- exported all relevant functions from sector_t.

Please note that currently most of these have little use, they are for future feature support.
This commit is contained in:
Christoph Oelckers 2017-01-08 00:50:40 +01:00
parent 82adc5bf1e
commit 3beed216dd
6 changed files with 813 additions and 28 deletions

View File

@ -278,6 +278,19 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct
return EMoveResult::ok;
}
DEFINE_ACTION_FUNCTION(_Sector, MoveFloor)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_FLOAT(speed);
PARAM_FLOAT(dest);
PARAM_INT(crush);
PARAM_INT(dir);
PARAM_BOOL(hex);
PARAM_BOOL_DEF(inst);
ACTION_RETURN_INT((int)self->MoveFloor(speed, dest, crush, dir, hex, inst));
}
EMoveResult sector_t::MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush)
{
bool flag;
@ -391,3 +404,14 @@ EMoveResult sector_t::MoveCeiling(double speed, double dest, int crush, int dire
}
return EMoveResult::ok;
}
DEFINE_ACTION_FUNCTION(_Sector, MoveCeiling)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_FLOAT(speed);
PARAM_FLOAT(dest);
PARAM_INT(crush);
PARAM_INT(dir);
PARAM_BOOL(hex);
ACTION_RETURN_INT((int)self->MoveCeiling(speed, dest, crush, dir, hex));
}

View File

@ -86,6 +86,13 @@ bool sector_t::IsLinked(sector_t *other, bool ceiling) const
return false;
}
DEFINE_ACTION_FUNCTION(_Sector, isLinked)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_POINTER(other, sector_t);
PARAM_BOOL(ceiling);
ACTION_RETURN_BOOL(self->IsLinked(other, ceiling));
}
//============================================================================
//

View File

