mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
* CA_BOUNCE users now play animation/sound when bouncing on enemies, monitors.
* CA_BOUNCE users harmlessly bounce off Sharps.
This commit is contained in:
parent
b84ad05061
commit
942065ba9f
5 changed files with 44 additions and 13 deletions
|
@ -382,6 +382,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
else
|
else
|
||||||
toucher->momz = -toucher->momz;
|
toucher->momz = -toucher->momz;
|
||||||
}
|
}
|
||||||
|
if (player->pflags & PF_BOUNCING)
|
||||||
|
P_DoAbilityBounce(player, false);
|
||||||
toucher->momx = -toucher->momx;
|
toucher->momx = -toucher->momx;
|
||||||
toucher->momy = -toucher->momy;
|
toucher->momy = -toucher->momy;
|
||||||
P_DamageMobj(special, toucher, toucher, 1, 0);
|
P_DamageMobj(special, toucher, toucher, 1, 0);
|
||||||
|
@ -416,8 +418,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
else if (special->type == MT_SHARP
|
else if (special->type == MT_SHARP
|
||||||
&& ((special->state == &states[special->info->xdeathstate]) || (toucher->z > special->z + special->height/2)))
|
&& ((special->state == &states[special->info->xdeathstate]) || (toucher->z > special->z + special->height/2)))
|
||||||
{
|
{
|
||||||
// Cannot hit sharp from above or when red and angry
|
if (player->pflags & PF_BOUNCING)
|
||||||
P_DamageMobj(toucher, special, special, 1, 0);
|
{
|
||||||
|
toucher->momz = -toucher->momz;
|
||||||
|
P_DoAbilityBounce(player, false);
|
||||||
|
}
|
||||||
|
else // Cannot hit sharp from above or when red and angry
|
||||||
|
P_DamageMobj(toucher, special, special, 1, 0);
|
||||||
}
|
}
|
||||||
else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING))
|
else if (((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING))
|
||||||
|| ((player->pflags & PF_JUMPED) && (player->pflags & PF_FORCEJUMPDAMAGE || !(player->charflags & SF_NOJUMPSPIN) || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY)))
|
|| ((player->pflags & PF_JUMPED) && (player->pflags & PF_FORCEJUMPDAMAGE || !(player->charflags & SF_NOJUMPSPIN) || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY)))
|
||||||
|
@ -433,6 +440,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||||
else
|
else
|
||||||
toucher->momz = -toucher->momz;
|
toucher->momz = -toucher->momz;
|
||||||
}
|
}
|
||||||
|
if (player->pflags & PF_BOUNCING)
|
||||||
|
P_DoAbilityBounce(player, false);
|
||||||
|
|
||||||
P_DamageMobj(special, toucher, toucher, 1, 0);
|
P_DamageMobj(special, toucher, toucher, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,7 @@ boolean P_AutoPause(void);
|
||||||
|
|
||||||
void P_DoJumpShield(player_t *player);
|
void P_DoJumpShield(player_t *player);
|
||||||
void P_DoBubbleBounce(player_t *player);
|
void P_DoBubbleBounce(player_t *player);
|
||||||
|
void P_DoAbilityBounce(player_t *player, boolean changemomz);
|
||||||
void P_BlackOw(player_t *player);
|
void P_BlackOw(player_t *player);
|
||||||
void P_ElementalFire(player_t *player, boolean cropcircle);
|
void P_ElementalFire(player_t *player, boolean cropcircle);
|
||||||
|
|
||||||
|
|
|
@ -1084,7 +1084,11 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||||
*momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically.
|
*momz = -*momz; // Therefore, you should be thrust in the opposite direction, vertically.
|
||||||
}
|
}
|
||||||
if (!(elementalpierce == 1 && thing->flags & MF_GRENADEBOUNCE)) // prevent gold monitor clipthrough.
|
if (!(elementalpierce == 1 && thing->flags & MF_GRENADEBOUNCE)) // prevent gold monitor clipthrough.
|
||||||
|
{
|
||||||
|
if (player->pflags & PF_BOUNCING)
|
||||||
|
P_DoAbilityBounce(player);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
*z -= *momz; // to ensure proper collision.
|
*z -= *momz; // to ensure proper collision.
|
||||||
}
|
}
|
||||||
|
|
13
src/p_mobj.c
13
src/p_mobj.c
|
@ -3318,17 +3318,8 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||||
|
|
||||||
if (mo->player->pflags & PF_BOUNCING && !P_CheckDeathPitCollide(mo))
|
if (mo->player->pflags & PF_BOUNCING && !P_CheckDeathPitCollide(mo))
|
||||||
{
|
{
|
||||||
fixed_t prevmomz = P_MobjFlip(mo)*abs(mo->momz);
|
mo->momz *= -1;
|
||||||
if (mo->eflags & MFE_UNDERWATER)
|
P_DoAbilityBounce(mo->player, true);
|
||||||
{
|
|
||||||
prevmomz /= 2;
|
|
||||||
}
|
|
||||||
S_StartSound(mo, sfx_boingf);
|
|
||||||
P_DoJump(mo->player, false);
|
|
||||||
P_SetPlayerMobjState(mo, S_PLAY_BOUNCE_LANDING);
|
|
||||||
mo->player->pflags |= PF_BOUNCING|PF_THOKKED;
|
|
||||||
mo->player->jumping = 0;
|
|
||||||
mo->momz = (FixedMul(mo->momz, 3*FRACUNIT/2) + prevmomz)/2;
|
|
||||||
clipmomz = false;
|
clipmomz = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
26
src/p_user.c
26
src/p_user.c
|
@ -4005,6 +4005,32 @@ void P_DoBubbleBounce(player_t *player)
|
||||||
player->mo->momz = FixedMul(player->mo->momz, 5*FRACUNIT/4);
|
player->mo->momz = FixedMul(player->mo->momz, 5*FRACUNIT/4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// P_DoAbilityBounce
|
||||||
|
//
|
||||||
|
// CA_BOUNCE landing handling
|
||||||
|
//
|
||||||
|
void P_DoAbilityBounce(player_t *player, boolean changemomz)
|
||||||
|
{
|
||||||
|
fixed_t prevmomz;
|
||||||
|
if (player->mo->state-states == S_PLAY_BOUNCE_LANDING)
|
||||||
|
return;
|
||||||
|
if (changemomz)
|
||||||
|
{
|
||||||
|
prevmomz = P_MobjFlip(player->mo)*player->mo->momz;
|
||||||
|
if (prevmomz < 0)
|
||||||
|
prevmomz = 0;
|
||||||
|
else if (player->mo->eflags & MFE_UNDERWATER)
|
||||||
|
prevmomz /= 2;
|
||||||
|
P_DoJump(player, false);
|
||||||
|
player->jumping = 0;
|
||||||
|
player->mo->momz = (FixedMul(player->mo->momz, 3*FRACUNIT/2) + prevmomz)/2;
|
||||||
|
}
|
||||||
|
S_StartSound(player->mo, sfx_boingf);
|
||||||
|
P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE_LANDING);
|
||||||
|
player->pflags |= PF_BOUNCING|PF_THOKKED;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_Telekinesis
|
// P_Telekinesis
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue