diff --git a/polymer/eduke32/build/src/a-c.c b/polymer/eduke32/build/src/a-c.c index 34edb321e..517d4a80e 100644 --- a/polymer/eduke32/build/src/a-c.c +++ b/polymer/eduke32/build/src/a-c.c @@ -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))<>(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))<>(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))<>(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))<>(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>16)+vptr))]; + for (x=0; x>16)+vptr))]; p += bpl; v += vi; dy--; } } diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 37a71185f..6a165809b 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -384,15 +384,15 @@ int32_t app_main(int32_t argc, const char **argv) setbrightness(brightness,palette,0); 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; whitecol = i; } } - for (i=0;i localartfreq[j]) j = k; if (localartfreq[j] > 0) @@ -993,7 +993,7 @@ void editinput(void) if ((tilesizx[temppicnum] <= 0) || (tilesizy[temppicnum] <= 0)) { j = 0; - for (k=0;k 0) && (tilesizy[k] > 0)) { j = k; @@ -1013,19 +1013,19 @@ void editinput(void) j = ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1); if ((sprite[i].cstat&128) == 0) sprite[i].z = min(max(hitinfo.pos.z, - getceilzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)+(j<<1)), - getflorzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)); + getceilzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)+(j<<1)), + getflorzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)); else sprite[i].z = min(max(hitinfo.pos.z, - getceilzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)+j), - getflorzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)-j); + getceilzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)+j), + getflorzofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y)-j); if ((searchstat == 0) || (searchstat == 4)) { sprite[i].cstat = (sprite[i].cstat&~48)|(16+64); if (hitinfo.hitwall >= 0) sprite[i].ang = ((getangle(wall[wall[hitinfo.hitwall].point2].x-wall[hitinfo.hitwall].x, - wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y)+512)&2047); + wall[wall[hitinfo.hitwall].point2].y-wall[hitinfo.hitwall].y)+512)&2047); //Make sure sprite's in right sector if (inside(sprite[i].x,sprite[i].y,sprite[i].sectnum) == 0) @@ -1500,15 +1500,15 @@ void overheadeditor(void) //White out all bordering lines of grab that are //not highlighted on both sides - for (i=highlightsectorcnt-1;i>=0;i--) + for (i=highlightsectorcnt-1; i>=0; i--) { startwall = sector[highlightsector[i]].wallptr; endwall = startwall + sector[highlightsector[i]].wallnum; - for (j=startwall;j= 0) { - for (k=highlightsectorcnt-1;k>=0;k--) + for (k=highlightsectorcnt-1; k>=0; k--) if (highlightsector[k] == wall[j].nextsector) break; if (k < 0) @@ -1522,9 +1522,9 @@ void overheadeditor(void) } } - for (i=0;i<(MAXWALLS>>3);i++) //Clear all highlights + for (i=0; i<(MAXWALLS>>3); i++) //Clear all highlights show2dwall[i] = 0; - for (i=0;i<(MAXSPRITES>>3);i++) + for (i=0; i<(MAXSPRITES>>3); i++) show2dsprite[i] = 0; sectorhighlightstat = -1; @@ -1669,7 +1669,7 @@ void overheadeditor(void) if (showtags == 1) { if (zoom >= 768) - for (i=0;i= 0) { - for (i=newnumwalls;i>=tempint;i--) + for (i=newnumwalls; i>=tempint; i--) wall[i].cstat |= (1<<14); } i = numwalls-1; if (newnumwalls >= 0) i = newnumwalls-1; - for (wal=&wall[i];i>=0;i--,wal--) + for (wal=&wall[i]; i>=0; i--,wal--) { if (zoom < 768 && !(wal->cstat & (1<<14))) continue; //Get average point of wall @@ -1807,7 +1807,7 @@ void overheadeditor(void) numwalls = tempint; if (highlightsectorcnt > 0) - for (i=0;i>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1)); } - for (i=0;i>1; - for (w=1;w<=numtoswap;w++) + for (w=1; w<=numtoswap; w++) { Bmemcpy(&tempwall,&wall[startofloop+w],sizeof(walltype)); Bmemcpy(&wall[startofloop+w],&wall[endofloop-w+1],sizeof(walltype)); @@ -1942,7 +1942,7 @@ void overheadeditor(void) } //make point2 point to next wall in loop - for (w=startofloop;w>grid))&(0xffffffff-(GRIDMAX>>(grid-1))+1)); } - for (i=0;i>1; - for (w=1;w<=numtoswap;w++) + for (w=1; w<=numtoswap; w++) { Bmemcpy(&tempwall,&wall[startofloop+w],sizeof(walltype)); Bmemcpy(&wall[startofloop+w],&wall[endofloop-w+1],sizeof(walltype)); @@ -2061,7 +2061,7 @@ void overheadeditor(void) } //make point2 point to next wall in loop - for (w=startofloop;w>3);i++) //Clear all highlights + for (i=0; i<(MAXWALLS>>3); i++) //Clear all highlights show2dwall[i] = 0; - for (i=0;i<(MAXSPRITES>>3);i++) + for (i=0; i<(MAXSPRITES>>3); i++) show2dsprite[i] = 0; } } @@ -2640,7 +2640,7 @@ void overheadeditor(void) highlight[highlightcnt++] = i; show2dwall[i>>3] |= (1<<(i&7)); - for (j=0;j= highlightx1) && (wall[i].x <= highlightx2)) if ((wall[i].y >= highlighty1) && (wall[i].y <= highlighty2)) { highlight[highlightcnt++] = i; show2dwall[i>>3] |= (1<<(i&7)); } - for (i=0;i= highlightx1) && (sprite[i].x <= highlightx2)) if ((sprite[i].y >= highlighty1) && (sprite[i].y <= highlighty2)) @@ -2695,11 +2695,11 @@ void overheadeditor(void) } if (highlightsectorcnt != 0) { - for (i=0;i= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -2728,12 +2728,12 @@ void overheadeditor(void) tempint = highlighty1; highlighty1 = highlighty2; highlighty2 = tempint; } - for (i=0;i highlightx2) bad = 1; @@ -2749,15 +2749,15 @@ void overheadeditor(void) //White out all bordering lines of grab that are //not highlighted on both sides - for (i=highlightsectorcnt-1;i>=0;i--) + for (i=highlightsectorcnt-1; i>=0; i--) { startwall = sector[highlightsector[i]].wallptr; endwall = startwall + sector[highlightsector[i]].wallnum; - for (j=startwall;j= 0) { - for (k=highlightsectorcnt-1;k>=0;k--) + for (k=highlightsectorcnt-1; k>=0; k--) if (highlightsector[k] == wall[j].nextsector) break; if (k < 0) @@ -2788,7 +2788,7 @@ void overheadeditor(void) j = 1; if (highlightcnt > 0) - for (i=0;i=0;i--) //delete points + for (i=numwalls-1; i>=0; i--) //delete points { if (wall[i].x == wall[wall[i].point2].x) if (wall[i].y == wall[wall[i].point2].y) @@ -2849,7 +2849,7 @@ void overheadeditor(void) } } - for (i=numwalls-1;i>=0;i--) //delete points + for (i=numwalls-1; i>=0; i--) //delete points { if (wall[i].x == wall[wall[i].point2].x) if (wall[i].y == wall[wall[i].point2].y) @@ -2865,7 +2865,7 @@ void overheadeditor(void) } } - for (i=0;i= 0) && (cursectorhighlight < numsectors)) { - for (i=0;i=0;j=nextspritesect[j]) + for (j=headspritesect[highlightsector[i]]; j>=0; j=nextspritesect[j]) { sprite[j].x += dax; sprite[j].y += day; } } @@ -2980,7 +2980,7 @@ SKIP: j = 1; if (highlightcnt > 0) - for (i=0;i= getceilzofslope(i,dax,day)) if (sprite[pointhighlight&16383].z-daz <= getflorzofslope(i,dax,day)) @@ -3093,7 +3093,7 @@ SKIP: if (zoom < 8) zoom = 8; printmessage16("Zoom: %d",zoom); } - + if (keystatus[0x22]) // G (grid on/off) { grid++; @@ -3115,13 +3115,13 @@ SKIP: { joinsector[1] = -1; - for (i=0;i= 0) { @@ -3238,11 +3238,11 @@ SKIP: numwalls = newnumwalls; newnumwalls = -1; - for (k=0;k<2;k++) + for (k=0; k<2; k++) { startwall = sector[joinsector[k]].wallptr; endwall = startwall + sector[joinsector[k]].wallnum - 1; - for (j=startwall;j<=endwall;j++) + for (j=startwall; j<=endwall; j++) { wall[j].nextwall = -1; wall[j].nextsector = -1; @@ -3265,7 +3265,7 @@ SKIP: else { joinsector[0] = -1; - for (i=0;i localartfreq[j]) j = k; if (localartfreq[j] > 0) @@ -3373,7 +3373,7 @@ SKIP: if ((tilesizx[temppicnum] <= 0) || (tilesizy[temppicnum] <= 0)) { j = 0; - for (k=0;k 0) && (tilesizy[k] > 0)) { j = k; @@ -3407,18 +3407,18 @@ SKIP: { newnumsectors = numsectors; newnumwalls = numwalls; - for (i=0;i= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -3438,7 +3438,7 @@ SKIP: } else if (highlightcnt >= 0) { - for (i=0;i0;i--) + for (i=circlepoints; i>0; i--) { j = ((circleang1 + scale(i,k,circlepoints+1))&2047); dax = centerx+mulscale14(sintable[(j+512)&2047],circlerad); @@ -3569,7 +3569,7 @@ SKIP: wall[newnumwalls].y = mousyplc; wall[newnumwalls].nextsector = -1; wall[newnumwalls].nextwall = -1; - for (i=0;i>1); day = ((wall[numwalls].y+mousyplc)>>1); - for (i=0;i= 0) { @@ -3645,7 +3645,7 @@ SKIP: wall[newnumwalls].y = mousyplc; wall[newnumwalls].nextsector = -1; wall[newnumwalls].nextwall = -1; - for (i=0;i= suckwall) wall[i].nextwall += j; @@ -3717,12 +3717,12 @@ SKIP: wall[i].point2 += j; } - for (i=newnumwalls-1;i>=suckwall;i--) + for (i=newnumwalls-1; i>=suckwall; i--) Bmemcpy(&wall[i+j],&wall[i],sizeof(walltype)); - for (i=0;inumwalls;j--) + for (j=newnumwalls; j>numwalls; j--) { Bmemcpy(&wall[danumwalls],&wall[j],sizeof(walltype)); wall[danumwalls].nextwall = -1; @@ -3875,7 +3875,7 @@ SKIP: //Add other loops for 2nd sector loopnum = loopnumofsector(splitsect,splitstartwall); i = loopnum; - for (j=startwall;j<=endwall;j++) + for (j=startwall; j<=endwall; j++) { k = loopnumofsector(splitsect,(int16_t)j); if ((k != i) && (k != loopnum)) @@ -3899,7 +3899,7 @@ SKIP: } //fix all next pointers on old sector line - for (j=numwalls;j= 0) { @@ -3911,7 +3911,7 @@ SKIP: } } //set all next pointers on split - for (j=numwalls;j= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -3964,7 +3964,7 @@ SKIP: //k now safe to use as temp - for (m=numsectors-2;mnumwalls;j--) + for (j=newnumwalls; j>numwalls; j--) { Bmemcpy(&wall[danumwalls],&wall[j],sizeof(walltype)); wall[danumwalls].nextwall = -1; @@ -4034,7 +4034,7 @@ SKIP: //Add other loops to sector loopnum = loopnumofsector(splitsect,splitstartwall); i = loopnum; - for (j=startwall;j<=endwall;j++) + for (j=startwall; j<=endwall; j++) { k = loopnumofsector(splitsect,(int16_t)j); if ((k != i) && (k != loopnumofsector(splitsect,splitstartwall)) && (k != loopnumofsector(splitsect,splitendwall))) @@ -4054,7 +4054,7 @@ SKIP: } //fix all next pointers on old sector line - for (j=numwalls;j= 0) { @@ -4084,7 +4084,7 @@ SKIP: //clear out old sector's next pointers for clean deletesector numwalls = danumwalls; - for (j=startwall;j<=endwall;j++) + for (j=startwall; j<=endwall; j++) { wall[j].nextwall = -1; wall[j].nextsector = -1; @@ -4092,7 +4092,7 @@ SKIP: deletesector(splitsect); //Check pointers - for (j=numwalls-k;j= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -4114,27 +4114,27 @@ SKIP: if (keystatus[0x2a]&keystatus[0x1d]) { printmessage16("CHECKING ALL POINTERS!"); - for (i=0;i=0;i--) + for (i=numsectors-2; i>=0; i--) sector[i].wallnum = sector[i+1].wallptr-sector[i].wallptr; sector[numsectors-1].wallnum = numwalls-sector[numsectors-1].wallptr; - for (i=0;i= 0) - for (j=0;j=0;j--) + for (j=highlightsectorcnt-1; j>=0; j--) { deletesector(highlightsector[j]); - for (k=j-1;k>=0;k--) + for (k=j-1; k>=0; k--) if (highlightsector[k] >= highlightsector[j]) highlightsector[k]--; } @@ -4243,18 +4243,18 @@ SKIP: { newnumsectors = numsectors; newnumwalls = numwalls; - for (i=0;i= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -4274,7 +4274,7 @@ SKIP: } else if (highlightcnt >= 0) { - for (i=0;i=0;i--) //delete points + for (i=numwalls-1; i>=0; i--) //delete points if (wall[i].x == wall[wall[i].point2].x) if (wall[i].y == wall[wall[i].point2].y) { deletepoint((int16_t)i); j++; } - for (i=0;i= 0) {keystatus[1]=0;joinsector[0]=-1;} + if (keystatus[1] && joinsector[0] >= 0) {keystatus[1]=0; joinsector[0]=-1;} if (keystatus[1]) { keystatus[1] = 0; @@ -4491,14 +4491,14 @@ CANCEL: highlightsectorcnt = -1; highlightcnt = -1; - for (i=0;i<(MAXWALLS>>3);i++) //Clear all highlights + for (i=0; i<(MAXWALLS>>3); i++) //Clear all highlights show2dwall[i] = 0; - for (i=0;i<(MAXSPRITES>>3);i++) + for (i=0; i<(MAXSPRITES>>3); i++) show2dsprite[i] = 0; - for (i=0;i= 0) { j = 0; k = 0; - for (i=0;i=0;i--) + for (i=MAXSPRITES-1; i>=0; i--) if (sprite[i].statnum < MAXSTATUS) { k = sprite[i].sectnum; - for (j=0;j= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -4744,7 +4744,7 @@ CANCEL: } if (bad == 2) { - char *f;int32_t res; + char *f; int32_t res; keystatus[0x1c] = 0; boardfilename[i] = '.'; @@ -4888,11 +4888,11 @@ CANCEL: //nextpage(); } - for (i=0;i= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -4947,7 +4947,7 @@ int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line) dist = 1024; closest = -1; - for (i=0;i= 256) - for (i=0;i>1);i++) + for (i=numwalls; i>1); i++) { j = numwalls+newnumwalls-i-1; tempint = wall[i].x; wall[i].x = wall[j].x; wall[j].x = tempint; @@ -5121,7 +5121,7 @@ void insertpoint(int16_t linehighlight, int32_t dax, int32_t day) sucksect = sectorofwall((int16_t)j); sector[sucksect].wallnum++; - for (i=sucksect+1;i= startwall) wall[i].nextsector--; return(0); @@ -5234,11 +5234,11 @@ void fixspritesectors(void) { int32_t i, j, dax, day, daz; - for (i=numsectors-1;i>=0;i--) + for (i=numsectors-1; i>=0; i--) if ((sector[i].wallnum <= 0) || (sector[i].wallptr >= numwalls)) deletesector((int16_t)i); - for (i=0;i= getceilzofslope(j,dax,day)) if (sprite[i].z-daz <= getflorzofslope(j,dax,day)) @@ -5265,16 +5265,16 @@ int32_t movewalls(int32_t start, int32_t offs) if (offs < 0) //Delete { - for (i=start;i 0) //Insert { - for (i=numwalls+offs-1;i>=start+offs;i--) + for (i=numwalls+offs-1; i>=start+offs; i--) Bmemcpy(&wall[i],&wall[i-offs],sizeof(walltype)); } numwalls += offs; - for (i=0;i= start) wall[i].nextwall += offs; if (wall[i].point2 >= start) wall[i].point2 += offs; @@ -5301,11 +5301,11 @@ int32_t checksectorpointer(int16_t i, int16_t sectnum) wall[i].nextsector = -1; wall[i].nextwall = -1; - for (j=0;j>14)+midydim16; y2 = (((wall[wall[z].point2].y-pos.y)*zoom)>>14)+midydim16; @@ -5899,12 +5899,12 @@ int32_t fillsector(int16_t sectnum, char fillcolor) if (miny < uborder) miny = uborder; if (maxy >= dborder) maxy = dborder-1; - for (sy=miny+((totalclock>>2)&3);sy<=maxy;sy+=3) // JBF 20040116: numframes%3 -> (totalclock>>2)&3 + for (sy=miny+((totalclock>>2)&3); sy<=maxy; sy+=3) // JBF 20040116: numframes%3 -> (totalclock>>2)&3 { y = pos.y+(((sy-midydim16)<<14)/zoom); fillist[0] = lborder; fillcnt = 1; - for (z=startwall;z<=endwall;z++) + for (z=startwall; z<=endwall; z++) { x1 = wall[z].x; x2 = wall[wall[z].point2].x; y1 = wall[z].y; y2 = wall[wall[z].point2].y; @@ -5924,14 +5924,14 @@ int32_t fillsector(int16_t sectnum, char fillcolor) } if (fillcnt > 0) { - for (z=1;z rborder) break; if (fillist[z+1] > rborder) @@ -5961,7 +5961,7 @@ int16_t whitelinescan(int16_t dalinehighlight) if (wall[j].nextwall >= 0) { j = wall[j].point2; - for (k=0;k MAXSECTORSV7 || numwalls > MAXWALLSV7 || numsprites > MAXSPRITESV7); Bsprintf(snotbuf,"%d/%d sect. %d/%d walls %d/%d spri.", - numsectors,m?MAXSECTORSV8:MAXSECTORSV7, - numwalls,m?MAXWALLSV8:MAXWALLSV7, - numsprites,m?MAXSPRITESV8:MAXSPRITESV7); + numsectors,m?MAXSECTORSV8:MAXSECTORSV7, + numwalls,m?MAXWALLSV8:MAXWALLSV7, + numsprites,m?MAXSPRITESV8:MAXSPRITESV7); i = 0; while ((snotbuf[i] != 0) && (i < 46)) @@ -6211,7 +6211,7 @@ void updatenumsprites(void) int32_t i; numsprites = 0; - for (i=0;i=0;i--) + for (i=7; i>=0; i--) { if (((k^a)&0x8000) > 0) a = ((a<<1)&65535) ^ 0x1021; //0x1021 = genpoly @@ -6606,7 +6606,7 @@ void AlignWalls(int32_t nWall0, int32_t z0, int32_t nWall1, int32_t z1, int32_t z1 = GetWallZPeg(nWall1); - for (n=(picsiz[nTile]>>4);((1<>4); ((1<>(n+3))); diff --git a/polymer/eduke32/build/src/cache1d.c b/polymer/eduke32/build/src/cache1d.c index 64aeaefc8..f8a370878 100644 --- a/polymer/eduke32/build/src/cache1d.c +++ b/polymer/eduke32/build/src/cache1d.c @@ -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= 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) 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=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= 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=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=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= 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= 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 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 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>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++; diff --git a/polymer/eduke32/build/src/compat.c b/polymer/eduke32/build/src/compat.c index 2e34122f2..0997f94ec 100644 --- a/polymer/eduke32/build/src/compat.c +++ b/polymer/eduke32/build/src/compat.c @@ -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); diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index 931e1e9fa..e503de867 100644 --- a/polymer/eduke32/build/src/config.c +++ b/polymer/eduke32/build/src/config.c @@ -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]); diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index 1c6d96e96..5d9ba2110 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -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= 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<=0;z=nextspritesect[z]) + for (z=headspritesect[sectnum]; z>=0; z=nextspritesect[z]) { spr = &sprite[z]; if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) && @@ -696,7 +696,7 @@ static void scansector(int16_t sectnum) startwall = sector[sectnum].wallptr; endwall = startwall + sector[sectnum].wallnum; scanfirst = numscans; - for (z=startwall,wal=&wall[z];znextsector; @@ -778,13 +778,13 @@ skipitaddwall: p2[numscans-1] = scanfirst, scanfirst = numscans; } - for (z=numscansbefore;z= xb1[p2[z]])) bunchfirst[numbunches++] = p2[z], p2[z] = -1; - for (z=bunchfrst;z=0;zz=p2[zz]); + for (zz=bunchfirst[z]; p2[zz]>=0; zz=p2[zz]); bunchlast[z] = zz; } } @@ -802,7 +802,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, i int32_t y1ve[4], y2ve[4], /* p,*/ tsizx, tsizy; #ifndef ENGINE_USING_A_C char bad; - int32_t i, u4, d4, dax, z; + int32_t i, u4, d4, dax, z; #endif tsizx = tilesizx[globalpicnum]; @@ -835,7 +835,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, i p = x+frameoffset; - for (;(x<=x2)&&(p&3);x++,p++) + for (; (x<=x2)&&(p&3); x++,p++) { y1ve[0] = max(uwal[x],startumost[x+windowx1]-windowy1); y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1); @@ -852,10 +852,10 @@ static void maskwallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, i mvlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],p+ylookup[y1ve[0]]); } - for (;x<=x2-3;x+=4,p+=4) + for (; x<=x2-3; x+=4,p+=4) { bad = 0; - for (z=3,dax=x+3;z>=0;z--,dax--) + for (z=3,dax=x+3; z>=0; z--,dax--) { y1ve[z] = max(uwal[dax],startumost[dax+windowx1]-windowy1); y2ve[z] = min(dwal[dax],startdmost[dax+windowx1]-windowy1)-1; @@ -910,7 +910,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, i if (y2ve[2] > d4) mvlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); if (y2ve[3] > d4) mvlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],i+3); } - for (;x<=x2;x++,p++) + for (; x<=x2; x++,p++) { y1ve[0] = max(uwal[x],startumost[x+windowx1]-windowy1); y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1); @@ -931,7 +931,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, i #else // ENGINE_USING_A_C p = startx+frameoffset; - for (x=startx;x<=x2;x++,p++) + for (x=startx; x<=x2; x++,p++) { y1ve[0] = max(uwal[x],startumost[x+windowx1]-windowy1); y2ve[0] = min(dwal[x],startdmost[x+windowx1]-windowy1); @@ -1072,10 +1072,10 @@ static inline int32_t bunchfront(int32_t b1, int32_t b2) if (x1b1 >= x1b2) { - for (i=b2f;xb2[i]cstat&8) { walxrepeat--; - for (x=xb1[z];x<=xb2[z];x++) lwall[x] = walxrepeat-lwall[x]; + for (x=xb1[z]; x<=xb2[z]; x++) lwall[x] = walxrepeat-lwall[x]; } } @@ -1571,7 +1571,7 @@ static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum) if (!(globalorientation&0x180)) { y1 = umost[x1]; y2 = y1; - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) { twall = umost[x]-1; bwall = min(uplc[x],dmost[x]); if (twall < bwall-1) @@ -1618,7 +1618,7 @@ static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum) } y1 = umost[x1]; y2 = y1; - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) { twall = umost[x]-1; bwall = min(uplc[x],dmost[x]); if (twall < bwall-1) @@ -1742,7 +1742,7 @@ static void florscan(int32_t x1, int32_t x2, int32_t sectnum) if (!(globalorientation&0x180)) { y1 = max(dplc[x1],umost[x1]); y2 = y1; - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) { twall = max(dplc[x],umost[x])-1; bwall = dmost[x]; if (twall < bwall-1) @@ -1789,7 +1789,7 @@ static void florscan(int32_t x1, int32_t x2, int32_t sectnum) } y1 = max(dplc[x1],umost[x1]); y2 = y1; - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) { twall = max(dplc[x],umost[x])-1; bwall = dmost[x]; if (twall < bwall-1) @@ -1829,7 +1829,7 @@ static void wallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, int32 int32_t y1ve[4], y2ve[4], tsizx, tsizy; #ifndef ENGINE_USING_A_C char bad; - int32_t i, u4, d4, z; + int32_t i, u4, d4, z; #endif if (x2 >= xdim) x2 = xdim-1; @@ -1857,7 +1857,7 @@ static void wallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, int32 x = x1; while ((umost[x] > dmost[x]) && (x <= x2)) x++; - for (;(x<=x2)&&((x+frameoffset)&3);x++) + for (; (x<=x2)&&((x+frameoffset)&3); x++) { y1ve[0] = max(uwal[x],umost[x]); y2ve[0] = min(dwal[x],dmost[x]); @@ -1874,10 +1874,10 @@ static void wallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, int32 vlineasm1(vince[0],palookupoffse[0],y2ve[0]-y1ve[0]-1,vplce[0],bufplce[0]+waloff[globalpicnum],x+frameoffset+ylookup[y1ve[0]]); } - for (;x<=x2-3;x+=4) + for (; x<=x2-3; x+=4) { bad = 0; - for (z=3;z>=0;z--) + for (z=3; z>=0; z--) { y1ve[z] = max(uwal[x+z],umost[x+z]); y2ve[z] = min(dwal[x+z],dmost[x+z])-1; @@ -1932,7 +1932,7 @@ static void wallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, int32 if (y2ve[2] > d4) prevlineasm1(vince[2],palookupoffse[2],y2ve[2]-d4-1,vplce[2],bufplce[2],i+2); if (y2ve[3] > d4) prevlineasm1(vince[3],palookupoffse[3],y2ve[3]-d4-1,vplce[3],bufplce[3],i+3); } - for (;x<=x2;x++) + for (; x<=x2; x++) { y1ve[0] = max(uwal[x],umost[x]); y2ve[0] = min(dwal[x],dmost[x]); @@ -1952,7 +1952,7 @@ static void wallscan(int32_t x1, int32_t x2, int16_t *uwal, int16_t *dwal, int32 #else // ENGINE_USING_A_C - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) { y1ve[0] = max(uwal[x],umost[x]); y2ve[0] = min(dwal[x],dmost[x]); @@ -2144,7 +2144,7 @@ static inline void ceilspritescan(int32_t x1, int32_t x2) int32_t x, y1, y2, twall, bwall; y1 = uwall[x1]; y2 = y1; - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) { twall = uwall[x]-1; bwall = dwall[x]; if (twall < bwall-1) @@ -2303,7 +2303,7 @@ static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat) m2 = m1+l; mptr1 = (int32_t *)&slopalookup[y1+(shoffs>>15)]; mptr2 = mptr1+1; - for (x=dax1;x<=dax2;x++) + for (x=dax1; x<=dax2; x++) { if (dastat == 0) { y1 = umost[x]; y2 = min(dmost[x],uplc[x])-1; } else { y1 = max(umost[x],dplc[x]); y2 = dmost[x]-1; } @@ -2391,7 +2391,7 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i k = 11 - (picsiz[globalpicnum]&15) - pskybits; x = -1; - for (z=bunchfirst[bunch];z>=0;z=p2[z]) + for (z=bunchfirst[bunch]; z>=0; z=p2[z]) { wallnum = thewall[z]; nextsectnum = wall[wallnum].nextsector; @@ -2408,18 +2408,18 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i if (parallaxtype == 0) { n = mulscale16(xdimenrecip,viewingrange); - for (j=xb1[z];j<=xb2[z];j++) + for (j=xb1[z]; j<=xb2[z]; j++) lplc[j] = (((mulscale23(j-halfxdimen,n)+globalang)&2047)>>k); } else { - for (j=xb1[z];j<=xb2[z];j++) + for (j=xb1[z]; j<=xb2[z]; j++) lplc[j] = ((((int32_t)radarang2[j]+globalang)&2047)>>k); } if (parallaxtype == 2) { n = mulscale16(xdimscale,viewingrange); - for (j=xb1[z];j<=xb2[z];j++) + for (j=xb1[z]; j<=xb2[z]; j++) swplc[j] = mulscale14(sintable[((int32_t)radarang2[j]+512)&2047],n); } else @@ -2501,7 +2501,7 @@ static void drawalls(int32_t bunch) sectnum = thesector[z]; sec = §or[sectnum]; andwstat1 = 0xff; andwstat2 = 0xff; - for (;z>=0;z=p2[z]) //uplc/dplc calculation + for (; z>=0; z=p2[z]) //uplc/dplc calculation { andwstat1 &= wallmost(uplc,z,sectnum,(uint8_t)0); andwstat2 &= wallmost(dplc,z,sectnum,(uint8_t)1); @@ -2527,12 +2527,12 @@ static void drawalls(int32_t bunch) } //DRAW WALLS SECTION! - for (z=bunchfirst[bunch];z>=0;z=p2[z]) + for (z=bunchfirst[bunch]; z>=0; z=p2[z]) { x1 = xb1[z]; x2 = xb2[z]; if (umost[x2] >= dmost[x2]) { - for (x=x1;x= x2) { @@ -2580,7 +2580,7 @@ static void drawalls(int32_t bunch) if ((cz[2] <= cz[0]) && (cz[3] <= cz[1])) { if (globparaceilclip) - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) if (uplc[x] > umost[x]) if (umost[x] <= dmost[x]) { @@ -2592,7 +2592,7 @@ static void drawalls(int32_t bunch) { wallmost(dwall,z,nextsectnum,(uint8_t)0); if ((cz[2] > fz[0]) || (cz[3] > fz[1])) - for (i=x1;i<=x2;i++) if (dwall[i] > dplc[i]) dwall[i] = dplc[i]; + for (i=x1; i<=x2; i++) if (dwall[i] > dplc[i]) dwall[i] = dplc[i]; if ((searchit == 2) && (searchx >= x1) && (searchx <= x2)) if (searchy <= dwall[searchx]) //wall @@ -2628,7 +2628,7 @@ static void drawalls(int32_t bunch) if ((cz[2] >= cz[0]) && (cz[3] >= cz[1])) { - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) if (dwall[x] > umost[x]) if (umost[x] <= dmost[x]) { @@ -2638,7 +2638,7 @@ static void drawalls(int32_t bunch) } else { - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) if (umost[x] <= dmost[x]) { i = max(uplc[x],dwall[x]); @@ -2669,7 +2669,7 @@ static void drawalls(int32_t bunch) if ((fz[2] >= fz[0]) && (fz[3] >= fz[1])) { if (globparaflorclip) - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) if (dplc[x] < dmost[x]) if (umost[x] <= dmost[x]) { @@ -2681,7 +2681,7 @@ static void drawalls(int32_t bunch) { wallmost(uwall,z,nextsectnum,(uint8_t)1); if ((fz[2] < cz[0]) || (fz[3] < cz[1])) - for (i=x1;i<=x2;i++) if (uwall[i] < uplc[i]) uwall[i] = uplc[i]; + for (i=x1; i<=x2; i++) if (uwall[i] < uplc[i]) uwall[i] = uplc[i]; if ((searchit == 2) && (searchx >= x1) && (searchx <= x2)) if (searchy >= uwall[searchx]) //wall @@ -2734,7 +2734,7 @@ static void drawalls(int32_t bunch) if ((fz[2] <= fz[0]) && (fz[3] <= fz[1])) { - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) if (uwall[x] < dmost[x]) if (umost[x] <= dmost[x]) { @@ -2744,7 +2744,7 @@ static void drawalls(int32_t bunch) } else { - for (x=x1;x<=x2;x++) + for (x=x1; x<=x2; x++) if (umost[x] <= dmost[x]) { i = min(dplc[x],uwall[x]); @@ -2777,7 +2777,7 @@ static void drawalls(int32_t bunch) scansector(nextsectnum); else { - for (x=x1;x>= 6; //New hacks (for sized-down voxels) - for (k=0;k= nytoofar)) continue; voxptr = (char *)(B_LITTLE16(shortptr[y])+slabxoffs); @@ -3049,7 +3049,7 @@ static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasp l1 = distrecip[(ny-yoff)>>14]; l2 = distrecip[(ny+yoff)>>14]; - for (;voxptr=0;i--) + for (i=smostwallcnt-1; i>=0; i--) { if (smostwalltype[i]&daclip) continue; j = smostwall[i]; @@ -3282,13 +3282,13 @@ static void drawsprite(int32_t snum) break; case 1: k = smoststart[i] - xb1[j]; - for (x=dalx2;x<=darx2;x++) + for (x=dalx2; x<=darx2; x++) if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x]; if ((dalx2 == lx) && (darx2 == rx)) daclip |= 1; break; case 2: k = smoststart[i] - xb1[j]; - for (x=dalx2;x<=darx2;x++) + for (x=dalx2; x<=darx2; x++) if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x]; if ((dalx2 == lx) && (darx2 == rx)) daclip |= 2; break; @@ -3297,7 +3297,7 @@ static void drawsprite(int32_t snum) if (uwall[rx] >= dwall[rx]) { - for (x=lx;x>8); - for (x=xb1[MAXWALLSB-1]+4;x<=j;x+=4) + for (x=xb1[MAXWALLSB-1]+4; x<=j; x+=4) { top += topinc; bot += botinc; zz = z; z = mulscale20(top,krecipasm(bot)); @@ -3442,7 +3442,7 @@ static void drawsprite(int32_t snum) if ((swapped^((cstat&4)>0)) > 0) { j = xspan-1; - for (x=xb1[MAXWALLSB-1];x<=xb2[MAXWALLSB-1];x++) + for (x=xb1[MAXWALLSB-1]; x<=xb2[MAXWALLSB-1]; x++) lwall[x] = j-lwall[x]; } @@ -3486,10 +3486,10 @@ static void drawsprite(int32_t snum) owallmost(uwall,(int32_t)(MAXWALLSB-1),z1-globalposz); owallmost(dwall,(int32_t)(MAXWALLSB-1),z2-globalposz); - for (i=xb1[MAXWALLSB-1];i<=xb2[MAXWALLSB-1];i++) + for (i=xb1[MAXWALLSB-1]; i<=xb2[MAXWALLSB-1]; i++) { swall[i] = (krecipasm(hplc)<<2); hplc += hinc; } - for (i=smostwallcnt-1;i>=0;i--) + for (i=smostwallcnt-1; i>=0; i--) { j = smostwall[i]; @@ -3569,12 +3569,12 @@ static void drawsprite(int32_t snum) break; case 1: k = smoststart[i] - xb1[j]; - for (x=dalx2;x<=darx2;x++) + for (x=dalx2; x<=darx2; x++) if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x]; break; case 2: k = smoststart[i] - xb1[j]; - for (x=dalx2;x<=darx2;x++) + for (x=dalx2; x<=darx2; x++) if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x]; break; } @@ -3679,7 +3679,7 @@ static void drawsprite(int32_t snum) //Clip edge 1 npoints2 = 0; zzsgn = rxi[0]+rzi[0]; - for (z=0;z>16); rx = ((rmax+65535)>>16); - for (x=lx;x<=rx;x++) + for (x=lx; x<=rx; x++) { uwall[x] = max(uwall[x],startumost[x+windowx1]-windowy1); dwall[x] = min(dwall[x],startdmost[x+windowx1]-windowy1); } //Additional uwall/dwall clipping goes here - for (i=smostwallcnt-1;i>=0;i--) + for (i=smostwallcnt-1; i>=0; i--) { j = smostwall[i]; if ((xb1[j] > rx) || (xb2[j] < lx)) continue; @@ -3854,12 +3854,12 @@ static void drawsprite(int32_t snum) break; case 1: k = smoststart[i] - xb1[j]; - for (x=dalx2;x<=darx2;x++) + for (x=dalx2; x<=darx2; x++) if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x]; break; case 2: k = smoststart[i] - xb1[j]; - for (x=dalx2;x<=darx2;x++) + for (x=dalx2; x<=darx2; x++) if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x]; break; } @@ -3918,12 +3918,12 @@ static void drawsprite(int32_t snum) int32_t nxrepeat, nyrepeat; lx = 0; rx = xdim-1; - for (x=lx;x<=rx;x++) + for (x=lx; x<=rx; x++) { lwall[x] = (int32_t)startumost[x+windowx1]-windowy1; swall[x] = (int32_t)startdmost[x+windowx1]-windowy1; } - for (i=smostwallcnt-1;i>=0;i--) + for (i=smostwallcnt-1; i>=0; i--) { j = smostwall[i]; if ((xb1[j] > rx) || (xb2[j] < lx)) continue; @@ -3944,12 +3944,12 @@ static void drawsprite(int32_t snum) break; case 1: k = smoststart[i] - xb1[j]; - for (x=dalx2;x<=darx2;x++) + for (x=dalx2; x<=darx2; x++) if (smost[k+x] > lwall[x]) lwall[x] = smost[k+x]; break; case 2: k = smoststart[i] - xb1[j]; - for (x=dalx2;x<=darx2;x++) + for (x=dalx2; x<=darx2; x++) if (smost[k+x] < swall[x]) swall[x] = smost[k+x]; break; } @@ -3957,12 +3957,12 @@ static void drawsprite(int32_t snum) if (lwall[rx] >= swall[rx]) { - for (x=lx;xnextsector,(uint8_t)0); - for (x=xb1[z];x<=xb2[z];x++) if (uplc[x] > uwall[x]) uwall[x] = uplc[x]; + for (x=xb1[z]; x<=xb2[z]; x++) if (uplc[x] > uwall[x]) uwall[x] = uplc[x]; wallmost(dwall,z,sectnum,(uint8_t)1); wallmost(dplc,z,(int32_t)wal->nextsector,(uint8_t)1); - for (x=xb1[z];x<=xb2[z];x++) if (dplc[x] < dwall[x]) dwall[x] = dplc[x]; + for (x=xb1[z]; x<=xb2[z]; x++) if (dplc[x] < dwall[x]) dwall[x] = dplc[x]; prepwall(z,wal); globalorientation = (int32_t)wal->cstat; @@ -4113,7 +4113,7 @@ static void drawmaskwall(int16_t damaskwallcnt) globalzd += (globalypanning<<24); if (globalorientation&256) globalyscale = -globalyscale, globalzd = -globalzd; - for (i=smostwallcnt-1;i>=0;i--) + for (i=smostwallcnt-1; i>=0; i--) { j = smostwall[i]; if ((xb1[j] > xb2[z]) || (xb2[j] < xb1[z])) continue; @@ -4133,12 +4133,12 @@ static void drawmaskwall(int16_t damaskwallcnt) break; case 1: k = smoststart[i] - xb1[j]; - for (x=lx;x<=rx;x++) + for (x=lx; x<=rx; x++) if (smost[k+x] > uwall[x]) uwall[x] = smost[k+x]; break; case 2: k = smoststart[i] - xb1[j]; - for (x=lx;x<=rx;x++) + for (x=lx; x<=rx; x++) if (smost[k+x] < dwall[x]) dwall[x] = smost[k+x]; break; } @@ -4180,19 +4180,19 @@ static void fillpolygon(int32_t npoints) #endif miny = 0x7fffffff; maxy = 0x80000000; - for (z=npoints-1;z>=0;z--) + for (z=npoints-1; z>=0; z--) { y = ry1[z]; miny = min(miny,y); maxy = max(maxy,y); } miny = (miny>>12); maxy = (maxy>>12); if (miny < 0) miny = 0; if (maxy >= ydim) maxy = ydim-1; ptr = smost; //They're pointers! - watch how you optimize this thing - for (y=miny;y<=maxy;y++) + for (y=miny; y<=maxy; y++) { dotp1[y] = ptr; dotp2[y] = ptr+(MAXNODESPERLINE>>1); ptr += MAXNODESPERLINE; } - for (z=npoints-1;z>=0;z--) + for (z=npoints-1; z>=0; z--) { zz = xb1[z]; y1 = ry1[z]; day1 = (y1>>12); @@ -4204,12 +4204,12 @@ static void fillpolygon(int32_t npoints) if (day2 > day1) { x1 += mulscale12((day1<<12)+4095-y1,xinc); - for (y=day1;y>12); x1 += xinc; } + for (y=day1; y>12); x1 += xinc; } } else { x2 += mulscale12((day2<<12)+4095-y2,xinc); - for (y=day2;y>12); x2 += xinc; } + for (y=day2; y>12); x2 += xinc; } } } } @@ -4224,13 +4224,13 @@ static void fillpolygon(int32_t npoints) setuphlineasm4(asm1,asm2); ptr = smost; - for (y=miny;y<=maxy;y++) + for (y=miny; y<=maxy; y++) { cnt = dotp1[y]-ptr; ptr2 = ptr+(MAXNODESPERLINE>>1); - for (z=cnt-1;z>=0;z--) + for (z=cnt-1; z>=0; z--) { day1 = 0; day2 = 0; - for (zz=z;zz>0;zz--) + for (zz=z; zz>0; zz--) { if (ptr[zz] < ptr[day1]) day1 = zz; if (ptr2[zz] < ptr2[day2]) day2 = zz; @@ -4325,8 +4325,8 @@ static int32_t clippoly(int32_t npoints, int32_t clipstat) while (z < npoints); if (npoints2 <= 2) return(0); - for (z=1;z=0;v--) + for (v=npoints-1; v>=0; v--) { x1 = nrx1[v]; x2 = nrx1[nextv]; dax1 = (x1>>16); if (x1 < lx) lx = x1; @@ -4721,10 +4721,10 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t palookupoffse[0] = palookupoffse[1] = palookupoffse[2] = palookupoffse[3] = palookupoffs; vince[0] = vince[1] = vince[2] = vince[3] = yv; - for (x=x1;x y1)) y1 = startumost[x1]; y2 = y1; - for (x=x1;x>16)*ysiz,xv<<16,ysiz,yv,0L); if (dastat&32) settransreverse(); else settransnormal(); } - for (x=x1;x= j) { j <<= 2; k++; } sqrtable[i] = (uint16_t)(msqrtasm((i<<18)+131072)<<1); @@ -5070,7 +5070,7 @@ static void dosetaspect(void) oxyaspect = xyaspect; j = xyaspect*320; horizlookup2[horizycent-1] = divscale26(131072,j); - for (i=ydim*4-1;i>=0;i--) + for (i=ydim*4-1; i>=0; i--) if (i != (horizycent-1)) { horizlookup[i] = divscale28(1,i-(horizycent-1)); @@ -5083,14 +5083,14 @@ static void dosetaspect(void) oviewingrange = viewingrange; xinc = mulscale32(viewingrange*320,xdimenrecip); x = (640<<16)-mulscale1(xinc,xdimen); - for (i=0;i>16); x += xinc; if (j != 0) j = mulscale16((int32_t)radarang[k+1]-(int32_t)radarang[k],j); radarang2[i] = (int16_t)(((int32_t)radarang[k]+j)>>6); } #ifdef SUPERBUILD - for (i=1;i<65536;i++) distrecip[i] = divscale20(xdimen,i); + for (i=1; i<65536; i++) distrecip[i] = divscale20(xdimen,i); nytooclose = xdimen*2100; nytoofar = 65536*16384-1048576; #endif @@ -5105,11 +5105,11 @@ static inline void calcbritable(void) { int32_t i,j; double a,b; - for (i=0;i<16;i++) + for (i=0; i<16; i++) { a = (double)8 / ((double)i+8); b = (double)255 / pow((double)255,a); - for (j=0;j<256;j++) // JBF 20040207: full 8bit precision + for (j=0; j<256; j++) // JBF 20040207: full 8bit precision britable[i][j] = (uint8_t)(pow((double)j,a)*b); } } @@ -5122,13 +5122,13 @@ static int32_t loadtables(void) { initksqrt(); - for (i=0;i<2048;i++) reciptable[i] = divscale30(2048L,i+2048); + for (i=0; i<2048; i++) reciptable[i] = divscale30(2048L,i+2048); if ((fil = kopen4load("tables.dat",0)) != -1) { kread(fil,sintable,2048*2); for (i=2048-1; i>=0; i--) sintable[i] = B_LITTLE16(sintable[i]); kread(fil,radarang,640*2); for (i=640-1; i>=0; i--) radarang[i] = B_LITTLE16(radarang[i]); - for (i=0;i<640;i++) radarang[1279-i] = -radarang[i]; + for (i=0; i<640; i++) radarang[1279-i] = -radarang[i]; //kread(fil,textfont,1024); //kread(fil,smalltextfont,1024); //kread(fil,britable,1024); @@ -5158,7 +5158,7 @@ static void initfastcolorlookup(int32_t rscale, int32_t gscale, int32_t bscale) char *pal1; j = 0; - for (i=64;i>=0;i--) + for (i=64; i>=0; i--) { //j = (i-64)*(i-64); rdist[i] = rdist[128-i] = j*rscale; @@ -5173,7 +5173,7 @@ static void initfastcolorlookup(int32_t rscale, int32_t gscale, int32_t bscale) Bmemset(colhead,0,sizeof(colhead)); pal1 = (char *)&palette[768-3]; - for (i=255;i>=0;i--,pal1-=3) + for (i=255; i>=0; i--,pal1-=3) { j = (pal1[0]>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(pal1[1]>>3)*FASTPALGRIDSIZ+(pal1[2]>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1; if (colhere[j>>3]&pow2char[j&7]) colnext[i] = colhead[j]; else colnext[i] = -1; @@ -5182,9 +5182,9 @@ static void initfastcolorlookup(int32_t rscale, int32_t gscale, int32_t bscale) } i = 0; - for (x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ;x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ;x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ) - for (y=-FASTPALGRIDSIZ;y<=FASTPALGRIDSIZ;y+=FASTPALGRIDSIZ) - for (z=-1;z<=1;z++) + for (x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ; x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ; x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ) + for (y=-FASTPALGRIDSIZ; y<=FASTPALGRIDSIZ; y+=FASTPALGRIDSIZ) + for (z=-1; z<=1; z++) colscan[i++] = x+y+z; i = colscan[13]; colscan[13] = colscan[26]; colscan[26] = i; } @@ -5239,7 +5239,7 @@ int32_t getclosestcol(int32_t r, int32_t g, int32_t b) r = 64-r; g = 64-g; b = 64-b; retcol = -1; - for (k=26;k>=0;k--) + for (k=26; k>=0; k--) { i = colscan[k]+j; if ((colhere[i>>3]&pow2char[i&7]) == 0) continue; i = colhead[i]; @@ -5264,7 +5264,7 @@ int32_t getclosestcol(int32_t r, int32_t g, int32_t b) mindist = 0x7fffffff; pal1 = (char *)&palette[768-3]; - for (i=255;i>=0;i--,pal1-=3) + for (i=255; i>=0; i--,pal1-=3) { dist = gdist[pal1[1]+g]; if (dist >= mindist) continue; dist += rdist[pal1[0]+r]; if (dist >= mindist) continue; @@ -5383,7 +5383,7 @@ static int32_t deletespritestat(int16_t deleteme) // lintersect (internal) // static inline int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t x3, - int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) + int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) { //p1 to p2 is a line segment int32_t x21, y21, x34, y34, x31, y31, bot, topt, topu, t; @@ -5416,7 +5416,7 @@ static inline int32_t lintersect(int32_t x1, int32_t y1, int32_t z1, int32_t x2, // rintersect (internal) // static inline int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy, int32_t vz, int32_t x3, - int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) + int32_t y3, int32_t x4, int32_t y4, int32_t *intx, int32_t *inty, int32_t *intz) { //p1 towards p2 is a ray int32_t x34, y34, x31, y31, bot, topt, topu, t; @@ -5474,7 +5474,7 @@ static inline int32_t raytrace(int32_t x3, int32_t y3, int32_t *x4, int32_t *y4) int32_t x21, y21, x43, y43; hitwall = -1; - for (z=clipnum-1;z>=0;z--) + for (z=clipnum-1; z>=0; z--) { x1 = clipit[z].x1; x2 = clipit[z].x2; x21 = x2-x1; y1 = clipit[z].y1; y2 = clipit[z].y2; y21 = y2-y1; @@ -5640,14 +5640,14 @@ int32_t initengine(void) showinvisibility = 0; #ifdef SUPERBUILD - for (i=1;i<1024;i++) lowrecip[i] = ((1<<24)-1)/i; - for (i=0;i>2,65536L); #endif @@ -5660,7 +5660,7 @@ int32_t initengine(void) searchit = 0; searchstat = -1; - for (i=0;i -1) - Bclose(cachefilehandle); - if (cacheindexptr != NULL) - Bfclose(cacheindexptr); */ + /* if (cachefilehandle > -1) + Bclose(cachefilehandle); + if (cacheindexptr != NULL) + Bfclose(cacheindexptr); */ #endif uninitsystem(); @@ -5719,7 +5719,7 @@ void uninitengine(void) //if (lookupsalloctype == 1) suckcache(lookups); //Cache already gone lookups = NULL; } - for (i=0;i=0;i--) + for (i=numscans-1; i>=0; i--) { if (wall[thewall[i]].nextsector < 0) continue; if (xb1[i] < mirrorsx1) mirrorsx1 = xb1[i]; if (xb2[i] > mirrorsx2) mirrorsx2 = xb2[i]; } - for (i=0;i=0;z=p2[z]) + for (z=bunchfirst[closest]; z>=0; z=p2[z]) show2dwall[thewall[z]>>3] |= pow2char[thewall[z]&7]; } @@ -6112,8 +6112,8 @@ void drawmasks(void) } #endif - for (i=spritesortcnt-1;i>=0;i--) tspriteptr[i] = &tsprite[i]; - for (i=spritesortcnt-1;i>=0;i--) + for (i=spritesortcnt-1; i>=0; i--) tspriteptr[i] = &tsprite[i]; + for (i=spritesortcnt-1; i>=0; i--) { xs = tspriteptr[i]->x-globalposx; ys = tspriteptr[i]->y-globalposy; yp = dmulscale6(xs,cosviewingrangeglobalang,ys,sinviewingrangeglobalang); @@ -6144,9 +6144,9 @@ killsprite: { gap = 1; while (gap < spritesortcnt) gap = (gap<<1)+1; - for (gap>>=1;gap>0;gap>>=1) //Sort sprite list - for (i=0;i=0;l-=gap) + for (gap>>=1; gap>0; gap>>=1) //Sort sprite list + for (i=0; i=0; l-=gap) { if (spritesy[l] <= spritesy[l+gap]) break; swaplong(&tspriteptr[l],&tspriteptr[l+gap]); @@ -6158,13 +6158,13 @@ killsprite: spritesy[spritesortcnt] = (spritesy[spritesortcnt-1]^1); ys = spritesy[0]; i = 0; - for (j=1;j<=spritesortcnt;j++) + for (j=1; j<=spritesortcnt; j++) { if (spritesy[j] == ys) continue; ys = spritesy[j]; if (j > i+1) { - for (k=i;kz; if ((tspriteptr[k]->cstat&48) != 32) @@ -6176,8 +6176,8 @@ killsprite: if (klabs(spritesz[k]-globalposz) < (yspan>>1)) spritesz[k] = globalposz; } } - for (k=i+1;kstatnum < tspriteptr[l]->statnum) { swaplong(&tspriteptr[k],&tspriteptr[l]); @@ -6288,127 +6288,127 @@ killsprite: #endif } /* depthpeeling */ #if defined(USE_OPENGL) && defined(POLYMOST) -/* - else - { - curpolygonoffset = 0; - cullcheckcnt = 0; - j = spritesortcnt; - k = maskwallcnt; + /* + else + { + curpolygonoffset = 0; + cullcheckcnt = 0; + j = spritesortcnt; + k = maskwallcnt; - while (j > 0) drawsprite(--j); - while (k > 0) drawmaskwall(--k); - if (totalclock < lastcullcheck - CULL_DELAY) - lastcullcheck = totalclock; - if (totalclock >= lastcullcheck + CULL_DELAY) - lastcullcheck = (totalclock + CULL_DELAY); - } -*/ + while (j > 0) drawsprite(--j); + while (k > 0) drawmaskwall(--k); + if (totalclock < lastcullcheck - CULL_DELAY) + lastcullcheck = totalclock; + if (totalclock >= lastcullcheck + CULL_DELAY) + lastcullcheck = (totalclock + CULL_DELAY); + } + */ #endif #if defined(USE_OPENGL) && defined(POLYMOST) -/* - if ((r_depthpeeling) && (rendmode >= 3)) - { - bglPopAttrib(); - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - bglNewList(1, GL_COMPILE); - - peelcompiling = 1; - curpolygonoffset = 0; - - while (spritesortcnt > 0) drawsprite(--spritesortcnt); - while (maskwallcnt > 0) drawmaskwall(--maskwallcnt); - - peelcompiling = 0; - - bglEndList(); - - bglDisable(GL_BLEND); - bglEnable(GL_ALPHA_TEST); - bglAlphaFunc(GL_GREATER, 0.0f); - bglEnable(GL_FRAGMENT_PROGRAM_ARB); - - i = 0; - while (i < r_peelscount) + /* + if ((r_depthpeeling) && (rendmode >= 3)) { - - if (i > 0) - { - bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[1]); - bglActiveTextureARB(GL_TEXTURE1_ARB); - bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[(i - 1) % 2]); - bglActiveTextureARB(GL_TEXTURE2_ARB); - bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[2]); - bglActiveTextureARB(GL_TEXTURE0_ARB); - } - else - { - bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[0]); - bglActiveTextureARB(GL_TEXTURE1_ARB); - bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[2]); - bglActiveTextureARB(GL_TEXTURE0_ARB); - } - - if (i == (r_peelscount - 1)) - bglEnable(GL_BLEND); - - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[i]); - bglPushAttrib(GL_VIEWPORT_BIT); - bglViewport(0, 0, xdim, ydim); - - bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - bglCallList(1); - bglPopAttrib(); bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - i++; + bglNewList(1, GL_COMPILE); + + peelcompiling = 1; + curpolygonoffset = 0; + + while (spritesortcnt > 0) drawsprite(--spritesortcnt); + while (maskwallcnt > 0) drawmaskwall(--maskwallcnt); + + peelcompiling = 0; + + bglEndList(); + + bglDisable(GL_BLEND); + bglEnable(GL_ALPHA_TEST); + bglAlphaFunc(GL_GREATER, 0.0f); + bglEnable(GL_FRAGMENT_PROGRAM_ARB); + + i = 0; + while (i < r_peelscount) + { + + if (i > 0) + { + bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[1]); + bglActiveTextureARB(GL_TEXTURE1_ARB); + bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[(i - 1) % 2]); + bglActiveTextureARB(GL_TEXTURE2_ARB); + bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[2]); + bglActiveTextureARB(GL_TEXTURE0_ARB); + } + else + { + bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[0]); + bglActiveTextureARB(GL_TEXTURE1_ARB); + bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[2]); + bglActiveTextureARB(GL_TEXTURE0_ARB); + } + + if (i == (r_peelscount - 1)) + bglEnable(GL_BLEND); + + bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[i]); + bglPushAttrib(GL_VIEWPORT_BIT); + bglViewport(0, 0, xdim, ydim); + + bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + bglCallList(1); + + bglPopAttrib(); + bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + + i++; + } + + bglDisable(GL_FRAGMENT_PROGRAM_ARB); + bglEnable(GL_BLEND); + bglDisable(GL_DEPTH_TEST); + + bglColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + // identity for screen aligned quads + bglMatrixMode(GL_PROJECTION); + bglPushMatrix(); + bglLoadIdentity(); + bglMatrixMode(GL_MODELVIEW); + bglPushMatrix(); + bglLoadIdentity(); + + bglEnable(GL_TEXTURE_RECTANGLE); + + // backbuffer + drawpeel(r_peelscount); + + if (r_curpeel == -1) + { + i = r_peelscount - 1; + while (i >= 0) + drawpeel(i--); + } + else + drawpeel(r_curpeel); + + bglDisable(GL_TEXTURE_RECTANGLE); + bglEnable(GL_TEXTURE_2D); + + // restore the polymost projection + bglMatrixMode(GL_PROJECTION); + bglPopMatrix(); + bglMatrixMode(GL_MODELVIEW); + bglPopMatrix(); + + bglEnable(GL_DEPTH_TEST); + + bglDeleteLists(1, 1); } - - bglDisable(GL_FRAGMENT_PROGRAM_ARB); - bglEnable(GL_BLEND); - bglDisable(GL_DEPTH_TEST); - - bglColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - // identity for screen aligned quads - bglMatrixMode(GL_PROJECTION); - bglPushMatrix(); - bglLoadIdentity(); - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); - bglLoadIdentity(); - - bglEnable(GL_TEXTURE_RECTANGLE); - - // backbuffer - drawpeel(r_peelscount); - - if (r_curpeel == -1) - { - i = r_peelscount - 1; - while (i >= 0) - drawpeel(i--); - } - else - drawpeel(r_curpeel); - - bglDisable(GL_TEXTURE_RECTANGLE); - bglEnable(GL_TEXTURE_2D); - - // restore the polymost projection - bglMatrixMode(GL_PROJECTION); - bglPopMatrix(); - bglMatrixMode(GL_MODELVIEW); - bglPopMatrix(); - - bglEnable(GL_DEPTH_TEST); - - bglDeleteLists(1, 1); - } -*/ + */ #endif indrawroomsandmasks = 0; @@ -6447,13 +6447,13 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) begindrawing(); //{{{ - for (s=0,sec=§or[s];s>3]&pow2char[s&7]) { npoints = 0; i = 0; startwall = sec->wallptr; #if 0 - for (w=sec->wallnum,wal=&wall[startwall];w>0;w--,wal++) + for (w=sec->wallnum,wal=&wall[startwall]; w>0; w--,wal++) { ox = wal->x - dax; oy = wal->y - day; x = dmulscale16(ox,xvect,-oy,yvect) + (xdim<<11); @@ -6466,7 +6466,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) } #else j = startwall; l = 0; - for (w=sec->wallnum,wal=&wall[startwall];w>0;w--,wal++,j++) + for (w=sec->wallnum,wal=&wall[startwall]; w>0; w--,wal++,j++) { k = lastwall(j); if ((k > j) && (npoints > 0)) { xb1[npoints-1] = l; l = npoints; } //overwrite point2 @@ -6493,7 +6493,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) } //Collect floor sprites to draw - for (i=headspritesect[s];i>=0;i=nextspritesect[i]) + for (i=headspritesect[s]; i>=0; i=nextspritesect[i]) if ((sprite[i].cstat&48) == 32) { if ((sprite[i].cstat&(64+8)) == (64+8)) continue; @@ -6575,15 +6575,15 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) //Sort sprite list gap = 1; while (gap < sortnum) gap = (gap<<1)+1; - for (gap>>=1;gap>0;gap>>=1) - for (i=0;i=0;j-=gap) + for (gap>>=1; gap>0; gap>>=1) + for (i=0; i=0; j-=gap) { if (sprite[tsprite[j].owner].z <= sprite[tsprite[j+gap].owner].z) break; swapshort(&tsprite[j].owner,&tsprite[j+gap].owner); } - for (s=sortnum-1;s>=0;s--) + for (s=sortnum-1; s>=0; s--) { spr = &sprite[tsprite[s].owner]; if ((spr->cstat&48) == 32) @@ -6711,7 +6711,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang) // loadboard // int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *daposy, int32_t *daposz, - int16_t *daang, int16_t *dacursectnum) + int16_t *daang, int16_t *dacursectnum) { int16_t fil, i, numsprites; @@ -6812,7 +6812,7 @@ int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *dapo } } - for (i=0;iltextptr; switch (legaltokens[i].tokenid) { @@ -7541,7 +7541,7 @@ int32_t loadmaphack(char *filename) { UNREFERENCED_PARAMETER(filename); return - // saveboard // int32_t saveboard(char *filename, int32_t *daposx, int32_t *daposy, int32_t *daposz, - int16_t *daang, int16_t *dacursectnum) + int16_t *daang, int16_t *dacursectnum) { int16_t fil, i, j, numsprites, ts; int32_t tl; @@ -7555,7 +7555,7 @@ int32_t saveboard(char *filename, int32_t *daposx, int32_t *daposy, int32_t *dap if ((fil = Bopen(filename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) return(-1); - for (j=0;jMAXSTATUS) + for (j=0; jMAXSTATUS) { initprintf("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n",j,sprite[j].x,sprite[j].y,sprite[j].statnum); changespritestat(j,0); @@ -7563,7 +7563,7 @@ int32_t saveboard(char *filename, int32_t *daposx, int32_t *daposy, int32_t *dap numsprites = 0; #if 0 - for (j=0;jpagesleft > 0) && (per->pagesleft <= numpages)) @@ -7832,7 +7832,7 @@ void nextpage(void) showframe(0); begindrawing(); //{{{ - for (i=permtail;i!=permhead;i=((i+1)&(MAXPERMS-1))) + for (i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) { per = &permfifo[i]; if (per->pagesleft >= 130) @@ -7861,7 +7861,7 @@ void nextpage(void) { int32_t i; - for (i=0;i 1) && (pow2long[j] > tilesizx[i])) j--; @@ -8022,7 +8022,7 @@ void loadtile(int16_t tilenume) artfilplc = tilefileoffs[tilenume]+dasiz; } else - { + { if (faketile[tilenume] == 1 || (faketile[tilenume] == 2 && faketiledata[tilenume] == NULL)) Bmemset((char *)waloff[tilenume],0,dasiz); else if (faketile[tilenume] == 2) @@ -8082,10 +8082,10 @@ void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, in if (waloff[tilenume2] == 0) loadtile(tilenume2); x1 = sx1; - for (i=0;iwallnum,wal=&wall[sec->wallptr];cnt>0;cnt--,wal++) + for (cnt=sec->wallnum,wal=&wall[sec->wallptr]; cnt>0; cnt--,wal++) { wal2 = &wall[wal->point2]; x31 = wal->x-x1; x34 = wal->x-wal2->x; @@ -8464,11 +8464,11 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, in getzsofslope((int16_t)nexts,x,y,&cz,&fz); if ((z <= cz) || (z >= fz)) return(0); - for (i=danum-1;i>=0;i--) if (clipsectorlist[i] == nexts) break; + for (i=danum-1; i>=0; i--) if (clipsectorlist[i] == nexts) break; if (i < 0) clipsectorlist[danum++] = nexts; } } - for (i=danum-1;i>=0;i--) if (clipsectorlist[i] == sect2) return(1); + for (i=danum-1; i>=0; i--) if (clipsectorlist[i] == sect2) return(1); return(0); } @@ -8544,212 +8544,212 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32 hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1; } - x1 = 0x7fffffff; - if (sec->floorstat&2) - { - wal = &wall[sec->wallptr]; wal2 = &wall[wal->point2]; - dax = wal2->x-wal->x; day = wal2->y-wal->y; - i = nsqrtasm(dax*dax+day*day); if (i == 0) continue; - i = divscale15(sec->floorheinum,i); - dax *= i; day *= i; + x1 = 0x7fffffff; + if (sec->floorstat&2) + { + wal = &wall[sec->wallptr]; wal2 = &wall[wal->point2]; + dax = wal2->x-wal->x; day = wal2->y-wal->y; + i = nsqrtasm(dax*dax+day*day); if (i == 0) continue; + i = divscale15(sec->floorheinum,i); + dax *= i; day *= i; - j = (vz<<8)-dmulscale15(dax,vy,-day,vx); - if (j != 0) - { - i = ((sec->floorz-sv->z)<<8)+dmulscale15(dax,sv->y-wal->y,-day,sv->x-wal->x); - if (((i^j) >= 0) && ((klabs(i)>>1) < klabs(j))) - { - i = divscale30(i,j); - x1 = sv->x + mulscale30(vx,i); - y1 = sv->y + mulscale30(vy,i); - z1 = sv->z + mulscale30(vz,i); - } - } - } - else if ((vz > 0) && (sv->z <= sec->floorz)) + j = (vz<<8)-dmulscale15(dax,vy,-day,vx); + if (j != 0) { - z1 = sec->floorz; i = z1-sv->z; - if ((klabs(i)>>1) < vz) + i = ((sec->floorz-sv->z)<<8)+dmulscale15(dax,sv->y-wal->y,-day,sv->x-wal->x); + if (((i^j) >= 0) && ((klabs(i)>>1) < klabs(j))) { - i = divscale30(i,vz); + i = divscale30(i,j); x1 = sv->x + mulscale30(vx,i); y1 = sv->y + mulscale30(vy,i); + z1 = sv->z + mulscale30(vz,i); } } - if ((x1 != 0x7fffffff) && (klabs(x1-sv->x)+klabs(y1-sv->y) < klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y))) - if (inside(x1,y1,dasector) != 0) - { - hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = -1; - hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1; - } + } + else if ((vz > 0) && (sv->z <= sec->floorz)) + { + z1 = sec->floorz; i = z1-sv->z; + if ((klabs(i)>>1) < vz) + { + i = divscale30(i,vz); + x1 = sv->x + mulscale30(vx,i); + y1 = sv->y + mulscale30(vy,i); + } + } + if ((x1 != 0x7fffffff) && (klabs(x1-sv->x)+klabs(y1-sv->y) < klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y))) + if (inside(x1,y1,dasector) != 0) + { + hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = -1; + hitinfo->pos.x = x1; hitinfo->pos.y = y1; hitinfo->pos.z = z1; + } - startwall = sec->wallptr; endwall = startwall + sec->wallnum; - for (z=startwall,wal=&wall[startwall];zpoint2]; - x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y; + startwall = sec->wallptr; endwall = startwall + sec->wallnum; + for (z=startwall,wal=&wall[startwall]; zpoint2]; + x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y; - if ((x1-sv->x)*(y2-sv->y) < (x2-sv->x)*(y1-sv->y)) continue; - if (rintersect(sv->x,sv->y,sv->z,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue; + if ((x1-sv->x)*(y2-sv->y) < (x2-sv->x)*(y1-sv->y)) continue; + if (rintersect(sv->x,sv->y,sv->z,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue; - if (klabs(intx-sv->x)+klabs(inty-sv->y) >= klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; + if (klabs(intx-sv->x)+klabs(inty-sv->y) >= klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; - nextsector = wal->nextsector; - if ((nextsector < 0) || (wal->cstat&dawalclipmask)) - { - hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - continue; - } - getzsofslope(nextsector,intx,inty,&daz,&daz2); - if ((intz <= daz) || (intz >= daz2)) - { - hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - continue; - } + nextsector = wal->nextsector; + if ((nextsector < 0) || (wal->cstat&dawalclipmask)) + { + hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1; + hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; + continue; + } + getzsofslope(nextsector,intx,inty,&daz,&daz2); + if ((intz <= daz) || (intz >= daz2)) + { + hitinfo->hitsect = dasector; hitinfo->hitwall = z; hitinfo->hitsprite = -1; + hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; + continue; + } - for (zz=tempshortnum-1;zz>=0;zz--) - if (clipsectorlist[zz] == nextsector) break; - if (zz < 0) clipsectorlist[tempshortnum++] = nextsector; - } + for (zz=tempshortnum-1; zz>=0; zz--) + if (clipsectorlist[zz] == nextsector) break; + if (zz < 0) clipsectorlist[tempshortnum++] = nextsector; + } - for (z=headspritesect[dasector];z>=0;z=nextspritesect[z]) - { - spr = &sprite[z]; - cstat = spr->cstat; + for (z=headspritesect[dasector]; z>=0; z=nextspritesect[z]) + { + spr = &sprite[z]; + cstat = spr->cstat; #ifdef POLYMOST - if (!hitallsprites) + if (!hitallsprites) #endif - if ((cstat&dasprclipmask) == 0) continue; + if ((cstat&dasprclipmask) == 0) continue; - x1 = spr->x; y1 = spr->y; z1 = spr->z; - switch (cstat&48) - { - case 0: - topt = vx*(x1-sv->x) + vy*(y1-sv->y); if (topt <= 0) continue; - bot = vx*vx + vy*vy; if (bot == 0) continue; + x1 = spr->x; y1 = spr->y; z1 = spr->z; + switch (cstat&48) + { + case 0: + topt = vx*(x1-sv->x) + vy*(y1-sv->y); if (topt <= 0) continue; + bot = vx*vx + vy*vy; if (bot == 0) continue; - intz = sv->z+scale(vz,topt,bot); + intz = sv->z+scale(vz,topt,bot); - i = (tilesizy[spr->picnum]*spr->yrepeat<<2); - if (cstat&128) z1 += (i>>1); - if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - if ((intz > z1) || (intz < z1-i)) continue; - topu = vx*(y1-sv->y) - vy*(x1-sv->x); + i = (tilesizy[spr->picnum]*spr->yrepeat<<2); + if (cstat&128) z1 += (i>>1); + if (picanm[spr->picnum]&0x00ff0000) z1 -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); + if ((intz > z1) || (intz < z1-i)) continue; + topu = vx*(y1-sv->y) - vy*(x1-sv->x); - offx = scale(vx,topu,bot); - offy = scale(vy,topu,bot); - dist = offx*offx + offy*offy; - i = tilesizx[spr->picnum]*spr->xrepeat; i *= i; - if (dist > (i>>7)) continue; - intx = sv->x + scale(vx,topt,bot); - inty = sv->y + scale(vy,topt,bot); + offx = scale(vx,topu,bot); + offy = scale(vy,topu,bot); + dist = offx*offx + offy*offy; + i = tilesizx[spr->picnum]*spr->xrepeat; i *= i; + if (dist > (i>>7)) continue; + intx = sv->x + scale(vx,topt,bot); + inty = sv->y + scale(vy,topt,bot); - if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; + if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; - hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - break; - case 16: - //These lines get the 2 points of the rotated sprite - //Given: (x1, y1) starts out as the center point - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - if ((cstat&4) > 0) xoff = -xoff; - k = spr->ang; l = spr->xrepeat; - dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l; - l = tilesizx[tilenum]; k = (l>>1)+xoff; - x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l); - y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l); + hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; + hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; + break; + case 16: + //These lines get the 2 points of the rotated sprite + //Given: (x1, y1) starts out as the center point + tilenum = spr->picnum; + xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); + if ((cstat&4) > 0) xoff = -xoff; + k = spr->ang; l = spr->xrepeat; + dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l; + l = tilesizx[tilenum]; k = (l>>1)+xoff; + x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l); + y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l); - if ((cstat&64) != 0) //back side of 1-way sprite - if ((x1-sv->x)*(y2-sv->y) < (x2-sv->x)*(y1-sv->y)) continue; + if ((cstat&64) != 0) //back side of 1-way sprite + if ((x1-sv->x)*(y2-sv->y) < (x2-sv->x)*(y1-sv->y)) continue; - if (rintersect(sv->x,sv->y,sv->z,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue; + if (rintersect(sv->x,sv->y,sv->z,vx,vy,vz,x1,y1,x2,y2,&intx,&inty,&intz) == 0) continue; - if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; + if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; - k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2); - if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z; - if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); - if ((intz < daz) && (intz > daz-k)) - { - hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - } - break; - case 32: - if (vz == 0) continue; - intz = z1; - if (((intz-sv->z)^vz) < 0) continue; - if ((cstat&64) != 0) - if ((sv->z > intz) == ((cstat&8)==0)) continue; + k = ((tilesizy[spr->picnum]*spr->yrepeat)<<2); + if (cstat&128) daz = spr->z+(k>>1); else daz = spr->z; + if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); + if ((intz < daz) && (intz > daz-k)) + { + hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; + hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; + } + break; + case 32: + if (vz == 0) continue; + intz = z1; + if (((intz-sv->z)^vz) < 0) continue; + if ((cstat&64) != 0) + if ((sv->z > intz) == ((cstat&8)==0)) continue; #if 1 // Abyss crash prevention code ((intz-sv->z)*zx overflowing a 8-bit word) - zz=(int32_t)((intz-sv->z)*vx); - intx = sv->x+scale(zz,1,vz); - zz=(int32_t)((intz-sv->z)*vy); - inty = sv->y+scale(zz,1,vz); + zz=(int32_t)((intz-sv->z)*vx); + intx = sv->x+scale(zz,1,vz); + zz=(int32_t)((intz-sv->z)*vy); + inty = sv->y+scale(zz,1,vz); #else - intx = sv->x+scale(intz-sv->z,vx,vz); - inty = sv->y+scale(intz-sv->z,vy,vz); + intx = sv->x+scale(intz-sv->z,vx,vz); + inty = sv->y+scale(intz-sv->z,vy,vz); #endif - if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; + if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hitinfo->pos.x)-sv->x)+klabs((hitinfo->pos.y)-sv->y)) continue; - tilenum = spr->picnum; - xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); - yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset); - if ((cstat&4) > 0) xoff = -xoff; - if ((cstat&8) > 0) yoff = -yoff; + tilenum = spr->picnum; + xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset); + yoff = (int32_t)((int8_t)((picanm[tilenum]>>16)&255))+((int32_t)spr->yoffset); + if ((cstat&4) > 0) xoff = -xoff; + if ((cstat&8) > 0) yoff = -yoff; - ang = spr->ang; - cosang = sintable[(ang+512)&2047]; sinang = sintable[ang]; - xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat; - yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat; + ang = spr->ang; + cosang = sintable[(ang+512)&2047]; sinang = sintable[ang]; + xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat; + yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat; - dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat; - x1 += dmulscale16(sinang,dax,cosang,day)-intx; - y1 += dmulscale16(sinang,day,-cosang,dax)-inty; - l = xspan*xrepeat; - x2 = x1 - mulscale16(sinang,l); - y2 = y1 + mulscale16(cosang,l); - l = yspan*yrepeat; - k = -mulscale16(cosang,l); x3 = x2+k; x4 = x1+k; - k = -mulscale16(sinang,l); y3 = y2+k; y4 = y1+k; + dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat; + x1 += dmulscale16(sinang,dax,cosang,day)-intx; + y1 += dmulscale16(sinang,day,-cosang,dax)-inty; + l = xspan*xrepeat; + x2 = x1 - mulscale16(sinang,l); + y2 = y1 + mulscale16(cosang,l); + l = yspan*yrepeat; + k = -mulscale16(cosang,l); x3 = x2+k; x4 = x1+k; + k = -mulscale16(sinang,l); y3 = y2+k; y4 = y1+k; - clipyou = 0; - if ((y1^y2) < 0) - { - if ((x1^x2) < 0) clipyou ^= (x1*y2= 0) clipyou ^= 1; - } - if ((y2^y3) < 0) - { - if ((x2^x3) < 0) clipyou ^= (x2*y3= 0) clipyou ^= 1; - } - if ((y3^y4) < 0) - { - if ((x3^x4) < 0) clipyou ^= (x3*y4= 0) clipyou ^= 1; - } - if ((y4^y1) < 0) - { - if ((x4^x1) < 0) clipyou ^= (x4*y1= 0) clipyou ^= 1; - } - - if (clipyou != 0) - { - hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; - hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; - } - break; - } + clipyou = 0; + if ((y1^y2) < 0) + { + if ((x1^x2) < 0) clipyou ^= (x1*y2= 0) clipyou ^= 1; } - tempshortcnt++; + if ((y2^y3) < 0) + { + if ((x2^x3) < 0) clipyou ^= (x2*y3= 0) clipyou ^= 1; + } + if ((y3^y4) < 0) + { + if ((x3^x4) < 0) clipyou ^= (x3*y4= 0) clipyou ^= 1; + } + if ((y4^y1) < 0) + { + if ((x4^x1) < 0) clipyou ^= (x4*y1= 0) clipyou ^= 1; + } + + if (clipyou != 0) + { + hitinfo->hitsect = dasector; hitinfo->hitwall = -1; hitinfo->hitsprite = z; + hitinfo->pos.x = intx; hitinfo->pos.y = inty; hitinfo->pos.z = intz; + } + break; + } + } + tempshortcnt++; } while (tempshortcnt < tempshortnum); return(0); @@ -8787,7 +8787,7 @@ int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ang startwall = sector[dasector].wallptr; endwall = startwall + sector[dasector].wallnum - 1; - for (z=startwall,wal=&wall[startwall];z<=endwall;z++,wal++) + for (z=startwall,wal=&wall[startwall]; z<=endwall; z++,wal++) { wal2 = &wall[wal->point2]; x1 = wal->x; y1 = wal->y; x2 = wal2->x; y2 = wal2->y; @@ -8817,14 +8817,14 @@ int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ang } if (nextsector >= 0) { - for (zz=tempshortnum-1;zz>=0;zz--) + for (zz=tempshortnum-1; zz>=0; zz--) if (clipsectorlist[zz] == nextsector) break; if (zz < 0) clipsectorlist[tempshortnum++] = nextsector; } } } - for (z=headspritesect[dasector];z>=0;z=nextspritesect[z]) + for (z=headspritesect[dasector]; z>=0; z=nextspritesect[z]) { spr = &sprite[z]; @@ -9014,7 +9014,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum, dasect = clipsectorlist[clipsectcnt++]; sec = §or[dasect]; startwall = sec->wallptr; endwall = startwall + sec->wallnum; - for (j=startwall,wal=&wall[startwall];jpoint2]; if ((wal->x < xmin) && (wal2->x < xmin)) continue; @@ -9070,13 +9070,13 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum, } else { - for (i=clipsectnum-1;i>=0;i--) + for (i=clipsectnum-1; i>=0; i--) if (wal->nextsector == clipsectorlist[i]) break; if (i < 0) clipsectorlist[clipsectnum++] = wal->nextsector; } } - for (j=headspritesect[dasect];j>=0;j=nextspritesect[j]) + for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j]) { spr = &sprite[j]; cstat = spr->cstat; @@ -9134,9 +9134,9 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum, //Side blocker if ((x2-x1)*((vect->x)-x1) + (y2-y1)*((vect->y)-y1) < 0) - { addclipline(x1-day,y1+dax,x1+dax,y1+day,(int16_t)j+49152); } + { addclipline(x1-day,y1+dax,x1+dax,y1+day,(int16_t)j+49152); } else if ((x1-x2)*((vect->x)-x2) + (y1-y2)*((vect->y)-y2) < 0) - { addclipline(x2+day,y2-dax,x2-dax,y2-day,(int16_t)j+49152); } + { addclipline(x2+day,y2-dax,x2-dax,y2-day,(int16_t)j+49152); } } } break; @@ -9224,7 +9224,7 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum, } tempint1 = dmulscale6(lx,oxvect,ly,oyvect); - for (i=cnt+1;i<=clipmoveboxtracenum;i++) + for (i=cnt+1; i<=clipmoveboxtracenum; i++) { j = hitwalls[i]; tempint2 = dmulscale6(clipit[j].x2-clipit[j].x1,oxvect,clipit[j].y2-clipit[j].y1,oyvect); @@ -9249,45 +9249,45 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum, } while (((xvect|yvect) != 0) && (hitwall >= 0) && (cnt > 0)); - for (j=0;jx,vect->y,clipsectorlist[j]) == 1) { *sectnum = clipsectorlist[j]; return(retval); } - *sectnum = -1; tempint1 = 0x7fffffff; - for (j=numsectors-1;j>=0;j--) - if (inside(vect->x,vect->y,j) == 1) + *sectnum = -1; tempint1 = 0x7fffffff; + for (j=numsectors-1; j>=0; j--) + if (inside(vect->x,vect->y,j) == 1) + { + if (sector[j].ceilingstat&2) + tempint2 = (getceilzofslope((int16_t)j,vect->x,vect->y)-(vect->z)); + else + tempint2 = (sector[j].ceilingz-(vect->z)); + + if (tempint2 > 0) { - if (sector[j].ceilingstat&2) - tempint2 = (getceilzofslope((int16_t)j,vect->x,vect->y)-(vect->z)); - else - tempint2 = (sector[j].ceilingz-(vect->z)); - - if (tempint2 > 0) - { - if (tempint2 < tempint1) + if (tempint2 < tempint1) { *sectnum = j; tempint1 = tempint2; } - } - else - { - if (sector[j].floorstat&2) - tempint2 = ((vect->z)-getflorzofslope((int16_t)j,vect->x,vect->y)); - else - tempint2 = ((vect->z)-sector[j].floorz); - - if (tempint2 <= 0) - { - *sectnum = j; - return(retval); - } - if (tempint2 < tempint1) - { *sectnum = j; tempint1 = tempint2; } - } } + else + { + if (sector[j].floorstat&2) + tempint2 = ((vect->z)-getflorzofslope((int16_t)j,vect->x,vect->y)); + else + tempint2 = ((vect->z)-sector[j].floorz); - return(retval); + if (tempint2 <= 0) + { + *sectnum = j; + return(retval); + } + if (tempint2 < tempint1) + { *sectnum = j; tempint1 = tempint2; } + } + } + + return(retval); } @@ -9359,7 +9359,7 @@ int32_t pushmove(vec3_t *vect, int16_t *sectnum, else endwall = sec->wallptr, startwall = endwall + sec->wallnum; - for (i=startwall,wal=&wall[startwall];i!=endwall;i+=dir,wal+=dir) + for (i=startwall,wal=&wall[startwall]; i!=endwall; i+=dir,wal+=dir) if (clipinsidebox(vect->x,vect->y,i,walldist-4) == 1) { j = 0; @@ -9413,13 +9413,13 @@ int32_t pushmove(vec3_t *vect, int16_t *sectnum, } else { - for (j=clipsectnum-1;j>=0;j--) + for (j=clipsectnum-1; j>=0; j--) if (wal->nextsector == clipsectorlist[j]) break; if (j < 0) clipsectorlist[clipsectnum++] = wal->nextsector; } } - clipsectcnt++; + clipsectcnt++; } while (clipsectcnt < clipsectnum); dir = -dir; @@ -9459,7 +9459,7 @@ void updatesector(int32_t x, int32_t y, int16_t *sectnum) while (j != 0); } - for (i=numsectors-1;i>=0;i--) + for (i=numsectors-1; i>=0; i--) if (inside(x,y,(int16_t)i) == 1) { *sectnum = i; @@ -9497,7 +9497,7 @@ void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) while (j != 0); } - for (i=numsectors-1;i>=0;i--) + for (i=numsectors-1; i>=0; i--) { getzsofslope(i, x, y, &cz, &fz); if ((z >= cz) && (z <= fz)) @@ -9590,7 +9590,7 @@ void getzrange(const vec3_t *vect, int16_t sectnum, { sec = §or[clipsectorlist[clipsectcnt]]; startwall = sec->wallptr; endwall = startwall + sec->wallnum; - for (j=startwall,wal=&wall[startwall];jnextsector; if (k >= 0) @@ -9617,7 +9617,7 @@ void getzrange(const vec3_t *vect, int16_t sectnum, if (((sec->floorstat&1) == 0) && (vect->z >= sec->floorz-(3<<8))) continue; } - for (i=clipsectnum-1;i>=0;i--) if (clipsectorlist[i] == k) break; + for (i=clipsectnum-1; i>=0; i--) if (clipsectorlist[i] == k) break; if (i < 0) clipsectorlist[clipsectnum++] = k; if ((x1 < xmin+MAXCLIPDIST) && (x2 < xmin+MAXCLIPDIST)) continue; @@ -9638,9 +9638,9 @@ void getzrange(const vec3_t *vect, int16_t sectnum, } while (clipsectcnt < clipsectnum); - for (i=0;i=0;j=nextspritesect[j]) + for (j=headspritesect[clipsectorlist[i]]; j>=0; j=nextspritesect[j]) { spr = &sprite[j]; cstat = spr->cstat; @@ -9765,10 +9765,10 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2) setaspect(65536L,(int32_t)divscale16(ydim*320L,xdim*200L)); - for (i=0;ipagesleft&127) == 0) continue; @@ -9858,7 +9858,7 @@ void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, per2->pagesleft = 0; } if ((per->z == 65536) && (per->a == 0)) - for (i=permtail;i!=permhead;i=((i+1)&(MAXPERMS-1))) + for (i=permtail; i!=permhead; i=((i+1)&(MAXPERMS-1))) { per2 = &permfifo[i]; if ((per2->pagesleft&127) == 0) continue; @@ -9903,11 +9903,11 @@ void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, if ((r|g|b) == 0) { - for (i=0;i<256;i++) + for (i=0; i<256; i++) { ptr = (char *)(FP_OFF(palookup[0])+remapbuf[i]); ptr2 = (char *)(FP_OFF(palookup[palnum])+i); - for (j=0;j=0;i--) + for (i=xsiz-1; i>=0; i--) { ptr1 = (char *)(waloff[tilenume]+i*(xsiz+1)); ptr2 = ptr1; if ((i&1) != 0) { ptr1--; ptr2 -= xsiz; swapchar(ptr1,ptr2); } - for (j=(i>>1)-1;j>=0;j--) + for (j=(i>>1)-1; j>=0; j--) { ptr1 -= 2; ptr2 -= k; swapchar2(ptr1,ptr2,xsiz); } } } @@ -10324,7 +10324,7 @@ void completemirror(void) begindrawing(); p = frameplace+ylookup[windowy1+mirrorsy1]+windowx1+mirrorsx1; i = windowx2-windowx1-mirrorsx2-mirrorsx1; mirrorsx2 -= mirrorsx1; - for (dy=mirrorsy2-mirrorsy1-1;dy>=0;dy--) + for (dy=mirrorsy2-mirrorsy1-1; dy>=0; dy--) { copybufbyte((void*)(p+1),tempbuf,mirrorsx2+1); tempbuf[mirrorsx2] = tempbuf[mirrorsx2-1]; @@ -10467,7 +10467,7 @@ int32_t loopnumofsector(int16_t sectnum, int16_t wallnum) numloops = 0; startwall = sector[sectnum].wallptr; endwall = startwall + sector[sectnum].wallnum; - for (i=startwall;i= startwall+danumwalls)) return; - for (i=0;i= danumwalls) k -= danumwalls; Bmemcpy(&wall[startwall+i],&wall[numwalls+k],sizeof(walltype)); @@ -10520,9 +10520,9 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall) if (newfirstwall >= startwall+danumwalls) newfirstwall -= danumwalls; } - for (i=0;i= numwallsofloop) k -= numwallsofloop; @@ -10534,7 +10534,7 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall) wall[startwall+i].point2 += startwall; } - for (i=startwall;i= 0) wall[wall[i].nextwall].nextwall = i; } @@ -10615,7 +10615,7 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) i = ((x1+2048)>>12); daend = ((x2+2048)>>12); begindrawing(); //{{{ - for (;i>12); if ((j >= startumost[i]) && (j < startdmost[i])) @@ -10638,7 +10638,7 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) begindrawing(); //{{{ p = ylookup[i]+frameplace; - for (;i>12); if ((i >= startumost[j]) && (i < startdmost[j])) @@ -10707,7 +10707,7 @@ void drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) clearbufbyte((void *)p, dx, i); } else - for (i=dx;i>0;i--) + for (i=dx; i>0; i--) { if (drawlinepat & pow2long[(patc++)&31]) drawpixel((char *)p, col); @@ -10729,7 +10729,7 @@ void drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) begindrawing(); //{{{ p = (y1*bytesperline)+x1+frameplace; - for (i=dy;i>0;i--) + for (i=dy; i>0; i--) { if (drawlinepat & pow2long[(patc++)&31]) drawpixel((char *)p, col); @@ -10832,7 +10832,7 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, char col) spx = lpx = x1+mulscale14(r,sintable[0]); spy = lpy = y1+mulscale14(r,sintable[512]); - for (l=64;l<2048;l+=64) + for (l=64; l<2048; l+=64) { px = x1+mulscale14(r,sintable[l]); py = y1+mulscale14(r,sintable[(l+512)&2047]); @@ -10982,7 +10982,7 @@ void draw2dgrid(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16 if ((yp1 < ydim16) && (yp2 >= 0) && (yp2 >= yp1)) { xp1 = halfxdim16-mulscale14(posxe+editorgridextent,zoome); - for (i=-editorgridextent;i<=editorgridextent;i+=(2048>>gride)) + for (i=-editorgridextent; i<=editorgridextent; i+=(2048>>gride)) { xp2 = xp1; xp1 = halfxdim16-mulscale14(posxe-i,zoome); @@ -11005,7 +11005,7 @@ void draw2dgrid(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16 xp1 = mulscale14(posxe+editorgridextent,zoome); xp2 = mulscale14(posxe-editorgridextent,zoome); tempy = 0x80000000l; - for (i=-editorgridextent;i<=editorgridextent;i+=(2048>>gride)) + for (i=-editorgridextent; i<=editorgridextent; i+=(2048>>gride)) { yp1 = (((posye-i)*zoome)>>14); if (yp1 != tempy) @@ -11052,7 +11052,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int } faketimerhandler(); - for (i=numwalls-1,wal=&wall[i];i>=0;i--,wal--) + for (i=numwalls-1,wal=&wall[i]; i>=0; i--,wal--) { int64 dist,dx,dy; if (editstatus == 0) @@ -11202,8 +11202,8 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int faketimerhandler(); if ((zoome >= 256) || (editstatus == 0)) - for (i=0;i=0;j=nextspritesect[j]) + for (i=0; i=0; j=nextspritesect[j]) if ((editstatus == 1) || (show2dsprite[j>>3]&pow2char[j&7])) { col = 3; @@ -11276,7 +11276,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int co[1][0] = co[2][0] = fx; co[2][1] = co[3][1] = fy; - for (ii=3;ii>=0;ii--) + for (ii=3; ii>=0; ii--) { r = mulscale14(cosang,co[ii][0]) - mulscale14(sinang,co[ii][1]); s = mulscale14(sinang,co[ii][0]) + mulscale14(cosang,co[ii][1]); @@ -11284,7 +11284,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int co[ii][1] = s; } drawlinepat = 0xcfcfcfcf; - for (ii=3;ii>=0;ii--) + for (ii=3; ii>=0; ii--) { drawline16(halfxdim16 + xp1 + co[ii][0], midydim16 + yp1 - co[ii][1], halfxdim16 + xp1 + co[(ii+1)&3][0], midydim16 + yp1 - co[(ii+1)&3][1], @@ -11406,7 +11406,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int co[1][0] = co[2][0] = fx; co[2][1] = co[3][1] = fy; - for (ii=3;ii>=0;ii--) + for (ii=3; ii>=0; ii--) { r = mulscale14(cosang,co[ii][0]) - mulscale14(sinang,co[ii][1]); s = mulscale14(sinang,co[ii][0]) + mulscale14(cosang,co[ii][1]); @@ -11415,7 +11415,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int } drawlinepat = 0xcfcfcfcf; - for (ii=3;ii>=0;ii--) + for (ii=3; ii>=0; ii--) { drawline16(halfxdim16 + xp1 + co[ii][0], midydim16 + yp1 - co[ii][1], halfxdim16 + xp1 + co[(ii+1)&3][0], midydim16 + yp1 - co[(ii+1)&3][1], @@ -11455,7 +11455,7 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, cha else { fontptr = textfont; charxsiz = 8; } begindrawing(); //{{{ - for (i=0;name[i];i++) + for (i=0; name[i]; i++) { if (name[i] == '^') { @@ -11521,9 +11521,9 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, cha letptr = &fontptr[name[i]<<3]; ptr = (char *)(bytesperline*(ypos+7)+(stx-fontsize)+frameplace); - for (y=7;y>=0;y--) + for (y=7; y>=0; y--) { - for (x=charxsiz-1;x>=0;x--) + for (x=charxsiz-1; x>=0; x--) { if (letptr[y]&pow2char[7-fontsize-x]) ptr[x] = (uint8_t)col; @@ -11583,7 +11583,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char bglBegin(GL_POINTS); - for (i=0;name[i];i++) + for (i=0; name[i]; i++) { if (name[i] == '^' && isdigit(name[i+1])) { @@ -11612,9 +11612,9 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char letptr = &fontptr[name[i]<<3]; xx = stx-fontsize; yy = ypos+7 + 2; //+1 is hack! - for (y=7;y>=0;y--) + for (y=7; y>=0; y--) { - for (x=charxsiz-1;x>=0;x--) + for (x=charxsiz-1; x>=0; x--) { if (letptr[y]&pow2char[7-fontsize-x]) { @@ -11644,7 +11644,7 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char #endif begindrawing(); //{{{ - for (i=0;name[i];i++) + for (i=0; name[i]; i++) { if (name[i] == '^' && isdigit(name[i+1])) { @@ -11661,9 +11661,9 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char } letptr = &fontptr[name[i]<<3]; ptr = (char *)(ylookup[ypos+7]+(stx-fontsize)+frameplace); - for (y=7;y>=0;y--) + for (y=7; y>=0; y--) { - for (x=charxsiz-1;x>=0;x--) + for (x=charxsiz-1; x>=0; x--) { if (letptr[y]&pow2char[7-fontsize-x]) ptr[x] = (uint8_t)col; diff --git a/polymer/eduke32/build/src/glbuild.c b/polymer/eduke32/build/src/glbuild.c index 8fae537e3..59524451c 100644 --- a/polymer/eduke32/build/src/glbuild.c +++ b/polymer/eduke32/build/src/glbuild.c @@ -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); diff --git a/polymer/eduke32/build/src/hightile.c b/polymer/eduke32/build/src/hightile.c index 5c5fa7be6..4dbcb4606 100644 --- a/polymer/eduke32/build/src/hightile.c +++ b/polymer/eduke32/build/src/hightile.c @@ -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=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); diff --git a/polymer/eduke32/build/src/kplib.c b/polymer/eduke32/build/src/kplib.c index 463a201df..b3f735da8 100644 --- a/polymer/eduke32/build/src/kplib.c +++ b/polymer/eduke32/build/src/kplib.c @@ -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<=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;ixr1;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<= 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<= 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<=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=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>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>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>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>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;c0;j--) + for (c=0; c0; 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>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>(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= kfilength) goto kpegrend_break2; //rest of file is missing! if (!dctbuf) dc = dct[0]; - for (c=0;c 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>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= 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=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>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= (uint32_t)dayres) continue; lptr = (int32_t *)(y*dabytesperline-(daglobyoffs<<2)+daframeplace); switch (cdim) { case 1: - for (x=x0;x>3]>>((x&7)^7))&1)]; break; + for (x=x0; x>3]>>((x&7)^7))&1)]; break; case 4: - for (x=x0;x>1]>>(((x&1)^1)<<2))&15)]; break; + for (x=x0; x>1]>>(((x&1)^1)<<2))&15)]; break; case 8: - for (x=x0;x= (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>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= 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=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; diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index 495f8b7a4..e4beb7432 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -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;imdnum == 3) - { - md3model_t *m = (md3model_t *)models[i]; - if (m->vbos) + for (i=0; imdnum == 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;imdnum == 1) { voxmodel_t *v = (voxmodel_t*)m; - for (j=0;jtexid[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;jnumskins*(HICEFFECTMASK+1);j++) + for (j=0; jnumskins*(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;itexid[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;inumframes;i++) + for (i=0; inumframes; 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;inumframes;i++) + for (i=0; inumframes; 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;iskinmap; @@ -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=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;iskinmap; 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;surfihead.numsurfs;surfi++) + for (surfi=0; surfihead.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;surfihead.numsurfs;surfi++) + for (surfi=0; surfihead.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;surfihead.numsurfs;surfi++) + for (surfi=0; surfihead.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<>5); ze = (z1>>5); - lptr[z] &=~(-1<>5] |= ((~(-1<>5); ze = (z1>>5); - lptr[z] |= (-1<mytexx + x0; - for (dy=0;dy;dy--,i+=gvox->mytexx) - for (x=0;x>5]&(1<mytexx) + for (x=0; x>5]&(1<>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;xmytexx + x0; - for (y=0;ymytexx) - for (x=0;x>5] |= (1<mytexx) + for (x=0; x>5] |= (1<>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;xmytexx) - for (xx=0;xxmytexx) + for (xx=0; xxmytex[(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;yymytex[(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<qfacind[i] = -1; + if (pow2m1[32] != -1) { for (i=0; i<32; i++) pow2m1[i] = (1<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= 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= 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= 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=y;x--) + for (y=gmaxy; y; y--) + for (x=gmaxx; x>=y; x--) { i = shcnt[y*shcntp+x]; - for (;j=0;z--) + for (z=zsiz-1; z>=0; z--) { if (tbuf[z] != 255) { i = j+z; vbit[i>>5] |= (1<=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;x0;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;ytexid[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;iqcnt;i++) + for (i=0,fi=0; iqcnt; 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], diff --git a/polymer/eduke32/build/src/mmulti.c b/polymer/eduke32/build/src/mmulti.c index b07ca37d1..d2614b4a9 100644 --- a/polymer/eduke32/build/src/mmulti.c +++ b/polymer/eduke32/build/src/mmulti.c @@ -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= '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>8)&255,(otherip[i]>>16)&255,((uint32_t)otherip[i])>>24,ntohs(otherport[i])); connecthead = 0; - for (i=0;i= 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 "); 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>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 (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>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; diff --git a/polymer/eduke32/build/src/mmulti_unstable.c b/polymer/eduke32/build/src/mmulti_unstable.c index ffb7cafbf..93bc86011 100644 --- a/polymer/eduke32/build/src/mmulti_unstable.c +++ b/polymer/eduke32/build/src/mmulti_unstable.c @@ -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;ibuffer[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;ibuffer[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;ibuffer[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;inumbytes;i++) initprintf("%2x ",gcom->buffer[i]); + for (i=0; inumbytes; 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=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;inumbytes;i++) initprintf("%2x ",gcom->buffer[i]); + for (i=0; inumbytes; 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;inumplayers++; 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 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); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 82acfdf94..aef374cc8 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -197,7 +197,7 @@ int32_t r_downsize = 1; static float fogresult, fogcol[4], fogtable[4*MAXPALOOKUPS]; -static inline void fogcalc(const int32_t shade, const int32_t vis, const int32_t pal) +static inline void fogcalc(const int32_t shade, const int32_t vis, const int32_t pal) { float f; @@ -258,7 +258,7 @@ static inline void ftol(float f, int32_t *a) #if 0 //(__GNUC__ >= 3) "flds %1; fistpl %0;" #else - "flds %1; fistpl (%0);" +"flds %1; fistpl (%0);" #endif : "=r"(a) : "m"(f) : "memory","cc"); } @@ -269,7 +269,7 @@ static inline void dtol(double d, int32_t *a) #if 0 //(__GNUC__ >= 3) "fldl %1; fistpl %0;" #else - "fldl %1; fistpl (%0);" +"fldl %1; fistpl (%0);" #endif : "=r"(a) : "m"(d) : "memory","cc"); } @@ -317,7 +317,7 @@ void drawline2d(float x0, float y0, float x1, float y1, char col) x = (int32_t)(x0+.5); if (x < 0) { y -= inc*x; x = 0; } //if for safety e = (int32_t)(x1+.5); if (e > xdimen) e = xdimen; //if for safety up16 = (ydimen<<16); - for (;x>16]+x+frameoffset) = col; + for (; x>16]+x+frameoffset) = col; } else { @@ -327,7 +327,7 @@ void drawline2d(float x0, float y0, float x1, float y1, char col) y = (int32_t)(y0+.5); if (y < 0) { x -= inc*y; y = 0; } //if for safety e = (int32_t)(y1+.5); if (e > ydimen) e = ydimen; //if for safety up16 = (xdimen<<16); - for (;y>16)+frameoffset) = col; + for (; y>16)+frameoffset) = col; } } @@ -540,8 +540,8 @@ void gltexinvalidateall() int32_t j; pthtyp *pth; - for (j=GLTEXCACHEADSIZ-1;j>=0;j--) - for (pth=gltexcachead[j];pth;pth=pth->next) + for (j=GLTEXCACHEADSIZ-1; j>=0; j--) + for (pth=gltexcachead[j]; pth; pth=pth->next) { pth->flags |= 128; if (pth->flags & 16) @@ -558,8 +558,8 @@ void gltexinvalidate8() int32_t j; pthtyp *pth; - for (j=GLTEXCACHEADSIZ-1;j>=0;j--) - for (pth=gltexcachead[j];pth;pth=pth->next) + for (j=GLTEXCACHEADSIZ-1; j>=0; j--) + for (pth=gltexcachead[j]; pth; pth=pth->next) { if (pth->hicr == NULL) { @@ -585,9 +585,9 @@ void gltexapplyprops(void) if (gltexfiltermode < 0) gltexfiltermode = 0; else if (gltexfiltermode >= (int32_t)numglfiltermodes) gltexfiltermode = numglfiltermodes-1; - for (i=GLTEXCACHEADSIZ-1;i>=0;i--) + for (i=GLTEXCACHEADSIZ-1; i>=0; i--) { - for (pth=gltexcachead[i];pth;pth=pth->next) + for (pth=gltexcachead[i]; pth; pth=pth->next) { bglBindTexture(GL_TEXTURE_2D,pth->glpic); bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); @@ -610,11 +610,11 @@ void gltexapplyprops(void) mdskinmap_t *sk; md2model_t *m; - for (i=0;imdnum < 2) continue; - for (j=0;jnumskins*(HICEFFECTMASK+1);j++) + for (j=0; jnumskins*(HICEFFECTMASK+1); j++) { if (!m->texid[j]) continue; bglBindTexture(GL_TEXTURE_2D,m->texid[j]); @@ -624,8 +624,8 @@ void gltexapplyprops(void) bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); } - for (sk=m->skinmap;sk;sk=sk->next) - for (j=0;j<(HICEFFECTMASK+1);j++) + for (sk=m->skinmap; sk; sk=sk->next) + for (j=0; j<(HICEFFECTMASK+1); j++) { if (!sk->texid[j]) continue; bglBindTexture(GL_TEXTURE_2D,sk->texid[j]); @@ -650,7 +650,7 @@ void polymost_glreset() int32_t i; pthtyp *pth, *next; - for(i=MAXPALOOKUPS-1;i>=0;i--) + for (i=MAXPALOOKUPS-1; i>=0; i--) { fogtable[i<<2] = palookupfog[i].r / 63.f; fogtable[(i<<2)+1] = palookupfog[i].g / 63.f; @@ -683,7 +683,7 @@ void polymost_glreset() if (pth->palmap) { //_initprintf("Kill #%d\n",pth->palmap); - free(pth->palmap);pth->palmap=0; + free(pth->palmap); pth->palmap=0; } free(pth); pth = next; @@ -700,19 +700,19 @@ void polymost_glreset() glox1 = -1; // Depth peeling cleanup -/* - if (peels) - { - bglDeleteProgramsARB(2, peelprogram); - bglDeleteFramebuffersEXT(r_peelscount + 1, peelfbos); - bglDeleteTextures(r_peelscount + 1, peels); - bglDeleteTextures(3, ztexture); - free(peels); - free(peelfbos); + /* + if (peels) + { + bglDeleteProgramsARB(2, peelprogram); + bglDeleteFramebuffersEXT(r_peelscount + 1, peelfbos); + bglDeleteTextures(r_peelscount + 1, peels); + bglDeleteTextures(3, ztexture); + free(peels); + free(peelfbos); - peels = NULL; - } -*/ + peels = NULL; + } + */ if (cachefilehandle != -1) { @@ -745,35 +745,35 @@ void polymost_glinit() { GLfloat col[4]; int32_t i; -/* - char notpeeledprogramstring[] = - "!!ARBfp1.0\n" - "OPTION ARB_fog_exp2;\n" - "OPTION ARB_fragment_program_shadow;\n" - "TEMP texsample;\n" - "TEMP depthresult;\n" - "TEX depthresult, fragment.position, texture[1], SHADOWRECT;\n" - "ADD depthresult.a, depthresult.a, -0.5;\n" - "KIL depthresult.a;\n" - "TEX texsample, fragment.texcoord[0], texture[0], 2D;\n" - "MUL result.color, fragment.color, texsample;\n" - "END\n"; - char peeledprogramstring[] = - "!!ARBfp1.0\n" - "OPTION ARB_fog_exp2;\n" - "OPTION ARB_fragment_program_shadow;\n" - "TEMP texsample;\n" - "TEMP depthresult;\n" - "TEX depthresult, fragment.position, texture[2], SHADOWRECT;\n" - "ADD depthresult.a, depthresult.a, -0.5;\n" - "KIL depthresult.a;\n" - "TEX depthresult, fragment.position, texture[1], SHADOWRECT;\n" - "ADD depthresult.a, depthresult.a, -0.5;\n" - "KIL depthresult.a;\n" - "TEX texsample, fragment.texcoord[0], texture[0], 2D;\n" - "MUL result.color, fragment.color, texsample;\n" - "END\n"; -*/ + /* + char notpeeledprogramstring[] = + "!!ARBfp1.0\n" + "OPTION ARB_fog_exp2;\n" + "OPTION ARB_fragment_program_shadow;\n" + "TEMP texsample;\n" + "TEMP depthresult;\n" + "TEX depthresult, fragment.position, texture[1], SHADOWRECT;\n" + "ADD depthresult.a, depthresult.a, -0.5;\n" + "KIL depthresult.a;\n" + "TEX texsample, fragment.texcoord[0], texture[0], 2D;\n" + "MUL result.color, fragment.color, texsample;\n" + "END\n"; + char peeledprogramstring[] = + "!!ARBfp1.0\n" + "OPTION ARB_fog_exp2;\n" + "OPTION ARB_fragment_program_shadow;\n" + "TEMP texsample;\n" + "TEMP depthresult;\n" + "TEX depthresult, fragment.position, texture[2], SHADOWRECT;\n" + "ADD depthresult.a, depthresult.a, -0.5;\n" + "KIL depthresult.a;\n" + "TEX depthresult, fragment.position, texture[1], SHADOWRECT;\n" + "ADD depthresult.a, depthresult.a, -0.5;\n" + "KIL depthresult.a;\n" + "TEX texsample, fragment.texcoord[0], texture[0], 2D;\n" + "MUL result.color, fragment.color, texsample;\n" + "END\n"; + */ if (!Bstrcmp(glinfo.vendor, "NVIDIA Corporation")) { @@ -803,13 +803,13 @@ void polymost_glinit() bglEnable(GL_MULTISAMPLE_ARB); } -/* - if (r_depthpeeling && (!glinfo.arbfp || !glinfo.depthtex || !glinfo.shadow || !glinfo.fbos || !glinfo.rect || !glinfo.multitex)) - { - OSD_Printf("Your OpenGL implementation doesn't support depth peeling. Disabling...\n"); - r_depthpeeling = 0; - } -*/ + /* + if (r_depthpeeling && (!glinfo.arbfp || !glinfo.depthtex || !glinfo.shadow || !glinfo.fbos || !glinfo.rect || !glinfo.multitex)) + { + OSD_Printf("Your OpenGL implementation doesn't support depth peeling. Disabling...\n"); + r_depthpeeling = 0; + } + */ if (r_detailmapping && (!glinfo.multitex || !glinfo.envcombine)) { @@ -830,78 +830,78 @@ void polymost_glinit() } //depth peeling initialization -/* - if (r_depthpeeling) - { - if (newpeelscount) + /* + if (r_depthpeeling) { - r_peelscount = newpeelscount; - newpeelscount = 0; - } - // create the secondary Z-buffers and the Z-backbuffer - bglGenTextures(3, ztexture); - - i = 0; - while (i < 3) - { - bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[i]); - bglCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_DEPTH_COMPONENT, 0, 0, xdim, ydim, 0); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); - if (i < 2) - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_FUNC_ARB, GL_GREATER); - else - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LESS); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA); - - i++; - } - - // create the various peeling layers as well as the FBOs to render to them - peels = malloc((r_peelscount + 1) * sizeof(GLuint)); - bglGenTextures(r_peelscount + 1, peels); - - peelfbos = malloc((r_peelscount + 1) * sizeof(GLuint)); - bglGenFramebuffersEXT(r_peelscount + 1, peelfbos); - - i = 0; - while (i <= r_peelscount) - { - bglBindTexture(GL_TEXTURE_RECTANGLE, peels[i]); - bglCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, xdim, ydim, 0); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP); - bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP); - - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[i]); - bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE, peels[i], 0); - if (i == r_peelscount) // bakcbuffer - bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_RECTANGLE, ztexture[2], 0); - else if (i < (r_peelscount - 1)) - bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_RECTANGLE, ztexture[i % 2], 0); - - if (bglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) + if (newpeelscount) { - OSD_Printf("FBO #%d initialization failed.\n", i); + r_peelscount = newpeelscount; + newpeelscount = 0; + } + // create the secondary Z-buffers and the Z-backbuffer + bglGenTextures(3, ztexture); + + i = 0; + while (i < 3) + { + bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[i]); + bglCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_DEPTH_COMPONENT, 0, 0, xdim, ydim, 0); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); + if (i < 2) + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_FUNC_ARB, GL_GREATER); + else + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LESS); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA); + + i++; } - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + // create the various peeling layers as well as the FBOs to render to them + peels = malloc((r_peelscount + 1) * sizeof(GLuint)); + bglGenTextures(r_peelscount + 1, peels); - i++; + peelfbos = malloc((r_peelscount + 1) * sizeof(GLuint)); + bglGenFramebuffersEXT(r_peelscount + 1, peelfbos); + + i = 0; + while (i <= r_peelscount) + { + bglBindTexture(GL_TEXTURE_RECTANGLE, peels[i]); + bglCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, xdim, ydim, 0); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP); + bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP); + + bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[i]); + bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE, peels[i], 0); + if (i == r_peelscount) // bakcbuffer + bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_RECTANGLE, ztexture[2], 0); + else if (i < (r_peelscount - 1)) + bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_RECTANGLE, ztexture[i % 2], 0); + + if (bglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) + { + OSD_Printf("FBO #%d initialization failed.\n", i); + } + + bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + + i++; + } + + // create the peeling fragment programs + bglGenProgramsARB(2, peelprogram); + bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[0]); + bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(notpeeledprogramstring), notpeeledprogramstring); + bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[1]); + bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(peeledprogramstring), peeledprogramstring); } - - // create the peeling fragment programs - bglGenProgramsARB(2, peelprogram); - bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[0]); - bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(notpeeledprogramstring), notpeeledprogramstring); - bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[1]); - bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(peeledprogramstring), peeledprogramstring); - } -*/ + */ bglEnableClientState(GL_VERTEX_ARRAY); bglEnableClientState(GL_TEXTURE_COORD_ARRAY); @@ -942,7 +942,7 @@ void polymost_glinit() Bfprintf(cacheindexptr,"// automatically generated by EDuke32, DO NOT MODIFY!\n"); } else rewind(cacheindexptr); - + cachefilehandle = Bopen(TEXCACHEFILE,BO_BINARY|BO_CREAT|BO_APPEND|BO_RDWR,BS_IREAD|BS_IWRITE); if (cachefilehandle < 0) @@ -1120,10 +1120,10 @@ void fixtransparency(coltype *dapic, int32_t daxsiz, int32_t daysiz, int32_t dax //Set transparent pixels to average color of neighboring opaque pixels //Doing this makes bilinear filtering look much better for masked textures (I.E. sprites) - for (y=doy;y>=0;y--) + for (y=doy; y>=0; y--) { wpptr = &dapic[y*daxsiz2+dox]; - for (x=dox;x>=0;x--,wpptr--) + for (x=dox; x>=0; x--,wpptr--) { if (wpptr->a) continue; r = g = b = j = 0; @@ -1199,14 +1199,14 @@ void uploadtexture(int32_t doalloc, int32_t xsiz, int32_t ysiz, int32_t intexfmt gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA8,xsiz,ysiz,texfmt,GL_UNSIGNED_BYTE,pic); //Needs C++ to link? #elif 1 x2 = xsiz; y2 = ysiz; - for (j=1;(x2 > 1) || (y2 > 1);j++) + for (j=1; (x2 > 1) || (y2 > 1); j++) { //x3 = ((x2+1)>>1); y3 = ((y2+1)>>1); x3 = max(1, x2 >> 1); y3 = max(1, y2 >> 1); // this came from the GL_ARB_texture_non_power_of_two spec - for (y=0;y= tsizx) || (y >= tsizy))) //Clamp texture { wpptr->r = wpptr->g = wpptr->b = wpptr->a = 0; continue; } @@ -1528,37 +1528,37 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea glusetexcache = 0; return; } -/* - { - struct stat st; - if (stat(TEXCACHEFILE, &st) < 0) + /* { - if (errno == ENOENT) // path doesn't exist + struct stat st; + if (stat(TEXCACHEFILE, &st) < 0) { - // try to create the cache directory - if (Bmkdir(TEXCACHEFILE, S_IRWXU) < 0) + if (errno == ENOENT) // path doesn't exist { - OSD_Printf("Failed to create texture cache directory %s\n", TEXCACHEFILE); + // try to create the cache directory + if (Bmkdir(TEXCACHEFILE, S_IRWXU) < 0) + { + OSD_Printf("Failed to create texture cache directory %s\n", TEXCACHEFILE); + glusetexcache = 0; + return; + } + else OSD_Printf("Created texture cache directory %s\n", TEXCACHEFILE); + } + else + { + // another type of failure glusetexcache = 0; return; } - else OSD_Printf("Created texture cache directory %s\n", TEXCACHEFILE); } - else + else if ((st.st_mode & S_IFDIR) != S_IFDIR) { - // another type of failure + // cache directory isn't a directory glusetexcache = 0; return; } } - else if ((st.st_mode & S_IFDIR) != S_IFDIR) - { - // cache directory isn't a directory - glusetexcache = 0; - return; - } - } -*/ + */ gi = GL_FALSE; bglGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, (GLint *)&gi); if (gi != GL_TRUE) return; @@ -1764,7 +1764,7 @@ static void applypalmapsT(char *pic, int32_t sizx, int32_t sizy, int32_t dapic,i int32_t stage; pthtyp *pichead1=pichead; - for (stage=0;stage tsizx) //Copy left to right { int32_t *lptr = (int32_t *)pic; - for (y=0;y tsizy) //Copy top to bottom @@ -1917,7 +1917,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp } 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); } @@ -1999,7 +1999,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp cachead.xdim = tsizx>>cachead.quality; cachead.ydim = tsizy>>cachead.quality; x = 0; - for (j=0;j<31;j++) + for (j=0; j<31; j++) { if (xsiz == pow2long[j]) { x |= 1; } if (ysiz == pow2long[j]) { x |= 2; } @@ -2045,7 +2045,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) else { f = 0; //f is area of polygon / 2 - for (i=n-2,j=n-1,k=0;k=0;i--) + for (i=n-1; i>=0; i--) { dd[i] = px[i]*gdx + py[i]*gdy + gdo; uu[i] = px[i]*gux + py[i]*guy + guo; @@ -2355,7 +2355,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) nguo -= ngdo*uoffs; //Find min&max u coordinates (du0...du1) - for (i=0;i GL_TEXTURE0_ARB) @@ -2559,8 +2559,8 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) tsizxm1 = tsizx-1; xmodnice = (!(tsizxm1&tsizx)); tsizym1 = tsizy-1; ymulnice = (!(tsizym1&tsizy)); if ((method&4) && (!xmodnice)) //Sprites don't need a mod on texture coordinates - { xmodnice = 1; for (tsizxm1=1;tsizxm1>4); } else @@ -2570,7 +2570,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) if (grhalfxdown10x < 0) //Hack for mirrors { - for (i=((n-1)>>1);i>=0;i--) + for (i=((n-1)>>1); i>=0; i--) { r = px[i]; px[i] = ((double)xdimen)-px[n-1-i]; px[n-1-i] = ((double)xdimen)-r; r = py[i]; py[i] = py[n-1-i]; py[n-1-i] = r; @@ -2585,7 +2585,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) ngvx2 = ngvx*(1<= py[1]); maxi = 1-mini; - for (z=2;z py[maxi]) maxi = z; @@ -2600,7 +2600,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) { f = (px[j]-px[i])/(py[j]-py[i]); dtol(f*16384.0,&xi); dtol((((double)yy-.5-py[j])*f + px[j])*16384.0+8192.0,&x); - for (;yy>y;yy--,x-=xi) lastx[yy-1] = (x>>14); + for (; yy>y; yy--,x-=xi) lastx[yy-1] = (x>>14); } i = j; } @@ -2613,7 +2613,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) { f = (px[j]-px[i])/(py[j]-py[i]); dtol(f*16384.0,&xi); dtol((((double)y+.5-py[j])*f + px[j])*16384.0+8192.0,&x); - for (;y>14); if (ix1 > xdimen) ix1 = xdimen; @@ -2638,7 +2638,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) case 0: if (xmodnice&ymulnice) //both u&v texture sizes are powers of 2 :) { - for (xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -2660,7 +2660,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) } else { - for (xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -2684,7 +2684,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) case 1: if (xmodnice) //both u&v texture sizes are powers of 2 :) { - for (xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -2712,7 +2712,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) } else { - for (xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -2740,7 +2740,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) } break; case 2: //Transluscence #1 - for (xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -2769,7 +2769,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) } break; case 3: //Transluscence #2 - for (xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -2810,7 +2810,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) { if (method&3) //Only draw border around sprites/maskwalls { - for (i=0,j=n-1;i=2;i--) if (px[i] < px[imin]) imin = i; + for (i=n-1; i>=2; i--) if (px[i] < px[imin]) imin = i; vsp[vcnt].x = px[imin]; @@ -2890,7 +2890,7 @@ void initmosts(double *px, double *py, int32_t n) } - for (i=0;i= 0)) return(1); @@ -2973,7 +2973,7 @@ void domost(float x0, float y0, float x1, float y1) } slop = (y1-y0)/(x1-x0); - for (i=vsp[0].n;i;i=newi) + for (i=vsp[0].n; i; i=newi) { newi = vsp[i].n; nx0 = vsp[i].x; nx1 = vsp[newi].x; if ((x0 >= nx1) || (nx0 >= x1) || (vsp[i].ctag <= 0)) continue; @@ -2992,7 +2992,7 @@ void domost(float x0, float y0, float x1, float y1) } //Test for intersection on umost (j == 0) and dmost (j == 1) - for (j=0;j<2;j++) + for (j=0; j<2; j++) { d = (y0-y1)*dx - (x0-x1)*cv[j]; n = (y0-cy[j])*dx - (x0-nx0)*cv[j]; @@ -3024,7 +3024,7 @@ void domost(float x0, float y0, float x1, float y1) } vsp[i].tag = vsp[newi].tag = -1; - for (z=0;z<=scnt;z++,i=vcnt) + for (z=0; z<=scnt; z++,i=vcnt) { if (z < scnt) { @@ -3183,7 +3183,7 @@ static void polymost_drawalls(int32_t bunch) #endif //DRAW WALLS SECTION! - for (z=bunchfirst[bunch];z>=0;z=p2[z]) + for (z=bunchfirst[bunch]; z>=0; z=p2[z]) { wallnum = thewall[z]; wal = &wall[wallnum]; wal2 = &wall[wal->point2]; nextsectnum = wal->nextsector; nextsec = §or[nextsectnum]; @@ -3301,7 +3301,7 @@ static void polymost_drawalls(int32_t bunch) px[2] = ghalfx*ox2*oy2 + ghalfx; oy2 *= gyxscale; py[2] = oy2 + ghoriz; - for (i=0;i<3;i++) + for (i=0; i<3; i++) { dd[i] = px[i]*gdx + py[i]*gdy + gdo; uu[i] = px[i]*gux + py[i]*guy + guo; @@ -3367,7 +3367,7 @@ static void polymost_drawalls(int32_t bunch) } //Use clamping for tiled sky textures - for (i=(1<0;i--) + for (i=(1<0; i--) if (pskyoff[i] != pskyoff[i-1]) { skyclamphack = r_parallaxskyclamping; break; } } @@ -3436,7 +3436,7 @@ static void polymost_drawalls(int32_t bunch) pow2xsplit = 0; skyclamphack = 1; - for (i=0;i<4;i++) + for (i=0; i<4; i++) { x = skywalx[i&3]; y = skywaly[i&3]; _xp0 = (double)y*gcosang - (double)x*gsinang; @@ -3676,7 +3676,7 @@ static void polymost_drawalls(int32_t bunch) px[2] = ghalfx*ox2*oy2 + ghalfx; oy2 *= gyxscale; py[2] = oy2 + ghoriz; - for (i=0;i<3;i++) + for (i=0; i<3; i++) { dd[i] = px[i]*gdx + py[i]*gdy + gdo; uu[i] = px[i]*gux + py[i]*guy + guo; @@ -3740,7 +3740,7 @@ static void polymost_drawalls(int32_t bunch) bglFogfv(GL_FOG_COLOR,fogcol); } //Use clamping for tiled sky textures - for (i=(1<0;i--) + for (i=(1<0; i--) if (pskyoff[i] != pskyoff[i-1]) { skyclamphack = r_parallaxskyclamping; break; } } @@ -3807,7 +3807,7 @@ static void polymost_drawalls(int32_t bunch) pow2xsplit = 0; skyclamphack = 1; - for (i=0;i<4;i++) + for (i=0; i<4; i++) { x = skywalx[i&3]; y = skywaly[i&3]; _xp0 = (double)y*gcosang - (double)x*gsinang; @@ -4208,10 +4208,10 @@ static int32_t polymost_bunchfront(int32_t b1, int32_t b2) if (x1b1 >= x1b2) { - for (i=b2f;dxb2[i]<=x1b1;i=p2[i]); + for (i=b2f; dxb2[i]<=x1b1; i=p2[i]); return(wallfront(b1f,i)); } - for (i=b1f;dxb2[i]<=x1b2;i=p2[i]); + for (i=b1f; dxb2[i]<=x1b2; i=p2[i]); return(wallfront(i,b2f)); } @@ -4231,7 +4231,7 @@ static void polymost_scansector(int32_t sectnum) { sectnum = sectorborder[--sectorbordercnt]; - for (z=headspritesect[sectnum];z>=0;z=nextspritesect[z]) + for (z=headspritesect[sectnum]; z>=0; z=nextspritesect[z]) { spr = &sprite[z]; if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) && @@ -4256,7 +4256,7 @@ static void polymost_scansector(int32_t sectnum) startwall = sector[sectnum].wallptr; endwall = sector[sectnum].wallnum+startwall; scanfirst = numscans; xp2 = 0; yp2 = 0; - for (z=startwall,wal=&wall[z];zpoint2]; x1 = wal->x-globalposx; y1 = wal->y-globalposy; @@ -4297,13 +4297,13 @@ static void polymost_scansector(int32_t sectnum) { p2[numscans-1] = scanfirst; scanfirst = numscans; } } - for (z=numscansbefore;z dxb1[p2[z]])) { bunchfirst[numbunches++] = p2[z]; p2[z] = -1; } - for (z=bunchfrst;z=0;zz=p2[zz]); + for (zz=bunchfirst[z]; p2[zz]>=0; zz=p2[zz]); bunchlast[z] = zz; } } @@ -4355,15 +4355,15 @@ void polymost_drawrooms() globalposy += cosglobalang/1024; } } -/* - if (r_depthpeeling) - { - bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[r_peelscount]); - bglPushAttrib(GL_VIEWPORT_BIT); - bglViewport(0, 0, xdim, ydim); - //bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - } -*/ + /* + if (r_depthpeeling) + { + bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[r_peelscount]); + bglPushAttrib(GL_VIEWPORT_BIT); + bglViewport(0, 0, xdim, ydim); + //bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); + } + */ } #endif @@ -4399,7 +4399,7 @@ void polymost_drawrooms() //Generate viewport trapezoid (for handling screen up/down) px[0] = px[3] = 0-1; px[1] = px[2] = windowx2+1-windowx1+2; py[0] = py[1] = 0-1; py[2] = py[3] = windowy2+1-windowy1+2; n = 4; - for (i=0;i= n) j = 0; if (pz[i] >= SCISDIST) { px2[n2] = px[i]; py2[n2] = py[i]; pz2[n2] = pz[i]; n2++; } @@ -4429,7 +4429,7 @@ void polymost_drawrooms() } } if (n2 < 3) { enddrawing(); return; } - for (i=0;ifz) searchstat = 2;else - if (hitinfo.hitwall >= 0) + if (hitinfo.pos.zfz) searchstat = 2; else if (hitinfo.hitwall >= 0) { searchwall = hitinfo.hitwall; searchstat = 0; if (wall[hitinfo.hitwall].nextwall >= 0) @@ -4547,13 +4545,13 @@ void polymost_drawrooms() memset(ptempbuf,0,numbunches+3); ptempbuf[0] = 1; closest = 0; //Almost works, but not quite :( - for (i=1;ipal); globalorientation = (int32_t)wal->cstat; -/* -#ifdef USE_OPENGL - if (r_depthpeeling) - { - if ((((wal->cstat&128) || (gltexmayhavealpha(globalpicnum,globalpal)))) && !peelcompiling) - return; // discard translucent sprite if drawing the backbuffer when doing depth peeling - if (!(((wal->cstat&128) || (gltexmayhavealpha(globalpicnum,globalpal)))) && peelcompiling) - return; // discard opaque sprite when composing the depth peels - } -#endif -*/ + /* + #ifdef USE_OPENGL + if (r_depthpeeling) + { + if ((((wal->cstat&128) || (gltexmayhavealpha(globalpicnum,globalpal)))) && !peelcompiling) + return; // discard translucent sprite if drawing the backbuffer when doing depth peeling + if (!(((wal->cstat&128) || (gltexmayhavealpha(globalpicnum,globalpal)))) && peelcompiling) + return; // discard opaque sprite when composing the depth peels + } + #endif + */ sx0 = (float)(wal->x-globalposx); sx1 = (float)(wal2->x-globalposx); sy0 = (float)(wal->y-globalposy); sy1 = (float)(wal2->y-globalposy); @@ -4695,7 +4693,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) } #endif - for (i=0;i<2;i++) + for (i=0; i<2; i++) { csy[i] = ((float)(cz[i]-globalposz))*ryp0 + ghoriz; fsy[i] = ((float)(fz[i]-globalposz))*ryp0 + ghoriz; @@ -4725,7 +4723,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) //Clip to (x0,csy[0])-(x1,csy[2]) n2 = 0; t1 = -((dpx[0]-x0)*(csy[2]-csy[0]) - (dpy[0]-csy[0])*(x1-x0)); - for (i=0;i= n) j = 0; @@ -4743,7 +4741,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) //Clip to (x1,fsy[2])-(x0,fsy[0]) n = 0; t1 = -((dpx2[0]-x1)*(fsy[0]-fsy[2]) - (dpy2[0]-fsy[2])*(x0-x1)); - for (i=0;i= n2) j = 0; @@ -4767,13 +4765,13 @@ char cullmodel[MAXSPRITES]; int32_t cullcheckcnt = 0; #ifndef _MSC_VER - #ifdef __GNUC__ - #ifndef __fastcall - #define __fastcall __attribute__((fastcall)) - #endif - #else - #define __fastcall - #endif +#ifdef __GNUC__ +#ifndef __fastcall +#define __fastcall __attribute__((fastcall)) +#endif +#else +#define __fastcall +#endif #endif int32_t __fastcall polymost_checkcoordinates(int32_t x, int32_t y, spritetype *tspr) @@ -4808,7 +4806,7 @@ RECHECK: cullcheckcnt++; if (cansee(globalposx, globalposy, globalposz, globalcursectnum, - tspr->x+x, tspr->y+y, tspr->z-512, datempsectnum)) + tspr->x+x, tspr->y+y, tspr->z-512, datempsectnum)) return 1; if (x != y && x == oldx) @@ -4854,15 +4852,15 @@ void polymost_drawsprite(int32_t snum) if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } #ifdef USE_OPENGL -/* - if (r_depthpeeling) - { - if ((((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && !peelcompiling) - return; // discard translucent sprite if drawing the backbuffer when doing depth peeling - if (!(((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && peelcompiling) - return; // discard opaque sprite when composing the depth peels - } -*/ + /* + if (r_depthpeeling) + { + if ((((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && !peelcompiling) + return; // discard translucent sprite if drawing the backbuffer when doing depth peeling + if (!(((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && peelcompiling) + return; // discard opaque sprite when composing the depth peels + } + */ if (!nofog && rendmode >= 3) { @@ -5193,7 +5191,7 @@ void polymost_drawsprite(int32_t snum) y1 = ((tsizy>>1)+yoff)*tspr->yrepeat; //Project 3D to 2D - for (j=0;j<4;j++) + for (j=0; j<4; j++) { sx0 = (float)(tspr->x-globalposx); sy0 = (float)(tspr->y-globalposy); @@ -5215,7 +5213,7 @@ void polymost_drawsprite(int32_t snum) //Clip to SCISDIST plane npoints = 0; - for (i=0;i<4;i++) + for (i=0; i<4; i++) { j = ((i+1)&3); if (py[i] >= SCISDIST) { px2[npoints] = px[i]; py2[npoints] = py[i]; npoints++; } @@ -5230,7 +5228,7 @@ void polymost_drawsprite(int32_t snum) //Project rotated 3D points to screen f = ((float)(tspr->z-globalposz))*gyxscale; - for (j=0;j>1);gap;gap>>=1) - for (i=0;i=0;j-=gap) + for (gap=(npoints>>1); gap; gap>>=1) + for (i=0; i=0; j-=gap) { if (py[npoint2[slist[j]]] <= py[npoint2[slist[j+gap]]]) break; k = slist[j]; slist[j] = slist[j+gap]; slist[j+gap] = k; } numrst = 0; - for (z=0;z0;i--) + for (i=numrst; i>0; i--) { if (rst[i-1].xi*(py[i1]-rst[i-1].y) + rst[i-1].x < px[i1]) break; rst[i+1] = rst[i-1]; @@ -5751,13 +5749,13 @@ static void tessectrap(float *px, float *py, int32_t *point2, int32_t numpoints) else { //NOTE:don't count backwards! - if (i1 == i2) { for (i=0;i py[i0]) && (py[i2] > py[i3])) //Delete raster { - for (;j<=i+1;j+=2) + for (; j<=i+1; j+=2) { x0 = (py[i1] - rst[j ].y)*rst[j ].xi + rst[j ].x; if ((i == j) && (i1 == i2)) x1 = x0; else x1 = (py[i1] - rst[j+1].y)*rst[j+1].xi + rst[j+1].x; @@ -5765,7 +5763,7 @@ static void tessectrap(float *px, float *py, int32_t *point2, int32_t numpoints) rst[j ].x = x0; rst[j ].y = py[i1]; rst[j+1].x = x1; rst[j+1].y = py[i1]; } - numrst -= 2; for (;i=0;i--) + for (i=npoints-1; i>=0; i--) { ((float *)rx1)[i] = ((float)rx1[i])/4096.0; ((float *)ry1)[i] = ((float)ry1[i])/4096.0; @@ -5955,12 +5953,12 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba Bmemset(tbuf, 0, 256*128); cptr = (char*)textfont; - for (h=0;h<256;h++) + for (h=0; h<256; h++) { tptr = tbuf + (h%32)*8 + (h/32)*256*8; - for (i=0;i<8;i++) + for (i=0; i<8; i++) { - for (j=0;j<8;j++) + for (j=0; j<8; j++) { if (cptr[h*8+i] & pow2char[7-j]) tptr[j] = 255; } @@ -5969,12 +5967,12 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba } cptr = (char*)smalltextfont; - for (h=0;h<256;h++) + for (h=0; h<256; h++) { tptr = tbuf + 256*64 + (h%32)*8 + (h/32)*256*8; - for (i=1;i<7;i++) + for (i=1; i<7; i++) { - for (j=2;j<6;j++) + for (j=2; j<6; j++) { if (cptr[h*8+i] & pow2char[7-j]) tptr[j-2] = 255; } @@ -6172,46 +6170,46 @@ static int32_t osdcmd_polymostvars(const osdfuncparm_t *parm) else gltexmiplevel = val; return OSDCMD_OK; } -/* - else if (!Bstrcasecmp(parm->name, "r_depthpeeling")) - { - if (showval) { OSD_Printf("r_depthpeeling is %d\n", r_depthpeeling); } - else + /* + else if (!Bstrcasecmp(parm->name, "r_depthpeeling")) { - if (!glinfo.arbfp || !glinfo.depthtex || !glinfo.shadow || !glinfo.fbos || !glinfo.rect) + if (showval) { OSD_Printf("r_depthpeeling is %d\n", r_depthpeeling); } + else { - OSD_Printf("r_depthpeeling: Your OpenGL implementation doesn't support depth peeling.\n"); - r_depthpeeling = 0; - return OSDCMD_OK; + if (!glinfo.arbfp || !glinfo.depthtex || !glinfo.shadow || !glinfo.fbos || !glinfo.rect) + { + OSD_Printf("r_depthpeeling: Your OpenGL implementation doesn't support depth peeling.\n"); + r_depthpeeling = 0; + return OSDCMD_OK; + } + r_depthpeeling = (val != 0); + resetvideomode(); + if (setgamemode(fullscreen,xdim,ydim,bpp)) + OSD_Printf("restartvid: Reset failed...\n"); } - r_depthpeeling = (val != 0); - resetvideomode(); - if (setgamemode(fullscreen,xdim,ydim,bpp)) - OSD_Printf("restartvid: Reset failed...\n"); + return OSDCMD_OK; } - return OSDCMD_OK; - } - else if (!Bstrcasecmp(parm->name, "r_peelscount")) - { - if (showval) { OSD_Printf("r_peelscount is %d\n", r_peelscount); } - else if (val < 1) { OSD_Printf("Value out of range.\n"); } - else + else if (!Bstrcasecmp(parm->name, "r_peelscount")) { - newpeelscount = val; - resetvideomode(); - if (setgamemode(fullscreen,xdim,ydim,bpp)) - OSD_Printf("restartvid: Reset failed...\n"); + if (showval) { OSD_Printf("r_peelscount is %d\n", r_peelscount); } + else if (val < 1) { OSD_Printf("Value out of range.\n"); } + else + { + newpeelscount = val; + resetvideomode(); + if (setgamemode(fullscreen,xdim,ydim,bpp)) + OSD_Printf("restartvid: Reset failed...\n"); + } + return OSDCMD_OK; } - return OSDCMD_OK; - } - else if (!Bstrcasecmp(parm->name, "r_curpeel")) - { - if (showval) { OSD_Printf("r_curpeel is %d\n", r_curpeel); } - else if ((val < -1) || (val >= r_peelscount)) { OSD_Printf("Value out of range.\n"); } - else r_curpeel = val; - return OSDCMD_OK; - } -*/ + else if (!Bstrcasecmp(parm->name, "r_curpeel")) + { + if (showval) { OSD_Printf("r_curpeel is %d\n", r_curpeel); } + else if ((val < -1) || (val >= r_peelscount)) { OSD_Printf("Value out of range.\n"); } + else r_curpeel = val; + return OSDCMD_OK; + } + */ else if (!Bstrcasecmp(parm->name, "r_detailmapping")) { if (showval) { OSD_Printf("r_detailmapping is %d\n", r_detailmapping); } @@ -6375,7 +6373,7 @@ static int32_t dumptexturedefs(const osdfuncparm_t *parm) if (!hicfirstinit) return OSDCMD_OK; initprintf("// Begin Texture Dump\n"); - for (i=0;imdnum == 3) j = ((md3model_t *)models[mid])->head.numsurfs; - for (i=0;i<=j;i++) + for (i=0; i<=j; i++) { mdloadskin((md2model_t*)models[mid], 0, dapalnum, i); } @@ -6572,9 +6570,9 @@ int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, c { //alpha_4x4 cptr = midbuf; - for (k=0;k<8;k++) *cptr++ = pic[k]; - for (j=stride;(unsigned)j>0)&3) + (((c2[1]>>0)&3)<<2) + (((c2[2]>>0)&3)<<4) + (((c2[3]>>0)&3)<<6); @@ -6654,8 +6652,8 @@ int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, c } else writebuf = packbuf; #else - cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf); - writebuf = packbuf; + cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf); + writebuf = packbuf; #endif } else @@ -6709,13 +6707,13 @@ int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, if (ispacked && cleng < j) if (lzf_decompress(packbuf,cleng,midbuf,j) == 0) return -1; #else - if (Bread(fil,inbuf,cleng) < cleng) return -1; - if (ispacked && lzwuncompress(packbuf,cleng,midbuf,j) != j) return -1; + if (Bread(fil,inbuf,cleng) < cleng) return -1; + if (ispacked && lzwuncompress(packbuf,cleng,midbuf,j) != j) return -1; #endif cptr = midbuf; - for (k=0;k<8;k++) pic[k] = *cptr++; - for (j=stride;jsize;j+=stride) - for (k=0;k<8;k++) pic[j+k] = (*cptr++); + for (k=0; k<8; k++) pic[k] = *cptr++; + for (j=stride; jsize; j+=stride) + for (k=0; k<8; k++) pic[j+k] = (*cptr++); } //rgb0,rgb1 @@ -6731,8 +6729,8 @@ int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, if (ispacked && lzwuncompress(packbuf,cleng,midbuf,j) != j) return -1; #endif cptr = midbuf; - for (k=0;k<=2;k+=2) - for (j=0;jsize;j+=stride) + for (k=0; k<=2; k+=2) + for (j=0; jsize; j+=stride) { *(int16_t *)(&pic[offs+j+k]) = hicoadd(*(int16_t *)cptr); cptr += 2; @@ -6751,7 +6749,7 @@ int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, if (ispacked && lzwuncompress(packbuf,cleng,midbuf,j) != j) return -1; #endif cptr = midbuf; - for (j=0;jsize;j+=stride) + for (j=0; jsize; j+=stride) { pic[j+offs+4] = ((cptr[0]>>0)&3) + (((cptr[1]>>0)&3)<<2) + (((cptr[2]>>0)&3)<<4) + (((cptr[3]>>0)&3)<<6); pic[j+offs+5] = ((cptr[0]>>2)&3) + (((cptr[1]>>2)&3)<<2) + (((cptr[2]>>2)&3)<<4) + (((cptr[3]>>2)&3)<<6); @@ -6766,7 +6764,7 @@ int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, #else /* POLYMOST */ -int32_t polymost_drawtilescreen (int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen) { return -1; } +int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen) { return -1; } #endif diff --git a/polymer/eduke32/build/src/pragmas.c b/polymer/eduke32/build/src/pragmas.c index 4d8e6a8c9..82f2cab0e 100644 --- a/polymer/eduke32/build/src/pragmas.c +++ b/polymer/eduke32/build/src/pragmas.c @@ -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>16); val += add; } + for (i=0; i>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>16); val += add; } + for (i=0; i>16); val += add; } } void clearbuf(void *d, int32_t c, int32_t a) diff --git a/polymer/eduke32/build/src/scriptfile.c b/polymer/eduke32/build/src/scriptfile.c index 00ab20a6a..4092fe361 100644 --- a/polymer/eduke32/build/src/scriptfile.c +++ b/polymer/eduke32/build/src/scriptfile.c @@ -192,8 +192,8 @@ int32_t scriptfile_getlinum(scriptfile *sf, char *ptr) ind = ((intptr_t)ptr) - ((intptr_t)sf->textbuf); - for (stp=1;stp+stplinenum;stp+=stp); //stp = highest power of 2 less than sf->linenum - for (i=0;stp;stp>>=1) + for (stp=1; stp+stplinenum; 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;ilinenum); - for (i=0;ilinenum;i++) printf("line %d = byte %d\n",i,sf->lineoffs[i]); + for (i=0; ilinenum; 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; } diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 69cd1a3cb..3df8b7b72 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -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> 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; } } diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 401b6e1b4..c1d175d86 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -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<nfeatures;i++) + for (i=0; infeatures; 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 8) { - for (i=0;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];xx-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 (;jsectnum].wallptr, endwall = x+sector[s->sectnum].wallnum; - for (;xx+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;xextra; 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;ksectnum, 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;jweapreccnt;j++) + for (j=0; jweapreccnt; 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;jwallptr; j= 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;jceilingz > 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]) { diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c index dbbc98dea..04a2a7d42 100644 --- a/polymer/eduke32/source/anim.c +++ b/polymer/eduke32/source/anim.c @@ -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 4) && (totalclock > frametime + 45)) { diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 902a69d7d..4176a965a 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -246,7 +246,7 @@ void ExtLoadMap(const char *mapname) } */ // Presize Sprites - for (j=numsprites;j>=0;j--) + for (j=numsprites; j>=0; j--) { /* if (tilesizx[sprite[j].picnum]==0 || tilesizy[sprite[j].picnum]==0) sprite[j].picnum=0; */ @@ -269,9 +269,9 @@ void ExtLoadMap(const char *mapname) Bstrcpy(levelname,mapname); pskyoff[0]=0; - for (i=0;i<8;i++) pskyoff[i]=0; + for (i=0; i<8; i++) pskyoff[i]=0; - for (i=0;inextfreetag) nextfreetag=1+sprite[i].hitag; + else if (sprite[i].hitag>nextfreetag) nextfreetag=1+sprite[i].hitag; break; default: break; @@ -909,9 +907,9 @@ void ExtShowWallData(int16_t wallnum) //F6 } // end sprite loop //Count Normal Actors - for (i=0;i 640)?3:2);i<=((xdim > 640)?7:3);i++) + for (i=((xdim > 640)?3:2); i<=((xdim > 640)?7:3); i++) { plotpixel(searchx+i,searchy,col); plotpixel(searchx-i,searchy,col); plotpixel(searchx,searchy-i,col); plotpixel(searchx,searchy+i,col); } - for (i=1;i<=((xdim > 640)?2:1);i++) + for (i=1; i<=((xdim > 640)?2:1); i++) { plotpixel(searchx+i,searchy,whitecol); plotpixel(searchx-i,searchy,whitecol); @@ -2086,7 +2084,7 @@ static void m32_showmouse(void) if (xdim > 640) { - for (i=1;i<=4;i++) + for (i=1; i<=4; i++) { plotpixel(searchx+i,searchy,whitecol); plotpixel(searchx-i,searchy,whitecol); @@ -2258,7 +2256,7 @@ static int32_t m32gettile(int32_t idInitialTile) break; case 3 : - for (i=0;i>6)*8; @@ -3685,7 +3683,7 @@ static void Keys3d(void) Bsprintf(lines[num++],"^251%s",getmessage); } begindrawing(); - for (i=0;i640?0:1); printext256(x,y,whitecol,-1,lines[i],xdimgame>640?0:1); @@ -3831,7 +3829,7 @@ static void Keys3d(void) wall[w].pal = pal[2]; } if (pal[3] > -1) - for (k=0;k= 0) @@ -3874,7 +3872,7 @@ static void Keys3d(void) { wall[w].pal = pal; } - for (k=0;k= 0) @@ -4012,9 +4010,9 @@ static void Keys3d(void) else if (zmode == 1) zlock = (loz-pos.z)&0xfffffc00; switch (zmode) { - case 0: message("Zmode = Gravity");break; - case 1: message("Zmode = Locked/Sector");break; - case 2: message("Zmode = Locked/Free");break; + case 0: message("Zmode = Gravity"); break; + case 1: message("Zmode = Locked/Sector"); break; + case 2: message("Zmode = Locked/Free"); break; } keystatus[KEYSC_CAPS] = keystatus[KEYSC_Z] = 0; } @@ -4225,12 +4223,12 @@ static void Keys3d(void) k=eitherSHIFT?1:16; if (highlightsectorcnt >= 0) - for (i=0;i 0) { - for (i=0;i= 0) { - for (i=0;i= 0) - for (i=0;i 0) { - for (i=0;i= 0) { - for (i=0;i= 0) { - for (i=0;i= 0) - for (i=0;i0) { updownunits=klabs(mousey*128); @@ -4853,7 +4851,7 @@ static void Keys3d(void) k = 0; if (highlightsectorcnt >= 0) { - for (i=0;i= 0) - for (i=0;i 640)))+2,0,-1,Help3d[i],!(xdimgame > 640)); @@ -5211,7 +5209,7 @@ static void Keys3d(void) { case 0: case 4: - for (i=0;i0) { i=klabs(mousey*2); @@ -5691,7 +5688,7 @@ static void Keys3d(void) x2=wall[wall[fw].point2].x,y2=wall[wall[fw].point2].y; a=getangle(x1-x2,y1-y2); } - mouseax+=mousex;mouseay+=mousey; + mouseax+=mousex; mouseay+=mousey; ma=getangle(mouseax,mouseay); ma+=ang-a; @@ -5701,25 +5698,25 @@ static void Keys3d(void) switch (i) { case 0:break; - case 1:ma=-ma;break; - case 2:ma=1024-ma;break; - case 3:ma+=1024;break; - case 4:ma=-512-ma;break; - case 5:ma+=512;break; - case 6:ma-=512;break; - case 7:ma=512-ma;break; + case 1:ma=-ma; break; + case 2:ma=1024-ma; break; + case 3:ma+=1024; break; + case 4:ma=-512-ma; break; + case 5:ma+=512; break; + case 6:ma-=512; break; + case 7:ma=512-ma; break; } else switch (i) { - case 0:ma=-ma;break; + case 0:ma=-ma; break; case 1:break; - case 2:ma+=1024;break; - case 3:ma=1024-ma;break; - case 4:ma-=512;break; - case 5:ma=512-ma;break; - case 6:ma=-512-ma;break; - case 7:ma+=512;break; + case 2:ma+=1024; break; + case 3:ma=1024-ma; break; + case 4:ma-=512; break; + case 5:ma=512-ma; break; + case 6:ma=-512-ma; break; + case 7:ma+=512; break; } a=ksqrt(mouseax*mouseax+mouseay*mouseay); @@ -5730,29 +5727,29 @@ static void Keys3d(void) y1=-a*sintable[(ma+1536)&2047]/mult; if (x1||y1) { - mouseax=0;mouseay=0; + mouseax=0; mouseay=0; if (searchstat==1) { - changedir=1;if (x1<0) {changedir=-1;x1*=-1;} + changedir=1; if (x1<0) {changedir=-1; x1*=-1;} while (x1--)sector[searchsector].ceilingxpanning = changechar(sector[searchsector].ceilingxpanning,changedir,0,0); - changedir=1;if (y1<0) {changedir=-1;y1*=-1;} + changedir=1; if (y1<0) {changedir=-1; y1*=-1;} while (y1--)sector[searchsector].ceilingypanning = changechar(sector[searchsector].ceilingypanning,changedir,0,0); message("Sector %d ceiling panning: %d, %d",searchsector,sector[searchsector].ceilingxpanning,sector[searchsector].ceilingypanning); } else { - changedir=1;if (x1<0) {changedir=-1;x1*=-1;} + changedir=1; if (x1<0) {changedir=-1; x1*=-1;} while (x1--)sector[searchsector].floorxpanning = changechar(sector[searchsector].floorxpanning,changedir,0,0); - changedir=1;if (y1<0) {changedir=-1;y1*=-1;} + changedir=1; if (y1<0) {changedir=-1; y1*=-1;} while (y1--)sector[searchsector].floorypanning = changechar(sector[searchsector].floorypanning,changedir,0,0); message("Sector %d floor panning: %d, %d",searchsector,sector[searchsector].floorxpanning,sector[searchsector].floorypanning); } asksave=1; } } - mousex=0;mousey=0; + mousex=0; mousey=0; } - if (!mouseb) {mouseax=0;mouseay=0;} + if (!mouseb) {mouseax=0; mouseay=0;} smooshyalign = keystatus[KEYSC_gKP5]; repeatpanalign = eitherSHIFT; @@ -5773,26 +5770,25 @@ static void Keys3d(void) if (updownunits) {mouseax=0;} } } - else - if (eitherCTRL) + else if (eitherCTRL) + { + mskip=1; + if (mousex!=0) { - mskip=1; - if (mousex!=0) + mouseaction=2; + repeatpanalign=0; + if (searchstat==3) { - mouseaction=2; - repeatpanalign=0; - if (searchstat==3) - { - updownunits=klabs(mouseax+=mousex)/4; - if (updownunits)mouseax=0; - } - else - { - updownunits=klabs(mouseax+=mousex)/16; - if (updownunits)mouseax=0; - } + updownunits=klabs(mouseax+=mousex)/4; + if (updownunits)mouseax=0; + } + else + { + updownunits=klabs(mouseax+=mousex)/16; + if (updownunits)mouseax=0; } } + } } if (keystatus[KEYSC_gLEFT] || keystatus[KEYSC_gRIGHT] || mouseaction) // 4 & 6 (keypad) @@ -5881,28 +5877,27 @@ static void Keys3d(void) } } } - else - if (eitherCTRL) + else if (eitherCTRL) + { + mskip=1; + if (mousey!=0) { - mskip=1; - if (mousey!=0) + mouseaction=2; + repeatpanalign=0; + if (searchstat==3) { - mouseaction=2; - repeatpanalign=0; - if (searchstat==3) - { - updownunits=klabs(mouseay+=mousey)/4; - if (updownunits)mouseay=0; - } - else - { - updownunits=klabs(mouseay+=mousey)/32; - if (updownunits)mouseay=0; - } + updownunits=klabs(mouseay+=mousey)/4; + if (updownunits)mouseay=0; + } + else + { + updownunits=klabs(mouseay+=mousey)/32; + if (updownunits)mouseay=0; } } + } } - if (!mouseb) {mouseax=0;mouseay=0;} + if (!mouseb) {mouseax=0; mouseay=0;} if (keystatus[KEYSC_gUP] || keystatus[KEYSC_gDOWN] || mouseaction) // 2 & 8 (keypad) { if ((repeatcounty == 0) || (repeatcounty > 32) || mouseaction) @@ -6162,7 +6157,7 @@ static void Keys3d(void) startwall = sector[i].wallptr; endwall = startwall + sector[i].wallnum - 1; - for (j=startwall;j<=endwall;j++) + for (j=startwall; j<=endwall; j++) { k = wall[j].nextsector; if (k >= 0) @@ -6171,7 +6166,7 @@ static void Keys3d(void) pskysearch[k] = 1; } - for (j=0;j= 0) @@ -6206,7 +6201,7 @@ static void Keys3d(void) pskysearch[k] = 1; } - for (j=0;j 0) && (tilesizy[k] > 0)) { j = k; @@ -6329,28 +6324,28 @@ static void Keys3d(void) { case 0: j = wall[searchwall].picnum; - for (i=0;i0) curwallnum--; - for (i=curwallnum;i>=0;i--) + for (i=curwallnum; i>=0; i--) { if ( (wall[i].picnum==wall[curwall].picnum) @@ -6986,7 +6981,7 @@ static void Keys2d(void) #if 0 { if (cursearchspritenum>0) cursearchspritenum--; - for (i=cursearchspritenum;i>=0;i--) + for (i=cursearchspritenum; i>=0; i--) { if ( @@ -7024,7 +7019,7 @@ static void Keys2d(void) else if (wallsprite==1) { if (curwallnum=0;i--) + for (i=numsectors-2; i>=0; i--) sector[i].wallnum = sector[i+1].wallptr-sector[i].wallptr; sector[numsectors-1].wallnum = numwalls-sector[numsectors-1].wallptr; - for (i=0;i=33 && *s<=126 && i>= 0 && i= 33 && *s <= 126) { alphabets[numalphabets].xofs[(*s)-33] = i; @@ -8730,7 +8725,7 @@ void ExtUnInit(void) if (s_TileGroups[i].szText != NULL) Bfree(s_TileGroups[i].szText); } - for (i = numhelppages-1; i >= 0;i--) free(helppage[i]); + for (i = numhelppages-1; i >= 0; i--) free(helppage[i]); if (helppage) free(helppage); } @@ -8756,7 +8751,7 @@ void ExtPreCheckKeys(void) // just before drawrooms if (shadepreview) { int32_t i = 0; - for (i=numsprites-1;i>=0;i--) + for (i=numsprites-1; i>=0; i--) if (sprite[i].picnum == SECTOREFFECTOR && (sprite[i].lotag == 12 || sprite[i].lotag == 3)) { int32_t w; @@ -8827,7 +8822,7 @@ void ExtPreCheckKeys(void) // just before drawrooms if (graphicsmode && zoom >= 256) { - for (i=0;i= 256*/ && sprite[i].sectnum != MAXSECTORS) { xp1 = mulscale14(sprite[i].x-pos.x,zoom); @@ -8963,7 +8958,7 @@ void ExtAnalyzeSprites(void) spritetype *tspr; int32_t frames=0, l; - for (i=0,tspr=&tsprite[0];i=0;i--) sector[i].extra = -1; - for (i=MAXWALLS-1;i>=0;i--) wall[i].extra = -1; - for (i=MAXSPRITES-1;i>=0;i--) sprite[i].extra = -1; + for (i=MAXSECTORS-1; i>=0; i--) sector[i].extra = -1; + for (i=MAXWALLS-1; i>=0; i--) wall[i].extra = -1; + for (i=MAXSPRITES-1; i>=0; i--) sprite[i].extra = -1; ExtPreLoadMap(); i = loadboard(f,(!pathsearchmode&&grponlymode?2:0),&pos.x,&pos.y,&pos.z,&ang,&cursectnum); @@ -9318,7 +9313,7 @@ static void Keys2d3d(void) startposz = pos.z; startang = ang; startsectnum = cursectnum; - pos.x=sposx;pos.y=sposy;pos.z=sposz;ang=sang; + pos.x=sposx; pos.y=sposy; pos.z=sposz; ang=sang; keystatus[KEYSC_L]=0; } } @@ -9401,7 +9396,7 @@ void ExtCheckKeys(void) if (shadepreview) { int32_t i = 0; - for (i=numsprites-1;i>=0;i--) + for (i=numsprites-1; i>=0; i--) if (sprite[i].picnum == SECTOREFFECTOR && (sprite[i].lotag == 12 || sprite[i].lotag == 3)) { int32_t w; @@ -9564,7 +9559,7 @@ static void SearchSectorsForward() if (cursector_lotag!=0) { if (cursectornum0) cursectornum--; - for (ii=cursectornum;ii>=0;ii--) + for (ii=cursectornum; ii>=0; ii--) { if (sector[ii].lotag==cursector_lotag) { @@ -10381,7 +10376,7 @@ static void GenSearchSprite() k=Bsprintf(disptext, "%s: ^O%d", labels[j][i], gs_sprite[i][j]); else k=Bsprintf(disptext, "%s: ^7any", labels[j][i]); - for (;k= 0) { int32_t k = 0; - for (j=0;j=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=0;i--) + for (i=ntokens-1; i>=0; i--) { if (!Bstrcasecmp(tok, tl[i].text)) return tl[i].tokenid; @@ -399,7 +399,7 @@ int32_t gametext_z(int32_t small, int32_t starttile, int32_t x,int32_t y,const c { x+=(x-ox)<<16; y+=(y-oy)<<16; - ox=x;oy=y; + ox=x; oy=y; } if (small&4) @@ -517,7 +517,7 @@ void G_AddUserQuote(const char *daquote) { int32_t i; - for (i=MAXUSERQUOTES-1;i>0;i--) + for (i=MAXUSERQUOTES-1; i>0; i--) { Bstrcpy(user_quote[i],user_quote[i-1]); user_quote_time[i] = user_quote_time[i-1]; @@ -597,7 +597,7 @@ void Net_GetPackets(void) j = 1; if ((g_player[other].movefifoend&(TIMERUPDATESIZ-1)) == 0) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) { if (g_player[i].playerquitflag == 0) continue; if (i == myconnectindex) @@ -647,7 +647,7 @@ void Net_GetPackets(void) TRAVERSE_CONNECT(i) if (i != myconnectindex) - for (j=g_movesPerPacket-1;j>=1;j--) + for (j=g_movesPerPacket-1; j>=1; j--) { copybufbyte(&nsyn[i],&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t)); g_player[i].movefifoend++; @@ -681,7 +681,7 @@ void Net_GetPackets(void) Net_GetSyncData(packbuf, packbufleng, &j, other); - for (i=g_movesPerPacket-1;i>=1;i--) + for (i=g_movesPerPacket-1; i>=1; i--) { copybufbyte(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t)); g_player[other].movefifoend++; @@ -697,7 +697,7 @@ void Net_GetPackets(void) if ((g_player[other].movefifoend&(TIMERUPDATESIZ-1)) == 0) if (other == connecthead) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) { if (i == myconnectindex) otherminlag = (int32_t)((int8_t)packbuf[j]); @@ -726,7 +726,7 @@ void Net_GetPackets(void) if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((int32_t)packbuf[j++])<<24); */ g_player[other].movefifoend++; - for (i=g_movesPerPacket-1;i>=1;i--) + for (i=g_movesPerPacket-1; i>=1; i--) { copybufbyte(&nsyn[other],&inputfifo[g_player[other].movefifoend&(MOVEFIFOSIZ-1)][other],sizeof(input_t)); g_player[other].movefifoend++; @@ -759,7 +759,7 @@ void Net_GetPackets(void) if (packbuf[1] == 255) { //Master re-transmits message to all others - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); } @@ -786,7 +786,7 @@ void Net_GetPackets(void) //Slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); if (vote_map != -1 || vote_episode != -1 || voting != -1) @@ -821,7 +821,7 @@ void Net_GetPackets(void) //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); if (packbuf[2] != (uint8_t)atoi(s_buildDate)) @@ -846,7 +846,7 @@ void Net_GetPackets(void) //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); other = packbuf[1]; @@ -864,12 +864,12 @@ void Net_GetPackets(void) //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); other = packbuf[1]; - for (i=2;packbuf[i];i++) + for (i=2; packbuf[i]; i++) g_player[other].user_name[i-2] = packbuf[i]; g_player[other].user_name[i-2] = 0; i++; @@ -880,7 +880,7 @@ void Net_GetPackets(void) //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); other = packbuf[1]; @@ -888,14 +888,14 @@ void Net_GetPackets(void) i = 2; j = i; //This used to be Duke packet #9... now concatenated with Duke packet #6 - for (;i-j<10;i++) g_player[other].wchoice[i-j] = packbuf[i]; + for (; i-j<10; i++) g_player[other].wchoice[i-j] = packbuf[i]; break; case PACKET_RTS: //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); if (numlumps == 0) break; @@ -915,7 +915,7 @@ void Net_GetPackets(void) if (myconnectindex == connecthead) { //Master re-transmits message to all others - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); } @@ -951,7 +951,7 @@ void Net_GetPackets(void) if (myconnectindex == connecthead) { //Master re-transmits message to all others - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); } @@ -981,7 +981,7 @@ void Net_GetPackets(void) if (myconnectindex == connecthead) { //Master re-transmits message to all others - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); } @@ -1014,7 +1014,7 @@ void Net_GetPackets(void) Bsprintf(tempbuf,"PRESS F1 TO ACCEPT, F2 TO DECLINE"); G_AddUserQuote(tempbuf); - for (i=MAXPLAYERS-1;i>=0;i--) + for (i=MAXPLAYERS-1; i>=0; i--) { g_player[i].vote = 0; g_player[i].gotvote = 0; @@ -1027,13 +1027,13 @@ void Net_GetPackets(void) { voting = -1; i = 0; - for (j=MAXPLAYERS-1;j>=0;j--) + for (j=MAXPLAYERS-1; j>=0; j--) i += g_player[j].gotvote; if (i != numplayers) Bsprintf(tempbuf,"%s^00 HAS CANCELED THE VOTE",g_player[(uint8_t)packbuf[1]].user_name); else Bsprintf(tempbuf,"VOTE FAILED"); - for (i=MAXPLAYERS-1;i>=0;i--) + for (i=MAXPLAYERS-1; i>=0; i--) { g_player[i].vote = 0; g_player[i].gotvote = 0; @@ -1048,7 +1048,7 @@ void Net_GetPackets(void) //Slaves in M/S mode only send to master //Master re-transmits message to all others if ((!g_networkBroadcastMode) && (myconnectindex == connecthead)) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (i != other) mmulti_sendpacket(i,packbuf,packbufleng); multiflag = 2; @@ -1218,10 +1218,10 @@ void faketimerhandler(void) } if (myconnectindex == connecthead) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) packbuf[j++] = min(max(g_player[i].myminlag,-128),127); - for (i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead; i>=0; i=connectpoint2[i]) g_player[i].myminlag = 0x7fffffff; } #endif @@ -1368,7 +1368,7 @@ void faketimerhandler(void) if (g_player[i].movefifoend <= movefifosendplc) { packbuf[0] = PACKET_NULL_PACKET; - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) mmulti_sendpacket(i,packbuf,1); return; } @@ -1388,7 +1388,7 @@ void faketimerhandler(void) //Fix timers and buffer/jitter value if ((movefifosendplc&(TIMERUPDATESIZ-1)) == 0) { - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (g_player[i].playerquitflag) packbuf[j++] = min(max(g_player[i].myminlag,-128),127); @@ -1448,7 +1448,7 @@ void faketimerhandler(void) } */ Net_AddSyncData(&j); - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead]; i>=0; i=connectpoint2[i]) if (g_player[i].playerquitflag) { mmulti_sendpacket(i,packbuf,j); @@ -1474,7 +1474,7 @@ static void G_ShowCacheLocks(void) int16_t i,k; k = 0; - for (i=cacnum-1;i>=0;i--) + for (i=cacnum-1; i>=0; i--) if ((*cac[i].lock) >= 200) { Bsprintf(tempbuf,"Locked- %d: Leng:%d, Lock:%d",i,cac[i].leng,*cac[i].lock); @@ -1484,7 +1484,7 @@ static void G_ShowCacheLocks(void) k += 6; - for (i=10;i>=0;i--) + for (i=10; i>=0; i--) if (lumplockbyte[i] >= 200) { Bsprintf(tempbuf,"RTS Locked %d:",i); @@ -1761,7 +1761,7 @@ static void G_DrawDigiNum(int32_t x,int32_t y,int32_t n,char s,char cs) Bsnprintf(b,10,"%d",n); i = Bstrlen(b); - for (k=i-1;k>=0;k--) + for (k=i-1; k>=0; k--) { p = DIGITALNUM+*(b+k)-'0'; j += tilesizx[p]+1; @@ -1769,7 +1769,7 @@ static void G_DrawDigiNum(int32_t x,int32_t y,int32_t n,char s,char cs) c = x-(j>>1); j = 0; - for (k=0;k=0;k--) + for (k=i-1; k>=0; k--) { p = starttile+*(b+k)-'0'; j += (tilesizx[p]+1)*z/65536; @@ -1796,7 +1796,7 @@ void G_DrawTXDigiNumZ(int32_t starttile, int32_t x,int32_t y,int32_t n,int32_t s c = x-(j>>1); j = 0; - for (k=0;k=0;k--) + for (k=i-1; k>=0; k--) { p = althud_numbertile+*(b+k)-'0'; j += tilesizx[p]+1; @@ -1829,7 +1829,7 @@ static void G_DrawAltDigiNum(int32_t x,int32_t y,int32_t n,char s,char cs) if (rev) { // j = 0; - for (k=0;k= 3 && althud_shadows) @@ -1840,7 +1840,7 @@ static void G_DrawAltDigiNum(int32_t x,int32_t y,int32_t n,char s,char cs) return; } j = 0; - for (k=0;k= 3 && althud_shadows) @@ -2276,7 +2276,7 @@ static void G_DrawStatusBar(int32_t snum) u |= (4+8+16+32+64+128+256+512+1024+65536L); } - for (i=1;iammo_amount[i]) { @@ -2552,7 +2552,7 @@ static void G_PrintFPS(void) // lag meter if (numplayers > 1 && (totalclock - lastpackettime) > 1) { - for (howlong = (totalclock - lastpackettime);howlong>0 && howlong<(xdim>>2);howlong--) + for (howlong = (totalclock - lastpackettime); howlong>0 && howlong<(xdim>>2); howlong--) printext256(4L*howlong,0,COLOR_WHITE,-1,".",0); } } @@ -2635,7 +2635,7 @@ static void G_PrintGameQuotes(void) //quotebotgoal = j; //j = quotebot; j = scale(j,ydim,200); - for (i=MAXUSERQUOTES-1;i>=0;i--) + for (i=MAXUSERQUOTES-1; i>=0; i--) { if (user_quote_time[i] <= 0) continue; k = user_quote_time[i]; @@ -2820,7 +2820,7 @@ void G_GameExit(const char *t) ready2send = 0; - for (j=MAXPLAYERS-1;j>=0;j--) + for (j=MAXPLAYERS-1; j>=0; j--) { oldtotalclock = totalclock; @@ -2935,7 +2935,7 @@ int32_t _EnterText(int32_t small,int32_t x,int32_t y,char *t,int32_t dalen,int32 if (c == 998) { char b[91],ii; - for (ii=0;iigm&MODE_TYPE) @@ -3134,7 +3134,7 @@ static inline void G_MoveClouds(void) cloudtotalclock = totalclock+6; - for (i=g_numClouds-1;i>=0;i--) + for (i=g_numClouds-1; i>=0; i--) { cloudx[i] += (sintable[(g_player[screenpeek].ps->ang+512)&2047]>>9); cloudy[i] += (sintable[g_player[screenpeek].ps->ang&2047]>>9); @@ -3162,7 +3162,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 yvect2 = mulscale16(yvect,yxaspect); //Draw red lines - for (i=numsectors-1;i>=0;i--) + for (i=numsectors-1; i>=0; i--) { if (!(show2dsector[i>>3]&(1<<(i&7)))) continue; @@ -3172,7 +3172,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 z1 = sector[i].ceilingz; z2 = sector[i].floorz; - for (j=startwall,wal=&wall[startwall];jnextwall; if (k < 0) continue; @@ -3208,10 +3208,10 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 //Draw sprites k = g_player[screenpeek].ps->i; - for (i=numsectors-1;i>=0;i--) + for (i=numsectors-1; i>=0; i--) { if (!(show2dsector[i>>3]&(1<<(i&7)))) continue; - for (j=headspritesect[i];j>=0;j=nextspritesect[j]) + for (j=headspritesect[i]; j>=0; j=nextspritesect[j]) //if ((show2dsprite[j>>3]&(1<<(j&7))) > 0) { spr = &sprite[j]; @@ -3354,7 +3354,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 } //Draw white lines - for (i=numsectors-1;i>=0;i--) + for (i=numsectors-1; i>=0; i--) { if (!(show2dsector[i>>3]&(1<<(i&7)))) continue; @@ -3362,7 +3362,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 endwall = sector[i].wallptr + sector[i].wallnum; k = -1; - for (j=startwall,wal=&wall[startwall];jnextwall >= 0) continue; @@ -3664,7 +3664,7 @@ void G_DisplayRest(int32_t smoothratio) { show2dsector[i>>3] |= (1<<(i&7)); wal = &wall[sector[i].wallptr]; - for (j=sector[i].wallnum;j>0;j--,wal++) + for (j=sector[i].wallnum; j>0; j--,wal++) { i = wal->nextsector; if (i < 0) continue; @@ -3831,7 +3831,7 @@ void G_DisplayRest(int32_t smoothratio) #if 0 if (GametypeFlags[ud.coop] & GAMETYPE_TDM) { - for (i=0;iteam == g_player[myconnectindex].ps->team) { @@ -4025,8 +4025,8 @@ void G_DrawBackground(void) X_OnEvent(EVENT_GETMENUTILE, -1, myconnectindex, -1); if (Gv_GetVarByLabel("MENU_TILE", tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?0:1, -1, -1)) { - for (y=y1;y> 1; - for (y=y2-y2%tilesizy[dapicnum];y>1;x+=tilesizx[dapicnum]) + for (y=y2-y2%tilesizy[dapicnum]; y>1; x+=tilesizx[dapicnum]) { rotatesprite(x<<16,y<<16,65536L,0,dapicnum,8,0,8+16+64,0,y2,x2,ydim-1); rotatesprite((xdim-x)<<16,y<<16,65536L,0,dapicnum,8,0,8+16+64,xdim-x2-1,y2,xdim-1,ydim-1); @@ -4097,13 +4097,13 @@ void G_DrawBackground(void) x2 = min(windowx2+4,xdim-1); y2 = min(windowy2+4,scale(ydim,200-scale(tilesizy[BOTTOMSTATUSBAR],ud.statusbarscale,100),200)-1); - for (y=y1+4;y=0;j=nextspritestat[j]) + for (j=headspritestat[15]; j>=0; j=nextspritestat[j]) { if (sprite[j].picnum==1 && sprite[j].lotag==fofmode && sprite[j].hitag==sprite[floor1].hitag) { @@ -4188,7 +4188,7 @@ static void SE40_Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int32_t a,int3 if (fofmode==40) k=41; else k=40; - for (j=headspritestat[15];j>=0;j=nextspritestat[j]) + for (j=headspritestat[15]; j>=0; j=nextspritestat[j]) { if (sprite[j].picnum==1 && sprite[j].lotag==k && sprite[j].hitag==sprite[floor1].hitag) { @@ -4219,7 +4219,7 @@ static void SE40_Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int32_t a,int3 // if(ok==2) { Message("no floor2",RED); return; } - for (j=headspritestat[15];j>=0;j=nextspritestat[j]) // raise ceiling or floor + for (j=headspritestat[15]; j>=0; j=nextspritestat[j]) // raise ceiling or floor { if (sprite[j].picnum==1 && sprite[j].lotag==k+2 && sprite[j].hitag==sprite[floor1].hitag) { @@ -4247,7 +4247,7 @@ static void SE40_Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int32_t a,int3 if (draw_both) { - for (j=headspritestat[15];j>=0;j=nextspritestat[j]) // restore ceiling or floor for the draw both sectors + for (j=headspritestat[15]; j>=0; j=nextspritestat[j]) // restore ceiling or floor for the draw both sectors { if (sprite[j].picnum==1 && sprite[j].lotag==k+2 && @@ -4401,7 +4401,7 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio) { //Block off unscreen section of 90ø tilted screen j = ((tiltcx-(60*tiltcs))>>(1-ud.detail)); - for (i=((60*tiltcs)>>(1-ud.detail))-1;i>=0;i--) + for (i=((60*tiltcs)>>(1-ud.detail))-1; i>=0; i--) { startumost[i] = 1; startumost[i+j] = 1; @@ -4502,7 +4502,7 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio) { dst = 0x7fffffff; i = 0; - for (k=g_mirrorCount-1;k>=0;k--) + for (k=g_mirrorCount-1; k>=0; k--) { j = klabs(wall[g_mirrorWall[k]].x-ud.camerax); j += klabs(wall[g_mirrorWall[k]].y-ud.cameray); @@ -4579,9 +4579,9 @@ static void G_DumpDebugInfo(void) // FILE * fp=fopen("condebug.log","w"); OSD_Printf("Current gamevar values:\n"); - for (i=0;i= 0) { OSD_Printf("Sprite %d (%d,%d,%d) (picnum: %d)\n",j,sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].picnum); - for (i=0;ilotag != 23) { - for (j=0;j= 0) @@ -6235,7 +6235,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) //find the two most clostest wall x's and y's q = 0x7fffffff; - for (s=startwall;sshade; @@ -6302,7 +6302,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) startwall = sector[sect].wallptr; endwall = startwall+sector[sect].wallnum; - for (s=startwall;sowner = sector[sect].ceilingpal<<8; sp->owner |= sector[sect].floorpal; - for (s=startwall;s T4) T4 = wall[s].shade; @@ -6352,7 +6352,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) startwall = sector[sect].wallptr; endwall = startwall+sector[sect].wallnum; - for (s=startwall;s T3) T3 = wall[s].shade; @@ -6383,7 +6383,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) sector[sect].hitag = i; } - for (j = MAXSPRITES-1;j>=0;j--) + for (j = MAXSPRITES-1; j>=0; j--) { if (sprite[j].statnum < MAXSTATUS) if (sprite[j].picnum == SECTOREFFECTOR && @@ -6418,7 +6418,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) endwall = startwall+sector[sect].wallnum; T2 = tempwallptr; - for (s=startwall;sx; msy[tempwallptr] = wall[s].y-sp->y; @@ -6443,7 +6443,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) j = 0; - for (s=startwall;s= 0 && sector[ wall[ s ].nextsector].hitag == 0 && @@ -6645,7 +6645,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) if (!spritesortcnt) return; - for (j=spritesortcnt-1;j>=0; j--) + for (j=spritesortcnt-1; j>=0; j--) { t = &tsprite[j]; i = t->owner; @@ -6739,7 +6739,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) t->shade = l; } - for (j=spritesortcnt-1;j>=0; j--) //Between drawrooms() and drawmasks() + for (j=spritesortcnt-1; j>=0; j--) //Between drawrooms() and drawmasks() { //is the perfect time to animate sprites t = &tsprite[j]; @@ -7682,9 +7682,9 @@ static void G_DoCheats(void) return; } - for (k=0;k < NUMCHEATCODES;k++) + for (k=0; k < NUMCHEATCODES; k++) { - for (j = 0;j= '0' && ch <= '9')) { @@ -7709,7 +7709,7 @@ FOUNDCHEAT: if (VOLUMEONE) j = 6; - for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++) + for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS-j; weapon++) { P_AddAmmo(weapon, g_player[myconnectindex].ps, g_player[myconnectindex].ps->max_ammo_amount[weapon]); g_player[myconnectindex].ps->gotweapon[weapon] = 1; @@ -7826,7 +7826,7 @@ FOUNDCHEAT: Bstrcpy(ScriptQuotes[122],"Scream for me, Long Beach!"); P_DoQuote(122,g_player[myconnectindex].ps); G_CheatGetInv(); - for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS;weapon++) + for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) g_player[myconnectindex].ps->gotweapon[weapon] = 1; for (weapon = PISTOL_WEAPON; @@ -7856,7 +7856,7 @@ FOUNDCHEAT: if (VOLUMEONE) j = 6; - for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++) + for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS-j; weapon++) g_player[myconnectindex].ps->gotweapon[weapon] = 1; for (weapon = PISTOL_WEAPON; @@ -7958,7 +7958,7 @@ FOUNDCHEAT: case CHEAT_UNLOCK: if (VOLUMEONE) return; - for (i=numsectors-1;i>=0;i--) //Unlock + for (i=numsectors-1; i>=0; i--) //Unlock { j = sector[i].lotag; if (j == -1 || j == 32767) continue; @@ -7994,17 +7994,17 @@ FOUNDCHEAT: ud.showallmap = 1-ud.showallmap; if (ud.showallmap) { - for (i=0;i<(MAXSECTORS>>3);i++) + for (i=0; i<(MAXSECTORS>>3); i++) show2dsector[i] = 255; - for (i=0;i<(MAXWALLS>>3);i++) + for (i=0; i<(MAXWALLS>>3); i++) show2dwall[i] = 255; P_DoQuote(111,g_player[myconnectindex].ps); } else { - for (i=0;i<(MAXSECTORS>>3);i++) + for (i=0; i<(MAXSECTORS>>3); i++) show2dsector[i] = 0; - for (i=0;i<(MAXWALLS>>3);i++) + for (i=0; i<(MAXWALLS>>3); i++) show2dwall[i] = 0; P_DoQuote(1,g_player[myconnectindex].ps); } @@ -8116,13 +8116,13 @@ static void G_ShowScores(void) t = 0; minitext(23,80," NAME KILLS",8,2+8+16+128); - for (i=playerswhenstarted-1;i>=0;i--) + for (i=playerswhenstarted-1; i>=0; i--) { Bsprintf(tempbuf,"%-4d",i+1); minitext(92+(i*23),80,tempbuf,3,2+8+16+128); } - for (i=playerswhenstarted-1;i>=0;i--) + for (i=playerswhenstarted-1; i>=0; i--) { xfragtotal = 0; Bsprintf(tempbuf,"%d",i+1); @@ -8130,7 +8130,7 @@ static void G_ShowScores(void) minitext(30,90+t,tempbuf,0,2+8+16+128); minitext(38,90+t,g_player[i].user_name,g_player[i].ps->palookup,2+8+16+128); - for (y=playerswhenstarted-1;y>=0;y--) + for (y=playerswhenstarted-1; y>=0; y--) { if (i == y) { @@ -8158,10 +8158,10 @@ static void G_ShowScores(void) t += 7; } - for (y=playerswhenstarted-1;y>=0;y--) + for (y=playerswhenstarted-1; y>=0; y--) { yfragtotal = 0; - for (i=playerswhenstarted-1;i>=0;i--) + for (i=playerswhenstarted-1; i>=0; i--) { if (i == y) yfragtotal += g_player[i].ps->fraggedself; @@ -8913,7 +8913,7 @@ static void setup_rancid_net(const char *fn) if (g_keepAddr == 0) { - for (i=0;i=0;i--) // +1 volume for "intro", "briefing" music + for (i=(MAXLEVELS*(MAXVOLUMES+1))-1; i>=0; i--) // +1 volume for "intro", "briefing" music { if (MapInfo[i].name != NULL) Bfree(MapInfo[i].name); if (MapInfo[i].filename != NULL) Bfree(MapInfo[i].filename); @@ -10133,19 +10133,19 @@ static void G_FreeMemory(void) if (MapInfo[i].savedstate != NULL) G_FreeMapState(i); } - for (i=MAXQUOTES-1;i>=0;i--) + for (i=MAXQUOTES-1; i>=0; i--) { if (ScriptQuotes[i] != NULL) Bfree(ScriptQuotes[i]); if (ScriptQuoteRedefinitions[i] != NULL) Bfree(ScriptQuoteRedefinitions[i]); } - for (i=MAXPLAYERS-1;i>=0;i--) + for (i=MAXPLAYERS-1; i>=0; i--) { if (g_player[i].ps != NULL) Bfree(g_player[i].ps); if (g_player[i].sync != NULL) Bfree(g_player[i].sync); } - for (i=MAXSOUNDS-1;i>=0;i--) + for (i=MAXSOUNDS-1; i>=0; i--) { if (g_sounds[i].filename != NULL) Bfree(g_sounds[i].filename); if (g_sounds[i].filename1 != NULL) Bfree(g_sounds[i].filename1); @@ -10284,10 +10284,10 @@ static void G_LoadExtraPalettes(void) for (j = 0; j < 256; j++) tempbuf[j] = j; - for (j=g_numRealPalettes+1;j=0;j--) + for (j=g_numRealPalettes-1; j>=0; j--) { kread(fp,(char *)&look_pos,1); kread(fp,tempbuf,256); @@ -10400,7 +10400,7 @@ static void G_Startup(void) if (ud.executions >= 50) initprintf("IT IS NOW TIME TO UPGRADE TO THE COMPLETE VERSION!!!\n"); } - for (i=0;i 1) { - for (;i=0;i--) + for (i=NUMGAMEFUNCTIONS-1; i>=0; i--) { char *str = strtolower(Bstrdup(gamefunctions[i]),Bstrlen(gamefunctions[i])); hash_add(&gamefuncH,gamefunctions[i],i); @@ -11124,7 +11124,7 @@ CLEAN_DIRECTORY: { int32_t ii; - for (ii=0;ii 1) ud.multimode = numplayers; - for (i=1;ipalette = (uint8_t *) &palette[0]; i = 1; - for (j=numplayers;jteam = g_player[j].pteam = i; @@ -11337,7 +11337,7 @@ CLEAN_DIRECTORY: CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent); // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too - for (i=0;iaim_mode,sizeof(int32_t),1,frecfilep); @@ -12575,7 +12574,7 @@ static int32_t G_DoMoveThings(void) if (g_earthquakeTime > 0) g_earthquakeTime--; if (g_RTSPlaying > 0) g_RTSPlaying--; - for (i=0;iholoduke_on != -1) sprite[g_player[i].ps->holoduke_on].cstat ^= 256; @@ -12597,7 +12596,7 @@ static int32_t G_DoMoveThings(void) sintable[g_player[screenpeek].ps->ang&2047], (100-g_player[screenpeek].ps->horiz-g_player[screenpeek].ps->horizoff)<<11,&hitinfo,0xffff0030); - for (i=0;iholoduke_on != -1) sprite[g_player[i].ps->holoduke_on].cstat ^= 256; @@ -12675,7 +12674,7 @@ static int32_t G_DoMoveThings(void) if (voting == i) { - for (i=0;i 390 && totalclock < 780) - for (t=0;t<35;t+=5) if (bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1]) + for (t=0; t<35; t+=5) if (bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1]) { if (t==10 && bonuscnt == 1) { @@ -12904,7 +12903,7 @@ void G_BonusScreen(int32_t bonusonly) } } - for (t=0;t<20;t+=5) + for (t=0; t<20; t+=5) if (breathe[t+2] && (totalclock%120) > breathe[t] && (totalclock%120) <= breathe[t+1]) { if (t==5 && bonuscnt == 0) @@ -13158,13 +13157,13 @@ FRAGBONUS: t = 0; minitext(23,80," NAME KILLS",8,2+8+16+128); - for (i=0;ipalookup,2+8+16+128); - for (y=0;yfraggedself; @@ -13545,8 +13544,8 @@ static void G_DrawCameraText(int16_t i) else { flipbits = (totalclock<<1)&48; - for (x=0;x<394;x+=64) - for (y=0;y<200;y+=64) + for (x=0; x<394; x+=64) + for (y=0; y<200; y+=64) rotatesprite(x<<16,y<<16,65536L,0,STATIC,0,0,2+flipbits,windowx1,windowy1,windowx2,windowy2); } } @@ -13561,7 +13560,7 @@ void vglass(int32_t x,int32_t y,short a,short wn,short n) if (sect == -1) return; zincs = (sector[sect].floorz-sector[sect].ceilingz) / n; - for (z = sector[sect].ceilingz;z < sector[sect].floorz; z += zincs) + for (z = sector[sect].ceilingz; z < sector[sect].floorz; z += zincs) A_InsertSprite(sect,x,y,z-(krand()&8191),GLASSPIECES+(z&(krand()%3)),-32,36,36,a+128-(krand()&255),16+(krand()&31),0,-1,5); } #endif @@ -13576,7 +13575,7 @@ void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n) if (wallnum < 0) { - for (j=n-1; j >= 0 ;j--) + for (j=n-1; j >= 0 ; j--) { a = SA-256+(krand()&511)+1024; A_InsertSprite(SECT,SX,SY,SZ,GLASSPIECES+(j%3),-32,36,36,a,32+(krand()&63),1024-(krand()&1023),i,5); @@ -13598,7 +13597,7 @@ void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n) xv /= j; yv /= j; - for (j=n;j>0;j--) + for (j=n; j>0; j--) { x1 += xv; y1 += yv; @@ -13619,7 +13618,7 @@ void A_SpawnGlass(int32_t i,int32_t n) { int32_t j, k, a, z; - for (j=n;j>0;j--) + for (j=n; j>0; j--) { a = krand()&2047; z = SZ-((krand()&16)<<8); @@ -13634,7 +13633,7 @@ void A_SpawnCeilingGlass(int32_t i,int32_t sectnum,int32_t n) int32_t startwall = sector[sectnum].wallptr; int32_t endwall = startwall+sector[sectnum].wallnum; - for (s=startwall;s<(endwall-1);s++) + for (s=startwall; s<(endwall-1); s++) { x1 = wall[s].x; y1 = wall[s].y; @@ -13642,7 +13641,7 @@ void A_SpawnCeilingGlass(int32_t i,int32_t sectnum,int32_t n) xv = (wall[s+1].x-x1)/(n+1); yv = (wall[s+1].y-y1)/(n+1); - for (j=n;j>0;j--) + for (j=n; j>0; j--) { x1 += xv; y1 += yv; @@ -13661,7 +13660,7 @@ void A_SpawnRandomGlass(int32_t i,int32_t wallnum,int32_t n) if (wallnum < 0) { - for (j=n-1; j >= 0 ;j--) + for (j=n-1; j >= 0 ; j--) { a = krand()&2047; k = A_InsertSprite(SECT,SX,SY,SZ-(krand()&(63<<8)),GLASSPIECES+(j%3),-32,36,36,a,32+(krand()&63),1024-(krand()&2047),i,5); @@ -13677,7 +13676,7 @@ void A_SpawnRandomGlass(int32_t i,int32_t wallnum,int32_t n) xv = (wall[wall[wallnum].point2].x-wall[wallnum].x)/j; yv = (wall[wall[wallnum].point2].y-wall[wallnum].y)/j; - for (j=n;j>0;j--) + for (j=n; j>0; j--) { x1 += xv; y1 += yv; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 771409cdb..fb78222c2 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -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<=0;i--) + for (i=NUMKEYWORDS-1; i>=0; i--) hash_add(&keywH,keyw[i],i); hash_init(§orH); - for (i=0;SectorLabels[i].lId >=0 ; i++) + for (i=0; SectorLabels[i].lId >=0 ; i++) hash_add(§orH,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]=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) { diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index c06ed2630..f01d0451c 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -49,7 +49,7 @@ void X_ScriptInfo(void) { intptr_t *p; if (insptr) - for (p=insptr-20;p>12&&(*p&0xFFF)>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)(§or[0])); + for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]-(intptr_t)(§or[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)(§or[0])); + for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(§or[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;ii].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)(§or[0])); + for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(§or[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;ii].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(); diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index c811e5b9d..48598929f 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -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=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); diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 0a3af6c67..197559e33 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -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 (;yi) { - for (i=0;iparms[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;iparms[0],ConsoleKeys[i].name)) break; if (!ConsoleKeys[i].name) { - for (i=0;iparms[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 (;jnumparms;j++) + for (; jnumparms; 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 (;jnumparms;j++) + for (; jnumparms; 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;inumparms < 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;iparms[0],ConsoleButtons[i])) break; if (i >= MAXMOUSEBUTTONS) @@ -1490,7 +1490,7 @@ int32_t registerosdcommands(void) OSD_RegisterFunction("fileinfo","fileinfo : gets a file's information", osdcmd_fileinfo); - for (i=0;i=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); diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index fb1041a86..2e14f35d5 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -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); } diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index f30303cd4..7d3c0b2a6 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -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;inumloogs;i++) + for (i=0; inumloogs; 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;icurr_weapon][snum];i++) + for (i=1; icurr_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;splcnextsector; 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=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=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; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index d8447ad0c..f2d9b11b1 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -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 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=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>3]) { @@ -607,11 +607,11 @@ void P_RandomSpawnPoint(int32_t snum) i = krand()%g_numPlayerSprites; if (GametypeFlags[ud.coop] & GAMETYPE_TDMSPAWN) { - for (j=0;jteam == p->team && sprite[g_player[j].ps->i].extra > 0) { - for (k=0;kposx-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;ihbomb_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;ioverpicnum==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= 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;ii, 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;iaim_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;jammo_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;iaim_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;jammo_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 (;kpalookup) { @@ -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=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;iover_shoulder_on = 0; @@ -1980,7 +1964,7 @@ void G_FreeMapState(int32_t mapnum) { int32_t j; - for (j=0;j>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=0;i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(§or[0])); + for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(§or[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= 0) wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; } else { - for (x=0;x=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>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>3]&(BITPTR_POINTER<<(i&7))) { j = script[i]+(intptr_t)&script[0]; script[i] = j; } - for (i=0;i=0;i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]-(intptr_t)(§or[0])); + for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]-(intptr_t)(§or[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)(§or[0])); + for (i = g_animateCount-1; i>=0; i--) animateptr[i] = (int32_t *)((intptr_t)animateptr[i]+(intptr_t)(§or[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=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] == §or[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=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: diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index c9d96f74e..7d03f0263 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -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 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 0) { if ((g_sounds[num].m&16) == 0) - for (tempj=0;tempj= 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; } diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index 36edfaf96..941c49dcc 100644 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -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; diff --git a/polymer/eduke32/source/sync.c b/polymer/eduke32/source/sync.c index 755bacae0..c93260869 100644 --- a/polymer/eduke32/source/sync.c +++ b/polymer/eduke32/source/sync.c @@ -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 = §or[j]; updatecrc(crc, (sect->floorz) & 255); diff --git a/polymer/eduke32/source/winbits.c b/polymer/eduke32/source/winbits.c index 44d4ad754..b3ad563a4 100644 --- a/polymer/eduke32/source/winbits.c +++ b/polymer/eduke32/source/winbits.c @@ -125,7 +125,7 @@ int32_t G_GetVersionFromWebsite(char *buffer) strtok(otherbuf," "); if (atol(strtok(NULL," ")) == 200) { - for (i=0;(unsigned)i 4)