mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- exported all meaningful parts of side_t to the VM.
This commit is contained in:
parent
97a90c52e0
commit
f78927500e
6 changed files with 216 additions and 13 deletions
|
@ -50,6 +50,7 @@
|
|||
#include "i_system.h"
|
||||
#include "po_man.h"
|
||||
#include "r_state.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "math/cmath.h"
|
||||
|
||||
static const int PO_LINE_START = 1;
|
||||
|
|
|
@ -1826,6 +1826,145 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt)
|
|||
ACTION_RETURN_INT(ndx);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTexture)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_INT(self->GetTexture(which).GetIndex());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTexture)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_INT(tex);
|
||||
self->SetTexture(which, FSetTextureID(tex));
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTextureXOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->SetTextureXOffset(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, AddTextureXOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->AddTextureXOffset(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTextureXOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_FLOAT(self->GetTextureXOffset(which));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTextureYOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->SetTextureYOffset(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, AddTextureYOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->AddTextureYOffset(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTextureYOffset)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_FLOAT(self->GetTextureYOffset(which));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTextureXScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->SetTextureXScale(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, MultiplyTextureXScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->MultiplyTextureXScale(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTextureXScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_FLOAT(self->GetTextureXScale(which));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, SetTextureYScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->SetTextureYScale(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, MultiplyTextureYScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
PARAM_FLOAT(ofs);
|
||||
self->MultiplyTextureYScale(which, ofs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, GetTextureYScale)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
PARAM_INT(which);
|
||||
ACTION_RETURN_FLOAT(self->GetTextureYScale(which));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, V1)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
ACTION_RETURN_POINTER(self->V1());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, V2)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
ACTION_RETURN_POINTER(self->V2());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Side, Index)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(side_t);
|
||||
ACTION_RETURN_INT(self->Index());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -2157,6 +2296,11 @@ DEFINE_FIELD_X(Line, line_t, locknumber)
|
|||
DEFINE_FIELD_X(Line, line_t, portalindex)
|
||||
DEFINE_FIELD_X(Line, line_t, portaltransferred)
|
||||
|
||||
DEFINE_FIELD_X(Side, side_t, sector)
|
||||
DEFINE_FIELD_X(Side, side_t, linedef)
|
||||
DEFINE_FIELD_X(Side, side_t, Light)
|
||||
DEFINE_FIELD_X(Side, side_t, Flags)
|
||||
|
||||
DEFINE_FIELD_X(Secplane, secplane_t, normal)
|
||||
DEFINE_FIELD_X(Secplane, secplane_t, D)
|
||||
DEFINE_FIELD_X(Secplane, secplane_t, negiC)
|
||||
|
|
|
@ -40,17 +40,6 @@
|
|||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
||||
inline vertex_t *side_t::V1() const
|
||||
{
|
||||
return this == linedef->sidedef[0]? linedef->v1 : linedef->v2;
|
||||
}
|
||||
|
||||
inline vertex_t *side_t::V2() const
|
||||
{
|
||||
return this == linedef->sidedef[0]? linedef->v2 : linedef->v1;
|
||||
}
|
||||
|
||||
|
||||
class DRotatePoly : public DPolyAction
|
||||
{
|
||||
DECLARE_CLASS (DRotatePoly, DPolyAction)
|
||||
|
@ -149,8 +138,6 @@ static void ReleaseAllPolyNodes();
|
|||
|
||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||
|
||||
extern seg_t *segs;
|
||||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
polyblock_t **PolyBlockMap;
|
||||
|
|
10
src/r_defs.h
10
src/r_defs.h
|
@ -1343,6 +1343,16 @@ struct line_t
|
|||
int Index() const;
|
||||
};
|
||||
|
||||
inline vertex_t *side_t::V1() const
|
||||
{
|
||||
return this == linedef->sidedef[0] ? linedef->v1 : linedef->v2;
|
||||
}
|
||||
|
||||
inline vertex_t *side_t::V2() const
|
||||
{
|
||||
return this == linedef->sidedef[0] ? linedef->v2 : linedef->v1;
|
||||
}
|
||||
|
||||
// phares 3/14/98
|
||||
//
|
||||
// Sector list node showing all sectors an object appears in.
|
||||
|
|
|
@ -726,6 +726,10 @@ void InitThingdef()
|
|||
linestruct->Size = sizeof(line_t);
|
||||
linestruct->Align = alignof(line_t);
|
||||
|
||||
auto sidestruct = NewNativeStruct("Side", nullptr);
|
||||
sidestruct->Size = sizeof(side_t);
|
||||
sidestruct->Align = alignof(side_t);
|
||||
|
||||
|
||||
// set up the lines array in the sector struct. This is a bit messy because the type system is not prepared to handle a pointer to an array of pointers to a native struct even remotely well...
|
||||
// As a result, the size has to be set to something large and arbritrary because it can change between maps. This will need some serious improvement when things get cleaned up.
|
||||
|
@ -754,6 +758,7 @@ void InitThingdef()
|
|||
// Add the sector array to LevelLocals.
|
||||
lstruct->AddNativeField("sectors", NewPointer(NewResizableArray(sectorstruct), false), myoffsetof(FLevelLocals, sectors), VARF_Native);
|
||||
lstruct->AddNativeField("lines", NewPointer(NewResizableArray(linestruct), false), myoffsetof(FLevelLocals, lines), VARF_Native);
|
||||
lstruct->AddNativeField("sides", NewPointer(NewResizableArray(sidestruct), false), myoffsetof(FLevelLocals, sides), VARF_Native);
|
||||
|
||||
// set up a variable for the DEH data
|
||||
PStruct *dstruct = NewNativeStruct("DehInfo", nullptr);
|
||||
|
|
|
@ -190,6 +190,56 @@ struct Vertex native
|
|||
native readonly Vector2 p;
|
||||
}
|
||||
|
||||
struct Side
|
||||
{
|
||||
enum ETexpart
|
||||
{
|
||||
top=0,
|
||||
mid=1,
|
||||
bottom=2
|
||||
};
|
||||
|
||||
enum EWallFlags
|
||||
{
|
||||
WALLF_ABSLIGHTING = 1, // Light is absolute instead of relative
|
||||
WALLF_NOAUTODECALS = 2, // Do not attach impact decals to this wall
|
||||
WALLF_NOFAKECONTRAST = 4, // Don't do fake contrast for this wall in side_t::GetLightLevel
|
||||
WALLF_SMOOTHLIGHTING = 8, // Similar to autocontrast but applies to all angles.
|
||||
WALLF_CLIP_MIDTEX = 16, // Like the line counterpart, but only for this side.
|
||||
WALLF_WRAP_MIDTEX = 32, // Like the line counterpart, but only for this side.
|
||||
WALLF_POLYOBJ = 64, // This wall belongs to a polyobject.
|
||||
WALLF_LIGHT_FOG = 128, // This wall's Light is used even in fog.
|
||||
};
|
||||
|
||||
native Sector sector; // Sector the SideDef is facing.
|
||||
//DBaseDecal* AttachedDecals; // [RH] Decals bound to the wall
|
||||
native Line linedef;
|
||||
native int16 Light;
|
||||
native uint8 Flags;
|
||||
|
||||
native TextureID GetTexture(int which);
|
||||
native void SetTexture(int which, TextureID tex);
|
||||
native void SetTextureXOffset(int which, double offset);
|
||||
native double GetTextureXOffset(int which);
|
||||
native void AddTextureXOffset(int which, double delta);
|
||||
native void SetTextureYOffset(int which, double offset);
|
||||
native double GetTextureYOffset(int which);
|
||||
native void AddTextureYOffset(int which, double delta);
|
||||
native void SetTextureXScale(int which, double scale);
|
||||
native double GetTextureXScale(int which);
|
||||
native void MultiplyTextureXScale(int which, double delta);
|
||||
native void SetTextureYScale(int which, double scale);
|
||||
native double GetTextureYScale(int which);
|
||||
native void MultiplyTextureYScale(int which, double delta);
|
||||
//native DInterpolation *SetInterpolation(int position);
|
||||
//native void StopInterpolation(int position);
|
||||
|
||||
native Vertex V1();
|
||||
native Vertex V2();
|
||||
|
||||
native int Index();
|
||||
};
|
||||
|
||||
struct Line native
|
||||
{
|
||||
enum ELineFlags
|
||||
|
@ -302,6 +352,12 @@ struct Sector native
|
|||
//SectorEffect ceilingdata;
|
||||
//SectorEffect lightingdata;
|
||||
|
||||
enum EPlane
|
||||
{
|
||||
floor,
|
||||
ceiling
|
||||
};
|
||||
|
||||
enum EInterpolationType
|
||||
{
|
||||
CeilingMove,
|
||||
|
|
Loading…
Reference in a new issue