mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- more direct native entry points.
This commit is contained in:
parent
3b5ce4ecca
commit
a3265c2963
12 changed files with 518 additions and 355 deletions
|
@ -1150,6 +1150,7 @@ set (PCH_SOURCES
|
|||
r_data/models/models_ue1.cpp
|
||||
r_data/models/models_obj.cpp
|
||||
scripting/symbols.cpp
|
||||
scripting/vmiterators.cpp
|
||||
scripting/vmthunks.cpp
|
||||
scripting/types.cpp
|
||||
scripting/thingdef.cpp
|
||||
|
|
|
@ -962,47 +962,6 @@ DThinker *FThinkerIterator::Next (bool exact)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// This is for scripting, which needs the iterator wrapped into an object with the needed functions exported.
|
||||
// Unfortunately we cannot have templated type conversions in scripts.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
class DThinkerIterator : public DObject, public FThinkerIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DThinkerIterator, DObject)
|
||||
|
||||
public:
|
||||
DThinkerIterator(PClass *cls, int statnum = MAX_STATNUM + 1)
|
||||
: FThinkerIterator(cls, statnum)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DThinkerIterator, true, false);
|
||||
DEFINE_ACTION_FUNCTION(DThinkerIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_CLASS(type, DThinker);
|
||||
PARAM_INT(statnum);
|
||||
ACTION_RETURN_OBJECT(Create<DThinkerIterator>(type, statnum));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DThinkerIterator, Next)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DThinkerIterator);
|
||||
PARAM_BOOL(exact);
|
||||
ACTION_RETURN_OBJECT(self->Next(exact));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DThinkerIterator, Reinit)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DThinkerIterator);
|
||||
self->Reinit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -289,36 +289,6 @@ bool FWeaponSlots::LocateWeapon (PClassActor *type, int *const slot, int *const
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FWeaponSlots, LocateWeapon)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FWeaponSlots);
|
||||
PARAM_CLASS(weap, AActor);
|
||||
int slot = 0, index = 0;
|
||||
bool retv = self->LocateWeapon(weap, &slot, &index);
|
||||
if (numret >= 1) ret[0].SetInt(retv);
|
||||
if (numret >= 2) ret[1].SetInt(slot);
|
||||
if (numret >= 3) ret[2].SetInt(index);
|
||||
return MIN(numret, 3);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FWeaponSlots, GetWeapon)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FWeaponSlots);
|
||||
PARAM_INT(slot);
|
||||
PARAM_INT(index);
|
||||
ACTION_RETURN_POINTER(self->GetWeapon(slot, index));
|
||||
return 1;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FWeaponSlots, SlotSize)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FWeaponSlots);
|
||||
PARAM_INT(slot);
|
||||
ACTION_RETURN_INT(self->SlotSize(slot));
|
||||
return 1;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FWeaponSlots :: AddExtraWeapons
|
||||
|
@ -819,14 +789,6 @@ void FWeaponSlots::SetupWeaponSlots(APlayerPawn *pp)
|
|||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FWeaponSlots, SetupWeaponSlots)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT(pawn, APlayerPawn);
|
||||
FWeaponSlots::SetupWeaponSlots(pawn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// P_SetupWeapons_ntohton
|
||||
|
|
137
src/p_maputl.cpp
137
src/p_maputl.cpp
|
@ -938,74 +938,6 @@ void FMultiBlockLinesIterator::Reset()
|
|||
startIteratorForGroup(basegroup);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// and the scriptable version
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class DBlockLinesIterator : public DObject, public FMultiBlockLinesIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DBlockLinesIterator, DObject);
|
||||
FPortalGroupArray check;
|
||||
|
||||
public:
|
||||
FMultiBlockLinesIterator::CheckResult cres;
|
||||
|
||||
bool Next()
|
||||
{
|
||||
return FMultiBlockLinesIterator::Next(&cres);
|
||||
}
|
||||
|
||||
DBlockLinesIterator(AActor *actor, double checkradius)
|
||||
: FMultiBlockLinesIterator(check, actor, checkradius)
|
||||
{
|
||||
cres.line = nullptr;
|
||||
cres.Position.Zero();
|
||||
cres.portalflags = 0;
|
||||
}
|
||||
|
||||
DBlockLinesIterator(double x, double y, double z, double height, double radius, sector_t *sec)
|
||||
:FMultiBlockLinesIterator(check, x, y, z, height, radius, sec)
|
||||
{
|
||||
cres.line = nullptr;
|
||||
cres.Position.Zero();
|
||||
cres.portalflags = 0;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DBlockLinesIterator, true, false);
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBlockLinesIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT_NOT_NULL(origin, AActor);
|
||||
PARAM_FLOAT(radius);
|
||||
ACTION_RETURN_OBJECT(Create<DBlockLinesIterator>(origin, radius));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBlockLinesIterator, CreateFromPos)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(z);
|
||||
PARAM_FLOAT(h);
|
||||
PARAM_FLOAT(radius);
|
||||
PARAM_POINTER(sec, sector_t);
|
||||
ACTION_RETURN_OBJECT(Create<DBlockLinesIterator>(x, y, z, h, radius, sec));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBlockLinesIterator, Next)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DBlockLinesIterator);
|
||||
ACTION_RETURN_BOOL(self->Next());
|
||||
}
|
||||
|
||||
DEFINE_FIELD_NAMED(DBlockLinesIterator, cres.line, curline);
|
||||
DEFINE_FIELD_NAMED(DBlockLinesIterator, cres.Position, position);
|
||||
DEFINE_FIELD_NAMED(DBlockLinesIterator, cres.portalflags, portalflags);
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FBlockThingsIterator :: FBlockThingsIterator
|
||||
|
@ -1277,75 +1209,6 @@ void FMultiBlockThingsIterator::Reset()
|
|||
startIteratorForGroup(basegroup);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// and the scriptable version
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class DBlockThingsIterator : public DObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DBlockThingsIterator, DObject);
|
||||
FPortalGroupArray check;
|
||||
FMultiBlockThingsIterator iterator;
|
||||
public:
|
||||
FMultiBlockThingsIterator::CheckResult cres;
|
||||
|
||||
bool Next()
|
||||
{
|
||||
return iterator.Next(&cres);
|
||||
}
|
||||
|
||||
DBlockThingsIterator(AActor *origin, double checkradius = -1, bool ignorerestricted = false)
|
||||
: iterator(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)
|
||||
: iterator(check, checkx, checky, checkz, checkh, checkradius, ignorerestricted, newsec)
|
||||
{
|
||||
cres.thing = nullptr;
|
||||
cres.Position.Zero();
|
||||
cres.portalflags = 0;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DBlockThingsIterator, true, false);
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBlockThingsIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT_NOT_NULL(origin, AActor);
|
||||
PARAM_FLOAT(radius);
|
||||
PARAM_BOOL(ignore);
|
||||
ACTION_RETURN_OBJECT(Create<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(Create<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
|
||||
|
|
|
@ -7708,42 +7708,6 @@ DEFINE_ACTION_FUNCTION(AActor, GetBobOffset)
|
|||
|
||||
|
||||
|
||||
|
||||
class DActorIterator : public DObject, public NActorIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DActorIterator, DObject)
|
||||
|
||||
public:
|
||||
DActorIterator(PClassActor *cls= nullptr, int tid = 0)
|
||||
: NActorIterator(cls, tid)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DActorIterator, true, false);
|
||||
DEFINE_ACTION_FUNCTION(DActorIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(tid);
|
||||
PARAM_CLASS(type, AActor);
|
||||
ACTION_RETURN_OBJECT(Create<DActorIterator>(type, tid));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DActorIterator, Next)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DActorIterator);
|
||||
ACTION_RETURN_OBJECT(self->Next());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DActorIterator, Reinit)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DActorIterator);
|
||||
self->Reinit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, deltaangle) // should this be global?
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
|
|
|
@ -162,6 +162,7 @@ int P_TranslateSectorSpecial (int);
|
|||
|
||||
int GetUDMFInt(int type, int index, FName key);
|
||||
double GetUDMFFloat(int type, int index, FName key);
|
||||
FString GetUDMFString(int type, int index, FName key);
|
||||
|
||||
bool P_LoadGLNodes(MapData * map);
|
||||
bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime);
|
||||
|
|
|
@ -364,64 +364,3 @@ int FLineIdIterator::Next()
|
|||
return ret;
|
||||
}
|
||||
|
||||
class DSectorTagIterator : public DObject, public FSectorTagIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DSectorTagIterator, DObject);
|
||||
public:
|
||||
DSectorTagIterator(int tag, line_t *line)
|
||||
{
|
||||
if (line == nullptr) Init(tag);
|
||||
else Init(tag, line);
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DSectorTagIterator, true, false);
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DSectorTagIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(tag);
|
||||
PARAM_POINTER(line, line_t);
|
||||
ACTION_RETURN_POINTER(Create<DSectorTagIterator>(tag, line));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DSectorTagIterator, Next)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DSectorTagIterator);
|
||||
ACTION_RETURN_INT(self->Next());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DSectorTagIterator, NextCompat)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DSectorTagIterator);
|
||||
PARAM_BOOL(compat);
|
||||
PARAM_INT(secnum);
|
||||
ACTION_RETURN_INT(self->NextCompat(compat, secnum));
|
||||
}
|
||||
|
||||
|
||||
class DLineIdIterator : public DObject, public FLineIdIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DLineIdIterator, DObject);
|
||||
public:
|
||||
DLineIdIterator(int tag)
|
||||
: FLineIdIterator(tag)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DLineIdIterator, true, false);
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DLineIdIterator, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(tag);
|
||||
ACTION_RETURN_POINTER(Create<DLineIdIterator>(tag));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DLineIdIterator, Next)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DLineIdIterator);
|
||||
ACTION_RETURN_INT(self->Next());
|
||||
}
|
||||
|
||||
|
|
|
@ -373,15 +373,6 @@ int GetUDMFInt(int type, int index, FName key)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FLevelLocals, GetUDMFInt)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||
PARAM_INT(type);
|
||||
PARAM_INT(index);
|
||||
PARAM_NAME(key);
|
||||
ACTION_RETURN_INT(GetUDMFInt(type, index, key));
|
||||
}
|
||||
|
||||
double GetUDMFFloat(int type, int index, FName key)
|
||||
{
|
||||
assert(type >=0 && type <=3);
|
||||
|
@ -399,15 +390,6 @@ double GetUDMFFloat(int type, int index, FName key)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FLevelLocals, GetUDMFFloat)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||
PARAM_INT(type);
|
||||
PARAM_INT(index);
|
||||
PARAM_NAME(key);
|
||||
ACTION_RETURN_FLOAT(GetUDMFFloat(type, index, key));
|
||||
}
|
||||
|
||||
FString GetUDMFString(int type, int index, FName key)
|
||||
{
|
||||
assert(type >= 0 && type <= 3);
|
||||
|
@ -425,16 +407,6 @@ FString GetUDMFString(int type, int index, FName key)
|
|||
return "";
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FLevelLocals, GetUDMFString)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||
PARAM_INT(type);
|
||||
PARAM_INT(index);
|
||||
PARAM_NAME(key);
|
||||
ACTION_RETURN_STRING(GetUDMFString(type, index, key));
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// UDMF parser
|
||||
|
|
394
src/scripting/vmiterators.cpp
Normal file
394
src/scripting/vmiterators.cpp
Normal file
|
@ -0,0 +1,394 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright 2016-2018 Christoph Oelckers
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// VM iterators
|
||||
//
|
||||
// These classes are thin wrappers which wrap the standars iterators into a DObject
|
||||
// so that the VM can use them
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "actor.h"
|
||||
#include "p_tags.h"
|
||||
#include "p_maputl.h"
|
||||
#include "vm.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// scriptable thinker iterator
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
class DThinkerIterator : public DObject, public FThinkerIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DThinkerIterator, DObject)
|
||||
|
||||
public:
|
||||
DThinkerIterator(PClass *cls, int statnum = MAX_STATNUM + 1)
|
||||
: FThinkerIterator(cls, statnum)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DThinkerIterator, true, false);
|
||||
|
||||
static DThinkerIterator *CreateThinkerIterator(PClass *type, int statnum)
|
||||
{
|
||||
return Create<DThinkerIterator>(type, statnum);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DThinkerIterator, Create, CreateThinkerIterator)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_CLASS(type, DThinker);
|
||||
PARAM_INT(statnum);
|
||||
ACTION_RETURN_OBJECT(Create<DThinkerIterator>(type, statnum));
|
||||
}
|
||||
|
||||
static DThinker *NextThinker(DThinkerIterator *self, bool exact)
|
||||
{
|
||||
return self->Next(exact);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DThinkerIterator, Next, NextThinker)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DThinkerIterator);
|
||||
PARAM_BOOL(exact);
|
||||
ACTION_RETURN_OBJECT(self->Next(exact));
|
||||
}
|
||||
|
||||
static void ReinitThinker(DThinkerIterator *self)
|
||||
{
|
||||
self->Reinit();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DThinkerIterator, Reinit, ReinitThinker)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DThinkerIterator);
|
||||
self->Reinit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// scriptable BlockLines iterator
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class DBlockLinesIterator : public DObject, public FMultiBlockLinesIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DBlockLinesIterator, DObject);
|
||||
FPortalGroupArray check;
|
||||
|
||||
public:
|
||||
FMultiBlockLinesIterator::CheckResult cres;
|
||||
|
||||
DBlockLinesIterator(AActor *actor, double checkradius)
|
||||
: FMultiBlockLinesIterator(check, actor, checkradius)
|
||||
{
|
||||
cres.line = nullptr;
|
||||
cres.Position.Zero();
|
||||
cres.portalflags = 0;
|
||||
}
|
||||
|
||||
DBlockLinesIterator(double x, double y, double z, double height, double radius, sector_t *sec)
|
||||
:FMultiBlockLinesIterator(check, x, y, z, height, radius, sec)
|
||||
{
|
||||
cres.line = nullptr;
|
||||
cres.Position.Zero();
|
||||
cres.portalflags = 0;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DBlockLinesIterator, true, false);
|
||||
|
||||
static DBlockLinesIterator *CreateBLI(AActor *origin, double radius)
|
||||
{
|
||||
return Create<DBlockLinesIterator>(origin, radius);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBlockLinesIterator, Create, CreateBLI)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT_NOT_NULL(origin, AActor);
|
||||
PARAM_FLOAT(radius);
|
||||
ACTION_RETURN_OBJECT(Create<DBlockLinesIterator>(origin, radius));
|
||||
}
|
||||
|
||||
static DBlockLinesIterator *CreateBLIFromPos(double x, double y, double z, double h, double radius, sector_t *sec)
|
||||
{
|
||||
return Create<DBlockLinesIterator>(x, y, z, h, radius, sec);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBlockLinesIterator, CreateFromPos, CreateBLIFromPos)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(z);
|
||||
PARAM_FLOAT(h);
|
||||
PARAM_FLOAT(radius);
|
||||
PARAM_POINTER(sec, sector_t);
|
||||
ACTION_RETURN_OBJECT(Create<DBlockLinesIterator>(x, y, z, h, radius, sec));
|
||||
}
|
||||
|
||||
static bool BLINext(DBlockLinesIterator *self)
|
||||
{
|
||||
return self->Next(&self->cres);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBlockLinesIterator, Next, BLINext)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DBlockLinesIterator);
|
||||
ACTION_RETURN_BOOL(BLINext(self));
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// scriptable BlockThings iterator
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class DBlockThingsIterator : public DObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DBlockThingsIterator, DObject);
|
||||
FPortalGroupArray check;
|
||||
public:
|
||||
FMultiBlockThingsIterator iterator;
|
||||
FMultiBlockThingsIterator::CheckResult cres;
|
||||
|
||||
DBlockThingsIterator(AActor *origin, double checkradius = -1, bool ignorerestricted = false)
|
||||
: iterator(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)
|
||||
: iterator(check, checkx, checky, checkz, checkh, checkradius, ignorerestricted, newsec)
|
||||
{
|
||||
cres.thing = nullptr;
|
||||
cres.Position.Zero();
|
||||
cres.portalflags = 0;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DBlockThingsIterator, true, false);
|
||||
|
||||
|
||||
static DBlockThingsIterator *CreateBTI(AActor *origin, double radius, bool ignore)
|
||||
{
|
||||
return Create<DBlockThingsIterator>(origin, radius, ignore);
|
||||
}
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBlockThingsIterator, Create, CreateBTI)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT_NOT_NULL(origin, AActor);
|
||||
PARAM_FLOAT(radius);
|
||||
PARAM_BOOL(ignore);
|
||||
ACTION_RETURN_OBJECT(Create<DBlockThingsIterator>(origin, radius, ignore));
|
||||
}
|
||||
|
||||
static DBlockThingsIterator *CreateBTIFromPos(double x, double y, double z, double h, double radius, bool ignore)
|
||||
{
|
||||
return Create<DBlockThingsIterator>(x, y, z, h, radius, ignore, nullptr);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBlockThingsIterator, CreateFromPos, CreateBTIFromPos)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(z);
|
||||
PARAM_FLOAT(h);
|
||||
PARAM_FLOAT(radius);
|
||||
PARAM_BOOL(ignore);
|
||||
ACTION_RETURN_OBJECT(Create<DBlockThingsIterator>(x, y, z, h, radius, ignore, nullptr));
|
||||
}
|
||||
|
||||
static bool NextBTI(DBlockThingsIterator *bti)
|
||||
{
|
||||
return bti->iterator.Next(&bti->cres);
|
||||
}
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DBlockThingsIterator, Next, NextBTI)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DBlockThingsIterator);
|
||||
ACTION_RETURN_BOOL(NextBTI(self));
|
||||
}
|
||||
|
||||
|
||||
class DSectorTagIterator : public DObject, public FSectorTagIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DSectorTagIterator, DObject);
|
||||
public:
|
||||
DSectorTagIterator(int tag, line_t *line)
|
||||
{
|
||||
if (line == nullptr) Init(tag);
|
||||
else Init(tag, line);
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DSectorTagIterator, true, false);
|
||||
|
||||
static DSectorTagIterator *CreateSTI(int tag, line_t *line)
|
||||
{
|
||||
return Create<DSectorTagIterator>(tag, line);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DSectorTagIterator, Create, CreateSTI)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(tag);
|
||||
PARAM_POINTER(line, line_t);
|
||||
ACTION_RETURN_POINTER(Create<DSectorTagIterator>(tag, line));
|
||||
}
|
||||
|
||||
int NextSTI(DSectorTagIterator *self)
|
||||
{
|
||||
return self->Next();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DSectorTagIterator, Next, NextSTI)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DSectorTagIterator);
|
||||
ACTION_RETURN_INT(self->Next());
|
||||
}
|
||||
|
||||
int NextCompatSTI(DSectorTagIterator *self, bool compat, int secnum)
|
||||
{
|
||||
return self->NextCompat(compat, secnum);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DSectorTagIterator, NextCompat, NextCompatSTI)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DSectorTagIterator);
|
||||
PARAM_BOOL(compat);
|
||||
PARAM_INT(secnum);
|
||||
ACTION_RETURN_INT(self->NextCompat(compat, secnum));
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// scriptable line id iterator
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class DLineIdIterator : public DObject, public FLineIdIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DLineIdIterator, DObject);
|
||||
public:
|
||||
DLineIdIterator(int tag)
|
||||
: FLineIdIterator(tag)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DLineIdIterator, true, false);
|
||||
|
||||
|
||||
static DLineIdIterator *CreateLTI(int tag)
|
||||
{
|
||||
return Create<DLineIdIterator>(tag);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DLineIdIterator, Create, CreateLTI)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(tag);
|
||||
ACTION_RETURN_POINTER(Create<DLineIdIterator>(tag));
|
||||
}
|
||||
|
||||
int NextLTI(DLineIdIterator *self)
|
||||
{
|
||||
return self->Next();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DLineIdIterator, Next, NextLTI)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DLineIdIterator);
|
||||
ACTION_RETURN_INT(self->Next());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// scriptable actor iterator
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
class DActorIterator : public DObject, public NActorIterator
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(DActorIterator, DObject)
|
||||
|
||||
public:
|
||||
DActorIterator(PClassActor *cls = nullptr, int tid = 0)
|
||||
: NActorIterator(cls, tid)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DActorIterator, true, false);
|
||||
|
||||
static DActorIterator *CreateActI(int tid, PClassActor *type)
|
||||
{
|
||||
return Create<DActorIterator>(type, tid);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DActorIterator, Create, CreateActI)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(tid);
|
||||
PARAM_CLASS(type, AActor);
|
||||
ACTION_RETURN_OBJECT(Create<DActorIterator>(type, tid));
|
||||
}
|
||||
|
||||
static AActor *NextActI(DActorIterator *self)
|
||||
{
|
||||
return self->Next();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DActorIterator, Next, NextActI)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DActorIterator);
|
||||
ACTION_RETURN_OBJECT(self->Next());
|
||||
}
|
||||
|
||||
static void ReinitActI(DActorIterator *self)
|
||||
{
|
||||
self->Reinit();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DActorIterator, Reinit, ReinitActI)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DActorIterator);
|
||||
self->Reinit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_FIELD_NAMED(DBlockLinesIterator, cres.line, curline);
|
||||
DEFINE_FIELD_NAMED(DBlockLinesIterator, cres.Position, position);
|
||||
DEFINE_FIELD_NAMED(DBlockLinesIterator, cres.portalflags, portalflags);
|
||||
|
||||
DEFINE_FIELD_NAMED(DBlockThingsIterator, cres.thing, thing);
|
||||
DEFINE_FIELD_NAMED(DBlockThingsIterator, cres.Position, position);
|
||||
DEFINE_FIELD_NAMED(DBlockThingsIterator, cres.portalflags, portalflags);
|
|
@ -42,11 +42,24 @@
|
|||
#include "a_pickups.h"
|
||||
#include "a_specialspot.h"
|
||||
#include "actorptrselect.h"
|
||||
#include "a_weapons.h"
|
||||
#include "d_player.h"
|
||||
#include "p_setup.h"
|
||||
#include "i_music.h"
|
||||
|
||||
DVector2 AM_GetPosition();
|
||||
int Net_GetLatency(int *ld, int *ad);
|
||||
void PrintPickupMessage(bool localview, const FString &str);
|
||||
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DObject, SetMusicVolume, I_SetMusicVolume)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_FLOAT(vol);
|
||||
I_SetMusicVolume(vol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
//
|
||||
// FString exports
|
||||
|
@ -1877,6 +1890,64 @@ DEFINE_ACTION_FUNCTION_NATIVE(AKey, GetKeyType, P_GetKeyType)
|
|||
ACTION_RETURN_POINTER(P_GetKeyType(num));
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
//
|
||||
// WeaponSlots exports
|
||||
//
|
||||
//=====================================================================================
|
||||
|
||||
static int LocateWeapon(FWeaponSlots *self, PClassActor *weap, int *pslot, int *pindex)
|
||||
{
|
||||
return self->LocateWeapon(weap, pslot, pindex);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, LocateWeapon, LocateWeapon)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FWeaponSlots);
|
||||
PARAM_CLASS(weap, AActor);
|
||||
int slot = 0, index = 0;
|
||||
bool retv = self->LocateWeapon(weap, &slot, &index);
|
||||
if (numret >= 1) ret[0].SetInt(retv);
|
||||
if (numret >= 2) ret[1].SetInt(slot);
|
||||
if (numret >= 3) ret[2].SetInt(index);
|
||||
return MIN(numret, 3);
|
||||
}
|
||||
|
||||
static PClassActor *GetWeapon(FWeaponSlots *self, int slot, int index)
|
||||
{
|
||||
return self->GetWeapon(slot, index);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, GetWeapon, GetWeapon)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FWeaponSlots);
|
||||
PARAM_INT(slot);
|
||||
PARAM_INT(index);
|
||||
ACTION_RETURN_POINTER(self->GetWeapon(slot, index));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int SlotSize(FWeaponSlots *self, int slot)
|
||||
{
|
||||
return self->SlotSize(slot);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, SlotSize, SlotSize)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FWeaponSlots);
|
||||
PARAM_INT(slot);
|
||||
ACTION_RETURN_INT(self->SlotSize(slot));
|
||||
return 1;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, SetupWeaponSlots, FWeaponSlots::SetupWeaponSlots)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_OBJECT(pawn, APlayerPawn);
|
||||
FWeaponSlots::SetupWeaponSlots(pawn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
//
|
||||
// SpotState exports
|
||||
|
@ -2459,6 +2530,53 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetAutomapPosition, GetAutomapPositi
|
|||
ACTION_RETURN_VEC2(AM_GetPosition());
|
||||
}
|
||||
|
||||
static int ZGetUDMFInt(int type, int index, int key)
|
||||
{
|
||||
return GetUDMFInt(type, index, ENamedName(key));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFInt, ZGetUDMFInt)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||
PARAM_INT(type);
|
||||
PARAM_INT(index);
|
||||
PARAM_NAME(key);
|
||||
ACTION_RETURN_INT(GetUDMFInt(type, index, key));
|
||||
}
|
||||
|
||||
static double ZGetUDMFFloat(int type, int index, int key)
|
||||
{
|
||||
return GetUDMFFloat(type, index, ENamedName(key));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, GetUDMFFloat, ZGetUDMFFloat)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||
PARAM_INT(type);
|
||||
PARAM_INT(index);
|
||||
PARAM_NAME(key);
|
||||
ACTION_RETURN_FLOAT(GetUDMFFloat(type, index, key));
|
||||
}
|
||||
|
||||
static void ZGetUDMFString(int type, int index, int key, FString *result)
|
||||
{
|
||||
*result = GetUDMFString(type, index, ENamedName(key));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FLevelLocals, GetUDMFString, ZGetUDMFString)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
|
||||
PARAM_INT(type);
|
||||
PARAM_INT(index);
|
||||
PARAM_NAME(key);
|
||||
ACTION_RETURN_STRING(GetUDMFString(type, index, key));
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//=====================================================================================
|
||||
|
||||
static int GetRealTime()
|
||||
{
|
||||
|
@ -2485,8 +2603,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_AltHUD, GetLatency, Net_GetLatency)
|
|||
return numret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DEFINE_FIELD_X(Sector, sector_t, floorplane)
|
||||
DEFINE_FIELD_X(Sector, sector_t, ceilingplane)
|
||||
DEFINE_FIELD_X(Sector, sector_t, Colormap)
|
||||
|
|
|
@ -624,21 +624,13 @@ void I_UpdateMusic()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void I_SetMusicVolume (float factor)
|
||||
void I_SetMusicVolume (double factor)
|
||||
{
|
||||
factor = clamp<float>(factor, 0, 2.0f);
|
||||
relative_volume = saved_relative_volume * factor;
|
||||
factor = clamp(factor, 0., 2.0);
|
||||
relative_volume = saved_relative_volume * float(factor);
|
||||
snd_musicvolume.Callback();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DObject, SetMusicVolume)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_FLOAT(vol);
|
||||
I_SetMusicVolume((float)vol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// test a relative music volume
|
||||
|
|
|
@ -50,7 +50,7 @@ void I_BuildMIDIMenuList (FOptionValues *);
|
|||
void I_UpdateMusic ();
|
||||
|
||||
// Volume.
|
||||
void I_SetMusicVolume (float volume);
|
||||
void I_SetMusicVolume (double volume);
|
||||
|
||||
// Registers a song handle to song data.
|
||||
class MusInfo;
|
||||
|
|
Loading…
Reference in a new issue