From 686150875cdfb97ed8d92eb61c8622ac5ee0c8d6 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Mon, 18 Sep 2023 16:38:35 -0500 Subject: [PATCH] Convert d_main.cpp --- src/CMakeLists.txt | 2 +- src/{d_main.c => d_main.cpp} | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) rename src/{d_main.c => d_main.cpp} (98%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c4135e459..684b8c6b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 md5.c config.h.in string.c - d_main.c + d_main.cpp d_clisrv.c d_net.c d_netfil.c diff --git a/src/d_main.c b/src/d_main.cpp similarity index 98% rename from src/d_main.c rename to src/d_main.cpp index 4057bf8d6..aa6f9a57e 100644 --- a/src/d_main.c +++ b/src/d_main.cpp @@ -268,7 +268,7 @@ void D_ProcessEvents(void) HandleGamepadDeviceEvents(ev); - if (demo.savemode == DSM_TITLEENTRY) + if (demo.savemode == demovars_s::DSM_TITLEENTRY) { if (G_DemoTitleResponder(ev)) continue; @@ -368,7 +368,7 @@ static void D_Display(void) { for (i = 0; i <= r_splitscreen; ++i) { - R_SetViewContext(VIEWCONTEXT_PLAYER1 + i); + R_SetViewContext(static_cast(VIEWCONTEXT_PLAYER1 + i)); R_InterpolateViewRollAngle(rendertimefrac); R_CheckViewMorph(i); } @@ -990,7 +990,7 @@ void D_ClearState(void) // In case someone exits out at the same time they start a time attack run, // reset modeattacking modeattacking = ATTACKING_NONE; - marathonmode = 0; + marathonmode = static_cast(0); // Reset GP and roundqueue memset(&grandprixinfo, 0, sizeof(struct grandprixinfo)); @@ -1050,7 +1050,7 @@ static void D_AddFile(char **list, const char *file) for (pnumwadfiles = 0; list[pnumwadfiles]; pnumwadfiles++) ; - newfile = malloc(strlen(file) + 1); + newfile = static_cast(malloc(strlen(file) + 1)); if (!newfile) { I_Error("No more free memory to AddFile %s",file); @@ -1187,7 +1187,7 @@ static void IdentifyVersion(void) musicwads++; \ } \ else if (ms == 0) \ - I_Error("File "str" has been modified with non-music/sound lumps"); \ + I_Error("File " str " has been modified with non-music/sound lumps"); \ } MUSICTEST("sounds.pk3") @@ -1331,7 +1331,7 @@ void D_SRB2Main(void) // default savegame strcpy(savegamename, SAVEGAMENAME"%u.ssg"); - strcpy(gpbackup, "gp"SAVEGAMENAME".bkp"); // intentionally not ending with .ssg + strcpy(gpbackup, "gp" SAVEGAMENAME ".bkp"); // intentionally not ending with .ssg // Init the joined IP table for quick rejoining of past games. M_InitJoinedIPArray(); @@ -1345,7 +1345,7 @@ void D_SRB2Main(void) I_Error("Please set $HOME to your home directory\n"); #else if (dedicated) - snprintf(configfile, sizeof configfile, "d"CONFIGFILENAME); + snprintf(configfile, sizeof configfile, "d" CONFIGFILENAME); else snprintf(configfile, sizeof configfile, CONFIGFILENAME); #endif @@ -1356,7 +1356,7 @@ void D_SRB2Main(void) #ifdef DEFAULTDIR snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome); if (dedicated) - snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home); + snprintf(configfile, sizeof configfile, "%s" PATHSEP "d" CONFIGFILENAME, srb2home); else snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2home); @@ -1769,9 +1769,9 @@ void D_SRB2Main(void) // user settings come before "+" parameters. if (dedicated) - COM_ImmedExecute(va("exec \"%s"PATHSEP"ringserv.cfg\"\n", srb2home)); + COM_ImmedExecute(va("exec \"%s" PATHSEP "ringserv.cfg\"\n", srb2home)); else - COM_ImmedExecute(va("exec \"%s"PATHSEP"ringexec.cfg\" -noerror\n", srb2home)); + COM_ImmedExecute(va("exec \"%s" PATHSEP "ringexec.cfg\" -noerror\n", srb2home)); if (!autostart) M_PushSpecialParameters(); // push all "+" parameters at the command buffer