diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 59f5ccc7a..a36915d66 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -196,6 +196,9 @@ 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}}; static CV_PossibleValue_t timetic_cons_t[] = {{0, "Normal"}, {1, "Tics"}, {2, "Centiseconds"}, {0, NULL}}; +consvar_t cv_timetic = {"timerres", "Normal", CV_SAVE, timetic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display + +consvar_t cv_showinputjoy = {"showinputjoy", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #ifdef NETGAME_DEVMODE static consvar_t cv_fishcake = {"fishcake", "Off", CV_CALL|CV_NOSHOWHELP|CV_RESTRICT, CV_OnOff, Fishcake_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -319,7 +322,6 @@ consvar_t cv_overtime = {"overtime", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, consvar_t cv_rollingdemos = {"rollingdemos", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_timetic = {"timerres", "Normal", CV_SAVE, timetic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t pointlimit_cons_t[] = {{0, "MIN"}, {999999990, "MAX"}, {0, NULL}}; @@ -672,6 +674,7 @@ void D_RegisterClientCommands(void) // HUD CV_RegisterVar(&cv_timetic); CV_RegisterVar(&cv_itemfinder); + CV_RegisterVar(&cv_showinputjoy); // time attack ghost options are also saved to config CV_RegisterVar(&cv_ghost_bestscore); diff --git a/src/doomstat.h b/src/doomstat.h index 0d763a5a9..c13b1db5a 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -494,6 +494,7 @@ extern boolean singletics; #include "d_clisrv.h" extern consvar_t cv_timetic; // display high resolution timer +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. extern ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS]; diff --git a/src/g_game.c b/src/g_game.c index e31cd8e3b..837191a3c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5067,13 +5067,16 @@ void G_BeginRecording(void) { UINT8 buf = 0; if (player->pflags & PF_FLIPCAM) - buf |= 1; + buf |= 0x01; if (player->pflags & PF_ANALOGMODE) - buf |= 2; + buf |= 0x02; if (player->pflags & PF_DIRECTIONCHAR) - buf |= 4; + buf |= 0x04; if (player->pflags & PF_AUTOBRAKE) - buf |= 8; + buf |= 0x08; + if (cv_usejoystick.value) + buf |= 0x10; + CV_SetValue(&cv_showinputjoy, !!(cv_usejoystick.value)); WRITEUINT8(demo_p,buf); } @@ -5454,14 +5457,15 @@ void G_DoPlayDemo(char *defdemoname) { UINT8 buf = READUINT8(demo_p); pflags = 0; - if (buf & 1) + if (buf & 0x01) pflags |= PF_FLIPCAM; - if (buf & 2) + if (buf & 0x02) pflags |= PF_ANALOGMODE; - if (buf & 4) + if (buf & 0x04) pflags |= PF_DIRECTIONCHAR; - if (buf & 8) + if (buf & 0x08) pflags |= PF_AUTOBRAKE; + CV_SetValue(&cv_showinputjoy, !!(buf & 0x10)); } // net var data diff --git a/src/p_user.c b/src/p_user.c index f4c57bcc6..788fe02d8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9849,7 +9849,7 @@ void P_PlayerThink(player_t *player) } } - // Autobrake! + // Autobrake! check ST_drawInput if you modify this { boolean currentlyonground = P_IsObjectOnGround(player->mo); diff --git a/src/st_stuff.c b/src/st_stuff.c index 66907036e..605c68d8d 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -779,6 +779,170 @@ static void ST_drawLives(void) } } +static void ST_drawInput(void) +{ + //const INT32 v_splitflag = (splitscreen && stplyr == &players[displayplayer] ? V_SPLITSCREEN : 0); -- no splitscreen support - record attack only for base game + const UINT8 accent = (stplyr->skincolor ? Color_Index[stplyr->skincolor-1][4] : 0); + UINT8 col, offs; + + if (stplyr->pflags & PF_AUTOBRAKE) + { + V_DrawThinString(hudinfo[HUD_LIVESPIC].x-2, hudinfo[HUD_LIVESPIC].y-13, + ((!stplyr->powers[pw_carry] + && (stplyr->pflags & PF_APPLYAUTOBRAKE) + && !(stplyr->cmd.sidemove || stplyr->cmd.forwardmove) + && (stplyr->rmomx || stplyr->rmomy)) + ? 0 : V_GRAYMAP), + "AUTOBRAKE"); + } + + if (cv_showinputjoy.value) // joystick render! + { + /*V_DrawFill(hudinfo[HUD_LIVESPIC].x , hudinfo[HUD_LIVESPIC].y , 16, 1, 16); + V_DrawFill(hudinfo[HUD_LIVESPIC].x , hudinfo[HUD_LIVESPIC].y+15, 16, 1, 16); + V_DrawFill(hudinfo[HUD_LIVESPIC].x , hudinfo[HUD_LIVESPIC].y+ 1, 1, 14, 16); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+15, hudinfo[HUD_LIVESPIC].y+ 1, 1, 14, 16); -- red's outline*/ + V_DrawFill(hudinfo[HUD_LIVESPIC].x , hudinfo[HUD_LIVESPIC].y , 16, 16, 20); // O backing + if (stplyr->cmd.sidemove || stplyr->cmd.forwardmove) + { + V_DrawFill(hudinfo[HUD_LIVESPIC].x+5, hudinfo[HUD_LIVESPIC].y+5, 6, 6, 29); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+3+stplyr->cmd.sidemove/12, + hudinfo[HUD_LIVESPIC].y+3-stplyr->cmd.forwardmove/12, + 10, 10, 29); + } + V_DrawFill(hudinfo[HUD_LIVESPIC].x+3+stplyr->cmd.sidemove/9, + hudinfo[HUD_LIVESPIC].y+3-stplyr->cmd.forwardmove/9, + 10, 10, ((stplyr->cmd.sidemove || stplyr->cmd.forwardmove) ? accent : 16)); + } + else // arrows! + { + V_DrawFill(hudinfo[HUD_LIVESPIC].x, hudinfo[HUD_LIVESPIC].y-1, 16, 16, 20); // O backing + // underside of base + /*if (stplyr->cmd.forwardmove > 0) + V_DrawFill(hudinfo[HUD_LIVESPIC].x, hudinfo[HUD_LIVESPIC].y+14, 16, 2, 29); + else if (!stplyr->cmd.forwardmove)*/ + V_DrawFill(hudinfo[HUD_LIVESPIC].x, hudinfo[HUD_LIVESPIC].y+15, 16, 1, 29); + + // < + if (stplyr->cmd.sidemove < 0) + { + offs = 0; + col = accent; + } + else + { + offs = 1; + col = 16; + V_DrawFill(hudinfo[HUD_LIVESPIC].x- 2, hudinfo[HUD_LIVESPIC].y+10, 6, 1, 29); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 4, hudinfo[HUD_LIVESPIC].y+ 9, 1, 1, 29); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 5, hudinfo[HUD_LIVESPIC].y+ 8, 1, 1, 29); + } + V_DrawFill(hudinfo[HUD_LIVESPIC].x- 2, hudinfo[HUD_LIVESPIC].y+ 5-offs, 6, 6, col); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 4, hudinfo[HUD_LIVESPIC].y+ 6-offs, 1, 4, col); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 5, hudinfo[HUD_LIVESPIC].y+ 7-offs, 1, 2, col); + + // ^ + if (stplyr->cmd.forwardmove > 0) + { + offs = 0; + col = accent; + } + else + { + offs = 1; + col = 16; + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 5, hudinfo[HUD_LIVESPIC].y+ 3, 1, 1, 29); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 6, hudinfo[HUD_LIVESPIC].y+ 4, 1, 1, 29); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 7, hudinfo[HUD_LIVESPIC].y+ 5, 2, 1, 29); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 9, hudinfo[HUD_LIVESPIC].y+ 4, 1, 1, 29); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+10, hudinfo[HUD_LIVESPIC].y+ 3, 1, 1, 29); + } + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 5, hudinfo[HUD_LIVESPIC].y- 2-offs, 6, 6, col); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 6, hudinfo[HUD_LIVESPIC].y+ 4-offs, 4, 1, col); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 7, hudinfo[HUD_LIVESPIC].y+ 5-offs, 2, 1, col); + + // > + if (stplyr->cmd.sidemove > 0) + { + offs = 0; + col = accent; + } + else + { + offs = 1; + col = 16; + V_DrawFill(hudinfo[HUD_LIVESPIC].x+12, hudinfo[HUD_LIVESPIC].y+10, 6, 1, 29); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+11, hudinfo[HUD_LIVESPIC].y+ 9, 1, 1, 29); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+10, hudinfo[HUD_LIVESPIC].y+ 8, 1, 1, 29); + } + V_DrawFill(hudinfo[HUD_LIVESPIC].x+12, hudinfo[HUD_LIVESPIC].y+ 5-offs, 6, 6, col); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+11, hudinfo[HUD_LIVESPIC].y+ 6-offs, 1, 4, col); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+10, hudinfo[HUD_LIVESPIC].y+ 7-offs, 1, 2, col); + + // v + if (stplyr->cmd.forwardmove < 0) + { + offs = 0; + col = accent; + } + else + { + offs = 1; + col = 16; + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 5, hudinfo[HUD_LIVESPIC].y+17, 6, 1, 29); + } + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 5, hudinfo[HUD_LIVESPIC].y+12-offs, 6, 6, col); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 6, hudinfo[HUD_LIVESPIC].y+11-offs, 4, 1, col); + V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 7, hudinfo[HUD_LIVESPIC].y+10-offs, 2, 1, col); + } + +#define drawbutt(xoffs, yoffs, butt, symb)\ + if (stplyr->cmd.buttons & butt)\ + {\ + offs = 0;\ + col = accent;\ + }\ + else\ + {\ + offs = 1;\ + col = 16;\ + V_DrawFill(hudinfo[HUD_LIVESPIC].x+16+(xoffs), hudinfo[HUD_LIVESPIC].y+9+(yoffs), 10, 1, 29);\ + }\ + V_DrawFill(hudinfo[HUD_LIVESPIC].x+16+(xoffs), hudinfo[HUD_LIVESPIC].y+(yoffs)-offs, 10, 10, col);\ + V_DrawCharacter(hudinfo[HUD_LIVESPIC].x+16+1+(xoffs), hudinfo[HUD_LIVESPIC].y+1+(yoffs)-offs, symb, false) + + drawbutt( 4,-3, BT_JUMP, 'J'); + drawbutt(15,-3, BT_USE, 'S'); + + if (stplyr->mo) + { + UINT8 i, precision; + angle_t ang = (stplyr->mo->angle - R_PointToAngle(stplyr->mo->x, stplyr->mo->y))>>ANGLETOFINESHIFT; + fixed_t xcomp = FINESINE(ang)>>13; + fixed_t ycomp = FINECOSINE(ang)>>14; + if (ycomp == 4) + ycomp = 3; + + V_DrawFill(hudinfo[HUD_LIVESPIC].x+16+4, hudinfo[HUD_LIVESPIC].y+8, 21, 10, 20); // sundial backing + + if (ycomp > 0) + V_DrawFill(hudinfo[HUD_LIVESPIC].x+16+13-xcomp, hudinfo[HUD_LIVESPIC].y+11-ycomp, 3, 3, accent); // point (behind) + + precision = max(3, abs(xcomp)); + for (i = 0; i < precision; i++) + { + V_DrawFill(hudinfo[HUD_LIVESPIC].x+16+14-(i*xcomp)/precision, + hudinfo[HUD_LIVESPIC].y+12-(i*ycomp)/precision, + 1, 1, 16); + } + + if (ycomp <= 0) + V_DrawFill(hudinfo[HUD_LIVESPIC].x+16+13-xcomp, hudinfo[HUD_LIVESPIC].y+11-ycomp, 3, 3, accent); // point (in front) + } + +#undef drawbutt +} + static void ST_drawLevelTitle(void) { char *lvlttl = mapheaderinfo[gamemap-1]->lvlttl; @@ -1868,6 +2032,8 @@ static void ST_overlayDrawer(void) #endif ) ST_drawLives(); + else if (modeattacking) + ST_drawInput(); } }