diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 3ed12664a..a6aa1712d 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -857,7 +857,7 @@ public: return (Pos().XY() - otherpos).LengthSquared(); } - double Distance2D(AActor *other, bool absolute = false) + double Distance2D(AActor *other, bool absolute = false) const { DVector2 otherpos = absolute ? other->Pos() : other->PosRelative(this); return (Pos().XY() - otherpos).Length(); @@ -868,7 +868,7 @@ public: return DVector2(X() - x, Y() - y).Length(); } - double Distance2D(AActor *other, double xadd, double yadd, bool absolute = false) + double Distance2D(AActor *other, double xadd, double yadd, bool absolute = false) const { DVector3 otherpos = absolute ? other->Pos() : other->PosRelative(this); return DVector2(X() - otherpos.X + xadd, Y() - otherpos.Y + yadd).Length(); @@ -1433,7 +1433,7 @@ public: // This is used by many vertical velocity calculations. // Better have it in one place, if something needs to be changed about the formula. - double DistanceBySpeed(AActor *dest, double speed) + double DistanceBySpeed(AActor *dest, double speed) const { return MAX(1., Distance2D(dest) / speed); } @@ -1441,7 +1441,7 @@ public: int ApplyDamageFactor(FName damagetype, int damage) const; int GetModifiedDamage(FName damagetype, int damage, bool passive, AActor *inflictor, AActor *source, int flags = 0); void DeleteAttachedLights(); - bool isFrozen(); + bool isFrozen() const; bool hasmodel; }; diff --git a/src/playsim/actorinlines.h b/src/playsim/actorinlines.h index 3e4f7684b..a287354c4 100644 --- a/src/playsim/actorinlines.h +++ b/src/playsim/actorinlines.h @@ -157,7 +157,7 @@ inline DVector3 AActor::Vec3Angle(double length, DAngle angle, double dz, bool a } } -inline bool AActor::isFrozen() +inline bool AActor::isFrozen() const { if (!(flags5 & MF5_NOTIMEFREEZE)) { diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index b80415cbd..374c4867f 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -450,7 +450,7 @@ class Actor : Thinker native return sin(fb * (180./32)) * 8; } - native bool isFrozen(); + native clearscope bool isFrozen() const; virtual native void BeginPlay(); virtual native void Activate(Actor activator); virtual native void Deactivate(Actor activator); @@ -607,7 +607,7 @@ class Actor : Thinker native native clearscope string GetTag(string defstr = "") const; native void SetTag(string defstr = ""); - native double GetBobOffset(double frac = 0); + native clearscope double GetBobOffset(double frac = 0) const; native void ClearCounters(); native bool GiveBody (int num, int max=0); native bool HitFloor(); @@ -703,7 +703,7 @@ class Actor : Thinker native native void FindFloorCeiling(int flags = 0); native double, double GetFriction(); native bool, Actor TestMobjZ(bool quick = false); - native static bool InStateSequence(State newstate, State basestate); + native clearscope static bool InStateSequence(State newstate, State basestate); bool TryWalk () { @@ -751,7 +751,7 @@ class Actor : Thinker native native bool LookForEnemies(bool allaround, LookExParams params = null); native bool LookForPlayers(bool allaround, LookExParams params = null); native bool TeleportMove(Vector3 pos, bool telefrag, bool modifyactor = true); - native double DistanceBySpeed(Actor other, double speed); + native clearscope double DistanceBySpeed(Actor other, double speed) const; native name GetSpecies(); native void PlayActiveSound(); native void Howl(); @@ -787,7 +787,7 @@ class Actor : Thinker native return level.totaltime - SpawnTime; } - double AccuracyFactor() + clearscope double AccuracyFactor() const { return 1. / (1 << (accuracy * 5 / 100)); } diff --git a/wadsrc/static/zscript/actors/player/player.zs b/wadsrc/static/zscript/actors/player/player.zs index d47b09182..aded501e5 100644 --- a/wadsrc/static/zscript/actors/player/player.zs +++ b/wadsrc/static/zscript/actors/player/player.zs @@ -2698,23 +2698,23 @@ struct PlayerInfo native play // self is what internally is known as player_t native void SetSubtitleNumber (int text, Sound sound_id = 0); native bool Resurrect(); - native String GetUserName() const; - native Color GetColor() const; - native Color GetDisplayColor() const; - native int GetColorSet() const; - native int GetPlayerClassNum() const; - native int GetSkin() const; - native bool GetNeverSwitch() const; - native int GetGender() const; - native int GetTeam() const; - native float GetAutoaim() const; - native bool GetNoAutostartMap() const; + native clearscope String GetUserName() const; + native clearscope Color GetColor() const; + native clearscope Color GetDisplayColor() const; + native clearscope int GetColorSet() const; + native clearscope int GetPlayerClassNum() const; + native clearscope int GetSkin() const; + native clearscope bool GetNeverSwitch() const; + native clearscope int GetGender() const; + native clearscope int GetTeam() const; + native clearscope float GetAutoaim() const; + native clearscope bool GetNoAutostartMap() const; native double GetWBobSpeed() const; native double GetWBobFire() const; native double GetMoveBob() const; native double GetStillBob() const; native void SetFOV(float fov); - native bool GetClassicFlight() const; + native clearscope bool GetClassicFlight() const; native void SendPitchLimits(); native clearscope bool HasWeaponsInSlot(int slot) const; @@ -2751,7 +2751,7 @@ struct PlayerInfo native play // self is what internally is known as player_t if (mo) mo.BringUpWeapon(); } - bool IsTotallyFrozen() + clearscope bool IsTotallyFrozen() const { return gamestate == GS_TITLELEVEL ||