From 4e446d22d602f8a35dc269834dbddddeaddccaee Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 31 Oct 2023 04:04:01 -0300 Subject: [PATCH] Fix pickedchar not being set when it should have been --- src/d_main.c | 5 +++-- src/g_demo.c | 8 ++++++-- src/m_menu.c | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 80907a013..274e4ceb3 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1614,6 +1614,9 @@ void D_SRB2Main(void) if (D_CheckNetGame()) autostart = true; + if (!dedicated) + pickedchar = R_SkinAvailable(cv_defaultskin.string); + // check for a driver that wants intermission stats // start the apropriate game based on parms if (M_CheckParm("-metal")) @@ -1627,8 +1630,6 @@ void D_SRB2Main(void) autostart = true; } - pickedchar = R_SkinAvailable(cv_defaultskin.string); - // user settings come before "+" parameters. if (dedicated) COM_ImmedExecute(va("exec \"%s"PATHSEP"adedserv.cfg\"\n", srb2home)); diff --git a/src/g_demo.c b/src/g_demo.c index cb168dfd9..632947291 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -1492,8 +1492,12 @@ void G_BeginRecording(void) demo_p += 16; // Skin - for (i = 0; i < 16 && cv_skin.string[i]; i++) - name[i] = cv_skin.string[i]; + const char *skinname = cv_skin.string; + if (pickedchar >= 0 && pickedchar < numskins) + skinname = skins[pickedchar].name; + + for (i = 0; i < 16 && skinname[i]; i++) + name[i] = skinname[i]; for (; i < 16; i++) name[i] = '\0'; M_Memcpy(demo_p,name,16); diff --git a/src/m_menu.c b/src/m_menu.c index 629f53d24..e2866f32b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -10372,6 +10372,8 @@ static void M_ChooseNightsAttack(INT32 choice) sprintf(gpath,"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value)); snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, skins[cv_chooseskin.value-1].name); + pickedchar = cv_chooseskin.value-1; + if (!cv_autorecord.value) remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo)); else @@ -10401,6 +10403,8 @@ static void M_ChooseTimeAttack(INT32 choice) sprintf(gpath,"replay"PATHSEP"%s"PATHSEP"%s", timeattackfolder, G_BuildMapName(cv_nextmap.value)); snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, skins[cv_chooseskin.value-1].name); + pickedchar = cv_chooseskin.value-1; + if (!cv_autorecord.value) remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo)); else