Merge branch 'debug_stuff' into 'master'

Debug tweaks

See merge request STJr/SRB2Internal!144
This commit is contained in:
Digiku 2018-11-21 16:41:51 -05:00
commit e599428442
2 changed files with 127 additions and 125 deletions

View file

@ -446,7 +446,7 @@ extern INT32 cv_debug;
#define DBG_BASIC 0x0001 #define DBG_BASIC 0x0001
#define DBG_DETAILED 0x0002 #define DBG_DETAILED 0x0002
#define DBG_RANDOMIZER 0x0004 #define DBG_PLAYER 0x0004
#define DBG_RENDER 0x0008 #define DBG_RENDER 0x0008
#define DBG_NIGHTSBASIC 0x0010 #define DBG_NIGHTSBASIC 0x0010
#define DBG_NIGHTS 0x0020 #define DBG_NIGHTS 0x0020
@ -456,6 +456,7 @@ extern INT32 cv_debug;
#define DBG_MEMORY 0x0200 #define DBG_MEMORY 0x0200
#define DBG_SETUP 0x0400 #define DBG_SETUP 0x0400
#define DBG_LUA 0x0800 #define DBG_LUA 0x0800
#define DBG_RANDOMIZER 0x1000
// ======================= // =======================
// Misc stuff for later... // Misc stuff for later...

View file

@ -460,7 +460,8 @@ static void ST_DrawNightsOverlayNum(fixed_t x /* right border */, fixed_t y, fix
// Devmode information // Devmode information
static void ST_drawDebugInfo(void) static void ST_drawDebugInfo(void)
{ {
INT32 height = 0; INT32 height = 0, h = 8, w = 18, lowh;
void (*textfunc)(INT32, INT32, INT32, const char *);
if (!(stplyr->mo && cv_debug)) if (!(stplyr->mo && cv_debug))
return; return;
@ -469,35 +470,33 @@ static void ST_drawDebugInfo(void)
if ((moviemode == MM_GIF && cv_gif_downscale.value) || vid.dupx == 1) if ((moviemode == MM_GIF && cv_gif_downscale.value) || vid.dupx == 1)
{ {
if (cv_debug & DBG_BASIC) textfunc = V_DrawRightAlignedString;
{ lowh = ((vid.height/vid.dupy) - 16);
const fixed_t d = AngleFixed(stplyr->mo->angle);
V_DrawRightAlignedString(320, 0, VFLAGS, va("X: %6d", stplyr->mo->x>>FRACBITS));
V_DrawRightAlignedString(320, 8, VFLAGS, va("Y: %6d", stplyr->mo->y>>FRACBITS));
V_DrawRightAlignedString(320, 16, VFLAGS, va("Z: %6d", stplyr->mo->z>>FRACBITS));
V_DrawRightAlignedString(320, 24, VFLAGS, va("A: %6d", FixedInt(d)));
height += 4*9;
}
if (cv_debug & (DBG_MEMORY|DBG_RANDOMIZER|DBG_DETAILED))
{
V_DrawRightAlignedThinString(320, height, VFLAGS|V_REDMAP, "INFO NOT AVAILABLE");
V_DrawRightAlignedThinString(320, 8+height, VFLAGS|V_REDMAP, "AT THIS RESOLUTION");
}
} }
else else
{ {
#define h 4 textfunc = V_DrawRightAlignedSmallString;
#define dist 2 h /= 2;
#define V_DrawDebugLine(str) V_DrawRightAlignedSmallString(320, height, VFLAGS, str);\ w /= 2;
height += h lowh = 0;
}
#define V_DrawDebugLine(str) if (lowh && (height > lowh))\
{\
V_DrawRightAlignedThinString(320, 8+lowh, VFLAGS|V_REDMAP, "SOME INFO NOT VISIBLE");\
return;\
}\
textfunc(320, height, VFLAGS, str);\
height += h;
#define V_DrawDebugFlag(f, str) textfunc(width, height, VFLAGS|f, str);\
width -= w
if (cv_debug & DBG_MEMORY) if (cv_debug & DBG_MEMORY)
{ {
V_DrawDebugLine(va("Heap: %8sKB", sizeu1(Z_TotalUsage()>>10))); V_DrawDebugLine(va("Heap: %8sKB", sizeu1(Z_TotalUsage()>>10)));
height += dist; height += h/2;
} }
if (cv_debug & DBG_RANDOMIZER) // randomizer testing if (cv_debug & DBG_RANDOMIZER) // randomizer testing
@ -510,15 +509,13 @@ static void ST_drawDebugInfo(void)
V_DrawDebugLine(va("Seed: %08x", P_GetRandSeed())); V_DrawDebugLine(va("Seed: %08x", P_GetRandSeed()));
V_DrawDebugLine(va("== : .%04d", peekres)); V_DrawDebugLine(va("== : .%04d", peekres));
height += dist; height += h/2;
} }
if (cv_debug & DBG_DETAILED) if (cv_debug & DBG_PLAYER)
{ {
#define V_DrawDebugFlag(f, str) V_DrawRightAlignedSmallString(w, height, VFLAGS|f, str);\ INT32 width = 320;
w -= 9
const fixed_t d = AngleFixed(stplyr->drawangle); const fixed_t d = AngleFixed(stplyr->drawangle);
INT32 w = 320;
V_DrawDebugLine(va("SHIELD: %5x", stplyr->powers[pw_shield])); V_DrawDebugLine(va("SHIELD: %5x", stplyr->powers[pw_shield]));
V_DrawDebugLine(va("SCALE: %5d%%", (stplyr->mo->scale*100)>>FRACBITS)); V_DrawDebugLine(va("SCALE: %5d%%", (stplyr->mo->scale*100)>>FRACBITS));
@ -539,7 +536,7 @@ static void ST_drawDebugInfo(void)
V_DrawDebugFlag(((stplyr->pflags & PF_STARTJUMP) ? V_GREENMAP : V_REDMAP), "SJ"); V_DrawDebugFlag(((stplyr->pflags & PF_STARTJUMP) ? V_GREENMAP : V_REDMAP), "SJ");
V_DrawDebugFlag(0, "PF/SF:"); V_DrawDebugFlag(0, "PF/SF:");
height += h; height += h;
w = 320; width = 320;
V_DrawDebugFlag(((stplyr->pflags & PF_INVIS) ? V_GREENMAP : V_REDMAP), "*I"); V_DrawDebugFlag(((stplyr->pflags & PF_INVIS) ? V_GREENMAP : V_REDMAP), "*I");
V_DrawDebugFlag(((stplyr->pflags & PF_NOCLIP) ? V_GREENMAP : V_REDMAP), "*C"); V_DrawDebugFlag(((stplyr->pflags & PF_NOCLIP) ? V_GREENMAP : V_REDMAP), "*C");
V_DrawDebugFlag(((stplyr->pflags & PF_GODMODE) ? V_GREENMAP : V_REDMAP), "*G"); V_DrawDebugFlag(((stplyr->pflags & PF_GODMODE) ? V_GREENMAP : V_REDMAP), "*G");
@ -550,6 +547,15 @@ static void ST_drawDebugInfo(void)
V_DrawDebugFlag(((stplyr->pflags & PF_GLIDING) ? V_GREENMAP : V_REDMAP), "GL"); V_DrawDebugFlag(((stplyr->pflags & PF_GLIDING) ? V_GREENMAP : V_REDMAP), "GL");
height += h; height += h;
V_DrawDebugLine(va("DRAWANGLE: %6d", FixedInt(d)));
height += h/2;
}
if (cv_debug & DBG_DETAILED)
{
INT32 width = 320;
V_DrawDebugLine(va("CEILINGZ: %6d", stplyr->mo->ceilingz>>FRACBITS)); V_DrawDebugLine(va("CEILINGZ: %6d", stplyr->mo->ceilingz>>FRACBITS));
V_DrawDebugLine(va("FLOORZ: %6d", stplyr->mo->floorz>>FRACBITS)); V_DrawDebugLine(va("FLOORZ: %6d", stplyr->mo->floorz>>FRACBITS));
@ -557,7 +563,7 @@ static void ST_drawDebugInfo(void)
V_DrawDebugLine(va("CMOMY: %6d", stplyr->cmomy>>FRACBITS)); V_DrawDebugLine(va("CMOMY: %6d", stplyr->cmomy>>FRACBITS));
V_DrawDebugLine(va("PMOMZ: %6d", stplyr->mo->pmomz>>FRACBITS)); V_DrawDebugLine(va("PMOMZ: %6d", stplyr->mo->pmomz>>FRACBITS));
w = 320; width = 320;
V_DrawDebugFlag(((stplyr->mo->eflags & MFE_APPLYPMOMZ) ? V_GREENMAP : V_REDMAP), "AP"); V_DrawDebugFlag(((stplyr->mo->eflags & MFE_APPLYPMOMZ) ? V_GREENMAP : V_REDMAP), "AP");
V_DrawDebugFlag(((stplyr->mo->eflags & MFE_SPRUNG) ? V_GREENMAP : V_REDMAP), "SP"); V_DrawDebugFlag(((stplyr->mo->eflags & MFE_SPRUNG) ? V_GREENMAP : V_REDMAP), "SP");
//V_DrawDebugFlag(((stplyr->mo->eflags & MFE_PUSHED) ? V_GREENMAP : V_REDMAP), "PU"); -- not relevant to players //V_DrawDebugFlag(((stplyr->mo->eflags & MFE_PUSHED) ? V_GREENMAP : V_REDMAP), "PU"); -- not relevant to players
@ -577,10 +583,7 @@ static void ST_drawDebugInfo(void)
V_DrawDebugLine(va("SPEED: %6d", stplyr->speed>>FRACBITS)); V_DrawDebugLine(va("SPEED: %6d", stplyr->speed>>FRACBITS));
V_DrawDebugLine(va("DRAWANGLE: %6d", FixedInt(d))); height += h/2;
height += dist;
#undef V_DrawDebugFlag
} }
if (cv_debug & DBG_BASIC) if (cv_debug & DBG_BASIC)
@ -591,13 +594,11 @@ static void ST_drawDebugInfo(void)
V_DrawDebugLine(va("Z: %6d", stplyr->mo->z>>FRACBITS)); V_DrawDebugLine(va("Z: %6d", stplyr->mo->z>>FRACBITS));
V_DrawDebugLine(va("A: %6d", FixedInt(d))); V_DrawDebugLine(va("A: %6d", FixedInt(d)));
//height += dist; //height += h/2;
}
} }
#undef V_DrawDebugFlag
#undef V_DrawDebugLine #undef V_DrawDebugLine
#undef dist
#undef h
#undef VFLAGS #undef VFLAGS
} }