mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-02 02:01:31 +00:00
- rewrote nextsectorneighborzptr with a better parameter interface
This commit is contained in:
parent
ec66f39535
commit
83c0ad55f2
9 changed files with 102 additions and 91 deletions
|
@ -176,13 +176,6 @@ inline constexpr uint32_t uhypsq(int32_t const dx, int32_t const dy)
|
||||||
|
|
||||||
void rotatepoint(vec2_t const pivot, vec2_t p, int16_t const daang, vec2_t * const p2) ATTRIBUTE((nonnull(4)));
|
void rotatepoint(vec2_t const pivot, vec2_t p, int16_t const daang, vec2_t * const p2) ATTRIBUTE((nonnull(4)));
|
||||||
|
|
||||||
sectortype* nextsectorneighborzptr(sectortype* sectp, int refz, int topbottom, int direction);
|
|
||||||
inline sectortype* safenextsectorneighborzptr(sectortype* sectp, int refz, int topbottom, int direction)
|
|
||||||
{
|
|
||||||
auto sect = nextsectorneighborzptr(sectp, refz, topbottom, direction);
|
|
||||||
return sect == nullptr ? sectp : sect;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t lintersect(int32_t originX, int32_t originY, int32_t originZ,
|
int32_t lintersect(int32_t originX, int32_t originY, int32_t originZ,
|
||||||
int32_t destX, int32_t destY, int32_t destZ,
|
int32_t destX, int32_t destY, int32_t destZ,
|
||||||
int32_t lineStartX, int32_t lineStartY, int32_t lineEndX, int32_t lineEndY,
|
int32_t lineStartX, int32_t lineStartY, int32_t lineEndX, int32_t lineEndY,
|
||||||
|
|
|
@ -248,38 +248,6 @@ int32_t getangle(int32_t xvect, int32_t yvect)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// nextsectorneighborz
|
|
||||||
//
|
|
||||||
// -1: ceiling or up
|
|
||||||
// 1: floor or down
|
|
||||||
sectortype* nextsectorneighborzptr(sectortype* sectp, int refz, int topbottom, int direction)
|
|
||||||
{
|
|
||||||
int nextz = (direction==1) ? INT32_MAX : INT32_MIN;
|
|
||||||
sectortype* sectortouse = nullptr;
|
|
||||||
|
|
||||||
for(auto& wal : wallsofsector(sectp))
|
|
||||||
{
|
|
||||||
if (wal.twoSided())
|
|
||||||
{
|
|
||||||
auto ns = wal.nextSector();
|
|
||||||
|
|
||||||
const int32_t testz = (topbottom == 1) ? ns->floorz : ns->ceilingz;
|
|
||||||
|
|
||||||
const int32_t update = (direction == 1) ?
|
|
||||||
(nextz > testz && testz > refz) :
|
|
||||||
(nextz < testz && testz < refz);
|
|
||||||
|
|
||||||
if (update)
|
|
||||||
{
|
|
||||||
nextz = testz;
|
|
||||||
sectortouse = ns;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sectortouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cansee
|
// cansee
|
||||||
|
|
|
@ -515,6 +515,38 @@ int inside(double x, double y, const sectortype* sect)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// find the closest neighboring sector plane in the given direction.
|
||||||
|
// Does not consider slopes, just like the original!
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
sectortype* nextsectorneighborzptr(sectortype* sectp, int startz, int flags)
|
||||||
|
{
|
||||||
|
int factor = (flags & Find_Up)? -1 : 1;
|
||||||
|
int bestz = INT_MAX;
|
||||||
|
sectortype* bestsec = (flags & Find_Safe)? sectp : nullptr;
|
||||||
|
const auto planez = (flags & Find_Ceiling)? §ortype::ceilingz : §ortype::floorz;
|
||||||
|
|
||||||
|
startz *= factor;
|
||||||
|
for(auto& wal : wallsofsector(sectp))
|
||||||
|
{
|
||||||
|
if (wal.twoSided())
|
||||||
|
{
|
||||||
|
auto nextsec = wal.nextSector();
|
||||||
|
auto nextz = factor * nextsec->*planez;
|
||||||
|
|
||||||
|
if (startz < nextz && nextz < bestz)
|
||||||
|
{
|
||||||
|
bestz = nextz;
|
||||||
|
bestsec = nextsec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bestsec;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -180,6 +180,24 @@ int getflorzofslopeptr(const sectortype* sec, int dax, int day);
|
||||||
void getzsofslopeptr(const sectortype* sec, int dax, int day, int* ceilz, int* florz);
|
void getzsofslopeptr(const sectortype* sec, int dax, int day, int* ceilz, int* florz);
|
||||||
void getzsofslopeptr(const sectortype* sec, double dax, double day, double* ceilz, double* florz);
|
void getzsofslopeptr(const sectortype* sec, double dax, double day, double* ceilz, double* florz);
|
||||||
|
|
||||||
|
enum EFindNextSector
|
||||||
|
{
|
||||||
|
Find_Floor = 0,
|
||||||
|
Find_Ceiling = 1,
|
||||||
|
|
||||||
|
Find_Down = 0,
|
||||||
|
Find_Up = 2,
|
||||||
|
|
||||||
|
Find_Safe = 4,
|
||||||
|
|
||||||
|
Find_CeilingUp = Find_Ceiling | Find_Up,
|
||||||
|
Find_CeilingDown = Find_Ceiling | Find_Down,
|
||||||
|
Find_FloorUp = Find_Floor | Find_Up,
|
||||||
|
Find_FloorDown = Find_Floor | Find_Down,
|
||||||
|
};
|
||||||
|
sectortype* nextsectorneighborzptr(sectortype* sectp, int startz, int flags);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// y is negated so that the orientation is the same as in GZDoom, in order to use its utilities.
|
// y is negated so that the orientation is the same as in GZDoom, in order to use its utilities.
|
||||||
// The render code should NOT use Build coordinates for anything!
|
// The render code should NOT use Build coordinates for anything!
|
||||||
|
|
|
@ -74,7 +74,7 @@ int pinsectorresetup(sectortype* sec)
|
||||||
|
|
||||||
if (j == -1)
|
if (j == -1)
|
||||||
{
|
{
|
||||||
j = safenextsectorneighborzptr(sec, sec->ceilingz, -1, -1)->ceilingz;
|
j = nextsectorneighborzptr(sec, sec->ceilingz, Find_CeilingUp | Find_Safe)->ceilingz;
|
||||||
setanimation(sec, anim_ceilingz, sec, j, 64);
|
setanimation(sec, anim_ceilingz, sec, j, 64);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -660,10 +660,10 @@ static void handle_st16(sectortype* sptr, DDukeActor* actor)
|
||||||
|
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
sectp = nextsectorneighborzptr(sptr, sptr->floorz, 1, 1);
|
sectp = nextsectorneighborzptr(sptr, sptr->floorz, Find_FloorDown);
|
||||||
if (sectp == nullptr)
|
if (sectp == nullptr)
|
||||||
{
|
{
|
||||||
sectp = nextsectorneighborzptr(sptr, sptr->floorz, 1, -1);
|
sectp = nextsectorneighborzptr(sptr, sptr->floorz, Find_FloorUp);
|
||||||
if (sectp == nullptr) return;
|
if (sectp == nullptr) return;
|
||||||
setanimation(sptr, anim_floorz, sptr, sectp->floorz, sptr->extra);
|
setanimation(sptr, anim_floorz, sptr, sectp->floorz, sptr->extra);
|
||||||
}
|
}
|
||||||
|
@ -687,8 +687,8 @@ static void handle_st18(sectortype* sptr, DDukeActor* actor)
|
||||||
|
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
auto sectp = nextsectorneighborzptr(sptr, sptr->floorz, 1, -1);
|
auto sectp = nextsectorneighborzptr(sptr, sptr->floorz, Find_FloorUp);
|
||||||
if (sectp == nullptr) sectp = nextsectorneighborzptr(sptr, sptr->floorz, 1, 1);
|
if (sectp == nullptr) sectp = nextsectorneighborzptr(sptr, sptr->floorz, Find_FloorDown);
|
||||||
if (sectp == nullptr) return;
|
if (sectp == nullptr) return;
|
||||||
int j = sectp->floorz;
|
int j = sectp->floorz;
|
||||||
int q = sptr->extra;
|
int q = sptr->extra;
|
||||||
|
@ -710,9 +710,9 @@ static void handle_st29(sectortype* sptr, DDukeActor* actor)
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if (sptr->lotag & 0x8000)
|
if (sptr->lotag & 0x8000)
|
||||||
j = safenextsectorneighborzptr(sptr, sptr->ceilingz, 1, 1)->floorz;
|
j = nextsectorneighborzptr(sptr, sptr->ceilingz, Find_FloorDown | Find_Safe)->floorz;
|
||||||
else
|
else
|
||||||
j = safenextsectorneighborzptr(sptr, sptr->ceilingz, -1, -1)->ceilingz;
|
j = nextsectorneighborzptr(sptr, sptr->ceilingz, Find_CeilingUp | Find_Safe)->ceilingz;
|
||||||
|
|
||||||
DukeStatIterator it(STAT_EFFECTOR);
|
DukeStatIterator it(STAT_EFFECTOR);
|
||||||
while (auto act2 = it.Next())
|
while (auto act2 = it.Next())
|
||||||
|
@ -762,7 +762,7 @@ REDODOOR:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto sectp = nextsectorneighborzptr(sptr, sptr->ceilingz, -1, -1);
|
auto sectp = nextsectorneighborzptr(sptr, sptr->ceilingz, Find_CeilingUp);
|
||||||
|
|
||||||
if (sectp) j = sectp->ceilingz;
|
if (sectp) j = sectp->ceilingz;
|
||||||
else
|
else
|
||||||
|
@ -791,14 +791,14 @@ static void handle_st21(sectortype* sptr, DDukeActor* actor)
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
{
|
{
|
||||||
if (animategoal[i] == sptr->ceilingz)
|
if (animategoal[i] == sptr->ceilingz)
|
||||||
animategoal[i] = safenextsectorneighborzptr(sptr, sptr->ceilingz, 1, 1)->floorz;
|
animategoal[i] = nextsectorneighborzptr(sptr, sptr->ceilingz, Find_FloorDown | Find_Safe)->floorz;
|
||||||
else animategoal[i] = sptr->ceilingz;
|
else animategoal[i] = sptr->ceilingz;
|
||||||
j = animategoal[i];
|
j = animategoal[i];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sptr->ceilingz == sptr->floorz)
|
if (sptr->ceilingz == sptr->floorz)
|
||||||
j = safenextsectorneighborzptr(sptr, sptr->ceilingz, 1, 1)->floorz;
|
j = nextsectorneighborzptr(sptr, sptr->ceilingz, Find_FloorDown | Find_Safe)->floorz;
|
||||||
else j = sptr->ceilingz;
|
else j = sptr->ceilingz;
|
||||||
|
|
||||||
sptr->lotag ^= 0x8000;
|
sptr->lotag ^= 0x8000;
|
||||||
|
@ -825,9 +825,9 @@ static void handle_st22(sectortype* sptr, DDukeActor* actor)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
q = safenextsectorneighborzptr(sptr, sptr->floorz, 1, 1)->floorz;
|
q = nextsectorneighborzptr(sptr, sptr->floorz, Find_FloorDown | Find_Safe)->floorz;
|
||||||
j = setanimation(sptr, anim_floorz, sptr, q, sptr->extra);
|
j = setanimation(sptr, anim_floorz, sptr, q, sptr->extra);
|
||||||
q = safenextsectorneighborzptr(sptr, sptr->ceilingz, -1, -1)->ceilingz;
|
q = nextsectorneighborzptr(sptr, sptr->ceilingz, Find_CeilingUp | Find_Safe)->ceilingz;
|
||||||
j = setanimation(sptr, anim_ceilingz, sptr, q, sptr->extra);
|
j = setanimation(sptr, anim_ceilingz, sptr, q, sptr->extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -750,8 +750,8 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
|
||||||
case SE_17_WARP_ELEVATOR:
|
case SE_17_WARP_ELEVATOR:
|
||||||
{
|
{
|
||||||
actor->temp_data[2] = sectp->floorz; //Stopping loc
|
actor->temp_data[2] = sectp->floorz; //Stopping loc
|
||||||
actor->temp_data[3] = safenextsectorneighborzptr(sectp, sectp->floorz, -1, -1)->ceilingz;
|
actor->temp_data[3] = nextsectorneighborzptr(sectp, sectp->floorz, Find_CeilingUp | Find_Safe)->ceilingz;
|
||||||
actor->temp_data[4] = safenextsectorneighborzptr(sectp, sectp->ceilingz, 1, 1)->floorz;
|
actor->temp_data[4] = nextsectorneighborzptr(sectp, sectp->ceilingz, Find_FloorDown | Find_Safe)->floorz;
|
||||||
|
|
||||||
if (numplayers < 2)
|
if (numplayers < 2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -615,7 +615,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
This function searches z-coordinates of neighboring sectors to find the
|
This function searches z-coordinates of neighboring sectors to find the
|
||||||
closest (next) ceiling starting at the given z-coordinate (thez).
|
closest (next) ceiling starting at the given z-coordinate (thez).
|
||||||
*/
|
*/
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
|
|
||||||
|
|
||||||
int nElev = BuildElevC(0, nChannel, pSector, FindWallSprites(pSector), nSpeed * 100, nSpeed * 100, 2, pSector->floorz, nextSectorP->ceilingz);
|
int nElev = BuildElevC(0, nChannel, pSector, FindWallSprites(pSector), nSpeed * 100, nSpeed * 100, 2, pSector->floorz, nextSectorP->ceilingz);
|
||||||
|
@ -634,7 +634,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 2: // Floor Doom door
|
case 2: // Floor Doom door
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
|
|
||||||
|
|
||||||
int nElev = BuildElevF(nChannel, pSector, FindWallSprites(pSector), nSpeed * 100, nSpeed * 100, 2, pSector->ceilingz, nextSectorP->floorz);
|
int nElev = BuildElevF(nChannel, pSector, FindWallSprites(pSector), nSpeed * 100, nSpeed * 100, 2, pSector->ceilingz, nextSectorP->floorz);
|
||||||
|
@ -683,7 +683,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 5: // Permanent floor raise
|
case 5: // Permanent floor raise
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz + 1, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz + 1, Find_CeilingUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
int nElev = BuildElevF(nChannel, pSector, FindWallSprites(pSector), nSpeed * 100, nSpeed * 100, 2, pSector->floorz, nextSectorP->ceilingz);
|
int nElev = BuildElevF(nChannel, pSector, FindWallSprites(pSector), nSpeed * 100, nSpeed * 100, 2, pSector->floorz, nextSectorP->ceilingz);
|
||||||
|
@ -694,7 +694,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 6: // Touchplate floor lower, single
|
case 6: // Touchplate floor lower, single
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 7: // Touchplate floor lower, multiple
|
case 7: // Touchplate floor lower, multiple
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 8: // Permanent floor lower
|
case 8: // Permanent floor lower
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -744,7 +744,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 9: // Switch activated lift down
|
case 9: // Switch activated lift down
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -760,7 +760,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 10: // Touchplate Floor Raise
|
case 10: // Touchplate Floor Raise
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -789,7 +789,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
*/
|
*/
|
||||||
int zVal = 0;
|
int zVal = 0;
|
||||||
|
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorUp | Find_Safe);
|
||||||
if (nextSectorP != nullptr) {
|
if (nextSectorP != nullptr) {
|
||||||
zVal = nextSectorP->floorz;
|
zVal = nextSectorP->floorz;
|
||||||
}
|
}
|
||||||
|
@ -809,7 +809,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
*/
|
*/
|
||||||
int zVal = 0;
|
int zVal = 0;
|
||||||
|
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorUp | Find_Safe);
|
||||||
if (nextSectorP != nullptr) {
|
if (nextSectorP != nullptr) {
|
||||||
zVal = nextSectorP->floorz;
|
zVal = nextSectorP->floorz;
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
*/
|
*/
|
||||||
int zVal = 0;
|
int zVal = 0;
|
||||||
|
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP != nullptr) {
|
if (nextSectorP != nullptr) {
|
||||||
zVal = nextSectorP->floorz;
|
zVal = nextSectorP->floorz;
|
||||||
}
|
}
|
||||||
|
@ -850,7 +850,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 15: // Sector raise/lower
|
case 15: // Sector raise/lower
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -925,7 +925,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
*/
|
*/
|
||||||
int zVal = 0;
|
int zVal = 0;
|
||||||
|
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP) {
|
if (nextSectorP) {
|
||||||
zVal = nextSectorP->floorz;
|
zVal = nextSectorP->floorz;
|
||||||
}
|
}
|
||||||
|
@ -942,7 +942,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 24: // Ceiling door, channel trigger only
|
case 24: // Ceiling door, channel trigger only
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -958,7 +958,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 25:
|
case 25:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -974,7 +974,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 26:
|
case 26:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -990,7 +990,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 27:
|
case 27:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1006,7 +1006,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 28:
|
case 28:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 31: // Touchplate
|
case 31: // Touchplate
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1038,7 +1038,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1050,7 +1050,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 33: // Ceiling Crusher
|
case 33: // Ceiling Crusher
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1062,7 +1062,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 34: // Triggerable Ceiling Crusher(Inactive)
|
case 34: // Triggerable Ceiling Crusher(Inactive)
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1088,7 +1088,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 37:
|
case 37:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1100,7 +1100,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 39: // Touchplate
|
case 39: // Touchplate
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1163,7 +1163,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
*/
|
*/
|
||||||
int zVal = 0;
|
int zVal = 0;
|
||||||
|
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingDown | Find_Safe);
|
||||||
if (nextSectorP != nullptr) {
|
if (nextSectorP != nullptr) {
|
||||||
zVal = nextSectorP->ceilingz;
|
zVal = nextSectorP->ceilingz;
|
||||||
}
|
}
|
||||||
|
@ -1176,7 +1176,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 49:
|
case 49:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1188,7 +1188,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 50: // Floor lower / raise
|
case 50: // Floor lower / raise
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1264,7 +1264,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 54:
|
case 54:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1280,7 +1280,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 55:
|
case 55:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1296,7 +1296,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 56:
|
case 56:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1308,7 +1308,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 57:
|
case 57:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1333,7 +1333,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
nEnergyChan = nChannel;
|
nEnergyChan = nChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
|
|
||||||
|
|
||||||
int nElev = BuildElevC(0, nChannel, pSector, FindWallSprites(pSector), nSpeed * 100, nSpeed * 100, 2, pSector->floorz, nextSectorP->ceilingz);
|
int nElev = BuildElevC(0, nChannel, pSector, FindWallSprites(pSector), nSpeed * 100, nSpeed * 100, 2, pSector->floorz, nextSectorP->ceilingz);
|
||||||
|
@ -1344,7 +1344,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 59:
|
case 59:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1369,7 +1369,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr || var_1C >= 8) {
|
if (nextSectorP == nullptr || var_1C >= 8) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1393,7 +1393,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr || var_20 >= 8) {
|
if (nextSectorP == nullptr || var_20 >= 8) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1419,7 +1419,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
|
|
||||||
case 68:
|
case 68:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->floorz, 1, 1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->floorz, Find_FloorDown | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1432,7 +1432,7 @@ void runlist_ProcessSectorTag(sectortype* pSector, int nLotag, int nHitag)
|
||||||
case 70:
|
case 70:
|
||||||
case 71:
|
case 71:
|
||||||
{
|
{
|
||||||
auto nextSectorP = safenextsectorneighborzptr(pSector, pSector->ceilingz, -1, -1);
|
auto nextSectorP = nextsectorneighborzptr(pSector, pSector->ceilingz, Find_CeilingUp | Find_Safe);
|
||||||
if (nextSectorP == nullptr) break;
|
if (nextSectorP == nullptr) break;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -630,7 +630,7 @@ void DoSpringBoardDown(void)
|
||||||
{
|
{
|
||||||
int destz;
|
int destz;
|
||||||
|
|
||||||
destz = safenextsectorneighborzptr(sbp->sectp, sbp->sectp->floorz, 1, 1)->floorz;
|
destz = nextsectorneighborzptr(sbp->sectp, sbp->sectp->floorz, Find_FloorDown | Find_Safe)->floorz;
|
||||||
|
|
||||||
AnimSet(ANIM_Floorz, sbp->sectp, destz, 256);
|
AnimSet(ANIM_Floorz, sbp->sectp, destz, 256);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue