diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index b8c66bb4..0efd64ab 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -30,6 +30,9 @@ protected: virtual void InitEffect (); virtual void DoEffect (); virtual void EndEffect (); + + friend void EndAllPowerupEffects(AInventory *item); + friend void InitAllPowerupEffects(AInventory *item); }; // An artifact is an item that gives the player a powerup when activated. diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index 0058c996..836cf41e 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -74,6 +74,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i } morphed = static_cast(Spawn (spawntype, actor->x, actor->y, actor->z, NO_REPLACE)); + EndAllPowerupEffects(actor->Inventory); DObject::StaticPointerSubstitution (actor, morphed); if ((actor->tid != 0) && (style & MORPH_NEWTIDBEHAVIOUR)) { @@ -144,6 +145,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i } item = next; } + InitAllPowerupEffects(morphed->Inventory); morphed->ActivateMorphWeapon (); if (p->camera == actor) { @@ -201,10 +203,8 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, } pmo->player = NULL; - mo->ObtainInventory (pmo); - DObject::StaticPointerSubstitution (pmo, mo); // Remove the morph power if the morph is being undone prematurely. - for (AInventory *item = mo->Inventory, *next = NULL; item != NULL; item = next) + for (AInventory *item = pmo->Inventory, *next = NULL; item != NULL; item = next) { next = item->Inventory; if (item->IsKindOf(RUNTIME_CLASS(APowerMorph))) @@ -213,6 +213,9 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, item->Destroy(); } } + EndAllPowerupEffects(pmo->Inventory); + mo->ObtainInventory (pmo); + DObject::StaticPointerSubstitution (pmo, mo); if ((pmo->tid != 0) && (player->MorphStyle & MORPH_NEWTIDBEHAVIOUR)) { mo->tid = pmo->tid; @@ -235,6 +238,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, mo->flags2 = (mo->flags2 & ~MF2_FLY) | (pmo->flags2 & MF2_FLY); mo->flags3 = (mo->flags3 & ~MF3_GHOST) | (pmo->flags3 & MF3_GHOST); mo->Score = pmo->Score; + InitAllPowerupEffects(mo->Inventory); const PClass *exit_flash = player->MorphExitFlash; bool correctweapon = !!(player->MorphStyle & MORPH_LOSEACTUALWEAPON); @@ -538,6 +542,46 @@ bool P_MorphedDeath(AActor *actor, AActor **morphed, int *morphedstyle, int *mor return false; } +//=========================================================================== +// +// EndAllPowerupEffects +// +// Calls EndEffect() on every Powerup in the inventory list. +// +//=========================================================================== + +void EndAllPowerupEffects(AInventory *item) +{ + while (item != NULL) + { + if (item->IsKindOf(RUNTIME_CLASS(APowerup))) + { + static_cast(item)->EndEffect(); + } + item = item->Inventory; + } +} + +//=========================================================================== +// +// InitAllPowerupEffects +// +// Calls InitEffect() on every Powerup in the inventory list. +// +//=========================================================================== + +void InitAllPowerupEffects(AInventory *item) +{ + while (item != NULL) + { + if (item->IsKindOf(RUNTIME_CLASS(APowerup))) + { + static_cast(item)->InitEffect(); + } + item = item->Inventory; + } +} + // Base class for morphing projectiles -------------------------------------- IMPLEMENT_CLASS(AMorphProjectile) diff --git a/src/r_3dfloors.cpp b/src/r_3dfloors.cpp index fbdc34ed..412a6057 100644 --- a/src/r_3dfloors.cpp +++ b/src/r_3dfloors.cpp @@ -140,6 +140,7 @@ void R_3D_EnterSkybox() height_top = NULL; height_cur = NULL; height_max = -1; + fakeActive = 0; CurrentSkybox++; } @@ -157,6 +158,7 @@ void R_3D_LeaveSkybox() height_top = current.height_top; height_cur = current.height_cur; height_max = current.height_max; + fakeActive = height_top != NULL; CurrentSkybox--; } diff --git a/src/r_main.cpp b/src/r_main.cpp index a5211a44..edb13d32 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -762,7 +762,7 @@ void R_RenderActorView (AActor *actor, bool dontmaplines) MaskedCycles.Reset(); WallScanCycles.Reset(); - fakeActive = 0; // kg3D - reset fake floor idicator + fakeActive = 0; // kg3D - reset fake floor indicator R_3D_ResetClip(); // reset clips (floor/ceiling) R_SetupBuffer (); diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 0e8237cb..d3c5f8c9 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -1002,15 +1002,15 @@ static void R_DrawSkyStriped (visplane_t *pl) CVAR (Bool, tilt, false, 0); //CVAR (Int, pa, 0, 0) -void R_DrawPlanes () +int R_DrawPlanes () { visplane_t *pl; int i; - int vpcount; + int vpcount = 0; ds_color = 3; - for (i = vpcount = 0; i < MAXVISPLANES; i++) + for (i = 0; i < MAXVISPLANES; i++) { for (pl = visplanes[i]; pl; pl = pl->next) { @@ -1024,6 +1024,7 @@ void R_DrawPlanes () } } } + return vpcount; } // kg3D - draw all visplanes with "height" @@ -1329,13 +1330,12 @@ void R_DrawSkyBoxes () for (*freehead = visplanes[MAXVISPLANES], visplanes[MAXVISPLANES] = NULL; *freehead; ) freehead = &(*freehead)->next; - } ADD_STAT(skyboxes) { FString out; - out.Format (out, "%d skybox planes", numskyboxes); + out.Format ("%d skybox planes", numskyboxes); return out; } diff --git a/src/r_plane.h b/src/r_plane.h index 6bcb36a1..7ad711bc 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -87,7 +87,7 @@ void R_InitPlanes (); void R_DeinitPlanes (); void R_ClearPlanes (bool fullclear); -void R_DrawPlanes (); +int R_DrawPlanes (); void R_DrawSkyBoxes (); void R_DrawSkyPlane (visplane_t *pl); void R_DrawNormalPlane (visplane_t *pl, fixed_t alpha, bool additive, bool masked); diff --git a/src/svnrevision.h b/src/svnrevision.h index c270fa31..d8066ff2 100644 --- a/src/svnrevision.h +++ b/src/svnrevision.h @@ -3,5 +3,5 @@ // This file was automatically generated by the // updaterevision tool. Do not edit by hand. -#define ZD_SVN_REVISION_STRING "4161" -#define ZD_SVN_REVISION_NUMBER 4161 +#define ZD_SVN_REVISION_STRING "4164" +#define ZD_SVN_REVISION_NUMBER 4164