listunusedsprites command

First, simple step in a cross-low-energy spare-moment project for clearing out unused SRB2 stuff in the info tables
This commit is contained in:
toaster 2023-04-25 23:19:23 +01:00
parent df5c866573
commit 8733f16a72

View file

@ -135,6 +135,7 @@ static void Command_Addfile(void);
static void Command_ListWADS_f(void);
static void Command_ListDoomednums_f(void);
static void Command_cxdiag_f(void);
static void Command_ListUnusedSprites_f(void);
static void Command_RunSOC(void);
static void Command_Pause(void);
@ -398,6 +399,7 @@ void D_RegisterServerCommands(void)
COM_AddDebugCommand("listwad", Command_ListWADS_f);
COM_AddDebugCommand("listmapthings", Command_ListDoomednums_f);
COM_AddDebugCommand("cxdiag", Command_cxdiag_f);
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
COM_AddCommand("runsoc", Command_RunSOC);
COM_AddCommand("pause", Command_Pause);
@ -4992,6 +4994,46 @@ static void Command_cxdiag_f(void)
CONS_Printf("\x83""No errors detected! Good job\n");
}
void Command_ListUnusedSprites_f(void)
{
size_t i, j;
CONS_Printf("\x82Printing sprite non-usage...\n");
for (i = 0; i < NUMSPRITES; i++)
{
if (sprites[i].numframes)
{
// We're only showing unused sprites...
continue;
}
if (i < SPR_FIRSTFREESLOT)
{
CONS_Printf(" \x87""hardcode SPR_""%.4s\n", sprnames[i]);
continue;
}
if (used_spr[(i-SPR_FIRSTFREESLOT)/8] == 0xFF)
{
for (j = 0; j < 8; j++)
{
CONS_Printf(" \x81""freeslot SPR_""%.4s\n", sprnames[i+j]);
}
i += j;
}
if (used_spr[(i-SPR_FIRSTFREESLOT)/8] & (1<<(i%8)))
{
CONS_Printf(" \x81""freeslot SPR_""%.4s\n", sprnames[i]);
continue;
}
break;
}
}
// =========================================================================
// MISC. COMMANDS
// =========================================================================