Move splitscreen code path out of SetSkinLocal and into SendNameAndColor

This commit is contained in:
Lactozilla 2023-08-15 12:37:18 -03:00
parent a745997243
commit 8d56a4d32e
2 changed files with 13 additions and 10 deletions

View file

@ -981,6 +981,7 @@ void D_StartTitle(void)
emeralds = 0;
memset(&luabanks, 0, sizeof(luabanks));
lastmaploaded = 0;
pickedchar = R_SkinAvailable(cv_defaultskin.string);
// In case someone exits out at the same time they start a time attack run,
// reset modeattacking
@ -1626,6 +1627,8 @@ 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));

View file

@ -1230,17 +1230,13 @@ static void SetSkinLocal(INT32 skinnum)
{
// Starring Metal Sonic as themselves, obviously.
SetPlayerSkinByNum(consoleplayer, 5);
return;
}
else if (splitscreen)
{
INT32 foundskin = R_SkinAvailable(cv_skin.string);
if (foundskin != -1 && R_SkinUsable(consoleplayer, foundskin))
SetPlayerSkinByNum(consoleplayer, foundskin);
if (skinnum != -1 && R_SkinUsable(consoleplayer, skinnum))
SetPlayerSkinByNum(consoleplayer, skinnum);
else
SetPlayerSkinByNum(consoleplayer, GetPlayerDefaultSkin(consoleplayer));
}
else
SetPlayerSkinByNum(consoleplayer, skinnum);
}
static void SetColorLocal(void)
@ -1294,6 +1290,10 @@ static void SendNameAndColor(void)
strcpy(player_names[consoleplayer], cv_playername.zstring);
SetColorLocal();
if (splitscreen)
SetSkinLocal(R_SkinAvailable(cv_skin.string));
else
SetSkinLocal(pickedchar);
return;
}