diff --git a/src/actor.h b/src/actor.h index dc7013865..863c0a496 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1337,11 +1337,7 @@ public: bool InStateSequence(FState * newstate, FState * basestate); int GetTics(FState * newstate); bool SetState (FState *newstate, bool nofunction=false); - virtual bool UpdateWaterLevel (fixed_t oldz, bool splash=true); - bool UpdateWaterLevel(double oldz, bool splash = true) - { - return UpdateWaterLevel(FLOAT2FIXED(oldz), splash); - } + virtual bool UpdateWaterLevel (bool splash=true); bool isFast(); bool isSlow(); void SetIdle(bool nofunction=false); diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 5c84532c4..eeaa12729 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -353,6 +353,11 @@ static bool ReadChars (char **stuff, int size); static char *igets (void); static int GetLine (void); +inline double DEHToDouble(int acsval) +{ + return acsval / 65536.; +} + static void PushTouchedActor(PClassActor *cls) { for(unsigned i = 0; i < TouchedActors.Size(); i++) @@ -647,7 +652,7 @@ static int CreateMushroomFunc(VMFunctionBuilder &buildit, int value1, int value2 } else { - buildit.Emit(OP_PARAM, 0, REGT_FLOAT | REGT_KONST, buildit.GetConstantFloat(FIXED2DBL(value1))); + buildit.Emit(OP_PARAM, 0, REGT_FLOAT | REGT_KONST, buildit.GetConstantFloat(DEHToDouble(value1))); } // hrange if (value2 == 0) @@ -656,7 +661,7 @@ static int CreateMushroomFunc(VMFunctionBuilder &buildit, int value1, int value2 } else { - buildit.Emit(OP_PARAM, 0, REGT_FLOAT | REGT_KONST, buildit.GetConstantFloat(FIXED2DBL(value2))); + buildit.Emit(OP_PARAM, 0, REGT_FLOAT | REGT_KONST, buildit.GetConstantFloat(DEHToDouble(value2))); } return 5; } @@ -896,14 +901,14 @@ static int PatchThing (int thingy) } else if (linelen == 12 && stricmp (Line1, "Translucency") == 0) { - info->Alpha = FIXED2DBL(val); + info->Alpha = DEHToDouble(val); info->RenderStyle = STYLE_Translucent; hadTranslucency = true; hadStyle = true; } else if (linelen == 6 && stricmp (Line1, "Height") == 0) { - info->Height = FIXED2DBL(val); + info->Height = DEHToDouble(val); info->projectilepassheight = 0; // needs to be disabled hadHeight = true; } @@ -919,7 +924,7 @@ static int PatchThing (int thingy) } else if (stricmp (Line1, "Width") == 0) { - info->radius = FIXED2FLOAT(val); + info->radius = DEHToDouble(val); } else if (stricmp (Line1, "Alpha") == 0) { diff --git a/src/d_net.cpp b/src/d_net.cpp index 89f6a28b6..4fe85f239 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2369,7 +2369,7 @@ void Net_DoCommand (int type, BYTE **stream, int player) DAngle ang = players[player].mo->Angles.Yaw; DAngle pitch = players[player].mo->Angles.Pitch; double c = pitch.Cos(); - DVector3 vec(c * ang.Cos(), c * ang.Sin(), -pitch.Sin); + DVector3 vec(c * ang.Cos(), c * ang.Sin(), -pitch.Sin()); s = ReadString (stream); diff --git a/src/d_player.h b/src/d_player.h index 598ccdd48..40178dac1 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -167,7 +167,7 @@ public: // [CW] Fades for when you are being damaged. PalEntry DamageFade; - bool UpdateWaterLevel (fixed_t oldz, bool splash); + bool UpdateWaterLevel (bool splash); bool ResetAirSupply (bool playgasp = true); int GetMaxHealth() const; diff --git a/src/d_protocol.h b/src/d_protocol.h index 02212efe7..61f7377e3 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -50,9 +50,6 @@ #define NETD_ID BIGE_ID('N','E','T','D') #define WEAP_ID BIGE_ID('W','E','A','P') -#define ANGLE2SHORT(x) ((((x)/360) & 65535) -#define SHORT2ANGLE(x) ((x)*360) - struct zdemoheader_s { BYTE demovermajor; diff --git a/src/g_shared/a_fastprojectile.cpp b/src/g_shared/a_fastprojectile.cpp index 55489cdcf..8c7d63b74 100644 --- a/src/g_shared/a_fastprojectile.cpp +++ b/src/g_shared/a_fastprojectile.cpp @@ -93,7 +93,7 @@ void AFastProjectile::Tick () } } AddZ(frac.Z); - UpdateWaterLevel (oldz); + UpdateWaterLevel (); oldz = Z(); if (oldz <= floorz) { // Hit the floor diff --git a/src/p_map.cpp b/src/p_map.cpp index 247dda65f..82eb9360a 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -6098,7 +6098,7 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool { n->visited = true; // mark thing as processed - n->m_thing->UpdateWaterLevel(n->m_thing->_f_Z(), false); + n->m_thing->UpdateWaterLevel(false); P_CheckFakeFloorTriggers(n->m_thing, n->m_thing->_f_Z() - amt); } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b59ae30aa..56f741494 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -472,7 +472,7 @@ void AActor::Serialize(FArchive &arc) } } ClearInterpolation(); - UpdateWaterLevel(_f_Z(), false); + UpdateWaterLevel(false); } } @@ -3462,7 +3462,7 @@ void AActor::Tick () } } - fixed_t oldz = _f_Z(); + double oldz = Z(); // [RH] Give the pain elemental vertical friction // This used to be in APainElemental::Tick but in order to use @@ -3736,7 +3736,7 @@ void AActor::Tick () const sector_t *sec = node->m_sector; if (sec->floorplane.c >= STEEPSLOPE) { - if (floorplane.ZatPointF (_f_PosRelative(node->m_sector)) >= Z() - MaxStepHeight) + if (floorplane.ZatPoint(PosRelative(node->m_sector)) >= Z() - MaxStepHeight) { dopush = false; break; @@ -3858,7 +3858,7 @@ void AActor::Tick () CheckPortalTransition(true); - UpdateWaterLevel (oldz); + UpdateWaterLevel (); // [RH] Don't advance if predicting a player if (player && (player->cheats & CF_PREDICTING)) @@ -4011,7 +4011,7 @@ void AActor::CheckSectorTransition(sector_t *oldsec) // //========================================================================== -bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash) +bool AActor::UpdateWaterLevel (bool dosplash) { BYTE lastwaterlevel = waterlevel; double fh = -FLT_MAX; @@ -4068,10 +4068,8 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash) else { // Check 3D floors as well! - for(unsigned int i=0;ie->XFloor.ffloors.Size();i++) + for(auto rover : Sector->e->XFloor.ffloors) { - F3DFloor* rover=Sector->e->XFloor.ffloors[i]; - if (!(rover->flags & FF_EXISTS)) continue; if(!(rover->flags & FF_SWIMMABLE) || rover->flags & FF_SOLID) continue; @@ -4269,7 +4267,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t a { actor->Floorclip = 0; } - actor->UpdateWaterLevel (actor->Z(), false); + actor->UpdateWaterLevel (false); if (!SpawningMapThing) { actor->BeginPlay (); diff --git a/src/p_user.cpp b/src/p_user.cpp index c81fe10af..40eefd893 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1225,10 +1225,10 @@ int APlayerPawn::GetMaxHealth() const // //=========================================================================== -bool APlayerPawn::UpdateWaterLevel (fixed_t oldz, bool splash) +bool APlayerPawn::UpdateWaterLevel (bool splash) { int oldlevel = waterlevel; - bool retval = Super::UpdateWaterLevel (oldz, splash); + bool retval = Super::UpdateWaterLevel (splash); if (player != NULL) { if (oldlevel < 3 && waterlevel == 3)