new version of astyle

git-svn-id: https://svn.eduke32.com/eduke32@1229 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-02-19 16:47:54 +00:00
parent 4ff6023244
commit 151189efab
41 changed files with 2449 additions and 2473 deletions

View file

@ -41,7 +41,7 @@ void hlineasm4(int32_t cnt, int32_t skiploadincs, int32_t paloffs, uint32_t by,
palptr = (char *)&ghlinepal[paloffs];
if (!skiploadincs) { gbxinc = asm1; gbyinc = asm2; }
for (;cnt>=0;cnt--)
for (; cnt>=0; cnt--)
{
*((char *)p) = palptr[gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))]];
bx -= gbxinc;
@ -64,7 +64,7 @@ void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t
bz = asm3; bzinc = (asm1>>3);
slopalptr = (int32_t*)slopaloffs;
for (;cnt>0;cnt--)
for (; cnt>0; cnt--)
{
i = krecip(bz>>6); bz += bzinc;
u = bx+globalx3*i;
@ -82,7 +82,7 @@ void vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intpt
{
gbuf = (char *)bufplc;
gpal = (char *)paloffs;
for (;cnt>=0;cnt--)
for (; cnt>=0; cnt--)
{
*((char *)p) = gpal[gbuf[vplc>>glogy]];
p += bpl;
@ -97,7 +97,7 @@ void mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intp
gbuf = (char *)bufplc;
gpal = (char *)paloffs;
for (;cnt>=0;cnt--)
for (; cnt>=0; cnt--)
{
ch = gbuf[vplc>>glogy]; if (ch != 255) *((char *)p) = gpal[ch];
p += bpl;
@ -114,7 +114,7 @@ void tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intp
gpal = (char *)paloffs;
if (transmode)
{
for (;cnt>=0;cnt--)
for (; cnt>=0; cnt--)
{
ch = gbuf[vplc>>glogy];
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
@ -124,7 +124,7 @@ void tvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, intp
}
else
{
for (;cnt>=0;cnt--)
for (; cnt>=0; cnt--)
{
ch = gbuf[vplc>>glogy];
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
@ -142,7 +142,7 @@ void mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_
gbuf = (char *)bufplc;
gpal = (char *)asm3;
for (cntup16>>=16;cntup16>0;cntup16--)
for (cntup16>>=16; cntup16>0; cntup16--)
{
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
if (ch != 255) *((char *)p) = gpal[ch];
@ -161,7 +161,7 @@ void thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_
gpal = (char *)asm3;
if (transmode)
{
for (cntup16>>=16;cntup16>0;cntup16--)
for (cntup16>>=16; cntup16>0; cntup16--)
{
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
@ -172,7 +172,7 @@ void thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_
}
else
{
for (cntup16>>=16;cntup16>0;cntup16--)
for (cntup16>>=16; cntup16>0; cntup16--)
{
ch = gbuf[((bx>>(32-glogx))<<glogy)+(by>>(32-glogy))];
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
@ -195,7 +195,7 @@ void setupspritevline(intptr_t paloffs, int32_t bxinc, int32_t byinc, int32_t ys
void spritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t p)
{
gbuf = (char *)bufplc;
for (;cnt>1;cnt--)
for (; cnt>1; cnt--)
{
(*(char *)p) = gpal[gbuf[(bx>>16)*glogy+(by>>16)]];
bx += gbxinc;
@ -217,7 +217,7 @@ void mspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t
char ch;
gbuf = (char *)bufplc;
for (;cnt>1;cnt--)
for (; cnt>1; cnt--)
{
ch = gbuf[(bx>>16)*glogy+(by>>16)];
if (ch != 255)(*(char *)p) = gpal[ch];
@ -241,7 +241,7 @@ void tspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t
gbuf = (char *)bufplc;
if (transmode)
{
for (;cnt>1;cnt--)
for (; cnt>1; cnt--)
{
ch = gbuf[(bx>>16)*glogy+(by>>16)];
if (ch != 255) *((char *)p) = gtrans[(*((char *)p))+(gpal[ch]<<8)];
@ -252,7 +252,7 @@ void tspritevline(int32_t bx, int32_t by, int32_t cnt, intptr_t bufplc, intptr_t
}
else
{
for (;cnt>1;cnt--)
for (; cnt>1; cnt--)
{
ch = gbuf[(bx>>16)*glogy+(by>>16)];
if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]];
@ -272,7 +272,7 @@ void drawslab(int32_t dx, int32_t v, int32_t dy, int32_t vi, intptr_t vptr, intp
while (dy > 0)
{
for (x=0;x<dx;x++) *(char *)(p+x) = gpal[(int32_t)(*(char *)((v>>16)+vptr))];
for (x=0; x<dx; x++) *(char *)(p+x) = gpal[(int32_t)(*(char *)((v>>16)+vptr))];
p += bpl; v += vi; dy--;
}
}

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,7 @@ static intptr_t kzipopen(char *filnam)
char newst[BMAX_PATH+4];
newst[0] = '|';
for (i=0;filnam[i] && (i < sizeof(newst)-2);i++) newst[i+1] = filnam[i];
for (i=0; filnam[i] && (i < sizeof(newst)-2); i++) newst[i+1] = filnam[i];
newst[i+1] = 0;
return(kzopen(newst));
}
@ -66,7 +66,7 @@ int32_t cachecount = 0;
char zerochar = 0;
intptr_t cachestart = 0;
int32_t cacnum = 0, agecount = 0;
typedef struct { intptr_t *hand;int32_t leng; char *lock ; } cactype;
typedef struct { intptr_t *hand; int32_t leng; char *lock ; } cactype;
cactype cac[MAXCACHEOBJECTS];
static int32_t lockrecip[200];
@ -84,7 +84,7 @@ void initcache(intptr_t dacachestart, int32_t dacachesize)
{
int32_t i;
for (i=1;i<200;i++) lockrecip[i] = (1<<28)/(200-i);
for (i=1; i<200; i++) lockrecip[i] = (1<<28)/(200-i);
// The following code was relocated here from engine.c, since this
// function is only ever called once (from there), and it seems to
@ -130,13 +130,13 @@ void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
//Find best place
bestval = 0x7fffffff; o1 = cachesize;
for (z=cacnum-1;z>=0;z--)
for (z=cacnum-1; z>=0; z--)
{
o1 -= cac[z].leng;
o2 = o1+newbytes; if (o2 > cachesize) continue;
daval = 0;
for (i=o1,zz=z;i<o2;i+=cac[zz++].leng)
for (i=o1,zz=z; i<o2; i+=cac[zz++].leng)
{
if (*cac[zz].lock == 0) continue;
if (*cac[zz].lock >= 200) { daval = 0x7fffffff; break; }
@ -156,7 +156,7 @@ void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
reportandexit("CACHE SPACE ALL LOCKED UP!");
//Suck things out
for (sucklen=-newbytes,suckz=bestz;sucklen<0;sucklen+=cac[suckz++].leng)
for (sucklen=-newbytes,suckz=bestz; sucklen<0; sucklen+=cac[suckz++].leng)
if (*cac[suckz].lock) *cac[suckz].hand = 0;
//Remove all blocks except 1
@ -182,7 +182,7 @@ void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
if (*cac[bestz].lock == 0) { cac[bestz].leng += sucklen; return; }
cacnum++; if (cacnum > MAXCACHEOBJECTS) reportandexit("Too many objects in cache! (cacnum > MAXCACHEOBJECTS)");
for (z=cacnum-1;z>bestz;z--) cac[z] = cac[z-1];
for (z=cacnum-1; z>bestz; z--) cac[z] = cac[z-1];
cac[bestz].leng = sucklen;
cac[bestz].lock = &zerochar;
}
@ -192,7 +192,7 @@ void suckcache(intptr_t *suckptr)
int32_t i;
//Can't exit early, because invalid pointer might be same even though lock = 0
for (i=0;i<cacnum;i++)
for (i=0; i<cacnum; i++)
if ((intptr_t)(*cac[i].hand) == (intptr_t)suckptr)
{
if (*cac[i].lock) *cac[i].hand = 0;
@ -220,7 +220,7 @@ void agecache(void)
if (agecount >= cacnum) agecount = cacnum-1;
if (agecount < 0) return;
for (cnt=(cacnum>>4);cnt>=0;cnt--)
for (cnt=(cacnum>>4); cnt>=0; cnt--)
{
ch = (*cac[agecount].lock);
if (((ch-2)&255) < 198)
@ -236,7 +236,7 @@ static void reportandexit(char *errormessage)
//setvmode(0x3);
j = 0;
for (i=0;i<cacnum;i++)
for (i=0; i<cacnum; i++)
{
Bprintf("%d- ",i);
if (cac[i].hand) Bprintf("ptr: 0x%" PRIxPTR ", ",*cac[i].hand);
@ -503,7 +503,7 @@ int32_t initgroupfile(char *filename)
Bread(groupfil[numgroupfiles],gfilelist[numgroupfiles],gnumfiles[numgroupfiles]<<4);
j = 0;
for (i=0;i<gnumfiles[numgroupfiles];i++)
for (i=0; i<gnumfiles[numgroupfiles]; i++)
{
k = B_LITTLE32(*((int32_t *)&gfilelist[numgroupfiles][(i<<4)+12]));
gfilelist[numgroupfiles][(i<<4)+12] = 0;
@ -520,7 +520,7 @@ void uninitsinglegroupfile(int32_t grphandle)
{
int32_t i, grpnum = -1;
for (i=numgroupfiles-1;i>=0;i--)
for (i=numgroupfiles-1; i>=0; i--)
if (groupfil[i] != -1 && groupfil[i] == grphandle)
{
kfree(gfilelist[i]);
@ -549,7 +549,7 @@ void uninitsinglegroupfile(int32_t grphandle)
}
// fix up the open files that need attention
for (i=0;i<MAXOPENFILES;i++)
for (i=0; i<MAXOPENFILES; i++)
{
if (filegrp[i] >= 254) // external file (255) or ZIPped file (254)
continue;
@ -564,7 +564,7 @@ void uninitgroupfile(void)
{
int32_t i;
for (i=numgroupfiles-1;i>=0;i--)
for (i=numgroupfiles-1; i>=0; i--)
if (groupfil[i] != -1)
{
kfree(gfilelist[i]);
@ -575,7 +575,7 @@ void uninitgroupfile(void)
numgroupfiles = 0;
// JBF 20040111: "close" any files open in groups
for (i=0;i<MAXOPENFILES;i++)
for (i=0; i<MAXOPENFILES; i++)
{
if (filegrp[i] < 254) // JBF 20040130: not external or ZIPped
filehan[i] = -1;
@ -627,17 +627,17 @@ int32_t kopen4load(char *filename, char searchfirst)
}
#endif
for (k=numgroupfiles-1;k>=0;k--)
for (k=numgroupfiles-1; k>=0; k--)
{
if (searchfirst == 1) k = 0;
if (groupfil[k] >= 0)
{
for (i=gnumfiles[k]-1;i>=0;i--)
for (i=gnumfiles[k]-1; i>=0; i--)
{
gfileptr = (char *)&gfilelist[k][i<<4];
bad = 0;
for (j=0;j<13;j++)
for (j=0; j<13; j++)
{
if (!filename[j]) break;
if (toupperlookup[filename[j]] != toupperlookup[gfileptr[j]])
@ -1049,10 +1049,10 @@ CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int32_t type)
char buf[13];
int32_t i,j;
buf[12] = 0;
for (i=0;i<MAXGROUPFILES;i++)
for (i=0; i<MAXGROUPFILES; i++)
{
if (groupfil[i] == -1) continue;
for (j=gnumfiles[i]-1;j>=0;j--)
for (j=gnumfiles[i]-1; j>=0; j--)
{
Bmemcpy(buf,&gfilelist[i][j<<4],12);
if (!Bwildmatch(buf,mask)) continue;
@ -1126,7 +1126,7 @@ int32_t kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil)
copybufbyte(lzwbuf4,ptr,(int32_t)dasizeof);
k += (int32_t)dasizeof;
for (i=1;i<count;i++)
for (i=1; i<count; i++)
{
if (k >= kgoal)
{
@ -1134,7 +1134,7 @@ int32_t kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil)
if (kread(fil,lzwbuf5,(int32_t)leng) != leng) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4);
}
for (j=0;j<dasizeof;j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
for (j=0; j<dasizeof; j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
k += dasizeof;
ptr += dasizeof;
}
@ -1165,7 +1165,7 @@ int32_t dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
copybufbyte(lzwbuf4,ptr,(int32_t)dasizeof);
k += (int32_t)dasizeof;
for (i=1;i<count;i++)
for (i=1; i<count; i++)
{
if (k >= kgoal)
{
@ -1173,7 +1173,7 @@ int32_t dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
if (Bfread(lzwbuf5,(int32_t)leng,1,fil) != 1) return -1;
k = 0; kgoal = lzwuncompress(lzwbuf5,(int32_t)leng,lzwbuf4);
}
for (j=0;j<dasizeof;j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
for (j=0; j<dasizeof; j++) ptr[j+dasizeof] = ((ptr[j]+lzwbuf4[j+k])&255);
k += dasizeof;
ptr += dasizeof;
}
@ -1206,9 +1206,9 @@ void kdfwrite(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil)
Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(int32_t)leng);
}
for (i=1;i<count;i++)
for (i=1; i<count; i++)
{
for (j=0;j<dasizeof;j++) lzwbuf4[j+k] = ((ptr[j+dasizeof]-ptr[j])&255);
for (j=0; j<dasizeof; j++) lzwbuf4[j+k] = ((ptr[j+dasizeof]-ptr[j])&255);
k += dasizeof;
if (k > LZWSIZE-dasizeof)
{
@ -1250,9 +1250,9 @@ void dfwrite(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil)
Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(int32_t)leng,1,fil);
}
for (i=1;i<count;i++)
for (i=1; i<count; i++)
{
for (j=0;j<dasizeof;j++) lzwbuf4[j+k] = ((ptr[j+dasizeof]-ptr[j])&255);
for (j=0; j<dasizeof; j++) lzwbuf4[j+k] = ((ptr[j+dasizeof]-ptr[j])&255);
k += dasizeof;
if (k > LZWSIZE-dasizeof)
{
@ -1275,7 +1275,7 @@ static int32_t lzwcompress(char *lzwinbuf, int32_t uncompleng, char *lzwoutbuf)
int32_t bytecnt1, bitcnt, numbits, oneupnumbits;
int16_t *shortptr;
for (i=255;i>=0;i--) { lzwbuf1[i] = i; lzwbuf3[i] = (i+1)&255; }
for (i=255; i>=0; i--) { lzwbuf1[i] = i; lzwbuf3[i] = (i+1)&255; }
clearbuf(lzwbuf2,256>>1,0xffffffff);
clearbuf(lzwoutbuf,((uncompleng+15)+3)>>2,0L);
@ -1329,7 +1329,7 @@ static int32_t lzwcompress(char *lzwinbuf, int32_t uncompleng, char *lzwoutbuf)
return((bitcnt+7)>>3);
}
shortptr[1] = (int16_t)0;
for (i=0;i<uncompleng;i++) lzwoutbuf[i+4] = lzwinbuf[i];
for (i=0; i<uncompleng; i++) lzwoutbuf[i+4] = lzwinbuf[i];
return(uncompleng+4);
}
@ -1346,7 +1346,7 @@ static int32_t lzwuncompress(char *lzwinbuf, int32_t compleng, char *lzwoutbuf)
copybuf(lzwinbuf+4,lzwoutbuf,((compleng-4)+3)>>2);
return((int32_t)B_LITTLE16(shortptr[0])); //uncompleng
}
for (i=255;i>=0;i--) { lzwbuf2[i] = i; lzwbuf3[i] = i; }
for (i=255; i>=0; i--) { lzwbuf2[i] = i; lzwbuf3[i] = i; }
currstr = 256; bitcnt = (4<<3); outbytecnt = 0;
numbits = 8; oneupnumbits = (1<<8);
do
@ -1359,11 +1359,11 @@ static int32_t lzwuncompress(char *lzwinbuf, int32_t compleng, char *lzwoutbuf)
lzwbuf3[currstr] = dat;
for (leng=0;dat>=256;leng++,dat=lzwbuf3[dat])
for (leng=0; dat>=256; leng++,dat=lzwbuf3[dat])
lzwbuf1[leng] = lzwbuf2[dat];
lzwoutbuf[outbytecnt++] = dat;
for (i=leng-1;i>=0;i--) lzwoutbuf[outbytecnt++] = lzwbuf1[i];
for (i=leng-1; i>=0; i--) lzwoutbuf[outbytecnt++] = lzwbuf1[i];
lzwbuf2[currstr-1] = dat; lzwbuf2[currstr] = dat;
currstr++;

View file

@ -738,7 +738,7 @@ int32_t Bwildmatch(const char *i, const char *j)
{
if (*j == '*')
{
for (k=i,j++;*k;k++) if (Bwildmatch(k,j)) return(1);
for (k=i,j++; *k; k++) if (Bwildmatch(k,j)) return(1);
continue;
}
if (!*i) return(0);

View file

@ -235,26 +235,26 @@ int32_t loadsetup(const char *fn)
#ifdef _WIN32
{
extern char map_dik_code(int32_t);
for (i=0;i<256;i++)
for (i=0; i<256; i++)
remap[i]=map_dik_code(i);
}
#else
for (i=0;i<256;i++)
for (i=0; i<256; i++)
remap[i]=i;
#endif
remapinit=1;
if (readconfig(fp, "remap", val, VL) > 0)
{
char *p=val;int32_t v1,v2;
char *p=val; int32_t v1,v2;
while (*p)
{
if (!sscanf(p,"%x",&v1))break;
if ((p=strchr(p,'-'))==0)break;p++;
if ((p=strchr(p,'-'))==0)break; p++;
if (!sscanf(p,"%x",&v2))break;
remap[v1]=v2;
initprintf("Remap %X key to %X\n",v1,v2);
if ((p=strchr(p,','))==0)break;p++;
if ((p=strchr(p,','))==0)break; p++;
}
}
Bfclose(fp);
@ -451,7 +451,7 @@ int32_t writesetup(const char *fn)
keys[19]
);
for (i=0;i<256;i++)
for (i=0; i<256; i++)
if (remap[i]!=i)
{
Bfprintf(fp,first?"%02X-%02X":",%02X-%02X",i,remap[i]);

View file

@ -275,7 +275,7 @@ static int32_t getatoken(scriptfile *sf, tokenlist *tl, int32_t ntokens)
tok = scriptfile_gettoken(sf);
if (!tok) return T_EOF;
for (i=0;i<ntokens;i++)
for (i=0; i<ntokens; i++)
{
if (!Bstrcasecmp(tok, tl[i].text))
return tl[i].tokenid;
@ -396,7 +396,7 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getsymbol(script,&tile)) break;
if (scriptfile_getsymbol(script,&pal)) break;
if (scriptfile_getsymbol(script,&i)) break; //future expansion
for (i=0;i<6;i++)
for (i=0; i<6; i++)
{
if (scriptfile_getstring(script,&fn[i])) break; //grab the 6 faces
ii = pathsearchmode;
@ -474,7 +474,7 @@ static int32_t defsparser(scriptfile *script)
#if defined(POLYMOST) && defined(USE_OPENGL)
if ((tilenume1 >= 0 && tilenume1 < MAXTILES) && (tilenume2 >= 0 && tilenume2 < MAXTILES))
{
for (i=tilenume1;i<=tilenume2;i++)
for (i=tilenume1; i<=tilenume2; i++)
{
if ((uint32_t)i < MAXTILES)
alphahackarray[i] = alpha;
@ -575,7 +575,7 @@ static int32_t defsparser(scriptfile *script)
}
if ((tile1 >= 0 && tile1 < MAXTILES) && (tile2 >= 0 && tile2 < MAXTILES))
{
for (i=tile1;i<=tile2;i++)
for (i=tile1; i<=tile2; i++)
{
if ((uint32_t)i < MAXTILES)
{
@ -681,9 +681,9 @@ static int32_t defsparser(scriptfile *script)
faketiledata[tile] = Bmalloc(xsiz*ysiz);
for (i=xsiz-1;i>=0;i--)
for (i=xsiz-1; i>=0; i--)
{
for (j=ysiz-1;j>=0;j--)
for (j=ysiz-1; j>=0; j--)
{
col = (palette_t *)&picptr[j*xsiz+i];
if (col->f < alphacut) { faketiledata[tile][i*ysiz+j] = 255; continue; }
@ -730,9 +730,9 @@ static int32_t defsparser(scriptfile *script)
faketiledata[tile] = Bmalloc(xsiz*ysiz);
for (i=xsiz-1;i>=0;i--)
for (i=xsiz-1; i>=0; i--)
{
for (j=ysiz-1;j>=0;j--)
for (j=ysiz-1; j>=0; j--)
{
col = (palette_t *)&picptr[j*xsiz+i];
if (col->f != 255) { faketiledata[tile][i*ysiz+j] = 255; continue; }
@ -799,7 +799,7 @@ static int32_t defsparser(scriptfile *script)
}
if ((tile1 >= 0 && tile1 < MAXTILES) && (tile2 >= 0 && tile2 < MAXTILES))
{
for (i=tile1;i<=tile2;i++)
for (i=tile1; i<=tile2; i++)
{
if ((uint32_t)i < MAXTILES)
{
@ -1238,9 +1238,9 @@ static int32_t defsparser(scriptfile *script)
{
case T_REDPAL: palnum = REDPAL; break;
case T_BLUEPAL: palnum = BLUEPAL; break;
case T_BROWNPAL:palnum = BROWNPAL;break;
case T_BROWNPAL:palnum = BROWNPAL; break;
case T_GREYPAL: palnum = GREYPAL; break;
case T_GREENPAL:palnum = GREENPAL;break;
case T_GREENPAL:palnum = GREENPAL; break;
case T_SPECPAL: palnum = SPECPAL; break;
case T_DETAIL:
@ -1403,7 +1403,7 @@ static int32_t defsparser(scriptfile *script)
if ((tile1 < 0) || (tile0 >= MAXTILES))
{ initprintf("Invalid tile range on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr)); break; }
#ifdef SUPERBUILD
for (tilex=tile0;tilex<=tile1;tilex++) tiletovox[tilex] = lastvoxid;
for (tilex=tile0; tilex<=tile1; tilex++) tiletovox[tilex] = lastvoxid;
#endif
break; //last tile number (inclusive)
case T_SCALE:
@ -1452,7 +1452,7 @@ static int32_t defsparser(scriptfile *script)
}
if (tile < 0) initprintf("Error: missing 'tile number' for skybox definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,skyboxtokptr)), happy=0;
for (i=0;i<6;i++)
for (i=0; i<6; i++)
{
if (!fn[i]) initprintf("Error: missing '%s filename' for skybox definition near line %s:%d\n", skyfaces[i], script->filename, scriptfile_getlinum(script,skyboxtokptr)), happy = 0;
ii = pathsearchmode;
@ -1516,7 +1516,7 @@ static int32_t defsparser(scriptfile *script)
int32_t tile=-1, token;
char *fnB=0; double alphacutB=0, xscaleB=0, yscaleB=0; char flagsB=0;
int32_t palmapbits=0;int32_t palbits=0;
int32_t palmapbits=0; int32_t palbits=0;
if (scriptfile_getsymbol(script,&tile)) break;
if (scriptfile_getbraces(script,&textureend)) break;
@ -1591,7 +1591,7 @@ static int32_t defsparser(scriptfile *script)
yscale = 1.0f / yscale;
hicsetsubsttex(tile,pal,fn,alphacut,xscale,yscale,flags);
fnB=fn;alphacutB=alphacut;xscaleB=xscale;yscaleB=yscale;flagsB=flags;
fnB=fn; alphacutB=alphacut; xscaleB=xscale; yscaleB=yscale; flagsB=flags;
if (pal<30)palbits|=1<<pal;
}
break;
@ -1652,12 +1652,12 @@ static int32_t defsparser(scriptfile *script)
switch (token)
{
case T_REDPAL: pal = REDPAL; palmapbits|=32;break;
case T_BLUEPAL: pal = BLUEPAL; palmapbits|=16;break;
case T_BROWNPAL:pal = BROWNPAL;palmapbits|= 8;break;
case T_GREYPAL: pal = GREYPAL; palmapbits|= 4;break;
case T_GREENPAL:pal = GREENPAL;palmapbits|= 2;break;
case T_SPECPAL: pal = SPECPAL; palmapbits|= 1;break;
case T_REDPAL: pal = REDPAL; palmapbits|=32; break;
case T_BLUEPAL: pal = BLUEPAL; palmapbits|=16; break;
case T_BROWNPAL:pal = BROWNPAL; palmapbits|= 8; break;
case T_GREYPAL: pal = GREYPAL; palmapbits|= 4; break;
case T_GREENPAL:pal = GREENPAL; palmapbits|= 2; break;
case T_SPECPAL: pal = SPECPAL; palmapbits|= 1; break;
case T_DETAIL:
pal = DETAILPAL;
@ -1680,7 +1680,7 @@ static int32_t defsparser(scriptfile *script)
if (palmapbits&&fnB)
{
int32_t i;
for (i=0;i<=25;i++)
for (i=0; i<=25; i++)
if (!(palbits&(1<<i))&&(palmapbits&checkpalmaps(i)))
hicsetsubsttex(tile,i,fnB,alphacutB,xscaleB,yscaleB,flagsB);
}

File diff suppressed because it is too large Load diff

View file

@ -74,7 +74,7 @@ void (APIENTRY * bglNormal3f)(GLfloat x, GLfloat y, GLfloat z);
// Lighting
void (APIENTRY * bglShadeModel)(GLenum mode);
void (APIENTRY * bglLightfv)( GLenum light, GLenum pname, const GLfloat * params );
void (APIENTRY * bglLightfv)(GLenum light, GLenum pname, const GLfloat * params);
// Raster funcs
void (APIENTRY * bglReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
@ -147,7 +147,7 @@ void (APIENTRY * bglBindBufferARB)(GLenum target, GLuint buffer);
void (APIENTRY * bglDeleteBuffersARB)(GLsizei n, const GLuint * buffers);
void (APIENTRY * bglBufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
void (APIENTRY * bglBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
void* (APIENTRY * bglMapBufferARB)(GLenum target, GLenum access);
void*(APIENTRY * bglMapBufferARB)(GLenum target, GLenum access);
GLboolean(APIENTRY * bglUnmapBufferARB)(GLenum target);
// Occlusion queries
@ -162,12 +162,12 @@ void (APIENTRY * bglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *param
// Shader Objects
void (APIENTRY * bglDeleteObjectARB)(GLhandleARB);
GLhandleARB (APIENTRY * bglGetHandleARB)(GLenum);
GLhandleARB(APIENTRY * bglGetHandleARB)(GLenum);
void (APIENTRY * bglDetachObjectARB)(GLhandleARB, GLhandleARB);
GLhandleARB (APIENTRY * bglCreateShaderObjectARB)(GLenum);
GLhandleARB(APIENTRY * bglCreateShaderObjectARB)(GLenum);
void (APIENTRY * bglShaderSourceARB)(GLhandleARB, GLsizei, const GLcharARB* *, const GLint *);
void (APIENTRY * bglCompileShaderARB)(GLhandleARB);
GLhandleARB (APIENTRY * bglCreateProgramObjectARB)(void);
GLhandleARB(APIENTRY * bglCreateProgramObjectARB)(void);
void (APIENTRY * bglAttachObjectARB)(GLhandleARB, GLhandleARB);
void (APIENTRY * bglLinkProgramARB)(GLhandleARB);
void (APIENTRY * bglUseProgramObjectARB)(GLhandleARB);
@ -195,7 +195,7 @@ void (APIENTRY * bglGetObjectParameterfvARB)(GLhandleARB, GLenum, GLfloat *);
void (APIENTRY * bglGetObjectParameterivARB)(GLhandleARB, GLenum, GLint *);
void (APIENTRY * bglGetInfoLogARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
void (APIENTRY * bglGetAttachedObjectsARB)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
GLint (APIENTRY * bglGetUniformLocationARB)(GLhandleARB, const GLcharARB *);
GLint(APIENTRY * bglGetUniformLocationARB)(GLhandleARB, const GLcharARB *);
void (APIENTRY * bglGetActiveUniformARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
void (APIENTRY * bglGetUniformfvARB)(GLhandleARB, GLint, GLfloat *);
void (APIENTRY * bglGetUniformivARB)(GLhandleARB, GLint, GLint *);
@ -247,7 +247,7 @@ void (APIENTRY * bglGetVertexAttribivARB)(GLuint, GLenum, GLint *);
void (APIENTRY * bglGetVertexAttribPointervARB)(GLuint, GLenum, GLvoid* *);
void (APIENTRY * bglBindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *);
void (APIENTRY * bglGetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
GLint (APIENTRY * bglGetAttribLocationARB)(GLhandleARB, const GLcharARB *);
GLint(APIENTRY * bglGetAttribLocationARB)(GLhandleARB, const GLcharARB *);
// GLU
void (APIENTRY * bgluTessBeginContour)(GLUtesselator* tess);
@ -262,7 +262,7 @@ GLUtesselator*(APIENTRY * bgluNewTess)(void);
void (APIENTRY * bgluPerspective)(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
const GLubyte * (APIENTRY * bgluErrorString)(GLenum error);
const GLubyte *(APIENTRY * bgluErrorString)(GLenum error);
GLint(APIENTRY * bgluProject)(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);

View file

@ -8,7 +8,7 @@
#include "build.h"
#include "compat.h"
#include "kplib.h"
#include "kplib.h"
#include "hightile.h"
@ -65,14 +65,14 @@ void hicinit(void)
#if defined(USE_OPENGL)
clearconv();
#endif
for (i=0;i<MAXPALOOKUPS;i++) // all tints should be 100%
for (i=0; i<MAXPALOOKUPS; i++) // all tints should be 100%
{
hictinting[i].r = hictinting[i].g = hictinting[i].b = 0xff;
hictinting[i].f = 0;
}
if (hicfirstinit)
for (i=MAXTILES-1;i>=0;i--)
for (i=MAXTILES-1; i>=0; i--)
{
for (hr=hicreplc[i]; hr;)
{
@ -80,7 +80,7 @@ void hicinit(void)
if (hr->skybox)
{
for (j=5;j>=0;j--)
for (j=5; j>=0; j--)
{
if (hr->skybox->face[j])
{
@ -184,7 +184,7 @@ int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6])
if ((uint32_t)picnum >= (uint32_t)MAXTILES) return -1;
if ((uint32_t)palnum >= (uint32_t)MAXPALOOKUPS) return -1;
for (j=5;j>=0;j--) if (!faces[j]) return -1;
for (j=5; j>=0; j--) if (!faces[j]) return -1;
if (!hicfirstinit) hicinit();
for (hr = hicreplc[picnum]; hr; hr = hr->next)
@ -214,7 +214,7 @@ int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6])
}
else
{
for (j=5;j>=0;j--)
for (j=5; j>=0; j--)
{
if (hrn->skybox->face[j])
free(hrn->skybox->face[j]);
@ -222,7 +222,7 @@ int32_t hicsetskybox(int32_t picnum, int32_t palnum, char *faces[6])
}
// store each face's filename
for (j=0;j<6;j++)
for (j=0; j<6; j++)
{
hrn->skybox->face[j] = strdup(faces[j]);
if (!hrn->skybox->face[j])
@ -270,7 +270,7 @@ int32_t hicclearsubst(int32_t picnum, int32_t palnum)
if (hr->skybox)
{
int32_t i;
for (i=5;i>=0;i--)
for (i=5; i>=0; i--)
if (hr->skybox->face[i])
free(hr->skybox->face[i]);
free(hr->skybox);

View file

@ -354,7 +354,7 @@ static inline uint32_t bswap(uint32_t a)
static inline int32_t bitrev(int32_t b, int32_t c)
{
int32_t i, j;
for (i=1,j=0,c=(1<<c);i<c;i+=i) { j += j; if (b&i) j++; }
for (i=1,j=0,c=(1<<c); i<c; i+=i) { j += j; if (b&i) j++; }
return(j);
}
@ -453,15 +453,15 @@ static void qhufgencode(int32_t *hitab, int32_t *hbmax, int32_t *qhval, char *qh
//r is the bit reverse of i. Ex: if: i = 1011100111, r = 1110011101
i = r = 0;
for (n=1;n<=numbits;n++)
for (k=hbmax[n-1];k<hbmax[n];k++)
for (j=i+pow2mask[numbits-n];i<=j;i++)
for (n=1; n<=numbits; n++)
for (k=hbmax[n-1]; k<hbmax[n]; k++)
for (j=i+pow2mask[numbits-n]; i<=j; i++)
{
r = bitrev(i,numbits);
qhval[r] = hitab[k];
qhbit[r] = (uint8_t)n;
}
for (j=pow2mask[numbits];i<=j;i++)
for (j=pow2mask[numbits]; i<=j; i++)
{
r = bitrev(i,numbits);
@ -498,11 +498,11 @@ static void hufgencode(int32_t *inbuf, int32_t inum, int32_t *hitab, int32_t *hb
{
int32_t i, tbuf[31];
for (i=30;i;i--) tbuf[i] = 0;
for (i=inum-1;i>=0;i--) tbuf[inbuf[i]]++;
for (i=30; i; i--) tbuf[i] = 0;
for (i=inum-1; i>=0; i--) tbuf[inbuf[i]]++;
tbuf[0] = hbmax[0] = 0; //Hack to remove symbols of length 0?
for (i=0;i<31;i++) hbmax[i+1] = hbmax[i]+tbuf[i];
for (i=0;i<inum;i++) if (inbuf[i]) hitab[hbmax[inbuf[i]]++] = i;
for (i=0; i<31; i++) hbmax[i+1] = hbmax[i]+tbuf[i];
for (i=0; i<inum; i++) if (inbuf[i]) hitab[hbmax[inbuf[i]]++] = i;
}
static int32_t initpass() //Interlaced images have 7 "passes", non-interlaced have 1
@ -788,10 +788,10 @@ static inline void rgbhlineasm(int32_t x, int32_t xr1, intptr_t p, int32_t ixstp
int32_t i;
if (!trnsrgb)
{
for (;x>xr1;p+=ixstp,x-=3) *(int32_t *)p = (*(int32_t *)&olinbuf[x])|LSWAPIB(0xff000000);
for (; x>xr1; p+=ixstp,x-=3) *(int32_t *)p = (*(int32_t *)&olinbuf[x])|LSWAPIB(0xff000000);
return;
}
for (;x>xr1;p+=ixstp,x-=3)
for (; x>xr1; p+=ixstp,x-=3)
{
i = (*(int32_t *)&olinbuf[x])|LSWAPIB(0xff000000);
if (i == trnsrgb) i &= LSWAPIB(0xffffff);
@ -801,7 +801,7 @@ static inline void rgbhlineasm(int32_t x, int32_t xr1, intptr_t p, int32_t ixstp
static inline void pal8hlineasm(int32_t x, int32_t xr1, intptr_t p, int32_t ixstp)
{
for (;x>xr1;p+=ixstp,x--) *(int32_t *)p = palcol[olinbuf[x]];
for (; x>xr1; p+=ixstp,x--) *(int32_t *)p = palcol[olinbuf[x]];
}
#endif
@ -887,7 +887,7 @@ static void putbuf(const char *buf, int32_t leng)
rgbhlineasm(x,xr1,p,ixstp);
break;
case 4:
for (;x>xr1;p+=ixstp,x-=2)
for (; x>xr1; p+=ixstp,x-=2)
{
#if (PROCESSALPHAHERE == 1)
//Enable this code to process alpha right here!
@ -902,7 +902,7 @@ static void putbuf(const char *buf, int32_t leng)
}
break;
case 6:
for (;x>xr1;p+=ixstp,x-=4)
for (; x>xr1; p+=ixstp,x-=4)
{
#if (PROCESSALPHAHERE == 1)
//Enable this code to process alpha right here!
@ -924,11 +924,11 @@ static void putbuf(const char *buf, int32_t leng)
switch (bitdepth)
{
case 1:
for (;x>xr1;p+=ixstp,x--) *(int32_t *)p = palcol[olinbuf[x>>3]>>(x&7)]; break;
for (; x>xr1; p+=ixstp,x--) *(int32_t *)p = palcol[olinbuf[x>>3]>>(x&7)]; break;
case 2:
for (;x>xr1;p+=ixstp,x-=2) *(int32_t *)p = palcol[olinbuf[x>>3]>>(x&6)]; break;
for (; x>xr1; p+=ixstp,x-=2) *(int32_t *)p = palcol[olinbuf[x>>3]>>(x&6)]; break;
case 4:
for (;x>xr1;p+=ixstp,x-=4) *(int32_t *)p = palcol[olinbuf[x>>3]>>(x&4)]; break;
for (; x>xr1; p+=ixstp,x-=4) *(int32_t *)p = palcol[olinbuf[x>>3]>>(x&4)]; break;
case 8:
pal8hlineasm(x,xr1,p,ixstp); break; //for(;x>xr1;p+=ixstp,x--) *(int32_t *)p = palcol[olinbuf[x]]; break;
}
@ -959,13 +959,13 @@ static void initpngtables()
// 2nd parameter: [0]: extra bits, [1]: base number
j = 1; k = 0;
for (i=0;i<30;i++)
for (i=0; i<30; i++)
{
hxbit[i][1] = j; j += (1<<k);
hxbit[i][0] = k; k += ((i&1) && (i >= 2));
}
j = 3; k = 0;
for (i=257;i<285;i++)
for (i=257; i<285; i++)
{
hxbit[i+30-257][1] = j; j += (1<<k);
hxbit[i+30-257][0] = k; k += ((!(i&3)) && (i >= 264));
@ -976,13 +976,13 @@ static void initpngtables()
if (k&(1<<15))
{
gotcmov = 4;
for (i=0;i<512;i++) abstab10[512+i] = abstab10[512-i] = i;
for (i=0; i<512; i++) abstab10[512+i] = abstab10[512-i] = i;
}
}
static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
{
int32_t i, j, k, bfinal, btype, hlit, hdist, leng;
int32_t slidew, slider;
@ -1019,13 +1019,13 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
{
j = 0xff000000; k = (255 / ((1<<bitdepth)-1))*0x10101;
paleng = (1<<bitdepth);
for (i=0;i<paleng;i++,j+=k) palcol[i] = LSWAPIB(j);
for (i=0; i<paleng; i++,j+=k) palcol[i] = LSWAPIB(j);
}
}
else if (i == LSWAPIB(0x45544c50)) //PLTE (must be before IDAT)
{
paleng = leng/3;
for (i=paleng-1;i>=0;i--) palcol[i] = LSWAPIB((LSWAPIL(*(int32_t *)&filptr[i*3])>>8)|0xff000000);
for (i=paleng-1; i>=0; i--) palcol[i] = LSWAPIB((LSWAPIL(*(int32_t *)&filptr[i*3])>>8)|0xff000000);
}
else if (i == LSWAPIB(0x44474b62)) //bKGD (must be after PLTE and before IDAT)
{
@ -1041,7 +1041,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
{ bakcol = (((int32_t)filptr[1])<<16)+(((int32_t)filptr[3])<<8)+((int32_t)filptr[5])+0xff000000; }
else
{
for (i=0,bakcol=0xff000000;i<3;i++)
for (i=0,bakcol=0xff000000; i<3; i++)
bakcol += ((((((int32_t)filptr[i<<1])<<8)+((int32_t)filptr[(i<<1)+1]))/257)<<(16-(i<<3)));
}
break;
@ -1068,7 +1068,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
//else {} //WARNING: PNG docs say: MUST compare all 48 bits :(
break;
case 3:
for (i=min(leng,paleng)-1;i>=0;i--)
for (i=min(leng,paleng)-1; i>=0; i--)
palcol[i] &= LSWAPIB((((int32_t)filptr[i])<<24)|0xffffff);
break;
default:
@ -1106,11 +1106,11 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
switch (bitdepth)
{
case 1:
for (i=2;i<256;i++) palcol[i] = palcol[i&1]; break;
for (i=2; i<256; i++) palcol[i] = palcol[i&1]; break;
case 2:
for (i=4;i<256;i++) palcol[i] = palcol[i&3]; break;
for (i=4; i<256; i++) palcol[i] = palcol[i&3]; break;
case 4:
for (i=16;i<256;i++) palcol[i] = palcol[i&15]; break;
for (i=16; i<256; i++) palcol[i] = palcol[i&15]; break;
}
//coltype: bitdepth: format:
@ -1146,7 +1146,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
//Raw (uncompressed)
suckbits((-bitpos)&7); //Synchronize to start of next byte
i = getbits(16); if ((getbits(16)^i) != 0xffff) return(-1);
for (;i;i--)
for (; i; i--)
{
if (slidew >= slider)
{
@ -1162,17 +1162,17 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
if (btype == 1) //Fixed Huffman
{
hlit = 288; hdist = 32; i = 0;
for (;i<144;i++) clen[i] = 8; //Fixed bit sizes (literals)
for (;i<256;i++) clen[i] = 9; //Fixed bit sizes (literals)
for (;i<280;i++) clen[i] = 7; //Fixed bit sizes (EOI,lengths)
for (;i<288;i++) clen[i] = 8; //Fixed bit sizes (lengths)
for (;i<320;i++) clen[i] = 5; //Fixed bit sizes (distances)
for (; i<144; i++) clen[i] = 8; //Fixed bit sizes (literals)
for (; i<256; i++) clen[i] = 9; //Fixed bit sizes (literals)
for (; i<280; i++) clen[i] = 7; //Fixed bit sizes (EOI,lengths)
for (; i<288; i++) clen[i] = 8; //Fixed bit sizes (lengths)
for (; i<320; i++) clen[i] = 5; //Fixed bit sizes (distances)
}
else //Dynamic Huffman
{
hlit = getbits(5)+257; hdist = getbits(5)+1; j = getbits(4)+4;
for (i=0;i<j;i++) cclen[ccind[i]] = getbits(3);
for (;i<19;i++) cclen[ccind[i]] = 0;
for (i=0; i<j; i++) cclen[ccind[i]] = getbits(3);
for (; i<19; i++) cclen[ccind[i]] = 0;
hufgencode(cclen,19,ibuf0,nbuf0);
j = 0; k = hlit+hdist;
@ -1181,11 +1181,11 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
i = hufgetsym(ibuf0,nbuf0);
if (i < 16) { clen[j++] = i; continue; }
if (i == 16)
{ for (i=getbits(2)+3;i;i--) { clen[j] = clen[j-1]; j++; } }
{ for (i=getbits(2)+3; i; i--) { clen[j] = clen[j-1]; j++; } }
else
{
if (i == 17) i = getbits(3)+3; else i = getbits(7)+11;
for (;i;i--) clen[j++] = 0;
for (; i; i--) clen[j++] = 0;
}
}
}
@ -1341,27 +1341,27 @@ static void initkpeg()
int32_t i, x, y;
x = 0; //Back & forth diagonal pattern (aligning bytes for best compression)
for (i=0;i<16;i+=2)
for (i=0; i<16; i+=2)
{
for (y=8-1;y>=0;y--)
for (y=8-1; y>=0; y--)
if ((unsigned)(i-y) < (unsigned)8) unzig[x++] = (y<<3)+i-y;
for (y=0;y<8;y++)
for (y=0; y<8; y++)
if ((unsigned)(i+1-y) < (unsigned)8) unzig[x++] = (y<<3)+i+1-y;
}
for (i=64-1;i>=0;i--) zigit[unzig[i]] = i;
for (i=64-1;i>=0;i--) dcflagor[i] = (uint8_t)(1<<(unzig[i]>>3));
for (i=64-1; i>=0; i--) zigit[unzig[i]] = i;
for (i=64-1; i>=0; i--) dcflagor[i] = (uint8_t)(1<<(unzig[i]>>3));
for (i=0;i<128;i++) colclip[i] = i+128;
for (i=128;i<512;i++) colclip[i] = 255;
for (i=512;i<896;i++) colclip[i] = 0;
for (i=896;i<1024;i++) colclip[i] = i-896;
for (i=0;i<1024;i++)
for (i=0; i<128; i++) colclip[i] = i+128;
for (i=128; i<512; i++) colclip[i] = 255;
for (i=512; i<896; i++) colclip[i] = 0;
for (i=896; i<1024; i++) colclip[i] = i-896;
for (i=0; i<1024; i++)
{
colclipup8[i] = (colclip[i]<<8);
colclipup16[i] = (colclip[i]<<16)+0xff000000; //Hack: set alphas to 255
}
#if defined(BIGENDIAN)
for (i=0;i<1024;i++)
for (i=0; i<1024; i++)
{
colclip[i] = bswap(colclip[i]);
colclipup8[i] = bswap(colclipup8[i]);
@ -1369,7 +1369,7 @@ static void initkpeg()
}
#endif
for (i=0;i<2048;i++)
for (i=0; i<2048; i++)
{
crmul[(i<<1)+0] = (i-1024)*1470104; //1.402*1048576
crmul[(i<<1)+1] = (i-1024)*-748830; //-0.71414*1048576
@ -1387,7 +1387,7 @@ static void huffgetval(int32_t index, int32_t curbits, int32_t num, int32_t *dav
hmax = &hufmaxatbit[index][0];
pow2 = pow2long[curbits-1];
if (num&pow2) v = 1; else v = 0;
for (b=1;b<=16;b++)
for (b=1; b<=16; b++)
{
if (v < hmax[b])
{
@ -1454,11 +1454,11 @@ static void yrbrend(int32_t x, int32_t y)
intptr_t p,pp;
odc = dct[0]; dc2 = dct[10];
for (yy=0;yy<(lcompvsamp[0]<<3);yy+=8)
for (yy=0; yy<(lcompvsamp[0]<<3); yy+=8)
{
oy = y+yy+globyoffs; if ((unsigned)oy >= (unsigned)clipydim) { odc += (lcomphsamp[0]<<6); continue; }
pp = oy*bytesperline + ((x+globxoffs)<<2) + frameplace;
for (xx=0;xx<(lcomphsamp[0]<<3);xx+=8,odc+=64)
for (xx=0; xx<(lcomphsamp[0]<<3); xx+=8,odc+=64)
{
ox = x+xx+globxoffs; if ((unsigned)ox >= (unsigned)clipxdim) continue;
p = pp+(xx<<2);
@ -1468,16 +1468,16 @@ static void yrbrend(int32_t x, int32_t y)
yyyend = min(clipydim-oy,8);
if ((lcomphsamp[0] == 1) && (xxxend == 8))
{
for (yyy=0;yyy<yyyend;yyy++)
for (yyy=0; yyy<yyyend; yyy++)
{
for (xxx=0;xxx<8;xxx++)
for (xxx=0; xxx<8; xxx++)
{
yv = dc[xxx];
cr = (dc2[xxx+64]>>13)&~1;
cb = (dc2[xxx ]>>13)&~1;
((int32_t *)p)[xxx] = colclipup16[(unsigned)(yv+crmul[cr+2048])>>22]+
colclipup8[(unsigned)(yv+crmul[cr+2049]+cbmul[cb+2048])>>22]+
colclip[(unsigned)(yv+cbmul[cb+2049])>>22];
colclipup8[(unsigned)(yv+crmul[cr+2049]+cbmul[cb+2048])>>22]+
colclip[(unsigned)(yv+cbmul[cb+2049])>>22];
}
p += bytesperline;
dc += 8;
@ -1486,9 +1486,9 @@ static void yrbrend(int32_t x, int32_t y)
}
else if ((lcomphsamp[0] == 2) && (xxxend == 8))
{
for (yyy=0;yyy<yyyend;yyy++)
for (yyy=0; yyy<yyyend; yyy++)
{
for (xxx=0;xxx<8;xxx+=2)
for (xxx=0; xxx<8; xxx+=2)
{
yv = dc[xxx];
cr = (dc2[(xxx>>1)+64]>>13)&~1;
@ -1497,12 +1497,12 @@ static void yrbrend(int32_t x, int32_t y)
cr = crmul[cr+2048];
cb = cbmul[cb+2049];
((int32_t *)p)[xxx] = colclipup16[(unsigned)(yv+cr)>>22]+
colclipup8[(unsigned)(yv+ i)>>22]+
colclip[(unsigned)(yv+cb)>>22];
colclipup8[(unsigned)(yv+ i)>>22]+
colclip[(unsigned)(yv+cb)>>22];
yv = dc[xxx+1];
((int32_t *)p)[xxx+1] = colclipup16[(unsigned)(yv+cr)>>22]+
colclipup8[(unsigned)(yv+ i)>>22]+
colclip[(unsigned)(yv+cb)>>22];
colclipup8[(unsigned)(yv+ i)>>22]+
colclip[(unsigned)(yv+cb)>>22];
}
p += bytesperline;
dc += 8;
@ -1511,10 +1511,10 @@ static void yrbrend(int32_t x, int32_t y)
}
else
{
for (yyy=0;yyy<yyyend;yyy++)
for (yyy=0; yyy<yyyend; yyy++)
{
i = 0; j = 1;
for (xxx=0;xxx<xxxend;xxx++)
for (xxx=0; xxx<xxxend; xxx++)
{
yv = dc[xxx];
j--;
@ -1526,8 +1526,8 @@ static void yrbrend(int32_t x, int32_t y)
i++;
}
((int32_t *)p)[xxx] = colclipup16[(unsigned)(yv+crmul[cr+2048])>>22]+
colclipup8[(unsigned)(yv+crmul[cr+2049]+cbmul[cb+2048])>>22]+
colclip[(unsigned)(yv+cbmul[cb+2049])>>22];
colclipup8[(unsigned)(yv+crmul[cr+2049]+cbmul[cb+2048])>>22]+
colclip[(unsigned)(yv+cbmul[cb+2049])>>22];
}
p += bytesperline;
dc += 8;
@ -1539,8 +1539,8 @@ static void yrbrend(int32_t x, int32_t y)
}
static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
{
int32_t i, j, v, leng, xdim = 0, ydim = 0, index, prec, restartcnt, restartinterval;
int32_t x, y, z, xx, yy, zz, *dc = 0, num, curbits, c, daval, dabits, *hqval, *hqbits, hqcnt, *quanptr = 0;
@ -1558,8 +1558,8 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
else return(-1); //"%s is not a JPEG file\n",filename
restartinterval = 0;
for (i=0;i<4;i++) lastdc[i] = 0;
for (i=0;i<8;i++) hufcnt[i] = 0;
for (i=0; i<4; i++) lastdc[i] = 0;
for (i=0; i<8; i++) hufcnt[i] = 0;
coltype = 0; bitdepth = 8; //For PNGOUT
do
@ -1595,14 +1595,14 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
gnumcomponents = kfileptr[4];
kfileptr += 5;
ghsampmax = gvsampmax = glhsampmax = glvsampmax = 0;
for (z=0;z<gnumcomponents;z++)
for (z=0; z<gnumcomponents; z++)
{
gcompid[z] = kfileptr[0];
gcomphsamp[z] = (kfileptr[1]>>4);
gcompvsamp[z] = (kfileptr[1]&15);
gcompquantab[z] = kfileptr[2];
for (i=0;i<8;i++) if (gcomphsamp[z] == pow2long[i]) { gcomphsampshift[z] = i; break; }
for (i=0;i<8;i++) if (gcompvsamp[z] == pow2long[i]) { gcompvsampshift[z] = i; break; }
for (i=0; i<8; i++) if (gcomphsamp[z] == pow2long[i]) { gcomphsampshift[z] = i; break; }
for (i=0; i<8; i++) if (gcompvsamp[z] == pow2long[i]) { gcompvsampshift[z] = i; break; }
if (gcomphsamp[z] > ghsampmax) { ghsampmax = gcomphsamp[z]; glhsampmax = gcomphsampshift[z]; }
if (gcompvsamp[z] > gvsampmax) { gvsampmax = gcompvsamp[z]; glvsampmax = gcompvsampshift[z]; }
kfileptr += 3;
@ -1620,14 +1620,14 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
v = 0; hufcnt[index] = 0;
hufquickcnt[index] = 0;
for (i=1;i<=16;i++)
for (i=1; i<=16; i++)
{
hufmaxatbit[index][i] = v+hufnumatbit[index][i];
hufvalatbit[index][i] = hufcnt[index]-v;
memcpy((void *)&huftable[index][hufcnt[index]],(void *)kfileptr,(int32_t)hufnumatbit[index][i]);
if (i <= 10)
for (c=0;c<hufnumatbit[index][i];c++)
for (j=(1<<(10-i));j>0;j--)
for (c=0; c<hufnumatbit[index][i]; c++)
for (j=(1<<(10-i)); j>0; j--)
{
hufquickval[index][hufquickcnt[index]] = huftable[index][hufcnt[index]+c];
hufquickbits[index][hufquickcnt[index]] = i;
@ -1648,7 +1648,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
ch = *kfileptr++; leng--;
index = (ch&15);
prec = (ch>>4);
for (z=0;z<64;z++)
for (z=0; z<64; z++)
{
v = (int32_t)(*kfileptr++);
if (prec) v = (v<<8)+((int32_t)(*kfileptr++));
@ -1672,7 +1672,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
lnumcomponents = (int32_t)(*kfileptr++); if (!lnumcomponents) { if (dctbuf) free(dctbuf); return(-1); }
if (lnumcomponents > 1) coltype = 2;
for (z=0;z<lnumcomponents;z++)
for (z=0; z<lnumcomponents; z++)
{
lcompid[z] = kfileptr[0];
lcompdc[z] = (kfileptr[1]>>4);
@ -1689,7 +1689,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
if ((!passcnt) && ((Ss) || (Se != 63) || (Ah) || (Al)))
{
for (z=zz=0;z<gnumcomponents;z++)
for (z=zz=0; z<gnumcomponents; z++)
{
dctx[z] = ((xdim+(ghsampmax<<3)-1)>>(glhsampmax+3)) << gcomphsampshift[z];
dcty[z] = ((ydim+(gvsampmax<<3)-1)>>(glvsampmax+3)) << gcompvsampshift[z];
@ -1698,12 +1698,12 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
z = zz*64*sizeof(int16_t);
dctbuf = (int16_t *)malloc(z); if (!dctbuf) return(-1);
memset(dctbuf,0,z);
for (z=zz=0;z<gnumcomponents;z++) { dctptr[z] = &dctbuf[zz*64]; zz += dctx[z]*dcty[z]; }
for (z=zz=0; z<gnumcomponents; z++) { dctptr[z] = &dctbuf[zz*64]; zz += dctx[z]*dcty[z]; }
}
glhstep = glvstep = 0x7fffffff;
for (z=0;z<lnumcomponents;z++)
for (zz=0;zz<gnumcomponents;zz++)
for (z=0; z<lnumcomponents; z++)
for (zz=0; zz<gnumcomponents; zz++)
if (lcompid[z] == gcompid[zz])
{
ldctptr[z] = dctptr[zz];
@ -1737,20 +1737,20 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
restartcnt = restartinterval; eobrun = 0; marker = 0xd0;
num = 0; curbits = 0;
for (y=0;y<ydim;y+=glvstep)
for (x=0;x<xdim;x+=glhstep)
for (y=0; y<ydim; y+=glvstep)
for (x=0; x<xdim; x+=glhstep)
{
if (kfileptr-4-(char *)kfilebuf >= kfilength) goto kpegrend_break2; //rest of file is missing!
if (!dctbuf) dc = dct[0];
for (c=0;c<lnumcomponents;c++)
for (c=0; c<lnumcomponents; c++)
{
hqval = &hufquickval[lcompac[c]+4][0];
hqbits = &hufquickbits[lcompac[c]+4][0];
hqcnt = hufquickcnt[lcompac[c]+4];
if (!dctbuf) quanptr = &quantab[lcompquantab[c]][0];
for (yy=0;yy<(lcompvsamp[c]<<3);yy+=8)
for (xx=0;xx<(lcomphsamp[c]<<3);xx+=8)
for (yy=0; yy<(lcompvsamp[c]<<3); yy+=8)
for (xx=0; xx<(lcomphsamp[c]<<3); xx+=8)
{
//NOTE: Might help to split this code into firstime vs. refinement (!Ah vs. Ah!=0)
@ -1794,7 +1794,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
z = max(Ss,1); dcflag = 1;
if (eobrun <= 0)
{
for (;z<=Se;z++)
for (; z<=Se; z++)
{
while (curbits < 24) //Getbits
{
@ -1870,7 +1870,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
if ((Ah) && (eobrun > 0))
{
eobrun--;
for (;z<=Se;z++)
for (; z<=Se; z++)
{
if (!dcs[z]) continue;
while (curbits < 24) //Getbits
@ -1884,7 +1884,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
if (!dctbuf)
{
for (z=64-1;z>=0;z--) dc[z] *= quanptr[z];
for (z=64-1; z>=0; z--) dc[z] *= quanptr[z];
invdct8x8(dc,dcflag); dc += 64;
}
}
@ -1899,7 +1899,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
if ((kfileptr[-2] != 255) || (kfileptr[-1] != marker)) kfileptr--;
marker++; if (marker >= 0xd8) marker = 0xd0;
restartcnt = restartinterval;
for (i=0;i<4;i++) lastdc[i] = 0;
for (i=0; i<4; i++) lastdc[i] = 0;
eobrun = 0;
}
}
@ -1918,7 +1918,7 @@ kpegrend_break2:
if (!dctbuf) return(0);
lnumcomponents = gnumcomponents;
for (i=0;i<gnumcomponents;i++)
for (i=0; i<gnumcomponents; i++)
{
lcomphsamp[i] = gcomphsamp[i]; gcomphsamp[i] <<= 3;
lcompvsamp[i] = gcompvsamp[i]; gcompvsamp[i] <<= 3;
@ -1928,17 +1928,17 @@ kpegrend_break2:
lcomphsampshift0 = gcomphsampshift[0];
lcompvsampshift0 = gcompvsampshift[0];
lcomphvsamp0 = (lcomphsamp[0]<<lcompvsampshift0);
for (y=0;y<ydim;y+=gcompvsamp[0])
for (x=0;x<xdim;x+=gcomphsamp[0])
for (y=0; y<ydim; y+=gcompvsamp[0])
for (x=0; x<xdim; x+=gcomphsamp[0])
{
dc = dct[0];
for (c=0;c<gnumcomponents;c++)
for (yy=0;yy<gcompvsamp[c];yy+=8)
for (xx=0;xx<gcomphsamp[c];xx+=8,dc+=64)
for (c=0; c<gnumcomponents; c++)
for (yy=0; yy<gcompvsamp[c]; yy+=8)
for (xx=0; xx<gcomphsamp[c]; xx+=8,dc+=64)
{
dcs = &dctptr[c][(((y+yy)>>lshy[c])*dctx[c] + ((x+xx)>>lshx[c]))<<6];
quanptr = &quantab[gcompquantab[c]][0];
for (z=0;z<64;z++) dc[z] = ((int32_t)dcs[zigit[z]])*quanptr[z];
for (z=0; z<64; z++) dc[z] = ((int32_t)dcs[zigit[z]])*quanptr[z];
invdct8x8(dc,-1);
}
yrbrend(x,y);
@ -1954,8 +1954,8 @@ static char suffix[4100], filbuffer[768], tempstack[4096];
static int32_t prefix[4100];
static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
{
int32_t i, x, y, xsiz, ysiz, yinc, xend, xspan, yspan, currstr, numbitgoal;
int32_t lzcols, dat, blocklen, bitcnt, xoff, transcol, backcol, *lptr;
@ -1994,9 +1994,9 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
cptr = ptr; ptr += paleng*3;
}
for (i=0;i<paleng;i++)
for (i=0; i<paleng; i++)
palcol[i] = LSWAPIB((((int32_t)cptr[i*3])<<16) + (((int32_t)cptr[i*3+1])<<8) + ((int32_t)cptr[i*3+2]) + 0xff000000);
for (;i<256;i++) palcol[i] = LSWAPIB(0xff000000);
for (; i<256; i++) palcol[i] = LSWAPIB(0xff000000);
if (transcol >= 0) palcol[transcol] &= LSWAPIB(~0xff000000);
//Handle GIF files with different logical&image sizes or non-0 offsets (added 05/15/2004)
@ -2014,15 +2014,15 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
xx[3] = min(daglobxoffs+xsiz ,daxres); yy[3] = min(daglobyoffs+ysiz ,dayres);
lptr = (int32_t *)(yy[0]*dabytesperline+daframeplace);
for (y=yy[0];y<yy[1];y++,lptr=(int32_t *)(((intptr_t)lptr)+dabytesperline))
for (x=xx[0];x<xx[3];x++) lptr[x] = backcol;
for (;y<yy[2];y++,lptr=(int32_t *)(((intptr_t)lptr)+dabytesperline))
for (y=yy[0]; y<yy[1]; y++,lptr=(int32_t *)(((intptr_t)lptr)+dabytesperline))
for (x=xx[0]; x<xx[3]; x++) lptr[x] = backcol;
for (; y<yy[2]; y++,lptr=(int32_t *)(((intptr_t)lptr)+dabytesperline))
{
for (x=xx[0];x<xx[1];x++) lptr[x] = backcol;
for (x=xx[2];x<xx[3];x++) lptr[x] = backcol;
for (x=xx[0]; x<xx[1]; x++) lptr[x] = backcol;
for (x=xx[2]; x<xx[3]; x++) lptr[x] = backcol;
}
for (;y<yy[3];y++,lptr=(int32_t *)(((intptr_t)lptr)+dabytesperline))
for (x=xx[0];x<xx[3];x++) lptr[x] = backcol;
for (; y<yy[3]; y++,lptr=(int32_t *)(((intptr_t)lptr)+dabytesperline))
for (x=xx[0]; x<xx[3]; x++) lptr[x] = backcol;
daglobxoffs += xoff; //Offset bitmap image by extra amount
daglobyoffs += yoff;
@ -2037,7 +2037,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
{ x = daglobxoffs+0x80000000; xend = xspan+0x80000000; }
lzcols = (1<<(*ptr)); startnumbits = (uint8_t)((*ptr)+1); ptr++;
for (i=lzcols-1;i>=0;i--) { suffix[i] = (uint8_t)(prefix[i] = i); }
for (i=lzcols-1; i>=0; i--) { suffix[i] = (uint8_t)(prefix[i] = i); }
currstr = lzcols+2; numbits = startnumbits; numbitgoal = (lzcols<<1);
blocklen = *ptr++;
memcpy(filbuffer,ptr,blocklen); ptr += blocklen;
@ -2063,11 +2063,11 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
{ numbits++; numbitgoal <<= 1; }
prefix[currstr] = dat;
for (i=0;dat>=lzcols;dat=prefix[dat]) tempstack[i++] = suffix[dat];
for (i=0; dat>=lzcols; dat=prefix[dat]) tempstack[i++] = suffix[dat];
tempstack[i] = (uint8_t)prefix[dat];
suffix[currstr-1] = suffix[currstr] = (uint8_t)dat;
for (;i>=0;i--)
for (; i>=0; i--)
{
if ((uint32_t)x < (uint32_t)daxres)
*(int32_t *)(yoff+(x<<2)) = palcol[(int32_t)tempstack[i]];
@ -2105,8 +2105,8 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
//int32_t imagebytes, filler[4];
//char pal6bit[256][3], image[ydim][xdim];
static int32_t kcelrend(const char *buf, int32_t fleng,
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
{
int32_t i, x, y, x0, x1, y0, y1, xsiz, ysiz;
const char *cptr;
@ -2124,7 +2124,7 @@ static int32_t kcelrend(const char *buf, int32_t fleng,
ysiz = (int32_t)SSWAPIB(*(uint16_t *)&buf[4]); if (ysiz <= 0) return(-1);
cptr = &buf[32];
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{
palcol[i] = (((int32_t)cptr[0])<<18) +
(((int32_t)cptr[1])<<10) +
@ -2134,8 +2134,8 @@ static int32_t kcelrend(const char *buf, int32_t fleng,
x0 = daglobyoffs; x1 = xsiz+daglobyoffs;
y0 = daglobyoffs; y1 = ysiz+daglobyoffs;
for (y=y0;y<y1;y++)
for (x=x0;x<x1;x++)
for (y=y0; y<y1; y++)
for (x=x0; x<x1; x++)
{
if (((uint32_t)x < (uint32_t)daxres) && ((uint32_t)y < (uint32_t)dayres))
*(int32_t *)(y*dabytesperline+x*4+daframeplace) = palcol[cptr[0]];
@ -2148,8 +2148,8 @@ static int32_t kcelrend(const char *buf, int32_t fleng,
//============================= TARGA begins ================================
static int32_t ktgarend(const char *header, int32_t fleng,
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
{
int32_t i = 0, x, y, pi, xi, yi, x0, x1, y0, y1, xsiz, ysiz, rlestat, colbyte, pixbyte;
const char *fptr = 0, *cptr = 0, *nptr = 0;
@ -2178,7 +2178,7 @@ static int32_t ktgarend(const char *header, int32_t fleng,
{
case 1:
coltype = 0; bitdepth = 8; palcol[0] = LSWAPIB(0xff000000);
for (i=1;i<256;i++) palcol[i] = palcol[i-1]+LSWAPIB(0x10101); break;
for (i=1; i<256; i++) palcol[i] = palcol[i-1]+LSWAPIB(0x10101); break;
case 2:
case 3:
coltype = 2; break;
@ -2195,8 +2195,8 @@ static int32_t ktgarend(const char *header, int32_t fleng,
if (header[2] < 8) rlestat = -2; else rlestat = -1;
p = y0*dabytesperline+daframeplace;
for (y=y0;y!=y1;y+=yi,p+=pi)
for (x=x0;x!=x1;x+=xi)
for (y=y0; y!=y1; y+=yi,p+=pi)
for (x=x0; x!=x1; x+=xi)
{
if (rlestat < 128)
{
@ -2253,8 +2253,8 @@ static int32_t ktgarend(const char *header, int32_t fleng,
// ³ rastoff(?): bitmap data ³
// ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
static int32_t kbmprend(const char *buf, int32_t fleng,
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
{
int32_t i, j, x, y, x0, x1, y0, y1, rastoff, headsiz, xsiz, ysiz, cdim, comp, cptrinc, *lptr;
const char *cptr;
@ -2289,7 +2289,7 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
{
if (cdim == 2) { palcol[0] = 0xffffffff; palcol[1] = LSWAPIB(0xff000000); }
if (headsiz == LSWAPIB(12)) j = 3; else j = 4;
for (i=0,cptr=&buf[headsiz+14];cptr<&buf[rastoff];i++,cptr+=j)
for (i=0,cptr=&buf[headsiz+14]; cptr<&buf[rastoff]; i++,cptr+=j)
palcol[i] = ((*(int32_t *)&cptr[0])|LSWAPIB(0xff000000));
coltype = 3; bitdepth = cdim; paleng = i; //For PNGOUT
}
@ -2305,15 +2305,15 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
}
if (comp == 3) //BI_BITFIELD (RGB masks)
{
for (i=0;i<3;i++)
for (i=0; i<3; i++)
{
j = *(int32_t *)&buf[headsiz+(i<<2)+14];
for (palcol[i]=0;palcol[i]<32;palcol[i]++)
for (palcol[i]=0; palcol[i]<32; palcol[i]++)
{
if (j&1) break;
j = (((uint32_t)j)>>1);
}
for (palcol[i+3]=0;palcol[i+3]<32;palcol[i+3]++)
for (palcol[i+3]=0; palcol[i+3]<32; palcol[i+3]++)
{
if (!(j&1)) break;
j = (((uint32_t)j)>>1);
@ -2337,20 +2337,20 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
if ((x0 >= daxres) || (x1 <= 0) || (y0 >= dayres) || (y1 <= 0)) return(0);
if (x0 < 0) x0 = 0;
if (x1 > daxres) x1 = daxres;
for (y=y0;y<y1;y++,cptr=&cptr[cptrinc])
for (y=y0; y<y1; y++,cptr=&cptr[cptrinc])
{
if ((uint32_t)y >= (uint32_t)dayres) continue;
lptr = (int32_t *)(y*dabytesperline-(daglobyoffs<<2)+daframeplace);
switch (cdim)
{
case 1:
for (x=x0;x<x1;x++) lptr[x] = palcol[(int32_t)((cptr[x>>3]>>((x&7)^7))&1)]; break;
for (x=x0; x<x1; x++) lptr[x] = palcol[(int32_t)((cptr[x>>3]>>((x&7)^7))&1)]; break;
case 4:
for (x=x0;x<x1;x++) lptr[x] = palcol[(int32_t)((cptr[x>>1]>>(((x&1)^1)<<2))&15)]; break;
for (x=x0; x<x1; x++) lptr[x] = palcol[(int32_t)((cptr[x>>1]>>(((x&1)^1)<<2))&15)]; break;
case 8:
for (x=x0;x<x1;x++) lptr[x] = palcol[(int32_t)(cptr[x])]; break;
for (x=x0; x<x1; x++) lptr[x] = palcol[(int32_t)(cptr[x])]; break;
case 16:
for (x=x0;x<x1;x++)
for (x=x0; x<x1; x++)
{
i = ((int32_t)(*(int16_t *)&cptr[x<<1]));
lptr[x] = (_lrotl(i,palcol[0])&palcol[3]) +
@ -2359,9 +2359,9 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
}
break;
case 24:
for (x=x0;x<x1;x++) lptr[x] = ((*(int32_t *)&cptr[x*3])|LSWAPIB(0xff000000)); break;
for (x=x0; x<x1; x++) lptr[x] = ((*(int32_t *)&cptr[x*3])|LSWAPIB(0xff000000)); break;
case 32:
for (x=x0;x<x1;x++)
for (x=x0; x<x1; x++)
{
i = (*(int32_t *)&cptr[x<<2]);
lptr[x] = (_lrotl(i,palcol[0])&palcol[3]) +
@ -2378,8 +2378,8 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
//============================== PCX begins =================================
//Note: currently only supports 8 and 24 bit PCX
static int32_t kpcxrend(const char *buf, int32_t fleng,
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
intptr_t daframeplace, int32_t dabytesperline, int32_t daxres, int32_t dayres,
int32_t daglobxoffs, int32_t daglobyoffs)
{
int32_t j, x, y, nplanes, x0, x1, y0, y1, xsiz, ysiz;
char c, *cptr;
@ -2398,7 +2398,7 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
{
//if (buf[fleng-769] != 12) return(-1); //Some PCX are buggy!
cptr = (char *)&buf[fleng-768];
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{
palcol[i] = (((int32_t)cptr[0])<<16) +
(((int32_t)cptr[1])<< 8) +
@ -2415,8 +2415,8 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
x0 = max(daglobxoffs,0); x1 = min(xsiz+daglobxoffs,daxres);
y0 = max(daglobyoffs,0); y1 = min(ysiz+daglobyoffs,dayres);
i = y0*dabytesperline + daframeplace+3;
for (y=y0;y<y1;y++,i+=dabytesperline)
for (x=x0;x<x1;x++) *(char *)((x<<2)+i) = 255;
for (y=y0; y<y1; y++,i+=dabytesperline)
for (x=x0; x<x1; x++) *(char *)((x<<2)+i) = 255;
}
x = x0 = daglobxoffs; x1 = xsiz+daglobxoffs;
@ -2431,7 +2431,7 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
{
c = *cptr++; if (c < 192) i = 1; else { i = (c&63); c = *cptr++; }
j = palcol[(int32_t)c];
for (;i;i--)
for (; i; i--)
{
if ((uint32_t)y < (uint32_t)dayres)
if ((uint32_t)x < (uint32_t)daxres) *(int32_t *)(x+p) = j;
@ -2445,7 +2445,7 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
do
{
c = *cptr++; if (c < 192) i = 1; else { i = (c&63); c = *cptr++; }
for (;i;i--)
for (; i; i--)
{
if ((uint32_t)y < (uint32_t)dayres)
if ((uint32_t)x < (uint32_t)daxres) *(char *)(x+p) = c;
@ -2463,7 +2463,7 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
//Note:currently supports: DXT1,DXT2,DXT3,DXT4,DXT5,A8R8G8B8
static int32_t kddsrend(const char *buf, int32_t leng,
intptr_t frameptr, int32_t bpl, int32_t xdim, int32_t ydim, int32_t xoff, int32_t yoff)
intptr_t frameptr, int32_t bpl, int32_t xdim, int32_t ydim, int32_t xoff, int32_t yoff)
{
int32_t x = 0, y = 0, z = 0, xx, yy, xsiz, ysiz, dxt, al[2], ai, k, v, c0, c1, stride;
uint32_t lut[256], r[4], g[4], b[4], a[8], rr, gg, bb;
@ -2486,7 +2486,7 @@ static int32_t kddsrend(const char *buf, int32_t leng,
j = yoff*bpl + (xoff<<2) + frameptr; xx = (xsiz<<2);
if (xoff < 0) { j -= (xoff<<2); buf -= (xoff<<2); xsiz += xoff; }
xsiz = (min(xsiz,xdim-xoff)<<2); ysiz = min(ysiz,ydim);
for (y=0;y<ysiz;y++,j+=bpl,buf+=xx)
for (y=0; y<ysiz; y++,j+=bpl,buf+=xx)
{
if ((uint32_t)(y+yoff) >= (uint32_t)ydim) continue;
memcpy((void *)j,(void *)buf,xsiz);
@ -2500,13 +2500,13 @@ static int32_t kddsrend(const char *buf, int32_t leng,
if (!(dxt&1))
{
for (z=256-1;z>0;z--) lut[z] = (255<<16)/z;
for (z=256-1; z>0; z--) lut[z] = (255<<16)/z;
lut[0] = (1<<16);
}
if (dxt == 1) stride = (xsiz<<1); else stride = (xsiz<<2);
for (y=0;y<ysiz;y+=4,buf+=stride)
for (x=0;x<xsiz;x+=4)
for (y=0; y<ysiz; y+=4,buf+=stride)
for (x=0; x<xsiz; x+=4)
{
if (dxt == 1) uptr = (char *)((intptr_t)(buf)+(x<<1));
else uptr = (char *)((intptr_t)(buf)+(x<<2)+8);
@ -2537,12 +2537,12 @@ static int32_t kddsrend(const char *buf, int32_t leng,
if (k < 0)
{
z = a[0]*6 + a[1] + 3;
for (j=2;j<8;j++) { a[j] = ((z*(65536/7))>>16); z += k; }
for (j=2; j<8; j++) { a[j] = ((z*(65536/7))>>16); z += k; }
}
else
{
z = a[0]*4 + a[1] + 2;
for (j=2;j<6;j++) { a[j] = ((z*(65536/5))>>16); z += k; }
for (j=2; j<6; j++) { a[j] = ((z*(65536/5))>>16); z += k; }
a[6] = 0; a[7] = 255;
}
al[0] = LSWAPIB(*(int32_t *)&uptr[-6]);
@ -2550,10 +2550,10 @@ static int32_t kddsrend(const char *buf, int32_t leng,
}
wptr = (char *)((y+yoff)*bpl + ((x+xoff)<<2) + frameptr);
ai = 0;
for (yy=0;yy<4;yy++,wptr+=bpl)
for (yy=0; yy<4; yy++,wptr+=bpl)
{
if ((uint32_t)(y+yy+yoff) >= (uint32_t)ydim) { ai += 4; continue; }
for (xx=0;xx<4;xx++,ai++)
for (xx=0; xx<4; xx++,ai++)
{
if ((uint32_t)(x+xx+xoff) >= (uint32_t)xdim) continue;
@ -2673,7 +2673,7 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz)
}
int32_t kprender(const char *buf, int32_t leng, intptr_t frameptr, int32_t bpl,
int32_t xdim, int32_t ydim, int32_t xoff, int32_t yoff)
int32_t xdim, int32_t ydim, int32_t xoff, int32_t yoff)
{
char *ubuf = (char *)buf;
@ -2725,7 +2725,7 @@ static int32_t wildmatch(const char *i, const char *j)
{
if (*j == '*')
{
for (k=i,j++;*k;k++) if (wildmatch(k,j)) return(1);
for (k=i,j++; *k; k++) if (wildmatch(k,j)) return(1);
continue;
}
if (!*i) return(0);
@ -2747,7 +2747,7 @@ static int32_t filnamcmp(const char *st0, const char *st1)
int32_t i;
char ch0, ch1;
for (i=0;st0[i];i++)
for (i=0; st0[i]; i++)
{
ch0 = st0[i]; if ((ch0 >= 'a') && (ch0 <= 'z')) ch0 -= 32;
ch1 = st1[i]; if ((ch1 >= 'a') && (ch1 <= 'z')) ch1 -= 32;
@ -2799,7 +2799,7 @@ static int32_t kzcalchash(const char *st)
int32_t i, hashind;
char ch;
for (i=0,hashind=0;st[i];i++)
for (i=0,hashind=0; st[i]; i++)
{
ch = st[i];
if ((ch >= 'a') && (ch <= 'z')) ch -= 32;
@ -2815,7 +2815,7 @@ static int32_t kzcheckhash(const char *filnam, char **zipnam, int32_t *zipseek)
if (!kzhashbuf) return(0);
if (filnam[0] == '|') filnam++;
for (i=kzhashead[kzcalchash(filnam)];i>=0;i=(*(int32_t *)&kzhashbuf[i]))
for (i=kzhashead[kzcalchash(filnam)]; i>=0; i=(*(int32_t *)&kzhashbuf[i]))
if (!filnamcmp(filnam,&kzhashbuf[i+16]))
{
(*zipnam) = &kzhashbuf[*(int32_t *)&kzhashbuf[i+8]];
@ -2867,7 +2867,7 @@ int32_t kzaddstack(const char *zipnam)
if (numfiles < 0) { fclose(fil); return(-1); }
fseek(fil,-4,SEEK_CUR);
}
for (i=0;i<numfiles;i++)
for (i=0; i<numfiles; i++)
{
fread(tempbuf,46,1,fil);
if (*(int32_t *)&tempbuf[0] != LSWAPIB(0x02014b50)) { fclose(fil); return(0); }
@ -2991,7 +2991,7 @@ int32_t kzfindfile(char *filnam)
//Extract directory from wildcard string for pre-pending
wildstpathleng = 0;
for (i=0;wildst[i];i++)
for (i=0; wildst[i]; i++)
if ((wildst[i] == '/') || (wildst[i] == '\\'))
wildstpathleng = i+1;
@ -3208,7 +3208,7 @@ kzreadplc0:
//Raw (uncompressed)
suckbits((-bitpos)&7); //Synchronize to start of next byte
i = getbits(16); if ((getbits(16)^i) != 0xffff) return(-1);
for (;i;i--)
for (; i; i--)
{
if (gslidew >= gslider)
{
@ -3230,17 +3230,17 @@ kzreadplc1:
if (btype == 1) //Fixed Huffman
{
hlit = 288; hdist = 32; i = 0;
for (;i<144;i++) clen[i] = 8; //Fixed bit sizes (literals)
for (;i<256;i++) clen[i] = 9; //Fixed bit sizes (literals)
for (;i<280;i++) clen[i] = 7; //Fixed bit sizes (EOI,lengths)
for (;i<288;i++) clen[i] = 8; //Fixed bit sizes (lengths)
for (;i<320;i++) clen[i] = 5; //Fixed bit sizes (distances)
for (; i<144; i++) clen[i] = 8; //Fixed bit sizes (literals)
for (; i<256; i++) clen[i] = 9; //Fixed bit sizes (literals)
for (; i<280; i++) clen[i] = 7; //Fixed bit sizes (EOI,lengths)
for (; i<288; i++) clen[i] = 8; //Fixed bit sizes (lengths)
for (; i<320; i++) clen[i] = 5; //Fixed bit sizes (distances)
}
else //Dynamic Huffman
{
hlit = getbits(5)+257; hdist = getbits(5)+1; j = getbits(4)+4;
for (i=0;i<j;i++) cclen[ccind[i]] = getbits(3);
for (;i<19;i++) cclen[ccind[i]] = 0;
for (i=0; i<j; i++) cclen[ccind[i]] = getbits(3);
for (; i<19; i++) cclen[ccind[i]] = 0;
hufgencode(cclen,19,ibuf0,nbuf0);
j = 0; k = hlit+hdist;
@ -3249,11 +3249,11 @@ kzreadplc1:
i = hufgetsym(ibuf0,nbuf0);
if (i < 16) { clen[j++] = i; continue; }
if (i == 16)
{ for (i=getbits(2)+3;i;i--) { clen[j] = clen[j-1]; j++; } }
{ for (i=getbits(2)+3; i; i--) { clen[j] = clen[j-1]; j++; } }
else
{
if (i == 17) i = getbits(3)+3; else i = getbits(7)+11;
for (;i;i--) clen[j++] = 0;
for (; i; i--) clen[j++] = 0;
}
}
}
@ -3290,7 +3290,7 @@ kzreadplc2:
else j = hufgetsym(ibuf1,nbuf1);
j = getbits(hxbit[j][0]) + hxbit[j][1];
for (;i;i--,gslidew++) slidebuf[gslidew&32767] = slidebuf[(gslidew-j)&32767];
for (; i; i--,gslidew++) slidebuf[gslidew&32767] = slidebuf[(gslidew-j)&32767];
}
}
while (!bfinal);

View file

@ -25,7 +25,7 @@ int32_t lzwcompress(char *ucompbuf, int32_t ucompleng, char *compbuf)
sibry = (int32_t *)malloc((ucompleng+256)*sizeof(int32_t)); if (!sibry) { free(sibly); free(child); free(nodev); return(0); }
#endif
for (i=255;i>=0;i--) { nodev[i] = i; child[i] = -1; }
for (i=255; i>=0; i--) { nodev[i] = i; child[i] = -1; }
memset(compbuf,0,ucompleng+15);
cptr = ucompbuf; eptr = &ucompbuf[ucompleng];
@ -33,7 +33,7 @@ int32_t lzwcompress(char *ucompbuf, int32_t ucompleng, char *compbuf)
numnodes = 256; bitcnt = (4<<3); nbits = 8; oneupnbits = (1<<8); hmask = ((oneupnbits>>1)-1);
do
{
for (i=cptr[0];i>=0;i=j)
for (i=cptr[0]; i>=0; i=j)
{
cptr++; if (cptr >= eptr) goto lzwcompbreak2b;
j = child[i]; if (j < 0) { child[i] = numnodes; break; }
@ -46,7 +46,7 @@ int32_t lzwcompress(char *ucompbuf, int32_t ucompleng, char *compbuf)
else { if (sibry[j] < 0) { sibry[j] = numnodes; goto lzwcompbreak2a; } j = sibry[j]; }
}
#else
for (;nodev[j]!=cptr[0];j=sibly[j])
for (; nodev[j]!=cptr[0]; j=sibly[j])
if (sibly[j] < 0) { sibly[j] = numnodes; goto lzwcompbreak2a; }
#endif
}
@ -98,14 +98,14 @@ int32_t lzwuncompress(char *compbuf, int32_t compleng, char *ucompbuf, int32_t u
prefix[numnodes] = dat;
ucompbuf++;
for (leng=0;dat>=256;dat=prefix[dat])
for (leng=0; dat>=256; dat=prefix[dat])
{
if ((int32_t)ucompbuf+leng-ucomp > ucompleng) goto bail;
ucompbuf[leng++] = suffix[dat];
}
ucptr = &ucompbuf[leng-1];
for (i=(leng>>1)-1;i>=0;i--) { ch = ucompbuf[i]; ucompbuf[i] = ucptr[-i]; ucptr[-i] = ch; }
for (i=(leng>>1)-1; i>=0; i--) { ch = ucompbuf[i]; ucompbuf[i] = ucptr[-i]; ucptr[-i] = ch; }
ucompbuf[-1] = dat; ucompbuf += leng;
suffix[numnodes-1] = suffix[numnodes] = dat;

View file

@ -22,7 +22,7 @@ int32_t addtileP(int32_t model,int32_t tile,int32_t pallet)
{
UNREFERENCED_PARAMETER(model);
if (curextra==MAXTILES+EXTRATILES-2)return curextra;
if (tile2model[tile].modelid==-1) {tile2model[tile].pal=pallet;return tile;}
if (tile2model[tile].modelid==-1) {tile2model[tile].pal=pallet; return tile;}
if (tile2model[tile].pal==pallet)return tile;
while (tile2model[tile].next!=-1)
{
@ -70,7 +70,7 @@ void freeallmodels()
if (models)
{
for (i=0;i<nextmodelid;i++) mdfree(models[i]);
for (i=0; i<nextmodelid; i++) mdfree(models[i]);
free(models); models = NULL;
nummodelsalloced = 0;
nextmodelid = 0;
@ -101,18 +101,18 @@ void freevbos()
{
int32_t i;
for (i=0;i<nextmodelid;i++)
if (models[i]->mdnum == 3)
{
md3model_t *m = (md3model_t *)models[i];
if (m->vbos)
for (i=0; i<nextmodelid; i++)
if (models[i]->mdnum == 3)
{
md3model_t *m = (md3model_t *)models[i];
if (m->vbos)
{
// OSD_Printf("freeing model %d vbo\n",i);
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
free(m->vbos);
m->vbos = NULL;
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
free(m->vbos);
m->vbos = NULL;
}
}
}
if (allocvbos)
{
@ -132,13 +132,13 @@ void clearskins()
mdmodel_t *m;
int32_t i, j;
for (i=0;i<nextmodelid;i++)
for (i=0; i<nextmodelid; i++)
{
m = models[i];
if (m->mdnum == 1)
{
voxmodel_t *v = (voxmodel_t*)m;
for (j=0;j<MAXPALOOKUPS;j++)
for (j=0; j<MAXPALOOKUPS; j++)
{
if (v->texid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]);
v->texid[j] = 0;
@ -148,14 +148,14 @@ void clearskins()
{
md2model_t *m2 = (md2model_t*)m;
mdskinmap_t *sk;
for (j=0;j<m2->numskins*(HICEFFECTMASK+1);j++)
for (j=0; j<m2->numskins*(HICEFFECTMASK+1); j++)
{
if (m2->texid[j]) bglDeleteTextures(1,(GLuint*)&m2->texid[j]);
m2->texid[j] = 0;
}
for (sk=m2->skinmap;sk;sk=sk->next)
for (j=0;j<(HICEFFECTMASK+1);j++)
for (sk=m2->skinmap; sk; sk=sk->next)
for (j=0; j<(HICEFFECTMASK+1); j++)
{
if (sk->texid[j]) bglDeleteTextures(1,(GLuint*)&sk->texid[j]);
sk->texid[j] = 0;
@ -163,10 +163,10 @@ void clearskins()
}
}
for (i=0;i<MAXVOXELS;i++)
for (i=0; i<MAXVOXELS; i++)
{
voxmodel_t *v = (voxmodel_t*)voxmodels[i]; if (!v) continue;
for (j=0;j<MAXPALOOKUPS;j++)
for (j=0; j<MAXPALOOKUPS; j++)
{
if (v->texid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]);
v->texid[j] = 0;
@ -230,7 +230,7 @@ static int32_t framename2index(mdmodel_t *vm, const char *nam)
{
md2model_t *m = (md2model_t *)vm;
md2frame_t *fr;
for (i=0;i<m->numframes;i++)
for (i=0; i<m->numframes; i++)
{
fr = (md2frame_t *)&m->frames[i*m->framebytes];
if (!Bstrcmp(fr->name, nam)) break;
@ -240,7 +240,7 @@ static int32_t framename2index(mdmodel_t *vm, const char *nam)
case 3:
{
md3model_t *m = (md3model_t *)vm;
for (i=0;i<m->numframes;i++)
for (i=0; i<m->numframes; i++)
if (!Bstrcmp(m->head.frames[i].nam,nam)) break;
}
break;
@ -417,24 +417,23 @@ void clearconv()
void setpalconv(int32_t pal,int32_t pal1,int32_t pal2)
{
int32_t i;
for (i=0;i<MAXPALCONV;i++)
for (i=0; i<MAXPALCONV; i++)
if (!palconv[i].pal)
{
palconv[i].pal =pal;
palconv[i].pal1=pal1;
palconv[i].pal2=pal2;return;
palconv[i].pal2=pal2; return;
}
else if (palconv[i].pal==pal&&palconv[i].pal1==pal1)
{
palconv[i].pal2=pal2; return;
}
else
if (palconv[i].pal==pal&&palconv[i].pal1==pal1)
{
palconv[i].pal2=pal2;return;
}
}
void getpalmap(int32_t *i,int32_t *pal1,int32_t *pal2)
{
for (;*i<MAXPALCONV&&palconv[*i].pal1;(*i)++)
for (; *i<MAXPALCONV&&palconv[*i].pal1; (*i)++)
if (palconv[*i].pal==*pal2)
{
*pal1=palconv[*i].pal1;
@ -447,7 +446,7 @@ int32_t checkpalmaps(int32_t pal)
{
int32_t stage,val=0;
for (stage=0;stage<MAXPALCONV;stage++)
for (stage=0; stage<MAXPALCONV; stage++)
{
int32_t pal1=0,pal2=pal;
getpalmap(&stage,&pal1,&pal2);
@ -477,7 +476,7 @@ void applypalmap(char *pic, char *palmap, int32_t size, int32_t pal)
pic[b]=((255*(255-a)+hictinting[pal].b*a)*palmap[b])/255/255;
*/
if (glinfo.bgra)swapchar(&pic[r], &pic[b]);
r+=4;g+=4;b+=4;
r+=4; g+=4; b+=4;
}
}
@ -486,7 +485,7 @@ static void applypalmapSkin(char *pic, int32_t sizx, int32_t sizy, md2model_t *m
int32_t stage;
//_initprintf("%d(%dx%d)\n",pal,sizx,sizy);
for (stage=0;stage<MAXPALCONV;stage++)
for (stage=0; stage<MAXPALCONV; stage++)
{
int32_t pal1=0,pal2=pal;
mdskinmap_t *sk=modelhead->skinmap;
@ -522,8 +521,8 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t
if (!glinfo.texnpot)
{
for (xsiz=1;xsiz<tsizx;xsiz+=xsiz);
for (ysiz=1;ysiz<tsizy;ysiz+=ysiz);
for (xsiz=1; xsiz<tsizx; xsiz+=xsiz);
for (ysiz=1; ysiz<tsizy; ysiz+=ysiz);
}
else
{
@ -544,11 +543,11 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t
r=(glinfo.bgra)?hictinting[pal].b:hictinting[pal].r;
g=hictinting[pal].g;
b=(glinfo.bgra)?hictinting[pal].r:hictinting[pal].b;
for (y=0,j=0;y<tsizy;y++,j+=xsiz)
for (y=0,j=0; y<tsizy; y++,j+=xsiz)
{
coltype *rpptr = &pic[j], tcol;
for (x=0;x<tsizx;x++)
for (x=0; x<tsizx; x++)
{
tcol.b = cptr[rpptr[x].b];
tcol.g = cptr[rpptr[x].g];
@ -583,7 +582,7 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t
}
if (!glinfo.bgra)
{
for (j=xsiz*ysiz-1;j>=0;j--)
for (j=xsiz*ysiz-1; j>=0; j--)
{
swapchar(&pic[j].r, &pic[j].b);
}
@ -627,23 +626,23 @@ int32_t mdloadskin_trytexcache(char *fn, int32_t len, int32_t pal, char effect,
int32_t offset = 0;
int32_t len = 0;
int32_t i;
/*
texcacheindex *cacheindexptr = &firstcacheindex;
/*
texcacheindex *cacheindexptr = &firstcacheindex;
do
{
// initprintf("checking %s against %s\n",cachefn,cacheindexptr->name);
if (!Bstrcmp(cachefn,cacheindexptr->name))
{
offset = cacheindexptr->offset;
len = cacheindexptr->len;
// initprintf("got a match for %s offset %d\n",cachefn,offset);
break;
}
cacheindexptr = cacheindexptr->next;
}
while (cacheindexptr->next);
*/
do
{
// initprintf("checking %s against %s\n",cachefn,cacheindexptr->name);
if (!Bstrcmp(cachefn,cacheindexptr->name))
{
offset = cacheindexptr->offset;
len = cacheindexptr->len;
// initprintf("got a match for %s offset %d\n",cachefn,offset);
break;
}
cacheindexptr = cacheindexptr->next;
}
while (cacheindexptr->next);
*/
i = hash_find(&cacheH,cachefn);
if (i != -1)
{
@ -808,7 +807,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
// possibly fetch an already loaded multitexture :_)
if (pal >= (MAXPALOOKUPS - RESERVEDPALS))
for (i=0;i<nextmodelid;i++)
for (i=0; i<nextmodelid; i++)
for (skzero = ((md2model_t *)models[i])->skinmap; skzero; skzero = skzero->next)
if (!Bstrcasecmp(skzero->fn, sk->fn) && skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)])
{
@ -888,8 +887,8 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
if (m->mdnum == 2)
{
int32_t *lptr;
for (lptr=m->glcmds;(i=*lptr++);)
for (i=labs(i);i>0;i--,lptr+=3)
for (lptr=m->glcmds; (i=*lptr++);)
for (i=labs(i); i>0; i--,lptr+=3)
{
((float *)lptr)[0] *= fx;
((float *)lptr)[1] *= fy;
@ -900,10 +899,10 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
md3model_t *m3 = (md3model_t *)m;
md3surf_t *s;
int32_t surfi;
for (surfi=0;surfi<m3->head.numsurfs;surfi++)
for (surfi=0; surfi<m3->head.numsurfs; surfi++)
{
s = &m3->head.surfs[surfi];
for (i=s->numverts-1;i>=0;i--)
for (i=s->numverts-1; i>=0; i--)
{
s->uv[i].u *= fx;
s->uv[i].v *= fy;
@ -930,7 +929,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
cachead.ydim = osizy>>cachead.quality;
i = 0;
for (j=0;j<31;j++)
for (j=0; j<31; j++)
{
if (xsiz == pow2long[j]) { i |= 1; }
if (ysiz == pow2long[j]) { i |= 2; }
@ -951,7 +950,7 @@ void updateanimation(md2model_t *m, spritetype *tspr)
int32_t fps;
char lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal;
if (m->numframes < 2)
if (m->numframes < 2)
{
m->interpol = 0;
return;
@ -1027,7 +1026,7 @@ void updateanimation(md2model_t *m, spritetype *tspr)
else
j = ((anim->endframe+1-anim->startframe)<<16);
//Just in case you play the game for a VERY int32_t time...
if (i < 0) { i = 0;spriteext[tspr->owner].mdanimtims = mdtims; }
if (i < 0) { i = 0; spriteext[tspr->owner].mdanimtims = mdtims; }
//compare with j*2 instead of j to ensure i stays > j-65536 for MDANIM_ONESHOT
if ((anim) && (i >= j+j) && (fps) && !mdpause) //Keep mdanimtims close to mdtims to avoid the use of MOD
spriteext[tspr->owner].mdanimtims += j/((fps*timerticspersec)/120);
@ -1147,7 +1146,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
{
fr = (md2frame_t *)f;
l = (int32_t *)&fr->mul;
for (j=5;j>=0;j--) l[j] = B_LITTLE32(l[j]);
for (j=5; j>=0; j--) l[j] = B_LITTLE32(l[j]);
f += m->framebytes;
}
@ -1159,7 +1158,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
#endif
strcpy(st,filnam);
for (i=strlen(st)-1;i>0;i--)
for (i=strlen(st)-1; i>0; i--)
if ((st[i] == '/') || (st[i] == '\\')) { i++; break; }
if (i<0) i=0;
st[i] = 0;
@ -1298,7 +1297,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
if (sk->palmap)
{
//_initprintf("Delete %s",m->skinfn);
sk->palmap=0;sk->size=0;
sk->palmap=0; sk->size=0;
}
strcpy(sk->fn, m->basepath);
strcat(sk->fn, m->skinfn);
@ -1416,20 +1415,20 @@ static md3model_t *md3load(int32_t fil)
for (i = m->head.numframes-1; i>=0; i--)
{
l = (int32_t *)&m->head.frames[i].min;
for (j=3+3+3+1-1;j>=0;j--) l[j] = B_LITTLE32(l[j]);
for (j=3+3+3+1-1; j>=0; j--) l[j] = B_LITTLE32(l[j]);
}
for (i = m->head.numtags-1; i>=0; i--)
{
l = (int32_t *)&m->head.tags[i].p;
for (j=3+3+3+3-1;j>=0;j--) l[j] = B_LITTLE32(l[j]);
for (j=3+3+3+3-1; j>=0; j--) l[j] = B_LITTLE32(l[j]);
}
}
#endif
maxtrispersurf = 0;
for (surfi=0;surfi<m->head.numsurfs;surfi++)
for (surfi=0; surfi<m->head.numsurfs; surfi++)
{
s = &m->head.surfs[surfi];
klseek(fil,ofsurf,SEEK_SET); kread(fil,s,SIZEOF_MD3SURF_T);
@ -1439,7 +1438,7 @@ static md3model_t *md3load(int32_t fil)
int32_t *l;
s->id = B_LITTLE32(s->id);
l = (int32_t *)&s->flags;
for (j=1+1+1+1+1+1+1+1+1+1-1;j>=0;j--) l[j] = B_LITTLE32(l[j]);
for (j=1+1+1+1+1+1+1+1+1+1-1; j>=0; j--) l[j] = B_LITTLE32(l[j]);
}
#endif
@ -1454,7 +1453,7 @@ static md3model_t *md3load(int32_t fil)
s->tris = (md3tri_t *)malloc(leng[0]+leng[1]+leng[2]+leng[3]);
if (!s->tris)
{
for (surfi--;surfi>=0;surfi--) free(m->head.surfs[surfi].tris);
for (surfi--; surfi>=0; surfi--) free(m->head.surfs[surfi].tris);
if (m->head.tags) free(m->head.tags); free(m->head.frames); free(m); return(0);
}
s->shaders = (md3shader_t *)(((intptr_t)s->tris)+leng[0]);
@ -1470,21 +1469,21 @@ static md3model_t *md3load(int32_t fil)
{
int32_t *l;
for (i=s->numtris-1;i>=0;i--)
for (i=s->numtris-1; i>=0; i--)
{
for (j=2;j>=0;j--) s->tris[i].i[j] = B_LITTLE32(s->tris[i].i[j]);
for (j=2; j>=0; j--) s->tris[i].i[j] = B_LITTLE32(s->tris[i].i[j]);
}
for (i=s->numshaders-1;i>=0;i--)
for (i=s->numshaders-1; i>=0; i--)
{
s->shaders[i].i = B_LITTLE32(s->shaders[i].i);
}
for (i=s->numverts-1;i>=0;i--)
for (i=s->numverts-1; i>=0; i--)
{
l = (int32_t*)&s->uv[i].u;
l[0] = B_LITTLE32(l[0]);
l[1] = B_LITTLE32(l[1]);
}
for (i=s->numframes*s->numverts-1;i>=0;i--)
for (i=s->numframes*s->numverts-1; i>=0; i--)
{
s->xyzn[i].x = (int16_t)B_LITTLE16((uint16_t)s->xyzn[i].x);
s->xyzn[i].y = (int16_t)B_LITTLE16((uint16_t)s->xyzn[i].y);
@ -1504,19 +1503,19 @@ static md3model_t *md3load(int32_t fil)
int32_t j, bsc;
strcpy(st,filnam);
for (i=0,j=0;st[i];i++) if ((st[i] == '/') || (st[i] == '\\')) j = i+1;
for (i=0,j=0; st[i]; i++) if ((st[i] == '/') || (st[i] == '\\')) j = i+1;
st[j] = '*'; st[j+1] = 0;
kzfindfilestart(st); bsc = -1;
while (kzfindfile(st))
{
if (st[0] == '\\') continue;
for (i=0,j=0;st[i];i++) if (st[i] == '.') j = i+1;
for (i=0,j=0; st[i]; i++) if (st[i] == '.') j = i+1;
if ((!stricmp(&st[j],"JPG")) || (!stricmp(&st[j],"PNG")) || (!stricmp(&st[j],"GIF")) ||
(!stricmp(&st[j],"PCX")) || (!stricmp(&st[j],"TGA")) || (!stricmp(&st[j],"BMP")) ||
(!stricmp(&st[j],"CEL")))
{
for (i=0;st[i];i++) if (st[i] != filnam[i]) break;
for (i=0; st[i]; i++) if (st[i] != filnam[i]) break;
if (i > bsc) { bsc = i; strcpy(bst,st); }
}
}
@ -1705,7 +1704,7 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
if (alphahackarray[globalpicnum] != 0)
al=alphahackarray[globalpicnum];
/*if (!peelcompiling)*/
bglEnable(GL_BLEND);
bglEnable(GL_BLEND);
bglEnable(GL_ALPHA_TEST);
bglAlphaFunc(GL_GREATER,al);
}
@ -1738,7 +1737,7 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
k2 = (float)sintable[(spriteext[tspr->owner].roll+512)&2047] / 16384.0;
k3 = (float)sintable[spriteext[tspr->owner].roll&2047] / 16384.0;
}
for (surfi=0;surfi<m->head.numsurfs;surfi++)
for (surfi=0; surfi<m->head.numsurfs; surfi++)
{
s = &m->head.surfs[surfi];
v0 = &s->xyzn[m->cframe*s->numverts];
@ -1754,7 +1753,7 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
vertexhandle = (point3d *)vbotemp;
}
for (i=s->numverts-1;i>=0;i--)
for (i=s->numverts-1; i>=0; i--)
{
if (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll || m->head.flags == 1337)
{
@ -1889,7 +1888,7 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
//PLAG: delayed polygon-level sorted rendering
if (m->usesalpha && !(tspr->cstat & 1024)/* && !r_depthpeeling*/)
{
for (i=s->numtris-1;i>=0;i--)
for (i=s->numtris-1; i>=0; i--)
{
// Matrix multiplication - ugly but clear
fp.x = (vertlist[s->tris[i].i[0]].x * mat[0]) + (vertlist[s->tris[i].i[0]].y * mat[4]) + (vertlist[s->tris[i].i[0]].z * mat[8]) + mat[12];
@ -1923,15 +1922,15 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
if (r_vertexarrays)
{
k = 0;
for (i=s->numtris-1;i>=0;i--)
for (j=0;j<3;j++)
for (i=s->numtris-1; i>=0; i--)
for (j=0; j<3; j++)
indexhandle[k++] = s->tris[m->indexes[i]].i[j];
}
else
{
bglBegin(GL_TRIANGLES);
for (i=s->numtris-1;i>=0;i--)
for (j=0;j<3;j++)
for (i=s->numtris-1; i>=0; i--)
for (j=0; j<3; j++)
{
k = s->tris[m->indexes[i]].i[j];
if (texunits > GL_TEXTURE0_ARB)
@ -1952,15 +1951,15 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
if (r_vertexarrays)
{
k = 0;
for (i=s->numtris-1;i>=0;i--)
for (j=0;j<3;j++)
for (i=s->numtris-1; i>=0; i--)
for (j=0; j<3; j++)
indexhandle[k++] = s->tris[i].i[j];
}
else
{
bglBegin(GL_TRIANGLES);
for (i=s->numtris-1;i>=0;i--)
for (j=0;j<3;j++)
for (i=s->numtris-1; i>=0; i--)
for (j=0; j<3; j++)
{
k = s->tris[i].i[j];
if (texunits > GL_TEXTURE0_ARB)
@ -2073,14 +2072,14 @@ static void md3free(md3model_t *m)
if (sk->palmap)
{
//_initprintf("Kill %d\n",sk->palette);
free(sk->palmap);sk->palmap=0;
free(sk->palmap); sk->palmap=0;
}
free(sk);
}
if (m->head.surfs)
{
for (surfi=m->head.numsurfs-1;surfi>=0;surfi--)
for (surfi=m->head.numsurfs-1; surfi>=0; surfi--)
{
s = &m->head.surfs[surfi];
if (s->tris) free(s->tris);
@ -2142,7 +2141,7 @@ unsigned gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i
cptr = (char*)&britable[gammabrightness ? 0 : curbrightness][0];
if (!is8bit)
{
for (i=xsiz*ysiz-1;i>=0;i--)
for (i=xsiz*ysiz-1; i>=0; i--)
{
pic2[i].b = cptr[pic[i].r];
pic2[i].g = cptr[pic[i].g];
@ -2153,7 +2152,7 @@ unsigned gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i
else
{
if (palookup[dapal] == NULL) dapal = 0;
for (i=xsiz*ysiz-1;i>=0;i--)
for (i=xsiz*ysiz-1; i>=0; i--)
{
pic2[i].b = cptr[palette[(int32_t)palookup[dapal][pic[i].a]*3+2]*4];
pic2[i].g = cptr[palette[(int32_t)palookup[dapal][pic[i].a]*3+1]*4];
@ -2174,7 +2173,7 @@ unsigned gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i
static int32_t getvox(int32_t x, int32_t y, int32_t z)
{
z += x*yzsiz + y*zsiz;
for (x=vcolhashead[(z*214013)&vcolhashsizm1];x>=0;x=vcol[x].n)
for (x=vcolhashead[(z*214013)&vcolhashsizm1]; x>=0; x=vcol[x].n)
if (vcol[x].p == z) return(vcol[x].c);
return(0x808080);
}
@ -2196,7 +2195,7 @@ static void setzrange0(int32_t *lptr, int32_t z0, int32_t z1)
int32_t z, ze;
if (!((z0^z1)&~31)) { lptr[z0>>5] &= ((~(-1<<SHIFTMOD32(z0)))|(-1<<SHIFTMOD32(z1))); return; }
z = (z0>>5); ze = (z1>>5);
lptr[z] &=~(-1<<SHIFTMOD32(z0)); for (z++;z<ze;z++) lptr[z] = 0;
lptr[z] &=~(-1<<SHIFTMOD32(z0)); for (z++; z<ze; z++) lptr[z] = 0;
lptr[z] &= (-1<<SHIFTMOD32(z1));
}
#endif
@ -2206,7 +2205,7 @@ static void setzrange1(int32_t *lptr, int32_t z0, int32_t z1)
int32_t z, ze;
if (!((z0^z1)&~31)) { lptr[z0>>5] |= ((~(-1<<SHIFTMOD32(z1)))&(-1<<SHIFTMOD32(z0))); return; }
z = (z0>>5); ze = (z1>>5);
lptr[z] |= (-1<<SHIFTMOD32(z0)); for (z++;z<ze;z++) lptr[z] = -1;
lptr[z] |= (-1<<SHIFTMOD32(z0)); for (z++; z<ze; z++) lptr[z] = -1;
lptr[z] |=~(-1<<SHIFTMOD32(z1));
}
@ -2215,20 +2214,20 @@ static int32_t isrectfree(int32_t x0, int32_t y0, int32_t dx, int32_t dy)
#if 0
int32_t i, j, x;
i = y0*gvox->mytexx + x0;
for (dy=0;dy;dy--,i+=gvox->mytexx)
for (x=0;x<dx;x++) { j = i+x; if (zbit[j>>5]&(1<<SHIFTMOD32(j))) return(0); }
for (dy=0; dy; dy--,i+=gvox->mytexx)
for (x=0; x<dx; x++) { j = i+x; if (zbit[j>>5]&(1<<SHIFTMOD32(j))) return(0); }
#else
int32_t i, c, m, m1, x;
i = y0*mytexo5 + (x0>>5); dx += x0-1; c = (dx>>5) - (x0>>5);
m = ~pow2m1[x0&31]; m1 = pow2m1[(dx&31)+1];
if (!c) { for (m&=m1;dy;dy--,i+=mytexo5) if (zbit[i]&m) return(0); }
if (!c) { for (m&=m1; dy; dy--,i+=mytexo5) if (zbit[i]&m) return(0); }
else
{
for (;dy;dy--,i+=mytexo5)
for (; dy; dy--,i+=mytexo5)
{
if (zbit[i]&m) return(0);
for (x=1;x<c;x++) if (zbit[i+x]) return(0);
for (x=1; x<c; x++) if (zbit[i+x]) return(0);
if (zbit[i+x]&m1) return(0);
}
}
@ -2241,20 +2240,20 @@ static void setrect(int32_t x0, int32_t y0, int32_t dx, int32_t dy)
#if 0
int32_t i, j, y;
i = y0*gvox->mytexx + x0;
for (y=0;y<dy;y++,i+=gvox->mytexx)
for (x=0;x<dx;x++) { j = i+x; zbit[j>>5] |= (1<<SHIFTMOD32(j)); }
for (y=0; y<dy; y++,i+=gvox->mytexx)
for (x=0; x<dx; x++) { j = i+x; zbit[j>>5] |= (1<<SHIFTMOD32(j)); }
#else
int32_t i, c, m, m1, x;
i = y0*mytexo5 + (x0>>5); dx += x0-1; c = (dx>>5) - (x0>>5);
m = ~pow2m1[x0&31]; m1 = pow2m1[(dx&31)+1];
if (!c) { for (m&=m1;dy;dy--,i+=mytexo5) zbit[i] |= m; }
if (!c) { for (m&=m1; dy; dy--,i+=mytexo5) zbit[i] |= m; }
else
{
for (;dy;dy--,i+=mytexo5)
for (; dy; dy--,i+=mytexo5)
{
zbit[i] |= m;
for (x=1;x<c;x++) zbit[i+x] = -1;
for (x=1; x<c; x++) zbit[i+x] = -1;
zbit[i+x] |= m1;
}
}
@ -2307,8 +2306,8 @@ static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1,
case 5:
nx = x0; break;
}
for (yy=0;yy<y;yy++,lptr+=gvox->mytexx)
for (xx=0;xx<x;xx++)
for (yy=0; yy<y; yy++,lptr+=gvox->mytexx)
for (xx=0; xx<x; xx++)
{
switch (face)
{
@ -2341,14 +2340,14 @@ static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1,
}
//Extend borders horizontally
for (yy=VOXBORDWIDTH;yy<y+VOXBORDWIDTH;yy++)
for (xx=0;xx<VOXBORDWIDTH;xx++)
for (yy=VOXBORDWIDTH; yy<y+VOXBORDWIDTH; yy++)
for (xx=0; xx<VOXBORDWIDTH; xx++)
{
lptr = &gvox->mytex[(shp[z].y+yy)*gvox->mytexx+shp[z].x];
lptr[xx] = lptr[VOXBORDWIDTH]; lptr[xx+x+VOXBORDWIDTH] = lptr[x-1+VOXBORDWIDTH];
}
//Extend borders vertically
for (yy=0;yy<VOXBORDWIDTH;yy++)
for (yy=0; yy<VOXBORDWIDTH; yy++)
{
memcpy(&gvox->mytex[(shp[z].y+yy)*gvox->mytexx+shp[z].x],
&gvox->mytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx+shp[z].x],
@ -2362,7 +2361,7 @@ static void addquad(int32_t x0, int32_t y0, int32_t z0, int32_t x1, int32_t y1,
qptr->v[0].x = x0; qptr->v[0].y = y0; qptr->v[0].z = z0;
qptr->v[1].x = x1; qptr->v[1].y = y1; qptr->v[1].z = z1;
qptr->v[2].x = x2; qptr->v[2].y = y2; qptr->v[2].z = z2;
for (j=0;j<3;j++) { qptr->v[j].u = shp[z].x+VOXBORDWIDTH; qptr->v[j].v = shp[z].y+VOXBORDWIDTH; }
for (j=0; j<3; j++) { qptr->v[j].u = shp[z].x+VOXBORDWIDTH; qptr->v[j].v = shp[z].y+VOXBORDWIDTH; }
if (i < 3) qptr->v[1].u += x; else qptr->v[1].v += y;
qptr->v[2].u += x; qptr->v[2].v += y;
@ -2401,14 +2400,14 @@ static voxmodel_t *vox2poly()
memset(shcntmal,0,i); shcnt = &shcntmal[-shcntp-1];
gmaxx = gmaxy = garea = 0;
if (pow2m1[32] != -1) { for (i=0;i<32;i++) pow2m1[i] = (1<<i)-1; pow2m1[32] = -1; }
for (i=0;i<7;i++) gvox->qfacind[i] = -1;
if (pow2m1[32] != -1) { for (i=0; i<32; i++) pow2m1[i] = (1<<i)-1; pow2m1[32] = -1; }
for (i=0; i<7; i++) gvox->qfacind[i] = -1;
i = ((max(ysiz,zsiz)+1)<<2);
bx0 = (int32_t *)malloc(i<<1); if (!bx0) { free(gvox); return(0); }
by0 = (int32_t *)(((intptr_t)bx0)+i);
for (cnt=0;cnt<2;cnt++)
for (cnt=0; cnt<2; cnt++)
{
if (!cnt) daquad = cntquad;
else daquad = addquad;
@ -2416,10 +2415,10 @@ static voxmodel_t *vox2poly()
memset(by0,-1,(max(ysiz,zsiz)+1)<<2); v = 0;
for (i=-1;i<=1;i+=2)
for (y=0;y<ysiz;y++)
for (x=0;x<=xsiz;x++)
for (z=0;z<=zsiz;z++)
for (i=-1; i<=1; i+=2)
for (y=0; y<ysiz; y++)
for (x=0; x<=xsiz; x++)
for (z=0; z<=zsiz; z++)
{
ov = v; v = (isolid(x,y,z) && (!isolid(x,y+i,z)));
if ((by0[z] >= 0) && ((by0[z] != oz) || (v >= ov)))
@ -2427,10 +2426,10 @@ static voxmodel_t *vox2poly()
if (v > ov) oz = z; else if ((v < ov) && (by0[z] != oz)) { bx0[z] = x; by0[z] = oz; }
}
for (i=-1;i<=1;i+=2)
for (z=0;z<zsiz;z++)
for (x=0;x<=xsiz;x++)
for (y=0;y<=ysiz;y++)
for (i=-1; i<=1; i+=2)
for (z=0; z<zsiz; z++)
for (x=0; x<=xsiz; x++)
for (y=0; y<=ysiz; y++)
{
ov = v; v = (isolid(x,y,z) && (!isolid(x,y,z-i)));
if ((by0[y] >= 0) && ((by0[y] != oz) || (v >= ov)))
@ -2438,10 +2437,10 @@ static voxmodel_t *vox2poly()
if (v > ov) oz = y; else if ((v < ov) && (by0[y] != oz)) { bx0[y] = x; by0[y] = oz; }
}
for (i=-1;i<=1;i+=2)
for (x=0;x<xsiz;x++)
for (y=0;y<=ysiz;y++)
for (z=0;z<=zsiz;z++)
for (i=-1; i<=1; i+=2)
for (x=0; x<xsiz; x++)
for (y=0; y<=ysiz; y++)
for (z=0; z<=zsiz; z++)
{
ov = v; v = (isolid(x,y,z) && (!isolid(x-i,y,z)));
if ((by0[z] >= 0) && ((by0[z] != oz) || (v >= ov)))
@ -2455,15 +2454,15 @@ static voxmodel_t *vox2poly()
if (!shp) { free(bx0); free(gvox); return(0); }
sc = 0;
for (y=gmaxy;y;y--)
for (x=gmaxx;x>=y;x--)
for (y=gmaxy; y; y--)
for (x=gmaxx; x>=y; x--)
{
i = shcnt[y*shcntp+x]; shcnt[y*shcntp+x] = sc; //shcnt changes from counter to head index
for (;i>0;i--) { shp[sc].x = x; shp[sc].y = y; sc++; }
for (; i>0; i--) { shp[sc].x = x; shp[sc].y = y; sc++; }
}
for (gvox->mytexx=32;gvox->mytexx<(gmaxx+(VOXBORDWIDTH<<1));gvox->mytexx<<=1);
for (gvox->mytexy=32;gvox->mytexy<(gmaxy+(VOXBORDWIDTH<<1));gvox->mytexy<<=1);
for (gvox->mytexx=32; gvox->mytexx<(gmaxx+(VOXBORDWIDTH<<1)); gvox->mytexx<<=1);
for (gvox->mytexy=32; gvox->mytexy<(gmaxy+(VOXBORDWIDTH<<1)); gvox->mytexy<<=1);
while (gvox->mytexx*gvox->mytexy*8 < garea*9) //This should be sufficient to fit most skins...
{
skindidntfit:
@ -2477,7 +2476,7 @@ skindidntfit:
memset(zbit,0,i);
v = gvox->mytexx*gvox->mytexy;
for (z=0;z<sc;z++)
for (z=0; z<sc; z++)
{
dx = shp[z].x+(VOXBORDWIDTH<<1); dy = shp[z].y+(VOXBORDWIDTH<<1); i = v;
do
@ -2496,14 +2495,14 @@ skindidntfit:
//Re-generate shp[].x/y (box sizes) from shcnt (now head indices) for next pass :/
j = 0;
for (y=gmaxy;y;y--)
for (x=gmaxx;x>=y;x--)
for (y=gmaxy; y; y--)
for (x=gmaxx; x>=y; x--)
{
i = shcnt[y*shcntp+x];
for (;j<i;j++) { shp[j].x = x0; shp[j].y = y0; }
for (; j<i; j++) { shp[j].x = x0; shp[j].y = y0; }
x0 = x; y0 = y;
}
for (;j<sc;j++) { shp[j].x = x0; shp[j].y = y0; }
for (; j<sc; j++) { shp[j].x = x0; shp[j].y = y0; }
goto skindidntfit;
}
@ -2540,7 +2539,7 @@ static int32_t loadvox(const char *filnam)
zpiv = ((float)zsiz)*.5;
klseek(fil,-768,SEEK_END);
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{ kread(fil,c,3); pal[i] = (((int32_t)c[0])<<18)+(((int32_t)c[1])<<10)+(((int32_t)c[2])<<2)+(i<<24); }
pal[255] = -1;
@ -2555,20 +2554,20 @@ static int32_t loadvox(const char *filnam)
tbuf = (char *)malloc(zsiz*sizeof(uint8_t)); if (!tbuf) { kclose(fil); return(-1); }
klseek(fil,12,SEEK_SET);
for (x=0;x<xsiz;x++)
for (y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
for (x=0; x<xsiz; x++)
for (y=0,j=x*yzsiz; y<ysiz; y++,j+=zsiz)
{
kread(fil,tbuf,zsiz);
for (z=zsiz-1;z>=0;z--)
for (z=zsiz-1; z>=0; z--)
{ if (tbuf[z] != 255) { i = j+z; vbit[i>>5] |= (1<<SHIFTMOD32(i)); } }
}
klseek(fil,12,SEEK_SET);
for (x=0;x<xsiz;x++)
for (y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
for (x=0; x<xsiz; x++)
for (y=0,j=x*yzsiz; y<ysiz; y++,j+=zsiz)
{
kread(fil,tbuf,zsiz);
for (z=0;z<zsiz;z++)
for (z=0; z<zsiz; z++)
{
if (tbuf[z] == 255) continue;
if ((!x) || (!y) || (!z) || (x == xsiz-1) || (y == ysiz-1) || (z == zsiz-1))
@ -2608,14 +2607,14 @@ static int32_t loadkvx(const char *filnam)
kread(fil,xyoffs,i); for (i=i/sizeof(int16_t)-1; i>=0; i--) xyoffs[i] = B_LITTLE16(xyoffs[i]);
klseek(fil,-768,SEEK_END);
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{ kread(fil,c,3); pal[i] = B_LITTLE32((((int32_t)c[0])<<18)+(((int32_t)c[1])<<10)+(((int32_t)c[2])<<2)+(i<<24)); }
yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3);
vbit = (int32_t *)malloc(i); if (!vbit) { free(xyoffs); kclose(fil); return(-1); }
memset(vbit,0,i);
for (vcolhashsizm1=4096;vcolhashsizm1<(mip1leng>>1);vcolhashsizm1<<=1); vcolhashsizm1--; //approx to numvoxs!
for (vcolhashsizm1=4096; vcolhashsizm1<(mip1leng>>1); vcolhashsizm1<<=1); vcolhashsizm1--; //approx to numvoxs!
vcolhashead = (int32_t *)malloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { free(xyoffs); kclose(fil); return(-1); }
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t));
@ -2626,8 +2625,8 @@ static int32_t loadkvx(const char *filnam)
kread(fil,tbuf,i); kclose(fil);
cptr = tbuf;
for (x=0;x<xsiz;x++) //Set surface voxels to 1 else 0
for (y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
for (x=0; x<xsiz; x++) //Set surface voxels to 1 else 0
for (y=0,j=x*yzsiz; y<ysiz; y++,j+=zsiz)
{
i = xyoffs[x*ysizp1+y+1] - xyoffs[x*ysizp1+y]; if (!i) continue;
z1 = 0;
@ -2637,7 +2636,7 @@ static int32_t loadkvx(const char *filnam)
if (!(cptr[-1]&16)) setzrange1(vbit,j+z1,j+z0);
i -= k+3; z1 = z0+k;
setzrange1(vbit,j+z0,j+z1);
for (z=z0;z<z1;z++) putvox(x,y,z,pal[*cptr++]);
for (z=z0; z<z1; z++) putvox(x,y,z,pal[*cptr++]);
}
}
@ -2671,15 +2670,15 @@ static int32_t loadkv6(const char *filnam)
vbit = (int32_t *)malloc(i); if (!vbit) { free(ylen); kclose(fil); return(-1); }
memset(vbit,0,i);
for (vcolhashsizm1=4096;vcolhashsizm1<numvoxs;vcolhashsizm1<<=1); vcolhashsizm1--;
for (vcolhashsizm1=4096; vcolhashsizm1<numvoxs; vcolhashsizm1<<=1); vcolhashsizm1--;
vcolhashead = (int32_t *)malloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { free(ylen); kclose(fil); return(-1); }
memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t));
for (x=0;x<xsiz;x++)
for (y=0,j=x*yzsiz;y<ysiz;y++,j+=zsiz)
for (x=0; x<xsiz; x++)
for (y=0,j=x*yzsiz; y<ysiz; y++,j+=zsiz)
{
z1 = zsiz;
for (i=ylen[x*ysiz+y];i>0;i--)
for (i=ylen[x*ysiz+y]; i>0; i--)
{
kread(fil,c,8); //b,g,r,a,z_lo,z_hi,vis,dir
z0 = B_LITTLE16(*(uint16_t *)&c[4]);
@ -2725,16 +2724,16 @@ static int32_t loadvxl(const char *filnam)
kclose(fil);
v = vbuf;
for (y=0;y<ysiz;y++)
for (x=0,j=y*zsiz;x<xsiz;x++,j+=yzsiz)
for (y=0; y<ysiz; y++)
for (x=0,j=y*zsiz; x<xsiz; x++,j+=yzsiz)
{
z = 0;
while (1)
{
setzrange0(vbit,j+z,j+v[1]);
for (z=v[1];z<=v[2];z++) putvox(x,y,z,(*(int32_t *)&v[(z-v[1]+1)<<2])&0xffffff);
for (z=v[1]; z<=v[2]; z++) putvox(x,y,z,(*(int32_t *)&v[(z-v[1]+1)<<2])&0xffffff);
if (!v[0]) break; z = v[2]-v[1]-v[0]+2; v += v[0]*4;
for (z+=v[3];z<v[3];z++) putvox(x,y,z,(*(int32_t *)&v[(z-v[3])<<2])&0xffffff);
for (z+=v[3]; z<v[3]; z++) putvox(x,y,z,(*(int32_t *)&v[(z-v[3])<<2])&0xffffff);
}
v += ((((int32_t)v[2])-((int32_t)v[1])+2)<<2);
}
@ -2895,7 +2894,7 @@ int32_t voxdraw(voxmodel_t *m, spritetype *tspr)
if (!m->texid[globalpal]) m->texid[globalpal] = gloadtex(m->mytex,m->mytexx,m->mytexy,m->is8bit,globalpal);
else bglBindTexture(GL_TEXTURE_2D,m->texid[globalpal]);
bglBegin(GL_QUADS);
for (i=0,fi=0;i<m->qcnt;i++)
for (i=0,fi=0; i<m->qcnt; i++)
{
if (i == m->qfacind[fi]) { f = clut[fi++]; bglColor4f(pc[0]*f,pc[1]*f,pc[2]*f,pc[3]*f); }
vptr = &m->quad[i].v[0];
@ -2904,7 +2903,7 @@ int32_t voxdraw(voxmodel_t *m, spritetype *tspr)
yy = vptr[0].y+vptr[2].y;
zz = vptr[0].z+vptr[2].z;
for (j=0;j<4;j++)
for (j=0; j<4; j++)
{
#if (VOXBORDWIDTH == 0)
bglTexCoord2f(((float)vptr[j].u)*ru+uhack[vptr[j].u!=vptr[0].u],

View file

@ -99,8 +99,7 @@ int32_t nfCheckCP(int32_t other) //Check if target player is our current NatFre
{
if (!natfree || nfFinished)
return 1;
else
if (nfCurrentPlayer == other) return 1;
else if (nfCurrentPlayer == other) return 1;
return 0;
}
@ -254,7 +253,7 @@ int32_t netread(int32_t *other, char *dabuf, int32_t bufsiz) //0:no packets in
snatchip = (int32_t)ip.sin_addr.s_addr; snatchport = (int32_t)ip.sin_port;
(*other) = myconnectindex;
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
if ((otherip[i] == snatchip) && (otherport[i] == snatchport))
{(*other) = i; break; }
@ -304,14 +303,14 @@ int32_t isvalidipaddress(char *st)
int32_t i, bcnt, num;
bcnt = 0; num = 0;
for (i=0;st[i];i++)
for (i=0; st[i]; i++)
{
if (st[i] == '.') { bcnt++; num = 0; continue; }
if (st[i] == ':')
{
if (bcnt != 3) return(0);
num = 0;
for (i++;st[i];i++)
for (i++; st[i]; i++)
{
if ((st[i] >= '0') && (st[i] <= '9'))
{ num = num*10+st[i]-'0'; if (num >= 65536) return(0); }
@ -346,9 +345,9 @@ static int32_t crctab16[256];
static void initcrc16()
{
int32_t i, j, k, a;
for (j=0;j<256;j++)
for (j=0; j<256; j++)
{
for (i=7,k=(j<<8),a=0;i>=0;i--,k=((k<<1)&65535))
for (i=7,k=(j<<8),a=0; i>=0; i--,k=((k<<1)&65535))
{
if ((k^a)&0x8000) a = ((a<<1)&65535)^0x1021;
else a = ((a<<1)&65535);
@ -362,7 +361,7 @@ static uint16_t getcrc16(char *buffer, int32_t bufleng)
int32_t i, j;
j = 0;
for (i=bufleng-1;i>=0;i--) updatecrc16(j,buffer[i]);
for (i=bufleng-1; i>=0; i--) updatecrc16(j,buffer[i]);
return((uint16_t)(j&65535));
}
@ -385,11 +384,11 @@ static void initmultiplayers_reset(void)
#endif
lastsendtims[0] = GetTickCount();
for (i=1;i<MAXPLAYERS;i++) lastsendtims[i] = lastsendtims[0];
for (i=1; i<MAXPLAYERS; i++) lastsendtims[i] = lastsendtims[0];
numplayers = 1; myconnectindex = 0;
memset(otherip,0,sizeof(otherip));
for (i=0;i<MAXPLAYERS;i++) otherport[i] = htons(NETPORT);
for (i=0; i<MAXPLAYERS; i++) otherport[i] = htons(NETPORT);
}
// Multiplayer command line summary. Assume myconnectindex always = 0 for 192.168.1.2
@ -413,7 +412,7 @@ int32_t initmultiplayersparms(int32_t argc, char **argv)
// if (!argv) return 0;
// go looking for the port, if specified
for (i=0;i<argc;i++)
for (i=0; i<argc; i++)
{
if (argv[i][0] != '-' && argv[i][0] != '/') continue;
if ((argv[i][1] == 'p' || argv[i][1] == 'P') && argv[i][2])
@ -428,7 +427,7 @@ int32_t initmultiplayersparms(int32_t argc, char **argv)
netinit(portnum);
for (i=0;i<argc;i++)
for (i=0; i<argc; i++)
{
//if (((argv[i][0] == '/') || (argv[i][0] == '-')) &&
// ((argv[i][1] == 'N') || (argv[i][1] == 'n')) &&
@ -469,7 +468,7 @@ int32_t initmultiplayersparms(int32_t argc, char **argv)
if (isvalidipaddress(st))
{
if ((danetmode == 1) && (daindex == myconnectindex)) daindex++;
for (j=0;st[j];j++)
for (j=0; st[j]; j++)
{
if (st[j] == ':')
{ otherport[daindex] = htons((uint16_t)atol(&st[j+1])); st[j] = 0; break; }
@ -483,7 +482,7 @@ int32_t initmultiplayersparms(int32_t argc, char **argv)
LPHOSTENT lph;
uint16_t pt = htons(NETPORT);
for (j=0;st[j];j++)
for (j=0; st[j]; j++)
if (st[j] == ':')
{ pt = htons((uint16_t)atol(&st[j+1])); st[j] = 0; break; }
if ((lph = gethostbyname(st)))
@ -507,7 +506,7 @@ int32_t initmultiplayersparms(int32_t argc, char **argv)
// printf("Player %d: %d.%d.%d.%d:%d\n",i,otherip[i]&255,(otherip[i]>>8)&255,(otherip[i]>>16)&255,((uint32_t)otherip[i])>>24,ntohs(otherport[i]));
connecthead = 0;
for (i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
for (i=0; i<numplayers-1; i++) connectpoint2[i] = i+1;
connectpoint2[numplayers-1] = -1;
// return (((!danetmode) && (numplayers >= 2)) || (numplayers == 2));
@ -526,7 +525,7 @@ int32_t initmultiplayerscycle(void)
tims = GetTickCount();
if (myconnectindex == connecthead) //Player 0 only
{
for (i=numplayers-1;i>0;i--)
for (i=numplayers-1; i>0; i--)
if (!otherip[i]) break;
if (!i)
{
@ -586,7 +585,7 @@ void mmulti_initmultiplayers(int32_t argc, char **argv, char damultioption, char
{
otims = tims;
sprintf(tbuf,"\rWait for players (%d/%d): ",myconnectindex,numplayers);
for (i=0;i<numplayers;i++)
for (i=0; i<numplayers; i++)
{
if (i == myconnectindex) { strcat(tbuf,"<me> "); continue; }
if (!otherip[i]) { strcat(tbuf,"?.?.?.?:? "); continue; }
@ -629,13 +628,13 @@ void mmulti_dosendpackets(int32_t other) //Host to send intially, client to sen
k = 2;
*(int32_t *)&pakbuf[k] = icnt0[other]; k += 4;
memset(&pakbuf[k],0,32);
for (i=icnt0[other];i<icnt0[other]+256;i++)
for (i=icnt0[other]; i<icnt0[other]+256; i++)
if (ipak[other][i&(FIFSIZ-1)])
pakbuf[((i-icnt0[other])>>3)+k] |= (1<<((i-icnt0[other])&7));
k += 32;
while ((ocnt0[other] < ocnt1[other]) && (!opak[other][ocnt0[other]&(FIFSIZ-1)])) ocnt0[other]++;
for (i=ocnt0[other];i<ocnt1[other];i++)
for (i=ocnt0[other]; i<ocnt1[other]; i++)
{
j = *(int16_t *)&pakmem[opak[other][i&(FIFSIZ-1)]]; if (!j) continue; //packet already acked
if (k+6+j+4 > (int32_t)sizeof(pakbuf)) break;
@ -683,7 +682,7 @@ int32_t mmulti_getpacket(int32_t *retother, char *bufptr)
if (netready)
{
for (i=connecthead;i>=0;i=connectpoint2[i])
for (i=connecthead; i>=0; i=connectpoint2[i])
{
if (i != myconnectindex) mmulti_dosendpackets(i);
if ((!danetmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
@ -716,7 +715,7 @@ int32_t mmulti_getpacket(int32_t *retother, char *bufptr)
//Master responds to slave with 0xab whenever it receives a 0xaa - even if during game!
if ((pakbuf[k] == 0xaa) && (myconnectindex == connecthead))
{
for (other=1;other<numplayers;other++)
for (other=1; other<numplayers; other++)
{
//Only send to others asking for a response
if ((otherip[other]) && ((otherip[other] != snatchip) || (otherport[other] != snatchport))) continue;
@ -758,7 +757,7 @@ int32_t mmulti_getpacket(int32_t *retother, char *bufptr)
numplayers = (int32_t)pakbuf[k+2];
connecthead = 0;
for (i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
for (i=0; i<numplayers-1; i++) connectpoint2[i] = i+1;
connectpoint2[numplayers-1] = -1;
otherip[connecthead] = snatchip;
@ -780,7 +779,7 @@ int32_t mmulti_getpacket(int32_t *retother, char *bufptr)
else
{
if (ocnt0[other] < ic0) ocnt0[other] = ic0;
for (i=ic0;i<min(ic0+256,ocnt1[other]);i++)
for (i=ic0; i<min(ic0+256,ocnt1[other]); i++)
if (pakbuf[((i-ic0)>>3)+k]&(1<<((i-ic0)&7)))
opak[other][i&(FIFSIZ-1)] = 0;
k += 32;
@ -805,7 +804,7 @@ int32_t mmulti_getpacket(int32_t *retother, char *bufptr)
//Return next valid packet from any player
if (!bufptr) return(0);
for (i=connecthead;i>=0;i=connectpoint2[i])
for (i=connecthead; i>=0; i=connectpoint2[i])
{
if (i != myconnectindex)
{
@ -897,7 +896,7 @@ int32_t getexternaladdress(char *buffer, const char *host, int32_t port)
recv(mysock, (char *)&tempbuf, sizeof(tempbuf), 0);
closesocket(mysock);
j = Bstrlen(text);
for (i=Bstrlen(tempbuf);i>0;i--)
for (i=Bstrlen(tempbuf); i>0; i--)
if (!Bstrncmp(&tempbuf[i], text, j))
{
i += j;

View file

@ -146,10 +146,10 @@ void initcrc(void)
{
int32_t i, j, k, a;
for (j=0;j<256;j++) /* Calculate CRC table */
for (j=0; j<256; j++) /* Calculate CRC table */
{
k = (j<<8); a = 0;
for (i=7;i>=0;i--)
for (i=7; i>=0; i--)
{
if (((k^a)&0x8000) > 0)
a = ((a<<1)&65535) ^ 0x1021; /* 0x1021 = genpoly */
@ -167,7 +167,7 @@ int32_t getcrc(char *buffer, int32_t bufleng)
int32_t i, j;
j = 0;
for (i=bufleng-1;i>=0;i--) updatecrc16(j,buffer[i]);
for (i=bufleng-1; i>=0; i--) updatecrc16(j,buffer[i]);
return(j&65535);
}
@ -178,7 +178,7 @@ void mmulti_initmultiplayers(int32_t argc, char **argv)
UNREFERENCED_PARAMETER(argc);
initcrc();
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
{
incnt[i] = 0L;
outcntplc[i] = 0L;
@ -226,10 +226,10 @@ void mmulti_initmultiplayers(int32_t argc, char **argv)
srand(myconnectindex*24572457+345356);
#endif
connecthead = 0;
for (i=0;i<numplayers-1;i++) connectpoint2[i] = i+1;
for (i=0; i<numplayers-1; i++) connectpoint2[i] = i+1;
connectpoint2[numplayers-1] = -1;
for (i=0;i<numplayers;i++) lastsendtime[i] = totalclock;
for (i=0; i<numplayers; i++) lastsendtime[i] = totalclock;
}
@ -257,7 +257,7 @@ void mmulti_dosendpackets(int32_t other)
j = bakpacketptr[other][outcntplc[other]&255];
messleng = bakpacketlen[other][outcntplc[other]&255];
for (i=0;i<messleng;i++)
for (i=0; i<messleng; i++)
gcom->buffer[k++] = bakpacketbuf[(i+j)&(BAKSIZ-1)];
outcntplc[other]++;
}
@ -273,14 +273,14 @@ void mmulti_dosendpackets(int32_t other)
messleng = bakpacketlen[other][outcntplc[other]&255];
gcom->buffer[k++] = (uint8_t)(messleng&255);
gcom->buffer[k++] = (uint8_t)(messleng>>8);
for (i=0;i<messleng;i++)
for (i=0; i<messleng; i++)
gcom->buffer[k++] = bakpacketbuf[(i+j)&(BAKSIZ-1)];
outcntplc[other]++;
/* Second half-packet */
j = bakpacketptr[other][outcntplc[other]&255];
messleng = bakpacketlen[other][outcntplc[other]&255];
for (i=0;i<messleng;i++)
for (i=0; i<messleng; i++)
gcom->buffer[k++] = bakpacketbuf[(i+j)&(BAKSIZ-1)];
outcntplc[other]++;
@ -295,7 +295,7 @@ void mmulti_dosendpackets(int32_t other)
#if (SHOWSENDPACKETS)
initprintf("Send(%ld): ",gcom->other);
for (i=0;i<gcom->numbytes;i++) initprintf("%2x ",gcom->buffer[i]);
for (i=0; i<gcom->numbytes; i++) initprintf("%2x ",gcom->buffer[i]);
initprintf("\n");
#endif
@ -321,7 +321,7 @@ void mmulti_sendpacket(int32_t other, char *bufptr, int32_t messleng)
if (bakpacketlen[other][(outcntend[other]-1)&255] == messleng)
{
j = bakpacketptr[other][(outcntend[other]-1)&255];
for (i=messleng-1;i>=0;i--)
for (i=messleng-1; i>=0; i--)
if (bakpacketbuf[(i+j)&(BAKSIZ-1)] != bufptr[i]) break;
}
bakpacketlen[other][outcntend[other]&255] = messleng;
@ -331,7 +331,7 @@ void mmulti_sendpacket(int32_t other, char *bufptr, int32_t messleng)
else
{
bakpacketptr[other][outcntend[other]&255] = bakpacketplc;
for (i=0;i<messleng;i++)
for (i=0; i<messleng; i++)
bakpacketbuf[(bakpacketplc+i)&(BAKSIZ-1)] = bufptr[i];
bakpacketplc = ((bakpacketplc+messleng)&(BAKSIZ-1));
}
@ -383,7 +383,7 @@ void mmulti_sendlogoff(void)
tempbuf[0] = 255;
tempbuf[1] = myconnectindex;
for (i=connecthead;i>=0;i=connectpoint2[i])
for (i=connecthead; i>=0; i=connectpoint2[i])
{
if (i != myconnectindex)
mmulti_sendpacket(i,tempbuf,2L);
@ -403,7 +403,7 @@ int32_t mmulti_getpacket(int32_t *other, char *bufptr)
if (numplayers < 2 || gcom == NULL) return(0);
for (i=connecthead;i>=0;i=connectpoint2[i])
for (i=connecthead; i>=0; i=connectpoint2[i])
{
if (i != myconnectindex)
{
@ -444,7 +444,7 @@ int32_t mmulti_getpacket(int32_t *other, char *bufptr)
if (gcom->other != -1)
{
initprintf(" Get(%ld): ",gcom->other);
for (i=0;i<gcom->numbytes;i++) initprintf("%2x ",gcom->buffer[i]);
for (i=0; i<gcom->numbytes; i++) initprintf("%2x ",gcom->buffer[i]);
initprintf("\n");
}
#endif
@ -556,7 +556,7 @@ void mmulti_flushpackets()
}
while (gcom->other >= 0);
for (i=connecthead;i>=0;i=connectpoint2[i])
for (i=connecthead; i>=0; i=connectpoint2[i])
{
incnt[i] = 0L;
outcntplc[i] = 0L;
@ -721,9 +721,9 @@ static int32_t get_udp_packet(int32_t *ip, uint16_t *_port, void *pkt, size_t pk
/* FIXME: Will this ever receive a partial packet? */
int32_t rc = recvfrom(udpsocket, pkt, pktsize, 0, (struct sockaddr *) &addr,
#ifdef _WIN32
(int32_t *)&fromlen);
(int32_t *)&fromlen);
#else
(uint32_t *)&fromlen);
(uint32_t *)&fromlen);
#endif
if (rc == -1)
@ -1095,15 +1095,15 @@ static int32_t wait_for_other_players(gcomtype *gcom, int32_t myip)
}
// found all the clients expected so relay all greetings
for (j=max;j>=0;j--)
for (j=max; j>=0; j--)
if (allowed_addresses[j].host)
{
int32_t ii;
// send another copy of our greeting just in case they missed it
send_peer_greeting(allowed_addresses[j].host,
allowed_addresses[j].port,
my_id);
allowed_addresses[j].port,
my_id);
for (ii = 0; ii < max; ii++)
send_peer_greeting(allowed_addresses[j].host,
@ -1209,9 +1209,9 @@ static int32_t connect_to_server(gcomtype *gcom, int32_t myip)
while (my_id == 0) /* player number is based on id, low to high. */
{
/* struct timeval tv;
gettimeofday(&tv, NULL);
my_id = (unsigned short)tv.tv_usec; //HACK */
/* struct timeval tv;
gettimeofday(&tv, NULL);
my_id = (unsigned short)tv.tv_usec; //HACK */
my_id = (uint16_t) rand();
}
@ -1274,7 +1274,7 @@ static int32_t connect_to_server(gcomtype *gcom, int32_t myip)
continue;
}
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
if (!heard_from[i] || heard_from[i] == B_SWAP16(packet.id)) break; // only increase once
// greeting with 0x1337 id starts the game
@ -1301,7 +1301,7 @@ static int32_t connect_to_server(gcomtype *gcom, int32_t myip)
heard_from[i] = packet.id;
initprintf("New player with id 0x%X\n",
(int32_t) packet.id);
(int32_t) packet.id);
gcom->numplayers++;
max++;
}
@ -1420,9 +1420,9 @@ static int32_t connect_to_everyone(gcomtype *gcom, int32_t myip, int32_t bcast)
while (my_id == 0) /* player number is based on id, low to high. */
{
/* struct timeval tv;
gettimeofday(&tv, NULL);
my_id = (unsigned short)tv.tv_usec; //HACK */
/* struct timeval tv;
gettimeofday(&tv, NULL);
my_id = (unsigned short)tv.tv_usec; //HACK */
my_id = (uint16_t) rand();
}
@ -1760,14 +1760,14 @@ int32_t isvalidipaddress(char *st)
int32_t i, bcnt, num;
bcnt = 0; num = 0;
for (i=0;st[i];i++)
for (i=0; st[i]; i++)
{
if (st[i] == '.') { bcnt++; num = 0; continue; }
if (st[i] == ':')
{
if (bcnt != 3) return(0);
num = 0;
for (i++;st[i];i++)
for (i++; st[i]; i++)
{
if ((st[i] >= '0') && (st[i] <= '9'))
{ num = num*10+st[i]-'0'; if (num >= 65536) return(0); }
@ -1802,7 +1802,7 @@ static int32_t parse_udp_config(int32_t argc, char **argv, gcomtype *gcom)
// if (!argv) return 0;
// go looking for the port, if specified
for (i=0;i<argc;i++)
for (i=0; i<argc; i++)
{
if (argv[i][0] != '-' && argv[i][0] != '/') continue;
if ((argv[i][1] == 'p' || argv[i][1] == 'P') && argv[i][2])
@ -1815,7 +1815,7 @@ static int32_t parse_udp_config(int32_t argc, char **argv, gcomtype *gcom)
}
}
for (i=0;i<argc;i++)
for (i=0; i<argc; i++)
{
if ((argv[i][0] == '-') || (argv[i][0] == '/'))
{
@ -1862,7 +1862,7 @@ static int32_t parse_udp_config(int32_t argc, char **argv, gcomtype *gcom)
struct hostent * lph;
uint16_t pt = BUILD_DEFAULT_UDP_PORT;
for (j=0;st[j];j++)
for (j=0; st[j]; j++)
if (st[j] == ':')
{ pt = (uint16_t)atol(&st[j+1]); st[j] = 0; break; }
if ((lph = gethostbyname(st)))

View file

@ -268,7 +268,7 @@ static void _internal_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade,
{
// find the palette index closest to white
k=0;
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{
j = ((int32_t)curpalette[i].r)+((int32_t)curpalette[i].g)+((int32_t)curpalette[i].b);
if (j > k) { k = j; white = i; }
@ -294,7 +294,7 @@ static void _internal_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, in
{
// find the palette index closest to white
k=0;
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{
j = ((int32_t)curpalette[i].r)+((int32_t)curpalette[i].g)+((int32_t)curpalette[i].b);
if (j > k) { k = j; white = i; }
@ -317,7 +317,7 @@ static void _internal_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t
{
// find the palette index closest to white
k=0;
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{
j = ((int32_t)palette[i*3])+((int32_t)palette[i*3+1])+((int32_t)palette[i*3+2]);
if (j > k) { k = j; white = i; }
@ -607,7 +607,7 @@ static int32_t _internal_osdfunc_history(const osdfuncparm_t *parm)
int32_t i, j = 0;
UNREFERENCED_PARAMETER(parm);
OSD_Printf(OSDTEXT_RED "Command history:\n");
for (i=HISTORYDEPTH-1; i>=0;i--)
for (i=HISTORYDEPTH-1; i>=0; i--)
if (osdhistorybuf[i][0])
OSD_Printf("%4d \"%s\"\n",osdhistorytotal-osdhistorysize+(++j),osdhistorybuf[i]);
return OSDCMD_OK;
@ -884,8 +884,8 @@ int32_t OSD_HandleChar(char ch)
if (!lastmatch)
{
for (i=osdeditcursor;i>0;i--) if (osdeditbuf[i-1] == ' ') break;
for (j=0;osdeditbuf[i] != ' ' && i < osdeditlen;j++,i++)
for (i=osdeditcursor; i>0; i--) if (osdeditbuf[i-1] == ' ') break;
for (j=0; osdeditbuf[i] != ' ' && i < osdeditlen; j++,i++)
osdedittmp[j] = osdeditbuf[i];
osdedittmp[j] = 0;
@ -947,10 +947,10 @@ int32_t OSD_HandleChar(char ch)
if (tabc)
{
for (i=osdeditcursor;i>0;i--) if (osdeditbuf[i-1] == ' ') break;
for (i=osdeditcursor; i>0; i--) if (osdeditbuf[i-1] == ' ') break;
osdeditlen = i;
for (j=0;tabc->name[j] && osdeditlen <= EDITLENGTH
&& (osdeditlen < commonsize);i++,j++,osdeditlen++)
for (j=0; tabc->name[j] && osdeditlen <= EDITLENGTH
&& (osdeditlen < commonsize); i++,j++,osdeditlen++)
osdeditbuf[i] = tabc->name[j];
osdeditcursor = osdeditlen;
osdeditwinend = osdeditcursor;
@ -1264,7 +1264,7 @@ void OSD_ResizeDisplay(int32_t w, int32_t h)
k = min(newcols, osdcols);
memset(newtext, 32, TEXTSIZE);
for (i=j-1;i>=0;i--)
for (i=j-1; i>=0; i--)
{
memcpy(newtext+newcols*i, osdtext+osdcols*i, k);
memcpy(newfmt+newcols*i, osdfmt+osdcols*i, k);

File diff suppressed because it is too large Load diff

View file

@ -185,14 +185,14 @@ void qinterpolatedown16(intptr_t bufptr, int32_t num, int32_t val, int32_t add)
{
// gee, I wonder who could have provided this...
int32_t i, *lptr = (int32_t *)bufptr;
for (i=0;i<num;i++) { lptr[i] = (val>>16); val += add; }
for (i=0; i<num; i++) { lptr[i] = (val>>16); val += add; }
}
void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t add)
{
// ...maybe the same person who provided this too?
int32_t i; int16_t *sptr = (int16_t *)bufptr;
for (i=0;i<num;i++) { sptr[i] = (int16_t)(val>>16); val += add; }
for (i=0; i<num; i++) { sptr[i] = (int16_t)(val>>16); val += add; }
}
void clearbuf(void *d, int32_t c, int32_t a)

View file

@ -192,8 +192,8 @@ int32_t scriptfile_getlinum(scriptfile *sf, char *ptr)
ind = ((intptr_t)ptr) - ((intptr_t)sf->textbuf);
for (stp=1;stp+stp<sf->linenum;stp+=stp); //stp = highest power of 2 less than sf->linenum
for (i=0;stp;stp>>=1)
for (stp=1; stp+stp<sf->linenum; stp+=stp); //stp = highest power of 2 less than sf->linenum
for (i=0; stp; stp>>=1)
if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp;
return(i+1); //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers
}
@ -204,10 +204,10 @@ void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen)
//Count number of lines
numcr = 1;
for (i=0;i<flen;i++)
for (i=0; i<flen; i++)
{
//detect all 4 types of carriage return (\r, \n, \r\n, \n\r :)
cr=0;if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
cr=0; if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; }
if (cr) { numcr++; continue; }
}
@ -217,10 +217,10 @@ void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen)
//Preprocess file for comments (// and /*...*/, and convert all whitespace to single spaces)
nflen = 0; ws = 0; cs = 0; numcr = 0; inquote = 0;
for (i=0;i<flen;i++)
for (i=0; i<flen; i++)
{
//detect all 4 types of carriage return (\r, \n, \r\n, \n\r :)
cr=0;if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
cr=0; if (tx[i] == '\r') { i += (tx[i+1] == '\n'); cr = 1; }
else if (tx[i] == '\n') { i += (tx[i+1] == '\r'); cr = 1; }
if (cr)
{
@ -250,9 +250,9 @@ void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen)
#if 0
//for debugging only:
printf("pre-parsed file:flen=%d,nflen=%d\n",flen,nflen);
for (i=0;i<nflen;i++) { if (tx[i] < 32) printf("_"); else printf("%c",tx[i]); }
for (i=0; i<nflen; i++) { if (tx[i] < 32) printf("_"); else printf("%c",tx[i]); }
printf("[eof]\nnumlines=%d\n",sf->linenum);
for (i=0;i<sf->linenum;i++) printf("line %d = byte %d\n",i,sf->lineoffs[i]);
for (i=0; i<sf->linenum; i++) printf("line %d = byte %d\n",i,sf->lineoffs[i]);
#endif
flen = nflen;
@ -356,7 +356,7 @@ static char * getsymbtabspace(int32_t reqd)
if (symbtablength + reqd > symbtaballoclength)
{
for (i=max(symbtaballoclength,SYMBTABSTARTSIZE);symbtablength+reqd>i;i<<=1);
for (i=max(symbtaballoclength,SYMBTABSTARTSIZE); symbtablength+reqd>i; i<<=1);
np = (char *)realloc(symbtab, i); if (!np) return NULL;
symbtab = np; symbtaballoclength = i;
}

View file

@ -401,7 +401,7 @@ int32_t initinput(void)
if (!getenv("SDL_HAS3BUTTONMOUSE")) putenv("SDL_HAS3BUTTONMOUSE=1");
#endif
if (!remapinit)
for (i=0;i<256;i++)
for (i=0; i<256; i++)
remap[i]=i;
remapinit=1;
@ -431,7 +431,7 @@ int32_t initinput(void)
{
i = SDL_NumJoysticks();
initprintf("%d joystick(s) found\n",i);
for (j=0;j<i;j++) initprintf(" %d. %s\n", j+1, SDL_JoystickName(j));
for (j=0; j<i; j++) initprintf(" %d. %s\n", j+1, SDL_JoystickName(j));
joydev = SDL_JoystickOpen(0);
if (joydev)
{
@ -805,11 +805,11 @@ void getvalidmodes(void)
pf.BitsPerPixel = cdepths[j];
pf.BytesPerPixel = cdepths[j] >> 3;
modes = SDL_ListModes(&pf, SURFACE_FLAGS
modes = SDL_ListModes(&pf, SURFACE_FLAGS
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3)
| SDL_FULLSCREEN // not implemented/working in SDL 1.3 SDL_compat.c
| SDL_FULLSCREEN // not implemented/working in SDL 1.3 SDL_compat.c
#endif
);
);
if (modes == (SDL_Rect **)0)
{
@ -821,7 +821,7 @@ void getvalidmodes(void)
{
for (i=0; defaultres[i][0]; i++)
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],1)
}
}
else
{
for (i=0; modes[i]; i++)
@ -1294,7 +1294,7 @@ void begindrawing(void)
setvlinebpl(bytesperline);
j = 0;
for (i=0;i<=ydim;i++) ylookup[i] = j, j += bytesperline;
for (i=0; i<=ydim; i++) ylookup[i] = j, j += bytesperline;
modechange=0;
}
}

View file

@ -796,7 +796,7 @@ int32_t initinput(void)
moustat=0;
memset(keystatus, 0, sizeof(keystatus));
if (!remapinit)
for (i=0;i<256;i++)
for (i=0; i<256; i++)
remap[i]=map_dik_code(i);
remapinit=1;
keyfifoplc = keyfifoend = 0;
@ -1205,12 +1205,12 @@ void releaseallbuttons(void)
if (joypresscallback)
{
for (i=0;i<32;i++)
for (i=0; i<32; i++)
if (joyb & (1<<i)) joypresscallback(i+1, 0);
}
joyb = joyblast = 0;
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{
//if (!keystatus[i]) continue;
//if (OSD_HandleKey(i, 0) != 0) {
@ -1292,7 +1292,7 @@ static const char *joyfindnameforofs(int32_t ofs)
{
int32_t i;
if (!thisjoydef) return NULL;
for (i=0;i<thisjoydef->nfeatures;i++)
for (i=0; i<thisjoydef->nfeatures; i++)
{
if (ofs == (int32_t)thisjoydef->features[i].ofs)
return Bstrdup(thisjoydef->features[i].name);
@ -1558,7 +1558,7 @@ static void GetKeyNames(void)
char tbuf[MAX_PATH];
memset(key_names,0,sizeof(key_names));
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{
ZeroMemory(&key,sizeof(key));
key.dwSize = sizeof(DIDEVICEOBJECTINSTANCE);
@ -2142,7 +2142,7 @@ int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t fo
if (!forced && (fs&1) == 0 && (nearest < 0 || validmode[nearest].xdim!=*x || validmode[nearest].ydim!=*y))
{
// check the colour depth is recognised at the very least
for (i=0;i<validmodecnt;i++)
for (i=0; i<validmodecnt; i++)
if (validmode[i].bpp == c)
return 0x7fffffffl;
return -1; // strange colour depth
@ -2192,7 +2192,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
customfs = fs;
}
for (i=0;i<NUM_INPUTS;i++) inp[i] = devacquired[i];
for (i=0; i<NUM_INPUTS; i++) inp[i] = devacquired[i];
AcquireInputDevices(0,-1);
if (hWindow && gammabrightness)
@ -2217,7 +2217,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
#if defined(USE_OPENGL) && defined(POLYMOST)
if (hGLWindow && glinfo.vsync) bwglSwapIntervalEXT(vsync);
#endif
for (i=0;i<NUM_INPUTS;i++) if (inp[i]) AcquireInputDevices(1,i);
for (i=0; i<NUM_INPUTS; i++) if (inp[i]) AcquireInputDevices(1,i);
modechange=1;
videomodereset = 0;
OSD_ResizeDisplay(xres,yres);
@ -2271,7 +2271,7 @@ static void cdsenummodes(void)
{
if (dm.dmBitsPerPel > 8)
{
for (i=0;i<nmodes;i++)
for (i=0; i<nmodes; i++)
{
if (modes[i].x == dm.dmPelsWidth
&& modes[i].y == dm.dmPelsHeight
@ -2296,7 +2296,7 @@ static void cdsenummodes(void)
dm.dmSize = sizeof(DEVMODE);
}
for (i=0;i<nmodes;i++)
for (i=0; i<nmodes; i++)
{
CHECK(modes[i].x, modes[i].y)
ADDMODE(modes[i].x, modes[i].y, modes[i].bpp, 1, modes[i].freq);
@ -2450,7 +2450,7 @@ void begindrawing(void)
setvlinebpl(bytesperline);
j = 0;
for (i=0;i<=ydim;i++) ylookup[i] = j, j += bytesperline;
for (i=0; i<=ydim; i++) ylookup[i] = j, j += bytesperline;
modechange=0;
}

View file

@ -33,7 +33,7 @@ extern int32_t g_noEnemies;
inline void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings
{
int32_t i=g_numInterpolations-1;
for (;i>=0;i--) oldipos[i] = *curipos[i];
for (; i>=0; i--) oldipos[i] = *curipos[i];
}
void G_SetInterpolation(int32_t *posptr)
@ -41,7 +41,7 @@ void G_SetInterpolation(int32_t *posptr)
int32_t i=g_numInterpolations-1;
if (g_numInterpolations >= MAXINTERPOLATIONS) return;
for (;i>=0;i--)
for (; i>=0; i--)
if (curipos[i] == posptr) return;
curipos[g_numInterpolations] = posptr;
oldipos[g_numInterpolations] = *posptr;
@ -52,7 +52,7 @@ void G_StopInterpolation(int32_t *posptr)
{
int32_t i=g_numInterpolations-1;
for (;i>=startofdynamicinterpolations;i--)
for (; i>=startofdynamicinterpolations; i--)
if (curipos[i] == posptr)
{
g_numInterpolations--;
@ -66,7 +66,7 @@ void G_DoInterpolations(int32_t smoothratio) //Stick at beginning of draws
{
int32_t i=g_numInterpolations-1, j = 0, odelta, ndelta = 0;
for (;i>=0;i--)
for (; i>=0; i--)
{
bakipos[i] = *curipos[i];
odelta = ndelta;
@ -79,7 +79,7 @@ void G_DoInterpolations(int32_t smoothratio) //Stick at beginning of draws
inline void G_RestoreInterpolations(void) //Stick at end of drawscreen
{
int32_t i=g_numInterpolations-1;
for (;i>=0;i--) *curipos[i] = bakipos[i];
for (; i>=0; i--) *curipos[i] = bakipos[i];
}
inline int32_t G_CheckForSpaceCeiling(int32_t sectnum)
@ -132,13 +132,13 @@ void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t
startwall = sector[dasect].wallptr;
endwall = startwall+sector[dasect].wallnum;
for (x=startwall,wal=&wall[startwall];x<endwall;x++,wal++)
for (x=startwall,wal=&wall[startwall]; x<endwall; x++,wal++)
if ((klabs(wal->x-s->x)+klabs(wal->y-s->y)) < r)
{
nextsect = wal->nextsector;
if (nextsect >= 0)
{
for (dasect=sectend-1;dasect>=0;dasect--)
for (dasect=sectend-1; dasect>=0; dasect--)
if (tempshort[dasect] == nextsect) break;
if (dasect < 0) tempshort[sectend++] = nextsect;
}
@ -163,7 +163,7 @@ SKIPWALLCHECK:
q = -(16<<8)+(krand()&((32<<8)-1));
for (x = 0;x<7;x++)
for (x = 0; x<7; x++)
{
j = headspritestat[(uint8_t)statlist[x]];
while (j >= 0)
@ -439,7 +439,7 @@ void A_SpawnMultiple(int32_t sp, int32_t pic, int32_t n)
int32_t j;
spritetype *s = &sprite[sp];
for (;n>0;n--)
for (; n>0; n--)
{
j = A_InsertSprite(s->sectnum,s->x,s->y,s->z-(krand()%(47<<8)),pic,-32,8,8,krand()&2047,0,0,sp,5);
A_Spawn(-1, j);
@ -470,7 +470,7 @@ void A_DoGuts(int32_t sp, int32_t gtype, int32_t n)
// pal = 6;
// else pal = 0;
for (j=n;j>0;j--)
for (j=n; j>0; j--)
{
a = krand()&2047;
i = A_InsertSprite(s->sectnum,s->x+(krand()&255)-128,s->y+(krand()&255)-128,gutz-(krand()&8191),gtype,-32,sx,sy,a,48+(krand()&31),-512-(krand()&2047),sp,5);
@ -503,7 +503,7 @@ void A_DoGutsDir(int32_t sp, int32_t gtype, int32_t n)
if (s->picnum == COMMANDER)
gutz -= (24<<8);
for (j=n;j>0;j--)
for (j=n; j>0; j--)
{
a = krand()&2047;
i = A_InsertSprite(s->sectnum,s->x,s->y,gutz,gtype,-32,sx,sy,a,256+(krand()&127),-512-(krand()&2047),sp,5);
@ -515,7 +515,7 @@ void Sect_SetInterpolation(int32_t i)
{
int32_t k, j = sector[SECT].wallptr,endwall = j+sector[SECT].wallnum;
for (;j<endwall;j++)
for (; j<endwall; j++)
{
G_SetInterpolation(&wall[j].x);
G_SetInterpolation(&wall[j].y);
@ -535,7 +535,7 @@ void Sect_ClearInterpolation(int32_t i)
{
int32_t j = sector[SECT].wallptr,endwall = j+sector[SECT].wallnum;
for (;j<endwall;j++)
for (; j<endwall; j++)
{
G_StopInterpolation(&wall[j].x);
G_StopInterpolation(&wall[j].y);
@ -561,7 +561,7 @@ static void ms(int32_t i)
{
int32_t x = sector[s->sectnum].wallptr, endwall = x+sector[s->sectnum].wallnum;
for (;x<endwall;x++)
for (; x<endwall; x++)
{
rotatepoint(0,0,msx[j],msy[j],k&2047,&tx,&ty);
dragpoint(x,s->x+tx,s->y+ty);
@ -788,7 +788,7 @@ void A_MoveCyclers(void)
int16_t *c;
walltype *wal;
for (q=g_numCyclers-1;q>=0;q--)
for (q=g_numCyclers-1; q>=0; q--)
{
c = &cyclers[q][0];
@ -805,7 +805,7 @@ void A_MoveCyclers(void)
if (c[5])
{
wal = &wall[sector[s].wallptr];
for (x = sector[s].wallnum;x>0;x--,wal++)
for (x = sector[s].wallnum; x>0; x--,wal++)
if (wal->hitag != 1)
{
wal->shade = j;
@ -1187,7 +1187,7 @@ static void G_MoveFallers(void)
if ((sector[sect].floorz-s->z) < (16<<8))
{
j = 1+(krand()&7);
for (x=0;x<j;x++) RANDOMSCRAP;
for (x=0; x<j; x++) RANDOMSCRAP;
KILLIT(i);
}
}
@ -1509,7 +1509,7 @@ static void G_MoveStandables(void)
if (T3 == 8)
{
A_PlaySound(LASERTRIP_EXPLODE,i);
for (j=0;j<5;j++) RANDOMSCRAP;
for (j=0; j<5; j++) RANDOMSCRAP;
x = s->extra;
A_RadiusDamage(i, g_tripbombBlastRadius, x>>2,x>>1,x-(x>>2),x);
@ -1671,7 +1671,7 @@ static void G_MoveStandables(void)
j = A_IncurDamage(i);
if (j == -1) goto BOLT;
for (k=0;k<16;k++)
for (k=0; k<16; k++)
{
j = A_InsertSprite(SECT,SX,SY,SZ-(krand()%(48<<8)),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5);
sprite[j].pal = 2;
@ -1806,7 +1806,7 @@ DETONATE:
}
if (s->xrepeat)
for (x=0;x<8;x++) RANDOMSCRAP;
for (x=0; x<8; x++) RANDOMSCRAP;
KILLIT(i);
}
@ -2123,7 +2123,7 @@ CLEAR_THE_BOLT:
IFHIT
{
A_PlaySound(VENT_BUST,i);
for (j=0;j<10;j++)
for (j=0; j<10; j++)
RANDOMSCRAP;
if (s->lotag) A_Spawn(i,s->lotag);
@ -2305,7 +2305,7 @@ static void G_MoveWeapons(void)
if (ActorExtra[i].projectile.trail >= 0)
{
for (f=0;f<=ActorExtra[i].projectile.tnum;f++)
for (f=0; f<=ActorExtra[i].projectile.tnum; f++)
{
j = A_Spawn(i,ActorExtra[i].projectile.trail);
if (ActorExtra[i].projectile.toffset != 0)
@ -2317,7 +2317,7 @@ static void G_MoveWeapons(void)
}
}
for (f=1;f<=ActorExtra[i].projectile.velmult;f++)
for (f=1; f<=ActorExtra[i].projectile.velmult; f++)
{
vec3_t tmpvect;
Bmemcpy(&davect,s,sizeof(vec3_t));
@ -2388,14 +2388,13 @@ static void G_MoveWeapons(void)
j = 16384|(s->sectnum);
s->zvel = -1;
}
else
if ((s->z > ActorExtra[i].floorz && sector[s->sectnum].lotag != 1) ||
(s->z > ActorExtra[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1))
{
j = 16384|(s->sectnum);
if (sector[s->sectnum].lotag != 1)
s->zvel = 1;
}
else if ((s->z > ActorExtra[i].floorz && sector[s->sectnum].lotag != 1) ||
(s->z > ActorExtra[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1))
{
j = 16384|(s->sectnum);
if (sector[s->sectnum].lotag != 1)
s->zvel = 1;
}
}
if (ActorExtra[i].projectile.workslike & PROJECTILE_WATERBUBBLES &&
@ -2452,7 +2451,7 @@ static void G_MoveWeapons(void)
j = 3+(krand()&3);
g_player[p].ps->numloogs = j;
g_player[p].ps->loogcnt = 24*4;
for (x=0;x < j;x++)
for (x=0; x < j; x++)
{
g_player[p].ps->loogiex[x] = krand()%xdim;
g_player[p].ps->loogiey[x] = krand()%ydim;
@ -2623,7 +2622,7 @@ static void G_MoveWeapons(void)
s->y = sprite[s->owner].y;
if (sprite[s->owner].picnum == APLAYER)
s->z = sprite[s->owner].z-(34<<8);
for (k=0;k<T1;k++)
for (k=0; k<T1; k++)
{
q = A_InsertSprite(s->sectnum,
s->x+((k*sintable[(s->ang+512)&2047])>>9),
@ -2717,19 +2716,18 @@ static void G_MoveWeapons(void)
j = 16384|(s->sectnum);
s->zvel = -1;
}
else
if ((s->z > ActorExtra[i].floorz && sector[s->sectnum].lotag != 1) ||
(s->z > ActorExtra[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1))
{
j = 16384|(s->sectnum);
if (sector[s->sectnum].lotag != 1)
s->zvel = 1;
}
else if ((s->z > ActorExtra[i].floorz && sector[s->sectnum].lotag != 1) ||
(s->z > ActorExtra[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1))
{
j = 16384|(s->sectnum);
if (sector[s->sectnum].lotag != 1)
s->zvel = 1;
}
}
if (s->picnum == FIRELASER)
{
for (k=-3;k<2;k++)
for (k=-3; k<2; k++)
{
x = A_InsertSprite(s->sectnum,
s->x+((k*sintable[(s->ang+512)&2047])>>9),
@ -2789,7 +2787,7 @@ static void G_MoveWeapons(void)
j = 3+(krand()&3);
g_player[p].ps->numloogs = j;
g_player[p].ps->loogcnt = 24*4;
for (x=0;x < j;x++)
for (x=0; x < j; x++)
{
g_player[p].ps->loogiex[x] = krand()%xdim;
g_player[p].ps->loogiey[x] = krand()%ydim;
@ -3112,7 +3110,7 @@ static void G_MoveTransports(void)
A_Spawn(j,WATERSPLASH2);
if (sectlotag == 1)
for (l = 0;l < 9;l++)
for (l = 0; l < 9; l++)
{
q = A_Spawn(g_player[p].ps->i,WATERBUBBLE);
sprite[q].z += krand()&16383;
@ -3399,7 +3397,7 @@ static void G_MoveActors(void)
if (t[0] > (26*8))
{
S_PlaySound(RPG_EXPLODE);
for (j=0;j<32;j++) RANDOMSCRAP;
for (j=0; j<32; j++) RANDOMSCRAP;
g_earthquakeTime = 16;
KILLIT(i);
}
@ -3521,8 +3519,8 @@ static void G_MoveActors(void)
{
s->yvel = 1;
for (l=512;l<(2048-512);l+= 128)
for (j=0;j<2048;j += 128)
for (l=512; l<(2048-512); l+= 128)
for (j=0; j<2048; j += 128)
{
k = A_Spawn(i,FORCESPHERE);
sprite[k].cstat = 257+128;
@ -3601,7 +3599,7 @@ static void G_MoveActors(void)
j = A_SetSprite(i,CLIPMASK0);
if (j != 1 || s->z > ActorExtra[i].floorz)
{
for (l=0;l<16;l++)
for (l=0; l<16; l++)
RANDOMSCRAP;
A_PlaySound(LASERTRIP_EXPLODE,i);
A_Spawn(i,PIGCOP);
@ -3819,7 +3817,7 @@ static void G_MoveActors(void)
IFHIT
{
if (j == FREEZEBLAST) goto BOLT;
for (j=16; j >= 0 ;j--)
for (j=16; j >= 0 ; j--)
{
k = A_InsertSprite(SECT,SX,SY,SZ,GLASSPIECES+(j%3),-32,36,36,krand()&2047,32+(krand()&63),1024-(krand()&1023),i,5);
sprite[k].pal = 1;
@ -3856,7 +3854,7 @@ static void G_MoveActors(void)
if ((TEST_SYNC_KEY(g_player[p].sync->bits, SK_FIRE) || (g_player[p].ps->quick_kick > 0)) && sprite[g_player[p].ps->i].extra > 0)
if (g_player[p].ps->quick_kick > 0 || (g_player[p].ps->curr_weapon != HANDREMOTE_WEAPON && g_player[p].ps->curr_weapon != HANDBOMB_WEAPON && g_player[p].ps->curr_weapon != TRIPBOMB_WEAPON && g_player[p].ps->ammo_amount[g_player[p].ps->curr_weapon] >= 0))
{
for (x=0;x<8;x++)
for (x=0; x<8; x++)
{
j = A_InsertSprite(sect,s->x,s->y,s->z-(8<<8),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(s->zvel>>2),i,5);
sprite[j].pal = 6;
@ -3971,7 +3969,7 @@ static void G_MoveActors(void)
sprite[j].pal = 0;
}
for (x=0;x<8;x++)
for (x=0; x<8; x++)
{
j = A_InsertSprite(sect,s->x,s->y,s->z-(8<<8),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(s->zvel>>2),i,5);
sprite[j].pal = 6;
@ -4338,7 +4336,7 @@ DETONATEB:
if (s->zvel == 0)
A_Spawn(i,EXPLOSION2BOT);
A_PlaySound(PIPEBOMB_EXPLODE,i);
for (x=0;x<8;x++)
for (x=0; x<8; x++)
RANDOMSCRAP;
}
@ -4370,7 +4368,7 @@ DETONATEB:
{
if ((GametypeFlags[ud.coop] & GAMETYPE_WEAPSTAY) && s->owner == i)
{
for (j=0;j<g_player[p].ps->weapreccnt;j++)
for (j=0; j<g_player[p].ps->weapreccnt; j++)
if (g_player[p].ps->weaprecs[j] == s->picnum)
goto BOLT;
@ -4544,7 +4542,7 @@ DETONATEB:
}
break;
}
for (x=0;x<16;x++)
for (x=0; x<16; x++)
RANDOMSCRAP;
s->z = t[4];
@ -4555,7 +4553,7 @@ DETONATEB:
{
IFHIT
{
for (x=0;x<32;x++)
for (x=0; x<32; x++)
RANDOMSCRAP;
if (s->extra < 0)
t[1] = 1;
@ -4574,7 +4572,7 @@ DETONATEB:
{
t[0] = 1; // static
s->cstat = (int16_t)32768;
for (x=0;x<5;x++) RANDOMSCRAP;
for (x=0; x<5; x++) RANDOMSCRAP;
goto BOLT;
}
}
@ -4721,12 +4719,11 @@ static void G_MoveMisc(void) // STATNUM 5
l += 3;
}
}
else
if (t[0] > 64)
{
t[0]--;
l -= 3;
}
else if (t[0] > 64)
{
t[0]--;
l -= 3;
}
s->x = sprite[s->owner].x;
s->y = sprite[s->owner].y;
@ -4740,7 +4737,7 @@ static void G_MoveMisc(void) // STATNUM 5
s->yrepeat = l;
s->shade = (l>>1)-48;
for (j=t[0];j > 0;j--)
for (j=t[0]; j > 0; j--)
A_SetSprite(i,CLIPMASK0);
goto BOLT;
case WATERSPLASH2__STATIC:
@ -4821,9 +4818,8 @@ static void G_MoveMisc(void) // STATNUM 5
if (s->zvel < 64)
s->zvel += (g_spriteGravity>>5)+(krand()&7);
}
else
if (s->zvel < 144)
s->zvel += (g_spriteGravity>>5)+(krand()&7);
else if (s->zvel < 144)
s->zvel += (g_spriteGravity>>5)+(krand()&7);
}
A_SetSprite(i,CLIPMASK0);
@ -5499,7 +5495,7 @@ static void G_MoveEffectors(void) //STATNUM 3
m = (s->xvel*sintable[(s->ang+512)&2047])>>14;
x = (s->xvel*sintable[s->ang&2047])>>14;
for (p = connecthead;p >= 0;p=connectpoint2[p])
for (p = connecthead; p >= 0; p=connectpoint2[p])
if (sector[g_player[p].ps->cursectnum].lotag != 2)
{
if (g_playerSpawnPoints[p].os == s->sectnum)
@ -5674,7 +5670,7 @@ static void G_MoveEffectors(void) //STATNUM 3
}
}
for (p = connecthead;p >= 0;p = connectpoint2[p])
for (p = connecthead; p >= 0; p = connectpoint2[p])
{
if (sprite[g_player[p].ps->i].sectnum == s->sectnum)
{
@ -5868,7 +5864,7 @@ static void G_MoveEffectors(void) //STATNUM 3
wal = &wall[sc->wallptr];
for (x=sc->wallnum;x > 0;x--,wal++)
for (x=sc->wallnum; x > 0; x--,wal++)
{
if (wal->hitag != 1)
{
@ -5908,7 +5904,7 @@ static void G_MoveEffectors(void) //STATNUM 3
wal = &wall[sc->wallptr];
for (x=sc->wallnum;x > 0; x--,wal++)
for (x=sc->wallnum; x > 0; x--,wal++)
{
if (j) wal->pal = (s->owner&0xff);
else wal->pal = s->pal;
@ -6055,7 +6051,7 @@ static void G_MoveEffectors(void) //STATNUM 3
wal = &wall[sector[sn].wallptr];
for (l=sector[sn].wallnum;l>0;l--,wal++)
for (l=sector[sn].wallnum; l>0; l--,wal++)
{
if (wal->hitag != 1)
{
@ -6135,7 +6131,7 @@ static void G_MoveEffectors(void) //STATNUM 3
{
int32_t endwall = sc->wallptr+sc->wallnum;
for (j=sc->wallptr;j<endwall;j++)
for (j=sc->wallptr; j<endwall; j++)
{
k = headspritestat[STAT_ACTOR];
while (k >= 0)
@ -6185,7 +6181,7 @@ static void G_MoveEffectors(void) //STATNUM 3
sc->ceilingpal = 0;
wal = &wall[sc->wallptr];
for (j = sc->wallnum;j > 0; j--, wal++)
for (j = sc->wallnum; j > 0; j--, wal++)
if (wal->hitag != 1)
{
wal->shade = t[1];
@ -6222,7 +6218,7 @@ static void G_MoveEffectors(void) //STATNUM 3
sc->ceilingshade -= 2;
wal = &wall[sc->wallptr];
for (j=sc->wallnum;j>0;j--,wal++)
for (j=sc->wallnum; j>0; j--,wal++)
if (wal->hitag != 1)
{
wal->pal = s->pal;
@ -6286,7 +6282,7 @@ static void G_MoveEffectors(void) //STATNUM 3
if (s->ang == 512)
{
wal = &wall[sc->wallptr];
for (j=sc->wallnum;j>0;j--,wal++)
for (j=sc->wallnum; j>0; j--,wal++)
wal->shade = s->shade;
sc->floorshade = s->shade;
@ -6307,7 +6303,7 @@ static void G_MoveEffectors(void) //STATNUM 3
if (t[2] == 4 && s->ang != 512)
for (x=0;x<7;x++) RANDOMSCRAP;
for (x=0; x<7; x++) RANDOMSCRAP;
break;
@ -6584,7 +6580,7 @@ static void G_MoveEffectors(void) //STATNUM 3
t[0]++;
x = sc->wallptr;
q = x+sc->wallnum;
for (j=x;j<q;j++)
for (j=x; j<q; j++)
if (wall[j].overpicnum == BIGFORCE)
{
wall[j].cstat &= (128+32+8+4+2);
@ -6864,7 +6860,7 @@ static void G_MoveEffectors(void) //STATNUM 3
case 35:
if (sc->ceilingz > s->z)
for (j = 0;j < 8;j++)
for (j = 0; j < 8; j++)
{
s->ang += krand()&511;
k = A_Spawn(i,SMALLSMOKE);
@ -6961,7 +6957,7 @@ static void G_MoveEffectors(void) //STATNUM 3
fricyv += x<<5;
}
for (p = connecthead;p >= 0;p = connectpoint2[p])
for (p = connecthead; p >= 0; p = connectpoint2[p])
if (sprite[g_player[p].ps->i].sectnum == s->sectnum && g_player[p].ps->on_ground)
g_player[p].ps->posz += s->zvel;
@ -7401,7 +7397,7 @@ BOLT:
}
//Sloped sin-wave floors!
for (i=headspritestat[STAT_EFFECTOR];i>=0;i=nextspritestat[i])
for (i=headspritestat[STAT_EFFECTOR]; i>=0; i=nextspritestat[i])
{
s = &sprite[i];
if (s->lotag != 29) continue;
@ -7478,19 +7474,6 @@ void A_PlayAlertSound(int32_t i)
}
}
inline int32_t A_CheckSpriteFlags(int32_t iActor, int32_t iType)
{
if ((SpriteFlags[sprite[iActor].picnum]^ActorExtra[iActor].flags) & iType) return 1;
return 0;
}
inline int32_t A_CheckSpriteTileFlags(int32_t iPicnum, int32_t iType)
{
if (SpriteFlags[iPicnum] & iType) return 1;
return 0;
}
int32_t A_CheckEnemyTile(int32_t pn)
{
//this case can't be handled by the dynamictostatic system because it adds
@ -7558,7 +7541,7 @@ int32_t A_CheckSwitchTile(int32_t i)
// ACCESSSWITCH and ACCESSSWITCH2 are only active in 1 state so deal with them separately
if ((PN == ACCESSSWITCH) || (PN == ACCESSSWITCH2)) return 1;
//loop to catch both states of switches
for (j=1;j>=0;j--)
for (j=1; j>=0; j--)
{
switch (DynamicTileMap[PN-j])
{

View file

@ -240,7 +240,7 @@ void G_PlayAnim(const char *fn,char t)
numframes = ANIM_NumFrames();
palptr = ANIM_GetPalette();
for (i=0;i<256;i++)
for (i=0; i<256; i++)
{
j = i*3;
animpal[j+0] = (palptr[j+0]>>2);
@ -261,7 +261,7 @@ void G_PlayAnim(const char *fn,char t)
frametime = totalclock;
for (i=1;i<numframes;i++)
for (i=1; i<numframes; i++)
{
if ((i > 4) && (totalclock > frametime + 45))
{

File diff suppressed because it is too large Load diff

View file

@ -353,7 +353,7 @@ void CONFIG_ReadKeys(void)
Bmemset(&KeyBindings,0,sizeof(KeyBindings));
for (i=0;i<numkeyentries;i++)
for (i=0; i<numkeyentries; i++)
{
function = CONFIG_FunctionNameToNum(SCRIPT_Entry(ud.config.scripthandle,"KeyDefinitions", i));
if (function != -1)
@ -405,7 +405,7 @@ void CONFIG_MapKey(int32 which, kb_scancode key1, kb_scancode oldkey1, kb_scanco
{
if (ii[k] == 0xff || !ii[k]) continue;
for (j=0;ConsoleKeys[j].name;j++)
for (j=0; ConsoleKeys[j].name; j++)
if (ii[k] == ConsoleKeys[j].id)
break;
if (ConsoleKeys[j].name)
@ -415,7 +415,7 @@ void CONFIG_MapKey(int32 which, kb_scancode key1, kb_scancode oldkey1, kb_scanco
KeyBindings[ii[k]].cmd[0] = 0;
tempbuf[0] = 0;
for (i=NUMGAMEFUNCTIONS-1;i>=0;i--)
for (i=NUMGAMEFUNCTIONS-1; i>=0; i--)
{
if (ud.config.KeyboardKeys[i][0] == ii[k] || ud.config.KeyboardKeys[i][1] == ii[k])
{
@ -448,7 +448,7 @@ void CONFIG_SetupMouse(void)
if (ud.config.scripthandle < 0) return;
for (i=0;i<MAXMOUSEBUTTONS;i++)
for (i=0; i<MAXMOUSEBUTTONS; i++)
{
Bsprintf(str,"MouseButton%d",i);
temp[0] = 0;
@ -462,7 +462,7 @@ void CONFIG_SetupMouse(void)
}
// map over the axes
for (i=0;i<MAXMOUSEAXES;i++)
for (i=0; i<MAXMOUSEAXES; i++)
{
Bsprintf(str,"MouseAnalogAxes%d",i);
temp[0] = 0;
@ -523,7 +523,7 @@ void CONFIG_SetupJoystick(void)
if (ud.config.scripthandle < 0) return;
for (i=0;i<MAXJOYBUTTONS;i++)
for (i=0; i<MAXJOYBUTTONS; i++)
{
Bsprintf(str,"JoystickButton%d",i);
temp[0] = 0;
@ -537,7 +537,7 @@ void CONFIG_SetupJoystick(void)
}
// map over the axes
for (i=0;i<MAXJOYAXES;i++)
for (i=0; i<MAXJOYAXES; i++)
{
Bsprintf(str,"JoystickAnalogAxes%d",i);
temp[0] = 0;
@ -573,12 +573,12 @@ void CONFIG_SetupJoystick(void)
ud.config.JoystickAnalogueSaturate[i] = scale;
}
for (i=0;i<MAXJOYBUTTONS;i++)
for (i=0; i<MAXJOYBUTTONS; i++)
{
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick);
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick);
}
for (i=0;i<MAXJOYAXES;i++)
for (i=0; i<MAXJOYAXES; i++)
{
CONTROL_MapAnalogAxis(i, ud.config.JoystickAnalogueAxes[i], controldevice_joystick);
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
@ -641,7 +641,7 @@ int32 CONFIG_ReadSetup(void)
{
char dummybuf[64];
for (dummy = 0;dummy < 10;dummy++)
for (dummy = 0; dummy < 10; dummy++)
{
commmacro[13] = dummy+'0';
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
@ -878,7 +878,7 @@ int32 CONFIG_ReadSetup(void)
// weapon choices are defaulted in G_CheckCommandLine, which may override them
if (!CommandWeaponChoice)
for (i=0;i<10;i++)
for (i=0; i<10; i++)
{
Bsprintf(buf,"WeaponChoice%d",i);
dummy = -1;
@ -972,11 +972,11 @@ void CONFIG_WriteBinds(void) // save binds and aliases to disk
{
symbol_t *symb;
fprintf(fp,"// this file automatically generated by EDuke32\n// do not modify if you lack common sense\n");
for (i=0;i<MAXBOUNDKEYS;i++)
for (i=0; i<MAXBOUNDKEYS; i++)
if (KeyBindings[i].cmd[0] && KeyBindings[i].key)
fprintf(fp,"bind \"%s\"%s \"%s\"\n",KeyBindings[i].key,KeyBindings[i].repeat?"":" norepeat",KeyBindings[i].cmd);
for (i=0;i<MAXMOUSEBUTTONS;i++)
for (i=0; i<MAXMOUSEBUTTONS; i++)
if (MouseBindings[i].cmd[0])
fprintf(fp,"bind \"%s\"%s \"%s\"\n",MouseBindings[i].key,MouseBindings[i].repeat?"":" norepeat",MouseBindings[i].cmd);
@ -1053,7 +1053,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "UsePrecache",ud.config.useprecache,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ViewBobbing",ud.viewbob,false,false);
for (dummy=0;dummy<10;dummy++)
for (dummy=0; dummy<10; dummy++)
{
Bsprintf(buf,"WeaponChoice%d",dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],false,false);
@ -1156,13 +1156,13 @@ void CONFIG_WriteSetup(void)
#endif
// JBF 20031211
for (dummy=0;dummy<NUMGAMEFUNCTIONS;dummy++)
for (dummy=0; dummy<NUMGAMEFUNCTIONS; dummy++)
{
SCRIPT_PutDoubleString(ud.config.scripthandle, "KeyDefinitions", CONFIG_FunctionNumToName(dummy),
KB_ScanCodeToString(ud.config.KeyboardKeys[dummy][0]), KB_ScanCodeToString(ud.config.KeyboardKeys[dummy][1]));
}
for (dummy=0;dummy<MAXMOUSEBUTTONS;dummy++)
for (dummy=0; dummy<MAXMOUSEBUTTONS; dummy++)
{
Bsprintf(buf,"MouseButton%d",dummy);
SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][0]));
@ -1173,7 +1173,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1]));
}
for (dummy=0;dummy<MAXMOUSEAXES;dummy++)
for (dummy=0; dummy<MAXMOUSEAXES; dummy++)
{
Bsprintf(buf,"MouseAnalogAxes%d",dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.MouseAnalogueAxes[dummy]));
@ -1190,7 +1190,7 @@ void CONFIG_WriteSetup(void)
dummy = CONTROL_GetMouseSensitivity();
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","Mouse_Sensitivity",dummy,false,false);
for (dummy=0;dummy<MAXJOYBUTTONS;dummy++)
for (dummy=0; dummy<MAXJOYBUTTONS; dummy++)
{
Bsprintf(buf,"JoystickButton%d",dummy);
SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0]));
@ -1198,7 +1198,7 @@ void CONFIG_WriteSetup(void)
Bsprintf(buf,"JoystickButtonClicked%d",dummy);
SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][1]));
}
for (dummy=0;dummy<MAXJOYAXES;dummy++)
for (dummy=0; dummy<MAXJOYAXES; dummy++)
{
Bsprintf(buf,"JoystickAnalogAxes%d",dummy);
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[dummy]));
@ -1238,7 +1238,7 @@ void CONFIG_WriteSetup(void)
{
char commmacro[] = "CommbatMacro# ";
for (dummy = 0;dummy < 10;dummy++)
for (dummy = 0; dummy < 10; dummy++)
{
commmacro[13] = dummy+'0';
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
@ -1261,7 +1261,7 @@ int32 CONFIG_GetMapBestTime(char *mapname)
p = strrchr(m, '/');
if (!p) p = strrchr(m, '\\');
if (p) strcpy(m, p);
for (p=m;*p;p++) *p = tolower(*p);
for (p=m; *p; p++) *p = tolower(*p);
// cheap hack because SCRIPT_GetNumber doesn't like the slashes
p = m;
@ -1282,7 +1282,7 @@ int32 CONFIG_SetMapBestTime(char *mapname, int32 tm)
p = strrchr(m, '/');
if (!p) p = strrchr(m, '\\');
if (p) strcpy(m, p);
for (p=m;*p;p++) *p = tolower(*p);
for (p=m; *p; p++) *p = tolower(*p);
// cheap hack because SCRIPT_GetNumber doesn't like the slashes
p = m;

View file

@ -255,10 +255,33 @@ extern void Net_SendQuit(void);
extern void G_AddUserQuote(const char *daquote);
extern void Net_NewGame(int32_t volume, int32_t level);
extern inline int32_t A_CheckSpriteFlags(int32_t iActor, int32_t iType);
extern inline int32_t A_CheckSpriteTileFlags(int32_t iPicnum, int32_t iType);
extern int32_t SpriteFlags[MAXTILES];
extern int32_t G_GetTeamPalette(int32_t team);
inline int32_t A_CheckSpriteFlags(int32_t iActor, int32_t iType)
{
return (((SpriteFlags[sprite[iActor].picnum]^ActorExtra[iActor].flags) & iType) != 0);
}
inline int32_t A_CheckSpriteTileFlags(int32_t iPicnum, int32_t iType)
{
return ((SpriteFlags[iPicnum] & iType) != 0);
}
inline int32_t G_GetTeamPalette(int32_t team)
{
switch (team)
{
case 0:
return 3;
case 1:
return 10;
case 2:
return 11;
case 3:
return 12;
}
return 0;
}
extern void se40code(int32_t x,int32_t y,int32_t z,int32_t a,int32_t h, int32_t smoothratio);

File diff suppressed because it is too large Load diff

View file

@ -129,7 +129,7 @@ static const char *C_GetLabelType(int32_t type)
char x[64];
x[0] = 0;
for (i=0;i<6;i++)
for (i=0; i<6; i++)
{
if (!(type & (1<<i))) continue;
if (x[0]) Bstrcat(x, " or ");
@ -970,33 +970,33 @@ void C_InitHashes()
inithashnames();
hash_init(&keywH);
for (i=NUMKEYWORDS-1;i>=0;i--)
for (i=NUMKEYWORDS-1; i>=0; i--)
hash_add(&keywH,keyw[i],i);
hash_init(&sectorH);
for (i=0;SectorLabels[i].lId >=0 ; i++)
for (i=0; SectorLabels[i].lId >=0 ; i++)
hash_add(&sectorH,SectorLabels[i].name,i);
hash_init(&wallH);
for (i=0;WallLabels[i].lId >=0 ; i++)
for (i=0; WallLabels[i].lId >=0 ; i++)
hash_add(&wallH,WallLabels[i].name,i);
hash_init(&userdefH);
for (i=0;UserdefsLabels[i].lId >=0 ; i++)
for (i=0; UserdefsLabels[i].lId >=0 ; i++)
hash_add(&userdefH,UserdefsLabels[i].name,i);
hash_init(&projectileH);
for (i=0;ProjectileLabels[i].lId >=0 ; i++)
for (i=0; ProjectileLabels[i].lId >=0 ; i++)
hash_add(&projectileH,ProjectileLabels[i].name,i);
hash_init(&playerH);
for (i=0;PlayerLabels[i].lId >=0 ; i++)
for (i=0; PlayerLabels[i].lId >=0 ; i++)
hash_add(&playerH,PlayerLabels[i].name,i);
hash_init(&inputH);
for (i=0;InputLabels[i].lId >=0 ; i++)
for (i=0; InputLabels[i].lId >=0 ; i++)
hash_add(&inputH,InputLabels[i].name,i);
hash_init(&actorH);
for (i=0;ActorLabels[i].lId >=0 ; i++)
for (i=0; ActorLabels[i].lId >=0 ; i++)
hash_add(&actorH,ActorLabels[i].name,i);
hash_init(&tspriteH);
for (i=0;TsprLabels[i].lId >=0 ; i++)
for (i=0; TsprLabels[i].lId >=0 ; i++)
hash_add(&tspriteH,TsprLabels[i].name,i);
}
@ -1022,7 +1022,7 @@ static int32_t C_IncreaseScriptSize(int32_t size)
int32_t osize = g_scriptSize;
char *newbitptr;
for (i=MAXSECTORS-1;i>=0;i--)
for (i=MAXSECTORS-1; i>=0; i--)
{
if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
{
@ -1031,7 +1031,7 @@ static int32_t C_IncreaseScriptSize(int32_t size)
}
scriptptrs = Bcalloc(1,g_scriptSize * sizeof(uint8_t));
for (i=g_scriptSize-1;i>=0;i--)
for (i=g_scriptSize-1; i>=0; i--)
{
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) && !((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize])))
{
@ -1048,7 +1048,7 @@ static int32_t C_IncreaseScriptSize(int32_t size)
else scriptptrs[i] = 0;
}
for (i=MAXTILES-1;i>=0;i--)
for (i=MAXTILES-1; i>=0; i--)
{
if (actorscrptr[i])
{
@ -1062,7 +1062,7 @@ static int32_t C_IncreaseScriptSize(int32_t size)
}
}
for (i=MAXGAMEEVENTS-1;i>=0;i--)
for (i=MAXGAMEEVENTS-1; i>=0; i--)
if (apScriptGameEvent[i])
{
j = (intptr_t)apScriptGameEvent[i]-(intptr_t)&script[0];
@ -1091,10 +1091,10 @@ static int32_t C_IncreaseScriptSize(int32_t size)
{
Bmemset(&newscript[osize],0,(size-osize) * sizeof(intptr_t));
// Bmemset(&bitptr[osize],0,size-osize);
Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) * ((osize+7)>>3));
Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((osize+7)>>3));
}
else if (size < osize)
Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) * ((size+7)>>3));
Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((size+7)>>3));
Bfree(bitptr);
bitptr = newbitptr;
@ -1110,7 +1110,7 @@ static int32_t C_IncreaseScriptSize(int32_t size)
if (g_parsingActorPtr != NULL)
g_parsingActorPtr = (intptr_t *)(script+oparsingActorPtr);
for (i=MAXSECTORS-1;i>=0;i--)
for (i=MAXSECTORS-1; i>=0; i--)
{
if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
{
@ -1120,7 +1120,7 @@ static int32_t C_IncreaseScriptSize(int32_t size)
if (size > osize)
{
for (i=g_scriptSize-(size-osize)-1;i>=0;i--)
for (i=g_scriptSize-(size-osize)-1; i>=0; i--)
if (scriptptrs[i])
{
j = (intptr_t)script[i]+(intptr_t)&script[0];
@ -1129,7 +1129,7 @@ static int32_t C_IncreaseScriptSize(int32_t size)
}
else
{
for (i=g_scriptSize-1;i>=0;i--)
for (i=g_scriptSize-1; i>=0; i--)
if (scriptptrs[i])
{
j = (intptr_t)script[i]+(intptr_t)&script[0];
@ -1137,7 +1137,7 @@ static int32_t C_IncreaseScriptSize(int32_t size)
}
}
for (i=MAXTILES-1;i>=0;i--)
for (i=MAXTILES-1; i>=0; i--)
{
if (actorscrptr[i])
{
@ -1151,7 +1151,7 @@ static int32_t C_IncreaseScriptSize(int32_t size)
}
}
for (i=MAXGAMEEVENTS-1;i>=0;i--)
for (i=MAXGAMEEVENTS-1; i>=0; i--)
if (apScriptGameEvent[i])
{
j = (intptr_t)apScriptGameEvent[i]+(intptr_t)&script[0];
@ -1768,7 +1768,7 @@ static void C_GetNextVarType(int32_t type)
static inline void C_GetManyVarsType(int32_t type, int32_t num)
{
int32_t i;
for (i=num-1;i>=0;i--)
for (i=num-1; i>=0; i--)
C_GetNextVarType(type);
}
@ -2293,7 +2293,7 @@ static int32_t C_ParseCommand(void)
}
case CON_PALFROM:
for (j=3;j>=0;j--)
for (j=3; j>=0; j--)
{
if (C_GetKeyword() == -1)
C_GetNextValue(LABEL_DEFINE);
@ -2371,12 +2371,12 @@ static int32_t C_ParseCommand(void)
labeltype[g_numLabels] = LABEL_MOVE;
labelcode[g_numLabels++] = (intptr_t) g_scriptPtr;
}
for (j=1;j>=0;j--)
for (j=1; j>=0; j--)
{
if (C_GetKeyword() >= 0) break;
C_GetNextValue(LABEL_DEFINE);
}
for (k=j;k>=0;k--)
for (k=j; k>=0; k--)
{
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
*g_scriptPtr = 0;
@ -2565,7 +2565,7 @@ static int32_t C_ParseCommand(void)
labelcode[g_numLabels++] = (intptr_t) g_scriptPtr;
}
for (j=0;j<3;j++)
for (j=0; j<3; j++)
{
if (C_GetKeyword() >= 0) break;
if (j == 1)
@ -2593,7 +2593,7 @@ static int32_t C_ParseCommand(void)
return 0;
}
}
for (k=j;k<3;k++)
for (k=j; k<3; k++)
{
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
*g_scriptPtr = 0;
@ -2647,12 +2647,12 @@ static int32_t C_ParseCommand(void)
g_numLabels++;
}
for (j=4;j>=0;j--)
for (j=4; j>=0; j--)
{
if (C_GetKeyword() >= 0) break;
C_GetNextValue(LABEL_DEFINE);
}
for (k=j;k>=0;k--)
for (k=j; k>=0; k--)
{
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
*(g_scriptPtr++) = 0;
@ -2684,7 +2684,7 @@ static int32_t C_ParseCommand(void)
g_scriptPtr--;
actorscrptr[*g_scriptPtr] = g_parsingActorPtr;
for (j=0;j<4;j++)
for (j=0; j<4; j++)
{
bitptr[(g_parsingActorPtr+j-script)>>3] &= ~(1<<((g_parsingActorPtr+j-script)&7));
*(g_parsingActorPtr+j) = 0;
@ -2850,7 +2850,7 @@ static int32_t C_ParseCommand(void)
actorscrptr[*g_scriptPtr] = g_parsingActorPtr;
ActorType[*g_scriptPtr] = j;
for (j=0;j<4;j++)
for (j=0; j<4; j++)
{
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
*(g_parsingActorPtr+j) = 0;
@ -2918,7 +2918,7 @@ static int32_t C_ParseCommand(void)
case CON_QSPRINTF:
C_GetNextValue(LABEL_DEFINE);
C_GetNextValue(LABEL_DEFINE);
for (j=3;j>=0;j--)
for (j=3; j>=0; j--)
{
if (C_GetKeyword() == -1)
C_GetNextVar();
@ -4493,15 +4493,15 @@ static int32_t C_ParseCommand(void)
if (tempscrptr)
{
intptr_t t,n;
for (i=3;i<3+tempscrptr[1]*2-2;i+=2) // sort them
for (i=3; i<3+tempscrptr[1]*2-2; i+=2) // sort them
{
t=tempscrptr[i];n=i;
for (j=i+2;j<3+tempscrptr[1]*2;j+=2)
if (tempscrptr[j]<t) {t=tempscrptr[j];n=j;}
t=tempscrptr[i]; n=i;
for (j=i+2; j<3+tempscrptr[1]*2; j+=2)
if (tempscrptr[j]<t) {t=tempscrptr[j]; n=j;}
if (n!=i)
{
t=tempscrptr[i ];tempscrptr[i ]=tempscrptr[n ];tempscrptr[n ]=t;
t=tempscrptr[i+1];tempscrptr[i+1]=tempscrptr[n+1];tempscrptr[n+1]=t;
t=tempscrptr[i ]; tempscrptr[i ]=tempscrptr[n ]; tempscrptr[n ]=t;
t=tempscrptr[i+1]; tempscrptr[i+1]=tempscrptr[n+1]; tempscrptr[n+1]=t;
}
}
// for (j=3;j<3+tempscrptr[1]*2;j+=2)initprintf("%5d %8x\n",tempscrptr[j],tempscrptr[j+1]);
@ -4553,7 +4553,7 @@ repeatcase:
//AddLog(g_szBuf);
if (g_caseScriptPtr)
{
for (i=(g_numCases/2)-1;i>=0;i--)
for (i=(g_numCases/2)-1; i>=0; i--)
if (g_caseScriptPtr[i*2+1]==j)
{
g_numCompilerWarnings++;
@ -5830,7 +5830,7 @@ static void C_InitProjectiles(void)
if (sizeof(projectile_t) != sizeof(DefaultProjectile))
G_GameExit("ERROR: C_InitProjectiles(): projectile_t mismatch!");
for (i=MAXTILES-1;i>=0;i--)
for (i=MAXTILES-1; i>=0; i--)
Bmemcpy(&ProjectileData[i],&DefaultProjectile,sizeof(projectile_t));
Bmemcpy(&DefaultProjectileData[0], &ProjectileData[0], sizeof(ProjectileData));
@ -6016,27 +6016,27 @@ void C_Compile(const char *filenam)
MAXSPRITES * sizeof(spritetype)/(1<<6)),
g_gameVarCount, MAXGAMEVARS);
for (i=MAXQUOTES-1;i>=0;i--)
for (i=MAXQUOTES-1; i>=0; i--)
if (ScriptQuotes[i])
j++;
initprintf("%ld/%d quotes, %d quote redefinitions\n",j,MAXQUOTES,g_numQuoteRedefinitions);
j = 0;
for (i=MAXGAMEEVENTS-1;i>=0;i--)
for (i=MAXGAMEEVENTS-1; i>=0; i--)
if (apScriptGameEvent[i])
j++;
for (i=MAXTILES-1;i>=0;i--)
for (i=MAXTILES-1; i>=0; i--)
if (actorscrptr[i])
k++;
initprintf("%ld/%d event definitions, %ld defined actors\n",j,MAXEVENTS,k);
for (i=127;i>=0;i--)
for (i=127; i>=0; i--)
if (ScriptQuotes[i] == NULL)
ScriptQuotes[i] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
for (i=MAXQUOTELEN-7;i>=0;i--)
for (i=MAXQUOTELEN-7; i>=0; i--)
if (Bstrncmp(&ScriptQuotes[13][i],"SPACE",5) == 0)
{
Bmemset(tempbuf,0,sizeof(tempbuf));
@ -6110,7 +6110,7 @@ void C_Compile(const char *filenam)
};
g_numObituaries = (sizeof(PlayerObituaries)/sizeof(PlayerObituaries[0]));
for (i=g_numObituaries-1;i>=0;i--)
for (i=g_numObituaries-1; i>=0; i--)
{
if (ScriptQuotes[i+FIRST_OBITUARY_QUOTE] == NULL)
{
@ -6120,7 +6120,7 @@ void C_Compile(const char *filenam)
}
g_numSelfObituaries = (sizeof(PlayerSelfObituaries)/sizeof(PlayerSelfObituaries[0]));
for (i=g_numSelfObituaries-1;i>=0;i--)
for (i=g_numSelfObituaries-1; i>=0; i--)
{
if (ScriptQuotes[i+FIRST_SUICIDE_QUOTE] == NULL)
{

View file

@ -49,7 +49,7 @@ void X_ScriptInfo(void)
{
intptr_t *p;
if (insptr)
for (p=insptr-20;p<insptr+20;p++)
for (p=insptr-20; p<insptr+20; p++)
{
if (*p>>12&&(*p&0xFFF)<CON_END)
initprintf("\n%5d: %5d %s ",p-script,*p>>12,keyw[*p&0xFFF]);
@ -169,7 +169,7 @@ static int32_t A_Dodge(spritetype *s)
if (A_CheckEnemySprite(s) && s->extra <= 0) // hack
return 0;
for (i=headspritestat[STAT_PROJECTILE];i>=0;i=nextspritestat[i]) //weapons list
for (i=headspritestat[STAT_PROJECTILE]; i>=0; i=nextspritestat[i]) //weapons list
{
if (OW == i || SECT != s->sectnum)
continue;
@ -207,7 +207,7 @@ int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs)
int32_t angincs = 2048/angs,j;
hitdata_t hitinfo;
for (j=s->ang;j<(2048+s->ang);j+=angincs)
for (j=s->ang; j<(2048+s->ang); j+=angincs)
{
s->z -= (8<<8);
hitscan((const vec3_t *)s, s->sectnum,
@ -240,7 +240,7 @@ int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_
angincs = 2048/2;
else angincs = 2048/(1+(krand()&1));
for (j=ts->ang;j<(2048+ts->ang);j+=(angincs-(krand()&511)))
for (j=ts->ang; j<(2048+ts->ang); j+=(angincs-(krand()&511)))
{
ts->z -= (16<<8);
hitscan((const vec3_t *)ts, ts->sectnum,
@ -911,7 +911,7 @@ static int32_t X_DoExecute(void)
if (*insptr == 0)
{
int32_t j = 0;
for (;j < g_player[vm.g_p].ps->weapreccnt;j++)
for (; j < g_player[vm.g_p].ps->weapreccnt; j++)
if (g_player[vm.g_p].ps->weaprecs[j] == vm.g_sp->picnum)
break;
@ -1029,7 +1029,7 @@ static int32_t X_DoExecute(void)
if ((*insptr<0 || *insptr>=MAXSOUNDS) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr);
insptr++;break;
insptr++; break;
}
if (A_CheckSoundPlaying(vm.g_i,*insptr))
A_StopSound((int16_t)*insptr,vm.g_i);
@ -1041,7 +1041,7 @@ static int32_t X_DoExecute(void)
if ((*insptr<0 || *insptr>=MAXSOUNDS) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr);
insptr++;break;
insptr++; break;
}
if (vm.g_p == screenpeek || (GametypeFlags[ud.coop]&GAMETYPE_COOPSOUND))
A_PlaySound((int16_t) *insptr,g_player[screenpeek].ps->i);
@ -1053,7 +1053,7 @@ static int32_t X_DoExecute(void)
if ((*insptr<0 || *insptr>=MAXSOUNDS) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr);
insptr++;break;
insptr++; break;
}
A_PlaySound((int16_t) *insptr++,vm.g_i);
break;
@ -1162,7 +1162,7 @@ static int32_t X_DoExecute(void)
if ((*insptr<0 || *insptr>=MAX_WEAPONS) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],*insptr);
insptr+=2;break;
insptr+=2; break;
}
if (g_player[vm.g_p].ps->ammo_amount[*insptr] >= g_player[vm.g_p].ps->max_ammo_amount[*insptr])
{
@ -1220,7 +1220,7 @@ static int32_t X_DoExecute(void)
if ((*insptr<0 ||*insptr>=MAX_WEAPONS) && g_scriptSanityChecks)
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],*insptr);
insptr+=2;break;
insptr+=2; break;
}
if (g_player[vm.g_p].ps->gotweapon[*insptr] == 0)
{
@ -1388,22 +1388,22 @@ static int32_t X_DoExecute(void)
switch (tw)
{
case CON_ACTIVATEBYSECTOR:
if ((var1<0 || var1>=numsectors) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1);break;}
if ((var1<0 || var1>=numsectors) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
activatebysector(var1, var2);
break;
case CON_OPERATESECTORS:
if ((var1<0 || var1>=numsectors) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1);break;}
if ((var1<0 || var1>=numsectors) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
G_OperateSectors(var1, var2);
break;
case CON_OPERATEACTIVATORS:
if ((var2<0 || var2>=ud.multimode) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid player %d\n",g_errorLineNum,keyw[g_tw],var2);break;}
if ((var2<0 || var2>=ud.multimode) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid player %d\n",g_errorLineNum,keyw[g_tw],var2); break;}
G_OperateActivators(var1, var2);
break;
case CON_SETASPECT:
setaspect(var1, var2);
break;
case CON_SSP:
if ((var1<0 || var1>=MAXSPRITES) && g_scriptSanityChecks) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],var1);break;}
if ((var1<0 || var1>=MAXSPRITES) && g_scriptSanityChecks) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
A_SetSprite(var1, var2);
break;
}
@ -1601,7 +1601,7 @@ static int32_t X_DoExecute(void)
s1=ScriptQuotes[q1];
s2=ScriptQuotes[q2];
while (*s2&&st--)s2++;
while ((*s1=*s2)&&ln--) {s1++;s2++;}
while ((*s1=*s2)&&ln--) {s1++; s2++;}
*s1=0;
}
break;
@ -1682,8 +1682,8 @@ static int32_t X_DoExecute(void)
Bstrcpy(ScriptQuotes[i],ScriptQuotes[j]);
break;
case CON_CHANGESPRITESECT:
if ((i<0 || i>=MAXSPRITES) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],i);break;}
if ((j<0 || j>=numsectors) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],j);break;}
if ((i<0 || i>=MAXSPRITES) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],i); break;}
if ((j<0 || j>=numsectors) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],j); break;}
changespritesect(i,j);
break;
}
@ -1821,7 +1821,7 @@ static int32_t X_DoExecute(void)
//Bsprintf(g_szBuf,"Checking %d cases for %d",lCases, lValue);
//AddLog(g_szBuf);
left=0;right=lCases-1;
left=0; right=lCases-1;
while (!bMatched)
{
//Bsprintf(g_szBuf,"Checking #%d Value= %d",lCheckCase, lpCases[lCheckCase*2]);
@ -2097,21 +2097,21 @@ static int32_t X_DoExecute(void)
switch (tw)
{
case CON_SOUNDONCEVAR:
if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);break;}
if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); break;}
if (!A_CheckSoundPlaying(vm.g_i,j))
A_PlaySound((int16_t)j,vm.g_i);
break;
case CON_GLOBALSOUNDVAR:
if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);break;}
if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); break;}
A_PlaySound((int16_t)j,g_player[screenpeek].ps->i);
break;
case CON_STOPSOUNDVAR:
if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);break;}
if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); break;}
if (A_CheckSoundPlaying(vm.g_i,j))
A_StopSound((int16_t)j,vm.g_i);
break;
case CON_SOUNDVAR:
if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);break;}
if ((j<0 || j>=MAXSOUNDS) && g_scriptSanityChecks) {OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); break;}
A_PlaySound((int16_t)j,vm.g_i);
break;
}
@ -2208,7 +2208,7 @@ static int32_t X_DoExecute(void)
{
int32_t j, i = 0, k, dst = 0x7fffffff;
for (k=g_mirrorCount-1;k>=0;k--)
for (k=g_mirrorCount-1; k>=0; k--)
{
j = klabs(wall[g_mirrorWall[k]].x-x);
j += klabs(wall[g_mirrorWall[k]].y-y);
@ -2265,7 +2265,7 @@ static int32_t X_DoExecute(void)
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++);
if (tw == CON_ROTATESPRITE && !(orientation & 256)) {x<<=16;y<<=16;}
if (tw == CON_ROTATESPRITE && !(orientation & 256)) {x<<=16; y<<=16;}
rotatesprite(x,y,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2);
break;
}
@ -2581,7 +2581,7 @@ static int32_t X_DoExecute(void)
int32_t s, l, j;
if (vm.g_sp->sectnum >= 0 && vm.g_sp->sectnum < MAXSECTORS)
for (j=(*insptr)-1;j>=0;j--)
for (j=(*insptr)-1; j>=0; j--)
{
if (vm.g_sp->picnum == BLIMP && dnum == SCRAP1)
s = 0;
@ -3062,7 +3062,7 @@ static int32_t X_DoExecute(void)
{
int32_t j = 2;
g_player[vm.g_p].ps->pals_time = *insptr++;
for (;j>=0;j--)
for (; j>=0; j--)
g_player[vm.g_p].ps->pals[2-j] = *insptr++;
}
break;
@ -4045,13 +4045,13 @@ static int32_t X_DoExecute(void)
switch (Gv_GetVarX(*(insptr++)))
{
default:
case 0:P_SetGamePalette(g_player[vm.g_p].ps,palette ,0);break;
case 1:P_SetGamePalette(g_player[vm.g_p].ps,waterpal ,0);break;
case 2:P_SetGamePalette(g_player[vm.g_p].ps,slimepal ,0);break;
case 3:P_SetGamePalette(g_player[vm.g_p].ps,drealms ,0);break;
case 4:P_SetGamePalette(g_player[vm.g_p].ps,titlepal ,0);break;
case 5:P_SetGamePalette(g_player[vm.g_p].ps,endingpal,0);break;
case 6:P_SetGamePalette(g_player[vm.g_p].ps,animpal ,0);break;
case 0:P_SetGamePalette(g_player[vm.g_p].ps,palette ,0); break;
case 1:P_SetGamePalette(g_player[vm.g_p].ps,waterpal ,0); break;
case 2:P_SetGamePalette(g_player[vm.g_p].ps,slimepal ,0); break;
case 3:P_SetGamePalette(g_player[vm.g_p].ps,drealms ,0); break;
case 4:P_SetGamePalette(g_player[vm.g_p].ps,titlepal ,0); break;
case 5:P_SetGamePalette(g_player[vm.g_p].ps,endingpal,0); break;
case 6:P_SetGamePalette(g_player[vm.g_p].ps,animpal ,0); break;
}
break;
@ -4299,7 +4299,7 @@ static int32_t X_DoExecute(void)
if (cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(4<<8),vm.g_sp->sectnum,g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,g_player[vm.g_p].ps->posz+(16<<8),sprite[g_player[vm.g_p].ps->i].sectnum))
{
int32_t j = ud.multimode-1;
for (;j>=0;j--)
for (; j>=0; j--)
{
if (g_player[j].ps->actorsqu == vm.g_i)
break;
@ -4421,7 +4421,7 @@ static int32_t X_DoExecute(void)
case CON_IFNOSOUNDS:
{
int32_t j = MAXSOUNDS-1;
for (;j>=0;j--)
for (; j>=0; j--)
if (g_sounds[j].SoundOwner[0].i == vm.g_i)
break;
@ -4630,7 +4630,7 @@ void G_SaveMapState(mapstate_t *save)
Bmemcpy(&save->prevspritestat[STAT_DEFAULT],&prevspritestat[STAT_DEFAULT],sizeof(prevspritestat));
Bmemcpy(&save->nextspritestat[STAT_DEFAULT],&nextspritestat[STAT_DEFAULT],sizeof(nextspritestat));
for (i=MAXSPRITES-1;i>=0;i--)
for (i=MAXSPRITES-1; i>=0; i--)
{
save->scriptptrs[i] = 0;
@ -4657,7 +4657,7 @@ void G_SaveMapState(mapstate_t *save)
Bmemcpy(&save->ActorExtra[0],&ActorExtra[0],sizeof(ActorData_t)*MAXSPRITES);
for (i=MAXSPRITES-1;i>=0;i--)
for (i=MAXSPRITES-1; i>=0; i--)
{
if (actorscrptr[PN] == 0) continue;
j = (intptr_t)&script[0];
@ -4693,16 +4693,16 @@ void G_SaveMapState(mapstate_t *save)
Bmemcpy(&save->animatevel[0],&animatevel[0],sizeof(animatevel));
Bmemcpy(&save->g_animateCount,&g_animateCount,sizeof(g_animateCount));
Bmemcpy(&save->animatesect[0],&animatesect[0],sizeof(animatesect));
for (i = g_animateCount-1;i>=0;i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]-(intptr_t)(&sector[0]));
for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]-(intptr_t)(&sector[0]));
Bmemcpy(&save->animateptr[0],&animateptr[0],sizeof(animateptr));
for (i = g_animateCount-1;i>=0;i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
Bmemcpy(&save->g_numPlayerSprites,&g_numPlayerSprites,sizeof(g_numPlayerSprites));
Bmemcpy(&save->g_earthquakeTime,&g_earthquakeTime,sizeof(g_earthquakeTime));
Bmemcpy(&save->lockclock,&lockclock,sizeof(lockclock));
Bmemcpy(&save->randomseed,&randomseed,sizeof(randomseed));
Bmemcpy(&save->g_globalRandom,&g_globalRandom,sizeof(g_globalRandom));
for (i=g_gameVarCount-1; i>=0;i--)
for (i=g_gameVarCount-1; i>=0; i--)
{
if (aGameVars[i].dwFlags & GAMEVAR_NORESET) continue;
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
@ -4734,7 +4734,7 @@ void G_RestoreMapState(mapstate_t *save)
intptr_t j;
char phealth[MAXPLAYERS];
for (i=0;i<ud.multimode;i++)
for (i=0; i<ud.multimode; i++)
phealth[i] = sprite[g_player[i].ps->i].extra;
pub = NUMPAGES;
@ -4755,7 +4755,7 @@ void G_RestoreMapState(mapstate_t *save)
Bmemcpy(&nextspritestat[STAT_DEFAULT],&save->nextspritestat[STAT_DEFAULT],sizeof(nextspritestat));
Bmemcpy(&ActorExtra[0],&save->ActorExtra[0],sizeof(ActorData_t)*MAXSPRITES);
for (i=MAXSPRITES-1;i>=0;i--)
for (i=MAXSPRITES-1; i>=0; i--)
{
j = (intptr_t)(&script[0]);
if (save->scriptptrs[i]&1) T2 += j;
@ -4787,14 +4787,14 @@ void G_RestoreMapState(mapstate_t *save)
Bmemcpy(&g_animateCount,&save->g_animateCount,sizeof(g_animateCount));
Bmemcpy(&animatesect[0],&save->animatesect[0],sizeof(animatesect));
Bmemcpy(&animateptr[0],&save->animateptr[0],sizeof(animateptr));
for (i = g_animateCount-1;i>=0;i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
Bmemcpy(&g_numPlayerSprites,&save->g_numPlayerSprites,sizeof(g_numPlayerSprites));
Bmemcpy(&g_earthquakeTime,&save->g_earthquakeTime,sizeof(g_earthquakeTime));
Bmemcpy(&lockclock,&save->lockclock,sizeof(lockclock));
Bmemcpy(&randomseed,&save->randomseed,sizeof(randomseed));
Bmemcpy(&g_globalRandom,&save->g_globalRandom,sizeof(g_globalRandom));
for (i=g_gameVarCount-1;i>=0;i--)
for (i=g_gameVarCount-1; i>=0; i--)
{
if (aGameVars[i].dwFlags & GAMEVAR_NORESET) continue;
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
@ -4806,7 +4806,7 @@ void G_RestoreMapState(mapstate_t *save)
Gv_RefreshPointers();
for (i=0;i<ud.multimode;i++)
for (i=0; i<ud.multimode; i++)
sprite[g_player[i].ps->i].extra = phealth[i];
if (g_player[myconnectindex].ps->over_shoulder_on != 0)
@ -4820,13 +4820,13 @@ void G_RestoreMapState(mapstate_t *save)
if (ud.lockout == 0)
{
for (x=g_numAnimWalls-1;x>=0;x--)
for (x=g_numAnimWalls-1; x>=0; x--)
if (wall[animwall[x].wallnum].extra >= 0)
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
}
else
{
for (x=g_numAnimWalls-1;x>=0;x--)
for (x=g_numAnimWalls-1; x>=0; x--)
switch (DynamicTileMap[wall[animwall[x].wallnum].picnum])
{
case FEMPIC1__STATIC:
@ -4877,8 +4877,8 @@ void G_RestoreMapState(mapstate_t *save)
k = nextspritestat[k];
}
for (i=g_numInterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
for (i = g_animateCount-1;i>=0;i--)
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
for (i = g_animateCount-1; i>=0; i--)
G_SetInterpolation(animateptr[i]);
Net_ResetPrediction();

View file

@ -38,7 +38,7 @@ static void Gv_Free(void) /* called from Gv_ReadSave() and Gv_ResetVars() */
// call this function as many times as needed.
int32_t i=(MAXGAMEVARS-1);
// AddLog("Gv_Free");
for (;i>=0;i--)
for (; i>=0; i--)
{
if (aGameVars[i].dwFlags & (GAMEVAR_USER_MASK) && aGameVars[i].val.plValues)
{
@ -66,7 +66,7 @@ static void Gv_Clear(void)
//AddLog("Gv_Clear");
for (;i>=0;i--)
for (; i>=0; i--)
{
if (aGameVars[i].szLabel)
Bfree(aGameVars[i].szLabel);
@ -113,7 +113,7 @@ int32_t Gv_ReadSave(int32_t fil)
// AddLog(g_szBuf);
if (kdfread(&g_gameVarCount,sizeof(g_gameVarCount),1,fil) != 1) goto corrupt;
for (i=0;i<g_gameVarCount;i++)
for (i=0; i<g_gameVarCount; i++)
{
if (kdfread(&(aGameVars[i]),sizeof(gamevar_t),1,fil) != 1) goto corrupt;
aGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(uint8_t));
@ -141,7 +141,7 @@ int32_t Gv_ReadSave(int32_t fil)
Gv_RefreshPointers();
if (kdfread(&g_gameArrayCount,sizeof(g_gameArrayCount),1,fil) != 1) goto corrupt;
for (i=0;i<g_gameArrayCount;i++)
for (i=0; i<g_gameArrayCount; i++)
{
if (kdfread(&(aGameArrays[i]),sizeof(gamearray_t),1,fil) != 1) goto corrupt;
aGameArrays[i].szLabel=Bcalloc(MAXARRAYLABEL,sizeof(uint8_t));
@ -155,7 +155,7 @@ int32_t Gv_ReadSave(int32_t fil)
// Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__);
// AddLog(g_szBuf);
if (kdfread(apScriptGameEvent,sizeof(apScriptGameEvent),1,fil) != 1) goto corrupt;
for (i=0;i<MAXGAMEEVENTS;i++)
for (i=0; i<MAXGAMEEVENTS; i++)
if (apScriptGameEvent[i])
{
l = (intptr_t)apScriptGameEvent[i]+(intptr_t)&script[0];
@ -167,14 +167,14 @@ int32_t Gv_ReadSave(int32_t fil)
if (kdfread(&savedstate[0],sizeof(savedstate),1,fil) != 1) goto corrupt;
for (i=0;i<(MAXVOLUMES*MAXLEVELS);i++)
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
{
if (savedstate[i])
{
if (MapInfo[i].savedstate == NULL)
MapInfo[i].savedstate = Bcalloc(1,sizeof(mapstate_t));
if (kdfread(MapInfo[i].savedstate,sizeof(mapstate_t),1,fil) != sizeof(mapstate_t)) goto corrupt;
for (j=0;j<g_gameVarCount;j++)
for (j=0; j<g_gameVarCount; j++)
{
if (aGameVars[j].dwFlags & GAMEVAR_NORESET) continue;
if (aGameVars[j].dwFlags & GAMEVAR_PERPLAYER)
@ -231,7 +231,7 @@ void Gv_WriteSave(FILE *fil)
// AddLog("Saving Game Vars to File");
dfwrite(&g_gameVarCount,sizeof(g_gameVarCount),1,fil);
for (i=0;i<g_gameVarCount;i++)
for (i=0; i<g_gameVarCount; i++)
{
dfwrite(&(aGameVars[i]),sizeof(gamevar_t),1,fil);
dfwrite(aGameVars[i].szLabel,sizeof(uint8_t) * MAXVARLABEL, 1, fil);
@ -252,38 +252,38 @@ void Gv_WriteSave(FILE *fil)
dfwrite(&g_gameArrayCount,sizeof(g_gameArrayCount),1,fil);
for (i=0;i<g_gameArrayCount;i++)
for (i=0; i<g_gameArrayCount; i++)
{
dfwrite(&(aGameArrays[i]),sizeof(gamearray_t),1,fil);
dfwrite(aGameArrays[i].szLabel,sizeof(uint8_t) * MAXARRAYLABEL, 1, fil);
dfwrite(aGameArrays[i].plValues,sizeof(intptr_t) * aGameArrays[i].size, 1, fil);
}
for (i=0;i<MAXGAMEEVENTS;i++)
for (i=0; i<MAXGAMEEVENTS; i++)
if (apScriptGameEvent[i])
{
l = (intptr_t)apScriptGameEvent[i]-(intptr_t)&script[0];
apScriptGameEvent[i] = (intptr_t *)l;
}
dfwrite(apScriptGameEvent,sizeof(apScriptGameEvent),1,fil);
for (i=0;i<MAXGAMEEVENTS;i++)
for (i=0; i<MAXGAMEEVENTS; i++)
if (apScriptGameEvent[i])
{
l = (intptr_t)apScriptGameEvent[i]+(intptr_t)&script[0];
apScriptGameEvent[i] = (intptr_t *)l;
}
for (i=0;i<(MAXVOLUMES*MAXLEVELS);i++)
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
if (MapInfo[i].savedstate != NULL)
savedstate[i] = 1;
dfwrite(&savedstate[0],sizeof(savedstate),1,fil);
for (i=0;i<(MAXVOLUMES*MAXLEVELS);i++)
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
if (MapInfo[i].savedstate)
{
dfwrite(MapInfo[i].savedstate,sizeof(mapstate_t),1,fil);
for (j=0;j<g_gameVarCount;j++)
for (j=0; j<g_gameVarCount; j++)
{
if (aGameVars[j].dwFlags & GAMEVAR_NORESET) continue;
if (aGameVars[j].dwFlags & GAMEVAR_PERPLAYER)
@ -309,7 +309,7 @@ void Gv_DumpValues(void)
OSD_Printf("// Current Game Definitions\n\n");
for (i=0;i<g_gameVarCount;i++)
for (i=0; i<g_gameVarCount; i++)
{
if (aGameVars[i].dwFlags & (GAMEVAR_SECRET))
continue; // do nothing...
@ -353,13 +353,13 @@ void Gv_ResetVars(void) /* this is called during a new game and nowhere else */
Gv_Free();
OSD_errors=0;
for (i=0;i<MAXGAMEVARS;i++)
for (i=0; i<MAXGAMEVARS; i++)
{
if (aGameVars[i].szLabel != NULL && aGameVars[i].dwFlags & GAMEVAR_RESET)
Gv_NewVar(aGameVars[i].szLabel,aGameVars[i].lDefault,aGameVars[i].dwFlags);
}
for (i=0;i<MAXGAMEARRAYS;i++)
for (i=0; i<MAXGAMEARRAYS; i++)
{
if (aGameArrays[i].szLabel != NULL && aGameArrays[i].bReset)
Gv_NewArray(aGameArrays[i].szLabel,aGameArrays[i].size);
@ -488,14 +488,14 @@ int32_t Gv_NewVar(const char *pszLabel, int32_t lValue, uint32_t dwFlags)
{
if (!aGameVars[i].val.plValues)
aGameVars[i].val.plValues=Bcalloc(MAXPLAYERS,sizeof(intptr_t));
for (j=MAXPLAYERS-1;j>=0;j--)
for (j=MAXPLAYERS-1; j>=0; j--)
aGameVars[i].val.plValues[j]=lValue;
}
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
{
if (!aGameVars[i].val.plValues)
aGameVars[i].val.plValues=Bcalloc(MAXSPRITES,sizeof(intptr_t));
for (j=MAXSPRITES-1;j>=0;j--)
for (j=MAXSPRITES-1; j>=0; j--)
aGameVars[i].val.plValues[j]=lValue;
}
else aGameVars[i].val.lValue = lValue;
@ -506,7 +506,7 @@ int32_t Gv_NewVar(const char *pszLabel, int32_t lValue, uint32_t dwFlags)
void A_ResetVars(int32_t iActor)
{
int32_t i=(MAXGAMEVARS-1);
for (;i>=0;i--)
for (; i>=0; i--)
if ((aGameVars[i].dwFlags & GAMEVAR_PERACTOR) && !(aGameVars[i].dwFlags & GAMEVAR_NODEFAULT))
aGameVars[i].val.plValues[iActor]=aGameVars[i].lDefault;
}
@ -944,9 +944,9 @@ void Gv_ResetSystemDefaults(void)
//AddLog("ResetWeaponDefaults");
for (j=MAXPLAYERS-1;j>=0;j--)
for (j=MAXPLAYERS-1; j>=0; j--)
{
for (i=MAX_WEAPONS-1;i>=0;i--)
for (i=MAX_WEAPONS-1; i>=0; i--)
{
Bsprintf(aszBuf,"WEAPON%d_CLIP",i);
aplWeaponClip[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j);
@ -1602,7 +1602,7 @@ void Gv_InitWeaponPointers(void)
//AddLog("Gv_InitWeaponPointers");
for (i=(MAX_WEAPONS-1);i>=0;i--)
for (i=(MAX_WEAPONS-1); i>=0; i--)
{
Bsprintf(aszBuf,"WEAPON%d_CLIP",i);
aplWeaponClip[i]=Gv_GetVarDataPtr(aszBuf);

View file

@ -482,7 +482,7 @@ static void M_DisplaySaveGameList(void)
int32_t x, c = 160;
c += 64;
for (x = 0;x <= 108;x += 12)
for (x = 0; x <= 108; x += 12)
rotatesprite((c+91-64)<<16,(x+56)<<16,65536L,0,TEXTBOX,24,0,10,0,0,xdim-1,ydim-1);
rotatesprite(22<<16,97<<16,65536L,0,WINDOWBORDER2,24,0,10,0,0,xdim-1,ydim-1);
@ -490,7 +490,7 @@ static void M_DisplaySaveGameList(void)
rotatesprite(99<<16,50<<16,65536L,512,WINDOWBORDER1,24,0,10,0,0,xdim-1,ydim-1);
rotatesprite(103<<16,144<<16,65536L,1024+512,WINDOWBORDER1,24,0,10,0,0,xdim-1,ydim-1);
for (x=0;x<=9;x++)
for (x=0; x<=9; x++)
minitext(c,48+(12*x),ud.savegame[x],2,10+16);
}
@ -526,7 +526,7 @@ void G_CheckPlayerColor(int32_t *color, int32_t prev_color)
{
int32_t i, disallowed[] = { 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20, 22 };
for (i=0;i<(signed)(sizeof(disallowed)/sizeof(disallowed[0]));i++)
for (i=0; i<(signed)(sizeof(disallowed)/sizeof(disallowed[0])); i++)
{
while (*color == disallowed[i])
{
@ -576,8 +576,8 @@ void M_DisplayMenus(void)
if (getrendermode() >= 3)
{
int32_t x,y=0;
for (;y<ydim;y+=tilesizy[MENUSCREEN])
for (x=0;x<xdim;x+=tilesizx[MENUSCREEN])
for (; y<ydim; y+=tilesizy[MENUSCREEN])
for (x=0; x<xdim; x+=tilesizx[MENUSCREEN])
rotatesprite(x<<16,y<<16,65536L,0,MENUSCREEN,80,0,1+8+16,0,0,xdim-1,ydim-1);
}
@ -992,7 +992,7 @@ void M_DisplayMenus(void)
g_currentMenu = 20004;
}
}
for (i=0;i<10;i++)
for (i=0; i<10; i++)
{
if (g_currentMenu == 20005 && i == last_menu_pos) continue;
mgametextpal(26,40+(i<<3),ud.ridecule[i],MENUHIGHLIGHT(i),0);
@ -1360,7 +1360,7 @@ void M_DisplayMenus(void)
ud.lockout = 0;
buf[0] = 0;
for (x=0;x<g_numAnimWalls;x++)
for (x=0; x<g_numAnimWalls; x++)
if (wall[animwall[x].wallnum].picnum != W_SCREENBREAK &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+1 &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+2)
@ -1383,7 +1383,7 @@ void M_DisplayMenus(void)
if (ud.pwlockout[0] == 0)
{
ud.lockout = 0;
for (x=0;x<g_numAnimWalls;x++)
for (x=0; x<g_numAnimWalls; x++)
if (wall[animwall[x].wallnum].picnum != W_SCREENBREAK &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+1 &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+2)
@ -1402,7 +1402,7 @@ void M_DisplayMenus(void)
{
ud.lockout = 1;
for (x=0;x<g_numAnimWalls;x++)
for (x=0; x<g_numAnimWalls; x++)
switch (DynamicTileMap[wall[animwall[x].wallnum].picnum])
{
case FEMPIC1__STATIC:
@ -2135,7 +2135,7 @@ cheat_for_port_credits:
}
else
{
for (i=0;i<g_numVolumes;i++)
for (i=0; i<g_numVolumes; i++)
menutext(160,60-(g_numVolumes*2)+(20*i),MENUHIGHLIGHT(i),PHX(-2),EpisodeNames[i]);
menutext(160,60-(g_numVolumes*2)+(20*i),MENUHIGHLIGHT(i),PHX(-6),"USER MAP");
@ -3549,7 +3549,7 @@ cheat_for_port_credits:
if (!p) continue;
strcpy(tempbuf, p);
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(70,34+l*8,tempbuf,(m+l == probey)?0:16,1,10+16);
//strcpy(tempbuf, KB_ScanCodeToString(ud.config.KeyboardKeys[m+l][0]));
@ -3701,7 +3701,7 @@ cheat_for_port_credits:
else
{
strcpy(tempbuf, CONFIG_FunctionNumToName(m));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(c+100+20,34+l*8,tempbuf,(l==probey)?0:16,2,10+16);
}
}
@ -3904,7 +3904,7 @@ cheat_for_port_credits:
else
strcpy(tempbuf, CONFIG_FunctionNumToName(m+l));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitext(100,51+l*8,tempbuf,(m+l == probey)?0:16,10+16);
}
@ -4022,7 +4022,7 @@ cheat_for_port_credits:
else
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[1][0]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(c+10+60,93+16,tempbuf,MENUHIGHLIGHT(3),0,10+16);
mgametextpal(c+10,92+16+9,"DOWN:",MENUHIGHLIGHT(4),10);
@ -4031,7 +4031,7 @@ cheat_for_port_credits:
else
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[1][1]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(c+10+60,93+16+9,tempbuf,MENUHIGHLIGHT(4),0,10+16);
mgametextpal(c+10,92+16+9+9,"LEFT:",MENUHIGHLIGHT(5),10);
@ -4040,7 +4040,7 @@ cheat_for_port_credits:
else
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[0][0]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(c+10+60,93+16+9+9,tempbuf,MENUHIGHLIGHT(5),0,10+16);
mgametextpal(c+10,92+16+9+9+9,"RIGHT:",MENUHIGHLIGHT(6),10);
@ -4049,7 +4049,7 @@ cheat_for_port_credits:
else
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[0][1]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(c+10+60,93+16+9+9+9,tempbuf,MENUHIGHLIGHT(6),0,10+16);
break;
@ -4143,7 +4143,7 @@ cheat_for_port_credits:
else
{
strcpy(tempbuf, CONFIG_FunctionNumToName(x));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitextshade(176,33+l*8,tempbuf,(m+l==probey)?0:16,2,10+16);
}
}
@ -4271,7 +4271,7 @@ cheat_for_port_credits:
else
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][0]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitext(140+12,38+15,tempbuf,0,10+16);
if (ud.config.JoystickDigitalFunctions[thispage*2][1] < 0)
@ -4279,7 +4279,7 @@ cheat_for_port_credits:
else
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][1]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitext(140+12+72,38+15,tempbuf,0,10+16);
mgametext(76,38+15+15,"ANALOG",0,2+8+16);
@ -4312,7 +4312,7 @@ cheat_for_port_credits:
else
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][0]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitext(140+12,38+15+64,tempbuf,0,10+16);
if (ud.config.JoystickDigitalFunctions[thispage*2+1][1] < 0)
@ -4320,7 +4320,7 @@ cheat_for_port_credits:
else
strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][1]));
for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
for (i=0; tempbuf[i]; i++) if (tempbuf[i]=='_') tempbuf[i] = ' ';
minitext(140+12+72,38+15+64,tempbuf,0,10+16);
mgametext(76,38+64+15+15,"ANALOG",0,2+8+16);
@ -4372,7 +4372,7 @@ cheat_for_port_credits:
break;
}
for (m=first;m<last-1;m++)
for (m=first; m<last-1; m++)
{
int32_t odx,dx,ody,dy;
Bstrcpy(tempbuf,(char *)getjoyname(0,m));
@ -4561,7 +4561,7 @@ cheat_for_port_credits:
int32_t rates[] = { 8000, 11025, 16000, 22050, 32000, 44100, 48000 };
int32_t j = (sizeof(rates)/sizeof(rates[0]));
for (i = 0;i<j;i++)
for (i = 0; i<j; i++)
if (rates[i] == ud.config.MixRate)
break;
@ -5103,7 +5103,7 @@ VOLUME_ALL_40x:
{
if (voting == myconnectindex)
{
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;
@ -5122,7 +5122,7 @@ VOLUME_ALL_40x:
ChangeToMenu(0);
}
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
{
plrvotes += g_player[i].vote;
j += g_player[i].gotvote;
@ -5158,7 +5158,7 @@ VOLUME_ALL_40x:
}
else if (j == numplayers)
{
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;
@ -5309,7 +5309,7 @@ VOLUME_ALL_40x:
{
if (g_player[myconnectindex].ps->i)
{
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;

View file

@ -1533,7 +1533,7 @@ void inithashnames()
{
int32_t i;
hash_init(&dynnamesH);
for (i=0;list[i].val;i++)
for (i=0; list[i].val; i++)
hash_add(&dynnamesH,list[i].s,i);
}

View file

@ -112,7 +112,7 @@ static int32_t osdcmd_changelevel(const osdfuncparm_t *parm)
{
int32_t i;
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;
@ -271,7 +271,7 @@ static int32_t osdcmd_map(const osdfuncparm_t *parm)
{
int32_t i;
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
{
g_player[i].vote = 0;
g_player[i].gotvote = 0;
@ -908,7 +908,7 @@ static int32_t osdcmd_give(const osdfuncparm_t *parm)
}
else if (!Bstrcasecmp(parm->parms[0], "ammo"))
{
for (i=MAX_WEAPONS-(VOLUMEONE?6:1)-1;i>=PISTOL_WEAPON;i--)
for (i=MAX_WEAPONS-(VOLUMEONE?6:1)-1; i>=PISTOL_WEAPON; i--)
P_AddAmmo(i,g_player[myconnectindex].ps,g_player[myconnectindex].ps->max_ammo_amount[i]);
return OSDCMD_OK;
}
@ -1138,8 +1138,8 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
if (parm->numparms==1&&!Bstrcasecmp(parm->parms[0],"showkeys"))
{
for (i=0;ConsoleKeys[i].name;i++)OSD_Printf("%s\n",ConsoleKeys[i].name);
for (i=0;i<MAXMOUSEBUTTONS;i++)OSD_Printf("%s\n",ConsoleButtons[i]);
for (i=0; ConsoleKeys[i].name; i++)OSD_Printf("%s\n",ConsoleKeys[i].name);
for (i=0; i<MAXMOUSEBUTTONS; i++)OSD_Printf("%s\n",ConsoleButtons[i]);
return OSDCMD_OK;
}
@ -1148,14 +1148,14 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
int32_t j=0;
OSD_Printf("Current key bindings:\n");
for (i=0;i<MAXBOUNDKEYS;i++)
for (i=0; i<MAXBOUNDKEYS; i++)
if (KeyBindings[i].cmd[0] && KeyBindings[i].key)
{
j++;
OSD_Printf("%-9s %s\"%s\"\n",KeyBindings[i].key, KeyBindings[i].repeat?"":"norepeat ", KeyBindings[i].cmd);
}
for (i=0;i<MAXMOUSEBUTTONS;i++)
for (i=0; i<MAXMOUSEBUTTONS; i++)
if (MouseBindings[i].cmd[0] && MouseBindings[i].key)
{
j++;
@ -1168,13 +1168,13 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
for (i=0;ConsoleKeys[i].name;i++)
for (i=0; ConsoleKeys[i].name; i++)
if (!Bstrcasecmp(parm->parms[0],ConsoleKeys[i].name))
break;
if (!ConsoleKeys[i].name)
{
for (i=0;i<MAXMOUSEBUTTONS;i++)
for (i=0; i<MAXMOUSEBUTTONS; i++)
if (!Bstrcasecmp(parm->parms[0],ConsoleButtons[i]))
break;
if (i >= MAXMOUSEBUTTONS)
@ -1196,7 +1196,7 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
}
Bstrcpy(tempbuf,parm->parms[j++]);
for (;j<parm->numparms;j++)
for (; j<parm->numparms; j++)
{
Bstrcat(tempbuf," ");
Bstrcat(tempbuf,parm->parms[j++]);
@ -1225,7 +1225,7 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
}
Bstrcpy(tempbuf,parm->parms[j++]);
for (;j<parm->numparms;j++)
for (; j<parm->numparms; j++)
{
Bstrcat(tempbuf," ");
Bstrcat(tempbuf,parm->parms[j++]);
@ -1244,10 +1244,10 @@ static int32_t osdcmd_unbindall(const osdfuncparm_t *parm)
UNREFERENCED_PARAMETER(parm);
for (i=0;i<MAXBOUNDKEYS;i++)
for (i=0; i<MAXBOUNDKEYS; i++)
if (KeyBindings[i].cmd[0])
KeyBindings[i].cmd[0] = 0;
for (i=0;i<MAXMOUSEBUTTONS;i++)
for (i=0; i<MAXMOUSEBUTTONS; i++)
if (MouseBindings[i].cmd[0])
MouseBindings[i].cmd[0] = 0;
OSD_Printf("unbound all keys\n");
@ -1259,12 +1259,12 @@ static int32_t osdcmd_unbind(const osdfuncparm_t *parm)
int32_t i;
if (parm->numparms < 1) return OSDCMD_SHOWHELP;
for (i=0;ConsoleKeys[i].name;i++)
for (i=0; ConsoleKeys[i].name; i++)
if (!Bstrcasecmp(parm->parms[0],ConsoleKeys[i].name))
break;
if (!ConsoleKeys[i].name)
{
for (i=0;i<MAXMOUSEBUTTONS;i++)
for (i=0; i<MAXMOUSEBUTTONS; i++)
if (!Bstrcasecmp(parm->parms[0],ConsoleButtons[i]))
break;
if (i >= MAXMOUSEBUTTONS)
@ -1490,7 +1490,7 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("fileinfo","fileinfo <file>: gets a file's information", osdcmd_fileinfo);
for (i=0;i<NUMGAMEFUNCTIONS;i++)
for (i=0; i<NUMGAMEFUNCTIONS; i++)
{
char *t;
int32_t j;
@ -1499,7 +1499,7 @@ int32_t registerosdcommands(void)
Bsprintf(tempbuf,"gamefunc_%s",gamefunctions[i]);
t = Bstrdup(tempbuf);
for (j=Bstrlen(t);j>=0;j--)
for (j=Bstrlen(t); j>=0; j--)
t[j] = Btolower(t[j]);
Bstrcat(tempbuf,": game button");
OSD_RegisterFunction(t,Bstrdup(tempbuf),osdcmd_button);

View file

@ -156,8 +156,8 @@ void GAME_clearbackground(int32_t c, int32_t r)
// ty2 = ydim/ysiz;
ty2 = daydim/ysiz;
for (x=tx2;x>=0;x--)
for (y=ty2;y>=0;y--)
for (x=tx2; x>=0; x--)
for (y=ty2; y>=0; y--)
// for (y=ty2+1;y>=1;y--)
// rotatesprite(x*xsiz<<16,((daydim-ydim)+(y*ysiz))<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim);
rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim);
@ -166,7 +166,7 @@ void GAME_clearbackground(int32_t c, int32_t r)
tx2 = xdim/xsiz;
ysiz = tilesizx[BORDTILE];
for (x=tx2;x>=0;x--)
for (x=tx2; x>=0; x--)
rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1);
}

View file

@ -128,7 +128,7 @@ static void A_DoWaterTracers(int32_t x1,int32_t y1,int32_t z1,int32_t x2,int32_t
if ((klabs(x1-x2)+klabs(y1-y2)) < 3084)
return;
for (i=n;i>0;i--)
for (i=n; i>0; i--)
{
x1 += xv;
y1 += yv;
@ -167,7 +167,7 @@ static void A_HitscanProjTrail(const vec3_t *sv, const vec3_t *dv, int32_t ang,
srcvect.y += destvect.y>>2;
srcvect.z += (destvect.z>>2);
for (i=ProjectileData[atwith].tnum;i>0;i--)
for (i=ProjectileData[atwith].tnum; i>0; i--)
{
srcvect.x += destvect.x;
srcvect.y += destvect.y;
@ -248,11 +248,11 @@ static int32_t A_FindTargetSprite(spritetype *s,int32_t aang,int32_t atwith)
dx3 = sintable[(a+512)&2047];
dy3 = sintable[a&2047];
for (k=0;k<4;k++)
for (k=0; k<4; k++)
{
if (j >= 0)
break;
for (i=headspritestat[aimstats[k]];i >= 0;i=nextspritestat[i])
for (i=headspritestat[aimstats[k]]; i >= 0; i=nextspritestat[i])
if (sprite[i].xrepeat > 0 && sprite[i].extra >= 0 && (sprite[i].cstat&(257+32768)) == 257)
if (A_CheckEnemySprite(&sprite[i]) || k < 2)
{
@ -1913,7 +1913,7 @@ static void P_DisplaySpitAnim(int32_t snum)
if (g_player[snum].ps->loogcnt == 0) return;
y = (g_player[snum].ps->loogcnt<<2);
for (i=0;i<g_player[snum].ps->numloogs;i++)
for (i=0; i<g_player[snum].ps->numloogs; i++)
{
a = klabs(sintable[((g_player[snum].ps->loogcnt+i)<<5)&2047])>>5;
z = 4096+((g_player[snum].ps->loogcnt+i)<<9);
@ -2090,7 +2090,7 @@ void P_FireWeapon(DukePlayer_t *p)
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum);
// OSD_Printf("doing %d %d %d\n",aplWeaponShoots[p->curr_weapon][snum],p->curr_weapon,snum);
A_Shoot(p->i,aplWeaponShoots[p->curr_weapon][snum]);
for (i=1;i<aplWeaponShotsPerBurst[p->curr_weapon][snum];i++)
for (i=1; i<aplWeaponShotsPerBurst[p->curr_weapon][snum]; i++)
{
if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FIREEVERYOTHER)
{
@ -3546,7 +3546,7 @@ void P_CheckWeapon(DukePlayer_t *p)
snum = sprite[p->i].yvel;
for (i=0;i<10;i++)
for (i=0; i<10; i++)
{
weap = g_player[snum].wchoice[i];
if (VOLUMEONE && weap > 6) continue;
@ -4359,7 +4359,7 @@ void P_ProcessInput(int32_t snum)
if (p->footprintcount > 0 && p->on_ground)
if (p->cursectnum >= 0 && (sector[p->cursectnum].floorstat&2) != 2)
{
for (j=headspritesect[psect];j>=0;j=nextspritesect[j])
for (j=headspritesect[psect]; j>=0; j=nextspritesect[j])
if (sprite[j].picnum == FOOTPRINTS || sprite[j].picnum == FOOTPRINTS2 || sprite[j].picnum == FOOTPRINTS3 || sprite[j].picnum == FOOTPRINTS4)
if (klabs(sprite[j].x-p->posx) < 384)
if (klabs(sprite[j].y-p->posy) < 384)
@ -5713,7 +5713,7 @@ void computergetinput(int32_t snum, input_t *syn)
if ((p->firstaid_amount > 0) && (p->last_extra < 100))
syn->bits |= BIT(SK_MEDKIT);
for (j=headspritestat[STAT_PROJECTILE];j>=0;j=nextspritestat[j])
for (j=headspritestat[STAT_PROJECTILE]; j>=0; j=nextspritestat[j])
{
switch (DynamicTileMap[sprite[j].picnum])
{
@ -5738,7 +5738,7 @@ void computergetinput(int32_t snum, input_t *syn)
x3 = sprite[j].x;
y3 = sprite[j].y;
z3 = sprite[j].z;
for (l=0;l<=8;l++)
for (l=0; l<=8; l++)
{
if (tmulscale11(x3-x1,x3-x1,y3-y1,y3-y1,(z3-z1)>>4,(z3-z1)>>4) < 3072)
{
@ -5857,11 +5857,11 @@ void computergetinput(int32_t snum, input_t *syn)
searchsect[0] = startsect;
searchparent[0] = -1;
dashow2dsector[startsect>>3] |= (1<<(startsect&7));
for (splc=0,send=1;splc<send;splc++)
for (splc=0,send=1; splc<send; splc++)
{
startwall = sector[searchsect[splc]].wallptr;
endwall = startwall + sector[searchsect[splc]].wallnum;
for (i=startwall,wal=&wall[startwall];i<endwall;i++,wal++)
for (i=startwall,wal=&wall[startwall]; i<endwall; i++,wal++)
{
j = wal->nextsector;
if (j < 0) continue;
@ -5881,17 +5881,17 @@ void computergetinput(int32_t snum, input_t *syn)
if (j == endsect)
{
clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L);
for (k=send-1;k>=0;k=searchparent[k])
for (k=send-1; k>=0; k=searchparent[k])
dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7));
for (k=send-1;k>=0;k=searchparent[k])
for (k=send-1; k>=0; k=searchparent[k])
if (!searchparent[k]) break;
goalsect[snum] = searchsect[k];
startwall = sector[goalsect[snum]].wallptr;
endwall = startwall+sector[goalsect[snum]].wallnum;
x3 = y3 = 0;
for (i=startwall;i<endwall;i++)
for (i=startwall; i<endwall; i++)
{
x3 += wall[i].x;
y3 += wall[i].y;
@ -5903,7 +5903,7 @@ void computergetinput(int32_t snum, input_t *syn)
endwall = startwall+sector[startsect].wallnum;
l = 0;
k = startwall;
for (i=startwall;i<endwall;i++)
for (i=startwall; i<endwall; i++)
{
if (wall[i].nextsector != goalsect[snum]) continue;
dx = wall[wall[i].point2].x-wall[i].x;
@ -5936,7 +5936,7 @@ void computergetinput(int32_t snum, input_t *syn)
}
}
for (i=headspritesect[searchsect[splc]];i>=0;i=nextspritesect[i])
for (i=headspritesect[searchsect[splc]]; i>=0; i=nextspritesect[i])
if (sprite[i].lotag == 7)
{
j = sprite[sprite[i].owner].sectnum;
@ -5949,10 +5949,10 @@ void computergetinput(int32_t snum, input_t *syn)
if (j == endsect)
{
clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L);
for (k=send-1;k>=0;k=searchparent[k])
for (k=send-1; k>=0; k=searchparent[k])
dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7));
for (k=send-1;k>=0;k=searchparent[k])
for (k=send-1; k>=0; k=searchparent[k])
if (!searchparent[k]) break;
goalsect[snum] = searchsect[k];
@ -5960,7 +5960,7 @@ void computergetinput(int32_t snum, input_t *syn)
endwall = startwall+sector[startsect].wallnum;
l = 0;
k = startwall;
for (i=startwall;i<endwall;i++)
for (i=startwall; i<endwall; i++)
{
dx = wall[wall[i].point2].x-wall[i].x;
dy = wall[wall[i].point2].y-wall[i].y;
@ -5991,10 +5991,10 @@ void computergetinput(int32_t snum, input_t *syn)
{
int32_t bestsprite = -1, spritescore = 0;
for (k=0;k<16;k++)
for (k=0; k<16; k++)
{
i = (rand()%numsectors);
for (j=headspritesect[i];j>=0;j=nextspritesect[j])
for (j=headspritesect[i]; j>=0; j=nextspritesect[j])
{
if ((sprite[j].xrepeat <= 0) || (sprite[j].yrepeat <= 0)) continue;
if (getspritescore(snum,sprite[j].picnum) <= 0) continue;

View file

@ -66,7 +66,7 @@ static void tloadtile(int32_t tilenume, int32_t type)
i = tilenume;
j = tilenume + (picanm[tilenume]&63);
}
for (;i<=j;i++)
for (; i<=j; i++)
{
if (!(gotpic[i>>3] & pow2char[i&7])) g_precacheCount++;
gotpic[i>>3] |= pow2char[i&7];
@ -118,7 +118,7 @@ static void G_CacheSpriteNum(int32_t i)
case LIZTROOPONTOILET__STATIC:
case LIZTROOPDUCKING__STATIC:
for (j = LIZTROOP; j < (LIZTROOP+72); j++) tloadtile(j,1);
for (j=HEADJIB1;j<LEGJIB1+3;j++) tloadtile(j,1);
for (j=HEADJIB1; j<LEGJIB1+3; j++) tloadtile(j,1);
maxc = 0;
break;
case WOODENHORSE__STATIC:
@ -154,7 +154,7 @@ static void G_CacheSpriteNum(int32_t i)
case LIZMANSPITTING__STATIC:
case LIZMANFEEDING__STATIC:
case LIZMANJUMP__STATIC:
for (j=LIZMANHEAD1;j<LIZMANLEG1+3;j++) tloadtile(j,1);
for (j=LIZMANHEAD1; j<LIZMANLEG1+3; j++) tloadtile(j,1);
maxc = 80;
break;
case APLAYER__STATIC:
@ -162,7 +162,7 @@ static void G_CacheSpriteNum(int32_t i)
if (ud.multimode > 1)
{
maxc = 5;
for (j = 1420;j < 1420+106; j++) tloadtile(j,1);
for (j = 1420; j < 1420+106; j++) tloadtile(j,1);
}
break;
case ATOMICHEALTH__STATIC:
@ -218,7 +218,7 @@ static void G_PrecacheSprites(void)
{
int32_t i,j;
for (i=0;i<MAXTILES;i++)
for (i=0; i<MAXTILES; i++)
{
if (SpriteFlags[i] & SPRITE_PROJECTILE)
tloadtile(i,1);
@ -232,11 +232,11 @@ static void G_PrecacheSprites(void)
tloadtile(VIEWSCREEN,1);
for (i=STARTALPHANUM;i<ENDALPHANUM+1;i++) tloadtile(i,1);
for (i=STARTALPHANUM; i<ENDALPHANUM+1; i++) tloadtile(i,1);
for (i=BIGALPHANUM; i<BIGALPHANUM+82; i++) tloadtile(i,1);
for (i=MINIFONT;i<MINIFONT+63;i++) tloadtile(i,1);
for (i=MINIFONT; i<MINIFONT+63; i++) tloadtile(i,1);
for (i=FOOTPRINTS;i<FOOTPRINTS+3;i++) tloadtile(i,1);
for (i=FOOTPRINTS; i<FOOTPRINTS+3; i++) tloadtile(i,1);
for (i = BURNING; i < BURNING+14; i++) tloadtile(i,1);
for (i = BURNING2; i < BURNING2+14; i++) tloadtile(i,1);
@ -278,7 +278,7 @@ static void G_PrecacheSprites(void)
}
// FIXME: this function is a piece of shit, needs specific sounds listed
static int32_t CacheSound(uint32_t num)
static int32_t G_CacheSound(uint32_t num)
{
int16_t fp = -1;
int32_t l;
@ -317,7 +317,7 @@ static void G_PrecacheSounds(void)
if (ud.config.FXDevice < 0) return;
j = 0;
for (i=MAXSOUNDS;i>=0;i--)
for (i=MAXSOUNDS; i>=0; i--)
if (g_sounds[i].ptr == 0)
{
j++;
@ -326,7 +326,7 @@ static void G_PrecacheSounds(void)
handleevents();
Net_GetPackets();
}
CacheSound(i);
G_CacheSound(i);
}
}
@ -452,7 +452,7 @@ void G_CacheMapData(void)
G_PrecacheSprites();
for (i=0;i<numwalls;i++)
for (i=0; i<numwalls; i++)
{
tloadtile(wall[i].picnum, 0);
@ -462,7 +462,7 @@ void G_CacheMapData(void)
}
}
for (i=0;i<numsectors;i++)
for (i=0; i<numsectors; i++)
{
tloadtile(sector[i].floorpicnum, 0);
tloadtile(sector[i].ceilingpicnum, 0);
@ -484,7 +484,7 @@ void G_CacheMapData(void)
tc = totalclock;
j = 0;
for (i=0;i<MAXTILES;i++)
for (i=0; i<MAXTILES; i++)
{
if (!(i&7) && !gotpic[i>>3])
{
@ -607,11 +607,11 @@ void P_RandomSpawnPoint(int32_t snum)
i = krand()%g_numPlayerSprites;
if (GametypeFlags[ud.coop] & GAMETYPE_TDMSPAWN)
{
for (j=0;j<ud.multimode;j++)
for (j=0; j<ud.multimode; j++)
{
if (j != snum && g_player[j].ps->team == p->team && sprite[g_player[j].ps->i].extra > 0)
{
for (k=0;k<g_numPlayerSprites;k++)
for (k=0; k<g_numPlayerSprites; k++)
{
dist = FindDistance2D(g_player[j].ps->posx-g_playerSpawnPoints[k].ox,g_player[j].ps->posy-g_playerSpawnPoints[k].oy);
if (dist < pdist)
@ -790,7 +790,7 @@ static void resetprestat(int32_t snum,int32_t g)
int32_t i;
g_spriteDeleteQueuePos = 0;
for (i=0;i<g_spriteDeleteQueueSize;i++) SpriteDeletionQueue[i] = -1;
for (i=0; i<g_spriteDeleteQueueSize; i++) SpriteDeletionQueue[i] = -1;
p->hbomb_on = 0;
p->cheat_phase = 0;
@ -845,11 +845,11 @@ static void resetprestat(int32_t snum,int32_t g)
}
static void setupbackdrop(int16_t sky)
static inline void G_SetupBackdrop(int16_t sky)
{
int16_t i;
for (i=0;i<MAXPSKYTILES;i++) pskyoff[i]=0;
for (i=0; i<MAXPSKYTILES; i++) pskyoff[i]=0;
if (parallaxyscale != 65536L)
parallaxyscale = 32768;
@ -887,7 +887,7 @@ static void setupbackdrop(int16_t sky)
pskybits=3;
}
static void prelevel(char g)
static inline void prelevel(char g)
{
int32_t i, nexti, j, startwall, endwall, lotaglist;
int32_t lotags[MAXSPRITES];
@ -901,7 +901,7 @@ static void prelevel(char g)
resetprestat(0,g);
g_numClouds = 0;
for (i=0;i<numsectors;i++)
for (i=0; i<numsectors; i++)
{
sector[i].extra = 256;
@ -919,10 +919,10 @@ static void prelevel(char g)
if (waloff[sector[i].ceilingpicnum] == 0)
{
if (sector[i].ceilingpicnum == LA)
for (j=0;j<5;j++)
for (j=0; j<5; j++)
tloadtile(sector[i].ceilingpicnum+j, 0);
}
setupbackdrop(sector[i].ceilingpicnum);
G_SetupBackdrop(sector[i].ceilingpicnum);
if (sector[i].ceilingpicnum == CLOUDYSKIES && g_numClouds < 127)
clouds[g_numClouds++] = i;
@ -994,7 +994,7 @@ static void prelevel(char g)
i = nexti;
}
for (i=0;i < MAXSPRITES;i++)
for (i=0; i < MAXSPRITES; i++)
{
if (sprite[i].statnum < MAXSTATUS)
{
@ -1004,7 +1004,7 @@ static void prelevel(char g)
}
}
for (i=0;i < MAXSPRITES;i++)
for (i=0; i < MAXSPRITES; i++)
if (sprite[i].statnum < MAXSTATUS)
{
if (PN == SECTOREFFECTOR && SLT == 14)
@ -1031,7 +1031,7 @@ static void prelevel(char g)
case POWERSWITCH1__STATIC:
case LOCKSWITCH1__STATIC:
case POWERSWITCH2__STATIC:
for (j=0;j<lotaglist;j++)
for (j=0; j<lotaglist; j++)
if (SLT == lotags[j])
break;
@ -1103,7 +1103,7 @@ static void prelevel(char g)
case W_FORCEFIELD__STATIC:
if (wal->overpicnum==W_FORCEFIELD__STATIC)
for (j=0;j<3;j++)
for (j=0; j<3; j++)
tloadtile(W_FORCEFIELD+j, 0);
if (wal->shade > 31)
wal->cstat = 0;
@ -1127,7 +1127,7 @@ static void prelevel(char g)
switch (DynamicTileMap[wal->picnum])
{
case WATERTILE2__STATIC:
for (j=0;j<3;j++)
for (j=0; j<3; j++)
tloadtile(wal->picnum+j, 0);
break;
@ -1146,7 +1146,7 @@ static void prelevel(char g)
case SCREENBREAK6__STATIC:
case SCREENBREAK7__STATIC:
case SCREENBREAK8__STATIC:
for (j=SCREENBREAK6;j<SCREENBREAK9;j++)
for (j=SCREENBREAK6; j<SCREENBREAK9; j++)
tloadtile(j, 0);
animwall[g_numAnimWalls].wallnum = i;
animwall[g_numAnimWalls].tag = -1;
@ -1197,11 +1197,11 @@ static void prelevel(char g)
}
//Invalidate textures in sector behind mirror
for (i=0;i<g_mirrorCount;i++)
for (i=0; i<g_mirrorCount; i++)
{
startwall = sector[g_mirrorSector[i]].wallptr;
endwall = startwall + sector[g_mirrorSector[i]].wallnum;
for (j=startwall;j<endwall;j++)
for (j=startwall; j<endwall; j++)
{
wall[j].picnum = MIRROR;
wall[j].overpicnum = MIRROR;
@ -1230,7 +1230,7 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk)
g_skillSoundID = -1;
waitforeverybody();
Net_WaitForEverybody();
ready2send = 0;
if (ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && (ud.coop&GAMETYPE_SCORESHEET))
@ -1278,7 +1278,7 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk)
Gv_ResetSystemDefaults();
for (i=0;i<(MAXVOLUMES*MAXLEVELS);i++)
for (i=0; i<(MAXVOLUMES*MAXLEVELS); i++)
if (MapInfo[i].savedstate)
{
Bfree(MapInfo[i].savedstate);
@ -1287,7 +1287,7 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk)
if (ud.m_coop != 1)
{
for (i=0;i<MAX_WEAPONS;i++)
for (i=0; i<MAX_WEAPONS; i++)
{
if (aplWeaponWorksLike[i][0]==PISTOL_WEAPON)
{
@ -1310,7 +1310,7 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk)
if (numplayers < 2)
{
connecthead = 0;
for (i=0;i<MAXPLAYERS;i++) connectpoint2[i] = i+1;
for (i=0; i<MAXPLAYERS; i++) connectpoint2[i] = i+1;
connectpoint2[ud.multimode-1] = -1;
}
}
@ -1322,22 +1322,6 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk)
X_OnEvent(EVENT_NEWGAME, g_player[screenpeek].ps->i, screenpeek, -1);
}
int32_t G_GetTeamPalette(int32_t team)
{
switch (team)
{
case 0:
return 3;
case 1:
return 10;
case 2:
return 11;
case 3:
return 12;
}
return 0;
}
static void resetpspritevars(char g)
{
int16_t i, j, nexti,circ;
@ -1349,14 +1333,14 @@ static void resetpspritevars(char g)
A_InsertSprite(g_player[0].ps->cursectnum,g_player[0].ps->posx,g_player[0].ps->posy,g_player[0].ps->posz,
APLAYER,0,0,0,g_player[0].ps->ang,0,0,0,10);
if (ud.recstat != 2) for (i=0;i<ud.multimode;i++)
if (ud.recstat != 2) for (i=0; i<ud.multimode; i++)
{
aimmode[i] = g_player[i].ps->aim_mode;
autoaim[i] = g_player[i].ps->auto_aim;
weaponswitch[i] = g_player[i].ps->weaponswitch;
if (ud.multimode > 1 && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{
for (j=0;j<MAX_WEAPONS;j++)
for (j=0; j<MAX_WEAPONS; j++)
{
tsbar[i].ammo_amount[j] = g_player[i].ps->ammo_amount[j];
tsbar[i].gotweapon[j] = g_player[i].ps->gotweapon[j];
@ -1378,18 +1362,18 @@ static void resetpspritevars(char g)
P_ResetStatus(0);
for (i=1;i<ud.multimode;i++)
for (i=1; i<ud.multimode; i++)
memcpy(g_player[i].ps,g_player[0].ps,sizeof(DukePlayer_t));
if (ud.recstat != 2)
for (i=0;i<ud.multimode;i++)
for (i=0; i<ud.multimode; i++)
{
g_player[i].ps->aim_mode = aimmode[i];
g_player[i].ps->auto_aim = autoaim[i];
g_player[i].ps->weaponswitch = weaponswitch[i];
if (ud.multimode > 1 && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{
for (j=0;j<MAX_WEAPONS;j++)
for (j=0; j<MAX_WEAPONS; j++)
{
g_player[i].ps->ammo_amount[j] = tsbar[i].ammo_amount[j];
g_player[i].ps->gotweapon[j] = tsbar[i].gotweapon[j];
@ -1461,7 +1445,7 @@ static void resetpspritevars(char g)
{
int32_t k = 0;
for (;k<ud.multimode;k++)
for (; k<ud.multimode; k++)
{
if (g_whichPalForPlayer == g_player[k].ps->palookup)
{
@ -1532,7 +1516,7 @@ void G_ResetTimers(void)
g_moveThingsCount = 0;
}
void waitforeverybody()
void Net_WaitForEverybody(void)
{
int32_t i;
@ -1619,7 +1603,7 @@ void clearfifo(void)
clearbufbyte(&loc,sizeof(input_t),0L);
clearbufbyte(&inputfifo,sizeof(input_t)*MOVEFIFOSIZ*MAXPLAYERS,0L);
for (;i<MAXPLAYERS;i++)
for (; i<MAXPLAYERS; i++)
{
// Bmemset(g_player[i].inputfifo,0,sizeof(g_player[i].inputfifo));
if (g_player[i].sync != NULL)
@ -1654,9 +1638,9 @@ extern int32_t voting, vote_map, vote_episode;
void G_FindLevelForFilename(const char *fn, char *volume, char *level)
{
for (*volume=0;*volume<MAXVOLUMES;(*volume)++)
for (*volume=0; *volume<MAXVOLUMES; (*volume)++)
{
for (*level=0;*level<MAXLEVELS;(*level)++)
for (*level=0; *level<MAXLEVELS; (*level)++)
{
if (MapInfo[(*volume*MAXLEVELS)+*level].filename != NULL)
if (!Bstrcasecmp(fn, MapInfo[(*volume*MAXLEVELS)+*level].filename))
@ -1944,11 +1928,11 @@ int32_t G_EnterLevel(int32_t g)
clearfifo();
for (i=g_numInterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
g_restorePalette = 1;
waitforeverybody();
Net_WaitForEverybody();
mmulti_flushpackets();
G_FadePalette(0,0,0,0);
@ -1957,7 +1941,7 @@ int32_t G_EnterLevel(int32_t g)
G_DrawBackground();
G_DrawRooms(myconnectindex,65536);
for (i=0;i<ud.multimode;i++)
for (i=0; i<ud.multimode; i++)
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
g_player[myconnectindex].ps->over_shoulder_on = 0;
@ -1980,7 +1964,7 @@ void G_FreeMapState(int32_t mapnum)
{
int32_t j;
for (j=0;j<g_gameVarCount;j++)
for (j=0; j<g_gameVarCount; j++)
{
if (aGameVars[j].dwFlags & GAMEVAR_NORESET) continue;
if (aGameVars[j].dwFlags & GAMEVAR_PERPLAYER)

View file

@ -37,7 +37,7 @@ void ReadSaveGameHeaders(void)
Bstrcpy(fn,"egam_.sav");
for (i=0;i<10;i++)
for (i=0; i<10; i++)
{
fn[4] = i+'0';
if ((fil = kopen4loadfrommod(fn,0)) == -1) continue;
@ -241,7 +241,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&sprite[0],sizeof(spritetype),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
#if defined(POLYMOST) && defined(USE_OPENGL)
for (i=0;i<MAXSPRITES;i++)
for (i=0; i<MAXSPRITES; i++)
if (spriteext[i].mdanimtims)
spriteext[i].mdanimtims+=mdtims;
#endif
@ -253,7 +253,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&nextspritestat[STAT_DEFAULT],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&g_numCyclers,sizeof(g_numCyclers),1,fil) != 1) goto corrupt;
if (kdfread(&cyclers[0][0],12,MAXCYCLERS,fil) != MAXCYCLERS) goto corrupt;
for (i=0;i<nump;i++)
for (i=0; i<nump; i++)
if (kdfread(g_player[i].ps,sizeof(DukePlayer_t),1,fil) != 1) goto corrupt;
if (kdfread(&g_playerSpawnPoints,sizeof(g_playerSpawnPoints),1,fil) != 1) goto corrupt;
if (kdfread(&g_numAnimWalls,sizeof(g_numAnimWalls),1,fil) != 1) goto corrupt;
@ -284,7 +284,7 @@ int32_t G_LoadPlayer(int32_t spot)
Bfree(script);
script = Bcalloc(1,g_scriptSize * sizeof(intptr_t));
if (kdfread(&script[0],sizeof(script),g_scriptSize,fil) != g_scriptSize) goto corrupt;
for (i=0;i<g_scriptSize;i++)
for (i=0; i<g_scriptSize; i++)
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
{
j = (intptr_t)script[i]+(intptr_t)&script[0];
@ -292,14 +292,14 @@ int32_t G_LoadPlayer(int32_t spot)
}
if (kdfread(&actorscrptr[0],4,MAXTILES,fil) != MAXTILES) goto corrupt;
for (i=0;i<MAXTILES;i++)
for (i=0; i<MAXTILES; i++)
if (actorscrptr[i])
{
j = (intptr_t)actorscrptr[i]+(intptr_t)&script[0];
actorscrptr[i] = (intptr_t *)j;
}
if (kdfread(&actorLoadEventScrptr[0],4,MAXTILES,fil) != MAXTILES) goto corrupt;
for (i=0;i<MAXTILES;i++)
for (i=0; i<MAXTILES; i++)
if (actorLoadEventScrptr[i])
{
j = (intptr_t)actorLoadEventScrptr[i]+(intptr_t)&script[0];
@ -311,7 +311,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&ActorExtra[0],sizeof(ActorData_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
for (i=0;i<MAXSPRITES;i++)
for (i=0; i<MAXSPRITES; i++)
{
j = (intptr_t)(&script[0]);
if (scriptptrs[i]&1) T2 += j;
@ -326,7 +326,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&g_animateCount,sizeof(g_animateCount),1,fil) != 1) goto corrupt;
if (kdfread(&animatesect[0],2,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
if (kdfread(&animateptr[0],sizeof(int32_t),MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
for (i = g_animateCount-1;i>=0;i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
if (kdfread(&animategoal[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
if (kdfread(&animatevel[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt;
@ -359,7 +359,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&connecthead,sizeof(connecthead),1,fil) != 1) goto corrupt;
if (kdfread(connectpoint2,sizeof(connectpoint2),1,fil) != 1) goto corrupt;
if (kdfread(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil) != 1) goto corrupt;
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
if (kdfread((int16_t *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil) != 1) goto corrupt;
if (kdfread(&randomseed,sizeof(randomseed),1,fil) != 1) goto corrupt;
@ -388,7 +388,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&g_numQuoteRedefinitions,sizeof(g_numQuoteRedefinitions),1,fil) != 1) goto corrupt;
for (i=0;i<g_numQuoteRedefinitions;i++)
for (i=0; i<g_numQuoteRedefinitions; i++)
{
if (ScriptQuoteRedefinitions[i] != NULL)
Bfree(ScriptQuoteRedefinitions[i]);
@ -499,13 +499,13 @@ int32_t G_LoadPlayer(int32_t spot)
if (ud.lockout == 0)
{
for (x=0;x<g_numAnimWalls;x++)
for (x=0; x<g_numAnimWalls; x++)
if (wall[animwall[x].wallnum].extra >= 0)
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
}
else
{
for (x=0;x<g_numAnimWalls;x++)
for (x=0; x<g_numAnimWalls; x++)
switch (DynamicTileMap[wall[animwall[x].wallnum].picnum])
{
case FEMPIC1__STATIC:
@ -556,8 +556,8 @@ int32_t G_LoadPlayer(int32_t spot)
k = nextspritestat[k];
}
for (i=g_numInterpolations-1;i>=0;i--) bakipos[i] = *curipos[i];
for (i = g_animateCount-1;i>=0;i--)
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
for (i = g_animateCount-1; i>=0; i--)
G_SetInterpolation(animateptr[i]);
g_showShareware = 0;
@ -565,7 +565,7 @@ int32_t G_LoadPlayer(int32_t spot)
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101);
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
clearbufbyte(&g_player[i].playerquitflag,1,0x01010101);
Net_ResetPrediction();
@ -664,7 +664,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&sector[0],sizeof(sectortype),MAXSECTORS,fil);
dfwrite(&sprite[0],sizeof(spritetype),MAXSPRITES,fil);
#if defined(POLYMOST) && defined(USE_OPENGL)
for (i=0;i<MAXSPRITES;i++)
for (i=0; i<MAXSPRITES; i++)
if (spriteext[i].mdanimtims)
{
spriteext[i].mdanimtims=spriteext[i].mdanimtims-mdtims;
@ -674,7 +674,7 @@ int32_t G_SavePlayer(int32_t spot)
#endif
dfwrite(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil);
#if defined(POLYMOST) && defined(USE_OPENGL)
for (i=0;i<MAXSPRITES;i++)if (spriteext[i].mdanimtims)spriteext[i].mdanimtims+=mdtims;
for (i=0; i<MAXSPRITES; i++)if (spriteext[i].mdanimtims)spriteext[i].mdanimtims+=mdtims;
#endif
dfwrite(&headspritesect[0],2,MAXSECTORS+1,fil);
dfwrite(&prevspritesect[0],2,MAXSPRITES,fil);
@ -684,7 +684,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&nextspritestat[STAT_DEFAULT],2,MAXSPRITES,fil);
dfwrite(&g_numCyclers,sizeof(g_numCyclers),1,fil);
dfwrite(&cyclers[0][0],12,MAXCYCLERS,fil);
for (i=0;i<ud.multimode;i++)
for (i=0; i<ud.multimode; i++)
dfwrite(g_player[i].ps,sizeof(DukePlayer_t),1,fil);
dfwrite(&g_playerSpawnPoints,sizeof(g_playerSpawnPoints),1,fil);
dfwrite(&g_numAnimWalls,sizeof(g_numAnimWalls),1,fil);
@ -707,7 +707,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&g_scriptSize,sizeof(g_scriptSize),1,fil);
scriptptrs = Bcalloc(1, g_scriptSize * sizeof(scriptptrs));
for (i=0;i<g_scriptSize;i++)
for (i=0; i<g_scriptSize; i++)
{
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
{
@ -722,35 +722,35 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&bitptr[0],sizeof(uint8_t),(g_scriptSize+7)>>3,fil);
dfwrite(&script[0],sizeof(script),g_scriptSize,fil);
for (i=0;i<g_scriptSize;i++)
for (i=0; i<g_scriptSize; i++)
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
{
j = script[i]+(intptr_t)&script[0];
script[i] = j;
}
for (i=0;i<MAXTILES;i++)
for (i=0; i<MAXTILES; i++)
if (actorscrptr[i])
{
j = (intptr_t)actorscrptr[i]-(intptr_t)&script[0];
actorscrptr[i] = (intptr_t *)j;
}
dfwrite(&actorscrptr[0],4,MAXTILES,fil);
for (i=0;i<MAXTILES;i++)
for (i=0; i<MAXTILES; i++)
if (actorscrptr[i])
{
j = (intptr_t)actorscrptr[i]+(intptr_t)&script[0];
actorscrptr[i] = (intptr_t *)j;
}
for (i=0;i<MAXTILES;i++)
for (i=0; i<MAXTILES; i++)
if (actorLoadEventScrptr[i])
{
j = (intptr_t)actorLoadEventScrptr[i]-(intptr_t)&script[0];
actorLoadEventScrptr[i] = (intptr_t *)j;
}
dfwrite(&actorLoadEventScrptr[0],4,MAXTILES,fil);
for (i=0;i<MAXTILES;i++)
for (i=0; i<MAXTILES; i++)
if (actorLoadEventScrptr[i])
{
j = (intptr_t)actorLoadEventScrptr[i]+(intptr_t)&script[0];
@ -760,7 +760,7 @@ int32_t G_SavePlayer(int32_t spot)
Bfree(scriptptrs);
scriptptrs = Bcalloc(1, MAXSPRITES * sizeof(scriptptrs));
for (i=0;i<MAXSPRITES;i++)
for (i=0; i<MAXSPRITES; i++)
{
scriptptrs[i] = 0;
@ -788,7 +788,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&scriptptrs[0],sizeof(scriptptrs),MAXSPRITES,fil);
dfwrite(&ActorExtra[0],sizeof(ActorData_t),MAXSPRITES,fil);
for (i=0;i<MAXSPRITES;i++)
for (i=0; i<MAXSPRITES; i++)
{
if (actorscrptr[PN] == 0) continue;
j = (intptr_t)&script[0];
@ -806,9 +806,9 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&pskyoff[0],sizeof(pskyoff[0]),MAXPSKYTILES,fil);
dfwrite(&g_animateCount,sizeof(g_animateCount),1,fil);
dfwrite(&animatesect[0],2,MAXANIMATES,fil);
for (i = g_animateCount-1;i>=0;i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]-(intptr_t)(&sector[0]));
for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]-(intptr_t)(&sector[0]));
dfwrite(&animateptr[0],4,MAXANIMATES,fil);
for (i = g_animateCount-1;i>=0;i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(&sector[0]));
dfwrite(&animategoal[0],4,MAXANIMATES,fil);
dfwrite(&animatevel[0],4,MAXANIMATES,fil);
@ -831,7 +831,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&connecthead,sizeof(connecthead),1,fil);
dfwrite(connectpoint2,sizeof(connectpoint2),1,fil);
dfwrite(&g_numPlayerSprites,sizeof(g_numPlayerSprites),1,fil);
for (i=0;i<MAXPLAYERS;i++)
for (i=0; i<MAXPLAYERS; i++)
dfwrite((int16_t *)&g_player[i].frags[0],sizeof(g_player[i].frags),1,fil);
dfwrite(&randomseed,sizeof(randomseed),1,fil);
@ -845,7 +845,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&SpriteCacheList[0],sizeof(SpriteCacheList[0]),MAXTILES,fil);
for (i=0;i<MAXQUOTES;i++)
for (i=0; i<MAXQUOTES; i++)
{
if (ScriptQuotes[i] != NULL)
{
@ -856,7 +856,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&i,sizeof(int32_t),1,fil);
dfwrite(&g_numQuoteRedefinitions,sizeof(g_numQuoteRedefinitions),1,fil);
for (i=0;i<g_numQuoteRedefinitions;i++)
for (i=0; i<g_numQuoteRedefinitions; i++)
{
if (ScriptQuoteRedefinitions[i] != NULL)
dfwrite(ScriptQuoteRedefinitions[i],MAXQUOTELEN, 1, fil);

View file

@ -191,7 +191,7 @@ int32_t isanearoperator(int32_t lotag)
inline int32_t G_CheckPlayerInSector(int32_t sect)
{
int32_t i = connecthead;
for (;i>=0;i=connectpoint2[i])
for (; i>=0; i=connectpoint2[i])
if (sprite[g_player[i].ps->i].sectnum == sect) return i;
return -1;
}
@ -255,7 +255,7 @@ void G_DoSectorAnimations(void)
{
int32_t i, j, a, p, v, dasect;
for (i=g_animateCount-1;i>=0;i--)
for (i=g_animateCount-1; i>=0; i--)
{
a = *animateptr[i];
v = animatevel[i]*TICSPERFRAME;
@ -269,7 +269,7 @@ void G_DoSectorAnimations(void)
// elevator sectors (ST 16-19) would jitter vertically after the
// elevator had stopped.
if (animateptr[i] == &sector[animatesect[i]].floorz)
for (j=headspritesect[dasect];j>=0;j=nextspritesect[j])
for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j])
if (sprite[j].statnum != 3)
ActorExtra[j].bposz = sprite[j].z;
@ -314,7 +314,7 @@ void G_DoSectorAnimations(void)
}
}
for (j=headspritesect[dasect];j>=0;j=nextspritesect[j])
for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j])
if (sprite[j].statnum != 3)
{
ActorExtra[j].bposz = sprite[j].z;
@ -331,7 +331,7 @@ int32_t GetAnimationGoal(int32_t *animptr)
{
int32_t i = g_animateCount-1, j = -1;
for (;i>=0;i--)
for (; i>=0; i--)
if (animptr == (int32_t *)animateptr[i])
{
j = i;
@ -347,7 +347,7 @@ int32_t SetAnimation(int32_t animsect,int32_t *animptr, int32_t thegoal, int32_t
if (g_animateCount >= MAXANIMATES-1)
return(-1);
for (;i<g_animateCount;i++)
for (; i<g_animateCount; i++)
if (animptr == animateptr[i])
{
j = i;
@ -396,7 +396,7 @@ void G_AnimateWalls(void)
{
int32_t i, j, p = g_numAnimWalls-1, t;
for (;p>=0;p--)
for (; p>=0; p--)
// for(p=g_numAnimWalls-1;p>=0;p--)
{
i = animwall[p].wallnum;
@ -580,7 +580,7 @@ void G_OperateSectors(int32_t sn,int32_t ii)
//first find center point by averaging all points
dax = 0L, day = 0L;
for (i=startwall;i<=endwall;i++)
for (i=startwall; i<=endwall; i++)
{
dax += wall[i].x;
day += wall[i].y;
@ -592,7 +592,7 @@ void G_OperateSectors(int32_t sn,int32_t ii)
// as center (dax, day) - should be 2 points found.
wallfind[0] = -1;
wallfind[1] = -1;
for (i=startwall;i<=endwall;i++)
for (i=startwall; i<=endwall; i++)
if ((wall[i].x == dax) || (wall[i].y == day))
{
if (wallfind[0] == -1)
@ -600,7 +600,7 @@ void G_OperateSectors(int32_t sn,int32_t ii)
else wallfind[1] = i;
}
for (j=0;j<2;j++)
for (j=0; j<2; j++)
{
if ((wall[wallfind[j]].x == dax) && (wall[wallfind[j]].y == day))
{
@ -991,7 +991,7 @@ void G_OperateActivators(int32_t low,int32_t snum)
int16_t *p;
walltype *wal;
for (i=g_numCyclers-1;i>=0;i--)
for (i=g_numCyclers-1; i>=0; i--)
{
p = &cyclers[i][0];
@ -1001,7 +1001,7 @@ void G_OperateActivators(int32_t low,int32_t snum)
sector[p[0]].floorshade = sector[p[0]].ceilingshade = p[3];
wal = &wall[sector[p[0]].wallptr];
for (j=sector[p[0]].wallnum;j > 0;j--,wal++)
for (j=sector[p[0]].wallnum; j > 0; j--,wal++)
wal->shade = p[3];
}
}
@ -1094,7 +1094,7 @@ void G_OperateForceFields(int32_t s, int32_t low)
{
int32_t i, p=g_numAnimWalls;
for (;p>=0;p--)
for (; p>=0; p--)
{
i = animwall[p].wallnum;
@ -1334,7 +1334,7 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype)
i = nextspritestat[i];
}
for (i=numwalls-1;i>=0;i--)
for (i=numwalls-1; i>=0; i--)
{
x = i;
if (lotag == wall[x].lotag)
@ -1846,7 +1846,7 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith
darkestwall = 0;
wal = &wall[sector[sn].wallptr];
for (i=sector[sn].wallnum;i > 0;i--,wal++)
for (i=sector[sn].wallnum; i > 0; i--,wal++)
if (wal->shade > darkestwall)
darkestwall=wal->shade;
@ -2024,7 +2024,7 @@ void A_DamageObject(int32_t i,int32_t sn)
case CACTUS__STATIC:
{
if (rpg == 1)
for (k=64;k>0;k--)
for (k=64; k>0; k--)
{
j = A_InsertSprite(SECT,SX,SY,SZ-(krand()%(48<<8)),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5);
sprite[j].pal = 8;
@ -2037,7 +2037,7 @@ void A_DamageObject(int32_t i,int32_t sn)
case FIRELASER__STATIC:
case HYDRENT__STATIC:
case HEAVYHBOMB__STATIC:
for (k=64;k>0;k--)
for (k=64; k>0; k--)
{
j = A_InsertSprite(SECT,SX,SY,SZ-(krand()%(48<<8)),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5);
sprite[j].pal = 8;
@ -2053,7 +2053,7 @@ void A_DamageObject(int32_t i,int32_t sn)
}
case HANGLIGHT__STATIC:
case GENERICPOLE2__STATIC:
for (k=6;k>0;k--)
for (k=6; k>0; k--)
A_InsertSprite(SECT,SX,SY,SZ-(8<<8),SCRAP1+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5);
A_PlaySound(GLASS_HEAVYBREAK,i);
deletesprite(i);
@ -2068,7 +2068,7 @@ void A_DamageObject(int32_t i,int32_t sn)
A_PlaySound(GLASS_HEAVYBREAK,i);
s = &sprite[i];
for (j=16;j>0;j--) RANDOMSCRAP;
for (j=16; j>0; j--) RANDOMSCRAP;
break;
case WATERFOUNTAIN__STATIC:
@ -2084,7 +2084,7 @@ void A_DamageObject(int32_t i,int32_t sn)
case ANTENNA__STATIC:
if (sprite[sn].extra != *actorscrptr[SHOTSPARK1])
{
for (j=15;j>0;j--)
for (j=15; j>0; j--)
A_InsertSprite(SECT,SX,SY,sector[SECT].floorz-(12<<8)-(j<<9),SCRAP1+(krand()&15),-8,64,64,
krand()&2047,(krand()&127)+64,-(krand()&511)-256,i,5);
A_Spawn(i,EXPLOSION2);
@ -2140,7 +2140,7 @@ void A_DamageObject(int32_t i,int32_t sn)
A_SpawnWallGlass(i,-1,10);
break;
case FETUSBROKE__STATIC:
for (j=48;j>0;j--)
for (j=48; j>0; j--)
{
A_Shoot(i,BLOODSPLAT1);
SA += 333;
@ -2309,7 +2309,7 @@ void A_DamageObject(int32_t i,int32_t sn)
case TRIPODCAMERA__STATIC:
A_PlaySound(GLASS_HEAVYBREAK,i);
s = &sprite[i];
for (j=16;j>0;j--) RANDOMSCRAP;
for (j=16; j>0; j--) RANDOMSCRAP;
deletesprite(i);
break;
case PLAYERONWATER__STATIC:

View file

@ -299,8 +299,8 @@ int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
}
else if (!(ud.config.VoiceToggle&1))
return -1;
for (j=0;j<MAXSOUNDS;j++)
for (k=0;k<g_sounds[j].num;k++)
for (j=0; j<MAXSOUNDS; j++)
for (k=0; k<g_sounds[j].num; k++)
if ((g_sounds[j].num > 0) && (g_sounds[j].m&4))
return -1;
}
@ -398,23 +398,21 @@ int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
if (*g_sounds[num].ptr == 'C')
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
else if (*g_sounds[num].ptr == 'O')
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
else
if (*g_sounds[num].ptr == 'O')
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
else
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num);
}
else
{
if (*g_sounds[num].ptr == 'C')
voice = FX_PlayVOC3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
else if (*g_sounds[num].ptr == 'O')
voice = FX_PlayOGG3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
else
if (*g_sounds[num].ptr == 'O')
voice = FX_PlayOGG3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
else
voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num);
}
if (voice > FX_Ok)
@ -475,29 +473,27 @@ void S_PlaySound(int32_t num)
voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
}
else if (*g_sounds[num].ptr == 'O')
{
start = (int32_t)*(uint16_t *)(g_sounds[num].ptr + 0x14);
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
}
else
if (*g_sounds[num].ptr == 'O')
{
start = (int32_t)*(uint16_t *)(g_sounds[num].ptr + 0x14);
voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
}
else
{
start = (int32_t)*(uint16_t *)(g_sounds[num].ptr + 0x14);
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
}
{
start = (int32_t)*(uint16_t *)(g_sounds[num].ptr + 0x14);
voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz,
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num);
}
}
else
{
if (*g_sounds[num].ptr == 'C')
voice = FX_PlayVOC3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
else if (*g_sounds[num].ptr == 'O')
voice = FX_PlayOGG3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
else
if (*g_sounds[num].ptr == 'O')
voice = FX_PlayOGG3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
else
voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
}
if (voice > FX_Ok) return;
@ -545,7 +541,7 @@ void S_StopEnvSound(int32_t num,int32_t i)
if (g_sounds[num].num > 0)
{
k = g_sounds[num].num;
for (j=0;j<k;j++)
for (j=0; j<k; j++)
if (g_sounds[num].SoundOwner[j].i == i)
{
FX_StopSound(g_sounds[num].SoundOwner[j].voice);
@ -578,7 +574,7 @@ void pan3dsound(void)
ca = sprite[ud.camerasprite].ang;
}
for (j=0;j<MAXSOUNDS;j++) for (k=0;k<g_sounds[j].num;k++)
for (j=0; j<MAXSOUNDS; j++) for (k=0; k<g_sounds[j].num; k++)
{
i = g_sounds[j].SoundOwner[k].i;
@ -650,7 +646,7 @@ void S_TestSoundCallback(uint32_t num)
if (tempk > 0)
{
if ((g_sounds[num].m&16) == 0)
for (tempj=0;tempj<tempk;tempj++)
for (tempj=0; tempj<tempk; tempj++)
{
tempi = g_sounds[num].SoundOwner[tempj].i;
if (sprite[tempi].picnum == MUSICANDSFX && sector[sprite[tempi].sectnum].lotag < 3 && sprite[tempi].lotag < 999)
@ -676,11 +672,11 @@ void S_ClearSoundLocks(void)
{
int32_t i;
for (i=0;i<MAXSOUNDS;i++)
for (i=0; i<MAXSOUNDS; i++)
if (g_sounds[i].lock >= 200)
g_sounds[i].lock = 199;
for (i=0;i<11;i++)
for (i=0; i<11; i++)
if (lumplockbyte[i] >= 200)
lumplockbyte[i] = 199;
}

View file

@ -250,7 +250,7 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
settings.gamedir = NULL;
else
{
for (j=1,dir=finddirs;dir != NULL;dir=dir->next,j++)
for (j=1,dir=finddirs; dir != NULL; dir=dir->next,j++)
if (j == i)
{
settings.gamedir = dir->name;

View file

@ -35,10 +35,10 @@ void initsynccrc(void)
{
int32_t i, j, k, a;
for (j=0;j<256;j++) //Calculate CRC table
for (j=0; j<256; j++) //Calculate CRC table
{
k = (j<<8); a = 0;
for (i=7;i>=0;i--)
for (i=7; i>=0; i--)
{
if (((k^a)&0x8000) > 0)
a = ((a<<1)&65535) ^ 0x1021; //0x1021 = genpoly
@ -165,14 +165,14 @@ char Net_MapSync(void)
updatecrc(crc, (spr->hitag) & 255);
}
for (j=numwalls;j>=0;j--)
for (j=numwalls; j>=0; j--)
{
wal = &wall[j];
updatecrc(crc, (wal->x) & 255);
updatecrc(crc, (wal->y) & 255);
}
for (j=numsectors;j>=0;j--)
for (j=numsectors; j>=0; j--)
{
sect = &sector[j];
updatecrc(crc, (sect->floorz) & 255);

View file

@ -125,7 +125,7 @@ int32_t G_GetVersionFromWebsite(char *buffer)
strtok(otherbuf," ");
if (atol(strtok(NULL," ")) == 200)
{
for (i=0;(unsigned)i<strlen(tempbuf);i++) // HACK: all of this needs to die a fiery death; we just skip to the content
for (i=0; (unsigned)i<strlen(tempbuf); i++) // HACK: all of this needs to die a fiery death; we just skip to the content
{
// instead of actually parsing any of the http headers
if (i > 4)