mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 15:52:09 +00:00
Added direct native functions to the remaining content of vmthunks.cpp
This commit is contained in:
parent
62efe11a85
commit
53d59559cd
7 changed files with 31 additions and 31 deletions
|
@ -257,7 +257,7 @@ bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int t
|
||||||
case DCeiling::ceilCrushRaiseAndStay:
|
case DCeiling::ceilCrushRaiseAndStay:
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.fD();
|
ceiling->m_TopHeight = sec->ceilingplane.fD();
|
||||||
case DCeiling::ceilLowerAndCrush:
|
case DCeiling::ceilLowerAndCrush:
|
||||||
targheight = sec->FindHighestFloorPoint (&spot);
|
targheight = FindHighestFloorPoint (sec, &spot);
|
||||||
targheight += height;
|
targheight += height;
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
|
@ -350,13 +350,13 @@ bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int t
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DCeiling::ceilLowerToFloor:
|
case DCeiling::ceilLowerToFloor:
|
||||||
targheight = sec->FindHighestFloorPoint (&spot) + height;
|
targheight = FindHighestFloorPoint (sec, &spot) + height;
|
||||||
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = -1;
|
ceiling->m_Direction = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DCeiling::ceilRaiseToFloor: // [RH] What's this for?
|
case DCeiling::ceilRaiseToFloor: // [RH] What's this for?
|
||||||
targheight = sec->FindHighestFloorPoint (&spot) + height;
|
targheight = FindHighestFloorPoint (sec, &spot) + height;
|
||||||
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
ceiling->m_TopHeight = sec->ceilingplane.PointToDist (spot, targheight);
|
||||||
ceiling->m_Direction = 1;
|
ceiling->m_Direction = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -388,7 +388,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, double speed, int delay, int lightTag
|
||||||
case doorWaitClose:
|
case doorWaitClose:
|
||||||
m_Direction = 0;
|
m_Direction = 0;
|
||||||
m_Type = DDoor::doorRaise;
|
m_Type = DDoor::doorRaise;
|
||||||
height = sec->FindHighestFloorPoint (&m_BotSpot);
|
height = FindHighestFloorPoint (sec, &m_BotSpot);
|
||||||
m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height);
|
m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height);
|
||||||
m_OldFloorDist = sec->floorplane.fD();
|
m_OldFloorDist = sec->floorplane.fD();
|
||||||
m_TopDist = sec->ceilingplane.fD();
|
m_TopDist = sec->ceilingplane.fD();
|
||||||
|
@ -399,7 +399,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, double speed, int delay, int lightTag
|
||||||
if (!m_Sector->floordata || !m_Sector->floordata->IsKindOf(RUNTIME_CLASS(DPlat)) ||
|
if (!m_Sector->floordata || !m_Sector->floordata->IsKindOf(RUNTIME_CLASS(DPlat)) ||
|
||||||
!(barrier_cast<DPlat*>(m_Sector->floordata))->IsLift())
|
!(barrier_cast<DPlat*>(m_Sector->floordata))->IsLift())
|
||||||
{
|
{
|
||||||
height = sec->FindHighestFloorPoint (&m_BotSpot);
|
height = FindHighestFloorPoint (sec, &m_BotSpot);
|
||||||
m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height);
|
m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -338,7 +338,7 @@ bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DFloor::floorMoveToValue:
|
case DFloor::floorMoveToValue:
|
||||||
sec->FindHighestFloorPoint(&spot);
|
FindHighestFloorPoint(sec, &spot);
|
||||||
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, height);
|
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, height);
|
||||||
floor->m_Direction = (floor->m_FloorDestDist > sec->floorplane.fD()) ? -1 : 1;
|
floor->m_Direction = (floor->m_FloorDestDist > sec->floorplane.fD()) ? -1 : 1;
|
||||||
break;
|
break;
|
||||||
|
@ -829,7 +829,7 @@ bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed)
|
||||||
floor->m_Instant = false;
|
floor->m_Instant = false;
|
||||||
floor->m_Texture = s3->GetTexture(sector_t::floor);
|
floor->m_Texture = s3->GetTexture(sector_t::floor);
|
||||||
floor->m_NewSpecial = {};
|
floor->m_NewSpecial = {};
|
||||||
height = s3->FindHighestFloorPoint (&spot);
|
height = FindHighestFloorPoint (s3, &spot);
|
||||||
floor->m_FloorDestDist = s2->floorplane.PointToDist (spot, height);
|
floor->m_FloorDestDist = s2->floorplane.PointToDist (spot, height);
|
||||||
floor->StartFloorSound ();
|
floor->StartFloorSound ();
|
||||||
|
|
||||||
|
@ -842,7 +842,7 @@ bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed)
|
||||||
floor->m_Sector = s1;
|
floor->m_Sector = s1;
|
||||||
floor->m_Speed = pillarspeed;
|
floor->m_Speed = pillarspeed;
|
||||||
floor->m_Instant = false;
|
floor->m_Instant = false;
|
||||||
height = s3->FindHighestFloorPoint (&spot);
|
height = FindHighestFloorPoint (s3, &spot);
|
||||||
floor->m_FloorDestDist = s1->floorplane.PointToDist (spot, height);
|
floor->m_FloorDestDist = s1->floorplane.PointToDist (spot, height);
|
||||||
floor->StartFloorSound ();
|
floor->StartFloorSound ();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -246,7 +246,7 @@ DFireFlicker::DFireFlicker (sector_t *sector)
|
||||||
: DLighting (sector)
|
: DLighting (sector)
|
||||||
{
|
{
|
||||||
m_MaxLight = sector->lightlevel;
|
m_MaxLight = sector->lightlevel;
|
||||||
m_MinLight = sector_t::ClampLight(sector->FindMinSurroundingLight(sector->lightlevel) + 16);
|
m_MinLight = sector_t::ClampLight(FindMinSurroundingLight(sector, sector->lightlevel) + 16);
|
||||||
m_Count = 4;
|
m_Count = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ DLightFlash::DLightFlash (sector_t *sector)
|
||||||
{
|
{
|
||||||
// Find light levels like Doom.
|
// Find light levels like Doom.
|
||||||
m_MaxLight = sector->lightlevel;
|
m_MaxLight = sector->lightlevel;
|
||||||
m_MinLight = sector->FindMinSurroundingLight (sector->lightlevel);
|
m_MinLight = FindMinSurroundingLight (sector, sector->lightlevel);
|
||||||
m_MaxTime = 64;
|
m_MaxTime = 64;
|
||||||
m_MinTime = 7;
|
m_MinTime = 7;
|
||||||
m_Count = (pr_lightflash() & m_MaxTime) + 1;
|
m_Count = (pr_lightflash() & m_MaxTime) + 1;
|
||||||
|
@ -483,7 +483,7 @@ DStrobe::DStrobe (sector_t *sector, int utics, int ltics, bool inSync)
|
||||||
m_BrightTime = utics;
|
m_BrightTime = utics;
|
||||||
|
|
||||||
m_MaxLight = sector->lightlevel;
|
m_MaxLight = sector->lightlevel;
|
||||||
m_MinLight = sector->FindMinSurroundingLight (sector->lightlevel);
|
m_MinLight = FindMinSurroundingLight (sector, sector->lightlevel);
|
||||||
|
|
||||||
if (m_MinLight == m_MaxLight)
|
if (m_MinLight == m_MaxLight)
|
||||||
m_MinLight = 0;
|
m_MinLight = 0;
|
||||||
|
@ -729,7 +729,7 @@ void DGlow::Tick ()
|
||||||
DGlow::DGlow (sector_t *sector)
|
DGlow::DGlow (sector_t *sector)
|
||||||
: DLighting (sector)
|
: DLighting (sector)
|
||||||
{
|
{
|
||||||
m_MinLight = sector->FindMinSurroundingLight (sector->lightlevel);
|
m_MinLight = FindMinSurroundingLight (sector, sector->lightlevel);
|
||||||
m_MaxLight = sector->lightlevel;
|
m_MaxLight = sector->lightlevel;
|
||||||
m_Direction = -1;
|
m_Direction = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -595,13 +595,13 @@ sector_t *FindModelCeilingSector (sector_t *sect, double floordestheight)
|
||||||
//
|
//
|
||||||
// Find minimum light from an adjacent sector
|
// Find minimum light from an adjacent sector
|
||||||
//
|
//
|
||||||
int sector_t::FindMinSurroundingLight (int min) const
|
int FindMinSurroundingLight (const sector_t *sector, int min)
|
||||||
{
|
{
|
||||||
sector_t* check;
|
sector_t* check;
|
||||||
|
|
||||||
for (auto line : Lines)
|
for (auto line : sector->Lines)
|
||||||
{
|
{
|
||||||
if (NULL != (check = getNextSector (line, this)) &&
|
if (NULL != (check = getNextSector (line, sector)) &&
|
||||||
check->lightlevel < min)
|
check->lightlevel < min)
|
||||||
{
|
{
|
||||||
min = check->lightlevel;
|
min = check->lightlevel;
|
||||||
|
@ -613,38 +613,38 @@ int sector_t::FindMinSurroundingLight (int min) const
|
||||||
//
|
//
|
||||||
// Find the highest point on the floor of the sector
|
// Find the highest point on the floor of the sector
|
||||||
//
|
//
|
||||||
double sector_t::FindHighestFloorPoint (vertex_t **v) const
|
double FindHighestFloorPoint (const sector_t *sector, vertex_t **v)
|
||||||
{
|
{
|
||||||
double height = -FLT_MAX;
|
double height = -FLT_MAX;
|
||||||
double probeheight;
|
double probeheight;
|
||||||
vertex_t *spot = NULL;
|
vertex_t *spot = NULL;
|
||||||
|
|
||||||
if (!floorplane.isSlope())
|
if (!sector->floorplane.isSlope())
|
||||||
{
|
{
|
||||||
if (v != NULL)
|
if (v != NULL)
|
||||||
{
|
{
|
||||||
if (Lines.Size() == 0) *v = &level.vertexes[0];
|
if (sector->Lines.Size() == 0) *v = &level.vertexes[0];
|
||||||
else *v = Lines[0]->v1;
|
else *v = sector->Lines[0]->v1;
|
||||||
}
|
}
|
||||||
return -floorplane.fD();
|
return -sector->floorplane.fD();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto line : Lines)
|
for (auto line : sector->Lines)
|
||||||
{
|
{
|
||||||
probeheight = floorplane.ZatPoint(line->v1);
|
probeheight = sector->floorplane.ZatPoint(line->v1);
|
||||||
if (probeheight > height)
|
if (probeheight > height)
|
||||||
{
|
{
|
||||||
height = probeheight;
|
height = probeheight;
|
||||||
spot = line->v1;
|
spot = line->v1;
|
||||||
}
|
}
|
||||||
probeheight = floorplane.ZatPoint(line->v2);
|
probeheight = sector->floorplane.ZatPoint(line->v2);
|
||||||
if (probeheight > height)
|
if (probeheight > height)
|
||||||
{
|
{
|
||||||
height = probeheight;
|
height = probeheight;
|
||||||
spot = line->v2;
|
spot = line->v2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (v != NULL)
|
if (v != nullptr)
|
||||||
*v = spot;
|
*v = spot;
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
|
@ -623,9 +623,7 @@ public:
|
||||||
|
|
||||||
bool IsLinked(sector_t *other, bool ceiling) const;
|
bool IsLinked(sector_t *other, bool ceiling) const;
|
||||||
|
|
||||||
int FindMinSurroundingLight (int max) const;
|
|
||||||
sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH]
|
sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH]
|
||||||
double FindHighestFloorPoint(vertex_t **v) const;
|
|
||||||
void RemoveForceField();
|
void RemoveForceField();
|
||||||
int Index() const;
|
int Index() const;
|
||||||
|
|
||||||
|
@ -1598,6 +1596,8 @@ double FindLowestCeilingSurrounding(const sector_t *sec, vertex_t **v); // jff
|
||||||
double FindHighestCeilingSurrounding(const sector_t *sec, vertex_t **v); // jff 2/04/98
|
double FindHighestCeilingSurrounding(const sector_t *sec, vertex_t **v); // jff 2/04/98
|
||||||
double FindNextLowestCeiling(const sector_t *sec, vertex_t **v); // jff 2/04/98
|
double FindNextLowestCeiling(const sector_t *sec, vertex_t **v); // jff 2/04/98
|
||||||
double FindNextHighestCeiling(const sector_t *sec, vertex_t **v); // jff 2/04/98
|
double FindNextHighestCeiling(const sector_t *sec, vertex_t **v); // jff 2/04/98
|
||||||
|
int FindMinSurroundingLight (const sector_t *sec, int max);
|
||||||
|
double FindHighestFloorPoint(const sector_t *sec, vertex_t **v);
|
||||||
|
|
||||||
double FindShortestTextureAround(sector_t *sector); // jff 2/04/98
|
double FindShortestTextureAround(sector_t *sector); // jff 2/04/98
|
||||||
double FindShortestUpperAround(sector_t *sector); // jff 2/04/98
|
double FindShortestUpperAround(sector_t *sector); // jff 2/04/98
|
||||||
|
|
|
@ -110,19 +110,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindHighestCeilingSurrounding, FindHighes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(_Sector, FindMinSurroundingLight)
|
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindMinSurroundingLight, FindMinSurroundingLight)
|
||||||
{
|
{
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||||
PARAM_INT(min);
|
PARAM_INT(min);
|
||||||
auto h = self->FindMinSurroundingLight(min);
|
auto h = FindMinSurroundingLight(self, min);
|
||||||
ACTION_RETURN_INT(h);
|
ACTION_RETURN_INT(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorPoint)
|
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindHighestFloorPoint, FindHighestFloorPoint)
|
||||||
{
|
{
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||||
vertex_t *v;
|
vertex_t *v;
|
||||||
double h = self->FindHighestFloorPoint(&v);
|
double h = FindHighestFloorPoint(self, &v);
|
||||||
if (numret > 0) ret[0].SetFloat(h);
|
if (numret > 0) ret[0].SetFloat(h);
|
||||||
if (numret > 1) ret[1].SetPointer(v);
|
if (numret > 1) ret[1].SetPointer(v);
|
||||||
return numret;
|
return numret;
|
||||||
|
@ -498,7 +498,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField)
|
||||||
self->SetYScale(pos, o);
|
self->SetYScale(pos, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(_Sector, SetYScale)
|
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetYScale, SetYScale)
|
||||||
{
|
{
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
|
||||||
PARAM_INT(pos);
|
PARAM_INT(pos);
|
||||||
|
|
Loading…
Reference in a new issue