- scriptified MorphProjectile and CustomSprite.

This should for now conclude actor class scriptification. The remaining ten classes with the exception of MorphedMonster are all too essential or too closely tied to engine feature so they should remain native.
This commit is contained in:
Christoph Oelckers 2017-01-20 01:11:36 +01:00
commit c880b26d98
12 changed files with 83 additions and 160 deletions

View file

@ -157,13 +157,13 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
DEFINE_ACTION_FUNCTION(_PlayerInfo, MorphPlayer)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
PARAM_POINTER(victim, player_t);
PARAM_POINTER(activator, player_t);
PARAM_CLASS(spawntype, APlayerPawn);
PARAM_INT(duration);
PARAM_INT(style);
PARAM_CLASS_DEF(enter_flash, AActor);
PARAM_CLASS_DEF(exit_flash, AActor);
ACTION_RETURN_BOOL(P_MorphPlayer(self, victim, spawntype, duration, style, enter_flash, exit_flash));
ACTION_RETURN_BOOL(P_MorphPlayer(activator, self, spawntype, duration, style, enter_flash, exit_flash));
}
//----------------------------------------------------------------------------
@ -396,7 +396,7 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st
if (actor == NULL || actor->player || spawntype == NULL ||
actor->flags3 & MF3_DONTMORPH ||
!(actor->flags3 & MF3_ISMONSTER) ||
!spawntype->IsDescendantOf (RUNTIME_CLASS(AMorphedMonster)))
!spawntype->IsDescendantOf (PClass::FindActor(NAME_MorphedMonster)))
{
return false;
}
@ -440,6 +440,17 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st
return true;
}
DEFINE_ACTION_FUNCTION(AActor, MorphMonster)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS(spawntype, APlayerPawn);
PARAM_INT(duration);
PARAM_INT(style);
PARAM_CLASS_DEF(enter_flash, AActor);
PARAM_CLASS_DEF(exit_flash, AActor);
ACTION_RETURN_BOOL(P_MorphMonster(self, spawntype, duration, style, enter_flash, exit_flash));
}
//----------------------------------------------------------------------------
//
// FUNC P_UndoMonsterMorph
@ -635,50 +646,6 @@ void InitAllPowerupEffects(AInventory *item)
}
}
// Base class for morphing projectiles --------------------------------------
IMPLEMENT_CLASS(AMorphProjectile, false, true)
IMPLEMENT_POINTERS_START(AMorphProjectile)
IMPLEMENT_POINTER(PlayerClass)
IMPLEMENT_POINTER(MonsterClass)
IMPLEMENT_POINTER(MorphFlash)
IMPLEMENT_POINTER(UnMorphFlash)
IMPLEMENT_POINTERS_END
DEFINE_FIELD(AMorphProjectile, PlayerClass)
DEFINE_FIELD(AMorphProjectile, MonsterClass)
DEFINE_FIELD(AMorphProjectile, MorphFlash)
DEFINE_FIELD(AMorphProjectile, UnMorphFlash)
DEFINE_FIELD(AMorphProjectile, Duration)
DEFINE_FIELD(AMorphProjectile, MorphStyle)
int AMorphProjectile::DoSpecialDamage (AActor *target, int damage, FName damagetype)
{
if (target->player)
{
P_MorphPlayer (NULL, target->player, PlayerClass, Duration, MorphStyle, MorphFlash, UnMorphFlash);
}
else
{
P_MorphMonster (target, MonsterClass, Duration, MorphStyle, MorphFlash, UnMorphFlash);
}
return -1;
}
void AMorphProjectile::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
auto def = (AMorphProjectile*)GetDefault();
arc("playerclass", PlayerClass, def->PlayerClass)
("monsterclass", MonsterClass, def->MonsterClass)
("duration", Duration, def->Duration)
("morphstyle", MorphStyle, def->MorphStyle)
("morphflash", MorphFlash, def->MorphFlash)
("unmorphflash", UnMorphFlash, def->UnMorphFlash);
}
// Morphed Monster (you must subclass this to do something useful) ---------
IMPLEMENT_CLASS(AMorphedMonster, false, true)