mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- floatified the rest of p_mobj_cpp and removed a large part of the conversion cruft from the headers that was needed to keep the code compileable.
This commit is contained in:
parent
2fff7005ad
commit
5e1c79c050
7 changed files with 48 additions and 106 deletions
|
@ -691,8 +691,7 @@ void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end,
|
|||
point = start + r * dir;
|
||||
dir.Z = dirz;
|
||||
|
||||
S_Sound (FLOAT2FIXED(point.X), FLOAT2FIXED(point.Y), viewz,
|
||||
CHAN_WEAPON, sound, 1, ATTN_NORM);
|
||||
S_Sound (DVector3(point.X, point.Y, viewz), CHAN_WEAPON, sound, 1, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,11 +138,6 @@ enum EPuffFlags
|
|||
};
|
||||
|
||||
AActor *P_SpawnPuff(AActor *source, PClassActor *pufftype, const DVector3 &pos, DAngle hitdir, DAngle particledir, int updown, int flags = 0, AActor *vict = NULL);
|
||||
inline AActor *P_SpawnPuff(AActor *source, PClassActor *pufftype, const fixedvec3 &pos, angle_t hitdir, angle_t particledir, int updown, int flags = 0, AActor *vict = NULL)
|
||||
{
|
||||
DVector3 _pos(FIXED2DBL(pos.x), FIXED2DBL(pos.y), FIXED2DBL(pos.z));
|
||||
return P_SpawnPuff(source, pufftype, _pos, ANGLE2DBL(hitdir), ANGLE2DBL(particledir), updown, flags, vict);
|
||||
}
|
||||
void P_SpawnBlood (const DVector3 &pos, DAngle angle, int damage, AActor *originator);
|
||||
void P_BloodSplatter (const DVector3 &pos, AActor *originator, DAngle hitangle);
|
||||
void P_BloodSplatter2 (const DVector3 &pos, AActor *originator, DAngle hitangle);
|
||||
|
@ -152,42 +147,13 @@ 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_SpawnMissileZ(AActor* source, double z, AActor* dest, PClassActor *type);
|
||||
AActor *P_SpawnMissileXYZ(DVector3 pos, AActor *source, AActor *dest, PClassActor *type, bool checkspawn = true, AActor *owner = NULL);
|
||||
AActor *P_SpawnMissileAngle(AActor *source, PClassActor *type, DAngle angle, double vz);
|
||||
AActor *P_SpawnMissileAngleZ(AActor *source, double z, PClassActor *type, DAngle angle, double vz);
|
||||
AActor *P_SpawnMissileAngleZSpeed(AActor *source, double z, PClassActor *type, DAngle angle, double vz, double speed, AActor *owner = NULL, bool checkspawn = true);
|
||||
AActor *P_SpawnMissileZAimed(AActor *source, double z, AActor *dest, PClassActor *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);
|
||||
}
|
||||
inline AActor *P_SpawnMissileXYZ(const DVector3 &pos, AActor *source, AActor *dest, PClassActor *type, bool checkspawn = true, AActor *owner = NULL)
|
||||
{
|
||||
return P_SpawnMissileXYZ(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(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);
|
||||
inline AActor *P_SpawnMissileAngleZSpeed(AActor *source, double z, PClassActor *type, DAngle angle, double vz, double speed, AActor *owner = NULL, bool checkspawn = true)
|
||||
{
|
||||
return P_SpawnMissileAngleZSpeed(source, FLOAT2FIXED(z), type, angle.BAMs(), FLOAT2FIXED(vz), FLOAT2FIXED(speed), owner, checkspawn);
|
||||
}
|
||||
AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassActor *type);
|
||||
inline AActor *P_SpawnMissileZAimed(AActor *source, double z, AActor *dest, PClassActor *type)
|
||||
{
|
||||
return P_SpawnMissileZAimed(source, FLOAT2FIXED(z), dest, type);
|
||||
}
|
||||
|
||||
AActor *P_SpawnPlayerMissile (AActor* source, PClassActor *type);
|
||||
AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type, DAngle angle);
|
||||
|
|
|
@ -4426,9 +4426,9 @@ void AActor::AdjustFloorClip ()
|
|||
// do the floorclipping instead of the terrain type.
|
||||
for (m = touching_sectorlist; m; m = m->m_tnext)
|
||||
{
|
||||
fixedvec3 pos = _f_PosRelative(m->m_sector);
|
||||
DVector3 pos = PosRelative(m->m_sector);
|
||||
sector_t *hsec = m->m_sector->GetHeightSec();
|
||||
if (hsec == NULL && m->m_sector->floorplane.ZatPoint (pos) == _f_Z())
|
||||
if (hsec == NULL && m->m_sector->floorplane.ZatPoint (pos) == Z())
|
||||
{
|
||||
double clip = Terrains[m->m_sector->GetTerrain(sector_t::floor)].FootClip;
|
||||
if (clip < shallowestclip)
|
||||
|
@ -5270,7 +5270,7 @@ void P_SpawnBlood (const DVector3 &pos, DAngle dir, int damage, AActor *originat
|
|||
}
|
||||
|
||||
if (bloodtype >= 1)
|
||||
P_DrawSplash2 (40, pos, ANGLE2DBL(dir), 2, bloodcolor);
|
||||
P_DrawSplash2 (40, pos, dir, 2, bloodcolor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -5590,11 +5590,11 @@ bool P_HitFloor (AActor *thing)
|
|||
return false;
|
||||
|
||||
// don't splash if landing on the edge above water/lava/etc....
|
||||
fixedvec3 pos;
|
||||
DVector3 pos;
|
||||
for (m = thing->touching_sectorlist; m; m = m->m_tnext)
|
||||
{
|
||||
pos = thing->_f_PosRelative(m->m_sector);
|
||||
if (thing->_f_Z() == m->m_sector->floorplane.ZatPoint(pos.x, pos.y))
|
||||
pos = thing->PosRelative(m->m_sector);
|
||||
if (thing->Z() == m->m_sector->floorplane.ZatPoint(pos))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -5606,7 +5606,7 @@ bool P_HitFloor (AActor *thing)
|
|||
if (!(rover->flags & FF_EXISTS)) continue;
|
||||
if (rover->flags & (FF_SOLID|FF_SWIMMABLE))
|
||||
{
|
||||
if (rover->top.plane->ZatPoint(pos.x, pos.y) == thing->_f_Z())
|
||||
if (rover->top.plane->ZatPoint(pos) == thing->Z())
|
||||
{
|
||||
return P_HitWater (thing, m->m_sector, pos);
|
||||
}
|
||||
|
@ -5638,8 +5638,8 @@ void P_CheckSplash(AActor *self, double distance)
|
|||
// 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
|
||||
// behavior.
|
||||
fixedvec3 pos = self->_f_PosRelative(floorsec);
|
||||
pos.z = self->_f_floorz();
|
||||
DVector3 pos = self->PosRelative(floorsec);
|
||||
pos.Z = self->floorz;
|
||||
P_HitWater (self, floorsec, pos, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -5754,19 +5754,19 @@ void P_PlaySpawnSound(AActor *missile, AActor *spawner)
|
|||
// If there is no spawner use the spawn position.
|
||||
// But not in a silenced sector.
|
||||
if (!(missile->Sector->Flags & SECF_SILENT))
|
||||
S_Sound (missile->_f_X(), missile->_f_Y(), missile->_f_Z(), CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM);
|
||||
S_Sound (missile->Pos(), CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static fixed_t GetDefaultSpeed(PClassActor *type)
|
||||
static double GetDefaultSpeed(PClassActor *type)
|
||||
{
|
||||
if (type == NULL)
|
||||
return 0;
|
||||
else if (G_SkillProperty(SKILLP_FastMonsters) && type->FastSpeed >= 0)
|
||||
return FLOAT2FIXED(type->FastSpeed);
|
||||
return type->FastSpeed;
|
||||
else
|
||||
return GetDefaultByType(type)->_f_speed();
|
||||
return GetDefaultByType(type)->Speed;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -5784,21 +5784,19 @@ AActor *P_SpawnMissile (AActor *source, AActor *dest, PClassActor *type, AActor
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
return P_SpawnMissileXYZ (source->_f_X(), source->_f_Y(), source->_f_Z() + 32*FRACUNIT + source->_f_GetBobOffset(),
|
||||
source, dest, type, true, owner);
|
||||
return P_SpawnMissileXYZ (source->PosPlusZ(32 + source->GetBobOffset()), source, dest, type, true, owner);
|
||||
}
|
||||
|
||||
AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, PClassActor *type)
|
||||
AActor *P_SpawnMissileZ (AActor *source, double z, AActor *dest, PClassActor *type)
|
||||
{
|
||||
if (source == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return P_SpawnMissileXYZ (source->_f_X(), source->_f_Y(), z, source, dest, type);
|
||||
return P_SpawnMissileXYZ (source->PosAtZ(z), source, dest, type);
|
||||
}
|
||||
|
||||
AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
|
||||
AActor *source, AActor *dest, PClassActor *type, bool checkspawn, AActor *owner)
|
||||
AActor *P_SpawnMissileXYZ (DVector3 pos, AActor *source, AActor *dest, PClassActor *type, bool checkspawn, AActor *owner)
|
||||
{
|
||||
if (source == NULL)
|
||||
{
|
||||
|
@ -5812,12 +5810,11 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (z != ONFLOORZ && z != ONCEILINGZ)
|
||||
if (pos.Z != ONFLOORZ && pos.Z != ONCEILINGZ)
|
||||
{
|
||||
z -= source->_f_floorclip();
|
||||
pos.Z -= source->Floorclip;
|
||||
}
|
||||
|
||||
DVector3 pos(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z));
|
||||
AActor *th = Spawn (type, pos, ALLOW_REPLACE);
|
||||
|
||||
P_PlaySpawnSound(th, source);
|
||||
|
@ -5841,9 +5838,9 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
|
|||
velocity.Z = 0;
|
||||
}
|
||||
// [RH] Adjust the trajectory if the missile will go over the target's head.
|
||||
else if (FIXED2FLOAT(z) - source->Z() >= dest->Height)
|
||||
else if (pos.Z - source->Z() >= dest->Height)
|
||||
{
|
||||
velocity.Z += (dest->Height - FIXED2FLOAT(z) + source->Z());
|
||||
velocity.Z += (dest->Height - pos.Z + source->Z());
|
||||
}
|
||||
th->Vel = velocity.Resized(speed);
|
||||
|
||||
|
@ -5908,25 +5905,21 @@ AActor *P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassAct
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
AActor *P_SpawnMissileAngle (AActor *source, PClassActor *type,
|
||||
angle_t angle, fixed_t vz)
|
||||
AActor *P_SpawnMissileAngle (AActor *source, PClassActor *type, DAngle angle, double vz)
|
||||
{
|
||||
if (source == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return P_SpawnMissileAngleZSpeed (source, source->_f_Z() + 32*FRACUNIT + source->_f_GetBobOffset(),
|
||||
type, angle, vz, GetDefaultSpeed (type));
|
||||
return P_SpawnMissileAngleZSpeed (source, source->Z() + 32 + source->GetBobOffset(), type, angle, vz, GetDefaultSpeed (type));
|
||||
}
|
||||
|
||||
AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z,
|
||||
PClassActor *type, angle_t angle, fixed_t vz)
|
||||
AActor *P_SpawnMissileAngleZ (AActor *source, double z, PClassActor *type, DAngle angle, double vz)
|
||||
{
|
||||
return P_SpawnMissileAngleZSpeed (source, z, type, angle, vz,
|
||||
GetDefaultSpeed (type));
|
||||
return P_SpawnMissileAngleZSpeed (source, z, type, angle, vz, GetDefaultSpeed (type));
|
||||
}
|
||||
|
||||
AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassActor *type)
|
||||
AActor *P_SpawnMissileZAimed (AActor *source, double z, AActor *dest, PClassActor *type)
|
||||
{
|
||||
if (source == NULL)
|
||||
{
|
||||
|
@ -5952,26 +5945,15 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassAct
|
|||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// FUNC P_SpawnMissileAngleSpeed
|
||||
// FUNC P_SpawnMissileAngleZSpeed
|
||||
//
|
||||
// Returns NULL if the missile exploded immediately, otherwise returns
|
||||
// a mobj_t pointer to the missile.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
AActor *P_SpawnMissileAngleSpeed (AActor *source, PClassActor *type,
|
||||
angle_t angle, fixed_t vz, fixed_t speed)
|
||||
{
|
||||
if (source == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return P_SpawnMissileAngleZSpeed (source, source->_f_Z() + 32*FRACUNIT + source->_f_GetBobOffset(),
|
||||
type, angle, vz, speed);
|
||||
}
|
||||
|
||||
AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
|
||||
PClassActor *type, angle_t angle, fixed_t vz, fixed_t speed, AActor *owner, bool checkspawn)
|
||||
AActor *P_SpawnMissileAngleZSpeed (AActor *source, double z,
|
||||
PClassActor *type, DAngle angle, double vz, double speed, AActor *owner, bool checkspawn)
|
||||
{
|
||||
if (source == NULL)
|
||||
{
|
||||
|
@ -5981,17 +5963,17 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
|
|||
|
||||
if (z != ONFLOORZ && z != ONCEILINGZ)
|
||||
{
|
||||
z -= source->_f_floorclip();
|
||||
z -= source->Floorclip;
|
||||
}
|
||||
|
||||
mo = Spawn (type, source->PosAtZ(FIXED2FLOAT(z)), ALLOW_REPLACE);
|
||||
mo = Spawn (type, source->PosAtZ(z), ALLOW_REPLACE);
|
||||
|
||||
P_PlaySpawnSound(mo, source);
|
||||
if (owner == NULL) owner = source;
|
||||
mo->target = owner;
|
||||
mo->Angles.Yaw = ANGLE2DBL(angle);
|
||||
mo->VelFromAngle(FIXED2DBL(speed));
|
||||
mo->Vel.Z = FIXED2DBL(vz);
|
||||
mo->Angles.Yaw = angle;
|
||||
mo->VelFromAngle(speed);
|
||||
mo->Vel.Z = vz;
|
||||
|
||||
if (mo->flags4 & MF4_SPECTRAL)
|
||||
{
|
||||
|
@ -6597,7 +6579,7 @@ void PrintMiscActorInfo(AActor *query)
|
|||
Printf("\nTID: %d", query->tid);
|
||||
Printf("\nCoord= x: %f, y: %f, z:%f, floor:%f, ceiling:%f.",
|
||||
query->X(), query->Y(), query->Z(),
|
||||
FIXED2DBL(query->_f_floorz()), query->ceilingz);
|
||||
query->floorz, query->ceilingz);
|
||||
Printf("\nSpeed= %f, velocity= x:%f, y:%f, z:%f, combined:%f.\n",
|
||||
query->Speed, query->Vel.X, query->Vel.Y, query->Vel.Z, query->Vel.Length());
|
||||
}
|
||||
|
|
|
@ -309,7 +309,7 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *ques
|
|||
}
|
||||
if (playsound)
|
||||
{
|
||||
S_Sound (pt[0], pt[1], 0, CHAN_VOICE|CHAN_LISTENERZ, sound, 1, ATTN_STATIC);
|
||||
S_Sound (DVector3(FIXED2DBL(pt[0]), FIXED2DBL(pt[1]), 0), CHAN_VOICE|CHAN_LISTENERZ, sound, 1, ATTN_STATIC);
|
||||
}
|
||||
if (quest != NULL)
|
||||
{
|
||||
|
@ -391,7 +391,7 @@ void DActiveButton::Tick ()
|
|||
if (def != NULL)
|
||||
{
|
||||
m_Frame = -1;
|
||||
S_Sound (m_X, m_Y, 0, CHAN_VOICE|CHAN_LISTENERZ,
|
||||
S_Sound (DVector3(FIXED2DBL(m_X), FIXED2DBL(m_Y), 0), CHAN_VOICE|CHAN_LISTENERZ,
|
||||
def->Sound != 0 ? FSoundID(def->Sound) : FSoundID("switches/normbutn"),
|
||||
1, ATTN_STATIC);
|
||||
bFlippable = false;
|
||||
|
|
|
@ -2106,7 +2106,7 @@ void P_FallingDamage (AActor *actor)
|
|||
}
|
||||
// The minimum amount of damage you take from falling in Strife
|
||||
// is 52. Ouch!
|
||||
damage = vel / 25000;
|
||||
damage = int(vel / (25000./65536.));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1259,10 +1259,9 @@ void S_Sound (const FPolyObj *poly, int channel, FSoundID sound_id, float volume
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void S_Sound (fixed_t x, fixed_t y, fixed_t z, int channel, FSoundID sound_id, float volume, float attenuation)
|
||||
void S_Sound(const DVector3 &pos, int channel, FSoundID sound_id, float volume, float attenuation)
|
||||
{
|
||||
FVector3 pt(FIXED2FLOAT(x), FIXED2FLOAT(z), FIXED2FLOAT(y));
|
||||
S_StartSound (NULL, NULL, NULL, &pt, channel, sound_id, volume, attenuation);
|
||||
S_StartSound (NULL, NULL, NULL, &pos, channel, sound_id, volume, attenuation);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -230,11 +230,7 @@ void S_Sound (AActor *ent, int channel, FSoundID sfxid, float volume, float atte
|
|||
void S_SoundMinMaxDist (AActor *ent, int channel, FSoundID sfxid, float volume, float mindist, float maxdist);
|
||||
void S_Sound (const FPolyObj *poly, int channel, FSoundID sfxid, float volume, float attenuation);
|
||||
void S_Sound (const sector_t *sec, int channel, FSoundID sfxid, float volume, float attenuation);
|
||||
void S_Sound (fixed_t x, fixed_t y, fixed_t z, int channel, FSoundID sfxid, float volume, float attenuation);
|
||||
inline void S_Sound(const DVector3 &pos, int channel, FSoundID sfxid, float volume, float attenuation)
|
||||
{
|
||||
S_Sound(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), channel, sfxid, volume, attenuation);
|
||||
}
|
||||
void S_Sound(const DVector3 &pos, int channel, FSoundID sfxid, float volume, float attenuation);
|
||||
|
||||
// sound channels
|
||||
// channel 0 never willingly overrides
|
||||
|
|
Loading…
Reference in a new issue