diff --git a/src/actor.h b/src/actor.h index 43a29cdc6..10194d031 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1115,7 +1115,14 @@ public: int floorterrain; struct sector_t *ceilingsector; FTextureID ceilingpic; // contacted sec ceilingpic - fixed_t radius, height; // for movement checking + double radius; + + inline fixed_t _f_radius() const + { + return FLOAT2FIXED(radius); + } + + fixed_t height; // for movement checking fixed_t projectilepassheight; // height for clipping projectile movement against this actor SDWORD tics; // state tic counter FState *state; @@ -1414,7 +1421,7 @@ public: } double _Radius() const { - return FIXED2DBL(radius); + return FIXED2DBL(_f_radius()); } double _pushfactor() const { diff --git a/src/am_map.cpp b/src/am_map.cpp index 204a844f0..d0caf9f28 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -648,7 +648,7 @@ CUSTOM_CVAR (Int, am_cheat, 0, 0) #define AM_NUMMARKPOINTS 10 -// player radius for automap checking +// player _f_radius() for automap checking #define PLAYERRADIUS 16*MAPUNIT // how much the automap moves window per tic in frame-buffer coordinates @@ -2920,7 +2920,7 @@ void AM_drawThings () { { -MAPUNIT, MAPUNIT }, { -MAPUNIT, -MAPUNIT } }, }; - AM_drawLineCharacter (box, 4, t->radius >> FRACTOMAPBITS, angle - t->_f_angle(), color, p.x, p.y); + AM_drawLineCharacter (box, 4, t->_f_radius() >> FRACTOMAPBITS, angle - t->_f_angle(), color, p.x, p.y); } } } diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index e6fa0d5e2..83816f9c0 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -903,7 +903,7 @@ CCMD(info) PrintMiscActorInfo(t.linetarget); } else Printf("No target found. Info cannot find actors that have " - "the NOBLOCKMAP flag or have height/radius of 0.\n"); + "the NOBLOCKMAP flag or have height/_f_radius() of 0.\n"); } typedef bool (*ActorTypeChecker) (AActor *); diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 5aa2ce1aa..ee9b78d64 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -919,7 +919,7 @@ static int PatchThing (int thingy) } else if (stricmp (Line1, "Width") == 0) { - info->radius = val; + info->radius = FIXED2FLOAT(val); } else if (stricmp (Line1, "Alpha") == 0) { diff --git a/src/d_net.cpp b/src/d_net.cpp index 2dac938aa..643fa5300 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2321,7 +2321,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) else { const AActor *def = GetDefaultByType (typeinfo); - fixedvec3 spawnpos = source->_f_Vec3Angle(def->radius * 2 + source->radius, source->_f_angle(), 8 * FRACUNIT); + fixedvec3 spawnpos = source->_f_Vec3Angle(def->_f_radius() * 2 + source->_f_radius(), source->_f_angle(), 8 * FRACUNIT); AActor *spawned = Spawn (typeinfo, spawnpos, ALLOW_REPLACE); if (spawned != NULL) diff --git a/src/doomdef.h b/src/doomdef.h index 18b1b8bbb..346a73f0f 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -350,7 +350,7 @@ enum { BCOMPATF_SETSLOPEOVERFLOW = 1 << 0, // SetSlope things can overflow BCOMPATF_RESETPLAYERSPEED = 1 << 1, // Set player speed to 1.0 when changing maps - BCOMPATF_VILEGHOSTS = 1 << 2, // Monsters' radius and height aren't restored properly when resurrected. + BCOMPATF_VILEGHOSTS = 1 << 2, // Monsters' _f_radius() and height aren't restored properly when resurrected. BCOMPATF_BADTELEPORTERS = 1 << 3, // Ignore tags on Teleport specials BCOMPATF_BADPORTALS = 1 << 4, // Restores the old unstable portal behavior BCOMPATF_REBUILDNODES = 1 << 5, // Force node rebuild diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index a7182cb87..46f48a38f 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -3206,7 +3206,7 @@ void FParser::SF_MoveCamera(void) } } - cam->radius=8; + cam->radius = 1 / 8192.; cam->height=8; if ((x != cam->_f_X() || y != cam->_f_Y()) && !P_TryMove(cam, x, y, true)) { @@ -4100,11 +4100,9 @@ void FParser::SF_MobjRadius(void) if(t_argc > 1) { if(mo) - mo->radius = fixedvalue(t_argv[1]); + mo->radius = floatvalue(t_argv[1]); } - - t_return.type = svt_fixed; - t_return.value.f = mo ? mo->radius : 0; + t_return.setDouble(mo ? mo->radius : 0.); } } diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index 12dfc59d7..ead3ed91d 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -62,7 +62,7 @@ void A_PainShootSkull (AActor *self, DAngle Angle, PClassActor *spawntype, int f } // okay, there's room for another one - prestep = 4 + FIXED2FLOAT(self->radius + GetDefaultByType(spawntype)->radius) * 1.5; + prestep = 4 + (self->radius + GetDefaultByType(spawntype)->radius) * 1.5; // NOTE: The following code contains some advance work for line-to-line portals which is currenty inactive. diff --git a/src/g_hexen/a_blastradius.cpp b/src/g_hexen/a_blastradius.cpp index d9138a62b..e904bc022 100644 --- a/src/g_hexen/a_blastradius.cpp +++ b/src/g_hexen/a_blastradius.cpp @@ -41,8 +41,8 @@ void BlastActor (AActor *victim, fixed_t strength, double speed, AActor *Owner, // Spawn blast puff angle -= 180.; pos = victim->Vec3Offset( - fixed_t((victim->radius + FRACUNIT) * angle.Cos()), - fixed_t((victim->radius + FRACUNIT) * angle.Sin()), + fixed_t((victim->_f_radius() + FRACUNIT) * angle.Cos()), + fixed_t((victim->_f_radius() + FRACUNIT) * angle.Sin()), -victim->floorclip + (victim->height>>1)); mo = Spawn (blasteffect, pos, ALLOW_REPLACE); if (mo) @@ -98,14 +98,13 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast) PARAM_ACTION_PROLOGUE; PARAM_INT_OPT (blastflags) { blastflags = 0; } PARAM_FIXED_OPT (strength) { strength = 255*FRACUNIT; } - PARAM_FIXED_OPT (radius) { radius = 255*FRACUNIT; } + PARAM_FLOAT_OPT (radius) { radius = 255; } PARAM_FLOAT_OPT (speed) { speed = 20; } PARAM_CLASS_OPT (blasteffect, AActor) { blasteffect = PClass::FindActor("BlastEffect"); } PARAM_SOUND_OPT (blastsound) { blastsound = "BlastRadius"; } AActor *mo; TThinkerIterator iterator; - fixed_t dist; if (self->player && (blastflags & BF_USEAMMO) && ACTION_CALL_FROM_WEAPON()) { @@ -144,8 +143,7 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast) { // Must be monster, player, missile, touchy or vulnerable continue; } - dist = self->AproxDistance (mo); - if (dist > radius) + if (self->Distance2D(mo) > radius) { // Out of range continue; } diff --git a/src/g_hexen/a_clericflame.cpp b/src/g_hexen/a_clericflame.cpp index e14b4855e..ad74d9424 100644 --- a/src/g_hexen/a_clericflame.cpp +++ b/src/g_hexen/a_clericflame.cpp @@ -124,7 +124,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile) AActor *BlockingMobj = self->BlockingMobj; if (BlockingMobj && BlockingMobj->flags&MF_SHOOTABLE) { // Hit something, so spawn the flame circle around the thing - dist = BlockingMobj->radius+18*FRACUNIT; + dist = BlockingMobj->_f_radius()+18*FRACUNIT; for (i = 0; i < 4; i++) { an = i*45.; diff --git a/src/g_hexen/a_heresiarch.cpp b/src/g_hexen/a_heresiarch.cpp index f1e69aaea..23bd3aa59 100644 --- a/src/g_hexen/a_heresiarch.cpp +++ b/src/g_hexen/a_heresiarch.cpp @@ -279,7 +279,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit) angle_t angle, baseangle; int mode = self->target->args[3]; AHeresiarch *parent = barrier_cast(self->target); - int dist = parent->radius - (self->radius<<1); + int dist = parent->_f_radius() - (self->_f_radius()<<1); angle_t prevangle = self->special1; if (!self->IsKindOf (RUNTIME_CLASS(ASorcBall))) @@ -813,7 +813,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit) return 0; } - fixed_t dist = parent->radius; + fixed_t dist = parent->_f_radius(); if ((parent->health <= 0) || // Sorcerer is dead (!parent->args[0])) // Time expired diff --git a/src/g_hexen/a_iceguy.cpp b/src/g_hexen/a_iceguy.cpp index ecaf31e14..d50f1f974 100644 --- a/src/g_hexen/a_iceguy.cpp +++ b/src/g_hexen/a_iceguy.cpp @@ -34,7 +34,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook) CALL_ACTION(A_Look, self); if (pr_iceguylook() < 64) { - dist = ((pr_iceguylook()-128)*self->radius)>>7; + dist = ((pr_iceguylook()-128)*self->_f_radius())>>7; an = (self->_f_angle()+ANG90)>>ANGLETOFINESHIFT; Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Offset( @@ -62,7 +62,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase) A_Chase (stack, self); if (pr_iceguychase() < 128) { - dist = ((pr_iceguychase()-128)*self->radius)>>7; + dist = ((pr_iceguychase()-128)*self->_f_radius())>>7; an = (self->_f_angle()+ANG90)>>ANGLETOFINESHIFT; mo = Spawn(WispTypes[pr_iceguychase() & 1], self->Vec3Offset( @@ -92,8 +92,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack) { return 0; } - P_SpawnMissileXYZ(self->_f_Vec3Angle(self->radius>>1, self->_f_angle()+ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX")); - P_SpawnMissileXYZ(self->_f_Vec3Angle(self->radius>>1, self->_f_angle()-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX")); + P_SpawnMissileXYZ(self->_f_Vec3Angle(self->_f_radius()>>1, self->_f_angle()+ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX")); + P_SpawnMissileXYZ(self->_f_Vec3Angle(self->_f_radius()>>1, self->_f_angle()-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX")); S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); return 0; } diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index 3e58095c7..62a62052e 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -238,8 +238,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap) { deltaZ = -10*FRACUNIT; } - fixed_t xo = ((pr_zap() - 128)*self->radius / 256); - fixed_t yo = ((pr_zap() - 128)*self->radius / 256); + fixed_t xo = ((pr_zap() - 128)*self->_f_radius() / 256); + fixed_t yo = ((pr_zap() - 128)*self->_f_radius() / 256); mo = Spawn(lightning, self->Vec3Offset(xo, yo, deltaZ), ALLOW_REPLACE); if (mo) diff --git a/src/g_hexen/a_spike.cpp b/src/g_hexen/a_spike.cpp index 81612d4ca..9bf3409a6 100644 --- a/src/g_hexen/a_spike.cpp +++ b/src/g_hexen/a_spike.cpp @@ -160,7 +160,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale) FMultiBlockThingsIterator::CheckResult cres; while (it.Next(&cres)) { - fixed_t blockdist = self->radius + cres.thing->radius; + fixed_t blockdist = self->_f_radius() + cres.thing->_f_radius(); if (abs(cres.thing->_f_X() - cres.position.x) >= blockdist || abs(cres.thing->_f_Y() - cres.position.y) >= blockdist) continue; diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index a94715142..70f5865f2 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -286,13 +286,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks) // with no relation to the size of the self shattering. I think it should // base the number of shards on the size of the dead thing, so bigger // things break up into more shards than smaller things. - // An actor with radius 20 and height 64 creates ~40 chunks. - numChunks = MAX (4, (self->radius>>FRACBITS)*(self->height>>FRACBITS)/32); + // An actor with _f_radius() 20 and height 64 creates ~40 chunks. + numChunks = MAX (4, (self->_f_radius()>>FRACBITS)*(self->height>>FRACBITS)/32); i = (pr_freeze.Random2()) % (numChunks/4); for (i = MAX (24, numChunks + i); i >= 0; i--) { - fixed_t xo = (((pr_freeze() - 128)*self->radius) >> 7); - fixed_t yo = (((pr_freeze() - 128)*self->radius) >> 7); + fixed_t xo = (((pr_freeze() - 128)*self->_f_radius()) >> 7); + fixed_t yo = (((pr_freeze() - 128)*self->_f_radius()) >> 7); fixed_t zo = (pr_freeze()*self->height / 255); mo = Spawn("IceChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); if (mo) diff --git a/src/g_shared/a_bridge.cpp b/src/g_shared/a_bridge.cpp index f1b479140..90355ec45 100644 --- a/src/g_shared/a_bridge.cpp +++ b/src/g_shared/a_bridge.cpp @@ -9,7 +9,7 @@ static FRandom pr_orbit ("Orbit"); // Custom bridge -------------------------------------------------------- /* - args[0]: Bridge radius, in mapunits + args[0]: Bridge _f_radius(), in mapunits args[1]: Bridge height, in mapunits args[2]: Amount of bridge balls (if 0: Doom bridge) args[3]: Rotation speed of bridge balls, in byte angle per seconds, sorta: @@ -28,8 +28,8 @@ static FRandom pr_orbit ("Orbit"); 233: -30° / seconds 244: -15° / seconds This value only matters if args[2] is not zero. - args[4]: Rotation radius of bridge balls, in bridge radius %. - If 0, use Hexen default: ORBIT_RADIUS, regardless of bridge radius. + args[4]: Rotation _f_radius() of bridge balls, in bridge _f_radius() %. + If 0, use Hexen default: ORBIT_RADIUS, regardless of bridge _f_radius(). This value only matters if args[2] is not zero. */ @@ -48,12 +48,12 @@ void ACustomBridge::BeginPlay () if (args[2]) // Hexen bridge if there are balls { SetState(SeeState); - radius = args[0] ? args[0] << FRACBITS : 32 * FRACUNIT; + radius = args[0] ? args[0] : 32; height = args[1] ? args[1] << FRACBITS : 2 * FRACUNIT; } else // No balls? Then a Doom bridge. { - radius = args[0] ? args[0] << FRACBITS : 36 * FRACUNIT; + radius = args[0] ? args[0] : 36; height = args[1] ? args[1] << FRACBITS : 4 * FRACUNIT; RenderStyle = STYLE_Normal; } @@ -108,8 +108,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit) // Set angular speed; 1--128: counterclockwise rotation ~=1--180°; 129--255: clockwise rotation ~= 180--1° if (self->target->args[3] > 128) rotationspeed = 45./32 * (self->target->args[3]-256) / TICRATE; else if (self->target->args[3] > 0) rotationspeed = 45./32 * (self->target->args[3]) / TICRATE; - // Set rotation radius - if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / 100); + // Set rotation _f_radius() + if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->_f_radius()) / 100); self->Angles.Yaw += rotationspeed; self->SetOrigin(self->target->Vec3Angle(rotationradius*FRACUNIT, self->Angles.Yaw, 0), true); @@ -162,7 +162,7 @@ void AInvisibleBridge::BeginPlay () { Super::BeginPlay (); if (args[0]) - radius = args[0] << FRACBITS; + radius = args[0]; if (args[1]) height = args[1] << FRACBITS; } diff --git a/src/g_shared/a_debris.cpp b/src/g_shared/a_debris.cpp index 0aea2258d..895c3b170 100644 --- a/src/g_shared/a_debris.cpp +++ b/src/g_shared/a_debris.cpp @@ -29,13 +29,13 @@ IMPLEMENT_CLASS(AGlassShard) // Dirt stuff -void P_SpawnDirt (AActor *actor, fixed_t radius) +void P_SpawnDirt (AActor *actor, double radius) { PClassActor *dtype = NULL; AActor *mo; - fixed_t zo = (pr_dirt() << 9) + FRACUNIT; - fixedvec3 pos = actor->_f_Vec3Angle(radius, pr_dirt() << 24, zo); + double zo = pr_dirt() / 128. + 1; + DVector3 pos = actor->Vec3Angle(radius, pr_dirt() * (360./256), zo); char fmt[8]; mysnprintf(fmt, countof(fmt), "Dirt%d", 1 + pr_dirt()%6); diff --git a/src/g_shared/a_fastprojectile.cpp b/src/g_shared/a_fastprojectile.cpp index cfccb5675..fe1c7c418 100644 --- a/src/g_shared/a_fastprojectile.cpp +++ b/src/g_shared/a_fastprojectile.cpp @@ -45,9 +45,9 @@ void AFastProjectile::Tick () int shift = 3; int count = 8; - if (radius > 0) + if (_f_radius() > 0) { - while ( ((abs(_f_velx()) >> shift) > radius) || ((abs(_f_vely()) >> shift) > radius)) + while ( ((abs(_f_velx()) >> shift) > _f_radius()) || ((abs(_f_vely()) >> shift) > _f_radius())) { // we need to take smaller steps. shift++; diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index 68f62527c..28f8d1445 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -132,7 +132,7 @@ void DEarthquake::Tick () fixed_t dist; dist = m_Spot->AproxDistance (victim, true); - // Check if in damage radius + // Check if in damage _f_radius() if (dist < m_DamageRadius && victim->_f_Z() <= victim->floorz) { if (pr_quake() < 50) diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index 1e59bf740..ff08a04d9 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -9,7 +9,7 @@ struct vertex_t; struct side_t; struct F3DFloor; -void P_SpawnDirt (AActor *actor, fixed_t radius); +void P_SpawnDirt (AActor *actor, double radius); class DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *sec, fixed_t x, fixed_t y, fixed_t z, angle_t angle, fixed_t tracedist, bool permanent); class DBaseDecal : public DThinker diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index aa1543d46..2913a7f8a 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -94,7 +94,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath) PARAM_ACTION_PROLOGUE; AActor *second; - double secondRadius = FIXED2DBL(GetDefaultByName("EntitySecond")->radius * 2); + double secondRadius = FIXED2DBL(GetDefaultByName("EntitySecond")->_f_radius() * 2); static const double turns[3] = { 0, 90, -90 }; const double velmul[3] = { 4.8828125f, secondRadius*4, secondRadius*4 }; diff --git a/src/g_strife/a_sentinel.cpp b/src/g_strife/a_sentinel.cpp index 5df0a0f51..a9c4cf4df 100644 --- a/src/g_strife/a_sentinel.cpp +++ b/src/g_strife/a_sentinel.cpp @@ -60,7 +60,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack) for (int i = 8; i > 1; --i) { trail = Spawn("SentinelFX1", - self->_f_Vec3Angle(missile->radius*i, missile->_f_angle(), (missile->_f_velz() / 4 * i)), ALLOW_REPLACE); + self->_f_Vec3Angle(missile->_f_radius()*i, missile->_f_angle(), (missile->_f_velz() / 4 * i)), ALLOW_REPLACE); if (trail != NULL) { trail->target = self; diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 340f361af..6edca4427 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -731,7 +731,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade) fixedvec2 offset; an = self->_f_angle() >> ANGLETOFINESHIFT; - tworadii = self->radius + grenade->radius; + tworadii = self->_f_radius() + grenade->_f_radius(); offset.x = FixedMul (finecosine[an], tworadii); offset.y = FixedMul (finesine[an], tworadii); diff --git a/src/m_bbox.h b/src/m_bbox.h index e8f8d65a5..fe73432da 100644 --- a/src/m_bbox.h +++ b/src/m_bbox.h @@ -57,8 +57,18 @@ public: setBox(x, y, radius); } + FBoundingBox(double x, double y, double radius) + { + setBox(x, y, radius); + } + void setBox(fixed_t x, fixed_t y, fixed_t radius); + void setBox(double x, double y, double radius) + { + setBox(FLOAT2FIXED(x), FLOAT2FIXED(y), FLOAT2FIXED(radius)); + } + void ClearBox () { m_Box[BOXTOP] = m_Box[BOXRIGHT] = FIXED_MIN; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 3a5e90970..732a46e04 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4088,7 +4088,7 @@ int DLevelScript::GetActorProperty (int tid, int property) case APROP_Accuracy: return actor->accuracy; case APROP_Stamina: return actor->stamina; case APROP_Height: return actor->height; - case APROP_Radius: return actor->radius; + case APROP_Radius: return actor->_f_radius(); case APROP_ReactionTime:return actor->reactiontime; case APROP_MeleeRange: return actor->meleerange; case APROP_ViewHeight: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) diff --git a/src/p_effect.cpp b/src/p_effect.cpp index ab749cccd..885f04af9 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -408,13 +408,13 @@ static void MakeFountain (AActor *actor, int color1, int color2) if (particle) { angle_t an = M_Random()<<(24-ANGLETOFINESHIFT); - fixed_t out = FixedMul (actor->radius, M_Random()<<8); + fixed_t out = FixedMul (actor->_f_radius(), M_Random()<<8); fixedvec3 pos = actor->Vec3Offset(FixedMul(out, finecosine[an]), FixedMul(out, finesine[an]), actor->height + FRACUNIT); particle->x = pos.x; particle->y = pos.y; particle->z = pos.z; - if (out < actor->radius/8) + if (out < actor->_f_radius()/8) particle->vel.z += FRACUNIT*10/3; else particle->vel.z += FRACUNIT*3; @@ -493,7 +493,7 @@ void P_RunEffect (AActor *actor, int effects) { // Grenade trail - fixedvec3 pos = actor->_f_Vec3Angle(-actor->radius * 2, moveangle.BAMs(), + fixedvec3 pos = actor->_f_Vec3Angle(-actor->_f_radius() * 2, moveangle.BAMs(), fixed_t(-(actor->height >> 3) * (actor->Vel.Z) + (2 * actor->height) / 3)); P_DrawSplash2 (6, pos.x, pos.y, pos.z, @@ -528,7 +528,7 @@ void P_RunEffect (AActor *actor, int effects) if (particle != NULL) { angle_t ang = M_Random () << (32-ANGLETOFINESHIFT-8); - fixedvec3 pos = actor->Vec3Offset(FixedMul (actor->radius, finecosine[ang]), FixedMul (actor->radius, finesine[ang]), 0); + fixedvec3 pos = actor->Vec3Offset(FixedMul (actor->_f_radius(), finecosine[ang]), FixedMul (actor->_f_radius(), finesine[ang]), 0); particle->x = pos.x; particle->y = pos.y; particle->z = pos.z; @@ -887,8 +887,8 @@ void P_DisconnectEffect (AActor *actor) break; - fixed_t xo = ((M_Random() - 128) << 9) * (actor->radius >> FRACBITS); - fixed_t yo = ((M_Random() - 128) << 9) * (actor->radius >> FRACBITS); + fixed_t xo = ((M_Random() - 128) << 9) * (actor->_f_radius() >> FRACBITS); + fixed_t yo = ((M_Random() - 128) << 9) * (actor->_f_radius() >> FRACBITS); fixed_t zo = (M_Random() << 8) * (actor->height >> FRACBITS); fixedvec3 pos = actor->Vec3Offset(xo, yo, zo); p->x = pos.x; diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 4a2bcce93..2e9f7c4f4 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -271,7 +271,7 @@ bool AActor::CheckMeleeRange () dist = AproxDistance (pl); - if (dist >= meleerange + pl->radius) + if (dist >= meleerange + pl->_f_radius()) return false; // [RH] If moving toward goal, then we've reached it. @@ -315,7 +315,7 @@ bool P_CheckMeleeRange2 (AActor *actor) } mo = actor->target; dist = mo->AproxDistance (actor); - if (dist >= (128 << FRACBITS) || dist < actor->meleerange + mo->radius) + if (dist >= (128 << FRACBITS) || dist < actor->meleerange + mo->_f_radius()) { return false; } @@ -517,7 +517,7 @@ bool P_Move (AActor *actor) // Like P_XYMovement this should do multiple moves if the step size is too large - fixed_t maxmove = actor->radius - FRACUNIT; + fixed_t maxmove = actor->_f_radius() - FRACUNIT; int steps = 1; if (maxmove > 0) @@ -884,7 +884,7 @@ void P_NewChaseDir(AActor * actor) !(actor->flags2 & MF2_ONMOBJ) && !(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF)) { - FBoundingBox box(actor->_f_X(), actor->_f_Y(), actor->radius); + FBoundingBox box(actor->_f_X(), actor->_f_Y(), actor->_f_radius()); FBlockLinesIterator it(box); line_t *line; @@ -968,7 +968,7 @@ void P_NewChaseDir(AActor * actor) fixed_t dist = actor->AproxDistance(target); if (target->player == NULL) { - ismeleeattacker = (target->MissileState == NULL && dist < (target->meleerange + target->radius)*2); + ismeleeattacker = (target->MissileState == NULL && dist < (target->meleerange + target->_f_radius())*2); } else if (target->player->ReadyWeapon != NULL) { @@ -1198,7 +1198,7 @@ bool P_IsVisible(AActor *lookee, AActor *other, INTBOOL allaround, FLookExParams { // if real close, react anyway // [KS] but respect minimum distance rules - if (mindist || dist > lookee->meleerange + lookee->radius) + if (mindist || dist > lookee->meleerange + lookee->_f_radius()) return false; // outside of fov } } @@ -2614,8 +2614,8 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) FState *raisestate = corpsehit->GetRaiseState(); if (raisestate != NULL) { - // use the current actor's radius instead of the Arch Vile's default. - fixed_t maxdist = corpsehit->GetDefault()->radius + self->radius; + // use the current actor's _f_radius() instead of the Arch Vile's default. + fixed_t maxdist = corpsehit->GetDefault()->_f_radius() + self->_f_radius(); if (abs(corpsehit->_f_Pos().x - cres.position.x) > maxdist || abs(corpsehit->_f_Pos().y - cres.position.y) > maxdist) @@ -2649,15 +2649,15 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) } corpsehit->Vel.X = corpsehit->Vel.Y = 0; - // [RH] Check against real height and radius + // [RH] Check against real height and _f_radius() fixed_t oldheight = corpsehit->height; - fixed_t oldradius = corpsehit->radius; + double oldradius = corpsehit->radius; ActorFlags oldflags = corpsehit->flags; corpsehit->flags |= MF_SOLID; corpsehit->height = corpsehit->GetDefault()->height; - bool check = P_CheckPosition(corpsehit, corpsehit->_f_Pos()); + bool check = P_CheckPosition(corpsehit, corpsehit->Pos()); corpsehit->flags = oldflags; corpsehit->radius = oldradius; corpsehit->height = oldheight; diff --git a/src/p_local.h b/src/p_local.h index 5d06a0504..826bb8e40 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -370,7 +370,8 @@ enum // P_RailAttack / A_RailAttack / A_CustomRailgun / P_DrawRailTrail flags }; -bool P_CheckMissileSpawn (AActor *missile, fixed_t maxdist); +bool P_CheckMissileSpawn(AActor *missile, double maxdist); + void P_PlaySpawnSound(AActor *missile, AActor *spawner); // [RH] Position the chasecam diff --git a/src/p_map.cpp b/src/p_map.cpp index e86bc66e2..06941d966 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -435,7 +435,7 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra sector_t *sector = P_PointInSector(x, y); FPortalGroupArray grouplist; - FMultiBlockLinesIterator mit(grouplist, x, y, z, thing->height, thing->radius, sector); + FMultiBlockLinesIterator mit(grouplist, x, y, z, thing->height, thing->_f_radius(), sector); FMultiBlockLinesIterator::CheckResult cres; while (mit.Next(&cres)) @@ -446,7 +446,7 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz; - FMultiBlockThingsIterator mit2(grouplist, x, y, z, thing->height, thing->radius, false, sector); + FMultiBlockThingsIterator mit2(grouplist, x, y, z, thing->height, thing->_f_radius(), false, sector); FMultiBlockThingsIterator::CheckResult cres2; while (mit2.Next(&cres2)) @@ -460,7 +460,7 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra if (th == thing) continue; - fixed_t blockdist = th->radius + tmf.thing->radius; + fixed_t blockdist = th->_f_radius() + tmf.thing->_f_radius(); if (abs(th->_f_X() - cres2.position.x) >= blockdist || abs(th->_f_Y() - cres2.position.y) >= blockdist) continue; @@ -557,7 +557,7 @@ void P_PlayerStartStomp(AActor *actor, bool mononly) if (th == actor || (th->player == actor->player && th->player != NULL)) continue; - fixed_t blockdist = th->radius + actor->radius; + fixed_t blockdist = th->_f_radius() + actor->_f_radius(); if (abs(th->_f_X() - cres.position.x) >= blockdist || abs(th->_f_Y() - cres.position.y) >= blockdist) continue; @@ -1031,7 +1031,7 @@ static bool PIT_CheckPortal(FMultiBlockLinesIterator &mit, FMultiBlockLinesItera if (lp->backsector == NULL) lp->backsector = lp->frontsector; tm.thing->_f_AddZ(zofs); - FBoundingBox pbox(cres.position.x, cres.position.y, tm.thing->radius); + FBoundingBox pbox(cres.position.x, cres.position.y, tm.thing->_f_radius()); FBlockLinesIterator it(pbox); bool ret = false; line_t *ld; @@ -1199,7 +1199,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY)) return true; // can't hit thing - fixed_t blockdist = thing->radius + tm.thing->radius; + fixed_t blockdist = thing->_f_radius() + tm.thing->_f_radius(); if (abs(thing->_f_X() - cres.position.x) >= blockdist || abs(thing->_f_Y() - cres.position.y) >= blockdist) return true; @@ -1230,8 +1230,8 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch // way to do this, so I restrict them to only walking on bridges instead. // Uncommenting the if here makes it almost impossible for them to walk on // anything, bridge or otherwise. - // if (abs(thing->x - tmx) <= thing->radius && - // abs(thing->y - tmy) <= thing->radius) + // if (abs(thing->x - tmx) <= thing->_f_radius() && + // abs(thing->y - tmy) <= thing->_f_radius()) { tm.stepthing = thing; tm.floorz = topz; @@ -1248,8 +1248,8 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch { unblocking = true; } - else if (abs(thing->_f_X() - oldpos.x) < (thing->radius + tm.thing->radius) && - abs(thing->_f_Y() - oldpos.y) < (thing->radius + tm.thing->radius)) + else if (abs(thing->_f_X() - oldpos.x) < (thing->_f_radius() + tm.thing->_f_radius()) && + abs(thing->_f_Y() - oldpos.y) < (thing->_f_radius() + tm.thing->_f_radius())) { fixed_t newdist = thing->AproxDistance(cres.position.x, cres.position.y); @@ -1647,10 +1647,10 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo } tm.stepthing = NULL; - FBoundingBox box(x, y, thing->radius); + FBoundingBox box(x, y, thing->_f_radius()); FPortalGroupArray pcheck; - FMultiBlockThingsIterator it2(pcheck, x, y, thing->_f_Z(), thing->height, thing->radius, false, newsec); + FMultiBlockThingsIterator it2(pcheck, x, y, thing->_f_Z(), thing->height, thing->_f_radius(), false, newsec); FMultiBlockThingsIterator::CheckResult tcres; while ((it2.Next(&tcres))) @@ -1720,7 +1720,7 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo spechit.Clear(); portalhit.Clear(); - FMultiBlockLinesIterator it(pcheck, x, y, thing->_f_Z(), thing->height, thing->radius, newsec); + FMultiBlockLinesIterator it(pcheck, x, y, thing->_f_Z(), thing->height, thing->_f_radius(), newsec); FMultiBlockLinesIterator::CheckResult lcres; fixed_t thingdropoffz = tm.floorz; @@ -1847,7 +1847,7 @@ bool P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj) { AActor *thing = cres.thing; - fixed_t blockdist = thing->radius + actor->radius; + fixed_t blockdist = thing->_f_radius() + actor->_f_radius(); if (abs(thing->_f_X() - cres.position.x) >= blockdist || abs(thing->_f_Y() - cres.position.y) >= blockdist) { continue; @@ -2906,24 +2906,24 @@ retry: // trace along the three leading corners if (tryx > 0) { - leadx = mo->_f_X() + mo->radius; - trailx = mo->_f_X() - mo->radius; + leadx = mo->_f_X() + mo->_f_radius(); + trailx = mo->_f_X() - mo->_f_radius(); } else { - leadx = mo->_f_X() - mo->radius; - trailx = mo->_f_X() + mo->radius; + leadx = mo->_f_X() - mo->_f_radius(); + trailx = mo->_f_X() + mo->_f_radius(); } if (tryy > 0) { - leady = mo->_f_Y() + mo->radius; - traily = mo->_f_Y() - mo->radius; + leady = mo->_f_Y() + mo->_f_radius(); + traily = mo->_f_Y() - mo->_f_radius(); } else { - leady = mo->_f_Y() - mo->radius; - traily = mo->_f_Y() + mo->radius; + leady = mo->_f_Y() - mo->_f_radius(); + traily = mo->_f_Y() + mo->_f_radius(); } bestslidefrac = FRACUNIT + 1; @@ -3235,19 +3235,19 @@ bool FSlide::BounceWall(AActor *mo) // if (mo->Vel.X > 0) { - leadx = mo->_f_X() + mo->radius; + leadx = mo->_f_X() + mo->_f_radius(); } else { - leadx = mo->_f_X() - mo->radius; + leadx = mo->_f_X() - mo->_f_radius(); } if (mo->Vel.Y > 0) { - leady = mo->_f_Y() + mo->radius; + leady = mo->_f_Y() + mo->_f_radius(); } else { - leady = mo->_f_Y() - mo->radius; + leady = mo->_f_Y() - mo->_f_radius(); } bestslidefrac = FRACUNIT + 1; bestslideline = mo->BlockingLine; @@ -3300,12 +3300,12 @@ bool FSlide::BounceWall(AActor *mo) movelen = fixed_t(g_sqrt(double(mo->_f_velx())*mo->_f_velx() + double(mo->_f_vely())*mo->_f_vely())); movelen = FixedMul(movelen, mo->wallbouncefactor); - FBoundingBox box(mo->_f_X(), mo->_f_Y(), mo->radius); + FBoundingBox box(mo->_f_X(), mo->_f_Y(), mo->_f_radius()); if (box.BoxOnLineSide(line) == -1) { fixedvec3 pos = mo->Vec3Offset( - FixedMul(mo->radius, finecosine[deltaangle]), - FixedMul(mo->radius, finesine[deltaangle]), 0); + FixedMul(mo->_f_radius(), finecosine[deltaangle]), + FixedMul(mo->_f_radius(), finesine[deltaangle]), 0); mo->SetOrigin(pos, true); } @@ -4238,7 +4238,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, fixedvec2 pos = P_GetOffsetPosition(trace.HitPos.x, trace.HitPos.y, -trace.HitVector.x * 4, -trace.HitVector.y * 4); puff = P_SpawnPuff(t1, pufftype, pos.x, pos.y, trace.HitPos.z - trace.HitVector.z * 4, trace.SrcAngleToTarget, trace.SrcAngleToTarget - ANGLE_90, 0, puffFlags); - puff->radius = 1; + puff->radius = 1/65536.; } // [RH] Spawn a decal @@ -5253,7 +5253,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo while ((it.Next(&cres))) { AActor *thing = cres.thing; - // Vulnerable actors can be damaged by radius attacks even if not shootable + // Vulnerable actors can be damaged by _f_radius() attacks even if not shootable // Used to emulate MBF's vulnerability of non-missile bouncers to explosions. if (!((thing->flags & MF_SHOOTABLE) || (thing->flags6 & MF6_VULNERABLE))) continue; @@ -5295,7 +5295,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo fixedvec2 vec = bombspot->_f_Vec2To(thing); dx = abs(vec.x); dy = abs(vec.y); - boxradius = double(thing->radius); + boxradius = double(thing->_f_radius()); // The damage pattern is square, not circular. len = double(dx > dy ? dx : dy); @@ -5395,7 +5395,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo dy = abs(vec.y); dist = dx>dy ? dx : dy; - dist = (dist - thing->radius) >> FRACBITS; + dist = (dist - thing->_f_radius()) >> FRACBITS; if (dist < 0) dist = 0; @@ -5515,7 +5515,7 @@ void P_FindAboveIntersectors(AActor *actor) while (it.Next(&cres)) { AActor *thing = cres.thing; - fixed_t blockdist = actor->radius + thing->radius; + fixed_t blockdist = actor->_f_radius() + thing->_f_radius(); if (abs(thing->_f_X() - cres.position.x) >= blockdist || abs(thing->_f_Y() - cres.position.y) >= blockdist) continue; @@ -5571,7 +5571,7 @@ void P_FindBelowIntersectors(AActor *actor) while (it.Next(&cres)) { AActor *thing = cres.thing; - fixed_t blockdist = actor->radius + thing->radius; + fixed_t blockdist = actor->_f_radius() + thing->_f_radius(); if (abs(thing->_f_X() - cres.position.x) >= blockdist || abs(thing->_f_Y() - cres.position.y) >= blockdist) continue; @@ -6340,7 +6340,7 @@ void P_CreateSecNodeList(AActor *thing, fixed_t x, fixed_t y) node = node->m_tnext; } - FBoundingBox box(thing->_f_X(), thing->_f_Y(), thing->radius); + FBoundingBox box(thing->_f_X(), thing->_f_Y(), thing->_f_radius()); FBlockLinesIterator it(box); line_t *ld; @@ -6365,7 +6365,7 @@ void P_CreateSecNodeList(AActor *thing, fixed_t x, fixed_t y) sector_list = P_AddSecnode(ld->frontsector, thing, sector_list); // Don't assume all lines are 2-sided, since some Things - // like MT_TFOG are allowed regardless of whether their radius takes + // like MT_TFOG are allowed regardless of whether their _f_radius() takes // them beyond an impassable linedef. // killough 3/27/98, 4/4/98: diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 20e24dffa..3de8aa764 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -380,10 +380,10 @@ bool AActor::FixMapthingPos() } // Not inside the line's bounding box - if (_f_X() + radius <= ldef->bbox[BOXLEFT] - || _f_X() - radius >= ldef->bbox[BOXRIGHT] - || _f_Y() + radius <= ldef->bbox[BOXBOTTOM] - || _f_Y() - radius >= ldef->bbox[BOXTOP]) + if (_f_X() + _f_radius() <= ldef->bbox[BOXLEFT] + || _f_X() - _f_radius() >= ldef->bbox[BOXRIGHT] + || _f_Y() + _f_radius() <= ldef->bbox[BOXBOTTOM] + || _f_Y() - _f_radius() >= ldef->bbox[BOXTOP]) continue; // Get the exact distance to the line @@ -399,7 +399,7 @@ bool AActor::FixMapthingPos() fixed_t distance = abs(P_InterceptVector(&dlv, &dll)); - if (distance < radius) + if (distance < _f_radius()) { DPrintf("%s at (%d,%d) lies on %s line %td, distance = %f\n", this->GetClass()->TypeName.GetChars(), _f_X() >> FRACBITS, _f_Y() >> FRACBITS, @@ -417,7 +417,7 @@ bool AActor::FixMapthingPos() finean >>= ANGLETOFINESHIFT; // Get the distance we have to move the object away from the wall - distance = radius - distance; + distance = _f_radius() - distance; SetXY(_f_X() + FixedMul(distance, finecosine[finean]), _f_Y() + FixedMul(distance, finesine[finean])); ClearInterpolation(); success = true; @@ -493,16 +493,16 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector) { FPortalGroupArray check(FPortalGroupArray::PGA_NoSectorPortals); - P_CollectConnectedGroups(Sector->PortalGroup, _f_Pos(), _f_Top(), radius, check); + P_CollectConnectedGroups(Sector->PortalGroup, _f_Pos(), _f_Top(), _f_radius(), check); for (int i = -1; i < (int)check.Size(); i++) { fixedvec3 pos = i==-1? _f_Pos() : PosRelative(check[i]); - int x1 = GetSafeBlockX(pos.x - radius - bmaporgx); - int x2 = GetSafeBlockX(pos.x + radius - bmaporgx); - int y1 = GetSafeBlockY(pos.y - radius - bmaporgy); - int y2 = GetSafeBlockY(pos.y + radius - bmaporgy); + int x1 = GetSafeBlockX(pos.x - _f_radius() - bmaporgx); + int x2 = GetSafeBlockX(pos.x + _f_radius() - bmaporgx); + int y1 = GetSafeBlockY(pos.y - _f_radius() - bmaporgy); + int y2 = GetSafeBlockY(pos.y + _f_radius() - bmaporgy); if (x1 >= bmapwidth || x2 < 0 || y1 >= bmapheight || y2 < 0) { // thing is off the map @@ -739,7 +739,7 @@ FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, AAc { checkpoint = origin->_f_Pos(); if (!check.inited) P_CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->_f_Top(), checkradius, checklist); - checkpoint.z = checkradius == -1? origin->radius : checkradius; + checkpoint.z = checkradius == -1? origin->_f_radius() : checkradius; basegroup = origin->Sector->PortalGroup; startsector = origin->Sector; Reset(); @@ -1074,7 +1074,7 @@ FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, A { checkpoint = origin->_f_Pos(); if (!check.inited) P_CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->_f_Top(), checkradius, checklist); - checkpoint.z = checkradius == -1? origin->radius : checkradius; + checkpoint.z = checkradius == -1? origin->_f_radius() : checkradius; basegroup = origin->Sector->PortalGroup; Reset(); } @@ -1260,31 +1260,31 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it switch (i) { case 0: // Top edge - line.x = thing->_f_X() + thing->radius; - line.y = thing->_f_Y() + thing->radius; - line.dx = -thing->radius * 2; + line.x = thing->_f_X() + thing->_f_radius(); + line.y = thing->_f_Y() + thing->_f_radius(); + line.dx = -thing->_f_radius() * 2; line.dy = 0; break; case 1: // Right edge - line.x = thing->_f_X() + thing->radius; - line.y = thing->_f_Y() - thing->radius; + line.x = thing->_f_X() + thing->_f_radius(); + line.y = thing->_f_Y() - thing->_f_radius(); line.dx = 0; - line.dy = thing->radius * 2; + line.dy = thing->_f_radius() * 2; break; case 2: // Bottom edge - line.x = thing->_f_X() - thing->radius; - line.y = thing->_f_Y() - thing->radius; - line.dx = thing->radius * 2; + line.x = thing->_f_X() - thing->_f_radius(); + line.y = thing->_f_Y() - thing->_f_radius(); + line.dx = thing->_f_radius() * 2; line.dy = 0; break; case 3: // Left edge - line.x = thing->_f_X() - thing->radius; - line.y = thing->_f_Y() + thing->radius; + line.x = thing->_f_X() - thing->_f_radius(); + line.y = thing->_f_Y() + thing->_f_radius(); line.dx = 0; - line.dy = thing->radius * -2; + line.dy = thing->_f_radius() * -2; break; } // Check if this side is facing the trace origin @@ -1306,19 +1306,19 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it switch (i) { case 0: - line.y -= 2 * thing->radius; + line.y -= 2 * thing->_f_radius(); break; case 1: - line.x -= 2 * thing->radius; + line.x -= 2 * thing->_f_radius(); break; case 2: - line.y += 2 * thing->radius; + line.y += 2 * thing->_f_radius(); break; case 3: - line.x += 2 * thing->radius; + line.x += 2 * thing->_f_radius(); break; } fixed_t frac2 = P_InterceptVector(&trace, &line); @@ -1363,19 +1363,19 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it // check a corner to corner crossection for hit if (tracepositive) { - x1 = thing->_f_X() - thing->radius; - y1 = thing->_f_Y() + thing->radius; + x1 = thing->_f_X() - thing->_f_radius(); + y1 = thing->_f_Y() + thing->_f_radius(); - x2 = thing->_f_X() + thing->radius; - y2 = thing->_f_Y() - thing->radius; + x2 = thing->_f_X() + thing->_f_radius(); + y2 = thing->_f_Y() - thing->_f_radius(); } else { - x1 = thing->_f_X() - thing->radius; - y1 = thing->_f_Y() - thing->radius; + x1 = thing->_f_X() - thing->_f_radius(); + y1 = thing->_f_Y() - thing->_f_radius(); - x2 = thing->_f_X() + thing->radius; - y2 = thing->_f_Y() + thing->radius; + x2 = thing->_f_X() + thing->_f_radius(); + y2 = thing->_f_Y() + thing->_f_radius(); } s1 = P_PointOnDivlineSide (x1, y1, &trace); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b5b52a9ea..969bc7405 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1198,7 +1198,8 @@ bool AActor::Grind(bool items) { flags &= ~MF_SOLID; flags3 |= MF3_DONTGIB; - height = radius = 0; + height = 0; + radius = 0; return false; } @@ -1224,7 +1225,8 @@ bool AActor::Grind(bool items) } flags &= ~MF_SOLID; flags3 |= MF3_DONTGIB; - height = radius = 0; + height = 0; + radius = 0; SetState (state); if (isgeneric) // Not a custom crush state, so colorize it appropriately. { @@ -1259,7 +1261,8 @@ bool AActor::Grind(bool items) // if there's no gib sprite don't crunch it. flags &= ~MF_SOLID; flags3 |= MF3_DONTGIB; - height = radius = 0; + height = 0; + radius = 0; return false; } @@ -1871,10 +1874,10 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) // through the actor. { - fixed_t maxmove = mo->radius - FRACUNIT; + fixed_t maxmove = mo->_f_radius() - FRACUNIT; if (maxmove <= 0) - { // gibs can have radius 0, so don't divide by zero below! + { // gibs can have _f_radius() 0, so don't divide by zero below! maxmove = _f_MAXMOVE; } @@ -3456,8 +3459,8 @@ void AActor::Tick () { smokecounter = 0; angle_t moveangle = R_PointToAngle2(0,0,_f_velx(),_f_vely()); - fixed_t xo = -FixedMul(finecosine[(moveangle) >> ANGLETOFINESHIFT], radius * 2) + (pr_rockettrail() << 10); - fixed_t yo = -FixedMul(finesine[(moveangle) >> ANGLETOFINESHIFT], radius * 2) + (pr_rockettrail() << 10); + fixed_t xo = -FixedMul(finecosine[(moveangle) >> ANGLETOFINESHIFT], _f_radius() * 2) + (pr_rockettrail() << 10); + fixed_t yo = -FixedMul(finesine[(moveangle) >> ANGLETOFINESHIFT], _f_radius() * 2) + (pr_rockettrail() << 10); AActor * th = Spawn("GrenadeSmokeTrail", Vec3Offset(xo, yo, - (height>>3) * (_f_velz()>>16) + (2*height)/3), ALLOW_REPLACE); if (th) { @@ -5762,7 +5765,7 @@ void P_CheckSplash(AActor *self, fixed_t distance) // //--------------------------------------------------------------------------- -bool P_CheckMissileSpawn (AActor* th, fixed_t maxdist) +bool P_CheckMissileSpawn (AActor* th, double maxdist) { // [RH] Don't decrement tics if they are already less than 1 if ((th->flags4 & MF4_RANDOMIZE) && th->tics > 0) @@ -5775,9 +5778,8 @@ bool P_CheckMissileSpawn (AActor* th, fixed_t maxdist) if (maxdist > 0) { // move a little forward so an angle can be computed if it immediately explodes - DVector3 advance(FIXED2DBL(th->_f_velx()), FIXED2DBL(th->_f_vely()), FIXED2DBL(th->_f_velz())); - double maxsquared = FIXED2DBL(maxdist); - maxsquared *= maxsquared; + DVector3 advance = th->Vel; + double maxsquared = maxdist*maxdist; // Keep halving the advance vector until we get something less than maxdist // units away, since we still want to spawn the missile inside the shooter. @@ -5785,11 +5787,8 @@ bool P_CheckMissileSpawn (AActor* th, fixed_t maxdist) { advance *= 0.5f; } - while (DVector2(advance).LengthSquared() >= maxsquared); - th->SetXYZ( - th->_f_X() + FLOAT2FIXED(advance.X), - th->_f_Y() + FLOAT2FIXED(advance.Y), - th->_f_Z() + FLOAT2FIXED(advance.Z)); + while (advance.XY().LengthSquared() >= maxsquared); + th->SetXYZ(th->Pos() + advance); } FCheckPosition tm(!!(th->flags2 & MF2_RIP)); diff --git a/src/p_spec.cpp b/src/p_spec.cpp index cb338ac13..2ba81927e 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -2197,7 +2197,7 @@ int DPusher::CheckForSectorMatch (EPusher type, int tag) ///////////////////////////// // -// T_Pusher looks for all objects that are inside the radius of +// T_Pusher looks for all objects that are inside the _f_radius() of // the effect. // void DPusher::Tick () @@ -2239,7 +2239,7 @@ void DPusher::Tick () if (m_Type == p_push) { - // Seek out all pushable things within the force radius of this + // Seek out all pushable things within the force _f_radius() of this // point pusher. Crosses sectors, so use blockmap. FPortalGroupArray check(FPortalGroupArray::PGA_NoSectorPortals); // no sector portals because this thing is utterly z-unaware. @@ -2266,7 +2266,7 @@ void DPusher::Tick () double dist = pos.Length(); double speed = (m_Magnitude - (dist/2)) / (PUSH_FACTOR * 2); - // If speed <= 0, you're outside the effective radius. You also have + // If speed <= 0, you're outside the effective _f_radius(). You also have // to be able to see the push/pull source point. if ((speed > 0) && (P_CheckSight (thing, m_Source, SF_IGNOREVISIBILITY))) diff --git a/src/p_spec.h b/src/p_spec.h index 979765d91..9abcca29a 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -131,7 +131,7 @@ protected: TObjPtr m_Source;// Point source if point pusher DVector2 m_PushVec; double m_Magnitude; // Vector strength for point pusher - double m_Radius; // Effective radius for point pusher + double m_Radius; // Effective _f_radius() for point pusher int m_Affectee; // Number of affected sector friend bool PIT_PushThing (AActor *thing); diff --git a/src/p_things.cpp b/src/p_things.cpp index 3273e4f24..4eaa85ca2 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -425,7 +425,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser) // [RH] Check against real height and radius fixed_t oldheight = thing->height; - fixed_t oldradius = thing->radius; + double oldradius = thing->radius; ActorFlags oldflags = thing->flags; thing->flags |= MF_SOLID; @@ -467,13 +467,13 @@ bool P_Thing_CanRaise(AActor *thing) // Check against real height and radius ActorFlags oldflags = thing->flags; fixed_t oldheight = thing->height; - fixed_t oldradius = thing->radius; + double oldradius = thing->radius; thing->flags |= MF_SOLID; thing->height = info->height; thing->radius = info->radius; - bool check = P_CheckPosition (thing, thing->_f_Pos()); + bool check = P_CheckPosition (thing, thing->Pos()); // Restore checked properties thing->flags = oldflags; @@ -694,7 +694,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, angle += (flags & WARPF_USECALLERANGLE) ? caller->_f_angle() : reference->_f_angle(); } - const fixed_t rad = FixedMul(radiusoffset, reference->radius); + const fixed_t rad = FixedMul(radiusoffset, reference->_f_radius()); const angle_t fineangle = angle >> ANGLETOFINESHIFT; if (!(flags & WARPF_ABSOLUTEPOSITION)) diff --git a/src/p_trace.cpp b/src/p_trace.cpp index 20a257173..64c895f41 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -714,8 +714,8 @@ bool FTraceInfo::ThingCheck(intercept_t *in) hitz = StartZ + FixedMul(Vz, dist); // calculated coordinate is outside the actor's bounding box - if (abs(hitx - in->d.thing->_f_X()) > in->d.thing->radius || - abs(hity - in->d.thing->_f_Y()) > in->d.thing->radius) return true; + if (abs(hitx - in->d.thing->_f_X()) > in->d.thing->_f_radius() || + abs(hity - in->d.thing->_f_Y()) > in->d.thing->_f_radius()) return true; } else if (hitz < in->d.thing->_f_Z()) { // trace enters below actor @@ -731,8 +731,8 @@ bool FTraceInfo::ThingCheck(intercept_t *in) hitz = StartZ + FixedMul(Vz, dist); // calculated coordinate is outside the actor's bounding box - if (abs(hitx - in->d.thing->_f_X()) > in->d.thing->radius || - abs(hity - in->d.thing->_f_Y()) > in->d.thing->radius) return true; + if (abs(hitx - in->d.thing->_f_X()) > in->d.thing->_f_radius() || + abs(hity - in->d.thing->_f_Y()) > in->d.thing->_f_radius()) return true; } if (CurSector->e->XFloor.ffloors.Size()) diff --git a/src/po_man.cpp b/src/po_man.cpp index 911bb97b4..281c75c31 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -1215,7 +1215,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd) performBlockingThrust = true; } - FBoundingBox box(mobj->_f_X(), mobj->_f_Y(), mobj->radius); + FBoundingBox box(mobj->_f_X(), mobj->_f_Y(), mobj->_f_radius()); if (box.Right() <= ld->bbox[BOXLEFT] || box.Left() >= ld->bbox[BOXRIGHT] diff --git a/src/portal.cpp b/src/portal.cpp index 7e81f46dd..9341b965a 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -1118,7 +1118,7 @@ void P_CreateLinkedPortals() if (!(actor->flags & MF_NOBLOCKMAP)) { FPortalGroupArray check(FPortalGroupArray::PGA_NoSectorPortals); - P_CollectConnectedGroups(actor->Sector->PortalGroup, actor->_f_Pos(), actor->_f_Top(), actor->radius, check); + P_CollectConnectedGroups(actor->Sector->PortalGroup, actor->_f_Pos(), actor->_f_Top(), actor->_f_radius(), check); if (check.Size() > 0) { actor->UnlinkFromWorld(); diff --git a/src/thingdef/olddecorations.cpp b/src/thingdef/olddecorations.cpp index 7924a2ffe..ecac5d4be 100644 --- a/src/thingdef/olddecorations.cpp +++ b/src/thingdef/olddecorations.cpp @@ -455,7 +455,7 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults, else if (sc.Compare ("Radius")) { sc.MustGetFloat (); - defaults->radius = int(sc.Float * FRACUNIT); + defaults->radius = sc.Float; } else if (sc.Compare ("Height")) { diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 25542e6cd..7f0e7b39d 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2401,7 +2401,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem) if (distance == 0) { // use the minimum distance that does not result in an overlap - distance = (self->radius + GetDefaultByType(missile)->radius) >> FRACBITS; + distance = (self->_f_radius() + GetDefaultByType(missile)->_f_radius()) >> FRACBITS; } if (ACTION_CALL_FROM_WEAPON()) @@ -3321,13 +3321,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst) // with no relation to the size of the self shattering. I think it should // base the number of shards on the size of the dead thing, so bigger // things break up into more shards than smaller things. - // An self with radius 20 and height 64 creates ~40 chunks. - numChunks = MAX (4, (self->radius>>FRACBITS)*(self->height>>FRACBITS)/32); + // An self with _f_radius() 20 and height 64 creates ~40 chunks. + numChunks = MAX (4, (self->_f_radius()>>FRACBITS)*(self->height>>FRACBITS)/32); i = (pr_burst.Random2()) % (numChunks/4); for (i = MAX (24, numChunks + i); i >= 0; i--) { - fixed_t xo = (((pr_burst() - 128)*self->radius) >> 7); - fixed_t yo = (((pr_burst() - 128)*self->radius) >> 7); + fixed_t xo = (((pr_burst() - 128)*self->_f_radius()) >> 7); + fixed_t yo = (((pr_burst() - 128)*self->_f_radius()) >> 7); fixed_t zo = (pr_burst()*self->height / 255 + self->GetBobOffset()); mo = Spawn(chunk, self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); @@ -3727,8 +3727,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF) } if (flags & CLOFF_MUL_WIDTH) { - offsetforward = FixedMul(self->radius, offsetforward); - offsetwidth = FixedMul(self->radius, offsetwidth); + offsetforward = FixedMul(self->_f_radius(), offsetforward); + offsetwidth = FixedMul(self->_f_radius(), offsetwidth); } pos = self->PosPlusZ(offsetheight - self->floorclip); @@ -5100,7 +5100,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack) // Compute position for spawning blood/puff angle = self->target->__f_AngleTo(self); - fixedvec3 bloodpos = self->target->_f_Vec3Angle(self->target->radius, angle, self->target->height >> 1); + fixedvec3 bloodpos = self->target->_f_Vec3Angle(self->target->_f_radius(), angle, self->target->height >> 1); int damage = flags & WAF_NORANDOM ? maxdamage : (1 + (pr_cabullet() % maxdamage)); diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 2209319df..8e732b1c3 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -647,7 +647,7 @@ void InitThingdef() symt.AddSymbol(new PField(NAME_Accuracy, TypeSInt32, VARF_Native, myoffsetof(AActor,accuracy))); symt.AddSymbol(new PField(NAME_Stamina, TypeSInt32, VARF_Native, myoffsetof(AActor,stamina))); symt.AddSymbol(new PField(NAME_Height, TypeFixed, VARF_Native, myoffsetof(AActor,height))); - symt.AddSymbol(new PField(NAME_Radius, TypeFixed, VARF_Native, myoffsetof(AActor,radius))); + symt.AddSymbol(new PField(NAME_Radius, TypeFloat64, VARF_Native, myoffsetof(AActor,radius))); symt.AddSymbol(new PField(NAME_ReactionTime,TypeSInt32, VARF_Native, myoffsetof(AActor,reactiontime))); symt.AddSymbol(new PField(NAME_MeleeRange, TypeFixed, VARF_Native, myoffsetof(AActor,meleerange))); symt.AddSymbol(new PField(NAME_Speed, TypeFloat64, VARF_Native, myoffsetof(AActor,Speed))); diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index d5996cf5e..659785586 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -624,8 +624,8 @@ DEFINE_PROPERTY(floatspeed, F, Actor) //========================================================================== DEFINE_PROPERTY(radius, F, Actor) { - PROP_FIXED_PARM(id, 0); - defaults->radius=id; + PROP_DOUBLE_PARM(id, 0); + defaults->radius = id; } //==========================================================================