Let Bubble blow-up destroy any MF_SHOOTABLE object

This commit is contained in:
James R 2024-01-13 16:31:54 -08:00
parent dd1db7cd4a
commit 99a2a3fb74
2 changed files with 37 additions and 29 deletions

View file

@ -745,17 +745,6 @@ void K_LightningShieldAttack(mobj_t *actor, fixed_t size)
boolean K_BubbleShieldCollide(mobj_t *t1, mobj_t *t2) boolean K_BubbleShieldCollide(mobj_t *t1, mobj_t *t2)
{ {
if (t1->type == MT_PLAYER)
{
// Bubble Shield already has a hitbox, and it gets
// teleported every tic so the Bubble itself will
// always make contact with other objects.
//
// Therefore, we don't need a second, smaller hitbox
// on the player. It'll just cause unwanted hitlag.
return true;
}
if (t2->type == MT_PLAYER) if (t2->type == MT_PLAYER)
{ {
// Counter desyncs // Counter desyncs

View file

@ -522,6 +522,17 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
} }
} }
static boolean P_BubbleCanReflect(mobj_t *t1, mobj_t *t2)
{
return (t2->type == MT_ORBINAUT || t2->type == MT_JAWZ || t2->type == MT_GACHABOM
|| t2->type == MT_BANANA || t2->type == MT_EGGMANITEM || t2->type == MT_BALLHOG
|| t2->type == MT_SSMINE || t2->type == MT_LANDMINE || t2->type == MT_SINK
|| t2->type == MT_GARDENTOP
|| t2->type == MT_DROPTARGET
|| t2->type == MT_KART_LEFTOVER
|| (t2->type == MT_PLAYER && t1->target != t2));
}
// //
// PIT_CheckThing // PIT_CheckThing
// //
@ -994,15 +1005,8 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
return BMIT_CONTINUE; return BMIT_CONTINUE;
// Bubble Shield reflect // Bubble Shield reflect
if (((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->bubbleblowup) if ((thing->type == MT_BUBBLESHIELD && thing->target->player && thing->target->player->bubbleblowup)
|| (thing->player && thing->player->bubbleblowup)) || (thing->player && thing->player->bubbleblowup))
&& (tm.thing->type == MT_ORBINAUT || tm.thing->type == MT_JAWZ || tm.thing->type == MT_GACHABOM
|| tm.thing->type == MT_BANANA || tm.thing->type == MT_EGGMANITEM || tm.thing->type == MT_BALLHOG
|| tm.thing->type == MT_SSMINE || tm.thing->type == MT_LANDMINE || tm.thing->type == MT_SINK
|| tm.thing->type == MT_GARDENTOP
|| tm.thing->type == MT_DROPTARGET
|| tm.thing->type == MT_KART_LEFTOVER
|| (tm.thing->type == MT_PLAYER && thing->target != tm.thing)))
{ {
// see if it went over / under // see if it went over / under
if (tm.thing->z > thing->z + thing->height) if (tm.thing->z > thing->z + thing->height)
@ -1010,17 +1014,21 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
if (tm.thing->z + tm.thing->height < thing->z) if (tm.thing->z + tm.thing->height < thing->z)
return BMIT_CONTINUE; // underneath return BMIT_CONTINUE; // underneath
if (P_BubbleCanReflect(thing, tm.thing))
{
// don't let player hitbox touch it too
if (thing->player)
return BMIT_CONTINUE;
return K_BubbleShieldCollide(thing, tm.thing) ? BMIT_CONTINUE : BMIT_ABORT; return K_BubbleShieldCollide(thing, tm.thing) ? BMIT_CONTINUE : BMIT_ABORT;
} }
else if (((tm.thing->type == MT_BUBBLESHIELD && tm.thing->target->player && tm.thing->target->player->bubbleblowup) else if ((tm.thing->flags & MF_SHOOTABLE) && !thing->player)
{
P_DamageMobj(tm.thing, thing, thing->target, 1, DMG_NORMAL);
return BMIT_CONTINUE;
}
}
else if ((tm.thing->type == MT_BUBBLESHIELD && tm.thing->target->player && tm.thing->target->player->bubbleblowup)
|| (tm.thing->player && tm.thing->player->bubbleblowup)) || (tm.thing->player && tm.thing->player->bubbleblowup))
&& (thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_GACHABOM
|| thing->type == MT_BANANA || thing->type == MT_EGGMANITEM || thing->type == MT_BALLHOG
|| thing->type == MT_SSMINE || thing->type == MT_LANDMINE || thing->type == MT_SINK
|| thing->type == MT_GARDENTOP
|| thing->type == MT_DROPTARGET
|| thing->type == MT_KART_LEFTOVER
|| (thing->type == MT_PLAYER && tm.thing->target != thing)))
{ {
// see if it went over / under // see if it went over / under
if (tm.thing->z > thing->z + thing->height) if (tm.thing->z > thing->z + thing->height)
@ -1028,8 +1036,19 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
if (tm.thing->z + tm.thing->height < thing->z) if (tm.thing->z + tm.thing->height < thing->z)
return BMIT_CONTINUE; // underneath return BMIT_CONTINUE; // underneath
if (P_BubbleCanReflect(tm.thing, thing))
{
// don't let player hitbox touch it too
if (tm.thing->player)
return BMIT_CONTINUE;
return K_BubbleShieldCollide(tm.thing, thing) ? BMIT_CONTINUE : BMIT_ABORT; return K_BubbleShieldCollide(tm.thing, thing) ? BMIT_CONTINUE : BMIT_ABORT;
} }
else if ((thing->flags & MF_SHOOTABLE) && !tm.thing->player)
{
P_DamageMobj(thing, tm.thing, tm.thing->target, 1, DMG_NORMAL);
return BMIT_CONTINUE;
}
}
// double make sure bubbles won't collide with anything else // double make sure bubbles won't collide with anything else
if (thing->type == MT_BUBBLESHIELD || tm.thing->type == MT_BUBBLESHIELD) if (thing->type == MT_BUBBLESHIELD || tm.thing->type == MT_BUBBLESHIELD)