- converted most of g_heretic to float.

This commit is contained in:
Christoph Oelckers 2016-03-20 16:51:42 +01:00
parent 0bdb65c477
commit b81080ce08
16 changed files with 88 additions and 87 deletions

View file

@ -860,6 +860,11 @@ public:
return (DVector2(_f_X() - otherpos.x, _f_Y() - otherpos.y).Length())/FRACUNIT;
}
double Distance2D(double x, double y) const
{
return DVector2(X() - x, Y() - y).Length();
}
// a full 3D version of the above
fixed_t Distance3D(AActor *other, bool absolute = false)
{
@ -1438,6 +1443,7 @@ public:
void AddZ(double newz, bool moving = true)
{
__pos.z += FLOAT2FIXED(newz);
if (!moving) PrevZ = __pos.z;
}
// These are not for general use as they do not link the actor into the world!

View file

@ -500,7 +500,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireSTGrenade)
// Temporarily raise the pitch to send the grenade slightly upwards
DAngle SavedPlayerPitch = self->Angles.Pitch;
self->Angles.Pitch -= 6.328125; //(1152 << FRACBITS);
self->Angles.Pitch -= 6.328125; //(1152 << F RACBITS);
P_SpawnPlayerMissile(self, grenade);
self->Angles.Pitch = SavedPlayerPitch;
return 0;

View file

@ -67,8 +67,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr1Attack)
PARAM_ACTION_PROLOGUE;
AActor *mo;
fixed_t vz;
angle_t angle;
DAngle angle;
if (!self->target)
{
@ -86,17 +85,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr1Attack)
PClassActor *fx = PClass::FindActor("SorcererFX1");
if (self->health > (self->SpawnHealth()/3)*2)
{ // Spit one fireball
P_SpawnMissileZ (self, self->_f_Z() + 48*FRACUNIT, self->target, fx );
P_SpawnMissileZ (self, self->Z() + 48, self->target, fx );
}
else
{ // Spit three fireballs
mo = P_SpawnMissileZ (self, self->_f_Z() + 48*FRACUNIT, self->target, fx);
mo = P_SpawnMissileZ (self, self->Z() + 48, self->target, fx);
if (mo != NULL)
{
vz = mo->_f_velz();
angle = mo->_f_angle();
P_SpawnMissileAngleZ (self, self->_f_Z() + 48*FRACUNIT, fx, angle-ANGLE_1*3, vz);
P_SpawnMissileAngleZ (self, self->_f_Z() + 48*FRACUNIT, fx, angle+ANGLE_1*3, vz);
angle = mo->Angles.Yaw;
P_SpawnMissileAngleZ(self, self->Z() + 48, fx, angle - 3, mo->Vel.Z);
P_SpawnMissileAngleZ(self, self->Z() + 48, fx, angle + 3, mo->Vel.Z);
}
if (self->health < self->SpawnHealth()/3)
{ // Maybe attack again
@ -143,24 +141,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcererRise)
void P_DSparilTeleport (AActor *actor)
{
fixed_t prevX;
fixed_t prevY;
fixed_t prevZ;
DVector3 prev;
AActor *mo;
AActor *spot;
DSpotState *state = DSpotState::GetSpotState();
if (state == NULL) return;
spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->_f_X(), actor->_f_Y(), 128*FRACUNIT, 0);
spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->X(), actor->Y(), 128, 0);
if (spot == NULL) return;
prevX = actor->_f_X();
prevY = actor->_f_Y();
prevZ = actor->_f_Z();
if (P_TeleportMove (actor, spot->_f_Pos(), false))
prev = actor->Pos();
if (P_TeleportMove (actor, spot->Pos(), false))
{
mo = Spawn("Sorcerer2Telefade", prevX, prevY, prevZ, ALLOW_REPLACE);
mo = Spawn("Sorcerer2Telefade", prev, ALLOW_REPLACE);
if (mo) mo->Translation = actor->Translation;
S_Sound (mo, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->SetState (actor->FindState("Teleport"));
@ -230,8 +224,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr2Attack)
PClassActor *fx = PClass::FindActor("Sorcerer2FX2");
if (fx)
{
P_SpawnMissileAngle (self, fx, self->_f_angle()-ANG45, FRACUNIT/2);
P_SpawnMissileAngle (self, fx, self->_f_angle()+ANG45, FRACUNIT/2);
P_SpawnMissileAngle(self, fx, self->Angles.Yaw - 45, 0.5);
P_SpawnMissileAngle(self, fx, self->Angles.Yaw + 45, 0.5);
}
}
else
@ -279,7 +273,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
mo = Spawn("Wizard", self->Pos(), ALLOW_REPLACE);
if (mo != NULL)
{
mo->_f_AddZ(-mo->GetDefault()->height / 2, false);
mo->AddZ(-mo->GetDefault()->_Height() / 2, false);
if (!P_TestMobjLocation (mo))
{ // Didn't fit
mo->ClearCounters();

View file

@ -49,12 +49,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
{
PARAM_ACTION_PROLOGUE;
self->_f_AddZ(32*FRACUNIT, false);
self->PrevZ = self->_f_Z(); // no interpolation!
self->AddZ(32, false);
self->RenderStyle = STYLE_Add;
self->alpha = FRACUNIT;
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE);
P_CheckSplash(self, 128<<FRACBITS);
P_CheckSplash(self, 128);
return 0;
}
@ -70,9 +69,8 @@ IMPLEMENT_CLASS (AArtiTimeBomb)
bool AArtiTimeBomb::Use (bool pickup)
{
angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT;
AActor *mo = Spawn("ActivatedTimeBomb",
Owner->_f_Vec3Angle(24*FRACUNIT, Owner->_f_angle(), - Owner->floorclip), ALLOW_REPLACE);
Owner->Vec3Angle(24., Owner->Angles.Yaw, - FIXED2FLOAT(Owner->floorclip)), ALLOW_REPLACE);
mo->target = Owner;
return true;
}

