mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-15 17:11:24 +00:00
Squashed commit of the following:
commit 6ecd831eb45a8258995c02664450c3ca8cfe5b48 Merge: a4fb1f61cafbd7f7a2
Author: Marisa Kirisame <marisa@sayachan.org> Date: Sun Jul 28 22:02:19 2019 +0200 Merge branch 'master' of github.com:coelckers/gzdoom into f3dfloor_export commit a4fb1f61c0532d3a6051d4c1fca4ac72ec33e060 Author: Marisa Kirisame <marisa@sayachan.org> Date: Fri Jul 12 15:43:25 2019 +0200 Renamed EFFloorType enum in ZScript to the more descriptive EF3DFloorFlags commit 9ad1c3b5625d53c06229be2a94d44fa0f36f41fd Author: Marisa Kirisame <marisa@sayachan.org> Date: Sun Jul 7 20:25:31 2019 +0200 Add bounds checks to Get3DFloor/GetAttached commit dd2a7956a887b92ed24ce5e79f10b1a445664d6c Author: Marisa Kirisame <marisa@sayachan.org> Date: Sun Jul 7 17:13:44 2019 +0200 Correct handling of 3d floor plane texture getting. commit 9b748287892c8fdee9ac67019bf1f66bc4b69eab Author: Marisa Kirisame <marisa@sayachan.org> Date: Sun Jul 7 16:14:45 2019 +0200 Implemented requested changes to F3DFloor exports. * Getters for ffloors/attached arrays. * Getter for 3D floor top/bottom texture. commit 6a1482bb0637a70890629e4c13e8759c7a3673f3 Author: Marisa Kirisame <marisa@sayachan.org> Date: Sat Jul 6 13:42:52 2019 +0200 Renamed exported extsector pointer in Sector struct to something more descriptive. commit 7c6783d43b898cbd7a01fb2191fd401ed8e8c300 Merge: ff64e04b28d36f0a0c
Author: Marisa Kirisame <marisa@sayachan.org> Date: Mon Apr 29 12:40:44 2019 +0200 Merge branch 'master' into f3dfloor_export commit ff64e04b251f23325d2f72bc25c59f34b4cab6fa Merge: a909473925b6bae409
Author: Marisa Kirisame <marisa@sayachan.org> Date: Sun Apr 21 16:56:18 2019 +0200 Merge branch 'master' into f3dfloor_export commit a90947392a27eb1c2dac7005614592ec2f410274 Author: Marisa Kirisame <marisa@sayachan.org> Date: Mon Feb 4 17:47:25 2019 +0100 Export F3DFloor structure and related data. Small changes to Trace code to better use this struct.
This commit is contained in:
parent
245326b5ac
commit
aa06b2f62c
4 changed files with 165 additions and 5 deletions
|
@ -901,6 +901,41 @@ bool FTraceInfo::TraceTraverse (int ptflags)
|
|||
Results->Distance = MaxDist;
|
||||
Results->Fraction = 1.;
|
||||
}
|
||||
|
||||
// [MK] set 3d floor on plane hits (if any)
|
||||
// modders will need this to get accurate plane normals on slopes
|
||||
if (Results->HitType == TRACE_HitFloor)
|
||||
{
|
||||
double secbottom = Results->Sector->floorplane.ZatPoint(Results->HitPos);
|
||||
for (auto rover : Results->Sector->e->XFloor.ffloors)
|
||||
{
|
||||
if (!(rover->flags&FF_EXISTS))
|
||||
continue;
|
||||
double ff_top = rover->top.plane->ZatPoint(Results->HitPos);
|
||||
if (fabs(ff_top-secbottom) < EQUAL_EPSILON)
|
||||
continue;
|
||||
if (fabs(ff_top-Results->HitPos.Z) > EQUAL_EPSILON)
|
||||
continue;
|
||||
Results->ffloor = rover;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (Results->HitType == TRACE_HitCeiling)
|
||||
{
|
||||
double sectop = Results->Sector->ceilingplane.ZatPoint(Results->HitPos);
|
||||
for (auto rover : Results->Sector->e->XFloor.ffloors)
|
||||
{
|
||||
if (!(rover->flags&FF_EXISTS))
|
||||
continue;
|
||||
double ff_bottom = rover->bottom.plane->ZatPoint(Results->HitPos);
|
||||
if (fabs(ff_bottom-sectop) < EQUAL_EPSILON)
|
||||
continue;
|
||||
if (fabs(ff_bottom-Results->HitPos.Z) > EQUAL_EPSILON)
|
||||
continue;
|
||||
Results->ffloor = rover;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Results->HitType != TRACE_HitNone;
|
||||
}
|
||||
|
||||
|
@ -1008,6 +1043,7 @@ DEFINE_FIELD_X(TraceResults, FTraceResults, Side)
|
|||
DEFINE_FIELD_X(TraceResults, FTraceResults, Tier)
|
||||
DEFINE_FIELD_X(TraceResults, FTraceResults, unlinked)
|
||||
DEFINE_FIELD_X(TraceResults, FTraceResults, HitType)
|
||||
DEFINE_FIELD_X(TraceResults, FTraceResults, ffloor)
|
||||
DEFINE_FIELD_X(TraceResults, FTraceResults, CrossedWater)
|
||||
DEFINE_FIELD_X(TraceResults, FTraceResults, CrossedWaterPos)
|
||||
DEFINE_FIELD_X(TraceResults, FTraceResults, Crossed3DWater)
|
||||
|
|
|
@ -1334,6 +1334,72 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static F3DFloor* Get3DFloor(sector_t *self, int index)
|
||||
{
|
||||
if ((index < 0) || (index >= self->e->XFloor.ffloors.Size()))
|
||||
return nullptr;
|
||||
return self->e->XFloor.ffloors[index];
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, Get3DFloor, Get3DFloor)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(index);
|
||||
ACTION_RETURN_POINTER(Get3DFloor(self,index));
|
||||
}
|
||||
|
||||
static int Get3DFloorCount(sector_t *self)
|
||||
{
|
||||
return self->e->XFloor.ffloors.Size();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, Get3DFloorCount, Get3DFloorCount)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
ACTION_RETURN_INT(self->e->XFloor.ffloors.Size());
|
||||
}
|
||||
|
||||
static sector_t* GetAttached(sector_t *self, int index)
|
||||
{
|
||||
if ((index < 0) || (index >= self->e->XFloor.attached.Size()))
|
||||
return nullptr;
|
||||
return self->e->XFloor.attached[index];
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetAttached, GetAttached)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
PARAM_INT(index);
|
||||
ACTION_RETURN_POINTER(GetAttached(self,index));
|
||||
}
|
||||
|
||||
static int GetAttachedCount(sector_t *self)
|
||||
{
|
||||
return self->e->XFloor.attached.Size();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, GetAttachedCount, GetAttachedCount)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||
ACTION_RETURN_INT(self->e->XFloor.attached.Size());
|
||||
}
|
||||
|
||||
static int Get3DFloorTexture(F3DFloor *self, int pos)
|
||||
{
|
||||
if ( pos )
|
||||
return self->bottom.texture->GetIndex();
|
||||
return self->top.texture->GetIndex();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_F3DFloor, GetTexture, Get3DFloorTexture)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(F3DFloor);
|
||||
PARAM_INT(pos);
|
||||
if ( pos )
|
||||
ACTION_RETURN_INT(self->bottom.texture->GetIndex());
|
||||
ACTION_RETURN_INT(self->top.texture->GetIndex());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// line_t exports
|
||||
|
@ -2971,6 +3037,14 @@ DEFINE_FIELD_X(Secplane, secplane_t, normal)
|
|||
DEFINE_FIELD_X(Secplane, secplane_t, D)
|
||||
DEFINE_FIELD_X(Secplane, secplane_t, negiC)
|
||||
|
||||
DEFINE_FIELD_NAMED_X(F3DFloor, F3DFloor, bottom.plane, bottom);
|
||||
DEFINE_FIELD_NAMED_X(F3DFloor, F3DFloor, top.plane, top);
|
||||
DEFINE_FIELD_X(F3DFloor, F3DFloor, flags);
|
||||
DEFINE_FIELD_X(F3DFloor, F3DFloor, master);
|
||||
DEFINE_FIELD_X(F3DFloor, F3DFloor, model);
|
||||
DEFINE_FIELD_X(F3DFloor, F3DFloor, target);
|
||||
DEFINE_FIELD_X(F3DFloor, F3DFloor, alpha);
|
||||
|
||||
DEFINE_FIELD_X(Vertex, vertex_t, p)
|
||||
|
||||
DEFINE_FIELD(DBaseStatusBar, RelTop);
|
||||
|
|
|
@ -594,7 +594,7 @@ struct TraceResults native
|
|||
native bool unlinked; // passed through a portal without static offset.
|
||||
|
||||
native ETraceResult HitType;
|
||||
// F3DFloor *ffloor;
|
||||
native F3DFloor ffloor;
|
||||
|
||||
native Sector CrossedWater; // For Boom-style, Transfer_Heights-based deep water
|
||||
native vector3 CrossedWaterPos; // remember the position so that we can use it for spawning the splash
|
||||
|
@ -814,10 +814,6 @@ struct State native
|
|||
native bool InStateSequence(State base);
|
||||
}
|
||||
|
||||
struct F3DFloor native
|
||||
{
|
||||
}
|
||||
|
||||
struct Wads
|
||||
{
|
||||
enum WadNamespace
|
||||
|
|
|
@ -214,6 +214,55 @@ struct SecPlane native play
|
|||
native double PointToDist(Vector2 xy, double z) const;
|
||||
}
|
||||
|
||||
struct F3DFloor native play
|
||||
{
|
||||
enum EF3DFloorFlags
|
||||
{
|
||||
FF_EXISTS = 0x1, //MAKE SURE IT'S VALID
|
||||
FF_SOLID = 0x2, //Does it clip things?
|
||||
FF_RENDERSIDES = 0x4, //Render the sides?
|
||||
FF_RENDERPLANES = 0x8, //Render the floor/ceiling?
|
||||
FF_RENDERALL = 0xC, //Render everything?
|
||||
FF_SWIMMABLE = 0x10, //Can we swim?
|
||||
FF_NOSHADE = 0x20, //Does it mess with the lighting?
|
||||
FF_BOTHPLANES = 0x200, //Render both planes all the time?
|
||||
FF_TRANSLUCENT = 0x800, //See through!
|
||||
FF_FOG = 0x1000, //Fog "brush"?
|
||||
FF_INVERTPLANES = 0x2000, //Reverse the plane visibility rules?
|
||||
FF_ALLSIDES = 0x4000, //Render inside and outside sides?
|
||||
FF_INVERTSIDES = 0x8000, //Only render inside sides?
|
||||
FF_DOUBLESHADOW = 0x10000,//Make two lightlist entries to reset light?
|
||||
FF_UPPERTEXTURE = 0x20000,
|
||||
FF_LOWERTEXTURE = 0x40000,
|
||||
FF_THINFLOOR = 0x80000, // EDGE
|
||||
FF_SCROLLY = 0x100000, // EDGE - not yet implemented!!!
|
||||
FF_FIX = 0x200000, // use floor of model sector as floor and floor of real sector as ceiling
|
||||
FF_INVERTSECTOR = 0x400000, // swap meaning of sector planes
|
||||
FF_DYNAMIC = 0x800000, // created by partitioning another 3D-floor due to overlap
|
||||
FF_CLIPPED = 0x1000000, // split into several dynamic ffloors
|
||||
FF_SEETHROUGH = 0x2000000,
|
||||
FF_SHOOTTHROUGH = 0x4000000,
|
||||
FF_FADEWALLS = 0x8000000, // Applies real fog to walls and doesn't blend the view
|
||||
FF_ADDITIVETRANS = 0x10000000, // Render this floor with additive translucency
|
||||
FF_FLOOD = 0x20000000, // extends towards the next lowest flooding or solid 3D floor or the bottom of the sector
|
||||
FF_THISINSIDE = 0x40000000, // hack for software 3D with FF_BOTHPLANES
|
||||
FF_RESET = 0x80000000, // light effect is completely reset, once interrupted
|
||||
};
|
||||
|
||||
native readonly secplane bottom;
|
||||
native readonly secplane top;
|
||||
|
||||
native readonly uint flags;
|
||||
native readonly Line master;
|
||||
|
||||
native readonly Sector model;
|
||||
native readonly Sector target;
|
||||
|
||||
native readonly int alpha;
|
||||
|
||||
native TextureID GetTexture(int pos);
|
||||
}
|
||||
|
||||
// This encapsulates all info Doom's original 'special' field contained - for saving and transferring.
|
||||
struct SecSpecial play
|
||||
{
|
||||
|
@ -369,6 +418,11 @@ struct Sector native play
|
|||
native double, Sector, F3DFloor NextHighestCeilingAt(double x, double y, double bottomz, double topz, int flags = 0);
|
||||
native double, Sector, F3DFloor NextLowestFloorAt(double x, double y, double z, int flags = 0, double steph = 0);
|
||||
|
||||
native F3DFloor Get3DFloor(int index);
|
||||
native int Get3DFloorCount();
|
||||
native Sector GetAttached(int index);
|
||||
native int GetAttachedCount();
|
||||
|
||||
native void RemoveForceField();
|
||||
native static clearscope Sector PointInSector(Vector2 pt);
|
||||
|
||||
|
|
Loading…
Reference in a new issue