- scriptified some trivial stuff from g_shared.

This commit is contained in:
Christoph Oelckers 2016-11-29 19:50:34 +01:00
parent 0c969746d0
commit a13e23dbe6
33 changed files with 276 additions and 502 deletions

View file

@ -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

View file

@ -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<AMapMarker> it (STAT_MAPMARKER);
AMapMarker *mark;
TThinkerIterator<AActor> it ("MapMarker", STAT_MAPMARKER);
AActor *mark;
while ((mark = it.Next()) != NULL)
{

View file

@ -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

View file

@ -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;
}

View file

@ -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 *);

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -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"

View file

@ -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 ();
}

View file

@ -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)

View file

@ -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)

View file

@ -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);
}

View file

@ -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 ();
}

View file

@ -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"

View file

@ -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;

View file

@ -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"

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
native Inventory FindInventory(class<Inventory> itemtype, bool subclass = false);

View file

@ -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<Object> type = "Actor", int statnum=MAX_STATNUM+1);
native static ThinkerIterator Create(class<Object> 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

View file

@ -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;
}
}
}

View file

@ -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;
}
}
}

View file

@ -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;
}
}

View file

@ -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 ();
}
}

View file

@ -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();
}
}

View file

@ -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 ----------------------------------------------------------

View file

@ -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);
}
}

View file

@ -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 ();
}
}