mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-22 17:01:08 +00:00
- reinstated the state's sprite frame code.
Having frames makes management a lot easier so let's keep it.
This commit is contained in:
parent
f3ea1e312a
commit
d20c37e708
2 changed files with 34 additions and 6 deletions
|
@ -870,16 +870,34 @@ bool FStateDefinitions::SetLoop()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
int FStateDefinitions::AddStates(FState *state, const FScriptPosition &sc)
|
||||
int FStateDefinitions::AddStates(FState *state, const char *framechars, const FScriptPosition &sc)
|
||||
{
|
||||
bool error = false;
|
||||
int frame = 0;
|
||||
int count = 0;
|
||||
while (*framechars)
|
||||
{
|
||||
bool noframe = false;
|
||||
|
||||
StateArray.Push(*state);
|
||||
SourceLines.Push(sc);
|
||||
++count;
|
||||
if (*framechars == '#')
|
||||
noframe = true;
|
||||
else if (*framechars == '^')
|
||||
frame = '\\' - 'A';
|
||||
else
|
||||
frame = (*framechars & 223) - 'A';
|
||||
|
||||
framechars++;
|
||||
if (frame < 0 || frame > 28)
|
||||
{
|
||||
frame = 0;
|
||||
error = true;
|
||||
}
|
||||
|
||||
state->Frame = frame;
|
||||
StateArray.Push(*state);
|
||||
SourceLines.Push(sc);
|
||||
++count;
|
||||
}
|
||||
laststate = &StateArray[StateArray.Size() - 1];
|
||||
laststatebeforelabel = laststate;
|
||||
return !error ? count : -count;
|
||||
|
@ -1062,3 +1080,12 @@ int GetSpriteIndex(const char * spritename, bool add)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
DEFINE_ACTION_FUNCTION(FState, ValidateSpriteFrame)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FState);
|
||||
ACTION_RETURN_BOOL(self->Frame < sprites[self->sprite].numframes);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -90,8 +90,9 @@ struct FState
|
|||
{
|
||||
FState *NextState;
|
||||
VMFunction *ActionFunc;
|
||||
int32_t sprite;
|
||||
int16_t sprite;
|
||||
int16_t Tics;
|
||||
uint8_t Frame;
|
||||
uint8_t StateFlags;
|
||||
uint8_t DefineFlags;
|
||||
public:
|
||||
|
@ -238,7 +239,7 @@ public:
|
|||
bool SetStop();
|
||||
bool SetWait();
|
||||
bool SetLoop();
|
||||
int AddStates(FState *state, const FScriptPosition &sc);
|
||||
int AddStates(FState* state, const char* framechars, const FScriptPosition& sc);
|
||||
int GetStateCount() const { return StateArray.Size(); }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue