This commit is contained in:
Christoph Oelckers 2013-08-12 22:51:28 +02:00
commit 36e35c0354
6 changed files with 44 additions and 27 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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;
}

View file

@ -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))

View file

@ -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());
}
}

View file

@ -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