Text-repl.: hitinfo variables -> hit, hit{sprite,sect,wall} members -> no "hit"

This makes the code rather more readable in some places.  Unlike the two
preceding commits, this one is actually purely textual replacement.

git-svn-id: https://svn.eduke32.com/eduke32@2877 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-08-10 19:12:01 +00:00
parent 971d816235
commit 4dca439d8f
9 changed files with 471 additions and 471 deletions

View file

@ -559,7 +559,7 @@ typedef struct {
typedef struct { typedef struct {
vec3_t pos; vec3_t pos;
int16_t hitsprite, hitwall, hitsect; int16_t sprite, wall, sect;
} hitdata_t; } hitdata_t;
#pragma pack(pop) #pragma pack(pop)

View file

@ -1252,7 +1252,7 @@ void editinput(void)
if (keystatus[0x1f]) //S (insert sprite) (3D) if (keystatus[0x1f]) //S (insert sprite) (3D)
{ {
hitdata_t hitinfo; hitdata_t hit;
dax = 16384; dax = 16384;
day = divscale14(searchx-(xdim>>1), xdim>>1); day = divscale14(searchx-(xdim>>1), xdim>>1);
@ -1260,21 +1260,21 @@ void editinput(void)
hitscan((const vec3_t *)&pos,cursectnum, //Start position hitscan((const vec3_t *)&pos,cursectnum, //Start position
dax,day,(scale(searchy,200,ydim)-horiz)*2000, //vector of 3D ang dax,day,(scale(searchy,200,ydim)-horiz)*2000, //vector of 3D ang
&hitinfo,CLIPMASK1); &hit,CLIPMASK1);
if (hitinfo.hitsect >= 0) if (hit.sect >= 0)
{ {
dax = hitinfo.pos.x; dax = hit.pos.x;
day = hitinfo.pos.y; day = hit.pos.y;
if (gridlock && grid > 0) if (gridlock && grid > 0)
{ {
if (AIMING_AT_WALL || AIMING_AT_MASKWALL) if (AIMING_AT_WALL || AIMING_AT_MASKWALL)
hitinfo.pos.z &= 0xfffffc00; hit.pos.z &= 0xfffffc00;
else else
locktogrid(&dax, &day); locktogrid(&dax, &day);
} }
i = insert_sprite_common(hitinfo.hitsect, dax, day); i = insert_sprite_common(hit.sect, dax, day);
if (i < 0) if (i < 0)
message("Couldn't insert sprite."); message("Couldn't insert sprite.");
@ -1284,17 +1284,17 @@ void editinput(void)
handle_sprite_in_clipboard(i); handle_sprite_in_clipboard(i);
getzsofslope(hitinfo.hitsect, hitinfo.pos.x, hitinfo.pos.y, &cz, &fz); getzsofslope(hit.sect, hit.pos.x, hit.pos.y, &cz, &fz);
spriteoncfz(i, &cz, &fz); spriteoncfz(i, &cz, &fz);
sprite[i].z = clamp(hitinfo.pos.z, cz, fz); sprite[i].z = clamp(hit.pos.z, cz, fz);
if (AIMING_AT_WALL || AIMING_AT_MASKWALL) if (AIMING_AT_WALL || AIMING_AT_MASKWALL)
{ {
sprite[i].cstat &= ~48; sprite[i].cstat &= ~48;
sprite[i].cstat |= (16+64); sprite[i].cstat |= (16+64);
correct_ornamented_sprite(i, hitinfo.hitwall); correct_ornamented_sprite(i, hit.wall);
} }
else else
sprite[i].cstat |= (tilesizy[sprite[i].picnum]>=32); sprite[i].cstat |= (tilesizy[sprite[i].picnum]>=32);
@ -1999,20 +1999,20 @@ static void correct_ornamented_sprite(int32_t i, int32_t hitw)
void DoSpriteOrnament(int32_t i) void DoSpriteOrnament(int32_t i)
{ {
hitdata_t hitinfo; hitdata_t hit;
hitscan((const vec3_t *)&sprite[i],sprite[i].sectnum, hitscan((const vec3_t *)&sprite[i],sprite[i].sectnum,
sintable[(sprite[i].ang+1536)&2047], sintable[(sprite[i].ang+1536)&2047],
sintable[(sprite[i].ang+1024)&2047], sintable[(sprite[i].ang+1024)&2047],
0, 0,
&hitinfo,CLIPMASK1); &hit,CLIPMASK1);
sprite[i].x = hitinfo.pos.x; sprite[i].x = hit.pos.x;
sprite[i].y = hitinfo.pos.y; sprite[i].y = hit.pos.y;
sprite[i].z = hitinfo.pos.z; sprite[i].z = hit.pos.z;
changespritesect(i, hitinfo.hitsect); changespritesect(i, hit.sect);
correct_ornamented_sprite(i, hitinfo.hitwall); correct_ornamented_sprite(i, hit.wall);
} }
void update_highlight(void) void update_highlight(void)

View file

@ -11206,7 +11206,7 @@ static int32_t hitscan_hitsectcf=-1;
// stat, heinum, z: either ceiling- or floor- // stat, heinum, z: either ceiling- or floor-
// how: -1: behave like ceiling, 1: behave like floor // how: -1: behave like ceiling, 1: behave like floor
static int32_t hitscan_trysector(const vec3_t *sv, const sectortype *sec, hitdata_t *hitinfo, static int32_t hitscan_trysector(const vec3_t *sv, const sectortype *sec, hitdata_t *hit,
int32_t vx, int32_t vy, int32_t vz, int32_t vx, int32_t vy, int32_t vz,
int16_t stat, int16_t heinum, int32_t z, int32_t how, const intptr_t *tmp) int16_t stat, int16_t heinum, int32_t z, int32_t how, const intptr_t *tmp)
{ {
@ -11246,14 +11246,14 @@ static int32_t hitscan_trysector(const vec3_t *sv, const sectortype *sec, hitdat
} }
} }
if ((x1 != INT32_MAX) && (klabs(x1-sv->x)+klabs(y1-sv->y) < klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y))) if ((x1 != INT32_MAX) && (klabs(x1-sv->x)+klabs(y1-sv->y) < klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y)))
{ {
if (tmp==NULL) if (tmp==NULL)
{ {
if (inside(x1,y1,sec-sector) != 0) if (inside(x1,y1,sec-sector) != 0)
{ {
hitinfo->hitsect = sec-sector; hitinfo->hitwall = -1; hitinfo->hitsprite = -1; hit->sect = sec-sector; hit->wall = -1; hit->sprite = -1;
hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1; hit->pos.x = x1; hit->pos.y = y1; hit->pos.z = z1;
hitscan_hitsectcf = (how+1)>>1; hitscan_hitsectcf = (how+1)>>1;
} }
} }
@ -11267,8 +11267,8 @@ static int32_t hitscan_trysector(const vec3_t *sv, const sectortype *sec, hitdat
{ {
if (inside(x1,y1,sec-sector) != 0) if (inside(x1,y1,sec-sector) != 0)
{ {
hitinfo->hitsect = curspr->sectnum; hitinfo->hitwall = -1; hitinfo->hitsprite = curspr-sprite; hit->sect = curspr->sectnum; hit->wall = -1; hit->sprite = curspr-sprite;
hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1; hit->pos.x = x1; hit->pos.y = y1; hit->pos.z = z1;
} }
} }
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
@ -11278,8 +11278,8 @@ static int32_t hitscan_trysector(const vec3_t *sv, const sectortype *sec, hitdat
{ {
if (inside(x1,y1,sectq[i]) != 0) if (inside(x1,y1,sectq[i]) != 0)
{ {
hitinfo->hitsect = curspr->sectnum; hitinfo->hitwall = -1; hitinfo->hitsprite = curspr-sprite; hit->sect = curspr->sectnum; hit->wall = -1; hit->sprite = curspr-sprite;
hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1; hit->pos.x = x1; hit->pos.y = y1; hit->pos.z = z1;
break; break;
} }
} }
@ -11298,7 +11298,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, const sectortype *sec, hitdat
static int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t *clipsectcnt, const vec3_t *vect); static int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t *clipsectcnt, const vec3_t *vect);
int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz,
hitdata_t *hitinfo, uint32_t cliptype) hitdata_t *hit, uint32_t cliptype)
{ {
sectortype *sec; sectortype *sec;
walltype *wal, *wal2; walltype *wal, *wal2;
@ -11320,7 +11320,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32
vec3_t newsv; vec3_t newsv;
int32_t oldhitsect = -1, oldhitsect2 = -2; int32_t oldhitsect = -1, oldhitsect2 = -2;
#endif #endif
hitinfo->hitsect = -1; hitinfo->hitwall = -1; hitinfo->hitsprite = -1; hit->sect = -1; hit->wall = -1; hit->sprite = -1;
if (sectnum < 0) return(-1); if (sectnum < 0) return(-1);
dawalclipmask = (cliptype&65535); dawalclipmask = (cliptype&65535);
@ -11328,7 +11328,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
restart_grand: restart_grand:
#endif #endif
hitinfo->pos.x = hitscangoalx; hitinfo->pos.y = hitscangoaly; hit->pos.x = hitscangoalx; hit->pos.y = hitscangoaly;
clipsectorlist[0] = sectnum; clipsectorlist[0] = sectnum;
tempshortcnt = 0; tempshortnum = 1; tempshortcnt = 0; tempshortnum = 1;
@ -11381,9 +11381,9 @@ restart_grand:
else tmp[2] = 0; else tmp[2] = 0;
} }
#endif #endif
if (hitscan_trysector(sv, sec, hitinfo, vx,vy,vz, sec->ceilingstat, sec->ceilingheinum, sec->ceilingz, -i, tmpptr)) if (hitscan_trysector(sv, sec, hit, vx,vy,vz, sec->ceilingstat, sec->ceilingheinum, sec->ceilingz, -i, tmpptr))
continue; continue;
if (hitscan_trysector(sv, sec, hitinfo, vx,vy,vz, sec->floorstat, sec->floorheinum, sec->floorz, i, tmpptr)) if (hitscan_trysector(sv, sec, hit, vx,vy,vz, sec->floorstat, sec->floorheinum, sec->floorz, i, tmpptr))
continue; continue;
startwall = sec->wallptr; endwall = startwall + sec->wallnum; startwall = sec->wallptr; endwall = startwall + sec->wallnum;
@ -11397,7 +11397,7 @@ restart_grand:
if ((int64_t)(x1-sv->x)*(y2-sv->y) < (int64_t)(x2-sv->x)*(y1-sv->y)) continue; if ((int64_t)(x1-sv->x)*(y2-sv->y) < (int64_t)(x2-sv->x)*(y1-sv->y)) continue;
if (rintersect(sv->x,sv->y,sv->z, vx,vy,vz, x1,y1, x2,y2, &intx,&inty,&intz) == 0) continue; if (rintersect(sv->x,sv->y,sv->z, vx,vy,vz, x1,y1, x2,y2, &intx,&inty,&intz) == 0) continue;
if (klabs(intx-sv->x)+klabs(inty-sv->y) >= klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) if (klabs(intx-sv->x)+klabs(inty-sv->y) >= klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y))
continue; continue;
nextsector = wal->nextsector; nextsector = wal->nextsector;
@ -11405,15 +11405,15 @@ restart_grand:
{ {
if ((nextsector < 0) || (wal->cstat&dawalclipmask)) if ((nextsector < 0) || (wal->cstat&dawalclipmask))
{ {
hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1; hit->sect = dasector; hit->wall = z; hit->sprite = -1;
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; hit->pos.x = intx; hit->pos.y = inty; hit->pos.z = intz;
continue; continue;
} }
getzsofslope(nextsector,intx,inty,&daz,&daz2); getzsofslope(nextsector,intx,inty,&daz,&daz2);
if ((intz <= daz) || (intz >= daz2)) if ((intz <= daz) || (intz >= daz2))
{ {
hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1; hit->sect = dasector; hit->wall = z; hit->sprite = -1;
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; hit->pos.x = intx; hit->pos.y = inty; hit->pos.z = intz;
continue; continue;
} }
} }
@ -11424,8 +11424,8 @@ restart_grand:
if (wal->cstat&dawalclipmask) if (wal->cstat&dawalclipmask)
{ {
hitinfo->hitsect = curspr->sectnum; hitinfo->hitwall = -1; hitinfo->hitsprite = curspr-sprite; hit->sect = curspr->sectnum; hit->wall = -1; hit->sprite = curspr-sprite;
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; hit->pos.x = intx; hit->pos.y = inty; hit->pos.z = intz;
continue; continue;
} }
getzsofslope(nextsector,intx,inty,&daz,&daz2); getzsofslope(nextsector,intx,inty,&daz,&daz2);
@ -11433,8 +11433,8 @@ restart_grand:
// ceil cz daz daz2 fz floor // ceil cz daz daz2 fz floor
if ((cz <= intz && intz <= daz) || (daz2 <= intz && intz <= fz)) if ((cz <= intz && intz <= daz) || (daz2 <= intz && intz <= fz))
{ {
hitinfo->hitsect = curspr->sectnum; hitinfo->hitwall = -1; hitinfo->hitsprite = curspr-sprite; hit->sect = curspr->sectnum; hit->wall = -1; hit->sprite = curspr-sprite;
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; hit->pos.x = intx; hit->pos.y = inty; hit->pos.z = intz;
continue; continue;
} }
} }
@ -11491,10 +11491,10 @@ restart_grand:
intx = sv->x + scale(vx,topt,bot); intx = sv->x + scale(vx,topt,bot);
inty = sv->y + scale(vy,topt,bot); inty = sv->y + scale(vy,topt,bot);
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y)) continue;
hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; hit->sect = dasector; hit->wall = -1; hit->sprite = z;
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; hit->pos.x = intx; hit->pos.y = inty; hit->pos.z = intz;
break; break;
case 16: case 16:
@ -11514,15 +11514,15 @@ restart_grand:
if (rintersect(sv->x,sv->y,sv->z,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue; if (rintersect(sv->x,sv->y,sv->z,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue;
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y)) continue;
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2); k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2);
if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z; if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z;
if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2);
if ((intz < daz) && (intz > daz-k)) if ((intz < daz) && (intz > daz-k))
{ {
hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; hit->sect = dasector; hit->wall = -1; hit->sprite = z;
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; hit->pos.x = intx; hit->pos.y = inty; hit->pos.z = intz;
} }
break; break;
@ -11543,7 +11543,7 @@ restart_grand:
inty = sv->y+scale(intz-sv->z,vy,vz); inty = sv->y+scale(intz-sv->z,vy,vz);
#endif #endif
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y)) continue;
tilenum = spr->picnum; tilenum = spr->picnum;
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
@ -11590,8 +11590,8 @@ restart_grand:
if (clipyou != 0) if (clipyou != 0)
{ {
hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; hit->sect = dasector; hit->wall = -1; hit->sprite = z;
hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; hit->pos.x = intx; hit->pos.y = inty; hit->pos.z = intz;
} }
break; break;
} }
@ -11608,34 +11608,34 @@ restart_grand:
if (numyaxbunches == 0 || editstatus) if (numyaxbunches == 0 || editstatus)
return 0; return 0;
if (hitinfo->hitsprite==-1 && hitinfo->hitwall==-1 && hitinfo->hitsect!=oldhitsect if (hit->sprite==-1 && hit->wall==-1 && hit->sect!=oldhitsect
&& hitinfo->hitsect != oldhitsect2) // 'ping-pong' infloop protection && hit->sect != oldhitsect2) // 'ping-pong' infloop protection
{ {
if (hitinfo->hitsect == -1 && oldhitsect >= 0) if (hit->sect == -1 && oldhitsect >= 0)
{ {
// this is bad: we didn't hit anything after going through a ceiling/floor // this is bad: we didn't hit anything after going through a ceiling/floor
Bmemcpy(&hitinfo->pos, &newsv, sizeof(vec3_t)); Bmemcpy(&hit->pos, &newsv, sizeof(vec3_t));
hitinfo->hitsect = oldhitsect; hit->sect = oldhitsect;
return 0; return 0;
} }
// 1st, 2nd, ... ceil/floor hit // 1st, 2nd, ... ceil/floor hit
// hitinfo->hitsect is >=0 because if oldhitsect's init and check above // hit->sect is >=0 because if oldhitsect's init and check above
if (SECTORFLD(hitinfo->hitsect,stat, hitscan_hitsectcf)&yax_waltosecmask(dawalclipmask)) if (SECTORFLD(hit->sect,stat, hitscan_hitsectcf)&yax_waltosecmask(dawalclipmask))
return 0; return 0;
i = yax_getneighborsect(hitinfo->pos.x, hitinfo->pos.y, hitinfo->hitsect, i = yax_getneighborsect(hit->pos.x, hit->pos.y, hit->sect,
hitscan_hitsectcf, NULL); hitscan_hitsectcf, NULL);
if (i >= 0) if (i >= 0)
{ {
Bmemcpy(&newsv, &hitinfo->pos, sizeof(vec3_t)); Bmemcpy(&newsv, &hit->pos, sizeof(vec3_t));
sectnum = i; sectnum = i;
sv = &newsv; sv = &newsv;
oldhitsect2 = oldhitsect; oldhitsect2 = oldhitsect;
oldhitsect = hitinfo->hitsect; oldhitsect = hit->sect;
hitinfo->hitsect = -1; hit->sect = -1;
// sector-like sprite re-init: // sector-like sprite re-init:
curspr = 0; curspr = 0;

View file

@ -4426,7 +4426,7 @@ void polymost_drawrooms()
{ {
int32_t vx, vy, vz; int32_t vx, vy, vz;
int32_t cz, fz; int32_t cz, fz;
hitdata_t hitinfo; hitdata_t hit;
vec3_t vect; vec3_t vect;
double ratio = 1.05; double ratio = 1.05;
@ -4472,43 +4472,43 @@ void polymost_drawrooms()
hitallsprites = 1; hitallsprites = 1;
hitscan((const vec3_t *)&vect,globalcursectnum, //Start position hitscan((const vec3_t *)&vect,globalcursectnum, //Start position
vx>>10,vy>>10,vz>>6,&hitinfo,0xffff0030); vx>>10,vy>>10,vz>>6,&hit,0xffff0030);
if (hitinfo.hitsect != -1) // if hitsect is -1, hitscan overflowed somewhere if (hit.sect != -1) // if hitsect is -1, hitscan overflowed somewhere
{ {
getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); getzsofslope(hit.sect,hit.pos.x,hit.pos.y,&cz,&fz);
hitallsprites = 0; hitallsprites = 0;
searchsector = hitinfo.hitsect; searchsector = hit.sect;
if (hitinfo.pos.z<cz) searchstat = 1; if (hit.pos.z<cz) searchstat = 1;
else if (hitinfo.pos.z>fz) searchstat = 2; else if (hit.pos.z>fz) searchstat = 2;
else if (hitinfo.hitwall >= 0) else if (hit.wall >= 0)
{ {
searchbottomwall = searchwall = hitinfo.hitwall; searchstat = 0; searchbottomwall = searchwall = hit.wall; searchstat = 0;
if (wall[hitinfo.hitwall].nextwall >= 0) if (wall[hit.wall].nextwall >= 0)
{ {
int32_t cz, fz; int32_t cz, fz;
getzsofslope(wall[hitinfo.hitwall].nextsector,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); getzsofslope(wall[hit.wall].nextsector,hit.pos.x,hit.pos.y,&cz,&fz);
if (hitinfo.pos.z > fz) if (hit.pos.z > fz)
{ {
searchisbottom = 1; searchisbottom = 1;
if (wall[hitinfo.hitwall].cstat&2) //'2' bottoms of walls if (wall[hit.wall].cstat&2) //'2' bottoms of walls
searchbottomwall = wall[hitinfo.hitwall].nextwall; searchbottomwall = wall[hit.wall].nextwall;
} }
else else
{ {
searchisbottom = 0; searchisbottom = 0;
if ((hitinfo.pos.z > cz) && (wall[hitinfo.hitwall].cstat&(16+32))) //masking or 1-way if ((hit.pos.z > cz) && (wall[hit.wall].cstat&(16+32))) //masking or 1-way
searchstat = 4; searchstat = 4;
} }
} }
} }
else if (hitinfo.hitsprite >= 0) { searchwall = hitinfo.hitsprite; searchstat = 3; } else if (hit.sprite >= 0) { searchwall = hit.sprite; searchstat = 3; }
else else
{ {
int32_t cz, fz; int32_t cz, fz;
getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); getzsofslope(hit.sect,hit.pos.x,hit.pos.y,&cz,&fz);
if ((hitinfo.pos.z<<1) < cz+fz) searchstat = 1; else searchstat = 2; if ((hit.pos.z<<1) < cz+fz) searchstat = 1; else searchstat = 2;
//if (vz < 0) searchstat = 1; else searchstat = 2; //Won't work for slopes :/ //if (vz < 0) searchstat = 1; else searchstat = 2; //Won't work for slopes :/
} }
@ -4516,10 +4516,10 @@ void polymost_drawrooms()
{ {
spritetype *tsp = &tsprite[spritesortcnt]; spritetype *tsp = &tsprite[spritesortcnt];
double dadist, x,y,z; double dadist, x,y,z;
Bmemcpy(tsp, &hitinfo.pos, sizeof(vec3_t)); Bmemcpy(tsp, &hit.pos, sizeof(vec3_t));
x = tsp->x-globalposx; y=tsp->y-globalposy; z=(tsp->z-globalposz)/16.0; x = tsp->x-globalposx; y=tsp->y-globalposy; z=(tsp->z-globalposz)/16.0;
dadist = sqrt(x*x + y*y + z*z); dadist = sqrt(x*x + y*y + z*z);
tsp->sectnum = hitinfo.hitsect; tsp->sectnum = hit.sect;
tsp->picnum = 2523; // CROSSHAIR tsp->picnum = 2523; // CROSSHAIR
tsp->cstat = 128; tsp->cstat = 128;
tsp->owner = MAXSPRITES-1; tsp->owner = MAXSPRITES-1;
@ -4541,8 +4541,8 @@ void polymost_drawrooms()
int32_t w1[2] = {wal[k].x, wal[k].y}; int32_t w1[2] = {wal[k].x, wal[k].y};
int32_t w2[2] = {wall[wal[k].point2].x, wall[wal[k].point2].y}; int32_t w2[2] = {wall[wal[k].point2].x, wall[wal[k].point2].y};
int32_t w21[2] = {w1[0]-w2[0], w1[1]-w2[1]}; int32_t w21[2] = {w1[0]-w2[0], w1[1]-w2[1]};
int32_t pw1[2] = {w1[0]-hitinfo.pos.x, w1[1]-hitinfo.pos.y}; int32_t pw1[2] = {w1[0]-hit.pos.x, w1[1]-hit.pos.y};
int32_t pw2[2] = {w2[0]-hitinfo.pos.x, w2[1]-hitinfo.pos.y}; int32_t pw2[2] = {w2[0]-hit.pos.x, w2[1]-hit.pos.y};
float w1d = (float)(scrv_r[0]*pw1[0] + scrv_r[1]*pw1[1]); float w1d = (float)(scrv_r[0]*pw1[0] + scrv_r[1]*pw1[1]);
float w2d = (float)(scrv_r[0]*pw2[0] + scrv_r[1]*pw2[1]); float w2d = (float)(scrv_r[0]*pw2[0] + scrv_r[1]*pw2[1]);
int32_t ptonline[2], scrp[2]; int32_t ptonline[2], scrp[2];

View file

@ -2996,7 +2996,7 @@ static void G_DoThirdPerson(DukePlayer_t *pp, vec3_t *vect,int16_t *vsectnum, in
int32_t i, hx, hy; int32_t i, hx, hy;
int32_t daang; int32_t daang;
int32_t bakcstat = sp->cstat; int32_t bakcstat = sp->cstat;
hitdata_t hitinfo; hitdata_t hit;
vec3_t n = { (sintable[(ang+1536)&2047]>>4), vec3_t n = { (sintable[(ang+1536)&2047]>>4),
(sintable[(ang+1024)&2047]>>4), (sintable[(ang+1024)&2047]>>4),
(horiz-100)*128 (horiz-100)*128
@ -3005,7 +3005,7 @@ static void G_DoThirdPerson(DukePlayer_t *pp, vec3_t *vect,int16_t *vsectnum, in
sp->cstat &= (int16_t)~0x101; sp->cstat &= (int16_t)~0x101;
updatesectorz(vect->x,vect->y,vect->z,vsectnum); updatesectorz(vect->x,vect->y,vect->z,vsectnum);
hitscan((const vec3_t *)vect,*vsectnum,n.x,n.y,n.z,&hitinfo,CLIPMASK1); hitscan((const vec3_t *)vect,*vsectnum,n.x,n.y,n.z,&hit,CLIPMASK1);
if (*vsectnum < 0) if (*vsectnum < 0)
{ {
@ -3013,21 +3013,21 @@ static void G_DoThirdPerson(DukePlayer_t *pp, vec3_t *vect,int16_t *vsectnum, in
return; return;
} }
hx = hitinfo.pos.x-(vect->x); hx = hit.pos.x-(vect->x);
hy = hitinfo.pos.y-(vect->y); hy = hit.pos.y-(vect->y);
if (klabs(n.x)+klabs(n.y) > klabs(hx)+klabs(hy)) if (klabs(n.x)+klabs(n.y) > klabs(hx)+klabs(hy))
{ {
*vsectnum = hitinfo.hitsect; *vsectnum = hit.sect;
if (hitinfo.hitwall >= 0) if (hit.wall >= 0)
{ {
daang = getangle(wall[wall[hitinfo.hitwall].point2].x-wall[hitinfo.hitwall].x, daang = getangle(wall[wall[hit.wall].point2].x-wall[hit.wall].x,
wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y); wall[wall[hit.wall].point2].y-wall[hit.wall].y);
i = n.x*sintable[daang]+n.y*sintable[(daang+1536)&2047]; i = n.x*sintable[daang]+n.y*sintable[(daang+1536)&2047];
if (klabs(n.x) > klabs(n.y)) hx -= mulscale28(n.x,i); if (klabs(n.x) > klabs(n.y)) hx -= mulscale28(n.x,i);
else hy -= mulscale28(n.y,i); else hy -= mulscale28(n.y,i);
} }
else if (hitinfo.hitsprite < 0) else if (hit.sprite < 0)
{ {
if (klabs(n.x) > klabs(n.y)) hx -= (n.x>>5); if (klabs(n.x) > klabs(n.y)) hx -= (n.x>>5);
else hy -= (n.y>>5); else hy -= (n.y>>5);
@ -10677,7 +10677,7 @@ int32_t G_DoMoveThings(void)
if (ud.idplayers && (g_netServer || ud.multimode > 1)) if (ud.idplayers && (g_netServer || ud.multimode > 1))
{ {
hitdata_t hitinfo; hitdata_t hit;
DukePlayer_t *const p = g_player[screenpeek].ps; DukePlayer_t *const p = g_player[screenpeek].ps;
for (i=0; i<ud.multimode; i++) for (i=0; i<ud.multimode; i++)
@ -10687,21 +10687,21 @@ int32_t G_DoMoveThings(void)
hitscan((vec3_t *)p,p->cursectnum, hitscan((vec3_t *)p,p->cursectnum,
sintable[(p->ang+512)&2047], sintable[(p->ang+512)&2047],
sintable[p->ang&2047], sintable[p->ang&2047],
(100-p->horiz-p->horizoff)<<11,&hitinfo,0xffff0030); (100-p->horiz-p->horizoff)<<11,&hit,0xffff0030);
for (i=0; i<ud.multimode; i++) for (i=0; i<ud.multimode; i++)
if (g_player[i].ps->holoduke_on != -1) if (g_player[i].ps->holoduke_on != -1)
sprite[g_player[i].ps->holoduke_on].cstat ^= 256; sprite[g_player[i].ps->holoduke_on].cstat ^= 256;
if ((hitinfo.hitsprite >= 0) && !(g_player[myconnectindex].ps->gm & MODE_MENU) && if ((hit.sprite >= 0) && !(g_player[myconnectindex].ps->gm & MODE_MENU) &&
sprite[hitinfo.hitsprite].picnum == APLAYER && sprite[hitinfo.hitsprite].yvel != screenpeek && sprite[hit.sprite].picnum == APLAYER && sprite[hit.sprite].yvel != screenpeek &&
g_player[sprite[hitinfo.hitsprite].yvel].ps->dead_flag == 0) g_player[sprite[hit.sprite].yvel].ps->dead_flag == 0)
{ {
if (p->fta == 0 || p->ftq == QUOTE_RESERVED3) if (p->fta == 0 || p->ftq == QUOTE_RESERVED3)
{ {
if (ldist(&sprite[p->i],&sprite[hitinfo.hitsprite]) < 9216) if (ldist(&sprite[p->i],&sprite[hit.sprite]) < 9216)
{ {
Bsprintf(ScriptQuotes[QUOTE_RESERVED3],"%s",&g_player[sprite[hitinfo.hitsprite].yvel].user_name[0]); Bsprintf(ScriptQuotes[QUOTE_RESERVED3],"%s",&g_player[sprite[hit.sprite].yvel].user_name[0]);
p->fta = 12, p->ftq = QUOTE_RESERVED3; p->fta = 12, p->ftq = QUOTE_RESERVED3;
} }
} }

View file

@ -242,7 +242,7 @@ int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs)
int32_t d; int32_t d;
int32_t greatestd = -(1<<30); int32_t greatestd = -(1<<30);
int32_t angincs = 2048/angs,j; int32_t angincs = 2048/angs,j;
hitdata_t hitinfo; hitdata_t hit;
for (j=s->ang; j<(2048+s->ang); j+=angincs) for (j=s->ang; j<(2048+s->ang); j+=angincs)
{ {
@ -250,9 +250,9 @@ int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs)
hitscan((const vec3_t *)s, s->sectnum, hitscan((const vec3_t *)s, s->sectnum,
sintable[(j+512)&2047], sintable[(j+512)&2047],
sintable[j&2047],0, sintable[j&2047],0,
&hitinfo,CLIPMASK1); &hit,CLIPMASK1);
s->z += (8<<8); s->z += (8<<8);
d = klabs(hitinfo.pos.x-s->x) + klabs(hitinfo.pos.y-s->y); d = klabs(hit.pos.x-s->x) + klabs(hit.pos.y-s->y);
if (d > greatestd) if (d > greatestd)
{ {
@ -273,7 +273,7 @@ int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_
int32_t d, da;//, d, cd, ca,tempx,tempy,cx,cy; int32_t d, da;//, d, cd, ca,tempx,tempy,cx,cy;
int32_t j, angincs; int32_t j, angincs;
spritetype *s = &sprite[iActor]; spritetype *s = &sprite[iActor];
hitdata_t hitinfo; hitdata_t hit;
if ((!g_netServer && ud.multimode < 2) && ud.player_skill < 3) if ((!g_netServer && ud.multimode < 2) && ud.player_skill < 3)
angincs = 2048/2; angincs = 2048/2;
@ -285,20 +285,20 @@ int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_
hitscan((const vec3_t *)ts, ts->sectnum, hitscan((const vec3_t *)ts, ts->sectnum,
sintable[(j+512)&2047], sintable[(j+512)&2047],
sintable[j&2047],16384-(krand()&32767), sintable[j&2047],16384-(krand()&32767),
&hitinfo,CLIPMASK1); &hit,CLIPMASK1);
ts->z += (16<<8); ts->z += (16<<8);
d = klabs(hitinfo.pos.x-ts->x)+klabs(hitinfo.pos.y-ts->y); d = klabs(hit.pos.x-ts->x)+klabs(hit.pos.y-ts->y);
da = klabs(hitinfo.pos.x-s->x)+klabs(hitinfo.pos.y-s->y); da = klabs(hit.pos.x-s->x)+klabs(hit.pos.y-s->y);
if (d < da && hitinfo.hitsect > -1) if (d < da && hit.sect > -1)
if (cansee(hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z, if (cansee(hit.pos.x,hit.pos.y,hit.pos.z,
hitinfo.hitsect,s->x,s->y,s->z-(16<<8),s->sectnum)) hit.sect,s->x,s->y,s->z-(16<<8),s->sectnum))
{ {
*dax = hitinfo.pos.x; *dax = hit.pos.x;
*day = hitinfo.pos.y; *day = hit.pos.y;
return hitinfo.hitsect; return hit.sect;
} }
} }
return -1; return -1;
@ -2717,7 +2717,7 @@ nullquote:
insptr++; insptr++;
{ {
vec3_t vect; vec3_t vect;
hitdata_t hitinfo; hitdata_t hit;
vect.x = Gv_GetVarX(*insptr++); vect.x = Gv_GetVarX(*insptr++);
vect.y = Gv_GetVarX(*insptr++); vect.y = Gv_GetVarX(*insptr++);
@ -2734,13 +2734,13 @@ nullquote:
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum);
continue; continue;
} }
hitscan((const vec3_t *)&vect, sectnum, vx, vy, vz, &hitinfo, cliptype); hitscan((const vec3_t *)&vect, sectnum, vx, vy, vz, &hit, cliptype);
Gv_SetVarX(hitsectvar, hitinfo.hitsect); Gv_SetVarX(hitsectvar, hit.sect);
Gv_SetVarX(hitwallvar, hitinfo.hitwall); Gv_SetVarX(hitwallvar, hit.wall);
Gv_SetVarX(hitspritevar, hitinfo.hitsprite); Gv_SetVarX(hitspritevar, hit.sprite);
Gv_SetVarX(hitxvar, hitinfo.pos.x); Gv_SetVarX(hitxvar, hit.pos.x);
Gv_SetVarX(hityvar, hitinfo.pos.y); Gv_SetVarX(hityvar, hit.pos.y);
Gv_SetVarX(hitzvar, hitinfo.pos.z); Gv_SetVarX(hitzvar, hit.pos.z);
} }
continue; continue;
} }

View file

@ -1853,7 +1853,7 @@ badindex:
insptr++; insptr++;
{ {
vec3_t vect; vec3_t vect;
hitdata_t hitinfo; hitdata_t hit;
vect.x = Gv_GetVarX(*insptr++); vect.x = Gv_GetVarX(*insptr++);
vect.y = Gv_GetVarX(*insptr++); vect.y = Gv_GetVarX(*insptr++);
@ -1866,13 +1866,13 @@ badindex:
int32_t hitxvar=*insptr++, hityvar=*insptr++, hitzvar=*insptr++, cliptype=Gv_GetVarX(*insptr++); int32_t hitxvar=*insptr++, hityvar=*insptr++, hitzvar=*insptr++, cliptype=Gv_GetVarX(*insptr++);
X_ERROR_INVALIDSECT(sectnum); X_ERROR_INVALIDSECT(sectnum);
hitscan((const vec3_t *)&vect, sectnum, vx, vy, vz, &hitinfo, cliptype); hitscan((const vec3_t *)&vect, sectnum, vx, vy, vz, &hit, cliptype);
Gv_SetVarX(hitsectvar, hitinfo.hitsect); Gv_SetVarX(hitsectvar, hit.sect);
Gv_SetVarX(hitwallvar, hitinfo.hitwall); Gv_SetVarX(hitwallvar, hit.wall);
Gv_SetVarX(hitspritevar, hitinfo.hitsprite); Gv_SetVarX(hitspritevar, hit.sprite);
Gv_SetVarX(hitxvar, hitinfo.pos.x); Gv_SetVarX(hitxvar, hit.pos.x);
Gv_SetVarX(hityvar, hitinfo.pos.y); Gv_SetVarX(hityvar, hit.pos.y);
Gv_SetVarX(hitzvar, hitinfo.pos.z); Gv_SetVarX(hitzvar, hit.pos.z);
} }
continue; continue;
} }

File diff suppressed because it is too large Load diff

View file

@ -2975,7 +2975,7 @@ CHECKINV1:
int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp) int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp)
{ {
hitdata_t hitinfo; hitdata_t hit;
int32_t zoff = 0; int32_t zoff = 0;
if (A_CheckEnemySprite(&sprite[i])) if (A_CheckEnemySprite(&sprite[i]))
@ -2986,31 +2986,31 @@ int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp)
hitscan((const vec3_t *)&sprite[i],SECT, hitscan((const vec3_t *)&sprite[i],SECT,
sintable[(SA+512)&2047], sintable[(SA+512)&2047],
sintable[SA&2047], sintable[SA&2047],
0,&hitinfo,CLIPMASK1); 0,&hit,CLIPMASK1);
SZ += zoff; SZ += zoff;
*hitsp = hitinfo.hitsprite; *hitsp = hit.sprite;
if (hitinfo.hitwall >= 0 && (wall[hitinfo.hitwall].cstat&16) && A_CheckEnemySprite(&sprite[i])) if (hit.wall >= 0 && (wall[hit.wall].cstat&16) && A_CheckEnemySprite(&sprite[i]))
return((1<<30)); return((1<<30));
return (FindDistance2D(hitinfo.pos.x-SX,hitinfo.pos.y-SY)); return (FindDistance2D(hit.pos.x-SX,hit.pos.y-SY));
} }
static int32_t P_FindWall(DukePlayer_t *p,int16_t *hitw) static int32_t P_FindWall(DukePlayer_t *p,int16_t *hitw)
{ {
hitdata_t hitinfo; hitdata_t hit;
hitscan((const vec3_t *)p,p->cursectnum, hitscan((const vec3_t *)p,p->cursectnum,
sintable[(p->ang+512)&2047], sintable[(p->ang+512)&2047],
sintable[p->ang&2047], sintable[p->ang&2047],
0,&hitinfo,CLIPMASK0); 0,&hit,CLIPMASK0);
*hitw = hitinfo.hitwall; *hitw = hit.wall;
if (hitinfo.hitwall < 0) if (hit.wall < 0)
return INT32_MAX; return INT32_MAX;
return (FindDistance2D(hitinfo.pos.x-p->pos.x,hitinfo.pos.y-p->pos.y)); return (FindDistance2D(hit.pos.x-p->pos.x,hit.pos.y-p->pos.y));
} }
// returns 1 if sprite i should not be considered by neartag // returns 1 if sprite i should not be considered by neartag