Convert d_main.cpp

This commit is contained in:
Eidolon 2023-09-18 16:38:35 -05:00
parent 689f5b8365
commit 686150875c
2 changed files with 11 additions and 11 deletions

View file

@ -4,7 +4,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
md5.c md5.c
config.h.in config.h.in
string.c string.c
d_main.c d_main.cpp
d_clisrv.c d_clisrv.c
d_net.c d_net.c
d_netfil.c d_netfil.c

View file

@ -268,7 +268,7 @@ void D_ProcessEvents(void)
HandleGamepadDeviceEvents(ev); HandleGamepadDeviceEvents(ev);
if (demo.savemode == DSM_TITLEENTRY) if (demo.savemode == demovars_s::DSM_TITLEENTRY)
{ {
if (G_DemoTitleResponder(ev)) if (G_DemoTitleResponder(ev))
continue; continue;
@ -368,7 +368,7 @@ static void D_Display(void)
{ {
for (i = 0; i <= r_splitscreen; ++i) for (i = 0; i <= r_splitscreen; ++i)
{ {
R_SetViewContext(VIEWCONTEXT_PLAYER1 + i); R_SetViewContext(static_cast<viewcontext_e>(VIEWCONTEXT_PLAYER1 + i));
R_InterpolateViewRollAngle(rendertimefrac); R_InterpolateViewRollAngle(rendertimefrac);
R_CheckViewMorph(i); 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, // In case someone exits out at the same time they start a time attack run,
// reset modeattacking // reset modeattacking
modeattacking = ATTACKING_NONE; modeattacking = ATTACKING_NONE;
marathonmode = 0; marathonmode = static_cast<marathonmode_t>(0);
// Reset GP and roundqueue // Reset GP and roundqueue
memset(&grandprixinfo, 0, sizeof(struct grandprixinfo)); 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++) for (pnumwadfiles = 0; list[pnumwadfiles]; pnumwadfiles++)
; ;
newfile = malloc(strlen(file) + 1); newfile = static_cast<char*>(malloc(strlen(file) + 1));
if (!newfile) if (!newfile)
{ {
I_Error("No more free memory to AddFile %s",file); I_Error("No more free memory to AddFile %s",file);
@ -1187,7 +1187,7 @@ static void IdentifyVersion(void)
musicwads++; \ musicwads++; \
} \ } \
else if (ms == 0) \ 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") MUSICTEST("sounds.pk3")
@ -1331,7 +1331,7 @@ void D_SRB2Main(void)
// default savegame // default savegame
strcpy(savegamename, SAVEGAMENAME"%u.ssg"); 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. // Init the joined IP table for quick rejoining of past games.
M_InitJoinedIPArray(); M_InitJoinedIPArray();
@ -1345,7 +1345,7 @@ void D_SRB2Main(void)
I_Error("Please set $HOME to your home directory\n"); I_Error("Please set $HOME to your home directory\n");
#else #else
if (dedicated) if (dedicated)
snprintf(configfile, sizeof configfile, "d"CONFIGFILENAME); snprintf(configfile, sizeof configfile, "d" CONFIGFILENAME);
else else
snprintf(configfile, sizeof configfile, CONFIGFILENAME); snprintf(configfile, sizeof configfile, CONFIGFILENAME);
#endif #endif
@ -1356,7 +1356,7 @@ void D_SRB2Main(void)
#ifdef DEFAULTDIR #ifdef DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome); snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome);
if (dedicated) if (dedicated)
snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home); snprintf(configfile, sizeof configfile, "%s" PATHSEP "d" CONFIGFILENAME, srb2home);
else else
snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2home); snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2home);
@ -1769,9 +1769,9 @@ void D_SRB2Main(void)
// user settings come before "+" parameters. // user settings come before "+" parameters.
if (dedicated) if (dedicated)
COM_ImmedExecute(va("exec \"%s"PATHSEP"ringserv.cfg\"\n", srb2home)); COM_ImmedExecute(va("exec \"%s" PATHSEP "ringserv.cfg\"\n", srb2home));
else 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) if (!autostart)
M_PushSpecialParameters(); // push all "+" parameters at the command buffer M_PushSpecialParameters(); // push all "+" parameters at the command buffer