View file

@ -59,7 +59,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PodPain)
}
for (count = chance > 240 ? 2 : 1; count; count--)
{
goo = Spawn(gootype, self->PosPlusZ(48*FRACUNIT), ALLOW_REPLACE);
goo = Spawn(gootype, self->PosPlusZ(48.), ALLOW_REPLACE);
goo->target = self;
goo->Vel.X = pr_podpain.Random2() / 128.;
goo->Vel.Y = pr_podpain.Random2() / 128.;
@ -104,17 +104,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MakePod)
PARAM_CLASS_OPT(podtype, AActor) { podtype = PClass::FindActor("Pod"); }
AActor *mo;
fixed_t x;
fixed_t y;
if (self->special1 == MAX_GEN_PODS)
{ // Too many generated pods
return 0;
}
x = self->_f_X();
y = self->_f_Y();
mo = Spawn(podtype, x, y, ONFLOORZ, ALLOW_REPLACE);
if (!P_CheckPosition (mo, x, y))
mo = Spawn(podtype, self->PosAtZ(ONFLOORZ), ALLOW_REPLACE);
if (!P_CheckPosition (mo, mo->Pos()))
{ // Didn't fit
mo->Destroy ();
return 0;

View file

@ -121,18 +121,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL1)
AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
if (!weapon->DepleteAmmo(weapon->bAltFire))
return 0;
}
DAngle pitch = P_BulletSlope(self);
damage = 7+(pr_fgw()&7);
damage = 7 + (pr_fgw() & 7);
angle = self->Angles.Yaw;
if (player->refire)
{
angle += pr_fgw.Random2() * (5.625 / 256);
}
P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, "GoldWandPuff1");
S_Sound (self, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
P_LineAttack(self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, "GoldWandPuff1");
S_Sound(self, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
return 0;
}
@ -149,7 +149,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2)
int i;
DAngle angle;
int damage;
fixed_t vz;
double vz;
player_t *player;
if (NULL == (player = self->player))
@ -164,11 +164,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2)
return 0;
}
DAngle pitch = P_BulletSlope(self);
//momz = GetDefault<AGoldWandFX2>()->Speed * tan(-bulletpitch);
vz = fixed_t(GetDefaultByName("GoldWandFX2")->_f_speed() * -pitch.TanClamped());
P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->_f_angle()-(ANG45/8), vz);
P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->_f_angle()+(ANG45/8), vz);
vz = -GetDefaultByName("GoldWandFX2")->Speed * pitch.TanClamped();
P_SpawnMissileAngle(self, PClass::FindActor("GoldWandFX2"), self->Angles.Yaw - (45. / 8), vz);
P_SpawnMissileAngle(self, PClass::FindActor("GoldWandFX2"), self->Angles.Yaw + (45. / 8), vz);
angle = self->Angles.Yaw - (45. / 8);
for(i = 0; i < 5; i++)
{
@ -406,7 +405,7 @@ void FireMacePL1B (AActor *actor)
ball->Vel.Z = 2 - player->mo->Angles.Pitch.TanClamped();
ball->target = actor;
ball->Angles.Yaw = actor->Angles.Yaw;
ball->_f_AddZ(ball->_f_velz());
ball->AddZ(ball->Vel.Z);
ball->VelFromAngle();
ball->Vel += actor->Vel.XY()/2;
S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM);
@ -433,18 +432,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL1)
if (pr_maceatk() < 28)
{
FireMacePL1B (self);
FireMacePL1B(self);
return 0;
}
AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
if (!weapon->DepleteAmmo(weapon->bAltFire))
return 0;
}
player->psprites[ps_weapon].sx = ((pr_maceatk()&3)-2)*FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP+(pr_maceatk()&3)*FRACUNIT;
ball = P_SpawnPlayerMissile (self, PClass::FindActor("MaceFX1"), self->Angles.Yaw + (((pr_maceatk()&7)-4) * (360./256)));
player->psprites[ps_weapon].sx = ((pr_maceatk() & 3) - 2)*FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_maceatk() & 3)*FRACUNIT;
ball = P_SpawnPlayerMissile(self, PClass::FindActor("MaceFX1"), self->Angles.Yaw + (((pr_maceatk() & 7) - 4) * (360. / 256)));
if (ball)
{
ball->special1 = 16; // tics till dropoff
@ -477,9 +476,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_MacePL1Check)
// [RH] Avoid some precision loss by scaling the velocity directly
#if 0
// This is the original code, for reference.
angle_t angle = self->_f_angle()>>ANGLETOFINESHIFT;
self->vel.x = FixedMul(7*FRACUNIT, finecosine[angle]);
self->vel.y = FixedMul(7*FRACUNIT, finesine[angle]);
a.ngle_t angle = self->_f_angle()>>ANGLETOF.INESHIFT;
self->vel.x = F.ixedMul(7*F.RACUNIT, f.inecosine[angle]);
self->vel.y = F.ixedMul(7*F.RACUNIT, f.inesine[angle]);
#else
double velscale = 7 / self->Vel.XY().Length();
self->Vel.X *= velscale;
@ -721,7 +720,7 @@ void ABlasterFX1::Effect ()
{
if (pr_bfx1t() < 64)
{
Spawn("BlasterSmoke", _f_X(), _f_Y(), MAX<fixed_t> (_f_Z() - 8 * FRACUNIT, floorz), ALLOW_REPLACE);
Spawn("BlasterSmoke", PosAtZ(MAX(Z() - 8., FIXED2DBL(floorz))), ALLOW_REPLACE);
}
}
@ -1319,10 +1318,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
}
slope = -self->Angles.Pitch.TanClamped();
fixed_t xo = (pr_fp2.Random2() << 9);
fixed_t yo = (pr_fp2.Random2() << 9);
fixedvec3 pos = self->Vec3Offset(xo, yo,
26*FRACUNIT + FLOAT2FIXED(slope) - self->floorclip);
double xo = pr_fp2.Random2() / 128.;
double yo = pr_fp2.Random2() / 128.;
DVector3 pos = self->Vec3Offset(xo, yo, 26 + slope - FIXED2FLOAT(self->floorclip));
slope += 0.1;
mo = Spawn("PhoenixFX2", pos, ALLOW_REPLACE);

