mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +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
fcf004ec39
commit
33b343ef31
2 changed files with 29 additions and 0 deletions
|
@ -28,6 +28,12 @@ extend class Actor
|
||||||
return null, 0, 0;
|
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));
|
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);
|
Substitute (morphed);
|
||||||
if ((style & MRF_TRANSFERTRANSLATION) && !morphed.bDontTranslate)
|
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);
|
let eflash = Spawn(enter_flash ? enter_flash : (class<Actor>)("TeleportFog"), Pos + (0, 0, gameinfo.TELEFOGHEIGHT), ALLOW_REPLACE);
|
||||||
if (eflash)
|
if (eflash)
|
||||||
eflash.target = morphed;
|
eflash.target = morphed;
|
||||||
|
PostMorph(morphed.GetClass());
|
||||||
|
morphed.PostMorph(GetClass());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,11 @@ extend class PlayerPawn
|
||||||
}
|
}
|
||||||
|
|
||||||
let morphed = PlayerPawn(Spawn (spawntype, Pos, NO_REPLACE));
|
let morphed = PlayerPawn(Spawn (spawntype, Pos, NO_REPLACE));
|
||||||
|
|
||||||
|
// Use GetClass in the event someone actually allows replacements.
|
||||||
|
PreMorph(morphed.GetClass());
|
||||||
|
morphed.PreMorph(GetClass());
|
||||||
|
|
||||||
EndAllPowerupEffects();
|
EndAllPowerupEffects();
|
||||||
Substitute(morphed);
|
Substitute(morphed);
|
||||||
if ((style & MRF_TRANSFERTRANSLATION) && !morphed.bDontTranslate)
|
if ((style & MRF_TRANSFERTRANSLATION) && !morphed.bDontTranslate)
|
||||||
|
@ -211,6 +216,8 @@ extend class PlayerPawn
|
||||||
morphed.ScoreIcon = ScoreIcon; // [GRB]
|
morphed.ScoreIcon = ScoreIcon; // [GRB]
|
||||||
if (eflash)
|
if (eflash)
|
||||||
eflash.target = morphed;
|
eflash.target = morphed;
|
||||||
|
PostMorph(morphed.GetClass());
|
||||||
|
morphed.PostMorph(GetClass());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,6 +256,9 @@ extend class PlayerPawn
|
||||||
player.morphTics = 2*TICRATE;
|
player.morphTics = 2*TICRATE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
PreUnmorph(altmo.GetClass());
|
||||||
|
altmo.PreUnmorph(GetClass());
|
||||||
|
|
||||||
// No longer using tracer as morph storage. That is what 'alternative' is for.
|
// 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.
|
// If the tracer has changed on the morph, change the original too.
|
||||||
altmo.target = target;
|
altmo.target = target;
|
||||||
|
@ -395,6 +405,8 @@ extend class PlayerPawn
|
||||||
beastweap.Destroy ();
|
beastweap.Destroy ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PostUnmorph(altmo.GetClass());
|
||||||
|
altmo.PostUnmorph(GetClass());
|
||||||
Destroy ();
|
Destroy ();
|
||||||
// Restore playerclass armor to its normal amount.
|
// Restore playerclass armor to its normal amount.
|
||||||
let hxarmor = HexenArmor(altmo.FindInventory('HexenArmor'));
|
let hxarmor = HexenArmor(altmo.FindInventory('HexenArmor'));
|
||||||
|
@ -544,6 +556,8 @@ class MorphedMonster : Actor
|
||||||
UnmorphTime = level.time + 5*TICRATE; // Next try in 5 seconds
|
UnmorphTime = level.time + 5*TICRATE; // Next try in 5 seconds
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
PreUnmorph(unmorphed.GetClass());
|
||||||
|
unmorphed.PreUnmorph(GetClass());
|
||||||
unmorphed.Angle = Angle;
|
unmorphed.Angle = Angle;
|
||||||
unmorphed.target = target;
|
unmorphed.target = target;
|
||||||
unmorphed.bShadow = bShadow;
|
unmorphed.bShadow = bShadow;
|
||||||
|
@ -563,6 +577,8 @@ class MorphedMonster : Actor
|
||||||
unmorphed.args[4] = args[4];
|
unmorphed.args[4] = args[4];
|
||||||
unmorphed.CopyFriendliness (self, true);
|
unmorphed.CopyFriendliness (self, true);
|
||||||
unmorphed.bUnmorphed = false;
|
unmorphed.bUnmorphed = false;
|
||||||
|
PostUnmorph(unmorphed.GetClass());
|
||||||
|
unmorphed.PostUnmorph(GetClass());
|
||||||
UnmorphedMe = NULL;
|
UnmorphedMe = NULL;
|
||||||
Substitute(unmorphed);
|
Substitute(unmorphed);
|
||||||
Destroy ();
|
Destroy ();
|
||||||
|
|
Loading…
Reference in a new issue