mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- added ACS CheckFlag function.
This commit is contained in:
parent
ba3e57281a
commit
61c94648dc
4 changed files with 41 additions and 24 deletions
|
@ -4235,6 +4235,7 @@ enum EACSFunctions
|
||||||
ACSF_SpawnDecal,
|
ACSF_SpawnDecal,
|
||||||
ACSF_CheckFont,
|
ACSF_CheckFont,
|
||||||
ACSF_DropItem,
|
ACSF_DropItem,
|
||||||
|
ACSF_CheckFlag,
|
||||||
|
|
||||||
// ZDaemon
|
// ZDaemon
|
||||||
ACSF_GetTeamScore = 19620, // (int team)
|
ACSF_GetTeamScore = 19620, // (int team)
|
||||||
|
@ -5270,6 +5271,16 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ACSF_CheckFlag:
|
||||||
|
{
|
||||||
|
AActor *actor = SingleActorFromTID(args[0], activator);
|
||||||
|
if (actor != NULL)
|
||||||
|
{
|
||||||
|
return !!CheckActorFlag(actor, FBehavior::StaticLookupString(args[1]));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ bool CheckDeprecatedFlags(const AActor *actor, FActorInfo *info, int index);
|
||||||
const char *GetFlagName(unsigned int flagnum, int flagoffset);
|
const char *GetFlagName(unsigned int flagnum, int flagoffset);
|
||||||
void ModActorFlag(AActor *actor, FFlagDef *fd, bool set);
|
void ModActorFlag(AActor *actor, FFlagDef *fd, bool set);
|
||||||
INTBOOL CheckActorFlag(const AActor *actor, FFlagDef *fd);
|
INTBOOL CheckActorFlag(const AActor *actor, FFlagDef *fd);
|
||||||
|
INTBOOL CheckActorFlag(const AActor *owner, const char *flagname, bool printerror = true);
|
||||||
|
|
||||||
#define FLAG_NAME(flagnum, flagvar) GetFlagName(flagnum, myoffsetof(AActor, flagvar))
|
#define FLAG_NAME(flagnum, flagvar) GetFlagName(flagnum, myoffsetof(AActor, flagvar))
|
||||||
|
|
||||||
|
|
|
@ -3777,32 +3777,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag)
|
||||||
|
|
||||||
COPY_AAPTR_NOT_NULL(self, owner, checkpointer);
|
COPY_AAPTR_NOT_NULL(self, owner, checkpointer);
|
||||||
|
|
||||||
const char *dot = strchr (flagname, '.');
|
if (CheckActorFlag(owner, flagname))
|
||||||
FFlagDef *fd;
|
|
||||||
const PClass *cls = owner->GetClass();
|
|
||||||
|
|
||||||
if (dot != NULL)
|
|
||||||
{
|
{
|
||||||
FString part1(flagname, dot-flagname);
|
ACTION_JUMP(jumpto);
|
||||||
fd = FindFlag (cls, part1, dot+1);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
fd = FindFlag (cls, flagname, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fd != NULL)
|
|
||||||
{
|
|
||||||
if (CheckActorFlag(owner, fd))
|
|
||||||
{
|
|
||||||
ACTION_JUMP(jumpto);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Printf("Unknown flag '%s' in '%s'\n", flagname, cls->TypeName.GetChars());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,33 @@ INTBOOL CheckActorFlag(const AActor *owner, FFlagDef *fd)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INTBOOL CheckActorFlag(const AActor *owner, const char *flagname, bool printerror)
|
||||||
|
{
|
||||||
|
const char *dot = strchr (flagname, '.');
|
||||||
|
FFlagDef *fd;
|
||||||
|
const PClass *cls = owner->GetClass();
|
||||||
|
|
||||||
|
if (dot != NULL)
|
||||||
|
{
|
||||||
|
FString part1(flagname, dot-flagname);
|
||||||
|
fd = FindFlag (cls, part1, dot+1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fd = FindFlag (cls, flagname, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fd != NULL)
|
||||||
|
{
|
||||||
|
return CheckActorFlag(owner, fd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (printerror) Printf("Unknown flag '%s' in '%s'\n", flagname, cls->TypeName.GetChars());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// HandleDeprecatedFlags
|
// HandleDeprecatedFlags
|
||||||
|
|
Loading…
Reference in a new issue