From c8cd11422a3384025fc0c2d23f66366703564e3d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers <coelckers@users.noreply.github.com> Date: Sun, 27 Jan 2019 16:09:05 +0100 Subject: [PATCH] - translate UMAPINFO specials at execution time, not load time. At load time the context for translation does not exist. --- src/p_enemy.cpp | 16 ++++++++++++++-- src/umapinfo.cpp | 10 +++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index aa8eb93d13..bc1341d1fa 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -3087,8 +3087,20 @@ void A_BossDeath(AActor *self) } checked = true; - P_ExecuteSpecial(sa->Action, NULL, self, false, - sa->Args[0], sa->Args[1], sa->Args[2], sa->Args[3], sa->Args[4]); + if (sa->Action & 0x40000000) + { + // This is a Doom format special from UMAPINFO. It must be translated here, because at parsing time there is not sufficient context to do it. + maplinedef_t ml; + ml.special = sa->Action & 0x3fffffff; + ml.tag = sa->Args[0]; + line_t line; + self->Level->TranslateLineDef(&line, &ml); + P_ExecuteSpecial(line.special, NULL, self, false, line.args[0], line.args[1], line.args[2], line.args[3], line.args[4]); + } + else + { + P_ExecuteSpecial(sa->Action, NULL, self, false, sa->Args[0], sa->Args[1], sa->Args[2], sa->Args[3], sa->Args[4]); + } } } diff --git a/src/umapinfo.cpp b/src/umapinfo.cpp index eccace0d6b..c981fc44f8 100644 --- a/src/umapinfo.cpp +++ b/src/umapinfo.cpp @@ -274,14 +274,10 @@ static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape) #pragma message("Fixme: This needs to be evaluated at run time") if (tag != 0 || special == 11 || special == 51 || special == 52 || special == 124) { + // This cannot be evaluated here because this needs to be done in the context of the level being used. FSpecialAction & bossact = mape->BossActions[mape->BossActions.Reserve(1)]; - line_t line; - maplinedef_t mld; - mld.special = special; - mld.tag = tag; - //level.TranslateLineDef(&line, &mld); - bossact = { type, (uint8_t)line.special, {line.args[0], line.args[1],line.args[2],line.args[3],line.args[4]} }; - } + bossact = { type, special | 0x40000000, tag }; + }; } } else