Add sightcheck boolean to P_RadiusAttack

Also now destroys Egg Guard shields, and circumstantially Minuses
This commit is contained in:
lachwright 2020-07-04 18:27:06 +08:00
parent e44d93f76b
commit 527e682931
6 changed files with 23 additions and 14 deletions

View File

@ -1580,11 +1580,12 @@ static int lib_pRadiusAttack(lua_State *L)
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
fixed_t damagedist = luaL_checkfixed(L, 3);
UINT8 damagetype = luaL_optinteger(L, 4, 0);
boolean sightcheck = lua_opttrueboolean(L, 5);
NOHUD
INLEVEL
if (!spot || !source)
return LUA_ErrInvalid(L, "mobj_t");
P_RadiusAttack(spot, source, damagedist, damagetype);
P_RadiusAttack(spot, source, damagedist, damagetype, sightcheck);
return 0;
}

View File

@ -3858,7 +3858,7 @@ void A_Explode(mobj_t *actor)
if (LUA_CallAction("A_Explode", actor))
return;
P_RadiusAttack(actor, actor->target, actor->info->damage, locvar1);
P_RadiusAttack(actor, actor->target, actor->info->damage, locvar1, true);
}
// Function: A_BossDeath
@ -5639,7 +5639,7 @@ void A_MinusPopup(mobj_t *actor)
P_SetObjectMomZ(rock, 3*FRACUNIT, false);
P_SetScale(rock, rock->scale/3);
}
P_RadiusAttack(actor, actor, 2*actor->radius, 0);
P_RadiusAttack(actor, actor, 2*actor->radius, 0, true);
if (actor->tracer)
P_DamageMobj(actor->tracer, actor, actor, 1, 0);
@ -11032,7 +11032,7 @@ void A_VileAttack(mobj_t *actor)
actor->target->x - P_ReturnThrustX(fire, actor->angle, FixedMul(24*FRACUNIT, fire->scale)),
actor->target->y - P_ReturnThrustY(fire, actor->angle, FixedMul(24*FRACUNIT, fire->scale)),
fire->z);
P_RadiusAttack(fire, actor, 70*FRACUNIT, 0);
P_RadiusAttack(fire, actor, 70*FRACUNIT, 0, true);
}
else
{
@ -11077,7 +11077,7 @@ void A_VileAttack(mobj_t *actor)
actor->target->x - P_ReturnThrustX(fire, actor->angle, FixedMul(24*FRACUNIT, fire->scale)),
actor->target->y - P_ReturnThrustY(fire, actor->angle, FixedMul(24*FRACUNIT, fire->scale)),
fire->z);
P_RadiusAttack(fire, actor, 70*FRACUNIT, 0);
P_RadiusAttack(fire, actor, 70*FRACUNIT, 0, true);
}
}
@ -12313,7 +12313,7 @@ void A_MineExplode(mobj_t *actor)
quake.intensity = 8*FRACUNIT;
quake.time = TICRATE/3;
P_RadiusAttack(actor, actor->tracer, 192*FRACUNIT, DMG_CANHURTSELF);
P_RadiusAttack(actor, actor->tracer, 192*FRACUNIT, DMG_CANHURTSELF, true);
P_MobjCheckWater(actor);
{
@ -13314,7 +13314,7 @@ void A_Boss5BombExplode(mobj_t *actor)
actor->flags2 = MF2_EXPLOSION;
if (actor->target)
P_RadiusAttack(actor, actor->target, 7*actor->radius, 0);
P_RadiusAttack(actor, actor->target, 7*actor->radius, 0, true);
P_DustRing(locvar1, 4, actor->x, actor->y, actor->z+actor->height, 2*actor->radius, 0, FRACUNIT, actor->scale);
P_DustRing(locvar1, 6, actor->x, actor->y, actor->z+actor->height/2, 3*actor->radius, FRACUNIT, FRACUNIT, actor->scale);

View File

@ -421,7 +421,7 @@ void P_DelPrecipSeclist(mprecipsecnode_t *node);
void P_CreateSecNodeList(mobj_t *thing, fixed_t x, fixed_t y);
void P_Initsecnode(void);
void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist, UINT8 damagetype);
void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist, UINT8 damagetype, boolean sightcheck);
fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
boolean PIT_PushableMoved(mobj_t *thing);

