Added direct native functions to the remaining content of vmthunks.cpp

This commit is contained in:
Christoph Oelckers 2018-11-29 17:55:56 +01:00
parent 62efe11a85
commit 53d59559cd
7 changed files with 31 additions and 31 deletions

View File

@ -257,7 +257,7 @@ bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int t
case DCeiling::ceilCrushRaiseAndStay:
ceiling->m_TopHeight = sec->ceilingplane.fD();
case DCeiling::ceilLowerAndCrush:
targheight = sec->FindHighestFloorPoint (&spot);
targheight = FindHighestFloorPoint (sec, &spot);
targheight += height;
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
ceiling->m_Direction = -1;
@ -350,13 +350,13 @@ bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int t
break;
case DCeiling::ceilLowerToFloor:
targheight = sec->FindHighestFloorPoint (&spot) + height;
targheight = FindHighestFloorPoint (sec, &spot) + height;
ceiling->m_BottomHeight = sec->ceilingplane.PointToDist (spot, targheight);
ceiling->m_Direction = -1;
break;
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_Direction = 1;
break;

View File

@ -388,7 +388,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, double speed, int delay, int lightTag
case doorWaitClose:
m_Direction = 0;
m_Type = DDoor::doorRaise;
height = sec->FindHighestFloorPoint (&m_BotSpot);
height = FindHighestFloorPoint (sec, &m_BotSpot);
m_BotDist = sec->ceilingplane.PointToDist (m_BotSpot, height);
m_OldFloorDist = sec->floorplane.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)) ||
!(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);
}
else

View File

@ -338,7 +338,7 @@ bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line,
break;
case DFloor::floorMoveToValue:
sec->FindHighestFloorPoint(&spot);
FindHighestFloorPoint(sec, &spot);
floor->m_FloorDestDist = sec->floorplane.PointToDist(spot, height);
floor->m_Direction = (floor->m_FloorDestDist > sec->floorplane.fD()) ? -1 : 1;
break;
@ -829,7 +829,7 @@ bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed)
floor->m_Instant = false;
floor->m_Texture = s3->GetTexture(sector_t::floor);
floor->m_NewSpecial = {};
height = s3->FindHighestFloorPoint (&spot);
height = FindHighestFloorPoint (s3, &spot);
floor->m_FloorDestDist = s2->floorplane.PointToDist (spot, height);
floor->StartFloorSound ();
@ -842,7 +842,7 @@ bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed)
floor->m_Sector = s1;
floor->m_Speed = pillarspeed;
floor->m_Instant = false;
height = s3->FindHighestFloorPoint (&spot);
height = FindHighestFloorPoint (s3, &spot);
floor->m_FloorDestDist = s1->floorplane.PointToDist (spot, height);
floor->StartFloorSound ();
break;

View File

@ -246,7 +246,7 @@ DFireFlicker::DFireFlicker (sector_t *sector)
: DLighting (sector)
{
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;
}
@ -391,7 +391,7 @@ DLightFlash::DLightFlash (sector_t *sector)
{
// Find light levels like Doom.
m_MaxLight = sector->lightlevel;
m_MinLight = sector->FindMinSurroundingLight (sector->lightlevel);
m_MinLight = FindMinSurroundingLight (sector, sector->lightlevel);
m_MaxTime = 64;
m_MinTime = 7;
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_MaxLight = sector->lightlevel;
m_MinLight = sector->FindMinSurroundingLight (sector->lightlevel);
m_MinLight = FindMinSurroundingLight (sector, sector->lightlevel);
if (m_MinLight == m_MaxLight)
m_MinLight = 0;
@ -729,7 +729,7 @@ void DGlow::Tick ()
DGlow::DGlow (sector_t *sector)
: DLighting (sector)
{
m_MinLight = sector->FindMinSurroundingLight (sector->lightlevel);
m_MinLight = FindMinSurroundingLight (sector, sector->lightlevel);
m_MaxLight = sector->lightlevel;
m_Direction = -1;
}

View File

@ -595,13 +595,13 @@ sector_t *FindModelCeilingSector (sector_t *sect, double floordestheight)
//
// 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;
for (auto line : Lines)
for (auto line : sector->Lines)
{
if (NULL != (check = getNextSector (line, this)) &&
if (NULL != (check = getNextSector (line, sector)) &&
check->lightlevel < min)
{
min = check->lightlevel;
@ -613,38 +613,38 @@ int sector_t::FindMinSurroundingLight (int min) const
//
// 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 probeheight;
vertex_t *spot = NULL;
if (!floorplane.isSlope())
if (!sector->floorplane.isSlope())
{
if (v != NULL)
{
if (Lines.Size() == 0) *v = &level.vertexes[0];
else *v = Lines[0]->v1;
if (sector->Lines.Size() == 0) *v = &level.vertexes[0];
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)
{
height = probeheight;
spot = line->v1;
}
probeheight = floorplane.ZatPoint(line->v2);
probeheight = sector->floorplane.ZatPoint(line->v2);
if (probeheight > height)
{
height = probeheight;
spot = line->v2;
}
}
if (v != NULL)
if (v != nullptr)
*v = spot;
return height;
}

View File

@ -623,9 +623,7 @@ public:
bool IsLinked(sector_t *other, bool ceiling) const;
int FindMinSurroundingLight (int max) const;
sector_t *NextSpecialSector (int type, sector_t *prev) const; // [RH]
double FindHighestFloorPoint(vertex_t **v) const;
void RemoveForceField();
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 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
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 FindShortestUpperAround(sector_t *sector); // jff 2/04/98

View File

@ -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_INT(min);
auto h = self->FindMinSurroundingLight(min);
auto h = FindMinSurroundingLight(self, min);
ACTION_RETURN_INT(h);
}
DEFINE_ACTION_FUNCTION(_Sector, FindHighestFloorPoint)
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, FindHighestFloorPoint, FindHighestFloorPoint)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
vertex_t *v;
double h = self->FindHighestFloorPoint(&v);
double h = FindHighestFloorPoint(self, &v);
if (numret > 0) ret[0].SetFloat(h);
if (numret > 1) ret[1].SetPointer(v);
return numret;
@ -498,7 +498,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, RemoveForceField, RemoveForceField)
self->SetYScale(pos, o);
}
DEFINE_ACTION_FUNCTION(_Sector, SetYScale)
DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetYScale, SetYScale)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(pos);