From dc00d61f4d40adc91669e6e81e41502a908c77c2 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Fri, 1 May 2015 08:32:07 -0500 Subject: [PATCH 1/4] - Added TF_OVERRIDE to A_Teleport. - Overrides the NOTELEPORT flag so actors with velocity don't need to disable it in order to perform A_Teleport, which could be screwed up by a teleporting line or sudden ACS interference. - Ensure that the result is set to false if it fails prematurely. Wasn't sure if this was needed, but with the upcoming if/else statements, better safe than sorry. --- src/thingdef/thingdef_codeptr.cpp | 14 ++++++++++++-- wadsrc/static/actors/constants.txt | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 21dc93036..23a6f58cf 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4249,6 +4249,7 @@ enum T_Flags TF_NODESTFOG = 0x00000080, // Don't spawn any fog at the arrival position. TF_USEACTORFOG = 0x00000100, // Use the actor's TeleFogSourceType and TeleFogDestType fogs. TF_NOJUMP = 0x00000200, // Don't jump after teleporting. + TF_OVERRIDE = 0x00000400, // Ignore NOTELEPORT. }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport) @@ -4270,8 +4271,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport) return; } - if (ref->flags2 & MF2_NOTELEPORT) + if ((ref->flags2 & MF2_NOTELEPORT) && !(Flags & TF_OVERRIDE)) + { + ACTION_SET_RESULT(false); return; + } // Randomly choose not to teleport like A_Srcr2Decide. if (Flags & TF_RANDOMDECIDE) @@ -4292,15 +4296,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport) } DSpotState *state = DSpotState::GetSpotState(); - if (state == NULL) + if (state == NULL) + { + ACTION_SET_RESULT(false); return; + } if (!TargetType) TargetType = PClass::FindClass("BossSpot"); AActor * spot = state->GetSpotWithMinMaxDistance(TargetType, ref->x, ref->y, MinDist, MaxDist); if (spot == NULL) + { + ACTION_SET_RESULT(false); return; + } fixed_t prevX = ref->x; fixed_t prevY = ref->y; diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 2ded98bc7..6612dd9f8 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -199,6 +199,7 @@ enum TF_NODESTFOG = 0x00000080, // Don't spawn any fog at the arrival position. TF_USEACTORFOG = 0x00000100, // Use the actor's TeleFogSourceType and TeleFogDestType fogs. TF_NOJUMP = 0x00000200, // Don't jump after teleporting. + TF_OVERRIDE = 0x00000400, // Ignore NOTELEPORT. TF_KEEPORIENTATION = TF_KEEPVELOCITY|TF_KEEPANGLE, TF_NOFOG = TF_NOSRCFOG|TF_NODESTFOG, From 247fd5b00857c42c51a4b5f94ed30dfd36e67ed3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 1 May 2015 20:27:04 +0200 Subject: [PATCH 2/4] - added missing 'id' property to udmf_zdoom.txt. --- specs/usdf_zdoom.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/specs/usdf_zdoom.txt b/specs/usdf_zdoom.txt index 217354292..839f9753a 100644 --- a/specs/usdf_zdoom.txt +++ b/specs/usdf_zdoom.txt @@ -63,6 +63,10 @@ either refuse loading dialogues with the 'ZDoom' namespace or if it does not outright abort on incompatible namespaces fail with a type mismatch error on one of the specified propeties. +In addition ZDoom defines one new field in the top level of a conversation block: + +id = ; Assigns a conversation ID for use in Thing_SetConversation or in UDMF's 'conversation' actor property. + ZDoom-format dialogues need to start with the line: namespace = "ZDoom"; From 4217c2ccd68699fcdaad9dadc252becd1e672294 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sat, 2 May 2015 13:46:34 +0200 Subject: [PATCH 3/4] - Fixed a very old bug in LookupLevelName code. If the map name neither matched 'ExMy', 'MAPxy' or 'LEVELxy', 'checkstring' was left uninitialized before using as argument to 'strstr', leading to undefined results. Spotted with Valgrind. --- src/g_mapinfo.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index 4d7b3c7d2..d26d2f45b 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -312,6 +312,10 @@ FString level_info_t::LookupLevelName() { mysnprintf (checkstring, countof(checkstring), "%d: ", atoi(&MapName[5])); } + else + { + checkstring[0] = '\0'; + } thename = strstr (lookedup, checkstring); if (thename == NULL) { From 353ace8be77d45b11708e054fb0edeb25c9ee4f0 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sat, 2 May 2015 14:18:52 +0200 Subject: [PATCH 4/4] - Improve the code readability in LookupLevelName. --- src/g_mapinfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index d26d2f45b..5a39d7dbb 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -314,10 +314,11 @@ FString level_info_t::LookupLevelName() } else { + // make sure nothing is stripped. checkstring[0] = '\0'; } thename = strstr (lookedup, checkstring); - if (thename == NULL) + if (thename == NULL || thename == lookedup) { thename = lookedup; }