From c5a4221b587bf7d5a9f7cfc42c1a6ead720c2722 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 7 Apr 2015 16:27:57 +0200 Subject: [PATCH] - 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. --- src/g_doomedmap.cpp | 9 ++++++--- src/info.h | 3 ++- src/p_mobj.cpp | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/g_doomedmap.cpp b/src/g_doomedmap.cpp index 131ddd076f..c9deb72565 100644 --- a/src/g_doomedmap.cpp +++ b/src/g_doomedmap.cpp @@ -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); } diff --git a/src/info.h b/src/info.h index 8eed93e48d..bdbb69940e 100644 --- a/src/info.h +++ b/src/info.h @@ -282,7 +282,8 @@ struct FActorInfo struct FDoomEdEntry { const PClass *Type; - int Special; + short Special; + bool ArgsDefined; int Args[5]; }; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e3317e1a26..2571413c85 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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)); }