mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- renamed getzsofslopeptr to calcSlope and removed one redundant inline.
This commit is contained in:
parent
ce4a6fc7e3
commit
0c87bcb91b
20 changed files with 42 additions and 47 deletions
|
@ -519,7 +519,7 @@ bool cansee(const DVector3& start, sectortype* sect1, const DVector3& end, secto
|
|||
|
||||
for (auto isec : { sec, wal.nextSector() })
|
||||
{
|
||||
getzsofslopeptr(isec, spot, &ceilz, &floorz);
|
||||
calcSlope(isec, spot, &ceilz, &floorz);
|
||||
|
||||
if (spot.Z <= ceilz || spot.Z >= floorz)
|
||||
return false;
|
||||
|
@ -698,7 +698,7 @@ double checkWallHit(walltype* wal, EWallFlags flagmask, const DVector3& start, c
|
|||
{
|
||||
// check if the trace passes this wall or hits the upper or lower tier.
|
||||
double cz, fz;
|
||||
getzsofslopeptr(wal->nextSector(), result, &cz, &fz);
|
||||
calcSlope(wal->nextSector(), result, &cz, &fz);
|
||||
if (result.Z > cz && result.Z < fz) return -2; // trace will pass this wall, i.e. no hit. Return -2 to tell the caller to go on.
|
||||
}
|
||||
return factor;
|
||||
|
@ -890,7 +890,7 @@ bool checkRangeOfWall(walltype* wal, EWallFlags flagmask, const DVector3& pos, d
|
|||
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE || !strict_compatibility)
|
||||
SquareDistToSector(closest.X, closest.Y, nextsect, &closest);
|
||||
|
||||
getzsofslopeptr(nextsect, closest.X, closest.Y, &theZs[0], &theZs[1]);
|
||||
calcSlope(nextsect, closest.X, closest.Y, &theZs[0], &theZs[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -988,7 +988,7 @@ void getzrange(const DVector3& pos, sectortype* sect, double* ceilz, CollisionBa
|
|||
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE || !strict_compatibility)
|
||||
SquareDistToSector(closest.X, closest.Y, sect, &closest);
|
||||
|
||||
getzsofslopeptr(sect, closest, ceilz, florz);
|
||||
calcSlope(sect, closest, ceilz, florz);
|
||||
ceilhit.setSector(sect);
|
||||
florhit.setSector(sect);
|
||||
|
||||
|
|
|
@ -331,13 +331,8 @@ inline void PlanesAtPoint(const sectortype* sec, float dax, float day, float* pc
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
inline void getzsofslopeptr(const sectortype* sec, double dax, double day, double* ceilz, double* florz)
|
||||
{
|
||||
calcSlope(sec, dax, day, ceilz, florz);
|
||||
}
|
||||
|
||||
template<class Vector>
|
||||
inline void getzsofslopeptr(const sectortype* sec, const Vector& pos, double* ceilz, double* florz)
|
||||
inline void calcSlope(const sectortype* sec, const Vector& pos, double* ceilz, double* florz)
|
||||
{
|
||||
calcSlope(sec, pos.X, pos.Y, ceilz, florz);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ inline int inside0(double x, double y, double z, const sectortype* sect)
|
|||
inline int insideZ(double x, double y, double z, const sectortype* sect)
|
||||
{
|
||||
double cz, fz;
|
||||
getzsofslopeptr(sect, x, y, &cz, &fz);
|
||||
calcSlope(sect, x, y, &cz, &fz);
|
||||
return (z >= cz && z <= fz && inside(x, y, sect) != 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -5241,7 +5241,7 @@ int MoveMissile(DBloodActor* actor)
|
|||
else
|
||||
{
|
||||
double fz, cz;
|
||||
getzsofslopeptr(clipmoveresult.hitWall->nextSector(), ppos, &cz, &fz);
|
||||
calcSlope(clipmoveresult.hitWall->nextSector(), ppos, &cz, &fz);
|
||||
if (ppos.Z <= cz || ppos.Z >= fz) cliptype = 0;
|
||||
else cliptype = 4;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ void CFX::fxProcess(void)
|
|||
if (!actor->vel.isZero())
|
||||
{
|
||||
double floorZ, ceilZ;
|
||||
getzsofslopeptr(pSector, actor->spr.pos, &ceilZ, &floorZ);
|
||||
calcSlope(pSector, actor->spr.pos, &ceilZ, &floorZ);
|
||||
if (ceilZ > actor->spr.pos.Z && !(pSector->ceilingstat & CSTAT_SECTOR_SKY))
|
||||
{
|
||||
remove(actor);
|
||||
|
|
|
@ -231,7 +231,7 @@ int HitScan(DBloodActor* actor, double z, const DVector3& vect, unsigned int nMa
|
|||
if (!pWall->twoSided())
|
||||
return 0;
|
||||
double nZCeil, nZFloor;
|
||||
getzsofslopeptr(pWall->nextSector(), gHitInfo.hitpos.X, gHitInfo.hitpos.Y, &nZCeil, &nZFloor);
|
||||
calcSlope(pWall->nextSector(), gHitInfo.hitpos.X, gHitInfo.hitpos.Y, &nZCeil, &nZFloor);
|
||||
if (gHitInfo.hitpos.Z <= nZCeil || gHitInfo.hitpos.Z >= nZFloor)
|
||||
return 0;
|
||||
return 4;
|
||||
|
@ -322,7 +322,7 @@ int VectorScan(DBloodActor* actor, double nOffset, double nZOffset, const DVecto
|
|||
sectortype* pSector = gHitInfo.hitSector;
|
||||
sectortype* pSectorNext = pWall->nextSector();
|
||||
double nZCeil, nZFloor;
|
||||
getzsofslopeptr(pWall->nextSector(), gHitInfo.hitpos, &nZCeil, &nZFloor);
|
||||
calcSlope(pWall->nextSector(), gHitInfo.hitpos, &nZCeil, &nZFloor);
|
||||
if (gHitInfo.hitpos.Z <= nZCeil)
|
||||
return 0;
|
||||
if (gHitInfo.hitpos.Z >= nZFloor)
|
||||
|
|
|
@ -278,7 +278,7 @@ void GibFX(DBloodActor* actor, GIBFX* pGFX, DVector3* pPos, DVector3* pVel)
|
|||
auto gPos = pPos? *pPos : actor->spr.pos;
|
||||
|
||||
double ceilZ, floorZ;
|
||||
getzsofslopeptr(pSector, gPos.XY(), &ceilZ, &floorZ);
|
||||
calcSlope(pSector, gPos.XY(), &ceilZ, &floorZ);
|
||||
int nCount = ChanceToCount(pGFX->chance, pGFX->at9);
|
||||
double dz1 = floorZ - gPos.Z;
|
||||
double dz2 = gPos.Z - ceilZ;
|
||||
|
@ -363,7 +363,7 @@ void GibThing(DBloodActor* actor, GIBTHING* pGThing, DVector3* pPos, DVector3* p
|
|||
gPos = *pPos;
|
||||
}
|
||||
double ceilZ, floorZ;
|
||||
getzsofslopeptr(pSector, gPos, &ceilZ, &floorZ);
|
||||
calcSlope(pSector, gPos, &ceilZ, &floorZ);
|
||||
double dz1 = floorZ - gPos.Z;
|
||||
double dz2 = gPos.Z - ceilZ;
|
||||
auto gibactor = actSpawnThing(pSector, gPos, pGThing->type);
|
||||
|
@ -485,9 +485,9 @@ void GibWall(walltype* pWall, GIBTYPE nGibType, DVector3* pVel)
|
|||
|
||||
auto pSector = pWall->sectorp();
|
||||
double ceilZ, floorZ;
|
||||
getzsofslopeptr(pSector, center, &ceilZ, &floorZ);
|
||||
calcSlope(pSector, center, &ceilZ, &floorZ);
|
||||
double ceilZ2, floorZ2;
|
||||
getzsofslopeptr(pWall->nextSector(), center, &ceilZ2, &floorZ2);
|
||||
calcSlope(pWall->nextSector(), center, &ceilZ2, &floorZ2);
|
||||
|
||||
ceilZ = max(ceilZ, ceilZ2);
|
||||
floorZ = min(floorZ, floorZ2);
|
||||
|
|
|
@ -1362,7 +1362,7 @@ void nnExtProcessSuperSprites()
|
|||
|
||||
auto pSector = debrisactor->sector();
|
||||
double fz, cz;
|
||||
getzsofslopeptr(pSector, debrisactor->spr.pos, &cz, &fz);
|
||||
calcSlope(pSector, debrisactor->spr.pos, &cz, &fz);
|
||||
GetActorExtents(debrisactor, &top, &bottom);
|
||||
|
||||
if (fz >= bottom && pSector->lowerLink == nullptr && !(pSector->ceilingstat & CSTAT_SECTOR_SKY)) debrisactor->spr.pos.Z += max(cz - top, 0.);
|
||||
|
@ -3731,9 +3731,9 @@ void useSeqSpawnerGen(DBloodActor* sourceactor, int objType, sectortype* pSector
|
|||
cpos.XY() = pWall->center();
|
||||
auto pMySector = pWall->sectorp();
|
||||
double ceilZ, floorZ;
|
||||
getzsofslopeptr(pSector, cpos, &ceilZ, &floorZ);
|
||||
calcSlope(pSector, cpos, &ceilZ, &floorZ);
|
||||
double ceilZ2, floorZ2;
|
||||
getzsofslopeptr(pWall->nextSector(), cpos, &ceilZ2, &floorZ2);
|
||||
calcSlope(pWall->nextSector(), cpos, &ceilZ2, &floorZ2);
|
||||
ceilZ = max(ceilZ, ceilZ2);
|
||||
floorZ = min(floorZ, floorZ2);
|
||||
cpos.Z = (ceilZ + floorZ) * 0.5;
|
||||
|
|
|
@ -711,7 +711,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
if (pSector != nullptr)
|
||||
{
|
||||
double ceilingZ, floorZ;
|
||||
getzsofslopeptr(pSector, cPos, &ceilingZ, &floorZ);
|
||||
calcSlope(pSector, cPos, &ceilingZ, &floorZ);
|
||||
if ((cPos.Z > floorZ - 1) && (pSector->upperLink == nullptr)) // clamp to floor
|
||||
{
|
||||
cPos.Z = floorZ - 1;
|
||||
|
|
|
@ -3556,7 +3556,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
|
|||
if (actor->spr.picnum == COMMANDER)
|
||||
{
|
||||
double c, f;
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f);
|
||||
calcSlope(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f);
|
||||
actor->floorz = f;
|
||||
actor->ceilingz = c;
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
|
|||
|
||||
if (sect)
|
||||
{
|
||||
getzsofslopeptr(sect, cpos, &cz, &fz);
|
||||
calcSlope(sect, cpos, &cz, &fz);
|
||||
cpos.Z = min(max(cpos.Z, cz + 4), fz - 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ int DoActorDebris(DSWActor* actor)
|
|||
KillActor(actor);
|
||||
return 0;
|
||||
case ZILLA_RUN_R0:
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.hiz, &actor->user.loz);
|
||||
calcSlope(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.hiz, &actor->user.loz);
|
||||
actor->user.lo_sectp = actor->sector();
|
||||
actor->user.hi_sectp = actor->sector();
|
||||
actor->user.lowActor = nullptr;
|
||||
|
|
|
@ -374,7 +374,7 @@ int DoBloodSpray(DSWActor* actor)
|
|||
// special stuff for blood worm
|
||||
actor->spr.pos.Z += actor->user.change.Z * 0.5;
|
||||
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos, &cz, &fz);
|
||||
calcSlope(actor->sector(), actor->spr.pos, &cz, &fz);
|
||||
// pretend like we hit a sector
|
||||
if (actor->spr.pos.Z >= fz)
|
||||
{
|
||||
|
@ -467,7 +467,7 @@ int DoBloodSpray(DSWActor* actor)
|
|||
{
|
||||
// sy & sz are the ceiling and floor of the sector you are sliding down
|
||||
if (bldActor->tempwall->twoSided())
|
||||
getzsofslopeptr(bldActor->tempwall->nextSector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.pos.Y, &actor->user.pos.Z);
|
||||
calcSlope(bldActor->tempwall->nextSector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.pos.Y, &actor->user.pos.Z);
|
||||
else
|
||||
actor->user.pos.Y = actor->user.pos.Z; // ceiling and floor are equal - white wall
|
||||
}
|
||||
|
|
|
@ -2078,7 +2078,7 @@ void PlayerSectorBound(PLAYER* pp, double amt)
|
|||
// called from DoPlayerMove() but can be called
|
||||
// from anywhere it is needed
|
||||
|
||||
getzsofslopeptr(pp->cursector, pp->pos, &cz, &fz);
|
||||
calcSlope(pp->cursector, pp->pos, &cz, &fz);
|
||||
|
||||
if (pp->pos.Z > fz - amt)
|
||||
pp->pos.Z = fz - amt;
|
||||
|
@ -2322,7 +2322,7 @@ void DoPlayerSectorUpdatePostMove(PLAYER* pp)
|
|||
pp->setcursector(sect);
|
||||
|
||||
// adjust the posz to be in a sector
|
||||
getzsofslopeptr(pp->cursector, pp->pos, &cz, &fz);
|
||||
calcSlope(pp->cursector, pp->pos, &cz, &fz);
|
||||
if (pp->pos.Z > fz)
|
||||
pp->pos.Z = fz;
|
||||
|
||||
|
@ -5246,7 +5246,7 @@ void DoPlayerBeginOperate(PLAYER* pp)
|
|||
pp->angle.oang = pp->angle.ang = sop->ang;
|
||||
pp->pos.XY() = sop->pmid.XY();
|
||||
updatesector(pp->pos, &pp->cursector);
|
||||
getzsofslopeptr(pp->cursector, pp->pos, &cz, &fz);
|
||||
calcSlope(pp->cursector, pp->pos, &cz, &fz);
|
||||
pp->pos.Z = fz - PLAYER_HEIGHTF;
|
||||
|
||||
pp->Flags &= ~(PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL);
|
||||
|
@ -5336,7 +5336,7 @@ void DoPlayerBeginRemoteOperate(PLAYER* pp, SECTOR_OBJECT* sop)
|
|||
pp->angle.oang = pp->angle.ang = sop->ang;
|
||||
pp->pos.XY() = sop->pmid.XY();
|
||||
updatesector(pp->pos, &pp->cursector);
|
||||
getzsofslopeptr(pp->cursector, pp->pos, &cz, &fz);
|
||||
calcSlope(pp->cursector, pp->pos, &cz, &fz);
|
||||
pp->pos.Z = fz - PLAYER_HEIGHTF;
|
||||
|
||||
pp->Flags &= ~(PF_CRAWLING|PF_JUMPING|PF_FALLING|PF_LOCK_CRAWL);
|
||||
|
@ -7339,7 +7339,7 @@ void PlayerSpawnPosition(PLAYER* pp)
|
|||
pp->angle.ang = pp->angle.oang = spawn_sprite->spr.angle;
|
||||
pp->setcursector(spawn_sprite->sector());
|
||||
|
||||
getzsofslopeptr(pp->cursector, pp->pos, &cz, &fz);
|
||||
calcSlope(pp->cursector, pp->pos, &cz, &fz);
|
||||
// if too close to the floor - stand up
|
||||
if (pp->pos.Z > fz - PLAYER_HEIGHTF)
|
||||
{
|
||||
|
|
|
@ -222,7 +222,7 @@ void FAFhitscan(const DVector3& start, sectortype* sect, const DVector3& vect, H
|
|||
}
|
||||
|
||||
double loz, hiz;
|
||||
getzsofslopeptr(hit.hitSector, hit.hitpos, &hiz, &loz);
|
||||
calcSlope(hit.hitSector, hit.hitpos, &hiz, &loz);
|
||||
if (abs(hit.hitpos.Z - loz) < 4)
|
||||
{
|
||||
if (FAF_ConnectFloor(hit.hitSector) && !(hit.hitSector->floorstat & CSTAT_SECTOR_FAF_BLOCK_HITSCAN))
|
||||
|
@ -303,7 +303,7 @@ bool FAFcansee(const DVector3& start, sectortype* sects, const DVector3& end, se
|
|||
if (hit.hitWall == nullptr && hit.actor() == nullptr)
|
||||
{
|
||||
double loz, hiz;
|
||||
getzsofslopeptr(hit.hitSector, hit.hitpos.X, hit.hitpos.Y, &hiz, &loz);
|
||||
calcSlope(hit.hitSector, hit.hitpos.X, hit.hitpos.Y, &hiz, &loz);
|
||||
if (abs(hit.hitpos.Z - loz) < 4)
|
||||
{
|
||||
if (FAF_ConnectFloor(hit.hitSector))
|
||||
|
|
|
@ -917,7 +917,7 @@ void SectorExp(DSWActor* actor, sectortype* sectp, double zh)
|
|||
|
||||
// setup vars needed by SectorExp
|
||||
ChangeActorSect(actor, sectp);
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.hiz, &actor->user.loz);
|
||||
calcSlope(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.hiz, &actor->user.loz);
|
||||
|
||||
// spawn explosion
|
||||
auto exp = SpawnSectorExp(actor);
|
||||
|
|
|
@ -316,7 +316,7 @@ void MoveSpritesWithSpike(sectortype* sect)
|
|||
if ((actor->spr.extra & SPRX_STAY_PUT_VATOR))
|
||||
continue;
|
||||
|
||||
getzsofslopeptr(sect, actor->spr.pos, &cz, &fz);
|
||||
calcSlope(sect, actor->spr.pos, &cz, &fz);
|
||||
actor->spr.pos.Z = fz;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1588,7 +1588,7 @@ void SpriteSetupPost(void)
|
|||
if (jActor->hasU())
|
||||
continue;
|
||||
|
||||
getzsofslopeptr(jActor->sector(), jActor->spr.pos, &cz, &fz);
|
||||
calcSlope(jActor->sector(), jActor->spr.pos, &cz, &fz);
|
||||
if (abs(jActor->spr.pos.Z - fz) > 4)
|
||||
continue;
|
||||
|
||||
|
@ -1642,7 +1642,7 @@ void SpriteSetup(void)
|
|||
while (auto actor = it.Next())
|
||||
{
|
||||
// not used yetv
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos, &cz, &fz);
|
||||
calcSlope(actor->sector(), actor->spr.pos, &cz, &fz);
|
||||
if (actor->spr.pos.Z > ((cz + fz) * 0.5))
|
||||
{
|
||||
// closer to a floor
|
||||
|
@ -4432,7 +4432,7 @@ void getzrangepoint(const DVector3& pos, sectortype* sect,
|
|||
}
|
||||
|
||||
// Initialize z's and hits to the current sector's top&bottom
|
||||
getzsofslopeptr(sect, pos, ceil_z, flor_z);
|
||||
calcSlope(sect, pos, ceil_z, flor_z);
|
||||
ceilhit->setSector(sect);
|
||||
florhit->setSector(sect);
|
||||
|
||||
|
@ -6755,7 +6755,7 @@ Collision move_ground_missile(DSWActor* actor, const DVector2& change, double ce
|
|||
ChangeActorSect(actor, dasect);
|
||||
}
|
||||
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos, &actor->user.hiz, &actor->user.loz);
|
||||
calcSlope(actor->sector(), actor->spr.pos, &actor->user.hiz, &actor->user.loz);
|
||||
|
||||
actor->user.hi_sectp = actor->user.lo_sectp = actor->sector();
|
||||
actor->user.highActor = nullptr; actor->user.lowActor = nullptr;
|
||||
|
|
|
@ -8291,7 +8291,7 @@ bool SlopeBounce(DSWActor* actor, bool* hit_wall)
|
|||
|
||||
auto hit_sector = actor->user.coll.hitSector;
|
||||
|
||||
getzsofslopeptr(hit_sector, actor->spr.pos, &hiz, &loz);
|
||||
calcSlope(hit_sector, actor->spr.pos, &hiz, &loz);
|
||||
|
||||
// detect the ceiling and the hit_wall
|
||||
if (actor->spr.pos.Z < ((hiz + loz) * 0.5))
|
||||
|
@ -10700,7 +10700,7 @@ void SpawnExpZadjust(DSWActor* actor, DSWActor* expActor, double upper_zsize, do
|
|||
{
|
||||
double cz,fz;
|
||||
|
||||
getzsofslopeptr(expActor->sector(), expActor->spr.pos, &cz, &fz);
|
||||
calcSlope(expActor->sector(), expActor->spr.pos, &cz, &fz);
|
||||
|
||||
tos_z = expActor->spr.pos.Z - upper_zsize;
|
||||
bos_z = expActor->spr.pos.Z + lower_zsize;
|
||||
|
@ -11540,7 +11540,7 @@ int DoRing(DSWActor* actor)
|
|||
|
||||
ASSERT(actor->insector());
|
||||
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos, &cz, &fz);
|
||||
calcSlope(actor->sector(), actor->spr.pos, &cz, &fz);
|
||||
|
||||
// bound the sprite by the sectors ceiling and floor
|
||||
if (actor->spr.pos.Z > fz)
|
||||
|
@ -11678,7 +11678,7 @@ int DoSerpRing(DSWActor* actor)
|
|||
|
||||
ASSERT(actor->insector());
|
||||
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos, &cz, &fz);
|
||||
calcSlope(actor->sector(), actor->spr.pos, &cz, &fz);
|
||||
|
||||
// bound the sprite by the sectors ceiling and floor
|
||||
if (actor->spr.pos.Z > fz)
|
||||
|
|
|
@ -644,7 +644,7 @@ int SetupZilla(DSWActor* actor)
|
|||
|
||||
int NullZilla(DSWActor* actor)
|
||||
{
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos, &actor->user.hiz, &actor->user.loz);
|
||||
calcSlope(actor->sector(), actor->spr.pos, &actor->user.hiz, &actor->user.loz);
|
||||
actor->user.lo_sectp = actor->sector();
|
||||
actor->user.hi_sectp = actor->sector();
|
||||
actor->user.lowActor = nullptr;
|
||||
|
@ -731,7 +731,7 @@ int DoZillaDeathMelt(DSWActor* actor)
|
|||
}
|
||||
|
||||
//KeepActorOnFloor(actor);
|
||||
getzsofslopeptr(actor->sector(), actor->spr.pos, &actor->user.hiz, &actor->user.loz);
|
||||
calcSlope(actor->sector(), actor->spr.pos, &actor->user.hiz, &actor->user.loz);
|
||||
actor->user.lo_sectp = actor->sector();
|
||||
actor->user.hi_sectp = actor->sector();
|
||||
actor->user.lowActor = nullptr;
|
||||
|
|
Loading…
Reference in a new issue