From cf79e1cb6dc8f5c21226f1808d2b186f185dbe89 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 22 Mar 2016 00:30:56 +0100 Subject: [PATCH] - fixed some leftover fixed point remnants in g_hexen. - made the full-coordinate version of P_SpawnPlayerMissile use float coordinates. --- src/g_hexen/a_fighterquietus.cpp | 12 ++++++------ src/g_hexen/a_flechette.cpp | 13 ++++--------- src/g_hexen/a_fog.cpp | 2 +- src/g_hexen/a_magestaff.cpp | 2 +- src/g_hexen/a_wraith.cpp | 2 +- src/p_local.h | 4 +++- src/p_mobj.cpp | 16 ++++++++-------- src/thingdef/thingdef_codeptr.cpp | 12 +++++------- wadsrc/static/actors/shared/inventory.txt | 2 +- 9 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp index af75f82d8..27e787d31 100644 --- a/src/g_hexen/a_fighterquietus.cpp +++ b/src/g_hexen/a_fighterquietus.cpp @@ -36,7 +36,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces) PClassActor *cls = j == 0 ? p1 : j == 1 ? p2 : p3; if (cls) { - AActor *piece = Spawn (cls, self->_f_Pos(), ALLOW_REPLACE); + AActor *piece = Spawn (cls, self->Pos(), ALLOW_REPLACE); if (piece != NULL) { piece->Vel = self->Vel + DAngle(i*120.).ToVector(1); @@ -92,11 +92,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FSwordAttack) if (!weapon->DepleteAmmo (weapon->bAltFire)) return 0; } - P_SpawnPlayerMissile (self, 0, 0, -10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./4)); - P_SpawnPlayerMissile (self, 0, 0, -5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./8)); - P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw); - P_SpawnPlayerMissile (self, 0, 0, 5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./8)); - P_SpawnPlayerMissile (self, 0, 0, 10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./4)); + P_SpawnPlayerMissile (self, 0, 0, -10, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./4)); + P_SpawnPlayerMissile (self, 0, 0, -5, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./8)); + P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw); + P_SpawnPlayerMissile (self, 0, 0, 5, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./8)); + P_SpawnPlayerMissile (self, 0, 0, 10, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./4)); S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM); return 0; } diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index 08798755e..ccc2bf112 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -39,10 +39,7 @@ IMPLEMENT_CLASS (AArtiPoisonBag1) bool AArtiPoisonBag1::Use (bool pickup) { - angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT; - AActor *mo; - - mo = Spawn("PoisonBag", Owner->Vec3Offset( + AActor *mo = Spawn("PoisonBag", Owner->Vec3Offset( 16 * Owner->Angles.Yaw.Cos(), 24 * Owner->Angles.Yaw.Sin(), -Owner->Floorclip + 8), ALLOW_REPLACE); @@ -100,9 +97,9 @@ bool AArtiPoisonBag3::Use (bool pickup) mo->Angles.Yaw = Owner->Angles.Yaw + (((pr_poisonbag() & 7) - 4) * (360./256.)); /* Original flight code from Hexen - * mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4)); - * mo->z += player->lookdir<<(FRACBITS-4); - * P_ThrustMobj(mo, mo->_f_angle(), mo->info->speed); + * mo->momz = 4*F.RACUNIT+((player->lookdir)<<(F.RACBITS-4)); + * mo->z += player->lookdir<<(F.RACBITS-4); + * P_ThrustMobj(mo, mo->angle, mo->info->speed); * mo->momx += player->mo->momx>>1; * mo->momy += player->mo->momy>>1; */ @@ -445,8 +442,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb2) PARAM_ACTION_PROLOGUE; // [RH] Check using actual velocity, although the vel.z < 2 check still stands - //if (abs(self->vel.x) < FRACUNIT*3/2 && abs(self->vel.y) < FRACUNIT*3/2 - // && self->vel.z < 2*FRACUNIT) if (self->Vel.Z < 2 && self->Vel.LengthSquared() < (9./4.)) { self->SetState (self->SpawnState + 6); diff --git a/src/g_hexen/a_fog.cpp b/src/g_hexen/a_fog.cpp index 80aba1bcc..b89f8d38c 100644 --- a/src/g_hexen/a_fog.cpp +++ b/src/g_hexen/a_fog.cpp @@ -37,7 +37,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn) }; AActor *mo = NULL; - angle_t delta; + int delta; if (self->special1-- > 0) { diff --git a/src/g_hexen/a_magestaff.cpp b/src/g_hexen/a_magestaff.cpp index 454a755a4..92724016c 100644 --- a/src/g_hexen/a_magestaff.cpp +++ b/src/g_hexen/a_magestaff.cpp @@ -102,7 +102,7 @@ void MStaffSpawn (AActor *pmo, DAngle angle, AActor *alttarget) AActor *mo; FTranslatedLineTarget t; - mo = P_SpawnPlayerMissile (pmo, 0, 0, 8*FRACUNIT, RUNTIME_CLASS(AMageStaffFX2), angle, &t); + mo = P_SpawnPlayerMissile (pmo, 0, 0, 8, RUNTIME_CLASS(AMageStaffFX2), angle, &t); if (mo) { mo->target = pmo; diff --git a/src/g_hexen/a_wraith.cpp b/src/g_hexen/a_wraith.cpp index 584821d50..24ae22afd 100644 --- a/src/g_hexen/a_wraith.cpp +++ b/src/g_hexen/a_wraith.cpp @@ -65,7 +65,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithRaise) { PARAM_ACTION_PROLOGUE; - if (A_RaiseMobj (self, 2*FRACUNIT)) + if (A_RaiseMobj (self, 2)) { // Reached it's target height // [RH] Once a buried wraith is fully raised, it should be diff --git a/src/p_local.h b/src/p_local.h index f73505d1e..d54ef162b 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -192,9 +192,11 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassAct AActor *P_SpawnPlayerMissile (AActor* source, PClassActor *type); AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type, DAngle angle); -AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, PClassActor *type, DAngle angle, + +AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z, PClassActor *type, DAngle angle, FTranslatedLineTarget *pLineTarget = NULL, AActor **MissileActor = NULL, bool nofreeaim = false, bool noautoaim = false, int aimflags = 0); + void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz, bool oldz_has_viewheight=false); AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target); // Strife uses it diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index f565d994f..1450f202c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -6136,7 +6136,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type, DAngle angle) return P_SpawnPlayerMissile (source, 0, 0, 0, type, angle); } -AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, +AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z, PClassActor *type, DAngle angle, FTranslatedLineTarget *pLineTarget, AActor **pMissileActor, bool nofreeaim, bool noautoaim, int aimflags) { @@ -6195,23 +6195,23 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, if (z != ONFLOORZ && z != ONCEILINGZ) { // Doom spawns missiles 4 units lower than hitscan attacks for players. - z += source->_f_Z() + (source->_f_height()>>1) - source->_f_floorclip(); + z += source->Center() - source->Floorclip; if (source->player != NULL) // Considering this is for player missiles, it better not be NULL. { - z += fixed_t ((source->player->mo->AttackZOffset - 4*FRACUNIT) * source->player->crouchfactor); + z += ((FIXED2DBL(source->player->mo->AttackZOffset) - 4) * source->player->crouchfactor); } else { - z += 4*FRACUNIT; + z += 4; } // Do not fire beneath the floor. - if (z < source->_f_floorz()) + if (z < source->floorz) { - z = source->_f_floorz(); + z = source->floorz; } } - fixedvec2 pos = source->Vec2Offset(x, y); - AActor *MissileActor = Spawn (type, pos.x, pos.y, z, ALLOW_REPLACE); + DVector3 pos = source->Vec2OffsetZ(x, y, z); + AActor *MissileActor = Spawn (type, pos, ALLOW_REPLACE); if (pMissileActor) *pMissileActor = MissileActor; P_PlaySpawnSound(MissileActor, source); MissileActor->target = source; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 46b114fe5..9c6cbb8c3 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1622,8 +1622,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) PARAM_CLASS (ti, AActor); PARAM_DANGLE_OPT(angle) { angle = 0.; } PARAM_BOOL_OPT (useammo) { useammo = true; } - PARAM_INT_OPT (spawnofs_xy) { spawnofs_xy = 0; } - PARAM_FIXED_OPT (spawnheight) { spawnheight = 0; } + PARAM_FLOAT_OPT (spawnofs_xy) { spawnofs_xy = 0; } + PARAM_FLOAT_OPT (spawnheight) { spawnheight = 0; } PARAM_INT_OPT (flags) { flags = 0; } PARAM_DANGLE_OPT(pitch) { pitch = 0.; } @@ -1643,10 +1643,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) if (ti) { - angle_t ang = (self->_f_angle() - ANGLE_90) >> ANGLETOFINESHIFT; - fixed_t x = spawnofs_xy * finecosine[ang]; - fixed_t y = spawnofs_xy * finesine[ang]; - fixed_t z = spawnheight; + DAngle ang = self->Angles.Yaw - 90; + DVector3 ofs = self->Vec3Angle(spawnofs_xy, ang, spawnheight); DAngle shootangle = self->Angles.Yaw; if (flags & FPF_AIMATANGLE) shootangle += angle; @@ -1654,7 +1652,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) // Temporarily adjusts the pitch DAngle saved_player_pitch = self->Angles.Pitch; self->Angles.Pitch -= pitch; - AActor * misl=P_SpawnPlayerMissile (self, x, y, z, ti, shootangle, &t, NULL, false, (flags & FPF_NOAUTOAIM) != 0); + AActor * misl=P_SpawnPlayerMissile (self, ofs.X, ofs.Y, ofs.Z, ti, shootangle, &t, NULL, false, (flags & FPF_NOAUTOAIM) != 0); self->Angles.Pitch = saved_player_pitch; // automatic handling of seeker missiles diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 98a195f01..0d1ea8b92 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -10,7 +10,7 @@ ACTOR Inventory native action native state A_JumpIfNoAmmo(state label); action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class pufftype = "BulletPuff", float range = 0, float lifesteal = 0, int lifestealmax = 0, class armorbonustype = "ArmorBonus", sound MeleeSound = "", sound MissSound = ""); action native A_FireBullets(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", int flags = 1, float range = 0); - action native A_FireCustomMissile(class missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0, float spawnheight = 0, int flags = 0, float pitch = 0); + action native A_FireCustomMissile(class missiletype, float angle = 0, bool useammo = true, float spawnofs_xy = 0, float spawnheight = 0, int flags = 0, float pitch = 0); action native A_RailAttack(int damage, int spawnofs_xy = 0, bool useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270); action native A_Light(int extralight); action native A_Light0();