- Removed DECORATE's ParseClass because it was only used to add data to fully

internal actor classes which no longer exist.
- Changed the state structure so that the Tics value doesn't need to be hacked
  into misc1 with SF_BIGTIC anymore. 
- Changed sprite processing so that sprite names are converted to indices 
  during parsing so that an additional postprocessing step is no longer needed.
- Fixed: Sprite names in DECORATE were case sensitive.
- Exported AActor's defaults to DECORATE and removed all code for the 
  internal property parser which is no longer needed.


SVN r1146 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-10 14:19:47 +00:00
commit f4c07c45ec
33 changed files with 484 additions and 1662 deletions

View file

@ -311,18 +311,10 @@ void InstallStates(FActorInfo *info, AActor *defaults)
// First ensure we have a valid spawn state.
FState * state = FindState(defaults, info->Class, "Spawn");
// Stateless actors that are direct subclasses of AActor
// have their spawnstate default to something that won't
// immediately destroy them.
if (state == &AActor::States[2] && info->Class->ParentClass == RUNTIME_CLASS(AActor))
if (state == NULL)
{
AddState("Spawn", &AActor::States[0]);
}
else if (state == NULL)
{
// A NULL spawn state will crash the engine so set it to something that will make
// the actor disappear as quickly as possible.
AddState("Spawn", &AActor::States[2]);
// A NULL spawn state will crash the engine so set it to something valid.
AddState("Spawn", GetDefault<AActor>()->SpawnState);
}
if (info->StateList != NULL)
@ -510,6 +502,8 @@ int ParseStates(FScanner &sc, FActorInfo * actor, AActor * defaults, Baggage &ba
FState * laststate = NULL;
intptr_t lastlabel = -1;
int minrequiredstate = -1;
int spriteindex;
char lastsprite[5]="";
sc.MustGetStringName ("{");
sc.SetEscape(false); // disable escape sequences in the state parser
@ -609,7 +603,14 @@ do_stop:
sc.ScriptError ("Sprite names must be exactly 4 characters\n");
}
memcpy(state.sprite.name, statestring, 4);
statestring.ToUpper();
if (strcmp(statestring, lastsprite))
{
strcpy(lastsprite, statestring);
spriteindex = GetSpriteIndex(lastsprite);
}
state.sprite = spriteindex;
state.Misc1 = state.Misc2 = 0;
state.ParameterIndex = 0;
sc.MustGetString();
@ -623,13 +624,7 @@ do_stop:
}
sc.MustGetNumber();
sc.Number++;
state.Tics = sc.Number & 255;
state.Misc1 = (sc.Number >> 8) & 255;
if (state.Misc1)
{
state.Frame |= SF_BIGTIC;
}
state.Tics = clamp<int>(sc.Number, -1, 32767);
while (sc.GetString() && !sc.Crossed)
{
@ -640,10 +635,6 @@ do_stop:
}
if (sc.Compare("OFFSET"))
{
if (state.Frame & SF_BIGTIC)
{
sc.ScriptError("You cannot use OFFSET with a state duration larger than 254!");
}
// specify a weapon offset
sc.MustGetStringName("(");
sc.MustGetNumber();
@ -902,7 +893,7 @@ endofstate:
frame=0;
}
state.Frame=(state.Frame&(SF_FULLBRIGHT|SF_BIGTIC))|frame;
state.Frame=(state.Frame&(SF_FULLBRIGHT))|frame;
StateArray.Push(state);
count++;
}