mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
Avoid using argument count for any kind of decision making in native VM functions.
This allows retaining the functionality, even if for the JIT compiler's benefit all default arguments are pushed onto the stack instead of reading them from the defaults array.
This commit is contained in:
parent
ac28f0d34f
commit
33fb76698b
6 changed files with 24 additions and 20 deletions
|
@ -2976,17 +2976,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_Chase)
|
|||
PARAM_STATE_DEF (missile)
|
||||
PARAM_INT_DEF (flags)
|
||||
|
||||
if (numparam > 1)
|
||||
if (melee != nullptr || missile != nullptr || flags != 0x40000000)
|
||||
{
|
||||
if ((flags & CHF_RESURRECT) && P_CheckForResurrection(self, false))
|
||||
return 0;
|
||||
|
||||
A_DoChase(self, !!(flags&CHF_FASTCHASE), melee, missile, !(flags&CHF_NOPLAYACTIVE),
|
||||
!!(flags&CHF_NIGHTMAREFAST), !!(flags&CHF_DONTMOVE), flags);
|
||||
!!(flags&CHF_NIGHTMAREFAST), !!(flags&CHF_DONTMOVE), flags & 0x3fffffff);
|
||||
}
|
||||
else // this is the old default A_Chase
|
||||
{
|
||||
A_DoChase(self, false, self->MeleeState, self->MissileState, true, gameinfo.nightmarefast, false, flags);
|
||||
A_DoChase(self, false, self->MeleeState, self->MissileState, true, gameinfo.nightmarefast, false, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7432,7 +7432,7 @@ DEFINE_ACTION_FUNCTION(AActor, SpawnPlayerMissile)
|
|||
PARAM_BOOL_DEF(noautoaim);
|
||||
PARAM_INT_DEF(aimflags);
|
||||
AActor *missileactor;
|
||||
if (numparam == 2) angle = self->Angles.Yaw;
|
||||
if (angle == 1e37) angle = self->Angles.Yaw;
|
||||
AActor *misl = P_SpawnPlayerMissile(self, x, y, z, type, angle, lt, &missileactor, nofreeaim, noautoaim, aimflags);
|
||||
if (numret > 0) ret[0].SetObject(misl);
|
||||
if (numret > 1) ret[1].SetObject(missileactor), numret = 2;
|
||||
|
@ -8292,20 +8292,22 @@ DEFINE_ACTION_FUNCTION(AActor, GetDefaultByType)
|
|||
DEFINE_ACTION_FUNCTION(AActor, VelFromAngle)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
if (numparam == 1)
|
||||
PARAM_FLOAT(speed);
|
||||
PARAM_ANGLE(angle);
|
||||
|
||||
if (speed == 1e37)
|
||||
{
|
||||
self->VelFromAngle();
|
||||
}
|
||||
else
|
||||
{
|
||||
PARAM_FLOAT(speed);
|
||||
if (numparam == 2)
|
||||
if (angle == 1e37)
|
||||
|
||||
{
|
||||
self->VelFromAngle(speed);
|
||||
}
|
||||
else
|
||||
{
|
||||
PARAM_ANGLE(angle);
|
||||
self->VelFromAngle(speed, angle);
|
||||
}
|
||||
}
|
||||
|
@ -8327,20 +8329,21 @@ DEFINE_ACTION_FUNCTION(AActor, Vel3DFromAngle)
|
|||
DEFINE_ACTION_FUNCTION(AActor, Thrust)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
if (numparam == 1)
|
||||
PARAM_FLOAT(speed);
|
||||
PARAM_ANGLE(angle);
|
||||
|
||||
if (speed == 1e37)
|
||||
{
|
||||
self->Thrust();
|
||||
}
|
||||
else
|
||||
{
|
||||
PARAM_FLOAT(speed);
|
||||
if (numparam == 2)
|
||||
if (angle == 1e37)
|
||||
{
|
||||
self->Thrust(speed);
|
||||
}
|
||||
else
|
||||
{
|
||||
PARAM_ANGLE(angle);
|
||||
self->Thrust(angle, speed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2603,7 +2603,8 @@ DEFINE_ACTION_FUNCTION(_Secplane, HeightDiff)
|
|||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(secplane_t);
|
||||
PARAM_FLOAT(oldd);
|
||||
if (numparam == 2)
|
||||
PARAM_FLOAT(newd);
|
||||
if (newd != 1e37)
|
||||
{
|
||||
ACTION_RETURN_FLOAT(self->HeightDiff(oldd));
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ struct BoundingRect
|
|||
|
||||
void setEmpty()
|
||||
{
|
||||
left = top = 1e38;
|
||||
bottom = right = -1e38;
|
||||
left = top = FLT_MAX;
|
||||
bottom = right = FLT_MIN;
|
||||
}
|
||||
|
||||
bool contains(const BoundingRect & other) const
|
||||
|
|
|
@ -616,7 +616,7 @@ class Actor : Thinker native
|
|||
native Actor SpawnMissileAngleZSpeed (double z, class<Actor> type, double angle, double vz, double speed, Actor owner = null, bool checkspawn = true);
|
||||
native Actor SpawnMissileZAimed (double z, Actor dest, Class<Actor> type);
|
||||
native Actor SpawnSubMissile(Class<Actor> type, Actor target);
|
||||
native Actor, Actor SpawnPlayerMissile(class<Actor> type, double angle = 0, double x = 0, double y = 0, double z = 0, out FTranslatedLineTarget pLineTarget = null, bool nofreeaim = false, bool noautoaim = false, int aimflags = 0);
|
||||
native Actor, Actor SpawnPlayerMissile(class<Actor> type, double angle = 1e37, double x = 0, double y = 0, double z = 0, out FTranslatedLineTarget pLineTarget = null, bool nofreeaim = false, bool noautoaim = false, int aimflags = 0);
|
||||
native void SpawnTeleportFog(Vector3 pos, bool beforeTele, bool setTarget);
|
||||
native Actor RoughMonsterSearch(int distance, bool onlyseekable = false, bool frontonly = false);
|
||||
native int ApplyDamageFactor(Name damagetype, int damage);
|
||||
|
@ -696,9 +696,9 @@ class Actor : Thinker native
|
|||
native clearscope vector2 Vec2Offset(double x, double y, bool absolute = false) const;
|
||||
native clearscope vector3 Vec2OffsetZ(double x, double y, double atz, bool absolute = false) const;
|
||||
native void VelIntercept(Actor targ, double speed = -1, bool aimpitch = true, bool oldvel = false);
|
||||
native void VelFromAngle(double speed = 0, double angle = 0);
|
||||
native void VelFromAngle(double speed = 1e37, double angle = 1e37);
|
||||
native void Vel3DFromAngle(double speed, double angle, double pitch);
|
||||
native void Thrust(double speed = 0, double angle = 0);
|
||||
native void Thrust(double speed = 1e37, double angle = 1e37);
|
||||
native clearscope bool isFriend(Actor other) const;
|
||||
native clearscope bool isHostile(Actor other) const;
|
||||
native void AdjustFloorClip();
|
||||
|
@ -1030,7 +1030,7 @@ class Actor : Thinker native
|
|||
void A_Fall() { A_NoBlocking(); }
|
||||
native void A_XScream();
|
||||
native void A_Look();
|
||||
native void A_Chase(statelabel melee = null, statelabel missile = null, int flags = 0);
|
||||
native void A_Chase(statelabel melee = null, statelabel missile = null, int flags = 0x40000000);
|
||||
native void A_Scream();
|
||||
native void A_VileChase();
|
||||
native bool A_CheckForResurrection();
|
||||
|
|
|
@ -206,7 +206,7 @@ struct SecPlane native play
|
|||
native bool isEqual(Secplane other) const;
|
||||
native void ChangeHeight(double hdiff);
|
||||
native double GetChangedHeight(double hdiff) const;
|
||||
native double HeightDiff(double oldd, double newd = 0.0) const;
|
||||
native double HeightDiff(double oldd, double newd = 1e37) const;
|
||||
native double PointToDist(Vector2 xy, double z) const;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue