mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 08:00:56 +00:00
- FindSector variants with vectors
This commit is contained in:
parent
f41c78d622
commit
139969d017
5 changed files with 16 additions and 8 deletions
|
@ -4564,7 +4564,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
else
|
||||
{
|
||||
assert(pSector);
|
||||
FindSector(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, &pSector);
|
||||
FindSector(actor->spr.pos, &pSector);
|
||||
}
|
||||
|
||||
actor->add_int_z(actor->vel.Z >> 8);
|
||||
|
@ -4746,7 +4746,7 @@ void MoveDude(DBloodActor* actor)
|
|||
if (pPlayer && gNoClip)
|
||||
{
|
||||
actor->add_int_pos({ actor->vel.X >> 12, actor->vel.Y >> 12, 0 });
|
||||
if (!FindSector(actor->int_pos().X, actor->int_pos().Y, &pSector))
|
||||
if (!FindSector(actor->spr.pos.XY(), &pSector))
|
||||
pSector = actor->sector();
|
||||
}
|
||||
else
|
||||
|
@ -4830,7 +4830,7 @@ void MoveDude(DBloodActor* actor)
|
|||
else
|
||||
{
|
||||
assert(pSector);
|
||||
FindSector(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, &pSector);
|
||||
FindSector(actor->spr.pos, &pSector);
|
||||
}
|
||||
|
||||
XSECTOR* pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
|
|
@ -293,7 +293,7 @@ static tspritetype* viewAddEffect(tspriteArray& tsprites, int nTSprite, VIEW_EFF
|
|||
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 });
|
||||
assert(pSector);
|
||||
FindSector(pNSprite->int_pos().X, pNSprite->int_pos().Y, pNSprite->int_pos().Z, &pSector);
|
||||
FindSector(pNSprite->pos, &pSector);
|
||||
pNSprite->sectp = pSector;
|
||||
pNSprite->ownerActor = pTSprite->ownerActor;
|
||||
pNSprite->picnum = pTSprite->picnum;
|
||||
|
|
|
@ -142,7 +142,7 @@ DBloodActor* CFX::fxSpawnActor(FX_ID nFx, sectortype* pSector, int x, int y, int
|
|||
if (pSector == nullptr)
|
||||
return nullptr;
|
||||
auto pSector2 = pSector;
|
||||
if (!FindSector(x, y, z, &pSector2))
|
||||
if (!FindSector(pos, &pSector2))
|
||||
return nullptr;
|
||||
if (adult_lockout && gGameOptions.nGameType <= 0)
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ void fxSpawnBlood(DBloodActor* actor, int)
|
|||
if (!actor->insector())
|
||||
return;
|
||||
auto pSector = actor->sector();
|
||||
if (!FindSector(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, &pSector))
|
||||
if (!FindSector(actor->spr.pos, &pSector))
|
||||
return;
|
||||
if (adult_lockout && gGameOptions.nGameType <= 0)
|
||||
return;
|
||||
|
@ -297,7 +297,7 @@ void fxSpawnPodStuff(DBloodActor* actor, int)
|
|||
if (!actor->insector())
|
||||
return;
|
||||
auto pSector = actor->sector();
|
||||
if (!FindSector(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, &pSector))
|
||||
if (!FindSector(actor->spr.pos, &pSector))
|
||||
return;
|
||||
if (adult_lockout && gGameOptions.nGameType <= 0)
|
||||
return;
|
||||
|
|
|
@ -34,6 +34,14 @@ 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 CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
|
||||
|
|
|
@ -1699,7 +1699,7 @@ void debrisMove(int listIndex)
|
|||
}
|
||||
|
||||
}
|
||||
else if (!FindSector(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, &pSector))
|
||||
else if (!FindSector(actor->spr.pos, &pSector))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue