Add dumprrautomedaltimes console command

This commit is contained in:
Eidolon 2025-08-17 17:16:01 -05:00
parent 56fe6580e2
commit 8cb962ee19
3 changed files with 51 additions and 0 deletions

View file

@ -535,6 +535,7 @@ void D_RegisterClientCommands(void)
COM_AddCommand("startlossless", Command_StartLossless_f);
COM_AddCommand("stopmovie", Command_StopMovie_f);
COM_AddDebugCommand("minigen", M_MinimapGenerate);
COM_AddDebugCommand("dumprrautomedaltimes", Command_dumprrautomedaltimes);
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
M_AVRecorder_AddCommands();

View file

@ -9472,6 +9472,54 @@ UINT8 P_InitMapData(void)
return ret;
}
void Command_dumprrautomedaltimes(void)
{
FILE* out;
char outname[512];
memset(outname, 0, sizeof(outname));
sprintf(outname, "%s/rrautomedaltimes.csv", srb2home);
out = fopen(outname, "wb");
if (out == NULL)
{
CONS_Alert(CONS_ERROR, "Failed to dump rrautomedaltimes.csv\n");
return;
}
fprintf(out, "Name,Bronze,Silver,Gold,Platinum\n");
for (int i = 0; i < nummapheaders; ++i)
{
fprintf(out, "%s,", mapheaderinfo[i]->lvlttl);
fprintf(
out,
"%d'%d\"%02d,",
G_TicsToMinutes(mapheaderinfo[i]->automedaltime[3], true),
G_TicsToSeconds(mapheaderinfo[i]->automedaltime[3]),
G_TicsToCentiseconds(mapheaderinfo[i]->automedaltime[3])
);
fprintf(
out,
"%d'%d\"%02d,",
G_TicsToMinutes(mapheaderinfo[i]->automedaltime[2], true),
G_TicsToSeconds(mapheaderinfo[i]->automedaltime[2]),
G_TicsToCentiseconds(mapheaderinfo[i]->automedaltime[2])
);
fprintf(
out,
"%d'%d\"%02d,",
G_TicsToMinutes(mapheaderinfo[i]->automedaltime[1], true),
G_TicsToSeconds(mapheaderinfo[i]->automedaltime[1]),
G_TicsToCentiseconds(mapheaderinfo[i]->automedaltime[1])
);
fprintf(
out,
"%d'%d\"%02d\n",
G_TicsToMinutes(mapheaderinfo[i]->automedaltime[0], true),
G_TicsToSeconds(mapheaderinfo[i]->automedaltime[0]),
G_TicsToCentiseconds(mapheaderinfo[i]->automedaltime[0])
);
}
fclose(out);
}
//
// Add a wadfile to the active wad files,
// replace sounds, musics, patches, textures, sprites and maps

View file

@ -160,6 +160,8 @@ void P_DeleteHeaderFollowers(UINT16 i);
// Needed for NiGHTS
void P_ReloadRings(void);
void Command_dumprrautomedaltimes(void);
#ifdef __cplusplus
} // extern "C"
#endif