diff --git a/src/info.h b/src/info.h index e198bb26c..86d653fe4 100644 --- a/src/info.h +++ b/src/info.h @@ -67,6 +67,14 @@ enum EStateDefineFlags SDF_DEHACKED = 8, // Identify a state as having been modified by a dehacked lump }; +enum EStateUseFlags +{ + SUF_ACTOR = 1, + SUF_OVERLAY = 2, + SUF_WEAPON = 4, + SUF_ITEM = 8, +}; + enum EStateType : int // this must ensure proper alignment. { STATE_Actor, @@ -97,11 +105,12 @@ struct FState WORD sprite; SWORD Tics; WORD TicRange; + short Light; BYTE Frame; + BYTE UseFlags; BYTE DefineFlags; // Unused byte so let's use it during state creation. int Misc1; // Was changed to SBYTE, reverted to long for MBF compat int Misc2; // Was changed to BYTE, reverted to long for MBF compat - short Light; BYTE Fullbright:1; // State is fullbright BYTE SameFrame:1; // Ignore Frame (except when spawning actor) BYTE Fast:1; @@ -153,6 +162,10 @@ struct FState { Frame = frame - 'A'; } + inline bool CheckUse(int usetype) + { + return !!(UseFlags & usetype); + } void SetAction(VMFunction *func) { ActionFunc = func; } void ClearAction() { ActionFunc = NULL; } void SetAction(const char *name); diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index d61dc100c..d56c7ee64 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -3622,7 +3622,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, CheckRange) } } } - ACTION_RETURN_BOOL(false); + ACTION_RETURN_BOOL(true); } diff --git a/src/scripting/decorate/thingdef_parse.cpp b/src/scripting/decorate/thingdef_parse.cpp index 151d88521..490d9cf79 100644 --- a/src/scripting/decorate/thingdef_parse.cpp +++ b/src/scripting/decorate/thingdef_parse.cpp @@ -1062,11 +1062,6 @@ static void ParseActor(FScanner &sc) break; case TK_States: - if (bag.StateSet) - { - sc.ScriptMessage("'%s' contains multiple state declarations", bag.Info->TypeName.GetChars()); - FScriptPosition::ErrorCounter++; - } ParseStates(sc, bag.Info, (AActor *)bag.Info->Defaults, bag); bag.StateSet = true; break; diff --git a/src/scripting/thingdef.h b/src/scripting/thingdef.h index 2c13d8eb7..3ff347ac6 100644 --- a/src/scripting/thingdef.h +++ b/src/scripting/thingdef.h @@ -63,6 +63,7 @@ class FStateDefinitions FState *laststatebeforelabel; intptr_t lastlabel; TArray StateArray; + uint8_t UseType; static FStateDefine *FindStateLabelInList(TArray &list, FName name, bool create); static FStateLabels *CreateStateLabelList(TArray &statelist); @@ -74,6 +75,10 @@ class FStateDefinitions FState *ResolveGotoLabel(AActor *actor, PClassActor *mytype, char *name); static void FixStatePointers(PClassActor *actor, TArray & list); void ResolveGotoLabels(PClassActor *actor, AActor *defaults, TArray & list); + void SetUseType(int type) + { + UseType = uint8_t(type); + } public: diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index 7c3038a74..5e47bbc7e 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -1,6 +1,14 @@ // for flag changer functions. const FLAG_NO_CHANGE = -1; +enum EStateUseFlags +{ + SUF_ACTOR = 1, + SUF_OVERLAY = 2, + SUF_WEAPON = 4, + SUF_ITEM = 8, +}; + // Flags for A_PainAttack enum EPainAttackFlags {