- State parser fixes.

SVN r1255 (trunk)
This commit is contained in:
Christoph Oelckers 2008-10-05 18:45:05 +00:00
parent 9adef560c2
commit 0b120116ab
3 changed files with 8 additions and 4 deletions

View file

@ -59,12 +59,11 @@ extern void LoadDecorations ();
int GetSpriteIndex(const char * spritename) int GetSpriteIndex(const char * spritename)
{ {
// Make sure that the string is upper case and 4 characters long // Make sure that the string is upper case and 4 characters long
char upper[5]; char upper[5]={0,0,0,0,0};
for (int i = 0; spritename[i] != 0 && i < 4; i++) for (int i = 0; spritename[i] != 0 && i < 4; i++)
{ {
upper[i] = toupper (spritename[i]); upper[i] = toupper (spritename[i]);
} }
upper[4] = 0;
for (unsigned i = 0; i < sprites.Size (); ++i) for (unsigned i = 0; i < sprites.Size (); ++i)
{ {

View file

@ -540,6 +540,7 @@ void FStateDefinitions::MakeStateList(const FStateLabels *list, TArray<FStateDef
def.Label = list->Labels[i].Label; def.Label = list->Labels[i].Label;
def.State = list->Labels[i].State; def.State = list->Labels[i].State;
def.DefineFlags = SDF_STATE;
dest.Push(def); dest.Push(def);
if (list->Labels[i].Children != NULL) if (list->Labels[i].Children != NULL)
{ {
@ -721,10 +722,11 @@ void FStateDefinitions::FixStatePointers (FActorInfo *actor, TArray<FStateDefine
{ {
for(unsigned i=0;i<list.Size(); i++) for(unsigned i=0;i<list.Size(); i++)
{ {
size_t v=(size_t)list[i].State; if (list[i].DefineFlags == SDF_INDEX)
if (v >= 1 && v < 0x10000)
{ {
size_t v=(size_t)list[i].State;
list[i].State = actor->OwnedStates + v - 1; list[i].State = actor->OwnedStates + v - 1;
list[i].DefineFlags = SDF_STATE;
} }
if (list[i].Children.Size() > 0) FixStatePointers(actor, list[i].Children); if (list[i].Children.Size() > 0) FixStatePointers(actor, list[i].Children);
} }
@ -764,6 +766,8 @@ int FStateDefinitions::FinishStates (FActorInfo *actor, AActor *defaults, TArray
static int c=0; static int c=0;
int count = StateArray.Size(); int count = StateArray.Size();
DPrintf("Finishing states for %s\n", actor->Class->TypeName.GetChars());
if (count > 0) if (count > 0)
{ {
FState *realstates = new FState[count]; FState *realstates = new FState[count];

View file

@ -311,6 +311,7 @@ bool ParsePropertyParams(FScanner &sc, FPropertyInfo *prop, AActor *defaults, Ba
nocomma = false; nocomma = false;
conv.s = NULL; conv.s = NULL;
pref.s = NULL;
pref.i = -1; pref.i = -1;
switch ((*p) & 223) switch ((*p) & 223)
{ {