diff --git a/polymer/build/src/a-c.c b/polymer/build/src/a-c.c index d4bae930d..8596a87c0 100644 --- a/polymer/build/src/a-c.c +++ b/polymer/build/src/a-c.c @@ -40,7 +40,7 @@ void hlineasm4(long cnt, long skiploadincs, long paloffs, unsigned long by, unsi 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; @@ -63,7 +63,7 @@ void slopevlin(long p, long i, long slopaloffs, long cnt, long bx, long by) bz = asm3; bzinc = (asm1>>3); slopalptr = (long *)slopaloffs; - for(;cnt>0;cnt--) + for (;cnt>0;cnt--) { i = krecip(bz>>6); bz += bzinc; u = bx+globalx3*i; @@ -81,7 +81,7 @@ void vlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufpl { gbuf = (char *)bufplc; gpal = (char *)paloffs; - for(;cnt>=0;cnt--) + for (;cnt>=0;cnt--) { *((char *)p) = gpal[gbuf[vplc>>glogy]]; p += bpl; @@ -96,7 +96,7 @@ void mvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufp 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; @@ -113,7 +113,7 @@ void tvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufp 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)]; @@ -123,7 +123,7 @@ void tvlineasm1(long vinc, long paloffs, long cnt, unsigned long vplc, long bufp } else { - for(;cnt>=0;cnt--) + for (;cnt>=0;cnt--) { ch = gbuf[vplc>>glogy]; if (ch != 255) *((char *)p) = gtrans[((*((char *)p))<<8)+gpal[ch]]; @@ -141,7 +141,7 @@ void mhline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned lon 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]; @@ -160,7 +160,7 @@ void thline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned lon 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)]; @@ -171,7 +171,7 @@ void thline(long bufplc, unsigned long bx, long cntup16, long junk, unsigned lon } 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]]; @@ -194,7 +194,7 @@ void setupspritevline(long paloffs, long bxinc, long byinc, long ysiz) void spritevline(long bx, long by, long cnt, long bufplc, long p) { gbuf = (char *)bufplc; - for(;cnt>1;cnt--) + for (;cnt>1;cnt--) { (*(char *)p) = gpal[gbuf[(bx>>16)*glogy+(by>>16)]]; bx += gbxinc; @@ -216,7 +216,7 @@ void mspritevline(long bx, long by, long cnt, long bufplc, long p) 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]; @@ -240,7 +240,7 @@ void tspritevline(long bx, long by, long cnt, long bufplc, long p) 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)]; @@ -251,7 +251,7 @@ void tspritevline(long bx, long by, long cnt, long bufplc, long p) } 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]]; @@ -271,7 +271,7 @@ void drawslab (long dx, long v, long dy, long vi, long vptr, long p) while (dy > 0) { - for(x=0;x>16)+vptr))]; + for (x=0;x>16)+vptr))]; p += bpl; v += vi; dy--; } } diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 95be1c2a4..dc4e95653 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -229,7 +229,8 @@ static int osdcmd_vidmode(const osdfuncparm_t *parm) newx = Batol(parm->parms[0]); newy = Batol(parm->parms[1]); break; - default: return OSDCMD_SHOWHELP; + default: + return OSDCMD_SHOWHELP; } if (setgamemode(newfullscreen,newx,newy,newbpp)) @@ -342,15 +343,15 @@ int app_main(int argc, char **argv) setbrightness(brightness,palette,0); k = 0; - for(i=0;i<256;i++) + for (i=0;i<256;i++) { j = ((long)palette[i*3])+((long)palette[i*3+1])+((long)palette[i*3+2]); if (j > k) { k = j; whitecol = i; } } - 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;i= 0) - for(i=0;i= 0) { - for(i=0;i= 0) - for(i=0;i= 0) @@ -1275,7 +1276,7 @@ void editinput(void) pskysearch[k] = 1; } - for(j=0;j= 0) @@ -1310,7 +1311,7 @@ void editinput(void) pskysearch[k] = 1; } - for(j=0;j 0) && (tilesizy[k] > 0)) { j = k; @@ -1423,32 +1424,32 @@ void editinput(void) { if (somethingintab < 255) { - switch(searchstat) + switch (searchstat) { case 0: j = wall[searchwall].picnum; - for(i=0;i= 0) - switch(searchstat) + switch (searchstat) { - case 0: case 1: case 4: + case 0: + case 1: + case 4: alignceilslope(searchsector,wall[searchwall].x,wall[searchwall].y,getceilzofslope(i,wall[searchwall].x,wall[searchwall].y)); break; case 2: @@ -1540,12 +1543,14 @@ void editinput(void) { i = wall[searchwall].nextsector; if (i >= 0) - switch(searchstat) + switch (searchstat) { case 1: alignceilslope(searchsector,wall[searchwall].x,wall[searchwall].y,getceilzofslope(i,wall[searchwall].x,wall[searchwall].y)); break; - case 0: case 2: case 4: + case 0: + case 2: + case 4: alignflorslope(searchsector,wall[searchwall].x,wall[searchwall].y,getflorzofslope(i,wall[searchwall].x,wall[searchwall].y)); break; } @@ -1822,7 +1827,8 @@ void editinput(void) { switch (searchstat) { - case 0: case 4: + case 0: + case 4: Bstrcpy(buffer,"Wall pal: "); wall[searchwall].pal = getnumber256(buffer,wall[searchwall].pal,256L,0); break; @@ -2120,12 +2126,16 @@ void editinput(void) { i = wall[searchwall].cstat; i = ((i>>3)&1)+((i>>7)&2); //3-x,8-y - switch(i) + switch (i) { - case 0: i = 1; break; - case 1: i = 3; break; - case 2: i = 0; break; - case 3: i = 2; break; + case 0: + i = 1; break; + case 1: + i = 3; break; + case 2: + i = 0; break; + case 3: + i = 2; break; } i = ((i&1)<<3)+((i&2)<<7); wall[searchwall].cstat &= ~0x0108; @@ -2136,16 +2146,24 @@ void editinput(void) { i = sector[searchsector].ceilingstat; i = (i&0x4)+((i>>4)&3); - switch(i) + switch (i) { - case 0: i = 6; break; - case 6: i = 3; break; - case 3: i = 5; break; - case 5: i = 1; break; - case 1: i = 7; break; - case 7: i = 2; break; - case 2: i = 4; break; - case 4: i = 0; break; + case 0: + i = 6; break; + case 6: + i = 3; break; + case 3: + i = 5; break; + case 5: + i = 1; break; + case 1: + i = 7; break; + case 7: + i = 2; break; + case 2: + i = 4; break; + case 4: + i = 0; break; } i = (i&0x4)+((i&3)<<4); sector[searchsector].ceilingstat &= ~0x34; @@ -2156,16 +2174,24 @@ void editinput(void) { i = sector[searchsector].floorstat; i = (i&0x4)+((i>>4)&3); - switch(i) + switch (i) { - case 0: i = 6; break; - case 6: i = 3; break; - case 3: i = 5; break; - case 5: i = 1; break; - case 1: i = 7; break; - case 7: i = 2; break; - case 2: i = 4; break; - case 4: i = 0; break; + case 0: + i = 6; break; + case 6: + i = 3; break; + case 3: + i = 5; break; + case 5: + i = 1; break; + case 1: + i = 7; break; + case 7: + i = 2; break; + case 2: + i = 4; break; + case 4: + i = 0; break; } i = (i&0x4)+((i&3)<<4); sector[searchsector].floorstat &= ~0x34; @@ -2183,12 +2209,16 @@ void editinput(void) else { i = ((i>>2)&3); - switch(i) + switch (i) { - case 0: i = 1; break; - case 1: i = 3; break; - case 2: i = 0; break; - case 3: i = 2; break; + case 0: + i = 1; break; + case 1: + i = 3; break; + case 2: + i = 0; break; + case 3: + i = 2; break; } i <<= 2; sprite[searchwall].cstat &= ~0xc; @@ -2240,13 +2270,13 @@ void editinput(void) sprite[i].hitag = 0; sprite[i].extra = -1; - for(k=0;k localartfreq[j]) j = k; if (localartfreq[j] > 0) @@ -2260,7 +2290,7 @@ void editinput(void) if ((tilesizx[temppicnum] <= 0) || (tilesizy[temppicnum] <= 0)) { j = 0; - for(k=0;k 0) && (tilesizy[k] > 0)) { j = k; @@ -2321,21 +2351,31 @@ void editinput(void) if ((keystatus[0x3f]|keystatus[0x40]) > 0) //F5,F6 { - switch(searchstat) + switch (searchstat) { - case 1: case 2: ExtShowSectorData(searchsector); break; - case 0: case 4: ExtShowWallData(searchwall); break; - case 3: ExtShowSpriteData(searchwall); break; + case 1: + case 2: + ExtShowSectorData(searchsector); break; + case 0: + case 4: + ExtShowWallData(searchwall); break; + case 3: + ExtShowSpriteData(searchwall); break; } keystatus[0x3f] = 0, keystatus[0x40] = 0; } if ((keystatus[0x41]|keystatus[0x42]) > 0) //F7,F8 { - switch(searchstat) + switch (searchstat) { - case 1: case 2: ExtEditSectorData(searchsector); break; - case 0: case 4: ExtEditWallData(searchwall); break; - case 3: ExtEditSpriteData(searchwall); break; + case 1: + case 2: + ExtEditSectorData(searchsector); break; + case 0: + case 4: + ExtEditWallData(searchwall); break; + case 3: + ExtEditSpriteData(searchwall); break; } keystatus[0x41] = 0, keystatus[0x42] = 0; } @@ -2386,31 +2426,31 @@ long gettile(long tilenum) otilenum = tilenum; keystatus[0x2f] = 0; - for(i=0;i>1); do { - for(i=0;i= 0)) @@ -2441,7 +2481,7 @@ long gettile(long tilenum) { tilenum = otilenum; localartlookupnum = MAXTILES; - for(i=0;i 0) //G (goto) @@ -2513,7 +2553,7 @@ long gettile(long tilenum) else tilenum = 0; localartlookupnum = MAXTILES; - for(i=0;i>gettilezoom)) && (ydime <= (64>>gettilezoom))) { - for(i=0;i>gettilezoom))>>(6-gettilezoom)); - for(i=0;i>gettilezoom);i++) + for (i=0;i<(64>>gettilezoom);i++) { plotpixel(dax+i,day,whitecol); plotpixel(dax+i,day+(63>>gettilezoom),whitecol); @@ -2734,15 +2774,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) @@ -2756,9 +2796,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; @@ -2874,7 +2914,7 @@ void overheadeditor(void) begindrawing(); //{{{ if ((showtags == 1) && (zoom >= 768)) { - for(i=0;i=0;i--,wal--) + for (i=numwalls-1,wal=&wall[i];i>=0;i--,wal--) { //Get average point of wall dax = ((wal->x+wall[wal->point2].x)>>1); @@ -2980,10 +3020,10 @@ void overheadeditor(void) numwalls = templong; 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)); @@ -3110,7 +3150,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)); @@ -3228,7 +3268,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; } } @@ -3843,7 +3883,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)) @@ -3898,11 +3938,11 @@ void overheadeditor(void) } if (highlightsectorcnt != 0) { - for(i=0;i= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -3931,12 +3971,12 @@ void overheadeditor(void) templong = highlighty1; highlighty1 = highlighty2; highlighty2 = templong; } - for(i=0;i highlightx2) bad = 1; @@ -3952,15 +3992,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) @@ -3991,7 +4031,7 @@ void overheadeditor(void) if (j == 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) @@ -4038,7 +4078,7 @@ void overheadeditor(void) asksave = 1; } } - 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; } } @@ -4161,7 +4201,7 @@ void overheadeditor(void) dax -= sprite[pointhighlight&16383].x; day -= sprite[pointhighlight&16383].y; } - for(i=0;i= getceilzofslope(i,dax,day)) if (sprite[pointhighlight&16383].z-daz <= getflorzofslope(i,dax,day)) @@ -4239,7 +4279,7 @@ void overheadeditor(void) if (joinsector[0] >= 0) { joinsector[1] = -1; - for(i=0;i= 0) { @@ -4317,11 +4357,11 @@ void overheadeditor(void) 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; @@ -4340,7 +4380,7 @@ void overheadeditor(void) else { joinsector[0] = -1; - for(i=0;i 0) //S { sucksect = -1; - for(i=0;i localartfreq[j]) j = k; if (localartfreq[j] > 0) @@ -4433,7 +4473,7 @@ void overheadeditor(void) if ((tilesizx[temppicnum] <= 0) || (tilesizy[temppicnum] <= 0)) { j = 0; - for(k=0;k 0) && (tilesizy[k] > 0)) { j = k; @@ -4467,18 +4507,18 @@ void overheadeditor(void) { newnumsectors = numsectors; newnumwalls = numwalls; - for(i=0;i= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -4498,7 +4538,7 @@ void overheadeditor(void) } 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); @@ -4638,7 +4678,7 @@ void overheadeditor(void) 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) { @@ -4712,7 +4752,7 @@ void overheadeditor(void) wall[newnumwalls].y = mousyplc; wall[newnumwalls].nextsector = -1; wall[newnumwalls].nextwall = -1; - for(i=0;i= suckwall) wall[i].nextwall += j; @@ -4783,12 +4823,12 @@ void overheadeditor(void) 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; @@ -4941,7 +4981,7 @@ void overheadeditor(void) //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,(short)j); if ((k != i) && (k != loopnum)) @@ -4965,7 +5005,7 @@ void overheadeditor(void) } //fix all next pointers on old sector line - for(j=numwalls;j= 0) { @@ -4977,7 +5017,7 @@ void overheadeditor(void) } } //set all next pointers on split - for(j=numwalls;j= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -5030,7 +5070,7 @@ void overheadeditor(void) //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; @@ -5098,7 +5138,7 @@ void overheadeditor(void) //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,(short)j); if ((k != i) && (k != loopnumofsector(splitsect,splitstartwall)) && (k != loopnumofsector(splitsect,splitendwall))) @@ -5117,7 +5157,7 @@ void overheadeditor(void) } //fix all next pointers on old sector line - for(j=numwalls;j= 0) { @@ -5147,7 +5187,7 @@ void overheadeditor(void) //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; @@ -5155,7 +5195,7 @@ void overheadeditor(void) deletesector(splitsect); //Check pointers - for(j=numwalls-k;j= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -5177,27 +5217,27 @@ void overheadeditor(void) 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]--; } @@ -5286,18 +5326,18 @@ void overheadeditor(void) { newnumsectors = numsectors; newnumwalls = numwalls; - for(i=0;i= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -5317,7 +5357,7 @@ void overheadeditor(void) } 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((short)i); j++; } - for(i=0;i>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); @@ -5790,7 +5830,7 @@ CANCEL: break; } } - while(keystatus[1] || keystatus[0x2e]) + while (keystatus[1] || keystatus[0x2e]) { keystatus[1] = 0; keystatus[0x2e] = 0; @@ -5821,11 +5861,11 @@ CANCEL: //nextpage(); } - for(i=0;i= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); @@ -5875,7 +5915,7 @@ long getlinehighlight(long xplc, long yplc) return(-1); dist = 1024; closest = numwalls-1; - for(i=0;i= 256) - for(i=0;i= 256) + for (i=0;i>1);i++) + for (i=numwalls;i>1);i++) { j = numwalls+newnumwalls-i-1; templong = wall[i].x; wall[i].x = wall[j].x; wall[j].x = templong; @@ -6047,7 +6087,7 @@ void insertpoint(short linehighlight, long dax, long day) sucksect = sectorofwall((short)j); sector[sucksect].wallnum++; - for(i=sucksect+1;i= startwall) wall[i].nextsector--; return(0); @@ -6160,11 +6200,11 @@ void fixspritesectors(void) { long 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((short)i); - for(i=0;i= getceilzofslope(j,dax,day)) if (sprite[i].z-daz <= getflorzofslope(j,dax,day)) @@ -6191,16 +6231,16 @@ long movewalls(long start, long 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; @@ -6227,11 +6267,11 @@ long checksectorpointer(short i, short sectnum) wall[i].nextsector = -1; wall[i].nextwall = -1; - for(j=0;j=0; i--) if (!dir->prev) break; else dir=dir->prev; - for(i=0; inext) { + for (i=listsize/2-1; i>=0; i--) if (!dir->prev) break; else dir=dir->prev; + for (i=0; inext) { int c = dir->type == CACHE1D_FIND_DIR ? 4 : 3; memset(buffer,0,sizeof(buffer)); strncpy(buffer,dir->name,25); @@ -6495,8 +6535,8 @@ long menuselect(void) if (findfileshigh) { dir = findfileshigh; - for(i=listsize/2-1; i>=0; i--) if (!dir->prev) break; else dir=dir->prev; - for(i=0; inext) { + for (i=listsize/2-1; i>=0; i--) if (!dir->prev) break; else dir=dir->prev; + for (i=0; inext) { if (dir == findfileshigh) { if (currentlist == 1) printext16(240,16+8*i,7|8,0,"->",0); printext16(240+24,16+8*i,7|8,0,dir->name,0); @@ -6527,9 +6567,9 @@ long menuselect(void) ch = bgetchar(); { // JBF 20040208: seek to first name matching pressed character CACHE1D_FIND_REC *seeker = currentlist ? findfiles : finddirs; - if((keystatus[0xc7]|keystatus[0xcf]) > 0) // home/end + if ((keystatus[0xc7]|keystatus[0xcf]) > 0) // home/end { - while(keystatus[0xcf]?seeker->next:seeker->prev) + while (keystatus[0xcf]?seeker->next:seeker->prev) seeker = keystatus[0xcf]?seeker->next:seeker->prev; if (seeker) { if (currentlist) findfileshigh = seeker; @@ -6538,12 +6578,12 @@ long menuselect(void) ch = keystatus[0xcf]?80:72; keystatus[0xc7] = keystatus[0xcf] = 0; } - else if((keystatus[0xc9]|keystatus[0xd1]) > 0) // page up/down + else if ((keystatus[0xc9]|keystatus[0xd1]) > 0) // page up/down { seeker = currentlist?findfileshigh:finddirshigh; i = (ydim2d-STATUS2DSIZ-48)>>3; - while(i>0) { - if(keystatus[0xd1]?seeker->next:seeker->prev) + while (i>0) { + if (keystatus[0xd1]?seeker->next:seeker->prev) seeker = keystatus[0xd1]?seeker->next:seeker->prev; i--; } @@ -6660,7 +6700,7 @@ long fillsector(short sectnum, char fillcolor) maxy = uborder; startwall = sector[sectnum].wallptr; endwall = startwall + sector[sectnum].wallnum - 1; - for(z=startwall;z<=endwall;z++) + for (z=startwall;z<=endwall;z++) { y1 = (((wall[z].y-posy)*zoom)>>14)+midydim16; y2 = (((wall[wall[z].point2].y-posy)*zoom)>>14)+midydim16; @@ -6672,12 +6712,12 @@ long fillsector(short 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 = posy+(((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; @@ -6697,7 +6737,7 @@ long fillsector(short sectnum, char fillcolor) } if (fillcnt > 0) { - for(z=1;z= 0) { j = wall[j].point2; - for(k=0;k=0;i--) + for (i=7;i>=0;i--) { if (((k^a)&0x8000) > 0) a = ((a<<1)&65535) ^ 0x1021; //0x1021 = genpoly @@ -7347,7 +7387,7 @@ void AlignWalls(long nWall0, long z0, long nWall1, long z1, long nTile) z1 = GetWallZPeg(nWall1); - for(n=(picsiz[nTile]>>4);((1<>4);((1<>(n+3))); diff --git a/polymer/build/src/cache1d.c b/polymer/build/src/cache1d.c index 5891645fc..3d5d0df07 100644 --- a/polymer/build/src/cache1d.c +++ b/polymer/build/src/cache1d.c @@ -23,7 +23,7 @@ static long 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)); } @@ -65,7 +65,7 @@ static long cachesize = 0; long cachecount = 0; char zerochar = 0; long cachestart = 0, cacnum = 0, agecount = 0; -typedef struct { long *hand, leng; char *lock; } cactype; +typedef struct { long *hand, leng; char *lock ; } cactype; cactype cac[MAXCACHEOBJECTS]; static long lockrecip[200]; @@ -83,7 +83,7 @@ void initcache(long dacachestart, long dacachesize) { long 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); cachestart = dacachestart; cachesize = dacachesize; @@ -115,13 +115,13 @@ void allocache(long *newhandle, long 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; } @@ -141,7 +141,7 @@ void allocache(long *newhandle, long 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 @@ -167,7 +167,7 @@ void allocache(long *newhandle, long 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; } @@ -177,7 +177,7 @@ void suckcache(long *suckptr) long 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) @@ -221,7 +221,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]); @@ -522,7 +522,7 @@ void uninitsinglegroupfile(long grphandle) } // fix up the open files that need attention - for(i=0;i= 254) // external file (255) or ZIPped file (254) continue; else if (filegrp[i] == grpnum) // close file in group we closed @@ -536,7 +536,7 @@ void uninitgroupfile(void) { long i; - for(i=numgroupfiles-1;i>=0;i--) + for (i=numgroupfiles-1;i>=0;i--) if (groupfil[i] != -1) { kfree(gfilelist[i]); @@ -547,7 +547,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]]) @@ -688,13 +688,16 @@ long klseek(long handle, long offset, long whence) if (groupfil[groupnum] != -1) { - switch(whence) + switch (whence) { - case BSEEK_SET: filepos[handle] = offset; break; - case BSEEK_END: i = filehan[handle]; + case BSEEK_SET: + filepos[handle] = offset; break; + case BSEEK_END: + i = filehan[handle]; filepos[handle] = (gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i])+offset; break; - case BSEEK_CUR: filepos[handle] += offset; break; + case BSEEK_CUR: + filepos[handle] += offset; break; } return(filepos[handle]); } @@ -902,7 +905,8 @@ CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int type) case -1: goto failure; //case 1: initprintf("%s:%s dropped for lower priority\n", d,dirent->name); break; //case 0: initprintf("%s:%s accepted\n", d,dirent->name); break; - default: break; + default: + break; } } Bclosedir(dir); @@ -970,10 +974,12 @@ CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int type) // the entry is in the clear switch (klistaddentry(&rec, buf, ftype, CACHE1D_SOURCE_ZIP)) { - case -1: goto failure; + case -1: + goto failure; //case 1: initprintf(":%s dropped for lower priority\n", buf); break; //case 0: initprintf(":%s accepted\n", buf); break; - default: break; + default: + break; } } } @@ -985,15 +991,17 @@ CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int type) 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; switch (klistaddentry(&rec, buf, CACHE1D_FIND_FILE, CACHE1D_SOURCE_GRP)) { - case -1: goto failure; + case -1: + goto failure; //case 1: initprintf(":%s dropped for lower priority\n", workspace); break; //case 0: initprintf(":%s accepted\n", workspace); break; - default: break; + default: + break; } } } @@ -1052,7 +1060,7 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } copybufbyte(lzwbuf4,ptr,(long)dasizeof); k += (long)dasizeof; - for(i=1;i= kgoal) { @@ -1060,7 +1068,7 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } if (kread(fil,lzwbuf5,(long)leng) != leng) return -1; k = 0; kgoal = lzwuncompress(lzwbuf5,(long)leng,lzwbuf4); } - for(j=0;j LZWSIZE) { count *= dasizeof; dasizeof = 1; } copybufbyte(lzwbuf4,ptr,(long)dasizeof); k += (long)dasizeof; - for(i=1;i= kgoal) { @@ -1099,7 +1107,7 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } if (Bfread(lzwbuf5,(long)leng,1,fil) != 1) return -1; k = 0; kgoal = lzwuncompress(lzwbuf5,(long)leng,lzwbuf4); } - for(j=0;j LZWSIZE) { count *= dasizeof; dasizeof = 1; } Bwrite(fil,&swleng,2); Bwrite(fil,lzwbuf5,(long)leng); } - for(i=1;i LZWSIZE-dasizeof) { @@ -1176,9 +1184,9 @@ if (dasizeof > LZWSIZE) { count *= dasizeof; dasizeof = 1; } Bfwrite(&swleng,2,1,fil); Bfwrite(lzwbuf5,(long)leng,1,fil); } - for(i=1;i LZWSIZE-dasizeof) { @@ -1201,7 +1209,7 @@ static long lzwcompress(char *lzwinbuf, long uncompleng, char *lzwoutbuf) long bytecnt1, bitcnt, numbits, oneupnumbits; short *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); @@ -1253,7 +1261,7 @@ static long lzwcompress(char *lzwinbuf, long uncompleng, char *lzwoutbuf) return((bitcnt+7)>>3); } shortptr[1] = (short)0; - for(i=0;i>2); return((long)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 @@ -1283,11 +1291,11 @@ static long lzwuncompress(char *lzwinbuf, long 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/build/src/compat.c b/polymer/build/src/compat.c index d9ef2c66e..c06ed8fda 100644 --- a/polymer/build/src/compat.c +++ b/polymer/build/src/compat.c @@ -95,9 +95,12 @@ bssize_t Bread(int fd, void *buf, bsize_t count) int Blseek(int fildes, int offset, int whence) { switch (whence) { - case BSEEK_SET: whence=SEEK_SET; break; - case BSEEK_CUR: whence=SEEK_CUR; break; - case BSEEK_END: whence=SEEK_END; break; + case BSEEK_SET: + whence=SEEK_SET; break; + case BSEEK_CUR: + whence=SEEK_CUR; break; + case BSEEK_END: + whence=SEEK_END; break; } return lseek(fildes,offset,whence); } @@ -686,7 +689,7 @@ long 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/build/src/config.c b/polymer/build/src/config.c index dfd3f6d17..a0587528c 100644 --- a/polymer/build/src/config.c +++ b/polymer/build/src/config.c @@ -13,7 +13,8 @@ static long vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400}, {360,400},{640,350},{640,400},{640,480},{800,600}, - {1024,768},{1280,1024},{1600,1200}}; + {1024,768},{1280,1024},{1600,1200} + }; static int readconfig(BFILE *fp, const char *key, char *value, unsigned len) { diff --git a/polymer/build/src/defs.c b/polymer/build/src/defs.c index 979a0af90..8b5187807 100644 --- a/polymer/build/src/defs.c +++ b/polymer/build/src/defs.c @@ -204,7 +204,7 @@ static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens) tok = scriptfile_gettoken(sf); if (!tok) return T_EOF; - for(i=0;ifilename,scriptfile_getlinum(script,cmdtokptr)); - } else { - defsparser(included); - scriptfile_close(included); - } + included = scriptfile_fromfile(fn); + if (!included) { + initprintf("Warning: Failed including %s on line %s:%d\n", + fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); + } else { + defsparser(included); + scriptfile_close(included); } - break; } + break; + } case T_DEFINE: - { - char *name; - int number; + { + char *name; + int number; - if (scriptfile_getstring(script,&name)) break; - if (scriptfile_getsymbol(script,&number)) break; + if (scriptfile_getstring(script,&name)) break; + if (scriptfile_getsymbol(script,&number)) break; - if (scriptfile_addsymbolvalue(name,number) < 0) - initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", - name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); - break; - } + if (scriptfile_addsymbolvalue(name,number) < 0) + initprintf("Warning: Symbol %s was NOT redefined to %d on line %s:%d\n", + name,number,script->filename,scriptfile_getlinum(script,cmdtokptr)); + break; + } - // OLD (DEPRECATED) DEFINITION SYNTAX + // OLD (DEPRECATED) DEFINITION SYNTAX case T_DEFINETEXTURE: - { - int tile,pal,fnoo,i; - char *fn; + { + int tile,pal,fnoo,i; + char *fn; - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getsymbol(script,&pal)) break; - if (scriptfile_getnumber(script,&fnoo)) break; //x-center - if (scriptfile_getnumber(script,&fnoo)) break; //y-center - if (scriptfile_getnumber(script,&fnoo)) break; //x-size - if (scriptfile_getnumber(script,&fnoo)) break; //y-size - if (scriptfile_getstring(script,&fn)) break; - - if ((i = kopen4load(fn,0)) < 0) { - initprintf("Error: file '%s' does not exist\n",fn); - break; - } else kclose(i); - - hicsetsubsttex(tile,pal,fn,-1.0,0); - } - break; - case T_DEFINESKYBOX: - { - int tile,pal,i,j; - char *fn[6],happy=1; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getsymbol(script,&pal)) break; - if (scriptfile_getsymbol(script,&i)) break; //future expansion - for (i=0;i<6;i++) { - if (scriptfile_getstring(script,&fn[i])) break; //grab the 6 faces - if ((j = kopen4load(fn[i],0)) < 0) { - initprintf("Error: file '%s' does not exist\n",fn[i]); - happy = 0; - } else kclose(j); - } - if (i < 6 || !happy) break; - hicsetskybox(tile,pal,fn); - } - break; - case T_DEFINETINT: - { - int pal, r,g,b,f; - - if (scriptfile_getsymbol(script,&pal)) break; - if (scriptfile_getnumber(script,&r)) break; - if (scriptfile_getnumber(script,&g)) break; - if (scriptfile_getnumber(script,&b)) break; - if (scriptfile_getnumber(script,&f)) break; //effects - hicsetpalettetint(pal,r,g,b,f); - } - break; - case T_NEGSHADEOFFSET: - { - double val; - extern float glnegshadeoffset; - - if (scriptfile_getdouble(script,&val)) break; -#if defined(POLYMOST) && defined(USE_OPENGL) - glnegshadeoffset = val; -#endif - } - break; - case T_NEGSHADESCALE: - { - double val; - extern float glnegshadescale; - - if (scriptfile_getdouble(script,&val)) break; -#if defined(POLYMOST) && defined(USE_OPENGL) - glnegshadescale = val; -#endif - } - break; - case T_SHADESCALE: - { - double val; - extern float glshadescale; - - if (scriptfile_getdouble(script,&val)) break; -#if defined(POLYMOST) && defined(USE_OPENGL) - glshadescale = val; -#endif - } - break; - case T_SPRSHADESCALE: - { - double val; - extern float glsprshadescale; - - if (scriptfile_getdouble(script,&val)) break; -#if defined(POLYMOST) && defined(USE_OPENGL) - glsprshadescale = val; -#endif - } - break; - case T_ALPHAHACK: - { - int tile; - double alpha; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getdouble(script,&alpha)) break; -#if defined(POLYMOST) && defined(USE_OPENGL) - if ((unsigned long)tile < MAXTILES) alphahackarray[tile] = alpha; -#endif - } - break; - case T_ALPHAHACKRANGE: - { - int tilenume1,tilenume2,i; - double alpha; - - if (scriptfile_getsymbol(script,&tilenume1)) break; - if (scriptfile_getsymbol(script,&tilenume2)) break; - if (scriptfile_getdouble(script,&alpha)) break; - if (tilenume2 < tilenume1) { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - i = tilenume2; - tilenume2 = tilenume1; - tilenume1 = i; - } -#if defined(POLYMOST) && defined(USE_OPENGL) - if ((tilenume1 >= 0 && tilenume1 < MAXTILES) && (tilenume2 >= 0 && tilenume2 < MAXTILES)) - { - for (i=tilenume1;i<=tilenume2;i++) - { - if ((unsigned long)i < MAXTILES) - alphahackarray[i] = alpha; - } - } -#endif - } - break; - case T_SPRITECOL: - { - int tile,col,col2; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getnumber(script,&col)) break; - if (scriptfile_getnumber(script,&col2)) break; - if ((unsigned long)tile < MAXTILES) - { - spritecol2d[tile][0] = col; - spritecol2d[tile][1] = col2; - } - } - break; - case T_2DCOL: - { - int col,b,g,r; - - if (scriptfile_getnumber(script,&col)) break; - if (scriptfile_getnumber(script,&r)) break; - if (scriptfile_getnumber(script,&g)) break; - if (scriptfile_getnumber(script,&b)) break; - - if (col < 256) { - vgapal16[col*4+0] = b; // blue - vgapal16[col*4+1] = g; // green - vgapal16[col*4+2] = r; // red - } - } - break; - case T_FOGPAL: - { - int p,r,g,b,j; - char tempbuf[256]; - - if (scriptfile_getnumber(script,&p)) break; - if (scriptfile_getnumber(script,&r)) break; - if (scriptfile_getnumber(script,&g)) break; - if (scriptfile_getnumber(script,&b)) break; - - for (j = 0; j < 256; j++) - tempbuf[j] = j; - makepalookup(p, tempbuf, r, g, b, 1); - } - break; - case T_LOADGRP: - { - char *bs; - scriptfile_getstring(script,&bs); - } - break; - case T_DUMMYTILE: - { - int tile, xsiz, ysiz, j; - extern char faketile[MAXTILES]; - - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getsymbol(script,&xsiz)) break; - if (scriptfile_getsymbol(script,&ysiz)) break; - - if(xsiz > 0 && ysiz > 0) - { - tilesizx[tile] = xsiz; - tilesizy[tile] = ysiz; - faketile[tile] = 1; - picanm[tile] = 0; - - j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; - picsiz[tile] = ((char)j); - j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; - picsiz[tile] += ((char)(j<<4)); - } + if (scriptfile_getsymbol(script,&tile)) break; + if (scriptfile_getsymbol(script,&pal)) break; + if (scriptfile_getnumber(script,&fnoo)) break; //x-center + if (scriptfile_getnumber(script,&fnoo)) break; //y-center + if (scriptfile_getnumber(script,&fnoo)) break; //x-size + if (scriptfile_getnumber(script,&fnoo)) break; //y-size + if (scriptfile_getstring(script,&fn)) break; + if ((i = kopen4load(fn,0)) < 0) { + initprintf("Error: file '%s' does not exist\n",fn); break; + } else kclose(i); + + hicsetsubsttex(tile,pal,fn,-1.0,0); + } + break; + case T_DEFINESKYBOX: + { + int tile,pal,i,j; + char *fn[6],happy=1; + + if (scriptfile_getsymbol(script,&tile)) break; + if (scriptfile_getsymbol(script,&pal)) break; + if (scriptfile_getsymbol(script,&i)) break; //future expansion + for (i=0;i<6;i++) { + if (scriptfile_getstring(script,&fn[i])) break; //grab the 6 faces + if ((j = kopen4load(fn[i],0)) < 0) { + initprintf("Error: file '%s' does not exist\n",fn[i]); + happy = 0; + } else kclose(j); } - case T_DUMMYTILERANGE: + if (i < 6 || !happy) break; + hicsetskybox(tile,pal,fn); + } + break; + case T_DEFINETINT: + { + int pal, r,g,b,f; + + if (scriptfile_getsymbol(script,&pal)) break; + if (scriptfile_getnumber(script,&r)) break; + if (scriptfile_getnumber(script,&g)) break; + if (scriptfile_getnumber(script,&b)) break; + if (scriptfile_getnumber(script,&f)) break; //effects + hicsetpalettetint(pal,r,g,b,f); + } + break; + case T_NEGSHADEOFFSET: + { + double val; + extern float glnegshadeoffset; + + if (scriptfile_getdouble(script,&val)) break; +#if defined(POLYMOST) && defined(USE_OPENGL) + glnegshadeoffset = val; +#endif + } + break; + case T_NEGSHADESCALE: + { + double val; + extern float glnegshadescale; + + if (scriptfile_getdouble(script,&val)) break; +#if defined(POLYMOST) && defined(USE_OPENGL) + glnegshadescale = val; +#endif + } + break; + case T_SHADESCALE: + { + double val; + extern float glshadescale; + + if (scriptfile_getdouble(script,&val)) break; +#if defined(POLYMOST) && defined(USE_OPENGL) + glshadescale = val; +#endif + } + break; + case T_SPRSHADESCALE: + { + double val; + extern float glsprshadescale; + + if (scriptfile_getdouble(script,&val)) break; +#if defined(POLYMOST) && defined(USE_OPENGL) + glsprshadescale = val; +#endif + } + break; + case T_ALPHAHACK: + { + int tile; + double alpha; + + if (scriptfile_getsymbol(script,&tile)) break; + if (scriptfile_getdouble(script,&alpha)) break; +#if defined(POLYMOST) && defined(USE_OPENGL) + if ((unsigned long)tile < MAXTILES) alphahackarray[tile] = alpha; +#endif + } + break; + case T_ALPHAHACKRANGE: + { + int tilenume1,tilenume2,i; + double alpha; + + if (scriptfile_getsymbol(script,&tilenume1)) break; + if (scriptfile_getsymbol(script,&tilenume2)) break; + if (scriptfile_getdouble(script,&alpha)) break; + if (tilenume2 < tilenume1) { + initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); + i = tilenume2; + tilenume2 = tilenume1; + tilenume1 = i; + } +#if defined(POLYMOST) && defined(USE_OPENGL) + if ((tilenume1 >= 0 && tilenume1 < MAXTILES) && (tilenume2 >= 0 && tilenume2 < MAXTILES)) { - int tile1,tile2,xsiz,ysiz,i,j; - extern char faketile[MAXTILES]; - - if (scriptfile_getnumber(script,&tile1)) break; - if (scriptfile_getnumber(script,&tile2)) break; - if (scriptfile_getnumber(script,&xsiz)) break; - if (scriptfile_getnumber(script,&ysiz)) break; - if (tile2 < tile1) { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - i = tile2; - tile2 = tile1; - tile1 = i; - } - if ((tile1 >= 0 && tile1 < MAXTILES) && (tile2 >= 0 && tile2 < MAXTILES)) + for (i=tilenume1;i<=tilenume2;i++) { - for (i=tile1;i<=tile2;i++) - { - if ((unsigned long)i < MAXTILES) - { - if(xsiz > 0 && ysiz > 0) - { - tilesizx[i] = xsiz; - tilesizy[i] = ysiz; - faketile[i] = 1; - picanm[i] = 0; + if ((unsigned long)i < MAXTILES) + alphahackarray[i] = alpha; + } + } +#endif + } + break; + case T_SPRITECOL: + { + int tile,col,col2; - j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; - picsiz[i] = ((char)j); - j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; - picsiz[i] += ((char)(j<<4)); - } + if (scriptfile_getsymbol(script,&tile)) break; + if (scriptfile_getnumber(script,&col)) break; + if (scriptfile_getnumber(script,&col2)) break; + if ((unsigned long)tile < MAXTILES) + { + spritecol2d[tile][0] = col; + spritecol2d[tile][1] = col2; + } + } + break; + case T_2DCOL: + { + int col,b,g,r; + + if (scriptfile_getnumber(script,&col)) break; + if (scriptfile_getnumber(script,&r)) break; + if (scriptfile_getnumber(script,&g)) break; + if (scriptfile_getnumber(script,&b)) break; + + if (col < 256) { + vgapal16[col*4+0] = b; // blue + vgapal16[col*4+1] = g; // green + vgapal16[col*4+2] = r; // red + } + } + break; + case T_FOGPAL: + { + int p,r,g,b,j; + char tempbuf[256]; + + if (scriptfile_getnumber(script,&p)) break; + if (scriptfile_getnumber(script,&r)) break; + if (scriptfile_getnumber(script,&g)) break; + if (scriptfile_getnumber(script,&b)) break; + + for (j = 0; j < 256; j++) + tempbuf[j] = j; + makepalookup(p, tempbuf, r, g, b, 1); + } + break; + case T_LOADGRP: + { + char *bs; + scriptfile_getstring(script,&bs); + } + break; + case T_DUMMYTILE: + { + int tile, xsiz, ysiz, j; + extern char faketile[MAXTILES]; + + if (scriptfile_getsymbol(script,&tile)) break; + if (scriptfile_getsymbol(script,&xsiz)) break; + if (scriptfile_getsymbol(script,&ysiz)) break; + + if (xsiz > 0 && ysiz > 0) + { + tilesizx[tile] = xsiz; + tilesizy[tile] = ysiz; + faketile[tile] = 1; + picanm[tile] = 0; + + j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; + picsiz[tile] = ((char)j); + j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; + picsiz[tile] += ((char)(j<<4)); + } + + break; + } + case T_DUMMYTILERANGE: + { + int tile1,tile2,xsiz,ysiz,i,j; + extern char faketile[MAXTILES]; + + if (scriptfile_getnumber(script,&tile1)) break; + if (scriptfile_getnumber(script,&tile2)) break; + if (scriptfile_getnumber(script,&xsiz)) break; + if (scriptfile_getnumber(script,&ysiz)) break; + if (tile2 < tile1) { + initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); + i = tile2; + tile2 = tile1; + tile1 = i; + } + if ((tile1 >= 0 && tile1 < MAXTILES) && (tile2 >= 0 && tile2 < MAXTILES)) + { + for (i=tile1;i<=tile2;i++) + { + if ((unsigned long)i < MAXTILES) + { + if (xsiz > 0 && ysiz > 0) + { + tilesizx[i] = xsiz; + tilesizy[i] = ysiz; + faketile[i] = 1; + picanm[i] = 0; + + j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; + picsiz[i] = ((char)j); + j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; + picsiz[i] += ((char)(j<<4)); } } } - break; } + break; + } case T_DEFINEMODEL: - { - char *modelfn; - double scale; - int shadeoffs; + { + char *modelfn; + double scale; + int shadeoffs; - if (scriptfile_getstring(script,&modelfn)) break; - if (scriptfile_getdouble(script,&scale)) break; - if (scriptfile_getnumber(script,&shadeoffs)) break; + if (scriptfile_getstring(script,&modelfn)) break; + if (scriptfile_getdouble(script,&scale)) break; + if (scriptfile_getnumber(script,&shadeoffs)) break; #if defined(POLYMOST) && defined(USE_OPENGL) - lastmodelid = md_loadmodel(modelfn); - if (lastmodelid < 0) { - initprintf("Failure loading MD2/MD3 model \"%s\"\n", modelfn); - break; - } - md_setmisc(lastmodelid,(float)scale, shadeoffs,0.0); -#endif - modelskin = lastmodelskin = 0; - seenframe = 0; + lastmodelid = md_loadmodel(modelfn); + if (lastmodelid < 0) { + initprintf("Failure loading MD2/MD3 model \"%s\"\n", modelfn); + break; } - break; + md_setmisc(lastmodelid,(float)scale, shadeoffs,0.0); +#endif + modelskin = lastmodelskin = 0; + seenframe = 0; + } + break; case T_DEFINEMODELFRAME: - { - char *framename, happy=1; - int ftilenume, ltilenume, tilex; + { + char *framename, happy=1; + int ftilenume, ltilenume, tilex; - if (scriptfile_getstring(script,&framename)) break; - if (scriptfile_getnumber(script,&ftilenume)) break; //first tile number - if (scriptfile_getnumber(script,<ilenume)) break; //last tile number (inclusive) - if (ltilenume < ftilenume) { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - tilex = ftilenume; - ftilenume = ltilenume; - ltilenume = tilex; - } + if (scriptfile_getstring(script,&framename)) break; + if (scriptfile_getnumber(script,&ftilenume)) break; //first tile number + if (scriptfile_getnumber(script,<ilenume)) break; //last tile number (inclusive) + if (ltilenume < ftilenume) { + initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); + tilex = ftilenume; + ftilenume = ltilenume; + ltilenume = tilex; + } - if (lastmodelid < 0) { - initprintf("Warning: Ignoring frame definition.\n"); + if (lastmodelid < 0) { + initprintf("Warning: Ignoring frame definition.\n"); + break; + } +#if defined(POLYMOST) && defined(USE_OPENGL) + for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) { + switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin))) { + case 0: + break; + case -1: + happy = 0; break; // invalid model id!? + case -2: + initprintf("Invalid tile number on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + happy = 0; + break; + case -3: + initprintf("Invalid frame name on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + happy = 0; break; } -#if defined(POLYMOST) && defined(USE_OPENGL) - for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) { - switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin))) { - case 0: break; - case -1: happy = 0; break; // invalid model id!? - case -2: initprintf("Invalid tile number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - happy = 0; - break; - case -3: initprintf("Invalid frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - happy = 0; - break; - } - } -#endif - seenframe = 1; } - break; +#endif + seenframe = 1; + } + break; case T_DEFINEMODELANIM: - { - char *startframe, *endframe; - int flags; - double dfps; + { + char *startframe, *endframe; + int flags; + double dfps; - if (scriptfile_getstring(script,&startframe)) break; - if (scriptfile_getstring(script,&endframe)) break; - if (scriptfile_getdouble(script,&dfps)) break; //animation frame rate - if (scriptfile_getnumber(script,&flags)) break; + if (scriptfile_getstring(script,&startframe)) break; + if (scriptfile_getstring(script,&endframe)) break; + if (scriptfile_getdouble(script,&dfps)) break; //animation frame rate + if (scriptfile_getnumber(script,&flags)) break; - if (lastmodelid < 0) { - initprintf("Warning: Ignoring animation definition.\n"); - break; - } -#if defined(POLYMOST) && defined(USE_OPENGL) - switch (md_defineanimation(lastmodelid, startframe, endframe, (int)(dfps*(65536.0*.001)), flags)) { - case 0: break; - case -1: break; // invalid model id!? - case -2: initprintf("Invalid starting frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - case -3: initprintf("Invalid ending frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - case -4: initprintf("Out of memory on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } -#endif + if (lastmodelid < 0) { + initprintf("Warning: Ignoring animation definition.\n"); + break; } - break; +#if defined(POLYMOST) && defined(USE_OPENGL) + switch (md_defineanimation(lastmodelid, startframe, endframe, (int)(dfps*(65536.0*.001)), flags)) { + case 0: + break; + case -1: + break; // invalid model id!? + case -2: + initprintf("Invalid starting frame name on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; + case -3: + initprintf("Invalid ending frame name on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; + case -4: + initprintf("Out of memory on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; + } +#endif + } + break; case T_DEFINEMODELSKIN: - { - int palnum, palnumer; - char *skinfn; + { + int palnum, palnumer; + char *skinfn; - if (scriptfile_getsymbol(script,&palnum)) break; - if (scriptfile_getstring(script,&skinfn)) break; //skin filename + if (scriptfile_getsymbol(script,&palnum)) break; + if (scriptfile_getstring(script,&skinfn)) break; //skin filename - // if we see a sequence of definemodelskin, then a sequence of definemodelframe, - // and then a definemodelskin, we need to increment the skin counter. - // - // definemodel "mymodel.md2" 1 1 - // definemodelskin 0 "normal.png" // skin 0 - // definemodelskin 21 "normal21.png" - // definemodelframe "foo" 1000 1002 // these use skin 0 - // definemodelskin 0 "wounded.png" // skin 1 - // definemodelskin 21 "wounded21.png" - // definemodelframe "foo2" 1003 1004 // these use skin 1 - // selectmodelskin 0 // resets to skin 0 - // definemodelframe "foo3" 1005 1006 // these use skin 0 - if (seenframe) { modelskin = ++lastmodelskin; } - seenframe = 0; + // if we see a sequence of definemodelskin, then a sequence of definemodelframe, + // and then a definemodelskin, we need to increment the skin counter. + // + // definemodel "mymodel.md2" 1 1 + // definemodelskin 0 "normal.png" // skin 0 + // definemodelskin 21 "normal21.png" + // definemodelframe "foo" 1000 1002 // these use skin 0 + // definemodelskin 0 "wounded.png" // skin 1 + // definemodelskin 21 "wounded21.png" + // definemodelframe "foo2" 1003 1004 // these use skin 1 + // selectmodelskin 0 // resets to skin 0 + // definemodelframe "foo3" 1005 1006 // these use skin 0 + if (seenframe) { modelskin = ++lastmodelskin; } + seenframe = 0; #if defined(POLYMOST) && defined(USE_OPENGL) - switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), 0)) { - case 0: break; - case -1: break; // invalid model id!? - case -2: initprintf("Invalid skin filename on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - case -3: initprintf("Invalid palette number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - case -4: initprintf("Out of memory on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } -#endif + switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), 0)) { + case 0: + break; + case -1: + break; // invalid model id!? + case -2: + initprintf("Invalid skin filename on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; + case -3: + initprintf("Invalid palette number on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; + case -4: + initprintf("Out of memory on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; } - break; +#endif + } + break; case T_SELECTMODELSKIN: - { - if (scriptfile_getsymbol(script,&modelskin)) break; - } - break; + { + if (scriptfile_getsymbol(script,&modelskin)) break; + } + break; case T_DEFINEVOXEL: - { - char *fn; + { + char *fn; - if (scriptfile_getstring(script,&fn)) break; //voxel filename + if (scriptfile_getstring(script,&fn)) break; //voxel filename - if (nextvoxid == MAXVOXELS) { - initprintf("Maximum number of voxels already defined.\n"); - break; - } + if (nextvoxid == MAXVOXELS) { + initprintf("Maximum number of voxels already defined.\n"); + break; + } #ifdef SUPERBUILD - if (qloadkvx(nextvoxid, fn)) { - initprintf("Failure loading voxel file \"%s\"\n",fn); - break; - } - - lastvoxid = nextvoxid++; -#endif + if (qloadkvx(nextvoxid, fn)) { + initprintf("Failure loading voxel file \"%s\"\n",fn); + break; } - break; + + lastvoxid = nextvoxid++; +#endif + } + break; case T_DEFINEVOXELTILES: - { - int ftilenume, ltilenume, tilex; + { + int ftilenume, ltilenume, tilex; - if (scriptfile_getnumber(script,&ftilenume)) break; //1st tile # - if (scriptfile_getnumber(script,<ilenume)) break; //last tile # + if (scriptfile_getnumber(script,&ftilenume)) break; //1st tile # + if (scriptfile_getnumber(script,<ilenume)) break; //last tile # - if (ltilenume < ftilenume) { - initprintf("Warning: backwards tile range on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - tilex = ftilenume; - ftilenume = ltilenume; - ltilenume = tilex; - } - if (ltilenume < 0 || ftilenume >= MAXTILES) { - initprintf("Invalid tile range on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - - if (lastvoxid < 0) { - initprintf("Warning: Ignoring voxel tiles definition.\n"); - break; - } -#ifdef SUPERBUILD - for (tilex = ftilenume; tilex <= ltilenume; tilex++) { - tiletovox[tilex] = lastvoxid; - } -#endif + if (ltilenume < ftilenume) { + initprintf("Warning: backwards tile range on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + tilex = ftilenume; + ftilenume = ltilenume; + ltilenume = tilex; + } + if (ltilenume < 0 || ftilenume >= MAXTILES) { + initprintf("Invalid tile range on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; } - break; - // NEW (ENCOURAGED) DEFINITION SYNTAX + if (lastvoxid < 0) { + initprintf("Warning: Ignoring voxel tiles definition.\n"); + break; + } +#ifdef SUPERBUILD + for (tilex = ftilenume; tilex <= ltilenume; tilex++) { + tiletovox[tilex] = lastvoxid; + } +#endif + } + break; + + // NEW (ENCOURAGED) DEFINITION SYNTAX case T_MODEL: - { - char *modelend, *modelfn; - double scale=1.0, mzadd=0.0; - int shadeoffs=0; + { + char *modelend, *modelfn; + double scale=1.0, mzadd=0.0; + int shadeoffs=0; - modelskin = lastmodelskin = 0; - seenframe = 0; + modelskin = lastmodelskin = 0; + seenframe = 0; - if (scriptfile_getstring(script,&modelfn)) break; + if (scriptfile_getstring(script,&modelfn)) break; #if defined(POLYMOST) && defined(USE_OPENGL) - lastmodelid = md_loadmodel(modelfn); - if (lastmodelid < 0) { - initprintf("Failure loading MD2/MD3 model \"%s\"\n", modelfn); - break; - } -#endif - if (scriptfile_getbraces(script,&modelend)) break; - while (script->textptr < modelend) { - switch (getatoken(script,modeltokens,sizeof(modeltokens)/sizeof(tokenlist))) { - //case T_ERROR: initprintf("Error on line %s:%d in model tokens\n", script->filename,script->linenum); break; - case T_SCALE: scriptfile_getdouble(script,&scale); break; - case T_SHADE: scriptfile_getnumber(script,&shadeoffs); break; - case T_ZADD: scriptfile_getdouble(script,&mzadd); break; - case T_FRAME: - { - char *frametokptr = script->ltextptr; - char *frameend, *framename = 0, happy=1; - int ftilenume = -1, ltilenume = -1, tilex = 0; - - if (scriptfile_getbraces(script,&frameend)) break; - while (script->textptr < frameend) { - switch(getatoken(script,modelframetokens,sizeof(modelframetokens)/sizeof(tokenlist))) { - case T_FRAME: scriptfile_getstring(script,&framename); break; - case T_TILE: scriptfile_getsymbol(script,&ftilenume); ltilenume = ftilenume; break; - case T_TILE0: scriptfile_getsymbol(script,&ftilenume); break; //first tile number - case T_TILE1: scriptfile_getsymbol(script,<ilenume); break; //last tile number (inclusive) - } - } - - if (ftilenume < 0) initprintf("Error: missing 'first tile number' for frame definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,frametokptr)), happy = 0; - if (ltilenume < 0) initprintf("Error: missing 'last tile number' for frame definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,frametokptr)), happy = 0; - if (!happy) break; - - if (ltilenume < ftilenume) { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,frametokptr)); - tilex = ftilenume; - ftilenume = ltilenume; - ltilenume = tilex; - } - - if (lastmodelid < 0) { - initprintf("Warning: Ignoring frame definition.\n"); - break; - } -#if defined(POLYMOST) && defined(USE_OPENGL) - for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) { - switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin))) { - case 0: break; - case -1: happy = 0; break; // invalid model id!? - case -2: initprintf("Invalid tile number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,frametokptr)); - happy = 0; - break; - case -3: initprintf("Invalid frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,frametokptr)); - happy = 0; - break; - } - } -#endif - seenframe = 1; - } - break; - case T_ANIM: - { - char *animtokptr = script->ltextptr; - char *animend, *startframe = 0, *endframe = 0, happy=1; - int flags = 0; - double dfps = 1.0; - - if (scriptfile_getbraces(script,&animend)) break; - while (script->textptr < animend) { - switch(getatoken(script,modelanimtokens,sizeof(modelanimtokens)/sizeof(tokenlist))) { - case T_FRAME0: scriptfile_getstring(script,&startframe); break; - case T_FRAME1: scriptfile_getstring(script,&endframe); break; - case T_FPS: scriptfile_getdouble(script,&dfps); break; //animation frame rate - case T_FLAGS: scriptfile_getsymbol(script,&flags); break; - } - } - - if (!startframe) initprintf("Error: missing 'start frame' for anim definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,animtokptr)), happy = 0; - if (!endframe) initprintf("Error: missing 'end frame' for anim definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,animtokptr)), happy = 0; - if (!happy) break; - - if (lastmodelid < 0) { - initprintf("Warning: Ignoring animation definition.\n"); - break; - } -#if defined(POLYMOST) && defined(USE_OPENGL) - switch (md_defineanimation(lastmodelid, startframe, endframe, (int)(dfps*(65536.0*.001)), flags)) { - case 0: break; - case -1: break; // invalid model id!? - case -2: initprintf("Invalid starting frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,animtokptr)); - break; - case -3: initprintf("Invalid ending frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,animtokptr)); - break; - case -4: initprintf("Out of memory on line %s:%d\n", - script->filename, scriptfile_getlinum(script,animtokptr)); - break; - } -#endif - } break; - case T_SKIN: - { - char *skintokptr = script->ltextptr; - char *skinend, *skinfn = 0; - int palnum = 0, surfnum = 0; - - if (scriptfile_getbraces(script,&skinend)) break; - while (script->textptr < skinend) { - switch(getatoken(script,modelskintokens,sizeof(modelskintokens)/sizeof(tokenlist))) { - case T_PAL: scriptfile_getsymbol(script,&palnum); break; - case T_FILE: scriptfile_getstring(script,&skinfn); break; //skin filename - case T_SURF: scriptfile_getnumber(script,&surfnum); break; - } - } - - if (!skinfn) { - initprintf("Error: missing 'skin filename' for skin definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,skintokptr)); - break; - } - - if (seenframe) { modelskin = ++lastmodelskin; } - seenframe = 0; - -#if defined(POLYMOST) && defined(USE_OPENGL) - switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), surfnum)) { - case 0: break; - case -1: break; // invalid model id!? - case -2: initprintf("Invalid skin filename on line %s:%d\n", - script->filename, scriptfile_getlinum(script,skintokptr)); - break; - case -3: initprintf("Invalid palette number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,skintokptr)); - break; - case -4: initprintf("Out of memory on line %s:%d\n", - script->filename, scriptfile_getlinum(script,skintokptr)); - break; - } -#endif - } break; - case T_HUD: - { - char *hudtokptr = script->ltextptr; - char happy=1, *frameend; - int ftilenume = -1, ltilenume = -1, tilex = 0, flags = 0; - double xadd = 0.0, yadd = 0.0, zadd = 0.0, angadd = 0.0; - - if (scriptfile_getbraces(script,&frameend)) break; - while (script->textptr < frameend) { - switch(getatoken(script,modelhudtokens,sizeof(modelhudtokens)/sizeof(tokenlist))) { - case T_TILE: scriptfile_getsymbol(script,&ftilenume); ltilenume = ftilenume; break; - case T_TILE0: scriptfile_getsymbol(script,&ftilenume); break; //first tile number - case T_TILE1: scriptfile_getsymbol(script,<ilenume); break; //last tile number (inclusive) - case T_XADD: scriptfile_getdouble(script,&xadd); break; - case T_YADD: scriptfile_getdouble(script,&yadd); break; - case T_ZADD: scriptfile_getdouble(script,&zadd); break; - case T_ANGADD:scriptfile_getdouble(script,&angadd); break; - case T_HIDE: flags |= 1; break; - case T_NOBOB: flags |= 2; break; - case T_FLIPPED: flags |= 4; break; - case T_NODEPTH: flags |= 8; break; - } - } - - if (ftilenume < 0) initprintf("Error: missing 'first tile number' for hud definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,hudtokptr)), happy = 0; - if (ltilenume < 0) initprintf("Error: missing 'last tile number' for hud definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,hudtokptr)), happy = 0; - if (!happy) break; - - if (ltilenume < ftilenume) { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,hudtokptr)); - tilex = ftilenume; - ftilenume = ltilenume; - ltilenume = tilex; - } - - if (lastmodelid < 0) { - initprintf("Warning: Ignoring frame definition.\n"); - break; - } -#if defined(POLYMOST) && defined(USE_OPENGL) - for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) { - switch (md_definehud(lastmodelid, tilex, xadd, yadd, zadd, angadd, flags)) { - case 0: break; - case -1: happy = 0; break; // invalid model id!? - case -2: initprintf("Invalid tile number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,hudtokptr)); - happy = 0; - break; - case -3: initprintf("Invalid frame name on line %s:%d\n", - script->filename, scriptfile_getlinum(script,hudtokptr)); - happy = 0; - break; - } - } -#endif - } break; - } - } - -#if defined(POLYMOST) && defined(USE_OPENGL) - md_setmisc(lastmodelid,(float)scale,shadeoffs,(float)mzadd); -#endif - - modelskin = lastmodelskin = 0; - seenframe = 0; - + lastmodelid = md_loadmodel(modelfn); + if (lastmodelid < 0) { + initprintf("Failure loading MD2/MD3 model \"%s\"\n", modelfn); + break; } - break; - case T_VOXEL: - { - char *voxeltokptr = script->ltextptr; - char *fn, *modelend; - int tile0 = MAXTILES, tile1 = -1, tilex = -1; - - if (scriptfile_getstring(script,&fn)) break; //voxel filename - if (nextvoxid == MAXVOXELS) { initprintf("Maximum number of voxels already defined.\n"); break; } -#ifdef SUPERBUILD - if (qloadkvx(nextvoxid, fn)) { initprintf("Failure loading voxel file \"%s\"\n",fn); break; } - lastvoxid = nextvoxid++; #endif + if (scriptfile_getbraces(script,&modelend)) break; + while (script->textptr < modelend) { + switch (getatoken(script,modeltokens,sizeof(modeltokens)/sizeof(tokenlist))) { + //case T_ERROR: initprintf("Error on line %s:%d in model tokens\n", script->filename,script->linenum); break; + case T_SCALE: + scriptfile_getdouble(script,&scale); break; + case T_SHADE: + scriptfile_getnumber(script,&shadeoffs); break; + case T_ZADD: + scriptfile_getdouble(script,&mzadd); break; + case T_FRAME: + { + char *frametokptr = script->ltextptr; + char *frameend, *framename = 0, happy=1; + int ftilenume = -1, ltilenume = -1, tilex = 0; - if (scriptfile_getbraces(script,&modelend)) break; - while (script->textptr < modelend) { - switch (getatoken(script,voxeltokens,sizeof(voxeltokens)/sizeof(tokenlist))) { - //case T_ERROR: initprintf("Error on line %s:%d in voxel tokens\n", script->filename,linenum); break; - case T_TILE: - scriptfile_getsymbol(script,&tilex); -#ifdef SUPERBUILD - if ((unsigned long)tilex < MAXTILES) tiletovox[tilex] = lastvoxid; - else initprintf("Invalid tile number on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr)); -#endif - break; - case T_TILE0: - scriptfile_getsymbol(script,&tile0); break; //1st tile # - case T_TILE1: - scriptfile_getsymbol(script,&tile1); - if (tile0 > tile1) - { - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,voxeltokptr)); - tilex = tile0; tile0 = tile1; tile1 = tilex; + if (scriptfile_getbraces(script,&frameend)) break; + while (script->textptr < frameend) { + switch (getatoken(script,modelframetokens,sizeof(modelframetokens)/sizeof(tokenlist))) { + case T_FRAME: + scriptfile_getstring(script,&framename); break; + case T_TILE: + scriptfile_getsymbol(script,&ftilenume); ltilenume = ftilenume; break; + case T_TILE0: + scriptfile_getsymbol(script,&ftilenume); break; //first tile number + case T_TILE1: + scriptfile_getsymbol(script,<ilenume); break; //last tile number (inclusive) } - 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; -#endif - break; //last tile number (inclusive) - case T_SCALE: { - double scale=1.0; - scriptfile_getdouble(script,&scale); -#ifdef SUPERBUILD - voxscale[lastvoxid] = 65536*scale; -#endif + } + + if (ftilenume < 0) initprintf("Error: missing 'first tile number' for frame definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,frametokptr)), happy = 0; + if (ltilenume < 0) initprintf("Error: missing 'last tile number' for frame definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,frametokptr)), happy = 0; + if (!happy) break; + + if (ltilenume < ftilenume) { + initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,frametokptr)); + tilex = ftilenume; + ftilenume = ltilenume; + ltilenume = tilex; + } + + if (lastmodelid < 0) { + initprintf("Warning: Ignoring frame definition.\n"); + break; + } +#if defined(POLYMOST) && defined(USE_OPENGL) + for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) { + switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin))) { + case 0: + break; + case -1: + happy = 0; break; // invalid model id!? + case -2: + initprintf("Invalid tile number on line %s:%d\n", + script->filename, scriptfile_getlinum(script,frametokptr)); + happy = 0; + break; + case -3: + initprintf("Invalid frame name on line %s:%d\n", + script->filename, scriptfile_getlinum(script,frametokptr)); + happy = 0; break; } } +#endif + seenframe = 1; + } + break; + case T_ANIM: + { + char *animtokptr = script->ltextptr; + char *animend, *startframe = 0, *endframe = 0, happy=1; + int flags = 0; + double dfps = 1.0; + + if (scriptfile_getbraces(script,&animend)) break; + while (script->textptr < animend) { + switch (getatoken(script,modelanimtokens,sizeof(modelanimtokens)/sizeof(tokenlist))) { + case T_FRAME0: + scriptfile_getstring(script,&startframe); break; + case T_FRAME1: + scriptfile_getstring(script,&endframe); break; + case T_FPS: + scriptfile_getdouble(script,&dfps); break; //animation frame rate + case T_FLAGS: + scriptfile_getsymbol(script,&flags); break; + } + } + + if (!startframe) initprintf("Error: missing 'start frame' for anim definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,animtokptr)), happy = 0; + if (!endframe) initprintf("Error: missing 'end frame' for anim definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,animtokptr)), happy = 0; + if (!happy) break; + + if (lastmodelid < 0) { + initprintf("Warning: Ignoring animation definition.\n"); + break; + } +#if defined(POLYMOST) && defined(USE_OPENGL) + switch (md_defineanimation(lastmodelid, startframe, endframe, (int)(dfps*(65536.0*.001)), flags)) { + case 0: + break; + case -1: + break; // invalid model id!? + case -2: + initprintf("Invalid starting frame name on line %s:%d\n", + script->filename, scriptfile_getlinum(script,animtokptr)); + break; + case -3: + initprintf("Invalid ending frame name on line %s:%d\n", + script->filename, scriptfile_getlinum(script,animtokptr)); + break; + case -4: + initprintf("Out of memory on line %s:%d\n", + script->filename, scriptfile_getlinum(script,animtokptr)); + break; + } +#endif + } break; + case T_SKIN: + { + char *skintokptr = script->ltextptr; + char *skinend, *skinfn = 0; + int palnum = 0, surfnum = 0; + + if (scriptfile_getbraces(script,&skinend)) break; + while (script->textptr < skinend) { + switch (getatoken(script,modelskintokens,sizeof(modelskintokens)/sizeof(tokenlist))) { + case T_PAL: + scriptfile_getsymbol(script,&palnum); break; + case T_FILE: + scriptfile_getstring(script,&skinfn); break; //skin filename + case T_SURF: + scriptfile_getnumber(script,&surfnum); break; + } + } + + if (!skinfn) { + initprintf("Error: missing 'skin filename' for skin definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,skintokptr)); + break; + } + + if (seenframe) { modelskin = ++lastmodelskin; } + seenframe = 0; + +#if defined(POLYMOST) && defined(USE_OPENGL) + switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), surfnum)) { + case 0: + break; + case -1: + break; // invalid model id!? + case -2: + initprintf("Invalid skin filename on line %s:%d\n", + script->filename, scriptfile_getlinum(script,skintokptr)); + break; + case -3: + initprintf("Invalid palette number on line %s:%d\n", + script->filename, scriptfile_getlinum(script,skintokptr)); + break; + case -4: + initprintf("Out of memory on line %s:%d\n", + script->filename, scriptfile_getlinum(script,skintokptr)); + break; + } +#endif + } break; + case T_HUD: + { + char *hudtokptr = script->ltextptr; + char happy=1, *frameend; + int ftilenume = -1, ltilenume = -1, tilex = 0, flags = 0; + double xadd = 0.0, yadd = 0.0, zadd = 0.0, angadd = 0.0; + + if (scriptfile_getbraces(script,&frameend)) break; + while (script->textptr < frameend) { + switch (getatoken(script,modelhudtokens,sizeof(modelhudtokens)/sizeof(tokenlist))) { + case T_TILE: + scriptfile_getsymbol(script,&ftilenume); ltilenume = ftilenume; break; + case T_TILE0: + scriptfile_getsymbol(script,&ftilenume); break; //first tile number + case T_TILE1: + scriptfile_getsymbol(script,<ilenume); break; //last tile number (inclusive) + case T_XADD: + scriptfile_getdouble(script,&xadd); break; + case T_YADD: + scriptfile_getdouble(script,&yadd); break; + case T_ZADD: + scriptfile_getdouble(script,&zadd); break; + case T_ANGADD: + scriptfile_getdouble(script,&angadd); break; + case T_HIDE: + flags |= 1; break; + case T_NOBOB: + flags |= 2; break; + case T_FLIPPED: + flags |= 4; break; + case T_NODEPTH: + flags |= 8; break; + } + } + + if (ftilenume < 0) initprintf("Error: missing 'first tile number' for hud definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,hudtokptr)), happy = 0; + if (ltilenume < 0) initprintf("Error: missing 'last tile number' for hud definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,hudtokptr)), happy = 0; + if (!happy) break; + + if (ltilenume < ftilenume) { + initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,hudtokptr)); + tilex = ftilenume; + ftilenume = ltilenume; + ltilenume = tilex; + } + + if (lastmodelid < 0) { + initprintf("Warning: Ignoring frame definition.\n"); + break; + } +#if defined(POLYMOST) && defined(USE_OPENGL) + for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++) { + switch (md_definehud(lastmodelid, tilex, xadd, yadd, zadd, angadd, flags)) { + case 0: + break; + case -1: + happy = 0; break; // invalid model id!? + case -2: + initprintf("Invalid tile number on line %s:%d\n", + script->filename, scriptfile_getlinum(script,hudtokptr)); + happy = 0; + break; + case -3: + initprintf("Invalid frame name on line %s:%d\n", + script->filename, scriptfile_getlinum(script,hudtokptr)); + happy = 0; + break; + } + } +#endif + } break; } - lastvoxid = -1; } - break; + +#if defined(POLYMOST) && defined(USE_OPENGL) + md_setmisc(lastmodelid,(float)scale,shadeoffs,(float)mzadd); +#endif + + modelskin = lastmodelskin = 0; + seenframe = 0; + + } + break; + case T_VOXEL: + { + char *voxeltokptr = script->ltextptr; + char *fn, *modelend; + int tile0 = MAXTILES, tile1 = -1, tilex = -1; + + if (scriptfile_getstring(script,&fn)) break; //voxel filename + if (nextvoxid == MAXVOXELS) { initprintf("Maximum number of voxels already defined.\n"); break; } +#ifdef SUPERBUILD + if (qloadkvx(nextvoxid, fn)) { initprintf("Failure loading voxel file \"%s\"\n",fn); break; } + lastvoxid = nextvoxid++; +#endif + + if (scriptfile_getbraces(script,&modelend)) break; + while (script->textptr < modelend) { + switch (getatoken(script,voxeltokens,sizeof(voxeltokens)/sizeof(tokenlist))) { + //case T_ERROR: initprintf("Error on line %s:%d in voxel tokens\n", script->filename,linenum); break; + case T_TILE: + scriptfile_getsymbol(script,&tilex); +#ifdef SUPERBUILD + if ((unsigned long)tilex < MAXTILES) tiletovox[tilex] = lastvoxid; + else initprintf("Invalid tile number on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr)); +#endif + break; + case T_TILE0: + scriptfile_getsymbol(script,&tile0); break; //1st tile # + case T_TILE1: + scriptfile_getsymbol(script,&tile1); + if (tile0 > tile1) + { + initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,voxeltokptr)); + tilex = tile0; tile0 = tile1; tile1 = tilex; + } + 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; +#endif + break; //last tile number (inclusive) + case T_SCALE: { + double scale=1.0; + scriptfile_getdouble(script,&scale); +#ifdef SUPERBUILD + voxscale[lastvoxid] = 65536*scale; +#endif + break; + } + } + } + lastvoxid = -1; + } + break; case T_SKYBOX: - { - char *skyboxtokptr = script->ltextptr; - char *fn[6] = {0,0,0,0,0,0}, *modelend, happy=1; - int i, tile = -1, pal = 0,j; + { + char *skyboxtokptr = script->ltextptr; + char *fn[6] = {0,0,0,0,0,0}, *modelend, happy=1; + int i, tile = -1, pal = 0,j; - if (scriptfile_getbraces(script,&modelend)) break; - while (script->textptr < modelend) { - switch (getatoken(script,skyboxtokens,sizeof(skyboxtokens)/sizeof(tokenlist))) { - //case T_ERROR: initprintf("Error on line %s:%d in skybox tokens\n",script->filename,linenum); break; - case T_TILE: scriptfile_getsymbol(script,&tile ); break; - case T_PAL: scriptfile_getsymbol(script,&pal ); break; - case T_FRONT: scriptfile_getstring(script,&fn[0]); break; - case T_RIGHT: scriptfile_getstring(script,&fn[1]); break; - case T_BACK: scriptfile_getstring(script,&fn[2]); break; - case T_LEFT: scriptfile_getstring(script,&fn[3]); break; - case T_TOP: scriptfile_getstring(script,&fn[4]); break; - case T_BOTTOM:scriptfile_getstring(script,&fn[5]); break; - } + if (scriptfile_getbraces(script,&modelend)) break; + while (script->textptr < modelend) { + switch (getatoken(script,skyboxtokens,sizeof(skyboxtokens)/sizeof(tokenlist))) { + //case T_ERROR: initprintf("Error on line %s:%d in skybox tokens\n",script->filename,linenum); break; + case T_TILE: + scriptfile_getsymbol(script,&tile ); break; + case T_PAL: + scriptfile_getsymbol(script,&pal ); break; + case T_FRONT: + scriptfile_getstring(script,&fn[0]); break; + case T_RIGHT: + scriptfile_getstring(script,&fn[1]); break; + case T_BACK: + scriptfile_getstring(script,&fn[2]); break; + case T_LEFT: + scriptfile_getstring(script,&fn[3]); break; + case T_TOP: + scriptfile_getstring(script,&fn[4]); break; + case T_BOTTOM: + scriptfile_getstring(script,&fn[5]); break; } - - 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++) { - 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; - if ((j = kopen4load(fn[i],0)) < 0) { - initprintf("Error: file '%s' does not exist\n",fn[i]); - happy = 0; - } else kclose(j); - } - if (!happy) break; - - hicsetskybox(tile,pal,fn); } - break; + + 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++) { + 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; + if ((j = kopen4load(fn[i],0)) < 0) { + initprintf("Error: file '%s' does not exist\n",fn[i]); + happy = 0; + } else kclose(j); + } + if (!happy) break; + + hicsetskybox(tile,pal,fn); + } + break; case T_TINT: - { - char *tinttokptr = script->ltextptr; - int red=255, green=255, blue=255, pal=-1, flags=0; - char *tintend; + { + char *tinttokptr = script->ltextptr; + int red=255, green=255, blue=255, pal=-1, flags=0; + char *tintend; - if (scriptfile_getbraces(script,&tintend)) break; - while (script->textptr < tintend) { - switch (getatoken(script,tinttokens,sizeof(tinttokens)/sizeof(tokenlist))) { - case T_PAL: scriptfile_getsymbol(script,&pal); break; - case T_RED: scriptfile_getnumber(script,&red); red = min(255,max(0,red)); break; - case T_GREEN: scriptfile_getnumber(script,&green); green = min(255,max(0,green)); break; - case T_BLUE: scriptfile_getnumber(script,&blue); blue = min(255,max(0,blue)); break; - case T_FLAGS: scriptfile_getsymbol(script,&flags); break; - } + if (scriptfile_getbraces(script,&tintend)) break; + while (script->textptr < tintend) { + switch (getatoken(script,tinttokens,sizeof(tinttokens)/sizeof(tokenlist))) { + case T_PAL: + scriptfile_getsymbol(script,&pal); break; + case T_RED: + scriptfile_getnumber(script,&red); red = min(255,max(0,red)); break; + case T_GREEN: + scriptfile_getnumber(script,&green); green = min(255,max(0,green)); break; + case T_BLUE: + scriptfile_getnumber(script,&blue); blue = min(255,max(0,blue)); break; + case T_FLAGS: + scriptfile_getsymbol(script,&flags); break; } - - if (pal < 0) { - initprintf("Error: missing 'palette number' for tint definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr)); - break; - } - - hicsetpalettetint(pal,red,green,blue,flags); } - break; + + if (pal < 0) { + initprintf("Error: missing 'palette number' for tint definition near line %s:%d\n", script->filename, scriptfile_getlinum(script,tinttokptr)); + break; + } + + hicsetpalettetint(pal,red,green,blue,flags); + } + break; case T_TEXTURE: - { - char *texturetokptr = script->ltextptr, *textureend; - int tile=-1; + { + char *texturetokptr = script->ltextptr, *textureend; + int tile=-1; - if (scriptfile_getsymbol(script,&tile)) break; - if (scriptfile_getbraces(script,&textureend)) break; - while (script->textptr < textureend) { - switch (getatoken(script,texturetokens,sizeof(texturetokens)/sizeof(tokenlist))) { - case T_PAL: { - char *paltokptr = script->ltextptr, *palend; - int pal=-1, i; - char *fn = NULL; - double alphacut = -1.0; - char flags = 0; + if (scriptfile_getsymbol(script,&tile)) break; + if (scriptfile_getbraces(script,&textureend)) break; + while (script->textptr < textureend) { + switch (getatoken(script,texturetokens,sizeof(texturetokens)/sizeof(tokenlist))) { + case T_PAL: { + char *paltokptr = script->ltextptr, *palend; + int pal=-1, i; + char *fn = NULL; + double alphacut = -1.0; + char flags = 0; - if (scriptfile_getsymbol(script,&pal)) break; - if (scriptfile_getbraces(script,&palend)) break; - while (script->textptr < palend) { - switch (getatoken(script,texturetokens_pal,sizeof(texturetokens_pal)/sizeof(tokenlist))) { - case T_FILE: scriptfile_getstring(script,&fn); break; - case T_ALPHACUT: scriptfile_getdouble(script,&alphacut); break; - case T_NOCOMPRESS: flags |= 1; break; - default: break; - } - } - - if ((unsigned)tile > (unsigned)MAXTILES) break; // message is printed later - if ((unsigned)pal > (unsigned)MAXPALOOKUPS) { - initprintf("Error: missing or invalid 'palette number' for texture definition near " - "line %s:%d\n", script->filename, scriptfile_getlinum(script,paltokptr)); - break; - } - if (!fn) { - initprintf("Error: missing 'file name' for texture definition near line %s:%d\n", - script->filename, scriptfile_getlinum(script,paltokptr)); - break; - } - if ((i = kopen4load(fn,0)) < 0) { - initprintf("Error: file '%s' does not exist\n",fn); - break; - } else kclose(i); - - hicsetsubsttex(tile,pal,fn,alphacut,flags); - } break; - default: break; + if (scriptfile_getsymbol(script,&pal)) break; + if (scriptfile_getbraces(script,&palend)) break; + while (script->textptr < palend) { + switch (getatoken(script,texturetokens_pal,sizeof(texturetokens_pal)/sizeof(tokenlist))) { + case T_FILE: + scriptfile_getstring(script,&fn); break; + case T_ALPHACUT: + scriptfile_getdouble(script,&alphacut); break; + case T_NOCOMPRESS: + flags |= 1; break; + default: + break; + } } - } - if ((unsigned)tile >= (unsigned)MAXTILES) { - initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n", - script->filename, scriptfile_getlinum(script,texturetokptr)); + if ((unsigned)tile > (unsigned)MAXTILES) break; // message is printed later + if ((unsigned)pal > (unsigned)MAXPALOOKUPS) { + initprintf("Error: missing or invalid 'palette number' for texture definition near " + "line %s:%d\n", script->filename, scriptfile_getlinum(script,paltokptr)); + break; + } + if (!fn) { + initprintf("Error: missing 'file name' for texture definition near line %s:%d\n", + script->filename, scriptfile_getlinum(script,paltokptr)); + break; + } + if ((i = kopen4load(fn,0)) < 0) { + initprintf("Error: file '%s' does not exist\n",fn); + break; + } else kclose(i); + + hicsetsubsttex(tile,pal,fn,alphacut,flags); + } break; + default: break; } } - break; + + if ((unsigned)tile >= (unsigned)MAXTILES) { + initprintf("Error: missing or invalid 'tile number' for texture definition near line %s:%d\n", + script->filename, scriptfile_getlinum(script,texturetokptr)); + break; + } + } + break; case T_UNDEFMODEL: case T_UNDEFMODELRANGE: - { - int r0,r1; + { + int r0,r1; - if (scriptfile_getsymbol(script,&r0)) break; - if (tokn == T_UNDEFMODELRANGE) { - if (scriptfile_getsymbol(script,&r1)) break; - if (r1 < r0) { - int t = r1; - r1 = r0; - r0 = t; - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - } - if (r0 < 0 || r1 >= MAXTILES) { - initprintf("Error: invalid tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - } else { + if (scriptfile_getsymbol(script,&r0)) break; + if (tokn == T_UNDEFMODELRANGE) { + if (scriptfile_getsymbol(script,&r1)) break; + if (r1 < r0) { + int t = r1; r1 = r0; - if ((unsigned)r0 >= (unsigned)MAXTILES) { - initprintf("Error: invalid tile number on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } + r0 = t; + initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); } -#if defined(POLYMOST) && defined(USE_OPENGL) - for (; r0 <= r1; r0++) md_undefinetile(r0); -#endif - } - break; - - case T_UNDEFMODELOF: - { - int mid,r0; - - if (scriptfile_getsymbol(script,&r0)) break; + if (r0 < 0 || r1 >= MAXTILES) { + initprintf("Error: invalid tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; + } + } else { + r1 = r0; if ((unsigned)r0 >= (unsigned)MAXTILES) { initprintf("Error: invalid tile number on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); break; } + } +#if defined(POLYMOST) && defined(USE_OPENGL) + for (; r0 <= r1; r0++) md_undefinetile(r0); +#endif + } + break; + + case T_UNDEFMODELOF: + { + int mid,r0; + + if (scriptfile_getsymbol(script,&r0)) break; + if ((unsigned)r0 >= (unsigned)MAXTILES) { + initprintf("Error: invalid tile number on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; + } #if defined(POLYMOST) && defined(USE_OPENGL) - mid = md_tilehasmodel(r0); - if (mid < 0) break; + mid = md_tilehasmodel(r0); + if (mid < 0) break; - md_undefinemodel(mid); + md_undefinemodel(mid); #endif - } - break; + } + break; case T_UNDEFTEXTURE: case T_UNDEFTEXTURERANGE: - { - int r0,r1,i; + { + int r0,r1,i; - if (scriptfile_getsymbol(script,&r0)) break; - if (tokn == T_UNDEFTEXTURERANGE) { - if (scriptfile_getsymbol(script,&r1)) break; - if (r1 < r0) { - int t = r1; - r1 = r0; - r0 = t; - initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - } - if (r0 < 0 || r1 >= MAXTILES) { - initprintf("Error: invalid tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - } else { + if (scriptfile_getsymbol(script,&r0)) break; + if (tokn == T_UNDEFTEXTURERANGE) { + if (scriptfile_getsymbol(script,&r1)) break; + if (r1 < r0) { + int t = r1; r1 = r0; - if ((unsigned)r0 >= (unsigned)MAXTILES) { - initprintf("Error: invalid tile number on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } + r0 = t; + initprintf("Warning: backwards tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); + } + if (r0 < 0 || r1 >= MAXTILES) { + initprintf("Error: invalid tile range on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; + } + } else { + r1 = r0; + if ((unsigned)r0 >= (unsigned)MAXTILES) { + initprintf("Error: invalid tile number on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; } - - for (; r0 <= r1; r0++) - for (i=MAXPALOOKUPS-1; i>=0; i--) - hicclearsubst(r0,i); } - break; + + for (; r0 <= r1; r0++) + for (i=MAXPALOOKUPS-1; i>=0; i--) + hicclearsubst(r0,i); + } + break; default: initprintf("Unknown token.\n"); break; diff --git a/polymer/build/src/dynamicgtk.c b/polymer/build/src/dynamicgtk.c index 6784fca4e..aca2cca55 100755 --- a/polymer/build/src/dynamicgtk.c +++ b/polymer/build/src/dynamicgtk.c @@ -15,132 +15,132 @@ struct _dynamicgtksyms dynamicgtksyms; int dynamicgtk_init(void) { - int err = 0; - const char *failsym = NULL; + int err = 0; + const char *failsym = NULL; - if (handle) return 1; + if (handle) return 1; - handle = dlopen("libgtk-x11-2.0.so", RTLD_NOW|RTLD_GLOBAL); - if (!handle) return 0; - - memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms)); + handle = dlopen("libgtk-x11-2.0.so", RTLD_NOW|RTLD_GLOBAL); + if (!handle) return 0; - do { - GETDLSYM(g_object_get_data) - GETDLSYM(g_object_set_data) - GETDLSYM(g_object_set_data_full) - GETDLSYM(g_object_unref) - GETDLSYM(g_signal_connect_data) - GETDLSYM(g_signal_handlers_block_matched) - GETDLSYM(g_signal_handlers_unblock_matched) - GETDLSYM(g_type_check_instance_cast) - GETDLSYM(gdk_pixbuf_from_pixdata) - GETDLSYM(gdk_pixbuf_new_from_data) - GETDLSYM(gtk_accel_group_new) - GETDLSYM(gtk_alignment_new) - GETDLSYM(gtk_box_get_type) - GETDLSYM(gtk_box_pack_start) - GETDLSYM(gtk_button_box_get_type) - GETDLSYM(gtk_button_box_set_layout) - GETDLSYM(gtk_button_new) - GETDLSYM(gtk_cell_layout_get_type) - GETDLSYM(gtk_cell_layout_pack_start) - GETDLSYM(gtk_cell_layout_set_attributes) - GETDLSYM(gtk_cell_renderer_text_new) - GETDLSYM(gtk_check_button_new_with_mnemonic) - GETDLSYM(gtk_combo_box_get_active_iter) - GETDLSYM(gtk_combo_box_get_model) - GETDLSYM(gtk_combo_box_get_type) - GETDLSYM(gtk_combo_box_new_text) - GETDLSYM(gtk_combo_box_new_with_model) - GETDLSYM(gtk_combo_box_set_active_iter) - GETDLSYM(gtk_container_add) - GETDLSYM(gtk_container_foreach) - GETDLSYM(gtk_container_get_type) - GETDLSYM(gtk_container_set_border_width) - GETDLSYM(gtk_dialog_get_type) - GETDLSYM(gtk_dialog_run) - GETDLSYM(gtk_fixed_get_type) - GETDLSYM(gtk_fixed_new) - GETDLSYM(gtk_fixed_put) - GETDLSYM(gtk_hbox_new) - GETDLSYM(gtk_hbutton_box_new) - GETDLSYM(gtk_image_new_from_pixbuf) - GETDLSYM(gtk_image_new_from_stock) - GETDLSYM(gtk_init_check) - GETDLSYM(gtk_label_get_type) - GETDLSYM(gtk_label_new) - GETDLSYM(gtk_label_new_with_mnemonic) - GETDLSYM(gtk_label_set_mnemonic_widget) - GETDLSYM(gtk_list_store_append) - GETDLSYM(gtk_list_store_clear) - GETDLSYM(gtk_list_store_get_type) - GETDLSYM(gtk_list_store_new) - GETDLSYM(gtk_list_store_set) - GETDLSYM(gtk_main) - GETDLSYM(gtk_main_iteration_do) - GETDLSYM(gtk_main_quit) - GETDLSYM(gtk_message_dialog_new) - GETDLSYM(gtk_misc_get_type) - GETDLSYM(gtk_misc_set_alignment) - GETDLSYM(gtk_notebook_get_nth_page) - GETDLSYM(gtk_notebook_get_type) - GETDLSYM(gtk_notebook_new) - GETDLSYM(gtk_notebook_set_current_page) - GETDLSYM(gtk_notebook_set_tab_label) - GETDLSYM(gtk_object_get_type) - GETDLSYM(gtk_scrolled_window_get_type) - GETDLSYM(gtk_scrolled_window_new) - GETDLSYM(gtk_scrolled_window_set_policy) - GETDLSYM(gtk_text_buffer_backspace) - GETDLSYM(gtk_text_buffer_create_mark) - GETDLSYM(gtk_text_buffer_delete_mark) - GETDLSYM(gtk_text_buffer_get_end_iter) - GETDLSYM(gtk_text_buffer_insert) - GETDLSYM(gtk_text_view_get_buffer) - GETDLSYM(gtk_text_view_get_type) - GETDLSYM(gtk_text_view_new) - GETDLSYM(gtk_text_view_scroll_to_mark) - GETDLSYM(gtk_text_view_set_cursor_visible) - GETDLSYM(gtk_text_view_set_editable) - GETDLSYM(gtk_text_view_set_left_margin) - GETDLSYM(gtk_text_view_set_right_margin) - GETDLSYM(gtk_text_view_set_wrap_mode) - GETDLSYM(gtk_toggle_button_get_active) - GETDLSYM(gtk_toggle_button_get_type) - GETDLSYM(gtk_toggle_button_set_active) - GETDLSYM(gtk_tree_model_get) - GETDLSYM(gtk_tree_model_get_type) - GETDLSYM(gtk_vbox_new) - GETDLSYM(gtk_widget_add_accelerator) - GETDLSYM(gtk_widget_destroy) - GETDLSYM(gtk_widget_ref) - GETDLSYM(gtk_widget_set_sensitive) - GETDLSYM(gtk_widget_set_size_request) - GETDLSYM(gtk_widget_show) - GETDLSYM(gtk_widget_unref) - GETDLSYM(gtk_window_add_accel_group) - GETDLSYM(gtk_window_get_type) - GETDLSYM(gtk_window_new) - GETDLSYM(gtk_window_set_default_icon) - GETDLSYM(gtk_window_set_position) - GETDLSYM(gtk_window_set_resizable) - GETDLSYM(gtk_window_set_title) - GETDLSYM(gtk_window_set_type_hint) - } while (0); + memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms)); - if (err) { - //printf("Failed fetching symbol %s from GTK lib\n", failsym); - dlclose(handle); - handle = NULL; - return -1; - } - return 0; + do { + GETDLSYM(g_object_get_data) + GETDLSYM(g_object_set_data) + GETDLSYM(g_object_set_data_full) + GETDLSYM(g_object_unref) + GETDLSYM(g_signal_connect_data) + GETDLSYM(g_signal_handlers_block_matched) + GETDLSYM(g_signal_handlers_unblock_matched) + GETDLSYM(g_type_check_instance_cast) + GETDLSYM(gdk_pixbuf_from_pixdata) + GETDLSYM(gdk_pixbuf_new_from_data) + GETDLSYM(gtk_accel_group_new) + GETDLSYM(gtk_alignment_new) + GETDLSYM(gtk_box_get_type) + GETDLSYM(gtk_box_pack_start) + GETDLSYM(gtk_button_box_get_type) + GETDLSYM(gtk_button_box_set_layout) + GETDLSYM(gtk_button_new) + GETDLSYM(gtk_cell_layout_get_type) + GETDLSYM(gtk_cell_layout_pack_start) + GETDLSYM(gtk_cell_layout_set_attributes) + GETDLSYM(gtk_cell_renderer_text_new) + GETDLSYM(gtk_check_button_new_with_mnemonic) + GETDLSYM(gtk_combo_box_get_active_iter) + GETDLSYM(gtk_combo_box_get_model) + GETDLSYM(gtk_combo_box_get_type) + GETDLSYM(gtk_combo_box_new_text) + GETDLSYM(gtk_combo_box_new_with_model) + GETDLSYM(gtk_combo_box_set_active_iter) + GETDLSYM(gtk_container_add) + GETDLSYM(gtk_container_foreach) + GETDLSYM(gtk_container_get_type) + GETDLSYM(gtk_container_set_border_width) + GETDLSYM(gtk_dialog_get_type) + GETDLSYM(gtk_dialog_run) + GETDLSYM(gtk_fixed_get_type) + GETDLSYM(gtk_fixed_new) + GETDLSYM(gtk_fixed_put) + GETDLSYM(gtk_hbox_new) + GETDLSYM(gtk_hbutton_box_new) + GETDLSYM(gtk_image_new_from_pixbuf) + GETDLSYM(gtk_image_new_from_stock) + GETDLSYM(gtk_init_check) + GETDLSYM(gtk_label_get_type) + GETDLSYM(gtk_label_new) + GETDLSYM(gtk_label_new_with_mnemonic) + GETDLSYM(gtk_label_set_mnemonic_widget) + GETDLSYM(gtk_list_store_append) + GETDLSYM(gtk_list_store_clear) + GETDLSYM(gtk_list_store_get_type) + GETDLSYM(gtk_list_store_new) + GETDLSYM(gtk_list_store_set) + GETDLSYM(gtk_main) + GETDLSYM(gtk_main_iteration_do) + GETDLSYM(gtk_main_quit) + GETDLSYM(gtk_message_dialog_new) + GETDLSYM(gtk_misc_get_type) + GETDLSYM(gtk_misc_set_alignment) + GETDLSYM(gtk_notebook_get_nth_page) + GETDLSYM(gtk_notebook_get_type) + GETDLSYM(gtk_notebook_new) + GETDLSYM(gtk_notebook_set_current_page) + GETDLSYM(gtk_notebook_set_tab_label) + GETDLSYM(gtk_object_get_type) + GETDLSYM(gtk_scrolled_window_get_type) + GETDLSYM(gtk_scrolled_window_new) + GETDLSYM(gtk_scrolled_window_set_policy) + GETDLSYM(gtk_text_buffer_backspace) + GETDLSYM(gtk_text_buffer_create_mark) + GETDLSYM(gtk_text_buffer_delete_mark) + GETDLSYM(gtk_text_buffer_get_end_iter) + GETDLSYM(gtk_text_buffer_insert) + GETDLSYM(gtk_text_view_get_buffer) + GETDLSYM(gtk_text_view_get_type) + GETDLSYM(gtk_text_view_new) + GETDLSYM(gtk_text_view_scroll_to_mark) + GETDLSYM(gtk_text_view_set_cursor_visible) + GETDLSYM(gtk_text_view_set_editable) + GETDLSYM(gtk_text_view_set_left_margin) + GETDLSYM(gtk_text_view_set_right_margin) + GETDLSYM(gtk_text_view_set_wrap_mode) + GETDLSYM(gtk_toggle_button_get_active) + GETDLSYM(gtk_toggle_button_get_type) + GETDLSYM(gtk_toggle_button_set_active) + GETDLSYM(gtk_tree_model_get) + GETDLSYM(gtk_tree_model_get_type) + GETDLSYM(gtk_vbox_new) + GETDLSYM(gtk_widget_add_accelerator) + GETDLSYM(gtk_widget_destroy) + GETDLSYM(gtk_widget_ref) + GETDLSYM(gtk_widget_set_sensitive) + GETDLSYM(gtk_widget_set_size_request) + GETDLSYM(gtk_widget_show) + GETDLSYM(gtk_widget_unref) + GETDLSYM(gtk_window_add_accel_group) + GETDLSYM(gtk_window_get_type) + GETDLSYM(gtk_window_new) + GETDLSYM(gtk_window_set_default_icon) + GETDLSYM(gtk_window_set_position) + GETDLSYM(gtk_window_set_resizable) + GETDLSYM(gtk_window_set_title) + GETDLSYM(gtk_window_set_type_hint) + } while (0); + + if (err) { + //printf("Failed fetching symbol %s from GTK lib\n", failsym); + dlclose(handle); + handle = NULL; + return -1; + } + return 0; } void dynamicgtk_uninit(void) { - if (handle) dlclose(handle); - handle = NULL; - memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms)); + if (handle) dlclose(handle); + handle = NULL; + memset(&dynamicgtksyms, 0, sizeof(dynamicgtksyms)); } diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 3e7100796..94ca2ad97 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -726,7 +726,7 @@ static void scansector(short 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)) && @@ -750,7 +750,7 @@ static void scansector(short sectnum) startwall = sector[sectnum].wallptr; endwall = startwall + sector[sectnum].wallnum; scanfirst = numscans; - for(z=startwall,wal=&wall[z];znextsector; @@ -832,13 +832,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; } } while (sectorbordercnt > 0); @@ -881,7 +881,7 @@ static void maskwallscan(long x1, long x2, short *uwal, short *dwal, long *swal, 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); @@ -898,10 +898,10 @@ static void maskwallscan(long x1, long x2, short *uwal, short *dwal, long *swal, 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; @@ -956,7 +956,7 @@ static void maskwallscan(long x1, long x2, short *uwal, short *dwal, long *swal, 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); @@ -977,7 +977,7 @@ static void maskwallscan(long x1, long x2, short *uwal, short *dwal, long *swal, #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); @@ -1117,10 +1117,10 @@ static long bunchfront(long b1, long 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]; } } @@ -1259,7 +1259,7 @@ long animateoffs(short tilenum, short fakevar) i = (totalclocklock>>((picanm[tilenum]>>24)&15)); if ((picanm[tilenum]&63) > 0) { - switch(picanm[tilenum]&192) + switch (picanm[tilenum]&192) { case 64: k = (i%((picanm[tilenum]&63)<<1)); @@ -1614,7 +1614,7 @@ if (globalorientation&8) { globalxshift++; globalyshift++; } 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) @@ -1645,7 +1645,7 @@ if (globalorientation&8) { globalxshift++; globalyshift++; } return; } - switch(globalorientation&0x180) + switch (globalorientation&0x180) { case 128: msethlineshift(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4); @@ -1661,7 +1661,7 @@ if (globalorientation&8) { globalxshift++; globalyshift++; } } 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) @@ -1785,7 +1785,7 @@ if (globalorientation&8) { globalxshift++; globalyshift++; } 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) @@ -1816,7 +1816,7 @@ if (globalorientation&8) { globalxshift++; globalyshift++; } return; } - switch(globalorientation&0x180) + switch (globalorientation&0x180) { case 128: msethlineshift(picsiz[globalpicnum]&15,picsiz[globalpicnum]>>4); @@ -1832,7 +1832,7 @@ if (globalorientation&8) { globalxshift++; globalyshift++; } } 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) @@ -1895,7 +1895,7 @@ static void wallscan(long x1, long x2, short *uwal, short *dwal, long *swal, lon 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]); @@ -1912,10 +1912,10 @@ static void wallscan(long x1, long x2, short *uwal, short *dwal, long *swal, lon 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; @@ -1970,7 +1970,7 @@ static void wallscan(long x1, long x2, short *uwal, short *dwal, long *swal, lon 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]); @@ -1990,7 +1990,7 @@ static void wallscan(long x1, long x2, short *uwal, short *dwal, long *swal, lon #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]); @@ -2180,7 +2180,7 @@ static void ceilspritescan(long x1, long x2) long 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) @@ -2339,7 +2339,7 @@ static void grouscan(long dax1, long dax2, long sectnum, char dastat) m2 = m1+l; mptr1 = (long *)&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; } @@ -2424,7 +2424,7 @@ static void parascan(long dax1, long dax2, long sectnum, char dastat, long bunch 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; @@ -2438,18 +2438,18 @@ static void parascan(long dax1, long dax2, long sectnum, char dastat, long bunch 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] = ((((long)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[((long)radarang2[j]+512)&2047],n); } else @@ -2531,7 +2531,7 @@ static void drawalls(long 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,(char)0); andwstat2 &= wallmost(dplc,z,sectnum,(char)1); @@ -2557,12 +2557,12 @@ static void drawalls(long 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) { @@ -2610,7 +2610,7 @@ static void drawalls(long 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]) { @@ -2622,7 +2622,7 @@ static void drawalls(long bunch) { wallmost(dwall,z,nextsectnum,(char)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 @@ -2658,7 +2658,7 @@ static void drawalls(long 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]) { @@ -2668,7 +2668,7 @@ static void drawalls(long 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]); @@ -2699,7 +2699,7 @@ static void drawalls(long 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]) { @@ -2711,7 +2711,7 @@ static void drawalls(long bunch) { wallmost(uwall,z,nextsectnum,(char)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 @@ -2764,7 +2764,7 @@ static void drawalls(long 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]) { @@ -2774,7 +2774,7 @@ static void drawalls(long 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]); @@ -2807,7 +2807,7 @@ static void drawalls(long bunch) scansector(nextsectnum); else { - for(x=x1;x>= 6; //New hacks (for sized-down voxels) - for(k=0;k 0) { davoxptr = (char *)voxoff[daindex][0]; i = 0; } gyinc = dmulscale10(sprcosang,cosang,sprsinang,sinang); x = 0; y = 0; j = max(daxsiz,daysiz); - for(i=0;i<=j;i++) + for (i=0;i<=j;i++) { ggxinc[i] = x; x += gxinc; ggyinc[i] = y; y += gyinc; @@ -2972,18 +2972,26 @@ if (!davoxptr && i > 0) { davoxptr = (char *)voxoff[daindex][0]; i = 0; } begindrawing(); //{{{ - for(cnt=0;cnt<8;cnt++) + for (cnt=0;cnt<8;cnt++) { - switch(cnt) + switch (cnt) { - case 0: xs = 0; ys = 0; xi = 1; yi = 1; break; - case 1: xs = daxsiz-1; ys = 0; xi = -1; yi = 1; break; - case 2: xs = 0; ys = daysiz-1; xi = 1; yi = -1; break; - case 3: xs = daxsiz-1; ys = daysiz-1; xi = -1; yi = -1; break; - case 4: xs = 0; ys = cbacky; xi = 1; yi = 2; break; - case 5: xs = daxsiz-1; ys = cbacky; xi = -1; yi = 2; break; - case 6: xs = cbackx; ys = 0; xi = 2; yi = 1; break; - case 7: xs = cbackx; ys = daysiz-1; xi = 2; yi = -1; break; + case 0: + xs = 0; ys = 0; xi = 1; yi = 1; break; + case 1: + xs = daxsiz-1; ys = 0; xi = -1; yi = 1; break; + case 2: + xs = 0; ys = daysiz-1; xi = 1; yi = -1; break; + case 3: + xs = daxsiz-1; ys = daysiz-1; xi = -1; yi = -1; break; + case 4: + xs = 0; ys = cbacky; xi = 1; yi = 2; break; + case 5: + xs = daxsiz-1; ys = cbacky; xi = -1; yi = 2; break; + case 6: + xs = cbackx; ys = 0; xi = 2; yi = 1; break; + case 7: + xs = cbackx; ys = daysiz-1; xi = 2; yi = -1; break; } xe = cbackx; ye = cbacky; if (cnt < 4) @@ -3003,19 +3011,35 @@ if (!davoxptr && i > 0) { davoxptr = (char *)voxoff[daindex][0]; i = 0; } } i = ksgn(ys-backy)+ksgn(xs-backx)*3+4; - switch(i) + switch (i) { - case 6: case 7: x1 = 0; y1 = 0; break; - case 8: case 5: x1 = gxinc; y1 = gyinc; break; - case 0: case 3: x1 = gyinc; y1 = -gxinc; break; - case 2: case 1: x1 = gxinc+gyinc; y1 = gyinc-gxinc; break; + case 6: + case 7: + x1 = 0; y1 = 0; break; + case 8: + case 5: + x1 = gxinc; y1 = gyinc; break; + case 0: + case 3: + x1 = gyinc; y1 = -gxinc; break; + case 2: + case 1: + x1 = gxinc+gyinc; y1 = gyinc-gxinc; break; } - switch(i) + switch (i) { - case 2: case 5: x2 = 0; y2 = 0; break; - case 0: case 1: x2 = gxinc; y2 = gyinc; break; - case 8: case 7: x2 = gyinc; y2 = -gxinc; break; - case 6: case 3: x2 = gxinc+gyinc; y2 = gyinc-gxinc; break; + case 2: + case 5: + x2 = 0; y2 = 0; break; + case 0: + case 1: + x2 = gxinc; y2 = gyinc; break; + case 8: + case 7: + x2 = gyinc; y2 = -gxinc; break; + case 6: + case 3: + x2 = gxinc+gyinc; y2 = gyinc-gxinc; break; } oand = pow2char[(xs 0) { davoxptr = (char *)voxoff[daindex][0]; i = 0; } ggxstart = gxstart+ggyinc[ys]; ggystart = gystart-ggxinc[ys]; - for(x=xs;x!=xe;x+=xi) + for (x=xs;x!=xe;x+=xi) { slabxoffs = (long)&davoxptr[B_LITTLE32(longptr[x])]; shortptr = (short *)&davoxptr[((x*(daysiz+1))<<1)+xyvoxoffs]; nx = mulscale16(ggxstart+ggxinc[x],viewingrangerecip)+x1; ny = ggystart+ggyinc[x]; - for(y=ys;y!=ye;y+=yi,nx+=dagyinc,ny-=dagxinc) + for (y=ys;y!=ye;y+=yi,nx+=dagyinc,ny-=dagxinc) { if ((ny <= nytooclose) || (ny >= nytoofar)) continue; voxptr = (char *)(B_LITTLE16(shortptr[y])+slabxoffs); @@ -3054,7 +3078,7 @@ if (!davoxptr && i > 0) { davoxptr = (char *)voxoff[daindex][0]; i = 0; } 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]; @@ -3261,7 +3285,7 @@ static void drawsprite(long snum) dalx2 = max(xb1[j],lx); darx2 = min(xb2[j],rx); - switch(smostwalltype[i]) + switch (smostwalltype[i]) { case 0: if (dalx2 <= darx2) @@ -3273,13 +3297,13 @@ static void drawsprite(long 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; @@ -3288,7 +3312,7 @@ static void drawsprite(long 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)); @@ -3433,7 +3457,7 @@ static void drawsprite(long 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]; } @@ -3477,10 +3501,10 @@ static void drawsprite(long snum) owallmost(uwall,(long)(MAXWALLSB-1),z1-globalposz); owallmost(dwall,(long)(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]; @@ -3547,7 +3571,7 @@ static void drawsprite(long snum) { if (dalx2 < xb1[MAXWALLSB-1]) dalx2 = xb1[MAXWALLSB-1]; if (darx2 > xb2[MAXWALLSB-1]) darx2 = xb2[MAXWALLSB-1]; - switch(smostwalltype[i]) + switch (smostwalltype[i]) { case 0: if (dalx2 <= darx2) @@ -3559,12 +3583,12 @@ static void drawsprite(long 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; } @@ -3666,7 +3690,7 @@ static void drawsprite(long 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; @@ -3829,7 +3853,7 @@ static void drawsprite(long snum) dalx2 = max(xb1[j],lx); darx2 = min(xb2[j],rx); - switch(smostwalltype[i]) + switch (smostwalltype[i]) { case 0: if (dalx2 <= darx2) @@ -3841,12 +3865,12 @@ static void drawsprite(long 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; } @@ -3905,12 +3929,12 @@ static void drawsprite(long snum) long nxrepeat, nyrepeat; lx = 0; rx = xdim-1; - for(x=lx;x<=rx;x++) + for (x=lx;x<=rx;x++) { lwall[x] = (long)startumost[x+windowx1]-windowy1; swall[x] = (long)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; @@ -3919,7 +3943,7 @@ static void drawsprite(long snum) dalx2 = max(xb1[j],lx); darx2 = min(xb2[j],rx); - switch(smostwalltype[i]) + switch (smostwalltype[i]) { case 0: if (dalx2 <= darx2) @@ -3931,12 +3955,12 @@ static void drawsprite(long 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; } @@ -3944,12 +3968,12 @@ static void drawsprite(long snum) if (lwall[rx] >= swall[rx]) { - for(x=lx;xnextsector,(char)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,(char)1); wallmost(dplc,z,(long)wal->nextsector,(char)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 = (long)wal->cstat; @@ -4087,7 +4111,7 @@ static void drawmaskwall(short 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; @@ -4095,7 +4119,7 @@ static void drawmaskwall(short damaskwallcnt) lx = max(xb1[j],xb1[z]); rx = min(xb2[j],xb2[z]); - switch(smostwalltype[i]) + switch (smostwalltype[i]) { case 0: if (lx <= rx) @@ -4107,12 +4131,12 @@ static void drawmaskwall(short 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; } @@ -4153,19 +4177,19 @@ static void fillpolygon(long 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); @@ -4177,12 +4201,12 @@ static void fillpolygon(long 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; } } } } @@ -4197,13 +4221,13 @@ static void fillpolygon(long 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; @@ -4296,8 +4320,8 @@ static long clippoly(long npoints, long 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; @@ -4627,7 +4651,7 @@ if (dastat&16) { xoff = 0; yoff = 0; } setgotpic(picnum); bufplc = waloff[picnum]; - if(!palookup[dapalnum]) dapalnum = 0; + if (!palookup[dapalnum]) dapalnum = 0; palookupoffs = FP_OFF(palookup[dapalnum]) + (getpalookup(0L,(long)dashade)<<8); i = divscale32(1L,z); @@ -4676,10 +4700,10 @@ if (dastat&16) { xoff = 0; yoff = 0; } 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] = (unsigned short)(msqrtasm((i<<18)+131072)<<1); @@ -5007,7 +5039,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)); @@ -5020,14 +5052,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((long)radarang[k+1]-(long)radarang[k],j); radarang2[i] = (short)(((long)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 @@ -5042,10 +5074,10 @@ static void calcbritable(void) { int 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] = (char)(pow((double)j,a)*b); } } @@ -5058,13 +5090,13 @@ static int 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); @@ -5092,7 +5124,7 @@ static void initfastcolorlookup(long rscale, long gscale, long 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; @@ -5107,7 +5139,7 @@ static void initfastcolorlookup(long rscale, long gscale, long 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; @@ -5116,9 +5148,9 @@ static void initfastcolorlookup(long rscale, long gscale, long 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; } @@ -5173,7 +5205,7 @@ static long getclosestcol(long r, long g, long 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]; @@ -5197,7 +5229,7 @@ static long getclosestcol(long r, long g, long 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; @@ -5405,7 +5437,7 @@ static long raytrace(long x3, long y3, long *x4, long *y4) long 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; @@ -5446,19 +5478,29 @@ static void sighandler(int sig, const siginfo_t *info, void *ctx) switch (sig) { case SIGFPE: switch (info->si_code) { - case FPE_INTDIV: s = "FPE_INTDIV (integer divide by zero)"; break; - case FPE_INTOVF: s = "FPE_INTOVF (integer overflow)"; break; - case FPE_FLTDIV: s = "FPE_FLTDIV (floating-point divide by zero)"; break; - case FPE_FLTOVF: s = "FPE_FLTOVF (floating-point overflow)"; break; - case FPE_FLTUND: s = "FPE_FLTUND (floating-point underflow)"; break; - case FPE_FLTRES: s = "FPE_FLTRES (floating-point inexact result)"; break; - case FPE_FLTINV: s = "FPE_FLTINV (floating-point invalid operation)"; break; - case FPE_FLTSUB: s = "FPE_FLTSUB (floating-point subscript out of range)"; break; - default: s = "?! (unknown)"; break; + case FPE_INTDIV: + s = "FPE_INTDIV (integer divide by zero)"; break; + case FPE_INTOVF: + s = "FPE_INTOVF (integer overflow)"; break; + case FPE_FLTDIV: + s = "FPE_FLTDIV (floating-point divide by zero)"; break; + case FPE_FLTOVF: + s = "FPE_FLTOVF (floating-point overflow)"; break; + case FPE_FLTUND: + s = "FPE_FLTUND (floating-point underflow)"; break; + case FPE_FLTRES: + s = "FPE_FLTRES (floating-point inexact result)"; break; + case FPE_FLTINV: + s = "FPE_FLTINV (floating-point invalid operation)"; break; + case FPE_FLTSUB: + s = "FPE_FLTSUB (floating-point subscript out of range)"; break; + default: + s = "?! (unknown)"; break; } fprintf(stderr, "Caught SIGFPE at address %p, code %s. Aborting.\n", info->si_addr, s); break; - default: break; + default: + break; } abort(); } @@ -5519,14 +5561,14 @@ int 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 @@ -5539,7 +5581,7 @@ int initengine(void) searchit = 0; searchstat = -1; - 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]; } @@ -5916,8 +5958,8 @@ void drawmasks(void) _equation maskeq, p1eq, p2eq; _point2d dot, dot2, middle, pos, spr; - 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); @@ -5943,9 +5985,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]); @@ -5957,13 +5999,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) @@ -5975,8 +6017,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]); @@ -6025,14 +6067,14 @@ killsprite: //Need to store alpha flag with all textures before this works right! if (rendmode == 3) { - for(i=spritesortcnt-1;i>=0;i--) + for (i=spritesortcnt-1;i>=0;i--) if ((!(tspriteptr[i]->cstat&2)) #ifdef USE_OPENGL && (!gltexmayhavealpha(tspriteptr[i]->picnum,tspriteptr[i]->pal)) #endif ) { drawsprite(i); tspriteptr[i] = 0; } //draw only if it is fully opaque - for(i=j=0;i=0;i--) + for (i=maskwallcnt-1;i>=0;i--) { k = thewall[maskwall[i]]; if ((!(wall[k].cstat&128)) @@ -6051,7 +6093,7 @@ killsprite: ) { drawmaskwall(i); maskwall[i] = -1; } //draw only if it is fully opaque } - for(i=j=0;i=0;i--) + for (i=spritesortcnt-2;i>=0;i--) if ((xb1[j] <= (spritesx[i]>>8)) && ((spritesx[i]>>8) <= xb2[j])) if (spritewallfront(tspriteptr[i],(long)thewall[j]) == 0) { @@ -6081,7 +6123,7 @@ killsprite: } if (k >= 0) //remove holes in sprite list { - for(i=k;iowner >= 0) { if (i > k) @@ -6302,13 +6344,13 @@ void drawmapview(long dax, long day, long zoome, short 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); @@ -6321,7 +6363,7 @@ void drawmapview(long dax, long day, long zoome, short 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 @@ -6348,7 +6390,7 @@ void drawmapview(long dax, long day, long zoome, short 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; @@ -6430,15 +6472,15 @@ void drawmapview(long dax, long day, long zoome, short 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) @@ -6657,7 +6699,7 @@ long loadboard(char *filename, char fromwhere, long *daposx, long *daposy, long sprite[i].extra = B_LITTLE16(sprite[i].extra); } - for(i=0;i MAXSECTORS) { kclose(fil); return(-1); } for (i=0; i MAXWALLS) { kclose(fil); return(-1); } for (i=0; i MAXWALLS) { kclose(fil); return(-1); } v5wall.hitag = B_LITTLE16(v5wall.hitag); v5wall.extra = B_LITTLE16(v5wall.extra); break; - case 6: kread(fil,&v6wall,sizeof(struct walltypev6)); + case 6: + kread(fil,&v6wall,sizeof(struct walltypev6)); v6wall.x = B_LITTLE32(v6wall.x); v6wall.y = B_LITTLE32(v6wall.y); v6wall.point2 = B_LITTLE16(v6wall.point2); @@ -7066,8 +7114,10 @@ if (numwalls > MAXWALLS) { kclose(fil); return(-1); } break; } switch (mapversion) { - case 5: convertv5wallv6(&v5wall,&v6wall,i); - case 6: convertv6wallv7(&v6wall,&wall[i]); + case 5: + convertv5wallv6(&v5wall,&v6wall,i); + case 6: + convertv6wallv7(&v6wall,&wall[i]); } } @@ -7075,7 +7125,8 @@ if (numwalls > MAXWALLS) { kclose(fil); return(-1); } if (numsprites > MAXSPRITES) { kclose(fil); return(-1); } for (i=0; i MAXSPRITES) { kclose(fil); return(-1); } v5spr.hitag = B_LITTLE16(v5spr.hitag); v5spr.extra = B_LITTLE16(v5spr.extra); break; - case 6: kread(fil,&v6spr,sizeof(struct spritetypev6)); + case 6: + kread(fil,&v6spr,sizeof(struct spritetypev6)); v6spr.x = B_LITTLE32(v6spr.x); v6spr.y = B_LITTLE32(v6spr.y); v6spr.z = B_LITTLE32(v6spr.z); @@ -7110,12 +7162,14 @@ if (numsprites > MAXSPRITES) { kclose(fil); return(-1); } break; } switch (mapversion) { - case 5: convertv5sprv6(&v5spr,&v6spr); - case 6: convertv6sprv7(&v6spr,&sprite[i]); + case 5: + convertv5sprv6(&v5spr,&v6spr); + case 6: + convertv6sprv7(&v6spr,&sprite[i]); } } - for(i=0;i - { - int ang; - if (scriptfile_getnumber(script, &ang)) break; + { + int ang; + if (scriptfile_getnumber(script, &ang)) break; - if (whichsprite < 0) { - // no sprite directive preceeding - initprintf("Ignoring angle offset directive because of absent/invalid sprite number on line %s:%d\n", - script->filename, scriptfile_getlinum(script,cmdtokptr)); - break; - } - spriteext[whichsprite].angoff = (short)ang; + if (whichsprite < 0) { + // no sprite directive preceeding + initprintf("Ignoring angle offset directive because of absent/invalid sprite number on line %s:%d\n", + script->filename, scriptfile_getlinum(script,cmdtokptr)); + break; } - break; + spriteext[whichsprite].angoff = (short)ang; + } + break; case 2: // notmd if (whichsprite < 0) { // no sprite directive preceeding @@ -7244,7 +7298,7 @@ long saveboard(char *filename, long *daposx, long *daposy, long *daposz, return(-1); numsprites = 0; - for(j=0;j>5)*40+32,(j&31)*6,31,-1,snotbuf,1); - switch(qsetmode) + switch (qsetmode) { case 200: 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 > 0) && (per->pagesleft <= numpages)) @@ -7450,7 +7504,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) @@ -7494,7 +7548,7 @@ long loadpics(char *filename, long askedsize) Bstrcpy(artfilename,filename); - for(i=0;i 1) && (pow2long[j] > tilesizx[i])) j--; @@ -7617,7 +7671,7 @@ void loadtile(short tilenume) allocache(&waloff[tilenume],dasiz,&walock[tilenume]); } - if(!faketile[tilenume]) + if (!faketile[tilenume]) { if (artfilplc != tilefileoffs[tilenume]) { @@ -7682,10 +7736,10 @@ void copytilepiece(long tilenume1, long sx1, long sy1, long xsiz, long ysiz, 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; @@ -8050,11 +8104,11 @@ long cansee(long x1, long y1, long z1, short sect1, long x2, long y2, long z2, s getzsofslope((short)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); } @@ -8171,7 +8225,7 @@ long hitscan(long xs, long ys, long zs, short sectnum, long vx, long vy, long vz } 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; @@ -8196,12 +8250,12 @@ long hitscan(long xs, long ys, long zs, short sectnum, long vx, long vy, long vz continue; } - 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]; cstat = spr->cstat; @@ -8211,7 +8265,7 @@ long hitscan(long xs, long ys, long zs, short sectnum, long vx, long vy, long vz if ((cstat&dasprclipmask) == 0) continue; x1 = spr->x; y1 = spr->y; z1 = spr->z; - switch(cstat&48) + switch (cstat&48) { case 0: topt = vx*(x1-xs) + vy*(y1-ys); if (topt <= 0) continue; @@ -8366,7 +8420,7 @@ long neartag(long xs, long ys, long zs, short sectnum, short ange, short *nearta 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; @@ -8396,14 +8450,14 @@ long neartag(long xs, long ys, long zs, short sectnum, short ange, short *nearta } 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]; @@ -8585,7 +8639,7 @@ long clipmove (long *x, long *y, long *z, short *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; @@ -8641,19 +8695,19 @@ long clipmove (long *x, long *y, long *z, short *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; if ((cstat&dasprclipmask) == 0) continue; x1 = spr->x; y1 = spr->y; - switch(cstat&48) + switch (cstat&48) { case 0: if ((x1 >= xmin) && (x1 <= xmax) && (y1 >= ymin) && (y1 <= ymax)) @@ -8794,7 +8848,7 @@ long clipmove (long *x, long *y, long *z, short *sectnum, } templong1 = dmulscale6(lx,oxvect,ly,oyvect); - for(i=cnt+1;i<=clipmoveboxtracenum;i++) + for (i=cnt+1;i<=clipmoveboxtracenum;i++) { j = hitwalls[i]; templong2 = dmulscale6(clipit[j].x2-clipit[j].x1,oxvect,clipit[j].y2-clipit[j].y1,oyvect); @@ -8818,7 +8872,7 @@ long clipmove (long *x, long *y, long *z, short *sectnum, *y = inty; } while (((xvect|yvect) != 0) && (hitwall >= 0) && (cnt > 0)); - for(j=0;j=0;j--) + for (j=numsectors-1;j>=0;j--) if (inside(*x,*y,j) == 1) { if (sector[j].ceilingstat&2) @@ -8929,7 +8983,7 @@ long pushmove (long *x, long *y, long *z, short *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(*x,*y,i,walldist-4) == 1) { j = 0; @@ -8982,7 +9036,7 @@ long pushmove (long *x, long *y, long *z, short *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; } @@ -9025,7 +9079,7 @@ void updatesector(long x, long y, short *sectnum) } while (j != 0); } - for(i=numsectors-1;i>=0;i--) + for (i=numsectors-1;i>=0;i--) if (inside(x,y,(short)i) == 1) { *sectnum = i; @@ -9153,7 +9207,7 @@ void getzrange(long x, long y, long z, short sectnum, { sec = §or[clipsectorlist[clipsectcnt]]; startwall = sec->wallptr; endwall = startwall + sec->wallnum; - for(j=startwall,wal=&wall[startwall];jnextsector; if (k >= 0) @@ -9180,7 +9234,7 @@ void getzrange(long x, long y, long z, short sectnum, if (((sec->floorstat&1) == 0) && (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; @@ -9200,9 +9254,9 @@ void getzrange(long x, long y, long z, short sectnum, clipsectcnt++; } 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; @@ -9211,7 +9265,7 @@ void getzrange(long x, long y, long z, short sectnum, x1 = spr->x; y1 = spr->y; clipyou = 0; - switch(cstat&48) + switch (cstat&48) { case 0: k = walldist+(spr->clipdist<<2)+1; @@ -9327,10 +9381,10 @@ void setview(long x1, long y1, long x2, long y2) setaspect(65536L,(long)divscale16(ydim*320L,xdim*200L)); - for(i=0;ipagesleft&127) == 0) continue; @@ -9419,7 +9473,7 @@ void rotatesprite(long sx, long sy, long z, short a, short picnum, signed char d 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; @@ -9464,11 +9518,11 @@ void makepalookup(long palnum, char *remapbuf, signed char r, signed char g, sig 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); } } } @@ -9864,7 +9918,7 @@ if (inpreparemirror) { inpreparemirror = 0; return; } 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]; @@ -10007,7 +10061,7 @@ long loopnumofsector(short sectnum, short 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)); @@ -10059,9 +10113,9 @@ void setfirstwall(short sectnum, short newfirstwall) if (newfirstwall >= startwall+danumwalls) newfirstwall -= danumwalls; } - for(i=0;i= numwallsofloop) k -= numwallsofloop; @@ -10073,7 +10127,7 @@ void setfirstwall(short sectnum, short newfirstwall) wall[startwall+i].point2 += startwall; } - for(i=startwall;i= 0) wall[wall[i].nextwall].nextwall = i; } @@ -10152,7 +10206,7 @@ void drawline256(long x1, long y1, long x2, long y2, char col) i = ((x1+2048)>>12); daend = ((x2+2048)>>12); begindrawing(); //{{{ - for(;i>12); if ((j >= startumost[i]) && (j < startdmost[i])) @@ -10175,7 +10229,7 @@ void drawline256(long x1, long y1, long x2, long y2, char col) begindrawing(); //{{{ p = ylookup[i]+frameplace; - for(;i>12); if ((i >= startumost[j]) && (i < startdmost[j])) @@ -10241,7 +10295,7 @@ void drawline16(long x1, long y1, long x2, long y2, char col) i = ((long)col<<24)|((long)col<<16)|((long)col<<8)|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); @@ -10263,7 +10317,7 @@ void drawline16(long x1, long y1, long x2, long 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); @@ -10502,7 +10556,7 @@ void draw2dgrid(long posxe, long posye, short ange, long zoome, short gride) 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); @@ -10525,7 +10579,7 @@ void draw2dgrid(long posxe, long posye, short ange, long zoome, short gride) 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) @@ -10568,7 +10622,7 @@ void draw2dscreen(long posxe, long posye, short ange, long zoome, short gride) } faketimerhandler(); - for(i=numwalls-1,wal=&wall[i];i>=0;i--,wal--) + for (i=numwalls-1,wal=&wall[i];i>=0;i--,wal--) { if (editstatus == 0) { @@ -10654,8 +10708,8 @@ void draw2dscreen(long posxe, long posye, short ange, long zoome, short gride) 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; @@ -10937,13 +10991,13 @@ void printext16(long xpos, long ypos, short col, short backcol, char *name, char else { fontptr = textfont; charxsiz = 8; } begindrawing(); //{{{ - for(i=0;name[i];i++) + for (i=0;name[i];i++) { 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] = (char)col; @@ -10997,12 +11051,12 @@ void printext256(long xpos, long ypos, short col, short backcol, char *name, cha bglBegin(GL_POINTS); - for(i=0;name[i];i++) { + for (i=0;name[i];i++) { letptr = &fontptr[name[i]<<3]; xx = stx-fontsize; yy = ypos+7 + 2; //+1 is hack! - for(y=7;y>=0;y--) { - for(x=charxsiz-1;x>=0;x--) { + for (y=7;y>=0;y--) { + for (x=charxsiz-1;x>=0;x--) { if (letptr[y]&pow2char[7-fontsize-x]) { if (lc!=col) bglColor4ub(p.r,p.g,p.b,255); @@ -11028,13 +11082,13 @@ void printext256(long xpos, long ypos, short col, short backcol, char *name, cha #endif begindrawing(); //{{{ - for(i=0;name[i];i++) + for (i=0;name[i];i++) { 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] = (char)col; diff --git a/polymer/build/src/glbuild.c b/polymer/build/src/glbuild.c index 525bdda40..d781054e0 100644 --- a/polymer/build/src/glbuild.c +++ b/polymer/build/src/glbuild.c @@ -6,12 +6,12 @@ #if defined USE_OPENGL - #ifdef RENDERTYPESDL +#ifdef RENDERTYPESDL # ifdef __APPLE__ # include # else - #include "SDL.h" - #endif +#include "SDL.h" +#endif #endif void (APIENTRY * bglClearColor)( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); @@ -57,7 +57,7 @@ void (APIENTRY * bglBegin)( GLenum mode ); void (APIENTRY * bglEnd)( void ); void (APIENTRY * bglVertex2f)( GLfloat x, GLfloat y ); void (APIENTRY * bglVertex2i)( GLint x, GLint y ); -void (APIENTRY * bglVertex3f)( GLfloat x, GLfloat y, GLfloat z ); +void (APIENTRY * bglVertex3f)( GLfloat x, GLfloat y, GLfloat z ); void (APIENTRY * bglVertex3d)( GLdouble x, GLdouble y, GLdouble z ); void (APIENTRY * bglVertex3fv)( const GLfloat *v ); void (APIENTRY * bglVertex3dv)( const GLdouble *v ); @@ -160,7 +160,7 @@ int loadgldriver(const char *driver) #endif if (!driver) { - #ifdef _WIN32 +#ifdef _WIN32 driver = "OPENGL32.DLL"; #elif defined __APPLE__ driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL"; diff --git a/polymer/build/src/gtkbits.c b/polymer/build/src/gtkbits.c index 83d246bca..ec06612d6 100644 --- a/polymer/build/src/gtkbits.c +++ b/polymer/build/src/gtkbits.c @@ -66,11 +66,11 @@ extern struct sdlappicon sdlappicon; void gtkbuild_init(int *argc, char ***argv) { #ifndef LINKED_GTK - gtkenabled = dynamicgtk_init(); - if (gtkenabled < 0) { - gtkenabled = 0; - return; - } + gtkenabled = dynamicgtk_init(); + if (gtkenabled < 0) { + gtkenabled = 0; + return; + } #endif gtkenabled = gtk_init_check(argc, argv); if (!gtkenabled) return; @@ -84,10 +84,10 @@ void gtkbuild_init(int *argc, char ***argv) void gtkbuild_exit(int r) { - if (gtkenabled) { - if (appicon) g_object_unref((gpointer)appicon); - } + if (gtkenabled) { + if (appicon) g_object_unref((gpointer)appicon); + } #ifndef LINKED_GTK - dynamicgtk_uninit(); + dynamicgtk_uninit(); #endif } diff --git a/polymer/build/src/kplib.c b/polymer/build/src/kplib.c index eaed118f5..38a7dea12 100644 --- a/polymer/build/src/kplib.c +++ b/polymer/build/src/kplib.c @@ -257,7 +257,8 @@ static _inline long bitrev (long b, long c) mov edx, b mov ecx, c xor eax, eax - beg: shr edx, 1 + beg: + shr edx, 1 adc eax, eax sub ecx, 1 jnz short beg @@ -349,7 +350,7 @@ static inline unsigned long bswap (unsigned long a) static inline long bitrev (long b, long c) { long 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;i>(coltype<<2))&15)*ixsiz; switch (bitdepth) { - case 1: xsizbpl = ((xsizbpl+7)>>3); break; - case 2: xsizbpl = ((xsizbpl+3)>>2); break; - case 4: xsizbpl = ((xsizbpl+1)>>1); break; + case 1: + xsizbpl = ((xsizbpl+7)>>3); break; + case 2: + xsizbpl = ((xsizbpl+3)>>2); break; + case 4: + xsizbpl = ((xsizbpl+1)>>1); break; } memset(olinbuf,0,(xsizbpl+1)*sizeof(olinbuf[0])); @@ -549,13 +553,16 @@ if (coltype == 4) { xr0 = xr0*2; xr1 = xr1*2; } else if (coltype == 6) { xr0 = xr0*4-2; xr1 = xr1*4-2; } else { - switch(bitdepth) + switch (bitdepth) { - case 1: xr0 += ((-ixsiz)&7)+7; + case 1: + xr0 += ((-ixsiz)&7)+7; xr1 += ((-ixsiz)&7)+7; break; - case 2: xr0 = ((xr0+((-ixsiz)&3)+3)<<1); + case 2: + xr0 = ((xr0+((-ixsiz)&3)+3)<<1); xr1 = ((xr1+((-ixsiz)&3)+3)<<1); break; - case 4: xr0 = ((xr0+((-ixsiz)&1)+1)<<2); + case 4: + xr0 = ((xr0+((-ixsiz)&1)+1)<<2); xr1 = ((xr1+((-ixsiz)&1)+1)<<2); break; } } @@ -674,17 +681,20 @@ static _inline void rgbhlineasm (long c, long d, long t, long b) add edx, offset olinbuf cmp dword ptr trnsrgb, 0 jz short begit2 - begit: mov eax, dword ptr [ecx+edx] + begit: + mov eax, dword ptr [ecx+edx] or eax, 0xff000000 cmp eax, dword ptr trnsrgb jne short skipit and eax, 0xffffff - skipit: sub ecx, 3 + skipit: + sub ecx, 3 mov [edi], eax lea edi, [edi+ebx] jnz short begit jmp short endit - begit2: mov eax, dword ptr [ecx+edx] + begit2: + mov eax, dword ptr [ecx+edx] or eax, 0xff000000 sub ecx, 3 mov [edi], eax @@ -705,7 +715,8 @@ static _inline void pal8hlineasm (long c, long d, long t, long b) sub ecx, edx jle short endit add edx, offset olinbuf - begit: movzx eax, byte ptr [ecx+edx] + begit: + movzx eax, byte ptr [ecx+edx] mov eax, dword ptr palcol[eax*4] sub ecx, 1 mov [edi], eax @@ -770,10 +781,10 @@ static inline void rgbhlineasm (long x, long xr1, long p, long ixstp) long i; if (!trnsrgb) { - for(;x>xr1;p+=ixstp,x-=3) *(long *)p = (*(long *)&olinbuf[x])|LSWAPIB(0xff000000); + for (;x>xr1;p+=ixstp,x-=3) *(long *)p = (*(long *)&olinbuf[x])|LSWAPIB(0xff000000); return; } - for(;x>xr1;p+=ixstp,x-=3) + for (;x>xr1;p+=ixstp,x-=3) { i = (*(long *)&olinbuf[x])|LSWAPIB(0xff000000); if (i == trnsrgb) i &= LSWAPIB(0xffffff); @@ -783,7 +794,7 @@ static inline void rgbhlineasm (long x, long xr1, long p, long ixstp) static inline void pal8hlineasm (long x, long xr1, long p, long ixstp) { - for(;x>xr1;p+=ixstp,x--) *(long *)p = palcol[olinbuf[x]]; + for (;x>xr1;p+=ixstp,x--) *(long *)p = palcol[olinbuf[x]]; } #endif @@ -867,7 +878,7 @@ static void putbuf (const unsigned char *buf, long 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! @@ -882,7 +893,7 @@ static void putbuf (const unsigned char *buf, long 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! @@ -901,12 +912,16 @@ static void putbuf (const unsigned char *buf, long leng) } break; default: - switch(bitdepth) + switch (bitdepth) { - case 1: for(;x>xr1;p+=ixstp,x-- ) *(long *)p = palcol[olinbuf[x>>3]>>(x&7)]; break; - case 2: for(;x>xr1;p+=ixstp,x-=2) *(long *)p = palcol[olinbuf[x>>3]>>(x&6)]; break; - case 4: for(;x>xr1;p+=ixstp,x-=4) *(long *)p = palcol[olinbuf[x>>3]>>(x&4)]; break; - case 8: pal8hlineasm(x,xr1,p,ixstp); break; //for(;x>xr1;p+=ixstp,x--) *(long *)p = palcol[olinbuf[x]]; break; + case 1: + for (;x>xr1;p+=ixstp,x-- ) *(long *)p = palcol[olinbuf[x>>3]>>(x&7)]; break; + case 2: + for (;x>xr1;p+=ixstp,x-=2) *(long *)p = palcol[olinbuf[x>>3]>>(x&6)]; break; + case 4: + for (;x>xr1;p+=ixstp,x-=4) *(long *)p = palcol[olinbuf[x>>3]>>(x&4)]; break; + case 8: + pal8hlineasm(x,xr1,p,ixstp); break; //for(;x>xr1;p+=ixstp,x--) *(long *)p = palcol[olinbuf[x]]; break; } break; } @@ -934,13 +949,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)); @@ -951,7 +966,7 @@ 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; } } @@ -992,27 +1007,29 @@ static long kpngrend (const char *kfilebuf, long kfilength, { j = 0xff000000; k = (255 / ((1<=0;i--) palcol[i] = LSWAPIB((LSWAPIL(*(long *)&filptr[i*3])>>8)|0xff000000); + for (i=paleng-1;i>=0;i--) palcol[i] = LSWAPIB((LSWAPIL(*(long *)&filptr[i*3])>>8)|0xff000000); } else if (i == LSWAPIB(0x44474b62)) //bKGD (must be after PLTE and before IDAT) { - switch(coltype) + switch (coltype) { - case 0: case 4: + case 0: + case 4: bakcol = (((long)filptr[0]<<8)+(long)filptr[1])*255/((1<=0;i--) + for (i=min(leng,paleng)-1;i>=0;i--) palcol[i] &= LSWAPIB((((long)filptr[i])<<24)|0xffffff); break; - default:; + default: + ; } } else if (i == LSWAPIB(0x54414449)) { break; } //IDAT @@ -1064,16 +1082,23 @@ static long kpngrend (const char *kfilebuf, long kfilength, switch (coltype) { - case 4: xmn[0] = 1; xmn[1] = 0; break; - case 2: xmn[0] = 1; xmn[1] = 2; xmn[2] = 0; break; - case 6: xmn[0] = 1; xmn[1] = 2; xmn[2] = 3; xmn[3] = 0; break; - default: xmn[0] = 0; break; + case 4: + xmn[0] = 1; xmn[1] = 0; break; + case 2: + xmn[0] = 1; xmn[1] = 2; xmn[2] = 0; break; + case 6: + xmn[0] = 1; xmn[1] = 2; xmn[2] = 3; xmn[3] = 0; break; + default: + xmn[0] = 0; break; } switch (bitdepth) { - case 1: 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; - case 4: for(i=16;i<256;i++) palcol[i] = palcol[i&15]; break; + case 1: + 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; + case 4: + for (i=16;i<256;i++) palcol[i] = palcol[i&15]; break; } //coltype: bitdepth: format: @@ -1085,9 +1110,12 @@ static long kpngrend (const char *kfilebuf, long kfilength, xsizbpl = ((0x04021301>>(coltype<<2))&15)*xsiz; switch (bitdepth) { - case 1: xsizbpl = ((xsizbpl+7)>>3); break; - case 2: xsizbpl = ((xsizbpl+3)>>2); break; - case 4: xsizbpl = ((xsizbpl+1)>>1); break; + case 1: + xsizbpl = ((xsizbpl+7)>>3); break; + case 2: + xsizbpl = ((xsizbpl+3)>>2); break; + case 4: + xsizbpl = ((xsizbpl+1)>>1); break; } //Tests to see if xsiz > allocated space in olinbuf //Note: xsizbpl gets re-written inside initpass() @@ -1106,7 +1134,7 @@ static long kpngrend (const char *kfilebuf, long 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) { @@ -1122,17 +1150,17 @@ static long kpngrend (const char *kfilebuf, long 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] = (unsigned char)(1<<(unzig[i]>>3)); + for (i=64-1;i>=0;i--) zigit[unzig[i]] = i; + for (i=64-1;i>=0;i--) dcflagor[i] = (unsigned char)(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]); @@ -1324,7 +1353,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 @@ -1342,7 +1371,7 @@ static void huffgetval (long index, long curbits, long num, long *daval, long *d 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]) { @@ -1358,10 +1387,10 @@ static void huffgetval (long index, long curbits, long num, long *daval, long *d static void invdct8x8 (long *dc, unsigned char dcflag) { - #define SQRT2 23726566 //(sqrt(2))<<24 - #define C182 31000253 //(cos(PI/8)*2)<<24 - #define C18S22 43840978 //(cos(PI/8)*sqrt(2)*2)<<24 - #define C38S22 18159528 //(cos(PI*3/8)*sqrt(2)*2)<<24 +#define SQRT2 23726566 //(sqrt(2))<<24 +#define C182 31000253 //(cos(PI/8)*2)<<24 +#define C18S22 43840978 //(cos(PI/8)*sqrt(2)*2)<<24 +#define C38S22 18159528 //(cos(PI*3/8)*sqrt(2)*2)<<24 long *edc, t0, t1, t2, t3, t4, t5, t6, t7; edc = dc+64; @@ -1406,11 +1435,11 @@ static void yrbrend (long x, long y) long i, j, ox, oy, xx, yy, xxx, yyy, xxxend, yyyend, yv, cr, cb, p, pp, *odc, *dc, *dc2; 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); @@ -1420,9 +1449,9 @@ static void yrbrend (long x, long y) yyyend = min(clipydim-oy,8); if ((lcomphsamp[0] == 1) && (xxxend == 8)) { - for(yyy=0;yyy>13)&~1; @@ -1438,9 +1467,9 @@ static void yrbrend (long x, long y) } else if ((lcomphsamp[0] == 2) && (xxxend == 8)) { - for(yyy=0;yyy>1)+64]>>13)&~1; @@ -1463,10 +1492,10 @@ static void yrbrend (long x, long y) } else { - for(yyy=0;yyy>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; @@ -1569,14 +1600,14 @@ case 0xc0: case 0xc1: case 0xc2: 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,(long)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; @@ -1596,7 +1627,7 @@ case 0xc0: case 0xc1: case 0xc2: ch = *kfileptr++; leng--; index = (ch&15); prec = (ch>>4); - for(z=0;z<64;z++) + for (z=0;z<64;z++) { v = (long)(*kfileptr++); if (prec) v = (v<<8)+((long)(*kfileptr++)); @@ -1619,7 +1650,7 @@ case 0xc0: case 0xc1: case 0xc2: lnumcomponents = (long)(*kfileptr++); if (!lnumcomponents) { if (dctbuf) free(dctbuf); return(-1); } if (lnumcomponents > 1) coltype = 2; - for(z=0;z>4); @@ -1636,7 +1667,7 @@ case 0xc0: case 0xc1: case 0xc2: 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]; @@ -1645,12 +1676,12 @@ case 0xc0: case 0xc1: case 0xc2: z = zz*64*sizeof(short); dctbuf = (short *)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>lshy[c])*ldctx[c] + ((x+xx)>>lshx[c]))<<6]; @@ -1740,7 +1771,7 @@ case 0xc0: case 0xc1: case 0xc2: z = max(Ss,1); dcflag = 1; if (eobrun <= 0) { - for(;z<=Se;z++) + for (;z<=Se;z++) { while (curbits < 24) //Getbits { @@ -1812,7 +1843,7 @@ case 0xc0: case 0xc1: case 0xc2: if ((Ah) && (eobrun > 0)) { eobrun--; - for(;z<=Se;z++) + for (;z<=Se;z++) { if (!dcs[z]) continue; while (curbits < 24) //Getbits @@ -1826,7 +1857,7 @@ case 0xc0: case 0xc1: case 0xc2: 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; } } @@ -1841,22 +1872,25 @@ case 0xc0: case 0xc1: case 0xc2: 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; } } -kpegrend_break2:; +kpegrend_break2: + ; if (!dctbuf) return(0); passcnt++; kfileptr -= ((curbits>>3)+1); break; - case 0xd9: break; - default: kfileptr += leng; break; + case 0xd9: + break; + default: + kfileptr += leng; break; } } while (kfileptr-(unsigned char *)kfilebuf < kfilength); 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] = ((long)dcs[zigit[z]])*quanptr[z]; + for (z=0;z<64;z++) dc[z] = ((long)dcs[zigit[z]])*quanptr[z]; invdct8x8(dc,-1); } yrbrend(x,y); @@ -1928,9 +1962,9 @@ if (ptr[-1]&64) { yinc = 8; ilacefirst = 1; } 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) @@ -1948,14 +1982,14 @@ if (ptr[-1]&64) { yinc = 8; ilacefirst = 1; } xx[3] = min(daglobxoffs+xsiz ,daxres); yy[3] = min(daglobyoffs+ysiz ,dayres); lptr = (long *)(yy[0]*dabytesperline+daframeplace); - for(y=yy[0];y=0;i--) { suffix[i] = (char)(prefix[i] = i); } + for (i=lzcols-1;i>=0;i--) { suffix[i] = (char)(prefix[i] = i); } currstr = lzcols+2; numbits = startnumbits; numbitgoal = (lzcols<<1); blocklen = *ptr++; memcpy(filbuffer,ptr,blocklen); ptr += blocklen; @@ -1996,11 +2030,11 @@ if (ptr[-1]&64) { yinc = 8; ilacefirst = 1; } { 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] = (char)prefix[dat]; suffix[currstr-1] = suffix[currstr] = (char)dat; - for(;i>=0;i--) + for (;i>=0;i--) { if ((unsigned long)x < (unsigned long)daxres) *(long *)(yoff+(x<<2)) = palcol[(long)tempstack[i]]; @@ -2009,12 +2043,16 @@ if (ptr[-1]&64) { yinc = 8; ilacefirst = 1; } { y += yinc; if (y >= yspan) - switch(yinc) + switch (yinc) { - case 8: if (!ilacefirst) { y = daglobyoffs+2; yinc = 4; break; } + case 8: + if (!ilacefirst) { y = daglobyoffs+2; yinc = 4; break; } ilacefirst = 0; y = daglobyoffs+4; yinc = 8; break; - case 4: y = daglobyoffs+1; yinc = 2; break; - case 2: case 1: return(0); + case 4: + y = daglobyoffs+1; yinc = 2; break; + case 2: + case 1: + return(0); } if ((unsigned long)y < (unsigned long)dayres) { yoff = y*dabytesperline+daframeplace; x = daglobxoffs; xend = xspan; } @@ -2049,7 +2087,7 @@ static long kcelrend (const char *buf, long fleng, ysiz = (long)SSWAPIB(*(unsigned short *)&buf[4]); if (ysiz <= 0) return(-1); cptr = &buf[32]; - for(i=0;i<256;i++) + for (i=0;i<256;i++) { palcol[i] = (((long)cptr[0])<<18) + (((long)cptr[1])<<10) + @@ -2059,8 +2097,8 @@ static long kcelrend (const char *buf, long 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 = (((unsigned long)j)>>1); @@ -2246,24 +2294,30 @@ if (ysiz < 0) { ysiz = -ysiz; } else { cptr = &cptr[(ysiz-1)*cptrinc]; cptrinc = 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= (unsigned long)dayres) continue; lptr = (long *)(y*dabytesperline-(daglobyoffs<<2)+daframeplace); - switch(cdim) + switch (cdim) { - case 1: for(x=x0;x>3]>>((x&7)^7))&1)]; break; - case 4: for(x=x0;x>1]>>(((x&1)^1)<<2))&15)]; break; - case 8: for(x=x0;x>3]>>((x&7)^7))&1)]; break; + case 4: + for (x=x0;x>1]>>(((x&1)^1)<<2))&15)]; break; + case 8: + for (x=x0;x= (unsigned long)ydim) continue; memcpy((void *)j,(void *)buf,xsiz); @@ -2395,13 +2449,13 @@ static long kddsrend (const char *buf, long 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(*(long *)&uptr[-6]); @@ -2445,19 +2499,24 @@ static long kddsrend (const char *buf, long leng, } wptr = (unsigned 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 ((unsigned long)(y+yy+yoff) >= (unsigned long)ydim) { ai += 4; continue; } - for(xx=0;xx<4;xx++,ai++) + for (xx=0;xx<4;xx++,ai++) { if ((unsigned long)(x+xx+xoff) >= (unsigned long)xdim) continue; j = ((v>>(ai<<1))&3); - switch(dxt) + switch (dxt) { - case 1: z = a[j]; break; - case 2: case 3: z = (( uptr[(ai>>1)-8] >> ((xx&1)<<2) )&15)*17; break; - case 4: case 5: z = a[( al[yy>>1] >> ((ai&7)*3) )&7]; break; + case 1: + z = a[j]; break; + case 2: + case 3: + z = (( uptr[(ai>>1)-8] >> ((xx&1)<<2) )&15)*17; break; + case 4: + case 5: + z = a[( al[yy>>1] >> ((ai&7)*3) )&7]; break; } rr = r[j]; gg = g[j]; bb = b[j]; if (!(dxt&1)) @@ -2614,7 +2673,7 @@ static long 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); @@ -2635,7 +2694,7 @@ static long filnamcmp (const char *st0, const char *st1) long 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; @@ -2686,7 +2745,7 @@ static long kzcalchash (const char *st) long 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; @@ -2702,7 +2761,7 @@ static long kzcheckhash (const char *filnam, char **zipnam, long *zipseek) if (!kzhashbuf) return(0); if (filnam[0] == '|') filnam++; - for(i=kzhashead[kzcalchash(filnam)];i>=0;i=(*(long *)&kzhashbuf[i])) + for (i=kzhashead[kzcalchash(filnam)];i>=0;i=(*(long *)&kzhashbuf[i])) if (!filnamcmp(filnam,&kzhashbuf[i+16])) { (*zipnam) = &kzhashbuf[*(long *)&kzhashbuf[i+8]]; @@ -2754,7 +2813,7 @@ i = strlen(zipnam)+1; if (!kzcheckhashsiz(i)) { fclose(fil); return(-1); } if (numfiles < 0) { fclose(fil); return(-1); } fseek(fil,-4,SEEK_CUR); } - for(i=0;i= gslider) { @@ -3095,7 +3161,8 @@ kzreadplc0:; { kzfs.jmpplc = 1; kzfs.i = i; kzfs.bfinal = bfinal; goto retkzread; -kzreadplc1:; i = kzfs.i; bfinal = kzfs.bfinal; +kzreadplc1: + ; i = kzfs.i; bfinal = kzfs.bfinal; } } slidebuf[(gslidew++)&32767] = (char)getbits(8); @@ -3107,17 +3174,17 @@ kzreadplc1:; i = kzfs.i; bfinal = kzfs.bfinal; 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= kzfs.endpos) { kzfs.jmpplc = 2; kzfs.bfinal = bfinal; goto retkzread; -kzreadplc2:; bfinal = kzfs.bfinal; +kzreadplc2: + ; bfinal = kzfs.bfinal; } } @@ -3166,7 +3234,7 @@ kzreadplc2:; bfinal = kzfs.bfinal; else j = hufgetsym(ibuf1,nbuf1); j = getbits(hxbit[j][0]) + hxbit[j][1]; - for(;i;i--,gslidew++) slidebuf[gslidew&32767] = slidebuf[(gslidew-j)&32767]; + for (;i;i--,gslidew++) slidebuf[gslidew&32767] = slidebuf[(gslidew-j)&32767]; } } while (!bfinal); @@ -3178,10 +3246,12 @@ kzreadplc2:; bfinal = kzfs.bfinal; putbuf4zip(&slidebuf[gslider&32767],gslider,gslidew&~32767); putbuf4zip(slidebuf,gslidew&~32767,gslidew); } -kzreadplc3:; kzfs.jmpplc = 3; +kzreadplc3: + ; kzfs.jmpplc = 3; } -retkzread:; +retkzread: + ; i = kzfs.pos; kzfs.pos += leng; if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng; return(kzfs.pos-i); @@ -3200,9 +3270,13 @@ long kzseek (long offset, long whence) if (!kzfs.fil) return(-1); switch (whence) { - case SEEK_CUR: kzfs.pos += offset; break; - case SEEK_END: kzfs.pos = kzfs.leng+offset; break; -case SEEK_SET: default: kzfs.pos = offset; + case SEEK_CUR: + kzfs.pos += offset; break; + case SEEK_END: + kzfs.pos = kzfs.leng+offset; break; + case SEEK_SET: + default: + kzfs.pos = offset; } if (kzfs.pos < 0) kzfs.pos = 0; if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng; diff --git a/polymer/build/src/lzf_c.c b/polymer/build/src/lzf_c.c index 6178d2438..6e1a047d3 100644 --- a/polymer/build/src/lzf_c.c +++ b/polymer/build/src/lzf_c.c @@ -1,19 +1,19 @@ /* * Copyright (c) 2000-2005 Marc Alexander Lehmann - * + * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO diff --git a/polymer/build/src/lzf_d.c b/polymer/build/src/lzf_d.c index 58b4edc10..e99055eb5 100644 --- a/polymer/build/src/lzf_d.c +++ b/polymer/build/src/lzf_d.c @@ -1,19 +1,19 @@ /* * Copyright (c) 2000-2005 Marc Alexander Lehmann - * + * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO diff --git a/polymer/build/src/lzwnew.c b/polymer/build/src/lzwnew.c index ee93460ce..257b7bd19 100644 --- a/polymer/build/src/lzwnew.c +++ b/polymer/build/src/lzwnew.c @@ -24,7 +24,7 @@ child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev); sibry = (long *)malloc((ucompleng+256)*sizeof(long)); if (!sibry) { free(sibly); free(child); free(nodev); return(0); } #endif - for(i=255;i>=0;i--) { nodev[i] = i; child[i] = -1; } + for (i=255;i>=0;i--) { nodev[i] = i; child[i] = -1; } memset(compbuf,0,ucompleng+15); cptr = ucompbuf; eptr = &ucompbuf[ucompleng]; @@ -32,7 +32,7 @@ child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev); 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; } @@ -45,12 +45,14 @@ child = (long *)malloc((ucompleng+256)*sizeof(long)); if (!child) { free(nodev); 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 } -lzwcompbreak2a: nodev[numnodes] = cptr[0]; -lzwcompbreak2b: child[numnodes] = sibly[numnodes] = -1; +lzwcompbreak2a: + nodev[numnodes] = cptr[0]; +lzwcompbreak2b: + child[numnodes] = sibly[numnodes] = -1; #if USENEW sibry[numnodes] = -1; #endif @@ -94,13 +96,13 @@ suffix = (unsigned char *)malloc(totnodes*sizeof(char)); if (!suffix) { free(pre prefix[numnodes] = dat; ucompbuf++; - for(leng=0;dat>=256;dat=prefix[dat]) { + for (leng=0;dat>=256;dat=prefix[dat]) { if ((long)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/build/src/mdsprite.c b/polymer/build/src/mdsprite.c index 4ff05f6e5..3b535e31d 100644 --- a/polymer/build/src/mdsprite.c +++ b/polymer/build/src/mdsprite.c @@ -206,7 +206,7 @@ static void freeallmodels () if (models) { - for(i=0;imdnum == 1) { voxmodel *v = (voxmodel*)m; - for(j=0;jtexid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]); v->texid[j] = 0; } } else if (m->mdnum == 2 || m->mdnum == 3) { md2model *m2 = (md2model*)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; @@ -254,10 +254,10 @@ static void clearskins () } } - for(i=0;itexid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]); v->texid[j] = 0; } @@ -313,26 +313,26 @@ static long framename2index (mdmodel *vm, const char *nam) { int i = 0; - switch(vm->mdnum) + switch (vm->mdnum) { case 2: + { + md2model *m = (md2model *)vm; + md2frame_t *fr; + for (i=0;inumframes;i++) { - md2model *m = (md2model *)vm; - md2frame_t *fr; - for(i=0;inumframes;i++) - { - fr = (md2frame_t *)&m->frames[i*m->framebytes]; - if (!Bstrcmp(fr->name, nam)) break; - } + fr = (md2frame_t *)&m->frames[i*m->framebytes]; + if (!Bstrcmp(fr->name, nam)) break; } - break; + } + break; case 3: - { - md3model *m = (md3model *)vm; - for(i=0;inumframes;i++) - if (!Bstrcmp(m->head.frames[i].nam,nam)) break; - } - break; + { + md3model *m = (md3model *)vm; + for (i=0;inumframes;i++) + if (!Bstrcmp(m->head.frames[i].nam,nam)) break; + } + break; } return(i); } @@ -500,8 +500,8 @@ static int daskinloader (long filh, long *fptr, long *bpl, long *sizx, long *siz if (tsizx == 0 || tsizy == 0) { free(picfil); return -1; } if (!glinfo.texnpot) { - for(xsiz=1;xsiz=0;j--) { + for (j=xsiz*ysiz-1;j>=0;j--) { swapchar(&pic[j].r, &pic[j].b); } } @@ -769,8 +769,8 @@ static long mdloadskin (md2model *m, int number, int pal, int surf) if (m->mdnum == 2) { long *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; @@ -784,7 +784,7 @@ static long mdloadskin (md2model *m, int number, int pal, int surf) 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; @@ -934,7 +934,7 @@ if ((head.id != 0x32504449) || (head.vers != 8)) { free(m); return(0); } //"IDP2 #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; @@ -1102,7 +1102,7 @@ int partition(unsigned short *indexes, float *depths, int f, int l) { void quicksort(unsigned short *indexes, float *depths, int first, int last) { int pivIndex = 0; - if(first < last) { + if (first < last) { pivIndex = partition(indexes,depths,first, last); quicksort(indexes,depths,first,(pivIndex-1)); quicksort(indexes,depths,(pivIndex+1),last); @@ -1169,7 +1169,7 @@ if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { free(m); return(0); } } #endif - 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)); @@ -1194,7 +1194,7 @@ if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { free(m); return(0); } 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 *)(((long)s->tris )+leng[0]); @@ -1234,19 +1234,19 @@ if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { free(m); return(0); } #if 0 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); } } } @@ -1315,7 +1315,7 @@ static int md3draw (md3model *m, spritetype *tspr) // floor aligned k1 = tspr->y; - if((globalorientation&48)==32) + if ((globalorientation&48)==32) { m0.z = -m0.z; m1.z = -m1.z; a0.z = -a0.z; m0.y = -m0.y; m1.y = -m1.y; a0.y = -a0.y; @@ -1349,7 +1349,7 @@ static int md3draw (md3model *m, spritetype *tspr) mat[14] += a0.y*mat[2] + a0.z*mat[6] + a0.x*mat[10]; // floor aligned - if((globalorientation&48)==32) + if ((globalorientation&48)==32) { f = mat[4]; mat[4] = mat[8]*16.0; mat[8] = -f*(1.0/16.0); f = mat[5]; mat[5] = mat[9]*16.0; mat[9] = -f*(1.0/16.0); @@ -1421,13 +1421,13 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } 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]; v1 = &s->xyzn[m->nframe*s->numverts]; - 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) { @@ -1515,7 +1515,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } indexes[i] = i; }*/ - 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]; @@ -1567,8 +1567,8 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } quicksort(indexes, maxdepths, 0, s->numtris - 1); 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[indexes[i]].i[j]; bglTexCoord2f(s->uv[k].u,s->uv[k].v); @@ -1582,8 +1582,8 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } 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]; bglTexCoord2f(s->uv[k].u,s->uv[k].v); @@ -1616,12 +1616,12 @@ static void md3free (md3model *m) if (!m) return; - for(anim=m->animations; anim; anim=nanim) + for (anim=m->animations; anim; anim=nanim) { nanim = anim->next; free(anim); } - for(sk=m->skinmap; sk; sk=nsk) + for (sk=m->skinmap; sk; sk=nsk) { nsk = sk->next; free(sk->fn); @@ -1630,7 +1630,7 @@ static void md3free (md3model *m) 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); @@ -1675,7 +1675,7 @@ unsigned gloadtex (long *picbuf, long xsiz, long ysiz, long is8bit, long dapal) cptr = (unsigned 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]; @@ -1686,7 +1686,7 @@ unsigned gloadtex (long *picbuf, long xsiz, long ysiz, long is8bit, long dapal) else { if (palookup[dapal] == 0) dapal = 0; - for(i=xsiz*ysiz-1;i>=0;i--) + for (i=xsiz*ysiz-1;i>=0;i--) { pic2[i].b = cptr[palette[(long)palookup[dapal][pic[i].a]*3+2]*4]; pic2[i].g = cptr[palette[(long)palookup[dapal][pic[i].a]*3+1]*4]; @@ -1707,7 +1707,7 @@ unsigned gloadtex (long *picbuf, long xsiz, long ysiz, long is8bit, long dapal) static long getvox (long x, long y, long 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); } @@ -1728,7 +1728,7 @@ static void setzrange0 (long *lptr, long z0, long z1) long 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;xmytex[(shp[z].y+VOXBORDWIDTH)*gvox->mytexx+(shp[z].x+VOXBORDWIDTH)]; - switch(face) + switch (face) { - case 0: ny = y1; x2 = x0; x0 = x1; x1 = x2; break; - case 1: ny = y0; y0++; y1++; y2++; break; - case 2: nz = z1; y0 = y2; y2 = y1; y1 = y0; z0++; z1++; z2++; break; - case 3: nz = z0; break; - case 4: nx = x1; y2 = y0; y0 = y1; y1 = y2; x0++; x1++; x2++; break; - case 5: nx = x0; break; + case 0: + ny = y1; x2 = x0; x0 = x1; x1 = x2; break; + case 1: + ny = y0; y0++; y1++; y2++; break; + case 2: + nz = z1; y0 = y2; y2 = y1; y1 = y0; z0++; z1++; z2++; break; + case 3: + nz = z0; break; + case 4: + nx = x1; y2 = y0; y0 = y1; y1 = y2; x0++; x1++; x2++; break; + case 5: + nx = x0; break; } - for(yy=0;yymytexx) - 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], @@ -1867,7 +1879,7 @@ if (x < y) { z = x; x = y; y = z; i += 3; } 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; @@ -1908,14 +1920,14 @@ if (x < y) { z = x; x = y; y = z; } 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 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); } by0 = (long *)(((long)bx0)+i); - for(cnt=0;cnt<2;cnt++) + for (cnt=0;cnt<2;cnt++) { if (!cnt) daquad = cntquad; else daquad = addquad; @@ -1923,10 +1935,10 @@ bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); } 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))) @@ -1934,10 +1946,10 @@ bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); } 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))) @@ -1945,10 +1957,10 @@ bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); } 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))) @@ -1962,18 +1974,19 @@ bx0 = (long *)malloc(i<<1); if (!bx0) { free(gvox); return(0); } 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:; +skindidntfit: + ; if (gvox->mytexx <= gvox->mytexy) gvox->mytexx <<= 1; else gvox->mytexy <<= 1; } mytexo5 = (gvox->mytexx>>5); @@ -1983,7 +1996,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((((long)c[0])<<18)+(((long)c[1])<<10)+(((long)c[2])<<2)+(i<<24)); } yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3); vbit = (long *)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 = (long *)malloc((vcolhashsizm1+1)*sizeof(long)); if (!vcolhashead) { free(xyoffs); kclose(fil); return(-1); } memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(long)); @@ -2131,8 +2144,8 @@ vcolhashead = (long *)malloc((vcolhashsizm1+1)*sizeof(long)); if (!vcolhashead) 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(*(unsigned short *)&c[4]); @@ -2230,16 +2243,16 @@ if ((i != 0x09072000) || (xsiz != 1024) || (ysiz != 1024)) { kclose(fil); return kclose(fil); v = vbuf; - for(y=0;ycstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } if (!m->texid[globalpal]) m->texid[globalpal] = gloadtex(m->mytex,m->mytexx,m->mytexy,m->is8bit,globalpal); else bglBindTexture(GL_TEXTURE_2D,m->texid[globalpal]); bglBegin(GL_QUADS); - for(i=0,fi=0;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]; @@ -2408,7 +2421,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } 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], @@ -2449,11 +2462,14 @@ mdmodel *mdload (const char *filnam) fil = kopen4load((char *)filnam,0); if (fil < 0) return(0); kread(fil,&i,4); klseek(fil,0,SEEK_SET); - switch(B_LITTLE32(i)) + switch (B_LITTLE32(i)) { - case 0x32504449: vm = (mdmodel*)md2load(fil,filnam); break; //IDP2 - case 0x33504449: vm = (mdmodel*)md3load(fil); break; //IDP3 - default: vm = (mdmodel*)0; break; + case 0x32504449: + vm = (mdmodel*)md2load(fil,filnam); break; //IDP2 + case 0x33504449: + vm = (mdmodel*)md3load(fil); break; //IDP3 + default: + vm = (mdmodel*)0; break; } kclose(fil); return(vm); diff --git a/polymer/build/src/mmulti.c b/polymer/build/src/mmulti.c index 0003652f8..28ea6ea90 100644 --- a/polymer/build/src/mmulti.c +++ b/polymer/build/src/mmulti.c @@ -206,7 +206,7 @@ long netread (long *other, char *dabuf, long bufsiz) //0:no packets in buffer snatchip = (long)ip.sin_addr.s_addr; snatchport = (long)ip.sin_port; (*other) = myconnectindex; - for(i=0;i= '0') && (st[i] <= '9')) { num = num*10+st[i]-'0'; if (num >= 65536) return(0); } @@ -293,9 +293,9 @@ static long crctab16[256]; static void initcrc16 () { long 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); @@ -309,7 +309,7 @@ static unsigned short getcrc16 (char *buffer, long bufleng) long 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((unsigned short)(j&65535)); } @@ -332,11 +332,11 @@ static void initmultiplayers_reset(void) #endif lastsendtims[0] = GetTickCount(); - for(i=1;i>8)&255,(otherip[i]>>16)&255,((unsigned long)otherip[i])>>24,ntohs(otherport[i])); connecthead = 0; - for(i=0;i= 2)) || (numplayers == 2)); @@ -471,7 +471,7 @@ long 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) { nfIncCP(); //Addfaz NatFree @@ -527,7 +527,7 @@ void initmultiplayers (long argc, char **argv, char damultioption, char dacomrat { otims = tims; sprintf(tbuf,"\rWait for players (%d/%d): ",myconnectindex,numplayers); - for(i=0;i "); continue; } if (!otherip[i]) { strcat(tbuf,"?.?.?.?:? "); continue; } @@ -570,13 +570,13 @@ void dosendpackets (long other) //Host to send intially, client to send to other k = 2; *(long *)&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 (long)sizeof(pakbuf)) break; @@ -624,7 +624,7 @@ long getpacket (long *retother, char *bufptr) if (netready) { - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { if (i != myconnectindex) dosendpackets(i); if ((!danetmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -657,7 +657,7 @@ long getpacket (long *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; @@ -746,7 +746,7 @@ long getpacket (long *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) { @@ -786,7 +786,7 @@ const char *getexternaladdress(void) char *host = "checkip.dyndns.org"; char *req = "GET / HTTP/1.0\r\n\r\n"; - if(ipaddr[0]) + if (ipaddr[0]) return(ipaddr); #ifdef _WIN32 @@ -812,18 +812,18 @@ const char *getexternaladdress(void) memset(&(dest_addr.sin_zero), '\0', 8); sockfd = socket(PF_INET, SOCK_STREAM, 0); - if(sockfd == SOCKET_ERROR) { + if (sockfd == SOCKET_ERROR) { initprintf("mmulti: socket() error in getexternaladdress() (%d)\n",errno); return(0); } - if(connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) { + if (connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) { initprintf("mmulti: connect() error in getexternaladdress() (%d)\n",errno); return(0); } bytes_sent = send(sockfd, req, strlen(req), 0); - if(bytes_sent == SOCKET_ERROR) { + if (bytes_sent == SOCKET_ERROR) { initprintf("mmulti: send() error in getexternaladdress() (%d)\n",errno); return(0); } @@ -836,11 +836,11 @@ const char *getexternaladdress(void) WSACleanup(); #endif - for(i=0;(unsigned)i k) { k = j; white = i; } @@ -132,7 +132,7 @@ static void _internal_drawosdstr(int x, int y, char *ch, int len, int shade, int if (white<0) { // find the palette index closest to white k=0; - for(i=0;i<256;i++) + for (i=0;i<256;i++) { j = ((int)curpalette[i].r)+((int)curpalette[i].g)+((int)curpalette[i].b); if (j > k) { k = j; white = i; } @@ -152,7 +152,7 @@ static void _internal_drawosdcursor(int x, int y, int type, int lastkeypress) if (white<0) { // find the palette index closest to white k=0; - for(i=0;i<256;i++) + for (i=0;i<256;i++) { j = ((int)palette[i*3])+((int)palette[i*3+1])+((int)palette[i*3+2]); if (j > k) { k = j; white = i; } @@ -803,9 +803,12 @@ static char *strtoken(char *s, char **ptrptr, int *restart) break; } else if (*p == '\\') { switch (*(++p)) { - case 'n': *p2 = '\n'; break; - case 'r': *p2 = '\r'; break; - default: *p2 = *p; break; + case 'n': + *p2 = '\n'; break; + case 'r': + *p2 = '\r'; break; + default: + *p2 = *p; break; } } else { *p2 = *p; @@ -876,8 +879,10 @@ int OSD_Dispatch(const char *cmd) ofp.parms = (const char **)parms; ofp.raw = cmd; switch (symb->func(&ofp)) { - case OSDCMD_OK: break; - case OSDCMD_SHOWHELP: OSD_Printf("%s\n", symb->help); break; + case OSDCMD_OK: + break; + case OSDCMD_SHOWHELP: + OSD_Printf("%s\n", symb->help); break; } state = wtp; diff --git a/polymer/build/src/polymer.c b/polymer/build/src/polymer.c index caa0967f8..edbc72805 100644 --- a/polymer/build/src/polymer.c +++ b/polymer/build/src/polymer.c @@ -102,14 +102,14 @@ void polymer_glinit(void) bglDisable(GL_FOG); - bglFogi(GL_FOG_MODE, GL_EXP); - //glFogfv(GL_FOG_COLOR, fogColor); + bglFogi(GL_FOG_MODE, GL_EXP); + //glFogfv(GL_FOG_COLOR, fogColor); bglEnable(GL_FOG); a = (1 - ((float)(visibility) / 512.0f)) / 10.0f; - bglFogf(GL_FOG_DENSITY, 0.1f - a); - bglFogf(GL_FOG_START, 0.0f); - bglFogf(GL_FOG_END, 1000000.0f); + bglFogf(GL_FOG_DENSITY, 0.1f - a); + bglFogf(GL_FOG_START, 0.0f); + bglFogf(GL_FOG_END, 1000000.0f); bglEnable(GL_CULL_FACE); bglCullFace(GL_BACK); @@ -215,7 +215,7 @@ void polymer_drawrooms(long daposx, long daposy, long daposz, sho } return; } - + i = 0; while (i < numsectors) { @@ -244,7 +244,7 @@ void polymer_drawrooms(long daposx, long daposy, long daposz, sho while (j < sec->wallnum) { if (((pr_frustumculling == 0) || polymer_portalinfrustum(sec->wallptr + j)) && - ((pr_cliplanes == 0) || polymer_wallincliplanes(sec->wallptr + j))) + ((pr_cliplanes == 0) || polymer_wallincliplanes(sec->wallptr + j))) { polymer_drawwall(sec->wallptr + j); if ((wal->nextsector != -1) && (prsectors[wal->nextsector]) && (prsectors[wal->nextsector]->drawingstate == 0)) @@ -320,7 +320,7 @@ int polymer_initsector(short sectnum) if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize geometry of sector %i : malloc failed.\n", sectnum); return (0); } - + s->floorindices = s->ceilindices = NULL; s->controlstate = s->drawingstate = 0; @@ -450,7 +450,7 @@ int polymer_updatesector(short sectnum) } if (picanm[curpicnum]&192) curpicnum += animateoffs(curpicnum,sectnum); - + if (!waloff[curpicnum]) loadtile(curpicnum); @@ -734,7 +734,7 @@ void polymer_updatewall(short wallnum) } if (wal->cstat & 4) - yref = sec->floorz; + yref = sec->floorz; else yref = sec->ceilingz; @@ -774,8 +774,8 @@ void polymer_updatewall(short wallnum) ns = prsectors[wal->nextsector]; if (((s->floorbuffer[((wallnum - sec->wallptr) * 5) + 1] != ns->floorbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || - (s->floorbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->floorbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) && - (s->floorbuffer[((wallnum - sec->wallptr) * 5) + 1] <= ns->floorbuffer[((nnwallnum - nsec->wallptr) * 5) + 1])) + (s->floorbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->floorbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) && + (s->floorbuffer[((wallnum - sec->wallptr) * 5) + 1] <= ns->floorbuffer[((nnwallnum - nsec->wallptr) * 5) + 1])) { memcpy(w->wallbuffer, &s->floorbuffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); memcpy(&w->wallbuffer[5], &s->floorbuffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); @@ -815,7 +815,7 @@ void polymer_updatewall(short wallnum) } if ((!(wal->cstat & 2) && (wal->cstat & 4)) || ((wal->cstat & 2) && (wall[nwallnum].cstat & 4))) - yref = sec->ceilingz; + yref = sec->ceilingz; else yref = nsec->floorz; @@ -850,8 +850,8 @@ void polymer_updatewall(short wallnum) } if (((s->ceilbuffer[((wallnum - sec->wallptr) * 5) + 1] != ns->ceilbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || - (s->ceilbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->ceilbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) && - (s->ceilbuffer[((wallnum - sec->wallptr) * 5) + 1] >= ns->ceilbuffer[((nnwallnum - nsec->wallptr) * 5) + 1])) + (s->ceilbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->ceilbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) && + (s->ceilbuffer[((wallnum - sec->wallptr) * 5) + 1] >= ns->ceilbuffer[((nnwallnum - nsec->wallptr) * 5) + 1])) { if (w->overbuffer == NULL) w->overbuffer = calloc(4, sizeof(GLfloat) * 5); @@ -888,7 +888,7 @@ void polymer_updatewall(short wallnum) } if (wal->cstat & 4) - yref = sec->ceilingz; + yref = sec->ceilingz; else yref = nsec->ceilingz; @@ -1016,8 +1016,8 @@ int polymer_portalinfrustum(short wallnum) while (j < 4) { sqdist = frustum[(i * 4) + 0] * w->portal[(j * 3) + 0] + - frustum[(i * 4) + 1] * w->portal[(j * 3) + 1] + - frustum[(i * 4) + 2] * w->portal[(j * 3) + 2] + + frustum[(i * 4) + 1] * w->portal[(j * 3) + 1] + + frustum[(i * 4) + 2] * w->portal[(j * 3) + 2] + frustum[(i * 4) + 3]; if (sqdist < 0) k++; @@ -1050,7 +1050,7 @@ int polymer_wallincliplanes(short wallnum) walltype *wal; _point2d p1, p2; int i, j; - + wal = &wall[wallnum]; p1.x = wal->x; diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index d4baacfe4..af2baea4f 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -245,7 +245,7 @@ if (y1 >= fyres) { x1 += (fyres-y1)*dx/dy; y1 = fyres; x = (long)(x0+.5); if (x < 0) { y -= inc*x; x = 0; } //if for safety e = (long)(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 { @@ -255,7 +255,7 @@ if (y1 >= fyres) { x1 += (fyres-y1)*dx/dy; y1 = fyres; y = (long)(y0+.5); if (y < 0) { x -= inc*y; y = 0; } //if for safety e = (long)(y1+.5); if (e > ydimen) e = ydimen; //if for safety up16 = (xdimen<<16); - for(;y>16)+frameoffset) = col; + for (;y>16)+frameoffset) = col; } } @@ -352,7 +352,7 @@ pthtyp * gltexcache (long dapicnum, long dapalnum, long dameth) */ // load a replacement - for(pth=gltexcachead[j]; pth; pth=pth->next) { + for (pth=gltexcachead[j]; pth; pth=pth->next) { if (pth->picnum == dapicnum && pth->palnum == si->palnum && (si->palnum>0 ? 1 : (pth->effects == hictinting[dapalnum].f)) && @@ -390,7 +390,7 @@ tryart: if (hicprecaching) return NULL; // load from art - for(pth=gltexcachead[j]; pth; pth=pth->next) + for (pth=gltexcachead[j]; pth; pth=pth->next) if (pth->picnum == dapicnum && pth->palnum == dapalnum && (pth->flags & (1+2)) == ((dameth&4)>>2) @@ -422,7 +422,7 @@ long gltexmayhavealpha (long dapicnum, long dapalnum) long j = (dapicnum&(GLTEXCACHEADSIZ-1)); pthtyp *pth; - for(pth=gltexcachead[j]; pth; pth=pth->next) + for (pth=gltexcachead[j]; pth; pth=pth->next) if ((pth->picnum == dapicnum) && (pth->palnum == dapalnum)) return((pth->flags&8) != 0); return(1); @@ -434,7 +434,7 @@ void gltexinvalidate (long dapicnum, long dapalnum, long dameth) pthtyp *pth; j = (dapicnum&(GLTEXCACHEADSIZ-1)); - for(pth=gltexcachead[j]; pth; pth=pth->next) + for (pth=gltexcachead[j]; pth; pth=pth->next) if (pth->picnum == dapicnum && pth->palnum == dapalnum && (pth->flags & 1) == ((dameth&4)>>2) ) { pth->flags |= 128; @@ -451,8 +451,8 @@ void gltexinvalidateall () long 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) @@ -477,8 +477,8 @@ void gltexapplyprops (void) if (gltexfiltermode < 0) gltexfiltermode = 0; else if (gltexfiltermode >= (long)numglfiltermodes) gltexfiltermode = numglfiltermodes-1; - for(i=GLTEXCACHEADSIZ-1;i>=0;i--) { - for(pth=gltexcachead[i];pth;pth=pth->next) { + for (i=GLTEXCACHEADSIZ-1;i>=0;i--) { + 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); bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); @@ -615,12 +615,15 @@ void resizeglcheck () if (lastglpolygonmode != glpolygonmode) { lastglpolygonmode = glpolygonmode; - switch(glpolygonmode) + switch (glpolygonmode) { default: - case 0: bglPolygonMode(GL_FRONT_AND_BACK,GL_FILL); break; - case 1: bglPolygonMode(GL_FRONT_AND_BACK,GL_LINE); break; - case 2: bglPolygonMode(GL_FRONT_AND_BACK,GL_POINT); break; + case 0: + bglPolygonMode(GL_FRONT_AND_BACK,GL_FILL); break; + case 1: + bglPolygonMode(GL_FRONT_AND_BACK,GL_LINE); break; + case 2: + bglPolygonMode(GL_FRONT_AND_BACK,GL_POINT); break; } } if (glpolygonmode) //FUK @@ -670,10 +673,10 @@ void fixtransparency (coltype *dapic, long daxsiz, long daysiz, long daxsiz2, lo //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; @@ -681,13 +684,18 @@ void fixtransparency (coltype *dapic, long daxsiz, long daysiz, long daxsiz2, lo if ((x 0) && (wpptr[naxsiz2].a)) { r += (long)wpptr[naxsiz2].r; g += (long)wpptr[naxsiz2].g; b += (long)wpptr[naxsiz2].b; j++; } if ((yr = r ; wpptr->g = g ; wpptr->b = b ; break; - case 2: wpptr->r = ((r + 1)>>1); wpptr->g = ((g + 1)>>1); wpptr->b = ((b + 1)>>1); break; - case 3: wpptr->r = ((r*85+128)>>8); wpptr->g = ((g*85+128)>>8); wpptr->b = ((b*85+128)>>8); break; - case 4: wpptr->r = ((r + 2)>>2); wpptr->g = ((g + 2)>>2); wpptr->b = ((b + 2)>>2); break; - default: break; + case 1: + wpptr->r = r ; wpptr->g = g ; wpptr->b = b ; break; + case 2: + wpptr->r = ((r + 1)>>1); wpptr->g = ((g + 1)>>1); wpptr->b = ((b + 1)>>1); break; + case 3: + wpptr->r = ((r*85+128)>>8); wpptr->g = ((g*85+128)>>8); wpptr->b = ((b*85+128)>>8); break; + case 4: + wpptr->r = ((r + 2)>>2); wpptr->g = ((g + 2)>>2); wpptr->b = ((b + 2)>>2); break; + default: + break; } } } @@ -735,14 +743,14 @@ static void uploadtexture(long doalloc, long xsiz, long ysiz, long intexfmt, lon 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;yr = r; wpptr->g = g; wpptr->b = b; wpptr->a = a; break; - case 2: wpptr->r = ((r+1)>>1); wpptr->g = ((g+1)>>1); wpptr->b = ((b+1)>>1); wpptr->a = ((a+1)>>1); break; - case 3: wpptr->r = ((r*85+128)>>8); wpptr->g = ((g*85+128)>>8); wpptr->b = ((b*85+128)>>8); wpptr->a = ((a*85+128)>>8); break; - case 4: wpptr->r = ((r+2)>>2); wpptr->g = ((g+2)>>2); wpptr->b = ((b+2)>>2); wpptr->a = ((a+2)>>2); break; - default: break; + case 1: + wpptr->r = r; wpptr->g = g; wpptr->b = b; wpptr->a = a; break; + case 2: + wpptr->r = ((r+1)>>1); wpptr->g = ((g+1)>>1); wpptr->b = ((b+1)>>1); wpptr->a = ((a+1)>>1); break; + case 3: + wpptr->r = ((r*85+128)>>8); wpptr->g = ((g*85+128)>>8); wpptr->b = ((b*85+128)>>8); wpptr->a = ((a*85+128)>>8); break; + case 4: + wpptr->r = ((r+2)>>2); wpptr->g = ((g+2)>>2); wpptr->b = ((b+2)>>2); wpptr->a = ((a+2)>>2); break; + default: + break; } //if (wpptr->a) wpptr->a = 255; } @@ -785,8 +798,8 @@ int gloadtile_art (long dapic, long dapal, long dameth, pthtyp *pth, long doallo tsizx = tilesizx[dapic]; tsizy = tilesizy[dapic]; if (!glinfo.texnpot) { - for(xsiz=1;xsiz= tsizx) || (y >= tsizy))) //Clamp texture { wpptr->r = wpptr->g = wpptr->b = wpptr->a = 0; continue; } @@ -1190,8 +1203,8 @@ int gloadtile_hi(long dapic, long facen, hicreplctyp *hicr, long dameth, pthtyp pth->sizy = tsizy; if (!glinfo.texnpot) { - for(xsiz=1;xsiz tsizx) //Copy left to right { long *lptr = (long *)pic; - for(y=0;y tsizy) //Copy top to bottom memcpy(&pic[xsiz*tsizy],pic,(ysiz-tsizy)*xsiz<<2); } 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); } } else texfmt = GL_BGRA; @@ -1324,7 +1337,7 @@ static long pow2xsplit = 0, skyclamphack = 0; void drawpoly (double *dpx, double *dpy, long n, long method) { - #define PI 3.14159265358979323 +#define PI 3.14159265358979323 double ngdx = 0.0, ngdy = 0.0, ngdo = 0.0, ngux = 0.0, nguy = 0.0, nguo = 0.0; double ngvx = 0.0, ngvy = 0.0, ngvo = 0.0, dp, up, vp, rdp, du0 = 0.0, du1 = 0.0, dui, duj; double ngdx2, ngux2, ngvx2; @@ -1347,7 +1360,7 @@ void drawpoly (double *dpx, double *dpy, long n, long 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; @@ -1477,12 +1490,16 @@ void drawpoly (double *dpx, double *dpy, long n, long method) float pc[4]; f = ((float)(numpalookups-min(max(globalshade,0),numpalookups)))/((float)numpalookups); pc[0] = pc[1] = pc[2] = f; - switch(method&3) + switch (method&3) { - case 0: pc[3] = 1.0; break; - case 1: pc[3] = 1.0; break; - case 2: pc[3] = 0.66; break; - case 3: pc[3] = 0.33; break; + case 0: + pc[3] = 1.0; break; + case 1: + pc[3] = 1.0; break; + case 2: + pc[3] = 0.66; break; + case 3: + pc[3] = 0.33; break; } // tinting happens only to hightile textures, and only if the texture we're // rendering isn't for the same palette as what we asked for @@ -1529,7 +1546,7 @@ void drawpoly (double *dpx, double *dpy, long n, long method) nguo -= ngdo*uoffs; //Find min&max u coordinates (du0...du1) - for(i=0;i>4); } else @@ -1707,7 +1724,7 @@ void drawpoly (double *dpx, double *dpy, long n, long 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; @@ -1722,7 +1739,7 @@ void drawpoly (double *dpx, double *dpy, long n, long method) ngvx2 = ngvx*(1<= py[1]); maxi = 1-mini; - for(z=2;z py[maxi]) maxi = z; @@ -1737,7 +1754,7 @@ void drawpoly (double *dpx, double *dpy, long n, long 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; } while (i != mini); @@ -1749,7 +1766,7 @@ void drawpoly (double *dpx, double *dpy, long n, long 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; @@ -1774,7 +1791,7 @@ void drawpoly (double *dpx, double *dpy, long n, long 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); @@ -1796,7 +1813,7 @@ void drawpoly (double *dpx, double *dpy, long n, long method) } else { - for(xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -1820,7 +1837,7 @@ void drawpoly (double *dpx, double *dpy, long n, long 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); @@ -1848,7 +1865,7 @@ void drawpoly (double *dpx, double *dpy, long n, long method) } else { - for(xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -1876,7 +1893,7 @@ void drawpoly (double *dpx, double *dpy, long n, long method) } break; case 2: //Transluscence #1 - for(xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -1905,7 +1922,7 @@ void drawpoly (double *dpx, double *dpy, long n, long method) } break; case 3: //Transluscence #2 - for(xx=ix0;xx>LINTERPSIZ); dtol(up*rdp,&u1); up += ngux2; u1 = ((u1-u0)>>LINTERPSIZ); @@ -1945,7 +1962,7 @@ void drawpoly (double *dpx, double *dpy, long n, long 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]; @@ -2024,7 +2041,7 @@ void initmosts (double *px, double *py, long n) } - for(i=0;i= 0)) return(1); @@ -2107,7 +2124,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; @@ -2126,7 +2143,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]; @@ -2158,7 +2175,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) { @@ -2199,19 +2216,23 @@ void domost (float x0, float y0, float x1, float y1) if (!dir) { - switch(k) + switch (k) { - case 1: case 2: + case 1: + case 2: dpx[0] = dx0; dpy[0] = vsp[i].cy[0]; dpx[1] = dx1; dpy[1] = vsp[i].cy[1]; dpx[2] = dx0; dpy[2] = ny0; drawpoly(dpx,dpy,3,domostpolymethod); vsp[i].cy[0] = ny0; vsp[i].ctag = gtag; break; - case 3: case 6: + case 3: + case 6: dpx[0] = dx0; dpy[0] = vsp[i].cy[0]; dpx[1] = dx1; dpy[1] = vsp[i].cy[1]; dpx[2] = dx1; dpy[2] = ny1; drawpoly(dpx,dpy,3,domostpolymethod); vsp[i].cy[1] = ny1; vsp[i].ctag = gtag; break; - case 4: case 5: case 7: + case 4: + case 5: + case 7: dpx[0] = dx0; dpy[0] = vsp[i].cy[0]; dpx[1] = dx1; dpy[1] = vsp[i].cy[1]; dpx[2] = dx1; dpy[2] = ny1; @@ -2223,24 +2244,29 @@ void domost (float x0, float y0, float x1, float y1) dpx[2] = dx1; dpy[2] = vsp[i].fy[1]; dpx[3] = dx0; dpy[3] = vsp[i].fy[0]; drawpoly(dpx,dpy,4,domostpolymethod); vsp[i].ctag = vsp[i].ftag = -1; break; - default: break; + default: + break; } } else { - switch(k) + switch (k) { - case 7: case 6: + case 7: + case 6: dpx[0] = dx0; dpy[0] = ny0; dpx[1] = dx1; dpy[1] = vsp[i].fy[1]; dpx[2] = dx0; dpy[2] = vsp[i].fy[0]; drawpoly(dpx,dpy,3,domostpolymethod); vsp[i].fy[0] = ny0; vsp[i].ftag = gtag; break; - case 5: case 2: + case 5: + case 2: dpx[0] = dx0; dpy[0] = vsp[i].fy[0]; dpx[1] = dx1; dpy[1] = ny1; dpx[2] = dx1; dpy[2] = vsp[i].fy[1]; drawpoly(dpx,dpy,3,domostpolymethod); vsp[i].fy[1] = ny1; vsp[i].ftag = gtag; break; - case 4: case 3: case 1: + case 4: + case 3: + case 1: dpx[0] = dx0; dpy[0] = ny0; dpx[1] = dx1; dpy[1] = ny1; dpx[2] = dx1; dpy[2] = vsp[i].fy[1]; @@ -2252,7 +2278,8 @@ void domost (float x0, float y0, float x1, float y1) dpx[2] = dx1; dpy[2] = vsp[i].fy[1]; dpx[3] = dx0; dpy[3] = vsp[i].fy[0]; drawpoly(dpx,dpy,4,domostpolymethod); vsp[i].ctag = vsp[i].ftag = -1; break; - default: break; + default: + break; } } } @@ -2304,7 +2331,7 @@ static void polymost_drawalls (long 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]; @@ -2422,7 +2449,7 @@ static void polymost_drawalls (long 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; @@ -2457,10 +2484,10 @@ static void polymost_drawalls (long bunch) domostpolymethod = (globalorientation>>7)&3; if (globalposz >= getflorzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling #ifdef USE_OPENGL - if(!nofog) + if (!nofog) { int i = klabs(sec->floorshade); - if(i > 30) i = 30; + if (i > 30) i = 30; bglFogf(GL_FOG_DENSITY,gvisibility/(sec->floorshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(sec->floorshade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } #endif @@ -2480,15 +2507,15 @@ static void polymost_drawalls (long bunch) //bglFogf(GL_FOG_DENSITY,r); } */ - if(!nofog) + if (!nofog) { int i = klabs(sec->floorshade); - if(i > 30) i = 30; + if (i > 30) i = 30; bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->floorshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } //Use clamping for tiled sky textures - for(i=(1<0;i--) + for (i=(1<0;i--) if (pskyoff[i] != pskyoff[i-1]) { skyclamphack = 1; break; } } @@ -2553,7 +2580,7 @@ static void polymost_drawalls (long 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; @@ -2790,7 +2817,7 @@ static void polymost_drawalls (long 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; @@ -2825,10 +2852,10 @@ static void polymost_drawalls (long bunch) domostpolymethod = (globalorientation>>7)&3; if (globalposz <= getceilzofslope(sectnum,globalposx,globalposy)) domostpolymethod = -1; //Back-face culling #ifdef USE_OPENGL - if(!nofog) + if (!nofog) { int i = klabs(sec->ceilingshade); - if(i > 30) i = 30; + if (i > 30) i = 30; bglFogf(GL_FOG_DENSITY,gvisibility/(sec->ceilingshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(sec->ceilingshade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } #endif @@ -2847,15 +2874,15 @@ static void polymost_drawalls (long bunch) //bglFogf(GL_FOG_DENSITY,r); } */ - if(!nofog) + if (!nofog) { int i = klabs(sec->ceilingshade); - if(i > 30) i = 30; + if (i > 30) i = 30; bglFogf(GL_FOG_DENSITY,0.005*gvisibility/(sec->ceilingshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } //Use clamping for tiled sky textures - for(i=(1<0;i--) + for (i=(1<0;i--) if (pskyoff[i] != pskyoff[i-1]) { skyclamphack = 1; break; } } @@ -2879,11 +2906,11 @@ static void polymost_drawalls (long bunch) if ((oy < cy0) && (oy < cy1)) domost(x1,oy,x0,oy); else if ((oy < cy0) != (oy < cy1)) { /* cy1 cy0 - // / \ - //oy---------- oy--------- - // / \ - // cy0 cy1 - */ + // / \ + //oy---------- oy--------- + // / \ + // cy0 cy1 + */ ox = (oy-cy0)*(x1-x0)/(cy1-cy0) + x0; if (oy < cy0) { domost(ox,oy,x0,oy); domost(x1,cy1,ox,oy); } else { domost(ox,oy,x0,cy0); domost(x1,oy,ox,oy); } @@ -2919,7 +2946,7 @@ static void polymost_drawalls (long 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; @@ -3164,10 +3191,10 @@ static void polymost_drawalls (long bunch) } if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip #ifdef USE_OPENGL - if(!nofog) + if (!nofog) { int i = klabs(wal->shade); - if(i > 30) i = 30; + if (i > 30) i = 30; bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(wal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } #endif @@ -3206,10 +3233,10 @@ static void polymost_drawalls (long bunch) } if (nwal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip #ifdef USE_OPENGL - if(!nofog) + if (!nofog) { int i = klabs(nwal->shade); - if(i > 30) i = 30; + if (i > 30) i = 30; bglFogf(GL_FOG_DENSITY,gvisibility/(nwal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(nwal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } #endif @@ -3244,10 +3271,10 @@ static void polymost_drawalls (long bunch) } if (wal->cstat&256) { gvx = -gvx; gvy = -gvy; gvo = -gvo; } //yflip #ifdef USE_OPENGL - if(!nofog) + if (!nofog) { int i = klabs(wal->shade); - if(i > 30) i = 30; + if (i > 30) i = 30; bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(wal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } #endif @@ -3271,10 +3298,10 @@ static long polymost_bunchfront (long b1, long 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)); } @@ -3294,7 +3321,7 @@ static void polymost_scansector (long 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)) && @@ -3318,7 +3345,7 @@ static void polymost_scansector (long 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; @@ -3359,13 +3386,13 @@ static void polymost_scansector (long 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; } } while (sectorbordercnt > 0); @@ -3451,7 +3478,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++; } @@ -3481,7 +3508,7 @@ void polymost_drawrooms () } } if (n2 < 3) { enddrawing(); return; } - for(i=0;ishade); - if(i > 30) i = 30; + if (i > 30) i = 30; bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(wal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } } } #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; @@ -3743,7 +3770,7 @@ if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; //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; @@ -3761,7 +3788,7 @@ if (yp1 < SCISDIST) { t1 = (SCISDIST-oyp0)/(yp1-oyp0); xp1 = (xp1-oxp0)*t1+oxp0; //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; @@ -3816,10 +3843,10 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } col[3] = 0; bglFogfv(GL_FOG_COLOR,col); //default is 0,0,0,0 - if(!nofog) + if (!nofog) { int i = klabs(globalshade); - if(i > 30) i = 30; + if (i > 30) i = 30; bglFogf(GL_FOG_DENSITY,gvisibility/(globalshade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(globalshade<0?1:shadetable[i]*glsprshadescale)*((float)((unsigned char)(sector[tspr->sectnum].visibility<240?sector[tspr->sectnum].visibility+16:sector[tspr->sectnum].visibility-239)))); } } @@ -3844,7 +3871,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } bglDepthMask(0); #endif - switch((globalorientation>>4)&3) + switch ((globalorientation>>4)&3) { case 0: //Face sprite //Project 3D to 2D @@ -4024,7 +4051,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } y1 = ((tilesizy[globalpicnum]>>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); @@ -4044,7 +4071,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } //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++; } @@ -4059,7 +4086,7 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } //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]; @@ -4540,13 +4567,13 @@ static void tessectrap (float *px, float *py, long *point2, long 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; @@ -4554,7 +4581,7 @@ static void tessectrap (float *px, float *py, long *point2, long 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; @@ -4603,9 +4630,12 @@ void polymost_fillpolygon (long npoints) f = ((float)(numpalookups-min(max(globalshade,0),numpalookups)))/((float)numpalookups); switch ((globalorientation>>7)&3) { case 0: - case 1: a = 1.0; bglDisable(GL_BLEND); break; - case 2: a = 0.66; bglEnable(GL_BLEND); break; - case 3: a = 0.33; bglEnable(GL_BLEND); break; + case 1: + a = 1.0; bglDisable(GL_BLEND); break; + case 2: + a = 0.66; bglEnable(GL_BLEND); break; + case 3: + a = 0.33; bglEnable(GL_BLEND); break; } bglColor4f(f,f,f,a); @@ -5080,16 +5110,16 @@ static unsigned short hicoadd (unsigned short c) /* Description of Ken's filter to improve LZW compression of DXT1 format by ~15%: (as tested with the HRP) - + To increase LZW patterns, I store each field of the DXT block structure separately. Here are the 3 DXT fields: 1. __int64 alpha_4x4; //DXT3 only (16 byte structure size when included) 2. short rgb0, rgb1; 3. long index_4x4; - + Each field is then stored with its own specialized algorithm. 1. I haven't done much testing with this field - I just copy it raw without any transform for now. - + 2. For rgb0 and rgb1, I use a "green" filter like this: g = g; r = r-g; @@ -5099,7 +5129,7 @@ Description of Ken's filter to improve LZW compression of DXT1 format by ~15%: ( Believe it or not, this gave 1% better compression :P I tried subtracting each componenet with the previous pixel, but strangely it hurt compression. Oh, the joy of trial & error. :) - + 3. For index_4x4, I transform the ordering of 2-bit indices in the DXT blocks from this: 0123 0123 0123 ---- ---- ---- 4567 4567 4567 ---- ---- ---- @@ -5155,9 +5185,9 @@ int dxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *pac { //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); @@ -5281,9 +5311,9 @@ int dedxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *p 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 @@ -5299,8 +5329,8 @@ int dedxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *p 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) { *(short *)(&pic[offs+j+k]) = hicoadd(*(short *)cptr); cptr += 2; @@ -5319,7 +5349,7 @@ int dedxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *p 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); diff --git a/polymer/build/src/pragmas.c b/polymer/build/src/pragmas.c index 963f98228..c287d7959 100644 --- a/polymer/build/src/pragmas.c +++ b/polymer/build/src/pragmas.c @@ -184,13 +184,13 @@ void copybufreverse(void *S, void *D, long c) void qinterpolatedown16(long bufptr, long num, long val, long add) { // gee, I wonder who could have provided this... long i, *lptr = (long *)bufptr; - for(i=0;i>16); val += add; } + for (i=0;i>16); val += add; } } void qinterpolatedown16short(long bufptr, long num, long val, long add) { // ...maybe the same person who provided this too? long i; short *sptr = (short *)bufptr; - for(i=0;i>16); val += add; } + for (i=0;i>16); val += add; } } void clearbuf(void *d, long c, long a) @@ -232,13 +232,13 @@ void clearbufbyte(void *D, long c, long a) void copybufbyte(void *S, void *D, long c) { char *p = (char*)S, *q = (char*)D; - while((c--) > 0) *(q++) = *(p++); + while ((c--) > 0) *(q++) = *(p++); } void copybufreverse(void *S, void *D, long c) { char *p = (char*)S, *q = (char*)D; - while((c--) > 0) *(q++) = *(p--); + while ((c--) > 0) *(q++) = *(p--); } #endif diff --git a/polymer/build/src/scriptfile.c b/polymer/build/src/scriptfile.c index 7ac4eafaf..0099302c3 100644 --- a/polymer/build/src/scriptfile.c +++ b/polymer/build/src/scriptfile.c @@ -178,8 +178,8 @@ int scriptfile_getlinum (scriptfile *sf, char *ptr) ind = ((long)ptr) - ((long)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 } @@ -190,7 +190,7 @@ void scriptfile_preparse (scriptfile *sf, char *tx, long 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; @@ -323,9 +323,9 @@ void scriptfile_close(scriptfile *sf) int scriptfile_eof(scriptfile *sf) { - skipoverws(sf); - if (sf->textptr >= sf->eof) return 1; - return 0; + skipoverws(sf); + if (sf->textptr >= sf->eof) return 1; + return 0; } #define SYMBTABSTARTSIZE 256 @@ -339,7 +339,7 @@ static char * getsymbtabspace(int 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/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index 97c25e445..1e8af09cb 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -663,7 +663,8 @@ void getvalidmodes(void) #ifdef USE_OPENGL 16,24,32, #endif - 0 }; + 0 + }; static int defaultres[][2] = { {1280,1024},{1280,960},{1152,864},{1024,768},{800,600},{640,480}, {640,400},{512,384},{480,360},{400,300},{320,240},{320,200},{0,0} @@ -690,7 +691,7 @@ void getvalidmodes(void) validmodecnt++; \ initprintf(" - %dx%d %d-bit %s\n", x, y, c, (f&1)?"fullscreen":"windowed"); \ } \ -} +} #define CHECK(w,h) if ((w < maxx) && (h < maxy)) @@ -788,10 +789,10 @@ int checkvideomode(int *x, int *y, int c, int fs, int forced) } } - #ifdef ANY_WINDOWED_SIZE +#ifdef ANY_WINDOWED_SIZE if (!forced && (fs&1) == 0 && (nearest < 0 || (validmode[nearest].xdim!=*x || validmode[nearest].ydim!=*y))) return 0x7fffffffl; - #endif +#endif if (nearest < 0) { // no mode that will match (eg. if no fullscreen modes) @@ -1071,7 +1072,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; } } @@ -1301,10 +1302,14 @@ int handleevents(void) case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: switch (ev.button.button) { - case SDL_BUTTON_LEFT: j = 0; break; - case SDL_BUTTON_RIGHT: j = 1; break; - case SDL_BUTTON_MIDDLE: j = 2; break; - default: j = ev.button.button; break; + case SDL_BUTTON_LEFT: + j = 0; break; + case SDL_BUTTON_RIGHT: + j = 1; break; + case SDL_BUTTON_MIDDLE: + j = 2; break; + default: + j = ev.button.button; break; } if (j<0) break; @@ -1338,28 +1343,28 @@ int handleevents(void) break; case SDL_JOYHATMOTION: { - int hatvals[16] = { - -1, // centre - 0, // up 1 - 9000, // right 2 - 4500, // up+right 3 - 18000, // down 4 - -1, // down+up!! 5 - 13500, // down+right 6 - -1, // down+right+up!! 7 - 27000, // left 8 - 27500, // left+up 9 - -1, // left+right!! 10 - -1, // left+right+up!! 11 - 22500, // left+down 12 - -1, // left+down+up!! 13 - -1, // left+down+right!! 14 - -1, // left+down+right+up!! 15 - }; - if (appactive && ev.jhat.hat < joynumhats) - joyhat[ ev.jhat.hat ] = hatvals[ ev.jhat.value & 15 ]; - break; - } + int hatvals[16] = { + -1, // centre + 0, // up 1 + 9000, // right 2 + 4500, // up+right 3 + 18000, // down 4 + -1, // down+up!! 5 + 13500, // down+right 6 + -1, // down+right+up!! 7 + 27000, // left 8 + 27500, // left+up 9 + -1, // left+right!! 10 + -1, // left+right+up!! 11 + 22500, // left+down 12 + -1, // left+down+up!! 13 + -1, // left+down+right!! 14 + -1, // left+down+right+up!! 15 + }; + if (appactive && ev.jhat.hat < joynumhats) + joyhat[ ev.jhat.hat ] = hatvals[ ev.jhat.value & 15 ]; + break; + } case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: diff --git a/polymer/build/src/sound.c b/polymer/build/src/sound.c index 16b9bb533..50ae03eae 100644 --- a/polymer/build/src/sound.c +++ b/polymer/build/src/sound.c @@ -95,14 +95,22 @@ void initsb(char dadigistat, char damusistat, long dasamplerate, char danumspeak } switch (FSOUND_GetOutput()) { - case FSOUND_OUTPUT_NOSOUND: s = "No Sound"; break; - case FSOUND_OUTPUT_WINMM: s = "WINMM"; break; - case FSOUND_OUTPUT_DSOUND: s = "DirectSound"; break; - case FSOUND_OUTPUT_OSS: s = "OSS"; break; - case FSOUND_OUTPUT_ESD: s = "ESound"; break; - case FSOUND_OUTPUT_ALSA: s = "ALSA"; break; - case FSOUND_OUTPUT_ASIO: s = "ASIO"; break; - default: s = "Other"; break; + case FSOUND_OUTPUT_NOSOUND: + s = "No Sound"; break; + case FSOUND_OUTPUT_WINMM: + s = "WINMM"; break; + case FSOUND_OUTPUT_DSOUND: + s = "DirectSound"; break; + case FSOUND_OUTPUT_OSS: + s = "OSS"; break; + case FSOUND_OUTPUT_ESD: + s = "ESound"; break; + case FSOUND_OUTPUT_ALSA: + s = "ALSA"; break; + case FSOUND_OUTPUT_ASIO: + s = "ASIO"; break; + default: + s = "Other"; break; } printOSD("Using FMOD \"%s\" output driver\n", s); diff --git a/polymer/build/src/startgtk.editor.c b/polymer/build/src/startgtk.editor.c index cfa5575ef..414027401 100755 --- a/polymer/build/src/startgtk.editor.c +++ b/polymer/build/src/startgtk.editor.c @@ -60,14 +60,14 @@ static GdkPixbuf *load_banner(void) static void SetPage(int n) { if (!gtkenabled || !startwin) return; - mode = n; + mode = n; gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n); - // each control in the config page vertical layout plus the start button should be made (in)sensitive - if (n == TAB_CONFIG) n = TRUE; else n = FALSE; - gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n); + // each control in the config page vertical layout plus the start button should be made (in)sensitive + if (n == TAB_CONFIG) n = TRUE; else n = FALSE; + gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n); gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")), - (GtkCallback)gtk_widget_set_sensitive, (gpointer)n); + (GtkCallback)gtk_widget_set_sensitive, (gpointer)n); } static void on_vmode2dcombo_changed(GtkComboBox *, gpointer); @@ -169,8 +169,8 @@ static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer u static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data) { - if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); } - else quitevent++; + if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); } + else quitevent++; } static void on_startbutton_clicked(GtkButton *button, gpointer user_data) @@ -181,8 +181,8 @@ static void on_startbutton_clicked(GtkButton *button, gpointer user_data) static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) { - if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); } - else quitevent++; + if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); } + else quitevent++; return TRUE; // FALSE would let the event go through. we want the game to decide when to close } @@ -375,9 +375,9 @@ static GtkWidget *create_window(void) gtk_widget_add_accelerator (cancelbutton, "grab_focus", accel_group, GDK_C, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); - gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group, - GDK_Escape, 0, - GTK_ACCEL_VISIBLE); + gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group, + GDK_Escape, 0, + GTK_ACCEL_VISIBLE); cancelbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (cancelbuttonalign); @@ -403,9 +403,9 @@ static GtkWidget *create_window(void) gtk_widget_add_accelerator (startbutton, "grab_focus", accel_group, GDK_S, GDK_MOD1_MASK, GTK_ACCEL_VISIBLE); - gtk_widget_add_accelerator (startbutton, "clicked", accel_group, - GDK_Return, 0, - GTK_ACCEL_VISIBLE); + gtk_widget_add_accelerator (startbutton, "clicked", accel_group, + GDK_Return, 0, + GTK_ACCEL_VISIBLE); startbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (startbuttonalign); diff --git a/polymer/build/src/startwin.editor.c b/polymer/build/src/startwin.editor.c index 2122a08e9..c82ac5ac6 100755 --- a/polymer/build/src/startwin.editor.c +++ b/polymer/build/src/startwin.editor.c @@ -112,10 +112,12 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case IDCALWAYSSHOW: settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED; return TRUE; - default: break; + default: + break; } break; - default: break; + default: + break; } return FALSE; } @@ -131,14 +133,14 @@ static void SetPage(int n) ShowWindow(pages[cur],SW_HIDE); SendMessage(tab, TCM_SETCURSEL, n, 0); ShowWindow(pages[n],SW_SHOW); - mode = n; + mode = n; SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL)); } static void EnableConfig(int n) { - //EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n); + //EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n); EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n); EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n); EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE), n); @@ -152,128 +154,128 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, switch (uMsg) { case WM_INITDIALOG: { - HWND hwnd; - RECT r, rdlg, chrome, rtab, rcancel, rstart; - int xoffset = 0, yoffset = 0; + HWND hwnd; + RECT r, rdlg, chrome, rtab, rcancel, rstart; + int xoffset = 0, yoffset = 0; - // Fetch the positions (in screen coordinates) of all the windows we need to tweak - ZeroMemory(&chrome, sizeof(chrome)); - AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE); - GetWindowRect(hwndDlg, &rdlg); - GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab); - GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel); - GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart); + // Fetch the positions (in screen coordinates) of all the windows we need to tweak + ZeroMemory(&chrome, sizeof(chrome)); + AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE); + GetWindowRect(hwndDlg, &rdlg); + GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab); + GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel); + GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart); - // Knock off the non-client area of the main dialogue to give just the client area - rdlg.left -= chrome.left; rdlg.top -= chrome.top; - rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom; + // Knock off the non-client area of the main dialogue to give just the client area + rdlg.left -= chrome.left; rdlg.top -= chrome.top; + rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom; - // Translate them to client-relative coordinates wrt the main dialogue window - rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1; - rtab.left -= rdlg.left; rtab.top -= rdlg.top; + // Translate them to client-relative coordinates wrt the main dialogue window + rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1; + rtab.left -= rdlg.left; rtab.top -= rdlg.top; - rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1; - rcancel.left -= rdlg.left; rcancel.top -= rdlg.top; + rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1; + rcancel.left -= rdlg.left; rcancel.top -= rdlg.top; - rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1; - rstart.left -= rdlg.left; rstart.top -= rdlg.top; + rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1; + rstart.left -= rdlg.left; rstart.top -= rdlg.top; - // And then convert the main dialogue coordinates to just width/length - rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1; - rdlg.left = 0; rdlg.top = 0; + // And then convert the main dialogue coordinates to just width/length + rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1; + rdlg.left = 0; rdlg.top = 0; - // Load the bitmap into the bitmap control and fetch its dimensions - hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP)); - hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP); - SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp); + // Load the bitmap into the bitmap control and fetch its dimensions + hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP)); + hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP); + SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp); + GetClientRect(hwnd, &r); + xoffset = r.right; + yoffset = r.bottom - rdlg.bottom; + + // Shift and resize the controls that require it + rtab.left += xoffset; rtab.bottom += yoffset; + rcancel.left += xoffset; rcancel.top += yoffset; + rstart.left += xoffset; rstart.top += yoffset; + rdlg.right += xoffset; + rdlg.bottom += yoffset; + + // Move the controls to their new positions + MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE); + MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE); + MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE); + + // Move the main dialogue to the centre of the screen + hdc = GetDC(NULL); + rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2; + rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2; + ReleaseDC(NULL, hdc); + MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left, + rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE); + + // Add tabs to the tab control + { + TCITEM tab; + + hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL); + + ZeroMemory(&tab, sizeof(tab)); + tab.mask = TCIF_TEXT; + tab.pszText = TEXT("Configuration"); + SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab); + tab.mask = TCIF_TEXT; + tab.pszText = TEXT("Messages"); + SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab); + + // Work out the position and size of the area inside the tab control for the pages + ZeroMemory(&r, sizeof(r)); GetClientRect(hwnd, &r); - xoffset = r.right; - yoffset = r.bottom - rdlg.bottom; + SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r); + r.right -= r.left-1; + r.bottom -= r.top-1; + r.top += rtab.top; + r.left += rtab.left; - // Shift and resize the controls that require it - rtab.left += xoffset; rtab.bottom += yoffset; - rcancel.left += xoffset; rcancel.top += yoffset; - rstart.left += xoffset; rstart.top += yoffset; - rdlg.right += xoffset; - rdlg.bottom += yoffset; + // Create the pages and position them in the tab control, but hide them + pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(), + MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc); + pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES); + SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); + SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); - // Move the controls to their new positions - MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE); - MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE); - MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE); + // Tell the editfield acting as the console to exclude the width of the scrollbar + GetClientRect(pages[TAB_MESSAGES],&r); + r.right -= GetSystemMetrics(SM_CXVSCROLL)+4; + r.left = r.top = 0; + SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r); - // Move the main dialogue to the centre of the screen - hdc = GetDC(NULL); - rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2; - rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2; - ReleaseDC(NULL, hdc); - MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left, - rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE); - - // Add tabs to the tab control - { - TCITEM tab; - - hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL); - - ZeroMemory(&tab, sizeof(tab)); - tab.mask = TCIF_TEXT; - tab.pszText = TEXT("Configuration"); - SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab); - tab.mask = TCIF_TEXT; - tab.pszText = TEXT("Messages"); - SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab); - - // Work out the position and size of the area inside the tab control for the pages - ZeroMemory(&r, sizeof(r)); - GetClientRect(hwnd, &r); - SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r); - r.right -= r.left-1; - r.bottom -= r.top-1; - r.top += rtab.top; - r.left += rtab.left; - - // Create the pages and position them in the tab control, but hide them - pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(), - MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc); - pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES); - SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); - SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); - - // Tell the editfield acting as the console to exclude the width of the scrollbar - GetClientRect(pages[TAB_MESSAGES],&r); - r.right -= GetSystemMetrics(SM_CXVSCROLL)+4; - r.left = r.top = 0; - SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r); - - SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START)); - } - return FALSE; + SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START)); } + return FALSE; + } case WM_NOTIFY: { - LPNMHDR nmhdr = (LPNMHDR)lParam; - int cur; - if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break; - cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0); - switch (nmhdr->code) { - case TCN_SELCHANGING: { - if (cur < 0 || !pages[cur]) break; - ShowWindow(pages[cur],SW_HIDE); - return TRUE; - } - case TCN_SELCHANGE: { - if (cur < 0 || !pages[cur]) break; - ShowWindow(pages[cur],SW_SHOW); - return TRUE; - } - } - break; + LPNMHDR nmhdr = (LPNMHDR)lParam; + int cur; + if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break; + cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0); + switch (nmhdr->code) { + case TCN_SELCHANGING: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_HIDE); + return TRUE; } + case TCN_SELCHANGE: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_SHOW); + return TRUE; + } + } + break; + } case WM_CLOSE: - if (mode == TAB_CONFIG) done = 0; - else quitevent++; + if (mode == TAB_CONFIG) done = 0; + else quitevent++; return TRUE; case WM_DESTROY: @@ -292,11 +294,12 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, case WM_COMMAND: switch (LOWORD(wParam)) { - case WIN_STARTWIN_CANCEL: - if (mode == TAB_CONFIG) done = 0; - else quitevent++; - return TRUE; - case WIN_STARTWIN_START: done = 1; return TRUE; + case WIN_STARTWIN_CANCEL: + if (mode == TAB_CONFIG) done = 0; + else quitevent++; + return TRUE; + case WIN_STARTWIN_START: + done = 1; return TRUE; } return FALSE; @@ -305,7 +308,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, return (BOOL)GetSysColorBrush(COLOR_WINDOW); break; - default: break; + default: + break; } return FALSE; @@ -422,8 +426,10 @@ int startwin_run(void) while (done < 0) { switch (GetMessage(&msg, NULL, 0,0)) { - case 0: done = 1; break; - case -1: return -1; + case 0: + done = 1; break; + case -1: + return -1; default: if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break; TranslateMessage(&msg); diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index 0c72bc7bb..9919909a1 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -910,7 +910,8 @@ static BOOL CALLBACK InitDirectInput_enum(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRe ); */ break; - default: d = "OTHER"; break; + default: + d = "OTHER"; break; } initprintf(" * %s: %s\n", d, lpddi->tszProductName); @@ -1494,40 +1495,74 @@ static void ShowDInputErrorBox(const char *m, HRESULT r) static const char * GetDInputError(HRESULT code) { switch (code) { - case DI_OK: return "DI_OK"; - case DI_BUFFEROVERFLOW: return "DI_BUFFEROVERFLOW"; - case DI_DOWNLOADSKIPPED: return "DI_DOWNLOADSKIPPED"; - case DI_EFFECTRESTARTED: return "DI_EFFECTRESTARTED"; - case DI_POLLEDDEVICE: return "DI_POLLEDDEVICE"; - case DI_TRUNCATED: return "DI_TRUNCATED"; - case DI_TRUNCATEDANDRESTARTED: return "DI_TRUNCATEDANDRESTARTED"; - case DIERR_ACQUIRED: return "DIERR_ACQUIRED"; - case DIERR_ALREADYINITIALIZED: return "DIERR_ALREADYINITIALIZED"; - case DIERR_BADDRIVERVER: return "DIERR_BADDRIVERVER"; - case DIERR_BETADIRECTINPUTVERSION: return "DIERR_BETADIRECTINPUTVERSION"; - case DIERR_DEVICEFULL: return "DIERR_DEVICEFULL"; - case DIERR_DEVICENOTREG: return "DIERR_DEVICENOTREG"; - case DIERR_EFFECTPLAYING: return "DIERR_EFFECTPLAYING"; - case DIERR_HASEFFECTS: return "DIERR_HASEFFECTS"; - case DIERR_GENERIC: return "DIERR_GENERIC"; - case DIERR_HANDLEEXISTS: return "DIERR_HANDLEEXISTS"; - case DIERR_INCOMPLETEEFFECT: return "DIERR_INCOMPLETEEFFECT"; - case DIERR_INPUTLOST: return "DIERR_INPUTLOST"; - case DIERR_INVALIDPARAM: return "DIERR_INVALIDPARAM"; - case DIERR_MOREDATA: return "DIERR_MOREDATA"; - case DIERR_NOAGGREGATION: return "DIERR_NOAGGREGATION"; - case DIERR_NOINTERFACE: return "DIERR_NOINTERFACE"; - case DIERR_NOTACQUIRED: return "DIERR_NOTACQUIRED"; - case DIERR_NOTBUFFERED: return "DIERR_NOTBUFFERED"; - case DIERR_NOTDOWNLOADED: return "DIERR_NOTDOWNLOADED"; - case DIERR_NOTEXCLUSIVEACQUIRED: return "DIERR_NOTEXCLUSIVEACQUIRED"; - case DIERR_NOTFOUND: return "DIERR_NOTFOUND"; - case DIERR_NOTINITIALIZED: return "DIERR_NOTINITIALIZED"; - case DIERR_OLDDIRECTINPUTVERSION: return "DIERR_OLDDIRECTINPUTVERSION"; - case DIERR_OUTOFMEMORY: return "DIERR_OUTOFMEMORY"; - case DIERR_UNSUPPORTED: return "DIERR_UNSUPPORTED"; - case E_PENDING: return "E_PENDING"; - default: break; + case DI_OK: + return "DI_OK"; + case DI_BUFFEROVERFLOW: + return "DI_BUFFEROVERFLOW"; + case DI_DOWNLOADSKIPPED: + return "DI_DOWNLOADSKIPPED"; + case DI_EFFECTRESTARTED: + return "DI_EFFECTRESTARTED"; + case DI_POLLEDDEVICE: + return "DI_POLLEDDEVICE"; + case DI_TRUNCATED: + return "DI_TRUNCATED"; + case DI_TRUNCATEDANDRESTARTED: + return "DI_TRUNCATEDANDRESTARTED"; + case DIERR_ACQUIRED: + return "DIERR_ACQUIRED"; + case DIERR_ALREADYINITIALIZED: + return "DIERR_ALREADYINITIALIZED"; + case DIERR_BADDRIVERVER: + return "DIERR_BADDRIVERVER"; + case DIERR_BETADIRECTINPUTVERSION: + return "DIERR_BETADIRECTINPUTVERSION"; + case DIERR_DEVICEFULL: + return "DIERR_DEVICEFULL"; + case DIERR_DEVICENOTREG: + return "DIERR_DEVICENOTREG"; + case DIERR_EFFECTPLAYING: + return "DIERR_EFFECTPLAYING"; + case DIERR_HASEFFECTS: + return "DIERR_HASEFFECTS"; + case DIERR_GENERIC: + return "DIERR_GENERIC"; + case DIERR_HANDLEEXISTS: + return "DIERR_HANDLEEXISTS"; + case DIERR_INCOMPLETEEFFECT: + return "DIERR_INCOMPLETEEFFECT"; + case DIERR_INPUTLOST: + return "DIERR_INPUTLOST"; + case DIERR_INVALIDPARAM: + return "DIERR_INVALIDPARAM"; + case DIERR_MOREDATA: + return "DIERR_MOREDATA"; + case DIERR_NOAGGREGATION: + return "DIERR_NOAGGREGATION"; + case DIERR_NOINTERFACE: + return "DIERR_NOINTERFACE"; + case DIERR_NOTACQUIRED: + return "DIERR_NOTACQUIRED"; + case DIERR_NOTBUFFERED: + return "DIERR_NOTBUFFERED"; + case DIERR_NOTDOWNLOADED: + return "DIERR_NOTDOWNLOADED"; + case DIERR_NOTEXCLUSIVEACQUIRED: + return "DIERR_NOTEXCLUSIVEACQUIRED"; + case DIERR_NOTFOUND: + return "DIERR_NOTFOUND"; + case DIERR_NOTINITIALIZED: + return "DIERR_NOTINITIALIZED"; + case DIERR_OLDDIRECTINPUTVERSION: + return "DIERR_OLDDIRECTINPUTVERSION"; + case DIERR_OUTOFMEMORY: + return "DIERR_OUTOFMEMORY"; + case DIERR_UNSUPPORTED: + return "DIERR_UNSUPPORTED"; + case E_PENDING: + return "E_PENDING"; + default: + break; } return "Unknown error"; } @@ -1993,7 +2028,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; } @@ -3170,118 +3205,230 @@ static void ShowDDrawErrorBox(const char *m, HRESULT r) static const char * GetDDrawError(HRESULT code) { switch (code) { - case DD_OK: return "DD_OK"; - case DDERR_ALREADYINITIALIZED: return "DDERR_ALREADYINITIALIZED"; - case DDERR_BLTFASTCANTCLIP: return "DDERR_BLTFASTCANTCLIP"; - case DDERR_CANNOTATTACHSURFACE: return "DDERR_CANNOTATTACHSURFACE"; - case DDERR_CANNOTDETACHSURFACE: return "DDERR_CANNOTDETACHSURFACE"; - case DDERR_CANTCREATEDC: return "DDERR_CANTCREATEDC"; - case DDERR_CANTDUPLICATE: return "DDERR_CANTDUPLICATE"; - case DDERR_CANTLOCKSURFACE: return "DDERR_CANTLOCKSURFACE"; - case DDERR_CANTPAGELOCK: return "DDERR_CANTPAGELOCK"; - case DDERR_CANTPAGEUNLOCK: return "DDERR_CANTPAGEUNLOCK"; - case DDERR_CLIPPERISUSINGHWND: return "DDERR_CLIPPERISUSINGHWND"; - case DDERR_COLORKEYNOTSET: return "DDERR_COLORKEYNOTSET"; - case DDERR_CURRENTLYNOTAVAIL: return "DDERR_CURRENTLYNOTAVAIL"; - case DDERR_DCALREADYCREATED: return "DDERR_DCALREADYCREATED"; - case DDERR_DEVICEDOESNTOWNSURFACE: return "DDERR_DEVICEDOESNTOWNSURFACE"; - case DDERR_DIRECTDRAWALREADYCREATED: return "DDERR_DIRECTDRAWALREADYCREATED"; - case DDERR_EXCEPTION: return "DDERR_EXCEPTION"; - case DDERR_EXCLUSIVEMODEALREADYSET: return "DDERR_EXCLUSIVEMODEALREADYSET"; - case DDERR_EXPIRED: return "DDERR_EXPIRED"; - case DDERR_GENERIC: return "DDERR_GENERIC"; - case DDERR_HEIGHTALIGN: return "DDERR_HEIGHTALIGN"; - case DDERR_HWNDALREADYSET: return "DDERR_HWNDALREADYSET"; - case DDERR_HWNDSUBCLASSED: return "DDERR_HWNDSUBCLASSED"; - case DDERR_IMPLICITLYCREATED: return "DDERR_IMPLICITLYCREATED"; - case DDERR_INCOMPATIBLEPRIMARY: return "DDERR_INCOMPATIBLEPRIMARY"; - case DDERR_INVALIDCAPS: return "DDERR_INVALIDCAPS"; - case DDERR_INVALIDCLIPLIST: return "DDERR_INVALIDCLIPLIST"; - case DDERR_INVALIDDIRECTDRAWGUID: return "DDERR_INVALIDDIRECTDRAWGUID"; - case DDERR_INVALIDMODE: return "DDERR_INVALIDMODE"; - case DDERR_INVALIDOBJECT: return "DDERR_INVALIDOBJECT"; - case DDERR_INVALIDPARAMS: return "DDERR_INVALIDPARAMS"; - case DDERR_INVALIDPIXELFORMAT: return "DDERR_INVALIDPIXELFORMAT"; - case DDERR_INVALIDPOSITION: return "DDERR_INVALIDPOSITION"; - case DDERR_INVALIDRECT: return "DDERR_INVALIDRECT"; - case DDERR_INVALIDSTREAM: return "DDERR_INVALIDSTREAM"; - case DDERR_INVALIDSURFACETYPE: return "DDERR_INVALIDSURFACETYPE"; - case DDERR_LOCKEDSURFACES: return "DDERR_LOCKEDSURFACES"; - case DDERR_MOREDATA: return "DDERR_MOREDATA"; - case DDERR_NO3D: return "DDERR_NO3D"; - case DDERR_NOALPHAHW: return "DDERR_NOALPHAHW"; - case DDERR_NOBLTHW: return "DDERR_NOBLTHW"; - case DDERR_NOCLIPLIST: return "DDERR_NOCLIPLIST"; - case DDERR_NOCLIPPERATTACHED: return "DDERR_NOCLIPPERATTACHED"; - case DDERR_NOCOLORCONVHW: return "DDERR_NOCOLORCONVHW"; - case DDERR_NOCOLORKEY: return "DDERR_NOCOLORKEY"; - case DDERR_NOCOLORKEYHW: return "DDERR_NOCOLORKEYHW"; - case DDERR_NOCOOPERATIVELEVELSET: return "DDERR_NOCOOPERATIVELEVELSET"; - case DDERR_NODC: return "DDERR_NODC"; - case DDERR_NODDROPSHW: return "DDERR_NODDROPSHW"; - case DDERR_NODIRECTDRAWHW: return "DDERR_NODIRECTDRAWHW"; - case DDERR_NODIRECTDRAWSUPPORT: return "DDERR_NODIRECTDRAWSUPPORT"; - case DDERR_NOEMULATION: return "DDERR_NOEMULATION"; - case DDERR_NOEXCLUSIVEMODE: return "DDERR_NOEXCLUSIVEMODE"; - case DDERR_NOFLIPHW: return "DDERR_NOFLIPHW"; - case DDERR_NOFOCUSWINDOW: return "DDERR_NOFOCUSWINDOW"; - case DDERR_NOGDI: return "DDERR_NOGDI"; - case DDERR_NOHWND: return "DDERR_NOHWND"; - case DDERR_NOMIPMAPHW: return "DDERR_NOMIPMAPHW"; - case DDERR_NOMIRRORHW: return "DDERR_NOMIRRORHW"; - case DDERR_NONONLOCALVIDMEM: return "DDERR_NONONLOCALVIDMEM"; - case DDERR_NOOPTIMIZEHW: return "DDERR_NOOPTIMIZEHW"; - case DDERR_NOOVERLAYDEST: return "DDERR_NOOVERLAYDEST"; - case DDERR_NOOVERLAYHW: return "DDERR_NOOVERLAYHW"; - case DDERR_NOPALETTEATTACHED: return "DDERR_NOPALETTEATTACHED"; - case DDERR_NOPALETTEHW: return "DDERR_NOPALETTEHW"; - case DDERR_NORASTEROPHW: return "DDERR_NORASTEROPHW"; - case DDERR_NOROTATIONHW: return "DDERR_NOROTATIONHW"; - case DDERR_NOSTRETCHHW: return "DDERR_NOSTRETCHHW"; - case DDERR_NOT4BITCOLOR: return "DDERR_NOT4BITCOLOR"; - case DDERR_NOT4BITCOLORINDEX: return "DDERR_NOT4BITCOLORINDEX"; - case DDERR_NOT8BITCOLOR: return "DDERR_NOT8BITCOLOR"; - case DDERR_NOTAOVERLAYSURFACE: return "DDERR_NOTAOVERLAYSURFACE"; - case DDERR_NOTEXTUREHW: return "DDERR_NOTEXTUREHW"; - case DDERR_NOTFLIPPABLE: return "DDERR_NOTFLIPPABLE"; - case DDERR_NOTFOUND: return "DDERR_NOTFOUND"; - case DDERR_NOTINITIALIZED: return "DDERR_NOTINITIALIZED"; - case DDERR_NOTLOADED: return "DDERR_NOTLOADED"; - case DDERR_NOTLOCKED: return "DDERR_NOTLOCKED"; - case DDERR_NOTPAGELOCKED: return "DDERR_NOTPAGELOCKED"; - case DDERR_NOTPALETTIZED: return "DDERR_NOTPALETTIZED"; - case DDERR_NOVSYNCHW: return "DDERR_NOVSYNCHW"; - case DDERR_NOZBUFFERHW: return "DDERR_NOZBUFFERHW"; - case DDERR_NOZOVERLAYHW: return "DDERR_NOZOVERLAYHW"; - case DDERR_OUTOFCAPS: return "DDERR_OUTOFCAPS"; - case DDERR_OUTOFMEMORY: return "DDERR_OUTOFMEMORY"; - case DDERR_OUTOFVIDEOMEMORY: return "DDERR_OUTOFVIDEOMEMORY"; - case DDERR_OVERLAPPINGRECTS: return "DDERR_OVERLAPPINGRECTS"; - case DDERR_OVERLAYCANTCLIP: return "DDERR_OVERLAYCANTCLIP"; - case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"; - case DDERR_OVERLAYNOTVISIBLE: return "DDERR_OVERLAYNOTVISIBLE"; - case DDERR_PALETTEBUSY: return "DDERR_PALETTEBUSY"; - case DDERR_PRIMARYSURFACEALREADYEXISTS: return "DDERR_PRIMARYSURFACEALREADYEXISTS"; - case DDERR_REGIONTOOSMALL: return "DDERR_REGIONTOOSMALL"; - case DDERR_SURFACEALREADYATTACHED: return "DDERR_SURFACEALREADYATTACHED"; - case DDERR_SURFACEALREADYDEPENDENT: return "DDERR_SURFACEALREADYDEPENDENT"; - case DDERR_SURFACEBUSY: return "DDERR_SURFACEBUSY"; - case DDERR_SURFACEISOBSCURED: return "DDERR_SURFACEISOBSCURED"; - case DDERR_SURFACELOST: return "DDERR_SURFACELOST"; - case DDERR_SURFACENOTATTACHED: return "DDERR_SURFACENOTATTACHED"; - case DDERR_TOOBIGHEIGHT: return "DDERR_TOOBIGHEIGHT"; - case DDERR_TOOBIGSIZE: return "DDERR_TOOBIGSIZE"; - case DDERR_TOOBIGWIDTH: return "DDERR_TOOBIGWIDTH"; - case DDERR_UNSUPPORTED: return "DDERR_UNSUPPORTED"; - case DDERR_UNSUPPORTEDFORMAT: return "DDERR_UNSUPPORTEDFORMAT"; - case DDERR_UNSUPPORTEDMASK: return "DDERR_UNSUPPORTEDMASK"; - case DDERR_UNSUPPORTEDMODE: return "DDERR_UNSUPPORTEDMODE"; - case DDERR_VERTICALBLANKINPROGRESS: return "DDERR_VERTICALBLANKINPROGRESS"; - case DDERR_VIDEONOTACTIVE: return "DDERR_VIDEONOTACTIVE"; - case DDERR_WASSTILLDRAWING: return "DDERR_WASSTILLDRAWING"; - case DDERR_WRONGMODE: return "DDERR_WRONGMODE"; - case DDERR_XALIGN: return "DDERR_XALIGN"; - default: break; + case DD_OK: + return "DD_OK"; + case DDERR_ALREADYINITIALIZED: + return "DDERR_ALREADYINITIALIZED"; + case DDERR_BLTFASTCANTCLIP: + return "DDERR_BLTFASTCANTCLIP"; + case DDERR_CANNOTATTACHSURFACE: + return "DDERR_CANNOTATTACHSURFACE"; + case DDERR_CANNOTDETACHSURFACE: + return "DDERR_CANNOTDETACHSURFACE"; + case DDERR_CANTCREATEDC: + return "DDERR_CANTCREATEDC"; + case DDERR_CANTDUPLICATE: + return "DDERR_CANTDUPLICATE"; + case DDERR_CANTLOCKSURFACE: + return "DDERR_CANTLOCKSURFACE"; + case DDERR_CANTPAGELOCK: + return "DDERR_CANTPAGELOCK"; + case DDERR_CANTPAGEUNLOCK: + return "DDERR_CANTPAGEUNLOCK"; + case DDERR_CLIPPERISUSINGHWND: + return "DDERR_CLIPPERISUSINGHWND"; + case DDERR_COLORKEYNOTSET: + return "DDERR_COLORKEYNOTSET"; + case DDERR_CURRENTLYNOTAVAIL: + return "DDERR_CURRENTLYNOTAVAIL"; + case DDERR_DCALREADYCREATED: + return "DDERR_DCALREADYCREATED"; + case DDERR_DEVICEDOESNTOWNSURFACE: + return "DDERR_DEVICEDOESNTOWNSURFACE"; + case DDERR_DIRECTDRAWALREADYCREATED: + return "DDERR_DIRECTDRAWALREADYCREATED"; + case DDERR_EXCEPTION: + return "DDERR_EXCEPTION"; + case DDERR_EXCLUSIVEMODEALREADYSET: + return "DDERR_EXCLUSIVEMODEALREADYSET"; + case DDERR_EXPIRED: + return "DDERR_EXPIRED"; + case DDERR_GENERIC: + return "DDERR_GENERIC"; + case DDERR_HEIGHTALIGN: + return "DDERR_HEIGHTALIGN"; + case DDERR_HWNDALREADYSET: + return "DDERR_HWNDALREADYSET"; + case DDERR_HWNDSUBCLASSED: + return "DDERR_HWNDSUBCLASSED"; + case DDERR_IMPLICITLYCREATED: + return "DDERR_IMPLICITLYCREATED"; + case DDERR_INCOMPATIBLEPRIMARY: + return "DDERR_INCOMPATIBLEPRIMARY"; + case DDERR_INVALIDCAPS: + return "DDERR_INVALIDCAPS"; + case DDERR_INVALIDCLIPLIST: + return "DDERR_INVALIDCLIPLIST"; + case DDERR_INVALIDDIRECTDRAWGUID: + return "DDERR_INVALIDDIRECTDRAWGUID"; + case DDERR_INVALIDMODE: + return "DDERR_INVALIDMODE"; + case DDERR_INVALIDOBJECT: + return "DDERR_INVALIDOBJECT"; + case DDERR_INVALIDPARAMS: + return "DDERR_INVALIDPARAMS"; + case DDERR_INVALIDPIXELFORMAT: + return "DDERR_INVALIDPIXELFORMAT"; + case DDERR_INVALIDPOSITION: + return "DDERR_INVALIDPOSITION"; + case DDERR_INVALIDRECT: + return "DDERR_INVALIDRECT"; + case DDERR_INVALIDSTREAM: + return "DDERR_INVALIDSTREAM"; + case DDERR_INVALIDSURFACETYPE: + return "DDERR_INVALIDSURFACETYPE"; + case DDERR_LOCKEDSURFACES: + return "DDERR_LOCKEDSURFACES"; + case DDERR_MOREDATA: + return "DDERR_MOREDATA"; + case DDERR_NO3D: + return "DDERR_NO3D"; + case DDERR_NOALPHAHW: + return "DDERR_NOALPHAHW"; + case DDERR_NOBLTHW: + return "DDERR_NOBLTHW"; + case DDERR_NOCLIPLIST: + return "DDERR_NOCLIPLIST"; + case DDERR_NOCLIPPERATTACHED: + return "DDERR_NOCLIPPERATTACHED"; + case DDERR_NOCOLORCONVHW: + return "DDERR_NOCOLORCONVHW"; + case DDERR_NOCOLORKEY: + return "DDERR_NOCOLORKEY"; + case DDERR_NOCOLORKEYHW: + return "DDERR_NOCOLORKEYHW"; + case DDERR_NOCOOPERATIVELEVELSET: + return "DDERR_NOCOOPERATIVELEVELSET"; + case DDERR_NODC: + return "DDERR_NODC"; + case DDERR_NODDROPSHW: + return "DDERR_NODDROPSHW"; + case DDERR_NODIRECTDRAWHW: + return "DDERR_NODIRECTDRAWHW"; + case DDERR_NODIRECTDRAWSUPPORT: + return "DDERR_NODIRECTDRAWSUPPORT"; + case DDERR_NOEMULATION: + return "DDERR_NOEMULATION"; + case DDERR_NOEXCLUSIVEMODE: + return "DDERR_NOEXCLUSIVEMODE"; + case DDERR_NOFLIPHW: + return "DDERR_NOFLIPHW"; + case DDERR_NOFOCUSWINDOW: + return "DDERR_NOFOCUSWINDOW"; + case DDERR_NOGDI: + return "DDERR_NOGDI"; + case DDERR_NOHWND: + return "DDERR_NOHWND"; + case DDERR_NOMIPMAPHW: + return "DDERR_NOMIPMAPHW"; + case DDERR_NOMIRRORHW: + return "DDERR_NOMIRRORHW"; + case DDERR_NONONLOCALVIDMEM: + return "DDERR_NONONLOCALVIDMEM"; + case DDERR_NOOPTIMIZEHW: + return "DDERR_NOOPTIMIZEHW"; + case DDERR_NOOVERLAYDEST: + return "DDERR_NOOVERLAYDEST"; + case DDERR_NOOVERLAYHW: + return "DDERR_NOOVERLAYHW"; + case DDERR_NOPALETTEATTACHED: + return "DDERR_NOPALETTEATTACHED"; + case DDERR_NOPALETTEHW: + return "DDERR_NOPALETTEHW"; + case DDERR_NORASTEROPHW: + return "DDERR_NORASTEROPHW"; + case DDERR_NOROTATIONHW: + return "DDERR_NOROTATIONHW"; + case DDERR_NOSTRETCHHW: + return "DDERR_NOSTRETCHHW"; + case DDERR_NOT4BITCOLOR: + return "DDERR_NOT4BITCOLOR"; + case DDERR_NOT4BITCOLORINDEX: + return "DDERR_NOT4BITCOLORINDEX"; + case DDERR_NOT8BITCOLOR: + return "DDERR_NOT8BITCOLOR"; + case DDERR_NOTAOVERLAYSURFACE: + return "DDERR_NOTAOVERLAYSURFACE"; + case DDERR_NOTEXTUREHW: + return "DDERR_NOTEXTUREHW"; + case DDERR_NOTFLIPPABLE: + return "DDERR_NOTFLIPPABLE"; + case DDERR_NOTFOUND: + return "DDERR_NOTFOUND"; + case DDERR_NOTINITIALIZED: + return "DDERR_NOTINITIALIZED"; + case DDERR_NOTLOADED: + return "DDERR_NOTLOADED"; + case DDERR_NOTLOCKED: + return "DDERR_NOTLOCKED"; + case DDERR_NOTPAGELOCKED: + return "DDERR_NOTPAGELOCKED"; + case DDERR_NOTPALETTIZED: + return "DDERR_NOTPALETTIZED"; + case DDERR_NOVSYNCHW: + return "DDERR_NOVSYNCHW"; + case DDERR_NOZBUFFERHW: + return "DDERR_NOZBUFFERHW"; + case DDERR_NOZOVERLAYHW: + return "DDERR_NOZOVERLAYHW"; + case DDERR_OUTOFCAPS: + return "DDERR_OUTOFCAPS"; + case DDERR_OUTOFMEMORY: + return "DDERR_OUTOFMEMORY"; + case DDERR_OUTOFVIDEOMEMORY: + return "DDERR_OUTOFVIDEOMEMORY"; + case DDERR_OVERLAPPINGRECTS: + return "DDERR_OVERLAPPINGRECTS"; + case DDERR_OVERLAYCANTCLIP: + return "DDERR_OVERLAYCANTCLIP"; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: + return "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"; + case DDERR_OVERLAYNOTVISIBLE: + return "DDERR_OVERLAYNOTVISIBLE"; + case DDERR_PALETTEBUSY: + return "DDERR_PALETTEBUSY"; + case DDERR_PRIMARYSURFACEALREADYEXISTS: + return "DDERR_PRIMARYSURFACEALREADYEXISTS"; + case DDERR_REGIONTOOSMALL: + return "DDERR_REGIONTOOSMALL"; + case DDERR_SURFACEALREADYATTACHED: + return "DDERR_SURFACEALREADYATTACHED"; + case DDERR_SURFACEALREADYDEPENDENT: + return "DDERR_SURFACEALREADYDEPENDENT"; + case DDERR_SURFACEBUSY: + return "DDERR_SURFACEBUSY"; + case DDERR_SURFACEISOBSCURED: + return "DDERR_SURFACEISOBSCURED"; + case DDERR_SURFACELOST: + return "DDERR_SURFACELOST"; + case DDERR_SURFACENOTATTACHED: + return "DDERR_SURFACENOTATTACHED"; + case DDERR_TOOBIGHEIGHT: + return "DDERR_TOOBIGHEIGHT"; + case DDERR_TOOBIGSIZE: + return "DDERR_TOOBIGSIZE"; + case DDERR_TOOBIGWIDTH: + return "DDERR_TOOBIGWIDTH"; + case DDERR_UNSUPPORTED: + return "DDERR_UNSUPPORTED"; + case DDERR_UNSUPPORTEDFORMAT: + return "DDERR_UNSUPPORTEDFORMAT"; + case DDERR_UNSUPPORTEDMASK: + return "DDERR_UNSUPPORTEDMASK"; + case DDERR_UNSUPPORTEDMODE: + return "DDERR_UNSUPPORTEDMODE"; + case DDERR_VERTICALBLANKINPROGRESS: + return "DDERR_VERTICALBLANKINPROGRESS"; + case DDERR_VIDEONOTACTIVE: + return "DDERR_VIDEONOTACTIVE"; + case DDERR_WASSTILLDRAWING: + return "DDERR_WASSTILLDRAWING"; + case DDERR_WRONGMODE: + return "DDERR_WRONGMODE"; + case DDERR_XALIGN: + return "DDERR_XALIGN"; + default: + break; } return "Unknown error"; } diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index b81deae42..2685b0aa2 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -28,7 +28,7 @@ void updateinterpolations() //Stick at beginning of domovethings { long i; - for(i=numinterpolations-1;i>=0;i--) oldipos[i] = *curipos[i]; + for (i=numinterpolations-1;i>=0;i--) oldipos[i] = *curipos[i]; } void setinterpolation(long *posptr) @@ -36,7 +36,7 @@ void setinterpolation(long *posptr) long i; if (numinterpolations >= MAXINTERPOLATIONS) return; - for(i=numinterpolations-1;i>=0;i--) + for (i=numinterpolations-1;i>=0;i--) if (curipos[i] == posptr) return; curipos[numinterpolations] = posptr; oldipos[numinterpolations] = *posptr; @@ -47,7 +47,7 @@ void stopinterpolation(long *posptr) { long i; - for(i=numinterpolations-1;i>=startofdynamicinterpolations;i--) + for (i=numinterpolations-1;i>=startofdynamicinterpolations;i--) if (curipos[i] == posptr) { numinterpolations--; @@ -62,7 +62,7 @@ void dointerpolations(long smoothratio) //Stick at beginning of drawscreen long i, j, odelta, ndelta; ndelta = 0; j = 0; - for(i=numinterpolations-1;i>=0;i--) + for (i=numinterpolations-1;i>=0;i--) { bakipos[i] = *curipos[i]; odelta = ndelta; ndelta = (*curipos[i])-oldipos[i]; @@ -75,12 +75,12 @@ void restoreinterpolations() //Stick at end of drawscreen { long i; - for(i=numinterpolations-1;i>=0;i--) *curipos[i] = bakipos[i]; + for (i=numinterpolations-1;i>=0;i--) *curipos[i] = bakipos[i]; } long ceilingspace(short sectnum) { - if( (sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 ) + if ( (sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 ) { if ((sector[sectnum].ceilingpicnum==MOONSKY1)||(sector[sectnum].ceilingpicnum==BIGORBIT1)) return 1; @@ -90,7 +90,7 @@ long ceilingspace(short sectnum) long floorspace(short sectnum) { - if( (sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 ) + if ( (sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 ) { if ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1)) return 1; } @@ -101,7 +101,7 @@ void addammo( short weapon,struct player_struct *p,short amount) { p->ammo_amount[weapon] += amount; - if( p->ammo_amount[weapon] > max_ammo_amount[weapon] ) + if ( p->ammo_amount[weapon] > max_ammo_amount[weapon] ) p->ammo_amount[weapon] = max_ammo_amount[weapon]; } @@ -110,28 +110,36 @@ void addweaponnoswitch( struct player_struct *p, short weapon) if ( p->gotweapon[weapon] == 0 ) { p->gotweapon[weapon] = 1; - if(weapon == SHRINKER_WEAPON) + if (weapon == SHRINKER_WEAPON) p->gotweapon[GROW_WEAPON] = 1; } - switch(p->curr_weapon) + switch (p->curr_weapon) { case KNEE_WEAPON: case TRIPBOMB_WEAPON: case HANDREMOTE_WEAPON: - case HANDBOMB_WEAPON: break; - case SHOTGUN_WEAPON: stopspritesound(SHOTGUN_COCK,p->i);break; - case PISTOL_WEAPON: stopspritesound(INSERT_CLIP,p->i);break; - default: stopspritesound(SELECT_WEAPON,p->i);break; + case HANDBOMB_WEAPON: + break; + case SHOTGUN_WEAPON: + stopspritesound(SHOTGUN_COCK,p->i);break; + case PISTOL_WEAPON: + stopspritesound(INSERT_CLIP,p->i);break; + default: + stopspritesound(SELECT_WEAPON,p->i);break; } - switch(weapon) + switch (weapon) { case KNEE_WEAPON: case TRIPBOMB_WEAPON: case HANDREMOTE_WEAPON: - case HANDBOMB_WEAPON: break; - case SHOTGUN_WEAPON: spritesound(SHOTGUN_COCK,p->i);break; - case PISTOL_WEAPON: spritesound(INSERT_CLIP,p->i);break; - default: spritesound(SELECT_WEAPON,p->i);break; + case HANDBOMB_WEAPON: + break; + case SHOTGUN_WEAPON: + spritesound(SHOTGUN_COCK,p->i);break; + case PISTOL_WEAPON: + spritesound(INSERT_CLIP,p->i);break; + default: + spritesound(SELECT_WEAPON,p->i);break; } } @@ -146,9 +154,9 @@ void addweapon( struct player_struct *p,short weapon) p->random_club_frame = 0; - if(p->holster_weapon == 0) + if (p->holster_weapon == 0) { - if(p->weapon_pos == 0) + if (p->weapon_pos == 0) p->weapon_pos = -1; else p->weapon_pos = -9; p->last_weapon = p->curr_weapon; @@ -162,13 +170,13 @@ void addweapon( struct player_struct *p,short weapon) p->kickback_pic = 0; - if(p->curr_weapon != weapon) + if (p->curr_weapon != weapon) OnEvent(EVENT_CHANGEWEAPON,p->i, snum, -1); p->curr_weapon = weapon; SetGameVarID(g_iWeaponVarID,p->curr_weapon, p->i, snum); - if(p->curr_weapon>=0) + if (p->curr_weapon>=0) { SetGameVarID(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum); } @@ -181,19 +189,19 @@ void addweapon( struct player_struct *p,short weapon) void checkavailinven( struct player_struct *p ) { - if(p->firstaid_amount > 0) + if (p->firstaid_amount > 0) p->inven_icon = 1; - else if(p->steroids_amount > 0) + else if (p->steroids_amount > 0) p->inven_icon = 2; - else if(p->holoduke_amount > 0) + else if (p->holoduke_amount > 0) p->inven_icon = 3; - else if(p->jetpack_amount > 0) + else if (p->jetpack_amount > 0) p->inven_icon = 4; - else if(p->heat_amount > 0) + else if (p->heat_amount > 0) p->inven_icon = 5; - else if(p->scuba_amount > 0) + else if (p->scuba_amount > 0) p->inven_icon = 6; - else if(p->boot_amount > 0) + else if (p->boot_amount > 0) p->inven_icon = 7; else p->inven_icon = 0; } @@ -203,15 +211,15 @@ void checkavailweapon( struct player_struct *p ) short i,snum; int32 weap; - if(p->reloading == 1) return; + if (p->reloading == 1) return; - if(p->wantweaponfire >= 0) + if (p->wantweaponfire >= 0) { weap = p->wantweaponfire; p->wantweaponfire = -1; - if(weap == p->curr_weapon) return; - else if( p->gotweapon[weap] && p->ammo_amount[weap] > 0 ) + if (weap == p->curr_weapon) return; + else if ( p->gotweapon[weap] && p->ammo_amount[weap] > 0 ) { addweapon(p,weap); return; @@ -219,26 +227,26 @@ void checkavailweapon( struct player_struct *p ) } weap = p->curr_weapon; - if( p->gotweapon[weap] && p->ammo_amount[weap] > 0 ) + if ( p->gotweapon[weap] && p->ammo_amount[weap] > 0 ) return; - if( p->gotweapon[weap] && !(p->weaponswitch & 2)) + if ( p->gotweapon[weap] && !(p->weaponswitch & 2)) return; snum = sprite[p->i].yvel; - for(i=0;i<10;i++) + for (i=0;i<10;i++) { weap = ud.wchoice[snum][i]; if (VOLUMEONE && weap > 6) continue; - if(weap == 0) weap = 9; + if (weap == 0) weap = 9; else weap--; - if( weap == 0 || ( p->gotweapon[weap] && p->ammo_amount[weap] > 0 ) ) + if ( weap == 0 || ( p->gotweapon[weap] && p->ammo_amount[weap] > 0 ) ) break; } - if(i == 10) weap = 0; + if (i == 10) weap = 0; // Found the weapon @@ -246,7 +254,7 @@ void checkavailweapon( struct player_struct *p ) p->random_club_frame = 0; p->curr_weapon = weap; SetGameVarID(g_iWeaponVarID,p->curr_weapon, p->i, snum); - if(p->curr_weapon>=0) + if (p->curr_weapon>=0) { SetGameVarID(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum); } @@ -256,7 +264,7 @@ void checkavailweapon( struct player_struct *p ) } OnEvent(EVENT_CHANGEWEAPON,p->i, snum, -1); p->kickback_pic = 0; - if(p->holster_weapon == 1) + if (p->holster_weapon == 1) { p->holster_weapon = 0; p->weapon_pos = 10; @@ -270,28 +278,28 @@ long ifsquished(short i, short p) char squishme; long floorceildist; - if(PN == APLAYER && ud.clipping) + if (PN == APLAYER && ud.clipping) return 0; sc = §or[SECT]; floorceildist = sc->floorz - sc->ceilingz; - if(sc->lotag != 23) + if (sc->lotag != 23) { - if(sprite[i].pal == 1) + if (sprite[i].pal == 1) squishme = floorceildist < (32<<8) && (sc->lotag&32768) == 0; else squishme = floorceildist < (12<<8); // && (sc->lotag&32768) == 0; } else squishme = 0; - if( squishme ) + if ( squishme ) { FTA(10,&ps[p]); - if(badguy(&sprite[i])) sprite[i].xvel = 0; + if (badguy(&sprite[i])) sprite[i].xvel = 0; - if(sprite[i].pal == 1) + if (sprite[i].pal == 1) { hittype[i].picnum = SHOTSPARK1; hittype[i].extra = 1; @@ -315,9 +323,9 @@ void hitradius( short i, long r, long hp1, long hp2, long hp3, long hp4 ) s = &sprite[i]; - if(s->picnum == RPG && s->xrepeat < 11) goto SKIPWALLCHECK; + if (s->picnum == RPG && s->xrepeat < 11) goto SKIPWALLCHECK; - if(s->picnum != SHRINKSPARK) + if (s->picnum != SHRINKSPARK) { tempshort[0] = s->sectnum; dasect = s->sectnum; @@ -326,35 +334,35 @@ void hitradius( short i, long r, long hp1, long hp2, long hp3, long hp4 ) do { dasect = tempshort[sectcnt++]; - if(((sector[dasect].ceilingz-s->z)>>8) < r) + if (((sector[dasect].ceilingz-s->z)>>8) < r) { d = klabs(wall[sector[dasect].wallptr].x-s->x)+klabs(wall[sector[dasect].wallptr].y-s->y); - if(d < r) + if (d < r) checkhitceiling(dasect); else { d = klabs(wall[wall[wall[sector[dasect].wallptr].point2].point2].x-s->x)+klabs(wall[wall[wall[sector[dasect].wallptr].point2].point2].y-s->y); - if(d < r) + if (d < r) checkhitceiling(dasect); } } startwall = sector[dasect].wallptr; endwall = startwall+sector[dasect].wallnum; - for(x=startwall,wal=&wall[startwall];xx-s->x)+klabs(wal->y-s->y) ) < r) + 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; } x1 = (((wal->x+wall[wal->point2].x)>>1)+s->x)>>1; y1 = (((wal->y+wall[wal->point2].y)>>1)+s->y)>>1; updatesector(x1,y1,§); - if( sect >= 0 && cansee(x1,y1,s->z,sect,s->x,s->y,s->z,s->sectnum ) ) + if ( sect >= 0 && cansee(x1,y1,s->z,sect,s->x,s->y,s->z,s->sectnum ) ) checkhitwall(i,x,wal->x,wal->y,s->z,s->picnum); } } @@ -365,40 +373,40 @@ SKIPWALLCHECK: q = -(16<<8)+(TRAND&((32<<8)-1)); - for(x = 0;x<7;x++) + for (x = 0;x<7;x++) { j = headspritestat[statlist[x]]; - while(j >= 0) + while (j >= 0) { nextj = nextspritestat[j]; sj = &sprite[j]; - if( x == 0 || x >= 5 || AFLAMABLE(sj->picnum) ) + if ( x == 0 || x >= 5 || AFLAMABLE(sj->picnum) ) { - if( s->picnum != SHRINKSPARK || (sj->cstat&257) ) - if( dist( s, sj ) < r ) + if ( s->picnum != SHRINKSPARK || (sj->cstat&257) ) + if ( dist( s, sj ) < r ) { - if( badguy(sj) && !cansee( sj->x, sj->y,sj->z+q, sj->sectnum, s->x, s->y, s->z+q, s->sectnum) ) + if ( badguy(sj) && !cansee( sj->x, sj->y,sj->z+q, sj->sectnum, s->x, s->y, s->z+q, s->sectnum) ) goto BOLT; checkhitsprite( j, i ); } } - else if( sj->extra >= 0 && sj != s && ( sj->picnum == TRIPBOMB || badguy(sj) || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL || (sj->cstat&257) || sj->picnum == DUKELYINGDEAD ) ) + else if ( sj->extra >= 0 && sj != s && ( sj->picnum == TRIPBOMB || badguy(sj) || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL || (sj->cstat&257) || sj->picnum == DUKELYINGDEAD ) ) { - if( s->picnum == SHRINKSPARK && sj->picnum != SHARK && ( j == s->owner || sj->xrepeat < 24 ) ) + if ( s->picnum == SHRINKSPARK && sj->picnum != SHARK && ( j == s->owner || sj->xrepeat < 24 ) ) { j = nextj; continue; } - if( s->picnum == MORTER && j == s->owner) + if ( s->picnum == MORTER && j == s->owner) { j = nextj; continue; } - if(sj->picnum == APLAYER) sj->z -= PHEIGHT; + if (sj->picnum == APLAYER) sj->z -= PHEIGHT; d = dist( s, sj ); - if(sj->picnum == APLAYER) sj->z += PHEIGHT; + if (sj->picnum == APLAYER) sj->z += PHEIGHT; if ( d < r && cansee( sj->x, sj->y, sj->z-(8<<8), sj->sectnum, s->x, s->y, s->z-(12<<8), s->sectnum) ) { @@ -406,40 +414,40 @@ SKIPWALLCHECK: if ( s->picnum == RPG && sj->extra > 0) hittype[j].picnum = RPG; - else if(checkspriteflags(i,SPRITE_FLAG_PROJECTILE) && thisprojectile[i].workslike & PROJECTILE_FLAG_RADIUS_PICNUM && sj->extra > 0) + else if (checkspriteflags(i,SPRITE_FLAG_PROJECTILE) && thisprojectile[i].workslike & PROJECTILE_FLAG_RADIUS_PICNUM && sj->extra > 0) hittype[j].picnum = s->picnum; else { - if( s->picnum == SHRINKSPARK ) + if ( s->picnum == SHRINKSPARK ) hittype[j].picnum = SHRINKSPARK; else hittype[j].picnum = RADIUSEXPLOSION; } - if(s->picnum != SHRINKSPARK) + if (s->picnum != SHRINKSPARK) { if ( d < r/3 ) { - if(hp4 == hp3) hp4++; + if (hp4 == hp3) hp4++; hittype[j].extra = hp3 + (TRAND%(hp4-hp3)); } else if ( d < 2*r/3 ) { - if(hp3 == hp2) hp3++; + if (hp3 == hp2) hp3++; hittype[j].extra = hp2 + (TRAND%(hp3-hp2)); } else if ( d < r ) { - if(hp2 == hp1) hp2++; + if (hp2 == hp1) hp2++; hittype[j].extra = hp1 + (TRAND%(hp2-hp1)); } - if( sprite[j].picnum != TANK && sprite[j].picnum != ROTATEGUN && sprite[j].picnum != RECON && sprite[j].picnum != BOSS1 && sprite[j].picnum != BOSS2 && sprite[j].picnum != BOSS3 && sprite[j].picnum != BOSS4 ) + if ( sprite[j].picnum != TANK && sprite[j].picnum != ROTATEGUN && sprite[j].picnum != RECON && sprite[j].picnum != BOSS1 && sprite[j].picnum != BOSS2 && sprite[j].picnum != BOSS3 && sprite[j].picnum != BOSS4 ) { - if(sj->xvel < 0) sj->xvel = 0; + if (sj->xvel < 0) sj->xvel = 0; sj->xvel += (s->extra<<2); } - if( sj->picnum == PODFEM1 || sj->picnum == FEM1 || + if ( sj->picnum == PODFEM1 || sj->picnum == FEM1 || sj->picnum == FEM2 || sj->picnum == FEM3 || sj->picnum == FEM4 || sj->picnum == FEM5 || sj->picnum == FEM6 || sj->picnum == FEM7 || @@ -448,15 +456,15 @@ SKIPWALLCHECK: sj->picnum == STATUEFLASH || sj->picnum == SPACEMARINE || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL) checkhitsprite( j, i ); } - else if(s->extra == 0) hittype[j].extra = 0; + else if (s->extra == 0) hittype[j].extra = 0; if ( sj->picnum != RADIUSEXPLOSION && s->owner >= 0 && sprite[s->owner].statnum < MAXSTATUS ) { - if(sj->picnum == APLAYER) + if (sj->picnum == APLAYER) { p = sj->yvel; - if(ps[p].newowner >= 0) + if (ps[p].newowner >= 0) { ps[p].newowner = -1; ps[p].posx = ps[p].oposx; @@ -467,9 +475,9 @@ SKIPWALLCHECK: setpal(&ps[p]); k = headspritestat[1]; - while(k >= 0) + while (k >= 0) { - if(sprite[k].picnum==CAMERA1) + if (sprite[k].picnum==CAMERA1) sprite[k].yvel = 0; k = nextspritestat[k]; } @@ -493,12 +501,12 @@ int movesprite(short spritenum, long xchange, long ychange, long zchange, unsign bg = badguy(&sprite[spritenum]); - if(sprite[spritenum].statnum == 5 || (bg && sprite[spritenum].xrepeat < 4 ) ) + if (sprite[spritenum].statnum == 5 || (bg && sprite[spritenum].xrepeat < 4 ) ) { sprite[spritenum].x += (xchange*TICSPERFRAME)>>2; sprite[spritenum].y += (ychange*TICSPERFRAME)>>2; sprite[spritenum].z += (zchange*TICSPERFRAME)>>2; - if(bg) + if (bg) setsprite(spritenum,sprite[spritenum].x,sprite[spritenum].y,sprite[spritenum].z); return 0; } @@ -509,18 +517,18 @@ int movesprite(short spritenum, long xchange, long ychange, long zchange, unsign h = ((tilesizy[sprite[spritenum].picnum]*sprite[spritenum].yrepeat)<<1); daz -= h; - if( bg ) + if ( bg ) { oldx = sprite[spritenum].x; oldy = sprite[spritenum].y; - if( sprite[spritenum].xrepeat > 60 ) + if ( sprite[spritenum].xrepeat > 60 ) retval = clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype); else { - if(sprite[spritenum].picnum == LIZMAN) + if (sprite[spritenum].picnum == LIZMAN) cd = 292L; - else if( (actortype[sprite[spritenum].picnum]&3) ) + else if ( (actortype[sprite[spritenum].picnum]&3) ) cd = sprite[spritenum].clipdist<<2; else cd = 192L; @@ -528,29 +536,29 @@ int movesprite(short spritenum, long xchange, long ychange, long zchange, unsign retval = clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype); } - if( dasectnum < 0 || ( dasectnum >= 0 && - ( ( hittype[spritenum].actorstayput >= 0 && hittype[spritenum].actorstayput != dasectnum ) || - ( ( sprite[spritenum].picnum == BOSS2 ) && sprite[spritenum].pal == 0 && sector[dasectnum].lotag != 3 ) || - ( ( sprite[spritenum].picnum == BOSS1 || sprite[spritenum].picnum == BOSS2 ) && sector[dasectnum].lotag == 1 ) || - ( sector[dasectnum].lotag == 1 && ( sprite[spritenum].picnum == LIZMAN || ( sprite[spritenum].picnum == LIZTROOP && sprite[spritenum].zvel == 0 ) ) ) - ) ) - ) + if ( dasectnum < 0 || ( dasectnum >= 0 && + ( ( hittype[spritenum].actorstayput >= 0 && hittype[spritenum].actorstayput != dasectnum ) || + ( ( sprite[spritenum].picnum == BOSS2 ) && sprite[spritenum].pal == 0 && sector[dasectnum].lotag != 3 ) || + ( ( sprite[spritenum].picnum == BOSS1 || sprite[spritenum].picnum == BOSS2 ) && sector[dasectnum].lotag == 1 ) || + ( sector[dasectnum].lotag == 1 && ( sprite[spritenum].picnum == LIZMAN || ( sprite[spritenum].picnum == LIZTROOP && sprite[spritenum].zvel == 0 ) ) ) + ) ) + ) { sprite[spritenum].x = oldx; sprite[spritenum].y = oldy; - if(sector[dasectnum].lotag == 1 && sprite[spritenum].picnum == LIZMAN) + if (sector[dasectnum].lotag == 1 && sprite[spritenum].picnum == LIZMAN) sprite[spritenum].ang = (TRAND&2047); - else if( (hittype[spritenum].temp_data[0]&3) == 1 && sprite[spritenum].picnum != COMMANDER ) + else if ( (hittype[spritenum].temp_data[0]&3) == 1 && sprite[spritenum].picnum != COMMANDER ) sprite[spritenum].ang = (TRAND&2047); setsprite(spritenum,oldx,oldy,sprite[spritenum].z); - if(dasectnum < 0) dasectnum = 0; + if (dasectnum < 0) dasectnum = 0; return (16384+dasectnum); } - if( (retval&49152) >= 32768 && (hittype[spritenum].cgg==0) ) sprite[spritenum].ang += 768; + if ( (retval&49152) >= 32768 && (hittype[spritenum].cgg==0) ) sprite[spritenum].ang += 768; } else { - if(sprite[spritenum].statnum == 4) + if (sprite[spritenum].statnum == 4) retval = clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype); else @@ -558,7 +566,7 @@ int movesprite(short spritenum, long xchange, long ychange, long zchange, unsign clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),(long)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype); } - if( dasectnum >= 0) + if ( dasectnum >= 0) if ( (dasectnum != sprite[spritenum].sectnum) ) changespritesect(spritenum,dasectnum); daz = sprite[spritenum].z + ((zchange*TICSPERFRAME)>>3); @@ -588,9 +596,9 @@ short ssp(short i,unsigned long cliptype) //The set sprite function void insertspriteq(short i) { - if(spriteqamount > 0) + if (spriteqamount > 0) { - if(spriteq[spriteqloc] >= 0) + if (spriteq[spriteqloc] >= 0) sprite[spriteq[spriteqloc]].xrepeat = 0; spriteq[spriteqloc] = i; spriteqloc = (spriteqloc+1)%spriteqamount; @@ -602,7 +610,7 @@ void insertspriteq(short i) void lotsofmoney(spritetype *s, short n) { short i ,j; - for(i=n;i>0;i--) + for (i=n;i>0;i--) { j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),MONEY,-32,8,8,TRAND&2047,0,0,0,5); sprite[j].cstat = TRAND&12; @@ -612,7 +620,7 @@ void lotsofmoney(spritetype *s, short n) void lotsofmail(spritetype *s, short n) { short i ,j; - for(i=n;i>0;i--) + for (i=n;i>0;i--) { j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),MAIL,-32,8,8,TRAND&2047,0,0,0,5); sprite[j].cstat = TRAND&12; @@ -622,7 +630,7 @@ void lotsofmail(spritetype *s, short n) void lotsofpaper(spritetype *s, short n) { short i ,j; - for(i=n;i>0;i--) + for (i=n;i>0;i--) { j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),PAPER,-32,8,8,TRAND&2047,0,0,0,5); sprite[j].cstat = TRAND&12; @@ -636,33 +644,33 @@ void guts(spritetype *s,short gtype, short n, short p) char sx,sy; signed char pal; - if(badguy(s) && s->xrepeat < 16) + if (badguy(s) && s->xrepeat < 16) sx = sy = 8; else sx = sy = 32; gutz = s->z-(8<<8); floorz = getflorzofslope(s->sectnum,s->x,s->y); - if( gutz > ( floorz-(8<<8) ) ) + if ( gutz > ( floorz-(8<<8) ) ) gutz = floorz-(8<<8); - if(s->picnum == COMMANDER) + if (s->picnum == COMMANDER) gutz -= (24<<8); - if( badguy(s) && s->pal == 6) + if ( badguy(s) && s->pal == 6) pal = 6; else pal = 0; - for(j=0;jsectnum,s->x+(TRAND&255)-128,s->y+(TRAND&255)-128,gutz-(TRAND&8191),gtype,-32,sx,sy,a,48+(TRAND&31),-512-(TRAND&2047),ps[p].i,5); - if(PN == JIBS2) + if (PN == JIBS2) { sprite[i].xrepeat >>= 2; sprite[i].yrepeat >>= 2; } - if(pal == 6) + if (pal == 6) sprite[i].pal = 6; } } @@ -673,20 +681,20 @@ void gutsdir(spritetype *s,short gtype, short n, short p) short i,a,j; char sx,sy; - if(badguy(s) && s->xrepeat < 16) + if (badguy(s) && s->xrepeat < 16) sx = sy = 8; else sx = sy = 32; gutz = s->z-(8<<8); floorz = getflorzofslope(s->sectnum,s->x,s->y); - if( gutz > ( floorz-(8<<8) ) ) + if ( gutz > ( floorz-(8<<8) ) ) gutz = floorz-(8<<8); - if(s->picnum == COMMANDER) + if (s->picnum == COMMANDER) gutz -= (24<<8); - for(j=0;jsectnum,s->x,s->y,gutz,gtype,-32,sx,sy,a,256+(TRAND&127),-512-(TRAND&2047),ps[p].i,5); @@ -700,12 +708,12 @@ void setsectinterpolate(short i) startwall = sector[SECT].wallptr; endwall = startwall+sector[SECT].wallnum; - for(j=startwall;j= 0) + if (k >= 0) { setinterpolation(&wall[k].x); setinterpolation(&wall[k].y); @@ -722,11 +730,11 @@ void clearsectinterpolate(short i) startwall = sector[SECT].wallptr; endwall = startwall+sector[SECT].wallnum; - for(j=startwall;j= 0) + if (wall[j].nextwall >= 0) { stopinterpolation(&wall[wall[j].nextwall].x); stopinterpolation(&wall[wall[j].nextwall].y); @@ -752,7 +760,7 @@ void ms(short i) startwall = sector[s->sectnum].wallptr; endwall = startwall+sector[s->sectnum].wallnum; - for(x=startwall;x= 0) + while (i >= 0) { nexti = nextspritestat[i]; @@ -781,19 +789,19 @@ void movefta(void) ssect = psect = s->sectnum; - if(sprite[ps[p].i].extra > 0 ) + if (sprite[ps[p].i].extra > 0 ) { - if( x < 30000 ) + if ( x < 30000 ) { hittype[i].timetosleep++; - if( hittype[i].timetosleep >= (x>>8) ) + if ( hittype[i].timetosleep >= (x>>8) ) { - if(badguy(s)) + if (badguy(s)) { px = ps[p].oposx+64-(TRAND&127); py = ps[p].oposy+64-(TRAND&127); updatesector(px,py,&psect); - if(psect == -1) + if (psect == -1) { i = nexti; continue; @@ -801,7 +809,7 @@ void movefta(void) sx = s->x+64-(TRAND&127); sy = s->y+64-(TRAND&127); updatesector(px,py,&ssect); - if(ssect == -1) + if (ssect == -1) { i = nexti; continue; @@ -813,7 +821,7 @@ void movefta(void) // j = 1; - if(j) switch(dynamictostatic[s->picnum]) + if (j) switch (dynamictostatic[s->picnum]) { case RUBBERCAN__STATIC: case EXPLODINGBARREL__STATIC: @@ -845,7 +853,7 @@ void movefta(void) else hittype[i].timetosleep = 0; } } - if( badguy( s ) && checkspriteflags(i,SPRITE_FLAG_NOSHADE) == 0) + if ( badguy( s ) && checkspriteflags(i,SPRITE_FLAG_NOSHADE) == 0) { if (sector[s->sectnum].ceilingstat&1) s->shade = sector[s->sectnum].ceilingshade; @@ -861,9 +869,9 @@ short ifhitsectors(short sectnum) short i; i = headspritestat[5]; - while(i >= 0) + while (i >= 0) { - if( PN == EXPLOSION2 && sectnum == SECT ) + if ( PN == EXPLOSION2 && sectnum == SECT ) return i; i = nextspritestat[i]; } @@ -875,26 +883,26 @@ short ifhitbyweapon(short sn) short j,p; spritetype *npc; - if( hittype[sn].extra >= 0 ) + if ( hittype[sn].extra >= 0 ) { - if(sprite[sn].extra >= 0 ) + if (sprite[sn].extra >= 0 ) { npc = &sprite[sn]; - if(npc->picnum == APLAYER) + if (npc->picnum == APLAYER) { - if(ud.god && hittype[sn].picnum != SHRINKSPARK ) return -1; + if (ud.god && hittype[sn].picnum != SHRINKSPARK ) return -1; p = npc->yvel; j = hittype[sn].owner; - if( j >= 0 && + if ( j >= 0 && sprite[j].picnum == APLAYER && (gametype_flags[ud.coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && ud.ffire == 0 ) return -1; - if( j >= 0 && + if ( j >= 0 && sprite[j].picnum == APLAYER && (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) && ps[p].team == ps[sprite[j].yvel].team && @@ -903,29 +911,29 @@ short ifhitbyweapon(short sn) npc->extra -= hittype[sn].extra; - if(j >= 0) + if (j >= 0) { - if(npc->extra <= 0 && hittype[sn].picnum != FREEZEBLAST) + if (npc->extra <= 0 && hittype[sn].picnum != FREEZEBLAST) { npc->extra = 0; ps[p].wackedbyactor = j; - if( sprite[hittype[sn].owner].picnum == APLAYER && p != sprite[hittype[sn].owner].yvel ) + if ( sprite[hittype[sn].owner].picnum == APLAYER && p != sprite[hittype[sn].owner].yvel ) ps[p].frag_ps = sprite[j].yvel; hittype[sn].owner = ps[p].i; } } - if(checkspriteflagsp(hittype[sn].picnum,SPRITE_FLAG_PROJECTILE) && (thisprojectile[sn].workslike & PROJECTILE_FLAG_RPG)) + if (checkspriteflagsp(hittype[sn].picnum,SPRITE_FLAG_PROJECTILE) && (thisprojectile[sn].workslike & PROJECTILE_FLAG_RPG)) { ps[p].posxv += hittype[sn].extra*(sintable[(hittype[sn].ang+512)&2047])<<2; ps[p].posyv += hittype[sn].extra*(sintable[hittype[sn].ang&2047])<<2; } - else if(checkspriteflagsp(hittype[sn].picnum,SPRITE_FLAG_PROJECTILE)) + else if (checkspriteflagsp(hittype[sn].picnum,SPRITE_FLAG_PROJECTILE)) { ps[p].posxv += hittype[sn].extra*(sintable[(hittype[sn].ang+512)&2047])<<1; @@ -933,7 +941,7 @@ short ifhitbyweapon(short sn) hittype[sn].extra*(sintable[hittype[sn].ang&2047])<<1; } - switch(dynamictostatic[hittype[sn].picnum]) + switch (dynamictostatic[hittype[sn].picnum]) { case RADIUSEXPLOSION__STATIC: case RPG__STATIC: @@ -957,12 +965,12 @@ short ifhitbyweapon(short sn) } else { - if(hittype[sn].extra == 0 ) - if( hittype[sn].picnum == SHRINKSPARK && npc->xrepeat < 24 ) + if (hittype[sn].extra == 0 ) + if ( hittype[sn].picnum == SHRINKSPARK && npc->xrepeat < 24 ) return -1; npc->extra -= hittype[sn].extra; - if(npc->picnum != RECON && npc->owner >= 0 && sprite[npc->owner].statnum < MAXSTATUS ) + if (npc->picnum != RECON && npc->owner >= 0 && sprite[npc->owner].statnum < MAXSTATUS ) npc->owner = hittype[sn].owner; } @@ -981,7 +989,7 @@ void movecyclers(void) walltype *wal; char cshade; - for(q=numcyclers-1;q>=0;q--) + for (q=numcyclers-1;q>=0;q--) { c = &cyclers[q][0]; @@ -991,19 +999,19 @@ void movecyclers(void) j = t+(sintable[c[1]&2047]>>10); cshade = c[2]; - if( j < cshade ) j = cshade; - else if( j > t ) j = t; + if ( j < cshade ) j = cshade; + else if ( j > t ) j = t; c[1] += sector[s].extra; - if(c[5]) + if (c[5]) { wal = &wall[sector[s].wallptr]; - for(x = sector[s].wallnum;x>0;x--,wal++) - if( wal->hitag != 1 ) + for (x = sector[s].wallnum;x>0;x--,wal++) + if ( wal->hitag != 1 ) { wal->shade = j; - if( (wal->cstat&2) && wal->nextwall >= 0) + if ( (wal->cstat&2) && wal->nextwall >= 0) wall[wal->nextwall].shade = j; } @@ -1017,31 +1025,31 @@ void movedummyplayers(void) short i, p, nexti; i = headspritestat[13]; - while(i >= 0) + while (i >= 0) { nexti = nextspritestat[i]; p = sprite[OW].yvel; - if( ps[p].on_crane >= 0 || sector[ps[p].cursectnum].lotag != 1 || sprite[ps[p].i].extra <= 0 ) + if ( ps[p].on_crane >= 0 || sector[ps[p].cursectnum].lotag != 1 || sprite[ps[p].i].extra <= 0 ) { ps[p].dummyplayersprite = -1; KILLIT(i); } else { - if(ps[p].on_ground && ps[p].on_warping_sector == 1 && sector[ps[p].cursectnum].lotag == 1 ) + if (ps[p].on_ground && ps[p].on_warping_sector == 1 && sector[ps[p].cursectnum].lotag == 1 ) { CS = 257; SZ = sector[SECT].ceilingz+(27<<8); SA = ps[p].ang; - if(T1 == 8) + if (T1 == 8) T1 = 0; else T1++; } else { - if(sector[SECT].lotag != 2) SZ = sector[SECT].floorz; + if (sector[SECT].lotag != 2) SZ = sector[SECT].floorz; CS = (short) 32768; } } @@ -1065,15 +1073,15 @@ void moveplayers(void) //Players struct player_struct *p; i = headspritestat[10]; - while(i >= 0) + while (i >= 0) { nexti = nextspritestat[i]; s = &sprite[i]; p = &ps[s->yvel]; - if(s->owner >= 0) + if (s->owner >= 0) { - if(p->newowner >= 0 ) //Looking thru the camera + if (p->newowner >= 0 ) //Looking thru the camera { s->x = p->oposx; s->y = p->oposy; @@ -1083,7 +1091,7 @@ void moveplayers(void) //Players } else { - if(ud.multimode > 1) + if (ud.multimode > 1) otherp = findotherplayer(s->yvel,&otherx); else { @@ -1093,12 +1101,12 @@ void moveplayers(void) //Players execute(i,s->yvel,otherx); - if(ud.multimode > 1) - if( sprite[ps[otherp].i].extra > 0 ) + if (ud.multimode > 1) + if ( sprite[ps[otherp].i].extra > 0 ) { - if( s->yrepeat > 32 && sprite[ps[otherp].i].yrepeat < 32) + if ( s->yrepeat > 32 && sprite[ps[otherp].i].yrepeat < 32) { - if( otherx < 1400 && p->knee_incs == 0 ) + if ( otherx < 1400 && p->knee_incs == 0 ) { p->knee_incs = 1; p->weapon_pos = -1; @@ -1106,7 +1114,7 @@ void moveplayers(void) //Players } } } - if(ud.god) + if (ud.god) { s->extra = max_player_health; s->cstat = 257; @@ -1114,12 +1122,12 @@ void moveplayers(void) //Players } - if( s->extra > 0 ) + if ( s->extra > 0 ) { hittype[i].owner = i; - if(ud.god == 0) - if( ceilingspace(s->sectnum) || floorspace(s->sectnum) ) + if (ud.god == 0) + if ( ceilingspace(s->sectnum) || floorspace(s->sectnum) ) quickkill(p); } else @@ -1131,7 +1139,7 @@ void moveplayers(void) //Players p->newowner = -1; - if( p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS ) + if ( p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS ) { p->ang += getincangle(p->ang,getangle(sprite[p->wackedbyactor].x-p->posx,sprite[p->wackedbyactor].y-p->posy))>>1; p->ang &= 2047; @@ -1143,7 +1151,7 @@ void moveplayers(void) //Players } else { - if(p->holoduke_on == -1) + if (p->holoduke_on == -1) KILLIT(i); hittype[i].bposx = s->x; @@ -1152,24 +1160,24 @@ void moveplayers(void) //Players s->cstat = 0; - if(s->xrepeat < 42) + if (s->xrepeat < 42) { s->xrepeat += 4; s->cstat |= 2; } else s->xrepeat = 42; - if(s->yrepeat < 36) + if (s->yrepeat < 36) s->yrepeat += 4; else { s->yrepeat = 36; - if(sector[s->sectnum].lotag != 2) + if (sector[s->sectnum].lotag != 2) makeitfall(i); - if(s->zvel == 0 && sector[s->sectnum].lotag == 1) + if (s->zvel == 0 && sector[s->sectnum].lotag == 1) s->z += (32<<8); } - if(s->extra < 8) + if (s->extra < 8) { s->xvel = 128; s->ang = p->ang; @@ -1200,22 +1208,22 @@ void movefx(void) spritetype *s; i = headspritestat[11]; - while(i >= 0) + while (i >= 0) { s = &sprite[i]; nexti = nextspritestat[i]; - switch(dynamictostatic[s->picnum]) + switch (dynamictostatic[s->picnum]) { case RESPAWN__STATIC: - if(sprite[i].extra == 66) + if (sprite[i].extra == 66) { j = spawn(i,SHT); // sprite[j].pal = sprite[i].pal; KILLIT(i); } - else if(sprite[i].extra > (66-13)) + else if (sprite[i].extra > (66-13)) sprite[i].extra++; break; @@ -1223,62 +1231,62 @@ void movefx(void) ht = s->hitag; - if(T2 != SoundToggle) + if (T2 != SoundToggle) { T2 = SoundToggle; T1 = 0; } - if(s->lotag >= 1000 && s->lotag < 2000) + if (s->lotag >= 1000 && s->lotag < 2000) { x = ldist(&sprite[ps[screenpeek].i],s); - if( x < ht && T1 == 0 ) + if ( x < ht && T1 == 0 ) { FX_SetReverb( s->lotag - 1000 ); T1 = 1; } - if( x >= ht && T1 == 1 ) + if ( x >= ht && T1 == 1 ) { FX_SetReverb(0); FX_SetReverbDelay(0); T1 = 0; } } - else if(s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz) + else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz) { - if( (soundm[s->lotag]&2) ) + if ( (soundm[s->lotag]&2) ) { x = dist(&sprite[ps[screenpeek].i],s); - if( x < ht && T1 == 0 && FX_VoiceAvailable(soundpr[s->lotag]-1) ) + if ( x < ht && T1 == 0 && FX_VoiceAvailable(soundpr[s->lotag]-1) ) { - if(numenvsnds == NumVoices) + if (numenvsnds == NumVoices) { j = headspritestat[11]; - while(j >= 0) + while (j >= 0) { - if( PN == MUSICANDSFX && j != i && sprite[j].lotag < 999 && hittype[j].temp_data[0] == 1 && dist(&sprite[j],&sprite[ps[screenpeek].i]) > x ) + if ( PN == MUSICANDSFX && j != i && sprite[j].lotag < 999 && hittype[j].temp_data[0] == 1 && dist(&sprite[j],&sprite[ps[screenpeek].i]) > x ) { stopenvsound(sprite[j].lotag,j); break; } j = nextspritestat[j]; } - if(j == -1) goto BOLT; + if (j == -1) goto BOLT; } spritesound(s->lotag,i); T1 = 1; } - if( x >= ht && T1 == 1 ) + if ( x >= ht && T1 == 1 ) { T1 = 0; stopenvsound(s->lotag,i); } } - if( (soundm[s->lotag]&16) ) + if ( (soundm[s->lotag]&16) ) { - if(T5 > 0) T5--; - else for(p=connecthead;p>=0;p=connectpoint2[p]) - if( p == myconnectindex && ps[p].cursectnum == s->sectnum ) + if (T5 > 0) T5--; + else for (p=connecthead;p>=0;p=connectpoint2[p]) + if ( p == myconnectindex && ps[p].cursectnum == s->sectnum ) { j = s->lotag+((unsigned)global_random%(s->hitag+1)); sound(j); @@ -1300,33 +1308,33 @@ void movefallers(void) long x; i = headspritestat[12]; - while(i >= 0) + while (i >= 0) { nexti = nextspritestat[i]; s = &sprite[i]; sect = s->sectnum; - if( T1 == 0 ) + if ( T1 == 0 ) { s->z -= (16<<8); T2 = s->ang; x = s->extra; IFHIT { - if( j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER ) + if ( j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER ) { - if(s->extra <= 0) + if (s->extra <= 0) { T1 = 1; j = headspritestat[12]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].hitag == SHT) + if (sprite[j].hitag == SHT) { hittype[j].temp_data[0] = 1; sprite[j].cstat &= (65535-64); - if(sprite[j].picnum == CEILINGSTEAM || sprite[j].picnum == STEAM) + if (sprite[j].picnum == CEILINGSTEAM || sprite[j].picnum == STEAM) sprite[j].cstat |= 32768; } j = nextspritestat[j]; @@ -1342,12 +1350,12 @@ void movefallers(void) s->ang = T2; s->z += (16<<8); } - else if(T1 == 1) + else if (T1 == 1) { - if(s->lotag > 0) + if (s->lotag > 0) { s->lotag-=3; - if(s->lotag <= 0) + if (s->lotag <= 0) { s->xvel = (32+(TRAND&63)); s->zvel = -(1024+(TRAND&1023)); @@ -1355,32 +1363,32 @@ void movefallers(void) } else { - if( s->xvel > 0) + if ( s->xvel > 0) { s->xvel -= 8; ssp(i,CLIPMASK0); } - if( floorspace(s->sectnum) ) x = 0; + if ( floorspace(s->sectnum) ) x = 0; else { - if(ceilingspace(s->sectnum)) + if (ceilingspace(s->sectnum)) x = gc/6; else x = gc; } - if( s->z < (sector[sect].floorz-FOURSLEIGHT) ) + if ( s->z < (sector[sect].floorz-FOURSLEIGHT) ) { s->zvel += x; - if(s->zvel > 6144) + if (s->zvel > 6144) s->zvel = 6144; s->z += s->zvel; } - if( (sector[sect].floorz-s->z) < (16<<8) ) + if ( (sector[sect].floorz-s->z) < (16<<8) ) { j = 1+(TRAND&7); - for(x=0;x= 0) + while (i >= 0) { nexti = nextspritestat[i]; @@ -1407,7 +1415,7 @@ void movestandables(void) s = &sprite[i]; sect = s->sectnum; - if( sect < 0 ) KILLIT(i); + if ( sect < 0 ) KILLIT(i); hittype[i].bposx = s->x; hittype[i].bposy = s->y; @@ -1418,15 +1426,15 @@ void movestandables(void) //t[0] = state //t[1] = checking sector number - if(s->xvel) getglobalz(i); + if (s->xvel) getglobalz(i); - if( t[0] == 0 ) //Waiting to check the sector + if ( t[0] == 0 ) //Waiting to check the sector { j = headspritesect[t[1]]; - while(j>=0) + while (j>=0) { nextj = nextspritesect[j]; - switch( sprite[j].statnum ) + switch ( sprite[j].statnum ) { case 1: case 2: @@ -1441,41 +1449,41 @@ void movestandables(void) } } - else if(t[0]==1) + else if (t[0]==1) { - if( s->xvel < 184 ) + if ( s->xvel < 184 ) { s->picnum = CRANE+1; s->xvel += 8; } ssp(i,CLIPMASK0); - if(sect == t[1]) + if (sect == t[1]) t[0]++; } - else if(t[0]==2 || t[0]==7) + else if (t[0]==2 || t[0]==7) { s->z += (1024+512); - if(t[0]==2) + if (t[0]==2) { - if( (sector[sect].floorz - s->z) < (64<<8) ) - if(s->picnum > CRANE) s->picnum--; + if ( (sector[sect].floorz - s->z) < (64<<8) ) + if (s->picnum > CRANE) s->picnum--; - if( (sector[sect].floorz - s->z) < (4096+1024)) + if ( (sector[sect].floorz - s->z) < (4096+1024)) t[0]++; } - if(t[0]==7) + if (t[0]==7) { - if( (sector[sect].floorz - s->z) < (64<<8) ) + if ( (sector[sect].floorz - s->z) < (64<<8) ) { - if(s->picnum > CRANE) s->picnum--; + if (s->picnum > CRANE) s->picnum--; else { - if(s->owner==-2) + if (s->owner==-2) { spritesound(DUKE_GRUNT,ps[p].i); p = findplayer(s,&x); - if(ps[p].on_crane == i) + if (ps[p].on_crane == i) ps[p].on_crane = -1; } t[0]++; @@ -1484,13 +1492,13 @@ void movestandables(void) } } } - else if(t[0]==3) + else if (t[0]==3) { s->picnum++; - if( s->picnum == (CRANE+2) ) + if ( s->picnum == (CRANE+2) ) { p = checkcursectnums(t[1]); - if(p >= 0 && ps[p].on_ground) + if (p >= 0 && ps[p].on_ground) { s->owner = -2; ps[p].on_crane = i; @@ -1500,9 +1508,9 @@ void movestandables(void) else { j = headspritesect[t[1]]; - while(j>=0) + while (j>=0) { - switch( sprite[j].statnum ) + switch ( sprite[j].statnum ) { case 1: case 6: @@ -1518,19 +1526,19 @@ void movestandables(void) goto BOLT; } } - else if(t[0]==4) //Delay before going up + else if (t[0]==4) //Delay before going up { t[2]++; - if(t[2] > 10) + if (t[2] > 10) t[0]++; } - else if(t[0]==5 || t[0] == 8) + else if (t[0]==5 || t[0] == 8) { - if(t[0]==8 && s->picnum < (CRANE+2)) - if( (sector[sect].floorz-s->z) > 8192) + if (t[0]==8 && s->picnum < (CRANE+2)) + if ( (sector[sect].floorz-s->z) > 8192) s->picnum++; - if(s->z < msx[t[4]+2]) + if (s->z < msx[t[4]+2]) { t[0]++; s->xvel = 0; @@ -1538,36 +1546,36 @@ void movestandables(void) else s->z -= (1024+512); } - else if(t[0]==6) + else if (t[0]==6) { - if( s->xvel < 192 ) + if ( s->xvel < 192 ) s->xvel += 8; s->ang = getangle(msx[t[4]]-s->x,msy[t[4]]-s->y); ssp(i,CLIPMASK0); - if( ((s->x-msx[t[4]])*(s->x-msx[t[4]])+(s->y-msy[t[4]])*(s->y-msy[t[4]]) ) < (128*128) ) + if ( ((s->x-msx[t[4]])*(s->x-msx[t[4]])+(s->y-msy[t[4]])*(s->y-msy[t[4]]) ) < (128*128) ) t[0]++; } - else if(t[0]==9) + else if (t[0]==9) t[0] = 0; setsprite(msy[t[4]+2],s->x,s->y,s->z-(34<<8)); - if(s->owner != -1) + if (s->owner != -1) { p = findplayer(s,&x); IFHIT { - if(s->owner == -2) - if(ps[p].on_crane == i) + if (s->owner == -2) + if (ps[p].on_crane == i) ps[p].on_crane = -1; s->owner = -1; s->picnum = CRANE; goto BOLT; } - if(s->owner >= 0) + if (s->owner >= 0) { setsprite(s->owner,s->x,s->y,s->z); @@ -1577,7 +1585,7 @@ void movestandables(void) s->zvel = 0; } - else if(s->owner == -2) + else if (s->owner == -2) { ps[p].oposx = ps[p].posx = s->x-(sintable[(ps[p].ang+512)&2047]>>6); ps[p].oposy = ps[p].posy = s->y-(sintable[ps[p].ang&2047]>>6); @@ -1592,22 +1600,22 @@ void movestandables(void) IFWITHIN(WATERFOUNTAIN,WATERFOUNTAIN+3) { - if(t[0] > 0) + if (t[0] > 0) { - if( t[0] < 20 ) + if ( t[0] < 20 ) { t[0]++; s->picnum++; - if( s->picnum == ( WATERFOUNTAIN+3 ) ) + if ( s->picnum == ( WATERFOUNTAIN+3 ) ) s->picnum = WATERFOUNTAIN+1; } else { p = findplayer(s,&x); - if(x > 512) + if (x > 512) { t[0] = 0; s->picnum = WATERFOUNTAIN; @@ -1618,14 +1626,14 @@ void movestandables(void) goto BOLT; } - if( AFLAMABLE(s->picnum) ) + if ( AFLAMABLE(s->picnum) ) { - if(T1 == 1) + if (T1 == 1) { T2++; - if( (T2&3) > 0) goto BOLT; + if ( (T2&3) > 0) goto BOLT; - if( s->picnum == TIRE && T2 == 32 ) + if ( s->picnum == TIRE && T2 == 32 ) { s->cstat = 0; j = spawn(i,BLOODPOOL); @@ -1633,12 +1641,12 @@ void movestandables(void) } else { - if(s->shade < 64) s->shade++; + if (s->shade < 64) s->shade++; else KILLIT(i); } j = s->xrepeat-(TRAND&7); - if(j < 10) + if (j < 10) { KILLIT(i); } @@ -1646,10 +1654,10 @@ void movestandables(void) s->xrepeat = j; j = s->yrepeat-(TRAND&7); - if(j < 4) { KILLIT(i); } + if (j < 4) { KILLIT(i); } s->yrepeat = j; } - if(s->picnum == BOX) + if (s->picnum == BOX) { makeitfall(i); hittype[i].ceilingz = sector[s->sectnum].ceilingz; @@ -1657,19 +1665,19 @@ void movestandables(void) goto BOLT; } - if(s->picnum == TRIPBOMB) + if (s->picnum == TRIPBOMB) { // long lTripBombControl=GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, -1, -1); // if(lTripBombControl & TRIPBOMB_TIMER) if (hittype[i].temp_data[6] == 1) { - if(hittype[i].temp_data[7] >= 1) + if (hittype[i].temp_data[7] >= 1) { hittype[i].temp_data[7]--; } - if(hittype[i].temp_data[7] <= 0) + if (hittype[i].temp_data[7] <= 0) { // s->extra = *actorscrptr[s->picnum]; T3=16; @@ -1678,13 +1686,13 @@ void movestandables(void) } // we're on a timer.... } - if(T3 > 0 && hittype[i].temp_data[6] == 3) + if (T3 > 0 && hittype[i].temp_data[6] == 3) { T3--; - if(T3 == 8) + if (T3 == 8) { spritesound(LASERTRIP_EXPLODE,i); - for(j=0;j<5;j++) RANDOMSCRAP; + for (j=0;j<5;j++) RANDOMSCRAP; x = s->extra; hitradius( i, tripbombblastradius, x>>2,x>>1,x-(x>>2),x); @@ -1694,9 +1702,9 @@ void movestandables(void) ssp(j,CLIPMASK0); j = headspritestat[5]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == LASERLINE && s->hitag == sprite[j].hitag) + if (sprite[j].picnum == LASERLINE && s->hitag == sprite[j].hitag) sprite[j].xrepeat = sprite[j].yrepeat = 0; j = nextspritestat[j]; } @@ -1714,13 +1722,13 @@ void movestandables(void) s->ang = l; } - if( T1 < 32 ) + if ( T1 < 32 ) { p = findplayer(s,&x); - if( x > 768 ) T1++; - else if(T1 > 16) T1++; + if ( x > 768 ) T1++; + else if (T1 > 16) T1++; } - if( T1 == 32 ) + if ( T1 == 32 ) { l = s->ang; s->ang = T6; @@ -1744,7 +1752,7 @@ void movestandables(void) { // we're on a trip wire - while(x > 0) + while (x > 0) { j = spawn(i,LASERLINE); setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z); @@ -1754,7 +1762,7 @@ void movestandables(void) s->x += sintable[(T6+512)&2047]>>4; s->y += sintable[(T6)&2047]>>4; - if( x < 1024 ) + if ( x < 1024 ) { sprite[j].xrepeat = x>>5; break; @@ -1776,7 +1784,7 @@ void movestandables(void) } else T3 = 0; } - if(T1 == 33) + if (T1 == 33) { T2++; @@ -1794,7 +1802,7 @@ void movestandables(void) setsprite(i,s->x,s->y,s->z); // if( hittype[i].lastvx != x && lTripBombControl & TRIPBOMB_TRIPWIRE) - if( hittype[i].lastvx != x && hittype[i].temp_data[6] != 1) + if ( hittype[i].lastvx != x && hittype[i].temp_data[6] != 1) { hittype[i].temp_data[6] = 3; T3 = 13; @@ -1805,20 +1813,20 @@ void movestandables(void) } - if( s->picnum >= CRACK1 && s->picnum <= CRACK4 ) + if ( s->picnum >= CRACK1 && s->picnum <= CRACK4 ) { - if(s->hitag > 0) + if (s->hitag > 0) { t[0] = s->cstat; t[1] = s->ang; j = ifhitbyweapon(i); - if(j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER ) + if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER ) { j = headspritestat[6]; - while(j >= 0) + while (j >= 0) { - if(s->hitag == sprite[j].hitag && ( sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE ) ) - if(sprite[j].shade != -32) + if (s->hitag == sprite[j].hitag && ( sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE ) ) + if (sprite[j].shade != -32) sprite[j].shade = -32; j = nextspritestat[j]; } @@ -1835,12 +1843,12 @@ void movestandables(void) goto BOLT; } - if( s->picnum == FIREEXT ) + if ( s->picnum == FIREEXT ) { j = ifhitbyweapon(i); - if( j == -1 ) goto BOLT; + if ( j == -1 ) goto BOLT; - for(k=0;k<16;k++) + for (k=0;k<16;k++) { j = EGS(SECT,SX,SY,SZ-(TRAND%(48<<8)),SCRAP3+(TRAND&3),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(sprite[i].zvel>>2),i,5); sprite[j].pal = 2; @@ -1850,13 +1858,13 @@ void movestandables(void) spritesound(PIPEBOMB_EXPLODE,i); spritesound(GLASS_HEAVYBREAK,i); - if(s->hitag > 0) + if (s->hitag > 0) { j = headspritestat[6]; - while(j >= 0) + while (j >= 0) { - if(s->hitag == sprite[j].hitag && ( sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE ) ) - if(sprite[j].shade != -32) + if (s->hitag == sprite[j].hitag && ( sprite[j].picnum == OOZFILTER || sprite[j].picnum == SEENINE ) ) + if (sprite[j].shade != -32) sprite[j].shade = -32; j = nextspritestat[j]; } @@ -1876,25 +1884,25 @@ void movestandables(void) goto BOLT; } - if(s->picnum == OOZFILTER || s->picnum == SEENINE || s->picnum == SEENINEDEAD || s->picnum == (SEENINEDEAD+1) ) + if (s->picnum == OOZFILTER || s->picnum == SEENINE || s->picnum == SEENINEDEAD || s->picnum == (SEENINEDEAD+1) ) { - if(s->shade != -32 && s->shade != -33) + if (s->shade != -32 && s->shade != -33) { - if(s->xrepeat) + if (s->xrepeat) j = (ifhitbyweapon(i) >= 0); else j = 0; - if( j || s->shade == -31 ) + if ( j || s->shade == -31 ) { - if(j) s->lotag = 0; + if (j) s->lotag = 0; t[3] = 1; j = headspritestat[6]; - while(j >= 0) + while (j >= 0) { - if(s->hitag == sprite[j].hitag && ( sprite[j].picnum == SEENINE || sprite[j].picnum == OOZFILTER ) ) + if (s->hitag == sprite[j].hitag && ( sprite[j].picnum == SEENINE || sprite[j].picnum == OOZFILTER ) ) sprite[j].shade = -32; j = nextspritestat[j]; } @@ -1902,34 +1910,34 @@ void movestandables(void) } else { - if(s->shade == -32) + if (s->shade == -32) { - if(s->lotag > 0) + if (s->lotag > 0) { s->lotag-=3; - if(s->lotag <= 0) s->lotag = -99; + if (s->lotag <= 0) s->lotag = -99; } else s->shade = -33; } else { - if( s->xrepeat > 0 ) + if ( s->xrepeat > 0 ) { T3++; - if(T3 == 3) + if (T3 == 3) { - if( s->picnum == OOZFILTER ) + if ( s->picnum == OOZFILTER ) { T3 = 0; goto DETONATE; } - if( s->picnum != (SEENINEDEAD+1) ) + if ( s->picnum != (SEENINEDEAD+1) ) { T3 = 0; - if(s->picnum == SEENINEDEAD) s->picnum++; - else if(s->picnum == SEENINE) + if (s->picnum == SEENINEDEAD) s->picnum++; + else if (s->picnum == SEENINE) s->picnum = SEENINEDEAD; } else goto DETONATE; @@ -1942,23 +1950,23 @@ DETONATE: earthquaketime = 16; j = headspritestat[3]; - while(j >= 0) + while (j >= 0) { - if( s->hitag == sprite[j].hitag ) + if ( s->hitag == sprite[j].hitag ) { - if(sprite[j].lotag == 13) + if (sprite[j].lotag == 13) { - if( hittype[j].temp_data[2] == 0 ) + if ( hittype[j].temp_data[2] == 0 ) hittype[j].temp_data[2] = 1; } - else if(sprite[j].lotag == 8) + else if (sprite[j].lotag == 8) hittype[j].temp_data[4] = 1; - else if(sprite[j].lotag == 18) + else if (sprite[j].lotag == 18) { - if(hittype[j].temp_data[0] == 0) + if (hittype[j].temp_data[0] == 0) hittype[j].temp_data[0] = 1; } - else if(sprite[j].lotag == 21) + else if (sprite[j].lotag == 21) hittype[j].temp_data[0] = 1; } j = nextspritestat[j]; @@ -1966,7 +1974,7 @@ DETONATE: s->z -= (32<<8); - if( ( t[3] == 1 && s->xrepeat ) || s->lotag == -99 ) + if ( ( t[3] == 1 && s->xrepeat ) || s->lotag == -99 ) { x = s->extra; spawn(i,EXPLOSION2); @@ -1974,8 +1982,8 @@ DETONATE: spritesound(PIPEBOMB_EXPLODE,i); } - if(s->xrepeat) - for(x=0;x<8;x++) RANDOMSCRAP; + if (s->xrepeat) + for (x=0;x<8;x++) RANDOMSCRAP; KILLIT(i); } @@ -1983,21 +1991,21 @@ DETONATE: goto BOLT; } - if(s->picnum == MASTERSWITCH) + if (s->picnum == MASTERSWITCH) { - if(s->yvel == 1) + if (s->yvel == 1) { s->hitag--; - if(s->hitag <= 0) + if (s->hitag <= 0) { operatesectors(sect,i); j = headspritesect[sect]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].statnum == 3) + if (sprite[j].statnum == 3) { - switch(sprite[j].lotag) + switch (sprite[j].lotag) { case 2: case 21: @@ -2011,9 +2019,9 @@ DETONATE: break; } } - else if(sprite[j].statnum == 6) + else if (sprite[j].statnum == 6) { - switch(dynamictostatic[sprite[j].picnum]) + switch (dynamictostatic[sprite[j].picnum]) { case SEENINE__STATIC: case OOZFILTER__STATIC: @@ -2036,21 +2044,21 @@ DETONATE: switchpicnum = BOLT1; } - switch(dynamictostatic[switchpicnum]) + switch (dynamictostatic[switchpicnum]) { case VIEWSCREEN__STATIC: case VIEWSCREEN2__STATIC: - if(s->xrepeat == 0) KILLIT(i); + if (s->xrepeat == 0) KILLIT(i); p = findplayer(s, &x); - if( x < 2048 ) + if ( x < 2048 ) { - if( SP == 1 ) + if ( SP == 1 ) camsprite = i; } - else if( camsprite != -1 && T1 == 1) + else if ( camsprite != -1 && T1 == 1) { camsprite = -1; T1 = 0; @@ -2063,12 +2071,12 @@ DETONATE: case TRASH__STATIC: - if(s->xvel == 0) s->xvel = 1; + if (s->xvel == 0) s->xvel = 1; IFMOVING { makeitfall(i); - if(TRAND&1) s->zvel -= 256; - if( klabs(s->xvel) < 48 ) + if (TRAND&1) s->zvel -= 256; + if ( klabs(s->xvel) < 48 ) s->xvel += (TRAND&3); } else KILLIT(i); @@ -2079,20 +2087,20 @@ DETONATE: // case SIDEBOLT1+2: // case SIDEBOLT1+3: p = findplayer(s, &x); - if( x > 20480 ) goto BOLT; + if ( x > 20480 ) goto BOLT; CLEAR_THE_BOLT2: - if(t[2]) + if (t[2]) { t[2]--; goto BOLT; } - if( (s->xrepeat|s->yrepeat) == 0 ) + if ( (s->xrepeat|s->yrepeat) == 0 ) { s->xrepeat=t[0]; s->yrepeat=t[1]; } - if( (TRAND&8) == 0 ) + if ( (TRAND&8) == 0 ) { t[0]=s->xrepeat; t[1]=s->yrepeat; @@ -2102,12 +2110,12 @@ CLEAR_THE_BOLT2: } s->picnum++; - if(l&1) s->cstat ^= 2; + if (l&1) s->cstat ^= 2; - if( (TRAND&1) && sector[sect].floorpicnum == HURTRAIL ) + if ( (TRAND&1) && sector[sect].floorpicnum == HURTRAIL ) spritesound(SHORT_CIRCUIT,i); - if(s->picnum == SIDEBOLT1+4) s->picnum = SIDEBOLT1; + if (s->picnum == SIDEBOLT1+4) s->picnum = SIDEBOLT1; goto BOLT; @@ -2116,25 +2124,25 @@ CLEAR_THE_BOLT2: // case BOLT1+2: // case BOLT1+3: p = findplayer(s, &x); - if( x > 20480 ) goto BOLT; + if ( x > 20480 ) goto BOLT; - if( t[3] == 0 ) + if ( t[3] == 0 ) t[3]=sector[sect].floorshade; CLEAR_THE_BOLT: - if(t[2]) + if (t[2]) { t[2]--; sector[sect].floorshade = 20; sector[sect].ceilingshade = 20; goto BOLT; } - if( (s->xrepeat|s->yrepeat) == 0 ) + if ( (s->xrepeat|s->yrepeat) == 0 ) { s->xrepeat=t[0]; s->yrepeat=t[1]; } - else if( (TRAND&8) == 0 ) + else if ( (TRAND&8) == 0 ) { t[0]=s->xrepeat; t[1]=s->yrepeat; @@ -2147,14 +2155,14 @@ CLEAR_THE_BOLT: l = global_random&7; s->xrepeat=l+8; - if(l&1) s->cstat ^= 2; + if (l&1) s->cstat ^= 2; - if( s->picnum == (BOLT1+1) && (TRAND&7) == 0 && sector[sect].floorpicnum == HURTRAIL ) + if ( s->picnum == (BOLT1+1) && (TRAND&7) == 0 && sector[sect].floorpicnum == HURTRAIL ) spritesound(SHORT_CIRCUIT,i); - if(s->picnum==BOLT1+4) s->picnum=BOLT1; + if (s->picnum==BOLT1+4) s->picnum=BOLT1; - if(s->picnum&1) + if (s->picnum&1) { sector[sect].floorshade = 0; sector[sect].ceilingshade = 0; @@ -2168,26 +2176,26 @@ CLEAR_THE_BOLT: case WATERDRIP__STATIC: - if( t[1] ) + if ( t[1] ) { t[1]--; - if(t[1] == 0) + if (t[1] == 0) s->cstat &= 32767; } else { makeitfall(i); ssp(i,CLIPMASK0); - if(s->xvel > 0) s->xvel -= 2; + if (s->xvel > 0) s->xvel -= 2; - if(s->zvel == 0) + if (s->zvel == 0) { s->cstat |= 32768; - if(s->pal != 2 && s->hitag == 0) + if (s->pal != 2 && s->hitag == 0) spritesound(SOMETHING_DRIPPING,i); - if(sprite[s->owner].picnum != WATERDRIP) + if (sprite[s->owner].picnum != WATERDRIP) { KILLIT(i); } @@ -2210,13 +2218,13 @@ CLEAR_THE_BOLT: goto BOLT; case TOUCHPLATE__STATIC: - if( t[1] == 1 && s->hitag >= 0) //Move the sector floor + if ( t[1] == 1 && s->hitag >= 0) //Move the sector floor { x = sector[sect].floorz; - if(t[3] == 1) + if (t[3] == 1) { - if(x >= t[2]) + if (x >= t[2]) { sector[sect].floorz = x; t[1] = 0; @@ -2225,12 +2233,12 @@ CLEAR_THE_BOLT: { sector[sect].floorz += sector[sect].extra; p = checkcursectnums(sect); - if(p >= 0) ps[p].posz += sector[sect].extra; + if (p >= 0) ps[p].posz += sector[sect].extra; } } else { - if(x <= s->z) + if (x <= s->z) { sector[sect].floorz = s->z; t[1] = 0; @@ -2239,40 +2247,40 @@ CLEAR_THE_BOLT: { sector[sect].floorz -= sector[sect].extra; p = checkcursectnums(sect); - if(p >= 0) + if (p >= 0) ps[p].posz -= sector[sect].extra; } } goto BOLT; } - if(t[5] == 1) goto BOLT; + if (t[5] == 1) goto BOLT; p = checkcursectnums(sect); - if( p >= 0 && ( ps[p].on_ground || s->ang == 512) ) + if ( p >= 0 && ( ps[p].on_ground || s->ang == 512) ) { - if( t[0] == 0 && !check_activator_motion(s->lotag) ) + if ( t[0] == 0 && !check_activator_motion(s->lotag) ) { t[0] = 1; t[1] = 1; t[3] = !t[3]; operatemasterswitches(s->lotag); operateactivators(s->lotag,p); - if(s->hitag > 0) + if (s->hitag > 0) { s->hitag--; - if(s->hitag == 0) t[5] = 1; + if (s->hitag == 0) t[5] = 1; } } } else t[0] = 0; - if(t[1] == 1) + if (t[1] == 1) { j = headspritestat[6]; - while(j >= 0) + while (j >= 0) { - if(j != i && sprite[j].picnum == TOUCHPLATE && sprite[j].lotag == s->lotag) + if (j != i && sprite[j].picnum == TOUCHPLATE && sprite[j].lotag == s->lotag) { hittype[j].temp_data[1] = 1; hittype[j].temp_data[3] = t[3]; @@ -2290,10 +2298,10 @@ CLEAR_THE_BOLT: IFHIT { spritesound(VENT_BUST,i); - for(j=0;j<10;j++) + for (j=0;j<10;j++) RANDOMSCRAP; - if(s->lotag) spawn(i,s->lotag); + if (s->lotag) spawn(i,s->lotag); KILLIT(i); } @@ -2373,19 +2381,19 @@ void moveweapons(void) spritetype *s; i = headspritestat[4]; - while(i >= 0) + while (i >= 0) { nexti = nextspritestat[i]; s = &sprite[i]; - if(s->sectnum < 0) KILLIT(i); + if (s->sectnum < 0) KILLIT(i); hittype[i].bposx = s->x; hittype[i].bposy = s->y; hittype[i].bposz = s->z; // here - if(checkspriteflags(i,SPRITE_FLAG_PROJECTILE)) + if (checkspriteflags(i,SPRITE_FLAG_PROJECTILE)) { /* Custom projectiles. This is a big hack. */ @@ -2397,7 +2405,7 @@ void moveweapons(void) if (thisprojectile[i].trail > -1) { - for(f=0;f<=thisprojectile[i].tnum;f++) + for (f=0;f<=thisprojectile[i].tnum;f++) { j = spawn(i,thisprojectile[i].trail); if (thisprojectile[i].toffset != 0) @@ -2417,13 +2425,13 @@ void moveweapons(void) p = -1; - if(thisprojectile[i].workslike & PROJECTILE_FLAG_COOLEXPLOSION1) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_COOLEXPLOSION1) { s->shade++; - if(s->shade >= 40) KILLIT(i); + if (s->shade >= 40) KILLIT(i); } - if(sector[s->sectnum].lotag == 2) + if (sector[s->sectnum].lotag == 2) { k = s->xvel>>1; ll = s->zvel>>1; @@ -2438,14 +2446,14 @@ void moveweapons(void) dax = s->x; day = s->y; daz = s->z; - if(thisprojectile[i].workslike & PROJECTILE_FLAG_TIMED && thisprojectile[i].range > 0) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_TIMED && thisprojectile[i].range > 0) { if (!(hittype[i].temp_data[8])) hittype[i].temp_data[8] = 1; else hittype[i].temp_data[8]++; - if(hittype[i].temp_data[8] > thisprojectile[i].range) + if (hittype[i].temp_data[8] > thisprojectile[i].range) { if (thisprojectile[i].workslike & PROJECTILE_FLAG_EXPLODEONTIMER) { @@ -2464,7 +2472,7 @@ void moveweapons(void) s->extra=thisprojectile[i].extra; - if(thisprojectile[i].extra_rand > 0) + if (thisprojectile[i].extra_rand > 0) s->extra += (TRAND&thisprojectile[i].extra_rand); x = s->extra; @@ -2496,7 +2504,7 @@ void moveweapons(void) s->extra=thisprojectile[i].extra; - if(thisprojectile[i].extra_rand > 0) + if (thisprojectile[i].extra_rand > 0) s->extra += (TRAND&thisprojectile[i].extra_rand); x = s->extra; @@ -2511,32 +2519,32 @@ void moveweapons(void) getglobalz(i); qq = CLIPMASK1; - for(f=1;f<=thisprojectile[i].velmult;f++) + for (f=1;f<=thisprojectile[i].velmult;f++) j = movesprite(i, (k*(sintable[(s->ang+512)&2047]))>>14, (k*(sintable[s->ang&2047]))>>14,ll,qq); - if(!(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) && s->yvel >= 0) - if( FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256 ) + if (!(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) && s->yvel >= 0) + if ( FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256 ) j = 49152|s->yvel; - if(s->sectnum < 0) { KILLIT(i); } + if (s->sectnum < 0) { KILLIT(i); } - if( (j&49152) != 49152) - if(!(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)) + if ( (j&49152) != 49152) + if (!(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)) { - if(s->z < hittype[i].ceilingz) + if (s->z < hittype[i].ceilingz) { j = 16384|(s->sectnum); s->zvel = -1; } else - if( ( s->z > hittype[i].floorz && sector[s->sectnum].lotag != 1 ) || + if ( ( s->z > hittype[i].floorz && sector[s->sectnum].lotag != 1 ) || ( s->z > hittype[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1 ) ) { j = 16384|(s->sectnum); - if(sector[s->sectnum].lotag != 1) + if (sector[s->sectnum].lotag != 1) s->zvel = 1; } } @@ -2558,16 +2566,16 @@ void moveweapons(void) } } else */ - if(thisprojectile[i].workslike & PROJECTILE_FLAG_SPIT) - if(s->zvel < 6144) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_SPIT) + if (s->zvel < 6144) s->zvel += gc-112; - if(thisprojectile[i].workslike & PROJECTILE_FLAG_WATERBUBBLES && sector[s->sectnum].lotag == 2 && rnd(140)) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_WATERBUBBLES && sector[s->sectnum].lotag == 2 && rnd(140)) spawn(i,WATERBUBBLE); - if( j != 0 ) + if ( j != 0 ) { - if(thisprojectile[i].workslike & PROJECTILE_FLAG_COOLEXPLOSION1) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_COOLEXPLOSION1) { /* if( (j&49152) == 49152 && sprite[j&(MAXSPRITES-1)].picnum != APLAYER) goto BOLT; */ @@ -2575,7 +2583,7 @@ void moveweapons(void) s->zvel = 0; } - if( (j&49152) == 49152 ) + if ( (j&49152) == 49152 ) { j &= (MAXSPRITES-1); @@ -2590,9 +2598,9 @@ void moveweapons(void) KILLIT(i); }*/ - if(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFSPRITES) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFSPRITES) { - if( wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR ) + if ( wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR ) s->yvel--; k = getangle( @@ -2613,25 +2621,25 @@ void moveweapons(void) checkhitsprite(j,i); - if(sprite[j].picnum == APLAYER) + if (sprite[j].picnum == APLAYER) { p = sprite[j].yvel; spritesound(PISTOL_BODYHIT,j); - if(thisprojectile[i].workslike & PROJECTILE_FLAG_SPIT) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_SPIT) { ps[p].horiz += 32; ps[p].return_to_center = 8; - if(ps[p].loogcnt == 0) + if (ps[p].loogcnt == 0) { - if(!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) + if (!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) spritesound(DUKE_LONGTERM_PAIN,ps[p].i); j = 3+(TRAND&3); ps[p].numloogs = j; ps[p].loogcnt = 24*4; - for(x=0;x < j;x++) + for (x=0;x < j;x++) { ps[p].loogiex[x] = TRAND%xdim; ps[p].loogiey[x] = TRAND%ydim; @@ -2640,7 +2648,7 @@ void moveweapons(void) } } - if(thisprojectile[i].workslike & PROJECTILE_FLAG_RPG_IMPACT) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_RPG_IMPACT) { hittype[j].owner = s->owner; @@ -2666,11 +2674,11 @@ void moveweapons(void) } } - else if( (j&49152) == 32768 ) + else if ( (j&49152) == 32768 ) { j &= (MAXWALLS-1); - if(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFMIRRORS && ( wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR ) ) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFMIRRORS && ( wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR ) ) { k = getangle( wall[wall[j].point2].x-wall[j].x, @@ -2685,9 +2693,9 @@ void moveweapons(void) setsprite(i,dax,day,daz); checkhitwall(i,j,s->x,s->y,s->z,s->picnum); - if(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) { - if( wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR ) + if ( wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR ) s->yvel--; k = getangle( @@ -2707,20 +2715,20 @@ void moveweapons(void) } } } - else if( (j&49152) == 16384) + else if ( (j&49152) == 16384) { setsprite(i,dax,day,daz); - if(s->zvel < 0) + if (s->zvel < 0) { - if( sector[s->sectnum].ceilingstat&1 ) - if(sector[s->sectnum].ceilingpal == 0) + if ( sector[s->sectnum].ceilingstat&1 ) + if (sector[s->sectnum].ceilingpal == 0) KILLIT(i); checkhitceiling(s->sectnum); } - if(thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) { bounce(i); ssp(i,qq); @@ -2744,7 +2752,7 @@ void moveweapons(void) } } - if(thisprojectile[i].workslike & PROJECTILE_FLAG_RPG) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_RPG) { if (thisprojectile[i].spawns > 0) { @@ -2783,7 +2791,7 @@ void moveweapons(void) } - if(thisprojectile[i].workslike & PROJECTILE_FLAG_RPG) + if (thisprojectile[i].workslike & PROJECTILE_FLAG_RPG) { if (thisprojectile[i].isound > -1) spritesound(thisprojectile[i].isound,i); @@ -2791,7 +2799,7 @@ void moveweapons(void) /* if(s->xrepeat >= 10) {*/ s->extra=thisprojectile[i].extra; - if(thisprojectile[i].extra_rand > 0) + if (thisprojectile[i].extra_rand > 0) s->extra += (TRAND&thisprojectile[i].extra_rand); x = s->extra; @@ -2818,7 +2826,7 @@ void moveweapons(void) { // here - switch(dynamictostatic[s->picnum]) + switch (dynamictostatic[s->picnum]) { case RADIUSEXPLOSION__STATIC: case KNEE__STATIC: @@ -2826,18 +2834,18 @@ void moveweapons(void) case TONGUE__STATIC: T1 = sintable[(T2)&2047]>>9; T2 += 32; - if(T2 > 2047) KILLIT(i); + if (T2 > 2047) KILLIT(i); - if(sprite[s->owner].statnum == MAXSTATUS) - if(badguy(&sprite[s->owner]) == 0) + if (sprite[s->owner].statnum == MAXSTATUS) + if (badguy(&sprite[s->owner]) == 0) KILLIT(i); s->ang = sprite[s->owner].ang; s->x = sprite[s->owner].x; s->y = sprite[s->owner].y; - if(sprite[s->owner].picnum == APLAYER) + 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), @@ -2853,13 +2861,13 @@ void moveweapons(void) s->z+((k*ksgn(s->zvel))*klabs(s->zvel/12)),INNERJAW,-40, 32,32,0,0,0,i,5); sprite[q].cstat = 128; - if( T2 > 512 && T2 < (1024) ) + if ( T2 > 512 && T2 < (1024) ) sprite[q].picnum = INNERJAW+1; goto BOLT; case FREEZEBLAST__STATIC: - if(s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) + if (s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) { j = spawn(i,TRANSPORTERSTAR); sprite[j].pal = 1; @@ -2873,13 +2881,13 @@ void moveweapons(void) case SPIT__STATIC: case COOLEXPLOSION1__STATIC: - if( s->picnum == COOLEXPLOSION1 ) - if( !issoundplaying(i,WIERDSHOT_FLY) ) + if ( s->picnum == COOLEXPLOSION1 ) + if ( !issoundplaying(i,WIERDSHOT_FLY) ) spritesound(WIERDSHOT_FLY,i); p = -1; - if(s->picnum == RPG && sector[s->sectnum].lotag == 2) + if (s->picnum == RPG && sector[s->sectnum].lotag == 2) { k = s->xvel>>1; ll = s->zvel>>1; @@ -2895,10 +2903,10 @@ void moveweapons(void) getglobalz(i); qq = CLIPMASK1; - switch(dynamictostatic[s->picnum]) + switch (dynamictostatic[s->picnum]) { case RPG__STATIC: - if(hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) + if (hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { j = spawn(i,SMALLSMOKE); sprite[j].z += (1<<8); @@ -2910,33 +2918,33 @@ void moveweapons(void) (k*(sintable[(s->ang+512)&2047]))>>14, (k*(sintable[s->ang&2047]))>>14,ll,qq); - if(s->picnum == RPG && s->yvel >= 0) - if( FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256 ) + if (s->picnum == RPG && s->yvel >= 0) + if ( FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256 ) j = 49152|s->yvel; - if(s->sectnum < 0) { KILLIT(i); } + if (s->sectnum < 0) { KILLIT(i); } - if( (j&49152) != 49152) - if(s->picnum != FREEZEBLAST) + if ( (j&49152) != 49152) + if (s->picnum != FREEZEBLAST) { - if(s->z < hittype[i].ceilingz) + if (s->z < hittype[i].ceilingz) { j = 16384|(s->sectnum); s->zvel = -1; } else - if( ( s->z > hittype[i].floorz && sector[s->sectnum].lotag != 1 ) || + if ( ( s->z > hittype[i].floorz && sector[s->sectnum].lotag != 1 ) || ( s->z > hittype[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1 ) ) { j = 16384|(s->sectnum); - if(sector[s->sectnum].lotag != 1) + if (sector[s->sectnum].lotag != 1) s->zvel = 1; } } - if(s->picnum == FIRELASER) + if (s->picnum == FIRELASER) { - for(k=-3;k<2;k++) + for (k=-3;k<2;k++) { x = EGS(s->sectnum, s->x+((k*sintable[(s->ang+512)&2047])>>9), @@ -2948,25 +2956,25 @@ void moveweapons(void) sprite[x].pal = s->pal; } } - else if(s->picnum == SPIT) if(s->zvel < 6144) + else if (s->picnum == SPIT) if (s->zvel < 6144) s->zvel += gc-112; - if( j != 0 ) + if ( j != 0 ) { - if(s->picnum == COOLEXPLOSION1) + if (s->picnum == COOLEXPLOSION1) { - if( (j&49152) == 49152 && sprite[j&(MAXSPRITES-1)].picnum != APLAYER) + if ( (j&49152) == 49152 && sprite[j&(MAXSPRITES-1)].picnum != APLAYER) goto BOLT; s->xvel = 0; s->zvel = 0; } - if( (j&49152) == 49152 ) + if ( (j&49152) == 49152 ) { j &= (MAXSPRITES-1); - if(s->picnum == FREEZEBLAST && sprite[j].pal == 1 ) - if( badguy(&sprite[j]) || sprite[j].picnum == APLAYER ) + if (s->picnum == FREEZEBLAST && sprite[j].pal == 1 ) + if ( badguy(&sprite[j]) || sprite[j].picnum == APLAYER ) { j = spawn(i,TRANSPORTERSTAR); sprite[j].pal = 1; @@ -2978,25 +2986,25 @@ void moveweapons(void) checkhitsprite(j,i); - if(sprite[j].picnum == APLAYER) + if (sprite[j].picnum == APLAYER) { p = sprite[j].yvel; spritesound(PISTOL_BODYHIT,j); - if(s->picnum == SPIT) + if (s->picnum == SPIT) { ps[p].horiz += 32; ps[p].return_to_center = 8; - if(ps[p].loogcnt == 0) + if (ps[p].loogcnt == 0) { - if(!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) + if (!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) spritesound(DUKE_LONGTERM_PAIN,ps[p].i); j = 3+(TRAND&3); ps[p].numloogs = j; ps[p].loogcnt = 24*4; - for(x=0;x < j;x++) + for (x=0;x < j;x++) { ps[p].loogiex[x] = TRAND%xdim; ps[p].loogiey[x] = TRAND%ydim; @@ -3005,11 +3013,11 @@ void moveweapons(void) } } } - else if( (j&49152) == 32768 ) + else if ( (j&49152) == 32768 ) { j &= (MAXWALLS-1); - if(s->picnum != RPG && s->picnum != FREEZEBLAST && s->picnum != SPIT && ( wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR ) ) + if (s->picnum != RPG && s->picnum != FREEZEBLAST && s->picnum != SPIT && ( wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR ) ) { k = getangle( wall[wall[j].point2].x-wall[j].x, @@ -3024,9 +3032,9 @@ void moveweapons(void) setsprite(i,dax,day,daz); checkhitwall(i,j,s->x,s->y,s->z,s->picnum); - if(s->picnum == FREEZEBLAST) + if (s->picnum == FREEZEBLAST) { - if( wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR ) + if ( wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR ) { s->extra >>= 1; s->yvel--; @@ -3040,75 +3048,77 @@ void moveweapons(void) } } } - else if( (j&49152) == 16384) + else if ( (j&49152) == 16384) { setsprite(i,dax,day,daz); - if(s->zvel < 0) + if (s->zvel < 0) { - if( sector[s->sectnum].ceilingstat&1 ) - if(sector[s->sectnum].ceilingpal == 0) + if ( sector[s->sectnum].ceilingstat&1 ) + if (sector[s->sectnum].ceilingpal == 0) KILLIT(i); checkhitceiling(s->sectnum); } - if(s->picnum == FREEZEBLAST) + if (s->picnum == FREEZEBLAST) { bounce(i); ssp(i,qq); s->extra >>= 1; - if(s->xrepeat > 8) + if (s->xrepeat > 8) s->xrepeat -= 2; - if(s->yrepeat > 8) + if (s->yrepeat > 8) s->yrepeat -= 2; s->yvel--; goto BOLT; } } - if(s->picnum != SPIT) + if (s->picnum != SPIT) { - if(s->picnum == RPG) + if (s->picnum == RPG) { k = spawn(i,EXPLOSION2); sprite[k].x = dax; sprite[k].y = day; sprite[k].z = daz; - if(s->xrepeat < 10) + if (s->xrepeat < 10) { sprite[k].xrepeat = 6; sprite[k].yrepeat = 6; } - else if( (j&49152) == 16384) + else if ( (j&49152) == 16384) { - if( s->zvel > 0) + if ( s->zvel > 0) spawn(i,EXPLOSION2BOT); else { sprite[k].cstat |= 8; sprite[k].z += (48<<8); } + } } - else if(s->picnum == SHRINKSPARK) + else if (s->picnum == SHRINKSPARK) { spawn(i,SHRINKEREXPLOSION); spritesound(SHRINKER_HIT,i); hitradius(i,shrinkerblastradius,0,0,0,0); } - else if( s->picnum != COOLEXPLOSION1 && s->picnum != FREEZEBLAST && s->picnum != FIRELASER) + else if ( s->picnum != COOLEXPLOSION1 && s->picnum != FREEZEBLAST && s->picnum != FIRELASER) { k = spawn(i,EXPLOSION2); sprite[k].xrepeat = sprite[k].yrepeat = s->xrepeat>>1; - if( (j&49152) == 16384) + if ( (j&49152) == 16384) { - if( s->zvel < 0) + if ( s->zvel < 0) { sprite[k].cstat |= 8; sprite[k].z += (72<<8); } + } } - if( s->picnum == RPG ) + if ( s->picnum == RPG ) { spritesound(RPG_EXPLODE,i); - if(s->xrepeat >= 10) + if (s->xrepeat >= 10) { x = s->extra; hitradius( i,rpgblastradius, x>>2,x>>1,x-(x>>2),x); @@ -3120,14 +3130,14 @@ void moveweapons(void) } } } - if(s->picnum != COOLEXPLOSION1) KILLIT(i); + if (s->picnum != COOLEXPLOSION1) KILLIT(i); } - if(s->picnum == COOLEXPLOSION1) + if (s->picnum == COOLEXPLOSION1) { s->shade++; - if(s->shade >= 40) KILLIT(i); + if (s->shade >= 40) KILLIT(i); } - else if(s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140)) + else if (s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140)) spawn(i,WATERBUBBLE); goto BOLT; @@ -3152,14 +3162,14 @@ void movetransports(void) i = headspritestat[9]; //Transporters - while(i >= 0) + while (i >= 0) { sect = SECT; sectlotag = sector[sect].lotag; nexti = nextspritestat[i]; - if(OW == i) + if (OW == i) { i = nexti; continue; @@ -3167,35 +3177,35 @@ void movetransports(void) onfloorz = T5; - if(T1 > 0) T1--; + if (T1 > 0) T1--; j = headspritesect[sect]; - while(j >= 0) + while (j >= 0) { nextj = nextspritesect[j]; - switch(sprite[j].statnum) + switch (sprite[j].statnum) { case 10: // Player - if( sprite[j].owner != -1 ) + if ( sprite[j].owner != -1 ) { p = sprite[j].yvel; ps[p].on_warping_sector = 1; - if( ps[p].transporter_hold == 0 && ps[p].jumping_counter == 0 ) + if ( ps[p].transporter_hold == 0 && ps[p].jumping_counter == 0 ) { - if(ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0 ) + if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0 ) { - if(sprite[i].pal == 0) + if (sprite[i].pal == 0) { spawn(i,TRANSPORTERBEAM); spritesound(TELEPORTER,i); } - for(k=connecthead;k>=0;k=connectpoint2[k]) - if(ps[k].cursectnum == sprite[OW].sectnum) + for (k=connecthead;k>=0;k=connectpoint2[k]) + if (ps[k].cursectnum == sprite[OW].sectnum) { ps[k].frag_ps = p; sprite[ps[k].i].extra = 0; @@ -3203,7 +3213,7 @@ void movetransports(void) ps[p].ang = sprite[OW].ang; - if(sprite[OW].owner != OW) + if (sprite[OW].owner != OW) { T1 = 13; hittype[OW].temp_data[0] = 13; @@ -3217,7 +3227,7 @@ void movetransports(void) changespritesect(j,sprite[OW].sectnum); ps[p].cursectnum = sprite[j].sectnum; - if(sprite[i].pal == 0) + if (sprite[i].pal == 0) { k = spawn(OW,TRANSPORTERBEAM); spritesound(TELEPORTER,k); @@ -3226,16 +3236,16 @@ void movetransports(void) break; } } - else if( !(sectlotag == 1 && ps[p].on_ground == 1) ) break; + else if ( !(sectlotag == 1 && ps[p].on_ground == 1) ) break; - if(onfloorz == 0 && klabs(SZ-ps[p].posz) < 6144 ) - if( (ps[p].jetpack_on == 0 ) || (ps[p].jetpack_on && (sync[p].bits&1) ) || + if (onfloorz == 0 && klabs(SZ-ps[p].posz) < 6144 ) + if ( (ps[p].jetpack_on == 0 ) || (ps[p].jetpack_on && (sync[p].bits&1) ) || (ps[p].jetpack_on && (sync[p].bits&2) ) ) { ps[p].oposx = ps[p].posx += sprite[OW].x-SX; ps[p].oposy = ps[p].posy += sprite[OW].y-SY; - if( ps[p].jetpack_on && ( (sync[p].bits&1) || ps[p].jetpack_on < 11 ) ) + if ( ps[p].jetpack_on && ( (sync[p].bits&1) || ps[p].jetpack_on < 11 ) ) ps[p].posz = sprite[OW].z-6144; else ps[p].posz = sprite[OW].z+6144; ps[p].oposz = ps[p].posz; @@ -3252,16 +3262,16 @@ void movetransports(void) k = 0; - if( onfloorz && sectlotag == 1 && ps[p].on_ground && ps[p].posz > (sector[sect].floorz-1080) && ( (sync[p].bits&2) || ps[p].poszv > 2048 ) ) + if ( onfloorz && sectlotag == 1 && ps[p].on_ground && ps[p].posz > (sector[sect].floorz-1080) && ( (sync[p].bits&2) || ps[p].poszv > 2048 ) ) // if( onfloorz && sectlotag == 1 && ps[p].posz > (sector[sect].floorz-(6<<8)) ) { k = 1; - if(screenpeek == p) + if (screenpeek == p) { FX_StopAllSounds(); clearsoundlocks(); } - if(sprite[ps[p].i].extra > 0) + if (sprite[ps[p].i].extra > 0) spritesound(DUKE_UNDERWATER,j); ps[p].oposz = ps[p].posz = sector[sprite[OW].sectnum].ceilingz; @@ -3271,11 +3281,11 @@ void movetransports(void) // ps[p].poszv += 1080; } - if( onfloorz && sectlotag == 2 && ps[p].posz < (sector[sect].ceilingz+1080) && ps[p].poszv == 0) + if ( onfloorz && sectlotag == 2 && ps[p].posz < (sector[sect].ceilingz+1080) && ps[p].poszv == 0) { k = 1; // if( sprite[j].extra <= 0) break; - if(screenpeek == p) + if (screenpeek == p) { FX_StopAllSounds(); clearsoundlocks(); @@ -3290,12 +3300,12 @@ void movetransports(void) // ps[p].poszv += 1024; } - if(k == 1) + if (k == 1) { ps[p].oposx = ps[p].posx += sprite[OW].x-SX; ps[p].oposy = ps[p].posy += sprite[OW].y-SY; - if(sprite[OW].owner != OW) + if (sprite[OW].owner != OW) ps[p].transporter_hold = -2; ps[p].cursectnum = sprite[OW].sectnum; @@ -3304,11 +3314,11 @@ void movetransports(void) setpal(&ps[p]); - if( (TRAND&255) < 32 ) + if ( (TRAND&255) < 32 ) spawn(j,WATERSPLASH2); - if(sectlotag == 1) - for(l = 0;l < 9;l++) + if (sectlotag == 1) + for (l = 0;l < 9;l++) { q = spawn(ps[p].i,WATERBUBBLE); sprite[q].z += TRAND&16383; @@ -3323,7 +3333,7 @@ void movetransports(void) || (sprite[j].picnum == OCTABRAIN) || ((sprite[j].picnum >= GREENSLIME) && (sprite[j].picnum >= GREENSLIME+7)) ) { - if(sprite[j].extra > 0) + if (sprite[j].extra > 0) goto JBOLT; } case 4: @@ -3335,15 +3345,15 @@ void movetransports(void) { warpspriteto = 0; - if( ll && sectlotag == 2 && sprite[j].z < (sector[sect].ceilingz+ll) ) + if ( ll && sectlotag == 2 && sprite[j].z < (sector[sect].ceilingz+ll) ) warpspriteto = 1; - if( ll && sectlotag == 1 && sprite[j].z > (sector[sect].floorz-ll) ) + if ( ll && sectlotag == 1 && sprite[j].z > (sector[sect].floorz-ll) ) warpspriteto = 1; - if( sectlotag == 0 && ( onfloorz || klabs(sprite[j].z-SZ) < 4096) ) + if ( sectlotag == 0 && ( onfloorz || klabs(sprite[j].z-SZ) < 4096) ) { - if( sprite[OW].owner != OW && onfloorz && T1 > 0 && sprite[j].statnum != 5 ) + if ( sprite[OW].owner != OW && onfloorz && T1 > 0 && sprite[j].statnum != 5 ) { T1++; goto BOLT; @@ -3353,7 +3363,7 @@ void movetransports(void) if (warpspriteto && checkspriteflags(j,SPRITE_FLAG_DECAL)) goto JBOLT; - if( warpspriteto ) switch(dynamictostatic[sprite[j].picnum]) + if ( warpspriteto ) switch (dynamictostatic[sprite[j].picnum]) { case TRANSPORTERSTAR__STATIC: case TRANSPORTERBEAM__STATIC: @@ -3368,23 +3378,23 @@ void movetransports(void) case LASERLINE__STATIC: goto JBOLT; case PLAYERONWATER__STATIC: - if(sectlotag == 2) + if (sectlotag == 2) { sprite[j].cstat &= 32767; break; } default: - if(sprite[j].statnum == 5 && !(sectlotag == 1 || sectlotag == 2) ) + if (sprite[j].statnum == 5 && !(sectlotag == 1 || sectlotag == 2) ) break; case WATERBUBBLE__STATIC: // if( rnd(192) && sprite[j].picnum == WATERBUBBLE) // break; - if(sectlotag > 0) + if (sectlotag > 0) { k = spawn(j,WATERSPLASH2); - if( sectlotag == 1 && sprite[j].statnum == 4 ) + if ( sectlotag == 1 && sprite[j].statnum == 4 ) { sprite[k].xvel = sprite[j].xvel>>1; sprite[k].ang = sprite[j].ang; @@ -3392,12 +3402,12 @@ void movetransports(void) } } - switch(sectlotag) + switch (sectlotag) { case 0: - if(onfloorz) + if (onfloorz) { - if( sprite[j].statnum == 4 || ( checkcursectnums(sect) == -1 && checkcursectnums(sprite[OW].sectnum) == -1 ) ) + if ( sprite[j].statnum == 4 || ( checkcursectnums(sect) == -1 && checkcursectnums(sprite[OW].sectnum) == -1 ) ) { sprite[j].x += (sprite[OW].x-SX); sprite[j].y += (sprite[OW].y-SY); @@ -3408,7 +3418,7 @@ void movetransports(void) hittype[j].bposy = sprite[j].y; hittype[j].bposz = sprite[j].z; - if(sprite[i].pal == 0) + if (sprite[i].pal == 0) { k = spawn(i,TRANSPORTERBEAM); spritesound(TELEPORTER,k); @@ -3417,7 +3427,7 @@ void movetransports(void) spritesound(TELEPORTER,k); } - if( sprite[OW].owner != OW ) + if ( sprite[OW].owner != OW ) { T1 = 13; hittype[OW].temp_data[0] = 13; @@ -3488,7 +3498,7 @@ void moveactors(void) int switchpicnum; i = headspritestat[1]; - while(i >= 0) + while (i >= 0) { nexti = nextspritestat[i]; @@ -3496,7 +3506,7 @@ void moveactors(void) sect = s->sectnum; - if( s->xrepeat == 0 || sect < 0 || sect >= MAXSECTORS) + if ( s->xrepeat == 0 || sect < 0 || sect >= MAXSECTORS) KILLIT(i); t = &hittype[i].temp_data[0]; @@ -3508,14 +3518,14 @@ void moveactors(void) if ((s->picnum > GREENSLIME)&&(s->picnum <= GREENSLIME+7)) { switchpicnum = GREENSLIME; } - switch(dynamictostatic[switchpicnum]) + switch (dynamictostatic[switchpicnum]) { case DUCK__STATIC: case TARGET__STATIC: - if(s->cstat&32) + if (s->cstat&32) { t[0]++; - if(t[0] > 60) + if (t[0] > 60) { t[0] = 0; s->cstat = 128+257+16; @@ -3525,20 +3535,20 @@ void moveactors(void) else { j = ifhitbyweapon(i); - if( j >= 0 ) + if ( j >= 0 ) { s->cstat = 32+128; k = 1; j = headspritestat[1]; - while(j >= 0) + while (j >= 0) { - if( sprite[j].lotag == s->lotag && + if ( sprite[j].lotag == s->lotag && sprite[j].picnum == s->picnum ) { - if( ( sprite[j].hitag && !(sprite[j].cstat&32) ) || + if ( ( sprite[j].hitag && !(sprite[j].cstat&32) ) || ( !sprite[j].hitag && (sprite[j].cstat&32) ) - ) + ) { k = 0; break; @@ -3548,7 +3558,7 @@ void moveactors(void) j = nextspritestat[j]; } - if(k == 1) + if (k == 1) { operateactivators(s->lotag,-1); operateforcefields(i,s->lotag); @@ -3562,13 +3572,13 @@ void moveactors(void) case RESPAWNMARKERYELLOW__STATIC: case RESPAWNMARKERGREEN__STATIC: T1++; - if(T1 > respawnitemtime) + if (T1 > respawnitemtime) { KILLIT(i); } - if( T1 >= (respawnitemtime>>1) && T1 < ((respawnitemtime>>1)+(respawnitemtime>>2)) ) + if ( T1 >= (respawnitemtime>>1) && T1 < ((respawnitemtime>>1)+(respawnitemtime>>2)) ) PN = RESPAWNMARKERYELLOW; - else if( T1 > ((respawnitemtime>>1)+(respawnitemtime>>2)) ) + else if ( T1 > ((respawnitemtime>>1)+(respawnitemtime>>2)) ) PN = RESPAWNMARKERGREEN; makeitfall(i); break; @@ -3579,16 +3589,16 @@ void moveactors(void) s->z += s->zvel; t[0]++; - if(t[0] == 4) spritesound(WAR_AMBIENCE2,i); + if (t[0] == 4) spritesound(WAR_AMBIENCE2,i); - if( t[0] > (26*8) ) + if ( t[0] > (26*8) ) { sound(RPG_EXPLODE); - for(j=0;j<32;j++) RANDOMSCRAP; + for (j=0;j<32;j++) RANDOMSCRAP; earthquaketime = 16; KILLIT(i); } - else if((t[0]&3) == 0) + else if ((t[0]&3) == 0) spawn(i,EXPLOSION2); ssp(i,CLIPMASK0); break; @@ -3596,28 +3606,28 @@ void moveactors(void) makeitfall(i); IFMOVING { - if( (TRAND&255) < 3 ) spritesound(RATTY,i); + if ( (TRAND&255) < 3 ) spritesound(RATTY,i); s->ang += (TRAND&31)-15+(sintable[(t[0]<<8)&2047]>>11); } else { T1++; - if(T1 > 1) { KILLIT(i); } + if (T1 > 1) { KILLIT(i); } else s->ang = (TRAND&2047); } - if(s->xvel < 128) + if (s->xvel < 128) s->xvel+=2; s->ang += (TRAND&3)-6; break; case QUEBALL__STATIC: case STRIPEBALL__STATIC: - if(s->xvel) + if (s->xvel) { j = headspritestat[0]; - while(j >= 0) + while (j >= 0) { nextj = nextspritestat[j]; - if( sprite[j].picnum == POCKET && ldist(&sprite[j],s) < 52 ) KILLIT(i); + if ( sprite[j].picnum == POCKET && ldist(&sprite[j],s) < 52 ) KILLIT(i); j = nextj; } @@ -3626,9 +3636,9 @@ void moveactors(void) (((s->xvel*(sintable[s->ang&2047]))>>14)*TICSPERFRAME)<<11, 24L,(4<<8),(4<<8),CLIPMASK1); - if(j&49152) + if (j&49152) { - if( (j&49152) == 32768 ) + if ( (j&49152) == 32768 ) { j &= (MAXWALLS-1); k = getangle( @@ -3636,15 +3646,15 @@ void moveactors(void) wall[wall[j].point2].y-wall[j].y); s->ang = ((k<<1) - s->ang)&2047; } - else if( (j&49152) == 49152 ) + else if ( (j&49152) == 49152 ) { j &= (MAXSPRITES-1); checkhitsprite(i,j); } } s->xvel --; - if(s->xvel < 0) s->xvel = 0; - if( s->picnum == STRIPEBALL ) + if (s->xvel < 0) s->xvel = 0; + if ( s->picnum == STRIPEBALL ) { s->cstat = 257; s->cstat |= 4&s->xvel; @@ -3655,32 +3665,32 @@ void moveactors(void) { p = findplayer(s,&x); - if( x < 1596) + if ( x < 1596) { // if(s->pal == 12) { j = getincangle(ps[p].ang,getangle(s->x-ps[p].posx,s->y-ps[p].posy)); - if( j > -64 && j < 64 && (sync[p].bits&(1<<29)) ) - if(ps[p].toggle_key_flag == 1) + if ( j > -64 && j < 64 && (sync[p].bits&(1<<29)) ) + if (ps[p].toggle_key_flag == 1) { a = headspritestat[1]; - while(a >= 0) + while (a >= 0) { - if(sprite[a].picnum == QUEBALL || sprite[a].picnum == STRIPEBALL) + if (sprite[a].picnum == QUEBALL || sprite[a].picnum == STRIPEBALL) { j = getincangle(ps[p].ang,getangle(sprite[a].x-ps[p].posx,sprite[a].y-ps[p].posy)); - if( j > -64 && j < 64 ) + if ( j > -64 && j < 64 ) { findplayer(&sprite[a],&l); - if(x > l) break; + if (x > l) break; } } a = nextspritestat[a]; } - if(a == -1) + if (a == -1) { - if(s->pal == 12) + if (s->pal == 12) s->xvel = 164; else s->xvel = 140; s->ang = ps[p].ang; @@ -3689,7 +3699,7 @@ void moveactors(void) } } } - if( x < 512 && s->sectnum == ps[p].cursectnum ) + if ( x < 512 && s->sectnum == ps[p].cursectnum ) { s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); s->xvel = 48; @@ -3699,12 +3709,12 @@ void moveactors(void) break; case FORCESPHERE__STATIC: - if(s->yvel == 0) + if (s->yvel == 0) { 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 = spawn(i,FORCESPHERE); sprite[k].cstat = 257+128; @@ -3716,23 +3726,23 @@ void moveactors(void) } } - if(t[3] > 0) + if (t[3] > 0) { - if(s->zvel < 6144) + if (s->zvel < 6144) s->zvel += 192; s->z += s->zvel; - if(s->z > sector[sect].floorz) + if (s->z > sector[sect].floorz) s->z = sector[sect].floorz; t[3]--; - if(t[3] == 0) + if (t[3] == 0) KILLIT(i); } - else if(t[2] > 10) + else if (t[2] > 10) { j = headspritestat[5]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].owner == i && sprite[j].picnum == FORCESPHERE) + if (sprite[j].owner == i && sprite[j].picnum == FORCESPHERE) hittype[j].temp_data[1] = 1+(TRAND&63); j = nextspritestat[j]; } @@ -3749,21 +3759,21 @@ void moveactors(void) s->shade += (sector[s->sectnum].ceilingshade-s->shade)>>1; else s->shade += (sector[s->sectnum].floorshade-s->shade)>>1; - if( s->z < sector[sect].ceilingz+(32<<8) ) + if ( s->z < sector[sect].ceilingz+(32<<8) ) s->z = sector[sect].ceilingz+(32<<8); - if( ud.multimode < 2 ) + if ( ud.multimode < 2 ) { - if( actor_tog == 1) + if ( actor_tog == 1) { s->cstat = (short)32768; goto BOLT; } - else if(actor_tog == 2) s->cstat = 257; + else if (actor_tog == 2) s->cstat = 257; } IFHIT { - if( s->extra < 0 && t[0] != -1 ) + if ( s->extra < 0 && t[0] != -1 ) { t[0] = -1; s->extra = 0; @@ -3772,18 +3782,18 @@ void moveactors(void) RANDOMSCRAP; } - if(t[0] == -1) + if (t[0] == -1) { s->z += 1024; t[2]++; - if( (t[2]&3) == 0) spawn(i,EXPLOSION2); + if ( (t[2]&3) == 0) spawn(i,EXPLOSION2); getglobalz(i); s->ang += 96; s->xvel = 128; j = ssp(i,CLIPMASK0); - if(j != 1 || s->z > hittype[i].floorz) + if (j != 1 || s->z > hittype[i].floorz) { - for(l=0;l<16;l++) + for (l=0;l<16;l++) RANDOMSCRAP; spritesound(LASERTRIP_EXPLODE,i); spawn(i,PIGCOP); @@ -3794,7 +3804,7 @@ void moveactors(void) } else { - if( s->z > hittype[i].floorz-(48<<8) ) + if ( s->z > hittype[i].floorz-(48<<8) ) s->z = hittype[i].floorz-(48<<8); } @@ -3803,10 +3813,10 @@ void moveactors(void) // 3 = findplayerz, 4 = shoot - if( t[0] >= 4 ) + if ( t[0] >= 4 ) { t[2]++; - if( (t[2]&15) == 0 ) + if ( (t[2]&15) == 0 ) { a = s->ang; s->ang = hittype[i].tempang; @@ -3814,7 +3824,7 @@ void moveactors(void) shoot(i,FIRELASER); s->ang = a; } - if( t[2] > (26*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum ) ) + if ( t[2] > (26*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum ) ) { t[0] = 0; t[2] = 0; @@ -3822,27 +3832,27 @@ void moveactors(void) else hittype[i].tempang += getincangle(hittype[i].tempang,getangle(ps[p].posx-s->x,ps[p].posy-s->y))/3; } - else if(t[0] == 2 || t[0] == 3) + else if (t[0] == 2 || t[0] == 3) { t[3] = 0; - if(s->xvel > 0) s->xvel -= 16; + if (s->xvel > 0) s->xvel -= 16; else s->xvel = 0; - if(t[0] == 2) + if (t[0] == 2) { l = ps[p].posz-s->z; - if( klabs(l) < (48<<8) ) t[0] = 3; + if ( klabs(l) < (48<<8) ) t[0] = 3; else s->z += ksgn(ps[p].posz-s->z)<<10; } else { t[2]++; - if( t[2] > (26*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum ) ) + if ( t[2] > (26*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum ) ) { t[0] = 1; t[2] = 0; } - else if( (t[2]&15) == 0 ) + else if ( (t[2]&15) == 0 ) { spritesound(RECO_ATTACK,i); shoot(i,FIRELASER); @@ -3851,35 +3861,35 @@ void moveactors(void) s->ang += getincangle(s->ang,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>2; } - if( t[0] != 2 && t[0] != 3 ) + if ( t[0] != 2 && t[0] != 3 ) { l = ldist(&sprite[j],s); - if(l <= 1524) + if (l <= 1524) { a = s->ang; s->xvel >>= 1; } else a = getangle(sprite[j].x-s->x,sprite[j].y-s->y); - if(t[0] == 1 || t[0] == 4) // Found a locator and going with it + if (t[0] == 1 || t[0] == 4) // Found a locator and going with it { l = dist(&sprite[j],s); - if( l <= 1524 ) { if(t[0] == 1) t[0] = 0; else t[0] = 5; } + if ( l <= 1524 ) { if (t[0] == 1) t[0] = 0; else t[0] = 5; } else { // Control speed here - if(l > 1524) { if( s->xvel < 256 ) s->xvel += 32; } + if (l > 1524) { if ( s->xvel < 256 ) s->xvel += 32; } else { - if(s->xvel > 0) s->xvel -= 16; + if (s->xvel > 0) s->xvel -= 16; else s->xvel = 0; } } - if(t[0] < 2) t[2]++; + if (t[0] < 2) t[2]++; - if( x < 6144 && t[0] < 2 && t[2] > (26*4) ) + if ( x < 6144 && t[0] < 2 && t[2] > (26*4) ) { t[0] = 2+(TRAND&2); t[2] = 0; @@ -3887,18 +3897,18 @@ void moveactors(void) } } - if(t[0] == 0 || t[0] == 5) + if (t[0] == 0 || t[0] == 5) { - if(t[0] == 0) + if (t[0] == 0) t[0] = 1; else t[0] = 4; j = s->owner = LocateTheLocator(s->hitag,-1); - if(j == -1) + if (j == -1) { s->hitag = j = hittype[i].temp_data[5]; s->owner = LocateTheLocator(j,-1); j = s->owner; - if(j == -1) KILLIT(i); + if (j == -1) KILLIT(i); } else s->hitag++; } @@ -3906,12 +3916,12 @@ void moveactors(void) t[3] = getincangle(s->ang,a); s->ang += t[3]>>3; - if(s->z < sprite[j].z) + if (s->z < sprite[j].z) s->z += 1024; else s->z -= 1024; } - if(!isspritemakingsound(i,RECO_ROAM)) + if (!isspritemakingsound(i,RECO_ROAM)) spritesound(RECO_ROAM,i); ssp(i,CLIPMASK0); @@ -3924,11 +3934,11 @@ void moveactors(void) getglobalz(i); j = (hittype[i].floorz-hittype[i].ceilingz)>>9; - if(j > 255) j = 255; + if (j > 255) j = 255; x = 25-(j>>1); - if(x < 8) x = 8; - else if(x > 48) x = 48; + if (x < 8) x = 8; + else if (x > 48) x = 48; s->yrepeat = j; s->xrepeat = x; @@ -3946,28 +3956,28 @@ void moveactors(void) // case GREENSLIME+7: // #ifndef VOLUMEONE - if( ud.multimode < 2 ) + if ( ud.multimode < 2 ) { - if( actor_tog == 1) + if ( actor_tog == 1) { s->cstat = (short)32768; goto BOLT; } - else if(actor_tog == 2) s->cstat = 257; + else if (actor_tog == 2) s->cstat = 257; } // #endif t[1]+=128; - if(sector[sect].floorstat&1) + if (sector[sect].floorstat&1) KILLIT(i); p = findplayer(s,&x); - if(x > 20480) + if (x > 20480) { hittype[i].timetosleep++; - if( hittype[i].timetosleep > SLEEPTIME ) + if ( hittype[i].timetosleep > SLEEPTIME ) { hittype[i].timetosleep = 0; changespritestat(i,2); @@ -3975,10 +3985,10 @@ void moveactors(void) } } - if(t[0] == -5) // FROZEN + if (t[0] == -5) // FROZEN { t[3]++; - if(t[3] > 280) + if (t[3] > 280) { s->pal = 0; t[0] = 0; @@ -3991,8 +4001,8 @@ void moveactors(void) s->pal = 1; IFHIT { - if(j == FREEZEBLAST) goto BOLT; - for(j=16; j >= 0 ;j--) + if (j == FREEZEBLAST) goto BOLT; + for (j=16; j >= 0 ;j--) { k = EGS(SECT,SX,SY,SZ,GLASSPIECES+(j%3),-32,36,36,TRAND&2047,32+(TRAND&63),1024-(TRAND&1023),i,5); sprite[k].pal = 1; @@ -4000,23 +4010,23 @@ void moveactors(void) spritesound(GLASS_BREAKING,i); KILLIT(i); } - else if(x < 1024 && ps[p].quick_kick == 0) + else if (x < 1024 && ps[p].quick_kick == 0) { j = getincangle(ps[p].ang,getangle(SX-ps[p].posx,SY-ps[p].posy)); - if( j > -128 && j < 128 ) + if ( j > -128 && j < 128 ) ps[p].quick_kick = 14; } goto BOLT; } - if(x < 1596) + if (x < 1596) s->cstat = 0; else s->cstat = 257; - if(t[0] == -4) //On the player + if (t[0] == -4) //On the player { - if( sprite[ps[p].i].extra < 1 ) + if ( sprite[ps[p].i].extra < 1 ) { t[0] = 0; goto BOLT; @@ -4026,10 +4036,10 @@ void moveactors(void) s->ang = ps[p].ang; - if( ( (sync[p].bits&4) || (ps[p].quick_kick > 0) ) && sprite[ps[p].i].extra > 0 ) - if( ps[p].quick_kick > 0 || ( ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0) ) + if ( ( (sync[p].bits&4) || (ps[p].quick_kick > 0) ) && sprite[ps[p].i].extra > 0 ) + if ( ps[p].quick_kick > 0 || ( ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0) ) { - for(x=0;x<8;x++) + for (x=0;x<8;x++) { j = EGS(sect,s->x,s->y,s->z-(8<<8),SCRAP3+(TRAND&3),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(s->zvel>>2),i,5); sprite[j].pal = 6; @@ -4037,14 +4047,14 @@ void moveactors(void) spritesound(SLIM_DYING,i); spritesound(SQUISHED,i); - if( (TRAND&255) < 32 ) + if ( (TRAND&255) < 32 ) { j = spawn(i,BLOODPOOL); sprite[j].pal = 0; } ps[p].actors_killed ++; t[0] = -3; - if(ps[p].somethingonplayer == i) + if (ps[p].somethingonplayer == i) ps[p].somethingonplayer = -1; KILLIT(i); } @@ -4053,13 +4063,13 @@ void moveactors(void) s->z += (100-ps[p].horiz)<<4; - if( t[2] > 512) + if ( t[2] > 512) t[2] -= 128; - if( t[2] < 348) + if ( t[2] < 348) t[2] += 128; - if(ps[p].newowner >= 0) + if (ps[p].newowner >= 0) { ps[p].newowner = -1; ps[p].posx = ps[p].oposx; @@ -4071,33 +4081,33 @@ void moveactors(void) setpal(&ps[p]); j = headspritestat[1]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; + if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; j = nextspritestat[j]; } } - if(t[3]>0) + if (t[3]>0) { short frames[] = {5,5,6,6,7,7,6,5}; s->picnum = GREENSLIME+frames[t[3]]; - if( t[3] == 5 ) + if ( t[3] == 5 ) { sprite[ps[p].i].extra += -(5+(TRAND&3)); spritesound(SLIM_ATTACK,i); } - if(t[3] < 7) t[3]++; + if (t[3] < 7) t[3]++; else t[3] = 0; } else { s->picnum = GREENSLIME+5; - if(rnd(32)) + if (rnd(32)) t[3] = 1; } @@ -4110,12 +4120,12 @@ void moveactors(void) goto BOLT; } - else if(s->xvel < 64 && x < 768) + else if (s->xvel < 64 && x < 768) { - if(ps[p].somethingonplayer == -1) + if (ps[p].somethingonplayer == -1) { ps[p].somethingonplayer = i; - if(t[0] == 3 || t[0] == 2) //Falling downward + if (t[0] == 3 || t[0] == 2) //Falling downward t[2] = (12<<8); else t[2] = -(13<<8); //Climbing up duke t[0] = -4; @@ -4127,22 +4137,22 @@ void moveactors(void) spritesound(SLIM_DYING,i); ps[p].actors_killed ++; - if(ps[p].somethingonplayer == i) + if (ps[p].somethingonplayer == i) ps[p].somethingonplayer = -1; - if(j == FREEZEBLAST) + if (j == FREEZEBLAST) { spritesound(SOMETHINGFROZE,i); t[0] = -5 ; t[3] = 0 ; goto BOLT; } - if( (TRAND&255) < 32 ) + if ( (TRAND&255) < 32 ) { j = spawn(i,BLOODPOOL); sprite[j].pal = 0; } - for(x=0;x<8;x++) + for (x=0;x<8;x++) { j = EGS(sect,s->x,s->y,s->z-(8<<8),SCRAP3+(TRAND&3),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(s->zvel>>2),i,5); sprite[j].pal = 6; @@ -4151,7 +4161,7 @@ void moveactors(void) KILLIT(i); } // All weap - if(t[0] == -1) //Shrinking down + if (t[0] == -1) //Shrinking down { makeitfall(i); @@ -4161,8 +4171,8 @@ void moveactors(void) // if(s->yrepeat > 62) // guts(s,JIBS6,5,myconnectindex); - if(s->xrepeat > 32) s->xrepeat -= TRAND&7; - if(s->yrepeat > 16) s->yrepeat -= TRAND&7; + if (s->xrepeat > 32) s->xrepeat -= TRAND&7; + if (s->yrepeat > 16) s->yrepeat -= TRAND&7; else { s->xrepeat = 40; @@ -4173,9 +4183,9 @@ void moveactors(void) goto BOLT; } - else if(t[0] != -2) getglobalz(i); + else if (t[0] != -2) getglobalz(i); - if(t[0] == -2) //On top of somebody + if (t[0] == -2) //On top of somebody { makeitfall(i); sprite[t[5]].xvel = 0; @@ -4188,15 +4198,15 @@ void moveactors(void) s->picnum = GREENSLIME+2+(global_random&1); - if(s->yrepeat < 64) s->yrepeat+=2; + if (s->yrepeat < 64) s->yrepeat+=2; else { - if(s->xrepeat < 32) s->xrepeat += 4; + if (s->xrepeat < 32) s->xrepeat += 4; else { t[0] = -1; x = ldist(s,&sprite[t[5]]); - if(x < 768) { + if (x < 768) { sprite[t[5]].xrepeat = 0; // JBF 20041129: a slimer eating another enemy really ought @@ -4210,18 +4220,18 @@ void moveactors(void) } //Check randomly to see of there is an actor near - if(rnd(32)) + if (rnd(32)) { j = headspritesect[sect]; - while(j>=0) + while (j>=0) { - switch(dynamictostatic[sprite[j].picnum]) + switch (dynamictostatic[sprite[j].picnum]) { case LIZTROOP__STATIC: case LIZMAN__STATIC: case PIGCOP__STATIC: case NEWBEAST__STATIC: - if( ldist(s,&sprite[j]) < 768 && (klabs(s->z-sprite[j].z)<8192) ) //Gulp them + if ( ldist(s,&sprite[j]) < 768 && (klabs(s->z-sprite[j].z)<8192) ) //Gulp them { t[5] = j; t[0] = -2; @@ -4236,19 +4246,19 @@ void moveactors(void) //Moving on the ground or ceiling - if(t[0] == 0 || t[0] == 2) + if (t[0] == 0 || t[0] == 2) { s->picnum = GREENSLIME; - if( (TRAND&511) == 0 ) + if ( (TRAND&511) == 0 ) spritesound(SLIM_ROAM,i); - if(t[0]==2) + if (t[0]==2) { s->zvel = 0; s->cstat &= (65535-8); - if( (sector[sect].ceilingstat&1) || (hittype[i].ceilingz+6144) < s->z) + if ( (sector[sect].ceilingstat&1) || (hittype[i].ceilingz+6144) < s->z) { s->z += 2048; t[0] = 3; @@ -4261,16 +4271,16 @@ void moveactors(void) makeitfall(i); } - if( everyothertime&1 ) ssp(i,CLIPMASK0); + if ( everyothertime&1 ) ssp(i,CLIPMASK0); - if(s->xvel > 96) + if (s->xvel > 96) { s->xvel -= 2; goto BOLT; } else { - if(s->xvel < 32) s->xvel += 4; + if (s->xvel < 32) s->xvel += 4; s->xvel = 64 - (sintable[(t[1]+512)&2047]>>9); s->ang += getincangle(s->ang, @@ -4281,7 +4291,7 @@ void moveactors(void) s->xrepeat = 36 + (sintable[(t[1]+512)&2047]>>11); s->yrepeat = 16 + (sintable[t[1]&2047]>>13); - if(rnd(4) && (sector[sect].ceilingstat&1) == 0 && + if (rnd(4) && (sector[sect].ceilingstat&1) == 0 && klabs(hittype[i].floorz-hittype[i].ceilingz) < (192<<8) ) { @@ -4291,15 +4301,15 @@ void moveactors(void) } - if(t[0]==1) + if (t[0]==1) { s->picnum = GREENSLIME; - if(s->yrepeat < 40) s->yrepeat+=8; - if(s->xrepeat > 8) s->xrepeat-=4; - if(s->zvel > -(2048+1024)) + if (s->yrepeat < 40) s->yrepeat+=8; + if (s->xrepeat > 8) s->xrepeat-=4; + if (s->zvel > -(2048+1024)) s->zvel -= 348; s->z += s->zvel; - if(s->z < hittype[i].ceilingz+4096) + if (s->z < hittype[i].ceilingz+4096) { s->z = hittype[i].ceilingz+4096; s->xvel = 0; @@ -4307,24 +4317,24 @@ void moveactors(void) } } - if(t[0]==3) + if (t[0]==3) { s->picnum = GREENSLIME+1; makeitfall(i); - if(s->z > hittype[i].floorz-(8<<8)) + if (s->z > hittype[i].floorz-(8<<8)) { s->yrepeat-=4; s->xrepeat+=2; } else { - if(s->yrepeat < (40-4)) s->yrepeat+=8; - if(s->xrepeat > 8) s->xrepeat-=4; + if (s->yrepeat < (40-4)) s->yrepeat+=8; + if (s->xrepeat > 8) s->xrepeat-=4; } - if(s->z > hittype[i].floorz-2048) + if (s->z > hittype[i].floorz-2048) { s->z = hittype[i].floorz-2048; t[0] = 0; @@ -4340,10 +4350,10 @@ void moveactors(void) case HEAVYHBOMB__STATIC: - if( (s->cstat&32768) ) + if ( (s->cstat&32768) ) { t[2]--; - if(t[2] <= 0) + if (t[2] <= 0) { spritesound(TELEPORTER,i); spawn(i,TRANSPORTERSTAR); @@ -4354,13 +4364,13 @@ void moveactors(void) p = findplayer(s,&x); - if( x < 1220 ) s->cstat &= ~257; + if ( x < 1220 ) s->cstat &= ~257; else s->cstat |= 257; - if(t[3] == 0 ) + if (t[3] == 0 ) { j = ifhitbyweapon(i); - if(j >= 0) + if (j >= 0) { t[3] = 1; t[4] = 0; @@ -4370,20 +4380,20 @@ void moveactors(void) } } - if( s->picnum != BOUNCEMINE ) + if ( s->picnum != BOUNCEMINE ) { makeitfall(i); - if( sector[sect].lotag != 1 && s->z >= hittype[i].floorz-(FOURSLEIGHT) && s->yvel < 3 ) + if ( sector[sect].lotag != 1 && s->z >= hittype[i].floorz-(FOURSLEIGHT) && s->yvel < 3 ) { - if( s->yvel > 0 || (s->yvel == 0 && hittype[i].floorz == sector[sect].floorz )) + if ( s->yvel > 0 || (s->yvel == 0 && hittype[i].floorz == sector[sect].floorz )) spritesound(PIPEBOMB_BOUNCE,i); s->zvel = -((4-s->yvel)<<8); - if(sector[s->sectnum].lotag== 2) + if (sector[s->sectnum].lotag== 2) s->zvel >>= 2; s->yvel++; } - if( s->z < hittype[i].ceilingz ) // && sector[sect].lotag != 2 ) + if ( s->z < hittype[i].ceilingz ) // && sector[sect].lotag != 2 ) { s->z = hittype[i].ceilingz+(3<<8); s->zvel = 0; @@ -4395,10 +4405,10 @@ void moveactors(void) (s->xvel*(sintable[s->ang&2047]))>>14, s->zvel,CLIPMASK0); - if(sector[SECT].lotag == 1 && s->zvel == 0) + if (sector[SECT].lotag == 1 && s->zvel == 0) { s->z += (32<<8); - if(t[5] == 0) + if (t[5] == 0) { t[5] = 1; spawn(i,WATERSPLASH2); @@ -4406,7 +4416,7 @@ void moveactors(void) } else t[5] = 0; - if(t[3] == 0 && ( s->picnum == BOUNCEMINE || s->picnum == MORTER ) && (j || x < 844) ) + if (t[3] == 0 && ( s->picnum == BOUNCEMINE || s->picnum == MORTER ) && (j || x < 844) ) { t[3] = 1; t[4] = 0; @@ -4415,22 +4425,22 @@ void moveactors(void) goto DETONATEB; } - if(sprite[s->owner].picnum == APLAYER) + if (sprite[s->owner].picnum == APLAYER) l = sprite[s->owner].yvel; else l = -1; - if(s->xvel > 0) + if (s->xvel > 0) { s->xvel -= 5; - if(sector[sect].lotag == 2) + if (sector[sect].lotag == 2) s->xvel -= 10; - if(s->xvel < 0) + if (s->xvel < 0) s->xvel = 0; - if(s->xvel&8) s->cstat ^= 4; + if (s->xvel&8) s->cstat ^= 4; } - if( (j&49152) == 32768 ) + if ( (j&49152) == 32768 ) { j &= (MAXWALLS-1); @@ -4451,7 +4461,7 @@ DETONATEB: // if(lPipeBombControl & PIPEBOMB_TIMER) // { - if( s->picnum == HEAVYHBOMB && hittype[i].temp_data[6] == 1) + if ( s->picnum == HEAVYHBOMB && hittype[i].temp_data[6] == 1) { /* if(s->extra >= 1) { @@ -4462,12 +4472,12 @@ DETONATEB: s->lotag=911; */ - if(hittype[i].temp_data[7] >= 1) + if (hittype[i].temp_data[7] >= 1) { hittype[i].temp_data[7]--; } - if(hittype[i].temp_data[7] <= 0) + if (hittype[i].temp_data[7] <= 0) { hittype[i].temp_data[6] = 3; // s->extra = *actorscrptr[s->picnum]; @@ -4475,43 +4485,46 @@ DETONATEB: } // } - if(( l >= 0 && ps[l].hbomb_on == 0 && hittype[i].temp_data[6] == 2) || t[3] == 1) + if (( l >= 0 && ps[l].hbomb_on == 0 && hittype[i].temp_data[6] == 2) || t[3] == 1) hittype[i].temp_data[6] = 3; - if(hittype[i].temp_data[6] == 3) + if (hittype[i].temp_data[6] == 3) { t[4]++; - if(t[4] == 2) + if (t[4] == 2) { x = s->extra; m = 0; - switch(dynamictostatic[s->picnum]) + switch (dynamictostatic[s->picnum]) { - case HEAVYHBOMB__STATIC: m = pipebombblastradius;break; - case MORTER__STATIC: m = morterblastradius;break; - case BOUNCEMINE__STATIC: m = bouncemineblastradius;break; + case HEAVYHBOMB__STATIC: + m = pipebombblastradius;break; + case MORTER__STATIC: + m = morterblastradius;break; + case BOUNCEMINE__STATIC: + m = bouncemineblastradius;break; } hitradius( i, m,x>>2,x>>1,x-(x>>2),x); spawn(i,EXPLOSION2); - if( s->zvel == 0 ) + if ( s->zvel == 0 ) spawn(i,EXPLOSION2BOT); spritesound(PIPEBOMB_EXPLODE,i); - for(x=0;x<8;x++) + for (x=0;x<8;x++) RANDOMSCRAP; } - if(s->yrepeat) + if (s->yrepeat) { s->yrepeat = 0; goto BOLT; } - if(t[4] > 20) + if (t[4] > 20) { - if(s->owner != i || ud.respawn_items == 0) + if (s->owner != i || ud.respawn_items == 0) { KILLIT(i); } @@ -4525,24 +4538,24 @@ DETONATEB: } } } - else if(s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0) - if( cansee(s->x,s->y,s->z-(8<<8),s->sectnum,ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum) ) - if(ps[p].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON] ) + else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0) + if ( cansee(s->x,s->y,s->z-(8<<8),s->sectnum,ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum) ) + if (ps[p].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON] ) { - if((gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY) && s->owner == i) + if ((gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY) && s->owner == i) { - for(j=0;jpicnum) + for (j=0;jpicnum) goto BOLT; - if(ps[p].weapreccnt < 255) + if (ps[p].weapreccnt < 255) ps[p].weaprecs[ps[p].weapreccnt++] = s->picnum; } addammo(HANDBOMB_WEAPON,&ps[p],1); spritesound(DUKE_GET,ps[p].i); - if( ps[p].gotweapon[HANDBOMB_WEAPON] == 0 || s->owner == ps[p].i ) + if ( ps[p].gotweapon[HANDBOMB_WEAPON] == 0 || s->owner == ps[p].i ) { /* addweapon(&ps[p],HANDBOMB_WEAPON); */ if (!(ps[p].weaponswitch & 1) && *aplWeaponWorksLike[ps[p].curr_weapon] != HANDREMOTE_WEAPON) @@ -4550,7 +4563,7 @@ DETONATEB: else addweapon( &ps[p],HANDBOMB_WEAPON); } - if( sprite[s->owner].picnum != APLAYER ) + if ( sprite[s->owner].picnum != APLAYER ) { ps[p].pals[0] = 0; ps[p].pals[1] = 32; @@ -4558,9 +4571,9 @@ DETONATEB: ps[p].pals_time = 32; } - if( s->owner != i || ud.respawn_items == 0 ) + if ( s->owner != i || ud.respawn_items == 0 ) { - if(s->owner == i && (gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY)) + if (s->owner == i && (gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY)) goto BOLT; KILLIT(i); } @@ -4572,7 +4585,7 @@ DETONATEB: } } - if(t[0] < 8) t[0]++; + if (t[0] < 8) t[0]++; goto BOLT; case REACTORBURNT__STATIC: @@ -4582,15 +4595,15 @@ DETONATEB: case REACTOR__STATIC: case REACTOR2__STATIC: - if( t[4] == 1 ) + if ( t[4] == 1 ) { j = headspritesect[sect]; - while(j >= 0) + while (j >= 0) { - switch(dynamictostatic[sprite[j].picnum]) + switch (dynamictostatic[sprite[j].picnum]) { case SECTOREFFECTOR__STATIC: - if(sprite[j].lotag == 1) + if (sprite[j].lotag == 1) { sprite[j].lotag = (short) 65535; sprite[j].hitag = (short) 65535; @@ -4612,7 +4625,7 @@ DETONATEB: goto BOLT; } - if(t[1] >= 20) + if (t[1] >= 20) { t[4] = 1; goto BOLT; @@ -4621,13 +4634,13 @@ DETONATEB: p = findplayer(s,&x); t[2]++; - if( t[2] == 4 ) t[2]=0; + if ( t[2] == 4 ) t[2]=0; - if( x < 4096 ) + if ( x < 4096 ) { - if( (TRAND&255) < 16 ) + if ( (TRAND&255) < 16 ) { - if(!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) + if (!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) spritesound(DUKE_LONGTERM_PAIN,ps[p].i); spritesound(SHORT_CIRCUIT,i); @@ -4639,19 +4652,19 @@ DETONATEB: ps[p].pals[2] = 0; } t[0] += 128; - if( t[3] == 0 ) + if ( t[3] == 0 ) t[3] = 1; } else t[3] = 0; - if( t[1] ) + if ( t[1] ) { t[1]++; t[4] = s->z; s->z = sector[sect].floorz-(TRAND%(sector[sect].floorz-sector[sect].ceilingz)); - switch( t[1] ) + switch ( t[1] ) { case 3: //Turn on all of those flashing sectoreffector. @@ -4677,11 +4690,11 @@ DETONATEB: } */ j = headspritestat[6]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == MASTERSWITCH) - if(sprite[j].hitag == s->hitag) - if(sprite[j].yvel == 0) + if (sprite[j].picnum == MASTERSWITCH) + if (sprite[j].hitag == s->hitag) + if (sprite[j].yvel == 0) sprite[j].yvel = 1; j = nextspritestat[j]; } @@ -4692,11 +4705,11 @@ DETONATEB: case 10: case 15: j = headspritesect[sect]; - while(j >= 0) + while (j >= 0) { l = nextspritesect[j]; - if(j != i) + if (j != i) { deletesprite(j); break; @@ -4705,7 +4718,7 @@ DETONATEB: } break; } - for(x=0;x<16;x++) + for (x=0;x<16;x++) RANDOMSCRAP; s->z = t[4]; @@ -4716,9 +4729,9 @@ DETONATEB: { IFHIT { - for(x=0;x<32;x++) + for (x=0;x<32;x++) RANDOMSCRAP; - if(s->extra < 0) + if (s->extra < 0) t[1] = 1; } } @@ -4726,27 +4739,27 @@ DETONATEB: case CAMERA1__STATIC: - if( t[0] == 0 ) + if ( t[0] == 0 ) { t[1]+=8; - if(camerashitable) + if (camerashitable) { IFHIT { t[0] = 1; // static s->cstat = (short)32768; - for(x=0;x<5;x++) RANDOMSCRAP; + for (x=0;x<5;x++) RANDOMSCRAP; goto BOLT; } } - if(s->hitag > 0) + if (s->hitag > 0) { - if(t[1]hitag) + if (t[1]hitag) s->ang+=8; - else if(t[1]<(s->hitag*3)) + else if (t[1]<(s->hitag*3)) s->ang-=8; - else if(t[1] < (s->hitag<<2) ) + else if (t[1] < (s->hitag<<2) ) s->ang+=8; else { @@ -4760,14 +4773,14 @@ DETONATEB: // #ifndef VOLOMEONE - if( ud.multimode < 2 && badguy(s) ) + if ( ud.multimode < 2 && badguy(s) ) { - if( actor_tog == 1) + if ( actor_tog == 1) { s->cstat = (short)32768; goto BOLT; } - else if(actor_tog == 2) s->cstat = 257; + else if (actor_tog == 2) s->cstat = 257; } // #endif @@ -4790,7 +4803,7 @@ void moveexplosions(void) // STATNUM 5 int switchpicnum; i = headspritestat[5]; - while(i >= 0) + while (i >= 0) { nexti = nextspritestat[i]; @@ -4798,7 +4811,7 @@ void moveexplosions(void) // STATNUM 5 s = &sprite[i]; sect = s->sectnum; - if( sect < 0 || s->xrepeat == 0 ) KILLIT(i); + if ( sect < 0 || s->xrepeat == 0 ) KILLIT(i); hittype[i].bposx = s->x; hittype[i].bposy = s->y; @@ -4815,7 +4828,7 @@ void moveexplosions(void) // STATNUM 5 } if ( (s->picnum == MONEY+1) || (s->picnum == MAIL+1) || (s->picnum == PAPER+1) ) hittype[i].floorz = s->z = getflorzofslope(s->sectnum,s->x,s->y); - else switch(dynamictostatic[switchpicnum]) + else switch (dynamictostatic[switchpicnum]) { case NEON1__STATIC: case NEON2__STATIC: @@ -4824,7 +4837,7 @@ void moveexplosions(void) // STATNUM 5 case NEON5__STATIC: case NEON6__STATIC: - if( (global_random/(s->lotag+1)&31) > 4) s->shade = -127; + if ( (global_random/(s->lotag+1)&31) > 4) s->shade = -127; else s->shade = 127; goto BOLT; @@ -4833,10 +4846,10 @@ void moveexplosions(void) // STATNUM 5 case BLOODSPLAT3__STATIC: case BLOODSPLAT4__STATIC: - if( t[0] == 7*26 ) goto BOLT; + if ( t[0] == 7*26 ) goto BOLT; s->z += 16+(TRAND&15); t[0]++; - if( (t[0]%9) == 0 ) s->yrepeat++; + if ( (t[0]%9) == 0 ) s->yrepeat++; goto BOLT; case NUKEBUTTON__STATIC: @@ -4844,16 +4857,16 @@ void moveexplosions(void) // STATNUM 5 // case NUKEBUTTON+2: // case NUKEBUTTON+3: - if(t[0]) + if (t[0]) { t[0]++; - if(t[0] == 8) s->picnum = NUKEBUTTON+1; - else if(t[0] == 16) + if (t[0] == 8) s->picnum = NUKEBUTTON+1; + else if (t[0] == 16) { s->picnum = NUKEBUTTON+2; ps[sprite[s->owner].yvel].fist_incs = 1; } - if( ps[sprite[s->owner].yvel].fist_incs == 26 ) + if ( ps[sprite[s->owner].yvel].fist_incs == 26 ) s->picnum = NUKEBUTTON+3; } goto BOLT; @@ -4861,24 +4874,24 @@ void moveexplosions(void) // STATNUM 5 case FORCESPHERE__STATIC: l = s->xrepeat; - if(t[1] > 0) + if (t[1] > 0) { t[1]--; - if(t[1] == 0) + if (t[1] == 0) { KILLIT(i); } } - if(hittype[s->owner].temp_data[1] == 0) + if (hittype[s->owner].temp_data[1] == 0) { - if(t[0] < 64) + if (t[0] < 64) { t[0]++; l += 3; } } else - if(t[0] > 64) + if (t[0] > 64) { t[0]--; l -= 3; @@ -4889,22 +4902,22 @@ void moveexplosions(void) // STATNUM 5 s->z = sprite[s->owner].z; s->ang += hittype[s->owner].temp_data[0]; - if(l > 64) l = 64; - else if(l < 1) l = 1; + if (l > 64) l = 64; + else if (l < 1) l = 1; s->xrepeat = l; s->yrepeat = l; s->shade = (l>>1)-48; - for(j=t[0];j > 0;j--) + for (j=t[0];j > 0;j--) ssp(i,CLIPMASK0); goto BOLT; case WATERSPLASH2__STATIC: t[0]++; - if(t[0] == 1 ) + if (t[0] == 1 ) { - if(sector[sect].lotag != 1 && sector[sect].lotag != 2) + if (sector[sect].lotag != 1 && sector[sect].lotag != 2) KILLIT(i); /* else { @@ -4914,29 +4927,29 @@ void moveexplosions(void) // STATNUM 5 else */ if (!issoundplaying(i,ITEM_SPLASH)) spritesound(ITEM_SPLASH,i); } - if(t[0] == 3) + if (t[0] == 3) { t[0] = 0; t[1]++; } - if(t[1] == 5) + if (t[1] == 5) deletesprite(i); goto BOLT; case FRAMEEFFECT1_13__STATIC: if (PLUTOPAK) goto BOLT; // JBF: ideally this should never happen... case FRAMEEFFECT1__STATIC: - if(s->owner >= 0) + if (s->owner >= 0) { t[0]++; - if( t[0] > 7 ) + if ( t[0] > 7 ) { KILLIT(i); } - else if( t[0] > 4 ) + else if ( t[0] > 4 ) s->cstat |= 512+2; - else if( t[0] > 2 ) + else if ( t[0] > 2 ) s->cstat |= 2; s->xoffset = sprite[s->owner].xoffset; s->yoffset = sprite[s->owner].yoffset; @@ -4946,7 +4959,7 @@ void moveexplosions(void) // STATNUM 5 // case INNERJAW+1: p = findplayer(s,&x); - if(x < 512) + if (x < 512) { ps[p].pals_time = 32; ps[p].pals[0] = 32; @@ -4956,7 +4969,7 @@ void moveexplosions(void) // STATNUM 5 } case FIRELASER__STATIC: - if(s->extra != 999) + if (s->extra != 999) s->extra = 999; else KILLIT(i); break; @@ -4969,27 +4982,27 @@ void moveexplosions(void) // STATNUM 5 s->xvel = (TRAND&7)+(sintable[T1&2047]>>9); T1 += (TRAND&63); - if( (T1&2047) > 512 && (T1&2047) < 1596) + if ( (T1&2047) > 512 && (T1&2047) < 1596) { - if(sector[sect].lotag == 2) + if (sector[sect].lotag == 2) { - if(s->zvel < 64) + if (s->zvel < 64) s->zvel += (gc>>5)+(TRAND&7); } else - if(s->zvel < 144) + if (s->zvel < 144) s->zvel += (gc>>5)+(TRAND&7); } ssp(i,CLIPMASK0); - if( (TRAND&3) == 0 ) + if ( (TRAND&3) == 0 ) setsprite(i,s->x,s->y,s->z); - if(s->sectnum == -1) KILLIT(i); + if (s->sectnum == -1) KILLIT(i); l = getflorzofslope(s->sectnum,s->x,s->y); - if( s->z > l ) + if ( s->z > l ) { s->z = l; @@ -4997,10 +5010,10 @@ void moveexplosions(void) // STATNUM 5 PN ++; j = headspritestat[5]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == BLOODPOOL) - if(ldist(s,&sprite[j]) < 348) + if (sprite[j].picnum == BLOODPOOL) + if (ldist(s,&sprite[j]) < 348) { s->pal = 2; break; @@ -5027,15 +5040,15 @@ void moveexplosions(void) // STATNUM 5 case DUKEGUN__STATIC: case DUKELEG__STATIC: - if(s->xvel > 0) s->xvel--; + if (s->xvel > 0) s->xvel--; else s->xvel = 0; - if( t[5] < 30*10 ) + if ( t[5] < 30*10 ) t[5]++; else { KILLIT(i); } - if(s->zvel > 1024 && s->zvel < 1280) + if (s->zvel > 1024 && s->zvel < 1280) { setsprite(i,s->x,s->y,s->z); sect = s->sectnum; @@ -5043,32 +5056,32 @@ void moveexplosions(void) // STATNUM 5 l = getflorzofslope(sect,s->x,s->y); x = getceilzofslope(sect,s->x,s->y); - if(x == l || sect < 0 || sect >= MAXSECTORS) KILLIT(i); + if (x == l || sect < 0 || sect >= MAXSECTORS) KILLIT(i); - if( s->z < l-(2<<8) ) + if ( s->z < l-(2<<8) ) { - if(t[1] < 2) t[1]++; - else if(sector[sect].lotag != 2) + if (t[1] < 2) t[1]++; + else if (sector[sect].lotag != 2) { t[1] = 0; - if( s->picnum == DUKELEG || s->picnum == DUKETORSO || s->picnum == DUKEGUN ) + if ( s->picnum == DUKELEG || s->picnum == DUKETORSO || s->picnum == DUKEGUN ) { - if(t[0] > 6) t[0] = 0; + if (t[0] > 6) t[0] = 0; else t[0]++; } else { - if(t[0] > 2) + if (t[0] > 2) t[0] = 0; else t[0]++; } } - if(s->zvel < 6144) + if (s->zvel < 6144) { - if(sector[sect].lotag == 2) + if (sector[sect].lotag == 2) { - if(s->zvel < 1024) + if (s->zvel < 1024) s->zvel += 48; else s->zvel = 1024; } @@ -5082,10 +5095,10 @@ void moveexplosions(void) // STATNUM 5 } else { - if(t[2] == 0) + if (t[2] == 0) { - if( s->sectnum == -1) { KILLIT(i); } - if( (sector[s->sectnum].floorstat&2) ) { KILLIT(i); } + if ( s->sectnum == -1) { KILLIT(i); } + if ( (sector[s->sectnum].floorstat&2) ) { KILLIT(i); } t[2]++; } l = getflorzofslope(s->sectnum,s->x,s->y); @@ -5093,24 +5106,25 @@ void moveexplosions(void) // STATNUM 5 s->z = l-(2<<8); s->xvel = 0; - if(s->picnum == JIBS6) + if (s->picnum == JIBS6) { t[1]++; - if( (t[1]&3) == 0 && t[0] < 7) + if ( (t[1]&3) == 0 && t[0] < 7) t[0]++; - if(t[1] > 20) KILLIT(i); + if (t[1] > 20) KILLIT(i); } else { s->picnum = JIBS6; t[0] = 0; t[1] = 0; } + } goto BOLT; case BLOODPOOL__STATIC: case PUKE__STATIC: - if(t[0] == 0) + if (t[0] == 0) { t[0] = 1; - if(sector[sect].floorstat&2) { KILLIT(i); } + if (sector[sect].floorstat&2) { KILLIT(i); } else insertspriteq(i); } @@ -5120,12 +5134,12 @@ void moveexplosions(void) // STATNUM 5 s->z = hittype[i].floorz-(FOURSLEIGHT); - if(t[2] < 32) + if (t[2] < 32) { t[2]++; - if(hittype[i].picnum == TIRE) + if (hittype[i].picnum == TIRE) { - if(s->xrepeat < 64 && s->yrepeat < 64) + if (s->xrepeat < 64 && s->yrepeat < 64) { s->xrepeat += TRAND&3; s->yrepeat += TRAND&3; @@ -5133,7 +5147,7 @@ void moveexplosions(void) // STATNUM 5 } else { - if(s->xrepeat < 32 && s->yrepeat < 32) + if (s->xrepeat < 32 && s->yrepeat < 32) { s->xrepeat += TRAND&3; s->yrepeat += TRAND&3; @@ -5141,15 +5155,15 @@ void moveexplosions(void) // STATNUM 5 } } - if(x < 844 && s->xrepeat > 6 && s->yrepeat > 6) + if (x < 844 && s->xrepeat > 6 && s->yrepeat > 6) { - if( s->pal == 0 && (TRAND&255) < 16 && s->picnum != PUKE) + if ( s->pal == 0 && (TRAND&255) < 16 && s->picnum != PUKE) { - if(ps[p].boot_amount > 0) + if (ps[p].boot_amount > 0) ps[p].boot_amount--; else { - if(!isspritemakingsound(ps[p].i,DUKE_LONGTERM_PAIN)) + if (!isspritemakingsound(ps[p].i,DUKE_LONGTERM_PAIN)) spritesound(DUKE_LONGTERM_PAIN,ps[p].i); sprite[ps[p].i].extra --; ps[p].pals_time = 32; @@ -5159,17 +5173,17 @@ void moveexplosions(void) // STATNUM 5 } } - if(t[1] == 1) goto BOLT; + if (t[1] == 1) goto BOLT; t[1] = 1; - if(hittype[i].picnum == TIRE) + if (hittype[i].picnum == TIRE) ps[p].footprintcount = 10; else ps[p].footprintcount = 3; ps[p].footprintpal = s->pal; ps[p].footprintshade = s->shade; - if(t[2] == 32) + if (t[2] == 32) { s->xrepeat -= 6; s->yrepeat -= 6; @@ -5200,34 +5214,34 @@ void moveexplosions(void) // STATNUM 5 ssp(i,CLIPMASK0); - if(sect < 0 || ( sector[sect].floorz + 256 ) < s->z ) KILLIT(i); + if (sect < 0 || ( sector[sect].floorz + 256 ) < s->z ) KILLIT(i); - if(sector[sect].lotag == 2) + if (sector[sect].lotag == 2) { t[1]++; - if(t[1] > 8) + if (t[1] > 8) { t[1] = 0; t[0]++; t[0] &= 3; } - if(s->zvel < 128) s->zvel += (gc/13); // 8 + if (s->zvel < 128) s->zvel += (gc/13); // 8 else s->zvel -= 64; - if(s->xvel > 0) + if (s->xvel > 0) s->xvel -= 4; else s->xvel = 0; } else { t[1]++; - if(t[1] > 3) + if (t[1] > 3) { t[1] = 0; t[0]++; t[0] &= 3; } - if(s->zvel < 512) s->zvel += (gc/3); // 52; - if(s->xvel > 0) + if (s->zvel < 512) s->zvel += (gc/3); // 52; + if (s->xvel > 0) s->xvel --; // else KILLIT(i); } @@ -5240,23 +5254,23 @@ void moveexplosions(void) // STATNUM 5 makeitfall(i); - if(s->zvel > 4096) s->zvel = 4096; - if(sect < 0) KILLIT(i); + if (s->zvel > 4096) s->zvel = 4096; + if (sect < 0) KILLIT(i); - if( s->z == hittype[i].floorz-(FOURSLEIGHT) && t[0] < 3) + if ( s->z == hittype[i].floorz-(FOURSLEIGHT) && t[0] < 3) { s->zvel = -((3-t[0])<<8)-(TRAND&511); - if(sector[sect].lotag == 2) + if (sector[sect].lotag == 2) s->zvel >>= 1; s->xrepeat >>= 1; s->yrepeat >>= 1; - if( rnd(96) ) + if ( rnd(96) ) setsprite(i,s->x,s->y,s->z); t[0]++;//Number of bounces } - else if( t[0] == 3 ) KILLIT(i); + else if ( t[0] == 3 ) KILLIT(i); - if(s->xvel > 0) + if (s->xvel > 0) { s->xvel -= 2; s->cstat = ((s->xvel&3)<<2); @@ -5270,44 +5284,44 @@ void moveexplosions(void) // STATNUM 5 IFWITHIN(SCRAP6,SCRAP5+3) { - if(s->xvel > 0) + if (s->xvel > 0) s->xvel--; else s->xvel = 0; - if(s->zvel > 1024 && s->zvel < 1280) + if (s->zvel > 1024 && s->zvel < 1280) { setsprite(i,s->x,s->y,s->z); sect = s->sectnum; } - if( s->z < sector[sect].floorz-(2<<8) ) + if ( s->z < sector[sect].floorz-(2<<8) ) { - if(t[1] < 1) t[1]++; + if (t[1] < 1) t[1]++; else { t[1] = 0; - if(s->picnum < SCRAP6+8) + if (s->picnum < SCRAP6+8) { - if(t[0] > 6) + if (t[0] > 6) t[0] = 0; else t[0]++; } else { - if(t[0] > 2) + if (t[0] > 2) t[0] = 0; else t[0]++; } } - if(s->zvel < 4096) s->zvel += gc-50; + if (s->zvel < 4096) s->zvel += gc-50; s->x += (s->xvel*sintable[(s->ang+512)&2047])>>14; s->y += (s->xvel*sintable[s->ang&2047])>>14; s->z += s->zvel; } else { - if(s->picnum == SCRAP1 && s->yvel > 0) + if (s->picnum == SCRAP1 && s->yvel > 0) { j = spawn(i,s->yvel); setsprite(j,s->x,s->y,s->z); @@ -5335,7 +5349,7 @@ void moveeffectors(void) //STATNUM 3 fricxv = fricyv = 0; i = headspritestat[3]; - while(i >= 0) + while (i >= 0) { nexti = nextspritestat[i]; s = &sprite[i]; @@ -5346,173 +5360,173 @@ void moveeffectors(void) //STATNUM 3 t = &hittype[i].temp_data[0]; - switch(st) + switch (st) { case 0: + { + long zchange = 0; + + zchange = 0; + + j = s->owner; + + if ( sprite[j].lotag == (short) 65535 ) + KILLIT(i); + + q = sc->extra>>3; + l = 0; + + if (sc->lotag == 30) { - long zchange = 0; + q >>= 2; - zchange = 0; - - j = s->owner; - - if( sprite[j].lotag == (short) 65535 ) - KILLIT(i); - - q = sc->extra>>3; - l = 0; - - if(sc->lotag == 30) + if ( sprite[i].extra == 1 ) { - q >>= 2; - - if( sprite[i].extra == 1 ) + if (hittype[i].tempang < 256) { - if(hittype[i].tempang < 256) - { - hittype[i].tempang += 4; - if(hittype[i].tempang >= 256) - callsound(s->sectnum,i); - if(s->clipdist) l = 1; - else l = -1; - } - else hittype[i].tempang = 256; - - if( sc->floorz > s->z ) //z's are touching - { - sc->floorz -= 512; - zchange = -512; - if( sc->floorz < s->z ) - sc->floorz = s->z; - } - - else if( sc->floorz < s->z ) //z's are touching - { - sc->floorz += 512; - zchange = 512; - if( sc->floorz > s->z ) - sc->floorz = s->z; - } + hittype[i].tempang += 4; + if (hittype[i].tempang >= 256) + callsound(s->sectnum,i); + if (s->clipdist) l = 1; + else l = -1; } - else if(sprite[i].extra == 3) + else hittype[i].tempang = 256; + + if ( sc->floorz > s->z ) //z's are touching { - if(hittype[i].tempang > 0) - { - hittype[i].tempang -= 4; - if(hittype[i].tempang <= 0) - callsound(s->sectnum,i); - if( s->clipdist ) l = -1; - else l = 1; - } - else hittype[i].tempang = 0; - - if( sc->floorz > T4 ) //z's are touching - { - sc->floorz -= 512; - zchange = -512; - if( sc->floorz < T4 ) - sc->floorz = T4; - } - - else if( sc->floorz < T4 ) //z's are touching - { - sc->floorz += 512; - zchange = 512; - if( sc->floorz > T4 ) - sc->floorz = T4; - } + sc->floorz -= 512; + zchange = -512; + if ( sc->floorz < s->z ) + sc->floorz = s->z; } - s->ang += (l*q); - t[2] += (l*q); + else if ( sc->floorz < s->z ) //z's are touching + { + sc->floorz += 512; + zchange = 512; + if ( sc->floorz > s->z ) + sc->floorz = s->z; + } } - else + else if (sprite[i].extra == 3) { - if( hittype[j].temp_data[0] == 0 ) break; - if( hittype[j].temp_data[0] == 2 ) KILLIT(i); + if (hittype[i].tempang > 0) + { + hittype[i].tempang -= 4; + if (hittype[i].tempang <= 0) + callsound(s->sectnum,i); + if ( s->clipdist ) l = -1; + else l = 1; + } + else hittype[i].tempang = 0; - if( sprite[j].ang > 1024 ) - l = -1; - else l = 1; - if( t[3] == 0 ) - t[3] = ldist(s,&sprite[j]); - s->xvel = t[3]; - s->x = sprite[j].x; - s->y = sprite[j].y; - s->ang += (l*q); - t[2] += (l*q); + if ( sc->floorz > T4 ) //z's are touching + { + sc->floorz -= 512; + zchange = -512; + if ( sc->floorz < T4 ) + sc->floorz = T4; + } + + else if ( sc->floorz < T4 ) //z's are touching + { + sc->floorz += 512; + zchange = 512; + if ( sc->floorz > T4 ) + sc->floorz = T4; + } } - if( l && (sc->floorstat&64) ) - { - for(p=connecthead;p>=0;p=connectpoint2[p]) - { - if( ps[p].cursectnum == s->sectnum && ps[p].on_ground == 1) - { + s->ang += (l*q); + t[2] += (l*q); + } + else + { + if ( hittype[j].temp_data[0] == 0 ) break; + if ( hittype[j].temp_data[0] == 2 ) KILLIT(i); - ps[p].ang += (l*q); - ps[p].ang &= 2047; - - ps[p].posz += zchange; - - rotatepoint( sprite[j].x,sprite[j].y, - ps[p].posx,ps[p].posy,(q*l), - &m,&x); - - ps[p].bobposx += m-ps[p].posx; - ps[p].bobposy += x-ps[p].posy; - - ps[p].posx = m; - ps[p].posy = x; - - if(sprite[ps[p].i].extra <= 0) - { - sprite[ps[p].i].x = m; - sprite[ps[p].i].y = x; - } - } - } - - p = headspritesect[s->sectnum]; - while(p >= 0) - { - if(sprite[p].statnum != 3 && sprite[p].statnum != 4) - if( sprite[p].picnum != LASERLINE ) - { - if(sprite[p].picnum == APLAYER && sprite[p].owner >= 0) - { - p = nextspritesect[p]; - continue; - } - - sprite[p].ang += (l*q); - sprite[p].ang &= 2047; - - sprite[p].z += zchange; - - rotatepoint(sprite[j].x,sprite[j].y, - sprite[p].x,sprite[p].y,(q*l), - &sprite[p].x,&sprite[p].y); - - } - p = nextspritesect[p]; - } - - } - - ms(i); + if ( sprite[j].ang > 1024 ) + l = -1; + else l = 1; + if ( t[3] == 0 ) + t[3] = ldist(s,&sprite[j]); + s->xvel = t[3]; + s->x = sprite[j].x; + s->y = sprite[j].y; + s->ang += (l*q); + t[2] += (l*q); } - break; + if ( l && (sc->floorstat&64) ) + { + for (p=connecthead;p>=0;p=connectpoint2[p]) + { + if ( ps[p].cursectnum == s->sectnum && ps[p].on_ground == 1) + { + + ps[p].ang += (l*q); + ps[p].ang &= 2047; + + ps[p].posz += zchange; + + rotatepoint( sprite[j].x,sprite[j].y, + ps[p].posx,ps[p].posy,(q*l), + &m,&x); + + ps[p].bobposx += m-ps[p].posx; + ps[p].bobposy += x-ps[p].posy; + + ps[p].posx = m; + ps[p].posy = x; + + if (sprite[ps[p].i].extra <= 0) + { + sprite[ps[p].i].x = m; + sprite[ps[p].i].y = x; + } + } + } + + p = headspritesect[s->sectnum]; + while (p >= 0) + { + if (sprite[p].statnum != 3 && sprite[p].statnum != 4) + if ( sprite[p].picnum != LASERLINE ) + { + if (sprite[p].picnum == APLAYER && sprite[p].owner >= 0) + { + p = nextspritesect[p]; + continue; + } + + sprite[p].ang += (l*q); + sprite[p].ang &= 2047; + + sprite[p].z += zchange; + + rotatepoint(sprite[j].x,sprite[j].y, + sprite[p].x,sprite[p].y,(q*l), + &sprite[p].x,&sprite[p].y); + + } + p = nextspritesect[p]; + } + + } + + ms(i); + } + + break; case 1: //Nothing for now used as the pivot - if(s->owner == -1) //Init + if (s->owner == -1) //Init { s->owner = i; j = headspritestat[3]; - while(j >= 0) + while (j >= 0) { - if( sprite[j].lotag == 19 && sprite[j].hitag == sh ) + if ( sprite[j].lotag == 19 && sprite[j].hitag == sh ) { t[0] = 0; break; @@ -5525,16 +5539,16 @@ void moveeffectors(void) //STATNUM 3 case 6: k = sc->extra; - if(t[4] > 0) + if (t[4] > 0) { t[4]--; - if( t[4] >= (k-(k>>3)) ) + if ( t[4] >= (k-(k>>3)) ) s->xvel -= (k>>5); - if( t[4] > ((k>>1)-1) && t[4] < (k-(k>>3)) ) + if ( t[4] > ((k>>1)-1) && t[4] < (k-(k>>3)) ) s->xvel = 0; - if( t[4] < (k>>1) ) + if ( t[4] < (k>>1) ) s->xvel += (k>>5); - if( t[4] < ((k>>1)-(k>>3)) ) + if ( t[4] < ((k>>1)-(k>>3)) ) { t[4] = 0; s->xvel = k; @@ -5543,17 +5557,17 @@ void moveeffectors(void) //STATNUM 3 else s->xvel = k; j = headspritestat[3]; - while( j >= 0) + while ( j >= 0) { - if( (sprite[j].lotag == 14) && (sh == sprite[j].hitag) && (hittype[j].temp_data[0] == t[0]) ) + if ( (sprite[j].lotag == 14) && (sh == sprite[j].hitag) && (hittype[j].temp_data[0] == t[0]) ) { sprite[j].xvel = s->xvel; // if( t[4] == 1 ) { - if(hittype[j].temp_data[5] == 0) + if (hittype[j].temp_data[5] == 0) hittype[j].temp_data[5] = dist(&sprite[j],s); x = ksgn( dist(&sprite[j],s)-hittype[j].temp_data[5] ); - if(sprite[j].extra) + if (sprite[j].extra) x = -x; s->xvel += x; } @@ -5565,10 +5579,10 @@ void moveeffectors(void) //STATNUM 3 case 14: - if(s->owner==-1) + if (s->owner==-1) s->owner = LocateTheLocator((short)t[3],(short)t[0]); - if(s->owner == -1) + if (s->owner == -1) { Bsprintf(tempbuf,"Could not find any locators for SE# 6 and 14 with a hitag of %ld.\n",t[3]); gameexit(tempbuf); @@ -5576,21 +5590,21 @@ void moveeffectors(void) //STATNUM 3 j = ldist(&sprite[s->owner],s); - if( j < 1024L ) + if ( j < 1024L ) { - if(st==6) - if(sprite[s->owner].hitag&1) + if (st==6) + if (sprite[s->owner].hitag&1) t[4]=sc->extra; //Slow it down t[3]++; s->owner = LocateTheLocator(t[3],t[0]); - if(s->owner==-1) + if (s->owner==-1) { t[3]=0; s->owner = LocateTheLocator(0,t[0]); } } - if(s->xvel) + if (s->xvel) { x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); q = getincangle(s->ang,x)>>3; @@ -5598,17 +5612,17 @@ void moveeffectors(void) //STATNUM 3 t[2] += q; s->ang += q; - if(s->xvel == sc->extra ) + if (s->xvel == sc->extra ) { - if( (sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0 ) + if ( (sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0 ) { - if( !issoundplaying(i,hittype[i].lastvx) ) + if ( !issoundplaying(i,hittype[i].lastvx) ) spritesound(hittype[i].lastvx,i); } - else if( ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat&1) && rnd(8) ) + else if ( ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat&1) && rnd(8) ) { p = findplayer(s,&x); - if(x < 20480) + if (x < 20480) { j = s->ang; s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); @@ -5618,18 +5632,18 @@ void moveeffectors(void) //STATNUM 3 } } - if(s->xvel <= 64 && (sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0 ) + if (s->xvel <= 64 && (sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0 ) stopspritesound(hittype[i].lastvx,i); - if( (sc->floorz-sc->ceilingz) < (108<<8) ) + if ( (sc->floorz-sc->ceilingz) < (108<<8) ) { - if(ud.clipping == 0 && s->xvel >= 192) - for(p=connecthead;p>=0;p=connectpoint2[p]) - if(sprite[ps[p].i].extra > 0) + if (ud.clipping == 0 && s->xvel >= 192) + for (p=connecthead;p>=0;p=connectpoint2[p]) + if (sprite[ps[p].i].extra > 0) { k = ps[p].cursectnum; updatesector(ps[p].posx,ps[p].posy,&k); - if( ( k == -1 && ud.clipping == 0 ) || ( k == s->sectnum && ps[p].cursectnum != s->sectnum ) ) + if ( ( k == -1 && ud.clipping == 0 ) || ( k == s->sectnum && ps[p].cursectnum != s->sectnum ) ) { ps[p].posx = s->x; ps[p].posy = s->y; @@ -5644,16 +5658,16 @@ void 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]) - if(sector[ps[p].cursectnum].lotag != 2) + for (p = connecthead;p >= 0;p=connectpoint2[p]) + if (sector[ps[p].cursectnum].lotag != 2) { - if(po[p].os == s->sectnum) + if (po[p].os == s->sectnum) { po[p].ox += m; po[p].oy += x; } - if(s->sectnum == sprite[ps[p].i].sectnum) + if (s->sectnum == sprite[ps[p].i].sectnum) { rotatepoint(s->x,s->y,ps[p].posx,ps[p].posy,q,&ps[p].posx,&ps[p].posy); @@ -5665,12 +5679,12 @@ void moveeffectors(void) //STATNUM 3 ps[p].ang += q; - if(numplayers > 1) + if (numplayers > 1) { ps[p].oposx = ps[p].posx; ps[p].oposy = ps[p].posy; } - if( sprite[ps[p].i].extra <= 0 ) + if ( sprite[ps[p].i].extra <= 0 ) { sprite[ps[p].i].x = ps[p].posx; sprite[ps[p].i].y = ps[p].posy; @@ -5678,7 +5692,7 @@ void moveeffectors(void) //STATNUM 3 } } j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { if (sprite[j].statnum != 10 && sector[sprite[j].sectnum].lotag != 2 && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS ) { @@ -5691,7 +5705,7 @@ void moveeffectors(void) //STATNUM 3 sprite[j].ang+=q; - if(numplayers > 1) + if (numplayers > 1) { hittype[j].bposx = sprite[j].x; hittype[j].bposy = sprite[j].y; @@ -5703,15 +5717,15 @@ void moveeffectors(void) //STATNUM 3 ms(i); setsprite(i,s->x,s->y,s->z); - if( (sc->floorz-sc->ceilingz) < (108<<8) ) + if ( (sc->floorz-sc->ceilingz) < (108<<8) ) { - if(ud.clipping == 0 && s->xvel >= 192) - for(p=connecthead;p>=0;p=connectpoint2[p]) - if(sprite[ps[p].i].extra > 0) + if (ud.clipping == 0 && s->xvel >= 192) + for (p=connecthead;p>=0;p=connectpoint2[p]) + if (sprite[ps[p].i].extra > 0) { k = ps[p].cursectnum; updatesector(ps[p].posx,ps[p].posy,&k); - if( ( k == -1 && ud.clipping == 0 ) || ( k == s->sectnum && ps[p].cursectnum != s->sectnum ) ) + if ( ( k == -1 && ud.clipping == 0 ) || ( k == s->sectnum && ps[p].cursectnum != s->sectnum ) ) { ps[p].oposx = ps[p].posx = s->x; ps[p].oposy = ps[p].posy = s->y; @@ -5723,14 +5737,14 @@ void moveeffectors(void) //STATNUM 3 } j = headspritesect[sprite[OW].sectnum]; - while(j >= 0) + while (j >= 0) { l = nextspritesect[j]; if (sprite[j].statnum == 1 && badguy(&sprite[j]) && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS ) { k = sprite[j].sectnum; updatesector(sprite[j].x,sprite[j].y,&k); - if( sprite[j].extra >= 0 && k == s->sectnum ) + if ( sprite[j].extra >= 0 && k == s->sectnum ) { gutsdir(&sprite[j],JIBS6,72,myconnectindex); spritesound(SQUISHED,i); @@ -5745,7 +5759,7 @@ void moveeffectors(void) //STATNUM 3 break; case 30: - if(s->owner == -1) + if (s->owner == -1) { t[3] = !t[3]; s->owner = LocateTheLocator(t[3],t[0]); @@ -5753,26 +5767,26 @@ void moveeffectors(void) //STATNUM 3 else { - if(t[4] == 1) // Starting to go + if (t[4] == 1) // Starting to go { - if( ldist( &sprite[s->owner],s ) < (2048-128) ) + if ( ldist( &sprite[s->owner],s ) < (2048-128) ) t[4] = 2; else { - if(s->xvel == 0) + if (s->xvel == 0) operateactivators(s->hitag+(!t[3]),-1); - if(s->xvel < 256) + if (s->xvel < 256) s->xvel += 16; } } - if(t[4] == 2) + if (t[4] == 2) { l = FindDistance2D(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); - if(l <= 128) + if (l <= 128) s->xvel = 0; - if( s->xvel > 0 ) + if ( s->xvel > 0 ) s->xvel -= 16; else { @@ -5784,9 +5798,9 @@ void moveeffectors(void) //STATNUM 3 operateforcefields(i,s->hitag); j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS ) + if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS ) { hittype[j].bposx = sprite[j].x; hittype[j].bposy = sprite[j].y; @@ -5798,19 +5812,19 @@ void moveeffectors(void) //STATNUM 3 } } - if(s->xvel) + if (s->xvel) { l = (s->xvel*sintable[(s->ang+512)&2047])>>14; x = (s->xvel*sintable[s->ang&2047])>>14; - if( (sc->floorz-sc->ceilingz) < (108<<8) ) - if(ud.clipping == 0) - for(p=connecthead;p>=0;p=connectpoint2[p]) - if(sprite[ps[p].i].extra > 0) + if ( (sc->floorz-sc->ceilingz) < (108<<8) ) + if (ud.clipping == 0) + for (p=connecthead;p>=0;p=connectpoint2[p]) + if (sprite[ps[p].i].extra > 0) { k = ps[p].cursectnum; updatesector(ps[p].posx,ps[p].posy,&k); - if( ( k == -1 && ud.clipping == 0 ) || ( k == s->sectnum && ps[p].cursectnum != s->sectnum ) ) + if ( ( k == -1 && ud.clipping == 0 ) || ( k == s->sectnum && ps[p].cursectnum != s->sectnum ) ) { ps[p].posx = s->x; ps[p].posy = s->y; @@ -5821,14 +5835,14 @@ void moveeffectors(void) //STATNUM 3 } } - for(p = connecthead;p >= 0;p = connectpoint2[p]) + for (p = connecthead;p >= 0;p = connectpoint2[p]) { - if( sprite[ps[p].i].sectnum == s->sectnum ) + if ( sprite[ps[p].i].sectnum == s->sectnum ) { ps[p].posx += l; ps[p].posy += x; - if(numplayers > 1) + if (numplayers > 1) { ps[p].oposx = ps[p].posx; ps[p].oposy = ps[p].posy; @@ -5838,7 +5852,7 @@ void moveeffectors(void) //STATNUM 3 ps[p].bobposy += x; } - if( po[p].os == s->sectnum ) + if ( po[p].os == s->sectnum ) { po[p].ox += l; po[p].oy += x; @@ -5846,11 +5860,11 @@ void moveeffectors(void) //STATNUM 3 } j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS ) + if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS ) { - if(numplayers < 2) + if (numplayers < 2) { hittype[j].bposx = sprite[j].x; hittype[j].bposy = sprite[j].y; @@ -5859,7 +5873,7 @@ void moveeffectors(void) //STATNUM 3 sprite[j].x += l; sprite[j].y += x; - if(numplayers > 1) + if (numplayers > 1) { hittype[j].bposx = sprite[j].x; hittype[j].bposy = sprite[j].y; @@ -5871,15 +5885,15 @@ void moveeffectors(void) //STATNUM 3 ms(i); setsprite(i,s->x,s->y,s->z); - if( (sc->floorz-sc->ceilingz) < (108<<8) ) + if ( (sc->floorz-sc->ceilingz) < (108<<8) ) { - if(ud.clipping == 0) - for(p=connecthead;p>=0;p=connectpoint2[p]) - if(sprite[ps[p].i].extra > 0) + if (ud.clipping == 0) + for (p=connecthead;p>=0;p=connectpoint2[p]) + if (sprite[ps[p].i].extra > 0) { k = ps[p].cursectnum; updatesector(ps[p].posx,ps[p].posy,&k); - if( ( k == -1 && ud.clipping == 0 ) || ( k == s->sectnum && ps[p].cursectnum != s->sectnum ) ) + if ( ( k == -1 && ud.clipping == 0 ) || ( k == s->sectnum && ps[p].cursectnum != s->sectnum ) ) { ps[p].posx = s->x; ps[p].posy = s->y; @@ -5895,7 +5909,7 @@ void moveeffectors(void) //STATNUM 3 } j = headspritesect[sprite[OW].sectnum]; - while(j >= 0) + while (j >= 0) { l = nextspritesect[j]; if (sprite[j].statnum == 1 && badguy(&sprite[j]) && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS ) @@ -5904,7 +5918,7 @@ void moveeffectors(void) //STATNUM 3 { k = sprite[j].sectnum; updatesector(sprite[j].x,sprite[j].y,&k); - if( sprite[j].extra >= 0 && k == s->sectnum ) + if ( sprite[j].extra >= 0 && k == s->sectnum ) { gutsdir(&sprite[j],JIBS6,24,myconnectindex); spritesound(SQUISHED,j); @@ -5922,20 +5936,20 @@ void moveeffectors(void) //STATNUM 3 case 2://Quakes - if(t[4] > 0 && t[0] == 0 ) + if (t[4] > 0 && t[0] == 0 ) { - if( t[4] < sh ) + if ( t[4] < sh ) t[4]++; else t[0] = 1; } - if(t[0] > 0) + if (t[0] > 0) { t[0]++; s->xvel = 3; - if(t[0] > 96) + if (t[0] > 96) { t[0] = -1; //Stop the quake t[4] = -1; @@ -5943,13 +5957,13 @@ void moveeffectors(void) //STATNUM 3 } else { - if( (t[0]&31) == 8 ) + if ( (t[0]&31) == 8 ) { earthquaketime = 48; spritesound(EARTHQUAKE,ps[screenpeek].i); } - if( klabs( sc->floorheinum-t[5] ) < 8 ) + if ( klabs( sc->floorheinum-t[5] ) < 8 ) sc->floorheinum = t[5]; else sc->floorheinum += ( ksgn(t[5]-sc->floorheinum)<<4 ); } @@ -5958,8 +5972,8 @@ void moveeffectors(void) //STATNUM 3 x = (s->xvel*sintable[s->ang&2047])>>14; - for(p=connecthead;p>=0;p=connectpoint2[p]) - if(ps[p].cursectnum == s->sectnum && ps[p].on_ground) + for (p=connecthead;p>=0;p=connectpoint2[p]) + if (ps[p].cursectnum == s->sectnum && ps[p].on_ground) { ps[p].posx += m; ps[p].posy += x; @@ -5969,7 +5983,7 @@ void moveeffectors(void) //STATNUM 3 } j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { nextj = nextspritesect[j]; @@ -5990,12 +6004,12 @@ void moveeffectors(void) //STATNUM 3 case 3: - if( t[4] == 0 ) break; + if ( t[4] == 0 ) break; p = findplayer(s,&x); // if(t[5] > 0) { t[5]--; break; } - if( (global_random/(sh+1)&31) < 4 && !t[2]) + if ( (global_random/(sh+1)&31) < 4 && !t[2]) { // t[5] = 4+(global_random&7); sc->ceilingpal = s->owner>>8; @@ -6015,12 +6029,12 @@ void 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 ) + if ( wal->hitag != 1 ) { wal->shade = t[0]; - if((wal->cstat&2) && wal->nextwall >= 0) + if ((wal->cstat&2) && wal->nextwall >= 0) { wall[wal->nextwall].shade = wal->shade; } @@ -6031,7 +6045,7 @@ void moveeffectors(void) //STATNUM 3 case 4: - if((global_random/(sh+1)&31) < 4 ) + if ((global_random/(sh+1)&31) < 4 ) { t[1] = s->shade + (global_random&15);//Got really bright t[0] = s->shade + (global_random&15); @@ -6055,23 +6069,23 @@ void 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); + if (j) wal->pal = (s->owner&0xff); else wal->pal = s->pal; - if( wal->hitag != 1 ) + if ( wal->hitag != 1 ) { wal->shade = t[0]; - if((wal->cstat&2) && wal->nextwall >= 0) + if ((wal->cstat&2) && wal->nextwall >= 0) wall[wal->nextwall].shade = wal->shade; } } j = headspritesect[SECT]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].cstat&16 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) + if (sprite[j].cstat&16 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) { if (sc->ceilingstat&1) sprite[j].shade = sc->ceilingshade; @@ -6081,14 +6095,14 @@ void moveeffectors(void) //STATNUM 3 j = nextspritesect[j]; } - if(t[4]) KILLIT(i); + if (t[4]) KILLIT(i); break; //BOSS case 5: p = findplayer(s,&x); - if(x < 8192) + if (x < 8192) { j = s->ang; s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); @@ -6096,19 +6110,19 @@ void moveeffectors(void) //STATNUM 3 s->ang = j; } - if(s->owner==-1) //Start search + if (s->owner==-1) //Start search { t[4]=0; l = 0x7fffffff; - while(1) //Find the shortest dist + while (1) //Find the shortest dist { s->owner = LocateTheLocator((short)t[4],-1); //t[0] hold sectnum - if(s->owner==-1) break; + if (s->owner==-1) break; m = ldist(&sprite[ps[p].i],&sprite[s->owner]); - if(l > m) + if (l > m) { q = s->owner; l = m; @@ -6121,7 +6135,7 @@ void moveeffectors(void) //STATNUM 3 s->zvel = ksgn(sprite[q].z-s->z)<<4; } - if(ldist(&sprite[s->owner],s) < 1024) + if (ldist(&sprite[s->owner],s) < 1024) { short ta; ta = s->ang; @@ -6137,7 +6151,7 @@ void moveeffectors(void) //STATNUM 3 q = getincangle(s->ang,x)>>3; s->ang += q; - if(rnd(32)) + if (rnd(32)) { t[2]+=q; sc->ceilingshade = 127; @@ -6151,7 +6165,7 @@ void moveeffectors(void) //STATNUM 3 IFHIT { t[3]++; - if(t[3] == 5) + if (t[3] == 5) { s->zvel += 1024; FTA(7,&ps[myconnectindex]); @@ -6173,19 +6187,19 @@ void moveeffectors(void) //STATNUM 3 j = -1; - if(hittype[i].temp_data[4]) + if (hittype[i].temp_data[4]) { hittype[i].temp_data[4]++; - if( hittype[i].temp_data[4] > 8 ) KILLIT(i); + if ( hittype[i].temp_data[4] > 8 ) KILLIT(i); j = 1; } else j = getanimationgoal(&sc->ceilingz); - if( j >= 0 ) + if ( j >= 0 ) { short sn; - if( (sc->lotag&0x8000) || hittype[i].temp_data[4] ) + if ( (sc->lotag&0x8000) || hittype[i].temp_data[4] ) x = -t[3]; else x = t[3]; @@ -6193,28 +6207,28 @@ void moveeffectors(void) //STATNUM 3 if ( st == 9 ) x = -x; j = headspritestat[3]; - while(j >= 0) + while (j >= 0) { - if( ((sprite[j].lotag) == st ) && (sprite[j].hitag) == sh ) + if ( ((sprite[j].lotag) == st ) && (sprite[j].hitag) == sh ) { sn = sprite[j].sectnum; m = sprite[j].shade; 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 ) + if ( wal->hitag != 1 ) { wal->shade+=x; - if(wal->shade < m) + if (wal->shade < m) wal->shade = m; - else if(wal->shade > hittype[j].temp_data[2]) + else if (wal->shade > hittype[j].temp_data[2]) wal->shade = hittype[j].temp_data[2]; - if(wal->nextwall >= 0) - if(wall[wal->nextwall].hitag != 1) + if (wal->nextwall >= 0) + if (wall[wal->nextwall].hitag != 1) wall[wal->nextwall].shade = wal->shade; } } @@ -6222,14 +6236,14 @@ void moveeffectors(void) //STATNUM 3 sector[sn].floorshade += x; sector[sn].ceilingshade += x; - if(sector[sn].floorshade < m) + if (sector[sn].floorshade < m) sector[sn].floorshade = m; - else if(sector[sn].floorshade > hittype[j].temp_data[0]) + else if (sector[sn].floorshade > hittype[j].temp_data[0]) sector[sn].floorshade = hittype[j].temp_data[0]; - if(sector[sn].ceilingshade < m) + if (sector[sn].ceilingshade < m) sector[sn].ceilingshade = m; - else if(sector[sn].ceilingshade > hittype[j].temp_data[1]) + else if (sector[sn].ceilingshade > hittype[j].temp_data[1]) sector[sn].ceilingshade = hittype[j].temp_data[1]; } @@ -6239,26 +6253,26 @@ void moveeffectors(void) //STATNUM 3 break; case 10: - if( (sc->lotag&0xff) == 27 || ( sc->floorz > sc->ceilingz && (sc->lotag&0xff) != 23 ) || sc->lotag == (short) 32791 ) + if ( (sc->lotag&0xff) == 27 || ( sc->floorz > sc->ceilingz && (sc->lotag&0xff) != 23 ) || sc->lotag == (short) 32791 ) { j = 1; - if( (sc->lotag&0xff) != 27) - for(p=connecthead;p>=0;p=connectpoint2[p]) - if( sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0 ) - if(s->sectnum == sprite[ps[p].i].sectnum) + if ( (sc->lotag&0xff) != 27) + for (p=connecthead;p>=0;p=connectpoint2[p]) + if ( sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0 ) + if (s->sectnum == sprite[ps[p].i].sectnum) j = 0; - if(j == 1) + if (j == 1) { - if(t[0] > sh ) - switch(sector[s->sectnum].lotag) + if (t[0] > sh ) + switch (sector[s->sectnum].lotag) { case 20: case 21: case 22: case 26: - if( getanimationgoal(§or[s->sectnum].ceilingz) >= 0 ) + if ( getanimationgoal(§or[s->sectnum].ceilingz) >= 0 ) break; default: activatebysector(s->sectnum,i); @@ -6272,33 +6286,33 @@ void moveeffectors(void) //STATNUM 3 break; case 11: //Swingdoor - if( t[5] > 0) + if ( t[5] > 0) { t[5]--; break; } - if( t[4] ) + if ( t[4] ) { short startwall,endwall; startwall = sc->wallptr; endwall = startwall+sc->wallnum; - for(j=startwall;j= 0) + while (k >= 0) { - if( sprite[k].extra > 0 && badguy(&sprite[k]) && clipinsidebox(sprite[k].x,sprite[k].y,j,256L) == 1 ) + if ( sprite[k].extra > 0 && badguy(&sprite[k]) && clipinsidebox(sprite[k].x,sprite[k].y,j,256L) == 1 ) goto BOLT; k = nextspritestat[k]; } k = headspritestat[10]; - while(k >= 0) + while (k >= 0) { - if( sprite[k].owner >= 0 && clipinsidebox(sprite[k].x,sprite[k].y,j,144L) == 1 ) + if ( sprite[k].owner >= 0 && clipinsidebox(sprite[k].x,sprite[k].y,j,144L) == 1 ) { t[5] = 8; // Delay k = (SP>>3)*t[3]; @@ -6318,7 +6332,7 @@ void moveeffectors(void) //STATNUM 3 ms(i); setsprite(i,s->x,s->y,s->z); - if(t[4] <= -511 || t[4] >= 512) + if (t[4] <= -511 || t[4] >= 512) { t[4] = 0; t[2] &= 0xffffff00; @@ -6329,14 +6343,14 @@ void moveeffectors(void) //STATNUM 3 } break; case 12: - if( t[0] == 3 || t[3] == 1 ) //Lights going off + if ( t[0] == 3 || t[3] == 1 ) //Lights going off { sc->floorpal = 0; sc->ceilingpal = 0; wal = &wall[sc->wallptr]; - for(j = sc->wallnum;j > 0; j--, wal++) - if(wal->hitag != 1) + for (j = sc->wallnum;j > 0; j--, wal++) + if (wal->hitag != 1) { wal->shade = t[1]; wal->pal = 0; @@ -6347,9 +6361,9 @@ void moveeffectors(void) //STATNUM 3 t[0]=0; j = headspritesect[SECT]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].cstat&16 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) + if (sprite[j].cstat&16 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) { if (sc->ceilingstat&1) sprite[j].shade = sc->ceilingshade; @@ -6359,11 +6373,11 @@ void moveeffectors(void) //STATNUM 3 } - if(t[3] == 1) KILLIT(i); + if (t[3] == 1) KILLIT(i); } - if( t[0] == 1 ) //Lights flickering on + if ( t[0] == 1 ) //Lights flickering on { - if( sc->floorshade > s->shade ) + if ( sc->floorshade > s->shade ) { sc->floorpal = s->pal; sc->ceilingpal = s->pal; @@ -6372,8 +6386,8 @@ void moveeffectors(void) //STATNUM 3 sc->ceilingshade -= 2; wal = &wall[sc->wallptr]; - for(j=sc->wallnum;j>0;j--,wal++) - if(wal->hitag != 1) + for (j=sc->wallnum;j>0;j--,wal++) + if (wal->hitag != 1) { wal->pal = s->pal; wal->shade -= 2; @@ -6382,9 +6396,9 @@ void moveeffectors(void) //STATNUM 3 else t[0] = 2; j = headspritesect[SECT]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].cstat&16) + if (sprite[j].cstat&16) { if (sc->ceilingstat&1 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) sprite[j].shade = sc->ceilingshade; @@ -6397,51 +6411,51 @@ void moveeffectors(void) //STATNUM 3 case 13: - if( t[2] ) + if ( t[2] ) { j = (SP<<5)|1; - if( s->ang == 512 ) + if ( s->ang == 512 ) { - if( s->owner ) + if ( s->owner ) { - if( klabs(t[0]-sc->ceilingz) >= j ) + if ( klabs(t[0]-sc->ceilingz) >= j ) sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j; else sc->ceilingz = t[0]; } else { - if( klabs(t[1]-sc->floorz) >= j ) + if ( klabs(t[1]-sc->floorz) >= j ) sc->floorz += ksgn(t[1]-sc->floorz)*j; else sc->floorz = t[1]; } } else { - if( klabs(t[1]-sc->floorz) >= j ) + if ( klabs(t[1]-sc->floorz) >= j ) sc->floorz += ksgn(t[1]-sc->floorz)*j; else sc->floorz = t[1]; - if( klabs(t[0]-sc->ceilingz) >= j ) + if ( klabs(t[0]-sc->ceilingz) >= j ) sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j; sc->ceilingz = t[0]; } - if( t[3] == 1 ) + if ( t[3] == 1 ) { //Change the shades t[3]++; sc->ceilingstat ^= 1; - if(s->ang == 512) + 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; - if(ps[0].one_parallax_sectnum >= 0) + if (ps[0].one_parallax_sectnum >= 0) { sc->ceilingpicnum = sector[ps[0].one_parallax_sectnum].ceilingpicnum; @@ -6451,25 +6465,25 @@ void moveeffectors(void) //STATNUM 3 } } t[2]++; - if(t[2] > 256) + if (t[2] > 256) KILLIT(i); } - if( t[2] == 4 && s->ang != 512) - for(x=0;x<7;x++) RANDOMSCRAP; + if ( t[2] == 4 && s->ang != 512) + for (x=0;x<7;x++) RANDOMSCRAP; break; case 15: - if(t[4]) + if (t[4]) { s->xvel = 16; - if(t[4] == 1) //Opening + if (t[4] == 1) //Opening { - if( t[3] >= (SP>>3) ) + if ( t[3] >= (SP>>3) ) { t[4] = 0; //Turn off the sliders callsound(s->sectnum,i); @@ -6477,9 +6491,9 @@ void moveeffectors(void) //STATNUM 3 } t[3]++; } - else if(t[4] == 2) + else if (t[4] == 2) { - if(t[3]<1) + if (t[3]<1) { t[4] = 0; callsound(s->sectnum,i); @@ -6496,9 +6510,9 @@ void moveeffectors(void) //STATNUM 3 case 16: //Reactor t[2]+=32; - if(sc->floorzceilingz) s->shade=0; + if (sc->floorzceilingz) s->shade=0; - else if( sc->ceilingz < t[3] ) + else if ( sc->ceilingz < t[3] ) { //The following code check to see if @@ -6507,17 +6521,17 @@ void moveeffectors(void) //STATNUM 3 //itself..... j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == REACTOR || sprite[j].picnum == REACTOR2) + if (sprite[j].picnum == REACTOR || sprite[j].picnum == REACTOR2) break; j = nextspritesect[j]; } - if(j == -1) { KILLIT(i); } + if (j == -1) { KILLIT(i); } else s->shade=1; } - if(s->shade) sc->ceilingz+=1024; + if (s->shade) sc->ceilingz+=1024; else sc->ceilingz-=512; ms(i); @@ -6533,20 +6547,20 @@ void moveeffectors(void) //STATNUM 3 sc->floorz += q; j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].statnum == 10 && sprite[j].owner >= 0) + if (sprite[j].statnum == 10 && sprite[j].owner >= 0) { p = sprite[j].yvel; - if(numplayers < 2) + if (numplayers < 2) ps[p].oposz = ps[p].posz; ps[p].posz += q; ps[p].truefz += q; ps[p].truecz += q; - if(numplayers > 1) + if (numplayers > 1) ps[p].oposz = ps[p].posz; } - if( sprite[j].statnum != 3 ) + if ( sprite[j].statnum != 3 ) { hittype[j].bposz = sprite[j].z; sprite[j].z += q; @@ -6558,43 +6572,43 @@ void moveeffectors(void) //STATNUM 3 j = nextspritesect[j]; } - if( t[0] ) if(t[0]) //If in motion + if ( t[0] ) if (t[0]) //If in motion { - if( klabs(sc->floorz-t[2]) <= SP) + if ( klabs(sc->floorz-t[2]) <= SP) { activatewarpelevators(i,0); break; } - if(t[0]==-1) + if (t[0]==-1) { - if( sc->floorz > t[3] ) + if ( sc->floorz > t[3] ) break; } - else if( sc->ceilingz < t[4] ) break; + else if ( sc->ceilingz < t[4] ) break; - if( t[1] == 0 ) break; + if ( t[1] == 0 ) break; t[1] = 0; j = headspritestat[3]; - while(j >= 0) + while (j >= 0) { - if( i != j && (sprite[j].lotag) == 17) - if( (sc->hitag-t[0]) == + if ( i != j && (sprite[j].lotag) == 17) + if ( (sc->hitag-t[0]) == (sector[sprite[j].sectnum].hitag) && sh == (sprite[j].hitag)) break; j = nextspritestat[j]; } - if(j == -1) break; + if (j == -1) break; k = headspritesect[s->sectnum]; - while(k >= 0) + while (k >= 0) { nextk = nextspritesect[k]; - if(sprite[k].statnum == 10 && sprite[k].owner >= 0) + if (sprite[k].statnum == 10 && sprite[k].owner >= 0) { p = sprite[k].yvel; @@ -6616,7 +6630,7 @@ void moveeffectors(void) //STATNUM 3 changespritesect(k,sprite[j].sectnum); ps[p].cursectnum = sprite[j].sectnum; } - else if( sprite[k].statnum != 3 ) + else if ( sprite[k].statnum != 3 ) { sprite[k].x += sprite[j].x-s->x; @@ -6642,14 +6656,14 @@ void moveeffectors(void) //STATNUM 3 break; case 18: - if(t[0]) + if (t[0]) { - if(s->pal) + if (s->pal) { - if(s->ang == 512) + if (s->ang == 512) { sc->ceilingz -= sc->extra; - if(sc->ceilingz <= t[1]) + if (sc->ceilingz <= t[1]) { sc->ceilingz = t[1]; KILLIT(i); @@ -6659,19 +6673,19 @@ void moveeffectors(void) //STATNUM 3 { sc->floorz += sc->extra; j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if( ps[sprite[j].yvel].on_ground == 1 ) + if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) + if ( ps[sprite[j].yvel].on_ground == 1 ) ps[sprite[j].yvel].posz += sc->extra; - if( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) + if ( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { hittype[j].bposz = sprite[j].z += sc->extra; hittype[j].floorz = sc->floorz; } j = nextspritesect[j]; } - if(sc->floorz >= t[1]) + if (sc->floorz >= t[1]) { sc->floorz = t[1]; KILLIT(i); @@ -6680,10 +6694,10 @@ void moveeffectors(void) //STATNUM 3 } else { - if(s->ang == 512) + if (s->ang == 512) { sc->ceilingz += sc->extra; - if(sc->ceilingz >= s->z) + if (sc->ceilingz >= s->z) { sc->ceilingz = s->z; KILLIT(i); @@ -6693,19 +6707,19 @@ void moveeffectors(void) //STATNUM 3 { sc->floorz -= sc->extra; j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if( ps[sprite[j].yvel].on_ground == 1 ) + if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) + if ( ps[sprite[j].yvel].on_ground == 1 ) ps[sprite[j].yvel].posz -= sc->extra; - if( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) + if ( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { hittype[j].bposz = sprite[j].z -= sc->extra; hittype[j].floorz = sc->floorz; } j = nextspritesect[j]; } - if(sc->floorz <= s->z) + if (sc->floorz <= s->z) { sc->floorz = s->z; KILLIT(i); @@ -6714,7 +6728,7 @@ void moveeffectors(void) //STATNUM 3 } t[2]++; - if(t[2] >= s->hitag) + if (t[2] >= s->hitag) { t[2] = 0; t[0] = 0; @@ -6724,19 +6738,19 @@ void moveeffectors(void) //STATNUM 3 case 19: //Battlestar galactia shields - if(t[0]) + if (t[0]) { - if(t[0] == 1) + if (t[0] == 1) { t[0]++; x = sc->wallptr; q = x+sc->wallnum; - for(j=x;j= 0) + if (wall[j].nextwall >= 0) { wall[wall[j].nextwall].overpicnum = 0; wall[wall[j].nextwall].cstat &= (128+32+8+4+2); @@ -6744,16 +6758,16 @@ void moveeffectors(void) //STATNUM 3 } } - if(sc->ceilingz < sc->floorz) + if (sc->ceilingz < sc->floorz) sc->ceilingz += SP; else { sc->ceilingz = sc->floorz; j = headspritestat[3]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].lotag == 0 && sprite[j].hitag==sh) + if (sprite[j].lotag == 0 && sprite[j].hitag==sh) { q = sprite[sprite[j].owner].sectnum; sector[sprite[j].sectnum].floorpal = sector[sprite[j].sectnum].ceilingpal = @@ -6775,13 +6789,13 @@ void moveeffectors(void) //STATNUM 3 FTA(8,&ps[myconnectindex]); l = headspritestat[3]; - while(l >= 0) + while (l >= 0) { x = sprite[l].lotag&0x7fff; - switch( x ) + switch ( x ) { case 0: - if(sprite[l].hitag == sh) + if (sprite[l].hitag == sh) { q = sprite[l].sectnum; sector[q].floorshade = @@ -6798,8 +6812,8 @@ void moveeffectors(void) //STATNUM 3 // case 18: case 19: - if( sh == sprite[l].hitag ) - if( hittype[l].temp_data[0] == 0 ) + if ( sh == sprite[l].hitag ) + if ( hittype[l].temp_data[0] == 0 ) { hittype[l].temp_data[0] = 1; //Shut them all on sprite[l].owner = i; @@ -6816,11 +6830,11 @@ void moveeffectors(void) //STATNUM 3 case 20: //Extend-o-bridge - if( t[0] == 0 ) break; - if( t[0] == 1 ) s->xvel = 8; + if ( t[0] == 0 ) break; + if ( t[0] == 1 ) s->xvel = 8; else s->xvel = -8; - if( s->xvel ) //Moving + if ( s->xvel ) //Moving { x = (s->xvel*sintable[(s->ang+512)&2047])>>14; l = (s->xvel*sintable[s->ang&2047])>>14; @@ -6830,7 +6844,7 @@ void moveeffectors(void) //STATNUM 3 s->x += x; s->y += l; - if( t[3] <= 0 || (t[3]>>6) >= (SP>>6) ) + if ( t[3] <= 0 || (t[3]>>6) >= (SP>>6) ) { s->x -= x; s->y -= l; @@ -6840,17 +6854,17 @@ void moveeffectors(void) //STATNUM 3 } j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { nextj = nextspritesect[j]; - if( sprite[j].statnum != 3 && sprite[j].zvel == 0) + if ( sprite[j].statnum != 3 && sprite[j].zvel == 0) { sprite[j].x += x; sprite[j].y += l; setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z); - if( sector[sprite[j].sectnum].floorstat&2 ) - if(sprite[j].statnum == 2) + if ( sector[sprite[j].sectnum].floorstat&2 ) + if (sprite[j].statnum == 2) makeitfall(j); } j = nextj; @@ -6859,8 +6873,8 @@ void moveeffectors(void) //STATNUM 3 dragpoint((short)t[1],wall[t[1]].x+x,wall[t[1]].y+l); dragpoint((short)t[2],wall[t[2]].x+x,wall[t[2]].y+l); - for(p=connecthead;p>=0;p=connectpoint2[p]) - if(ps[p].cursectnum == s->sectnum && ps[p].on_ground) + for (p=connecthead;p>=0;p=connectpoint2[p]) + if (ps[p].cursectnum == s->sectnum && ps[p].on_ground) { ps[p].posx += x; ps[p].posy += l; @@ -6882,24 +6896,24 @@ void moveeffectors(void) //STATNUM 3 case 21: // Cascading effect - if( t[0] == 0 ) break; + if ( t[0] == 0 ) break; - if( s->ang == 1536 ) + if ( s->ang == 1536 ) l = (long) &sc->ceilingz; else l = (long) &sc->floorz; - if( t[0] == 1 ) //Decide if the s->sectnum should go up or down + if ( t[0] == 1 ) //Decide if the s->sectnum should go up or down { s->zvel = ksgn(s->z-*(long *)l) * (SP<<4); t[0]++; } - if( sc->extra == 0 ) + if ( sc->extra == 0 ) { *(long *)l += s->zvel; - if(klabs(*(long *)l-s->z) < 1024) + if (klabs(*(long *)l-s->z) < 1024) { *(long *)l = s->z; KILLIT(i); //All done @@ -6910,9 +6924,9 @@ void moveeffectors(void) //STATNUM 3 case 22: - if( t[1] ) + if ( t[1] ) { - if(getanimationgoal(§or[t[0]].ceilingz) >= 0) + if (getanimationgoal(§or[t[0]].ceilingz) >= 0) sc->ceilingz += sc->extra*9; else t[1] = 0; } @@ -6921,7 +6935,7 @@ void moveeffectors(void) //STATNUM 3 case 24: case 34: - if(t[4]) break; + if (t[4]) break; x = (SP*sintable[(s->ang+512)&2047])>>18; l = (SP*sintable[s->ang&2047])>>18; @@ -6929,14 +6943,14 @@ void moveeffectors(void) //STATNUM 3 k = 0; j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { nextj = nextspritesect[j]; - if(sprite[j].zvel >= 0) - switch(sprite[j].statnum) + if (sprite[j].zvel >= 0) + switch (sprite[j].statnum) { case 5: - switch(dynamictostatic[sprite[j].picnum]) + switch (dynamictostatic[sprite[j].picnum]) { case BLOODPOOL__STATIC: case PUKE__STATIC: @@ -6957,10 +6971,10 @@ void moveeffectors(void) //STATNUM 3 continue; } case 6: - if(sprite[j].picnum == TRIPBOMB) break; + if (sprite[j].picnum == TRIPBOMB) break; case 1: case 0: - if( + if ( sprite[j].picnum == BOLT1 || sprite[j].picnum == BOLT1+1 || sprite[j].picnum == BOLT1+2 || @@ -6973,9 +6987,9 @@ void moveeffectors(void) //STATNUM 3 ) break; - if( !(sprite[j].picnum >= CRANE && sprite[j].picnum <= (CRANE+3))) + if ( !(sprite[j].picnum >= CRANE && sprite[j].picnum <= (CRANE+3))) { - if( sprite[j].z > (hittype[j].floorz-(16<<8)) ) + if ( sprite[j].z > (hittype[j].floorz-(16<<8)) ) { hittype[j].bposx = sprite[j].x; hittype[j].bposy = sprite[j].y; @@ -6985,8 +6999,8 @@ void moveeffectors(void) //STATNUM 3 setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z); - if( sector[sprite[j].sectnum].floorstat&2 ) - if(sprite[j].statnum == 2) + if ( sector[sprite[j].sectnum].floorstat&2 ) + if (sprite[j].statnum == 2) makeitfall(j); } } @@ -6996,8 +7010,8 @@ void moveeffectors(void) //STATNUM 3 } p = myconnectindex; - if(ps[p].cursectnum == s->sectnum && ps[p].on_ground) - if( klabs(ps[p].posz-ps[p].truefz) < PHEIGHT+(9<<8) ) + if (ps[p].cursectnum == s->sectnum && ps[p].on_ground) + if ( klabs(ps[p].posz-ps[p].truefz) < PHEIGHT+(9<<8) ) { fricxv += x<<3; fricyv += l<<3; @@ -7008,30 +7022,30 @@ void moveeffectors(void) //STATNUM 3 break; case 35: - if(sc->ceilingz > s->z) - for(j = 0;j < 8;j++) + if (sc->ceilingz > s->z) + for (j = 0;j < 8;j++) { s->ang += TRAND&511; k = spawn(i,SMALLSMOKE); sprite[k].xvel = 96+(TRAND&127); ssp(k,CLIPMASK0); setsprite(k,sprite[k].x,sprite[k].y,sprite[k].z); - if( rnd(16) ) + if ( rnd(16) ) spawn(i,EXPLOSION2); } - switch(t[0]) + switch (t[0]) { case 0: sc->ceilingz += s->yvel; - if(sc->ceilingz > sc->floorz) + if (sc->ceilingz > sc->floorz) sc->floorz = sc->ceilingz; - if(sc->ceilingz > s->z+(32<<8)) + if (sc->ceilingz > s->z+(32<<8)) t[0]++; break; case 1: sc->ceilingz-=(s->yvel<<2); - if(sc->ceilingz < t[4]) + if (sc->ceilingz < t[4]) { sc->ceilingz = t[4]; t[0] = 0; @@ -7042,23 +7056,23 @@ void moveeffectors(void) //STATNUM 3 case 25: //PISTONS - if( t[4] == 0 ) break; + if ( t[4] == 0 ) break; - if(sc->floorz <= sc->ceilingz) + if (sc->floorz <= sc->ceilingz) s->shade = 0; - else if( sc->ceilingz <= t[3]) + else if ( sc->ceilingz <= t[3]) s->shade = 1; - if(s->shade) + if (s->shade) { sc->ceilingz += SP<<4; - if(sc->ceilingz > sc->floorz) + if (sc->ceilingz > sc->floorz) sc->ceilingz = sc->floorz; } else { sc->ceilingz -= SP<<4; - if(sc->ceilingz < t[3]) + if (sc->ceilingz < t[3]) sc->ceilingz = t[3]; } @@ -7071,7 +7085,7 @@ void moveeffectors(void) //STATNUM 3 x = (s->xvel*sintable[s->ang&2047])>>14; s->shade++; - if( s->shade > 7 ) + if ( s->shade > 7 ) { s->x = t[3]; s->y = t[4]; @@ -7082,10 +7096,10 @@ void moveeffectors(void) //STATNUM 3 sc->floorz += s->zvel; j = headspritesect[s->sectnum]; - while( j >= 0 ) + while ( j >= 0 ) { nextj = nextspritesect[j]; - if(sprite[j].statnum != 3 && sprite[j].statnum != 10) + if (sprite[j].statnum != 3 && sprite[j].statnum != 10) { hittype[j].bposx = sprite[j].x; hittype[j].bposy = sprite[j].y; @@ -7100,14 +7114,14 @@ void moveeffectors(void) //STATNUM 3 } p = myconnectindex; - if(sprite[ps[p].i].sectnum == s->sectnum && ps[p].on_ground) + if (sprite[ps[p].i].sectnum == s->sectnum && ps[p].on_ground) { fricxv += l<<5; fricyv += x<<5; } - for(p = connecthead;p >= 0;p = connectpoint2[p]) - if(sprite[ps[p].i].sectnum == s->sectnum && ps[p].on_ground) + for (p = connecthead;p >= 0;p = connectpoint2[p]) + if (sprite[ps[p].i].sectnum == s->sectnum && ps[p].on_ground) ps[p].posz += s->zvel; ms(i); @@ -7118,23 +7132,23 @@ void moveeffectors(void) //STATNUM 3 case 27: - if(ud.recstat == 0 || !ud.democams) break; + if (ud.recstat == 0 || !ud.democams) break; hittype[i].tempang = s->ang; p = findplayer(s,&x); - if( sprite[ps[p].i].extra > 0 && myconnectindex == screenpeek) + if ( sprite[ps[p].i].extra > 0 && myconnectindex == screenpeek) { - if( t[0] < 0 ) + if ( t[0] < 0 ) { ud.camerasprite = i; t[0]++; } - else if(ud.recstat == 2 && ps[p].newowner == -1) + else if (ud.recstat == 2 && ps[p].newowner == -1) { - if(cansee(s->x,s->y,s->z,SECT,ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum)) + if (cansee(s->x,s->y,s->z,SECT,ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum)) { - if(x < (long)((unsigned)sh)) + if (x < (long)((unsigned)sh)) { ud.camerasprite = i; t[0] = 999; @@ -7142,9 +7156,9 @@ void moveeffectors(void) //STATNUM 3 SP = 100+((s->z-ps[p].posz)/257); } - else if(t[0] == 999) + else if (t[0] == 999) { - if(ud.camerasprite == i) + if (ud.camerasprite == i) t[0] = 0; else t[0] = -10; ud.camerasprite = i; @@ -7155,9 +7169,9 @@ void moveeffectors(void) //STATNUM 3 { s->ang = getangle(ps[p].posx-s->x,ps[p].posy-s->y); - if(t[0] == 999) + if (t[0] == 999) { - if(ud.camerasprite == i) + if (ud.camerasprite == i) t[0] = 0; else t[0] = -20; ud.camerasprite = i; @@ -7167,16 +7181,16 @@ void moveeffectors(void) //STATNUM 3 } break; case 28: - if(t[5] > 0) + if (t[5] > 0) { t[5]--; break; } - if(T1 == 0) + if (T1 == 0) { p = findplayer(s,&x); - if( x > 15500 ) + if ( x > 15500 ) break; T1 = 1; T2 = 64 + (TRAND&511); @@ -7185,44 +7199,44 @@ void moveeffectors(void) //STATNUM 3 else { T3++; - if(T3 > T2) + if (T3 > T2) { T1 = 0; ps[screenpeek].visibility = ud.const_visibility; break; } - else if( T3 == (T2>>1) ) + else if ( T3 == (T2>>1) ) spritesound(THUNDER,i); - else if(T3 == (T2>>3) ) + else if (T3 == (T2>>3) ) spritesound(LIGHTNING_SLAP,i); - else if( T3 == (T2>>2) ) + else if ( T3 == (T2>>2) ) { j = headspritestat[0]; - while(j >= 0) + while (j >= 0) { - if( sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag) + if ( sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag) sprite[j].cstat |= 32768; j = nextspritestat[j]; } } - else if(T3 > (T2>>3) && T3 < (T2>>2) ) + else if (T3 > (T2>>3) && T3 < (T2>>2) ) { - if( cansee(s->x,s->y,s->z,s->sectnum,ps[screenpeek].posx,ps[screenpeek].posy,ps[screenpeek].posz,ps[screenpeek].cursectnum ) ) + if ( cansee(s->x,s->y,s->z,s->sectnum,ps[screenpeek].posx,ps[screenpeek].posy,ps[screenpeek].posz,ps[screenpeek].cursectnum ) ) j = 1; else j = 0; - if( rnd(192) && (T3&1) ) + if ( rnd(192) && (T3&1) ) { - if(j) + if (j) ps[screenpeek].visibility = 0; } - else if(j) + else if (j) ps[screenpeek].visibility = ud.const_visibility; j = headspritestat[0]; - while(j >= 0) + while (j >= 0) { - if( sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag) + if ( sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag) { if ( rnd(32) && (T3&1) ) { @@ -7231,9 +7245,9 @@ void moveeffectors(void) //STATNUM 3 p = findplayer(s,&x); x = ldist(&sprite[ps[p].i], &sprite[j]); - if( x < 768 ) + if ( x < 768 ) { - if(!isspritemakingsound(ps[p].i,DUKE_LONGTERM_PAIN)) + if (!isspritemakingsound(ps[p].i,DUKE_LONGTERM_PAIN)) spritesound(DUKE_LONGTERM_PAIN,ps[p].i); spritesound(SHORT_CIRCUIT,ps[p].i); sprite[ps[p].i].extra -= 8+(TRAND&7); @@ -7258,21 +7272,21 @@ void moveeffectors(void) //STATNUM 3 sc->floorz = s->z + l; break; case 31: // True Drop Floor - if(t[0] == 1) + if (t[0] == 1) { // Choose dir - if(t[3] > 0) + if (t[3] > 0) { t[3]--; break; } - if(t[2] == 1) // Retract + if (t[2] == 1) // Retract { - if(SA != 1536) + if (SA != 1536) { - if( klabs( sc->floorz - s->z ) < SP ) + if ( klabs( sc->floorz - s->z ) < SP ) { sc->floorz = s->z; t[2] = 0; @@ -7286,12 +7300,12 @@ void moveeffectors(void) //STATNUM 3 sc->floorz += l; j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if( ps[sprite[j].yvel].on_ground == 1 ) + if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) + if ( ps[sprite[j].yvel].on_ground == 1 ) ps[sprite[j].yvel].posz += l; - if( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) + if ( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { hittype[j].bposz = sprite[j].z += l; hittype[j].floorz = sc->floorz; @@ -7302,7 +7316,7 @@ void moveeffectors(void) //STATNUM 3 } else { - if( klabs( sc->floorz - t[1] ) < SP ) + if ( klabs( sc->floorz - t[1] ) < SP ) { sc->floorz = t[1]; callsound(s->sectnum,i); @@ -7316,12 +7330,12 @@ void moveeffectors(void) //STATNUM 3 sc->floorz += l; j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if( ps[sprite[j].yvel].on_ground == 1 ) + if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) + if ( ps[sprite[j].yvel].on_ground == 1 ) ps[sprite[j].yvel].posz += l; - if( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4 ) + if ( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4 ) { hittype[j].bposz = sprite[j].z += l; hittype[j].floorz = sc->floorz; @@ -7333,9 +7347,9 @@ void moveeffectors(void) //STATNUM 3 break; } - if( (s->ang&2047) == 1536) + if ( (s->ang&2047) == 1536) { - if( klabs( s->z-sc->floorz ) < SP ) + if ( klabs( s->z-sc->floorz ) < SP ) { callsound(s->sectnum,i); t[0] = 0; @@ -7348,12 +7362,12 @@ void moveeffectors(void) //STATNUM 3 sc->floorz += l; j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if( ps[sprite[j].yvel].on_ground == 1 ) + if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) + if ( ps[sprite[j].yvel].on_ground == 1 ) ps[sprite[j].yvel].posz += l; - if( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4 ) + if ( sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4 ) { hittype[j].bposz = sprite[j].z += l; hittype[j].floorz = sc->floorz; @@ -7364,7 +7378,7 @@ void moveeffectors(void) //STATNUM 3 } else { - if( klabs( sc->floorz-t[1] ) < SP ) + if ( klabs( sc->floorz-t[1] ) < SP ) { t[0] = 0; callsound(s->sectnum,i); @@ -7377,12 +7391,12 @@ void moveeffectors(void) //STATNUM 3 sc->floorz -= l; j = headspritesect[s->sectnum]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if( ps[sprite[j].yvel].on_ground == 1 ) + if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) + if ( ps[sprite[j].yvel].on_ground == 1 ) ps[sprite[j].yvel].posz -= l; - if(sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4 ) + if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4 ) { hittype[j].bposz = sprite[j].z -= l; hittype[j].floorz = sc->floorz; @@ -7395,15 +7409,15 @@ void moveeffectors(void) //STATNUM 3 break; case 32: // True Drop Ceiling - if(t[0] == 1) + if (t[0] == 1) { // Choose dir - if(t[2] == 1) // Retract + if (t[2] == 1) // Retract { - if(SA != 1536) + if (SA != 1536) { - if( klabs( sc->ceilingz - s->z ) < + if ( klabs( sc->ceilingz - s->z ) < (SP<<1) ) { sc->ceilingz = s->z; @@ -7416,7 +7430,7 @@ void moveeffectors(void) //STATNUM 3 } else { - if( klabs( sc->ceilingz - t[1] ) < + if ( klabs( sc->ceilingz - t[1] ) < (SP<<1) ) { sc->ceilingz = t[1]; @@ -7430,9 +7444,9 @@ void moveeffectors(void) //STATNUM 3 break; } - if( (s->ang&2047) == 1536) + if ( (s->ang&2047) == 1536) { - if( klabs(sc->ceilingz-s->z ) < + if ( klabs(sc->ceilingz-s->z ) < (SP<<1) ) { t[0] = 0; @@ -7445,7 +7459,7 @@ void moveeffectors(void) //STATNUM 3 } else { - if( klabs(sc->ceilingz-t[1] ) < (SP<<1) ) + if ( klabs(sc->ceilingz-t[1] ) < (SP<<1) ) { t[0] = 0; t[2] = !t[2]; @@ -7457,16 +7471,16 @@ void moveeffectors(void) //STATNUM 3 break; case 33: - if( earthquaketime > 0 && (TRAND&7) == 0 ) + if ( earthquaketime > 0 && (TRAND&7) == 0 ) RANDOMSCRAP; break; case 36: - if( t[0] ) + if ( t[0] ) { - if( t[0] == 1 ) + if ( t[0] == 1 ) shoot(i,sc->extra); - else if( t[0] == 26*5 ) + else if ( t[0] == 26*5 ) t[0] = 0; t[0]++; } @@ -7476,11 +7490,11 @@ void moveeffectors(void) //STATNUM 3 wal = &wall[t[2]]; - if(wal->cstat|32) + if (wal->cstat|32) { wal->cstat &= (255-32); wal->cstat |= 16; - if(wal->nextwall >= 0) + if (wal->nextwall >= 0) { wall[wal->nextwall].cstat &= (255-32); wall[wal->nextwall].cstat |= 16; @@ -7489,26 +7503,26 @@ void moveeffectors(void) //STATNUM 3 else break; wal->overpicnum++; - if(wal->nextwall >= 0) + if (wal->nextwall >= 0) wall[wal->nextwall].overpicnum++; - if(t[0] < t[1]) t[0]++; + if (t[0] < t[1]) t[0]++; else { wal->cstat &= (128+32+8+4+2); - if(wal->nextwall >= 0) + if (wal->nextwall >= 0) wall[wal->nextwall].cstat &= (128+32+8+4+2); KILLIT(i); } break; case 130: - if(t[0] > 80) { KILLIT(i); } + if (t[0] > 80) { KILLIT(i); } else t[0]++; x = sc->floorz-sc->ceilingz; - if( rnd(64) ) + if ( rnd(64) ) { k = spawn(i,EXPLOSION2); sprite[k].xrepeat = sprite[k].yrepeat = 2+(TRAND&7); @@ -7519,12 +7533,12 @@ void moveeffectors(void) //STATNUM 3 } break; case 131: - if(t[0] > 40) { KILLIT(i); } + if (t[0] > 40) { KILLIT(i); } else t[0]++; x = sc->floorz-sc->ceilingz; - if( rnd(32) ) + if ( rnd(32) ) { k = spawn(i,EXPLOSION2); sprite[k].xrepeat = sprite[k].yrepeat = 2+(TRAND&3); @@ -7540,7 +7554,7 @@ BOLT: } //Sloped sin-wave floors! - for(i=headspritestat[3];i>=0;i=nextspritestat[i]) + for (i=headspritestat[3];i>=0;i=nextspritestat[i]) { s = &sprite[i]; if (s->lotag != 29) continue; diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c index 8d48b34c5..1f29c72ff 100644 --- a/polymer/eduke32/source/anim.c +++ b/polymer/eduke32/source/anim.c @@ -25,11 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void endanimsounds(long fr) { - switch(ud.volume_number) + switch (ud.volume_number) { - case 0:break; + case 0: + break; case 1: - switch(fr) + switch (fr) { case 1: sound(WIND_AMBIENCE); @@ -61,7 +62,7 @@ void endanimsounds(long fr) } break; case 2: - switch(fr) + switch (fr) { case 1: sound(WIND_REPEAT); @@ -89,7 +90,7 @@ void endanimsounds(long fr) void logoanimsounds(long fr) { - switch(fr) + switch (fr) { case 1: sound(FLY_BY); @@ -102,7 +103,7 @@ void logoanimsounds(long fr) void intro4animsounds(long fr) { - switch(fr) + switch (fr) { case 1: sound(INTRO4_B); @@ -119,7 +120,7 @@ void intro4animsounds(long fr) void first4animsounds(long fr) { - switch(fr) + switch (fr) { case 1: sound(INTRO4_1); @@ -138,7 +139,7 @@ void first4animsounds(long fr) void intro42animsounds(long fr) { - switch(fr) + switch (fr) { case 10: sound(INTRO4_6); @@ -148,7 +149,7 @@ void intro42animsounds(long fr) void endanimvol41(long fr) { - switch(fr) + switch (fr) { case 3: sound(DUKE_UNDERWATER); @@ -161,7 +162,7 @@ void endanimvol41(long fr) void endanimvol42(long fr) { - switch(fr) + switch (fr) { case 11: sound(DUKE_UNDERWATER); @@ -180,7 +181,7 @@ void endanimvol42(long fr) void endanimvol43(long fr) { - switch(fr) + switch (fr) { case 1: sound(BOSS4_DEADSPEECH); @@ -203,17 +204,17 @@ void playanm(char *fn,char t) // return; - if(t != 7 && t != 9 && t != 10 && t != 11) + if (t != 7 && t != 9 && t != 10 && t != 11) KB_FlushKeyboardQueue(); - if( KB_KeyWaiting() ) + if ( KB_KeyWaiting() ) { FX_StopAllSounds(); goto ENDOFANIMLOOP; } handle = kopen4load(fn,0); - if(handle == -1) return; + if (handle == -1) return; length = kfilelength(handle); walock[TILE_ANIM] = 219+t; @@ -230,7 +231,7 @@ void playanm(char *fn,char t) numframes = ANIM_NumFrames(); palptr = ANIM_GetPalette(); - for(i=0;i<256;i++) + for (i=0;i<256;i++) { /* j = (i<<2); k = j-i; @@ -251,26 +252,26 @@ void playanm(char *fn,char t) ototalclock = totalclock + 10; - for(i=1;i=20 && sprite[j].picnum<=59) + if (sprite[j].picnum>=20 && sprite[j].picnum<=59) { - if(sprite[j].picnum==26) { + if (sprite[j].picnum==26) { sprite[j].xrepeat = 8; sprite[j].yrepeat = 8; } else @@ -210,11 +210,11 @@ 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;i 10000 && sector[sectnum].lotag < 32767) Bsprintf(lo,"%d 1 TIME SOUND",sector[sectnum].lotag); - if(qsetmode != 200) + if (qsetmode != 200) Bsprintf(tempbuf,"%hu,%s",sector[sectnum].hitag,lo); else Bstrcpy(tempbuf,lo); } @@ -304,7 +326,7 @@ const char *ExtGetSectorCaption(short sectnum) const char *ExtGetWallCaption(short wallnum) { - if(!(onnames==2 || onnames==4)) + if (!(onnames==2 || onnames==4)) { tempbuf[0] = 0; return(tempbuf); @@ -325,49 +347,83 @@ const char *ExtGetWallCaption(short wallnum) const char *SectorEffectorText(short spritenum) { - switch(sprite[spritenum].lotag) + switch (sprite[spritenum].lotag) { - case 0: Bsprintf(tempbuf,"SE: ROTATED SECTOR"); break; - case 1: Bsprintf(tempbuf,"SE: PIVOT SPRITE FOR SE 0"); break; - case 2: Bsprintf(tempbuf,"SE: EARTHQUAKE"); break; - case 3: Bsprintf(tempbuf,"SE: RANDOM LIGHTS AFTER SHOT OUT"); break; - case 4: Bsprintf(tempbuf,"SE: RANDOM LIGHTS"); break; - case 6: Bsprintf(tempbuf,"SE: SUBWAY"); break; - case 7: Bsprintf(tempbuf,"SE: TRANSPORT"); break; - case 8: Bsprintf(tempbuf,"SE: UP OPEN DOOR LIGHTS"); break; - case 9: Bsprintf(tempbuf,"SE: DOWN OPEN DOOR LIGHTS"); break; - case 10: Bsprintf(tempbuf,"SE: DOOR AUTO CLOSE (H=DELAY)"); break; - case 11: Bsprintf(tempbuf,"SE: ROTATE SECTOR DOOR"); break; - case 12: Bsprintf(tempbuf,"SE: LIGHT SWITCH"); break; - case 13: Bsprintf(tempbuf,"SE: EXPLOSIVE"); break; - case 14: Bsprintf(tempbuf,"SE: SUBWAY CAR"); break; - case 15: Bsprintf(tempbuf,"SE: SLIDE DOOR (ST 25)"); break; - case 16: Bsprintf(tempbuf,"SE: ROTATE REACTOR SECTOR"); break; - case 17: Bsprintf(tempbuf,"SE: ELEVATOR TRANSPORT (ST 15)"); break; - case 18: Bsprintf(tempbuf,"SE: INCREMENTAL SECTOR RISE/FALL"); break; - case 19: Bsprintf(tempbuf,"SE: CEILING FALL ON EXPLOSION"); break; - case 20: Bsprintf(tempbuf,"SE: BRIDGE (ST 27)"); break; - case 21: Bsprintf(tempbuf,"SE: DROP FLOOR (ST 28)"); break; - case 22: Bsprintf(tempbuf,"SE: TEETH DOOR (ST 29)"); break; - case 23: Bsprintf(tempbuf,"SE: 1-WAY SE7 DESTINATION (H=SE 7)"); break; - case 24: Bsprintf(tempbuf,"SE: CONVAYER BELT"); break; - case 25: Bsprintf(tempbuf,"SE: ENGINE"); break; - case 28: Bsprintf(tempbuf,"SE: LIGHTNING (H= TILE#4890)"); break; - case 27: Bsprintf(tempbuf,"SE: CAMERA FOR PLAYBACK"); break; - case 29: Bsprintf(tempbuf,"SE: FLOAT"); break; - case 30: Bsprintf(tempbuf,"SE: 2 WAY TRAIN (ST=31)"); break; - case 31: Bsprintf(tempbuf,"SE: FLOOR RISE"); break; - case 32: Bsprintf(tempbuf,"SE: CEILING FALL"); break; - case 33: Bsprintf(tempbuf,"SE: SPAWN JIB W/QUAKE"); break; - case 36: Bsprintf(tempbuf,"SE: SKRINK RAY SHOOTER"); break; - default: SpriteName(spritenum,tempbuf); break; + case 0: + Bsprintf(tempbuf,"SE: ROTATED SECTOR"); break; + case 1: + Bsprintf(tempbuf,"SE: PIVOT SPRITE FOR SE 0"); break; + case 2: + Bsprintf(tempbuf,"SE: EARTHQUAKE"); break; + case 3: + Bsprintf(tempbuf,"SE: RANDOM LIGHTS AFTER SHOT OUT"); break; + case 4: + Bsprintf(tempbuf,"SE: RANDOM LIGHTS"); break; + case 6: + Bsprintf(tempbuf,"SE: SUBWAY"); break; + case 7: + Bsprintf(tempbuf,"SE: TRANSPORT"); break; + case 8: + Bsprintf(tempbuf,"SE: UP OPEN DOOR LIGHTS"); break; + case 9: + Bsprintf(tempbuf,"SE: DOWN OPEN DOOR LIGHTS"); break; + case 10: + Bsprintf(tempbuf,"SE: DOOR AUTO CLOSE (H=DELAY)"); break; + case 11: + Bsprintf(tempbuf,"SE: ROTATE SECTOR DOOR"); break; + case 12: + Bsprintf(tempbuf,"SE: LIGHT SWITCH"); break; + case 13: + Bsprintf(tempbuf,"SE: EXPLOSIVE"); break; + case 14: + Bsprintf(tempbuf,"SE: SUBWAY CAR"); break; + case 15: + Bsprintf(tempbuf,"SE: SLIDE DOOR (ST 25)"); break; + case 16: + Bsprintf(tempbuf,"SE: ROTATE REACTOR SECTOR"); break; + case 17: + Bsprintf(tempbuf,"SE: ELEVATOR TRANSPORT (ST 15)"); break; + case 18: + Bsprintf(tempbuf,"SE: INCREMENTAL SECTOR RISE/FALL"); break; + case 19: + Bsprintf(tempbuf,"SE: CEILING FALL ON EXPLOSION"); break; + case 20: + Bsprintf(tempbuf,"SE: BRIDGE (ST 27)"); break; + case 21: + Bsprintf(tempbuf,"SE: DROP FLOOR (ST 28)"); break; + case 22: + Bsprintf(tempbuf,"SE: TEETH DOOR (ST 29)"); break; + case 23: + Bsprintf(tempbuf,"SE: 1-WAY SE7 DESTINATION (H=SE 7)"); break; + case 24: + Bsprintf(tempbuf,"SE: CONVAYER BELT"); break; + case 25: + Bsprintf(tempbuf,"SE: ENGINE"); break; + case 28: + Bsprintf(tempbuf,"SE: LIGHTNING (H= TILE#4890)"); break; + case 27: + Bsprintf(tempbuf,"SE: CAMERA FOR PLAYBACK"); break; + case 29: + Bsprintf(tempbuf,"SE: FLOAT"); break; + case 30: + Bsprintf(tempbuf,"SE: 2 WAY TRAIN (ST=31)"); break; + case 31: + Bsprintf(tempbuf,"SE: FLOOR RISE"); break; + case 32: + Bsprintf(tempbuf,"SE: CEILING FALL"); break; + case 33: + Bsprintf(tempbuf,"SE: SPAWN JIB W/QUAKE"); break; + case 36: + Bsprintf(tempbuf,"SE: SKRINK RAY SHOOTER"); break; + default: + SpriteName(spritenum,tempbuf); break; } return (tempbuf); } const char *ExtGetSpriteCaption(short spritenum) { - if((onnames!=5 && onnames!=6 &&(!(onnames==3 || onnames==4 || onnames==7 || onnames==8))) || (onnames==7 && sprite[spritenum].picnum!=1)) + if ((onnames!=5 && onnames!=6 &&(!(onnames==3 || onnames==4 || onnames==7 || onnames==8))) || (onnames==7 && sprite[spritenum].picnum!=1)) { tempbuf[0] = 0; return(tempbuf); @@ -375,7 +431,7 @@ const char *ExtGetSpriteCaption(short spritenum) if (onnames==5) { - switch(sprite[spritenum].picnum) + switch (sprite[spritenum].picnum) { case FIRSTGUNSPRITE: case CHAINGUNSPRITE : @@ -408,14 +464,14 @@ const char *ExtGetSpriteCaption(short spritenum) case BOOTS: break; default: - { - tempbuf[0] = 0; - return(tempbuf); - } + { + tempbuf[0] = 0; + return(tempbuf); + } } } - if( onnames==6 && sprite[spritenum].picnum != sprite[cursprite].picnum) + if ( onnames==6 && sprite[spritenum].picnum != sprite[cursprite].picnum) { tempbuf[0] = 0; return(tempbuf); @@ -425,14 +481,14 @@ const char *ExtGetSpriteCaption(short spritenum) if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0) { SpriteName(spritenum,lo); - if(lo[0]!=0) + if (lo[0]!=0) { - if(sprite[spritenum].pal==1) Bsprintf(tempbuf,"%s (MULTIPLAYER)",lo); + if (sprite[spritenum].pal==1) Bsprintf(tempbuf,"%s (MULTIPLAYER)",lo); else Bsprintf(tempbuf,"%s",lo); } } else - if(sprite[spritenum].picnum==SECTOREFFECTOR) + if (sprite[spritenum].picnum==SECTOREFFECTOR) { if (onnames==8) tempbuf[0] = 0; @@ -480,12 +536,12 @@ void ExtShowSectorData(short sectnum) //F5 int totalactors1=0,totalactors2=0,totalactors3=0,totalactors4=0; int totalrespawn=0; - if(qsetmode==200) + if (qsetmode==200) return; - for(i=0;inextfreetag) nextfreetag=1+sprite[i].lotag; + if (sprite[i].lotag>nextfreetag) nextfreetag=1+sprite[i].lotag; break; //HITAG case SEENINE: case OOZFILTER: case SECTOREFFECTOR: - if(sprite[i].lotag==10 || sprite[i].lotag==27 || sprite[i].lotag==28 || sprite[i].lotag==29) + if (sprite[i].lotag==10 || sprite[i].lotag==27 || sprite[i].lotag==28 || sprite[i].lotag==29) break; else - if(sprite[i].hitag>nextfreetag) nextfreetag=1+sprite[i].hitag; + if (sprite[i].hitag>nextfreetag) nextfreetag=1+sprite[i].hitag; break; default: break; @@ -708,14 +765,14 @@ void ExtShowWallData(short wallnum) //F6 } // end sprite loop //Count Normal Actors - for(i=0;ixmax) xmax=x; + x++; if (x>xmax) xmax=x; } tempbuf[x]=0; printext16(xx*4,ydim16+(y*6)+2,11,-1,tempbuf,1); x=0; y++; - if(y>18) {col++; y=6; xx+=xmax; xmax=0; + if (y>18) {col++; y=6; xx+=xmax; xmax=0; } } enddrawing(); @@ -950,7 +1007,7 @@ void Show3dText(char *name) int fp,t; char x=0,y=4,xmax=0,xx=0,col=0; - if((fp=kopen4load(name,0)) == -1) + if ((fp=kopen4load(name,0)) == -1) { begindrawing(); printext256(1*4,4*8,whitecol,-1,"ERROR: file not found.",0); @@ -959,21 +1016,21 @@ void Show3dText(char *name) } t=65; begindrawing(); - while(t!=EOF && col<5) + while (t!=EOF && col<5) { t = 0; if (kread(fp,&t,1)<=0) t = EOF; - while(t!=EOF && t!='\n' && x<250) + while (t!=EOF && t!='\n' && x<250) { tempbuf[x]=t; t = 0; if (kread(fp,&t,1)<=0) t = EOF; - x++; if(x>xmax) xmax=x; + x++; if (x>xmax) xmax=x; } tempbuf[x]=0; printext256(xx*4,(y*6)+2,whitecol,-1,tempbuf,1); x=0; y++; - if(y>18) {col++; y=6; xx+=xmax; xmax=0; + if (y>18) {col++; y=6; xx+=xmax; xmax=0; } } enddrawing(); @@ -985,7 +1042,7 @@ void ShowHelpText(char *name) { BFILE *fp; char x=0,y=4; - if((fp=fopenfrompath("helpdoc.txt","rb")) == NULL) + if ((fp=fopenfrompath("helpdoc.txt","rb")) == NULL) { begindrawing(); printext256(1*4,4*8,whitecol,-1,"ERROR: file not found.",0); @@ -1003,7 +1060,7 @@ void ShowHelpText(char *name) Bfgets(tempbuf,80,fp); Bstrcat(tempbuf,"\n"); begindrawing(); - while(!Bfeof(fp) && !(Bstrcmp(tempbuf,"SectorEffector")==0)) + while (!Bfeof(fp) && !(Bstrcmp(tempbuf,"SectorEffector")==0)) { Bfgets(tempbuf,80,fp); Bstrcat(tempbuf,"\n"); @@ -1052,7 +1109,7 @@ static void ExtSE40Draw(int spnum,long x,long y,long z,short a,short h) int floor1=0,floor2=0,ok=0,fofmode=0,draw_both=0; long offx,offy,offz; - if(sprite[spnum].ang!=512) return; + if (sprite[spnum].ang!=512) return; // Things are a little different now, as we allow for masked transparent // floors and ceilings. So the FOF textures is no longer required @@ -1073,10 +1130,10 @@ static void ExtSE40Draw(int spnum,long x,long y,long z,short a,short h) floor1=spnum; - if(sprite[spnum].lotag==42) fofmode=40; - if(sprite[spnum].lotag==43) fofmode=41; - if(sprite[spnum].lotag==44) fofmode=40; - if(sprite[spnum].lotag==45) fofmode=41; + if (sprite[spnum].lotag==42) fofmode=40; + if (sprite[spnum].lotag==43) fofmode=41; + if (sprite[spnum].lotag==44) fofmode=40; + if (sprite[spnum].lotag==45) fofmode=41; // fofmode=sprite[spnum].lotag-2; @@ -1097,9 +1154,9 @@ static void ExtSE40Draw(int spnum,long x,long y,long z,short a,short h) // if(ok==0) { Message("no fof",RED); return; } - for(j=0;j 0) //ALT { @@ -1267,7 +1324,7 @@ void ExtEditWallData(short wallnum) //F8 void ExtEditSpriteData(short spritenum) //F8 { - if(qsetmode==200) + if (qsetmode==200) return; if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT { @@ -1303,12 +1360,12 @@ void ReadPaletteTable() { int i,j,fp; char lookup_num; - if((fp=kopen4load("lookup.dat",0)) == -1) + if ((fp=kopen4load("lookup.dat",0)) == -1) { - if((fp=kopen4load("lookup.dat",1)) == -1) + if ((fp=kopen4load("lookup.dat",1)) == -1) { initprintf("LOOKUP.DAT not found, creating dummy palette lookups\n"); - for(i=0;i<256;i++) + for (i=0;i<256;i++) tempbuf[i] = ((i+32)&255); //remap colors for screwy palette sectors makepalookup(MAXPALOOKUPS,tempbuf,0,0,0,1); return; @@ -1316,7 +1373,7 @@ void ReadPaletteTable() } initprintf("Loading palette lookups... "); kread(fp,&num_tables,1); - for(j=0;j 640); - if(totalclock > lastupdate) + if (totalclock > lastupdate) { mousecol += mouseadd; - if(mousecol >= 30 || mousecol <= 0) + if (mousecol >= 30 || mousecol <= 0) { mouseadd = -mouseadd; mousecol += mouseadd; @@ -1402,7 +1459,7 @@ void m32_showmouse(void) lastupdate = totalclock + 3; } - switch(whitecol) + switch (whitecol) { case 1: // Shadow Warrior col = whitecol+mousecol; @@ -1415,16 +1472,16 @@ void m32_showmouse(void) break; } - if(col != whitecol) + if (col != whitecol) { - for(i=(j?3:2);i<=(j?7:3);i++) + for (i=(j?3:2);i<=(j?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<=(j?2:1);i++) + for (i=1;i<=(j?2:1);i++) { plotpixel(searchx+i,searchy,whitecol); plotpixel(searchx-i,searchy,whitecol); @@ -1462,7 +1519,7 @@ int AskIfSure(void) retval = 0; break; } } - while(keystatus[1]) + while (keystatus[1]) { keystatus[1] = 0; retval = 1; @@ -1495,21 +1552,21 @@ void Keys3d(void) } - if(usedcount && !helpon) + if (usedcount && !helpon) { - if(searchstat!=3) + if (searchstat!=3) { count=0; - for(i=0;i>2))<<16,(114)<<16,32768,0,temppicnum,tempshade,temppal,2,0L,0L,xdim-1L,ydim-1L); else if (tabgraphic == 2 ) - rotatesprite((44+tilesizx[temppicnum])<<16,(114)<<16,16384,0,temppicnum,tempshade,temppal,2,0L,0L,xdim-1L,ydim-1L); + rotatesprite((44+(tilesizx[temppicnum]>>2))<<16,(114)<<16,16384,0,temppicnum,tempshade,temppal,2,0L,0L,xdim-1L,ydim-1L); begindrawing(); j = xdimgame>640?0:1; @@ -1563,15 +1620,15 @@ void Keys3d(void) { case 0: case 4: - { - long dax, day, dist; - dax = wall[searchwall].x-wall[wall[searchwall].point2].x; - day = wall[searchwall].y-wall[wall[searchwall].point2].y; - dist = ksqrt(dax*dax+day*day); - Bsprintf(msgbuf,"Wall %d: length:%ld lo:%d hi:%d",searchwall,dist,wall[searchwall].lotag,wall[searchwall].hitag); - _message(msgbuf); - break; - } + { + long dax, day, dist; + dax = wall[searchwall].x-wall[wall[searchwall].point2].x; + day = wall[searchwall].y-wall[wall[searchwall].point2].y; + dist = ksqrt(dax*dax+day*day); + Bsprintf(msgbuf,"Wall %d: length:%ld lo:%d hi:%d",searchwall,dist,wall[searchwall].lotag,wall[searchwall].hitag); + _message(msgbuf); + break; + } case 1: Bsprintf(msgbuf,"Sector %d ceiling: lo:%s hi:%d",searchsector,ExtGetSectorCaption(searchsector),sector[searchsector].hitag); _message(msgbuf); @@ -1581,16 +1638,16 @@ void Keys3d(void) _message(msgbuf); break; case 3: - { - if (strlen(names[sprite[searchwall].picnum]) > 0) { - if (sprite[searchwall].picnum==SECTOREFFECTOR) - Bsprintf(msgbuf,"Sprite %d %s: lo:%d hi:%d",searchwall,SectorEffectorText(searchwall),sprite[searchwall].lotag,sprite[searchwall].hitag); - else Bsprintf(msgbuf,"Sprite %d %s: lo:%d hi:%d ex:%d",searchwall,names[sprite[searchwall].picnum],sprite[searchwall].lotag,sprite[searchwall].hitag,sprite[searchwall].extra); - } - else Bsprintf(msgbuf,"Sprite %d picnum %d: lo:%d hi:%d ex:%d",searchwall,sprite[searchwall].picnum,sprite[searchwall].lotag,sprite[searchwall].hitag,sprite[searchwall].extra); - _message(msgbuf); - break; + { + if (strlen(names[sprite[searchwall].picnum]) > 0) { + if (sprite[searchwall].picnum==SECTOREFFECTOR) + Bsprintf(msgbuf,"Sprite %d %s: lo:%d hi:%d",searchwall,SectorEffectorText(searchwall),sprite[searchwall].lotag,sprite[searchwall].hitag); + else Bsprintf(msgbuf,"Sprite %d %s: lo:%d hi:%d ex:%d",searchwall,names[sprite[searchwall].picnum],sprite[searchwall].lotag,sprite[searchwall].hitag,sprite[searchwall].extra); } + else Bsprintf(msgbuf,"Sprite %d picnum %d: lo:%d hi:%d ex:%d",searchwall,sprite[searchwall].picnum,sprite[searchwall].lotag,sprite[searchwall].hitag,sprite[searchwall].extra); + _message(msgbuf); + break; + } } } @@ -1609,14 +1666,17 @@ void Keys3d(void) keystatus[KEYSC_F3] = 0; } - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x0e]==1) // ' del + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x0e]==1) // ' del { keystatus[0x0e] = 0; switch (searchstat) { - case 0: case 4: wall[searchwall].cstat = 0; break; + case 0: + case 4: + wall[searchwall].cstat = 0; break; // case 1: case 2: sector[searchsector].cstat = 0; break; - case 3: sprite[searchwall].cstat = 0; break; + case 3: + sprite[searchwall].cstat = 0; break; } } @@ -1628,14 +1688,14 @@ void Keys3d(void) keystatus[KEYSC_P] = 0; - if(highlightsectorcnt == -1) + if (highlightsectorcnt == -1) { message("You didn't select any sectors!"); return; } pal = (unsigned char)getnumber256("Palette: ",0,MAXPALOOKUPS,0); - if(AskIfSure()) return; + if (AskIfSure()) return; for (i = 0; i < highlightsectorcnt; i++) { @@ -1662,14 +1722,14 @@ void Keys3d(void) keystatus[KEYSC_P] = 0; - if(highlightsectorcnt == -1) + if (highlightsectorcnt == -1) { message("You didn't select any sectors!"); return; } pal = (unsigned char)getnumber256("Palette: ",0,MAXPALOOKUPS,0); - if(AskIfSure()) return; + if (AskIfSure()) return; for (i = 0; i < highlightsectorcnt; i++) { @@ -1686,7 +1746,7 @@ void Keys3d(void) for (k=0;k= 0) + while (w >= 0) { j = nextspritesect[w]; sprite[i].pal = pal; @@ -1704,13 +1764,13 @@ void Keys3d(void) keystatus[KEYSC_V] = 0; - if(highlightsectorcnt == -1) + if (highlightsectorcnt == -1) { message("You didn't select any sectors!"); return; } visval = (unsigned char)getnumber256("Visibility of selected sectors: ",sector[searchsector].visibility,255,0); - if(AskIfSure()) return; + if (AskIfSure()) return; for (i = 0; i < highlightsectorcnt; i++) { @@ -1857,7 +1917,8 @@ void Keys3d(void) { switch (searchstat) { - case 0: case 4: + case 0: + case 4: strcpy(buffer,"Wall extra: "); wall[searchwall].extra = getnumber256(buffer,(long)wall[searchwall].extra,65536L,1); break; @@ -1995,7 +2056,8 @@ void Keys3d(void) { switch (searchstat) { - case 0: case 4: + case 0: + case 4: strcpy(buffer,"Wall hitag: "); wall[searchwall].hitag = getnumber256(buffer,(long)wall[searchwall].hitag,65536L,0); break; @@ -2045,9 +2107,9 @@ void Keys3d(void) smooshyalign = keystatus[0x4c]; repeatpanalign = (keystatus[0x2a]|keystatus[0x36]|(bstatus&2)); - if(bstatus&4) + if (bstatus&4) { - if(bstatus&1) + if (bstatus&1) { searchit = 0; if (searchx != osearchx) @@ -2060,7 +2122,7 @@ void Keys3d(void) if ((searchstat == 0) || (searchstat == 4)) { - if(!(wall[searchwall].cstat&8)) changedir = -changedir; + if (!(wall[searchwall].cstat&8)) changedir = -changedir; if (repeatpanalign == 0) wall[searchwall].xrepeat = changechar(wall[searchwall].xrepeat,changedir,smooshyalign,1); else @@ -2098,7 +2160,7 @@ void Keys3d(void) if ((searchstat == 0) || (searchstat == 4)) { - if(wall[searchwall].cstat&4) changedir = -changedir; + if (wall[searchwall].cstat&4) changedir = -changedir; if (repeatpanalign == 0) wall[searchwall].yrepeat = changechar(wall[searchwall].yrepeat,changedir,smooshyalign,1); else @@ -2143,12 +2205,12 @@ void Keys3d(void) k = 16; else k = 1; 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) // mousewheel, -, and +, cycle picnum + if ((keystatus[KEYSC_DASH]|keystatus[KEYSC_EQUAL]|((bstatus&(16|32)) && !(bstatus&2))) > 0) // mousewheel, -, and +, cycle picnum { j = i = (keystatus[KEYSC_EQUAL]|(bstatus&32))?1:-1; switch (searchstat) { case 0: - while(!tilesizx[wall[searchwall].picnum]||!tilesizy[wall[searchwall].picnum]||j) { - if(wall[searchwall].picnum+i >= MAXTILES) wall[searchwall].picnum = 0; - else if(wall[searchwall].picnum+i < 0) wall[searchwall].picnum = MAXTILES-1; + while (!tilesizx[wall[searchwall].picnum]||!tilesizy[wall[searchwall].picnum]||j) { + if (wall[searchwall].picnum+i >= MAXTILES) wall[searchwall].picnum = 0; + else if (wall[searchwall].picnum+i < 0) wall[searchwall].picnum = MAXTILES-1; else wall[searchwall].picnum += i; j = 0; } break; case 1: - while(!tilesizx[sector[searchsector].ceilingpicnum]||!tilesizy[sector[searchsector].ceilingpicnum]||j) { - if(sector[searchsector].ceilingpicnum+i >= MAXTILES) sector[searchsector].ceilingpicnum = 0; - else if(sector[searchsector].ceilingpicnum+i < 0) sector[searchsector].ceilingpicnum = MAXTILES-1; + while (!tilesizx[sector[searchsector].ceilingpicnum]||!tilesizy[sector[searchsector].ceilingpicnum]||j) { + if (sector[searchsector].ceilingpicnum+i >= MAXTILES) sector[searchsector].ceilingpicnum = 0; + else if (sector[searchsector].ceilingpicnum+i < 0) sector[searchsector].ceilingpicnum = MAXTILES-1; else sector[searchsector].ceilingpicnum += i; j = 0; } break; case 2: - while(!tilesizx[sector[searchsector].floorpicnum]||!tilesizy[sector[searchsector].floorpicnum]||j) { - if(sector[searchsector].floorpicnum+i >= MAXTILES) sector[searchsector].floorpicnum = 0; - else if(sector[searchsector].floorpicnum+i < 0) sector[searchsector].floorpicnum = MAXTILES-1; + while (!tilesizx[sector[searchsector].floorpicnum]||!tilesizy[sector[searchsector].floorpicnum]||j) { + if (sector[searchsector].floorpicnum+i >= MAXTILES) sector[searchsector].floorpicnum = 0; + else if (sector[searchsector].floorpicnum+i < 0) sector[searchsector].floorpicnum = MAXTILES-1; else sector[searchsector].floorpicnum += i; j = 0; } break; case 3: - while(!tilesizx[sprite[searchwall].picnum]||!tilesizy[sprite[searchwall].picnum]||j) { - if(sprite[searchwall].picnum+i >= MAXTILES) sprite[searchwall].picnum = 0; - else if(sprite[searchwall].picnum+i < 0) sprite[searchwall].picnum = MAXTILES-1; + while (!tilesizx[sprite[searchwall].picnum]||!tilesizy[sprite[searchwall].picnum]||j) { + if (sprite[searchwall].picnum+i >= MAXTILES) sprite[searchwall].picnum = 0; + else if (sprite[searchwall].picnum+i < 0) sprite[searchwall].picnum = MAXTILES-1; else sprite[searchwall].picnum += i; j = 0; } break; case 4: - while(!tilesizx[wall[searchwall].overpicnum]||!tilesizy[wall[searchwall].overpicnum]||j) { - if(wall[searchwall].overpicnum+i >= MAXTILES) wall[searchwall].overpicnum = 0; - else if(wall[searchwall].overpicnum+i < 0) wall[searchwall].overpicnum = MAXTILES-1; + while (!tilesizx[wall[searchwall].overpicnum]||!tilesizy[wall[searchwall].overpicnum]||j) { + if (wall[searchwall].overpicnum+i >= MAXTILES) wall[searchwall].overpicnum = 0; + else if (wall[searchwall].overpicnum+i < 0) wall[searchwall].overpicnum = MAXTILES-1; else wall[searchwall].overpicnum += i; j = 0; } @@ -2379,7 +2441,7 @@ void Keys3d(void) { framerateon = !framerateon; - if(framerateon) message("Show framerate ON"); + if (framerateon) message("Show framerate ON"); else message("Show framerate OFF"); } @@ -2438,12 +2500,16 @@ void Keys3d(void) { i = wall[searchwall].cstat; i = ((i>>3)&1)+((i>>7)&2); //3-x,8-y - switch(i) + switch (i) { - case 0: i = 1; break; - case 1: i = 3; break; - case 2: i = 0; break; - case 3: i = 2; break; + case 0: + i = 1; break; + case 1: + i = 3; break; + case 2: + i = 0; break; + case 3: + i = 2; break; } i = ((i&1)<<3)+((i&2)<<7); wall[searchwall].cstat &= ~0x0108; @@ -2454,16 +2520,24 @@ void Keys3d(void) { i = sector[searchsector].ceilingstat; i = (i&0x4)+((i>>4)&3); - switch(i) + switch (i) { - case 0: i = 6; break; - case 6: i = 3; break; - case 3: i = 5; break; - case 5: i = 1; break; - case 1: i = 7; break; - case 7: i = 2; break; - case 2: i = 4; break; - case 4: i = 0; break; + case 0: + i = 6; break; + case 6: + i = 3; break; + case 3: + i = 5; break; + case 5: + i = 1; break; + case 1: + i = 7; break; + case 7: + i = 2; break; + case 2: + i = 4; break; + case 4: + i = 0; break; } i = (i&0x4)+((i&3)<<4); sector[searchsector].ceilingstat &= ~0x34; @@ -2474,16 +2548,24 @@ void Keys3d(void) { i = sector[searchsector].floorstat; i = (i&0x4)+((i>>4)&3); - switch(i) + switch (i) { - case 0: i = 6; break; - case 6: i = 3; break; - case 3: i = 5; break; - case 5: i = 1; break; - case 1: i = 7; break; - case 7: i = 2; break; - case 2: i = 4; break; - case 4: i = 0; break; + case 0: + i = 6; break; + case 6: + i = 3; break; + case 3: + i = 5; break; + case 5: + i = 1; break; + case 1: + i = 7; break; + case 7: + i = 2; break; + case 2: + i = 4; break; + case 4: + i = 0; break; } i = (i&0x4)+((i&3)<<4); sector[searchsector].floorstat &= ~0x34; @@ -2501,12 +2583,16 @@ void Keys3d(void) else { i = ((i>>2)&3); - switch(i) + switch (i) { - case 0: i = 1; break; - case 1: i = 3; break; - case 2: i = 0; break; - case 3: i = 2; break; + case 0: + i = 1; break; + case 1: + i = 3; break; + case 2: + i = 0; break; + case 3: + i = 2; break; } i <<= 2; sprite[searchwall].cstat &= ~0xc; @@ -2529,7 +2615,7 @@ void Keys3d(void) k = 0; if (highlightsectorcnt >= 0) { - for(i=0;i= 0) - for(i=0;i= 0) { - for(i=0;i= 0) - for(i=0;i 640)); // printext256(searchx+4,searchy+4,whitecol,-1,tempbuf,!(xdimgame > 640)); } - if(helpon==1) + if (helpon==1) { - for(i=0;i 640)))+2,0,-1,Help3d[i],!(xdimgame > 640)); printext256(0*8,8+(i*(8+(xdimgame > 640))),whitecol,-1,Help3d[i],!(xdimgame > 640)); enddrawing(); - switch(i) + switch (i) { - case 8: Bsprintf(tempbuf,"%d",autosave); break; - case 9: Bsprintf(tempbuf,"%s",SKILLMODE[skill]); break; - case 10: Bsprintf(tempbuf,"%d",tabgraphic); break; - case 11: Bsprintf(tempbuf,"%d",framerateon); break; - case 12: Bsprintf(tempbuf,"%s",SPRDSPMODE[nosprites]); break; - case 13: Bsprintf(tempbuf,"%d",shadepreview); break; - case 14: Bsprintf(tempbuf,"%d",purpleon); break; - default : sprintf(tempbuf," "); break; + case 8: + Bsprintf(tempbuf,"%d",autosave); break; + case 9: + Bsprintf(tempbuf,"%s",SKILLMODE[skill]); break; + case 10: + Bsprintf(tempbuf,"%d",tabgraphic); break; + case 11: + Bsprintf(tempbuf,"%d",framerateon); break; + case 12: + Bsprintf(tempbuf,"%s",SPRDSPMODE[nosprites]); break; + case 13: + Bsprintf(tempbuf,"%d",shadepreview); break; + case 14: + Bsprintf(tempbuf,"%d",purpleon); break; + default : + sprintf(tempbuf," "); break; } begindrawing(); - if(!strcmp(tempbuf,"0")) + if (!strcmp(tempbuf,"0")) Bsprintf(tempbuf,"OFF"); - else if(!strcmp(tempbuf,"1")) + else if (!strcmp(tempbuf,"1")) Bsprintf(tempbuf,"ON"); - else if(!strcmp(tempbuf,"2")) + else if (!strcmp(tempbuf,"2")) Bsprintf(tempbuf,"ON (2)"); printext256((20+((xdimgame > 640) * 20))*8+2,8+(i*8+(xdimgame > 640))+2,0,-1,tempbuf,!(xdimgame > 640)); @@ -2889,9 +2983,9 @@ void Keys3d(void) enddrawing(); } */ - if(sector[cursectnum].lotag==2) + if (sector[cursectnum].lotag==2) { - if(sector[cursectnum].floorpal==8) SetBOSS1Palette(); + if (sector[cursectnum].floorpal==8) SetBOSS1Palette(); else SetWATERPalette(); } else SetGAMEPalette(); @@ -2902,7 +2996,7 @@ void Keys3d(void) - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x20]==1) // ' d + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x20]==1) // ' d /* { ShowHelpText("SectorEffector"); @@ -2910,87 +3004,87 @@ void Keys3d(void) { keystatus[0x20] = 0; - skill++; if(skill>MAXSKILL-1) skill=0; + skill++; if (skill>MAXSKILL-1) skill=0; sprintf(tempbuf,"%s",SKILLMODE[skill]); // printext256(1*4,1*8,11,-1,tempbuf,0); message(tempbuf); } begindrawing(); - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x22]==1) // ' g + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x22]==1) // ' g { keystatus[0x22] = 0; tabgraphic++; if (tabgraphic > 2) tabgraphic = 0; - if(tabgraphic) message("Graphics ON"); + if (tabgraphic) message("Graphics ON"); else message("Graphics OFF"); } - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x2d]==1) // ' x + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x2d]==1) // ' x { keystatus[0x2d] = 0; shadepreview=!shadepreview; - if(shadepreview) message("Sprite shade preview ON"); + if (shadepreview) message("Sprite shade preview ON"); else message("Sprite shade preview OFF"); } - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x13]==1) // ' r + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x13]==1) // ' r { keystatus[0x13] = 0; framerateon=!framerateon; - if(framerateon) message("Framerate ON"); + if (framerateon) message("Framerate ON"); else message("Framerate OFF"); } - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x11]==1) // ' w + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x11]==1) // ' w { keystatus[0x11] = 0; - nosprites++; if(nosprites>3) nosprites=0; + nosprites++; if (nosprites>3) nosprites=0; Bsprintf(tempbuf,"%s",SPRDSPMODE[nosprites]); // printext256(1*4,1*8,whitecol,-1,tempbuf,0); message(tempbuf); } - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x15]==1) // ' y + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x15]==1) // ' y { keystatus[0x15] = 0; - purpleon=!purpleon; if(nosprites>3) nosprites=0; - if(purpleon) message("Purple ON"); + purpleon=!purpleon; if (nosprites>3) nosprites=0; + if (purpleon) message("Purple ON"); else message("Purple OFF"); } enddrawing(); - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x2e]==1) // ' C + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x2e]==1) // ' C { keystatus[0x2e] = 0; switch (searchstat) { case 0: case 4: - for(i=0;i0) // F2 + if (keystatus[0x3c]>0) // F2 { usedcount=!usedcount; keystatus[0x3c] = 0; } - if(keystatus[0x0f]>0) // TAB : USED + if (keystatus[0x0f]>0) // TAB : USED { // usedcount=!usedcount; count=0; - for(i=0;i= 16384) { @@ -3536,7 +3651,7 @@ void Keys2d(void) } } - if(keystatus[KEYSC_QUOTE] && keystatus[KEYSC_F]) // ' F + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_F]) // ' F { void FuncMenu(void); keystatus[KEYSC_F] = 0; @@ -3544,21 +3659,21 @@ void Keys2d(void) FuncMenu(); } - if(keystatus[0x1a]>0) // [ search backward + if (keystatus[0x1a]>0) // [ search backward { keystatus[0x1a]=0; - if(wallsprite==0) + if (wallsprite==0) { SearchSectorsBackward(); } else - if(wallsprite==1) + if (wallsprite==1) { - if(curwallnum>0) curwallnum--; - for(i=curwallnum;i>=0;i--) + if (curwallnum>0) curwallnum--; + for (i=curwallnum;i>=0;i--) { - if( + if ( (wall[i].picnum==wall[curwall].picnum) &&((search_lotag==0)|| (search_lotag!=0 && search_lotag==wall[i].lotag)) @@ -3579,13 +3694,13 @@ void Keys2d(void) } else - if(wallsprite==2) + if (wallsprite==2) { - if(cursearchspritenum>0) cursearchspritenum--; - for(i=cursearchspritenum;i>=0;i--) + if (cursearchspritenum>0) cursearchspritenum--; + for (i=cursearchspritenum;i>=0;i--) { - if( + if ( (sprite[i].picnum==sprite[cursearchsprite].picnum && sprite[i].statnum==0 ) &&((search_lotag==0)|| @@ -3609,21 +3724,21 @@ void Keys2d(void) } - if(keystatus[0x1b]>0) // ] search forward + if (keystatus[0x1b]>0) // ] search forward { keystatus[0x1b]=0; - if(wallsprite==0) + if (wallsprite==0) { SearchSectorsForward(); } else - if(wallsprite==1) + if (wallsprite==1) { - if(curwallnum 0?-1:1); if (grid == -1 || grid == 9) { - switch(grid) { + switch (grid) { case -1: grid = 8; break; @@ -3685,7 +3800,7 @@ void Keys2d(void) break; } } - if(!grid) sprintf(tempbuf,"Grid off"); + if (!grid) sprintf(tempbuf,"Grid off"); else sprintf(tempbuf,"Grid size: %d (%d units)",grid,2048>>grid); printmessage16(tempbuf); keystatus[0x22] = 0; @@ -3723,9 +3838,9 @@ void Keys2d(void) } - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x04]==1) // ' 3 + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x04]==1) // ' 3 { - onnames++; if(onnames>8) onnames=0; + onnames++; if (onnames>8) onnames=0; keystatus[0x04]=0; Bsprintf(tempbuf,"Mode %d %s",onnames,SpriteMode[onnames]); printmessage16(tempbuf); @@ -3735,7 +3850,7 @@ void Keys2d(void) // Ver(); #ifdef VULGARITY - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x05]==1) // ' 4 + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x05]==1) // ' 4 { keystatus[0x05]=0; MinRate=getnumber16("Enter Min Frame Rate : ", MinRate, 65536L,0); @@ -3792,7 +3907,7 @@ void Keys2d(void) } */ - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x08]==1) // ' 7 : swap hilo + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x08]==1) // ' 7 : swap hilo { keystatus[0x08]=0; @@ -3814,7 +3929,7 @@ void Keys2d(void) } } - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x24]==1) // ' J + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x24]==1) // ' J { posx=getnumber16("X-coordinate: ",posx,131072L,1); posy=getnumber16("Y-coordinate: ",posy,131072L,1); @@ -3830,7 +3945,7 @@ void ExtSetupSpecialSpriteCols(void) short i; 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;iltextptr; switch (tokn) { case T_LOADGRP: + { + char *fn; + if (!scriptfile_getstring(script,&fn)) { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - int j = initgroupfile(fn); + int j = initgroupfile(fn); - if( j == -1 ) - initprintf("Could not find GRP file %s.\n",fn); - else - initprintf("Using GRP file %s.\n",fn); - } + if ( j == -1 ) + initprintf("Could not find GRP file %s.\n",fn); + else + initprintf("Using GRP file %s.\n",fn); } - break; + } + break; case T_EOF: return(0); default: @@ -4099,13 +4215,13 @@ int ExtInit(void) int asperr; #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) - addsearchpath("/usr/share/games/jfduke3d"); - addsearchpath("/usr/local/share/games/jfduke3d"); - addsearchpath("/usr/share/games/eduke32"); - addsearchpath("/usr/local/share/games/eduke32"); + addsearchpath("/usr/share/games/jfduke3d"); + addsearchpath("/usr/local/share/games/jfduke3d"); + addsearchpath("/usr/share/games/eduke32"); + addsearchpath("/usr/local/share/games/eduke32"); #elif defined(__APPLE__) - addsearchpath("/Library/Application Support/JFDuke3D"); - addsearchpath("/Library/Application Support/EDuke32"); + addsearchpath("/Library/Application Support/JFDuke3D"); + addsearchpath("/Library/Application Support/EDuke32"); #endif if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd); if ((homedir = Bgethomedir())) { @@ -4148,7 +4264,7 @@ int ExtInit(void) if (loadsetup("build.cfg") < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1; - if(glusetexcache == -1 || glusetexcachecompression == -1) + if (glusetexcache == -1 || glusetexcachecompression == -1) { int i; @@ -4159,7 +4275,7 @@ int ExtInit(void) "textures and skins, but textures will load dramatically " "faster after the first time they are loaded."); if (i) i = 'y'; - if(i == 'y' || i == 'Y' ) + if (i == 'y' || i == 'Y' ) glusetexcompr = glusetexcache = glusetexcachecompression = 1; else glusetexcache = glusetexcachecompression = 0; } @@ -4207,7 +4323,7 @@ void ExtPreCheckKeys(void) // just before drawrooms if (qsetmode == 200) //In 3D mode { if (floor_over_floor) ExtSE40Code(posx,posy,posz,ang,horiz); - if(purpleon) clearview(255); + if (purpleon) clearview(255); if (sidemode != 0) { lockbyte4094 = 1; @@ -4227,20 +4343,20 @@ void ExtAnalyzeSprites(void) char frames=0; signed char l; - for(i=0,tspr=&tsprite[0];ipicnum<11) tspr->xrepeat=0; + if ((nosprites==1||nosprites==3)&&tspr->picnum<11) tspr->xrepeat=0; - if(nosprites==1||nosprites==3) - switch(tspr->picnum) + if (nosprites==1||nosprites==3) + switch (tspr->picnum) { case SEENINE : tspr->xrepeat=0; } - if(shadepreview && !(tspr->cstat & 16)) + if (shadepreview && !(tspr->cstat & 16)) { if (sector[tspr->sectnum].ceilingstat&1) l = sector[tspr->sectnum].ceilingshade; @@ -4250,14 +4366,14 @@ void ExtAnalyzeSprites(void) if (sector[tspr->sectnum].floorpal != 0 && sector[tspr->sectnum].floorpal < num_tables) tspr->pal=sector[tspr->sectnum].floorpal; } - if(l < -127) l = -127; - if(l > 126) l = 127; + if (l < -127) l = -127; + if (l > 126) l = 127; tspr->shade = l; } - switch(tspr->picnum) + switch (tspr->picnum) { // 5-frame walk case 1550 : // Shark @@ -4272,7 +4388,7 @@ void ExtAnalyzeSprites(void) case BOSS1SHOOT : case BOSS1LOB : case LIZTROOPSHOOT : - if(frames==0) frames=2; + if (frames==0) frames=2; // 4-frame walk case 1491 : // duke crawl @@ -4285,16 +4401,16 @@ void ExtAnalyzeSprites(void) case BOSS3 : case BOSS4 : case NEWBEAST: - if(frames==0) frames=4; + if (frames==0) frames=4; case LIZTROOPJETPACK : case DRONE : case COMMANDER : case TANK : case RECON : - if(frames==0) frames = 10; + if (frames==0) frames = 10; case CAMERA1: case APLAYER : - if(frames==0) frames=1; + if (frames==0) frames=1; case GREENSLIME : case EGG : case PIGCOPSTAYPUT : @@ -4303,23 +4419,23 @@ void ExtAnalyzeSprites(void) case LIZMANSPITTING : case LIZMANFEEDING : case LIZMANJUMP : - if(skill!=4) + if (skill!=4) { - if(tspr->lotag>skill+1) + if (tspr->lotag>skill+1) { tspr->xrepeat=0; break; } } - if(nosprites==2||nosprites==3) + if (nosprites==2||nosprites==3) { tspr->xrepeat=0; // tspr->cstat|=32768; } // else tspr->cstat&=32767; - if(frames!=0) + if (frames!=0) { - if(frames==10) frames=0; + if (frames==10) frames=0; k = getangle(tspr->x-posx,tspr->y-posy); k = (((tspr->ang+3072+128-k)&2047)>>8)&7; //This guy has only 5 pictures for 8 angles (3 are x-flipped) @@ -4335,11 +4451,11 @@ void ExtAnalyzeSprites(void) } } - if(frames==2) tspr->picnum+=((((4-(totalclock>>5)))&1)*5); - if(frames==4) tspr->picnum+=((((4-(totalclock>>5)))&3)*5); - if(frames==5) tspr->picnum+=(((totalclock>>5)%5))*5; + if (frames==2) tspr->picnum+=((((4-(totalclock>>5)))&1)*5); + if (frames==4) tspr->picnum+=((((4-(totalclock>>5)))&3)*5); + if (frames==5) tspr->picnum+=(((totalclock>>5)%5))*5; - if(tilesizx[tspr->picnum] == 0) + if (tilesizx[tspr->picnum] == 0) tspr->picnum -= 5; //Hack, for actors break; @@ -4353,19 +4469,19 @@ void ExtAnalyzeSprites(void) void Keys2d3d(void) { int i, j; - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x1e]==1) // ' a + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x1e]==1) // ' a { keystatus[0x1e] = 0; autosave=!autosave; - if(autosave) message("Autosave ON"); + if (autosave) message("Autosave ON"); else message("Autosave OFF"); } - if(keystatus[KEYSC_QUOTE]==1 && keystatus[KEYSC_N]==1) // ' n + if (keystatus[KEYSC_QUOTE]==1 && keystatus[KEYSC_N]==1) // ' n { keystatus[KEYSC_N] = 0; noclip=!noclip; - if(noclip) message("Clipping disabled"); + if (noclip) message("Clipping disabled"); else message("Clipping enabled"); } @@ -4411,9 +4527,9 @@ void Keys2d3d(void) //if (dimensionmode[snum] == 2) charsperline = 80; if (qsetmode == 200) { - for(i=0;i<=getmessageleng;i+=charsperline) + for (i=0;i<=getmessageleng;i+=charsperline) { - for(j=0;j=5) counter=0; + counter++; if (counter>=5) counter=0; sampletimer(); if (totalclock < ototalclock+TICSPERFRAME) @@ -4520,7 +4636,7 @@ void faketimerhandler(void) if (horiz < 100) horiz++; if (horiz > 100) horiz--; - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x06]==1) // ' 5 + if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x06]==1) // ' 5 { keystatus[0x06]=0; editstatus = 1; @@ -4530,7 +4646,7 @@ void faketimerhandler(void) void SetBOSS1Palette() { - if(acurpalette==3) return; + if (acurpalette==3) return; acurpalette=3; kensetpalette(BOSS1palette); } @@ -4538,14 +4654,14 @@ void SetBOSS1Palette() void SetSLIMEPalette() { - if(acurpalette==2) return; + if (acurpalette==2) return; acurpalette=2; kensetpalette(SLIMEpalette); } void SetWATERPalette() { - if(acurpalette==1) return; + if (acurpalette==1) return; acurpalette=1; kensetpalette(WATERpalette); } @@ -4553,7 +4669,7 @@ void SetWATERPalette() void SetGAMEPalette() { - if(acurpalette==0) return; + if (acurpalette==0) return; acurpalette=0; kensetpalette(GAMEpalette); } @@ -4563,7 +4679,7 @@ void kensetpalette(char *vgapal) long i; char vesapal[1024]; - for(i=0;i<256;i++) + for (i=0;i<256;i++) { vesapal[i*4+0] = vgapal[i*3+2]; vesapal[i*4+1] = vgapal[i*3+1]; @@ -4576,12 +4692,12 @@ void kensetpalette(char *vgapal) void SearchSectorsForward() { long ii=0; - if(cursector_lotag!=0) + if (cursector_lotag!=0) { - if(cursectornum0) cursectornum--; - for(ii=cursectornum;ii>=0;ii--) + if (cursectornum>0) cursectornum--; + for (ii=cursectornum;ii>=0;ii--) { - if(sector[ii].lotag==cursector_lotag) + if (sector[ii].lotag==cursector_lotag) { posx=wall[sector[ii].wallptr].x; posy=wall[sector[ii].wallptr].y; @@ -4633,7 +4749,7 @@ void EditSectorData(short sectnum) showsectordata(sectnum); begindrawing(); - while(keystatus[1] == 0) + while (keystatus[1] == 0) { if (handleevents()) { if (quitevent) quitevent = 0; @@ -4869,7 +4985,7 @@ void EditWallData(short wallnum) clearmidstatbar16(); showwalldata(wallnum); begindrawing(); - while(keystatus[1] == 0) + while (keystatus[1] == 0) { if (handleevents()) { if (quitevent) quitevent = 0; @@ -5001,7 +5117,7 @@ void EditSpriteData(short spritenum) clearmidstatbar16(); showspritedata(spritenum); - while(keystatus[1] == 0) + while (keystatus[1] == 0) { begindrawing(); if (handleevents()) { @@ -5031,27 +5147,27 @@ void EditSpriteData(short spritenum) switch (col) { case 1: - { - printext16(xpos,ypos+row*8,11,0,disptext,0); - col = 0; - xpos = 8; - rowmax = 4; - dispwidth = 23; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; + { + printext16(xpos,ypos+row*8,11,0,disptext,0); + col = 0; + xpos = 8; + rowmax = 4; + dispwidth = 23; + disptext[dispwidth] = 0; + if (row > rowmax) row = rowmax; + } + break; case 2: - { - printext16(xpos,ypos+row*8,11,0,disptext,0); - col = 1; - xpos = 200; - rowmax = 5; - dispwidth = 24; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; + { + printext16(xpos,ypos+row*8,11,0,disptext,0); + col = 1; + xpos = 200; + rowmax = 5; + dispwidth = 24; + disptext[dispwidth] = 0; + if (row > rowmax) row = rowmax; + } + break; } keystatus[0xcb] = 0; } @@ -5060,27 +5176,27 @@ void EditSpriteData(short spritenum) switch (col) { case 0: - { - printext16(xpos,ypos+row*8,11,0,disptext,0); - col = 1; - xpos = 200; - rowmax = 5; - dispwidth = 24; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; + { + printext16(xpos,ypos+row*8,11,0,disptext,0); + col = 1; + xpos = 200; + rowmax = 5; + dispwidth = 24; + disptext[dispwidth] = 0; + if (row > rowmax) row = rowmax; + } + break; case 1: - { - printext16(xpos,ypos+row*8,11,0,disptext,0); - col = 2; - xpos = 400; - rowmax = 6; - dispwidth = 26; - disptext[dispwidth] = 0; - if (row > rowmax) row = rowmax; - } - break; + { + printext16(xpos,ypos+row*8,11,0,disptext,0); + col = 2; + xpos = 400; + rowmax = 6; + dispwidth = 26; + disptext[dispwidth] = 0; + if (row > rowmax) row = rowmax; + } + break; } keystatus[0xcd] = 0; } @@ -5092,234 +5208,234 @@ void EditSpriteData(short spritenum) switch (col) { case 0: + { + switch (row) { - switch (row) + case 0: + { + for (i=Bsprintf(disptext,"X-coordinate: %ld",sprite[spritenum].x); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) X-coordinate: ",spritenum); + if (editval) { - case 0: - { - for (i=Bsprintf(disptext,"X-coordinate: %ld",sprite[spritenum].x); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) X-coordinate: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].x = getnumber16(edittext,sprite[spritenum].x,131072,1); - } - } - break; - case 1: - { - for (i=Bsprintf(disptext,"Y-coordinate: %ld",sprite[spritenum].y); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Y-coordinate: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].y = getnumber16(edittext,sprite[spritenum].y,131072,1); - } - } - break; - case 2: - { - for (i=Bsprintf(disptext,"Z-coordinate: %ld",sprite[spritenum].z); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Z-coordinate: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].z = getnumber16(edittext,sprite[spritenum].z,8388608,1); //2147483647L,-2147483648L - } - } - break; - case 3: - { - for (i=Bsprintf(disptext,"Sectnum: %d",sprite[spritenum].sectnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Sectnum: ",spritenum); - if (editval) - { - printmessage16(edittext); - i = getnumber16(edittext,sprite[spritenum].sectnum,MAXSECTORS-1,0); - if(i != sprite[spritenum].sectnum) - changespritesect(spritenum,i); - } - } - break; - case 4: - { - for (i=Bsprintf(disptext,"Statnum: %d",sprite[spritenum].statnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Statnum: ",spritenum); - if (editval) - { - printmessage16(edittext); - i = getnumber16(edittext,sprite[spritenum].statnum,MAXSTATUS-1,0); - if(i != sprite[spritenum].statnum) - changespritestat(spritenum,i); - } - } - break; + printmessage16(edittext); + sprite[spritenum].x = getnumber16(edittext,sprite[spritenum].x,131072,1); } } break; + case 1: + { + for (i=Bsprintf(disptext,"Y-coordinate: %ld",sprite[spritenum].y); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Y-coordinate: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].y = getnumber16(edittext,sprite[spritenum].y,131072,1); + } + } + break; + case 2: + { + for (i=Bsprintf(disptext,"Z-coordinate: %ld",sprite[spritenum].z); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Z-coordinate: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].z = getnumber16(edittext,sprite[spritenum].z,8388608,1); //2147483647L,-2147483648L + } + } + break; + case 3: + { + for (i=Bsprintf(disptext,"Sectnum: %d",sprite[spritenum].sectnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Sectnum: ",spritenum); + if (editval) + { + printmessage16(edittext); + i = getnumber16(edittext,sprite[spritenum].sectnum,MAXSECTORS-1,0); + if (i != sprite[spritenum].sectnum) + changespritesect(spritenum,i); + } + } + break; + case 4: + { + for (i=Bsprintf(disptext,"Statnum: %d",sprite[spritenum].statnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Statnum: ",spritenum); + if (editval) + { + printmessage16(edittext); + i = getnumber16(edittext,sprite[spritenum].statnum,MAXSTATUS-1,0); + if (i != sprite[spritenum].statnum) + changespritestat(spritenum,i); + } + } + break; + } + } + break; case 1: + { + switch (row) { - switch (row) + case 0: + { + for (i=Bsprintf(disptext,"Flags (hex): %x",sprite[spritenum].cstat); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Flags: ",spritenum); + if (editval) { - case 0: - { - for (i=Bsprintf(disptext,"Flags (hex): %x",sprite[spritenum].cstat); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Flags: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].cstat = (short)getnumber16(edittext,(long)sprite[spritenum].cstat,32768L,0); - } - } - break; - case 1: - { - for (i=Bsprintf(disptext,"Shade: %d",sprite[spritenum].shade); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Shade: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].shade = (char)getnumber16(edittext,(long)sprite[spritenum].shade,127,1); - } - } - break; - case 2: - { - for (i=Bsprintf(disptext,"Pal: %d",sprite[spritenum].pal); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Pal: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].pal = (char)getnumber16(edittext,(long)sprite[spritenum].pal,MAXPALOOKUPS,0); - } - } - break; - case 3: - { - for (i=Bsprintf(disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - Bsprintf(edittext,"Sprite (%d) X Repeat: ",spritenum); - printmessage16(edittext); - sprite[spritenum].xrepeat = (char)getnumber16(edittext,(long)sprite[spritenum].xrepeat,256L,0); - Bsprintf(edittext,"Sprite (%d) Y Repeat: ",spritenum); - printmessage16(edittext); - sprite[spritenum].yrepeat = (char)getnumber16(edittext,(long)sprite[spritenum].yrepeat,256L,0); - } - } - break; - case 4: - { - for (i=Bsprintf(disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - Bsprintf(edittext,"Sprite (%d) X Offset: ",spritenum); - printmessage16(edittext); - sprite[spritenum].xoffset = (char)getnumber16(edittext,(long)sprite[spritenum].xoffset,128L,1); - Bsprintf(edittext,"Sprite (%d) Y Offset: ",spritenum); - printmessage16(edittext); - sprite[spritenum].yoffset = (char)getnumber16(edittext,(long)sprite[spritenum].yoffset,128L,1); - } - } - break; - case 5: - { - for (i=Bsprintf(disptext,"Tile number: %d",sprite[spritenum].picnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Tile number: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].picnum = (short)getnumber16(edittext,(long)sprite[spritenum].picnum,MAXTILES,0); - } - } - break; + printmessage16(edittext); + sprite[spritenum].cstat = (short)getnumber16(edittext,(long)sprite[spritenum].cstat,32768L,0); } } break; + case 1: + { + for (i=Bsprintf(disptext,"Shade: %d",sprite[spritenum].shade); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Shade: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].shade = (char)getnumber16(edittext,(long)sprite[spritenum].shade,127,1); + } + } + break; + case 2: + { + for (i=Bsprintf(disptext,"Pal: %d",sprite[spritenum].pal); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Pal: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].pal = (char)getnumber16(edittext,(long)sprite[spritenum].pal,MAXPALOOKUPS,0); + } + } + break; + case 3: + { + for (i=Bsprintf(disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); i < dispwidth; i++) disptext[i] = ' '; + if (editval) + { + Bsprintf(edittext,"Sprite (%d) X Repeat: ",spritenum); + printmessage16(edittext); + sprite[spritenum].xrepeat = (char)getnumber16(edittext,(long)sprite[spritenum].xrepeat,256L,0); + Bsprintf(edittext,"Sprite (%d) Y Repeat: ",spritenum); + printmessage16(edittext); + sprite[spritenum].yrepeat = (char)getnumber16(edittext,(long)sprite[spritenum].yrepeat,256L,0); + } + } + break; + case 4: + { + for (i=Bsprintf(disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); i < dispwidth; i++) disptext[i] = ' '; + if (editval) + { + Bsprintf(edittext,"Sprite (%d) X Offset: ",spritenum); + printmessage16(edittext); + sprite[spritenum].xoffset = (char)getnumber16(edittext,(long)sprite[spritenum].xoffset,128L,1); + Bsprintf(edittext,"Sprite (%d) Y Offset: ",spritenum); + printmessage16(edittext); + sprite[spritenum].yoffset = (char)getnumber16(edittext,(long)sprite[spritenum].yoffset,128L,1); + } + } + break; + case 5: + { + for (i=Bsprintf(disptext,"Tile number: %d",sprite[spritenum].picnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Tile number: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].picnum = (short)getnumber16(edittext,(long)sprite[spritenum].picnum,MAXTILES,0); + } + } + break; + } + } + break; case 2: + { + switch (row) { - switch (row) + case 0: + { + for (i=Bsprintf(disptext,"Angle (2048 degrees): %d",sprite[spritenum].ang); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Angle: ",spritenum); + if (editval) { - case 0: - { - for (i=Bsprintf(disptext,"Angle (2048 degrees): %d",sprite[spritenum].ang); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Angle: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].ang = (short)getnumber16(edittext,(long)sprite[spritenum].ang,2048L,0); - } - } - break; - case 1: - { - for (i=Bsprintf(disptext,"X-Velocity: %d",sprite[spritenum].xvel); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) X-Velocity: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].xvel = getnumber16(edittext,(long)sprite[spritenum].xvel,32767,1); - } - } - break; - case 2: - { - for (i=Bsprintf(disptext,"Y-Velocity: %d",sprite[spritenum].yvel); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Y-Velocity: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].yvel = getnumber16(edittext,(long)sprite[spritenum].yvel,32767,1); - } - } - break; - case 3: - { - for (i=Bsprintf(disptext,"Z-Velocity: %d",sprite[spritenum].zvel); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Z-Velocity: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].zvel = getnumber16(edittext,(long)sprite[spritenum].zvel,32767,1); - } - } - break; - case 4: - { - for (i=Bsprintf(disptext,"Owner: %d",sprite[spritenum].owner); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Owner: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].owner = getnumber16(edittext,(long)sprite[spritenum].owner,MAXSPRITES,0); - } - } - break; - case 5: - { - for (i=Bsprintf(disptext,"Clipdist: %d",sprite[spritenum].clipdist); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Clipdist: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].clipdist = (char)getnumber16(edittext,(long)sprite[spritenum].clipdist,255,0); - } - } - break; - case 6: - { - for (i=Bsprintf(disptext,"Extra: %d",sprite[spritenum].extra); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sprite (%d) Extra: ",spritenum); - if (editval) - { - printmessage16(edittext); - sprite[spritenum].extra = getnumber16(edittext,(long)sprite[spritenum].extra,32767,1); - } - } - break; + printmessage16(edittext); + sprite[spritenum].ang = (short)getnumber16(edittext,(long)sprite[spritenum].ang,2048L,0); } } break; + case 1: + { + for (i=Bsprintf(disptext,"X-Velocity: %d",sprite[spritenum].xvel); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) X-Velocity: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].xvel = getnumber16(edittext,(long)sprite[spritenum].xvel,32767,1); + } + } + break; + case 2: + { + for (i=Bsprintf(disptext,"Y-Velocity: %d",sprite[spritenum].yvel); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Y-Velocity: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].yvel = getnumber16(edittext,(long)sprite[spritenum].yvel,32767,1); + } + } + break; + case 3: + { + for (i=Bsprintf(disptext,"Z-Velocity: %d",sprite[spritenum].zvel); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Z-Velocity: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].zvel = getnumber16(edittext,(long)sprite[spritenum].zvel,32767,1); + } + } + break; + case 4: + { + for (i=Bsprintf(disptext,"Owner: %d",sprite[spritenum].owner); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Owner: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].owner = getnumber16(edittext,(long)sprite[spritenum].owner,MAXSPRITES,0); + } + } + break; + case 5: + { + for (i=Bsprintf(disptext,"Clipdist: %d",sprite[spritenum].clipdist); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Clipdist: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].clipdist = (char)getnumber16(edittext,(long)sprite[spritenum].clipdist,255,0); + } + } + break; + case 6: + { + for (i=Bsprintf(disptext,"Extra: %d",sprite[spritenum].extra); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sprite (%d) Extra: ",spritenum); + if (editval) + { + printmessage16(edittext); + sprite[spritenum].extra = getnumber16(edittext,(long)sprite[spritenum].extra,32767,1); + } + } + break; + } + } + break; } printext16(xpos,ypos+row*8,11,1,disptext,0); @@ -5411,7 +5527,7 @@ void FuncMenu(void) FuncMenuOpts(); - while(!editval && keystatus[1] == 0) + while (!editval && keystatus[1] == 0) { begindrawing(); if (handleevents()) { @@ -5495,216 +5611,216 @@ void FuncMenu(void) switch (row) { case 0: + { + for (i=Bsprintf(disptext,"Replace invalid tiles"); i < dispwidth; i++) disptext[i] = ' '; + if (editval) { - for (i=Bsprintf(disptext,"Replace invalid tiles"); i < dispwidth; i++) disptext[i] = ' '; - if (editval) + j = 0; + for (i=0;i= 0) { - Bsprintf(tempbuf,"Delete all sprites of picnum: "); - i = getnumber16(tempbuf,-1,MAXSPRITES-1,1); - if (i >= 0) - { - for(j=0;j>4)/j; - } - printmessage16("Visibility adjusted"); - } else printmessage16("Aborted"); - } + if (sector[i].visibility < 240) + sector[i].visibility /= j; + else sector[i].visibility = 240 + (sector[i].visibility>>4)/j; + } + printmessage16("Visibility adjusted"); + } else printmessage16("Aborted"); } - break; + } + break; } break; } diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 0dad57409..c0eb6694c 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -417,12 +417,12 @@ void CONFIG_SetupMouse( void ) { Bsprintf(str,"MouseButton%ld",i); temp[0] = 0; if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) - if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp); Bsprintf(str,"MouseButtonClicked%ld",i); temp[0] = 0; if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) - if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp); } @@ -431,17 +431,17 @@ void CONFIG_SetupMouse( void ) { Bsprintf(str,"MouseAnalogAxes%ld",i); temp[0] = 0; if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) - if(CONFIG_AnalogNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_AnalogNameToNum(temp) != -1 || temp[0] == 0) MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp); Bsprintf(str,"MouseDigitalAxes%ld_0",i); temp[0] = 0; if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) - if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp); Bsprintf(str,"MouseDigitalAxes%ld_1",i); temp[0] = 0; if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) - if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp); Bsprintf(str,"MouseAnalogScale%ld",i); @@ -489,12 +489,12 @@ void CONFIG_SetupJoystick( void ) { Bsprintf(str,"JoystickButton%ld",i); temp[0] = 0; if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) - if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp); Bsprintf(str,"JoystickButtonClicked%ld",i); temp[0] = 0; if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) - if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp); } @@ -503,17 +503,17 @@ void CONFIG_SetupJoystick( void ) { Bsprintf(str,"JoystickAnalogAxes%ld",i); temp[0] = 0; if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) - if(CONFIG_AnalogNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_AnalogNameToNum(temp) != -1 || temp[0] == 0) JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp); Bsprintf(str,"JoystickDigitalAxes%ld_0",i); temp[0] = 0; if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) - if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp); Bsprintf(str,"JoystickDigitalAxes%ld_1",i); temp[0] = 0; if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) - if(CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) + if (CONFIG_FunctionNameToNum(temp) != -1 || temp[0] == 0) JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp); Bsprintf(str,"JoystickAnalogScale%ld",i); @@ -559,10 +559,10 @@ void readsavenames(void) { fn[4] = i+'0'; if ((fil = Bfopen(fn,"rb")) == NULL ) continue; - if(dfread(&j,sizeof(long),1,fil) != 1) { Bfclose(fil); continue; } - if(dfread(g_szBuf,j,1,fil) != 1) { Bfclose(fil); continue; } + if (dfread(&j,sizeof(long),1,fil) != 1) { Bfclose(fil); continue; } + if (dfread(g_szBuf,j,1,fil) != 1) { Bfclose(fil); continue; } if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; } - if(dummy != BYTEVERSION) { Bfclose(fil); continue; } + if (dummy != BYTEVERSION) { Bfclose(fil); continue; } if (dfread(&dummy,4,1,fil) != 1) { Bfclose(fil); continue; } if (dfread(&ud.savegame[i][0],19,1,fil) != 1) { ud.savegame[i][0] = 0; } Bfclose(fil); @@ -597,7 +597,7 @@ int32 CONFIG_ReadSetup( void ) if (scripthandle >= 0) { - for(dummy = 0;dummy < 10;dummy++) + for (dummy = 0;dummy < 10;dummy++) { commmacro[13] = dummy+'0'; SCRIPT_GetString( scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]); @@ -605,7 +605,7 @@ int32 CONFIG_ReadSetup( void ) SCRIPT_GetString( scripthandle, "Comm Setup","PlayerName",&tempbuf[0]); - while(Bstrlen(strip_color_codes(tempbuf)) > 10) + while (Bstrlen(strip_color_codes(tempbuf)) > 10) tempbuf[Bstrlen(tempbuf)-1] = '\0'; Bstrncpy(myname,tempbuf,sizeof(myname)-1); @@ -665,7 +665,7 @@ int32 CONFIG_ReadSetup( void ) check_player_color((int *)&ud.color,-1); ps[0].palookup = ud.pcolor[0] = ud.color; SCRIPT_GetNumber( scripthandle, "Misc", "Team",&ud.team); - if(ud.team > 1) ud.team = 0; + if (ud.team > 1) ud.team = 0; ud.pteam[0] = ud.team; SCRIPT_GetNumber( scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime); SCRIPT_GetNumber( scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode); @@ -677,7 +677,7 @@ int32 CONFIG_ReadSetup( void ) // weapon choices are defaulted in checkcommandline, which may override them if (!CommandWeaponChoice) - for(i=0;i<10;i++) + for (i=0;i<10;i++) { Bsprintf(buf,"WeaponChoice%ld",i); dummy = -1; @@ -813,12 +813,12 @@ void CONFIG_WriteSetup( void ) SCRIPT_PutNumber( scripthandle, "Sound Setup", "VoiceToggle",VoiceToggle,false,false); // JBF 20031211 - for(dummy=0;dummy (starttile + 93) ) break; + if ( ac < starttile || ac > (starttile + 93) ) break; - if(*t >= '0' && *t <= '9') + if (*t >= '0' && *t <= '9') newx += 8; else newx += tilesizx[ac]; t++; @@ -275,13 +276,13 @@ int gametext_(int small, int starttile, int x,int y,char *t,char s,char p,short x = (320>>1)-(newx>>1); } - while(*t) + while (*t) { - if(*t == '^' && isdigit(*(t+1))) + if (*t == '^' && isdigit(*(t+1))) { char smallbuf[3]; t += 1; - if(isdigit(*(t+1))) + if (isdigit(*(t+1))) { smallbuf[0] = *(t++); smallbuf[1] = *(t++); @@ -294,17 +295,17 @@ int gametext_(int small, int starttile, int x,int y,char *t,char s,char p,short } continue; } - if(*t == 32) {x+=5;t++;continue;} + if (*t == 32) {x+=5;t++;continue;} else ac = *t - '!' + starttile; - if( ac < starttile || ac > (starttile + 93) ) + if ( ac < starttile || ac > (starttile + 93) ) break; rotatesprite(x<<16,(y<<16)+(small?ScreenHeight<<15:0),65536,0,ac,s,p,small?(8|16):(2|orientation),x1,y1,x2,y2); - if((*t >= '0' && *t <= '9')) + if ((*t >= '0' && *t <= '9')) x += 8; else x += tilesizx[ac];//(tilesizx[ac]>>small); - if(t-oldt >= (signed)TEXTWRAPLEN-!small) oldt = t, x = oldx, y+=8; + if (t-oldt >= (signed)TEXTWRAPLEN-!small) oldt = t, x = oldx, y+=8; t++; } @@ -323,7 +324,7 @@ inline int gametextpal(int x,int y,char *t,char s,char p) inline int mpgametext(int y,char *t,char s,short dabits) { - if(xdim >= 640 && ydim >= 480) + if (xdim >= 640 && ydim >= 480) return(gametext_(1,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1)); else return(gametext_(0,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1)); } @@ -336,10 +337,10 @@ int minitext_(int x,int y,char *t,char s,char p,short sb) cmode = (sb&256)!=0; sb &= 255; - while(*t) + while (*t) { ch = Btoupper(*t); - if(ch == 32) {x+=5;t++;continue;} + if (ch == 32) {x+=5;t++;continue;} else ac = ch - '!' + MINIFONT; if (cmode) rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,ac,s,p,sb,0,0,xdim-1,ydim-1); @@ -376,7 +377,7 @@ void allowtimetocorrecterrorswhenquitting(void) ready2send = 0; - for(j=0;j<8;j++) + for (j=0;j<8;j++) { oldtotalclock = totalclock; @@ -384,10 +385,10 @@ void allowtimetocorrecterrorswhenquitting(void) handleevents(); getpackets(); } - if(KB_KeyPressed(sc_Escape)) return; + if (KB_KeyPressed(sc_Escape)) return; packbuf[0] = 127; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { if (i != myconnectindex) sendpacket(i,packbuf,1); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -399,7 +400,7 @@ void adduserquote(char *daquote) { long 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]; @@ -420,9 +421,9 @@ void getpackets(void) sampletimer(); AudioUpdate(); - if(ALT_IS_PRESSED && KB_KeyPressed(sc_Enter)) + if (ALT_IS_PRESSED && KB_KeyPressed(sc_Enter)) { - if(setgamemode(!ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP)) { + if (setgamemode(!ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP)) { OSD_Printf("Failed setting fullscreen video mode.\n"); if (setgamemode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP)) gameexit("Failed to recover from failure to set fullscreen video mode.\n"); @@ -434,9 +435,9 @@ void getpackets(void) } // only dispatch commands here when not in a game -if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } +if ( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } - if(qe == 0 && KB_KeyPressed(sc_LeftControl) && KB_KeyPressed(sc_LeftAlt) && KB_KeyPressed(sc_Delete)) + if (qe == 0 && KB_KeyPressed(sc_LeftControl) && KB_KeyPressed(sc_LeftAlt) && KB_KeyPressed(sc_Delete)) { qe = 1; gameexit("Quick Exit."); @@ -445,14 +446,14 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } if (numplayers < 2) return; while ((packbufleng = getpacket(&other,packbuf)) > 0) { - switch(packbuf[0]) + switch (packbuf[0]) { case 254: //slaves in M/S mode only send to master 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) sendpacket(i,packbuf,packbufleng); } @@ -488,14 +489,14 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } 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) sendpacket(i,packbuf,packbufleng); } Bstrcpy(boardfilename,packbuf+1); boardfilename[packbufleng-1] = 0; - if(boardfilename[0] != 0) + if (boardfilename[0] != 0) { if ((i = kopen4load(boardfilename,0)) < 0) { Bmemset(boardfilename,0,sizeof(boardfilename)); @@ -503,7 +504,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } } else kclose(i); } - if(ud.m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0) + if (ud.m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0) ud.m_level_number = 0; break; @@ -513,15 +514,15 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } 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) sendpacket(i,packbuf,packbufleng); } - switch(packbuf[1]) + switch (packbuf[1]) { case 0: - if(voting == myconnectindex && gotvote[packbuf[2]] == 0) + if (voting == myconnectindex && gotvote[packbuf[2]] == 0) { gotvote[packbuf[2]] = 1; votes[packbuf[2]] = packbuf[3]; @@ -544,14 +545,14 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } break; case 2: // cancel map vote - if(voting == packbuf[2]) + if (voting == packbuf[2]) { voting = -1; i = 0; - for(j=0;j=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) if (i != other) sendpacket(i,packbuf,packbufleng); multiflag = 2; @@ -580,7 +581,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } j = 1; if ((movefifoend[other]&(TIMERUPDATESIZ-1)) == 0) - for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) { if (playerquitflag[i] == 0) continue; if (i == myconnectindex) @@ -592,9 +593,9 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } nsyn = (input *)&inputfifo[(movefifoend[connecthead])&(MOVEFIFOSIZ-1)][0]; k = j; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) j += playerquitflag[i]+playerquitflag[i]; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { if (playerquitflag[i] == 0) continue; @@ -624,8 +625,8 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } while (j != packbufleng) { - for(i=connecthead;i>=0;i=connectpoint2[i]) - if(i != myconnectindex) + for (i=connecthead;i>=0;i=connectpoint2[i]) + if (i != myconnectindex) { syncval[i][syncvalhead[i]&(MOVEFIFOSIZ-1)] = packbuf[j]; syncvalhead[i]++; @@ -633,9 +634,9 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } j++; } - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) - for(j=1;j=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) if (i != other) sendpacket(i,packbuf,packbufleng); } @@ -713,10 +714,10 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } //Slaves in M/S mode only send to master //Master re-transmits message to all others if ((!networkmode) && (myconnectindex == connecthead)) - for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) if (i != other) sendpacket(i,packbuf,packbufleng); - if(vote_map != -1 || vote_episode != -1 || voting != -1) + if (vote_map != -1 || vote_episode != -1 || voting != -1) adduserquote("VOTE SUCCEEDED"); ud.m_level_number = ud.level_number = packbuf[1]; @@ -731,7 +732,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } ud.m_ffire = ud.ffire = packbuf[10]; ud.m_noexits = ud.noexits = packbuf[11]; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { resetweapons(i); resetinventory(i); @@ -747,7 +748,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!networkmode) && (myconnectindex == connecthead)) - for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) if (i != other) sendpacket(i,packbuf,packbufleng); if (packbuf[2] != BYTEVERSION) @@ -780,10 +781,10 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } //slaves in M/S mode only send to master //Master re-transmits message to all others if ((!networkmode) && (myconnectindex == connecthead)) - for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) if (i != other) sendpacket(i,packbuf,packbufleng); - if(numlumps == 0) break; + if (numlumps == 0) break; if (SoundToggle == 0 || ud.lockout == 1 || FXDevice < 0 ) break; @@ -803,7 +804,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } if ((movefifoend[other]&(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 = (long)((signed char)packbuf[j]); @@ -831,7 +832,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((long)packbuf[j++])<<24); movefifoend[other]++; - for(i=1;i= 16) return; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) if (movefifoend[i] < movefifoend[myconnectindex]-200) return; @@ -912,11 +913,11 @@ void faketimerhandler() if (numplayers < 2) { - if (ud.multimode > 1) for(i=connecthead;i>=0;i=connectpoint2[i]) - if(i != myconnectindex) + if (ud.multimode > 1) for (i=connecthead;i>=0;i=connectpoint2[i]) + if (i != myconnectindex) { //clearbufbyte(&inputfifo[movefifoend[i]&(MOVEFIFOSIZ-1)][i],sizeof(input),0L); - if(ud.playerai) + if (ud.playerai) computergetinput(i,&inputfifo[movefifoend[i]&(MOVEFIFOSIZ-1)][i]); inputfifo[movefifoend[i]&(MOVEFIFOSIZ-1)][i].svel++; inputfifo[movefifoend[i]&(MOVEFIFOSIZ-1)][i].fvel++; @@ -925,7 +926,7 @@ void faketimerhandler() return; } - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) { k = (movefifoend[myconnectindex]-1)-movefifoend[i]; @@ -961,10 +962,10 @@ void faketimerhandler() } 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(myminlag[i],-128),127); - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) myminlag[i] = 0x7fffffff; } @@ -1014,7 +1015,7 @@ void faketimerhandler() syncvaltail++; } - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) sendpacket(i,packbuf,j); @@ -1033,7 +1034,7 @@ void faketimerhandler() totalclock -= TICSPERFRAME*i; myminlag[connecthead] -= i; otherminlag += i; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) myminlag[i] = 0x7fffffff; } @@ -1085,18 +1086,18 @@ void faketimerhandler() } //This allows allow packet resends - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (movefifoend[i] <= movefifosendplc) { packbuf[0] = 127; - for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) sendpacket(i,packbuf,1); return; } while (1) //Master { - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (playerquitflag[i] && (movefifoend[i] <= movefifosendplc)) return; osyn = (input *)&inputfifo[(movefifosendplc-1)&(MOVEFIFOSIZ-1)][0]; @@ -1108,18 +1109,18 @@ void faketimerhandler() //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 (playerquitflag[i]) packbuf[j++] = min(max(myminlag[i],-128),127); - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) myminlag[i] = 0x7fffffff; } k = j; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) j += playerquitflag[i] + playerquitflag[i]; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { if (playerquitflag[i] == 0) continue; @@ -1165,7 +1166,7 @@ void faketimerhandler() syncvaltail++; } - for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) if (playerquitflag[i]) { sendpacket(i,packbuf,j); @@ -1178,7 +1179,8 @@ void faketimerhandler() } extern long cacnum; -typedef struct { long *hand, leng; char *lock; } cactype; +typedef struct { long *hand, leng; char *lock ; } +cactype; extern cactype cac[]; void caches(void) @@ -1186,7 +1188,7 @@ void caches(void) short i,k; k = 0; - for(i=0;i= 200) { Bsprintf(tempbuf,"Locked- %d: Leng:%ld, Lock:%d",i,cac[i].leng,*cac[i].lock); @@ -1195,7 +1197,7 @@ void caches(void) k += 6; - for(i=1;i<11;i++) + for (i=1;i<11;i++) if (lumplockbyte[i] >= 200) { Bsprintf(tempbuf,"RTS Locked %d:",i); @@ -1209,20 +1211,20 @@ void checksync(void) { long i; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (syncvalhead[i] == syncvaltottail) break; if (i < 0) { syncstat = 0; do { - for(i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) if (syncval[i][syncvaltottail&(MOVEFIFOSIZ-1)] != syncval[connecthead][syncvaltottail&(MOVEFIFOSIZ-1)]) syncstat = 1; syncvaltottail++; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (syncvalhead[i] == syncvaltottail) break; } while (i < 0); } @@ -1242,8 +1244,8 @@ void checksync(void) void check_fta_sounds(short i) { - if(sprite[i].extra > 0) - switch(dynamictostatic[PN]) + if (sprite[i].extra > 0) + switch (dynamictostatic[PN]) { case LIZTROOPONTOILET__STATIC: case LIZTROOPJUSTSIT__STATIC: @@ -1285,18 +1287,18 @@ void check_fta_sounds(short i) sound(BOS1_RECOG); break; case BOSS2__STATIC: - if(sprite[i].pal == 1) + if (sprite[i].pal == 1) sound(BOS2_RECOG); else sound(WHIPYOURASS); break; case BOSS3__STATIC: - if(sprite[i].pal == 1) + if (sprite[i].pal == 1) sound(BOS3_RECOG); else sound(RIPHEADNECK); break; case BOSS4__STATIC: case BOSS4STAYPUT__STATIC: - if(sprite[i].pal == 1) + if (sprite[i].pal == 1) sound(BOS4_RECOG); sound(BOSS4_FIRSTSEE); break; @@ -1308,7 +1310,7 @@ void check_fta_sounds(short i) inline short inventory(spritetype *s) { - switch(dynamictostatic[s->picnum]) + switch (dynamictostatic[s->picnum]) { case FIRSTAID__STATIC: case STEROIDS__STATIC: @@ -1327,13 +1329,13 @@ inline int checkspriteflags(short sActor, int iType) int i; i = spriteflags[sprite[sActor].picnum]; i ^= actorspriteflags[sActor]; - if(i & iType) return 1; + if (i & iType) return 1; else return 0; } inline int checkspriteflagsp(short sPicnum, int iType) { - if(spriteflags[sPicnum] & iType) return 1; + if (spriteflags[sPicnum] & iType) return 1; else return 0; } @@ -1343,11 +1345,11 @@ inline short badguypic(short pn) //stuff to the value from names.h so handling separately if ((pn >= GREENSLIME) && (pn <= GREENSLIME+7)) return 1; - if(checkspriteflagsp(pn,SPRITE_FLAG_BADGUY)) return 1; + if (checkspriteflagsp(pn,SPRITE_FLAG_BADGUY)) return 1; - if( actortype[pn] ) return 1; + if ( actortype[pn] ) return 1; - switch(dynamictostatic[pn]) + switch (dynamictostatic[pn]) { case SHARK__STATIC: case RECON__STATIC: @@ -1401,7 +1403,7 @@ void myos(long x, long y, short tilenum, signed char shade, char orientation) char p; short a; - if(orientation&4) + if (orientation&4) a = 1024; else a = 0; @@ -1413,7 +1415,7 @@ void myospal(long x, long y, short tilenum, signed char shade, char orientation, { short a; - if(orientation&4) + if (orientation&4) a = 1024; else a = 0; @@ -1425,7 +1427,7 @@ void myosx(long x, long y, short tilenum, signed char shade, char orientation) char p; short a; - if(orientation&4) + if (orientation&4) a = 1024; else a = 0; @@ -1437,7 +1439,7 @@ void myospalx(long x, long y, short tilenum, signed char shade, char orientation { short a; - if(orientation&4) + if (orientation&4) a = 1024; else a = 0; @@ -1448,13 +1450,13 @@ void invennum(long x,long y,char num1,char ha,char sbits) { char dabuf[80] = {0}; Bsprintf(dabuf,"%d",num1); - if(num1 > 99) + if (num1 > 99) { rotatesprite(sbarx(x-4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[2]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); } - else if(num1 > 9) + else if (num1 > 9) { rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,sbits,0,0,xdim-1,ydim-1); @@ -1479,11 +1481,11 @@ void weaponnum(short ind,long x,long y,long num1, long num2,char ha) rotatesprite(sbarx(x-3),sbary(y),sbarsc(65536L),0,THREEBYFIVE+10,ha,0,10,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+9),sbary(y),sbarsc(65536L),0,THREEBYFIVE+11,ha,0,10,0,0,xdim-1,ydim-1); - if(num1 > 99) num1 = 99; - if(num2 > 99) num2 = 99; + if (num1 > 99) num1 = 99; + if (num2 > 99) num2 = 99; Bsprintf(dabuf,"%ld",num1); - if(num1 > 9) + if (num1 > 9) { rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); @@ -1491,7 +1493,7 @@ void weaponnum(short ind,long x,long y,long num1, long num2,char ha) else rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); Bsprintf(dabuf,"%ld",num2); - if(num2 > 9) + if (num2 > 9) { rotatesprite(sbarx(x+13),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+17),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); @@ -1508,13 +1510,13 @@ void weaponnum999(char ind,long x,long y,long num1, long num2,char ha) rotatesprite(sbarx(x+13),sbary(y),sbarsc(65536L),0,THREEBYFIVE+11,ha,0,10,0,0,xdim-1,ydim-1); Bsprintf(dabuf,"%ld",num1); - if(num1 > 99) + if (num1 > 99) { rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+8),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[2]-'0',ha,0,10,0,0,xdim-1,ydim-1); } - else if(num1 > 9) + else if (num1 > 9) { rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+8),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); @@ -1522,13 +1524,13 @@ void weaponnum999(char ind,long x,long y,long num1, long num2,char ha) else rotatesprite(sbarx(x+8),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); Bsprintf(dabuf,"%ld",num2); - if(num2 > 99) + if (num2 > 99) { rotatesprite(sbarx(x+17),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+21),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+25),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[2]-'0',ha,0,10,0,0,xdim-1,ydim-1); } - else if(num2 > 9) + else if (num2 > 9) { rotatesprite(sbarx(x+17),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); rotatesprite(sbarx(x+21),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,10,0,0,xdim-1,ydim-1); @@ -1590,7 +1592,7 @@ void weapon_amounts(struct player_struct *p,long x,long y,long u) (!p->gotweapon[SHRINKER_WEAPON]*9)+12-18* (cw == SHRINKER_WEAPON) ); } else { - if(p->subweapon&(1<subweapon&(1<ammo_amount[GROW_WEAPON],max_ammo_amount[GROW_WEAPON], (!p->gotweapon[GROW_WEAPON]*9)+12-18* @@ -1659,7 +1661,7 @@ void digitalnumber(long x,long y,long n,char s,char cs) i = Bstrlen(b); j = 0; - for(k=0;k>1); j = 0; - for(k=0;k>1); j = 0; - for(k=0;kjetpack_amount > 0)<<3; if(n&8) j++; - n |= ( p->scuba_amount > 0 )<<5; if(n&32) j++; - n |= (p->steroids_amount > 0)<<1; if(n&2) j++; - n |= ( p->holoduke_amount > 0)<<2; if(n&4) j++; - n |= (p->firstaid_amount > 0); if(n&1) j++; - n |= (p->heat_amount > 0)<<4; if(n&16) j++; - n |= (p->boot_amount > 0)<<6; if(n&64) j++; + n = (p->jetpack_amount > 0)<<3; if (n&8) j++; + n |= ( p->scuba_amount > 0 )<<5; if (n&32) j++; + n |= (p->steroids_amount > 0)<<1; if (n&2) j++; + n |= ( p->holoduke_amount > 0)<<2; if (n&4) j++; + n |= (p->firstaid_amount > 0); if (n&1) j++; + n |= (p->heat_amount > 0)<<4; if (n&16) j++; + n |= (p->boot_amount > 0)<<6; if (n&64) j++; xoff = 160-(j*11); j = 0; - if(ud.screen_size > 4) + if (ud.screen_size > 4) y = 154; else y = (ud.drawweapon == 2?150:172); - if(ud.screen_size == 4 && ud.drawweapon != 2) + if (ud.screen_size == 4 && ud.drawweapon != 2) { - if(ud.multimode > 1) + if (ud.multimode > 1) xoff += 56; else xoff += 65; } - while( j <= 9 ) + while ( j <= 9 ) { - if( n&(1<inven_icon == j+1) + if (p->inven_icon == j+1) rotatesprite((xoff-2)<<16,(y+19)<<16,65536L,1024,ARROW,-32,0,2+16,windowx1,windowy1,windowx2,windowy2); } @@ -1787,15 +1789,15 @@ void displayfragbar(void) j = 0; - for(i=connecthead;i>=0;i=connectpoint2[i]) - if(i > j) j = i; + for (i=connecthead;i>=0;i=connectpoint2[i]) + if (i > j) j = i; rotatesprite(0,0,65600L,0,FRAGBAR,0,0,2+8+16+64,0,0,xdim-1,ydim-1); - if(j >= 4) rotatesprite(319,(8)<<16,65600L,0,FRAGBAR,0,0,10+16+64,0,0,xdim-1,ydim-1); - if(j >= 8) rotatesprite(319,(16)<<16,65600L,0,FRAGBAR,0,0,10+16+64,0,0,xdim-1,ydim-1); - if(j >= 12) rotatesprite(319,(24)<<16,65600L,0,FRAGBAR,0,0,10+16+64,0,0,xdim-1,ydim-1); + if (j >= 4) rotatesprite(319,(8)<<16,65600L,0,FRAGBAR,0,0,10+16+64,0,0,xdim-1,ydim-1); + if (j >= 8) rotatesprite(319,(16)<<16,65600L,0,FRAGBAR,0,0,10+16+64,0,0,xdim-1,ydim-1); + if (j >= 12) rotatesprite(319,(24)<<16,65600L,0,FRAGBAR,0,0,10+16+64,0,0,xdim-1,ydim-1); - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { minitext(21+(73*(i&3)),2+((i&28)<<1),&ud.user_name[i][0],/*sprite[ps[i].i].pal*/ps[i].palookup,2+8+16); Bsprintf(tempbuf,"%d",ps[i].frag-ps[i].fraggedself); @@ -1816,8 +1818,8 @@ void coolgaugetext(short snum) if (p->invdisptime > 0) displayinventory(p); - if(ps[snum].gm&MODE_MENU) - if( (current_menu >= 400 && current_menu <= 405) ) + if (ps[snum].gm&MODE_MENU) + if ( (current_menu >= 400 && current_menu <= 405) ) return; ss = ud.screen_size; if (ss < 4) return; @@ -1830,10 +1832,12 @@ void coolgaugetext(short snum) { displayfragbar(); } else { - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (ps[i].frag != sbar.frag[i]) { displayfragbar(); break; } + + } - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) sbar.frag[i] = ps[i].frag; } @@ -1844,7 +1848,7 @@ void coolgaugetext(short snum) if (p->inven_icon) rotatesprite(sbarx(69),sbary(200-30),sbarsc(65536L),0,INVENTORYBOX,0,21,10+16,0,0,xdim-1,ydim-1); - if(sprite[p->i].pal == 1 && p->last_extra < 2) + if (sprite[p->i].pal == 1 && p->last_extra < 2) digitalnumber(20,200-17,1,-16,10+16); else digitalnumber(20,200-17,p->last_extra,-16,10+16); @@ -1856,31 +1860,46 @@ void coolgaugetext(short snum) o = 158; permbit = 0; if (p->inven_icon) { - switch(p->inven_icon) + switch (p->inven_icon) { - case 1: i = FIRSTAID_ICON; break; - case 2: i = STEROIDS_ICON; break; - case 3: i = HOLODUKE_ICON; break; - case 4: i = JETPACK_ICON; break; - case 5: i = HEAT_ICON; break; - case 6: i = AIRTANK_ICON; break; - case 7: i = BOOT_ICON; break; - default: i = -1; + case 1: + i = FIRSTAID_ICON; break; + case 2: + i = STEROIDS_ICON; break; + case 3: + i = HOLODUKE_ICON; break; + case 4: + i = JETPACK_ICON; break; + case 5: + i = HEAT_ICON; break; + case 6: + i = AIRTANK_ICON; break; + case 7: + i = BOOT_ICON; break; + default: + i = -1; } if (i >= 0) rotatesprite(sbarx(231-o),sbary(200-21),sbarsc(65536L),0,i,0,0,10+16+permbit,0,0,xdim-1,ydim-1); minitext(292-30-o,190,"%",6,10+16+permbit + 256); j = 0x80000000; - switch(p->inven_icon) + switch (p->inven_icon) { - case 1: i = p->firstaid_amount; break; - case 2: i = ((p->steroids_amount+3)>>2); break; - case 3: i = ((p->holoduke_amount+15)/24); j = p->holoduke_on; break; - case 4: i = ((p->jetpack_amount+15)>>4); j = p->jetpack_on; break; - case 5: i = p->heat_amount/12; j = p->heat_on; break; - case 6: i = ((p->scuba_amount+63)>>6); break; - case 7: i = (p->boot_amount>>1); break; + case 1: + i = p->firstaid_amount; break; + case 2: + i = ((p->steroids_amount+3)>>2); break; + case 3: + i = ((p->holoduke_amount+15)/24); j = p->holoduke_on; break; + case 4: + i = ((p->jetpack_amount+15)>>4); j = p->jetpack_on; break; + case 5: + i = p->heat_amount/12; j = p->heat_on; break; + case 6: + i = ((p->scuba_amount+63)>>6); break; + case 7: + i = (p->boot_amount>>1); break; } invennum(284-30-o,200-6,(char)i,0,10+permbit); if (j > 0) minitext(288-30-o,180,"ON",0,10+16+permbit + 256); @@ -1892,31 +1911,36 @@ void coolgaugetext(short snum) //DRAW/UPDATE FULL STATUS BAR: -if (pus) { pus = 0; u = -1; } else u = 0; +if (pus) { pus = 0; u = -1; } + else u = 0; if (sbar.frag[myconnectindex] != p->frag) { sbar.frag[myconnectindex] = p->frag; u |= 32768; } if (sbar.got_access != p->got_access) { sbar.got_access = p->got_access; u |= 16384; } { long lAmount=GetGameVar("PLR_MORALE",-1, p->i, snum); - if(lAmount == -1) + if (lAmount == -1) { if (sbar.shield_amount != p->shield_amount) { sbar.shield_amount = p->shield_amount; u |= 2; } + + } else { if (sbar.shield_amount != lAmount) { sbar.shield_amount = lAmount; u |= 2; } + + } } if (sbar.curr_weapon != p->curr_weapon) { sbar.curr_weapon = p->curr_weapon; u |= (4+8+16+32+64+128+256+512+1024+65536L); } - for(i=1;iammo_amount[i]) { sbar.ammo_amount[i] = p->ammo_amount[i]; - if(i < 9) + if (i < 9) u |= ((2<frag) { sbar.frag[myconnectindex] = p->frag; if (sbar.gotweapon[i] != p->gotweapon[i]) { sbar.gotweapon[i] = p->gotweapon[i]; - if(i < 9 ) + if (i < 9 ) u |= ((2<inven_icon) { sbar.inven_icon = p->inven_icon; u |= (2 { long lAmount=GetGameVar("PLR_MORALE",-1, p->i, snum); if (u != -1) patchstatusbar(52,SBY+17,75,SBY+17+11); - if(lAmount == -1) + if (lAmount == -1) digitalnumber(64,SBY+17,p->shield_amount,-16,10+16); else digitalnumber(64,SBY+17,lAmount,-16,10+16); @@ -2020,6 +2044,8 @@ if (sbar.inven_icon != p->inven_icon) { sbar.inven_icon = p->inven_icon; u |= (2 { if (u&(2048+4096)) { patchstatusbar(231,SBY+13,265,SBY+13+18); } else { patchstatusbar(250,SBY+24,261,SBY+24+6); } + + } if (p->inven_icon) { @@ -2027,15 +2053,22 @@ if (sbar.inven_icon != p->inven_icon) { sbar.inven_icon = p->inven_icon; u |= (2 if (u&(2048+4096)) { - switch(p->inven_icon) + switch (p->inven_icon) { - case 1: i = FIRSTAID_ICON; break; - case 2: i = STEROIDS_ICON; break; - case 3: i = HOLODUKE_ICON; break; - case 4: i = JETPACK_ICON; break; - case 5: i = HEAT_ICON; break; - case 6: i = AIRTANK_ICON; break; - case 7: i = BOOT_ICON; break; + case 1: + i = FIRSTAID_ICON; break; + case 2: + i = STEROIDS_ICON; break; + case 3: + i = HOLODUKE_ICON; break; + case 4: + i = JETPACK_ICON; break; + case 5: + i = HEAT_ICON; break; + case 6: + i = AIRTANK_ICON; break; + case 7: + i = BOOT_ICON; break; } rotatesprite(sbarx(231-o),sbary(SBY+13),sbarsc(65536L),0,i,0,0,10+16+permbit,0,0,xdim-1,ydim-1); minitext(292-30-o,SBY+24,"%",6,10+16+permbit + 256); @@ -2043,27 +2076,38 @@ if (sbar.inven_icon != p->inven_icon) { sbar.inven_icon = p->inven_icon; u |= (2 } if (u&(2048+4096)) { - switch(p->inven_icon) + switch (p->inven_icon) { - case 3: j = p->holoduke_on; break; - case 4: j = p->jetpack_on; break; - case 5: j = p->heat_on; break; - default: j = 0x80000000; + case 3: + j = p->holoduke_on; break; + case 4: + j = p->jetpack_on; break; + case 5: + j = p->heat_on; break; + default: + j = 0x80000000; } if (j > 0) minitext(288-30-o,SBY+14,"ON",0,10+16+permbit + 256); else if ((unsigned long)j != 0x80000000) minitext(284-30-o,SBY+14,"OFF",2,10+16+permbit + 256); } if (u&8192) { - switch(p->inven_icon) + switch (p->inven_icon) { - case 1: i = p->firstaid_amount; break; - case 2: i = ((p->steroids_amount+3)>>2); break; - case 3: i = ((p->holoduke_amount+15)/24); break; - case 4: i = ((p->jetpack_amount+15)>>4); break; - case 5: i = p->heat_amount/12; break; - case 6: i = ((p->scuba_amount+63)>>6); break; - case 7: i = (p->boot_amount>>1); break; + case 1: + i = p->firstaid_amount; break; + case 2: + i = ((p->steroids_amount+3)>>2); break; + case 3: + i = ((p->holoduke_amount+15)/24); break; + case 4: + i = ((p->jetpack_amount+15)>>4); break; + case 5: + i = p->heat_amount/12; break; + case 6: + i = ((p->scuba_amount+63)>>6); break; + case 7: + i = (p->boot_amount>>1); break; } invennum(284-30-o,SBY+28,(char)i,0,10+permbit); } @@ -2087,10 +2131,10 @@ void tics(void) { int k = 1; - if(ud.screen_size != 0 && GTFLAGS(GAMETYPE_FLAG_FRAGBAR) && ud.multimode > 1) + if (ud.screen_size != 0 && GTFLAGS(GAMETYPE_FLAG_FRAGBAR) && ud.multimode > 1) { k += 8; - if(ud.multimode > 4) + if (ud.multimode > 4) k += 8; } Bsprintf(b,"%ld",j>0?j:0); @@ -2106,11 +2150,11 @@ void coords(short snum) { short y = 8; - if((gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR)) + if ((gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR)) { - if(ud.multimode > 1 && ud.multimode < 5) + if (ud.multimode > 1 && ud.multimode < 5) y = 16; - else if(ud.multimode > 4) + else if (ud.multimode > 4) y = 24; } sprintf(tempbuf,"X= %ld",ps[snum].posx); @@ -2143,16 +2187,16 @@ void operatefta(void) { long i, j, k, l; - if(ud.screen_size > 0) j = 200-45; else j = 200-8; + if (ud.screen_size > 0) j = 200-45; else j = 200-8; quotebot = min(quotebot,j); quotebotgoal = min(quotebotgoal,j); - if(ps[myconnectindex].gm&MODE_TYPE) j -= 8; + if (ps[myconnectindex].gm&MODE_TYPE) j -= 8; quotebotgoal = j; j = quotebot; - for(i=0;i TEXTWRAPLEN) + while (l > TEXTWRAPLEN) { l -= TEXTWRAPLEN; j -= 8; @@ -2174,7 +2218,7 @@ void operatefta(void) if (GTFLAGS(GAMETYPE_FLAG_FRAGBAR) && ud.screen_size > 0 && ud.multimode > 1) { j = 0; k = 8; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (i > j) j = i; if (j >= 4 && j <= 8) k += 8; @@ -2200,7 +2244,7 @@ void operatefta(void) k -= 4; } - if(fta_quotes[ps[screenpeek].ftq] == NULL) + if (fta_quotes[ps[screenpeek].ftq] == NULL) { OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,ps[screenpeek].ftq); return; @@ -2217,12 +2261,12 @@ void operatefta(void) void FTA(short q,struct player_struct *p) { - if(fta_quotes[p->ftq] != NULL) + if (fta_quotes[p->ftq] != NULL) { - if( ud.fta_on == 1) + if ( ud.fta_on == 1) { - if( p->fta > 0 && q != 115 && q != 116 ) - if( p->ftq == 115 || p->ftq == 116 ) return; + if ( p->fta > 0 && q != 115 && q != 116 ) + if ( p->ftq == 115 || p->ftq == 116 ) return; p->fta = 100; @@ -2250,13 +2294,15 @@ void showtwoscreens(void) KB_FlushKeyboardQueue(); rotatesprite(0,0,65536L,0,3291,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); IFISSOFTMODE fadepal(0,0,0, 63,0,-7); else nextpage(); - while( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + while ( !KB_KeyWaiting() ) { handleevents(); getpackets(); } fadepal(0,0,0, 0,64,7); KB_FlushKeyboardQueue(); rotatesprite(0,0,65536L,0,3290,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); IFISSOFTMODE fadepal(0,0,0, 63,0,-7); else nextpage(); - while( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + while ( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + + } } /* @@ -2278,33 +2324,33 @@ extern long qsetmode; void gameexit(char *t) { - if(*t != 0) ps[myconnectindex].palette = (char *) &palette[0]; + if (*t != 0) ps[myconnectindex].palette = (char *) &palette[0]; - if(numplayers > 1) + if (numplayers > 1) { allowtimetocorrecterrorswhenquitting(); uninitmultiplayers(); } - if(ud.recstat == 1) closedemowrite(); -else if(ud.recstat == 2) { if (frecfilep) fclose(frecfilep); } // JBF: fixes crash on demo playback + if (ud.recstat == 1) closedemowrite(); +else if (ud.recstat == 2) { if (frecfilep) fclose(frecfilep); } // JBF: fixes crash on demo playback - if(!qe && !cp) + if (!qe && !cp) { - if(playerswhenstarted > 1 && ps[myconnectindex].gm&MODE_GAME && GTFLAGS(GAMETYPE_FLAG_SCORESHEET) && *t == ' ') + if (playerswhenstarted > 1 && ps[myconnectindex].gm&MODE_GAME && GTFLAGS(GAMETYPE_FLAG_SCORESHEET) && *t == ' ') { dobonus(1); setgamemode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP); } - if( *t != 0 && *(t+1) != 'V' && *(t+1) != 'Y') + if ( *t != 0 && *(t+1) != 'V' && *(t+1) != 'Y') showtwoscreens(); } if (qsetmode == 200) Shutdown(); - if(*t != 0) + if (*t != 0) { //setvmode(0x3); // JBF //binscreen(); @@ -2329,11 +2375,11 @@ short strget_(int small,short x,short y,char *t,short dalen,short c) short ch; int i; - while((ch = KB_Getch()) != 0) + while ((ch = KB_Getch()) != 0) { - if(ch == asc_BackSpace) + if (ch == asc_BackSpace) { - if( inputloc > 0 ) + if ( inputloc > 0 ) { inputloc--; *(t+inputloc) = 0; @@ -2341,13 +2387,13 @@ short strget_(int small,short x,short y,char *t,short dalen,short c) } else { - if(ch == asc_Enter) + if (ch == asc_Enter) { KB_ClearKeyDown(sc_Enter); KB_ClearKeyDown(sc_kpad_Enter); return (1); } - else if(ch == asc_Escape) + else if (ch == asc_Escape) { KB_ClearKeyDown(sc_Escape); return (-1); @@ -2364,27 +2410,27 @@ short strget_(int small,short x,short y,char *t,short dalen,short c) } } - if( c == 999 ) return(0); - if( c == 998 ) + if ( c == 999 ) return(0); + if ( c == 998 ) { char b[91],ii; - for(ii=0;ii>11); i = Bstrlen(t); - while(i > TEXTWRAPLEN-!small) + while (i > TEXTWRAPLEN-!small) { i -= TEXTWRAPLEN-!small; y += 8; @@ -2406,7 +2452,7 @@ inline short strgetsm(short x,short y,char *t,short dalen,short c) inline short mpstrget(short x,short y,char *t,short dalen,short c) { - if(xdim >= 640 && ydim >= 480) + if (xdim >= 640 && ydim >= 480) return(strgetsm(x,y,t,dalen,c)); else return(strget(x,y,t,dalen,c)); } @@ -2415,23 +2461,23 @@ void typemode(void) { short ch, hitstate, i, j, l; - if( ps[myconnectindex].gm&MODE_SENDTOWHOM ) + if ( ps[myconnectindex].gm&MODE_SENDTOWHOM ) { - if(sendmessagecommand != -1 || ud.multimode < 3 || movesperpacket == 4) + if (sendmessagecommand != -1 || ud.multimode < 3 || movesperpacket == 4) { tempbuf[0] = 4; tempbuf[2] = 0; recbuf[0] = 0; - if(ud.multimode < 3) + if (ud.multimode < 3) sendmessagecommand = 2; - if(typebuf[0] == '/' && Btoupper(typebuf[1]) == 'M' && Btoupper(typebuf[2]) == 'E') + if (typebuf[0] == '/' && Btoupper(typebuf[1]) == 'M' && Btoupper(typebuf[2]) == 'E') { Bstrcat(recbuf,"* "); i = 3, j = Bstrlen(typebuf); Bstrcpy(tempbuf,typebuf); - while(i < j) + while (i < j) { typebuf[i-3] = tempbuf[i]; i++; @@ -2451,10 +2497,10 @@ void typemode(void) recbuf[j] = 0; Bstrcat(tempbuf+2,recbuf); - if(sendmessagecommand >= ud.multimode || movesperpacket == 4) + if (sendmessagecommand >= ud.multimode || movesperpacket == 4) { tempbuf[1] = 255; - for(ch=connecthead;ch >= 0;ch=connectpoint2[ch]) + for (ch=connecthead;ch >= 0;ch=connectpoint2[ch]) { if (ch != myconnectindex) sendpacket(ch,tempbuf,j+2); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -2462,14 +2508,14 @@ void typemode(void) adduserquote(recbuf); quotebot += 8; l = Bstrlen(recbuf); - while(l > TEXTWRAPLEN) + while (l > TEXTWRAPLEN) { l -= TEXTWRAPLEN; quotebot += 8; } quotebotgoal = quotebot; } - else if(sendmessagecommand >= 0) + else if (sendmessagecommand >= 0) { tempbuf[1] = (char)sendmessagecommand; if ((!networkmode) && (myconnectindex != connecthead)) @@ -2480,11 +2526,11 @@ void typemode(void) sendmessagecommand = -1; ps[myconnectindex].gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); } - else if(sendmessagecommand == -1) + else if (sendmessagecommand == -1) { j = 50; gametext(320>>1,j,"SEND MESSAGE TO...",0,2+8+16); j += 8; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { if (i == myconnectindex) { @@ -2504,18 +2550,18 @@ void typemode(void) if (ud.screen_size > 0) j = 200-45; else j = 200-8; mpgametext(j,typebuf,0,2+8+16); - if( KB_KeyWaiting() ) + if ( KB_KeyWaiting() ) { i = KB_GetCh(); - if(i == 'A' || i == 'a' || i == 13) + if (i == 'A' || i == 'a' || i == 13) sendmessagecommand = ud.multimode; - else if(i >= '1' || i <= (ud.multimode + '1') ) + else if (i >= '1' || i <= (ud.multimode + '1') ) sendmessagecommand = i - '1'; else { sendmessagecommand = ud.multimode; - if(i == 27) + if (i == 27) { ps[myconnectindex].gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); sendmessagecommand = -1; @@ -2540,20 +2586,20 @@ void typemode(void) } else { - if(ud.screen_size > 0) j = 200-45; else j = 200-8; + if (ud.screen_size > 0) j = 200-45; else j = 200-8; hitstate = mpstrget(320>>1,j,typebuf,120,1); - if(hitstate == 1) + if (hitstate == 1) { KB_ClearKeyDown(sc_Enter); - if(ud.automsg) + if (ud.automsg) { - if(SHIFTS_IS_PRESSED) sendmessagecommand = -1; + if (SHIFTS_IS_PRESSED) sendmessagecommand = -1; else sendmessagecommand = ud.multimode; } ps[myconnectindex].gm |= MODE_SENDTOWHOM; } - else if(hitstate == -1) + else if (hitstate == -1) ps[myconnectindex].gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); else pub = NUMPAGES; } @@ -2561,13 +2607,13 @@ void typemode(void) void moveclouds(void) { - if( totalclock > cloudtotalclock || totalclock < (cloudtotalclock-7)) + if ( totalclock > cloudtotalclock || totalclock < (cloudtotalclock-7)) { short i; cloudtotalclock = totalclock+6; - for(i=0;i>9); cloudy[i] += (sintable[ps[screenpeek].ang&2047]>>9); @@ -2595,7 +2641,7 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) yvect2 = mulscale16(yvect,yxaspect); //Draw red lines - for(i=0;i>3]&(1<<(i&7)))) continue; @@ -2604,7 +2650,7 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) z1 = sector[i].ceilingz; z2 = sector[i].floorz; - for(j=startwall,wal=&wall[startwall];jnextwall; if (k < 0) continue; @@ -2637,10 +2683,10 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) //Draw sprites k = ps[screenpeek].i; - for(i=0;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]; @@ -2653,9 +2699,10 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) sprx = spr->x; spry = spr->y; - if( (spr->cstat&257) != 0) switch (spr->cstat&48) + if ( (spr->cstat&257) != 0) switch (spr->cstat&48) { - case 0: break; + case 0: + break; ox = sprx-cposx; oy = spry-cposy; x1 = dmulscale16(ox,xvect,-oy,yvect); @@ -2678,7 +2725,7 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) break; case 16: - if( spr->picnum == LASERLINE ) + if ( spr->picnum == LASERLINE ) { x1 = sprx; y1 = spry; tilenum = spr->picnum; @@ -2761,7 +2808,7 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) } //Draw white lines - for(i=0;i>3]&(1<<(i&7)))) continue; @@ -2769,7 +2816,7 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) endwall = sector[i].wallptr + sector[i].wallnum; k = -1; - for(j=startwall,wal=&wall[startwall];jnextwall >= 0) continue; @@ -2796,9 +2843,9 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) } } - for(p=connecthead;p >= 0;p=connectpoint2[p]) + for (p=connecthead;p >= 0;p=connectpoint2[p]) { - if(ud.scrollmode && p == screenpeek) continue; + if (ud.scrollmode && p == screenpeek) continue; ox = sprite[ps[p].i].x-cposx; oy = sprite[ps[p].i].y-cposy; daang = (sprite[ps[p].i].ang-cang)&2047; @@ -2806,9 +2853,9 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) x1 = mulscale(ox,xvect,16) - mulscale(oy,yvect,16); y1 = mulscale(oy,xvect2,16) + mulscale(ox,yvect2,16); - if(p == screenpeek || GTFLAGS(GAMETYPE_FLAG_OTHERPLAYERSINMAP) ) + if (p == screenpeek || GTFLAGS(GAMETYPE_FLAG_OTHERPLAYERSINMAP) ) { - if(sprite[ps[p].i].xvel > 16 && ps[p].on_ground) + if (sprite[ps[p].i].xvel > 16 && ps[p].on_ground) i = APLAYERTOP+((totalclock>>4)&3); else i = APLAYERTOP; @@ -2816,8 +2863,8 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) j = klabs(ps[p].truefz-ps[p].posz)>>8; j = mulscale(czoom*(sprite[ps[p].i].yrepeat+j),yxaspect,16); - if(j < 22000) j = 22000; - else if(j > (65536<<1)) j = (65536<<1); + if (j < 22000) j = 22000; + else if (j > (65536<<1)) j = (65536<<1); rotatesprite((x1<<4)+(xdim<<15),(y1<<4)+(ydim<<15),j, daang,i,sprite[ps[p].i].shade,/*sprite[ps[p].i].pal*/sector[ps[p].cursectnum].floorpal, @@ -2868,7 +2915,7 @@ void displayrest(long smoothratio) } // this does pain tinting etc from the CON - if( pp->pals_time >= 0 && pp->loogcnt == 0) // JBF 20040101: pals_time > 0 now >= 0 + if ( pp->pals_time >= 0 && pp->loogcnt == 0) // JBF 20040101: pals_time > 0 now >= 0 { fader = pp->pals[0]; fadeg = pp->pals[1]; @@ -2878,14 +2925,14 @@ void displayrest(long smoothratio) dotint = 1; } // reset a normal palette - else if( restorepalette ) + else if ( restorepalette ) { //setbrightness(ud.brightness>>2,&pp->palette[0],0); setgamepalette(pp,pp->palette,0); restorepalette = 0; } // loogies courtesy of being snotted on - else if(pp->loogcnt > 0) { + else if (pp->loogcnt > 0) { //palto(0,64,0,(pp->loogcnt>>1)+128); fader = 0; fadeg = 64; @@ -2900,9 +2947,9 @@ void displayrest(long smoothratio) tintf = fadef; } - if(ud.show_help) + if (ud.show_help) { - switch(ud.show_help) + switch (ud.show_help) { case 1: rotatesprite(0,0,65536L,0,TEXTSTORY,0,0,10+16+64, 0,0,xdim-1,ydim-1); @@ -2916,7 +2963,7 @@ void displayrest(long smoothratio) { KB_ClearKeyDown(sc_Escape); ud.show_help = 0; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -2931,7 +2978,7 @@ void displayrest(long 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; @@ -2942,28 +2989,28 @@ void displayrest(long smoothratio) show2dsector[i>>3] |= (1<<(i&7)); } - if(ud.camerasprite == -1) + if (ud.camerasprite == -1) { - if( ud.overhead_on != 2 ) + if ( ud.overhead_on != 2 ) { - if(pp->newowner >= 0) + if (pp->newowner >= 0) cameratext(pp->newowner); else { displayweapon(screenpeek); - if(pp->over_shoulder_on == 0 ) + if (pp->over_shoulder_on == 0 ) displaymasks(screenpeek); } moveclouds(); } - if( ud.overhead_on > 0 ) + if ( ud.overhead_on > 0 ) { smoothratio = min(max(smoothratio,0),65536); dointerpolations(smoothratio); - if( ud.scrollmode == 0 ) + if ( ud.scrollmode == 0 ) { - if(pp->newowner == -1 && !ud.pause_on) + if (pp->newowner == -1 && !ud.pause_on) { if (screenpeek == myconnectindex && numplayers > 1) { @@ -2987,7 +3034,7 @@ void displayrest(long smoothratio) } else { - if(!ud.pause_on) + if (!ud.pause_on) { ud.fola += ud.folavel>>3; ud.folx += (ud.folfvel*sintable[(512+2048-ud.fola)&2047])>>14; @@ -2998,7 +3045,7 @@ void displayrest(long smoothratio) cang = ud.fola; } - if(ud.overhead_on == 2) + if (ud.overhead_on == 2) { clearview(0L); drawmapview(cposx,cposy,pp->zoom,cang); @@ -3007,9 +3054,9 @@ void displayrest(long smoothratio) restoreinterpolations(); - if(ud.overhead_on == 2) + if (ud.overhead_on == 2) { - if(ud.screen_size > 0) a = 147; + if (ud.screen_size > 0) a = 147; else a = 182; minitext(1,a+6,volume_names[ud.volume_number],0,2+8+16); @@ -3021,15 +3068,15 @@ void displayrest(long smoothratio) coolgaugetext(screenpeek); operatefta(); - if( KB_KeyPressed(sc_Escape) && ud.overhead_on == 0 + if ( KB_KeyPressed(sc_Escape) && ud.overhead_on == 0 && ud.show_help == 0 && ps[myconnectindex].newowner == -1) { - if( (ps[myconnectindex].gm&MODE_MENU) == MODE_MENU && current_menu < 51) + if ( (ps[myconnectindex].gm&MODE_MENU) == MODE_MENU && current_menu < 51) { KB_ClearKeyDown(sc_Escape); ps[myconnectindex].gm &= ~MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -3039,9 +3086,9 @@ void displayrest(long smoothratio) walock[TILE_SAVESHOT] = 199; vscrn(); } - else if( (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU && - ps[myconnectindex].newowner == -1 && - (ps[myconnectindex].gm&MODE_TYPE) != MODE_TYPE) + else if ( (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU && + ps[myconnectindex].newowner == -1 && + (ps[myconnectindex].gm&MODE_TYPE) != MODE_TYPE) { KB_ClearKeyDown(sc_Escape); FX_StopAllSounds(); @@ -3051,9 +3098,9 @@ void displayrest(long smoothratio) ps[myconnectindex].gm |= MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) ready2send = 0; + if (ud.multimode < 2 && ud.recstat != 2) ready2send = 0; - if(ps[myconnectindex].gm&MODE_GAME) cmenu(50); + if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); else cmenu(0); screenpeek = myconnectindex; } @@ -3061,19 +3108,19 @@ void displayrest(long smoothratio) OnEvent(EVENT_DISPLAYREST, ps[screenpeek].i, screenpeek, -1); - if(ps[myconnectindex].newowner == -1 && ud.overhead_on == 0 && ud.crosshair && ud.camerasprite == -1) + if (ps[myconnectindex].newowner == -1 && ud.overhead_on == 0 && ud.crosshair && ud.camerasprite == -1) { SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DISPLAYCROSSHAIR, ps[screenpeek].i, screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) rotatesprite((160L-(ps[myconnectindex].look_ang>>1))<<16,100L<<16,ud.crosshair>1?65536L>>(ud.crosshair-1):65536L,0,CROSSHAIR,0,0,2+1,windowx1,windowy1,windowx2,windowy2); } #if 0 - if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) + if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) { - for(i=0;i>1,-160),160); rotatesprite((160-j)<<16,100L<<16,65536L,0,DUKEICON,0,0,2+1,windowx1,windowy1,windowx2,windowy2); @@ -3081,21 +3128,21 @@ void displayrest(long smoothratio) } } #endif - if(ps[myconnectindex].gm&MODE_TYPE) + if (ps[myconnectindex].gm&MODE_TYPE) typemode(); else menus(); - if( ud.pause_on==1 && (ps[myconnectindex].gm&MODE_MENU) == 0 ) + if ( ud.pause_on==1 && (ps[myconnectindex].gm&MODE_MENU) == 0 ) menutext(160,100,0,0,"GAME PAUSED"); - if(ud.coords) + if (ud.coords) coords(screenpeek); tics(); // JBF 20040124: display level stats in screen corner - if(ud.levelstats && (ps[myconnectindex].gm&MODE_MENU) == 0) { + if (ud.levelstats && (ps[myconnectindex].gm&MODE_MENU) == 0) { i = (ud.screen_size <= 4)?0:scale(tilesizy[BOTTOMSTATUSBAR],ud.statusbarscale,100); Bsprintf(tempbuf,"Time: %ld:%02ld", @@ -3103,7 +3150,7 @@ void displayrest(long smoothratio) (ps[myconnectindex].player_par/26)%60); minitext(320-5*12,200-i-6-6-6,tempbuf,0,26); - if(ud.player_skill > 3 || (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY))) + if (ud.player_skill > 3 || (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY))) Bsprintf(tempbuf,"Kills: %ld",(ud.multimode>1 &&!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY))?ps[i].frag-ps[i].fraggedself:ps[myconnectindex].actors_killed); else Bsprintf(tempbuf,"Kills: %ld/%ld",ps[myconnectindex].actors_killed, @@ -3135,7 +3182,7 @@ void view(struct player_struct *pp, long *vx, long *vy,long *vz,short *vsectnum, updatesectorz(*vx,*vy,*vz,vsectnum); hitscan(*vx,*vy,*vz,*vsectnum,nx,ny,nz,&hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1); - if(*vsectnum < 0) + if (*vsectnum < 0) { sp->cstat = bakcstat; return; @@ -3183,11 +3230,14 @@ void drawbackground(void) flushperms(); - switch(ud.m_volume_number) + switch (ud.m_volume_number) { - default:dapicnum = BIGHOLE;break; - case 1:dapicnum = BIGHOLE;break; - case 2:dapicnum = BIGHOLE;break; + default: + dapicnum = BIGHOLE;break; + case 1: + dapicnum = BIGHOLE;break; + case 2: + dapicnum = BIGHOLE;break; } if (tilesizx[dapicnum] == 0 || tilesizy[dapicnum] == 0) { @@ -3196,25 +3246,25 @@ void drawbackground(void) } y1 = 0; y2 = ydim; - if( (ready2send && ps[myconnectindex].gm == MODE_GAME) || ud.recstat == 2 ) + if ( (ready2send && ps[myconnectindex].gm == MODE_GAME) || ud.recstat == 2 ) //if (ud.recstat == 0 || ud.recstat == 1 || (ud.recstat == 2 && ud.reccnt > 0)) // JBF 20040717 { if (ud.screen_size == 8) y1 = scale(ydim,200-scale(tilesizy[BOTTOMSTATUSBAR],ud.statusbarscale,100),200); - else if(gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR) + else if (gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR) { if (ud.multimode > 1) y1 += scale(ydim,8,200); if (ud.multimode > 4) y1 += scale(ydim,8,200); } } else { // when not rendering a game, fullscreen wipe - #define MENUTILE bpp==8?MENUSCREEN:LOADSCREEN +#define MENUTILE bpp==8?MENUSCREEN:LOADSCREEN SetGameVarID(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1); OnEvent(EVENT_GETMENUTILE, -1, myconnectindex, -1); if (GetGameVar("MENU_TILE", tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?0:1, -1, -1)) { - for(y=y1;y> 1; x1 = xdim-x2; x1 -= x1%tilesizx[dapicnum]; - for(y=y1-y1%tilesizy[dapicnum]; y 8 && ( ready2send || ud.recstat == 2 )) + if (ud.screen_size > 8 && ( ready2send || ud.recstat == 2 )) { y = 0; - if(gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR) + if (gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR) { if (ud.multimode > 1) y += 8; if (ud.multimode > 4) y += 8; @@ -3269,13 +3319,13 @@ void 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 ) + if ( sprite[j].picnum==1 && sprite[j].lotag==fofmode && sprite[j].hitag==sprite[floor1].hitag ) { floor1=j; fofmode=sprite[j].lotag; @@ -3357,11 +3407,11 @@ static void SE40_Draw(int spnum,long x,long y,long z,short a,short h,long smooth } // if(ok==1) { Message("no floor1",RED); return; } - if(fofmode==40) k=41; else k=40; + 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 ) + if ( sprite[j].picnum==1 && sprite[j].lotag==k && sprite[j].hitag==sprite[floor1].hitag ) { floor2=j; ok++; break; } @@ -3389,11 +3439,11 @@ static void SE40_Draw(int spnum,long x,long y,long z,short a,short h,long smooth // 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 ) + if (sprite[j].picnum==1 && sprite[j].lotag==k+2 && sprite[j].hitag==sprite[floor1].hitag ) { - if(k==40) + if (k==40) { tempsectorz[sprite[j].sectnum]=sector[sprite[j].sectnum].floorz; sector[sprite[j].sectnum].floorz+=(((z-sector[sprite[j].sectnum].floorz)/32768)+1)*32768; @@ -3417,13 +3467,13 @@ static void SE40_Draw(int spnum,long x,long y,long z,short a,short h,long smooth 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 && + if (sprite[j].picnum==1 && sprite[j].lotag==k+2 && sprite[j].hitag==sprite[floor1].hitag) { - if(k==40) + if (k==40) { sector[sprite[j].sectnum].floorz=tempsectorz[sprite[j].sectnum]; sector[sprite[j].sectnum].floorpicnum=tempsectorpicnum[sprite[j].sectnum]; @@ -3448,10 +3498,10 @@ static void se40code(long x,long y,long z,long a,long h, long smoothratio) int i; i = headspritestat[15]; - while(i >= 0) + while (i >= 0) { int t = sprite[i].lotag; - switch(t) + switch (t) { // case 40: // case 41: @@ -3461,7 +3511,7 @@ static void se40code(long x,long y,long z,long a,long h, long smoothratio) case 43: case 44: case 45: - if(ps[screenpeek].cursectnum == sprite[i].sectnum) + if (ps[screenpeek].cursectnum == sprite[i].sectnum) SE40_Draw(i,x,y,z,a,h,smoothratio); break; } @@ -3486,16 +3536,16 @@ void displayrooms(short snum,long smoothratio) p = &ps[snum]; - if(pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always + if (pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always { - if(ud.screen_size > 8 || (ud.screen_size == 8 && ud.statusbarscale<100)) drawbackground(); + if (ud.screen_size > 8 || (ud.screen_size == 8 && ud.statusbarscale<100)) drawbackground(); pub = 0; } #ifdef POLYMOST - if( ud.overhead_on == 2 || ud.show_help || (p->cursectnum == -1 && rendmode != 4)) + if ( ud.overhead_on == 2 || ud.show_help || (p->cursectnum == -1 && rendmode != 4)) #else - if( ud.overhead_on == 2 || ud.show_help || p->cursectnum == -1) + if ( ud.overhead_on == 2 || ud.show_help || p->cursectnum == -1) #endif return; @@ -3503,27 +3553,27 @@ void displayrooms(short snum,long smoothratio) visibility = p->visibility; - if(ud.pause_on || ps[snum].on_crane > -1) smoothratio = 65536; + if (ud.pause_on || ps[snum].on_crane > -1) smoothratio = 65536; sect = p->cursectnum; #ifdef POLYMOST - if(rendmode != 4) + if (rendmode != 4) #endif - if(sect < 0 || sect >= MAXSECTORS) return; + if (sect < 0 || sect >= MAXSECTORS) return; dointerpolations(smoothratio); animatecamsprite(); - if(ud.camerasprite >= 0) + if (ud.camerasprite >= 0) { spritetype *s; s = &sprite[ud.camerasprite]; - if(s->yvel < 0) s->yvel = -100; - else if(s->yvel > 199) s->yvel = 300; + if (s->yvel < 0) s->yvel = -100; + else if (s->yvel > 199) s->yvel = 300; cang = hittype[ud.camerasprite].tempang+mulscale16((long)(((s->ang+1024-hittype[ud.camerasprite].tempang)&2047)-1024),smoothratio); #ifdef SE40 @@ -3542,14 +3592,14 @@ void displayrooms(short snum,long smoothratio) setaspect(oyrepeat,yxaspect); } - if(screencapt) + if (screencapt) { walock[TILE_SAVESHOT] = 199; if (waloff[TILE_SAVESHOT] == 0) allocache((long *)&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]); setviewtotile(TILE_SAVESHOT,200L,320L); } - else if( getrendermode() == 0 && ( ( ud.screen_tilting && p->rotscrnang ) || ud.detail==0 ) ) + else if ( getrendermode() == 0 && ( ( ud.screen_tilting && p->rotscrnang ) || ud.detail==0 ) ) { if (ud.screen_tilting) tang = p->rotscrnang; else tang = 0; @@ -3573,7 +3623,7 @@ void displayrooms(short snum,long smoothratio) if ((tang&1023) == 512) { //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; startdmost[i] = 0; startdmost[i+j] = 0; @@ -3618,27 +3668,27 @@ void displayrooms(short snum,long smoothratio) smoothratio = 65536L; } - else if( p->over_shoulder_on == 0 ) + else if ( p->over_shoulder_on == 0 ) cposz += p->opyoff+mulscale16((long)(p->pyoff-p->opyoff),smoothratio); else view(p,&cposx,&cposy,&cposz,§,cang,choriz); cz = hittype[p->i].ceilingz; fz = hittype[p->i].floorz; - if(earthquaketime > 0 && p->on_ground == 1) + if (earthquaketime > 0 && p->on_ground == 1) { cposz += 256-(((earthquaketime)&1)<<9); cang += (2-((earthquaketime)&2))<<2; } - if(sprite[p->i].pal == 1) cposz -= (18<<8); + if (sprite[p->i].pal == 1) cposz -= (18<<8); - if(p->newowner >= 0) + if (p->newowner >= 0) choriz = 100+sprite[p->newowner].shade; - else if(p->spritebridge == 0) + else if (p->spritebridge == 0) { - if( cposz < ( p->truecz + (4<<8) ) ) cposz = cz + (4<<8); - else if( cposz > ( p->truefz - (4<<8) ) ) cposz = fz - (4<<8); + if ( cposz < ( p->truecz + (4<<8) ) ) cposz = cz + (4<<8); + else if ( cposz > ( p->truefz - (4<<8) ) ) cposz = fz - (4<<8); } if (sect >= 0) @@ -3648,22 +3698,22 @@ void displayrooms(short snum,long smoothratio) if (cposz > fz-(4<<8)) cposz = fz-(4<<8); } - if(choriz > 299) choriz = 299; - else if(choriz < -99) choriz = -99; + if (choriz > 299) choriz = 299; + else if (choriz < -99) choriz = -99; #ifdef SE40 se40code(cposx,cposy,cposz,cang,choriz,smoothratio); #endif if ((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0) { dst = 0x7fffffff; i = 0; - for(k=0;krotscrnang) || ud.detail==0 ) ) + else if ( getrendermode() == 0 && ( ( ud.screen_tilting && p->rotscrnang) || ud.detail==0 ) ) { if (ud.screen_tilting) tang = p->rotscrnang; else tang = 0; @@ -3725,9 +3775,9 @@ short LocateTheLocator(short n,short sn) short i; i = headspritestat[7]; - while(i >= 0) + while (i >= 0) { - if( (sn == -1 || sn == SECT) && n == SLT ) + if ( (sn == -1 || sn == SECT) && n == SLT ) return i; i = nextspritestat[i]; } @@ -3742,7 +3792,7 @@ short EGS(short whatsect,long s_x,long s_y,long s_z,short s_pn,signed char s_s,s i = insertsprite(whatsect,s_ss); - if( i < 0 ) + if ( i < 0 ) gameexit(" Too many sprites spawned."); hittype[i].bposx = s_x; @@ -3792,7 +3842,7 @@ short EGS(short whatsect,long s_x,long s_y,long s_z,short s_pn,signed char s_s,s actorspriteflags[i] = 0; - if( actorscrptr[s_pn] ) + if ( actorscrptr[s_pn] ) { s->extra = *actorscrptr[s_pn]; T5 = *(actorscrptr[s_pn]+1); @@ -3833,7 +3883,7 @@ char wallswitchcheck(short i) if ((PN == ACCESSSWITCH) || (PN == ACCESSSWITCH2)) return 1; //loop to catch both states of switches for (j=0;j<=1;j++) { - switch(dynamictostatic[PN-j]) + switch (dynamictostatic[PN-j]) { case HANDPRINTSWITCH__STATIC: //case HANDPRINTSWITCH+1: @@ -3887,7 +3937,7 @@ short spawn( short j, short pn ) long x, y, d, p; spritetype *sp; - if(j >= 0) + if (j >= 0) { i = EGS(sprite[j].sectnum,sprite[j].x,sprite[j].y,sprite[j].z ,pn,0,0,0,0,0,0,j,0); @@ -3920,15 +3970,15 @@ short spawn( short j, short pn ) actorspriteflags[i] = 0; - if( PN != SPEAKER && PN != LETTER && PN != DUCK && PN != TARGET && PN != TRIPBOMB && PN != VIEWSCREEN && PN != VIEWSCREEN2 && (CS&48) ) - if( !(PN >= CRACK1 && PN <= CRACK4) ) + if ( PN != SPEAKER && PN != LETTER && PN != DUCK && PN != TARGET && PN != TRIPBOMB && PN != VIEWSCREEN && PN != VIEWSCREEN2 && (CS&48) ) + if ( !(PN >= CRACK1 && PN <= CRACK4) ) { - if(SS == 127) return i; - if( wallswitchcheck(i) == 1 && (CS&16) ) + if (SS == 127) return i; + if ( wallswitchcheck(i) == 1 && (CS&16) ) { - if( PN != ACCESSSWITCH && PN != ACCESSSWITCH2 && sprite[i].pal) + if ( PN != ACCESSSWITCH && PN != ACCESSSWITCH2 && sprite[i].pal) { - if( (ud.multimode < 2) || (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_DMSWITCHES)) ) + if ( (ud.multimode < 2) || (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_DMSWITCHES)) ) { sprite[i].xrepeat = sprite[i].yrepeat = 0; sprite[i].cstat = SLT = SHT = 0; @@ -3936,12 +3986,12 @@ short spawn( short j, short pn ) } } CS |= 257; - if( sprite[i].pal && PN != ACCESSSWITCH && PN != ACCESSSWITCH2) + if ( sprite[i].pal && PN != ACCESSSWITCH && PN != ACCESSSWITCH2) sprite[i].pal = 0; return i; } - if( SHT ) + if ( SHT ) { changespritestat(i,12); CS |= 257; @@ -3952,14 +4002,14 @@ short spawn( short j, short pn ) s = PN; - if( CS&1 ) CS |= 256; + if ( CS&1 ) CS |= 256; - if( actorscrptr[s] ) + if ( actorscrptr[s] ) { SH = *(actorscrptr[s]); T5 = *(actorscrptr[s]+1); T2 = *(actorscrptr[s]+2); - if( *(actorscrptr[s]+3) && SHT == 0 ) + if ( *(actorscrptr[s]+3) && SHT == 0 ) SHT = *(actorscrptr[s]+3); } else T2 = T5 = 0; @@ -3981,10 +4031,10 @@ short spawn( short j, short pn ) if (sp->picnum != GENERICPOLE) { sp->extra = 1; - if(camerashitable) sp->cstat = 257; + if (camerashitable) sp->cstat = 257; else sp->cstat = 0; } - if( ud.multimode < 2 && sp->pal != 0 ) + if ( ud.multimode < 2 && sp->pal != 0 ) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); @@ -3998,12 +4048,12 @@ short spawn( short j, short pn ) } } } - else switch(dynamictostatic[sp->picnum]) + else switch (dynamictostatic[sp->picnum]) { default: - if( actorscrptr[sp->picnum] ) + if ( actorscrptr[sp->picnum] ) { - if( j == -1 && sp->lotag > ud.player_skill ) + if ( j == -1 && sp->lotag > ud.player_skill ) { sp->xrepeat=sp->yrepeat=0; changespritestat(i,5); @@ -4011,12 +4061,12 @@ short spawn( short j, short pn ) } // Init the size - if(sp->xrepeat == 0 || sp->yrepeat == 0) + if (sp->xrepeat == 0 || sp->yrepeat == 0) sp->xrepeat = sp->yrepeat = 1; - if( actortype[sp->picnum] & 3) + if ( actortype[sp->picnum] & 3) { - if( ud.monsters_off == 1 ) + if ( ud.monsters_off == 1 ) { sp->xrepeat=sp->yrepeat=0; changespritestat(i,5); @@ -4025,14 +4075,14 @@ short spawn( short j, short pn ) makeitfall(i); - if( actortype[sp->picnum] & 2) + if ( actortype[sp->picnum] & 2) hittype[i].actorstayput = sp->sectnum; ps[myconnectindex].max_actors_killed++; sp->clipdist = 80; - if(j >= 0) + if (j >= 0) { - if(sprite[j].picnum == RESPAWN) + if (sprite[j].picnum == RESPAWN) hittype[i].tempang = sprite[i].pal = sprite[j].pal; changespritestat(i,1); } @@ -4047,7 +4097,7 @@ short spawn( short j, short pn ) hittype[i].timetosleep = 0; - if(j >= 0) + if (j >= 0) sp->ang = sprite[j].ang; } break; @@ -4056,7 +4106,7 @@ short spawn( short j, short pn ) changespritestat(i,5); break; case WATERSPLASH2__STATIC: - if(j >= 0) + if (j >= 0) { setsprite(i,sprite[j].x,sprite[j].y,sprite[j].z); sp->xrepeat = sp->yrepeat = 8+(TRAND&7); @@ -4065,18 +4115,18 @@ short spawn( short j, short pn ) sp->shade = -16; sp->cstat |= 128; - if(j >= 0) + if (j >= 0) { - if(sector[sprite[j].sectnum].lotag == 2) + if (sector[sprite[j].sectnum].lotag == 2) { sp->z = getceilzofslope(SECT,SX,SY)+(16<<8); sp->cstat |= 8; } - else if( sector[sprite[j].sectnum].lotag == 1) + else if ( sector[sprite[j].sectnum].lotag == 1) sp->z = getflorzofslope(SECT,SX,SY); } - if(sector[sect].floorpicnum == FLOORSLIME || + if (sector[sect].floorpicnum == FLOORSLIME || sector[sect].ceilingpicnum == FLOORSLIME) sp->pal = 7; case NEON1__STATIC: @@ -4086,10 +4136,10 @@ short spawn( short j, short pn ) case NEON5__STATIC: case NEON6__STATIC: case DOMELITE__STATIC: - if(sp->picnum != WATERSPLASH2) + if (sp->picnum != WATERSPLASH2) sp->cstat |= 257; case NUKEBUTTON__STATIC: - if(sp->picnum == DOMELITE) + if (sp->picnum == DOMELITE) sp->cstat |= 257; case JIBS1__STATIC: case JIBS2__STATIC: @@ -4109,7 +4159,7 @@ short spawn( short j, short pn ) changespritestat(i,5); break; case TONGUE__STATIC: - if(j >= 0) + if (j >= 0) sp->ang = sprite[j].ang; sp->z -= 38<<8; sp->zvel = 256-(TRAND&511); @@ -4122,8 +4172,8 @@ short spawn( short j, short pn ) break; case TRANSPORTERSTAR__STATIC: case TRANSPORTERBEAM__STATIC: - if(j == -1) break; - if(sp->picnum == TRANSPORTERBEAM) + if (j == -1) break; + if (sp->picnum == TRANSPORTERBEAM) { sp->xrepeat = 31; sp->yrepeat = 1; @@ -4131,7 +4181,7 @@ short spawn( short j, short pn ) } else { - if(sprite[j].statnum == 4) + if (sprite[j].statnum == 4) { sp->xrepeat = 8; sp->yrepeat = 8; @@ -4140,7 +4190,7 @@ short spawn( short j, short pn ) { sp->xrepeat = 48; sp->yrepeat = 64; - if(sprite[j].statnum == 10 || badguy(&sprite[j]) ) + if (sprite[j].statnum == 10 || badguy(&sprite[j]) ) sp->z -= (32<<8); } } @@ -4158,7 +4208,7 @@ short spawn( short j, short pn ) case FRAMEEFFECT1_13__STATIC: if (PLUTOPAK) break; case FRAMEEFFECT1__STATIC: - if(j >= 0) + if (j >= 0) { sp->xrepeat = sprite[j].xrepeat; sp->yrepeat = sprite[j].yrepeat; @@ -4174,9 +4224,9 @@ short spawn( short j, short pn ) sp->yrepeat = 6; sp->xrepeat = 32; - if(lasermode == 1) + if (lasermode == 1) sp->cstat = 16 + 2; - else if(lasermode == 0 || lasermode == 2) + else if (lasermode == 0 || lasermode == 2) sp->cstat = 16; else { @@ -4184,12 +4234,12 @@ short spawn( short j, short pn ) sp->yrepeat = 0; } - if(j >= 0) sp->ang = hittype[j].temp_data[5]+512; + if (j >= 0) sp->ang = hittype[j].temp_data[5]+512; changespritestat(i,5); break; case FORCESPHERE__STATIC: - if(j == -1 ) + if (j == -1 ) { sp->cstat = (short) 32768; changespritestat(i,2); @@ -4204,60 +4254,68 @@ short spawn( short j, short pn ) case BLOOD__STATIC: sp->xrepeat = sp->yrepeat = 16; sp->z -= (26<<8); - if( j >= 0 && sprite[j].pal == 6 ) + if ( j >= 0 && sprite[j].pal == 6 ) sp->pal = 6; changespritestat(i,5); break; case BLOODPOOL__STATIC: case PUKE__STATIC: - { - short s1; - s1 = sp->sectnum; + { + short s1; + s1 = sp->sectnum; - updatesector(sp->x+108,sp->y+108,&s1); - if(s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) + updatesector(sp->x+108,sp->y+108,&s1); + if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) + { + updatesector(sp->x-108,sp->y-108,&s1); + if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) { - updatesector(sp->x-108,sp->y-108,&s1); - if(s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) + updatesector(sp->x+108,sp->y-108,&s1); + if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) { - updatesector(sp->x+108,sp->y-108,&s1); - if(s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) - { - updatesector(sp->x-108,sp->y+108,&s1); - if(s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz) - { sp->xrepeat = sp->yrepeat = 0;changespritestat(i,5);break;} - } - else { sp->xrepeat = sp->yrepeat = 0;changespritestat(i,5);break;} + updatesector(sp->x-108,sp->y+108,&s1); + if (s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz) + { sp->xrepeat = sp->yrepeat = 0;changespritestat(i,5);break;} + + } else { sp->xrepeat = sp->yrepeat = 0;changespritestat(i,5);break;} + + } else { sp->xrepeat = sp->yrepeat = 0;changespritestat(i,5);break;} - } - if( sector[SECT].lotag == 1 ) + + } + else { sp->xrepeat = sp->yrepeat = 0;changespritestat(i,5);break;} + + + } + + if ( sector[SECT].lotag == 1 ) + { + changespritestat(i,5); + break; + } + + if (j >= 0 && sp->picnum != PUKE) + { + if ( sprite[j].pal == 1) + sp->pal = 1; + else if ( sprite[j].pal != 6 && sprite[j].picnum != NUKEBARREL && sprite[j].picnum != TIRE ) { - changespritestat(i,5); - break; + if (sprite[j].picnum == FECES) + sp->pal = 7; // Brown + else sp->pal = 2; // Red } + else sp->pal = 0; // green - if(j >= 0 && sp->picnum != PUKE) - { - if( sprite[j].pal == 1) - sp->pal = 1; - else if( sprite[j].pal != 6 && sprite[j].picnum != NUKEBARREL && sprite[j].picnum != TIRE ) - { - if(sprite[j].picnum == FECES) - sp->pal = 7; // Brown - else sp->pal = 2; // Red - } - else sp->pal = 0; // green - - if(sprite[j].picnum == TIRE) - sp->shade = 127; - } - sp->cstat |= 32; + if (sprite[j].picnum == TIRE) + sp->shade = 127; + } + sp->cstat |= 32; case FECES__STATIC: - if( j >= 0) + if ( j >= 0) sp->xrepeat = sp->yrepeat = 1; changespritestat(i,5); break; @@ -4270,14 +4328,14 @@ short spawn( short j, short pn ) sp->xrepeat = 7+(TRAND&7); sp->yrepeat = 7+(TRAND&7); sp->z -= (16<<8); - if(j >= 0 && sprite[j].pal == 6) + if (j >= 0 && sprite[j].pal == 6) sp->pal = 6; insertspriteq(i); changespritestat(i,5); break; case TRIPBOMB__STATIC: - if( sp->lotag > ud.player_skill ) + if ( sp->lotag > ud.player_skill ) { sp->xrepeat=sp->yrepeat=0; changespritestat(i,5); @@ -4297,7 +4355,7 @@ short spawn( short j, short pn ) hittype[i].temp_data[5] = sp->ang; case SPACEMARINE__STATIC: - if(sp->picnum == SPACEMARINE) + if (sp->picnum == SPACEMARINE) { sp->extra = 20; sp->cstat |= 257; @@ -4383,7 +4441,7 @@ short spawn( short j, short pn ) case DUKETAG__STATIC: case SIGN1__STATIC: case SIGN2__STATIC: - if(ud.multimode < 2 && sp->pal) + if (ud.multimode < 2 && sp->pal) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); @@ -4413,27 +4471,33 @@ short spawn( short j, short pn ) case FOOTPRINTS2__STATIC: case FOOTPRINTS3__STATIC: case FOOTPRINTS4__STATIC: - if(j >= 0) + if (j >= 0) { short s1; s1 = sp->sectnum; updatesector(sp->x+84,sp->y+84,&s1); - if(s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) + if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) { updatesector(sp->x-84,sp->y-84,&s1); - if(s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) + if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) { updatesector(sp->x+84,sp->y-84,&s1); - if(s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) + if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) { updatesector(sp->x-84,sp->y+84,&s1); - if(s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz) + if (s1 >= 0 && sector[s1].floorz != sector[sp->sectnum].floorz) { sp->xrepeat = sp->yrepeat = 0;changespritestat(i,5);break;} + + } else { sp->xrepeat = sp->yrepeat = 0;break;} + + } else { sp->xrepeat = sp->yrepeat = 0;break;} + + } else { sp->xrepeat = sp->yrepeat = 0;break;} @@ -4442,7 +4506,7 @@ short spawn( short j, short pn ) } sp->z = sector[sect].floorz; - if(sector[sect].lotag != 1 && sector[sect].lotag != 2) + if (sector[sect].lotag != 1 && sector[sect].lotag != 2) sp->xrepeat = sp->yrepeat = 32; insertspriteq(i); @@ -4465,13 +4529,13 @@ short spawn( short j, short pn ) case TOUGHGAL__STATIC: sp->yvel = sp->hitag; sp->hitag = -1; - if(sp->picnum == PODFEM1) sp->extra <<= 1; + if (sp->picnum == PODFEM1) sp->extra <<= 1; case BLOODYPOLE__STATIC: case QUEBALL__STATIC: case STRIPEBALL__STATIC: - if(sp->picnum == QUEBALL || sp->picnum == STRIPEBALL) + if (sp->picnum == QUEBALL || sp->picnum == STRIPEBALL) { sp->cstat = 256; sp->clipdist = 8; @@ -4486,7 +4550,7 @@ short spawn( short j, short pn ) break; case DUKELYINGDEAD__STATIC: - if(j >= 0 && sprite[j].picnum == APLAYER) + if (j >= 0 && sprite[j].picnum == APLAYER) { sp->xrepeat = sprite[j].xrepeat; sp->yrepeat = sprite[j].yrepeat; @@ -4503,10 +4567,10 @@ short spawn( short j, short pn ) case RESPAWNMARKERRED__STATIC: case BLIMP__STATIC: - if(sp->picnum == RESPAWNMARKERRED) + if (sp->picnum == RESPAWNMARKERRED) { sp->xrepeat = sp->yrepeat = 24; - if(j >= 0) sp->z = hittype[j].floorz; // -(1<<4); + if (j >= 0) sp->z = hittype[j].floorz; // -(1<<4); } else { @@ -4514,7 +4578,7 @@ short spawn( short j, short pn ) sp->clipdist = 128; } case MIKE__STATIC: - if(sp->picnum == MIKE) + if (sp->picnum == MIKE) { sp->yvel = sp->hitag; sp->hitag = 0; @@ -4534,7 +4598,7 @@ short spawn( short j, short pn ) case MONEY__STATIC: case MAIL__STATIC: case PAPER__STATIC: - if( sp->picnum == MONEY || sp->picnum == MAIL || sp->picnum == PAPER ) + if ( sp->picnum == MONEY || sp->picnum == MAIL || sp->picnum == PAPER ) { hittype[i].temp_data[0] = TRAND&2047; sp->cstat = TRAND&12; @@ -4554,17 +4618,17 @@ short spawn( short j, short pn ) case SHELL__STATIC: //From the player case SHOTGUNSHELL__STATIC: - if( j >= 0 ) + if ( j >= 0 ) { short snum,a; - if(sprite[j].picnum == APLAYER) + if (sprite[j].picnum == APLAYER) { snum = sprite[j].yvel; a = ps[snum].ang-(TRAND&63)+8; //Fine tune T1 = TRAND&1; - if(sp->picnum == SHOTGUNSHELL) + if (sp->picnum == SHOTGUNSHELL) sp->z = (6<<8)+ps[snum].pyoff+ps[snum].posz-((ps[snum].horizoff+ps[snum].horiz-100)<<4); else sp->z = (3<<8)+ps[snum].pyoff+ps[snum].posz-((ps[snum].horizoff+ps[snum].horiz-100)<<4); sp->zvel = -(TRAND&255); @@ -4599,7 +4663,7 @@ short spawn( short j, short pn ) case RESPAWN__STATIC: sp->extra = 66-13; case MUSICANDSFX__STATIC: - if( ud.multimode < 2 && sp->pal == 1) + if ( ud.multimode < 2 && sp->pal == 1) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); @@ -4617,41 +4681,41 @@ short spawn( short j, short pn ) case SHRINKEREXPLOSION__STATIC: case COOLEXPLOSION1__STATIC: - if(j >= 0) + if (j >= 0) { sp->ang = sprite[j].ang; sp->shade = -64; sp->cstat = 128|(TRAND&4); } - if(sp->picnum == EXPLOSION2 || sp->picnum == EXPLOSION2BOT) + if (sp->picnum == EXPLOSION2 || sp->picnum == EXPLOSION2BOT) { sp->xrepeat = 48; sp->yrepeat = 48; sp->shade = -127; sp->cstat |= 128; } - else if(sp->picnum == SHRINKEREXPLOSION ) + else if (sp->picnum == SHRINKEREXPLOSION ) { sp->xrepeat = 32; sp->yrepeat = 32; } - else if( sp->picnum == SMALLSMOKE ) + else if ( sp->picnum == SMALLSMOKE ) { // 64 "money" sp->xrepeat = 24; sp->yrepeat = 24; } - else if(sp->picnum == BURNING || sp->picnum == BURNING2) + else if (sp->picnum == BURNING || sp->picnum == BURNING2) { sp->xrepeat = 4; sp->yrepeat = 4; } - if(j >= 0) + if (j >= 0) { x = getflorzofslope(sp->sectnum,sp->x,sp->y); - if(sp->z > x-(12<<8) ) + if (sp->z > x-(12<<8) ) sp->z = x-(12<<8); } @@ -4660,12 +4724,12 @@ short spawn( short j, short pn ) break; case PLAYERONWATER__STATIC: - if(j >= 0) + if (j >= 0) { sp->xrepeat = sprite[j].xrepeat; sp->yrepeat = sprite[j].yrepeat; sp->zvel = 128; - if(sector[sp->sectnum].lotag != 2) + if (sector[sp->sectnum].lotag != 2) sp->cstat |= 32768; } changespritestat(i,13); @@ -4676,17 +4740,17 @@ short spawn( short j, short pn ) //j = ud.coop; //if(j == 2) j = 0; j=(gametype_flags[ud.coop] & GAMETYPE_FLAG_COOPSPAWN ) / GAMETYPE_FLAG_COOPSPAWN ; - if( ud.multimode < 2 || (ud.multimode > 1 && j != sp->lotag) ) + if ( ud.multimode < 2 || (ud.multimode > 1 && j != sp->lotag) ) changespritestat(i,5); else changespritestat(i,10); break; case WATERBUBBLE__STATIC: - if(j >= 0 && sprite[j].picnum == APLAYER) + if (j >= 0 && sprite[j].picnum == APLAYER) sp->z -= (16<<8); - if( sp->picnum == WATERBUBBLE) + if ( sp->picnum == WATERBUBBLE) { - if( j >= 0 ) + if ( j >= 0 ) sp->ang = sprite[j].ang; sp->xrepeat = sp->yrepeat = 4; } @@ -4708,9 +4772,9 @@ short spawn( short j, short pn ) msx[tempwallptr+2] = sp->z; s = headspritestat[0]; - while(s >= 0) + while (s >= 0) { - if( sprite[s].picnum == CRANEPOLE && SHT == (sprite[s].hitag) ) + if ( sprite[s].picnum == CRANEPOLE && SHT == (sprite[s].hitag) ) { msy[tempwallptr+2] = s; @@ -4740,10 +4804,10 @@ short spawn( short j, short pn ) break; case WATERDRIP__STATIC: - if((j >= 0 && sprite[j].statnum == 10) || sprite[j].statnum == 1) + if ((j >= 0 && sprite[j].statnum == 10) || sprite[j].statnum == 1) { sp->shade = 32; - if(sprite[j].pal != 1) + if (sprite[j].pal != 1) { sp->pal = 2; sp->z -= (18<<8); @@ -4753,7 +4817,7 @@ short spawn( short j, short pn ) sp->xvel = 48-(TRAND&31); ssp(i,CLIPMASK0); } - else if(j == -1) + else if (j == -1) { sp->z += (4<<8); T1 = sp->z; @@ -4761,7 +4825,7 @@ short spawn( short j, short pn ) } case TRASH__STATIC: - if(sp->picnum != WATERDRIP) + if (sp->picnum != WATERDRIP) sp->ang = TRAND&2047; case WATERDRIPSPLASH__STATIC: @@ -4779,9 +4843,9 @@ short spawn( short j, short pn ) break; case TOUCHPLATE__STATIC: T3 = sector[sect].floorz; - if(sector[sect].lotag != 1 && sector[sect].lotag != 2) + if (sector[sect].lotag != 1 && sector[sect].lotag != 2) sector[sect].floorz = sp->z; - if(sp->pal && ud.multimode > 1) + if (sp->pal && ud.multimode > 1) { sp->xrepeat=sp->yrepeat=0; changespritestat(i,5); @@ -4807,7 +4871,7 @@ short spawn( short j, short pn ) // T1 = sp->xrepeat; // T2 = sp->yrepeat; case MASTERSWITCH__STATIC: - if(sp->picnum == MASTERSWITCH) + if (sp->picnum == MASTERSWITCH) sp->cstat |= 32768; sp->yvel = 0; changespritestat(i,6); @@ -4834,7 +4898,7 @@ short spawn( short j, short pn ) case BOSS4__STATIC: case ROTATEGUN__STATIC: case GREENSLIME__STATIC: - if(sp->picnum == GREENSLIME) + if (sp->picnum == GREENSLIME) sp->extra = 1; case DRONE__STATIC: case LIZTROOPONTOILET__STATIC: @@ -4855,9 +4919,9 @@ short spawn( short j, short pn ) case RAT__STATIC: case SHARK__STATIC: - if(sp->pal == 0) + if (sp->pal == 0) { - switch(dynamictostatic[sp->picnum]) + switch (dynamictostatic[sp->picnum]) { case LIZTROOPONTOILET__STATIC: case LIZTROOPSHOOT__STATIC: @@ -4872,11 +4936,11 @@ short spawn( short j, short pn ) } } - if( sp->picnum == BOSS4STAYPUT || sp->picnum == BOSS1 || sp->picnum == BOSS2 || sp->picnum == BOSS1STAYPUT || sp->picnum == BOSS3 || sp->picnum == BOSS4 ) + if ( sp->picnum == BOSS4STAYPUT || sp->picnum == BOSS1 || sp->picnum == BOSS2 || sp->picnum == BOSS1STAYPUT || sp->picnum == BOSS3 || sp->picnum == BOSS4 ) { - if(j >= 0 && sprite[j].picnum == RESPAWN) + if (j >= 0 && sprite[j].picnum == RESPAWN) sp->pal = sprite[j].pal; - if(sp->pal) + if (sp->pal) { sp->clipdist = 80; sp->xrepeat = 40; @@ -4891,7 +4955,7 @@ short spawn( short j, short pn ) } else { - if(sp->picnum != SHARK) + if (sp->picnum != SHARK) { sp->xrepeat = 40; sp->yrepeat = 40; @@ -4905,9 +4969,9 @@ short spawn( short j, short pn ) } } - if(j >= 0) sp->lotag = 0; + if (j >= 0) sp->lotag = 0; - if( ( sp->lotag > ud.player_skill ) || ud.monsters_off == 1 ) + if ( ( sp->lotag > ud.player_skill ) || ud.monsters_off == 1 ) { sp->xrepeat=sp->yrepeat=0; changespritestat(i,5); @@ -4917,7 +4981,7 @@ short spawn( short j, short pn ) { makeitfall(i); - if(sp->picnum == RAT) + if (sp->picnum == RAT) { sp->ang = TRAND&2047; sp->xrepeat = sp->yrepeat = 48; @@ -4927,13 +4991,13 @@ short spawn( short j, short pn ) { sp->cstat |= 257; - if(sp->picnum != SHARK) + if (sp->picnum != SHARK) ps[myconnectindex].max_actors_killed++; } - if(sp->picnum == ORGANTIC) sp->cstat |= 128; + if (sp->picnum == ORGANTIC) sp->cstat |= 128; - if(j >= 0) + if (j >= 0) { hittype[i].timetosleep = 0; check_fta_sounds(i); @@ -4942,7 +5006,7 @@ short spawn( short j, short pn ) else changespritestat(i,2); } - if(sp->picnum == ROTATEGUN) + if (sp->picnum == ROTATEGUN) sp->zvel = 0; break; @@ -4955,7 +5019,7 @@ short spawn( short j, short pn ) case ACTIVATORLOCKED__STATIC: case ACTIVATOR__STATIC: sp->cstat = (short) 32768; - if(sp->picnum == ACTIVATORLOCKED) + if (sp->picnum == ACTIVATORLOCKED) sector[sp->sectnum].lotag |= 16384; changespritestat(i,8); break; @@ -4970,9 +5034,9 @@ short spawn( short j, short pn ) case OOZ2__STATIC: sp->shade = -12; - if(j >= 0) + if (j >= 0) { - if( sprite[j].picnum == NUKEBARREL ) + if ( sprite[j].picnum == NUKEBARREL ) sp->pal = 8; insertspriteq(i); } @@ -4990,7 +5054,7 @@ short spawn( short j, short pn ) break; case HEAVYHBOMB__STATIC: - if(j >= 0) + if (j >= 0) sp->owner = j; else sp->owner = i; sp->xrepeat = sp->yrepeat = 9; @@ -4999,9 +5063,9 @@ short spawn( short j, short pn ) case REACTOR__STATIC: case RECON__STATIC: - if(sp->picnum == RECON) + if (sp->picnum == RECON) { - if( sp->lotag > ud.player_skill ) + if ( sp->lotag > ud.player_skill ) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); @@ -5009,7 +5073,7 @@ short spawn( short j, short pn ) } ps[myconnectindex].max_actors_killed++; hittype[i].temp_data[5] = 0; - if(ud.monsters_off == 1) + if (ud.monsters_off == 1) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); @@ -5018,12 +5082,12 @@ short spawn( short j, short pn ) sp->extra = 130; } - if(sp->picnum == REACTOR || sp->picnum == REACTOR2) + if (sp->picnum == REACTOR || sp->picnum == REACTOR2) sp->extra = impact_damage; CS |= 257; // Make it hitable - if( ud.multimode < 2 && sp->pal != 0) + if ( ud.multimode < 2 && sp->pal != 0) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); @@ -5067,7 +5131,7 @@ short spawn( short j, short pn ) case FIRSTAID__STATIC: case SIXPAK__STATIC: - if(j >= 0) + if (j >= 0) { sp->lotag = 0; sp->z -= (32<<8); @@ -5081,7 +5145,7 @@ short spawn( short j, short pn ) sp->cstat = 0; } - if( ( ud.multimode < 2 && sp->pal != 0) || (sp->lotag > ud.player_skill) ) + if ( ( ud.multimode < 2 && sp->pal != 0) || (sp->lotag > ud.player_skill) ) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); @@ -5092,10 +5156,10 @@ short spawn( short j, short pn ) case ACCESSCARD__STATIC: - if(sp->picnum == ATOMICHEALTH) + if (sp->picnum == ATOMICHEALTH) sp->cstat |= 128; - if(ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_ACCESSCARDSPRITES) && sp->picnum == ACCESSCARD) + if (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_ACCESSCARDSPRITES) && sp->picnum == ACCESSCARD) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); @@ -5103,14 +5167,14 @@ short spawn( short j, short pn ) } else { - if(sp->picnum == AMMO) + if (sp->picnum == AMMO) sp->xrepeat = sp->yrepeat = 16; else sp->xrepeat = sp->yrepeat = 32; } sp->shade = -17; - if(j >= 0) changespritestat(i,1); + if (j >= 0) changespritestat(i,1); else { changespritestat(i,2); @@ -5148,7 +5212,7 @@ short spawn( short j, short pn ) case STEAM__STATIC: - if(j >= 0) + if (j >= 0) { sp->ang = sprite[j].ang; sp->cstat = 16+128+2; @@ -5165,17 +5229,17 @@ short spawn( short j, short pn ) sp->cstat |= 32768; sp->xrepeat = sp->yrepeat = 0; - switch(sp->lotag) + switch (sp->lotag) { case 28: T6 = 65;// Delay for lightning break; case 7: // Transporters!!!! case 23:// XPTR END - if(sp->lotag != 23) + if (sp->lotag != 23) { - for(j=0;jang == 512) + if (sp->ang == 512) { T2 = sector[sect].ceilingz; - if(sp->pal) + if (sp->pal) sector[sect].ceilingz = sp->z; } else { T2 = sector[sect].floorz; - if(sp->pal) + if (sp->pal) sector[sect].floorz = sp->z; } @@ -5222,7 +5286,7 @@ short spawn( short j, short pn ) sector[sect].ceilingz = sp->z; break; case 27: - if(ud.recstat == 1) + if (ud.recstat == 1) { sp->xrepeat=sp->yrepeat=64; sp->cstat &= 32767; @@ -5239,13 +5303,13 @@ short spawn( short j, short pn ) T1 = sector[sect].ceilingz; T2 = sector[sect].floorz; - if( klabs(T1-sp->z) < klabs(T2-sp->z) ) + if ( klabs(T1-sp->z) < klabs(T2-sp->z) ) sp->owner = 1; else sp->owner = 0; - if(sp->ang == 512) + if (sp->ang == 512) { - if(sp->owner) + if (sp->owner) sector[sect].ceilingz = sp->z; else sector[sect].floorz = sp->z; @@ -5253,12 +5317,12 @@ short spawn( short j, short pn ) else sector[sect].ceilingz = sector[sect].floorz = sp->z; - if( sector[sect].ceilingstat&1 ) + if ( sector[sect].ceilingstat&1 ) { sector[sect].ceilingstat ^= 1; T4 = 1; - if(!sp->owner && sp->ang==512) + if (!sp->owner && sp->ang==512) { sector[sect].ceilingstat ^= 1; T4 = 0; @@ -5267,15 +5331,15 @@ short spawn( short j, short pn ) sector[sect].ceilingshade = sector[sect].floorshade; - if(sp->ang==512) + if (sp->ang==512) { startwall = sector[sect].wallptr; endwall = startwall+sector[sect].wallnum; - for(j=startwall;j= 0) - if( !(sector[x].ceilingstat&1) ) + if (x >= 0) + if ( !(sector[x].ceilingstat&1) ) { sector[sect].ceilingpicnum = sector[x].ceilingpicnum; @@ -5299,7 +5363,7 @@ short spawn( short j, short pn ) j = nextsectorneighborz(sect,sector[sect].ceilingz,1,1); T5 = sector[j].floorz; - if(numplayers < 2) + if (numplayers < 2) { setinterpolation(§or[sect].floorz); setinterpolation(§or[sect].ceilingz); @@ -5313,49 +5377,49 @@ short spawn( short j, short pn ) break; case 20: + { + long q; + + startwall = sector[sect].wallptr; + endwall = startwall+sector[sect].wallnum; + + //find the two most clostest wall x's and y's + q = 0x7fffffff; + + for (s=startwall;sx-x,sp->y-y); + if ( d < q ) { - x = wall[s].x; - y = wall[s].y; - - d = FindDistance2D(sp->x-x,sp->y-y); - if( d < q ) - { - q = d; - clostest = s; - } + q = d; + clostest = s; } - - T2 = clostest; - - q = 0x7fffffff; - - for(s=startwall;sx-x,sp->y-y); - if(d < q && s != T2) - { - q = d; - clostest = s; - } - } - - T3 = clostest; } - break; + T2 = clostest; + + q = 0x7fffffff; + + for (s=startwall;sx-x,sp->y-y); + if (d < q && s != T2) + { + q = d; + clostest = s; + } + } + + T3 = clostest; + } + + break; case 3: @@ -5372,11 +5436,11 @@ short spawn( short j, short pn ) startwall = sector[sect].wallptr; endwall = startwall+sector[sect].wallnum; - for(s=startwall;sshade; - if( (wall[s].cstat&2) && wall[s].nextwall >= 0) + if ( (wall[s].cstat&2) && wall[s].nextwall >= 0) wall[wall[s].nextwall].shade = sp->shade; } break; @@ -5384,13 +5448,13 @@ short spawn( short j, short pn ) case 31: T2 = sector[sect].floorz; // T3 = sp->hitag; - if(sp->ang != 1536) sector[sect].floorz = sp->z; + if (sp->ang != 1536) sector[sect].floorz = sp->z; startwall = sector[sect].wallptr; endwall = startwall+sector[sect].wallnum; - for(s=startwall;shitag; - if(sp->ang != 1536) sector[sect].ceilingz = sp->z; + if (sp->ang != 1536) sector[sect].ceilingz = sp->z; 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) + for (s=startwall;s T4) T4 = wall[s].shade; break; case 9: - if( sector[sect].lotag && + if ( sector[sect].lotag && labs(sector[sect].ceilingz-sp->z) > 1024) sector[sect].lotag |= 32768; //If its open case 8: @@ -5439,8 +5503,8 @@ short spawn( short j, short pn ) startwall = sector[sect].wallptr; endwall = startwall+sector[sect].wallnum; - for(s=startwall;s T3) + for (s=startwall;s T3) T3 = wall[s].shade; T4 = 1; //Take Out; @@ -5448,7 +5512,7 @@ short spawn( short j, short pn ) break; case 11://Pivitor rotater - if(sp->ang>1024) T4 = 2; + if (sp->ang>1024) T4 = 2; else T4 = -2; case 0: case 2://Earthquakemakers @@ -5460,24 +5524,24 @@ short spawn( short j, short pn ) case 26://ESCELATOR case 30://No rotational subways - if(sp->lotag == 0) + if (sp->lotag == 0) { - if( sector[sect].lotag == 30 ) + if ( sector[sect].lotag == 30 ) { - if(sp->pal) sprite[i].clipdist = 1; + if (sp->pal) sprite[i].clipdist = 1; else sprite[i].clipdist = 0; T4 = sector[sect].floorz; sector[sect].hitag = i; } - for(j = 0;j < MAXSPRITES;j++) + for (j = 0;j < MAXSPRITES;j++) { - if( sprite[j].statnum < MAXSTATUS ) - if( sprite[j].picnum == SECTOREFFECTOR && + if ( sprite[j].statnum < MAXSTATUS ) + if ( sprite[j].picnum == SECTOREFFECTOR && sprite[j].lotag == 1 && sprite[j].hitag == sp->hitag) { - if( sp->ang == 512 ) + if ( sp->ang == 512 ) { sp->x = sprite[j].x; sp->y = sprite[j].y; @@ -5485,7 +5549,7 @@ short spawn( short j, short pn ) break; } } - if(j == MAXSPRITES) + if (j == MAXSPRITES) { Bsprintf(tempbuf,"Found lonely Sector Effector (lotag 0) at (%ld,%ld)\n",sp->x,sp->y); gameexit(tempbuf); @@ -5497,24 +5561,24 @@ short spawn( short j, short pn ) endwall = startwall+sector[sect].wallnum; T2 = tempwallptr; - for(s=startwall;sx; msy[tempwallptr] = wall[s].y-sp->y; tempwallptr++; - if(tempwallptr > 2047) + if (tempwallptr > 2047) { Bsprintf(tempbuf,"Too many moving sectors at (%ld,%ld).\n",wall[s].x,wall[s].y); gameexit(tempbuf); } } - if( sp->lotag == 30 || sp->lotag == 6 || sp->lotag == 14 || sp->lotag == 5 ) + if ( sp->lotag == 30 || sp->lotag == 6 || sp->lotag == 14 || sp->lotag == 5 ) { startwall = sector[sect].wallptr; endwall = startwall+sector[sect].wallnum; - if(sector[sect].hitag == -1) + if (sector[sect].hitag == -1) sp->extra = 0; else sp->extra = 1; @@ -5522,9 +5586,9 @@ short spawn( short j, short pn ) j = 0; - for(s=startwall;s= 0 && + if ( wall[ s ].nextsector >= 0 && sector[ wall[ s ].nextsector].hitag == 0 && sector[ wall[ s ].nextsector].lotag < 3 ) { @@ -5534,7 +5598,7 @@ short spawn( short j, short pn ) } } - if(j == 0) + if (j == 0) { Bsprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%ld,%ld).\n",sp->x,sp->y); gameexit(tempbuf); @@ -5543,40 +5607,40 @@ short spawn( short j, short pn ) sp->owner = -1; T1 = s; - if(sp->lotag != 30) + if (sp->lotag != 30) T4 = sp->hitag; } - else if(sp->lotag == 16) + else if (sp->lotag == 16) T4 = sector[sect].ceilingz; - else if( sp->lotag == 26 ) + else if ( sp->lotag == 26 ) { T4 = sp->x; T5 = sp->y; - if(sp->shade==sector[sect].floorshade) //UP + if (sp->shade==sector[sect].floorshade) //UP sp->zvel = -256; else sp->zvel = 256; sp->shade = 0; } - else if( sp->lotag == 2) + else if ( sp->lotag == 2) { T6 = sector[sp->sectnum].floorheinum; sector[sp->sectnum].floorheinum = 0; } } - switch(sp->lotag) + switch (sp->lotag) { case 6: case 14: j = callsound(sect,i); - if(j == -1) j = SUBWAY; + if (j == -1) j = SUBWAY; hittype[i].lastvx = j; case 30: - if(numplayers > 1) break; + if (numplayers > 1) break; case 0: case 1: case 5: @@ -5588,7 +5652,7 @@ short spawn( short j, short pn ) break; } - switch(sprite[i].lotag) + switch (sprite[i].lotag) { case 40: case 41: @@ -5610,7 +5674,7 @@ short spawn( short j, short pn ) case OOZFILTER__STATIC: sp->shade = -16; - if(sp->xrepeat <= 8) + if (sp->xrepeat <= 8) { sp->cstat = (short)32768; sp->xrepeat=sp->yrepeat=0; @@ -5627,7 +5691,7 @@ short spawn( short j, short pn ) case CRACK3__STATIC: case CRACK4__STATIC: case FIREEXT__STATIC: - if(sp->picnum == FIREEXT) + if (sp->picnum == FIREEXT) { sp->cstat = 257; sp->extra = impact_damage<<2; @@ -5638,7 +5702,7 @@ short spawn( short j, short pn ) sp->extra = 1; } - if( ud.multimode < 2 && sp->pal != 0) + if ( ud.multimode < 2 && sp->pal != 0) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); @@ -5674,22 +5738,22 @@ short spawn( short j, short pn ) case NUKEBARRELLEAKED__STATIC: case WOODENHORSE__STATIC: - if(j >= 0) + if (j >= 0) sp->xrepeat = sp->yrepeat = 32; sp->clipdist = 72; makeitfall(i); - if(j >= 0) + if (j >= 0) sp->owner = j; else sp->owner = i; case EGG__STATIC: - if( ud.monsters_off == 1 && sp->picnum == EGG ) + if ( ud.monsters_off == 1 && sp->picnum == EGG ) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); } else { - if(sp->picnum == EGG) + if (sp->picnum == EGG) sp->clipdist = 24; sp->cstat = 257|(TRAND&4); changespritestat(i,2); @@ -5718,14 +5782,15 @@ void animatesprites(long x,long y,short a,long smoothratio) spritetype *s,*t; int switchpic; - for(j=0;j < spritesortcnt; j++) + for (j=0;j < spritesortcnt; j++) { t = &tsprite[j]; i = t->owner; s = &sprite[t->owner]; //greenslime can't be handled through the dynamictostatic system due to addition on constant if ((t->picnum >= GREENSLIME)&&(t->picnum <= GREENSLIME+7)) { - } else switch(dynamictostatic[t->picnum]) + } + else switch (dynamictostatic[t->picnum]) { case BLOODPOOL__STATIC: case PUKE__STATIC: @@ -5733,12 +5798,12 @@ void animatesprites(long x,long y,short a,long smoothratio) case FOOTPRINTS2__STATIC: case FOOTPRINTS3__STATIC: case FOOTPRINTS4__STATIC: - if(t->shade == 127) continue; + if (t->shade == 127) continue; break; case RESPAWNMARKERRED__STATIC: case RESPAWNMARKERYELLOW__STATIC: case RESPAWNMARKERGREEN__STATIC: - if(ud.marker == 0) + if (ud.marker == 0) t->xrepeat = t->yrepeat = 0; continue; case CHAIR3__STATIC: @@ -5749,7 +5814,7 @@ void animatesprites(long x,long y,short a,long smoothratio) } #endif k = (((t->ang+3072+128-a)&2047)>>8)&7; - if(k>4) + if (k>4) { k = 8-k; t->cstat |= 4; @@ -5761,8 +5826,8 @@ void animatesprites(long x,long y,short a,long smoothratio) case BLOODSPLAT2__STATIC: case BLOODSPLAT3__STATIC: case BLOODSPLAT4__STATIC: - if(ud.lockout) t->xrepeat = t->yrepeat = 0; - else if(t->pal == 6) + if (ud.lockout) t->xrepeat = t->yrepeat = 0; + else if (t->pal == 6) { t->shade = -127; continue; @@ -5791,7 +5856,7 @@ void animatesprites(long x,long y,short a,long smoothratio) //case GREENSLIME+7: // break; default: - if( ( (t->cstat&16) ) || ( badguy(t) && t->extra > 0) || t->statnum == 10) + if ( ( (t->cstat&16) ) || ( badguy(t) && t->extra > 0) || t->statnum == 10) continue; } @@ -5803,23 +5868,23 @@ void animatesprites(long x,long y,short a,long smoothratio) l = sector[t->sectnum].ceilingshade; else l = sector[t->sectnum].floorshade; - if(l < -127) l = -127; - if(l > 128) l = 127; + if (l < -127) l = -127; + if (l > 128) l = 127; } t->shade = l; } - for(j=0;j < spritesortcnt; j++ ) //Between drawrooms() and drawmasks() + for (j=0;j < spritesortcnt; j++ ) //Between drawrooms() and drawmasks() { //is the perfect time to animate sprites t = &tsprite[j]; i = t->owner; s = &sprite[i]; - switch(dynamictostatic[s->picnum]) + switch (dynamictostatic[s->picnum]) { case SECTOREFFECTOR__STATIC: - if(t->lotag == 27 && ud.recstat == 1) + if (t->lotag == 27 && ud.recstat == 1) { t->picnum = 11+((totalclock>>3)&1); t->cstat |= 128; @@ -5881,13 +5946,13 @@ void animatesprites(long x,long y,short a,long smoothratio) case TOUGHGAL__STATIC: case TAMPON__STATIC: case XXXSTACY__STATIC: - if(ud.lockout) + if (ud.lockout) { t->xrepeat = t->yrepeat = 0; continue; } } - switch(s->picnum) + switch (s->picnum) { case 4946: @@ -5899,22 +5964,22 @@ void animatesprites(long x,long y,short a,long smoothratio) case 4562: case 4498: case 4957: - if(ud.lockout) + if (ud.lockout) { t->xrepeat = t->yrepeat = 0; continue; } } - if( t->statnum == 99 ) continue; - if( s->statnum != 1 && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && s->owner >= 0 ) + if ( t->statnum == 99 ) continue; + if ( s->statnum != 1 && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && s->owner >= 0 ) { t->x -= mulscale16(65536-smoothratio,ps[s->yvel].posx-ps[s->yvel].oposx); t->y -= mulscale16(65536-smoothratio,ps[s->yvel].posy-ps[s->yvel].oposy); t->z = ps[s->yvel].oposz + mulscale16(smoothratio,ps[s->yvel].posz-ps[s->yvel].oposz); t->z += (40<<8); } - else if( ( s->statnum == 0 && s->picnum != CRANEPOLE) || s->statnum == 10 || s->statnum == 6 || s->statnum == 4 || s->statnum == 5 || s->statnum == 1 ) + else if ( ( s->statnum == 0 && s->picnum != CRANEPOLE) || s->statnum == 10 || s->statnum == 6 || s->statnum == 4 || s->statnum == 5 || s->statnum == 1 ) { t->x -= mulscale16(65536-smoothratio,s->x-hittype[i].bposx); t->y -= mulscale16(65536-smoothratio,s->y-hittype[i].bposy); @@ -5930,7 +5995,7 @@ void animatesprites(long x,long y,short a,long smoothratio) else if ((s->picnum==MONEY+1)||(s->picnum==MAIL+1)||(s->picnum==PAPER+1)) switchpic--; - switch(dynamictostatic[switchpic]) + switch (dynamictostatic[switchpic]) { case DUKELYINGDEAD__STATIC: t->z += (24<<8); @@ -5940,7 +6005,7 @@ void animatesprites(long x,long y,short a,long smoothratio) case FOOTPRINTS2__STATIC: case FOOTPRINTS3__STATIC: case FOOTPRINTS4__STATIC: - if(t->pal == 6) + if (t->pal == 6) t->shade = -127; case PUKE__STATIC: case MONEY__STATIC: @@ -5949,7 +6014,7 @@ void animatesprites(long x,long y,short a,long smoothratio) //case MAIL+1__STATIC: case PAPER__STATIC: //case PAPER+1__STATIC: - if(ud.lockout && s->pal == 2) + if (ud.lockout && s->pal == 2) { t->xrepeat = t->yrepeat = 0; continue; @@ -5958,7 +6023,7 @@ void animatesprites(long x,long y,short a,long smoothratio) case TRIPBOMB__STATIC: continue; case FORCESPHERE__STATIC: - if(t->statnum == 5) + if (t->statnum == 5) { short sqa,sqb; @@ -5971,16 +6036,16 @@ void animatesprites(long x,long y,short a,long smoothratio) sprite[s->owner].x-t->x, sprite[s->owner].y-t->y); - if( klabs(getincangle(sqa,sqb)) > 512 ) - if( ldist(&sprite[s->owner],t) < ldist(&sprite[ps[screenpeek].i],&sprite[s->owner]) ) + if ( klabs(getincangle(sqa,sqb)) > 512 ) + if ( ldist(&sprite[s->owner],t) < ldist(&sprite[ps[screenpeek].i],&sprite[s->owner]) ) t->xrepeat = t->yrepeat = 0; } continue; case BURNING__STATIC: case BURNING2__STATIC: - if( sprite[s->owner].statnum == 10 ) + if ( sprite[s->owner].statnum == 10 ) { - if( display_mirror == 0 && sprite[s->owner].yvel == screenpeek && ps[sprite[s->owner].yvel].over_shoulder_on == 0 ) + if ( display_mirror == 0 && sprite[s->owner].yvel == screenpeek && ps[sprite[s->owner].yvel].over_shoulder_on == 0 ) t->xrepeat = 0; else { @@ -6001,7 +6066,7 @@ void animatesprites(long x,long y,short a,long smoothratio) continue; case VIEWSCREEN__STATIC: case VIEWSCREEN2__STATIC: - if(camsprite >= 0 && hittype[OW].temp_data[0] == 1) + if (camsprite >= 0 && hittype[OW].temp_data[0] == 1) { t->picnum = STATIC; t->cstat |= (rand()&12); @@ -6027,7 +6092,7 @@ void animatesprites(long x,long y,short a,long smoothratio) #endif k = getangle(s->x-x,s->y-y); k = (((s->ang+3072+128-k)&2047)/170); - if(k > 6) + if (k > 6) { k = 12-k; t->cstat |= 4; @@ -6044,18 +6109,18 @@ void animatesprites(long x,long y,short a,long smoothratio) } #endif k = getangle(s->x-x,s->y-y); - if( T1 < 4 ) + if ( T1 < 4 ) k = (((s->ang+3072+128-k)&2047)/170); else k = (((s->ang+3072+128-k)&2047)/170); - if(k>6) + if (k>6) { k = 12-k; t->cstat |= 4; } else t->cstat &= ~4; - if( klabs(t3) > 64 ) k += 7; + if ( klabs(t3) > 64 ) k += 7; t->picnum = RECON+k; break; @@ -6064,9 +6129,9 @@ void animatesprites(long x,long y,short a,long smoothratio) p = s->yvel; - if(t->pal == 1) t->z -= (18<<8); + if (t->pal == 1) t->z -= (18<<8); - if(ps[p].over_shoulder_on > 0 && ps[p].newowner < 0 ) + if (ps[p].over_shoulder_on > 0 && ps[p].newowner < 0 ) { t->cstat |= 2; if ( screenpeek == myconnectindex && numplayers >= 2 ) @@ -6079,24 +6144,24 @@ void animatesprites(long x,long y,short a,long smoothratio) } } - if( ( display_mirror == 1 || screenpeek != p || s->owner == -1 ) && ud.multimode > 1 && ud.showweapons && sprite[ps[p].i].extra > 0 && ps[p].curr_weapon > 0 ) + if ( ( display_mirror == 1 || screenpeek != p || s->owner == -1 ) && ud.multimode > 1 && ud.showweapons && sprite[ps[p].i].extra > 0 && ps[p].curr_weapon > 0 ) { memcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype)); tsprite[spritesortcnt].statnum = 99; tsprite[spritesortcnt].yrepeat = ( t->yrepeat>>3 ); - if(t->yrepeat < 4) t->yrepeat = 4; + if (t->yrepeat < 4) t->yrepeat = 4; tsprite[spritesortcnt].shade = t->shade; tsprite[spritesortcnt].cstat = 0; tsprite[spritesortcnt].picnum = (ps[p].curr_weapon==GROW_WEAPON?GROWSPRITEICON:weapon_sprites[ps[p].curr_weapon]); - if(s->owner >= 0) + if (s->owner >= 0) tsprite[spritesortcnt].z = ps[p].posz-(12<<8); else tsprite[spritesortcnt].z = s->z-(51<<8); - if(tsprite[spritesortcnt].picnum == HEAVYHBOMB) + if (tsprite[spritesortcnt].picnum == HEAVYHBOMB) { tsprite[spritesortcnt].xrepeat = 10; tsprite[spritesortcnt].yrepeat = 10; @@ -6110,20 +6175,20 @@ void animatesprites(long x,long y,short a,long smoothratio) spritesortcnt++; } - if( ( display_mirror == 1 || screenpeek != p || s->owner == -1 ) && ud.multimode > 1 && sync[p].svel == 0 && sync[p].fvel == 0 && !ud.pause_on) + if ( ( display_mirror == 1 || screenpeek != p || s->owner == -1 ) && ud.multimode > 1 && sync[p].svel == 0 && sync[p].fvel == 0 && !ud.pause_on) { memcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype)); tsprite[spritesortcnt].statnum = 99; tsprite[spritesortcnt].yrepeat = ( t->yrepeat>>3 ); - if(t->yrepeat < 4) t->yrepeat = 4; + if (t->yrepeat < 4) t->yrepeat = 4; tsprite[spritesortcnt].cstat = 0; tsprite[spritesortcnt].picnum = RESPAWNMARKERGREEN; - if(s->owner >= 0) + if (s->owner >= 0) tsprite[spritesortcnt].z = ps[p].posz-(20<<8); else tsprite[spritesortcnt].z = s->z-(96<<8); tsprite[spritesortcnt].xrepeat = 32; @@ -6132,7 +6197,7 @@ void animatesprites(long x,long y,short a,long smoothratio) spritesortcnt++; } - if(s->owner == -1) + if (s->owner == -1) { #if defined(POLYMOST) && defined(USE_OPENGL) if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) { @@ -6142,7 +6207,7 @@ void animatesprites(long x,long y,short a,long smoothratio) #endif { k = (((s->ang+3072+128-a)&2047)>>8)&7; - if(k>4) + if (k>4) { k = 8-k; t->cstat |= 4; @@ -6150,8 +6215,8 @@ void animatesprites(long x,long y,short a,long smoothratio) else t->cstat &= ~4; } - if(sector[t->sectnum].lotag == 2) k += 1795-1405; - else if( (hittype[i].floorz-s->z) > (64<<8) ) k += 60; + if (sector[t->sectnum].lotag == 2) k += 1795-1405; + else if ( (hittype[i].floorz-s->z) > (64<<8) ) k += 60; t->picnum += k; t->pal = ps[p].palookup; @@ -6159,24 +6224,24 @@ void animatesprites(long x,long y,short a,long smoothratio) goto PALONLY; } - if( ps[p].on_crane == -1 && (sector[s->sectnum].lotag&0x7ff) != 1 ) + if ( ps[p].on_crane == -1 && (sector[s->sectnum].lotag&0x7ff) != 1 ) { l = s->z-hittype[ps[p].i].floorz+(3<<8); - if( l > 1024 && s->yrepeat > 32 && s->extra > 0 ) + if ( l > 1024 && s->yrepeat > 32 && s->extra > 0 ) s->yoffset = (signed char)(l/(s->yrepeat<<2)); else s->yoffset=0; } - if(ps[p].newowner > -1) + if (ps[p].newowner > -1) { t4 = *(actorscrptr[APLAYER]+1); t3 = 0; t1 = *(actorscrptr[APLAYER]+2); } - if(ud.camerasprite == -1 && ps[p].newowner == -1) - if(s->owner >= 0 && display_mirror == 0 && ps[p].over_shoulder_on == 0 ) - if( ud.multimode < 2 || ( ud.multimode > 1 && p == screenpeek ) ) + if (ud.camerasprite == -1 && ps[p].newowner == -1) + if (s->owner >= 0 && display_mirror == 0 && ps[p].over_shoulder_on == 0 ) + if ( ud.multimode < 2 || ( ud.multimode > 1 && p == screenpeek ) ) { t->owner = -1; t->xrepeat = t->yrepeat = 0; @@ -6185,12 +6250,12 @@ void animatesprites(long x,long y,short a,long smoothratio) PALONLY: - if( sector[sect].floorpal && sector[sect].floorpal < numl) + if ( sector[sect].floorpal && sector[sect].floorpal < numl) t->pal = sector[sect].floorpal; - if(s->owner == -1) continue; + if (s->owner == -1) continue; - if( t->z > hittype[i].floorz && t->xrepeat < 32 ) + if ( t->z > hittype[i].floorz && t->xrepeat < 32 ) t->z = hittype[i].floorz; break; @@ -6210,41 +6275,41 @@ PALONLY: case DUKELEG__STATIC: case DUKEGUN__STATIC: case DUKETORSO__STATIC: - if(ud.lockout) + if (ud.lockout) { t->xrepeat = t->yrepeat = 0; continue; } - if(t->pal == 6) t->shade = -120; + if (t->pal == 6) t->shade = -120; case SCRAP1__STATIC: case SCRAP2__STATIC: case SCRAP3__STATIC: case SCRAP4__STATIC: case SCRAP5__STATIC: - if(hittype[i].picnum == BLIMP && t->picnum == SCRAP1 && s->yvel >= 0) + if (hittype[i].picnum == BLIMP && t->picnum == SCRAP1 && s->yvel >= 0) t->picnum = s->yvel; else t->picnum += T1; t->shade -= 6; - if( sector[sect].floorpal && sector[sect].floorpal < numl ) + if ( sector[sect].floorpal && sector[sect].floorpal < numl ) t->pal = sector[sect].floorpal; break; case WATERBUBBLE__STATIC: - if(sector[t->sectnum].floorpicnum == FLOORSLIME) + if (sector[t->sectnum].floorpicnum == FLOORSLIME) { t->pal = 7; break; } default: - if( sector[sect].floorpal && sector[sect].floorpal < numl ) + if ( sector[sect].floorpal && sector[sect].floorpal < numl ) t->pal = sector[sect].floorpal; break; } - if( actorscrptr[s->picnum] ) + if ( actorscrptr[s->picnum] ) { - if(t4) + if (t4) { l = *(long *)(t4+8); #if defined(POLYMOST) && defined(USE_OPENGL) @@ -6254,7 +6319,7 @@ PALONLY: } else #endif - switch( l ) + switch ( l ) { case 2: k = (((s->ang+3072+128-a)&2047)>>8)&1; @@ -6263,7 +6328,7 @@ PALONLY: case 3: case 4: k = (((s->ang+3072+128-a)&2047)>>7)&7; - if(k > 3) + if (k > 3) { t->cstat |= 4; k = 7-k; @@ -6274,7 +6339,7 @@ PALONLY: case 5: k = getangle(s->x-x,s->y-y); k = (((s->ang+3072+128-k)&2047)>>8)&7; - if(k>4) + if (k>4) { k = 8-k; t->cstat |= 4; @@ -6284,7 +6349,7 @@ PALONLY: case 7: k = getangle(s->x-x,s->y-y); k = (((s->ang+3072+128-k)&2047)/170); - if(k>6) + if (k>6) { k = 12-k; t->cstat |= 4; @@ -6302,49 +6367,49 @@ PALONLY: t->picnum += k + ( *(long *)t4 ) + l * t3; - if(l > 0) while(tilesizx[t->picnum] == 0 && t->picnum > 0 ) + if (l > 0) while (tilesizx[t->picnum] == 0 && t->picnum > 0 ) t->picnum -= l; //Hack, for actors - if( hittype[i].dispicnum >= 0) + if ( hittype[i].dispicnum >= 0) hittype[i].dispicnum = t->picnum; } - else if(display_mirror == 1) + else if (display_mirror == 1) t->cstat |= 4; } - if( ps[screenpeek].heat_amount > 0 && ps[screenpeek].heat_on && (badguy(s) || checkspriteflags(t->owner,SPRITE_FLAG_NVG) || s->picnum == APLAYER || s->statnum == 13)) + if ( ps[screenpeek].heat_amount > 0 && ps[screenpeek].heat_on && (badguy(s) || checkspriteflags(t->owner,SPRITE_FLAG_NVG) || s->picnum == APLAYER || s->statnum == 13)) { t->pal = 6; t->shade = 0; } - if( s->statnum == 13 || badguy(s) || checkspriteflags(t->owner,SPRITE_FLAG_SHADOW) || (s->picnum == APLAYER && s->owner >= 0) ) - if(t->statnum != 99 && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE) - if(s->picnum != HOTMEAT) + if ( s->statnum == 13 || badguy(s) || checkspriteflags(t->owner,SPRITE_FLAG_SHADOW) || (s->picnum == APLAYER && s->owner >= 0) ) + if (t->statnum != 99 && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE) + if (s->picnum != HOTMEAT) { - if( hittype[i].dispicnum < 0 ) + if ( hittype[i].dispicnum < 0 ) { hittype[i].dispicnum++; continue; } - else if( ud.shadows && spritesortcnt < (MAXSPRITESONSCREEN-2)) + else if ( ud.shadows && spritesortcnt < (MAXSPRITESONSCREEN-2)) { long daz,xrep,yrep; - if( (sector[sect].lotag&0xff) > 2 || s->statnum == 4 || s->statnum == 5 || s->picnum == DRONE || s->picnum == COMMANDER ) + if ( (sector[sect].lotag&0xff) > 2 || s->statnum == 4 || s->statnum == 5 || s->picnum == DRONE || s->picnum == COMMANDER ) daz = sector[sect].floorz; else daz = hittype[i].floorz; - if( (s->z-daz) < (8<<8) ) - if( ps[screenpeek].posz < daz ) + if ( (s->z-daz) < (8<<8) ) + if ( ps[screenpeek].posz < daz ) { memcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype)); tsprite[spritesortcnt].statnum = 99; tsprite[spritesortcnt].yrepeat = ( t->yrepeat>>3 ); - if(t->yrepeat < 4) t->yrepeat = 4; + if (t->yrepeat < 4) t->yrepeat = 4; tsprite[spritesortcnt].shade = 127; tsprite[spritesortcnt].cstat |= 2; @@ -6365,7 +6430,7 @@ PALONLY: //1024:tell MD2SPRITE.C to use Z-buffer hacks to hide overdraw issues tsprite[spritesortcnt].cstat |= (512+1024); } - else if(bpp > 8) + else if (bpp > 8) { int ii; @@ -6381,12 +6446,12 @@ PALONLY: } } - switch(dynamictostatic[s->picnum]) + switch (dynamictostatic[s->picnum]) { case LASERLINE__STATIC: - if(sector[t->sectnum].lotag == 2) t->pal = 8; + if (sector[t->sectnum].lotag == 2) t->pal = 8; t->z = sprite[s->owner].z-(3<<8); - if(lasermode == 2 && ps[screenpeek].heat_on == 0 ) + if (lasermode == 2 && ps[screenpeek].heat_on == 0 ) t->yrepeat = 0; case EXPLOSION2__STATIC: case EXPLOSION2BOT__STATIC: @@ -6399,7 +6464,7 @@ PALONLY: case SHRINKEREXPLOSION__STATIC: case RPG__STATIC: case FLOORFLAME__STATIC: - if(t->picnum == EXPLOSION2) + if (t->picnum == EXPLOSION2) { ps[screenpeek].visibility = -127; lastvisinc = totalclock+32; @@ -6411,7 +6476,7 @@ PALONLY: case FIRE2__STATIC: case BURNING__STATIC: case BURNING2__STATIC: - if( sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2 ) + if ( sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2 ) t->z = sector[t->sectnum].floorz; t->shade = -127; break; @@ -6428,7 +6493,7 @@ PALONLY: #endif { k = (((t->ang+3072+128-a)&2047)>>8)&7; - if(k>4) + if (k>4) { k = 8-k; t->cstat |= 4; @@ -6451,24 +6516,24 @@ PALONLY: t->picnum = s->picnum+(T1&1); case SHOTGUNSHELL__STATIC: t->cstat |= 12; - if(T1 > 1) t->cstat &= ~4; - if(T1 > 2) t->cstat &= ~12; + if (T1 > 1) t->cstat &= ~4; + if (T1 > 2) t->cstat &= ~12; break; case FRAMEEFFECT1_13__STATIC: if (PLUTOPAK) break; case FRAMEEFFECT1__STATIC: - if(s->owner >= 0 && sprite[s->owner].statnum < MAXSTATUS) + if (s->owner >= 0 && sprite[s->owner].statnum < MAXSTATUS) { - if(sprite[s->owner].picnum == APLAYER) - if(ud.camerasprite == -1) - if(screenpeek == sprite[s->owner].yvel && display_mirror == 0) + if (sprite[s->owner].picnum == APLAYER) + if (ud.camerasprite == -1) + if (screenpeek == sprite[s->owner].yvel && display_mirror == 0) { t->owner = -1; break; } - if( (sprite[s->owner].cstat&32768) == 0 ) + if ( (sprite[s->owner].cstat&32768) == 0 ) { - if(!hittype[s->owner].dispicnum) + if (!hittype[s->owner].dispicnum) t->picnum = hittype[i].temp_data[1]; else t->picnum = hittype[s->owner].dispicnum; t->pal = sprite[s->owner].pal; @@ -6490,7 +6555,7 @@ PALONLY: #endif k = (((t->ang+3072+128-a)&2047)>>8)&7; - if(k>4) + if (k>4) { k = 8-k; t->cstat |= 4; @@ -6501,7 +6566,7 @@ PALONLY: } hittype[i].dispicnum = t->picnum; - if(sector[t->sectnum].floorpicnum == MIRROR) + if (sector[t->sectnum].floorpicnum == MIRROR) t->xrepeat = t->yrepeat = 0; } } @@ -6576,7 +6641,7 @@ void CheatGetInventory(void) { SetGameVarID(g_iReturnVarID, 400, ps[myconnectindex].i, myconnectindex); OnEvent(EVENT_CHEATGETSTEROIDS, ps[myconnectindex].i, myconnectindex, -1); - if( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + if ( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) { ps[myconnectindex].steroids_amount = GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); @@ -6584,7 +6649,7 @@ void CheatGetInventory(void) SetGameVarID(g_iReturnVarID, 1200, ps[myconnectindex].i, myconnectindex); OnEvent(EVENT_CHEATGETHEAT, ps[myconnectindex].i, myconnectindex, -1); - if( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + if ( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) { ps[myconnectindex].heat_amount = GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); @@ -6592,7 +6657,7 @@ void CheatGetInventory(void) SetGameVarID(g_iReturnVarID, 200, ps[myconnectindex].i, myconnectindex); OnEvent(EVENT_CHEATGETBOOT, ps[myconnectindex].i, myconnectindex, -1); - if( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + if ( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) { ps[myconnectindex].boot_amount = GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); @@ -6600,7 +6665,7 @@ void CheatGetInventory(void) SetGameVarID(g_iReturnVarID, 100, ps[myconnectindex].i, myconnectindex); OnEvent(EVENT_CHEATGETSHIELD, ps[myconnectindex].i, myconnectindex, -1); - if( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + if ( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) { ps[myconnectindex].shield_amount = GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); @@ -6608,7 +6673,7 @@ void CheatGetInventory(void) SetGameVarID(g_iReturnVarID, 6400, ps[myconnectindex].i, myconnectindex); OnEvent(EVENT_CHEATGETSCUBA, ps[myconnectindex].i, myconnectindex, -1); - if( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + if ( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) { ps[myconnectindex].scuba_amount = GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); @@ -6616,7 +6681,7 @@ void CheatGetInventory(void) SetGameVarID(g_iReturnVarID, 2400, ps[myconnectindex].i, myconnectindex); OnEvent(EVENT_CHEATGETHOLODUKE, ps[myconnectindex].i, myconnectindex, -1); - if( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + if ( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) { ps[myconnectindex].holoduke_amount = GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); @@ -6624,7 +6689,7 @@ void CheatGetInventory(void) SetGameVarID(g_iReturnVarID, 1600, ps[myconnectindex].i, myconnectindex); OnEvent(EVENT_CHEATGETJETPACK, ps[myconnectindex].i, myconnectindex, -1); - if( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + if ( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) { ps[myconnectindex].jetpack_amount = GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); @@ -6632,7 +6697,7 @@ void CheatGetInventory(void) SetGameVarID(g_iReturnVarID, max_player_health, ps[myconnectindex].i, myconnectindex); OnEvent(EVENT_CHEATGETFIRSTAID, ps[myconnectindex].i, myconnectindex, -1); - if( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + if ( GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) { ps[myconnectindex].firstaid_amount = GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); @@ -6653,7 +6718,7 @@ void cheats(void) consolecheat = 1; } - if( (ps[myconnectindex].gm&MODE_TYPE) || (ps[myconnectindex].gm&MODE_MENU)) + if ( (ps[myconnectindex].gm&MODE_TYPE) || (ps[myconnectindex].gm&MODE_MENU)) return; if (VOLUMEONE && !z) { @@ -6671,7 +6736,7 @@ void cheats(void) { ch = Btolower(KB_Getch()); - if( !( (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') ) ) + if ( !( (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') ) ) { ps[myconnectindex].cheat_phase = 0; // FTA(46,&ps[myconnectindex]); @@ -6682,20 +6747,20 @@ void cheats(void) cheatbuf[cheatbuflen] = 0; // KB_ClearKeysDown(); - if(cheatbuflen > MAXCHEATLEN) + if (cheatbuflen > MAXCHEATLEN) { ps[myconnectindex].cheat_phase = 0; return; } - for(k=0;k < NUMCHEATCODES;k++) + for (k=0;k < NUMCHEATCODES;k++) { - for(j = 0;j= '0' && ch <= '9') ) + if ( cheatbuf[j] == cheatquotes[k][j] || (cheatquotes[k][j] == '#' && ch >= '0' && ch <= '9') ) { - if( cheatquotes[k][j+1] == 0 ) goto FOUNDCHEAT; - if(j == cheatbuflen-1) return; + if ( cheatquotes[k][j+1] == 0 ) goto FOUNDCHEAT; + if (j == cheatbuflen-1) return; } else break; } @@ -6706,7 +6771,7 @@ void cheats(void) FOUNDCHEAT: { - switch(k) + switch (k) { case CHEAT_WEAPONS: if (VOLUMEONE) { @@ -6749,9 +6814,9 @@ FOUNDCHEAT: { int i,j; FILE * fp=fopen("debug.con","w"); - for(i=0;i= 0) + while (j >= 0) { fprintf(fp,"Sprite %d (%ld,%ld,%ld) (picnum: %d)\n",j,sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].picnum); - for(i=0;i 0 ) + if ( VOLUMEONE && volnume > 0 ) { ps[myconnectindex].cheat_phase = 0; KB_FlushKeyBoardQueue(); return; } - else if(volnume > num_volumes-1) + else if (volnume > num_volumes-1) { ps[myconnectindex].cheat_phase = 0; KB_FlushKeyBoardQueue(); return; } - else if(volnume == 0) + else if (volnume == 0) { - if(levnume > 5) + if (levnume > 5) { ps[myconnectindex].cheat_phase = 0; KB_FlushKeyBoardQueue(); @@ -6984,7 +7050,7 @@ FOUNDCHEAT: } else { - if(levnume >= 11) + if (levnume >= 11) { ps[myconnectindex].cheat_phase = 0; KB_FlushKeyBoardQueue(); @@ -7005,7 +7071,7 @@ FOUNDCHEAT: i = Bstrlen(cheatquotes[k])-1; ud.m_player_skill = ud.player_skill = cheatbuf[i] - '1'; } - if(numplayers > 1 && myconnectindex == connecthead) + if (numplayers > 1 && myconnectindex == connecthead) { tempbuf[0] = 5; tempbuf[1] = ud.m_level_number; @@ -7020,7 +7086,7 @@ FOUNDCHEAT: tempbuf[10] = ud.m_ffire; tempbuf[11] = ud.m_noexits; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) sendpacket(i,tempbuf,12); } else ps[myconnectindex].gm |= MODE_RESTART; @@ -7036,7 +7102,7 @@ FOUNDCHEAT: return; case CHEAT_VIEW: - if( ps[myconnectindex].over_shoulder_on ) + if ( ps[myconnectindex].over_shoulder_on ) ps[myconnectindex].over_shoulder_on = 0; else { @@ -7059,13 +7125,13 @@ 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; - if( (j & 0x7fff) > 2 ) + if (j == -1 || j == 32767) continue; + if ( (j & 0x7fff) > 2 ) { - if( j&(0xffff-16384) ) + if ( j&(0xffff-16384) ) sector[i].lotag &= (0xffff-16384); operatesectors(i,ps[myconnectindex].i); } @@ -7093,19 +7159,19 @@ FOUNDCHEAT: case CHEAT_SHOWMAP: // SHOW ALL OF THE MAP TOGGLE; ud.showallmap = 1-ud.showallmap; - if(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; FTA(111,&ps[myconnectindex]); } 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; FTA(1,&ps[myconnectindex]); } @@ -7141,17 +7207,17 @@ FOUNDCHEAT: return; case CHEAT_MONSTERS: - { - char *s[] = { "ON", "OFF", "ON (BLOCKING)" }; + { + char *s[] = { "ON", "OFF", "ON (BLOCKING)" }; - actor_tog++; - if(actor_tog == 3) actor_tog = 0; - ps[screenpeek].cheat_phase = 0; - Bsprintf(fta_quotes[122],"MONSTERS: %s",s[actor_tog]); - FTA(122,&ps[myconnectindex]); - KB_FlushKeyBoardQueue(); - return; - } + actor_tog++; + if (actor_tog == 3) actor_tog = 0; + ps[screenpeek].cheat_phase = 0; + Bsprintf(fta_quotes[122],"MONSTERS: %s",s[actor_tog]); + FTA(122,&ps[myconnectindex]); + KB_FlushKeyBoardQueue(); + return; + } case CHEAT_RESERVED: case CHEAT_RESERVED3: ud.eog = 1; @@ -7164,17 +7230,17 @@ FOUNDCHEAT: } else { - if( KB_KeyPressed(cheatkey[0]) ) + if ( KB_KeyPressed(cheatkey[0]) ) { - if( ps[myconnectindex].cheat_phase >= 0 && numplayers < 2 && ud.recstat == 0) + if ( ps[myconnectindex].cheat_phase >= 0 && numplayers < 2 && ud.recstat == 0) ps[myconnectindex].cheat_phase = -1; } - if( KB_KeyPressed(cheatkey[1]) ) + if ( KB_KeyPressed(cheatkey[1]) ) { - if( ps[myconnectindex].cheat_phase == -1 ) + if ( ps[myconnectindex].cheat_phase == -1 ) { - if(ud.player_skill == 4) + if (ud.player_skill == 4) { FTA(22,&ps[myconnectindex]); ps[myconnectindex].cheat_phase = 0; @@ -7187,7 +7253,7 @@ FOUNDCHEAT: } KB_FlushKeyboardQueue(); } - else if(ps[myconnectindex].cheat_phase != 0) + else if (ps[myconnectindex].cheat_phase != 0) { ps[myconnectindex].cheat_phase = 0; KB_ClearKeyDown(cheatkey[0]); @@ -7202,22 +7268,22 @@ void nonsharedkeys(void) short i,ch; long j; - if(ud.recstat == 2) + if (ud.recstat == 2) { ControlInfo noshareinfo; CONTROL_GetInput( &noshareinfo ); } - if(gotvote[myconnectindex] == 0 && voting != -1 && voting != myconnectindex) + if (gotvote[myconnectindex] == 0 && voting != -1 && voting != myconnectindex) { - if(KB_KeyPressed(sc_F1) || KB_KeyPressed(sc_F2) || ud.autovote) + if (KB_KeyPressed(sc_F1) || KB_KeyPressed(sc_F2) || ud.autovote) { tempbuf[0] = 18; tempbuf[1] = 0; tempbuf[2] = myconnectindex; tempbuf[3] = (KB_KeyPressed(sc_F1) || ud.autovote?ud.autovote-1:0); - for(i=connecthead;i >= 0;i=connectpoint2[i]) + for (i=connecthead;i >= 0;i=connectpoint2[i]) { if (i != myconnectindex) sendpacket(i,tempbuf,4); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -7230,49 +7296,49 @@ void nonsharedkeys(void) } } - if( KB_KeyPressed( sc_F12 ) ) + if ( KB_KeyPressed( sc_F12 ) ) { KB_ClearKeyDown( sc_F12 ); screencapture("duke0000.tga",0); FTA(103,&ps[myconnectindex]); } - if( !ALT_IS_PRESSED && ud.overhead_on == 0 && (ps[myconnectindex].gm & MODE_TYPE) == 0) + if ( !ALT_IS_PRESSED && ud.overhead_on == 0 && (ps[myconnectindex].gm & MODE_TYPE) == 0) { - if( BUTTON( gamefunc_Enlarge_Screen ) ) + if ( BUTTON( gamefunc_Enlarge_Screen ) ) { CONTROL_ClearButton( gamefunc_Enlarge_Screen ); - if(ud.screen_size > 0) + if (ud.screen_size > 0) sound(THUD); - if(ud.screen_size == 8 && ud.statusbarmode == 0 && bpp > 8 && ud.statusbarscale != 100) + if (ud.screen_size == 8 && ud.statusbarmode == 0 && bpp > 8 && ud.statusbarscale != 100) ud.statusbarmode = 1; else ud.screen_size -= 4; vscrn(); } - if( BUTTON( gamefunc_Shrink_Screen ) ) + if ( BUTTON( gamefunc_Shrink_Screen ) ) { CONTROL_ClearButton( gamefunc_Shrink_Screen ); - if(ud.screen_size < 64) sound(THUD); - if(ud.screen_size == 4 && ud.statusbarscale == 100 && ud.statusbarmode == 1) + if (ud.screen_size < 64) sound(THUD); + if (ud.screen_size == 4 && ud.statusbarscale == 100 && ud.statusbarmode == 1) ud.statusbarmode = 0; - if(ud.screen_size == 8 && ud.statusbarmode == 1 && bpp > 8) + if (ud.screen_size == 8 && ud.statusbarmode == 1 && bpp > 8) ud.statusbarmode = 0; else ud.screen_size += 4; vscrn(); } } - if( ps[myconnectindex].cheat_phase == 1 || (ps[myconnectindex].gm&(MODE_MENU|MODE_TYPE))) return; + if ( ps[myconnectindex].cheat_phase == 1 || (ps[myconnectindex].gm&(MODE_MENU|MODE_TYPE))) return; - if( BUTTON(gamefunc_See_Coop_View) && ( GTFLAGS(GAMETYPE_FLAG_COOPVIEW) || ud.recstat == 2) ) + if ( BUTTON(gamefunc_See_Coop_View) && ( GTFLAGS(GAMETYPE_FLAG_COOPVIEW) || ud.recstat == 2) ) { CONTROL_ClearButton( gamefunc_See_Coop_View ); screenpeek = connectpoint2[screenpeek]; - if(screenpeek == -1) screenpeek = connecthead; + if (screenpeek == -1) screenpeek = connecthead; restorepalette = 1; } - if( ud.multimode > 1 && BUTTON(gamefunc_Show_Opponents_Weapon) ) + if ( ud.multimode > 1 && BUTTON(gamefunc_Show_Opponents_Weapon) ) { CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon); ud.showweapons = 1-ud.showweapons; @@ -7280,18 +7346,18 @@ void nonsharedkeys(void) FTA(82-ud.showweapons,&ps[screenpeek]); } - if( BUTTON(gamefunc_Toggle_Crosshair) ) + if ( BUTTON(gamefunc_Toggle_Crosshair) ) { CONTROL_ClearButton(gamefunc_Toggle_Crosshair); ud.crosshair = (ud.crosshair==3)?0:ud.crosshair+1; FTA(ud.crosshair?20:21,&ps[screenpeek]); } - if(ud.overhead_on && BUTTON(gamefunc_Map_Follow_Mode) ) + if (ud.overhead_on && BUTTON(gamefunc_Map_Follow_Mode) ) { CONTROL_ClearButton(gamefunc_Map_Follow_Mode); ud.scrollmode = 1-ud.scrollmode; - if(ud.scrollmode) + if (ud.scrollmode) { ud.folx = ps[screenpeek].oposx; ud.foly = ps[screenpeek].oposy; @@ -7300,31 +7366,31 @@ void nonsharedkeys(void) FTA(83+ud.scrollmode,&ps[myconnectindex]); } - if( SHIFTS_IS_PRESSED || ALT_IS_PRESSED ) + if ( SHIFTS_IS_PRESSED || ALT_IS_PRESSED ) { i = 0; - if( KB_KeyPressed( sc_F1) ) { KB_ClearKeyDown(sc_F1);i = 1; } - if( KB_KeyPressed( sc_F2) ) { KB_ClearKeyDown(sc_F2);i = 2; } - if( KB_KeyPressed( sc_F3) ) { KB_ClearKeyDown(sc_F3);i = 3; } - if( KB_KeyPressed( sc_F4) ) { KB_ClearKeyDown(sc_F4);i = 4; } - if( KB_KeyPressed( sc_F5) ) { KB_ClearKeyDown(sc_F5);i = 5; } - if( KB_KeyPressed( sc_F6) ) { KB_ClearKeyDown(sc_F6);i = 6; } - if( KB_KeyPressed( sc_F7) ) { KB_ClearKeyDown(sc_F7);i = 7; } - if( KB_KeyPressed( sc_F8) ) { KB_ClearKeyDown(sc_F8);i = 8; } - if( KB_KeyPressed( sc_F9) ) { KB_ClearKeyDown(sc_F9);i = 9; } - if( KB_KeyPressed( sc_F10) ) {KB_ClearKeyDown(sc_F10);i = 10; } + if ( KB_KeyPressed( sc_F1) ) { KB_ClearKeyDown(sc_F1);i = 1; } + if ( KB_KeyPressed( sc_F2) ) { KB_ClearKeyDown(sc_F2);i = 2; } + if ( KB_KeyPressed( sc_F3) ) { KB_ClearKeyDown(sc_F3);i = 3; } + if ( KB_KeyPressed( sc_F4) ) { KB_ClearKeyDown(sc_F4);i = 4; } + if ( KB_KeyPressed( sc_F5) ) { KB_ClearKeyDown(sc_F5);i = 5; } + if ( KB_KeyPressed( sc_F6) ) { KB_ClearKeyDown(sc_F6);i = 6; } + if ( KB_KeyPressed( sc_F7) ) { KB_ClearKeyDown(sc_F7);i = 7; } + if ( KB_KeyPressed( sc_F8) ) { KB_ClearKeyDown(sc_F8);i = 8; } + if ( KB_KeyPressed( sc_F9) ) { KB_ClearKeyDown(sc_F9);i = 9; } + if ( KB_KeyPressed( sc_F10) ) {KB_ClearKeyDown(sc_F10);i = 10; } - if(i) + if (i) { - if(SHIFTS_IS_PRESSED) + if (SHIFTS_IS_PRESSED) { - if(i == 5 && ps[myconnectindex].fta > 0 && ps[myconnectindex].ftq == 26) + if (i == 5 && ps[myconnectindex].fta > 0 && ps[myconnectindex].ftq == 26) { i = (VOLUMEALL?num_volumes*11:6); music_select++; - while(!music_fn[0][music_select][0] && music_select < i) + while (!music_fn[0][music_select][0] && music_select < i) music_select++; - if(music_select == i) + if (music_select == i) music_select = 0; Bsprintf(fta_quotes[26],"PLAYING %s",&music_fn[0][music_select][0]); FTA(26,&ps[myconnectindex]); @@ -7343,8 +7409,8 @@ void nonsharedkeys(void) i = 2+strlen(ud.ridecule[i-1]); - if(ud.multimode > 1) - for(ch=connecthead;ch>=0;ch=connectpoint2[ch]) + if (ud.multimode > 1) + for (ch=connecthead;ch>=0;ch=connectpoint2[ch]) { if (ch != myconnectindex) sendpacket(ch,tempbuf,i); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -7357,24 +7423,24 @@ void nonsharedkeys(void) } - if(ud.lockout == 0) - if(SoundToggle && ALT_IS_PRESSED && ( RTS_NumSounds() > 0 ) && rtsplaying == 0 && VoiceToggle ) + if (ud.lockout == 0) + if (SoundToggle && ALT_IS_PRESSED && ( RTS_NumSounds() > 0 ) && rtsplaying == 0 && VoiceToggle ) { rtsptr = (char *)RTS_GetSound (i-1); - if(*rtsptr == 'C') + if (*rtsptr == 'C') FX_PlayVOC3D( rtsptr,0,0,0,255,-i); else FX_PlayWAV3D( rtsptr,0,0,0,255,-i); rtsplaying = 7; - if(ud.multimode > 1) + if (ud.multimode > 1) { tempbuf[0] = 7; tempbuf[1] = i; - for(ch=connecthead;ch>=0;ch=connectpoint2[ch]) + for (ch=connecthead;ch>=0;ch=connectpoint2[ch]) { - if(ch != myconnectindex) sendpacket(ch,tempbuf,2); + if (ch != myconnectindex) sendpacket(ch,tempbuf,2); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master } } @@ -7387,10 +7453,10 @@ void nonsharedkeys(void) } } - if(!ALT_IS_PRESSED && !SHIFTS_IS_PRESSED) + if (!ALT_IS_PRESSED && !SHIFTS_IS_PRESSED) { - if( ud.multimode > 1 && BUTTON(gamefunc_SendMessage) ) + if ( ud.multimode > 1 && BUTTON(gamefunc_SendMessage) ) { KB_FlushKeyboardQueue(); CONTROL_ClearButton( gamefunc_SendMessage ); @@ -7399,7 +7465,7 @@ void nonsharedkeys(void) inputloc = 0; } - if( KB_KeyPressed(sc_F1) || ( ud.show_help && ( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) ) ) ) + if ( KB_KeyPressed(sc_F1) || ( ud.show_help && ( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) ) ) ) { KB_ClearKeyDown(sc_F1); KB_ClearKeyDown(sc_Space); @@ -7407,16 +7473,16 @@ void nonsharedkeys(void) KB_ClearKeyDown(sc_Enter); ud.show_help ++; - if( ud.show_help > 2 ) + if ( ud.show_help > 2 ) { ud.show_help = 0; - if(ud.multimode < 2 && ud.recstat != 2) ready2send = 1; + if (ud.multimode < 2 && ud.recstat != 2) ready2send = 1; vscrn(); } else { setview(0,0,xdim-1,ydim-1); - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 0; totalclock = ototalclock; @@ -7426,15 +7492,15 @@ void nonsharedkeys(void) // if(ud.multimode < 2) { - if(ud.recstat != 2 && KB_KeyPressed( sc_F2 ) ) + if (ud.recstat != 2 && KB_KeyPressed( sc_F2 ) ) { KB_ClearKeyDown( sc_F2 ); - if(movesperpacket == 4 && connecthead != myconnectindex) + if (movesperpacket == 4 && connecthead != myconnectindex) return; FAKE_F2: - if(sprite[ps[myconnectindex].i].extra <= 0) + if (sprite[ps[myconnectindex].i].extra <= 0) { FTA(118,&ps[myconnectindex]); return; @@ -7450,7 +7516,7 @@ FAKE_F2: // setview(0,0,xdim-1,ydim-1); ps[myconnectindex].gm |= MODE_MENU; - if(ud.multimode < 2) + if (ud.multimode < 2) { ready2send = 0; totalclock = ototalclock; @@ -7458,11 +7524,11 @@ FAKE_F2: } } - if(KB_KeyPressed( sc_F3 )) + if (KB_KeyPressed( sc_F3 )) { KB_ClearKeyDown( sc_F3 ); - if(movesperpacket == 4 && connecthead != myconnectindex) + if (movesperpacket == 4 && connecthead != myconnectindex) return; FAKE_F3: cmenu(300); @@ -7471,7 +7537,7 @@ FAKE_F3: // setview(0,0,xdim-1,ydim-1); ps[myconnectindex].gm |= MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 0; totalclock = ototalclock; @@ -7480,14 +7546,14 @@ FAKE_F3: } } - if(KB_KeyPressed( sc_F4 ) && FXDevice >= 0 ) + if (KB_KeyPressed( sc_F4 ) && FXDevice >= 0 ) { KB_ClearKeyDown( sc_F4 ); FX_StopAllSounds(); clearsoundlocks(); ps[myconnectindex].gm |= MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 0; totalclock = ototalclock; @@ -7496,18 +7562,18 @@ FAKE_F3: } - if( KB_KeyPressed( sc_F6 ) && (ps[myconnectindex].gm&MODE_GAME)) + if ( KB_KeyPressed( sc_F6 ) && (ps[myconnectindex].gm&MODE_GAME)) { KB_ClearKeyDown( sc_F6 ); - if(movesperpacket == 4 && connecthead != myconnectindex) + if (movesperpacket == 4 && connecthead != myconnectindex) return; - if(lastsavedpos == -1) goto FAKE_F2; + if (lastsavedpos == -1) goto FAKE_F2; KB_FlushKeyboardQueue(); - if(sprite[ps[myconnectindex].i].extra <= 0) + if (sprite[ps[myconnectindex].i].extra <= 0) { FTA(118,&ps[myconnectindex]); return; @@ -7516,21 +7582,21 @@ FAKE_F3: displayrooms(myconnectindex,65536); //savetemp("duke3d.tmp",waloff[TILE_SAVESHOT],160*100); screencapt = 0; - if( lastsavedpos >= 0 ) + if ( lastsavedpos >= 0 ) { /* inputloc = Bstrlen(&ud.savegame[lastsavedpos][0]); current_menu = 360+lastsavedpos; probey = lastsavedpos; */ - if(ud.multimode > 1) + if (ud.multimode > 1) saveplayer(-1-(lastsavedpos)); else saveplayer(lastsavedpos); } } - if(KB_KeyPressed( sc_F7 ) ) + if (KB_KeyPressed( sc_F7 ) ) { KB_ClearKeyDown(sc_F7); - if( ps[myconnectindex].over_shoulder_on ) + if ( ps[myconnectindex].over_shoulder_on ) ps[myconnectindex].over_shoulder_on = 0; else { @@ -7541,7 +7607,7 @@ FAKE_F3: FTA(109+ps[myconnectindex].over_shoulder_on,&ps[myconnectindex]); } - if( KB_KeyPressed( sc_F5 ) && MusicDevice >= 0 ) + if ( KB_KeyPressed( sc_F5 ) && MusicDevice >= 0 ) { KB_ClearKeyDown( sc_F5 ); Bstrcpy(fta_quotes[26],&music_fn[0][music_select][0]); @@ -7549,11 +7615,11 @@ FAKE_F3: FTA(26,&ps[myconnectindex]); } - if(KB_KeyPressed( sc_F8 )) + if (KB_KeyPressed( sc_F8 )) { KB_ClearKeyDown( sc_F8 ); ud.fta_on = !ud.fta_on; - if(ud.fta_on) FTA(23,&ps[myconnectindex]); + if (ud.fta_on) FTA(23,&ps[myconnectindex]); else { ud.fta_on = 1; @@ -7562,22 +7628,22 @@ FAKE_F3: } } - if(KB_KeyPressed( sc_F9 ) && (ps[myconnectindex].gm&MODE_GAME) ) + if (KB_KeyPressed( sc_F9 ) && (ps[myconnectindex].gm&MODE_GAME) ) { KB_ClearKeyDown( sc_F9 ); - if(movesperpacket == 4 && myconnectindex != connecthead) + if (movesperpacket == 4 && myconnectindex != connecthead) return; - if(lastsavedpos == -1) goto FAKE_F3; + if (lastsavedpos == -1) goto FAKE_F3; - if( lastsavedpos >= 0 ) + if ( lastsavedpos >= 0 ) { KB_FlushKeyboardQueue(); KB_ClearKeysDown(); FX_StopAllSounds(); - if(ud.multimode > 1) + if (ud.multimode > 1) { loadplayer(-1-lastsavedpos); ps[myconnectindex].gm = MODE_GAME; @@ -7585,27 +7651,27 @@ FAKE_F3: else { i = loadplayer(lastsavedpos); - if(i == 0) + if (i == 0) ps[myconnectindex].gm = MODE_GAME; } } } - if(KB_KeyPressed( sc_F10 )) + if (KB_KeyPressed( sc_F10 )) { KB_ClearKeyDown( sc_F10 ); cmenu(500); FX_StopAllSounds(); clearsoundlocks(); ps[myconnectindex].gm |= MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 0; totalclock = ototalclock; } } - if( ud.overhead_on != 0) + if ( ud.overhead_on != 0) { j = totalclock-nonsharedtimer; nonsharedtimer += j; @@ -7614,15 +7680,15 @@ FAKE_F3: if ( BUTTON( gamefunc_Shrink_Screen ) ) ps[myconnectindex].zoom -= mulscale6(j,max(ps[myconnectindex].zoom,256)); - if( (ps[myconnectindex].zoom > 2048) ) + if ( (ps[myconnectindex].zoom > 2048) ) ps[myconnectindex].zoom = 2048; - if( (ps[myconnectindex].zoom < 48) ) + if ( (ps[myconnectindex].zoom < 48) ) ps[myconnectindex].zoom = 48; } } - if( KB_KeyPressed(sc_Escape) && ud.overhead_on && ps[myconnectindex].newowner == -1 ) + if ( KB_KeyPressed(sc_Escape) && ud.overhead_on && ps[myconnectindex].newowner == -1 ) { KB_ClearKeyDown( sc_Escape ); ud.last_overhead = ud.overhead_on; @@ -7631,7 +7697,7 @@ FAKE_F3: vscrn(); } - if( BUTTON(gamefunc_AutoRun) ) + if ( BUTTON(gamefunc_AutoRun) ) { CONTROL_ClearButton(gamefunc_AutoRun); ud.auto_run = 1-ud.auto_run; @@ -7639,10 +7705,10 @@ FAKE_F3: FTA(85+ud.auto_run,&ps[myconnectindex]); } - if( BUTTON(gamefunc_Map) ) + if ( BUTTON(gamefunc_Map) ) { CONTROL_ClearButton( gamefunc_Map ); - if( ud.last_overhead != ud.overhead_on && ud.last_overhead) + if ( ud.last_overhead != ud.overhead_on && ud.last_overhead) { ud.overhead_on = ud.last_overhead; ud.last_overhead = 0; @@ -7650,27 +7716,27 @@ FAKE_F3: else { ud.overhead_on++; - if(ud.overhead_on == 3 ) ud.overhead_on = 0; + if (ud.overhead_on == 3 ) ud.overhead_on = 0; ud.last_overhead = ud.overhead_on; } restorepalette = 1; vscrn(); } - if(KB_KeyPressed( sc_F11 )) + if (KB_KeyPressed( sc_F11 )) { KB_ClearKeyDown( sc_F11 ); - if(SHIFTS_IS_PRESSED) ud.brightness-=4; + if (SHIFTS_IS_PRESSED) ud.brightness-=4; else ud.brightness+=4; if (ud.brightness > (7<<2) ) ud.brightness = 0; - else if(ud.brightness < 0) + else if (ud.brightness < 0) ud.brightness = (7<<2); setbrightness(ud.brightness>>2,&ps[myconnectindex].palette[0],0); - if(ud.brightness < 20) FTA( 29 + (ud.brightness>>2) ,&ps[myconnectindex]); - else if(ud.brightness < 40) FTA( 96 + (ud.brightness>>2) - 5,&ps[myconnectindex]); + if (ud.brightness < 20) FTA( 29 + (ud.brightness>>2) ,&ps[myconnectindex]); + else if (ud.brightness < 40) FTA( 96 + (ud.brightness>>2) - 5,&ps[myconnectindex]); } } @@ -7738,33 +7804,33 @@ int load_rancid_net(char *fn) cmdtokptr = script->ltextptr; switch (tokn) { case T_INTERFACE: - { - char *ip; + { + char *ip; - if (scriptfile_getstring(script,&ip)) break; - Bstrcpy(rancid_ip_strings[MAXPLAYERS],ip); - Bstrcpy(rancid_ip_strings[rancid_players++],ip); - strtok(ip,":"); - Bsprintf(tempbuf,"%s",strtok(NULL,":")); - if(atoi(tempbuf) > 1024) - Bsprintf(rancid_local_port_string,"-p %s",tempbuf); - } - break; + if (scriptfile_getstring(script,&ip)) break; + Bstrcpy(rancid_ip_strings[MAXPLAYERS],ip); + Bstrcpy(rancid_ip_strings[rancid_players++],ip); + strtok(ip,":"); + Bsprintf(tempbuf,"%s",strtok(NULL,":")); + if (atoi(tempbuf) > 1024) + Bsprintf(rancid_local_port_string,"-p %s",tempbuf); + } + break; case T_MODE: - { - char *mode; + { + char *mode; - if (scriptfile_getstring(script,&mode)) break; - } - break; + if (scriptfile_getstring(script,&mode)) break; + } + break; case T_ALLOW: - { - char *ip; + { + char *ip; - if (scriptfile_getstring(script,&ip)) break; - Bstrcpy(rancid_ip_strings[rancid_players++],ip); - } - break; + if (scriptfile_getstring(script,&ip)) break; + Bstrcpy(rancid_ip_strings[rancid_players++],ip); + } + break; case T_EOF: return(0); default: @@ -7802,19 +7868,19 @@ int loadgroupfiles(char *fn) cmdtokptr = script->ltextptr; switch (tokn) { case T_LOADGRP: + { + char *fn; + if (!scriptfile_getstring(script,&fn)) { - char *fn; - if (!scriptfile_getstring(script,&fn)) - { - int j = initgroupfile(fn); + int j = initgroupfile(fn); - if( j == -1 ) - initprintf("Could not find GRP file %s.\n",fn); - else - initprintf("Using GRP file %s.\n",fn); - } + if ( j == -1 ) + initprintf("Could not find GRP file %s.\n",fn); + else + initprintf("Using GRP file %s.\n",fn); } - break; + } + break; case T_EOF: return(0); default: @@ -7855,11 +7921,11 @@ void checkcommandline(int argc,char **argv) ud.wchoice[0][8] = 9; ud.wchoice[0][9] = 1; - if(argc > 1) + if (argc > 1) { int keepaddr = 0; - while(i < argc) + while (i < argc) { c = argv[i]; if (((*c == '/') || (*c == '-')) && (!firstnet)) @@ -7896,49 +7962,49 @@ void checkcommandline(int argc,char **argv) CommandNet = argv[i+1]; i++; } - if(CommandNet) + if (CommandNet) { - if(load_rancid_net(CommandNet) != -1) + if (load_rancid_net(CommandNet) != -1) { char tmp[32]; CommandNet = 0; - if(keepaddr == 0) + if (keepaddr == 0) { - for(j=0;j 120 && totalclock < (120+60) ) + if ( totalclock > 120 && totalclock < (120+60) ) { - if(soundanm == 0) + if (soundanm == 0) { soundanm = 1; sound(PIPEBOMB_EXPLODE); } rotatesprite(160<<16,104<<16,(totalclock-120)<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); } - else if( totalclock >= (120+60) ) + else if ( totalclock >= (120+60) ) rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); } else soundanm = 1; if (logoflags & LOGO_FLAG_THREEDEE) { - if( totalclock > 220 && totalclock < (220+30) ) + if ( totalclock > 220 && totalclock < (220+30) ) { - if( soundanm == 1) + if ( soundanm == 1) { soundanm = 2; sound(PIPEBOMB_EXPLODE); @@ -8421,22 +8489,22 @@ void Logo(void) rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); rotatesprite(160<<16,(129)<<16,(totalclock - 220 )<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1); } - else if( totalclock >= (220+30) ) + else if ( totalclock >= (220+30) ) rotatesprite(160<<16,(129)<<16,30<<11,0,THREEDEE,0,0,2+8,0,0,xdim-1,ydim-1); } else soundanm = 2; if (PLUTOPAK && (logoflags & LOGO_FLAG_PLUTOPAKSPRITE)) { // JBF 20030804 - if( totalclock >= 280 && totalclock < 395 ) + if ( totalclock >= 280 && totalclock < 395 ) { rotatesprite(160<<16,(151)<<16,(410-totalclock)<<12,0,PLUTOPAKSPRITE+1,0,0,2+8,0,0,xdim-1,ydim-1); - if(soundanm == 2) + if (soundanm == 2) { soundanm = 3; sound(FLY_BY); } } - else if( totalclock >= 395 ) + else if ( totalclock >= 395 ) { - if(soundanm == 3) + if (soundanm == 3) { soundanm = 4; sound(PIPEBOMB_EXPLODE); @@ -8453,7 +8521,7 @@ void Logo(void) KB_ClearKeysDown(); // JBF } - if(ud.multimode > 1) + if (ud.multimode > 1) { setgamepalette(&ps[myconnectindex], titlepal, 3); rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1); @@ -8487,7 +8555,7 @@ void loadtmb(void) long fil, l; fil = kopen4load("d3dtimbr.tmb",0); - if(fil == -1) return; + if (fil == -1) return; l = kfilelength(fil); kread(fil,(char *)tmb,l); MUSIC_RegisterTimbreBank(tmb); @@ -8498,27 +8566,27 @@ void freeconmem(void) { int i; - for(i=0;i 10) + while (Bstrlen(strip_color_codes(tempbuf)) > 10) tempbuf[Bstrlen(tempbuf)-1] = '\0'; Bstrncpy(myname,tempbuf,sizeof(myname)-1); @@ -8691,7 +8759,7 @@ void Startup(void) if (VOLUMEONE) { initprintf("*** You have run Duke Nukem 3D %ld times. ***\n\n",ud.executions); - if(ud.executions >= 50) initprintf("IT IS NOW TIME TO UPGRADE TO THE COMPLETE VERSION!!!\n"); + if (ud.executions >= 50) initprintf("IT IS NOW TIME TO UPGRADE TO THE COMPLETE VERSION!!!\n"); } if (CONTROL_Startup( 1, &GetTime, TICRATE )) { @@ -8723,9 +8791,9 @@ void Startup(void) tilesizx[MIRROR] = tilesizy[MIRROR] = 0; - for(i=0;i 1) + if (numplayers > 1) initprintf("Multiplayer initialized.\n"); screenpeek = myconnectindex; ps[myconnectindex].palette = (char *) &palette[0]; - if(networkmode == 255) + if (networkmode == 255) networkmode = 1; getnames(); @@ -8760,7 +8828,7 @@ void Startup(void) void sendscore(char *s) { - if(numplayers > 1) + if (numplayers > 1) genericmultifunction(-1,s,strlen(s)+1,5); } @@ -8774,10 +8842,10 @@ void syncnames(void) l = 3; //null terminated player name to send - for(i=0;myname[i];i++) buf[l++] = Btoupper(myname[i]); + for (i=0;myname[i];i++) buf[l++] = Btoupper(myname[i]); buf[l++] = 0; - for(i=0;i<10;i++) + for (i=0;i<10;i++) { ud.wchoice[myconnectindex][i] = ud.wchoice[0][i]; buf[l++] = (char)ud.wchoice[0][i]; @@ -8790,7 +8858,7 @@ void syncnames(void) buf[l++] = ud.pteam[myconnectindex] = ud.team; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { if (i != myconnectindex) sendpacket(i,&buf[0],l); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -8799,7 +8867,7 @@ void syncnames(void) void sendboardname(void) { - if(ud.multimode > 1) + if (ud.multimode > 1) { int j; int ch; @@ -8811,7 +8879,7 @@ void sendboardname(void) boardfilename[j] = 0; Bstrcat(tempbuf+1,boardfilename); - for(ch=connecthead;ch >= 0;ch=connectpoint2[ch]) + for (ch=connecthead;ch >= 0;ch=connectpoint2[ch]) { if (ch != myconnectindex) sendpacket(ch,tempbuf,j+1); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -8823,10 +8891,10 @@ void getnames(void) { int l; - for(l=0;(unsigned)l 1) + if (numplayers > 1) { syncnames(); sendboardname(); @@ -8835,7 +8903,7 @@ void getnames(void) waitforeverybody(); } - if(cp == 1 && numplayers < 2) + if (cp == 1 && numplayers < 2) gameexit("Please put the Duke Nukem 3D Atomic Edition CD in the CD-ROM drive."); } @@ -8843,16 +8911,16 @@ void updatenames(void) { int l; - if(ud.recstat != 0) + if (ud.recstat != 0) return; - for(l=0;(unsigned)l 1) + if (ud.multimode > 1) { syncnames(); - if(sprite[ps[myconnectindex].i].picnum == APLAYER && sprite[ps[myconnectindex].i].pal != 1) + if (sprite[ps[myconnectindex].i].picnum == APLAYER && sprite[ps[myconnectindex].i].pal != 1) sprite[ps[myconnectindex].i].pal = ud.pcolor[myconnectindex]; } else @@ -8866,7 +8934,7 @@ void updatenames(void) j = ps[myconnectindex].team; ud.pteam[myconnectindex] = ud.team; - if(sprite[ps[myconnectindex].i].picnum == APLAYER && sprite[ps[myconnectindex].i].pal != 1) + if (sprite[ps[myconnectindex].i].picnum == APLAYER && sprite[ps[myconnectindex].i].pal != 1) sprite[ps[myconnectindex].i].pal = ud.pcolor[myconnectindex]; } } @@ -8897,7 +8965,7 @@ void copyprotect(void) #endif if (VOLUMEONE) return; - if( testcd(IDFILENAME, IDFSIZE) ) + if ( testcd(IDFILENAME, IDFSIZE) ) { cp = 1; return; @@ -8920,11 +8988,11 @@ int load_script(char *szScript) { FILE* fp = fopenfrompath(szScript, "r"); - if(fp != NULL) + if (fp != NULL) { char line[255]; OSD_Printf("Executing \"%s\"\n", szScript); - while(fgets(line ,sizeof(line)-1, fp) != NULL) + while (fgets(line ,sizeof(line)-1, fp) != NULL) OSD_Dispatch(strtok(line,"\r\n")); fclose(fp); return 0; @@ -9015,7 +9083,7 @@ void app_main(int argc,char **argv) i = CONFIG_ReadSetup(); if (getenv("DUKE3DGRP")) duke3dgrp = getenv("DUKE3DGRP"); - if(glusetexcache == -1 || glusetexcachecompression == -1) + if (glusetexcache == -1 || glusetexcachecompression == -1) { i=wm_ynbox("Texture caching", "Would you like to enable the on-disk texture cache? " @@ -9024,7 +9092,7 @@ void app_main(int argc,char **argv) "textures and skins, but textures will load dramatically " "faster after the first time they are loaded."); if (i) i = 'y'; - if(i == 'y' || i == 'Y' ) + if (i == 'y' || i == 'Y' ) useprecache = glusetexcompr = glusetexcache = glusetexcachecompression = 1; else glusetexcache = glusetexcachecompression = 0; } @@ -9092,7 +9160,7 @@ void app_main(int argc,char **argv) while (CommandGrps) { s = CommandGrps->next; j = initgroupfile(CommandGrps->str); - if( j == -1 ) initprintf("Warning: could not find group file %s.\n",CommandGrps->str); + if ( j == -1 ) initprintf("Warning: could not find group file %s.\n",CommandGrps->str); else { groupfile = j; initprintf("Using group file %s.\n",CommandGrps->str); @@ -9133,7 +9201,7 @@ void app_main(int argc,char **argv) { i = 1; - for(j=numplayers;j 1) + if (numplayers > 1) { ud.multimode = numplayers; sendlogon(); } - else if(boardfilename[0] != 0) + else if (boardfilename[0] != 0) { ud.m_level_number = 7; ud.m_volume_number = 0; @@ -9160,11 +9228,11 @@ void app_main(int argc,char **argv) getnames(); - if(ud.multimode > 1) + if (ud.multimode > 1) { playerswhenstarted = ud.multimode; - if(ud.warp_on == 0) + if (ud.warp_on == 0) { ud.m_monsters_off = 1; ud.m_player_skill = 0; @@ -9174,9 +9242,9 @@ void app_main(int argc,char **argv) ud.last_level = -1; RTS_Init(ud.rtsname); - if(numlumps) initprintf("Using .RTS file: %s\n",ud.rtsname); + if (numlumps) initprintf("Using .RTS file: %s\n",ud.rtsname); - if( setgamemode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP) < 0 ) + if ( setgamemode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP) < 0 ) { int i = 0; int xres[] = {800,640,320}; @@ -9187,12 +9255,12 @@ void app_main(int argc,char **argv) ScreenWidth,ScreenHeight,ScreenBPP,ScreenMode?"fullscreen":"windowed"); #if defined(POLYMOST) && defined(USE_OPENGL) - while(setgamemode(0,xres[i],yres[i],bpp[i]) < 0) { + while (setgamemode(0,xres[i],yres[i],bpp[i]) < 0) { initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],bpp[i]); i++; } #else - while(setgamemode(0,xres[i],yres[i],8) < 0) { + while (setgamemode(0,xres[i],yres[i],8) < 0) { initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],8); i++; } @@ -9224,7 +9292,7 @@ void app_main(int argc,char **argv) loadtmb(); if (VOLUMEONE) { - if(numplayers > 4 || ud.multimode > 4) + if (numplayers > 4 || ud.multimode > 4) gameexit(" The full version of Duke Nukem 3D supports 5 or more players."); } @@ -9237,7 +9305,7 @@ void app_main(int argc,char **argv) load_script("autoexec.cfg"); - if(ud.warp_on > 1 && ud.multimode < 2) + if (ud.warp_on > 1 && ud.multimode < 2) { clearview(0L); //ps[myconnectindex].palette = palette; @@ -9248,7 +9316,7 @@ void app_main(int argc,char **argv) nextpage(); j = loadplayer(ud.warp_on-2); - if(j) + if (j) ud.warp_on = 0; } @@ -9256,9 +9324,9 @@ void app_main(int argc,char **argv) MAIN_LOOP_RESTART: - if(ud.warp_on == 0) + if (ud.warp_on == 0) Logo(); - else if(ud.warp_on == 1) + else if (ud.warp_on == 1) { newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill); @@ -9279,7 +9347,7 @@ MAIN_LOOP_RESTART: } else if(ud.warp_on != 0) vscrn(); */ - if( ud.warp_on == 0 && playback() ) + if ( ud.warp_on == 0 && playback() ) { FX_StopAllSounds(); clearsoundlocks(); @@ -9294,18 +9362,20 @@ MAIN_LOOP_RESTART: ps[myconnectindex].weaponswitch = ud.weaponswitch; ud.pteam[myconnectindex] = ud.team; - if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) + if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) { int k = 0; - switch(ud.pteam[myconnectindex]) + switch (ud.pteam[myconnectindex]) { - case 0: k = 3; break; - case 1: k = 21; break; + case 0: + k = 3; break; + case 1: + k = 21; break; } ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = k; } else { - if(ud.color) ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; + if (ud.color) ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; else ps[myconnectindex].palookup = ud.pcolor[myconnectindex]; } @@ -9325,19 +9395,19 @@ MAIN_LOOP_RESTART: OSD_DispatchQueued(); - if( ud.recstat == 2 || ud.multimode > 1 || ( ud.show_help == 0 && (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU ) ) - if( ps[myconnectindex].gm&MODE_GAME ) - if( moveloop() ) continue; + if ( ud.recstat == 2 || ud.multimode > 1 || ( ud.show_help == 0 && (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU ) ) + if ( ps[myconnectindex].gm&MODE_GAME ) + if ( moveloop() ) continue; - if( ps[myconnectindex].gm&MODE_EOL || ps[myconnectindex].gm&MODE_RESTART ) + if ( ps[myconnectindex].gm&MODE_EOL || ps[myconnectindex].gm&MODE_RESTART ) { - if( ps[myconnectindex].gm&MODE_EOL) + if ( ps[myconnectindex].gm&MODE_EOL) { closedemowrite(); ready2send = 0; - if(display_bonus_screen == 1) + if (display_bonus_screen == 1) { i = ud.screen_size; ud.screen_size = 0; @@ -9345,10 +9415,10 @@ MAIN_LOOP_RESTART: ud.screen_size = i; dobonus(0); } - if(ud.eog) + if (ud.eog) { ud.eog = 0; - if(ud.multimode < 2) + if (ud.multimode < 2) { if (!VOLUMEALL) { doorders(); @@ -9367,7 +9437,7 @@ MAIN_LOOP_RESTART: } display_bonus_screen = 1; ready2send = 0; - if(numplayers > 1) ps[myconnectindex].gm = MODE_GAME; + if (numplayers > 1) ps[myconnectindex].gm = MODE_GAME; if (enterlevel(ps[myconnectindex].gm)) { backtomenu(); goto MAIN_LOOP_RESTART; @@ -9378,7 +9448,7 @@ MAIN_LOOP_RESTART: cheats(); nonsharedkeys(); - if( (ud.show_help == 0 && ud.multimode < 2 && !(ps[myconnectindex].gm&MODE_MENU) ) || ud.multimode > 1 || ud.recstat == 2) + if ( (ud.show_help == 0 && ud.multimode < 2 && !(ps[myconnectindex].gm&MODE_MENU) ) || ud.multimode > 1 || ud.recstat == 2) i = min(max((totalclock-ototalclock)*(65536L/TICSPERFRAME),0),65536); else i = 65536; @@ -9386,7 +9456,7 @@ MAIN_LOOP_RESTART: displayrooms(screenpeek,i); displayrest(i); - if(gotvote[myconnectindex] == 0 && voting != -1 && voting != myconnectindex) + if (gotvote[myconnectindex] == 0 && voting != -1 && voting != myconnectindex) { Bsprintf(tempbuf,"%s HAS CALLED A VOTE FOR MAP",ud.user_name[voting]); gametext(160,40,tempbuf,0,2+8+16); @@ -9401,15 +9471,15 @@ MAIN_LOOP_RESTART: // addplayer(); // } - if(ps[myconnectindex].gm&MODE_DEMO) + if (ps[myconnectindex].gm&MODE_DEMO) goto MAIN_LOOP_RESTART; - if(debug_on) caches(); + if (debug_on) caches(); checksync(); if (VOLUMEONE) { - if(ud.show_help == 0 && show_shareware > 0 && (ps[myconnectindex].gm&MODE_MENU) == 0 ) + if (ud.show_help == 0 && show_shareware > 0 && (ps[myconnectindex].gm&MODE_MENU) == 0 ) rotatesprite((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128,0,0,xdim-1,ydim-1); } @@ -9432,14 +9502,14 @@ char opendemoread(char which_demo) // 0 = mine Bstrcpy(d, "demo_.dmo"); - if(which_demo == 10) + if (which_demo == 10) d[4] = 'x'; else d[4] = '0' + which_demo; ud.reccnt = 0; - if(which_demo == 1 && firstdemofile[0] != 0) + if (which_demo == 1 && firstdemofile[0] != 0) { if ((recfilep = kopen4load(firstdemofile,loadfromgrouponly)) == -1) return(0); } @@ -9449,7 +9519,7 @@ char opendemoread(char which_demo) // 0 = mine if (kread(recfilep,&ud.reccnt,sizeof(long)) != sizeof(long)) goto corrupt; if (kread(recfilep,&ver,sizeof(char)) != sizeof(char)) goto corrupt; - if(ver != BYTEVERSION /*&& ver != 116 && ver != 117*/) { /* old demo playback */ + if (ver != BYTEVERSION /*&& ver != 116 && ver != 117*/) { /* old demo playback */ if (ver == BYTEVERSION_JF) initprintf("Demo %s is for Regular edition.\n", d); else if (ver == BYTEVERSION_JF+1) initprintf("Demo %s is for Atomic edition.\n", d); else if (ver == BYTEVERSION_JF+2) initprintf("Demo %s is for Shareware version.\n", d); @@ -9489,17 +9559,17 @@ char opendemoread(char which_demo) // 0 = mine OSD_Printf("ud.user_name: %s\n",ud.user_name); if (kread(recfilep,(int32 *)&i,sizeof(int32)) != sizeof(int32)) goto corrupt; - if(ver == BYTEVERSION) { + if (ver == BYTEVERSION) { if (kread(recfilep,(char *)boardfilename,sizeof(boardfilename)) != sizeof(boardfilename)) goto corrupt; } else if (kread(recfilep,(char *)boardfilename,128) != 128) goto corrupt; - if( boardfilename[0] != 0 ) + if ( boardfilename[0] != 0 ) { ud.m_level_number = 7; ud.m_volume_number = 0; } - for(i=0;i=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { copybufbyte(&sync[i],&recsync[ud.reccnt],sizeof(input)); ud.reccnt++; @@ -9623,7 +9693,7 @@ long playback(void) long i,j,k,l; char foundemo; - if( ready2send ) return 0; + if ( ready2send ) return 0; foundemo = 0; @@ -9636,11 +9706,11 @@ RECHECK: flushperms(); - if(numplayers < 2) foundemo = opendemoread(which_demo); + if (numplayers < 2) foundemo = opendemoread(which_demo); - if(foundemo == 0) + if (foundemo == 0) { - if(which_demo > 1) + if (which_demo > 1) { which_demo = 1; goto RECHECK; @@ -9658,11 +9728,11 @@ RECHECK: { ud.recstat = 2; which_demo++; - if(which_demo == 10) which_demo = 1; + if (which_demo == 10) which_demo = 1; if (enterlevel(MODE_DEMO)) return 1; } - if(foundemo == 0 || in_menu || KB_KeyWaiting() || numplayers > 1) + if (foundemo == 0 || in_menu || KB_KeyWaiting() || numplayers > 1) { FX_StopAllSounds(); clearsoundlocks(); @@ -9678,7 +9748,7 @@ RECHECK: while (ud.reccnt > 0 || foundemo == 0) { - if(foundemo) while ( totalclock >= (lockclock+TICSPERFRAME) ) + if (foundemo) while ( totalclock >= (lockclock+TICSPERFRAME) ) { if (demo_version != BYTEVERSION) { @@ -9697,7 +9767,7 @@ RECHECK: OSD_Printf("ud.reccnt: %d\n",ud.reccnt); } - for(j=connecthead;j>=0;j=connectpoint2[j]) + for (j=connecthead;j>=0;j=connectpoint2[j]) { OSD_Printf("ud.reccnt: %d, a:%d, h:%d, s:%d, f:%d, b:%d\n",ud.reccnt,oldrecsync[i].avel,oldrecsync[i].horz,oldrecsync[i].svel,oldrecsync[i].fvel,oldrecsync[i].bits); clearbufbyte(&inputfifo[movefifoend[j]&(MOVEFIFOSIZ-1)][j],sizeof(input),0L); @@ -9723,7 +9793,7 @@ RECHECK: } } - for(j=connecthead;j>=0;j=connectpoint2[j]) + for (j=connecthead;j>=0;j=connectpoint2[j]) { copybufbyte(&recsync[i],&inputfifo[movefifoend[j]&(MOVEFIFOSIZ-1)][j],sizeof(input)); movefifoend[j]++; @@ -9734,7 +9804,7 @@ RECHECK: domovethings(); } - if(foundemo == 0) + if (foundemo == 0) drawbackground(); else { @@ -9744,14 +9814,14 @@ RECHECK: displayrooms(screenpeek,j); displayrest(j); - if(ud.multimode > 1 && ps[myconnectindex].gm ) + if (ud.multimode > 1 && ps[myconnectindex].gm ) getpackets(); - if(gotvote[myconnectindex] == 0 && voting != -1 && voting != myconnectindex) + if (gotvote[myconnectindex] == 0 && voting != -1 && voting != myconnectindex) gametext(160,60,"PRESS F1 TO VOTE YES, F2 TO VOTE NO",0,2+8+16); } - if( (ps[myconnectindex].gm&MODE_MENU) && (ps[myconnectindex].gm&MODE_EOL) ) + if ( (ps[myconnectindex].gm&MODE_MENU) && (ps[myconnectindex].gm&MODE_EOL) ) goto RECHECK; if (KB_KeyPressed(sc_Escape) && (ps[myconnectindex].gm&MODE_MENU) == 0 && (ps[myconnectindex].gm&MODE_TYPE) == 0) @@ -9764,21 +9834,21 @@ RECHECK: intomenusounds(); } - if(ps[myconnectindex].gm&MODE_TYPE) + if (ps[myconnectindex].gm&MODE_TYPE) { typemode(); - if((ps[myconnectindex].gm&MODE_TYPE) != MODE_TYPE) + if ((ps[myconnectindex].gm&MODE_TYPE) != MODE_TYPE) ps[myconnectindex].gm = MODE_MENU; } else { - if(ud.recstat != 2) + if (ud.recstat != 2) menus(); - if( ud.multimode > 1 && current_menu != 20003 && current_menu != 20005 && current_menu != 210) + if ( ud.multimode > 1 && current_menu != 20003 && current_menu != 20005 && current_menu != 210) { ControlInfo noshareinfo; CONTROL_GetInput( &noshareinfo ); - if( BUTTON(gamefunc_SendMessage) ) + if ( BUTTON(gamefunc_SendMessage) ) { KB_FlushKeyboardQueue(); CONTROL_ClearButton( gamefunc_SendMessage ); @@ -9791,23 +9861,23 @@ RECHECK: operatefta(); - if(ud.last_camsprite != ud.camerasprite) + if (ud.last_camsprite != ud.camerasprite) { ud.last_camsprite = ud.camerasprite; ud.camera_time = totalclock+(TICRATE*2); } if (VOLUMEONE) { - if( ud.show_help == 0 && (ps[myconnectindex].gm&MODE_MENU) == 0 ) + if ( ud.show_help == 0 && (ps[myconnectindex].gm&MODE_MENU) == 0 ) rotatesprite((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128,0,0,xdim-1,ydim-1); } handleevents(); getpackets(); nextpage(); - if( ps[myconnectindex].gm==MODE_END || ps[myconnectindex].gm==MODE_GAME ) + if ( ps[myconnectindex].gm==MODE_END || ps[myconnectindex].gm==MODE_GAME ) { - if(foundemo) + if (foundemo) kclose(recfilep); return 0; } @@ -9828,7 +9898,7 @@ RECHECK: } #endif - if(ps[myconnectindex].gm&MODE_MENU) goto RECHECK; + if (ps[myconnectindex].gm&MODE_MENU) goto RECHECK; return 1; } @@ -9844,10 +9914,10 @@ char moveloop() if (numplayers < 2) bufferjitter = 0; while (movefifoend[myconnectindex]-movefifoplc > bufferjitter) { - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (movefifoplc == movefifoend[i]) break; if (i >= 0) break; - if( domovethings() ) return 1; + if ( domovethings() ) return 1; } return 0; } @@ -9908,7 +9978,7 @@ void fakedomovethings(void) shrunk = (sprite[p->i].yrepeat < 32); - if( ud.clipping == 0 && ( sector[psect].floorpicnum == MIRROR || psect < 0 || psect >= MAXSECTORS) ) + if ( ud.clipping == 0 && ( sector[psect].floorpicnum == MIRROR || psect < 0 || psect >= MAXSECTORS) ) { myx = omyx; myy = omyy; @@ -9928,10 +9998,10 @@ void fakedomovethings(void) j = getflorzofslope(psect,myx,myy); - if( (lz&49152) == 16384 && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) ) + if ( (lz&49152) == 16384 && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) ) psectlotag = 0; - if( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) ) + if ( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) ) { x = myx+(sintable[(myang+512)&2047]>>5); y = myy+(sintable[myang&2047]>>5); @@ -9949,7 +10019,7 @@ void fakedomovethings(void) if (myhorizoff > 0) myhorizoff -= ((myhorizoff>>3)+1); else if (myhorizoff < 0) myhorizoff += (((-myhorizoff)>>3)+1); - if(hz >= 0 && (hz&49152) == 49152) + if (hz >= 0 && (hz&49152) == 49152) { hz &= (MAXSPRITES-1); if (sprite[hz].statnum == 1 && sprite[hz].extra >= 0) @@ -9959,7 +10029,7 @@ void fakedomovethings(void) } } - if(lz >= 0 && (lz&49152) == 49152) + if (lz >= 0 && (lz&49152) == 49152) { j = lz&(MAXSPRITES-1); if ((sprite[j].cstat&33) == 33) @@ -9967,7 +10037,7 @@ void fakedomovethings(void) psectlotag = 0; spritebridge = 1; } - if(badguy(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(sprite[p->i].z-sprite[j].z) < (84<<8) ) + if (badguy(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(sprite[p->i].z-sprite[j].z) < (84<<8) ) { j = getangle( sprite[j].x-myx,sprite[j].y-myy); myxvel -= sintable[(j+512)&2047]<<4; @@ -9975,13 +10045,13 @@ void fakedomovethings(void) } } - if( sprite[p->i].extra <= 0 ) + if ( sprite[p->i].extra <= 0 ) { - if( psectlotag == 2 ) + if ( psectlotag == 2 ) { - if(p->on_warping_sector == 0) + if (p->on_warping_sector == 0) { - if( klabs(myz-fz) > (PHEIGHT>>1)) + if ( klabs(myz-fz) > (PHEIGHT>>1)) myz += 348; } clipmove(&myx,&myy,&myz,&mycursectnum,0,0,164L,(4L<<8),(4L<<8),CLIPMASK0); @@ -9998,68 +10068,68 @@ void fakedomovethings(void) doubvel = TICSPERFRAME; - if(p->on_crane >= 0) goto FAKEHORIZONLY; + if (p->on_crane >= 0) goto FAKEHORIZONLY; - if(p->one_eighty_count < 0) myang += 128; + if (p->one_eighty_count < 0) myang += 128; i = 40; - if( psectlotag == 2) + if ( psectlotag == 2) { myjumpingcounter = 0; if ( sb_snum&1 ) { - if(myzvel > 0) myzvel = 0; + if (myzvel > 0) myzvel = 0; myzvel -= 348; - if(myzvel < -(256*6)) myzvel = -(256*6); + if (myzvel < -(256*6)) myzvel = -(256*6); } else if (sb_snum&(1<<1)) { - if(myzvel < 0) myzvel = 0; + if (myzvel < 0) myzvel = 0; myzvel += 348; - if(myzvel > (256*6)) myzvel = (256*6); + if (myzvel > (256*6)) myzvel = (256*6); } else { - if(myzvel < 0) + if (myzvel < 0) { myzvel += 256; - if(myzvel > 0) + if (myzvel > 0) myzvel = 0; } - if(myzvel > 0) + if (myzvel > 0) { myzvel -= 256; - if(myzvel < 0) + if (myzvel < 0) myzvel = 0; } } - if(myzvel > 2048) myzvel >>= 1; + if (myzvel > 2048) myzvel >>= 1; myz += myzvel; - if(myz > (fz-(15<<8)) ) + if (myz > (fz-(15<<8)) ) myz += ((fz-(15<<8))-myz)>>1; - if(myz < (cz+(4<<8)) ) + if (myz < (cz+(4<<8)) ) { myz = cz+(4<<8); myzvel = 0; } } - else if(p->jetpack_on) + else if (p->jetpack_on) { myonground = 0; myjumpingcounter = 0; myhardlanding = 0; - if(p->jetpack_on < 11) + if (p->jetpack_on < 11) myz -= (p->jetpack_on<<7); //Goin up - if(shrunk) j = 512; + if (shrunk) j = 512; else j = 2048; if (sb_snum&1) //A @@ -10067,24 +10137,24 @@ void fakedomovethings(void) if (sb_snum&(1<<1)) //Z myz += j; - if(shrunk == 0 && ( psectlotag == 0 || psectlotag == 2 ) ) k = 32; + if (shrunk == 0 && ( psectlotag == 0 || psectlotag == 2 ) ) k = 32; else k = 16; - if(myz > (fz-(k<<8)) ) + if (myz > (fz-(k<<8)) ) myz += ((fz-(k<<8))-myz)>>1; - if(myz < (cz+(18<<8)) ) + if (myz < (cz+(18<<8)) ) myz = cz+(18<<8); } - else if( psectlotag != 2 ) + else if ( psectlotag != 2 ) { if (psectlotag == 1 && p->spritebridge == 0) { - if(shrunk == 0) i = 34; + if (shrunk == 0) i = 34; else i = 12; } - if(myz < (fz-(i<<8)) && (floorspace(psect)|ceilingspace(psect)) == 0 ) //falling + if (myz < (fz-(i<<8)) && (floorspace(psect)|ceilingspace(psect)) == 0 ) //falling { - if( (sb_snum&3) == 0 && myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8) ) ) + if ( (sb_snum&3) == 0 && myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8) ) ) myz = fz-(i<<8); else { @@ -10092,63 +10162,63 @@ void fakedomovethings(void) myzvel += (gc+80); - if(myzvel >= (4096+2048)) myzvel = (4096+2048); + if (myzvel >= (4096+2048)) myzvel = (4096+2048); } } else { - if(psectlotag != 1 && psectlotag != 2 && myonground == 0 && myzvel > (6144>>1)) + if (psectlotag != 1 && psectlotag != 2 && myonground == 0 && myzvel > (6144>>1)) myhardlanding = myzvel>>10; myonground = 1; - if(i==40) + if (i==40) { //Smooth on the ground k = ((fz-(i<<8))-myz)>>1; - if( klabs(k) < 256 ) k = 0; + if ( klabs(k) < 256 ) k = 0; myz += k; // ((fz-(i<<8))-myz)>>1; myzvel -= 768; // 412; - if(myzvel < 0) myzvel = 0; + if (myzvel < 0) myzvel = 0; } - else if(myjumpingcounter == 0) + else if (myjumpingcounter == 0) { myz += ((fz-(i<<7))-myz)>>1; //Smooth on the water - if(p->on_warping_sector == 0 && myz > fz-(16<<8)) + if (p->on_warping_sector == 0 && myz > fz-(16<<8)) { myz = fz-(16<<8); myzvel >>= 1; } } - if( sb_snum&2 ) + if ( sb_snum&2 ) myz += (2048+768); - if( (sb_snum&1) == 0 && myjumpingtoggle == 1) + if ( (sb_snum&1) == 0 && myjumpingtoggle == 1) myjumpingtoggle = 0; - else if( (sb_snum&1) && myjumpingtoggle == 0 ) + else if ( (sb_snum&1) && myjumpingtoggle == 0 ) { - if( myjumpingcounter == 0 ) - if( (fz-cz) > (56<<8) ) + if ( myjumpingcounter == 0 ) + if ( (fz-cz) > (56<<8) ) { myjumpingcounter = 1; myjumpingtoggle = 1; } } - if( myjumpingcounter && (sb_snum&1) == 0 ) + if ( myjumpingcounter && (sb_snum&1) == 0 ) myjumpingcounter = 0; } - if(myjumpingcounter) + if (myjumpingcounter) { - if( (sb_snum&1) == 0 && myjumpingtoggle == 1) + if ( (sb_snum&1) == 0 && myjumpingtoggle == 1) myjumpingtoggle = 0; - if( myjumpingcounter < (1024+256) ) + if ( myjumpingcounter < (1024+256) ) { - if(psectlotag == 1 && myjumpingcounter > 768) + if (psectlotag == 1 && myjumpingcounter > 768) { myjumpingcounter = 0; myzvel = -512; @@ -10170,10 +10240,10 @@ void fakedomovethings(void) myz += myzvel; - if(myz < (cz+(4<<8)) ) + if (myz < (cz+(4<<8)) ) { myjumpingcounter = 0; - if(myzvel < 0) myxvel = myyvel = 0; + if (myzvel < 0) myxvel = myyvel = 0; myzvel = 128; myz = cz+(4<<8); } @@ -10199,7 +10269,7 @@ void fakedomovethings(void) tempang = syn->avel<<1; - if(psectlotag == 2) + if (psectlotag == 2) myang += (tempang-(tempang>>3))*ksgn(doubvel); else myang += (tempang)*ksgn(doubvel); myang &= 2047; @@ -10207,20 +10277,20 @@ void fakedomovethings(void) if ( myxvel || myyvel || syn->fvel || syn->svel ) { - if(p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) + if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) doubvel <<= 1; myxvel += ((syn->fvel*doubvel)<<6); myyvel += ((syn->svel*doubvel)<<6); - if( ( p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && myonground ) || ( myonground && (sb_snum&2) ) ) + if ( ( p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && myonground ) || ( myonground && (sb_snum&2) ) ) { myxvel = mulscale16(myxvel,p->runspeed-0x2000); myyvel = mulscale16(myyvel,p->runspeed-0x2000); } else { - if(psectlotag == 2) + if (psectlotag == 2) { myxvel = mulscale16(myxvel,p->runspeed-0x1400); myyvel = mulscale16(myyvel,p->runspeed-0x1400); @@ -10232,10 +10302,10 @@ void fakedomovethings(void) } } - if( abs(myxvel) < 2048 && abs(myyvel) < 2048 ) + if ( abs(myxvel) < 2048 && abs(myyvel) < 2048 ) myxvel = myyvel = 0; - if( shrunk ) + if ( shrunk ) { myxvel = mulscale16(myxvel,(p->runspeed)-(p->runspeed>>1)+(p->runspeed>>2)); @@ -10245,12 +10315,12 @@ void fakedomovethings(void) } FAKEHORIZONLY: - if(psectlotag == 1 || spritebridge == 1) i = (4L<<8); else i = (20L<<8); + if (psectlotag == 1 || spritebridge == 1) i = (4L<<8); else i = (20L<<8); clipmove(&myx,&myy,&myz,&mycursectnum,myxvel,myyvel,164L,4L<<8,i,CLIPMASK0); pushmove(&myx,&myy,&myz,&mycursectnum,164L,4L<<8,4L<<8,CLIPMASK0); - if( p->jetpack_on == 0 && psectlotag != 1 && psectlotag != 2 && shrunk) + if ( p->jetpack_on == 0 && psectlotag != 1 && psectlotag != 2 && shrunk) myz += 30<<8; if ((sb_snum&(1<<18)) || myhardlanding) @@ -10286,12 +10356,12 @@ FAKEHORIZONLY: myhoriz += 33-(myhoriz/3); } - if(p->aim_mode) + if (p->aim_mode) myhoriz += syn->horz; else { - if( myhoriz > 95 && myhoriz < 105) myhoriz = 100; - if( myhorizoff > -5 && myhorizoff < 5) myhorizoff = 0; + if ( myhoriz > 95 && myhoriz < 105) myhoriz = 100; + if ( myhorizoff > -5 && myhorizoff < 5) myhorizoff = 0; } if (myhardlanding > 0) @@ -10303,7 +10373,7 @@ FAKEHORIZONLY: if (myhoriz > 299) myhoriz = 299; else if (myhoriz < -99) myhoriz = -99; - if(p->knee_incs > 0) + if (p->knee_incs > 0) { myhoriz -= 48; myreturntocenter = 9; @@ -10330,20 +10400,20 @@ char domovethings(void) long p; - for(i=connecthead;i>=0;i=connectpoint2[i]) - if( sync[i].bits&(1<<17) ) + for (i=connecthead;i>=0;i=connectpoint2[i]) + if ( sync[i].bits&(1<<17) ) { multiflag = 2; multiwhat = (sync[i].bits>>18)&1; multipos = (unsigned) (sync[i].bits>>19)&15; multiwho = i; - if( multiwhat ) + if ( multiwhat ) { saveplayer( multipos ); multiflag = 0; - if(multiwho != myconnectindex) + if (multiwho != myconnectindex) { Bsprintf(fta_quotes[122],"%s SAVED A MULTIPLAYER GAME",&ud.user_name[multiwho][0]); FTA(122,&ps[myconnectindex]); @@ -10363,9 +10433,9 @@ char domovethings(void) multiflag = 0; - if(j == 0) + if (j == 0) { - if(multiwho != myconnectindex) + if (multiwho != myconnectindex) { Bsprintf(fta_quotes[122],"%s LOADED A MULTIPLAYER GAME",&ud.user_name[multiwho][0]); FTA(122,&ps[myconnectindex]); @@ -10383,23 +10453,23 @@ char domovethings(void) ud.camerasprite = -1; lockclock += TICSPERFRAME; - if(earthquaketime > 0) earthquaketime--; - if(rtsplaying > 0) rtsplaying--; + if (earthquaketime > 0) earthquaketime--; + if (rtsplaying > 0) rtsplaying--; - for(i=0;i 1) + if (ud.idplayers && ud.multimode > 1) { long sx,sy,sz; short sect,hw,hs; - for(i=0;i 2) ps[screenpeek].fta -= 3; + } else if (ps[screenpeek].fta > 2) ps[screenpeek].fta -= 3; } } - if( show_shareware > 0 ) + if ( show_shareware > 0 ) { show_shareware--; - if(show_shareware == 0) + if (show_shareware == 0) { pus = NUMPAGES; pub = NUMPAGES; @@ -10436,14 +10506,14 @@ char domovethings(void) everyothertime++; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) copybufbyte(&inputfifo[movefifoplc&(MOVEFIFOSIZ-1)][i],&sync[i],sizeof(input)); movefifoplc++; updateinterpolations(); j = -1; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { if ((sync[i].bits&(1<<26)) == 0) { j = i; continue; } @@ -10476,7 +10546,7 @@ char domovethings(void) adduserquote(buf); Bstrcpy(fta_quotes[116],buf); - if(voting == i) + if (voting == i) { Bmemset(votes,0,sizeof(votes)); Bmemset(gotvote,0,sizeof(gotvote)); @@ -10485,63 +10555,65 @@ char domovethings(void) ps[myconnectindex].ftq = 116, ps[myconnectindex].fta = 180; - if(j < 0 && networkmode == 0 ) + if (j < 0 && networkmode == 0 ) gameexit( "The server/master player just quit the game; disconnected."); } if ((numplayers >= 2) && ((movefifoplc&7) == 7)) { ch = (char)(randomseed&255); - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) ch += ((ps[i].posx+ps[i].posy+ps[i].posz+ps[i].ang+ps[i].horiz)&255); syncval[myconnectindex][syncvalhead[myconnectindex]&(MOVEFIFOSIZ-1)] = ch; syncvalhead[myconnectindex]++; } - if(ud.recstat == 1) record(); + if (ud.recstat == 1) record(); - if( ud.pause_on == 0 ) + if ( ud.pause_on == 0 ) { global_random = TRAND; movedummyplayers();//ST 13 } - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { - if(sync[i].extbits&(1<<6)) + if (sync[i].extbits&(1<<6)) { ps[i].team = ud.pteam[i]; - if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) + if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) { hittype[ps[i].i].picnum = APLAYERTOP; quickkill(&ps[i]); } } - if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) + if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) { j = 0; - switch(ps[i].team) + switch (ps[i].team) { - case 0: j = 3; break; - case 1: j = 21; break; + case 0: + j = 3; break; + case 1: + j = 21; break; } ps[i].palookup = ud.pcolor[i] = j; } - if(sprite[ps[i].i].pal != 1) + if (sprite[ps[i].i].pal != 1) sprite[ps[i].i].pal = ud.pcolor[i]; cheatkeys(i); - if( ud.pause_on == 0 ) + if ( ud.pause_on == 0 ) { processinput(i); checksectors(i); } } - if( ud.pause_on == 0 ) + if ( ud.pause_on == 0 ) { movefta(); //ST 2 @@ -10560,7 +10632,7 @@ char domovethings(void) for (k=0;k= 0) + while (i >= 0) { j = nextspritestat[i]; OnEvent(EVENT_GAME,i, findplayer(&sprite[i],&p), p); @@ -10574,7 +10646,7 @@ char domovethings(void) fakedomovethingscorrect(); - if( (everyothertime&1) == 0) + if ( (everyothertime&1) == 0) { animatewalls(); movecyclers(); @@ -10599,25 +10671,27 @@ void doorders(void) KB_FlushKeyboardQueue(); rotatesprite(0,0,65536L,0,ORDERING,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); fadepal(0,0,0, 63,0,-7); - while( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + while ( !KB_KeyWaiting() ) { handleevents(); getpackets(); } fadepal(0,0,0, 0,63,7); KB_FlushKeyboardQueue(); rotatesprite(0,0,65536L,0,ORDERING+1,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); fadepal(0,0,0, 63,0,-7); - while( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + while ( !KB_KeyWaiting() ) { handleevents(); getpackets(); } fadepal(0,0,0, 0,63,7); KB_FlushKeyboardQueue(); rotatesprite(0,0,65536L,0,ORDERING+2,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); fadepal(0,0,0, 63,0,-7); - while( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + while ( !KB_KeyWaiting() ) { handleevents(); getpackets(); } fadepal(0,0,0, 0,63,7); KB_FlushKeyboardQueue(); rotatesprite(0,0,65536L,0,ORDERING+3,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); fadepal(0,0,0, 63,0,-7); - while( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + while ( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + + } void dobonus(char bonusonly) @@ -10668,13 +10742,13 @@ void dobonus(char bonusonly) clearsoundlocks(); FX_SetReverb(0L); - if(bonusonly) goto FRAGBONUS; + if (bonusonly) goto FRAGBONUS; - if(numplayers < 2 && ud.eog && ud.from_bonus == 0) - switch(ud.volume_number) + if (numplayers < 2 && ud.eog && ud.from_bonus == 0) + switch (ud.volume_number) { case 0: - if(ud.lockout == 0) + if (ud.lockout == 0) { setgamepalette(&ps[myconnectindex], endingpal, 3); // JBF 20040308 clearview(0L); @@ -10685,31 +10759,33 @@ void dobonus(char bonusonly) KB_FlushKeyboardQueue(); totalclock = 0; tinc = 0; - while( 1 ) + while ( 1 ) { clearview(0L); rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); // boss - if( totalclock > 390 && totalclock < 780 ) - for(t=0;t<35;t+=5) if( bossmove[t+2] && (totalclock%390) > bossmove[t] && (totalclock%390) <= bossmove[t+1] ) + if ( totalclock > 390 && totalclock < 780 ) + 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) { sound(SHOTGUN_FIRE);sound(SQUISHED); bonuscnt++; } + if (t==10 && bonuscnt == 1) { sound(SHOTGUN_FIRE);sound(SQUISHED); bonuscnt++; } rotatesprite(bossmove[t+3]<<16,bossmove[t+4]<<16,65536L,0,bossmove[t+2],0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); } // Breathe - if( totalclock < 450 || totalclock >= 750 ) + if ( totalclock < 450 || totalclock >= 750 ) { - if(totalclock >= 750) + if (totalclock >= 750) { rotatesprite(86<<16,59<<16,65536L,0,VICTORY1+8,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - if(totalclock >= 750 && bonuscnt == 2) { sound(DUKETALKTOBOSS); bonuscnt++; } + if (totalclock >= 750 && bonuscnt == 2) { sound(DUKETALKTOBOSS); bonuscnt++; } + + } - for(t=0;t<20;t+=5) - if( breathe[t+2] && (totalclock%120) > breathe[t] && (totalclock%120) <= breathe[t+1] ) + 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) + if (t==5 && bonuscnt == 0) { sound(BOSSTALKTODUKE); bonuscnt++; @@ -10720,7 +10796,7 @@ void dobonus(char bonusonly) handleevents(); getpackets(); nextpage(); - if( KB_KeyWaiting() ) break; + if ( KB_KeyWaiting() ) break; } } @@ -10732,7 +10808,7 @@ void dobonus(char bonusonly) rotatesprite(0,0,65536L,0,3292,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); IFISSOFTMODE fadepal(0,0,0, 63,0,-1); else nextpage(); - while( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + while ( !KB_KeyWaiting() ) { handleevents(); getpackets(); } fadepal(0,0,0, 0,64,1); MUSIC_StopSong(); FX_StopAllSounds(); @@ -10743,7 +10819,7 @@ void dobonus(char bonusonly) clearview(0L); nextpage(); - if(ud.lockout == 0) + if (ud.lockout == 0) { playanm("cineov2.anm",1); KB_FlushKeyBoardQueue(); @@ -10760,7 +10836,7 @@ void dobonus(char bonusonly) setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 rotatesprite(0,0,65536L,0,3293,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); IFISSOFTMODE fadepal(0,0,0, 63,0,-1); else nextpage(); - while( !KB_KeyWaiting() ) { handleevents(); getpackets(); } + while ( !KB_KeyWaiting() ) { handleevents(); getpackets(); } IFISSOFTMODE fadepal(0,0,0, 0,64,1); break; @@ -10773,7 +10849,7 @@ void dobonus(char bonusonly) clearview(0L); nextpage(); - if(ud.lockout == 0) + if (ud.lockout == 0) { KB_FlushKeyboardQueue(); playanm("vol4e1.anm",8); @@ -10805,7 +10881,7 @@ void dobonus(char bonusonly) fadepal(0,0,0, 63,0,-3); KB_FlushKeyboardQueue(); - while(!KB_KeyWaiting()) { handleevents(); getpackets(); } + while (!KB_KeyWaiting()) { handleevents(); getpackets(); } fadepal(0,0,0, 0,64,3); clearview(0L); @@ -10814,7 +10890,7 @@ void dobonus(char bonusonly) playanm("DUKETEAM.ANM",4); KB_FlushKeyBoardQueue(); - while(!KB_KeyWaiting()) { handleevents(); getpackets(); } + while (!KB_KeyWaiting()) { handleevents(); getpackets(); } clearview(0L); nextpage(); @@ -10831,13 +10907,13 @@ void dobonus(char bonusonly) MUSIC_StopSong(); clearview(0L); nextpage(); - if(ud.lockout == 0) + if (ud.lockout == 0) { fadepal(0,0,0, 63,0,-1); playanm("cineov3.anm",2); KB_FlushKeyBoardQueue(); ototalclock = totalclock+200; - while(totalclock < ototalclock) { handleevents(); getpackets(); } + while (totalclock < ototalclock) { handleevents(); getpackets(); } clearview(0L); nextpage(); @@ -10847,27 +10923,29 @@ void dobonus(char bonusonly) playanm("RADLOGO.ANM",3); - if( ud.lockout == 0 && !KB_KeyWaiting() ) + if ( ud.lockout == 0 && !KB_KeyWaiting() ) { sound(ENDSEQVOL3SND5); - while(issoundplaying(-1,ENDSEQVOL3SND5)) { handleevents(); getpackets(); } - if(KB_KeyWaiting()) goto ENDANM; + while (issoundplaying(-1,ENDSEQVOL3SND5)) { handleevents(); getpackets(); } + if (KB_KeyWaiting()) goto ENDANM; sound(ENDSEQVOL3SND6); - while(issoundplaying(-1,ENDSEQVOL3SND6)) { handleevents(); getpackets(); } - if(KB_KeyWaiting()) goto ENDANM; + while (issoundplaying(-1,ENDSEQVOL3SND6)) { handleevents(); getpackets(); } + if (KB_KeyWaiting()) goto ENDANM; sound(ENDSEQVOL3SND7); - while(issoundplaying(-1,ENDSEQVOL3SND7)) { handleevents(); getpackets(); } - if(KB_KeyWaiting()) goto ENDANM; + while (issoundplaying(-1,ENDSEQVOL3SND7)) { handleevents(); getpackets(); } + if (KB_KeyWaiting()) goto ENDANM; sound(ENDSEQVOL3SND8); - while(issoundplaying(-1,ENDSEQVOL3SND8)) { handleevents(); getpackets(); } - if(KB_KeyWaiting()) goto ENDANM; + while (issoundplaying(-1,ENDSEQVOL3SND8)) { handleevents(); getpackets(); } + if (KB_KeyWaiting()) goto ENDANM; sound(ENDSEQVOL3SND9); - while(issoundplaying(-1,ENDSEQVOL3SND9)) { handleevents(); getpackets(); } + while (issoundplaying(-1,ENDSEQVOL3SND9)) { handleevents(); getpackets(); } + + } KB_FlushKeyBoardQueue(); totalclock = 0; - while(!KB_KeyWaiting() && totalclock < 120) { handleevents(); getpackets(); } + while (!KB_KeyWaiting() && totalclock < 120) { handleevents(); getpackets(); } ENDANM: @@ -10894,9 +10972,9 @@ FRAGBONUS: FX_StopAllSounds(); clearsoundlocks(); - if(playerswhenstarted > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_SCORESHEET)) + if (playerswhenstarted > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_SCORESHEET)) { - if(!(MusicToggle == 0 || MusicDevice < 0)) + if (!(MusicToggle == 0 || MusicDevice < 0)) sound(BONUSMUSIC); rotatesprite(0,0,65536L,0,MENUSCREEN,16,0,2+8+16+64,0,0,xdim-1,ydim-1); @@ -10911,13 +10989,13 @@ FRAGBONUS: t = 0; minitext(23,80," NAME KILLS",8,2+8+16+128); - for(i=0;i 1) return; + if (bonusonly || ud.multimode > 1) return; fadepal(0,0,0, 0,64,7); } - if(bonusonly || ud.multimode > 1) return; + if (bonusonly || ud.multimode > 1) return; - switch(ud.volume_number) + switch (ud.volume_number) { case 1: gfx_offset = 5; @@ -11004,7 +11082,7 @@ FRAGBONUS: gametext(160,192,"PRESS ANY KEY TO CONTINUE",16,2+8+16); - if(!(MusicToggle == 0 || MusicDevice < 0)) + if (!(MusicToggle == 0 || MusicDevice < 0)) sound(BONUSMUSIC); nextpage(); @@ -11027,10 +11105,10 @@ FRAGBONUS: for (ii=ps[myconnectindex].player_par/(26*60), ij=1; ii>9; ii/=10, ij++) ; clockpad = max(clockpad,ij); - if(!(ud.volume_number == 0 && ud.last_level-1 == 7)) { + if (!(ud.volume_number == 0 && ud.last_level-1 == 7)) { for (ii=partime[ud.volume_number*11+ud.last_level-1]/(26*60), ij=1; ii>9; ii/=10, ij++) ; clockpad = max(clockpad,ij); - if(!NAM) { + if (!NAM) { for (ii=designertime[ud.volume_number*11+ud.last_level-1]/(26*60), ij=1; ii>9; ii/=10, ij++) ; clockpad = max(clockpad,ij); } @@ -11040,27 +11118,27 @@ FRAGBONUS: } - while( 1 ) + while ( 1 ) { int yy = 0, zz; handleevents(); AudioUpdate(); - if(ps[myconnectindex].gm&MODE_EOL) + if (ps[myconnectindex].gm&MODE_EOL) { rotatesprite(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - if( totalclock > (1000000000L) && totalclock < (1000000320L) ) + if ( totalclock > (1000000000L) && totalclock < (1000000320L) ) { - switch( (totalclock>>4)%15 ) + switch ( (totalclock>>4)%15 ) { case 0: - if(bonuscnt == 6) + if (bonuscnt == 6) { bonuscnt++; sound(SHOTGUN_COCK); - switch(rand()&3) + switch (rand()&3) { case 0: sound(BONUS_SPEECH1); @@ -11087,10 +11165,10 @@ FRAGBONUS: break; } } - else if( totalclock > (10240+120L) ) break; + else if ( totalclock > (10240+120L) ) break; else { - switch( (totalclock>>5)&3 ) + switch ( (totalclock>>5)&3 ) { case 1: case 3: @@ -11107,23 +11185,25 @@ FRAGBONUS: gametext(160,192,"PRESS ANY KEY TO CONTINUE",16,2+8+16); - if( totalclock > (60*3) ) + if ( totalclock > (60*3) ) { yy = zz = 59; gametext(10,yy+9,"Your Time:",0,2+8+16); yy+=10; - if(!(ud.volume_number == 0 && ud.last_level-1 == 7)) { + if (!(ud.volume_number == 0 && ud.last_level-1 == 7)) { gametext(10,yy+9,"Par Time:",0,2+8+16); yy+=10; if (!NAM) { gametext(10,yy+9,"3D Realms' Time:",0,2+8+16); yy+=10; } + + } if (playerbest > 0) { gametext(10,yy+9,ps[myconnectindex].player_par (60*4) ) + if ( totalclock > (60*4) ) { - if(bonuscnt == 1) + if (bonuscnt == 1) { bonuscnt++; sound(PIPEBOMB_EXPLODE); @@ -11133,11 +11213,11 @@ FRAGBONUS: (ps[myconnectindex].player_par/(26*60)), (ps[myconnectindex].player_par/26)%60); gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); - if(ps[myconnectindex].player_par < playerbest) + if (ps[myconnectindex].player_par < playerbest) gametext((320>>2)+71+(clockpad*24),yy+9,"New record!",0,2+8+16); yy+=10; - if(!(ud.volume_number == 0 && ud.last_level-1 == 7)) { + if (!(ud.volume_number == 0 && ud.last_level-1 == 7)) { Bsprintf(tempbuf,"%0*ld:%02ld",clockpad, (partime[ud.volume_number*11+ud.last_level-1]/(26*60)), (partime[ud.volume_number*11+ud.last_level-1]/26)%60); @@ -11161,12 +11241,12 @@ FRAGBONUS: } zz = yy += 5; - if( totalclock > (60*6) ) + if ( totalclock > (60*6) ) { gametext(10,yy+9,"Enemies Killed:",0,2+8+16); yy += 10; gametext(10,yy+9,"Enemies Left:",0,2+8+16); yy += 10; - if(bonuscnt == 2) + if (bonuscnt == 2) { bonuscnt++; sound(FLY_BY); @@ -11174,23 +11254,23 @@ FRAGBONUS: yy = zz; - if( totalclock > (60*7) ) + if ( totalclock > (60*7) ) { - if(bonuscnt == 3) + if (bonuscnt == 3) { bonuscnt++; sound(PIPEBOMB_EXPLODE); } sprintf(tempbuf,"%-3ld",ps[myconnectindex].actors_killed); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; - if(ud.player_skill > 3 ) + if (ud.player_skill > 3 ) { sprintf(tempbuf,"N/A"); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; } else { - if( (ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed) < 0 ) + if ( (ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed) < 0 ) sprintf(tempbuf,"%-3d",0); else sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; @@ -11199,47 +11279,47 @@ FRAGBONUS: } zz = yy += 5; - if( totalclock > (60*9) ) + if ( totalclock > (60*9) ) { gametext(10,yy+9,"Secrets Found:",0,2+8+16); yy += 10; gametext(10,yy+9,"Secrets Missed:",0,2+8+16); yy += 10; - if(bonuscnt == 4) bonuscnt++; + if (bonuscnt == 4) bonuscnt++; yy = zz; - if( totalclock > (60*10) ) + if ( totalclock > (60*10) ) { - if(bonuscnt == 5) + if (bonuscnt == 5) { bonuscnt++; sound(PIPEBOMB_EXPLODE); } sprintf(tempbuf,"%-3ld",ps[myconnectindex].secret_rooms); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; - if( ps[myconnectindex].secret_rooms > 0 ) + if ( ps[myconnectindex].secret_rooms > 0 ) sprintf(tempbuf,"%-3ld%%",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms)); sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; } } - if(totalclock > 10240 && totalclock < 10240+10240) + if (totalclock > 10240 && totalclock < 10240+10240) totalclock = 1024; - if( ( (MOUSE_GetButtons()&7) || KB_KeyWaiting() ) && totalclock > (60*2) ) // JBF 20030809 + if ( ( (MOUSE_GetButtons()&7) || KB_KeyWaiting() ) && totalclock > (60*2) ) // JBF 20030809 { MOUSE_ClearButton(7); - if( KB_KeyPressed( sc_F12 ) ) + if ( KB_KeyPressed( sc_F12 ) ) { KB_ClearKeyDown( sc_F12 ); screencapture("duke0000.tga",0); } - if( totalclock < (60*13) ) + if ( totalclock < (60*13) ) { KB_FlushKeyboardQueue(); totalclock = (60*13); } - else if( totalclock < (1000000000L)) + else if ( totalclock < (1000000000L)) totalclock = (1000000000L); } } @@ -11253,20 +11333,20 @@ void cameratext(short i) char flipbits; long x , y; - if(!T1) + if (!T1) { rotatesprite(24<<16,33<<16,65536L,0,CAMCORNER,0,0,2,windowx1,windowy1,windowx2,windowy2); rotatesprite((320-26)<<16,34<<16,65536L,0,CAMCORNER+1,0,0,2,windowx1,windowy1,windowx2,windowy2); rotatesprite(22<<16,163<<16,65536L,512,CAMCORNER+1,0,0,2+4,windowx1,windowy1,windowx2,windowy2); rotatesprite((310-10)<<16,163<<16,65536L,512,CAMCORNER+1,0,0,2,windowx1,windowy1,windowx2,windowy2); - if(totalclock&16) + if (totalclock&16) rotatesprite(46<<16,32<<16,65536L,0,CAMLIGHT,0,0,2,windowx1,windowy1,windowx2,windowy2); } 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); } } @@ -11277,10 +11357,10 @@ void vglass(long x,long y,short a,short wn,short n) short sect; sect = wall[wn].nextsector; - if(sect == -1) return; + 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 ) EGS(sect,x,y,z-(TRAND&8191),GLASSPIECES+(z&(TRAND%3)),-32,36,36,a+128-(TRAND&255),16+(TRAND&31),0,-1,5); } @@ -11291,9 +11371,9 @@ void lotsofglass(short i,short wallnum,short n) sect = -1; - if(wallnum < 0) + if (wallnum < 0) { - for(j=n-1; j >= 0 ;j--) + for (j=n-1; j >= 0 ;j--) { a = SA-256+(TRAND&511)+1024; EGS(SECT,SX,SY,SZ,GLASSPIECES+(j%3),-32,36,36,a,32+(TRAND&63),1024-(TRAND&1023),i,5); @@ -11315,16 +11395,16 @@ void lotsofglass(short i,short wallnum,short n) xv /= j; yv /= j; - for(j=n;j>0;j--) + for (j=n;j>0;j--) { x1 += xv; y1 += yv; updatesector(x1,y1,§); - if(sect >= 0) + if (sect >= 0) { z = sector[sect].floorz-(TRAND&(klabs(sector[sect].ceilingz-sector[sect].floorz))); - if( z < -(32<<8) || z > (32<<8) ) + if ( z < -(32<<8) || z > (32<<8) ) z = SZ-(32<<8)+(TRAND&((64<<8)-1)); a = SA-1024; EGS(SECT,x1,y1,z,GLASSPIECES+(j%3),-32,36,36,a,32+(TRAND&63),-(TRAND&1023),i,5); @@ -11336,7 +11416,7 @@ void spriteglass(short i,short n) { long j, k, a, z; - for(j=n;j>0;j--) + for (j=n;j>0;j--) { a = TRAND&2047; z = SZ-((TRAND&16)<<8); @@ -11353,7 +11433,7 @@ void ceilingglass(short i,short sectnum,short n) startwall = sector[sectnum].wallptr; 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; @@ -11361,7 +11441,7 @@ void ceilingglass(short i,short sectnum,short 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; @@ -11378,9 +11458,9 @@ void lotsofcolourglass(short i,short wallnum,short n) long j, xv, yv, z, x1, y1; short sect = -1, a, k; - if(wallnum < 0) + if (wallnum < 0) { - for(j=n-1; j >= 0 ;j--) + for (j=n-1; j >= 0 ;j--) { a = TRAND&2047; k = EGS(SECT,SX,SY,SZ-(TRAND&(63<<8)),GLASSPIECES+(j%3),-32,36,36,a,32+(TRAND&63),1024-(TRAND&2047),i,5); @@ -11396,14 +11476,14 @@ void lotsofcolourglass(short i,short wallnum,short 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; updatesector(x1,y1,§); z = sector[sect].floorz-(TRAND&(klabs(sector[sect].ceilingz-sector[sect].floorz))); - if( z < -(32<<8) || z > (32<<8) ) + if ( z < -(32<<8) || z > (32<<8) ) z = SZ-(32<<8)+(TRAND&((64<<8)-1)); a = SA-1024; k = EGS(SECT,x1,y1,z,GLASSPIECES+(j%3),-32,36,36,a,32+(TRAND&63),-(TRAND&2047),i,5); diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index e2b76649f..76936482a 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -868,7 +868,7 @@ void skipcomments(void) { if (!(error || warning) && condebug > 1) initprintf("%s:%ld: debug: got comment.\n",compilefile,line_number); - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; } else if (c == '/' && textptr[1] == '*') @@ -885,7 +885,7 @@ void skipcomments(void) initprintf("%s:%ld: debug: got end of comment block.\n",compilefile,line_number); if (!*textptr) { - if(!(error || warning) && condebug) + if (!(error || warning) && condebug) initprintf("%s:%ld: debug: EOF in comment!\n",compilefile,line_number); ReportError(-1); initprintf("%s:%ld: error: found `/*' with no `*/'.\n",compilefile,line_number); @@ -902,7 +902,7 @@ void skipcomments(void) void DefineProjectile(long lVar1, long lLabelID, long lVar2) { - switch(lLabelID) + switch (lLabelID) { case PROJ_WORKSLIKE: projectile[lVar1].workslike=lVar2; @@ -1028,9 +1028,9 @@ void DefineProjectile(long lVar1, long lLabelID, long lVar2) char CheckEventSync(int iEventID) { - if(parsing_event || parsing_actor) + if (parsing_event || parsing_actor) { - switch(iEventID) + switch (iEventID) { case EVENT_CHEATGETSTEROIDS: case EVENT_CHEATGETHEAT: @@ -1061,7 +1061,7 @@ char CheckEventSync(int iEventID) void AddLog(char *psz) { Bstrcpy(tempbuf,psz); - if(tempbuf[Bstrlen(psz)] != '\n') + if (tempbuf[Bstrlen(psz)] != '\n') Bstrcat(tempbuf,"\n"); if (qsetmode == 200) OSD_Printf(tempbuf); else initprintf(tempbuf); @@ -1080,20 +1080,20 @@ int ReadGameVars(long fil) // Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__); // AddLog(g_szBuf); - if(kdfread(&iGameVarCount,sizeof(iGameVarCount),1,fil) != 1) goto corrupt; - for(i=0;i (MAXVARLABEL-1) ) + if (Bstrlen(pszLabel) > (MAXVARLABEL-1) ) { error++; initprintf("%s:%ld: error: variable name `%s' exceeds limit of %d characters.\n",compilefile,line_number,pszLabel, MAXVARLABEL); return 0; } - for(i=0;i= iGameVarCount) + if (id<0 || id >= iGameVarCount) { - if(id==MAXGAMEVARS) + if (id==MAXGAMEVARS) return(*insptr++); - else if(id&(MAXGAMEVARS<<1)) + else if (id&(MAXGAMEVARS<<1)) { m=1; id ^= (MAXGAMEVARS<<1); @@ -1428,72 +1428,72 @@ long GetGameVarID(int id, short sActor, short sPlayer) return -1; } } - if( id == g_iThisActorID ) + if ( id == g_iThisActorID ) { return sActor; } - if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER ) + if ( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER ) { // for the current player - if(sPlayer >=0 && sPlayer < MAXPLAYERS) + if (sPlayer >=0 && sPlayer < MAXPLAYERS) { //Bsprintf(g_szBuf,"GetGameVarID( %d, %d, %d) returns %ld\n",id,sActor,sPlayer, aGameVars[id].plValues[sPlayer]); //AddLog(g_szBuf); - if(m) return -aGameVars[id].plValues[sPlayer]; + if (m) return -aGameVars[id].plValues[sPlayer]; else return aGameVars[id].plValues[sPlayer]; } else { - if(m) return -aGameVars[id].lValue; + if (m) return -aGameVars[id].lValue; else return aGameVars[id].lValue; } } - else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR ) + else if ( aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR ) { // for the current actor - if(sActor >= 0 && sActor <=MAXSPRITES) + if (sActor >= 0 && sActor <=MAXSPRITES) { - if(m) return -aGameVars[id].plValues[sActor]; + if (m) return -aGameVars[id].plValues[sActor]; else return aGameVars[id].plValues[sActor]; } else { - if(m) return -aGameVars[id].lValue; + if (m) return -aGameVars[id].lValue; else return aGameVars[id].lValue; } } - else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG ) + else if ( aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG ) { - if(m) return -(*((long*)aGameVars[id].lValue)); + if (m) return -(*((long*)aGameVars[id].lValue)); else return (*((long*)aGameVars[id].lValue)); } else { - if(m) return -aGameVars[id].lValue; + if (m) return -aGameVars[id].lValue; else return aGameVars[id].lValue; } } void SetGameVarID(int id, long lValue, short sActor, short sPlayer) { - if(id<0 || id >= iGameVarCount) + if (id<0 || id >= iGameVarCount) { AddLog("Invalid Game ID"); return; } //Bsprintf(g_szBuf,"SGVI: %d ('%s') to %ld for %d %d",id,aGameVars[id].szLabel,lValue,sActor,sPlayer); //AddLog(g_szBuf); - if((aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER) && (sPlayer != -1)) + if ((aGameVars[id].dwFlags & GAMEVAR_FLAG_PERPLAYER) && (sPlayer != -1)) { // for the current player aGameVars[id].plValues[sPlayer]=lValue; } - else if((aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR) && (sActor != -1)) + else if ((aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR) && (sActor != -1)) { // for the current actor aGameVars[id].plValues[sActor]=lValue; } - else if( aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG ) + else if ( aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG ) { // set the value at pointer *((long*)aGameVars[id].lValue)=lValue; @@ -1507,11 +1507,11 @@ void SetGameVarID(int id, long lValue, short sActor, short sPlayer) long GetGameVar(char *szGameLabel, long lDefault, short sActor, short sPlayer) { int i; - for(i=0;i=0 ; i++) + for (i=0;pLabel[i].lId >=0 ; i++) { - if(!Bstrcasecmp(pLabel[i].name,psz)) + if (!Bstrcasecmp(pLabel[i].name,psz)) { l= pLabel[i].lId; break; // stop for loop @@ -1606,9 +1606,9 @@ long getlabeloffset(LABELS *pLabel, char *psz) // returns the offset in the array for the label, or -1 int i; - for(i=0;pLabel[i].lId >=0 ; i++) + for (i=0;pLabel[i].lId >=0 ; i++) { - if(!Bstrcasecmp(pLabel[i].name,psz)) + if (!Bstrcasecmp(pLabel[i].name,psz)) { // printf("Label has flags of %02X\n",pLabel[i].flags); return i; @@ -1623,16 +1623,16 @@ void getlabel(void) skipcomments(); - while( isalnum(*textptr) == 0 ) + while ( isalnum(*textptr) == 0 ) { - if(*textptr == 0x0a) line_number++; + if (*textptr == 0x0a) line_number++; textptr++; - if( *textptr == 0) + if ( *textptr == 0) return; } i = 0; - while( ispecial(*textptr) == 0 && *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r') + while ( ispecial(*textptr) == 0 && *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r') label[(labelcnt<<6)+i++] = *(textptr++); label[(labelcnt<<6)+i] = 0; @@ -1649,22 +1649,22 @@ long keyword(void) temptextptr = textptr; - while( isaltok(*temptextptr) == 0 ) + while ( isaltok(*temptextptr) == 0 ) { temptextptr++; - if( *temptextptr == 0 ) + if ( *temptextptr == 0 ) return 0; } i = 0; - while( isaltok(*temptextptr) ) + while ( isaltok(*temptextptr) ) { tempbuf[i] = *(temptextptr++); i++; } tempbuf[i] = 0; - for(i=0;i 63 || ( *textptr == '\0' ) || ( *(textptr+1) == '\0' ) ) return 1; + if ( (error+warning) > 63 || ( *textptr == '\0' ) || ( *(textptr+1) == '\0' ) ) return 1; - if(condebug) + if (condebug) ReportError(-1); if (checking_switch > 0 ) @@ -1989,13 +1989,13 @@ char parsecommand(void) skipcomments(); // yes? no? - switch(tw) + switch (tw) { default: case -1: return 0; //End case CON_STATE: - if( parsing_actor == 0 && parsing_state == 0 ) + if ( parsing_actor == 0 && parsing_state == 0 ) { getlabel(); scriptptr--; @@ -2010,16 +2010,16 @@ char parsecommand(void) getlabel(); - for(i=0;i 0 ) + if ( num_braces > 0 ) { ReportError(ERROR_OPENBRACKET); error++; } - if( num_braces < 0 ) + if ( num_braces < 0 ) { ReportError(ERROR_CLOSEBRACKET); error++; } - if( checking_switch > 0 ) + if ( checking_switch > 0 ) { ReportError(ERROR_NOENDSWITCH); error++; @@ -2083,78 +2083,78 @@ char parsecommand(void) case CON_SETTHISPROJECTILE: case CON_SETPROJECTILE: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_GETTHISPROJECTILE: case CON_GETPROJECTILE: + { + long lLabelID; + + // syntax getwall[].x + // gets the value of wall[].xxx into + + // now get name of .xxx + while ((*textptr != '[')) { - long lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while((*textptr != '[')) - { - textptr++; - } - if(*textptr == '[') - textptr++; - - // get the ID of the DEF - if(tw == CON_SETTHISPROJECTILE) - labelsonly = 1; - transvar(); - labelsonly = 0; - // now get name of .xxx - while(*textptr != '.') - { - if(*textptr == 0xa) - break; - if(!*textptr) - break; - - textptr++; - } - if(*textptr!='.') - { - error++; - ReportError(ERROR_SYNTAXERROR); - return 0; - } textptr++; - /// now pointing at 'xxx' - getlabel(); - //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); + } + if (*textptr == '[') + textptr++; - lLabelID=getlabeloffset(projectilelabels,label+(labelcnt<<6)); - //printf("LabelID is %ld\n",lLabelID); - if(lLabelID == -1 ) - { - error++; - ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - - *scriptptr++=projectilelabels[lLabelID].lId; - - //printf("member's flags are: %02Xh\n",playerlabels[lLabelID].flags); - - // now at target VAR... - - // get the ID of the DEF - switch(tw) - { - case CON_SETPROJECTILE: - case CON_SETTHISPROJECTILE: - transvar(); + // get the ID of the DEF + if (tw == CON_SETTHISPROJECTILE) + labelsonly = 1; + transvar(); + labelsonly = 0; + // now get name of .xxx + while (*textptr != '.') + { + if (*textptr == 0xa) break; - default: - transvartype(GAMEVAR_FLAG_READONLY); + if (!*textptr) break; - } + + textptr++; + } + if (*textptr!='.') + { + error++; + ReportError(ERROR_SYNTAXERROR); + return 0; + } + textptr++; + /// now pointing at 'xxx' + getlabel(); + //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); + + lLabelID=getlabeloffset(projectilelabels,label+(labelcnt<<6)); + //printf("LabelID is %ld\n",lLabelID); + if (lLabelID == -1 ) + { + error++; + ReportError(ERROR_SYMBOLNOTRECOGNIZED); + return 0; + } + + *scriptptr++=projectilelabels[lLabelID].lId; + + //printf("member's flags are: %02Xh\n",playerlabels[lLabelID].flags); + + // now at target VAR... + + // get the ID of the DEF + switch (tw) + { + case CON_SETPROJECTILE: + case CON_SETTHISPROJECTILE: + transvar(); + break; + default: + transvartype(GAMEVAR_FLAG_READONLY); break; } + break; + } case CON_GAMEVAR: // syntax: gamevar @@ -2163,7 +2163,7 @@ char parsecommand(void) // (see top of this files for flags) //printf("Got gamedef. Getting Label. '%.20s'\n",textptr); - if(isdigit(*textptr) || (*textptr == '-')) + if (isdigit(*textptr) || (*textptr == '-')) { getlabel(); error++; @@ -2178,19 +2178,19 @@ char parsecommand(void) //printf("Got Label '%.20s'\n",textptr); // Check to see it's already defined - for(i=0;i= defaultlabelcnt) { - if (i >= defaultlabelcnt) - { - warning++; - ReportError(WARNING_DUPLICATEDEFINITION); - } - break; + warning++; + ReportError(WARNING_DUPLICATEDEFINITION); } + break; } - //printf("Translating. '%.20s'\n",textptr); - transnum(LABEL_DEFINE); - //printf("Translated. '%.20s'\n",textptr); - if(i == labelcnt) - { - // printf("Defining Definition '%s' to be '%d'\n",label+(labelcnt<<6),*(scriptptr-1)); - labeltype[labelcnt] = LABEL_DEFINE; - labelcode[labelcnt++] = *(scriptptr-1); - if (*(scriptptr-1) >= 0 && *(scriptptr-1) < MAXTILES && dynamicremap) - processnames(label+(i<<6),*(scriptptr-1)); - } - scriptptr -= 2; - return 0; } + //printf("Translating. '%.20s'\n",textptr); + transnum(LABEL_DEFINE); + //printf("Translated. '%.20s'\n",textptr); + if (i == labelcnt) + { + // printf("Defining Definition '%s' to be '%d'\n",label+(labelcnt<<6),*(scriptptr-1)); + labeltype[labelcnt] = LABEL_DEFINE; + labelcode[labelcnt++] = *(scriptptr-1); + if (*(scriptptr-1) >= 0 && *(scriptptr-1) < MAXTILES && dynamicremap) + processnames(label+(i<<6),*(scriptptr-1)); + } + scriptptr -= 2; + return 0; + } case CON_PALFROM: - for(j=0;j<4;j++) + for (j=0;j<4;j++) { - if( keyword() == -1 ) + if ( keyword() == -1 ) transnum(LABEL_DEFINE); else break; } - while(j<4) + while (j<4) { *scriptptr = 0; scriptptr++; @@ -2277,12 +2277,12 @@ char parsecommand(void) return 0; case CON_MOVE: - if( parsing_actor || parsing_state ) + if ( parsing_actor || parsing_state ) { - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); - if((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) + if ((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) { ReportError(-1); *(scriptptr-1) = 0; @@ -2290,7 +2290,7 @@ char parsecommand(void) } j = 0; - while(keyword() == -1) + while (keyword() == -1) { transnum(LABEL_DEFINE); scriptptr--; @@ -2306,32 +2306,32 @@ char parsecommand(void) getlabel(); // Check to see it's already defined - for(i=0;i= 0) break; + if (keyword() >= 0) break; transnum(LABEL_DEFINE); } - for(k=j;k<2;k++) + for (k=j;k<2;k++) { *scriptptr = 0; scriptptr++; @@ -2340,78 +2340,78 @@ char parsecommand(void) return 0; case CON_MUSIC: + { + // NOTE: this doesn't get stored in the PCode... + + // music 1 stalker.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid + // thecall.mid ahgeez.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid + scriptptr--; + transnum(LABEL_DEFINE); // Volume Number (0/4) + scriptptr--; + + k = *scriptptr-1; + + if (k >= 0) // if it's background music { - // NOTE: this doesn't get stored in the PCode... - - // music 1 stalker.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid - // thecall.mid ahgeez.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid - scriptptr--; - transnum(LABEL_DEFINE); // Volume Number (0/4) - scriptptr--; - - k = *scriptptr-1; - - if(k >= 0) // if it's background music + i = 0; + // get the file name... + while (keyword() == -1) { - i = 0; - // get the file name... - while(keyword() == -1) + while ( isaltok(*textptr) == 0 ) { - while( isaltok(*textptr) == 0 ) - { - if(*textptr == 0x0a) line_number++; - textptr++; - if( *textptr == 0 ) break; - } - j = 0; - while( isaltok(*(textptr+j)) ) - { - music_fn[k][i][j] = textptr[j]; - j++; - } - music_fn[k][i][j] = '\0'; - textptr += j; - if(i > 9) break; - i++; + if (*textptr == 0x0a) line_number++; + textptr++; + if ( *textptr == 0 ) break; } - } - else - { - i = 0; - while(keyword() == -1) + j = 0; + while ( isaltok(*(textptr+j)) ) { - while( isaltok(*textptr) == 0 ) - { - if(*textptr == 0x0a) line_number++; - textptr++; - if( *textptr == 0 ) break; - } - j = 0; - while( isaltok(*(textptr+j)) ) - { - env_music_fn[i][j] = textptr[j]; - j++; - } - env_music_fn[i][j] = '\0'; - - textptr += j; - if(i > 9) break; - i++; + music_fn[k][i][j] = textptr[j]; + j++; } + music_fn[k][i][j] = '\0'; + textptr += j; + if (i > 9) break; + i++; } } - return 0; + else + { + i = 0; + while (keyword() == -1) + { + while ( isaltok(*textptr) == 0 ) + { + if (*textptr == 0x0a) line_number++; + textptr++; + if ( *textptr == 0 ) break; + } + j = 0; + while ( isaltok(*(textptr+j)) ) + { + env_music_fn[i][j] = textptr[j]; + j++; + } + env_music_fn[i][j] = '\0'; + + textptr += j; + if (i > 9) break; + i++; + } + } + } + return 0; case CON_INCLUDE: scriptptr--; - while( isaltok(*textptr) == 0 ) + while ( isaltok(*textptr) == 0 ) { - if(*textptr == 0x0a) line_number++; + if (*textptr == 0x0a) line_number++; textptr++; - if( *textptr == 0 ) break; + if ( *textptr == 0 ) break; } j = 0; - while( isaltok(*textptr) ) + while ( isaltok(*textptr) ) { tempbuf[j] = *(textptr++); j++; @@ -2426,7 +2426,7 @@ char parsecommand(void) int fp; fp = kopen4load(tempbuf,loadfromgrouponly); - if(fp < 0) + if (fp < 0) { error++; initprintf("%s:%ld: error: could not find file `%s'.\n",compilefile,line_number,tempbuf); @@ -2476,9 +2476,9 @@ char parsecommand(void) return 0; case CON_AI: - if( parsing_actor || parsing_state ) + if ( parsing_actor || parsing_state ) { - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); transnum(LABEL_AI); } @@ -2487,43 +2487,43 @@ char parsecommand(void) scriptptr--; getlabel(); - for(i=0;i= 0) break; - if(j == 1) + if (keyword() >= 0) break; + if (j == 1) transnum(LABEL_ACTION); - else if(j == 2) + else if (j == 2) { - if((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) + if ((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) { ReportError(-1); *(scriptptr-1) = 0; initprintf("%s:%ld: warning: expected a move, found a constant.\n",compilefile,line_number); } k = 0; - while(keyword() == -1) + while (keyword() == -1) { transnum(LABEL_DEFINE); scriptptr--; @@ -2534,7 +2534,7 @@ char parsecommand(void) return 0; } } - for(k=j;k<3;k++) + for (k=j;k<3;k++) { *scriptptr = 0; scriptptr++; @@ -2543,9 +2543,9 @@ char parsecommand(void) return 0; case CON_ACTION: - if( parsing_actor || parsing_state ) + if ( parsing_actor || parsing_state ) { - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); transnum(LABEL_ACTION); } @@ -2555,34 +2555,34 @@ char parsecommand(void) getlabel(); // Check to see it's already defined - for(i=0;i= 0) break; + if (keyword() >= 0) break; transnum(LABEL_DEFINE); } - for(k=j;k<5;k++) + for (k=j;k<5;k++) { *scriptptr = 0; scriptptr++; @@ -2591,7 +2591,7 @@ char parsecommand(void) return 0; case CON_ACTOR: - if( parsing_state || parsing_actor ) + if ( parsing_state || parsing_actor ) { ReportError(ERROR_FOUNDWITHIN); error++; @@ -2603,7 +2603,7 @@ char parsecommand(void) skipcomments(); j = 0; - while( isaltok(*(textptr+j)) ) + while ( isaltok(*(textptr+j)) ) { parsing_item_name[j] = textptr[j]; j++; @@ -2614,13 +2614,13 @@ char parsecommand(void) scriptptr--; actorscrptr[*scriptptr] = parsing_actor; - for(j=0;j<4;j++) + for (j=0;j<4;j++) { *(parsing_actor+j) = 0; - if(j == 3) + if (j == 3) { j = 0; - while(keyword() == -1) + while (keyword() == -1) { transnum(LABEL_DEFINE); scriptptr--; @@ -2632,17 +2632,19 @@ char parsecommand(void) } else { - if(keyword() >= 0) + if (keyword() >= 0) { for (i=4-j; i; i--) *(scriptptr++) = 0; break; } - switch(j) + switch (j) { - case 0: transnum(LABEL_DEFINE); break; - case 1: transnum(LABEL_ACTION); break; + case 0: + transnum(LABEL_DEFINE); break; + case 1: + transnum(LABEL_ACTION); break; case 2: - if((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) + if ((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) { ReportError(-1); *(scriptptr-1) = 0; @@ -2657,7 +2659,7 @@ char parsecommand(void) return 0; case CON_ONEVENT: - if( parsing_state || parsing_actor ) + if ( parsing_state || parsing_actor ) { ReportError(ERROR_FOUNDWITHIN); error++; @@ -2670,7 +2672,7 @@ char parsecommand(void) skipcomments(); j = 0; - while( isaltok(*(textptr+j)) ) + while ( isaltok(*(textptr+j)) ) { parsing_item_name[j] = textptr[j]; j++; @@ -2684,14 +2686,14 @@ char parsecommand(void) current_event = j; //Bsprintf(g_szBuf,"Adding Event for %d at %lX",j, parsing_event); //AddLog(g_szBuf); - if(j > MAXGAMEEVENTS-1 || j < 0) + if (j > MAXGAMEEVENTS-1 || j < 0) { initprintf("%s:%ld: error: invalid event ID.\n",compilefile,line_number); error++; return 0; } - if(apScriptGameEvent[j]) + if (apScriptGameEvent[j]) { tempscrptr = parsing_event; parsing_event = parsing_actor = 0; @@ -2706,7 +2708,7 @@ char parsecommand(void) return 0; case CON_EVENTLOADACTOR: - if( parsing_state || parsing_actor ) + if ( parsing_state || parsing_actor ) { ReportError(ERROR_FOUNDWITHIN); error++; @@ -2718,7 +2720,7 @@ char parsecommand(void) skipcomments(); j = 0; - while( isaltok(*(textptr+j)) ) + while ( isaltok(*(textptr+j)) ) { parsing_item_name[j] = textptr[j]; j++; @@ -2732,7 +2734,7 @@ char parsecommand(void) return 0; case CON_USERACTOR: - if( parsing_state || parsing_actor ) + if ( parsing_state || parsing_actor ) { ReportError(ERROR_FOUNDWITHIN); error++; @@ -2747,7 +2749,7 @@ char parsecommand(void) skipcomments(); j = 0; - while( isaltok(*(textptr+j)) ) + while ( isaltok(*(textptr+j)) ) { parsing_item_name[j] = textptr[j]; j++; @@ -2756,7 +2758,7 @@ char parsecommand(void) j = *scriptptr; - if(j > 2) + if (j > 2) { ReportError(-1); initprintf("%s:%ld: warning: invalid useractor type.\n",compilefile,line_number); @@ -2768,13 +2770,13 @@ char parsecommand(void) actorscrptr[*scriptptr] = parsing_actor; actortype[*scriptptr] = j; - for(j=0;j<4;j++) + for (j=0;j<4;j++) { *(parsing_actor+j) = 0; - if(j == 3) + if (j == 3) { j = 0; - while(keyword() == -1) + while (keyword() == -1) { transnum(LABEL_DEFINE); scriptptr--; @@ -2786,17 +2788,19 @@ char parsecommand(void) } else { - if(keyword() >= 0) + if (keyword() >= 0) { for (i=4-j; i; i--) *(scriptptr++) = 0; break; } - switch(j) + switch (j) { - case 0: transnum(LABEL_DEFINE); break; - case 1: transnum(LABEL_ACTION); break; + case 0: + transnum(LABEL_DEFINE); break; + case 1: + transnum(LABEL_ACTION); break; case 2: - if((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) + if ((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) { ReportError(-1); *(scriptptr-1) = 0; @@ -2811,21 +2815,21 @@ char parsecommand(void) return 0; case CON_INSERTSPRITEQ: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); return 0; case CON_QSPRINTF: transnum(LABEL_DEFINE); transnum(LABEL_DEFINE); - for(j = 0;j < 4;j++) + for (j = 0;j < 4;j++) { - if( keyword() == -1 ) + if ( keyword() == -1 ) transvar(); else break; } - while(j < 4) + while (j < 4) { *scriptptr = 0; scriptptr++; @@ -2857,7 +2861,7 @@ char parsecommand(void) case CON_CLIPDIST: case CON_LOTSOFGLASS: case CON_SAVE: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_ANGOFF: case CON_USERQUOTE: @@ -2869,13 +2873,13 @@ char parsecommand(void) transnum(LABEL_DEFINE); if (tw == CON_CSTAT) { - if(*(scriptptr-1) == 32767) + if (*(scriptptr-1) == 32767) { ReportError(-1); initprintf("%s:%ld: warning: tried to set cstat 32767, using 32768 instead.\n",compilefile,line_number); *(scriptptr-1) = 32768; } - else if((*(scriptptr-1) & 32) && (*(scriptptr-1) & 16)) + else if ((*(scriptptr-1) & 32) && (*(scriptptr-1) & 16)) { i = *(scriptptr-1); *(scriptptr-1) ^= 48; @@ -2896,14 +2900,14 @@ char parsecommand(void) case CON_DEBRIS: case CON_ADDINVENTORY: case CON_GUTS: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); transnum(LABEL_DEFINE); transnum(LABEL_DEFINE); break; case CON_ELSE: - if( checking_ifelse ) + if ( checking_ifelse ) { checking_ifelse--; tempscrptr = scriptptr; @@ -2921,67 +2925,67 @@ char parsecommand(void) return 0; case CON_SETSECTOR: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_GETSECTOR: + { + long lLabelID; + + // syntax getsector[].x + // gets the value of sector[].xxx into + + // now get name of .xxx + while ((*textptr != '[')) { - long lLabelID; - - // syntax getsector[].x - // gets the value of sector[].xxx into - - // now get name of .xxx - while((*textptr != '[')) - { - textptr++; - } - if(*textptr == '[') - textptr++; - - // get the ID of the DEF - labelsonly = 1; - transvar(); - labelsonly = 0; - // now get name of .xxx - while(*textptr != '.') - { - if(*textptr == 0xa) - break; - if(!*textptr) - break; - - textptr++; - } - if(*textptr!='.') - { - error++; - ReportError(ERROR_SYNTAXERROR); - return 0; - } textptr++; - /// now pointing at 'xxx' - getlabel(); - //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); - - lLabelID=getlabelid(sectorlabels,label+(labelcnt<<6)); - - if(lLabelID == -1 ) - { - error++; - ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - *scriptptr++=lLabelID; - - // now at target VAR... - - // get the ID of the DEF - if (tw==CON_GETSECTOR) - transvartype(GAMEVAR_FLAG_READONLY); - else - transvar(); - break; } + if (*textptr == '[') + textptr++; + + // get the ID of the DEF + labelsonly = 1; + transvar(); + labelsonly = 0; + // now get name of .xxx + while (*textptr != '.') + { + if (*textptr == 0xa) + break; + if (!*textptr) + break; + + textptr++; + } + if (*textptr!='.') + { + error++; + ReportError(ERROR_SYNTAXERROR); + return 0; + } + textptr++; + /// now pointing at 'xxx' + getlabel(); + //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); + + lLabelID=getlabelid(sectorlabels,label+(labelcnt<<6)); + + if (lLabelID == -1 ) + { + error++; + ReportError(ERROR_SYMBOLNOTRECOGNIZED); + return 0; + } + *scriptptr++=lLabelID; + + // now at target VAR... + + // get the ID of the DEF + if (tw==CON_GETSECTOR) + transvartype(GAMEVAR_FLAG_READONLY); + else + transvar(); + break; + } case CON_FINDNEARACTOR: case CON_FINDNEARACTOR3D: @@ -2989,510 +2993,510 @@ char parsecommand(void) case CON_FINDNEARSPRITE3D: case CON_FINDNEARACTORZ: case CON_FINDNEARSPRITEZ: + { + // syntax findnearactor + // gets the sprite ID of the nearest actor within max dist + // that is of into + // -1 for none found + + transnum(LABEL_DEFINE); // get + transnum(LABEL_DEFINE); // get maxdist + + switch (tw) { - // syntax findnearactor - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - - transnum(LABEL_DEFINE); // get - transnum(LABEL_DEFINE); // get maxdist - - switch(tw) - { - case CON_FINDNEARACTORZ: - case CON_FINDNEARSPRITEZ: - transnum(LABEL_DEFINE); - default: - break; - } - - // target var - // get the ID of the DEF - transvartype(GAMEVAR_FLAG_READONLY); + case CON_FINDNEARACTORZ: + case CON_FINDNEARSPRITEZ: + transnum(LABEL_DEFINE); + default: break; } + // target var + // get the ID of the DEF + transvartype(GAMEVAR_FLAG_READONLY); + break; + } + case CON_FINDNEARACTORVAR: case CON_FINDNEARACTOR3DVAR: case CON_FINDNEARSPRITEVAR: case CON_FINDNEARSPRITE3DVAR: case CON_FINDNEARACTORZVAR: case CON_FINDNEARSPRITEZVAR: - { - transnum(LABEL_DEFINE); // get + { + transnum(LABEL_DEFINE); // get - // get the ID of the DEF + // get the ID of the DEF + transvar(); + switch (tw) + { + case CON_FINDNEARACTORZVAR: + case CON_FINDNEARSPRITEZVAR: transvar(); - switch(tw) - { - case CON_FINDNEARACTORZVAR: - case CON_FINDNEARSPRITEZVAR: - transvar(); - default: - break; - } - // target var - // get the ID of the DEF - transvartype(GAMEVAR_FLAG_READONLY); + default: break; } + // target var + // get the ID of the DEF + transvartype(GAMEVAR_FLAG_READONLY); + break; + } case CON_SQRT: - { - // syntax sqrt - // gets the sqrt of invar into outvar + { + // syntax sqrt + // gets the sqrt of invar into outvar - // get the ID of the DEF - transvar(); - // target var - // get the ID of the DEF - transvartype(GAMEVAR_FLAG_READONLY); - break; - } + // get the ID of the DEF + transvar(); + // target var + // get the ID of the DEF + transvartype(GAMEVAR_FLAG_READONLY); + break; + } case CON_SETWALL: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_GETWALL: + { + long lLabelID; + + // syntax getwall[].x + // gets the value of wall[].xxx into + + // now get name of .xxx + while ((*textptr != '[')) { - long lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while((*textptr != '[')) - { - textptr++; - } - if(*textptr == '[') - textptr++; - - // get the ID of the DEF - labelsonly = 1; - transvar(); - labelsonly = 0; - // now get name of .xxx - while(*textptr != '.') - { - if(*textptr == 0xa) - break; - if(!*textptr) - break; - - textptr++; - } - if(*textptr!='.') - { - error++; - ReportError(ERROR_SYNTAXERROR); - return 0; - } textptr++; - /// now pointing at 'xxx' - getlabel(); - //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); - - lLabelID=getlabelid(walllabels,label+(labelcnt<<6)); - - if(lLabelID == -1 ) - { - error++; - ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - *scriptptr++=lLabelID; - - // now at target VAR... - - // get the ID of the DEF - if (tw == CON_GETWALL) - transvartype(GAMEVAR_FLAG_READONLY); - else - transvar(); - break; } + if (*textptr == '[') + textptr++; + + // get the ID of the DEF + labelsonly = 1; + transvar(); + labelsonly = 0; + // now get name of .xxx + while (*textptr != '.') + { + if (*textptr == 0xa) + break; + if (!*textptr) + break; + + textptr++; + } + if (*textptr!='.') + { + error++; + ReportError(ERROR_SYNTAXERROR); + return 0; + } + textptr++; + /// now pointing at 'xxx' + getlabel(); + //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); + + lLabelID=getlabelid(walllabels,label+(labelcnt<<6)); + + if (lLabelID == -1 ) + { + error++; + ReportError(ERROR_SYMBOLNOTRECOGNIZED); + return 0; + } + *scriptptr++=lLabelID; + + // now at target VAR... + + // get the ID of the DEF + if (tw == CON_GETWALL) + transvartype(GAMEVAR_FLAG_READONLY); + else + transvar(); + break; + } case CON_SETPLAYER: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_GETPLAYER: + { + long lLabelID; + + // syntax getwall[].x + // gets the value of wall[].xxx into + + // now get name of .xxx + while ((*textptr != '[')) { - long lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while((*textptr != '[')) - { - textptr++; - } - if(*textptr == '[') - textptr++; - - // get the ID of the DEF - labelsonly = 1; - transvar(); - labelsonly = 0; - // now get name of .xxx - while(*textptr != '.') - { - if(*textptr == 0xa) - break; - if(!*textptr) - break; - - textptr++; - } - if(*textptr!='.') - { - error++; - ReportError(ERROR_SYNTAXERROR); - return 0; - } textptr++; - /// now pointing at 'xxx' - getlabel(); - //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); - - lLabelID=getlabeloffset(playerlabels,label+(labelcnt<<6)); - //printf("LabelID is %ld\n",lLabelID); - if(lLabelID == -1 ) - { - error++; - ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - - *scriptptr++=playerlabels[lLabelID].lId; - - //printf("member's flags are: %02Xh\n",playerlabels[lLabelID].flags); - if (playerlabels[lLabelID].flags & LABEL_HASPARM2) - { - //printf("Member has PARM2\n"); - // get parm2 - // get the ID of the DEF - transvar(); - } - else - { - //printf("Member does not have Parm2\n"); - } - - // now at target VAR... - - // get the ID of the DEF - if (tw==CON_GETPLAYER) - transvartype(GAMEVAR_FLAG_READONLY); - else - transvar(); - break; } + if (*textptr == '[') + textptr++; + + // get the ID of the DEF + labelsonly = 1; + transvar(); + labelsonly = 0; + // now get name of .xxx + while (*textptr != '.') + { + if (*textptr == 0xa) + break; + if (!*textptr) + break; + + textptr++; + } + if (*textptr!='.') + { + error++; + ReportError(ERROR_SYNTAXERROR); + return 0; + } + textptr++; + /// now pointing at 'xxx' + getlabel(); + //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); + + lLabelID=getlabeloffset(playerlabels,label+(labelcnt<<6)); + //printf("LabelID is %ld\n",lLabelID); + if (lLabelID == -1 ) + { + error++; + ReportError(ERROR_SYMBOLNOTRECOGNIZED); + return 0; + } + + *scriptptr++=playerlabels[lLabelID].lId; + + //printf("member's flags are: %02Xh\n",playerlabels[lLabelID].flags); + if (playerlabels[lLabelID].flags & LABEL_HASPARM2) + { + //printf("Member has PARM2\n"); + // get parm2 + // get the ID of the DEF + transvar(); + } + else + { + //printf("Member does not have Parm2\n"); + } + + // now at target VAR... + + // get the ID of the DEF + if (tw==CON_GETPLAYER) + transvartype(GAMEVAR_FLAG_READONLY); + else + transvar(); + break; + } case CON_SETINPUT: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_GETINPUT: + { + long lLabelID; + + // syntax getwall[].x + // gets the value of wall[].xxx into + + // now get name of .xxx + while ((*textptr != '[')) { - long lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while((*textptr != '[')) - { - textptr++; - } - if(*textptr == '[') - textptr++; - - // get the ID of the DEF - labelsonly = 1; - transvar(); - labelsonly = 0; - // now get name of .xxx - while(*textptr != '.') - { - if(*textptr == 0xa) - break; - if(!*textptr) - break; - - textptr++; - } - if(*textptr!='.') - { - error++; - ReportError(ERROR_SYNTAXERROR); - return 0; - } textptr++; - /// now pointing at 'xxx' - getlabel(); - //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); - - lLabelID=getlabeloffset(inputlabels,label+(labelcnt<<6)); - //printf("LabelID is %ld\n",lLabelID); - if(lLabelID == -1 ) - { - error++; - ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - - *scriptptr++=inputlabels[lLabelID].lId; - - // now at target VAR... - - // get the ID of the DEF - if (tw==CON_GETINPUT) - transvartype(GAMEVAR_FLAG_READONLY); - else - transvar(); - break; } + if (*textptr == '[') + textptr++; + + // get the ID of the DEF + labelsonly = 1; + transvar(); + labelsonly = 0; + // now get name of .xxx + while (*textptr != '.') + { + if (*textptr == 0xa) + break; + if (!*textptr) + break; + + textptr++; + } + if (*textptr!='.') + { + error++; + ReportError(ERROR_SYNTAXERROR); + return 0; + } + textptr++; + /// now pointing at 'xxx' + getlabel(); + //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); + + lLabelID=getlabeloffset(inputlabels,label+(labelcnt<<6)); + //printf("LabelID is %ld\n",lLabelID); + if (lLabelID == -1 ) + { + error++; + ReportError(ERROR_SYMBOLNOTRECOGNIZED); + return 0; + } + + *scriptptr++=inputlabels[lLabelID].lId; + + // now at target VAR... + + // get the ID of the DEF + if (tw==CON_GETINPUT) + transvartype(GAMEVAR_FLAG_READONLY); + else + transvar(); + break; + } case CON_SETUSERDEF: case CON_GETUSERDEF: + { + long lLabelID; + + // syntax [gs]etuserdef.x + // gets the value of ud.xxx into + + // now get name of .xxx + while (*textptr != '.') { - long lLabelID; + if (*textptr == 0xa) + break; + if (!*textptr) + break; - // syntax [gs]etuserdef.x - // gets the value of ud.xxx into - - // now get name of .xxx - while(*textptr != '.') - { - if(*textptr == 0xa) - break; - if(!*textptr) - break; - - textptr++; - } - if(*textptr!='.') - { - error++; - ReportError(ERROR_SYNTAXERROR); - return 0; - } textptr++; - /// now pointing at 'xxx' - getlabel(); - //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); - - lLabelID=getlabelid(userdefslabels,label+(labelcnt<<6)); - - if(lLabelID == -1 ) - { - error++; - ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - *scriptptr++=lLabelID; - - // now at target VAR... - - // get the ID of the DEF - if (tw==CON_GETUSERDEF) - transvartype(GAMEVAR_FLAG_READONLY); - else - transvar(); - break; } + if (*textptr!='.') + { + error++; + ReportError(ERROR_SYNTAXERROR); + return 0; + } + textptr++; + /// now pointing at 'xxx' + getlabel(); + //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); + + lLabelID=getlabelid(userdefslabels,label+(labelcnt<<6)); + + if (lLabelID == -1 ) + { + error++; + ReportError(ERROR_SYMBOLNOTRECOGNIZED); + return 0; + } + *scriptptr++=lLabelID; + + // now at target VAR... + + // get the ID of the DEF + if (tw==CON_GETUSERDEF) + transvartype(GAMEVAR_FLAG_READONLY); + else + transvar(); + break; + } case CON_SETACTORVAR: case CON_SETPLAYERVAR: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_GETACTORVAR: case CON_GETPLAYERVAR: + { + // syntax [gs]etactorvar[]. + // gets the value of the per-actor variable varx into VAR + + // now get name of + while ((*textptr != '[')) { - // syntax [gs]etactorvar[]. - // gets the value of the per-actor variable varx into VAR - - // now get name of - while((*textptr != '[')) - { - textptr++; - } - if(*textptr == '[') - textptr++; - - // get the ID of the DEF - labelsonly = 1; - transvar(); - labelsonly = 0; - // now get name of . - while(*textptr != '.') - { - if(*textptr == 0xa) - break; - if(!*textptr) - break; - - textptr++; - } - if(*textptr!='.') - { - error++; - ReportError(ERROR_SYNTAXERROR); - return 0; - } textptr++; - /// now pointing at 'xxx' + } + if (*textptr == '[') + textptr++; - // get the ID of the DEF - getlabel(); - //printf("found label of '%s'\n", label+(labelcnt<<6)); + // get the ID of the DEF + labelsonly = 1; + transvar(); + labelsonly = 0; + // now get name of . + while (*textptr != '.') + { + if (*textptr == 0xa) + break; + if (!*textptr) + break; - // Check to see if it's a keyword - for(i=0;i].x + // gets the value of wall[].xxx into + + // now get name of .xxx + while ((*textptr != '[')) { - long lLabelID; - - // syntax getwall[].x - // gets the value of wall[].xxx into - - // now get name of .xxx - while((*textptr != '[')) - { - textptr++; - } - if(*textptr == '[') - textptr++; - - // get the ID of the DEF - labelsonly = 1; - transvar(); - labelsonly = 0; - // now get name of .xxx - while(*textptr != '.') - { - if(*textptr == 0xa) - break; - if(!*textptr) - break; - - textptr++; - } - if(*textptr!='.') - { - error++; - ReportError(ERROR_SYNTAXERROR); - return 0; - } textptr++; - /// now pointing at 'xxx' - getlabel(); - //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); - - lLabelID=getlabeloffset(actorlabels,label+(labelcnt<<6)); - //printf("LabelID is %ld\n",lLabelID); - if(lLabelID == -1 ) - { - error++; - ReportError(ERROR_SYMBOLNOTRECOGNIZED); - return 0; - } - - *scriptptr++=actorlabels[lLabelID].lId; - - //printf("member's flags are: %02Xh\n",actorlabels[lLabelID].flags); - if (actorlabels[lLabelID].flags & LABEL_HASPARM2) - { - //printf("Member has PARM2\n"); - // get parm2 - // get the ID of the DEF - transvar(); - } - else - { - //printf("Member does not have Parm2\n"); - } - - // now at target VAR... - - // get the ID of the DEF - if(tw == CON_GETACTOR) - transvartype(GAMEVAR_FLAG_READONLY); - else - transvar(); - break; } + if (*textptr == '[') + textptr++; + + // get the ID of the DEF + labelsonly = 1; + transvar(); + labelsonly = 0; + // now get name of .xxx + while (*textptr != '.') + { + if (*textptr == 0xa) + break; + if (!*textptr) + break; + + textptr++; + } + if (*textptr!='.') + { + error++; + ReportError(ERROR_SYNTAXERROR); + return 0; + } + textptr++; + /// now pointing at 'xxx' + getlabel(); + //printf("found xxx label of '%s'\n", label+(labelcnt<<6)); + + lLabelID=getlabeloffset(actorlabels,label+(labelcnt<<6)); + //printf("LabelID is %ld\n",lLabelID); + if (lLabelID == -1 ) + { + error++; + ReportError(ERROR_SYMBOLNOTRECOGNIZED); + return 0; + } + + *scriptptr++=actorlabels[lLabelID].lId; + + //printf("member's flags are: %02Xh\n",actorlabels[lLabelID].flags); + if (actorlabels[lLabelID].flags & LABEL_HASPARM2) + { + //printf("Member has PARM2\n"); + // get parm2 + // get the ID of the DEF + transvar(); + } + else + { + //printf("Member does not have Parm2\n"); + } + + // now at target VAR... + + // get the ID of the DEF + if (tw == CON_GETACTOR) + transvartype(GAMEVAR_FLAG_READONLY); + else + transvar(); + break; + } case CON_GETCURRADDRESS: transvartype(GAMEVAR_FLAG_READONLY); @@ -3509,7 +3513,7 @@ char parsecommand(void) case CON_INITTIMER: case CON_LOCKPLAYER: case CON_SHOOTVAR: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_JUMP: case CON_SOUNDVAR: @@ -3526,32 +3530,32 @@ char parsecommand(void) return 0; case CON_ENHANCED: + { + // don't store in pCode... + scriptptr--; + //printf("We are enhanced, baby...\n"); + transnum(LABEL_DEFINE); + scriptptr--; + if (*scriptptr > BYTEVERSION_JF) { - // don't store in pCode... - scriptptr--; - //printf("We are enhanced, baby...\n"); - transnum(LABEL_DEFINE); - scriptptr--; - if(*scriptptr > BYTEVERSION_JF) - { - warning++; - initprintf("%s:%ld: warning: need build %ld, found build %ld\n",compilefile,line_number,k,BYTEVERSION_JF); - } - break; + warning++; + initprintf("%s:%ld: warning: need build %ld, found build %ld\n",compilefile,line_number,k,BYTEVERSION_JF); } + break; + } case CON_DYNAMICREMAP: - { - scriptptr--; - initprintf("Dynamic tile remapping enabled.\n"); - dynamicremap = 1; - break; - } + { + scriptptr--; + initprintf("Dynamic tile remapping enabled.\n"); + dynamicremap = 1; + break; + } case CON_RANDVAR: case CON_ZSHOOT: case CON_EZSHOOT: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_SETVAR: case CON_ADDVAR: @@ -3572,14 +3576,14 @@ char parsecommand(void) //printf("Found [add|set]var at line= %ld\n",line_number); // get the ID of the DEF - if(tw != CON_ZSHOOT && tw != CON_EZSHOOT) + if (tw != CON_ZSHOOT && tw != CON_EZSHOOT) transvartype(GAMEVAR_FLAG_READONLY); else transvar(); transnum(LABEL_DEFINE); // the number to check against... return 0; case CON_RANDVARVAR: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_SETVARVAR: case CON_ADDVARVAR: @@ -3603,7 +3607,7 @@ char parsecommand(void) case CON_OPERATESECTORS: case CON_OPERATEACTIVATORS: case CON_SSP: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_GMAXAMMO: case CON_DIST: @@ -3613,7 +3617,7 @@ char parsecommand(void) case CON_MULSCALE: case CON_SETASPECT: // get the ID of the DEF - switch(tw) + switch (tw) { case CON_DIST: case CON_LDIST: @@ -3631,7 +3635,7 @@ char parsecommand(void) transvartype(GAMEVAR_FLAG_READONLY); else transvar(); - switch(tw) + switch (tw) { case CON_DIST: case CON_LDIST: @@ -3659,118 +3663,118 @@ char parsecommand(void) return 0; case CON_DEFINEPROJECTILE: + { + short y; + signed long z; + + if ( parsing_state || parsing_actor ) { - short y; - signed long z; - - if( parsing_state || parsing_actor ) - { - ReportError(ERROR_FOUNDWITHIN); - error++; - } - - scriptptr--; - - transnum(LABEL_DEFINE); - j = *(scriptptr-1); - - if(j > MAXTILES-1) - { - ReportError(ERROR_EXCEEDSMAXTILES); - error++; - } - - transnum(LABEL_DEFINE); - y = *(scriptptr-1); - transnum(LABEL_DEFINE); - z = *(scriptptr-1); - - DefineProjectile(j,y,z); - spriteflags[j] |= SPRITE_FLAG_PROJECTILE; - return 0; + ReportError(ERROR_FOUNDWITHIN); + error++; } + scriptptr--; + + transnum(LABEL_DEFINE); + j = *(scriptptr-1); + + if (j > MAXTILES-1) + { + ReportError(ERROR_EXCEEDSMAXTILES); + error++; + } + + transnum(LABEL_DEFINE); + y = *(scriptptr-1); + transnum(LABEL_DEFINE); + z = *(scriptptr-1); + + DefineProjectile(j,y,z); + spriteflags[j] |= SPRITE_FLAG_PROJECTILE; + return 0; + } + case CON_SPRITEFLAGS: + { + if ( parsing_actor == 0 && parsing_state == 0 ) { - if( parsing_actor == 0 && parsing_state == 0 ) - { - scriptptr--; - - transnum(LABEL_DEFINE); - scriptptr--; - j = *scriptptr; - - if(j > MAXTILES-1) - { - ReportError(ERROR_EXCEEDSMAXTILES); - error++; - } - - transnum(LABEL_DEFINE); - scriptptr--; - spriteflags[j] = *scriptptr; - - return 0; - } - if(!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - transvar(); - return 0; - } - - case CON_SPRITESHADOW: - case CON_SPRITENVG: - case CON_SPRITENOSHADE: - case CON_PRECACHE: - { - if( parsing_state || parsing_actor ) - { - ReportError(ERROR_FOUNDWITHIN); - error++; - } - scriptptr--; transnum(LABEL_DEFINE); scriptptr--; j = *scriptptr; - if(j > MAXTILES-1) + if (j > MAXTILES-1) { ReportError(ERROR_EXCEEDSMAXTILES); error++; } - switch (tw) - { - case CON_SPRITESHADOW: - spriteflags[*scriptptr] |= SPRITE_FLAG_SHADOW; - break; - case CON_SPRITENVG: - spriteflags[*scriptptr] |= SPRITE_FLAG_NVG; - break; - case CON_SPRITENOSHADE: - spriteflags[*scriptptr] |= SPRITE_FLAG_NOSHADE; - break; - case CON_PRECACHE: - spritecache[*scriptptr][0] = j; - transnum(LABEL_DEFINE); - scriptptr--; - i = *scriptptr; - if(i > MAXTILES-1) - { - ReportError(ERROR_EXCEEDSMAXTILES); - error++; - } - spritecache[j][1] = i; - transnum(LABEL_DEFINE); - scriptptr--; - i = *scriptptr; - spritecache[j][2] = i; - break; - } + transnum(LABEL_DEFINE); + scriptptr--; + spriteflags[j] = *scriptptr; + return 0; } + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + transvar(); + return 0; + } + + case CON_SPRITESHADOW: + case CON_SPRITENVG: + case CON_SPRITENOSHADE: + case CON_PRECACHE: + { + if ( parsing_state || parsing_actor ) + { + ReportError(ERROR_FOUNDWITHIN); + error++; + } + + scriptptr--; + + transnum(LABEL_DEFINE); + scriptptr--; + j = *scriptptr; + + if (j > MAXTILES-1) + { + ReportError(ERROR_EXCEEDSMAXTILES); + error++; + } + + switch (tw) + { + case CON_SPRITESHADOW: + spriteflags[*scriptptr] |= SPRITE_FLAG_SHADOW; + break; + case CON_SPRITENVG: + spriteflags[*scriptptr] |= SPRITE_FLAG_NVG; + break; + case CON_SPRITENOSHADE: + spriteflags[*scriptptr] |= SPRITE_FLAG_NOSHADE; + break; + case CON_PRECACHE: + spritecache[*scriptptr][0] = j; + transnum(LABEL_DEFINE); + scriptptr--; + i = *scriptptr; + if (i > MAXTILES-1) + { + ReportError(ERROR_EXCEEDSMAXTILES); + error++; + } + spritecache[j][1] = i; + transnum(LABEL_DEFINE); + scriptptr--; + i = *scriptptr; + spritecache[j][2] = i; + break; + } + return 0; + } case CON_IFVARVARG: case CON_IFVARVARL: @@ -3787,7 +3791,7 @@ char parsecommand(void) *tempscrptr = (long) scriptptr; - if(tw != CON_WHILEVARVARN) checking_ifelse++; + if (tw != CON_WHILEVARVARN) checking_ifelse++; return 0; case CON_SPGETLOTAG: @@ -3823,7 +3827,7 @@ char parsecommand(void) *tempscrptr = (long) scriptptr; - if(tw != CON_WHILEVARN) checking_ifelse++; + if (tw != CON_WHILEVARN) checking_ifelse++; return 0; case CON_ADDLOGVAR: @@ -3839,7 +3843,7 @@ char parsecommand(void) return 0; case CON_ROTATESPRITE: - if( parsing_event == 0 && parsing_state == 0) + if ( parsing_event == 0 && parsing_state == 0) { ReportError(ERROR_EVENTONLY); error++; @@ -3865,7 +3869,7 @@ char parsecommand(void) // get the ID of the DEF transmultvars(tw==CON_CANSEE?8:7); transmultvarstype(GAMEVAR_FLAG_READONLY,tw==CON_CANSEE?1:6); - if(tw==CON_HITSCAN) transvar(); + if (tw==CON_HITSCAN) transvar(); break; case CON_CANSEESPR: @@ -3886,7 +3890,7 @@ char parsecommand(void) case CON_MOVESPRITE: case CON_SETSPRITE: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); transmultvars(4); if (tw == CON_MOVESPRITE) { @@ -3898,13 +3902,13 @@ char parsecommand(void) case CON_MINITEXT: case CON_GAMETEXT: case CON_DIGITALNUMBER: - if( parsing_event == 0 && parsing_state == 0) + if ( parsing_event == 0 && parsing_state == 0) { ReportError(ERROR_EVENTONLY); error++; } - switch(tw) + switch (tw) { case CON_GAMETEXT: case CON_DIGITALNUMBER: @@ -3927,7 +3931,7 @@ char parsecommand(void) case CON_MYOSPAL: case CON_MYOSX: case CON_MYOSPALX: - if( parsing_event == 0 && parsing_state == 0) + if ( parsing_event == 0 && parsing_state == 0) { ReportError(ERROR_EVENTONLY); error++; @@ -3938,7 +3942,7 @@ char parsecommand(void) // myospal adds char pal transmultvars(5); - if(tw==CON_MYOSPAL || tw==CON_MYOSPALX) + if (tw==CON_MYOSPAL || tw==CON_MYOSPALX) { // Parse: pal @@ -3960,7 +3964,7 @@ char parsecommand(void) case CON_SWITCH: //AddLog("Got Switch statement"); - if(checking_switch) + if (checking_switch) { // Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=",__FILE__,__LINE__, checking_switch); // AddLog(g_szBuf); @@ -3985,12 +3989,12 @@ char parsecommand(void) j=CountCaseStatements(); //Bsprintf(g_szBuf,"Done Counting Case Statements: found %d.", j); //AddLog(g_szBuf); - if(checking_switch>1) + if (checking_switch>1) { // Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=",__FILE__,__LINE__, checking_switch); // AddLog(g_szBuf); } - if( j<0 ) + if ( j<0 ) { return 1; } @@ -4004,7 +4008,7 @@ char parsecommand(void) //AddLog(g_szBuf); } - while(j--) + while (j--) { // leave room for statements *scriptptr++=0; // value check @@ -4024,7 +4028,7 @@ char parsecommand(void) //Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr); //AddLog(g_szBuf); // done processing switch. clean up. - if(checking_switch!=1) + if (checking_switch!=1) { // Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=%d",__FILE__,__LINE__, checking_switch); // AddLog(g_szBuf); @@ -4043,7 +4047,7 @@ char parsecommand(void) // decremented in endswitch. Don't decrement here... // checking_switch--; // allow nesting (maybe if other things work) tempscrptr=NULL; - if(checking_switch) + if (checking_switch) { //Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=%d",__FILE__,__LINE__, checking_switch); //AddLog(g_szBuf); @@ -4055,7 +4059,7 @@ char parsecommand(void) //AddLog("Found Case"); repeatcase: scriptptr--; // don't save in code - if(checking_switch<1) + if (checking_switch<1) { error++; ReportError(-1); @@ -4066,7 +4070,7 @@ repeatcase: //Bsprintf(g_szBuf,"case1: %.12s",textptr); //AddLog(g_szBuf); transnum(LABEL_DEFINE); - if(*textptr == ':') + if (*textptr == ':') textptr++; //Bsprintf(g_szBuf,"case2: %.12s",textptr); //AddLog(g_szBuf); @@ -4074,7 +4078,7 @@ repeatcase: j=*(--scriptptr); // get value //Bsprintf(g_szBuf,"case: Value of case %ld is %ld",(long)casecount,(long)j); //AddLog(g_szBuf); - if( casescriptptr) + if ( casescriptptr) { //AddLog("Adding value to script"); casescriptptr[casecount++]=j; // save value @@ -4093,7 +4097,7 @@ repeatcase: } //Bsprintf(g_szBuf,"case4: '%.12s'",textptr); //AddLog(g_szBuf); - while(parsecommand() == 0) + while (parsecommand() == 0) { //Bsprintf(g_szBuf,"case5 '%.25s'",textptr); //AddLog(g_szBuf); @@ -4110,14 +4114,14 @@ repeatcase: // break; case CON_DEFAULT: scriptptr--; // don't save - if(checking_switch<1) + if (checking_switch<1) { error++; ReportError(-1); initprintf("%s:%ld: error: found `default' statement when not in switch\n",compilefile,line_number); return 1; } - if(casescriptptr && casescriptptr[0]!=0) + if (casescriptptr && casescriptptr[0]!=0) { // duplicate default statement error++; @@ -4130,7 +4134,7 @@ repeatcase: } //Bsprintf(g_szBuf,"default: '%.22s'",textptr); //AddLog(g_szBuf); - while( parsecommand() == 0) + while ( parsecommand() == 0) { //Bsprintf(g_szBuf,"defaultParse: '%.22s'",textptr); //AddLog(g_szBuf); @@ -4141,7 +4145,7 @@ repeatcase: case CON_ENDSWITCH: //AddLog("End Switch"); checking_switch--; - if(checking_switch < 0 ) + if (checking_switch < 0 ) { error++; ReportError(-1); @@ -4153,7 +4157,7 @@ repeatcase: //Bsprintf(g_szBuf,"Default Offset is %ld\n Total of %ld cases",casescriptptr[0],(long)casecount/2); //AddLog(g_szBuf); - for(i=1;i<=casecount;i++) + for (i=1;i<=casecount;i++) { if (i & 1) { @@ -4178,7 +4182,7 @@ repeatcase: case CON_CHANGESPRITESECT: case CON_ZSHOOTVAR: case CON_EZSHOOTVAR: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_GETPNAME: case CON_STARTLEVEL: @@ -4189,7 +4193,7 @@ repeatcase: return 0; case CON_SETACTORANGLE: case CON_SETPLAYERANGLE: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_GETANGLETOTARGET: case CON_GETACTORANGLE: @@ -4210,7 +4214,7 @@ repeatcase: case CON_IFPINVENTORY: case CON_IFRND: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_IFPDISTL: case CON_IFPDISTG: @@ -4232,7 +4236,7 @@ repeatcase: case CON_IFAI: case CON_IFACTION: case CON_IFMOVE: - switch(tw) + switch (tw) { case CON_IFAI: transnum(LABEL_AI); @@ -4241,7 +4245,7 @@ repeatcase: transnum(LABEL_ACTION); break; case CON_IFMOVE: - if((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) + if ((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) { ReportError(-1); *(scriptptr-1) = 0; @@ -4277,7 +4281,7 @@ repeatcase: case CON_IFAWAYFROMWALL: case CON_IFCANSEETARGET: case CON_IFNOSOUNDS: - if(tw == CON_IFP) + if (tw == CON_IFP) { j = 0; do @@ -4286,7 +4290,7 @@ repeatcase: scriptptr--; j |= *scriptptr; } - while(keyword() == -1); + while (keyword() == -1); *scriptptr = j; scriptptr++; } @@ -4303,7 +4307,7 @@ repeatcase: return 0; case CON_LEFTBRACE: - if(!(parsing_state || parsing_actor || parsing_event)) + if (!(parsing_state || parsing_actor || parsing_event)) { error++; ReportError(ERROR_SYNTAXERROR); @@ -4311,14 +4315,14 @@ repeatcase: num_braces++; do done = parsecommand(); - while( done == 0 ); + while ( done == 0 ); return 0; case CON_RIGHTBRACE: num_braces--; - if( num_braces < 0 ) + if ( num_braces < 0 ) { - if(checking_switch) + if (checking_switch) { ReportError(ERROR_NOENDSWITCH); } @@ -4332,7 +4336,7 @@ repeatcase: case CON_BETANAME: scriptptr--; j = 0; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; return 0; @@ -4341,27 +4345,27 @@ repeatcase: transnum(LABEL_DEFINE); scriptptr--; j = *scriptptr; - while( *textptr == ' ' || *textptr == '\t') textptr++; + while ( *textptr == ' ' || *textptr == '\t') textptr++; if (j < 0 || j > MAXVOLUMES-1) { initprintf("%s:%ld: error: volume number exceeds maximum volume count.\n",compilefile,line_number); error++; - while( *textptr != 0x0a && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0 ) textptr++; break; } i = 0; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) { volume_names[j][i] = toupper(*textptr); textptr++,i++; - if(i >= (signed)sizeof(volume_names[j])-1) + if (i >= (signed)sizeof(volume_names[j])-1) { initprintf("%s:%ld: error: volume name exceeds limit of %ld characters.\n",compilefile,line_number,sizeof(volume_names[j])-1); error++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; break; } } @@ -4374,28 +4378,28 @@ repeatcase: transnum(LABEL_DEFINE); scriptptr--; j = *scriptptr; - while( *textptr == ' ' || *textptr == '\t' ) textptr++; + while ( *textptr == ' ' || *textptr == '\t' ) textptr++; if (j < 0 || j > NUMGAMEFUNCTIONS-1) { initprintf("%s:%ld: error: function number exceeds number of game functions.\n",compilefile,line_number); error++; - while( *textptr != 0x0a && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0 ) textptr++; break; } i = 0; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) { gamefunctions[j][i] = *textptr; keydefaults[j*3][i] = *textptr; textptr++,i++; - if(i >= MAXGAMEFUNCLEN-1) + if (i >= MAXGAMEFUNCLEN-1) { initprintf("%s:%ld: error: function name exceeds limit of %ld characters.\n",compilefile,line_number,MAXGAMEFUNCLEN); error++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; break; } } @@ -4408,27 +4412,27 @@ repeatcase: transnum(LABEL_DEFINE); scriptptr--; j = *scriptptr; - while( *textptr == ' ' || *textptr == '\t' ) textptr++; + while ( *textptr == ' ' || *textptr == '\t' ) textptr++; if (j < 0 || j > 4) { initprintf("%s:%ld: error: skill number exceeds maximum skill count.\n",compilefile,line_number); error++; - while( *textptr != 0x0a && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0 ) textptr++; break; } i = 0; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) { skill_names[j][i] = toupper(*textptr); textptr++,i++; - if(i >= (signed)sizeof(skill_names[j])-1) + if (i >= (signed)sizeof(skill_names[j])-1) { initprintf("%s:%ld: error: skill name exceeds limit of %ld characters.\n",compilefile,line_number,sizeof(skill_names[j])-1); error++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; break; } } @@ -4445,28 +4449,28 @@ repeatcase: scriptptr--; //remove it from compiled code gametype_flags[j] = *scriptptr; //put it into the flags - while( *textptr == ' ' || *textptr == '\t' ) textptr++; + while ( *textptr == ' ' || *textptr == '\t' ) textptr++; if (j < 0 || j > MAXGAMETYPES-1) { initprintf("%s:%ld: error: gametype number exceeds maximum gametype count.\n",compilefile,line_number); error++; - while( *textptr != 0x0a && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0 ) textptr++; break; } num_gametypes = j+1; i = 0; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) { gametype_names[j][i] = toupper(*textptr); textptr++,i++; - if(i >= (signed)sizeof(gametype_names[j])-1) + if (i >= (signed)sizeof(gametype_names[j])-1) { initprintf("%s:%ld: error: gametype name exceeds limit of %ld characters.\n",compilefile,line_number,sizeof(gametype_names[j])-1); error++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; break; } } @@ -4481,13 +4485,13 @@ repeatcase: transnum(LABEL_DEFINE); scriptptr--; k = *scriptptr; - while( *textptr == ' ' || *textptr == '\t' ) textptr++; + while ( *textptr == ' ' || *textptr == '\t' ) textptr++; if (j < 0 || j > MAXVOLUMES-1) { initprintf("%s:%ld: error: volume number exceeds maximum volume count.\n",compilefile,line_number); error++; - while( *textptr != 0x0a && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0 ) textptr++; break; } if (k < 0 || k > 10) @@ -4495,52 +4499,52 @@ repeatcase: initprintf("%s:%ld: error: level number exceeds maximum number of levels per episode.\n", line_number,compilefile); error++; - while( *textptr != 0x0a && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0 ) textptr++; break; } i = 0; - while( *textptr != ' ' && *textptr != '\t' && *textptr != 0x0a ) + while ( *textptr != ' ' && *textptr != '\t' && *textptr != 0x0a ) { level_file_names[j*11+k][i] = *textptr; textptr++,i++; - if(i >= BMAX_PATH) + if (i >= BMAX_PATH) { initprintf("%s:%ld: error: level file name exceeds limit of %d characters.\n",compilefile,line_number,BMAX_PATH); error++; - while( *textptr != ' ' && *textptr != '\t') textptr++; + while ( *textptr != ' ' && *textptr != '\t') textptr++; break; } } level_names[j*11+k][i] = '\0'; - while( *textptr == ' ' || *textptr == '\t' ) textptr++; + while ( *textptr == ' ' || *textptr == '\t' ) textptr++; partime[j*11+k] = (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*26*60)+ (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*26); textptr += 5; - while( *textptr == ' ' || *textptr == '\t') textptr++; + while ( *textptr == ' ' || *textptr == '\t') textptr++; designertime[j*11+k] = (((*(textptr+0)-'0')*10+(*(textptr+1)-'0'))*26*60)+ (((*(textptr+3)-'0')*10+(*(textptr+4)-'0'))*26); textptr += 5; - while( *textptr == ' ' || *textptr == '\t') textptr++; + while ( *textptr == ' ' || *textptr == '\t') textptr++; i = 0; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) { level_names[j*11+k][i] = toupper(*textptr); textptr++,i++; - if(i >= (signed)sizeof(level_names[j*11+k])-1) + if (i >= (signed)sizeof(level_names[j*11+k])-1) { initprintf("%s:%ld: error: level name exceeds limit of %ld characters.\n",compilefile,line_number,sizeof(level_names[j*11+k])-1); error++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; break; } } @@ -4556,13 +4560,13 @@ repeatcase: k = *(scriptptr-1); - if(k >= MAXQUOTES) + if (k >= MAXQUOTES) { initprintf("%s:%ld: error: quote number exceeds limit of %ld.\n",compilefile,line_number,MAXQUOTES); error++; } - if(fta_quotes[k] == NULL) + if (fta_quotes[k] == NULL) fta_quotes[k] = Bcalloc(MAXQUOTELEN,sizeof(char)); if (!fta_quotes[k]) { @@ -4576,12 +4580,12 @@ repeatcase: i = 0; - while( *textptr == ' ' || *textptr == '\t' ) + while ( *textptr == ' ' || *textptr == '\t' ) textptr++; if (tw == CON_REDEFINEQUOTE) { - if(redefined_quotes[redefined_quote_count] == NULL) + if (redefined_quotes[redefined_quote_count] == NULL) redefined_quotes[redefined_quote_count] = Bcalloc(MAXQUOTELEN,sizeof(char)); if (!redefined_quotes[redefined_quote_count]) { @@ -4591,13 +4595,13 @@ repeatcase: } } - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) { - if(*textptr == '%' && *(textptr+1) == 's') + if (*textptr == '%' && *(textptr+1) == 's') { initprintf("%s:%ld: error: quote text contains string identifier.\n",compilefile,line_number); error++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; break; } if (tw == CON_DEFINEQUOTE) @@ -4605,11 +4609,11 @@ repeatcase: else *(redefined_quotes[redefined_quote_count]+i) = *textptr; textptr++,i++; - if(i >= MAXQUOTELEN-1) + if (i >= MAXQUOTELEN-1) { initprintf("%s:%ld: error: quote text exceeds limit of %ld characters.\n",compilefile,line_number,MAXQUOTELEN-1); error++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; break; } } @@ -4636,26 +4640,26 @@ repeatcase: transnum(LABEL_DEFINE); k = *(scriptptr-1); - if(k > 25) + if (k > 25) { initprintf("%s:%ld: error: cheat redefinition attempts to redefine nonexistant cheat.\n",compilefile,line_number); error++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++; break; } scriptptr--; i = 0; - while( *textptr == ' ' || *textptr == '\t' ) + while ( *textptr == ' ' || *textptr == '\t' ) textptr++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') { cheatquotes[k][i] = *textptr; textptr++,i++; - if(i >= (signed)sizeof(cheatquotes[k])-1) + if (i >= (signed)sizeof(cheatquotes[k])-1) { initprintf("%s:%ld: error: cheat exceeds limit of %ld characters.\n",compilefile,line_number,MAXCHEATLEN,sizeof(cheatquotes[k])-1); error++; - while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') textptr++; + while ( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') textptr++; break; } } @@ -4666,7 +4670,7 @@ repeatcase: scriptptr--; transnum(LABEL_DEFINE); k = *(scriptptr-1); - if(k >= NUM_SOUNDS) + if (k >= NUM_SOUNDS) { initprintf("%s:%ld: error: exceeded sound limit of %ld.\n",compilefile,line_number,NUM_SOUNDS); error++; @@ -4675,11 +4679,11 @@ repeatcase: i = 0; skipcomments(); - while( *textptr != ' ' || *textptr == '\t' ) + while ( *textptr != ' ' || *textptr == '\t' ) { sounds[k][i] = *textptr; textptr++,i++; - if(i >= BMAX_PATH) + if (i >= BMAX_PATH) { initprintf("%s:%ld: error: sound filename exceeds limit of %d characters.\n",compilefile,line_number,BMAX_PATH); error++; @@ -4708,18 +4712,18 @@ repeatcase: case CON_ENDEVENT: - if( parsing_event == 0) + if ( parsing_event == 0) { ReportError(-1); initprintf("%s:%ld: error: found `endevent' without open `onevent'.\n",compilefile,line_number); error++; } - if( num_braces > 0 ) + if ( num_braces > 0 ) { ReportError(ERROR_OPENBRACKET); error++; } - if( num_braces < 0 ) + if ( num_braces < 0 ) { ReportError(ERROR_CLOSEBRACKET); error++; @@ -4731,18 +4735,18 @@ repeatcase: return 0; case CON_ENDA: - if( parsing_actor == 0 ) + if ( parsing_actor == 0 ) { ReportError(-1); initprintf("%s:%ld: error: found `enda' without open `actor'.\n",compilefile,line_number); error++; } - if( num_braces > 0 ) + if ( num_braces > 0 ) { ReportError(ERROR_OPENBRACKET); error++; } - if( num_braces < 0 ) + if ( num_braces < 0 ) { ReportError(ERROR_CLOSEBRACKET); error++; @@ -4752,7 +4756,7 @@ repeatcase: return 0; case CON_BREAK: - if(checking_switch) + if (checking_switch) { //Bsprintf(g_szBuf," * (L%ld) case Break statement.\n",line_number); //AddLog(g_szBuf); @@ -4775,106 +4779,106 @@ repeatcase: case CON_PKICK: case CON_MIKESND: case CON_TOSSWEAPON: - if(!CheckEventSync(current_event)) + if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); case CON_NULLOP: case CON_STOPALLSOUNDS: return 0; case CON_GAMESTARTUP: + { + long params[30]; + + scriptptr--; + for (j = 0; j < 30; j++) { - long params[30]; - + transnum(LABEL_DEFINE); scriptptr--; - for(j = 0; j < 30; j++) - { - transnum(LABEL_DEFINE); - scriptptr--; - params[j] = *scriptptr; + params[j] = *scriptptr; - if (j != 25) continue; - - if (keyword() != -1) { - initprintf("Duke Nukem 3D v1.3D style CON files detected.\n"); - break; - } else { - conversion = 14; - initprintf("Duke Nukem 3D v1.4+ style CON files detected.\n"); - } + if (j != 25) continue; + if (keyword() != -1) { + initprintf("Duke Nukem 3D v1.3D style CON files detected.\n"); + break; + } else { + conversion = 14; + initprintf("Duke Nukem 3D v1.4+ style CON files detected.\n"); } - /* - v1.3d v1.5 - DEFAULTVISIBILITY DEFAULTVISIBILITY - GENERICIMPACTDAMAGE GENERICIMPACTDAMAGE - MAXPLAYERHEALTH MAXPLAYERHEALTH - STARTARMORHEALTH STARTARMORHEALTH - RESPAWNACTORTIME RESPAWNACTORTIME - RESPAWNITEMTIME RESPAWNITEMTIME - RUNNINGSPEED RUNNINGSPEED - RPGBLASTRADIUS GRAVITATIONALCONSTANT - PIPEBOMBRADIUS RPGBLASTRADIUS - SHRINKERBLASTRADIUS PIPEBOMBRADIUS - TRIPBOMBBLASTRADIUS SHRINKERBLASTRADIUS - MORTERBLASTRADIUS TRIPBOMBBLASTRADIUS - BOUNCEMINEBLASTRADIUS MORTERBLASTRADIUS - SEENINEBLASTRADIUS BOUNCEMINEBLASTRADIUS - MAXPISTOLAMMO SEENINEBLASTRADIUS - MAXSHOTGUNAMMO MAXPISTOLAMMO - MAXCHAINGUNAMMO MAXSHOTGUNAMMO - MAXRPGAMMO MAXCHAINGUNAMMO - MAXHANDBOMBAMMO MAXRPGAMMO - MAXSHRINKERAMMO MAXHANDBOMBAMMO - MAXDEVISTATORAMMO MAXSHRINKERAMMO - MAXTRIPBOMBAMMO MAXDEVISTATORAMMO - MAXFREEZEAMMO MAXTRIPBOMBAMMO - CAMERASDESTRUCTABLE MAXFREEZEAMMO - NUMFREEZEBOUNCES MAXGROWAMMO - FREEZERHURTOWNER CAMERASDESTRUCTABLE - NUMFREEZEBOUNCES - FREEZERHURTOWNER - QSIZE - TRIPBOMBLASERMODE - */ - - j = 0; - ud.const_visibility = params[j++]; - impact_damage = params[j++]; - max_player_health = params[j++]; - max_armour_amount = params[j++]; - respawnactortime = params[j++]; - respawnitemtime = params[j++]; - dukefriction = params[j++]; - if (conversion == 14) gc = params[j++]; - rpgblastradius = params[j++]; - pipebombblastradius = params[j++]; - shrinkerblastradius = params[j++]; - tripbombblastradius = params[j++]; - morterblastradius = params[j++]; - bouncemineblastradius = params[j++]; - seenineblastradius = params[j++]; - max_ammo_amount[PISTOL_WEAPON] = params[j++]; - max_ammo_amount[SHOTGUN_WEAPON] = params[j++]; - max_ammo_amount[CHAINGUN_WEAPON] = params[j++]; - max_ammo_amount[RPG_WEAPON] = params[j++]; - max_ammo_amount[HANDBOMB_WEAPON] = params[j++]; - max_ammo_amount[SHRINKER_WEAPON] = params[j++]; - max_ammo_amount[DEVISTATOR_WEAPON] = params[j++]; - max_ammo_amount[TRIPBOMB_WEAPON] = params[j++]; - max_ammo_amount[FREEZE_WEAPON] = params[j++]; - if (conversion == 14) max_ammo_amount[GROW_WEAPON] = params[j++]; - camerashitable = params[j++]; - numfreezebounces = params[j++]; - freezerhurtowner = params[j++]; - if (conversion == 14) { - spriteqamount = params[j++]; - if(spriteqamount > 1024) spriteqamount = 1024; - else if(spriteqamount < 0) spriteqamount = 0; - - lasermode = params[j++]; - } } - return 0; + + /* + v1.3d v1.5 + DEFAULTVISIBILITY DEFAULTVISIBILITY + GENERICIMPACTDAMAGE GENERICIMPACTDAMAGE + MAXPLAYERHEALTH MAXPLAYERHEALTH + STARTARMORHEALTH STARTARMORHEALTH + RESPAWNACTORTIME RESPAWNACTORTIME + RESPAWNITEMTIME RESPAWNITEMTIME + RUNNINGSPEED RUNNINGSPEED + RPGBLASTRADIUS GRAVITATIONALCONSTANT + PIPEBOMBRADIUS RPGBLASTRADIUS + SHRINKERBLASTRADIUS PIPEBOMBRADIUS + TRIPBOMBBLASTRADIUS SHRINKERBLASTRADIUS + MORTERBLASTRADIUS TRIPBOMBBLASTRADIUS + BOUNCEMINEBLASTRADIUS MORTERBLASTRADIUS + SEENINEBLASTRADIUS BOUNCEMINEBLASTRADIUS + MAXPISTOLAMMO SEENINEBLASTRADIUS + MAXSHOTGUNAMMO MAXPISTOLAMMO + MAXCHAINGUNAMMO MAXSHOTGUNAMMO + MAXRPGAMMO MAXCHAINGUNAMMO + MAXHANDBOMBAMMO MAXRPGAMMO + MAXSHRINKERAMMO MAXHANDBOMBAMMO + MAXDEVISTATORAMMO MAXSHRINKERAMMO + MAXTRIPBOMBAMMO MAXDEVISTATORAMMO + MAXFREEZEAMMO MAXTRIPBOMBAMMO + CAMERASDESTRUCTABLE MAXFREEZEAMMO + NUMFREEZEBOUNCES MAXGROWAMMO + FREEZERHURTOWNER CAMERASDESTRUCTABLE + NUMFREEZEBOUNCES + FREEZERHURTOWNER + QSIZE + TRIPBOMBLASERMODE + */ + + j = 0; + ud.const_visibility = params[j++]; + impact_damage = params[j++]; + max_player_health = params[j++]; + max_armour_amount = params[j++]; + respawnactortime = params[j++]; + respawnitemtime = params[j++]; + dukefriction = params[j++]; + if (conversion == 14) gc = params[j++]; + rpgblastradius = params[j++]; + pipebombblastradius = params[j++]; + shrinkerblastradius = params[j++]; + tripbombblastradius = params[j++]; + morterblastradius = params[j++]; + bouncemineblastradius = params[j++]; + seenineblastradius = params[j++]; + max_ammo_amount[PISTOL_WEAPON] = params[j++]; + max_ammo_amount[SHOTGUN_WEAPON] = params[j++]; + max_ammo_amount[CHAINGUN_WEAPON] = params[j++]; + max_ammo_amount[RPG_WEAPON] = params[j++]; + max_ammo_amount[HANDBOMB_WEAPON] = params[j++]; + max_ammo_amount[SHRINKER_WEAPON] = params[j++]; + max_ammo_amount[DEVISTATOR_WEAPON] = params[j++]; + max_ammo_amount[TRIPBOMB_WEAPON] = params[j++]; + max_ammo_amount[FREEZE_WEAPON] = params[j++]; + if (conversion == 14) max_ammo_amount[GROW_WEAPON] = params[j++]; + camerashitable = params[j++]; + numfreezebounces = params[j++]; + freezerhurtowner = params[j++]; + if (conversion == 14) { + spriteqamount = params[j++]; + if (spriteqamount > 1024) spriteqamount = 1024; + else if (spriteqamount < 0) spriteqamount = 0; + + lasermode = params[j++]; + } + } + return 0; } return 0; } @@ -4885,14 +4889,14 @@ void passone(void) int i; #endif - while( parsecommand() == 0 ); + while ( parsecommand() == 0 ); - if( (error+warning) > 63) + if ( (error+warning) > 63) initprintf( "fatal error: too many warnings or errors: Aborted\n"); #ifdef DEBUG initprintf("Game Definitions\n"); - for(i=0;i= MAXSPRITES) + if (proj < 0 || proj >= MAXSPRITES) return; - switch(lLabelID) + switch (lLabelID) { case PROJ_WORKSLIKE: - if(bSet) + if (bSet) thisprojectile[proj].workslike=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].workslike, sActor, sPlayer); break; case PROJ_SPAWNS: - if(bSet) + if (bSet) thisprojectile[proj].spawns=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].spawns, sActor, sPlayer); break; case PROJ_SXREPEAT: - if(bSet) + if (bSet) thisprojectile[proj].sxrepeat=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].sxrepeat, sActor, sPlayer); break; case PROJ_SYREPEAT: - if(bSet) + if (bSet) thisprojectile[proj].syrepeat=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].syrepeat, sActor, sPlayer); break; case PROJ_SOUND: - if(bSet) + if (bSet) thisprojectile[proj].sound=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].sound, sActor, sPlayer); break; case PROJ_ISOUND: - if(bSet) + if (bSet) thisprojectile[proj].isound=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].isound, sActor, sPlayer); break; case PROJ_VEL: - if(bSet) + if (bSet) thisprojectile[proj].vel=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].vel, sActor, sPlayer); break; case PROJ_EXTRA: - if(bSet) + if (bSet) thisprojectile[proj].extra=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].extra, sActor, sPlayer); break; case PROJ_DECAL: - if(bSet) + if (bSet) thisprojectile[proj].decal=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].decal, sActor, sPlayer); break; case PROJ_TRAIL: - if(bSet) + if (bSet) thisprojectile[proj].trail=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].trail, sActor, sPlayer); break; case PROJ_TXREPEAT: - if(bSet) + if (bSet) thisprojectile[proj].txrepeat=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].txrepeat, sActor, sPlayer); break; case PROJ_TYREPEAT: - if(bSet) + if (bSet) thisprojectile[proj].tyrepeat=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].tyrepeat, sActor, sPlayer); break; case PROJ_TOFFSET: - if(bSet) + if (bSet) thisprojectile[proj].toffset=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].toffset, sActor, sPlayer); break; case PROJ_TNUM: - if(bSet) + if (bSet) thisprojectile[proj].tnum=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].tnum, sActor, sPlayer); break; case PROJ_DROP: - if(bSet) + if (bSet) thisprojectile[proj].drop=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].drop, sActor, sPlayer); break; case PROJ_CSTAT: - if(bSet) + if (bSet) thisprojectile[proj].cstat=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].cstat, sActor, sPlayer); break; case PROJ_CLIPDIST: - if(bSet) + if (bSet) thisprojectile[proj].clipdist=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].clipdist, sActor, sPlayer); break; case PROJ_SHADE: - if(bSet) + if (bSet) thisprojectile[proj].shade=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].shade, sActor, sPlayer); break; case PROJ_XREPEAT: - if(bSet) + if (bSet) thisprojectile[proj].xrepeat=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].xrepeat, sActor, sPlayer); break; case PROJ_YREPEAT: - if(bSet) + if (bSet) thisprojectile[proj].yrepeat=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].yrepeat, sActor, sPlayer); break; case PROJ_PAL: - if(bSet) + if (bSet) thisprojectile[proj].pal=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].pal, sActor, sPlayer); break; case PROJ_EXTRA_RAND: - if(bSet) + if (bSet) thisprojectile[proj].extra_rand=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].extra_rand, sActor, sPlayer); break; case PROJ_HITRADIUS: - if(bSet) + if (bSet) thisprojectile[proj].hitradius=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].hitradius, sActor, sPlayer); break; case PROJ_VEL_MULT: - if(bSet) + if (bSet) thisprojectile[proj].velmult=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].velmult, sActor, sPlayer); break; case PROJ_OFFSET: - if(bSet) + if (bSet) thisprojectile[proj].offset=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].offset, sActor, sPlayer); break; case PROJ_BOUNCES: - if(bSet) + if (bSet) thisprojectile[proj].bounces=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].bounces, sActor, sPlayer); break; case PROJ_BSOUND: - if(bSet) + if (bSet) thisprojectile[proj].bsound=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].bsound, sActor, sPlayer); break; case PROJ_RANGE: - if(bSet) + if (bSet) thisprojectile[proj].range=lValue; else SetGameVarID((int)lVar2, thisprojectile[proj].range, sActor, sPlayer); @@ -1036,33 +1036,33 @@ void DoPlayer(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sh lValue=GetGameVarID((int)lVar2, sActor, sPlayer); - if(lVar1 == g_iThisActorID ) + if (lVar1 == g_iThisActorID ) // if they've asked for 'this', then use 'this player'... iPlayer=g_p; else iPlayer=GetGameVarID((int)lVar1, sActor, sPlayer); - if(iPlayer<0 || iPlayer >= MAXPLAYERS) + if (iPlayer<0 || iPlayer >= MAXPLAYERS) return; - switch(lLabelID) + switch (lLabelID) { case PLAYER_ZOOM: - if(bSet) + if (bSet) ps[iPlayer].zoom=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].zoom, sActor, sPlayer); break; case PLAYER_EXITX: - if(bSet) + if (bSet) ps[iPlayer].exitx=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].exitx, sActor, sPlayer); break; case PLAYER_EXITY: - if(bSet) + if (bSet) ps[iPlayer].exity=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].exity, sActor, sPlayer); @@ -1070,7 +1070,7 @@ void DoPlayer(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sh case PLAYER_LOOGIEX: lTemp=lParm2; - if(bSet) + if (bSet) ps[iPlayer].loogiex[lTemp]=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].loogiex[lTemp], sActor, sPlayer); @@ -1078,266 +1078,266 @@ void DoPlayer(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sh case PLAYER_LOOGIEY: lTemp=lParm2; - if(bSet) + if (bSet) ps[iPlayer].loogiey[lTemp]=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].loogiey[lTemp], sActor, sPlayer); break; case PLAYER_NUMLOOGS: - if(bSet) + if (bSet) ps[iPlayer].numloogs=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].numloogs, sActor, sPlayer); break; case PLAYER_LOOGCNT: - if(bSet) + if (bSet) ps[iPlayer].loogcnt=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].loogcnt, sActor, sPlayer); break; case PLAYER_POSX: - if(bSet) + if (bSet) ps[iPlayer].posx=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].posx, sActor, sPlayer); break; case PLAYER_POSY: - if(bSet) + if (bSet) ps[iPlayer].posy=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].posy, sActor, sPlayer); break; case PLAYER_POSZ: - if(bSet) + if (bSet) ps[iPlayer].posz=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].posz, sActor, sPlayer); break; case PLAYER_HORIZ: - if(bSet) + if (bSet) ps[iPlayer].horiz=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].horiz, sActor, sPlayer); break; case PLAYER_OHORIZ: - if(bSet) + if (bSet) ps[iPlayer].ohoriz=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].ohoriz, sActor, sPlayer); break; case PLAYER_OHORIZOFF: - if(bSet) + if (bSet) ps[iPlayer].ohorizoff=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].ohorizoff, sActor, sPlayer); break; case PLAYER_INVDISPTIME: - if(bSet) + if (bSet) ps[iPlayer].invdisptime=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].invdisptime, sActor, sPlayer); break; case PLAYER_BOBPOSX: - if(bSet) + if (bSet) ps[iPlayer].bobposx=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].bobposx, sActor, sPlayer); break; case PLAYER_BOBPOSY: - if(bSet) + if (bSet) ps[iPlayer].bobposy=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].bobposy, sActor, sPlayer); break; case PLAYER_OPOSX: - if(bSet) + if (bSet) ps[iPlayer].oposx=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].oposx, sActor, sPlayer); break; case PLAYER_OPOSY: - if(bSet) + if (bSet) ps[iPlayer].oposy=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].oposy, sActor, sPlayer); break; case PLAYER_OPOSZ: - if(bSet) + if (bSet) ps[iPlayer].oposz=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].oposz, sActor, sPlayer); break; case PLAYER_PYOFF: - if(bSet) + if (bSet) ps[iPlayer].pyoff=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].pyoff, sActor, sPlayer); break; case PLAYER_OPYOFF: - if(bSet) + if (bSet) ps[iPlayer].opyoff=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].opyoff, sActor, sPlayer); break; case PLAYER_POSXV: - if(bSet) + if (bSet) ps[iPlayer].posxv=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].posxv, sActor, sPlayer); break; case PLAYER_POSYV: - if(bSet) + if (bSet) ps[iPlayer].posyv=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].posyv, sActor, sPlayer); break; case PLAYER_POSZV: - if(bSet) + if (bSet) ps[iPlayer].poszv=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].poszv, sActor, sPlayer); break; case PLAYER_LAST_PISSED_TIME: - if(bSet) + if (bSet) ps[iPlayer].last_pissed_time=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].last_pissed_time, sActor, sPlayer); break; case PLAYER_TRUEFZ: - if(bSet) + if (bSet) ps[iPlayer].truefz=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].truefz, sActor, sPlayer); break; case PLAYER_TRUECZ: - if(bSet) + if (bSet) ps[iPlayer].truecz=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].truecz, sActor, sPlayer); break; case PLAYER_PLAYER_PAR: - if(bSet) + if (bSet) ps[iPlayer].player_par=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].player_par, sActor, sPlayer); break; case PLAYER_VISIBILITY: - if(bSet) + if (bSet) ps[iPlayer].visibility=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].visibility, sActor, sPlayer); break; case PLAYER_BOBCOUNTER: - if(bSet) + if (bSet) ps[iPlayer].bobcounter=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].bobcounter, sActor, sPlayer); break; case PLAYER_WEAPON_SWAY: - if(bSet) + if (bSet) ps[iPlayer].weapon_sway=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].weapon_sway, sActor, sPlayer); break; case PLAYER_PALS_TIME: - if(bSet) + if (bSet) ps[iPlayer].pals_time=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].pals_time, sActor, sPlayer); break; case PLAYER_RANDOMFLAMEX: - if(bSet) + if (bSet) ps[iPlayer].randomflamex=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].randomflamex, sActor, sPlayer); break; case PLAYER_CRACK_TIME: - if(bSet) + if (bSet) ps[iPlayer].crack_time=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].crack_time, sActor, sPlayer); break; case PLAYER_AIM_MODE: - if(bSet) + if (bSet) ps[iPlayer].aim_mode=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].aim_mode, sActor, sPlayer); break; case PLAYER_ANG: - if(bSet) + if (bSet) ps[iPlayer].ang=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].ang, sActor, sPlayer); break; case PLAYER_OANG: - if(bSet) + if (bSet) ps[iPlayer].oang=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].oang, sActor, sPlayer); break; case PLAYER_ANGVEL: - if(bSet) + if (bSet) ps[iPlayer].angvel=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].angvel, sActor, sPlayer); break; case PLAYER_CURSECTNUM: - if(bSet) + if (bSet) ps[iPlayer].cursectnum=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].cursectnum, sActor, sPlayer); break; case PLAYER_LOOK_ANG: - if(bSet) + if (bSet) ps[iPlayer].look_ang=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].look_ang, sActor, sPlayer); break; case PLAYER_LAST_EXTRA: - if(bSet) + if (bSet) ps[iPlayer].last_extra=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].last_extra, sActor, sPlayer); break; case PLAYER_SUBWEAPON: - if(bSet) + if (bSet) ps[iPlayer].subweapon=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].subweapon, sActor, sPlayer); @@ -1345,546 +1345,546 @@ void DoPlayer(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sh case PLAYER_AMMO_AMOUNT: lTemp=lParm2; - if(bSet) + if (bSet) ps[iPlayer].ammo_amount[lTemp]=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].ammo_amount[lTemp], sActor, sPlayer); break; case PLAYER_WACKEDBYACTOR: - if(bSet) + if (bSet) ps[iPlayer].wackedbyactor=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].wackedbyactor, sActor, sPlayer); break; case PLAYER_FRAG: - if(bSet) + if (bSet) ps[iPlayer].frag=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].frag, sActor, sPlayer); break; case PLAYER_FRAGGEDSELF: - if(bSet) + if (bSet) ps[iPlayer].fraggedself=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].fraggedself, sActor, sPlayer); break; case PLAYER_CURR_WEAPON: - if(bSet) + if (bSet) ps[iPlayer].curr_weapon=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].curr_weapon, sActor, sPlayer); break; case PLAYER_LAST_WEAPON: - if(bSet) + if (bSet) ps[iPlayer].last_weapon=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].last_weapon, sActor, sPlayer); break; case PLAYER_TIPINCS: - if(bSet) + if (bSet) ps[iPlayer].tipincs=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].tipincs, sActor, sPlayer); break; case PLAYER_HORIZOFF: - if(bSet) + if (bSet) ps[iPlayer].horizoff=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].horizoff, sActor, sPlayer); break; case PLAYER_WANTWEAPONFIRE: - if(bSet) + if (bSet) ps[iPlayer].wantweaponfire=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].wantweaponfire, sActor, sPlayer); break; case PLAYER_HOLODUKE_AMOUNT: - if(bSet) + if (bSet) ps[iPlayer].holoduke_amount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].holoduke_amount, sActor, sPlayer); break; case PLAYER_NEWOWNER: - if(bSet) + if (bSet) ps[iPlayer].newowner=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].newowner, sActor, sPlayer); break; case PLAYER_HURT_DELAY: - if(bSet) + if (bSet) ps[iPlayer].hurt_delay=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].hurt_delay, sActor, sPlayer); break; case PLAYER_HBOMB_HOLD_DELAY: - if(bSet) + if (bSet) ps[iPlayer].hbomb_hold_delay=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].hbomb_hold_delay, sActor, sPlayer); break; case PLAYER_JUMPING_COUNTER: - if(bSet) + if (bSet) ps[iPlayer].jumping_counter=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].jumping_counter, sActor, sPlayer); break; case PLAYER_AIRLEFT: - if(bSet) + if (bSet) ps[iPlayer].airleft=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].airleft, sActor, sPlayer); break; case PLAYER_KNEE_INCS: - if(bSet) + if (bSet) ps[iPlayer].knee_incs=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].knee_incs, sActor, sPlayer); break; case PLAYER_ACCESS_INCS: - if(bSet) + if (bSet) ps[iPlayer].access_incs=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].access_incs, sActor, sPlayer); break; case PLAYER_FTA: - if(bSet) + if (bSet) ps[iPlayer].fta=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].fta, sActor, sPlayer); break; case PLAYER_FTQ: - if(bSet) + if (bSet) ps[iPlayer].ftq=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].ftq, sActor, sPlayer); break; case PLAYER_ACCESS_WALLNUM: - if(bSet) + if (bSet) ps[iPlayer].access_wallnum=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].access_wallnum, sActor, sPlayer); break; case PLAYER_ACCESS_SPRITENUM: - if(bSet) + if (bSet) ps[iPlayer].access_spritenum=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].access_spritenum, sActor, sPlayer); break; case PLAYER_KICKBACK_PIC: - if(bSet) + if (bSet) ps[iPlayer].kickback_pic=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].kickback_pic, sActor, sPlayer); break; case PLAYER_GOT_ACCESS: - if(bSet) + if (bSet) ps[iPlayer].got_access=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].got_access, sActor, sPlayer); break; case PLAYER_WEAPON_ANG: - if(bSet) + if (bSet) ps[iPlayer].weapon_ang=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].weapon_ang, sActor, sPlayer); break; case PLAYER_FIRSTAID_AMOUNT: - if(bSet) + if (bSet) ps[iPlayer].firstaid_amount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].firstaid_amount, sActor, sPlayer); break; case PLAYER_SOMETHINGONPLAYER: - if(bSet) + if (bSet) ps[iPlayer].somethingonplayer=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].somethingonplayer, sActor, sPlayer); break; case PLAYER_ON_CRANE: - if(bSet) + if (bSet) ps[iPlayer].on_crane=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].on_crane, sActor, sPlayer); break; case PLAYER_I: - if(bSet) + if (bSet) ps[iPlayer].i=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].i, sActor, sPlayer); break; case PLAYER_ONE_PARALLAX_SECTNUM: - if(bSet) + if (bSet) ps[iPlayer].one_parallax_sectnum=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].one_parallax_sectnum, sActor, sPlayer); break; case PLAYER_OVER_SHOULDER_ON: - if(bSet) + if (bSet) ps[iPlayer].over_shoulder_on=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].over_shoulder_on, sActor, sPlayer); break; case PLAYER_RANDOM_CLUB_FRAME: - if(bSet) + if (bSet) ps[iPlayer].random_club_frame=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].random_club_frame, sActor, sPlayer); break; case PLAYER_FIST_INCS: - if(bSet) + if (bSet) ps[iPlayer].fist_incs=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].fist_incs, sActor, sPlayer); break; case PLAYER_ONE_EIGHTY_COUNT: - if(bSet) + if (bSet) ps[iPlayer].one_eighty_count=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].one_eighty_count, sActor, sPlayer); break; case PLAYER_CHEAT_PHASE: - if(bSet) + if (bSet) ps[iPlayer].cheat_phase=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].cheat_phase, sActor, sPlayer); break; case PLAYER_DUMMYPLAYERSPRITE: - if(bSet) + if (bSet) ps[iPlayer].dummyplayersprite=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].dummyplayersprite, sActor, sPlayer); break; case PLAYER_EXTRA_EXTRA8: - if(bSet) + if (bSet) ps[iPlayer].extra_extra8=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].extra_extra8, sActor, sPlayer); break; case PLAYER_QUICK_KICK: - if(bSet) + if (bSet) ps[iPlayer].quick_kick=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].quick_kick, sActor, sPlayer); break; case PLAYER_HEAT_AMOUNT: - if(bSet) + if (bSet) ps[iPlayer].heat_amount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].heat_amount, sActor, sPlayer); break; case PLAYER_ACTORSQU: - if(bSet) + if (bSet) ps[iPlayer].actorsqu=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].actorsqu, sActor, sPlayer); break; case PLAYER_TIMEBEFOREEXIT: - if(bSet) + if (bSet) ps[iPlayer].timebeforeexit=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].timebeforeexit, sActor, sPlayer); break; case PLAYER_CUSTOMEXITSOUND: - if(bSet) + if (bSet) ps[iPlayer].customexitsound=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].customexitsound, sActor, sPlayer); break; case PLAYER_WEAPRECS: - if(bSet) + if (bSet) ps[iPlayer].weaprecs[16]=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].weaprecs[16], sActor, sPlayer); break; case PLAYER_WEAPRECCNT: - if(bSet) + if (bSet) ps[iPlayer].weapreccnt=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].weapreccnt, sActor, sPlayer); break; case PLAYER_INTERFACE_TOGGLE_FLAG: - if(bSet) + if (bSet) ps[iPlayer].interface_toggle_flag=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].interface_toggle_flag, sActor, sPlayer); break; case PLAYER_ROTSCRNANG: - if(bSet) + if (bSet) ps[iPlayer].rotscrnang=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].rotscrnang, sActor, sPlayer); break; case PLAYER_DEAD_FLAG: - if(bSet) + if (bSet) ps[iPlayer].dead_flag=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].dead_flag, sActor, sPlayer); break; case PLAYER_SHOW_EMPTY_WEAPON: - if(bSet) + if (bSet) ps[iPlayer].show_empty_weapon=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].show_empty_weapon, sActor, sPlayer); break; case PLAYER_SCUBA_AMOUNT: - if(bSet) + if (bSet) ps[iPlayer].scuba_amount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].scuba_amount, sActor, sPlayer); break; case PLAYER_JETPACK_AMOUNT: - if(bSet) + if (bSet) ps[iPlayer].jetpack_amount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].jetpack_amount, sActor, sPlayer); break; case PLAYER_STEROIDS_AMOUNT: - if(bSet) + if (bSet) ps[iPlayer].steroids_amount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].steroids_amount, sActor, sPlayer); break; case PLAYER_SHIELD_AMOUNT: - if(bSet) + if (bSet) ps[iPlayer].shield_amount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].shield_amount, sActor, sPlayer); break; case PLAYER_HOLODUKE_ON: - if(bSet) + if (bSet) ps[iPlayer].holoduke_on=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].holoduke_on, sActor, sPlayer); break; case PLAYER_PYCOUNT: - if(bSet) + if (bSet) ps[iPlayer].pycount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].pycount, sActor, sPlayer); break; case PLAYER_WEAPON_POS: - if(bSet) + if (bSet) ps[iPlayer].weapon_pos=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].weapon_pos, sActor, sPlayer); break; case PLAYER_FRAG_PS: - if(bSet) + if (bSet) ps[iPlayer].frag_ps=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].frag_ps, sActor, sPlayer); break; case PLAYER_TRANSPORTER_HOLD: - if(bSet) + if (bSet) ps[iPlayer].transporter_hold=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].transporter_hold, sActor, sPlayer); break; case PLAYER_LAST_FULL_WEAPON: - if(bSet) + if (bSet) ps[iPlayer].last_full_weapon=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].last_full_weapon, sActor, sPlayer); break; case PLAYER_FOOTPRINTSHADE: - if(bSet) + if (bSet) ps[iPlayer].footprintshade=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].footprintshade, sActor, sPlayer); break; case PLAYER_BOOT_AMOUNT: - if(bSet) + if (bSet) ps[iPlayer].boot_amount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].boot_amount, sActor, sPlayer); break; case PLAYER_SCREAM_VOICE: - if(bSet) + if (bSet) ps[iPlayer].scream_voice=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].scream_voice, sActor, sPlayer); break; case PLAYER_GM: - if(bSet) + if (bSet) ps[iPlayer].gm=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].gm, sActor, sPlayer); break; case PLAYER_ON_WARPING_SECTOR: - if(bSet) + if (bSet) ps[iPlayer].on_warping_sector=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].on_warping_sector, sActor, sPlayer); break; case PLAYER_FOOTPRINTCOUNT: - if(bSet) + if (bSet) ps[iPlayer].footprintcount=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].footprintcount, sActor, sPlayer); break; case PLAYER_HBOMB_ON: - if(bSet) + if (bSet) ps[iPlayer].hbomb_on=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].hbomb_on, sActor, sPlayer); break; case PLAYER_JUMPING_TOGGLE: - if(bSet) + if (bSet) ps[iPlayer].jumping_toggle=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].jumping_toggle, sActor, sPlayer); break; case PLAYER_RAPID_FIRE_HOLD: - if(bSet) + if (bSet) ps[iPlayer].rapid_fire_hold=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].rapid_fire_hold, sActor, sPlayer); break; case PLAYER_ON_GROUND: - if(bSet) + if (bSet) ps[iPlayer].on_ground=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].on_ground, sActor, sPlayer); break; case PLAYER_NAME: - if(bSet) + if (bSet) ps[iPlayer].name[32]=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].name[32], sActor, sPlayer); break; case PLAYER_INVEN_ICON: - if(bSet) + if (bSet) ps[iPlayer].inven_icon=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].inven_icon, sActor, sPlayer); break; case PLAYER_BUTTONPALETTE: - if(bSet) + if (bSet) ps[iPlayer].buttonpalette=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].buttonpalette, sActor, sPlayer); break; case PLAYER_JETPACK_ON: - if(bSet) + if (bSet) ps[iPlayer].jetpack_on=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].jetpack_on, sActor, sPlayer); break; case PLAYER_SPRITEBRIDGE: - if(bSet) + if (bSet) ps[iPlayer].spritebridge=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].spritebridge, sActor, sPlayer); break; case PLAYER_LASTRANDOMSPOT: - if(bSet) + if (bSet) ps[iPlayer].lastrandomspot=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].lastrandomspot, sActor, sPlayer); break; case PLAYER_SCUBA_ON: - if(bSet) + if (bSet) ps[iPlayer].scuba_on=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].scuba_on, sActor, sPlayer); break; case PLAYER_FOOTPRINTPAL: - if(bSet) + if (bSet) ps[iPlayer].footprintpal=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].footprintpal, sActor, sPlayer); break; case PLAYER_HEAT_ON: - if(bSet) + if (bSet) ps[iPlayer].heat_on=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].heat_on, sActor, sPlayer); break; case PLAYER_HOLSTER_WEAPON: - if(bSet) + if (bSet) ps[iPlayer].holster_weapon=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].holster_weapon, sActor, sPlayer); break; case PLAYER_FALLING_COUNTER: - if(bSet) + if (bSet) ps[iPlayer].falling_counter=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].falling_counter, sActor, sPlayer); @@ -1892,14 +1892,14 @@ void DoPlayer(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sh case PLAYER_GOTWEAPON: lTemp=lParm2; - if(bSet) + if (bSet) ps[iPlayer].gotweapon[lTemp]=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].gotweapon[lTemp], sActor, sPlayer); break; case PLAYER_REFRESH_INVENTORY: - if(bSet) + if (bSet) ps[iPlayer].refresh_inventory=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].refresh_inventory, sActor, sPlayer); @@ -1917,49 +1917,49 @@ void DoPlayer(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sh // break; case PLAYER_TOGGLE_KEY_FLAG: - if(bSet) + if (bSet) ps[iPlayer].toggle_key_flag=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].toggle_key_flag, sActor, sPlayer); break; case PLAYER_KNUCKLE_INCS: - if(bSet) + if (bSet) ps[iPlayer].knuckle_incs=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].knuckle_incs, sActor, sPlayer); break; case PLAYER_WALKING_SND_TOGGLE: - if(bSet) + if (bSet) ps[iPlayer].walking_snd_toggle=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].walking_snd_toggle, sActor, sPlayer); break; case PLAYER_PALOOKUP: - if(bSet) + if (bSet) ps[iPlayer].palookup=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].palookup, sActor, sPlayer); break; case PLAYER_HARD_LANDING: - if(bSet) + if (bSet) ps[iPlayer].hard_landing=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].hard_landing, sActor, sPlayer); break; case PLAYER_MAX_SECRET_ROOMS: - if(bSet) + if (bSet) ps[iPlayer].max_secret_rooms=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].max_secret_rooms, sActor, sPlayer); break; case PLAYER_SECRET_ROOMS: - if(bSet) + if (bSet) ps[iPlayer].secret_rooms=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].secret_rooms, sActor, sPlayer); @@ -1967,84 +1967,84 @@ void DoPlayer(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sh case PLAYER_PALS: lTemp=lParm2; - if(bSet) + if (bSet) ps[iPlayer].pals[lTemp]=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].pals[lTemp], sActor, sPlayer); break; case PLAYER_MAX_ACTORS_KILLED: - if(bSet) + if (bSet) ps[iPlayer].max_actors_killed=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].max_actors_killed, sActor, sPlayer); break; case PLAYER_ACTORS_KILLED: - if(bSet) + if (bSet) ps[iPlayer].actors_killed=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].actors_killed, sActor, sPlayer); break; case PLAYER_RETURN_TO_CENTER: - if(bSet) + if (bSet) ps[iPlayer].return_to_center=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].return_to_center, sActor, sPlayer); break; case PLAYER_RUNSPEED: - if(bSet) + if (bSet) ps[iPlayer].runspeed=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].runspeed, sActor, sPlayer); break; case PLAYER_SBS: - if(bSet) + if (bSet) ps[iPlayer].sbs=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].sbs, sActor, sPlayer); break; case PLAYER_RELOADING: - if(bSet) + if (bSet) ps[iPlayer].reloading=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].reloading, sActor, sPlayer); break; case PLAYER_AUTO_AIM: - if(bSet) + if (bSet) ps[iPlayer].auto_aim=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].auto_aim, sActor, sPlayer); break; case PLAYER_MOVEMENT_LOCK: - if(bSet) + if (bSet) ps[iPlayer].movement_lock=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].movement_lock, sActor, sPlayer); break; case PLAYER_SOUND_PITCH: - if(bSet) + if (bSet) ps[iPlayer].sound_pitch=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].sound_pitch, sActor, sPlayer); break; case PLAYER_WEAPONSWITCH: - if(bSet) + if (bSet) ps[iPlayer].weaponswitch=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].weaponswitch, sActor, sPlayer); break; case PLAYER_TEAM: - if(bSet) + if (bSet) ps[iPlayer].team=lValue; else SetGameVarID((int)lVar2, ps[iPlayer].team, sActor, sPlayer); @@ -2063,7 +2063,7 @@ void DoInput(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sho lValue=GetGameVarID((int)lVar2, sActor, sPlayer); - if(lVar1 == g_iThisActorID ) + if (lVar1 == g_iThisActorID ) { // if they've asked for 'this', then use 'this player'... iPlayer=g_p; @@ -2071,48 +2071,48 @@ void DoInput(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sho else iPlayer=GetGameVarID((int)lVar1, sActor, sPlayer); - if(iPlayer<0 || iPlayer >= MAXPLAYERS) + if (iPlayer<0 || iPlayer >= MAXPLAYERS) return; - switch(lLabelID) + switch (lLabelID) { case INPUT_AVEL: - if(bSet) + if (bSet) sync[iPlayer].avel=lValue; else SetGameVarID((int)lVar2, sync[iPlayer].avel, sActor, sPlayer); break; case INPUT_HORZ: - if(bSet) + if (bSet) sync[iPlayer].horz=lValue; else SetGameVarID((int)lVar2, sync[iPlayer].horz, sActor, sPlayer); break; case INPUT_FVEL: - if(bSet) + if (bSet) sync[iPlayer].fvel=lValue; else SetGameVarID((int)lVar2, sync[iPlayer].fvel, sActor, sPlayer); break; case INPUT_SVEL: - if(bSet) + if (bSet) sync[iPlayer].svel=lValue; else SetGameVarID((int)lVar2, sync[iPlayer].svel, sActor, sPlayer); break; case INPUT_BITS: - if(bSet) + if (bSet) sync[iPlayer].bits=lValue; else SetGameVarID((int)lVar2, sync[iPlayer].bits, sActor, sPlayer); break; case INPUT_EXTBITS: - if(bSet) + if (bSet) sync[iPlayer].extbits=lValue; else SetGameVarID((int)lVar2, sync[iPlayer].extbits, sActor, sPlayer); @@ -2132,125 +2132,125 @@ void DoWall(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, shor iWall=GetGameVarID((int)lVar1, sActor, sPlayer); - if(iWall<0 || iWall >= MAXWALLS) + if (iWall<0 || iWall >= MAXWALLS) return; - switch(lLabelID) + switch (lLabelID) { case WALL_X: - if(bSet) + if (bSet) wall[iWall].x=lValue; else SetGameVarID((int)lVar2, wall[iWall].x, sActor, sPlayer); break; case WALL_Y: - if(bSet) + if (bSet) wall[iWall].y=lValue; else SetGameVarID((int)lVar2, wall[iWall].y, sActor, sPlayer); break; case WALL_POINT2: - if(bSet) + if (bSet) wall[iWall].point2=lValue; else SetGameVarID((int)lVar2, wall[iWall].point2, sActor, sPlayer); break; case WALL_NEXTWALL: - if(bSet) + if (bSet) wall[iWall].nextwall=lValue; else SetGameVarID((int)lVar2, wall[iWall].nextwall, sActor, sPlayer); break; case WALL_NEXTSECTOR: - if(bSet) + if (bSet) wall[iWall].nextsector=lValue; else SetGameVarID((int)lVar2, wall[iWall].nextsector, sActor, sPlayer); break; case WALL_CSTAT: - if(bSet) + if (bSet) wall[iWall].cstat=lValue; else SetGameVarID((int)lVar2, wall[iWall].cstat, sActor, sPlayer); break; case WALL_PICNUM: - if(bSet) + if (bSet) wall[iWall].picnum=lValue; else SetGameVarID((int)lVar2, wall[iWall].picnum, sActor, sPlayer); break; case WALL_OVERPICNUM: - if(bSet) + if (bSet) wall[iWall].overpicnum=lValue; else SetGameVarID((int)lVar2, wall[iWall].overpicnum, sActor, sPlayer); break; case WALL_SHADE: - if(bSet) + if (bSet) wall[iWall].shade=lValue; else SetGameVarID((int)lVar2, wall[iWall].shade, sActor, sPlayer); break; case WALL_PAL: - if(bSet) + if (bSet) wall[iWall].pal=lValue; else SetGameVarID((int)lVar2, wall[iWall].pal, sActor, sPlayer); break; case WALL_XREPEAT: - if(bSet) + if (bSet) wall[iWall].xrepeat=lValue; else SetGameVarID((int)lVar2, wall[iWall].xrepeat, sActor, sPlayer); break; case WALL_YREPEAT: - if(bSet) + if (bSet) wall[iWall].yrepeat=lValue; else SetGameVarID((int)lVar2, wall[iWall].yrepeat, sActor, sPlayer); break; case WALL_XPANNING: - if(bSet) + if (bSet) wall[iWall].xpanning=lValue; else SetGameVarID((int)lVar2, wall[iWall].xpanning, sActor, sPlayer); break; case WALL_YPANNING: - if(bSet) + if (bSet) wall[iWall].ypanning=lValue; else SetGameVarID((int)lVar2, wall[iWall].ypanning, sActor, sPlayer); break; case WALL_LOTAG: - if(bSet) + if (bSet) wall[iWall].lotag=lValue; else SetGameVarID((int)lVar2, wall[iWall].lotag, sActor, sPlayer); break; case WALL_HITAG: - if(bSet) + if (bSet) wall[iWall].hitag=lValue; else SetGameVarID((int)lVar2, wall[iWall].hitag, sActor, sPlayer); break; case WALL_EXTRA: - if(bSet) + if (bSet) wall[iWall].extra=lValue; else SetGameVarID((int)lVar2, wall[iWall].extra, sActor, sPlayer); @@ -2266,168 +2266,168 @@ void DoSector(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sh int iSector; long lValue; - if(lVar1 == g_iThisActorID ) + if (lVar1 == g_iThisActorID ) // if they've asked for 'this', then use 'this'... iSector=sprite[g_i].sectnum; else iSector=GetGameVarID((int)lVar1, sActor, sPlayer); - if(iSector<0 || iSector >= MAXSECTORS) + if (iSector<0 || iSector >= MAXSECTORS) return; lValue=GetGameVarID((int)lVar2, sActor, sPlayer); - switch(lLabelID) + switch (lLabelID) { case SECTOR_WALLPTR: - if(bSet) + if (bSet) sector[iSector].wallptr=lValue; else SetGameVarID((int)lVar2, sector[iSector].wallptr,sActor,sPlayer); break; case SECTOR_WALLNUM: - if(bSet) + if (bSet) sector[iSector].wallnum=lValue; else SetGameVarID((int)lVar2, sector[iSector].wallnum,sActor,sPlayer); break; case SECTOR_CEILINGZ: - if(bSet) + if (bSet) sector[iSector].ceilingz=lValue; else SetGameVarID((int)lVar2, sector[iSector].ceilingz,sActor,sPlayer); break; case SECTOR_FLOORZ: - if(bSet) + if (bSet) sector[iSector].floorz=lValue; else SetGameVarID((int)lVar2, sector[iSector].floorz,sActor,sPlayer); break; case SECTOR_CEILINGSTAT: - if(bSet) + if (bSet) sector[iSector].ceilingstat=lValue; else SetGameVarID((int)lVar2, sector[iSector].ceilingstat,sActor,sPlayer); break; case SECTOR_FLOORSTAT: - if(bSet) + if (bSet) sector[iSector].floorstat=lValue; else SetGameVarID((int)lVar2, sector[iSector].floorstat,sActor,sPlayer); break; case SECTOR_CEILINGPICNUM: - if(bSet) + if (bSet) sector[iSector].ceilingpicnum=lValue; else SetGameVarID((int)lVar2, sector[iSector].ceilingpicnum,sActor,sPlayer); break; case SECTOR_CEILINGSLOPE: - if(bSet) + if (bSet) sector[iSector].ceilingheinum=lValue; else SetGameVarID((int)lVar2, sector[iSector].ceilingheinum,sActor,sPlayer); break; case SECTOR_CEILINGSHADE: - if(bSet) + if (bSet) sector[iSector].ceilingshade=lValue; else SetGameVarID((int)lVar2, sector[iSector].ceilingshade,sActor,sPlayer); break; case SECTOR_CEILINGPAL: - if(bSet) + if (bSet) sector[iSector].ceilingpal=lValue; else SetGameVarID((int)lVar2, sector[iSector].ceilingpal,sActor,sPlayer); break; case SECTOR_CEILINGXPANNING: - if(bSet) + if (bSet) sector[iSector].ceilingxpanning=lValue; else SetGameVarID((int)lVar2, sector[iSector].ceilingypanning,sActor,sPlayer); break; case SECTOR_FLOORPICNUM: - if(bSet) + if (bSet) sector[iSector].floorpicnum=lValue; else SetGameVarID((int)lVar2, sector[iSector].floorpicnum,sActor,sPlayer); break; case SECTOR_FLOORSLOPE: - if(bSet) + if (bSet) sector[iSector].floorheinum=lValue; else SetGameVarID((int)lVar2, sector[iSector].floorheinum,sActor,sPlayer); break; case SECTOR_FLOORSHADE: - if(bSet) + if (bSet) sector[iSector].floorshade=lValue; else SetGameVarID((int)lVar2, sector[iSector].floorshade,sActor,sPlayer); break; case SECTOR_FLOORPAL: - if(bSet) + if (bSet) sector[iSector].floorpal=lValue; else SetGameVarID((int)lVar2, sector[iSector].floorpal,sActor,sPlayer); break; case SECTOR_FLOORXPANNING: - if(bSet) + if (bSet) sector[iSector].floorxpanning=lValue; else SetGameVarID((int)lVar2, sector[iSector].floorxpanning,sActor,sPlayer); break; case SECTOR_FLOORYPANNING: - if(bSet) + if (bSet) sector[iSector].floorypanning=lValue; else SetGameVarID((int)lVar2, sector[iSector].floorypanning,sActor,sPlayer); break; case SECTOR_VISIBILITY: - if(bSet) + if (bSet) sector[iSector].visibility=lValue; else SetGameVarID((int)lVar2, sector[iSector].visibility,sActor,sPlayer); break; case SECTOR_ALIGNTO: - if(bSet) + if (bSet) sector[iSector].filler=lValue; else SetGameVarID((int)lVar2, sector[iSector].filler,sActor,sPlayer); break; case SECTOR_LOTAG: - if(bSet) + if (bSet) sector[iSector].lotag=lValue; else SetGameVarID((int)lVar2, sector[iSector].lotag,sActor,sPlayer); break; case SECTOR_HITAG: - if(bSet) + if (bSet) sector[iSector].hitag=lValue; else SetGameVarID((int)lVar2, sector[iSector].hitag,sActor,sPlayer); break; case SECTOR_EXTRA: - if(bSet) + if (bSet) sector[iSector].extra=lValue; else SetGameVarID((int)lVar2, sector[iSector].extra,sActor,sPlayer); @@ -2447,292 +2447,292 @@ void DoActor(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sho lValue=GetGameVarID((int)lVar2, sActor, sPlayer); - if(lVar1 == g_iThisActorID ) + if (lVar1 == g_iThisActorID ) // if they've asked for 'this', then use 'this'... iActor=g_i; else iActor=GetGameVarID((int)lVar1, sActor, sPlayer); - if(iActor < 0 || iActor >= MAXSPRITES) + if (iActor < 0 || iActor >= MAXSPRITES) return; - switch(lLabelID) + switch (lLabelID) { case ACTOR_X: - if(bSet) + if (bSet) sprite[iActor].x=lValue; else SetGameVarID((int)lVar2, sprite[iActor].x,sActor,sPlayer); break; case ACTOR_Y: - if(bSet) + if (bSet) sprite[iActor].y=lValue; else SetGameVarID((int)lVar2, sprite[iActor].y,sActor,sPlayer); break; case ACTOR_Z: - if(bSet) + if (bSet) sprite[iActor].z=lValue; else SetGameVarID((int)lVar2, sprite[iActor].z,sActor,sPlayer); break; case ACTOR_CSTAT: - if(bSet) + if (bSet) sprite[iActor].cstat=lValue; else SetGameVarID((int)lVar2, sprite[iActor].cstat,sActor,sPlayer); break; case ACTOR_PICNUM: - if(bSet) + if (bSet) sprite[iActor].picnum=lValue; else SetGameVarID((int)lVar2, sprite[iActor].picnum,sActor,sPlayer); break; case ACTOR_SHADE: - if(bSet) + if (bSet) sprite[iActor].shade=lValue; else SetGameVarID((int)lVar2, sprite[iActor].shade,sActor,sPlayer); break; case ACTOR_PAL: - if(bSet) + if (bSet) sprite[iActor].pal=lValue; else SetGameVarID((int)lVar2, sprite[iActor].pal,sActor,sPlayer); break; case ACTOR_CLIPDIST: - if(bSet) + if (bSet) sprite[iActor].clipdist=lValue; else SetGameVarID((int)lVar2, sprite[iActor].clipdist,sActor,sPlayer); break; case ACTOR_DETAIL: - if(bSet) + if (bSet) sprite[iActor].filler=lValue; else SetGameVarID((int)lVar2, sprite[iActor].filler,sActor,sPlayer); break; case ACTOR_XREPEAT: - if(bSet) + if (bSet) sprite[iActor].xrepeat=lValue; else SetGameVarID((int)lVar2, sprite[iActor].xrepeat,sActor,sPlayer); break; case ACTOR_YREPEAT: - if(bSet) + if (bSet) sprite[iActor].yrepeat=lValue; else SetGameVarID((int)lVar2, sprite[iActor].yrepeat,sActor,sPlayer); break; case ACTOR_XOFFSET: - if(bSet) + if (bSet) sprite[iActor].xoffset=lValue; else SetGameVarID((int)lVar2, sprite[iActor].xoffset,sActor,sPlayer); break; case ACTOR_YOFFSET: - if(bSet) + if (bSet) sprite[iActor].yoffset=lValue; else SetGameVarID((int)lVar2, sprite[iActor].yoffset,sActor,sPlayer); break; case ACTOR_SECTNUM: - if(bSet) + if (bSet) changespritesect(iActor,lValue); else SetGameVarID((int)lVar2, sprite[iActor].sectnum,sActor,sPlayer); break; case ACTOR_STATNUM: - if(bSet) + if (bSet) changespritestat(iActor,lValue); else SetGameVarID((int)lVar2, sprite[iActor].statnum,sActor,sPlayer); break; case ACTOR_ANG: - if(bSet) + if (bSet) sprite[iActor].ang=lValue; else SetGameVarID((int)lVar2, sprite[iActor].ang,sActor,sPlayer); break; case ACTOR_OWNER: - if(bSet) + if (bSet) sprite[iActor].owner=lValue; else SetGameVarID((int)lVar2, sprite[iActor].owner,sActor,sPlayer); break; case ACTOR_XVEL: - if(bSet) + if (bSet) sprite[iActor].xvel=lValue; else SetGameVarID((int)lVar2, sprite[iActor].xvel,sActor,sPlayer); break; case ACTOR_YVEL: - if(bSet) + if (bSet) sprite[iActor].yvel=lValue; else SetGameVarID((int)lVar2, sprite[iActor].yvel,sActor,sPlayer); break; case ACTOR_ZVEL: - if(bSet) + if (bSet) sprite[iActor].zvel=lValue; else SetGameVarID((int)lVar2, sprite[iActor].zvel,sActor,sPlayer); break; case ACTOR_LOTAG: - if(bSet) + if (bSet) sprite[iActor].lotag=lValue; else SetGameVarID((int)lVar2, sprite[iActor].lotag,sActor,sPlayer); break; case ACTOR_HITAG: - if(bSet) + if (bSet) sprite[iActor].hitag=lValue; else SetGameVarID((int)lVar2, sprite[iActor].hitag,sActor,sPlayer); break; case ACTOR_EXTRA: - if(bSet) + if (bSet) sprite[iActor].extra=lValue; else SetGameVarID((int)lVar2, sprite[iActor].extra,sActor,sPlayer); break; case ACTOR_HTCGG: - if(bSet) + if (bSet) hittype[iActor].cgg=lValue; else SetGameVarID((int)lVar2, hittype[iActor].cgg, sActor, sPlayer); break; case ACTOR_HTPICNUM : - if(bSet) + if (bSet) hittype[iActor].picnum=lValue; else SetGameVarID((int)lVar2, hittype[iActor].picnum, sActor, sPlayer); break; case ACTOR_HTANG: - if(bSet) + if (bSet) hittype[iActor].ang=lValue; else SetGameVarID((int)lVar2, hittype[iActor].ang, sActor, sPlayer); break; case ACTOR_HTEXTRA: - if(bSet) + if (bSet) hittype[iActor].extra=lValue; else SetGameVarID((int)lVar2,hittype[iActor].extra, sActor, sPlayer); break; case ACTOR_HTOWNER: - if(bSet) + if (bSet) hittype[iActor].owner=lValue; else SetGameVarID((int)lVar2,hittype[iActor].owner, sActor, sPlayer); break; case ACTOR_HTMOVFLAG: - if(bSet) + if (bSet) hittype[iActor].movflag=lValue; else SetGameVarID((int)lVar2,hittype[iActor].movflag, sActor, sPlayer); break; case ACTOR_HTTEMPANG: - if(bSet) + if (bSet) hittype[iActor].tempang=lValue; else SetGameVarID((int)lVar2,hittype[iActor].tempang, sActor, sPlayer); break; case ACTOR_HTACTORSTAYPUT: - if(bSet) + if (bSet) hittype[iActor].actorstayput=lValue; else SetGameVarID((int)lVar2,hittype[iActor].actorstayput, sActor, sPlayer); break; case ACTOR_HTDISPICNUM: - if(bSet) + if (bSet) hittype[iActor].dispicnum=lValue; else SetGameVarID((int)lVar2,hittype[iActor].dispicnum, sActor, sPlayer); break; case ACTOR_HTTIMETOSLEEP: - if(bSet) + if (bSet) hittype[iActor].timetosleep=lValue; else SetGameVarID((int)lVar2,hittype[iActor].timetosleep, sActor, sPlayer); break; case ACTOR_HTFLOORZ: - if(bSet) + if (bSet) hittype[iActor].floorz=lValue; else SetGameVarID((int)lVar2,hittype[iActor].floorz, sActor, sPlayer); break; case ACTOR_HTCEILINGZ: - if(bSet) + if (bSet) hittype[iActor].ceilingz=lValue; else SetGameVarID((int)lVar2,hittype[iActor].ceilingz, sActor, sPlayer); break; case ACTOR_HTLASTVX: - if(bSet) + if (bSet) hittype[iActor].lastvx=lValue; else SetGameVarID((int)lVar2,hittype[iActor].lastvx, sActor, sPlayer); break; case ACTOR_HTLASTVY: - if(bSet) + if (bSet) hittype[iActor].lastvy=lValue; else SetGameVarID((int)lVar2,hittype[iActor].lastvy, sActor, sPlayer); break; case ACTOR_HTBPOSX: - if(bSet) + if (bSet) hittype[iActor].bposx=lValue; else SetGameVarID((int)lVar2,hittype[iActor].bposx, sActor, sPlayer); break; case ACTOR_HTBPOSY: - if(bSet) + if (bSet) hittype[iActor].bposy=lValue; else SetGameVarID((int)lVar2,hittype[iActor].bposy, sActor, sPlayer); break; case ACTOR_HTBPOSZ: - if(bSet) + if (bSet) hittype[iActor].bposz=lValue; else SetGameVarID((int)lVar2,hittype[iActor].bposz, sActor, sPlayer); @@ -2740,49 +2740,49 @@ void DoActor(char bSet, long lVar1, long lLabelID, long lVar2, short sActor, sho case ACTOR_HTG_T: lTemp=lParm2; - if(bSet) + if (bSet) hittype[iActor].temp_data[lTemp]=lValue; else SetGameVarID((int)lVar2, hittype[iActor].temp_data[lTemp], sActor, sPlayer); break; case ACTOR_ANGOFF: - if(bSet) + if (bSet) spriteext[iActor].angoff=lValue; else SetGameVarID((int)lVar2,spriteext[iActor].angoff, sActor, sPlayer); break; case ACTOR_PITCH: - if(bSet) + if (bSet) spriteext[iActor].pitch=lValue; else SetGameVarID((int)lVar2,spriteext[iActor].pitch, sActor, sPlayer); break; case ACTOR_ROLL: - if(bSet) + if (bSet) spriteext[iActor].roll=lValue; else SetGameVarID((int)lVar2,spriteext[iActor].roll, sActor, sPlayer); break; case ACTOR_MDXOFF: - if(bSet) + if (bSet) spriteext[iActor].xoff=lValue; else SetGameVarID((int)lVar2,spriteext[iActor].xoff, sActor, sPlayer); break; case ACTOR_MDYOFF: - if(bSet) + if (bSet) spriteext[iActor].yoff=lValue; else SetGameVarID((int)lVar2,spriteext[iActor].yoff, sActor, sPlayer); break; case ACTOR_MDZOFF: - if(bSet) + if (bSet) spriteext[iActor].zoff=lValue; else SetGameVarID((int)lVar2,spriteext[iActor].zoff, sActor, sPlayer); @@ -2801,204 +2801,204 @@ void DoProjectile(char bSet, long lVar1, long lLabelID, long lVar2, short sActor // proj=GetGameVarID((int)lVar1, sActor, sPlayer); proj=lVar1; - if(proj < 0 || proj >= MAXTILES) + if (proj < 0 || proj >= MAXTILES) return; lValue=GetGameVarID((int)lVar2, sActor, sPlayer); - switch(lLabelID) + switch (lLabelID) { case PROJ_WORKSLIKE: - if(bSet) + if (bSet) projectile[proj].workslike=lValue; else SetGameVarID((int)lVar2, projectile[proj].workslike, sActor, sPlayer); break; case PROJ_SPAWNS: - if(bSet) + if (bSet) projectile[proj].spawns=lValue; else SetGameVarID((int)lVar2, projectile[proj].spawns, sActor, sPlayer); break; case PROJ_SXREPEAT: - if(bSet) + if (bSet) projectile[proj].sxrepeat=lValue; else SetGameVarID((int)lVar2, projectile[proj].sxrepeat, sActor, sPlayer); break; case PROJ_SYREPEAT: - if(bSet) + if (bSet) projectile[proj].syrepeat=lValue; else SetGameVarID((int)lVar2, projectile[proj].syrepeat, sActor, sPlayer); break; case PROJ_SOUND: - if(bSet) + if (bSet) projectile[proj].sound=lValue; else SetGameVarID((int)lVar2, projectile[proj].sound, sActor, sPlayer); break; case PROJ_ISOUND: - if(bSet) + if (bSet) projectile[proj].isound=lValue; else SetGameVarID((int)lVar2, projectile[proj].isound, sActor, sPlayer); break; case PROJ_VEL: - if(bSet) + if (bSet) projectile[proj].vel=lValue; else SetGameVarID((int)lVar2, projectile[proj].vel, sActor, sPlayer); break; case PROJ_EXTRA: - if(bSet) + if (bSet) projectile[proj].extra=lValue; else SetGameVarID((int)lVar2, projectile[proj].extra, sActor, sPlayer); break; case PROJ_DECAL: - if(bSet) + if (bSet) projectile[proj].decal=lValue; else SetGameVarID((int)lVar2, projectile[proj].decal, sActor, sPlayer); break; case PROJ_TRAIL: - if(bSet) + if (bSet) projectile[proj].trail=lValue; else SetGameVarID((int)lVar2, projectile[proj].trail, sActor, sPlayer); break; case PROJ_TXREPEAT: - if(bSet) + if (bSet) projectile[proj].txrepeat=lValue; else SetGameVarID((int)lVar2, projectile[proj].txrepeat, sActor, sPlayer); break; case PROJ_TYREPEAT: - if(bSet) + if (bSet) projectile[proj].tyrepeat=lValue; else SetGameVarID((int)lVar2, projectile[proj].tyrepeat, sActor, sPlayer); break; case PROJ_TOFFSET: - if(bSet) + if (bSet) projectile[proj].toffset=lValue; else SetGameVarID((int)lVar2, projectile[proj].toffset, sActor, sPlayer); break; case PROJ_TNUM: - if(bSet) + if (bSet) projectile[proj].tnum=lValue; else SetGameVarID((int)lVar2, projectile[proj].tnum, sActor, sPlayer); break; case PROJ_DROP: - if(bSet) + if (bSet) projectile[proj].drop=lValue; else SetGameVarID((int)lVar2, projectile[proj].drop, sActor, sPlayer); break; case PROJ_CSTAT: - if(bSet) + if (bSet) projectile[proj].cstat=lValue; else SetGameVarID((int)lVar2, projectile[proj].cstat, sActor, sPlayer); break; case PROJ_CLIPDIST: - if(bSet) + if (bSet) projectile[proj].clipdist=lValue; else SetGameVarID((int)lVar2, projectile[proj].clipdist, sActor, sPlayer); break; case PROJ_SHADE: - if(bSet) + if (bSet) projectile[proj].shade=lValue; else SetGameVarID((int)lVar2, projectile[proj].shade, sActor, sPlayer); break; case PROJ_XREPEAT: - if(bSet) + if (bSet) projectile[proj].xrepeat=lValue; else SetGameVarID((int)lVar2, projectile[proj].xrepeat, sActor, sPlayer); break; case PROJ_YREPEAT: - if(bSet) + if (bSet) projectile[proj].yrepeat=lValue; else SetGameVarID((int)lVar2, projectile[proj].yrepeat, sActor, sPlayer); break; case PROJ_PAL: - if(bSet) + if (bSet) projectile[proj].pal=lValue; else SetGameVarID((int)lVar2, projectile[proj].pal, sActor, sPlayer); break; case PROJ_EXTRA_RAND: - if(bSet) + if (bSet) projectile[proj].extra_rand=lValue; else SetGameVarID((int)lVar2, projectile[proj].extra_rand, sActor, sPlayer); break; case PROJ_HITRADIUS: - if(bSet) + if (bSet) projectile[proj].hitradius=lValue; else SetGameVarID((int)lVar2, projectile[proj].hitradius, sActor, sPlayer); break; case PROJ_VEL_MULT: - if(bSet) + if (bSet) projectile[proj].velmult=lValue; else SetGameVarID((int)lVar2, projectile[proj].velmult, sActor, sPlayer); break; case PROJ_OFFSET: - if(bSet) + if (bSet) projectile[proj].offset=lValue; else SetGameVarID((int)lVar2, projectile[proj].offset, sActor, sPlayer); break; case PROJ_BOUNCES: - if(bSet) + if (bSet) projectile[proj].bounces=lValue; else SetGameVarID((int)lVar2, projectile[proj].bounces, sActor, sPlayer); break; case PROJ_BSOUND: - if(bSet) + if (bSet) projectile[proj].bsound=lValue; else SetGameVarID((int)lVar2, projectile[proj].bsound, sActor, sPlayer); break; case PROJ_RANGE: - if(bSet) + if (bSet) projectile[proj].range=lValue; else SetGameVarID((int)lVar2, projectile[proj].range, sActor, sPlayer); @@ -3021,13 +3021,13 @@ void OnEvent(int iEventID, short sActor,short sPlayer,long lDist) char done; - if( iEventID >= MAXGAMEEVENTS) + if ( iEventID >= MAXGAMEEVENTS) { AddLog("Invalid Event ID"); return; } - if( apScriptGameEvent[iEventID] == 0 ) + if ( apScriptGameEvent[iEventID] == 0 ) { //Bsprintf(g_szBuf,"No event found for %d",iEventID); //AddLog(g_szBuf); @@ -3056,7 +3056,18 @@ void OnEvent(int iEventID, short sActor,short sPlayer,long lDist) killit_flag = 0; do done = parse(); - while( done == 0 ); + while ( done == 0 ); + + if (killit_flag == 1) + { + // if player was set to squish, first stop that... + if (g_p >= 0 ) + { + if (ps[g_p].actorsqu == g_i) + ps[g_p].actorsqu = -1; + } + deletesprite(g_i); + } // restore old values... g_i=og_i; @@ -3079,9 +3090,9 @@ char dodge(spritetype *s) my = s->y; mxvect = sintable[(s->ang+512)&2047]; myvect = sintable[s->ang&2047]; - for(i=headspritestat[4];i>=0;i=nextspritestat[i]) //weapons list + for (i=headspritestat[4];i>=0;i=nextspritestat[i]) //weapons list { - if( OW == i || SECT != s->sectnum) + if ( OW == i || SECT != s->sectnum) continue; bx = SX-mx; @@ -3111,10 +3122,10 @@ short furthestangle(short sActor,short angs) greatestd = -(1<<30); angincs = 2048/angs; - if(s->picnum != APLAYER) - if( (g_t[0]&63) > 2 ) return( s->ang + 1024 ); + if (s->picnum != APLAYER) + if ( (g_t[0]&63) > 2 ) return( s->ang + 1024 ); - for(j=s->ang;j<(2048+s->ang);j+=angincs) + for (j=s->ang;j<(2048+s->ang);j+=angincs) { hitscan(s->x, s->y, s->z-(8<<8), s->sectnum, sintable[(j+512)&2047], @@ -3123,7 +3134,7 @@ short furthestangle(short sActor,short angs) d = klabs(hx-s->x) + klabs(hy-s->y); - if(d > greatestd) + if (d > greatestd) { greatestd = d; furthest_angle = j; @@ -3138,13 +3149,13 @@ short furthestcanseepoint(short sActor,spritetype *ts,long *dax,long *day) long hx, hy, hz, d, da;//, d, cd, ca,tempx,tempy,cx,cy; spritetype *s = &sprite[sActor]; - if( (g_t[0]&63) ) return -1; + if ( (g_t[0]&63) ) return -1; - if(ud.multimode < 2 && ud.player_skill < 3) + if (ud.multimode < 2 && ud.player_skill < 3) angincs = 2048/2; else angincs = 2048/(1+(TRAND&1)); - for(j=ts->ang;j<(2048+ts->ang);j+=(angincs-(TRAND&511))) + for (j=ts->ang;j<(2048+ts->ang);j+=(angincs-(TRAND&511))) { hitscan(ts->x, ts->y, ts->z-(16<<8), ts->sectnum, sintable[(j+512)&2047], @@ -3154,8 +3165,8 @@ short furthestcanseepoint(short sActor,spritetype *ts,long *dax,long *day) d = klabs(hx-ts->x)+klabs(hy-ts->y); da = klabs(hx-s->x)+klabs(hy-s->y); - if( d < da ) - if(cansee(hx,hy,hz,hitsect,s->x,s->y,s->z-(16<<8),s->sectnum)) + if ( d < da ) + if (cansee(hx,hy,hz,hitsect,s->x,s->y,s->z-(16<<8),s->sectnum)) { *dax = hx; *day = hy; @@ -3171,34 +3182,34 @@ void getglobalz(short sActor) spritetype *s = &sprite[sActor]; - if( s->statnum == 10 || s->statnum == 6 || s->statnum == 2 || s->statnum == 1 || s->statnum == 4) + if ( s->statnum == 10 || s->statnum == 6 || s->statnum == 2 || s->statnum == 1 || s->statnum == 4) { - if(s->statnum == 4) + if (s->statnum == 4) zr = 4L; else zr = 127L; getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&hittype[sActor].ceilingz,&hz,&hittype[sActor].floorz,&lz,zr,CLIPMASK0); - if( (lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0 ) + if ( (lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0 ) { lz &= (MAXSPRITES-1); - if( badguy(&sprite[lz]) && sprite[lz].pal != 1) + if ( badguy(&sprite[lz]) && sprite[lz].pal != 1) { - if( s->statnum != 4 ) + if ( s->statnum != 4 ) { hittype[sActor].dispicnum = -4; // No shadows on actors s->xvel = -256; ssp(sActor,CLIPMASK0); } } - else if(sprite[lz].picnum == APLAYER && badguy(s) ) + else if (sprite[lz].picnum == APLAYER && badguy(s) ) { hittype[sActor].dispicnum = -4; // No shadows on actors s->xvel = -256; ssp(sActor,CLIPMASK0); } - else if(s->statnum == 4 && sprite[lz].picnum == APLAYER) - if(s->owner == lz) + else if (s->statnum == 4 && sprite[lz].picnum == APLAYER) + if (s->owner == lz) { hittype[sActor].ceilingz = sector[s->sectnum].ceilingz; hittype[sActor].floorz = sector[s->sectnum].floorz; @@ -3217,16 +3228,16 @@ void makeitfall(short sActor) spritetype *s = &sprite[sActor]; long hz,lz,c; - if( floorspace(s->sectnum) ) + if ( floorspace(s->sectnum) ) c = 0; else { - if( ceilingspace(s->sectnum) || sector[s->sectnum].lotag == 2) + if ( ceilingspace(s->sectnum) || sector[s->sectnum].lotag == 2) c = gc/6; else c = gc; } - if( ( s->statnum == 1 || s->statnum == 10 || s->statnum == 2 || s->statnum == 6 ) ) + if ( ( s->statnum == 1 || s->statnum == 10 || s->statnum == 2 || s->statnum == 6 ) ) getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&hittype[sActor].ceilingz,&hz,&hittype[sActor].floorz,&lz,127L,CLIPMASK0); else { @@ -3234,16 +3245,16 @@ void makeitfall(short sActor) hittype[sActor].floorz = sector[s->sectnum].floorz; } - if( s->z < hittype[sActor].floorz-(FOURSLEIGHT) ) + if ( s->z < hittype[sActor].floorz-(FOURSLEIGHT) ) { - if( sector[s->sectnum].lotag == 2 && s->zvel > 3122 ) + if ( sector[s->sectnum].lotag == 2 && s->zvel > 3122 ) s->zvel = 3144; - if(s->zvel < 6144) + if (s->zvel < 6144) s->zvel += c; else s->zvel = 6144; s->z += s->zvel; } - if( s->z >= hittype[sActor].floorz-(FOURSLEIGHT) ) + if ( s->z >= hittype[sActor].floorz-(FOURSLEIGHT) ) { s->z = hittype[sActor].floorz - FOURSLEIGHT; s->zvel = 0; @@ -3255,12 +3266,12 @@ short getincangle(short a,short na) a &= 2047; na &= 2047; - if(klabs(a-na) < 1024) + if (klabs(a-na) < 1024) return (na-a); else { - if(na > 1024) na -= 2048; - if(a > 1024) a -= 2048; + if (na > 1024) na -= 2048; + if (a > 1024) a -= 2048; na -= 2048; a -= 2048; @@ -3280,57 +3291,57 @@ void alterang(short a) aang = g_sp->ang; g_sp->xvel += (*moveptr-g_sp->xvel)/5; - if(g_sp->zvel < 648) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)/5; + if (g_sp->zvel < 648) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)/5; - if(a&seekplayer) + if (a&seekplayer) { j = ps[g_p].holoduke_on; // NOTE: looks like 'owner' is set to target sprite ID... - if(j >= 0 && cansee(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,g_sp->x,g_sp->y,g_sp->z,g_sp->sectnum) ) + if (j >= 0 && cansee(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,g_sp->x,g_sp->y,g_sp->z,g_sp->sectnum) ) g_sp->owner = j; else g_sp->owner = ps[g_p].i; - if(sprite[g_sp->owner].picnum == APLAYER) + if (sprite[g_sp->owner].picnum == APLAYER) goalang = getangle(hittype[g_i].lastvx-g_sp->x,hittype[g_i].lastvy-g_sp->y); else goalang = getangle(sprite[g_sp->owner].x-g_sp->x,sprite[g_sp->owner].y-g_sp->y); - if(g_sp->xvel && g_sp->picnum != DRONE) + if (g_sp->xvel && g_sp->picnum != DRONE) { angdif = getincangle(aang,goalang); - if(ticselapsed < 2) + if (ticselapsed < 2) { - if( klabs(angdif) < 256) + if ( klabs(angdif) < 256) { j = 128-(TRAND&256); g_sp->ang += j; - if( hits(g_i) < 844 ) + if ( hits(g_i) < 844 ) g_sp->ang -= j; } } - else if(ticselapsed > 18 && ticselapsed < 26) // choose + else if (ticselapsed > 18 && ticselapsed < 26) // choose { - if(klabs(angdif>>2) < 128) g_sp->ang = goalang; + if (klabs(angdif>>2) < 128) g_sp->ang = goalang; else g_sp->ang += angdif>>2; } } else g_sp->ang = goalang; } - if(ticselapsed < 1) + if (ticselapsed < 1) { j = 2; - if(a&furthestdir) + if (a&furthestdir) { goalang = furthestangle(g_i,j); g_sp->ang = goalang; g_sp->owner = ps[g_p].i; } - if(a&fleeenemy) + if (a&fleeenemy) { goalang = furthestangle(g_i,j); g_sp->ang = goalang; // += angdif; // = getincangle(aang,goalang)>>1; @@ -3346,30 +3357,30 @@ void move() a = g_sp->hitag; - if(a == -1) a = 0; + if (a == -1) a = 0; g_t[0]++; - if(a&face_player) + if (a&face_player) { - if(ps[g_p].newowner >= 0) + if (ps[g_p].newowner >= 0) goalang = getangle(ps[g_p].oposx-g_sp->x,ps[g_p].oposy-g_sp->y); else goalang = getangle(ps[g_p].posx-g_sp->x,ps[g_p].posy-g_sp->y); angdif = getincangle(g_sp->ang,goalang)>>2; - if(angdif > -8 && angdif < 0) angdif = 0; + if (angdif > -8 && angdif < 0) angdif = 0; g_sp->ang += angdif; } - if(a&spin) + if (a&spin) g_sp->ang += sintable[ ((g_t[0]<<3)&2047) ]>>6; - if(a&face_player_slow) + if (a&face_player_slow) { - if(ps[g_p].newowner >= 0) + if (ps[g_p].newowner >= 0) goalang = getangle(ps[g_p].oposx-g_sp->x,ps[g_p].oposy-g_sp->y); else goalang = getangle(ps[g_p].posx-g_sp->x,ps[g_p].posy-g_sp->y); angdif = ksgn(getincangle(g_sp->ang,goalang))<<5; - if(angdif > -32 && angdif < 0) + if (angdif > -32 && angdif < 0) { angdif = 0; g_sp->ang = goalang; @@ -3377,13 +3388,13 @@ void move() g_sp->ang += angdif; } - if((a&jumptoplayer) == jumptoplayer) + if ((a&jumptoplayer) == jumptoplayer) { - if(g_t[0] < 16) + if (g_t[0] < 16) g_sp->zvel -= (sintable[(512+(g_t[0]<<4))&2047]>>5); } - if(a&face_player_smart) + if (a&face_player_smart) { long newx,newy; @@ -3391,13 +3402,13 @@ void move() newy = ps[g_p].posy+(ps[g_p].posyv/768); goalang = getangle(newx-g_sp->x,newy-g_sp->y); angdif = getincangle(g_sp->ang,goalang)>>2; - if(angdif > -8 && angdif < 0) angdif = 0; + if (angdif > -8 && angdif < 0) angdif = 0; g_sp->ang += angdif; } - if( g_t[1] == 0 || a == 0 ) + if ( g_t[1] == 0 || a == 0 ) { - if( ( badguy(g_sp) && g_sp->extra <= 0 ) || (hittype[g_i].bposx != g_sp->x) || (hittype[g_i].bposy != g_sp->y) ) + if ( ( badguy(g_sp) && g_sp->extra <= 0 ) || (hittype[g_i].bposx != g_sp->x) || (hittype[g_i].bposy != g_sp->y) ) { hittype[g_i].bposx = g_sp->x; hittype[g_i].bposy = g_sp->y; @@ -3408,36 +3419,36 @@ void move() moveptr = (long *)g_t[1]; - if(a&geth) g_sp->xvel += (*moveptr-g_sp->xvel)>>1; - if(a&getv) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)>>1; + if (a&geth) g_sp->xvel += (*moveptr-g_sp->xvel)>>1; + if (a&getv) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)>>1; - if(a&dodgebullet) + if (a&dodgebullet) dodge(g_sp); - if(g_sp->picnum != APLAYER) + if (g_sp->picnum != APLAYER) alterang(a); - if(g_sp->xvel > -6 && g_sp->xvel < 6 ) g_sp->xvel = 0; + if (g_sp->xvel > -6 && g_sp->xvel < 6 ) g_sp->xvel = 0; a = badguy(g_sp); - if(g_sp->xvel || g_sp->zvel) + if (g_sp->xvel || g_sp->zvel) { - if(a && g_sp->picnum != ROTATEGUN) + if (a && g_sp->picnum != ROTATEGUN) { - if( (g_sp->picnum == DRONE || g_sp->picnum == COMMANDER) && g_sp->extra > 0) + if ( (g_sp->picnum == DRONE || g_sp->picnum == COMMANDER) && g_sp->extra > 0) { - if(g_sp->picnum == COMMANDER) + if (g_sp->picnum == COMMANDER) { hittype[g_i].floorz = l = getflorzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if( g_sp->z > (l-(8<<8)) ) + if ( g_sp->z > (l-(8<<8)) ) { - if( g_sp->z > (l-(8<<8)) ) g_sp->z = l-(8<<8); + if ( g_sp->z > (l-(8<<8)) ) g_sp->z = l-(8<<8); g_sp->zvel = 0; } hittype[g_i].ceilingz = l = getceilzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if( (g_sp->z-l) < (80<<8) ) + if ( (g_sp->z-l) < (80<<8) ) { g_sp->z = l+(80<<8); g_sp->zvel = 0; @@ -3445,16 +3456,16 @@ void move() } else { - if( g_sp->zvel > 0 ) + if ( g_sp->zvel > 0 ) { hittype[g_i].floorz = l = getflorzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if( g_sp->z > (l-(30<<8)) ) + if ( g_sp->z > (l-(30<<8)) ) g_sp->z = l-(30<<8); } else { hittype[g_i].ceilingz = l = getceilzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if( (g_sp->z-l) < (50<<8) ) + if ( (g_sp->z-l) < (50<<8) ) { g_sp->z = l+(50<<8); g_sp->zvel = 0; @@ -3462,14 +3473,14 @@ void move() } } } - else if(g_sp->picnum != ORGANTIC) + else if (g_sp->picnum != ORGANTIC) { - if(g_sp->zvel > 0 && hittype[g_i].floorz < g_sp->z) + if (g_sp->zvel > 0 && hittype[g_i].floorz < g_sp->z) g_sp->z = hittype[g_i].floorz; - if( g_sp->zvel < 0) + if ( g_sp->zvel < 0) { l = getceilzofslope(g_sp->sectnum,g_sp->x,g_sp->y); - if( (g_sp->z-l) < (66<<8) ) + if ( (g_sp->z-l) < (66<<8) ) { g_sp->z = l+(66<<8); g_sp->zvel >>= 1; @@ -3477,22 +3488,22 @@ void move() } } } - else if(g_sp->picnum == APLAYER) - if( (g_sp->z-hittype[g_i].ceilingz) < (32<<8) ) + else if (g_sp->picnum == APLAYER) + if ( (g_sp->z-hittype[g_i].ceilingz) < (32<<8) ) g_sp->z = hittype[g_i].ceilingz+(32<<8); daxvel = g_sp->xvel; angdif = g_sp->ang; - if( a && g_sp->picnum != ROTATEGUN ) + if ( a && g_sp->picnum != ROTATEGUN ) { - if( g_x < 960 && g_sp->xrepeat > 16 ) + if ( g_x < 960 && g_sp->xrepeat > 16 ) { daxvel = -(1024-g_x); angdif = getangle(ps[g_p].posx-g_sp->x,ps[g_p].posy-g_sp->y); - if(g_x < 512) + if (g_x < 512) { ps[g_p].posxv = 0; ps[g_p].posyv = 0; @@ -3503,16 +3514,16 @@ void move() ps[g_p].posyv = mulscale(ps[g_p].posyv,ps[g_p].runspeed-0x2000,16); } } - else if(g_sp->picnum != DRONE && g_sp->picnum != SHARK && g_sp->picnum != COMMANDER) + else if (g_sp->picnum != DRONE && g_sp->picnum != SHARK && g_sp->picnum != COMMANDER) { - if( hittype[g_i].bposz != g_sp->z || ( ud.multimode < 2 && ud.player_skill < 2 ) ) + if ( hittype[g_i].bposz != g_sp->z || ( ud.multimode < 2 && ud.player_skill < 2 ) ) { - if( (g_t[0]&1) || ps[g_p].actorsqu == g_i ) return; + if ( (g_t[0]&1) || ps[g_p].actorsqu == g_i ) return; else daxvel <<= 1; } else { - if( (g_t[0]&3) || ps[g_p].actorsqu == g_i ) return; + if ( (g_t[0]&3) || ps[g_p].actorsqu == g_i ) return; else daxvel <<= 2; } } @@ -3523,13 +3534,13 @@ void move() (daxvel*(sintable[angdif&2047]))>>14,g_sp->zvel,CLIPMASK0); } - if( a ) + if ( a ) { if (sector[g_sp->sectnum].ceilingstat&1) g_sp->shade += (sector[g_sp->sectnum].ceilingshade-g_sp->shade)>>1; else g_sp->shade += (sector[g_sp->sectnum].floorshade-g_sp->shade)>>1; - if( sector[g_sp->sectnum].floorpicnum == MIRROR ) + if ( sector[g_sp->sectnum].floorpicnum == MIRROR ) deletesprite(g_i); } } @@ -3538,7 +3549,7 @@ char parse(void); void parseifelse(long condition) { - if( condition ) + if ( condition ) { // skip 'else' pointer.. and... insptr+=2; @@ -3547,7 +3558,7 @@ void parseifelse(long condition) else { insptr = (long *) *(insptr+1); - if(*insptr == 10) + if (*insptr == 10) { // else... // skip 'else' and... @@ -3569,7 +3580,7 @@ char parse(void) // AddLog(g_szBuf); } - if(killit_flag) return 1; + if (killit_flag) return 1; // if(*it == 1668249134L) gameexit("\nERR"); // Bsprintf(g_szBuf,"Parsing: %d",*insptr); @@ -3577,35 +3588,35 @@ char parse(void) tw = *insptr; - switch(tw) + switch (tw) { case CON_REDEFINEQUOTE: - { - int q, i; - insptr++; - q = *insptr++; - i = *insptr++; - if(fta_quotes[q] == NULL || redefined_quotes[i] == NULL) - OSD_Printf("%s %d null quote %d %d\n",__FILE__,__LINE__,q,i); - else Bstrcpy(fta_quotes[q],redefined_quotes[i]); - break; - } + { + int q, i; + insptr++; + q = *insptr++; + i = *insptr++; + if (fta_quotes[q] == NULL || redefined_quotes[i] == NULL) + OSD_Printf("%s %d null quote %d %d\n",__FILE__,__LINE__,q,i); + else Bstrcpy(fta_quotes[q],redefined_quotes[i]); + break; + } case CON_GETTHISPROJECTILE: case CON_SETTHISPROJECTILE: - { - // syntax [gs]etplayer[].x - // - long lLabelID; - long lVar1, lVar2; + { + // syntax [gs]etplayer[].x + // + long lLabelID; + long lVar1, lVar2; - insptr++; - lVar1=*insptr++; - lLabelID=*insptr++; - lVar2=*insptr++; - DoThisProjectile(tw==CON_SETTHISPROJECTILE,lVar1,lLabelID,lVar2,g_i,g_p); - break; - } + insptr++; + lVar1=*insptr++; + lLabelID=*insptr++; + lVar2=*insptr++; + DoThisProjectile(tw==CON_SETTHISPROJECTILE,lVar1,lLabelID,lVar2,g_i,g_p); + break; + } case CON_IFRND: insptr++; @@ -3614,11 +3625,11 @@ char parse(void) case CON_IFCANSHOOTTARGET: - if(g_x > 1024) + if (g_x > 1024) { short temphit, sclip, angdif; - if( badguy(g_sp) && g_sp->xrepeat > 56 ) + if ( badguy(g_sp) && g_sp->xrepeat > 56 ) { sclip = 3084; angdif = 48; @@ -3630,28 +3641,28 @@ char parse(void) } j = hitasprite(g_i,&temphit); - if(j == (1<<30)) + if (j == (1<<30)) { parseifelse(1); break; } - if(j > sclip) + if (j > sclip) { - if(temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) + if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) j = 0; else { g_sp->ang += angdif;j = hitasprite(g_i,&temphit);g_sp->ang -= angdif; - if(j > sclip) + if (j > sclip) { - if(temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) + if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) j = 0; else { g_sp->ang -= angdif;j = hitasprite(g_i,&temphit);g_sp->ang += angdif; - if( j > 768 ) + if ( j > 768 ) { - if(temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) + if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) j = 0; else j = 1; } @@ -3671,7 +3682,7 @@ char parse(void) case CON_IFCANSEETARGET: j = cansee(g_sp->x,g_sp->y,g_sp->z-((TRAND&41)<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz/*-((TRAND&41)<<8)*/,sprite[ps[g_p].i].sectnum); parseifelse(j); - if( j ) hittype[g_i].timetosleep = SLEEPTIME; + if ( j ) hittype[g_i].timetosleep = SLEEPTIME; break; case CON_IFACTORNOTSTAYPUT: @@ -3679,68 +3690,68 @@ char parse(void) break; case CON_IFCANSEE: + { + spritetype *s; + + // select sprite for monster to target + // if holoduke is on, let them target holoduke first. + // + if (ps[g_p].holoduke_on >= 0) { - spritetype *s; + s = &sprite[ps[g_p].holoduke_on]; + j = cansee(g_sp->x,g_sp->y,g_sp->z-(TRAND&((32<<8)-1)),g_sp->sectnum, + s->x,s->y,s->z,s->sectnum); - // select sprite for monster to target - // if holoduke is on, let them target holoduke first. - // - if(ps[g_p].holoduke_on >= 0) + if (j == 0) { - s = &sprite[ps[g_p].holoduke_on]; - j = cansee(g_sp->x,g_sp->y,g_sp->z-(TRAND&((32<<8)-1)),g_sp->sectnum, - s->x,s->y,s->z,s->sectnum); - - if(j == 0) - { - // they can't see player's holoduke - // check for player... - s = &sprite[ps[g_p].i]; - } + // they can't see player's holoduke + // check for player... + s = &sprite[ps[g_p].i]; } - else s = &sprite[ps[g_p].i]; // holoduke not on. look for player - - // can they see player, (or player's holoduke) - j = cansee(g_sp->x,g_sp->y,g_sp->z-(TRAND&((47<<8))),g_sp->sectnum, - s->x,s->y,s->z-(24<<8),s->sectnum); - - if(j == 0) - { - // they can't see it. - - // Huh?. This does nothing.... - // (the result is always j==0....) - if( ( klabs(hittype[g_i].lastvx-g_sp->x)+klabs(hittype[g_i].lastvy-g_sp->y) ) < - ( klabs(hittype[g_i].lastvx-s->x)+klabs(hittype[g_i].lastvy-s->y) ) ) - j = 0; - - // um yeah, this if() will always fire.... - if( j == 0 ) - { - // search around for target player - - // also modifies 'target' x&y if found.. - - j = furthestcanseepoint(g_i,s,&hittype[g_i].lastvx,&hittype[g_i].lastvy); - - if(j == -1) j = 0; - else j = 1; - } - } - else - { - // else, they did see it. - // save where we were looking... - hittype[g_i].lastvx = s->x; - hittype[g_i].lastvy = s->y; - } - - if( j == 1 && ( g_sp->statnum == 1 || g_sp->statnum == 6 ) ) - hittype[g_i].timetosleep = SLEEPTIME; - - parseifelse(j == 1); - break; } + else s = &sprite[ps[g_p].i]; // holoduke not on. look for player + + // can they see player, (or player's holoduke) + j = cansee(g_sp->x,g_sp->y,g_sp->z-(TRAND&((47<<8))),g_sp->sectnum, + s->x,s->y,s->z-(24<<8),s->sectnum); + + if (j == 0) + { + // they can't see it. + + // Huh?. This does nothing.... + // (the result is always j==0....) + if ( ( klabs(hittype[g_i].lastvx-g_sp->x)+klabs(hittype[g_i].lastvy-g_sp->y) ) < + ( klabs(hittype[g_i].lastvx-s->x)+klabs(hittype[g_i].lastvy-s->y) ) ) + j = 0; + + // um yeah, this if() will always fire.... + if ( j == 0 ) + { + // search around for target player + + // also modifies 'target' x&y if found.. + + j = furthestcanseepoint(g_i,s,&hittype[g_i].lastvx,&hittype[g_i].lastvy); + + if (j == -1) j = 0; + else j = 1; + } + } + else + { + // else, they did see it. + // save where we were looking... + hittype[g_i].lastvx = s->x; + hittype[g_i].lastvy = s->y; + } + + if ( j == 1 && ( g_sp->statnum == 1 || g_sp->statnum == 6 ) ) + hittype[g_i].timetosleep = SLEEPTIME; + + parseifelse(j == 1); + break; + } case CON_IFHITWEAPON: parseifelse(ifhitbyweapon(g_i) >= 0); @@ -3751,13 +3762,13 @@ char parse(void) break; case CON_IFDEAD: - { - j = g_sp->extra; - if(g_sp->picnum == APLAYER) - j--; - parseifelse(j < 0); - } - break; + { + j = g_sp->extra; + if (g_sp->picnum == APLAYER) + j--; + parseifelse(j < 0); + } + break; case CON_AI: insptr++; @@ -3766,7 +3777,7 @@ char parse(void) g_t[1] = *(long *)(g_t[5]+4); // move g_sp->hitag = *(long *)(g_t[5]+8); // move flags g_t[0] = g_t[2] = g_t[3] = 0; // count, actioncount... g_t[3] = ??? - if(g_sp->hitag&random_angle) + if (g_sp->hitag&random_angle) g_sp->ang = TRAND&2047; break; @@ -3780,14 +3791,14 @@ char parse(void) case CON_IFPDISTL: insptr++; parseifelse(g_x < *insptr); - if(g_x > MAXSLEEPDIST && hittype[g_i].timetosleep == 0) + if (g_x > MAXSLEEPDIST && hittype[g_i].timetosleep == 0) hittype[g_i].timetosleep = SLEEPTIME; break; case CON_IFPDISTG: insptr++; parseifelse(g_x > *insptr); - if(g_x > MAXSLEEPDIST && hittype[g_i].timetosleep == 0) + if (g_x > MAXSLEEPDIST && hittype[g_i].timetosleep == 0) hittype[g_i].timetosleep = SLEEPTIME; break; @@ -3808,17 +3819,17 @@ char parse(void) case CON_IFGOTWEAPONCE: insptr++; - if((gametype_flags[ud.coop]&GAMETYPE_FLAG_WEAPSTAY) && ud.multimode > 1) + if ((gametype_flags[ud.coop]&GAMETYPE_FLAG_WEAPSTAY) && ud.multimode > 1) { - if(*insptr == 0) + if (*insptr == 0) { - for(j=0;j < ps[g_p].weapreccnt;j++) - if( ps[g_p].weaprecs[j] == g_sp->picnum ) + for (j=0;j < ps[g_p].weapreccnt;j++) + if ( ps[g_p].weaprecs[j] == g_sp->picnum ) break; parseifelse(j < ps[g_p].weapreccnt && g_sp->owner == g_i); } - else if(ps[g_p].weapreccnt < 16) + else if (ps[g_p].weapreccnt < 16) { ps[g_p].weaprecs[ps[g_p].weapreccnt++] = g_sp->picnum; parseifelse(g_sp->owner == g_i); @@ -3829,7 +3840,7 @@ char parse(void) case CON_GETLASTPAL: insptr++; - if(g_sp->picnum == APLAYER) + if (g_sp->picnum == APLAYER) g_sp->pal = ps[g_sp->yvel].palookup; else g_sp->pal = hittype[g_i].tempang; hittype[g_i].tempang = 0; @@ -3846,19 +3857,19 @@ char parse(void) case CON_MIKESND: insptr++; - if(!isspritemakingsound(g_i,g_sp->yvel)) + if (!isspritemakingsound(g_i,g_sp->yvel)) spritesound(g_sp->yvel,g_i); break; case CON_PKICK: insptr++; - if( ud.multimode > 1 && g_sp->picnum == APLAYER ) + if ( ud.multimode > 1 && g_sp->picnum == APLAYER ) { - if(ps[otherp].quick_kick == 0) + if (ps[otherp].quick_kick == 0) ps[otherp].quick_kick = 14; } - else if(g_sp->picnum != APLAYER && ps[g_p].quick_kick == 0) + else if (g_sp->picnum != APLAYER && ps[g_p].quick_kick == 0) ps[g_p].quick_kick = 14; break; @@ -3868,10 +3879,10 @@ char parse(void) j = (*insptr++-g_sp->xrepeat)<<1; g_sp->xrepeat += ksgn(j); - if( ( g_sp->picnum == APLAYER && g_sp->yrepeat < 36 ) || *insptr < g_sp->yrepeat || ((g_sp->yrepeat*(tilesizy[g_sp->picnum]+8))<<2) < (hittype[g_i].floorz - hittype[g_i].ceilingz) ) + if ( ( g_sp->picnum == APLAYER && g_sp->yrepeat < 36 ) || *insptr < g_sp->yrepeat || ((g_sp->yrepeat*(tilesizy[g_sp->picnum]+8))<<2) < (hittype[g_i].floorz - hittype[g_i].ceilingz) ) { j = ((*insptr)-g_sp->yrepeat)<<1; - if( klabs(j) ) g_sp->yrepeat += ksgn(j); + if ( klabs(j) ) g_sp->yrepeat += ksgn(j); } insptr++; @@ -3890,7 +3901,7 @@ char parse(void) case CON_SOUNDONCE: insptr++; - if(!isspritemakingsound(g_i,*insptr)) + if (!isspritemakingsound(g_i,*insptr)) spritesound((short) *insptr,g_i); insptr++; break; @@ -3903,14 +3914,14 @@ char parse(void) case CON_STOPSOUND: insptr++; - if(isspritemakingsound(g_i,*insptr)) + if (isspritemakingsound(g_i,*insptr)) stopspritesound((short)*insptr,g_i); insptr++; break; case CON_GLOBALSOUND: insptr++; - if(g_p == screenpeek || (gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND)) + if (g_p == screenpeek || (gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND)) spritesound((short) *insptr,ps[screenpeek].i); insptr++; break; @@ -3933,41 +3944,41 @@ char parse(void) { long c; - if( floorspace(g_sp->sectnum) ) + if ( floorspace(g_sp->sectnum) ) c = 0; else { - if( ceilingspace(g_sp->sectnum) || sector[g_sp->sectnum].lotag == 2) + if ( ceilingspace(g_sp->sectnum) || sector[g_sp->sectnum].lotag == 2) c = gc/6; else c = gc; } - if( hittype[g_i].cgg <= 0 || (sector[g_sp->sectnum].floorstat&2) ) + if ( hittype[g_i].cgg <= 0 || (sector[g_sp->sectnum].floorstat&2) ) { getglobalz(g_i); hittype[g_i].cgg = 6; } else hittype[g_i].cgg --; - if( g_sp->z < (hittype[g_i].floorz-FOURSLEIGHT) ) + if ( g_sp->z < (hittype[g_i].floorz-FOURSLEIGHT) ) { g_sp->zvel += c; g_sp->z+=g_sp->zvel; - if(g_sp->zvel > 6144) g_sp->zvel = 6144; + if (g_sp->zvel > 6144) g_sp->zvel = 6144; } else { g_sp->z = hittype[g_i].floorz - FOURSLEIGHT; - if( badguy(g_sp) || ( g_sp->picnum == APLAYER && g_sp->owner >= 0) ) + if ( badguy(g_sp) || ( g_sp->picnum == APLAYER && g_sp->owner >= 0) ) { - if( g_sp->zvel > 3084 && g_sp->extra <= 1) + if ( g_sp->zvel > 3084 && g_sp->extra <= 1) { - if(g_sp->pal != 1 && g_sp->picnum != DRONE) + if (g_sp->pal != 1 && g_sp->picnum != DRONE) { - if(g_sp->picnum == APLAYER && g_sp->extra > 0) + if (g_sp->picnum == APLAYER && g_sp->extra > 0) goto SKIPJIBS; guts(g_sp,JIBS6,15,g_p); spritesound(SQUISHED,g_i); @@ -3980,18 +3991,18 @@ SKIPJIBS: hittype[g_i].extra = 1; g_sp->zvel = 0; } - else if(g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != 1) + else if (g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != 1) { j = g_sp->sectnum; pushmove(&g_sp->x,&g_sp->y,&g_sp->z,(short*)&j,128L,(4L<<8),(4L<<8),CLIPMASK0); - if(j != g_sp->sectnum && j >= 0 && j < MAXSECTORS) + if (j != g_sp->sectnum && j >= 0 && j < MAXSECTORS) changespritesect(g_i,j); spritesound(THUD,g_i); } } - if(sector[g_sp->sectnum].lotag == 1) + if (sector[g_sp->sectnum].lotag == 1) switch (dynamictostatic[g_sp->picnum]) { case OCTABRAIN__STATIC: @@ -4017,14 +4028,14 @@ SKIPJIBS: return 1; case CON_ADDAMMO: insptr++; - if( ps[g_p].ammo_amount[*insptr] >= max_ammo_amount[*insptr] ) + if ( ps[g_p].ammo_amount[*insptr] >= max_ammo_amount[*insptr] ) { killit_flag = 2; break; } addammo( *insptr, &ps[g_p], *(insptr+1) ); - if(ps[g_p].curr_weapon == KNEE_WEAPON) - if( ps[g_p].gotweapon[*insptr]) { + if (ps[g_p].curr_weapon == KNEE_WEAPON) + if ( ps[g_p].gotweapon[*insptr]) { if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); else addweapon( &ps[g_p], *insptr ); } @@ -4069,18 +4080,18 @@ SKIPJIBS: case CON_ADDWEAPON: insptr++; - if( ps[g_p].gotweapon[*insptr] == 0 ) { + if ( ps[g_p].gotweapon[*insptr] == 0 ) { if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); else addweapon( &ps[g_p], *insptr ); } - else if( ps[g_p].ammo_amount[*insptr] >= max_ammo_amount[*insptr] ) + else if ( ps[g_p].ammo_amount[*insptr] >= max_ammo_amount[*insptr] ) { killit_flag = 2; break; } addammo( *insptr, &ps[g_p], *(insptr+1) ); - if(ps[g_p].curr_weapon == KNEE_WEAPON) - if( ps[g_p].gotweapon[*insptr]) { + if (ps[g_p].curr_weapon == KNEE_WEAPON) + if ( ps[g_p].gotweapon[*insptr]) { if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); else addweapon( &ps[g_p], *insptr ); } @@ -4102,7 +4113,7 @@ SKIPJIBS: case CON_ADDPHEALTH: insptr++; - if(ps[g_p].newowner >= 0) + if (ps[g_p].newowner >= 0) { ps[g_p].newowner = -1; ps[g_p].posx = ps[g_p].oposx; @@ -4113,9 +4124,9 @@ SKIPJIBS: setpal(&ps[g_p]); j = headspritestat[1]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum==CAMERA1) + if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; j = nextspritestat[j]; } @@ -4123,16 +4134,16 @@ SKIPJIBS: j = sprite[ps[g_p].i].extra; - if(g_sp->picnum != ATOMICHEALTH) + if (g_sp->picnum != ATOMICHEALTH) { - if( j > max_player_health && *insptr > 0 ) + if ( j > max_player_health && *insptr > 0 ) { insptr++; break; } else { - if(j > 0) + if (j > 0) j += *insptr; if ( j > max_player_health && *insptr > 0 ) j = max_player_health; @@ -4140,19 +4151,19 @@ SKIPJIBS: } else { - if( j > 0 ) + if ( j > 0 ) j += *insptr; if ( j > (max_player_health<<1) ) j = (max_player_health<<1); } - if(j < 0) j = 0; + if (j < 0) j = 0; - if(ud.god == 0) + if (ud.god == 0) { - if(*insptr > 0) + if (*insptr > 0) { - if( ( j - *insptr ) < (max_player_health>>2) && + if ( ( j - *insptr ) < (max_player_health>>2) && j >= (max_player_health>>2) ) spritesound(DUKE_GOTHEALTHATLOW,ps[g_p].i); @@ -4166,20 +4177,20 @@ SKIPJIBS: break; case CON_STATE: - { - long *tempscrptr; + { + long *tempscrptr; - tempscrptr = insptr+2; + tempscrptr = insptr+2; - insptr = (long *) *(insptr+1); - while(1) if(parse()) break; - insptr = tempscrptr; - } - break; + insptr = (long *) *(insptr+1); + while (1) if (parse()) break; + insptr = tempscrptr; + } + break; case CON_LEFTBRACE: insptr++; - while(1) if(parse()) break; + while (1) if (parse()) break; break; case CON_MOVE: @@ -4187,24 +4198,24 @@ SKIPJIBS: g_t[0]=0; g_t[1] = *insptr++; g_sp->hitag = *insptr++; - if(g_sp->hitag&random_angle) + if (g_sp->hitag&random_angle) g_sp->ang = TRAND&2047; break; case CON_ADDWEAPONVAR: insptr++; - if( ps[g_p].gotweapon[GetGameVarID(*(insptr),g_i,g_p)] == 0 ) { + if ( ps[g_p].gotweapon[GetGameVarID(*(insptr),g_i,g_p)] == 0 ) { if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], GetGameVarID(*(insptr),g_i,g_p)); else addweapon( &ps[g_p], GetGameVarID(*(insptr),g_i,g_p) ); } - else if( ps[g_p].ammo_amount[GetGameVarID(*(insptr),g_i,g_p)] >= max_ammo_amount[GetGameVarID(*(insptr),g_i,g_p)] ) + else if ( ps[g_p].ammo_amount[GetGameVarID(*(insptr),g_i,g_p)] >= max_ammo_amount[GetGameVarID(*(insptr),g_i,g_p)] ) { killit_flag = 2; break; } addammo( GetGameVarID(*(insptr),g_i,g_p), &ps[g_p], GetGameVarID(*(insptr+1),g_i,g_p) ); - if(ps[g_p].curr_weapon == KNEE_WEAPON) - if( ps[g_p].gotweapon[GetGameVarID(*(insptr),g_i,g_p)] ) { + if (ps[g_p].curr_weapon == KNEE_WEAPON) + if ( ps[g_p].gotweapon[GetGameVarID(*(insptr),g_i,g_p)] ) { if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], GetGameVarID(*(insptr),g_i,g_p)); else addweapon( &ps[g_p], GetGameVarID(*(insptr),g_i,g_p) ); } @@ -4216,77 +4227,77 @@ SKIPJIBS: case CON_OPERATEACTIVATORS: case CON_SETASPECT: case CON_SSP: + { + long var1, var2; + + insptr++; + + var1 = GetGameVarID(*insptr++,g_i,g_p); + if (tw == CON_OPERATEACTIVATORS && *insptr == g_iThisActorID) { - long var1, var2; - + var2 = g_p; insptr++; + } else var2 = GetGameVarID(*insptr++,g_i,g_p); - var1 = GetGameVarID(*insptr++,g_i,g_p); - if(tw == CON_OPERATEACTIVATORS && *insptr == g_iThisActorID) - { - var2 = g_p; - insptr++; - } else var2 = GetGameVarID(*insptr++,g_i,g_p); - - switch(tw) - { - case CON_ACTIVATEBYSECTOR: - activatebysector(var1, var2); - break; - case CON_OPERATESECTORS: - operatesectors(var1, var2); - break; - case CON_OPERATEACTIVATORS: - operateactivators(var1, var2); - break; - case CON_SETASPECT: - setaspect(var1, var2); - break; - case CON_SSP: - ssp(var1, var2); - break; - } + switch (tw) + { + case CON_ACTIVATEBYSECTOR: + activatebysector(var1, var2); + break; + case CON_OPERATESECTORS: + operatesectors(var1, var2); + break; + case CON_OPERATEACTIVATORS: + operateactivators(var1, var2); + break; + case CON_SETASPECT: + setaspect(var1, var2); + break; + case CON_SSP: + ssp(var1, var2); break; } + break; + } case CON_CANSEESPR: - { - long lVar1, lVar2, lVar3; + { + long lVar1, lVar2, lVar3; - insptr++; + insptr++; - lVar1 = GetGameVarID(*insptr++,g_i,g_p); - lVar2 = GetGameVarID(*insptr++,g_i,g_p); - lVar3 = *insptr++; + lVar1 = GetGameVarID(*insptr++,g_i,g_p); + lVar2 = GetGameVarID(*insptr++,g_i,g_p); + lVar3 = *insptr++; - SetGameVarID(lVar3, cansee(sprite[lVar1].x,sprite[lVar1].y,sprite[lVar1].z,sprite[lVar1].sectnum, - sprite[lVar2].x,sprite[lVar2].y,sprite[lVar2].z,sprite[lVar2].sectnum), g_i, g_p); - break; - } + SetGameVarID(lVar3, cansee(sprite[lVar1].x,sprite[lVar1].y,sprite[lVar1].z,sprite[lVar1].sectnum, + sprite[lVar2].x,sprite[lVar2].y,sprite[lVar2].z,sprite[lVar2].sectnum), g_i, g_p); + break; + } case CON_OPERATERESPAWNS: case CON_OPERATEMASTERSWITCHES: case CON_CHECKACTIVATORMOTION: + { + long var1; + + insptr++; + var1 = GetGameVarID(*insptr++,g_i,g_p); + + switch (tw) { - long var1; - - insptr++; - var1 = GetGameVarID(*insptr++,g_i,g_p); - - switch(tw) - { - case CON_OPERATERESPAWNS: - operaterespawns(var1); - break; - case CON_OPERATEMASTERSWITCHES: - operatemasterswitches(var1); - break; - case CON_CHECKACTIVATORMOTION: - SetGameVarID(g_iReturnVarID, check_activator_motion(var1), g_i, g_p); - break; - } + case CON_OPERATERESPAWNS: + operaterespawns(var1); + break; + case CON_OPERATEMASTERSWITCHES: + operatemasterswitches(var1); + break; + case CON_CHECKACTIVATORMOTION: + SetGameVarID(g_iReturnVarID, check_activator_motion(var1), g_i, g_p); break; } + break; + } case CON_INSERTSPRITEQ: insptr++; @@ -4294,239 +4305,242 @@ SKIPJIBS: break; case CON_QSTRLEN: - { - int i,j; - insptr++; - i=*insptr++; - j=GetGameVarID(*insptr++, g_i, g_p); - if(fta_quotes[j] != NULL) - SetGameVarID(i,Bstrlen(fta_quotes[j]),g_i,g_p); - else SetGameVarID(i,-1,g_i,g_p); - break; - } + { + int i,j; + insptr++; + i=*insptr++; + j=GetGameVarID(*insptr++, g_i, g_p); + if (fta_quotes[j] != NULL) + SetGameVarID(i,Bstrlen(fta_quotes[j]),g_i,g_p); + else SetGameVarID(i,-1,g_i,g_p); + break; + } case CON_GETPNAME: case CON_QSTRCAT: case CON_QSTRCPY: case CON_CHANGESPRITESTAT: case CON_CHANGESPRITESECT: + { + int i,j; + insptr++; + + i = GetGameVarID(*insptr++, g_i, g_p); + if (tw == CON_GETPNAME && *insptr == g_iThisActorID) { - int i,j; + j = g_p; insptr++; + } else j = GetGameVarID(*insptr++, g_i, g_p); - i = GetGameVarID(*insptr++, g_i, g_p); - if(tw == CON_GETPNAME && *insptr == g_iThisActorID) + switch (tw) + { + case CON_GETPNAME: + if (fta_quotes[i] != NULL) { - j = g_p; - insptr++; - } else j = GetGameVarID(*insptr++, g_i, g_p); - - switch(tw) - { - case CON_GETPNAME: - if(fta_quotes[i] != NULL) - { - if (ud.user_name[j][0]) - Bstrcpy(fta_quotes[i],ud.user_name[j]); - else Bsprintf(fta_quotes[i],"%d",j); - } else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,i); - break; - case CON_QSTRCAT: - if(fta_quotes[i] != NULL && fta_quotes[j] != NULL) - Bstrncat(fta_quotes[i],fta_quotes[j],(MAXQUOTELEN-1)-Bstrlen(fta_quotes[i])); - else OSD_Printf("%s %d null quote %d %d\n",__FILE__,__LINE__,i,j); - break; - case CON_QSTRCPY: - if(fta_quotes[i] != NULL && fta_quotes[j] != NULL) - Bstrcpy(fta_quotes[i],fta_quotes[j]); - else OSD_Printf("%s %d null quote %d %d\n",__FILE__,__LINE__,i,j); - break; - case CON_CHANGESPRITESTAT: - changespritestat(i,j); - break; - case CON_CHANGESPRITESECT: - changespritesect(i,j); - break; - } + if (ud.user_name[j][0]) + Bstrcpy(fta_quotes[i],ud.user_name[j]); + else Bsprintf(fta_quotes[i],"%d",j); + } else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,i); + break; + case CON_QSTRCAT: + if (fta_quotes[i] != NULL && fta_quotes[j] != NULL) + Bstrncat(fta_quotes[i],fta_quotes[j],(MAXQUOTELEN-1)-Bstrlen(fta_quotes[i])); + else OSD_Printf("%s %d null quote %d %d\n",__FILE__,__LINE__,i,j); + break; + case CON_QSTRCPY: + if (fta_quotes[i] != NULL && fta_quotes[j] != NULL) + Bstrcpy(fta_quotes[i],fta_quotes[j]); + else OSD_Printf("%s %d null quote %d %d\n",__FILE__,__LINE__,i,j); + break; + case CON_CHANGESPRITESTAT: + changespritestat(i,j); + break; + case CON_CHANGESPRITESECT: + changespritesect(i,j); break; } + break; + } case CON_STARTLEVEL: + { + // from 'level' cheat in game.c (about line 6250) + long volnume; + long levnume; + int i; + + insptr++; // skip command + volnume=GetGameVarID(*insptr++,g_i,g_p); + levnume=GetGameVarID(*insptr++,g_i,g_p); + + if (volnume > num_volumes || volnume < 0) { - // from 'level' cheat in game.c (about line 6250) - long volnume; - long levnume; - int i; - - insptr++; // skip command - volnume=GetGameVarID(*insptr++,g_i,g_p); - levnume=GetGameVarID(*insptr++,g_i,g_p); - - if(volnume > num_volumes || volnume < 0) + /* + if( g_cmddebug&CMDDEBUG_COMPILE) { - /* - if( g_cmddebug&CMDDEBUG_COMPILE) - { - Bsprintf(g_szBuf,"startlevel: Invalid Volume number: %ld. Command ignored.",volnume); - AddLog(g_szBuf); - } - */ - break; + Bsprintf(g_szBuf,"startlevel: Invalid Volume number: %ld. Command ignored.",volnume); + AddLog(g_szBuf); } - - if(levnume >= 11 || levnume <0) - { - /* - if( g_cmddebug&CMDDEBUG_COMPILE) - { - Bsprintf(g_szBuf,"startlevel: Invalid Level number: %ld. Command ignored.",levnume); - AddLog(g_szBuf); - } - */ - break; - } - - ud.m_volume_number = ud.volume_number = volnume; - ud.m_level_number = ud.level_number = levnume; - if(numplayers > 1 && myconnectindex == connecthead) - { - tempbuf[0] = 5; - tempbuf[1] = ud.m_level_number; - tempbuf[2] = ud.m_volume_number; - tempbuf[3] = ud.m_player_skill; - tempbuf[4] = ud.m_monsters_off; - tempbuf[5] = ud.m_respawn_monsters; - tempbuf[6] = ud.m_respawn_items; - tempbuf[7] = ud.m_respawn_inventory; - tempbuf[8] = ud.m_coop; - tempbuf[9] = ud.m_marker; - tempbuf[10] = ud.m_ffire; - tempbuf[11] = ud.m_noexits; - - for(i=connecthead;i>=0;i=connectpoint2[i]) - sendpacket(i,tempbuf,12); - } - else { ps[myconnectindex].gm |= MODE_EOL; display_bonus_screen = 0; } // MODE_RESTART; - + */ break; } + if (levnume >= 11 || levnume <0) + { + /* + if( g_cmddebug&CMDDEBUG_COMPILE) + { + Bsprintf(g_szBuf,"startlevel: Invalid Level number: %ld. Command ignored.",levnume); + AddLog(g_szBuf); + } + */ + break; + } + + ud.m_volume_number = ud.volume_number = volnume; + ud.m_level_number = ud.level_number = levnume; + if (numplayers > 1 && myconnectindex == connecthead) + { + tempbuf[0] = 5; + tempbuf[1] = ud.m_level_number; + tempbuf[2] = ud.m_volume_number; + tempbuf[3] = ud.m_player_skill; + tempbuf[4] = ud.m_monsters_off; + tempbuf[5] = ud.m_respawn_monsters; + tempbuf[6] = ud.m_respawn_items; + tempbuf[7] = ud.m_respawn_inventory; + tempbuf[8] = ud.m_coop; + tempbuf[9] = ud.m_marker; + tempbuf[10] = ud.m_ffire; + tempbuf[11] = ud.m_noexits; + + for (i=connecthead;i>=0;i=connectpoint2[i]) + { + if (i != myconnectindex) sendpacket(i,tempbuf,12); + if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + } + } + else { ps[myconnectindex].gm |= MODE_EOL; display_bonus_screen = 0; } // MODE_RESTART; + + break; + } + case CON_MYOSX: case CON_MYOSPALX: case CON_MYOS: case CON_MYOSPAL: + { + long x,y; + short tilenum; + signed char shade; + char orientation; + char pal; + + insptr++; + x=GetGameVarID(*insptr++,g_i,g_p); + y=GetGameVarID(*insptr++,g_i,g_p); + tilenum=GetGameVarID(*insptr++,g_i,g_p); + shade=GetGameVarID(*insptr++,g_i,g_p); + orientation=GetGameVarID(*insptr++,g_i,g_p); + + switch (tw) { - long x,y; - short tilenum; - signed char shade; - char orientation; - char pal; - - insptr++; - x=GetGameVarID(*insptr++,g_i,g_p); - y=GetGameVarID(*insptr++,g_i,g_p); - tilenum=GetGameVarID(*insptr++,g_i,g_p); - shade=GetGameVarID(*insptr++,g_i,g_p); - orientation=GetGameVarID(*insptr++,g_i,g_p); - - switch(tw) - { - case CON_MYOS: - myos(x,y,tilenum,shade,orientation); - break; - case CON_MYOSPAL: - pal=GetGameVarID(*insptr++,g_i,g_p); - myospal(x,y,tilenum,shade,orientation,pal); - break; - case CON_MYOSX: - myosx(x,y,tilenum,shade,orientation); - break; - case CON_MYOSPALX: - pal=GetGameVarID(*insptr++,g_i,g_p); - myospalx(x,y,tilenum,shade,orientation,pal); - break; - } + case CON_MYOS: + myos(x,y,tilenum,shade,orientation); + break; + case CON_MYOSPAL: + pal=GetGameVarID(*insptr++,g_i,g_p); + myospal(x,y,tilenum,shade,orientation,pal); + break; + case CON_MYOSX: + myosx(x,y,tilenum,shade,orientation); + break; + case CON_MYOSPALX: + pal=GetGameVarID(*insptr++,g_i,g_p); + myospalx(x,y,tilenum,shade,orientation,pal); break; } + break; + } case CON_SWITCH: + { + long lVarID; + long lValue; + long *lpDefault; + long *lpCases; + long lCases; + long lEnd; + long lCheckCase; + char bMatched; + long *lTempInsPtr; + + // command format: + // variable ID to check + // script offset to 'end' + // count of case statements + // script offset to default case (null if none) + // For each case: value, ptr to code + //AddLog("Processing Switch..."); + insptr++; // p-code + lVarID=*insptr++; + lValue=GetGameVarID(lVarID, g_i, g_p); + lEnd=*insptr++; + lCases=*insptr++; + lpDefault=insptr++; + lpCases=insptr; + insptr+=lCases*2; + bMatched=0; + lTempInsPtr=insptr; + //Bsprintf(g_szBuf,"lEnd= %ld *lpDefault=%ld",lEnd,*lpDefault); + //AddLog(g_szBuf); + + //Bsprintf(g_szBuf,"Checking %ld cases for %ld",lCases, lValue); + //AddLog(g_szBuf); + for (lCheckCase=0; lCheckCasesectnum >= 0 && g_sp->sectnum < MAXSECTORS) - lReturn = spawn(g_i, lIn); - switch(tw) { - case CON_EQSPAWNVAR: - insertspriteq(lReturn); - case CON_ESPAWNVAR: - SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); - break; - case CON_QSPAWNVAR: - insertspriteq(lReturn); - break; - } + lIn=*insptr++; + lIn=GetGameVarID(lIn, g_i, g_p); + if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) + lReturn = spawn(g_i, lIn); + switch (tw) { + case CON_EQSPAWNVAR: + insertspriteq(lReturn); + case CON_ESPAWNVAR: + SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); + break; + case CON_QSPAWNVAR: + insertspriteq(lReturn); break; } + break; + } case CON_ESPAWN: case CON_EQSPAWN: case CON_QSPAWN: - { - long lReturn=-1; + { + long lReturn=-1; - insptr++; - if(g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) - lReturn = spawn(g_i,*insptr++); - switch(tw) { - case CON_EQSPAWN: - insertspriteq(lReturn); - case CON_ESPAWN: - SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); - break; - case CON_QSPAWN: - insertspriteq(lReturn); - break; - } + insptr++; + if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) + lReturn = spawn(g_i,*insptr++); + switch (tw) { + case CON_EQSPAWN: + insertspriteq(lReturn); + case CON_ESPAWN: + SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); + break; + case CON_QSPAWN: + insertspriteq(lReturn); break; } + break; + } case CON_ESHOOT: case CON_EZSHOOT: case CON_ZSHOOT: - { - long lReturn=-1; + { + long lReturn=-1; - insptr++; - if(tw == CON_ZSHOOT || tw == CON_EZSHOOT) - { - hittype[g_i].temp_data[9] = GetGameVarID(*insptr++, g_i, g_p); - if (hittype[g_i].temp_data[9] == 0) - hittype[g_i].temp_data[9] = 1; - } - if(g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) - { - lReturn = shoot(g_i,*insptr++); - if(tw == CON_EZSHOOT || tw == CON_ESHOOT) - SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); - } - hittype[g_i].temp_data[9]=0; - break; + insptr++; + if (tw == CON_ZSHOOT || tw == CON_EZSHOOT) + { + hittype[g_i].temp_data[9] = GetGameVarID(*insptr++, g_i, g_p); + if (hittype[g_i].temp_data[9] == 0) + hittype[g_i].temp_data[9] = 1; } + if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) + { + lReturn = shoot(g_i,*insptr++); + if (tw == CON_EZSHOOT || tw == CON_ESHOOT) + SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); + } + hittype[g_i].temp_data[9]=0; + break; + } case CON_SHOOTVAR: case CON_ESHOOTVAR: case CON_EZSHOOTVAR: case CON_ZSHOOTVAR: + { + long lIn, lReturn=-1; + + insptr++; + + if (tw == CON_ZSHOOTVAR || tw == CON_EZSHOOTVAR) { - long lIn, lReturn=-1; - - insptr++; - - if(tw == CON_ZSHOOTVAR || tw == CON_EZSHOOTVAR) - { - hittype[g_i].temp_data[9] = GetGameVarID(*insptr++, g_i, g_p); - if (hittype[g_i].temp_data[9] == 0) - hittype[g_i].temp_data[9] = 1; - } - lIn=GetGameVarID(*insptr++, g_i, g_p); - if(g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) - { - lReturn = shoot(g_i, lIn); - if (tw == CON_ESHOOTVAR || tw == CON_EZSHOOTVAR) - SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); - } - hittype[g_i].temp_data[9]=0; - break; + hittype[g_i].temp_data[9] = GetGameVarID(*insptr++, g_i, g_p); + if (hittype[g_i].temp_data[9] == 0) + hittype[g_i].temp_data[9] = 1; } + lIn=GetGameVarID(*insptr++, g_i, g_p); + if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) + { + lReturn = shoot(g_i, lIn); + if (tw == CON_ESHOOTVAR || tw == CON_EZSHOOTVAR) + SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); + } + hittype[g_i].temp_data[9]=0; + break; + } case CON_SOUNDVAR: case CON_STOPSOUNDVAR: case CON_SOUNDONCEVAR: case CON_GLOBALSOUNDVAR: + { + int sound; + + insptr++; + sound=GetGameVarID(*insptr++, g_i, g_p); + + switch (tw) { - int sound; - - insptr++; - sound=GetGameVarID(*insptr++, g_i, g_p); - - switch(tw) - { - case CON_SOUNDONCEVAR: - if(!isspritemakingsound(g_i,sound)) - spritesound((short)sound,g_i); - break; - case CON_GLOBALSOUNDVAR: - spritesound((short)sound,ps[screenpeek].i); - break; - case CON_STOPSOUNDVAR: - if(isspritemakingsound(g_i,sound)) - stopspritesound((short)sound,g_i); - break; - case CON_SOUNDVAR: + case CON_SOUNDONCEVAR: + if (!isspritemakingsound(g_i,sound)) spritesound((short)sound,g_i); - break; - } + break; + case CON_GLOBALSOUNDVAR: + spritesound((short)sound,ps[screenpeek].i); + break; + case CON_STOPSOUNDVAR: + if (isspritemakingsound(g_i,sound)) + stopspritesound((short)sound,g_i); + break; + case CON_SOUNDVAR: + spritesound((short)sound,g_i); break; } + break; + } case CON_GUNIQHUDID: - { - int i; - insptr++; - i=GetGameVarID(*insptr++, g_i, g_p); - if (i < MAXUNIQHUDID-1) - guniqhudid = i; - break; - } + { + int i; + insptr++; + i=GetGameVarID(*insptr++, g_i, g_p); + if (i < MAXUNIQHUDID-1) + guniqhudid = i; + break; + } case CON_SAVEGAMEVAR: case CON_READGAMEVAR: + { + int32 i=0; + insptr++; + if (scripthandle < 0) break; + switch (tw) { - int32 i=0; - insptr++; - if (scripthandle < 0) break; - switch(tw) - { - case CON_SAVEGAMEVAR: - i=GetGameVarID(*insptr, g_i, g_p); - SCRIPT_PutNumber( scripthandle, "Gamevars",aGameVars[*insptr++].szLabel,i,false,false); - break; - case CON_READGAMEVAR: - SCRIPT_GetNumber( scripthandle, "Gamevars",aGameVars[*insptr].szLabel,&i); - SetGameVarID(*insptr++, i, g_i, g_p); - break; - } + case CON_SAVEGAMEVAR: + i=GetGameVarID(*insptr, g_i, g_p); + SCRIPT_PutNumber( scripthandle, "Gamevars",aGameVars[*insptr++].szLabel,i,false,false); + break; + case CON_READGAMEVAR: + SCRIPT_GetNumber( scripthandle, "Gamevars",aGameVars[*insptr].szLabel,&i); + SetGameVarID(*insptr++, i, g_i, g_p); break; } + break; + } case CON_ROTATESPRITE: - { - long x,y,z; - short tilenum; - short a; - signed char shade; - char orientation; - char pal; - long x1, y1, x2, y2; - insptr++; - x=GetGameVarID(*insptr++,g_i,g_p); - y=GetGameVarID(*insptr++,g_i,g_p); - z=GetGameVarID(*insptr++,g_i,g_p); - a=GetGameVarID(*insptr++,g_i,g_p); + { + long x,y,z; + short tilenum; + short a; + signed char shade; + char orientation; + char pal; + long x1, y1, x2, y2; + insptr++; + x=GetGameVarID(*insptr++,g_i,g_p); + y=GetGameVarID(*insptr++,g_i,g_p); + z=GetGameVarID(*insptr++,g_i,g_p); + a=GetGameVarID(*insptr++,g_i,g_p); + tilenum=GetGameVarID(*insptr++,g_i,g_p); + shade=GetGameVarID(*insptr++,g_i,g_p); + pal=GetGameVarID(*insptr++,g_i,g_p); + orientation=GetGameVarID(*insptr++,g_i,g_p); + x1=GetGameVarID(*insptr++,g_i,g_p); + y1=GetGameVarID(*insptr++,g_i,g_p); + x2=GetGameVarID(*insptr++,g_i,g_p); + y2=GetGameVarID(*insptr++,g_i,g_p); + + rotatesprite(x<<16,y<<16,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2); + break; + } + + case CON_MINITEXT: + case CON_GAMETEXT: + case CON_DIGITALNUMBER: + { + long x,y; + short tilenum=0; + signed char shade; + char orientation=0; + char pal; + long x1=0, y1=0, x2=0, y2=0; + long q; + insptr++; + + if (tw == CON_GAMETEXT || tw == CON_DIGITALNUMBER) tilenum=GetGameVarID(*insptr++,g_i,g_p); - shade=GetGameVarID(*insptr++,g_i,g_p); - pal=GetGameVarID(*insptr++,g_i,g_p); + x=GetGameVarID(*insptr++,g_i,g_p); + y=GetGameVarID(*insptr++,g_i,g_p); + q=GetGameVarID(*insptr++,g_i,g_p); + shade=GetGameVarID(*insptr++,g_i,g_p); + pal=GetGameVarID(*insptr++,g_i,g_p); + if (tw == CON_GAMETEXT || tw == CON_DIGITALNUMBER) + { orientation=GetGameVarID(*insptr++,g_i,g_p); x1=GetGameVarID(*insptr++,g_i,g_p); y1=GetGameVarID(*insptr++,g_i,g_p); x2=GetGameVarID(*insptr++,g_i,g_p); y2=GetGameVarID(*insptr++,g_i,g_p); - - rotatesprite(x<<16,y<<16,z,a,tilenum,shade,pal,2|orientation,x1,y1,x2,y2); - break; - } - - case CON_MINITEXT: - case CON_GAMETEXT: - case CON_DIGITALNUMBER: - { - long x,y; - short tilenum=0; - signed char shade; - char orientation=0; - char pal; - long x1=0, y1=0, x2=0, y2=0; - long q; - insptr++; - - if (tw == CON_GAMETEXT || tw == CON_DIGITALNUMBER) - tilenum=GetGameVarID(*insptr++,g_i,g_p); - x=GetGameVarID(*insptr++,g_i,g_p); - y=GetGameVarID(*insptr++,g_i,g_p); - q=GetGameVarID(*insptr++,g_i,g_p); - shade=GetGameVarID(*insptr++,g_i,g_p); - pal=GetGameVarID(*insptr++,g_i,g_p); - if (tw == CON_GAMETEXT || tw == CON_DIGITALNUMBER) - { - orientation=GetGameVarID(*insptr++,g_i,g_p); - x1=GetGameVarID(*insptr++,g_i,g_p); - y1=GetGameVarID(*insptr++,g_i,g_p); - x2=GetGameVarID(*insptr++,g_i,g_p); - y2=GetGameVarID(*insptr++,g_i,g_p); - } - if (tw == CON_MINITEXT && fta_quotes[q] != NULL) minitextshade(x,y,fta_quotes[q],shade,pal,26); - else if (tw == CON_GAMETEXT && fta_quotes[q] != NULL) gametext_(0,tilenum,x>>1,y,fta_quotes[q],shade,pal,orientation,x1,y1,x2,y2); - else if (tw == CON_DIGITALNUMBER) txdigitalnumber(tilenum,x,y,q,shade,pal,orientation,x1,y1,x2,y2); - if((tw == CON_MINITEXT || tw == CON_GAMETEXT) && fta_quotes[q] == NULL) - OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,q); - break; } + if (tw == CON_MINITEXT && fta_quotes[q] != NULL) minitextshade(x,y,fta_quotes[q],shade,pal,26); + else if (tw == CON_GAMETEXT && fta_quotes[q] != NULL) gametext_(0,tilenum,x>>1,y,fta_quotes[q],shade,pal,orientation,x1,y1,x2,y2); + else if (tw == CON_DIGITALNUMBER) txdigitalnumber(tilenum,x,y,q,shade,pal,orientation,x1,y1,x2,y2); + if ((tw == CON_MINITEXT || tw == CON_GAMETEXT) && fta_quotes[q] == NULL) + OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,q); + break; + } case CON_ANGOFF: insptr++; @@ -4862,212 +4876,212 @@ SKIPJIBS: break; case CON_GETZRANGE: - { - long x, y, z, ceilz, ceilhit, florz, florhit, walldist, clipmask; - long ceilzvar, ceilhitvar, florzvar, florhitvar; - short sectnum; + { + long x, y, z, ceilz, ceilhit, florz, florhit, walldist, clipmask; + long ceilzvar, ceilhitvar, florzvar, florhitvar; + short sectnum; - insptr++; - x=GetGameVarID(*insptr++,g_i,g_p); - y=GetGameVarID(*insptr++,g_i,g_p); - z=GetGameVarID(*insptr++,g_i,g_p); - sectnum=GetGameVarID(*insptr++,g_i,g_p); - ceilzvar=*insptr++; - ceilhitvar=*insptr++; - florzvar=*insptr++; - florhitvar=*insptr++; - walldist=GetGameVarID(*insptr++,g_i,g_p); - clipmask=GetGameVarID(*insptr++,g_i,g_p); + insptr++; + x=GetGameVarID(*insptr++,g_i,g_p); + y=GetGameVarID(*insptr++,g_i,g_p); + z=GetGameVarID(*insptr++,g_i,g_p); + sectnum=GetGameVarID(*insptr++,g_i,g_p); + ceilzvar=*insptr++; + ceilhitvar=*insptr++; + florzvar=*insptr++; + florhitvar=*insptr++; + walldist=GetGameVarID(*insptr++,g_i,g_p); + clipmask=GetGameVarID(*insptr++,g_i,g_p); - getzrange(x, y, z, sectnum, &ceilz, &ceilhit, &florz, &florhit, walldist, clipmask); - SetGameVarID(ceilzvar, ceilz, g_i, g_p); - SetGameVarID(ceilhitvar, ceilhit, g_i, g_p); - SetGameVarID(florzvar, florz, g_i, g_p); - SetGameVarID(florhitvar, florhit, g_i, g_p); - break; - } + getzrange(x, y, z, sectnum, &ceilz, &ceilhit, &florz, &florhit, walldist, clipmask); + SetGameVarID(ceilzvar, ceilz, g_i, g_p); + SetGameVarID(ceilhitvar, ceilhit, g_i, g_p); + SetGameVarID(florzvar, florz, g_i, g_p); + SetGameVarID(florhitvar, florhit, g_i, g_p); + break; + } case CON_HITSCAN: - { - long xs, ys, zs, vx, vy, vz, hitx, hity, hitz; - short sectnum, hitsect, hitwall, hitsprite; - unsigned long cliptype; + { + long xs, ys, zs, vx, vy, vz, hitx, hity, hitz; + short sectnum, hitsect, hitwall, hitsprite; + unsigned long cliptype; - long hitxvar, hityvar, hitzvar; - short hitsectvar, hitwallvar, hitspritevar; + long hitxvar, hityvar, hitzvar; + short hitsectvar, hitwallvar, hitspritevar; - insptr++; - xs=GetGameVarID(*insptr++,g_i,g_p); - ys=GetGameVarID(*insptr++,g_i,g_p); - zs=GetGameVarID(*insptr++,g_i,g_p); - sectnum=GetGameVarID(*insptr++,g_i,g_p); - vx=GetGameVarID(*insptr++,g_i,g_p); - vy=GetGameVarID(*insptr++,g_i,g_p); - vz=GetGameVarID(*insptr++,g_i,g_p); - hitsectvar=*insptr++; - hitwallvar=*insptr++; - hitspritevar=*insptr++; - hitxvar=*insptr++; - hityvar=*insptr++; - hitzvar=*insptr++; - cliptype=GetGameVarID(*insptr++,g_i,g_p); - hitscan(xs, ys, zs, sectnum, vx, vy, vz, &hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, cliptype); - SetGameVarID(hitsectvar, hitsect, g_i, g_p); - SetGameVarID(hitwallvar, hitwall, g_i, g_p); - SetGameVarID(hitspritevar, hitsprite, g_i, g_p); - SetGameVarID(hitxvar, hitx, g_i, g_p); - SetGameVarID(hityvar, hity, g_i, g_p); - SetGameVarID(hitzvar, hitz, g_i, g_p); - break; - } + insptr++; + xs=GetGameVarID(*insptr++,g_i,g_p); + ys=GetGameVarID(*insptr++,g_i,g_p); + zs=GetGameVarID(*insptr++,g_i,g_p); + sectnum=GetGameVarID(*insptr++,g_i,g_p); + vx=GetGameVarID(*insptr++,g_i,g_p); + vy=GetGameVarID(*insptr++,g_i,g_p); + vz=GetGameVarID(*insptr++,g_i,g_p); + hitsectvar=*insptr++; + hitwallvar=*insptr++; + hitspritevar=*insptr++; + hitxvar=*insptr++; + hityvar=*insptr++; + hitzvar=*insptr++; + cliptype=GetGameVarID(*insptr++,g_i,g_p); + hitscan(xs, ys, zs, sectnum, vx, vy, vz, &hitsect, &hitwall, &hitsprite, &hitx, &hity, &hitz, cliptype); + SetGameVarID(hitsectvar, hitsect, g_i, g_p); + SetGameVarID(hitwallvar, hitwall, g_i, g_p); + SetGameVarID(hitspritevar, hitsprite, g_i, g_p); + SetGameVarID(hitxvar, hitx, g_i, g_p); + SetGameVarID(hityvar, hity, g_i, g_p); + SetGameVarID(hitzvar, hitz, g_i, g_p); + break; + } case CON_CANSEE: - { - long x1, y1, z1, sect1, x2, y2, z2, sect2, r, rvar; + { + long x1, y1, z1, sect1, x2, y2, z2, sect2, r, rvar; - insptr++; - x1=GetGameVarID(*insptr++,g_i,g_p); - y1=GetGameVarID(*insptr++,g_i,g_p); - z1=GetGameVarID(*insptr++,g_i,g_p); - sect1=GetGameVarID(*insptr++,g_i,g_p); - x2=GetGameVarID(*insptr++,g_i,g_p); - y2=GetGameVarID(*insptr++,g_i,g_p); - z2=GetGameVarID(*insptr++,g_i,g_p); - sect2=GetGameVarID(*insptr++,g_i,g_p); - rvar=*insptr++; - r = cansee(x1,y1,z1,sect1,x2,y2,z2,sect2); - SetGameVarID(rvar, r, g_i, g_p); - break; - } + insptr++; + x1=GetGameVarID(*insptr++,g_i,g_p); + y1=GetGameVarID(*insptr++,g_i,g_p); + z1=GetGameVarID(*insptr++,g_i,g_p); + sect1=GetGameVarID(*insptr++,g_i,g_p); + x2=GetGameVarID(*insptr++,g_i,g_p); + y2=GetGameVarID(*insptr++,g_i,g_p); + z2=GetGameVarID(*insptr++,g_i,g_p); + sect2=GetGameVarID(*insptr++,g_i,g_p); + rvar=*insptr++; + r = cansee(x1,y1,z1,sect1,x2,y2,z2,sect2); + SetGameVarID(rvar, r, g_i, g_p); + break; + } case CON_ROTATEPOINT: - { - long xpivot, ypivot, x, y, x2, y2, x2var, y2var; - short daang; + { + long xpivot, ypivot, x, y, x2, y2, x2var, y2var; + short daang; - insptr++; - xpivot=GetGameVarID(*insptr++,g_i,g_p); - ypivot=GetGameVarID(*insptr++,g_i,g_p); - x=GetGameVarID(*insptr++,g_i,g_p); - y=GetGameVarID(*insptr++,g_i,g_p); - daang=GetGameVarID(*insptr++,g_i,g_p); - x2var=*insptr++; - y2var=*insptr++; - rotatepoint(xpivot,ypivot,x,y,daang,&x2,&y2); - SetGameVarID(x2var, x2, g_i, g_p); - SetGameVarID(y2var, y2, g_i, g_p); - break; - } + insptr++; + xpivot=GetGameVarID(*insptr++,g_i,g_p); + ypivot=GetGameVarID(*insptr++,g_i,g_p); + x=GetGameVarID(*insptr++,g_i,g_p); + y=GetGameVarID(*insptr++,g_i,g_p); + daang=GetGameVarID(*insptr++,g_i,g_p); + x2var=*insptr++; + y2var=*insptr++; + rotatepoint(xpivot,ypivot,x,y,daang,&x2,&y2); + SetGameVarID(x2var, x2, g_i, g_p); + SetGameVarID(y2var, y2, g_i, g_p); + break; + } case CON_NEARTAG: - { - // neartag(long x, long y, long z, short sectnum, short ang, //Starting position & angle - // short *neartagsector, //Returns near sector if sector[].tag != 0 - // short *neartagwall, //Returns near wall if wall[].tag != 0 - // short *neartagsprite, //Returns near sprite if sprite[].tag != 0 - // long *neartaghitdist, //Returns actual distance to object (scale: 1024=largest grid size) - // long neartagrange, //Choose maximum distance to scan (scale: 1024=largest grid size) - // char tagsearch) //1-lotag only, 2-hitag only, 3-lotag&hitag + { + // neartag(long x, long y, long z, short sectnum, short ang, //Starting position & angle + // short *neartagsector, //Returns near sector if sector[].tag != 0 + // short *neartagwall, //Returns near wall if wall[].tag != 0 + // short *neartagsprite, //Returns near sprite if sprite[].tag != 0 + // long *neartaghitdist, //Returns actual distance to object (scale: 1024=largest grid size) + // long neartagrange, //Choose maximum distance to scan (scale: 1024=largest grid size) + // char tagsearch) //1-lotag only, 2-hitag only, 3-lotag&hitag - long x, y, z, neartaghitdist, neartagrange; - short sectnum, ang, neartagsector, neartagwall, neartagsprite; - long neartagsectorvar, neartagwallvar, neartagspritevar, neartaghitdistvar; - char tagsearch; + long x, y, z, neartaghitdist, neartagrange; + short sectnum, ang, neartagsector, neartagwall, neartagsprite; + long neartagsectorvar, neartagwallvar, neartagspritevar, neartaghitdistvar; + char tagsearch; - insptr++; - x=GetGameVarID(*insptr++,g_i,g_p); - y=GetGameVarID(*insptr++,g_i,g_p); - z=GetGameVarID(*insptr++,g_i,g_p); - sectnum=GetGameVarID(*insptr++,g_i,g_p); - ang=GetGameVarID(*insptr++,g_i,g_p); - neartagsectorvar=*insptr++; - neartagwallvar=*insptr++; - neartagspritevar=*insptr++; - neartaghitdistvar=*insptr++; - neartagrange=GetGameVarID(*insptr++,g_i,g_p); - tagsearch=GetGameVarID(*insptr++,g_i,g_p); - neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, neartagrange, tagsearch); - SetGameVarID(neartagsectorvar, neartagsector, g_i, g_p); - SetGameVarID(neartagwallvar, neartagwall, g_i, g_p); - SetGameVarID(neartagspritevar, neartagsprite, g_i, g_p); - SetGameVarID(neartaghitdistvar, neartaghitdist, g_i, g_p); - break; - } + insptr++; + x=GetGameVarID(*insptr++,g_i,g_p); + y=GetGameVarID(*insptr++,g_i,g_p); + z=GetGameVarID(*insptr++,g_i,g_p); + sectnum=GetGameVarID(*insptr++,g_i,g_p); + ang=GetGameVarID(*insptr++,g_i,g_p); + neartagsectorvar=*insptr++; + neartagwallvar=*insptr++; + neartagspritevar=*insptr++; + neartaghitdistvar=*insptr++; + neartagrange=GetGameVarID(*insptr++,g_i,g_p); + tagsearch=GetGameVarID(*insptr++,g_i,g_p); + neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, neartagrange, tagsearch); + SetGameVarID(neartagsectorvar, neartagsector, g_i, g_p); + SetGameVarID(neartagwallvar, neartagwall, g_i, g_p); + SetGameVarID(neartagspritevar, neartagsprite, g_i, g_p); + SetGameVarID(neartaghitdistvar, neartaghitdist, g_i, g_p); + break; + } case CON_MOVESPRITE: case CON_SETSPRITE: + { + short spritenum; + long x, y, z; + unsigned long cliptype, returnvar; + insptr++; + spritenum = GetGameVarID(*insptr++,g_i,g_p); + x = GetGameVarID(*insptr++,g_i,g_p); + y = GetGameVarID(*insptr++,g_i,g_p); + z = GetGameVarID(*insptr++,g_i,g_p); + switch (tw) { - short spritenum; - long x, y, z; - unsigned long cliptype, returnvar; - insptr++; - spritenum = GetGameVarID(*insptr++,g_i,g_p); - x = GetGameVarID(*insptr++,g_i,g_p); - y = GetGameVarID(*insptr++,g_i,g_p); - z = GetGameVarID(*insptr++,g_i,g_p); - switch(tw) - { - case CON_MOVESPRITE: - cliptype = GetGameVarID(*insptr++,g_i,g_p); - returnvar = *insptr++; - SetGameVarID(returnvar, movesprite(spritenum, x, y, z, cliptype), g_i, g_p); - break; - case CON_SETSPRITE: - setsprite(spritenum, x, y, z); - break; - } + case CON_MOVESPRITE: + cliptype = GetGameVarID(*insptr++,g_i,g_p); + returnvar = *insptr++; + SetGameVarID(returnvar, movesprite(spritenum, x, y, z, cliptype), g_i, g_p); + break; + case CON_SETSPRITE: + setsprite(spritenum, x, y, z); break; } + break; + } case CON_GETFLORZOFSLOPE: case CON_GETCEILZOFSLOPE: + { + short sectnum; + long x, y; + unsigned long returnvar; + insptr++; + sectnum = GetGameVarID(*insptr++,g_i,g_p); + x = GetGameVarID(*insptr++,g_i,g_p); + y = GetGameVarID(*insptr++,g_i,g_p); + returnvar = *insptr++; + switch (tw) { - short sectnum; - long x, y; - unsigned long returnvar; - insptr++; - sectnum = GetGameVarID(*insptr++,g_i,g_p); - x = GetGameVarID(*insptr++,g_i,g_p); - y = GetGameVarID(*insptr++,g_i,g_p); - returnvar = *insptr++; - switch(tw) - { - case CON_GETFLORZOFSLOPE: - SetGameVarID(returnvar, getflorzofslope(sectnum,x,y), g_i, g_p); - break; - case CON_GETCEILZOFSLOPE: - SetGameVarID(returnvar, getceilzofslope(sectnum,x,y), g_i, g_p); - break; - } + case CON_GETFLORZOFSLOPE: + SetGameVarID(returnvar, getflorzofslope(sectnum,x,y), g_i, g_p); + break; + case CON_GETCEILZOFSLOPE: + SetGameVarID(returnvar, getceilzofslope(sectnum,x,y), g_i, g_p); break; } + break; + } case CON_UPDATESECTOR: case CON_UPDATESECTORZ: - { - long x,y,z=0; - int var; - short w; + { + long x,y,z=0; + int var; + short w; - w=sprite[g_i].sectnum; + w=sprite[g_i].sectnum; - insptr++; + insptr++; - x=GetGameVarID(*insptr++,g_i,g_p); - y=GetGameVarID(*insptr++,g_i,g_p); - if (tw==CON_UPDATESECTORZ) z=GetGameVarID(*insptr++,g_i,g_p); - var=*insptr++; + x=GetGameVarID(*insptr++,g_i,g_p); + y=GetGameVarID(*insptr++,g_i,g_p); + if (tw==CON_UPDATESECTORZ) z=GetGameVarID(*insptr++,g_i,g_p); + var=*insptr++; - if (tw==CON_UPDATESECTOR) updatesector(x,y,&w); - else if (tw==CON_UPDATESECTORZ) updatesectorz(x,y,z,&w); + if (tw==CON_UPDATESECTOR) updatesector(x,y,&w); + else if (tw==CON_UPDATESECTORZ) updatesectorz(x,y,z,&w); - SetGameVarID(var, w, g_i, g_p); - break; - } + SetGameVarID(var, w, g_i, g_p); + break; + } case CON_SPAWN: insptr++; - if(g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) + if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) spawn(g_i,*insptr); insptr++; break; @@ -5098,32 +5112,32 @@ SKIPJIBS: break; case CON_DEBRIS: - { - short dnum; + { + short dnum; - insptr++; - dnum = *insptr++; + insptr++; + dnum = *insptr++; - if(g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) - for(j=(*insptr)-1;j>=0;j--) - { - if(g_sp->picnum == BLIMP && dnum == SCRAP1) - s = 0; - else s = (TRAND%3); + if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) + for (j=(*insptr)-1;j>=0;j--) + { + if (g_sp->picnum == BLIMP && dnum == SCRAP1) + s = 0; + else s = (TRAND%3); - l = EGS(g_sp->sectnum, - g_sp->x+(TRAND&255)-128,g_sp->y+(TRAND&255)-128,g_sp->z-(8<<8)-(TRAND&8191), - dnum+s,g_sp->shade,32+(TRAND&15),32+(TRAND&15), - TRAND&2047,(TRAND&127)+32, - -(TRAND&2047),g_i,5); - if(g_sp->picnum == BLIMP && dnum == SCRAP1) - sprite[l].yvel = weaponsandammosprites[j%14]; - else sprite[l].yvel = -1; - sprite[l].pal = g_sp->pal; - } - insptr++; - } - break; + l = EGS(g_sp->sectnum, + g_sp->x+(TRAND&255)-128,g_sp->y+(TRAND&255)-128,g_sp->z-(8<<8)-(TRAND&8191), + dnum+s,g_sp->shade,32+(TRAND&15),32+(TRAND&15), + TRAND&2047,(TRAND&127)+32, + -(TRAND&2047),g_i,5); + if (g_sp->picnum == BLIMP && dnum == SCRAP1) + sprite[l].yvel = weaponsandammosprites[j%14]; + else sprite[l].yvel = -1; + sprite[l].pal = g_sp->pal; + } + insptr++; + } + break; case CON_COUNT: insptr++; @@ -5146,36 +5160,36 @@ SKIPJIBS: break; case CON_SAVE: - { - int i; - time_t curtime; - - insptr++; - i = *insptr++; - if(movesperpacket == 4 && connecthead != myconnectindex) - break; - - lastsavedpos = i; - curtime = time(NULL); - Bstrcpy(tempbuf,asctime(localtime(&curtime))); - clearbuf(ud.savegame[lastsavedpos],sizeof(ud.savegame[lastsavedpos]),0); - Bsprintf(ud.savegame[lastsavedpos],"Auto"); - for(i=0;i<13;i++) - Bmemcpy(&ud.savegame[lastsavedpos][i+4],&tempbuf[i+3],sizeof(tempbuf[i+3])); - ud.savegame[lastsavedpos][i+4] = '\0'; - OSD_Printf("Saving to slot %d\n",lastsavedpos); - - KB_FlushKeyboardQueue(); - - screencapt = 1; - displayrooms(myconnectindex,65536); - screencapt = 0; - if(ud.multimode > 1) - saveplayer(-1-(lastsavedpos)); - else saveplayer(lastsavedpos); + { + int i; + time_t curtime; + insptr++; + i = *insptr++; + if (movesperpacket == 4 && connecthead != myconnectindex) break; - } + + lastsavedpos = i; + curtime = time(NULL); + Bstrcpy(tempbuf,asctime(localtime(&curtime))); + clearbuf(ud.savegame[lastsavedpos],sizeof(ud.savegame[lastsavedpos]),0); + Bsprintf(ud.savegame[lastsavedpos],"Auto"); + for (i=0;i<13;i++) + Bmemcpy(&ud.savegame[lastsavedpos][i+4],&tempbuf[i+3],sizeof(tempbuf[i+3])); + ud.savegame[lastsavedpos][i+4] = '\0'; + OSD_Printf("Saving to slot %d\n",lastsavedpos); + + KB_FlushKeyboardQueue(); + + screencapt = 1; + displayrooms(myconnectindex,65536); + screencapt = 0; + if (ud.multimode > 1) + saveplayer(-1-(lastsavedpos)); + else saveplayer(lastsavedpos); + + break; + } case CON_IFMOVE: insptr++; @@ -5183,84 +5197,84 @@ SKIPJIBS: break; case CON_RESETPLAYER: + { + insptr++; + + //AddLog("resetplayer"); + if (ud.multimode < 2) { - insptr++; - - //AddLog("resetplayer"); - if(ud.multimode < 2) + if ( lastsavedpos >= 0 && ud.recstat != 2 ) { - if( lastsavedpos >= 0 && ud.recstat != 2 ) - { - ps[g_p].gm = MODE_MENU; - KB_ClearKeyDown(sc_Space); - cmenu(15000); - } - else ps[g_p].gm = MODE_RESTART; - killit_flag = 2; + ps[g_p].gm = MODE_MENU; + KB_ClearKeyDown(sc_Space); + cmenu(15000); } - else - { - pickrandomspot(g_p); - g_sp->x = hittype[g_i].bposx = ps[g_p].bobposx = ps[g_p].oposx = ps[g_p].posx; - g_sp->y = hittype[g_i].bposy = ps[g_p].bobposy = ps[g_p].oposy =ps[g_p].posy; - g_sp->z = hittype[g_i].bposy = ps[g_p].oposz =ps[g_p].posz; - updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum); - setsprite(ps[g_p].i,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+PHEIGHT); - g_sp->cstat = 257; - - g_sp->shade = -12; - g_sp->clipdist = 64; - g_sp->xrepeat = 42; - g_sp->yrepeat = 36; - g_sp->owner = g_i; - g_sp->xoffset = 0; - g_sp->pal = ps[g_p].palookup; - - ps[g_p].last_extra = g_sp->extra = max_player_health; - ps[g_p].wantweaponfire = -1; - ps[g_p].horiz = 100; - ps[g_p].on_crane = -1; - ps[g_p].frag_ps = g_p; - ps[g_p].horizoff = 0; - ps[g_p].opyoff = 0; - ps[g_p].wackedbyactor = -1; - ps[g_p].shield_amount = max_armour_amount; - ps[g_p].dead_flag = 0; - ps[g_p].pals_time = 0; - ps[g_p].footprintcount = 0; - ps[g_p].weapreccnt = 0; - ps[g_p].fta = 0; - ps[g_p].ftq = 0; - ps[g_p].posxv = ps[g_p].posyv = 0; - ps[g_p].rotscrnang = 0; - ps[g_p].runspeed = dukefriction; - ps[g_p].falling_counter = 0; - - hittype[g_i].extra = -1; - hittype[g_i].owner = g_i; - - hittype[g_i].cgg = 0; - hittype[g_i].movflag = 0; - hittype[g_i].tempang = 0; - hittype[g_i].actorstayput = -1; - hittype[g_i].dispicnum = 0; - hittype[g_i].owner = ps[g_p].i; - - resetinventory(g_p); - resetweapons(g_p); - - ps[g_p].reloading = 0; - - ps[g_p].movement_lock = 0; - - OnEvent(EVENT_RESETPLAYER, ps[g_p].i, g_p, -1); - cameradist = 0; - cameraclock = totalclock; - } - setpal(&ps[g_p]); - //AddLog("EOF: resetplayer"); + else ps[g_p].gm = MODE_RESTART; + killit_flag = 2; } - break; + else + { + pickrandomspot(g_p); + g_sp->x = hittype[g_i].bposx = ps[g_p].bobposx = ps[g_p].oposx = ps[g_p].posx; + g_sp->y = hittype[g_i].bposy = ps[g_p].bobposy = ps[g_p].oposy =ps[g_p].posy; + g_sp->z = hittype[g_i].bposy = ps[g_p].oposz =ps[g_p].posz; + updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum); + setsprite(ps[g_p].i,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+PHEIGHT); + g_sp->cstat = 257; + + g_sp->shade = -12; + g_sp->clipdist = 64; + g_sp->xrepeat = 42; + g_sp->yrepeat = 36; + g_sp->owner = g_i; + g_sp->xoffset = 0; + g_sp->pal = ps[g_p].palookup; + + ps[g_p].last_extra = g_sp->extra = max_player_health; + ps[g_p].wantweaponfire = -1; + ps[g_p].horiz = 100; + ps[g_p].on_crane = -1; + ps[g_p].frag_ps = g_p; + ps[g_p].horizoff = 0; + ps[g_p].opyoff = 0; + ps[g_p].wackedbyactor = -1; + ps[g_p].shield_amount = max_armour_amount; + ps[g_p].dead_flag = 0; + ps[g_p].pals_time = 0; + ps[g_p].footprintcount = 0; + ps[g_p].weapreccnt = 0; + ps[g_p].fta = 0; + ps[g_p].ftq = 0; + ps[g_p].posxv = ps[g_p].posyv = 0; + ps[g_p].rotscrnang = 0; + ps[g_p].runspeed = dukefriction; + ps[g_p].falling_counter = 0; + + hittype[g_i].extra = -1; + hittype[g_i].owner = g_i; + + hittype[g_i].cgg = 0; + hittype[g_i].movflag = 0; + hittype[g_i].tempang = 0; + hittype[g_i].actorstayput = -1; + hittype[g_i].dispicnum = 0; + hittype[g_i].owner = ps[g_p].i; + + resetinventory(g_p); + resetweapons(g_p); + + ps[g_p].reloading = 0; + + ps[g_p].movement_lock = 0; + + OnEvent(EVENT_RESETPLAYER, ps[g_p].i, g_p, -1); + cameradist = 0; + cameraclock = totalclock; + } + setpal(&ps[g_p]); + //AddLog("EOF: resetplayer"); + } + break; case CON_IFONWATER: parseifelse( klabs(g_sp->z-sector[g_sp->sectnum].floorz) < (32<<8) && sector[g_sp->sectnum].lotag == 1); @@ -5287,7 +5301,7 @@ SKIPJIBS: case CON_ADDINVENTORY: insptr+=2; - switch(*(insptr-1)) + switch (*(insptr-1)) { case GET_STEROIDS: ps[g_p].steroids_amount = *insptr; @@ -5296,7 +5310,7 @@ SKIPJIBS: case GET_SHIELD: ps[g_p].shield_amount += *insptr;// 100; - if(ps[g_p].shield_amount > max_player_health) + if (ps[g_p].shield_amount > max_player_health) ps[g_p].shield_amount = max_player_health; break; @@ -5316,11 +5330,14 @@ SKIPJIBS: break; case GET_ACCESS: - switch(g_sp->pal) + switch (g_sp->pal) { - case 0: ps[g_p].got_access |= 1;break; - case 21: ps[g_p].got_access |= 2;break; - case 23: ps[g_p].got_access |= 4;break; + case 0: + ps[g_p].got_access |= 1;break; + case 21: + ps[g_p].got_access |= 2;break; + case 23: + ps[g_p].got_access |= 4;break; } break; @@ -5348,62 +5365,62 @@ SKIPJIBS: break; case CON_IFP: + { + insptr++; + + l = *insptr; + j = 0; + + s = sprite[ps[g_p].i].xvel; + + if ( (l&8) && ps[g_p].on_ground && (sync[g_p].bits&2) ) + j = 1; + else if ( (l&16) && ps[g_p].jumping_counter == 0 && !ps[g_p].on_ground && + ps[g_p].poszv > 2048 ) + j = 1; + else if ( (l&32) && ps[g_p].jumping_counter > 348 ) + j = 1; + else if ( (l&1) && s >= 0 && s < 8) + j = 1; + else if ( (l&2) && s >= 8 && !(sync[g_p].bits&(1<<5)) ) + j = 1; + else if ( (l&4) && s >= 8 && sync[g_p].bits&(1<<5) ) + j = 1; + else if ( (l&64) && ps[g_p].posz < (g_sp->z-(48<<8)) ) + j = 1; + else if ( (l&128) && s <= -8 && !(sync[g_p].bits&(1<<5)) ) + j = 1; + else if ( (l&256) && s <= -8 && (sync[g_p].bits&(1<<5)) ) + j = 1; + else if ( (l&512) && ( ps[g_p].quick_kick > 0 || ( ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0 ) ) ) + j = 1; + else if ( (l&1024) && sprite[ps[g_p].i].xrepeat < 32 ) + j = 1; + else if ( (l&2048) && ps[g_p].jetpack_on ) + j = 1; + else if ( (l&4096) && ps[g_p].steroids_amount > 0 && ps[g_p].steroids_amount < 400 ) + j = 1; + else if ( (l&8192) && ps[g_p].on_ground) + j = 1; + else if ( (l&16384) && sprite[ps[g_p].i].xrepeat > 32 && sprite[ps[g_p].i].extra > 0 && ps[g_p].timebeforeexit == 0 ) + j = 1; + else if ( (l&32768) && sprite[ps[g_p].i].extra <= 0) + j = 1; + else if ( (l&65536L) ) { - insptr++; + if (g_sp->picnum == APLAYER && ud.multimode > 1) + j = getincangle(ps[otherp].ang,getangle(ps[g_p].posx-ps[otherp].posx,ps[g_p].posy-ps[otherp].posy)); + else + j = getincangle(ps[g_p].ang,getangle(g_sp->x-ps[g_p].posx,g_sp->y-ps[g_p].posy)); - l = *insptr; - j = 0; - - s = sprite[ps[g_p].i].xvel; - - if( (l&8) && ps[g_p].on_ground && (sync[g_p].bits&2) ) + if ( j > -128 && j < 128 ) j = 1; - else if( (l&16) && ps[g_p].jumping_counter == 0 && !ps[g_p].on_ground && - ps[g_p].poszv > 2048 ) - j = 1; - else if( (l&32) && ps[g_p].jumping_counter > 348 ) - j = 1; - else if( (l&1) && s >= 0 && s < 8) - j = 1; - else if( (l&2) && s >= 8 && !(sync[g_p].bits&(1<<5)) ) - j = 1; - else if( (l&4) && s >= 8 && sync[g_p].bits&(1<<5) ) - j = 1; - else if( (l&64) && ps[g_p].posz < (g_sp->z-(48<<8)) ) - j = 1; - else if( (l&128) && s <= -8 && !(sync[g_p].bits&(1<<5)) ) - j = 1; - else if( (l&256) && s <= -8 && (sync[g_p].bits&(1<<5)) ) - j = 1; - else if( (l&512) && ( ps[g_p].quick_kick > 0 || ( ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0 ) ) ) - j = 1; - else if( (l&1024) && sprite[ps[g_p].i].xrepeat < 32 ) - j = 1; - else if( (l&2048) && ps[g_p].jetpack_on ) - j = 1; - else if( (l&4096) && ps[g_p].steroids_amount > 0 && ps[g_p].steroids_amount < 400 ) - j = 1; - else if( (l&8192) && ps[g_p].on_ground) - j = 1; - else if( (l&16384) && sprite[ps[g_p].i].xrepeat > 32 && sprite[ps[g_p].i].extra > 0 && ps[g_p].timebeforeexit == 0 ) - j = 1; - else if( (l&32768) && sprite[ps[g_p].i].extra <= 0) - j = 1; - else if( (l&65536L) ) - { - if(g_sp->picnum == APLAYER && ud.multimode > 1) - j = getincangle(ps[otherp].ang,getangle(ps[g_p].posx-ps[otherp].posx,ps[g_p].posy-ps[otherp].posy)); - else - j = getincangle(ps[g_p].ang,getangle(g_sp->x-ps[g_p].posx,g_sp->y-ps[g_p].posy)); - - if( j > -128 && j < 128 ) - j = 1; - else - j = 0; - } - parseifelse((long) j); + else + j = 0; } - break; + parseifelse((long) j); + } + break; case CON_IFSTRENGTH: insptr++; @@ -5458,22 +5475,22 @@ SKIPJIBS: case CON_OPERATE: insptr++; - if( sector[g_sp->sectnum].lotag == 0 ) + if ( sector[g_sp->sectnum].lotag == 0 ) { neartag(g_sp->x,g_sp->y,g_sp->z-(32<<8),g_sp->sectnum,g_sp->ang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,768L,1); - if( neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag) ) - if( (sector[neartagsector].lotag&0xff) == 23 || sector[neartagsector].floorz == sector[neartagsector].ceilingz ) - if( (sector[neartagsector].lotag&16384) == 0 ) - if( (sector[neartagsector].lotag&32768) == 0 ) + if ( neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag) ) + if ( (sector[neartagsector].lotag&0xff) == 23 || sector[neartagsector].floorz == sector[neartagsector].ceilingz ) + if ( (sector[neartagsector].lotag&16384) == 0 ) + if ( (sector[neartagsector].lotag&32768) == 0 ) { j = headspritesect[neartagsector]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum == ACTIVATOR) + if (sprite[j].picnum == ACTIVATOR) break; j = nextspritesect[j]; } - if(j == -1) + if (j == -1) operatesectors(neartagsector,g_i); } } @@ -5485,7 +5502,7 @@ SKIPJIBS: case CON_SPRITEPAL: insptr++; - if(g_sp->picnum != APLAYER) + if (g_sp->picnum != APLAYER) hittype[g_i].tempang = g_sp->pal; g_sp->pal = *insptr++; break; @@ -5500,9 +5517,9 @@ SKIPJIBS: break; case CON_IFRESPAWN: - if( badguy(g_sp) ) + if ( badguy(g_sp) ) parseifelse( ud.respawn_monsters ); - else if( inventory(g_sp) ) + else if ( inventory(g_sp) ) parseifelse( ud.respawn_inventory ); else parseifelse( ud.respawn_items ); @@ -5521,1138 +5538,1138 @@ SKIPJIBS: case CON_PALFROM: insptr++; ps[g_p].pals_time = *insptr++; - for(j=0;j<3;j++) + for (j=0;j<3;j++) ps[g_p].pals[j] = *insptr++; break; case CON_QSPRINTF: + { + long var1, var2, var3, var4, sq, dq; + insptr++; + dq = *insptr++; + sq = *insptr++; + if (fta_quotes[sq] != NULL && fta_quotes[dq] != NULL) { - long var1, var2, var3, var4, sq, dq; - insptr++; - dq = *insptr++; - sq = *insptr++; - if(fta_quotes[sq] != NULL && fta_quotes[dq] != NULL) - { - Bstrcpy(tempbuf,fta_quotes[sq]); - var1 = GetGameVarID(*insptr++, g_i, g_p); - var2 = GetGameVarID(*insptr++, g_i, g_p); - var3 = GetGameVarID(*insptr++, g_i, g_p); - var4 = GetGameVarID(*insptr++, g_i, g_p); - Bsprintf(fta_quotes[dq],tempbuf,var1,var2,var3,var4); - } else { - if(fta_quotes[sq] == NULL) OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,sq); - if(fta_quotes[dq] == NULL) OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,dq); - insptr += 5; - } - break; + Bstrcpy(tempbuf,fta_quotes[sq]); + var1 = GetGameVarID(*insptr++, g_i, g_p); + var2 = GetGameVarID(*insptr++, g_i, g_p); + var3 = GetGameVarID(*insptr++, g_i, g_p); + var4 = GetGameVarID(*insptr++, g_i, g_p); + Bsprintf(fta_quotes[dq],tempbuf,var1,var2,var3,var4); + } else { + if (fta_quotes[sq] == NULL) OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,sq); + if (fta_quotes[dq] == NULL) OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,dq); + insptr += 5; } + break; + } case CON_ADDLOG: - { - long l; - insptr++; - l=*insptr++; // var - Bsprintf(g_szBuf,"CONLOG: L=%ld",l); - AddLog(g_szBuf); - break; - } + { + long l; + insptr++; + l=*insptr++; // var + Bsprintf(g_szBuf,"CONLOG: L=%ld",l); + AddLog(g_szBuf); + break; + } case CON_ADDLOGVAR: + { + long l,m=1,lVarID; + char szBuf[256]; + insptr++; + l=*insptr++; // l=Line number, *instpr=varID + + lVarID = *insptr; + if ( (lVarID >= iGameVarCount) || lVarID < 0) { - long l,m=1,lVarID; - char szBuf[256]; - insptr++; - l=*insptr++; // l=Line number, *instpr=varID - - lVarID = *insptr; - if( (lVarID >= iGameVarCount) || lVarID < 0) - { - if(*insptr==MAXGAMEVARS) // addlogvar for a constant? Har. - insptr++; - else if(*insptr&(MAXGAMEVARS<<1)) - { - m = -1; - lVarID ^= (MAXGAMEVARS<<1); - goto good; - } - // invalid varID + if (*insptr==MAXGAMEVARS) // addlogvar for a constant? Har. insptr++; - Bsprintf(g_szBuf,"CONLOGVAR: L=%ld INVALID VARIABLE",l); - AddLog(g_szBuf); - break; // out of switch - } -good: - Bsprintf(szBuf,"CONLOGVAR: L=%ld %s ",l, aGameVars[lVarID].szLabel); - strcpy(g_szBuf,szBuf); - - if( aGameVars[lVarID].dwFlags & GAMEVAR_FLAG_READONLY) + else if (*insptr&(MAXGAMEVARS<<1)) { - Bsprintf(szBuf," (read-only)"); - strcat(g_szBuf,szBuf); + m = -1; + lVarID ^= (MAXGAMEVARS<<1); + goto good; } - if( aGameVars[lVarID].dwFlags & GAMEVAR_FLAG_PERPLAYER) - { - Bsprintf(szBuf," (Per Player. Player=%d)",g_p); - } - else if( aGameVars[lVarID].dwFlags & GAMEVAR_FLAG_PERACTOR) - { - Bsprintf(szBuf," (Per Actor. Actor=%d)",g_i); - } - else - { - Bsprintf(szBuf," (Global)"); - } - strcat(g_szBuf,szBuf); - Bsprintf(szBuf," =%ld", GetGameVarID(lVarID, g_i, g_p)*m); - strcat(g_szBuf,szBuf); - AddLog(g_szBuf); + // invalid varID insptr++; - break; + Bsprintf(g_szBuf,"CONLOGVAR: L=%ld INVALID VARIABLE",l); + AddLog(g_szBuf); + break; // out of switch } +good: + Bsprintf(szBuf,"CONLOGVAR: L=%ld %s ",l, aGameVars[lVarID].szLabel); + strcpy(g_szBuf,szBuf); + + if ( aGameVars[lVarID].dwFlags & GAMEVAR_FLAG_READONLY) + { + Bsprintf(szBuf," (read-only)"); + strcat(g_szBuf,szBuf); + } + if ( aGameVars[lVarID].dwFlags & GAMEVAR_FLAG_PERPLAYER) + { + Bsprintf(szBuf," (Per Player. Player=%d)",g_p); + } + else if ( aGameVars[lVarID].dwFlags & GAMEVAR_FLAG_PERACTOR) + { + Bsprintf(szBuf," (Per Actor. Actor=%d)",g_i); + } + else + { + Bsprintf(szBuf," (Global)"); + } + strcat(g_szBuf,szBuf); + Bsprintf(szBuf," =%ld", GetGameVarID(lVarID, g_i, g_p)*m); + strcat(g_szBuf,szBuf); + AddLog(g_szBuf); + insptr++; + break; + } case CON_SETSECTOR: case CON_GETSECTOR: - { - // syntax [gs]etsector[].x - // - long lLabelID; - long lVar1, lVar2; + { + // syntax [gs]etsector[].x + // + long lLabelID; + long lVar1, lVar2; - insptr++; - lVar1=*insptr++; - lLabelID=*insptr++; - lVar2=*insptr++; - DoSector(tw==CON_SETSECTOR, lVar1, lLabelID, lVar2, g_i, g_p); - break; - } + insptr++; + lVar1=*insptr++; + lLabelID=*insptr++; + lVar2=*insptr++; + DoSector(tw==CON_SETSECTOR, lVar1, lLabelID, lVar2, g_i, g_p); + break; + } case CON_SQRT: - { - // syntax sqrt + { + // syntax sqrt - long lInVarID; - long lOutVarID; - long lIn; + long lInVarID; + long lOutVarID; + long lIn; - insptr++; - lInVarID=*insptr++; - lOutVarID=*insptr++; - lIn=GetGameVarID(lInVarID, g_i, g_p); - SetGameVarID(lOutVarID, ksqrt(lIn), g_i, g_p); - break; - } + insptr++; + lInVarID=*insptr++; + lOutVarID=*insptr++; + lIn=GetGameVarID(lInVarID, g_i, g_p); + SetGameVarID(lOutVarID, ksqrt(lIn), g_i, g_p); + break; + } case CON_FINDNEARACTOR: case CON_FINDNEARSPRITE: case CON_FINDNEARACTOR3D: case CON_FINDNEARSPRITE3D: + { + // syntax findnearactorvar + // gets the sprite ID of the nearest actor within max dist + // that is of into + // -1 for none found + // + long lType, lMaxDist, lVarID, lTemp, lFound; + short j, k; + + insptr++; + + lType=*insptr++; + lMaxDist=*insptr++; + lVarID=*insptr++; + + lFound=-1; + + for (k=0;k - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - // - long lType, lMaxDist, lVarID, lTemp, lFound; - short j, k; - - insptr++; - - lType=*insptr++; - lMaxDist=*insptr++; - lVarID=*insptr++; - - lFound=-1; - - for (k=0;k=0) { - j=headspritestat[(tw==CON_FINDNEARACTOR||tw==CON_FINDNEARACTOR3D)?1:k]; // all sprites - while(j>=0) + if (sprite[j].picnum == lType && j != g_i) { - if(sprite[j].picnum == lType && j != g_i) + if (tw==CON_FINDNEARACTOR3D || tw==CON_FINDNEARSPRITE3D) + lTemp=dist(&sprite[g_i], &sprite[j]); + else lTemp=ldist(&sprite[g_i], &sprite[j]); + if (lTemp < lMaxDist) { - if(tw==CON_FINDNEARACTOR3D || tw==CON_FINDNEARSPRITE3D) - lTemp=dist(&sprite[g_i], &sprite[j]); - else lTemp=ldist(&sprite[g_i], &sprite[j]); - if(lTemp < lMaxDist) - { - lFound=j; - j = MAXSPRITES; - break; - } + lFound=j; + j = MAXSPRITES; + break; } - j = nextspritestat[j]; } - if((tw==CON_FINDNEARACTOR||tw==CON_FINDNEARACTOR3D) || j == MAXSPRITES) - break; + j = nextspritestat[j]; } - SetGameVarID(lVarID, lFound, g_i, g_p); - break; + if ((tw==CON_FINDNEARACTOR||tw==CON_FINDNEARACTOR3D) || j == MAXSPRITES) + break; } + SetGameVarID(lVarID, lFound, g_i, g_p); + break; + } case CON_FINDNEARACTORVAR: case CON_FINDNEARSPRITEVAR: case CON_FINDNEARACTOR3DVAR: case CON_FINDNEARSPRITE3DVAR: + { + // syntax findnearactorvar + // gets the sprite ID of the nearest actor within max dist + // that is of into + // -1 for none found + // + long lType, lMaxDist; + long lVarID, lTemp, lFound; + short j, k; + + insptr++; + + lType=*insptr++; + lMaxDist=GetGameVarID(*insptr++, g_i, g_p); + lVarID=*insptr++; + lFound=-1; + + for (k=0;k - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - // - long lType, lMaxDist; - long lVarID, lTemp, lFound; - short j, k; - - insptr++; - - lType=*insptr++; - lMaxDist=GetGameVarID(*insptr++, g_i, g_p); - lVarID=*insptr++; - lFound=-1; - - for (k=0;k=0) { - j=headspritestat[(tw==CON_FINDNEARACTORVAR||tw==CON_FINDNEARACTOR3DVAR)?1:k]; // all sprites - while(j>=0) + if (sprite[j].picnum == lType && j != g_i) { - if(sprite[j].picnum == lType && j != g_i) + if (tw==CON_FINDNEARACTOR3DVAR || tw==CON_FINDNEARSPRITE3DVAR) + lTemp=dist(&sprite[g_i], &sprite[j]); + else lTemp=ldist(&sprite[g_i], &sprite[j]); + if ( lTemp < lMaxDist) { - if(tw==CON_FINDNEARACTOR3DVAR || tw==CON_FINDNEARSPRITE3DVAR) - lTemp=dist(&sprite[g_i], &sprite[j]); - else lTemp=ldist(&sprite[g_i], &sprite[j]); - if( lTemp < lMaxDist) + lFound=j; + j = MAXSPRITES; + break; + } + } + j = nextspritestat[j]; + } + if ((tw==CON_FINDNEARACTORVAR||tw==CON_FINDNEARACTOR3DVAR) || j == MAXSPRITES) + break; + } + SetGameVarID(lVarID, lFound, g_i, g_p); + break; + } + + case CON_FINDNEARACTORZVAR: + case CON_FINDNEARSPRITEZVAR: + { + // syntax findnearactorvar + // gets the sprite ID of the nearest actor within max dist + // that is of into + // -1 for none found + // + long lType, lMaxDist, lMaxZDist; + long lVarID, lTemp, lTemp2, lFound; + short j, k; + + insptr++; + + lType=*insptr++; + lMaxDist=GetGameVarID(*insptr++, g_i, g_p); + lMaxZDist=GetGameVarID(*insptr++, g_i, g_p); + lVarID=*insptr++; + lFound=-1; + + for (k=0;k=0) + { + if (sprite[j].picnum == lType && j != g_i) + { + lTemp=ldist(&sprite[g_i], &sprite[j]); + if (lTemp < lMaxDist) + { + lTemp2=klabs(sprite[g_i].z-sprite[j].z); + if (lTemp2 < lMaxZDist) { lFound=j; j = MAXSPRITES; break; } } - j = nextspritestat[j]; } - if((tw==CON_FINDNEARACTORVAR||tw==CON_FINDNEARACTOR3DVAR) || j == MAXSPRITES) - break; + j = nextspritestat[j]; } - SetGameVarID(lVarID, lFound, g_i, g_p); - break; + if (tw==CON_FINDNEARACTORZVAR || j == MAXSPRITES) + break; } + SetGameVarID(lVarID, lFound, g_i, g_p); - case CON_FINDNEARACTORZVAR: - case CON_FINDNEARSPRITEZVAR: - { - // syntax findnearactorvar - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - // - long lType, lMaxDist, lMaxZDist; - long lVarID, lTemp, lTemp2, lFound; - short j, k; - - insptr++; - - lType=*insptr++; - lMaxDist=GetGameVarID(*insptr++, g_i, g_p); - lMaxZDist=GetGameVarID(*insptr++, g_i, g_p); - lVarID=*insptr++; - lFound=-1; - - for (k=0;k=0) - { - if(sprite[j].picnum == lType && j != g_i) - { - lTemp=ldist(&sprite[g_i], &sprite[j]); - if(lTemp < lMaxDist) - { - lTemp2=klabs(sprite[g_i].z-sprite[j].z); - if (lTemp2 < lMaxZDist) - { - lFound=j; - j = MAXSPRITES; - break; - } - } - } - j = nextspritestat[j]; - } - if(tw==CON_FINDNEARACTORZVAR || j == MAXSPRITES) - break; - } - SetGameVarID(lVarID, lFound, g_i, g_p); - - break; - } + break; + } case CON_FINDNEARACTORZ: case CON_FINDNEARSPRITEZ: + { + // syntax findnearactorvar + // gets the sprite ID of the nearest actor within max dist + // that is of into + // -1 for none found + // + long lType, lMaxDist, lMaxZDist, lVarID; + long lTemp, lTemp2, lFound; + short j, k; + + insptr++; + + lType=*insptr++; + lMaxDist=*insptr++; + lMaxZDist=*insptr++; + lVarID=*insptr++; + + lFound=-1; + + for (k=0;k - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - // - long lType, lMaxDist, lMaxZDist, lVarID; - long lTemp, lTemp2, lFound; - short j, k; - - insptr++; - - lType=*insptr++; - lMaxDist=*insptr++; - lMaxZDist=*insptr++; - lVarID=*insptr++; - - lFound=-1; - - for (k=0;k=0) { - j=headspritestat[tw==CON_FINDNEARACTORZ?1:k]; // all sprites - while(j>=0) + if (sprite[j].picnum == lType && j != g_i) { - if(sprite[j].picnum == lType && j != g_i) + lTemp=ldist(&sprite[g_i], &sprite[j]); + if (lTemp < lMaxDist) { - lTemp=ldist(&sprite[g_i], &sprite[j]); - if(lTemp < lMaxDist) + lTemp2=klabs(sprite[g_i].z-sprite[j].z); + if (lTemp2 < lMaxZDist) { - lTemp2=klabs(sprite[g_i].z-sprite[j].z); - if (lTemp2 < lMaxZDist) - { - lFound=j; - j = MAXSPRITES; - break; - } + lFound=j; + j = MAXSPRITES; + break; } } - j = nextspritestat[j]; } - if(tw==CON_FINDNEARACTORZ || j == MAXSPRITES) - break; + j = nextspritestat[j]; } - SetGameVarID(lVarID, lFound, g_i, g_p); - break; + if (tw==CON_FINDNEARACTORZ || j == MAXSPRITES) + break; } + SetGameVarID(lVarID, lFound, g_i, g_p); + break; + } case CON_FINDPLAYER: case CON_FINDOTHERPLAYER: - { - // syntax findnearactorvar - // gets the sprite ID of the nearest actor within max dist - // that is of into - // -1 for none found - // - short j=0; - long var1, d; + { + // syntax findnearactorvar + // gets the sprite ID of the nearest actor within max dist + // that is of into + // -1 for none found + // + short j=0; + long var1, d; - insptr++; - var1 = *insptr++; + insptr++; + var1 = *insptr++; - if (tw == CON_FINDPLAYER) j=findplayer(&sprite[g_i],&d); - else if (tw == CON_FINDOTHERPLAYER) j=findotherplayer(g_i,&d); + if (tw == CON_FINDPLAYER) j=findplayer(&sprite[g_i],&d); + else if (tw == CON_FINDOTHERPLAYER) j=findotherplayer(g_i,&d); - SetGameVarID(g_iReturnVarID, j, g_i, g_p); - SetGameVarID(var1, d, g_i, g_p); + SetGameVarID(g_iReturnVarID, j, g_i, g_p); + SetGameVarID(var1, d, g_i, g_p); - break; - } + break; + } case CON_SETPLAYER: case CON_GETPLAYER: + { + // syntax [gs]etplayer[].x + // + long lLabelID; + long lVar1, lVar2; + long lParm2; + + insptr++; + lVar1=*insptr++; + lLabelID=*insptr++; + // HACK: need to have access to labels structure at run-time... + + switch (lLabelID) { - // syntax [gs]etplayer[].x - // - long lLabelID; - long lVar1, lVar2; - long lParm2; - - insptr++; - lVar1=*insptr++; - lLabelID=*insptr++; - // HACK: need to have access to labels structure at run-time... - - switch(lLabelID) - { - case PLAYER_AMMO_AMOUNT: - case PLAYER_GOTWEAPON: - case PLAYER_PALS: - case PLAYER_LOOGIEX: - case PLAYER_LOOGIEY: - lParm2=GetGameVarID(*insptr++, g_i, g_p); - break; - default: - lParm2=0; - break; - } - lVar2=*insptr++; - - DoPlayer(tw==CON_SETPLAYER, lVar1, lLabelID, lVar2, g_i, g_p, lParm2); + case PLAYER_AMMO_AMOUNT: + case PLAYER_GOTWEAPON: + case PLAYER_PALS: + case PLAYER_LOOGIEX: + case PLAYER_LOOGIEY: + lParm2=GetGameVarID(*insptr++, g_i, g_p); + break; + default: + lParm2=0; break; } + lVar2=*insptr++; + + DoPlayer(tw==CON_SETPLAYER, lVar1, lLabelID, lVar2, g_i, g_p, lParm2); + break; + } case CON_SETINPUT: case CON_GETINPUT: - { - // syntax [gs]etplayer[].x - // - long lLabelID; - long lVar1, lVar2; + { + // syntax [gs]etplayer[].x + // + long lLabelID; + long lVar1, lVar2; - insptr++; - lVar1=*insptr++; - lLabelID=*insptr++; + insptr++; + lVar1=*insptr++; + lLabelID=*insptr++; - lVar2=*insptr++; + lVar2=*insptr++; - DoInput(tw==CON_SETINPUT, lVar1, lLabelID, lVar2, g_i, g_p); - break; - } + DoInput(tw==CON_SETINPUT, lVar1, lLabelID, lVar2, g_i, g_p); + break; + } case CON_GETUSERDEF: case CON_SETUSERDEF: - { - // syntax [gs]etuserdef.xxx - // - long lLabelID; - long lVar2; + { + // syntax [gs]etuserdef.xxx + // + long lLabelID; + long lVar2; - insptr++; - lLabelID=*insptr++; - lVar2=*insptr++; + insptr++; + lLabelID=*insptr++; + lVar2=*insptr++; - DoUserDef(tw==CON_SETUSERDEF, lLabelID, lVar2, g_i, g_p); - break; - } + DoUserDef(tw==CON_SETUSERDEF, lLabelID, lVar2, g_i, g_p); + break; + } case CON_GETPROJECTILE: case CON_SETPROJECTILE: - { - // syntax [gs]etplayer[].x - // - long lLabelID; - long lVar1, lVar2; + { + // syntax [gs]etplayer[].x + // + long lLabelID; + long lVar1, lVar2; - insptr++; - lVar1=GetGameVarID(*insptr++, g_i, g_p); - lLabelID=*insptr++; - lVar2=*insptr++; - DoProjectile(tw==CON_SETPROJECTILE,lVar1,lLabelID,lVar2,g_i,g_p); + insptr++; + lVar1=GetGameVarID(*insptr++, g_i, g_p); + lLabelID=*insptr++; + lVar2=*insptr++; + DoProjectile(tw==CON_SETPROJECTILE,lVar1,lLabelID,lVar2,g_i,g_p); - break; - } + break; + } case CON_SETWALL: case CON_GETWALL: - { - // syntax [gs]etwall[].x - // - long lLabelID; - long lVar1, lVar2; + { + // syntax [gs]etwall[].x + // + long lLabelID; + long lVar1, lVar2; - insptr++; - lVar1=*insptr++; - lLabelID=*insptr++; - lVar2=*insptr++; + insptr++; + lVar1=*insptr++; + lLabelID=*insptr++; + lVar2=*insptr++; - DoWall(tw==CON_SETWALL, lVar1, lLabelID, lVar2, g_i, g_p); - break; - } + DoWall(tw==CON_SETWALL, lVar1, lLabelID, lVar2, g_i, g_p); + break; + } case CON_SETACTORVAR: case CON_GETACTORVAR: + { + // syntax [gs]etactorvar[]. + // gets the value of the per-actor variable varx into VAR + // + long lVar1, lVar2, lVar3; + long lTemp,lSprite; + + insptr++; + + lVar1=*insptr++; + lVar2=*insptr++; + lVar3=*insptr++; + + lSprite=GetGameVarID(lVar1, g_i, g_p); + switch (tw) { - // syntax [gs]etactorvar[]. - // gets the value of the per-actor variable varx into VAR - // - long lVar1, lVar2, lVar3; - long lTemp,lSprite; - - insptr++; - - lVar1=*insptr++; - lVar2=*insptr++; - lVar3=*insptr++; - - lSprite=GetGameVarID(lVar1, g_i, g_p); - switch(tw) - { - case CON_SETACTORVAR: - lTemp=GetGameVarID(lVar3, g_i, g_p); - SetGameVarID(lVar2, lTemp, lSprite, g_p); - break; - case CON_GETACTORVAR: - lTemp=GetGameVarID(lVar2, lSprite, g_p); - SetGameVarID(lVar3, lTemp, g_i, g_p); - break; - } + case CON_SETACTORVAR: + lTemp=GetGameVarID(lVar3, g_i, g_p); + SetGameVarID(lVar2, lTemp, lSprite, g_p); + break; + case CON_GETACTORVAR: + lTemp=GetGameVarID(lVar2, lSprite, g_p); + SetGameVarID(lVar3, lTemp, g_i, g_p); break; } + break; + } case CON_SETPLAYERVAR: case CON_GETPLAYERVAR: + { + // syntax [gs]etactorvar[]. + // gets the value of the per-actor variable varx into VAR + // + long lVar1, lVar2, lVar3; + long lTemp,lSprite; + + insptr++; + + lVar1=*insptr++; + lVar2=*insptr++; + lVar3=*insptr++; + + lSprite=GetGameVarID(lVar1, g_i, g_p); + switch (tw) { - // syntax [gs]etactorvar[]. - // gets the value of the per-actor variable varx into VAR - // - long lVar1, lVar2, lVar3; - long lTemp,lSprite; - - insptr++; - - lVar1=*insptr++; - lVar2=*insptr++; - lVar3=*insptr++; - - lSprite=GetGameVarID(lVar1, g_i, g_p); - switch(tw) - { - case CON_SETPLAYERVAR: - lTemp=GetGameVarID(lVar3, g_i, g_p); - SetGameVarID(lVar2, lTemp, g_i, lSprite); - break; - case CON_GETPLAYERVAR: - lTemp=GetGameVarID(lVar2, g_i, lSprite); - SetGameVarID(lVar3, lTemp, g_i, g_p); - break; - } + case CON_SETPLAYERVAR: + lTemp=GetGameVarID(lVar3, g_i, g_p); + SetGameVarID(lVar2, lTemp, g_i, lSprite); + break; + case CON_GETPLAYERVAR: + lTemp=GetGameVarID(lVar2, g_i, lSprite); + SetGameVarID(lVar3, lTemp, g_i, g_p); break; } + break; + } case CON_SETACTOR: case CON_GETACTOR: + { + // syntax [gs]etactor[].x + // + long lLabelID; + long lVar1, lVar2; + long lParm2; + + insptr++; + lVar1=*insptr++; + lLabelID=*insptr++; + + switch (lLabelID) { - // syntax [gs]etactor[].x - // - long lLabelID; - long lVar1, lVar2; - long lParm2; - - insptr++; - lVar1=*insptr++; - lLabelID=*insptr++; - - switch(lLabelID) - { - case ACTOR_HTG_T: - lParm2=GetGameVarID(*insptr++, g_i, g_p); - break; - default: - lParm2=0; - break; - } - lVar2=*insptr++; - - DoActor(tw==CON_SETACTOR, lVar1, lLabelID, lVar2, g_i, g_p, lParm2); + case ACTOR_HTG_T: + lParm2=GetGameVarID(*insptr++, g_i, g_p); + break; + default: + lParm2=0; break; } + lVar2=*insptr++; + + DoActor(tw==CON_SETACTOR, lVar1, lLabelID, lVar2, g_i, g_p, lParm2); + break; + } case CON_GETANGLETOTARGET: - { - int i; - short ang; + { + int i; + short ang; - insptr++; - i=*insptr++; // ID of def + insptr++; + i=*insptr++; // ID of def - // hittype[g_i].lastvx and lastvy are last known location of target. - ang=getangle(hittype[g_i].lastvx-g_sp->x,hittype[g_i].lastvy-g_sp->y); - SetGameVarID(i, ang, g_i, g_p ); - break; - } + // hittype[g_i].lastvx and lastvy are last known location of target. + ang=getangle(hittype[g_i].lastvx-g_sp->x,hittype[g_i].lastvy-g_sp->y); + SetGameVarID(i, ang, g_i, g_p ); + break; + } case CON_ANGOFFVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - spriteext[g_i].angoff=GetGameVarID(i, g_i, g_p); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + spriteext[g_i].angoff=GetGameVarID(i, g_i, g_p); + break; + } case CON_LOCKPLAYER: - { - int i; - insptr++; - i=*insptr++; // ID of def - ps[g_p].transporter_hold=GetGameVarID(i, g_i, g_p); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + ps[g_p].transporter_hold=GetGameVarID(i, g_i, g_p); + break; + } case CON_CHECKAVAILWEAPON: case CON_CHECKAVAILINVEN: + { + int i; + + insptr++; + + if (*insptr == g_iThisActorID) { - int i; - + i = g_p; insptr++; - - if (*insptr == g_iThisActorID) - { - i = g_p; - insptr++; - } - else - i=GetGameVarID(*insptr++, g_i, g_p); - if (i < MAXPLAYERS) - { - if (tw == CON_CHECKAVAILWEAPON) - checkavailweapon(&ps[i]); - else checkavailinven(&ps[i]); - } - break; } + else + i=GetGameVarID(*insptr++, g_i, g_p); + if (i < MAXPLAYERS) + { + if (tw == CON_CHECKAVAILWEAPON) + checkavailweapon(&ps[i]); + else checkavailinven(&ps[i]); + } + break; + } case CON_GETPLAYERANGLE: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, ps[g_p].ang, g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, ps[g_p].ang, g_i, g_p ); + break; + } case CON_SETPLAYERANGLE: - { - int i; - insptr++; - i=*insptr++; // ID of def - ps[g_p].ang=GetGameVarID(i, g_i, g_p); - ps[g_p].ang &= 2047; - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + ps[g_p].ang=GetGameVarID(i, g_i, g_p); + ps[g_p].ang &= 2047; + break; + } case CON_GETACTORANGLE: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, g_sp->ang, g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, g_sp->ang, g_i, g_p ); + break; + } case CON_SETACTORANGLE: - { - int i; - insptr++; - i=*insptr++; // ID of def - g_sp->ang=GetGameVarID(i, g_i, g_p); - g_sp->ang &= 2047; - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + g_sp->ang=GetGameVarID(i, g_i, g_p); + g_sp->ang &= 2047; + break; + } case CON_SETVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, *insptr++, g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, *insptr++, g_i, g_p ); + break; + } case CON_SETVARVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, GetGameVarID(*insptr++, g_i, g_p), g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, GetGameVarID(*insptr++, g_i, g_p), g_i, g_p ); + break; + } case CON_RANDVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, mulscale(krand(), *(insptr++)+1, 16), g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, mulscale(krand(), *(insptr++)+1, 16), g_i, g_p ); + break; + } case CON_DISPLAYRANDVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, mulscale(rand(), *(insptr++)+1, 15), g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, mulscale(rand(), *(insptr++)+1, 15), g_i, g_p ); + break; + } case CON_MULVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, GetGameVarID(i, g_i, g_p) * *insptr++, g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, GetGameVarID(i, g_i, g_p) * *insptr++, g_i, g_p ); + break; + } case CON_DIVVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - if( (*insptr) == 0 ) - gameexit("CON_DIVVAR: Divide by zero."); - SetGameVarID(i, GetGameVarID(i, g_i, g_p) / *insptr++, g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + if ( (*insptr) == 0 ) + gameexit("CON_DIVVAR: Divide by zero."); + SetGameVarID(i, GetGameVarID(i, g_i, g_p) / *insptr++, g_i, g_p ); + break; + } case CON_MODVAR: - { - int i; - long l; - insptr++; - i=*insptr++; // ID of def - l=*insptr++; - if( l == 0 ) - gameexit("CON_MODVAR: Mod by zero."); - SetGameVarID(i,GetGameVarID(i, g_i, g_p)%l, g_i, g_p ); - break; - } + { + int i; + long l; + insptr++; + i=*insptr++; // ID of def + l=*insptr++; + if ( l == 0 ) + gameexit("CON_MODVAR: Mod by zero."); + SetGameVarID(i,GetGameVarID(i, g_i, g_p)%l, g_i, g_p ); + break; + } case CON_ANDVAR: - { - int i; - long l; - insptr++; - i=*insptr++; // ID of def - l=*insptr++; - SetGameVarID(i,GetGameVarID(i, g_i, g_p) & l, g_i, g_p ); - break; - } + { + int i; + long l; + insptr++; + i=*insptr++; // ID of def + l=*insptr++; + SetGameVarID(i,GetGameVarID(i, g_i, g_p) & l, g_i, g_p ); + break; + } case CON_ORVAR: - { - int i; - long l; - insptr++; - i=*insptr++; // ID of def - l=*insptr++; - SetGameVarID(i,GetGameVarID(i, g_i, g_p) | l, g_i, g_p ); - break; - } + { + int i; + long l; + insptr++; + i=*insptr++; // ID of def + l=*insptr++; + SetGameVarID(i,GetGameVarID(i, g_i, g_p) | l, g_i, g_p ); + break; + } case CON_XORVAR: - { - int i; - long l; - insptr++; - i=*insptr++; // ID of def - l=*insptr++; - SetGameVarID(i,GetGameVarID(i, g_i, g_p) ^ l, g_i, g_p ); - break; - } + { + int i; + long l; + insptr++; + i=*insptr++; // ID of def + l=*insptr++; + SetGameVarID(i,GetGameVarID(i, g_i, g_p) ^ l, g_i, g_p ); + break; + } case CON_RANDVARVAR: - { - int i; - long l1; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(*insptr++, g_i, g_p); - SetGameVarID(i,mulscale(krand(), l1+1, 16), g_i, g_p ); - break; - } + { + int i; + long l1; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(*insptr++, g_i, g_p); + SetGameVarID(i,mulscale(krand(), l1+1, 16), g_i, g_p ); + break; + } case CON_DISPLAYRANDVARVAR: - { - int i; - long l1; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(*insptr++, g_i, g_p); + { + int i; + long l1; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(*insptr++, g_i, g_p); - SetGameVarID(i,mulscale(rand(), l1+1, 15), g_i, g_p ); - break; - } + SetGameVarID(i,mulscale(rand(), l1+1, 15), g_i, g_p ); + break; + } case CON_GMAXAMMO: - { - int i; - long l1; // l2; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(i, g_i, g_p); - SetGameVarID(*insptr++, max_ammo_amount[l1], g_i, g_p ); - break; - } + { + int i; + long l1; // l2; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(i, g_i, g_p); + SetGameVarID(*insptr++, max_ammo_amount[l1], g_i, g_p ); + break; + } case CON_SMAXAMMO: - { - int i; - long l1,l2; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(i, g_i, g_p); - l2=GetGameVarID(*insptr++, g_i, g_p); - max_ammo_amount[l1]=l2; - break; - } + { + int i; + long l1,l2; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(i, g_i, g_p); + l2=GetGameVarID(*insptr++, g_i, g_p); + max_ammo_amount[l1]=l2; + break; + } case CON_MULVARVAR: - { - int i; - long l1,l2; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(i, g_i, g_p); - l2=GetGameVarID(*insptr++, g_i, g_p); - SetGameVarID(i, l1*l2, g_i, g_p ); - break; - } + { + int i; + long l1,l2; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(i, g_i, g_p); + l2=GetGameVarID(*insptr++, g_i, g_p); + SetGameVarID(i, l1*l2, g_i, g_p ); + break; + } case CON_DIVVARVAR: + { + int i; + long l1,l2; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(i, g_i, g_p); + l2=GetGameVarID(*insptr++, g_i, g_p); + if (l2==0) { - int i; - long l1,l2; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(i, g_i, g_p); - l2=GetGameVarID(*insptr++, g_i, g_p); - if(l2==0) - { - gameexit("CON_DIVVARVAR: Divide by zero."); - } - SetGameVarID(i, l1/l2 , g_i, g_p ); - break; + gameexit("CON_DIVVARVAR: Divide by zero."); } + SetGameVarID(i, l1/l2 , g_i, g_p ); + break; + } case CON_MODVARVAR: - { - int i; - long l1,l2; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(i, g_i, g_p); - l2=GetGameVarID(*insptr++, g_i, g_p); - if(l2==0) - gameexit("CON_MODVARVAR: Mod by zero."); - SetGameVarID(i, l1 % l2, g_i, g_p ); - break; - } + { + int i; + long l1,l2; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(i, g_i, g_p); + l2=GetGameVarID(*insptr++, g_i, g_p); + if (l2==0) + gameexit("CON_MODVARVAR: Mod by zero."); + SetGameVarID(i, l1 % l2, g_i, g_p ); + break; + } case CON_ANDVARVAR: - { - int i; - long l1,l2; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(i, g_i, g_p); - l2=GetGameVarID(*insptr++, g_i, g_p); - SetGameVarID(i, l1 & l2 , g_i, g_p ); - break; - } + { + int i; + long l1,l2; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(i, g_i, g_p); + l2=GetGameVarID(*insptr++, g_i, g_p); + SetGameVarID(i, l1 & l2 , g_i, g_p ); + break; + } case CON_XORVARVAR: - { - int i; - long l1,l2; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(i, g_i, g_p); - l2=GetGameVarID(*insptr++, g_i, g_p); - SetGameVarID(i, l1 ^ l2 , g_i, g_p ); - break; - } + { + int i; + long l1,l2; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(i, g_i, g_p); + l2=GetGameVarID(*insptr++, g_i, g_p); + SetGameVarID(i, l1 ^ l2 , g_i, g_p ); + break; + } case CON_ORVARVAR: - { - int i; - long l1,l2; - insptr++; - i=*insptr++; // ID of def - l1=GetGameVarID(i, g_i, g_p); - l2=GetGameVarID(*insptr++, g_i, g_p); - SetGameVarID(i, l1 | l2 , g_i, g_p ); - break; - } + { + int i; + long l1,l2; + insptr++; + i=*insptr++; // ID of def + l1=GetGameVarID(i, g_i, g_p); + l2=GetGameVarID(*insptr++, g_i, g_p); + SetGameVarID(i, l1 | l2 , g_i, g_p ); + break; + } case CON_SUBVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, GetGameVarID(i, g_i, g_p) - *insptr++, g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, GetGameVarID(i, g_i, g_p) - *insptr++, g_i, g_p ); + break; + } case CON_SUBVARVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, GetGameVarID(i, g_i, g_p) - GetGameVarID(*insptr++, g_i, g_p), g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, GetGameVarID(i, g_i, g_p) - GetGameVarID(*insptr++, g_i, g_p), g_i, g_p ); + break; + } case CON_ADDVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, GetGameVarID(i, g_i, g_p) + *insptr++, g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, GetGameVarID(i, g_i, g_p) + *insptr++, g_i, g_p ); + break; + } case CON_SHIFTVARL: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, GetGameVarID(i, g_i, g_p) << *insptr++, g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, GetGameVarID(i, g_i, g_p) << *insptr++, g_i, g_p ); + break; + } case CON_SHIFTVARR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, GetGameVarID(i, g_i, g_p) >> *insptr++, g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, GetGameVarID(i, g_i, g_p) >> *insptr++, g_i, g_p ); + break; + } case CON_SIN: - { - int i; - long lValue; - insptr++; - i=*insptr++; // ID of def - lValue=GetGameVarID(*insptr++, g_i, g_p); - lValue=sintable[lValue&2047]; - SetGameVarID(i, lValue , g_i, g_p ); - break; - } + { + int i; + long lValue; + insptr++; + i=*insptr++; // ID of def + lValue=GetGameVarID(*insptr++, g_i, g_p); + lValue=sintable[lValue&2047]; + SetGameVarID(i, lValue , g_i, g_p ); + break; + } case CON_COS: - { - int i; - long lValue; - insptr++; - i=*insptr++; // ID of def - lValue=GetGameVarID(*insptr++, g_i, g_p); - lValue=sintable[(lValue+512)&2047]; - SetGameVarID(i, lValue , g_i, g_p ); - break; - } + { + int i; + long lValue; + insptr++; + i=*insptr++; // ID of def + lValue=GetGameVarID(*insptr++, g_i, g_p); + lValue=sintable[(lValue+512)&2047]; + SetGameVarID(i, lValue , g_i, g_p ); + break; + } case CON_ADDVARVAR: - { - int i; - insptr++; - i=*insptr++; // ID of def - SetGameVarID(i, GetGameVarID(i, g_i, g_p) + GetGameVarID(*insptr++, g_i, g_p), g_i, g_p ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + SetGameVarID(i, GetGameVarID(i, g_i, g_p) + GetGameVarID(*insptr++, g_i, g_p), g_i, g_p ); + break; + } case CON_SPGETLOTAG: - { - insptr++; - SetGameVarID(g_iLoTagID, g_sp->lotag, g_i, g_p); - break; - } + { + insptr++; + SetGameVarID(g_iLoTagID, g_sp->lotag, g_i, g_p); + break; + } case CON_SPGETHITAG: - { - insptr++; - SetGameVarID(g_iHiTagID, g_sp->hitag, g_i, g_p); - break; - } + { + insptr++; + SetGameVarID(g_iHiTagID, g_sp->hitag, g_i, g_p); + break; + } case CON_SECTGETLOTAG: - { - insptr++; - SetGameVarID(g_iLoTagID, sector[g_sp->sectnum].lotag, g_i, g_p); - break; - } + { + insptr++; + SetGameVarID(g_iLoTagID, sector[g_sp->sectnum].lotag, g_i, g_p); + break; + } case CON_SECTGETHITAG: - { - insptr++; - SetGameVarID(g_iHiTagID, sector[g_sp->sectnum].hitag, g_i, g_p); - break; - } + { + insptr++; + SetGameVarID(g_iHiTagID, sector[g_sp->sectnum].hitag, g_i, g_p); + break; + } case CON_GETTEXTUREFLOOR: - { - insptr++; - SetGameVarID(g_iTextureID, sector[g_sp->sectnum].floorpicnum, g_i, g_p); - break; - } + { + insptr++; + SetGameVarID(g_iTextureID, sector[g_sp->sectnum].floorpicnum, g_i, g_p); + break; + } case CON_STARTTRACK: - { - insptr++; - music_select=*insptr++; - playmusic(&music_fn[ud.volume_number][music_select][0]); - break; - } + { + insptr++; + music_select=*insptr++; + playmusic(&music_fn[ud.volume_number][music_select][0]); + break; + } case CON_GETTEXTURECEILING: - { - insptr++; - SetGameVarID(g_iTextureID, sector[g_sp->sectnum].ceilingpicnum, g_i, g_p); - break; - } + { + insptr++; + SetGameVarID(g_iTextureID, sector[g_sp->sectnum].ceilingpicnum, g_i, g_p); + break; + } case CON_IFVARVARAND: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) & GetGameVarID(*(insptr), g_i, g_p) ) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) & GetGameVarID(*(insptr), g_i, g_p) ) + j=1; + parseifelse( j ); + break; + } case CON_IFVARVARN: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) != GetGameVarID(*(insptr), g_i, g_p) ) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) != GetGameVarID(*(insptr), g_i, g_p) ) + j=1; + parseifelse( j ); + break; + } case CON_IFVARVARE: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) == GetGameVarID(*(insptr), g_i, g_p) ) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) == GetGameVarID(*(insptr), g_i, g_p) ) + j=1; + parseifelse( j ); + break; + } case CON_IFVARVARG: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) > GetGameVarID(*(insptr), g_i, g_p) ) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) > GetGameVarID(*(insptr), g_i, g_p) ) + j=1; + parseifelse( j ); + break; + } case CON_IFVARVARL: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) < GetGameVarID(*(insptr), g_i, g_p) ) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) < GetGameVarID(*(insptr), g_i, g_p) ) + j=1; + parseifelse( j ); + break; + } case CON_IFVARE: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) == *insptr) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) == *insptr) + j=1; + parseifelse( j ); + break; + } case CON_IFVARN: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) != *insptr) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) != *insptr) + j=1; + parseifelse( j ); + break; + } case CON_WHILEVARN: + { + int i; + long *savedinsptr; + savedinsptr=insptr; + j=1; + while (j) { - int i; - long *savedinsptr; - savedinsptr=insptr; - j=1; - while (j) - { - insptr=savedinsptr; - insptr++; - i=*insptr++; // ID of def - j=0; + insptr=savedinsptr; + insptr++; + i=*insptr++; // ID of def + j=0; - if(GetGameVarID(i, g_i, g_p) != *insptr) - j=1; - parseifelse( j ); - } - break; + if (GetGameVarID(i, g_i, g_p) != *insptr) + j=1; + parseifelse( j ); } + break; + } case CON_WHILEVARVARN: + { + int i,k; + long *savedinsptr; + savedinsptr=insptr; + j=1; + while (j) { - int i,k; - long *savedinsptr; - savedinsptr=insptr; - j=1; - while (j) - { - insptr=savedinsptr; - insptr++; - i=*insptr++; // ID of def - k=*(insptr); // ID of def - j=0; + insptr=savedinsptr; + insptr++; + i=*insptr++; // ID of def + k=*(insptr); // ID of def + j=0; - if(GetGameVarID(i, g_i, g_p) != GetGameVarID(k, g_i, g_p)) - j=1; - parseifelse( j ); - } - break; + if (GetGameVarID(i, g_i, g_p) != GetGameVarID(k, g_i, g_p)) + j=1; + parseifelse( j ); } + break; + } case CON_IFVARAND: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) & *insptr) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) & *insptr) + j=1; + parseifelse( j ); + break; + } case CON_IFVARG: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) > *insptr) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) > *insptr) + j=1; + parseifelse( j ); + break; + } case CON_IFVARL: - { - int i; - insptr++; - i=*insptr++; // ID of def - j=0; - if(GetGameVarID(i, g_i, g_p) < *insptr) - j=1; - parseifelse( j ); - break; - } + { + int i; + insptr++; + i=*insptr++; // ID of def + j=0; + if (GetGameVarID(i, g_i, g_p) < *insptr) + j=1; + parseifelse( j ); + break; + } case CON_IFPHEALTHL: insptr++; @@ -6660,54 +6677,63 @@ good: break; case CON_IFPINVENTORY: + { + insptr++; + j = 0; + switch (*insptr++) { - insptr++; - j = 0; - switch(*insptr++) - { - case GET_STEROIDS:if( ps[g_p].steroids_amount != *insptr) + case GET_STEROIDS: + if ( ps[g_p].steroids_amount != *insptr) j = 1; - break; - case GET_SHIELD:if(ps[g_p].shield_amount != max_player_health ) - j = 1; - break; - case GET_SCUBA:if(ps[g_p].scuba_amount != *insptr) j = 1;break; - case GET_HOLODUKE:if(ps[g_p].holoduke_amount != *insptr) j = 1;break; - case GET_JETPACK:if(ps[g_p].jetpack_amount != *insptr) j = 1;break; - case GET_ACCESS: - switch(g_sp->pal) - { - case 0: if(ps[g_p].got_access&1) j = 1;break; - case 21: if(ps[g_p].got_access&2) j = 1;break; - case 23: if(ps[g_p].got_access&4) j = 1;break; - } - break; - case GET_HEATS:if(ps[g_p].heat_amount != *insptr) j = 1;break; - case GET_FIRSTAID: - if(ps[g_p].firstaid_amount != *insptr) j = 1;break; - case GET_BOOTS: - if(ps[g_p].boot_amount != *insptr) j = 1;break; - } - - parseifelse(j); break; + case GET_SHIELD: + if (ps[g_p].shield_amount != max_player_health ) + j = 1; + break; + case GET_SCUBA: + if (ps[g_p].scuba_amount != *insptr) j = 1;break; + case GET_HOLODUKE: + if (ps[g_p].holoduke_amount != *insptr) j = 1;break; + case GET_JETPACK: + if (ps[g_p].jetpack_amount != *insptr) j = 1;break; + case GET_ACCESS: + switch (g_sp->pal) + { + case 0: + if (ps[g_p].got_access&1) j = 1;break; + case 21: + if (ps[g_p].got_access&2) j = 1;break; + case 23: + if (ps[g_p].got_access&4) j = 1;break; + } + break; + case GET_HEATS: + if (ps[g_p].heat_amount != *insptr) j = 1;break; + case GET_FIRSTAID: + if (ps[g_p].firstaid_amount != *insptr) j = 1;break; + case GET_BOOTS: + if (ps[g_p].boot_amount != *insptr) j = 1;break; } + parseifelse(j); + break; + } + case CON_PSTOMP: insptr++; - if( ps[g_p].knee_incs == 0 && sprite[ps[g_p].i].xrepeat >= 40 ) - if( cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+(16<<8),sprite[ps[g_p].i].sectnum) ) + if ( ps[g_p].knee_incs == 0 && sprite[ps[g_p].i].xrepeat >= 40 ) + if ( cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+(16<<8),sprite[ps[g_p].i].sectnum) ) { int i; - for(i=0;isectnum; + + j = 0; + + updatesector(g_sp->x+108,g_sp->y+108,&s1); + if ( s1 == g_sp->sectnum ) { - short s1; - - s1 = g_sp->sectnum; - - j = 0; - - updatesector(g_sp->x+108,g_sp->y+108,&s1); - if( s1 == g_sp->sectnum ) + updatesector(g_sp->x-108,g_sp->y-108,&s1); + if ( s1 == g_sp->sectnum ) { - updatesector(g_sp->x-108,g_sp->y-108,&s1); - if( s1 == g_sp->sectnum ) + updatesector(g_sp->x+108,g_sp->y-108,&s1); + if ( s1 == g_sp->sectnum ) { - updatesector(g_sp->x+108,g_sp->y-108,&s1); - if( s1 == g_sp->sectnum ) - { - updatesector(g_sp->x-108,g_sp->y+108,&s1); - if( s1 == g_sp->sectnum ) - j = 1; - } + updatesector(g_sp->x-108,g_sp->y+108,&s1); + if ( s1 == g_sp->sectnum ) + j = 1; } } - parseifelse( j ); } - break; + parseifelse( j ); + } + break; case CON_QUOTE: insptr++; - if(fta_quotes[*insptr] != NULL) + if (fta_quotes[*insptr] != NULL) FTA(*insptr++,&ps[g_p]); else { OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,*insptr); @@ -6753,7 +6779,7 @@ good: case CON_USERQUOTE: insptr++; - if(fta_quotes[*insptr] != NULL) + if (fta_quotes[*insptr] != NULL) adduserquote(fta_quotes[*insptr++]); else { OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,*insptr); @@ -6771,7 +6797,7 @@ good: case CON_RESPAWNHITAG: insptr++; - switch(dynamictostatic[g_sp->picnum]) + switch (dynamictostatic[g_sp->picnum]) { case FEM1__STATIC: case FEM2__STATIC: @@ -6786,10 +6812,10 @@ good: case PODFEM1__STATIC: case NAKED1__STATIC: case STATUE__STATIC: - if(g_sp->yvel) operaterespawns(g_sp->yvel); + if (g_sp->yvel) operaterespawns(g_sp->yvel); break; default: - if(g_sp->hitag >= 0) operaterespawns(g_sp->hitag); + if (g_sp->hitag >= 0) operaterespawns(g_sp->hitag); break; } break; @@ -6806,39 +6832,39 @@ good: break; case CON_IFNOSOUNDS: - for(j=1;jpicnum); @@ -6858,13 +6884,13 @@ void LoadActor(short sActor,short sPlayer,long lDist) g_sp = &sprite[g_i]; // Pointer to sprite structure g_t = &hittype[g_i].temp_data[0]; // Sprite's 'extra' data - if( actorLoadEventScrptr[g_sp->picnum] == 0 ) return; + if ( actorLoadEventScrptr[g_sp->picnum] == 0 ) return; insptr = actorLoadEventScrptr[g_sp->picnum]; killit_flag = 0; - if(g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS) + if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS) { // if(badguy(g_sp)) // ps[g_p].actors_killed++; @@ -6873,14 +6899,14 @@ void LoadActor(short sActor,short sPlayer,long lDist) } do done = parse(); - while( done == 0 ); + while ( done == 0 ); - if(killit_flag == 1) + if (killit_flag == 1) { // if player was set to squish, first stop that... if (g_p >= 0 ) { - if(ps[g_p].actorsqu == g_i) + if (ps[g_p].actorsqu == g_i) ps[g_p].actorsqu = -1; } deletesprite(g_i); @@ -6897,43 +6923,43 @@ void execute(short sActor,short sPlayer,long lDist) g_sp = &sprite[g_i]; // Pointer to sprite structure g_t = &hittype[g_i].temp_data[0]; // Sprite's 'extra' data - if( actorscrptr[g_sp->picnum] == 0 ) return; + if ( actorscrptr[g_sp->picnum] == 0 ) return; insptr = 4 + (actorscrptr[g_sp->picnum]); killit_flag = 0; - if(g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS) + if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS) { - if(badguy(g_sp)) + if (badguy(g_sp)) ps[g_p].actors_killed++; deletesprite(g_i); return; } - if(g_t[4]) + if (g_t[4]) { g_sp->lotag += TICSPERFRAME; - if(g_sp->lotag > *(long *)(g_t[4]+16) ) + if (g_sp->lotag > *(long *)(g_t[4]+16) ) { g_t[2]++; g_sp->lotag = 0; g_t[3] += *(long *)( g_t[4]+12 ); } - if( klabs(g_t[3]) >= klabs( *(long *)(g_t[4]+4) * *(long *)(g_t[4]+12) ) ) + if ( klabs(g_t[3]) >= klabs( *(long *)(g_t[4]+4) * *(long *)(g_t[4]+12) ) ) g_t[3] = 0; } do done = parse(); - while( done == 0 ); + while ( done == 0 ); - if(killit_flag == 1) + if (killit_flag == 1) { // if player was set to squish, first stop that... - if(ps[g_p].actorsqu == g_i) + if (ps[g_p].actorsqu == g_i) ps[g_p].actorsqu = -1; deletesprite(g_i); } @@ -6941,23 +6967,23 @@ void execute(short sActor,short sPlayer,long lDist) { move(); - if( g_sp->statnum == 1) + if ( g_sp->statnum == 1) { - if( badguy(g_sp) ) + if ( badguy(g_sp) ) { - if( g_sp->xrepeat > 60 ) return; - if( ud.respawn_monsters == 1 && g_sp->extra <= 0 ) return; + if ( g_sp->xrepeat > 60 ) return; + if ( ud.respawn_monsters == 1 && g_sp->extra <= 0 ) return; } - else if( ud.respawn_items == 1 && (g_sp->cstat&32768) ) return; + else if ( ud.respawn_items == 1 && (g_sp->cstat&32768) ) return; - if(hittype[g_i].timetosleep > 1) + if (hittype[g_i].timetosleep > 1) hittype[g_i].timetosleep--; - else if(hittype[g_i].timetosleep == 1) + else if (hittype[g_i].timetosleep == 1) changespritestat(g_i,2); } - else if(g_sp->statnum == 6) - switch(dynamictostatic[g_sp->picnum]) + else if (g_sp->statnum == 6) + switch (dynamictostatic[g_sp->picnum]) { case RUBBERCAN__STATIC: case EXPLODINGBARREL__STATIC: @@ -6970,9 +6996,9 @@ void execute(short sActor,short sPlayer,long lDist) case NUKEBARRELLEAKED__STATIC: case TRIPBOMB__STATIC: case EGG__STATIC: - if(hittype[g_i].timetosleep > 1) + if (hittype[g_i].timetosleep > 1) hittype[g_i].timetosleep--; - else if(hittype[g_i].timetosleep == 1) + else if (hittype[g_i].timetosleep == 1) changespritestat(g_i,2); break; } diff --git a/polymer/eduke32/source/grpscan.c b/polymer/eduke32/source/grpscan.c index 9737573ee..d9ead7d2e 100755 --- a/polymer/eduke32/source/grpscan.c +++ b/polymer/eduke32/source/grpscan.c @@ -9,7 +9,8 @@ #include "grpscan.h" struct grpfile grpfiles[numgrpfiles] = { - { "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAMEDUKE, NULL }, + { "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAMEDUKE, NULL } + , { "Duke Nukem 3D: Atomic Edition", 0xF514A6AC, 44348015, GAMEDUKE, NULL }, { "Duke Nukem 3D: Atomic Edition", 0xFD3DCFF1, 44356548, GAMEDUKE, NULL }, { "Duke Nukem 3D Shareware Version", 0x983AD923, 11035779, GAMEDUKE, NULL }, diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 3cf7b06b2..0d6288e11 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -51,20 +51,20 @@ void cmenu(short cm) { current_menu = cm; - if( (cm >= 1000 && cm <= 1009) ) + if ( (cm >= 1000 && cm <= 1009) ) return; - if( cm == 0 ) + if ( cm == 0 ) probey = last_zero; - else if(cm == 50) + else if (cm == 50) probey = last_fifty; - else if(cm == 100) + else if (cm == 100) probey = last_onehundred; - else if(cm == 202) + else if (cm == 202) probey = last_twoohtwo; - else if(cm >= 300 && cm < 400) + else if (cm >= 300 && cm < 400) probey = last_threehundred; - else if(cm == 110) + else if (cm == 110) probey = 1; else probey = 0; lastprobey = -1; @@ -86,9 +86,9 @@ void getangplayers(short snum) { short i,a; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { - if(i != snum) + if (i != snum) { a = ps[snum].ang+getangle(ps[i].posx-ps[snum].posx,ps[i].posy-ps[snum].posy); a = a-1024; @@ -118,13 +118,13 @@ static int probe_(int type,int x,int y,int i,int n) mi += minfo.dz; } - if( x == (320>>1) ) + if ( x == (320>>1) ) centre = 320>>2; else centre = 0; - if(!buttonstat) + if (!buttonstat) { - if( KB_KeyPressed( sc_UpArrow ) || KB_KeyPressed( sc_PgUp ) || KB_KeyPressed( sc_kpad_8 ) || + if ( KB_KeyPressed( sc_UpArrow ) || KB_KeyPressed( sc_PgUp ) || KB_KeyPressed( sc_kpad_8 ) || mi < -8192 ) { mi = 0; @@ -134,10 +134,10 @@ static int probe_(int type,int x,int y,int i,int n) sound(KICK_HIT); probey--; - if(probey < 0) probey = n-1; + if (probey < 0) probey = n-1; minfo.dz = 0; } - if( KB_KeyPressed( sc_DownArrow ) || KB_KeyPressed( sc_PgDn ) || KB_KeyPressed( sc_kpad_2 ) + if ( KB_KeyPressed( sc_DownArrow ) || KB_KeyPressed( sc_PgDn ) || KB_KeyPressed( sc_kpad_2 ) || mi > 8192 ) { mi = 0; @@ -150,10 +150,10 @@ static int probe_(int type,int x,int y,int i,int n) } } - if(probey >= n) + if (probey >= n) probey = 0; - if(centre) + if (centre) { // rotatesprite(((320>>1)+(centre)+54)<<16,(y+(probey*i)-4)<<16,65536L,0,SPINNINGNUKEICON+6-((6+(totalclock>>3))%7),sh,0,10,0,0,xdim-1,ydim-1); // rotatesprite(((320>>1)-(centre)-54)<<16,(y+(probey*i)-4)<<16,65536L,0,SPINNINGNUKEICON+((totalclock>>3)%7),sh,0,10,0,0,xdim-1,ydim-1); @@ -164,16 +164,16 @@ static int probe_(int type,int x,int y,int i,int n) else rotatesprite((x<<16)-((tilesizx[BIGFNTCURSOR]-4)<<(16-type)),(y+(probey*i)-(4>>type))<<16,65536L>>type,0,SPINNINGNUKEICON+(((totalclock>>3))%7),sh,0,10,0,0,xdim-1,ydim-1); - if( KB_KeyPressed(sc_Space) || KB_KeyPressed( sc_kpad_Enter ) || KB_KeyPressed( sc_Enter ) || (LMB && !onbar) ) + if ( KB_KeyPressed(sc_Space) || KB_KeyPressed( sc_kpad_Enter ) || KB_KeyPressed( sc_Enter ) || (LMB && !onbar) ) { - if(current_menu != 110) + if (current_menu != 110) sound(PISTOL_BODYHIT); KB_ClearKeyDown( sc_Enter ); KB_ClearKeyDown( sc_Space ); KB_ClearKeyDown( sc_kpad_Enter ); return(probey); } - else if( KB_KeyPressed( sc_Escape ) || (RMB) ) + else if ( KB_KeyPressed( sc_Escape ) || (RMB) ) { onbar = 0; KB_ClearKeyDown( sc_Escape ); @@ -182,7 +182,7 @@ static int probe_(int type,int x,int y,int i,int n) } else { - if(onbar == 0) return(-probey-2); + if (onbar == 0) return(-probey-2); if ( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -128 ) ) return(probey); else if ( KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 128 ) ) @@ -201,24 +201,24 @@ int menutext_(int x,int y,short s,short p,char *t) i = centre = 0; - if( x == (320>>1) ) + if ( x == (320>>1) ) { - while( *(t+i) ) + while ( *(t+i) ) { - if(*(t+i) == ' ') + if (*(t+i) == ' ') { centre += 5; i++; continue; } ac = 0; - if(*(t+i) >= '0' && *(t+i) <= '9') + if (*(t+i) >= '0' && *(t+i) <= '9') ac = *(t+i) - '0' + BIGALPHANUM-10; - else if(*(t+i) >= 'a' && *(t+i) <= 'z') + else if (*(t+i) >= 'a' && *(t+i) <= 'z') ac = toupper(*(t+i)) - 'A' + BIGALPHANUM; - else if(*(t+i) >= 'A' && *(t+i) <= 'Z') + else if (*(t+i) >= 'A' && *(t+i) <= 'Z') ac = *(t+i) - 'A' + BIGALPHANUM; - else switch(*(t+i)) + else switch (*(t+i)) { case '-': ac = BIGALPHANUM-11; @@ -255,20 +255,20 @@ int menutext_(int x,int y,short s,short p,char *t) } } - if(centre) + if (centre) x = (320-centre-10)>>1; - while(*t) + while (*t) { - if(*t == ' ') {x+=5;t++;continue;} + if (*t == ' ') {x+=5;t++;continue;} ac = 0; - if(*t >= '0' && *t <= '9') + if (*t >= '0' && *t <= '9') ac = *t - '0' + BIGALPHANUM-10; - else if(*t >= 'a' && *t <= 'z') + else if (*t >= 'a' && *t <= 'z') ac = toupper(*t) - 'A' + BIGALPHANUM; - else if(*t >= 'A' && *t <= 'Z') + else if (*t >= 'A' && *t <= 'Z') ac = *t - 'A' + BIGALPHANUM; - else switch(*t) + else switch (*t) { case '-': ac = BIGALPHANUM-11; @@ -318,54 +318,54 @@ static void bar_(int type, int x,int y,short *p,short dainc,char damodify,short short xloc; char rev; - if(dainc < 0) { dainc = -dainc; rev = 1; } + if (dainc < 0) { dainc = -dainc; rev = 1; } else rev = 0; y-=2; - if(damodify) + if (damodify) { - if(rev == 0) + if (rev == 0) { - if( *p > 0 && (KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ) ) ) // && onbar) ) + if ( *p > 0 && (KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ) ) ) // && onbar) ) { KB_ClearKeyDown( sc_LeftArrow ); KB_ClearKeyDown( sc_kpad_4 ); *p -= dainc; - if(*p < 0) + if (*p < 0) *p = 0; sound(KICK_HIT); } - if( *p < 63 && (KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 256 ) ) )//&& onbar) ) + if ( *p < 63 && (KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 256 ) ) )//&& onbar) ) { KB_ClearKeyDown( sc_RightArrow ); KB_ClearKeyDown( sc_kpad_6 ); *p += dainc; - if(*p > 63) + if (*p > 63) *p = 63; sound(KICK_HIT); } } else { - if( *p > 0 && (KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 256 ) ) )//&& onbar) ) + if ( *p > 0 && (KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 256 ) ) )//&& onbar) ) { KB_ClearKeyDown( sc_RightArrow ); KB_ClearKeyDown( sc_kpad_6 ); *p -= dainc; - if(*p < 0) + if (*p < 0) *p = 0; sound(KICK_HIT); } - if( *p < 64 && (KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ) ) ) // && onbar) ) + if ( *p < 64 && (KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ) ) ) // && onbar) ) { KB_ClearKeyDown( sc_LeftArrow ); KB_ClearKeyDown( sc_kpad_4 ); *p += dainc; - if(*p > 64) + if (*p > 64) *p = 64; sound(KICK_HIT); } @@ -375,7 +375,7 @@ static void bar_(int type, int x,int y,short *p,short dainc,char damodify,short xloc = *p; rotatesprite( (x<<16)+(22<<(16-type)),(y<<16)-(3<<(16-type)),65536L>>type,0,SLIDEBAR,s,pa,10,0,0,xdim-1,ydim-1); - if(rev == 0) + if (rev == 0) rotatesprite( (x<<16)+((xloc+1)<<(16-type)),(y<<16)+(1<<(16-type)),65536L>>type,0,SLIDEBAR+1,s,pa,10,0,0,xdim-1,ydim-1); else rotatesprite( (x<<16)+((65-xloc)<<(16-type)),(y<<16)+(1<<(16-type)),65536L>>type,0,SLIDEBAR+1,s,pa,10,0,0,xdim-1,ydim-1); @@ -388,53 +388,53 @@ static void modval(int min, int max,int *p,short dainc,char damodify) { char rev; - if(dainc < 0) { dainc = -dainc; rev = 1; } + if (dainc < 0) { dainc = -dainc; rev = 1; } else rev = 0; - if(damodify) + if (damodify) { - if(rev == 0) + if (rev == 0) { - if( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ) ) // && onbar) ) + if ( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ) ) // && onbar) ) { KB_ClearKeyDown( sc_LeftArrow ); KB_ClearKeyDown( sc_kpad_4 ); *p -= dainc; - if(*p < min) + if (*p < min) *p = max; sound(PISTOL_BODYHIT); } - if( KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 256 ) )//&& onbar) ) + if ( KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 256 ) )//&& onbar) ) { KB_ClearKeyDown( sc_RightArrow ); KB_ClearKeyDown( sc_kpad_6 ); *p += dainc; - if(*p > max) + if (*p > max) *p = min; sound(PISTOL_BODYHIT); } } else { - if( KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 256 ))//&& onbar )) + if ( KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 256 ))//&& onbar )) { KB_ClearKeyDown( sc_RightArrow ); KB_ClearKeyDown( sc_kpad_6 ); *p -= dainc; - if(*p < min) + if (*p < min) *p = max; sound(PISTOL_BODYHIT); } - if( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ))// && onbar) ) + if ( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ))// && onbar) ) { KB_ClearKeyDown( sc_LeftArrow ); KB_ClearKeyDown( sc_kpad_4 ); *p += dainc; - if(*p > max) + if (*p > max) *p = min; sound(PISTOL_BODYHIT); } @@ -464,7 +464,7 @@ void dispnames(void) short 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); @@ -508,9 +508,9 @@ void check_player_color(int *color,int prev_color) { int 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++) { - while(*color == disallowed[i]) { - if(*color > prev_color) + for (i=0;i<(signed)(sizeof(disallowed)/sizeof(disallowed[0]));i++) { + while (*color == disallowed[i]) { + if (*color > prev_color) (*color)++; else (*color)--; i=0; @@ -522,9 +522,9 @@ void sendquit(void) { int i; - if( gamequit == 0 && ( numplayers > 1 ) ) + if ( gamequit == 0 && ( numplayers > 1 ) ) { - if(ps[myconnectindex].gm&MODE_GAME) + if (ps[myconnectindex].gm&MODE_GAME) { gamequit = 1; quittimer = totalclock+120; @@ -534,7 +534,7 @@ void sendquit(void) tempbuf[0] = 254; tempbuf[1] = myconnectindex; - for(i=connecthead;i >= 0;i=connectpoint2[i]) + for (i=connecthead;i >= 0;i=connectpoint2[i]) { if (i != myconnectindex) sendpacket(i,tempbuf,2); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -542,10 +542,10 @@ void sendquit(void) gameexit(" "); } } - else if( numplayers < 2 ) + else if ( numplayers < 2 ) gameexit(" "); - if( ( totalclock > quittimer ) && ( gamequit == 1) ) + if ( ( totalclock > quittimer ) && ( gamequit == 1) ) gameexit("Timed out."); } @@ -559,17 +559,17 @@ void menus(void) getpackets(); { - if(buttonstat != 0 && !onbar) + if (buttonstat != 0 && !onbar) { x = MOUSE_GetButtons()<<3; - if( x ) buttonstat = x<<3; + if ( x ) buttonstat = x<<3; else buttonstat = 0; } else buttonstat = MOUSE_GetButtons(); } - if( (ps[myconnectindex].gm&MODE_MENU) == 0 ) + if ( (ps[myconnectindex].gm&MODE_MENU) == 0 ) { walock[TILE_LOADSHOT] = 1; return; @@ -581,17 +581,17 @@ void menus(void) x = 0; sh = 4-(sintable[(totalclock<<4)&2047]>>11); - if(bpp > 8) + if (bpp > 8) { long x,y,y1=0,y2=ydim; - for(y=y1;y= 1000 && current_menu <= 2999 && current_menu >= 300 && current_menu <= 369)) + if (!(current_menu >= 1000 && current_menu <= 2999 && current_menu >= 300 && current_menu <= 369)) vscrn(); - if(KB_KeyPressed(sc_Q) && current_menu >= 0 && (current_menu > 502 || current_menu < 500) && current_menu != 20003 && + if (KB_KeyPressed(sc_Q) && current_menu >= 0 && (current_menu > 502 || current_menu < 500) && current_menu != 20003 && current_menu != 20005 && current_menu != 210 && current_menu != 603 && current_menu != 10001 && !(current_menu > 359 && current_menu < 370)) { last_menu = current_menu; @@ -599,16 +599,16 @@ void menus(void) cmenu(502); } - switch(current_menu) + switch (current_menu) { case 25000: gametext(160,90,"SELECT A SAVE SPOT BEFORE",0,2+8+16); gametext(160,90+9,"YOU QUICK RESTORE.",0,2+8+16); x = probe(186,124,0,0); - if(x >= -1) + if (x >= -1) { - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -634,7 +634,7 @@ void menus(void) gametext(160,140+8,"VERSION OF DUKE NUKEM 3D.",0,2+8+16); gametext(160,149+16,"PRESS ANY KEY...",0,2+8+16); - if( x >= -1 ) cmenu(100); + if ( x >= -1 ) cmenu(100); break; case 20001: @@ -657,18 +657,20 @@ void menus(void) case 20003: rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); menutext(160,24,0,0,"PLAYER SETUP"); - if(probey == 2) + if (probey == 2) { - switch(ud.team) { - case 0: x = 3; break; - case 1: x = 21; break; + switch (ud.team) { + case 0: + x = 3; break; + case 1: + x = 21; break; } } else x = ud.color; rotatesprite((280)<<16,(37+(tilesizy[APLAYER]>>1))<<16,49152L,0,1441-((((4-(totalclock>>4)))&3)*5),0,x,10,0,0,xdim-1,ydim-1); if (current_menu == 20002) { x = probe(40,50,16,7); - switch(x) { + switch (x) { case -1: cmenu(202); probey = 3; @@ -686,7 +688,7 @@ void menus(void) case 1: ud.color++; - if(ud.color > 23) + if (ud.color > 23) ud.color = 0; check_player_color((int *)&ud.color,-1); updatenames(); @@ -717,7 +719,7 @@ void menus(void) } else { x = strget(200,50-9,buf,30,0); - while(Bstrlen(strip_color_codes(buf)) > 10) + while (Bstrlen(strip_color_codes(buf)) > 10) { buf[Bstrlen(buf)-1] = '\0'; inputloc--; @@ -725,7 +727,7 @@ void menus(void) if (x) { if (x == 1) { - if(buf[0]) { + if (buf[0]) { Bstrcpy(myname,buf); } // send name update @@ -756,7 +758,7 @@ void menus(void) modval(0,3,(int *)&ud.weaponswitch,1,probey==4); modval(0,1,(int *)&ud.mouseaiming,1,probey==5); check_player_color((int *)&ud.color,ud_color); - if(ud_color != ud.color || aaim != AutoAim || ud_weaponswitch != ud.weaponswitch || ud_maim != ud.mouseaiming || ud_team != ud.team) + if (ud_color != ud.color || aaim != AutoAim || ud_weaponswitch != ud.weaponswitch || ud_maim != ud.mouseaiming || ud_team != ud.team) updatenames(); } menutext(40,50+16+16,MENUHIGHLIGHT(2),0,"TEAM"); @@ -766,16 +768,21 @@ void menus(void) menutext(40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),0,"MACRO SETUP"); if (current_menu == 20002) { - gametext(200,50-9,myname,MENUHIGHLIGHT(0),2+8+16); } + gametext(200,50-9,myname,MENUHIGHLIGHT(0),2+8+16); + } { char *s[] = { "Auto","","","","","","","","","Blue","Dk red","Green","Gray","Dk gray","Dk green","Brown", "Dk blue","","","","","Red","","Yellow","","" }; - gametext(200,50+16-9,s[ud.color],MENUHIGHLIGHT(1),2+8+16); } + gametext(200,50+16-9,s[ud.color],MENUHIGHLIGHT(1),2+8+16); + } { char *s[] = { "Blue", "Red" }; - gametext(200,50+16+16-9,s[ud.team],MENUHIGHLIGHT(2),2+8+16); } + gametext(200,50+16+16-9,s[ud.team],MENUHIGHLIGHT(2),2+8+16); + } { char *s[] = { "Off", "Full", "Hitscan" }; - gametext(200,50+16+16+16-9,s[AutoAim],MENUHIGHLIGHT(3),2+8+16); } + gametext(200,50+16+16+16-9,s[AutoAim],MENUHIGHLIGHT(3),2+8+16); + } { char *s[] = { "Off", "On pickup", "When empty", "Both" }; - gametext(200,50+16+16+16+16-9,s[ud.weaponswitch],MENUHIGHLIGHT(4),2+8+16); } + gametext(200,50+16+16+16+16-9,s[ud.weaponswitch],MENUHIGHLIGHT(4),2+8+16); + } gametext(200,50+16+16+16+16+16-9,ud.mouseaiming?"Held":"Toggle",MENUHIGHLIGHT(5),2+8+16); break; @@ -788,12 +795,12 @@ void menus(void) if (current_menu == 20004) { x = probesm(24,45,8,10); - if(x == -1) + if (x == -1) { cmenu(20002); probey = 6; } - else if(x >= 0 && x <= 9) + else if (x >= 0 && x <= 9) { strcpy(buf, ud.ridecule[x]); inputloc = strlen(buf); @@ -815,9 +822,9 @@ void menus(void) current_menu = 20004; } } - for(i=0;i<10;i++) + for (i=0;i<10;i++) { - if(current_menu == 20005 && i == last_probey) continue; + if (current_menu == 20005 && i == last_probey) continue; gametextpal(26,40+(i<<3),ud.ridecule[i],MENUHIGHLIGHT(i),0); } @@ -875,43 +882,43 @@ void menus(void) x = probe(c,57-8,16,8); - switch(x) + switch (x) { case -1: cmenu(20010); break; case 0: ud.m_coop++; - if(ud.m_coop == 3) ud.m_coop = 0; + if (ud.m_coop == 3) ud.m_coop = 0; break; case 1: if (!VOLUMEONE) { ud.m_volume_number++; - if(ud.m_volume_number == num_volumes) ud.m_volume_number = 0; - if(ud.m_volume_number == 0 && ud.m_level_number > 6) + if (ud.m_volume_number == num_volumes) ud.m_volume_number = 0; + if (ud.m_volume_number == 0 && ud.m_level_number > 6) ud.m_level_number = 0; - if(ud.m_level_number > 10) ud.m_level_number = 0; + if (ud.m_level_number > 10) ud.m_level_number = 0; } break; case 2: ud.m_level_number++; if (!VOLUMEONE) { - if(ud.m_volume_number == 0 && ud.m_level_number > 6) + if (ud.m_volume_number == 0 && ud.m_level_number > 6) ud.m_level_number = 0; } else { - if(ud.m_volume_number == 0 && ud.m_level_number > 5) + if (ud.m_volume_number == 0 && ud.m_level_number > 5) ud.m_level_number = 0; } - if(ud.m_level_number > 10) ud.m_level_number = 0; + if (ud.m_level_number > 10) ud.m_level_number = 0; break; case 3: - if(ud.m_monsters_off == 1 && ud.m_player_skill > 0) + if (ud.m_monsters_off == 1 && ud.m_player_skill > 0) ud.m_monsters_off = 0; - if(ud.m_monsters_off == 0) + if (ud.m_monsters_off == 0) { ud.m_player_skill++; - if(ud.m_player_skill > 3) + if (ud.m_player_skill > 3) { ud.m_player_skill = 0; ud.m_monsters_off = 1; @@ -922,12 +929,12 @@ void menus(void) break; case 4: - if(ud.m_coop == 0) + if (ud.m_coop == 0) ud.m_marker = !ud.m_marker; break; case 5: - if(ud.m_coop == 1) + if (ud.m_coop == 1) ud.m_ffire = !ud.m_ffire; break; @@ -951,20 +958,20 @@ void menus(void) gametext(c+70,57+16+16-7-9,&level_names[11*ud.m_volume_number+ud.m_level_number][0],0,2+8+16); - if(ud.m_monsters_off == 0 || ud.m_player_skill > 0) + if (ud.m_monsters_off == 0 || ud.m_player_skill > 0) gametext(c+70,57+16+16+16-7-9,skill_names[ud.m_player_skill],0,2+8+16); else gametext(c+70,57+16+16+16-7-9,"NONE",0,2+8+16); - if(ud.m_coop == 0) + if (ud.m_coop == 0) { - if(ud.m_marker) + if (ud.m_marker) gametext(c+70,57+16+16+16+16-7-9,"ON",0,2+8+16); else gametext(c+70,57+16+16+16+16-7-9,"OFF",0,2+8+16); } - if(ud.m_coop == 1) + if (ud.m_coop == 1) { - if(ud.m_ffire) + if (ud.m_ffire) gametext(c+70,57+16+16+16+16+16-7-9,"ON",0,2+8+16); else gametext(c+70,57+16+16+16+16+16-7-9,"OFF",0,2+8+16); } @@ -981,18 +988,18 @@ void menus(void) menutext(c,57+16+16+16-9,MENUHIGHLIGHT(3),PHX(-5),"MONSTERS"); - if(ud.m_coop == 0) + if (ud.m_coop == 0) menutext(c,57+16+16+16+16-9,MENUHIGHLIGHT(4),PHX(-6),"MARKERS"); else menutext(c,57+16+16+16+16-9,MENUHIGHLIGHT(4),1,"MARKERS"); - if(ud.m_coop == 1) + if (ud.m_coop == 1) menutext(c,57+16+16+16+16+16-9,MENUHIGHLIGHT(5),PHX(-6),"FR. FIRE"); else menutext(c,57+16+16+16+16+16-9,MENUHIGHLIGHT(5),1,"FR. FIRE"); if (VOLUMEALL) { menutext(c,57+16+16+16+16+16+16-9,MENUHIGHLIGHT(6),boardfilename[0] == 0,"USER MAP"); - if( boardfilename[0] != 0 ) + if ( boardfilename[0] != 0 ) gametext(c+70+44,57+16+16+16+16+16,boardfilename,0,2+8+16); } else { menutext(c,57+16+16+16+16+16+16-9,MENUHIGHLIGHT(6),1,"USER MAP"); @@ -1081,9 +1088,9 @@ void menus(void) gametext(160,99+9,"(Y/N)",0,2+8+16); - if( KB_KeyPressed(sc_Escape) || KB_KeyPressed(sc_N) || RMB) + if ( KB_KeyPressed(sc_Escape) || KB_KeyPressed(sc_N) || RMB) { - if(sprite[ps[myconnectindex].i].extra <= 0) + if (sprite[ps[myconnectindex].i].extra <= 0) { if (enterlevel(MODE_GAME)) backtomenu(); return; @@ -1093,20 +1100,20 @@ void menus(void) KB_ClearKeyDown(sc_Escape); ps[myconnectindex].gm &= ~MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; } } - if( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) + if ( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) { KB_FlushKeyboardQueue(); KB_ClearKeysDown(); FX_StopAllSounds(); - if(ud.multimode > 1) + if (ud.multimode > 1) { loadplayer(-1-lastsavedpos); ps[myconnectindex].gm = MODE_GAME; @@ -1114,7 +1121,7 @@ void menus(void) else { c = loadplayer(lastsavedpos); - if(c == 0) + if (c == 0) ps[myconnectindex].gm = MODE_GAME; } } @@ -1131,32 +1138,32 @@ void menus(void) menutext(160,24,0,0,"ADULT MODE"); x = probe(60,50+16,16,2); - if(x == -1) { cmenu(201); probey = 0; break; } + if (x == -1) { cmenu(201); probey = 0; break; } menutext(c,50+16,MENUHIGHLIGHT(0),PHX(-2),"ADULT MODE"); menutext(c,50+16+16,MENUHIGHLIGHT(1),PHX(-3),"ENTER PASSWORD"); menutext(c+160+40,50+16,MENUHIGHLIGHT(0),0,ud.lockout?"OFF":"ON"); - if(current_menu == 10001) + if (current_menu == 10001) { gametext(160,50+16+16+16+16-12,"ENTER PASSWORD",0,2+8+16); x = strget((320>>1),50+16+16+16+16,buf,19, 998); - if( x ) + if ( x ) { - if(ud.pwlockout[0] == 0 || ud.lockout == 0 ) + if (ud.pwlockout[0] == 0 || ud.lockout == 0 ) strcpy(&ud.pwlockout[0],buf); - else if( strcmp(buf,&ud.pwlockout[0]) == 0 ) + else if ( strcmp(buf,&ud.pwlockout[0]) == 0 ) { ud.lockout = 0; buf[0] = 0; - for(x=0;x= 0 ) + if ( wall[animwall[x].wallnum].extra >= 0 ) wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; } @@ -1168,18 +1175,18 @@ void menus(void) } else { - if(x == 0) + if (x == 0) { - if( ud.lockout == 1 ) + if ( ud.lockout == 1 ) { - if(ud.pwlockout[0] == 0) + if (ud.pwlockout[0] == 0) { ud.lockout = 0; - for(x=0;x= 0 ) + if ( wall[animwall[x].wallnum].extra >= 0 ) wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; } else @@ -1194,8 +1201,8 @@ void menus(void) { ud.lockout = 1; - for(x=0;x 1) + if (ud.multimode > 1) { - if( ps[myconnectindex].gm&MODE_GAME ) + if ( ps[myconnectindex].gm&MODE_GAME ) { loadplayer(-1-lastsavedpos); ps[myconnectindex].gm = MODE_GAME; @@ -1274,7 +1281,7 @@ void menus(void) tempbuf[0] = 126; tempbuf[1] = lastsavedpos; tempbuf[2] = myconnectindex; - for(x=connecthead;x>=0;x=connectpoint2[x]) + for (x=connecthead;x>=0;x=connectpoint2[x]) { if (x != myconnectindex) sendpacket(x,tempbuf,3); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -1289,22 +1296,22 @@ void menus(void) else { c = loadplayer(lastsavedpos); - if(c == 0) + if (c == 0) ps[myconnectindex].gm = MODE_GAME; } break; } - if( KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Escape) || RMB) + if ( KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Escape) || RMB) { KB_ClearKeyDown(sc_N); KB_ClearKeyDown(sc_Escape); sound(EXITMENUSOUND); - if(ps[myconnectindex].gm&MODE_DEMO) cmenu(300); + if (ps[myconnectindex].gm&MODE_DEMO) cmenu(300); else { ps[myconnectindex].gm &= ~MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -1318,16 +1325,16 @@ void menus(void) case 1500: - if( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) + if ( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) { KB_FlushKeyboardQueue(); cmenu(100); } - if( KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Escape) || RMB) + if ( KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Escape) || RMB) { KB_ClearKeyDown(sc_N); KB_ClearKeyDown(sc_Escape); - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -1372,7 +1379,7 @@ void menus(void) gametext(160,90,"OVERWRITE previous SAVED game?",0,2+8+16); gametext(160,90+9,"(Y/N)",0,2+8+16); - if( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) + if ( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) { inputloc = strlen(&ud.savegame[current_menu-2000][0]); @@ -1381,7 +1388,7 @@ void menus(void) KB_FlushKeyboardQueue(); break; } - if( KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Escape) || RMB) + if ( KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Escape) || RMB) { KB_ClearKeyDown(sc_N); KB_ClearKeyDown(sc_Escape); @@ -1413,9 +1420,9 @@ void menus(void) l = 3; } - if(KB_KeyPressed(sc_Escape)) { cmenu(0); break; } + if (KB_KeyPressed(sc_Escape)) { cmenu(0); break; } - if( KB_KeyPressed( sc_LeftArrow ) || + if ( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || KB_KeyPressed( sc_UpArrow ) || KB_KeyPressed( sc_PgUp ) || @@ -1429,9 +1436,9 @@ void menus(void) sound(KICK_HIT); current_menu--; - if(current_menu < 990) current_menu = 990+l; + if (current_menu < 990) current_menu = 990+l; } - else if( + else if ( KB_KeyPressed( sc_PgDn ) || KB_KeyPressed( sc_Enter ) || KB_KeyPressed( sc_Space ) || @@ -1453,7 +1460,7 @@ void menus(void) KB_ClearKeyDown(sc_Space); sound(KICK_HIT); current_menu++; - if(current_menu > 990+l) current_menu = 990; + if (current_menu > 990+l) current_menu = 990; } if (!VOLUMEALL || !PLUTOPAK) { @@ -1570,7 +1577,7 @@ void menus(void) } // Plutonium pak menus - switch(current_menu) + switch (current_menu) { case 990: case 991: @@ -1654,11 +1661,11 @@ cheat_for_port_credits: if (PLUTOPAK) // JBF 20030804 rotatesprite((c+100)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,(sintable[(totalclock<<4)&2047]>>11),0,2+8,0,0,xdim-1,ydim-1); x = probe(c,67,16,6); - if(x >= 0) + if (x >= 0) { - if( ud.multimode > 1 && x == 0 && ud.recstat != 2) + if ( ud.multimode > 1 && x == 0 && ud.recstat != 2) { - if( movesperpacket == 4 && myconnectindex != connecthead ) + if ( movesperpacket == 4 && myconnectindex != connecthead ) break; last_zero = 0; @@ -1667,40 +1674,44 @@ cheat_for_port_credits: else { last_zero = x; - switch(x) + switch (x) { case 0: cmenu(100); break; //case 1: break;//cmenu(20001);break; // JBF 20031128: I'm taking over the TEN menu option - case 1: cmenu(202);break; // JBF 20031205: was 200 + case 1: + cmenu(202);break; // JBF 20031205: was 200 case 2: - if(movesperpacket == 4 && connecthead != myconnectindex) + if (movesperpacket == 4 && connecthead != myconnectindex) break; cmenu(300); break; - case 3: KB_FlushKeyboardQueue();cmenu(400);break; - case 4: cmenu(990);break; - case 5: cmenu(500);break; + case 3: + KB_FlushKeyboardQueue();cmenu(400);break; + case 4: + cmenu(990);break; + case 5: + cmenu(500);break; } } } - if(KB_KeyPressed(sc_Q)) cmenu(500); + if (KB_KeyPressed(sc_Q)) cmenu(500); - if(x == -1 && (ps[myconnectindex].gm&MODE_GAME || ud.recstat == 2)) + if (x == -1 && (ps[myconnectindex].gm&MODE_GAME || ud.recstat == 2)) { ps[myconnectindex].gm &= ~MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; } } - if(movesperpacket == 4) + if (movesperpacket == 4) { - if( myconnectindex == connecthead ) + if ( myconnectindex == connecthead ) menutext(c,67,MENUHIGHLIGHT(0),PHX(-2),"NEW GAME"); else menutext(c,67,MENUHIGHLIGHT(0),1,"NEW GAME"); @@ -1712,7 +1723,7 @@ cheat_for_port_credits: menutext(c,67+16/*+16*/,MENUHIGHLIGHT(1),PHX(-3),"OPTIONS"); - if(movesperpacket == 4 && connecthead != myconnectindex) + if (movesperpacket == 4 && connecthead != myconnectindex) menutext(c,67+16+16/*+16*/,MENUHIGHLIGHT(2),1,"LOAD GAME"); else menutext(c,67+16+16/*+16*/,MENUHIGHLIGHT(2),PHX(-4),"LOAD GAME"); @@ -1736,12 +1747,12 @@ cheat_for_port_credits: if (PLUTOPAK) // JBF 20030804 rotatesprite((c+100)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,(sintable[(totalclock<<4)&2047]>>11),0,2+8,0,0,xdim-1,ydim-1); x = probe(c,67,16,7); - switch(x) + switch (x) { case 0: - if(movesperpacket == 4 && myconnectindex != connecthead) + if (movesperpacket == 4 && myconnectindex != connecthead) break; - if(ud.multimode < 2 || ud.recstat == 2) + if (ud.multimode < 2 || ud.recstat == 2) cmenu(1500); else { @@ -1750,9 +1761,9 @@ cheat_for_port_credits: } break; case 1: - if(movesperpacket == 4 && connecthead != myconnectindex) + if (movesperpacket == 4 && connecthead != myconnectindex) break; - if(ud.recstat != 2) + if (ud.recstat != 2) { last_fifty = 1; cmenu(350); @@ -1760,7 +1771,7 @@ cheat_for_port_credits: } break; case 2: - if(movesperpacket == 4 && connecthead != myconnectindex) + if (movesperpacket == 4 && connecthead != myconnectindex) break; last_fifty = 2; cmenu(300); @@ -1775,7 +1786,7 @@ cheat_for_port_credits: cmenu(400); break; case 5: - if(numplayers < 2) + if (numplayers < 2) { last_fifty = 5; cmenu(501); @@ -1787,7 +1798,7 @@ cheat_for_port_credits: break; case -1: ps[myconnectindex].gm &= ~MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -1795,10 +1806,10 @@ cheat_for_port_credits: break; } - if( KB_KeyPressed(sc_Q) ) + if ( KB_KeyPressed(sc_Q) ) cmenu(500); - if(movesperpacket == 4 && connecthead != myconnectindex) + if (movesperpacket == 4 && connecthead != myconnectindex) { menutext(c,67 ,MENUHIGHLIGHT(0),1,"NEW GAME"); menutext(c,67+16 ,MENUHIGHLIGHT(1),1,"SAVE GAME"); @@ -1817,7 +1828,7 @@ cheat_for_port_credits: } else { menutext(c,67+16+16+16+16 ,MENUHIGHLIGHT(4),PHX(-6)," HELP"); } - if(numplayers > 1) + if (numplayers > 1) menutext(c,67+16+16+16+16+16 ,MENUHIGHLIGHT(5),1,"QUIT TO TITLE"); else menutext(c,67+16+16+16+16+16 ,MENUHIGHLIGHT(5),PHX(-7),"QUIT TO TITLE"); menutext(c,67+16+16+16+16+16+16,MENUHIGHLIGHT(6),PHX(-8),"QUIT GAME"); @@ -1827,10 +1838,10 @@ cheat_for_port_credits: rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); menutext(160,24,0,0,"SELECT AN EPISODE"); x = probe(160,VOLUMEONE?60:60-(num_volumes*2),20,VOLUMEONE?3:num_volumes+1); - if(x >= 0) + if (x >= 0) { if (VOLUMEONE) { - if(x > 0) + if (x > 0) cmenu(20000); else { @@ -1842,7 +1853,7 @@ cheat_for_port_credits: } if (!VOLUMEONE) { - if(x == num_volumes /*&& boardfilename[0]*/) + if (x == num_volumes /*&& boardfilename[0]*/) { //ud.m_volume_number = 0; //ud.m_level_number = 7; @@ -1859,9 +1870,9 @@ cheat_for_port_credits: } } } - else if(x == -1) + else if (x == -1) { - if(ps[myconnectindex].gm&MODE_GAME) cmenu(50); + if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); else cmenu(0); } @@ -1902,9 +1913,9 @@ cheat_for_port_credits: { // JBF 20040208: seek to first name matching pressed character CACHE1D_FIND_REC *seeker = currentlist ? findfiles : finddirs; - if((KB_KeyPressed(sc_Home)|KB_KeyPressed(sc_End)) > 0) + if ((KB_KeyPressed(sc_Home)|KB_KeyPressed(sc_End)) > 0) { - while(KB_KeyPressed(sc_End)?seeker->next:seeker->prev) + while (KB_KeyPressed(sc_End)?seeker->next:seeker->prev) seeker = KB_KeyPressed(sc_End)?seeker->next:seeker->prev; if (seeker) { if (currentlist) findfileshigh = seeker; @@ -1912,12 +1923,12 @@ cheat_for_port_credits: sound(KICK_HIT); } } - else if((KB_KeyPressed(sc_PgUp)|KB_KeyPressed(sc_PgDn)) > 0) + else if ((KB_KeyPressed(sc_PgUp)|KB_KeyPressed(sc_PgDn)) > 0) { seeker = currentlist?findfileshigh:finddirshigh; i = 6; - while(i>0) { - if(KB_KeyPressed(sc_PgDn)?seeker->next:seeker->prev) + while (i>0) { + if (KB_KeyPressed(sc_PgDn)?seeker->next:seeker->prev) seeker = KB_KeyPressed(sc_PgDn)?seeker->next:seeker->prev; i--; } @@ -1951,8 +1962,8 @@ cheat_for_port_credits: if (finddirshigh) { dir = finddirshigh; - for(i=0; i<2; i++) if (!dir->prev) break; else dir=dir->prev; - for(i=2; i>-2 && dir; i--, dir=dir->next) { + for (i=0; i<2; i++) if (!dir->prev) break; else dir=dir->prev; + for (i=2; i>-2 && dir; i--, dir=dir->next) { if (dir == finddirshigh) c=0; else c=16; minitextshade(40,1+12+32+8*(3-i),dir->name,c,0,26); } @@ -1962,14 +1973,14 @@ cheat_for_port_credits: if (findfileshigh) { dir = findfileshigh; - for(i=0; i<4; i++) if (!dir->prev) break; else dir=dir->prev; - for(i=4; i>-4 && dir; i--, dir=dir->next) { + for (i=0; i<4; i++) if (!dir->prev) break; else dir=dir->prev; + for (i=4; i>-4 && dir; i--, dir=dir->next) { if (dir == findfileshigh) c=0; else c=16; minitextshade(40,(8+32+8*5)+8*(6-i),dir->name,c,2,26); } } - if( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ) || + if ( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || ((buttonstat&1) && minfo.dyaw < -256 ) || KB_KeyPressed( sc_RightArrow ) || KB_KeyPressed( sc_kpad_6 ) || ((buttonstat&1) && minfo.dyaw > 256 ) || KB_KeyPressed( sc_Tab ) ) { @@ -2005,17 +2016,17 @@ cheat_for_port_credits: } } - if(x == -1) { + if (x == -1) { clearfilenames(); boardfilename[0] = 0; - if(ud.multimode > 1) + if (ud.multimode > 1) { sendboardname(); cmenu(600); probey = last_probey; } else cmenu(100); } - else if(x >= 0) + else if (x >= 0) { if (currentlist == 0) { if (!finddirshigh) break; @@ -2029,7 +2040,7 @@ cheat_for_port_credits: strcat(boardfilename, findfileshigh->name); ud.m_volume_number = 0; ud.m_level_number = 7; - if(ud.multimode > 1) + if (ud.multimode > 1) { sendboardname(); cmenu(600); @@ -2045,20 +2056,24 @@ cheat_for_port_credits: rotatesprite(c<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); menutext(c,24,0,0,"SELECT SKILL"); x = probe(c,70,19,4); - if(x >= 0) + if (x >= 0) { - switch(x) + switch (x) { - case 0: globalskillsound = JIBBED_ACTOR6;break; - case 1: globalskillsound = BONUS_SPEECH1;break; - case 2: globalskillsound = DUKE_GETWEAPON2;break; - case 3: globalskillsound = JIBBED_ACTOR5;break; + case 0: + globalskillsound = JIBBED_ACTOR6;break; + case 1: + globalskillsound = BONUS_SPEECH1;break; + case 2: + globalskillsound = DUKE_GETWEAPON2;break; + case 3: + globalskillsound = JIBBED_ACTOR5;break; } sound(globalskillsound); ud.m_player_skill = x+1; - if(x == 3) ud.m_respawn_monsters = 1; + if (x == 3) ud.m_respawn_monsters = 1; else ud.m_respawn_monsters = 0; ud.m_monsters_off = ud.monsters_off = 0; @@ -2068,7 +2083,7 @@ cheat_for_port_credits: ud.multimode = 1; - if(ud.m_volume_number == 3) + if (ud.m_volume_number == 3) { flushperms(); setview(0,0,xdim-1,ydim-1); @@ -2079,7 +2094,7 @@ cheat_for_port_credits: newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill); if (enterlevel(MODE_GAME)) backtomenu(); } - else if(x == -1) + else if (x == -1) { cmenu(100); KB_FlushKeyboardQueue(); @@ -2145,32 +2160,40 @@ cheat_for_port_credits: } enabled = 1; switch (io) { - case 0: if (x==io) glwidescreen = 1-glwidescreen; + case 0: + if (x==io) glwidescreen = 1-glwidescreen; modval(0,1,(int *)&glwidescreen,1,probey==io); gametextpal(d,yy, glwidescreen ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - case 1: if (x==io) usehightile = 1-usehightile; + case 1: + if (x==io) usehightile = 1-usehightile; modval(0,1,(int *)&usehightile,1,probey==io); gametextpal(d,yy, usehightile ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - case 2: enabled = usehightile; + case 2: + enabled = usehightile; if (enabled && x==io) useprecache = !useprecache; if (enabled) modval(0,1,(int *)&useprecache,1,probey==io); gametextpal(d,yy, useprecache && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):15, 0); break; - case 3: enabled = usehightile; + case 3: + enabled = usehightile; if (enabled && x==io) glusetexcompr = !glusetexcompr; if (enabled) modval(0,1,(int *)&glusetexcompr,1,probey==io); gametextpal(d,yy, glusetexcompr && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):15, 0); break; - case 4: enabled = (glusetexcompr && usehightile && useprecache); + case 4: + enabled = (glusetexcompr && usehightile && useprecache); if (enabled && x==io) glusetexcache = !glusetexcache; if (enabled) modval(0,1,(int *)&glusetexcache,1,probey==io); gametextpal(d,yy, glusetexcache && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):15, 0); break; - case 5: enabled = (glusetexcompr && usehightile && useprecache && glusetexcache); + case 5: + enabled = (glusetexcompr && usehightile && useprecache && glusetexcache); if (enabled && x==io) glusetexcachecompression = !glusetexcachecompression; if (enabled) modval(0,1,(int *)&glusetexcachecompression,1,probey==io); gametextpal(d,yy, glusetexcachecompression && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):15, 0); break; - case 6: if (x==io) usemodels = 1-usemodels; + case 6: + if (x==io) usemodels = 1-usemodels; modval(0,1,(int *)&usemodels,1,probey==io); gametextpal(d,yy, usemodels ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - default: break; + default: + break; } gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); io++; @@ -2238,11 +2261,14 @@ cheat_for_port_credits: } enabled = 1; switch (io) { - case 0: if (x==io) ud.crosshair = (ud.crosshair==3)?0:ud.crosshair+1; + case 0: + if (x==io) ud.crosshair = (ud.crosshair==3)?0:ud.crosshair+1; modval(0,3,(int *)&ud.crosshair,1,probey==io); { char *s[] = { "OFF", "ON [100%]", "ON [50%]", "ON [25%]" }; - gametextpal(d,yy,s[ud.crosshair], MENUHIGHLIGHT(io), 0); break; } - case 1: if (x==io) ud.levelstats = 1-ud.levelstats; + gametextpal(d,yy,s[ud.crosshair], MENUHIGHLIGHT(io), 0); break; + } + case 1: + if (x==io) ud.levelstats = 1-ud.levelstats; modval(0,1,(int *)&ud.levelstats,1,probey==io); gametextpal(d,yy, ud.levelstats ? "Shown" : "Hidden", MENUHIGHLIGHT(io), 0); break; case 2: @@ -2250,15 +2276,15 @@ cheat_for_port_credits: int i; i = ud.screen_size; barsm(d+8,yy+7, (short *)&ud.screen_size,-4,x==io,MENUHIGHLIGHT(io),PHX(-5)); - if(i < ud.screen_size && i == 8 && ud.statusbarmode == 1 && bpp > 8) + if (i < ud.screen_size && i == 8 && ud.statusbarmode == 1 && bpp > 8) { ud.statusbarmode = 0; - if(ud.statusbarscale != 100) + if (ud.statusbarscale != 100) ud.screen_size = i; } - else if(i > ud.screen_size && i == 8 && ud.statusbarmode == 0 && bpp > 8) + else if (i > ud.screen_size && i == 8 && ud.statusbarmode == 0 && bpp > 8) { - if(ud.statusbarscale != 100) + if (ud.statusbarscale != 100) { ud.statusbarmode = 1; ud.screen_size = i; @@ -2277,35 +2303,44 @@ cheat_for_port_credits: } } break; - case 4: if (x==io) ud.runkey_mode = 1-ud.runkey_mode; + case 4: + if (x==io) ud.runkey_mode = 1-ud.runkey_mode; modval(0,1,(int *)&ud.runkey_mode,1,probey==io); gametextpal(d,yy, ud.runkey_mode ? "Classic" : "Modern", MENUHIGHLIGHT(io), 0); break; - case 5: if (x==io) ud.detail = 1-ud.detail; + case 5: + if (x==io) ud.detail = 1-ud.detail; modval(0,1,(int *)&ud.detail,1,probey==io); gametextpal(d,yy, ud.detail ? "High" : "Low", MENUHIGHLIGHT(io), 0); break; - case 6: if (x==io) ud.shadows = 1-ud.shadows; + case 6: + if (x==io) ud.shadows = 1-ud.shadows; modval(0,1,(int *)&ud.shadows,1,probey==io); gametextpal(d,yy, ud.shadows ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - case 7: if (x==io) ud.screen_tilting = 1-ud.screen_tilting; + case 7: + if (x==io) ud.screen_tilting = 1-ud.screen_tilting; modval(0,1,(int *)&ud.screen_tilting,1,probey==io); gametextpal(d,yy, ud.screen_tilting ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; // original had a 'full' option - case 8: if (x==io) ud.showweapons = 1-ud.showweapons; + case 8: + if (x==io) ud.showweapons = 1-ud.showweapons; modval(0,1,(int *)&ud.showweapons,1,probey==io); ShowOpponentWeapons = ud.showweapons; gametextpal(d,yy, ShowOpponentWeapons ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - case 9: if (x==io) ud.democams = 1-ud.democams; + case 9: + if (x==io) ud.democams = 1-ud.democams; modval(0,1,(int *)&ud.democams,1,probey==io); gametextpal(d,yy, ud.democams ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - case 10: if (x==io) { + case 10: + if (x==io) { enabled = !((ps[myconnectindex].gm&MODE_GAME) && ud.m_recstat != 1); - if( (ps[myconnectindex].gm&MODE_GAME) ) closedemowrite(); + if ( (ps[myconnectindex].gm&MODE_GAME) ) closedemowrite(); else ud.m_recstat = !ud.m_recstat; } - if( (ps[myconnectindex].gm&MODE_GAME) && ud.m_recstat != 1 ) + if ( (ps[myconnectindex].gm&MODE_GAME) && ud.m_recstat != 1 ) enabled = 0; gametextpal(d,yy,ud.m_recstat?((ud.m_recstat && enabled && ps[myconnectindex].gm&MODE_GAME)?"Recording":"On"):"Off",enabled?MENUHIGHLIGHT(io):15,enabled?0:1); break; - case 11: if (x==io) cmenu(201); break; - default: break; + case 11: + if (x==io) cmenu(201); break; + default: + break; } gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); io++; @@ -2372,29 +2407,41 @@ cheat_for_port_credits: } enabled = 1; switch (io) { - case 0: if(!NAM) { if (x==io) cmenu(10000); } else enabled = 0; break; - case 1: if (x==io) { ud.drawweapon = (ud.drawweapon == 2) ? 0 : ud.drawweapon+1; } + case 0: + if (!NAM) { if (x==io) cmenu(10000); } + else enabled = 0; break; + case 1: + if (x==io) { ud.drawweapon = (ud.drawweapon == 2) ? 0 : ud.drawweapon+1; } modval(0,2,(int *)&ud.drawweapon,1,probey==io); { char *s[] = { "Off", "On", "Icon" }; - gametextpal(d,yy, s[ud.drawweapon], MENUHIGHLIGHT(io), 0); break; } - case 2: if (x==io) ud.tickrate = 1-ud.tickrate; + gametextpal(d,yy, s[ud.drawweapon], MENUHIGHLIGHT(io), 0); break; + } + case 2: + if (x==io) ud.tickrate = 1-ud.tickrate; modval(0,1,(int *)&ud.tickrate,1,probey==io); gametextpal(d,yy, ud.tickrate ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - case 3: if (x==io) { ud.autovote = (ud.autovote == 2) ? 0 : ud.autovote+1; } + case 3: + if (x==io) { ud.autovote = (ud.autovote == 2) ? 0 : ud.autovote+1; } modval(0,2,(int *)&ud.autovote,1,probey==io); { char *s[] = { "Off", "Vote No", "Vote Yes" }; - gametextpal(d,yy, s[ud.autovote], MENUHIGHLIGHT(io), 0); break; } - case 4: if (x==io) ud.automsg = 1-ud.automsg; + gametextpal(d,yy, s[ud.autovote], MENUHIGHLIGHT(io), 0); break; + } + case 4: + if (x==io) ud.automsg = 1-ud.automsg; modval(0,1,(int *)&ud.automsg,1,probey==io); gametextpal(d,yy, ud.automsg ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - case 5: if (x==io) ud.idplayers = 1-ud.idplayers; + case 5: + if (x==io) ud.idplayers = 1-ud.idplayers; modval(0,1,(int *)&ud.idplayers,1,probey==io); gametextpal(d,yy, ud.idplayers ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - case 6: if (x==io) ForceSetup = 1-ForceSetup; + case 6: + if (x==io) ForceSetup = 1-ForceSetup; modval(0,1,(int *)&ForceSetup,1,probey==io); gametextpal(d,yy, ForceSetup ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - case 7: if (x==io) cmenu(200); break; - default: break; + case 7: + if (x==io) cmenu(200); break; + default: + break; } gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); io++; @@ -2417,7 +2464,7 @@ cheat_for_port_credits: switch (x) { case -1: - if(ps[myconnectindex].gm&MODE_GAME) cmenu(50);else cmenu(0); + if (ps[myconnectindex].gm&MODE_GAME) cmenu(50);else cmenu(0); break; case 0: @@ -2457,7 +2504,7 @@ cheat_for_port_credits: } break; case 3: - if(ud.recstat != 1) + if (ud.recstat != 1) cmenu(20002); break; case 4: @@ -2546,7 +2593,7 @@ cheat_for_port_credits: newvidmode++; if (newvidmode == lastvidmode) break; // end of cycle if (newvidmode >= validmodecnt) { - if(safevidmode != -1) + if (safevidmode != -1) break; newvidmode = 0; } @@ -2670,10 +2717,14 @@ cheat_for_port_credits: case 5: if (bpp==8) break; switch (gltexfiltermode) { - case 0: gltexfiltermode = 3; break; - case 3: gltexfiltermode = 5; break; - case 5: gltexfiltermode = 0; break; - default: gltexfiltermode = 3; break; + case 0: + gltexfiltermode = 3; break; + case 3: + gltexfiltermode = 5; break; + case 5: + gltexfiltermode = 0; break; + default: + gltexfiltermode = 3; break; } gltexapplyprops(); break; @@ -2710,7 +2761,7 @@ cheat_for_port_credits: { short ss = ud.brightness; bar(c+167,50+62+16,&ss,8,x==4,MENUHIGHLIGHT(4),PHX(-6)); - if(x==4) { + if (x==4) { ud.brightness = ss; setbrightness(ud.brightness>>2,&ps[myconnectindex].palette[0],0); } @@ -2719,10 +2770,14 @@ cheat_for_port_credits: #if defined(POLYMOST) && defined(USE_OPENGL) menutext(c,50+62+16+16,MENUHIGHLIGHT(5),bpp==8,"FILTERING"); switch (gltexfiltermode) { - case 0: strcpy(tempbuf,"NEAREST"); break; - case 3: strcpy(tempbuf,"BILINEAR"); break; - case 5: strcpy(tempbuf,"TRILINEAR"); break; - default: strcpy(tempbuf,"OTHER"); break; + case 0: + strcpy(tempbuf,"NEAREST"); break; + case 3: + strcpy(tempbuf,"BILINEAR"); break; + case 5: + strcpy(tempbuf,"TRILINEAR"); break; + default: + strcpy(tempbuf,"OTHER"); break; } menutext(c+154,50+62+16+16,MENUHIGHLIGHT(5),bpp==8,tempbuf); @@ -3001,10 +3056,14 @@ cheat_for_port_credits: } else if (function == 1) { Bstrcpy(tempbuf,"TO DIGITAL "); switch (whichkey) { - case 0: Bstrcat(tempbuf, "LEFT"); break; - case 1: Bstrcat(tempbuf, "RIGHT"); break; - case 2: Bstrcat(tempbuf, "UP"); break; - case 3: Bstrcat(tempbuf, "DOWN"); break; + case 0: + Bstrcat(tempbuf, "LEFT"); break; + case 1: + Bstrcat(tempbuf, "RIGHT"); break; + case 2: + Bstrcat(tempbuf, "UP"); break; + case 3: + Bstrcat(tempbuf, "DOWN"); break; } } else if (function == 2) { static char *directions[] = { "UP", "RIGHT", "DOWN", "LEFT" }; @@ -3113,13 +3172,13 @@ cheat_for_port_credits: MouseFilter = l<<1; menutext(c,46+16+16+16+8,/*(MENUHIGHLIGHT(3))+(MENUHIGHLIGHT(4))+(MENUHIGHLIGHT(5))+(MENUHIGHLIGHT(6))-24*/0,0,"DIGITAL AXES ACTIONS"); - if(MouseFilter == 0) + if (MouseFilter == 0) Bsprintf(tempbuf," OFF"); - else if(MouseFilter < 48) + else if (MouseFilter < 48) Bsprintf(tempbuf," LOW"); - else if(MouseFilter < 96) + else if (MouseFilter < 96) Bsprintf(tempbuf," MED"); - else if(MouseFilter < 128) + else if (MouseFilter < 128) Bsprintf(tempbuf,"HIGH"); gametext(c+160-16,46+16+16-8,tempbuf,MENUHIGHLIGHT(2),2+8+16); @@ -3266,14 +3325,18 @@ cheat_for_port_credits: onbar = 0; switch (probey) { case 0: - case 4: onbar = 1; x = probe(88,45+(probey==4)*64,0,1+(4< 2) cmenu(208); - case 0: break; + case 0: + break; case 1: // digitals case 2: @@ -3322,7 +3386,8 @@ cheat_for_port_credits: mouseyaxismode = -1; } break; - default:break; + default: + break; } Bsprintf(tempbuf,getjoyname(0,thispage*2)); @@ -3477,13 +3542,13 @@ cheat_for_port_credits: onbar = ( probey == 2 || probey == 3 ); x = probe(c,50,16,7); - switch(x) + switch (x) { case -1: - if(ps[myconnectindex].gm&MODE_GAME && current_menu == 701) + if (ps[myconnectindex].gm&MODE_GAME && current_menu == 701) { ps[myconnectindex].gm &= ~MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -3497,7 +3562,7 @@ cheat_for_port_credits: if (FXDevice >= 0) { SoundToggle = 1-SoundToggle; - if( SoundToggle == 0 ) + if ( SoundToggle == 0 ) { FX_StopAllSounds(); clearsoundlocks(); @@ -3506,13 +3571,13 @@ cheat_for_port_credits: } break; case 1: - if(MusicDevice >= 0 && (numplayers < 2 || MusicToggle)) + if (MusicDevice >= 0 && (numplayers < 2 || MusicToggle)) { MusicToggle = 1-MusicToggle; - if( MusicToggle == 0 ) MUSIC_Pause(); + if ( MusicToggle == 0 ) MUSIC_Pause(); else { - if(ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME) + if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME) playmusic(&music_fn[0][music_select][0]); else playmusic(&env_music_fn[0][0]); @@ -3523,15 +3588,15 @@ cheat_for_port_credits: break; case 4: - if(SoundToggle && (FXDevice >= 0)) { VoiceToggle = (VoiceToggle == 2) ? 0 : VoiceToggle+1; } + if (SoundToggle && (FXDevice >= 0)) { VoiceToggle = (VoiceToggle == 2) ? 0 : VoiceToggle+1; } onbar = 0; break; case 5: - if(SoundToggle && (FXDevice >= 0)) AmbienceToggle = 1-AmbienceToggle; + if (SoundToggle && (FXDevice >= 0)) AmbienceToggle = 1-AmbienceToggle; onbar = 0; break; case 6: - if(SoundToggle && (FXDevice >= 0)) + if (SoundToggle && (FXDevice >= 0)) { ReverseStereo = 1-ReverseStereo; FX_SetReverseStereo(ReverseStereo); @@ -3553,9 +3618,9 @@ cheat_for_port_credits: l = FXVolume; FXVolume >>= 2; bar(c+167+40,50+16+16,(short *)&FXVolume,4,(FXDevice>=0)&&x==2,MENUHIGHLIGHT(2),SoundToggle==0||(FXDevice<0)); - if(l != FXVolume) + if (l != FXVolume) FXVolume <<= 2; - if(l != FXVolume) + if (l != FXVolume) FX_SetVolume( (short) FXVolume ); } menutext(c,50+16,MENUHIGHLIGHT(1),(MusicDevice<0||(numplayers > 1 && !MusicToggle)),"MUSIC"); @@ -3568,7 +3633,7 @@ cheat_for_port_credits: (MusicDevice>=0) && x==3,MENUHIGHLIGHT(3), MusicToggle==0||(MusicDevice<0)); MusicVolume <<= 2; - if(l != MusicVolume) + if (l != MusicVolume) MUSIC_SetVolume( (short) MusicVolume ); } @@ -3578,7 +3643,8 @@ cheat_for_port_credits: menutext(c,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(FXDevice<0)||SoundToggle==0,"FLIP STEREO"); { char *s[] = { "OFF", "LOCAL", "ALL" }; - menutext(c+160+40,50+16+16+16+16,MENUHIGHLIGHT(4),(FXDevice<0)||SoundToggle==0,s[VoiceToggle]); } + menutext(c+160+40,50+16+16+16+16,MENUHIGHLIGHT(4),(FXDevice<0)||SoundToggle==0,s[VoiceToggle]); + } menutext(c+160+40,50+16+16+16+16+16,MENUHIGHLIGHT(5),(FXDevice<0)||SoundToggle==0,AmbienceToggle?"ON":"OFF"); @@ -3611,10 +3677,10 @@ cheat_for_port_credits: rotatesprite(c<<16,200<<15,65536L,0,MENUSCREEN,16,0,10+64,0,0,xdim-1,ydim-1); rotatesprite(c<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - if(current_menu == 300) menutext(c,24,0,0,"LOAD GAME"); + if (current_menu == 300) menutext(c,24,0,0,"LOAD GAME"); else menutext(c,24,0,0,"SAVE GAME"); - if(current_menu >= 360 && current_menu <= 369 ) + if (current_menu >= 360 && current_menu <= 369 ) { sprintf(tempbuf,"PLAYERS: %-2ld ",ud.multimode); gametext(160,156,tempbuf,0,2+8+16); @@ -3625,11 +3691,11 @@ cheat_for_port_credits: x = strget((320>>1),184,&ud.savegame[current_menu-360][0],19, 999 ); - if(x == -1) + if (x == -1) { // readsavenames(); ps[myconnectindex].gm = MODE_GAME; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -3637,22 +3703,22 @@ cheat_for_port_credits: goto DISPLAYNAMES; } - if( x == 1 ) + if ( x == 1 ) { - if( ud.savegame[current_menu-360][0] == 0 ) + if ( ud.savegame[current_menu-360][0] == 0 ) { KB_FlushKeyboardQueue(); cmenu(351); } else { - if(ud.multimode > 1) + if (ud.multimode > 1) saveplayer(-1-(current_menu-360)); else saveplayer(current_menu-360); lastsavedpos = current_menu-360; ps[myconnectindex].gm = MODE_GAME; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -3672,11 +3738,11 @@ cheat_for_port_credits: x = probe(c+68,54,12,10); - if(current_menu == 300) + if (current_menu == 300) { - if( ud.savegame[probey][0] ) + if ( ud.savegame[probey][0] ) { - if( lastprobey != probey ) + if ( lastprobey != probey ) { loadpheader(probey,&savehead); lastprobey = probey; @@ -3694,9 +3760,9 @@ cheat_for_port_credits: } else { - if( ud.savegame[probey][0] ) + if ( ud.savegame[probey][0] ) { - if(lastprobey != probey) + if (lastprobey != probey) loadpheader(probey,&savehead); lastprobey = probey; rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); @@ -3710,12 +3776,12 @@ cheat_for_port_credits: gametext(160,180,boardfilename,0,2+8+16); } - switch( x ) + switch ( x ) { case -1: - if(current_menu == 300) + if (current_menu == 300) { - if( (ps[myconnectindex].gm&MODE_GAME) != MODE_GAME) + if ( (ps[myconnectindex].gm&MODE_GAME) != MODE_GAME) { cmenu(0); break; @@ -3726,7 +3792,7 @@ cheat_for_port_credits: else ps[myconnectindex].gm = MODE_GAME; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -3743,14 +3809,14 @@ cheat_for_port_credits: case 7: case 8: case 9: - if( current_menu == 300) + if ( current_menu == 300) { - if( ud.savegame[x][0] ) + if ( ud.savegame[x][0] ) current_menu = (1000+x); } else { - if( ud.savegame[x][0] != 0) + if ( ud.savegame[x][0] != 0) current_menu = 2000+x; else { @@ -3775,7 +3841,7 @@ DISPLAYNAMES: c = 320>>1; - if( KB_KeyPressed( sc_LeftArrow ) || + if ( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || KB_KeyPressed( sc_UpArrow ) || KB_KeyPressed( sc_PgUp ) || @@ -3789,9 +3855,9 @@ DISPLAYNAMES: sound(KICK_HIT); current_menu--; - if(current_menu < 400) current_menu = 403; + if (current_menu < 400) current_menu = 403; } - else if( + else if ( KB_KeyPressed( sc_PgDn ) || KB_KeyPressed( sc_Enter ) || KB_KeyPressed( sc_kpad_Enter ) || @@ -3813,12 +3879,12 @@ DISPLAYNAMES: KB_ClearKeyDown(sc_Space); sound(KICK_HIT); current_menu++; - if(current_menu > 403) current_menu = 400; + if (current_menu > 403) current_menu = 400; } - if( KB_KeyPressed(sc_Escape) ) + if ( KB_KeyPressed(sc_Escape) ) { - if(ps[myconnectindex].gm&MODE_GAME) + if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); else cmenu(0); return; @@ -3832,7 +3898,7 @@ VOLUME_ALL_40x: c = 320>>1; - if( KB_KeyPressed( sc_LeftArrow ) || + if ( KB_KeyPressed( sc_LeftArrow ) || KB_KeyPressed( sc_kpad_4 ) || KB_KeyPressed( sc_UpArrow ) || KB_KeyPressed( sc_PgUp ) || @@ -3846,9 +3912,9 @@ VOLUME_ALL_40x: sound(KICK_HIT); current_menu--; - if(current_menu < 400) current_menu = 401; + if (current_menu < 400) current_menu = 401; } - else if( + else if ( KB_KeyPressed( sc_PgDn ) || KB_KeyPressed( sc_Enter ) || KB_KeyPressed( sc_kpad_Enter ) || @@ -3870,19 +3936,19 @@ VOLUME_ALL_40x: KB_ClearKeyDown(sc_Space); sound(KICK_HIT); current_menu++; - if(current_menu > 401) current_menu = 400; + if (current_menu > 401) current_menu = 400; } - if( KB_KeyPressed(sc_Escape) ) + if ( KB_KeyPressed(sc_Escape) ) { - if(ps[myconnectindex].gm&MODE_GAME) + if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); else cmenu(0); return; } flushperms(); - switch(current_menu) + switch (current_menu) { case 400: rotatesprite(0,0,65536L,0,TEXTSTORY,0,0,10+16+64, 0,0,xdim-1,ydim-1); @@ -3901,7 +3967,7 @@ VOLUME_ALL_40x: gametext(c,90,"Are you sure you want to quit?",0,2+8+16); gametext(c,99,"(Y/N)",0,2+8+16); - if( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) + if ( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) { KB_FlushKeyboardQueue(); @@ -3909,23 +3975,23 @@ VOLUME_ALL_40x: } x = probe(186,124,0,0); - if(x == -1 || KB_KeyPressed(sc_N) || RMB) + if (x == -1 || KB_KeyPressed(sc_N) || RMB) { KB_ClearKeyDown(sc_N); quittimer = 0; - if( ps[myconnectindex].gm&MODE_DEMO && ud.recstat == 2 ) + if ( ps[myconnectindex].gm&MODE_DEMO && ud.recstat == 2 ) ps[myconnectindex].gm = MODE_DEMO; else { - if(current_menu == 502) + if (current_menu == 502) { cmenu(last_menu); probey = last_probey; } - else if(!(ps[myconnectindex].gm & MODE_GAME || ud.recstat == 2)) + else if (!(ps[myconnectindex].gm & MODE_GAME || ud.recstat == 2)) cmenu(0); else ps[myconnectindex].gm &= ~MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -3939,21 +4005,21 @@ VOLUME_ALL_40x: gametext(c,90,"Quit to Title?",0,2+8+16); gametext(c,99,"(Y/N)",0,2+8+16); - if( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) + if ( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB ) { KB_FlushKeyboardQueue(); ps[myconnectindex].gm = MODE_DEMO; - if(ud.recstat == 1) + if (ud.recstat == 1) closedemowrite(); cmenu(0); } x = probe(186,124,0,0); - if(x == -1 || KB_KeyPressed(sc_N) || RMB) + if (x == -1 || KB_KeyPressed(sc_N) || RMB) { ps[myconnectindex].gm &= ~MODE_MENU; - if(ud.multimode < 2 && ud.recstat != 2) + if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; @@ -3971,7 +4037,7 @@ VOLUME_ALL_40x: gametext(160,50,tempbuf,0,2+8+16); gametext(160,59,"to select level",0,2+8+16); - if( KB_KeyPressed(sc_Escape) ) + if ( KB_KeyPressed(sc_Escape) ) { KB_ClearKeyDown(sc_Escape); sound(EXITMENUSOUND); @@ -3980,7 +4046,7 @@ VOLUME_ALL_40x: break; case 602: - if(menunamecnt == 0) + if (menunamecnt == 0) { // getfilenames("SUBD"); getfilenames(".","*.MAP"); @@ -3994,11 +4060,11 @@ VOLUME_ALL_40x: x = probe(186,124,0,0); - if(voting != myconnectindex) + if (voting != myconnectindex) ps[myconnectindex].gm &= ~MODE_MENU; if (x == -1) { - if(voting == myconnectindex) + if (voting == myconnectindex) { Bmemset(votes,0,sizeof(votes)); Bmemset(gotvote,0,sizeof(gotvote)); @@ -4007,9 +4073,9 @@ VOLUME_ALL_40x: tempbuf[1] = 2; tempbuf[2] = myconnectindex; - for(c=connecthead;c>=0;c=connectpoint2[c]) + for (c=connecthead;c>=0;c=connectpoint2[c]) { - if(c != myconnectindex) sendpacket(c,tempbuf,3); + if (c != myconnectindex) sendpacket(c,tempbuf,3); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master } voting = -1; @@ -4017,24 +4083,24 @@ VOLUME_ALL_40x: cmenu(0); } - for(i=0;i (numplayers>>1)) || (!networkmode && myconnectindex == connecthead)) + if (j == numplayers || !ps[myconnectindex].i || (plrvotes > (numplayers>>1)) || (!networkmode && myconnectindex == connecthead)) { - if(plrvotes > (numplayers>>1) || !ps[myconnectindex].i || (!networkmode && myconnectindex == connecthead)) + if (plrvotes > (numplayers>>1) || !ps[myconnectindex].i || (!networkmode && myconnectindex == connecthead)) { tempbuf[0] = 5; tempbuf[1] = ud.m_level_number; tempbuf[2] = ud.m_volume_number; tempbuf[3] = ud.m_player_skill+1; - if( ud.m_player_skill == 3 ) ud.m_respawn_monsters = 1; + if ( ud.m_player_skill == 3 ) ud.m_respawn_monsters = 1; else ud.m_respawn_monsters = 0; - if((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_ITEMRESPAWN)) ud.m_respawn_items = 1; + if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_ITEMRESPAWN)) ud.m_respawn_items = 1; else ud.m_respawn_items = 0; ud.m_respawn_inventory = 1; @@ -4048,19 +4114,19 @@ VOLUME_ALL_40x: tempbuf[10] = ud.m_ffire; tempbuf[11] = ud.m_noexits; - for(c=connecthead;c>=0;c=connectpoint2[c]) + for (c=connecthead;c>=0;c=connectpoint2[c]) { resetweapons(c); resetinventory(c); } - for(c=connecthead;c>=0;c=connectpoint2[c]) + for (c=connecthead;c>=0;c=connectpoint2[c]) { - if(c != myconnectindex) sendpacket(c,tempbuf,12); + if (c != myconnectindex) sendpacket(c,tempbuf,12); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master } - if(voting == myconnectindex) + if (voting == myconnectindex) adduserquote("VOTE SUCCEEDED"); newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill+1); @@ -4068,7 +4134,7 @@ VOLUME_ALL_40x: return; } - else if(j == numplayers) { + else if (j == numplayers) { Bmemset(votes,0,sizeof(votes)); Bmemset(gotvote,0,sizeof(gotvote)); voting = -1; @@ -4078,9 +4144,9 @@ VOLUME_ALL_40x: tempbuf[2] = myconnectindex; tempbuf[3] = 1; - for(c=connecthead;c>=0;c=connectpoint2[c]) + for (c=connecthead;c>=0;c=connectpoint2[c]) { - if(c != myconnectindex) sendpacket(c,tempbuf,4); + if (c != myconnectindex) sendpacket(c,tempbuf,4); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master } @@ -4095,7 +4161,7 @@ VOLUME_ALL_40x: } case 600: c = (320>>1) - 120; - if((ps[myconnectindex].gm&MODE_GAME) != MODE_GAME) + if ((ps[myconnectindex].gm&MODE_GAME) != MODE_GAME) displayfragbar(); rotatesprite(160<<16,26<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); menutext(160,31,0,0,&ud.user_name[myconnectindex][0]); @@ -4103,55 +4169,55 @@ VOLUME_ALL_40x: x = probe(c,57-8,16,8); modval(0,num_gametypes-1,(int *)&ud.m_coop,1,probey==0); - if(!VOLUMEONE) + if (!VOLUMEONE) modval(0,num_volumes-1,(int *)&ud.m_volume_number,1,probey==1); modval(0,ud.m_volume_number == 0?6+(boardfilename[0]!=0):10,(int *)&ud.m_level_number,1,probey==2); - if((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION)) + if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION)) modval(0,1,(int *)&ud.m_marker,1,probey==4); - if((gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM))) + if ((gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM))) modval(0,1,(int *)&ud.m_ffire,1,probey==5); else modval(0,1,(int *)&ud.m_noexits,1,probey==5); - switch(x) + switch (x) { case -1: ud.m_recstat = 0; - if(ps[myconnectindex].gm&MODE_GAME) cmenu(50); + if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); else cmenu(0); break; case 0: ud.m_coop++; - if(ud.m_coop == num_gametypes) ud.m_coop = 0; + if (ud.m_coop == num_gametypes) ud.m_coop = 0; break; case 1: if (!VOLUMEONE) { ud.m_volume_number++; - if(ud.m_volume_number == num_volumes) ud.m_volume_number = 0; - if(ud.m_volume_number == 0 && ud.m_level_number > 6) + if (ud.m_volume_number == num_volumes) ud.m_volume_number = 0; + if (ud.m_volume_number == 0 && ud.m_level_number > 6) ud.m_level_number = 0; - if(ud.m_level_number > 10) ud.m_level_number = 0; + if (ud.m_level_number > 10) ud.m_level_number = 0; } break; case 2: ud.m_level_number++; if (!VOLUMEONE) { - if(ud.m_volume_number == 0 && ud.m_level_number > 6+(boardfilename[0]!=0)) + if (ud.m_volume_number == 0 && ud.m_level_number > 6+(boardfilename[0]!=0)) ud.m_level_number = 0; } else { - if(ud.m_volume_number == 0 && ud.m_level_number > 5) + if (ud.m_volume_number == 0 && ud.m_level_number > 5) ud.m_level_number = 0; } - if(ud.m_level_number > 10) ud.m_level_number = 0; + if (ud.m_level_number > 10) ud.m_level_number = 0; break; case 3: - if(ud.m_monsters_off == 1 && ud.m_player_skill > 0) + if (ud.m_monsters_off == 1 && ud.m_player_skill > 0) ud.m_monsters_off = 0; - if(ud.m_monsters_off == 0) + if (ud.m_monsters_off == 0) { ud.m_player_skill++; - if(ud.m_player_skill > 3) + if (ud.m_player_skill > 3) { ud.m_player_skill = 0; ud.m_monsters_off = 1; @@ -4162,12 +4228,12 @@ VOLUME_ALL_40x: break; case 4: - if((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION)) + if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION)) ud.m_marker = !ud.m_marker; break; case 5: - if((gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM))) + if ((gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM))) ud.m_ffire = !ud.m_ffire; else ud.m_noexits = !ud.m_noexits; break; @@ -4180,9 +4246,9 @@ VOLUME_ALL_40x: } break; case 7: - if(voting == -1) + if (voting == -1) { - if(ps[myconnectindex].i) + if (ps[myconnectindex].i) { Bmemset(votes,0,sizeof(votes)); Bmemset(gotvote,0,sizeof(gotvote)); @@ -4195,9 +4261,9 @@ VOLUME_ALL_40x: tempbuf[3] = ud.m_volume_number; tempbuf[4] = ud.m_level_number; - for(c=connecthead;c>=0;c=connectpoint2[c]) + for (c=connecthead;c>=0;c=connectpoint2[c]) { - if(c != myconnectindex) sendpacket(c,tempbuf,5); + if (c != myconnectindex) sendpacket(c,tempbuf,5); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master } } @@ -4222,10 +4288,10 @@ VOLUME_ALL_40x: gametext(c+70,57+16+16+16-7-9,ud.m_monsters_off == 0 || ud.m_player_skill > 0?skill_names[ud.m_player_skill]:"NONE",MENUHIGHLIGHT(3),2+8+16); - if(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION) + if (gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION) gametext(c+70,57+16+16+16+16-7-9,ud.m_marker?"ON":"OFF",MENUHIGHLIGHT(4),2+8+16); - if(gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM)) + if (gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM)) gametext(c+70,57+16+16+16+16+16-7-9,ud.m_ffire?"ON":"OFF",MENUHIGHLIGHT(5),2+8+16); else gametext(c+70,57+16+16+16+16+16-7-9,ud.m_noexits?"OFF":"ON",MENUHIGHLIGHT(5),2+8+16); @@ -4246,18 +4312,18 @@ VOLUME_ALL_40x: menutext(c,57+16+16+16-9,MENUHIGHLIGHT(3),PHX(-5),"MONSTERS"); - if(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION) + if (gametype_flags[ud.m_coop] & GAMETYPE_FLAG_MARKEROPTION) menutext(c,57+16+16+16+16-9,MENUHIGHLIGHT(4),PHX(-6),"MARKERS"); else menutext(c,57+16+16+16+16-9,MENUHIGHLIGHT(4),1,"MARKERS"); - if(gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM)) + if (gametype_flags[ud.m_coop] & (GAMETYPE_FLAG_PLAYERSFRIENDLY|GAMETYPE_FLAG_TDM)) menutext(c,57+16+16+16+16+16-9,MENUHIGHLIGHT(5),0,"FR. FIRE"); else menutext(c,57+16+16+16+16+16-9,MENUHIGHLIGHT(5),0,"MAP EXITS"); if (VOLUMEALL) { menutext(c,57+16+16+16+16+16+16-9,MENUHIGHLIGHT(6),0,"USER MAP"); - if( boardfilename[0] != 0 ) + if ( boardfilename[0] != 0 ) gametext(c+70+44,57+16+16+16+16+16,boardfilename,MENUHIGHLIGHT(6),2+8+16); } else { menutext(c,57+16+16+16+16+16+16-9,MENUHIGHLIGHT(6),1,"USER MAP"); @@ -4268,7 +4334,7 @@ VOLUME_ALL_40x: break; } - if( (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU) + if ( (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU) { vscrn(); cameraclock = totalclock; diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index b4ffc2220..d49ae329b 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -120,7 +120,7 @@ int osdcmd_map(const osdfuncparm_t *parm) if (parm->numparms != 1) return OSDCMD_SHOWHELP; strcpy(filename,parm->parms[0]); - if( strchr(filename,'.') == 0) + if ( strchr(filename,'.') == 0) strcat(filename,".map"); if ((i = kopen4load(filename,0)) < 0) { @@ -370,9 +370,9 @@ int osdcmd_setvar(const osdfuncparm_t *parm) strcpy(varname,parm->parms[0]); varval = Batol(parm->parms[1]); - for(i=0;iparms[0]); - if (cvar[i].type == CVAR_BOOL) val = val != 0; + val = atoi(parm->parms[0]); + if (cvar[i].type == CVAR_BOOL) val = val != 0; - if (val < cvar[i].min || val > cvar[i].max) { - OSD_Printf("%s value out of range\n",cvar[i].name); - return OSDCMD_OK; - } - *(int*)cvar[i].var = val; - OSD_Printf("%s %d",cvar[i].name,val); - } break; + if (val < cvar[i].min || val > cvar[i].max) { + OSD_Printf("%s value out of range\n",cvar[i].name); + return OSDCMD_OK; + } + *(int*)cvar[i].var = val; + OSD_Printf("%s %d",cvar[i].name,val); + } break; case CVAR_STRING: - { - if (showval) { - OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvar[i].name,(char*)cvar[i].var,(char*)cvar[i].helpstr); - return OSDCMD_OK; - } - else { - Bstrncpy((char*)cvar[i].var, parm->parms[0], cvar[i].extra-1); - ((char*)cvar[i].var)[cvar[i].extra-1] = 0; - OSD_Printf("%s %s",cvar[i].name,(char*)cvar[i].var); - } - } break; - default: break; + { + if (showval) { + OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvar[i].name,(char*)cvar[i].var,(char*)cvar[i].helpstr); + return OSDCMD_OK; + } + else { + Bstrncpy((char*)cvar[i].var, parm->parms[0], cvar[i].extra-1); + ((char*)cvar[i].var)[cvar[i].extra-1] = 0; + OSD_Printf("%s %s",cvar[i].name,(char*)cvar[i].var); + } + } break; + default: + break; } - if(cvar[i].type&256) + if (cvar[i].type&256) updatenames(); } } @@ -561,7 +563,7 @@ int osdcmd_give(const osdfuncparm_t *parm) int i; if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) { - if(ps[myconnectindex].dead_flag != 0) { + if (ps[myconnectindex].dead_flag != 0) { OSD_Printf("give: Cannot give while dead.\n"); return OSDCMD_OK; } @@ -653,7 +655,7 @@ int osdcmd_mpmap(const osdfuncparm_t *parm) if (parm->numparms != 1) return OSDCMD_SHOWHELP; strcpy(filename,parm->parms[0]); - if( strchr(filename,'.') == 0) + if ( strchr(filename,'.') == 0) strcat(filename,".map"); if ((i = kopen4load(filename,0)) < 0) { @@ -679,7 +681,7 @@ int osdcmd_name(const osdfuncparm_t *parm) Bstrcpy(tempbuf,parm->parms[0]); - while(Bstrlen(strip_color_codes(tempbuf)) > 10) + while (Bstrlen(strip_color_codes(tempbuf)) > 10) tempbuf[Bstrlen(tempbuf)-1] = '\0'; Bstrncpy(myname,tempbuf,sizeof(myname)-1); diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index 0e2dfce1d..d5875feda 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -77,14 +77,14 @@ void GAME_clearbackground(int c, int r) xsiz = tilesizx[BGTILE]; tx2 = xdim/xsiz; ysiz = tilesizy[BGTILE]; ty2 = daydim/ysiz; - for(x=0;x<=tx2;x++) - for(y=0;y<=ty2;y++) + for (x=0;x<=tx2;x++) + for (y=0;y<=ty2;y++) rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim); xsiz = tilesizy[BORDTILE]; tx2 = xdim/xsiz; ysiz = tilesizx[BORDTILE]; - for(x=0;x<=tx2;x++) + for (x=0;x<=tx2;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 ad891b263..e698f2774 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -39,11 +39,11 @@ int32 lastcontroltime; //MED void setpal(struct player_struct *p) { - if(p->heat_on) p->palette = slimepal; + if (p->heat_on) p->palette = slimepal; else if ((sector[p->cursectnum].ceilingpicnum >= FLOORSLIME)&&(sector[p->cursectnum].ceilingpicnum <=FLOORSLIME+2)) { p->palette = slimepal; } else { - if(sector[p->cursectnum].lotag == 2) p->palette = waterpal; + if (sector[p->cursectnum].lotag == 2) p->palette = waterpal; else p->palette = palette; } @@ -64,7 +64,7 @@ void incur_damage(struct player_struct *p) SetGameVarID(g_iReturnVarID,0,p->i,sprite[p->i].yvel); OnEvent(EVENT_INCURDAMAGE, p->i, sprite[p->i].yvel, -1); - if(GetGameVarID(g_iReturnVarID,p->i,sprite[p->i].yvel) == 0) + if (GetGameVarID(g_iReturnVarID,p->i,sprite[p->i].yvel) == 0) { sprite[p->i].extra -= p->extra_extra8>>8; @@ -105,7 +105,7 @@ void quickkill(struct player_struct *p) sprite[p->i].extra = 0; sprite[p->i].cstat |= 32768; - if(ud.god == 0) guts(&sprite[p->i],JIBS6,8,myconnectindex); + if (ud.god == 0) guts(&sprite[p->i],JIBS6,8,myconnectindex); return; } @@ -131,18 +131,18 @@ void tracers(long x1,long y1,long z1,long x2,long y2,long z2,long n) yv = (y2-y1)/i; zv = (z2-z1)/i; - if( ( klabs(x1-x2)+klabs(y1-y2) ) < 3084 ) + 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; z1 += zv; updatesector(x1,y1,§); - if(sect >= 0) + if (sect >= 0) { - if(sector[sect].lotag == 2) + if (sector[sect].lotag == 2) EGS(sect,x1,y1,z1,WATERBUBBLE,-32,4+(TRAND&3),4+(TRAND&3),TRAND&2047,0,0,ps[0].i,5); else EGS(sect,x1,y1,z1,SMALLSMOKE,-32,14,14,0,0,0,ps[0].i,5); @@ -160,7 +160,7 @@ void hitscantrail(long x1, long y1, long z1, long x2, long y2, long z2, short an n = ((FindDistance2D(x1-x2,y1-y2))>>8)+1; - if(projectile[atwith].toffset != 0) + if (projectile[atwith].toffset != 0) z1 += (projectile[atwith].toffset<<8); z1 += 1024; @@ -173,13 +173,13 @@ void hitscantrail(long x1, long y1, long z1, long x2, long y2, long z2, short an y1 += yv>>2; z1 += zv>>2; - for(i=0;i= 0) + if (sect >= 0) { j = EGS(sect,x1,y1,z1,projectile[atwith].trail,-32,projectile[atwith].txrepeat,projectile[atwith].tyrepeat,ang,0,0,ps[0].i,0); changespritestat(j,1); @@ -194,7 +194,7 @@ long hits(short i) short sect,hw,hs; long zoff; - if(PN == APLAYER) zoff = (40<<8); + if (PN == APLAYER) zoff = (40<<8); else zoff = 0; hitscan(SX,SY,SZ-zoff,SECT, @@ -210,9 +210,9 @@ long hitasprite(short i,short *hitsp) long sx,sy,sz,zoff; short sect,hw; - if(badguy(&sprite[i]) ) + if (badguy(&sprite[i]) ) zoff = (42<<8); - else if(PN == APLAYER) zoff = (39<<8); + else if (PN == APLAYER) zoff = (39<<8); else zoff = 0; hitscan(SX,SY,SZ-zoff,SECT, @@ -220,7 +220,7 @@ long hitasprite(short i,short *hitsp) sintable[SA&2047], 0,§,&hw,hitsp,&sx,&sy,&sz,CLIPMASK1); - if(hw >= 0 && (wall[hw].cstat&16) && badguy(&sprite[i]) ) + if (hw >= 0 && (wall[hw].cstat&16) && badguy(&sprite[i]) ) return((1<<30)); return ( FindDistance2D(sx-SX,sy-SY) ); @@ -262,14 +262,14 @@ short aim(spritetype *s,short aang,short atwith) long dx1, dy1, dx2, dy2, dx3, dy3, smax, sdist; long xv, yv; - if(s->picnum == APLAYER) { - if(!ps[s->yvel].auto_aim) + if (s->picnum == APLAYER) { + if (!ps[s->yvel].auto_aim) return -1; - if(ps[s->yvel].auto_aim == 2) + if (ps[s->yvel].auto_aim == 2) { - if(checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE) && (projectile[atwith].workslike & PROJECTILE_FLAG_RPG)) + if (checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE) && (projectile[atwith].workslike & PROJECTILE_FLAG_RPG)) return -1; - else switch(dynamictostatic[atwith]) { + else switch (dynamictostatic[atwith]) { case TONGUE__STATIC: case FREEZEBLAST__STATIC: case SHRINKSPARK__STATIC: @@ -302,54 +302,55 @@ short aim(spritetype *s,short aang,short 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 ) + if ( j >= 0 ) break; - 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( badguy(&sprite[i]) || k < 2 ) + 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 ( badguy(&sprite[i]) || k < 2 ) { - if(badguy(&sprite[i]) || PN == APLAYER || PN == SHARK) + if (badguy(&sprite[i]) || PN == APLAYER || PN == SHARK) { - if( PN == APLAYER && + if ( PN == APLAYER && // ud.ffire == 0 && (GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[i].yvel].team == ps[s->yvel].team)) && s->picnum == APLAYER && s != &sprite[i]) continue; - if(gotshrinker && sprite[i].xrepeat < 30 ) + if (gotshrinker && sprite[i].xrepeat < 30 ) { if (PN == SHARK) { - if(sprite[i].xrepeat < 20) continue; + if (sprite[i].xrepeat < 20) continue; continue; } else if ((PN >= GREENSLIME)&&(PN <= GREENSLIME+7)) { - } else { + } + else { continue; } } - if(gotfreezer && sprite[i].pal == 1) continue; + if (gotfreezer && sprite[i].pal == 1) continue; } xv = (SX-s->x); yv = (SY-s->y); - if( (dy1*xv) <= (dx1*yv) ) - if( ( dy2*xv ) >= (dx2*yv) ) + if ( (dy1*xv) <= (dx1*yv) ) + if ( ( dy2*xv ) >= (dx2*yv) ) { sdist = mulscale(dx3,xv,14) + mulscale(dy3,yv,14); - if( sdist > 512 && sdist < smax ) + if ( sdist > 512 && sdist < smax ) { - if(s->picnum == APLAYER) + if (s->picnum == APLAYER) a = (klabs(scale(SZ-s->z,10,sdist)-(ps[s->yvel].horiz+ps[s->yvel].horizoff-100)) < 100); else a = 1; - if(PN == ORGANTIC || PN == ROTATEGUN ) + if (PN == ORGANTIC || PN == ROTATEGUN ) cans = cansee(SX,SY,SZ,SECT,s->x,s->y,s->z-(32<<8),s->sectnum); else cans = cansee(SX,SY,SZ-(32<<8),SECT,s->x,s->y,s->z-(32<<8),s->sectnum); - if( a && cans ) + if ( a && cans ) { smax = sdist; j = i; @@ -373,7 +374,7 @@ short shoot(short i,short atwith) sect = s->sectnum; zvel = 0; - if( s->picnum == APLAYER ) + if ( s->picnum == APLAYER ) { p = s->yvel; @@ -391,10 +392,10 @@ short shoot(short i,short atwith) sx = s->x; sy = s->y; sz = s->z-((s->yrepeat*tilesizy[s->picnum])<<1)+(4<<8); - if(s->picnum != ROTATEGUN) + if (s->picnum != ROTATEGUN) { sz -= (7<<8); - if(badguy(s) && PN != COMMANDER) + if (badguy(s) && PN != COMMANDER) { sx += (sintable[(sa+1024+96)&2047]>>7); sy += (sintable[(sa+512+96)&2047]>>7); @@ -402,27 +403,27 @@ short shoot(short i,short atwith) } } - if(checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE)) + if (checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE)) { /* Custom projectiles. This is a big hack. */ if (projectile[atwith].offset == 0) projectile[atwith].offset = 1; // writestring(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047],zvel<<6); - if(projectile[atwith].workslike & PROJECTILE_FLAG_BLOOD || projectile[atwith].workslike & PROJECTILE_FLAG_KNEE) + if (projectile[atwith].workslike & PROJECTILE_FLAG_BLOOD || projectile[atwith].workslike & PROJECTILE_FLAG_KNEE) { - if(projectile[atwith].workslike & PROJECTILE_FLAG_BLOOD) + if (projectile[atwith].workslike & PROJECTILE_FLAG_BLOOD) { - if(p >= 0) + if (p >= 0) sa += 64 - (TRAND&127); else sa += 1024 + 64 - (TRAND&127); zvel = 1024-(TRAND&2047); } - if(projectile[atwith].workslike & PROJECTILE_FLAG_KNEE) + if (projectile[atwith].workslike & PROJECTILE_FLAG_KNEE) { - if(p >= 0) + if (p >= 0) { zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; sz += (6<<8); @@ -442,41 +443,41 @@ short shoot(short i,short atwith) sintable[sa&2047],zvel<<6, &hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); - if(projectile[atwith].workslike & PROJECTILE_FLAG_BLOOD) + if (projectile[atwith].workslike & PROJECTILE_FLAG_BLOOD) { if (projectile[atwith].range == 0) projectile[atwith].range = 1024; - if( FindDistance2D(sx-hitx,sy-hity) < projectile[atwith].range ) + if ( FindDistance2D(sx-hitx,sy-hity) < projectile[atwith].range ) if (FindDistance2D(wall[hitwall].x-wall[wall[hitwall].point2].x,wall[hitwall].y-wall[wall[hitwall].point2].y) > (mulscale(projectile[atwith].xrepeat+8,tilesizx[projectile[atwith].decal],3))) - if( hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE ) - if( ( wall[hitwall].nextsector >= 0 && hitsect >= 0 && + if ( hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE ) + if ( ( wall[hitwall].nextsector >= 0 && hitsect >= 0 && sector[wall[hitwall].nextsector].lotag == 0 && sector[hitsect].lotag == 0 && sector[wall[hitwall].nextsector].lotag == 0 && (sector[hitsect].floorz-sector[wall[hitwall].nextsector].floorz) > (mulscale(projectile[atwith].yrepeat,tilesizy[projectile[atwith].decal],3)<<8) ) || ( wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0 ) ) - if( (wall[hitwall].cstat&16) == 0) + if ( (wall[hitwall].cstat&16) == 0) { - if(wall[hitwall].nextsector >= 0) + if (wall[hitwall].nextsector >= 0) { k = headspritesect[wall[hitwall].nextsector]; - while(k >= 0) + while (k >= 0) { - if(sprite[k].statnum == 3 && sprite[k].lotag == 13) + if (sprite[k].statnum == 3 && sprite[k].lotag == 13) return -1; k = nextspritesect[k]; } } - if( wall[hitwall].nextwall >= 0 && + if ( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) return -1; - if(wall[hitwall].hitag == 0) + if (wall[hitwall].hitag == 0) { - if(projectile[atwith].decal >= 0) + if (projectile[atwith].decal >= 0) { k = spawn(i,projectile[atwith].decal); /* @@ -495,7 +496,7 @@ short shoot(short i,short atwith) insertspriteq(k); */ - if(!spriteflags[projectile[atwith].decal] & SPRITE_FLAG_DECAL) + if (!spriteflags[projectile[atwith].decal] & SPRITE_FLAG_DECAL) spriteflags[projectile[atwith].decal] |= SPRITE_FLAG_DECAL; k = spawn(i,projectile[atwith].decal); @@ -505,7 +506,7 @@ short shoot(short i,short atwith) sprite[k].x = hitx; sprite[k].y = hity; sprite[k].z = hitz; - if(projectile[atwith].workslike & PROJECTILE_FLAG_RANDDECALSIZE) + if (projectile[atwith].workslike & PROJECTILE_FLAG_RANDDECALSIZE) { wh = (TRAND&projectile[atwith].xrepeat); if (wh < projectile[atwith].yrepeat) @@ -547,25 +548,25 @@ short shoot(short i,short atwith) return -1; } - if(hitsect < 0) return -1; + if (hitsect < 0) return -1; if ((projectile[atwith].range == 0) && (projectile[atwith].workslike & PROJECTILE_FLAG_KNEE)) projectile[atwith].range = 1024; - if( (projectile[atwith].range > 0) && (( klabs(sx-hitx)+klabs(sy-hity) ) > projectile[atwith].range) ) + if ( (projectile[atwith].range > 0) && (( klabs(sx-hitx)+klabs(sy-hity) ) > projectile[atwith].range) ) return -1; else { - if(hitwall >= 0 || hitspr >= 0) + if (hitwall >= 0 || hitspr >= 0) { j = EGS(hitsect,hitx,hity,hitz,atwith,-15,0,0,sa,32,0,i,4); thisprojectile[j].workslike = projectile[sprite[j].picnum].workslike; sprite[j].extra = projectile[atwith].extra; - if(projectile[atwith].extra_rand > 0) + if (projectile[atwith].extra_rand > 0) sprite[j].extra += (TRAND&projectile[atwith].extra_rand); - if(p >= 0) + if (p >= 0) { - if(projectile[atwith].spawns >= 0) + if (projectile[atwith].spawns >= 0) { k = spawn(j,projectile[atwith].spawns); sprite[k].z -= (8<<8); @@ -579,27 +580,27 @@ short shoot(short i,short atwith) if ( p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400 ) sprite[j].extra += (max_player_health>>2); - if( hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2 ) + if ( hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2 ) { checkhitsprite(hitspr,j); - if(p >= 0) checkhitswitch(p,hitspr,1); + if (p >= 0) checkhitswitch(p,hitspr,1); } - else if( hitwall >= 0 ) + else if ( hitwall >= 0 ) { - if( wall[hitwall].cstat&2 ) - if(wall[hitwall].nextsector >= 0) - if(hitz >= (sector[wall[hitwall].nextsector].floorz) ) + if ( wall[hitwall].cstat&2 ) + if (wall[hitwall].nextsector >= 0) + if (hitz >= (sector[wall[hitwall].nextsector].floorz) ) hitwall = wall[hitwall].nextwall; - if( hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2 ) + if ( hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2 ) { checkhitwall(j,hitwall,hitx,hity,hitz,atwith); - if(p >= 0) checkhitswitch(p,hitwall,0); + if (p >= 0) checkhitswitch(p,hitwall,0); } } } - else if(p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) + else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) { j = spawn(ps[p].i,WATERSPLASH2); sprite[j].x = hitx; @@ -614,11 +615,11 @@ short shoot(short i,short atwith) return -1; } - if(projectile[atwith].workslike & PROJECTILE_FLAG_HITSCAN) + if (projectile[atwith].workslike & PROJECTILE_FLAG_HITSCAN) { - if( s->extra >= 0 ) s->shade = projectile[atwith].shade; + if ( s->extra >= 0 ) s->shade = projectile[atwith].shade; - if(p >= 0) + if (p >= 0) { int angRange; int zRange; @@ -626,11 +627,11 @@ short shoot(short i,short atwith) SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); j=-1; - if( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) + if ( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) { j = aim( s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); } - if(j >= 0) + if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); if (((sprite[j].picnum >= GREENSLIME)&&(sprite[j].picnum <= GREENSLIME+7))||(sprite[j].picnum ==ROTATEGUN) ) @@ -651,7 +652,7 @@ short shoot(short i,short atwith) zRange=GetGameVarID(g_iZRangeVarID,i,p); sa += (angRange/2)-(TRAND&(angRange-1)); - if(j == -1) + if (j == -1) { // no target zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; @@ -664,7 +665,7 @@ short shoot(short i,short atwith) j = findplayer(s,&x); sz -= (4<<8); zvel = ( (ps[j].posz-sz) <<8 ) / (ldist(&sprite[ps[j].i], s ) ); - if(s->picnum != BOSS1) + if (s->picnum != BOSS1) { zvel += 128-(TRAND&255); sa += 32-(TRAND&63); @@ -689,20 +690,20 @@ short shoot(short i,short atwith) if (projectile[atwith].cstat >= 0) s->cstat |= projectile[atwith].cstat; else s->cstat |= 257; - if(hitsect < 0) return -1; + if (hitsect < 0) return -1; - if( (projectile[atwith].range > 0) && (( klabs(sx-hitx)+klabs(sy-hity) ) > projectile[atwith].range) ) return -1; + if ( (projectile[atwith].range > 0) && (( klabs(sx-hitx)+klabs(sy-hity) ) > projectile[atwith].range) ) return -1; if (projectile[atwith].trail > -1) hitscantrail(sx,sy,sz,hitx,hity,hitz,sa,atwith); if (projectile[atwith].workslike & PROJECTILE_FLAG_WATERBUBBLES) { - if( (TRAND&15) == 0 && sector[hitsect].lotag == 2 ) + if ( (TRAND&15) == 0 && sector[hitsect].lotag == 2 ) tracers(hitx,hity,hitz,sx,sy,sz,8-(ud.multimode>>1)); } - if(p >= 0) + if (p >= 0) { k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,10,10,sa,0,0,i,4); sprite[k].extra = projectile[atwith].extra; @@ -711,14 +712,14 @@ short shoot(short i,short atwith) hittype[k].temp_data[7] = hitsect; hittype[k].temp_data[8] = hitspr; - if(projectile[atwith].extra_rand > 0) + if (projectile[atwith].extra_rand > 0) sprite[k].extra += (TRAND%projectile[atwith].extra_rand); - if( hitwall == -1 && hitspr == -1) + if ( hitwall == -1 && hitspr == -1) { - if( zvel < 0 ) + if ( zvel < 0 ) { - if( sector[hitsect].ceilingstat&1 ) + if ( sector[hitsect].ceilingstat&1 ) { sprite[k].xrepeat = 0; sprite[k].yrepeat = 0; @@ -738,10 +739,10 @@ short shoot(short i,short atwith) } } - if(hitspr >= 0) + if (hitspr >= 0) { checkhitsprite(hitspr,k); - if( sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team))) + if ( sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team))) { l = spawn(k,JIBS6); sprite[k].xrepeat = sprite[k].yrepeat = 0; @@ -761,7 +762,7 @@ short shoot(short i,short atwith) hittype[wh].temp_data[8] = hitspr; } } - if(p >= 0 && ( + if (p >= 0 && ( sprite[hitspr].picnum == DIPSWITCH || sprite[hitspr].picnum == DIPSWITCH+1 || sprite[hitspr].picnum == DIPSWITCH2 || @@ -775,7 +776,7 @@ short shoot(short i,short atwith) return -1; } } - else if( hitwall >= 0 ) + else if ( hitwall >= 0 ) { if (projectile[atwith].spawns >= 0) { @@ -786,9 +787,9 @@ short shoot(short i,short atwith) hittype[wh].temp_data[7] = hitsect; hittype[wh].temp_data[8] = hitspr; } - if( isadoorwall(wall[hitwall].picnum) == 1 ) + if ( isadoorwall(wall[hitwall].picnum) == 1 ) goto DOSKIPBULLETHOLE; - if(p >= 0 && ( + if (p >= 0 && ( wall[hitwall].picnum == DIPSWITCH || wall[hitwall].picnum == DIPSWITCH+1 || wall[hitwall].picnum == DIPSWITCH2 || @@ -802,31 +803,31 @@ short shoot(short i,short atwith) return -1; } - if(wall[hitwall].hitag != 0 || ( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) ) + if (wall[hitwall].hitag != 0 || ( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) ) goto DOSKIPBULLETHOLE; - if( hitsect >= 0 && sector[hitsect].lotag == 0 ) - if( wall[hitwall].overpicnum != BIGFORCE ) - if( (wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0 ) || + if ( hitsect >= 0 && sector[hitsect].lotag == 0 ) + if ( wall[hitwall].overpicnum != BIGFORCE ) + if ( (wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0 ) || ( wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0 ) ) - if( (wall[hitwall].cstat&16) == 0) + if ( (wall[hitwall].cstat&16) == 0) { - if(wall[hitwall].nextsector >= 0) + if (wall[hitwall].nextsector >= 0) { l = headspritesect[wall[hitwall].nextsector]; - while(l >= 0) + while (l >= 0) { - if(sprite[l].statnum == 3 && sprite[l].lotag == 13) + if (sprite[l].statnum == 3 && sprite[l].lotag == 13) goto DOSKIPBULLETHOLE; l = nextspritesect[l]; } } l = headspritestat[5]; - while(l >= 0) + while (l >= 0) { - if(sprite[l].picnum == projectile[atwith].decal) - if(dist(&sprite[l],&sprite[k]) < (12+(TRAND&7)) ) + if (sprite[l].picnum == projectile[atwith].decal) + if (dist(&sprite[l],&sprite[k]) < (12+(TRAND&7)) ) goto DOSKIPBULLETHOLE; l = nextspritestat[l]; } @@ -836,7 +837,7 @@ short shoot(short i,short atwith) sprite[l].xvel = -1; sprite[l].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x, wall[hitwall].y-wall[wall[hitwall].point2].y)+512; - if(projectile[atwith].workslike & PROJECTILE_FLAG_RANDDECALSIZE) + if (projectile[atwith].workslike & PROJECTILE_FLAG_RANDDECALSIZE) { wh = (TRAND&projectile[atwith].xrepeat); if (wh < projectile[atwith].yrepeat) @@ -860,9 +861,9 @@ short shoot(short i,short atwith) DOSKIPBULLETHOLE: - if( wall[hitwall].cstat&2 ) - if(wall[hitwall].nextsector >= 0) - if(hitz >= (sector[wall[hitwall].nextsector].floorz) ) + if ( wall[hitwall].cstat&2 ) + if (wall[hitwall].nextsector >= 0) + if (hitz >= (sector[wall[hitwall].nextsector].floorz) ) hitwall = wall[hitwall].nextwall; checkhitwall(k,hitwall,hitx,hity,hitz,atwith); @@ -877,10 +878,10 @@ DOSKIPBULLETHOLE: hittype[k].temp_data[7] = hitsect; hittype[k].temp_data[8] = hitspr; - if( hitspr >= 0 ) + if ( hitspr >= 0 ) { checkhitsprite(hitspr,k); - if( sprite[hitspr].picnum != APLAYER ) + if ( sprite[hitspr].picnum != APLAYER ) { if (projectile[atwith].spawns >= 0) { @@ -894,45 +895,45 @@ DOSKIPBULLETHOLE: } else sprite[k].xrepeat = sprite[k].yrepeat = 0; } - else if( hitwall >= 0 ) + else if ( hitwall >= 0 ) checkhitwall(k,hitwall,hitx,hity,hitz,atwith); } - if( (TRAND&255) < 4 ) + if ( (TRAND&255) < 4 ) if (projectile[atwith].isound >= 0) xyzsound(projectile[atwith].isound,k,hitx,hity,hitz); return -1; } - if(projectile[atwith].workslike & PROJECTILE_FLAG_RPG) + if (projectile[atwith].workslike & PROJECTILE_FLAG_RPG) { /* if(projectile[atwith].workslike & PROJECTILE_FLAG_FREEZEBLAST) sz += (3<<8);*/ - if( s->extra >= 0 ) s->shade = projectile[atwith].shade; + if ( s->extra >= 0 ) s->shade = projectile[atwith].shade; scount = 1; vel = projectile[atwith].vel; j = -1; - if(p >= 0) + if (p >= 0) { // j = aim( s, AUTO_AIM_ANGLE ); // 48 SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); j=-1; - if( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) + if ( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) { j = aim( s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); } - if(j >= 0) + if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); zvel = ( (sprite[j].z-sz-dal)*vel ) / ldist(&sprite[ps[p].i], &sprite[j]); - if( sprite[j].picnum != RECON ) + if ( sprite[j].picnum != RECON ) sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } // else zvel = (100-ps[p].horiz-ps[p].horizoff)*81; @@ -949,14 +950,14 @@ DOSKIPBULLETHOLE: l = ldist(&sprite[ps[j].i],s); zvel = ( (ps[j].oposz-sz)*vel) / l; - if( badguy(s) && (s->hitag&face_player_smart) ) + if ( badguy(s) && (s->hitag&face_player_smart) ) sa = s->ang+(TRAND&31)-16; } } - if( p >= 0 && j >= 0) + if ( p >= 0 && j >= 0) l = j; else l = -1; @@ -974,9 +975,9 @@ DOSKIPBULLETHOLE: sprite[j].yrepeat=projectile[atwith].yrepeat; - if(projectile[atwith].extra_rand > 0) + if (projectile[atwith].extra_rand > 0) sprite[j].extra += (TRAND&projectile[atwith].extra_rand); - if(!(projectile[atwith].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)) + if (!(projectile[atwith].workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS)) sprite[j].yvel = l; else { @@ -1015,21 +1016,21 @@ DOSKIPBULLETHOLE: else { - switch(dynamictostatic[atwith]) + switch (dynamictostatic[atwith]) { case BLOODSPLAT1__STATIC: case BLOODSPLAT2__STATIC: case BLOODSPLAT3__STATIC: case BLOODSPLAT4__STATIC: - if(p >= 0) + if (p >= 0) sa += 64 - (TRAND&127); else sa += 1024 + 64 - (TRAND&127); zvel = 1024-(TRAND&2047); case KNEE__STATIC: - if(atwith == KNEE ) + if (atwith == KNEE ) { - if(p >= 0) + if (p >= 0) { zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; sz += (6<<8); @@ -1050,34 +1051,34 @@ DOSKIPBULLETHOLE: sintable[sa&2047],zvel<<6, &hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); - if( atwith == BLOODSPLAT1 || atwith == BLOODSPLAT2 || atwith == BLOODSPLAT3 || atwith == BLOODSPLAT4 ) + if ( atwith == BLOODSPLAT1 || atwith == BLOODSPLAT2 || atwith == BLOODSPLAT3 || atwith == BLOODSPLAT4 ) { - if( FindDistance2D(sx-hitx,sy-hity) < 1024 ) - if( hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE ) - if( ( wall[hitwall].nextsector >= 0 && hitsect >= 0 && + if ( FindDistance2D(sx-hitx,sy-hity) < 1024 ) + if ( hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE ) + if ( ( wall[hitwall].nextsector >= 0 && hitsect >= 0 && sector[wall[hitwall].nextsector].lotag == 0 && sector[hitsect].lotag == 0 && sector[wall[hitwall].nextsector].lotag == 0 && (sector[hitsect].floorz-sector[wall[hitwall].nextsector].floorz) > (16<<8) ) || ( wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0 ) ) - if( (wall[hitwall].cstat&16) == 0) + if ( (wall[hitwall].cstat&16) == 0) { - if(wall[hitwall].nextsector >= 0) + if (wall[hitwall].nextsector >= 0) { k = headspritesect[wall[hitwall].nextsector]; - while(k >= 0) + while (k >= 0) { - if(sprite[k].statnum == 3 && sprite[k].lotag == 13) + if (sprite[k].statnum == 3 && sprite[k].lotag == 13) return -1; k = nextspritesect[k]; } } - if( wall[hitwall].nextwall >= 0 && + if ( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) return -1; - if(wall[hitwall].hitag == 0) + if (wall[hitwall].hitag == 0) { k = spawn(i,atwith); sprite[k].xvel = -12; @@ -1089,22 +1090,22 @@ DOSKIPBULLETHOLE: sprite[k].cstat |= (TRAND&4); ssp(k,CLIPMASK0); setsprite(k,sprite[k].x,sprite[k].y,sprite[k].z); - if( PN == OOZFILTER || PN == NEWBEAST ) + if ( PN == OOZFILTER || PN == NEWBEAST ) sprite[k].pal = 6; } } return -1; } - if(hitsect < 0) break; + if (hitsect < 0) break; - if( ( klabs(sx-hitx)+klabs(sy-hity) ) < 1024 ) + if ( ( klabs(sx-hitx)+klabs(sy-hity) ) < 1024 ) { - if(hitwall >= 0 || hitspr >= 0) + if (hitwall >= 0 || hitspr >= 0) { j = EGS(hitsect,hitx,hity,hitz,KNEE,-15,0,0,sa,32,0,i,4); sprite[j].extra += (TRAND&7); - if(p >= 0) + if (p >= 0) { k = spawn(j,SMALLSMOKE); sprite[k].z -= (8<<8); @@ -1117,27 +1118,27 @@ DOSKIPBULLETHOLE: if ( p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400 ) sprite[j].extra += (max_player_health>>2); - if( hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2 ) + if ( hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2 ) { checkhitsprite(hitspr,j); - if(p >= 0) checkhitswitch(p,hitspr,1); + if (p >= 0) checkhitswitch(p,hitspr,1); } - else if( hitwall >= 0 ) + else if ( hitwall >= 0 ) { - if( wall[hitwall].cstat&2 ) - if(wall[hitwall].nextsector >= 0) - if(hitz >= (sector[wall[hitwall].nextsector].floorz) ) + if ( wall[hitwall].cstat&2 ) + if (wall[hitwall].nextsector >= 0) + if (hitz >= (sector[wall[hitwall].nextsector].floorz) ) hitwall = wall[hitwall].nextwall; - if( hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2 ) + if ( hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2 ) { checkhitwall(j,hitwall,hitx,hity,hitz,atwith); - if(p >= 0) checkhitswitch(p,hitwall,0); + if (p >= 0) checkhitswitch(p,hitwall,0); } } } - else if(p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) + else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) { j = spawn(ps[p].i,WATERSPLASH2); sprite[j].x = hitx; @@ -1156,9 +1157,9 @@ DOSKIPBULLETHOLE: case SHOTGUN__STATIC: case CHAINGUN__STATIC: - if( s->extra >= 0 ) s->shade = -96; + if ( s->extra >= 0 ) s->shade = -96; - if(p >= 0) + if (p >= 0) { int angRange; int zRange; @@ -1166,11 +1167,11 @@ DOSKIPBULLETHOLE: SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); j=-1; - if( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) + if ( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) { j = aim( s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); } - if(j >= 0) + if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); if (((sprite[j].picnum>=GREENSLIME)&&(sprite[j].picnum<=GREENSLIME+7))||(sprite[j].picnum==ROTATEGUN)) { @@ -1191,7 +1192,7 @@ DOSKIPBULLETHOLE: zRange=GetGameVarID(g_iZRangeVarID,i,p); sa += (angRange/2)-(TRAND&(angRange-1)); - if(j == -1) + if (j == -1) { // no target zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; @@ -1204,7 +1205,7 @@ DOSKIPBULLETHOLE: j = findplayer(s,&x); sz -= (4<<8); zvel = ( (ps[j].posz-sz) <<8 ) / (ldist(&sprite[ps[j].i], s ) ); - if(s->picnum != BOSS1) + if (s->picnum != BOSS1) { zvel += 128-(TRAND&255); sa += 32-(TRAND&63); @@ -1224,12 +1225,12 @@ DOSKIPBULLETHOLE: zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); s->cstat |= 257; - if(hitsect < 0) return -1; + if (hitsect < 0) return -1; - if( (TRAND&15) == 0 && sector[hitsect].lotag == 2 ) + if ( (TRAND&15) == 0 && sector[hitsect].lotag == 2 ) tracers(hitx,hity,hitz,sx,sy,sz,8-(ud.multimode>>1)); - if(p >= 0) + if (p >= 0) { k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,10,10,sa,0,0,i,4); sprite[k].extra = *actorscrptr[atwith]; @@ -1240,11 +1241,11 @@ DOSKIPBULLETHOLE: hittype[k].temp_data[8] = hitspr; - if( hitwall == -1 && hitspr == -1) + if ( hitwall == -1 && hitspr == -1) { - if( zvel < 0 ) + if ( zvel < 0 ) { - if( sector[hitsect].ceilingstat&1 ) + if ( sector[hitsect].ceilingstat&1 ) { sprite[k].xrepeat = 0; sprite[k].yrepeat = 0; @@ -1259,10 +1260,10 @@ DOSKIPBULLETHOLE: hittype[l].temp_data[8] = hitspr; } - if(hitspr >= 0) + if (hitspr >= 0) { checkhitsprite(hitspr,k); - if( sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team))) + if ( sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team))) { l = spawn(k,JIBS6); sprite[k].xrepeat = sprite[k].yrepeat = 0; @@ -1271,7 +1272,7 @@ DOSKIPBULLETHOLE: sprite[l].xrepeat = sprite[l].yrepeat = 24; sprite[l].ang += 64-(TRAND&127); } - else + else { l = spawn(k,SMALLSMOKE); hittype[l].temp_data[6] = hitwall; @@ -1279,7 +1280,7 @@ DOSKIPBULLETHOLE: hittype[l].temp_data[8] = hitspr; } - if(p >= 0 && ( + if (p >= 0 && ( sprite[hitspr].picnum == DIPSWITCH || sprite[hitspr].picnum == DIPSWITCH+1 || sprite[hitspr].picnum == DIPSWITCH2 || @@ -1293,16 +1294,16 @@ DOSKIPBULLETHOLE: return -1; } } - else if( hitwall >= 0 ) + else if ( hitwall >= 0 ) { l = spawn(k,SMALLSMOKE); hittype[l].temp_data[6] = hitwall; hittype[l].temp_data[7] = hitsect; hittype[l].temp_data[8] = hitspr; - if( isadoorwall(wall[hitwall].picnum) == 1 ) + if ( isadoorwall(wall[hitwall].picnum) == 1 ) goto SKIPBULLETHOLE; - if(p >= 0 && ( + if (p >= 0 && ( wall[hitwall].picnum == DIPSWITCH || wall[hitwall].picnum == DIPSWITCH+1 || wall[hitwall].picnum == DIPSWITCH2 || @@ -1316,31 +1317,31 @@ DOSKIPBULLETHOLE: return -1; } - if(wall[hitwall].hitag != 0 || ( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) ) + if (wall[hitwall].hitag != 0 || ( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) ) goto SKIPBULLETHOLE; - if( hitsect >= 0 && sector[hitsect].lotag == 0 ) - if( wall[hitwall].overpicnum != BIGFORCE ) - if( (wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0 ) || + if ( hitsect >= 0 && sector[hitsect].lotag == 0 ) + if ( wall[hitwall].overpicnum != BIGFORCE ) + if ( (wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0 ) || ( wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0 ) ) - if( (wall[hitwall].cstat&16) == 0) + if ( (wall[hitwall].cstat&16) == 0) { - if(wall[hitwall].nextsector >= 0) + if (wall[hitwall].nextsector >= 0) { l = headspritesect[wall[hitwall].nextsector]; - while(l >= 0) + while (l >= 0) { - if(sprite[l].statnum == 3 && sprite[l].lotag == 13) + if (sprite[l].statnum == 3 && sprite[l].lotag == 13) goto SKIPBULLETHOLE; l = nextspritesect[l]; } } l = headspritestat[5]; - while(l >= 0) + while (l >= 0) { - if(sprite[l].picnum == BULLETHOLE) - if(dist(&sprite[l],&sprite[k]) < (12+(TRAND&7)) ) + if (sprite[l].picnum == BULLETHOLE) + if (dist(&sprite[l],&sprite[k]) < (12+(TRAND&7)) ) goto SKIPBULLETHOLE; l = nextspritestat[l]; } @@ -1360,9 +1361,9 @@ DOSKIPBULLETHOLE: SKIPBULLETHOLE: - if( wall[hitwall].cstat&2 ) - if(wall[hitwall].nextsector >= 0) - if(hitz >= (sector[wall[hitwall].nextsector].floorz) ) + if ( wall[hitwall].cstat&2 ) + if (wall[hitwall].nextsector >= 0) + if (hitz >= (sector[wall[hitwall].nextsector].floorz) ) hitwall = wall[hitwall].nextwall; checkhitwall(k,hitwall,hitx,hity,hitz,SHOTSPARK1); @@ -1377,10 +1378,10 @@ SKIPBULLETHOLE: hittype[k].temp_data[7] = hitsect; hittype[k].temp_data[8] = hitspr; - if( hitspr >= 0 ) + if ( hitspr >= 0 ) { checkhitsprite(hitspr,k); - if( sprite[hitspr].picnum != APLAYER ) + if ( sprite[hitspr].picnum != APLAYER ) { l = spawn(k,SMALLSMOKE); hittype[l].temp_data[6] = hitwall; @@ -1389,11 +1390,11 @@ SKIPBULLETHOLE: } else sprite[k].xrepeat = sprite[k].yrepeat = 0; } - else if( hitwall >= 0 ) + else if ( hitwall >= 0 ) checkhitwall(k,hitwall,hitx,hity,hitz,SHOTSPARK1); } - if( (TRAND&255) < 4 ) + if ( (TRAND&255) < 4 ) xyzsound(PISTOL_RICOCHET,k,hitx,hity,hitz); return -1; @@ -1402,15 +1403,15 @@ SKIPBULLETHOLE: case SPIT__STATIC: case COOLEXPLOSION1__STATIC: - if( s->extra >= 0 ) s->shade = -96; + if ( s->extra >= 0 ) s->shade = -96; scount = 1; - if(atwith == SPIT) vel = 292; + if (atwith == SPIT) vel = 292; else { - if(atwith == COOLEXPLOSION1) + if (atwith == COOLEXPLOSION1) { - if(s->picnum == BOSS2) vel = 644; + if (s->picnum == BOSS2) vel = 644; else vel = 348; sz -= (4<<7); } @@ -1421,18 +1422,18 @@ SKIPBULLETHOLE: } } - if(p >= 0) + if (p >= 0) { // j = aim( s, AUTO_AIM_ANGLE ); SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); j=-1; - if( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) + if ( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) { j = aim( s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); } - if(j >= 0) + if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)-(12<<8); zvel = ((sprite[j].z-sz-dal)*vel ) / ldist(&sprite[ps[p].i], &sprite[j]) ; @@ -1451,12 +1452,12 @@ SKIPBULLETHOLE: if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; oldzvel = zvel; - if(atwith == SPIT) { sizx = 18;sizy = 18,sz -= (10<<8); } + if (atwith == SPIT) { sizx = 18;sizy = 18,sz -= (10<<8); } else { - if( atwith == FIRELASER ) + if ( atwith == FIRELASER ) { - if(p >= 0) + if (p >= 0) { sizx = 34; @@ -1475,17 +1476,17 @@ SKIPBULLETHOLE: } } - if(p >= 0) sizx = 7,sizy = 7; + if (p >= 0) sizx = 7,sizy = 7; - while(scount > 0) + while (scount > 0) { j = EGS(sect,sx,sy,sz,atwith,-127,sizx,sizy,sa,vel,zvel,i,4); sprite[j].extra += (TRAND&7); - if(atwith == COOLEXPLOSION1) + if (atwith == COOLEXPLOSION1) { sprite[j].shade = 0; - if(PN == BOSS2) + if (PN == BOSS2) { l = sprite[j].xvel; sprite[j].xvel = 1024; @@ -1510,33 +1511,33 @@ SKIPBULLETHOLE: sz += (3<<8); case RPG__STATIC: - if( s->extra >= 0 ) s->shade = -96; + if ( s->extra >= 0 ) s->shade = -96; scount = 1; vel = 644; j = -1; - if(p >= 0) + if (p >= 0) { // j = aim( s, AUTO_AIM_ANGLE ); // 48 SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); j=-1; - if( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) + if ( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) { j = aim( s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); } - if(j >= 0) + if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); zvel = ( (sprite[j].z-sz-dal)*vel ) / ldist(&sprite[ps[p].i], &sprite[j]); - if( sprite[j].picnum != RECON ) + if ( sprite[j].picnum != RECON ) sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } else zvel = (100-ps[p].horiz-ps[p].horizoff)*81; - if(atwith == RPG) + if (atwith == RPG) spritesound(RPG_SHOOT,i); } @@ -1544,9 +1545,9 @@ SKIPBULLETHOLE: { j = findplayer(s,&x); sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); - if(PN == BOSS3) + if (PN == BOSS3) sz -= (32<<8); - else if(PN == BOSS2) + else if (PN == BOSS2) { vel += 128; sz += 24<<8; @@ -1555,11 +1556,11 @@ SKIPBULLETHOLE: l = ldist(&sprite[ps[j].i],s); zvel = ( (ps[j].oposz-sz)*vel) / l; - if( badguy(s) && (s->hitag&face_player_smart) ) + if ( badguy(s) && (s->hitag&face_player_smart) ) sa = s->ang+(TRAND&31)-16; } - if( p >= 0 && j >= 0) + if ( p >= 0 && j >= 0) l = j; else l = -1; if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; @@ -1569,7 +1570,7 @@ SKIPBULLETHOLE: sz-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4); sprite[j].extra += (TRAND&7); - if(atwith != FREEZEBLAST) + if (atwith != FREEZEBLAST) sprite[j].yvel = l; else { @@ -1579,11 +1580,11 @@ SKIPBULLETHOLE: sprite[j].zvel -= (2<<4); } - if(p == -1) + if (p == -1) { - if(PN == BOSS3) + if (PN == BOSS3) { - if(TRAND&1) + if (TRAND&1) { sprite[j].x -= sintable[sa&2047]>>6; sprite[j].y -= sintable[(sa+1024+512)&2047]>>6; @@ -1598,7 +1599,7 @@ SKIPBULLETHOLE: sprite[j].xrepeat = 42; sprite[j].yrepeat = 42; } - else if(PN == BOSS2) + else if (PN == BOSS2) { sprite[j].x -= sintable[sa&2047]/56; sprite[j].y -= sintable[(sa+1024+512)&2047]/56; @@ -1606,7 +1607,7 @@ SKIPBULLETHOLE: sprite[j].xrepeat = 24; sprite[j].yrepeat = 24; } - else if(atwith != FREEZEBLAST) + else if (atwith != FREEZEBLAST) { sprite[j].xrepeat = 30; sprite[j].yrepeat = 30; @@ -1614,13 +1615,13 @@ SKIPBULLETHOLE: } } - else if(*aplWeaponWorksLike[ps[p].curr_weapon] == DEVISTATOR_WEAPON) + else if (*aplWeaponWorksLike[ps[p].curr_weapon] == DEVISTATOR_WEAPON) { sprite[j].extra >>= 2; sprite[j].ang += 16-(TRAND&31); sprite[j].zvel += 256-(TRAND&511); - if( ps[p].hbomb_hold_delay ) + if ( ps[p].hbomb_hold_delay ) { sprite[j].x -= sintable[sa&2047]/644; sprite[j].y -= sintable[(sa+1024+512)&2047]/644; @@ -1635,7 +1636,7 @@ SKIPBULLETHOLE: } sprite[j].cstat = 128; - if(atwith == RPG) + if (atwith == RPG) sprite[j].clipdist = 4; else sprite[j].clipdist = 40; @@ -1644,7 +1645,7 @@ SKIPBULLETHOLE: case HANDHOLDINGLASER__STATIC: - if(p >= 0) + if (p >= 0) zvel = (100-ps[p].horiz-ps[p].horizoff)*32; else zvel = 0; if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; @@ -1654,25 +1655,25 @@ SKIPBULLETHOLE: zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); j = 0; - if(hitspr >= 0) break; + if (hitspr >= 0) break; - if(hitwall >= 0 && hitsect >= 0) - if( ((hitx-sx)*(hitx-sx)+(hity-sy)*(hity-sy)) < (290*290) ) + if (hitwall >= 0 && hitsect >= 0) + if ( ((hitx-sx)*(hitx-sx)+(hity-sy)*(hity-sy)) < (290*290) ) { - if( wall[hitwall].nextsector >= 0) + if ( wall[hitwall].nextsector >= 0) { - if( sector[wall[hitwall].nextsector].lotag <= 2 && sector[hitsect].lotag <= 2 ) + if ( sector[wall[hitwall].nextsector].lotag <= 2 && sector[hitsect].lotag <= 2 ) j = 1; } - else if( sector[hitsect].lotag <= 2 ) + else if ( sector[hitsect].lotag <= 2 ) j = 1; } - if(j == 1) + if (j == 1) { long lTripBombControl=GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, ps[p].i, p); k = EGS(hitsect,hitx,hity,hitz,TRIPBOMB,-16,4,5,sa,0,0,i,6); - if(lTripBombControl & TRIPBOMB_TIMER) + if (lTripBombControl & TRIPBOMB_TIMER) { long lLifetime=GetGameVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, ps[p].i, p); long lLifetimeVar=GetGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, ps[p].i, p); @@ -1698,14 +1699,14 @@ SKIPBULLETHOLE: case BOUNCEMINE__STATIC: case MORTER__STATIC: - if( s->extra >= 0 ) s->shade = -96; + if ( s->extra >= 0 ) s->shade = -96; j = ps[findplayer(s,&x)].i; x = ldist(&sprite[j],s); zvel = -x>>1; - if(zvel < -4096) + if (zvel < -4096) zvel = -2048; vel = x>>4; if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; @@ -1717,18 +1718,18 @@ SKIPBULLETHOLE: case GROWSPARK__STATIC: - if(p >= 0) + if (p >= 0) { // j = aim( s, AUTO_AIM_ANGLE ); SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); j=-1; - if( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) + if ( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) { j = aim( s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); } - if(j >= 0) + if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(5<<8); if (((sprite[j].picnum >= GREENSLIME)&&(sprite[j].picnum <= GREENSLIME+7))||(sprite[j].picnum ==ROTATEGUN) ) { @@ -1775,13 +1776,13 @@ SKIPBULLETHOLE: sprite[j].cstat |= 130; sprite[j].xrepeat = sprite[j].yrepeat = 1; - if( hitwall == -1 && hitspr == -1 && hitsect >= 0) + if ( hitwall == -1 && hitspr == -1 && hitsect >= 0) { - if( zvel < 0 && (sector[hitsect].ceilingstat&1) == 0) + if ( zvel < 0 && (sector[hitsect].ceilingstat&1) == 0) checkhitceiling(hitsect); } - else if(hitspr >= 0) checkhitsprite(hitspr,j); - else if(hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2 ) + else if (hitspr >= 0) checkhitsprite(hitspr,j); + else if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2 ) { /* if(wall[hitwall].overpicnum == MIRROR && k == 0) { @@ -1807,19 +1808,19 @@ SKIPBULLETHOLE: break; case SHRINKER__STATIC: - if( s->extra >= 0 ) s->shade = -96; - if(p >= 0) + if ( s->extra >= 0 ) s->shade = -96; + if (p >= 0) { // j = aim( s, AUTO_AIM_ANGLE ); SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); j=-1; - if( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) + if ( GetGameVarID(g_iAimAngleVarID,i,p) > 0 ) { j = aim( s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); } - if(j >= 0) + if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1); zvel = ( (sprite[j].z-sz-dal-(4<<8))*768) / (ldist( &sprite[ps[p].i], &sprite[j])); @@ -1827,7 +1828,7 @@ SKIPBULLETHOLE: } else zvel = (100-ps[p].horiz-ps[p].horizoff)*98; } - else if(s->statnum != 3) + else if (s->statnum != 3) { j = findplayer(s,&x); l = ldist(&sprite[ps[j].i],s); @@ -1854,10 +1855,10 @@ void displayloogie(short snum) { long i, a, x, y, z; - if(ps[snum].loogcnt == 0) return; + if (ps[snum].loogcnt == 0) return; y = (ps[snum].loogcnt<<2); - for(i=0;i>5; z = 4096+((ps[snum].loogcnt+i)<<9); @@ -1875,19 +1876,19 @@ char animatefist(short gs,short snum) long fistzoom, fistz; fisti = ps[snum].fist_incs; - if(fisti > 32) fisti = 32; - if(fisti <= 0) return 0; + if (fisti > 32) fisti = 32; + if (fisti <= 0) return 0; looking_arc = klabs(ps[snum].look_ang)/9; fistzoom = 65536L - (sintable[(512+(fisti<<6))&2047]<<2); - if(fistzoom > 90612L) + if (fistzoom > 90612L) fistzoom = 90612L; - if(fistzoom < 40920) + if (fistzoom < 40920) fistzoom = 40290; fistz = 194 + (sintable[((6+fisti)<<7)&2047]>>9); - if(sprite[ps[snum].i].pal == 1) + if (sprite[ps[snum].i].pal == 1) fistpal = 1; else fistpal = sector[ps[snum].cursectnum].floorpal; @@ -1905,18 +1906,18 @@ char animateknee(short gs,short snum) short knee_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8}; short looking_arc, pal; - if(ps[snum].knee_incs > 11 || ps[snum].knee_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; + if (ps[snum].knee_incs > 11 || ps[snum].knee_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; looking_arc = knee_y[ps[snum].knee_incs] + klabs(ps[snum].look_ang)/9; looking_arc -= (ps[snum].hard_landing<<3); - if(sprite[ps[snum].i].pal == 1) + if (sprite[ps[snum].i].pal == 1) pal = 1; else { pal = sector[ps[snum].cursectnum].floorpal; - if(pal == 0) + if (pal == 0) pal = ps[snum].palookup; } @@ -1930,13 +1931,13 @@ char animateknuckles(short gs,short snum) short knuckle_frames[] = {0,1,2,2,3,3,3,2,2,1,0}; short looking_arc, pal; - if(ps[snum].knuckle_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; + if (ps[snum].knuckle_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; looking_arc = klabs(ps[snum].look_ang)/9; looking_arc -= (ps[snum].hard_landing<<3); - if(sprite[ps[snum].i].pal == 1) + if (sprite[ps[snum].i].pal == 1) pal = 1; else pal = sector[ps[snum].cursectnum].floorpal; @@ -1957,14 +1958,14 @@ void DoFire(struct player_struct *p) SetGameVarID(g_iReturnVarID,0,p->i,snum); OnEvent(EVENT_DOFIRE, p->i, snum, -1); - if(GetGameVarID(g_iReturnVarID,p->i,snum) == 0) + if (GetGameVarID(g_iReturnVarID,p->i,snum) == 0) { if (p->weapon_pos != 0) return; - if(aplWeaponWorksLike[p->curr_weapon][snum]!=KNEE_WEAPON) + if (aplWeaponWorksLike[p->curr_weapon][snum]!=KNEE_WEAPON) p->ammo_amount[p->curr_weapon]--; - if(aplWeaponFireSound[p->curr_weapon][snum]) + if (aplWeaponFireSound[p->curr_weapon][snum]) { spritesound(aplWeaponFireSound[p->curr_weapon][snum],p->i); } @@ -1972,11 +1973,11 @@ void DoFire(struct player_struct *p) SetGameVarID(g_iWeaponVarID,p->curr_weapon,p->i,snum); SetGameVarID(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum); 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_FLAG_AMMOPERSHOT) + if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AMMOPERSHOT) { - if(p->ammo_amount[p->curr_weapon] > 0) + if (p->ammo_amount[p->curr_weapon] > 0) { p->ammo_amount[p->curr_weapon]--; shoot(p->i,aplWeaponShoots[p->curr_weapon][snum]); @@ -1986,7 +1987,7 @@ void DoFire(struct player_struct *p) shoot(p->i,aplWeaponShoots[p->curr_weapon][snum]); } - if(! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE )) + if (! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE )) { lastvisinc = totalclock+32; p->visibility = 0; @@ -2009,12 +2010,12 @@ void DoSpawn(struct player_struct *p) short snum = sprite[p->i].yvel; - if(!aplWeaponSpawn[p->curr_weapon][snum]) + if (!aplWeaponSpawn[p->curr_weapon][snum]) return; j = spawn(p->i, aplWeaponSpawn[p->curr_weapon][snum]); - if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE3 ) ) + if ((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE3 ) ) { // like chaingun shells sprite[j].ang += 1024; @@ -2031,12 +2032,12 @@ void displaymasks(short snum) { short p; - if(sprite[ps[snum].i].pal == 1) + if (sprite[ps[snum].i].pal == 1) p = 1; else p = sector[ps[snum].cursectnum].floorpal; - if(ps[snum].scuba_on) + if (ps[snum].scuba_on) { rotatesprite(43<<16,(200-tilesizy[SCUBAMASK])<<16,65536,0,SCUBAMASK,0,p,2+16,windowx1,windowy1,windowx2,windowy2); rotatesprite((320-43)<<16,(200-tilesizy[SCUBAMASK])<<16,65536,1024,SCUBAMASK,0,p,2+4+16,windowx1,windowy1,windowx2,windowy2); @@ -2048,12 +2049,12 @@ char animatetip(short gs,short snum) short p,looking_arc; short tip_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16}; - if(ps[snum].tipincs == 0) return 0; + if (ps[snum].tipincs == 0) return 0; looking_arc = klabs(ps[snum].look_ang)/9; looking_arc -= (ps[snum].hard_landing<<3); - if(sprite[ps[snum].i].pal == 1) + if (sprite[ps[snum].i].pal == 1) p = 1; else p = sector[ps[snum].cursectnum].floorpal; @@ -2075,18 +2076,18 @@ char animateaccess(short gs,short snum) short looking_arc; char p; - if(ps[snum].access_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; + if (ps[snum].access_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; looking_arc = access_y[ps[snum].access_incs] + klabs(ps[snum].look_ang)/9; looking_arc -= (ps[snum].hard_landing<<3); - if(ps[snum].access_spritenum >= 0) + if (ps[snum].access_spritenum >= 0) p = sprite[ps[snum].access_spritenum].pal; else p = 0; // else // p = wall[ps[snum].access_wallnum].pal; - if((ps[snum].access_incs-3) > 0 && (ps[snum].access_incs-3)>>3) + if ((ps[snum].access_incs-3) > 0 && (ps[snum].access_incs-3)>>3) myospal(170+(sync[snum].avel>>4)-(ps[snum].look_ang>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].horiz-ps[snum].horizoff)>>4),HANDHOLDINGLASER+(ps[snum].access_incs>>3),gs,0,p); else myospal(170+(sync[snum].avel>>4)-(ps[snum].look_ang>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].horiz-ps[snum].horizoff)>>4),HANDHOLDINGACCESS,gs,4,p); @@ -2096,13 +2097,13 @@ char animateaccess(short gs,short snum) void myospalw(long x, long y, short tilenum, signed char shade, char orientation, char p) { - if(!ud.drawweapon) + if (!ud.drawweapon) return; - else if(ud.drawweapon == 1) + else if (ud.drawweapon == 1) myospal(x,y,tilenum,shade,orientation,p); - else if(ud.drawweapon == 2) + else if (ud.drawweapon == 2) { - switch(g_currentweapon) + switch (g_currentweapon) { case PISTOL_WEAPON: case CHAINGUN_WEAPON: @@ -2142,9 +2143,9 @@ void displayweapon(short snum) looking_arc = klabs(p->look_ang)/9; gs = sprite[p->i].shade; - if(gs > 24) gs = 24; + if (gs > 24) gs = 24; - if(p->newowner >= 0 || ud.camerasprite >= 0 || p->over_shoulder_on > 0 || (sprite[p->i].pal != 1 && sprite[p->i].extra <= 0) || animatefist(gs,snum) || animateknuckles(gs,snum) || animatetip(gs,snum) || animateaccess(gs,snum) ) + if (p->newowner >= 0 || ud.camerasprite >= 0 || p->over_shoulder_on > 0 || (sprite[p->i].pal != 1 && sprite[p->i].extra <= 0) || animatefist(gs,snum) || animateknuckles(gs,snum) || animatetip(gs,snum) || animateaccess(gs,snum) ) return; animateknee(gs,snum); @@ -2154,13 +2155,13 @@ void displayweapon(short snum) weapon_xoffset = (160)-90; weapon_xoffset -= (sintable[((p->weapon_sway>>1)+512)&2047]/(1024+512)); weapon_xoffset -= 58 + p->weapon_ang; - if( sprite[p->i].xrepeat < 32 ) + if ( sprite[p->i].xrepeat < 32 ) gun_pos -= klabs(sintable[(p->weapon_sway<<2)&2047]>>9); else gun_pos -= klabs(sintable[(p->weapon_sway>>1)&2047]>>10); gun_pos -= (p->hard_landing<<3); - if(p->last_weapon >= 0) + if (p->last_weapon >= 0) cw = aplWeaponWorksLike[p->last_weapon][snum]; else cw = aplWeaponWorksLike[p->curr_weapon][snum]; @@ -2176,31 +2177,31 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,p->i,snum); OnEvent(EVENT_DISPLAYWEAPON, p->i, screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,p->i,snum) == 0) + if (GetGameVarID(g_iReturnVarID,p->i,snum) == 0) { j = 14-p->quick_kick; - if(j != 14 || last_quick_kick[snum]) + if (j != 14 || last_quick_kick[snum]) { - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else { pal = sector[p->cursectnum].floorpal; - if(pal == 0) + if (pal == 0) pal = p->palookup; } - if( j < 6 || j > 12 ) + if ( j < 6 || j > 12 ) myospal(weapon_xoffset+80-(p->look_ang>>1), looking_arc+250-gun_pos,KNEE,gs,o|4,pal); else myospal(weapon_xoffset+160-16-(p->look_ang>>1), looking_arc+214-gun_pos,KNEE+1,gs,o|4,pal); } - if( sprite[p->i].xrepeat < 40 ) + if ( sprite[p->i].xrepeat < 40 ) { - if(p->jetpack_on == 0 ) + if (p->jetpack_on == 0 ) { i = sprite[p->i].xvel; looking_arc += 32-(i>>1); @@ -2217,7 +2218,7 @@ void displayweapon(short snum) looking_arc+200+(klabs(sintable[(fistsign)&2047]>>8)), FIST,gs,o|4); } - else switch(cw) + else switch (cw) { @@ -2225,20 +2226,20 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - if( (*kb) > 0 ) + if ( (*kb) > 0 ) { - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else { pal = sector[p->cursectnum].floorpal; - if(pal == 0) + if (pal == 0) pal = p->palookup; } - if( (*kb) < 5 || (*kb) > 9 ) + if ( (*kb) < 5 || (*kb) > 9 ) myospal(weapon_xoffset+220-(p->look_ang>>1), looking_arc+250-gun_pos,KNEE,gs,o,pal); else @@ -2252,9 +2253,9 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else pal = sector[p->cursectnum].floorpal; @@ -2262,9 +2263,9 @@ void displayweapon(short snum) weapon_xoffset += 8; gun_pos -= 10; - if((*kb) > 6) + if ((*kb) > 6) looking_arc += ((*kb)<<3); - else if((*kb) < 4) + else if ((*kb) < 4) myospalw(weapon_xoffset+142-(p->look_ang>>1), looking_arc+234-gun_pos,HANDHOLDINGLASER+3,gs,o,pal); @@ -2281,18 +2282,18 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else pal = sector[p->cursectnum].floorpal; weapon_xoffset -= sintable[(768+((*kb)<<7))&2047]>>11; gun_pos += sintable[(768+((*kb)<<7))&2047]>>11; - if(*kb > 0) + if (*kb > 0) { - if(*kb < 8) + if (*kb < 8) { myospalw(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos, RPGGUN+((*kb)>>1),gs,o,pal); @@ -2308,9 +2309,9 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else pal = sector[p->cursectnum].floorpal; @@ -2318,7 +2319,7 @@ void displayweapon(short snum) weapon_xoffset -= 8; - switch(*kb) + switch (*kb) { case 1: case 2: @@ -2338,7 +2339,7 @@ void displayweapon(short snum) case 10: case 11: case 12: - if( *kb > 1 && *kb < 5 ) + if ( *kb > 1 && *kb < 5 ) { gun_pos -= 40; weapon_xoffset += 20; @@ -2393,38 +2394,38 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else pal = sector[p->cursectnum].floorpal; - if(*kb > 0) + if (*kb > 0) gun_pos -= sintable[(*kb)<<7]>>12; - if(*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1-(rand()&3); + if (*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1-(rand()&3); myospalw(weapon_xoffset+168-(p->look_ang>>1),looking_arc+260-gun_pos, CHAINGUN,gs,o,pal); - switch(*kb) + switch (*kb) { case 0: myospalw(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos, CHAINGUN+1,gs,o,pal); break; default: - if(*kb > *aplWeaponFireDelay[CHAINGUN_WEAPON] && *kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]) + if (*kb > *aplWeaponFireDelay[CHAINGUN_WEAPON] && *kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]) { i = 0; - if(sprite[p->i].pal != 1) i = rand()&7; + if (sprite[p->i].pal != 1) i = rand()&7; myospalw(i+weapon_xoffset-4+140-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos, CHAINGUN+5+((*kb-4)/5),gs,o,pal); - if(sprite[p->i].pal != 1) i = rand()&7; + if (sprite[p->i].pal != 1) i = rand()&7; myospalw(i+weapon_xoffset-4+184-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos, CHAINGUN+5+((*kb-4)/5),gs,o,pal); } - if(*kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]-4) + if (*kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]-4) { i = rand()&7; myospalw(i+weapon_xoffset-4+162-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos, @@ -2443,20 +2444,20 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else pal = sector[p->cursectnum].floorpal; - if( (*kb) < *aplWeaponTotalTime[PISTOL_WEAPON]+1) + if ( (*kb) < *aplWeaponTotalTime[PISTOL_WEAPON]+1) { short kb_frames[] = {0,1,2},l; l = 195-12+weapon_xoffset; - if((*kb) == *aplWeaponFireDelay[PISTOL_WEAPON]) + if ((*kb) == *aplWeaponFireDelay[PISTOL_WEAPON]) l -= 3; myospalw((l-(p->look_ang>>1)),(looking_arc+244-gun_pos),FIRSTGUN+kb_frames[*kb>2?0:*kb],gs,2,pal); @@ -2464,30 +2465,30 @@ void displayweapon(short snum) else { - if((*kb) < *aplWeaponReload[PISTOL_WEAPON]-17) + if ((*kb) < *aplWeaponReload[PISTOL_WEAPON]-17) myospalw(194-(p->look_ang>>1),looking_arc+230-gun_pos,FIRSTGUN+4,gs,o,pal); - else if((*kb) < *aplWeaponReload[PISTOL_WEAPON]-12) + else if ((*kb) < *aplWeaponReload[PISTOL_WEAPON]-12) { myospalw(244-((*kb)<<3)-(p->look_ang>>1),looking_arc+130-gun_pos+((*kb)<<4),FIRSTGUN+6,gs,o,pal); myospalw(224-(p->look_ang>>1),looking_arc+220-gun_pos,FIRSTGUN+5,gs,o,pal); } - else if((*kb) < *aplWeaponReload[PISTOL_WEAPON]-7) + else if ((*kb) < *aplWeaponReload[PISTOL_WEAPON]-7) { myospalw(124+((*kb)<<1)-(p->look_ang>>1),looking_arc+430-gun_pos-((*kb)<<3),FIRSTGUN+6,gs,o,pal); myospalw(224-(p->look_ang>>1),looking_arc+220-gun_pos,FIRSTGUN+5,gs,o,pal); } - else if((*kb) < *aplWeaponReload[PISTOL_WEAPON]-4) + else if ((*kb) < *aplWeaponReload[PISTOL_WEAPON]-4) { myospalw(184-(p->look_ang>>1),looking_arc+235-gun_pos,FIRSTGUN+8,gs,o,pal); myospalw(224-(p->look_ang>>1),looking_arc+210-gun_pos,FIRSTGUN+5,gs,o,pal); } - else if((*kb) < *aplWeaponReload[PISTOL_WEAPON]-2) + else if ((*kb) < *aplWeaponReload[PISTOL_WEAPON]-2) { myospalw(164-(p->look_ang>>1),looking_arc+245-gun_pos,FIRSTGUN+8,gs,o,pal); myospalw(224-(p->look_ang>>1),looking_arc+220-gun_pos,FIRSTGUN+5,gs,o,pal); } - else if((*kb) < *aplWeaponReload[PISTOL_WEAPON]) + else if ((*kb) < *aplWeaponReload[PISTOL_WEAPON]) myospalw(194-(p->look_ang>>1),looking_arc+235-gun_pos,FIRSTGUN+5,gs,o,pal); } @@ -2495,79 +2496,79 @@ void displayweapon(short snum) break; case HANDBOMB_WEAPON: + { + SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (sprite[p->i].pal == 1) + pal = 1; + else + pal = sector[p->cursectnum].floorpal; + + if ((*kb)) { - if(sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - - if((*kb)) + if ((*kb) < (*aplWeaponTotalTime[p->curr_weapon])) { - if((*kb) < (*aplWeaponTotalTime[p->curr_weapon])) - { - char throw_frames[] - = {0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2}; + char throw_frames[] + = {0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2}; - if((*kb) < 7) - gun_pos -= 10*(*kb); //D - else if((*kb) < 12) - gun_pos += 20*((*kb)-10); //U - else if((*kb) < 20) - gun_pos -= 9*((*kb)-14); //D + if ((*kb) < 7) + gun_pos -= 10*(*kb); //D + else if ((*kb) < 12) + gun_pos += 20*((*kb)-10); //U + else if ((*kb) < 20) + gun_pos -= 9*((*kb)-14); //D - myospalw(weapon_xoffset+190-(p->look_ang>>1),looking_arc+250-gun_pos,HANDTHROW+throw_frames[(*kb)],gs,o,pal); - } + myospalw(weapon_xoffset+190-(p->look_ang>>1),looking_arc+250-gun_pos,HANDTHROW+throw_frames[(*kb)],gs,o,pal); } - else - myospalw(weapon_xoffset+190-(p->look_ang>>1),looking_arc+260-gun_pos,HANDTHROW,gs,o,pal); } + else + myospalw(weapon_xoffset+190-(p->look_ang>>1),looking_arc+260-gun_pos,HANDTHROW,gs,o,pal); } - break; + } + break; case HANDREMOTE_WEAPON: + { + SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) - { - signed char remote_frames[] = {0,1,1,2,1,1,0,0,0,0,0}; - if(sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; + signed char remote_frames[] = {0,1,1,2,1,1,0,0,0,0,0}; + if (sprite[p->i].pal == 1) + pal = 1; + else + pal = sector[p->cursectnum].floorpal; - weapon_xoffset = -48; - if((*kb)) - myospalw(weapon_xoffset+150-(p->look_ang>>1),looking_arc+258-gun_pos,HANDREMOTE+remote_frames[(*kb)],gs,o,pal); - else - myospalw(weapon_xoffset+150-(p->look_ang>>1),looking_arc+258-gun_pos,HANDREMOTE,gs,o,pal); - } + weapon_xoffset = -48; + if ((*kb)) + myospalw(weapon_xoffset+150-(p->look_ang>>1),looking_arc+258-gun_pos,HANDREMOTE+remote_frames[(*kb)],gs,o,pal); + else + myospalw(weapon_xoffset+150-(p->look_ang>>1),looking_arc+258-gun_pos,HANDREMOTE,gs,o,pal); } - break; + } + break; case DEVISTATOR_WEAPON: SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else pal = sector[p->cursectnum].floorpal; - if((*kb) < (*aplWeaponTotalTime[DEVISTATOR_WEAPON]+1) && (*kb) > 0) + if ((*kb) < (*aplWeaponTotalTime[DEVISTATOR_WEAPON]+1) && (*kb) > 0) { char cycloidy[] = {0,4,12,24,12,4,0}; i = ksgn((*kb)>>2); - if(p->hbomb_hold_delay) + if (p->hbomb_hold_delay) { myospalw( (cycloidy[*kb]>>1)+weapon_xoffset+268-(p->look_ang>>1),cycloidy[*kb]+looking_arc+238-gun_pos,DEVISTATOR+i,-32,o,pal); myospalw(weapon_xoffset+30-(p->look_ang>>1),looking_arc+240-gun_pos,DEVISTATOR,gs,o|4,pal); @@ -2590,18 +2591,18 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else pal = sector[p->cursectnum].floorpal; - if((*kb) < (aplWeaponTotalTime[p->curr_weapon][snum]+1) && (*kb) > 0) + if ((*kb) < (aplWeaponTotalTime[p->curr_weapon][snum]+1) && (*kb) > 0) { char cat_frames[] = { 0,0,1,1,2,2 }; - if(sprite[p->i].pal != 1) + if (sprite[p->i].pal != 1) { weapon_xoffset += rand()&3; looking_arc += rand()&3; @@ -2618,18 +2619,18 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { weapon_xoffset += 28; looking_arc += 18; - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else pal = sector[p->cursectnum].floorpal; { - if((*kb) < aplWeaponTotalTime[p->curr_weapon][snum] && (*kb) > 0) + if ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum] && (*kb) > 0) { - if(sprite[p->i].pal != 1) + if (sprite[p->i].pal != 1) { weapon_xoffset += rand()&3; gun_pos += (rand()&3); @@ -2660,17 +2661,17 @@ void displayweapon(short snum) SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if(GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) { weapon_xoffset += 28; looking_arc += 18; - if(sprite[p->i].pal == 1) + if (sprite[p->i].pal == 1) pal = 1; else pal = sector[p->cursectnum].floorpal; - if(((*kb) > 0) && ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum])) + if (((*kb) > 0) && ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum])) { - if(sprite[p->i].pal != 1) + if (sprite[p->i].pal != 1) { weapon_xoffset += rand()&3; gun_pos += (rand()&3); @@ -2733,7 +2734,7 @@ void getinput(short snum) momx = momy = 0; p = &ps[snum]; - if( (p->gm&MODE_MENU) || (p->gm&MODE_TYPE) || (ud.pause_on && !KB_KeyPressed(sc_Pause)) ) + if ( (p->gm&MODE_MENU) || (p->gm&MODE_TYPE) || (ud.pause_on && !KB_KeyPressed(sc_Pause)) ) { CONTROL_GetInput( &info ); memset(&lastinfo, 0, sizeof(lastinfo)); @@ -2771,37 +2772,37 @@ void getinput(short snum) CONTROL_GetInput( &info ); - if(MouseFilter) + if (MouseFilter) { - if(info.dpitch > 0) + if (info.dpitch > 0) { - if(info.dpitch > MouseFilter) + if (info.dpitch > MouseFilter) info.dpitch -= MouseFilter; else info.dpitch = 0; } - else if(info.dpitch < 0) + else if (info.dpitch < 0) { - if(info.dpitch < -MouseFilter) + if (info.dpitch < -MouseFilter) info.dpitch += MouseFilter; else info.dpitch = 0; } - if(info.dyaw > 0) + if (info.dyaw > 0) { - if(info.dyaw > MouseFilter) + if (info.dyaw > MouseFilter) info.dyaw -= MouseFilter; else info.dyaw = 0; } - else if(info.dyaw < 0) + else if (info.dyaw < 0) { - if(info.dyaw < -MouseFilter) + if (info.dyaw < -MouseFilter) info.dyaw += MouseFilter; else info.dyaw = 0; } } - if(MouseBias) + if (MouseBias) { - if(klabs(info.dyaw) > klabs(info.dpitch)) + if (klabs(info.dyaw) > klabs(info.dpitch)) info.dpitch /= MouseBias; else info.dyaw /= MouseBias; } @@ -2809,7 +2810,7 @@ void getinput(short snum) tics = totalclock-lastcontroltime; lastcontroltime = totalclock; - if(multiflag == 1) + if (multiflag == 1) { loc.bits = 1<<17; loc.bits |= multiwhat<<18; @@ -2818,7 +2819,7 @@ void getinput(short snum) return; } - if(BUTTON(gamefunc_Jump) && p->on_ground) + if (BUTTON(gamefunc_Jump) && p->on_ground) jump_input = 4; loc.bits = (jump_input > 0 || BUTTON(gamefunc_Jump)); //BUTTON(gamefunc_Jump); @@ -2834,7 +2835,7 @@ void getinput(short snum) if ( aplWeaponFlags[ps[snum].curr_weapon][snum] & WEAPON_FLAG_SEMIAUTO && BUTTON( gamefunc_Fire ) ) CONTROL_ClearButton(gamefunc_Fire); - if(jump_input > 0) + if (jump_input > 0) jump_input--; j=0; @@ -2894,9 +2895,9 @@ void getinput(short snum) svel = vel = angvel = horiz = 0; - if(SmoothInput) + if (SmoothInput) { - if( BUTTON(gamefunc_Strafe) ) { + if ( BUTTON(gamefunc_Strafe) ) { svel = -(info.dyaw+lastinfo.dyaw)/8; lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 8; } else { @@ -2904,7 +2905,7 @@ void getinput(short snum) lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 64; } - if(ud.mouseflip) + if (ud.mouseflip) horiz = -(info.dpitch+lastinfo.dpitch)/(314-128); else horiz = (info.dpitch+lastinfo.dpitch)/(314-128); @@ -2912,13 +2913,13 @@ void getinput(short snum) } else { - if( BUTTON(gamefunc_Strafe) ) { + if ( BUTTON(gamefunc_Strafe) ) { svel = -info.dyaw/8; } else { angvel = info.dyaw/64; } - if(ud.mouseflip) + if (ud.mouseflip) horiz -= info.dpitch/(314-128); else horiz += info.dpitch/(314-128); } @@ -2976,14 +2977,14 @@ void getinput(short snum) if ( BUTTON(gamefunc_Move_Backward) && !(ps[snum].movement_lock&2)) vel += -keymove; - if(vel < -MAXVEL) vel = -MAXVEL; - if(vel > MAXVEL) vel = MAXVEL; - if(svel < -MAXSVEL) svel = -MAXSVEL; - if(svel > MAXSVEL) svel = MAXSVEL; - if(angvel < -MAXANGVEL) angvel = -MAXANGVEL; - if(angvel > MAXANGVEL) angvel = MAXANGVEL; - if(horiz < -MAXHORIZ) horiz = -MAXHORIZ; - if(horiz > MAXHORIZ) horiz = MAXHORIZ; + if (vel < -MAXVEL) vel = -MAXVEL; + if (vel > MAXVEL) vel = MAXVEL; + if (svel < -MAXSVEL) svel = -MAXSVEL; + if (svel > MAXSVEL) svel = MAXSVEL; + if (angvel < -MAXANGVEL) angvel = -MAXANGVEL; + if (angvel > MAXANGVEL) angvel = MAXANGVEL; + if (horiz < -MAXHORIZ) horiz = -MAXHORIZ; + if (horiz > MAXHORIZ) horiz = MAXHORIZ; loc.extbits = BUTTON(gamefunc_Move_Forward); loc.extbits |= BUTTON(gamefunc_Move_Backward)<<1; @@ -2993,7 +2994,7 @@ void getinput(short snum) loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5; loc.extbits |= (ud.pteam[snum] != ps[snum].team)<<6; - if(ud.scrollmode && ud.overhead_on) + if (ud.scrollmode && ud.overhead_on) { ud.folfvel = vel; ud.folavel = angvel; @@ -3004,7 +3005,7 @@ void getinput(short snum) return; } - if( numplayers > 1 ) + if ( numplayers > 1 ) daang = myang; else daang = p->ang; @@ -3035,53 +3036,53 @@ char doincrements(struct player_struct *p) // j = sync[snum].avel; // p->weapon_ang = -(j/5); - if(p->invdisptime > 0) + if (p->invdisptime > 0) p->invdisptime--; - if(p->tipincs > 0) p->tipincs--; + if (p->tipincs > 0) p->tipincs--; - if(p->last_pissed_time > 0 ) + if (p->last_pissed_time > 0 ) { p->last_pissed_time--; - if( p->last_pissed_time == (26*219) ) + if ( p->last_pissed_time == (26*219) ) { spritesound(FLUSH_TOILET,p->i); - if(snum == screenpeek || GTFLAGS(GAMETYPE_FLAG_COOPSOUND)) + if (snum == screenpeek || GTFLAGS(GAMETYPE_FLAG_COOPSOUND)) spritesound(DUKE_PISSRELIEF,p->i); } - if( p->last_pissed_time == (26*218) ) + if ( p->last_pissed_time == (26*218) ) { p->holster_weapon = 0; p->weapon_pos = 10; } } - if(p->crack_time > 0) + if (p->crack_time > 0) { p->crack_time--; - if(p->crack_time == 0) + if (p->crack_time == 0) { p->knuckle_incs = 1; p->crack_time = 777; } } - if( p->steroids_amount > 0 && p->steroids_amount < 400) + if ( p->steroids_amount > 0 && p->steroids_amount < 400) { p->steroids_amount--; - if(p->steroids_amount == 0) + if (p->steroids_amount == 0) checkavailinven(p); - if( !(p->steroids_amount&7) ) - if(snum == screenpeek || GTFLAGS(GAMETYPE_FLAG_COOPSOUND)) + if ( !(p->steroids_amount&7) ) + if (snum == screenpeek || GTFLAGS(GAMETYPE_FLAG_COOPSOUND)) spritesound(DUKE_HARTBEAT,p->i); } - if(p->heat_on && p->heat_amount > 0) + if (p->heat_on && p->heat_amount > 0) { p->heat_amount--; - if( p->heat_amount == 0 ) + if ( p->heat_amount == 0 ) { p->heat_on = 0; checkavailinven(p); @@ -3090,10 +3091,10 @@ char doincrements(struct player_struct *p) } } - if( p->holoduke_on >= 0 ) + if ( p->holoduke_on >= 0 ) { p->holoduke_amount--; - if(p->holoduke_amount <= 0) + if (p->holoduke_amount <= 0) { spritesound(TELEPORTER,p->i); p->holoduke_on = -1; @@ -3101,10 +3102,10 @@ char doincrements(struct player_struct *p) } } - if( p->jetpack_on && p->jetpack_amount > 0 ) + if ( p->jetpack_on && p->jetpack_amount > 0 ) { p->jetpack_amount--; - if(p->jetpack_amount <= 0) + if (p->jetpack_amount <= 0) { p->jetpack_on = 0; checkavailinven(p); @@ -3114,45 +3115,51 @@ char doincrements(struct player_struct *p) } } - if(p->quick_kick > 0 && sprite[p->i].pal != 1) + if (p->quick_kick > 0 && sprite[p->i].pal != 1) { last_quick_kick[snum] = p->quick_kick+1; p->quick_kick--; - if( p->quick_kick == 8 ) + if ( p->quick_kick == 8 ) shoot(p->i,KNEE); - } else if(last_quick_kick[snum] > 0) last_quick_kick[snum]--; + } else if (last_quick_kick[snum] > 0) last_quick_kick[snum]--; - if(p->access_incs && sprite[p->i].pal != 1) + if (p->access_incs && sprite[p->i].pal != 1) { p->access_incs++; - if(sprite[p->i].extra <= 0) + if (sprite[p->i].extra <= 0) p->access_incs = 12; - if(p->access_incs == 12) + if (p->access_incs == 12) { - if(p->access_spritenum >= 0) + if (p->access_spritenum >= 0) { checkhitswitch(snum,p->access_spritenum,1); - switch(sprite[p->access_spritenum].pal) + switch (sprite[p->access_spritenum].pal) { - case 0:p->got_access &= (0xffff-0x1);break; - case 21:p->got_access &= (0xffff-0x2);break; - case 23:p->got_access &= (0xffff-0x4);break; + case 0: + p->got_access &= (0xffff-0x1);break; + case 21: + p->got_access &= (0xffff-0x2);break; + case 23: + p->got_access &= (0xffff-0x4);break; } p->access_spritenum = -1; } else { checkhitswitch(snum,p->access_wallnum,0); - switch(wall[p->access_wallnum].pal) + switch (wall[p->access_wallnum].pal) { - case 0:p->got_access &= (0xffff-0x1);break; - case 21:p->got_access &= (0xffff-0x2);break; - case 23:p->got_access &= (0xffff-0x4);break; + case 0: + p->got_access &= (0xffff-0x1);break; + case 21: + p->got_access &= (0xffff-0x2);break; + case 23: + p->got_access &= (0xffff-0x4);break; } } } - if(p->access_incs > 20) + if (p->access_incs > 20) { p->access_incs = 0; p->weapon_pos = 10; @@ -3160,9 +3167,9 @@ char doincrements(struct player_struct *p) } } - if(p->scuba_on == 0 && sector[p->cursectnum].lotag == 2) + if (p->scuba_on == 0 && sector[p->cursectnum].lotag == 2) { - if(p->scuba_amount > 0) + if (p->scuba_amount > 0) { p->scuba_on = 1; p->inven_icon = 6; @@ -3170,36 +3177,36 @@ char doincrements(struct player_struct *p) } else { - if(p->airleft > 0) + if (p->airleft > 0) p->airleft--; else { p->extra_extra8 += 32; - if(p->last_extra < (max_player_health>>1) && (p->last_extra&3) == 0) + if (p->last_extra < (max_player_health>>1) && (p->last_extra&3) == 0) spritesound(DUKE_LONGTERM_PAIN,p->i); } } } - else if(p->scuba_amount > 0 && p->scuba_on) + else if (p->scuba_amount > 0 && p->scuba_on) { p->scuba_amount--; - if(p->scuba_amount == 0) + if (p->scuba_amount == 0) { p->scuba_on = 0; checkavailinven(p); } } - if(p->knuckle_incs) + if (p->knuckle_incs) { p->knuckle_incs ++; - if(p->knuckle_incs==10) + if (p->knuckle_incs==10) { - if(totalclock > 1024) - if(snum == screenpeek || GTFLAGS(GAMETYPE_FLAG_COOPSOUND)) + if (totalclock > 1024) + if (snum == screenpeek || GTFLAGS(GAMETYPE_FLAG_COOPSOUND)) { - if(rand()&1) + if (rand()&1) spritesound(DUKE_CRACK,p->i); else spritesound(DUKE_CRACK2,p->i); @@ -3208,7 +3215,7 @@ char doincrements(struct player_struct *p) spritesound(DUKE_CRACK_FIRST,p->i); } - else if( p->knuckle_incs == 22 || (sync[snum].bits&(1<<2))) + else if ( p->knuckle_incs == 22 || (sync[snum].bits&(1<<2))) p->knuckle_incs=0; return 1; @@ -3227,13 +3234,13 @@ void checkweapons(struct player_struct *p) cw = aplWeaponWorksLike[p->curr_weapon][snum]; - if(cw < 1 || cw >= MAX_WEAPONS) return; + if (cw < 1 || cw >= MAX_WEAPONS) return; - if(cw) + if (cw) { - if(TRAND&1) + if (TRAND&1) spawn(p->i,weapon_sprites[cw]); - else switch(cw) + else switch (cw) { case RPG_WEAPON: case HANDBOMB_WEAPON: @@ -3262,21 +3269,21 @@ void processinput(short snum) OnEvent(EVENT_PROCESSINPUT, pi, snum, -1); - if(p->cheat_phase <= 0) sb_snum = sync[snum].bits; + if (p->cheat_phase <= 0) sb_snum = sync[snum].bits; else sb_snum = 0; - if((sb_snum&(1<<2))) + if ((sb_snum&(1<<2))) { SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_PRESSEDFIRE, pi, snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) != 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) != 0) sb_snum &= ~(1<<2); } psect = p->cursectnum; - if(psect == -1) + if (psect == -1) { - if(s->extra > 0 && ud.clipping == 0) + if (s->extra > 0 && ud.clipping == 0) { quickkill(p); spritesound(SQUISHED,pi); @@ -3297,7 +3304,7 @@ void processinput(short snum) p->truecz = getceilzofslope(psect,p->posx,p->posy); truefdist = klabs(p->posz-j); - if( (lz&49152) == 16384 && psectlotag == 1 && truefdist > PHEIGHT+(16<<8) ) + if ( (lz&49152) == 16384 && psectlotag == 1 && truefdist > PHEIGHT+(16<<8) ) psectlotag = 0; hittype[pi].floorz = fz; @@ -3306,7 +3313,7 @@ void processinput(short snum) p->ohoriz = p->horiz; p->ohorizoff = p->horizoff; - if( p->aim_mode == 0 && p->on_ground && psectlotag != 2 && (sector[psect].floorstat&2) ) + if ( p->aim_mode == 0 && p->on_ground && psectlotag != 2 && (sector[psect].floorstat&2) ) { x = p->posx+(sintable[(p->ang+512)&2047]>>5); y = p->posy+(sintable[p->ang&2047]>>5); @@ -3325,29 +3332,29 @@ void processinput(short snum) if (p->horizoff > 0) p->horizoff -= ((p->horizoff>>3)+1); else if (p->horizoff < 0) p->horizoff += (((-p->horizoff)>>3)+1); - if( hz >= 0 && (hz&49152) == 49152) + if ( hz >= 0 && (hz&49152) == 49152) { hz &= (MAXSPRITES-1); - if(sprite[hz].statnum == 1 && sprite[hz].extra >= 0) + if (sprite[hz].statnum == 1 && sprite[hz].extra >= 0) { hz = 0; cz = p->truecz; } } - if(lz >= 0 && (lz&49152) == 49152) + if (lz >= 0 && (lz&49152) == 49152) { j = lz&(MAXSPRITES-1); - if( (sprite[j].cstat&33) == 33 ) + if ( (sprite[j].cstat&33) == 33 ) { psectlotag = 0; p->footprintcount = 0; p->spritebridge = 1; p->sbs = j; } - else if(badguy(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(s->z-sprite[j].z) < (84<<8) ) + else if (badguy(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(s->z-sprite[j].z) < (84<<8) ) { j = getangle(sprite[j].x-p->posx,sprite[j].y-p->posy); p->posxv -= sintable[(j+512)&2047]<<4; @@ -3365,33 +3372,33 @@ void processinput(short snum) p->last_extra = s->extra; - if(p->loogcnt > 0) p->loogcnt--; + if (p->loogcnt > 0) p->loogcnt--; else p->loogcnt = 0; - if(p->fist_incs) + if (p->fist_incs) { // the fist puching the end-of-level thing... p->fist_incs++; - if(p->fist_incs == 28) + if (p->fist_incs == 28) { - if(ud.recstat == 1) closedemowrite(); + if (ud.recstat == 1) closedemowrite(); sound(PIPEBOMB_EXPLODE); p->pals[0] = 64; p->pals[1] = 64; p->pals[2] = 64; p->pals_time = 48; } - if(p->fist_incs > 42) + if (p->fist_incs > 42) { - if(p->buttonpalette && ud.from_bonus == 0) + if (p->buttonpalette && ud.from_bonus == 0) { ud.from_bonus = ud.level_number+1; - if(ud.secretlevel > 0 && ud.secretlevel < 12) ud.level_number = ud.secretlevel-1; + if (ud.secretlevel > 0 && ud.secretlevel < 12) ud.level_number = ud.secretlevel-1; ud.m_level_number = ud.level_number; } else { - if(ud.from_bonus) + if (ud.from_bonus) { ud.level_number = ud.from_bonus; ud.m_level_number = ud.level_number; @@ -3399,16 +3406,16 @@ void processinput(short snum) } else { - if(ud.level_number == ud.secretlevel && ud.from_bonus > 0 ) + if (ud.level_number == ud.secretlevel && ud.from_bonus > 0 ) ud.level_number = ud.from_bonus; else ud.level_number++; - if(ud.level_number > 10) ud.level_number = 0; + if (ud.level_number > 10) ud.level_number = 0; ud.m_level_number = ud.level_number; } } - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) ps[i].gm = MODE_EOL; p->fist_incs = 0; @@ -3416,24 +3423,24 @@ void processinput(short snum) } } - if(p->timebeforeexit > 1 && p->last_extra > 0) + if (p->timebeforeexit > 1 && p->last_extra > 0) { p->timebeforeexit--; - if(p->timebeforeexit == 26*5) + if (p->timebeforeexit == 26*5) { FX_StopAllSounds(); clearsoundlocks(); - if(p->customexitsound >= 0) + if (p->customexitsound >= 0) { sound(p->customexitsound); FTA(102,p); } } - else if(p->timebeforeexit == 1) + else if (p->timebeforeexit == 1) { - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) ps[i].gm = MODE_EOL; - if(ud.from_bonus) + if (ud.from_bonus) { ud.level_number = ud.from_bonus; ud.m_level_number = ud.level_number; @@ -3469,13 +3476,13 @@ void processinput(short snum) } */ - if(p->pals_time >= 0) + if (p->pals_time >= 0) p->pals_time--; - if(p->fta > 0) + if (p->fta > 0) { p->fta--; - if(p->fta == 0) + if (p->fta == 0) { pub = NUMPAGES; pus = NUMPAGES; @@ -3483,11 +3490,11 @@ void processinput(short snum) } } - if( s->extra <= 0 ) + if ( s->extra <= 0 ) { - if(p->dead_flag == 0) + if (p->dead_flag == 0) { - if(s->pal != 1) + if (s->pal != 1) { p->pals[0] = 63; p->pals[1] = 0; @@ -3497,13 +3504,13 @@ void processinput(short snum) s->z -= (16<<8); } - if(ud.recstat == 1 && ud.multimode < 2) + if (ud.recstat == 1 && ud.multimode < 2) closedemowrite(); - if(s->pal != 1) + if (s->pal != 1) { p->dead_flag = (512-((TRAND&1)<<10)+(TRAND&255)-512)&2047; - if(p->dead_flag == 0) + if (p->dead_flag == 0) p->dead_flag++; } @@ -3511,20 +3518,20 @@ void processinput(short snum) p->holoduke_on = -1; stopspritesound(DUKE_JETPACK_IDLE,p->i); - if(p->scream_voice > FX_Ok) + if (p->scream_voice > FX_Ok) { FX_StopSound(p->scream_voice); testcallback(DUKE_SCREAM); p->scream_voice = FX_Ok; } - if( s->pal != 1 && (s->cstat&32768) == 0) s->cstat = 0; + if ( s->pal != 1 && (s->cstat&32768) == 0) s->cstat = 0; - if( ud.multimode > 1 && ( s->pal != 1 || (s->cstat&32768) ) ) + if ( ud.multimode > 1 && ( s->pal != 1 || (s->cstat&32768) ) ) { - if(p->frag_ps != snum) + if (p->frag_ps != snum) { - if(GTFLAGS(GAMETYPE_FLAG_TDM) && ps[p->frag_ps].team == ps[snum].team) + if (GTFLAGS(GAMETYPE_FLAG_TDM) && ps[p->frag_ps].team == ps[snum].team) ps[p->frag_ps].fraggedself++; else { @@ -3532,7 +3539,7 @@ void processinput(short snum) frags[p->frag_ps][snum]++; } - if(snum == screenpeek) + if (snum == screenpeek) { Bsprintf(fta_quotes[115],"KILLED BY %s",&ud.user_name[p->frag_ps][0]); FTA(115,p); @@ -3546,19 +3553,19 @@ void processinput(short snum) { char name1[32],name2[32]; - if(GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_FLAG_TDM) && ps[snum].team == ps[p->frag_ps].team)) + if (GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_FLAG_TDM) && ps[snum].team == ps[p->frag_ps].team)) i = 9; else { - switch(dynamictostatic[hittype[p->i].picnum]) + switch (dynamictostatic[hittype[p->i].picnum]) { case KNEE__STATIC: - if(hittype[p->i].temp_data[1] == 1) + if (hittype[p->i].temp_data[1] == 1) i = 7; else i = 0; break; case SHOTSPARK1__STATIC: - switch(ps[p->frag_ps].curr_weapon) + switch (ps[p->frag_ps].curr_weapon) { default: case PISTOL_WEAPON: @@ -3572,42 +3579,47 @@ void processinput(short snum) break; } break; - case RPG__STATIC: i = 4; break; - case RADIUSEXPLOSION__STATIC: i = 5; break; - case SHRINKSPARK__STATIC: i = 6; break; - case GROWSPARK__STATIC: i = 8; break; - default: i = 0; break; + case RPG__STATIC: + i = 4; break; + case RADIUSEXPLOSION__STATIC: + i = 5; break; + case SHRINKSPARK__STATIC: + i = 6; break; + case GROWSPARK__STATIC: + i = 8; break; + default: + i = 0; break; } } Bstrcpy(name1,&ud.user_name[snum][0]); Bstrcpy(name2,&ud.user_name[p->frag_ps][0]); Bsprintf(tempbuf,fta_quotes[PPDEATHSTRINGS+i+(mulscale(krand(), 3, 16)*10)],name1,name2); - if(ScreenWidth >= 800) + if (ScreenWidth >= 800) adduserquote(tempbuf); else OSD_Printf("%s\n",strip_color_codes(tempbuf)); } } else { - if(hittype[p->i].picnum != APLAYERTOP) + if (hittype[p->i].picnum != APLAYERTOP) { p->fraggedself++; - if(badguypic(sprite[p->wackedbyactor].picnum)) + if (badguypic(sprite[p->wackedbyactor].picnum)) i = 2; - else if(hittype[p->i].picnum == NUKEBUTTON) + else if (hittype[p->i].picnum == NUKEBUTTON) i = 1; else i = 0; Bsprintf(tempbuf,fta_quotes[PSDEATHSTRINGS+i],&ud.user_name[snum][0]); } else Bsprintf(tempbuf,fta_quotes[PSDEATHSTRINGS+3],&ud.user_name[snum][0],p->team+1); - if(ScreenWidth >= 800) + if (ScreenWidth >= 800) adduserquote(tempbuf); else OSD_Printf("%s\n",strip_color_codes(tempbuf)); } - if(myconnectindex == connecthead) + if (myconnectindex == connecthead) { Bsprintf(tempbuf,"frag %d killed %d\n",p->frag_ps+1,snum+1); sendscore(tempbuf); @@ -3619,11 +3631,11 @@ void processinput(short snum) } } - if( psectlotag == 2 ) + if ( psectlotag == 2 ) { - if(p->on_warping_sector == 0) + if (p->on_warping_sector == 0) { - if( klabs(p->posz-fz) > (PHEIGHT>>1)) + if ( klabs(p->posz-fz) > (PHEIGHT>>1)) p->posz += 348; } else @@ -3651,7 +3663,7 @@ void processinput(short snum) pushmove(&p->posx,&p->posy,&p->posz,&p->cursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0); - if( fz > cz+(16<<8) && s->pal != 1) + if ( fz > cz+(16<<8) && s->pal != 1) p->rotscrnang = (p->dead_flag + ( (fz+p->posz)>>7))&2047; p->on_warping_sector = 0; @@ -3659,16 +3671,16 @@ void processinput(short snum) return; } - if(p->transporter_hold > 0) + if (p->transporter_hold > 0) { p->transporter_hold--; - if(p->transporter_hold == 0 && p->on_warping_sector) + if (p->transporter_hold == 0 && p->on_warping_sector) p->transporter_hold = 2; } - if(p->transporter_hold < 0) + if (p->transporter_hold < 0) p->transporter_hold++; - if(p->newowner >= 0) + if (p->newowner >= 0) { i = p->newowner; p->posx = SX; @@ -3681,7 +3693,7 @@ void processinput(short snum) doincrements(p); - if(*aplWeaponWorksLike[p->curr_weapon] == HANDREMOTE_WEAPON) + if (*aplWeaponWorksLike[p->curr_weapon] == HANDREMOTE_WEAPON) goto SHOOTINCODE; return; @@ -3694,31 +3706,31 @@ void processinput(short snum) p->look_ang -= (p->look_ang>>2); - if( sb_snum&(1<<6) ) + if ( sb_snum&(1<<6) ) { // look_left SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_LOOKLEFT,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { p->look_ang -= 152; p->rotscrnang += 24; } } - if( sb_snum&(1<<7) ) + if ( sb_snum&(1<<7) ) { // look_right SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_LOOKRIGHT,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { p->look_ang += 152; p->rotscrnang -= 24; } } - if(p->on_crane >= 0) + if (p->on_crane >= 0) goto HORIZONLY; j = ksgn(sync[snum].avel); @@ -3732,11 +3744,11 @@ void processinput(short snum) } */ - if( s->xvel < 32 || p->on_ground == 0 || p->bobcounter == 1024 ) + if ( s->xvel < 32 || p->on_ground == 0 || p->bobcounter == 1024 ) { - if( (p->weapon_sway&2047) > (1024+96) ) + if ( (p->weapon_sway&2047) > (1024+96) ) p->weapon_sway -= 96; - else if( (p->weapon_sway&2047) < (1024-96) ) + else if ( (p->weapon_sway&2047) < (1024-96) ) p->weapon_sway += 96; else p->weapon_sway = 1024; } @@ -3744,9 +3756,9 @@ void processinput(short snum) s->xvel = ksqrt( (p->posx-p->bobposx)*(p->posx-p->bobposx)+(p->posy-p->bobposy)*(p->posy-p->bobposy)); - if(p->on_ground) p->bobcounter += sprite[p->i].xvel>>1; + if (p->on_ground) p->bobcounter += sprite[p->i].xvel>>1; - if( ud.clipping == 0 && ( sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS) ) + if ( ud.clipping == 0 && ( sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS) ) { p->posx = p->oposx; p->posy = p->oposy; @@ -3764,7 +3776,7 @@ void processinput(short snum) p->opyoff = p->pyoff; p->oang = p->ang; - if(p->one_eighty_count < 0) + if (p->one_eighty_count < 0) { p->one_eighty_count += 128; p->ang += 128; @@ -3774,7 +3786,7 @@ void processinput(short snum) i = 40; - if( psectlotag == 2) + if ( psectlotag == 2) { // under water p->jumping_counter = 0; @@ -3783,65 +3795,65 @@ void processinput(short snum) p->pycount &= 2047; p->pyoff = sintable[p->pycount]>>7; - if(!isspritemakingsound(pi,DUKE_UNDERWATER)) + if (!isspritemakingsound(pi,DUKE_UNDERWATER)) spritesound(DUKE_UNDERWATER,pi); if ( sb_snum&1 ) { SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_SWIMUP,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { // jump - if(p->poszv > 0) p->poszv = 0; + if (p->poszv > 0) p->poszv = 0; p->poszv -= 348; - if(p->poszv < -(256*6)) p->poszv = -(256*6); + if (p->poszv < -(256*6)) p->poszv = -(256*6); } } else if (sb_snum&(1<<1)) { SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_SWIMDOWN,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { // crouch - if(p->poszv < 0) p->poszv = 0; + if (p->poszv < 0) p->poszv = 0; p->poszv += 348; - if(p->poszv > (256*6)) p->poszv = (256*6); + if (p->poszv > (256*6)) p->poszv = (256*6); } } else { // normal view - if(p->poszv < 0) + if (p->poszv < 0) { p->poszv += 256; - if(p->poszv > 0) + if (p->poszv > 0) p->poszv = 0; } - if(p->poszv > 0) + if (p->poszv > 0) { p->poszv -= 256; - if(p->poszv < 0) + if (p->poszv < 0) p->poszv = 0; } } - if(p->poszv > 2048) + if (p->poszv > 2048) p->poszv >>= 1; p->posz += p->poszv; - if(p->posz > (fz-(15<<8)) ) + if (p->posz > (fz-(15<<8)) ) p->posz += ((fz-(15<<8))-p->posz)>>1; - if(p->posz < (cz+(4<<8)) ) + if (p->posz < (cz+(4<<8)) ) { p->posz = cz+(4<<8); p->poszv = 0; } - if( p->scuba_on && (TRAND&255) < 8 ) + if ( p->scuba_on && (TRAND&255) < 8 ) { j = spawn(pi,WATERBUBBLE); sprite[j].x += @@ -3854,7 +3866,7 @@ void processinput(short snum) } } - else if(p->jetpack_on) + else if (p->jetpack_on) { p->on_ground = 0; p->jumping_counter = 0; @@ -3865,15 +3877,15 @@ void processinput(short snum) p->pycount &= 2047; p->pyoff = sintable[p->pycount]>>7; - if(p->jetpack_on < 11) + if (p->jetpack_on < 11) { p->jetpack_on++; p->posz -= (p->jetpack_on<<7); //Goin up } - else if(p->jetpack_on == 11 && !isspritemakingsound(pi,DUKE_JETPACK_IDLE)) + else if (p->jetpack_on == 11 && !isspritemakingsound(pi,DUKE_JETPACK_IDLE)) spritesound(DUKE_JETPACK_IDLE,pi); - if(shrunk) j = 512; + if (shrunk) j = 512; else j = 2048; if ( sb_snum&1 ) //A (soar high) @@ -3881,7 +3893,7 @@ void processinput(short snum) // jump SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_SOARUP,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { p->posz -= j; p->crack_time = 777; @@ -3893,36 +3905,36 @@ void processinput(short snum) // crouch SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_SOARDOWN,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { p->posz += j; p->crack_time = 777; } } - if( shrunk == 0 && (psectlotag == 0 || psectlotag == 2)) k = 32; + if ( shrunk == 0 && (psectlotag == 0 || psectlotag == 2)) k = 32; else k = 16; - if( psectlotag != 2 && p->scuba_on == 1 ) + if ( psectlotag != 2 && p->scuba_on == 1 ) p->scuba_on = 0; - if(p->posz > (fz-(k<<8)) ) + if (p->posz > (fz-(k<<8)) ) p->posz += ((fz-(k<<8))-p->posz)>>1; - if(p->posz < (hittype[pi].ceilingz+(18<<8)) ) + if (p->posz < (hittype[pi].ceilingz+(18<<8)) ) p->posz = hittype[pi].ceilingz+(18<<8); } - else if( psectlotag != 2 ) + else if ( psectlotag != 2 ) { - if(p->airleft != 15*26) + if (p->airleft != 15*26) p->airleft = 15*26; //Aprox twenty seconds. - if(p->scuba_on == 1) + if (p->scuba_on == 1) p->scuba_on = 0; - if( psectlotag == 1 && p->spritebridge == 0) + if ( psectlotag == 1 && p->spritebridge == 0) { - if(shrunk == 0) + if (shrunk == 0) { i = 34; p->pycount += 32; @@ -3931,16 +3943,16 @@ void processinput(short snum) } else i = 12; - if(shrunk == 0 && truefdist <= PHEIGHT) + if (shrunk == 0 && truefdist <= PHEIGHT) { - if(p->on_ground == 1) + if (p->on_ground == 1) { - if( p->dummyplayersprite == -1 ) + if ( p->dummyplayersprite == -1 ) p->dummyplayersprite = spawn(pi,PLAYERONWATER); sprite[p->dummyplayersprite].pal = sprite[p->i].pal; p->footprintcount = 6; - if(sector[p->cursectnum].floorpicnum == FLOORSLIME) + if (sector[p->cursectnum].floorpicnum == FLOORSLIME) p->footprintpal = 8; else p->footprintpal = 0; p->footprintshade = 0; @@ -3949,25 +3961,29 @@ void processinput(short snum) } else { - if(p->footprintcount > 0 && p->on_ground) - if( (sector[p->cursectnum].floorstat&2) != 2 ) + if (p->footprintcount > 0 && p->on_ground) + if ( (sector[p->cursectnum].floorstat&2) != 2 ) { - 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 ) + 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) break; - if(j < 0) + if (j < 0) { p->footprintcount--; - if( sector[p->cursectnum].lotag == 0 && sector[p->cursectnum].hitag == 0 ) + if ( sector[p->cursectnum].lotag == 0 && sector[p->cursectnum].hitag == 0 ) { - switch(TRAND&3) + switch (TRAND&3) { - case 0: j = spawn(pi,FOOTPRINTS); break; - case 1: j = spawn(pi,FOOTPRINTS2); break; - case 2: j = spawn(pi,FOOTPRINTS3); break; - default: j = spawn(pi,FOOTPRINTS4); break; + case 0: + j = spawn(pi,FOOTPRINTS); break; + case 1: + j = spawn(pi,FOOTPRINTS2); break; + case 2: + j = spawn(pi,FOOTPRINTS3); break; + default: + j = spawn(pi,FOOTPRINTS4); break; } sprite[j].pal = p->footprintpal; sprite[j].shade = p->footprintshade; @@ -3976,34 +3992,34 @@ void processinput(short snum) } } - if(p->posz < (fz-(i<<8)) ) //falling + if (p->posz < (fz-(i<<8)) ) //falling { // not jumping or crouching - if( (sb_snum&3) == 0 && p->on_ground && (sector[psect].floorstat&2) && p->posz >= (fz-(i<<8)-(16<<8) ) ) + if ( (sb_snum&3) == 0 && p->on_ground && (sector[psect].floorstat&2) && p->posz >= (fz-(i<<8)-(16<<8) ) ) p->posz = fz-(i<<8); else { p->on_ground = 0; p->poszv += (gc+80); // (TICSPERFRAME<<6); - if(p->poszv >= (4096+2048)) p->poszv = (4096+2048); - if(p->poszv > 2400 && p->falling_counter < 255) + if (p->poszv >= (4096+2048)) p->poszv = (4096+2048); + if (p->poszv > 2400 && p->falling_counter < 255) { p->falling_counter++; - if( p->falling_counter == 38 ) + if ( p->falling_counter == 38 ) p->scream_voice = spritesound(DUKE_SCREAM,pi); } - if( (p->posz+p->poszv) >= (fz-(i<<8)) ) // hit the ground - if(sector[p->cursectnum].lotag != 1) + if ( (p->posz+p->poszv) >= (fz-(i<<8)) ) // hit the ground + if (sector[p->cursectnum].lotag != 1) { - if( p->falling_counter > 62 ) quickkill(p); + if ( p->falling_counter > 62 ) quickkill(p); - else if( p->falling_counter > 9 ) + else if ( p->falling_counter > 9 ) { j = p->falling_counter; s->extra -= j-(TRAND&3); - if(s->extra <= 0) + if (s->extra <= 0) { spritesound(SQUISHED,pi); p->pals[0] = 63; @@ -4022,7 +4038,7 @@ void processinput(short snum) p->pals[2] = 0; p->pals_time = 32; } - else if(p->poszv > 2048) spritesound(DUKE_LAND,pi); + else if (p->poszv > 2048) spritesound(DUKE_LAND,pi); } } } @@ -4030,31 +4046,31 @@ void processinput(short snum) else { p->falling_counter = 0; - if(p->scream_voice > FX_Ok) + if (p->scream_voice > FX_Ok) { FX_StopSound(p->scream_voice); p->scream_voice = FX_Ok; } - if(psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->poszv > (6144>>1)) + if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->poszv > (6144>>1)) p->hard_landing = p->poszv>>10; p->on_ground = 1; - if( i==40 ) + if ( i==40 ) { //Smooth on the ground k = ((fz-(i<<8))-p->posz)>>1; - if( klabs(k) < 256 ) k = 0; + if ( klabs(k) < 256 ) k = 0; p->posz += k; p->poszv -= 768; - if(p->poszv < 0) p->poszv = 0; + if (p->poszv < 0) p->poszv = 0; } - else if(p->jumping_counter == 0) + else if (p->jumping_counter == 0) { p->posz += ((fz-(i<<7))-p->posz)>>1; //Smooth on the water - if(p->on_warping_sector == 0 && p->posz > fz-(16<<8)) + if (p->on_warping_sector == 0 && p->posz > fz-(16<<8)) { p->posz = fz-(16<<8); p->poszv >>= 1; @@ -4063,12 +4079,12 @@ void processinput(short snum) p->on_warping_sector = 0; - if( (sb_snum&2) ) + if ( (sb_snum&2) ) { // crouching SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_CROUCH,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { p->posz += (2048+768); p->crack_time = 777; @@ -4076,17 +4092,17 @@ void processinput(short snum) } // jumping - if( (sb_snum&1) == 0 && p->jumping_toggle == 1) + if ( (sb_snum&1) == 0 && p->jumping_toggle == 1) p->jumping_toggle = 0; - else if( (sb_snum&1) && p->jumping_toggle == 0 ) + else if ( (sb_snum&1) && p->jumping_toggle == 0 ) { - if( p->jumping_counter == 0 ) - if( (fz-cz) > (56<<8) ) + if ( p->jumping_counter == 0 ) + if ( (fz-cz) > (56<<8) ) { SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_JUMP,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { p->jumping_counter = 1; p->jumping_toggle = 1; @@ -4094,18 +4110,18 @@ void processinput(short snum) } } - if( p->jumping_counter && (sb_snum&1) == 0 ) + if ( p->jumping_counter && (sb_snum&1) == 0 ) p->jumping_toggle = 0; } - if(p->jumping_counter) + if (p->jumping_counter) { - if( (sb_snum&1) == 0 && p->jumping_toggle == 1) + if ( (sb_snum&1) == 0 && p->jumping_toggle == 1) p->jumping_toggle = 0; - if( p->jumping_counter < (1024+256) ) + if ( p->jumping_counter < (1024+256) ) { - if(psectlotag == 1 && p->jumping_counter > 768) + if (psectlotag == 1 && p->jumping_counter > 768) { p->jumping_counter = 0; p->poszv = -512; @@ -4126,10 +4142,10 @@ void processinput(short snum) p->posz += p->poszv; - if(p->posz < (cz+(4<<8))) + if (p->posz < (cz+(4<<8))) { p->jumping_counter = 0; - if(p->poszv < 0) + if (p->poszv < 0) p->posxv = p->posyv = 0; p->poszv = 128; p->posz = cz+(4<<8); @@ -4157,7 +4173,7 @@ void processinput(short snum) tempang = sync[snum].avel<<1; - if( psectlotag == 2 ) p->angvel =(tempang-(tempang>>3))*ksgn(doubvel); + if ( psectlotag == 2 ) p->angvel =(tempang-(tempang>>3))*ksgn(doubvel); else p->angvel = tempang*ksgn(doubvel); p->ang += p->angvel; @@ -4165,22 +4181,22 @@ void processinput(short snum) p->crack_time = 777; } - if(p->spritebridge == 0) + if (p->spritebridge == 0) { j = sector[s->sectnum].floorpicnum; - if( j == PURPLELAVA || sector[s->sectnum].ceilingpicnum == PURPLELAVA ) + if ( j == PURPLELAVA || sector[s->sectnum].ceilingpicnum == PURPLELAVA ) { - if(p->boot_amount > 0) + if (p->boot_amount > 0) { p->boot_amount--; p->inven_icon = 7; - if(p->boot_amount <= 0) + if (p->boot_amount <= 0) checkavailinven(p); } else { - if(!isspritemakingsound(pi,DUKE_LONGTERM_PAIN)) + if (!isspritemakingsound(pi,DUKE_LONGTERM_PAIN)) spritesound(DUKE_LONGTERM_PAIN,pi); p->pals[0] = 0; p->pals[1] = 8; p->pals[2] = 0; p->pals_time = 32; @@ -4190,35 +4206,35 @@ void processinput(short snum) k = 0; - if(p->on_ground && truefdist <= PHEIGHT+(16<<8)) + if (p->on_ground && truefdist <= PHEIGHT+(16<<8)) { - switch(dynamictostatic[j]) + switch (dynamictostatic[j]) { case HURTRAIL__STATIC: - if( rnd(32) ) + if ( rnd(32) ) { - if(p->boot_amount > 0) + if (p->boot_amount > 0) k = 1; else { - if(!isspritemakingsound(pi,DUKE_LONGTERM_PAIN)) + if (!isspritemakingsound(pi,DUKE_LONGTERM_PAIN)) spritesound(DUKE_LONGTERM_PAIN,pi); p->pals[0] = 64; p->pals[1] = 64; p->pals[2] = 64; p->pals_time = 32; s->extra -= 1+(TRAND&3); - if(!isspritemakingsound(pi,SHORT_CIRCUIT)) + if (!isspritemakingsound(pi,SHORT_CIRCUIT)) spritesound(SHORT_CIRCUIT,pi); } } break; case FLOORSLIME__STATIC: - if( rnd(16) ) + if ( rnd(16) ) { - if(p->boot_amount > 0) + if (p->boot_amount > 0) k = 1; else { - if(!isspritemakingsound(pi,DUKE_LONGTERM_PAIN)) + if (!isspritemakingsound(pi,DUKE_LONGTERM_PAIN)) spritesound(DUKE_LONGTERM_PAIN,pi); p->pals[0] = 0; p->pals[1] = 8; p->pals[2] = 0; p->pals_time = 32; @@ -4227,13 +4243,13 @@ void processinput(short snum) } break; case FLOORPLASMA__STATIC: - if( rnd(32) ) + if ( rnd(32) ) { - if( p->boot_amount > 0 ) + if ( p->boot_amount > 0 ) k = 1; else { - if(!isspritemakingsound(pi,DUKE_LONGTERM_PAIN)) + if (!isspritemakingsound(pi,DUKE_LONGTERM_PAIN)) spritesound(DUKE_LONGTERM_PAIN,pi); p->pals[0] = 8; p->pals[1] = 0; p->pals[2] = 0; p->pals_time = 32; @@ -4244,11 +4260,11 @@ void processinput(short snum) } } - if( k ) + if ( k ) { FTA(75,p); p->boot_amount -= 2; - if(p->boot_amount <= 0) + if (p->boot_amount <= 0) checkavailinven(p); } } @@ -4259,19 +4275,19 @@ void processinput(short snum) k = sintable[p->bobcounter&2047]>>12; - if((truefdist < PHEIGHT+(8<<8) ) && ( k == 1 || k == 3 )) + if ((truefdist < PHEIGHT+(8<<8) ) && ( k == 1 || k == 3 )) { - if(p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground) + if (p->spritebridge == 0 && p->walking_snd_toggle == 0 && p->on_ground) { - switch( psectlotag ) + switch ( psectlotag ) { case 0: - if(lz >= 0 && (lz&(MAXSPRITES-1))==49152 ) + if (lz >= 0 && (lz&(MAXSPRITES-1))==49152 ) j = sprite[lz&(MAXSPRITES-1)].picnum; else j = sector[psect].floorpicnum; - switch(dynamictostatic[j]) + switch (dynamictostatic[j]) { case PANNEL1__STATIC: case PANNEL2__STATIC: @@ -4281,17 +4297,17 @@ void processinput(short snum) } break; case 1: - if((TRAND&1) == 0) + if ((TRAND&1) == 0) spritesound(DUKE_ONWATER,pi); p->walking_snd_toggle = 1; break; } } } - else if(p->walking_snd_toggle > 0) + else if (p->walking_snd_toggle > 0) p->walking_snd_toggle --; - if(p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) + if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) doubvel <<= 1; /* @@ -4323,14 +4339,14 @@ void processinput(short snum) p->posxv += ((sync[snum].fvel*doubvel)<<6); p->posyv += ((sync[snum].svel*doubvel)<<6); - if( ( aplWeaponWorksLike[p->curr_weapon] == KNEE_WEAPON && *kb > 10 && p->on_ground ) || ( p->on_ground && (sb_snum&2) ) ) + if ( ( aplWeaponWorksLike[p->curr_weapon] == KNEE_WEAPON && *kb > 10 && p->on_ground ) || ( p->on_ground && (sb_snum&2) ) ) { p->posxv = mulscale(p->posxv,p->runspeed-0x2000,16); p->posyv = mulscale(p->posyv,p->runspeed-0x2000,16); } else { - if(psectlotag == 2) + if (psectlotag == 2) { p->posxv = mulscale(p->posxv,p->runspeed-0x1400,16); p->posyv = mulscale(p->posyv,p->runspeed-0x1400,16); @@ -4342,10 +4358,10 @@ void processinput(short snum) } } - if( abs(p->posxv) < 2048 && abs(p->posyv) < 2048 ) + if ( abs(p->posxv) < 2048 && abs(p->posyv) < 2048 ) p->posxv = p->posyv = 0; - if( shrunk ) + if ( shrunk ) { p->posxv = mulscale16(p->posxv,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2)); @@ -4356,13 +4372,13 @@ void processinput(short snum) HORIZONLY: - if(psectlotag == 1 || p->spritebridge == 1) i = (4L<<8); + if (psectlotag == 1 || p->spritebridge == 1) i = (4L<<8); else i = (20L<<8); - if(sector[p->cursectnum].lotag == 2) k = 0; + if (sector[p->cursectnum].lotag == 2) k = 0; else k = 1; - if(ud.clipping) + if (ud.clipping) { j = 0; p->posx += p->posxv>>14; @@ -4375,17 +4391,17 @@ HORIZONLY: &p->posz,&p->cursectnum, p->posxv,p->posyv,164L,(4L<<8),i,CLIPMASK0); - if(p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) + if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) p->posz += 32<<8; - if(j) + if (j) checkplayerhurt(p,j); - if(p->jetpack_on == 0) + if (p->jetpack_on == 0) { - if( s->xvel > 16 ) + if ( s->xvel > 16 ) { - if( psectlotag != 1 && psectlotag != 2 && p->on_ground ) + if ( psectlotag != 1 && psectlotag != 2 && p->on_ground ) { p->pycount += 52; p->pycount &= 2047; @@ -4393,19 +4409,19 @@ HORIZONLY: klabs(s->xvel*sintable[p->pycount])/1596; } } - else if( psectlotag != 2 && psectlotag != 1 ) + else if ( psectlotag != 2 && psectlotag != 1 ) p->pyoff = 0; } // RBG*** setsprite(pi,p->posx,p->posy,p->posz+PHEIGHT); - if( psectlotag < 3 ) + if ( psectlotag < 3 ) { psect = s->sectnum; - if( ud.clipping == 0 && sector[psect].lotag == 31) + if ( ud.clipping == 0 && sector[psect].lotag == 31) { - if( sprite[sector[psect].hitag].xvel && hittype[sector[psect].hitag].temp_data[0] == 0) + if ( sprite[sector[psect].hitag].xvel && hittype[sector[psect].hitag].temp_data[0] == 0) { quickkill(p); return; @@ -4413,156 +4429,156 @@ HORIZONLY: } } - if(truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1) - if(!isspritemakingsound(pi,DUKE_ONWATER)) + if (truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1) + if (!isspritemakingsound(pi,DUKE_ONWATER)) spritesound(DUKE_ONWATER,pi); if (p->cursectnum != s->sectnum) changespritesect(pi,p->cursectnum); - if(ud.clipping == 0) + if (ud.clipping == 0) j = ( pushmove(&p->posx,&p->posy,&p->posz,&p->cursectnum,164L,(4L<<8),(4L<<8),CLIPMASK0) < 0 && furthestangle(pi,8) < 512 ); else j = 0; - if(ud.clipping == 0) + if (ud.clipping == 0) { - if( klabs(hittype[pi].floorz-hittype[pi].ceilingz) < (48<<8) || j ) + if ( klabs(hittype[pi].floorz-hittype[pi].ceilingz) < (48<<8) || j ) { if ( !(sector[s->sectnum].lotag&0x8000) && ( isanunderoperator(sector[s->sectnum].lotag) || isanearoperator(sector[s->sectnum].lotag) ) ) activatebysector(s->sectnum,pi); - if(j) + if (j) { quickkill(p); return; } } - else if( klabs(fz-cz) < (32<<8) && isanunderoperator(sector[psect].lotag) ) + else if ( klabs(fz-cz) < (32<<8) && isanunderoperator(sector[psect].lotag) ) activatebysector(psect,pi); } // center_view i = 0; - if( sb_snum&(1<<18) || p->hard_landing) + if ( sb_snum&(1<<18) || p->hard_landing) { SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_RETURNTOCENTER,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { p->return_to_center = 9; } } - if( sb_snum&(1<<13) ) + if ( sb_snum&(1<<13) ) { // look_up SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_LOOKUP,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { p->return_to_center = 9; - if( sb_snum&(1<<5) ) p->horiz += 12; // running + if ( sb_snum&(1<<5) ) p->horiz += 12; // running p->horiz += 12; i++; } } - else if( sb_snum&(1<<14) ) + else if ( sb_snum&(1<<14) ) { // look_down SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_LOOKDOWN,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { p->return_to_center = 9; - if( sb_snum&(1<<5) ) p->horiz -= 12; + if ( sb_snum&(1<<5) ) p->horiz -= 12; p->horiz -= 12; i++; } } - else if( sb_snum&(1<<3) ) + else if ( sb_snum&(1<<3) ) { // aim_up SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_AIMUP,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { // running - if( sb_snum&(1<<5) ) p->horiz += 6; + if ( sb_snum&(1<<5) ) p->horiz += 6; p->horiz += 6; i++; } } - else if( sb_snum&(1<<4) ) + else if ( sb_snum&(1<<4) ) { // aim_down SetGameVarID(g_iReturnVarID,0,pi,snum); OnEvent(EVENT_AIMDOWN,pi,snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { // running - if( sb_snum&(1<<5) ) p->horiz -= 6; + if ( sb_snum&(1<<5) ) p->horiz -= 6; p->horiz -= 6; i++; } } - if(p->return_to_center > 0) - if( (sb_snum&(1<<13)) == 0 && (sb_snum&(1<<14)) == 0 ) + if (p->return_to_center > 0) + if ( (sb_snum&(1<<13)) == 0 && (sb_snum&(1<<14)) == 0 ) { p->return_to_center--; p->horiz += 33-(p->horiz/3); i++; } - if(p->hard_landing > 0) + if (p->hard_landing > 0) { p->hard_landing--; p->horiz -= (p->hard_landing<<4); } - if(i) + if (i) { - if( p->horiz > 95 && p->horiz < 105) p->horiz = 100; - if( p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0; + if ( p->horiz > 95 && p->horiz < 105) p->horiz = 100; + if ( p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0; } p->horiz += sync[snum].horz; - if(p->horiz > 299) p->horiz = 299; - else if(p->horiz < -99) p->horiz = -99; + if (p->horiz > 299) p->horiz = 299; + else if (p->horiz < -99) p->horiz = -99; //Shooting code/changes - if(p->show_empty_weapon > 0) + if (p->show_empty_weapon > 0) { p->show_empty_weapon--; - if(p->show_empty_weapon == 0 && (p->weaponswitch & 2) && p->ammo_amount[p->curr_weapon] <= 0) + if (p->show_empty_weapon == 0 && (p->weaponswitch & 2) && p->ammo_amount[p->curr_weapon] <= 0) { - if(p->last_full_weapon == GROW_WEAPON) + if (p->last_full_weapon == GROW_WEAPON) p->subweapon |= (1<last_full_weapon == SHRINKER_WEAPON) + else if (p->last_full_weapon == SHRINKER_WEAPON) p->subweapon &= ~(1<last_full_weapon ); return; } } - if(p->knee_incs > 0) + if (p->knee_incs > 0) { p->knee_incs++; p->horiz -= 48; p->return_to_center = 9; - if(p->knee_incs > 15) + if (p->knee_incs > 15) { p->knee_incs = 0; p->holster_weapon = 0; - if(p->weapon_pos < 0) + if (p->weapon_pos < 0) p->weapon_pos = -p->weapon_pos; - if(p->actorsqu >= 0 && dist(&sprite[pi],&sprite[p->actorsqu]) < 1400 && sprite[p->actorsqu].statnum != MAXSTATUS) + if (p->actorsqu >= 0 && dist(&sprite[pi],&sprite[p->actorsqu]) < 1400 && sprite[p->actorsqu].statnum != MAXSTATUS) { guts(&sprite[p->actorsqu],JIBS6,7,myconnectindex); spawn(p->actorsqu,BLOODPOOL); spritesound(SQUISHED,p->actorsqu); - switch(dynamictostatic[sprite[p->actorsqu].picnum]) + switch (dynamictostatic[sprite[p->actorsqu].picnum]) { case FEM1__STATIC: case FEM2__STATIC: @@ -4577,17 +4593,17 @@ HORIZONLY: case PODFEM1__STATIC: case NAKED1__STATIC: case STATUE__STATIC: - if(sprite[p->actorsqu].yvel) + if (sprite[p->actorsqu].yvel) operaterespawns(sprite[p->actorsqu].yvel); break; } - if(sprite[p->actorsqu].picnum == APLAYER) + if (sprite[p->actorsqu].picnum == APLAYER) { quickkill(&ps[sprite[p->actorsqu].yvel]); ps[sprite[p->actorsqu].yvel].frag_ps = snum; } - else if(badguy(&sprite[p->actorsqu])) + else if (badguy(&sprite[p->actorsqu])) { deletesprite(p->actorsqu); p->actors_killed++; @@ -4596,23 +4612,23 @@ HORIZONLY: } p->actorsqu = -1; } - else if(p->actorsqu >= 0) + else if (p->actorsqu >= 0) p->ang += getincangle(p->ang,getangle(sprite[p->actorsqu].x-p->posx,sprite[p->actorsqu].y-p->posy))>>2; } - if( doincrements(p) ) return; + if ( doincrements(p) ) return; - if(p->weapon_pos != 0) + if (p->weapon_pos != 0) { - if(p->weapon_pos == -9) + if (p->weapon_pos == -9) { - if(p->last_weapon >= 0) + if (p->last_weapon >= 0) { p->weapon_pos = 10; // if(p->curr_weapon == KNEE_WEAPON) *kb = 1; p->last_weapon = -1; } - else if(p->holster_weapon == 0) + else if (p->holster_weapon == 0) p->weapon_pos = 10; } else p->weapon_pos--; @@ -4621,17 +4637,17 @@ HORIZONLY: // HACKS SHOOTINCODE: - if( sb_snum & (1<<19) ) // 'Holster Weapon + if ( sb_snum & (1<<19) ) // 'Holster Weapon { SetGameVarID(g_iReturnVarID,0,pi,snum); SetGameVarID(g_iWeaponVarID,p->curr_weapon,pi,snum); SetGameVarID(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],pi,snum); OnEvent(EVENT_HOLSTER, pi, snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { - if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_HOLSTER_CLEARS_CLIP) + if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_HOLSTER_CLEARS_CLIP) { - if( p->ammo_amount[p->curr_weapon] > aplWeaponClip[p->curr_weapon][snum] + if ( p->ammo_amount[p->curr_weapon] > aplWeaponClip[p->curr_weapon][snum] && (p->ammo_amount[p->curr_weapon] % aplWeaponClip[p->curr_weapon][snum]) != 0 ) { p->ammo_amount[p->curr_weapon]-= @@ -4644,24 +4660,24 @@ SHOOTINCODE: } } - if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_GLOWS) + if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_GLOWS) p->random_club_frame += 64; // Glowing - if(p->rapid_fire_hold == 1) + if (p->rapid_fire_hold == 1) { - if( sb_snum&(1<<2) ) return; + if ( sb_snum&(1<<2) ) return; p->rapid_fire_hold = 0; } - if(shrunk || p->tipincs || p->access_incs) + if (shrunk || p->tipincs || p->access_incs) sb_snum &= ~(1<<2); else if ( shrunk == 0 && (sb_snum&(1<<2)) && (*kb) == 0 && p->fist_incs == 0 && p->last_weapon == -1 && ( p->weapon_pos == 0 || p->holster_weapon == 1 ) ) { p->crack_time = 777; - if(p->holster_weapon == 1) + if (p->holster_weapon == 1) { - if( p->last_pissed_time <= (26*218) && p->weapon_pos == -9) + if ( p->last_pissed_time <= (26*218) && p->weapon_pos == -9) { p->holster_weapon = 0; p->weapon_pos = 10; @@ -4674,18 +4690,18 @@ SHOOTINCODE: SetGameVarID(g_iWeaponVarID,p->curr_weapon,pi,snum); SetGameVarID(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],pi,snum); OnEvent(EVENT_FIRE, pi, snum, -1); - if(GetGameVarID(g_iReturnVarID,pi,snum) == 0) + if (GetGameVarID(g_iReturnVarID,pi,snum) == 0) { - switch(aplWeaponWorksLike[p->curr_weapon][snum]) + switch (aplWeaponWorksLike[p->curr_weapon][snum]) { case HANDBOMB_WEAPON: OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); p->hbomb_hold_delay = 0; - if( p->ammo_amount[p->curr_weapon] > 0 ) + if ( p->ammo_amount[p->curr_weapon] > 0 ) { (*kb)=1; - if(aplWeaponInitialSound[p->curr_weapon][snum]) + if (aplWeaponInitialSound[p->curr_weapon][snum]) { spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); } @@ -4696,7 +4712,7 @@ SHOOTINCODE: OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); p->hbomb_hold_delay = 0; (*kb) = 1; - if(aplWeaponInitialSound[p->curr_weapon][snum]) + if (aplWeaponInitialSound[p->curr_weapon][snum]) { spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); } @@ -4704,10 +4720,10 @@ SHOOTINCODE: case SHOTGUN_WEAPON: OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); - if( p->ammo_amount[p->curr_weapon] > 0 && p->random_club_frame == 0 ) + if ( p->ammo_amount[p->curr_weapon] > 0 && p->random_club_frame == 0 ) { (*kb)=1; - if(aplWeaponInitialSound[p->curr_weapon][snum]) + if (aplWeaponInitialSound[p->curr_weapon][snum]) { spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); } @@ -4725,33 +4741,33 @@ SHOOTINCODE: sintable[p->ang&2047], (100-p->horiz-p->horizoff)*32, §, &hw, &hitsp, &sx, &sy, &sz,CLIPMASK1); - if(sect < 0 || hitsp >= 0) + if (sect < 0 || hitsp >= 0) break; - if( hw >= 0 && sector[sect].lotag > 2 ) + if ( hw >= 0 && sector[sect].lotag > 2 ) break; - if(hw >= 0 && wall[hw].overpicnum >= 0) - if(wall[hw].overpicnum == BIGFORCE) + if (hw >= 0 && wall[hw].overpicnum >= 0) + if (wall[hw].overpicnum == BIGFORCE) break; j = headspritesect[sect]; - while(j >= 0) + while (j >= 0) { - if( sprite[j].picnum == TRIPBOMB && + if ( sprite[j].picnum == TRIPBOMB && klabs(sprite[j].z-sz) < (12<<8) && ((sprite[j].x-sx)*(sprite[j].x-sx)+(sprite[j].y-sy)*(sprite[j].y-sy)) < (290*290) ) break; j = nextspritesect[j]; } - if(j == -1 && hw >= 0 && (wall[hw].cstat&16) == 0 ) - if( ( wall[hw].nextsector >= 0 && sector[wall[hw].nextsector].lotag <= 2 ) || ( wall[hw].nextsector == -1 && sector[sect].lotag <= 2 ) ) - if( ( (sx-p->posx)*(sx-p->posx) + (sy-p->posy)*(sy-p->posy) ) < (290*290) ) + if (j == -1 && hw >= 0 && (wall[hw].cstat&16) == 0 ) + if ( ( wall[hw].nextsector >= 0 && sector[wall[hw].nextsector].lotag <= 2 ) || ( wall[hw].nextsector == -1 && sector[sect].lotag <= 2 ) ) + if ( ( (sx-p->posx)*(sx-p->posx) + (sy-p->posy)*(sy-p->posy) ) < (290*290) ) { p->posz = p->oposz; p->poszv = 0; (*kb) = 1; - if(aplWeaponInitialSound[p->curr_weapon][snum]) + if (aplWeaponInitialSound[p->curr_weapon][snum]) { spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); } @@ -4769,7 +4785,7 @@ SHOOTINCODE: if ( p->ammo_amount[p->curr_weapon] > 0) { (*kb) = 1; - if(aplWeaponInitialSound[p->curr_weapon][snum]) + if (aplWeaponInitialSound[p->curr_weapon][snum]) { spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); } @@ -4778,11 +4794,11 @@ SHOOTINCODE: case DEVISTATOR_WEAPON: OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); - if( p->ammo_amount[p->curr_weapon] > 0 ) + if ( p->ammo_amount[p->curr_weapon] > 0 ) { (*kb) = 1; p->hbomb_hold_delay = !p->hbomb_hold_delay; - if(aplWeaponInitialSound[p->curr_weapon][snum]) + if (aplWeaponInitialSound[p->curr_weapon][snum]) { spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); } @@ -4791,10 +4807,10 @@ SHOOTINCODE: case KNEE_WEAPON: OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); - if(p->quick_kick == 0) + if (p->quick_kick == 0) { (*kb) = 1; - if(aplWeaponInitialSound[p->curr_weapon][snum]) + if (aplWeaponInitialSound[p->curr_weapon][snum]) { spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); } @@ -4804,23 +4820,23 @@ SHOOTINCODE: } } } - else if((*kb)) + else if ((*kb)) { - if(aplWeaponWorksLike[p->curr_weapon][snum] == HANDBOMB_WEAPON) + if (aplWeaponWorksLike[p->curr_weapon][snum] == HANDBOMB_WEAPON) { - if( aplWeaponHoldDelay[p->curr_weapon][snum] && ((*kb) == aplWeaponFireDelay[p->curr_weapon][snum]) && (sb_snum&(1<<2))) + if ( aplWeaponHoldDelay[p->curr_weapon][snum] && ((*kb) == aplWeaponFireDelay[p->curr_weapon][snum]) && (sb_snum&(1<<2))) { p->rapid_fire_hold = 1; return; } (*kb)++; - if((*kb)==aplWeaponHoldDelay[p->curr_weapon][snum]) + if ((*kb)==aplWeaponHoldDelay[p->curr_weapon][snum]) { long lPipeBombControl; p->ammo_amount[p->curr_weapon]--; - if(p->on_ground && (sb_snum&2) ) + if (p->on_ground && (sb_snum&2) ) { k = 15; i = ((p->horiz+p->horizoff-100)*20); @@ -4839,7 +4855,7 @@ SHOOTINCODE: lPipeBombControl=GetGameVar("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, snum); - if(lPipeBombControl & PIPEBOMB_TIMER) + if (lPipeBombControl & PIPEBOMB_TIMER) { long lGrenadeLifetime=GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, -1, snum); long lGrenadeLifetimeVar=GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, -1, snum); @@ -4851,14 +4867,14 @@ SHOOTINCODE: else hittype[j].temp_data[6]=2; - if(k == 15) + if (k == 15) { sprite[j].yvel = 3; sprite[j].z += (8<<8); } k = hits(pi); - if( k < 512 ) + if ( k < 512 ) { sprite[j].ang += 1024; sprite[j].zvel /= 3; @@ -4866,17 +4882,17 @@ SHOOTINCODE: } p->hbomb_on = 1; } - else if( (*kb) < aplWeaponHoldDelay[p->curr_weapon][snum] && (sb_snum&(1<<2)) ) + else if ( (*kb) < aplWeaponHoldDelay[p->curr_weapon][snum] && (sb_snum&(1<<2)) ) { p->hbomb_hold_delay++; } - else if( (*kb) > aplWeaponTotalTime[p->curr_weapon][snum] ) + else if ( (*kb) > aplWeaponTotalTime[p->curr_weapon][snum] ) { long lPipeBombControl=GetGameVar("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, snum); (*kb) = 0; - if(lPipeBombControl == PIPEBOMB_REMOTE) + if (lPipeBombControl == PIPEBOMB_REMOTE) { p->curr_weapon = HANDREMOTE_WEAPON; p->last_weapon = -1; @@ -4886,19 +4902,19 @@ SHOOTINCODE: checkavailweapon(p); } } - else if(aplWeaponWorksLike[p->curr_weapon][snum] == HANDREMOTE_WEAPON) + else if (aplWeaponWorksLike[p->curr_weapon][snum] == HANDREMOTE_WEAPON) { (*kb)++; - if((*kb) == aplWeaponFireDelay[p->curr_weapon][snum]) + if ((*kb) == aplWeaponFireDelay[p->curr_weapon][snum]) { - if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_BOMB_TRIGGER) + if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_BOMB_TRIGGER) { p->hbomb_on = 0; } - if(aplWeaponShoots[p->curr_weapon][snum] != 0) + if (aplWeaponShoots[p->curr_weapon][snum] != 0) { - if(! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE )) + if (! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE )) { lastvisinc = totalclock+32; p->visibility = 0; @@ -4909,11 +4925,11 @@ SHOOTINCODE: } } - if((*kb) >= aplWeaponTotalTime[p->curr_weapon][snum]) + if ((*kb) >= aplWeaponTotalTime[p->curr_weapon][snum]) { long lPipeBombControl=GetGameVar("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, snum); (*kb) = 0; - if((p->ammo_amount[HANDBOMB_WEAPON] > 0) && lPipeBombControl == PIPEBOMB_REMOTE) + if ((p->ammo_amount[HANDBOMB_WEAPON] > 0) && lPipeBombControl == PIPEBOMB_REMOTE) addweapon(p,HANDBOMB_WEAPON); else checkavailweapon(p); @@ -4924,42 +4940,42 @@ SHOOTINCODE: // the basic weapon... (*kb)++; - if(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_CHECKATRELOAD) + if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_CHECKATRELOAD) { if (aplWeaponWorksLike[p->curr_weapon][snum] == TRIPBOMB_WEAPON) { - if((*kb) >= aplWeaponTotalTime[p->curr_weapon][snum]) + if ((*kb) >= aplWeaponTotalTime[p->curr_weapon][snum]) { (*kb) = 0; checkavailweapon(p); p->weapon_pos = -9; } } - else if(*kb >= aplWeaponReload[p->curr_weapon][snum]) + else if (*kb >= aplWeaponReload[p->curr_weapon][snum]) checkavailweapon(p); } - else if(aplWeaponWorksLike[p->curr_weapon][snum]!=KNEE_WEAPON && *kb >= aplWeaponFireDelay[p->curr_weapon][snum]) + else if (aplWeaponWorksLike[p->curr_weapon][snum]!=KNEE_WEAPON && *kb >= aplWeaponFireDelay[p->curr_weapon][snum]) checkavailweapon(p); - if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_STANDSTILL + if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_STANDSTILL && *kb < (aplWeaponFireDelay[p->curr_weapon][snum]+1) ) { p->posz = p->oposz; p->poszv = 0; } - if(*kb == aplWeaponSound2Time[p->curr_weapon][snum]) + if (*kb == aplWeaponSound2Time[p->curr_weapon][snum]) { - if(aplWeaponSound2Sound[p->curr_weapon][snum]) + if (aplWeaponSound2Sound[p->curr_weapon][snum]) { spritesound(aplWeaponSound2Sound[p->curr_weapon][snum],pi); } } - if(*kb == aplWeaponSpawnTime[p->curr_weapon][snum]) + if (*kb == aplWeaponSpawnTime[p->curr_weapon][snum]) DoSpawn(p); if ((*kb) >= aplWeaponTotalTime[p->curr_weapon][snum]) { - if(/*!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_CHECKATRELOAD) && */ p->reloading == 1 || + if (/*!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_CHECKATRELOAD) && */ p->reloading == 1 || (aplWeaponReload[p->curr_weapon][snum] > aplWeaponTotalTime[p->curr_weapon][snum] && p->ammo_amount[p->curr_weapon] > 0 && (aplWeaponClip[p->curr_weapon][snum]) && (((p->ammo_amount[p->curr_weapon]%(aplWeaponClip[p->curr_weapon][snum]))==0)))) { @@ -4967,20 +4983,20 @@ SHOOTINCODE: p->reloading = 1; - if( (*kb) != (aplWeaponTotalTime[p->curr_weapon][snum])) + if ( (*kb) != (aplWeaponTotalTime[p->curr_weapon][snum])) { - if( (*kb) == (aplWeaponTotalTime[p->curr_weapon][snum]+1)) + if ( (*kb) == (aplWeaponTotalTime[p->curr_weapon][snum]+1)) { - if(aplWeaponReloadSound1[p->curr_weapon][snum]) + if (aplWeaponReloadSound1[p->curr_weapon][snum]) spritesound(aplWeaponReloadSound1[p->curr_weapon][snum],pi); } - else if( ((*kb) == (aplWeaponReload[p->curr_weapon][snum] - (i/3)) && !(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RELOAD_TIMING)) || - ((*kb) == (aplWeaponReload[p->curr_weapon][snum] - i+4) && (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RELOAD_TIMING)) ) + else if ( ((*kb) == (aplWeaponReload[p->curr_weapon][snum] - (i/3)) && !(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RELOAD_TIMING)) || + ((*kb) == (aplWeaponReload[p->curr_weapon][snum] - i+4) && (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RELOAD_TIMING)) ) { - if(aplWeaponReloadSound2[p->curr_weapon][snum]) + if (aplWeaponReloadSound2[p->curr_weapon][snum]) spritesound(aplWeaponReloadSound2[p->curr_weapon][snum],pi); } - else if( (*kb) >= (aplWeaponReload[p->curr_weapon][snum]) ) + else if ( (*kb) >= (aplWeaponReload[p->curr_weapon][snum]) ) { *kb=0; p->reloading = 0; @@ -4992,9 +5008,9 @@ SHOOTINCODE: if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AUTOMATIC && (aplWeaponWorksLike[p->curr_weapon][snum]==KNEE_WEAPON?1:p->ammo_amount[p->curr_weapon] > 0)) { - if( sb_snum&(1<<2) ) + if ( sb_snum&(1<<2) ) { - if(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RANDOMRESTART) + if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RANDOMRESTART) *kb = 1+(TRAND&3); else *kb=1; } @@ -5002,10 +5018,10 @@ SHOOTINCODE: } else *kb = 0; - if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET && + if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET && ((aplWeaponWorksLike[p->curr_weapon][snum] == KNEE_WEAPON)?1:p->ammo_amount[p->curr_weapon] > 0)) { - if( sb_snum&(1<<2) ) *kb = 1; + if ( sb_snum&(1<<2) ) *kb = 1; else *kb = 0; } } @@ -5015,49 +5031,49 @@ SHOOTINCODE: { if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AUTOMATIC ) { - if(!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SEMIAUTO)) + if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SEMIAUTO)) { - if(( sb_snum&(1<<2) ) == 0 && aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET) + if (( sb_snum&(1<<2) ) == 0 && aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET) *kb = 0; if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYTHIRD) { - if( ((*(kb))%3) == 0 ) + if ( ((*(kb))%3) == 0 ) { DoFire(p); DoSpawn(p); } } - else if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYOTHER) + else if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYOTHER) { DoFire(p); DoSpawn(p); } else { - if(*kb == aplWeaponFireDelay[p->curr_weapon][snum]) + if (*kb == aplWeaponFireDelay[p->curr_weapon][snum]) { DoFire(p); // DoSpawn(p); } } - if(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET && + if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET && (*kb) > aplWeaponTotalTime[p->curr_weapon][snum]-aplWeaponHoldDelay[p->curr_weapon][snum] && ((aplWeaponWorksLike[p->curr_weapon][snum] == KNEE_WEAPON)?1:p->ammo_amount[p->curr_weapon] > 0)) { - if( sb_snum&(1<<2) ) *kb = 1; + if ( sb_snum&(1<<2) ) *kb = 1; else *kb = 0; } } else { - if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYOTHER) + if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYOTHER) { DoFire(p); DoSpawn(p); } else { - if(*kb == aplWeaponFireDelay[p->curr_weapon][snum]) + if (*kb == aplWeaponFireDelay[p->curr_weapon][snum]) { DoFire(p); // DoSpawn(p); @@ -5065,7 +5081,7 @@ SHOOTINCODE: } } } - else if(*kb == aplWeaponFireDelay[p->curr_weapon][snum]) + else if (*kb == aplWeaponFireDelay[p->curr_weapon][snum]) DoFire(p); } } @@ -5075,43 +5091,75 @@ SHOOTINCODE: //UPDATE THIS FILE OVER THE OLD GETSPRITESCORE/COMPUTERGETINPUT FUNCTIONS int getspritescore(long snum, long dapicnum) { - switch(dynamictostatic[dapicnum]) + switch (dynamictostatic[dapicnum]) { - case FIRSTGUNSPRITE__STATIC: return(20); - case CHAINGUNSPRITE__STATIC: return(50); - case RPGSPRITE__STATIC: return(200); - case FREEZESPRITE__STATIC: return(25); - case SHRINKERSPRITE__STATIC: return(80); - case HEAVYHBOMB__STATIC: return(60); - case TRIPBOMBSPRITE__STATIC: return(50); - case SHOTGUNSPRITE__STATIC: return(120); - case DEVISTATORSPRITE__STATIC: return(120); + case FIRSTGUNSPRITE__STATIC: + return(20); + case CHAINGUNSPRITE__STATIC: + return(50); + case RPGSPRITE__STATIC: + return(200); + case FREEZESPRITE__STATIC: + return(25); + case SHRINKERSPRITE__STATIC: + return(80); + case HEAVYHBOMB__STATIC: + return(60); + case TRIPBOMBSPRITE__STATIC: + return(50); + case SHOTGUNSPRITE__STATIC: + return(120); + case DEVISTATORSPRITE__STATIC: + return(120); - case FREEZEAMMO__STATIC: if (ps[snum].ammo_amount[FREEZE_WEAPON] < max_ammo_amount[FREEZE_WEAPON]) return(10); else return(0); - case AMMO__STATIC: if (ps[snum].ammo_amount[PISTOL_WEAPON] < max_ammo_amount[PISTOL_WEAPON]) return(10); else return(0); - case BATTERYAMMO__STATIC: if (ps[snum].ammo_amount[CHAINGUN_WEAPON] < max_ammo_amount[CHAINGUN_WEAPON]) return(20); else return(0); - case DEVISTATORAMMO__STATIC: if (ps[snum].ammo_amount[DEVISTATOR_WEAPON] < max_ammo_amount[DEVISTATOR_WEAPON]) return(25); else return(0); - case RPGAMMO__STATIC: if (ps[snum].ammo_amount[RPG_WEAPON] < max_ammo_amount[RPG_WEAPON]) return(50); else return(0); - case CRYSTALAMMO__STATIC: if (ps[snum].ammo_amount[SHRINKER_WEAPON] < max_ammo_amount[SHRINKER_WEAPON]) return(10); else return(0); - case HBOMBAMMO__STATIC: if (ps[snum].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON]) return(30); else return(0); - case SHOTGUNAMMO__STATIC: if (ps[snum].ammo_amount[SHOTGUN_WEAPON] < max_ammo_amount[SHOTGUN_WEAPON]) return(25); else return(0); + case FREEZEAMMO__STATIC: + if (ps[snum].ammo_amount[FREEZE_WEAPON] < max_ammo_amount[FREEZE_WEAPON]) return(10); else return(0); + case AMMO__STATIC: + if (ps[snum].ammo_amount[PISTOL_WEAPON] < max_ammo_amount[PISTOL_WEAPON]) return(10); else return(0); + case BATTERYAMMO__STATIC: + if (ps[snum].ammo_amount[CHAINGUN_WEAPON] < max_ammo_amount[CHAINGUN_WEAPON]) return(20); else return(0); + case DEVISTATORAMMO__STATIC: + if (ps[snum].ammo_amount[DEVISTATOR_WEAPON] < max_ammo_amount[DEVISTATOR_WEAPON]) return(25); else return(0); + case RPGAMMO__STATIC: + if (ps[snum].ammo_amount[RPG_WEAPON] < max_ammo_amount[RPG_WEAPON]) return(50); else return(0); + case CRYSTALAMMO__STATIC: + if (ps[snum].ammo_amount[SHRINKER_WEAPON] < max_ammo_amount[SHRINKER_WEAPON]) return(10); else return(0); + case HBOMBAMMO__STATIC: + if (ps[snum].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON]) return(30); else return(0); + case SHOTGUNAMMO__STATIC: + if (ps[snum].ammo_amount[SHOTGUN_WEAPON] < max_ammo_amount[SHOTGUN_WEAPON]) return(25); else return(0); - case COLA__STATIC: if (sprite[ps[snum].i].extra < 100) return(10); else return(0); - case SIXPAK__STATIC: if (sprite[ps[snum].i].extra < 100) return(30); else return(0); - case FIRSTAID__STATIC: if (ps[snum].firstaid_amount < 100) return(100); else return(0); - case SHIELD__STATIC: if (ps[snum].shield_amount < 100) return(50); else return(0); - case STEROIDS__STATIC: if (ps[snum].steroids_amount < 400) return(30); else return(0); - case AIRTANK__STATIC: if (ps[snum].scuba_amount < 6400) return(30); else return(0); - case JETPACK__STATIC: if (ps[snum].jetpack_amount < 1600) return(100); else return(0); - case HEATSENSOR__STATIC: if (ps[snum].heat_amount < 1200) return(5); else return(0); - case ACCESSCARD__STATIC: return(1); - case BOOTS__STATIC: if (ps[snum].boot_amount < 200) return(15); else return(0); - case ATOMICHEALTH__STATIC: if (sprite[ps[snum].i].extra < max_player_health<<1) return(50); else return(0); - case HOLODUKE__STATIC: if (ps[snum].holoduke_amount < 2400) return(5); else return(0); + case COLA__STATIC: + if (sprite[ps[snum].i].extra < 100) return(10); else return(0); + case SIXPAK__STATIC: + if (sprite[ps[snum].i].extra < 100) return(30); else return(0); + case FIRSTAID__STATIC: + if (ps[snum].firstaid_amount < 100) return(100); else return(0); + case SHIELD__STATIC: + if (ps[snum].shield_amount < 100) return(50); else return(0); + case STEROIDS__STATIC: + if (ps[snum].steroids_amount < 400) return(30); else return(0); + case AIRTANK__STATIC: + if (ps[snum].scuba_amount < 6400) return(30); else return(0); + case JETPACK__STATIC: + if (ps[snum].jetpack_amount < 1600) return(100); else return(0); + case HEATSENSOR__STATIC: + if (ps[snum].heat_amount < 1200) return(5); else return(0); + case ACCESSCARD__STATIC: + return(1); + case BOOTS__STATIC: + if (ps[snum].boot_amount < 200) return(15); else return(0); + case ATOMICHEALTH__STATIC: + if (sprite[ps[snum].i].extra < max_player_health<<1) return(50); else return(0); + case HOLODUKE__STATIC: + if (ps[snum].holoduke_amount < 2400) return(5); else return(0); - case SECTOREFFECTOR__STATIC: return(1); - case TOUCHPLATE__STATIC: return(1); - case MUSICANDSFX__STATIC: return(1); + case SECTOREFFECTOR__STATIC: + return(1); + case TOUCHPLATE__STATIC: + return(1); + case MUSICANDSFX__STATIC: + return(1); } return(0); } @@ -5176,7 +5224,7 @@ void computergetinput(long snum, input *syn) if ((goalplayer[snum] == snum) || (ps[goalplayer[snum]].dead_flag != 0)) { j = 0x7fffffff; - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != snum && !(GTFLAGS(GAMETYPE_FLAG_TDM) && ps[snum].team == ps[i].team)) { dist = ksqrt((sprite[ps[i].i].x-x1)*(sprite[ps[i].i].x-x1)+(sprite[ps[i].i].y-y1)*(sprite[ps[i].i].y-y1)); @@ -5188,6 +5236,7 @@ void computergetinput(long snum, input *syn) dist <<= 1; if (dist < j) { j = dist; goalplayer[snum] = i; } + } } @@ -5199,22 +5248,27 @@ void computergetinput(long snum, input *syn) if ((p->firstaid_amount > 0) && (p->last_extra < 100)) syn->bits |= (1<<16); - for(j=headspritestat[4];j>=0;j=nextspritestat[j]) + for (j=headspritestat[4];j>=0;j=nextspritestat[j]) { switch (dynamictostatic[sprite[j].picnum]) { - case TONGUE__STATIC: k = 4; break; - case FREEZEBLAST__STATIC: k = 4; break; - case SHRINKSPARK__STATIC: k = 16; break; - case RPG__STATIC: k = 16; break; - default: k = 0; break; + case TONGUE__STATIC: + k = 4; break; + case FREEZEBLAST__STATIC: + k = 4; break; + case SHRINKSPARK__STATIC: + k = 16; break; + case RPG__STATIC: + k = 16; break; + default: + k = 0; break; } if (k) { 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) { @@ -5314,11 +5368,11 @@ void computergetinput(long snum, input *syn) searchsect[0] = startsect; searchparent[0] = -1; dashow2dsector[startsect>>3] |= (1<<(startsect&7)); - for(splc=0,send=1;splcnextsector; if (j < 0) continue; @@ -5337,17 +5391,17 @@ void computergetinput(long snum, input *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 l) { l = dist; k = i; } + } goalwall[snum] = k; daang = ((getangle(wall[wall[k].point2].x-wall[k].x,wall[wall[k].point2].y-wall[k].y)+1536)&2047); @@ -5383,7 +5438,7 @@ void computergetinput(long snum, input *syn) } } - for(i=headspritesect[searchsect[splc]];i>=0;i=nextspritesect[i]) + for (i=headspritesect[searchsect[splc]];i>=0;i=nextspritesect[i]) if (sprite[i].lotag == 7) { j = sprite[sprite[i].owner].sectnum; @@ -5396,23 +5451,24 @@ void computergetinput(long snum, input *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[startsect].wallptr; endwall = startwall+sector[startsect].wallnum; l = 0; k = startwall; - for(i=startwall;i l)) { l = dist; k = i; } + } goalwall[snum] = k; daang = ((getangle(wall[wall[k].point2].x-wall[k].x,wall[wall[k].point2].y-wall[k].y)+1536)&2047); @@ -5431,15 +5487,16 @@ void computergetinput(long snum, input *syn) { if (goalsprite[snum] < 0) { - for(k=0;k<4;k++) + for (k=0;k<4;k++) { i = (rand()%numsectors); - for(j=headspritesect[i];j>=0;j=nextspritesect[j]) + for (j=headspritesect[i];j>=0;j=nextspritesect[j]) { if ((sprite[j].xrepeat <= 0) || (sprite[j].yrepeat <= 0)) continue; if (getspritescore(snum,sprite[j].picnum) <= 0) continue; if (cansee(x1,y1,z1-(32<<8),damysect,sprite[j].x,sprite[j].y,sprite[j].z-(4<<8),i)) { goalx[snum] = sprite[j].x; goaly[snum] = sprite[j].y; goalz[snum] = sprite[j].z; goalsprite[snum] = j; break; } + } } } diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 312748713..b688f0369 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -62,27 +62,27 @@ void cachespritenum(short i) char maxc; short j; - if(ud.monsters_off && badguy(&sprite[i])) return; + if (ud.monsters_off && badguy(&sprite[i])) return; maxc = 1; - if(spritecache[PN][0] == PN) - for(j = PN; j <= spritecache[PN][1]; j++) + if (spritecache[PN][0] == PN) + for (j = PN; j <= spritecache[PN][1]; j++) tloadtile(j,1); - switch(dynamictostatic[PN]) + switch (dynamictostatic[PN]) { case HYDRENT__STATIC: tloadtile(BROKEFIREHYDRENT,1); - for(j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1); + for (j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1); break; case TOILET__STATIC: tloadtile(TOILETBROKE,1); - for(j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1); + for (j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1); break; case STALL__STATIC: tloadtile(STALLBROKE,1); - for(j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1); + for (j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1); break; case RUBBERCAN__STATIC: maxc = 2; @@ -99,13 +99,13 @@ void cachespritenum(short i) case LIZTROOPJETPACK__STATIC: case LIZTROOPONTOILET__STATIC: case LIZTROOPDUCKING__STATIC: - for(j = LIZTROOP; j < (LIZTROOP+72); j++) tloadtile(j,1); - for(j=HEADJIB1;j 1) + if (ud.multimode > 1) { maxc = 5; - for(j = 1420;j < 1420+106; j++) tloadtile(j,1); + for (j = 1420;j < 1420+106; j++) tloadtile(j,1); } break; case ATOMICHEALTH__STATIC: @@ -163,61 +163,69 @@ void cachespritenum(short i) maxc = 5; break; // caching of HUD sprites for weapons that may be in the level - case CHAINGUNSPRITE__STATIC: for (j=CHAINGUN; j<=CHAINGUN+7; j++) tloadtile(j,1); break; - case RPGSPRITE__STATIC: for (j=RPGGUN; j<=RPGGUN+2; j++) tloadtile(j,1); break; - case FREEZESPRITE__STATIC: for (j=FREEZE; j<=FREEZE+5; j++) tloadtile(j,1); break; + case CHAINGUNSPRITE__STATIC: + for (j=CHAINGUN; j<=CHAINGUN+7; j++) tloadtile(j,1); break; + case RPGSPRITE__STATIC: + for (j=RPGGUN; j<=RPGGUN+2; j++) tloadtile(j,1); break; + case FREEZESPRITE__STATIC: + for (j=FREEZE; j<=FREEZE+5; j++) tloadtile(j,1); break; case GROWSPRITEICON__STATIC: - case SHRINKERSPRITE__STATIC: for (j=SHRINKER-2; j<=SHRINKER+5; j++) tloadtile(j,1); break; + case SHRINKERSPRITE__STATIC: + for (j=SHRINKER-2; j<=SHRINKER+5; j++) tloadtile(j,1); break; case HBOMBAMMO__STATIC: - case HEAVYHBOMB__STATIC: for (j=HANDREMOTE; j<=HANDREMOTE+5; j++) tloadtile(j,1); break; - case TRIPBOMBSPRITE__STATIC: for (j=HANDHOLDINGLASER; j<=HANDHOLDINGLASER+4; j++) tloadtile(j,1); break; - case SHOTGUNSPRITE__STATIC: tloadtile(SHOTGUNSHELL,1); for (j=SHOTGUN; j<=SHOTGUN+6; j++) tloadtile(j,1); break; - case DEVISTATORSPRITE__STATIC: for (j=DEVISTATOR; j<=DEVISTATOR+1; j++) tloadtile(j,1); break; + case HEAVYHBOMB__STATIC: + for (j=HANDREMOTE; j<=HANDREMOTE+5; j++) tloadtile(j,1); break; + case TRIPBOMBSPRITE__STATIC: + for (j=HANDHOLDINGLASER; j<=HANDHOLDINGLASER+4; j++) tloadtile(j,1); break; + case SHOTGUNSPRITE__STATIC: + tloadtile(SHOTGUNSHELL,1); for (j=SHOTGUN; j<=SHOTGUN+6; j++) tloadtile(j,1); break; + case DEVISTATORSPRITE__STATIC: + for (j=DEVISTATOR; j<=DEVISTATOR+1; j++) tloadtile(j,1); break; } - for(j = PN; j < (PN+maxc); j++) tloadtile(j,1); + for (j = PN; j < (PN+maxc); j++) tloadtile(j,1); } void cachegoodsprites(void) { short i,j; - for(i=0;i 1) + if ( ud.multimode > 1) tloadtile(FRAGBAR,1); tloadtile(VIEWSCREEN,1); - for(i=STARTALPHANUM;i= NUM_SOUNDS || SoundToggle == 0) return 0; + if (num >= NUM_SOUNDS || SoundToggle == 0) return 0; if (FXDevice < 0) return 0; if (!sounds[num][0]) return 0; fp = kopen4load(sounds[num],loadfromgrouponly); - if(fp == -1) return 0; + if (fp == -1) return 0; l = kfilelength( fp ); soundsiz[num] = l; - if( (ud.level_number == 0 && ud.volume_number == 0 && (num == 189 || num == 232 || num == 99 || num == 233 || num == 17 ) ) || + if ( (ud.level_number == 0 && ud.volume_number == 0 && (num == 189 || num == 232 || num == 99 || num == 233 || num == 17 ) ) || ( l < 12288 ) ) { Sound[num].lock = 199; allocache((long *)&Sound[num].ptr,l,(char *)&Sound[num].lock); - if(Sound[num].ptr != NULL) + if (Sound[num].ptr != NULL) kread( fp, Sound[num].ptr , l); } kclose( fp ); @@ -261,11 +269,11 @@ void precachenecessarysounds(void) if (FXDevice < 0) return; j = 0; - for(i=0;i= 0) { + if (wall[i].overpicnum >= 0) { tloadtile(wall[i].overpicnum, 0); } } - for(i=0;i= 0) + while (j >= 0) { - if(sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0) + if (sprite[j].xrepeat != 0 && sprite[j].yrepeat != 0 && (sprite[j].cstat&32768) == 0) cachespritenum(j); j = nextspritesect[j]; } @@ -317,12 +325,12 @@ void cacheit(void) tc = totalclock; j = 0; - for(i=0;i>3]) { i+=7; continue; } - if(gotpic[i>>3] & pow2char[i&7]) { + if (gotpic[i>>3] & pow2char[i&7]) { if (waloff[i] == 0) loadtile((short)i); @@ -341,7 +349,7 @@ void cacheit(void) pc++; } else continue; - if((j&7) == 0) { handleevents(); getpackets(); } + if ((j&7) == 0) { handleevents(); getpackets(); } if (totalclock - tc > TICRATE/4) { sprintf(tempbuf,"Loading textures ... %ld%%\n",min(100,100*pc/precachecount)); dofrontscreens(tempbuf); @@ -373,10 +381,10 @@ void vscrn(void) { long i, j, ss, x1, x2, y1, y2; - if(ud.screen_size < 0) ud.screen_size = 0; - else if(ud.screen_size > 63) ud.screen_size = 64; + if (ud.screen_size < 0) ud.screen_size = 0; + else if (ud.screen_size > 63) ud.screen_size = 64; - if(ud.screen_size == 0) flushperms(); + if (ud.screen_size == 0) flushperms(); ss = max(ud.screen_size-8,0); @@ -387,8 +395,8 @@ void vscrn(void) if ( ud.screen_size > 0 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_FRAGBAR) && ud.multimode > 1) { j = 0; - for(i=connecthead;i>=0;i=connectpoint2[i]) - if(i > j) j = i; + for (i=connecthead;i>=0;i=connectpoint2[i]) + if (i > j) j = i; if (j >= 1) y1 += 8; if (j >= 4) y1 += 8; @@ -415,18 +423,18 @@ void pickrandomspot(short snum) p = &ps[snum]; - if( ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_FIXEDRESPAWN)) + if ( ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_FIXEDRESPAWN)) { - if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDMSPAWN) + if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDMSPAWN) { - for(j=0;j 0) + if (j != snum && ps[j].team == ps[snum].team && sprite[ps[j].i].extra > 0) { - for(k=0;krapid_fire_hold = 0; p->toggle_key_flag = 0; p->access_spritenum = -1; - if(ud.multimode > 1 && (gametype_flags[ud.coop] & GAMETYPE_FLAG_ACCESSATSTART)) + if (ud.multimode > 1 && (gametype_flags[ud.coop] & GAMETYPE_FLAG_ACCESSATSTART)) p->got_access = 7; else p->got_access = 0; p->random_club_frame= 0; @@ -505,7 +513,7 @@ void resetplayerstats(short snum) p->sbs = 0; p->palette = (char *) &palette[0]; - if(p->steroids_amount < 400 ) + if (p->steroids_amount < 400 ) { p->steroids_amount = 0; p->inven_icon = 0; @@ -532,7 +540,7 @@ void resetplayerstats(short snum) p->on_crane = -1; - if( (aplWeaponWorksLike[p->curr_weapon][snum] == PISTOL_WEAPON) && + if ( (aplWeaponWorksLike[p->curr_weapon][snum] == PISTOL_WEAPON) && (aplWeaponReload[p->curr_weapon][snum] > aplWeaponTotalTime[p->curr_weapon][snum]) ) p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum]+1; else p->kickback_pic = 0; @@ -608,7 +616,7 @@ void resetprestat(short snum,char g) p = &ps[snum]; spriteqloc = 0; - for(i=0;ihbomb_on = 0; p->cheat_phase = 0; @@ -647,12 +655,12 @@ void resetprestat(short snum,char g) numinterpolations = 0; startofdynamicinterpolations = 0; - if( ( (g&MODE_EOL) != MODE_EOL && numplayers < 2) || (!(gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && numplayers > 1) ) + if ( ( (g&MODE_EOL) != MODE_EOL && numplayers < 2) || (!(gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && numplayers > 1) ) { resetweapons(snum); resetinventory(snum); } - else if(p->curr_weapon == HANDREMOTE_WEAPON) + else if (p->curr_weapon == HANDREMOTE_WEAPON) { p->ammo_amount[HANDBOMB_WEAPON]++; p->curr_weapon = HANDBOMB_WEAPON; @@ -667,12 +675,12 @@ void setupbackdrop(short sky) { short i; - for(i=0;i sector[i].ceilingz) + if ( sector[i].floorz > sector[i].ceilingz) sector[i].lotag |= 32768; continue; } - if(sector[i].ceilingstat&1) + if (sector[i].ceilingstat&1) { - if(waloff[sector[i].ceilingpicnum] == 0) + if (waloff[sector[i].ceilingpicnum] == 0) { - if(sector[i].ceilingpicnum == LA) - for(j=0;j<5;j++) + if (sector[i].ceilingpicnum == LA) + for (j=0;j<5;j++) tloadtile(sector[i].ceilingpicnum+j, 0); } setupbackdrop(sector[i].ceilingpicnum); - if(sector[i].ceilingpicnum == CLOUDYSKIES && numclouds < 127) + if (sector[i].ceilingpicnum == CLOUDYSKIES && numclouds < 127) clouds[numclouds++] = i; - if(ps[0].one_parallax_sectnum == -1) + if (ps[0].one_parallax_sectnum == -1) ps[0].one_parallax_sectnum = i; } - if(sector[i].lotag == 32767) //Found a secret room + if (sector[i].lotag == 32767) //Found a secret room { ps[0].max_secret_rooms++; continue; } - if(sector[i].lotag == -1) + if (sector[i].lotag == -1) { ps[0].exitx = wall[sector[i].wallptr].x; ps[0].exity = wall[sector[i].wallptr].y; @@ -752,17 +760,17 @@ void prelevel(char g) } i = headspritestat[0]; - while(i >= 0) + while (i >= 0) { nexti = nextspritestat[i]; ResetActorGameVars(i); LoadActor(i, -1, -1); - if(sprite[i].lotag == -1 && (sprite[i].cstat&16) ) + if (sprite[i].lotag == -1 && (sprite[i].cstat&16) ) { ps[0].exitx = SX; ps[0].exity = SY; } - else switch(dynamictostatic[PN]) + else switch (dynamictostatic[PN]) { case GPSPEED__STATIC: sector[SECT].extra = SLT; @@ -770,7 +778,7 @@ void prelevel(char g) break; case CYCLER__STATIC: - if(numcyclers >= MAXCYCLERS) + if (numcyclers >= MAXCYCLERS) { Bsprintf(tempbuf,"\nToo many cycling sectors (%d max).",MAXCYCLERS); gameexit(tempbuf); @@ -799,29 +807,29 @@ void prelevel(char g) i = nexti; } - for(i=0;i < MAXSPRITES;i++) + for (i=0;i < MAXSPRITES;i++) { - if(sprite[i].statnum < MAXSTATUS) + if (sprite[i].statnum < MAXSTATUS) { - if(PN == SECTOREFFECTOR && SLT == 14) + if (PN == SECTOREFFECTOR && SLT == 14) continue; spawn(-1,i); } } - for(i=0;i < MAXSPRITES;i++) - if(sprite[i].statnum < MAXSTATUS) + for (i=0;i < MAXSPRITES;i++) + if (sprite[i].statnum < MAXSTATUS) { - if( PN == SECTOREFFECTOR && SLT == 14 ) + if ( PN == SECTOREFFECTOR && SLT == 14 ) spawn(-1,i); } lotaglist = 0; i = headspritestat[0]; - while(i >= 0) + while (i >= 0) { - switch(dynamictostatic[PN-1]) + switch (dynamictostatic[PN-1]) { case DIPSWITCH__STATIC: case DIPSWITCH2__STATIC: @@ -836,21 +844,21 @@ void prelevel(char g) case POWERSWITCH1__STATIC: case LOCKSWITCH1__STATIC: case POWERSWITCH2__STATIC: - for(j=0;j 64) + if (lotaglist > 64) gameexit("\nToo many switches (64 max)."); j = headspritestat[3]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].lotag == 12 && sprite[j].hitag == SLT) + if (sprite[j].lotag == 12 && sprite[j].hitag == SLT) hittype[j].temp_data[0] = 1; j = nextspritestat[j]; } @@ -862,16 +870,16 @@ void prelevel(char g) mirrorcnt = 0; - for( i = 0; i < numwalls; i++ ) + for ( i = 0; i < numwalls; i++ ) { walltype *wal; wal = &wall[i]; - if(wal->overpicnum == MIRROR && (wal->cstat&32) != 0) + if (wal->overpicnum == MIRROR && (wal->cstat&32) != 0) { j = wal->nextsector; - if(mirrorcnt > 63) + if (mirrorcnt > 63) gameexit("\nToo many mirrors (64 max.)"); if ( (j >= 0) && sector[j].ceilingpicnum != MIRROR ) { @@ -884,7 +892,7 @@ void prelevel(char g) } } - if(numanimwalls >= MAXANIMWALLS) + if (numanimwalls >= MAXANIMWALLS) { Bsprintf(tempbuf,"\nToo many 'anim' walls (%d max).",MAXANIMWALLS); gameexit(tempbuf); @@ -896,7 +904,7 @@ void prelevel(char g) if ((wal->overpicnum > W_FORCEFIELD)&&(wal->overpicnum <= W_FORCEFIELD+2)) { switchpicnum = W_FORCEFIELD; } - switch(dynamictostatic[switchpicnum]) + switch (dynamictostatic[switchpicnum]) { case FANSHADOW__STATIC: case FANSPRITE__STATIC: @@ -907,14 +915,14 @@ void prelevel(char g) case W_FORCEFIELD__STATIC: if (wal->overpicnum==W_FORCEFIELD__STATIC) - for(j=0;j<3;j++) + for (j=0;j<3;j++) tloadtile(W_FORCEFIELD+j, 0); - if(wal->shade > 31) + if (wal->shade > 31) wal->cstat = 0; else wal->cstat |= 85+256; - if(wal->lotag && wal->nextwall >= 0) + if (wal->lotag && wal->nextwall >= 0) wall[wal->nextwall].lotag = wal->lotag; @@ -928,10 +936,10 @@ void prelevel(char g) wal->extra = -1; - switch(dynamictostatic[wal->picnum]) + switch (dynamictostatic[wal->picnum]) { case WATERTILE2__STATIC: - for(j=0;j<3;j++) + for (j=0;j<3;j++) tloadtile(wal->picnum+j, 0); break; @@ -950,7 +958,7 @@ void prelevel(char g) case SCREENBREAK6__STATIC: case SCREENBREAK7__STATIC: case SCREENBREAK8__STATIC: - for(j=SCREENBREAK6;jextra = wal->picnum; animwall[numanimwalls].tag = -1; - if(ud.lockout) + if (ud.lockout) { - if(wal->picnum == FEMPIC1) + if (wal->picnum == FEMPIC1) wal->picnum = BLANKSCREEN; else wal->picnum = SCREENBREAK6; } @@ -1001,11 +1009,11 @@ void prelevel(char g) } //Invalidate textures in sector behind mirror - for(i=0;i= 0 && FXDevice >= 0 && SoundToggle) - while(issoundplaying(-1,globalskillsound)) { handleevents(); getpackets(); } + if (globalskillsound >= 0 && FXDevice >= 0 && SoundToggle) + while (issoundplaying(-1,globalskillsound)) { handleevents(); getpackets(); } else { handleevents(); getpackets(); } globalskillsound = -1; waitforeverybody(); ready2send = 0; - if( ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && (ud.coop&GAMETYPE_FLAG_SCORESHEET)) + if ( ud.m_recstat != 2 && ud.last_level >= 0 && ud.multimode > 1 && (ud.coop&GAMETYPE_FLAG_SCORESHEET)) dobonus(1); - if( ln == 0 && vn == 3 && ud.multimode < 2 && ud.lockout == 0) + if ( ln == 0 && vn == 3 && ud.multimode < 2 && ud.lockout == 0) { playmusic(&env_music_fn[1][0]); @@ -1072,19 +1080,19 @@ void newgame(char vn,char ln,char sk) ResetSystemDefaults(); - if(ud.m_coop != 1) + if (ud.m_coop != 1) { - for(i=0;icurr_weapon = i; p->gotweapon[i] = 1; p->ammo_amount[i] = 48; } - else if(aplWeaponWorksLike[i][0]==KNEE_WEAPON) + else if (aplWeaponWorksLike[i][0]==KNEE_WEAPON) p->gotweapon[i] = 1; - else if(aplWeaponWorksLike[i][0]==HANDREMOTE_WEAPON) + else if (aplWeaponWorksLike[i][0]==HANDREMOTE_WEAPON) p->gotweapon[i] = 1; } p->last_weapon = -1; @@ -1092,12 +1100,12 @@ void newgame(char vn,char ln,char sk) } display_mirror = 0; - if(ud.multimode > 1 ) + if (ud.multimode > 1 ) { - if(numplayers < 2) + if (numplayers < 2) { connecthead = 0; - for(i=0;i 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0) + if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0) { - for(j=0;j 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0) + if (ud.multimode > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0) { - for(j=0;j= 0) + while (i >= 0) { nexti = nextspritestat[i]; s = &sprite[i]; - if( numplayersprites == MAXPLAYERS) + if ( numplayersprites == MAXPLAYERS) gameexit("\nToo many player sprites (max 16.)"); - if(numplayersprites == 0) + if (numplayersprites == 0) { firstx = ps[0].posx; firsty = ps[0].posy; @@ -1204,7 +1212,7 @@ void resetpspritevars(char g) po[numplayersprites].os = s->sectnum; numplayersprites++; - if(j >= 0) + if (j >= 0) { s->owner = i; s->shade = 0; @@ -1214,7 +1222,7 @@ void resetpspritevars(char g) s->xoffset = 0; s->clipdist = 64; - if( (g&MODE_EOL) != MODE_EOL || ps[j].last_extra == 0) + if ( (g&MODE_EOL) != MODE_EOL || ps[j].last_extra == 0) { ps[j].last_extra = max_player_health; s->extra = max_player_health; @@ -1224,22 +1232,22 @@ void resetpspritevars(char g) s->yvel = j; - if(!ud.pcolor[j] && ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)) + if (!ud.pcolor[j] && ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)) { - if(s->pal == 0) + if (s->pal == 0) { int k; - for(k=0;k= 17 ) + if ( which_palookup >= 17 ) which_palookup = 9; k=0; } } ud.pcolor[j] = s->pal = ps[j].palookup = which_palookup++; - if( which_palookup >= 17 ) + if ( which_palookup >= 17 ) which_palookup = 9; } else ud.pcolor[j] = ps[j].palookup = s->pal; @@ -1248,12 +1256,14 @@ void resetpspritevars(char g) { int k = ud.pcolor[j]; - if(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) + if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) { - switch(ud.pteam[j]) + switch (ud.pteam[j]) { - case 0: k = 3; break; - case 1: k = 21; break; + case 0: + k = 3; break; + case 1: + k = 21; break; } ps[j].team = ud.pteam[j]; } @@ -1283,7 +1293,7 @@ void clearfrags(void) { short i; - for(i = 0;i=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { if (i != myconnectindex) sendpacket(i,packbuf,1); if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master @@ -1365,10 +1375,11 @@ void waitforeverybody() getpackets(); - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) { if (playerreadyflag[i] < playerreadyflag[myconnectindex]) break; if ((!networkmode) && (myconnectindex != connecthead)) { i = -1; break; } //slaves in M/S mode only wait for master + } if (i < 0) return; } @@ -1378,7 +1389,7 @@ void dofrontscreens(char *statustext) { long i=0,j; - if(ud.recstat != 2) + if (ud.recstat != 2) { if (!statustext) { //ps[myconnectindex].palette = palette; @@ -1394,12 +1405,12 @@ void dofrontscreens(char *statustext) OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1); j = GetGameVarID(g_iReturnVarID, -1, -1); rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1); - if(j > MAXTILES-1) + if (j > MAXTILES-1) { nextpage(); return; } - if( boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0 ) + if ( boardfilename[0] != 0 && ud.level_number == 7 && ud.volume_number == 0 ) { menutext(160,90,0,0,"ENTERING USER MAP"); gametextpal(160,90+10,boardfilename,14,2); @@ -1435,7 +1446,7 @@ void dofrontscreens(char *statustext) OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1); j = GetGameVarID(g_iReturnVarID, -1, -1); rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1); - if(j > MAXTILES-1) + if (j > MAXTILES-1) { nextpage(); return; @@ -1497,7 +1508,7 @@ int enterlevel(char g) long l; char levname[BMAX_PATH]; - if( (g&MODE_DEMO) != MODE_DEMO ) ud.recstat = ud.m_recstat; + if ( (g&MODE_DEMO) != MODE_DEMO ) ud.recstat = ud.m_recstat; ud.respawn_monsters = ud.m_respawn_monsters; ud.respawn_items = ud.m_respawn_items; ud.respawn_inventory = ud.m_respawn_inventory; @@ -1511,13 +1522,13 @@ int enterlevel(char g) Bmemset(votes,0,sizeof(votes)); Bmemset(gotvote,0,sizeof(gotvote)); - if( (g&MODE_DEMO) == 0 && ud.recstat == 2) + if ( (g&MODE_DEMO) == 0 && ud.recstat == 2) ud.recstat = 0; if (VOLUMEALL) Bsprintf(tempbuf,HEAD2); else Bsprintf(tempbuf,HEAD); - if( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 ) + if ( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 ) { Bstrcpy(levname, boardfilename); Bsprintf(apptitle," - %s",levname); @@ -1539,7 +1550,7 @@ int enterlevel(char g) if (!VOLUMEONE) { - if( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 ) + if ( boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0 ) { if ( loadboard( boardfilename,0,&ps[0].posx, &ps[0].posy, &ps[0].posz, &ps[0].ang,&ps[0].cursectnum ) == -1 ) { @@ -1603,34 +1614,34 @@ int enterlevel(char g) cachedebug = 0; automapping = 0; - if(ud.recstat != 2) MUSIC_StopSong(); + if (ud.recstat != 2) MUSIC_StopSong(); cacheit(); - if(ud.recstat != 2) + if (ud.recstat != 2) { music_select = (ud.volume_number*11) + ud.level_number; playmusic(&music_fn[0][music_select][0]); } - if( (g&MODE_GAME) || (g&MODE_EOL) ) + if ( (g&MODE_GAME) || (g&MODE_EOL) ) ps[myconnectindex].gm = MODE_GAME; - else if(g&MODE_RESTART) + else if (g&MODE_RESTART) { - if(ud.recstat == 2) + if (ud.recstat == 2) ps[myconnectindex].gm = MODE_DEMO; else ps[myconnectindex].gm = MODE_GAME; } - if( (ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART ) + if ( (ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART ) opendemowrite(); if (VOLUMEONE) { - if(ud.level_number == 0 && ud.recstat != 2) FTA(40,&ps[myconnectindex]); + if (ud.level_number == 0 && ud.recstat != 2) FTA(40,&ps[myconnectindex]); } - for(i=connecthead;i>=0;i=connectpoint2[i]) - switch(dynamictostatic[sector[sprite[ps[i].i].sectnum].floorpicnum]) + for (i=connecthead;i>=0;i=connectpoint2[i]) + switch (dynamictostatic[sector[sprite[ps[i].i].sectnum].floorpicnum]) { case HURTRAIL__STATIC: case FLOORSLIME__STATIC: @@ -1662,7 +1673,7 @@ int enterlevel(char g) clearfifo(); - for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i]; + for (i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i]; restorepalette = 1; diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index e248cb66f..fa0621510 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -35,13 +35,13 @@ int loadpheader(char spot,struct savehead *saveh) walock[TILE_LOADSHOT] = 255; - if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt; - if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt; + if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt; + if (kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt; g_szBuf[bv]=0; // AddLog(g_szBuf); if (kdfread(&bv,4,1,fil) != 1) goto corrupt; - if(bv != BYTEVERSION) { + if (bv != BYTEVERSION) { FTA(114,&ps[myconnectindex]); kclose(fil); return 1; @@ -80,7 +80,7 @@ int loadplayer(signed char spot) strcpy(fn, "egam0.sav"); strcpy(mpfn, "egamA_00.sav"); - if(spot < 0) + if (spot < 0) { multiflag = 1; multiwhat = 0; @@ -88,12 +88,12 @@ int loadplayer(signed char spot) return -1; } - if( multiflag == 2 && multiwho != myconnectindex ) + if ( multiflag == 2 && multiwho != myconnectindex ) { fnptr = mpfn; mpfn[4] = spot + 'A'; - if(ud.multimode > 9) + if (ud.multimode > 9) { mpfn[6] = (multiwho/10) + '0'; mpfn[7] = (multiwho%10) + '0'; @@ -110,13 +110,13 @@ int loadplayer(signed char spot) ready2send = 0; - if(kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt; - if(kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt; + if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt; + if (kdfread(g_szBuf,bv,1,fil) != 1) goto corrupt; g_szBuf[bv]=0; // AddLog(g_szBuf); if (kdfread(&bv,4,1,fil) != 1) return -1; - if(bv != BYTEVERSION) + if (bv != BYTEVERSION) { FTA(114,&ps[myconnectindex]); kclose(fil); @@ -126,7 +126,7 @@ int loadplayer(signed char spot) } if (kdfread(&nump,sizeof(nump),1,fil) != 1) return -1; - if(nump != ud.multimode) + if (nump != ud.multimode) { kclose(fil); ototalclock = totalclock; @@ -135,7 +135,7 @@ int loadplayer(signed char spot) return 1; } else ud.multimode = nump; - if(numplayers > 1) + if (numplayers > 1) { pub = NUMPAGES; pus = NUMPAGES; @@ -151,7 +151,7 @@ int loadplayer(signed char spot) clearsoundlocks(); MUSIC_StopSong(); - if(numplayers > 1) { + if (numplayers > 1) { if (kdfread(&buf,19,1,fil) != 1) goto corrupt; } else { if (kdfread(&ud.savegame[spot][0],19,1,fil) != 1) goto corrupt; @@ -210,23 +210,23 @@ int loadplayer(signed char spot) if (kdfread(&scriptptrs[0],1,MAXSCRIPTSIZE,fil) != MAXSCRIPTSIZE) goto corrupt; if (kdfread(&script[0],4,MAXSCRIPTSIZE,fil) != MAXSCRIPTSIZE) goto corrupt; - for(i=0;i=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0])); + for (i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0])); if (kdfread(&animategoal[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt; if (kdfread(&animatevel[0],4,MAXANIMATES,fil) != MAXANIMATES) goto corrupt; @@ -300,27 +300,27 @@ int loadplayer(signed char spot) if (kdfread(&i,sizeof(long),1,fil) != 1) goto corrupt; - while(i != MAXQUOTES) + while (i != MAXQUOTES) { - if(fta_quotes[i] != NULL) + if (fta_quotes[i] != NULL) Bfree(fta_quotes[i]); fta_quotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char)); - if(kdfread((char *)fta_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt; - if(kdfread(&i,sizeof(long),1,fil) != 1) goto corrupt; + if (kdfread((char *)fta_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt; + if (kdfread(&i,sizeof(long),1,fil) != 1) goto corrupt; } if (kdfread(&redefined_quote_count,sizeof(redefined_quote_count),1,fil) != 1) goto corrupt; - for(i=0;i= 0 ) + for (x=0;x= 0 ) wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; } else { - for(x=0;x= 0) + while (k >= 0) { - switch(sprite[k].lotag) + switch (sprite[k].lotag) { case 31: setinterpolation(§or[sprite[k].sectnum].floorz); @@ -420,8 +420,8 @@ int loadplayer(signed char spot) k = nextspritestat[k]; } - for(i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i]; - for(i = animatecnt-1;i>=0;i--) + for (i=numinterpolations-1;i>=0;i--) bakipos[i] = *curipos[i]; + for (i = animatecnt-1;i>=0;i--) setinterpolation(animateptr[i]); show_shareware = 0; @@ -458,7 +458,7 @@ int saveplayer(signed char spot) strcpy(fn, "egam0.sav"); strcpy(mpfn, "egamA_00.sav"); - if(spot < 0) + if (spot < 0) { multiflag = 1; multiwhat = 1; @@ -468,12 +468,12 @@ int saveplayer(signed char spot) waitforeverybody(); - if( multiflag == 2 && multiwho != myconnectindex ) + if ( multiflag == 2 && multiwho != myconnectindex ) { fnptr = mpfn; mpfn[4] = spot + 'A'; - if(ud.multimode > 9) + if (ud.multimode > 9) { mpfn[6] = (multiwho/10) + '0'; mpfn[7] = multiwho + '0'; @@ -545,9 +545,9 @@ int saveplayer(signed char spot) dfwrite(&cloudx[0],sizeof(short)<<7,1,fil); dfwrite(&cloudy[0],sizeof(short)<<7,1,fil); - for(i=0;i= (long)(&script[0]) && (long)script[i] < (long)(&script[MAXSCRIPTSIZE]) ) + if ( (long)script[i] >= (long)(&script[0]) && (long)script[i] < (long)(&script[MAXSCRIPTSIZE]) ) { scriptptrs[i] = 1; j = (long)script[i] - (long)&script[0]; @@ -559,61 +559,61 @@ int saveplayer(signed char spot) dfwrite(&scriptptrs[0],1,MAXSCRIPTSIZE,fil); dfwrite(&script[0],4,MAXSCRIPTSIZE,fil); - for(i=0;i= j && T2 < (long)(&script[MAXSCRIPTSIZE]) ) + if (T2 >= j && T2 < (long)(&script[MAXSCRIPTSIZE]) ) { scriptptrs[i] |= 1; T2 -= j; } - if(T5 >= j && T5 < (long)(&script[MAXSCRIPTSIZE]) ) + if (T5 >= j && T5 < (long)(&script[MAXSCRIPTSIZE]) ) { scriptptrs[i] |= 2; T5 -= j; } - if(T6 >= j && T6 < (long)(&script[MAXSCRIPTSIZE]) ) + if (T6 >= j && T6 < (long)(&script[MAXSCRIPTSIZE]) ) { scriptptrs[i] |= 4; T6 -= j; @@ -623,16 +623,16 @@ int saveplayer(signed char spot) dfwrite(&scriptptrs[0],1,MAXSPRITES,fil); dfwrite(&hittype[0],sizeof(struct weaponhit),MAXSPRITES,fil); - for(i=0;i=0;i--) animateptr[i] = (long *)((long)animateptr[i]-(long)(§or[0])); + for (i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]-(long)(§or[0])); dfwrite(&animateptr[0],4,MAXANIMATES,fil); - for(i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0])); + for (i = animatecnt-1;i>=0;i--) animateptr[i] = (long *)((long)animateptr[i]+(long)(§or[0])); dfwrite(&animategoal[0],4,MAXANIMATES,fil); dfwrite(&animatevel[0],4,MAXANIMATES,fil); @@ -681,9 +681,9 @@ int saveplayer(signed char spot) dfwrite(&spritecache[0],sizeof(spritecache[0]),MAXTILES,fil); - for(i=0;i= 0) + while (i >= 0) { - if( PN == MUSICANDSFX && SLT < 1000 ) + if ( PN == MUSICANDSFX && SLT < 1000 ) { - if(whatsprite == -1) whatsprite = i; + if (whatsprite == -1) whatsprite = i; - if(T1 == 0) + if (T1 == 0) { - if( (soundm[SLT]&16) == 0) + if ( (soundm[SLT]&16) == 0) { - if(SLT) + if (SLT) { spritesound(SLT,whatsprite); - if(SHT && SLT != SHT && SHT < NUM_SOUNDS) + if (SHT && SLT != SHT && SHT < NUM_SOUNDS) stopspritesound(SHT,T6); T6 = whatsprite; } - if( (sector[SECT].lotag&0xff) != 22) + if ( (sector[SECT].lotag&0xff) != 22) T1 = 1; } } - else if(SHT < NUM_SOUNDS) + else if (SHT < NUM_SOUNDS) { - if(SHT) spritesound(SHT,whatsprite); - if( (soundm[SLT]&1) || ( SHT && SHT != SLT ) ) + if (SHT) spritesound(SHT,whatsprite); + if ( (soundm[SLT]&1) || ( SHT && SHT != SLT ) ) stopspritesound(SLT,T6); T6 = whatsprite; T1 = 0; @@ -91,8 +91,8 @@ short check_activator_motion( short lotag ) j = headspritestat[3]; while ( j >= 0 ) { - if(s->sectnum == sprite[j].sectnum) - switch(sprite[j].lotag) + if (s->sectnum == sprite[j].sectnum) + switch (sprite[j].lotag) { case 11: case 30: @@ -118,7 +118,7 @@ short check_activator_motion( short lotag ) char isadoorwall(short dapic) { - switch(dynamictostatic[dapic]) + switch (dynamictostatic[dapic]) { case DOORTILE1__STATIC: case DOORTILE2__STATIC: @@ -149,7 +149,7 @@ char isadoorwall(short dapic) char isanunderoperator(short lotag) { - switch(lotag&0xff) + switch (lotag&0xff) { case 15: case 16: @@ -165,7 +165,7 @@ char isanunderoperator(short lotag) char isanearoperator(short lotag) { - switch(lotag&0xff) + switch (lotag&0xff) { case 9: case 15: @@ -188,8 +188,8 @@ char isanearoperator(short lotag) short checkcursectnums(short sect) { short i; - for(i=connecthead;i>=0;i=connectpoint2[i]) - if( sprite[ps[i].i].sectnum == sect ) return i; + for (i=connecthead;i>=0;i=connectpoint2[i]) + if ( sprite[ps[i].i].sectnum == sect ) return i; return -1; } @@ -215,7 +215,7 @@ short findplayer(spritetype *s,long *d) short j, closest_player; long x, closest; - if(ud.multimode < 2) + if (ud.multimode < 2) { *d = klabs(ps[myconnectindex].oposx-s->x) + klabs(ps[myconnectindex].oposy-s->y) + ((klabs(ps[myconnectindex].oposz-s->z+(28<<8)))>>4); return myconnectindex; @@ -224,10 +224,10 @@ short findplayer(spritetype *s,long *d) closest = 0x7fffffff; closest_player = 0; - for(j=connecthead;j>=0;j=connectpoint2[j]) + for (j=connecthead;j>=0;j=connectpoint2[j]) { x = klabs(ps[j].oposx-s->x) + klabs(ps[j].oposy-s->y) + ((klabs(ps[j].oposz-s->z+(28<<8)))>>4); - if( x < closest && sprite[ps[j].i].extra > 0 ) + if ( x < closest && sprite[ps[j].i].extra > 0 ) { closest_player = j; closest = x; @@ -246,12 +246,12 @@ short findotherplayer(short p,long *d) closest = 0x7fffffff; closest_player = p; - for(j=connecthead;j>=0;j=connectpoint2[j]) - if(p != j && sprite[ps[j].i].extra > 0) + for (j=connecthead;j>=0;j=connectpoint2[j]) + if (p != j && sprite[ps[j].i].extra > 0) { x = klabs(ps[j].oposx-ps[p].posx) + klabs(ps[j].oposy-ps[p].posy) + (klabs(ps[j].oposz-ps[p].posz)>>4); - if( x < closest ) + if ( x < closest ) { closest_player = j; closest = x; @@ -266,7 +266,7 @@ void doanimations(void) { long i, j, a, p, v, dasect; - for(i=animatecnt-1;i>=0;i--) + for (i=animatecnt-1;i>=0;i--) { a = *animateptr[i]; v = animatevel[i]*TICSPERFRAME; @@ -281,11 +281,11 @@ void doanimations(void) animategoal[i] = animategoal[animatecnt]; animatevel[i] = animatevel[animatecnt]; animatesect[i] = animatesect[animatecnt]; - if( sector[animatesect[i]].lotag == 18 || sector[animatesect[i]].lotag == 19 ) - if(animateptr[i] == §or[animatesect[i]].ceilingz) + if ( sector[animatesect[i]].lotag == 18 || sector[animatesect[i]].lotag == 19 ) + if (animateptr[i] == §or[animatesect[i]].ceilingz) continue; - if( (sector[dasect].lotag&0xff) != 22 ) + if ( (sector[dasect].lotag&0xff) != 22 ) callsound(dasect,-1); continue; @@ -294,9 +294,9 @@ void doanimations(void) if (v > 0) { a = min(a+v,animategoal[i]); } else { a = max(a+v,animategoal[i]); } - if( animateptr[i] == §or[animatesect[i]].floorz) + if ( animateptr[i] == §or[animatesect[i]].floorz) { - for(p=connecthead;p>=0;p=connectpoint2[p]) + for (p=connecthead;p>=0;p=connectpoint2[p]) if (ps[p].cursectnum == dasect) if ((sector[dasect].floorz-ps[p].posz) < (64<<8)) if (sprite[ps[p].i].owner >= 0) @@ -311,7 +311,7 @@ void doanimations(void) } } - for(j=headspritesect[dasect];j>=0;j=nextspritesect[j]) + for (j=headspritesect[dasect];j>=0;j=nextspritesect[j]) if (sprite[j].statnum != 3) { hittype[j].bposz = sprite[j].z; @@ -329,7 +329,7 @@ int getanimationgoal(long *animptr) long i, j; j = -1; - for(i=animatecnt-1;i>=0;i--) + for (i=animatecnt-1;i>=0;i--) if (animptr == (long *)animateptr[i]) { j = i; @@ -346,7 +346,7 @@ int setanimation(short animsect,long *animptr, long thegoal, long thevel) return(-1); j = animatecnt; - for(i=0;i= 11) + if (T1 >= 11) { T1 = 0; - if(ps[screenpeek].newowner >= 0) + if (ps[screenpeek].newowner >= 0) OW = ps[screenpeek].newowner; - else if(OW >= 0 && dist(&sprite[ps[screenpeek].i],&sprite[i]) < 2048) + else if (OW >= 0 && dist(&sprite[ps[screenpeek].i],&sprite[i]) < 2048) { if (waloff[TILE_VIEWSCR] == 0) allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]); @@ -398,13 +398,13 @@ void animatewalls(void) { long i, j, p, t; - for(p=0;p < numanimwalls ;p++) + for (p=0;p < numanimwalls ;p++) // for(p=numanimwalls-1;p>=0;p--) { i = animwall[p].wallnum; j = wall[i].picnum; - switch(dynamictostatic[j]) + switch (dynamictostatic[j]) { case SCREENBREAK1__STATIC: case SCREENBREAK2__STATIC: @@ -424,7 +424,7 @@ void animatewalls(void) case SCREENBREAK18__STATIC: case SCREENBREAK19__STATIC: - if( (TRAND&255) < 16) + if ( (TRAND&255) < 16) { animwall[p].tag = wall[i].picnum; wall[i].picnum = SCREENBREAK6; @@ -436,30 +436,30 @@ void animatewalls(void) case SCREENBREAK7__STATIC: case SCREENBREAK8__STATIC: - if(animwall[p].tag >= 0 && wall[i].extra != FEMPIC2 && wall[i].extra != FEMPIC3 ) + if (animwall[p].tag >= 0 && wall[i].extra != FEMPIC2 && wall[i].extra != FEMPIC3 ) wall[i].picnum = animwall[p].tag; else { wall[i].picnum++; - if(wall[i].picnum == (SCREENBREAK6+3) ) + if (wall[i].picnum == (SCREENBREAK6+3) ) wall[i].picnum = SCREENBREAK6; } continue; } - if(wall[i].cstat&16) + if (wall[i].cstat&16) if ((wall[i].overpicnum >= W_FORCEFIELD)&&(wall[i].overpicnum <= W_FORCEFIELD+2)) { t = animwall[p].tag; - if(wall[i].cstat&254) + if (wall[i].cstat&254) { wall[i].xpanning -= t>>10; // sintable[(t+512)&2047]>>12; wall[i].ypanning -= t>>10; // sintable[t&2047]>>12; - if(wall[i].extra == 1) + if (wall[i].extra == 1) { wall[i].extra = 0; animwall[p].tag = 0; @@ -467,15 +467,15 @@ void animatewalls(void) else animwall[p].tag+=128; - if( animwall[p].tag < (128<<4) ) + if ( animwall[p].tag < (128<<4) ) { - if( animwall[p].tag&128 ) + if ( animwall[p].tag&128 ) wall[i].overpicnum = W_FORCEFIELD; else wall[i].overpicnum = W_FORCEFIELD+1; } else { - if( (TRAND&255) < 32 ) + if ( (TRAND&255) < 32 ) animwall[p].tag = 128<<(TRAND&3); else wall[i].overpicnum = W_FORCEFIELD+1; } @@ -494,34 +494,34 @@ char activatewarpelevators(short s,short d) //Parm = sectoreffectornum // See if the sector exists i = headspritestat[3]; - while(i >= 0) + while (i >= 0) { - if( SLT == 17 ) - if( SHT == sprite[s].hitag ) - if( (klabs(sector[sn].floorz-hittype[s].temp_data[2]) > SP) || + if ( SLT == 17 ) + if ( SHT == sprite[s].hitag ) + if ( (klabs(sector[sn].floorz-hittype[s].temp_data[2]) > SP) || (sector[SECT].hitag == (sector[sn].hitag-d) ) ) break; i = nextspritestat[i]; } - if(i==-1) + if (i==-1) { d = 0; return 1; // No find } else { - if(d == 0) + if (d == 0) spritesound(ELEVATOR_OFF,s); else spritesound(ELEVATOR_ON,s); } i = headspritestat[3]; - while(i >= 0) + while (i >= 0) { - if( SLT == 17 ) - if( SHT == sprite[s].hitag ) + if ( SLT == 17 ) + if ( SHT == sprite[s].hitag ) { T1 = d; T2 = d; //Make all check warp @@ -541,15 +541,15 @@ void operatesectors(short sn,short ii) sect_error = 0; sptr = §or[sn]; - switch(sptr->lotag&(0xffff-49152)) + switch (sptr->lotag&(0xffff-49152)) { case 30: j = sector[sn].hitag; - if( hittype[j].tempang == 0 || + if ( hittype[j].tempang == 0 || hittype[j].tempang == 256) callsound(sn,ii); - if(sprite[j].extra == 1) + if (sprite[j].extra == 1) sprite[j].extra = 3; else sprite[j].extra = 1; break; @@ -557,7 +557,7 @@ void operatesectors(short sn,short ii) case 31: j = sector[sn].hitag; - if(hittype[j].temp_data[4] == 0) + if (hittype[j].temp_data[4] == 0) hittype[j].temp_data[4] = 1; callsound(sn,ii); @@ -565,7 +565,7 @@ void operatesectors(short sn,short ii) case 26: //The split doors i = getanimationgoal(&sptr->ceilingz); - if(i == -1) //if the door has stopped + if (i == -1) //if the door has stopped { haltsoundhack = 1; sptr->lotag &= 0xff00; @@ -580,113 +580,113 @@ void operatesectors(short sn,short ii) return; case 9: + { + long dax,day,dax2,day2,sp; + long wallfind[2]; + + startwall = sptr->wallptr; + endwall = startwall+sptr->wallnum-1; + + sp = sptr->extra>>4; + + //first find center point by averaging all points + dax = 0L, day = 0L; + for (i=startwall;i<=endwall;i++) { - long dax,day,dax2,day2,sp; - long wallfind[2]; - - startwall = sptr->wallptr; - endwall = startwall+sptr->wallnum-1; - - sp = sptr->extra>>4; - - //first find center point by averaging all points - dax = 0L, day = 0L; - for(i=startwall;i<=endwall;i++) - { - dax += wall[i].x; - day += wall[i].y; - } - dax /= (endwall-startwall+1); - day /= (endwall-startwall+1); - - //find any points with either same x or same y coordinate - // as center (dax, day) - should be 2 points found. - wallfind[0] = -1; - wallfind[1] = -1; - for(i=startwall;i<=endwall;i++) - if ((wall[i].x == dax) || (wall[i].y == day)) - { - if (wallfind[0] == -1) - wallfind[0] = i; - else wallfind[1] = i; - } - - for(j=0;j<2;j++) - { - if ((wall[wallfind[j]].x == dax) && (wall[wallfind[j]].y == day)) - { - //find what direction door should open by averaging the - // 2 neighboring points of wallfind[0] & wallfind[1]. - i = wallfind[j]-1; if (i < startwall) i = endwall; - dax2 = ((wall[i].x+wall[wall[wallfind[j]].point2].x)>>1)-wall[wallfind[j]].x; - day2 = ((wall[i].y+wall[wall[wallfind[j]].point2].y)>>1)-wall[wallfind[j]].y; - if (dax2 != 0) - { - dax2 = wall[wall[wall[wallfind[j]].point2].point2].x; - dax2 -= wall[wall[wallfind[j]].point2].x; - setanimation(sn,&wall[wallfind[j]].x,wall[wallfind[j]].x+dax2,sp); - setanimation(sn,&wall[i].x,wall[i].x+dax2,sp); - setanimation(sn,&wall[wall[wallfind[j]].point2].x,wall[wall[wallfind[j]].point2].x+dax2,sp); - callsound(sn,ii); - } - else if (day2 != 0) - { - day2 = wall[wall[wall[wallfind[j]].point2].point2].y; - day2 -= wall[wall[wallfind[j]].point2].y; - setanimation(sn,&wall[wallfind[j]].y,wall[wallfind[j]].y+day2,sp); - setanimation(sn,&wall[i].y,wall[i].y+day2,sp); - setanimation(sn,&wall[wall[wallfind[j]].point2].y,wall[wall[wallfind[j]].point2].y+day2,sp); - callsound(sn,ii); - } - } - else - { - i = wallfind[j]-1; if (i < startwall) i = endwall; - dax2 = ((wall[i].x+wall[wall[wallfind[j]].point2].x)>>1)-wall[wallfind[j]].x; - day2 = ((wall[i].y+wall[wall[wallfind[j]].point2].y)>>1)-wall[wallfind[j]].y; - if (dax2 != 0) - { - setanimation(sn,&wall[wallfind[j]].x,dax,sp); - setanimation(sn,&wall[i].x,dax+dax2,sp); - setanimation(sn,&wall[wall[wallfind[j]].point2].x,dax+dax2,sp); - callsound(sn,ii); - } - else if (day2 != 0) - { - setanimation(sn,&wall[wallfind[j]].y,day,sp); - setanimation(sn,&wall[i].y,day+day2,sp); - setanimation(sn,&wall[wall[wallfind[j]].point2].y,day+day2,sp); - callsound(sn,ii); - } - } - } - + dax += wall[i].x; + day += wall[i].y; } - return; + dax /= (endwall-startwall+1); + day /= (endwall-startwall+1); + + //find any points with either same x or same y coordinate + // as center (dax, day) - should be 2 points found. + wallfind[0] = -1; + wallfind[1] = -1; + for (i=startwall;i<=endwall;i++) + if ((wall[i].x == dax) || (wall[i].y == day)) + { + if (wallfind[0] == -1) + wallfind[0] = i; + else wallfind[1] = i; + } + + for (j=0;j<2;j++) + { + if ((wall[wallfind[j]].x == dax) && (wall[wallfind[j]].y == day)) + { + //find what direction door should open by averaging the + // 2 neighboring points of wallfind[0] & wallfind[1]. + i = wallfind[j]-1; if (i < startwall) i = endwall; + dax2 = ((wall[i].x+wall[wall[wallfind[j]].point2].x)>>1)-wall[wallfind[j]].x; + day2 = ((wall[i].y+wall[wall[wallfind[j]].point2].y)>>1)-wall[wallfind[j]].y; + if (dax2 != 0) + { + dax2 = wall[wall[wall[wallfind[j]].point2].point2].x; + dax2 -= wall[wall[wallfind[j]].point2].x; + setanimation(sn,&wall[wallfind[j]].x,wall[wallfind[j]].x+dax2,sp); + setanimation(sn,&wall[i].x,wall[i].x+dax2,sp); + setanimation(sn,&wall[wall[wallfind[j]].point2].x,wall[wall[wallfind[j]].point2].x+dax2,sp); + callsound(sn,ii); + } + else if (day2 != 0) + { + day2 = wall[wall[wall[wallfind[j]].point2].point2].y; + day2 -= wall[wall[wallfind[j]].point2].y; + setanimation(sn,&wall[wallfind[j]].y,wall[wallfind[j]].y+day2,sp); + setanimation(sn,&wall[i].y,wall[i].y+day2,sp); + setanimation(sn,&wall[wall[wallfind[j]].point2].y,wall[wall[wallfind[j]].point2].y+day2,sp); + callsound(sn,ii); + } + } + else + { + i = wallfind[j]-1; if (i < startwall) i = endwall; + dax2 = ((wall[i].x+wall[wall[wallfind[j]].point2].x)>>1)-wall[wallfind[j]].x; + day2 = ((wall[i].y+wall[wall[wallfind[j]].point2].y)>>1)-wall[wallfind[j]].y; + if (dax2 != 0) + { + setanimation(sn,&wall[wallfind[j]].x,dax,sp); + setanimation(sn,&wall[i].x,dax+dax2,sp); + setanimation(sn,&wall[wall[wallfind[j]].point2].x,dax+dax2,sp); + callsound(sn,ii); + } + else if (day2 != 0) + { + setanimation(sn,&wall[wallfind[j]].y,day,sp); + setanimation(sn,&wall[i].y,day+day2,sp); + setanimation(sn,&wall[wall[wallfind[j]].point2].y,day+day2,sp); + callsound(sn,ii); + } + } + } + + } + return; case 15://Warping elevators - if(sprite[ii].picnum != APLAYER) return; + if (sprite[ii].picnum != APLAYER) return; // if(ps[sprite[ii].yvel].select_dir == 1) return; i = headspritesect[sn]; - while(i >= 0) + while (i >= 0) { - if(PN==SECTOREFFECTOR && SLT == 17 ) break; + if (PN==SECTOREFFECTOR && SLT == 17 ) break; i = nextspritesect[i]; } - if(sprite[ii].sectnum == sn) + if (sprite[ii].sectnum == sn) { - if( activatewarpelevators(i,-1) ) + if ( activatewarpelevators(i,-1) ) activatewarpelevators(i,1); - else if( activatewarpelevators(i,1) ) + else if ( activatewarpelevators(i,1) ) activatewarpelevators(i,-1); return; } else { - if(sptr->floorz > SZ) + if (sptr->floorz > SZ) activatewarpelevators(i,-1); else activatewarpelevators(i,1); @@ -699,13 +699,13 @@ void operatesectors(short sn,short ii) i = getanimationgoal(&sptr->floorz); - if(i == -1) + if (i == -1) { i = nextsectorneighborz(sn,sptr->floorz,1,1); - if( i == -1 ) + if ( i == -1 ) { i = nextsectorneighborz(sn,sptr->floorz,1,-1); - if( i == -1 ) return; + if ( i == -1 ) return; j = sector[i].floorz; setanimation(sn,&sptr->floorz,j,sptr->extra); } @@ -724,11 +724,11 @@ void operatesectors(short sn,short ii) i = getanimationgoal(&sptr->floorz); - if(i==-1) + if (i==-1) { i = nextsectorneighborz(sn,sptr->floorz,1,-1); - if(i==-1) i = nextsectorneighborz(sn,sptr->floorz,1,1); - if(i==-1) return; + if (i==-1) i = nextsectorneighborz(sn,sptr->floorz,1,1); + if (i==-1) return; j = sector[i].floorz; q = sptr->extra; l = sptr->ceilingz-sptr->floorz; @@ -740,15 +740,15 @@ void operatesectors(short sn,short ii) case 29: - if(sptr->lotag&0x8000) + if (sptr->lotag&0x8000) j = sector[nextsectorneighborz(sn,sptr->ceilingz,1,1)].floorz; else j = sector[nextsectorneighborz(sn,sptr->ceilingz,-1,-1)].ceilingz; i = headspritestat[3]; //Effectors - while(i >= 0) + while (i >= 0) { - if( (SLT == 22) && + if ( (SLT == 22) && (SHT == sptr->hitag) ) { sector[SECT].extra = -sector[SECT].extra; @@ -771,26 +771,26 @@ void operatesectors(short sn,short ii) REDODOOR: - if(sptr->lotag&0x8000) + if (sptr->lotag&0x8000) { i = headspritesect[sn]; - while(i >= 0) + while (i >= 0) { - if(sprite[i].statnum == 3 && SLT==9) + if (sprite[i].statnum == 3 && SLT==9) { j = SZ; break; } i = nextspritesect[i]; } - if(i==-1) + if (i==-1) j = sptr->floorz; } else { j = nextsectorneighborz(sn,sptr->ceilingz,-1,-1); - if(j >= 0) j = sector[j].ceilingz; + if (j >= 0) j = sector[j].ceilingz; else { sptr->lotag |= 32768; @@ -822,7 +822,7 @@ REDODOOR: sptr->lotag ^= 0x8000; - if(setanimation(sn,&sptr->floorz,j,sptr->extra) >= 0) + if (setanimation(sn,&sptr->floorz,j,sptr->extra) >= 0) callsound(sn,ii); } return; @@ -857,9 +857,9 @@ REDODOOR: q = 0; i = headspritestat[3]; - while(i >= 0) + while (i >= 0) { - if( SLT == 11 && SECT == sn && !T5) + if ( SLT == 11 && SECT == sn && !T5) { j = i; break; @@ -869,18 +869,18 @@ REDODOOR: if (i<0) { OSD_Printf("WARNING: SE23 i<0!\n"); return; } // JBF l = sector[SECT].lotag&0x8000; - if(j >= 0) + if (j >= 0) { i = headspritestat[3]; - while(i >= 0) + while (i >= 0) { - if( l == (sector[SECT].lotag&0x8000) && SLT == 11 && sprite[j].hitag == SHT && !T5 ) + if ( l == (sector[SECT].lotag&0x8000) && SLT == 11 && sprite[j].hitag == SHT && !T5 ) { - if(sector[SECT].lotag&0x8000) sector[SECT].lotag &= 0x7fff; + if (sector[SECT].lotag&0x8000) sector[SECT].lotag &= 0x7fff; else sector[SECT].lotag |= 0x8000; T5 = 1; T4 = -T4; - if(q == 0) + if (q == 0) { callsound(sn,i); q = 1; @@ -894,28 +894,28 @@ REDODOOR: case 25: //Subway type sliding doors j = headspritestat[3]; - while(j >= 0)//Find the sprite + while (j >= 0)//Find the sprite { - if( (sprite[j].lotag) == 15 && sprite[j].sectnum == sn ) + if ( (sprite[j].lotag) == 15 && sprite[j].sectnum == sn ) break; //Found the sectoreffector. j = nextspritestat[j]; } - if(j < 0) + if (j < 0) return; i = headspritestat[3]; - while(i >= 0) + while (i >= 0) { - if( SHT==sprite[j].hitag ) + if ( SHT==sprite[j].hitag ) { - if( SLT == 15 ) + if ( SLT == 15 ) { sector[SECT].lotag ^= 0x8000; // Toggle the open or close SA += 1024; - if(T5) callsound(SECT,i); + if (T5) callsound(SECT,i); callsound(SECT,i); - if(sector[SECT].lotag&0x8000) T5 = 1; + if (sector[SECT].lotag&0x8000) T5 = 1; else T5 = 2; } } @@ -926,13 +926,13 @@ REDODOOR: case 27: //Extended bridge j = headspritestat[3]; - while(j >= 0) + while (j >= 0) { - if( (sprite[j].lotag&0xff)==20 && sprite[j].sectnum == sn) //Bridge + if ( (sprite[j].lotag&0xff)==20 && sprite[j].sectnum == sn) //Bridge { sector[sn].lotag ^= 0x8000; - if(sector[sn].lotag&0x8000) //OPENING + if (sector[sn].lotag&0x8000) //OPENING hittype[j].temp_data[0] = 1; else hittype[j].temp_data[0] = 2; callsound(sn,ii); @@ -947,9 +947,9 @@ REDODOOR: //activate the rest of them j = headspritesect[sn]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].statnum==3 && (sprite[j].lotag&0xff)==21) + if (sprite[j].statnum==3 && (sprite[j].lotag&0xff)==21) break; //Found it j = nextspritesect[j]; } @@ -957,9 +957,9 @@ REDODOOR: j = sprite[j].hitag; l = headspritestat[3]; - while(l >= 0) + while (l >= 0) { - if( (sprite[l].lotag&0xff)==21 && !hittype[l].temp_data[0] && + if ( (sprite[l].lotag&0xff)==21 && !hittype[l].temp_data[0] && (sprite[l].hitag) == j ) hittype[l].temp_data[0] = 1; l = nextspritestat[l]; @@ -975,12 +975,12 @@ void operaterespawns(short low) short i, j, nexti; i = headspritestat[11]; - while(i >= 0) + while (i >= 0) { nexti = nextspritestat[i]; if ((SLT == low) && (PN == RESPAWN)) { - if( badguypic(SHT) && ud.monsters_off ) break; + if ( badguypic(SHT) && ud.monsters_off ) break; j = spawn(i,TRANSPORTERSTAR); sprite[j].z -= (32<<8); @@ -996,56 +996,56 @@ void operateactivators(short low,short snum) short i, j, k, *p; walltype *wal; - for(i=numcyclers-1;i>=0;i--) + for (i=numcyclers-1;i>=0;i--) { p = &cyclers[i][0]; - if(p[4] == low) + if (p[4] == low) { p[5] = !p[5]; 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]; } } i = headspritestat[8]; k = -1; - while(i >= 0) + while (i >= 0) { - if(sprite[i].lotag == low) + if (sprite[i].lotag == low) { - if( sprite[i].picnum == ACTIVATORLOCKED ) + if ( sprite[i].picnum == ACTIVATORLOCKED ) { - if(sector[SECT].lotag&16384) + if (sector[SECT].lotag&16384) sector[SECT].lotag &= 65535-16384; else sector[SECT].lotag |= 16384; - if(snum >= 0) + if (snum >= 0) { - if(sector[SECT].lotag&16384) + if (sector[SECT].lotag&16384) FTA(4,&ps[snum]); else FTA(8,&ps[snum]); } } else { - switch(SHT) + switch (SHT) { case 0: break; case 1: - if(sector[SECT].floorz != sector[SECT].ceilingz) + if (sector[SECT].floorz != sector[SECT].ceilingz) { i = nextspritestat[i]; continue; } break; case 2: - if(sector[SECT].floorz == sector[SECT].ceilingz) + if (sector[SECT].floorz == sector[SECT].ceilingz) { i = nextspritestat[i]; continue; @@ -1053,12 +1053,12 @@ void operateactivators(short low,short snum) break; } - if( sector[sprite[i].sectnum].lotag < 3 ) + if ( sector[sprite[i].sectnum].lotag < 3 ) { j = headspritesect[sprite[i].sectnum]; - while(j >= 0) + while (j >= 0) { - if( sprite[j].statnum == 3 ) switch(sprite[j].lotag) + if ( sprite[j].statnum == 3 ) switch (sprite[j].lotag) { case 36: case 31: @@ -1072,7 +1072,7 @@ void operateactivators(short low,short snum) } } - if( k == -1 && (sector[SECT].lotag&0xff) == 22 ) + if ( k == -1 && (sector[SECT].lotag&0xff) == 22 ) k = callsound(SECT,i); operatesectors(SECT,i); @@ -1089,9 +1089,9 @@ void operatemasterswitches(short low) short i; i = headspritestat[6]; - while(i >= 0) + while (i >= 0) { - if( PN == MASTERSWITCH && SLT == low && SP == 0 ) + if ( PN == MASTERSWITCH && SLT == low && SP == 0 ) SP = 1; i = nextspritestat[i]; } @@ -1101,21 +1101,21 @@ void operateforcefields(short s, short low) { short i, p; - for(p=numanimwalls;p>=0;p--) + for (p=numanimwalls;p>=0;p--) { i = animwall[p].wallnum; - if(low == wall[i].lotag || low == -1) + if (low == wall[i].lotag || low == -1) if (((wall[i].overpicnum >= W_FORCEFIELD)&&(wall[i].overpicnum <= W_FORCEFIELD+2))||(wall[i].overpicnum == BIGFORCE)) { animwall[p].tag = 0; - if( wall[i].cstat ) + if ( wall[i].cstat ) { wall[i].cstat = 0; - if( s >= 0 && sprite[s].picnum == SECTOREFFECTOR && + if ( s >= 0 && sprite[s].picnum == SECTOREFFECTOR && sprite[s].lotag == 30) wall[i].lotag = 0; } @@ -1132,13 +1132,13 @@ char checkhitswitch(short snum,long w,char switchtype) long sx,sy; int switchpicnum; - if(w < 0) return 0; + if (w < 0) return 0; correctdips = 1; numdips = 0; - if(switchtype == 1) // A wall sprite + if (switchtype == 1) // A wall sprite { - lotag = sprite[w].lotag; if(lotag == 0) return 0; + lotag = sprite[w].lotag; if (lotag == 0) return 0; hitag = sprite[w].hitag; sx = sprite[w].x; sy = sprite[w].y; @@ -1147,7 +1147,7 @@ char checkhitswitch(short snum,long w,char switchtype) } else { - lotag = wall[w].lotag; if(lotag == 0) return 0; + lotag = wall[w].lotag; if (lotag == 0) return 0; hitag = wall[w].hitag; sx = wall[w].x; sy = wall[w].y; @@ -1180,7 +1180,7 @@ char checkhitswitch(short snum,long w,char switchtype) switchpicnum = MULTISWITCH; } - switch(dynamictostatic[switchpicnum]) + switch (dynamictostatic[switchpicnum]) { case DIPSWITCH__STATIC: // case DIPSWITCH+1: @@ -1191,32 +1191,32 @@ char checkhitswitch(short snum,long w,char switchtype) break; case ACCESSSWITCH__STATIC: case ACCESSSWITCH2__STATIC: - if(ps[snum].access_incs == 0) + if (ps[snum].access_incs == 0) { - if( switchpal == 0 ) + if ( switchpal == 0 ) { - if( (ps[snum].got_access&1) ) + if ( (ps[snum].got_access&1) ) ps[snum].access_incs = 1; else FTA(70,&ps[snum]); } - else if( switchpal == 21 ) + else if ( switchpal == 21 ) { - if( ps[snum].got_access&2 ) + if ( ps[snum].got_access&2 ) ps[snum].access_incs = 1; else FTA(71,&ps[snum]); } - else if( switchpal == 23 ) + else if ( switchpal == 23 ) { - if( ps[snum].got_access&4 ) + if ( ps[snum].got_access&4 ) ps[snum].access_incs = 1; else FTA(72,&ps[snum]); } - if( ps[snum].access_incs == 1 ) + if ( ps[snum].access_incs == 1 ) { - if(switchtype == 0) + if (switchtype == 0) ps[snum].access_wallnum = w; else ps[snum].access_spritenum = w; @@ -1254,32 +1254,32 @@ char checkhitswitch(short snum,long w,char switchtype) //case LOCKSWITCH1+1: case POWERSWITCH2__STATIC: //case POWERSWITCH2+1: - if( check_activator_motion( lotag ) ) return 0; + if ( check_activator_motion( lotag ) ) return 0; break; default: - if( isadoorwall(picnum) == 0 ) return 0; + if ( isadoorwall(picnum) == 0 ) return 0; break; } i = headspritestat[0]; - while(i >= 0) + while (i >= 0) { if ( lotag == SLT ) { int switchpicnum=PN; // put it in a variable so later switches don't trigger on the result of changes if ((switchpicnum >= MULTISWITCH) && (switchpicnum <=MULTISWITCH+3)) { sprite[i].picnum++; - if( sprite[i].picnum > (MULTISWITCH+3) ) + if ( sprite[i].picnum > (MULTISWITCH+3) ) sprite[i].picnum = MULTISWITCH; } - switch(dynamictostatic[switchpicnum]) { + switch (dynamictostatic[switchpicnum]) { case DIPSWITCH__STATIC: case TECHSWITCH__STATIC: case ALIENSWITCH__STATIC: - if( switchtype == 1 && w == i ) PN++; - else if( SHT == 0 ) correctdips++; + if ( switchtype == 1 && w == i ) PN++; + else if ( SHT == 0 ) correctdips++; numdips++; break; case ACCESSSWITCH__STATIC: @@ -1300,13 +1300,13 @@ char checkhitswitch(short snum,long w,char switchtype) sprite[i].picnum++; break; default: - switch(dynamictostatic[switchpicnum-1]) { + switch (dynamictostatic[switchpicnum-1]) { case TECHSWITCH__STATIC: case DIPSWITCH__STATIC: case ALIENSWITCH__STATIC: - if( switchtype == 1 && w == i ) PN--; - else if( SHT == 1 ) correctdips++; + if ( switchtype == 1 && w == i ) PN--; + else if ( SHT == 1 ) correctdips++; numdips++; break; case PULLSWITCH__STATIC: @@ -1331,23 +1331,23 @@ char checkhitswitch(short snum,long w,char switchtype) i = nextspritestat[i]; } - for(i=0;i= MULTISWITCH) && (wall[x].picnum <=MULTISWITCH+3)) { wall[x].picnum++; - if(wall[x].picnum > (MULTISWITCH+3) ) + if (wall[x].picnum > (MULTISWITCH+3) ) wall[x].picnum = MULTISWITCH; } - switch(dynamictostatic[wall[x].picnum]) { + switch (dynamictostatic[wall[x].picnum]) { case DIPSWITCH__STATIC: case TECHSWITCH__STATIC: case ALIENSWITCH__STATIC: - if( switchtype == 0 && i == w ) wall[x].picnum++; - else if( wall[x].hitag == 0 ) correctdips++; + if ( switchtype == 0 && i == w ) wall[x].picnum++; + else if ( wall[x].hitag == 0 ) correctdips++; numdips++; break; case ACCESSSWITCH__STATIC: @@ -1368,13 +1368,13 @@ char checkhitswitch(short snum,long w,char switchtype) wall[x].picnum++; break; default: - switch(dynamictostatic[wall[x].picnum-1]) { + switch (dynamictostatic[wall[x].picnum-1]) { case TECHSWITCH__STATIC: case DIPSWITCH__STATIC: case ALIENSWITCH__STATIC: - if( switchtype == 0 && i == w ) wall[x].picnum--; - else if( wall[x].hitag == 1 ) correctdips++; + if ( switchtype == 0 && i == w ) wall[x].picnum--; + else if ( wall[x].hitag == 1 ) correctdips++; numdips++; break; case PULLSWITCH__STATIC: @@ -1398,11 +1398,11 @@ char checkhitswitch(short snum,long w,char switchtype) } } - if(lotag == (short) 65535) + if (lotag == (short) 65535) { ps[myconnectindex].gm = MODE_EOL; - if(ud.from_bonus) + if (ud.from_bonus) { ud.level_number = ud.from_bonus; ud.m_level_number = ud.level_number; @@ -1411,7 +1411,7 @@ char checkhitswitch(short snum,long w,char switchtype) else { ud.level_number++; - if( (ud.volume_number && ud.level_number > 10 ) || ( ud.volume_number == 0 && ud.level_number > 5 ) ) + if ( (ud.volume_number && ud.level_number > 10 ) || ( ud.volume_number == 0 && ud.level_number > 5 ) ) ud.level_number = 0; ud.m_level_number = ud.level_number; } @@ -1445,33 +1445,33 @@ char checkhitswitch(short snum,long w,char switchtype) switchpicnum = MULTISWITCH; } - switch(dynamictostatic[switchpicnum]) + switch (dynamictostatic[switchpicnum]) { default: - if(isadoorwall(picnum) == 0) break; + if (isadoorwall(picnum) == 0) break; case DIPSWITCH__STATIC: //case DIPSWITCH+1: case TECHSWITCH__STATIC: //case TECHSWITCH+1: case ALIENSWITCH__STATIC: //case ALIENSWITCH+1: - if( picnum == DIPSWITCH || picnum == DIPSWITCH+1 || + if ( picnum == DIPSWITCH || picnum == DIPSWITCH+1 || picnum == ALIENSWITCH || picnum == ALIENSWITCH+1 || picnum == TECHSWITCH || picnum == TECHSWITCH+1 ) { - if( picnum == ALIENSWITCH || picnum == ALIENSWITCH+1) + if ( picnum == ALIENSWITCH || picnum == ALIENSWITCH+1) { - if(switchtype == 1) + if (switchtype == 1) xyzsound(ALIEN_SWITCH1,w,sx,sy,ps[snum].posz); else xyzsound(ALIEN_SWITCH1,ps[snum].i,sx,sy,ps[snum].posz); } else { - if(switchtype == 1) + if (switchtype == 1) xyzsound(SWITCH_ON,w,sx,sy,ps[snum].posz); else xyzsound(SWITCH_ON,ps[snum].i,sx,sy,ps[snum].posz); } - if(numdips != correctdips) break; + if (numdips != correctdips) break; xyzsound(END_OF_LEVEL_WARN,ps[snum].i,sx,sy,ps[snum].posz); } case DIPSWITCH2__STATIC: @@ -1507,21 +1507,21 @@ char checkhitswitch(short snum,long w,char switchtype) case PULLSWITCH__STATIC: //case PULLSWITCH+1: - if( picnum == MULTISWITCH || picnum == (MULTISWITCH+1) || + if ( picnum == MULTISWITCH || picnum == (MULTISWITCH+1) || picnum == (MULTISWITCH+2) || picnum == (MULTISWITCH+3) ) lotag += picnum-MULTISWITCH; x = headspritestat[3]; - while(x >= 0) + while (x >= 0) { - if( ((sprite[x].hitag) == lotag) ) + if ( ((sprite[x].hitag) == lotag) ) { - switch(sprite[x].lotag) + switch (sprite[x].lotag) { case 12: sector[sprite[x].sectnum].floorpal = 0; hittype[x].temp_data[0]++; - if(hittype[x].temp_data[0] == 2) + if (hittype[x].temp_data[0] == 2) hittype[x].temp_data[0]++; break; @@ -1529,7 +1529,7 @@ char checkhitswitch(short snum,long w,char switchtype) case 34: case 25: hittype[x].temp_data[4] = !hittype[x].temp_data[4]; - if(hittype[x].temp_data[4]) + if (hittype[x].temp_data[4]) FTA(15,&ps[snum]); else FTA(2,&ps[snum]); break; @@ -1545,19 +1545,19 @@ char checkhitswitch(short snum,long w,char switchtype) operateforcefields(ps[snum].i,lotag); operatemasterswitches(lotag); - if( picnum == DIPSWITCH || picnum == DIPSWITCH+1 || + if ( picnum == DIPSWITCH || picnum == DIPSWITCH+1 || picnum == ALIENSWITCH || picnum == ALIENSWITCH+1 || picnum == TECHSWITCH || picnum == TECHSWITCH+1 ) return 1; - if( hitag == 0 && isadoorwall(picnum) == 0 ) + if ( hitag == 0 && isadoorwall(picnum) == 0 ) { - if(switchtype == 1) + if (switchtype == 1) xyzsound(SWITCH_ON,w,sx,sy,ps[snum].posz); else xyzsound(SWITCH_ON,ps[snum].i,sx,sy,ps[snum].posz); } - else if(hitag != 0) + else if (hitag != 0) { - if(switchtype == 1 && (soundm[hitag]&4) == 0) + if (switchtype == 1 && (soundm[hitag]&4) == 0) xyzsound(hitag,w,sx,sy,ps[snum].posz); else spritesound(hitag,ps[snum].i); } @@ -1575,9 +1575,9 @@ void activatebysector(short sect,short j) didit = 0; i = headspritesect[sect]; - while(i >= 0) + while (i >= 0) { - if(PN == ACTIVATOR) + if (PN == ACTIVATOR) { operateactivators(SLT,-1); didit = 1; @@ -1586,7 +1586,7 @@ void activatebysector(short sect,short j) i = nextspritesect[i]; } - if(didit == 0) + if (didit == 0) operatesectors(sect,j); } @@ -1605,7 +1605,7 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) wal = &wall[dawallnum]; - if(wal->overpicnum == MIRROR && checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE) && (thisprojectile[spr].workslike & PROJECTILE_FLAG_RPG)) + if (wal->overpicnum == MIRROR && checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE) && (thisprojectile[spr].workslike & PROJECTILE_FLAG_RPG)) { lotsofglass(spr,dawallnum,70); wal->cstat &= ~16; @@ -1613,9 +1613,9 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) spritesound(GLASS_HEAVYBREAK,spr); } - if(wal->overpicnum == MIRROR) + if (wal->overpicnum == MIRROR) { - switch(dynamictostatic[atwith]) + switch (dynamictostatic[atwith]) { case HEAVYHBOMB__STATIC: case RADIUSEXPLOSION__STATIC: @@ -1632,14 +1632,14 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) } } - if( ( (wal->cstat&16) || wal->overpicnum == BIGFORCE ) && wal->nextsector >= 0 ) - if( sector[wal->nextsector].floorz > z ) - if( sector[wal->nextsector].floorz-sector[wal->nextsector].ceilingz ) + if ( ( (wal->cstat&16) || wal->overpicnum == BIGFORCE ) && wal->nextsector >= 0 ) + if ( sector[wal->nextsector].floorz > z ) + if ( sector[wal->nextsector].floorz-sector[wal->nextsector].ceilingz ) { int switchpicnum = wal->overpicnum; if ((switchpicnum > W_FORCEFIELD)&&(switchpicnum <= W_FORCEFIELD+2)) switchpicnum = W_FORCEFIELD; - switch(dynamictostatic[switchpicnum]) + switch (dynamictostatic[switchpicnum]) { case W_FORCEFIELD__STATIC: //case W_FORCEFIELD+1: @@ -1647,13 +1647,13 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) wal->extra = 1; // tell the forces to animate case BIGFORCE__STATIC: updatesector(x,y,&sn); - if( sn < 0 ) return; + if ( sn < 0 ) return; - if(atwith == -1) + if (atwith == -1) i = EGS(sn,x,y,z,FORCERIPPLE,-127,8,8,0,0,0,spr,5); else { - if(atwith == CHAINGUN) + if (atwith == CHAINGUN) i = EGS(sn,x,y,z,FORCERIPPLE,-127,16+sprite[spr].xrepeat,16+sprite[spr].yrepeat,0,0,0,spr,5); else i = EGS(sn,x,y,z,FORCERIPPLE,-127,32,32,0,0,0,spr,5); } @@ -1669,7 +1669,7 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) case FANSPRITE__STATIC: wal->overpicnum = FANSPRITEBROKE; wal->cstat &= 65535-65; - if(wal->nextwall >= 0) + if (wal->nextwall >= 0) { wall[wal->nextwall].overpicnum = FANSPRITEBROKE; wall[wal->nextwall].cstat &= 65535-65; @@ -1679,12 +1679,12 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) return; case GLASS__STATIC: - updatesector(x,y,&sn); if( sn < 0 ) return; + updatesector(x,y,&sn); if ( sn < 0 ) return; wal->overpicnum=GLASS2; lotsofglass(spr,dawallnum,10); wal->cstat = 0; - if(wal->nextwall >= 0) + if (wal->nextwall >= 0) wall[wal->nextwall].cstat = 0; i = EGS(sn,x,y,z,SECTOREFFECTOR,0,0,0,ps[0].ang,0,0,spr,3); @@ -1692,10 +1692,10 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) spritesound(GLASS_BREAKING,i); return; case STAINGLASS1__STATIC: - updatesector(x,y,&sn); if( sn < 0 ) return; + updatesector(x,y,&sn); if ( sn < 0 ) return; lotsofcolourglass(spr,dawallnum,80); wal->cstat = 0; - if(wal->nextwall >= 0) + if (wal->nextwall >= 0) wall[wal->nextwall].cstat = 0; spritesound(VENT_BUST,spr); spritesound(GLASS_BREAKING,spr); @@ -1703,7 +1703,7 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) } } - switch(dynamictostatic[wal->picnum]) + switch (dynamictostatic[wal->picnum]) { case COLAMACHINE__STATIC: case VENDMACHINE__STATIC: @@ -1799,45 +1799,45 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) case TECHLIGHT2__STATIC: case TECHLIGHT4__STATIC: - if( rnd(128) ) + if ( rnd(128) ) spritesound(GLASS_HEAVYBREAK,spr); else spritesound(GLASS_BREAKING,spr); lotsofglass(spr,dawallnum,30); - if(wal->picnum == WALLLIGHT1) + if (wal->picnum == WALLLIGHT1) wal->picnum = WALLLIGHTBUST1; - if(wal->picnum == WALLLIGHT2) + if (wal->picnum == WALLLIGHT2) wal->picnum = WALLLIGHTBUST2; - if(wal->picnum == WALLLIGHT3) + if (wal->picnum == WALLLIGHT3) wal->picnum = WALLLIGHTBUST3; - if(wal->picnum == WALLLIGHT4) + if (wal->picnum == WALLLIGHT4) wal->picnum = WALLLIGHTBUST4; - if(wal->picnum == TECHLIGHT2) + if (wal->picnum == TECHLIGHT2) wal->picnum = TECHLIGHTBUST2; - if(wal->picnum == TECHLIGHT4) + if (wal->picnum == TECHLIGHT4) wal->picnum = TECHLIGHTBUST4; - if(!wal->lotag) return; + if (!wal->lotag) return; sn = wal->nextsector; - if(sn < 0) return; + if (sn < 0) return; darkestwall = 0; wal = &wall[sector[sn].wallptr]; - for(i=sector[sn].wallnum;i > 0;i--,wal++) - if(wal->shade > darkestwall) + for (i=sector[sn].wallnum;i > 0;i--,wal++) + if (wal->shade > darkestwall) darkestwall=wal->shade; j = TRAND&1; i= headspritestat[3]; - while(i >= 0) + while (i >= 0) { - if(SHT == wall[dawallnum].lotag && SLT == 3 ) + if (SHT == wall[dawallnum].lotag && SLT == 3 ) { T3 = j; T4 = darkestwall; @@ -1851,13 +1851,13 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) void checkplayerhurt(struct player_struct *p,short j) { - if( (j&49152) == 49152 ) + if ( (j&49152) == 49152 ) { j &= (MAXSPRITES-1); - if(sprite[j].picnum==CACTUS){ + if (sprite[j].picnum==CACTUS){ - if(p->hurt_delay < 8 ) + if (p->hurt_delay < 8 ) { sprite[p->i].extra -= 5; @@ -1873,16 +1873,16 @@ void checkplayerhurt(struct player_struct *p,short j) return; } - if( (j&49152) != 32768) return; + if ( (j&49152) != 32768) return; j &= (MAXWALLS-1); - if( p->hurt_delay > 0 ) p->hurt_delay--; - else if( wall[j].cstat&85 ) { + if ( p->hurt_delay > 0 ) p->hurt_delay--; + else if ( wall[j].cstat&85 ) { int switchpicnum = wall[j].overpicnum; if ((switchpicnum>W_FORCEFIELD)&&(switchpicnum<=W_FORCEFIELD+2)) switchpicnum=W_FORCEFIELD; - switch(dynamictostatic[switchpicnum]) + switch (dynamictostatic[switchpicnum]) { case W_FORCEFIELD__STATIC: // case W_FORCEFIELD+1: @@ -1922,7 +1922,7 @@ char checkhitceiling(short sn) { short i, j; - switch(dynamictostatic[sector[sn].ceilingpicnum]) + switch (dynamictostatic[sector[sn].ceilingpicnum]) { case WALLLIGHT1__STATIC: case WALLLIGHT2__STATIC: @@ -1934,36 +1934,36 @@ char checkhitceiling(short sn) ceilingglass(ps[myconnectindex].i,sn,10); spritesound(GLASS_BREAKING,ps[screenpeek].i); - if(sector[sn].ceilingpicnum == WALLLIGHT1) + if (sector[sn].ceilingpicnum == WALLLIGHT1) sector[sn].ceilingpicnum = WALLLIGHTBUST1; - if(sector[sn].ceilingpicnum == WALLLIGHT2) + if (sector[sn].ceilingpicnum == WALLLIGHT2) sector[sn].ceilingpicnum = WALLLIGHTBUST2; - if(sector[sn].ceilingpicnum == WALLLIGHT3) + if (sector[sn].ceilingpicnum == WALLLIGHT3) sector[sn].ceilingpicnum = WALLLIGHTBUST3; - if(sector[sn].ceilingpicnum == WALLLIGHT4) + if (sector[sn].ceilingpicnum == WALLLIGHT4) sector[sn].ceilingpicnum = WALLLIGHTBUST4; - if(sector[sn].ceilingpicnum == TECHLIGHT2) + if (sector[sn].ceilingpicnum == TECHLIGHT2) sector[sn].ceilingpicnum = TECHLIGHTBUST2; - if(sector[sn].ceilingpicnum == TECHLIGHT4) + if (sector[sn].ceilingpicnum == TECHLIGHT4) sector[sn].ceilingpicnum = TECHLIGHTBUST4; - if(!sector[sn].hitag) + if (!sector[sn].hitag) { i = headspritesect[sn]; - while(i >= 0) + while (i >= 0) { - if( PN == SECTOREFFECTOR && SLT == 12 ) + if ( PN == SECTOREFFECTOR && SLT == 12 ) { j = headspritestat[3]; - while(j >= 0) + while (j >= 0) { - if( sprite[j].hitag == SHT ) + if ( sprite[j].hitag == SHT ) hittype[j].temp_data[3] = 1; j = nextspritestat[j]; } @@ -1975,9 +1975,9 @@ char checkhitceiling(short sn) i = headspritestat[3]; j = TRAND&1; - while(i >= 0) + while (i >= 0) { - if(SHT == (sector[sn].hitag) && SLT == 3 ) + if (SHT == (sector[sn].hitag) && SLT == 3 ) { T3 = j; T5 = 1; @@ -1999,14 +1999,14 @@ void checkhitsprite(short i,short sn) i &= (MAXSPRITES-1); - if(checkspriteflags(sn,SPRITE_FLAG_PROJECTILE)) - if(thisprojectile[sn].workslike & PROJECTILE_FLAG_RPG) + if (checkspriteflags(sn,SPRITE_FLAG_PROJECTILE)) + if (thisprojectile[sn].workslike & PROJECTILE_FLAG_RPG) rpg = 1; switchpicnum = PN; if ((PN > WATERFOUNTAIN)&&(PN < WATERFOUNTAIN+3)) { switchpicnum = WATERFOUNTAIN; } - switch(dynamictostatic[PN]) + switch (dynamictostatic[PN]) { case OCEANSPRITE1__STATIC: case OCEANSPRITE2__STATIC: @@ -2018,17 +2018,17 @@ void checkhitsprite(short i,short sn) break; case QUEBALL__STATIC: case STRIPEBALL__STATIC: - if(sprite[sn].picnum == QUEBALL || sprite[sn].picnum == STRIPEBALL) + if (sprite[sn].picnum == QUEBALL || sprite[sn].picnum == STRIPEBALL) { sprite[sn].xvel = (sprite[i].xvel>>1)+(sprite[i].xvel>>2); sprite[sn].ang -= (SA<<1)+1024; SA = getangle(SX-sprite[sn].x,SY-sprite[sn].y)-512; - if(issoundplaying(i,POOLBALLHIT) < 2) + if (issoundplaying(i,POOLBALLHIT) < 2) spritesound(POOLBALLHIT,i); } else { - if( TRAND&3 ) + if ( TRAND&3 ) { sprite[i].xvel = 164; sprite[i].ang = sprite[sn].ang; @@ -2045,64 +2045,64 @@ void checkhitsprite(short i,short sn) case TIRE__STATIC: case CONE__STATIC: case BOX__STATIC: - { - if (rpg == 1) - if(T1 == 0) - { - CS &= ~257; - T1 = 1; - spawn(i,BURNING); - } - switch(dynamictostatic[sprite[sn].picnum]) + { + if (rpg == 1) + if (T1 == 0) { - case RADIUSEXPLOSION__STATIC: - case RPG__STATIC: - case FIRELASER__STATIC: - case HYDRENT__STATIC: - case HEAVYHBOMB__STATIC: - if(T1 == 0) - { - CS &= ~257; - T1 = 1; - spawn(i,BURNING); - } - break; - } - break; - } - case CACTUS__STATIC: - { - if (rpg == 1) - for(k=0;k<64;k++) - { - j = EGS(SECT,SX,SY,SZ-(TRAND%(48<<8)),SCRAP3+(TRAND&3),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(sprite[i].zvel>>2),i,5); - sprite[j].pal = 8; - } - // case CACTUSBROKE: - switch(dynamictostatic[sprite[sn].picnum]) - { - case RADIUSEXPLOSION__STATIC: - case RPG__STATIC: - case FIRELASER__STATIC: - case HYDRENT__STATIC: - case HEAVYHBOMB__STATIC: - for(k=0;k<64;k++) - { - j = EGS(SECT,SX,SY,SZ-(TRAND%(48<<8)),SCRAP3+(TRAND&3),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(sprite[i].zvel>>2),i,5); - sprite[j].pal = 8; - } - - if(PN == CACTUS) - PN = CACTUSBROKE; CS &= ~257; - // else deletesprite(i); - break; + T1 = 1; + spawn(i,BURNING); + } + switch (dynamictostatic[sprite[sn].picnum]) + { + case RADIUSEXPLOSION__STATIC: + case RPG__STATIC: + case FIRELASER__STATIC: + case HYDRENT__STATIC: + case HEAVYHBOMB__STATIC: + if (T1 == 0) + { + CS &= ~257; + T1 = 1; + spawn(i,BURNING); } break; } + break; + } + case CACTUS__STATIC: + { + if (rpg == 1) + for (k=0;k<64;k++) + { + j = EGS(SECT,SX,SY,SZ-(TRAND%(48<<8)),SCRAP3+(TRAND&3),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(sprite[i].zvel>>2),i,5); + sprite[j].pal = 8; + } + // case CACTUSBROKE: + switch (dynamictostatic[sprite[sn].picnum]) + { + case RADIUSEXPLOSION__STATIC: + case RPG__STATIC: + case FIRELASER__STATIC: + case HYDRENT__STATIC: + case HEAVYHBOMB__STATIC: + for (k=0;k<64;k++) + { + j = EGS(SECT,SX,SY,SZ-(TRAND%(48<<8)),SCRAP3+(TRAND&3),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(sprite[i].zvel>>2),i,5); + sprite[j].pal = 8; + } + + if (PN == CACTUS) + PN = CACTUSBROKE; + CS &= ~257; + // else deletesprite(i); + break; + } + break; + } case HANGLIGHT__STATIC: case GENERICPOLE2__STATIC: - for(k=0;k<6;k++) + for (k=0;k<6;k++) EGS(SECT,SX,SY,SZ-(8<<8),SCRAP1+(TRAND&15),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(sprite[i].zvel>>2),i,5); spritesound(GLASS_HEAVYBREAK,i); deletesprite(i); @@ -2112,12 +2112,12 @@ void checkhitsprite(short i,short sn) case FANSPRITE__STATIC: PN = FANSPRITEBROKE; CS &= (65535-257); - if( sector[SECT].floorpicnum == FANSHADOW ) + if ( sector[SECT].floorpicnum == FANSHADOW ) sector[SECT].floorpicnum = FANSHADOWBROKE; spritesound(GLASS_HEAVYBREAK,i); s = &sprite[i]; - for(j=0;j<16;j++) RANDOMSCRAP; + for (j=0;j<16;j++) RANDOMSCRAP; break; case WATERFOUNTAIN__STATIC: @@ -2131,9 +2131,9 @@ void checkhitsprite(short i,short sn) case FUELPOD__STATIC: case SOLARPANNEL__STATIC: case ANTENNA__STATIC: - if(sprite[sn].extra != *actorscrptr[SHOTSPARK1] ) + if (sprite[sn].extra != *actorscrptr[SHOTSPARK1] ) { - for(j=0;j<15;j++) + for (j=0;j<15;j++) EGS(SECT,SX,SY,sector[SECT].floorz-(12<<8)-(j<<9),SCRAP1+(TRAND&15),-8,64,64, TRAND&2047,(TRAND&127)+64,-(TRAND&511)-256,i,5); spawn(i,EXPLOSION2); @@ -2168,14 +2168,14 @@ void checkhitsprite(short i,short sn) case VASE__STATIC: case STATUEFLASH__STATIC: case STATUE__STATIC: - if(PN == BOTTLE10) + if (PN == BOTTLE10) lotsofmoney(&sprite[i],4+(TRAND&3)); - else if(PN == STATUE || PN == STATUEFLASH) + else if (PN == STATUE || PN == STATUEFLASH) { lotsofcolourglass(i,-1,40); spritesound(GLASS_HEAVYBREAK,i); } - else if(PN == VASE) + else if (PN == VASE) lotsofglass(i,-1,40); spritesound(GLASS_BREAKING,i); @@ -2189,7 +2189,7 @@ void checkhitsprite(short i,short sn) lotsofglass(i,-1,10); break; case FETUSBROKE__STATIC: - for(j=0;j<48;j++) + for (j=0;j<48;j++) { shoot(i,BLOODSPLAT1); SA += 333; @@ -2216,7 +2216,7 @@ void checkhitsprite(short i,short sn) break; case BROKEHYDROPLANT__STATIC: - if(CS&1) + if (CS&1) { spritesound(GLASS_BREAKING,i); SZ += 16<<8; @@ -2281,14 +2281,20 @@ void checkhitsprite(short i,short sn) case PIPE4__STATIC: case PIPE5__STATIC: case PIPE6__STATIC: - switch(dynamictostatic[PN]) + switch (dynamictostatic[PN]) { - case PIPE1__STATIC:PN=PIPE1B;break; - case PIPE2__STATIC:PN=PIPE2B;break; - case PIPE3__STATIC:PN=PIPE3B;break; - case PIPE4__STATIC:PN=PIPE4B;break; - case PIPE5__STATIC:PN=PIPE5B;break; - case PIPE6__STATIC:PN=PIPE6B;break; + case PIPE1__STATIC: + PN=PIPE1B;break; + case PIPE2__STATIC: + PN=PIPE2B;break; + case PIPE3__STATIC: + PN=PIPE3B;break; + case PIPE4__STATIC: + PN=PIPE4B;break; + case PIPE5__STATIC: + PN=PIPE5B;break; + case PIPE6__STATIC: + PN=PIPE6B;break; } j = spawn(i,STEAM); @@ -2303,7 +2309,7 @@ void checkhitsprite(short i,short sn) spawn(i,SHT); case SPACEMARINE__STATIC: sprite[i].extra -= sprite[sn].extra; - if(sprite[i].extra > 0) break; + if (sprite[i].extra > 0) break; SA = TRAND&2047; shoot(i,BLOODSPLAT1); SA = TRAND&2047; @@ -2346,27 +2352,27 @@ void checkhitsprite(short i,short sn) case TRIPODCAMERA__STATIC: spritesound(GLASS_HEAVYBREAK,i); s = &sprite[i]; - for(j=0;j<16;j++) RANDOMSCRAP; + for (j=0;j<16;j++) RANDOMSCRAP; deletesprite(i); break; case PLAYERONWATER__STATIC: i = OW; default: - if( (sprite[i].cstat&16) && SHT == 0 && SLT == 0 && sprite[i].statnum == 0) + if ( (sprite[i].cstat&16) && SHT == 0 && SLT == 0 && sprite[i].statnum == 0) break; - if( ( sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i ) && sprite[i].statnum != 4) + if ( ( sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i ) && sprite[i].statnum != 4) { - if( badguy(&sprite[i]) == 1) + if ( badguy(&sprite[i]) == 1) { - if(sprite[sn].picnum == RPG) sprite[sn].extra <<= 1; + if (sprite[sn].picnum == RPG) sprite[sn].extra <<= 1; - if( (PN != DRONE) && (PN != ROTATEGUN) && (PN != COMMANDER) && (PN < GREENSLIME || PN > GREENSLIME+7) ) - if(sprite[sn].picnum != FREEZEBLAST ) - if( actortype[PN] == 0 ) + if ( (PN != DRONE) && (PN != ROTATEGUN) && (PN != COMMANDER) && (PN < GREENSLIME || PN > GREENSLIME+7) ) + if (sprite[sn].picnum != FREEZEBLAST ) + if ( actortype[PN] == 0 ) { j = spawn(sn,JIBS6); - if(sprite[sn].pal == 6) + if (sprite[sn].pal == 6) sprite[j].pal = 6; sprite[j].z += (4<<8); sprite[j].xvel = 16; @@ -2376,8 +2382,8 @@ void checkhitsprite(short i,short sn) j = sprite[sn].owner; - if( j >= 0 && sprite[j].picnum == APLAYER && PN != ROTATEGUN && PN != DRONE ) - if( ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON ) + if ( j >= 0 && sprite[j].picnum == APLAYER && PN != ROTATEGUN && PN != DRONE ) + if ( ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON ) { shoot(i,BLOODSPLAT3); shoot(i,BLOODSPLAT1); @@ -2385,28 +2391,28 @@ void checkhitsprite(short i,short sn) shoot(i,BLOODSPLAT4); } - if( PN != TANK && PN != BOSS1 && PN != BOSS4 && PN != BOSS2 && PN != BOSS3 && PN != RECON && PN != ROTATEGUN ) + if ( PN != TANK && PN != BOSS1 && PN != BOSS4 && PN != BOSS2 && PN != BOSS3 && PN != RECON && PN != ROTATEGUN ) { - if( (sprite[i].cstat&48) == 0 ) + if ( (sprite[i].cstat&48) == 0 ) SA = (sprite[sn].ang+1024)&2047; sprite[i].xvel = -(sprite[sn].extra<<2); j = SECT; pushmove(&SX,&SY,&SZ,&j,128L,(4L<<8),(4L<<8),CLIPMASK0); - if(j != SECT && j >= 0 && j < MAXSECTORS) + if (j != SECT && j >= 0 && j < MAXSECTORS) changespritesect(i,j); } - if(sprite[i].statnum == 2) + if (sprite[i].statnum == 2) { changespritestat(i,1); hittype[i].timetosleep = SLEEPTIME; } - if( ( RX < 24 || PN == SHARK) && sprite[sn].picnum == SHRINKSPARK) return; + if ( ( RX < 24 || PN == SHARK) && sprite[sn].picnum == SHRINKSPARK) return; } - if( sprite[i].statnum != 2 ) + if ( sprite[i].statnum != 2 ) { - if( sprite[sn].picnum == FREEZEBLAST && ( (PN == APLAYER && sprite[i].pal == 1 ) || ( freezerhurtowner == 0 && sprite[sn].owner == i ) ) ) + if ( sprite[sn].picnum == FREEZEBLAST && ( (PN == APLAYER && sprite[i].pal == 1 ) || ( freezerhurtowner == 0 && sprite[sn].owner == i ) ) ) return; hittype[i].picnum = sprite[sn].picnum; @@ -2415,10 +2421,10 @@ void checkhitsprite(short i,short sn) hittype[i].owner = sprite[sn].owner; } - if(sprite[i].statnum == 10) + if (sprite[i].statnum == 10) { p = sprite[i].yvel; - if(ps[p].newowner >= 0) + if (ps[p].newowner >= 0) { ps[p].newowner = -1; ps[p].posx = ps[p].oposx; @@ -2430,18 +2436,18 @@ void checkhitsprite(short i,short sn) setpal(&ps[p]); j = headspritestat[1]; - while(j >= 0) + while (j >= 0) { - if(sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; + if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; j = nextspritestat[j]; } } - if( RX < 24 && sprite[sn].picnum == SHRINKSPARK) + if ( RX < 24 && sprite[sn].picnum == SHRINKSPARK) return; - if( sprite[hittype[i].owner].picnum != APLAYER) - if(ud.player_skill >= 3) + if ( sprite[hittype[i].owner].picnum != APLAYER) + if (ud.player_skill >= 3) sprite[sn].extra += (sprite[sn].extra>>1); } @@ -2455,14 +2461,14 @@ void allignwarpelevators(void) short i, j; i = headspritestat[3]; - while(i >= 0) + while (i >= 0) { - if( SLT == 17 && SS > 16) + if ( SLT == 17 && SS > 16) { j = headspritestat[3]; - while(j >= 0) + while (j >= 0) { - if( (sprite[j].lotag) == 17 && i != j && + if ( (sprite[j].lotag) == 17 && i != j && (SHT) == (sprite[j].hitag) ) { sector[sprite[j].sectnum].floorz = @@ -2488,7 +2494,7 @@ void cheatkeys(short snum) sb_snum = sync[snum].bits; p = &ps[snum]; - if(p->cheat_phase == 1) return; + if (p->cheat_phase == 1) return; // 1<<0 = jump // 1<<1 = crouch @@ -2522,15 +2528,15 @@ void cheatkeys(short snum) i = p->aim_mode; p->aim_mode = (sb_snum>>23)&1; - if(p->aim_mode < i) + if (p->aim_mode < i) p->return_to_center = 9; - if( (sb_snum&(1<<22)) && p->quick_kick == 0) - if( p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0 ) + if ( (sb_snum&(1<<22)) && p->quick_kick == 0) + if ( p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0 ) { SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); OnEvent(EVENT_QUICKKICK,ps[snum].i,snum, -1); - if(GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0 ) + if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0 ) { p->quick_kick = 14; FTA(80,p); @@ -2542,15 +2548,15 @@ void cheatkeys(short snum) p->interface_toggle_flag |= sb_snum | ((sb_snum&0xf00)?0xf00:0); p->interface_toggle_flag &= j | ((j&0xf00)?0xf00:0); - if(sb_snum && ( sb_snum&(1<<17) ) == 0) + if (sb_snum && ( sb_snum&(1<<17) ) == 0) { - if( sb_snum&(1<<21) ) + if ( sb_snum&(1<<21) ) { KB_ClearKeyDown( sc_Pause ); - if(ud.pause_on) + if (ud.pause_on) ud.pause_on = 0; else ud.pause_on = 1+SHIFTS_IS_PRESSED; - if(ud.pause_on) + if (ud.pause_on) { MUSIC_Pause(); FX_StopAllSounds(); @@ -2558,38 +2564,43 @@ void cheatkeys(short snum) } else { - if(MusicToggle) MUSIC_Continue(); + if (MusicToggle) MUSIC_Continue(); pub = NUMPAGES; pus = NUMPAGES; } } - if(ud.pause_on) return; + if (ud.pause_on) return; - if(sprite[p->i].extra <= 0) return; // if dead... + if (sprite[p->i].extra <= 0) return; // if dead... - if( sb_snum&(1<<30) && p->newowner == -1 ) // inventory button generates event for selected item + if ( sb_snum&(1<<30) && p->newowner == -1 ) // inventory button generates event for selected item { SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); OnEvent(EVENT_INVENTORY,ps[snum].i,snum, -1); - if(GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0 ) + if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0 ) { - switch(p->inven_icon) + switch (p->inven_icon) { - case 4: sb_snum |= (1<<25);break; - case 3: sb_snum |= (1<<24);break; - case 5: sb_snum |= (1<<15);break; - case 1: sb_snum |= (1<<16);break; - case 2: sb_snum |= (1<<12);break; + case 4: + sb_snum |= (1<<25);break; + case 3: + sb_snum |= (1<<24);break; + case 5: + sb_snum |= (1<<15);break; + case 1: + sb_snum |= (1<<16);break; + case 2: + sb_snum |= (1<<12);break; } } } - if( sb_snum&(1<<15) ) + if ( sb_snum&(1<<15) ) { SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); OnEvent(EVENT_USENIGHTVISION,ps[snum].i,snum, -1); - if(GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0 + if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0 && p->heat_amount > 0) { p->heat_on = !p->heat_on; @@ -2600,13 +2611,13 @@ void cheatkeys(short snum) } } - if( (sb_snum&(1<<12)) ) + if ( (sb_snum&(1<<12)) ) { SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); OnEvent(EVENT_USESTEROIDS,ps[snum].i,snum, -1); - if(GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) { - if(p->steroids_amount == 400 ) + if (p->steroids_amount == 400 ) { p->steroids_amount--; spritesound(DUKE_TAKEPILLS,p->i); @@ -2616,84 +2627,84 @@ void cheatkeys(short snum) } return; // is there significance to returning? } - if(p->refresh_inventory) + if (p->refresh_inventory) { sb_snum|=(1<<20); // emulate move left... } - if(p->newowner == -1) - if( sb_snum&(1<<20) || sb_snum&(1<<27)) + if (p->newowner == -1) + if ( sb_snum&(1<<20) || sb_snum&(1<<27)) { p->invdisptime = 26*2; - if( sb_snum&(1<<27) ) k = 1; + if ( sb_snum&(1<<27) ) k = 1; else k = 0; - if(p->refresh_inventory) p->refresh_inventory = 0; + if (p->refresh_inventory) p->refresh_inventory = 0; dainv = p->inven_icon; i = 0; CHECKINV1: - if(i < 9) + if (i < 9) { i++; - switch(dainv) + switch (dainv) { case 4: - if(p->jetpack_amount > 0 && i > 1) + if (p->jetpack_amount > 0 && i > 1) break; - if(k) dainv = 5; + if (k) dainv = 5; else dainv = 3; goto CHECKINV1; case 6: - if(p->scuba_amount > 0 && i > 1) + if (p->scuba_amount > 0 && i > 1) break; - if(k) dainv = 7; + if (k) dainv = 7; else dainv = 5; goto CHECKINV1; case 2: - if(p->steroids_amount > 0 && i > 1) + if (p->steroids_amount > 0 && i > 1) break; - if(k) dainv = 3; + if (k) dainv = 3; else dainv = 1; goto CHECKINV1; case 3: - if(p->holoduke_amount > 0 && i > 1) + if (p->holoduke_amount > 0 && i > 1) break; - if(k) dainv = 4; + if (k) dainv = 4; else dainv = 2; goto CHECKINV1; case 0: case 1: - if(p->firstaid_amount > 0 && i > 1) + if (p->firstaid_amount > 0 && i > 1) break; - if(k) dainv = 2; + if (k) dainv = 2; else dainv = 7; goto CHECKINV1; case 5: - if(p->heat_amount > 0 && i > 1) + if (p->heat_amount > 0 && i > 1) break; - if(k) dainv = 6; + if (k) dainv = 6; else dainv = 4; goto CHECKINV1; case 7: - if(p->boot_amount > 0 && i > 1) + if (p->boot_amount > 0 && i > 1) break; - if(k) dainv = 1; + if (k) dainv = 1; else dainv = 6; goto CHECKINV1; } } else dainv = 0; - if( sb_snum&(1<<20) ) // Inventory_Left + if ( sb_snum&(1<<20) ) // Inventory_Left { SetGameVarID(g_iReturnVarID,dainv,ps[snum].i,snum); OnEvent(EVENT_INVENTORYLEFT,ps[snum].i,snum, -1); dainv=GetGameVarID(g_iReturnVarID,ps[snum].i,snum); } - if( sb_snum&(1<<27) ) // Inventory_Right + if ( sb_snum&(1<<27) ) // Inventory_Right { SetGameVarID(g_iReturnVarID,dainv,ps[snum].i,snum); OnEvent(EVENT_INVENTORYRIGHT,ps[snum].i,snum, -1); @@ -2702,15 +2713,22 @@ CHECKINV1: p->inven_icon = dainv; - switch(dainv) + switch (dainv) { - case 1: FTA(3,p);break; - case 2: FTA(90,p);break; - case 3: FTA(91,p);break; - case 4: FTA(88,p);break; - case 5: FTA(101,p);break; - case 6: FTA(89,p);break; - case 7: FTA(6,p);break; + case 1: + FTA(3,p);break; + case 2: + FTA(90,p);break; + case 3: + FTA(91,p);break; + case 4: + FTA(88,p);break; + case 5: + FTA(101,p);break; + case 6: + FTA(89,p);break; + case 7: + FTA(6,p);break; } } @@ -2718,7 +2736,7 @@ CHECKINV1: SetGameVarID(g_iReturnVarID,j,p->i,snum); - switch(j) + switch (j) { case 0: OnEvent(EVENT_WEAPKEY1,p->i,snum, -1); @@ -2758,31 +2776,31 @@ CHECKINV1: break; } - if((unsigned long) GetGameVarID(g_iReturnVarID,p->i,snum) != j) + if ((unsigned long) GetGameVarID(g_iReturnVarID,p->i,snum) != j) j = (unsigned long) GetGameVarID(g_iReturnVarID,p->i,snum); if (p->reloading == 1) j = -1; - else if( j > 0 && p->kickback_pic == 1 && p->weapon_pos == 1) + else if ( j > 0 && p->kickback_pic == 1 && p->weapon_pos == 1) { p->wantweaponfire = j; p->kickback_pic = 0; } - if(p->last_pissed_time <= (26*218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && sprite[p->i].xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0 ) + if (p->last_pissed_time <= (26*218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && sprite[p->i].xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0 ) { // if( ( p->weapon_pos == 0 || ( p->holster_weapon && p->weapon_pos == -9 ) )) { - if(j == 10 || j == 11) + if (j == 10 || j == 11) { k = p->curr_weapon; j = ( j == 10 ? -1 : 1 ); // JBF: prev (-1) or next (1) weapon choice i = 0; - while( ( k >= 0 && k < 10 ) || ( PLUTOPAK && k == GROW_WEAPON && (p->subweapon&(1<= 0 && k < 10 ) || ( PLUTOPAK && k == GROW_WEAPON && (p->subweapon&(1<subweapon&(1<subweapon&(1<gotweapon[k] && p->ammo_amount[k] > 0 ) + if ( p->gotweapon[k] && p->ammo_amount[k] > 0 ) { if (PLUTOPAK) // JBF 20040116: so we don't select grower with v1.3d - if( k == SHRINKER_WEAPON && (p->subweapon&(1<subweapon&(1<ammo_amount[GROW_WEAPON] == 0 && p->gotweapon[SHRINKER_WEAPON] && p->ammo_amount[SHRINKER_WEAPON] > 0) // JBF 20040116: added PLUTOPAK so we don't select grower with v1.3d + if (PLUTOPAK && k == GROW_WEAPON && p->ammo_amount[GROW_WEAPON] == 0 && p->gotweapon[SHRINKER_WEAPON] && p->ammo_amount[SHRINKER_WEAPON] > 0) // JBF 20040116: added PLUTOPAK so we don't select grower with v1.3d { j = SHRINKER_WEAPON; p->subweapon &= ~(1<ammo_amount[SHRINKER_WEAPON] == 0 && p->gotweapon[SHRINKER_WEAPON] && p->ammo_amount[GROW_WEAPON] > 0) // JBF 20040116: added PLUTOPAK so we don't select grower with v1.3d + if (PLUTOPAK && k == SHRINKER_WEAPON && p->ammo_amount[SHRINKER_WEAPON] == 0 && p->gotweapon[SHRINKER_WEAPON] && p->ammo_amount[GROW_WEAPON] > 0) // JBF 20040116: added PLUTOPAK so we don't select grower with v1.3d { j = GROW_WEAPON; p->subweapon |= (1<i, snum); SetGameVarID(g_iReturnVarID,0,p->i,snum); OnEvent(EVENT_SELECTWEAPON,p->i,snum, -1); - if(GetGameVarID(g_iReturnVarID,p->i,snum) == 0) + if (GetGameVarID(g_iReturnVarID,p->i,snum) == 0) { - if( j == HANDBOMB_WEAPON && p->ammo_amount[HANDBOMB_WEAPON] == 0 ) + if ( j == HANDBOMB_WEAPON && p->ammo_amount[HANDBOMB_WEAPON] == 0 ) { k = headspritestat[1]; - while(k >= 0) + while (k >= 0) { - if( sprite[k].picnum == HEAVYHBOMB && sprite[k].owner == p->i ) + if ( sprite[k].picnum == HEAVYHBOMB && sprite[k].owner == p->i ) { p->gotweapon[HANDBOMB_WEAPON] = 1; j = HANDREMOTE_WEAPON; @@ -2852,26 +2870,26 @@ CHECKINV1: } } - if(j == SHRINKER_WEAPON && PLUTOPAK) // JBF 20040116: so we don't select the grower with v1.3d + if (j == SHRINKER_WEAPON && PLUTOPAK) // JBF 20040116: so we don't select the grower with v1.3d { - if(screenpeek == snum) pus = NUMPAGES; + if (screenpeek == snum) pus = NUMPAGES; - if( p->curr_weapon != GROW_WEAPON && p->curr_weapon != SHRINKER_WEAPON ) + if ( p->curr_weapon != GROW_WEAPON && p->curr_weapon != SHRINKER_WEAPON ) { - if( p->ammo_amount[GROW_WEAPON] > 0 ) + if ( p->ammo_amount[GROW_WEAPON] > 0 ) { - if( (p->subweapon&(1<subweapon&(1<ammo_amount[SHRINKER_WEAPON] == 0) + else if (p->ammo_amount[SHRINKER_WEAPON] == 0) { j = GROW_WEAPON; p->subweapon |= (1<ammo_amount[SHRINKER_WEAPON] > 0 ) + else if ( p->ammo_amount[SHRINKER_WEAPON] > 0 ) p->subweapon &= ~(1<curr_weapon == SHRINKER_WEAPON ) + else if ( p->curr_weapon == SHRINKER_WEAPON ) { p->subweapon |= (1<subweapon &= ~(1<holster_weapon) + if (p->holster_weapon) { sb_snum |= 1<<19; p->weapon_pos = -9; } - else if( (long)j >= 0 && p->gotweapon[j] && (unsigned long)p->curr_weapon != j ) - switch(j) + else if ( (long)j >= 0 && p->gotweapon[j] && (unsigned long)p->curr_weapon != j ) + switch (j) { case KNEE_WEAPON: addweapon( p, KNEE_WEAPON ); break; case PISTOL_WEAPON: if ( p->ammo_amount[PISTOL_WEAPON] == 0 ) - if(p->show_empty_weapon == 0) + if (p->show_empty_weapon == 0) { p->last_full_weapon = p->curr_weapon; p->show_empty_weapon = 32; @@ -2901,7 +2919,7 @@ CHECKINV1: addweapon( p, PISTOL_WEAPON ); break; case SHOTGUN_WEAPON: - if( p->ammo_amount[SHOTGUN_WEAPON] == 0 && p->show_empty_weapon == 0) + if ( p->ammo_amount[SHOTGUN_WEAPON] == 0 && p->show_empty_weapon == 0) { p->last_full_weapon = p->curr_weapon; p->show_empty_weapon = 32; @@ -2909,7 +2927,7 @@ CHECKINV1: addweapon( p, SHOTGUN_WEAPON); break; case CHAINGUN_WEAPON: - if( p->ammo_amount[CHAINGUN_WEAPON] == 0 && p->show_empty_weapon == 0) + if ( p->ammo_amount[CHAINGUN_WEAPON] == 0 && p->show_empty_weapon == 0) { p->last_full_weapon = p->curr_weapon; p->show_empty_weapon = 32; @@ -2917,8 +2935,8 @@ CHECKINV1: addweapon( p, CHAINGUN_WEAPON); break; case RPG_WEAPON: - if( p->ammo_amount[RPG_WEAPON] == 0 ) - if(p->show_empty_weapon == 0) + if ( p->ammo_amount[RPG_WEAPON] == 0 ) + if (p->show_empty_weapon == 0) { p->last_full_weapon = p->curr_weapon; p->show_empty_weapon = 32; @@ -2926,7 +2944,7 @@ CHECKINV1: addweapon( p, RPG_WEAPON ); break; case DEVISTATOR_WEAPON: - if( p->ammo_amount[DEVISTATOR_WEAPON] == 0 && p->show_empty_weapon == 0 ) + if ( p->ammo_amount[DEVISTATOR_WEAPON] == 0 && p->show_empty_weapon == 0 ) { p->last_full_weapon = p->curr_weapon; p->show_empty_weapon = 32; @@ -2934,7 +2952,7 @@ CHECKINV1: addweapon( p, DEVISTATOR_WEAPON ); break; case FREEZE_WEAPON: - if( p->ammo_amount[FREEZE_WEAPON] == 0 && p->show_empty_weapon == 0) + if ( p->ammo_amount[FREEZE_WEAPON] == 0 && p->show_empty_weapon == 0) { p->last_full_weapon = p->curr_weapon; p->show_empty_weapon = 32; @@ -2944,7 +2962,7 @@ CHECKINV1: case GROW_WEAPON: case SHRINKER_WEAPON: - if( p->ammo_amount[j] == 0 && p->show_empty_weapon == 0) + if ( p->ammo_amount[j] == 0 && p->show_empty_weapon == 0) { p->show_empty_weapon = 32; p->last_full_weapon = p->curr_weapon; @@ -2953,7 +2971,7 @@ CHECKINV1: addweapon(p, j); break; case HANDREMOTE_WEAPON: - if(k >= 0) // Found in list of [1]'s + if (k >= 0) // Found in list of [1]'s { p->curr_weapon = HANDREMOTE_WEAPON; p->last_weapon = -1; @@ -2961,28 +2979,28 @@ CHECKINV1: } break; case HANDBOMB_WEAPON: - if( p->ammo_amount[HANDBOMB_WEAPON] > 0 && p->gotweapon[HANDBOMB_WEAPON] ) + if ( p->ammo_amount[HANDBOMB_WEAPON] > 0 && p->gotweapon[HANDBOMB_WEAPON] ) addweapon( p, HANDBOMB_WEAPON ); break; case TRIPBOMB_WEAPON: - if( p->ammo_amount[TRIPBOMB_WEAPON] > 0 && p->gotweapon[TRIPBOMB_WEAPON] ) + if ( p->ammo_amount[TRIPBOMB_WEAPON] > 0 && p->gotweapon[TRIPBOMB_WEAPON] ) addweapon( p, TRIPBOMB_WEAPON ); break; } } } - if( sb_snum&(1<<19) ) + if ( sb_snum&(1<<19) ) { - if( p->curr_weapon > KNEE_WEAPON ) + if ( p->curr_weapon > KNEE_WEAPON ) { - if(p->holster_weapon == 0 && p->weapon_pos == 0) + if (p->holster_weapon == 0 && p->weapon_pos == 0) { p->holster_weapon = 1; p->weapon_pos = -1; FTA(73,p); } - else if(p->holster_weapon == 1 && p->weapon_pos == -9) + else if (p->holster_weapon == 1 && p->weapon_pos == -9) { p->holster_weapon = 0; p->weapon_pos = 10; @@ -2992,17 +3010,17 @@ CHECKINV1: } } - if( sb_snum&(1<<24) && p->newowner == -1 ) + if ( sb_snum&(1<<24) && p->newowner == -1 ) { - if( p->holoduke_on == -1 ) + if ( p->holoduke_on == -1 ) { SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); OnEvent(EVENT_HOLODUKEON,ps[snum].i,snum, -1); - if(GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) { - if( p->holoduke_amount > 0 ) + if ( p->holoduke_amount > 0 ) { p->inven_icon = 3; @@ -3025,7 +3043,7 @@ CHECKINV1: { SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); OnEvent(EVENT_HOLODUKEOFF,ps[snum].i,snum, -1); - if(GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) { spritesound(TELEPORTER,p->holoduke_on); p->holoduke_on = -1; @@ -3034,17 +3052,17 @@ CHECKINV1: } } - if( sb_snum&(1<<16) ) + if ( sb_snum&(1<<16) ) { SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); OnEvent(EVENT_USEMEDKIT,ps[snum].i,snum, -1); - if(GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) { - if( p->firstaid_amount > 0 && sprite[p->i].extra < max_player_health ) + if ( p->firstaid_amount > 0 && sprite[p->i].extra < max_player_health ) { j = max_player_health-sprite[p->i].extra; - if((unsigned long)p->firstaid_amount > j) + if ((unsigned long)p->firstaid_amount > j) { p->firstaid_amount -= j; sprite[p->i].extra = max_player_health; @@ -3061,19 +3079,19 @@ CHECKINV1: } } - if( sb_snum&(1<<25) && p->newowner == -1) + if ( sb_snum&(1<<25) && p->newowner == -1) { SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); OnEvent(EVENT_USEJETPACK,ps[snum].i,snum, -1); - if(GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) { - if( p->jetpack_amount > 0 ) + if ( p->jetpack_amount > 0 ) { p->jetpack_on = !p->jetpack_on; - if(p->jetpack_on) + if (p->jetpack_on) { p->inven_icon = 4; - if(p->scream_voice > FX_Ok) + if (p->scream_voice > FX_Ok) { FX_StopSound(p->scream_voice); testcallback(DUKE_SCREAM); @@ -3098,11 +3116,11 @@ CHECKINV1: } } - if(sb_snum&(1<<28) && p->one_eighty_count == 0) + if (sb_snum&(1<<28) && p->one_eighty_count == 0) { SetGameVarID(g_iReturnVarID,0,p->i,snum); OnEvent(EVENT_TURNAROUND,p->i,snum, -1); - if(GetGameVarID(g_iReturnVarID,p->i,snum) == 0) + if (GetGameVarID(g_iReturnVarID,p->i,snum) == 0) { p->one_eighty_count = -1024; } @@ -3118,7 +3136,7 @@ void checksectors(short snum) p = &ps[snum]; - switch(sector[p->cursectnum].lotag) + switch (sector[p->cursectnum].lotag) { case 32767: @@ -3127,10 +3145,10 @@ void checksectors(short snum) p->secret_rooms++; return; case -1: - for(i=connecthead;i>=0;i=connectpoint2[i]) + for (i=connecthead;i>=0;i=connectpoint2[i]) ps[i].gm = MODE_EOL; sector[p->cursectnum].lotag = 0; - if(ud.from_bonus) + if (ud.from_bonus) { ud.level_number = ud.from_bonus; ud.m_level_number = ud.level_number; @@ -3139,7 +3157,7 @@ void checksectors(short snum) else { ud.level_number++; - if( (ud.volume_number && ud.level_number > 10 ) || ( ud.volume_number == 0 && ud.level_number > 5 ) ) + if ( (ud.volume_number && ud.level_number > 10 ) || ( ud.volume_number == 0 && ud.level_number > 5 ) ) ud.level_number = 0; ud.m_level_number = ud.level_number; } @@ -3150,9 +3168,9 @@ void checksectors(short snum) p->customexitsound = sector[p->cursectnum].hitag; return; default: - if(sector[p->cursectnum].lotag >= 10000 && sector[p->cursectnum].lotag < 16383) + if (sector[p->cursectnum].lotag >= 10000 && sector[p->cursectnum].lotag < 16383) { - if(snum == screenpeek || (gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND)) + if (snum == screenpeek || (gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND)) spritesound(sector[p->cursectnum].lotag-10000,p->i); sector[p->cursectnum].lotag = 0; } @@ -3162,37 +3180,37 @@ void checksectors(short snum) //After this point the the player effects the map with space - if(p->gm&MODE_TYPE || sprite[p->i].extra <= 0) return; + if (p->gm&MODE_TYPE || sprite[p->i].extra <= 0) return; - if((sync[snum].bits&(1<<29))) + if ((sync[snum].bits&(1<<29))) { SetGameVarID(g_iReturnVarID,0,p->i,snum); OnEvent(EVENT_USE, p->i, snum, -1); - if(GetGameVarID(g_iReturnVarID,p->i,snum) != 0) + if (GetGameVarID(g_iReturnVarID,p->i,snum) != 0) sync[snum].bits &= ~(1<<29); } - if( ud.cashman && sync[snum].bits&(1<<29) ) + if ( ud.cashman && sync[snum].bits&(1<<29) ) lotsofmoney(&sprite[p->i],2); - if(p->newowner >= 0) + if (p->newowner >= 0) { - if( klabs(sync[snum].svel) > 768 || klabs(sync[snum].fvel) > 768 ) + if ( klabs(sync[snum].svel) > 768 || klabs(sync[snum].fvel) > 768 ) { i = -1; goto CLEARCAMERAS; } } - if( !(sync[snum].bits&(1<<29)) && !(sync[snum].bits&(1<<31))) + if ( !(sync[snum].bits&(1<<29)) && !(sync[snum].bits&(1<<31))) p->toggle_key_flag = 0; - else if(!p->toggle_key_flag) + else if (!p->toggle_key_flag) { - if( (sync[snum].bits&(1<<31)) ) + if ( (sync[snum].bits&(1<<31)) ) { - if( p->newowner >= 0 ) + if ( p->newowner >= 0 ) { i = -1; goto CLEARCAMERAS; @@ -3206,36 +3224,36 @@ void checksectors(short snum) i = hitawall(p,&hitscanwall); - if(i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR) - if( wall[hitscanwall].lotag > 0 && !isspritemakingsound(p->i,wall[hitscanwall].lotag) && snum == screenpeek) + if (i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR) + if ( wall[hitscanwall].lotag > 0 && !isspritemakingsound(p->i,wall[hitscanwall].lotag) && snum == screenpeek) { spritesound(wall[hitscanwall].lotag,p->i); return; } - if(hitscanwall >= 0 && (wall[hitscanwall].cstat&16) ) - switch(wall[hitscanwall].overpicnum) + if (hitscanwall >= 0 && (wall[hitscanwall].cstat&16) ) + switch (wall[hitscanwall].overpicnum) { default: - if(wall[hitscanwall].lotag) + if (wall[hitscanwall].lotag) return; } - if(p->newowner >= 0) + if (p->newowner >= 0) neartag(p->oposx,p->oposy,p->oposz,sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,1); else { neartag(p->posx,p->posy,p->posz,sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,1); - if(neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) + if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) neartag(p->posx,p->posy,p->posz+(8<<8),sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,1); - if(neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) + if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) neartag(p->posx,p->posy,p->posz+(16<<8),sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,1); - if(neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) + if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) { neartag(p->posx,p->posy,p->posz+(16<<8),sprite[p->i].sectnum,p->oang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,1280L,3); - if(neartagsprite >= 0) + if (neartagsprite >= 0) { - switch(dynamictostatic[sprite[neartagsprite].picnum]) + switch (dynamictostatic[sprite[neartagsprite].picnum]) { case FEM1__STATIC: case FEM2__STATIC: @@ -3261,58 +3279,58 @@ void checksectors(short snum) } } - if(p->newowner == -1 && neartagsprite == -1 && neartagsector == -1 && neartagwall == -1 ) - if( isanunderoperator(sector[sprite[p->i].sectnum].lotag) ) + if (p->newowner == -1 && neartagsprite == -1 && neartagsector == -1 && neartagwall == -1 ) + if ( isanunderoperator(sector[sprite[p->i].sectnum].lotag) ) neartagsector = sprite[p->i].sectnum; - if( neartagsector >= 0 && (sector[neartagsector].lotag&16384) ) + if ( neartagsector >= 0 && (sector[neartagsector].lotag&16384) ) return; - if( neartagsprite == -1 && neartagwall == -1) - if(sector[p->cursectnum].lotag == 2 ) + if ( neartagsprite == -1 && neartagwall == -1) + if (sector[p->cursectnum].lotag == 2 ) { oldz = hitasprite(p->i,&neartagsprite); - if(oldz > 1280) neartagsprite = -1; + if (oldz > 1280) neartagsprite = -1; } - if(neartagsprite >= 0) + if (neartagsprite >= 0) { - if( checkhitswitch(snum,neartagsprite,1) ) return; + if ( checkhitswitch(snum,neartagsprite,1) ) return; - switch(dynamictostatic[sprite[neartagsprite].picnum]) + switch (dynamictostatic[sprite[neartagsprite].picnum]) { case TOILET__STATIC: case STALL__STATIC: - if(p->last_pissed_time == 0) + if (p->last_pissed_time == 0) { - if(ud.lockout == 0) spritesound(DUKE_URINATE,p->i); + if (ud.lockout == 0) spritesound(DUKE_URINATE,p->i); p->last_pissed_time = 26*220; p->transporter_hold = 29*2; - if(p->holster_weapon == 0) + if (p->holster_weapon == 0) { p->holster_weapon = 1; p->weapon_pos = -1; } - if(sprite[p->i].extra <= (max_player_health-(max_player_health/10) ) ) + if (sprite[p->i].extra <= (max_player_health-(max_player_health/10) ) ) { sprite[p->i].extra += max_player_health/10; p->last_extra = sprite[p->i].extra; } - else if(sprite[p->i].extra < max_player_health ) + else if (sprite[p->i].extra < max_player_health ) sprite[p->i].extra = max_player_health; } - else if(!isspritemakingsound(neartagsprite,FLUSH_TOILET)) + else if (!isspritemakingsound(neartagsprite,FLUSH_TOILET)) spritesound(FLUSH_TOILET,neartagsprite); return; case NUKEBUTTON__STATIC: hitawall(p,&j); - if(j >= 0 && wall[j].overpicnum == 0) - if(hittype[neartagsprite].temp_data[0] == 0) + if (j >= 0 && wall[j].overpicnum == 0) + if (hittype[neartagsprite].temp_data[0] == 0) { - if(ud.noexits && ud.multimode > 1) + if (ud.noexits && ud.multimode > 1) { hittype[p->i].picnum = NUKEBUTTON; hittype[p->i].extra = 250; @@ -3322,19 +3340,19 @@ void checksectors(short snum) hittype[neartagsprite].temp_data[0] = 1; sprite[neartagsprite].owner = p->i; p->buttonpalette = sprite[neartagsprite].pal; - if(p->buttonpalette) + if (p->buttonpalette) ud.secretlevel = sprite[neartagsprite].lotag; else ud.secretlevel = 0; } } return; case WATERFOUNTAIN__STATIC: - if(hittype[neartagsprite].temp_data[0] != 1) + if (hittype[neartagsprite].temp_data[0] != 1) { hittype[neartagsprite].temp_data[0] = 1; sprite[neartagsprite].owner = p->i; - if(sprite[p->i].extra < max_player_health) + if (sprite[p->i].extra < max_player_health) { sprite[p->i].extra++; spritesound(DUKE_DRINKING,p->i); @@ -3351,110 +3369,110 @@ void checksectors(short snum) break; case VIEWSCREEN__STATIC: case VIEWSCREEN2__STATIC: + { + i = headspritestat[1]; + + while (i >= 0) { - i = headspritestat[1]; - - while(i >= 0) + if ( PN == CAMERA1 && SP == 0 && sprite[neartagsprite].hitag == SLT ) { - if( PN == CAMERA1 && SP == 0 && sprite[neartagsprite].hitag == SLT ) - { - SP = 1; //Using this camera - spritesound(MONITOR_ACTIVE,neartagsprite); + SP = 1; //Using this camera + spritesound(MONITOR_ACTIVE,neartagsprite); - sprite[neartagsprite].owner = i; - sprite[neartagsprite].yvel = 1; + sprite[neartagsprite].owner = i; + sprite[neartagsprite].yvel = 1; - j = p->cursectnum; - p->cursectnum = SECT; - setpal(p); - p->cursectnum = j; + j = p->cursectnum; + p->cursectnum = SECT; + setpal(p); + p->cursectnum = j; - // parallaxtype = 2; - p->newowner = i; - return; - } - i = nextspritestat[i]; + // parallaxtype = 2; + p->newowner = i; + return; } + i = nextspritestat[i]; } + } CLEARCAMERAS: - if(i < 0) + if (i < 0) + { + p->posx = p->oposx; + p->posy = p->oposy; + p->posz = p->oposz; + p->ang = p->oang; + p->newowner = -1; + + updatesector(p->posx,p->posy,&p->cursectnum); + setpal(p); + + + i = headspritestat[1]; + while (i >= 0) { - p->posx = p->oposx; - p->posy = p->oposy; - p->posz = p->oposz; - p->ang = p->oang; - p->newowner = -1; - - updatesector(p->posx,p->posy,&p->cursectnum); - setpal(p); - - - i = headspritestat[1]; - while(i >= 0) - { - if(PN==CAMERA1) SP = 0; - i = nextspritestat[i]; - } + if (PN==CAMERA1) SP = 0; + i = nextspritestat[i]; } - else if(p->newowner >= 0) - p->newowner = -1; + } + else if (p->newowner >= 0) + p->newowner = -1; - if( KB_KeyPressed(sc_Escape) ) - KB_ClearKeyDown(sc_Escape); + if ( KB_KeyPressed(sc_Escape) ) + KB_ClearKeyDown(sc_Escape); - return; + return; } } - if( (sync[snum].bits&(1<<29)) == 0 ) return; - else if(p->newowner >= 0) { i = -1; goto CLEARCAMERAS; } + if ( (sync[snum].bits&(1<<29)) == 0 ) return; + else if (p->newowner >= 0) { i = -1; goto CLEARCAMERAS; } - if(neartagwall == -1 && neartagsector == -1 && neartagsprite == -1) - if( klabs(hits(p->i)) < 512 ) + if (neartagwall == -1 && neartagsector == -1 && neartagsprite == -1) + if ( klabs(hits(p->i)) < 512 ) { - if( (TRAND&255) < 16 ) + if ( (TRAND&255) < 16 ) spritesound(DUKE_SEARCH2,p->i); else spritesound(DUKE_SEARCH,p->i); return; } - if( neartagwall >= 0 ) + if ( neartagwall >= 0 ) { - if( wall[neartagwall].lotag > 0 && isadoorwall(wall[neartagwall].picnum) ) + if ( wall[neartagwall].lotag > 0 && isadoorwall(wall[neartagwall].picnum) ) { - if(hitscanwall == neartagwall || hitscanwall == -1) + if (hitscanwall == neartagwall || hitscanwall == -1) checkhitswitch(snum,neartagwall,0); return; } - else if(p->newowner >= 0) + else if (p->newowner >= 0) { i = -1; goto CLEARCAMERAS; } } - if( neartagsector >= 0 && (sector[neartagsector].lotag&16384) == 0 && isanearoperator(sector[neartagsector].lotag) ) + if ( neartagsector >= 0 && (sector[neartagsector].lotag&16384) == 0 && isanearoperator(sector[neartagsector].lotag) ) { i = headspritesect[neartagsector]; - while(i >= 0) + while (i >= 0) { - if( PN == ACTIVATOR || PN == MASTERSWITCH ) + if ( PN == ACTIVATOR || PN == MASTERSWITCH ) return; i = nextspritesect[i]; } operatesectors(neartagsector,p->i); } - else if( (sector[sprite[p->i].sectnum].lotag&16384) == 0 ) + else if ( (sector[sprite[p->i].sectnum].lotag&16384) == 0 ) { - if( isanunderoperator(sector[sprite[p->i].sectnum].lotag) ) + if ( isanunderoperator(sector[sprite[p->i].sectnum].lotag) ) { i = headspritesect[sprite[p->i].sectnum]; - while(i >= 0) + while (i >= 0) { - if(PN == ACTIVATOR || PN == MASTERSWITCH) return; + if (PN == ACTIVATOR || PN == MASTERSWITCH) return; i = nextspritesect[i]; } operatesectors(sprite[p->i].sectnum,p->i); diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 704f45d27..176ee8a58 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -203,15 +203,15 @@ void playmusic(char *fn) short fp; long l; - if(MusicToggle == 0) return; - if(MusicDevice < 0) return; + if (MusicToggle == 0) return; + if (MusicDevice < 0) return; fp = kopen4load(fn,0); - if(fp == -1) return; + if (fp == -1) return; l = kfilelength( fp ); - if(l >= (signed long)sizeof(MusicPtr)) + if (l >= (signed long)sizeof(MusicPtr)) { kclose(fp); return; @@ -226,11 +226,11 @@ char loadsound(unsigned short num) { long fp, l; - if(num >= NUM_SOUNDS || SoundToggle == 0) return 0; + if (num >= NUM_SOUNDS || SoundToggle == 0) return 0; if (FXDevice < 0) return 0; fp = kopen4load(sounds[num],loadfromgrouponly); - if(fp == -1) + if (fp == -1) { // Bsprintf(fta_quotes[113],"Sound %s(#%d) not found.",sounds[num],num); // FTA(113,&ps[myconnectindex]); @@ -257,7 +257,7 @@ int xyzsound(short num,short i,long x,long y,long z) // if(num != 358) return 0; - if( num >= NUM_SOUNDS || + if ( num >= NUM_SOUNDS || FXDevice < 0 || ( (soundm[num]&8) && ud.lockout ) || SoundToggle == 0 || @@ -266,21 +266,21 @@ int xyzsound(short num,short i,long x,long y,long z) (ps[myconnectindex].timebeforeexit > 0 && ps[myconnectindex].timebeforeexit <= 26*3) || ps[myconnectindex].gm&MODE_MENU) return -1; - if( soundm[num]&128 ) + if ( soundm[num]&128 ) { sound(num); return 0; } - if( soundm[num]&4 ) + if ( soundm[num]&4 ) { - if(VoiceToggle==0) + if (VoiceToggle==0) return -1; else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && VoiceToggle!=2) return -1; - for(j=0;j 0) && (soundm[j]&4) ) + for (j=0;j 0) && (soundm[j]&4) ) return -1; } @@ -292,54 +292,54 @@ int xyzsound(short num,short i,long x,long y,long z) sndist = FindDistance3D((cx-x),(cy-y),(cz-z)>>4); - if( i >= 0 && (soundm[num]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9 ) + if ( i >= 0 && (soundm[num]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9 ) sndist = divscale14(sndist,(SHT+1)); pitchs = soundps[num]; pitche = soundpe[num]; cx = klabs(pitche-pitchs); - if(cx) + if (cx) { - if( pitchs < pitche ) + if ( pitchs < pitche ) pitch = pitchs + ( rand()%cx ); else pitch = pitche + ( rand()%cx ); } else pitch = pitchs; sndist += soundvo[num]; - if(sndist < 0) sndist = 0; - if( sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,SX,SY,SZ-(24<<8),SECT) ) + if (sndist < 0) sndist = 0; + if ( sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,SX,SY,SZ-(24<<8),SECT) ) sndist += sndist>>5; - switch(num) + switch (num) { case PIPEBOMB_EXPLODE: case LASERTRIP_EXPLODE: case RPG_EXPLODE: - if(sndist > (6144) ) + if (sndist > (6144) ) sndist = 6144; - if(sector[ps[screenpeek].cursectnum].lotag == 2) + if (sector[ps[screenpeek].cursectnum].lotag == 2) pitch -= 1024; break; default: - if(sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&4) == 0) + if (sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&4) == 0) pitch = -768; - if( sndist > 31444 && PN != MUSICANDSFX) + if ( sndist > 31444 && PN != MUSICANDSFX) return -1; break; } if (ps[screenpeek].sound_pitch) pitch += ps[screenpeek].sound_pitch; - if( Sound[num].num > 0 && PN != MUSICANDSFX ) + if ( Sound[num].num > 0 && PN != MUSICANDSFX ) { - if( SoundOwner[num][0].i == i ) stopsound(num); - else if( Sound[num].num > 1 ) stopsound(num); - else if( badguy(&sprite[i]) && sprite[i].extra <= 0 ) stopsound(num); + if ( SoundOwner[num][0].i == i ) stopsound(num); + else if ( Sound[num].num > 1 ) stopsound(num); + else if ( badguy(&sprite[i]) && sprite[i].extra <= 0 ) stopsound(num); } - if( PN == APLAYER && sprite[i].yvel == screenpeek ) + if ( PN == APLAYER && sprite[i].yvel == screenpeek ) { sndang = 0; sndist = 0; @@ -350,7 +350,7 @@ int xyzsound(short num,short i,long x,long y,long z) sndang &= 2047; } - if(Sound[num].ptr == 0) { if( loadsound(num) == 0 ) return 0; } + if (Sound[num].ptr == 0) { if ( loadsound(num) == 0 ) return 0; } else { if (Sound[num].lock < 200) @@ -358,20 +358,20 @@ int xyzsound(short num,short i,long x,long y,long z) else Sound[num].lock++; } - if( soundm[num]&16 ) sndist = 0; + if ( soundm[num]&16 ) sndist = 0; - if(sndist < ((255-LOUDESTVOLUME)<<6) ) + if (sndist < ((255-LOUDESTVOLUME)<<6) ) sndist = ((255-LOUDESTVOLUME)<<6); - if( soundm[num]&1 ) + if ( soundm[num]&1 ) { unsigned short start; - if(Sound[num].num > 0) return -1; + if (Sound[num].num > 0) return -1; start = *(unsigned short *)(Sound[num].ptr + 0x14); - if(*Sound[num].ptr == 'C') + if (*Sound[num].ptr == 'C') voice = FX_PlayLoopedVOC( Sound[num].ptr, start, start + soundsiz[num], pitch,sndist>>6,sndist>>6,0,soundpr[num],num); else @@ -380,7 +380,7 @@ int xyzsound(short num,short i,long x,long y,long z) } else { - if( *Sound[num].ptr == 'C') + if ( *Sound[num].ptr == 'C') voice = FX_PlayVOC3D( Sound[ num ].ptr,pitch,sndang>>6,sndist>>6, soundpr[num], num ); else voice = FX_PlayWAV3D( Sound[ num ].ptr,pitch,sndang>>6,sndist>>6, soundpr[num], num ); @@ -403,24 +403,24 @@ void sound(short num) long start; if (FXDevice < 0) return; - if(SoundToggle==0) return; - if(VoiceToggle==0 && (soundm[num]&4) ) return; - if( (soundm[num]&8) && ud.lockout ) return; - if(FX_VoiceAvailable(soundpr[num]) == 0) return; + if (SoundToggle==0) return; + if (VoiceToggle==0 && (soundm[num]&4) ) return; + if ( (soundm[num]&8) && ud.lockout ) return; + if (FX_VoiceAvailable(soundpr[num]) == 0) return; pitchs = soundps[num]; pitche = soundpe[num]; cx = klabs(pitche-pitchs); - if(cx) + if (cx) { - if( pitchs < pitche ) + if ( pitchs < pitche ) pitch = pitchs + ( rand()%cx ); else pitch = pitche + ( rand()%cx ); } else pitch = pitchs; -if(Sound[num].ptr == 0) { if( loadsound(num) == 0 ) return; } +if (Sound[num].ptr == 0) { if ( loadsound(num) == 0 ) return; } else { if (Sound[num].lock < 200) @@ -428,9 +428,9 @@ if(Sound[num].ptr == 0) { if( loadsound(num) == 0 ) return; } else Sound[num].lock++; } - if( soundm[num]&1 ) + if ( soundm[num]&1 ) { - if(*Sound[num].ptr == 'C') + if (*Sound[num].ptr == 'C') { start = (long)*(unsigned short *)(Sound[num].ptr + 0x14); voice = FX_PlayLoopedVOC( Sound[num].ptr, start, start + soundsiz[num], @@ -445,19 +445,19 @@ if(Sound[num].ptr == 0) { if( loadsound(num) == 0 ) return; } } else { - if(*Sound[num].ptr == 'C') + if (*Sound[num].ptr == 'C') voice = FX_PlayVOC3D( Sound[ num ].ptr, pitch,0,255-LOUDESTVOLUME,soundpr[num], num ); else voice = FX_PlayWAV3D( Sound[ num ].ptr, pitch,0,255-LOUDESTVOLUME,soundpr[num], num ); } - if(voice > FX_Ok) return; + if (voice > FX_Ok) return; Sound[num].lock--; } int spritesound(unsigned short num, short i) { - if(num >= NUM_SOUNDS) return -1; + if (num >= NUM_SOUNDS) return -1; return xyzsound(num,i,SX,SY,SZ); } @@ -468,7 +468,7 @@ void stopspritesound(short num, short i) void stopsound(short num) { - if(Sound[num].num > 0) + if (Sound[num].num > 0) { FX_StopSound(SoundOwner[num][Sound[num].num-1].voice); testcallback(num); @@ -479,11 +479,11 @@ void stopenvsound(short num,short i) { short j, k; - if(Sound[num].num > 0) + if (Sound[num].num > 0) { k = Sound[num].num; - for(j=0;j>4); - if( i >= 0 && (soundm[j]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9 ) + if ( i >= 0 && (soundm[j]&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9 ) sndist = divscale14(sndist,(SHT+1)); } sndist += soundvo[j]; - if(sndist < 0) sndist = 0; + if (sndist < 0) sndist = 0; - if( sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,sx,sy,sz-(24<<8),SECT) ) + if ( sndist && PN != MUSICANDSFX && !cansee(cx,cy,cz-(24<<8),cs,sx,sy,sz-(24<<8),SECT) ) sndist += sndist>>5; - if(PN == MUSICANDSFX && SLT < 999) + if (PN == MUSICANDSFX && SLT < 999) numenvsnds++; - switch(j) + switch (j) { case PIPEBOMB_EXPLODE: case LASERTRIP_EXPLODE: case RPG_EXPLODE: - if(sndist > (6144)) sndist = (6144); + if (sndist > (6144)) sndist = (6144); break; default: - if( sndist > 31444 && PN != MUSICANDSFX) + if ( sndist > 31444 && PN != MUSICANDSFX) { stopsound(j); continue; } } - if(Sound[j].ptr == 0 && loadsound(j) == 0 ) continue; - if( soundm[j]&16 ) sndist = 0; + if (Sound[j].ptr == 0 && loadsound(j) == 0 ) continue; + if ( soundm[j]&16 ) sndist = 0; - if(sndist < ((255-LOUDESTVOLUME)<<6) ) + if (sndist < ((255-LOUDESTVOLUME)<<6) ) sndist = ((255-LOUDESTVOLUME)<<6); FX_Pan3D(SoundOwner[j][k].voice,sndang>>6,sndist>>6); @@ -575,25 +575,25 @@ void testcallback(unsigned long num) { short tempi,tempj,tempk; - if((long)num < 0) + if ((long)num < 0) { - if(lumplockbyte[-num] >= 200) + if (lumplockbyte[-num] >= 200) lumplockbyte[-num]--; return; } tempk = Sound[num].num; - if(tempk > 0) + if (tempk > 0) { - if( (soundm[num]&16) == 0) - for(tempj=0;tempj= 200) + for (i=0;i= 200) Sound[i].lock = 199; - for(i=0;i<11;i++) - if(lumplockbyte[i] >= 200) + for (i=0;i<11;i++) + if (lumplockbyte[i] >= 200) lumplockbyte[i] = 199; } @@ -630,8 +630,8 @@ int isspritemakingsound(short i, int num) int issoundplaying(short i, int num) { - if(i == -1) { - if(Sound[num].lock == 200) + if (i == -1) { + if (Sound[num].lock == 200) return 1; else return 0; } diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index ed2cc4308..513fb7422 100755 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -157,10 +157,12 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case IDCINPUTJOY: settings.usejoy = IsDlgButtonChecked(hwndDlg, IDCINPUTJOY) == BST_CHECKED; return TRUE; - default: break; + default: + break; } break; - default: break; + default: + break; } return FALSE; } @@ -171,20 +173,22 @@ static INT_PTR CALLBACK GamePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA case WM_COMMAND: switch (LOWORD(wParam)) { case IDGDATA: { - int i; - if (HIWORD(wParam) != LBN_SELCHANGE) break; - i = ListBox_GetCurSel((HWND)lParam); - if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i); - if (i != CB_ERR) { - strcpy(settings.selectedgrp, ((struct grpfile*)i)->name); - settings.game = ((struct grpfile*)i)->game; - } - return TRUE; + int i; + if (HIWORD(wParam) != LBN_SELCHANGE) break; + i = ListBox_GetCurSel((HWND)lParam); + if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i); + if (i != CB_ERR) { + strcpy(settings.selectedgrp, ((struct grpfile*)i)->name); + settings.game = ((struct grpfile*)i)->game; } - default: break; + return TRUE; + } + default: + break; } break; - default: break; + default: + break; } return FALSE; } @@ -224,137 +228,137 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, switch (uMsg) { case WM_INITDIALOG: { - HWND hwnd; - RECT r, rdlg, chrome, rtab, rcancel, rstart; - int xoffset = 0, yoffset = 0; + HWND hwnd; + RECT r, rdlg, chrome, rtab, rcancel, rstart; + int xoffset = 0, yoffset = 0; - // Fetch the positions (in screen coordinates) of all the windows we need to tweak - ZeroMemory(&chrome, sizeof(chrome)); - AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE); - GetWindowRect(hwndDlg, &rdlg); - GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab); - GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel); - GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart); + // Fetch the positions (in screen coordinates) of all the windows we need to tweak + ZeroMemory(&chrome, sizeof(chrome)); + AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE); + GetWindowRect(hwndDlg, &rdlg); + GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab); + GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel); + GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart); - // Knock off the non-client area of the main dialogue to give just the client area - rdlg.left -= chrome.left; rdlg.top -= chrome.top; - rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom; + // Knock off the non-client area of the main dialogue to give just the client area + rdlg.left -= chrome.left; rdlg.top -= chrome.top; + rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom; - // Translate them to client-relative coordinates wrt the main dialogue window - rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1; - rtab.left -= rdlg.left; rtab.top -= rdlg.top; + // Translate them to client-relative coordinates wrt the main dialogue window + rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1; + rtab.left -= rdlg.left; rtab.top -= rdlg.top; - rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1; - rcancel.left -= rdlg.left; rcancel.top -= rdlg.top; + rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1; + rcancel.left -= rdlg.left; rcancel.top -= rdlg.top; - rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1; - rstart.left -= rdlg.left; rstart.top -= rdlg.top; + rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1; + rstart.left -= rdlg.left; rstart.top -= rdlg.top; - // And then convert the main dialogue coordinates to just width/length - rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1; - rdlg.left = 0; rdlg.top = 0; + // And then convert the main dialogue coordinates to just width/length + rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1; + rdlg.left = 0; rdlg.top = 0; - // Load the bitmap into the bitmap control and fetch its dimensions - hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP)); - hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP); - SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp); + // Load the bitmap into the bitmap control and fetch its dimensions + hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP)); + hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP); + SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp); + GetClientRect(hwnd, &r); + xoffset = r.right; + yoffset = r.bottom - rdlg.bottom; + + // Shift and resize the controls that require it + rtab.left += xoffset; rtab.bottom += yoffset; + rcancel.left += xoffset; rcancel.top += yoffset; + rstart.left += xoffset; rstart.top += yoffset; + rdlg.right += xoffset; + rdlg.bottom += yoffset; + + // Move the controls to their new positions + MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE); + MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE); + MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE); + + // Move the main dialogue to the centre of the screen + hdc = GetDC(NULL); + rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2; + rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2; + ReleaseDC(NULL, hdc); + MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left, + rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE); + + // Add tabs to the tab control + { + TCITEM tab; + + hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL); + + ZeroMemory(&tab, sizeof(tab)); + tab.mask = TCIF_TEXT; + tab.pszText = TEXT("Configuration"); + SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab); + tab.mask = TCIF_TEXT; + tab.pszText = TEXT("Game"); + SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_GAME, (LPARAM)&tab); + tab.mask = TCIF_TEXT; + tab.pszText = TEXT("Messages"); + SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab); + + // Work out the position and size of the area inside the tab control for the pages + ZeroMemory(&r, sizeof(r)); GetClientRect(hwnd, &r); - xoffset = r.right; - yoffset = r.bottom - rdlg.bottom; + SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r); + r.right -= r.left-1; + r.bottom -= r.top-1; + r.top += rtab.top; + r.left += rtab.left; - // Shift and resize the controls that require it - rtab.left += xoffset; rtab.bottom += yoffset; - rcancel.left += xoffset; rcancel.top += yoffset; - rstart.left += xoffset; rstart.top += yoffset; - rdlg.right += xoffset; - rdlg.bottom += yoffset; + // Create the pages and position them in the tab control, but hide them + pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(), + MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc); + pages[TAB_GAME] = CreateDialog((HINSTANCE)win_gethinstance(), + MAKEINTRESOURCE(WIN_STARTWINPAGE_GAME), hwndDlg, GamePageProc); + pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES); + SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); + SetWindowPos(pages[TAB_GAME], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); + SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); - // Move the controls to their new positions - MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE); - MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE); - MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE); + // Tell the editfield acting as the console to exclude the width of the scrollbar + GetClientRect(pages[TAB_MESSAGES],&r); + r.right -= GetSystemMetrics(SM_CXVSCROLL)+4; + r.left = r.top = 0; + SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r); - // Move the main dialogue to the centre of the screen - hdc = GetDC(NULL); - rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2; - rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2; - ReleaseDC(NULL, hdc); - MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left, - rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE); - - // Add tabs to the tab control + // Set a tab stop in the game data listbox { - TCITEM tab; - - hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL); - - ZeroMemory(&tab, sizeof(tab)); - tab.mask = TCIF_TEXT; - tab.pszText = TEXT("Configuration"); - SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab); - tab.mask = TCIF_TEXT; - tab.pszText = TEXT("Game"); - SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_GAME, (LPARAM)&tab); - tab.mask = TCIF_TEXT; - tab.pszText = TEXT("Messages"); - SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab); - - // Work out the position and size of the area inside the tab control for the pages - ZeroMemory(&r, sizeof(r)); - GetClientRect(hwnd, &r); - SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r); - r.right -= r.left-1; - r.bottom -= r.top-1; - r.top += rtab.top; - r.left += rtab.left; - - // Create the pages and position them in the tab control, but hide them - pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(), - MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc); - pages[TAB_GAME] = CreateDialog((HINSTANCE)win_gethinstance(), - MAKEINTRESOURCE(WIN_STARTWINPAGE_GAME), hwndDlg, GamePageProc); - pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES); - SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); - SetWindowPos(pages[TAB_GAME], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); - SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); - - // Tell the editfield acting as the console to exclude the width of the scrollbar - GetClientRect(pages[TAB_MESSAGES],&r); - r.right -= GetSystemMetrics(SM_CXVSCROLL)+4; - r.left = r.top = 0; - SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r); - - // Set a tab stop in the game data listbox - { - DWORD tabs[1] = { 150 }; - ListBox_SetTabStops(GetDlgItem(pages[TAB_GAME], IDGDATA), 1, tabs); - } - - SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START)); - SetWindowText(hwndDlg, apptitle); + DWORD tabs[1] = { 150 }; + ListBox_SetTabStops(GetDlgItem(pages[TAB_GAME], IDGDATA), 1, tabs); } - return FALSE; + + SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START)); + SetWindowText(hwndDlg, apptitle); } + return FALSE; + } case WM_NOTIFY: { - LPNMHDR nmhdr = (LPNMHDR)lParam; - int cur; - if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break; - cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0); - switch (nmhdr->code) { - case TCN_SELCHANGING: { - if (cur < 0 || !pages[cur]) break; - ShowWindow(pages[cur],SW_HIDE); - return TRUE; - } - case TCN_SELCHANGE: { - if (cur < 0 || !pages[cur]) break; - ShowWindow(pages[cur],SW_SHOW); - return TRUE; - } - } - break; + LPNMHDR nmhdr = (LPNMHDR)lParam; + int cur; + if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break; + cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0); + switch (nmhdr->code) { + case TCN_SELCHANGING: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_HIDE); + return TRUE; } + case TCN_SELCHANGE: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_SHOW); + return TRUE; + } + } + break; + } case WM_CLOSE: if (mode == TAB_CONFIG) done = 0; @@ -386,7 +390,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, if (mode == TAB_CONFIG) done = 0; else quitevent++; return TRUE; - case WIN_STARTWIN_START: done = 1; return TRUE; + case WIN_STARTWIN_START: + done = 1; return TRUE; } return FALSE; @@ -395,7 +400,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, return (BOOL)GetSysColorBrush(COLOR_WINDOW); break; - default: break; + default: + break; } return FALSE; @@ -519,8 +525,10 @@ int startwin_run(void) while (done < 0) { switch (GetMessage(&msg, NULL, 0,0)) { - case 0: done = 1; break; - case -1: return -1; + case 0: + done = 1; break; + case -1: + return -1; default: if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break; TranslateMessage(&msg); diff --git a/polymer/eduke32/source/wrapper.c b/polymer/eduke32/source/wrapper.c index 910b2f28d..c8f2ea789 100755 --- a/polymer/eduke32/source/wrapper.c +++ b/polymer/eduke32/source/wrapper.c @@ -20,14 +20,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, in strcpy(sCmdLine,lpCmdLine); szFileName[0] = '\0'; - while(sCmdLine[i] == ' ') i++; - while(i < (signed)strlen(sCmdLine)) + while (sCmdLine[i] == ' ') i++; + while (i < (signed)strlen(sCmdLine)) { - if(sCmdLine[i] == '-' && sCmdLine[i+1] == 'n' && sCmdLine[i+2] == 'e' && sCmdLine[i+3] == 't') + if (sCmdLine[i] == '-' && sCmdLine[i+1] == 'n' && sCmdLine[i+2] == 'e' && sCmdLine[i+3] == 't') { CmdLine[i-1] = '\0'; i += 5; - while(sCmdLine[i] != ' ' && i < (signed)strlen(sCmdLine)) + while (sCmdLine[i] != ' ' && i < (signed)strlen(sCmdLine)) { szFileName[j] = sCmdLine[i]; j++,i++; @@ -40,8 +40,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, in CmdLine[i] = '\0'; } - if(szFileName[0] != '\0' && CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName); - else if(CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s",CmdLine); + if (szFileName[0] != '\0' && CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName); + else if (CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s",CmdLine); else sprintf(sCmdLine,"eduke32.exe"); szCmdLine = sCmdLine;