mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 12:01:05 +00:00
Don't change cv_skin or cv_playercolor if there is no need to
This commit is contained in:
parent
0bb65166c9
commit
062af20628
8 changed files with 39 additions and 52 deletions
|
@ -1626,6 +1626,14 @@ void D_SRB2Main(void)
|
||||||
autostart = true;
|
autostart = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set default singleplayer skin
|
||||||
|
if (!dedicated)
|
||||||
|
{
|
||||||
|
pickedchar = R_SkinAvailable(cv_defaultskin.string);
|
||||||
|
if (pickedchar == -1)
|
||||||
|
pickedchar = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// user settings come before "+" parameters.
|
// user settings come before "+" parameters.
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
COM_ImmedExecute(va("exec \"%s"PATHSEP"adedserv.cfg\"\n", srb2home));
|
COM_ImmedExecute(va("exec \"%s"PATHSEP"adedserv.cfg\"\n", srb2home));
|
||||||
|
|
|
@ -1274,25 +1274,22 @@ static void SendNameAndColor(void)
|
||||||
players[consoleplayer].mo->color = P_GetPlayerColor(&players[consoleplayer]);
|
players[consoleplayer].mo->color = P_GetPlayerColor(&players[consoleplayer]);
|
||||||
|
|
||||||
if (metalrecording)
|
if (metalrecording)
|
||||||
{ // Starring Metal Sonic as themselves, obviously.
|
|
||||||
SetPlayerSkinByNum(consoleplayer, 5);
|
|
||||||
CV_StealthSet(&cv_skin, skins[5].name);
|
|
||||||
}
|
|
||||||
else if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1 && R_SkinUsable(consoleplayer, foundskin))
|
|
||||||
{
|
{
|
||||||
cv_skin.value = foundskin;
|
// Starring Metal Sonic as themselves, obviously.
|
||||||
|
SetPlayerSkinByNum(consoleplayer, 5);
|
||||||
SetPlayerSkin(consoleplayer, cv_skin.string);
|
}
|
||||||
CV_StealthSet(&cv_skin, skins[cv_skin.value].name);
|
else if (splitscreen)
|
||||||
|
{
|
||||||
|
if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1 && R_SkinUsable(consoleplayer, foundskin))
|
||||||
|
SetPlayerSkin(consoleplayer, cv_skin.string);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// will always be same as current
|
||||||
|
SetPlayerSkin(consoleplayer, cv_skin.string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
SetPlayerSkinByNum(consoleplayer, pickedchar);
|
||||||
cv_skin.value = players[consoleplayer].skin;
|
|
||||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
|
||||||
// will always be same as current
|
|
||||||
SetPlayerSkin(consoleplayer, cv_skin.string);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1365,7 +1362,6 @@ static void SendNameAndColor2(void)
|
||||||
if (!Playing())
|
if (!Playing())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If you're not in a netgame, merely update the skin, color, and name.
|
|
||||||
if (botingame)
|
if (botingame)
|
||||||
{
|
{
|
||||||
players[secondplaya].skincolor = botcolor;
|
players[secondplaya].skincolor = botcolor;
|
||||||
|
@ -1377,6 +1373,7 @@ static void SendNameAndColor2(void)
|
||||||
}
|
}
|
||||||
else if (!netgame)
|
else if (!netgame)
|
||||||
{
|
{
|
||||||
|
// If you're not in a netgame, merely update the skin, color, and name.
|
||||||
INT32 foundskin;
|
INT32 foundskin;
|
||||||
|
|
||||||
CleanupPlayerName(secondplaya, cv_playername2.zstring);
|
CleanupPlayerName(secondplaya, cv_playername2.zstring);
|
||||||
|
@ -1387,7 +1384,7 @@ static void SendNameAndColor2(void)
|
||||||
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
||||||
players[secondplaya].mo->color = P_GetPlayerColor(&players[secondplaya]);
|
players[secondplaya].mo->color = P_GetPlayerColor(&players[secondplaya]);
|
||||||
|
|
||||||
if (cv_forceskin.value >= 0 && (netgame || multiplayer)) // Server wants everyone to use the same player
|
if (cv_forceskin.value >= 0 && multiplayer) // Server wants everyone to use the same player
|
||||||
{
|
{
|
||||||
const INT32 forcedskin = cv_forceskin.value;
|
const INT32 forcedskin = cv_forceskin.value;
|
||||||
|
|
||||||
|
@ -1395,16 +1392,9 @@ static void SendNameAndColor2(void)
|
||||||
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
|
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
|
||||||
}
|
}
|
||||||
else if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1 && R_SkinUsable(secondplaya, foundskin))
|
else if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1 && R_SkinUsable(secondplaya, foundskin))
|
||||||
{
|
|
||||||
cv_skin2.value = foundskin;
|
|
||||||
|
|
||||||
SetPlayerSkin(secondplaya, cv_skin2.string);
|
SetPlayerSkin(secondplaya, cv_skin2.string);
|
||||||
CV_StealthSet(&cv_skin2, skins[cv_skin2.value].name);
|
else if (splitscreen)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
cv_skin2.value = players[secondplaya].skin;
|
|
||||||
CV_StealthSet(&cv_skin2, skins[players[secondplaya].skin].name);
|
|
||||||
// will always be same as current
|
// will always be same as current
|
||||||
SetPlayerSkin(secondplaya, cv_skin2.string);
|
SetPlayerSkin(secondplaya, cv_skin2.string);
|
||||||
}
|
}
|
||||||
|
@ -2094,7 +2084,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||||
{
|
{
|
||||||
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
||||||
players[0].skincolor = skins[players[0].skin].prefcolor;
|
players[0].skincolor = skins[players[0].skin].prefcolor;
|
||||||
CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mapnumber = M_MapNumber(mapname[3], mapname[4]);
|
mapnumber = M_MapNumber(mapname[3], mapname[4]);
|
||||||
|
|
|
@ -1500,8 +1500,12 @@ void G_BeginRecording(void)
|
||||||
demo_p += 16;
|
demo_p += 16;
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
for (i = 0; i < MAXCOLORNAME && cv_playercolor.string[i]; i++)
|
UINT16 skincolor = players[0].skincolor;
|
||||||
name[i] = cv_playercolor.string[i];
|
if (skincolor >= numskincolors)
|
||||||
|
skincolor = SKINCOLOR_NONE;
|
||||||
|
const char *skincolor_name = skincolors[skincolor].name;
|
||||||
|
for (i = 0; i < MAXCOLORNAME && skincolor_name[i]; i++)
|
||||||
|
name[i] = skincolor_name[i];
|
||||||
for (; i < MAXCOLORNAME; i++)
|
for (; i < MAXCOLORNAME; i++)
|
||||||
name[i] = '\0';
|
name[i] = '\0';
|
||||||
M_Memcpy(demo_p,name,MAXCOLORNAME);
|
M_Memcpy(demo_p,name,MAXCOLORNAME);
|
||||||
|
@ -2263,7 +2267,6 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
players[0].skincolor = i;
|
players[0].skincolor = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
|
|
||||||
if (players[0].mo)
|
if (players[0].mo)
|
||||||
{
|
{
|
||||||
players[0].mo->color = players[0].skincolor;
|
players[0].mo->color = players[0].skincolor;
|
||||||
|
|
14
src/g_game.c
14
src/g_game.c
|
@ -55,6 +55,8 @@ gameaction_t gameaction;
|
||||||
gamestate_t gamestate = GS_NULL;
|
gamestate_t gamestate = GS_NULL;
|
||||||
UINT8 ultimatemode = false;
|
UINT8 ultimatemode = false;
|
||||||
|
|
||||||
|
INT32 pickedchar;
|
||||||
|
|
||||||
boolean botingame;
|
boolean botingame;
|
||||||
UINT8 botskin;
|
UINT8 botskin;
|
||||||
UINT16 botcolor;
|
UINT16 botcolor;
|
||||||
|
@ -4770,12 +4772,9 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
|
||||||
Z_Free(savebuffer);
|
Z_Free(savebuffer);
|
||||||
save_p = savebuffer = NULL;
|
save_p = savebuffer = NULL;
|
||||||
|
|
||||||
// gameaction = ga_nothing;
|
|
||||||
// G_SetGamestate(GS_LEVEL);
|
|
||||||
displayplayer = consoleplayer;
|
displayplayer = consoleplayer;
|
||||||
multiplayer = splitscreen = false;
|
multiplayer = splitscreen = false;
|
||||||
|
|
||||||
// G_DeferedInitNew(sk_medium, G_BuildMapName(1), 0, 0, 1);
|
|
||||||
if (setsizeneeded)
|
if (setsizeneeded)
|
||||||
R_ExecuteSetViewSize();
|
R_ExecuteSetViewSize();
|
||||||
|
|
||||||
|
@ -4968,9 +4967,9 @@ cleanup:
|
||||||
// Can be called by the startup code or the menu task,
|
// Can be called by the startup code or the menu task,
|
||||||
// consoleplayer, displayplayer, playeringame[] should be set.
|
// consoleplayer, displayplayer, playeringame[] should be set.
|
||||||
//
|
//
|
||||||
void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, boolean SSSG, boolean FLS)
|
void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 character, boolean SSSG, boolean FLS)
|
||||||
{
|
{
|
||||||
UINT16 color = skins[pickedchar].prefcolor;
|
pickedchar = character;
|
||||||
paused = false;
|
paused = false;
|
||||||
|
|
||||||
if (demoplayback)
|
if (demoplayback)
|
||||||
|
@ -4991,10 +4990,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
|
||||||
SplitScreen_OnChange();
|
SplitScreen_OnChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
color = skins[pickedchar].prefcolor;
|
SetPlayerSkinByNum(consoleplayer, character);
|
||||||
SetPlayerSkinByNum(consoleplayer, pickedchar);
|
|
||||||
CV_StealthSet(&cv_skin, skins[pickedchar].name);
|
|
||||||
CV_StealthSetValue(&cv_playercolor, color);
|
|
||||||
|
|
||||||
if (mapname)
|
if (mapname)
|
||||||
D_MapChange(M_MapNumber(mapname[3], mapname[4]), gametype, pultmode, true, 1, false, FLS);
|
D_MapChange(M_MapNumber(mapname[3], mapname[4]), gametype, pultmode, true, 1, false, FLS);
|
||||||
|
|
|
@ -174,8 +174,7 @@ void G_SpawnPlayer(INT32 playernum);
|
||||||
|
|
||||||
// Can be called by the startup code or M_Responder.
|
// Can be called by the startup code or M_Responder.
|
||||||
// A normal game starts at map 1, but a warp test can start elsewhere
|
// A normal game starts at map 1, but a warp test can start elsewhere
|
||||||
void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar,
|
void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 character, boolean SSSG, boolean FLS);
|
||||||
boolean SSSG, boolean FLS);
|
|
||||||
void G_DoLoadLevel(boolean resetplayer);
|
void G_DoLoadLevel(boolean resetplayer);
|
||||||
void G_StartTitleCard(void);
|
void G_StartTitleCard(void);
|
||||||
void G_PreLevelTitleCard(void);
|
void G_PreLevelTitleCard(void);
|
||||||
|
|
|
@ -53,9 +53,11 @@ typedef enum
|
||||||
|
|
||||||
extern gamestate_t gamestate;
|
extern gamestate_t gamestate;
|
||||||
extern UINT8 titlemapinaction;
|
extern UINT8 titlemapinaction;
|
||||||
extern UINT8 ultimatemode; // was sk_insane
|
extern UINT8 ultimatemode;
|
||||||
extern gameaction_t gameaction;
|
extern gameaction_t gameaction;
|
||||||
|
|
||||||
|
extern INT32 pickedchar;
|
||||||
|
|
||||||
extern boolean botingame;
|
extern boolean botingame;
|
||||||
extern UINT8 botskin;
|
extern UINT8 botskin;
|
||||||
extern UINT16 botcolor;
|
extern UINT16 botcolor;
|
||||||
|
|
|
@ -7179,19 +7179,13 @@ static void P_ForceCharacter(const char *forcecharskin)
|
||||||
{
|
{
|
||||||
SetPlayerSkin(secondarydisplayplayer, forcecharskin);
|
SetPlayerSkin(secondarydisplayplayer, forcecharskin);
|
||||||
if ((unsigned)cv_playercolor2.value != skins[players[secondarydisplayplayer].skin].prefcolor)
|
if ((unsigned)cv_playercolor2.value != skins[players[secondarydisplayplayer].skin].prefcolor)
|
||||||
{
|
|
||||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondarydisplayplayer].skin].prefcolor);
|
|
||||||
players[secondarydisplayplayer].skincolor = skins[players[secondarydisplayplayer].skin].prefcolor;
|
players[secondarydisplayplayer].skincolor = skins[players[secondarydisplayplayer].skin].prefcolor;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetPlayerSkin(consoleplayer, forcecharskin);
|
SetPlayerSkin(consoleplayer, forcecharskin);
|
||||||
// normal player colors in single player
|
// normal player colors in single player
|
||||||
if ((unsigned)cv_playercolor.value != skins[players[consoleplayer].skin].prefcolor)
|
if ((unsigned)cv_playercolor.value != skins[players[consoleplayer].skin].prefcolor)
|
||||||
{
|
|
||||||
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor);
|
|
||||||
players[consoleplayer].skincolor = skins[players[consoleplayer].skin].prefcolor;
|
players[consoleplayer].skincolor = skins[players[consoleplayer].skin].prefcolor;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,10 +346,6 @@ static void SetSkin(player_t *player, INT32 skinnum)
|
||||||
|
|
||||||
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
|
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
|
||||||
{
|
{
|
||||||
if (player == &players[consoleplayer])
|
|
||||||
CV_StealthSetValue(&cv_playercolor, skin->prefcolor);
|
|
||||||
else if (player == &players[secondarydisplayplayer])
|
|
||||||
CV_StealthSetValue(&cv_playercolor2, skin->prefcolor);
|
|
||||||
player->skincolor = newcolor = skin->prefcolor;
|
player->skincolor = newcolor = skin->prefcolor;
|
||||||
if (player->bot && botingame)
|
if (player->bot && botingame)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue