Merge branch 'skinvarstuff' into 'next'

Update skin cvar from character select and compare against cvar when warping without a loaded file (resolves #1267, #1117, #1114, #1112)

Closes #1112, #1114, #1117, and #1267

See merge request STJr/SRB2!2467
This commit is contained in:
sphere 2024-06-03 14:19:44 +00:00
commit 6d68091f3f
4 changed files with 25 additions and 13 deletions

View file

@ -983,7 +983,7 @@ void D_StartTitle(void)
emeralds = 0;
memset(&luabanks, 0, sizeof(luabanks));
lastmaploaded = 0;
pickedchar = R_SkinAvailable(cv_defaultskin.string);
pickedchar = R_SkinAvailable(cv_skin.string);
// In case someone exits out at the same time they start a time attack run,
// reset modeattacking

View file

@ -7000,7 +7000,10 @@ static void M_LevelSelectWarp(INT32 choice)
if (currentMenu == &SP_LevelSelectDef || currentMenu == &SP_PauseLevelSelectDef)
{
if (cursaveslot > 0) // do we have a save slot to load?
{
CV_StealthSet(&cv_skin, DEFAULTSKIN); // already handled by loadgame so we don't want this
G_LoadGame((UINT32)cursaveslot, startmap); // reload from SP save data: this is needed to keep score/lives/continues from reverting to defaults
}
else // no save slot, start new game but keep the current skin
{
M_ClearMenus(true);
@ -8649,9 +8652,14 @@ static void M_LoadSelect(INT32 choice)
M_NewGame();
}
else if (savegameinfo[saveSlotSelected-1].gamemap & 8192) // Completed
{
M_LoadGameLevelSelect(0);
}
else
{
CV_StealthSet(&cv_skin, DEFAULTSKIN); // already handled by loadgame so we don't want this
G_LoadGame((UINT32)saveSlotSelected, 0);
}
cursaveslot = saveSlotSelected;
}
@ -9510,6 +9518,8 @@ static void M_ChoosePlayer(INT32 choice)
//lastmapsaved = 0;
gamecomplete = 0;
CV_StealthSet(&cv_skin, skins[skinnum]->name);
G_DeferedInitNew(ultmode, G_BuildMapName(startmap), skinnum, false, fromlevelselect);
COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this

View file

@ -1309,7 +1309,7 @@ static void SendNameAndColor(void)
SetColorLocal(consoleplayer, cv_playercolor.value);
if (splitscreen)
if (splitscreen || (!pickedchar && stricmp(cv_skin.string, skins[consoleplayer]->name) != 0))
SetSkinLocal(consoleplayer, R_SkinAvailable(cv_skin.string));
else
SetSkinLocal(consoleplayer, pickedchar);
@ -4942,6 +4942,8 @@ static boolean Skin2_CanChange(const char *valstr)
*/
static void Skin_OnChange(void)
{
pickedchar = R_SkinAvailable(cv_skin.string);
if (!Playing())
return;