From 4d22b346f4524074a8e38509734da30d32a05e7a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 24 Mar 2016 23:50:29 +0100 Subject: [PATCH] - floatified the remaining fixed point variables accessible through DECORATE. PROP_FIXED_PARAM is no longer used anywhere. --- src/d_player.h | 10 +++++----- src/p_acs.cpp | 4 ++-- src/p_map.cpp | 14 ++++++-------- src/p_mobj.cpp | 4 ++-- src/p_user.cpp | 12 ++++++------ src/thingdef/thingdef.h | 3 --- src/thingdef/thingdef_codeptr.cpp | 2 +- src/thingdef/thingdef_properties.cpp | 16 ++++++++-------- 8 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 2a2c99027..598ccdd48 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -150,17 +150,17 @@ public: // [GRB] Player class properties double JumpZ; - fixed_t GruntSpeed; - fixed_t FallingScreamMinSpeed, FallingScreamMaxSpeed; + double GruntSpeed; + double FallingScreamMinSpeed, FallingScreamMaxSpeed; double ViewHeight; double ForwardMove1, ForwardMove2; double SideMove1, SideMove2; FTextureID ScoreIcon; int SpawnMask; FNameNoInit MorphWeapon; - fixed_t AttackZOffset; // attack height, relative to player center - fixed_t UseRange; // [NS] Distance at which player can +use - fixed_t AirCapacity; // Multiplier for air supply underwater. + double AttackZOffset; // attack height, relative to player center + double UseRange; // [NS] Distance at which player can +use + double AirCapacity; // Multiplier for air supply underwater. PClassActor *FlechetteType; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 2ca9378aa..f21a5b91a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4014,7 +4014,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) case APROP_AttackZOffset: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) - static_cast(actor)->AttackZOffset = value; + static_cast(actor)->AttackZOffset = ACSToDouble(value); break; case APROP_StencilColor: @@ -4108,7 +4108,7 @@ int DLevelScript::GetActorProperty (int tid, int property) case APROP_AttackZOffset: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) { - return static_cast(actor)->AttackZOffset; + return DoubleToACS(static_cast(actor)->AttackZOffset); } else { diff --git a/src/p_map.cpp b/src/p_map.cpp index c0bfd4cd7..16d6b5dac 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4027,7 +4027,7 @@ DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLin fixed_t shootz = t1->_f_Z() + (t1->_f_height() >> 1) - t1->_f_floorclip(); if (t1->player != NULL) { - shootz += fixed_t(t1->player->mo->AttackZOffset * t1->player->crouchfactor); + shootz += FLOAT2FIXED(t1->player->mo->AttackZOffset * t1->player->crouchfactor); } else { @@ -4172,7 +4172,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, shootz = t1->_f_Z() - t1->_f_floorclip() + (t1->_f_height() >> 1); if (t1->player != NULL) { - shootz += fixed_t(t1->player->mo->AttackZOffset * t1->player->crouchfactor); + shootz += FLOAT2FIXED(t1->player->mo->AttackZOffset * t1->player->crouchfactor); if (damageType == NAME_Melee || damageType == NAME_Hitscan) { // this is coming from a weapon attack function which needs to transfer information to the obituary code, @@ -4433,7 +4433,7 @@ AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch, shootz = t1->_f_Z() - t1->_f_floorclip() + (t1->_f_height() >> 1); if (t1->player != NULL) { - shootz += fixed_t(t1->player->mo->AttackZOffset * t1->player->crouchfactor); + shootz += FLOAT2FIXED(t1->player->mo->AttackZOffset * t1->player->crouchfactor); } else { @@ -4707,7 +4707,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i { if (source->player != NULL) { - shootz += fixed_t(source->player->mo->AttackZOffset * source->player->crouchfactor); + shootz += FLOAT2FIXED(source->player->mo->AttackZOffset * source->player->crouchfactor); } else { @@ -5092,8 +5092,6 @@ bool P_NoWayTraverse(AActor *usething, fixed_t startx, fixed_t starty, fixed_t e // //========================================================================== -CVAR(Int, userange, 0, 0); - void P_UseLines(player_t *player) { bool foundline = false; @@ -5101,7 +5099,7 @@ void P_UseLines(player_t *player) // If the player is transitioning a portal, use the group that is at its vertical center. fixedvec2 start = player->mo->GetPortalTransition(player->mo->_f_height() / 2); // [NS] Now queries the Player's UseRange. - fixedvec2 end = start + Vec2Angle(userange > 0? fixed_t(userange<mo->UseRange, player->mo->_f_angle()); + fixedvec2 end = start + Vec2Angle(FLOAT2FIXED(player->mo->UseRange), player->mo->_f_angle()); // old code: // @@ -5141,7 +5139,7 @@ bool P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType) // [NS] If it's a Player, get their UseRange. if (PuzzleItemUser->player) - usedist = PuzzleItemUser->player->mo->UseRange; + usedist = FLOAT2FIXED(PuzzleItemUser->player->mo->UseRange); else usedist = USERANGE; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 9118abce3..6ceaaa4e3 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2716,7 +2716,7 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj) { grunted = false; // Why should this number vary by gravity? - if (mo->health > 0 && mo->_f_velz() < -mo->player->mo->GruntSpeed) + if (mo->health > 0 && mo->Vel.Z < -mo->player->mo->GruntSpeed) { S_Sound (mo, CHAN_VOICE, "*grunt", 1, ATTN_NORM); grunted = true; @@ -6177,7 +6177,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z, z += source->Center() - source->Floorclip; if (source->player != NULL) // Considering this is for player missiles, it better not be NULL. { - z += ((FIXED2DBL(source->player->mo->AttackZOffset) - 4) * source->player->crouchfactor); + z += ((source->player->mo->AttackZOffset - 4) * source->player->crouchfactor); } else { diff --git a/src/p_user.cpp b/src/p_user.cpp index a8e8755bc..8783bac99 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -648,9 +648,9 @@ void APlayerPawn::Serialize (FArchive &arc) << FlechetteType; if (SaveVersion < 3829) { - GruntSpeed = 12*FRACUNIT; - FallingScreamMinSpeed = 35*FRACUNIT; - FallingScreamMaxSpeed = 40*FRACUNIT; + GruntSpeed = 12; + FallingScreamMinSpeed = 35; + FallingScreamMaxSpeed = 40; } else { @@ -1265,7 +1265,7 @@ bool APlayerPawn::ResetAirSupply (bool playgasp) { S_Sound (this, CHAN_VOICE, "*gasp", 1, ATTN_NORM); } - if (level.airsupply> 0 && player->mo->AirCapacity > 0) player->air_finished = level.time + FixedMul(level.airsupply, player->mo->AirCapacity); + if (level.airsupply> 0 && player->mo->AirCapacity > 0) player->air_finished = level.time + int(level.airsupply * player->mo->AirCapacity); else player->air_finished = INT_MAX; return wasdrowning; } @@ -2618,8 +2618,8 @@ void P_PlayerThink (player_t *player) // Player must be touching the floor P_PlayerOnSpecialFlat(player, P_GetThingFloorType(player->mo)); } - if (player->mo->_f_velz() <= -player->mo->FallingScreamMinSpeed && - player->mo->_f_velz() >= -player->mo->FallingScreamMaxSpeed && !player->morphTics && + if (player->mo->Vel.Z <= -player->mo->FallingScreamMinSpeed && + player->mo->Vel.Z >= -player->mo->FallingScreamMaxSpeed && !player->morphTics && player->mo->waterlevel == 0) { int id = S_FindSkinnedSound (player->mo, "*falling"); diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index d990b05f0..d522ad573 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -326,9 +326,6 @@ int MatchString (const char *in, const char **strings); #define PROP_DOUBLE_PARM(var, no) \ double var = params[(no)+1].d; -#define PROP_FIXED_PARM(var, no) \ - fixed_t var = FLOAT2FIXED(params[(no)+1].d); - #define PROP_COLOR_PARM(var, no) \ int var = params[(no)+1].i== 0? params[(no)+2].i : V_GetColor(NULL, params[(no)+2].s); diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 5ce83f757..7f4f23729 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3736,7 +3736,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF) pos.z += (self->_f_height() >> 1); if (self->player != NULL) { - pos.z += fixed_t (self->player->mo->AttackZOffset * self->player->crouchfactor); + pos.z += FLOAT2FIXED(self->player->mo->AttackZOffset * self->player->crouchfactor); } else { diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 71818a7ae..63e74cb24 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -2093,9 +2093,9 @@ DEFINE_CLASS_PROPERTY(slotnumber, I, Weapon) //========================================================================== DEFINE_CLASS_PROPERTY(slotpriority, F, Weapon) { - PROP_FIXED_PARM(i, 0); + PROP_DOUBLE_PARM(i, 0); assert(info->IsKindOf(RUNTIME_CLASS(PClassWeapon))); - static_cast(info)->SlotPriority = i; + static_cast(info)->SlotPriority = int(i*65536); } //========================================================================== @@ -2504,7 +2504,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, clearcolorset, I, PlayerPawn) //========================================================================== DEFINE_CLASS_PROPERTY_PREFIX(player, attackzoffset, F, PlayerPawn) { - PROP_FIXED_PARM(z, 0); + PROP_DOUBLE_PARM(z, 0); defaults->AttackZOffset = z; } @@ -2522,7 +2522,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, jumpz, F, PlayerPawn) //========================================================================== DEFINE_CLASS_PROPERTY_PREFIX(player, GruntSpeed, F, PlayerPawn) { - PROP_FIXED_PARM(z, 0); + PROP_DOUBLE_PARM(z, 0); defaults->GruntSpeed = z; } @@ -2531,8 +2531,8 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, GruntSpeed, F, PlayerPawn) //========================================================================== DEFINE_CLASS_PROPERTY_PREFIX(player, FallingScreamSpeed, FF, PlayerPawn) { - PROP_FIXED_PARM(minz, 0); - PROP_FIXED_PARM(maxz, 1); + PROP_DOUBLE_PARM(minz, 0); + PROP_DOUBLE_PARM(maxz, 1); defaults->FallingScreamMinSpeed = minz; defaults->FallingScreamMaxSpeed = maxz; } @@ -2582,7 +2582,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, viewheight, F, PlayerPawn) //========================================================================== DEFINE_CLASS_PROPERTY_PREFIX(player, userange, F, PlayerPawn) { - PROP_FIXED_PARM(z, 0); + PROP_DOUBLE_PARM(z, 0); defaults->UseRange = z; } @@ -2591,7 +2591,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, userange, F, PlayerPawn) //========================================================================== DEFINE_CLASS_PROPERTY_PREFIX(player, aircapacity, F, PlayerPawn) { - PROP_FIXED_PARM(z, 0); + PROP_DOUBLE_PARM(z, 0); defaults->AirCapacity = z; }