mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 12:11:25 +00:00
make various getter and pure-math methods clearscope, and where applicable, const
Original PR: https://github.com/coelckers/gzdoom/pull/532 Status of the original PR 1. Actor - [already in] deltaangle - [already in] absangle - [already in] AngleToVector - [already in] RotateVector - [already in] Normalize180 - [already in] BobSin - [already in] GetDefaultSpeed - [this PR] GetBobOffset - [this PR] InStateSequence - [already in] FindState - [already in] GetDropItems - [this PR] DistanceBySpeed - [this PR] AccuracyFactor - [not in original PR, for PlayerInfo.isTotallyFrozen] isFrozen 2. PlayerInfo - [this PR] GetUserName - [this PR] GetColor - [this PR] GetDisplayColor - [this PR] GetColorSet - [this PR] GetPlayerClassNum - [this PR] GetSkin - [this PR] GetNeverSwitch - [this PR] GetGender - [this PR] GetTeam - [this PR] GetAutoaim - [this PR] GetNoAutostartMap - [this PR] GetClassicFlight - [this PR] IsTotallyFrozen 3. C++ methods, to match ZScript: - [scriptified] AActor::AccuracyFactor() to Actor.AccuracyFactor - [this PR] AActor::DistanceBySpeed(AActor *, double) — it is a combination of getter and pure math - [this PR] AActor::Distance2D(AActor *, bool) — called by DistanceBySpeed - [this PR] AActor::Distance2D(AActor *, double, double, bool) — called by DistanceBySpeed - [not in original PR, for PlayerInfo.isTotallyFrozen] AActor::isFrozen
This commit is contained in:
parent
6b4ec2630c
commit
928c738e19
4 changed files with 23 additions and 23 deletions
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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 ||
|
||||
|
|
Loading…
Reference in a new issue