View File

@ -4015,6 +4015,7 @@ static fixed_t bombdamage;
static mobj_t *bombsource;
static mobj_t *bombspot;
static UINT8 bombdamagetype;
static boolean bombsightcheck;
//
// PIT_RadiusAttack
@ -4028,10 +4029,16 @@ static boolean PIT_RadiusAttack(mobj_t *thing)
if (thing == bombspot) // ignore the bomb itself (Deton fix)
return true;
if ((thing->flags & (MF_MONITOR|MF_SHOOTABLE)) != MF_SHOOTABLE)
if (bombsource && thing->type == bombsource->type && !(bombdamagetype & DMG_CANHURTSELF)) // ignore the type of guys who dropped the bomb (Jetty-Syn Bomber or Skim can bomb eachother, but not themselves.)
return true;
if (bombsource && thing->type == bombsource->type && !(bombdamagetype & DMG_CANHURTSELF)) // ignore the type of guys who dropped the bomb (Jetty-Syn Bomber or Skim can bomb eachother, but not themselves.)
if (thing->type == MT_MINUS && !(thing->flags & (MF_SPECIAL|MF_SHOOTABLE)) && !bombsightcheck)
thing->flags = (thing->flags & ~MF_NOCLIPTHING)|MF_SPECIAL|MF_SHOOTABLE;
if (thing->type == MT_EGGGUARD && thing->tracer) //nuke Egg Guard's shield!
P_KillMobj(thing->tracer, bombspot, bombsource, bombdamagetype);
if ((thing->flags & (MF_MONITOR|MF_SHOOTABLE)) != MF_SHOOTABLE)
return true;
dx = abs(thing->x - bombspot->x);
@ -4053,7 +4060,7 @@ static boolean PIT_RadiusAttack(mobj_t *thing)
if (thing->ceilingz < bombspot->z && bombspot->floorz > thing->z)
return true;
if (P_CheckSight(thing, bombspot))
if (!bombsightcheck || P_CheckSight(thing, bombspot))
{ // must be in direct path
P_DamageMobj(thing, bombspot, bombsource, 1, bombdamagetype); // Tails 01-11-2001
}
@ -4065,7 +4072,7 @@ static boolean PIT_RadiusAttack(mobj_t *thing)
// P_RadiusAttack
// Source is the creature that caused the explosion at spot.
//
void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist, UINT8 damagetype)
void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist, UINT8 damagetype, boolean sightcheck)
{
INT32 x, y;
INT32 xl, xh, yl, yh;
@ -4083,6 +4090,7 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist, UINT8 dama
bombsource = source;
bombdamage = FixedMul(damagedist, spot->scale);
bombdamagetype = damagetype;
bombsightcheck = sightcheck;
for (y = yl; y <= yh; y++)
for (x = xl; x <= xh; x++)

View File

@ -880,7 +880,7 @@ void P_ExplodeMissile(mobj_t *mo)
if (mo->type == MT_DETON)
{
P_RadiusAttack(mo, mo, 96*FRACUNIT, 0);
P_RadiusAttack(mo, mo, 96*FRACUNIT, 0, true);
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
P_SetScale(explodemo, mo->scale);

View File

@ -9030,7 +9030,7 @@ void P_Earthquake(mobj_t *inflictor, mobj_t *source, fixed_t radius)
quake.radius = scaledradius;
}
P_RadiusAttack(inflictor, source, radius, 0);
P_RadiusAttack(inflictor, source, radius, 0, false);
}
//