* "BAD DEMO!!" and "ANALOG" attachments to the input viewer

* Minor refactor
This commit is contained in:
toasterbabe 2017-10-18 13:22:57 +01:00
parent c7b2c43ae5
commit 0fe1f9d63b
3 changed files with 82 additions and 64 deletions

View file

@ -248,7 +248,7 @@ static UINT8 demoflags;
static UINT16 demoversion;
boolean singledemo; // quit after playing a demo from cmdline
boolean demo_start; // don't start playing demo right away
static boolean demosynced = true; // console warning message
boolean demosynced = true; // console warning message
boolean metalrecording; // recording as metal sonic
mobj_t *metalplayback;
@ -1683,6 +1683,7 @@ void G_DoLoadLevel(boolean resetplayer)
// Make sure objectplace is OFF when you first start the level!
OP_ResetObjectplace();
demosynced = true;
levelstarttic = gametic; // for time calculation
@ -5492,9 +5493,6 @@ void G_DoPlayDemo(char *defdemoname)
if (VERSION != version || SUBVERSION != subversion)
CONS_Alert(CONS_WARNING, M_GetText("Demo version does not match game version. Desyncs may occur.\n"));
// console warning messages
demosynced = true;
// didn't start recording right away.
demo_start = false;

View file

@ -41,6 +41,7 @@ extern boolean demoplayback, titledemo, demorecording, timingdemo;
// Quit after playing a demo from cmdline.
extern boolean singledemo;
extern boolean demo_start;
extern boolean demosynced;
extern mobj_t *metalplayback;

View file

@ -785,44 +785,41 @@ static void ST_drawInput(void)
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");
}
INT32 x = hudinfo[HUD_LIVESPIC].x, y = hudinfo[HUD_LIVESPIC].y;
// O backing
V_DrawFill(x, y-1, 16, 16, 20);
V_DrawFill(x, y+15, 16, 1, 29);
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
/*V_DrawFill(x , y , 16, 1, 16);
V_DrawFill(x , y+15, 16, 1, 16);
V_DrawFill(x , y+ 1, 1, 14, 16);
V_DrawFill(x+15, y+ 1, 1, 14, 16); -- red's outline*/
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,
// joystick hole
V_DrawFill(x+5, y+4, 6, 6, 29);
// joystick top
V_DrawFill(x+3+stplyr->cmd.sidemove/12,
y+2-stplyr->cmd.forwardmove/12,
10, 10, 29);
V_DrawFill(x+3+stplyr->cmd.sidemove/9,
y+1-stplyr->cmd.forwardmove/9,
10, 10, accent);
}
else
{
// just a limited, greyed out joystick top
V_DrawFill(x+3, y+11, 10, 1, 29);
V_DrawFill(x+3,
y+1,
10, 10, 16);
}
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)
{
@ -833,13 +830,13 @@ static void ST_drawInput(void)
{
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(x- 2, y+10, 6, 1, 29);
V_DrawFill(x+ 4, y+ 9, 1, 1, 29);
V_DrawFill(x+ 5, 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);
V_DrawFill(x- 2, y+ 5-offs, 6, 6, col);
V_DrawFill(x+ 4, y+ 6-offs, 1, 4, col);
V_DrawFill(x+ 5, y+ 7-offs, 1, 2, col);
// ^
if (stplyr->cmd.forwardmove > 0)
@ -851,15 +848,15 @@ static void ST_drawInput(void)
{
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(x+ 5, y+ 3, 1, 1, 29);
V_DrawFill(x+ 6, y+ 4, 1, 1, 29);
V_DrawFill(x+ 7, y+ 5, 2, 1, 29);
V_DrawFill(x+ 9, y+ 4, 1, 1, 29);
V_DrawFill(x+10, 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);
V_DrawFill(x+ 5, y- 2-offs, 6, 6, col);
V_DrawFill(x+ 6, y+ 4-offs, 4, 1, col);
V_DrawFill(x+ 7, y+ 5-offs, 2, 1, col);
// >
if (stplyr->cmd.sidemove > 0)
@ -871,13 +868,13 @@ static void ST_drawInput(void)
{
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(x+12, y+10, 6, 1, 29);
V_DrawFill(x+11, y+ 9, 1, 1, 29);
V_DrawFill(x+10, 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_DrawFill(x+12, y+ 5-offs, 6, 6, col);
V_DrawFill(x+11, y+ 6-offs, 1, 4, col);
V_DrawFill(x+10, y+ 7-offs, 1, 2, col);
// v
if (stplyr->cmd.forwardmove < 0)
@ -889,11 +886,11 @@ static void ST_drawInput(void)
{
offs = 1;
col = 16;
V_DrawFill(hudinfo[HUD_LIVESPIC].x+ 5, hudinfo[HUD_LIVESPIC].y+17, 6, 1, 29);
V_DrawFill(x+ 5, 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);
V_DrawFill(x+ 5, y+12-offs, 6, 6, col);
V_DrawFill(x+ 6, y+11-offs, 4, 1, col);
V_DrawFill(x+ 7, y+10-offs, 2, 1, col);
}
#define drawbutt(xoffs, yoffs, butt, symb)\
@ -906,10 +903,10 @@ static void ST_drawInput(void)
{\
offs = 1;\
col = 16;\
V_DrawFill(hudinfo[HUD_LIVESPIC].x+16+(xoffs), hudinfo[HUD_LIVESPIC].y+9+(yoffs), 10, 1, 29);\
V_DrawFill(x+16+(xoffs), 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)
V_DrawFill(x+16+(xoffs), y+(yoffs)-offs, 10, 10, col);\
V_DrawCharacter(x+16+1+(xoffs), y+1+(yoffs)-offs, symb, false)
drawbutt( 4,-3, BT_JUMP, 'J');
drawbutt(15,-3, BT_USE, 'S');
@ -923,24 +920,46 @@ static void ST_drawInput(void)
if (ycomp == 4)
ycomp = 3;
V_DrawFill(hudinfo[HUD_LIVESPIC].x+16+4, hudinfo[HUD_LIVESPIC].y+8, 21, 10, 20); // sundial backing
V_DrawFill(x+16+4, 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)
V_DrawFill(x+16+13-xcomp, 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,
V_DrawFill(x+16+14-(i*xcomp)/precision,
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)
V_DrawFill(x+16+13-xcomp, y+11-ycomp, 3, 3, accent); // point (in front)
}
#undef drawbutt
// text above
x -= 2;
y -= 13;
if (stplyr->pflags & PF_AUTOBRAKE)
{
V_DrawThinString(x, y,
((!stplyr->powers[pw_carry]
&& (stplyr->pflags & PF_APPLYAUTOBRAKE)
&& !(stplyr->cmd.sidemove || stplyr->cmd.forwardmove)
&& (stplyr->rmomx || stplyr->rmomy))
? 0 : V_GRAYMAP),
"AUTOBRAKE");
y -= 8;
}
if (stplyr->pflags & PF_ANALOGMODE)
{
V_DrawThinString(x, y, 0, "ANALOG");
y -= 8;
}
if (!demosynced) // should always be last, so it doesn't push anything else around
V_DrawThinString(x, y, ((leveltime & 2) ? V_YELLOWMAP : V_REDMAP), "BAD DEMO!!");
}
static void ST_drawLevelTitle(void)