diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index fbdc504c2..045cbdd21 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -616,7 +616,7 @@ FORCE_INLINE void sector_tracker_hook(uintptr_t address) Bassert(usector < ((MAXSECTORS + M32_FIXME_SECTORS) * sizeof(sectortype))); #endif - sectorchanged[usector / sizeof(sectortype)]++; + ++sectorchanged[usector / sizeof(sectortype)]; } FORCE_INLINE void wall_tracker_hook(uintptr_t address) @@ -627,7 +627,7 @@ FORCE_INLINE void wall_tracker_hook(uintptr_t address) Bassert(uwall < ((MAXWALLS + M32_FIXME_WALLS) * sizeof(walltype))); #endif - wallchanged[uwall / sizeof(walltype)]++; + ++wallchanged[uwall / sizeof(walltype)]; } FORCE_INLINE void sprite_tracker_hook(uintptr_t address) @@ -638,7 +638,7 @@ FORCE_INLINE void sprite_tracker_hook(uintptr_t address) Bassert(usprite < (MAXSPRITES * sizeof(spritetype))); #endif - spritechanged[usprite / sizeof(spritetype)]++; + ++spritechanged[usprite / sizeof(spritetype)]; } @@ -712,7 +712,7 @@ EXTERN int32_t g_rotatespriteNoWidescreen; // alpha-blending tables: EXTERN uint8_t numalphatabs; -EXTERN int32_t windowx1, windowy1, windowx2, windowy2; +EXTERN vec2_t windowxy1, windowxy2; EXTERN int16_t *startumost, *startdmost; // The maximum tile offset ever used in any tiled parallaxed multi-sky. @@ -1098,7 +1098,7 @@ FORCE_INLINE void rotatesprite_fs_alpha(int32_t sx, int32_t sy, int32_t z, int16 FORCE_INLINE void rotatesprite_win(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat) { - rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, windowx1,windowy1,windowx2,windowy2); + rotatesprite_(sx, sy, z, a, picnum, dashade, dapalnum, dastat, 0, 0, windowxy1.x,windowxy1.y,windowxy2.x,windowxy2.y); } void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int32_t maxnum, int16_t firstelt); @@ -1188,7 +1188,7 @@ FORCE_INLINE int32_t E_SpriteIsValid(const int32_t i) return ((unsigned)i < MAXSPRITES && sprite[i].statnum != MAXSTATUS); } -int32_t clipshape_idx_for_sprite(spritetype *curspr, int32_t curidx); +int32_t clipshape_idx_for_sprite(uspritetype const * const curspr, int32_t curidx); void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z); void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z); @@ -1216,10 +1216,10 @@ int32_t changespritestat(int16_t spritenum, int16_t newstatnum); int32_t setsprite(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2))); int32_t setspritez(int16_t spritenum, const vec3_t *) ATTRIBUTE((nonnull(2))); -int32_t spriteheightofsptr(const spritetype *spr, int32_t *height, int32_t alsotileyofs); +int32_t spriteheightofsptr(const uspritetype *spr, int32_t *height, int32_t alsotileyofs); FORCE_INLINE int32_t spriteheightofs(int16_t i, int32_t *height, int32_t alsotileyofs) { - return spriteheightofsptr(&sprite[i], height, alsotileyofs); + return spriteheightofsptr((uspritetype *)&sprite[i], height, alsotileyofs); } int32_t screencapture(const char *filename, char inverseit, const char *versionstr) ATTRIBUTE((nonnull(1))); diff --git a/polymer/eduke32/build/include/clip.h b/polymer/eduke32/build/include/clip.h index 35d70eb38..b767bd1ec 100644 --- a/polymer/eduke32/build/include/clip.h +++ b/polymer/eduke32/build/include/clip.h @@ -58,8 +58,8 @@ extern int16_t *sectq; extern int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index extern int16_t clipspritelist[MAXCLIPNUM]; extern void mapinfo_set(mapinfo_t *bak, mapinfo_t *newmap); -extern int32_t clipsprite_try(const spritetype *spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax); -extern int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t *clipsectcnt, const vec3_t *vect); +extern int32_t clipsprite_try(uspritetype const * const spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax); +extern int32_t clipsprite_initindex(int32_t curidx, uspritetype const * const curspr, int32_t *clipsectcnt, const vec3_t *vect); #endif // HAVE_CLIPSHAPE_FEATURE typedef struct diff --git a/polymer/eduke32/build/src/clip.c b/polymer/eduke32/build/src/clip.c index 4750b2432..d6bfd05b7 100644 --- a/polymer/eduke32/build/src/clip.c +++ b/polymer/eduke32/build/src/clip.c @@ -504,7 +504,7 @@ int32_t clipmapinfo_load(void) } -int32_t clipshape_idx_for_sprite(spritetype *curspr, int32_t curidx) +int32_t clipshape_idx_for_sprite(uspritetype const * const curspr, int32_t curidx) { if (curidx < 0) // per-sprite init curidx = pictoidx[curspr->picnum]; @@ -517,7 +517,7 @@ int32_t clipshape_idx_for_sprite(spritetype *curspr, int32_t curidx) return curidx; } #else -int32_t clipshape_idx_for_sprite(spritetype *curspr, int32_t curidx) +int32_t clipshape_idx_for_sprite(uspritetype const * const curspr, int32_t curidx) { UNREFERENCED_PARAMETER(curspr); UNREFERENCED_PARAMETER(curidx); @@ -593,7 +593,7 @@ int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t #ifdef HAVE_CLIPSHAPE_FEATURE -int32_t clipsprite_try(const spritetype *spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax) +int32_t clipsprite_try(uspritetype const * const spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax) { // try and see whether this sprite's picnum has sector-like clipping data int32_t i = pictoidx[spr->picnum]; @@ -626,7 +626,7 @@ int32_t clipsprite_try(const spritetype *spr, int32_t xmin, int32_t ymin, int32_ return 1; if (clipspritenum < MAXCLIPNUM) - clipspritelist[clipspritenum++] = spr-sprite; + clipspritelist[clipspritenum++] = spr-(uspritetype *)sprite; //initprintf("%d: clip sprite[%d]\n",clipspritenum,j); return 1; } @@ -635,7 +635,7 @@ int32_t clipsprite_try(const spritetype *spr, int32_t xmin, int32_t ymin, int32_ } // return: -1 if curspr has x-flip xor y-flip (in the horizontal map plane!), 1 else -int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t *clipsectcnt, const vec3_t *vect) +int32_t clipsprite_initindex(int32_t curidx, uspritetype const * const curspr, int32_t *clipsectcnt, const vec3_t *vect) { int32_t k, daz = curspr->z; int32_t scalex, scaley, scalez, flipx, flipy; @@ -868,7 +868,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum, int32_t dax, day; int32_t retval=0; - spritetype *curspr=NULL; // non-NULL when handling sprite with sector-like clipping + uspritetype const * curspr=NULL; // non-NULL when handling sprite with sector-like clipping int32_t curidx=-1, clipsectcnt, clipspritecnt; const int32_t dawalclipmask = (cliptype&65535); //CLIPMASK0 = 0x00010001 @@ -917,7 +917,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum, mapinfo_set(&origmapinfo, &clipmapinfo); } - curspr = &sprite[clipspritelist[clipspritecnt]]; + curspr = (uspritetype *)&sprite[clipspritelist[clipspritecnt]]; curidx = clipshape_idx_for_sprite(curspr, curidx); if (curidx < 0) @@ -1029,7 +1029,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum, if (!curspr) objtype = (int16_t) j+32768; else - objtype = (int16_t) (curspr-sprite)+49152; + objtype = (int16_t) (curspr-(uspritetype *)sprite)+49152; //Add 2 boxes at endpoints bsz = walldist; if (gx < 0) bsz = -bsz; @@ -1062,7 +1062,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum, #endif for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j]) { - const spritetype *const spr = &sprite[j]; + const uspritetype *const spr = (uspritetype *)&sprite[j]; const int32_t cstat = spr->cstat; if ((cstat&dasprclipmask) == 0) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 98f65c247..c6d5cdc88 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -362,7 +362,7 @@ uint8_t yax_gotsector[MAXSECTORS>>3]; // engine internal int16_t yax_bunchnum[MAXSECTORS][2]; int16_t yax_nextwall[MAXWALLS][2]; -static inline int32_t yax_islockededge(int32_t line, int32_t cf) +FORCE_INLINE int32_t yax_islockededge(int32_t line, int32_t cf) { return !!(wall[line].cstat&(YAX_NEXTWALLBIT(cf))); } @@ -376,17 +376,14 @@ int16_t yax_getbunch(int16_t i, int16_t cf) if (editstatus==0) return yax_bunchnum[i][cf]; - if (((*(§or[i].ceilingstat + cf))&YAX_BIT)==0) - return -1; - - return YAX_BUNCHNUM(i, cf); + return (*(§or[i].ceilingstat + cf) & YAX_BIT) ? YAX_BUNCHNUM(i, cf) : -1; } # else # define YAX_PTRBUNCHNUM(Ptr, Sect, Cf) (*((Cf) ? &(Ptr)[Sect].floorbunch : &(Ptr)[Sect].ceilingbunch)) # define YAX_BUNCHNUM(Sect, Cf) YAX_PTRBUNCHNUM(sector, Sect, Cf) # if !defined NEW_MAP_FORMAT -static inline int32_t yax_islockededge(int32_t line, int32_t cf) +FORCE_INLINE int32_t yax_islockededge(int32_t line, int32_t cf) { return (yax_getnextwall(line, cf) >= 0); } @@ -410,13 +407,10 @@ void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum) if (bunchnum < 0) { - int32_t j; - int16_t ynw; - if (bunchnum > -3) { // TODO: for in-game too? - for (j=sector[i].wallptr; j= 0) @@ -458,10 +452,7 @@ int16_t yax_getnextwall(int16_t wal, int16_t cf) if (editstatus==0) return yax_nextwall[wal][cf]; - if (!yax_islockededge(wal, cf)) - return -1; - - return YAX_NEXTWALL(wal, cf); + return yax_islockededge(wal, cf) ? YAX_NEXTWALL(wal, cf) : -1; } // unchecked! @@ -655,12 +646,11 @@ void yax_update(int32_t resetstat) int32_t yax_getneighborsect(int32_t x, int32_t y, int32_t sectnum, int32_t cf) { int16_t bunchnum = yax_getbunch(sectnum, cf); - int32_t i; if (bunchnum < 0) return -1; - for (SECTORS_OF_BUNCH(bunchnum, !cf, i)) + for (int SECTORS_OF_BUNCH(bunchnum, !cf, i)) if (inside(x, y, i)==1) return i; @@ -1974,7 +1964,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc) setupmvlineasm(globalshiftval, saturatevplc); int32_t x = x1; - while ((x <= x2) && (startumost[x+windowx1] > startdmost[x+windowx1])) + while ((x <= x2) && (startumost[x+windowxy1.x] > startdmost[x+windowxy1.x])) x++; intptr_t p = x+frameoffset; @@ -1989,8 +1979,8 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc) #ifdef MULTI_COLUMN_VLINE for (; (x<=x2)&&(p&3); x++,p++) { - y1ve[0] = max(uwall[x],startumost[x+windowx1]-windowy1); - y2ve[0] = min(dwall[x],startdmost[x+windowx1]-windowy1); + y1ve[0] = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y); + y2ve[0] = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y); if (y2ve[0] <= y1ve[0]) continue; palookupoffse[0] = fpalookup + getpalookupsh(mulscale16(swall[x],globvis)); @@ -2006,8 +1996,8 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc) for (int z=3,dax=x+3; z>=0; z--,dax--) { - y1ve[z] = max(uwall[dax],startumost[dax+windowx1]-windowy1); - y2ve[z] = min(dwall[dax],startdmost[dax+windowx1]-windowy1)-1; + y1ve[z] = max(uwall[dax],startumost[dax+windowxy1.x]-windowxy1.y); + y2ve[z] = min(dwall[dax],startdmost[dax+windowxy1.x]-windowxy1.y)-1; if (y2ve[z] < y1ve[z]) { bad += pow2char[z]; continue; } calc_bufplc(&bufplce[z], lwall[dax], tsiz); @@ -2062,8 +2052,8 @@ do_mvlineasm1: #endif for (; x<=x2; x++,p++) { - y1ve[0] = max(uwall[x],startumost[x+windowx1]-windowy1); - y2ve[0] = min(dwall[x],startdmost[x+windowx1]-windowy1); + y1ve[0] = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y); + y2ve[0] = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y); if (y2ve[0] <= y1ve[0]) continue; palookupoffse[0] = fpalookup + getpalookupsh(mulscale16(swall[x],globvis)); @@ -3102,10 +3092,10 @@ do_vlineasm1: // static void transmaskvline(int32_t x) { - if ((unsigned)x >= xdimen) return; + if ((unsigned)x >= (unsigned)xdimen) return; - int32_t const y1v = max(uwall[x],startumost[x+windowx1]-windowy1); - int32_t const y2v = min(dwall[x],startdmost[x+windowx1]-windowy1) - 1; + int32_t const y1v = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y); + int32_t const y2v = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y) - 1; if (y2v < y1v) return; @@ -3135,17 +3125,17 @@ static void transmaskvline(int32_t x) #ifdef MULTI_COLUMN_VLINE static void transmaskvline2(int32_t x) { - if ((unsigned)x >= xdimen) return; + if ((unsigned)x >= (unsigned)xdimen) return; if (x == xdimen-1) { transmaskvline(x); return; } int32_t y1ve[2], y2ve[2]; int32_t x2 = x+1; - y1ve[0] = max(uwall[x],startumost[x+windowx1]-windowy1); - y2ve[0] = min(dwall[x],startdmost[x+windowx1]-windowy1)-1; + y1ve[0] = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y); + y2ve[0] = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y)-1; if (y2ve[0] < y1ve[0]) { transmaskvline(x2); return; } - y1ve[1] = max(uwall[x2],startumost[x2+windowx1]-windowy1); - y2ve[1] = min(dwall[x2],startdmost[x2+windowx1]-windowy1)-1; + y1ve[1] = max(uwall[x2],startumost[x2+windowxy1.x]-windowxy1.y); + y2ve[1] = min(dwall[x2],startdmost[x2+windowxy1.x]-windowxy1.y)-1; if (y2ve[1] < y1ve[1]) { transmaskvline(x); return; } palookupoffse[0] = FP_OFF(palookup[globalpal]) + getpalookupsh(mulscale16(swall[x],globvis)); @@ -3211,7 +3201,7 @@ static void transmaskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc) setuptvlineasm(globalshiftval, saturatevplc); int32_t x = x1; - while ((x <= x2) && (startumost[x+windowx1] > startdmost[x+windowx1])) + while ((x <= x2) && (startumost[x+windowxy1.x] > startdmost[x+windowxy1.x])) ++x; #ifndef ENGINE_USING_A_C @@ -4872,8 +4862,7 @@ static void drawsprite_classic(int32_t snum) if (cstat&2) setup_blend(blendidx, cstat&512); - int32_t xoff = picanm[tilenum].xofs + tspr->xoffset; - int32_t yoff = picanm[tilenum].yofs + tspr->yoffset; + vec2_t off = { picanm[tilenum].xofs + tspr->xoffset, picanm[tilenum].yofs + tspr->yoffset }; if ((cstat&48) == 0) { @@ -4883,49 +4872,39 @@ static void drawsprite_classic(int32_t snum) draw_as_face_sprite: if (yp <= (4<<8)) return; - const int32_t siz = divscale19(xdimenscale,yp); + int const isiz = divscale19(xdimenscale,yp); + int const xv = mulscale16(((int32_t)tspr->xrepeat)<<16,xyaspect); + vec2_t const span = tilesiz[tilenum]; + vec2_t const siz = { mulscale30(isiz, xv * span.x), mulscale14(isiz, tspr->yrepeat * span.y) }; - const int32_t xv = mulscale16(((int32_t)tspr->xrepeat)<<16,xyaspect); - - const int32_t xspan = tilesiz[tilenum].x; - const int32_t yspan = tilesiz[tilenum].y; - - const int32_t xsiz = mulscale30(siz,xv*xspan); - const int32_t ysiz = mulscale14(siz,tspr->yrepeat*yspan); - - if (EDUKE32_PREDICT_FALSE((xspan>>11) >= xsiz || yspan >= (ysiz>>1))) + if (EDUKE32_PREDICT_FALSE((span.x>>11) >= siz.x || span.y >= (siz.y>>1))) return; //Watch out for divscale overflow - x1 = xb-(xsiz>>1); - if (xspan&1) x1 += mulscale31(siz,xv); //Odd xspans - i = mulscale30(siz,xv*xoff); + x1 = xb-(siz.x>>1); + if (span.x&1) x1 += mulscale31(isiz,xv); //Odd xspans + i = mulscale30(isiz,xv*off.x); if ((cstat&4) == 0) x1 -= i; else x1 += i; - y1 = mulscale16(tspr->z-globalposz,siz); - y1 -= mulscale14(siz,tspr->yrepeat*yoff); - y1 += (globalhoriz<<8)-ysiz; + y1 = mulscale16(tspr->z-globalposz,isiz); + y1 -= mulscale14(isiz,tspr->yrepeat*off.y); + y1 += (globalhoriz<<8)-siz.y; if (cstat&128) { - y1 += (ysiz>>1); - if (yspan&1) y1 += mulscale15(siz,tspr->yrepeat); //Odd yspans + y1 += (siz.y>>1); + if (span.y&1) y1 += mulscale15(isiz,tspr->yrepeat); //Odd yspans } - x2 = x1+xsiz-1; - y2 = y1+ysiz-1; + x2 = x1+siz.x-1; + y2 = y1+siz.y-1; if ((y1|255) >= (y2|255)) return; int32_t lx = (x1>>8)+1; if (lx < 0) lx = 0; int32_t rx = (x2>>8); if (rx >= xdimen) rx = xdimen-1; if (lx > rx) return; - if ((sec->ceilingstat&3) == 0) - startum = globalhoriz+mulscale24(siz,sec->ceilingz-globalposz)-1; - else - startum = 0; - if ((sec->floorstat&3) == 0) - startdm = globalhoriz+mulscale24(siz,sec->floorz-globalposz)+1; - else - startdm = INT32_MAX; + startum = ((sec->ceilingstat&3) == 0) ? globalhoriz+mulscale24(isiz,sec->ceilingz-globalposz)-1 : 0; + startdm = ((sec->floorstat&3) == 0) ? globalhoriz+mulscale24(isiz,sec->floorz-globalposz)+1 : INT32_MAX; + if ((y1>>8) > startum) startum = (y1>>8); if ((y2>>8) < startdm) startdm = (y2>>8); @@ -4935,12 +4914,12 @@ draw_as_face_sprite: if ((cstat&4) == 0) { - linuminc = divscale24(xspan,xsiz); + linuminc = divscale24(span.x,siz.x); linum = mulscale8((lx<<8)-x1,linuminc); } else { - linuminc = -divscale24(xspan,xsiz); + linuminc = -divscale24(span.x,siz.x); linum = mulscale8((lx<<8)-x2,linuminc); } @@ -4951,21 +4930,21 @@ draw_as_face_sprite: #ifdef CLASSIC_SLICE_BY_4 for (; x<=rx-4; x+=4) { - uwall[x] = max(startumost[windowx1+x]-windowy1, (int16_t) startum); - uwall[x+1] = max(startumost[windowx1+x+1]-windowy1, (int16_t) startum); - uwall[x+2] = max(startumost[windowx1+x+2]-windowy1, (int16_t) startum); - uwall[x+3] = max(startumost[windowx1+x+3]-windowy1, (int16_t) startum); + uwall[x] = max(startumost[windowxy1.x+x]-windowxy1.y, (int16_t) startum); + uwall[x+1] = max(startumost[windowxy1.x+x+1]-windowxy1.y, (int16_t) startum); + uwall[x+2] = max(startumost[windowxy1.x+x+2]-windowxy1.y, (int16_t) startum); + uwall[x+3] = max(startumost[windowxy1.x+x+3]-windowxy1.y, (int16_t) startum); - dwall[x] = min(startdmost[windowx1+x]-windowy1, (int16_t) startdm); - dwall[x+1] = min(startdmost[windowx1+x+1]-windowy1, (int16_t) startdm); - dwall[x+2] = min(startdmost[windowx1+x+2]-windowy1, (int16_t) startdm); - dwall[x+3] = min(startdmost[windowx1+x+3]-windowy1, (int16_t) startdm); + dwall[x] = min(startdmost[windowxy1.x+x]-windowxy1.y, (int16_t) startdm); + dwall[x+1] = min(startdmost[windowxy1.x+x+1]-windowxy1.y, (int16_t) startdm); + dwall[x+2] = min(startdmost[windowxy1.x+x+2]-windowxy1.y, (int16_t) startdm); + dwall[x+3] = min(startdmost[windowxy1.x+x+3]-windowxy1.y, (int16_t) startdm); } #endif for (; x<=rx; x++) { - uwall[x] = max(startumost[windowx1+x]-windowy1,(int16_t)startum); - dwall[x] = min(startdmost[windowx1+x]-windowy1,(int16_t)startdm); + uwall[x] = max(startumost[windowxy1.x+x]-windowxy1.y,(int16_t)startum); + dwall[x] = min(startdmost[windowxy1.x+x]-windowxy1.y,(int16_t)startdm); } int32_t daclip = 0; @@ -5041,7 +5020,7 @@ draw_as_face_sprite: searchstat = 3; searchit = 1; } - setup_globals_sprite1(tspr, sec, yspan, yoff, tilenum, cstat, &z1, &z2); + setup_globals_sprite1(tspr, sec, span.y, off.y, tilenum, cstat, &z1, &z2); qinterpolatedown16((intptr_t)&lwall[lx],rx-lx+1,linum,linuminc); clearbuf(&swall[lx],rx-lx+1,mulscale19(yp,xdimscale)); @@ -5052,7 +5031,7 @@ draw_as_face_sprite: // initialize the float of the union ((cstat&8) ? -1 : 1) * (float)yp * xdimscale - * (1<<(22-19)) / (yspan*tspr->yrepeat) + * (1<<(22-19)) / (span.y*tspr->yrepeat) }; clearbuf(&swallf[lx], rx-lx+1, sw.i); @@ -5075,10 +5054,10 @@ draw_as_face_sprite: const int32_t xv = tspr->xrepeat*sintable[(tspr->ang+2560+1536)&2047]; const int32_t yv = tspr->xrepeat*sintable[(tspr->ang+2048+1536)&2047]; - if ((cstat&4) > 0) xoff = -xoff; - if ((cstat&8) > 0) yoff = -yoff; + if ((cstat&4) > 0) off.x = -off.x; + if ((cstat&8) > 0) off.y = -off.y; - i = (xspan>>1) + xoff; + i = (xspan>>1) + off.x; x1 = tspr->x-globalposx-mulscale16(xv,i); x2 = x1+mulscale16(xv,xspan); y1 = tspr->y-globalposy-mulscale16(yv,i); y2 = y1+mulscale16(yv,xspan); @@ -5142,7 +5121,7 @@ draw_as_face_sprite: rx1[MAXWALLSB-1] = p1.x; ry1[MAXWALLSB-1] = p1.y; rx2[MAXWALLSB-1] = p2.x; ry2[MAXWALLSB-1] = p2.y; - setup_globals_sprite1(tspr, sec, yspan, yoff, tilenum, cstat, &z1, &z2); + setup_globals_sprite1(tspr, sec, yspan, off.y, tilenum, cstat, &z1, &z2); if ((sec->ceilingstat&1) == 0 && z1 < sec->ceilingz) z1 = sec->ceilingz; @@ -5352,8 +5331,8 @@ draw_as_face_sprite: if ((globalposz > tspr->z) == ((cstat&8)==0)) return; - if ((cstat&4) > 0) xoff = -xoff; - if ((cstat&8) > 0) yoff = -yoff; + if ((cstat&4) > 0) off.x = -off.x; + if ((cstat&8) > 0) off.y = -off.y; const int32_t xspan = tilesiz[tilenum].x; const int32_t yspan = tilesiz[tilenum].y; @@ -5368,8 +5347,8 @@ draw_as_face_sprite: i = ((tspr->ang+2048-globalang)&2047); int32_t cosang = sintable[(i+512)&2047]; int32_t sinang = sintable[i]; - dax = ((xspan>>1)+xoff)*tspr->xrepeat; - day = ((yspan>>1)+yoff)*tspr->yrepeat; + dax = ((xspan>>1)+off.x)*tspr->xrepeat; + day = ((yspan>>1)+off.y)*tspr->yrepeat; rzi[0] += dmulscale12(sinang,dax,cosang,day); rxi[0] += dmulscale12(sinang,day,-cosang,dax); @@ -5582,8 +5561,8 @@ draw_as_face_sprite: for (x=lx; x<=rx; x++) { - uwall[x] = max(uwall[x],startumost[x+windowx1]-windowy1); - dwall[x] = min(dwall[x],startdmost[x+windowx1]-windowy1); + uwall[x] = max(uwall[x],startumost[x+windowxy1.x]-windowxy1.y); + dwall[x] = min(dwall[x],startdmost[x+windowxy1.x]-windowxy1.y); } //Additional uwall/dwall clipping goes here @@ -5691,8 +5670,8 @@ draw_as_face_sprite: for (x=lx; x<=rx; x++) { - lwall[x] = startumost[x+windowx1]-windowy1; - swall[x] = startdmost[x+windowx1]-windowy1; + lwall[x] = startumost[x+windowxy1.x]-windowxy1.y; + swall[x] = startdmost[x+windowxy1.x]-windowxy1.y; } for (i=smostwallcnt-1; i>=0; i--) { @@ -5781,8 +5760,8 @@ draw_as_face_sprite: } if (!(cstat&128)) tspr->z -= mulscale22(B_LITTLE32(longptr[5]),nyrepeat); - yoff = /*picanm[sprite[tspr->owner].picnum].yofs +*/ tspr->yoffset; - tspr->z -= mulscale14(yoff,nyrepeat); + off.y = /*picanm[sprite[tspr->owner].picnum].yofs +*/ tspr->yoffset; + tspr->z -= mulscale14(off.y,nyrepeat); globvis = globalvisibility; if (sec->visibility != 0) globvis = mulscale4(globvis, (uint8_t)(sec->visibility+16)); @@ -5805,7 +5784,7 @@ draw_as_face_sprite: { x1 = xb-(siz.x>>1); if (xspan&1) x1 += mulscale31(xdsiz,xv); //Odd xspans - i = mulscale30(xdsiz,xv*xoff); + i = mulscale30(xdsiz,xv*off.x); if ((cstat&4) == 0) x1 -= i; else x1 += i; y1 = mulscale16(tspr->z-globalposz,xdsiz); @@ -6158,10 +6137,10 @@ static int32_t clippoly(int32_t npoints, int32_t clipstat) int32_t z, zz, s1, s2, t, npoints2, start2, z1, z2, z3, z4, splitcnt; int32_t cx1, cy1, cx2, cy2; - cx1 = windowx1; - cy1 = windowy1; - cx2 = windowx2+1; - cy2 = windowy2+1; + cx1 = windowxy1.x; + cy1 = windowxy1.y; + cx2 = windowxy2.x+1; + cy2 = windowxy2.y+1; cx1 <<= 12; cy1 <<= 12; cx2 <<= 12; cy2 <<= 12; if (clipstat&0xa) //Need to clip top or left @@ -7974,17 +7953,17 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, #endif ) { - shortptr1 = (int16_t *)&startumost[windowx1]; - shortptr2 = (int16_t *)&startdmost[windowx1]; + shortptr1 = (int16_t *)&startumost[windowxy1.x]; + shortptr2 = (int16_t *)&startdmost[windowxy1.x]; i = xdimen-1; do { - umost[i] = shortptr1[i]-windowy1; - dmost[i] = shortptr2[i]-windowy1; + umost[i] = shortptr1[i]-windowxy1.y; + dmost[i] = shortptr2[i]-windowxy1.y; } while (i--); // xdimen == 1 is OK! - umost[0] = shortptr1[0]-windowy1; - dmost[0] = shortptr2[0]-windowy1; + umost[0] = shortptr1[0]-windowxy1.y; + dmost[0] = shortptr2[0]-windowxy1.y; } #ifdef USE_OPENGL @@ -8044,7 +8023,7 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, draw_rainbow_background(); #endif - frameoffset = frameplace + windowy1*bytesperline + windowx1; + frameoffset = frameplace + windowxy1.y*bytesperline + windowxy1.x; //if (smostwallcnt < 0) // if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4) @@ -8278,7 +8257,7 @@ static inline int32_t sameside(const _equation *eq, const vec2f_t *p1, c // x1, y1: in/out // rest x/y: out -void get_wallspr_points(const spritetype *spr, int32_t *x1, int32_t *x2, +void get_wallspr_points(const uspritetype *spr, int32_t *x1, int32_t *x2, int32_t *y1, int32_t *y2); void get_floorspr_points(const uspritetype *spr, int32_t px, int32_t py, int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, @@ -8531,7 +8510,7 @@ killsprite: if ((tspr->cstat & 48) != 16) tspriteptr[i]->ang = globalang; - get_wallspr_points((const spritetype *)tspr, &xx[0], &xx[1], &yy[0], &yy[1]); + get_wallspr_points((const uspritetype *)tspr, &xx[0], &xx[1], &yy[0], &yy[1]); if ((tspr->cstat & 48) == 0) tspriteptr[i]->ang = oang; @@ -8663,8 +8642,8 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) Bmemset(gotsector, 0, (numsectors+7)>>3); - vec2_t const c1 ={ (windowx1<<12), (windowy1<<12) }; - vec2_t const c2 ={ ((windowx2+1)<<12)-1, ((windowy2+1)<<12)-1 }; + vec2_t const c1 ={ (windowxy1.x<<12), (windowxy1.y<<12) }; + vec2_t const c2 ={ ((windowxy2.x+1)<<12)-1, ((windowxy2.y+1)<<12)-1 }; zoome <<= 8; @@ -9835,8 +9814,8 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1 if (numsprites > 0) { - spritetype *const tspri = (spritetype *)Xmalloc(sizeof(spritetype) * numsprites); - spritetype *spri = tspri; + uspritetype *const tspri = (uspritetype *)Xmalloc(sizeof(spritetype) * numsprites); + uspritetype *spri = tspri; for (j=0; jpicnum, yrepeat=spr->yrepeat; @@ -11163,13 +11142,13 @@ static int32_t hitscan_trysector(const vec3_t *sv, const usectortype *sec, hitda else { const int32_t curidx=(int32_t)tmp[0]; - const spritetype *const curspr=(spritetype *)tmp[1]; + const uspritetype *const curspr=(uspritetype *)tmp[1]; const int32_t thislastsec = tmp[2]; if (!thislastsec) { if (inside(x1,y1,sec-(usectortype *)sector) == 1) - hit_set(hit, curspr->sectnum, -1, curspr-sprite, x1, y1, z1); + hit_set(hit, curspr->sectnum, -1, curspr-(uspritetype *)sprite, x1, y1, z1); } #ifdef HAVE_CLIPSHAPE_FEATURE else @@ -11178,7 +11157,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, const usectortype *sec, hitda { if (inside(x1,y1,sectq[i]) == 1) { - hit_set(hit, curspr->sectnum, -1, curspr-sprite, x1, y1, z1); + hit_set(hit, curspr->sectnum, -1, curspr-(uspritetype *)sprite, x1, y1, z1); break; } } @@ -11192,7 +11171,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, const usectortype *sec, hitda // x1, y1: in/out // rest x/y: out -void get_wallspr_points(const spritetype *spr, int32_t *x1, int32_t *x2, +void get_wallspr_points(uspritetype const * const spr, int32_t *x1, int32_t *x2, int32_t *y1, int32_t *y2) { //These lines get the 2 points of the rotated sprite @@ -11221,7 +11200,7 @@ void get_wallspr_points(const spritetype *spr, int32_t *x1, int32_t *x2, // x1, y1: in/out // rest x/y: out -void get_floorspr_points(const uspritetype *spr, int32_t px, int32_t py, +void get_floorspr_points(uspritetype const * const spr, int32_t px, int32_t py, int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, int32_t *y1, int32_t *y2, int32_t *y3, int32_t *y4) { @@ -11289,7 +11268,7 @@ static int32_t get_floorspr_clipyou(int32_t x1, int32_t x2, int32_t x3, int32_t } // intp: point of currently best (closest) intersection -static int32_t try_facespr_intersect(const spritetype *spr, const vec3_t *refpos, +static int32_t try_facespr_intersect(uspritetype const * const spr, const vec3_t *refpos, int32_t vx, int32_t vy, int32_t vz, vec3_t *intp, int32_t strictly_smaller_than_p) { @@ -11346,7 +11325,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32 int32_t i, k, daz; int16_t tempshortcnt, tempshortnum; - spritetype *curspr = NULL; + uspritetype *curspr = NULL; int32_t clipspritecnt, curidx=-1; // tmp: { (int32_t)curidx, (spritetype *)curspr, (!=0 if outer sector) } intptr_t tmp[3], *tmpptr=NULL; @@ -11382,7 +11361,7 @@ restart_grand: if (!curspr) mapinfo_set(&origmapinfo, &clipmapinfo); // replace sector and wall with clip map - curspr = &sprite[clipspritelist[clipspritecnt]]; + curspr = (uspritetype *)&sprite[clipspritelist[clipspritecnt]]; curidx = clipshape_idx_for_sprite(curspr, curidx); if (curidx < 0) @@ -11460,7 +11439,7 @@ restart_grand: if (wal->cstat&dawalclipmask) { - hit_set(hit, curspr->sectnum, -1, curspr-sprite, intx, inty, intz); + hit_set(hit, curspr->sectnum, -1, curspr-(uspritetype *)sprite, intx, inty, intz); continue; } @@ -11469,7 +11448,7 @@ restart_grand: // ceil cz daz daz2 fz floor if ((cz <= intz && intz <= daz) || (daz2 <= intz && intz <= fz)) { - hit_set(hit, curspr->sectnum, -1, curspr-sprite, intx, inty, intz); + hit_set(hit, curspr->sectnum, -1, curspr-(uspritetype *)sprite, intx, inty, intz); continue; } } @@ -11490,7 +11469,7 @@ restart_grand: #endif for (z=headspritesect[dasector]; z>=0; z=nextspritesect[z]) { - const spritetype *const spr = &sprite[z]; + const uspritetype *const spr = (uspritetype *)&sprite[z]; const int32_t cstat = spr->cstat; #ifdef USE_OPENGL if (!hitallsprites) @@ -11740,7 +11719,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, for (z=headspritesect[dasector]; z>=0; z=nextspritesect[z]) { - const spritetype *const spr = &sprite[z]; + const uspritetype *const spr = (uspritetype *)&sprite[z]; if (blacklist_sprite_func && blacklist_sprite_func(z)) continue; @@ -12265,7 +12244,7 @@ void getzrange(const vec3_t *pos, int16_t sectnum, int32_t mcf=-1; #endif - spritetype *curspr=NULL; // non-NULL when handling sprite with sector-like clipping + uspritetype *curspr=NULL; // non-NULL when handling sprite with sector-like clipping int32_t curidx=-1, clipspritecnt = 0; //Extra walldist for sprites on sector lines @@ -12307,7 +12286,7 @@ restart_grand: { // one set of clip-sprite sectors completed, prepare the next - curspr = &sprite[clipspritelist[clipspritecnt]]; + curspr = (uspritetype *)&sprite[clipspritelist[clipspritecnt]]; curidx = clipshape_idx_for_sprite(curspr, curidx); if (curidx < 0) @@ -12329,7 +12308,7 @@ restart_grand: int32_t fz, cz; getzsofslope(k,pos->x,pos->y,&daz,&daz2); getzsofslope(sectq[clipinfo[curidx].qend],pos->x,pos->y,&cz,&fz); - const int hitwhat = (curspr-sprite)+49152; + const int hitwhat = (curspr-(uspritetype *)sprite)+49152; if ((sector[k].ceilingstat&1)==0) { @@ -12413,7 +12392,7 @@ restart_grand: #ifdef HAVE_CLIPSHAPE_FEATURE if (curspr) { - int32_t fz,cz, hitwhat=(curspr-sprite)+49152; + int32_t fz,cz, hitwhat=(curspr-(uspritetype *)sprite)+49152; getzsofslope(sectq[clipinfo[curidx].qend],pos->x,pos->y,&cz,&fz); if ((sec->ceilingstat&1)==0) @@ -12476,7 +12455,7 @@ restart_grand: int32_t clipyou = 0; #ifdef HAVE_CLIPSHAPE_FEATURE - if (clipsprite_try(&sprite[j], xmin,ymin, xmax,ymax)) + if (clipsprite_try((uspritetype *)&sprite[j], xmin,ymin, xmax,ymax)) continue; #endif x1 = sprite[j].x; y1 = sprite[j].y; @@ -12497,7 +12476,7 @@ restart_grand: case 16: { - get_wallspr_points(&sprite[j], &x1, &x2, &y1, &y2); + get_wallspr_points((uspritetype *)&sprite[j], &x1, &x2, &y1, &y2); if (clipinsideboxline(pos->x,pos->y,x1,y1,x2,y2,walldist+1) != 0) { @@ -12710,10 +12689,10 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2) { int32_t i; - windowx1 = x1; wx1 = (x1<<12); - windowy1 = y1; wy1 = (y1<<12); - windowx2 = x2; wx2 = ((x2+1)<<12); - windowy2 = y2; wy2 = ((y2+1)<<12); + windowxy1.x = x1; wx1 = (x1<<12); + windowxy1.y = y1; wy1 = (y1<<12); + windowxy2.x = x2; wx2 = ((x2+1)<<12); + windowxy2.y = y2; wy2 = ((y2+1)<<12); xdimen = (x2-x1)+1; halfxdimen = (xdimen>>1); xdimenrecip = divscale32(1L,xdimen); @@ -12725,11 +12704,11 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2) #endif setaspect_new(); - for (i=0; i= numwalls) + if ((unsigned)theline >= (unsigned)numwalls) return -1; int i = wall[theline].nextwall; @@ -13143,7 +13122,7 @@ int32_t sectorofwall(int16_t theline) int32_t sectorofwall_noquick(int16_t theline) { - if ((unsigned)theline >= numwalls) + if ((unsigned)theline >= (unsigned)numwalls) return -1; return sectorofwall_internal(theline); @@ -13158,7 +13137,7 @@ int32_t getceilzofslopeptr(const sectortype *sec, int32_t dax, int32_t day) uwalltype const *wal = (uwalltype *)&wall[sec->wallptr]; // floor(sqrt(2**31-1)) == 46340 - vec2_t const w = *(vec2_t *) wal; + vec2_t const w = *(vec2_t const *)wal; vec2_t const d ={ wall[wal->point2].x-w.x , wall[wal->point2].y-w.y }; int32_t const i = nsqrtasm(uhypsq(d.x,d.y))<<5; @@ -13175,7 +13154,7 @@ int32_t getflorzofslopeptr(const sectortype *sec, int32_t dax, int32_t day) uwalltype const *wal = (uwalltype *) &wall[sec->wallptr]; - vec2_t const w = *(vec2_t *) wal; + vec2_t const w = *(vec2_t const *)wal; vec2_t const d ={ wall[wal->point2].x-w.x , wall[wal->point2].y-w.y }; int32_t const i = nsqrtasm(uhypsq(d.x,d.y))<<5; @@ -13344,22 +13323,20 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall) wall[wall[i].nextwall].nextwall = i; #ifdef YAX_ENABLE + int16_t cb, fb; + yax_getbunches(sectnum, &cb, &fb); + + if (cb>=0 || fb>=0) { - int16_t cb, fb; - yax_getbunches(sectnum, &cb, &fb); - - if (cb>=0 || fb>=0) + for (i=startwall; i= 0) - yax_setnextwall(j, YAX_FLOOR, i); + j = yax_getnextwall(i, YAX_CEILING); + if (j >= 0) + yax_setnextwall(j, YAX_FLOOR, i); - j = yax_getnextwall(i, YAX_FLOOR); - if (j >= 0) - yax_setnextwall(j, YAX_CEILING, i); - } + j = yax_getnextwall(i, YAX_FLOOR); + if (j >= 0) + yax_setnextwall(j, YAX_CEILING, i); } } #endif diff --git a/polymer/eduke32/build/src/engine_priv.h b/polymer/eduke32/build/src/engine_priv.h index 3df010755..feddd703a 100644 --- a/polymer/eduke32/build/src/engine_priv.h +++ b/polymer/eduke32/build/src/engine_priv.h @@ -316,9 +316,9 @@ void calc_and_apply_fog(int32_t tile, int32_t shade, int32_t vis, int32_t pal); void calc_and_apply_fog_factor(int32_t tile, int32_t shade, int32_t vis, int32_t pal, float factor); #endif -extern void get_wallspr_points(const spritetype *spr, int32_t *x1, int32_t *x2, +extern void get_wallspr_points(uspritetype const * const spr, int32_t *x1, int32_t *x2, int32_t *y1, int32_t *y2); -extern void get_floorspr_points(const uspritetype *spr, int32_t px, int32_t py, +extern void get_floorspr_points(uspritetype const * const spr, int32_t px, int32_t py, int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, int32_t *y1, int32_t *y2, int32_t *y3, int32_t *y4); diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index bfbcd290b..397fe00a0 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -917,8 +917,8 @@ void polymer_setaspect(int32_t ang) if (pr_customaspect != 0.0f) aspect = pr_customaspect; else - aspect = (float)(windowx2-windowx1+1) / - (float)(windowy2-windowy1+1); + aspect = (float)(windowxy2.x-windowxy1.x+1) / + (float)(windowxy2.y-windowxy1.y+1); bglMatrixMode(GL_PROJECTION); bglLoadIdentity(); @@ -930,7 +930,7 @@ void polymer_glinit(void) bglClearColor(0.0f, 0.0f, 0.0f, 1.0f); bglClearStencil(0); bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - bglViewport(windowx1, yres-(windowy2+1),windowx2-windowx1+1, windowy2-windowy1+1); + bglViewport(windowxy1.x, yres-(windowxy2.y+1),windowxy2.x-windowxy1.x+1, windowxy2.y-windowxy1.y+1); // texturing bglEnable(GL_TEXTURE_2D); @@ -2033,7 +2033,7 @@ static void polymer_displayrooms(const int16_t dacursectnum) { bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, prrts[0].fbo); bglPushAttrib(GL_VIEWPORT_BIT); - bglViewport(windowx1, yres-(windowy2+1),windowx2-windowx1+1, windowy2-windowy1+1); + bglViewport(windowxy1.x, yres-(windowxy2.y+1),windowxy2.x-windowxy1.x+1, windowxy2.y-windowxy1.y+1); bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index ba9c36e1c..744dc76dc 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -570,19 +570,19 @@ static void resizeglcheck(void) bglPolygonMode(GL_FRONT_AND_BACK,GL_FILL); #endif - if ((glox1 != windowx1) || (gloy1 != windowy1) || (glox2 != windowx2) || (gloy2 != windowy2)) + if ((glox1 != windowxy1.x) || (gloy1 != windowxy1.y) || (glox2 != windowxy2.x) || (gloy2 != windowxy2.y)) { - const int32_t ourxdimen = (windowx2-windowx1+1); + const int32_t ourxdimen = (windowxy2.x-windowxy1.x+1); float ratio = get_projhack_ratio(); const int32_t fovcorrect = (int32_t)(ourxdimen*ratio - ourxdimen); ratio = 1.f/ratio; - glox1 = (float)windowx1; gloy1 = (float)windowy1; - glox2 = (float)windowx2; gloy2 = (float)windowy2; + glox1 = (float)windowxy1.x; gloy1 = (float)windowxy1.y; + glox2 = (float)windowxy2.x; gloy2 = (float)windowxy2.y; - bglViewport(windowx1-(fovcorrect/2), yres-(windowy2+1), - ourxdimen+fovcorrect, windowy2-windowy1+1); + bglViewport(windowxy1.x-(fovcorrect/2), yres-(windowxy2.y+1), + ourxdimen+fovcorrect, windowxy2.y-windowxy1.y+1); bglMatrixMode(GL_PROJECTION); @@ -1632,11 +1632,12 @@ static inline pthtyp *our_texcache_fetch(int32_t dameth) static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32_t method) { + if (method == DAMETH_BACKFACECULL || #ifdef YAX_ENABLE - if (g_nodraw) return; + g_nodraw || #endif - - if (method == DAMETH_BACKFACECULL || (uint32_t)globalpicnum >= MAXTILES) return; + (uint32_t)globalpicnum >= MAXTILES) + return; const int32_t method_ = method; @@ -1683,9 +1684,9 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 for (int i=0; ihicr && detailpth->hicr->palnum == DETAILPAL) @@ -1782,10 +1783,10 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 } // glow texture - pthtyp *glowpth = NULL; - if (r_glowmapping) { + pthtyp *glowpth = NULL; + if (usehightile && !drawingskybox && hicfindsubst(globalpicnum, GLOWPAL) && (glowpth = texcache_fetch(globalpicnum, GLOWPAL, 0, (method & ~DAMETH_MASKPROPS) | DAMETH_MASK)) && glowpth->hicr && (glowpth->hicr->palnum == GLOWPAL)) @@ -1868,26 +1869,23 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 float const r = 1.f / (opxy[0].x*px[0] + opxy[0].y*px[1] + opxy[0].z*px[2]); - float ngdx = (opxy[0].x*dd[0] + opxy[0].y*dd[1] + opxy[0].z*dd[2])*r, - ngux = (opxy[0].x*uu[0] + opxy[0].y*uu[1] + opxy[0].z*uu[2])*r, - ngvx = (opxy[0].x*vv[0] + opxy[0].y*vv[1] + opxy[0].z*vv[2])*r; + vec3f_t ngx = { (opxy[0].x * dd[0] + opxy[0].y * dd[1] + opxy[0].z * dd[2]) * r, + ((opxy[0].x * uu[0] + opxy[0].y * uu[1] + opxy[0].z * uu[2]) * r) * hacksc.x, + ((opxy[0].x * vv[0] + opxy[0].y * vv[1] + opxy[0].z * vv[2]) * r) * hacksc.y }; - float ngdy = (opxy[1].x*dd[0] + opxy[1].y*dd[1] + opxy[1].z*dd[2])*r, - nguy = (opxy[1].x*uu[0] + opxy[1].y*uu[1] + opxy[1].z*uu[2])*r, - ngvy = (opxy[1].x*vv[0] + opxy[1].y*vv[1] + opxy[1].z*vv[2])*r; + vec3f_t ngy = { (opxy[1].x * dd[0] + opxy[1].y * dd[1] + opxy[1].z * dd[2]) * r, + ((opxy[1].x * uu[0] + opxy[1].y * uu[1] + opxy[1].z * uu[2]) * r) * hacksc.x, + ((opxy[1].x * vv[0] + opxy[1].y * vv[1] + opxy[1].z * vv[2]) * r) * hacksc.y }; - float ngdo = dd[0] - opxy[2].x * ngdx - opxy[2].y * ngdy, - nguo = uu[0] - opxy[2].x * ngux - opxy[2].y * nguy, - ngvo = vv[0] - opxy[2].x * ngvx - opxy[2].y * ngvy; - - ngux *= hacksc.x; nguy *= hacksc.x; nguo *= hacksc.x; - ngvx *= hacksc.y; ngvy *= hacksc.y; ngvo *= hacksc.y; + vec3f_t ngo = { dd[0] - opxy[2].x * ngx.d - opxy[2].y * ngy.d, + (uu[0] - opxy[2].x * ngx.u - opxy[2].y * ngy.u) * hacksc.x, + (vv[0] - opxy[2].x * ngx.v - opxy[2].y * ngy.v) * hacksc.y }; float const uoffs = ((float)(tsiz2.x - tsiz.x) * 0.5f); - ngux -= ngdx * uoffs; - nguy -= ngdy * uoffs; - nguo -= ngdo * uoffs; + ngx.u -= ngx.d * uoffs; + ngy.u -= ngy.d * uoffs; + ngo.u -= ngo.d * uoffs; float du0, du1; @@ -1895,23 +1893,21 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 for (int i=0; i du1) du1 = f; } float const rf = 1.0f / tsiz.x; + int const ix1 = (int)floorf(du1 * rf); - int32_t ix0 = (int)floorf(du0 * rf); - int32_t const ix1 = (int)floorf(du1 * rf); - - for (; ix0<=ix1; ++ix0) + for (int ix0 = (int)floorf(du0 * rf); ix0 <= ix1; ++ix0) { du0 = (float)(ix0 * tsiz.x); // + uoffs; du1 = (float)((ix0 + 1) * tsiz.x); // + uoffs; - float duj = (px[0]*ngux + py[0]*nguy + nguo) / (px[0]*ngdx + py[0]*ngdy + ngdo); + float duj = (px[0]*ngx.u + py[0]*ngy.u + ngo.u) / (px[0]*ngx.d + py[0]*ngy.d + ngo.d); int i = 0, nn = 0; do @@ -1923,7 +1919,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 float const dui = duj; - duj = (px[j]*ngux + py[j]*nguy + nguo) / (px[j]*ngdx + py[j]*ngdy + ngdo); + duj = (px[j]*ngx.u + py[j]*ngy.u + ngo.u) / (px[j]*ngx.d + py[j]*ngy.d + ngo.d); if ((du0 <= dui) && (dui <= du1)) { @@ -1932,22 +1928,22 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 nn++; } - //ox*(ngux-ngdx*du1) + oy*(nguy-ngdy*du1) + (nguo-ngdo*du1) = 0 + //ox*(ngx.u-ngx.d*du1) + oy*(ngy.u-ngdy*du1) + (ngo.u-ngo.d*du1) = 0 //(px[j]-px[i])*f + px[i] = ox //(py[j]-py[i])*f + py[i] = oy ///Solve for f - //((px[j]-px[i])*f + px[i])*(ngux-ngdx*du1) + - //((py[j]-py[i])*f + py[i])*(nguy-ngdy*du1) + (nguo-ngdo*du1) = 0 + //((px[j]-px[i])*f + px[i])*(ngx.u-ngx.d*du1) + + //((py[j]-py[i])*f + py[i])*(ngy.u-ngdy*du1) + (ngo.u-ngo.d*du1) = 0 #define DRAWPOLY_MATH_BULLSHIT(XXX) \ do \ { \ - float const f = -(px[i] * (ngux - ngdx * XXX) + py[i] * (nguy - ngdy * XXX) + (nguo - ngdo * XXX)) / \ - ((px[j] - px[i]) * (ngux - ngdx * XXX) + (py[j] - py[i]) * (nguy - ngdy * XXX)); \ + float const f = -(px[i] * (ngx.u - ngx.d * XXX) + py[i] * (ngy.u - ngy.d * XXX) + (ngo.u - ngo.d * XXX)) / \ + ((px[j] - px[i]) * (ngx.u - ngx.d * XXX) + (py[j] - py[i]) * (ngy.u - ngy.d * XXX)); \ uu[nn] = (px[j] - px[i]) * f + px[i]; \ vv[nn] = (py[j] - py[i]) * f + py[i]; \ - nn++; \ + ++nn; \ } while (0) if (duj <= dui) @@ -1969,30 +1965,28 @@ do if (nn < 3) continue; - vec2f_t const invtsiz2 ={ 1.f / tsiz2.x, 1.f / tsiz2.y }; + vec2f_t const invtsiz2 = { 1.f / tsiz2.x, 1.f / tsiz2.y }; bglBegin(GL_TRIANGLE_FAN); - for (i=0; i GL_TEXTURE0_ARB) { j = GL_TEXTURE0_ARB; while (j <= texunits) - bglMultiTexCoord2fARB(j++, (up * r - du0 + uoffs) * invtsiz2.x, vp * r * invtsiz2.y); + bglMultiTexCoord2fARB(j++, (p.u * r - du0 + uoffs) * invtsiz2.x, p.v * r * invtsiz2.y); } else #endif - bglTexCoord2f((up * r - du0 + uoffs) * invtsiz2.x, vp * r * invtsiz2.y); + bglTexCoord2f((p.u * r - du0 + uoffs) * invtsiz2.x, p.v * r * invtsiz2.y); bglVertex3f((o.x - ghalfx) * r * grhalfxdown10x, (ghoriz - o.y) * r * grhalfxdown10, @@ -2003,11 +1997,11 @@ do } else { - vec2f_t const scale ={ 1.f / tsiz2.x * hacksc.x, 1.f / tsiz2.y * hacksc.y }; + vec2f_t const scale = { 1.f / tsiz2.x * hacksc.x, 1.f / tsiz2.y * hacksc.y }; bglBegin(GL_TRIANGLE_FAN); - for (int i = 0; i < npoints; i++) + for (int i = 0; i < npoints; ++i) { float const r = 1.f / dd[i]; @@ -2048,16 +2042,16 @@ do bglLoadIdentity(); bglMatrixMode(GL_MODELVIEW); - if (getrendermode() == REND_POLYMOST) - { - int const clamp_mode = glinfo.clamptoedge ? GL_CLAMP_TO_EDGE : GL_CLAMP; + if (getrendermode() != REND_POLYMOST) + return; - if (drawpoly_srepeat) - bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, clamp_mode); + int const clamp_mode = glinfo.clamptoedge ? GL_CLAMP_TO_EDGE : GL_CLAMP; - if (drawpoly_trepeat) - bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, clamp_mode); - } + if (drawpoly_srepeat) + bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, clamp_mode); + + if (drawpoly_trepeat) + bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, clamp_mode); if (fullbright_pass == 1) { @@ -2085,7 +2079,7 @@ do static inline void vsp_finalize_init(int32_t const vcnt) { - for (int i=0; i n0.x) && (dm1.x < n1.x)) { - const float t = (dm1.x-n0.x)*cv[dir] - (dm1.y-cy[dir])*dx; - if (((!dir) && (t < 0)) || ((dir) && (t > 0))) + float const t = (dm1.x-n0.x)*cv[dir] - (dm1.y-cy[dir])*dx; + if (((!dir) && (t < 0.f)) || ((dir) && (t > 0.f))) { spx[scnt] = dm1.x; spt[scnt] = -1; scnt++; } } @@ -3864,7 +3858,7 @@ void polymost_drawrooms() if (getrendermode() == REND_CLASSIC) return; begindrawing(); - frameoffset = frameplace + windowy1*bytesperline + windowx1; + frameoffset = frameplace + windowxy1.y*bytesperline + windowxy1.x; resizeglcheck(); #ifdef YAX_ENABLE @@ -3889,14 +3883,14 @@ void polymost_drawrooms() if (redblueclearcnt < numpages) { redblueclearcnt++; bglColorMask(1,1,1,1); bglClear(GL_COLOR_BUFFER_BIT); } if (grbfcnt&1) { - bglViewport(windowx1-16,yres-(windowy2+1),windowx2-(windowx1-16)+1,windowy2-windowy1+1); + bglViewport(windowxy1.x-16,yres-(windowxy2.y+1),windowxy2.x-(windowxy1.x-16)+1,windowxy2.y-windowxy1.y+1); bglColorMask(1,0,0,1); globalposx += singlobalang>>10; globalposy -= cosglobalang>>10; } else { - bglViewport(windowx1,yres-(windowy2+1),windowx2+16-windowx1+1,windowy2-windowy1+1); + bglViewport(windowxy1.x,yres-(windowxy2.y+1),windowxy2.x+16-windowxy1.x+1,windowxy2.y-windowxy1.y+1); bglColorMask(0,1,1,1); globalposx -= singlobalang>>10; globalposy += cosglobalang>>10; @@ -3943,9 +3937,9 @@ void polymost_drawrooms() //Generate viewport trapezoid (for handling screen up/down) vec3f_t p[4] = { { 0-1, 0-1, 0 }, - { (float)(windowx2 + 1 - windowx1 + 2), 0-1, 0 }, - { (float)(windowx2 + 1 - windowx1 + 2), (float)(windowy2 + 1 - windowy1 + 2), 0 }, - { 0-1, (float)(windowy2 + 1 - windowy1 + 2), 0 } }; + { (float)(windowxy2.x + 1 - windowxy1.x + 2), 0-1, 0 }, + { (float)(windowxy2.x + 1 - windowxy1.x + 2), (float)(windowxy2.y + 1 - windowxy1.y + 2), 0 }, + { 0-1, (float)(windowxy2.y + 1 - windowxy1.y + 2), 0 } }; for (int i=0; i<4; i++) { @@ -5070,7 +5064,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a, tspr.cstat = globalorientation = (dastat&RS_TRANS1) | ((dastat&RS_TRANS2)<<4) | ((dastat&RS_YFLIP)<<1); if ((dastat&(RS_AUTO|RS_NOCLIP)) == RS_AUTO) - bglViewport(windowx1, yres-(windowy2+1), windowx2-windowx1+1, windowy2-windowy1+1); + bglViewport(windowxy1.x, yres-(windowxy2.y+1), windowxy2.x-windowxy1.x+1, windowxy2.y-windowxy1.y+1); else { bglViewport(0, 0, xdim, ydim); diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index aee1e6c3f..bd1a40148 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -339,10 +339,10 @@ int32_t G_ToggleWallInterpolation(int32_t w, int32_t doset); # define ACTOR_INLINE_HEADER EXTERN_INLINE_HEADER #endif -extern int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist); +extern int32_t A_MoveSpriteClipdist(int32_t spritenum, vec3_t const * const change, uint32_t cliptype, int32_t clipdist); ACTOR_INLINE_HEADER int A_CheckEnemyTile(int32_t pn); ACTOR_INLINE_HEADER int32_t A_SetSprite(int32_t i,uint32_t cliptype); -ACTOR_INLINE_HEADER int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype); +ACTOR_INLINE_HEADER int32_t A_MoveSprite(int32_t spritenum, vec3_t const * const change, uint32_t cliptype); EXTERN_INLINE_HEADER int32_t G_CheckForSpaceCeiling(int32_t sectnum); EXTERN_INLINE_HEADER int32_t G_CheckForSpaceFloor(int32_t sectnum); @@ -371,7 +371,7 @@ ACTOR_INLINE int32_t A_SetSprite(int32_t i,uint32_t cliptype) return (A_MoveSprite(i,&davect,cliptype)==0); } -ACTOR_INLINE int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) +ACTOR_INLINE int32_t A_MoveSprite(int32_t spritenum, vec3_t const * const change, uint32_t cliptype) { return A_MoveSpriteClipdist(spritenum, change, cliptype, -1); } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 3b9f7dba6..c69653459 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -5425,8 +5425,8 @@ static void Keys3d(void) int32_t x = (xdim <= 640); int32_t chars = Bsprintf(tempbuf, "%2u ms (%3u fps)", howlong, LastCount); - int32_t const dax = m32_is2d3dmode() ? m32_2d3d.x + XSIZE_2D3D - 3: windowx2; - int32_t const day = m32_is2d3dmode() ? m32_2d3d.y + 4 : windowy1; + int32_t const dax = m32_is2d3dmode() ? m32_2d3d.x + XSIZE_2D3D - 3: windowxy2.x; + int32_t const day = m32_is2d3dmode() ? m32_2d3d.y + 4 : windowxy1.y; if (!x) { diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 0197b246f..2a9d49b19 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1062,18 +1062,18 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) { begindrawing(); { - const int32_t height = windowy2-windowy1+1; - const int32_t width = windowx2-windowx1+1; + const int32_t height = windowxy2.y-windowxy1.y+1; + const int32_t width = windowxy2.x-windowxy1.x+1; - uint8_t *f = (uint8_t *)(frameplace + ylookup[windowy1]); + uint8_t *f = (uint8_t *)(frameplace + ylookup[windowxy1.y]); int32_t x, y; for (y=0; y < (height>>1); y++) - swapbufreverse(f + y*bytesperline + windowx2, - f + (height-1-y)*bytesperline + windowx1, + swapbufreverse(f + y*bytesperline + windowxy2.x, + f + (height-1-y)*bytesperline + windowxy1.x, width); - f += (height>>1)*bytesperline + windowx1; + f += (height>>1)*bytesperline + windowxy1.x; if (height&1) for (x=0; x<(width>>1); x++) diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 12c84e6d7..393bb7f67 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -1661,10 +1661,10 @@ static void Gv_AddSystemVars(void) Gv_NewVar("looking_angSR1",(intptr_t)&hudweap.lookhalfang, GAMEVAR_INTPTR | GAMEVAR_SYSTEM); Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); - Gv_NewVar("windowx1",(intptr_t)&windowx1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); - Gv_NewVar("windowx2",(intptr_t)&windowx2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); - Gv_NewVar("windowy1",(intptr_t)&windowy1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); - Gv_NewVar("windowy2",(intptr_t)&windowy2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); + Gv_NewVar("windowx1",(intptr_t)&windowxy1.x, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); + Gv_NewVar("windowx2",(intptr_t)&windowxy2.x, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); + Gv_NewVar("windowy1",(intptr_t)&windowxy1.y, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); + Gv_NewVar("windowy2",(intptr_t)&windowxy2.y, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); Gv_NewVar("totalclock",(intptr_t)&totalclock, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); Gv_NewVar("lastvisinc",(intptr_t)&lastvisinc, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY); @@ -1839,10 +1839,10 @@ void Gv_RefreshPointers(void) aGameVars[Gv_GetVarIndex("looking_angSR1")].val.lValue = (intptr_t)&hudweap.lookhalfang; aGameVars[Gv_GetVarIndex("xdim")].val.lValue = (intptr_t)&xdim; aGameVars[Gv_GetVarIndex("ydim")].val.lValue = (intptr_t)&ydim; - aGameVars[Gv_GetVarIndex("windowx1")].val.lValue = (intptr_t)&windowx1; - aGameVars[Gv_GetVarIndex("windowx2")].val.lValue = (intptr_t)&windowx2; - aGameVars[Gv_GetVarIndex("windowy1")].val.lValue = (intptr_t)&windowy1; - aGameVars[Gv_GetVarIndex("windowy2")].val.lValue = (intptr_t)&windowy2; + aGameVars[Gv_GetVarIndex("windowx1")].val.lValue = (intptr_t)&windowxy1.x; + aGameVars[Gv_GetVarIndex("windowx2")].val.lValue = (intptr_t)&windowxy2.x; + aGameVars[Gv_GetVarIndex("windowy1")].val.lValue = (intptr_t)&windowxy1.y; + aGameVars[Gv_GetVarIndex("windowy2")].val.lValue = (intptr_t)&windowxy2.y; aGameVars[Gv_GetVarIndex("totalclock")].val.lValue = (intptr_t)&totalclock; aGameVars[Gv_GetVarIndex("lastvisinc")].val.lValue = (intptr_t)&lastvisinc; aGameVars[Gv_GetVarIndex("numsectors")].val.lValue = (intptr_t)&numsectors; diff --git a/polymer/eduke32/source/m32vars.c b/polymer/eduke32/source/m32vars.c index 8037553f9..05647bed3 100644 --- a/polymer/eduke32/source/m32vars.c +++ b/polymer/eduke32/source/m32vars.c @@ -537,10 +537,10 @@ static void Gv_AddSystemVars(void) Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); - Gv_NewVar("windowx1",(intptr_t)&windowx1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); - Gv_NewVar("windowx2",(intptr_t)&windowx2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); - Gv_NewVar("windowy1",(intptr_t)&windowy1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); - Gv_NewVar("windowy2",(intptr_t)&windowy2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); + Gv_NewVar("windowx1",(intptr_t)&windowxy1.x, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); + Gv_NewVar("windowx2",(intptr_t)&windowxy2.x, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); + Gv_NewVar("windowy1",(intptr_t)&windowxy1.y, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); + Gv_NewVar("windowy2",(intptr_t)&windowxy2.y, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); Gv_NewVar("totalclock",(intptr_t)&totalclock, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY); Gv_NewVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 708acc978..a1e1856a1 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -1721,7 +1721,7 @@ static int32_t P_DisplayFist(int32_t gs) int32_t looking_arc,fisti,fistpal; int32_t fistzoom, fistz; - int32_t wx[2] = { windowx1, windowx2 }; + int32_t wx[2] = { windowxy1.x, windowxy2.x }; const DukePlayer_t *const ps = g_player[screenpeek].ps; @@ -1756,7 +1756,7 @@ static int32_t P_DisplayFist(int32_t gs) (-fisti+222+(g_player[screenpeek].sync->avel>>5))<<16, (looking_arc+fistz)<<16, fistzoom,0,FIST,gs,fistpal,2, - wx[0],windowy1,wx[1],windowy2); + wx[0],windowxy1.y,wx[1],windowxy2.y); return 1; } @@ -1771,8 +1771,8 @@ static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shad int32_t ang = 0; int32_t xoff = 192; - int32_t wx[2] = { windowx1, windowx2 }; - int32_t wy[2] = { windowy1, windowy2 }; + int32_t wx[2] = { windowxy1.x, windowxy2.x }; + int32_t wy[2] = { windowxy1.y, windowxy2.y }; int32_t yofs = 0; switch (hudweap.cur) @@ -4576,7 +4576,7 @@ void P_ProcessInput(int32_t snum) j = lz&(MAXSPRITES-1); if ((sprite[j].cstat&33) == 33 || (sprite[j].cstat&17) == 17 || - clipshape_idx_for_sprite(&sprite[j], -1) >= 0) + clipshape_idx_for_sprite((uspritetype *)&sprite[j], -1) >= 0) { // EDuke32 extension: xvel of 1 makes a sprite be never regarded as a bridge. if ((sprite[j].xvel&1) == 0) diff --git a/polymer/eduke32/source/sbar.c b/polymer/eduke32/source/sbar.c index 5bd04c46e..5be1e8079 100644 --- a/polymer/eduke32/source/sbar.c +++ b/polymer/eduke32/source/sbar.c @@ -34,7 +34,7 @@ int32_t althud_shadows = 0; int32_t althud_shadows = 1; #endif -int32_t sbarsc(int32_t sc) +inline int32_t sbarsc(int32_t sc) { return scale(sc, ud.statusbarscale, 100); } @@ -78,13 +78,13 @@ int32_t sbary16(int32_t y) static void G_PatchStatusBar(int32_t x1, int32_t y1, int32_t x2, int32_t y2) { - int32_t scl = sbarsc(65536); - int32_t tx = sbarx16((160<<16) - (tilesiz[BOTTOMSTATUSBAR].x<<15)); // centered - int32_t ty = sbary(200-tilesiz[BOTTOMSTATUSBAR].y); + int32_t const scl = sbarsc(65536); + int32_t const tx = sbarx16((160<<16) - (tilesiz[BOTTOMSTATUSBAR].x<<15)); // centered + int32_t const ty = sbary(200-tilesiz[BOTTOMSTATUSBAR].y); - int32_t clx1 = sbarsc(scale(x1, xdim, 320)), cly1 = sbarsc(scale(y1, ydim, 200)); - int32_t clx2 = sbarsc(scale(x2, xdim, 320)), cly2 = sbarsc(scale(y2, ydim, 200)); - int32_t clofx = (xdim - sbarsc(xdim)) >> 1, clofy = (ydim - sbarsc(ydim)); + int32_t const clx1 = sbarsc(scale(x1, xdim, 320)), cly1 = sbarsc(scale(y1, ydim, 200)); + int32_t const clx2 = sbarsc(scale(x2, xdim, 320)), cly2 = sbarsc(scale(y2, ydim, 200)); + int32_t const clofx = (xdim - sbarsc(xdim)) >> 1, clofy = (ydim - sbarsc(ydim)); rotatesprite(tx, ty, scl, 0, BOTTOMSTATUSBAR, 4, 0, 10+16+64, clx1+clofx, cly1+clofy, clx2+clofx-1, cly2+clofy-1); } @@ -1082,23 +1082,23 @@ void G_DrawBackground(void) if (ud.screen_size > 8) { // across top - for (y=0; y 4) y += 8; } - x1 = max(windowx1-4, 0); - y1 = max(windowy1-4, y); - x2 = min(windowx2+4, xdim-1); - y2 = min(windowy2+4, scale(ydim, 200-sbarsc(tilesiz[BOTTOMSTATUSBAR].y), 200)-1); + x1 = max(windowxy1.x-4, 0); + y1 = max(windowxy1.y-4, y); + x2 = min(windowxy2.x+4, xdim-1); + y2 = min(windowxy2.y+4, scale(ydim, 200-sbarsc(tilesiz[BOTTOMSTATUSBAR].y), 200)-1); for (y=y1+4; y 1) { chars = Bsprintf(tempbuf, "max fps: %3u", MaxFrames); - printext256(windowx2-(chars<<(3-x))+1, windowy1+10+2+FPS_YOFFSET, 0, -1, tempbuf, x); - printext256(windowx2-(chars<<(3-x)), windowy1+10+FPS_YOFFSET, + printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+10+2+FPS_YOFFSET, 0, -1, tempbuf, x); + printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+10+FPS_YOFFSET, (MaxFrames < LOW_FPS) ? COLOR_RED : COLOR_WHITE, -1, tempbuf, x); chars = Bsprintf(tempbuf, "min fps: %3u", MinFrames); - printext256(windowx2-(chars<<(3-x))+1, windowy1+20+2+FPS_YOFFSET, 0, -1, tempbuf, x); - printext256(windowx2-(chars<<(3-x)), windowy1+20+FPS_YOFFSET, + printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+20+2+FPS_YOFFSET, 0, -1, tempbuf, x); + printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+20+FPS_YOFFSET, (MinFrames < LOW_FPS) ? COLOR_RED : COLOR_WHITE, -1, tempbuf, x); } @@ -814,8 +814,8 @@ static void G_PrintFPS(void) chars = Bsprintf(tempbuf, "%d +- %d ms", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2, (g_netClientPeer->lastRoundTripTimeVariance + g_netClientPeer->roundTripTimeVariance)/2); - printext256(windowx2-(chars<<(3-x))+1, windowy1+30+2+FPS_YOFFSET, 0, -1, tempbuf, x); - printext256(windowx2-(chars<<(3-x)), windowy1+30+1+FPS_YOFFSET, g_netClientPeer->lastRoundTripTime > 200 ? COLOR_RED : COLOR_WHITE, -1, tempbuf, x); + printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+30+2+FPS_YOFFSET, 0, -1, tempbuf, x); + printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+1+FPS_YOFFSET, g_netClientPeer->lastRoundTripTime > 200 ? COLOR_RED : COLOR_WHITE, -1, tempbuf, x); } }