mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- Blood: Replace use of clipmove_old()
inline wrapper with clipmove()
.
This commit is contained in:
parent
0fe5ac6a56
commit
b793bc8327
6 changed files with 27 additions and 28 deletions
|
@ -4645,7 +4645,7 @@ int MoveThing(DBloodActor* actor)
|
|||
pSprite->cstat &= ~257;
|
||||
if ((pSprite->owner >= 0) && !cl_bloodvanillaexplosions && !VanillaMode())
|
||||
enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy
|
||||
lhit = actor->hit().hit = ClipMove(&pSprite->x, &pSprite->y, &pSprite->z, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, pSprite->clipdist << 2, (pSprite->z - top) / 4, (bottom - pSprite->z) / 4, CLIPMASK0);
|
||||
lhit = actor->hit().hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, pSprite->clipdist << 2, (pSprite->z - top) / 4, (bottom - pSprite->z) / 4, CLIPMASK0);
|
||||
enginecompatibility_mode = bakCompat; // restore
|
||||
pSprite->cstat = bakCstat;
|
||||
assert(nSector >= 0);
|
||||
|
@ -4868,7 +4868,7 @@ void MoveDude(DBloodActor* actor)
|
|||
{
|
||||
short bakCstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~257;
|
||||
actor->hit().hit = ClipMove(&pSprite->x, &pSprite->y, &pSprite->z, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, wd, tz, bz, CLIPMASK0);
|
||||
actor->hit().hit = ClipMove(&pSprite->pos, &nSector, actor->xvel() >> 12, actor->yvel() >> 12, wd, tz, bz, CLIPMASK0);
|
||||
if (nSector == -1)
|
||||
{
|
||||
nSector = pSprite->sectnum;
|
||||
|
@ -5379,9 +5379,7 @@ int MoveMissile(DBloodActor* actor)
|
|||
const bool isFlameSprite = (pSprite->type == kMissileFlameSpray || pSprite->type == kMissileFlameHound); // do not use accurate clipmove for flame based sprites (changes damage too much)
|
||||
while (1)
|
||||
{
|
||||
int x = pSprite->x;
|
||||
int y = pSprite->y;
|
||||
int z = pSprite->z;
|
||||
vec3_t pos = pSprite->pos;
|
||||
int nSector2 = pSprite->sectnum;
|
||||
clipmoveboxtracenum = 1;
|
||||
const short bakSpriteCstat = pSprite->cstat;
|
||||
|
@ -5390,7 +5388,7 @@ int MoveMissile(DBloodActor* actor)
|
|||
enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy
|
||||
pSprite->cstat &= ~257; // remove self collisions for accurate clipmove
|
||||
}
|
||||
Collision clipmoveresult = ClipMove(&x, &y, &z, &nSector2, vx, vy, pSprite->clipdist << 2, (z - top) / 4, (bottom - z) / 4, CLIPMASK0);
|
||||
Collision clipmoveresult = ClipMove(&pos, &nSector2, vx, vy, pSprite->clipdist << 2, (pos.z - top) / 4, (bottom - pos.z) / 4, CLIPMASK0);
|
||||
enginecompatibility_mode = bakCompat; // restore
|
||||
pSprite->cstat = bakSpriteCstat;
|
||||
clipmoveboxtracenum = 3;
|
||||
|
@ -5412,8 +5410,8 @@ int MoveMissile(DBloodActor* actor)
|
|||
else
|
||||
{
|
||||
int32_t fz, cz;
|
||||
getzsofslope(wall[clipmoveresult.index].nextsector, x, y, &cz, &fz);
|
||||
if (z <= cz || z >= fz) cliptype = 0;
|
||||
getzsofslope(wall[clipmoveresult.index].nextsector, pos.x, pos.y, &cz, &fz);
|
||||
if (pos.z <= cz || pos.z >= fz) cliptype = 0;
|
||||
else cliptype = 4;
|
||||
}
|
||||
}
|
||||
|
@ -5440,15 +5438,15 @@ int MoveMissile(DBloodActor* actor)
|
|||
if (cliptype >= 0 && cliptype != 3)
|
||||
{
|
||||
int nAngle = getangle(actor->xvel(), actor->yvel());
|
||||
x -= MulScale(Cos(nAngle), 16, 30);
|
||||
y -= MulScale(Sin(nAngle), 16, 30);
|
||||
pos.x -= MulScale(Cos(nAngle), 16, 30);
|
||||
pos.y -= MulScale(Sin(nAngle), 16, 30);
|
||||
int nVel = approxDist(actor->xvel(), actor->yvel());
|
||||
vz -= scale(0x100, actor->zvel(), nVel);
|
||||
updatesector(x, y, &nSector);
|
||||
updatesector(pos.x, pos.y, &nSector);
|
||||
nSector2 = nSector;
|
||||
}
|
||||
int ceilZ, ceilHit, floorZ, floorHit;
|
||||
GetZRangeAtXYZ(x, y, z, nSector2, &ceilZ, &ceilHit, &floorZ, &floorHit, pSprite->clipdist << 2, CLIPMASK0);
|
||||
GetZRangeAtXYZ(pos.x, pos.y, pos.z, nSector2, &ceilZ, &ceilHit, &floorZ, &floorHit, pSprite->clipdist << 2, CLIPMASK0);
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
top += vz;
|
||||
bottom += vz;
|
||||
|
@ -5464,10 +5462,9 @@ int MoveMissile(DBloodActor* actor)
|
|||
vz += ClipLow(ceilZ - top, 0);
|
||||
cliptype = 1;
|
||||
}
|
||||
pSprite->x = x;
|
||||
pSprite->y = y;
|
||||
pSprite->z = z + vz;
|
||||
updatesector(x, y, &nSector);
|
||||
pSprite->pos = pos;
|
||||
pSprite->z += vz;
|
||||
updatesector(pos.x, pos.y, &nSector);
|
||||
if (nSector >= 0 && nSector != pSprite->sectnum)
|
||||
{
|
||||
assert(nSector >= 0 && nSector < kMaxSectors);
|
||||
|
|
|
@ -730,16 +730,14 @@ int GetDistToLine(int x1, int y1, int x2, int y2, int x3, int y3)
|
|||
return approxDist(t1-x1, t2-y1);
|
||||
}
|
||||
|
||||
unsigned int ClipMove(int *x, int *y, int *z, int *nSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask)
|
||||
unsigned int ClipMove(vec3_t *pos, int *nSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask)
|
||||
{
|
||||
int bakX = *x;
|
||||
int bakY = *y;
|
||||
int bakZ = *z;
|
||||
auto opos = *pos;
|
||||
short bakSect = *nSector;
|
||||
unsigned int nRes = clipmove_old((int32_t*)x, (int32_t*)y, (int32_t*)z, &bakSect, xv<<14, yv<<14, wd, cd, fd, nMask);
|
||||
unsigned int nRes = clipmove(pos, &bakSect, xv<<14, yv<<14, wd, cd, fd, nMask);
|
||||
if (bakSect == -1)
|
||||
{
|
||||
*x = bakX; *y = bakY; *z = bakZ;
|
||||
*pos = opos;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ int VectorScan(spritetype *pSprite, int nOffset, int nZOffset, int dx, int dy, i
|
|||
void GetZRange(spritetype *pSprite, int *ceilZ, int *ceilHit, int *floorZ, int *floorHit, int nDist, unsigned int nMask, unsigned int nClipParallax = 0);
|
||||
void GetZRangeAtXYZ(int x, int y, int z, int nSector, int *ceilZ, int *ceilHit, int *floorZ, int *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(int *x, int *y, int *z, int *nSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask);
|
||||
unsigned int ClipMove(vec3_t* pos, int *nSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask);
|
||||
int GetClosestSectors(int nSector, int x, int y, int nDist, short *pSectors, char *pSectBit);
|
||||
int GetClosestSpriteSectors(int nSector, int x, int y, int nDist, uint8_t *pSectBit, short *pWalls = nullptr, bool newSectCheckMethod = false);
|
||||
int picWidth(short nPic, short repeat);
|
||||
|
|
|
@ -1592,7 +1592,7 @@ void debrisMove(int listIndex)
|
|||
short oldcstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||
|
||||
moveHit = gSpriteHit[nXSprite].hit = ClipMove((int*)&pSprite->x, (int*)&pSprite->y, (int*)&pSprite->z, &nSector, xvel[nSprite] >> 12,
|
||||
moveHit = gSpriteHit[nXSprite].hit = ClipMove(&pSprite->pos, &nSector, xvel[nSprite] >> 12,
|
||||
yvel[nSprite] >> 12, clipDist, ceilDist, floorDist, CLIPMASK0);
|
||||
|
||||
pSprite->cstat = oldcstat;
|
||||
|
|
|
@ -383,7 +383,7 @@ static void fakeMoveDude(spritetype *pSprite)
|
|||
{
|
||||
short bakCstat = pSprite->cstat;
|
||||
pSprite->cstat &= ~257;
|
||||
predict.at75.hit = ClipMove(&predict.x, &predict.y, &predict.z, &nSector, predict.xvel >> 12, predict.yvel >> 12, wd, tz, bz, CLIPMASK0);
|
||||
predict.at75.hit = ClipMove(&predict.pos, &nSector, predict.xvel >> 12, predict.yvel >> 12, wd, tz, bz, CLIPMASK0);
|
||||
if (nSector == -1)
|
||||
nSector = predict.sectnum;
|
||||
|
||||
|
|
|
@ -51,9 +51,13 @@ struct VIEW {
|
|||
int at44;
|
||||
int at48; // posture
|
||||
double spin; // spin
|
||||
int x; // x
|
||||
int y; // y
|
||||
int z; // z
|
||||
union {
|
||||
struct
|
||||
{
|
||||
int32_t x, y, z;
|
||||
};
|
||||
vec3_t pos;
|
||||
};
|
||||
int xvel; //xvel
|
||||
int yvel; //yvel
|
||||
int zvel; //zvel
|
||||
|
|
Loading…
Reference in a new issue