diff --git a/src/d_netcmd.c b/src/d_netcmd.c index e821bcaab..78f88435c 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1203,33 +1203,40 @@ static void Got_NameAndColor(const UINT8 **cp, INT32 playernum) // The following is a miniature subset of Got_Teamchange. if ((gamestate == GS_LEVEL) // In a level? - && (cv_restrictskinchange.value) // Skin changes are restricted? - && (G_GametypeHasSpectators() && players[playernum].spectator == false) // not a spectator but could be? && (players[playernum].jointime > 1) // permit on join && (leveltime > introtime) // permit during intro turnaround && (players[playernum].skin != oldskin)) // a skin change actually happened? { - for (i = 0; i < MAXPLAYERS; ++i) - { - if (i == playernum) - continue; - if (!playeringame[i]) - continue; - if (players[i].spectator) - continue; - break; - } + players[playernum].roundconditions.switched_skin = true; - if (i != MAXPLAYERS // Someone on your server who isn't you? - && LUA_HookTeamSwitch(&players[playernum], 0, false, false, false)) // fiiiine, lua can except it + if ( + cv_restrictskinchange.value // Skin changes are restricted? + && G_GametypeHasSpectators() // not a spectator... + && players[playernum].spectator == false // ...but could be? + ) { - P_DamageMobj(players[playernum].mo, NULL, NULL, 1, DMG_SPECTATOR); - - if (players[i].spectator) + for (i = 0; i < MAXPLAYERS; ++i) { - HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); + if (i == playernum) + continue; + if (!playeringame[i]) + continue; + if (players[i].spectator) + continue; + break; + } - FinalisePlaystateChange(playernum); + if (i != MAXPLAYERS // Someone on your server who isn't you? + && LUA_HookTeamSwitch(&players[playernum], 0, false, false, false)) // fiiiine, lua can except it + { + P_DamageMobj(players[playernum].mo, NULL, NULL, 1, DMG_SPECTATOR); + + if (players[i].spectator) + { + HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); + + FinalisePlaystateChange(playernum); + } } } } diff --git a/src/d_player.h b/src/d_player.h index 9306af9cd..d0de6c444 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -464,6 +464,9 @@ struct roundconditions_t // 32 triggers, one bit each, for map execution UINT32 unlocktriggers; + + // Forbidding skin-based unlocks if you changed your skin + boolean switched_skin; }; // player_t struct for all skybox variables diff --git a/src/g_game.c b/src/g_game.c index 52764ed84..fa2ca0839 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2267,6 +2267,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) rings = 5; } + saveroundconditions = false; + if (betweenmaps || leveltime < introtime) { K_StopRoulette(&itemRoulette); @@ -2288,7 +2290,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) lastsafecheatcheck = 0; bigwaypointgap = 0; - saveroundconditions = false; tallyactive = false; } else @@ -2328,8 +2329,11 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) pflags |= (players[player].pflags & (PF_STASIS|PF_ELIMINATED|PF_NOCONTEST|PF_FAULT|PF_LOSTLIFE)); - memcpy(&roundconditions, &players[player].roundconditions, sizeof (roundconditions)); - saveroundconditions = true; + if (spectator == false) + { + memcpy(&roundconditions, &players[player].roundconditions, sizeof (roundconditions)); + saveroundconditions = true; + } lastsafelap = players[player].lastsafelap; lastsafecheatcheck = players[player].lastsafecheatcheck; diff --git a/src/m_cond.c b/src/m_cond.c index 1777af617..2902c88dd 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1649,9 +1649,13 @@ boolean M_CheckCondition(condition_t *cn, player_t *player) case UCRP_ISMAP: return (gamemap == cn->requirement+1); case UCRP_ISCHARACTER: - return (player->skin == cn->requirement); + return ( + player->roundconditions.switched_skin == false + && player->skin == cn->requirement + ); case UCRP_ISENGINECLASS: - return (player->skin < numskins + return (player->roundconditions.switched_skin == false + && player->skin < numskins && R_GetEngineClass( skins[player->skin].kartspeed, skins[player->skin].kartweight,