Merge branch 'i-pity-you' into 'next'

Allow JumpSpin abilities to be used with non-ability shields

Closes #277

See merge request STJr/SRB2!1146
This commit is contained in:
James R 2020-10-14 03:08:20 -04:00
commit f7e9772e10

View file

@ -5007,40 +5007,14 @@ static void P_DoTwinSpin(player_t *player)
}
//
// P_DoJumpStuff
// returns true if the player used a shield ability, false otherwise
// passing in the mobjs from P_DoJumpStuff is a bit hackily specific, but I don't care enough to make a more elaborate solution (I think that is more appropriately approached with a more general MT_LOCKON spawning system)
//
// Handles player jumping
//
static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lockonthok, mobj_t *visual)
{
mobj_t *lockonthok = NULL, *lockonshield = NULL, *visual = NULL;
mobj_t *lockonshield = NULL;
if (player->pflags & PF_JUMPSTASIS)
return;
if ((player->charability == CA_HOMINGTHOK) && !player->homing && (player->pflags & PF_JUMPED) && (!(player->pflags & PF_THOKKED) || (player->charflags & SF_MULTIABILITY)) && (lockonthok = P_LookForEnemies(player, true, false)))
{
if (P_IsLocalPlayer(player)) // Only display it on your own view.
{
visual = P_SpawnMobj(lockonthok->x, lockonthok->y, lockonthok->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
P_SetTarget(&visual->target, lockonthok);
}
}
//////////////////
//SHIELD ACTIVES//
//& SUPER FLOAT!//
//////////////////
if ((player->pflags & PF_JUMPED) && !player->exiting && !P_PlayerInPain(player))
{
if (onground || player->climbing || player->powers[pw_carry])
;
else if ((gametyperules & GTR_TEAMFLAGS) && player->gotflag)
;
else if (player->pflags & (PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) // If the player has used an ability previously
;
else if ((player->powers[pw_shield] & SH_NOSTACK) && !player->powers[pw_super] && !(player->pflags & PF_SPINDOWN)
if ((player->powers[pw_shield] & SH_NOSTACK) && !player->powers[pw_super] && !(player->pflags & PF_SPINDOWN)
&& ((!(player->pflags & PF_THOKKED) || (((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP || (player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) && player->secondjump == UINT8_MAX) ))) // thokked is optional if you're bubblewrapped / 3dblasted
{
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT)
@ -5093,7 +5067,6 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
case SH_ATTRACT:
player->pflags |= PF_THOKKED|PF_SHIELDABILITY;
player->homing = 2;
player->secondjump = 0;
P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockonshield));
if (lockonshield)
{
@ -5140,7 +5113,47 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
}
}
}
return player->pflags & PF_SHIELDABILITY;
}
return false;
}
//
// P_DoJumpStuff
//
// Handles player jumping
//
static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
{
mobj_t *lockonthok = NULL, *visual = NULL;
if (player->pflags & PF_JUMPSTASIS)
return;
if ((player->charability == CA_HOMINGTHOK) && !player->homing && (player->pflags & PF_JUMPED) && (!(player->pflags & PF_THOKKED) || (player->charflags & SF_MULTIABILITY)) && (lockonthok = P_LookForEnemies(player, true, false)))
{
if (P_IsLocalPlayer(player)) // Only display it on your own view.
{
visual = P_SpawnMobj(lockonthok->x, lockonthok->y, lockonthok->z, MT_LOCKON); // positioning, flip handled in P_SceneryThinker
P_SetTarget(&visual->target, lockonthok);
}
}
//////////////////
//SHIELD ACTIVES//
//& SUPER FLOAT!//
//////////////////
if ((player->pflags & PF_JUMPED) && !player->exiting && !P_PlayerInPain(player))
{
if (onground || player->climbing || player->powers[pw_carry])
;
else if ((gametyperules & GTR_TEAMFLAGS) && player->gotflag)
;
else if (player->pflags & (PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) // If the player has used an ability previously
;
else if (P_PlayerShieldThink(player, cmd, lockonthok, visual))
;
else if ((cmd->buttons & BT_SPIN))
{
if (!(player->pflags & PF_SPINDOWN) && P_SuperReady(player))