- fixed handling of args for non-actor mapthings again. As it turns out there was insufficient information in the data to properly decide this case so a new flag was added to make it all more reliable.

This commit is contained in:
Christoph Oelckers 2015-04-07 16:27:57 +02:00
parent 268e7df992
commit c5a4221b58
3 changed files with 10 additions and 6 deletions

View File

@ -80,7 +80,8 @@ const char *SpecialMapthingNames[] = {
struct MapinfoEdMapItem struct MapinfoEdMapItem
{ {
FName classname; // DECORATE is read after MAPINFO so we do not have the actual classes available here yet. FName classname; // DECORATE is read after MAPINFO so we do not have the actual classes available here yet.
int special; short special;
bool argsdefined;
int args[5]; int args[5];
// These are for error reporting. We must store the file information because it's no longer available when these items get resolved. // These are for error reporting. We must store the file information because it's no longer available when these items get resolved.
FString filename; FString filename;
@ -180,14 +181,15 @@ void FMapInfoParser::ParseDoomEdNums()
editem.special = -1; editem.special = -1;
} }
memset(editem.args, 0, sizeof(editem.args)); memset(editem.args, 0, sizeof(editem.args));
editem.argsdefined = false;
int minargs = 0; int minargs = 0;
int maxargs = 5; int maxargs = 5;
FString specialname; FString specialname;
if (sc.CheckString(",")) if (sc.CheckString(","))
{ {
// todo: parse a special or args editem.argsdefined = true; // mark args as used - if this is done we need to prevent assignment of map args in P_SpawnMapThing.
if (editem.special < 0) editem.special = 0; // mark args as used - if this is done we need to prevent assignment of map args in P_SpawnMapThing. if (editem.special < 0) editem.special = 0;
if (!sc.CheckNumber()) if (!sc.CheckNumber())
{ {
sc.MustGetString(); sc.MustGetString();
@ -264,6 +266,7 @@ void InitActorNumsFromMapinfo()
FDoomEdEntry ent; FDoomEdEntry ent;
ent.Type = cls; ent.Type = cls;
ent.Special = pair->Value.special; ent.Special = pair->Value.special;
ent.ArgsDefined = pair->Value.argsdefined;
memcpy(ent.Args, pair->Value.args, sizeof(ent.Args)); memcpy(ent.Args, pair->Value.args, sizeof(ent.Args));
DoomEdMap.Insert(pair->Key, ent); DoomEdMap.Insert(pair->Key, ent);
} }

View File

@ -282,7 +282,8 @@ struct FActorInfo
struct FDoomEdEntry struct FDoomEdEntry
{ {
const PClass *Type; const PClass *Type;
int Special; short Special;
bool ArgsDefined;
int Args[5]; int Args[5];
}; };

View File

@ -4617,9 +4617,9 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
} }
// copy args to mapthing so that we have them in one place for the rest of this function // copy args to mapthing so that we have them in one place for the rest of this function
if (mentry->Type != NULL && mentry->Special >= 0) if (mentry->ArgsDefined)
{ {
mthing->special = mentry->Special; if (mentry->Type!= NULL) mthing->special = mentry->Special;
memcpy(mthing->args, mentry->Args, sizeof(mthing->args)); memcpy(mthing->args, mentry->Args, sizeof(mthing->args));
} }