SF_IRONMAN: handle randomised skin and hurt/death states differently

- P_DamageMobj
    - Become skin temporarily to show off the hurt frames
    - Sets charflags, so P_PlayerThink can handle reversion
    - Add sparkles for losing disguise
- P_KillPlayer
    - Sets charflags, so P_PlayerThink can handle reversion
    - Add extra sound for losing disguise
- G_PlayerReborn
    - Sets charflags in not-betweenmaps case as well, so P_PlayerThink can handle reversion
- P_SpawnPlayer
    - Use set skin for spawn again (partial revert of previously committed code)
- P_PlayerThink
    - More specific conditions for fakeskin reversion
        - Not hurt, dead, or respawning (except for last part of drop)
    - Add sound and sparkles for reapplying disguise
This commit is contained in:
toaster 2023-01-21 14:43:54 +00:00
parent 0606fb50ba
commit 2e35a40b80
4 changed files with 31 additions and 22 deletions

View file

@ -2292,10 +2292,15 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
}
else
{
UINT32 skinflags = (demo.playback)
? demo.skinlist[demo.currentskinid[player]].flags
: skins[players[player].skin].flags;
fakeskin = players[player].fakeskin;
kartspeed = players[player].kartspeed;
kartweight = players[player].kartweight;
charflags = players[player].charflags;
charflags = (skinflags & SF_IRONMAN) ? skinflags : players[player].charflags;
}
lastfakeskin = players[player].lastfakeskin;

View file

@ -1935,7 +1935,9 @@ static boolean P_KillPlayer(player_t *player, mobj_t *inflictor, mobj_t *source,
if (skinflags & SF_IRONMAN)
{
player->mo->skin = &skins[player->skin];
player->charflags = skinflags;
K_SpawnMagicianParticles(player->mo, 5);
S_StartSound(player->mo, sfx_slip);
}
player->mo->renderflags &= ~RF_DONTDRAW;
@ -2281,6 +2283,20 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
player->glanceDir = 0;
player->pflags &= ~PF_GAINAX;
if (!(player->charflags & SF_IRONMAN))
{
UINT32 skinflags = (demo.playback)
? demo.skinlist[demo.currentskinid[(player-players)]].flags
: skins[player->skin].flags;
if (skinflags & SF_IRONMAN)
{
player->mo->skin = &skins[player->skin];
player->charflags = skinflags;
K_SpawnMagicianParticles(player->mo, 5);
}
}
switch (type)
{
case DMG_STING:

View file

@ -11729,26 +11729,7 @@ void P_SpawnPlayer(INT32 playernum)
// set 'spritedef' override in mobj for player skins.. (see ProjectSprite)
// (usefulness: when body mobj is detached from player (who respawns),
// the dead body mobj retains the skin through the 'spritedef' override).
// Loading skins from a player is a little more complicated, now.
{
UINT32 skinflags = (demo.playback)
? demo.skinlist[demo.currentskinid[p-players]].flags
: skins[p->skin].flags;
UINT32 skinid = p->skin;
if ((skinflags & SF_IRONMAN) && (p->fakeskin != MAXSKINS))
{
skinid = p->fakeskin;
if (demo.playback)
{
skinid = demo.skinlist[skinid].mapping;
}
}
mobj->skin = &skins[skinid];
}
mobj->skin = &skins[p->skin];
P_SetupStateAnimation(mobj, mobj->state);
mobj->health = 1;

View file

@ -4238,11 +4238,18 @@ void P_PlayerThink(player_t *player)
{
if (player->charflags & SF_IRONMAN) // no fakeskin yet
{
if (leveltime >= starttime && !player->exiting)
if (leveltime >= starttime
&& !player->exiting
&& player->mo->health > 0
&& (player->respawn.state == RESPAWNST_NONE
|| (player->respawn.state == RESPAWNST_DROP && !player->respawn.timer))
&& !P_PlayerInPain(player))
{
if (player->fakeskin != MAXSKINS)
{
SetFakePlayerSkin(player, player->fakeskin);
S_StartSound(player->mo, sfx_kc33);
K_SpawnMagicianParticles(player->mo, 5);
}
else if (!(gametyperules & GTR_CIRCUIT))
{