From f759b6757aa9ab92e9e50e9e4adca6a2569d5756 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 13 Jan 2017 23:17:04 +0100 Subject: [PATCH] - scriptified the teleport fog. --- src/g_shared/a_morph.cpp | 8 ++++---- src/g_shared/a_sharedglobal.h | 7 ------- src/gl/dynlights/a_dynlight.cpp | 8 ++++---- src/p_teleport.cpp | 22 ---------------------- wadsrc/static/zscript/shared/teleport.txt | 23 ++++++++++++++++++++++- 5 files changed, 30 insertions(+), 38 deletions(-) diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index 0ca8e3945..bb03ff489 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -116,7 +116,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp morphed->flags |= actor->flags & (MF_SHADOW|MF_NOGRAVITY); morphed->flags2 |= actor->flags2 & MF2_FLY; morphed->flags3 |= actor->flags3 & MF3_GHOST; - AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE); + AActor *eflash = Spawn(((enter_flash) ? enter_flash : PClass::FindActor("TeleportFog")), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE); actor->player = nullptr; actor->alternative = morphed; actor->flags &= ~(MF_SOLID|MF_SHOOTABLE); @@ -128,7 +128,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp p->MorphedPlayerClass = spawntype; p->MorphStyle = style; - p->MorphExitFlash = (exit_flash) ? exit_flash : RUNTIME_CLASS(ATeleportFog); + p->MorphExitFlash = (exit_flash) ? exit_flash : PClass::FindActor("TeleportFog"); p->health = morphed->health; p->mo = morphed; p->Vel.X = p->Vel.Y = 0; @@ -416,7 +416,7 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st morphed->UnmorphTime = level.time + ((duration) ? duration : MORPHTICS) + pr_morphmonst(); morphed->MorphStyle = style; - morphed->MorphExitFlash = (exit_flash) ? exit_flash : RUNTIME_CLASS(ATeleportFog); + morphed->MorphExitFlash = (exit_flash) ? exit_flash : PClass::FindActor("TeleportFog"); morphed->FlagsSave = actor->flags & ~MF_JUSTHIT; morphed->special = actor->special; memcpy (morphed->args, actor->args, sizeof(actor->args)); @@ -434,7 +434,7 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st actor->flags &= ~(MF_SOLID|MF_SHOOTABLE); actor->flags |= MF_UNMORPHED; actor->renderflags |= RF_INVISIBLE; - AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE); + AActor *eflash = Spawn(((enter_flash) ? enter_flash : PClass::FindActor("TeleportFog")), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE); if (eflash) eflash->target = morphed; return true; diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index 93e0c7e0e..bee819dd0 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -76,13 +76,6 @@ private: DImpactDecal(); }; -class ATeleportFog : public AActor -{ - DECLARE_CLASS (ATeleportFog, AActor) -public: - void PostBeginPlay (); -}; - class ASkyViewpoint : public AActor { DECLARE_CLASS (ASkyViewpoint, AActor) diff --git a/src/gl/dynlights/a_dynlight.cpp b/src/gl/dynlights/a_dynlight.cpp index 98b5d1315..a844d4880 100644 --- a/src/gl/dynlights/a_dynlight.cpp +++ b/src/gl/dynlights/a_dynlight.cpp @@ -109,10 +109,10 @@ DEFINE_CLASS_PROPERTY(type, S, DynamicLight) // which is controlled by flags // //========================================================================== -IMPLEMENT_CLASS (ADynamicLight, false, false) -IMPLEMENT_CLASS (AVavoomLight, false, false) -IMPLEMENT_CLASS (AVavoomLightWhite, false, false) -IMPLEMENT_CLASS (AVavoomLightColor, false, false) +IMPLEMENT_CLASS(ADynamicLight, false, false) +IMPLEMENT_CLASS(AVavoomLight, false, false) +IMPLEMENT_CLASS(AVavoomLightWhite, false, false) +IMPLEMENT_CLASS(AVavoomLightColor, false, false) void AVavoomLight::BeginPlay () { diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 5eb63e4ce..b34b4de1d 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -48,28 +48,6 @@ extern void P_CalcHeight (player_t *player); CVAR (Bool, telezoom, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); -IMPLEMENT_CLASS(ATeleportFog, false, false) - -void ATeleportFog::PostBeginPlay () -{ - Super::PostBeginPlay (); - S_Sound (this, CHAN_BODY, "misc/teleport", 1, ATTN_NORM); - switch (gameinfo.gametype) - { - case GAME_Hexen: - case GAME_Heretic: - SetState(FindState(NAME_Raven)); - break; - - case GAME_Strife: - SetState(FindState(NAME_Strife)); - break; - - default: - break; - } -} - //========================================================================== // // P_SpawnTeleportFog diff --git a/wadsrc/static/zscript/shared/teleport.txt b/wadsrc/static/zscript/shared/teleport.txt index 55308415f..acf4a6d75 100644 --- a/wadsrc/static/zscript/shared/teleport.txt +++ b/wadsrc/static/zscript/shared/teleport.txt @@ -1,5 +1,5 @@ -class TeleportFog : Actor native +class TeleportFog : Actor { default { @@ -22,6 +22,27 @@ class TeleportFog : Actor native TFOG ABCDEFEDCB 6 Bright; Stop; } + + override void PostBeginPlay () + { + Super.PostBeginPlay (); + A_PlaySound ("misc/teleport", CHAN_BODY); + switch (gametype()) + { + case GAME_Hexen: + case GAME_Heretic: + SetStateLabel("Raven"); + break; + + case GAME_Strife: + SetStateLabel("Strife"); + break; + + default: + break; + } + } + }