mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- debrisMove + getting rid of the index based ClipMove variant.
This commit is contained in:
parent
94671c5b05
commit
a34e89c8b7
3 changed files with 22 additions and 39 deletions
|
@ -696,22 +696,6 @@ int GetDistToLine(int x1, int y1, int x2, int y2, int x3, int y3)
|
|||
return approxDist(t1-x1, t2-y1);
|
||||
}
|
||||
|
||||
unsigned int ClipMove(vec3_t *pos, int *nSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask, int tracecount)
|
||||
{
|
||||
auto opos = *pos;
|
||||
int bakSect = *nSector;
|
||||
unsigned int nRes = clipmove(pos, &bakSect, xv<<14, yv<<14, wd, cd, fd, nMask, tracecount);
|
||||
if (bakSect == -1)
|
||||
{
|
||||
*pos = opos;
|
||||
}
|
||||
else
|
||||
{
|
||||
*nSector = bakSect;
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
|
||||
unsigned int ClipMove(vec3_t* pos, sectortype** pSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask, int tracecount)
|
||||
{
|
||||
auto opos = *pos;
|
||||
|
|
|
@ -79,7 +79,6 @@ int VectorScan(DBloodActor *pSprite, int nOffset, int nZOffset, int dx, int dy,
|
|||
void GetZRange(DBloodActor *pSprite, int *ceilZ, Collision *ceilHit, int *floorZ, Collision *floorHit, int nDist, unsigned int nMask, unsigned int nClipParallax = 0);
|
||||
void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int *ceilZ, Collision *ceilHit, int *floorZ, Collision *floorHit, int nDist, unsigned int nMask, unsigned int nClipParallax = 0);
|
||||
int GetDistToLine(int x1, int y1, int x2, int y2, int x3, int y3);
|
||||
[[deprecated]] unsigned int ClipMove(vec3_t* pos, int *nSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask, int tracecount = 3);
|
||||
unsigned int ClipMove(vec3_t* pos, sectortype** pSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask, int tracecount = 3);
|
||||
BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod = false);
|
||||
int picWidth(int nPic, int repeat);
|
||||
|
|
|
@ -1672,9 +1672,9 @@ void debrisMove(int listIndex)
|
|||
auto actor = gPhysSpritesList[listIndex];
|
||||
XSPRITE* pXSprite = &actor->x();
|
||||
spritetype* pSprite = &actor->s();
|
||||
int nSector = pSprite->sectnum;
|
||||
auto pSector = pSprite->sector();
|
||||
|
||||
if (!actor->hasX() || !validSectorIndex(pSprite->sectnum))
|
||||
if (!actor->hasX() || !pSector)
|
||||
{
|
||||
gPhysSpritesList[listIndex] = nullptr;
|
||||
return;
|
||||
|
@ -1692,7 +1692,7 @@ void debrisMove(int listIndex)
|
|||
|
||||
bool uwater = false;
|
||||
int tmpFraction = actor->spriteMass.fraction;
|
||||
if (sector[nSector].hasX() && sector[nSector].xs().Underwater)
|
||||
if (pSector->hasX() && pSector->xs().Underwater)
|
||||
{
|
||||
tmpFraction >>= 1;
|
||||
uwater = true;
|
||||
|
@ -1704,21 +1704,21 @@ void debrisMove(int listIndex)
|
|||
auto oldcstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
|
||||
moveHit = actor->hit.hit = ClipMove(&pSprite->pos, &nSector, actor->xvel >> 12,
|
||||
moveHit = actor->hit.hit = ClipMove(&pSprite->pos, &pSector, actor->xvel >> 12,
|
||||
actor->yvel >> 12, clipDist, ceilDist, floorDist, CLIPMASK0);
|
||||
|
||||
pSprite->cstat = oldcstat;
|
||||
if (pSprite->sectnum != nSector)
|
||||
if (pSprite->sector() != pSector)
|
||||
{
|
||||
if (!validSectorIndex(nSector)) return;
|
||||
else ChangeActorSect(actor, nSector);
|
||||
if (!pSector) return;
|
||||
else ChangeActorSect(actor, pSector);
|
||||
}
|
||||
|
||||
if (sector[nSector].type >= kSectorPath && sector[nSector].type <= kSectorRotate)
|
||||
if (pSector->type >= kSectorPath && pSector->type <= kSectorRotate)
|
||||
{
|
||||
int nSector2 = nSector;
|
||||
if (pushmove(&pSprite->pos, &nSector2, clipDist, ceilDist, floorDist, CLIPMASK0) != -1)
|
||||
nSector = nSector2;
|
||||
auto pSector2 = pSector;
|
||||
if (pushmove(&pSprite->pos, &pSector2, clipDist, ceilDist, floorDist, CLIPMASK0) != -1)
|
||||
pSector = pSector2;
|
||||
}
|
||||
|
||||
if (actor->hit.hit.type == kHitWall)
|
||||
|
@ -1728,20 +1728,20 @@ void debrisMove(int listIndex)
|
|||
}
|
||||
|
||||
}
|
||||
else if (!FindSector(pSprite->x, pSprite->y, pSprite->z, &nSector))
|
||||
else if (!FindSector(pSprite->x, pSprite->y, pSprite->z, &pSector))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (pSprite->sectnum != nSector)
|
||||
if (pSprite->sector() != pSector)
|
||||
{
|
||||
assert(validSectorIndex(nSector));
|
||||
ChangeActorSect(actor, nSector);
|
||||
nSector = pSprite->sectnum;
|
||||
}
|
||||
assert(pSector);
|
||||
ChangeActorSect(actor, pSector);
|
||||
pSector = pSprite->sector();
|
||||
}
|
||||
|
||||
if (sector[nSector].hasX())
|
||||
uwater = sector[nSector].xs().Underwater;
|
||||
if (pSector->hasX())
|
||||
uwater = pSector->xs().Underwater;
|
||||
|
||||
if (actor->zvel)
|
||||
pSprite->z += actor->zvel >> 8;
|
||||
|
@ -1754,11 +1754,11 @@ void debrisMove(int listIndex)
|
|||
if ((pXSprite->physAttr & kPhysDebrisSwim) && uwater)
|
||||
{
|
||||
int vc = 0;
|
||||
int cz = getceilzofslope(nSector, pSprite->x, pSprite->y);
|
||||
int fz = getflorzofslope(nSector, pSprite->x, pSprite->y);
|
||||
int cz = getceilzofslopeptr(pSector, pSprite->x, pSprite->y);
|
||||
int fz = getflorzofslopeptr(pSector, pSprite->x, pSprite->y);
|
||||
int div = ClipLow(bottom - top, 1);
|
||||
|
||||
if (getLowerLink(nSector)) cz += (cz < 0) ? 0x500 : -0x500;
|
||||
if (pSector->lowerLink) cz += (cz < 0) ? 0x500 : -0x500;
|
||||
if (top > cz && (!(pXSprite->physAttr & kPhysDebrisFloat) || fz <= bottom << 2))
|
||||
actor->zvel -= DivScale((bottom - ceilZ) >> 6, mass, 8);
|
||||
|
||||
|
|
Loading…
Reference in a new issue