From 6ba839a0e92ef29821ac40e5a97de58b315705a7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 7 Jun 2009 20:10:05 +0000 Subject: [PATCH] - added PERSISTENTPOWER and TRANSFERPOINTERS submissions by Gez. SVN r1651 (trunk) --- docs/rh-log.txt | 1 + src/g_game.cpp | 3 ++- src/g_shared/a_pickups.h | 1 + src/thingdef/thingdef_codeptr.cpp | 9 ++++++++- src/thingdef/thingdef_data.cpp | 1 + wadsrc/static/actors/constants.txt | 1 + 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 7f24497b6..f837255ce 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ June 7, 2009 (Changes by Graf Zahl) +- added PERSISTENTPOWER and TRANSFERPOINTERS submissions by Gez. - fixed FORCEPAIN logic. - added Gez's infinite ammo powerup and random spawner fix patches. - reduced size of Hexen's flames to fix bug in Deathkings MAP01. diff --git a/src/g_game.cpp b/src/g_game.cpp index b139fa1f8..8f9b14541 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1104,7 +1104,8 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, bool resetinventory next = item->Inventory; if (item->IsKindOf (RUNTIME_CLASS(APowerup))) { - if (deathmatch || mode != FINISH_SameHub || !(item->ItemFlags & IF_HUBPOWER)) + if (deathmatch || ((mode != FINISH_SameHub || !(item->ItemFlags & IF_HUBPOWER)) + && !(item->ItemFlags & IF_PERSISTENTPOWER))) // Keep persistent powers in non-deathmatch games { item->Destroy (); } diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index bea7be533..ef100357e 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -129,6 +129,7 @@ enum IF_CREATECOPYMOVED = 1<<15, // CreateCopy changed the owner (copy's Owner field holds new owner). IF_INITEFFECTFAILED = 1<<16, // CreateCopy tried to activate a powerup and activation failed (can happen with PowerMorph) IF_NOATTENPICKUPSOUND = 1<<17, // Play pickup sound with ATTN_NONE + IF_PERSISTENTPOWER = 1<<18, // Powerup is kept when travelling between levels }; struct vissprite_t; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index ef43feac0..4a5c3f3b7 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1317,6 +1317,7 @@ enum SIX_Flags // 128 is used by Skulltag! SIXF_TRANSFERAMBUSHFLAG=256, SIXF_TRANSFERPITCH=512, + SIXF_TRANSFERPOINTERS=1024, }; @@ -1330,6 +1331,12 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags) { mo->Translation = self->Translation; } + if (flags & SIXF_TRANSFERPOINTERS) + { + mo->target = self->target; + mo->master = self->master; // This will be overridden later if SIXF_SETMASTER is set + mo->tracer = self->tracer; + } mo->angle=self->angle; if (flags & SIXF_TRANSFERPITCH) mo->pitch = self->pitch; @@ -1378,7 +1385,7 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags) } } } - else + else if (!(flags & SIXF_TRANSFERPOINTERS)) { // If this is a missile or something else set the target to the originator mo->target=originator? originator : self; diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 9585af9eb..986135592 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -255,6 +255,7 @@ static FFlagDef InventoryFlags[] = DEFINE_FLAG(IF, IGNORESKILL, AInventory, ItemFlags), DEFINE_FLAG(IF, ADDITIVETIME, AInventory, ItemFlags), DEFINE_FLAG(IF, NOATTENPICKUPSOUND, AInventory, ItemFlags), + DEFINE_FLAG(IF, PERSISTENTPOWER, AInventory, ItemFlags), DEFINE_DEPRECATED_FLAG(PICKUPFLASH), diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 97f5c3068..14e9078f4 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -16,6 +16,7 @@ const int SXF_TELEFRAG=64; const int SXF_CLIENTSPAWN=128; // only used by Skulltag const int SXF_TRANSFERAMBUSHFLAG=256; const int SXF_TRANSFERPITCH=512; +const int SXF_TRANSFERPOINTERS=1024; // Flags for A_Chase const int CHF_FASTCHASE = 1;