mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 12:01:05 +00:00
Remember the player's color after a team gametype
This commit is contained in:
parent
57592a566a
commit
3377fa986a
9 changed files with 31 additions and 82 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)
|
||||
|
|
|
@ -1233,15 +1233,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)
|
||||
{
|
||||
|
@ -1367,16 +1358,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)
|
||||
|
@ -1498,7 +1479,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]))
|
||||
|
@ -1507,15 +1488,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;
|
||||
|
@ -2904,17 +2876,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();
|
||||
|
|
19
src/g_game.c
19
src/g_game.c
|
@ -2748,25 +2748,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;
|
||||
|
||||
|
|
|
@ -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
|
@ -11564,8 +11564,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;
|
||||
|
@ -11585,13 +11583,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))
|
||||
|
@ -11603,7 +11594,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),
|
||||
|
|
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
|
||||
|
@ -3029,7 +3029,7 @@ static void P_CheckInvincibilityTimer(player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
}
|
||||
|
@ -4302,7 +4302,7 @@ static void P_DoSuperStuff(player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -4352,7 +4352,7 @@ static void P_DoSuperStuff(player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->color = P_GetPlayerColor(player);
|
||||
G_GhostAddColor(GHC_NORMAL);
|
||||
}
|
||||
|
||||
|
@ -13113,3 +13113,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;
|
||||
}
|
||||
|
|
|
@ -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