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:
Sally Coolatta 2021-12-28 12:49:33 -05:00
parent a7022af93f
commit d3f8e61591
5 changed files with 43 additions and 24 deletions

View file

@ -26,22 +26,23 @@
// Button/action code definitions. // Button/action code definitions.
typedef enum typedef enum
{ {
BT_ACCELERATE = 1, // Accelerate BT_ACCELERATE = 1, // Accelerate
BT_DRIFT = 1<<2, // Drift (direction is cmd->turning) BT_DRIFT = 1<<2, // Drift (direction is cmd->turning)
BT_BRAKE = 1<<3, // Brake BT_BRAKE = 1<<3, // Brake
BT_ATTACK = 1<<4, // Use Item BT_ATTACK = 1<<4, // Use Item
BT_FORWARD = 1<<5, // Aim Item Forward BT_FORWARD = 1<<5, // Aim Item Forward
BT_BACKWARD = 1<<6, // Aim Item Backward BT_BACKWARD = 1<<6, // Aim Item Backward
BT_LOOKBACK = 1<<7, // Look Backward BT_LOOKBACK = 1<<7, // Look Backward
BT_EBRAKEMASK = (BT_ACCELERATE|BT_BRAKE), BT_EBRAKEMASK = (BT_ACCELERATE|BT_BRAKE),
BT_SPINDASHMASK = (BT_ACCELERATE|BT_BRAKE|BT_DRIFT),
// free: 1<<9 to 1<<12 // free: 1<<9 to 1<<12
// Lua garbage // Lua garbage
BT_CUSTOM1 = 1<<13, BT_LUAA = 1<<13,
BT_CUSTOM2 = 1<<14, BT_LUAB = 1<<14,
BT_CUSTOM3 = 1<<15, BT_LUAC = 1<<15,
} buttoncode_t; } buttoncode_t;
// The data sampled per tick (single player) // The data sampled per tick (single player)

View file

@ -6661,9 +6661,9 @@ struct int_const_s const INT_CONST[] = {
{"BT_ATTACK",BT_ATTACK}, {"BT_ATTACK",BT_ATTACK},
{"BT_FORWARD",BT_FORWARD}, {"BT_FORWARD",BT_FORWARD},
{"BT_BACKWARD",BT_BACKWARD}, {"BT_BACKWARD",BT_BACKWARD},
{"BT_CUSTOM1",BT_CUSTOM1}, // Lua customizable {"BT_LUAA",BT_LUAA}, // Lua customizable
{"BT_CUSTOM2",BT_CUSTOM2}, // Lua customizable {"BT_LUAB",BT_LUAB}, // Lua customizable
{"BT_CUSTOM3",BT_CUSTOM3}, // Lua customizable {"BT_LUAC",BT_LUAC}, // Lua customizable
// Lua command registration flags // Lua command registration flags
{"COM_ADMIN",COM_ADMIN}, {"COM_ADMIN",COM_ADMIN},

View file

@ -956,7 +956,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
else else
{ {
// forward with key or button // SRB2kart - we use an accel/brake instead of forward/backward. // 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) if (value != 0)
{ {
cmd->buttons |= BT_ACCELERATE; 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)) 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; 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)) if (G_PlayerInputDown(forplayer, gc_y, 0))
{ {
cmd->buttons |= BT_LOOKBACK; 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... // spectator aiming shit, ahhhh...
/* /*
{ {

View file

@ -18,6 +18,7 @@
#include "hu_stuff.h" // need HUFONT start & end #include "hu_stuff.h" // need HUFONT start & end
#include "d_net.h" #include "d_net.h"
#include "console.h" #include "console.h"
#include "i_joy.h" // JOYAXISRANGE
#define MAXMOUSESENSITIVITY 100 // sensitivity steps #define MAXMOUSESENSITIVITY 100 // sensitivity steps
@ -118,7 +119,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_keydown: case ev_keydown:
if (ev->data1 < NUMINPUTS) if (ev->data1 < NUMINPUTS)
{ {
gamekeydown[ev->device][ev->data1] = FRACUNIT; gamekeydown[ev->device][ev->data1] = JOYAXISRANGE;
} }
#ifdef PARANOIA #ifdef PARANOIA
else else
@ -404,6 +405,9 @@ static const char *gamecontrolname[num_gamecontrols] =
"r", "r",
"start", "start",
"abc", "abc",
"luaa",
"luab",
"luac",
"console", "console",
"talk", "talk",
"teamtalk", "teamtalk",

View file

@ -67,13 +67,15 @@ typedef enum
// special keys // special keys
gc_abc, gc_abc,
gc_luaa,
gc_luab,
gc_luac,
gc_console, gc_console,
gc_talk, gc_talk,
gc_teamtalk, gc_teamtalk,
gc_screenshot, gc_screenshot,
gc_recordgif, gc_recordgif,
num_gamecontrols num_gamecontrols
} gamecontrols_e; } gamecontrols_e;