From a13e23dbe65328c6e0f587d8fd3ba6d6244b4ce5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 29 Nov 2016 19:50:34 +0100 Subject: [PATCH] - scriptified some trivial stuff from g_shared. --- src/CMakeLists.txt | 6 -- src/am_map.cpp | 4 +- src/dthinker.cpp | 7 ++ src/g_shared/a_action.cpp | 77 ------------------- src/g_shared/a_action.h | 29 ------- src/g_shared/a_hatetarget.cpp | 76 ------------------ src/g_shared/a_mapmarker.cpp | 69 ----------------- src/g_shared/a_randomspawner.cpp | 1 - src/g_shared/a_secrettrigger.cpp | 66 ---------------- src/g_shared/a_setcolor.cpp | 33 -------- src/g_shared/a_sharedglobal.h | 9 --- src/g_shared/a_spark.cpp | 55 ------------- src/g_shared/a_waterzone.cpp | 53 ------------- src/p_actionfunctions.cpp | 1 - src/p_effect.cpp | 10 +++ src/p_enemy.cpp | 1 - src/p_mobj.cpp | 1 - src/p_sectors.cpp | 20 +++++ src/p_spec.cpp | 9 +++ src/scripting/decorate/olddecorations.cpp | 1 - src/scripting/decorate/thingdef_states.cpp | 1 - src/scripting/thingdef.cpp | 1 - src/scripting/thingdef_properties.cpp | 1 - wadsrc/static/zscript/actor.txt | 3 +- wadsrc/static/zscript/base.txt | 58 ++++++++++++-- wadsrc/static/zscript/raven/minotaur.txt | 47 +++++++++++ wadsrc/static/zscript/shared/hatetarget.txt | 30 +++++++- wadsrc/static/zscript/shared/mapmarker.txt | 33 +++++++- .../static/zscript/shared/secrettrigger.txt | 16 +++- wadsrc/static/zscript/shared/setcolor.txt | 21 ++++- wadsrc/static/zscript/shared/sharedmisc.txt | 18 ++++- wadsrc/static/zscript/shared/spark.txt | 10 ++- wadsrc/static/zscript/shared/waterzone.txt | 11 ++- 33 files changed, 276 insertions(+), 502 deletions(-) delete mode 100644 src/g_shared/a_action.h delete mode 100644 src/g_shared/a_hatetarget.cpp delete mode 100644 src/g_shared/a_mapmarker.cpp delete mode 100644 src/g_shared/a_secrettrigger.cpp delete mode 100644 src/g_shared/a_setcolor.cpp delete mode 100644 src/g_shared/a_spark.cpp delete mode 100644 src/g_shared/a_waterzone.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 071fc5ce7..111b2663c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1116,25 +1116,19 @@ set (PCH_SOURCES g_shared/a_fastprojectile.cpp g_shared/a_flashfader.cpp g_shared/a_fountain.cpp - g_shared/a_hatetarget.cpp g_shared/a_keys.cpp g_shared/a_lightning.cpp - g_shared/a_mapmarker.cpp g_shared/a_morph.cpp g_shared/a_movingcamera.cpp g_shared/a_pickups.cpp g_shared/a_puzzleitems.cpp g_shared/a_quake.cpp g_shared/a_randomspawner.cpp - g_shared/a_secrettrigger.cpp g_shared/a_sectoraction.cpp - g_shared/a_setcolor.cpp g_shared/a_skies.cpp g_shared/a_soundenvironment.cpp g_shared/a_soundsequence.cpp - g_shared/a_spark.cpp g_shared/a_specialspot.cpp - g_shared/a_waterzone.cpp g_shared/a_weaponpiece.cpp g_shared/a_weapons.cpp g_shared/hudmessages.cpp diff --git a/src/am_map.cpp b/src/am_map.cpp index d74927b68..99fda3bd6 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2963,8 +2963,8 @@ void AM_drawAuthorMarkers () // [RH] Draw any actors derived from AMapMarker on the automap. // If args[0] is 0, then the actor's sprite is drawn at its own location. // Otherwise, its sprite is drawn at the location of any actors whose TIDs match args[0]. - TThinkerIterator it (STAT_MAPMARKER); - AMapMarker *mark; + TThinkerIterator it ("MapMarker", STAT_MAPMARKER); + AActor *mark; while ((mark = it.Next()) != NULL) { diff --git a/src/dthinker.cpp b/src/dthinker.cpp index d214b28e9..7c8bf1bf5 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -387,6 +387,13 @@ void DThinker::ChangeStatNum (int statnum) list->AddTail(this); } +DEFINE_ACTION_FUNCTION(DThinker, ChangeStatNum) +{ + PARAM_SELF_PROLOGUE(DThinker); + PARAM_INT(stat); + self->ChangeStatNum(stat); + return 0; +} //========================================================================== // // Mark the first thinker of each list diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index 3938a9743..afe188019 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -1,7 +1,6 @@ #include "actor.h" #include "p_conversation.h" #include "p_lnspec.h" -#include "a_action.h" #include "m_random.h" #include "s_sound.h" #include "d_player.h" @@ -18,39 +17,6 @@ static FRandom pr_icesettics ("IceSetTics"); static FRandom pr_freeze ("FreezeDeathChunks"); -// SwitchableDecoration: Activate and Deactivate change state --------------- - -class ASwitchableDecoration : public AActor -{ - DECLARE_CLASS (ASwitchableDecoration, AActor) -public: - void Activate (AActor *activator); - void Deactivate (AActor *activator); -}; - -IMPLEMENT_CLASS(ASwitchableDecoration, false, false) - -void ASwitchableDecoration::Activate (AActor *activator) -{ - SetState (FindState(NAME_Active)); -} - -void ASwitchableDecoration::Deactivate (AActor *activator) -{ - SetState (FindState(NAME_Inactive)); -} - -// SwitchingDecoration: Only Activate changes state ------------------------- - -class ASwitchingDecoration : public ASwitchableDecoration -{ - DECLARE_CLASS (ASwitchingDecoration, ASwitchableDecoration) -public: - void Deactivate (AActor *activator) {} -}; - -IMPLEMENT_CLASS(ASwitchingDecoration, false, false) - //---------------------------------------------------------------------------- // // PROC A_NoBlocking @@ -412,46 +378,3 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeQueueCorpse) return 0; } -//=========================================================================== -// -// FaceMovementDirection -// -//=========================================================================== - -void FaceMovementDirection(AActor *actor) -{ - switch (actor->movedir) - { - case DI_EAST: - actor->Angles.Yaw = 0.; - break; - case DI_NORTHEAST: - actor->Angles.Yaw = 45.; - break; - case DI_NORTH: - actor->Angles.Yaw = 90.; - break; - case DI_NORTHWEST: - actor->Angles.Yaw = 135.; - break; - case DI_WEST: - actor->Angles.Yaw = 180.; - break; - case DI_SOUTHWEST: - actor->Angles.Yaw = 225.; - break; - case DI_SOUTH: - actor->Angles.Yaw = 270.; - break; - case DI_SOUTHEAST: - actor->Angles.Yaw = 315.; - break; - } -} - -DEFINE_ACTION_FUNCTION(AActor, FaceMovementDirection) -{ - PARAM_SELF_PROLOGUE(AActor); - FaceMovementDirection(self); - return 0; -} diff --git a/src/g_shared/a_action.h b/src/g_shared/a_action.h deleted file mode 100644 index 7c5e00a79..000000000 --- a/src/g_shared/a_action.h +++ /dev/null @@ -1,29 +0,0 @@ -class AActor; - -/* -void A_NoBlocking (AActor *); -void A_HideThing (AActor *); -void A_UnHideThing (AActor *); -void A_FreezeDeath (AActor *); -void A_FreezeDeathChunks (AActor *); -void A_GenericFreezeDeath (AActor *); -void A_IceSetTics (AActor *); -void A_IceCheckHeadDone (AActor *); -void A_QueueCorpse (AActor *); -void A_DeQueueCorpse (AActor *); -void A_SetInvulnerable (AActor *); -void A_UnSetInvulnerable (AActor *); -void A_SetReflective (AActor *); -void A_UnSetReflective (AActor *); -void A_SetReflectiveInvulnerable (AActor *); -void A_UnSetReflectiveInvulnerable (AActor *); -void A_SetShootable (AActor *); -void A_UnSetShootable (AActor *); -void A_SetFloorClip (AActor *); -void A_UnSetFloorClip (AActor *); -void A_NoGravity (AActor *); -void A_SkullPop (AActor *); -*/ - - -void FaceMovementDirection (AActor *); diff --git a/src/g_shared/a_hatetarget.cpp b/src/g_shared/a_hatetarget.cpp deleted file mode 100644 index 8d5b0fa72..000000000 --- a/src/g_shared/a_hatetarget.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* -** a_hatetarget.cpp -** Something for monsters to hate and shoot at -** -**--------------------------------------------------------------------------- -** Copyright 2003-2006 Randy Heit -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -#include "actor.h" -#include "info.h" -#include "m_fixed.h" - -// Hate Target -------------------------------------------------------------- - -class AHateTarget : public AActor -{ - DECLARE_CLASS(AHateTarget, AActor) -public: - void BeginPlay(); - int TakeSpecialDamage(AActor *inflictor, AActor *source, int damage, FName damagetype); -}; - -IMPLEMENT_CLASS(AHateTarget, false, false) - -void AHateTarget::BeginPlay() -{ - Super::BeginPlay(); - if (SpawnAngle != 0) - { // Each degree translates into 10 units of health - health = SpawnAngle * 10; - } - else - { - special2 = 1; - health = 1000001; - } -} - -int AHateTarget::TakeSpecialDamage(AActor *inflictor, AActor *source, int damage, FName damagetype) -{ - if (special2 != 0) - { - return 0; - } - else - { - return damage; - } -} - diff --git a/src/g_shared/a_mapmarker.cpp b/src/g_shared/a_mapmarker.cpp deleted file mode 100644 index 524bfca44..000000000 --- a/src/g_shared/a_mapmarker.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* -** a_mapmarker.cpp -** An actor that appears on the automap instead of in the 3D view. -** -**--------------------------------------------------------------------------- -** Copyright 2006 Randy Heit -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -#include "a_sharedglobal.h" -#include "statnums.h" - -// Map Marker -------------------------------------------------------------- -// -// This class uses the following argument: -// args[0] == 0, shows the sprite at this actor -// != 0, shows the sprite for all actors whose TIDs match instead -// -// args[1] == 0, show the sprite always -// == 1, show the sprite only after its sector has been drawn -// -// To enable display of the sprite, activate it. To turn off the sprite, -// deactivate it. -// -// All the code to display it is in am_map.cpp. -// -//-------------------------------------------------------------------------- - -IMPLEMENT_CLASS(AMapMarker, false, false) - -void AMapMarker::BeginPlay () -{ - ChangeStatNum (STAT_MAPMARKER); -} - -void AMapMarker::Activate (AActor *activator) -{ - flags2 |= MF2_DORMANT; -} - -void AMapMarker::Deactivate (AActor *activator) -{ - flags2 &= ~MF2_DORMANT; -} diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index 0cecfd115..d5a396d0d 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -13,7 +13,6 @@ #include "s_sound.h" #include "statnums.h" #include "gstrings.h" -#include "a_action.h" #include "v_text.h" #include "doomstat.h" #include "doomdata.h" diff --git a/src/g_shared/a_secrettrigger.cpp b/src/g_shared/a_secrettrigger.cpp deleted file mode 100644 index 509ec47e9..000000000 --- a/src/g_shared/a_secrettrigger.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* -** a_secrettrigger.cpp -** A thing that counts toward the secret count when activated -** -**--------------------------------------------------------------------------- -** Copyright 1998-2006 Randy Heit -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -#include "actor.h" -#include "g_level.h" -#include "c_console.h" -#include "info.h" -#include "s_sound.h" -#include "d_player.h" -#include "doomstat.h" -#include "v_font.h" -#include "p_spec.h" - -class ASecretTrigger : public AActor -{ - DECLARE_CLASS (ASecretTrigger, AActor) -public: - void PostBeginPlay (); - void Activate (AActor *activator); -}; - -IMPLEMENT_CLASS(ASecretTrigger, false, false) - -void ASecretTrigger::PostBeginPlay () -{ - Super::PostBeginPlay (); - level.total_secrets++; -} - -void ASecretTrigger::Activate (AActor *activator) -{ - P_GiveSecret(activator, args[0] <= 1, (args[0] == 0 || args[0] == 2), -1); - Destroy (); -} - diff --git a/src/g_shared/a_setcolor.cpp b/src/g_shared/a_setcolor.cpp deleted file mode 100644 index e8a11b850..000000000 --- a/src/g_shared/a_setcolor.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "r_defs.h" -#include "actor.h" -#include "info.h" - -class AColorSetter : public AActor -{ - DECLARE_CLASS(AColorSetter, AActor) - - void PostBeginPlay() - { - Super::PostBeginPlay(); - Sector->SetColor(args[0], args[1], args[2], args[3]); - Destroy(); - } - -}; - -IMPLEMENT_CLASS(AColorSetter, false, false) - -class AFadeSetter : public AActor -{ - DECLARE_CLASS(AFadeSetter, AActor) - - void PostBeginPlay() - { - Super::PostBeginPlay(); - Sector->SetFade(args[0], args[1], args[2]); - Destroy(); - } - -}; - -IMPLEMENT_CLASS(AFadeSetter, false, false) diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index a690107c9..0087690f7 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -214,15 +214,6 @@ public: ActorFlags FlagsSave; }; -class AMapMarker : public AActor -{ - DECLARE_CLASS(AMapMarker, AActor) -public: - void BeginPlay (); - void Activate (AActor *activator); - void Deactivate (AActor *activator); -}; - class AFastProjectile : public AActor { DECLARE_CLASS(AFastProjectile, AActor) diff --git a/src/g_shared/a_spark.cpp b/src/g_shared/a_spark.cpp deleted file mode 100644 index f13c7178f..000000000 --- a/src/g_shared/a_spark.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* -** a_spark.cpp -** Actor that makes a particle spark when activated -** -**--------------------------------------------------------------------------- -** Copyright 1998-2006 Randy Heit -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -#include "actor.h" -#include "info.h" -#include "m_random.h" -#include "p_effect.h" -#include "s_sound.h" - -class ASpark : public AActor -{ - DECLARE_CLASS (ASpark, AActor) -public: - void Activate (AActor *activator); -}; - -IMPLEMENT_CLASS(ASpark, false, false) - -void ASpark::Activate (AActor *activator) -{ - Super::Activate (activator); - P_DrawSplash (args[0] ? args[0] : 32, Pos(), Angles.Yaw, 1); - S_Sound (this, CHAN_AUTO, "world/spark", 1, ATTN_STATIC); -} diff --git a/src/g_shared/a_waterzone.cpp b/src/g_shared/a_waterzone.cpp deleted file mode 100644 index 2245b22bd..000000000 --- a/src/g_shared/a_waterzone.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* -** a_waterzone.cpp -** Actor that makes BOOM deep water swimmable -** -**--------------------------------------------------------------------------- -** Copyright 1998-2006 Randy Heit -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -#include "info.h" -#include "r_defs.h" - -class AWaterZone : public AActor -{ - DECLARE_CLASS (AWaterZone, AActor) -public: - void PostBeginPlay (); -}; - -IMPLEMENT_CLASS(AWaterZone, false, false) - -void AWaterZone::PostBeginPlay () -{ - Super::PostBeginPlay (); - Sector->MoreFlags |= SECF_UNDERWATER; - Destroy (); -} - diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index a23e9943a..99d38b2c1 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -53,7 +53,6 @@ #include "p_lnspec.h" #include "p_effect.h" #include "p_enemy.h" -#include "a_action.h" #include "decallib.h" #include "m_random.h" #include "i_system.h" diff --git a/src/p_effect.cpp b/src/p_effect.cpp index ec051c299..42e82d740 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -574,6 +574,16 @@ void P_DrawSplash (int count, const DVector3 &pos, DAngle angle, int kind) } } +DEFINE_ACTION_FUNCTION(AActor, DrawSplash) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_INT(count); + PARAM_FLOAT(angle); + PARAM_INT(kind); + P_DrawSplash(count, self->Pos(), angle, kind); + return 0; +} + void P_DrawSplash2 (int count, const DVector3 &pos, DAngle angle, int updown, int kind) { int color1, color2, zadd; diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 3d9122930..64e4feb4a 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -42,7 +42,6 @@ #include "c_cvars.h" #include "p_enemy.h" #include "a_sharedglobal.h" -#include "a_action.h" #include "d_dehacked.h" #include "g_level.h" #include "r_utility.h" diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 5e2a9f039..7decbe9ad 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -47,7 +47,6 @@ #include "p_acs.h" #include "cmdlib.h" #include "decallib.h" -#include "a_action.h" #include "a_keys.h" #include "p_conversation.h" #include "g_game.h" diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 2b8097e55..22ef88358 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -700,6 +700,16 @@ void sector_t::SetColor(int r, int g, int b, int desat) P_RecalculateAttachedLights(this); } +DEFINE_ACTION_FUNCTION(_Sector, SetColor) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_COLOR(color); + PARAM_INT(desat); + self->ColorMap = GetSpecialLights(color, self->ColorMap->Fade, desat); + P_RecalculateAttachedLights(self); + return 0; +} + void sector_t::SetFade(int r, int g, int b) { PalEntry fade = PalEntry (r,g,b); @@ -707,6 +717,16 @@ void sector_t::SetFade(int r, int g, int b) P_RecalculateAttachedLights(this); } +DEFINE_ACTION_FUNCTION(_Sector, SetFade) +{ + PARAM_SELF_STRUCT_PROLOGUE(sector_t); + PARAM_COLOR(fade); + self->ColorMap = GetSpecialLights(self->ColorMap->Color, fade, self->ColorMap->Desaturate); + P_RecalculateAttachedLights(self); + return 0; +} + + //=========================================================================== // // sector_t :: ClosestPoint diff --git a/src/p_spec.cpp b/src/p_spec.cpp index eb6b9bea7..e4aea5595 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -552,6 +552,15 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornu level.found_secrets++; } +DEFINE_ACTION_FUNCTION(AActor, GiveSecret) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_BOOL(printmessage); + PARAM_BOOL(playsound); + P_GiveSecret(self, printmessage, playsound, -1); + return 0; +} + //============================================================================ // // P_PlayerOnSpecialFlat diff --git a/src/scripting/decorate/olddecorations.cpp b/src/scripting/decorate/olddecorations.cpp index 8321a8f89..400444340 100644 --- a/src/scripting/decorate/olddecorations.cpp +++ b/src/scripting/decorate/olddecorations.cpp @@ -44,7 +44,6 @@ #include "s_sound.h" #include "cmdlib.h" #include "p_lnspec.h" -#include "a_action.h" #include "decallib.h" #include "i_system.h" #include "thingdef.h" diff --git a/src/scripting/decorate/thingdef_states.cpp b/src/scripting/decorate/thingdef_states.cpp index 3b4abe002..1cb0a91af 100644 --- a/src/scripting/decorate/thingdef_states.cpp +++ b/src/scripting/decorate/thingdef_states.cpp @@ -45,7 +45,6 @@ #include "templates.h" #include "cmdlib.h" #include "p_lnspec.h" -#include "a_action.h" #include "p_local.h" #include "v_palette.h" #include "doomerrors.h" diff --git a/src/scripting/thingdef.cpp b/src/scripting/thingdef.cpp index 5708f89d2..77120c947 100644 --- a/src/scripting/thingdef.cpp +++ b/src/scripting/thingdef.cpp @@ -50,7 +50,6 @@ #include "s_sound.h" #include "cmdlib.h" #include "p_lnspec.h" -#include "a_action.h" #include "decallib.h" #include "m_random.h" #include "i_system.h" diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index 8586d32af..cfadc53bf 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -49,7 +49,6 @@ #include "s_sound.h" #include "cmdlib.h" #include "p_lnspec.h" -#include "a_action.h" #include "decallib.h" #include "m_random.h" #include "i_system.h" diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index c3dc3c1dd..b4b4afeb1 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -302,7 +302,6 @@ class Actor : Thinker native native void SetOrigin(vector3 newpos, bool moving); native void SetXYZ(vector3 newpos); native Actor GetPointer(int aaptr); - native void FaceMovementDirection(); native double BulletSlope(out FTranslatedLineTarget pLineTarget = null, int aimflags = 0); native Actor AimTarget(); native bool CheckMissileSpawn(double maxdist); @@ -375,6 +374,8 @@ class Actor : Thinker native native name GetSpecies(); native void PlayActiveSound(); native void Howl(); + native void DrawSplash (int count, double angle, int kind); + native void GiveSecret(bool printmsg = true, bool playsound = true); native bool CheckClass(class checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false); native Inventory FindInventory(class itemtype, bool subclass = false); diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 73f515f71..b1d9526ce 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -17,20 +17,47 @@ class Object native class Thinker : Object native { + enum EStatnums + { + // Thinkers that don't actually think + STAT_INFO, // An info queue + STAT_DECAL, // A decal + STAT_AUTODECAL, // A decal that can be automatically deleted + STAT_CORPSEPOINTER, // An entry in Hexen's corpse queue + STAT_TRAVELLING, // An actor temporarily travelling to a new map + + // Thinkers that do think + STAT_FIRST_THINKING=32, + STAT_SCROLLER=STAT_FIRST_THINKING, // A DScroller thinker + STAT_PLAYER, // A player actor + STAT_BOSSTARGET, // A boss brain target + STAT_LIGHTNING, // The lightning thinker + STAT_DECALTHINKER, // An object that thinks for a decal + STAT_INVENTORY, // An inventory item + STAT_LIGHT, // A sector light effect + STAT_LIGHTTRANSFER, // A sector light transfer. These must be ticked after the light effects. + STAT_EARTHQUAKE, // Earthquake actors + STAT_MAPMARKER, // Map marker actors + + STAT_DEFAULT = 100, // Thinkers go here unless specified otherwise. + STAT_SECTOREFFECT, // All sector effects that cause floor and ceiling movement + STAT_ACTORMOVER, // actor movers + STAT_SCRIPTS, // The ACS thinker. This is to ensure that it can't tick before all actors called PostBeginPlay + STAT_BOT, // Bot thinker + MAX_STATNUM = 127 + } + const TICRATE = 35; virtual native void Tick(); virtual native void PostBeginPlay(); + virtual native void ChangeStatNum(int stat); } class ThinkerIterator : Object native { - enum EStatnums - { - MAX_STATNUM = 127 - } - native static ThinkerIterator Create(class type = "Actor", int statnum=MAX_STATNUM+1); + native static ThinkerIterator Create(class type = "Actor", int statnum=Thinker.MAX_STATNUM+1); native Thinker Next(bool exact = false); native void Reinit(); } @@ -87,11 +114,11 @@ struct LevelLocals native native readonly int maptype; native readonly String Music; native readonly int musicorder; - native readonly int total_secrets; + native int total_secrets; native int found_secrets; - native readonly int total_items; + native int total_items; native int found_items; - native readonly int total_monsters; + native int total_monsters; native int killed_monsters; native double gravity; native double aircontrol; @@ -225,6 +252,19 @@ struct Sector native native int16 leakydamage; native uint16 ZoneNumber; + + enum ESectorMoreFlags + { + SECMF_FAKEFLOORONLY = 2, // when used as heightsec in R_FakeFlat, only copies floor + SECMF_CLIPFAKEPLANES = 4, // as a heightsec, clip planes to target sector's planes + SECMF_NOFAKELIGHT = 8, // heightsec does not change lighting + SECMF_IGNOREHEIGHTSEC= 16, // heightsec is only for triggering sector actions + SECMF_UNDERWATER = 32, // sector is underwater + SECMF_FORCEDUNDERWATER= 64, // sector is forced to be underwater + SECMF_UNDERWATERMASK = 32+64, + SECMF_DRAWN = 128, // sector has been drawn at least once + SECMF_HIDDEN = 256, // Do not draw on textured automap + } native uint16 MoreFlags; enum ESectorFlags @@ -263,6 +303,8 @@ struct Sector native native void RemoveForceField(); native static Sector PointInSector(Vector2 pt); + native void SetColor(color c, int desat = 0); + native void SetFade(color c); } struct Wads diff --git a/wadsrc/static/zscript/raven/minotaur.txt b/wadsrc/static/zscript/raven/minotaur.txt index fa40cbec1..5e3d0cfe3 100644 --- a/wadsrc/static/zscript/raven/minotaur.txt +++ b/wadsrc/static/zscript/raven/minotaur.txt @@ -757,3 +757,50 @@ class MinotaurSmokeExit : Actor } } +extend class Actor +{ + enum dirtype_t + { + DI_EAST, + DI_NORTHEAST, + DI_NORTH, + DI_NORTHWEST, + DI_WEST, + DI_SOUTHWEST, + DI_SOUTH, + DI_SOUTHEAST, + DI_NODIR, + NUMDIRS + }; + + void FaceMovementDirection() + { + switch (movedir) + { + case DI_EAST: + angle = 0.; + break; + case DI_NORTHEAST: + angle = 45.; + break; + case DI_NORTH: + angle = 90.; + break; + case DI_NORTHWEST: + angle = 135.; + break; + case DI_WEST: + angle = 180.; + break; + case DI_SOUTHWEST: + angle = 225.; + break; + case DI_SOUTH: + angle = 270.; + break; + case DI_SOUTHEAST: + angle = 315.; + break; + } + } +} \ No newline at end of file diff --git a/wadsrc/static/zscript/shared/hatetarget.txt b/wadsrc/static/zscript/shared/hatetarget.txt index 6d2263f61..e90abcdbb 100644 --- a/wadsrc/static/zscript/shared/hatetarget.txt +++ b/wadsrc/static/zscript/shared/hatetarget.txt @@ -2,7 +2,7 @@ // Hate Target -------------------------------------------------------------- -class HateTarget : Actor native +class HateTarget : Actor { default { @@ -19,4 +19,32 @@ class HateTarget : Actor native Spawn: TNT1 A -1; } + + override void BeginPlay() + { + Super.BeginPlay(); + if (SpawnAngle != 0) + { // Each degree translates into 10 units of health + health = SpawnAngle * 10; + } + else + { + special2 = 1; + health = 1000001; + } + } + + override int TakeSpecialDamage(Actor inflictor, Actor source, int damage, Name damagetype) + { + if (special2 != 0) + { + return 0; + } + else + { + return damage; + } + } + + } \ No newline at end of file diff --git a/wadsrc/static/zscript/shared/mapmarker.txt b/wadsrc/static/zscript/shared/mapmarker.txt index 1afa00459..25e197307 100644 --- a/wadsrc/static/zscript/shared/mapmarker.txt +++ b/wadsrc/static/zscript/shared/mapmarker.txt @@ -1,5 +1,20 @@ +// Map Marker -------------------------------------------------------------- +// +// This class uses the following argument: +// args[0] == 0, shows the sprite at this actor +// != 0, shows the sprite for all actors whose TIDs match instead +// +// args[1] == 0, show the sprite always +// == 1, show the sprite only after its sector has been drawn +// +// To enable display of the sprite, activate it. To turn off the sprite, +// deactivate it. +// +// All the code to display it is in am_map.cpp. +// +//-------------------------------------------------------------------------- -class MapMarker : Actor native +class MapMarker : Actor { default { @@ -15,4 +30,20 @@ class MapMarker : Actor native AMRK A -1; Stop; } + + override void BeginPlay () + { + ChangeStatNum (STAT_MAPMARKER); + } + + override void Activate (Actor activator) + { + bDormant = true; + } + + override void Deactivate (Actor activator) + { + bDormant = false; + } + } diff --git a/wadsrc/static/zscript/shared/secrettrigger.txt b/wadsrc/static/zscript/shared/secrettrigger.txt index 48c93686e..c60399600 100644 --- a/wadsrc/static/zscript/shared/secrettrigger.txt +++ b/wadsrc/static/zscript/shared/secrettrigger.txt @@ -1,5 +1,5 @@ -class SecretTrigger : Actor native +class SecretTrigger : Actor { default { @@ -8,5 +8,19 @@ class SecretTrigger : Actor native +NOGRAVITY +DONTSPLASH } + + override void PostBeginPlay () + { + Super.PostBeginPlay (); + level.total_secrets++; + } + + override void Activate (Actor activator) + { + activator.GiveSecret(args[0] <= 1, (args[0] == 0 || args[0] == 2)); + Destroy (); + } + + } diff --git a/wadsrc/static/zscript/shared/setcolor.txt b/wadsrc/static/zscript/shared/setcolor.txt index 8689e5fd1..18105ef54 100644 --- a/wadsrc/static/zscript/shared/setcolor.txt +++ b/wadsrc/static/zscript/shared/setcolor.txt @@ -1,4 +1,4 @@ -class ColorSetter : Actor native +class ColorSetter : Actor { default { @@ -7,10 +7,18 @@ class ColorSetter : Actor native +DONTSPLASH RenderStyle "None"; } + + override void PostBeginPlay() + { + Super.PostBeginPlay(); + CurSector.SetColor(color(args[0], args[1], args[2]), args[3]); + Destroy(); + } + } -class FadeSetter : Actor native +class FadeSetter : Actor { default { @@ -19,4 +27,13 @@ class FadeSetter : Actor native +DONTSPLASH RenderStyle "None"; } + + void PostBeginPlay() + { + Super.PostBeginPlay(); + CurSector.SetFade(color(args[0], args[1], args[2])); + Destroy(); + } + + } diff --git a/wadsrc/static/zscript/shared/sharedmisc.txt b/wadsrc/static/zscript/shared/sharedmisc.txt index 5989702fd..6da942e39 100644 --- a/wadsrc/static/zscript/shared/sharedmisc.txt +++ b/wadsrc/static/zscript/shared/sharedmisc.txt @@ -157,13 +157,25 @@ class CustomSprite : Actor native // SwitchableDecoration: Activate and Deactivate change state -------------- -class SwitchableDecoration : Actor native +class SwitchableDecoration : Actor { + override void Activate (Actor activator) + { + SetStateLabel("Active"); + } + + override void Deactivate (Actor activator) + { + SetStateLabel("Inactive"); + } + } - -class SwitchingDecoration : SwitchableDecoration native +class SwitchingDecoration : SwitchableDecoration { + override void Deactivate (Actor activator) + { + } } // Random spawner ---------------------------------------------------------- diff --git a/wadsrc/static/zscript/shared/spark.txt b/wadsrc/static/zscript/shared/spark.txt index 5adffdfe1..c5ae6a455 100644 --- a/wadsrc/static/zscript/shared/spark.txt +++ b/wadsrc/static/zscript/shared/spark.txt @@ -1,5 +1,5 @@ -class Spark : Actor native +class Spark : Actor { default { @@ -8,4 +8,12 @@ class Spark : Actor native +NOGRAVITY +DONTSPLASH } + + override void Activate (Actor activator) + { + Super.Activate (activator); + DrawSplash (args[0] ? args[0] : 32, Angle, 1); + A_PlaySound ("world/spark", CHAN_AUTO, 1, false, ATTN_STATIC); + } + } \ No newline at end of file diff --git a/wadsrc/static/zscript/shared/waterzone.txt b/wadsrc/static/zscript/shared/waterzone.txt index 975c8a473..49d950b00 100644 --- a/wadsrc/static/zscript/shared/waterzone.txt +++ b/wadsrc/static/zscript/shared/waterzone.txt @@ -1,4 +1,4 @@ -class WaterZone : Actor native +class WaterZone : Actor { default { @@ -7,4 +7,13 @@ class WaterZone : Actor native +NOGRAVITY +DONTSPLASH } + + override void PostBeginPlay () + { + Super.PostBeginPlay (); + CurSector.MoreFlags |= Sector.SECMF_UNDERWATER; + Destroy (); + } + + }