From a652c061f607678d2055098536f43a45e9daf0dd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 22 Mar 2016 12:42:27 +0100 Subject: [PATCH] - converted g_strife to full floating point use, except the floor height changing stuff in A_LightGoesOut. --- src/actor.h | 22 +- src/b_move.cpp | 8 +- src/d_player.h | 6 +- src/g_raven/a_minotaur.cpp | 4 +- src/g_shared/a_morph.cpp | 4 +- src/g_strife/a_acolyte.cpp | 2 +- src/g_strife/a_alienspectres.cpp | 12 +- src/g_strife/a_crusader.cpp | 16 +- src/g_strife/a_entityboss.cpp | 7 +- src/g_strife/a_inquisitor.cpp | 14 +- src/g_strife/a_loremaster.cpp | 4 +- src/g_strife/a_programmer.cpp | 2 +- src/g_strife/a_rebels.cpp | 6 +- src/g_strife/a_sentinel.cpp | 4 +- src/g_strife/a_strifeitems.cpp | 14 +- src/g_strife/a_strifestuff.cpp | 360 +-------------------------- src/g_strife/a_strifeweapons.cpp | 56 ++--- src/g_strife/a_thingstoblowup.cpp | 6 +- src/g_strife/strife_sbar.cpp | 12 +- src/gi.cpp | 9 +- src/gi.h | 2 +- src/p_3dfloors.cpp | 2 +- src/p_3dmidtex.cpp | 2 +- src/p_acs.cpp | 2 +- src/p_enemy.cpp | 2 +- src/p_enemy.h | 5 + src/p_local.h | 4 + src/p_map.cpp | 30 +-- src/p_mobj.cpp | 13 +- src/p_spec.h | 9 + src/p_teleport.cpp | 10 +- src/p_things.cpp | 4 +- src/p_user.cpp | 8 +- src/portal.h | 7 + src/r_defs.h | 15 ++ src/thingdef/thingdef_properties.cpp | 2 +- 36 files changed, 192 insertions(+), 493 deletions(-) diff --git a/src/actor.h b/src/actor.h index 31f264026..1977f7d38 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1003,6 +1003,11 @@ public: } } + DVector3 Vec3Offset(const DVector3 &ofs, bool absolute = false) + { + return Vec3Offset(ofs.X, ofs.Y, ofs.Z, absolute); + } + fixedvec3 _f_Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false) { if (absolute) @@ -1270,7 +1275,13 @@ public: FSoundIDNoInit WallBounceSound; FSoundIDNoInit CrushPainSound; - fixed_t MaxDropOffHeight, MaxStepHeight; + fixed_t MaxDropOffHeight; + double MaxStepHeight; + + fixed_t _f_MaxStepHeight() + { + return FLOAT2FIXED(MaxStepHeight); + } SDWORD Mass; SWORD PainChance; int PainThreshold; @@ -1728,6 +1739,15 @@ inline T *Spawn(const DVector3 &pos, replace_t allowreplacement) return static_cast(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, allowreplacement)); } +template +inline T *Spawn(double x, double y, double z, replace_t allowreplacement) +{ + fixed_t zz; + if (z != ONFLOORZ && z != ONCEILINGZ && z != FLOATRANDZ) zz = FLOAT2FIXED(z); + else zz = (int)z; + return static_cast(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), FLOAT2FIXED(x), FLOAT2FIXED(y), zz, allowreplacement)); +} + template inline T *Spawn() // for inventory items we do not need coordinates and replacement info. { diff --git a/src/b_move.cpp b/src/b_move.cpp index 63a0bc623..f5eba7ea7 100644 --- a/src/b_move.cpp +++ b/src/b_move.cpp @@ -269,17 +269,17 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm if (!(thing->flags & MF_NOCLIP) ) { - fixed_t maxstep = thing->MaxStepHeight; if (tm.ceilingz - tm.floorz < thing->Height) return false; // doesn't fit + double maxmove = FIXED2FLOAT(MAXMOVEHEIGHT); if (!(thing->flags&MF_MISSILE)) { - if(tm._f_floorz() > (thing->Sector->floorplane.ZatPoint (x, y)+MAXMOVEHEIGHT)) //Too high wall + if(tm.floorz > (thing->Sector->floorplane._f_ZatPointF(x, y)+maxmove)) //Too high wall return false; //Jumpable - if(tm._f_floorz()>(thing->Sector->floorplane.ZatPoint (x, y)+thing->MaxStepHeight)) + if(tm.floorz > (thing->Sector->floorplane._f_ZatPointF(x, y)+thing->MaxStepHeight)) cmd->ucmd.buttons |= BT_JUMP; @@ -292,7 +292,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm // maxstep=37*FRACUNIT; if ( !(thing->flags & MF_TELEPORT) && - (tm._f_floorz() - thing->_f_Z() > maxstep ) ) + (tm.floorz - thing->Z() > thing->MaxStepHeight) ) return false; // too big a step up diff --git a/src/d_player.h b/src/d_player.h index 0a38167db..10297159c 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -404,7 +404,7 @@ public: float FOV; // current field of vision fixed_t viewz; // focal origin above r.z fixed_t viewheight; // base height above floor for viewz - fixed_t deltaviewheight; // squat speed. + double deltaviewheight; // squat speed. double bob; // bounded/scaled total velocity // killough 10/98: used for realistic bobbing (i.e. not simply overall speed) @@ -502,9 +502,9 @@ public: DAngle ConversationNPCAngle; bool ConversationFaceTalker; - fixed_t GetDeltaViewHeight() const + double GetDeltaViewHeight() const { - return (mo->ViewHeight + crouchviewdelta - viewheight) >> 3; + return FIXED2DBL((mo->ViewHeight + crouchviewdelta - viewheight) >> 3); } void Uncrouch() diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index 1e7cf6674..34ecfd161 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -161,7 +161,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk1) if ((player = self->target->player) != NULL && player->mo == self->target) { // Squish the player - player->deltaviewheight = -16*FRACUNIT; + player->deltaviewheight = -16; } } return 0; @@ -350,7 +350,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk3) if ((player = self->target->player) != NULL && player->mo == self->target) { // Squish the player - player->deltaviewheight = -16*FRACUNIT; + player->deltaviewheight = -16; } } else diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index 08367e89b..174bfd4a2 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -168,7 +168,6 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, AWeapon *beastweap; APlayerPawn *mo; APlayerPawn *pmo; - angle_t angle; pmo = player->mo; // [MH] @@ -305,11 +304,10 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, } } - angle = mo->_f_angle() >> ANGLETOFINESHIFT; AActor *eflash = NULL; if (exit_flash != NULL) { - eflash = Spawn(exit_flash, pmo->Vec3Offset(20*finecosine[angle], 20*finesine[angle], TELEFOGHEIGHT), ALLOW_REPLACE); + eflash = Spawn(exit_flash, pmo->Vec3Angle(20., mo->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE); if (eflash) eflash->target = mo; } mo->SetupWeaponSlots(); // Use original class's weapon slots. diff --git a/src/g_strife/a_acolyte.cpp b/src/g_strife/a_acolyte.cpp index 97f4698b2..e8049da1b 100644 --- a/src/g_strife/a_acolyte.cpp +++ b/src/g_strife/a_acolyte.cpp @@ -29,7 +29,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideDecepticon) { PARAM_ACTION_PROLOGUE; - EV_DoDoor (DDoor::doorClose, NULL, self, 999, 8*FRACUNIT, 0, 0, 0); + EV_DoDoor (DDoor::doorClose, NULL, self, 999, 8., 0, 0, 0); if (self->target != NULL && self->target->player != NULL) { P_NoiseAlert (self->target, self); diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index de95de431..a7624785b 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -22,7 +22,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall) { PARAM_ACTION_PROLOGUE; - AActor *foo = Spawn("AlienChunkSmall", self->PosPlusZ(10*FRACUNIT), ALLOW_REPLACE); + AActor *foo = Spawn("AlienChunkSmall", self->PosPlusZ(10.), ALLOW_REPLACE); if (foo != NULL) { @@ -43,7 +43,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkLarge) { PARAM_ACTION_PROLOGUE; - AActor *foo = Spawn("AlienChunkLarge", self->PosPlusZ(10*FRACUNIT), ALLOW_REPLACE); + AActor *foo = Spawn("AlienChunkLarge", self->PosPlusZ(10.), ALLOW_REPLACE); if (foo != NULL) { @@ -67,7 +67,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack) if (self->target == NULL) return 0; - AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE); + AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32.), ALLOW_REPLACE); foo->Vel.Z = -12; foo->target = self; @@ -114,7 +114,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath) switch (self->GetClass()->TypeName) { case NAME_AlienSpectre1: - EV_DoFloor (DFloor::floorLowerToLowest, NULL, 999, FRACUNIT, 0, -1, 0, false); + EV_DoFloor (DFloor::floorLowerToLowest, NULL, 999, 1., 0., -1, 0, false); log = 95; break; @@ -152,7 +152,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath) { // You wield the power of the complete Sigil. log = 85; } - EV_DoDoor (DDoor::doorOpen, NULL, NULL, 222, 8*FRACUNIT, 0, 0, 0); + EV_DoDoor (DDoor::doorOpen, NULL, NULL, 222, 8., 0, 0, 0); break; } @@ -188,7 +188,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath) { // Another Sigil piece. Woohoo! log = 83; } - EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, FRACUNIT, 0, -1, 0, false); + EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0., -1, 0, false); break; default: diff --git a/src/g_strife/a_crusader.cpp b/src/g_strife/a_crusader.cpp index 9fef47f09..b54fdd427 100644 --- a/src/g_strife/a_crusader.cpp +++ b/src/g_strife/a_crusader.cpp @@ -13,7 +13,7 @@ static bool CrusaderCheckRange (AActor *self) { if (self->reactiontime == 0 && P_CheckSight (self, self->target)) { - return self->AproxDistance (self->target) < 264*FRACUNIT; + return self->Distance2D (self->target) < 264.; } return false; } @@ -29,18 +29,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose) { A_FaceTarget (self); self->Angles.Yaw -= 180./16; - P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile")); + P_SpawnMissileZAimed (self, self->Z() + 40, self->target, PClass::FindActor("FastFlameMissile")); } else { if (P_CheckMissileRange (self)) { A_FaceTarget (self); - P_SpawnMissileZAimed (self, self->_f_Z() + 56*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile")); + P_SpawnMissileZAimed (self, self->Z() + 56, self->target, PClass::FindActor("CrusaderMissile")); self->Angles.Yaw -= 45./32; - P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile")); + P_SpawnMissileZAimed (self, self->Z() + 40, self->target, PClass::FindActor("CrusaderMissile")); self->Angles.Yaw += 45./16; - P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile")); + P_SpawnMissileZAimed (self, self->Z() + 40, self->target, PClass::FindActor("CrusaderMissile")); self->Angles.Yaw -= 45./16; self->reactiontime += 15; } @@ -54,7 +54,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft) PARAM_ACTION_PROLOGUE; self->Angles.Yaw += 90./16; - AActor *misl = P_SpawnMissileZAimed (self, self->_f_Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile")); + AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48, self->target, PClass::FindActor("FastFlameMissile")); if (misl != NULL) { misl->Vel.Z += 1; @@ -67,7 +67,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight) PARAM_ACTION_PROLOGUE; self->Angles.Yaw -= 90./16; - AActor *misl = P_SpawnMissileZAimed (self, self->_f_Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile")); + AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48, self->target, PClass::FindActor("FastFlameMissile")); if (misl != NULL) { misl->Vel.Z += 1; @@ -94,7 +94,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderDeath) if (CheckBossDeath (self)) { - EV_DoFloor (DFloor::floorLowerToLowest, NULL, 667, FRACUNIT, 0, -1, 0, false); + EV_DoFloor (DFloor::floorLowerToLowest, NULL, 667, 1., 0., -1, 0, false); } return 0; } diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index 2913a7f8a..349942fe2 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -27,8 +27,7 @@ void A_SpectralMissile (AActor *self, const char *missilename) { if (self->target != NULL) { - AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32*FRACUNIT), - self, self->target, PClass::FindActor(missilename), false); + AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32.), self, self->target, PClass::FindActor(missilename), false); if (missile != NULL) { missile->tracer = self->target; @@ -78,7 +77,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity) { PARAM_ACTION_PROLOGUE; - AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70*FRACUNIT), ALLOW_REPLACE); + AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70), ALLOW_REPLACE); if (entity != NULL) { entity->Angles.Yaw = self->Angles.Yaw; @@ -94,7 +93,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath) PARAM_ACTION_PROLOGUE; AActor *second; - double secondRadius = FIXED2DBL(GetDefaultByName("EntitySecond")->_f_radius() * 2); + double secondRadius = GetDefaultByName("EntitySecond")->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_inquisitor.cpp b/src/g_strife/a_inquisitor.cpp index 368df7621..101959ffb 100644 --- a/src/g_strife/a_inquisitor.cpp +++ b/src/g_strife/a_inquisitor.cpp @@ -23,7 +23,7 @@ bool InquisitorCheckDistance (AActor *self) { if (self->reactiontime == 0 && P_CheckSight (self, self->target)) { - return self->AproxDistance (self->target) < 264*FRACUNIT; + return self->Distance2D (self->target) < 264.; } return false; } @@ -61,20 +61,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack) A_FaceTarget (self); - self->_f_AddZ(32*FRACUNIT); + self->AddZ(32); self->Angles.Yaw -= 45./32; - proj = P_SpawnMissileZAimed (self, self->_f_Z(), self->target, PClass::FindActor("InquisitorShot")); + proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot")); if (proj != NULL) { proj->Vel.Z += 9; } self->Angles.Yaw += 45./16; - proj = P_SpawnMissileZAimed (self, self->_f_Z(), self->target, PClass::FindActor("InquisitorShot")); + proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot")); if (proj != NULL) { proj->Vel.Z += 16; } - self->_f_AddZ(-32*FRACUNIT); + self->AddZ(-32); return 0; } @@ -89,7 +89,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump) return 0; S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM); - self->_f_AddZ(64*FRACUNIT); + self->AddZ(64); A_FaceTarget (self); speed = self->Speed * (2./3); self->VelFromAngle(speed); @@ -127,7 +127,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossArm) { PARAM_ACTION_PROLOGUE; - AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); + AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24), ALLOW_REPLACE); foo->Angles.Yaw = self->Angles.Yaw - 90. + pr_inq.Random2() * (360./1024.); foo->VelFromAngle(foo->Speed / 8); foo->Vel.Z = pr_inq() / 64.; diff --git a/src/g_strife/a_loremaster.cpp b/src/g_strife/a_loremaster.cpp index 85ef0ba2b..ead116c63 100644 --- a/src/g_strife/a_loremaster.cpp +++ b/src/g_strife/a_loremaster.cpp @@ -37,7 +37,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain) S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM); Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE); - Spawn("LoreShot2", self->Vec3Offset(-(self->_f_velx() >> 1), -(self->_f_vely() >> 1), -(self->_f_velz() >> 1)), ALLOW_REPLACE); - Spawn("LoreShot2", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), -self->_f_velz()), ALLOW_REPLACE); + Spawn("LoreShot2", self->Vec3Offset(-self->Vel/2.), ALLOW_REPLACE); + Spawn("LoreShot2", self->Vec3Offset(-self->Vel), ALLOW_REPLACE); return 0; } diff --git a/src/g_strife/a_programmer.cpp b/src/g_strife/a_programmer.cpp index cbdc4a14c..951e9d954 100644 --- a/src/g_strife/a_programmer.cpp +++ b/src/g_strife/a_programmer.cpp @@ -130,7 +130,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase) { PARAM_ACTION_PROLOGUE; - AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); + AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24), ALLOW_REPLACE); if (foo != NULL) { foo->Angles.Yaw = self->Angles.Yaw + 180. + pr_prog.Random2() * (360. / 1024.); diff --git a/src/g_strife/a_rebels.cpp b/src/g_strife/a_rebels.cpp index ba9213471..dd5267c60 100644 --- a/src/g_strife/a_rebels.cpp +++ b/src/g_strife/a_rebels.cpp @@ -78,10 +78,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon) AActor *owner = self->target; AActor *rebel; - angle_t an; rebel = Spawn("Rebel1", self->PosAtZ(self->floorz), ALLOW_REPLACE); - if (!P_TryMove (rebel, rebel->X(), rebel->Y(), true)) + if (!P_TryMove (rebel, rebel->Pos(), true)) { rebel->Destroy (); return 0; @@ -116,8 +115,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon) rebel->SetState (rebel->SeeState); rebel->Angles.Yaw = self->Angles.Yaw; - an = self->_f_angle() >> ANGLETOFINESHIFT; - Spawn (rebel->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE); + Spawn (rebel->Vec3Angle(20., self->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE); if (--self->health < 0) { self->SetState(self->FindState(NAME_Death)); diff --git a/src/g_strife/a_sentinel.cpp b/src/g_strife/a_sentinel.cpp index eb282fcce..977098df4 100644 --- a/src/g_strife/a_sentinel.cpp +++ b/src/g_strife/a_sentinel.cpp @@ -53,14 +53,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack) return 0; } - missile = P_SpawnMissileZAimed (self, self->_f_Z() + 32*FRACUNIT, self->target, PClass::FindActor("SentinelFX2")); + missile = P_SpawnMissileZAimed (self, self->Z() + 32, self->target, PClass::FindActor("SentinelFX2")); if (missile != NULL && (missile->Vel.X != 0 || missile->Vel.Y != 0)) { for (int i = 8; i > 1; --i) { trail = Spawn("SentinelFX1", - self->_f_Vec3Angle(missile->_f_radius()*i, missile->_f_angle(), (missile->_f_velz() / 4 * i)), ALLOW_REPLACE); + self->Vec3Angle(missile->radius*i, missile->Angles.Yaw, missile->Vel.Z / 4 * i), ALLOW_REPLACE); if (trail != NULL) { trail->target = self; diff --git a/src/g_strife/a_strifeitems.cpp b/src/g_strife/a_strifeitems.cpp index c9f10cb83..45e8218e1 100644 --- a/src/g_strife/a_strifeitems.cpp +++ b/src/g_strife/a_strifeitems.cpp @@ -135,7 +135,7 @@ IMPLEMENT_CLASS (APrisonPass) bool APrisonPass::TryPickup (AActor *&toucher) { Super::TryPickup (toucher); - EV_DoDoor (DDoor::doorOpen, NULL, toucher, 223, 2*FRACUNIT, 0, 0, 0); + EV_DoDoor (DDoor::doorOpen, NULL, toucher, 223, 2., 0, 0, 0); toucher->GiveInventoryType (QuestItemClasses[9]); return true; } @@ -152,7 +152,7 @@ bool APrisonPass::TryPickup (AActor *&toucher) bool APrisonPass::SpecialDropAction (AActor *dropper) { - EV_DoDoor (DDoor::doorOpen, NULL, dropper, 223, 2*FRACUNIT, 0, 0, 0); + EV_DoDoor (DDoor::doorOpen, NULL, dropper, 223, 2., 0, 0, 0); Destroy (); return true; } @@ -210,7 +210,7 @@ IMPLEMENT_CLASS (AOpenDoor222) bool AOpenDoor222::TryPickup (AActor *&toucher) { - EV_DoDoor (DDoor::doorOpen, NULL, toucher, 222, 2*FRACUNIT, 0, 0, 0); + EV_DoDoor (DDoor::doorOpen, NULL, toucher, 222, 2., 0, 0, 0); GoAwayAndDie (); return true; } @@ -229,14 +229,14 @@ IMPLEMENT_CLASS (ACloseDoor222) bool ACloseDoor222::TryPickup (AActor *&toucher) { - EV_DoDoor (DDoor::doorClose, NULL, toucher, 222, 2*FRACUNIT, 0, 0, 0); + EV_DoDoor (DDoor::doorClose, NULL, toucher, 222, 2., 0, 0, 0); GoAwayAndDie (); return true; } bool ACloseDoor222::SpecialDropAction (AActor *dropper) { - EV_DoDoor (DDoor::doorClose, NULL, dropper, 222, 2*FRACUNIT, 0, 0, 0); + EV_DoDoor (DDoor::doorClose, NULL, dropper, 222, 2., 0, 0, 0); if (dropper->target->CheckLocalView (consoleplayer)) { Printf ("You're dead! You set off the alarm.\n"); @@ -260,14 +260,14 @@ IMPLEMENT_CLASS (AOpenDoor224) bool AOpenDoor224::TryPickup (AActor *&toucher) { - EV_DoDoor (DDoor::doorOpen, NULL, toucher, 224, 2*FRACUNIT, 0, 0, 0); + EV_DoDoor (DDoor::doorOpen, NULL, toucher, 224, 2., 0, 0, 0); GoAwayAndDie (); return true; } bool AOpenDoor224::SpecialDropAction (AActor *dropper) { - EV_DoDoor (DDoor::doorOpen, NULL, dropper, 224, 2*FRACUNIT, 0, 0, 0); + EV_DoDoor (DDoor::doorOpen, NULL, dropper, 224, 2., 0, 0, 0); Destroy (); return true; } diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 0bfe5513a..c845c253c 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -58,354 +58,6 @@ // angle += pr_spawnmissile.Random2() << 22 // Note that these numbers are different from those used by all the other Doom engine games. -/* These mobjinfos have been converted: - - 0 ForceFieldGuard - 1 StrifePlayer - 2 WeaponSmith - 3 BarKeep - 4 Armorer - 5 Medic - 6 Peasant1 - 7 Peasant2 - 8 Peasant3 - 9 Peasant4 - 10 Peasant5 - 11 Peasant6 - 12 Peasant7 - 13 Peasant8 - 14 Peasant9 - 15 Peasant10 - 16 Peasant11 - 17 Peasant12 - 18 Peasant13 - 19 Peasant14 - 20 Peasant15 - 21 Peasant16 - 22 Peasant17 - 23 Peasant18 - 24 Peasant19 - 25 Peasant20 - 26 Peasant21 - 27 Peasant22 - 28 Zombie - 29 AcolyteToBe - 30 ZombieSpawner - 31 Tank1 - 32 Tank2 - 33 Tank3 - 34 Tank4 - 35 Tank5 - 36 Tank6 - 37 KneelingGuy - 38 Beggar1 - 39 Beggar2 - 40 Beggar3 - 41 Beggar4 - 42 Beggar5 - 43 Rebel1 - 44 Rebel2 - 45 Rebel3 - 46 Rebel4 - 47 Rebel5 - 48 Rebel6 - 49 Macil1 - 50 Macil2 - 51 RocketTrail - 52 Reaver - 53 AcolyteTan - 54 AcolyteRed - 55 AcolyteRust - 56 AcolyteGray - 57 AcolyteDGreen - 58 AcolyteGold - 59 AcolyteLGreen - 60 AcolyteBlue - 61 AcolyteShadow - 62 Templar - 63 Crusader - 64 StrifeBishop - 65 Oracle - 66 Loremaster (aka Priest) - 67 AlienSpectre1 - 68 AlienChunkSmall - 69 AlienChunkLarge - 70 AlienSpectre2 - 71 AlienSpectre3 - 72 AlienSpectre4 - 73 AlienSpectre5 - 74 EntityBoss - 75 EntitySecond - 76 EntityNest - 77 EntityPod - 78 SpectralLightningH1 - 79 SpectralLightningH2 - 80 SpectralLightningBall1 - 81 SpectralLightningBall2 - 82 SpectralLightningH3 - 83 SpectralLightningHTail - 84 SpectralLightningBigBall1 - 85 SpectralLightningBigBall2 - 86 SpectralLightningV1 - 87 SpectralLightningV2 - 88 SpectralLightningSpot - 89 SpectralLightningBigV1 - 90 SpectralLightningBigV2 - 91 Sentinel - 92 Stalker - 93 Inquisitor - 94 InquisitorArm - 95 Programmer - 96 ProgrammerBase - 97 LoreShot - 98 LoreShot2 - 99 MiniMissile - 100 CrusaderMissile - 101 BishopMissile - 102 ElectricBolt - 103 PoisonBolt - 104 SentinelFX1 - 105 SentinelFX2 - 106 HEGrenade - 107 PhosphorousGrenade - 108 InquisitorShot - 109 PhosphorousFire - 110 MaulerTorpedo - 111 MaulerTorpedoWave - 112 FlameMissile - 113 FastFlameMissile - 114 MaulerPuff - 115 StrifePuff - 116 StrifeSpark - 117 Blood - 118 TeleportFog - 119 ItemFog - 120 teleport destination - 121 KlaxonWarningLight - 122 CeilingTurret - 123 Piston - 124 Computer - 125 MedPatch - 126 MedicalKit - 127 SurgeryKit - 128 DegninOre - 129 MetalArmor - 130 LeatherArmor - 131 WaterBottle - 132 Mug - 133 BaseKey - 134 GovsKey - 135 Passcard - 136 IDBadge - 137 PrisonKey - 138 SeveredHand - 139 Power1Key - 140 Power2Key - 141 Power3Key - 142 GoldKey - 143 IDCard - 144 SilverKey - 145 OracleKey - 146 MilitaryID - 147 OrderKey - 148 WarehouseKey - 149 BrassKey - 150 RedCrystalKey - 151 BlueCrystalKey - 152 ChapelKey - 153 CatacombKey - 154 SecurityKey - 155 CoreKey - 156 MaulerKey - 157 FactoryKey - 158 MineKey - 159 NewKey5 - 160 ShadowArmor - 161 EnvironmentalSuit - 162 GuardUniform - 163 OfficersUniform - 164 StrifeMap - 165 Scanner - 166 - 167 Targeter - 168 Coin - 169 Gold10 - 170 Gold25 - 171 Gold50 - 172 Gold300 - 173 BeldinsRing - 174 OfferingChalice - 175 Ear - 176 Communicator - 177 HEGrenadeRounds - 178 PhosphorusGrenadeRounds - 179 ClipOfBullets - 180 BoxOfBullets - 181 MiniMissiles - 182 CrateOfMissiles - 183 EnergyPod - 184 EnergyPack - 185 PoisonBolts - 186 ElectricBolts - 187 AmmoSatchel - 188 AssaultGun - 189 AssaultGunStanding - 190 FlameThrower - 191 FlameThrowerParts - 192 MiniMissileLauncher - 193 Mauler - 194 StrifeCrossbow - 195 StrifeGrenadeLauncher - 196 Sigil1 - 197 Sigil2 - 198 Sigil3 - 199 Sigil4 - 200 Sigil5 - 201 PowerCrystal - 202 RatBuddy - 203 WoodenBarrel - 204 ExplosiveBarrel2 - 205 TargetPractice - 206 LightSilverFluorescent - 207 LightBrownFluorescent - 208 LightGoldFluorescent - 209 LightGlobe - 210 PillarTechno - 211 PillarAztec - 212 PillarAztecDamaged - 213 PillarAztecRuined - 214 PillarHugeTech - 215 PillarAlienPower - 216 SStalactiteBig - 217 SStalactiteSmall - 218 SStalagmiteBig - 219 CavePillarTop - 220 CavePillarBottom - 221 SStalagmiteSmall - 222 Candle - 223 StrifeCandelabra - 224 WaterDropOnFloor - 225 WaterfallSplash - 226 WaterDrip - 227 WaterFountain - 228 HeartsInTank - 229 TeleportSwirl - 230 DeadCrusader - 231 DeadStrifePlayer - 232 DeadPeasant - 233 DeadAcolyte - 234 DeadReaver - 235 DeadRebel - 236 SacrificedGuy - 237 PileOfGuts - 238 StrifeBurningBarrel - 239 BurningBowl - 240 BurningBrazier - 241 SmallTorchLit - 242 SmallTorchUnlit - 243 CeilingChain - 244 CageLight - 245 Statue - 246 StatueRuined - 247 MediumTorch - 248 OutsideLamp - 249 PoleLantern - 250 SRock1 - 251 SRock2 - 252 SRock3 - 253 SRock4 - 254 StickInWater - 255 Rubble1 - 256 Rubble2 - 257 Rubble3 - 258 Rubble4 - 259 Rubble5 - 260 Rubble6 - 261 Rubble7 - 262 Rubble8 - 263 SurgeryCrab - 264 LargeTorch - 265 HugeTorch - 266 PalmTree - 267 BigTree2 - 268 PottedTree - 269 TreeStub - 270 ShortBush - 271 TallBush - 272 ChimneyStack - 273 BarricadeColumn - 274 Pot - 275 Pitcher - 276 Stool - 277 MetalPot - 278 Tub - 279 Anvil - 280 TechLampSilver - 281 TechLampBrass - 282 Tray - 283 AmmoFiller - 284 SigilBanner - 285 RebelBoots - 286 RebelHelmet - 287 RebelShirt - 288 PowerCoupling - 289 BrokenPowerCoupling - 290 AlienBubbleColumn - 291 AlienFloorBubble - 292 AlienCeilingBubble - 293 AlienAspClimber - 294 AlienSpiderLight - 295 Meat - 296 Junk - 297 FireDroplet - 298 AmmoFillup - 299 HealthFillup - 300 Info - 301 RaiseAlarm - 302 OpenDoor222 - 303 CloseDoor222 - 304 PrisonPass - 305 OpenDoor224 - 306 UpgradeStamina - 307 UpgradeAccuracy - 308 InterrogatorReport (seems to be unused) - 309 HealthTraining - 310 GunTraining - 311 OraclePass - 312 QuestItem1 - 313 QuestItem2 - 314 QuestItem3 - 315 QuestItem4 - 316 QuestItem5 - 317 QuestItem6 - 318 QuestItem7 - 319 QuestItem8 - 320 QuestItem9 - 321 QuestItem10 - 322 QuestItem11 - 323 QuestItem12 - 324 QuestItem13 - 325 QuestItem14 - 326 QuestItem15 - 327 QuestItem16 - 328 QuestItem17 - 329 QuestItem18 - 330 QuestItem19 - 331 QuestItem20 - 332 QuestItem21 - 333 QuestItem22 - 334 QuestItem23 - 335 QuestItem24 - 336 QuestItem25 - 337 QuestItem26 - 338 QuestItem27 - 339 QuestItem28 - 340 QuestItem29 - 341 QuestItem30 - 342 QuestItem31 - 343 SlideshowStarter -*/ - static FRandom pr_gibtosser ("GibTosser"); // Force Field Guard -------------------------------------------------------- @@ -564,8 +216,8 @@ void APowerCoupling::Die (AActor *source, AActor *inflictor, int dmgflags) { P_NoiseAlert (source, this); } - EV_DoDoor (DDoor::doorClose, NULL, players[i].mo, 225, 2*FRACUNIT, 0, 0, 0); - EV_DoFloor (DFloor::floorLowerToHighest, NULL, 44, FRACUNIT, 0, -1, 0, false); + EV_DoDoor (DDoor::doorClose, NULL, players[i].mo, 225, 2., 0, 0, 0); + EV_DoFloor (DFloor::floorLowerToHighest, NULL, 44, 1., 0., -1, 0, false); players[i].mo->GiveInventoryType (QuestItemClasses[5]); S_Sound (CHAN_VOICE, "svox/voc13", 1, ATTN_NORM); players[i].SetLogNumber (13); @@ -599,7 +251,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossGib) PARAM_ACTION_PROLOGUE; const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat"; - AActor *gib = Spawn (gibtype, self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); + AActor *gib = Spawn (gibtype, self->PosPlusZ(24), ALLOW_REPLACE); if (gib == NULL) { @@ -654,7 +306,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain) sector_t *sec = self->Sector; - if (self->_f_Z() == sec->floorplane.ZatPoint(self) && sec->PortalBlocksMovement(sector_t::floor)) + if (self->Z() == sec->floorplane.ZatPointF(self) && sec->PortalBlocksMovement(sector_t::floor)) { if (sec->special == Damage_InstantDeath) { @@ -714,8 +366,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_DropFire) { PARAM_ACTION_PROLOGUE; - AActor *drop = Spawn("FireDroplet", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); - drop->Vel.Z = -FRACUNIT; + AActor *drop = Spawn("FireDroplet", self->PosPlusZ(24.), ALLOW_REPLACE); + drop->Vel.Z = -1.; P_RadiusAttack (self, self, 64, 64, NAME_Fire, 0); return 0; } diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index f13102010..5eee0827a 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -147,7 +147,7 @@ enum DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_AlertMonsters) { PARAM_ACTION_PROLOGUE; - PARAM_FIXED_OPT(maxdist) { maxdist = 0; } + PARAM_FLOAT_OPT(maxdist) { maxdist = 0; } PARAM_INT_OPT(Flags) { Flags = 0; } AActor * target = NULL; @@ -379,8 +379,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_RocketInFlight) AActor *trail; S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM); - P_SpawnPuff (self, PClass::FindActor("MiniMissilePuff"), self->_f_Pos(), self->_f_angle() - ANGLE_180, 2, PF_HITTHING); - trail = Spawn("RocketTrail", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), 0), ALLOW_REPLACE); + P_SpawnPuff (self, PClass::FindActor("MiniMissilePuff"), self->Pos(), self->Angles.Yaw - 180, self->Angles.Yaw - 180, 2, PF_HITTHING); + trail = Spawn("RocketTrail", self->Vec3Offset(-self->Vel.X, -self->Vel.Y, 0.), ALLOW_REPLACE); if (trail != NULL) { trail->Vel.Z = 1; @@ -547,11 +547,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave) PARAM_ACTION_PROLOGUE; AActor *wavedef = GetDefaultByName("MaulerTorpedoWave"); - fixed_t savedz; + double savedz; self->Angles.Yaw += 180.; // If the torpedo hit the ceiling, it should still spawn the wave - savedz = self->_f_Z(); + savedz = self->Z(); if (wavedef && self->ceilingz < wavedef->Top()) { self->SetZ(self->ceilingz - wavedef->Height); @@ -562,7 +562,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave) self->Angles.Yaw += 4.5; P_SpawnSubMissile (self, PClass::FindActor("MaulerTorpedoWave"), self->target); } - self->_f_SetZ(savedz); + self->SetZ(savedz); return 0; } @@ -639,7 +639,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination) if (!(self->flags & MF_DROPPED)) { // Original x and y offsets seemed to be like this: - // x + (((pr_phburn() + 12) & 31) << FRACBITS); + // x + (((pr_phburn() + 12) & 31) << F.RACBITS); // // But that creates a lop-sided burn because it won't use negative offsets. int xofs, xrand = pr_phburn(); @@ -658,19 +658,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination) yofs = -yofs; } - fixedvec2 pos = self->Vec2Offset(xofs << FRACBITS, yofs << FRACBITS); - sector_t * sector = P_PointInSector(pos.x, pos.y); + DVector2 pos = self->Vec2Offset((double)xofs, (double)yofs); + sector_t * sector = P_PointInSector(pos); // The sector's floor is too high so spawn the flame elsewhere. - if (sector->floorplane.ZatPoint(pos.x, pos.y) > self->_f_Z() + self->MaxStepHeight) + if (sector->floorplane.ZatPoint(pos) > self->Z() + self->MaxStepHeight) { - pos.x = self->_f_X(); - pos.y = self->_f_Y(); + pos = self->Pos(); } - AActor *drop = Spawn ( - pos.x, pos.y, - self->_f_Z() + 4*FRACUNIT, ALLOW_REPLACE); + AActor *drop = Spawn (pos.X, pos.Y, self->Z() + 4., ALLOW_REPLACE); if (drop != NULL) { drop->Vel.X = self->Vel.X + pr_phburn.Random2 (7); @@ -693,13 +690,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade) { PARAM_ACTION_PROLOGUE; PARAM_CLASS(grenadetype, AActor); - PARAM_ANGLE(angleofs); + PARAM_DANGLE(angleofs); PARAM_STATE(flash) player_t *player = self->player; AActor *grenade; - angle_t an; - fixed_t tworadii; + DAngle an; AWeapon *weapon; if (player == NULL || grenadetype == NULL) @@ -715,9 +711,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade) if (grenadetype != NULL) { - self->_f_AddZ(32*FRACUNIT); + self->AddZ(32); grenade = P_SpawnSubMissile (self, grenadetype, self); - self->_f_AddZ(-32*FRACUNIT); + self->AddZ(-32); if (grenade == NULL) return 0; @@ -728,20 +724,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade) grenade->Vel.Z = (-self->Angles.Pitch.TanClamped()) * grenade->Speed + 8; - fixedvec2 offset; - - an = self->_f_angle() >> ANGLETOFINESHIFT; - tworadii = self->_f_radius() + grenade->_f_radius(); - offset.x = FixedMul (finecosine[an], tworadii); - offset.y = FixedMul (finesine[an], tworadii); - - an = self->_f_angle() + angleofs; - an >>= ANGLETOFINESHIFT; - offset.x += FixedMul (finecosine[an], 15*FRACUNIT); - offset.y += FixedMul (finesine[an], 15*FRACUNIT); - - fixedvec2 newpos = grenade->Vec2Offset(offset.x, offset.y); - grenade->SetOrigin(newpos.x, newpos.y, grenade->_f_Z(), false); + DVector2 offset = self->Angles.Yaw.ToVector(self->radius + grenade->radius); + DAngle an = self->Angles.Yaw + angleofs; + offset += an.ToVector(15); + grenade->SetOrigin(grenade->Vec3Offset(offset.X, offset.Y, 0.), false); } return 0; } @@ -995,7 +981,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1) } else { - spot = Spawn("SpectralLightningSpot", self->_f_Pos(), ALLOW_REPLACE); + spot = Spawn("SpectralLightningSpot", self->Pos(), ALLOW_REPLACE); if (spot != NULL) { spot->VelFromAngle(self->Angles.Yaw, 28.); diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index 3042623a3..1dc72b118 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -18,9 +18,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud) { PARAM_ACTION_PROLOGUE; - fixed_t xo = (pr_bang4cloud.Random2() & 3) * 10240; - fixed_t yo = (pr_bang4cloud.Random2() & 3) * 10240; - Spawn("Bang4Cloud", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE); + double xo = (pr_bang4cloud.Random2() & 3) * (10. / 64); + double yo = (pr_bang4cloud.Random2() & 3) * (10. / 64); + Spawn("Bang4Cloud", self->Vec3Offset(xo, yo, 0.), ALLOW_REPLACE); return 0; } diff --git a/src/g_strife/strife_sbar.cpp b/src/g_strife/strife_sbar.cpp index 0b58832f7..dfdd9dbb5 100644 --- a/src/g_strife/strife_sbar.cpp +++ b/src/g_strife/strife_sbar.cpp @@ -327,7 +327,7 @@ private: if (ItemFlash > 0) { - ItemFlash -= FRACUNIT/14; + ItemFlash -= 1/14.; if (ItemFlash < 0) { ItemFlash = 0; @@ -379,7 +379,7 @@ private: void FlashItem (const PClass *itemtype) { - ItemFlash = FRACUNIT*3/4; + ItemFlash = 0.75; } void DrawMainBar () @@ -454,7 +454,7 @@ private: screen->DrawTexture (Images[CursorImage], 42 + 35*i + ST_X, 12 + ST_Y, DTA_Bottom320x200, Scaled, - DTA_Alpha, OPAQUE - ItemFlash, + DTA_AlphaF, 1. - ItemFlash, TAG_DONE); } if (item->Icon.isValid()) @@ -526,7 +526,7 @@ private: DTA_HUDRules, HUD_Normal, DTA_LeftOffset, cursor->GetWidth(), DTA_TopOffset, cursor->GetHeight(), - DTA_Alpha, ItemFlash, + DTA_AlphaF, ItemFlash, TAG_DONE); } DrINumberOuter (CPlayer->mo->InvSel->Amount, -51, -10, false, 7); @@ -583,7 +583,7 @@ private: left = screen->GetWidth()/2 - 160*CleanXfac; top = bottom + height * yscale; - screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_Alpha, FRACUNIT*3/4, TAG_DONE); + screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_AlphaF, 0.75, TAG_DONE); screen->DrawTexture (Images[bars], left, top, DTA_CleanNoMove, true, TAG_DONE); @@ -847,7 +847,7 @@ private: int CursorImage; int CurrentPop, PendingPop, PopHeight, PopHeightChange; int KeyPopPos, KeyPopScroll; - fixed_t ItemFlash; + double ItemFlash; }; IMPLEMENT_CLASS(DStrifeStatusBar); diff --git a/src/gi.cpp b/src/gi.cpp index 405e42ce7..7881c0006 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -133,6 +133,13 @@ const char* GameInfoBorders[] = gameinfo.key = static_cast (sc.Float); \ } +#define GAMEINFOKEY_DOUBLE(key, variable) \ + else if(nextKey.CompareNoCase(variable) == 0) \ + { \ + sc.MustGetFloat(); \ + gameinfo.key = sc.Float; \ + } + #define GAMEINFOKEY_FIXED(key, variable) \ else if(nextKey.CompareNoCase(variable) == 0) \ { \ @@ -310,7 +317,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_STRING(PauseSign, "pausesign") GAMEINFOKEY_STRING(quitSound, "quitSound") GAMEINFOKEY_STRING(BorderFlat, "borderFlat") - GAMEINFOKEY_FIXED(telefogheight, "telefogheight") + GAMEINFOKEY_DOUBLE(telefogheight, "telefogheight") GAMEINFOKEY_FIXED(gibfactor, "gibfactor") GAMEINFOKEY_INT(defKickback, "defKickback") GAMEINFOKEY_STRING(SkyFlatName, "SkyFlatName") diff --git a/src/gi.h b/src/gi.h index 8bdfc7e3e..07839cacd 100644 --- a/src/gi.h +++ b/src/gi.h @@ -138,7 +138,7 @@ struct gameinfo_t fixed_t Armor2Percent; FString quitSound; gameborder_t Border; - int telefogheight; + double telefogheight; int defKickback; FString translator; DWORD defaultbloodcolor; diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 14ec62eb5..db98330ee 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -811,7 +811,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li highestfloorsec = j == 0 ? linedef->frontsector : linedef->backsector; highestfloorplanes[j] = rover->top.plane; } - if(ff_top > lowestfloor[j] && ff_top <= thing->_f_Z() + thing->MaxStepHeight) lowestfloor[j] = ff_top; + if(ff_top > lowestfloor[j] && ff_top <= thing->_f_Z() + thing->_f_MaxStepHeight()) lowestfloor[j] = ff_top; } } diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index eeef7e7fe..ffeb32e6f 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -299,7 +299,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening & } // returns true if it touches the midtexture - return (abs(thing->_f_Z() - tt) <= thing->MaxStepHeight); + return (abs(thing->_f_Z() - tt) <= thing->_f_MaxStepHeight()); } } return false; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index b5e160f24..dbfe1db29 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4214,7 +4214,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b if (floor) { - actor->Sector->NextLowestFloorAt(actor->_f_X(), actor->_f_Y(), actor->_f_Z(), 0, actor->MaxStepHeight, &resultsec, &resffloor); + actor->Sector->NextLowestFloorAt(actor->_f_X(), actor->_f_Y(), actor->_f_Z(), 0, actor->_f_MaxStepHeight(), &resultsec, &resffloor); secpic = resffloor ? *resffloor->top.texture : resultsec->planes[sector_t::floor].Texture; } else diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index d7e827c55..a1e5d063d 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -576,7 +576,7 @@ bool P_Move (AActor *actor) !((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP)) && actor->Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ)) { - if (actor->_f_Z() <= actor->_f_floorz() + actor->MaxStepHeight) + if (actor->Z() <= actor->floorz + actor->MaxStepHeight) { double savedz = actor->Z(); actor->SetZ(actor->floorz); diff --git a/src/p_enemy.h b/src/p_enemy.h index 797d468ee..467e74eba 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -50,6 +50,11 @@ void P_DaggerAlert (AActor *target, AActor *emitter); void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter=NULL, fixed_t maxdist=0); bool P_HitFriend (AActor *self); void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false, fixed_t maxdist=0); +inline void P_NoiseAlert(AActor *target, AActor *emmiter, bool splash, double maxdist) +{ + P_NoiseAlert(target, emmiter, splash, FLOAT2FIXED(maxdist)); +} + bool P_CheckMeleeRange2 (AActor *actor); bool P_Move (AActor *actor); bool P_TryWalk (AActor *actor); diff --git a/src/p_local.h b/src/p_local.h index d54ef162b..6f33acc3f 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -189,6 +189,10 @@ inline AActor *P_SpawnMissileAngleZSpeed(AActor *source, double z, PClassActor * 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); diff --git a/src/p_map.cpp b/src/p_map.cpp index 6d3d201fd..318f2b95f 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -292,7 +292,7 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags) F3DFloor *ffc, *fff; tmf.ceilingz = FIXED2DBL(sec->NextHighestCeilingAt(tmf.x, tmf.y, tmf.z, tmf.z + tmf.thing->_f_height(), flags, &tmf.ceilingsector, &ffc)); - tmf.dropoffz = sec->NextLowestFloorAt(tmf.x, tmf.y, tmf.z, flags, tmf.thing->MaxStepHeight, &tmf.floorsector, &fff); + tmf.dropoffz = sec->NextLowestFloorAt(tmf.x, tmf.y, tmf.z, flags, tmf.thing->_f_MaxStepHeight(), &tmf.floorsector, &fff); tmf.floorz = FIXED2DBL(tmf.dropoffz); if (fff) @@ -1224,7 +1224,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch { // [RH] Let monsters walk on actors as well as floors if ((tm.thing->flags3 & MF3_ISMONSTER) && - topz >= tm._f_floorz() && topz <= tm.thing->_f_Z() + tm.thing->MaxStepHeight) + topz >= tm._f_floorz() && topz <= tm.thing->_f_Z() + tm.thing->_f_MaxStepHeight()) { // The commented-out if is an attempt to prevent monsters from walking off a // thing further than they would walk off a ledge. I can't think of an easy @@ -1549,7 +1549,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch // [RH] The next condition is to compensate for the extra height // that gets added by P_CheckPosition() so that you cannot pick // up things that are above your true height. - && thing->_f_Z() < tm.thing->_f_Top() - tm.thing->MaxStepHeight) + && thing->Z() < tm.thing->Top() - tm.thing->MaxStepHeight) { // Can be picked up by tmthing P_TouchSpecialThing(thing, tm.thing); // can remove thing } @@ -1645,7 +1645,7 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo thingblocker = NULL; if (thing->player) { // [RH] Fake taller height to catch stepping up into things. - thing->Height = realHeight + FIXED2DBL(thing->MaxStepHeight); + thing->Height = realHeight + thing->MaxStepHeight; } tm.stepthing = NULL; @@ -1671,17 +1671,17 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo return false; } else if (!BlockingMobj->player && !(thing->flags & (MF_FLOAT | MF_MISSILE | MF_SKULLFLY)) && - BlockingMobj->_f_Top() - thing->_f_Z() <= thing->MaxStepHeight) + BlockingMobj->Top() - thing->Z() <= thing->MaxStepHeight) { if (thingblocker == NULL || - BlockingMobj->_f_Z() > thingblocker->_f_Z()) + BlockingMobj->Z() > thingblocker->Z()) { thingblocker = BlockingMobj; } thing->BlockingMobj = NULL; } else if (thing->player && - thing->_f_Top() - BlockingMobj->_f_Z() <= thing->MaxStepHeight) + thing->Top() - BlockingMobj->Z() <= thing->MaxStepHeight) { if (thingblocker) { // There is something to step up on. Return this thing as @@ -2054,8 +2054,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, { goto pushline; } - else if (BlockingMobj->_f_Top() - thing->_f_Z() > thing->MaxStepHeight - || (BlockingMobj->Sector->ceilingplane.ZatPoint(x, y) - (BlockingMobj->_f_Top()) < thing->_f_height()) + else if (BlockingMobj->Top() - thing->Z() > thing->MaxStepHeight + || (BlockingMobj->Sector->ceilingplane._f_ZatPointF(x, y) - (BlockingMobj->Top()) < thing->Height) || (tm.ceilingz - (BlockingMobj->Top()) < thing->Height)) { goto pushline; @@ -2124,7 +2124,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, { // [RH] Don't let normal missiles climb steps goto pushline; } - if (tm._f_floorz() - thing->_f_Z() > thing->MaxStepHeight) + if (tm.floorz - thing->Z() > thing->MaxStepHeight) { // too big a step up goto pushline; } @@ -2569,7 +2569,7 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y) } if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER)) { - if (tm._f_floorz() - newz > thing->MaxStepHeight) + if (tm._f_floorz() - newz > thing->_f_MaxStepHeight()) { // too big a step up return false; } @@ -3034,7 +3034,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov fixed_t thisplanez = rover->top.plane->ZatPoint(pos); - if (thisplanez>planezhere && thisplanez <= actor->_f_Z() + actor->MaxStepHeight) + if (thisplanez>planezhere && thisplanez <= actor->_f_Z() + actor->_f_MaxStepHeight()) { copyplane = *rover->top.plane; if (copyplane.c<0) copyplane.FlipVert(); @@ -3052,7 +3052,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov fixed_t thisplanez = rover->top.plane->ZatPoint(actor); - if (thisplanez>planezhere && thisplanez <= actor->_f_Z() + actor->MaxStepHeight) + if (thisplanez>planezhere && thisplanez <= actor->_f_Z() + actor->_f_MaxStepHeight()) { copyplane = *rover->top.plane; if (copyplane.c<0) copyplane.FlipVert(); @@ -3107,7 +3107,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov pos.x += xmove; pos.y += ymove; - if (sec->floorplane.ZatPoint(pos) >= actor->_f_Z() - actor->MaxStepHeight) + if (sec->floorplane.ZatPoint(pos) >= actor->_f_Z() - actor->_f_MaxStepHeight()) { dopush = false; break; @@ -5086,7 +5086,7 @@ bool P_NoWayTraverse(AActor *usething, fixed_t startx, fixed_t starty, fixed_t e if (ld->flags&(ML_BLOCKING | ML_BLOCKEVERYTHING | ML_BLOCK_PLAYERS)) return true; P_LineOpening(open, NULL, ld, it.InterceptPoint(in)); if (open.range <= 0 || - open.bottom > usething->_f_Z() + usething->MaxStepHeight || + open.bottom > usething->_f_Z() + usething->_f_MaxStepHeight() || open.top < usething->_f_Top()) return true; } return false; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 1450f202c..c7090f60d 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2701,7 +2701,7 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj) if (mo->player->mo == mo) { - mo->player->deltaviewheight = mo->_f_velz() >> 3; + mo->player->deltaviewheight = mo->Vel.Z / 8.; } if (mo->player->cheats & CF_PREDICTING) @@ -2826,7 +2826,7 @@ void P_NightmareRespawn (AActor *mobj) P_SpawnTeleportFog(mobj, mobj->PosPlusZ(TELEFOGHEIGHT), true, true); // spawn a teleport fog at the new spot - P_SpawnTeleportFog(mobj, x, y, z + TELEFOGHEIGHT, false, true); + P_SpawnTeleportFog(mobj, FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z) + TELEFOGHEIGHT, false, true); // remove the old monster mobj->Destroy (); @@ -3745,7 +3745,7 @@ void AActor::Tick () const sector_t *sec = node->m_sector; if (sec->floorplane.c >= STEEPSLOPE) { - if (floorplane.ZatPoint (PosRelative(node->m_sector)) >= _f_Z() - MaxStepHeight) + if (floorplane.ZatPoint (PosRelative(node->m_sector)) >= _f_Z() - _f_MaxStepHeight()) { dopush = false; break; @@ -3810,12 +3810,12 @@ void AActor::Tick () PlayerLandedOnThing (this, onmo); } } - if (onmo->_f_Top() - _f_Z() <= MaxStepHeight) + if (onmo->Top() - Z() <= MaxStepHeight) { if (player && player->mo == this) { player->viewheight -= onmo->_f_Top() - _f_Z(); - fixed_t deltaview = player->GetDeltaViewHeight(); + double deltaview = player->GetDeltaViewHeight(); if (deltaview > player->deltaviewheight) { player->deltaviewheight = deltaview; @@ -4780,8 +4780,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) if (multiplayer) { - unsigned an = mobj->_f_angle() >> ANGLETOFINESHIFT; - Spawn ("TeleportFog", mobj->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE); + Spawn ("TeleportFog", mobj->Vec3Angle(20, mobj->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE); } // "Fix" for one of the starts on exec.wad MAP01: If you start inside the ceiling, diff --git a/src/p_spec.h b/src/p_spec.h index 5496e9ef5..1148dfa6b 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -801,6 +801,11 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, int usespecials); bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, fixed_t speed, fixed_t height, int crush, int change, bool hexencrush, bool hereticlower=false); +inline bool EV_DoFloor(DFloor::EFloor floortype, line_t *line, int tag, + double speed, double height, int crush, int change, bool hexencrush, bool hereticlower = false) +{ + return EV_DoFloor(floortype, line, tag, FLOAT2FIXED(speed), FLOAT2FIXED(height), crush, change, hexencrush, hereticlower); +} bool EV_FloorCrushStop (int tag); bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed); @@ -928,6 +933,10 @@ inline void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTel { P_SpawnTeleportFog(mobj, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), beforeTele, setTarget); } +inline void P_SpawnTeleportFog(AActor *mobj, double x, double y, double z, bool beforeTele = true, bool setTarget = false) +{ + P_SpawnTeleportFog(mobj, FLOAT2FIXED(x), FLOAT2FIXED(y), FLOAT2FIXED(z), beforeTele, setTarget); +} bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, int flags); // bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false inline bool P_Teleport(AActor *thing, const DVector3 &pos, DAngle angle, int flags) { diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 61eb73dc7..1441ae39b 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -191,10 +191,10 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, i { if (!predicting) { - fixed_t fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT; - fixedvec2 vector = Vec2Angle(20 * FRACUNIT, angle); - fixedvec2 fogpos = P_GetOffsetPosition(x, y, vector.x, vector.y); - P_SpawnTeleportFog(thing, fogpos.x, fogpos.y, thing->_f_Z() + fogDelta, false, true); + double fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT; + DVector2 vector = angle.ToVector(20); + DVector2 fogpos = P_GetOffsetPosition(FIXED2DBL(x), FIXED2DBL(y), vector.X, vector.Y); + P_SpawnTeleportFog(thing, fogpos.X, fogpos.Y, thing->Z() + fogDelta, false, true); } if (thing->player) @@ -560,7 +560,7 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO player->Vel.Y = p.Y*c + p.X*s; // Save the current deltaviewheight, used in stepping - fixed_t deltaviewheight = player->deltaviewheight; + double deltaviewheight = player->deltaviewheight; // Clear deltaviewheight, since we don't want any changes now player->deltaviewheight = 0; diff --git a/src/p_things.cpp b/src/p_things.cpp index 35560af6c..032ae9075 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -86,7 +86,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, i } while (spot != NULL) { - mobj = Spawn (kind, spot->_f_Pos(), ALLOW_REPLACE); + mobj = Spawn (kind, spot->Pos(), ALLOW_REPLACE); if (mobj != NULL) { @@ -98,7 +98,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, i mobj->Angles.Yaw = (angle != 1000000. ? angle : spot->Angles.Yaw); if (fog) { - P_SpawnTeleportFog(mobj, spot->_f_X(), spot->_f_Y(), spot->_f_Z() + TELEFOGHEIGHT, false, true); + P_SpawnTeleportFog(mobj, spot->PosPlusZ(TELEFOGHEIGHT), false, true); } if (mobj->flags & MF_SPECIAL) mobj->flags |= MF_DROPPED; // Don't respawn diff --git a/src/p_user.cpp b/src/p_user.cpp index f801ff866..2409a7475 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1879,7 +1879,7 @@ void P_CalcHeight (player_t *player) // move viewheight if (player->playerstate == PST_LIVE) { - player->viewheight += player->deltaviewheight; + player->viewheight += FLOAT2FIXED(player->deltaviewheight); if (player->viewheight > defaultviewheight) { @@ -1890,14 +1890,14 @@ void P_CalcHeight (player_t *player) { player->viewheight = defaultviewheight>>1; if (player->deltaviewheight <= 0) - player->deltaviewheight = 1; + player->deltaviewheight = 1 / 65536.; } if (player->deltaviewheight) { - player->deltaviewheight += FRACUNIT/4; + player->deltaviewheight += 0.25; if (!player->deltaviewheight) - player->deltaviewheight = 1; + player->deltaviewheight = 1/65536.; } } diff --git a/src/portal.h b/src/portal.h index 4fe89a3c6..582695f06 100644 --- a/src/portal.h +++ b/src/portal.h @@ -217,4 +217,11 @@ void P_NormalizeVXVY(fixed_t& vx, fixed_t& vy); fixed_t P_PointLineDistance(line_t* line, fixed_t x, fixed_t y); fixedvec2 P_GetOffsetPosition(fixed_t x, fixed_t y, fixed_t dx, fixed_t dy); +inline DVector2 P_GetOffsetPosition(double x, double y, double dx, double dy) +{ + fixedvec2 v = P_GetOffsetPosition(FLOAT2FIXED(x), FLOAT2FIXED(y), FLOAT2FIXED(dx), FLOAT2FIXED(dy)); + return{ FIXED2DBL(v.x), FIXED2DBL(v.y) }; +} + + #endif \ No newline at end of file diff --git a/src/r_defs.h b/src/r_defs.h index 4e7e1a504..0eb374c6f 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -264,12 +264,22 @@ struct secplane_t return FixedMul (ic, -d - DMulScale16 (a, x, b, y)); } + double _f_ZatPointF(fixed_t x, fixed_t y) const + { + return FIXED2DBL(FixedMul(ic, -d - DMulScale16(a, x, b, y))); + } + // Returns the value of z at (x,y) as a double double ZatPoint (double x, double y) const { return (d + a*x + b*y) * ic / (-65536.0 * 65536.0); } + double ZatPoint(const DVector2 &pos) const + { + return (d + a*pos.X + b*pos.Y) * ic / (-65536.0 * 65536.0); + } + // Returns the value of z at vertex v fixed_t ZatPoint (const vertex_t *v) const { @@ -1294,6 +1304,11 @@ inline sector_t *P_PointInSector(fixed_t x, fixed_t y) return P_PointInSubsector(x, y)->sector; } +inline sector_t *P_PointInSector(const DVector2 &pos) +{ + return P_PointInSubsector(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y))->sector; +} + inline fixedvec3 AActor::PosRelative(int portalgroup) const { return __pos + Displacements.getOffset(Sector->PortalGroup, portalgroup); diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 8fba15fba..270ac19ce 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -1247,7 +1247,7 @@ DEFINE_PROPERTY(decal, S, Actor) //========================================================================== DEFINE_PROPERTY(maxstepheight, F, Actor) { - PROP_FIXED_PARM(i, 0); + PROP_DOUBLE_PARM(i, 0); defaults->MaxStepHeight = i; }