From 4575148c02194c9d76ccaba6fbe97db9e5ca0e30 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 27 Aug 2016 01:41:21 +0000 Subject: [PATCH] Use size_t or ssize_t in for loops where possible git-svn-id: https://svn.eduke32.com/eduke32@5829 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/a.h | 22 +-- polymer/eduke32/build/src/2d.c | 14 +- polymer/eduke32/build/src/a-c.c | 26 ++-- polymer/eduke32/build/src/build.c | 2 +- polymer/eduke32/build/src/cache1d.c | 12 +- polymer/eduke32/build/src/clip.c | 6 +- polymer/eduke32/build/src/colmatch.c | 8 +- polymer/eduke32/build/src/defs.c | 14 +- polymer/eduke32/build/src/engine.c | 150 ++++++++++---------- polymer/eduke32/build/src/hash.c | 2 +- polymer/eduke32/build/src/mdsprite.c | 8 +- polymer/eduke32/build/src/osd.c | 6 +- polymer/eduke32/build/src/palette.c | 34 ++--- polymer/eduke32/build/src/polymer.c | 2 +- polymer/eduke32/build/src/polymost.c | 116 +++++++-------- polymer/eduke32/build/src/pragmas.c | 2 +- polymer/eduke32/build/src/sdlayer.c | 2 +- polymer/eduke32/build/src/texcache.c | 6 +- polymer/eduke32/build/src/tiles.c | 20 +-- polymer/eduke32/build/src/voxmodel.c | 74 +++++----- polymer/eduke32/source/actors.c | 50 +++---- polymer/eduke32/source/android/in_android.c | 2 +- polymer/eduke32/source/cheats.c | 12 +- polymer/eduke32/source/common.c | 6 +- polymer/eduke32/source/game.c | 77 +++++----- polymer/eduke32/source/game.h | 2 +- polymer/eduke32/source/gamedef.c | 18 +-- polymer/eduke32/source/gameexec.c | 50 +++---- polymer/eduke32/source/gamevars.c | 140 +++++++++--------- polymer/eduke32/source/gamevars.h | 2 +- polymer/eduke32/source/global.h | 2 +- polymer/eduke32/source/jmact/animlib.c | 2 +- polymer/eduke32/source/m32common.c | 12 +- polymer/eduke32/source/m32exec.c | 22 +-- polymer/eduke32/source/menus.c | 2 +- polymer/eduke32/source/midi.c | 8 +- polymer/eduke32/source/player.c | 20 +-- polymer/eduke32/source/premap.c | 20 +-- polymer/eduke32/source/savegame.c | 18 +-- polymer/eduke32/source/screens.c | 8 +- polymer/eduke32/source/sector.c | 52 +++---- polymer/eduke32/source/sounds.c | 16 +-- 42 files changed, 534 insertions(+), 533 deletions(-) diff --git a/polymer/eduke32/build/include/a.h b/polymer/eduke32/build/include/a.h index d3b1c74d5..19015244c 100644 --- a/polymer/eduke32/build/include/a.h +++ b/polymer/eduke32/build/include/a.h @@ -103,21 +103,21 @@ void settransreverse(void); void sethlinesizes(int32_t logx, int32_t logy, intptr_t bufplc); void setpalookupaddress(char *paladdr); void setuphlineasm4(int32_t bxinc, int32_t byinc); -void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by, uint32_t bx, intptr_t p); +void hlineasm4(bssize_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by, uint32_t bx, intptr_t p); void setupslopevlin(int32_t logylogx, intptr_t bufplc, int32_t pinc); -void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t bx, int32_t by); +void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, bssize_t cnt, int32_t bx, int32_t by); void setupvlineasm(int32_t neglogy); -int32_t vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p); -void vlineasm4(int32_t cnt, char *p); +int32_t vlineasm1(int32_t vinc, intptr_t paloffs, bssize_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p); +void vlineasm4(bssize_t cnt, char *p); void setupmvlineasm(int32_t neglogy, int32_t dosaturate); -int32_t mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p); -void mvlineasm4(int32_t cnt, char *p); +int32_t mvlineasm1(int32_t vinc, intptr_t paloffs, bssize_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p); +void mvlineasm4(bssize_t cnt, char *p); void setuptvlineasm(int32_t neglogy, int32_t dosaturate); -int32_t tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p); +int32_t tvlineasm1(int32_t vinc, intptr_t paloffs, bssize_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p); void setuptvlineasm2(int32_t neglogy, intptr_t paloffs1, intptr_t paloffs2); void tvlineasm2(uint32_t vplc2, int32_t vinc1, intptr_t bufplc1, intptr_t bufplc2, uint32_t vplc1, intptr_t p); @@ -129,17 +129,17 @@ void tsethlineshift(int32_t logx, int32_t logy); void thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p); void setupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz); -void spritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p); +void spritevline(int32_t bx, int32_t by, bssize_t cnt, intptr_t bufplc, intptr_t p); void msetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz); -void mspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p); +void mspritevline(int32_t bx, int32_t by, bssize_t cnt, intptr_t bufplc, intptr_t p); void tsetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ysiz); -void tspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p); +void tspritevline(int32_t bx, int32_t by, bssize_t cnt, intptr_t bufplc, intptr_t p); void setupdrawslab (int32_t dabpl, intptr_t pal); void drawslab (int32_t dx, int32_t v, int32_t dy, int32_t vi, intptr_t vptr, intptr_t p); -void stretchhline (intptr_t p0, int32_t u, int32_t cnt, int32_t uinc, intptr_t rptr, intptr_t p); +void stretchhline (intptr_t p0, int32_t u, bssize_t cnt, int32_t uinc, intptr_t rptr, intptr_t p); void mmxoverlay(); diff --git a/polymer/eduke32/build/src/2d.c b/polymer/eduke32/build/src/2d.c index 1d9bace1d..0c27e6ffe 100644 --- a/polymer/eduke32/build/src/2d.c +++ b/polymer/eduke32/build/src/2d.c @@ -343,7 +343,7 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col) if (drawlinepat == 0xffffffff) { - for (int i=d.x, df=0; i>0; i--) + for (bssize_t i=d.x, df=0; i>0; i--) { drawtranspixel((char *) p, col); df += d.y; @@ -355,7 +355,7 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col) { uint32_t patc = UINT_MAX; - for (int i=d.x, df=0; i>0; i--) + for (bssize_t i=d.x, df=0; i>0; i--) { if (drawlinepat & pow2long[(++patc)&31]) drawtranspixel((char *) p, col); @@ -374,7 +374,7 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col) clearbufbyte((void *) p, d.x, ((int32_t) col<<24)|((int32_t) col<<16)|((int32_t) col<<8)|col); else if (drawlinepat == 0xffffffff) { - for (int i=d.x, df=0; i>0; i--) + for (bssize_t i=d.x, df=0; i>0; i--) { drawpixel((char *) p, col); df += d.y; @@ -386,7 +386,7 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col) { uint32_t patc = UINT_MAX; - for (int i=d.x, df=0; i>0; i--) + for (bssize_t i=d.x, df=0; i>0; i--) { if (drawlinepat & pow2long[(++patc)&31]) drawpixel((char *) p, col); @@ -1024,12 +1024,12 @@ int32_t getspritecol(int32_t spr) const uint8_t *const texbuf = (const uint8_t *) waloff[picnum]; - for (int i = 0; i < tilesiz[picnum].x * tilesiz[picnum].y; i++) + for (bssize_t i = 0; i < tilesiz[picnum].x * tilesiz[picnum].y; i++) cols[texbuf[i]]++; unsigned col = 0, cnt = 0; - for (int i = 0; i < 240; i++) + for (bssize_t i = 0; i < 240; i++) if (cols[i] > cnt) col = i, cnt = cols[i]; @@ -1282,7 +1282,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z faketimerhandler(); if (zoome >= 256 || highlightcnt>0) - for (int32_t j=0; j= 1 -static void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal, char *const A_C_RESTRICT * buf, +static void vlineasm4nlogy(bssize_t cnt, char *p, char *const A_C_RESTRICT * pal, char *const A_C_RESTRICT * buf, # ifdef USE_VECTOR_EXT uint32_vec4 vplc, const uint32_vec4 vinc) # else @@ -258,7 +258,7 @@ static void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal, #endif // cnt >= 1 -void vlineasm4(int32_t cnt, char *p) +void vlineasm4(bssize_t cnt, char *p) { char * const A_C_RESTRICT pal[4] = {(char *)palookupoffse[0], (char *)palookupoffse[1], (char *)palookupoffse[2], (char *)palookupoffse[3]}; char * const A_C_RESTRICT buf[4] = {(char *)bufplce[0], (char *)bufplce[1], (char *)bufplce[2], (char *)bufplce[3]}; @@ -350,7 +350,7 @@ void setupmvlineasm(int32_t neglogy, int32_t dosaturate) } // cnt+1 loop iterations! -int32_t mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p) +int32_t mvlineasm1(int32_t vinc, intptr_t paloffs, bssize_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p) { char ch; @@ -391,7 +391,7 @@ int32_t mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, i } // cnt >= 1 -void mvlineasm4(int32_t cnt, char *p) +void mvlineasm4(bssize_t cnt, char *p) { char *const A_C_RESTRICT pal[4] = {(char *)palookupoffse[0], (char *)palookupoffse[1], (char *)palookupoffse[2], (char *)palookupoffse[3]}; char *const A_C_RESTRICT buf[4] = {(char *)bufplce[0], (char *)bufplce[1], (char *)bufplce[2], (char *)bufplce[3]}; @@ -483,7 +483,7 @@ void setuptvlineasm(int32_t neglogy, int32_t dosaturate) #if !defined USE_ASM64 // cnt+1 loop iterations! -int32_t tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p) +int32_t tvlineasm1(int32_t vinc, intptr_t paloffs, bssize_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p) { char ch; @@ -540,7 +540,7 @@ void tvlineasm2(uint32_t vplc2, int32_t vinc1, intptr_t bufplc1, intptr_t bufplc { char ch; - int32_t cnt = tabledivide32(asm2-p-1, bpl); // >= 1 + bssize_t cnt = tabledivide32(asm2-p-1, bpl); // >= 1 const int32_t vinc2 = asm1; const char *const A_C_RESTRICT buf1 = (char *)bufplc1; @@ -671,7 +671,7 @@ void setupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ys gbyinc = byinc; glogy = ysiz; } -void spritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p) +void spritevline(int32_t bx, int32_t by, bssize_t cnt, intptr_t bufplc, intptr_t p) { gbuf = (char *)bufplc; for (; cnt>1; cnt--) @@ -691,7 +691,7 @@ void msetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t y gbyinc = byinc; glogy = ysiz; } -void mspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p) +void mspritevline(int32_t bx, int32_t by, bssize_t cnt, intptr_t bufplc, intptr_t p) { char ch; @@ -713,7 +713,7 @@ void tsetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t y gbyinc = byinc; glogy = ysiz; } -void tspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p) +void tspritevline(int32_t bx, int32_t by, bssize_t cnt, intptr_t bufplc, intptr_t p) { char ch; @@ -761,7 +761,7 @@ void drawslab(int32_t dx, int32_t v, int32_t dy, int32_t vi, intptr_t vptr, intp } #if 0 -void stretchhline(intptr_t p0, int32_t u, int32_t cnt, int32_t uinc, intptr_t rptr, intptr_t p) +void stretchhline(intptr_t p0, int32_t u, bssize_t cnt, int32_t uinc, intptr_t rptr, intptr_t p) { p0 = p-(cnt<<2); do diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 381a826c1..bb9f3f6ee 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -9150,7 +9150,7 @@ static void clearministatbar16(void) // similar to how inside() did before r3898. int32_t loopinside(int32_t x, int32_t y, int16_t startwall) { - int32_t cnt = clockdir(startwall); + bssize_t cnt = clockdir(startwall); int32_t i = startwall; do diff --git a/polymer/eduke32/build/src/cache1d.c b/polymer/eduke32/build/src/cache1d.c index 8f01f5d08..997f713a4 100644 --- a/polymer/eduke32/build/src/cache1d.c +++ b/polymer/eduke32/build/src/cache1d.c @@ -311,7 +311,7 @@ void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr) void agecache(void) { #ifndef DEBUG_ALLOCACHE_AS_MALLOC - int32_t cnt = (cacnum>>4); + bssize_t cnt = (cacnum>>4); if (agecount >= cacnum) agecount = cacnum-1; @@ -792,7 +792,7 @@ int32_t initgroupfile(const char *filename) kread_grp(numgroupfiles,gfilelist[numgroupfiles],gnumfiles[numgroupfiles]<<4); int32_t j = (gnumfiles[numgroupfiles]+1)<<4, k; - for (int32_t i=0; i= 0; --k) + for (bssize_t k = searchfirst != 1 ? numgroupfiles-1 : 0; k >= 0; --k) { if (groupfil[k] < 0) continue; - for (int32_t i = gnumfiles[k]-1; i >= 0; --i) + for (bssize_t i = gnumfiles[k]-1; i >= 0; --i) { char const * const gfileptr = (char *)&gfilelist[k][i<<4]; @@ -1089,7 +1089,7 @@ gnumfiles_continue: ; void krename(int32_t crcval, int32_t filenum, const char *newname) { - for (int32_t k=numgroupfiles-1; k>=0; k--) + for (bssize_t k=numgroupfiles-1; k>=0; k--) { if (groupfil[k] >= 0 && groupcrc[k] == crcval) { diff --git a/polymer/eduke32/build/src/clip.c b/polymer/eduke32/build/src/clip.c index 286087ceb..f63ae9793 100644 --- a/polymer/eduke32/build/src/clip.c +++ b/polymer/eduke32/build/src/clip.c @@ -785,7 +785,7 @@ static inline int32_t raytrace(int32_t x3, int32_t y3, int32_t *x4, int32_t *y4) { int32_t hitwall = -1; - for (int32_t z=clipnum-1; z>=0; z--) + for (bssize_t z=clipnum-1; z>=0; z--) { const int32_t x1 = clipit[z].x1, x2 = clipit[z].x2, x21 = x2-x1; const int32_t y1 = clipit[z].y1, y2 = clipit[z].y2, y21 = y2-y1; @@ -810,7 +810,7 @@ static inline int32_t raytrace(int32_t x3, int32_t y3, int32_t *x4, int32_t *y4) if (bot == 0) continue; - int32_t cnt = 256, nintx, ninty; + bssize_t cnt = 256, nintx, ninty; do { @@ -1181,7 +1181,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum, #endif int32_t hitwalls[4], hitwall; - int32_t cnt = clipmoveboxtracenum; + bssize_t cnt = clipmoveboxtracenum; do { diff --git a/polymer/eduke32/build/src/colmatch.c b/polymer/eduke32/build/src/colmatch.c index f96472694..f8693c6da 100644 --- a/polymer/eduke32/build/src/colmatch.c +++ b/polymer/eduke32/build/src/colmatch.c @@ -24,7 +24,7 @@ static uint8_t const * colmatch_palette; void initfastcolorlookup_scale(int32_t rscale, int32_t gscale, int32_t bscale) { int32_t j = 0; - for (int i=256; i>=0; i--) + for (bssize_t i=256; i>=0; i--) { //j = (i-64)*(i-64); rdist[i] = rdist[FASTPALCOLDEPTH*2-i] = j*rscale; @@ -41,7 +41,7 @@ void initfastcolorlookup_palette(uint8_t const * const pal) colmatch_palette = pal; char const *pal1 = (char const *)&pal[768-3]; - for (int i=255; i>=0; i--,pal1-=3) + for (bssize_t i=255; i>=0; i--,pal1-=3) { int32_t const j = (pal1[0]>>FASTPALRIGHTSHIFT)*FASTPALGRIDSIZ*FASTPALGRIDSIZ + (pal1[1]>>FASTPALRIGHTSHIFT)*FASTPALGRIDSIZ + (pal1[2]>>FASTPALRIGHTSHIFT) @@ -144,7 +144,7 @@ int32_t getclosestcol_nocache_lim(int32_t r, int32_t g, int32_t b, int32_t const int retcol = -1; - for (int k=26; k>=0; k--) + for (bssize_t k=26; k>=0; k--) { int i = colscan[k]+j; @@ -173,7 +173,7 @@ int32_t getclosestcol_nocache_lim(int32_t r, int32_t g, int32_t b, int32_t const mindist = INT32_MAX; - for (int i = 0; i < lastokcol; ++i) + for (bssize_t i = 0; i < lastokcol; ++i) { char const * const pal1 = (char const *)&colmatch_palette[i*3]; int dist = gdist[pal1[1]+g]; diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index 2d49e0fc6..9f92d4acc 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -232,7 +232,7 @@ static int32_t Defs_LoadTileIntoBuffer(int32_t const tile) static void Defs_ApplyPaletteToTileBuffer(int32_t const tsiz, int32_t const pal) { - for (int32_t i = 0; i < tsiz; i++) + for (bssize_t i = 0; i < tsiz; i++) faketilebuffer[i] = palookup[pal][faketilebuffer[i]]; } @@ -1095,7 +1095,7 @@ static int32_t defsparser(scriptfile *script) if (check_tile_range("undefinetilerange", &tile1, &tile2, script, cmdtokptr)) break; - for (int32_t i = tile1; i <= tile2; i++) + for (bssize_t i = tile1; i <= tile2; i++) E_UndefineTile(i); break; @@ -2585,7 +2585,7 @@ static int32_t defsparser(scriptfile *script) usermaphacks = (usermaphack_t *)Xrealloc(usermaphacks, num_usermaphacks*sizeof(usermaphack_t)); usermaphack_t *newusermaphack = &usermaphacks[num_usermaphacks - 1]; - for (int i = 0; i < 16; i++) + for (bssize_t i = 0; i < 16; i++) { char smallbuf[3] = { 0, 0, 0 }; smallbuf[0] = mapmd4string[2*i]; @@ -2837,7 +2837,7 @@ static int32_t defsparser(scriptfile *script) if (shiftleft != 0) { - for (int k = 0; k < 768; k++) + for (bssize_t k = 0; k < 768; k++) palbuf[k] <<= shiftleft; } @@ -3398,7 +3398,7 @@ static int32_t defsparser(scriptfile *script) break; } - for (int32_t i = id0; i <= id1; i++) + for (bssize_t i = id0; i <= id1; i++) removebasepal(i); if (id0 == 0) @@ -3421,7 +3421,7 @@ static int32_t defsparser(scriptfile *script) break; } - for (int32_t i = id0; i <= id1; i++) + for (bssize_t i = id0; i <= id1; i++) removepalookup(i); if (id0 == 0) @@ -3444,7 +3444,7 @@ static int32_t defsparser(scriptfile *script) break; } - for (int32_t i = id0; i <= id1; i++) + for (bssize_t i = id0; i <= id1; i++) removeblendtab(i); if (id0 == 0) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index ae07b4f02..e69b9a7e6 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -381,7 +381,7 @@ void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum) if (bunchnum > -3) { // TODO: for in-game too? - for (int ynw, j=sector[i].wallptr; j= 0) @@ -621,7 +621,7 @@ int32_t yax_getneighborsect(int32_t x, int32_t y, int32_t sectnum, int32_t cf) if (bunchnum < 0) return -1; - for (int SECTORS_OF_BUNCH(bunchnum, !cf, i)) + for (bssize_t SECTORS_OF_BUNCH(bunchnum, !cf, i)) if (inside(x, y, i)==1) return i; @@ -1665,7 +1665,7 @@ static void scansector(int16_t startsectnum) #ifdef YAX_ENABLE if (scansector_collectsprites) #endif - for (int32_t i=headspritesect[sectnum]; i>=0; i=nextspritesect[i]) + for (bssize_t i=headspritesect[sectnum]; i>=0; i=nextspritesect[i]) { const uspritetype *const spr = (uspritetype *)&sprite[i]; @@ -1692,7 +1692,7 @@ static void scansector(int16_t startsectnum) vec2_t p1, p2 = { 0, 0 }; - for (int32_t w=startwall; wnextsector; @@ -1750,7 +1750,7 @@ skipitaddwall: bunchp2[numscans-1] = scanfirst, scanfirst = numscans; } - for (int32_t s=onumscans; s= xb1[bunchp2[s]]) { bunchfirst[numbunches++] = bunchp2[s], bunchp2[s] = -1; @@ -1760,7 +1760,7 @@ skipitaddwall: #endif } - for (int32_t bn=onumbunches; bn=0; s=bunchp2[s]) @@ -1782,7 +1782,7 @@ void printscans(void) Bmemset(didscan, 0, sizeof(didscan)); - for (int s=0; s= 0 && (didscan[s>>3] & (1<<(s&7)))==0) { @@ -1813,10 +1813,10 @@ void printscans(void) void printbunches(void) { - for (int bn=0; bn=0; s=bunchp2[s]) + for (bssize_t s=bunchfirst[bn]; s>=0; s=bunchp2[s]) printf("%d(%d) ", s, thewall[s]); printf("\n"); } @@ -1960,7 +1960,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc) { char bad = 0; - for (int z=3,dax=x+3; z>=0; z--,dax--) + for (bssize_t z=3,dax=x+3; z>=0; z--,dax--) { y1ve[z] = max(uwall[dax],startumost[dax+windowxy1.x]-windowxy1.y); y2ve[z] = min(dwall[dax],startdmost[dax+windowxy1.x]-windowxy1.y)-1; @@ -2397,14 +2397,14 @@ static int32_t owallmost(int16_t *mostbuf, int32_t w, zint_t z) if ((bad&3) == 3) { - for (int i=ix1; i<=ix2; i++) + for (bssize_t i=ix1; i<=ix2; i++) mostbuf[i] = 0; return bad; } if ((bad&12) == 12) { - for (int i=ix1; i<=ix2; i++) + for (bssize_t i=ix1; i<=ix2; i++) mostbuf[i] = ydimen; return bad; } @@ -2418,13 +2418,13 @@ static int32_t owallmost(int16_t *mostbuf, int32_t w, zint_t z) if ((bad&3) == 2) { if (xb1[w] <= xcross) { iy2 = inty; ix2 = xcross; } - for (int i=xcross+1; i<=xb2[w]; i++) + for (bssize_t i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = 0; } else { if (xcross <= xb2[w]) { iy1 = inty; ix1 = xcross; } - for (int i=xb1[w]; i<=xcross; i++) + for (bssize_t i=xb1[w]; i<=xcross; i++) mostbuf[i] = 0; } } @@ -2438,13 +2438,13 @@ static int32_t owallmost(int16_t *mostbuf, int32_t w, zint_t z) if ((bad&12) == 8) { if (xb1[w] <= xcross) { iy2 = inty; ix2 = xcross; } - for (int i=xcross+1; i<=xb2[w]; i++) + for (bssize_t i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = ydimen; } else { if (xcross <= xb2[w]) { iy1 = inty; ix1 = xcross; } - for (int i=xb1[w]; i<=xcross; i++) + for (bssize_t i=xb1[w]; i<=xcross; i++) mostbuf[i] = ydimen; } } @@ -2537,14 +2537,14 @@ static int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dasta if ((bad&3) == 3) { - for (int i=ix1; i<=ix2; i++) + for (bssize_t i=ix1; i<=ix2; i++) mostbuf[i] = 0; return bad; } if ((bad&12) == 12) { - for (int i=ix1; i<=ix2; i++) + for (bssize_t i=ix1; i<=ix2; i++) mostbuf[i] = ydimen; return bad; } @@ -2566,13 +2566,13 @@ static int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dasta if ((bad&3) == 2) { if (xb1[w] <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; } - for (int i=xcross+1; i<=xb2[w]; i++) + for (bssize_t i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = 0; } else { if (xcross <= xb2[w]) { z1 = intz; iy1 = inty; ix1 = xcross; } - for (int i=xb1[w]; i<=xcross; i++) + for (bssize_t i=xb1[w]; i<=xcross; i++) mostbuf[i] = 0; } } @@ -2592,13 +2592,13 @@ static int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dasta if ((bad&12) == 8) { if (xb1[w] <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; } - for (int i=xcross+1; i<=xb2[w]; i++) + for (bssize_t i=xcross+1; i<=xb2[w]; i++) mostbuf[i] = ydimen; } else { if (xcross <= xb2[w]) { z1 = intz; iy1 = inty; ix1 = xcross; } - for (int i=xb1[w]; i<=xcross; i++) + for (bssize_t i=xb1[w]; i<=xcross; i++) mostbuf[i] = ydimen; } } @@ -3311,7 +3311,7 @@ static void ceilspritescan(int32_t x1, int32_t x2) int32_t y1 = uwall[x1]; int32_t y2 = y1; - for (int x=x1; x<=x2; ++x) + for (bssize_t x=x1; x<=x2; ++x) { const int32_t twall = uwall[x]-1; const int32_t bwall = dwall[x]; @@ -3364,7 +3364,7 @@ static inline void setupslopevlin_alsotrans(int32_t logylogx, intptr_t bufplc, i } // cnt iterations -static void tslopevlin(uint8_t *p, const intptr_t *slopalptr, int32_t cnt, int32_t bx, int32_t by) +static void tslopevlin(uint8_t *p, const intptr_t *slopalptr, bssize_t cnt, int32_t bx, int32_t by) { const char *const A_C_RESTRICT buf = ggbuf; const char *const A_C_RESTRICT pal = ggpal; @@ -4456,7 +4456,7 @@ static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasp begindrawing(); //{{{ - for (int32_t cnt=0; cnt<8; cnt++) + for (bssize_t cnt=0; cnt<8; cnt++) { int32_t xs=0, ys=0, xi=0, yi=0; @@ -5854,12 +5854,12 @@ static void drawmaskwall(int16_t damaskwallcnt) wallmost(uwall,z,sectnum,(uint8_t)0); wallmost(uplc,z,(int32_t)wal->nextsector,(uint8_t)0); - for (int x=xb1[z]; x<=xb2[z]; x++) + for (bssize_t x=xb1[z]; x<=xb2[z]; x++) if (uplc[x] > uwall[x]) uwall[x] = uplc[x]; wallmost(dwall,z,sectnum,(uint8_t)1); wallmost(dplc,z,(int32_t)wal->nextsector,(uint8_t)1); - for (int x=xb1[z]; x<=xb2[z]; x++) + for (bssize_t x=xb1[z]; x<=xb2[z]; x++) if (dplc[x] < dwall[x]) dwall[x] = dplc[x]; prepwall(z,wal); @@ -5867,7 +5867,7 @@ static void drawmaskwall(int16_t damaskwallcnt) setup_globals_wall1(wal, wal->overpicnum); setup_globals_wall2(wal, sec->visibility, z1, z2); - for (int i=smostwallcnt-1; i>=0; i--) + for (bssize_t i=smostwallcnt-1; i>=0; i--) { int j=smostwall[i]; if ((xb1[j] > xb2[z]) || (xb2[j] < xb1[z])) continue; @@ -5883,15 +5883,15 @@ static void drawmaskwall(int16_t damaskwallcnt) { if ((lx == xb1[z]) && (rx == xb2[z])) return; //clearbufbyte(&dwall[lx],(rx-lx+1)*sizeof(dwall[0]),0L); - for (int x=lx; x<=rx; x++) dwall[x] = 0; + for (bssize_t x=lx; x<=rx; x++) dwall[x] = 0; } break; case 1: - for (int x=lx, k = smoststart[i] - xb1[j]; x<=rx; x++) + for (bssize_t x=lx, k = smoststart[i] - xb1[j]; x<=rx; x++) if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x]; break; case 2: - for (int x=lx, k = smoststart[i] - xb1[j]; x<=rx; x++) + for (bssize_t x=lx, k = smoststart[i] - xb1[j]; x<=rx; x++) if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x]; break; } @@ -6023,7 +6023,7 @@ static void fillpolygon(int32_t npoints) int16_t *const xptr = &smost[i*nodesperline]; int16_t *const xptr2 = &smost[i*nodesperline + (nodesperline>>1)]; - const int32_t cnt = dotp1[y]-xptr; + const bssize_t cnt = dotp1[y]-xptr; for (z=cnt-1; z>=0; z--) { @@ -7486,7 +7486,7 @@ int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, psky_t * E_DefinePsky(int32_t const tilenum) { - for (int i = 0; i < pskynummultis; i++) + for (bssize_t i = 0; i < pskynummultis; i++) if (multipskytile[i] == tilenum) return &multipsky[i]; @@ -7754,7 +7754,7 @@ void uninitengine(void) paletteloaded = 0; - for (int i=0; i>=1; gap>0; gap>>=1) //Sort sprite list for (i=0; i=0; l-=gap) + for (bssize_t l=i; l>=0; l-=gap) { if (spritesxyz[l].y <= spritesxyz[l+gap].y) break; swapptr(&tspriteptr[l],&tspriteptr[l+gap]); @@ -8313,7 +8313,7 @@ killsprite: spritesxyz[spritesortcnt].y = (spritesxyz[spritesortcnt-1].y^1); ys = spritesxyz[0].y; i = 0; - for (int32_t j=1; j<=spritesortcnt; j++) + for (bssize_t j=1; j<=spritesortcnt; j++) { if (spritesxyz[j].y == ys) continue; @@ -8322,7 +8322,7 @@ killsprite: if (j > i+1) { - for (int32_t k=i; kx == tspriteptr[l]->x && tspriteptr[k]->y == tspriteptr[l]->y && (tspriteptr[k]->cstat & 48) == (tspriteptr[l]->cstat & 48) && @@ -9734,7 +9734,7 @@ static void PolymostProcessVoxels(void) OSD_Printf("Generating voxel models for Polymost. This may take a while...\n"); nextpage(); - for (int32_t i=0; ipagesleft > 0) && (per->pagesleft <= numpages)) @@ -9881,7 +9881,7 @@ void nextpage(void) showframe(0); begindrawing(); //{{{ - for (int i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) + for (bssize_t i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) { per = &permfifo[i]; if (per->pagesleft >= 130) @@ -9908,7 +9908,7 @@ void nextpage(void) #ifdef USE_OPENGL omdtims = mdtims; mdtims = getticks(); - for (int i = 0; i < Numsprites; ++i) + for (bssize_t i = 0; i < Numsprites; ++i) if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM)) spriteext[i].mdanimtims += mdtims - omdtims; #endif @@ -9929,7 +9929,7 @@ int32_t qloadkvx(int32_t voxindex, const char *filename) int32_t lengcnt = 0; const int32_t lengtot = kfilelength(fil); - for (int32_t i=0; i=0; --i) + for (bssize_t i=numsectors-1; i>=0; --i) if (inside_p(x, y, i)) SET_AND_RETURN(*sectnum, i); @@ -11321,7 +11321,7 @@ void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t * while (--wallsleft); } - for (int i=numsectors-1; i>=0; --i) + for (bssize_t i=numsectors-1; i>=0; --i) if (inside_exclude_p(x, y, i, excludesectbitmap)) SET_AND_RETURN(*sectnum, i); @@ -11380,7 +11380,7 @@ void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) while (--wallsleft); } - for (int i=numsectors-1; i>=0; --i) + for (bssize_t i=numsectors-1; i>=0; --i) if (inside_z_p(x,y,z, i)) SET_AND_RETURN(*sectnum, i); @@ -11555,7 +11555,7 @@ restart_grand: clipsprite_initindex(curidx, curspr, &clipsectcnt, pos); - for (int i=0; iwallptr; const int endwall = startwall + startsec->wallnum; - for (int j=startwall; j=0; j=nextspritesect[j]) + for (bssize_t j=headspritesect[clipsectorlist[i]]; j>=0; j=nextspritesect[j]) { const int32_t cstat = sprite[j].cstat; int32_t daz, daz2; @@ -11837,7 +11837,7 @@ restart_grand: if (cb < 0) continue; - for (int SECTORS_OF_BUNCH(cb,YAX_FLOOR, j)) + for (bssize_t SECTORS_OF_BUNCH(cb,YAX_FLOOR, j)) if (inside(pos->x,pos->y, j)==1) { clipsectorlist[clipsectnum++] = j; @@ -11873,7 +11873,7 @@ restart_grand: if (fb < 0) continue; - for (int SECTORS_OF_BUNCH(fb, YAX_CEILING, j)) + for (bssize_t SECTORS_OF_BUNCH(fb, YAX_CEILING, j)) if (inside(pos->x,pos->y, j)==1) { clipsectorlist[clipsectnum++] = j; @@ -11967,11 +11967,11 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2) #endif setaspect_new(); - for (int i=0; i=3; i-=4) + for (bssize_t i=siz-1, j; i>=3; i-=4) { ptr2 = ptr1 = (char *) (waloff[tilenume]+i*(siz+1)); swapchar(--ptr1, (ptr2 -= siz)); @@ -12335,7 +12335,7 @@ void completemirror(void) // p+destof == frameplace + ylookup[...] + windowx2-mirrorsx2 int const destofs = windowxy2.x-mirrorsx2-windowxy1.x-mirrorsx1; - for (int y=0; y= bytesperline*ydim) @@ -12499,7 +12499,7 @@ int32_t loopnumofsector(int16_t sectnum, int16_t wallnum) const int32_t startwall = sector[sectnum].wallptr; const int32_t endwall = startwall + sector[sectnum].wallnum; - for (int i=startwall; i= 0) { - for (int y=ymin; y<=ymax; y++) + for (bssize_t y=ymin; y<=ymax; y++) { - for (int x=0; x= (unsigned)xdim || ptr < (char *) frameplace) break; ptr[x] = (letptr[y] & pow2char[7 - (fontsize & 1) - x]) ? @@ -12792,9 +12792,9 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, con } else { - for (int y=ymin; y<=ymax; y++) + for (bssize_t y=ymin; y<=ymax; y++) { - for (int x=0; x= (unsigned)xdim || ptr < (char *) frameplace) break; if (letptr[y]&pow2char[7-(fontsize&1)-x]) ptr[x] = (uint8_t) col; @@ -12941,7 +12941,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const static void PolymerProcessModels(void) { // potentially deferred MD3 postprocessing - for (int32_t i=0; imdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL) { @@ -13043,10 +13043,10 @@ void invalidatetile(int16_t tilenume, int32_t pal, int32_t how) const int32_t firstpal = (pal < 0) ? 0 : pal; const int32_t numpals = (pal < 0) ? MAXPALOOKUPS : 1; - for (int hp = 0; hp <= 4; hp+=4) + for (bssize_t hp = 0; hp <= 4; hp+=4) { if (how & pow2long[hp]) - for (int np = firstpal; np < firstpal+numpals; np++) + for (bssize_t np = firstpal; np < firstpal+numpals; np++) gltexinvalidate(tilenume, np, hp); } diff --git a/polymer/eduke32/build/src/hash.c b/polymer/eduke32/build/src/hash.c index 4ad39b588..5f341d8fa 100644 --- a/polymer/eduke32/build/src/hash.c +++ b/polymer/eduke32/build/src/hash.c @@ -14,7 +14,7 @@ void hash_loop(hashtable_t *t, void(*func)(const char *, intptr_t)) if (t->items == NULL) return; - for (int32_t i=0; i < t->size; i++) + for (bssize_t i=0; i < t->size; i++) for (hashitem_t *item=t->items[i]; item != NULL; item = item->next) func(item->string, item->key); } diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index 2ee9bfb22..f51270757 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -829,11 +829,11 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) char al = 255; char onebitalpha = 1; - for (int32_t y = 0, j = 0; y < tsiz.y; ++y, j += siz.x) + for (bssize_t y = 0, j = 0; y < tsiz.y; ++y, j += siz.x) { coltype tcol, *rpptr = &pic[j]; - for (int32_t x = 0; x < tsiz.x; ++x) + for (bssize_t x = 0; x < tsiz.x; ++x) { tcol.b = cptr[rpptr[x].b]; tcol.g = cptr[rpptr[x].g]; @@ -891,7 +891,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) if (!glinfo.bgra) { - for (int32_t j = siz.x*siz.y - 1; j >= 0; j--) + for (bssize_t j = siz.x*siz.y - 1; j >= 0; j--) swapchar(&pic[j].r, &pic[j].b); } @@ -2570,7 +2570,7 @@ static void md3free(md3model_t *m) if (m->head.surfs) { - for (int surfi=m->head.numsurfs-1; surfi>=0; surfi--) + for (bssize_t surfi=m->head.numsurfs-1; surfi>=0; surfi--) { md3surf_t *s = &m->head.surfs[surfi]; Bfree(s->tris); diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index bfc762b12..bd28efadb 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -632,7 +632,7 @@ static int32_t _internal_osdfunc_history(const osdfuncparm_t *parm) OSD_Printf(OSDTEXT_RED "Command history:\n"); - for (int32_t i=osd->history.maxlines-1; i>=0; i--) + for (bssize_t i=osd->history.maxlines-1; i>=0; i--) if (h->buf[i]) OSD_Printf("%4d \"%s\"\n", h->total - h->lines + (++j), h->buf[i]); @@ -660,7 +660,7 @@ void OSD_Cleanup(void) DO_FREE_AND_NULL(osd->cvars); DO_FREE_AND_NULL(osd->editor.buf); DO_FREE_AND_NULL(osd->editor.tmp); - for (int i=0; ihistory.buf[i]); DO_FREE_AND_NULL(osd->text.buf); DO_FREE_AND_NULL(osd->text.fmt); @@ -686,7 +686,7 @@ static int32_t osdcmd_cvar_set_osd(const osdfuncparm_t *parm) OSD_SetTextMode(osd->draw.mode); else if (!Bstrcasecmp(parm->name, "osdhistorydepth")) { - for (int i = OSDMAXHISTORYDEPTH - 1; i >= osd->history.maxlines; i--) + for (bssize_t i = OSDMAXHISTORYDEPTH - 1; i >= osd->history.maxlines; i--) DO_FREE_AND_NULL(osd->history.buf[i]); } diff --git a/polymer/eduke32/build/src/palette.c b/polymer/eduke32/build/src/palette.c index 63390f906..f4f99f553 100644 --- a/polymer/eduke32/build/src/palette.c +++ b/polymer/eduke32/build/src/palette.c @@ -115,7 +115,7 @@ void loadpalette(void) if (kread_and_test(fil, palette, 768)) return kclose(fil); - for (int k = 0; k < 768; k++) + for (bssize_t k = 0; k < 768; k++) palette[k] <<= 2; initfastcolorlookup_palette(palette); @@ -185,7 +185,7 @@ void loadpalette(void) // Read translucency (blending) table. if (lamedukep) { - for (int i=0; i<255; i++) + for (bssize_t i=0; i<255; i++) { // NOTE: LameDuke's table doesn't have the last row or column (i==255). @@ -195,7 +195,7 @@ void loadpalette(void) return kclose(fil); // Duplicate the entries below the diagonal. - for (int j=0; j k) { k = j; whitecol = i; } } - for (int i=0, j, k=768; i<256; i++) + for (bssize_t i=0, j, k=768; i<256; i++) { j = palette[i*3] + palette[i*3+1] + palette[i*3+2]; if (j < k) { k = j; blackcol = i; } @@ -290,7 +290,7 @@ static void E_PostLoadPalette(void) redcol = getclosestcol(255, 0, 0); // Bmemset(PaletteIndexFullbrights, 0, sizeof(PaletteIndexFullbrights)); - for (int c = 0; c < 255; ++c) // skipping transparent color + for (bssize_t c = 0; c < 255; ++c) // skipping transparent color { char const * const thispalookup = palookup[0]; char const color = thispalookup[c]; @@ -300,7 +300,7 @@ static void E_PostLoadPalette(void) palette[color*3+2] == 0)) continue; // don't consider #000000 fullbright - for (int s = c + 256; s < 256*32; s += 256) + for (bssize_t s = c + 256; s < 256*32; s += 256) if (EDUKE32_PREDICT_FALSE(thispalookup[s] != color)) goto PostLoad_NotFullbright; @@ -331,13 +331,13 @@ int32_t E_PostInitTables(void) void E_ReplaceTransparentColorWithBlack(void) { - for (int i=0; inext) { @@ -232,7 +232,7 @@ void gltexapplyprops(void) gltexfiltermode = clamp(gltexfiltermode, 0, NUMGLFILTERMODES-1); - for (int i=0; i<=GLTEXCACHEADSIZ-1; i++) + for (bssize_t i=0; i<=GLTEXCACHEADSIZ-1; i++) { for (pthtyp *pth=texcache.list[i]; pth; pth=pth->next) { @@ -245,14 +245,14 @@ void gltexapplyprops(void) } } - for (int i=0; imdnum < 2) continue; - for (int j = 0; j < m->numskins * (HICEFFECTMASK + 1); j++) + for (bssize_t j = 0; j < m->numskins * (HICEFFECTMASK + 1); j++) { if (!m->texid[j]) continue; @@ -260,7 +260,7 @@ void gltexapplyprops(void) } for (mdskinmap_t *sk = m->skinmap; sk; sk = sk->next) - for (int j = 0; j < (HICEFFECTMASK + 1); j++) + for (bssize_t j = 0; j < (HICEFFECTMASK + 1); j++) { if (!sk->texid[j]) continue; @@ -278,7 +278,7 @@ static int32_t gltexcacnum = -1; void polymost_glreset() { - for (int i=0; i<=MAXPALOOKUPS-1; i++) + for (bssize_t i=0; i<=MAXPALOOKUPS-1; i++) { fogtable[i].r = palookupfog[i].r * (1.f/255.f); fogtable[i].g = palookupfog[i].g * (1.f/255.f); @@ -297,7 +297,7 @@ void polymost_glreset() } else { - for (int i = 0; i <= GLTEXCACHEADSIZ-1; i++) + for (bssize_t i = 0; i <= GLTEXCACHEADSIZ-1; i++) { for (pthtyp *pth = texcache.list[i]; pth;) { @@ -620,11 +620,11 @@ static void fixtransparency(coltype *dapic, vec2_t dasiz, vec2_t dasiz2, int32_t //Set transparent pixels to average color of neighboring opaque pixels //Doing this makes bilinear filtering look much better for masked textures (I.E. sprites) - for (int y=doxy.y; y>=0; y--) + for (bssize_t y=doxy.y; y>=0; y--) { coltype * wpptr = &dapic[y*dasiz2.x+doxy.x]; - for (int x=doxy.x; x>=0; x--,wpptr--) + for (bssize_t x=doxy.x; x>=0; x--,wpptr--) { if (wpptr->a) continue; @@ -898,17 +898,17 @@ void uploadtexture(int32_t doalloc, vec2_t siz, int32_t texfmt, vec2_t siz2 = siz; - for (int j=1; (siz2.x > 1) || (siz2.y > 1); j++) + for (bssize_t j=1; (siz2.x > 1) || (siz2.y > 1); j++) { vec2_t const siz3 = { max(1, siz2.x >> 1), max(1, siz2.y >> 1) }; // this came from the GL_ARB_texture_non_power_of_two spec //x3 = ((x2+1)>>1); y3 = ((y2+1)>>1); - for (int y=0; y= 0)) @@ -2836,7 +2836,7 @@ static void polymost_drawalls(int32_t const bunch) usectortype const * const sec = (usectortype *)§or[sectnum]; //DRAW WALLS SECTION! - for (int z=bunchfirst[bunch]; z>=0; z=bunchp2[z]) + for (bssize_t z=bunchfirst[bunch]; z>=0; z=bunchp2[z]) { int32_t const wallnum = thewall[z]; @@ -2930,7 +2930,7 @@ static void polymost_drawalls(int32_t const bunch) calc_and_apply_fog_factor(sec->floorpicnum, sec->floorshade, sec->visibility, sec->floorpal, 0.005f); //Use clamping for tiled sky textures - for (int i=(1<0; i--) + for (bssize_t i=(1<0; i--) if (dapskyoff[i] != dapskyoff[i-1]) { skyclamphack = r_parallaxskyclamping; break; } @@ -3017,7 +3017,7 @@ static void polymost_drawalls(int32_t const bunch) pow2xsplit = 0; skyclamphack = 1; - for (int i=0; i<4; i++) + for (bssize_t i=0; i<4; i++) { walpos = skywal[i&3]; vec2f_t skyp0 = { walpos.y * gcosang - walpos.x * gsinang, @@ -3222,7 +3222,7 @@ static void polymost_drawalls(int32_t const bunch) calc_and_apply_fog_factor(sec->ceilingpicnum, sec->ceilingshade, sec->visibility, sec->ceilingpal, 0.005f); //Use clamping for tiled sky textures - for (int i=(1<0; i--) + for (bssize_t i=(1<0; i--) if (dapskyoff[i] != dapskyoff[i-1]) { skyclamphack = r_parallaxskyclamping; break; } @@ -3309,7 +3309,7 @@ static void polymost_drawalls(int32_t const bunch) pow2xsplit = 0; skyclamphack = 1; - for (int i=0; i<4; i++) + for (bssize_t i=0; i<4; i++) { walpos = skywal[i&3]; vec2f_t skyp0 = { walpos.y * gcosang - walpos.x * gsinang, @@ -3664,7 +3664,7 @@ void polymost_scansector(int32_t sectnum) { sectnum = sectorborder[--sectorbordercnt]; - for (int z=headspritesect[sectnum]; z>=0; z=nextspritesect[z]) + for (bssize_t z=headspritesect[sectnum]; z>=0; z=nextspritesect[z]) { uspritetype const * const spr = (uspritetype *)&sprite[z]; @@ -3753,7 +3753,7 @@ void polymost_scansector(int32_t sectnum) } } - for (int z=numscansbefore; z dxb1[bunchp2[z]])) { @@ -3766,7 +3766,7 @@ void polymost_scansector(int32_t sectnum) } } - for (int z=bunchfrst; z=0; zz=bunchp2[zz]) { } @@ -3789,7 +3789,7 @@ static void polymost_initmosts(const float * px, const float * py, int const n) int32_t imin = (px[1] < px[0]); - for (int i=n-1; i>=2; i--) + for (bssize_t i=n-1; i>=2; i--) if (px[i] < px[imin]) imin = i; int32_t vcnt = 1; //0 is dummy solid node @@ -3941,7 +3941,7 @@ void polymost_drawrooms() { (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++) + for (bssize_t i=0; i<4; i++) { //Tilt rotation (backwards) vec2f_t const o = { p[i].x-ghalfx, p[i].y-ghoriz }; @@ -3958,7 +3958,7 @@ void polymost_drawrooms() vec3f_t p2[6]; - for (int i=0; i<4; i++) + for (bssize_t i=0; i<4; i++) { int const j = i < 3 ? i + 1 : 0; @@ -3978,7 +3978,7 @@ void polymost_drawrooms() float sx[4], sy[4]; - for (int i = 0; i < n; i++) + for (bssize_t i = 0; i < n; i++) { float const r = ghalfx / p2[i].z; sx[i] = p2[i].x * r + ghalfx; @@ -4023,13 +4023,13 @@ void polymost_drawrooms() int32_t closest = 0; //Almost works, but not quite :( - for (int i=1; i= n2) j = 0; @@ -4264,7 +4264,7 @@ static inline int32_t polymost_findwall(uspritetype const * const tspr, vec2_t c usectortype const * const sect = (usectortype * )§or[tspr->sectnum]; vec2_t n; - for (int i=sect->wallptr; iwallptr + sect->wallnum; i++) + for (bssize_t i=sect->wallptr; iwallptr + sect->wallnum; i++) { if ((wall[i].nextsector == -1 || ((sector[wall[i].nextsector].ceilingz > (tspr->z - ((tsiz->y * tspr->yrepeat) << 2))) || sector[wall[i].nextsector].floorz < tspr->z)) && !polymost_getclosestpointonwall((const vec2_t *) tspr, i, &n)) @@ -4775,7 +4775,7 @@ void polymost_drawsprite(int32_t snum) vec2f_t pxy[6]; // Project 3D to 2D - for (int j = 0; j < 4; j++) + for (bssize_t j = 0; j < 4; j++) { vec2f_t s0 = { (float)(tspr->x - globalposx), (float)(tspr->y - globalposy) }; @@ -4816,7 +4816,7 @@ void polymost_drawsprite(int32_t snum) int32_t npoints = 0; vec2f_t p2[6]; - for (int i = 0, j = 1; i < 4; j = ((++i + 1) & 3)) + for (bssize_t i = 0, j = 1; i < 4; j = ((++i + 1) & 3)) { if (pxy[i].y >= SCISDIST) p2[npoints++] = pxy[i]; @@ -4846,7 +4846,7 @@ void polymost_drawsprite(int32_t snum) float f = (float)(tspr->z - globalposz + fadjust) * gyxscale; - for (int j = 0; j < npoints; j++) + for (bssize_t j = 0; j < npoints; j++) { float const ryp0 = 1.f / p2[j].y; pxy[j].x = ghalfx * p2[j].x * ryp0 + ghalfx; @@ -5419,7 +5419,7 @@ static void drawtrap(float x0, float x1, float y0, float x2, float x3, float y1) else { px[1] = x1; py[1] = y0; px[2] = x3; px[3] = x2; py[3] = y1; n = 4; } bglBegin(GL_TRIANGLE_FAN); - for (int i=0; imdnum == 3) ? ((md3model_t *)models[mid])->head.numsurfs : 0; - for (int i = 0; i <= j; i++) mdloadskin((md2model_t *)models[mid], 0, dapalnum, i); + for (bssize_t i = 0; i <= j; i++) mdloadskin((md2model_t *)models[mid], 0, dapalnum, i); } #else /* if !defined USE_OPENGL */ diff --git a/polymer/eduke32/build/src/pragmas.c b/polymer/eduke32/build/src/pragmas.c index aa6006917..a0f82c780 100644 --- a/polymer/eduke32/build/src/pragmas.c +++ b/polymer/eduke32/build/src/pragmas.c @@ -18,7 +18,7 @@ void initdivtables(void) libdivide_s64_t d; libdivide_s32_t d32; - for (int i=1; i= 0; ii--) + for (bssize_t ii = texcache.numentries - 1; ii >= 0; ii--) if (i != ii && texcache.iptrs[ii] == texcache.iptrs[i]) { /*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/ @@ -689,7 +689,7 @@ static int32_t texcache_loadmips(const texcacheheader *head, GLenum *glerr) UNREFERENCED_PARAMETER(head); #endif - for (int32_t level = 0; level==0 || (pict.xdim > 1 || pict.ydim > 1); level++) + for (bssize_t level = 0; level==0 || (pict.xdim > 1 || pict.ydim > 1); level++) { if (texcache_readdata(&pict, sizeof(texcachepicture))) { diff --git a/polymer/eduke32/build/src/tiles.c b/polymer/eduke32/build/src/tiles.c index 875b39732..fe0746adf 100644 --- a/polymer/eduke32/build/src/tiles.c +++ b/polymer/eduke32/build/src/tiles.c @@ -46,7 +46,7 @@ static inline void clearmapartfilename(void) static inline void E_RecalcPicSiz(void) { - for (int i=0; i= MAXARTFILES_BASE) { @@ -147,7 +147,7 @@ void E_MapArt_Setup(const char *filename) ALLOC_MAPART_ARRAY(tilesiz, g_bakTileSiz); ALLOC_MAPART_ARRAY(picanm, g_bakPicAnm); - for (int i=MAXARTFILES_BASE; inumtiles*sizeof(int16_t)); kread(fil, &picanm[local->tilestart], local->numtiles*sizeof(picanm_t)); - for (int i=local->tilestart; i<=local->tileend; i++) + for (bssize_t i=local->tilestart; i<=local->tileend; i++) { tilesiz[i].x = B_LITTLE16(tilesizx[i-local->tilestart]); tilesiz[i].y = B_LITTLE16(tilesizy[i-local->tilestart]); @@ -364,7 +364,7 @@ void E_ReadArtFileIntoFakeData(int32_t const fil, artheader_t const * const loca char *buffer = NULL; int32_t buffersize = 0; - for (int i=local->tilestart; i<=local->tileend; i++) + for (bssize_t i=local->tilestart; i<=local->tileend; i++) { int const dasiz = tilesiz[i].x * tilesiz[i].y; @@ -435,7 +435,7 @@ static int32_t E_ReadArtFileOfID(int32_t tilefilei) { // Check whether we can evict existing tiles to make place for // per-map ART ones. - for (int32_t i=local.tilestart; i<=local.tileend; i++) + for (bssize_t i=local.tilestart; i<=local.tileend; i++) { // Tiles having dummytile replacements or those that are // cache1d-locked can't be replaced. @@ -463,7 +463,7 @@ static int32_t E_ReadArtFileOfID(int32_t tilefilei) { int offscount = 4+4+4+4+(local.numtiles<<3); - for (int i=local.tilestart; i<=local.tileend; ++i) + for (bssize_t i=local.tilestart; i<=local.tileend; ++i) { int const dasiz = tilesiz[i].x * tilesiz[i].y; @@ -498,7 +498,7 @@ int32_t loadpics(const char *filename, int32_t askedsize) // artsize = 0; - for (int tilefilei=0; tilefilei=0; i--) + for (bssize_t i=xsiz*ysiz-1; i>=0; i--) { pic2[i].b = cptr[pic[i].r]; pic2[i].g = cptr[pic[i].g]; @@ -60,7 +60,7 @@ uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i if (palookup[dapal] == NULL) dapal = 0; - for (int32_t i=xsiz*ysiz-1; i>=0; i--) + for (bssize_t i=xsiz*ysiz-1; i>=0; i--) { const int32_t ii = palookup[dapal][pic[i].a]; @@ -265,8 +265,8 @@ static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1, nx = x0; break; } - for (int32_t yy=0; yymytexx) - for (int32_t xx=0; xxmytexx) + for (bssize_t xx=0; xxmytex[(shp[z].y+yy)*gvox->mytexx + shp[z].x]; lptr[xx] = lptr[VOXBORDWIDTH]; @@ -309,7 +309,7 @@ static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1, } //Extend borders vertically - for (int32_t yy=0; yymytex[(shp[z].y+yy)*gvox->mytexx + shp[z].x], &gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx + shp[z].x], @@ -325,7 +325,7 @@ static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1, qptr->v[1].x = x1; qptr->v[1].y = y1; qptr->v[1].z = z1; qptr->v[2].x = x2; qptr->v[2].y = y2; qptr->v[2].z = z2; - for (int32_t j=0; j<3; j++) + for (bssize_t j=0; j<3; j++) { qptr->v[j].u = shp[z].x+VOXBORDWIDTH; qptr->v[j].v = shp[z].y+VOXBORDWIDTH; @@ -416,7 +416,7 @@ static voxmodel_t *vox2poly() int32_t ov, oz=0; - for (int32_t cnt=0; cnt<2; cnt++) + for (bssize_t cnt=0; cnt<2; cnt++) { void (*daquad)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t) = cnt == 0 ? cntquad : addquad; @@ -427,9 +427,9 @@ static voxmodel_t *vox2poly() int32_t v = 0; for (i=-1; i<=1; i+=2) - for (int32_t y=0; y= 0) && ((by0[z] != oz) || (v >= ov))) @@ -443,9 +443,9 @@ static voxmodel_t *vox2poly() } for (i=-1; i<=1; i+=2) - for (int32_t z=0; z= 0) && ((by0[y] != oz) || (v >= ov))) @@ -459,9 +459,9 @@ static voxmodel_t *vox2poly() } for (i=-1; i<=1; i+=2) - for (int32_t x=0; x= 0) && ((by0[z] != oz) || (v >= ov))) @@ -480,8 +480,8 @@ static voxmodel_t *vox2poly() int32_t sc = 0; - for (int32_t y=gmaxy; y; y--) - for (int32_t x=gmaxx; x>=y; x--) + for (bssize_t y=gmaxy; y; y--) + for (bssize_t x=gmaxx; x>=y; x--) { i = shcnt[y*shcntp+x]; shcnt[y*shcntp+x] = sc; //shcnt changes from counter to head index @@ -515,7 +515,7 @@ skindidntfit: memset(zbit, 0, i); v = gvox->mytexx*gvox->mytexy; - for (int32_t z=0; z=y; x--) + for (bssize_t y=gmaxy; y; y--) + for (bssize_t x=gmaxx; x>=y; x--) { i = shcnt[y*shcntp+x]; @@ -603,7 +603,7 @@ static void read_pal(int32_t fil, int32_t pal[256]) { klseek(fil, -768, SEEK_END); - for (int32_t i=0; i<256; i++) + for (bssize_t i=0; i<256; i++) { char c[3]; kread(fil, c, 3); @@ -640,12 +640,12 @@ static int32_t loadvox(const char *filnam) char *const tbuf = (char *)Xmalloc(voxsiz.z*sizeof(uint8_t)); klseek(fil, 12, SEEK_SET); - for (int32_t x=0; x=0; z--) + for (bssize_t z=voxsiz.z-1; z>=0; z--) if (tbuf[z] != 255) { const int32_t i = j+z; @@ -654,12 +654,12 @@ static int32_t loadvox(const char *filnam) } klseek(fil, 12, SEEK_SET); - for (int32_t x=0; xqcnt; i++) + for (bssize_t i=0, fi=0; iqcnt; i++) { if (i == m->qfacind[fi]) { @@ -1034,7 +1034,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr) const int32_t yy = vptr[0].y + vptr[2].y; const int32_t zz = vptr[0].z + vptr[2].z; - for (int32_t j=0; j<4; j++) + for (bssize_t j=0; j<4; j++) { vec3f_t fp; #if (VOXBORDWIDTH == 0) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 1e073e99c..3a41170bd 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -42,7 +42,7 @@ int32_t G_SetInterpolation(int32_t * const posptr) if (g_numInterpolations >= MAXINTERPOLATIONS) return 1; - for (int i = 0; i < g_numInterpolations; ++i) + for (bssize_t i = 0; i < g_numInterpolations; ++i) if (curipos[i] == posptr) return 0; @@ -54,7 +54,7 @@ int32_t G_SetInterpolation(int32_t * const posptr) void G_StopInterpolation(int32_t * const posptr) { - for (int i = 0; i < g_numInterpolations; ++i) + for (bssize_t i = 0; i < g_numInterpolations; ++i) if (curipos[i] == posptr) { g_numInterpolations--; @@ -71,7 +71,7 @@ void G_DoInterpolations(int32_t smoothratio) //Stick at beginning of draws int32_t odelta, ndelta = 0; - for (int i = 0, j = 0; i < g_numInterpolations; ++i) + for (bssize_t i = 0, j = 0; i < g_numInterpolations; ++i) { odelta = ndelta; bakipos[i] = *curipos[i]; @@ -91,7 +91,7 @@ void G_ClearCameraView(DukePlayer_t *ps) updatesector(ps->pos.x, ps->pos.y, &ps->cursectnum); P_UpdateScreenPal(ps); - for (int SPRITES_OF(STAT_ACTOR, k)) + for (bssize_t SPRITES_OF(STAT_ACTOR, k)) if (sprite[k].picnum==CAMERA1) sprite[k].yvel = 0; } @@ -190,7 +190,7 @@ SKIPWALLCHECK: q = -ZOFFSET2 + (krand()&(ZOFFSET5-1)); - for (int stati=0; stati < ARRAY_SSIZE(statnumList); stati++) + for (bssize_t stati=0; stati < ARRAY_SSIZE(statnumList); stati++) { int32_t otherSprite = headspritestat[statnumList[stati]]; @@ -529,7 +529,7 @@ int32_t A_MoveSpriteClipdist(int32_t spriteNum, vec3_t const * const change, uin { // Projectile sector changes due to transport SEs (SE7_PROJECTILE). // PROJECTILE_CHSECT - for (int SPRITES_OF(STAT_TRANSPORT, otherSpriteNum)) + for (bssize_t SPRITES_OF(STAT_TRANSPORT, otherSpriteNum)) { if (sprite[otherSpriteNum].sectnum == newSectnum) { @@ -651,7 +651,7 @@ void A_DoGuts(int32_t spriteNum, int32_t tileNum, int32_t spawnCnt) if (pSprite->picnum == COMMANDER) gutZ -= (24<<8); - for (int j=spawnCnt; j>0; j--) + for (bssize_t j=spawnCnt; j>0; j--) { int const i = A_InsertSprite(pSprite->sectnum, pSprite->x + (krand() & 255) - 128, pSprite->y + (krand() & 255) - 128, gutZ - (krand() & 8191), tileNum, -32, repeat.x, @@ -684,7 +684,7 @@ void A_DoGutsDir(int32_t spriteNum, int32_t tileNum, int32_t spawnCnt) if (s->picnum == COMMANDER) gutZ -= (24<<8); - for (int j=spawnCnt; j>0; j--) + for (bssize_t j=spawnCnt; j>0; j--) { int const i = A_InsertSprite(s->sectnum, s->x, s->y, gutZ, tileNum, -32, repeat.x, repeat.y, krand() & 2047, 256 + (krand() & 127), -512 - (krand() & 2047), spriteNum, 5); @@ -708,7 +708,7 @@ LUNATIC_EXTERN int32_t G_ToggleWallInterpolation(int32_t wallNum, int32_t setInt void Sect_ToggleInterpolation(int sectNum, int setInterpolation) { - for (int j = sector[sectNum].wallptr, endwall = sector[sectNum].wallptr + sector[sectNum].wallnum; j < endwall; j++) + for (bssize_t j = sector[sectNum].wallptr, endwall = sector[sectNum].wallptr + sector[sectNum].wallnum; j < endwall; j++) { G_ToggleWallInterpolation(j, setInterpolation); @@ -753,7 +753,7 @@ void A_MoveSector(int spriteNum) int const endWall = sector[pSprite->sectnum].wallptr + sector[pSprite->sectnum].wallnum; - for (int wallNum = sector[pSprite->sectnum].wallptr; wallNum < endWall; wallNum++) + for (bssize_t wallNum = sector[pSprite->sectnum].wallptr; wallNum < endWall; wallNum++) { vec2_t const origin = g_origins[originIdx]; vec2_t result; @@ -857,7 +857,7 @@ ACTOR_STATIC void A_MaybeAwakenBadGuys(int spriteNum) { uspritetype *const pSprite = (uspritetype *)&sprite[spriteNum]; - for (int nextSprite, SPRITES_OF_STAT_SAFE(STAT_ZOMBIEACTOR, spriteNum, nextSprite)) + for (bssize_t nextSprite, SPRITES_OF_STAT_SAFE(STAT_ZOMBIEACTOR, spriteNum, nextSprite)) { if (A_CheckEnemySprite(&sprite[spriteNum])) { @@ -998,7 +998,7 @@ ACTOR_STATIC void G_MoveZombieActors(void) // stupid name, but it's what the function does. FORCE_INLINE int G_FindExplosionInSector(int sectnum) { - for (int SPRITES_OF(STAT_MISC, i)) + for (bssize_t SPRITES_OF(STAT_MISC, i)) if (PN(i) == EXPLOSION2 && sectnum == SECT(i)) return i; @@ -1089,7 +1089,7 @@ int32_t A_IncurDamage(int32_t spriteNum) void A_MoveCyclers(void) { - for (int i=g_numCyclers-1; i>=0; i--) + for (bssize_t i=g_numCyclers-1; i>=0; i--) { int16_t *const pCycler = cyclers[i]; const int32_t sectNum = pCycler[0]; @@ -1108,7 +1108,7 @@ void A_MoveCyclers(void) { walltype *pWall = &wall[sector[sectNum].wallptr]; - for (int wallsLeft = sector[sectNum].wallnum; wallsLeft > 0; wallsLeft--, pWall++) + for (bssize_t wallsLeft = sector[sectNum].wallnum; wallsLeft > 0; wallsLeft--, pWall++) { if (pWall->hitag != 1) { @@ -1491,7 +1491,7 @@ ACTOR_STATIC void G_MoveFallers(void) { T1(spriteNum) = 1; - for (int SPRITES_OF(STAT_FALLER, j)) + for (bssize_t SPRITES_OF(STAT_FALLER, j)) { if (sprite[j].hitag == SHT(spriteNum)) { @@ -2264,7 +2264,7 @@ DETONATE: sprite[spriteNum].yvel = 0; // VIEWSCREEN_YVEL T1(spriteNum) = 0; - for (int ii = 0; ii < VIEWSCREENFACTOR; ii++) walock[TILE_VIEWSCR - ii] = 199; + for (bssize_t ii = 0; ii < VIEWSCREENFACTOR; ii++) walock[TILE_VIEWSCR - ii] = 199; } } @@ -2602,7 +2602,7 @@ ACTOR_STATIC void P_HandleBeingSpitOn(DukePlayer_t * const ps) int j = 3+(krand()&3); ps->numloogs = j; ps->loogcnt = 24*4; - for (int x=0; x < j; x++) + for (bssize_t x=0; x < j; x++) { ps->loogiex[x] = krand()%xdim; ps->loogiey[x] = krand()%ydim; @@ -2753,7 +2753,7 @@ ACTOR_STATIC void Proj_MoveCustom(int spriteNum) if (pProj->trail >= 0) { - for (int cnt=0; cnt<=pProj->tnum; cnt++) + for (bssize_t cnt=0; cnt<=pProj->tnum; cnt++) { otherSprite = A_Spawn(spriteNum, pProj->trail); @@ -3331,7 +3331,7 @@ static void P_FinishWaterChange(int32_t j, DukePlayer_t *ps, int32_t sectlotag, A_Spawn(j, WATERSPLASH2); if (sectlotag == ST_1_ABOVE_WATER) - for (int l = 0; l < 9; l++) + for (bssize_t l = 0; l < 9; l++) sprite[A_Spawn(ps->i, WATERBUBBLE)].z += krand()&16383; } @@ -3632,7 +3632,7 @@ next_sprite: static int16_t A_FindLocator(int32_t n, int32_t sn) { - for (int SPRITES_OF(STAT_LOCATOR, i)) + for (bssize_t SPRITES_OF(STAT_LOCATOR, i)) { if ((sn == -1 || sn == SECT(i)) && n == SLT(i)) return i; @@ -5043,7 +5043,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 pSprite->yrepeat = l; pSprite->shade = (l >> 1) - 48; - for (int j = pData[0]; j > 0; j--) A_SetSprite(spriteNum, CLIPMASK0); + for (bssize_t j = pData[0]; j > 0; j--) A_SetSprite(spriteNum, CLIPMASK0); goto next_sprite; } @@ -5146,7 +5146,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 A_AddToDeleteQueue(spriteNum); PN(spriteNum) ++; - for (int SPRITES_OF(STAT_MISC, j)) + for (bssize_t SPRITES_OF(STAT_MISC, j)) { if (sprite[j].picnum == BLOODPOOL && ldist(pSprite, &sprite[j]) < 348) { @@ -5734,7 +5734,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 } } - for (int SPRITES_OF_SECT(pSprite->sectnum, p)) + for (bssize_t SPRITES_OF_SECT(pSprite->sectnum, p)) { // KEEPINSYNC1 if (sprite[p].statnum != STAT_EFFECTOR && sprite[p].statnum != STAT_PROJECTILE) @@ -5761,7 +5761,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 else if (l==0 && (pSector->floorstat&64)) { // fix for jittering of sprites in halted rotating sectors - for (int SPRITES_OF_SECT(pSprite->sectnum, p)) + for (bssize_t SPRITES_OF_SECT(pSprite->sectnum, p)) { // KEEPINSYNC1 if (sprite[p].statnum != STAT_EFFECTOR && sprite[p].statnum != STAT_PROJECTILE) @@ -8216,7 +8216,7 @@ int32_t A_CheckSwitchTile(int32_t i) return 1; // Loop to catch both states of switches. - for (int j=1; j>=0; j--) + for (bssize_t j=1; j>=0; j--) { switch (DYNAMICTILEMAP(PN(i)-j)) { diff --git a/polymer/eduke32/source/android/in_android.c b/polymer/eduke32/source/android/in_android.c index ecee68699..e63f1f116 100644 --- a/polymer/eduke32/source/android/in_android.c +++ b/polymer/eduke32/source/android/in_android.c @@ -282,7 +282,7 @@ int32_t AndroidRead(portableread_t r) rv = g_player[myconnectindex].ps->dead_flag; break; case R_PLAYER_INV_AMOUNT: rv = 0; - for (int i = 0; i < GET_MAX; i++) + for (bssize_t i = 0; i < GET_MAX; i++) { if (g_player[myconnectindex].ps->inv_amount[i]) rv += (1 << i); diff --git a/polymer/eduke32/source/cheats.c b/polymer/eduke32/source/cheats.c index 1d71209bd..4526173ad 100644 --- a/polymer/eduke32/source/cheats.c +++ b/polymer/eduke32/source/cheats.c @@ -281,7 +281,7 @@ void G_DoCheats(void) for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++) { - for (int j = 0; j= '0' && ch <= '9')) { @@ -308,7 +308,7 @@ void G_DoCheats(void) { int const weaponLimit = (VOLUMEONE) ? 6 : 0; - for (int weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++) + for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++) { P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]); pPlayer->gotweapon |= (1<gotweapon |= (1<max_ammo_amount[weaponNum]); pPlayer->got_access = 7; @@ -430,10 +430,10 @@ void G_DoCheats(void) { int const weaponLimit = (VOLUMEONE) ? 6 : 0; - for (int weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++) + for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS-weaponLimit; weaponNum++) pPlayer->gotweapon |= (1<max_ammo_amount[weaponNum]); G_CheatGetInv(pPlayer); diff --git a/polymer/eduke32/source/common.c b/polymer/eduke32/source/common.c index 8e9a679a4..8fcd28919 100644 --- a/polymer/eduke32/source/common.c +++ b/polymer/eduke32/source/common.c @@ -203,8 +203,8 @@ void G_InitMultiPsky(int32_t const CLOUDYOCEAN__DYN, int32_t const MOONSKY1__DYN #if 0 // This assertion should hold. See note above. - for (int i=0; i=0; k--) + for (bssize_t k=g_mirrorCount-1; k>=0; k--) { const int32_t j = klabs(wall[g_mirrorWall[k]].x - x) + @@ -582,7 +582,7 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i int32_t startwall = sector[g_mirrorSector[i]].wallptr; int32_t endwall = startwall + sector[g_mirrorSector[i]].wallnum; - for (int32_t k=startwall; k= 0 && (wall[j].cstat&32) && wall[j].overpicnum==MIRROR) // cmp. premap.c @@ -852,7 +852,7 @@ void G_DrawRooms(int playerNum, int smoothRatio) { //Block off unscreen section of 90ø tilted screen int const j = tiltcx-(60*tiltcs); - for (int i=(60*tiltcs)-1; i>=0; i--) + for (bssize_t i=(60*tiltcs)-1; i>=0; i--) { startumost[i] = 1; startumost[i+j] = 1; @@ -2897,7 +2897,7 @@ int A_Spawn(int spriteNum, int tileNum) { int const startwall = sector[sectNum].wallptr; int const endwall = startwall + sector[sectNum].wallnum; - for (int j = startwall; j < endwall; j++) + for (bssize_t j = startwall; j < endwall; j++) { int const nextSect = wall[j].nextsector; @@ -2966,7 +2966,7 @@ int A_Spawn(int spriteNum, int tileNum) int const startWall = sector[sectNum].wallptr; int const endWall = startWall + sector[sectNum].wallnum; - for (int findWall=startWall; findWallshade; @@ -3041,7 +3041,7 @@ int A_Spawn(int spriteNum, int tileNum) int const startWall = sector[sectNum].wallptr; int const endWall = startWall + sector[sectNum].wallnum; - for (int w = startWall; w < endWall; ++w) + for (bssize_t w = startWall; w < endWall; ++w) if (wall[w].hitag == 0) wall[w].hitag = 9999; @@ -3064,7 +3064,7 @@ int A_Spawn(int spriteNum, int tileNum) int const startWall = sector[sectNum].wallptr; int const endWall = startWall + sector[sectNum].wallnum; - for (int w = startWall; w < endWall; ++w) + for (bssize_t w = startWall; w < endWall; ++w) if (wall[w].hitag == 0) wall[w].hitag = 9999; @@ -3083,7 +3083,7 @@ int A_Spawn(int spriteNum, int tileNum) pSprite->owner = sector[sectNum].ceilingpal << 8; pSprite->owner |= sector[sectNum].floorpal; - for (int w = startWall; w < endWall; ++w) + for (bssize_t w = startWall; w < endWall; ++w) if (wall[w].shade > T4(newSprite)) T4(newSprite) = wall[w].shade; } @@ -3102,7 +3102,7 @@ int A_Spawn(int spriteNum, int tileNum) int const startWall = sector[sectNum].wallptr; int const endWall = startWall + sector[sectNum].wallnum; - for (int w = startWall; w < endWall; ++w) + for (bssize_t w = startWall; w < endWall; ++w) if (wall[w].shade > T3(newSprite)) T3(newSprite) = wall[w].shade; @@ -3161,7 +3161,7 @@ int A_Spawn(int spriteNum, int tileNum) int const endWall = startWall+sector[sectNum].wallnum; T2(newSprite) = tempwallptr; - for (int w = startWall; w < endWall; ++w) + for (bssize_t w = startWall; w < endWall; ++w) { g_origins[tempwallptr].x = wall[w].x - pSprite->x; g_origins[tempwallptr].y = wall[w].y - pSprite->y; @@ -4616,7 +4616,7 @@ void G_HandleLocalKeys(void) int ridiculeNum = 0; // NOTE: sc_F1 .. sc_F10 are contiguous. sc_F11 is not sc_F10+1. - for (int j=sc_F1; j<=sc_F10; j++) + for (bssize_t j=sc_F1; j<=sc_F10; j++) if (KB_UnBoundKeyPressed(j)) { KB_ClearKeyDown(j); @@ -5411,7 +5411,7 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass) if (pScript) parsedefinitions_game(pScript, firstPass); - for (int i=0; i < g_defModulesNum; ++i) + for (bssize_t i=0; i < g_defModulesNum; ++i) parsedefinitions_game_include(g_defModules[i], NULL, "null", firstPass); if (pScript) @@ -5620,19 +5620,19 @@ static void A_InitEnemyFlags(void) int NoWaterDipEnemies[] = { OCTABRAIN, COMMANDER, DRONE }; int GreenSlimeFoodEnemies[] = { LIZTROOP, LIZMAN, PIGCOP, NEWBEAST }; - for (int i=GREENSLIME; i<=GREENSLIME+7; i++) + for (bssize_t i=GREENSLIME; i<=GREENSLIME+7; i++) SETFLAG(i, SFLAG_HARDCODED_BADGUY); - for (int i=ARRAY_SIZE(DukeEnemies)-1; i>=0; i--) + for (bssize_t i=ARRAY_SIZE(DukeEnemies)-1; i>=0; i--) SETFLAG(DukeEnemies[i], SFLAG_HARDCODED_BADGUY); - for (int i=ARRAY_SIZE(SolidEnemies)-1; i>=0; i--) + for (bssize_t i=ARRAY_SIZE(SolidEnemies)-1; i>=0; i--) SETFLAG(SolidEnemies[i], SFLAG_NODAMAGEPUSH); - for (int i=ARRAY_SIZE(NoWaterDipEnemies)-1; i>=0; i--) + for (bssize_t i=ARRAY_SIZE(NoWaterDipEnemies)-1; i>=0; i--) SETFLAG(NoWaterDipEnemies[i], SFLAG_NOWATERDIP); - for (int i=ARRAY_SIZE(GreenSlimeFoodEnemies)-1; i>=0; i--) + for (bssize_t i=ARRAY_SIZE(GreenSlimeFoodEnemies)-1; i>=0; i--) SETFLAG(GreenSlimeFoodEnemies[i], SFLAG_GREENSLIMEFOOD); } #undef SETFLAG @@ -6120,7 +6120,7 @@ int app_main(int argc, char const * const * argv) // used with binds for fast function lookup hash_init(&h_gamefuncs); - for (int i=NUMGAMEFUNCTIONS-1; i>=0; i--) + for (bssize_t i=NUMGAMEFUNCTIONS-1; i>=0; i--) { char *str = Bstrtolower(Xstrdup(gamefunctions[i])); hash_add(&h_gamefuncs,gamefunctions[i],i,0); @@ -6246,11 +6246,11 @@ int app_main(int argc, char const * const * argv) } else { - for (int i=0; ipalette = BASEPAL; - for (int i=1, j=numplayers; jteam = g_player[j].pteam = i; g_player[j].ps->weaponswitch = 3; g_player[j].ps->auto_aim = 0; @@ -6289,7 +6289,7 @@ int app_main(int argc, char const * const * argv) loaddefinitions_game(defsfile, FALSE); } - for (int i=0; i < g_defModulesNum; ++i) + for (bssize_t i=0; i < g_defModulesNum; ++i) Bfree(g_defModules[i]); DO_FREE_AND_NULL(g_defModules); g_defModulesNum = 0; @@ -6366,7 +6366,7 @@ int app_main(int argc, char const * const * argv) CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent); // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too - for (int i=0; i 0) initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError); - for (int i=0; i < g_clipMapFilesNum; ++i) + for (bssize_t i=0; i < g_clipMapFilesNum; ++i) Bfree(g_clipMapFiles[i]); DO_FREE_AND_NULL(g_clipMapFiles); g_clipMapFilesNum = 0; @@ -6384,7 +6384,7 @@ int app_main(int argc, char const * const * argv) // check if the minifont will support lowercase letters (3136-3161) // there is room for them in tiles012.art between "[\]^_." and "{|}~" minitext_lowercase = 1; - for (int i = MINIFONT + ('a'-'!'); minitext_lowercase && i < MINIFONT + ('z'-'!') + 1; ++i) + for (bssize_t i = MINIFONT + ('a'-'!'); minitext_lowercase && i < MINIFONT + ('z'-'!') + 1; ++i) minitext_lowercase &= tile_exists(i); system_getcvars(); @@ -6489,7 +6489,7 @@ MAIN_LOOP_RESTART: ud.m_respawn_monsters = 1; else ud.m_respawn_monsters = 0; - for (int TRAVERSE_CONNECT(i)) + for (bssize_t TRAVERSE_CONNECT(i)) { P_ResetWeapons(i); P_ResetInventory(i); @@ -6716,14 +6716,15 @@ int G_DoMoveThings(void) if (g_RTSPlaying > 0) g_RTSPlaying--; - for (int i=0; i ud.msgdisptime) + if (--user_quote_time[i] > ud.msgdisptime) user_quote_time[i] = ud.msgdisptime; if (!user_quote_time[i]) pub = NUMPAGES; } + } // Name display when aiming at opponents if (ud.idplayers && (g_netServer || ud.multimode > 1) @@ -6735,14 +6736,14 @@ int G_DoMoveThings(void) hitdata_t hitData; DukePlayer_t *const pPlayer = g_player[screenpeek].ps; - for (int TRAVERSE_CONNECT(i)) + for (bssize_t TRAVERSE_CONNECT(i)) if (g_player[i].ps->holoduke_on != -1) sprite[g_player[i].ps->holoduke_on].cstat ^= 256; hitscan((vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(pPlayer->ang + 512) & 2047], sintable[pPlayer->ang & 2047], (100 - pPlayer->horiz - pPlayer->horizoff) << 11, &hitData, 0xffff0030); - for (int TRAVERSE_CONNECT(i)) + for (bssize_t TRAVERSE_CONNECT(i)) if (g_player[i].ps->holoduke_on != -1) sprite[g_player[i].ps->holoduke_on].cstat ^= 256; @@ -6782,7 +6783,7 @@ int G_DoMoveThings(void) if (g_netServer || g_netClient) randomseed = ticrandomseed; - for (int TRAVERSE_CONNECT(i)) + for (bssize_t TRAVERSE_CONNECT(i)) Bmemcpy(g_player[i].inputBits, &inputfifo[(g_netServer && myconnectindex == i)][i], sizeof(input_t)); G_UpdateInterpolations(); @@ -6816,7 +6817,7 @@ int G_DoMoveThings(void) A_MoveDummyPlayers();//ST 13 } - for (int TRAVERSE_CONNECT(i)) + for (bssize_t TRAVERSE_CONNECT(i)) { if (g_player[i].inputBits->extbits&(1<<6)) { @@ -6871,7 +6872,7 @@ void A_SpawnWallGlass(int spriteNum,int wallNum,int glassCnt) { if (wallNum < 0) { - for (int j = glassCnt - 1; j >= 0; --j) + for (bssize_t j = glassCnt - 1; j >= 0; --j) { int const a = SA(spriteNum) - 256 + (krand() & 511) + 1024; A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum), GLASSPIECES + (j % 3), -32, 36, 36, a, diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 418c75ad0..e2d2fa38f 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -502,7 +502,7 @@ static inline int G_GetViewscreenSizeShift(const uspritetype *tspr) static const int mask = (1<xrepeat & mask) | (tspr->yrepeat & mask); - for (int i=0; i < VIEWSCREENFACTOR; i++) + for (bssize_t i=0; i < VIEWSCREENFACTOR; i++) if (rem & (1< 0; i--) + for (bssize_t i = 4; i > 0; i--) r |= ((v & b[i]) != 0) << i; return r; @@ -2454,13 +2454,13 @@ void C_UndefineVolume(int32_t vol) { Bassert((unsigned)vol < MAXVOLUMES); - for (int32_t i = 0; i < MAXLEVELS; i++) + for (bssize_t i = 0; i < MAXLEVELS; i++) C_UndefineLevel(vol, i); EpisodeNames[vol][0] = '\0'; g_numVolumes = 0; - for (int32_t i = MAXVOLUMES-1; i >= 0; i--) + for (bssize_t i = MAXVOLUMES-1; i >= 0; i--) { if (EpisodeNames[i][0]) { @@ -2477,7 +2477,7 @@ void C_UndefineSkill(int32_t skill) SkillNames[skill][0] = '\0'; g_numSkills = 0; - for (int32_t i = MAXSKILLS-1; i >= 0; i--) + for (bssize_t i = MAXSKILLS-1; i >= 0; i--) { if (SkillNames[i][0]) { @@ -2626,7 +2626,7 @@ static void C_ReplaceQuoteSubstring(const size_t q, char const * const query, ch { size_t querylength = Bstrlen(query); - for (int i = MAXQUOTELEN - querylength - 2; i >= 0; i--) + for (bssize_t i = MAXQUOTELEN - querylength - 2; i >= 0; i--) if (Bstrncmp(&apStrings[q][i], query, querylength) == 0) { Bmemset(tempbuf, 0, sizeof(tempbuf)); @@ -2641,7 +2641,7 @@ static void C_ReplaceQuoteSubstring(const size_t q, char const * const query, ch void C_InitQuotes(void) { - for (int i = 0; i < 128; i++) C_AllocQuote(i); + for (bssize_t i = 0; i < 128; i++) C_AllocQuote(i); #ifdef EDUKE32_TOUCH_DEVICES apStrings[QUOTE_DEAD] = 0; @@ -2722,14 +2722,14 @@ void C_InitQuotes(void) EDUKE32_STATIC_ASSERT(SUICIDEQUOTEINDEX + ARRAY_SIZE(PlayerSelfObituaries)-1 < MAXQUOTES); g_numObituaries = ARRAY_SIZE(PlayerObituaries); - for (int i = g_numObituaries - 1; i >= 0; i--) + for (bssize_t i = g_numObituaries - 1; i >= 0; i--) { if (C_AllocQuote(i + OBITQUOTEINDEX)) Bstrcpy(apStrings[i + OBITQUOTEINDEX], PlayerObituaries[i]); } g_numSelfObituaries = ARRAY_SIZE(PlayerSelfObituaries); - for (int i = g_numSelfObituaries - 1; i >= 0; i--) + for (bssize_t i = g_numSelfObituaries - 1; i >= 0; i--) { if (C_AllocQuote(i + SUICIDEQUOTEINDEX)) Bstrcpy(apStrings[i + SUICIDEQUOTEINDEX], PlayerSelfObituaries[i]); @@ -6191,7 +6191,7 @@ void C_InitProjectiles(void) DefaultProjectile = Projectile; - for (int i=MAXTILES-1; i>=0; i--) + for (bssize_t i=MAXTILES-1; i>=0; i--) { if (g_tile[i].proj) *g_tile[i].proj = DefaultProjectile; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index ec2b10d22..cba11c892 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -301,7 +301,7 @@ int32_t A_Dodge(spritetype *pSprite) if (A_CheckEnemySprite(pSprite) && pSprite->extra <= 0) // hack return 0; - for (int nexti, SPRITES_OF_STAT_SAFE(STAT_PROJECTILE, i, nexti)) //weapons list + for (bssize_t nexti, SPRITES_OF_STAT_SAFE(STAT_PROJECTILE, i, nexti)) //weapons list { if (OW(i) == i) continue; @@ -334,7 +334,7 @@ int32_t A_GetFurthestAngle(int spriteNum, int angDiv) int const angincs = tabledivide32_noinline(2048, angDiv); hitdata_t hit; - for (int j = pSprite->ang; j < (2048 + pSprite->ang); j += angincs) + for (bssize_t j = pSprite->ang; j < (2048 + pSprite->ang); j += angincs) { pSprite->z -= ZOFFSET3; hitscan((const vec3_t *)pSprite, pSprite->sectnum, @@ -366,7 +366,7 @@ int32_t A_FurthestVisiblePoint(int32_t spriteNum, uspritetype * const pSprite, i int const angincs = 128; // ((!g_netServer && ud.multimode < 2) && ud.player_skill < 3) ? 2048 / 2 : tabledivide32_noinline(2048, 1 + (krand() & 1)); - for (int j = pSprite->ang; j < (2048 + pSprite->ang); j += (angincs /*-(krand()&511)*/)) + for (bssize_t j = pSprite->ang; j < (2048 + pSprite->ang); j += (angincs /*-(krand()&511)*/)) { pSprite->z -= ZOFFSET2; hitscan((const vec3_t *)pSprite, pSprite->sectnum, sintable[(j + 512) & 2047], sintable[j & 2047], @@ -848,7 +848,7 @@ static void P_AddWeaponMaybeSwitch(DukePlayer_t *ps, int weaponNum) int new_wchoice = -1; int curr_wchoice = -1; - for (int i=0; i<=FREEZE_WEAPON && (new_wchoice < 0 || curr_wchoice < 0); i++) + for (bssize_t i=0; i<=FREEZE_WEAPON && (new_wchoice < 0 || curr_wchoice < 0); i++) { int w = g_player[playerNum].wchoice[i]; @@ -3290,7 +3290,7 @@ nullquote: int32_t values[8]; G_GetTimeDate(values); - for (int i = 0; i < 8; i++) + for (bssize_t i = 0; i < 8; i++) Gv_SetVarX(*insptr++, values[i]); continue; @@ -3424,7 +3424,7 @@ nullquote: int debrisTile = *insptr++; if ((unsigned)vm.pSprite->sectnum < MAXSECTORS) - for (int cnt = (*insptr) - 1; cnt >= 0; cnt--) + for (bssize_t cnt = (*insptr) - 1; cnt >= 0; cnt--) { int const tileOffset = (vm.pSprite->picnum == BLIMP && debrisTile == SCRAP1) ? 0 : (krand() % 3); @@ -4646,7 +4646,7 @@ finish_qsprintf: aGameArrays[arrayNum].pValues = (intptr_t *)Xaligned_alloc(ACTOR_VAR_ALIGNMENT, numElements * GAR_ELTSZ); aGameArrays[arrayNum].size = numElements; #ifdef BITNESS64 - for (int i = 0; i < numElements; i++) + for (bssize_t i = 0; i < numElements; i++) aGameArrays[arrayNum].pValues[i] = pArray[i]; // int32_t --> int64_t Bfree(pArray); #else @@ -4677,7 +4677,7 @@ finish_qsprintf: int const arraySize = aGameArrays[arrayNum].size; int *const pArray = (int32_t *)Xmalloc(sizeof(int32_t) * arraySize); - for (int k = 0; k < arraySize; k++) + for (bssize_t k = 0; k < arraySize; k++) pArray[k] = Gv_GetGameArrayValue(arrayNum, k); fwrite(pArray, 1, sizeof(int32_t) * arraySize, fil); @@ -5332,7 +5332,7 @@ finish_qsprintf: switch (iterType) { case ITER_ALLSPRITES: - for (int jj=0; jj= MAXSECTORS) goto badindex; - for (int jj=headspritesect[nIndex]; jj>=0; jj=nextspritesect[jj]) + for (bssize_t jj=headspritesect[nIndex]; jj>=0; jj=nextspritesect[jj]) { Gv_SetVarX(returnVar, jj); insptr = pNext; @@ -5417,7 +5417,7 @@ finish_qsprintf: break; case ITER_SPRITESOFSTATUS: if ((unsigned) nIndex >= MAXSTATUS) goto badindex; - for (int jj=headspritestat[nIndex]; jj>=0; jj=nextspritestat[jj]) + for (bssize_t jj=headspritestat[nIndex]; jj>=0; jj=nextspritestat[jj]) { Gv_SetVarX(returnVar, jj); insptr = pNext; @@ -5426,7 +5426,7 @@ finish_qsprintf: break; case ITER_WALLSOFSECTOR: if ((unsigned) nIndex >= MAXSECTORS) goto badindex; - for (int jj=sector[nIndex].wallptr, endwall=jj+sector[nIndex].wallnum-1; + for (bssize_t jj=sector[nIndex].wallptr, endwall=jj+sector[nIndex].wallnum-1; jj<=endwall; jj++) { Gv_SetVarX(returnVar, jj); @@ -5448,7 +5448,7 @@ finish_qsprintf: } break; case ITER_RANGE: - for (int jj=0; jjg_globalRandom,&g_globalRandom,sizeof(g_globalRandom)); #if !defined LUNATIC - for (int i=g_gameVarCount-1; i>=0; i--) + for (bssize_t i=g_gameVarCount-1; i>=0; i--) { if (aGameVars[i].flags & GAMEVAR_NORESET) continue; if (aGameVars[i].flags & GAMEVAR_PERPLAYER) @@ -6043,7 +6043,7 @@ void G_RestoreMapState(void) { int playerHealth[MAXPLAYERS]; - for (int i=0; ii].extra; pub = NUMPAGES; @@ -6063,7 +6063,7 @@ void G_RestoreMapState(void) if (g_currentEventExec == EVENT_ANIMATESPRITES) { initprintf("Line %d: loadmapstate called from EVENT_ANIMATESPRITES. WHY?\n",g_errorLineNum); - for (int i=0; irandomseed,sizeof(randomseed)); Bmemcpy(&g_globalRandom,&pSavedState->g_globalRandom,sizeof(g_globalRandom)); #if !defined LUNATIC - for (int i=g_gameVarCount-1; i>=0; i--) + for (bssize_t i=g_gameVarCount-1; i>=0; i--) { if (aGameVars[i].flags & GAMEVAR_NORESET) continue; if (aGameVars[i].flags & GAMEVAR_PERPLAYER) @@ -6144,14 +6144,14 @@ void G_RestoreMapState(void) // - walk forward (to door leading to other level "Shadowpine Forest") // - in new level, walk backward to get back to the Spider Den // - walk backward to the door leading to Shadowpine Forest --> crash. - for (int SPRITES_OF(STAT_PLAYER, i)) + for (bssize_t SPRITES_OF(STAT_PLAYER, i)) { int32_t snum = P_Get(i); Bassert((unsigned)snum < MAXPLAYERS); g_player[snum].ps->i = i; } - for (int i=0; ii].extra = playerHealth[i]; if (g_player[myconnectindex].ps->over_shoulder_on != 0) @@ -6165,7 +6165,7 @@ void G_RestoreMapState(void) if (ud.lockout) { - for (int x=g_numAnimWalls-1; x>=0; x--) + for (bssize_t x=g_numAnimWalls-1; x>=0; x--) switch (DYNAMICTILEMAP(wall[animwall[x].wallnum].picnum)) { case FEMPIC1__STATIC: @@ -6180,7 +6180,7 @@ void G_RestoreMapState(void) #if 0 else { - for (int x=g_numAnimWalls-1; x>=0; x--) + for (bssize_t x=g_numAnimWalls-1; x>=0; x--) if (wall[animwall[x].wallnum].extra >= 0) wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; } diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 878d5f3b8..15dbf0588 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -64,7 +64,7 @@ intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Muzzle flash color // Returns: old g_gameVarCount | (g_gameArrayCount<<16). static int Gv_Free(void) { - for (int i=0; ilog.errors = 0; - for (int i=0; i=0; --j) + for (bssize_t j=MAXPLAYERS-1; j>=0; --j) aGameVars[gV].pValues[j]=lValue; } else if (aGameVars[gV].flags & GAMEVAR_PERACTOR) @@ -544,7 +544,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags) aGameVars[gV].pValues = (intptr_t *) Xaligned_alloc(ACTOR_VAR_ALIGNMENT, MAXSPRITES * sizeof(intptr_t)); Bmemset(aGameVars[gV].pValues, 0, MAXSPRITES * sizeof(intptr_t)); } - for (int j=MAXSPRITES-1; j>=0; --j) + for (bssize_t j=MAXSPRITES-1; j>=0; --j) aGameVars[gV].pValues[j]=lValue; } else aGameVars[gV].global = lValue; @@ -1124,7 +1124,7 @@ perr: void __fastcall Gv_GetManyVars(int const count, int32_t * const rv) { - for (int j = 0; j < count; ++j) + for (bssize_t j = 0; j < count; ++j) { int gameVar = *insptr++; @@ -1241,49 +1241,49 @@ void Gv_ResetSystemDefaults(void) //AddLog("ResetWeaponDefaults"); - for (int weaponNum = 0; weaponNum < MAX_WEAPONS; ++weaponNum) + for (bssize_t weaponNum = 0; weaponNum < MAX_WEAPONS; ++weaponNum) { - for (int playerNum = 0; playerNum < MAXPLAYERS; ++playerNum) + for (bssize_t playerNum = 0; playerNum < MAXPLAYERS; ++playerNum) { - Bsprintf(aszBuf, "WEAPON%d_CLIP", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_CLIP", weaponNum); aplWeaponClip[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_RELOAD", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_RELOAD", weaponNum); aplWeaponReload[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_FIREDELAY", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_FIREDELAY", weaponNum); aplWeaponFireDelay[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_TOTALTIME", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_TOTALTIME", weaponNum); aplWeaponTotalTime[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_HOLDDELAY", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_HOLDDELAY", weaponNum); aplWeaponHoldDelay[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_FLAGS", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_FLAGS", weaponNum); aplWeaponFlags[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_SHOOTS", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_SHOOTS", weaponNum); aplWeaponShoots[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); if ((unsigned)aplWeaponShoots[weaponNum][playerNum] >= MAXTILES) aplWeaponShoots[weaponNum][playerNum] = 0; - Bsprintf(aszBuf, "WEAPON%d_SPAWNTIME", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_SPAWNTIME", weaponNum); aplWeaponSpawnTime[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_SPAWN", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_SPAWN", weaponNum); aplWeaponSpawn[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_SHOTSPERBURST", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_SHOTSPERBURST", weaponNum); aplWeaponShotsPerBurst[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_WORKSLIKE", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_WORKSLIKE", weaponNum); aplWeaponWorksLike[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_INITIALSOUND", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_INITIALSOUND", weaponNum); aplWeaponInitialSound[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_FIRESOUND", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_FIRESOUND", weaponNum); aplWeaponFireSound[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_SOUND2TIME", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_SOUND2TIME", weaponNum); aplWeaponSound2Time[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_SOUND2SOUND", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_SOUND2SOUND", weaponNum); aplWeaponSound2Sound[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_RELOADSOUND1", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_RELOADSOUND1", weaponNum); aplWeaponReloadSound1[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_RELOADSOUND2", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_RELOADSOUND2", weaponNum); aplWeaponReloadSound2[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_SELECTSOUND", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_SELECTSOUND", weaponNum); aplWeaponSelectSound[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); - Bsprintf(aszBuf, "WEAPON%d_FLASHCOLOR", weaponNum); + Bsprintf(aszBuf, "WEAPON%zd_FLASHCOLOR", weaponNum); aplWeaponFlashColor[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum); } } @@ -1301,7 +1301,7 @@ void Gv_ResetSystemDefaults(void) g_structVarIDs = Gv_GetVarIndex("sprite"); #endif - for (int weaponNum = 0; weaponNum <= MAXTILES - 1; weaponNum++) + for (bssize_t weaponNum = 0; weaponNum <= MAXTILES - 1; weaponNum++) if (g_tile[weaponNum].defproj) *g_tile[weaponNum].proj = *g_tile[weaponNum].defproj; @@ -1330,8 +1330,8 @@ static weapondata_t weapondefaults[MAX_WEAPONS] = { }, { - PISTOL_WEAPON, /*NAM_WW2GI?20:*/12, /*NAM_WW2GI?50:*/27, 2, 5, 0, - /*(NAM_WW2GI?WEAPON_HOLSTER_CLEARS_CLIP:0) |*/ WEAPON_RELOAD_TIMING, + PISTOL_WEAPON, 12, 27, 2, 5, 0, + WEAPON_RELOAD_TIMING, SHOTSPARK1__STATIC, 2, SHELL__STATIC, 0, 0, PISTOL_FIRE__STATIC, 0, 0, EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, INSERT_CLIP__STATIC, 255+(95<<8) }, @@ -1365,7 +1365,7 @@ static weapondata_t weapondefaults[MAX_WEAPONS] = { }, { - SHRINKER_WEAPON, 0, 0, 10, /*NAM_WW2GI?30:*/12, 0, + SHRINKER_WEAPON, 0, 0, 10, 12, 0, WEAPON_GLOWS, SHRINKER__STATIC, 0, 0, 0, SHRINKER_FIRE__STATIC, 0, 0, 0, EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 176+(252<<8)+(120<<16) @@ -1400,9 +1400,9 @@ static weapondata_t weapondefaults[MAX_WEAPONS] = { }, { - GROW_WEAPON, 0, 0, 3, /*NAM_WW2GI?30:*/5, 0, + GROW_WEAPON, 0, 0, 3, 5, 0, WEAPON_GLOWS, - GROWSPARK__STATIC, /*NAM_WW2GI?2:*/0, /*NAM_WW2GI?SHELL:*/0, 0, 0, /*NAM_WW2GI?0:*/EXPANDERSHOOT__STATIC, 0, 0, + GROWSPARK__STATIC, 0, 0, 0, 0, EXPANDERSHOOT__STATIC, 0, 0, EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, SELECT_WEAPON__STATIC, 216+(52<<8)+(20<<16) }, }; @@ -1458,7 +1458,7 @@ static int32_t G_StaticToDynamicSound(int32_t const sound) } while (0) #else # define ADDWEAPONVAR(Weapidx, Membname) do { \ - Bsprintf(aszBuf, "WEAPON%d_" #Membname, Weapidx); \ + Bsprintf(aszBuf, "WEAPON%zd_" #Membname, Weapidx); \ Bstrupr(aszBuf); \ Gv_NewVar(aszBuf, weapondefaults[Weapidx].Membname, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); \ } while (0) @@ -1492,7 +1492,7 @@ static int32_t G_StaticToDynamicSound(int32_t const sound) // We cannot do this before, because the dynamic maps are not yet set up then. void Gv_FinalizeWeaponDefaults(void) { - for (int i=0; i=0; i--) + for (bssize_t i=(MAX_WEAPONS-1); i>=0; i--) { - Bsprintf(aszBuf,"WEAPON%d_CLIP",i); + Bsprintf(aszBuf,"WEAPON%zd_CLIP",i); aplWeaponClip[i]=Gv_GetVarDataPtr(aszBuf); if (!aplWeaponClip[i]) { @@ -1744,41 +1744,41 @@ void Gv_InitWeaponPointers(void) // Bexit(0); G_Shutdown(); } - Bsprintf(aszBuf,"WEAPON%d_RELOAD",i); + Bsprintf(aszBuf,"WEAPON%zd_RELOAD",i); aplWeaponReload[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",i); + Bsprintf(aszBuf,"WEAPON%zd_FIREDELAY",i); aplWeaponFireDelay[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",i); + Bsprintf(aszBuf,"WEAPON%zd_TOTALTIME",i); aplWeaponTotalTime[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",i); + Bsprintf(aszBuf,"WEAPON%zd_HOLDDELAY",i); aplWeaponHoldDelay[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_FLAGS",i); + Bsprintf(aszBuf,"WEAPON%zd_FLAGS",i); aplWeaponFlags[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SHOOTS",i); + Bsprintf(aszBuf,"WEAPON%zd_SHOOTS",i); aplWeaponShoots[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",i); + Bsprintf(aszBuf,"WEAPON%zd_SPAWNTIME",i); aplWeaponSpawnTime[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SPAWN",i); + Bsprintf(aszBuf,"WEAPON%zd_SPAWN",i); aplWeaponSpawn[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",i); + Bsprintf(aszBuf,"WEAPON%zd_SHOTSPERBURST",i); aplWeaponShotsPerBurst[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",i); + Bsprintf(aszBuf,"WEAPON%zd_WORKSLIKE",i); aplWeaponWorksLike[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",i); + Bsprintf(aszBuf,"WEAPON%zd_INITIALSOUND",i); aplWeaponInitialSound[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",i); + Bsprintf(aszBuf,"WEAPON%zd_FIRESOUND",i); aplWeaponFireSound[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",i); + Bsprintf(aszBuf,"WEAPON%zd_SOUND2TIME",i); aplWeaponSound2Time[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",i); + Bsprintf(aszBuf,"WEAPON%zd_SOUND2SOUND",i); aplWeaponSound2Sound[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",i); + Bsprintf(aszBuf,"WEAPON%zd_RELOADSOUND1",i); aplWeaponReloadSound1[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",i); + Bsprintf(aszBuf,"WEAPON%zd_RELOADSOUND2",i); aplWeaponReloadSound2[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",i); + Bsprintf(aszBuf,"WEAPON%zd_SELECTSOUND",i); aplWeaponSelectSound[i]=Gv_GetVarDataPtr(aszBuf); - Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",i); + Bsprintf(aszBuf,"WEAPON%zd_FLASHCOLOR",i); aplWeaponFlashColor[i]=Gv_GetVarDataPtr(aszBuf); } } diff --git a/polymer/eduke32/source/gamevars.h b/polymer/eduke32/source/gamevars.h index cdd9ecc49..b6b6c489d 100644 --- a/polymer/eduke32/source/gamevars.h +++ b/polymer/eduke32/source/gamevars.h @@ -113,7 +113,7 @@ int32_t Gv_NewVar(const char *pszLabel,intptr_t lValue,uint32_t dwFlags); FORCE_INLINE void A_ResetVars(int const spriteNum) { - for (int i = 0; i < g_gameVarCount; ++i) + for (bssize_t i = 0; i < g_gameVarCount; ++i) { if ((aGameVars[i].flags & (GAMEVAR_PERACTOR | GAMEVAR_NODEFAULT)) != GAMEVAR_PERACTOR) continue; diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index fd41495d8..76c6bb34d 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -194,7 +194,7 @@ EXTERN_INLINE_HEADER void G_RestoreInterpolations(void); EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings { - for (int i=g_numInterpolations-1; i>=0; i--) oldipos[i] = *curipos[i]; + for (bssize_t i=g_numInterpolations-1; i>=0; i--) oldipos[i] = *curipos[i]; } EXTERN_INLINE void G_RestoreInterpolations(void) //Stick at end of drawscreen diff --git a/polymer/eduke32/source/jmact/animlib.c b/polymer/eduke32/source/jmact/animlib.c index 08757a2b3..70bf67301 100644 --- a/polymer/eduke32/source/jmact/animlib.c +++ b/polymer/eduke32/source/jmact/animlib.c @@ -328,7 +328,7 @@ int32_t ANIM_NumFrames(void) uint8_t * ANIM_DrawFrame(int32_t framenumber) { - int32_t cnt = anim->currentframe; + bssize_t cnt = anim->currentframe; // handle first play and looping or rewinding if (cnt < 0 || cnt > framenumber) diff --git a/polymer/eduke32/source/m32common.c b/polymer/eduke32/source/m32common.c index e62d23d84..ca11de19c 100644 --- a/polymer/eduke32/source/m32common.c +++ b/polymer/eduke32/source/m32common.c @@ -475,7 +475,7 @@ void create_map_snapshot(void) spritetype *const tspri = (spritetype *)Xmalloc(Numsprites*sizeof(spritetype) + 4); spritetype *spri = tspri; - for (int j=0; j MAXSPRITES) return 1; - for (int i=0; i>3); - for (int s=0; s= MAXSECTORS) goto badindex; - for (int jj=headspritesect[parm2]; jj>=0 && !vm.flags; jj=nextspritesect[jj]) + for (bssize_t jj=headspritesect[parm2]; jj>=0 && !vm.flags; jj=nextspritesect[jj]) { Gv_SetVarX(var, jj); vm.spriteNum = jj; @@ -1397,7 +1397,7 @@ skip_check: case ITER_WALLSOFSECTOR: if (parm2 < 0 || parm2 >= MAXSECTORS) goto badindex; - for (int jj=sector[parm2].wallptr, endwall=jj+sector[parm2].wallnum-1; + for (bssize_t jj=sector[parm2].wallptr, endwall=jj+sector[parm2].wallnum-1; jj<=endwall && !vm.flags; jj++) { Gv_SetVarX(var, jj); @@ -1421,7 +1421,7 @@ skip_check: } break; case ITER_RANGE: - for (int jj=0; jjpos = ptr->start; ptr->delay = _MIDI_ReadDelta(ptr); @@ -517,7 +517,7 @@ static int32_t _MIDI_SendControlChange(int32_t channel, int32_t c1, int32_t c2) int32_t MIDI_AllNotesOff(void) { - for (int channel = 0; channel < NUM_MIDI_CHANNELS; channel++) + for (bssize_t channel = 0; channel < NUM_MIDI_CHANNELS; channel++) { _MIDI_SendControlChange(channel, 0x40, 0); _MIDI_SendControlChange(channel, MIDI_ALL_NOTES_OFF, 0); @@ -542,7 +542,7 @@ static void _MIDI_SetChannelVolume(int32_t channel, int32_t volume) static void _MIDI_SendChannelVolumes(void) { - for (int channel = 0; channel < NUM_MIDI_CHANNELS; channel++) + for (bssize_t channel = 0; channel < NUM_MIDI_CHANNELS; channel++) _MIDI_SetChannelVolume(channel, _MIDI_ChannelVolume[channel]); } @@ -550,7 +550,7 @@ int32_t MIDI_Reset(void) { MIDI_AllNotesOff(); - for (int channel = 0; channel < NUM_MIDI_CHANNELS; channel++) + for (bssize_t channel = 0; channel < NUM_MIDI_CHANNELS; channel++) { _MIDI_SendControlChange(channel, MIDI_RESET_ALL_CONTROLLERS, 0); _MIDI_SendControlChange(channel, MIDI_RPN_MSB, MIDI_PITCHBEND_MSB); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 2d7df30ac..3f6cd64c4 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -114,7 +114,7 @@ static void A_DoWaterTracers(int x1, int y1, int z1, int x2, int y2, int z2, int vec3_t const v = { tabledivide32_noinline(x2 - x1, n + 1), tabledivide32_noinline(y2 - y1, n + 1), tabledivide32_noinline(z2 - z1, n + 1) }; - for (int i=n; i>0; i--) + for (bssize_t i=n; i>0; i--) { x1 += v.x; y1 += v.y; @@ -157,7 +157,7 @@ static void A_HitscanProjTrail(const vec3_t *startPos, const vec3_t *endPos, int int32_t j; - for (int i = pProj->tnum; i > 0; --i) + for (bssize_t i = pProj->tnum; i > 0; --i) { spawnPos.x += increment.x; spawnPos.y += increment.y; @@ -241,12 +241,12 @@ static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projec int lastDist = INT32_MAX; int returnSprite = -1; - for (int k=0; k<4; k++) + for (bssize_t k=0; k<4; k++) { if (returnSprite >= 0) break; - for (int spriteNum=headspritestat[aimstats[k]]; spriteNum >= 0; spriteNum=nextspritestat[spriteNum]) + for (bssize_t spriteNum=headspritestat[aimstats[k]]; spriteNum >= 0; spriteNum=nextspritestat[spriteNum]) { if ((sprite[spriteNum].xrepeat > 0 && sprite[spriteNum].extra >= 0 && (sprite[spriteNum].cstat & (257 + 32768)) == 257) || @@ -561,7 +561,7 @@ static int SectorContainsSE13(int sectNum) { if (sectNum >= 0) { - for (int SPRITES_OF_SECT(sectNum, i)) + for (bssize_t SPRITES_OF_SECT(sectNum, i)) { if (sprite[i].statnum == STAT_EFFECTOR && sprite[i].lotag == SE_13_EXPLOSIVE) return 1; @@ -1630,7 +1630,7 @@ static void P_DisplaySpit(void) int const rotY = loogCounter<<2; - for (int i=0; i < pPlayer->numloogs; i++) + for (bssize_t i=0; i < pPlayer->numloogs; i++) { int const rotAng = klabs(sintable[((loogCounter + i) << 5) & 2047]) >> 5; int const rotZoom = 4096 + ((loogCounter + i) << 9); @@ -1898,7 +1898,7 @@ static void P_FireWeapon(int playerNum) // OSD_Printf("doing %d %d %d\n",PWEAPON(snum, p->curr_weapon, Shoots),p->curr_weapon,snum); A_Shoot(pPlayer->i, PWEAPON(playerNum, pPlayer->curr_weapon, Shoots)); - for (int burstFire = PWEAPON(playerNum, pPlayer->curr_weapon, ShotsPerBurst) - 1; burstFire > 0; --burstFire) + for (bssize_t burstFire = PWEAPON(playerNum, pPlayer->curr_weapon, ShotsPerBurst) - 1; burstFire > 0; --burstFire) { if (PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER) { @@ -3595,7 +3595,7 @@ int P_FindOtherPlayer(int playerNum, int32_t *pDist) int closestPlayer = playerNum; int closestPlayerDist = INT32_MAX; - for (int TRAVERSE_CONNECT(otherPlayer)) + for (bssize_t TRAVERSE_CONNECT(otherPlayer)) { if (playerNum != otherPlayer && sprite[g_player[otherPlayer].ps->i].extra > 0) { @@ -4262,7 +4262,7 @@ static void P_ProcessWeapon(int playerNum) void P_EndLevel(void) { - for (int TRAVERSE_CONNECT(playerNum)) + for (bssize_t TRAVERSE_CONNECT(playerNum)) g_player[playerNum].ps->gm = MODE_EOL; if (ud.from_bonus) @@ -4295,7 +4295,7 @@ static int P_DoFist(DukePlayer_t *pPlayer) { if (pPlayer->buttonpalette && ud.from_bonus == 0) { - for (int TRAVERSE_CONNECT(playerNum)) + for (bssize_t TRAVERSE_CONNECT(playerNum)) g_player[playerNum].ps->gm = MODE_EOL; ud.from_bonus = ud.level_number + 1; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 494f82895..0b08c8ccf 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -636,11 +636,11 @@ void P_RandomSpawnPoint(int playerNum) if (GametypeFlags[ud.coop] & GAMETYPE_TDMSPAWN) { - for (int j=0; jteam == pPlayer->team && sprite[g_player[j].ps->i].extra > 0) { - for (int k=0; kpos.x - g_playerSpawnPoints[k].pos.x, g_player[j].ps->pos.y - g_playerSpawnPoints[k].pos.y); @@ -846,7 +846,7 @@ void P_ResetWeapons(int playerNum) { DukePlayer_t *const pPlayer = g_player[playerNum].ps; - for (int weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++) + for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++) pPlayer->ammo_amount[weaponNum] = 0; pPlayer->weapon_pos = WEAPON_POS_START; @@ -883,7 +883,7 @@ static void resetprestat(int playerNum, int gameMode) DukePlayer_t *const pPlayer = g_player[playerNum].ps; g_spriteDeleteQueuePos = 0; - for (int i = 0; i < g_deleteQueueSize; i++) SpriteDeletionQueue[i] = -1; + for (bssize_t i = 0; i < g_deleteQueueSize; i++) SpriteDeletionQueue[i] = -1; pPlayer->hbomb_on = 0; pPlayer->cheat_phase = 0; @@ -1429,12 +1429,12 @@ end_vol4a: #endif Gv_ResetSystemDefaults(); - for (int i=0; i<(MAXVOLUMES*MAXLEVELS); i++) + for (bssize_t i=0; i<(MAXVOLUMES*MAXLEVELS); i++) ALIGNED_FREE_AND_NULL(aMapInfo[i].savedstate); if (ud.m_coop != 1) { - for (int weaponNum = 0; weaponNum < MAX_WEAPONS; weaponNum++) + for (bssize_t weaponNum = 0; weaponNum < MAX_WEAPONS; weaponNum++) { if (PWEAPON(0, weaponNum, WorksLike) == PISTOL_WEAPON) { @@ -1619,7 +1619,7 @@ static void resetpspritevars(char gameMode) static inline void clearfrags(void) { - for (int i = 0; i < ud.multimode; i++) + for (bssize_t i = 0; i < ud.multimode; i++) { playerdata_t *const pPlayerData = &g_player[i]; pPlayerData->ps->frag = pPlayerData->ps->fraggedself = 0; @@ -1661,11 +1661,11 @@ void G_ClearFIFO(void) int G_FindLevelByFile(const char *fileName) { - for (int volumeNum = 0; volumeNum < MAXVOLUMES; volumeNum++) + for (bssize_t volumeNum = 0; volumeNum < MAXVOLUMES; volumeNum++) { int const volumeOffset = volumeNum * MAXLEVELS; - for (int levelNum = 0; levelNum < MAXLEVELS; levelNum++) + for (bssize_t levelNum = 0; levelNum < MAXLEVELS; levelNum++) { if (aMapInfo[volumeOffset + levelNum].filename == NULL) continue; @@ -2023,7 +2023,7 @@ void G_FreeMapState(int levelNum) return; #if !defined LUNATIC - for (int j=0; j>3, l=Bstrlen((const char *)spec->ptr); + bssize_t cnt, eltnum=-1, nbytes=(getnumvar(spec)+7)>>3, l=Bstrlen((const char *)spec->ptr); if (Bmemcmp(diffptr, spec->ptr, l)) // check STRING magic (sync check) return 1; @@ -922,7 +922,7 @@ readidx_##Idxbits##_##Datbits: \ static uint32_t calcsz(const dataspec_t *spec) { const dataspec_t *sp=spec; - int32_t cnt; + bssize_t cnt; uint32_t dasiz=0; for (; sp->flags!=DS_END; sp++) @@ -1750,7 +1750,7 @@ static void sv_preprojectilesave() #endif g_numProjectiles = 0; - for (int i=0; i 0) ProjectileData = (projectile_t *) Xrealloc(ProjectileData, sizeof(projectile_t) * g_numProjectiles); - for (int i=0; i 390 && totalclock < 780) - for (int t=0; t<35; t+=5) if (bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1]) + for (bssize_t t=0; t<35; t+=5) if (bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1]) { if (t==10 && bonuscnt == 1) { @@ -1725,7 +1725,7 @@ static void G_BonusCutscenes(void) } } - for (int t=0; t<20; t+=5) + for (bssize_t t=0; t<20; t+=5) if (breathe[t+2] && (totalclock%120) > breathe[t] && (totalclock%120) <= breathe[t+1]) { if (t==5 && bonuscnt == 0) diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 9b93ecabf..5559bc809 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -977,7 +977,7 @@ REDODOOR: { j = sprite[j].hitag; - for (int SPRITES_OF(STAT_EFFECTOR, l)) + for (bssize_t SPRITES_OF(STAT_EFFECTOR, l)) { if ((sprite[l].lotag&0xff)==SE_21_DROP_FLOOR && !actor[l].t_data[0] && sprite[l].hitag == j) @@ -1091,14 +1091,14 @@ void G_OperateActivators(int nTag, int playerNum) void G_OperateMasterSwitches(int nTag) { - for (int SPRITES_OF(STAT_STANDABLE, i)) + for (bssize_t SPRITES_OF(STAT_STANDABLE, i)) if (PN(i) == MASTERSWITCH && SLT(i) == nTag && SP(i) == 0) SP(i) = 1; } void G_OperateForceFields(int32_t spriteNum, int32_t wallTag) { - for (int animwallNum = 0; animwallNum < g_numAnimWalls; ++animwallNum) + for (bssize_t animwallNum = 0; animwallNum < g_numAnimWalls; ++animwallNum) { int const wallNum = animwall[animwallNum].wallnum; @@ -1154,7 +1154,7 @@ void G_OperateForceFields(int32_t spriteNum, int32_t wallTag) // 2: is one, on static int G_IsLikeDipswitch(int switchPic) { - for (int i=0; i<2; i++) + for (bssize_t i=0; i<2; i++) if (switchPic == DIPSWITCH+i || switchPic == TECHSWITCH+i || switchPic == ALIENSWITCH+i) return 1+i; @@ -1232,7 +1232,7 @@ int P_ActivateSwitch(int playerNum, int wallOrSprite, int switchType) static const int32_t key_switchpal[3] = { 0, 21, 23 }; static const int32_t need_key_quote[3] = { QUOTE_NEED_BLUE_KEY, QUOTE_NEED_RED_KEY, QUOTE_NEED_YELLOW_KEY }; - for (int nKeyPal = 0; nKeyPal < 3; nKeyPal++) + for (bssize_t nKeyPal = 0; nKeyPal < 3; nKeyPal++) { if (nSwitchPal == key_switchpal[nKeyPal]) { @@ -1268,7 +1268,7 @@ int P_ActivateSwitch(int playerNum, int wallOrSprite, int switchType) break; } - for (int SPRITES_OF(STAT_DEFAULT, spriteNum)) + for (bssize_t SPRITES_OF(STAT_DEFAULT, spriteNum)) { if (lotag == SLT(spriteNum)) { @@ -1321,7 +1321,7 @@ int P_ActivateSwitch(int playerNum, int wallOrSprite, int switchType) } } - for (int nWall=numwalls-1; nWall>=0; nWall--) + for (bssize_t nWall=numwalls-1; nWall>=0; nWall--) { if (lotag == wall[nWall].lotag) { @@ -1403,7 +1403,7 @@ int P_ActivateSwitch(int playerNum, int wallOrSprite, int switchType) if (nSwitchPicnum >= MULTISWITCH && nSwitchPicnum <= MULTISWITCH + 3) lotag += nSwitchPicnum - MULTISWITCH; - for (int SPRITES_OF(STAT_EFFECTOR, spriteNum)) + for (bssize_t SPRITES_OF(STAT_EFFECTOR, spriteNum)) { if (sprite[spriteNum].hitag == lotag) { @@ -1458,7 +1458,7 @@ void G_ActivateBySector(int sectNum, int spriteNum) { int nActivatedSectors = 0; - for (int SPRITES_OF_SECT(sectNum, i)) + for (bssize_t SPRITES_OF_SECT(sectNum, i)) if (PN(i) == ACTIVATOR) { G_OperateActivators(SLT(i),-1); @@ -1732,13 +1732,13 @@ void A_DamageWall(int spriteNum, int nWall, const vec3_t *vPos, int weaponNum) pWall = &wall[sector[sectNum].wallptr]; - for (int i = sector[sectNum].wallnum; i > 0; i--, pWall++) + for (bssize_t i = sector[sectNum].wallnum; i > 0; i--, pWall++) if (pWall->shade > nDarkestWall) nDarkestWall = pWall->shade; int const nRand = krand() & 1; - for (int SPRITES_OF(STAT_EFFECTOR, i)) + for (bssize_t SPRITES_OF(STAT_EFFECTOR, i)) if (SHT(i) == wall[nWall].lotag && SLT(i) == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT) { T3(i) = nRand; @@ -1786,11 +1786,11 @@ int Sect_DamageCeilingOrFloor(int damageFloor, int const sectNum) if (sector[sectNum].hitag == 0) { - for (int SPRITES_OF_SECT(sectNum, i)) + for (bssize_t SPRITES_OF_SECT(sectNum, i)) { if (PN(i) == SECTOREFFECTOR && SLT(i) == SE_12_LIGHT_SWITCH) { - for (int SPRITES_OF(STAT_EFFECTOR, j)) + for (bssize_t SPRITES_OF(STAT_EFFECTOR, j)) if (sprite[j].hitag == SHT(i)) actor[j].t_data[3] = 1; break; @@ -1800,7 +1800,7 @@ int Sect_DamageCeilingOrFloor(int damageFloor, int const sectNum) int j = krand() & 1; - for (int SPRITES_OF(STAT_EFFECTOR, i)) + for (bssize_t SPRITES_OF(STAT_EFFECTOR, i)) { if (SHT(i) == sector[sectNum].hitag && SLT(i) == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT) { @@ -1902,7 +1902,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc) case CACTUS__STATIC: { if (isRPG == 1) - for (int k=64; k>0; k--) + for (bssize_t k=64; k>0; k--) { int newSprite = A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, @@ -1917,7 +1917,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc) case FIRELASER__STATIC: case HYDRENT__STATIC: case HEAVYHBOMB__STATIC: - for (int k=64; k>0; k--) + for (bssize_t k=64; k>0; k--) { int newSprite = A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, @@ -1936,7 +1936,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc) case HANGLIGHT__STATIC: case GENERICPOLE2__STATIC: - for (int k=6; k>0; k--) + for (bssize_t k=6; k>0; k--) A_InsertSprite(SECT(spriteNum),SX(spriteNum),SY(spriteNum),SZ(spriteNum)-ZOFFSET3,SCRAP1+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[spriteNum].zvel>>2),spriteNum,5); A_PlaySound(GLASS_HEAVYBREAK,spriteNum); A_DeleteSprite(spriteNum); @@ -1950,7 +1950,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc) A_PlaySound(GLASS_HEAVYBREAK,spriteNum); pSprite = &sprite[spriteNum]; - for (int j=16; j>0; j--) + for (bssize_t j=16; j>0; j--) RANDOMSCRAP(pSprite, spriteNum); break; @@ -1968,7 +1968,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc) case ANTENNA__STATIC: if (sprite[damageSrc].extra != G_DefaultActorHealth(SHOTSPARK1)) { - for (int j=15; j>0; j--) + for (bssize_t j=15; j>0; j--) A_InsertSprite(SECT(spriteNum),SX(spriteNum),SY(spriteNum),sector[SECT(spriteNum)].floorz-ZOFFSET4-(j<<9),SCRAP1+(krand()&15),-8,64,64, krand()&2047,(krand()&127)+64,-(krand()&511)-256,spriteNum,5); A_Spawn(spriteNum,EXPLOSION2); @@ -2027,7 +2027,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc) break; case FETUSBROKE__STATIC: - for (int j=48; j>0; j--) + for (bssize_t j=48; j>0; j--) { A_Shoot(spriteNum,BLOODSPLAT1); SA(spriteNum) += 333; @@ -2202,7 +2202,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc) case TRIPODCAMERA__STATIC: A_PlaySound(GLASS_HEAVYBREAK,spriteNum); pSprite = &sprite[spriteNum]; - for (int j=16; j>0; j--) + for (bssize_t j=16; j>0; j--) RANDOMSCRAP(pSprite, spriteNum); A_DeleteSprite(spriteNum); break; @@ -2303,11 +2303,11 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc) void G_AlignWarpElevators(void) { - for (int SPRITES_OF(STAT_EFFECTOR, i)) + for (bssize_t SPRITES_OF(STAT_EFFECTOR, i)) { if (SLT(i) == SE_17_WARP_ELEVATOR && SS(i) > 16) { - for (int SPRITES_OF(STAT_EFFECTOR, j)) + for (bssize_t SPRITES_OF(STAT_EFFECTOR, j)) { if (i != j && sprite[j].lotag == SE_17_WARP_ELEVATOR && SHT(i) == sprite[j].hitag) { @@ -3123,7 +3123,7 @@ void P_CheckSectors(int playerNum) case VIEWSCREEN__STATIC: case VIEWSCREEN2__STATIC: // Try to find a camera sprite for the viewscreen. - for (int SPRITES_OF(STAT_ACTOR, spriteNum)) + for (bssize_t SPRITES_OF(STAT_ACTOR, spriteNum)) { if (PN(spriteNum) == CAMERA1 && SP(spriteNum) == 0 && sprite[neartagsprite].hitag == SLT(spriteNum)) { @@ -3186,7 +3186,7 @@ void P_CheckSectors(int playerNum) if (neartagsector >= 0 && (sector[neartagsector].lotag&16384) == 0 && isanearoperator(sector[neartagsector].lotag)) { - for (int SPRITES_OF_SECT(neartagsector, spriteNum)) + for (bssize_t SPRITES_OF_SECT(neartagsector, spriteNum)) { if (PN(spriteNum) == ACTIVATOR || PN(spriteNum) == MASTERSWITCH) return; @@ -3198,7 +3198,7 @@ void P_CheckSectors(int playerNum) { if (isanunderoperator(sector[sprite[pPlayer->i].sectnum].lotag)) { - for (int SPRITES_OF_SECT(sprite[pPlayer->i].sectnum, spriteNum)) + for (bssize_t SPRITES_OF_SECT(sprite[pPlayer->i].sectnum, spriteNum)) { if (PN(spriteNum) == ACTIVATOR || PN(spriteNum) == MASTERSWITCH) return; diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index c7d3bf298..39f10baba 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -62,9 +62,9 @@ void S_SoundStartup(void) initprintf("%d voices, %d channels, %d-bit %d Hz\n", ud.config.NumVoices, ud.config.NumChannels, ud.config.NumBits, ud.config.MixRate); - for (int i=0; i 0) FX_PauseVoice(g_sounds[i].SoundOwner[j].voice, onf); @@ -767,7 +767,7 @@ void S_ChangeSoundPitch(int32_t num, int32_t i, int32_t pitchoffset) if ((unsigned)num > (unsigned)g_maxSoundPos || g_sounds[num].num <= 0) return; - for (int j=0; j 0 && i >= 0) { - for (int32_t j=0; j