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
This commit is contained in:
terminx 2016-08-27 01:41:21 +00:00
parent aae66ccb11
commit 4575148c02
42 changed files with 534 additions and 533 deletions

View file

@ -103,21 +103,21 @@ void settransreverse(void);
void sethlinesizes(int32_t logx, int32_t logy, intptr_t bufplc); void sethlinesizes(int32_t logx, int32_t logy, intptr_t bufplc);
void setpalookupaddress(char *paladdr); void setpalookupaddress(char *paladdr);
void setuphlineasm4(int32_t bxinc, int32_t byinc); 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 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); 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); int32_t vlineasm1(int32_t vinc, intptr_t paloffs, bssize_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p);
void vlineasm4(int32_t cnt, char *p); void vlineasm4(bssize_t cnt, char *p);
void setupmvlineasm(int32_t neglogy, int32_t dosaturate); 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); int32_t mvlineasm1(int32_t vinc, intptr_t paloffs, bssize_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p);
void mvlineasm4(int32_t cnt, char *p); void mvlineasm4(bssize_t cnt, char *p);
void setuptvlineasm(int32_t neglogy, int32_t dosaturate); 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 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); 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 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 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 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 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 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 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(); void mmxoverlay();

View file

@ -343,7 +343,7 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col)
if (drawlinepat == 0xffffffff) 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); drawtranspixel((char *) p, col);
df += d.y; 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; 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]) if (drawlinepat & pow2long[(++patc)&31])
drawtranspixel((char *) p, col); 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); clearbufbyte((void *) p, d.x, ((int32_t) col<<24)|((int32_t) col<<16)|((int32_t) col<<8)|col);
else if (drawlinepat == 0xffffffff) 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); drawpixel((char *) p, col);
df += d.y; 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; 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]) if (drawlinepat & pow2long[(++patc)&31])
drawpixel((char *) p, col); drawpixel((char *) p, col);
@ -1024,12 +1024,12 @@ int32_t getspritecol(int32_t spr)
const uint8_t *const texbuf = (const uint8_t *) waloff[picnum]; 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]]++; cols[texbuf[i]]++;
unsigned col = 0, cnt = 0; unsigned col = 0, cnt = 0;
for (int i = 0; i < 240; i++) for (bssize_t i = 0; i < 240; i++)
if (cols[i] > cnt) if (cols[i] > cnt)
col = i, cnt = cols[i]; 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(); faketimerhandler();
if (zoome >= 256 || highlightcnt>0) if (zoome >= 256 || highlightcnt>0)
for (int32_t j=0; j<MAXSPRITES; j++) for (bssize_t j=0; j<MAXSPRITES; j++)
if (sprite[j].statnum<MAXSTATUS) if (sprite[j].statnum<MAXSTATUS)
{ {
// if sprite is highlighted, always draw it // if sprite is highlighted, always draw it

View file

@ -61,7 +61,7 @@ void sethlinesizes(int32_t logx, int32_t logy, intptr_t bufplc)
{ glogx = logx; glogy = logy; gbuf = (char *)bufplc; } { glogx = logx; glogy = logy; gbuf = (char *)bufplc; }
void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; } void setpalookupaddress(char *paladdr) { ghlinepal = paladdr; }
void setuphlineasm4(int32_t bxinc, int32_t byinc) { gbxinc = bxinc; gbyinc = byinc; } void setuphlineasm4(int32_t bxinc, int32_t byinc) { gbxinc = bxinc; gbyinc = 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)
{ {
if (!skiploadincs) { gbxinc = asm1; gbyinc = asm2; } if (!skiploadincs) { gbxinc = asm1; gbyinc = asm2; }
@ -103,7 +103,7 @@ void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by,
///// Sloped ceiling/floor vertical line functions ///// ///// Sloped ceiling/floor vertical line functions /////
extern int32_t sloptable[16384]; extern int32_t sloptable[16384];
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)
{ {
intptr_t * A_C_RESTRICT slopalptr; intptr_t * A_C_RESTRICT slopalptr;
int32_t bz, bzinc; int32_t bz, bzinc;
@ -140,7 +140,7 @@ static inline int32_t getpix(int32_t logy, const char *buf, uint32_t vplc)
void setupvlineasm(int32_t neglogy) { glogy = neglogy; } void setupvlineasm(int32_t neglogy) { glogy = neglogy; }
// cnt+1 loop iterations! // cnt+1 loop iterations!
int32_t vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p) int32_t vlineasm1(int32_t vinc, intptr_t paloffs, bssize_t cnt, uint32_t vplc, intptr_t bufplc, intptr_t p)
{ {
const char *const A_C_RESTRICT buf = (char *)bufplc; const char *const A_C_RESTRICT buf = (char *)bufplc;
const char *const A_C_RESTRICT pal = (char *)paloffs; const char *const A_C_RESTRICT pal = (char *)paloffs;
@ -226,7 +226,7 @@ typedef uint32_t uint32_vec4 __attribute__ ((vector_size (16)));
#ifdef CLASSIC_NONPOW2_YSIZE_WALLS #ifdef CLASSIC_NONPOW2_YSIZE_WALLS
// cnt >= 1 // cnt >= 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 # ifdef USE_VECTOR_EXT
uint32_vec4 vplc, const uint32_vec4 vinc) uint32_vec4 vplc, const uint32_vec4 vinc)
# else # else
@ -258,7 +258,7 @@ static void vlineasm4nlogy(int32_t cnt, char *p, char *const A_C_RESTRICT * pal,
#endif #endif
// cnt >= 1 // 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 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]}; 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! // 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; char ch;
@ -391,7 +391,7 @@ int32_t mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, i
} }
// cnt >= 1 // 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 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]}; 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 #if !defined USE_ASM64
// cnt+1 loop iterations! // 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; char ch;
@ -540,7 +540,7 @@ void tvlineasm2(uint32_t vplc2, int32_t vinc1, intptr_t bufplc1, intptr_t bufplc
{ {
char ch; 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 int32_t vinc2 = asm1;
const char *const A_C_RESTRICT buf1 = (char *)bufplc1; 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; gbyinc = byinc;
glogy = ysiz; 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; gbuf = (char *)bufplc;
for (; cnt>1; cnt--) for (; cnt>1; cnt--)
@ -691,7 +691,7 @@ void msetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t y
gbyinc = byinc; gbyinc = byinc;
glogy = ysiz; 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; char ch;
@ -713,7 +713,7 @@ void tsetupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t y
gbyinc = byinc; gbyinc = byinc;
glogy = ysiz; 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; 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 #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); p0 = p-(cnt<<2);
do do

View file

@ -9150,7 +9150,7 @@ static void clearministatbar16(void)
// similar to how inside() did before r3898. // similar to how inside() did before r3898.
int32_t loopinside(int32_t x, int32_t y, int16_t startwall) 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; int32_t i = startwall;
do do

View file

@ -311,7 +311,7 @@ void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
void agecache(void) void agecache(void)
{ {
#ifndef DEBUG_ALLOCACHE_AS_MALLOC #ifndef DEBUG_ALLOCACHE_AS_MALLOC
int32_t cnt = (cacnum>>4); bssize_t cnt = (cacnum>>4);
if (agecount >= cacnum) if (agecount >= cacnum)
agecount = cacnum-1; agecount = cacnum-1;
@ -792,7 +792,7 @@ int32_t initgroupfile(const char *filename)
kread_grp(numgroupfiles,gfilelist[numgroupfiles],gnumfiles[numgroupfiles]<<4); kread_grp(numgroupfiles,gfilelist[numgroupfiles],gnumfiles[numgroupfiles]<<4);
int32_t j = (gnumfiles[numgroupfiles]+1)<<4, k; int32_t j = (gnumfiles[numgroupfiles]+1)<<4, k;
for (int32_t i=0; i<gnumfiles[numgroupfiles]; i++) for (bssize_t i=0; i<gnumfiles[numgroupfiles]; i++)
{ {
k = B_LITTLE32(*((int32_t *)&gfilelist[numgroupfiles][(i<<4)+12])); k = B_LITTLE32(*((int32_t *)&gfilelist[numgroupfiles][(i<<4)+12]));
gfilelist[numgroupfiles][(i<<4)+12] = 0; gfilelist[numgroupfiles][(i<<4)+12] = 0;
@ -880,7 +880,7 @@ int32_t initgroupfile(const char *filename)
gfileoffs[numgroupfiles] = (int32_t *)Xmalloc((gnumfiles[numgroupfiles]+1)<<2); gfileoffs[numgroupfiles] = (int32_t *)Xmalloc((gnumfiles[numgroupfiles]+1)<<2);
int32_t j = (version == 2 ? 267 : 254) + (numfiles * 121), k; int32_t j = (version == 2 ? 267 : 254) + (numfiles * 121), k;
for (int32_t i = 0; i < numfiles; i++) for (bssize_t i = 0; i < numfiles; i++)
{ {
// get the string length // get the string length
kread_grp(numgroupfiles, &temp, 1); kread_grp(numgroupfiles, &temp, 1);
@ -1056,12 +1056,12 @@ static int32_t kopen_internal(const char *filename, char **lastpfn, char searchf
UNREFERENCED_PARAMETER(tryzip); UNREFERENCED_PARAMETER(tryzip);
#endif #endif
for (int32_t k = searchfirst != 1 ? numgroupfiles-1 : 0; k >= 0; --k) for (bssize_t k = searchfirst != 1 ? numgroupfiles-1 : 0; k >= 0; --k)
{ {
if (groupfil[k] < 0) if (groupfil[k] < 0)
continue; 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]; 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) 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) if (groupfil[k] >= 0 && groupcrc[k] == crcval)
{ {

View file

@ -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; 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 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; 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) if (bot == 0)
continue; continue;
int32_t cnt = 256, nintx, ninty; bssize_t cnt = 256, nintx, ninty;
do do
{ {
@ -1181,7 +1181,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
#endif #endif
int32_t hitwalls[4], hitwall; int32_t hitwalls[4], hitwall;
int32_t cnt = clipmoveboxtracenum; bssize_t cnt = clipmoveboxtracenum;
do do
{ {

View file

@ -24,7 +24,7 @@ static uint8_t const * colmatch_palette;
void initfastcolorlookup_scale(int32_t rscale, int32_t gscale, int32_t bscale) void initfastcolorlookup_scale(int32_t rscale, int32_t gscale, int32_t bscale)
{ {
int32_t j = 0; int32_t j = 0;
for (int i=256; i>=0; i--) for (bssize_t i=256; i>=0; i--)
{ {
//j = (i-64)*(i-64); //j = (i-64)*(i-64);
rdist[i] = rdist[FASTPALCOLDEPTH*2-i] = j*rscale; rdist[i] = rdist[FASTPALCOLDEPTH*2-i] = j*rscale;
@ -41,7 +41,7 @@ void initfastcolorlookup_palette(uint8_t const * const pal)
colmatch_palette = pal; colmatch_palette = pal;
char const *pal1 = (char const *)&pal[768-3]; 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 int32_t const j = (pal1[0]>>FASTPALRIGHTSHIFT)*FASTPALGRIDSIZ*FASTPALGRIDSIZ
+ (pal1[1]>>FASTPALRIGHTSHIFT)*FASTPALGRIDSIZ + (pal1[2]>>FASTPALRIGHTSHIFT) + (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; int retcol = -1;
for (int k=26; k>=0; k--) for (bssize_t k=26; k>=0; k--)
{ {
int i = colscan[k]+j; 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; 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]; char const * const pal1 = (char const *)&colmatch_palette[i*3];
int dist = gdist[pal1[1]+g]; int dist = gdist[pal1[1]+g];

View file

@ -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) 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]]; 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)) if (check_tile_range("undefinetilerange", &tile1, &tile2, script, cmdtokptr))
break; break;
for (int32_t i = tile1; i <= tile2; i++) for (bssize_t i = tile1; i <= tile2; i++)
E_UndefineTile(i); E_UndefineTile(i);
break; break;
@ -2585,7 +2585,7 @@ static int32_t defsparser(scriptfile *script)
usermaphacks = (usermaphack_t *)Xrealloc(usermaphacks, num_usermaphacks*sizeof(usermaphack_t)); usermaphacks = (usermaphack_t *)Xrealloc(usermaphacks, num_usermaphacks*sizeof(usermaphack_t));
usermaphack_t *newusermaphack = &usermaphacks[num_usermaphacks - 1]; 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 }; char smallbuf[3] = { 0, 0, 0 };
smallbuf[0] = mapmd4string[2*i]; smallbuf[0] = mapmd4string[2*i];
@ -2837,7 +2837,7 @@ static int32_t defsparser(scriptfile *script)
if (shiftleft != 0) if (shiftleft != 0)
{ {
for (int k = 0; k < 768; k++) for (bssize_t k = 0; k < 768; k++)
palbuf[k] <<= shiftleft; palbuf[k] <<= shiftleft;
} }
@ -3398,7 +3398,7 @@ static int32_t defsparser(scriptfile *script)
break; break;
} }
for (int32_t i = id0; i <= id1; i++) for (bssize_t i = id0; i <= id1; i++)
removebasepal(i); removebasepal(i);
if (id0 == 0) if (id0 == 0)
@ -3421,7 +3421,7 @@ static int32_t defsparser(scriptfile *script)
break; break;
} }
for (int32_t i = id0; i <= id1; i++) for (bssize_t i = id0; i <= id1; i++)
removepalookup(i); removepalookup(i);
if (id0 == 0) if (id0 == 0)
@ -3444,7 +3444,7 @@ static int32_t defsparser(scriptfile *script)
break; break;
} }
for (int32_t i = id0; i <= id1; i++) for (bssize_t i = id0; i <= id1; i++)
removeblendtab(i); removeblendtab(i);
if (id0 == 0) if (id0 == 0)

View file

@ -381,7 +381,7 @@ void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum)
if (bunchnum > -3) if (bunchnum > -3)
{ {
// TODO: for in-game too? // TODO: for in-game too?
for (int ynw, j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++) for (bssize_t ynw, j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
{ {
ynw = yax_getnextwall(j, cf); ynw = yax_getnextwall(j, cf);
if (ynw >= 0) if (ynw >= 0)
@ -621,7 +621,7 @@ int32_t yax_getneighborsect(int32_t x, int32_t y, int32_t sectnum, int32_t cf)
if (bunchnum < 0) if (bunchnum < 0)
return -1; 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) if (inside(x, y, i)==1)
return i; return i;
@ -1665,7 +1665,7 @@ static void scansector(int16_t startsectnum)
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
if (scansector_collectsprites) if (scansector_collectsprites)
#endif #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]; const uspritetype *const spr = (uspritetype *)&sprite[i];
@ -1692,7 +1692,7 @@ static void scansector(int16_t startsectnum)
vec2_t p1, p2 = { 0, 0 }; vec2_t p1, p2 = { 0, 0 };
for (int32_t w=startwall; w<endwall; w++) for (bssize_t w=startwall; w<endwall; w++)
{ {
const uwalltype *const wal = (uwalltype *)&wall[w]; const uwalltype *const wal = (uwalltype *)&wall[w];
const int32_t nextsectnum = wal->nextsector; const int32_t nextsectnum = wal->nextsector;
@ -1750,7 +1750,7 @@ skipitaddwall:
bunchp2[numscans-1] = scanfirst, scanfirst = numscans; bunchp2[numscans-1] = scanfirst, scanfirst = numscans;
} }
for (int32_t s=onumscans; s<numscans; s++) for (bssize_t s=onumscans; s<numscans; s++)
if (wall[thewall[s]].point2 != thewall[bunchp2[s]] || xb2[s] >= xb1[bunchp2[s]]) if (wall[thewall[s]].point2 != thewall[bunchp2[s]] || xb2[s] >= xb1[bunchp2[s]])
{ {
bunchfirst[numbunches++] = bunchp2[s], bunchp2[s] = -1; bunchfirst[numbunches++] = bunchp2[s], bunchp2[s] = -1;
@ -1760,7 +1760,7 @@ skipitaddwall:
#endif #endif
} }
for (int32_t bn=onumbunches; bn<numbunches; bn++) for (bssize_t bn=onumbunches; bn<numbunches; bn++)
{ {
int32_t s; int32_t s;
for (s=bunchfirst[bn]; bunchp2[s]>=0; s=bunchp2[s]) for (s=bunchfirst[bn]; bunchp2[s]>=0; s=bunchp2[s])
@ -1782,7 +1782,7 @@ void printscans(void)
Bmemset(didscan, 0, sizeof(didscan)); Bmemset(didscan, 0, sizeof(didscan));
for (int s=0; s<numscans; s++) for (bssize_t s=0; s<numscans; s++)
{ {
if (bunchp2[s] >= 0 && (didscan[s>>3] & (1<<(s&7)))==0) if (bunchp2[s] >= 0 && (didscan[s>>3] & (1<<(s&7)))==0)
{ {
@ -1813,10 +1813,10 @@ void printscans(void)
void printbunches(void) void printbunches(void)
{ {
for (int bn=0; bn<numbunches; bn++) for (bssize_t bn=0; bn<numbunches; bn++)
{ {
printf("bunch %d: ", bn); printf("bunch %d: ", bn);
for (int s=bunchfirst[bn]; s>=0; s=bunchp2[s]) for (bssize_t s=bunchfirst[bn]; s>=0; s=bunchp2[s])
printf("%d(%d) ", s, thewall[s]); printf("%d(%d) ", s, thewall[s]);
printf("\n"); printf("\n");
} }
@ -1960,7 +1960,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc)
{ {
char bad = 0; 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); y1ve[z] = max(uwall[dax],startumost[dax+windowxy1.x]-windowxy1.y);
y2ve[z] = min(dwall[dax],startdmost[dax+windowxy1.x]-windowxy1.y)-1; 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) if ((bad&3) == 3)
{ {
for (int i=ix1; i<=ix2; i++) for (bssize_t i=ix1; i<=ix2; i++)
mostbuf[i] = 0; mostbuf[i] = 0;
return bad; return bad;
} }
if ((bad&12) == 12) if ((bad&12) == 12)
{ {
for (int i=ix1; i<=ix2; i++) for (bssize_t i=ix1; i<=ix2; i++)
mostbuf[i] = ydimen; mostbuf[i] = ydimen;
return bad; return bad;
} }
@ -2418,13 +2418,13 @@ static int32_t owallmost(int16_t *mostbuf, int32_t w, zint_t z)
if ((bad&3) == 2) if ((bad&3) == 2)
{ {
if (xb1[w] <= xcross) { iy2 = inty; ix2 = xcross; } 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; mostbuf[i] = 0;
} }
else else
{ {
if (xcross <= xb2[w]) { iy1 = inty; ix1 = xcross; } 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; 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 ((bad&12) == 8)
{ {
if (xb1[w] <= xcross) { iy2 = inty; ix2 = xcross; } 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; mostbuf[i] = ydimen;
} }
else else
{ {
if (xcross <= xb2[w]) { iy1 = inty; ix1 = xcross; } 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; 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) if ((bad&3) == 3)
{ {
for (int i=ix1; i<=ix2; i++) for (bssize_t i=ix1; i<=ix2; i++)
mostbuf[i] = 0; mostbuf[i] = 0;
return bad; return bad;
} }
if ((bad&12) == 12) if ((bad&12) == 12)
{ {
for (int i=ix1; i<=ix2; i++) for (bssize_t i=ix1; i<=ix2; i++)
mostbuf[i] = ydimen; mostbuf[i] = ydimen;
return bad; 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 ((bad&3) == 2)
{ {
if (xb1[w] <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; } 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; mostbuf[i] = 0;
} }
else else
{ {
if (xcross <= xb2[w]) { z1 = intz; iy1 = inty; ix1 = xcross; } 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; 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 ((bad&12) == 8)
{ {
if (xb1[w] <= xcross) { z2 = intz; iy2 = inty; ix2 = xcross; } 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; mostbuf[i] = ydimen;
} }
else else
{ {
if (xcross <= xb2[w]) { z1 = intz; iy1 = inty; ix1 = xcross; } 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; mostbuf[i] = ydimen;
} }
} }
@ -3311,7 +3311,7 @@ static void ceilspritescan(int32_t x1, int32_t x2)
int32_t y1 = uwall[x1]; int32_t y1 = uwall[x1];
int32_t y2 = y1; 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 twall = uwall[x]-1;
const int32_t bwall = dwall[x]; const int32_t bwall = dwall[x];
@ -3364,7 +3364,7 @@ static inline void setupslopevlin_alsotrans(int32_t logylogx, intptr_t bufplc, i
} }
// cnt iterations // 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 buf = ggbuf;
const char *const A_C_RESTRICT pal = ggpal; 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(); //{{{ 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; 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(uwall,z,sectnum,(uint8_t)0);
wallmost(uplc,z,(int32_t)wal->nextsector,(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]) if (uplc[x] > uwall[x])
uwall[x] = uplc[x]; uwall[x] = uplc[x];
wallmost(dwall,z,sectnum,(uint8_t)1); wallmost(dwall,z,sectnum,(uint8_t)1);
wallmost(dplc,z,(int32_t)wal->nextsector,(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]) if (dplc[x] < dwall[x])
dwall[x] = dplc[x]; dwall[x] = dplc[x];
prepwall(z,wal); prepwall(z,wal);
@ -5867,7 +5867,7 @@ static void drawmaskwall(int16_t damaskwallcnt)
setup_globals_wall1(wal, wal->overpicnum); setup_globals_wall1(wal, wal->overpicnum);
setup_globals_wall2(wal, sec->visibility, z1, z2); 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]; int j=smostwall[i];
if ((xb1[j] > xb2[z]) || (xb2[j] < xb1[z])) continue; 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; if ((lx == xb1[z]) && (rx == xb2[z])) return;
//clearbufbyte(&dwall[lx],(rx-lx+1)*sizeof(dwall[0]),0L); //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; break;
case 1: 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]; if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x];
break; break;
case 2: 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]; if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x];
break; break;
} }
@ -6023,7 +6023,7 @@ static void fillpolygon(int32_t npoints)
int16_t *const xptr = &smost[i*nodesperline]; int16_t *const xptr = &smost[i*nodesperline];
int16_t *const xptr2 = &smost[i*nodesperline + (nodesperline>>1)]; 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--) 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) 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) if (multipskytile[i] == tilenum)
return &multipsky[i]; return &multipsky[i];
@ -7754,7 +7754,7 @@ void uninitengine(void)
paletteloaded = 0; paletteloaded = 0;
for (int i=0; i<MAXPALOOKUPS; i++) for (bssize_t i=0; i<MAXPALOOKUPS; i++)
if (i==0 || palookup[i] != palookup[0]) if (i==0 || palookup[i] != palookup[0])
{ {
// Take care of handling aliased ^^^ cases! // Take care of handling aliased ^^^ cases!
@ -7762,11 +7762,11 @@ void uninitengine(void)
} }
Bmemset(palookup, 0, sizeof(palookup)); Bmemset(palookup, 0, sizeof(palookup));
for (int i=0; i<MAXBLENDTABS; i++) for (bssize_t i=0; i<MAXBLENDTABS; i++)
Bfree(blendtable[i]); Bfree(blendtable[i]);
Bmemset(blendtable, 0, sizeof(blendtable)); Bmemset(blendtable, 0, sizeof(blendtable));
for (int i=1; i<MAXBASEPALS; i++) for (bssize_t i=1; i<MAXBASEPALS; i++)
Bfree(basepaltable[i]); Bfree(basepaltable[i]);
Bmemset(basepaltable, 0, sizeof(basepaltable)); Bmemset(basepaltable, 0, sizeof(basepaltable));
basepaltable[0] = palette; basepaltable[0] = palette;
@ -7779,7 +7779,7 @@ void uninitengine(void)
uninitsystem(); uninitsystem();
for (int i = 0; i < num_usermaphacks; i++) for (bssize_t i = 0; i < num_usermaphacks; i++)
{ {
Bfree(usermaphacks[i].mhkfile); Bfree(usermaphacks[i].mhkfile);
Bfree(usermaphacks[i].title); Bfree(usermaphacks[i].title);
@ -8301,7 +8301,7 @@ killsprite:
gap = 1; while (gap < spritesortcnt) gap = (gap<<1)+1; gap = 1; while (gap < spritesortcnt) gap = (gap<<1)+1;
for (gap>>=1; gap>0; gap>>=1) //Sort sprite list for (gap>>=1; gap>0; gap>>=1) //Sort sprite list
for (i=0; i<spritesortcnt-gap; i++) for (i=0; i<spritesortcnt-gap; i++)
for (int32_t l=i; l>=0; l-=gap) for (bssize_t l=i; l>=0; l-=gap)
{ {
if (spritesxyz[l].y <= spritesxyz[l+gap].y) break; if (spritesxyz[l].y <= spritesxyz[l+gap].y) break;
swapptr(&tspriteptr[l],&tspriteptr[l+gap]); swapptr(&tspriteptr[l],&tspriteptr[l+gap]);
@ -8313,7 +8313,7 @@ killsprite:
spritesxyz[spritesortcnt].y = (spritesxyz[spritesortcnt-1].y^1); spritesxyz[spritesortcnt].y = (spritesxyz[spritesortcnt-1].y^1);
ys = spritesxyz[0].y; i = 0; 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) if (spritesxyz[j].y == ys)
continue; continue;
@ -8322,7 +8322,7 @@ killsprite:
if (j > i+1) if (j > i+1)
{ {
for (int32_t k=i; k<j; k++) for (bssize_t k=i; k<j; k++)
{ {
const uspritetype *const s = tspriteptr[k]; const uspritetype *const s = tspriteptr[k];
@ -8341,8 +8341,8 @@ killsprite:
} }
} }
for (int32_t k=i+1; k<j; k++) for (bssize_t k=i+1; k<j; k++)
for (int32_t l=i; l<k; l++) for (bssize_t l=i; l<k; l++)
if (klabs(spritesxyz[k].z-globalposz) < klabs(spritesxyz[l].z-globalposz)) if (klabs(spritesxyz[k].z-globalposz) < klabs(spritesxyz[l].z-globalposz))
{ {
swapptr(&tspriteptr[k],&tspriteptr[l]); swapptr(&tspriteptr[k],&tspriteptr[l]);
@ -8351,8 +8351,8 @@ killsprite:
spritesxyz[l] = tv3; spritesxyz[l] = tv3;
} }
for (int32_t k=i+1; k<j; k++) for (bssize_t k=i+1; k<j; k++)
for (int32_t l=i; l<k; l++) for (bssize_t l=i; l<k; l++)
if (tspriteptr[k]->x == tspriteptr[l]->x && if (tspriteptr[k]->x == tspriteptr[l]->x &&
tspriteptr[k]->y == tspriteptr[l]->y && tspriteptr[k]->y == tspriteptr[l]->y &&
(tspriteptr[k]->cstat & 48) == (tspriteptr[l]->cstat & 48) && (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"); OSD_Printf("Generating voxel models for Polymost. This may take a while...\n");
nextpage(); nextpage();
for (int32_t i=0; i<MAXVOXELS; i++) for (bssize_t i=0; i<MAXVOXELS; i++)
{ {
if (voxfilenames[i]) if (voxfilenames[i])
{ {
@ -9867,7 +9867,7 @@ void nextpage(void)
{ {
case 200: case 200:
begindrawing(); //{{{ 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]; per = &permfifo[i];
if ((per->pagesleft > 0) && (per->pagesleft <= numpages)) if ((per->pagesleft > 0) && (per->pagesleft <= numpages))
@ -9881,7 +9881,7 @@ void nextpage(void)
showframe(0); showframe(0);
begindrawing(); //{{{ 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]; per = &permfifo[i];
if (per->pagesleft >= 130) if (per->pagesleft >= 130)
@ -9908,7 +9908,7 @@ void nextpage(void)
#ifdef USE_OPENGL #ifdef USE_OPENGL
omdtims = mdtims; mdtims = getticks(); 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)) if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM))
spriteext[i].mdanimtims += mdtims - omdtims; spriteext[i].mdanimtims += mdtims - omdtims;
#endif #endif
@ -9929,7 +9929,7 @@ int32_t qloadkvx(int32_t voxindex, const char *filename)
int32_t lengcnt = 0; int32_t lengcnt = 0;
const int32_t lengtot = kfilelength(fil); const int32_t lengtot = kfilelength(fil);
for (int32_t i=0; i<MAXVOXMIPS; i++) for (bssize_t i=0; i<MAXVOXMIPS; i++)
{ {
int32_t dasiz; int32_t dasiz;
kread(fil, &dasiz, 4); dasiz = B_LITTLE32(dasiz); kread(fil, &dasiz, 4); dasiz = B_LITTLE32(dasiz);
@ -10199,7 +10199,7 @@ restart_grand:
const int32_t dasectnum = clipsectorlist[dacnt]; const int32_t dasectnum = clipsectorlist[dacnt];
const usectortype *const sec = (usectortype *)&sector[dasectnum]; const usectortype *const sec = (usectortype *)&sector[dasectnum];
const uwalltype *wal; const uwalltype *wal;
int32_t cnt; bssize_t cnt;
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
int32_t cfz1[2], cfz2[2]; // both wrt dasectnum int32_t cfz1[2], cfz2[2]; // both wrt dasectnum
int16_t bn[2]; int16_t bn[2];
@ -11033,7 +11033,7 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags)
int32_t w = yaxwalls[i]; int32_t w = yaxwalls[i];
const int32_t tmpstartwall = w; const int32_t tmpstartwall = w;
int32_t cnt = MAXWALLS; bssize_t cnt = MAXWALLS;
while (1) while (1)
{ {
@ -11264,7 +11264,7 @@ void updatesector(int32_t x, int32_t y, int16_t *sectnum)
while (--wallsleft); while (--wallsleft);
} }
for (int i=numsectors-1; i>=0; --i) for (bssize_t i=numsectors-1; i>=0; --i)
if (inside_p(x, y, i)) if (inside_p(x, y, i))
SET_AND_RETURN(*sectnum, 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); 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)) if (inside_exclude_p(x, y, i, excludesectbitmap))
SET_AND_RETURN(*sectnum, i); 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); 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)) if (inside_z_p(x,y,z, i))
SET_AND_RETURN(*sectnum, i); SET_AND_RETURN(*sectnum, i);
@ -11555,7 +11555,7 @@ restart_grand:
clipsprite_initindex(curidx, curspr, &clipsectcnt, pos); clipsprite_initindex(curidx, curspr, &clipsectcnt, pos);
for (int i=0; i<clipsectnum; i++) for (bssize_t i=0; i<clipsectnum; i++)
{ {
int const k = clipsectorlist[i]; int const k = clipsectorlist[i];
@ -11587,7 +11587,7 @@ restart_grand:
const int startwall = startsec->wallptr; const int startwall = startsec->wallptr;
const int endwall = startwall + startsec->wallnum; const int endwall = startwall + startsec->wallnum;
for (int j=startwall; j<endwall; j++) for (bssize_t j=startwall; j<endwall; j++)
{ {
const int k = wall[j].nextsector; const int k = wall[j].nextsector;
@ -11704,12 +11704,12 @@ restart_grand:
////////// Sprites ////////// ////////// Sprites //////////
for (int i=0; i<clipsectnum; i++) for (bssize_t i=0; i<clipsectnum; i++)
{ {
if (dasprclipmask==0) if (dasprclipmask==0)
break; break;
for (int j=headspritesect[clipsectorlist[i]]; j>=0; j=nextspritesect[j]) for (bssize_t j=headspritesect[clipsectorlist[i]]; j>=0; j=nextspritesect[j])
{ {
const int32_t cstat = sprite[j].cstat; const int32_t cstat = sprite[j].cstat;
int32_t daz, daz2; int32_t daz, daz2;
@ -11837,7 +11837,7 @@ restart_grand:
if (cb < 0) if (cb < 0)
continue; 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) if (inside(pos->x,pos->y, j)==1)
{ {
clipsectorlist[clipsectnum++] = j; clipsectorlist[clipsectnum++] = j;
@ -11873,7 +11873,7 @@ restart_grand:
if (fb < 0) if (fb < 0)
continue; 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) if (inside(pos->x,pos->y, j)==1)
{ {
clipsectorlist[clipsectnum++] = j; clipsectorlist[clipsectnum++] = j;
@ -11967,11 +11967,11 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
#endif #endif
setaspect_new(); setaspect_new();
for (int i=0; i<windowxy1.x; i++) { startumost[i] = 1, startdmost[i] = 0; } for (bssize_t i=0; i<windowxy1.x; i++) { startumost[i] = 1, startdmost[i] = 0; }
Bassert(windowxy2.x < xdim); // xdim is the number of alloc'd elements in start*most[]. Bassert(windowxy2.x < xdim); // xdim is the number of alloc'd elements in start*most[].
for (int i=windowxy1.x; i<=windowxy2.x; i++) for (bssize_t i=windowxy1.x; i<=windowxy2.x; i++)
{ startumost[i] = windowxy1.y, startdmost[i] = windowxy2.y+1; } { startumost[i] = windowxy1.y, startdmost[i] = windowxy2.y+1; }
for (int i=windowxy2.x+1; i<xdim; i++) { startumost[i] = 1, startdmost[i] = 0; } for (bssize_t i=windowxy2.x+1; i<xdim; i++) { startumost[i] = 1, startdmost[i] = 0; }
} }
@ -12123,7 +12123,7 @@ void clearview(int32_t dacol)
//dacol += (dacol<<8); dacol += (dacol<<16); //dacol += (dacol<<8); dacol += (dacol<<16);
int const dx = windowxy2.x-windowxy1.x+1; int const dx = windowxy2.x-windowxy1.x+1;
intptr_t p = frameplace+ylookup[windowxy1.y]+windowxy1.x; intptr_t p = frameplace+ylookup[windowxy1.y]+windowxy1.x;
for (int y=windowxy1.y; y<=windowxy2.y; ++y) for (bssize_t y=windowxy1.y; y<=windowxy2.y; ++y)
{ {
//clearbufbyte((void*)p,dx,dacol); //clearbufbyte((void*)p,dx,dacol);
Bmemset((void *)p,dacol,dx); Bmemset((void *)p,dacol,dx);
@ -12247,7 +12247,7 @@ void squarerotatetile(int16_t tilenume)
char *ptr1, *ptr2; char *ptr1, *ptr2;
for (int i=siz-1, j; i>=3; i-=4) for (bssize_t i=siz-1, j; i>=3; i-=4)
{ {
ptr2 = ptr1 = (char *) (waloff[tilenume]+i*(siz+1)); ptr2 = ptr1 = (char *) (waloff[tilenume]+i*(siz+1));
swapchar(--ptr1, (ptr2 -= siz)); swapchar(--ptr1, (ptr2 -= siz));
@ -12335,7 +12335,7 @@ void completemirror(void)
// p+destof == frameplace + ylookup[...] + windowx2-mirrorsx2 // p+destof == frameplace + ylookup[...] + windowx2-mirrorsx2
int const destofs = windowxy2.x-mirrorsx2-windowxy1.x-mirrorsx1; int const destofs = windowxy2.x-mirrorsx2-windowxy1.x-mirrorsx1;
for (int y=0; y<height; y++) for (bssize_t y=0; y<height; y++)
{ {
#if 0 #if 0
if ((p-frameplace) + width-1 >= bytesperline*ydim) if ((p-frameplace) + width-1 >= 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 startwall = sector[sectnum].wallptr;
const int32_t endwall = startwall + sector[sectnum].wallnum; const int32_t endwall = startwall + sector[sectnum].wallnum;
for (int i=startwall; i<endwall; i++) for (bssize_t i=startwall; i<endwall; i++)
{ {
if (i == wallnum) if (i == wallnum)
return numloops; return numloops;
@ -12683,7 +12683,7 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, con
char const * const fontptr = (fontsize & 1) ? smalltextfont : textfont; char const * const fontptr = (fontsize & 1) ? smalltextfont : textfont;
int const charxsiz = 8 - ((fontsize & 1)<<2); int const charxsiz = 8 - ((fontsize & 1)<<2);
for (int i=0; name[i]; i++) for (bssize_t i=0; name[i]; i++)
{ {
if (name[i] == '^') if (name[i] == '^')
{ {
@ -12778,9 +12778,9 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, con
if (backcol >= 0) if (backcol >= 0)
{ {
for (int y=ymin; y<=ymax; y++) for (bssize_t y=ymin; y<=ymax; y++)
{ {
for (int x=0; x<charxsiz; x++) for (bssize_t x=0; x<charxsiz; x++)
{ {
if ((unsigned) (stx+x) >= (unsigned)xdim || ptr < (char *) frameplace) break; if ((unsigned) (stx+x) >= (unsigned)xdim || ptr < (char *) frameplace) break;
ptr[x] = (letptr[y] & pow2char[7 - (fontsize & 1) - x]) ? 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 else
{ {
for (int y=ymin; y<=ymax; y++) for (bssize_t y=ymin; y<=ymax; y++)
{ {
for (int x=0; x<charxsiz; x++) for (bssize_t x=0; x<charxsiz; x++)
{ {
if ((unsigned) (stx+x) >= (unsigned)xdim || ptr < (char *) frameplace) break; if ((unsigned) (stx+x) >= (unsigned)xdim || ptr < (char *) frameplace) break;
if (letptr[y]&pow2char[7-(fontsize&1)-x]) ptr[x] = (uint8_t) col; 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) static void PolymerProcessModels(void)
{ {
// potentially deferred MD3 postprocessing // potentially deferred MD3 postprocessing
for (int32_t i=0; i<nextmodelid; i++) for (bssize_t i=0; i<nextmodelid; i++)
{ {
if (models[i]->mdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL) if (models[i]->mdnum==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 firstpal = (pal < 0) ? 0 : pal;
const int32_t numpals = (pal < 0) ? MAXPALOOKUPS : 1; 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]) 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); gltexinvalidate(tilenume, np, hp);
} }

View file

@ -14,7 +14,7 @@ void hash_loop(hashtable_t *t, void(*func)(const char *, intptr_t))
if (t->items == NULL) if (t->items == NULL)
return; 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) for (hashitem_t *item=t->items[i]; item != NULL; item = item->next)
func(item->string, item->key); func(item->string, item->key);
} }

View file

@ -829,11 +829,11 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
char al = 255; char al = 255;
char onebitalpha = 1; 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]; 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.b = cptr[rpptr[x].b];
tcol.g = cptr[rpptr[x].g]; 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) 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); swapchar(&pic[j].r, &pic[j].b);
} }
@ -2570,7 +2570,7 @@ static void md3free(md3model_t *m)
if (m->head.surfs) 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]; md3surf_t *s = &m->head.surfs[surfi];
Bfree(s->tris); Bfree(s->tris);

View file

@ -632,7 +632,7 @@ static int32_t _internal_osdfunc_history(const osdfuncparm_t *parm)
OSD_Printf(OSDTEXT_RED "Command history:\n"); 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]) if (h->buf[i])
OSD_Printf("%4d \"%s\"\n", h->total - h->lines + (++j), 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->cvars);
DO_FREE_AND_NULL(osd->editor.buf); DO_FREE_AND_NULL(osd->editor.buf);
DO_FREE_AND_NULL(osd->editor.tmp); DO_FREE_AND_NULL(osd->editor.tmp);
for (int i=0; i<OSDMAXHISTORYDEPTH; i++) for (bssize_t i=0; i<OSDMAXHISTORYDEPTH; i++)
DO_FREE_AND_NULL(osd->history.buf[i]); DO_FREE_AND_NULL(osd->history.buf[i]);
DO_FREE_AND_NULL(osd->text.buf); DO_FREE_AND_NULL(osd->text.buf);
DO_FREE_AND_NULL(osd->text.fmt); 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); OSD_SetTextMode(osd->draw.mode);
else if (!Bstrcasecmp(parm->name, "osdhistorydepth")) 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]); DO_FREE_AND_NULL(osd->history.buf[i]);
} }

View file

@ -115,7 +115,7 @@ void loadpalette(void)
if (kread_and_test(fil, palette, 768)) if (kread_and_test(fil, palette, 768))
return kclose(fil); return kclose(fil);
for (int k = 0; k < 768; k++) for (bssize_t k = 0; k < 768; k++)
palette[k] <<= 2; palette[k] <<= 2;
initfastcolorlookup_palette(palette); initfastcolorlookup_palette(palette);
@ -185,7 +185,7 @@ void loadpalette(void)
// Read translucency (blending) table. // Read translucency (blending) table.
if (lamedukep) 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). // NOTE: LameDuke's table doesn't have the last row or column (i==255).
@ -195,7 +195,7 @@ void loadpalette(void)
return kclose(fil); return kclose(fil);
// Duplicate the entries below the diagonal. // Duplicate the entries below the diagonal.
for (int j=0; j<i; j++) for (bssize_t j=0; j<i; j++)
transluc[256*i + j] = transluc[256*j + i]; transluc[256*i + j] = transluc[256*j + i];
} }
} }
@ -222,7 +222,7 @@ void loadpalette(void)
uint8_t blendnum; uint8_t blendnum;
char *tab = (char *) Xmalloc(256*256); char *tab = (char *) Xmalloc(256*256);
for (int i=0; i<addblendtabs; i++) for (bssize_t i=0; i<addblendtabs; i++)
{ {
if (kread_and_test(fil, &blendnum, 1)) if (kread_and_test(fil, &blendnum, 1))
{ {
@ -271,17 +271,17 @@ static void E_PostLoadPalette(void)
#ifdef DEBUG_TILESIZY_512 #ifdef DEBUG_TILESIZY_512
// Bump shade 1 by 16. // Bump shade 1 by 16.
for (int i=256; i<512; i++) for (bssize_t i=256; i<512; i++)
palookup[0][i] = palookup[0][i+(16<<8)]; palookup[0][i] = palookup[0][i+(16<<8)];
#endif #endif
// find white and black colors // find white and black colors
for (int i=0, j, k=0; i<256; i++) for (bssize_t i=0, j, k=0; i<256; i++)
{ {
j = palette[i*3] + palette[i*3+1] + palette[i*3+2]; j = palette[i*3] + palette[i*3+1] + palette[i*3+2];
if (j > k) { k = j; whitecol = i; } if (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]; j = palette[i*3] + palette[i*3+1] + palette[i*3+2];
if (j < k) { k = j; blackcol = i; } if (j < k) { k = j; blackcol = i; }
@ -290,7 +290,7 @@ static void E_PostLoadPalette(void)
redcol = getclosestcol(255, 0, 0); redcol = getclosestcol(255, 0, 0);
// Bmemset(PaletteIndexFullbrights, 0, sizeof(PaletteIndexFullbrights)); // 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 * const thispalookup = palookup[0];
char const color = thispalookup[c]; char const color = thispalookup[c];
@ -300,7 +300,7 @@ static void E_PostLoadPalette(void)
palette[color*3+2] == 0)) palette[color*3+2] == 0))
continue; // don't consider #000000 fullbright 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)) if (EDUKE32_PREDICT_FALSE(thispalookup[s] != color))
goto PostLoad_NotFullbright; goto PostLoad_NotFullbright;
@ -331,13 +331,13 @@ int32_t E_PostInitTables(void)
void E_ReplaceTransparentColorWithBlack(void) void E_ReplaceTransparentColorWithBlack(void)
{ {
for (int i=0; i<MAXPALOOKUPS; i++) for (bssize_t i=0; i<MAXPALOOKUPS; i++)
{ {
char * const thispalookup = palookup[i]; char * const thispalookup = palookup[i];
if (thispalookup == NULL) if (thispalookup == NULL)
continue; continue;
for (int j=0; j<numshades; j++) for (bssize_t j=0; j<numshades; j++)
{ {
thispalookup[(j<<8) + 255] = 255; thispalookup[(j<<8) + 255] = 255;
} }
@ -345,13 +345,13 @@ void E_ReplaceTransparentColorWithBlack(void)
// fix up translucency table so that transluc(255,x) // fix up translucency table so that transluc(255,x)
// and transluc(x,255) is black instead of purple. // and transluc(x,255) is black instead of purple.
for (int i=0; i<MAXBLENDTABS; i++) for (bssize_t i=0; i<MAXBLENDTABS; i++)
{ {
char * const transluc = blendtable[i]; char * const transluc = blendtable[i];
if (transluc == NULL) if (transluc == NULL)
continue; continue;
for (int j=0; j<255; j++) for (bssize_t j=0; j<255; j++)
{ {
transluc[(255<<8) + j] = transluc[(blackcol<<8) + j]; transluc[(255<<8) + j] = transluc[(blackcol<<8) + j];
transluc[255 + (j<<8)] = transluc[blackcol + (j<<8)]; transluc[255 + (j<<8)] = transluc[blackcol + (j<<8)];
@ -376,7 +376,7 @@ int32_t loadlookups(int32_t fp)
if (kread_and_test(fp, &numlookups, 1)) if (kread_and_test(fp, &numlookups, 1))
return -1; return -1;
for (int j=0; j<numlookups; j++) for (bssize_t j=0; j<numlookups; j++)
{ {
uint8_t palnum; uint8_t palnum;
@ -402,7 +402,7 @@ void generatefogpals(void)
{ {
// Find a gap of four consecutive unused pal numbers to generate fog shade // Find a gap of four consecutive unused pal numbers to generate fog shade
// tables. // tables.
for (int32_t j=1; j<=255-3; j++) for (bssize_t j=1; j<=255-3; j++)
if (!palookup[j] && !palookup[j+1] && !palookup[j+2] && !palookup[j+3]) if (!palookup[j] && !palookup[j+1] && !palookup[j+2] && !palookup[j+3])
{ {
makepalookup(j, NULL, 60, 60, 60, 1); makepalookup(j, NULL, 60, 60, 60, 1);
@ -417,7 +417,7 @@ void generatefogpals(void)
void fillemptylookups(void) void fillemptylookups(void)
{ {
// Alias remaining unused pal numbers to the base shade table. // Alias remaining unused pal numbers to the base shade table.
for (int32_t j=1; j<MAXPALOOKUPS; j++) for (bssize_t j=1; j<MAXPALOOKUPS; j++)
{ {
// If an existing lookup is identical to #0, free it. // If an existing lookup is identical to #0, free it.
if (palookup[j] && palookup[j] != palookup[0] && !Bmemcmp(palookup[0], palookup[j], 256*numshades)) if (palookup[j] && palookup[j] != palookup[0] && !Bmemcmp(palookup[0], palookup[j], 256*numshades))
@ -479,7 +479,7 @@ void removepalookup(int32_t const palnum)
{ {
if (palnum == 0 && palookup[palnum] != NULL) if (palnum == 0 && palookup[palnum] != NULL)
{ {
for (int i = 1; i < MAXPALOOKUPS; i++) for (bssize_t i = 1; i < MAXPALOOKUPS; i++)
if (palookup[i] == palookup[palnum]) if (palookup[i] == palookup[palnum])
palookup[i] = NULL; palookup[i] = NULL;

View file

@ -296,7 +296,7 @@ static const _prprogrambit prprogrambits[PR_BIT_COUNT] = {
"\n" "\n"
" eyeVec = normalize(tangentSpaceEyeVec);\n" " eyeVec = normalize(tangentSpaceEyeVec);\n"
"\n" "\n"
" for (int i = 0; i < 4; i++) {\n" " for (bssize_t i = 0; i < 4; i++) {\n"
" normalStep = texture2D(normalMap, commonTexCoord.st);\n" " normalStep = texture2D(normalMap, commonTexCoord.st);\n"
" biasedHeight = normalStep.a * normalBias.x - normalBias.y;\n" " biasedHeight = normalStep.a * normalBias.x - normalBias.y;\n"
" commonTexCoord += (biasedHeight - commonTexCoord.z) * normalStep.z * eyeVec;\n" " commonTexCoord += (biasedHeight - commonTexCoord.z) * normalStep.z * eyeVec;\n"

View file

@ -185,7 +185,7 @@ void gltexinvalidate(int32_t dapicnum, int32_t dapalnum, int32_t dameth)
//Use this for palette effects ... but not ones that change every frame! //Use this for palette effects ... but not ones that change every frame!
void gltexinvalidatetype(int32_t type) void gltexinvalidatetype(int32_t type)
{ {
for (int j=0; j<=GLTEXCACHEADSIZ-1; j++) for (bssize_t j=0; j<=GLTEXCACHEADSIZ-1; j++)
{ {
for (pthtyp *pth=texcache.list[j]; pth; pth=pth->next) for (pthtyp *pth=texcache.list[j]; pth; pth=pth->next)
{ {
@ -232,7 +232,7 @@ void gltexapplyprops(void)
gltexfiltermode = clamp(gltexfiltermode, 0, NUMGLFILTERMODES-1); 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) for (pthtyp *pth=texcache.list[i]; pth; pth=pth->next)
{ {
@ -245,14 +245,14 @@ void gltexapplyprops(void)
} }
} }
for (int i=0; i<nextmodelid; i++) for (bssize_t i=0; i<nextmodelid; i++)
{ {
md2model_t *m = (md2model_t *)models[i]; md2model_t *m = (md2model_t *)models[i];
if (m->mdnum < 2) if (m->mdnum < 2)
continue; 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]) if (!m->texid[j])
continue; continue;
@ -260,7 +260,7 @@ void gltexapplyprops(void)
} }
for (mdskinmap_t *sk = m->skinmap; sk; sk = sk->next) 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]) if (!sk->texid[j])
continue; continue;
@ -278,7 +278,7 @@ static int32_t gltexcacnum = -1;
void polymost_glreset() 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].r = palookupfog[i].r * (1.f/255.f);
fogtable[i].g = palookupfog[i].g * (1.f/255.f); fogtable[i].g = palookupfog[i].g * (1.f/255.f);
@ -297,7 +297,7 @@ void polymost_glreset()
} }
else 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;) 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 //Set transparent pixels to average color of neighboring opaque pixels
//Doing this makes bilinear filtering look much better for masked textures (I.E. sprites) //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]; 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; if (wpptr->a) continue;
@ -898,17 +898,17 @@ void uploadtexture(int32_t doalloc, vec2_t siz, int32_t texfmt,
vec2_t siz2 = siz; 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 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); //x3 = ((x2+1)>>1); y3 = ((y2+1)>>1);
for (int y=0; y<siz3.y; y++) for (bssize_t y=0; y<siz3.y; y++)
{ {
coltype *wpptr = &pic[y*siz3.x]; coltype *wpptr = &pic[y*siz3.x];
coltype const *rpptr = &pic[(y<<1)*siz2.x]; coltype const *rpptr = &pic[(y<<1)*siz2.x];
for (int x=0; x<siz3.x; x++,wpptr++,rpptr+=2) for (bssize_t x=0; x<siz3.x; x++,wpptr++,rpptr+=2)
{ {
int32_t r=0, g=0, b=0, a=0, k=0; int32_t r=0, g=0, b=0, a=0, k=0;
@ -1060,12 +1060,12 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das
{ {
const int dofullbright = !(picanm[dapic].sf & PICANM_NOFULLBRIGHT_BIT) && !(globalflags & GLOBAL_NO_GL_FULLBRIGHT); const int dofullbright = !(picanm[dapic].sf & PICANM_NOFULLBRIGHT_BIT) && !(globalflags & GLOBAL_NO_GL_FULLBRIGHT);
for (int y = 0; y < siz.y; y++) for (bssize_t y = 0; y < siz.y; y++)
{ {
coltype *wpptr = &pic[y * siz.x]; coltype *wpptr = &pic[y * siz.x];
int32_t y2 = (y < tsiz.y) ? y : y - tsiz.y; int32_t y2 = (y < tsiz.y) ? y : y - tsiz.y;
for (int x = 0; x < siz.x; x++, wpptr++) for (bssize_t x = 0; x < siz.x; x++, wpptr++)
{ {
int32_t dacol; int32_t dacol;
int32_t x2 = (x < tsiz.x) ? x : x-tsiz.x; int32_t x2 = (x < tsiz.x) ? x : x-tsiz.x;
@ -1391,11 +1391,11 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
char al = 255; char al = 255;
char onebitalpha = 1; 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]; 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.b = cptr[rpptr[x].b];
tcol.g = cptr[rpptr[x].g]; tcol.g = cptr[rpptr[x].g];
@ -1463,7 +1463,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
if (!glinfo.bgra) if (!glinfo.bgra)
{ {
for (int i=siz.x*siz.y, j=0; j<i; j++) for (bssize_t i=siz.x*siz.y, j=0; j<i; j++)
swapchar(&pic[j].r, &pic[j].b); swapchar(&pic[j].r, &pic[j].b);
} }
@ -1650,7 +1650,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
{ {
float f = 0; //f is area of polygon / 2 float f = 0; //f is area of polygon / 2
for (int i=n-2, j=n-1,k=0; k<n; i=j,j=k,k++) for (bssize_t i=n-2, j=n-1,k=0; k<n; i=j,j=k,k++)
f += (dpxy[i].x-dpxy[k].x)*dpxy[j].y; f += (dpxy[i].x-dpxy[k].x)*dpxy[j].y;
if (f <= 0) return; if (f <= 0) return;
@ -1681,7 +1681,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
float const ozgs = ghalfx * gshang, float const ozgs = ghalfx * gshang,
ozgc = ghalfx * gchang; ozgc = ghalfx * gchang;
for (int i=0; i<n; ++i) for (bssize_t i=0; i<n; ++i)
{ {
//Up/down rotation //Up/down rotation
vec3f_t const orot = { dpxy[i].x - ghalfx, vec3f_t const orot = { dpxy[i].x - ghalfx,
@ -1890,7 +1890,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
float du0, du1; float du0, du1;
//Find min&max u coordinates (du0...du1) //Find min&max u coordinates (du0...du1)
for (int i=0; i<npoints; ++i) for (bssize_t i=0; i<npoints; ++i)
{ {
vec2f_t const o = { px[i], py[i] }; vec2f_t const o = { px[i], py[i] };
float const f = (o.x*ngx.u + o.y*ngy.u + ngo.u) / (o.x*ngx.d + o.y*ngy.d + ngo.d); float const f = (o.x*ngx.u + o.y*ngy.u + ngo.u) / (o.x*ngx.d + o.y*ngy.d + ngo.d);
@ -1902,7 +1902,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
float const rf = 1.0f / tsiz.x; float const rf = 1.0f / tsiz.x;
int const ix1 = (int)floorf(du1 * rf); int const ix1 = (int)floorf(du1 * rf);
for (int ix0 = (int)floorf(du0 * rf); ix0 <= ix1; ++ix0) for (bssize_t ix0 = (int)floorf(du0 * rf); ix0 <= ix1; ++ix0)
{ {
du0 = (float)(ix0 * tsiz.x); // + uoffs; du0 = (float)(ix0 * tsiz.x); // + uoffs;
du1 = (float)((ix0 + 1) * tsiz.x); // + uoffs; du1 = (float)((ix0 + 1) * tsiz.x); // + uoffs;
@ -2001,7 +2001,7 @@ do
bglBegin(GL_TRIANGLE_FAN); bglBegin(GL_TRIANGLE_FAN);
for (int i = 0; i < npoints; ++i) for (bssize_t i = 0; i < npoints; ++i)
{ {
float const r = 1.f / dd[i]; float const r = 1.f / dd[i];
@ -2079,7 +2079,7 @@ do
static inline void vsp_finalize_init(int32_t const vcnt) static inline void vsp_finalize_init(int32_t const vcnt)
{ {
for (int i=0; i<vcnt; ++i) for (bssize_t i=0; i<vcnt; ++i)
{ {
vsp[i].cy[1] = vsp[i+1].cy[0]; vsp[i].ctag = i; vsp[i].cy[1] = vsp[i+1].cy[0]; vsp[i].ctag = i;
vsp[i].fy[1] = vsp[i+1].fy[0]; vsp[i].ftag = i; vsp[i].fy[1] = vsp[i+1].fy[0]; vsp[i].ftag = i;
@ -2089,7 +2089,7 @@ static inline void vsp_finalize_init(int32_t const vcnt)
vsp[vcnt-1].n = 0; vsp[0].p = vcnt-1; vsp[vcnt-1].n = 0; vsp[0].p = vcnt-1;
//VSPMAX-1 is dummy empty node //VSPMAX-1 is dummy empty node
for (int i=vcnt; i<VSPMAX; i++) { vsp[i].n = i+1; vsp[i].p = i-1; } for (bssize_t i=vcnt; i<VSPMAX; i++) { vsp[i].n = i+1; vsp[i].p = i-1; }
vsp[VSPMAX-1].n = vcnt; vsp[vcnt].p = VSPMAX-1; vsp[VSPMAX-1].n = vcnt; vsp[vcnt].p = VSPMAX-1;
} }
@ -2162,7 +2162,7 @@ static void polymost_domost(float x0, float y0, float x1, float y1)
float spx[4]; float spx[4];
int32_t spt[4]; int32_t spt[4];
for (int newi, i=vsp[0].n; i; i=newi) for (bssize_t newi, i=vsp[0].n; i; i=newi)
{ {
newi = vsp[i].n; n0.x = vsp[i].x; n1.x = vsp[newi].x; newi = vsp[i].n; n0.x = vsp[i].x; n1.x = vsp[newi].x;
@ -2218,7 +2218,7 @@ static void polymost_domost(float x0, float y0, float x1, float y1)
float const rdx = 1.f/dx; float const rdx = 1.f/dx;
for (int z=0, vcnt=0; z<=scnt; z++,i=vcnt) for (bssize_t z=0, vcnt=0; z<=scnt; z++,i=vcnt)
{ {
float t; float t;
@ -2532,7 +2532,7 @@ void polymost_editorfunc(void)
uint64_t bestwdistsq = 0x7fffffff; uint64_t bestwdistsq = 0x7fffffff;
int32_t bestk = -1; int32_t bestk = -1;
for (int32_t k = 0; k < sector[searchsector].wallnum; k++) for (bssize_t k = 0; k < sector[searchsector].wallnum; k++)
{ {
vec2_t const w1 = { wal[k].x, wal[k].y }; vec2_t const w1 = { wal[k].x, wal[k].y };
vec2_t const w2 = { wall[wal[k].point2].x, wall[wal[k].point2].y }; vec2_t const w2 = { wall[wal[k].point2].x, wall[wal[k].point2].y };
@ -2797,7 +2797,7 @@ static void calc_ypanning(int32_t refposz, float ryp0, float ryp1,
static inline int32_t testvisiblemost(float const x0, float const x1) static inline int32_t testvisiblemost(float const x0, float const x1)
{ {
for (int i=vsp[0].n, newi; i; i=newi) for (bssize_t i=vsp[0].n, newi; i; i=newi)
{ {
newi = vsp[i].n; newi = vsp[i].n;
if ((x0 < vsp[newi].x) && (vsp[i].x < x1) && (vsp[i].ctag >= 0)) if ((x0 < vsp[newi].x) && (vsp[i].x < x1) && (vsp[i].ctag >= 0))
@ -2836,7 +2836,7 @@ static void polymost_drawalls(int32_t const bunch)
usectortype const * const sec = (usectortype *)&sector[sectnum]; usectortype const * const sec = (usectortype *)&sector[sectnum];
//DRAW WALLS SECTION! //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]; 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); calc_and_apply_fog_factor(sec->floorpicnum, sec->floorshade, sec->visibility, sec->floorpal, 0.005f);
//Use clamping for tiled sky textures //Use clamping for tiled sky textures
for (int i=(1<<dapskybits)-1; i>0; i--) for (bssize_t i=(1<<dapskybits)-1; i>0; i--)
if (dapskyoff[i] != dapskyoff[i-1]) if (dapskyoff[i] != dapskyoff[i-1])
{ skyclamphack = r_parallaxskyclamping; break; } { skyclamphack = r_parallaxskyclamping; break; }
@ -3017,7 +3017,7 @@ static void polymost_drawalls(int32_t const bunch)
pow2xsplit = 0; pow2xsplit = 0;
skyclamphack = 1; skyclamphack = 1;
for (int i=0; i<4; i++) for (bssize_t i=0; i<4; i++)
{ {
walpos = skywal[i&3]; walpos = skywal[i&3];
vec2f_t skyp0 = { walpos.y * gcosang - walpos.x * gsinang, 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); calc_and_apply_fog_factor(sec->ceilingpicnum, sec->ceilingshade, sec->visibility, sec->ceilingpal, 0.005f);
//Use clamping for tiled sky textures //Use clamping for tiled sky textures
for (int i=(1<<dapskybits)-1; i>0; i--) for (bssize_t i=(1<<dapskybits)-1; i>0; i--)
if (dapskyoff[i] != dapskyoff[i-1]) if (dapskyoff[i] != dapskyoff[i-1])
{ skyclamphack = r_parallaxskyclamping; break; } { skyclamphack = r_parallaxskyclamping; break; }
@ -3309,7 +3309,7 @@ static void polymost_drawalls(int32_t const bunch)
pow2xsplit = 0; pow2xsplit = 0;
skyclamphack = 1; skyclamphack = 1;
for (int i=0; i<4; i++) for (bssize_t i=0; i<4; i++)
{ {
walpos = skywal[i&3]; walpos = skywal[i&3];
vec2f_t skyp0 = { walpos.y * gcosang - walpos.x * gsinang, vec2f_t skyp0 = { walpos.y * gcosang - walpos.x * gsinang,
@ -3664,7 +3664,7 @@ void polymost_scansector(int32_t sectnum)
{ {
sectnum = sectorborder[--sectorbordercnt]; 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]; uspritetype const * const spr = (uspritetype *)&sprite[z];
@ -3753,7 +3753,7 @@ void polymost_scansector(int32_t sectnum)
} }
} }
for (int z=numscansbefore; z<numscans; z++) for (bssize_t z=numscansbefore; z<numscans; z++)
{ {
if ((wall[thewall[z]].point2 != thewall[bunchp2[z]]) || (dxb2[z] > dxb1[bunchp2[z]])) if ((wall[thewall[z]].point2 != thewall[bunchp2[z]]) || (dxb2[z] > dxb1[bunchp2[z]]))
{ {
@ -3766,7 +3766,7 @@ void polymost_scansector(int32_t sectnum)
} }
} }
for (int z=bunchfrst; z<numbunches; z++) for (bssize_t z=bunchfrst; z<numbunches; z++)
{ {
int zz; int zz;
for (zz=bunchfirst[z]; bunchp2[zz]>=0; zz=bunchp2[zz]) { } for (zz=bunchfirst[z]; bunchp2[zz]>=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]); 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; if (px[i] < px[imin]) imin = i;
int32_t vcnt = 1; //0 is dummy solid node 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 }, { (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 } }; { 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) //Tilt rotation (backwards)
vec2f_t const o = { p[i].x-ghalfx, p[i].y-ghoriz }; vec2f_t const o = { p[i].x-ghalfx, p[i].y-ghoriz };
@ -3958,7 +3958,7 @@ void polymost_drawrooms()
vec3f_t p2[6]; 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; int const j = i < 3 ? i + 1 : 0;
@ -3978,7 +3978,7 @@ void polymost_drawrooms()
float sx[4], sy[4]; 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; float const r = ghalfx / p2[i].z;
sx[i] = p2[i].x * r + ghalfx; sx[i] = p2[i].x * r + ghalfx;
@ -4023,13 +4023,13 @@ void polymost_drawrooms()
int32_t closest = 0; //Almost works, but not quite :( int32_t closest = 0; //Almost works, but not quite :(
for (int i=1; i<numbunches; ++i) for (bssize_t i=1; i<numbunches; ++i)
{ {
int const bnch = polymost_bunchfront(i,closest); if (bnch < 0) continue; int const bnch = polymost_bunchfront(i,closest); if (bnch < 0) continue;
ptempbuf[i] = 1; ptempbuf[i] = 1;
if (!bnch) { ptempbuf[closest] = 1; closest = i; } if (!bnch) { ptempbuf[closest] = 1; closest = i; }
} }
for (int i=0; i<numbunches; ++i) //Double-check for (bssize_t i=0; i<numbunches; ++i) //Double-check
{ {
if (ptempbuf[i]) continue; if (ptempbuf[i]) continue;
int const bnch = polymost_bunchfront(i,closest); if (bnch < 0) continue; int const bnch = polymost_bunchfront(i,closest); if (bnch < 0) continue;
@ -4189,7 +4189,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
int n2 = 0; int n2 = 0;
t1 = -((dpxy[0].x - x0) * (csy[2] - csy[0]) - (dpxy[0].y - csy[0]) * (x1 - x0)); t1 = -((dpxy[0].x - x0) * (csy[2] - csy[0]) - (dpxy[0].y - csy[0]) * (x1 - x0));
for (int i=0; i<4; i++) for (bssize_t i=0; i<4; i++)
{ {
int j = i + 1; int j = i + 1;
@ -4218,7 +4218,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
t1 = -((dp2[0].x - x1) * (fsy[0] - fsy[2]) - (dp2[0].y - fsy[2]) * (x0 - x1)); t1 = -((dp2[0].x - x1) * (fsy[0] - fsy[2]) - (dp2[0].y - fsy[2]) * (x0 - x1));
int n = 0; int n = 0;
for (int i = 0, j = 1; i < n2; j = ++i + 1) for (bssize_t i = 0, j = 1; i < n2; j = ++i + 1)
{ {
if (j >= n2) if (j >= n2)
j = 0; j = 0;
@ -4264,7 +4264,7 @@ static inline int32_t polymost_findwall(uspritetype const * const tspr, vec2_t c
usectortype const * const sect = (usectortype * )&sector[tspr->sectnum]; usectortype const * const sect = (usectortype * )&sector[tspr->sectnum];
vec2_t n; vec2_t n;
for (int i=sect->wallptr; i<sect->wallptr + sect->wallnum; i++) for (bssize_t i=sect->wallptr; i<sect->wallptr + sect->wallnum; i++)
{ {
if ((wall[i].nextsector == -1 || ((sector[wall[i].nextsector].ceilingz > (tspr->z - ((tsiz->y * tspr->yrepeat) << 2))) || 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)) 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]; vec2f_t pxy[6];
// Project 3D to 2D // 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) }; 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; int32_t npoints = 0;
vec2f_t p2[6]; 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) if (pxy[i].y >= SCISDIST)
p2[npoints++] = pxy[i]; p2[npoints++] = pxy[i];
@ -4846,7 +4846,7 @@ void polymost_drawsprite(int32_t snum)
float f = (float)(tspr->z - globalposz + fadjust) * gyxscale; 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; float const ryp0 = 1.f / p2[j].y;
pxy[j].x = ghalfx * p2[j].x * ryp0 + ghalfx; 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; } else { px[1] = x1; py[1] = y0; px[2] = x3; px[3] = x2; py[3] = y1; n = 4; }
bglBegin(GL_TRIANGLE_FAN); bglBegin(GL_TRIANGLE_FAN);
for (int i=0; i<n; i++) for (bssize_t i=0; i<n; i++)
{ {
px[i] = min(max(px[i],trapextx[0]),trapextx[1]); px[i] = min(max(px[i],trapextx[0]),trapextx[1]);
bglTexCoord2f(px[i]*xtex.u + py[i]*ytex.u + otex.u, bglTexCoord2f(px[i]*xtex.u + py[i]*ytex.u + otex.u,
@ -5578,7 +5578,7 @@ void polymost_fillpolygon(int32_t npoints)
otex.v = (fxdim * xtex.v + fydim * ytex.v) * -0.5f - fglobalposy * (1.f / 4294967296.f); otex.v = (fxdim * xtex.v + fydim * ytex.v) * -0.5f - fglobalposy * (1.f / 4294967296.f);
//Convert int32_t to float (in-place) //Convert int32_t to float (in-place)
for (int i=0; i<npoints; ++i) for (bssize_t i=0; i<npoints; ++i)
{ {
((float *)rx1)[i] = ((float)rx1[i])*(1.0f/4096.f); ((float *)rx1)[i] = ((float)rx1[i])*(1.0f/4096.f);
((float *)ry1)[i] = ((float)ry1[i])*(1.0f/4096.f); ((float *)ry1)[i] = ((float)ry1[i])*(1.0f/4096.f);
@ -5707,12 +5707,12 @@ static int32_t gen_font_glyph_tex(void)
char * cptr = (char *)textfont; char * cptr = (char *)textfont;
for (int h=0; h<256; h++) for (bssize_t h=0; h<256; h++)
{ {
char *tptr = tbuf + (h%32)*8 + (h/32)*256*8; char *tptr = tbuf + (h%32)*8 + (h/32)*256*8;
for (int i=0; i<8; i++) for (bssize_t i=0; i<8; i++)
{ {
for (int j=0; j<8; j++) for (bssize_t j=0; j<8; j++)
{ {
if (cptr[h*8+i] & pow2char[7-j]) tptr[j] = 255; if (cptr[h*8+i] & pow2char[7-j]) tptr[j] = 255;
} }
@ -5722,12 +5722,12 @@ static int32_t gen_font_glyph_tex(void)
cptr = (char *)smalltextfont; cptr = (char *)smalltextfont;
for (int h=0; h<256; h++) for (bssize_t h=0; h<256; h++)
{ {
char *tptr = tbuf + 256*64 + (h%32)*8 + (h/32)*256*8; char *tptr = tbuf + 256*64 + (h%32)*8 + (h/32)*256*8;
for (int i=1; i<7; i++) for (bssize_t i=1; i<7; i++)
{ {
for (int j=2; j<6; j++) for (bssize_t j=2; j<6; j++)
{ {
if (cptr[h*8+i] & pow2char[7-j]) tptr[j-2] = 255; if (cptr[h*8+i] & pow2char[7-j]) tptr[j-2] = 255;
} }
@ -5798,7 +5798,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
bglBegin(GL_QUADS); bglBegin(GL_QUADS);
for (int c=0; name[c]; ++c) for (bssize_t c=0; name[c]; ++c)
{ {
if (name[c] == '^' && isdigit(name[c+1])) if (name[c] == '^' && isdigit(name[c+1]))
{ {
@ -6099,7 +6099,7 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
int j = (models[mid]->mdnum == 3) ? ((md3model_t *)models[mid])->head.numsurfs : 0; int j = (models[mid]->mdnum == 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 */ #else /* if !defined USE_OPENGL */

View file

@ -18,7 +18,7 @@ void initdivtables(void)
libdivide_s64_t d; libdivide_s64_t d;
libdivide_s32_t d32; libdivide_s32_t d32;
for (int i=1; i<DIVTABLESIZE; i++) for (bssize_t i=1; i<DIVTABLESIZE; i++)
{ {
d = libdivide_s64_gen(i); d = libdivide_s64_gen(i);
divtable64[i].magic = d.magic, divtable64[i].more = d.more; divtable64[i].magic = d.magic, divtable64[i].more = d.more;

View file

@ -461,7 +461,7 @@ int32_t main(int32_t argc, char *argv[])
const char **buildargv = (const char **) Bmalloc(sizeof(char *)*(buildargc+1)); const char **buildargv = (const char **) Bmalloc(sizeof(char *)*(buildargc+1));
char *wp = argvbuf; char *wp = argvbuf;
for (int i=0; i<buildargc; i++, wp++) for (bssize_t i=0; i<buildargc; i++, wp++)
{ {
buildargv[i] = wp; buildargv[i] = wp;
while (*wp) wp++; while (*wp) wp++;

View file

@ -201,10 +201,10 @@ void texcache_freeptrs(void)
if (!texcache.iptrs) if (!texcache.iptrs)
return; return;
for (int i = 0; i < texcache.numentries; i++) for (bssize_t i = 0; i < texcache.numentries; i++)
if (texcache.iptrs[i]) if (texcache.iptrs[i])
{ {
for (int ii = texcache.numentries - 1; ii >= 0; ii--) for (bssize_t ii = texcache.numentries - 1; ii >= 0; ii--)
if (i != ii && texcache.iptrs[ii] == texcache.iptrs[i]) if (i != ii && texcache.iptrs[ii] == texcache.iptrs[i])
{ {
/*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/ /*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); UNREFERENCED_PARAMETER(head);
#endif #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))) if (texcache_readdata(&pict, sizeof(texcachepicture)))
{ {

View file

@ -46,7 +46,7 @@ static inline void clearmapartfilename(void)
static inline void E_RecalcPicSiz(void) static inline void E_RecalcPicSiz(void)
{ {
for (int i=0; i<MAXTILES; i++) for (bssize_t i=0; i<MAXTILES; i++)
set_picsiz(i); set_picsiz(i);
} }
@ -93,7 +93,7 @@ void E_MapArt_Clear(void)
artfilplc = 0L; artfilplc = 0L;
} }
for (int i=0; i<MAXTILES; i++) for (bssize_t i=0; i<MAXTILES; i++)
{ {
if (tilefilenum[i] >= MAXARTFILES_BASE) if (tilefilenum[i] >= MAXARTFILES_BASE)
{ {
@ -147,7 +147,7 @@ void E_MapArt_Setup(const char *filename)
ALLOC_MAPART_ARRAY(tilesiz, g_bakTileSiz); ALLOC_MAPART_ARRAY(tilesiz, g_bakTileSiz);
ALLOC_MAPART_ARRAY(picanm, g_bakPicAnm); ALLOC_MAPART_ARRAY(picanm, g_bakPicAnm);
for (int i=MAXARTFILES_BASE; i<MAXARTFILES_TOTAL; i++) for (bssize_t i=MAXARTFILES_BASE; i<MAXARTFILES_TOTAL; i++)
{ {
int ret = E_ReadArtFileOfID(i); int ret = E_ReadArtFileOfID(i);
@ -347,7 +347,7 @@ void E_ReadArtFileTileInfo(int32_t const fil, artheader_t const * const local)
kread(fil, tilesizy, local->numtiles*sizeof(int16_t)); kread(fil, tilesizy, local->numtiles*sizeof(int16_t));
kread(fil, &picanm[local->tilestart], local->numtiles*sizeof(picanm_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].x = B_LITTLE16(tilesizx[i-local->tilestart]);
tilesiz[i].y = B_LITTLE16(tilesizy[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; char *buffer = NULL;
int32_t buffersize = 0; 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; 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 // Check whether we can evict existing tiles to make place for
// per-map ART ones. // 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 // Tiles having dummytile replacements or those that are
// cache1d-locked can't be replaced. // 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); 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; int const dasiz = tilesiz[i].x * tilesiz[i].y;
@ -498,7 +498,7 @@ int32_t loadpics(const char *filename, int32_t askedsize)
// artsize = 0; // artsize = 0;
for (int tilefilei=0; tilefilei<MAXARTFILES_BASE; tilefilei++) for (bssize_t tilefilei=0; tilefilei<MAXARTFILES_BASE; tilefilei++)
E_ReadArtFileOfID(tilefilei); E_ReadArtFileOfID(tilefilei);
Bmemset(gotpic, 0, sizeof(gotpic)); Bmemset(gotpic, 0, sizeof(gotpic));
@ -635,11 +635,11 @@ static void postloadtile(int16_t tilenume)
// Assumes pic has been initialized to zero. // Assumes pic has been initialized to zero.
void E_RenderArtDataIntoBuffer(palette_t * const pic, uint8_t const * const buf, int32_t const bufsizx, int32_t const sizx, int32_t const sizy) void E_RenderArtDataIntoBuffer(palette_t * const pic, uint8_t const * const buf, int32_t const bufsizx, int32_t const sizx, int32_t const sizy)
{ {
for (int y = 0; y < sizy; ++y) for (bssize_t y = 0; y < sizy; ++y)
{ {
palette_t * const picrow = &pic[bufsizx * y]; palette_t * const picrow = &pic[bufsizx * y];
for (int x = 0; x < sizx; ++x) for (bssize_t x = 0; x < sizx; ++x)
{ {
uint8_t index = buf[sizy * x + y]; uint8_t index = buf[sizy * x + y];

View file

@ -47,7 +47,7 @@ uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i
if (!is8bit) if (!is8bit)
{ {
for (int32_t i=xsiz*ysiz-1; i>=0; i--) for (bssize_t i=xsiz*ysiz-1; i>=0; i--)
{ {
pic2[i].b = cptr[pic[i].r]; pic2[i].b = cptr[pic[i].r];
pic2[i].g = cptr[pic[i].g]; 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) if (palookup[dapal] == NULL)
dapal = 0; 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]; 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; nx = x0; break;
} }
for (int32_t yy=0; yy<y; yy++, lptr+=gvox->mytexx) for (bssize_t yy=0; yy<y; yy++, lptr+=gvox->mytexx)
for (int32_t xx=0; xx<x; xx++) for (bssize_t xx=0; xx<x; xx++)
{ {
switch (face) switch (face)
{ {
@ -300,8 +300,8 @@ static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1,
} }
//Extend borders horizontally //Extend borders horizontally
for (int32_t yy=VOXBORDWIDTH; yy<y+VOXBORDWIDTH; yy++) for (bssize_t yy=VOXBORDWIDTH; yy<y+VOXBORDWIDTH; yy++)
for (int32_t xx=0; xx<VOXBORDWIDTH; xx++) for (bssize_t xx=0; xx<VOXBORDWIDTH; xx++)
{ {
lptr = &gvox->mytex[(shp[z].y+yy)*gvox->mytexx + shp[z].x]; lptr = &gvox->mytex[(shp[z].y+yy)*gvox->mytexx + shp[z].x];
lptr[xx] = lptr[VOXBORDWIDTH]; 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 //Extend borders vertically
for (int32_t yy=0; yy<VOXBORDWIDTH; yy++) for (bssize_t yy=0; yy<VOXBORDWIDTH; yy++)
{ {
Bmemcpy(&gvox->mytex[(shp[z].y+yy)*gvox->mytexx + shp[z].x], Bmemcpy(&gvox->mytex[(shp[z].y+yy)*gvox->mytexx + shp[z].x],
&gvox->mytex[(shp[z].y+VOXBORDWIDTH)*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[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; 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].u = shp[z].x+VOXBORDWIDTH;
qptr->v[j].v = shp[z].y+VOXBORDWIDTH; qptr->v[j].v = shp[z].y+VOXBORDWIDTH;
@ -416,7 +416,7 @@ static voxmodel_t *vox2poly()
int32_t ov, oz=0; 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) = 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; cnt == 0 ? cntquad : addquad;
@ -427,9 +427,9 @@ static voxmodel_t *vox2poly()
int32_t v = 0; int32_t v = 0;
for (i=-1; i<=1; i+=2) for (i=-1; i<=1; i+=2)
for (int32_t y=0; y<voxsiz.y; y++) for (bssize_t y=0; y<voxsiz.y; y++)
for (int32_t x=0; x<=voxsiz.x; x++) for (bssize_t x=0; x<=voxsiz.x; x++)
for (int32_t z=0; z<=voxsiz.z; z++) for (bssize_t z=0; z<=voxsiz.z; z++)
{ {
ov = v; v = (isolid(x, y, z) && (!isolid(x, y+i, z))); ov = v; v = (isolid(x, y, z) && (!isolid(x, y+i, z)));
if ((by0[z] >= 0) && ((by0[z] != oz) || (v >= ov))) if ((by0[z] >= 0) && ((by0[z] != oz) || (v >= ov)))
@ -443,9 +443,9 @@ static voxmodel_t *vox2poly()
} }
for (i=-1; i<=1; i+=2) for (i=-1; i<=1; i+=2)
for (int32_t z=0; z<voxsiz.z; z++) for (bssize_t z=0; z<voxsiz.z; z++)
for (int32_t x=0; x<=voxsiz.x; x++) for (bssize_t x=0; x<=voxsiz.x; x++)
for (int32_t y=0; y<=voxsiz.y; y++) for (bssize_t y=0; y<=voxsiz.y; y++)
{ {
ov = v; v = (isolid(x, y, z) && (!isolid(x, y, z-i))); ov = v; v = (isolid(x, y, z) && (!isolid(x, y, z-i)));
if ((by0[y] >= 0) && ((by0[y] != oz) || (v >= ov))) if ((by0[y] >= 0) && ((by0[y] != oz) || (v >= ov)))
@ -459,9 +459,9 @@ static voxmodel_t *vox2poly()
} }
for (i=-1; i<=1; i+=2) for (i=-1; i<=1; i+=2)
for (int32_t x=0; x<voxsiz.x; x++) for (bssize_t x=0; x<voxsiz.x; x++)
for (int32_t y=0; y<=voxsiz.y; y++) for (bssize_t y=0; y<=voxsiz.y; y++)
for (int32_t z=0; z<=voxsiz.z; z++) for (bssize_t z=0; z<=voxsiz.z; z++)
{ {
ov = v; v = (isolid(x, y, z) && (!isolid(x-i, y, z))); ov = v; v = (isolid(x, y, z) && (!isolid(x-i, y, z)));
if ((by0[z] >= 0) && ((by0[z] != oz) || (v >= ov))) if ((by0[z] >= 0) && ((by0[z] != oz) || (v >= ov)))
@ -480,8 +480,8 @@ static voxmodel_t *vox2poly()
int32_t sc = 0; int32_t sc = 0;
for (int32_t y=gmaxy; y; y--) for (bssize_t y=gmaxy; y; y--)
for (int32_t x=gmaxx; x>=y; x--) 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 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); memset(zbit, 0, i);
v = gvox->mytexx*gvox->mytexy; v = gvox->mytexx*gvox->mytexy;
for (int32_t z=0; z<sc; z++) for (bssize_t z=0; z<sc; z++)
{ {
const int32_t dx = shp[z].x + (VOXBORDWIDTH<<1); const int32_t dx = shp[z].x + (VOXBORDWIDTH<<1);
const int32_t dy = shp[z].y + (VOXBORDWIDTH<<1); const int32_t dy = shp[z].y + (VOXBORDWIDTH<<1);
@ -540,8 +540,8 @@ skindidntfit:
//Re-generate shp[].x/y (box sizes) from shcnt (now head indices) for next pass :/ //Re-generate shp[].x/y (box sizes) from shcnt (now head indices) for next pass :/
j = 0; j = 0;
for (int32_t y=gmaxy; y; y--) for (bssize_t y=gmaxy; y; y--)
for (int32_t x=gmaxx; x>=y; x--) for (bssize_t x=gmaxx; x>=y; x--)
{ {
i = shcnt[y*shcntp+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); klseek(fil, -768, SEEK_END);
for (int32_t i=0; i<256; i++) for (bssize_t i=0; i<256; i++)
{ {
char c[3]; char c[3];
kread(fil, 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)); char *const tbuf = (char *)Xmalloc(voxsiz.z*sizeof(uint8_t));
klseek(fil, 12, SEEK_SET); klseek(fil, 12, SEEK_SET);
for (int32_t x=0; x<voxsiz.x; x++) for (bssize_t x=0; x<voxsiz.x; x++)
for (int32_t y=0, j=x*yzsiz; y<voxsiz.y; y++, j+=voxsiz.z) for (bssize_t y=0, j=x*yzsiz; y<voxsiz.y; y++, j+=voxsiz.z)
{ {
kread(fil, tbuf, voxsiz.z); kread(fil, tbuf, voxsiz.z);
for (int32_t z=voxsiz.z-1; z>=0; z--) for (bssize_t z=voxsiz.z-1; z>=0; z--)
if (tbuf[z] != 255) if (tbuf[z] != 255)
{ {
const int32_t i = j+z; const int32_t i = j+z;
@ -654,12 +654,12 @@ static int32_t loadvox(const char *filnam)
} }
klseek(fil, 12, SEEK_SET); klseek(fil, 12, SEEK_SET);
for (int32_t x=0; x<voxsiz.x; x++) for (bssize_t x=0; x<voxsiz.x; x++)
for (int32_t y=0, j=x*yzsiz; y<voxsiz.y; y++, j+=voxsiz.z) for (bssize_t y=0, j=x*yzsiz; y<voxsiz.y; y++, j+=voxsiz.z)
{ {
kread(fil, tbuf, voxsiz.z); kread(fil, tbuf, voxsiz.z);
for (int32_t z=0; z<voxsiz.z; z++) for (bssize_t z=0; z<voxsiz.z; z++)
{ {
if (tbuf[z] == 255) if (tbuf[z] == 255)
continue; continue;
@ -739,8 +739,8 @@ static int32_t loadkvx(const char *filnam)
char *cptr = tbuf; char *cptr = tbuf;
for (int32_t x=0; x<voxsiz.x; x++) //Set surface voxels to 1 else 0 for (bssize_t x=0; x<voxsiz.x; x++) //Set surface voxels to 1 else 0
for (int32_t y=0, j=x*yzsiz; y<voxsiz.y; y++, j+=voxsiz.z) for (bssize_t y=0, j=x*yzsiz; y<voxsiz.y; y++, j+=voxsiz.z)
{ {
i = xyoffs[x*ysizp1+y+1] - xyoffs[x*ysizp1+y]; i = xyoffs[x*ysizp1+y+1] - xyoffs[x*ysizp1+y];
if (!i) if (!i)
@ -762,7 +762,7 @@ static int32_t loadkvx(const char *filnam)
setzrange1(vbit, j+z0, j+z1); // PK: oob in AMC TC dev if vbit alloc'd w/o +1 setzrange1(vbit, j+z0, j+z1); // PK: oob in AMC TC dev if vbit alloc'd w/o +1
for (int32_t z=z0; z<z1; z++) for (bssize_t z=z0; z<z1; z++)
putvox(x, y, z, pal[*cptr++]); putvox(x, y, z, pal[*cptr++]);
} }
} }
@ -819,8 +819,8 @@ static int32_t loadkv6(const char *filnam)
vcolhashsizm1--; vcolhashsizm1--;
alloc_vcolhashead(); alloc_vcolhashead();
for (int32_t x=0; x<voxsiz.x; x++) for (bssize_t x=0; x<voxsiz.x; x++)
for (int32_t y=0, j=x*yzsiz; y<voxsiz.y; y++, j+=voxsiz.z) for (bssize_t y=0, j=x*yzsiz; y<voxsiz.y; y++, j+=voxsiz.z)
{ {
int32_t z1 = voxsiz.z; int32_t z1 = voxsiz.z;
@ -1020,7 +1020,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr)
bglBegin(GL_QUADS); // {{{ bglBegin(GL_QUADS); // {{{
for (int32_t i=0, fi=0; i<m->qcnt; i++) for (bssize_t i=0, fi=0; i<m->qcnt; i++)
{ {
if (i == m->qfacind[fi]) 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 yy = vptr[0].y + vptr[2].y;
const int32_t zz = vptr[0].z + vptr[2].z; 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; vec3f_t fp;
#if (VOXBORDWIDTH == 0) #if (VOXBORDWIDTH == 0)

View file

@ -42,7 +42,7 @@ int32_t G_SetInterpolation(int32_t * const posptr)
if (g_numInterpolations >= MAXINTERPOLATIONS) if (g_numInterpolations >= MAXINTERPOLATIONS)
return 1; return 1;
for (int i = 0; i < g_numInterpolations; ++i) for (bssize_t i = 0; i < g_numInterpolations; ++i)
if (curipos[i] == posptr) if (curipos[i] == posptr)
return 0; return 0;
@ -54,7 +54,7 @@ int32_t G_SetInterpolation(int32_t * const posptr)
void G_StopInterpolation(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) if (curipos[i] == posptr)
{ {
g_numInterpolations--; g_numInterpolations--;
@ -71,7 +71,7 @@ void G_DoInterpolations(int32_t smoothratio) //Stick at beginning of draws
int32_t odelta, ndelta = 0; 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; odelta = ndelta;
bakipos[i] = *curipos[i]; bakipos[i] = *curipos[i];
@ -91,7 +91,7 @@ void G_ClearCameraView(DukePlayer_t *ps)
updatesector(ps->pos.x, ps->pos.y, &ps->cursectnum); updatesector(ps->pos.x, ps->pos.y, &ps->cursectnum);
P_UpdateScreenPal(ps); P_UpdateScreenPal(ps);
for (int SPRITES_OF(STAT_ACTOR, k)) for (bssize_t SPRITES_OF(STAT_ACTOR, k))
if (sprite[k].picnum==CAMERA1) if (sprite[k].picnum==CAMERA1)
sprite[k].yvel = 0; sprite[k].yvel = 0;
} }
@ -190,7 +190,7 @@ SKIPWALLCHECK:
q = -ZOFFSET2 + (krand()&(ZOFFSET5-1)); 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]]; 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 sector changes due to transport SEs (SE7_PROJECTILE).
// PROJECTILE_CHSECT // PROJECTILE_CHSECT
for (int SPRITES_OF(STAT_TRANSPORT, otherSpriteNum)) for (bssize_t SPRITES_OF(STAT_TRANSPORT, otherSpriteNum))
{ {
if (sprite[otherSpriteNum].sectnum == newSectnum) 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) if (pSprite->picnum == COMMANDER)
gutZ -= (24<<8); 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, int const i = A_InsertSprite(pSprite->sectnum, pSprite->x + (krand() & 255) - 128,
pSprite->y + (krand() & 255) - 128, gutZ - (krand() & 8191), tileNum, -32, repeat.x, 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) if (s->picnum == COMMANDER)
gutZ -= (24<<8); 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, 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); 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) 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); G_ToggleWallInterpolation(j, setInterpolation);
@ -753,7 +753,7 @@ void A_MoveSector(int spriteNum)
int const endWall = sector[pSprite->sectnum].wallptr + sector[pSprite->sectnum].wallnum; 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 const origin = g_origins[originIdx];
vec2_t result; vec2_t result;
@ -857,7 +857,7 @@ ACTOR_STATIC void A_MaybeAwakenBadGuys(int spriteNum)
{ {
uspritetype *const pSprite = (uspritetype *)&sprite[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])) if (A_CheckEnemySprite(&sprite[spriteNum]))
{ {
@ -998,7 +998,7 @@ ACTOR_STATIC void G_MoveZombieActors(void)
// stupid name, but it's what the function does. // stupid name, but it's what the function does.
FORCE_INLINE int G_FindExplosionInSector(int sectnum) 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)) if (PN(i) == EXPLOSION2 && sectnum == SECT(i))
return i; return i;
@ -1089,7 +1089,7 @@ int32_t A_IncurDamage(int32_t spriteNum)
void A_MoveCyclers(void) 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]; int16_t *const pCycler = cyclers[i];
const int32_t sectNum = pCycler[0]; const int32_t sectNum = pCycler[0];
@ -1108,7 +1108,7 @@ void A_MoveCyclers(void)
{ {
walltype *pWall = &wall[sector[sectNum].wallptr]; 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) if (pWall->hitag != 1)
{ {
@ -1491,7 +1491,7 @@ ACTOR_STATIC void G_MoveFallers(void)
{ {
T1(spriteNum) = 1; T1(spriteNum) = 1;
for (int SPRITES_OF(STAT_FALLER, j)) for (bssize_t SPRITES_OF(STAT_FALLER, j))
{ {
if (sprite[j].hitag == SHT(spriteNum)) if (sprite[j].hitag == SHT(spriteNum))
{ {
@ -2264,7 +2264,7 @@ DETONATE:
sprite[spriteNum].yvel = 0; // VIEWSCREEN_YVEL sprite[spriteNum].yvel = 0; // VIEWSCREEN_YVEL
T1(spriteNum) = 0; 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); int j = 3+(krand()&3);
ps->numloogs = j; ps->numloogs = j;
ps->loogcnt = 24*4; 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->loogiex[x] = krand()%xdim;
ps->loogiey[x] = krand()%ydim; ps->loogiey[x] = krand()%ydim;
@ -2753,7 +2753,7 @@ ACTOR_STATIC void Proj_MoveCustom(int spriteNum)
if (pProj->trail >= 0) 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); 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); A_Spawn(j, WATERSPLASH2);
if (sectlotag == ST_1_ABOVE_WATER) 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; 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) 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)) if ((sn == -1 || sn == SECT(i)) && n == SLT(i))
return i; return i;
@ -5043,7 +5043,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
pSprite->yrepeat = l; pSprite->yrepeat = l;
pSprite->shade = (l >> 1) - 48; 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; goto next_sprite;
} }
@ -5146,7 +5146,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
A_AddToDeleteQueue(spriteNum); A_AddToDeleteQueue(spriteNum);
PN(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) 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 // KEEPINSYNC1
if (sprite[p].statnum != STAT_EFFECTOR && sprite[p].statnum != STAT_PROJECTILE) 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)) else if (l==0 && (pSector->floorstat&64))
{ {
// fix for jittering of sprites in halted rotating sectors // 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 // KEEPINSYNC1
if (sprite[p].statnum != STAT_EFFECTOR && sprite[p].statnum != STAT_PROJECTILE) if (sprite[p].statnum != STAT_EFFECTOR && sprite[p].statnum != STAT_PROJECTILE)
@ -8216,7 +8216,7 @@ int32_t A_CheckSwitchTile(int32_t i)
return 1; return 1;
// Loop to catch both states of switches. // 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)) switch (DYNAMICTILEMAP(PN(i)-j))
{ {

View file

@ -282,7 +282,7 @@ int32_t AndroidRead(portableread_t r)
rv = g_player[myconnectindex].ps->dead_flag; break; rv = g_player[myconnectindex].ps->dead_flag; break;
case R_PLAYER_INV_AMOUNT: case R_PLAYER_INV_AMOUNT:
rv = 0; 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]) if (g_player[myconnectindex].ps->inv_amount[i])
rv += (1 << i); rv += (1 << i);

View file

@ -281,7 +281,7 @@ void G_DoCheats(void)
for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++) for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++)
{ {
for (int j = 0; j<cheatbuflen; j++) for (bssize_t j = 0; j<cheatbuflen; j++)
{ {
if (cheatbuf[j] == CheatStrings[cheatNum][j] || (CheatStrings[cheatNum][j] == '#' && ch >= '0' && ch <= '9')) if (cheatbuf[j] == CheatStrings[cheatNum][j] || (CheatStrings[cheatNum][j] == '#' && ch >= '0' && ch <= '9'))
{ {
@ -308,7 +308,7 @@ void G_DoCheats(void)
{ {
int const weaponLimit = (VOLUMEONE) ? 6 : 0; 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]); P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]);
pPlayer->gotweapon |= (1<<weaponNum); pPlayer->gotweapon |= (1<<weaponNum);
@ -399,10 +399,10 @@ void G_DoCheats(void)
P_DoQuote(QUOTE_RESERVED4, pPlayer); P_DoQuote(QUOTE_RESERVED4, pPlayer);
G_CheatGetInv(pPlayer); G_CheatGetInv(pPlayer);
for (int weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++) for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++)
pPlayer->gotweapon |= (1<<weaponNum); pPlayer->gotweapon |= (1<<weaponNum);
for (int weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++) for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++)
P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]); P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]);
pPlayer->got_access = 7; pPlayer->got_access = 7;
@ -430,10 +430,10 @@ void G_DoCheats(void)
{ {
int const weaponLimit = (VOLUMEONE) ? 6 : 0; 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<<weaponNum); pPlayer->gotweapon |= (1<<weaponNum);
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]); P_AddAmmo(pPlayer, weaponNum, pPlayer->max_ammo_amount[weaponNum]);
G_CheatGetInv(pPlayer); G_CheatGetInv(pPlayer);

View file

@ -203,8 +203,8 @@ void G_InitMultiPsky(int32_t const CLOUDYOCEAN__DYN, int32_t const MOONSKY1__DYN
#if 0 #if 0
// This assertion should hold. See note above. // This assertion should hold. See note above.
for (int i=0; i<pskynummultis; ++i) for (bssize_t i=0; i<pskynummultis; ++i)
for (int j=0; j<(1<<multipsky[i].lognumtiles); ++j) for (bssize_t j=0; j<(1<<multipsky[i].lognumtiles); ++j)
Bassert(multipsky[i].tileofs[j] <= PSKYOFF_MAX); Bassert(multipsky[i].tileofs[j] <= PSKYOFF_MAX);
#endif #endif
} }
@ -1020,7 +1020,7 @@ void G_LoadLookups(void)
if (kread_and_test(fp, paldata, 768)) if (kread_and_test(fp, paldata, 768))
return kclose(fp); return kclose(fp);
for (int k = 0; k < 768; k++) for (bssize_t k = 0; k < 768; k++)
paldata[k] <<= 2; paldata[k] <<= 2;
setbasepal(basepalnum, paldata); setbasepal(basepalnum, paldata);

View file

@ -565,7 +565,7 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i
int32_t i = 0, dst = INT32_MAX; int32_t i = 0, dst = INT32_MAX;
for (int32_t k=g_mirrorCount-1; k>=0; k--) for (bssize_t k=g_mirrorCount-1; k>=0; k--)
{ {
const int32_t j = const int32_t j =
klabs(wall[g_mirrorWall[k]].x - x) + 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 startwall = sector[g_mirrorSector[i]].wallptr;
int32_t endwall = startwall + sector[g_mirrorSector[i]].wallnum; int32_t endwall = startwall + sector[g_mirrorSector[i]].wallnum;
for (int32_t k=startwall; k<endwall; k++) for (bssize_t k=startwall; k<endwall; k++)
{ {
int32_t j = wall[k].nextwall; int32_t j = wall[k].nextwall;
if (j >= 0 && (wall[j].cstat&32) && wall[j].overpicnum==MIRROR) // cmp. premap.c if (j >= 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 //Block off unscreen section of 90ø tilted screen
int const j = tiltcx-(60*tiltcs); 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] = 1;
startumost[i+j] = 1; startumost[i+j] = 1;
@ -2897,7 +2897,7 @@ int A_Spawn(int spriteNum, int tileNum)
{ {
int const startwall = sector[sectNum].wallptr; int const startwall = sector[sectNum].wallptr;
int const endwall = startwall + sector[sectNum].wallnum; 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; 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 startWall = sector[sectNum].wallptr;
int const endWall = startWall + sector[sectNum].wallnum; int const endWall = startWall + sector[sectNum].wallnum;
for (int findWall=startWall; findWall<endWall; findWall++) for (bssize_t findWall=startWall; findWall<endWall; findWall++)
{ {
int const x = wall[findWall].x; int const x = wall[findWall].x;
int const y = wall[findWall].y; int const y = wall[findWall].y;
@ -2983,7 +2983,7 @@ int A_Spawn(int spriteNum, int tileNum)
closestDist = INT32_MAX; closestDist = INT32_MAX;
for (int findWall=startWall; findWall<endWall; findWall++) for (bssize_t findWall=startWall; findWall<endWall; findWall++)
{ {
int const x = wall[findWall].x; int const x = wall[findWall].x;
int const y = wall[findWall].y; int const y = wall[findWall].y;
@ -3017,7 +3017,7 @@ int A_Spawn(int spriteNum, int tileNum)
int const startWall = sector[sectNum].wallptr; int const startWall = sector[sectNum].wallptr;
int const endWall = startWall+sector[sectNum].wallnum; 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 & 1)) if (!(wall[w].hitag & 1))
wall[w].shade = pSprite->shade; wall[w].shade = pSprite->shade;
@ -3041,7 +3041,7 @@ int A_Spawn(int spriteNum, int tileNum)
int const startWall = sector[sectNum].wallptr; int const startWall = sector[sectNum].wallptr;
int const endWall = startWall + sector[sectNum].wallnum; 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) if (wall[w].hitag == 0)
wall[w].hitag = 9999; wall[w].hitag = 9999;
@ -3064,7 +3064,7 @@ int A_Spawn(int spriteNum, int tileNum)
int const startWall = sector[sectNum].wallptr; int const startWall = sector[sectNum].wallptr;
int const endWall = startWall + sector[sectNum].wallnum; 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) if (wall[w].hitag == 0)
wall[w].hitag = 9999; 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].ceilingpal << 8;
pSprite->owner |= sector[sectNum].floorpal; 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)) if (wall[w].shade > T4(newSprite))
T4(newSprite) = wall[w].shade; T4(newSprite) = wall[w].shade;
} }
@ -3102,7 +3102,7 @@ int A_Spawn(int spriteNum, int tileNum)
int const startWall = sector[sectNum].wallptr; int const startWall = sector[sectNum].wallptr;
int const endWall = startWall + sector[sectNum].wallnum; 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)) if (wall[w].shade > T3(newSprite))
T3(newSprite) = wall[w].shade; T3(newSprite) = wall[w].shade;
@ -3161,7 +3161,7 @@ int A_Spawn(int spriteNum, int tileNum)
int const endWall = startWall+sector[sectNum].wallnum; int const endWall = startWall+sector[sectNum].wallnum;
T2(newSprite) = tempwallptr; 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].x = wall[w].x - pSprite->x;
g_origins[tempwallptr].y = wall[w].y - pSprite->y; g_origins[tempwallptr].y = wall[w].y - pSprite->y;
@ -4616,7 +4616,7 @@ void G_HandleLocalKeys(void)
int ridiculeNum = 0; int ridiculeNum = 0;
// NOTE: sc_F1 .. sc_F10 are contiguous. sc_F11 is not sc_F10+1. // 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)) if (KB_UnBoundKeyPressed(j))
{ {
KB_ClearKeyDown(j); KB_ClearKeyDown(j);
@ -5411,7 +5411,7 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass)
if (pScript) if (pScript)
parsedefinitions_game(pScript, firstPass); 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); parsedefinitions_game_include(g_defModules[i], NULL, "null", firstPass);
if (pScript) if (pScript)
@ -5620,19 +5620,19 @@ static void A_InitEnemyFlags(void)
int NoWaterDipEnemies[] = { OCTABRAIN, COMMANDER, DRONE }; int NoWaterDipEnemies[] = { OCTABRAIN, COMMANDER, DRONE };
int GreenSlimeFoodEnemies[] = { LIZTROOP, LIZMAN, PIGCOP, NEWBEAST }; 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); 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); 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); 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); 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); SETFLAG(GreenSlimeFoodEnemies[i], SFLAG_GREENSLIMEFOOD);
} }
#undef SETFLAG #undef SETFLAG
@ -6120,7 +6120,7 @@ int app_main(int argc, char const * const * argv)
// used with binds for fast function lookup // used with binds for fast function lookup
hash_init(&h_gamefuncs); 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])); char *str = Bstrtolower(Xstrdup(gamefunctions[i]));
hash_add(&h_gamefuncs,gamefunctions[i],i,0); hash_add(&h_gamefuncs,gamefunctions[i],i,0);
@ -6246,11 +6246,11 @@ int app_main(int argc, char const * const * argv)
} }
else else
{ {
for (int i=0; i<ud.multimode-1; i++) for (bssize_t i=0; i<ud.multimode-1; i++)
connectpoint2[i] = i+1; connectpoint2[i] = i+1;
connectpoint2[ud.multimode-1] = -1; connectpoint2[ud.multimode-1] = -1;
for (int i=1; i<ud.multimode; i++) for (bssize_t i=1; i<ud.multimode; i++)
g_player[i].playerquitflag = 1; g_player[i].playerquitflag = 1;
} }
@ -6258,7 +6258,7 @@ int app_main(int argc, char const * const * argv)
// NOTE: Allocating the DukePlayer_t structs has to be before compiling scripts, // NOTE: Allocating the DukePlayer_t structs has to be before compiling scripts,
// because in Lunatic, the {pipe,trip}bomb* members are initialized. // because in Lunatic, the {pipe,trip}bomb* members are initialized.
for (int i=0; i<MAXPLAYERS; i++) for (bssize_t i=0; i<MAXPLAYERS; i++)
G_MaybeAllocPlayer(i); G_MaybeAllocPlayer(i);
G_Startup(); // a bunch of stuff including compiling cons G_Startup(); // a bunch of stuff including compiling cons
@ -6267,9 +6267,9 @@ int app_main(int argc, char const * const * argv)
g_player[myconnectindex].ps->palette = BASEPAL; g_player[myconnectindex].ps->palette = BASEPAL;
for (int i=1, j=numplayers; j<ud.multimode; j++) for (bssize_t i=1, j=numplayers; j<ud.multimode; j++)
{ {
Bsprintf(g_player[j].user_name,"PLAYER %d",j+1); Bsprintf(g_player[j].user_name,"PLAYER %zd",j+1);
g_player[j].ps->team = g_player[j].pteam = i; g_player[j].ps->team = g_player[j].pteam = i;
g_player[j].ps->weaponswitch = 3; g_player[j].ps->weaponswitch = 3;
g_player[j].ps->auto_aim = 0; g_player[j].ps->auto_aim = 0;
@ -6289,7 +6289,7 @@ int app_main(int argc, char const * const * argv)
loaddefinitions_game(defsfile, FALSE); 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]); Bfree(g_defModules[i]);
DO_FREE_AND_NULL(g_defModules); DO_FREE_AND_NULL(g_defModules);
g_defModulesNum = 0; g_defModulesNum = 0;
@ -6366,7 +6366,7 @@ int app_main(int argc, char const * const * argv)
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent); CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (int i=0; i<joynumaxes; i++) for (bssize_t i=0; i<joynumaxes; i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]); setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
} }
@ -6375,7 +6375,7 @@ int app_main(int argc, char const * const * argv)
if (clipMapError > 0) if (clipMapError > 0)
initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError); 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]); Bfree(g_clipMapFiles[i]);
DO_FREE_AND_NULL(g_clipMapFiles); DO_FREE_AND_NULL(g_clipMapFiles);
g_clipMapFilesNum = 0; 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) // check if the minifont will support lowercase letters (3136-3161)
// there is room for them in tiles012.art between "[\]^_." and "{|}~" // there is room for them in tiles012.art between "[\]^_." and "{|}~"
minitext_lowercase = 1; 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); minitext_lowercase &= tile_exists(i);
system_getcvars(); system_getcvars();
@ -6489,7 +6489,7 @@ MAIN_LOOP_RESTART:
ud.m_respawn_monsters = 1; ud.m_respawn_monsters = 1;
else ud.m_respawn_monsters = 0; else ud.m_respawn_monsters = 0;
for (int TRAVERSE_CONNECT(i)) for (bssize_t TRAVERSE_CONNECT(i))
{ {
P_ResetWeapons(i); P_ResetWeapons(i);
P_ResetInventory(i); P_ResetInventory(i);
@ -6716,14 +6716,15 @@ int G_DoMoveThings(void)
if (g_RTSPlaying > 0) if (g_RTSPlaying > 0)
g_RTSPlaying--; g_RTSPlaying--;
for (int i=0; i<MAXUSERQUOTES; i++) for (bssize_t i=0; i<MAXUSERQUOTES; i++)
{
if (user_quote_time[i]) if (user_quote_time[i])
{ {
user_quote_time[i]--; if (--user_quote_time[i] > ud.msgdisptime)
if (user_quote_time[i] > ud.msgdisptime)
user_quote_time[i] = ud.msgdisptime; user_quote_time[i] = ud.msgdisptime;
if (!user_quote_time[i]) pub = NUMPAGES; if (!user_quote_time[i]) pub = NUMPAGES;
} }
}
// Name display when aiming at opponents // Name display when aiming at opponents
if (ud.idplayers && (g_netServer || ud.multimode > 1) if (ud.idplayers && (g_netServer || ud.multimode > 1)
@ -6735,14 +6736,14 @@ int G_DoMoveThings(void)
hitdata_t hitData; hitdata_t hitData;
DukePlayer_t *const pPlayer = g_player[screenpeek].ps; 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) if (g_player[i].ps->holoduke_on != -1)
sprite[g_player[i].ps->holoduke_on].cstat ^= 256; sprite[g_player[i].ps->holoduke_on].cstat ^= 256;
hitscan((vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(pPlayer->ang + 512) & 2047], sintable[pPlayer->ang & 2047], hitscan((vec3_t *)pPlayer, pPlayer->cursectnum, sintable[(pPlayer->ang + 512) & 2047], sintable[pPlayer->ang & 2047],
(100 - pPlayer->horiz - pPlayer->horizoff) << 11, &hitData, 0xffff0030); (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) if (g_player[i].ps->holoduke_on != -1)
sprite[g_player[i].ps->holoduke_on].cstat ^= 256; sprite[g_player[i].ps->holoduke_on].cstat ^= 256;
@ -6782,7 +6783,7 @@ int G_DoMoveThings(void)
if (g_netServer || g_netClient) if (g_netServer || g_netClient)
randomseed = ticrandomseed; 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)); Bmemcpy(g_player[i].inputBits, &inputfifo[(g_netServer && myconnectindex == i)][i], sizeof(input_t));
G_UpdateInterpolations(); G_UpdateInterpolations();
@ -6816,7 +6817,7 @@ int G_DoMoveThings(void)
A_MoveDummyPlayers();//ST 13 A_MoveDummyPlayers();//ST 13
} }
for (int TRAVERSE_CONNECT(i)) for (bssize_t TRAVERSE_CONNECT(i))
{ {
if (g_player[i].inputBits->extbits&(1<<6)) if (g_player[i].inputBits->extbits&(1<<6))
{ {
@ -6871,7 +6872,7 @@ void A_SpawnWallGlass(int spriteNum,int wallNum,int glassCnt)
{ {
if (wallNum < 0) 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; 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, A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum), GLASSPIECES + (j % 3), -32, 36, 36, a,

View file

@ -502,7 +502,7 @@ static inline int G_GetViewscreenSizeShift(const uspritetype *tspr)
static const int mask = (1<<VIEWSCREENFACTOR)-1; static const int mask = (1<<VIEWSCREENFACTOR)-1;
const int rem = (tspr->xrepeat & mask) | (tspr->yrepeat & mask); const int rem = (tspr->xrepeat & mask) | (tspr->yrepeat & mask);
for (int i=0; i < VIEWSCREENFACTOR; i++) for (bssize_t i=0; i < VIEWSCREENFACTOR; i++)
if (rem & (1<<i)) if (rem & (1<<i))
return i; return i;

View file

@ -2137,7 +2137,7 @@ static inline uint32_t C_Pow2IntLogBase2(int32_t const v)
register uint32_t r = (v & b[0]) != 0; register uint32_t r = (v & b[0]) != 0;
for (int i = 4; i > 0; i--) for (bssize_t i = 4; i > 0; i--)
r |= ((v & b[i]) != 0) << i; r |= ((v & b[i]) != 0) << i;
return r; return r;
@ -2454,13 +2454,13 @@ void C_UndefineVolume(int32_t vol)
{ {
Bassert((unsigned)vol < MAXVOLUMES); Bassert((unsigned)vol < MAXVOLUMES);
for (int32_t i = 0; i < MAXLEVELS; i++) for (bssize_t i = 0; i < MAXLEVELS; i++)
C_UndefineLevel(vol, i); C_UndefineLevel(vol, i);
EpisodeNames[vol][0] = '\0'; EpisodeNames[vol][0] = '\0';
g_numVolumes = 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]) if (EpisodeNames[i][0])
{ {
@ -2477,7 +2477,7 @@ void C_UndefineSkill(int32_t skill)
SkillNames[skill][0] = '\0'; SkillNames[skill][0] = '\0';
g_numSkills = 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]) 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); 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) if (Bstrncmp(&apStrings[q][i], query, querylength) == 0)
{ {
Bmemset(tempbuf, 0, sizeof(tempbuf)); 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) 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 #ifdef EDUKE32_TOUCH_DEVICES
apStrings[QUOTE_DEAD] = 0; apStrings[QUOTE_DEAD] = 0;
@ -2722,14 +2722,14 @@ void C_InitQuotes(void)
EDUKE32_STATIC_ASSERT(SUICIDEQUOTEINDEX + ARRAY_SIZE(PlayerSelfObituaries)-1 < MAXQUOTES); EDUKE32_STATIC_ASSERT(SUICIDEQUOTEINDEX + ARRAY_SIZE(PlayerSelfObituaries)-1 < MAXQUOTES);
g_numObituaries = ARRAY_SIZE(PlayerObituaries); 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)) if (C_AllocQuote(i + OBITQUOTEINDEX))
Bstrcpy(apStrings[i + OBITQUOTEINDEX], PlayerObituaries[i]); Bstrcpy(apStrings[i + OBITQUOTEINDEX], PlayerObituaries[i]);
} }
g_numSelfObituaries = ARRAY_SIZE(PlayerSelfObituaries); 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)) if (C_AllocQuote(i + SUICIDEQUOTEINDEX))
Bstrcpy(apStrings[i + SUICIDEQUOTEINDEX], PlayerSelfObituaries[i]); Bstrcpy(apStrings[i + SUICIDEQUOTEINDEX], PlayerSelfObituaries[i]);
@ -6191,7 +6191,7 @@ void C_InitProjectiles(void)
DefaultProjectile = Projectile; DefaultProjectile = Projectile;
for (int i=MAXTILES-1; i>=0; i--) for (bssize_t i=MAXTILES-1; i>=0; i--)
{ {
if (g_tile[i].proj) if (g_tile[i].proj)
*g_tile[i].proj = DefaultProjectile; *g_tile[i].proj = DefaultProjectile;

View file

@ -301,7 +301,7 @@ int32_t A_Dodge(spritetype *pSprite)
if (A_CheckEnemySprite(pSprite) && pSprite->extra <= 0) // hack if (A_CheckEnemySprite(pSprite) && pSprite->extra <= 0) // hack
return 0; 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) if (OW(i) == i)
continue; continue;
@ -334,7 +334,7 @@ int32_t A_GetFurthestAngle(int spriteNum, int angDiv)
int const angincs = tabledivide32_noinline(2048, angDiv); int const angincs = tabledivide32_noinline(2048, angDiv);
hitdata_t hit; 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; pSprite->z -= ZOFFSET3;
hitscan((const vec3_t *)pSprite, pSprite->sectnum, 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; int const angincs = 128;
// ((!g_netServer && ud.multimode < 2) && ud.player_skill < 3) ? 2048 / 2 : tabledivide32_noinline(2048, 1 + (krand() & 1)); // ((!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; pSprite->z -= ZOFFSET2;
hitscan((const vec3_t *)pSprite, pSprite->sectnum, sintable[(j + 512) & 2047], sintable[j & 2047], 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 new_wchoice = -1;
int curr_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]; int w = g_player[playerNum].wchoice[i];
@ -3290,7 +3290,7 @@ nullquote:
int32_t values[8]; int32_t values[8];
G_GetTimeDate(values); G_GetTimeDate(values);
for (int i = 0; i < 8; i++) for (bssize_t i = 0; i < 8; i++)
Gv_SetVarX(*insptr++, values[i]); Gv_SetVarX(*insptr++, values[i]);
continue; continue;
@ -3424,7 +3424,7 @@ nullquote:
int debrisTile = *insptr++; int debrisTile = *insptr++;
if ((unsigned)vm.pSprite->sectnum < MAXSECTORS) 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); 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].pValues = (intptr_t *)Xaligned_alloc(ACTOR_VAR_ALIGNMENT, numElements * GAR_ELTSZ);
aGameArrays[arrayNum].size = numElements; aGameArrays[arrayNum].size = numElements;
#ifdef BITNESS64 #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 aGameArrays[arrayNum].pValues[i] = pArray[i]; // int32_t --> int64_t
Bfree(pArray); Bfree(pArray);
#else #else
@ -4677,7 +4677,7 @@ finish_qsprintf:
int const arraySize = aGameArrays[arrayNum].size; int const arraySize = aGameArrays[arrayNum].size;
int *const pArray = (int32_t *)Xmalloc(sizeof(int32_t) * arraySize); 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); pArray[k] = Gv_GetGameArrayValue(arrayNum, k);
fwrite(pArray, 1, sizeof(int32_t) * arraySize, fil); fwrite(pArray, 1, sizeof(int32_t) * arraySize, fil);
@ -5332,7 +5332,7 @@ finish_qsprintf:
switch (iterType) switch (iterType)
{ {
case ITER_ALLSPRITES: case ITER_ALLSPRITES:
for (int jj=0; jj<MAXSPRITES; ++jj) for (bssize_t jj=0; jj<MAXSPRITES; ++jj)
{ {
if (sprite[jj].statnum == MAXSTATUS) if (sprite[jj].statnum == MAXSTATUS)
continue; continue;
@ -5343,7 +5343,7 @@ finish_qsprintf:
} }
break; break;
case ITER_ALLSECTORS: case ITER_ALLSECTORS:
for (int jj=0; jj<numsectors; ++jj) for (bssize_t jj=0; jj<numsectors; ++jj)
{ {
Gv_SetVarX(returnVar, jj); Gv_SetVarX(returnVar, jj);
insptr = pNext; insptr = pNext;
@ -5351,7 +5351,7 @@ finish_qsprintf:
} }
break; break;
case ITER_ALLWALLS: case ITER_ALLWALLS:
for (int jj=0; jj<numwalls; ++jj) for (bssize_t jj=0; jj<numwalls; ++jj)
{ {
Gv_SetVarX(returnVar, jj); Gv_SetVarX(returnVar, jj);
insptr = pNext; insptr = pNext;
@ -5360,7 +5360,7 @@ finish_qsprintf:
break; break;
case ITER_ACTIVELIGHTS: case ITER_ACTIVELIGHTS:
#ifdef POLYMER #ifdef POLYMER
for (int jj=0; jj<PR_MAXLIGHTS; ++jj) for (bssize_t jj=0; jj<PR_MAXLIGHTS; ++jj)
{ {
if (!prlights[jj].flags.active) if (!prlights[jj].flags.active)
continue; continue;
@ -5384,7 +5384,7 @@ finish_qsprintf:
Bmemcpy(&lastSpriteBackup, lastSpritePtr, sizeof(uspritetype)); Bmemcpy(&lastSpriteBackup, lastSpritePtr, sizeof(uspritetype));
*/ */
for (int ii=0; ii<spritesortcnt; ii++) for (bssize_t ii=0; ii<spritesortcnt; ii++)
{ {
/* /*
Bmemcpy(lastSpritePtr, &tsprite[ii], sizeof(uspritetype)); Bmemcpy(lastSpritePtr, &tsprite[ii], sizeof(uspritetype));
@ -5408,7 +5408,7 @@ finish_qsprintf:
case ITER_SPRITESOFSECTOR: case ITER_SPRITESOFSECTOR:
if ((unsigned)nIndex >= MAXSECTORS) goto badindex; if ((unsigned)nIndex >= 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); Gv_SetVarX(returnVar, jj);
insptr = pNext; insptr = pNext;
@ -5417,7 +5417,7 @@ finish_qsprintf:
break; break;
case ITER_SPRITESOFSTATUS: case ITER_SPRITESOFSTATUS:
if ((unsigned) nIndex >= MAXSTATUS) goto badindex; 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); Gv_SetVarX(returnVar, jj);
insptr = pNext; insptr = pNext;
@ -5426,7 +5426,7 @@ finish_qsprintf:
break; break;
case ITER_WALLSOFSECTOR: case ITER_WALLSOFSECTOR:
if ((unsigned) nIndex >= MAXSECTORS) goto badindex; 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++) jj<=endwall; jj++)
{ {
Gv_SetVarX(returnVar, jj); Gv_SetVarX(returnVar, jj);
@ -5448,7 +5448,7 @@ finish_qsprintf:
} }
break; break;
case ITER_RANGE: case ITER_RANGE:
for (int jj=0; jj<nIndex; jj++) for (bssize_t jj=0; jj<nIndex; jj++)
{ {
Gv_SetVarX(returnVar, jj); Gv_SetVarX(returnVar, jj);
insptr = pNext; insptr = pNext;
@ -5999,7 +5999,7 @@ void G_SaveMapState(void)
Bmemcpy(&save->g_globalRandom,&g_globalRandom,sizeof(g_globalRandom)); Bmemcpy(&save->g_globalRandom,&g_globalRandom,sizeof(g_globalRandom));
#if !defined LUNATIC #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_NORESET) continue;
if (aGameVars[i].flags & GAMEVAR_PERPLAYER) if (aGameVars[i].flags & GAMEVAR_PERPLAYER)
@ -6043,7 +6043,7 @@ void G_RestoreMapState(void)
{ {
int playerHealth[MAXPLAYERS]; int playerHealth[MAXPLAYERS];
for (int i=0; i<playerswhenstarted; i++) for (bssize_t i=0; i<playerswhenstarted; i++)
playerHealth[i] = sprite[g_player[i].ps->i].extra; playerHealth[i] = sprite[g_player[i].ps->i].extra;
pub = NUMPAGES; pub = NUMPAGES;
@ -6063,7 +6063,7 @@ void G_RestoreMapState(void)
if (g_currentEventExec == EVENT_ANIMATESPRITES) if (g_currentEventExec == EVENT_ANIMATESPRITES)
{ {
initprintf("Line %d: loadmapstate called from EVENT_ANIMATESPRITES. WHY?\n",g_errorLineNum); initprintf("Line %d: loadmapstate called from EVENT_ANIMATESPRITES. WHY?\n",g_errorLineNum);
for (int i=0; i<MAXSPRITES; i++) for (bssize_t i=0; i<MAXSPRITES; i++)
spriteext[i].tspr = NULL; spriteext[i].tspr = NULL;
} }
#endif #endif
@ -6115,7 +6115,7 @@ void G_RestoreMapState(void)
Bmemcpy(&randomseed,&pSavedState->randomseed,sizeof(randomseed)); Bmemcpy(&randomseed,&pSavedState->randomseed,sizeof(randomseed));
Bmemcpy(&g_globalRandom,&pSavedState->g_globalRandom,sizeof(g_globalRandom)); Bmemcpy(&g_globalRandom,&pSavedState->g_globalRandom,sizeof(g_globalRandom));
#if !defined LUNATIC #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_NORESET) continue;
if (aGameVars[i].flags & GAMEVAR_PERPLAYER) if (aGameVars[i].flags & GAMEVAR_PERPLAYER)
@ -6144,14 +6144,14 @@ void G_RestoreMapState(void)
// - walk forward (to door leading to other level "Shadowpine Forest") // - walk forward (to door leading to other level "Shadowpine Forest")
// - in new level, walk backward to get back to the Spider Den // - in new level, walk backward to get back to the Spider Den
// - walk backward to the door leading to Shadowpine Forest --> crash. // - 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); int32_t snum = P_Get(i);
Bassert((unsigned)snum < MAXPLAYERS); Bassert((unsigned)snum < MAXPLAYERS);
g_player[snum].ps->i = i; g_player[snum].ps->i = i;
} }
for (int i=0; i<playerswhenstarted; i++) for (bssize_t i=0; i<playerswhenstarted; i++)
sprite[g_player[i].ps->i].extra = playerHealth[i]; sprite[g_player[i].ps->i].extra = playerHealth[i];
if (g_player[myconnectindex].ps->over_shoulder_on != 0) if (g_player[myconnectindex].ps->over_shoulder_on != 0)
@ -6165,7 +6165,7 @@ void G_RestoreMapState(void)
if (ud.lockout) 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)) switch (DYNAMICTILEMAP(wall[animwall[x].wallnum].picnum))
{ {
case FEMPIC1__STATIC: case FEMPIC1__STATIC:
@ -6180,7 +6180,7 @@ void G_RestoreMapState(void)
#if 0 #if 0
else 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) if (wall[animwall[x].wallnum].extra >= 0)
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
} }

View file

@ -64,7 +64,7 @@ intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Muzzle flash color
// Returns: old g_gameVarCount | (g_gameArrayCount<<16). // Returns: old g_gameVarCount | (g_gameArrayCount<<16).
static int Gv_Free(void) static int Gv_Free(void)
{ {
for (int i=0; i<g_gameVarCount; ++i) for (bssize_t i=0; i<g_gameVarCount; ++i)
{ {
if (aGameVars[i].flags & GAMEVAR_USER_MASK) if (aGameVars[i].flags & GAMEVAR_USER_MASK)
ALIGNED_FREE_AND_NULL(aGameVars[i].pValues); ALIGNED_FREE_AND_NULL(aGameVars[i].pValues);
@ -72,7 +72,7 @@ static int Gv_Free(void)
aGameVars[i].flags |= GAMEVAR_RESET; aGameVars[i].flags |= GAMEVAR_RESET;
} }
for (int i=0; i<g_gameArrayCount; ++i) for (bssize_t i=0; i<g_gameArrayCount; ++i)
{ {
if (aGameArrays[i].flags & GAMEARRAY_NORMAL) if (aGameArrays[i].flags & GAMEARRAY_NORMAL)
ALIGNED_FREE_AND_NULL(aGameArrays[i].pValues); ALIGNED_FREE_AND_NULL(aGameArrays[i].pValues);
@ -100,10 +100,10 @@ static void Gv_Clear(void)
gameVarCount &= 65535; gameVarCount &= 65535;
// Now, only do work that Gv_Free() hasn't done. // Now, only do work that Gv_Free() hasn't done.
for (int i=0; i<gameVarCount; ++i) for (bssize_t i=0; i<gameVarCount; ++i)
DO_FREE_AND_NULL(aGameVars[i].szLabel); DO_FREE_AND_NULL(aGameVars[i].szLabel);
for (int i=0; i<gameArrayCount; i++) for (bssize_t i=0; i<gameArrayCount; i++)
DO_FREE_AND_NULL(aGameArrays[i].szLabel); DO_FREE_AND_NULL(aGameArrays[i].szLabel);
} }
@ -125,7 +125,7 @@ int Gv_ReadSave(int32_t kFile)
// AddLog(g_szBuf); // AddLog(g_szBuf);
if (kdfread(&g_gameVarCount,sizeof(g_gameVarCount),1,kFile) != 1) goto corrupt; if (kdfread(&g_gameVarCount,sizeof(g_gameVarCount),1,kFile) != 1) goto corrupt;
for (int i=0; i<g_gameVarCount; i++) for (bssize_t i=0; i<g_gameVarCount; i++)
{ {
char *const olabel = aGameVars[i].szLabel; char *const olabel = aGameVars[i].szLabel;
@ -162,7 +162,7 @@ int Gv_ReadSave(int32_t kFile)
Gv_RefreshPointers(); Gv_RefreshPointers();
if (kdfread(&g_gameArrayCount,sizeof(g_gameArrayCount),1,kFile) != 1) goto corrupt; if (kdfread(&g_gameArrayCount,sizeof(g_gameArrayCount),1,kFile) != 1) goto corrupt;
for (int i=0; i<g_gameArrayCount; i++) for (bssize_t i=0; i<g_gameArrayCount; i++)
{ {
if (aGameArrays[i].flags&GAMEARRAY_READONLY) if (aGameArrays[i].flags&GAMEARRAY_READONLY)
continue; continue;
@ -201,14 +201,14 @@ int Gv_ReadSave(int32_t kFile)
if (kdfread(&savedstate[0],sizeof(savedstate),1,kFile) != 1) goto corrupt; if (kdfread(&savedstate[0],sizeof(savedstate),1,kFile) != 1) goto corrupt;
for (int i=0; i<(MAXVOLUMES*MAXLEVELS); i++) for (bssize_t i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
{ {
if (savedstate[i]) if (savedstate[i])
{ {
if (aMapInfo[i].savedstate == NULL) if (aMapInfo[i].savedstate == NULL)
aMapInfo[i].savedstate = (mapstate_t *)Xaligned_alloc(16, sizeof(mapstate_t)); aMapInfo[i].savedstate = (mapstate_t *)Xaligned_alloc(16, sizeof(mapstate_t));
if (kdfread(aMapInfo[i].savedstate,sizeof(mapstate_t),1,kFile) != sizeof(mapstate_t)) goto corrupt; if (kdfread(aMapInfo[i].savedstate,sizeof(mapstate_t),1,kFile) != sizeof(mapstate_t)) goto corrupt;
for (int j=0; j<g_gameVarCount; j++) for (bssize_t j=0; j<g_gameVarCount; j++)
{ {
if (aGameVars[j].flags & GAMEVAR_NORESET) continue; if (aGameVars[j].flags & GAMEVAR_NORESET) continue;
if (aGameVars[j].flags & GAMEVAR_PERPLAYER) if (aGameVars[j].flags & GAMEVAR_PERPLAYER)
@ -263,7 +263,7 @@ void Gv_WriteSave(FILE *fil)
dfwrite(&g_gameVarCount,sizeof(g_gameVarCount),1,fil); dfwrite(&g_gameVarCount,sizeof(g_gameVarCount),1,fil);
for (int i=0; i<g_gameVarCount; i++) for (bssize_t i=0; i<g_gameVarCount; i++)
{ {
dfwrite(&(aGameVars[i]),sizeof(gamevar_t),1,fil); dfwrite(&(aGameVars[i]),sizeof(gamevar_t),1,fil);
dfwrite(aGameVars[i].szLabel,sizeof(uint8_t) * MAXVARLABEL, 1, fil); dfwrite(aGameVars[i].szLabel,sizeof(uint8_t) * MAXVARLABEL, 1, fil);
@ -284,7 +284,7 @@ void Gv_WriteSave(FILE *fil)
dfwrite(&g_gameArrayCount,sizeof(g_gameArrayCount),1,fil); dfwrite(&g_gameArrayCount,sizeof(g_gameArrayCount),1,fil);
for (int i=0; i<g_gameArrayCount; i++) for (bssize_t i=0; i<g_gameArrayCount; i++)
{ {
if (aGameArrays[i].flags&GAMEARRAY_READONLY) if (aGameArrays[i].flags&GAMEARRAY_READONLY)
continue; continue;
@ -298,17 +298,17 @@ void Gv_WriteSave(FILE *fil)
dfwrite(apScriptEvents,sizeof(apScriptEvents),1,fil); dfwrite(apScriptEvents,sizeof(apScriptEvents),1,fil);
for (int i=0; i<(MAXVOLUMES*MAXLEVELS); i++) for (bssize_t i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
if (aMapInfo[i].savedstate != NULL) if (aMapInfo[i].savedstate != NULL)
savedstate[i] = 1; savedstate[i] = 1;
dfwrite(&savedstate[0],sizeof(savedstate),1,fil); dfwrite(&savedstate[0],sizeof(savedstate),1,fil);
for (int i=0; i<(MAXVOLUMES*MAXLEVELS); i++) for (bssize_t i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
if (aMapInfo[i].savedstate) if (aMapInfo[i].savedstate)
{ {
dfwrite(aMapInfo[i].savedstate,sizeof(mapstate_t),1,fil); dfwrite(aMapInfo[i].savedstate,sizeof(mapstate_t),1,fil);
for (int j=0; j<g_gameVarCount; j++) for (bssize_t j=0; j<g_gameVarCount; j++)
{ {
if (aGameVars[j].flags & GAMEVAR_NORESET) continue; if (aGameVars[j].flags & GAMEVAR_NORESET) continue;
if (aGameVars[j].flags & GAMEVAR_PERPLAYER) if (aGameVars[j].flags & GAMEVAR_PERPLAYER)
@ -329,7 +329,7 @@ void Gv_DumpValues(void)
{ {
OSD_Printf("// Current Game Definitions\n\n"); OSD_Printf("// Current Game Definitions\n\n");
for (int i=0; i<g_gameVarCount; i++) for (bssize_t i=0; i<g_gameVarCount; i++)
{ {
OSD_Printf("gamevar %s ",aGameVars[i].szLabel); OSD_Printf("gamevar %s ",aGameVars[i].szLabel);
@ -370,7 +370,7 @@ void Gv_ResetVars(void) /* this is called during a new game and nowhere else */
osd->log.errors = 0; osd->log.errors = 0;
for (int i=0; i<MAXGAMEVARS; i++) for (bssize_t i=0; i<MAXGAMEVARS; i++)
{ {
if (aGameVars[i].szLabel != NULL) if (aGameVars[i].szLabel != NULL)
Gv_NewVar(aGameVars[i].szLabel, Gv_NewVar(aGameVars[i].szLabel,
@ -378,7 +378,7 @@ void Gv_ResetVars(void) /* this is called during a new game and nowhere else */
aGameVars[i].flags); aGameVars[i].flags);
} }
for (int i=0; i<MAXGAMEARRAYS; i++) for (bssize_t i=0; i<MAXGAMEARRAYS; i++)
{ {
if (aGameArrays[i].szLabel != NULL && (aGameArrays[i].flags & GAMEARRAY_RESET)) if (aGameArrays[i].szLabel != NULL && (aGameArrays[i].flags & GAMEARRAY_RESET))
Gv_NewArray(aGameArrays[i].szLabel,aGameArrays[i].pValues,aGameArrays[i].size,aGameArrays[i].flags); Gv_NewArray(aGameArrays[i].szLabel,aGameArrays[i].pValues,aGameArrays[i].size,aGameArrays[i].flags);
@ -534,7 +534,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
aGameVars[gV].pValues = (intptr_t *) Xaligned_alloc(PLAYER_VAR_ALIGNMENT, MAXPLAYERS * sizeof(intptr_t)); aGameVars[gV].pValues = (intptr_t *) Xaligned_alloc(PLAYER_VAR_ALIGNMENT, MAXPLAYERS * sizeof(intptr_t));
Bmemset(aGameVars[gV].pValues, 0, MAXPLAYERS * sizeof(intptr_t)); Bmemset(aGameVars[gV].pValues, 0, MAXPLAYERS * sizeof(intptr_t));
} }
for (int j=MAXPLAYERS-1; j>=0; --j) for (bssize_t j=MAXPLAYERS-1; j>=0; --j)
aGameVars[gV].pValues[j]=lValue; aGameVars[gV].pValues[j]=lValue;
} }
else if (aGameVars[gV].flags & GAMEVAR_PERACTOR) 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)); aGameVars[gV].pValues = (intptr_t *) Xaligned_alloc(ACTOR_VAR_ALIGNMENT, MAXSPRITES * sizeof(intptr_t));
Bmemset(aGameVars[gV].pValues, 0, 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; aGameVars[gV].pValues[j]=lValue;
} }
else aGameVars[gV].global = lValue; else aGameVars[gV].global = lValue;
@ -1124,7 +1124,7 @@ perr:
void __fastcall Gv_GetManyVars(int const count, int32_t * const rv) 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++; int gameVar = *insptr++;
@ -1241,49 +1241,49 @@ void Gv_ResetSystemDefaults(void)
//AddLog("ResetWeaponDefaults"); //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); 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); 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); 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); 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); 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); 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); aplWeaponShoots[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
if ((unsigned)aplWeaponShoots[weaponNum][playerNum] >= MAXTILES) if ((unsigned)aplWeaponShoots[weaponNum][playerNum] >= MAXTILES)
aplWeaponShoots[weaponNum][playerNum] = 0; 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); aplWeaponFlashColor[weaponNum][playerNum] = Gv_GetVarByLabel(aszBuf, 0, -1, playerNum);
} }
} }
@ -1301,7 +1301,7 @@ void Gv_ResetSystemDefaults(void)
g_structVarIDs = Gv_GetVarIndex("sprite"); g_structVarIDs = Gv_GetVarIndex("sprite");
#endif #endif
for (int weaponNum = 0; weaponNum <= MAXTILES - 1; weaponNum++) for (bssize_t weaponNum = 0; weaponNum <= MAXTILES - 1; weaponNum++)
if (g_tile[weaponNum].defproj) if (g_tile[weaponNum].defproj)
*g_tile[weaponNum].proj = *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, PISTOL_WEAPON, 12, 27, 2, 5, 0,
/*(NAM_WW2GI?WEAPON_HOLSTER_CLEARS_CLIP:0) |*/ WEAPON_RELOAD_TIMING, WEAPON_RELOAD_TIMING,
SHOTSPARK1__STATIC, 2, SHELL__STATIC, 0, 0, PISTOL_FIRE__STATIC, 0, 0, SHOTSPARK1__STATIC, 2, SHELL__STATIC, 0, 0, PISTOL_FIRE__STATIC, 0, 0,
EJECT_CLIP__STATIC, INSERT_CLIP__STATIC, INSERT_CLIP__STATIC, 255+(95<<8) 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, WEAPON_GLOWS,
SHRINKER__STATIC, 0, 0, 0, SHRINKER_FIRE__STATIC, 0, 0, 0, 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) 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, 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) 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) } while (0)
#else #else
# define ADDWEAPONVAR(Weapidx, Membname) do { \ # define ADDWEAPONVAR(Weapidx, Membname) do { \
Bsprintf(aszBuf, "WEAPON%d_" #Membname, Weapidx); \ Bsprintf(aszBuf, "WEAPON%zd_" #Membname, Weapidx); \
Bstrupr(aszBuf); \ Bstrupr(aszBuf); \
Gv_NewVar(aszBuf, weapondefaults[Weapidx].Membname, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); \ Gv_NewVar(aszBuf, weapondefaults[Weapidx].Membname, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); \
} while (0) } 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. // We cannot do this before, because the dynamic maps are not yet set up then.
void Gv_FinalizeWeaponDefaults(void) void Gv_FinalizeWeaponDefaults(void)
{ {
for (int i=0; i<MAX_WEAPONS; i++) for (bssize_t i=0; i<MAX_WEAPONS; i++)
{ {
FINISH_WEAPON_DEFAULT_TILE(i, Shoots); FINISH_WEAPON_DEFAULT_TILE(i, Shoots);
FINISH_WEAPON_DEFAULT_TILE(i, Spawn); FINISH_WEAPON_DEFAULT_TILE(i, Spawn);
@ -1535,7 +1535,7 @@ static void Gv_AddSystemVars(void)
weapondefaults[GROW_WEAPON].FireSound = 0; weapondefaults[GROW_WEAPON].FireSound = 0;
} }
for (int i=0; i<MAX_WEAPONS; i++) for (bssize_t i=0; i<MAX_WEAPONS; i++)
{ {
ADDWEAPONVAR(i, WorksLike); ADDWEAPONVAR(i, WorksLike);
ADDWEAPONVAR(i, Clip); ADDWEAPONVAR(i, Clip);
@ -1558,7 +1558,7 @@ static void Gv_AddSystemVars(void)
ADDWEAPONVAR(i, FlashColor); ADDWEAPONVAR(i, FlashColor);
} }
#ifdef LUNATIC #ifdef LUNATIC
for (int i=0; i<MAXPLAYERS; i++) for (bssize_t i=0; i<MAXPLAYERS; i++)
{ {
DukePlayer_t *ps = g_player[i].ps; DukePlayer_t *ps = g_player[i].ps;
@ -1734,9 +1734,9 @@ void Gv_InitWeaponPointers(void)
//AddLog("Gv_InitWeaponPointers"); //AddLog("Gv_InitWeaponPointers");
for (int i=(MAX_WEAPONS-1); 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); aplWeaponClip[i]=Gv_GetVarDataPtr(aszBuf);
if (!aplWeaponClip[i]) if (!aplWeaponClip[i])
{ {
@ -1744,41 +1744,41 @@ void Gv_InitWeaponPointers(void)
// Bexit(0); // Bexit(0);
G_Shutdown(); G_Shutdown();
} }
Bsprintf(aszBuf,"WEAPON%d_RELOAD",i); Bsprintf(aszBuf,"WEAPON%zd_RELOAD",i);
aplWeaponReload[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponReload[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",i); Bsprintf(aszBuf,"WEAPON%zd_FIREDELAY",i);
aplWeaponFireDelay[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponFireDelay[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",i); Bsprintf(aszBuf,"WEAPON%zd_TOTALTIME",i);
aplWeaponTotalTime[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponTotalTime[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",i); Bsprintf(aszBuf,"WEAPON%zd_HOLDDELAY",i);
aplWeaponHoldDelay[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponHoldDelay[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_FLAGS",i); Bsprintf(aszBuf,"WEAPON%zd_FLAGS",i);
aplWeaponFlags[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponFlags[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_SHOOTS",i); Bsprintf(aszBuf,"WEAPON%zd_SHOOTS",i);
aplWeaponShoots[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponShoots[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",i); Bsprintf(aszBuf,"WEAPON%zd_SPAWNTIME",i);
aplWeaponSpawnTime[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponSpawnTime[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_SPAWN",i); Bsprintf(aszBuf,"WEAPON%zd_SPAWN",i);
aplWeaponSpawn[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponSpawn[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_SHOTSPERBURST",i); Bsprintf(aszBuf,"WEAPON%zd_SHOTSPERBURST",i);
aplWeaponShotsPerBurst[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponShotsPerBurst[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",i); Bsprintf(aszBuf,"WEAPON%zd_WORKSLIKE",i);
aplWeaponWorksLike[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponWorksLike[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_INITIALSOUND",i); Bsprintf(aszBuf,"WEAPON%zd_INITIALSOUND",i);
aplWeaponInitialSound[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponInitialSound[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_FIRESOUND",i); Bsprintf(aszBuf,"WEAPON%zd_FIRESOUND",i);
aplWeaponFireSound[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponFireSound[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_SOUND2TIME",i); Bsprintf(aszBuf,"WEAPON%zd_SOUND2TIME",i);
aplWeaponSound2Time[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponSound2Time[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_SOUND2SOUND",i); Bsprintf(aszBuf,"WEAPON%zd_SOUND2SOUND",i);
aplWeaponSound2Sound[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponSound2Sound[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND1",i); Bsprintf(aszBuf,"WEAPON%zd_RELOADSOUND1",i);
aplWeaponReloadSound1[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponReloadSound1[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_RELOADSOUND2",i); Bsprintf(aszBuf,"WEAPON%zd_RELOADSOUND2",i);
aplWeaponReloadSound2[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponReloadSound2[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",i); Bsprintf(aszBuf,"WEAPON%zd_SELECTSOUND",i);
aplWeaponSelectSound[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponSelectSound[i]=Gv_GetVarDataPtr(aszBuf);
Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",i); Bsprintf(aszBuf,"WEAPON%zd_FLASHCOLOR",i);
aplWeaponFlashColor[i]=Gv_GetVarDataPtr(aszBuf); aplWeaponFlashColor[i]=Gv_GetVarDataPtr(aszBuf);
} }
} }

View file

@ -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) 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) if ((aGameVars[i].flags & (GAMEVAR_PERACTOR | GAMEVAR_NODEFAULT)) != GAMEVAR_PERACTOR)
continue; continue;

View file

@ -194,7 +194,7 @@ EXTERN_INLINE_HEADER void G_RestoreInterpolations(void);
EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings 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 EXTERN_INLINE void G_RestoreInterpolations(void) //Stick at end of drawscreen

View file

@ -328,7 +328,7 @@ int32_t ANIM_NumFrames(void)
uint8_t * ANIM_DrawFrame(int32_t framenumber) uint8_t * ANIM_DrawFrame(int32_t framenumber)
{ {
int32_t cnt = anim->currentframe; bssize_t cnt = anim->currentframe;
// handle first play and looping or rewinding // handle first play and looping or rewinding
if (cnt < 0 || cnt > framenumber) if (cnt < 0 || cnt > framenumber)

View file

@ -475,7 +475,7 @@ void create_map_snapshot(void)
spritetype *const tspri = (spritetype *)Xmalloc(Numsprites*sizeof(spritetype) + 4); spritetype *const tspri = (spritetype *)Xmalloc(Numsprites*sizeof(spritetype) + 4);
spritetype *spri = tspri; spritetype *spri = tspri;
for (int j=0; j<MAXSPRITES && i < Numsprites; j++) for (bssize_t j=0; j<MAXSPRITES && i < Numsprites; j++)
if (sprite[j].statnum != MAXSTATUS) if (sprite[j].statnum != MAXSTATUS)
{ {
Bmemcpy(spri++, &sprite[j], sizeof(spritetype)); Bmemcpy(spri++, &sprite[j], sizeof(spritetype));
@ -740,7 +740,7 @@ static int32_t check_spritelist_consistency()
if (Numsprites < 0 || Numsprites > MAXSPRITES) if (Numsprites < 0 || Numsprites > MAXSPRITES)
return 1; return 1;
for (int i=0; i<MAXSPRITES; i++) for (bssize_t i=0; i<MAXSPRITES; i++)
{ {
const int32_t sectnum=sprite[i].sectnum, statnum=sprite[i].statnum; const int32_t sectnum=sprite[i].sectnum, statnum=sprite[i].statnum;
@ -766,7 +766,7 @@ static int32_t check_spritelist_consistency()
Bmemset(havesprite, 0, (Numsprites+7)>>3); Bmemset(havesprite, 0, (Numsprites+7)>>3);
for (int s=0; s<numsectors; s++) for (bssize_t s=0; s<numsectors; s++)
{ {
int i; int i;
csc_s = s; csc_s = s;
@ -792,7 +792,7 @@ static int32_t check_spritelist_consistency()
} }
csc_s = -1; csc_s = -1;
for (int i=0; i<MAXSPRITES; i++) for (bssize_t i=0; i<MAXSPRITES; i++)
{ {
csc_i = i; csc_i = i;
@ -803,7 +803,7 @@ static int32_t check_spritelist_consistency()
// STATUS LIST -- we now clear havesprite[] bits // STATUS LIST -- we now clear havesprite[] bits
for (int s=0; s<MAXSTATUS; s++) for (bssize_t s=0; s<MAXSTATUS; s++)
{ {
int i; int i;
csc_s = s; csc_s = s;
@ -831,7 +831,7 @@ static int32_t check_spritelist_consistency()
} }
csc_s = -1; csc_s = -1;
for (int i=0; i<Numsprites; i++) for (bssize_t i=0; i<Numsprites; i++)
{ {
csc_i = i; csc_i = i;

View file

@ -1279,7 +1279,7 @@ skip_check:
switch (how) switch (how)
{ {
case ITER_ALLSPRITES: case ITER_ALLSPRITES:
for (int jj=0; jj<MAXSPRITES && !vm.flags; jj++) for (bssize_t jj=0; jj<MAXSPRITES && !vm.flags; jj++)
{ {
if (sprite[jj].statnum == MAXSTATUS) if (sprite[jj].statnum == MAXSTATUS)
continue; continue;
@ -1291,7 +1291,7 @@ skip_check:
} }
break; break;
case ITER_ALLSECTORS: case ITER_ALLSECTORS:
for (int jj=0; jj<numsectors && !vm.flags; jj++) for (bssize_t jj=0; jj<numsectors && !vm.flags; jj++)
{ {
Gv_SetVarX(var, jj); Gv_SetVarX(var, jj);
insptr = beg; insptr = beg;
@ -1299,7 +1299,7 @@ skip_check:
} }
break; break;
case ITER_ALLWALLS: case ITER_ALLWALLS:
for (int jj=0; jj<numwalls && !vm.flags; jj++) for (bssize_t jj=0; jj<numwalls && !vm.flags; jj++)
{ {
Gv_SetVarX(var, jj); Gv_SetVarX(var, jj);
insptr = beg; insptr = beg;
@ -1308,7 +1308,7 @@ skip_check:
break; break;
case ITER_ACTIVELIGHTS: case ITER_ACTIVELIGHTS:
#ifdef POLYMER #ifdef POLYMER
for (int jj=0; jj<PR_MAXLIGHTS; jj++) for (bssize_t jj=0; jj<PR_MAXLIGHTS; jj++)
{ {
if (!prlights[jj].flags.active) if (!prlights[jj].flags.active)
continue; continue;
@ -1323,7 +1323,7 @@ skip_check:
break; break;
case ITER_SELSPRITES: case ITER_SELSPRITES:
for (int ii=0; ii<highlightcnt && !vm.flags; ii++) for (bssize_t ii=0; ii<highlightcnt && !vm.flags; ii++)
{ {
int jj = highlight[ii]; int jj = highlight[ii];
if (jj&0xc000) if (jj&0xc000)
@ -1338,7 +1338,7 @@ skip_check:
} }
break; break;
case ITER_SELSECTORS: case ITER_SELSECTORS:
for (int ii=0; ii<highlightsectorcnt && !vm.flags; ii++) for (bssize_t ii=0; ii<highlightsectorcnt && !vm.flags; ii++)
{ {
int jj=highlightsector[ii]; int jj=highlightsector[ii];
Gv_SetVarX(var, jj); Gv_SetVarX(var, jj);
@ -1347,7 +1347,7 @@ skip_check:
} }
break; break;
case ITER_SELWALLS: case ITER_SELWALLS:
for (int ii=0; ii<highlightcnt && !vm.flags; ii++) for (bssize_t ii=0; ii<highlightcnt && !vm.flags; ii++)
{ {
int jj=highlight[ii]; int jj=highlight[ii];
if (jj&0xc000) if (jj&0xc000)
@ -1365,7 +1365,7 @@ skip_check:
// Back up sprite MAXSPRITES-1. // Back up sprite MAXSPRITES-1.
Bmemcpy(&lastSpriteBackup, lastSpritePtr, sizeof(uspritetype)); Bmemcpy(&lastSpriteBackup, lastSpritePtr, sizeof(uspritetype));
for (int ii=0; ii<spritesortcnt && !vm.flags; ii++) for (bssize_t ii=0; ii<spritesortcnt && !vm.flags; ii++)
{ {
vm.pUSprite = lastSpritePtr; vm.pUSprite = lastSpritePtr;
Bmemcpy(lastSpritePtr, &tsprite[ii], sizeof(uspritetype)); Bmemcpy(lastSpritePtr, &tsprite[ii], sizeof(uspritetype));
@ -1385,7 +1385,7 @@ skip_check:
case ITER_SPRITESOFSECTOR: case ITER_SPRITESOFSECTOR:
if (parm2 < 0 || parm2 >= MAXSECTORS) if (parm2 < 0 || parm2 >= MAXSECTORS)
goto badindex; 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); Gv_SetVarX(var, jj);
vm.spriteNum = jj; vm.spriteNum = jj;
@ -1397,7 +1397,7 @@ skip_check:
case ITER_WALLSOFSECTOR: case ITER_WALLSOFSECTOR:
if (parm2 < 0 || parm2 >= MAXSECTORS) if (parm2 < 0 || parm2 >= MAXSECTORS)
goto badindex; 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++) jj<=endwall && !vm.flags; jj++)
{ {
Gv_SetVarX(var, jj); Gv_SetVarX(var, jj);
@ -1421,7 +1421,7 @@ skip_check:
} }
break; break;
case ITER_RANGE: case ITER_RANGE:
for (int jj=0; jj<parm2 && !vm.flags; jj++) for (bssize_t jj=0; jj<parm2 && !vm.flags; jj++)
{ {
Gv_SetVarX(var, jj); Gv_SetVarX(var, jj);
insptr = beg; insptr = beg;

View file

@ -3237,7 +3237,7 @@ static void M_MenuTextFormSubmit(char *input)
Bstrcpy(&ud.pwlockout[0], input); Bstrcpy(&ud.pwlockout[0], input);
else if (Bstrcmp(input, &ud.pwlockout[0]) == 0) else if (Bstrcmp(input, &ud.pwlockout[0]) == 0)
{ {
for (int x=0; x<g_numAnimWalls; x++) for (bssize_t x=0; x<g_numAnimWalls; x++)
if ((unsigned) animwall[x].wallnum < (unsigned)numwalls && wall[animwall[x].wallnum].picnum != W_SCREENBREAK && if ((unsigned) animwall[x].wallnum < (unsigned)numwalls && wall[animwall[x].wallnum].picnum != W_SCREENBREAK &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+1 && wall[animwall[x].wallnum].picnum != W_SCREENBREAK+1 &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+2) wall[animwall[x].wallnum].picnum != W_SCREENBREAK+2)

View file

@ -142,7 +142,7 @@ static void _MIDI_ResetTracks(void)
_MIDI_Context = 0; _MIDI_Context = 0;
track *ptr = _MIDI_TrackPtr; track *ptr = _MIDI_TrackPtr;
for (int i = 0; i < _MIDI_NumTracks; ++i) for (bssize_t i = 0; i < _MIDI_NumTracks; ++i)
{ {
ptr->pos = ptr->start; ptr->pos = ptr->start;
ptr->delay = _MIDI_ReadDelta(ptr); 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) 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, 0x40, 0);
_MIDI_SendControlChange(channel, MIDI_ALL_NOTES_OFF, 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) 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]); _MIDI_SetChannelVolume(channel, _MIDI_ChannelVolume[channel]);
} }
@ -550,7 +550,7 @@ int32_t MIDI_Reset(void)
{ {
MIDI_AllNotesOff(); 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_RESET_ALL_CONTROLLERS, 0);
_MIDI_SendControlChange(channel, MIDI_RPN_MSB, MIDI_PITCHBEND_MSB); _MIDI_SendControlChange(channel, MIDI_RPN_MSB, MIDI_PITCHBEND_MSB);

View file

@ -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), vec3_t const v = { tabledivide32_noinline(x2 - x1, n + 1), tabledivide32_noinline(y2 - y1, n + 1),
tabledivide32_noinline(z2 - z1, 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; x1 += v.x;
y1 += v.y; y1 += v.y;
@ -157,7 +157,7 @@ static void A_HitscanProjTrail(const vec3_t *startPos, const vec3_t *endPos, int
int32_t j; 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.x += increment.x;
spawnPos.y += increment.y; spawnPos.y += increment.y;
@ -241,12 +241,12 @@ static int A_FindTargetSprite(const spritetype *pSprite, int projAng, int projec
int lastDist = INT32_MAX; int lastDist = INT32_MAX;
int returnSprite = -1; int returnSprite = -1;
for (int k=0; k<4; k++) for (bssize_t k=0; k<4; k++)
{ {
if (returnSprite >= 0) if (returnSprite >= 0)
break; 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 && if ((sprite[spriteNum].xrepeat > 0 && sprite[spriteNum].extra >= 0 &&
(sprite[spriteNum].cstat & (257 + 32768)) == 257) || (sprite[spriteNum].cstat & (257 + 32768)) == 257) ||
@ -561,7 +561,7 @@ static int SectorContainsSE13(int sectNum)
{ {
if (sectNum >= 0) 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) if (sprite[i].statnum == STAT_EFFECTOR && sprite[i].lotag == SE_13_EXPLOSIVE)
return 1; return 1;
@ -1630,7 +1630,7 @@ static void P_DisplaySpit(void)
int const rotY = loogCounter<<2; 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 rotAng = klabs(sintable[((loogCounter + i) << 5) & 2047]) >> 5;
int const rotZoom = 4096 + ((loogCounter + i) << 9); 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); // 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)); 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) 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 closestPlayer = playerNum;
int closestPlayerDist = INT32_MAX; 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) 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) void P_EndLevel(void)
{ {
for (int TRAVERSE_CONNECT(playerNum)) for (bssize_t TRAVERSE_CONNECT(playerNum))
g_player[playerNum].ps->gm = MODE_EOL; g_player[playerNum].ps->gm = MODE_EOL;
if (ud.from_bonus) if (ud.from_bonus)
@ -4295,7 +4295,7 @@ static int P_DoFist(DukePlayer_t *pPlayer)
{ {
if (pPlayer->buttonpalette && ud.from_bonus == 0) 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; g_player[playerNum].ps->gm = MODE_EOL;
ud.from_bonus = ud.level_number + 1; ud.from_bonus = ud.level_number + 1;

View file

@ -636,11 +636,11 @@ void P_RandomSpawnPoint(int playerNum)
if (GametypeFlags[ud.coop] & GAMETYPE_TDMSPAWN) if (GametypeFlags[ud.coop] & GAMETYPE_TDMSPAWN)
{ {
for (int j=0; j<ud.multimode; j++) for (bssize_t j=0; j<ud.multimode; j++)
{ {
if (j != playerNum && g_player[j].ps->team == pPlayer->team && sprite[g_player[j].ps->i].extra > 0) if (j != playerNum && g_player[j].ps->team == pPlayer->team && sprite[g_player[j].ps->i].extra > 0)
{ {
for (int k=0; k<g_numPlayerSprites; k++) for (bssize_t k=0; k<g_numPlayerSprites; k++)
{ {
dist = FindDistance2D(g_player[j].ps->pos.x - g_playerSpawnPoints[k].pos.x, dist = FindDistance2D(g_player[j].ps->pos.x - g_playerSpawnPoints[k].pos.x,
g_player[j].ps->pos.y - g_playerSpawnPoints[k].pos.y); 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; 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->ammo_amount[weaponNum] = 0;
pPlayer->weapon_pos = WEAPON_POS_START; 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; DukePlayer_t *const pPlayer = g_player[playerNum].ps;
g_spriteDeleteQueuePos = 0; 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->hbomb_on = 0;
pPlayer->cheat_phase = 0; pPlayer->cheat_phase = 0;
@ -1429,12 +1429,12 @@ end_vol4a:
#endif #endif
Gv_ResetSystemDefaults(); 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); ALIGNED_FREE_AND_NULL(aMapInfo[i].savedstate);
if (ud.m_coop != 1) 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) if (PWEAPON(0, weaponNum, WorksLike) == PISTOL_WEAPON)
{ {
@ -1619,7 +1619,7 @@ static void resetpspritevars(char gameMode)
static inline void clearfrags(void) 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]; playerdata_t *const pPlayerData = &g_player[i];
pPlayerData->ps->frag = pPlayerData->ps->fraggedself = 0; pPlayerData->ps->frag = pPlayerData->ps->fraggedself = 0;
@ -1661,11 +1661,11 @@ void G_ClearFIFO(void)
int G_FindLevelByFile(const char *fileName) 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; 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) if (aMapInfo[volumeOffset + levelNum].filename == NULL)
continue; continue;
@ -2023,7 +2023,7 @@ void G_FreeMapState(int levelNum)
return; return;
#if !defined LUNATIC #if !defined LUNATIC
for (int j=0; j<g_gameVarCount; j++) for (bssize_t j=0; j<g_gameVarCount; j++)
{ {
// if (aGameVars[j].flags & GAMEVAR_NORESET) continue; // if (aGameVars[j].flags & GAMEVAR_NORESET) continue;
if (aGameVars[j].flags & (GAMEVAR_PERPLAYER|GAMEVAR_PERACTOR)) if (aGameVars[j].flags & (GAMEVAR_PERPLAYER|GAMEVAR_PERACTOR))

View file

@ -55,13 +55,13 @@ void G_Util_PtrToIdx(void *ptr, int32_t const count, const void *base, int32_t c
// WARNING: C std doesn't say that bit pattern of NULL is necessarily 0! // WARNING: C std doesn't say that bit pattern of NULL is necessarily 0!
if ((mode & P2I_BACK_BIT) == 0) if ((mode & P2I_BACK_BIT) == 0)
{ {
for (int i = 0; i < count; i++) for (bssize_t i = 0; i < count; i++)
if (!onlynon0_p || iptr[i]) if (!onlynon0_p || iptr[i])
iptr[i] -= ibase; iptr[i] -= ibase;
} }
else else
{ {
for (int i = 0; i < count; i++) for (bssize_t i = 0; i < count; i++)
if (!onlynon0_p || iptr[i]) if (!onlynon0_p || iptr[i])
iptr[i] += ibase; iptr[i] += ibase;
} }
@ -75,7 +75,7 @@ void G_Util_PtrToIdx2(void *ptr, int32_t const count, size_t const stride, const
if ((mode & P2I_BACK_BIT) == 0) if ((mode & P2I_BACK_BIT) == 0)
{ {
for (int i = 0; i < count; ++i) for (bssize_t i = 0; i < count; ++i)
{ {
if (!onlynon0_p || *(intptr_t *)iptr) if (!onlynon0_p || *(intptr_t *)iptr)
*(intptr_t *)iptr -= ibase; *(intptr_t *)iptr -= ibase;
@ -85,7 +85,7 @@ void G_Util_PtrToIdx2(void *ptr, int32_t const count, size_t const stride, const
} }
else else
{ {
for (int i = 0; i < count; ++i) for (bssize_t i = 0; i < count; ++i)
{ {
if (!onlynon0_p || *(intptr_t *)iptr) if (!onlynon0_p || *(intptr_t *)iptr)
*(intptr_t *)iptr += ibase; *(intptr_t *)iptr += ibase;
@ -828,7 +828,7 @@ static int32_t applydiff(const dataspec_t *spec, uint8_t **dumpvar, uint8_t **di
{ {
uint8_t *dumptr=*dumpvar, *diffptr=*diffvar; uint8_t *dumptr=*dumpvar, *diffptr=*diffvar;
const dataspec_t *sp=spec; const dataspec_t *sp=spec;
int32_t cnt, eltnum=-1, nbytes=(getnumvar(spec)+7)>>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) if (Bmemcmp(diffptr, spec->ptr, l)) // check STRING magic (sync check)
return 1; return 1;
@ -922,7 +922,7 @@ readidx_##Idxbits##_##Datbits: \
static uint32_t calcsz(const dataspec_t *spec) static uint32_t calcsz(const dataspec_t *spec)
{ {
const dataspec_t *sp=spec; const dataspec_t *sp=spec;
int32_t cnt; bssize_t cnt;
uint32_t dasiz=0; uint32_t dasiz=0;
for (; sp->flags!=DS_END; sp++) for (; sp->flags!=DS_END; sp++)
@ -1750,7 +1750,7 @@ static void sv_preprojectilesave()
#endif #endif
g_numProjectiles = 0; g_numProjectiles = 0;
for (int i=0; i<MAXTILES; i++) for (bssize_t i=0; i<MAXTILES; i++)
{ {
if (g_tile[i].proj) if (g_tile[i].proj)
{ {
@ -1775,7 +1775,7 @@ static void sv_preprojectileload()
if (ProjectileData != NULL || g_numProjectiles > 0) if (ProjectileData != NULL || g_numProjectiles > 0)
ProjectileData = (projectile_t *) Xrealloc(ProjectileData, sizeof(projectile_t) * g_numProjectiles); ProjectileData = (projectile_t *) Xrealloc(ProjectileData, sizeof(projectile_t) * g_numProjectiles);
for (int i=0; i<MAXTILES; i++) for (bssize_t i=0; i<MAXTILES; i++)
C_FreeProjectile(i); C_FreeProjectile(i);
} }
@ -1786,7 +1786,7 @@ static void sv_postprojectileload()
#endif #endif
g_numProjectiles = 0; g_numProjectiles = 0;
for (int i=0; i<MAXTILES; i++) for (bssize_t i=0; i<MAXTILES; i++)
{ {
if (g_tile[i].proj) if (g_tile[i].proj)
{ {

View file

@ -282,8 +282,8 @@ static void G_DrawCameraText(int16_t i)
{ {
int32_t flipbits = (totalclock<<1)&48; int32_t flipbits = (totalclock<<1)&48;
for (int32_t x=-64; x<394; x+=64) for (bssize_t x=-64; x<394; x+=64)
for (int32_t y=0; y<200; y+=64) for (bssize_t y=0; y<200; y+=64)
rotatesprite_win(x<<16, y<<16, 65536L, 0, STATIC, 0, 0, 2+flipbits); rotatesprite_win(x<<16, y<<16, 65536L, 0, STATIC, 0, 0, 2+flipbits);
} }
} }
@ -1693,7 +1693,7 @@ static void G_BonusCutscenes(void)
// boss // boss
if (totalclock > 390 && totalclock < 780) if (totalclock > 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) 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 (breathe[t+2] && (totalclock%120) > breathe[t] && (totalclock%120) <= breathe[t+1])
{ {
if (t==5 && bonuscnt == 0) if (t==5 && bonuscnt == 0)

View file

@ -977,7 +977,7 @@ REDODOOR:
{ {
j = sprite[j].hitag; 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] && if ((sprite[l].lotag&0xff)==SE_21_DROP_FLOOR && !actor[l].t_data[0] &&
sprite[l].hitag == j) sprite[l].hitag == j)
@ -1091,14 +1091,14 @@ void G_OperateActivators(int nTag, int playerNum)
void G_OperateMasterSwitches(int nTag) 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) if (PN(i) == MASTERSWITCH && SLT(i) == nTag && SP(i) == 0)
SP(i) = 1; SP(i) = 1;
} }
void G_OperateForceFields(int32_t spriteNum, int32_t wallTag) 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; int const wallNum = animwall[animwallNum].wallnum;
@ -1154,7 +1154,7 @@ void G_OperateForceFields(int32_t spriteNum, int32_t wallTag)
// 2: is one, on // 2: is one, on
static int G_IsLikeDipswitch(int switchPic) 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) if (switchPic == DIPSWITCH+i || switchPic == TECHSWITCH+i || switchPic == ALIENSWITCH+i)
return 1+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 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 }; 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]) if (nSwitchPal == key_switchpal[nKeyPal])
{ {
@ -1268,7 +1268,7 @@ int P_ActivateSwitch(int playerNum, int wallOrSprite, int switchType)
break; break;
} }
for (int SPRITES_OF(STAT_DEFAULT, spriteNum)) for (bssize_t SPRITES_OF(STAT_DEFAULT, spriteNum))
{ {
if (lotag == SLT(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) if (lotag == wall[nWall].lotag)
{ {
@ -1403,7 +1403,7 @@ int P_ActivateSwitch(int playerNum, int wallOrSprite, int switchType)
if (nSwitchPicnum >= MULTISWITCH && nSwitchPicnum <= MULTISWITCH + 3) if (nSwitchPicnum >= MULTISWITCH && nSwitchPicnum <= MULTISWITCH + 3)
lotag += nSwitchPicnum - MULTISWITCH; lotag += nSwitchPicnum - MULTISWITCH;
for (int SPRITES_OF(STAT_EFFECTOR, spriteNum)) for (bssize_t SPRITES_OF(STAT_EFFECTOR, spriteNum))
{ {
if (sprite[spriteNum].hitag == lotag) if (sprite[spriteNum].hitag == lotag)
{ {
@ -1458,7 +1458,7 @@ void G_ActivateBySector(int sectNum, int spriteNum)
{ {
int nActivatedSectors = 0; int nActivatedSectors = 0;
for (int SPRITES_OF_SECT(sectNum, i)) for (bssize_t SPRITES_OF_SECT(sectNum, i))
if (PN(i) == ACTIVATOR) if (PN(i) == ACTIVATOR)
{ {
G_OperateActivators(SLT(i),-1); 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]; 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) if (pWall->shade > nDarkestWall)
nDarkestWall = pWall->shade; nDarkestWall = pWall->shade;
int const nRand = krand() & 1; 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) if (SHT(i) == wall[nWall].lotag && SLT(i) == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT)
{ {
T3(i) = nRand; T3(i) = nRand;
@ -1786,11 +1786,11 @@ int Sect_DamageCeilingOrFloor(int damageFloor, int const sectNum)
if (sector[sectNum].hitag == 0) 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) 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)) if (sprite[j].hitag == SHT(i))
actor[j].t_data[3] = 1; actor[j].t_data[3] = 1;
break; break;
@ -1800,7 +1800,7 @@ int Sect_DamageCeilingOrFloor(int damageFloor, int const sectNum)
int j = krand() & 1; 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) 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: case CACTUS__STATIC:
{ {
if (isRPG == 1) if (isRPG == 1)
for (int k=64; k>0; k--) for (bssize_t k=64; k>0; k--)
{ {
int newSprite = int newSprite =
A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, 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 FIRELASER__STATIC:
case HYDRENT__STATIC: case HYDRENT__STATIC:
case HEAVYHBOMB__STATIC: case HEAVYHBOMB__STATIC:
for (int k=64; k>0; k--) for (bssize_t k=64; k>0; k--)
{ {
int newSprite = int newSprite =
A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, 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 HANGLIGHT__STATIC:
case GENERICPOLE2__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_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_PlaySound(GLASS_HEAVYBREAK,spriteNum);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
@ -1950,7 +1950,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
A_PlaySound(GLASS_HEAVYBREAK,spriteNum); A_PlaySound(GLASS_HEAVYBREAK,spriteNum);
pSprite = &sprite[spriteNum]; pSprite = &sprite[spriteNum];
for (int j=16; j>0; j--) for (bssize_t j=16; j>0; j--)
RANDOMSCRAP(pSprite, spriteNum); RANDOMSCRAP(pSprite, spriteNum);
break; break;
@ -1968,7 +1968,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
case ANTENNA__STATIC: case ANTENNA__STATIC:
if (sprite[damageSrc].extra != G_DefaultActorHealth(SHOTSPARK1)) 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, 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); krand()&2047,(krand()&127)+64,-(krand()&511)-256,spriteNum,5);
A_Spawn(spriteNum,EXPLOSION2); A_Spawn(spriteNum,EXPLOSION2);
@ -2027,7 +2027,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
break; break;
case FETUSBROKE__STATIC: case FETUSBROKE__STATIC:
for (int j=48; j>0; j--) for (bssize_t j=48; j>0; j--)
{ {
A_Shoot(spriteNum,BLOODSPLAT1); A_Shoot(spriteNum,BLOODSPLAT1);
SA(spriteNum) += 333; SA(spriteNum) += 333;
@ -2202,7 +2202,7 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
case TRIPODCAMERA__STATIC: case TRIPODCAMERA__STATIC:
A_PlaySound(GLASS_HEAVYBREAK,spriteNum); A_PlaySound(GLASS_HEAVYBREAK,spriteNum);
pSprite = &sprite[spriteNum]; pSprite = &sprite[spriteNum];
for (int j=16; j>0; j--) for (bssize_t j=16; j>0; j--)
RANDOMSCRAP(pSprite, spriteNum); RANDOMSCRAP(pSprite, spriteNum);
A_DeleteSprite(spriteNum); A_DeleteSprite(spriteNum);
break; break;
@ -2303,11 +2303,11 @@ void A_DamageObject(int32_t spriteNum, int32_t damageSrc)
void G_AlignWarpElevators(void) 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) 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) 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 VIEWSCREEN__STATIC:
case VIEWSCREEN2__STATIC: case VIEWSCREEN2__STATIC:
// Try to find a camera sprite for the viewscreen. // 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)) 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 && if (neartagsector >= 0 && (sector[neartagsector].lotag&16384) == 0 &&
isanearoperator(sector[neartagsector].lotag)) 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) if (PN(spriteNum) == ACTIVATOR || PN(spriteNum) == MASTERSWITCH)
return; return;
@ -3198,7 +3198,7 @@ void P_CheckSectors(int playerNum)
{ {
if (isanunderoperator(sector[sprite[pPlayer->i].sectnum].lotag)) 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) if (PN(spriteNum) == ACTIVATOR || PN(spriteNum) == MASTERSWITCH)
return; return;

View file

@ -62,9 +62,9 @@ void S_SoundStartup(void)
initprintf("%d voices, %d channels, %d-bit %d Hz\n", ud.config.NumVoices, ud.config.NumChannels, initprintf("%d voices, %d channels, %d-bit %d Hz\n", ud.config.NumVoices, ud.config.NumChannels,
ud.config.NumBits, ud.config.MixRate); ud.config.NumBits, ud.config.MixRate);
for (int i=0; i<g_maxSoundPos; ++i) for (bssize_t i=0; i<g_maxSoundPos; ++i)
{ {
for (int j = 0; j<MAXSOUNDINSTANCES; ++j) for (bssize_t j = 0; j<MAXSOUNDINSTANCES; ++j)
{ {
g_sounds[i].num = 0; g_sounds[i].num = 0;
g_sounds[i].SoundOwner[j].voice = 0; g_sounds[i].SoundOwner[j].voice = 0;
@ -144,9 +144,9 @@ void S_PauseSounds(int32_t onf)
SoundPaused = onf; SoundPaused = onf;
for (int i=0; i<g_maxSoundPos; ++i) for (bssize_t i=0; i<g_maxSoundPos; ++i)
{ {
for (int j = 0; j<MAXSOUNDINSTANCES; ++j) for (bssize_t j = 0; j<MAXSOUNDINSTANCES; ++j)
{ {
if (g_sounds[i].SoundOwner[j].voice > 0) if (g_sounds[i].SoundOwner[j].voice > 0)
FX_PauseVoice(g_sounds[i].SoundOwner[j].voice, onf); 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) if ((unsigned)num > (unsigned)g_maxSoundPos || g_sounds[num].num <= 0)
return; return;
for (int j=0; j<MAXSOUNDINSTANCES; ++j) for (bssize_t j=0; j<MAXSOUNDINSTANCES; ++j)
{ {
int32_t voice = g_sounds[num].SoundOwner[j].voice; int32_t voice = g_sounds[num].SoundOwner[j].voice;
@ -811,7 +811,7 @@ void S_Update(void)
do do
{ {
for (int k=0; k<MAXSOUNDINSTANCES; ++k) for (bssize_t k=0; k<MAXSOUNDINSTANCES; ++k)
{ {
int32_t i = g_sounds[num].SoundOwner[k].ow; int32_t i = g_sounds[num].SoundOwner[k].ow;
@ -865,7 +865,7 @@ int32_t A_CheckSoundPlaying(int32_t i, int32_t num)
if (g_sounds[num].num > 0 && i >= 0) if (g_sounds[num].num > 0 && i >= 0)
{ {
for (int32_t j=0; j<MAXSOUNDINSTANCES; ++j) for (bssize_t j=0; j<MAXSOUNDINSTANCES; ++j)
if (g_sounds[num].SoundOwner[j].ow == i) if (g_sounds[num].SoundOwner[j].ow == i)
return 1; return 1;
} }
@ -879,7 +879,7 @@ int32_t A_CheckAnySoundPlaying(int32_t i)
int32_t const msp = g_maxSoundPos; int32_t const msp = g_maxSoundPos;
int32_t k; int32_t k;
for (int32_t j=0; j<msp; ++j) for (bssize_t j=0; j<msp; ++j)
{ {
for (k=0; k<MAXSOUNDINSTANCES; ++k) for (k=0; k<MAXSOUNDINSTANCES; ++k)
if (g_sounds[j].SoundOwner[k].ow == i) if (g_sounds[j].SoundOwner[k].ow == i)