- 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
{
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];
// These are for error reporting. We must store the file information because it's no longer available when these items get resolved.
FString filename;
@ -180,14 +181,15 @@ void FMapInfoParser::ParseDoomEdNums()
editem.special = -1;
}
memset(editem.args, 0, sizeof(editem.args));
editem.argsdefined = false;
int minargs = 0;
int maxargs = 5;
FString specialname;
if (sc.CheckString(","))
{
// todo: parse a special or args
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.
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;
if (!sc.CheckNumber())
{
sc.MustGetString();
@ -264,6 +266,7 @@ void InitActorNumsFromMapinfo()
FDoomEdEntry ent;
ent.Type = cls;
ent.Special = pair->Value.special;
ent.ArgsDefined = pair->Value.argsdefined;
memcpy(ent.Args, pair->Value.args, sizeof(ent.Args));
DoomEdMap.Insert(pair->Key, ent);
}

View File

@ -282,7 +282,8 @@ struct FActorInfo
struct FDoomEdEntry
{
const PClass *Type;
int Special;
short Special;
bool ArgsDefined;
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
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));
}