- looks like the oldz parameter in UpdateWaterLevel is not needed at all...

This commit is contained in:
Christoph Oelckers 2016-03-26 01:13:36 +01:00
parent 558e04cb99
commit c2e7858e05
9 changed files with 24 additions and 28 deletions

View file

@ -1337,11 +1337,7 @@ public:
bool InStateSequence(FState * newstate, FState * basestate); bool InStateSequence(FState * newstate, FState * basestate);
int GetTics(FState * newstate); int GetTics(FState * newstate);
bool SetState (FState *newstate, bool nofunction=false); bool SetState (FState *newstate, bool nofunction=false);
virtual bool UpdateWaterLevel (fixed_t oldz, bool splash=true); virtual bool UpdateWaterLevel (bool splash=true);
bool UpdateWaterLevel(double oldz, bool splash = true)
{
return UpdateWaterLevel(FLOAT2FIXED(oldz), splash);
}
bool isFast(); bool isFast();
bool isSlow(); bool isSlow();
void SetIdle(bool nofunction=false); void SetIdle(bool nofunction=false);

View file

@ -353,6 +353,11 @@ static bool ReadChars (char **stuff, int size);
static char *igets (void); static char *igets (void);
static int GetLine (void); static int GetLine (void);
inline double DEHToDouble(int acsval)
{
return acsval / 65536.;
}
static void PushTouchedActor(PClassActor *cls) static void PushTouchedActor(PClassActor *cls)
{ {
for(unsigned i = 0; i < TouchedActors.Size(); i++) for(unsigned i = 0; i < TouchedActors.Size(); i++)
@ -647,7 +652,7 @@ static int CreateMushroomFunc(VMFunctionBuilder &buildit, int value1, int value2
} }
else 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 // hrange
if (value2 == 0) if (value2 == 0)
@ -656,7 +661,7 @@ static int CreateMushroomFunc(VMFunctionBuilder &buildit, int value1, int value2
} }
else 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; return 5;
} }
@ -896,14 +901,14 @@ static int PatchThing (int thingy)
} }
else if (linelen == 12 && stricmp (Line1, "Translucency") == 0) else if (linelen == 12 && stricmp (Line1, "Translucency") == 0)
{ {
info->Alpha = FIXED2DBL(val); info->Alpha = DEHToDouble(val);
info->RenderStyle = STYLE_Translucent; info->RenderStyle = STYLE_Translucent;
hadTranslucency = true; hadTranslucency = true;
hadStyle = true; hadStyle = true;
} }
else if (linelen == 6 && stricmp (Line1, "Height") == 0) else if (linelen == 6 && stricmp (Line1, "Height") == 0)
{ {
info->Height = FIXED2DBL(val); info->Height = DEHToDouble(val);
info->projectilepassheight = 0; // needs to be disabled info->projectilepassheight = 0; // needs to be disabled
hadHeight = true; hadHeight = true;
} }
@ -919,7 +924,7 @@ static int PatchThing (int thingy)
} }
else if (stricmp (Line1, "Width") == 0) else if (stricmp (Line1, "Width") == 0)
{ {
info->radius = FIXED2FLOAT(val); info->radius = DEHToDouble(val);
} }
else if (stricmp (Line1, "Alpha") == 0) else if (stricmp (Line1, "Alpha") == 0)
{ {

View file

@ -2369,7 +2369,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
DAngle ang = players[player].mo->Angles.Yaw; DAngle ang = players[player].mo->Angles.Yaw;
DAngle pitch = players[player].mo->Angles.Pitch; DAngle pitch = players[player].mo->Angles.Pitch;
double c = pitch.Cos(); 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); s = ReadString (stream);

View file

@ -167,7 +167,7 @@ public:
// [CW] Fades for when you are being damaged. // [CW] Fades for when you are being damaged.
PalEntry DamageFade; PalEntry DamageFade;
bool UpdateWaterLevel (fixed_t oldz, bool splash); bool UpdateWaterLevel (bool splash);
bool ResetAirSupply (bool playgasp = true); bool ResetAirSupply (bool playgasp = true);
int GetMaxHealth() const; int GetMaxHealth() const;

View file

@ -50,9 +50,6 @@
#define NETD_ID BIGE_ID('N','E','T','D') #define NETD_ID BIGE_ID('N','E','T','D')
#define WEAP_ID BIGE_ID('W','E','A','P') #define WEAP_ID BIGE_ID('W','E','A','P')
#define ANGLE2SHORT(x) ((((x)/360) & 65535)
#define SHORT2ANGLE(x) ((x)*360)
struct zdemoheader_s { struct zdemoheader_s {
BYTE demovermajor; BYTE demovermajor;

View file

@ -93,7 +93,7 @@ void AFastProjectile::Tick ()
} }
} }
AddZ(frac.Z); AddZ(frac.Z);
UpdateWaterLevel (oldz); UpdateWaterLevel ();
oldz = Z(); oldz = Z();
if (oldz <= floorz) if (oldz <= floorz)
{ // Hit the floor { // Hit the floor

View file

@ -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->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); P_CheckFakeFloorTriggers(n->m_thing, n->m_thing->_f_Z() - amt);
} }
} }

View file

@ -472,7 +472,7 @@ void AActor::Serialize(FArchive &arc)
} }
} }
ClearInterpolation(); 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 // [RH] Give the pain elemental vertical friction
// This used to be in APainElemental::Tick but in order to use // 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; const sector_t *sec = node->m_sector;
if (sec->floorplane.c >= STEEPSLOPE) 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; dopush = false;
break; break;
@ -3858,7 +3858,7 @@ void AActor::Tick ()
CheckPortalTransition(true); CheckPortalTransition(true);
UpdateWaterLevel (oldz); UpdateWaterLevel ();
// [RH] Don't advance if predicting a player // [RH] Don't advance if predicting a player
if (player && (player->cheats & CF_PREDICTING)) 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; BYTE lastwaterlevel = waterlevel;
double fh = -FLT_MAX; double fh = -FLT_MAX;
@ -4068,10 +4068,8 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
else else
{ {
// Check 3D floors as well! // Check 3D floors as well!
for(unsigned int i=0;i<Sector->e->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_EXISTS)) continue;
if(!(rover->flags & FF_SWIMMABLE) || rover->flags & FF_SOLID) 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->Floorclip = 0;
} }
actor->UpdateWaterLevel (actor->Z(), false); actor->UpdateWaterLevel (false);
if (!SpawningMapThing) if (!SpawningMapThing)
{ {
actor->BeginPlay (); actor->BeginPlay ();

View file

@ -1225,10 +1225,10 @@ int APlayerPawn::GetMaxHealth() const
// //
//=========================================================================== //===========================================================================
bool APlayerPawn::UpdateWaterLevel (fixed_t oldz, bool splash) bool APlayerPawn::UpdateWaterLevel (bool splash)
{ {
int oldlevel = waterlevel; int oldlevel = waterlevel;
bool retval = Super::UpdateWaterLevel (oldz, splash); bool retval = Super::UpdateWaterLevel (splash);
if (player != NULL) if (player != NULL)
{ {
if (oldlevel < 3 && waterlevel == 3) if (oldlevel < 3 && waterlevel == 3)