diff --git a/src/d_main.cpp b/src/d_main.cpp index 75a616bf4e..b70e5d779c 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -855,7 +855,7 @@ void D_Display () FTexture *tex; int x; - tex = TexMan[gameinfo.PauseSign]; + tex = TexMan(gameinfo.PauseSign); x = (SCREENWIDTH - tex->GetScaledWidth() * CleanXfac)/2 + tex->GetScaledLeftOffset() * CleanXfac; screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE); diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index dc1b8ccd8b..dd25c9e0bb 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -207,7 +207,7 @@ bool DMenu::MouseEventBack(int type, int x, int y) { if (m_show_backbutton >= 0) { - FTexture *tex = TexMan[gameinfo.mBackButton]; + FTexture *tex = TexMan(gameinfo.mBackButton); if (tex != NULL) { if (m_show_backbutton&1) x -= screen->GetWidth() - tex->GetScaledWidth() * CleanXfac; @@ -263,7 +263,7 @@ void DMenu::Drawer () { if (this == DMenu::CurrentMenu && BackbuttonAlpha > 0 && m_show_backbutton >= 0 && m_use_mouse) { - FTexture *tex = TexMan[gameinfo.mBackButton]; + FTexture *tex = TexMan(gameinfo.mBackButton); int w = tex->GetScaledWidth() * CleanXfac; int h = tex->GetScaledHeight() * CleanYfac; int x = (!(m_show_backbutton&1))? 0:screen->GetWidth() - w; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 8a015bae45..bb92b42bdf 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4235,6 +4235,7 @@ enum EACSFunctions ACSF_SpawnDecal, ACSF_CheckFont, ACSF_DropItem, + ACSF_CheckFlag, // ZDaemon ACSF_GetTeamScore = 19620, // (int team) @@ -5270,6 +5271,16 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) break; } + case ACSF_CheckFlag: + { + AActor *actor = SingleActorFromTID(args[0], activator); + if (actor != NULL) + { + return !!CheckActorFlag(actor, FBehavior::StaticLookupString(args[1])); + } + break; + } + default: break; } diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index 63d04ea294..c388a8544f 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -31,6 +31,7 @@ bool CheckDeprecatedFlags(const AActor *actor, FActorInfo *info, int index); const char *GetFlagName(unsigned int flagnum, int flagoffset); void ModActorFlag(AActor *actor, FFlagDef *fd, bool set); 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)) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 456a1d6e37..7964c422b6 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3777,32 +3777,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag) COPY_AAPTR_NOT_NULL(self, owner, checkpointer); - const char *dot = strchr (flagname, '.'); - FFlagDef *fd; - const PClass *cls = owner->GetClass(); - - if (dot != NULL) + if (CheckActorFlag(owner, flagname)) { - FString part1(flagname, dot-flagname); - fd = FindFlag (cls, part1, dot+1); + ACTION_JUMP(jumpto); } - 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()); - } - } diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 2c0abee179..d6731aafaa 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -180,6 +180,33 @@ INTBOOL CheckActorFlag(const AActor *owner, FFlagDef *fd) #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