mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-11 19:51:01 +00:00
- FindSector.
This commit is contained in:
parent
b8953849ee
commit
9017fee74f
3 changed files with 23 additions and 40 deletions
|
@ -35,19 +35,19 @@ BEGIN_BLD_NS
|
||||||
|
|
||||||
HITINFO gHitInfo;
|
HITINFO gHitInfo;
|
||||||
|
|
||||||
bool FindSector(int nX, int nY, int nZ, int *nSector)
|
bool FindSector(int nX, int nY, int nZ, sectortype** pSector)
|
||||||
{
|
{
|
||||||
int32_t nZFloor, nZCeil;
|
int32_t nZFloor, nZCeil;
|
||||||
assert(validSectorIndex(*nSector));
|
assert(pSector);
|
||||||
if (inside(nX, nY, *nSector))
|
if (inside(nX, nY, *pSector))
|
||||||
{
|
{
|
||||||
getzsofslope(*nSector, nX, nY, &nZCeil, &nZFloor);
|
getzsofslopeptr(*pSector, nX, nY, &nZCeil, &nZFloor);
|
||||||
if (nZ >= nZCeil && nZ <= nZFloor)
|
if (nZ >= nZCeil && nZ <= nZFloor)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto& wal : wallsofsector(*nSector))
|
for (auto& wal : wallsofsector(*pSector))
|
||||||
{
|
{
|
||||||
auto pOSector = wal.nextSector();
|
auto pOSector = wal.nextSector();
|
||||||
if (pOSector != nullptr && inside(nX, nY, pOSector))
|
if (pOSector != nullptr && inside(nX, nY, pOSector))
|
||||||
|
@ -55,19 +55,19 @@ bool FindSector(int nX, int nY, int nZ, int *nSector)
|
||||||
getzsofslopeptr(pOSector, nX, nY, &nZCeil, &nZFloor);
|
getzsofslopeptr(pOSector, nX, nY, &nZCeil, &nZFloor);
|
||||||
if (nZ >= nZCeil && nZ <= nZFloor)
|
if (nZ >= nZCeil && nZ <= nZFloor)
|
||||||
{
|
{
|
||||||
*nSector = sectnum(pOSector);
|
*pSector = pOSector;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < numsectors; i++)
|
for(auto& sec : sectors())
|
||||||
{
|
{
|
||||||
if (inside(nX, nY, i))
|
if (inside(nX, nY, &sec))
|
||||||
{
|
{
|
||||||
getzsofslope(i, nX, nY, &nZCeil, &nZFloor);
|
getzsofslopeptr(&sec, nX, nY, &nZCeil, &nZFloor);
|
||||||
if (nZ >= nZCeil && nZ <= nZFloor)
|
if (nZ >= nZCeil && nZ <= nZFloor)
|
||||||
{
|
{
|
||||||
*nSector = i;
|
*pSector = &sec;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,27 +75,27 @@ bool FindSector(int nX, int nY, int nZ, int *nSector)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FindSector(int nX, int nY, int *nSector)
|
bool FindSector(int nX, int nY, sectortype** pSector)
|
||||||
{
|
{
|
||||||
assert(validSectorIndex(*nSector));
|
assert(*pSector);
|
||||||
if (inside(nX, nY, *nSector))
|
if (inside(nX, nY, *pSector))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (auto& wal : wallsofsector(*nSector))
|
for (auto& wal : wallsofsector(*pSector))
|
||||||
{
|
{
|
||||||
auto pOSector = wal.nextSector();
|
auto pOSector = wal.nextSector();
|
||||||
if (pOSector != nullptr && inside(nX, nY, pOSector))
|
if (pOSector != nullptr && inside(nX, nY, pOSector))
|
||||||
{
|
{
|
||||||
*nSector = sectnum(pOSector);
|
*pSector = pOSector;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < numsectors; i++)
|
for (auto& sec : sectors())
|
||||||
{
|
{
|
||||||
if (inside(nX, nY, i))
|
if (inside(nX, nY, &sec))
|
||||||
{
|
{
|
||||||
*nSector = i;
|
*pSector = &sec;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,27 +52,8 @@ enum {
|
||||||
|
|
||||||
|
|
||||||
struct Collision;
|
struct Collision;
|
||||||
bool FindSector(int nX, int nY, int nZ, int *nSector);
|
bool FindSector(int nX, int nY, int nZ, sectortype** ppSector);
|
||||||
inline bool FindSector(int nX, int nY, int nZ, sectortype** ppSector)
|
bool FindSector(int nX, int nY, sectortype** ppSector);
|
||||||
{
|
|
||||||
int n = sectnum(*ppSector);
|
|
||||||
bool res = FindSector(nX, nY, nZ, &n);
|
|
||||||
*ppSector = §or[n];
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
bool FindSector(int nX, int nY, int *nSector);
|
|
||||||
inline bool FindSector(int nX, int nY, sectortype** ppSector)
|
|
||||||
{
|
|
||||||
int n = sectnum(*ppSector);
|
|
||||||
bool res = FindSector(nX, nY, &n);
|
|
||||||
*ppSector = §or[n];
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[deprecated]]
|
|
||||||
bool FindSector(int nX, int nY, int nZ, int* nSector);
|
|
||||||
[[deprecated]]
|
|
||||||
bool FindSector(int nX, int nY, int* nSector);
|
|
||||||
|
|
||||||
bool CheckProximity(DBloodActor *pSprite, int nX, int nY, int nZ, sectortype* pSector, int nDist);
|
bool CheckProximity(DBloodActor *pSprite, int nX, int nY, int nZ, 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);
|
||||||
|
|
|
@ -163,7 +163,8 @@ void viewInit(void)
|
||||||
int othercameradist = 1280;
|
int othercameradist = 1280;
|
||||||
int othercameraclock;
|
int othercameraclock;
|
||||||
|
|
||||||
void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsectnum, int nAng, fixed_t zm, int smoothratio)
|
#if 0
|
||||||
|
void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, sectortype** vsectnum, int nAng, fixed_t zm, int smoothratio) // currently unused
|
||||||
{
|
{
|
||||||
int vX = MulScale(-Cos(nAng), 1280, 30);
|
int vX = MulScale(-Cos(nAng), 1280, 30);
|
||||||
int vY = MulScale(-Sin(nAng), 1280, 30);
|
int vY = MulScale(-Sin(nAng), 1280, 30);
|
||||||
|
@ -208,6 +209,7 @@ void CalcOtherPosition(spritetype *pSprite, int *pX, int *pY, int *pZ, int *vsec
|
||||||
FindSector(*pX, *pY, *pZ, vsectnum);
|
FindSector(*pX, *pY, *pZ, vsectnum);
|
||||||
pSprite->cstat = bakCstat;
|
pSprite->cstat = bakCstat;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// by NoOne: show warning msgs in game instead of throwing errors (in some cases)
|
// by NoOne: show warning msgs in game instead of throwing errors (in some cases)
|
||||||
void viewSetSystemMessage(const char* pMessage, ...) {
|
void viewSetSystemMessage(const char* pMessage, ...) {
|
||||||
|
|
Loading…
Reference in a new issue