mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-21 03:11:03 +00:00
Merge branch 'team-gametype-keep-player-color' into 'next'
Respect the player's skin and color selection See merge request STJr/SRB2!2100
This commit is contained in:
commit
f02fd19c5a
17 changed files with 165 additions and 262 deletions
|
@ -1071,7 +1071,6 @@ static inline void AM_drawPlayers(void)
|
|||
return;
|
||||
}
|
||||
|
||||
// multiplayer (how??)
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
|
|
|
@ -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));
|
||||
|
|
241
src/d_netcmd.c
241
src/d_netcmd.c
|
@ -225,6 +225,7 @@ consvar_t cv_seenames = CVAR_INIT ("seenames", "Ally/Foe", CV_SAVE|CV_ALLOWLUA,
|
|||
consvar_t cv_allowseenames = CVAR_INIT ("allowseenames", "Yes", CV_SAVE|CV_NETVAR|CV_ALLOWLUA, CV_YesNo, NULL);
|
||||
|
||||
// names
|
||||
static char *lastskinnames[2];
|
||||
consvar_t cv_playername = CVAR_INIT ("name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange);
|
||||
consvar_t cv_playername2 = CVAR_INIT ("name2", "Tails", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name2_OnChange);
|
||||
// player colors
|
||||
|
@ -1205,27 +1206,38 @@ UINT8 CanChangeSkin(INT32 playernum)
|
|||
|
||||
static void ForceAllSkins(INT32 forcedskin)
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; ++i)
|
||||
for (INT32 i = 0; i < MAXPLAYERS; ++i)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
SetPlayerSkinByNum(i, forcedskin);
|
||||
|
||||
// If it's me (or my brother), set appropriate skin value in cv_skin/cv_skin2
|
||||
if (!dedicated) // But don't do this for dedicated servers, of course.
|
||||
{
|
||||
if (i == consoleplayer)
|
||||
CV_StealthSet(&cv_skin, skins[forcedskin].name);
|
||||
else if (i == secondarydisplayplayer)
|
||||
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
|
||||
}
|
||||
if (playeringame[i])
|
||||
SetPlayerSkinByNum(i, forcedskin);
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 snacpending = 0, snac2pending = 0, chmappending = 0;
|
||||
|
||||
static void SetSkinLocal(INT32 playernum, INT32 skinnum)
|
||||
{
|
||||
if (metalrecording && playernum == consoleplayer)
|
||||
{
|
||||
// Starring Metal Sonic as themselves, obviously.
|
||||
SetPlayerSkinByNum(playernum, 5);
|
||||
return;
|
||||
}
|
||||
|
||||
if (skinnum != -1 && R_SkinUsable(playernum, skinnum))
|
||||
SetPlayerSkinByNum(playernum, skinnum);
|
||||
else
|
||||
SetPlayerSkinByNum(playernum, GetPlayerDefaultSkin(playernum));
|
||||
}
|
||||
|
||||
static void SetColorLocal(INT32 playernum, UINT16 color)
|
||||
{
|
||||
players[playernum].skincolor = color;
|
||||
|
||||
if (players[playernum].mo && !players[playernum].powers[pw_dye])
|
||||
players[playernum].mo->color = P_GetPlayerColor(&players[playernum]);
|
||||
}
|
||||
|
||||
// name, color, or skin has changed
|
||||
//
|
||||
static void SendNameAndColor(void)
|
||||
|
@ -1235,15 +1247,6 @@ static void SendNameAndColor(void)
|
|||
|
||||
p = buf;
|
||||
|
||||
// normal player colors
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (players[consoleplayer].ctfteam == 1 && cv_playercolor.value != skincolor_redteam)
|
||||
CV_StealthSetValue(&cv_playercolor, skincolor_redteam);
|
||||
else if (players[consoleplayer].ctfteam == 2 && cv_playercolor.value != skincolor_blueteam)
|
||||
CV_StealthSetValue(&cv_playercolor, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// don't allow inaccessible colors
|
||||
if (!skincolors[cv_playercolor.value].accessible)
|
||||
{
|
||||
|
@ -1274,50 +1277,15 @@ static void SendNameAndColor(void)
|
|||
// If you're not in a netgame, merely update the skin, color, and name.
|
||||
if (!netgame)
|
||||
{
|
||||
INT32 foundskin;
|
||||
|
||||
CleanupPlayerName(consoleplayer, cv_playername.zstring);
|
||||
strcpy(player_names[consoleplayer], cv_playername.zstring);
|
||||
|
||||
players[consoleplayer].skincolor = cv_playercolor.value;
|
||||
SetColorLocal(consoleplayer, cv_playercolor.value);
|
||||
|
||||
if (players[consoleplayer].mo && !players[consoleplayer].powers[pw_dye])
|
||||
players[consoleplayer].mo->color = players[consoleplayer].skincolor;
|
||||
|
||||
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))
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin.value != players[consoleplayer].skin);
|
||||
|
||||
SetPlayerSkin(consoleplayer, cv_skin.string);
|
||||
CV_StealthSet(&cv_skin, skins[cv_skin.value].name);
|
||||
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor, skins[cv_skin.value].prefcolor);
|
||||
|
||||
players[consoleplayer].skincolor = cv_playercolor.value % numskincolors;
|
||||
|
||||
if (players[consoleplayer].mo)
|
||||
players[consoleplayer].mo->color = (UINT16)players[consoleplayer].skincolor;
|
||||
}*/
|
||||
}
|
||||
if (splitscreen)
|
||||
SetSkinLocal(consoleplayer, R_SkinAvailable(cv_skin.string));
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
SetSkinLocal(consoleplayer, pickedchar);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1334,10 +1302,6 @@ static void SendNameAndColor(void)
|
|||
else // Cleanup name if changing it
|
||||
CleanupPlayerName(consoleplayer, cv_playername.zstring);
|
||||
|
||||
// Don't change skin if the server doesn't want you to.
|
||||
if (!CanChangeSkin(consoleplayer))
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||
|
||||
// check if player has the skin loaded (cv_skin may have
|
||||
// the name of a skin that was available in the previous game)
|
||||
cv_skin.value = R_SkinAvailable(cv_skin.string);
|
||||
|
@ -1369,16 +1333,6 @@ static void SendNameAndColor2(void)
|
|||
else // HACK
|
||||
secondplaya = 1;
|
||||
|
||||
// normal player colors
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (players[secondplaya].ctfteam == 1 && cv_playercolor2.value != skincolor_redteam)
|
||||
CV_StealthSetValue(&cv_playercolor2, skincolor_redteam);
|
||||
else if (players[secondplaya].ctfteam == 2 && cv_playercolor2.value != skincolor_blueteam)
|
||||
CV_StealthSetValue(&cv_playercolor2, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// don't allow inaccessible colors
|
||||
if (!skincolors[cv_playercolor2.value].accessible)
|
||||
{
|
||||
if (players[secondplaya].skincolor && skincolors[players[secondplaya].skincolor].accessible)
|
||||
|
@ -1400,63 +1354,24 @@ static void SendNameAndColor2(void)
|
|||
if (!Playing())
|
||||
return;
|
||||
|
||||
// If you're not in a netgame, merely update the skin, color, and name.
|
||||
if (botingame)
|
||||
{
|
||||
players[secondplaya].skincolor = botcolor;
|
||||
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
|
||||
SetColorLocal(secondplaya, botcolor);
|
||||
SetPlayerSkinByNum(secondplaya, botskin-1);
|
||||
return;
|
||||
}
|
||||
else if (!netgame)
|
||||
{
|
||||
INT32 foundskin;
|
||||
|
||||
// If you're not in a netgame, merely update the skin, color, and name.
|
||||
CleanupPlayerName(secondplaya, cv_playername2.zstring);
|
||||
strcpy(player_names[secondplaya], cv_playername2.zstring);
|
||||
|
||||
// don't use secondarydisplayplayer: the second player must be 1
|
||||
players[secondplaya].skincolor = cv_playercolor2.value;
|
||||
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
SetColorLocal(secondplaya, cv_playercolor2.value);
|
||||
|
||||
if (cv_forceskin.value >= 0 && (netgame || multiplayer)) // Server wants everyone to use the same player
|
||||
{
|
||||
const INT32 forcedskin = cv_forceskin.value;
|
||||
|
||||
SetPlayerSkinByNum(secondplaya, forcedskin);
|
||||
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
|
||||
}
|
||||
else if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1 && R_SkinUsable(secondplaya, foundskin))
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin2.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin2.value != players[secondplaya].skin);
|
||||
|
||||
SetPlayerSkin(secondplaya, cv_skin2.string);
|
||||
CV_StealthSet(&cv_skin2, skins[cv_skin2.value].name);
|
||||
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
|
||||
|
||||
players[secondplaya].skincolor = cv_playercolor2.value % numskincolors;
|
||||
|
||||
if (players[secondplaya].mo)
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
}*/
|
||||
}
|
||||
if (cv_forceskin.value >= 0)
|
||||
SetSkinLocal(secondplaya, cv_forceskin.value);
|
||||
else
|
||||
{
|
||||
cv_skin2.value = players[secondplaya].skin;
|
||||
CV_StealthSet(&cv_skin2, skins[players[secondplaya].skin].name);
|
||||
// will always be same as current
|
||||
SetPlayerSkin(secondplaya, cv_skin2.string);
|
||||
}
|
||||
SetSkinLocal(secondplaya, R_SkinAvailable(cv_skin2.string));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1500,7 +1415,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
// set color
|
||||
p->skincolor = color % numskincolors;
|
||||
if (p->mo)
|
||||
p->mo->color = (UINT16)p->skincolor;
|
||||
p->mo->color = P_GetPlayerColor(p);
|
||||
|
||||
// normal player colors
|
||||
if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer]))
|
||||
|
@ -1509,15 +1424,6 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
UINT32 unlockShift = 0;
|
||||
UINT32 i;
|
||||
|
||||
// team colors
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (p->ctfteam == 1 && p->skincolor != skincolor_redteam)
|
||||
kick = true;
|
||||
else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam)
|
||||
kick = true;
|
||||
}
|
||||
|
||||
// don't allow inaccessible colors
|
||||
if (skincolors[p->skincolor].accessible == false)
|
||||
kick = true;
|
||||
|
@ -1558,16 +1464,9 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
}
|
||||
|
||||
// set skin
|
||||
if (cv_forceskin.value >= 0 && (netgame || multiplayer)) // Server wants everyone to use the same player
|
||||
{
|
||||
const INT32 forcedskin = cv_forceskin.value;
|
||||
INT32 forcedskin = R_GetForcedSkin(playernum);
|
||||
if (forcedskin != -1 && (netgame || multiplayer)) // Server wants everyone to use the same player (or the level is forcing one.)
|
||||
SetPlayerSkinByNum(playernum, forcedskin);
|
||||
|
||||
if (playernum == consoleplayer)
|
||||
CV_StealthSet(&cv_skin, skins[forcedskin].name);
|
||||
else if (playernum == secondarydisplayplayer)
|
||||
CV_StealthSet(&cv_skin2, skins[forcedskin].name);
|
||||
}
|
||||
else
|
||||
SetPlayerSkinByNum(playernum, skin);
|
||||
}
|
||||
|
@ -2177,7 +2076,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
||||
players[0].skincolor = skins[players[0].skin].prefcolor;
|
||||
CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
|
||||
}
|
||||
|
||||
mapnumber = M_MapNumber(mapname[3], mapname[4]);
|
||||
|
@ -2931,17 +2829,6 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (NetPacket.packet.newteam)
|
||||
{
|
||||
if (playernum == consoleplayer) //CTF and Team Match colors.
|
||||
CV_SetValue(&cv_playercolor, NetPacket.packet.newteam + 5);
|
||||
else if (playernum == secondarydisplayplayer)
|
||||
CV_SetValue(&cv_playercolor2, NetPacket.packet.newteam + 5);
|
||||
}
|
||||
}
|
||||
|
||||
// In tag, check to see if you still have a game.
|
||||
if (G_TagGametype())
|
||||
P_CheckSurvivors();
|
||||
|
@ -4820,11 +4707,16 @@ static void ForceSkin_OnChange(void)
|
|||
return;
|
||||
|
||||
if (cv_forceskin.value < 0)
|
||||
{
|
||||
CONS_Printf("The server has lifted the forced skin restrictions.\n");
|
||||
if (Playing())
|
||||
D_SendPlayerConfig();
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("The server is restricting all players to skin \"%s\".\n",skins[cv_forceskin.value].name);
|
||||
ForceAllSkins(cv_forceskin.value);
|
||||
if (Playing())
|
||||
ForceAllSkins(cv_forceskin.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4838,7 +4730,6 @@ static void Name_OnChange(void)
|
|||
}
|
||||
else
|
||||
SendNameAndColor();
|
||||
|
||||
}
|
||||
|
||||
static void Name2_OnChange(void)
|
||||
|
@ -4861,19 +4752,33 @@ static void Skin_OnChange(void)
|
|||
if (!Playing())
|
||||
return; // do whatever you want
|
||||
|
||||
if (!(cv_debug || devparm) && !(multiplayer || netgame) // In single player.
|
||||
&& (gamestate != GS_WAITINGPLAYERS)) // allows command line -warp x +skin y
|
||||
if (lastskinnames[0] == NULL)
|
||||
lastskinnames[0] = Z_StrDup(cv_skin.string);
|
||||
|
||||
if (!(multiplayer || netgame)) // In single player.
|
||||
{
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||
if (!(cv_debug || devparm)
|
||||
&& (gamestate != GS_WAITINGPLAYERS)) // allows command line -warp x +skin y
|
||||
{
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||
return;
|
||||
}
|
||||
|
||||
// Just do it here if devmode is enabled
|
||||
SetSkinLocal(consoleplayer, R_SkinAvailable(cv_skin.string));
|
||||
return;
|
||||
}
|
||||
|
||||
if (CanChangeSkin(consoleplayer) && !P_PlayerMoving(consoleplayer))
|
||||
{
|
||||
SendNameAndColor();
|
||||
Z_Free(lastskinnames[0]);
|
||||
lastskinnames[0] = Z_StrDup(cv_skin.string);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||
CV_StealthSet(&cv_skin, lastskinnames[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4887,12 +4792,19 @@ static void Skin2_OnChange(void)
|
|||
if (!Playing() || !splitscreen)
|
||||
return; // do whatever you want
|
||||
|
||||
if (lastskinnames[1] == NULL)
|
||||
lastskinnames[1] = Z_StrDup(cv_skin2.string);
|
||||
|
||||
if (CanChangeSkin(secondarydisplayplayer) && !P_PlayerMoving(secondarydisplayplayer))
|
||||
{
|
||||
SendNameAndColor2();
|
||||
Z_Free(lastskinnames[1]);
|
||||
lastskinnames[1] = Z_StrDup(cv_skin.string);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("You can't change your skin at the moment.\n"));
|
||||
CV_StealthSet(&cv_skin2, skins[players[secondarydisplayplayer].skin].name);
|
||||
CV_StealthSet(&cv_skin2, lastskinnames[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4902,15 +4814,18 @@ static void Skin2_OnChange(void)
|
|||
*/
|
||||
static void Color_OnChange(void)
|
||||
{
|
||||
if (!Playing()) {
|
||||
if (!Playing())
|
||||
{
|
||||
if (!cv_playercolor.value || !skincolors[cv_playercolor.value].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor, lastgoodcolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player.
|
||||
if (!(multiplayer || netgame)) // In single player.
|
||||
{
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||
// Just do it here if devmode is enabled
|
||||
if (cv_debug || devparm)
|
||||
SetColorLocal(consoleplayer, cv_playercolor.value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1500,8 +1500,12 @@ void G_BeginRecording(void)
|
|||
demo_p += 16;
|
||||
|
||||
// Color
|
||||
for (i = 0; i < MAXCOLORNAME && cv_playercolor.string[i]; i++)
|
||||
name[i] = cv_playercolor.string[i];
|
||||
UINT16 skincolor = players[0].skincolor;
|
||||
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++)
|
||||
name[i] = '\0';
|
||||
M_Memcpy(demo_p,name,MAXCOLORNAME);
|
||||
|
@ -2263,7 +2267,6 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
players[0].skincolor = i;
|
||||
break;
|
||||
}
|
||||
CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
|
||||
if (players[0].mo)
|
||||
{
|
||||
players[0].mo->color = players[0].skincolor;
|
||||
|
|
40
src/g_game.c
40
src/g_game.c
|
@ -55,6 +55,8 @@ gameaction_t gameaction;
|
|||
gamestate_t gamestate = GS_NULL;
|
||||
UINT8 ultimatemode = false;
|
||||
|
||||
INT32 pickedchar;
|
||||
|
||||
boolean botingame;
|
||||
UINT8 botskin;
|
||||
UINT16 botcolor;
|
||||
|
@ -2751,25 +2753,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
//if ((netgame || multiplayer) && !p->spectator) -- moved into P_SpawnPlayer to account for forced changes there
|
||||
//p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent
|
||||
|
||||
// Check to make sure their color didn't change somehow...
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
if (p->ctfteam == 1 && p->skincolor != skincolor_redteam)
|
||||
{
|
||||
if (p == &players[consoleplayer])
|
||||
CV_SetValue(&cv_playercolor, skincolor_redteam);
|
||||
else if (p == &players[secondarydisplayplayer])
|
||||
CV_SetValue(&cv_playercolor2, skincolor_redteam);
|
||||
}
|
||||
else if (p->ctfteam == 2 && p->skincolor != skincolor_blueteam)
|
||||
{
|
||||
if (p == &players[consoleplayer])
|
||||
CV_SetValue(&cv_playercolor, skincolor_blueteam);
|
||||
else if (p == &players[secondarydisplayplayer])
|
||||
CV_SetValue(&cv_playercolor2, skincolor_blueteam);
|
||||
}
|
||||
}
|
||||
|
||||
if (betweenmaps)
|
||||
return;
|
||||
|
||||
|
@ -4805,12 +4788,9 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
|
|||
Z_Free(savebuffer);
|
||||
save_p = savebuffer = NULL;
|
||||
|
||||
// gameaction = ga_nothing;
|
||||
// G_SetGamestate(GS_LEVEL);
|
||||
displayplayer = consoleplayer;
|
||||
multiplayer = splitscreen = false;
|
||||
|
||||
// G_DeferedInitNew(sk_medium, G_BuildMapName(1), 0, 0, 1);
|
||||
if (setsizeneeded)
|
||||
R_ExecuteSetViewSize();
|
||||
|
||||
|
@ -5003,9 +4983,9 @@ cleanup:
|
|||
// Can be called by the startup code or the menu task,
|
||||
// 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;
|
||||
|
||||
if (demoplayback)
|
||||
|
@ -5026,10 +5006,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar, b
|
|||
SplitScreen_OnChange();
|
||||
}
|
||||
|
||||
color = skins[pickedchar].prefcolor;
|
||||
SetPlayerSkinByNum(consoleplayer, pickedchar);
|
||||
CV_StealthSet(&cv_skin, skins[pickedchar].name);
|
||||
CV_StealthSetValue(&cv_playercolor, color);
|
||||
SetPlayerSkinByNum(consoleplayer, character);
|
||||
|
||||
if (mapname)
|
||||
D_MapChange(M_MapNumber(mapname[3], mapname[4]), gametype, pultmode, true, 1, false, FLS);
|
||||
|
@ -5109,6 +5086,10 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
|||
CV_StealthSetValue(&cv_itemfinder, 0);
|
||||
}
|
||||
|
||||
// Restore each player's skin if it was previously forced to be a specific one
|
||||
// (Looks a bit silly, but it works.)
|
||||
boolean reset_skin = netgame && mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0';
|
||||
|
||||
// internal game map
|
||||
// well this check is useless because it is done before (d_netcmd.c::command_map_f)
|
||||
// but in case of for demos....
|
||||
|
@ -5136,6 +5117,9 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean
|
|||
automapactive = false;
|
||||
imcontinuing = false;
|
||||
|
||||
if (reset_skin)
|
||||
D_SendPlayerConfig();
|
||||
|
||||
// fetch saved data if available
|
||||
if (savedata.lives > 0)
|
||||
{
|
||||
|
|
|
@ -176,8 +176,7 @@ void G_SpawnPlayer(INT32 playernum);
|
|||
|
||||
// Can be called by the startup code or M_Responder.
|
||||
// A normal game starts at map 1, but a warp test can start elsewhere
|
||||
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);
|
||||
void G_DoLoadLevel(boolean resetplayer);
|
||||
void G_StartTitleCard(void);
|
||||
void G_PreLevelTitleCard(void);
|
||||
|
|
|
@ -53,9 +53,11 @@ typedef enum
|
|||
|
||||
extern gamestate_t gamestate;
|
||||
extern UINT8 titlemapinaction;
|
||||
extern UINT8 ultimatemode; // was sk_insane
|
||||
extern UINT8 ultimatemode;
|
||||
extern gameaction_t gameaction;
|
||||
|
||||
extern INT32 pickedchar;
|
||||
|
||||
extern boolean botingame;
|
||||
extern UINT8 botskin;
|
||||
extern UINT16 botcolor;
|
||||
|
|
12
src/m_menu.c
12
src/m_menu.c
|
@ -12690,11 +12690,7 @@ static void M_SetupMultiPlayer(INT32 choice)
|
|||
else
|
||||
MP_PlayerSetupMenu[1].status = (IT_KEYHANDLER|IT_STRING);
|
||||
|
||||
// ditto with colour
|
||||
if (Playing() && G_GametypeHasTeams())
|
||||
MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT);
|
||||
else
|
||||
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING);
|
||||
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING);
|
||||
|
||||
multi_spr2 = P_GetSkinSprite2(&skins[setupm_fakeskin], SPR2_WALK, NULL);
|
||||
|
||||
|
@ -12735,11 +12731,7 @@ static void M_SetupMultiPlayer2(INT32 choice)
|
|||
else
|
||||
MP_PlayerSetupMenu[1].status = (IT_KEYHANDLER | IT_STRING);
|
||||
|
||||
// ditto with colour
|
||||
if (Playing() && G_GametypeHasTeams())
|
||||
MP_PlayerSetupMenu[2].status = (IT_GRAYEDOUT);
|
||||
else
|
||||
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING);
|
||||
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING);
|
||||
|
||||
multi_spr2 = P_GetSkinSprite2(&skins[setupm_fakeskin], SPR2_WALK, NULL);
|
||||
|
||||
|
|
|
@ -5248,7 +5248,7 @@ void A_SignPlayer(mobj_t *actor)
|
|||
return;
|
||||
|
||||
skin = &skins[actor->target->player->skin];
|
||||
facecolor = actor->target->player->skincolor;
|
||||
facecolor = P_GetPlayerColor(actor->target->player);
|
||||
|
||||
if (signcolor)
|
||||
;
|
||||
|
@ -9059,7 +9059,7 @@ void A_Dye(mobj_t *actor)
|
|||
if (!color)
|
||||
{
|
||||
target->colorized = false;
|
||||
target->color = target->player ? target->player->skincolor : SKINCOLOR_NONE;
|
||||
target->color = target->player ? P_GetPlayerColor(target->player) : SKINCOLOR_NONE;
|
||||
}
|
||||
else if (!(target->player))
|
||||
{
|
||||
|
|
|
@ -2630,7 +2630,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
}
|
||||
}
|
||||
|
||||
target->color = target->player->skincolor;
|
||||
target->color = P_GetPlayerColor(target->player);
|
||||
target->colorized = false;
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
|
||||
|
@ -3323,7 +3323,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
|
|||
|
||||
// Get rid of shield
|
||||
player->powers[pw_shield] = SH_NONE;
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
|
||||
// Get rid of emeralds
|
||||
player->powers[pw_emeralds] = 0;
|
||||
|
@ -3440,7 +3440,7 @@ void P_RemoveShield(player_t *player)
|
|||
{ // Second layer shields
|
||||
if (((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) && !(player->powers[pw_super] || (mariomode && player->powers[pw_invulnerability])))
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
player->powers[pw_shield] = SH_NONE;
|
||||
|
|
|
@ -146,6 +146,7 @@ void P_ForceLocalAngle(player_t *player, angle_t angle);
|
|||
boolean P_PlayerFullbright(player_t *player);
|
||||
boolean P_PlayerCanEnterSpinGaps(player_t *player);
|
||||
boolean P_PlayerShouldUseSpinHeight(player_t *player);
|
||||
UINT16 P_GetPlayerColor(player_t *player);
|
||||
|
||||
boolean P_IsObjectInGoop(mobj_t *mo);
|
||||
boolean P_IsObjectOnGround(mobj_t *mo);
|
||||
|
|
11
src/p_mobj.c
11
src/p_mobj.c
|
@ -11586,8 +11586,6 @@ void P_SpawnPlayer(INT32 playernum)
|
|||
// Spawn as a spectator,
|
||||
// yes even in splitscreen mode
|
||||
p->spectator = true;
|
||||
if (playernum&1) p->skincolor = skincolor_redteam;
|
||||
else p->skincolor = skincolor_blueteam;
|
||||
|
||||
// but immediately send a team change packet.
|
||||
NetPacket.packet.playernum = playernum;
|
||||
|
@ -11607,13 +11605,6 @@ void P_SpawnPlayer(INT32 playernum)
|
|||
// Fix stupid non spectator spectators.
|
||||
if (!p->spectator && !p->ctfteam)
|
||||
p->spectator = true;
|
||||
|
||||
// Fix team colors.
|
||||
// This code isn't being done right somewhere else. Oh well.
|
||||
if (p->ctfteam == 1)
|
||||
p->skincolor = skincolor_redteam;
|
||||
else if (p->ctfteam == 2)
|
||||
p->skincolor = skincolor_blueteam;
|
||||
}
|
||||
|
||||
if ((netgame || multiplayer) && ((gametyperules & GTR_SPAWNINVUL) || leveltime) && !p->spectator && !(maptol & TOL_NIGHTS))
|
||||
|
@ -11625,7 +11616,7 @@ void P_SpawnPlayer(INT32 playernum)
|
|||
mobj->angle = 0;
|
||||
|
||||
// set color translations for player sprites
|
||||
mobj->color = p->skincolor;
|
||||
mobj->color = P_GetPlayerColor(p);
|
||||
|
||||
// set 'spritedef' override in mobj for player skins.. (see ProjectSprite)
|
||||
// (usefulness: when body mobj is detached from player (who respawns),
|
||||
|
|
|
@ -7174,37 +7174,23 @@ static void P_RunLevelScript(const char *scriptname)
|
|||
|
||||
static void P_ForceCharacter(const char *forcecharskin)
|
||||
{
|
||||
if (netgame)
|
||||
{
|
||||
char skincmd[33];
|
||||
if (splitscreen)
|
||||
{
|
||||
sprintf(skincmd, "skin2 %s\n", forcecharskin);
|
||||
CV_Set(&cv_skin2, forcecharskin);
|
||||
}
|
||||
// Don't do anything if the server is forcing a skin already.
|
||||
if (netgame && cv_forceskin.value >= 0)
|
||||
return;
|
||||
|
||||
sprintf(skincmd, "skin %s\n", forcecharskin);
|
||||
COM_BufAddText(skincmd);
|
||||
}
|
||||
else
|
||||
for (unsigned i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (splitscreen)
|
||||
{
|
||||
SetPlayerSkin(secondarydisplayplayer, forcecharskin);
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
SetPlayerSkin(consoleplayer, forcecharskin);
|
||||
// normal player colors in single player
|
||||
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;
|
||||
}
|
||||
INT32 skinnum = R_SkinAvailable(forcecharskin);
|
||||
if (skinnum == -1 || !R_SkinUsable(i, skinnum))
|
||||
continue;
|
||||
|
||||
SetPlayerSkinByNum(i, skinnum);
|
||||
|
||||
if (!netgame)
|
||||
players[i].skincolor = skins[skinnum].prefcolor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
21
src/p_user.c
21
src/p_user.c
|
@ -686,7 +686,7 @@ static void P_DeNightserizePlayer(player_t *player)
|
|||
|
||||
player->mo->skin = &skins[player->skin];
|
||||
player->followitem = skins[player->skin].followitem;
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_RETURNSKIN);
|
||||
|
||||
// Restore aiming angle
|
||||
|
@ -3032,7 +3032,7 @@ static void P_CheckInvincibilityTimer(player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
}
|
||||
|
@ -4305,7 +4305,7 @@ static void P_DoSuperStuff(player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -4355,7 +4355,7 @@ static void P_DoSuperStuff(player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -13119,3 +13119,16 @@ boolean P_PlayerShouldUseSpinHeight(player_t *player)
|
|||
&& player->dashmode >= DASHMODE_THRESHOLD && player->mo->state-states == S_PLAY_DASH)
|
||||
|| JUMPCURLED(player));
|
||||
}
|
||||
|
||||
UINT16 P_GetPlayerColor(player_t *player)
|
||||
{
|
||||
if (G_GametypeHasTeams() && player->ctfteam)
|
||||
{
|
||||
if (player->ctfteam == 1)
|
||||
return skincolor_redteam;
|
||||
else if (player->ctfteam == 2)
|
||||
return skincolor_blueteam;
|
||||
}
|
||||
|
||||
return player->skincolor;
|
||||
}
|
||||
|
|
|
@ -306,6 +306,21 @@ INT32 R_SkinAvailable(const char *name)
|
|||
return -1;
|
||||
}
|
||||
|
||||
INT32 R_GetForcedSkin(INT32 playernum)
|
||||
{
|
||||
if (netgame && cv_forceskin.value >= 0 && R_SkinUsable(playernum, cv_forceskin.value))
|
||||
return cv_forceskin.value;
|
||||
|
||||
if (mapheaderinfo[gamemap-1] && mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0')
|
||||
{
|
||||
INT32 skinnum = R_SkinAvailable(mapheaderinfo[gamemap-1]->forcecharacter);
|
||||
if (skinnum != -1 && R_SkinUsable(playernum, skinnum))
|
||||
return skinnum;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Auxillary function that actually sets the skin
|
||||
static void SetSkin(player_t *player, INT32 skinnum)
|
||||
{
|
||||
|
@ -347,10 +362,6 @@ static void SetSkin(player_t *player, INT32 skinnum)
|
|||
|
||||
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;
|
||||
if (player->bot && botingame)
|
||||
{
|
||||
|
|
|
@ -96,6 +96,7 @@ void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
|
|||
boolean R_SkinUsable(INT32 playernum, INT32 skinnum);
|
||||
UINT32 R_GetSkinAvailabilities(void);
|
||||
INT32 R_SkinAvailable(const char *name);
|
||||
INT32 R_GetForcedSkin(INT32 playernum);
|
||||
void R_AddSkins(UINT16 wadnum, boolean mainfile);
|
||||
void R_PatchSkins(UINT16 wadnum, boolean mainfile);
|
||||
|
||||
|
|
|
@ -827,6 +827,8 @@ static void ST_drawLivesArea(void)
|
|||
V_DrawSmallScaledPatch(hudinfo[HUD_LIVES].x, hudinfo[HUD_LIVES].y,
|
||||
hudinfo[HUD_LIVES].f|V_PERPLAYER|V_HUDTRANS, livesback);
|
||||
|
||||
UINT16 facecolor = P_GetPlayerColor(stplyr);
|
||||
|
||||
// face
|
||||
if (stplyr->spectator)
|
||||
{
|
||||
|
@ -856,10 +858,10 @@ static void ST_drawLivesArea(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (stplyr->skincolor)
|
||||
else if (facecolor)
|
||||
{
|
||||
// skincolor face
|
||||
UINT8 *colormap = R_GetTranslationColormap(stplyr->skin, stplyr->skincolor, GTC_CACHE);
|
||||
UINT8 *colormap = R_GetTranslationColormap(stplyr->skin, facecolor, GTC_CACHE);
|
||||
V_DrawSmallMappedPatch(hudinfo[HUD_LIVES].x, hudinfo[HUD_LIVES].y,
|
||||
hudinfo[HUD_LIVES].f|V_PERPLAYER|V_HUDTRANS, faceprefix[stplyr->skin], colormap);
|
||||
}
|
||||
|
@ -1030,7 +1032,8 @@ static void ST_drawLivesArea(void)
|
|||
|
||||
static void ST_drawInput(void)
|
||||
{
|
||||
const INT32 accent = V_SNAPTOLEFT|V_SNAPTOBOTTOM|(stplyr->skincolor ? skincolors[stplyr->skincolor].ramp[4] : 0);
|
||||
UINT16 color = P_GetPlayerColor(stplyr);
|
||||
const INT32 accent = V_SNAPTOLEFT|V_SNAPTOBOTTOM|(color ? skincolors[color].ramp[4] : 0);
|
||||
INT32 col;
|
||||
UINT8 offs;
|
||||
|
||||
|
|
Loading…
Reference in a new issue