View file

@ -127,7 +127,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
mo = P_SpawnMissile (self, target, RUNTIME_CLASS(AWhirlwind));
if (mo != NULL)
{
mo->_f_AddZ(-32*FRACUNIT, false);
mo->AddZ(-32);
mo->tracer = target;
mo->health = 20*TICRATE; // Duration
S_Sound (self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
@ -150,20 +150,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_WhirlwindSeek)
if (self->health < 0)
{
self->Vel.Zero();
self->SetState (self->FindState(NAME_Death));
self->SetState(self->FindState(NAME_Death));
self->flags &= ~MF_MISSILE;
return 0;
}
if ((self->threshold -= 3) < 0)
{
self->threshold = 58 + (pr_seek() & 31);
S_Sound (self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
S_Sound(self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
}
if (self->tracer && self->tracer->flags&MF_SHADOW)
{
return 0;
}
P_SeekerMissile (self, ANGLE_1*10, ANGLE_1*30);
P_SeekerMissile(self, ANGLE_1 * 10, ANGLE_1 * 30);
return 0;
}
@ -203,7 +203,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichFireGrow)
PARAM_ACTION_PROLOGUE;
self->health--;
self->_f_AddZ(9*FRACUNIT);
self->AddZ(9.);
if (self->health == 0)
{
self->Damage = self->GetDefault()->Damage;

View file

@ -25,9 +25,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_DripBlood)
AActor *mo;
fixed_t xo = (pr_dripblood.Random2() << 11);
fixed_t yo = (pr_dripblood.Random2() << 11);
mo = Spawn ("Blood", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE);
double xo = pr_dripblood.Random2() / 32.;
double yo = pr_dripblood.Random2() / 32.;
mo = Spawn ("Blood", self->Vec3Offset(xo, yo, 0.), ALLOW_REPLACE);
mo->Vel.X = pr_dripblood.Random2 () / 64.;
mo->Vel.Y = pr_dripblood.Random2() / 64.;
mo->gravity = FRACUNIT/8;
@ -60,11 +60,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_KnightAttack)
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM);
if (self->flags & MF_SHADOW || pr_knightatk () < 40)
{ // Red axe
P_SpawnMissileZ (self, self->_f_Z() + 36*FRACUNIT, self->target, PClass::FindActor("RedAxe"));
P_SpawnMissileZ (self, self->Z() + 36, self->target, PClass::FindActor("RedAxe"));
return 0;
}
// Green axe
P_SpawnMissileZ (self, self->_f_Z() + 36*FRACUNIT, self->target, PClass::FindActor("KnightAxe"));
P_SpawnMissileZ (self, self->Z() + 36, self->target, PClass::FindActor("KnightAxe"));
return 0;
}

View file

@ -88,8 +88,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_WizAtk3)
mo = P_SpawnMissile (self, self->target, fx);
if (mo != NULL)
{
P_SpawnMissileAngle(self, fx, mo->_f_angle()-(ANG45/8), mo->_f_velz());
P_SpawnMissileAngle(self, fx, mo->_f_angle()+(ANG45/8), mo->_f_velz());
P_SpawnMissileAngle(self, fx, mo->Angles.Yaw - 45. / 8, mo->Vel.Z);
P_SpawnMissileAngle(self, fx, mo->Angles.Yaw + 45. / 8, mo->Vel.Z);
}
return 0;
}

View file

@ -149,17 +149,17 @@ struct FSpotList
//
//----------------------------------------------------------------------------
ASpecialSpot *GetSpotWithMinMaxDistance(fixed_t x, fixed_t y, fixed_t mindist, fixed_t maxdist)
ASpecialSpot *GetSpotWithMinMaxDistance(double x, double y, double mindist, double maxdist)
{
if (Spots.Size() == 0) return NULL;
int i = pr_spot() % Spots.Size();
int initial = i;
fixed_t distance;
double distance;
while (true)
{
distance = Spots[i]->AproxDistance(x, y);
distance = Spots[i]->Distance2D(x, y);
if ((distance >= mindist) && ((maxdist == 0) || (distance <= maxdist))) break;
@ -337,7 +337,7 @@ ASpecialSpot *DSpotState::GetNextInList(const PClass *type, int skipcounter)
//
//----------------------------------------------------------------------------
ASpecialSpot *DSpotState::GetSpotWithMinMaxDistance(const PClass *type, fixed_t x, fixed_t y, fixed_t mindist, fixed_t maxdist)
ASpecialSpot *DSpotState::GetSpotWithMinMaxDistance(const PClass *type, double x, double y, double mindist, double maxdist)
{
FSpotList *list = FindSpotList(type);
if (list != NULL) return list->GetSpotWithMinMaxDistance(x, y, mindist, maxdist);

View file

@ -36,7 +36,7 @@ public:
bool RemoveSpot(ASpecialSpot *spot);
void Serialize(FArchive &arc);
ASpecialSpot *GetNextInList(const PClass *type, int skipcounter);
ASpecialSpot *GetSpotWithMinMaxDistance(const PClass *type, fixed_t x, fixed_t y, fixed_t mindist, fixed_t maxdist);
ASpecialSpot *GetSpotWithMinMaxDistance(const PClass *type, double x, double y, double mindist, double maxdist);
ASpecialSpot *GetRandomSpot(const PClass *type, bool onlyonce = false);
};

View file

@ -81,7 +81,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Explode512)
{
self->target->player->extralight = 5;
}
P_CheckSplash(self, 512<<FRACBITS);
P_CheckSplash(self, 512);
// Strife didn't do this next part, but it looks good
self->RenderStyle = STYLE_Add;

View file

@ -3301,7 +3301,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Detonate)
PARAM_ACTION_PROLOGUE;
int damage = self->GetMissileDamage(0, 1);
P_RadiusAttack (self, self->target, damage, damage, self->DamageType, RADF_HURTSOURCE);
P_CheckSplash(self, damage<<FRACBITS);
P_CheckSplash(self, damage);
return 0;
}

