mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- added scripting exports for the global map types and a few more actor utilities.
This commit is contained in:
parent
cc6629a95f
commit
df7e6dfec8
13 changed files with 988 additions and 16 deletions
|
@ -801,6 +801,7 @@ set( NOT_COMPILED_SOURCE_FILES
|
|||
games/duke/src/spawn.cpp
|
||||
games/duke/src/spawn_d.cpp
|
||||
games/duke/src/spawn_r.cpp
|
||||
games/duke/src/vmexports.cpp
|
||||
|
||||
# Shadow Warrior
|
||||
games/sw/src/actor.cpp
|
||||
|
@ -1014,6 +1015,7 @@ set (PCH_SOURCES
|
|||
|
||||
core/actorinfo.cpp
|
||||
core/zcc_compile_raze.cpp
|
||||
core/vmexports.cpp
|
||||
core/thingdef_data.cpp
|
||||
core/thingdef_properties.cpp
|
||||
core/actorlist.cpp
|
||||
|
|
|
@ -517,13 +517,30 @@ DEFINE_ACTION_FUNCTION(DCoreActor, pos)
|
|||
ACTION_RETURN_VEC3(DVector3(self->spr.pos.X * (1 / 16.), self->spr.pos.Y * (1 / 16.), self->spr.pos.Z * (1 / 256.)));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DCoreActor, xy)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DCoreActor);
|
||||
ACTION_RETURN_VEC2(DVector2(self->spr.pos.X * (1 / 16.), self->spr.pos.Y * (1 / 16.)));
|
||||
}
|
||||
|
||||
double coreactor_z(DCoreActor* self)
|
||||
{
|
||||
return self->spr.zvel * zinttoworld;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, z, coreactor_z)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DCoreActor);
|
||||
ACTION_RETURN_FLOAT(coreactor_z(self));
|
||||
}
|
||||
|
||||
void coreactor_setpos(DCoreActor* self, double x, double y, double z, int relink)
|
||||
{
|
||||
self->spr.pos.X = int(x * 16);
|
||||
self->spr.pos.Y = int(y * 16);
|
||||
self->spr.pos.Z = int(z * 256);
|
||||
self->spr.pos.X = int(x * worldtoint);
|
||||
self->spr.pos.Y = int(y * worldtoint);
|
||||
self->spr.pos.Z = int(z * zworldtoint);
|
||||
// todo: SW needs to call updatesectorz here or have a separate function.
|
||||
if (relink) updatesector(self->spr.pos.X, self->spr.pos.Y, &self->spr.sectp);
|
||||
if (relink) SetActor(self, self->spr.pos);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, setpos, coreactor_setpos)
|
||||
|
@ -537,13 +554,30 @@ DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, setpos, coreactor_setpos)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void coreactor_copypos(DCoreActor* self, DCoreActor* other, int relink)
|
||||
{
|
||||
if (!other) return;
|
||||
self->spr.pos = other->spr.pos;
|
||||
// todo: SW needs to call updatesectorz here or have a separate function.
|
||||
if (relink) SetActor(self, self->spr.pos);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, copypos, coreactor_setpos)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DCoreActor);
|
||||
PARAM_POINTER(other, DCoreActor);
|
||||
PARAM_BOOL(relink);
|
||||
coreactor_copypos(self, other, relink);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void coreactor_move(DCoreActor* self, double x, double y, double z, int relink)
|
||||
{
|
||||
self->spr.pos.X += int(x * 16);
|
||||
self->spr.pos.Y += int(y * 16);
|
||||
self->spr.pos.Z += int(z * 256);
|
||||
// todo: SW needs to call updatesectorz here or have a separate function.
|
||||
if (relink) updatesector(self->spr.pos.X, self->spr.pos.Y, &self->spr.sectp);
|
||||
if (relink) SetActor(self, self->spr.pos);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, move, coreactor_move)
|
||||
|
@ -600,3 +634,16 @@ DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, setSpritePic, coreactor_setSpritePic)
|
|||
coreactor_setSpritePic(self, z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void coreactor_backuppos(DCoreActor* self)
|
||||
{
|
||||
self->backuppos();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, backuppos, coreactor_backuppos)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DCoreActor);
|
||||
coreactor_backuppos(self);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,6 +156,10 @@ public:
|
|||
return spr.sectp ? ::sector.IndexOf(spr.sectp) : -1;
|
||||
}
|
||||
|
||||
auto spriteset() const
|
||||
{
|
||||
return static_cast<PClassActor*>(GetClass())->ActorInfo()->SpriteSet;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1573,6 +1573,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, bcos, bcos)
|
|||
ACTION_RETURN_INT(bcos(v, shift));
|
||||
}
|
||||
|
||||
int raze_getangle(double x, double y)
|
||||
{
|
||||
return bvectangbam(x, y).asbuild();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, getangle, raze_getangle)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
ACTION_RETURN_INT(raze_getangle(x, y));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, GetBuildTime, I_GetBuildTime)
|
||||
{
|
||||
ACTION_RETURN_INT(I_GetBuildTime());
|
||||
|
|
|
@ -345,11 +345,11 @@ struct sectortype
|
|||
void setceilingslope(int heinum) { ceilingheinum = heinum; if (heinum) ceilingstat |= CSTAT_SECTOR_SLOPE; else ceilingstat &= ~CSTAT_SECTOR_SLOPE; }
|
||||
void setfloorslope(int heinum) { floorheinum = heinum; if (heinum) floorstat |= CSTAT_SECTOR_SLOPE; else floorstat &= ~CSTAT_SECTOR_SLOPE; }
|
||||
int getfloorslope() const { return floorstat & CSTAT_SECTOR_SLOPE ? floorheinum : 0; }
|
||||
int getceilingslope() const { return ceilingstat & CSTAT_SECTOR_SLOPE ? ceilingheinum : 0; }
|
||||
walltype* firstWall() const;
|
||||
walltype* lastWall() const;
|
||||
|
||||
|
||||
// These will unfortunately have to be within the base struct to refactor Blood properly. They can later be removed again, once everything is done.
|
||||
Blood::XSECTOR& xs() const { return *_xs; }
|
||||
bool hasX() const { return _xs != nullptr; } // 0 is invalid!
|
||||
void allocX();
|
||||
|
|
|
@ -148,7 +148,7 @@ enum EDefinitionType
|
|||
#if defined(_MSC_VER)
|
||||
#pragma section(SECTION_GREG,read)
|
||||
|
||||
#define MSVC_PSEG __declspec(allocate(SECTION_GREG)) __declspec(no_sanitize_address)
|
||||
#define MSVC_PSEG __declspec(allocate(SECTION_GREG))
|
||||
#define GCC_PSEG
|
||||
#else
|
||||
#define MSVC_PSEG
|
||||
|
|
|
@ -19,10 +19,6 @@
|
|||
** 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.
|
||||
** 4. When not used as part of ZDoom or a ZDoom derivative, this code will be
|
||||
** covered by the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or (at
|
||||
** your option) any later version.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
|
|
@ -19,10 +19,6 @@
|
|||
** 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.
|
||||
** 4. When not used as part of ZDoom or a ZDoom derivative, this code will be
|
||||
** covered by the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or (at
|
||||
** your option) any later version.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
|
|
586
source/core/vmexports.cpp
Normal file
586
source/core/vmexports.cpp
Normal file
|
@ -0,0 +1,586 @@
|
|||
/*
|
||||
** vmexports.cpp
|
||||
**
|
||||
** global script exports
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2022 Christoph Oelckers
|
||||
** 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 "maptypes.h"
|
||||
#include "vm.h"
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// internal sector struct - no longer identical with on-disk format
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
DEFINE_FIELD_NAMED_X(sectortype, sectortype, ceilingxpan_, ceilingxpan)
|
||||
DEFINE_FIELD_NAMED_X(sectortype, sectortype, ceilingypan_, ceilingypan)
|
||||
DEFINE_FIELD_NAMED_X(sectortype, sectortype, floorxpan_, floorxpan)
|
||||
DEFINE_FIELD_NAMED_X(sectortype, sectortype, floorypan_, floorypan)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, wallptr)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, wallnum)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, ceilingstat)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, floorstat)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, lotag)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, type)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, hitag)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, extra)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, ceilingshade)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, ceilingpal)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, floorshade)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, floorpal)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, visibility)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, fogpal)
|
||||
DEFINE_FIELD_X(sectortype, sectortype, exflags)
|
||||
|
||||
DEFINE_FIELD_NAMED_X(walltype, walltype, xpan_, xpan)
|
||||
DEFINE_FIELD_NAMED_X(walltype, walltype, ypan_, ypan)
|
||||
DEFINE_FIELD_X(walltype, walltype, pos)
|
||||
DEFINE_FIELD_X(walltype, walltype, point2)
|
||||
DEFINE_FIELD_X(walltype, walltype, nextwall)
|
||||
DEFINE_FIELD_X(walltype, walltype, sector)
|
||||
DEFINE_FIELD_X(walltype, walltype, nextsector)
|
||||
DEFINE_FIELD_X(walltype, walltype, cstat)
|
||||
DEFINE_FIELD_X(walltype, walltype, lotag)
|
||||
DEFINE_FIELD_X(walltype, walltype, type)
|
||||
DEFINE_FIELD_X(walltype, walltype, hitag)
|
||||
DEFINE_FIELD_X(walltype, walltype, extra)
|
||||
DEFINE_FIELD_X(walltype, walltype, shade)
|
||||
DEFINE_FIELD_X(walltype, walltype, pal)
|
||||
DEFINE_FIELD_X(walltype, walltype, xrepeat)
|
||||
DEFINE_FIELD_X(walltype, walltype, yrepeat)
|
||||
|
||||
DEFINE_FIELD_NAMED_X(tspritetype, tspritetype, sectp, sector)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, cstat)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, statnum)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, ang)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, xvel)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, yvel)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, zvel)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, lotag)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, hitag)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, extra)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, detail)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, shade)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, pal)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, clipdist)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, blend)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, xrepeat)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, yrepeat)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, xoffset)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, yoffset)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, ownerActor)
|
||||
DEFINE_FIELD_X(tspritetype, tspritetype, time)
|
||||
|
||||
DEFINE_GLOBAL(wall)
|
||||
DEFINE_GLOBAL(sector)
|
||||
|
||||
double sector_floorz(sectortype* sect)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return sect->floorz * zinttoworld;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, floorz, sector_floorz)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
ACTION_RETURN_FLOAT(self->floorz * zinttoworld);
|
||||
}
|
||||
|
||||
double sector_ceilingz(sectortype* sect)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return sect->ceilingz * zinttoworld;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, ceilingz, sector_ceilingz)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
ACTION_RETURN_FLOAT(self->ceilingz * zinttoworld);
|
||||
}
|
||||
|
||||
void sector_setfloorz(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->setfloorz(int(val * zworldtoint));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setfloorz, sector_floorz)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(z);
|
||||
self->setfloorz(z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_setceilingz(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->setceilingz(int(val * zworldtoint));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setceilingz, sector_ceilingz)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(z);
|
||||
self->setceilingz(z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_addfloorz(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->addfloorz(int(val * zworldtoint));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addfloorz, sector_floorz)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(z);
|
||||
self->addfloorz(z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_addceilingz(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->addceilingz(int(val * zworldtoint));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addceilingz, sector_ceilingz)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(z);
|
||||
self->addceilingz(z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_setfloorxpan(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->setfloorxpan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setfloorxpan, sector_setfloorxpan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(xpan);
|
||||
self->setfloorxpan(xpan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_setceilingxpan(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->setceilingxpan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setceilingxpan, sector_setceilingxpan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(xpan);
|
||||
self->setceilingxpan(xpan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_addfloorxpan(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->addfloorxpan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addfloorxpan, sector_addfloorxpan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(xpan);
|
||||
self->addfloorxpan(xpan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_addceilingxpan(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->addceilingxpan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addceilingxpan, sector_addceilingxpan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(xpan);
|
||||
self->addceilingxpan(xpan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_setfloorypan(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->setfloorypan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setfloorypan, sector_setfloorypan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(ypan);
|
||||
self->setfloorypan(ypan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_setceilingypan(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->setceilingypan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setceilingypan, sector_setceilingypan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(ypan);
|
||||
self->setceilingypan(ypan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_addfloorypan(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->addfloorypan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addfloorypan, sector_addfloorypan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(ypan);
|
||||
self->addfloorypan(ypan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_addceilingypan(sectortype* sect, double val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->addceilingypan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addceilingypan, sector_addceilingypan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_FLOAT(ypan);
|
||||
self->addceilingypan(ypan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void sector_setfloorslope(sectortype* sect, int val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->setfloorslope(val);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setfloorslope, sector_setfloorslope)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_INT(slope);
|
||||
self->setfloorslope(slope);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sector_setceilingslope(sectortype* sect, int val)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
sect->setceilingslope(val);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setceilingslope, sector_setceilingslope)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
PARAM_INT(slope);
|
||||
self->setceilingslope(slope);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sector_floorslope(sectortype* sect)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return sect->getfloorslope();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, floorslope, sector_floorslope)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
ACTION_RETURN_INT(self->getfloorslope());
|
||||
}
|
||||
|
||||
int sector_ceilingslope(sectortype* sect)
|
||||
{
|
||||
if (!sect) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return sect->getceilingslope();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, ceilingslope, sector_ceilingslope)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
|
||||
ACTION_RETURN_INT(self->getceilingslope());
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void wall_setxpan(walltype* wal, double val)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
wal->setxpan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, setxpan, wall_setxpan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
PARAM_FLOAT(xpan);
|
||||
self->setxpan(xpan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wall_addxpan(walltype* wal, double val)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
wal->addxpan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, addxpan, wall_addxpan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
PARAM_FLOAT(xpan);
|
||||
self->addxpan(xpan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wall_setypan(walltype* wal, double val)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
wal->setypan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, setypan, wall_setypan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
PARAM_FLOAT(ypan);
|
||||
self->setypan(ypan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wall_addypan(walltype* wal, double val)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
wal->addypan(float(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, addypan, wall_addypan)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
PARAM_FLOAT(ypan);
|
||||
self->addypan(ypan);
|
||||
return 0;
|
||||
}
|
||||
|
||||
sectortype* wall_nextsector(walltype* wal)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return wal->nextSector();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, nextsectorp, wall_nextsector)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_POINTER(self->nextSector());
|
||||
}
|
||||
|
||||
sectortype* wall_sector(walltype* wal)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return wal->sectorp();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, sectorp, wall_sector)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_POINTER(self->sectorp());
|
||||
}
|
||||
|
||||
walltype* wall_nextwall(walltype* wal)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return wal->nextWall();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, nextwallp, wall_nextwall)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_POINTER(self->nextWall());
|
||||
}
|
||||
|
||||
walltype* wall_lastwall(walltype* wal)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return wal->lastWall();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, lastwall, wall_lastwall)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_POINTER(self->lastWall());
|
||||
}
|
||||
|
||||
walltype* wall_point2wall(walltype* wal)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return wal->point2Wall();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, point2wall, wall_point2wall)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_POINTER(self->point2Wall());
|
||||
}
|
||||
|
||||
double wall_deltax(walltype* wal)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return wal->deltax();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, deltax, wall_point2wall)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_FLOAT(self->deltax());
|
||||
}
|
||||
|
||||
double wall_deltay(walltype* wal)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return wal->deltay();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, deltay, wall_point2wall)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_FLOAT(self->deltay());
|
||||
}
|
||||
|
||||
double wall_length(walltype* wal)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return wal->Length();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, length, wall_point2wall)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_FLOAT(self->Length());
|
||||
}
|
||||
|
||||
void wall_move(walltype* wal, double x, double y)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
wal->movexy(x, y);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, move, wall_move)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
self->movexy(x, y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wall_twosided(walltype* wal)
|
||||
{
|
||||
if (!wal) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
return wal->twoSided();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_walltype, twosided, wall_twosided)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(walltype);
|
||||
ACTION_RETURN_BOOL(self->twoSided());
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_tspritetype, pos)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
|
||||
ACTION_RETURN_VEC3(DVector3(self->pos.X * inttoworld, self->pos.Y * inttoworld, self->pos.Z * zinttoworld));
|
||||
}
|
||||
|
||||
void tsprite_setpos(tspritetype* tsp, double x, double y, double z)
|
||||
{
|
||||
if (!tsp) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
tsp->pos.X = int(x * worldtoint);
|
||||
tsp->pos.Y = int(y * worldtoint);
|
||||
tsp->pos.Z = int(z * zworldtoint);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, setpos, tsprite_setpos)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(z);
|
||||
tsprite_setpos(self, x, y, z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tsprite_addpos(tspritetype* tsp, double x, double y, double z)
|
||||
{
|
||||
if (!tsp) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
tsp->pos.X = int(x * worldtoint);
|
||||
tsp->pos.Y = int(y * worldtoint);
|
||||
tsp->pos.Z = int(z * zworldtoint);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, addpos, tsprite_addpos)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
|
||||
PARAM_FLOAT(x);
|
||||
PARAM_FLOAT(y);
|
||||
PARAM_FLOAT(z);
|
||||
tsprite_addpos(self, x, y, z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
struct tsprite
|
||||
{
|
||||
void setPic(string texture);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -33,6 +33,7 @@ version "4.3"
|
|||
#include "zscript/summary.zs"
|
||||
#include "zscript/statusbar.zs"
|
||||
#include "zscript/usermapmenu.zs"
|
||||
#include "zscript/maptypes.zs"
|
||||
#include "zscript/coreactor.zs"
|
||||
#include "zscript/games/duke/dukeactor.zs"
|
||||
#include "zscript/games/blood/bloodactor.zs"
|
||||
|
|
|
@ -33,16 +33,21 @@ class CoreActor native
|
|||
native uint8 renderflags;
|
||||
native float alpha;
|
||||
|
||||
native readonly sectortype sector;
|
||||
native readonly int16 spritesetpic;
|
||||
native readonly int spawnindex;
|
||||
|
||||
// note that the pos vector is not directly accessible here.
|
||||
// Its mixed fixed point format should be hidden from scripting, plus we need to wrap the setters to ensure proper sector linking anyway.
|
||||
native Vector3 pos();
|
||||
native Vector2 xy();
|
||||
native double z();
|
||||
native void setpos(Vector3 newpos, bool relink = true);
|
||||
native void copypos(CoreActor newpos, bool relink = true);
|
||||
native void move(Vector3 newpos, bool relink = true);
|
||||
native void setz(double newz);
|
||||
native void addz(double amount);
|
||||
native void setSpritePic(int index); // index into actor's spriteset.
|
||||
native void backuppos();
|
||||
}
|
||||
|
||||
|
|
317
wadsrc/static/zscript/maptypes.zs
Normal file
317
wadsrc/static/zscript/maptypes.zs
Normal file
|
@ -0,0 +1,317 @@
|
|||
|
||||
// Original Build sector bit flags.
|
||||
enum ESectorBits
|
||||
{
|
||||
CSTAT_SECTOR_SKY = 1,
|
||||
CSTAT_SECTOR_SLOPE = 2,
|
||||
CSTAT_SECTOR_SWAPXY = 4,
|
||||
CSTAT_SECTOR_TEXHALF = 8,
|
||||
CSTAT_SECTOR_XFLIP = 16,
|
||||
CSTAT_SECTOR_YFLIP = 32,
|
||||
CSTAT_SECTOR_ALIGN = 64,
|
||||
CSTAT_SECTOR_TRANS = 128,
|
||||
CSTAT_SECTOR_TRANS_INVERT = 256,
|
||||
CSTAT_SECTOR_METHOD = 384,
|
||||
CSTAT_SECTOR_FAF_BLOCK_HITSCAN = 32768, // SW only
|
||||
|
||||
CSTAT_SECTOR_EXHUMED_BIT1 = 1 << 14,
|
||||
CSTAT_SECTOR_EXHUMED_BIT2 = 1 << 15,
|
||||
|
||||
CSTAT_SECTOR_NO_CEILINGSHADE = 32768, // Blood: Force use of floorshade for sprites, even in sky sectors.
|
||||
|
||||
}
|
||||
|
||||
enum EWallBits // names are from Shadow Warrior
|
||||
{
|
||||
CSTAT_WALL_BLOCK = 1, // bit 0: 1 = Blocking wall (use with clipmove, getzrange) "B"
|
||||
CSTAT_WALL_BOTTOM_SWAP = 2, // bit 1: 1 = bottoms of invisible walls swapped, 0 = not "2"
|
||||
CSTAT_WALL_ALIGN_BOTTOM = 4, // bit 2: 1 = align picture on bottom (for doors), 0 = top "O"
|
||||
CSTAT_WALL_XFLIP = 8, // bit 3: 1 = x-flipped, 0 = normal "F"
|
||||
CSTAT_WALL_MASKED = 16, // bit 4: 1 = masking wall, 0 = not "M"
|
||||
CSTAT_WALL_1WAY = 32, // bit 5: 1 = 1-way wall, 0 = not "1"
|
||||
CSTAT_WALL_BLOCK_HITSCAN = 64, // bit 6: 1 = Blocking wall (use with hitscan / cliptype 1) "H"
|
||||
CSTAT_WALL_TRANSLUCENT = 128, // bit 7: 1 = Transluscence, 0 = not "T"
|
||||
CSTAT_WALL_YFLIP = 256, // bit 8: 1 = y-flipped, 0 = normal "F"
|
||||
CSTAT_WALL_TRANS_FLIP = 512, // bit 9: 1 = Transluscence reversing, 0 = normal "T"
|
||||
CSTAT_WALL_ANY_EXCEPT_BLOCK = 254, // Duke stupidity
|
||||
|
||||
CSTAT_WALL_ROTATE_90 = 1<<12, // EDuke32 extension supported by Raze
|
||||
|
||||
CSTAT_WALL_BLOCK_ACTOR = 1<<14, // SW specific.
|
||||
CSTAT_WALL_WARP_HITSCAN = 1<<15, // SW specific.
|
||||
|
||||
CSTAT_WALL_MOVE_FORWARD = 1 << 14, // Blood specific
|
||||
CSTAT_WALL_MOVE_BACKWARD = 1 << 15, // Blood specific
|
||||
CSTAT_WALL_MOVE_MASK = CSTAT_WALL_MOVE_FORWARD | CSTAT_WALL_MOVE_BACKWARD
|
||||
|
||||
}
|
||||
|
||||
enum ESpriteBits // names mostly from SW.
|
||||
{
|
||||
CSTAT_SPRITE_BLOCK = 1, // bit 0: 1 = Blocking sprite (use with clipmove, getzrange) "B"
|
||||
CSTAT_SPRITE_TRANSLUCENT = 2, // bit 1: 1 = transluscence, 0 = normal "T"
|
||||
CSTAT_SPRITE_XFLIP = 4, // bit 2: 1 = x-flipped, 0 = normal "F"
|
||||
CSTAT_SPRITE_YFLIP = 8, // bit 3: 1 = y-flipped, 0 = normal "F"
|
||||
|
||||
CSTAT_SPRITE_ALIGNMENT_FACING = 0, // bits 5-4: 00 = FACE sprite (default) "R"
|
||||
CSTAT_SPRITE_ALIGNMENT_WALL = 16, // 01 = WALL sprite (like masked walls)
|
||||
CSTAT_SPRITE_ALIGNMENT_FLOOR = 32, // 10 = FLOOR sprite (parallel to ceilings&floors)
|
||||
CSTAT_SPRITE_ALIGNMENT_SLAB = 48, // 11 = either voxel or slope sprite, depending on the situation
|
||||
CSTAT_SPRITE_ALIGNMENT_SLOPE = 48,
|
||||
CSTAT_SPRITE_ALIGNMENT_MASK = 48,
|
||||
|
||||
CSTAT_SPRITE_ONE_SIDE = 64, // bit 6: 1 = 1-sided sprite, 0 = normal "1"
|
||||
CSTAT_SPRITE_YCENTER = 128, // bit 7: 1 = Real centered centering, 0 = foot center "C"
|
||||
CSTAT_SPRITE_BLOCK_HITSCAN = 256, // bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1) "H"
|
||||
CSTAT_SPRITE_TRANS_FLIP = 512, // bit 9: 1 = Transluscence reversing, 0 = normal "T"
|
||||
|
||||
CSTAT_SPRITE_BLOCK_ALL = CSTAT_SPRITE_BLOCK_HITSCAN | CSTAT_SPRITE_BLOCK, // 257
|
||||
CSTAT_SPRITE_INVISIBLE = 32768, // bit 15: 1 = Invisible sprite, 0 = not invisible
|
||||
|
||||
// SW flags
|
||||
CSTAT_SPRITE_RESTORE = 1<<12,
|
||||
CSTAT_SPRITE_CLOSE_FLOOR = 1<<13, //tells whether a sprite started out close to a ceiling or floor
|
||||
CSTAT_SPRITE_BLOCK_MISSILE = 1<<14,
|
||||
CSTAT_SPRITE_BREAKABLE = CSTAT_SPRITE_BLOCK_HITSCAN|CSTAT_SPRITE_BLOCK_MISSILE,
|
||||
|
||||
// Blood flags
|
||||
CSTAT_SPRITE_BLOOD_BIT2 = 1024, // Both of these get set but not checked directly, so no idea what they mean...
|
||||
CSTAT_SPRITE_BLOOD_BIT1 = 4096,
|
||||
CSTAT_SPRITE_MOVE_FORWARD = 8192,
|
||||
CSTAT_SPRITE_MOVE_REVERSE = 16384,
|
||||
CSTAT_SPRITE_MOVE_MASK = CSTAT_SPRITE_MOVE_FORWARD | CSTAT_SPRITE_MOVE_REVERSE,
|
||||
}
|
||||
|
||||
enum ESpriteBits2
|
||||
{
|
||||
CSTAT2_SPRITE_NOFIND = 1, // Invisible to neartag and hitscan
|
||||
CSTAT2_SPRITE_MAPPED = 2, // sprite was mapped for automap
|
||||
CSTAT2_SPRITE_NOSHADOW = 4, // cast no shadow.
|
||||
CSTAT2_SPRITE_DECAL = 8, // always attached to a wall.
|
||||
}
|
||||
|
||||
// tsprite flags use the otherwise unused clipdist field.
|
||||
enum ETSprFlags
|
||||
{
|
||||
TSPR_FLAGS_MDHACK = 1, // Currently unused: set for model shadows
|
||||
TSPR_FLAGS_DRAW_LAST = 2, // Currently unused: checked by Polymost but never set.
|
||||
TSPR_MDLROTATE = 4, // rotate if this is a model or voxel.
|
||||
TSPR_SLOPESPRITE = 8, // render as sloped sprite
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// internal sector struct - no longer identical with on-disk format
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
struct sectortype native
|
||||
{
|
||||
// panning byte fields were promoted to full floats to enable panning interpolation.
|
||||
native readonly float ceilingxpan;
|
||||
native readonly float ceilingypan;
|
||||
native readonly float floorxpan;
|
||||
native readonly float floorypan;
|
||||
|
||||
native readonly int wallptr;
|
||||
native readonly int16 wallnum;
|
||||
native int16 ceilingstat;
|
||||
native int16 floorstat;
|
||||
//int16 ceilingpicnum;
|
||||
//int16 floorpicnum;
|
||||
|
||||
native int16 lotag;
|
||||
native int16 type; // type is an alias of lotag for Blood.
|
||||
native int16 hitag;
|
||||
native int16 extra;
|
||||
|
||||
native int8 ceilingshade;
|
||||
native uint8 ceilingpal;
|
||||
native int8 floorshade;
|
||||
native uint8 floorpal;
|
||||
native uint8 visibility;
|
||||
native uint8 fogpal; // EDuke32 extension - was originally a filler byte
|
||||
|
||||
// new additions not from the binary map format.
|
||||
native uint8 exflags;
|
||||
|
||||
|
||||
/*
|
||||
// Game specific extensions. Only export what's really needed.
|
||||
union
|
||||
{
|
||||
struct // DukeRR
|
||||
{
|
||||
uint8_t keyinfo; // This was originally the repurposed filler byte.
|
||||
uint8_t shadedsector;
|
||||
TObjPtr<DCoreActor*> hitagactor; // we need this because Duke stores an actor in the hitag field. Is really a DDukeActor, but cannot be declared here safely.
|
||||
}
|
||||
struct // Blood
|
||||
{
|
||||
BLD_NS::XSECTOR* _xs;
|
||||
TObjPtr<DCoreActor*> upperLink;
|
||||
TObjPtr<DCoreActor*> lowerLink;
|
||||
int baseFloor;
|
||||
int baseCeil;
|
||||
int velFloor;
|
||||
int velCeil;
|
||||
uint8_t slopewallofs; // This was originally the repurposed filler byte.
|
||||
}
|
||||
struct // Exhumed
|
||||
{
|
||||
sectortype* pSoundSect;
|
||||
sectortype* pAbove;
|
||||
sectortype* pBelow;
|
||||
int Depth;
|
||||
short Sound;
|
||||
short Flag;
|
||||
short Damage;
|
||||
short Speed;
|
||||
}
|
||||
struct // SW
|
||||
{
|
||||
// No need to allocate this on demand as it is smaller than what Blood needs.
|
||||
int flags;
|
||||
int depth_fixed;
|
||||
short stag; // ST? tag number - for certain things it helps to know it
|
||||
short ang;
|
||||
short height;
|
||||
short speed;
|
||||
short damage;
|
||||
short number; // usually used for matching number
|
||||
bool u_defined;
|
||||
uint8_t flags2;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
native double floorz();
|
||||
native double ceilingz();
|
||||
native void setceilingz(double cc, bool temp = false);
|
||||
native void setfloorz(double cc, bool temp = false);
|
||||
native void addceilingz(double cc, bool temp = false);
|
||||
native void addfloorz(double cc, bool temp = false);
|
||||
|
||||
native void setfloorxpan(double val);
|
||||
native void setfloorypan(double val);
|
||||
native void setceilingxpan(double val);
|
||||
native void setceilingypan(double val);
|
||||
native void addfloorxpan(double add);
|
||||
native void addfloorypan(double add);
|
||||
native void addceilingxpan(double add);
|
||||
native void addceilingypan(double add);
|
||||
native void setceilingslope(int heinum);
|
||||
native void setfloorslope(int heinum);
|
||||
native int ceilingslope();
|
||||
native int floorslope();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// internal wall struct - no longer identical with on-disk format
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
struct walltype native
|
||||
{
|
||||
native readonly Vector2 pos;
|
||||
|
||||
native readonly int point2;
|
||||
native readonly int nextwall;
|
||||
native readonly int sector; // Build never had this...
|
||||
native readonly int nextsector;
|
||||
|
||||
// Again, panning fields extended for interpolation.
|
||||
native readonly float xpan;
|
||||
native readonly float ypan;
|
||||
|
||||
native int16 cstat;
|
||||
|
||||
// no access to pics!
|
||||
//int16 picnum;
|
||||
//int16 overpicnum;
|
||||
native int16 lotag;
|
||||
native int16 type; // type is an alias of lotag for Blood.
|
||||
native int16 hitag;
|
||||
native int16 extra;
|
||||
|
||||
native int8 shade;
|
||||
native uint8 pal;
|
||||
native uint8 xrepeat;
|
||||
native uint8 yrepeat;
|
||||
|
||||
|
||||
native void setxpan(double add);
|
||||
native void setypan(double add);
|
||||
native void addxpan(double add);
|
||||
native void addypan(double add);
|
||||
native sectortype nextSectorp() const;
|
||||
native sectortype sectorp() const;
|
||||
native walltype nextWallp() const;
|
||||
native walltype lastWall() const;
|
||||
native walltype point2Wall() const;
|
||||
/*
|
||||
Vector2 delta() const;
|
||||
Vector2 center() const;
|
||||
*/
|
||||
native double deltax() const;
|
||||
native double deltay() const;
|
||||
native bool twoSided() const;
|
||||
|
||||
native double Length();
|
||||
native void move(Vector2 vec);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// internal sprite struct - no longer identical with on-disk format
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
struct tspritetype native
|
||||
{
|
||||
native sectortype sector;
|
||||
native int16 cstat;
|
||||
//native int16 picnum;
|
||||
native int16 statnum;
|
||||
native int16 ang;
|
||||
/* these are not needed for tsprites
|
||||
native int16 xvel;
|
||||
native int16 yvel;
|
||||
native int16 zvel;
|
||||
native int16 lotag;
|
||||
native int16 hitag;
|
||||
native int16 extra;
|
||||
native int16 detail;
|
||||
*/
|
||||
|
||||
native int8 shade;
|
||||
native uint8 pal;
|
||||
native uint8 clipdist;
|
||||
native uint8 blend;
|
||||
native uint8 xrepeat;
|
||||
native uint8 yrepeat;
|
||||
native int8 xoffset;
|
||||
native int8 yoffset;
|
||||
native CoreActor ownerActor;
|
||||
native int time;
|
||||
|
||||
//void setPic(string texture);
|
||||
native Vector3 pos();
|
||||
native void setPos(Vector3 pos);
|
||||
native void addPos(Vector3 pos);
|
||||
}
|
||||
|
||||
enum ESprextFlags
|
||||
{
|
||||
SPREXT_NOTMD = 1,
|
||||
SPREXT_NOMDANIM = 2,
|
||||
SPREXT_AWAY1 = 4,
|
||||
SPREXT_AWAY2 = 8,
|
||||
SPREXT_TSPRACCESS = 16,
|
||||
SPREXT_TEMPINVISIBLE = 32,
|
||||
}
|
||||
|
|
@ -70,6 +70,10 @@ extend struct _
|
|||
native readonly MapRecord currentLevel;
|
||||
native readonly int automapMode;
|
||||
native readonly int PlayClock;
|
||||
|
||||
native Array<@sectortype> Sector;
|
||||
native Array<@walltype> Wall;
|
||||
|
||||
}
|
||||
|
||||
struct MapRecord native
|
||||
|
@ -140,6 +144,7 @@ struct Raze
|
|||
native static String PlayerName(int i);
|
||||
native static int bsin(int angle, int shift = 0);
|
||||
native static int bcos(int angle, int shift = 0);
|
||||
native static int getangle(double x, double y);
|
||||
native static TextureID PickTexture(TextureID texid);
|
||||
native static int GetBuildTime();
|
||||
native static Font PickBigFont(String cmptext = "");
|
||||
|
@ -212,7 +217,7 @@ struct Raze
|
|||
// todo: reimplement this in a game independent fashion based on GZDoom's code.
|
||||
// Right now, with no MP support there is no need, though.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue