mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-24 11:42:03 +00:00
Fixed a bug where using your shield ability just before your shield changed got you stuck in whatever state it left you.
To do that, P_SwitchShield was born! Don't use with Force.
This commit is contained in:
parent
18ec4297ee
commit
f1fb276e5a
3 changed files with 40 additions and 22 deletions
|
@ -3058,11 +3058,7 @@ void A_JumpShield(mobj_t *actor)
|
|||
|
||||
player = actor->target->player;
|
||||
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) != SH_JUMP)
|
||||
{
|
||||
player->powers[pw_shield] = SH_JUMP|(player->powers[pw_shield] & SH_STACK);
|
||||
P_SpawnShieldOrb(player);
|
||||
}
|
||||
P_SwitchShield(player, SH_JUMP);
|
||||
|
||||
S_StartSound(player->mo, actor->info->seesound);
|
||||
}
|
||||
|
@ -3090,11 +3086,7 @@ void A_RingShield(mobj_t *actor)
|
|||
|
||||
player = actor->target->player;
|
||||
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) != SH_ATTRACT)
|
||||
{
|
||||
player->powers[pw_shield] = SH_ATTRACT|(player->powers[pw_shield] & SH_STACK);
|
||||
P_SpawnShieldOrb(player);
|
||||
}
|
||||
P_SwitchShield(player, SH_ATTRACT);
|
||||
|
||||
S_StartSound(player->mo, actor->info->seesound);
|
||||
}
|
||||
|
@ -3296,8 +3288,8 @@ void A_BombShield(mobj_t *actor)
|
|||
P_BlackOw(player);
|
||||
|
||||
// Now we know for certain that we don't have a bomb shield, so add one. :3
|
||||
player->powers[pw_shield] = SH_BOMB|(player->powers[pw_shield] & SH_STACK);
|
||||
P_SpawnShieldOrb(player);
|
||||
P_SwitchShield(player, SH_BOMB);
|
||||
|
||||
S_StartSound(player->mo, actor->info->seesound);
|
||||
}
|
||||
|
||||
|
@ -3324,11 +3316,7 @@ void A_WaterShield(mobj_t *actor)
|
|||
|
||||
player = actor->target->player;
|
||||
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) != SH_ELEMENTAL)
|
||||
{
|
||||
player->powers[pw_shield] = SH_ELEMENTAL|(player->powers[pw_shield] & SH_STACK);
|
||||
P_SpawnShieldOrb(player);
|
||||
}
|
||||
P_SwitchShield(player, SH_ELEMENTAL);
|
||||
|
||||
if (player->powers[pw_underwater] && player->powers[pw_underwater] <= 12*TICRATE + 1)
|
||||
P_RestoreMusic(player);
|
||||
|
@ -3366,8 +3354,17 @@ void A_ForceShield(mobj_t *actor)
|
|||
|
||||
player = actor->target->player;
|
||||
|
||||
//can't use P_SwitchShield(player, SH_FORCE) - special case
|
||||
|
||||
if (!(player->powers[pw_shield] & SH_FORCE))
|
||||
{
|
||||
// Just in case.
|
||||
if (player->pflags & PF_SHIELDABILITY)
|
||||
{
|
||||
player->pflags &= ~PF_SHIELDABILITY;
|
||||
player->homing = 0;
|
||||
}
|
||||
|
||||
player->powers[pw_shield] = SH_FORCE|(player->powers[pw_shield] & SH_STACK)|0x01;
|
||||
P_SpawnShieldOrb(player);
|
||||
}
|
||||
|
@ -3404,11 +3401,7 @@ void A_PityShield(mobj_t *actor)
|
|||
|
||||
player = actor->target->player;
|
||||
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) != SH_PITY)
|
||||
{
|
||||
player->powers[pw_shield] = SH_PITY+(player->powers[pw_shield] & SH_STACK);
|
||||
P_SpawnShieldOrb(player);
|
||||
}
|
||||
P_SwitchShield(player, SH_PITY);
|
||||
|
||||
S_StartSound(player->mo, actor->info->seesound);
|
||||
}
|
||||
|
|
|
@ -142,6 +142,7 @@ boolean P_InQuicksand(mobj_t *mo);
|
|||
void P_SetObjectMomZ(mobj_t *mo, fixed_t value, boolean relative);
|
||||
void P_RestoreMusic(player_t *player);
|
||||
void P_SpawnShieldOrb(player_t *player);
|
||||
void P_SwitchShield(player_t *player, UINT16 shieldtype);
|
||||
mobj_t *P_SpawnGhostMobj(mobj_t *mobj);
|
||||
void P_GivePlayerRings(player_t *player, INT32 num_rings);
|
||||
void P_GivePlayerLives(player_t *player, INT32 numlives);
|
||||
|
|
24
src/p_user.c
24
src/p_user.c
|
@ -1403,6 +1403,30 @@ void P_SpawnShieldOrb(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
void P_SwitchShield(player_t *player, UINT16 shieldtype)
|
||||
{
|
||||
if ((player->powers[pw_shield] & SH_NOSTACK) != shieldtype)
|
||||
{
|
||||
// Just in case.
|
||||
if (player->pflags & PF_SHIELDABILITY)
|
||||
{
|
||||
player->pflags &= ~PF_SPINNING|PF_SHIELDABILITY; // They'll still have PF_THOKKED...
|
||||
player->homing = 0;
|
||||
if (player->powers[pw_shield] & SH_FORCE) // Dash.
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
|
||||
player->mo->flags &= ~MF_NOGRAVITY;
|
||||
player->pflags &= ~PF_FULLSTASIS;
|
||||
player->mo->momx >>= 3;
|
||||
player->mo->momy >>= 3;
|
||||
}
|
||||
}
|
||||
|
||||
player->powers[pw_shield] = shieldtype|(player->powers[pw_shield] & SH_STACK);
|
||||
P_SpawnShieldOrb(player);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_SpawnGhostMobj
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue