mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +00:00
- scriptified Hexen's spike, which was the last remaining item in the game directories.
- added a BlockThingsIterator for scripts.
This commit is contained in:
parent
f17f6c30c2
commit
0c969746d0
8 changed files with 146 additions and 136 deletions
|
@ -828,7 +828,6 @@ endif()
|
||||||
file( GLOB HEADER_FILES
|
file( GLOB HEADER_FILES
|
||||||
${EXTRA_HEADER_DIRS}
|
${EXTRA_HEADER_DIRS}
|
||||||
fragglescript/*.h
|
fragglescript/*.h
|
||||||
g_hexen/*.h
|
|
||||||
g_shared/*.h
|
g_shared/*.h
|
||||||
g_strife/*.h
|
g_strife/*.h
|
||||||
intermission/*.h
|
intermission/*.h
|
||||||
|
@ -859,7 +858,6 @@ set( NOT_COMPILED_SOURCE_FILES
|
||||||
${OTHER_SYSTEM_SOURCES}
|
${OTHER_SYSTEM_SOURCES}
|
||||||
sc_man_scanner.h
|
sc_man_scanner.h
|
||||||
sc_man_scanner.re
|
sc_man_scanner.re
|
||||||
g_hexen/a_spike.cpp
|
|
||||||
g_shared/sbarinfo_commands.cpp
|
g_shared/sbarinfo_commands.cpp
|
||||||
xlat/xlat_parser.y
|
xlat/xlat_parser.y
|
||||||
xlat_parser.c
|
xlat_parser.c
|
||||||
|
@ -1108,7 +1106,6 @@ set (PCH_SOURCES
|
||||||
w_wad.cpp
|
w_wad.cpp
|
||||||
wi_stuff.cpp
|
wi_stuff.cpp
|
||||||
zstrformat.cpp
|
zstrformat.cpp
|
||||||
g_hexen/a_hexenmisc.cpp
|
|
||||||
g_strife/strife_sbar.cpp
|
g_strife/strife_sbar.cpp
|
||||||
g_shared/a_action.cpp
|
g_shared/a_action.cpp
|
||||||
g_shared/a_armor.cpp
|
g_shared/a_armor.cpp
|
||||||
|
@ -1258,7 +1255,6 @@ endif()
|
||||||
|
|
||||||
target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma )
|
target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma )
|
||||||
include_directories( .
|
include_directories( .
|
||||||
g_hexen
|
|
||||||
g_strife
|
g_strife
|
||||||
g_shared
|
g_shared
|
||||||
oplsynth
|
oplsynth
|
||||||
|
@ -1389,7 +1385,6 @@ source_group("External\\Math" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/m
|
||||||
source_group("External\\RapidJSON" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/.+")
|
source_group("External\\RapidJSON" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/.+")
|
||||||
source_group("Externak\\SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")
|
source_group("Externak\\SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")
|
||||||
source_group("FraggleScript" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/fragglescript/.+")
|
source_group("FraggleScript" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/fragglescript/.+")
|
||||||
source_group("Games\\Hexen Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_hexen/.+")
|
|
||||||
source_group("Games\\Strife Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_strife/.+")
|
source_group("Games\\Strife Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_strife/.+")
|
||||||
source_group("Intermission" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/intermission/.+")
|
source_group("Intermission" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/intermission/.+")
|
||||||
source_group("Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/menu/.+")
|
source_group("Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/menu/.+")
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
#include "d_player.h"
|
|
||||||
#include "info.h"
|
|
||||||
#include "p_local.h"
|
|
||||||
#include "s_sound.h"
|
|
||||||
#include "a_action.h"
|
|
||||||
#include "m_random.h"
|
|
||||||
#include "a_sharedglobal.h"
|
|
||||||
#include "i_system.h"
|
|
||||||
#include "gi.h"
|
|
||||||
#include "g_level.h"
|
|
||||||
#include "p_enemy.h"
|
|
||||||
#include "a_weaponpiece.h"
|
|
||||||
#include "doomstat.h"
|
|
||||||
#include "p_lnspec.h"
|
|
||||||
#include "p_terrain.h"
|
|
||||||
#include "m_bbox.h"
|
|
||||||
#include "v_palette.h"
|
|
||||||
#include "g_game.h"
|
|
||||||
#include "p_blockmap.h"
|
|
||||||
#include "r_utility.h"
|
|
||||||
#include "p_maputl.h"
|
|
||||||
#include "p_spec.h"
|
|
||||||
#include "serializer.h"
|
|
||||||
#include "a_pickups.h"
|
|
||||||
|
|
||||||
// Include all the Hexen stuff here to reduce compile time
|
|
||||||
#include "a_spike.cpp"
|
|
|
@ -1,90 +0,0 @@
|
||||||
/*
|
|
||||||
#include "actor.h"
|
|
||||||
#include "info.h"
|
|
||||||
#include "m_random.h"
|
|
||||||
#include "p_enemy.h"
|
|
||||||
#include "p_local.h"
|
|
||||||
#include "a_sharedglobal.h"
|
|
||||||
#include "s_sound.h"
|
|
||||||
#include "m_bbox.h"
|
|
||||||
#include "vm.h"
|
|
||||||
*/
|
|
||||||
|
|
||||||
static FRandom pr_thrustraise ("ThrustRaise");
|
|
||||||
|
|
||||||
// Spike (thrust floor) -----------------------------------------------------
|
|
||||||
|
|
||||||
// AThrustFloor is just a container for all the spike states.
|
|
||||||
// All the real spikes subclass it.
|
|
||||||
|
|
||||||
class AThrustFloor : public AActor
|
|
||||||
{
|
|
||||||
DECLARE_CLASS (AThrustFloor, AActor)
|
|
||||||
public:
|
|
||||||
|
|
||||||
void Activate (AActor *activator);
|
|
||||||
void Deactivate (AActor *activator);
|
|
||||||
};
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(AThrustFloor, false, false)
|
|
||||||
|
|
||||||
void AThrustFloor::Activate (AActor *activator)
|
|
||||||
{
|
|
||||||
if (args[0] == 0)
|
|
||||||
{
|
|
||||||
S_Sound (this, CHAN_BODY, "ThrustSpikeLower", 1, ATTN_NORM);
|
|
||||||
renderflags &= ~RF_INVISIBLE;
|
|
||||||
if (args[1])
|
|
||||||
SetState (FindState ("BloodThrustRaise"));
|
|
||||||
else
|
|
||||||
SetState (FindState ("ThrustRaise"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AThrustFloor::Deactivate (AActor *activator)
|
|
||||||
{
|
|
||||||
if (args[0] == 1)
|
|
||||||
{
|
|
||||||
S_Sound (this, CHAN_BODY, "ThrustSpikeRaise", 1, ATTN_NORM);
|
|
||||||
if (args[1])
|
|
||||||
SetState (FindState ("BloodThrustLower"));
|
|
||||||
else
|
|
||||||
SetState (FindState ("ThrustLower"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale)
|
|
||||||
{
|
|
||||||
PARAM_SELF_PROLOGUE(AActor);
|
|
||||||
|
|
||||||
// This doesn't need to iterate through portals.
|
|
||||||
|
|
||||||
FPortalGroupArray check;
|
|
||||||
FMultiBlockThingsIterator it(check, self);
|
|
||||||
FMultiBlockThingsIterator::CheckResult cres;
|
|
||||||
while (it.Next(&cres))
|
|
||||||
{
|
|
||||||
double blockdist = self->radius + cres.thing->radius;
|
|
||||||
if (fabs(cres.thing->X() - cres.Position.X) >= blockdist || fabs(cres.thing->Y() - cres.Position.Y) >= blockdist)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Q: Make this z-aware for everything? It never was before.
|
|
||||||
if (cres.thing->Top() < self->Z() || cres.thing->Z() > self->Top())
|
|
||||||
{
|
|
||||||
if (self->Sector->PortalGroup != cres.thing->Sector->PortalGroup)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(cres.thing->flags & MF_SHOOTABLE) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (cres.thing == self)
|
|
||||||
continue; // don't clip against self
|
|
||||||
|
|
||||||
int newdam = P_DamageMobj (cres.thing, self, self, 10001, NAME_Crush);
|
|
||||||
P_TraceBleed (newdam > 0 ? newdam : 10001, cres.thing);
|
|
||||||
self->args[1] = 1; // Mark thrust thing as bloody
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -4652,16 +4652,6 @@ void P_TraceBleed(int damage, AActor *target, AActor *missile)
|
||||||
P_TraceBleed(damage, target->PosPlusZ(target->Height/2), target, missile->AngleTo(target), pitch);
|
P_TraceBleed(damage, target->PosPlusZ(target->Height/2), target, missile->AngleTo(target), pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AActor, TraceBleed)
|
|
||||||
{
|
|
||||||
PARAM_SELF_PROLOGUE(AActor);
|
|
||||||
PARAM_INT(damage);
|
|
||||||
PARAM_OBJECT(missile, AActor);
|
|
||||||
|
|
||||||
P_TraceBleed(damage, self, missile);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -4706,6 +4696,18 @@ void P_TraceBleed(int damage, AActor *target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(AActor, TraceBleed)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(AActor);
|
||||||
|
PARAM_INT(damage);
|
||||||
|
PARAM_OBJECT(missile, AActor);
|
||||||
|
|
||||||
|
if (missile) P_TraceBleed(damage, self, missile);
|
||||||
|
else P_TraceBleed(damage, self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// [RH] Rail gun stuffage
|
// [RH] Rail gun stuffage
|
||||||
|
|
|
@ -1152,6 +1152,75 @@ void FMultiBlockThingsIterator::Reset()
|
||||||
startIteratorForGroup(basegroup);
|
startIteratorForGroup(basegroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// and the scriptable version
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
class DBlockThingsIterator : public DObject, public FMultiBlockThingsIterator
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(DBlockThingsIterator, DObject);
|
||||||
|
FPortalGroupArray check;
|
||||||
|
public:
|
||||||
|
FMultiBlockThingsIterator::CheckResult cres;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool Next()
|
||||||
|
{
|
||||||
|
return FMultiBlockThingsIterator::Next(&cres);
|
||||||
|
}
|
||||||
|
|
||||||
|
DBlockThingsIterator(AActor *origin = nullptr, double checkradius = -1, bool ignorerestricted = false)
|
||||||
|
: FMultiBlockThingsIterator(check, origin, checkradius, ignorerestricted)
|
||||||
|
{
|
||||||
|
cres.thing = nullptr;
|
||||||
|
cres.Position.Zero();
|
||||||
|
cres.portalflags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBlockThingsIterator(double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec)
|
||||||
|
: FMultiBlockThingsIterator(check, checkx, checky, checkz, checkh, checkradius, ignorerestricted, newsec)
|
||||||
|
{
|
||||||
|
cres.thing = nullptr;
|
||||||
|
cres.Position.Zero();
|
||||||
|
cres.portalflags = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(DBlockThingsIterator, false, false);
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Create)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_OBJECT(origin, AActor);
|
||||||
|
PARAM_FLOAT_DEF(radius);
|
||||||
|
PARAM_BOOL_DEF(ignore);
|
||||||
|
ACTION_RETURN_OBJECT(new DBlockThingsIterator(origin, radius, ignore));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, CreateFromPos)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_FLOAT(x);
|
||||||
|
PARAM_FLOAT(y);
|
||||||
|
PARAM_FLOAT(z);
|
||||||
|
PARAM_FLOAT(h);
|
||||||
|
PARAM_FLOAT(radius);
|
||||||
|
PARAM_BOOL(ignore);
|
||||||
|
ACTION_RETURN_OBJECT(new DBlockThingsIterator(x, y, z, h, radius, ignore, nullptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Next)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DBlockThingsIterator);
|
||||||
|
ACTION_RETURN_BOOL(self->Next());
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_FIELD_NAMED(DBlockThingsIterator, cres.thing, thing);
|
||||||
|
DEFINE_FIELD_NAMED(DBlockThingsIterator, cres.Position, position);
|
||||||
|
DEFINE_FIELD_NAMED(DBlockThingsIterator, cres.portalflags, portalflags);
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// FPathTraverse :: Intercepts
|
// FPathTraverse :: Intercepts
|
||||||
|
|
|
@ -387,7 +387,7 @@ class Actor : Thinker native
|
||||||
// DECORATE compatible functions
|
// DECORATE compatible functions
|
||||||
native int CountInv(class<Inventory> itemtype, int ptr_select = AAPTR_DEFAULT);
|
native int CountInv(class<Inventory> itemtype, int ptr_select = AAPTR_DEFAULT);
|
||||||
native double GetDistance(bool checkz, int ptr = AAPTR_TARGET);
|
native double GetDistance(bool checkz, int ptr = AAPTR_TARGET);
|
||||||
native double GetAngle(int flags, int ptr = AAPTR_DEFAULT);
|
native double GetAngle(int flags, int ptr = AAPTR_TARGET);
|
||||||
native double GetZAt(double px = 0, double py = 0, double angle = 0, int flags = 0, int pick_pointer = AAPTR_DEFAULT);
|
native double GetZAt(double px = 0, double py = 0, double angle = 0, int flags = 0, int pick_pointer = AAPTR_DEFAULT);
|
||||||
native int GetSpawnHealth();
|
native int GetSpawnHealth();
|
||||||
native int GetGibHealth();
|
native int GetGibHealth();
|
||||||
|
|
|
@ -42,6 +42,17 @@ class ActorIterator : Object native
|
||||||
native void Reinit();
|
native void Reinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BlockThingsIterator : Object native
|
||||||
|
{
|
||||||
|
native Actor thing;
|
||||||
|
native Vector3 position;
|
||||||
|
native int portalflags;
|
||||||
|
|
||||||
|
native static BlockThingsIterator Create(Actor origin, double checkradius = -1, bool ignorerestricted = false);
|
||||||
|
native static BlockThingsIterator CreateFromPos(double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted);
|
||||||
|
native bool Next();
|
||||||
|
}
|
||||||
|
|
||||||
class DropItem : Object native
|
class DropItem : Object native
|
||||||
{
|
{
|
||||||
native readonly DropItem Next;
|
native readonly DropItem Next;
|
||||||
|
|
|
@ -18,7 +18,7 @@ class DirtClump : Actor
|
||||||
|
|
||||||
// Spike (thrust floor) -----------------------------------------------------
|
// Spike (thrust floor) -----------------------------------------------------
|
||||||
|
|
||||||
class ThrustFloor : Actor native
|
class ThrustFloor : Actor
|
||||||
{
|
{
|
||||||
Default
|
Default
|
||||||
{
|
{
|
||||||
|
@ -26,8 +26,6 @@ class ThrustFloor : Actor native
|
||||||
Height 128;
|
Height 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
native void A_ThrustImpale();
|
|
||||||
|
|
||||||
States
|
States
|
||||||
{
|
{
|
||||||
ThrustRaising:
|
ThrustRaising:
|
||||||
|
@ -78,6 +76,31 @@ class ThrustFloor : Actor native
|
||||||
Loop;
|
Loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override void Activate (Actor activator)
|
||||||
|
{
|
||||||
|
if (args[0] == 0)
|
||||||
|
{
|
||||||
|
A_PlaySound ("ThrustSpikeLower", CHAN_BODY);
|
||||||
|
bInvisible = false;
|
||||||
|
if (args[1])
|
||||||
|
SetStateLabel("BloodThrustRaise");
|
||||||
|
else
|
||||||
|
SetStateLabel("ThrustRaise");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override void Deactivate (Actor activator)
|
||||||
|
{
|
||||||
|
if (args[0] == 1)
|
||||||
|
{
|
||||||
|
A_PlaySound ("ThrustSpikeRaise", CHAN_BODY);
|
||||||
|
if (args[1])
|
||||||
|
SetStateLabel("BloodThrustLower");
|
||||||
|
else
|
||||||
|
SetStateLabel("ThrustLower");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// Thrust floor stuff
|
// Thrust floor stuff
|
||||||
|
@ -150,6 +173,33 @@ class ThrustFloor : Actor native
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void A_ThrustImpale()
|
||||||
|
{
|
||||||
|
BlockThingsIterator it = BlockThingsIterator.Create(self);
|
||||||
|
while (it.Next())
|
||||||
|
{
|
||||||
|
double blockdist = radius + it.thing.radius;
|
||||||
|
if (abs(it.thing.pos.x - it.Position.X) >= blockdist || abs(it.thing.pos.y - it.Position.Y) >= blockdist)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Q: Make this z-aware for everything? It never was before.
|
||||||
|
if (it.thing.pos.z + it.thing.height < pos.z || it.thing.pos.z > pos.z + height)
|
||||||
|
{
|
||||||
|
if (CurSector.PortalGroup != it.thing.CurSector.PortalGroup)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!it.thing.bShootable)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (it.thing == self)
|
||||||
|
continue; // don't clip against self
|
||||||
|
|
||||||
|
int newdam = it.thing.DamageMobj (self, self, 10001, 'Crush');
|
||||||
|
it.thing.TraceBleed (newdam > 0 ? newdam : 10001, null);
|
||||||
|
args[1] = 1; // Mark thrust thing as bloody
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spike up -----------------------------------------------------------------
|
// Spike up -----------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue