From 69a00ddabbc300bf4f54ac85118af47fd565ad9e Mon Sep 17 00:00:00 2001 From: Blue-Shadow Date: Fri, 22 Jul 2016 16:21:15 +0300 Subject: [PATCH] Added TRANSFERTRANSLATION morph flag --- src/g_shared/a_morph.cpp | 8 ++++++++ src/g_shared/a_morph.h | 1 + src/thingdef/thingdef_parse.cpp | 1 + wadsrc/static/actors/constants.txt | 1 + 4 files changed, 11 insertions(+) diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index d0e807c3e..98af9ff25 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -81,6 +81,10 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp morphed = static_cast(Spawn (spawntype, actor->Pos(), NO_REPLACE)); EndAllPowerupEffects(actor->Inventory); DObject::StaticPointerSubstitution (actor, morphed); + if ((style & MORPH_TRANSFERTRANSLATION) && !(morphed->flags2 & MF2_DONTTRANSLATE)) + { + morphed->Translation = actor->Translation; + } if ((actor->tid != 0) && (style & MORPH_NEWTIDBEHAVIOUR)) { morphed->tid = actor->tid; @@ -382,6 +386,10 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st morphed = static_cast(Spawn (spawntype, actor->Pos(), NO_REPLACE)); DObject::StaticPointerSubstitution (actor, morphed); + if ((style & MORPH_TRANSFERTRANSLATION) && !(morphed->flags2 & MF2_DONTTRANSLATE)) + { + morphed->Translation = actor->Translation; + } morphed->tid = actor->tid; morphed->Angles.Yaw = actor->Angles.Yaw; morphed->UnmorphedMe = actor; diff --git a/src/g_shared/a_morph.h b/src/g_shared/a_morph.h index f797c75e6..e770e418e 100644 --- a/src/g_shared/a_morph.h +++ b/src/g_shared/a_morph.h @@ -25,6 +25,7 @@ enum MORPH_UNDOBYDEATHSAVES = 0x00000800, // Actor (if unmorphed when killed) regains their health and doesn't die MORPH_UNDOBYTIMEOUT = 0x00001000, // Player unmorphs once countdown expires MORPH_UNDOALWAYS = 0x00002000, // Powerups must always unmorph, no matter what. + MORPH_TRANSFERTRANSLATION = 0x00004000, // Transfer translation from the original actor to the morphed one MORPH_STANDARDUNDOING = MORPH_UNDOBYTOMEOFPOWER | MORPH_UNDOBYCHAOSDEVICE | MORPH_UNDOBYTIMEOUT, }; diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index c97930277..f4bad69bb 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -710,6 +710,7 @@ static int ParseMorphStyle (FScanner &sc) { "MRF_UNDOBYDEATHFORCED", MORPH_UNDOBYDEATHFORCED}, { "MRF_UNDOBYDEATHSAVES", MORPH_UNDOBYDEATHSAVES}, { "MRF_UNDOALWAYS", MORPH_UNDOALWAYS }, + { "MRF_TRANSFERTRANSLATION", MORPH_TRANSFERTRANSLATION }, { NULL, 0 } }; diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 8fbcd78e8..e11f3d0bb 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -164,6 +164,7 @@ const int MRF_UNDOBYDEATH = 512; const int MRF_UNDOBYDEATHFORCED = 1024; const int MRF_UNDOBYDEATHSAVES = 2048; const int MRF_UNDOALWAYS = 4096; +const int MRF_TRANSFERTRANSLATION = 8192; // Flags for A_RailAttack and A_CustomRailgun const int RGF_SILENT = 1;