- GetZRange

This commit is contained in:
Christoph Oelckers 2021-09-04 20:19:38 +02:00
parent 626deed960
commit 7a2c661ff9
7 changed files with 19 additions and 15 deletions

View file

@ -4682,7 +4682,7 @@ static Collision MoveThing(DBloodActor* actor)
int ceilZ, floorZ;
Collision ceilColl, floorColl;
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0);
GetActorExtents(actor, &top, &bottom);
if ((pSprite->flags & 2) && bottom < floorZ)
@ -4709,7 +4709,7 @@ static Collision MoveThing(DBloodActor* actor)
}
}
}
if (CheckLink(actor)) GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0);
if (CheckLink(actor)) GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0);
GetActorExtents(actor, &top, &bottom);
if (bottom >= floorZ)
@ -4993,7 +4993,7 @@ void MoveDude(DBloodActor* actor)
int ceilZ, floorZ;
Collision ceilColl, floorColl;
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, wd, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, wd, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
GetActorExtents(actor, &top, &bottom);
if (pSprite->flags & 2)
@ -5042,7 +5042,7 @@ void MoveDude(DBloodActor* actor)
int nLink = CheckLink(actor);
if (nLink)
{
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, wd, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, wd, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
if (pPlayer)
playerCorrectInertia(pPlayer, &oldpos);
switch (nLink)
@ -5206,7 +5206,7 @@ void MoveDude(DBloodActor* actor)
{
int floorZ2 = floorZ;
auto floorColl2 = floorColl;
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
if (bottom <= floorZ && pSprite->z - floorZ2 < bz)
{
floorZ = floorZ2;

View file

@ -391,7 +391,7 @@ void fxBloodBits(DBloodActor* actor, int) // 14
spritetype *pSprite = &actor->s();
int ceilZ, floorZ;
Collision floorColl, ceilColl;
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0);
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ-bottom;
@ -440,7 +440,7 @@ void fxBouncingSleeve(DBloodActor* actor, int) // 16
int ceilZ, floorZ;
Collision floorColl, ceilColl;
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0);
int top, bottom; GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ - bottom;
@ -548,7 +548,7 @@ void fxPodBloodSplat(DBloodActor* actor, int) // 19
int ceilZ, floorZ;
Collision floorColl, ceilColl;
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist, CLIPMASK0);
int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom);
pSprite->z += floorZ-bottom;

View file

@ -621,10 +621,12 @@ int VectorScan(DBloodActor *actor, int nOffset, int nZOffset, int dx, int dy, in
return -1;
}
void GetZRange(spritetype *pSprite, int *ceilZ, Collision *ceilColl, int *floorZ, Collision *floorColl, int nDist, unsigned int nMask, unsigned int nClipParallax)
void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ, Collision *floorColl, int nDist, unsigned int nMask, unsigned int nClipParallax)
{
assert(actor != NULL);
auto pSprite = &actor->s();
int floorHit, ceilHit;
assert(pSprite != NULL);
int bakCstat = pSprite->cstat;
int32_t nTemp1, nTemp2;
pSprite->cstat &= ~257;

View file

@ -83,7 +83,7 @@ void GetWallNormal(int nWall, int *pX, int *pY);
bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int x2, int y2, int z2, int *ix, int *iy, int *iz);
int HitScan(DBloodActor *pSprite, int z, int dx, int dy, int dz, unsigned int nMask, int a8);
int VectorScan(DBloodActor *pSprite, int nOffset, int nZOffset, int dx, int dy, int dz, int nRange, int ac);
void GetZRange(spritetype *pSprite, int *ceilZ, Collision *ceilHit, int *floorZ, Collision *floorHit, int nDist, unsigned int nMask, unsigned int nClipParallax = 0);
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, int nSector, 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);
unsigned int ClipMove(vec3_t* pos, int *nSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask, int tracecount = 3);

View file

@ -1812,7 +1812,7 @@ void debrisMove(int listIndex)
int ceilZ, floorZ;
Collision ceilColl, floorColl;
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, clipDist, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, clipDist, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
GetSpriteExtents(pSprite, &top, &bottom);
if ((pXSprite->physAttr & kPhysDebrisSwim) && uwater)
@ -1845,7 +1845,7 @@ void debrisMove(int listIndex)
if ((i = CheckLink(actor)) != 0)
{
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, clipDist, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
GetZRange(actor, &ceilZ, &ceilColl, &floorZ, &floorColl, clipDist, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
if (!(pSprite->cstat & CSTAT_SPRITE_INVISIBLE))
{
switch (i)

View file

@ -357,6 +357,7 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
static void fakeMoveDude(spritetype *pSprite)
{
#if 0 // not needed for single player, temporarily disabled due to icompatibilities with the refactored API.
PLAYER *pPlayer = NULL;
int bottom, top;
if (IsPlayerSprite(pSprite))
@ -566,6 +567,7 @@ static void fakeMoveDude(spritetype *pSprite)
if (approxDist(predict.xvel, predict.yvel) < 0x1000)
predict.xvel = predict.yvel = 0;
}
#endif
}
static void fakeActAirDrag(spritetype *, int num)

View file

@ -692,7 +692,7 @@ void viewDrawScreen(bool sceneonly)
int nClipDist = gView->pSprite->clipdist << 2;
int vec, vf4;
Collision c1, c2;
GetZRange(gView->pSprite, &vf4, &c1, &vec, &c2, nClipDist, 0);
GetZRange(gView->actor(), &vf4, &c1, &vec, &c2, nClipDist, 0);
if (sceneonly) return;
#if 0
int tmpSect = nSectnum;
@ -782,7 +782,7 @@ bool GameInterface::DrawAutomapPlayer(int x, int y, int z, int a, double const s
int nTile = pSprite->picnum;
int ceilZ, floorZ;
Collision ceilHit, floorHit;
GetZRange(pSprite, &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
GetZRange(gView->actor(), &ceilZ, &ceilHit, &floorZ, &floorHit, (pSprite->clipdist << 2) + 16, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
int nTop, nBottom;
GetSpriteExtents(pSprite, &nTop, &nBottom);
int nScale = (pSprite->yrepeat + ((floorZ - nBottom) >> 8)) * z;