- added explicit setter functions for the count and link flags so that A_ChangeFlag and A_SetFlag can be deprecated.

This commit is contained in:
Christoph Oelckers 2016-10-25 10:15:24 +02:00
parent ae728cc61a
commit 656b8cb16e
4 changed files with 79 additions and 2 deletions

View file

@ -4852,6 +4852,74 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag)
}
//===========================================================================
//
// A_ChangeCountFlags (needed, because these flags affect global counters)
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeLinkFlags)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_OPT(blockmap) { blockmap = -1; }
PARAM_INT_OPT(sector) { sector = -1; }
self->UnlinkFromWorld();
if (blockmap != -1)
{
if (blockmap == 0) self->flags &= MF_NOBLOCKMAP;
else self->flags |= MF_NOBLOCKMAP;
}
if (sector != -1)
{
if (sector == 0) self->flags &= MF_NOSECTOR;
else self->flags |= MF_NOSECTOR;
}
self->LinkToWorld();
return 0;
}
//===========================================================================
//
// A_ChangeCountFlags (needed, because these flags affect global counters)
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeCountFlags)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_OPT(kill) { kill = -1; }
PARAM_INT_OPT(item) { item = -1; }
PARAM_INT_OPT(secret) { secret = -1; }
if (self->CountsAsKill() && self->health > 0) --level.total_monsters;
if (self->flags & MF_COUNTITEM) --level.total_items;
if (self->flags5 & MF5_COUNTSECRET) --level.total_secrets;
if (kill != -1)
{
if (kill == 0) self->flags &= MF_COUNTKILL;
else self->flags |= MF_COUNTKILL;
}
if (item != -1)
{
if (item == 0) self->flags &= MF_COUNTITEM;
else self->flags |= MF_COUNTITEM;
}
if (secret != -1)
{
if (secret == 0) self->flags5 &= MF5_COUNTSECRET;
else self->flags5 |= MF5_COUNTSECRET;
}
if (self->CountsAsKill() && self->health > 0) ++level.total_monsters;
if (self->flags & MF_COUNTITEM) ++level.total_items;
if (self->flags5 & MF5_COUNTSECRET) ++level.total_secrets;
return 0;
}
//===========================================================================
//
// A_RaiseMaster

View file

@ -177,3 +177,5 @@ zscript/chex/chexweapons.txt
zscript/chex/chexitems.txt
zscript/chex/chexdecorations.txt
zscript/chex/chexplayer.txt
zscript/test2.txt

View file

@ -238,8 +238,10 @@ class Actor : Thinker native
native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);
native void A_DropInventory(class<Inventory> itemtype);
native void A_SetBlend(color color1, float alpha, int tics, color color2 = "");
native void A_ChangeFlag(string flagname, bool value);
native state A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT);
deprecated native void A_ChangeFlag(string flagname, bool value);
deprecated native state A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT);
native void A_ChangeCountFlags(int kill = FLAG_NO_CHANGE, int item = FLAG_NO_CHANGE, int secret = FLAG_NO_CHANGE);
native void A_ChangeLinkFlags(int blockmap = FLAG_NO_CHANGE, int sector = FLAG_NO_CHANGE);
native state A_JumpIf(bool expression, state label);
native void A_RaiseMaster(bool copy = 0);
native void A_RaiseChildren(bool copy = 0);

View file

@ -1,3 +1,6 @@
// for flag changer functions.
const int FLAG_NO_CHANGE = -1;
// Flags for A_PainAttack
enum EPainAttackFlags
{
@ -820,3 +823,5 @@ struct FStateParamInfo
EStateType mStateType;
int mPSPIndex;
}