diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 683487c97..e1608f9f8 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -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(); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 690002841..5e2987d4e 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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 diff --git a/src/p_setup.h b/src/p_setup.h index 0430cdfb5..820f039fa 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -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