* Updated to ZDoom 4164:

- Properly transfer powerups between morphed and unmorphed actors by calling EndEffect() on the powerups before they transfer ownership, then calling InitEffect() on them after they transfer ownership.
- Fixed: stat skyboxes output was broken.
- Fixed: Skyboxes never cleared planes when a 3D floor was in view.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1532 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2013-02-24 14:23:58 +00:00
parent 5f6aad30f5
commit 4ee531e60c
7 changed files with 61 additions and 12 deletions

View file

@ -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.

View file

@ -74,6 +74,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i
}
morphed = static_cast<APlayerPawn *>(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<APowerup *>(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<APowerup *>(item)->InitEffect();
}
item = item->Inventory;
}
}
// Base class for morphing projectiles --------------------------------------
IMPLEMENT_CLASS(AMorphProjectile)

View file

@ -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--;
}

View file

@ -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 ();

View file

@ -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;
}

View file

@ -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);

View file

@ -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