View file

@ -158,14 +158,27 @@ void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target);
AActor *P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassActor *type);
AActor *P_SpawnMissile (AActor* source, AActor* dest, PClassActor *type, AActor* owner = NULL);
AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, PClassActor *type);
inline AActor *P_SpawnMissileZ(AActor* source, double z, AActor* dest, PClassActor *type)
{
return P_SpawnMissileZ(source, FLOAT2FIXED(z), dest, type);
}
AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, AActor *source, AActor *dest, PClassActor *type, bool checkspawn = true, AActor *owner = NULL);
inline AActor *P_SpawnMissileXYZ(const fixedvec3 &pos, AActor *source, AActor *dest, PClassActor *type, bool checkspawn = true, AActor *owner = NULL)
{
return P_SpawnMissileXYZ(pos.x, pos.y, pos.z, source, dest, type, checkspawn, owner);
}
AActor *P_SpawnMissileAngle (AActor *source, PClassActor *type, angle_t angle, fixed_t vz);
inline AActor *P_SpawnMissileAngle(AActor *source, PClassActor *type, DAngle angle, double vz)
{
return P_SpawnMissileAngle(source, type, angle.BAMs(), FLOAT2FIXED(vz));
}
AActor *P_SpawnMissileAngleSpeed (AActor *source, PClassActor *type, angle_t angle, fixed_t vz, fixed_t speed);
AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z, PClassActor *type, angle_t angle, fixed_t vz);
inline AActor *P_SpawnMissileAngleZ(AActor *source, double z, PClassActor *type, DAngle angle, double vz)
{
return P_SpawnMissileAngleZ(source, FLOAT2FIXED(z), type, angle.BAMs(), FLOAT2FIXED(vz));
}
AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z, PClassActor *type, angle_t angle, fixed_t vz, fixed_t speed, AActor *owner=NULL, bool checkspawn = true);
AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassActor *type);
@ -353,11 +366,7 @@ inline bool P_HitWater(AActor *thing, sector_t *sec, const fixedvec3 &pos, bool
{
return P_HitWater(thing, sec, pos.x, pos.y, pos.z, checkabove, alert, force);
}
void P_CheckSplash(AActor *self, fixed_t distance);
inline void P_CheckSplash(AActor *self, double distance)
{
return P_CheckSplash(self, FLOAT2FIXED(distance));
}
void P_CheckSplash(AActor *self, double distance);
void P_RailAttack (AActor *source, int damage, int offset_xy, fixed_t offset_z = 0, int color1 = 0, int color2 = 0, double maxdiff = 0, int flags = 0, PClassActor *puff = NULL, angle_t angleoffset = 0, angle_t pitchoffset = 0, fixed_t distance = 8192*FRACUNIT, int duration = 0, double sparsity = 1.0, double drift = 1.0, PClassActor *spawnclass = NULL, int SpiralOffset = 270); // [RH] Shoot a railgun
enum // P_RailAttack / A_RailAttack / A_CustomRailgun / P_DrawRailTrail flags

View file

@ -5742,11 +5742,11 @@ bool P_HitFloor (AActor *thing)
//
//---------------------------------------------------------------------------
void P_CheckSplash(AActor *self, fixed_t distance)
void P_CheckSplash(AActor *self, double distance)
{
sector_t *floorsec;
self->Sector->_f_LowestFloorAt(self, &floorsec);
if (self->_f_Z() <= self->floorz + distance && self->floorsector == floorsec && self->Sector->GetHeightSec() == NULL && floorsec->heightsec == NULL)
if (self->_f_Z() <= self->floorz + FLOAT2FIXED(distance) && self->floorsector == floorsec && self->Sector->GetHeightSec() == NULL && floorsec->heightsec == NULL)
{
// Explosion splashes never alert monsters. This is because A_Explode has
// a separate parameter for that so this would get in the way of proper

View file

@ -1104,7 +1104,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
}
P_RadiusAttack (self, self->target, damage, distance, self->DamageType, flags, fulldmgdistance);
P_CheckSplash(self, distance<<FRACBITS);
P_CheckSplash(self, distance);
if (alert && self->target != NULL && self->target->player != NULL)
{
validcount++;
@ -1147,7 +1147,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusThrust)
}
P_RadiusAttack (self, self->target, force, distance, self->DamageType, flags | RADF_NODAMAGE, fullthrustdistance);
P_CheckSplash(self, distance << FRACBITS);
P_CheckSplash(self, distance);
if (sourcenothrust)
{
@ -4711,8 +4711,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
PARAM_CLASS_OPT (target_type, ASpecialSpot) { target_type = PClass::FindActor("BossSpot"); }
PARAM_CLASS_OPT (fog_type, AActor) { fog_type = PClass::FindActor("TeleportFog"); }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_FIXED_OPT (mindist) { mindist = 128 << FRACBITS; }
PARAM_FIXED_OPT (maxdist) { maxdist = 128 << FRACBITS; }
PARAM_FLOAT_OPT (mindist) { mindist = 128; }
PARAM_FLOAT_OPT (maxdist) { maxdist = 0; }
PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; }
AActor *ref = COPY_AAPTR(self, ptr);
@ -4771,7 +4771,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
target_type = PClass::FindActor("BossSpot");
}
AActor *spot = state->GetSpotWithMinMaxDistance(target_type, ref->_f_X(), ref->_f_Y(), mindist, maxdist);
AActor *spot = state->GetSpotWithMinMaxDistance(target_type, ref->X(), ref->Y(), mindist, maxdist);
if (spot == NULL)
{
return numret;