@ -57,6 +57,14 @@ sector_t *sector_t::NextSpecialSector (int type, sector_t *nogood) const
return NULL;
}
DEFINE_ACTION_FUNCTION(_Sector, NextSpecialSector)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(type);
PARAM_POINTER(nogood, sector_t);
ACTION_RETURN_POINTER(self->NextSpecialSector(type, nogood));
}
//
// P_FindLowestFloorSurrounding()
// FIND LOWEST FLOOR HEIGHT IN SURROUNDING SECTORS
@ -96,8 +104,16 @@ double sector_t::FindLowestFloorSurrounding (vertex_t **v) const
return floor;
}
DEFINE_ACTION_FUNCTION(_Sector, FindLowestFloorSurrounding)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindLowestFloorSurrounding(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//
// P_FindHighestFloorSurrounding()
// FIND HIGHEST FLOOR HEIGHT IN SURROUNDING SECTORS
@ -137,6 +153,16 @@ double sector_t::FindHighestFloorSurrounding (vertex_t **v) const
return floor;
}
DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorSurrounding)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindHighestFloorSurrounding(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//
@ -190,6 +216,16 @@ double sector_t::FindNextHighestFloor (vertex_t **v) const
return height;
}
DEFINE_ACTION_FUNCTION(_Sector, FindNextHighestFloor)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindNextHighestFloor(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//
// P_FindNextLowestFloor()
@ -242,6 +278,17 @@ double sector_t::FindNextLowestFloor (vertex_t **v) const
return height;
}
DEFINE_ACTION_FUNCTION(_Sector, FindNextLowestFloor)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindNextLowestFloor(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//
// P_FindNextLowestCeiling()
//
@ -293,6 +340,17 @@ double sector_t::FindNextLowestCeiling (vertex_t **v) const
return height;
}
DEFINE_ACTION_FUNCTION(_Sector, FindNextLowestCeiling)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindNextLowestCeiling(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//
// P_FindNextHighestCeiling()
//
@ -344,6 +402,17 @@ double sector_t::FindNextHighestCeiling (vertex_t **v) const
return height;
}
DEFINE_ACTION_FUNCTION(_Sector, FindNextHighestCeiling)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindNextHighestCeiling(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//
// FIND LOWEST CEILING IN THE SURROUNDING SECTORS
//
@ -382,6 +451,16 @@ double sector_t::FindLowestCeilingSurrounding (vertex_t **v) const
return height;
}
DEFINE_ACTION_FUNCTION(_Sector, FindLowestCeilingSurrounding)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindLowestCeilingSurrounding(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//
// FIND HIGHEST CEILING IN THE SURROUNDING SECTORS
@ -421,6 +500,17 @@ double sector_t::FindHighestCeilingSurrounding (vertex_t **v) const
return height;
}
DEFINE_ACTION_FUNCTION(_Sector, FindHighestCeilingSurrounding)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindHighestCeilingSurrounding(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//
// P_FindShortestTextureAround()
//
@ -461,6 +551,13 @@ double sector_t::FindShortestTextureAround () const
return minsize < FLT_MAX ? minsize : TexMan[0]->GetHeight();
}
DEFINE_ACTION_FUNCTION(_Sector, FindShortestTextureAround)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
double h = self->FindShortestTextureAround();
ACTION_RETURN_FLOAT(h);
}
//
// P_FindShortestUpperAround()
@ -487,6 +584,12 @@ double sector_t::FindShortestUpperAround () const
return minsize < FLT_MAX ? minsize : TexMan[0]->GetHeight();
}
DEFINE_ACTION_FUNCTION(_Sector, FindShortestUpperAround)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
double h = self->FindShortestUpperAround();
ACTION_RETURN_FLOAT(h);
}
//
// P_FindModelFloorSector()
@ -519,6 +622,14 @@ sector_t *sector_t::FindModelFloorSector (double floordestheight) const
return NULL;
}
DEFINE_ACTION_FUNCTION(_Sector, FindModelFloorSector)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_FLOAT(fdh);
auto h = self->FindModelFloorSector(fdh);
ACTION_RETURN_POINTER(h);
}
//
// P_FindModelCeilingSector()
@ -552,6 +663,14 @@ sector_t *sector_t::FindModelCeilingSector (double floordestheight) const
return NULL;
}
DEFINE_ACTION_FUNCTION(_Sector, FindModelCeilingSector)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_FLOAT(fdh);
auto h = self->FindModelCeilingSector(fdh);
ACTION_RETURN_POINTER(h);
}
//
// Find minimum light from an adjacent sector
//
@ -570,6 +689,14 @@ int sector_t::FindMinSurroundingLight (int min) const
return min;
}
DEFINE_ACTION_FUNCTION(_Sector, FindMinSurroundingLight)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(min);
auto h = self->FindMinSurroundingLight(min);
ACTION_RETURN_INT(h);
}
//
// Find the highest point on the floor of the sector
//
@ -609,6 +736,16 @@ double sector_t::FindHighestFloorPoint (vertex_t **v) const
return height;
}
DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorPoint)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindHighestFloorPoint(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//
// Find the lowest point on the ceiling of the sector
//
@ -648,6 +785,20 @@ double sector_t::FindLowestCeilingPoint (vertex_t **v) const
return height;
}
DEFINE_ACTION_FUNCTION(_Sector, FindLowestCeilingPoint)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindLowestCeilingPoint(&v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v, ATAG_GENERIC);
return numret;
}
//=====================================================================================
//
//
//=====================================================================================
void sector_t::SetColor(int r, int g, int b, int desat)
{
@ -666,6 +817,11 @@ DEFINE_ACTION_FUNCTION(_Sector, SetColor)
return 0;
}
//=====================================================================================
//
//
//=====================================================================================
void sector_t::SetFade(int r, int g, int b)
{
PalEntry fade = PalEntry (r,g,b);
@ -746,6 +902,11 @@ void sector_t::ClosestPoint(const DVector2 &in, DVector2 &out) const
}
//=====================================================================================
//
//
//=====================================================================================
bool sector_t::PlaneMoving(int pos)
{
if (pos == floor)
@ -754,6 +915,17 @@ bool sector_t::PlaneMoving(int pos)
return (ceilingdata != NULL || (planes[ceiling].Flags & PLANEF_BLOCKED));
}
DEFINE_ACTION_FUNCTION(_Sector, PlaneMoving)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_BOOL(self->PlaneMoving(pos));
}
//=====================================================================================
//
//
//=====================================================================================
int sector_t::GetFloorLight () const
{
@ -767,6 +939,17 @@ int sector_t::GetFloorLight () const
}
}
DEFINE_ACTION_FUNCTION(_Sector, GetFloorLight)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
ACTION_RETURN_INT(self->GetFloorLight());
}
//=====================================================================================
//
//
//=====================================================================================
int sector_t::GetCeilingLight () const
{
if (GetFlags(ceiling) & PLANEF_ABSLIGHTING)
@ -779,6 +962,16 @@ int sector_t::GetCeilingLight () const
}
}
DEFINE_ACTION_FUNCTION(_Sector, GetCeilingLight)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
ACTION_RETURN_INT(self->GetCeilingLight());
}
//=====================================================================================
//
//
//=====================================================================================
FSectorPortal *sector_t::ValidatePortal(int which)
{
@ -789,8 +982,12 @@ FSectorPortal *sector_t::ValidatePortal(int which)
return port;
}
//=====================================================================================
//
//
//=====================================================================================
sector_t *sector_t::GetHeightSec() const
sector_t *sector_t::GetHeightSec() const
{
if (heightsec == NULL)
{
@ -814,6 +1011,16 @@ sector_t *sector_t::GetHeightSec() const
return heightsec;
}
DEFINE_ACTION_FUNCTION(_Sector, GetHeightSec)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
ACTION_RETURN_POINTER(self->GetHeightSec());
}
//=====================================================================================
//
//
//=====================================================================================
void sector_t::GetSpecial(secspecial_t *spec)
{
@ -825,6 +1032,19 @@ void sector_t::GetSpecial(secspecial_t *spec)
spec->Flags = Flags & SECF_SPECIALFLAGS;
}
DEFINE_ACTION_FUNCTION(_Sector, GetSpecial)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_POINTER(spec, secspecial_t);
self->GetSpecial(spec);
return 0;
}
//=====================================================================================
//
//
//=====================================================================================
void sector_t::SetSpecial(const secspecial_t *spec)
{
special = spec->special;
@ -835,6 +1055,20 @@ void sector_t::SetSpecial(const secspecial_t *spec)
Flags = (Flags & ~SECF_SPECIALFLAGS) | (spec->Flags & SECF_SPECIALFLAGS);
}
DEFINE_ACTION_FUNCTION(_Sector, SetSpecial)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_POINTER(spec, secspecial_t);
self->SetSpecial(spec);
return 0;
}
//=====================================================================================
//
//
//=====================================================================================
void sector_t::TransferSpecial(sector_t *model)
{
special = model->special;
@ -845,11 +1079,36 @@ void sector_t::TransferSpecial(sector_t *model)
Flags = (Flags&~SECF_SPECIALFLAGS) | (model->Flags & SECF_SPECIALFLAGS);
}
DEFINE_ACTION_FUNCTION(_Sector, TransferSpecial)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_POINTER(spec, sector_t);
self->TransferSpecial(spec);
return 0;
}
//=====================================================================================
//
//
//=====================================================================================
int sector_t::GetTerrain(int pos) const
{
return terrainnum[pos] >= 0 ? terrainnum[pos] : TerrainTypes[GetTexture(pos)];
}
DEFINE_ACTION_FUNCTION(_Sector, GetTerrain)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_INT(self->GetTerrain(pos));
}
//=====================================================================================
//
//
//=====================================================================================
void sector_t::CheckPortalPlane(int plane)
{
if (GetPortalType(plane) == PORTS_LINKEDPORTAL)
@ -861,6 +1120,14 @@ void sector_t::CheckPortalPlane(int plane)
}
}
DEFINE_ACTION_FUNCTION(_Sector, CheckPortalPlane)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(plane);
self->CheckPortalPlane(plane);
return 0;
}
//===========================================================================
//
// Finds the highest ceiling at the given position, all portals considered
@ -884,6 +1151,18 @@ double sector_t::HighestCeilingAt(const DVector2 &p, sector_t **resultsec)
return check->ceilingplane.ZatPoint(pos);
}
DEFINE_ACTION_FUNCTION(_Sector, HighestCeilingAt)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
sector_t *s;
double h = self->HighestCeilingAt(DVector2(x, y), &s);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(s, ATAG_GENERIC);
return numret;
}
//===========================================================================
//
// Finds the lowest floor at the given position, all portals considered
@ -907,6 +1186,22 @@ double sector_t::LowestFloorAt(const DVector2 &p, sector_t **resultsec)
return check->floorplane.ZatPoint(pos);
}
DEFINE_ACTION_FUNCTION(_Sector, LowestFloorAt)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
sector_t *s;
double h = self->LowestFloorAt(DVector2(x, y), &s);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(s, ATAG_GENERIC);
return numret;
}
//=====================================================================================
//
//
//=====================================================================================
double sector_t::NextHighestCeilingAt(double x, double y, double bottomz, double topz, int flags, sector_t **resultsec, F3DFloor **resultffloor)
{
@ -980,6 +1275,11 @@ DEFINE_ACTION_FUNCTION(_Sector, NextHighestCeilingAt)
return numret;
}
//=====================================================================================
//
//
//=====================================================================================
double sector_t::NextLowestFloorAt(double x, double y, double z, int flags, double steph, sector_t **resultsec, F3DFloor **resultffloor)
{
sector_t *sec = this;
@ -1080,6 +1380,17 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt)
}
}
DEFINE_ACTION_FUNCTION(_Sector, GetFriction)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(plane);
double mf;
double h = self->GetFriction(plane, &mf);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetFloat(mf);
return numret;
}
//===========================================================================
//
//
@ -1107,6 +1418,32 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt)
return 0;
}
//===========================================================================
//
// phares 3/12/98: End of friction effects
//
//===========================================================================
void sector_t::AdjustFloorClip() const
{
msecnode_t *node;
for (node = touching_thinglist; node; node = node->m_snext)
{
if (node->m_thing->flags2 & MF2_FLOORCLIP)
{
node->m_thing->AdjustFloorClip();
}
}
}
DEFINE_ACTION_FUNCTION(_Sector, AdjustFloorClip)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
self->AdjustFloorClip();
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, PointInSector)
{
@ -1116,6 +1453,325 @@ DEFINE_ACTION_FUNCTION(_Sector, NextLowestFloorAt)
ACTION_RETURN_POINTER(P_PointInSector(x, y));
}
DEFINE_ACTION_FUNCTION(_Sector, SetXOffset)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_FLOAT(o);
self->SetXOffset(pos, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, AddXOffset)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_FLOAT(o);
self->AddXOffset(pos, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetXOffset)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_FLOAT(self->GetXOffset(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, SetYOffset)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_FLOAT(o);
self->SetXOffset(pos, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, AddYOffset)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_FLOAT(o);
self->AddXOffset(pos, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetYOffset)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_BOOL_DEF(addbase);
ACTION_RETURN_FLOAT(self->GetYOffset(pos, addbase));
}
DEFINE_ACTION_FUNCTION(_Sector, SetXScale)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_FLOAT(o);
self->SetXScale(pos, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetXScale)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_FLOAT(self->GetXScale(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, SetYScale)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_FLOAT(o);
self->SetXScale(pos, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetYScale)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_FLOAT(self->GetYScale(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, SetAngle)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_ANGLE(o);
self->SetAngle(pos, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetAngle)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_BOOL_DEF(addbase);
ACTION_RETURN_FLOAT(self->GetAngle(pos, addbase).Degrees);
}
DEFINE_ACTION_FUNCTION(_Sector, SetBase)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_FLOAT(o);
PARAM_ANGLE(a);
self->SetBase(pos, o, a);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, SetAlpha)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_FLOAT(o);
self->SetAlpha(pos, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetAlpha)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_FLOAT(self->GetAlpha(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, GetFlags)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_INT(self->GetFlags(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, GetVisFlags)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_INT(self->GetVisFlags(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, ChangeFlags)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_INT(a);
PARAM_INT(o);
self->ChangeFlags(pos, a, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, SetPlaneLight)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_INT(o);
self->SetPlaneLight(pos, o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetPlaneLight)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_INT(self->GetPlaneLight(pos));
}
class FSetTextureID : public FTextureID
{
public:
FSetTextureID(int v) : FTextureID(v) {}
};
DEFINE_ACTION_FUNCTION(_Sector, SetTexture)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_INT(o);
PARAM_BOOL_DEF(adj);
self->SetTexture(pos, FSetTextureID(o), adj);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetTexture)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_INT(self->GetTexture(pos).GetIndex());
}
DEFINE_ACTION_FUNCTION(_Sector, SetPlaneTexZ)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
PARAM_FLOAT(o);
PARAM_BOOL_DEF(dirty);
self->SetPlaneTexZ(pos, o, dirty);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetPlaneTexZ)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_FLOAT(self->GetPlaneTexZ(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, SetLightLevel)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(o);
self->SetLightLevel(o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, ChangeLightLevel)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(o);
self->ChangeLightLevel(o);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetLightLevel)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
ACTION_RETURN_INT(self->GetLightLevel());
}
DEFINE_ACTION_FUNCTION(_Sector, ClearSpecial)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
self->ClearSpecial();
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, PortalBlocksView)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_BOOL(self->PortalBlocksView(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, PortalBlocksSight)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_BOOL(self->PortalBlocksSight(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, PortalBlocksMovement)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_BOOL(self->PortalBlocksMovement(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, PortalBlocksSound)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_BOOL(self->PortalBlocksSound(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, PortalIsLinked)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_BOOL(self->PortalIsLinked(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, ClearPortal)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
self->ClearPortal(pos);
return 0;
}
DEFINE_ACTION_FUNCTION(_Sector, GetPortalPlaneZ)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_FLOAT(self->GetPortalPlaneZ(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, GetPortalDisplacement)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_VEC2(self->GetPortalDisplacement(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, GetPortalType)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_INT(self->GetPortalType(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, GetOppositePortalGroup)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);
ACTION_RETURN_INT(self->GetOppositePortalGroup(pos));
}
DEFINE_ACTION_FUNCTION(_Sector, CenterFloor)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
ACTION_RETURN_FLOAT(self->CenterFloor());
}
DEFINE_ACTION_FUNCTION(_Sector, CenterCeiling)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
ACTION_RETURN_FLOAT(self->CenterCeiling());
}
//===========================================================================
//
//
@ -1448,3 +2104,5 @@ DEFINE_FIELD_X(Line, line_t, portalindex)
DEFINE_FIELD_X(Secplane, secplane_t, normal)
DEFINE_FIELD_X(Secplane, secplane_t, D)
DEFINE_FIELD_X(Secplane, secplane_t, negiC)
DEFINE_FIELD_X(Vertex, vertex_t, p)

View File

@ -1589,23 +1589,3 @@ double FrictionToMoveFactor(double friction)
return movefactor;
}
//
// phares 3/12/98: End of friction effects
//
////////////////////////////////////////////////////////////////////////////
void sector_t::AdjustFloorClip () const
{
msecnode_t *node;
for (node = touching_thinglist; node; node = node->m_snext)
{
if (node->m_thing->flags2 & MF2_FLOORCLIP)
{
node->m_thing->AdjustFloorClip();
}
}
}

View File

@ -92,11 +92,8 @@ typedef double vtype;
struct vertex_t
{
private:
DVector2 p;
public:
void set(fixed_t x, fixed_t y)
{
p.X = x / 65536.;
@ -136,7 +133,7 @@ public:
DVector2 fPos()
{
return { p.X, p.Y };
return p;
}
angle_t viewangle; // precalculated angle for clipping

View File

@ -185,6 +185,11 @@ struct F3DFloor native
{
}
struct Vertex native
{
native readonly Vector2 p;
}
struct Line native
{
enum ELineFlags
@ -250,7 +255,18 @@ struct SecPlane native
native void ChangeHeight(double hdiff);
native double GetChangedHeight(double hdiff);
native double HeightDiff(double oldd, double newd = 0.0);
native double PointToDist(const DVector2 &xy, double z);
native double PointToDist(Vector2 xy, double z);
}
// This encapsulates all info Doom's original 'special' field contained - for saving and transferring.
struct SecSpecial
{
Name damagetype;
int damageamount;
short special;
short damageinterval;
short leakydamage;
int Flags;
}
struct Sector native
@ -345,6 +361,14 @@ struct Sector native
SECF_NOMODIFY = SECF_SECRET|SECF_WASSECRET, // not modifiable by Sector_ChangeFlags
SECF_SPECIALFLAGS = SECF_DAMAGEFLAGS|SECF_FRICTION|SECF_PUSH, // these flags originate from 'special and must be transferrable by floor thinkers
}
enum EMoveResult
{
MOVE_OK,
MOVE_CRUSHED,
MOVE_PASTDEST
};
native uint Flags;
native SectorAction SecActTarget;
@ -362,6 +386,101 @@ struct Sector native
native static Sector PointInSector(Vector2 pt);
native void SetColor(color c, int desat = 0);
native void SetFade(color c);
native bool PlaneMoving(int pos);
native int GetFloorLight();
native int GetCeilingLight();
native Sector GetHeightSec();
native void TransferSpecial(Sector model);
native void GetSpecial(out SecSpecial spec);
native void SetSpecial( SecSpecial spec);
native int GetTerrain(int pos);
native void CheckPortalPlane(int plane);
native double, Sector HighestCeilingAt(Vector2 a);
native double, Sector LowestFloorAt(Vector2 a);
native double, double GetFriction(int plane);
native void SetXOffset(int pos, double o);
native void AddXOffset(int pos, double o);
native double GetXOffset(int pos);
native void SetYOffset(int pos, double o);
native void AddYOffset(int pos, double o);
native double GetYOffset(int pos, bool addbase = true);
native void SetXScale(int pos, double o);
native double GetXScale(int pos);
native void SetYScale(int pos, double o);
native double GetYScale(int pos);
native void SetAngle(int pos, double o);
native double GetAngle(int pos, bool addbase = true);
native void SetBase(int pos, double y, double o);
native void SetAlpha(int pos, double o);
native double GetAlpha(int pos);
native int GetFlags(int pos);
native int GetVisFlags(int pos);
native void ChangeFlags(int pos, int And, int Or);
native int GetPlaneLight(int pos);
native void SetPlaneLight(int pos, int level);
native TextureID GetTexture(int pos);
native void SetTexture(int pos, TextureID tex, bool floorclip = true);
native double GetPlaneTexZ(int pos);
native void SetPlaneTexZ(int pos, double val, bool dirtify = false); // This mainly gets used by init code. The only place where it must set the vertex to dirty is the interpolation code.
native void ChangeLightLevel(int newval);
native void SetLightLevel(int newval);
native int GetLightLevel();
native void AdjustFloorClip();
native bool IsLinked(Sector other, bool ceiling);
native bool PortalBlocksView(int plane);
native bool PortalBlocksSight(int plane);
native bool PortalBlocksMovement(int plane);
native bool PortalBlocksSound(int plane);
native bool PortalIsLinked(int plane);
native void ClearPortal(int plane);
native double GetPortalPlaneZ(int plane);
native Vector2 GetPortalDisplacement(int plane);
native int GetPortalType(int plane);
native int GetOppositePortalGroup(int plane);
native double CenterFloor();
native double CenterCeiling();
native int MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush, bool instant = false);
native int MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush);
native Sector NextSpecialSector(int type, Sector prev);
native double, Vertex FindLowestFloorSurrounding();
native double, Vertex FindHighestFloorSurrounding();
native double, Vertex FindNextHighestFloor();
native double, Vertex FindNextLowestFloor();
native double, Vertex FindLowestCeilingSurrounding();
native double, Vertex FindHighestCeilingSurrounding();
native double, Vertex FindNextLowestCeiling();
native double, Vertex FindNextHighestCeiling();
native double FindShortestTextureAround();
native double FindShortestUpperAround();
native Sector FindModelFloorSector(double floordestheight);
native Sector FindModelCeilingSector(double floordestheight);
native int FindMinSurroundingLight(int max);
native double, Vertex FindLowestCeilingPoint();
native double, Vertex FindHighestFloorPoint();
bool isSecret()
{
return !!(Flags & SECF_SECRET);
}
bool wasSecret()
{
return !!(Flags & SECF_WASSECRET);
}
void ClearSecret()
{
Flags &= ~SECF_SECRET;
}
}
struct Wads