engine.c: style-cleanup getzrange(). DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5035 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-03-01 14:15:36 +00:00
parent 5953541075
commit 3ecc8a6962

View file

@ -14649,9 +14649,7 @@ void getzrange(const vec3_t *pos, int16_t sectnum,
int32_t walldist, uint32_t cliptype) int32_t walldist, uint32_t cliptype)
{ {
int32_t clipsectcnt; int32_t clipsectcnt;
int32_t dax, day, daz, daz2; int32_t daz, daz2, i, j, x1, y1, x2, y2;
int32_t i, j, k, dx, dy;
int32_t x1, y1, x2, y2;
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
// YAX round, -1:center, 0:ceiling, 1:floor // YAX round, -1:center, 0:ceiling, 1:floor
@ -14702,10 +14700,6 @@ restart_grand:
#endif #endif
do //Collect sectors inside your square first do //Collect sectors inside your square first
{ {
const walltype *wal;
const sectortype *sec;
int32_t startwall, endwall;
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
if (clipsectcnt>=clipsectnum) if (clipsectcnt>=clipsectnum)
{ {
@ -14725,15 +14719,15 @@ restart_grand:
for (i=0; i<clipsectnum; i++) for (i=0; i<clipsectnum; i++)
{ {
int32_t fz,cz, hitwhat; const int k = clipsectorlist[i];
k = clipsectorlist[i];
if (k==sectq[clipinfo[curidx].qend]) if (k==sectq[clipinfo[curidx].qend])
continue; continue;
getzsofslope((int16_t)k,pos->x,pos->y,&daz,&daz2); int32_t fz, cz;
getzsofslope(k,pos->x,pos->y,&daz,&daz2);
getzsofslope(sectq[clipinfo[curidx].qend],pos->x,pos->y,&cz,&fz); getzsofslope(sectq[clipinfo[curidx].qend],pos->x,pos->y,&cz,&fz);
hitwhat = (curspr-sprite)+49152; const int hitwhat = (curspr-sprite)+49152;
if ((sector[k].ceilingstat&1)==0) if ((sector[k].ceilingstat&1)==0)
{ {
@ -14750,11 +14744,15 @@ restart_grand:
#endif #endif
////////// Walls ////////// ////////// Walls //////////
sec = &sector[clipsectorlist[clipsectcnt]]; const walltype *wal;
startwall = sec->wallptr; endwall = startwall + sec->wallnum; const sectortype *const startsec = &sector[clipsectorlist[clipsectcnt]];
const int startwall = startsec->wallptr;
const int endwall = startwall + startsec->wallnum;
for (j=startwall,wal=&wall[startwall]; j<endwall; j++,wal++) for (j=startwall,wal=&wall[startwall]; j<endwall; j++,wal++)
{ {
k = wal->nextsector; const int k = wal->nextsector;
if (k >= 0) if (k >= 0)
{ {
const walltype *const wal2 = &wall[wal->point2]; const walltype *const wal2 = &wall[wal->point2];
@ -14766,14 +14764,16 @@ restart_grand:
if ((y1 < ymin) && (y2 < ymin)) continue; if ((y1 < ymin) && (y2 < ymin)) continue;
if ((y1 > ymax) && (y2 > ymax)) continue; if ((y1 > ymax) && (y2 > ymax)) continue;
dx = x2-x1; dy = y2-y1; const int32_t dx = x2-x1, dy = y2-y1;
if (dx*(pos->y-y1) < (pos->x-x1)*dy) continue; //back if (dx*(pos->y-y1) < (pos->x-x1)*dy) continue; //back
if (dx > 0) dax = dx*(ymin-y1); else dax = dx*(ymax-y1);
if (dy > 0) day = dy*(xmax-x1); else day = dy*(xmin-x1); int32_t dax = (dx > 0) ? dx*(ymin-y1) : dx*(ymax-y1);
if (dax >= day) continue; int32_t day = (dy > 0) ? dy*(xmax-x1) : dy*(xmin-x1);
if (dax >= day)
continue;
if (wal->cstat&dawalclipmask) continue; // XXX? if (wal->cstat&dawalclipmask) continue; // XXX?
sec = &sector[k]; const sectortype *const sec = &sector[k];
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
if (curspr) if (curspr)
@ -14799,9 +14799,11 @@ restart_grand:
if ((x1 > xmax-MAXCLIPDIST) && (x2 > xmax-MAXCLIPDIST)) continue; if ((x1 > xmax-MAXCLIPDIST) && (x2 > xmax-MAXCLIPDIST)) continue;
if ((y1 < ymin+MAXCLIPDIST) && (y2 < ymin+MAXCLIPDIST)) continue; if ((y1 < ymin+MAXCLIPDIST) && (y2 < ymin+MAXCLIPDIST)) continue;
if ((y1 > ymax-MAXCLIPDIST) && (y2 > ymax-MAXCLIPDIST)) continue; if ((y1 > ymax-MAXCLIPDIST) && (y2 > ymax-MAXCLIPDIST)) continue;
if (dx > 0) dax += dx*MAXCLIPDIST; else dax -= dx*MAXCLIPDIST; if (dx > 0) dax += dx*MAXCLIPDIST; else dax -= dx*MAXCLIPDIST;
if (dy > 0) day -= dy*MAXCLIPDIST; else day += dy*MAXCLIPDIST; if (dy > 0) day -= dy*MAXCLIPDIST; else day += dy*MAXCLIPDIST;
if (dax >= day) continue; if (dax >= day)
continue;
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
if (mcf==-1 && curspr==NULL) if (mcf==-1 && curspr==NULL)
origclipsectorlist[origclipsectnum++] = k; origclipsectorlist[origclipsectnum++] = k;
@ -14884,7 +14886,8 @@ restart_grand:
switch (cstat&48) switch (cstat&48)
{ {
case 0: case 0:
k = walldist+(spr->clipdist<<2)+1; {
int32_t k = walldist+(spr->clipdist<<2)+1;
if ((klabs(x1-pos->x) <= k) && (klabs(y1-pos->y) <= k)) if ((klabs(x1-pos->x) <= k) && (klabs(y1-pos->y) <= k))
{ {
daz = spr->z + spriteheightofs(j, &k, 1); daz = spr->z + spriteheightofs(j, &k, 1);
@ -14892,6 +14895,7 @@ restart_grand:
clipyou = 1; clipyou = 1;
} }
break; break;
}
case 16: case 16:
{ {
@ -14899,6 +14903,7 @@ restart_grand:
if (clipinsideboxline(pos->x,pos->y,x1,y1,x2,y2,walldist+1) != 0) if (clipinsideboxline(pos->x,pos->y,x1,y1,x2,y2,walldist+1) != 0)
{ {
int32_t k;
daz = spr->z + spriteheightofs(j, &k, 1); daz = spr->z + spriteheightofs(j, &k, 1);
daz2 = daz-k; daz2 = daz-k;
clipyou = 1; clipyou = 1;
@ -14913,13 +14918,14 @@ restart_grand:
daz = spr->z; daz2 = daz; daz = spr->z; daz2 = daz;
if ((cstat&64) != 0) if ((cstat&64) != 0)
if ((pos->z > daz) == ((cstat&8)==0)) continue; if ((pos->z > daz) == ((cstat&8)==0))
continue;
get_floorspr_points(spr, pos->x, pos->y, &x1, &x2, &x3, &x4, get_floorspr_points(spr, pos->x, pos->y, &x1, &x2, &x3, &x4,
&y1, &y2, &y3, &y4); &y1, &y2, &y3, &y4);
dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist+4); const int32_t dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist+4);
day = mulscale14(sintable[(spr->ang-256)&2047],walldist+4); const int32_t day = mulscale14(sintable[(spr->ang-256)&2047],walldist+4);
x1 += dax; x2 -= day; x3 -= dax; x4 += day; x1 += dax; x2 -= day; x3 -= dax; x4 += day;
y1 += day; y2 += dax; y3 -= day; y4 -= dax; y1 += day; y2 += dax; y3 -= day; y4 -= dax;