- added two floating point special variables, because the two existing ones are integers and unusable for storing doubles.

This commit is contained in:
Christoph Oelckers 2016-03-20 21:51:09 +01:00
parent cff8e51811
commit afa5f22b31
5 changed files with 24 additions and 14 deletions

View file

@ -1136,6 +1136,7 @@ public:
} }
double projectilepassheight; // height for clipping projectile movement against this actor double projectilepassheight; // height for clipping projectile movement against this actor
SDWORD tics; // state tic counter SDWORD tics; // state tic counter
FState *state; FState *state;
VMFunction *Damage; // For missiles and monster railgun VMFunction *Damage; // For missiles and monster railgun
@ -1153,6 +1154,9 @@ public:
int special1; // Special info int special1; // Special info
int special2; // Special info int special2; // Special info
double specialf1; // With floats we cannot use the int versions for storing position or angle data without reverting to fixed point (which we do not want.)
double specialf2;
int weaponspecial; // Special info for weapons. int weaponspecial; // Special info for weapons.
int health; int health;
BYTE movedir; // 0-7 BYTE movedir; // 0-7
@ -1290,6 +1294,7 @@ public:
void AddToHash (); void AddToHash ();
void RemoveFromHash (); void RemoveFromHash ();
private: private:
static AActor *TIDHash[128]; static AActor *TIDHash[128];
static inline int TIDHASH (int key) { return key & 127; } static inline int TIDHASH (int key) { return key & 127; }

View file

@ -1459,9 +1459,9 @@ void FParser::SF_SetCamera(void)
angle = t_argc < 2 ? newcamera->Angles.Yaw : floatvalue(t_argv[1]); angle = t_argc < 2 ? newcamera->Angles.Yaw : floatvalue(t_argv[1]);
newcamera->special1 = newcamera->Angles.Yaw.BAMs(); newcamera->specialf1 = newcamera->Angles.Yaw.Degrees;
newcamera->special2=newcamera->_f_Z(); newcamera->specialf2 = newcamera->Z();
newcamera->_f_SetZ(t_argc < 3 ? (newcamera->_f_Z() + (41 << FRACBITS)) : (intvalue(t_argv[2]) << FRACBITS)); newcamera->SetZ(t_argc < 3 ? newcamera->Z() + 41 : floatvalue(t_argv[2]));
newcamera->Angles.Yaw = angle; newcamera->Angles.Yaw = angle;
if (t_argc < 4) newcamera->Angles.Pitch = 0.; if (t_argc < 4) newcamera->Angles.Pitch = 0.;
else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.); else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.);
@ -1485,8 +1485,8 @@ void FParser::SF_ClearCamera(void)
if (cam) if (cam)
{ {
player->camera=player->mo; player->camera=player->mo;
cam->Angles.Yaw = ANGLE2DBL(cam->special1); cam->Angles.Yaw = cam->specialf1;
cam->_f_SetZ(cam->special2); cam->SetZ(cam->specialf2);
} }
} }

View file

@ -134,8 +134,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
mo->Angles.Yaw = an; mo->Angles.Yaw = an;
mo->target = self->target; mo->target = self->target;
mo->VelFromAngle(FLAMESPEED); mo->VelFromAngle(FLAMESPEED);
mo->special1 = FLOAT2FIXED(mo->Vel.X); mo->specialf1 = mo->Vel.X;
mo->special2 = FLOAT2FIXED(mo->Vel.Y); mo->specialf2 = mo->Vel.Y;
mo->tics -= pr_missile()&3; mo->tics -= pr_missile()&3;
} }
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset( mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
@ -146,8 +146,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
mo->Angles.Yaw = an + 180.; mo->Angles.Yaw = an + 180.;
mo->target = self->target; mo->target = self->target;
mo->VelFromAngle(-FLAMESPEED); mo->VelFromAngle(-FLAMESPEED);
mo->special1 = FLOAT2FIXED(mo->Vel.X); mo->specialf1 = mo->Vel.X;
mo->special2 = FLOAT2FIXED(mo->Vel.Y); mo->specialf2 = mo->Vel.Y;
mo->tics -= pr_missile()&3; mo->tics -= pr_missile()&3;
} }
} }
@ -168,7 +168,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameRotate)
DAngle an = self->Angles.Yaw + 90.; DAngle an = self->Angles.Yaw + 90.;
self->VelFromAngle(an, FLAMEROTSPEED); self->VelFromAngle(an, FLAMEROTSPEED);
self->Vel += DVector2(FIXED2DBL(self->special1), FIXED2DBL(self->special2)); self->Vel += DVector2(self->specialf1, self->specialf2);
self->Angles.Yaw += 6.; self->Angles.Yaw += 6.;
return 0; return 0;

View file

@ -2425,9 +2425,9 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
// Hexen yanked all items to the floor, except those being spawned at map start in the air. // Hexen yanked all items to the floor, except those being spawned at map start in the air.
// Those were kept at their original height. // Those were kept at their original height.
// Do this only if the item was actually spawned by the map above ground to avoid problems. // Do this only if the item was actually spawned by the map above ground to avoid problems.
if (mo->special1 > 0 && (mo->flags2 & MF2_FLOATBOB) && (ib_compatflags & BCOMPATF_FLOATBOB)) if (mo->specialf1 > 0 && (mo->flags2 & MF2_FLOATBOB) && (ib_compatflags & BCOMPATF_FLOATBOB))
{ {
mo->_f_SetZ(mo->_f_floorz() + mo->special1); mo->SetZ(mo->floorz + mo->specialf1);
} }
@ -5123,7 +5123,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
mobj->_f_AddZ(mthing->z); mobj->_f_AddZ(mthing->z);
if ((mobj->flags2 & MF2_FLOATBOB) && (ib_compatflags & BCOMPATF_FLOATBOB)) if ((mobj->flags2 & MF2_FLOATBOB) && (ib_compatflags & BCOMPATF_FLOATBOB))
{ {
mobj->special1 = mthing->z; mobj->specialf1 = FIXED2DBL(mthing->z);
} }
} }
else if (z == ONCEILINGZ) else if (z == ONCEILINGZ)
@ -5140,7 +5140,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
else mobj->flags &= ~MF_NOGRAVITY; else mobj->flags &= ~MF_NOGRAVITY;
// For Hexen floatbob 'compatibility' we do not really want to alter the floorz. // For Hexen floatbob 'compatibility' we do not really want to alter the floorz.
if (mobj->special1 == 0 || !(mobj->flags2 & MF2_FLOATBOB) || !(ib_compatflags & BCOMPATF_FLOATBOB)) if (mobj->specialf1 == 0 || !(mobj->flags2 & MF2_FLOATBOB) || !(ib_compatflags & BCOMPATF_FLOATBOB))
{ {
P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
} }

View file

@ -281,6 +281,11 @@ struct secplane_t
return FixedMul (ic, -d - DMulScale16 (a, ac->_f_X(), b, ac->_f_Y())); return FixedMul (ic, -d - DMulScale16 (a, ac->_f_X(), b, ac->_f_Y()));
} }
double ZatPointF(const AActor *ac) const
{
return FIXED2DBL(ZatPoint(ac));
}
// Returns the value of z at (x,y) if d is equal to dist // Returns the value of z at (x,y) if d is equal to dist
fixed_t ZatPointDist (fixed_t x, fixed_t y, fixed_t dist) const fixed_t ZatPointDist (fixed_t x, fixed_t y, fixed_t dist) const
{ {