mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-15 17:11:24 +00:00
Added Pre(Un)Morph and Post(Un)Morph functions.
- cls: The other class's cast type which the actor is transitioning from/to.
This commit is contained in:
parent
dde31dcac4
commit
8712d7c237
2 changed files with 29 additions and 0 deletions
|
@ -28,6 +28,12 @@ extend class Actor
|
|||
return null, 0, 0;
|
||||
}
|
||||
|
||||
// [MC] Called when an actor morphs, on both the previous form (passive) and present form (!passive).
|
||||
// 'cls' points to the other class they transitioned from/to.
|
||||
virtual void PreMorph(Class<Actor> cls) {}
|
||||
virtual void PostMorph(Class<Actor> cls) {}
|
||||
virtual void PreUnmorph(Class<Actor> cls) {}
|
||||
virtual void PostUnmorph(Class<Actor> cls) {}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -105,6 +111,11 @@ extend class Actor
|
|||
}
|
||||
|
||||
let morphed = MorphedMonster(Spawn (spawntype, Pos, NO_REPLACE));
|
||||
|
||||
// Use GetClass in the event someone actually allows replacements.
|
||||
PreMorph(morphed.GetClass());
|
||||
morphed.PreMorph(GetClass());
|
||||
|
||||
Substitute (morphed);
|
||||
if ((style & MRF_TRANSFERTRANSLATION) && !morphed.bDontTranslate)
|
||||
{
|
||||
|
@ -140,6 +151,8 @@ extend class Actor
|
|||
let eflash = Spawn(enter_flash ? enter_flash : (class<Actor>)("TeleportFog"), Pos + (0, 0, gameinfo.TELEFOGHEIGHT), ALLOW_REPLACE);
|
||||
if (eflash)
|
||||
eflash.target = morphed;
|
||||
PostMorph(morphed.GetClass());
|
||||
morphed.PostMorph(GetClass());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,6 +138,11 @@ extend class PlayerPawn
|
|||
}
|
||||
|
||||
let morphed = PlayerPawn(Spawn (spawntype, Pos, NO_REPLACE));
|
||||
|
||||
// Use GetClass in the event someone actually allows replacements.
|
||||
PreMorph(morphed.GetClass());
|
||||
morphed.PreMorph(GetClass());
|
||||
|
||||
EndAllPowerupEffects();
|
||||
Substitute(morphed);
|
||||
if ((style & MRF_TRANSFERTRANSLATION) && !morphed.bDontTranslate)
|
||||
|
@ -211,6 +216,8 @@ extend class PlayerPawn
|
|||
morphed.ScoreIcon = ScoreIcon; // [GRB]
|
||||
if (eflash)
|
||||
eflash.target = morphed;
|
||||
PostMorph(morphed.GetClass());
|
||||
morphed.PostMorph(GetClass());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -249,6 +256,9 @@ extend class PlayerPawn
|
|||
player.morphTics = 2*TICRATE;
|
||||
return false;
|
||||
}
|
||||
PreUnmorph(altmo.GetClass());
|
||||
altmo.PreUnmorph(GetClass());
|
||||
|
||||
// No longer using tracer as morph storage. That is what 'alternative' is for.
|
||||
// If the tracer has changed on the morph, change the original too.
|
||||
altmo.target = target;
|
||||
|
@ -395,6 +405,8 @@ extend class PlayerPawn
|
|||
beastweap.Destroy ();
|
||||
}
|
||||
}
|
||||
PostUnmorph(altmo.GetClass());
|
||||
altmo.PostUnmorph(GetClass());
|
||||
Destroy ();
|
||||
// Restore playerclass armor to its normal amount.
|
||||
let hxarmor = HexenArmor(altmo.FindInventory('HexenArmor'));
|
||||
|
@ -544,6 +556,8 @@ class MorphedMonster : Actor
|
|||
UnmorphTime = level.time + 5*TICRATE; // Next try in 5 seconds
|
||||
return false;
|
||||
}
|
||||
PreUnmorph(unmorphed.GetClass());
|
||||
unmorphed.PreUnmorph(GetClass());
|
||||
unmorphed.Angle = Angle;
|
||||
unmorphed.target = target;
|
||||
unmorphed.bShadow = bShadow;
|
||||
|
@ -563,6 +577,8 @@ class MorphedMonster : Actor
|
|||
unmorphed.args[4] = args[4];
|
||||
unmorphed.CopyFriendliness (self, true);
|
||||
unmorphed.bUnmorphed = false;
|
||||
PostUnmorph(unmorphed.GetClass());
|
||||
unmorphed.PostUnmorph(GetClass());
|
||||
UnmorphedMe = NULL;
|
||||
Substitute(unmorphed);
|
||||
Destroy ();
|
||||
|
|
Loading…
Reference in a new issue