mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- fixed some incomplete checks for static arrays.
- made AActor::OkaytoSwitchTarget scripted virtual.
This commit is contained in:
parent
d283beb063
commit
64bdc8c495
4 changed files with 31 additions and 4 deletions
|
@ -692,6 +692,7 @@ public:
|
|||
int SpecialMissileHit (AActor *victim);
|
||||
|
||||
// Returns true if it's okay to switch target to "other" after being attacked by it.
|
||||
bool CallOkayToSwitchTarget(AActor *other);
|
||||
bool OkayToSwitchTarget (AActor *other);
|
||||
|
||||
// Note: Although some of the inventory functions are virtual, this
|
||||
|
|
|
@ -1682,8 +1682,13 @@ DEFINE_ACTION_FUNCTION(AActor, PoisonMobj)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// OkayToSwitchTarget
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool AActor::OkayToSwitchTarget (AActor *other)
|
||||
bool AActor::OkayToSwitchTarget(AActor *other)
|
||||
{
|
||||
if (other == this)
|
||||
return false; // [RH] Don't hate self (can happen when shooting barrels)
|
||||
|
@ -1743,6 +1748,27 @@ bool AActor::OkayToSwitchTarget (AActor *other)
|
|||
return true;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, OkayToSwitchTarget)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
PARAM_OBJECT(other, AActor);
|
||||
ACTION_RETURN_BOOL(self->OkayToSwitchTarget(other));
|
||||
}
|
||||
|
||||
bool AActor::CallOkayToSwitchTarget(AActor *other)
|
||||
{
|
||||
IFVIRTUAL(AActor, OkayToSwitchTarget)
|
||||
{
|
||||
VMValue params[] = { (DObject*)this, other };
|
||||
int retv;
|
||||
VMReturn ret(&retv);
|
||||
GlobalVMStack.Call(func, params, 2, &ret, 1);
|
||||
return !!retv;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// P_PoisonPlayer - Sets up all data concerning poisoning
|
||||
|
|
|
@ -6293,7 +6293,7 @@ FxExpression *FxMemberIdentifier::Resolve(FCompileContext& ctx)
|
|||
else
|
||||
{
|
||||
auto f = dyn_cast<PField>(sym);
|
||||
if (f != nullptr && (f->Flags & VARF_Static | VARF_ReadOnly) == (VARF_Static | VARF_ReadOnly))
|
||||
if (f != nullptr && (f->Flags & (VARF_Static | VARF_ReadOnly | VARF_Meta)) == (VARF_Static | VARF_ReadOnly))
|
||||
{
|
||||
auto x = new FxGlobalVariable(f, ScriptPosition);
|
||||
delete this;
|
||||
|
@ -6944,7 +6944,7 @@ FxExpression *FxStructMember::Resolve(FCompileContext &ctx)
|
|||
}
|
||||
|
||||
// Even though this is global, static and readonly, we still need to do the scope checks for consistency.
|
||||
if ((membervar->Flags & (VARF_Static | VARF_ReadOnly)) == (VARF_Static | VARF_ReadOnly))
|
||||
if ((membervar->Flags & (VARF_Static | VARF_ReadOnly | VARF_Meta)) == (VARF_Static | VARF_ReadOnly))
|
||||
{
|
||||
// This is a static constant array, which is stored at a constant address, like a global variable.
|
||||
auto x = new FxGlobalVariable(membervar, ScriptPosition);
|
||||
|
|
|
@ -438,7 +438,7 @@ class Actor : Thinker native
|
|||
return Obituary;
|
||||
}
|
||||
|
||||
|
||||
native virtual bool OkayToSwitchTarget(Actor other);
|
||||
native static class<Actor> GetReplacement(class<Actor> cls);
|
||||
native static class<Actor> GetReplacee(class<Actor> cls);
|
||||
native static int GetSpriteIndex(name sprt);
|
||||
|
|
Loading…
Reference in a new issue