mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'challenge-reskin' into 'master'
Halt skin-switching Challenge cheese (resolves #1231) Closes #1231 See merge request KartKrew/Kart!2206
This commit is contained in:
commit
96948258d2
4 changed files with 42 additions and 24 deletions
|
|
@ -1203,33 +1203,40 @@ static void Got_NameAndColor(const UINT8 **cp, INT32 playernum)
|
||||||
|
|
||||||
// The following is a miniature subset of Got_Teamchange.
|
// The following is a miniature subset of Got_Teamchange.
|
||||||
if ((gamestate == GS_LEVEL) // In a level?
|
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
|
&& (players[playernum].jointime > 1) // permit on join
|
||||||
&& (leveltime > introtime) // permit during intro turnaround
|
&& (leveltime > introtime) // permit during intro turnaround
|
||||||
&& (players[playernum].skin != oldskin)) // a skin change actually happened?
|
&& (players[playernum].skin != oldskin)) // a skin change actually happened?
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAXPLAYERS; ++i)
|
players[playernum].roundconditions.switched_skin = true;
|
||||||
{
|
|
||||||
if (i == playernum)
|
|
||||||
continue;
|
|
||||||
if (!playeringame[i])
|
|
||||||
continue;
|
|
||||||
if (players[i].spectator)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i != MAXPLAYERS // Someone on your server who isn't you?
|
if (
|
||||||
&& LUA_HookTeamSwitch(&players[playernum], 0, false, false, false)) // fiiiine, lua can except it
|
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);
|
for (i = 0; i < MAXPLAYERS; ++i)
|
||||||
|
|
||||||
if (players[i].spectator)
|
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -464,6 +464,9 @@ struct roundconditions_t
|
||||||
|
|
||||||
// 32 triggers, one bit each, for map execution
|
// 32 triggers, one bit each, for map execution
|
||||||
UINT32 unlocktriggers;
|
UINT32 unlocktriggers;
|
||||||
|
|
||||||
|
// Forbidding skin-based unlocks if you changed your skin
|
||||||
|
boolean switched_skin;
|
||||||
};
|
};
|
||||||
|
|
||||||
// player_t struct for all skybox variables
|
// player_t struct for all skybox variables
|
||||||
|
|
|
||||||
10
src/g_game.c
10
src/g_game.c
|
|
@ -2267,6 +2267,8 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
rings = 5;
|
rings = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveroundconditions = false;
|
||||||
|
|
||||||
if (betweenmaps || leveltime < introtime)
|
if (betweenmaps || leveltime < introtime)
|
||||||
{
|
{
|
||||||
K_StopRoulette(&itemRoulette);
|
K_StopRoulette(&itemRoulette);
|
||||||
|
|
@ -2288,7 +2290,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
||||||
lastsafecheatcheck = 0;
|
lastsafecheatcheck = 0;
|
||||||
bigwaypointgap = 0;
|
bigwaypointgap = 0;
|
||||||
|
|
||||||
saveroundconditions = false;
|
|
||||||
tallyactive = false;
|
tallyactive = false;
|
||||||
}
|
}
|
||||||
else
|
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));
|
pflags |= (players[player].pflags & (PF_STASIS|PF_ELIMINATED|PF_NOCONTEST|PF_FAULT|PF_LOSTLIFE));
|
||||||
|
|
||||||
memcpy(&roundconditions, &players[player].roundconditions, sizeof (roundconditions));
|
if (spectator == false)
|
||||||
saveroundconditions = true;
|
{
|
||||||
|
memcpy(&roundconditions, &players[player].roundconditions, sizeof (roundconditions));
|
||||||
|
saveroundconditions = true;
|
||||||
|
}
|
||||||
|
|
||||||
lastsafelap = players[player].lastsafelap;
|
lastsafelap = players[player].lastsafelap;
|
||||||
lastsafecheatcheck = players[player].lastsafecheatcheck;
|
lastsafecheatcheck = players[player].lastsafecheatcheck;
|
||||||
|
|
|
||||||
|
|
@ -1649,9 +1649,13 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
|
||||||
case UCRP_ISMAP:
|
case UCRP_ISMAP:
|
||||||
return (gamemap == cn->requirement+1);
|
return (gamemap == cn->requirement+1);
|
||||||
case UCRP_ISCHARACTER:
|
case UCRP_ISCHARACTER:
|
||||||
return (player->skin == cn->requirement);
|
return (
|
||||||
|
player->roundconditions.switched_skin == false
|
||||||
|
&& player->skin == cn->requirement
|
||||||
|
);
|
||||||
case UCRP_ISENGINECLASS:
|
case UCRP_ISENGINECLASS:
|
||||||
return (player->skin < numskins
|
return (player->roundconditions.switched_skin == false
|
||||||
|
&& player->skin < numskins
|
||||||
&& R_GetEngineClass(
|
&& R_GetEngineClass(
|
||||||
skins[player->skin].kartspeed,
|
skins[player->skin].kartspeed,
|
||||||
skins[player->skin].kartweight,
|
skins[player->skin].kartweight,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue