mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
In-game control shenanigans
- Fix gamekeydown using FRACUNIT instead of JOYAXISRANGE - Re-add spindash button functionality - I put custom buttons back ... but they're now called "Lua" buttons A thru C because Custom was a dumb misleading name
This commit is contained in:
parent
a7022af93f
commit
d3f8e61591
5 changed files with 43 additions and 24 deletions
|
|
@ -26,22 +26,23 @@
|
|||
// Button/action code definitions.
|
||||
typedef enum
|
||||
{
|
||||
BT_ACCELERATE = 1, // Accelerate
|
||||
BT_DRIFT = 1<<2, // Drift (direction is cmd->turning)
|
||||
BT_BRAKE = 1<<3, // Brake
|
||||
BT_ATTACK = 1<<4, // Use Item
|
||||
BT_FORWARD = 1<<5, // Aim Item Forward
|
||||
BT_BACKWARD = 1<<6, // Aim Item Backward
|
||||
BT_LOOKBACK = 1<<7, // Look Backward
|
||||
BT_ACCELERATE = 1, // Accelerate
|
||||
BT_DRIFT = 1<<2, // Drift (direction is cmd->turning)
|
||||
BT_BRAKE = 1<<3, // Brake
|
||||
BT_ATTACK = 1<<4, // Use Item
|
||||
BT_FORWARD = 1<<5, // Aim Item Forward
|
||||
BT_BACKWARD = 1<<6, // Aim Item Backward
|
||||
BT_LOOKBACK = 1<<7, // Look Backward
|
||||
|
||||
BT_EBRAKEMASK = (BT_ACCELERATE|BT_BRAKE),
|
||||
BT_SPINDASHMASK = (BT_ACCELERATE|BT_BRAKE|BT_DRIFT),
|
||||
|
||||
// free: 1<<9 to 1<<12
|
||||
|
||||
// Lua garbage
|
||||
BT_CUSTOM1 = 1<<13,
|
||||
BT_CUSTOM2 = 1<<14,
|
||||
BT_CUSTOM3 = 1<<15,
|
||||
BT_LUAA = 1<<13,
|
||||
BT_LUAB = 1<<14,
|
||||
BT_LUAC = 1<<15,
|
||||
} buttoncode_t;
|
||||
|
||||
// The data sampled per tick (single player)
|
||||
|
|
|
|||
|
|
@ -6661,9 +6661,9 @@ struct int_const_s const INT_CONST[] = {
|
|||
{"BT_ATTACK",BT_ATTACK},
|
||||
{"BT_FORWARD",BT_FORWARD},
|
||||
{"BT_BACKWARD",BT_BACKWARD},
|
||||
{"BT_CUSTOM1",BT_CUSTOM1}, // Lua customizable
|
||||
{"BT_CUSTOM2",BT_CUSTOM2}, // Lua customizable
|
||||
{"BT_CUSTOM3",BT_CUSTOM3}, // Lua customizable
|
||||
{"BT_LUAA",BT_LUAA}, // Lua customizable
|
||||
{"BT_LUAB",BT_LUAB}, // Lua customizable
|
||||
{"BT_LUAC",BT_LUAC}, // Lua customizable
|
||||
|
||||
// Lua command registration flags
|
||||
{"COM_ADMIN",COM_ADMIN},
|
||||
|
|
|
|||
30
src/g_game.c
30
src/g_game.c
|
|
@ -956,7 +956,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
else
|
||||
{
|
||||
// forward with key or button // SRB2kart - we use an accel/brake instead of forward/backward.
|
||||
fixed_t value = G_PlayerInputAnalog(forplayer, gc_a, 0);
|
||||
INT32 value = G_PlayerInputAnalog(forplayer, gc_a, 0);
|
||||
if (value != 0)
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
|
|
@ -982,24 +982,36 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
}
|
||||
}
|
||||
|
||||
// fire with any button/key
|
||||
// drift
|
||||
if (G_PlayerInputDown(forplayer, gc_c, 0))
|
||||
{
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
}
|
||||
|
||||
// drift with any button/key
|
||||
if (G_PlayerInputDown(forplayer, gc_x, 0))
|
||||
{
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
}
|
||||
|
||||
// rear view with any button/key
|
||||
// A + B + C shortcut
|
||||
if (G_PlayerInputDown(forplayer, gc_abc, 0))
|
||||
{
|
||||
forward = 0;
|
||||
cmd->buttons |= BT_SPINDASHMASK;
|
||||
}
|
||||
|
||||
// fire
|
||||
if (G_PlayerInputDown(forplayer, gc_x, 0))
|
||||
{
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
}
|
||||
|
||||
// rear view
|
||||
if (G_PlayerInputDown(forplayer, gc_y, 0))
|
||||
{
|
||||
cmd->buttons |= BT_LOOKBACK;
|
||||
}
|
||||
|
||||
// lua buttons a thru c
|
||||
if (G_PlayerInputDown(forplayer, gc_luaa, 0)) { cmd->buttons |= BT_LUAA; }
|
||||
if (G_PlayerInputDown(forplayer, gc_luab, 0)) { cmd->buttons |= BT_LUAB; }
|
||||
if (G_PlayerInputDown(forplayer, gc_luac, 0)) { cmd->buttons |= BT_LUAC; }
|
||||
|
||||
// spectator aiming shit, ahhhh...
|
||||
/*
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "hu_stuff.h" // need HUFONT start & end
|
||||
#include "d_net.h"
|
||||
#include "console.h"
|
||||
#include "i_joy.h" // JOYAXISRANGE
|
||||
|
||||
#define MAXMOUSESENSITIVITY 100 // sensitivity steps
|
||||
|
||||
|
|
@ -118,7 +119,7 @@ void G_MapEventsToControls(event_t *ev)
|
|||
case ev_keydown:
|
||||
if (ev->data1 < NUMINPUTS)
|
||||
{
|
||||
gamekeydown[ev->device][ev->data1] = FRACUNIT;
|
||||
gamekeydown[ev->device][ev->data1] = JOYAXISRANGE;
|
||||
}
|
||||
#ifdef PARANOIA
|
||||
else
|
||||
|
|
@ -404,6 +405,9 @@ static const char *gamecontrolname[num_gamecontrols] =
|
|||
"r",
|
||||
"start",
|
||||
"abc",
|
||||
"luaa",
|
||||
"luab",
|
||||
"luac",
|
||||
"console",
|
||||
"talk",
|
||||
"teamtalk",
|
||||
|
|
|
|||
|
|
@ -67,12 +67,14 @@ typedef enum
|
|||
|
||||
// special keys
|
||||
gc_abc,
|
||||
gc_luaa,
|
||||
gc_luab,
|
||||
gc_luac,
|
||||
gc_console,
|
||||
gc_talk,
|
||||
gc_teamtalk,
|
||||
gc_screenshot,
|
||||
gc_recordgif,
|
||||
|
||||
|
||||
num_gamecontrols
|
||||
} gamecontrols_e;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue