Merge branch 'showinput' into 'next'

Allow input view outside of record attack

See merge request STJr/SRB2!2020
This commit is contained in:
sphere 2024-02-25 14:16:44 +00:00
commit 553240f7c2
6 changed files with 51 additions and 40 deletions

View file

@ -4834,6 +4834,7 @@ const char *const POWERS_LIST[] = {
const char *const HUDITEMS_LIST[] = {
"LIVES",
"INPUT",
"RINGS",
"RINGSNUM",

View file

@ -638,6 +638,7 @@ extern boolean singletics;
extern consvar_t cv_timetic; // display high resolution timer
extern consvar_t cv_powerupdisplay; // display powerups
extern consvar_t cv_showinput; // display input viewer outside of time attack
extern consvar_t cv_showinputjoy; // display joystick in time attack
extern consvar_t cv_forceskin; // force clients to use the server's skin
extern consvar_t cv_downloading; // allow clients to downloading WADs.

View file

@ -24,6 +24,7 @@ enum hud {
hud_time,
hud_rings,
hud_lives,
hud_input,
// Match / CTF / Tag / Ringslinger
hud_weaponrings,
hud_powerstones,

View file

@ -209,6 +209,7 @@ static CV_PossibleValue_t matchboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"},
static CV_PossibleValue_t chances_cons_t[] = {{0, "MIN"}, {9, "MAX"}, {0, NULL}};
static CV_PossibleValue_t pause_cons_t[] = {{0, "Server"}, {1, "All"}, {0, NULL}};
consvar_t cv_showinput = CVAR_INIT ("showinput", "Off", CV_ALLOWLUA, CV_OnOff, NULL);
consvar_t cv_showinputjoy = CVAR_INIT ("showinputjoy", "Off", CV_ALLOWLUA, CV_OnOff, NULL);
#ifdef NETGAME_DEVMODE
@ -736,6 +737,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_timetic);
CV_RegisterVar(&cv_powerupdisplay);
CV_RegisterVar(&cv_itemfinder);
CV_RegisterVar(&cv_showinput);
CV_RegisterVar(&cv_showinputjoy);
// time attack ghost options are also saved to config

View file

@ -139,6 +139,7 @@ static patch_t *fireflower;
hudinfo_t hudinfo[NUMHUDITEMS] =
{
{ 16, 176, V_SNAPTOLEFT|V_SNAPTOBOTTOM}, // HUD_LIVES
{ 16, 152, V_SNAPTOLEFT|V_SNAPTOBOTTOM}, // HUD_INPUT
{ 16, 42, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_RINGS
{ 96, 42, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_RINGSNUM
@ -1037,32 +1038,36 @@ static void ST_drawInput(void)
INT32 col;
UINT8 offs;
INT32 x = hudinfo[HUD_LIVES].x, y = hudinfo[HUD_LIVES].y;
INT32 x = hudinfo[HUD_INPUT].x, y = hudinfo[HUD_INPUT].y;
if (stplyr->powers[pw_carry] == CR_NIGHTSMODE)
y -= 16;
y += 8;
else if (modeattacking || !LUA_HudEnabled(hud_lives))
y += 24;
else if (G_RingSlingerGametype() && LUA_HudEnabled(hud_powerstones))
y -= 5;
if (F_GetPromptHideHud(y))
return;
// O backing
V_DrawFill(x, y-1, 16, 16, hudinfo[HUD_LIVES].f|20);
V_DrawFill(x, y+15, 16, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x, y-1, 16, 16, hudinfo[HUD_INPUT].f|20);
V_DrawFill(x, y+15, 16, 1, hudinfo[HUD_INPUT].f|29);
if (cv_showinputjoy.value) // joystick render!
{
/*V_DrawFill(x , y , 16, 1, hudinfo[HUD_LIVES].f|16);
V_DrawFill(x , y+15, 16, 1, hudinfo[HUD_LIVES].f|16);
V_DrawFill(x , y+ 1, 1, 14, hudinfo[HUD_LIVES].f|16);
V_DrawFill(x+15, y+ 1, 1, 14, hudinfo[HUD_LIVES].f|16); -- red's outline*/
/*V_DrawFill(x , y , 16, 1, hudinfo[HUD_INPUT.f|16);
V_DrawFill(x , y+15, 16, 1, hudinfo[HUD_INPUT].f|16);
V_DrawFill(x , y+ 1, 1, 14, hudinfo[HUD_INPUT].f|16);
V_DrawFill(x+15, y+ 1, 1, 14, hudinfo[HUD_INPUT].f|16); -- red's outline*/
if (stplyr->cmd.sidemove || stplyr->cmd.forwardmove)
{
// joystick hole
V_DrawFill(x+5, y+4, 6, 6, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+5, y+4, 6, 6, hudinfo[HUD_INPUT].f|29);
// joystick top
V_DrawFill(x+3+stplyr->cmd.sidemove/12,
y+2-stplyr->cmd.forwardmove/12,
10, 10, hudinfo[HUD_LIVES].f|29);
10, 10, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+3+stplyr->cmd.sidemove/9,
y+1-stplyr->cmd.forwardmove/9,
10, 10, accent);
@ -1070,10 +1075,10 @@ static void ST_drawInput(void)
else
{
// just a limited, greyed out joystick top
V_DrawFill(x+3, y+11, 10, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+3, y+11, 10, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+3,
y+1,
10, 10, hudinfo[HUD_LIVES].f|16);
10, 10, hudinfo[HUD_INPUT].f|16);
}
}
else // arrows!
@ -1087,10 +1092,10 @@ static void ST_drawInput(void)
else
{
offs = 1;
col = hudinfo[HUD_LIVES].f|16;
V_DrawFill(x- 2, y+10, 6, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 4, y+ 9, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 5, y+ 8, 1, 1, hudinfo[HUD_LIVES].f|29);
col = hudinfo[HUD_INPUT].f|16;
V_DrawFill(x- 2, y+10, 6, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 4, y+ 9, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 5, y+ 8, 1, 1, hudinfo[HUD_INPUT].f|29);
}
V_DrawFill(x- 2, y+ 5-offs, 6, 6, col);
V_DrawFill(x+ 4, y+ 6-offs, 1, 4, col);
@ -1105,12 +1110,12 @@ static void ST_drawInput(void)
else
{
offs = 1;
col = hudinfo[HUD_LIVES].f|16;
V_DrawFill(x+ 5, y+ 3, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 6, y+ 4, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 7, y+ 5, 2, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+ 9, y+ 4, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+10, y+ 3, 1, 1, hudinfo[HUD_LIVES].f|29);
col = hudinfo[HUD_INPUT].f|16;
V_DrawFill(x+ 5, y+ 3, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 6, y+ 4, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 7, y+ 5, 2, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+ 9, y+ 4, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+10, y+ 3, 1, 1, hudinfo[HUD_INPUT].f|29);
}
V_DrawFill(x+ 5, y- 2-offs, 6, 6, col);
V_DrawFill(x+ 6, y+ 4-offs, 4, 1, col);
@ -1125,10 +1130,10 @@ static void ST_drawInput(void)
else
{
offs = 1;
col = hudinfo[HUD_LIVES].f|16;
V_DrawFill(x+12, y+10, 6, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+11, y+ 9, 1, 1, hudinfo[HUD_LIVES].f|29);
V_DrawFill(x+10, y+ 8, 1, 1, hudinfo[HUD_LIVES].f|29);
col = hudinfo[HUD_INPUT].f|16;
V_DrawFill(x+12, y+10, 6, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+11, y+ 9, 1, 1, hudinfo[HUD_INPUT].f|29);
V_DrawFill(x+10, y+ 8, 1, 1, hudinfo[HUD_INPUT].f|29);
}
V_DrawFill(x+12, y+ 5-offs, 6, 6, col);
V_DrawFill(x+11, y+ 6-offs, 1, 4, col);
@ -1143,8 +1148,8 @@ static void ST_drawInput(void)
else
{
offs = 1;
col = hudinfo[HUD_LIVES].f|16;
V_DrawFill(x+ 5, y+17, 6, 1, hudinfo[HUD_LIVES].f|29);
col = hudinfo[HUD_INPUT].f|16;
V_DrawFill(x+ 5, y+17, 6, 1, hudinfo[HUD_INPUT].f|29);
}
V_DrawFill(x+ 5, y+12-offs, 6, 6, col);
V_DrawFill(x+ 6, y+11-offs, 4, 1, col);
@ -1160,16 +1165,16 @@ static void ST_drawInput(void)
else\
{\
offs = 1;\
col = hudinfo[HUD_LIVES].f|16;\
V_DrawFill(x+16+(xoffs), y+9+(yoffs), 10, 1, hudinfo[HUD_LIVES].f|29);\
col = hudinfo[HUD_INPUT].f|16;\
V_DrawFill(x+16+(xoffs), y+9+(yoffs), 10, 1, hudinfo[HUD_INPUT].f|29);\
}\
V_DrawFill(x+16+(xoffs), y+(yoffs)-offs, 10, 10, col);\
V_DrawCharacter(x+16+1+(xoffs), y+1+(yoffs)-offs, hudinfo[HUD_LIVES].f|symb, false)
V_DrawCharacter(x+16+1+(xoffs), y+1+(yoffs)-offs, hudinfo[HUD_INPUT].f|symb, false)
drawbutt( 4,-3, BT_JUMP, 'J');
drawbutt(15,-3, BT_SPIN, 'S');
V_DrawFill(x+16+4, y+8, 21, 10, hudinfo[HUD_LIVES].f|20); // sundial backing
V_DrawFill(x+16+4, y+8, 21, 10, hudinfo[HUD_INPUT].f|20); // sundial backing
if (stplyr->mo)
{
UINT8 i, precision;
@ -1189,7 +1194,7 @@ static void ST_drawInput(void)
{
V_DrawFill(x+16+14-(i*xcomp)/precision,
y+12-(i*ycomp)/precision,
1, 1, hudinfo[HUD_LIVES].f|16);
1, 1, hudinfo[HUD_INPUT].f|16);
}
if (ycomp <= 0)
@ -1206,7 +1211,7 @@ static void ST_drawInput(void)
if (stplyr->pflags & PF_AUTOBRAKE)
{
V_DrawThinString(x, y,
hudinfo[HUD_LIVES].f|
hudinfo[HUD_INPUT].f|
((!stplyr->powers[pw_carry]
&& (stplyr->pflags & PF_APPLYAUTOBRAKE)
&& !(stplyr->cmd.sidemove || stplyr->cmd.forwardmove)
@ -1219,22 +1224,22 @@ static void ST_drawInput(void)
switch (P_ControlStyle(stplyr))
{
case CS_LMAOGALOG:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "ANALOG");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f, "ANALOG");
y -= 8;
break;
case CS_SIMPLE:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "AUTOMATIC");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f, "AUTOMATIC");
y -= 8;
break;
case CS_STANDARD:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "MANUAL");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f, "MANUAL");
y -= 8;
break;
case CS_LEGACY:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "STRAFE");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f, "STRAFE");
y -= 8;
break;
@ -1243,7 +1248,7 @@ static void ST_drawInput(void)
}
}
if (!demosynced) // should always be last, so it doesn't push anything else around
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f|((leveltime & 4) ? V_YELLOWMAP : V_REDMAP), "BAD DEMO!!");
V_DrawThinString(x, y, hudinfo[HUD_INPUT].f|((leveltime & 4) ? V_YELLOWMAP : V_REDMAP), "BAD DEMO!!");
}
static patch_t *lt_patches[3];
@ -2844,7 +2849,7 @@ static void ST_overlayDrawer(void)
if (!hu_showscores && (netgame || multiplayer) && LUA_HudEnabled(hud_textspectator))
ST_drawTextHUD();
if (modeattacking && !(demoplayback && hu_showscores))
if ((cv_showinput.value && !players[displayplayer].spectator) || (modeattacking && !(demoplayback && hu_showscores)))
ST_drawInput();
ST_drawDebugInfo();

View file

@ -92,6 +92,7 @@ typedef struct
typedef enum
{
HUD_LIVES,
HUD_INPUT,
HUD_RINGS,
HUD_RINGSNUM,