- fixed CheckRange return value.

- removed the error message for multiple state blocks in DECORATE.
- added some constants for state types.
This commit is contained in:
Christoph Oelckers 2016-11-14 17:50:09 +01:00
parent ba62a86c80
commit 199e2e2f9c
5 changed files with 28 additions and 7 deletions

View file

@ -67,6 +67,14 @@ enum EStateDefineFlags
SDF_DEHACKED = 8, // Identify a state as having been modified by a dehacked lump 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. enum EStateType : int // this must ensure proper alignment.
{ {
STATE_Actor, STATE_Actor,
@ -97,11 +105,12 @@ struct FState
WORD sprite; WORD sprite;
SWORD Tics; SWORD Tics;
WORD TicRange; WORD TicRange;
short Light;
BYTE Frame; BYTE Frame;
BYTE UseFlags;
BYTE DefineFlags; // Unused byte so let's use it during state creation. 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 Misc1; // Was changed to SBYTE, reverted to long for MBF compat
int Misc2; // Was changed to BYTE, 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 Fullbright:1; // State is fullbright
BYTE SameFrame:1; // Ignore Frame (except when spawning actor) BYTE SameFrame:1; // Ignore Frame (except when spawning actor)
BYTE Fast:1; BYTE Fast:1;
@ -153,6 +162,10 @@ struct FState
{ {
Frame = frame - 'A'; Frame = frame - 'A';
} }
inline bool CheckUse(int usetype)
{
return !!(UseFlags & usetype);
}
void SetAction(VMFunction *func) { ActionFunc = func; } void SetAction(VMFunction *func) { ActionFunc = func; }
void ClearAction() { ActionFunc = NULL; } void ClearAction() { ActionFunc = NULL; }
void SetAction(const char *name); void SetAction(const char *name);

View file

@ -3622,7 +3622,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, CheckRange)
} }
} }
} }
ACTION_RETURN_BOOL(false); ACTION_RETURN_BOOL(true);
} }

View file

@ -1062,11 +1062,6 @@ static void ParseActor(FScanner &sc)
break; break;
case TK_States: 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); ParseStates(sc, bag.Info, (AActor *)bag.Info->Defaults, bag);
bag.StateSet = true; bag.StateSet = true;
break; break;

View file

@ -63,6 +63,7 @@ class FStateDefinitions
FState *laststatebeforelabel; FState *laststatebeforelabel;
intptr_t lastlabel; intptr_t lastlabel;
TArray<FState> StateArray; TArray<FState> StateArray;
uint8_t UseType;
static FStateDefine *FindStateLabelInList(TArray<FStateDefine> &list, FName name, bool create); static FStateDefine *FindStateLabelInList(TArray<FStateDefine> &list, FName name, bool create);
static FStateLabels *CreateStateLabelList(TArray<FStateDefine> &statelist); static FStateLabels *CreateStateLabelList(TArray<FStateDefine> &statelist);
@ -74,6 +75,10 @@ class FStateDefinitions
FState *ResolveGotoLabel(AActor *actor, PClassActor *mytype, char *name); FState *ResolveGotoLabel(AActor *actor, PClassActor *mytype, char *name);
static void FixStatePointers(PClassActor *actor, TArray<FStateDefine> & list); static void FixStatePointers(PClassActor *actor, TArray<FStateDefine> & list);
void ResolveGotoLabels(PClassActor *actor, AActor *defaults, TArray<FStateDefine> & list); void ResolveGotoLabels(PClassActor *actor, AActor *defaults, TArray<FStateDefine> & list);
void SetUseType(int type)
{
UseType = uint8_t(type);
}
public: public:

View file

@ -1,6 +1,14 @@
// for flag changer functions. // for flag changer functions.
const FLAG_NO_CHANGE = -1; const FLAG_NO_CHANGE = -1;
enum EStateUseFlags
{
SUF_ACTOR = 1,
SUF_OVERLAY = 2,
SUF_WEAPON = 4,
SUF_ITEM = 8,
};
// Flags for A_PainAttack // Flags for A_PainAttack
enum EPainAttackFlags enum EPainAttackFlags
{ {