mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-22 19:41:20 +00:00
- use engine's updatesector in Blood instead of the limited homegrown FindSector variant.
This commit is contained in:
parent
72187a7f3b
commit
db0ce36143
7 changed files with 24 additions and 107 deletions
|
@ -4564,7 +4564,9 @@ static Collision MoveThing(DBloodActor* actor)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(pSector);
|
assert(pSector);
|
||||||
FindSector(actor->spr.pos, &pSector);
|
auto pSector2 = pSector;
|
||||||
|
updatesectorz(actor->spr.pos, &pSector2);
|
||||||
|
if (pSector2) pSector = pSector2;
|
||||||
}
|
}
|
||||||
|
|
||||||
actor->add_int_z(actor->vel.Z >> 8);
|
actor->add_int_z(actor->vel.Z >> 8);
|
||||||
|
@ -4746,8 +4748,8 @@ void MoveDude(DBloodActor* actor)
|
||||||
if (pPlayer && gNoClip)
|
if (pPlayer && gNoClip)
|
||||||
{
|
{
|
||||||
actor->add_int_pos({ actor->vel.X >> 12, actor->vel.Y >> 12, 0 });
|
actor->add_int_pos({ actor->vel.X >> 12, actor->vel.Y >> 12, 0 });
|
||||||
if (!FindSector(actor->spr.pos.XY(), &pSector))
|
updatesector(actor->spr.pos, &pSector);
|
||||||
pSector = actor->sector();
|
if (!pSector) pSector = actor->sector();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4830,7 +4832,9 @@ void MoveDude(DBloodActor* actor)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(pSector);
|
assert(pSector);
|
||||||
FindSector(actor->spr.pos, &pSector);
|
auto pSector2 = pSector;
|
||||||
|
updatesectorz(actor->spr.pos, &pSector2);
|
||||||
|
if (pSector2) pSector = pSector2;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSECTOR* pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
XSECTOR* pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||||
|
|
|
@ -146,8 +146,8 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange)
|
||||||
y += MulScale(nRange, Sin(nAngle), 30);
|
y += MulScale(nRange, Sin(nAngle), 30);
|
||||||
auto pSector = actor->sector();
|
auto pSector = actor->sector();
|
||||||
assert(pSector);
|
assert(pSector);
|
||||||
if (!FindSector(x, y, z, &pSector))
|
updatesectorz(x, y, z, &pSector);
|
||||||
return false;
|
if (!pSector) return false;
|
||||||
int floorZ = getflorzofslopeptr(pSector, x, y);
|
int floorZ = getflorzofslopeptr(pSector, x, y);
|
||||||
auto pXSector = pSector->hasX()? &pSector->xs() : nullptr;
|
auto pXSector = pSector->hasX()? &pSector->xs() : nullptr;
|
||||||
bool Underwater = 0;
|
bool Underwater = 0;
|
||||||
|
|
|
@ -293,7 +293,9 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
|
||||||
int y = MulScale(nLen, Sin(nAng), 30);
|
int y = MulScale(nLen, Sin(nAng), 30);
|
||||||
pNSprite->set_int_pos({ pTSprite->int_pos().X + x, pTSprite->int_pos().Y + y, pTSprite->int_pos().Z });
|
pNSprite->set_int_pos({ pTSprite->int_pos().X + x, pTSprite->int_pos().Y + y, pTSprite->int_pos().Z });
|
||||||
assert(pSector);
|
assert(pSector);
|
||||||
FindSector(pNSprite->pos, &pSector);
|
auto pSector2 = pSector;
|
||||||
|
updatesectorz(pNSprite->pos, &pSector2);
|
||||||
|
if (pSector2) pSector = pSector2;
|
||||||
pNSprite->sectp = pSector;
|
pNSprite->sectp = pSector;
|
||||||
pNSprite->ownerActor = pTSprite->ownerActor;
|
pNSprite->ownerActor = pTSprite->ownerActor;
|
||||||
pNSprite->picnum = pTSprite->picnum;
|
pNSprite->picnum = pTSprite->picnum;
|
||||||
|
|
|
@ -146,8 +146,8 @@ DBloodActor* CFX::fxSpawnActor(FX_ID nFx, sectortype* pSector, const DVector3& p
|
||||||
if (pSector == nullptr)
|
if (pSector == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
auto pSector2 = pSector;
|
auto pSector2 = pSector;
|
||||||
if (!FindSector(pos, &pSector2))
|
updatesectorz(pos, &pSector2);
|
||||||
return nullptr;
|
if (!pSector2) return nullptr;
|
||||||
if (adult_lockout && gGameOptions.nGameType <= 0)
|
if (adult_lockout && gGameOptions.nGameType <= 0)
|
||||||
{
|
{
|
||||||
switch (nFx)
|
switch (nFx)
|
||||||
|
@ -275,8 +275,8 @@ void fxSpawnBlood(DBloodActor* actor, int)
|
||||||
if (!actor->insector())
|
if (!actor->insector())
|
||||||
return;
|
return;
|
||||||
auto pSector = actor->sector();
|
auto pSector = actor->sector();
|
||||||
if (!FindSector(actor->spr.pos, &pSector))
|
updatesectorz(actor->spr.pos, &pSector);
|
||||||
return;
|
if (!pSector) return;
|
||||||
if (adult_lockout && gGameOptions.nGameType <= 0)
|
if (adult_lockout && gGameOptions.nGameType <= 0)
|
||||||
return;
|
return;
|
||||||
auto bloodactor = gFX.fxSpawnActor(FX_27, actor->sector(), actor->spr.pos, 0);
|
auto bloodactor = gFX.fxSpawnActor(FX_27, actor->sector(), actor->spr.pos, 0);
|
||||||
|
@ -301,8 +301,8 @@ void fxSpawnPodStuff(DBloodActor* actor, int)
|
||||||
if (!actor->insector())
|
if (!actor->insector())
|
||||||
return;
|
return;
|
||||||
auto pSector = actor->sector();
|
auto pSector = actor->sector();
|
||||||
if (!FindSector(actor->spr.pos, &pSector))
|
updatesectorz(actor->spr.pos, &pSector);
|
||||||
return;
|
if (!pSector) return;
|
||||||
if (adult_lockout && gGameOptions.nGameType <= 0)
|
if (adult_lockout && gGameOptions.nGameType <= 0)
|
||||||
return;
|
return;
|
||||||
DBloodActor* spawnactor;
|
DBloodActor* spawnactor;
|
||||||
|
|
|
@ -41,85 +41,6 @@ HitInfo gHitInfo;
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool FindSector(int nX, int nY, int nZ, sectortype** pSector)
|
|
||||||
{
|
|
||||||
int32_t nZFloor, nZCeil;
|
|
||||||
assert(pSector);
|
|
||||||
if (inside(nX, nY, *pSector))
|
|
||||||
{
|
|
||||||
getzsofslopeptr(*pSector, nX, nY, &nZCeil, &nZFloor);
|
|
||||||
if (nZ >= nZCeil && nZ <= nZFloor)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (auto& wal : wallsofsector(*pSector))
|
|
||||||
{
|
|
||||||
auto pOSector = wal.nextSector();
|
|
||||||
if (pOSector != nullptr && inside(nX, nY, pOSector))
|
|
||||||
{
|
|
||||||
getzsofslopeptr(pOSector, nX, nY, &nZCeil, &nZFloor);
|
|
||||||
if (nZ >= nZCeil && nZ <= nZFloor)
|
|
||||||
{
|
|
||||||
*pSector = pOSector;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (auto& sec : sector)
|
|
||||||
{
|
|
||||||
if (inside(nX, nY, &sec))
|
|
||||||
{
|
|
||||||
getzsofslopeptr(&sec, nX, nY, &nZCeil, &nZFloor);
|
|
||||||
if (nZ >= nZCeil && nZ <= nZFloor)
|
|
||||||
{
|
|
||||||
*pSector = &sec;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool FindSector(int nX, int nY, sectortype** pSector)
|
|
||||||
{
|
|
||||||
assert(*pSector);
|
|
||||||
if (inside(nX, nY, *pSector))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
for (auto& wal : wallsofsector(*pSector))
|
|
||||||
{
|
|
||||||
auto pOSector = wal.nextSector();
|
|
||||||
if (pOSector != nullptr && inside(nX, nY, pOSector))
|
|
||||||
{
|
|
||||||
*pSector = pOSector;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (auto& sec : sector)
|
|
||||||
{
|
|
||||||
if (inside(nX, nY, &sec))
|
|
||||||
{
|
|
||||||
*pSector = &sec;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool CheckProximity(DBloodActor* actor, const DVector3& pos, sectortype* pSector, int nDist)
|
bool CheckProximity(DBloodActor* actor, const DVector3& pos, sectortype* pSector, int nDist)
|
||||||
{
|
{
|
||||||
assert(actor != nullptr);
|
assert(actor != nullptr);
|
||||||
|
|
|
@ -32,17 +32,6 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool FindSector(int nX, int nY, int nZ, sectortype** ppSector);
|
|
||||||
bool FindSector(int nX, int nY, sectortype** ppSector);
|
|
||||||
inline bool FindSector(const DVector3& pos, sectortype** ppSector)
|
|
||||||
{
|
|
||||||
return FindSector(int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint), ppSector);
|
|
||||||
}
|
|
||||||
inline bool FindSector(const DVector2& pos, sectortype** ppSector)
|
|
||||||
{
|
|
||||||
return FindSector(int(pos.X * worldtoint), int(pos.Y * worldtoint), ppSector);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CheckProximity(DBloodActor* pSprite, const DVector3& pos, sectortype* pSector, int nDist);
|
bool CheckProximity(DBloodActor* pSprite, const DVector3& pos, sectortype* pSector, int nDist);
|
||||||
bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
|
bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
|
||||||
bool CheckProximityWall(walltype* pWall, int x, int y, int nDist);
|
bool CheckProximityWall(walltype* pWall, int x, int y, int nDist);
|
||||||
|
|
|
@ -1698,9 +1698,10 @@ void debrisMove(int listIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!FindSector(actor->spr.pos, &pSector))
|
else
|
||||||
{
|
{
|
||||||
return;
|
updatesectorz(actor->spr.pos, &pSector);
|
||||||
|
if (!pSector) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actor->sector() != pSector)
|
if (actor->sector() != pSector)
|
||||||
|
@ -7708,8 +7709,8 @@ bool nnExtCanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRang
|
||||||
|
|
||||||
x += MulScale(nRange, Cos(nAngle), 30);
|
x += MulScale(nRange, Cos(nAngle), 30);
|
||||||
y += MulScale(nRange, Sin(nAngle), 30);
|
y += MulScale(nRange, Sin(nAngle), 30);
|
||||||
if (!FindSector(x, y, z, &pSector))
|
updatesectorz(x, y, z, &pSector);
|
||||||
return false;
|
if (!pSector) return false;
|
||||||
|
|
||||||
if (pSector->hasX()) {
|
if (pSector->hasX()) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue