mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- made clipmoveboxtracenum a function argument of clipmove
There’e zero need for hackery here.
This commit is contained in:
parent
0ffe52791e
commit
762ebafc2a
8 changed files with 13 additions and 35 deletions
|
@ -29,10 +29,9 @@ inline int clipinsidebox(int x, int y, int wall, int dist)
|
|||
}
|
||||
int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist);
|
||||
|
||||
extern int32_t clipmoveboxtracenum;
|
||||
|
||||
int32_t clipmove(vec3_t *const pos, int *const sectnum, int32_t xvect, int32_t yvect, int32_t const walldist, int32_t const ceildist,
|
||||
int32_t const flordist, uint32_t const cliptype) ATTRIBUTE((nonnull(1, 2)));
|
||||
int32_t const flordist, uint32_t const cliptype, int clipmoveboxtracenum = 3) ATTRIBUTE((nonnull(1, 2)));
|
||||
|
||||
int pushmove(vec3_t *const vect, int *const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
|
||||
uint32_t const cliptype, bool clear = true) ATTRIBUTE((nonnull(1, 2)));
|
||||
|
|
|
@ -101,8 +101,6 @@ static inline void get_floorspr_points(T const * const spr, int32_t px, int32_t
|
|||
*y3 = *y2 + ofs.y, *y4 = *y1 + ofs.y;
|
||||
}
|
||||
|
||||
int32_t clipmoveboxtracenum = 3;
|
||||
|
||||
//
|
||||
// clipinsidebox
|
||||
//
|
||||
|
@ -454,7 +452,7 @@ static void clipupdatesector(vec2_t const pos, int * const sectnum, int walldist
|
|||
// clipmove
|
||||
//
|
||||
int32_t clipmove(vec3_t * const pos, int * const sectnum, int32_t xvect, int32_t yvect,
|
||||
int32_t const walldist, int32_t const ceildist, int32_t const flordist, uint32_t const cliptype)
|
||||
int32_t const walldist, int32_t const ceildist, int32_t const flordist, uint32_t const cliptype, int clipmoveboxtracenum)
|
||||
{
|
||||
if ((xvect|yvect) == 0 || *sectnum < 0)
|
||||
return 0;
|
||||
|
|
|
@ -5381,17 +5381,15 @@ int MoveMissile(DBloodActor* actor)
|
|||
{
|
||||
vec3_t pos = pSprite->pos;
|
||||
int nSector2 = pSprite->sectnum;
|
||||
clipmoveboxtracenum = 1;
|
||||
const short bakSpriteCstat = pSprite->cstat;
|
||||
if (pOwner && !isFlameSprite && !cl_bloodvanillaexplosions && !VanillaMode())
|
||||
{
|
||||
enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy
|
||||
pSprite->cstat &= ~257; // remove self collisions for accurate clipmove
|
||||
}
|
||||
Collision clipmoveresult = ClipMove(&pos, &nSector2, vx, vy, pSprite->clipdist << 2, (pos.z - top) / 4, (bottom - pos.z) / 4, CLIPMASK0);
|
||||
Collision clipmoveresult = ClipMove(&pos, &nSector2, vx, vy, pSprite->clipdist << 2, (pos.z - top) / 4, (bottom - pos.z) / 4, CLIPMASK0, 1);
|
||||
enginecompatibility_mode = bakCompat; // restore
|
||||
pSprite->cstat = bakSpriteCstat;
|
||||
clipmoveboxtracenum = 3;
|
||||
int nSector = nSector2;
|
||||
if (nSector2 < 0)
|
||||
{
|
||||
|
|
|
@ -732,11 +732,11 @@ 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)
|
||||
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);
|
||||
unsigned int nRes = clipmove(pos, &bakSect, xv<<14, yv<<14, wd, cd, fd, nMask, tracecount);
|
||||
if (bakSect == -1)
|
||||
{
|
||||
*pos = opos;
|
||||
|
|
|
@ -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(vec3_t* pos, 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 tracecount = 3);
|
||||
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);
|
||||
|
|
|
@ -64,9 +64,7 @@ int MultiClipMove(PLAYERp pp, int z, int floor_dist)
|
|||
|
||||
xvect = sop->clipbox_vdist[i] * bcos(ang);
|
||||
yvect = sop->clipbox_vdist[i] * bsin(ang);
|
||||
clipmoveboxtracenum = 1;
|
||||
ret_start = clipmove(&spos, &pp->cursectnum, xvect, yvect, (int)sop->clipbox_dist[i], Z(4), floor_dist, CLIPMASK_PLAYER);
|
||||
clipmoveboxtracenum = 3;
|
||||
ret_start = clipmove(&spos, &pp->cursectnum, xvect, yvect, (int)sop->clipbox_dist[i], Z(4), floor_dist, CLIPMASK_PLAYER, 1);
|
||||
|
||||
if (ret_start)
|
||||
{
|
||||
|
|
|
@ -5082,10 +5082,8 @@ move_actor(short SpriteNum, int xchange, int ychange, int zchange)
|
|||
hi_sectp = u->hi_sectp;
|
||||
sectnum = sp->sectnum;
|
||||
|
||||
clipmoveboxtracenum = 1;
|
||||
u->ret = move_sprite(SpriteNum, xchange, ychange, zchange,
|
||||
u->ceiling_dist, u->floor_dist, cliptype, ACTORMOVETICS);
|
||||
clipmoveboxtracenum = 3;
|
||||
|
||||
ASSERT(sp->sectnum >= 0);
|
||||
|
||||
|
@ -6861,12 +6859,10 @@ move_sprite(int spritenum, int xchange, int ychange, int zchange, int ceildist,
|
|||
|
||||
// ASSERT(inside(spr->x,spr->y,dasectnum));
|
||||
|
||||
clipmoveboxtracenum = 1;
|
||||
retval = clipmove(&clippos, &dasectnum,
|
||||
((xchange * numtics) << 11), ((ychange * numtics) << 11),
|
||||
(((int) spr->clipdist) << 2), ceildist, flordist, cliptype);
|
||||
(((int) spr->clipdist) << 2), ceildist, flordist, cliptype, 1);
|
||||
spr->pos.vec2 = clippos.vec2;
|
||||
clipmoveboxtracenum = 3;
|
||||
|
||||
//if (TEST(retval, HIT_MASK) == HIT_WALL)
|
||||
// {
|
||||
|
@ -7106,12 +7102,10 @@ move_missile(int spritenum, int xchange, int ychange, int zchange, int ceildist,
|
|||
|
||||
|
||||
// ASSERT(inside(sp->x,sp->y,dasectnum));
|
||||
clipmoveboxtracenum = 1;
|
||||
retval = clipmove(&clippos, &dasectnum,
|
||||
((xchange * numtics) << 11), ((ychange * numtics) << 11),
|
||||
(((int) sp->clipdist) << 2), ceildist, flordist, cliptype);
|
||||
(((int) sp->clipdist) << 2), ceildist, flordist, cliptype, 1);
|
||||
sp->pos.vec2 = clippos.vec2;
|
||||
clipmoveboxtracenum = 3;
|
||||
|
||||
if (dasectnum < 0)
|
||||
{
|
||||
|
@ -7265,12 +7259,10 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int
|
|||
dasectnum = lastsectnum = sp->sectnum;
|
||||
opos = sp->pos;
|
||||
opos.z = daz;
|
||||
clipmoveboxtracenum = 1;
|
||||
retval = clipmove(&opos, &dasectnum,
|
||||
((xchange * numtics) << 11), ((ychange * numtics) << 11),
|
||||
(((int) sp->clipdist) << 2), ceildist, flordist, cliptype);
|
||||
(((int) sp->clipdist) << 2), ceildist, flordist, cliptype, 1);
|
||||
sp->pos.vec2 = opos.vec2;
|
||||
clipmoveboxtracenum = 3;
|
||||
}
|
||||
|
||||
if (dasectnum < 0)
|
||||
|
|
|
@ -17442,12 +17442,9 @@ HitscanSpriteAdjust(short SpriteNum, short hit_wall)
|
|||
xvect = bcos(ang, 4);
|
||||
yvect = bsin(ang, 4);
|
||||
|
||||
clipmoveboxtracenum = 1;
|
||||
|
||||
// must have this
|
||||
sectnum = sp->sectnum;
|
||||
clipmove(&sp->pos, §num, xvect, yvect, 4L, 4L<<8, 4L<<8, CLIPMASK_MISSILE);
|
||||
clipmoveboxtracenum = 3;
|
||||
clipmove(&sp->pos, §num, xvect, yvect, 4L, 4L<<8, 4L<<8, CLIPMASK_MISSILE, 1);
|
||||
|
||||
if (sp->sectnum != sectnum)
|
||||
changespritesect(SpriteNum, sectnum);
|
||||
|
@ -20310,9 +20307,7 @@ int QueueHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z)
|
|||
|
||||
sectnum = sp->sectnum;
|
||||
|
||||
clipmoveboxtracenum = 1;
|
||||
clipmove(&sp->pos, §num, nx, ny, 0L, 0L, 0L, CLIPMASK_MISSILE);
|
||||
clipmoveboxtracenum = 3;
|
||||
clipmove(&sp->pos, §num, nx, ny, 0L, 0L, 0L, CLIPMASK_MISSILE, 1);
|
||||
|
||||
if (sp->sectnum != sectnum)
|
||||
changespritesect(SpriteNum, sectnum);
|
||||
|
@ -20644,9 +20639,7 @@ int QueueWallBlood(short hit_sprite, short ang)
|
|||
|
||||
sectnum = sp->sectnum;
|
||||
|
||||
clipmoveboxtracenum = 1;
|
||||
clipmove(&sp->pos, §num, nx, ny, 0L, 0L, 0L, CLIPMASK_MISSILE);
|
||||
clipmoveboxtracenum = 3;
|
||||
clipmove(&sp->pos, §num, nx, ny, 0L, 0L, 0L, CLIPMASK_MISSILE, 1);
|
||||
|
||||
if (sp->sectnum != sectnum)
|
||||
changespritesect(SpriteNum, sectnum);
|
||||
|
|
Loading…
Reference in a new issue