From 628ef41cc496d05eab7c4c48423f41aabae62bae Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 15 Nov 2006 01:16:55 +0000 Subject: [PATCH] An additional crapload of formatting changes git-svn-id: https://svn.eduke32.com/eduke32@335 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 8746 ++++++++--------- polymer/eduke32/source/anim.c | 231 +- polymer/eduke32/source/astub.c | 3456 +++---- polymer/eduke32/source/config.c | 137 +- polymer/eduke32/source/game.c | 8668 +++++++++-------- polymer/eduke32/source/gamedef.c | 5658 +++++------ polymer/eduke32/source/gameexec.c | 11578 ++++++++++++----------- polymer/eduke32/source/grpscan.c | 70 +- polymer/eduke32/source/menus.c | 7512 ++++++++------- polymer/eduke32/source/namesdyn.c | 1573 +-- polymer/eduke32/source/osdcmds.c | 399 +- polymer/eduke32/source/osdfuncs.c | 21 +- polymer/eduke32/source/player.c | 3179 ++++--- polymer/eduke32/source/premap.c | 727 +- polymer/eduke32/source/rts.c | 12 +- polymer/eduke32/source/savegame.c | 86 +- polymer/eduke32/source/sector.c | 3568 +++---- polymer/eduke32/source/sounds.c | 75 +- polymer/eduke32/source/startgtk.game.c | 98 +- polymer/eduke32/source/startwin.game.c | 553 +- polymer/eduke32/source/testcd.c | 6 +- polymer/eduke32/source/winbits.c | 3 +- polymer/eduke32/source/wrapper.c | 6 +- 23 files changed, 29182 insertions(+), 27180 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 6d6c03363..e0d130405 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -61,11 +61,13 @@ void dointerpolations(long smoothratio) //Stick at beginning of drawscreen { long i, j, odelta, ndelta; - ndelta = 0; j = 0; + ndelta = 0; + j = 0; for (i=numinterpolations-1;i>=0;i--) { bakipos[i] = *curipos[i]; - odelta = ndelta; ndelta = (*curipos[i])-oldipos[i]; + odelta = ndelta; + ndelta = (*curipos[i])-oldipos[i]; if (odelta != ndelta) j = mulscale16(ndelta,smoothratio); *curipos[i] = oldipos[i]+j; } @@ -115,31 +117,37 @@ void addweaponnoswitch(struct player_struct *p, short 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 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; } 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 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; } } @@ -329,7 +337,8 @@ void hitradius(short i, long r, long hp1, long hp2, long hp3, long hp4) { tempshort[0] = s->sectnum; dasect = s->sectnum; - sectcnt = 0; sectend = 1; + sectcnt = 0; + sectend = 1; do { @@ -823,32 +832,32 @@ void movefta(void) if (j) switch (dynamictostatic[s->picnum]) { - case RUBBERCAN__STATIC: - case EXPLODINGBARREL__STATIC: - case WOODENHORSE__STATIC: - case HORSEONSIDE__STATIC: - case CANWITHSOMETHING__STATIC: - case CANWITHSOMETHING2__STATIC: - case CANWITHSOMETHING3__STATIC: - case CANWITHSOMETHING4__STATIC: - case FIREBARREL__STATIC: - case FIREVASE__STATIC: - case NUKEBARREL__STATIC: - case NUKEBARRELDENTED__STATIC: - case NUKEBARRELLEAKED__STATIC: - case TRIPBOMB__STATIC: - if (sector[s->sectnum].ceilingstat&1 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) - s->shade = sector[s->sectnum].ceilingshade; - else s->shade = sector[s->sectnum].floorshade; + case RUBBERCAN__STATIC: + case EXPLODINGBARREL__STATIC: + case WOODENHORSE__STATIC: + case HORSEONSIDE__STATIC: + case CANWITHSOMETHING__STATIC: + case CANWITHSOMETHING2__STATIC: + case CANWITHSOMETHING3__STATIC: + case CANWITHSOMETHING4__STATIC: + case FIREBARREL__STATIC: + case FIREVASE__STATIC: + case NUKEBARREL__STATIC: + case NUKEBARRELDENTED__STATIC: + case NUKEBARRELLEAKED__STATIC: + case TRIPBOMB__STATIC: + if (sector[s->sectnum].ceilingstat&1 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) + s->shade = sector[s->sectnum].ceilingshade; + else s->shade = sector[s->sectnum].floorshade; - hittype[i].timetosleep = 0; - changespritestat(i,6); - break; - default: - hittype[i].timetosleep = 0; - check_fta_sounds(i); - changespritestat(i,1); - break; + hittype[i].timetosleep = 0; + changespritestat(i,6); + break; + default: + hittype[i].timetosleep = 0; + check_fta_sounds(i); + changespritestat(i,1); + break; } else hittype[i].timetosleep = 0; } @@ -943,24 +952,24 @@ short ifhitbyweapon(short sn) switch (dynamictostatic[hittype[sn].picnum]) { - case RADIUSEXPLOSION__STATIC: - case RPG__STATIC: - case HYDRENT__STATIC: - case HEAVYHBOMB__STATIC: - case SEENINE__STATIC: - case OOZFILTER__STATIC: - case EXPLODINGBARREL__STATIC: - 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; - break; - default: - ps[p].posxv += - hittype[sn].extra*(sintable[(hittype[sn].ang+512)&2047])<<1; - ps[p].posyv += - hittype[sn].extra*(sintable[hittype[sn].ang&2047])<<1; - break; + case RADIUSEXPLOSION__STATIC: + case RPG__STATIC: + case HYDRENT__STATIC: + case HEAVYHBOMB__STATIC: + case SEENINE__STATIC: + case OOZFILTER__STATIC: + case EXPLODINGBARREL__STATIC: + 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; + break; + default: + ps[p].posxv += + hittype[sn].extra*(sintable[(hittype[sn].ang+512)&2047])<<1; + ps[p].posyv += + hittype[sn].extra*(sintable[hittype[sn].ang&2047])<<1; + break; } } else @@ -1216,85 +1225,85 @@ void movefx(void) switch (dynamictostatic[s->picnum]) { - case RESPAWN__STATIC: - if (sprite[i].extra == 66) - { - j = spawn(i,SHT); - // sprite[j].pal = sprite[i].pal; - KILLIT(i); - } - else if (sprite[i].extra > (66-13)) - sprite[i].extra++; - break; - - case MUSICANDSFX__STATIC: - - ht = s->hitag; - - if (T2 != SoundToggle) - { - T2 = SoundToggle; - T1 = 0; - } - - if (s->lotag >= 1000 && s->lotag < 2000) - { - x = ldist(&sprite[ps[screenpeek].i],s); - if (x < ht && T1 == 0) + case RESPAWN__STATIC: + if (sprite[i].extra == 66) { - FX_SetReverb(s->lotag - 1000); - T1 = 1; + j = spawn(i,SHT); + // sprite[j].pal = sprite[i].pal; + KILLIT(i); } - if (x >= ht && T1 == 1) + else if (sprite[i].extra > (66-13)) + sprite[i].extra++; + break; + + case MUSICANDSFX__STATIC: + + ht = s->hitag; + + if (T2 != SoundToggle) { - FX_SetReverb(0); - FX_SetReverbDelay(0); + T2 = SoundToggle; T1 = 0; } - } - else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz) - { - if ((soundm[s->lotag]&2)) + + if (s->lotag >= 1000 && s->lotag < 2000) { - x = dist(&sprite[ps[screenpeek].i],s); - if (x < ht && T1 == 0 && FX_VoiceAvailable(soundpr[s->lotag]-1)) + x = ldist(&sprite[ps[screenpeek].i],s); + if (x < ht && T1 == 0) { - if (numenvsnds == NumVoices) - { - j = headspritestat[11]; - 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) - { - stopenvsound(sprite[j].lotag,j); - break; - } - j = nextspritestat[j]; - } - if (j == -1) goto BOLT; - } - spritesound(s->lotag,i); + FX_SetReverb(s->lotag - 1000); T1 = 1; } if (x >= ht && T1 == 1) { + FX_SetReverb(0); + FX_SetReverbDelay(0); T1 = 0; - stopenvsound(s->lotag,i); } } - if ((soundm[s->lotag]&16)) + else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz) { - if (T5 > 0) T5--; - else for (p=connecthead;p>=0;p=connectpoint2[p]) - if (p == myconnectindex && ps[p].cursectnum == s->sectnum) + if ((soundm[s->lotag]&2)) + { + x = dist(&sprite[ps[screenpeek].i],s); + if (x < ht && T1 == 0 && FX_VoiceAvailable(soundpr[s->lotag]-1)) + { + if (numenvsnds == NumVoices) { - j = s->lotag+((unsigned)global_random%(s->hitag+1)); - sound(j); - T5 = 26*40 + (global_random%(26*40)); + j = headspritestat[11]; + 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) + { + stopenvsound(sprite[j].lotag,j); + break; + } + j = nextspritestat[j]; + } + if (j == -1) goto BOLT; } + spritesound(s->lotag,i); + T1 = 1; + } + if (x >= ht && T1 == 1) + { + T1 = 0; + stopenvsound(s->lotag,i); + } + } + 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) + { + j = s->lotag+((unsigned)global_random%(s->hitag+1)); + sound(j); + T5 = 26*40 + (global_random%(26*40)); + } + } } - } - break; + break; } BOLT: i = nexti; @@ -1436,14 +1445,14 @@ void movestandables(void) nextj = nextspritesect[j]; switch (sprite[j].statnum) { - case 1: - case 2: - case 6: - case 10: - s->ang = getangle(msx[t[4]+1]-s->x,msy[t[4]+1]-s->y); - setsprite(j,msx[t[4]+1],msy[t[4]+1],sprite[j].z); - t[0]++; - goto BOLT; + case 1: + case 2: + case 6: + case 10: + s->ang = getangle(msx[t[4]+1]-s->x,msy[t[4]+1]-s->y); + setsprite(j,msx[t[4]+1],msy[t[4]+1],sprite[j].z); + t[0]++; + goto BOLT; } j = nextj; } @@ -1512,10 +1521,10 @@ void movestandables(void) { switch (sprite[j].statnum) { - case 1: - case 6: - s->owner = j; - break; + case 1: + case 6: + s->owner = j; + break; } j = nextspritesect[j]; } @@ -1654,7 +1663,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) @@ -1717,7 +1729,9 @@ void movestandables(void) x = s->extra; s->extra = 1; l = s->ang; - IFHIT { hittype[i].temp_data[6] = 3; T3 = 16; } + IFHIT { hittype[i].temp_data[6] = 3; + T3 = 16; + } s->extra = x; s->ang = l; } @@ -1733,7 +1747,8 @@ void movestandables(void) l = s->ang; s->ang = T6; - T4 = s->x;T5 = s->y; + T4 = s->x; + T5 = s->y; s->x += sintable[(T6+512)&2047]>>9; s->y += sintable[(T6)&2047]>>9; s->z -= (3<<8); @@ -1771,7 +1786,8 @@ void movestandables(void) } } T1++; - s->x = T4;s->y = T5; + s->x = T4; + s->y = T5; s->z += (3<<8); setsprite(i,s->x,s->y,s->z); T4 = 0; @@ -1789,7 +1805,8 @@ void movestandables(void) T2++; - T4 = s->x;T5 = s->y; + T4 = s->x; + T5 = s->y; s->x += sintable[(T6+512)&2047]>>9; s->y += sintable[(T6)&2047]>>9; s->z -= (3<<8); @@ -1797,7 +1814,8 @@ void movestandables(void) x = hitasprite(i,&m); - s->x = T4;s->y = T5; + s->x = T4; + s->y = T5; s->z += (3<<8); setsprite(i,s->x,s->y,s->z); @@ -2007,26 +2025,26 @@ DETONATE: { switch (sprite[j].lotag) { - case 2: - case 21: - case 31: - case 32: - case 36: - hittype[j].temp_data[0] = 1; - break; - case 3: - hittype[j].temp_data[4] = 1; - break; + case 2: + case 21: + case 31: + case 32: + case 36: + hittype[j].temp_data[0] = 1; + break; + case 3: + hittype[j].temp_data[4] = 1; + break; } } else if (sprite[j].statnum == 6) { switch (dynamictostatic[sprite[j].picnum]) { - case SEENINE__STATIC: - case OOZFILTER__STATIC: - sprite[j].shade = -31; - break; + case SEENINE__STATIC: + case OOZFILTER__STATIC: + sprite[j].shade = -31; + break; } } j = nextspritesect[j]; @@ -2037,296 +2055,298 @@ DETONATE: goto BOLT; } switchpicnum = s->picnum; - if ((s->picnum > SIDEBOLT1) && (s->picnum <= SIDEBOLT1+3)) { + if ((s->picnum > SIDEBOLT1) && (s->picnum <= SIDEBOLT1+3)) + { switchpicnum = SIDEBOLT1; } - if ((s->picnum > BOLT1) && (s->picnum <= BOLT1+3)) { + if ((s->picnum > BOLT1) && (s->picnum <= BOLT1+3)) + { switchpicnum = BOLT1; } switch (dynamictostatic[switchpicnum]) { - case VIEWSCREEN__STATIC: - case VIEWSCREEN2__STATIC: + case VIEWSCREEN__STATIC: + case VIEWSCREEN2__STATIC: - if (s->xrepeat == 0) KILLIT(i); + if (s->xrepeat == 0) KILLIT(i); - p = findplayer(s, &x); + p = findplayer(s, &x); - if (x < 2048) - { - if (SP == 1) - camsprite = i; - } - else if (camsprite != -1 && T1 == 1) - { - camsprite = -1; - T1 = 0; - //loadtile(s->picnum); - //invalidatetile(s->picnum,-1,255); - walock[TILE_VIEWSCR] = 199; - } - - goto BOLT; - - case TRASH__STATIC: - - if (s->xvel == 0) s->xvel = 1; - IFMOVING - { - makeitfall(i); - if (TRAND&1) s->zvel -= 256; - if (klabs(s->xvel) < 48) - s->xvel += (TRAND&3); + if (x < 2048) + { + if (SP == 1) + camsprite = i; + } + else if (camsprite != -1 && T1 == 1) + { + camsprite = -1; + T1 = 0; + //loadtile(s->picnum); + //invalidatetile(s->picnum,-1,255); + walock[TILE_VIEWSCR] = 199; } - else KILLIT(i); - break; - case SIDEBOLT1__STATIC: - // case SIDEBOLT1+1: - // case SIDEBOLT1+2: - // case SIDEBOLT1+3: - p = findplayer(s, &x); - if (x > 20480) goto BOLT; + goto BOLT; + + case TRASH__STATIC: + + if (s->xvel == 0) s->xvel = 1; + IFMOVING + { + makeitfall(i); + if (TRAND&1) s->zvel -= 256; + if (klabs(s->xvel) < 48) + s->xvel += (TRAND&3); + } + else KILLIT(i); + break; + + case SIDEBOLT1__STATIC: + // case SIDEBOLT1+1: + // case SIDEBOLT1+2: + // case SIDEBOLT1+3: + p = findplayer(s, &x); + if (x > 20480) goto BOLT; CLEAR_THE_BOLT2: - if (t[2]) - { - t[2]--; + if (t[2]) + { + t[2]--; + goto BOLT; + } + if ((s->xrepeat|s->yrepeat) == 0) + { + s->xrepeat=t[0]; + s->yrepeat=t[1]; + } + if ((TRAND&8) == 0) + { + t[0]=s->xrepeat; + t[1]=s->yrepeat; + t[2] = global_random&4; + s->xrepeat=s->yrepeat=0; + goto CLEAR_THE_BOLT2; + } + s->picnum++; + + if (l&1) s->cstat ^= 2; + + if ((TRAND&1) && sector[sect].floorpicnum == HURTRAIL) + spritesound(SHORT_CIRCUIT,i); + + if (s->picnum == SIDEBOLT1+4) s->picnum = SIDEBOLT1; + goto BOLT; - } - if ((s->xrepeat|s->yrepeat) == 0) - { - s->xrepeat=t[0]; - s->yrepeat=t[1]; - } - if ((TRAND&8) == 0) - { - t[0]=s->xrepeat; - t[1]=s->yrepeat; - t[2] = global_random&4; - s->xrepeat=s->yrepeat=0; - goto CLEAR_THE_BOLT2; - } - s->picnum++; - if (l&1) s->cstat ^= 2; + case BOLT1__STATIC: + // case BOLT1+1: + // case BOLT1+2: + // case BOLT1+3: + p = findplayer(s, &x); + if (x > 20480) goto BOLT; - if ((TRAND&1) && sector[sect].floorpicnum == HURTRAIL) - spritesound(SHORT_CIRCUIT,i); - - if (s->picnum == SIDEBOLT1+4) s->picnum = SIDEBOLT1; - - goto BOLT; - - case BOLT1__STATIC: - // case BOLT1+1: - // case BOLT1+2: - // case BOLT1+3: - p = findplayer(s, &x); - if (x > 20480) goto BOLT; - - if (t[3] == 0) - t[3]=sector[sect].floorshade; + if (t[3] == 0) + t[3]=sector[sect].floorshade; CLEAR_THE_BOLT: - if (t[2]) - { - t[2]--; - sector[sect].floorshade = 20; - sector[sect].ceilingshade = 20; - goto BOLT; - } - if ((s->xrepeat|s->yrepeat) == 0) - { - s->xrepeat=t[0]; - s->yrepeat=t[1]; - } - else if ((TRAND&8) == 0) - { - t[0]=s->xrepeat; - t[1]=s->yrepeat; - t[2] = global_random&4; - s->xrepeat=s->yrepeat=0; - goto CLEAR_THE_BOLT; - } - s->picnum++; - - l = global_random&7; - s->xrepeat=l+8; - - if (l&1) s->cstat ^= 2; - - 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&1) - { - sector[sect].floorshade = 0; - sector[sect].ceilingshade = 0; - } - else - { - sector[sect].floorshade = 20; - sector[sect].ceilingshade = 20; - } - goto BOLT; - - case WATERDRIP__STATIC: - - if (t[1]) - { - t[1]--; - if (t[1] == 0) - s->cstat &= 32767; - } - else - { - makeitfall(i); - ssp(i,CLIPMASK0); - if (s->xvel > 0) s->xvel -= 2; - - if (s->zvel == 0) + if (t[2]) { - s->cstat |= 32768; - - if (s->pal != 2 && s->hitag == 0) - spritesound(SOMETHING_DRIPPING,i); - - if (sprite[s->owner].picnum != WATERDRIP) - { - KILLIT(i); - } - else - { - hittype[i].bposz = s->z = t[0]; - t[1] = 48+(TRAND&31); - } + t[2]--; + sector[sect].floorshade = 20; + sector[sect].ceilingshade = 20; + goto BOLT; } - } - - - goto BOLT; - - case DOORSHOCK__STATIC: - j = klabs(sector[sect].ceilingz-sector[sect].floorz)>>9; - s->yrepeat = j+4; - s->xrepeat = 16; - s->z = sector[sect].floorz; - goto BOLT; - - case TOUCHPLATE__STATIC: - if (t[1] == 1 && s->hitag >= 0) //Move the sector floor - { - x = sector[sect].floorz; - - if (t[3] == 1) + if ((s->xrepeat|s->yrepeat) == 0) { - if (x >= t[2]) - { - sector[sect].floorz = x; - t[1] = 0; - } - else - { - sector[sect].floorz += sector[sect].extra; - p = checkcursectnums(sect); - if (p >= 0) ps[p].posz += sector[sect].extra; - } + s->xrepeat=t[0]; + s->yrepeat=t[1]; + } + else if ((TRAND&8) == 0) + { + t[0]=s->xrepeat; + t[1]=s->yrepeat; + t[2] = global_random&4; + s->xrepeat=s->yrepeat=0; + goto CLEAR_THE_BOLT; + } + s->picnum++; + + l = global_random&7; + s->xrepeat=l+8; + + if (l&1) s->cstat ^= 2; + + 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&1) + { + sector[sect].floorshade = 0; + sector[sect].ceilingshade = 0; } else { - if (x <= s->z) + sector[sect].floorshade = 20; + sector[sect].ceilingshade = 20; + } + goto BOLT; + + case WATERDRIP__STATIC: + + if (t[1]) + { + t[1]--; + if (t[1] == 0) + s->cstat &= 32767; + } + else + { + makeitfall(i); + ssp(i,CLIPMASK0); + if (s->xvel > 0) s->xvel -= 2; + + if (s->zvel == 0) { - sector[sect].floorz = s->z; - t[1] = 0; + s->cstat |= 32768; + + if (s->pal != 2 && s->hitag == 0) + spritesound(SOMETHING_DRIPPING,i); + + if (sprite[s->owner].picnum != WATERDRIP) + { + KILLIT(i); + } + else + { + hittype[i].bposz = s->z = t[0]; + t[1] = 48+(TRAND&31); + } + } + } + + + goto BOLT; + + case DOORSHOCK__STATIC: + j = klabs(sector[sect].ceilingz-sector[sect].floorz)>>9; + s->yrepeat = j+4; + s->xrepeat = 16; + s->z = sector[sect].floorz; + goto BOLT; + + case TOUCHPLATE__STATIC: + if (t[1] == 1 && s->hitag >= 0) //Move the sector floor + { + x = sector[sect].floorz; + + if (t[3] == 1) + { + if (x >= t[2]) + { + sector[sect].floorz = x; + t[1] = 0; + } + else + { + sector[sect].floorz += sector[sect].extra; + p = checkcursectnums(sect); + if (p >= 0) ps[p].posz += sector[sect].extra; + } } else { - sector[sect].floorz -= sector[sect].extra; - p = checkcursectnums(sect); - if (p >= 0) - ps[p].posz -= sector[sect].extra; + if (x <= s->z) + { + sector[sect].floorz = s->z; + t[1] = 0; + } + else + { + sector[sect].floorz -= sector[sect].extra; + p = checkcursectnums(sect); + if (p >= 0) + ps[p].posz -= sector[sect].extra; + } + } + goto BOLT; + } + + if (t[5] == 1) goto BOLT; + + p = checkcursectnums(sect); + if (p >= 0 && (ps[p].on_ground || s->ang == 512)) + { + 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) + { + s->hitag--; + if (s->hitag == 0) t[5] = 1; + } + } + } + else t[0] = 0; + + if (t[1] == 1) + { + j = headspritestat[6]; + while (j >= 0) + { + 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]; + } + j = nextspritestat[j]; } } goto BOLT; - } - if (t[5] == 1) goto BOLT; - - p = checkcursectnums(sect); - if (p >= 0 && (ps[p].on_ground || s->ang == 512)) - { - if (t[0] == 0 && !check_activator_motion(s->lotag)) + case CANWITHSOMETHING__STATIC: + case CANWITHSOMETHING2__STATIC: + case CANWITHSOMETHING3__STATIC: + case CANWITHSOMETHING4__STATIC: + makeitfall(i); + IFHIT { - t[0] = 1; - t[1] = 1; - t[3] = !t[3]; - operatemasterswitches(s->lotag); - operateactivators(s->lotag,p); - if (s->hitag > 0) - { - s->hitag--; - if (s->hitag == 0) t[5] = 1; + spritesound(VENT_BUST,i); + for (j=0;j<10;j++) + RANDOMSCRAP; + + if (s->lotag) spawn(i,s->lotag); + + KILLIT(i); } - } - } - else t[0] = 0; + goto BOLT; - if (t[1] == 1) - { - j = headspritestat[6]; - while (j >= 0) - { - 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]; - } - j = nextspritestat[j]; - } - } - goto BOLT; - - case CANWITHSOMETHING__STATIC: - case CANWITHSOMETHING2__STATIC: - case CANWITHSOMETHING3__STATIC: - case CANWITHSOMETHING4__STATIC: - makeitfall(i); - IFHIT - { - spritesound(VENT_BUST,i); - for (j=0;j<10;j++) - RANDOMSCRAP; - - if (s->lotag) spawn(i,s->lotag); - - KILLIT(i); - } - goto BOLT; - - case EXPLODINGBARREL__STATIC: - case WOODENHORSE__STATIC: - case HORSEONSIDE__STATIC: - case FLOORFLAME__STATIC: - case FIREBARREL__STATIC: - case FIREVASE__STATIC: - case NUKEBARREL__STATIC: - case NUKEBARRELDENTED__STATIC: - case NUKEBARRELLEAKED__STATIC: - case TOILETWATER__STATIC: - case RUBBERCAN__STATIC: - case STEAM__STATIC: - case CEILINGSTEAM__STATIC: - p = findplayer(s, &x); - execute(i,p,x); - goto BOLT; - case WATERBUBBLEMAKER__STATIC: + case EXPLODINGBARREL__STATIC: + case WOODENHORSE__STATIC: + case HORSEONSIDE__STATIC: + case FLOORFLAME__STATIC: + case FIREBARREL__STATIC: + case FIREVASE__STATIC: + case NUKEBARREL__STATIC: + case NUKEBARRELDENTED__STATIC: + case NUKEBARRELLEAKED__STATIC: + case TOILETWATER__STATIC: + case RUBBERCAN__STATIC: + case STEAM__STATIC: + case CEILINGSTEAM__STATIC: p = findplayer(s, &x); - execute(i,p,x); - goto BOLT; + execute(i,p,x); + goto BOLT; + case WATERBUBBLEMAKER__STATIC: + p = findplayer(s, &x); + execute(i,p,x); + goto BOLT; } BOLT: @@ -2346,7 +2366,8 @@ void bounce(short i) hitsect = s->sectnum; - k = sector[hitsect].wallptr; l = wall[k].point2; + k = sector[hitsect].wallptr; + l = wall[k].point2; daang = getangle(wall[l].x-wall[k].x,wall[l].y-wall[k].y); if (s->z < (hittype[i].floorz+hittype[i].ceilingz)>>1) @@ -2444,7 +2465,9 @@ void moveweapons(void) if (thisprojectile[i].drop) s->zvel=s->zvel-thisprojectile[i].drop; - dax = s->x; day = s->y; daz = s->z; + dax = s->x; + day = s->y; + daz = s->z; if (thisprojectile[i].workslike & PROJECTILE_FLAG_TIMED && thisprojectile[i].range > 0) { @@ -2529,7 +2552,10 @@ void moveweapons(void) 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)) @@ -2828,325 +2854,337 @@ void moveweapons(void) // here switch (dynamictostatic[s->picnum]) { - case RADIUSEXPLOSION__STATIC: - case KNEE__STATIC: - KILLIT(i); - case TONGUE__STATIC: - T1 = sintable[(T2)&2047]>>9; - T2 += 32; - if (T2 > 2047) KILLIT(i); + case RADIUSEXPLOSION__STATIC: + case KNEE__STATIC: + KILLIT(i); + case TONGUE__STATIC: + T1 = sintable[(T2)&2047]>>9; + T2 += 32; + if (T2 > 2047) KILLIT(i); - if (sprite[s->owner].statnum == MAXSTATUS) - if (badguy(&sprite[s->owner]) == 0) - KILLIT(i); + 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) - s->z = sprite[s->owner].z-(34<<8); - for (k=0;kang = sprite[s->owner].ang; + s->x = sprite[s->owner].x; + s->y = sprite[s->owner].y; + if (sprite[s->owner].picnum == APLAYER) + s->z = sprite[s->owner].z-(34<<8); + for (k=0;ksectnum, + s->x+((k*sintable[(s->ang+512)&2047])>>9), + s->y+((k*sintable[s->ang&2047])>>9), + s->z+((k*ksgn(s->zvel))*klabs(s->zvel/12)),TONGUE,-40+(k<<1), + 8,8,0,0,0,i,5); + sprite[q].cstat = 128; + sprite[q].pal = 8; + } q = EGS(s->sectnum, s->x+((k*sintable[(s->ang+512)&2047])>>9), s->y+((k*sintable[s->ang&2047])>>9), - s->z+((k*ksgn(s->zvel))*klabs(s->zvel/12)),TONGUE,-40+(k<<1), - 8,8,0,0,0,i,5); + s->z+((k*ksgn(s->zvel))*klabs(s->zvel/12)),INNERJAW,-40, + 32,32,0,0,0,i,5); sprite[q].cstat = 128; - sprite[q].pal = 8; - } - q = EGS(s->sectnum, - s->x+((k*sintable[(s->ang+512)&2047])>>9), - s->y+((k*sintable[s->ang&2047])>>9), - 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)) - sprite[q].picnum = INNERJAW+1; + if (T2 > 512 && T2 < (1024)) + sprite[q].picnum = INNERJAW+1; - goto BOLT; + goto BOLT; - case FREEZEBLAST__STATIC: - if (s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) - { - j = spawn(i,TRANSPORTERSTAR); - sprite[j].pal = 1; - sprite[j].xrepeat = 32; - sprite[j].yrepeat = 32; - KILLIT(i); - } - case SHRINKSPARK__STATIC: - case RPG__STATIC: - case FIRELASER__STATIC: - case SPIT__STATIC: - case COOLEXPLOSION1__STATIC: - - if (s->picnum == COOLEXPLOSION1) - if (!issoundplaying(i,WIERDSHOT_FLY)) - spritesound(WIERDSHOT_FLY,i); - - p = -1; - - if (s->picnum == RPG && sector[s->sectnum].lotag == 2) - { - k = s->xvel>>1; - ll = s->zvel>>1; - } - else - { - k = s->xvel; - ll = s->zvel; - } - - dax = s->x; day = s->y; daz = s->z; - - getglobalz(i); - qq = CLIPMASK1; - - switch (dynamictostatic[s->picnum]) - { - case RPG__STATIC: - if (hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) + case FREEZEBLAST__STATIC: + if (s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) { - j = spawn(i,SMALLSMOKE); - sprite[j].z += (1<<8); + j = spawn(i,TRANSPORTERSTAR); + sprite[j].pal = 1; + sprite[j].xrepeat = 32; + sprite[j].yrepeat = 32; + KILLIT(i); } - break; - } + case SHRINKSPARK__STATIC: + case RPG__STATIC: + case FIRELASER__STATIC: + case SPIT__STATIC: + case COOLEXPLOSION1__STATIC: - j = movesprite(i, - (k*(sintable[(s->ang+512)&2047]))>>14, - (k*(sintable[s->ang&2047]))>>14,ll,qq); + if (s->picnum == COOLEXPLOSION1) + if (!issoundplaying(i,WIERDSHOT_FLY)) + spritesound(WIERDSHOT_FLY,i); - 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; + p = -1; - if (s->sectnum < 0) { KILLIT(i); } - - if ((j&49152) != 49152) - if (s->picnum != FREEZEBLAST) + if (s->picnum == RPG && sector[s->sectnum].lotag == 2) { - if (s->z < hittype[i].ceilingz) + k = s->xvel>>1; + ll = s->zvel>>1; + } + else + { + k = s->xvel; + ll = s->zvel; + } + + dax = s->x; + day = s->y; + daz = s->z; + + getglobalz(i); + qq = CLIPMASK1; + + switch (dynamictostatic[s->picnum]) + { + case RPG__STATIC: + if (hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) + { + j = spawn(i,SMALLSMOKE); + sprite[j].z += (1<<8); + } + break; + } + + j = movesprite(i, + (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) + j = 49152|s->yvel; + + if (s->sectnum < 0) + { + KILLIT(i); + } + + if ((j&49152) != 49152) + if (s->picnum != FREEZEBLAST) { - j = 16384|(s->sectnum); - s->zvel = -1; - } - else - if ((s->z > hittype[i].floorz && sector[s->sectnum].lotag != 1) || - (s->z > hittype[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1)) + if (s->z < hittype[i].ceilingz) { j = 16384|(s->sectnum); - if (sector[s->sectnum].lotag != 1) - s->zvel = 1; + s->zvel = -1; } - } - - if (s->picnum == FIRELASER) - { - for (k=-3;k<2;k++) - { - x = EGS(s->sectnum, - s->x+((k*sintable[(s->ang+512)&2047])>>9), - s->y+((k*sintable[s->ang&2047])>>9), - s->z+((k*ksgn(s->zvel))*klabs(s->zvel/24)),FIRELASER,-40+(k<<2), - s->xrepeat,s->yrepeat,0,0,0,s->owner,5); - - sprite[x].cstat = 128; - sprite[x].pal = s->pal; - } - } - else if (s->picnum == SPIT) if (s->zvel < 6144) - s->zvel += gc-112; - - if (j != 0) - { - if (s->picnum == COOLEXPLOSION1) - { - if ((j&49152) == 49152 && sprite[j&(MAXSPRITES-1)].picnum != APLAYER) - goto BOLT; - s->xvel = 0; - s->zvel = 0; - } - - if ((j&49152) == 49152) - { - j &= (MAXSPRITES-1); - - if (s->picnum == FREEZEBLAST && sprite[j].pal == 1) - if (badguy(&sprite[j]) || sprite[j].picnum == APLAYER) - { - j = spawn(i,TRANSPORTERSTAR); - sprite[j].pal = 1; - sprite[j].xrepeat = 32; - sprite[j].yrepeat = 32; - - KILLIT(i); - } - - checkhitsprite(j,i); - - if (sprite[j].picnum == APLAYER) - { - p = sprite[j].yvel; - spritesound(PISTOL_BODYHIT,j); - - if (s->picnum == SPIT) - { - ps[p].horiz += 32; - ps[p].return_to_center = 8; - - if (ps[p].loogcnt == 0) + else + if ((s->z > hittype[i].floorz && sector[s->sectnum].lotag != 1) || + (s->z > hittype[i].floorz+(16<<8) && sector[s->sectnum].lotag == 1)) { - if (!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) - spritesound(DUKE_LONGTERM_PAIN,ps[p].i); + j = 16384|(s->sectnum); + if (sector[s->sectnum].lotag != 1) + s->zvel = 1; + } + } - j = 3+(TRAND&3); - ps[p].numloogs = j; - ps[p].loogcnt = 24*4; - for (x=0;x < j;x++) + if (s->picnum == FIRELASER) + { + for (k=-3;k<2;k++) + { + x = EGS(s->sectnum, + s->x+((k*sintable[(s->ang+512)&2047])>>9), + s->y+((k*sintable[s->ang&2047])>>9), + s->z+((k*ksgn(s->zvel))*klabs(s->zvel/24)),FIRELASER,-40+(k<<2), + s->xrepeat,s->yrepeat,0,0,0,s->owner,5); + + sprite[x].cstat = 128; + sprite[x].pal = s->pal; + } + } + else if (s->picnum == SPIT) if (s->zvel < 6144) + s->zvel += gc-112; + + if (j != 0) + { + if (s->picnum == COOLEXPLOSION1) + { + if ((j&49152) == 49152 && sprite[j&(MAXSPRITES-1)].picnum != APLAYER) + goto BOLT; + s->xvel = 0; + s->zvel = 0; + } + + if ((j&49152) == 49152) + { + j &= (MAXSPRITES-1); + + if (s->picnum == FREEZEBLAST && sprite[j].pal == 1) + if (badguy(&sprite[j]) || sprite[j].picnum == APLAYER) + { + j = spawn(i,TRANSPORTERSTAR); + sprite[j].pal = 1; + sprite[j].xrepeat = 32; + sprite[j].yrepeat = 32; + + KILLIT(i); + } + + checkhitsprite(j,i); + + if (sprite[j].picnum == APLAYER) + { + p = sprite[j].yvel; + spritesound(PISTOL_BODYHIT,j); + + if (s->picnum == SPIT) + { + ps[p].horiz += 32; + ps[p].return_to_center = 8; + + if (ps[p].loogcnt == 0) { - ps[p].loogiex[x] = TRAND%xdim; - ps[p].loogiey[x] = TRAND%ydim; + 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++) + { + ps[p].loogiex[x] = TRAND%xdim; + ps[p].loogiey[x] = TRAND%ydim; + } } } } } - } - 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)) + else if ((j&49152) == 32768) { - k = getangle( - wall[wall[j].point2].x-wall[j].x, - wall[wall[j].point2].y-wall[j].y); - s->ang = ((k<<1) - s->ang)&2047; - s->owner = i; - spawn(i,TRANSPORTERSTAR); - goto BOLT; - } - else - { - setsprite(i,dax,day,daz); - checkhitwall(i,j,s->x,s->y,s->z,s->picnum); + j &= (MAXWALLS-1); - if (s->picnum == FREEZEBLAST) + if (s->picnum != RPG && s->picnum != FREEZEBLAST && s->picnum != SPIT && (wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR)) { - if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR) - { - s->extra >>= 1; - s->yvel--; - } - k = getangle( wall[wall[j].point2].x-wall[j].x, wall[wall[j].point2].y-wall[j].y); s->ang = ((k<<1) - s->ang)&2047; + s->owner = i; + spawn(i,TRANSPORTERSTAR); goto BOLT; } - } - } - else if ((j&49152) == 16384) - { - setsprite(i,dax,day,daz); - - if (s->zvel < 0) - { - if (sector[s->sectnum].ceilingstat&1) - if (sector[s->sectnum].ceilingpal == 0) - KILLIT(i); - - checkhitceiling(s->sectnum); - } - - if (s->picnum == FREEZEBLAST) - { - bounce(i); - ssp(i,qq); - s->extra >>= 1; - if (s->xrepeat > 8) - s->xrepeat -= 2; - if (s->yrepeat > 8) - s->yrepeat -= 2; - s->yvel--; - goto BOLT; - } - } - - if (s->picnum != SPIT) - { - if (s->picnum == RPG) - { - k = spawn(i,EXPLOSION2); - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; - - if (s->xrepeat < 10) - { - sprite[k].xrepeat = 6; - sprite[k].yrepeat = 6; - } - else if ((j&49152) == 16384) - { - if (s->zvel > 0) - spawn(i,EXPLOSION2BOT); - else { sprite[k].cstat |= 8; sprite[k].z += (48<<8); } - - } - } - 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) - { - k = spawn(i,EXPLOSION2); - sprite[k].xrepeat = sprite[k].yrepeat = s->xrepeat>>1; - if ((j&49152) == 16384) - { - if (s->zvel < 0) - { sprite[k].cstat |= 8; sprite[k].z += (72<<8); } - - } - } - if (s->picnum == RPG) - { - spritesound(RPG_EXPLODE,i); - - if (s->xrepeat >= 10) - { - x = s->extra; - hitradius(i,rpgblastradius, x>>2,x>>1,x-(x>>2),x); - } else { - x = s->extra+(global_random&3); - hitradius(i,(rpgblastradius>>1),x>>2,x>>1,x-(x>>2),x); + setsprite(i,dax,day,daz); + checkhitwall(i,j,s->x,s->y,s->z,s->picnum); + + if (s->picnum == FREEZEBLAST) + { + if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR) + { + s->extra >>= 1; + s->yvel--; + } + + k = getangle( + wall[wall[j].point2].x-wall[j].x, + wall[wall[j].point2].y-wall[j].y); + s->ang = ((k<<1) - s->ang)&2047; + goto BOLT; + } } } + else if ((j&49152) == 16384) + { + setsprite(i,dax,day,daz); + + if (s->zvel < 0) + { + if (sector[s->sectnum].ceilingstat&1) + if (sector[s->sectnum].ceilingpal == 0) + KILLIT(i); + + checkhitceiling(s->sectnum); + } + + if (s->picnum == FREEZEBLAST) + { + bounce(i); + ssp(i,qq); + s->extra >>= 1; + if (s->xrepeat > 8) + s->xrepeat -= 2; + if (s->yrepeat > 8) + s->yrepeat -= 2; + s->yvel--; + goto BOLT; + } + } + + if (s->picnum != SPIT) + { + if (s->picnum == RPG) + { + k = spawn(i,EXPLOSION2); + sprite[k].x = dax; + sprite[k].y = day; + sprite[k].z = daz; + + if (s->xrepeat < 10) + { + sprite[k].xrepeat = 6; + sprite[k].yrepeat = 6; + } + else if ((j&49152) == 16384) + { + if (s->zvel > 0) + spawn(i,EXPLOSION2BOT); + else + { + sprite[k].cstat |= 8; + sprite[k].z += (48<<8); + } + + } + } + 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) + { + k = spawn(i,EXPLOSION2); + sprite[k].xrepeat = sprite[k].yrepeat = s->xrepeat>>1; + if ((j&49152) == 16384) + { + if (s->zvel < 0) + { + sprite[k].cstat |= 8; + sprite[k].z += (72<<8); + } + + } + } + if (s->picnum == RPG) + { + spritesound(RPG_EXPLODE,i); + + if (s->xrepeat >= 10) + { + x = s->extra; + hitradius(i,rpgblastradius, x>>2,x>>1,x-(x>>2),x); + } + else + { + x = s->extra+(global_random&3); + hitradius(i,(rpgblastradius>>1),x>>2,x>>1,x-(x>>2),x); + } + } + } + if (s->picnum != COOLEXPLOSION1) KILLIT(i); } - if (s->picnum != COOLEXPLOSION1) KILLIT(i); - } - if (s->picnum == COOLEXPLOSION1) - { - s->shade++; - if (s->shade >= 40) KILLIT(i); - } - else if (s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140)) - spawn(i,WATERBUBBLE); + if (s->picnum == COOLEXPLOSION1) + { + s->shade++; + if (s->shade >= 40) KILLIT(i); + } + else if (s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140)) + spawn(i,WATERBUBBLE); - goto BOLT; + goto BOLT; - case SHOTSPARK1__STATIC: - p = findplayer(s,&x); - execute(i,p,x); - goto BOLT; + case SHOTSPARK1__STATIC: + p = findplayer(s,&x); + execute(i,p,x); + goto BOLT; } } BOLT: @@ -3186,299 +3224,300 @@ void movetransports(void) switch (sprite[j].statnum) { - case 10: // Player + case 10: // Player - 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 (sprite[j].owner != -1) { - if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0) - { - if (sprite[i].pal == 0) - { - spawn(i,TRANSPORTERBEAM); - spritesound(TELEPORTER,i); - } + p = sprite[j].yvel; - for (k=connecthead;k>=0;k=connectpoint2[k]) - if (ps[k].cursectnum == sprite[OW].sectnum) + ps[p].on_warping_sector = 1; + + 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 (sprite[i].pal == 0) { - ps[k].frag_ps = p; - sprite[ps[k].i].extra = 0; + spawn(i,TRANSPORTERBEAM); + spritesound(TELEPORTER,i); } - ps[p].ang = sprite[OW].ang; + 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; + } - if (sprite[OW].owner != OW) - { - T1 = 13; - hittype[OW].temp_data[0] = 13; - ps[p].transporter_hold = 13; + ps[p].ang = sprite[OW].ang; + + if (sprite[OW].owner != OW) + { + T1 = 13; + hittype[OW].temp_data[0] = 13; + ps[p].transporter_hold = 13; + } + + ps[p].bobposx = ps[p].oposx = ps[p].posx = sprite[OW].x; + ps[p].bobposy = ps[p].oposy = ps[p].posy = sprite[OW].y; + ps[p].oposz = ps[p].posz = sprite[OW].z-PHEIGHT; + + changespritesect(j,sprite[OW].sectnum); + ps[p].cursectnum = sprite[j].sectnum; + + if (sprite[i].pal == 0) + { + k = spawn(OW,TRANSPORTERBEAM); + spritesound(TELEPORTER,k); + } + + break; } - - ps[p].bobposx = ps[p].oposx = ps[p].posx = sprite[OW].x; - ps[p].bobposy = ps[p].oposy = ps[p].posy = sprite[OW].y; - ps[p].oposz = ps[p].posz = sprite[OW].z-PHEIGHT; - - changespritesect(j,sprite[OW].sectnum); - ps[p].cursectnum = sprite[j].sectnum; - - if (sprite[i].pal == 0) - { - k = spawn(OW,TRANSPORTERBEAM); - spritesound(TELEPORTER,k); - } - - 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)) || - (ps[p].jetpack_on && (sync[p].bits&2))) + 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)) + ps[p].posz = sprite[OW].z-6144; + else ps[p].posz = sprite[OW].z+6144; + ps[p].oposz = ps[p].posz; + + hittype[ps[p].i].bposx = ps[p].posx; + hittype[ps[p].i].bposy = ps[p].posy; + hittype[ps[p].i].bposz = ps[p].posz; + + changespritesect(j,sprite[OW].sectnum); + ps[p].cursectnum = sprite[OW].sectnum; + + break; + } + + 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].posz > (sector[sect].floorz-(6<<8)) ) + { + k = 1; + if (screenpeek == p) + { + FX_StopAllSounds(); + clearsoundlocks(); + } + if (sprite[ps[p].i].extra > 0) + spritesound(DUKE_UNDERWATER,j); + ps[p].oposz = ps[p].posz = + sector[sprite[OW].sectnum].ceilingz; + + ps[p].posxv = 4096-(TRAND&8192); + ps[p].posyv = 4096-(TRAND&8192); + // ps[p].poszv += 1080; + } + + 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) + { + FX_StopAllSounds(); + clearsoundlocks(); + } + spritesound(DUKE_GASP,j); + + ps[p].oposz = ps[p].posz = + sector[sprite[OW].sectnum].floorz; + + ps[p].jumping_toggle = 1; + ps[p].jumping_counter = 0; + // ps[p].poszv += 1024; + } + + if (k == 1) { 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)) - ps[p].posz = sprite[OW].z-6144; - else ps[p].posz = sprite[OW].z+6144; - ps[p].oposz = ps[p].posz; - - hittype[ps[p].i].bposx = ps[p].posx; - hittype[ps[p].i].bposy = ps[p].posy; - hittype[ps[p].i].bposz = ps[p].posz; - - changespritesect(j,sprite[OW].sectnum); + if (sprite[OW].owner != OW) + ps[p].transporter_hold = -2; ps[p].cursectnum = sprite[OW].sectnum; - break; + changespritesect(j,sprite[OW].sectnum); + setsprite(ps[p].i,ps[p].posx,ps[p].posy,ps[p].posz+PHEIGHT); + + setpal(&ps[p]); + + if ((TRAND&255) < 32) + spawn(j,WATERSPLASH2); + + if (sectlotag == 1) + for (l = 0;l < 9;l++) + { + q = spawn(ps[p].i,WATERBUBBLE); + sprite[q].z += TRAND&16383; + } } - - 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].posz > (sector[sect].floorz-(6<<8)) ) - { - k = 1; - if (screenpeek == p) - { - FX_StopAllSounds(); - clearsoundlocks(); - } - if (sprite[ps[p].i].extra > 0) - spritesound(DUKE_UNDERWATER,j); - ps[p].oposz = ps[p].posz = - sector[sprite[OW].sectnum].ceilingz; - - ps[p].posxv = 4096-(TRAND&8192); - ps[p].posyv = 4096-(TRAND&8192); - // ps[p].poszv += 1080; } + break; - if (onfloorz && sectlotag == 2 && ps[p].posz < (sector[sect].ceilingz+1080) && ps[p].poszv == 0) + case 1: + if ((sprite[j].picnum == SHARK) + || (sprite[j].picnum == COMMANDER) + || (sprite[j].picnum == OCTABRAIN) + || ((sprite[j].picnum >= GREENSLIME) && (sprite[j].picnum >= GREENSLIME+7)) + ) { - k = 1; - // if( sprite[j].extra <= 0) break; - if (screenpeek == p) - { - FX_StopAllSounds(); - clearsoundlocks(); - } - spritesound(DUKE_GASP,j); - - ps[p].oposz = ps[p].posz = - sector[sprite[OW].sectnum].floorz; - - ps[p].jumping_toggle = 1; - ps[p].jumping_counter = 0; - // ps[p].poszv += 1024; - } - - 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) - ps[p].transporter_hold = -2; - ps[p].cursectnum = sprite[OW].sectnum; - - changespritesect(j,sprite[OW].sectnum); - setsprite(ps[p].i,ps[p].posx,ps[p].posy,ps[p].posz+PHEIGHT); - - setpal(&ps[p]); - - if ((TRAND&255) < 32) - spawn(j,WATERSPLASH2); - - if (sectlotag == 1) - for (l = 0;l < 9;l++) - { - q = spawn(ps[p].i,WATERBUBBLE); - sprite[q].z += TRAND&16383; - } - } - } - break; - - case 1: - if ((sprite[j].picnum == SHARK) - || (sprite[j].picnum == COMMANDER) - || (sprite[j].picnum == OCTABRAIN) - || ((sprite[j].picnum >= GREENSLIME) && (sprite[j].picnum >= GREENSLIME+7)) - ) { - if (sprite[j].extra > 0) - goto JBOLT; - } - case 4: - case 5: - case 12: - case 13: - - ll = klabs(sprite[j].zvel); - - { - warpspriteto = 0; - if (ll && sectlotag == 2 && sprite[j].z < (sector[sect].ceilingz+ll)) - warpspriteto = 1; - - if (ll && sectlotag == 1 && sprite[j].z > (sector[sect].floorz-ll)) - warpspriteto = 1; - - if (sectlotag == 0 && (onfloorz || klabs(sprite[j].z-SZ) < 4096)) - { - if (sprite[OW].owner != OW && onfloorz && T1 > 0 && sprite[j].statnum != 5) - { - T1++; - goto BOLT; - } - warpspriteto = 1; - } - - if (warpspriteto && checkspriteflags(j,SPRITE_FLAG_DECAL)) goto JBOLT; - - if (warpspriteto) switch (dynamictostatic[sprite[j].picnum]) - { - case TRANSPORTERSTAR__STATIC: - case TRANSPORTERBEAM__STATIC: - case TRIPBOMB__STATIC: - case BULLETHOLE__STATIC: - case WATERSPLASH2__STATIC: - case BURNING__STATIC: - case BURNING2__STATIC: - case FIRE__STATIC: - case FIRE2__STATIC: - case TOILETWATER__STATIC: - case LASERLINE__STATIC: + if (sprite[j].extra > 0) goto JBOLT; - case PLAYERONWATER__STATIC: - if (sectlotag == 2) + } + case 4: + case 5: + case 12: + case 13: + + ll = klabs(sprite[j].zvel); + + { + warpspriteto = 0; + if (ll && sectlotag == 2 && sprite[j].z < (sector[sect].ceilingz+ll)) + warpspriteto = 1; + + if (ll && sectlotag == 1 && sprite[j].z > (sector[sect].floorz-ll)) + warpspriteto = 1; + + if (sectlotag == 0 && (onfloorz || klabs(sprite[j].z-SZ) < 4096)) + { + if (sprite[OW].owner != OW && onfloorz && T1 > 0 && sprite[j].statnum != 5) { - sprite[j].cstat &= 32767; - break; + T1++; + goto BOLT; } - default: - if (sprite[j].statnum == 5 && !(sectlotag == 1 || sectlotag == 2)) - break; - - case WATERBUBBLE__STATIC: - // if( rnd(192) && sprite[j].picnum == WATERBUBBLE) - // break; - - if (sectlotag > 0) - { - k = spawn(j,WATERSPLASH2); - if (sectlotag == 1 && sprite[j].statnum == 4) - { - sprite[k].xvel = sprite[j].xvel>>1; - sprite[k].ang = sprite[j].ang; - ssp(k,CLIPMASK0); - } - } - - switch (sectlotag) - { - case 0: - if (onfloorz) - { - 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); - sprite[j].z -= SZ - sector[sprite[OW].sectnum].floorz; - sprite[j].ang = sprite[OW].ang; - - hittype[j].bposx = sprite[j].x; - hittype[j].bposy = sprite[j].y; - hittype[j].bposz = sprite[j].z; - - if (sprite[i].pal == 0) - { - k = spawn(i,TRANSPORTERBEAM); - spritesound(TELEPORTER,k); - - k = spawn(OW,TRANSPORTERBEAM); - spritesound(TELEPORTER,k); - } - - if (sprite[OW].owner != OW) - { - T1 = 13; - hittype[OW].temp_data[0] = 13; - } - - changespritesect(j,sprite[OW].sectnum); - } - } - else - { - sprite[j].x += (sprite[OW].x-SX); - sprite[j].y += (sprite[OW].y-SY); - sprite[j].z = sprite[OW].z+4096; - - hittype[j].bposx = sprite[j].x; - hittype[j].bposy = sprite[j].y; - hittype[j].bposz = sprite[j].z; - - changespritesect(j,sprite[OW].sectnum); - } - break; - case 1: - sprite[j].x += (sprite[OW].x-SX); - sprite[j].y += (sprite[OW].y-SY); - sprite[j].z = sector[sprite[OW].sectnum].ceilingz+ll; - - hittype[j].bposx = sprite[j].x; - hittype[j].bposy = sprite[j].y; - hittype[j].bposz = sprite[j].z; - - changespritesect(j,sprite[OW].sectnum); - - break; - case 2: - sprite[j].x += (sprite[OW].x-SX); - sprite[j].y += (sprite[OW].y-SY); - sprite[j].z = sector[sprite[OW].sectnum].floorz-ll; - - hittype[j].bposx = sprite[j].x; - hittype[j].bposy = sprite[j].y; - hittype[j].bposz = sprite[j].z; - - changespritesect(j,sprite[OW].sectnum); - - break; - } - - break; + warpspriteto = 1; } - } - break; + + if (warpspriteto && checkspriteflags(j,SPRITE_FLAG_DECAL)) goto JBOLT; + + if (warpspriteto) switch (dynamictostatic[sprite[j].picnum]) + { + case TRANSPORTERSTAR__STATIC: + case TRANSPORTERBEAM__STATIC: + case TRIPBOMB__STATIC: + case BULLETHOLE__STATIC: + case WATERSPLASH2__STATIC: + case BURNING__STATIC: + case BURNING2__STATIC: + case FIRE__STATIC: + case FIRE2__STATIC: + case TOILETWATER__STATIC: + case LASERLINE__STATIC: + goto JBOLT; + case PLAYERONWATER__STATIC: + if (sectlotag == 2) + { + sprite[j].cstat &= 32767; + break; + } + default: + if (sprite[j].statnum == 5 && !(sectlotag == 1 || sectlotag == 2)) + break; + + case WATERBUBBLE__STATIC: + // if( rnd(192) && sprite[j].picnum == WATERBUBBLE) + // break; + + if (sectlotag > 0) + { + k = spawn(j,WATERSPLASH2); + if (sectlotag == 1 && sprite[j].statnum == 4) + { + sprite[k].xvel = sprite[j].xvel>>1; + sprite[k].ang = sprite[j].ang; + ssp(k,CLIPMASK0); + } + } + + switch (sectlotag) + { + case 0: + if (onfloorz) + { + 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); + sprite[j].z -= SZ - sector[sprite[OW].sectnum].floorz; + sprite[j].ang = sprite[OW].ang; + + hittype[j].bposx = sprite[j].x; + hittype[j].bposy = sprite[j].y; + hittype[j].bposz = sprite[j].z; + + if (sprite[i].pal == 0) + { + k = spawn(i,TRANSPORTERBEAM); + spritesound(TELEPORTER,k); + + k = spawn(OW,TRANSPORTERBEAM); + spritesound(TELEPORTER,k); + } + + if (sprite[OW].owner != OW) + { + T1 = 13; + hittype[OW].temp_data[0] = 13; + } + + changespritesect(j,sprite[OW].sectnum); + } + } + else + { + sprite[j].x += (sprite[OW].x-SX); + sprite[j].y += (sprite[OW].y-SY); + sprite[j].z = sprite[OW].z+4096; + + hittype[j].bposx = sprite[j].x; + hittype[j].bposy = sprite[j].y; + hittype[j].bposz = sprite[j].z; + + changespritesect(j,sprite[OW].sectnum); + } + break; + case 1: + sprite[j].x += (sprite[OW].x-SX); + sprite[j].y += (sprite[OW].y-SY); + sprite[j].z = sector[sprite[OW].sectnum].ceilingz+ll; + + hittype[j].bposx = sprite[j].x; + hittype[j].bposy = sprite[j].y; + hittype[j].bposz = sprite[j].z; + + changespritesect(j,sprite[OW].sectnum); + + break; + case 2: + sprite[j].x += (sprite[OW].x-SX); + sprite[j].y += (sprite[OW].y-SY); + sprite[j].z = sector[sprite[OW].sectnum].floorz-ll; + + hittype[j].bposx = sprite[j].x; + hittype[j].bposy = sprite[j].y; + hittype[j].bposz = sprite[j].z; + + changespritesect(j,sprite[OW].sectnum); + + break; + } + + break; + } + } + break; } JBOLT: @@ -3515,862 +3554,922 @@ void moveactors(void) hittype[i].bposy = s->y; hittype[i].bposz = s->z; switchpicnum=s->picnum; - if ((s->picnum > GREENSLIME)&&(s->picnum <= GREENSLIME+7)) { + if ((s->picnum > GREENSLIME)&&(s->picnum <= GREENSLIME+7)) + { switchpicnum = GREENSLIME; } switch (dynamictostatic[switchpicnum]) { - case DUCK__STATIC: - case TARGET__STATIC: - if (s->cstat&32) - { - t[0]++; - if (t[0] > 60) + case DUCK__STATIC: + case TARGET__STATIC: + if (s->cstat&32) { - t[0] = 0; - s->cstat = 128+257+16; - s->extra = 1; - } - } - else - { - j = ifhitbyweapon(i); - if (j >= 0) - { - s->cstat = 32+128; - k = 1; - - j = headspritestat[1]; - while (j >= 0) + t[0]++; + if (t[0] > 60) { - if (sprite[j].lotag == s->lotag && - sprite[j].picnum == s->picnum) - { - if ((sprite[j].hitag && !(sprite[j].cstat&32)) || - (!sprite[j].hitag && (sprite[j].cstat&32)) - ) - { - k = 0; - break; - } - } - - j = nextspritestat[j]; + t[0] = 0; + s->cstat = 128+257+16; + s->extra = 1; } - - if (k == 1) - { - operateactivators(s->lotag,-1); - operateforcefields(i,s->lotag); - operatemasterswitches(s->lotag); - } - } - } - goto BOLT; - - case RESPAWNMARKERRED__STATIC: - case RESPAWNMARKERYELLOW__STATIC: - case RESPAWNMARKERGREEN__STATIC: - T1++; - if (T1 > respawnitemtime) - { - KILLIT(i); - } - if (T1 >= (respawnitemtime>>1) && T1 < ((respawnitemtime>>1)+(respawnitemtime>>2))) - PN = RESPAWNMARKERYELLOW; - else if (T1 > ((respawnitemtime>>1)+(respawnitemtime>>2))) - PN = RESPAWNMARKERGREEN; - makeitfall(i); - break; - - case HELECOPT__STATIC: - case DUKECAR__STATIC: - - s->z += s->zvel; - t[0]++; - - if (t[0] == 4) spritesound(WAR_AMBIENCE2,i); - - if (t[0] > (26*8)) - { - sound(RPG_EXPLODE); - for (j=0;j<32;j++) RANDOMSCRAP; - earthquaketime = 16; - KILLIT(i); - } - else if ((t[0]&3) == 0) - spawn(i,EXPLOSION2); - ssp(i,CLIPMASK0); - break; - case RAT__STATIC: - makeitfall(i); - IFMOVING - { - 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); } - else s->ang = (TRAND&2047); - } - if (s->xvel < 128) - s->xvel+=2; - s->ang += (TRAND&3)-6; - break; - case QUEBALL__STATIC: - case STRIPEBALL__STATIC: - if (s->xvel) - { - j = headspritestat[0]; - while (j >= 0) - { - nextj = nextspritestat[j]; - if (sprite[j].picnum == POCKET && ldist(&sprite[j],s) < 52) KILLIT(i); - j = nextj; - } - - j = clipmove(&s->x,&s->y,&s->z,&s->sectnum, - (((s->xvel*(sintable[(s->ang+512)&2047]))>>14)*TICSPERFRAME)<<11, - (((s->xvel*(sintable[s->ang&2047]))>>14)*TICSPERFRAME)<<11, - 24L,(4<<8),(4<<8),CLIPMASK1); - - if (j&49152) - { - if ((j&49152) == 32768) - { - j &= (MAXWALLS-1); - k = getangle( - wall[wall[j].point2].x-wall[j].x, - wall[wall[j].point2].y-wall[j].y); - s->ang = ((k<<1) - s->ang)&2047; - } - else if ((j&49152) == 49152) - { - j &= (MAXSPRITES-1); - checkhitsprite(i,j); - } - } - s->xvel --; - if (s->xvel < 0) s->xvel = 0; - if (s->picnum == STRIPEBALL) - { - s->cstat = 257; - s->cstat |= 4&s->xvel; - s->cstat |= 8&s->xvel; - } - } - else - { - p = findplayer(s,&x); - - 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) - { - a = headspritestat[1]; - while (a >= 0) - { - 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) - { - findplayer(&sprite[a],&l); - if (x > l) break; - } - } - a = nextspritestat[a]; - } - if (a == -1) - { - if (s->pal == 12) - s->xvel = 164; - else s->xvel = 140; - s->ang = ps[p].ang; - ps[p].toggle_key_flag = 2; - } - } - } - } - if (x < 512 && s->sectnum == ps[p].cursectnum) - { - s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); - s->xvel = 48; - } - } - - break; - case FORCESPHERE__STATIC: - - if (s->yvel == 0) - { - s->yvel = 1; - - for (l=512;l<(2048-512);l+= 128) - for (j=0;j<2048;j += 128) - { - k = spawn(i,FORCESPHERE); - sprite[k].cstat = 257+128; - sprite[k].clipdist = 64; - sprite[k].ang = j; - sprite[k].zvel = sintable[l&2047]>>5; - sprite[k].xvel = sintable[(l+512)&2047]>>9; - sprite[k].owner = i; - } - } - - if (t[3] > 0) - { - if (s->zvel < 6144) - s->zvel += 192; - s->z += s->zvel; - if (s->z > sector[sect].floorz) - s->z = sector[sect].floorz; - t[3]--; - if (t[3] == 0) - KILLIT(i); - } - else if (t[2] > 10) - { - j = headspritestat[5]; - while (j >= 0) - { - if (sprite[j].owner == i && sprite[j].picnum == FORCESPHERE) - hittype[j].temp_data[1] = 1+(TRAND&63); - j = nextspritestat[j]; - } - t[3] = 64; - } - - goto BOLT; - - case RECON__STATIC: - - getglobalz(i); - - if (sector[s->sectnum].ceilingstat&1) - 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)) - s->z = sector[sect].ceilingz+(32<<8); - - if (ud.multimode < 2) - { - if (actor_tog == 1) - { - s->cstat = (short)32768; - goto BOLT; - } - else if (actor_tog == 2) s->cstat = 257; - } - IFHIT - { - if (s->extra < 0 && t[0] != -1) - { - t[0] = -1; - s->extra = 0; - } - spritesound(RECO_PAIN,i); - RANDOMSCRAP; - } - - if (t[0] == -1) - { - s->z += 1024; - t[2]++; - 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) - { - for (l=0;l<16;l++) - RANDOMSCRAP; - spritesound(LASERTRIP_EXPLODE,i); - spawn(i,PIGCOP); - ps[myconnectindex].actors_killed++; - KILLIT(i); - } - goto BOLT; - } - else - { - if (s->z > hittype[i].floorz-(48<<8)) - s->z = hittype[i].floorz-(48<<8); - } - - p = findplayer(s,&x); - j = s->owner; - - // 3 = findplayerz, 4 = shoot - - if (t[0] >= 4) - { - t[2]++; - if ((t[2]&15) == 0) - { - a = s->ang; - s->ang = hittype[i].tempang; - spritesound(RECO_ATTACK,i); - 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)) - { - t[0] = 0; - t[2] = 0; - } - 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) - { - t[3] = 0; - if (s->xvel > 0) s->xvel -= 16; - else s->xvel = 0; - - if (t[0] == 2) - { - l = ps[p].posz-s->z; - 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)) + j = ifhitbyweapon(i); + if (j >= 0) { - t[0] = 1; - t[2] = 0; - } - else if ((t[2]&15) == 0) - { - spritesound(RECO_ATTACK,i); - shoot(i,FIRELASER); - } - } - s->ang += getincangle(s->ang,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>2; - } + s->cstat = 32+128; + k = 1; - if (t[0] != 2 && t[0] != 3) - { - l = ldist(&sprite[j],s); - 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 - { - l = dist(&sprite[j],s); - - 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; } - else + j = headspritestat[1]; + while (j >= 0) { - if (s->xvel > 0) s->xvel -= 16; - else s->xvel = 0; + if (sprite[j].lotag == s->lotag && + sprite[j].picnum == s->picnum) + { + if ((sprite[j].hitag && !(sprite[j].cstat&32)) || + (!sprite[j].hitag && (sprite[j].cstat&32)) + ) + { + k = 0; + break; + } + } + + j = nextspritestat[j]; + } + + if (k == 1) + { + operateactivators(s->lotag,-1); + operateforcefields(i,s->lotag); + operatemasterswitches(s->lotag); } } - - if (t[0] < 2) t[2]++; - - if (x < 6144 && t[0] < 2 && t[2] > (26*4)) - { - t[0] = 2+(TRAND&2); - t[2] = 0; - hittype[i].tempang = s->ang; - } } + goto BOLT; - if (t[0] == 0 || t[0] == 5) + case RESPAWNMARKERRED__STATIC: + case RESPAWNMARKERYELLOW__STATIC: + case RESPAWNMARKERGREEN__STATIC: + T1++; + if (T1 > respawnitemtime) { - if (t[0] == 0) - t[0] = 1; - else t[0] = 4; - j = s->owner = LocateTheLocator(s->hitag,-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); - } - else s->hitag++; - } - - t[3] = getincangle(s->ang,a); - s->ang += t[3]>>3; - - if (s->z < sprite[j].z) - s->z += 1024; - else s->z -= 1024; - } - - if (!isspritemakingsound(i,RECO_ROAM)) - spritesound(RECO_ROAM,i); - - ssp(i,CLIPMASK0); - - goto BOLT; - - case OOZ__STATIC: - case OOZ2__STATIC: - - getglobalz(i); - - j = (hittype[i].floorz-hittype[i].ceilingz)>>9; - if (j > 255) j = 255; - - x = 25-(j>>1); - if (x < 8) x = 8; - else if (x > 48) x = 48; - - s->yrepeat = j; - s->xrepeat = x; - s->z = hittype[i].floorz; - - goto BOLT; - - case GREENSLIME__STATIC: - // case GREENSLIME+1: - // case GREENSLIME+2: - // case GREENSLIME+3: - // case GREENSLIME+4: - // case GREENSLIME+5: - // case GREENSLIME+6: - // case GREENSLIME+7: - - // #ifndef VOLUMEONE - if (ud.multimode < 2) - { - if (actor_tog == 1) - { - s->cstat = (short)32768; - goto BOLT; - } - else if (actor_tog == 2) s->cstat = 257; - } - // #endif - - t[1]+=128; - - if (sector[sect].floorstat&1) - KILLIT(i); - - p = findplayer(s,&x); - - if (x > 20480) - { - hittype[i].timetosleep++; - if (hittype[i].timetosleep > SLEEPTIME) - { - hittype[i].timetosleep = 0; - changespritestat(i,2); - goto BOLT; - } - } - - if (t[0] == -5) // FROZEN - { - t[3]++; - if (t[3] > 280) - { - s->pal = 0; - t[0] = 0; - goto BOLT; + KILLIT(i); } + if (T1 >= (respawnitemtime>>1) && T1 < ((respawnitemtime>>1)+(respawnitemtime>>2))) + PN = RESPAWNMARKERYELLOW; + else if (T1 > ((respawnitemtime>>1)+(respawnitemtime>>2))) + PN = RESPAWNMARKERGREEN; makeitfall(i); - s->cstat = 257; - s->picnum = GREENSLIME+2; - s->extra = 1; - s->pal = 1; + break; + + case HELECOPT__STATIC: + case DUKECAR__STATIC: + + s->z += s->zvel; + t[0]++; + + if (t[0] == 4) spritesound(WAR_AMBIENCE2,i); + + if (t[0] > (26*8)) + { + sound(RPG_EXPLODE); + for (j=0;j<32;j++) RANDOMSCRAP; + earthquaketime = 16; + KILLIT(i); + } + else if ((t[0]&3) == 0) + spawn(i,EXPLOSION2); + ssp(i,CLIPMASK0); + break; + case RAT__STATIC: + makeitfall(i); + IFMOVING + { + 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); + } + else s->ang = (TRAND&2047); + } + if (s->xvel < 128) + s->xvel+=2; + s->ang += (TRAND&3)-6; + break; + case QUEBALL__STATIC: + case STRIPEBALL__STATIC: + if (s->xvel) + { + j = headspritestat[0]; + while (j >= 0) + { + nextj = nextspritestat[j]; + if (sprite[j].picnum == POCKET && ldist(&sprite[j],s) < 52) KILLIT(i); + j = nextj; + } + + j = clipmove(&s->x,&s->y,&s->z,&s->sectnum, + (((s->xvel*(sintable[(s->ang+512)&2047]))>>14)*TICSPERFRAME)<<11, + (((s->xvel*(sintable[s->ang&2047]))>>14)*TICSPERFRAME)<<11, + 24L,(4<<8),(4<<8),CLIPMASK1); + + if (j&49152) + { + if ((j&49152) == 32768) + { + j &= (MAXWALLS-1); + k = getangle( + wall[wall[j].point2].x-wall[j].x, + wall[wall[j].point2].y-wall[j].y); + s->ang = ((k<<1) - s->ang)&2047; + } + else if ((j&49152) == 49152) + { + j &= (MAXSPRITES-1); + checkhitsprite(i,j); + } + } + s->xvel --; + if (s->xvel < 0) s->xvel = 0; + if (s->picnum == STRIPEBALL) + { + s->cstat = 257; + s->cstat |= 4&s->xvel; + s->cstat |= 8&s->xvel; + } + } + else + { + p = findplayer(s,&x); + + 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) + { + a = headspritestat[1]; + while (a >= 0) + { + 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) + { + findplayer(&sprite[a],&l); + if (x > l) break; + } + } + a = nextspritestat[a]; + } + if (a == -1) + { + if (s->pal == 12) + s->xvel = 164; + else s->xvel = 140; + s->ang = ps[p].ang; + ps[p].toggle_key_flag = 2; + } + } + } + } + if (x < 512 && s->sectnum == ps[p].cursectnum) + { + s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); + s->xvel = 48; + } + } + + break; + case FORCESPHERE__STATIC: + + if (s->yvel == 0) + { + s->yvel = 1; + + for (l=512;l<(2048-512);l+= 128) + for (j=0;j<2048;j += 128) + { + k = spawn(i,FORCESPHERE); + sprite[k].cstat = 257+128; + sprite[k].clipdist = 64; + sprite[k].ang = j; + sprite[k].zvel = sintable[l&2047]>>5; + sprite[k].xvel = sintable[(l+512)&2047]>>9; + sprite[k].owner = i; + } + } + + if (t[3] > 0) + { + if (s->zvel < 6144) + s->zvel += 192; + s->z += s->zvel; + if (s->z > sector[sect].floorz) + s->z = sector[sect].floorz; + t[3]--; + if (t[3] == 0) + KILLIT(i); + } + else if (t[2] > 10) + { + j = headspritestat[5]; + while (j >= 0) + { + if (sprite[j].owner == i && sprite[j].picnum == FORCESPHERE) + hittype[j].temp_data[1] = 1+(TRAND&63); + j = nextspritestat[j]; + } + t[3] = 64; + } + + goto BOLT; + + case RECON__STATIC: + + getglobalz(i); + + if (sector[s->sectnum].ceilingstat&1) + 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)) + s->z = sector[sect].ceilingz+(32<<8); + + if (ud.multimode < 2) + { + if (actor_tog == 1) + { + s->cstat = (short)32768; + goto BOLT; + } + else if (actor_tog == 2) s->cstat = 257; + } IFHIT { - 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; - } - spritesound(GLASS_BREAKING,i); - KILLIT(i); - } - else if (x < 1024 && ps[p].quick_kick == 0) + if (s->extra < 0 && t[0] != -1) { - j = getincangle(ps[p].ang,getangle(SX-ps[p].posx,SY-ps[p].posy)); - if (j > -128 && j < 128) - ps[p].quick_kick = 14; - } - - goto BOLT; + t[0] = -1; + s->extra = 0; + } + spritesound(RECO_PAIN,i); + RANDOMSCRAP; } - if (x < 1596) - s->cstat = 0; - else s->cstat = 257; - - if (t[0] == -4) //On the player - { - if (sprite[ps[p].i].extra < 1) + if (t[0] == -1) { - t[0] = 0; - goto BOLT; - } - - setsprite(i,s->x,s->y,s->z); - - 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)) + s->z += 1024; + t[2]++; + 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) { - 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; - } - - spritesound(SLIM_DYING,i); - spritesound(SQUISHED,i); - if ((TRAND&255) < 32) - { - j = spawn(i,BLOODPOOL); - sprite[j].pal = 0; - } - ps[p].actors_killed ++; - t[0] = -3; - if (ps[p].somethingonplayer == i) - ps[p].somethingonplayer = -1; + for (l=0;l<16;l++) + RANDOMSCRAP; + spritesound(LASERTRIP_EXPLODE,i); + spawn(i,PIGCOP); + ps[myconnectindex].actors_killed++; KILLIT(i); } - - s->z = ps[p].posz+ps[p].pyoff-t[2]+(8<<8); - - s->z += (100-ps[p].horiz)<<4; - - if (t[2] > 512) - t[2] -= 128; - - if (t[2] < 348) - t[2] += 128; - - if (ps[p].newowner >= 0) - { - ps[p].newowner = -1; - ps[p].posx = ps[p].oposx; - ps[p].posy = ps[p].oposy; - ps[p].posz = ps[p].oposz; - ps[p].ang = ps[p].oang; - - updatesector(ps[p].posx,ps[p].posy,&ps[p].cursectnum); - setpal(&ps[p]); - - j = headspritestat[1]; - while (j >= 0) - { - if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; - j = nextspritestat[j]; - } - } - - if (t[3]>0) - { - short frames[] = {5,5,6,6,7,7,6,5}; - - s->picnum = GREENSLIME+frames[t[3]]; - - if (t[3] == 5) - { - sprite[ps[p].i].extra += -(5+(TRAND&3)); - spritesound(SLIM_ATTACK,i); - } - - if (t[3] < 7) t[3]++; - else t[3] = 0; - + goto BOLT; } else { - s->picnum = GREENSLIME+5; - if (rnd(32)) - t[3] = 1; + if (s->z > hittype[i].floorz-(48<<8)) + s->z = hittype[i].floorz-(48<<8); } - s->xrepeat = 20+(sintable[t[1]&2047]>>13); - s->yrepeat = 15+(sintable[t[1]&2047]>>13); + p = findplayer(s,&x); + j = s->owner; - s->x = ps[p].posx + (sintable[(ps[p].ang+512)&2047]>>7); - s->y = ps[p].posy + (sintable[ps[p].ang&2047]>>7); + // 3 = findplayerz, 4 = shoot + + if (t[0] >= 4) + { + t[2]++; + if ((t[2]&15) == 0) + { + a = s->ang; + s->ang = hittype[i].tempang; + spritesound(RECO_ATTACK,i); + 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)) + { + t[0] = 0; + t[2] = 0; + } + 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) + { + t[3] = 0; + if (s->xvel > 0) s->xvel -= 16; + else s->xvel = 0; + + if (t[0] == 2) + { + l = ps[p].posz-s->z; + 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)) + { + t[0] = 1; + t[2] = 0; + } + else if ((t[2]&15) == 0) + { + spritesound(RECO_ATTACK,i); + shoot(i,FIRELASER); + } + } + s->ang += getincangle(s->ang,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>2; + } + + if (t[0] != 2 && t[0] != 3) + { + l = ldist(&sprite[j],s); + 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 + { + l = dist(&sprite[j],s); + + 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; + } + else + { + if (s->xvel > 0) s->xvel -= 16; + else s->xvel = 0; + } + } + + if (t[0] < 2) t[2]++; + + if (x < 6144 && t[0] < 2 && t[2] > (26*4)) + { + t[0] = 2+(TRAND&2); + t[2] = 0; + hittype[i].tempang = s->ang; + } + } + + if (t[0] == 0 || t[0] == 5) + { + if (t[0] == 0) + t[0] = 1; + else t[0] = 4; + j = s->owner = LocateTheLocator(s->hitag,-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); + } + else s->hitag++; + } + + t[3] = getincangle(s->ang,a); + s->ang += t[3]>>3; + + if (s->z < sprite[j].z) + s->z += 1024; + else s->z -= 1024; + } + + if (!isspritemakingsound(i,RECO_ROAM)) + spritesound(RECO_ROAM,i); + + ssp(i,CLIPMASK0); goto BOLT; - } - else if (s->xvel < 64 && x < 768) - { - if (ps[p].somethingonplayer == -1) + case OOZ__STATIC: + case OOZ2__STATIC: + + getglobalz(i); + + j = (hittype[i].floorz-hittype[i].ceilingz)>>9; + if (j > 255) j = 255; + + x = 25-(j>>1); + if (x < 8) x = 8; + else if (x > 48) x = 48; + + s->yrepeat = j; + s->xrepeat = x; + s->z = hittype[i].floorz; + + goto BOLT; + + case GREENSLIME__STATIC: + // case GREENSLIME+1: + // case GREENSLIME+2: + // case GREENSLIME+3: + // case GREENSLIME+4: + // case GREENSLIME+5: + // case GREENSLIME+6: + // case GREENSLIME+7: + + // #ifndef VOLUMEONE + if (ud.multimode < 2) { - ps[p].somethingonplayer = i; - if (t[0] == 3 || t[0] == 2) //Falling downward - t[2] = (12<<8); - else t[2] = -(13<<8); //Climbing up duke - t[0] = -4; + if (actor_tog == 1) + { + s->cstat = (short)32768; + goto BOLT; + } + else if (actor_tog == 2) s->cstat = 257; } - } + // #endif - IFHIT - { - spritesound(SLIM_DYING,i); + t[1]+=128; - ps[p].actors_killed ++; - if (ps[p].somethingonplayer == i) - ps[p].somethingonplayer = -1; + if (sector[sect].floorstat&1) + KILLIT(i); - if (j == FREEZEBLAST) + p = findplayer(s,&x); + + if (x > 20480) { - spritesound(SOMETHINGFROZE,i); t[0] = -5 ; t[3] = 0 ; + hittype[i].timetosleep++; + if (hittype[i].timetosleep > SLEEPTIME) + { + hittype[i].timetosleep = 0; + changespritestat(i,2); + goto BOLT; + } + } + + if (t[0] == -5) // FROZEN + { + t[3]++; + if (t[3] > 280) + { + s->pal = 0; + t[0] = 0; + goto BOLT; + } + makeitfall(i); + s->cstat = 257; + s->picnum = GREENSLIME+2; + s->extra = 1; + s->pal = 1; + IFHIT + { + 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; + } + spritesound(GLASS_BREAKING,i); + KILLIT(i); + } + 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) + ps[p].quick_kick = 14; + } + + goto BOLT; + } + + if (x < 1596) + s->cstat = 0; + else s->cstat = 257; + + if (t[0] == -4) //On the player + { + if (sprite[ps[p].i].extra < 1) + { + t[0] = 0; goto BOLT; } - if ((TRAND&255) < 32) - { - j = spawn(i,BLOODPOOL); - sprite[j].pal = 0; - } + setsprite(i,s->x,s->y,s->z); - 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; - } - t[0] = -3; - KILLIT(i); - } - // All weap - if (t[0] == -1) //Shrinking down - { - makeitfall(i); + s->ang = ps[p].ang; - s->cstat &= 65535-8; - s->picnum = GREENSLIME+4; + 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++) + { + 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; + } - // if(s->yrepeat > 62) - // guts(s,JIBS6,5,myconnectindex); + spritesound(SLIM_DYING,i); + spritesound(SQUISHED,i); + if ((TRAND&255) < 32) + { + j = spawn(i,BLOODPOOL); + sprite[j].pal = 0; + } + ps[p].actors_killed ++; + t[0] = -3; + if (ps[p].somethingonplayer == i) + ps[p].somethingonplayer = -1; + KILLIT(i); + } - if (s->xrepeat > 32) s->xrepeat -= TRAND&7; - if (s->yrepeat > 16) s->yrepeat -= TRAND&7; - else - { - s->xrepeat = 40; - s->yrepeat = 16; - t[5] = -1; - t[0] = 0; - } + s->z = ps[p].posz+ps[p].pyoff-t[2]+(8<<8); - goto BOLT; - } - else if (t[0] != -2) getglobalz(i); + s->z += (100-ps[p].horiz)<<4; - if (t[0] == -2) //On top of somebody - { - makeitfall(i); - sprite[t[5]].xvel = 0; + if (t[2] > 512) + t[2] -= 128; - l = sprite[t[5]].ang; + if (t[2] < 348) + t[2] += 128; - s->z = sprite[t[5]].z; - s->x = sprite[t[5]].x+(sintable[(l+512)&2047]>>11); - s->y = sprite[t[5]].y+(sintable[l&2047]>>11); + if (ps[p].newowner >= 0) + { + ps[p].newowner = -1; + ps[p].posx = ps[p].oposx; + ps[p].posy = ps[p].oposy; + ps[p].posz = ps[p].oposz; + ps[p].ang = ps[p].oang; - s->picnum = GREENSLIME+2+(global_random&1); + updatesector(ps[p].posx,ps[p].posy,&ps[p].cursectnum); + setpal(&ps[p]); - if (s->yrepeat < 64) s->yrepeat+=2; - else - { - if (s->xrepeat < 32) s->xrepeat += 4; + j = headspritestat[1]; + while (j >= 0) + { + if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; + j = nextspritestat[j]; + } + } + + if (t[3]>0) + { + short frames[] = {5,5,6,6,7,7,6,5}; + + s->picnum = GREENSLIME+frames[t[3]]; + + if (t[3] == 5) + { + sprite[ps[p].i].extra += -(5+(TRAND&3)); + spritesound(SLIM_ATTACK,i); + } + + if (t[3] < 7) t[3]++; + else t[3] = 0; + + } else { - t[0] = -1; - x = ldist(s,&sprite[t[5]]); - if (x < 768) { - sprite[t[5]].xrepeat = 0; + s->picnum = GREENSLIME+5; + if (rnd(32)) + t[3] = 1; + } - // JBF 20041129: a slimer eating another enemy really ought - // to decrease the maximum kill count by one. - if (sprite[t[5]].extra > 0) ps[myconnectindex].max_actors_killed--; - } + s->xrepeat = 20+(sintable[t[1]&2047]>>13); + s->yrepeat = 15+(sintable[t[1]&2047]>>13); + + s->x = ps[p].posx + (sintable[(ps[p].ang+512)&2047]>>7); + s->y = ps[p].posy + (sintable[ps[p].ang&2047]>>7); + + goto BOLT; + } + + else if (s->xvel < 64 && x < 768) + { + if (ps[p].somethingonplayer == -1) + { + ps[p].somethingonplayer = i; + if (t[0] == 3 || t[0] == 2) //Falling downward + t[2] = (12<<8); + else t[2] = -(13<<8); //Climbing up duke + t[0] = -4; } } - goto BOLT; - } - - //Check randomly to see of there is an actor near - if (rnd(32)) - { - j = headspritesect[sect]; - while (j>=0) + IFHIT { - switch (dynamictostatic[sprite[j].picnum]) + spritesound(SLIM_DYING,i); + + ps[p].actors_killed ++; + if (ps[p].somethingonplayer == i) + ps[p].somethingonplayer = -1; + + if (j == FREEZEBLAST) { - 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 + spritesound(SOMETHINGFROZE,i); + t[0] = -5 ; + t[3] = 0 ; + goto BOLT; + } + + if ((TRAND&255) < 32) + { + j = spawn(i,BLOODPOOL); + sprite[j].pal = 0; + } + + 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; + } + t[0] = -3; + KILLIT(i); + } + // All weap + if (t[0] == -1) //Shrinking down + { + makeitfall(i); + + s->cstat &= 65535-8; + s->picnum = GREENSLIME+4; + + // 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; + else + { + s->xrepeat = 40; + s->yrepeat = 16; + t[5] = -1; + t[0] = 0; + } + + goto BOLT; + } + else if (t[0] != -2) getglobalz(i); + + if (t[0] == -2) //On top of somebody + { + makeitfall(i); + sprite[t[5]].xvel = 0; + + l = sprite[t[5]].ang; + + s->z = sprite[t[5]].z; + s->x = sprite[t[5]].x+(sintable[(l+512)&2047]>>11); + s->y = sprite[t[5]].y+(sintable[l&2047]>>11); + + s->picnum = GREENSLIME+2+(global_random&1); + + if (s->yrepeat < 64) s->yrepeat+=2; + else + { + if (s->xrepeat < 32) s->xrepeat += 4; + else { - t[5] = j; - t[0] = -2; - t[1] = 0; + t[0] = -1; + x = ldist(s,&sprite[t[5]]); + if (x < 768) + { + sprite[t[5]].xrepeat = 0; + + // JBF 20041129: a slimer eating another enemy really ought + // to decrease the maximum kill count by one. + if (sprite[t[5]].extra > 0) ps[myconnectindex].max_actors_killed--; + } + } + } + + goto BOLT; + } + + //Check randomly to see of there is an actor near + if (rnd(32)) + { + j = headspritesect[sect]; + while (j>=0) + { + 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 + { + t[5] = j; + t[0] = -2; + t[1] = 0; + goto BOLT; + } + } + + j = nextspritesect[j]; + } + } + + //Moving on the ground or ceiling + + if (t[0] == 0 || t[0] == 2) + { + s->picnum = GREENSLIME; + + if ((TRAND&511) == 0) + spritesound(SLIM_ROAM,i); + + if (t[0]==2) + { + s->zvel = 0; + s->cstat &= (65535-8); + + if ((sector[sect].ceilingstat&1) || (hittype[i].ceilingz+6144) < s->z) + { + s->z += 2048; + t[0] = 3; goto BOLT; } } - - j = nextspritesect[j]; - } - } - - //Moving on the ground or ceiling - - if (t[0] == 0 || t[0] == 2) - { - s->picnum = GREENSLIME; - - if ((TRAND&511) == 0) - spritesound(SLIM_ROAM,i); - - if (t[0]==2) - { - s->zvel = 0; - s->cstat &= (65535-8); - - if ((sector[sect].ceilingstat&1) || (hittype[i].ceilingz+6144) < s->z) + else { - s->z += 2048; - t[0] = 3; + s->cstat |= 8; + makeitfall(i); + } + + if (everyothertime&1) ssp(i,CLIPMASK0); + + if (s->xvel > 96) + { + s->xvel -= 2; goto BOLT; } - } - else - { - s->cstat |= 8; - makeitfall(i); + else + { + if (s->xvel < 32) s->xvel += 4; + s->xvel = 64 - (sintable[(t[1]+512)&2047]>>9); + + s->ang += getincangle(s->ang, + getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>3; + // TJR + } + + 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 && + klabs(hittype[i].floorz-hittype[i].ceilingz) + < (192<<8)) + { + s->zvel = 0; + t[0]++; + } + } - if (everyothertime&1) ssp(i,CLIPMASK0); - - if (s->xvel > 96) + if (t[0]==1) { - s->xvel -= 2; - goto BOLT; - } - else - { - if (s->xvel < 32) s->xvel += 4; - s->xvel = 64 - (sintable[(t[1]+512)&2047]>>9); - - s->ang += getincangle(s->ang, - getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>3; - // TJR - } - - 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 && - klabs(hittype[i].floorz-hittype[i].ceilingz) - < (192<<8)) - { - s->zvel = 0; - t[0]++; - } - - } - - 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)) - s->zvel -= 348; - s->z += s->zvel; - if (s->z < hittype[i].ceilingz+4096) - { - s->z = hittype[i].ceilingz+4096; - s->xvel = 0; - t[0] = 2; - } - } - - if (t[0]==3) - { - s->picnum = GREENSLIME+1; - - makeitfall(i); - - if (s->z > hittype[i].floorz-(8<<8)) - { - s->yrepeat-=4; - s->xrepeat+=2; - } - else - { - if (s->yrepeat < (40-4)) s->yrepeat+=8; + s->picnum = GREENSLIME; + 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) + { + s->z = hittype[i].ceilingz+4096; + s->xvel = 0; + t[0] = 2; + } } - if (s->z > hittype[i].floorz-2048) + if (t[0]==3) { - s->z = hittype[i].floorz-2048; - t[0] = 0; - s->xvel = 0; - } - } - goto BOLT; + s->picnum = GREENSLIME+1; - case BOUNCEMINE__STATIC: - case MORTER__STATIC: - j = spawn(i,(PLUTOPAK?FRAMEEFFECT1:FRAMEEFFECT1_13)); - hittype[j].temp_data[0] = 3; + makeitfall(i); - case HEAVYHBOMB__STATIC: + 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->cstat&32768)) - { - t[2]--; - if (t[2] <= 0) - { - spritesound(TELEPORTER,i); - spawn(i,TRANSPORTERSTAR); - s->cstat = 257; + if (s->z > hittype[i].floorz-2048) + { + s->z = hittype[i].floorz-2048; + t[0] = 0; + s->xvel = 0; + } } goto BOLT; - } - p = findplayer(s,&x); + case BOUNCEMINE__STATIC: + case MORTER__STATIC: + j = spawn(i,(PLUTOPAK?FRAMEEFFECT1:FRAMEEFFECT1_13)); + hittype[j].temp_data[0] = 3; - if (x < 1220) s->cstat &= ~257; - else s->cstat |= 257; + case HEAVYHBOMB__STATIC: - if (t[3] == 0) - { - j = ifhitbyweapon(i); - if (j >= 0) + if ((s->cstat&32768)) + { + t[2]--; + if (t[2] <= 0) + { + spritesound(TELEPORTER,i); + spawn(i,TRANSPORTERSTAR); + s->cstat = 257; + } + goto BOLT; + } + + p = findplayer(s,&x); + + if (x < 1220) s->cstat &= ~257; + else s->cstat |= 257; + + if (t[3] == 0) + { + j = ifhitbyweapon(i); + if (j >= 0) + { + t[3] = 1; + t[4] = 0; + l = 0; + s->xvel = 0; + goto DETONATEB; + } + } + + if (s->picnum != BOUNCEMINE) + { + makeitfall(i); + + 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)) + spritesound(PIPEBOMB_BOUNCE,i); + s->zvel = -((4-s->yvel)<<8); + if (sector[s->sectnum].lotag== 2) + s->zvel >>= 2; + s->yvel++; + } + if (s->z < hittype[i].ceilingz) // && sector[sect].lotag != 2 ) + { + s->z = hittype[i].ceilingz+(3<<8); + s->zvel = 0; + } + } + + j = movesprite(i, + (s->xvel*(sintable[(s->ang+512)&2047]))>>14, + (s->xvel*(sintable[s->ang&2047]))>>14, + s->zvel,CLIPMASK0); + + if (sector[SECT].lotag == 1 && s->zvel == 0) + { + s->z += (32<<8); + if (t[5] == 0) + { + t[5] = 1; + spawn(i,WATERSPLASH2); + } + } + else t[5] = 0; + + if (t[3] == 0 && (s->picnum == BOUNCEMINE || s->picnum == MORTER) && (j || x < 844)) { t[3] = 1; t[4] = 0; @@ -4378,203 +4477,111 @@ void moveactors(void) s->xvel = 0; goto DETONATEB; } - } - if (s->picnum != BOUNCEMINE) - { - makeitfall(i); + if (sprite[s->owner].picnum == APLAYER) + l = sprite[s->owner].yvel; + else l = -1; - if (sector[sect].lotag != 1 && s->z >= hittype[i].floorz-(FOURSLEIGHT) && s->yvel < 3) + if (s->xvel > 0) { - 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) - s->zvel >>= 2; - s->yvel++; + s->xvel -= 5; + if (sector[sect].lotag == 2) + s->xvel -= 10; + + if (s->xvel < 0) + s->xvel = 0; + if (s->xvel&8) s->cstat ^= 4; } - if (s->z < hittype[i].ceilingz) // && sector[sect].lotag != 2 ) + + if ((j&49152) == 32768) { - s->z = hittype[i].ceilingz+(3<<8); - s->zvel = 0; + j &= (MAXWALLS-1); + + checkhitwall(i,j,s->x,s->y,s->z,s->picnum); + + k = getangle( + wall[wall[j].point2].x-wall[j].x, + wall[wall[j].point2].y-wall[j].y); + + s->ang = ((k<<1) - s->ang)&2047; + s->xvel >>= 1; } - } - j = movesprite(i, - (s->xvel*(sintable[(s->ang+512)&2047]))>>14, - (s->xvel*(sintable[s->ang&2047]))>>14, - s->zvel,CLIPMASK0); - - if (sector[SECT].lotag == 1 && s->zvel == 0) - { - s->z += (32<<8); - if (t[5] == 0) - { - t[5] = 1; - spawn(i,WATERSPLASH2); - } - } - else t[5] = 0; - - if (t[3] == 0 && (s->picnum == BOUNCEMINE || s->picnum == MORTER) && (j || x < 844)) - { - t[3] = 1; - t[4] = 0; - l = 0; - s->xvel = 0; - goto DETONATEB; - } - - if (sprite[s->owner].picnum == APLAYER) - l = sprite[s->owner].yvel; - else l = -1; - - if (s->xvel > 0) - { - s->xvel -= 5; - if (sector[sect].lotag == 2) - s->xvel -= 10; - - if (s->xvel < 0) - s->xvel = 0; - if (s->xvel&8) s->cstat ^= 4; - } - - if ((j&49152) == 32768) - { - j &= (MAXWALLS-1); - - checkhitwall(i,j,s->x,s->y,s->z,s->picnum); - - k = getangle( - wall[wall[j].point2].x-wall[j].x, - wall[wall[j].point2].y-wall[j].y); - - s->ang = ((k<<1) - s->ang)&2047; - s->xvel >>= 1; - } - - // long lPipeBombControl=GetGameVar("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, -1); + // long lPipeBombControl=GetGameVar("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, -1); DETONATEB: - // if(lPipeBombControl & PIPEBOMB_TIMER) - // { + // if(lPipeBombControl & PIPEBOMB_TIMER) + // { - if (s->picnum == HEAVYHBOMB && hittype[i].temp_data[6] == 1) - { - /* if(s->extra >= 1) - { - s->extra--; - } - - if(s->extra <= 0) - s->lotag=911; - */ - - if (hittype[i].temp_data[7] >= 1) + if (s->picnum == HEAVYHBOMB && hittype[i].temp_data[6] == 1) { - hittype[i].temp_data[7]--; + /* if(s->extra >= 1) + { + s->extra--; + } + + if(s->extra <= 0) + s->lotag=911; + */ + + if (hittype[i].temp_data[7] >= 1) + { + hittype[i].temp_data[7]--; + } + + if (hittype[i].temp_data[7] <= 0) + { + hittype[i].temp_data[6] = 3; + // s->extra = *actorscrptr[s->picnum]; + } } + // } - if (hittype[i].temp_data[7] <= 0) - { + if ((l >= 0 && ps[l].hbomb_on == 0 && hittype[i].temp_data[6] == 2) || t[3] == 1) hittype[i].temp_data[6] = 3; - // s->extra = *actorscrptr[s->picnum]; - } - } - // } - 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) { - x = s->extra; - m = 0; - switch (dynamictostatic[s->picnum]) + t[4]++; + + if (t[4] == 2) { - case HEAVYHBOMB__STATIC: - m = pipebombblastradius;break; - case MORTER__STATIC: - m = morterblastradius;break; - case BOUNCEMINE__STATIC: - m = bouncemineblastradius;break; + x = s->extra; + m = 0; + switch (dynamictostatic[s->picnum]) + { + 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) + spawn(i,EXPLOSION2BOT); + spritesound(PIPEBOMB_EXPLODE,i); + for (x=0;x<8;x++) + RANDOMSCRAP; } - hitradius(i, m,x>>2,x>>1,x-(x>>2),x); - spawn(i,EXPLOSION2); - if (s->zvel == 0) - spawn(i,EXPLOSION2BOT); - spritesound(PIPEBOMB_EXPLODE,i); - for (x=0;x<8;x++) - RANDOMSCRAP; - } - - if (s->yrepeat) - { - s->yrepeat = 0; - goto BOLT; - } - - if (t[4] > 20) - { - if (s->owner != i || ud.respawn_items == 0) + if (s->yrepeat) { - KILLIT(i); - } - else - { - t[2] = respawnitemtime; - spawn(i,RESPAWNMARKERRED); - s->cstat = (short) 32768; - s->yrepeat = 9; + s->yrepeat = 0; goto BOLT; } - } - } - 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 (t[4] > 20) { - if ((gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY) && s->owner == i) - { - for (j=0;jpicnum) - goto BOLT; - - 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) - { - /* addweapon(&ps[p],HANDBOMB_WEAPON); */ - if (!(ps[p].weaponswitch & 1) && *aplWeaponWorksLike[ps[p].curr_weapon] != HANDREMOTE_WEAPON) - addweaponnoswitch(&ps[p],HANDBOMB_WEAPON); - else addweapon(&ps[p],HANDBOMB_WEAPON); - } - - if (sprite[s->owner].picnum != APLAYER) - { - ps[p].pals[0] = 0; - ps[p].pals[1] = 32; - ps[p].pals[2] = 0; - ps[p].pals_time = 32; - } - if (s->owner != i || ud.respawn_items == 0) { - if (s->owner == i && (gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY)) - goto BOLT; KILLIT(i); } else @@ -4582,193 +4589,242 @@ DETONATEB: t[2] = respawnitemtime; spawn(i,RESPAWNMARKERRED); s->cstat = (short) 32768; + s->yrepeat = 9; + goto BOLT; } } - - if (t[0] < 8) t[0]++; - goto BOLT; - - case REACTORBURNT__STATIC: - case REACTOR2BURNT__STATIC: - goto BOLT; - - case REACTOR__STATIC: - case REACTOR2__STATIC: - - if (t[4] == 1) - { - j = headspritesect[sect]; - while (j >= 0) - { - switch (dynamictostatic[sprite[j].picnum]) - { - case SECTOREFFECTOR__STATIC: - if (sprite[j].lotag == 1) + } + 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]) { - sprite[j].lotag = (short) 65535; - sprite[j].hitag = (short) 65535; + if ((gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY) && s->owner == i) + { + for (j=0;jpicnum) + goto BOLT; + + 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) + { + /* addweapon(&ps[p],HANDBOMB_WEAPON); */ + if (!(ps[p].weaponswitch & 1) && *aplWeaponWorksLike[ps[p].curr_weapon] != HANDREMOTE_WEAPON) + addweaponnoswitch(&ps[p],HANDBOMB_WEAPON); + else addweapon(&ps[p],HANDBOMB_WEAPON); + } + + if (sprite[s->owner].picnum != APLAYER) + { + ps[p].pals[0] = 0; + ps[p].pals[1] = 32; + ps[p].pals[2] = 0; + ps[p].pals_time = 32; + } + + if (s->owner != i || ud.respawn_items == 0) + { + if (s->owner == i && (gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY)) + goto BOLT; + KILLIT(i); + } + else + { + t[2] = respawnitemtime; + spawn(i,RESPAWNMARKERRED); + s->cstat = (short) 32768; + } } - break; - case REACTOR__STATIC: - sprite[j].picnum = REACTORBURNT; - break; - case REACTOR2__STATIC: - sprite[j].picnum = REACTOR2BURNT; - break; - case REACTORSPARK__STATIC: - case REACTOR2SPARK__STATIC: - sprite[j].cstat = (short) 32768; - break; - } - j = nextspritesect[j]; - } + + if (t[0] < 8) t[0]++; goto BOLT; - } - if (t[1] >= 20) - { - t[4] = 1; + case REACTORBURNT__STATIC: + case REACTOR2BURNT__STATIC: goto BOLT; - } - p = findplayer(s,&x); + case REACTOR__STATIC: + case REACTOR2__STATIC: - t[2]++; - if (t[2] == 4) t[2]=0; - - if (x < 4096) - { - if ((TRAND&255) < 16) + if (t[4] == 1) { - if (!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) - spritesound(DUKE_LONGTERM_PAIN,ps[p].i); - - spritesound(SHORT_CIRCUIT,i); - - sprite[ps[p].i].extra --; - ps[p].pals_time = 32; - ps[p].pals[0] = 32; - ps[p].pals[1] = 0; - ps[p].pals[2] = 0; - } - t[0] += 128; - if (t[3] == 0) - t[3] = 1; - } - else t[3] = 0; - - if (t[1]) - { - t[1]++; - - t[4] = s->z; - s->z = sector[sect].floorz-(TRAND%(sector[sect].floorz-sector[sect].ceilingz)); - - switch (t[1]) - { - case 3: - //Turn on all of those flashing sectoreffector. - hitradius(i, 4096, - impact_damage<<2, - impact_damage<<2, - impact_damage<<2, - impact_damage<<2); - /* - j = headspritestat[3]; - while(j>=0) - { - if( sprite[j].lotag == 3 ) - hittype[j].temp_data[4]=1; - else if(sprite[j].lotag == 12) - { - hittype[j].temp_data[4] = 1; - sprite[j].lotag = 3; - sprite[j].owner = 0; - hittype[j].temp_data[0] = s->shade; - } - j = nextspritestat[j]; - } - */ - j = headspritestat[6]; - while (j >= 0) - { - if (sprite[j].picnum == MASTERSWITCH) - if (sprite[j].hitag == s->hitag) - if (sprite[j].yvel == 0) - sprite[j].yvel = 1; - j = nextspritestat[j]; - } - break; - - case 4: - case 7: - case 10: - case 15: j = headspritesect[sect]; while (j >= 0) { - l = nextspritesect[j]; - - if (j != i) + switch (dynamictostatic[sprite[j].picnum]) { - deletesprite(j); - break; + case SECTOREFFECTOR__STATIC: + if (sprite[j].lotag == 1) + { + sprite[j].lotag = (short) 65535; + sprite[j].hitag = (short) 65535; + } + break; + case REACTOR__STATIC: + sprite[j].picnum = REACTORBURNT; + break; + case REACTOR2__STATIC: + sprite[j].picnum = REACTOR2BURNT; + break; + case REACTORSPARK__STATIC: + case REACTOR2SPARK__STATIC: + sprite[j].cstat = (short) 32768; + break; } - j = l; + j = nextspritesect[j]; } - break; + goto BOLT; } - for (x=0;x<16;x++) - RANDOMSCRAP; - s->z = t[4]; - t[4] = 0; - - } - else - { - IFHIT + if (t[1] >= 20) { - for (x=0;x<32;x++) - RANDOMSCRAP; - if (s->extra < 0) - t[1] = 1; - } + t[4] = 1; + goto BOLT; } - goto BOLT; - case CAMERA1__STATIC: + p = findplayer(s,&x); - if (t[0] == 0) - { - t[1]+=8; - if (camerashitable) + t[2]++; + if (t[2] == 4) t[2]=0; + + if (x < 4096) + { + if ((TRAND&255) < 16) + { + if (!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) + spritesound(DUKE_LONGTERM_PAIN,ps[p].i); + + spritesound(SHORT_CIRCUIT,i); + + sprite[ps[p].i].extra --; + ps[p].pals_time = 32; + ps[p].pals[0] = 32; + ps[p].pals[1] = 0; + ps[p].pals[2] = 0; + } + t[0] += 128; + if (t[3] == 0) + t[3] = 1; + } + else t[3] = 0; + + if (t[1]) + { + t[1]++; + + t[4] = s->z; + s->z = sector[sect].floorz-(TRAND%(sector[sect].floorz-sector[sect].ceilingz)); + + switch (t[1]) + { + case 3: + //Turn on all of those flashing sectoreffector. + hitradius(i, 4096, + impact_damage<<2, + impact_damage<<2, + impact_damage<<2, + impact_damage<<2); + /* + j = headspritestat[3]; + while(j>=0) + { + if( sprite[j].lotag == 3 ) + hittype[j].temp_data[4]=1; + else if(sprite[j].lotag == 12) + { + hittype[j].temp_data[4] = 1; + sprite[j].lotag = 3; + sprite[j].owner = 0; + hittype[j].temp_data[0] = s->shade; + } + j = nextspritestat[j]; + } + */ + j = headspritestat[6]; + while (j >= 0) + { + if (sprite[j].picnum == MASTERSWITCH) + if (sprite[j].hitag == s->hitag) + if (sprite[j].yvel == 0) + sprite[j].yvel = 1; + j = nextspritestat[j]; + } + break; + + case 4: + case 7: + case 10: + case 15: + j = headspritesect[sect]; + while (j >= 0) + { + l = nextspritesect[j]; + + if (j != i) + { + deletesprite(j); + break; + } + j = l; + } + break; + } + for (x=0;x<16;x++) + RANDOMSCRAP; + + s->z = t[4]; + t[4] = 0; + + } + else { IFHIT { - t[0] = 1; // static - s->cstat = (short)32768; - for (x=0;x<5;x++) RANDOMSCRAP; - goto BOLT; + for (x=0;x<32;x++) + RANDOMSCRAP; + if (s->extra < 0) + t[1] = 1; + } } - } - - if (s->hitag > 0) - { - if (t[1]hitag) - s->ang+=8; - else if (t[1]<(s->hitag*3)) - s->ang-=8; - else if (t[1] < (s->hitag<<2)) - s->ang+=8; - else - { - t[1]=8; - s->ang+=16; - } - } - } goto BOLT; + + case CAMERA1__STATIC: + + if (t[0] == 0) + { + t[1]+=8; + if (camerashitable) + { + IFHIT + { + t[0] = 1; // static + s->cstat = (short)32768; + for (x=0;x<5;x++) RANDOMSCRAP; + goto BOLT; + } + } + + if (s->hitag > 0) + { + if (t[1]hitag) + s->ang+=8; + else if (t[1]<(s->hitag*3)) + s->ang-=8; + else if (t[1] < (s->hitag<<2)) + s->ang+=8; + else + { + t[1]=8; + s->ang+=16; + } + } + } + goto BOLT; } @@ -4817,469 +4873,490 @@ void moveexplosions(void) // STATNUM 5 hittype[i].bposy = s->y; hittype[i].bposz = s->z; switchpicnum = s->picnum; - if ((s->picnum > NUKEBUTTON)&&(s->picnum <= NUKEBUTTON+3)) { + if ((s->picnum > NUKEBUTTON)&&(s->picnum <= NUKEBUTTON+3)) + { switchpicnum = NUKEBUTTON; } - if ((s->picnum > GLASSPIECES)&&(s->picnum <= GLASSPIECES+2)) { + if ((s->picnum > GLASSPIECES)&&(s->picnum <= GLASSPIECES+2)) + { switchpicnum = GLASSPIECES; } - if (s->picnum ==INNERJAW+1) { + if (s->picnum ==INNERJAW+1) + { switchpicnum--; } 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]) { - case NEON1__STATIC: - case NEON2__STATIC: - case NEON3__STATIC: - case NEON4__STATIC: - case NEON5__STATIC: - case NEON6__STATIC: + case NEON1__STATIC: + case NEON2__STATIC: + case NEON3__STATIC: + case NEON4__STATIC: + case NEON5__STATIC: + case NEON6__STATIC: - if ((global_random/(s->lotag+1)&31) > 4) s->shade = -127; - else s->shade = 127; - goto BOLT; + if ((global_random/(s->lotag+1)&31) > 4) s->shade = -127; + else s->shade = 127; + goto BOLT; - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: + case BLOODSPLAT1__STATIC: + case BLOODSPLAT2__STATIC: + case BLOODSPLAT3__STATIC: + case BLOODSPLAT4__STATIC: - if (t[0] == 7*26) goto BOLT; - s->z += 16+(TRAND&15); - t[0]++; - if ((t[0]%9) == 0) s->yrepeat++; - goto BOLT; - - case NUKEBUTTON__STATIC: - // case NUKEBUTTON+1: - // case NUKEBUTTON+2: - // case NUKEBUTTON+3: - - if (t[0]) - { + if (t[0] == 7*26) goto BOLT; + s->z += 16+(TRAND&15); t[0]++; - 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) - s->picnum = NUKEBUTTON+3; - } - goto BOLT; + if ((t[0]%9) == 0) s->yrepeat++; + goto BOLT; - case FORCESPHERE__STATIC: + case NUKEBUTTON__STATIC: + // case NUKEBUTTON+1: + // case NUKEBUTTON+2: + // case NUKEBUTTON+3: - l = s->xrepeat; - if (t[1] > 0) - { - t[1]--; - if (t[1] == 0) - { - KILLIT(i); - } - } - if (hittype[s->owner].temp_data[1] == 0) - { - if (t[0] < 64) + if (t[0]) { t[0]++; - l += 3; + 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) + s->picnum = NUKEBUTTON+3; } - } - else - if (t[0] > 64) + goto BOLT; + + case FORCESPHERE__STATIC: + + l = s->xrepeat; + if (t[1] > 0) { - t[0]--; - l -= 3; + t[1]--; + if (t[1] == 0) + { + KILLIT(i); + } } - - s->x = sprite[s->owner].x; - s->y = sprite[s->owner].y; - 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; - - s->xrepeat = l; - s->yrepeat = l; - s->shade = (l>>1)-48; - - for (j=t[0];j > 0;j--) - ssp(i,CLIPMASK0); - goto BOLT; - case WATERSPLASH2__STATIC: - - t[0]++; - if (t[0] == 1) - { - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) - KILLIT(i); - /* else - { - l = getflorzofslope(sect,s->x,s->y)-s->z; - if( l > (16<<8) ) KILLIT(i); - } - else */ if (!issoundplaying(i,ITEM_SPLASH)) - spritesound(ITEM_SPLASH,i); - } - if (t[0] == 3) - { - t[0] = 0; - t[1]++; - } - 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) - { - t[0]++; - - if (t[0] > 7) + if (hittype[s->owner].temp_data[1] == 0) { - KILLIT(i); - } - else if (t[0] > 4) - s->cstat |= 512+2; - else if (t[0] > 2) - s->cstat |= 2; - s->xoffset = sprite[s->owner].xoffset; - s->yoffset = sprite[s->owner].yoffset; - } - goto BOLT; - case INNERJAW__STATIC: - // case INNERJAW+1: - - p = findplayer(s,&x); - if (x < 512) - { - ps[p].pals_time = 32; - ps[p].pals[0] = 32; - ps[p].pals[1] = 0; - ps[p].pals[2] = 0; - sprite[ps[p].i].extra -= 4; - } - - case FIRELASER__STATIC: - if (s->extra != 999) - s->extra = 999; - else KILLIT(i); - break; - case TONGUE__STATIC: - KILLIT(i); - - case MONEY__STATIC: - case MAIL__STATIC: - case PAPER__STATIC: - - s->xvel = (TRAND&7)+(sintable[T1&2047]>>9); - T1 += (TRAND&63); - if ((T1&2047) > 512 && (T1&2047) < 1596) - { - if (sector[sect].lotag == 2) - { - if (s->zvel < 64) - s->zvel += (gc>>5)+(TRAND&7); + if (t[0] < 64) + { + t[0]++; + l += 3; + } } else - if (s->zvel < 144) - s->zvel += (gc>>5)+(TRAND&7); - } + if (t[0] > 64) + { + t[0]--; + l -= 3; + } - ssp(i,CLIPMASK0); + s->x = sprite[s->owner].x; + s->y = sprite[s->owner].y; + s->z = sprite[s->owner].z; + s->ang += hittype[s->owner].temp_data[0]; - if ((TRAND&3) == 0) - setsprite(i,s->x,s->y,s->z); + if (l > 64) l = 64; + else if (l < 1) l = 1; - if (s->sectnum == -1) KILLIT(i); - l = getflorzofslope(s->sectnum,s->x,s->y); + s->xrepeat = l; + s->yrepeat = l; + s->shade = (l>>1)-48; - if (s->z > l) - { - s->z = l; + for (j=t[0];j > 0;j--) + ssp(i,CLIPMASK0); + goto BOLT; + case WATERSPLASH2__STATIC: - insertspriteq(i); - PN ++; - - j = headspritestat[5]; - while (j >= 0) + t[0]++; + if (t[0] == 1) { - if (sprite[j].picnum == BLOODPOOL) - if (ldist(s,&sprite[j]) < 348) - { - s->pal = 2; - break; - } - j = nextspritestat[j]; + if (sector[sect].lotag != 1 && sector[sect].lotag != 2) + KILLIT(i); + /* else + { + l = getflorzofslope(sect,s->x,s->y)-s->z; + if( l > (16<<8) ) KILLIT(i); + } + else */ + if (!issoundplaying(i,ITEM_SPLASH)) + spritesound(ITEM_SPLASH,i); } - } - - break; - - case JIBS1__STATIC: - case JIBS2__STATIC: - case JIBS3__STATIC: - case JIBS4__STATIC: - case JIBS5__STATIC: - case JIBS6__STATIC: - case HEADJIB1__STATIC: - case ARMJIB1__STATIC: - case LEGJIB1__STATIC: - case LIZMANHEAD1__STATIC: - case LIZMANARM1__STATIC: - case LIZMANLEG1__STATIC: - case DUKETORSO__STATIC: - case DUKEGUN__STATIC: - case DUKELEG__STATIC: - - if (s->xvel > 0) s->xvel--; - else s->xvel = 0; - - if (t[5] < 30*10) - t[5]++; - else { KILLIT(i); } - - - if (s->zvel > 1024 && s->zvel < 1280) - { - setsprite(i,s->x,s->y,s->z); - sect = s->sectnum; - } - - l = getflorzofslope(sect,s->x,s->y); - x = getceilzofslope(sect,s->x,s->y); - if (x == l || sect < 0 || sect >= MAXSECTORS) KILLIT(i); - - if (s->z < l-(2<<8)) - { - if (t[1] < 2) t[1]++; - else if (sector[sect].lotag != 2) + if (t[0] == 3) { - t[1] = 0; - if (s->picnum == DUKELEG || s->picnum == DUKETORSO || s->picnum == DUKEGUN) + t[0] = 0; + t[1]++; + } + 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) + { + t[0]++; + + if (t[0] > 7) { - if (t[0] > 6) t[0] = 0; - else t[0]++; - } - else - { - if (t[0] > 2) - t[0] = 0; - else t[0]++; + KILLIT(i); } + else if (t[0] > 4) + s->cstat |= 512+2; + else if (t[0] > 2) + s->cstat |= 2; + s->xoffset = sprite[s->owner].xoffset; + s->yoffset = sprite[s->owner].yoffset; + } + goto BOLT; + case INNERJAW__STATIC: + // case INNERJAW+1: + + p = findplayer(s,&x); + if (x < 512) + { + ps[p].pals_time = 32; + ps[p].pals[0] = 32; + ps[p].pals[1] = 0; + ps[p].pals[2] = 0; + sprite[ps[p].i].extra -= 4; } - if (s->zvel < 6144) + case FIRELASER__STATIC: + if (s->extra != 999) + s->extra = 999; + else KILLIT(i); + break; + case TONGUE__STATIC: + KILLIT(i); + + case MONEY__STATIC: + case MAIL__STATIC: + case PAPER__STATIC: + + s->xvel = (TRAND&7)+(sintable[T1&2047]>>9); + T1 += (TRAND&63); + if ((T1&2047) > 512 && (T1&2047) < 1596) { if (sector[sect].lotag == 2) { - if (s->zvel < 1024) - s->zvel += 48; - else s->zvel = 1024; + if (s->zvel < 64) + s->zvel += (gc>>5)+(TRAND&7); } - else s->zvel += gc-50; + else + if (s->zvel < 144) + s->zvel += (gc>>5)+(TRAND&7); } - s->x += (s->xvel*sintable[(s->ang+512)&2047])>>14; - s->y += (s->xvel*sintable[s->ang&2047])>>14; - s->z += s->zvel; + ssp(i,CLIPMASK0); - } - else - { - if (t[2] == 0) - { - if (s->sectnum == -1) { KILLIT(i); } - if ((sector[s->sectnum].floorstat&2)) { KILLIT(i); } - t[2]++; - } + if ((TRAND&3) == 0) + setsprite(i,s->x,s->y,s->z); + + if (s->sectnum == -1) KILLIT(i); l = getflorzofslope(s->sectnum,s->x,s->y); - s->z = l-(2<<8); - s->xvel = 0; - - if (s->picnum == JIBS6) + if (s->z > l) { - t[1]++; - if ((t[1]&3) == 0 && t[0] < 7) - t[0]++; - if (t[1] > 20) KILLIT(i); - } - else { s->picnum = JIBS6; t[0] = 0; t[1] = 0; } + s->z = l; - } - goto BOLT; + insertspriteq(i); + PN ++; - case BLOODPOOL__STATIC: - case PUKE__STATIC: - - if (t[0] == 0) - { - t[0] = 1; - if (sector[sect].floorstat&2) { KILLIT(i); } - else insertspriteq(i); - } - - makeitfall(i); - - p = findplayer(s,&x); - - s->z = hittype[i].floorz-(FOURSLEIGHT); - - if (t[2] < 32) - { - t[2]++; - if (hittype[i].picnum == TIRE) - { - if (s->xrepeat < 64 && s->yrepeat < 64) + j = headspritestat[5]; + while (j >= 0) { - s->xrepeat += TRAND&3; - s->yrepeat += TRAND&3; + if (sprite[j].picnum == BLOODPOOL) + if (ldist(s,&sprite[j]) < 348) + { + s->pal = 2; + break; + } + j = nextspritestat[j]; } } + + break; + + case JIBS1__STATIC: + case JIBS2__STATIC: + case JIBS3__STATIC: + case JIBS4__STATIC: + case JIBS5__STATIC: + case JIBS6__STATIC: + case HEADJIB1__STATIC: + case ARMJIB1__STATIC: + case LEGJIB1__STATIC: + case LIZMANHEAD1__STATIC: + case LIZMANARM1__STATIC: + case LIZMANLEG1__STATIC: + case DUKETORSO__STATIC: + case DUKEGUN__STATIC: + case DUKELEG__STATIC: + + if (s->xvel > 0) s->xvel--; + else s->xvel = 0; + + if (t[5] < 30*10) + t[5]++; + else + { + KILLIT(i); + } + + + if (s->zvel > 1024 && s->zvel < 1280) + { + setsprite(i,s->x,s->y,s->z); + sect = s->sectnum; + } + + l = getflorzofslope(sect,s->x,s->y); + x = getceilzofslope(sect,s->x,s->y); + if (x == l || sect < 0 || sect >= MAXSECTORS) KILLIT(i); + + if (s->z < l-(2<<8)) + { + 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 (t[0] > 6) t[0] = 0; + else t[0]++; + } + else + { + if (t[0] > 2) + t[0] = 0; + else t[0]++; + } + } + + if (s->zvel < 6144) + { + if (sector[sect].lotag == 2) + { + if (s->zvel < 1024) + s->zvel += 48; + else s->zvel = 1024; + } + else 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->xrepeat < 32 && s->yrepeat < 32) + if (t[2] == 0) { - s->xrepeat += TRAND&3; - s->yrepeat += TRAND&3; + if (s->sectnum == -1) + { + KILLIT(i); + } + if ((sector[s->sectnum].floorstat&2)) + { + KILLIT(i); + } + t[2]++; } - } - } + l = getflorzofslope(s->sectnum,s->x,s->y); - if (x < 844 && s->xrepeat > 6 && s->yrepeat > 6) - { - if (s->pal == 0 && (TRAND&255) < 16 && s->picnum != PUKE) - { - if (ps[p].boot_amount > 0) - ps[p].boot_amount--; + s->z = l-(2<<8); + s->xvel = 0; + + if (s->picnum == JIBS6) + { + t[1]++; + if ((t[1]&3) == 0 && t[0] < 7) + t[0]++; + if (t[1] > 20) KILLIT(i); + } else { - 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; - ps[p].pals[0] = 16; - ps[p].pals[1] = 0; - ps[p].pals[2] = 0; + s->picnum = JIBS6; + t[0] = 0; + t[1] = 0; + } + + } + goto BOLT; + + case BLOODPOOL__STATIC: + case PUKE__STATIC: + + if (t[0] == 0) + { + t[0] = 1; + if (sector[sect].floorstat&2) + { + KILLIT(i); + } + else insertspriteq(i); + } + + makeitfall(i); + + p = findplayer(s,&x); + + s->z = hittype[i].floorz-(FOURSLEIGHT); + + if (t[2] < 32) + { + t[2]++; + if (hittype[i].picnum == TIRE) + { + if (s->xrepeat < 64 && s->yrepeat < 64) + { + s->xrepeat += TRAND&3; + s->yrepeat += TRAND&3; + } + } + else + { + if (s->xrepeat < 32 && s->yrepeat < 32) + { + s->xrepeat += TRAND&3; + s->yrepeat += TRAND&3; + } } } - if (t[1] == 1) goto BOLT; - t[1] = 1; - - 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 (x < 844 && s->xrepeat > 6 && s->yrepeat > 6) { - s->xrepeat -= 6; - s->yrepeat -= 6; + if (s->pal == 0 && (TRAND&255) < 16 && s->picnum != PUKE) + { + if (ps[p].boot_amount > 0) + ps[p].boot_amount--; + else + { + 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; + ps[p].pals[0] = 16; + ps[p].pals[1] = 0; + ps[p].pals[2] = 0; + } + } + + if (t[1] == 1) goto BOLT; + t[1] = 1; + + 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) + { + s->xrepeat -= 6; + s->yrepeat -= 6; + } } - } - else t[1] = 0; - goto BOLT; + else t[1] = 0; + goto BOLT; - case BURNING__STATIC: - case BURNING2__STATIC: - case FECES__STATIC: - case WATERBUBBLE__STATIC: - case SMALLSMOKE__STATIC: - case EXPLOSION2__STATIC: - case SHRINKEREXPLOSION__STATIC: - case EXPLOSION2BOT__STATIC: - case BLOOD__STATIC: - case LASERSITE__STATIC: - case FORCERIPPLE__STATIC: - case TRANSPORTERSTAR__STATIC: - case TRANSPORTERBEAM__STATIC: - p = findplayer(s,&x); - execute(i,p,x); - goto BOLT; + case BURNING__STATIC: + case BURNING2__STATIC: + case FECES__STATIC: + case WATERBUBBLE__STATIC: + case SMALLSMOKE__STATIC: + case EXPLOSION2__STATIC: + case SHRINKEREXPLOSION__STATIC: + case EXPLOSION2BOT__STATIC: + case BLOOD__STATIC: + case LASERSITE__STATIC: + case FORCERIPPLE__STATIC: + case TRANSPORTERSTAR__STATIC: + case TRANSPORTERBEAM__STATIC: + p = findplayer(s,&x); + execute(i,p,x); + goto BOLT; - case SHELL__STATIC: - case SHOTGUNSHELL__STATIC: + case SHELL__STATIC: + case SHOTGUNSHELL__STATIC: - ssp(i,CLIPMASK0); + 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) - { - t[1]++; - if (t[1] > 8) - { - t[1] = 0; - t[0]++; - t[0] &= 3; - } - if (s->zvel < 128) s->zvel += (gc/13); // 8 - else s->zvel -= 64; - if (s->xvel > 0) - s->xvel -= 4; - else s->xvel = 0; - } - else - { - t[1]++; - 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) - s->xvel --; - // else KILLIT(i); - } - - goto BOLT; - - case GLASSPIECES__STATIC: - // case GLASSPIECES+1: - // case GLASSPIECES+2: - - makeitfall(i); - - if (s->zvel > 4096) s->zvel = 4096; - if (sect < 0) KILLIT(i); - - if (s->z == hittype[i].floorz-(FOURSLEIGHT) && t[0] < 3) - { - s->zvel = -((3-t[0])<<8)-(TRAND&511); if (sector[sect].lotag == 2) - s->zvel >>= 1; - s->xrepeat >>= 1; - s->yrepeat >>= 1; - if (rnd(96)) - setsprite(i,s->x,s->y,s->z); - t[0]++;//Number of bounces - } - else if (t[0] == 3) KILLIT(i); + { + t[1]++; + if (t[1] > 8) + { + t[1] = 0; + t[0]++; + t[0] &= 3; + } + if (s->zvel < 128) s->zvel += (gc/13); // 8 + else s->zvel -= 64; + if (s->xvel > 0) + s->xvel -= 4; + else s->xvel = 0; + } + else + { + t[1]++; + 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) + s->xvel --; + // else KILLIT(i); + } - if (s->xvel > 0) - { - s->xvel -= 2; - s->cstat = ((s->xvel&3)<<2); - } - else s->xvel = 0; + goto BOLT; - ssp(i,CLIPMASK0); + case GLASSPIECES__STATIC: + // case GLASSPIECES+1: + // case GLASSPIECES+2: - goto BOLT; + makeitfall(i); + + if (s->zvel > 4096) s->zvel = 4096; + if (sect < 0) KILLIT(i); + + if (s->z == hittype[i].floorz-(FOURSLEIGHT) && t[0] < 3) + { + s->zvel = -((3-t[0])<<8)-(TRAND&511); + if (sector[sect].lotag == 2) + s->zvel >>= 1; + s->xrepeat >>= 1; + s->yrepeat >>= 1; + if (rnd(96)) + setsprite(i,s->x,s->y,s->z); + t[0]++;//Number of bounces + } + else if (t[0] == 3) KILLIT(i); + + if (s->xvel > 0) + { + s->xvel -= 2; + s->cstat = ((s->xvel&3)<<2); + } + else s->xvel = 0; + + ssp(i,CLIPMASK0); + + goto BOLT; } IFWITHIN(SCRAP6,SCRAP5+3) @@ -5362,1003 +5439,725 @@ void moveeffectors(void) //STATNUM 3 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) + case 0: { - q >>= 2; + long zchange = 0; - if (sprite[i].extra == 1) + zchange = 0; + + j = s->owner; + + if (sprite[j].lotag == (short) 65535) + KILLIT(i); + + q = sc->extra>>3; + l = 0; + + if (sc->lotag == 30) { - if (hittype[i].tempang < 256) + q >>= 2; + + if (sprite[i].extra == 1) { - 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; - } - } - else if (sprite[i].extra == 3) - { - 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; - } - } - - 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); - - 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 (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) + if (hittype[i].tempang < 256) { - sprite[ps[p].i].x = m; - sprite[ps[p].i].y = x; + 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; } } + else if (sprite[i].extra == 3) + { + 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; + } + } + + 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); + + 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); } - p = headspritesect[s->sectnum]; - while (p >= 0) + if (l && (sc->floorstat&64)) { - if (sprite[p].statnum != 3 && sprite[p].statnum != 4) - if (sprite[p].picnum != LASERLINE) + for (p=connecthead;p>=0;p=connectpoint2[p]) + { + if (ps[p].cursectnum == s->sectnum && ps[p].on_ground == 1) { - if (sprite[p].picnum == APLAYER && sprite[p].owner >= 0) - { - p = nextspritesect[p]; - continue; - } - sprite[p].ang += (l*q); - sprite[p].ang &= 2047; + ps[p].ang += (l*q); + ps[p].ang &= 2047; - sprite[p].z += zchange; + ps[p].posz += zchange; rotatepoint(sprite[j].x,sprite[j].y, - sprite[p].x,sprite[p].y,(q*l), - &sprite[p].x,&sprite[p].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 = nextspritesect[p]; + } + + 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); } - ms(i); - } + break; + case 1: //Nothing for now used as the pivot + if (s->owner == -1) //Init + { + s->owner = i; - break; - case 1: //Nothing for now used as the pivot - if (s->owner == -1) //Init - { - s->owner = i; + j = headspritestat[3]; + while (j >= 0) + { + if (sprite[j].lotag == 19 && sprite[j].hitag == sh) + { + t[0] = 0; + break; + } + j = nextspritestat[j]; + } + } + + break; + case 6: + k = sc->extra; + + if (t[4] > 0) + { + t[4]--; + if (t[4] >= (k-(k>>3))) + s->xvel -= (k>>5); + if (t[4] > ((k>>1)-1) && t[4] < (k-(k>>3))) + s->xvel = 0; + if (t[4] < (k>>1)) + s->xvel += (k>>5); + if (t[4] < ((k>>1)-(k>>3))) + { + t[4] = 0; + s->xvel = k; + } + } + else s->xvel = k; j = headspritestat[3]; while (j >= 0) { - if (sprite[j].lotag == 19 && sprite[j].hitag == sh) + if ((sprite[j].lotag == 14) && (sh == sprite[j].hitag) && (hittype[j].temp_data[0] == t[0])) { - t[0] = 0; - break; + sprite[j].xvel = s->xvel; + // if( t[4] == 1 ) + { + 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) + x = -x; + s->xvel += x; + } + hittype[j].temp_data[4] = t[4]; } j = nextspritestat[j]; } - } - - break; - case 6: - k = sc->extra; - - if (t[4] > 0) - { - t[4]--; - if (t[4] >= (k-(k>>3))) - s->xvel -= (k>>5); - if (t[4] > ((k>>1)-1) && t[4] < (k-(k>>3))) - s->xvel = 0; - if (t[4] < (k>>1)) - s->xvel += (k>>5); - if (t[4] < ((k>>1)-(k>>3))) - { - t[4] = 0; - s->xvel = k; - } - } - else s->xvel = k; - - j = headspritestat[3]; - while (j >= 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) - hittype[j].temp_data[5] = dist(&sprite[j],s); - x = ksgn(dist(&sprite[j],s)-hittype[j].temp_data[5]); - if (sprite[j].extra) - x = -x; - s->xvel += x; - } - hittype[j].temp_data[4] = t[4]; - } - j = nextspritestat[j]; - } - x = 0; + x = 0; - case 14: - if (s->owner==-1) - s->owner = LocateTheLocator((short)t[3],(short)t[0]); - - 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); - } - - j = ldist(&sprite[s->owner],s); - - if (j < 1024L) - { - 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]); + case 14: if (s->owner==-1) + s->owner = LocateTheLocator((short)t[3],(short)t[0]); + + if (s->owner == -1) { - t[3]=0; - s->owner = LocateTheLocator(0,t[0]); + Bsprintf(tempbuf,"Could not find any locators for SE# 6 and 14 with a hitag of %ld.\n",t[3]); + gameexit(tempbuf); } - } - if (s->xvel) - { - x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); - q = getincangle(s->ang,x)>>3; + j = ldist(&sprite[s->owner],s); - t[2] += q; - s->ang += q; - - if (s->xvel == sc->extra) + if (j < 1024L) { - if ((sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0) + 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 (!issoundplaying(i,hittype[i].lastvx)) - spritesound(hittype[i].lastvx,i); + t[3]=0; + s->owner = LocateTheLocator(0,t[0]); } - else if (ud.monsters_off == 0 && sc->floorpal == 0 && (sc->floorstat&1) && rnd(8)) + } + + if (s->xvel) + { + x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); + q = getincangle(s->ang,x)>>3; + + t[2] += q; + s->ang += q; + + if (s->xvel == sc->extra) { - p = findplayer(s,&x); - if (x < 20480) + if ((sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0) { - j = s->ang; - s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); - shoot(i,RPG); - s->ang = j; + 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)) + { + p = findplayer(s,&x); + if (x < 20480) + { + j = s->ang; + s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); + shoot(i,RPG); + s->ang = j; + } } } - } - if (s->xvel <= 64 && (sc->floorstat&1) == 0 && (sc->ceilingstat&1) == 0) - stopspritesound(hittype[i].lastvx,i); + 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 (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 ((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) { - ps[p].posx = s->x; - ps[p].posy = s->y; - ps[p].cursectnum = s->sectnum; + 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)) + { + ps[p].posx = s->x; + ps[p].posy = s->y; + ps[p].cursectnum = s->sectnum; - setsprite(ps[p].i,s->x,s->y,s->z); - quickkill(&ps[p]); + setsprite(ps[p].i,s->x,s->y,s->z); + quickkill(&ps[p]); + } + } + } + + 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) + { + if (po[p].os == s->sectnum) + { + po[p].ox += m; + po[p].oy += x; + } + + 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); + + ps[p].posx += m; + ps[p].posy += x; + + ps[p].bobposx += m; + ps[p].bobposy += x; + + ps[p].ang += q; + + if (numplayers > 1) + { + ps[p].oposx = ps[p].posx; + ps[p].oposy = ps[p].posy; + } + if (sprite[ps[p].i].extra <= 0) + { + sprite[ps[p].i].x = ps[p].posx; + sprite[ps[p].i].y = ps[p].posy; } } + } + j = headspritesect[s->sectnum]; + while (j >= 0) + { + if (sprite[j].statnum != 10 && sector[sprite[j].sectnum].lotag != 2 && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) + { + rotatepoint(s->x,s->y, + sprite[j].x,sprite[j].y,q, + &sprite[j].x,&sprite[j].y); + + sprite[j].x+= m; + sprite[j].y+= x; + + sprite[j].ang+=q; + + if (numplayers > 1) + { + hittype[j].bposx = sprite[j].x; + hittype[j].bposy = sprite[j].y; + } + } + j = nextspritesect[j]; + } + + ms(i); + setsprite(i,s->x,s->y,s->z); + + 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) + { + 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)) + { + ps[p].oposx = ps[p].posx = s->x; + ps[p].oposy = ps[p].posy = s->y; + ps[p].cursectnum = s->sectnum; + + setsprite(ps[p].i,s->x,s->y,s->z); + quickkill(&ps[p]); + } + } + + j = headspritesect[sprite[OW].sectnum]; + 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) + { + gutsdir(&sprite[j],JIBS6,72,myconnectindex); + spritesound(SQUISHED,i); + deletesprite(j); + } + } + j = l; + } + } } - m = (s->xvel*sintable[(s->ang+512)&2047])>>14; - x = (s->xvel*sintable[s->ang&2047])>>14; + break; - for (p = connecthead;p >= 0;p=connectpoint2[p]) - if (sector[ps[p].cursectnum].lotag != 2) + case 30: + if (s->owner == -1) + { + t[3] = !t[3]; + s->owner = LocateTheLocator(t[3],t[0]); + } + else + { + + if (t[4] == 1) // Starting to go { - if (po[p].os == s->sectnum) + if (ldist(&sprite[s->owner],s) < (2048-128)) + t[4] = 2; + else { - po[p].ox += m; - po[p].oy += x; + if (s->xvel == 0) + operateactivators(s->hitag+(!t[3]),-1); + if (s->xvel < 256) + s->xvel += 16; } + } + if (t[4] == 2) + { + l = FindDistance2D(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); - if (s->sectnum == sprite[ps[p].i].sectnum) + if (l <= 128) + s->xvel = 0; + + if (s->xvel > 0) + s->xvel -= 16; + else { - rotatepoint(s->x,s->y,ps[p].posx,ps[p].posy,q,&ps[p].posx,&ps[p].posy); + s->xvel = 0; + operateactivators(s->hitag+(short)t[3],-1); + s->owner = -1; + s->ang += 1024; + t[4] = 0; + operateforcefields(i,s->hitag); - ps[p].posx += m; + j = headspritesect[s->sectnum]; + while (j >= 0) + { + if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) + { + hittype[j].bposx = sprite[j].x; + hittype[j].bposy = sprite[j].y; + } + j = nextspritesect[j]; + } + + } + } + } + + 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) + { + 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)) + { + ps[p].posx = s->x; + ps[p].posy = s->y; + ps[p].cursectnum = s->sectnum; + + setsprite(ps[p].i,s->x,s->y,s->z); + quickkill(&ps[p]); + } + } + + for (p = connecthead;p >= 0;p = connectpoint2[p]) + { + if (sprite[ps[p].i].sectnum == s->sectnum) + { + ps[p].posx += l; ps[p].posy += x; - ps[p].bobposx += m; - ps[p].bobposy += x; - - ps[p].ang += q; - if (numplayers > 1) { ps[p].oposx = ps[p].posx; ps[p].oposy = ps[p].posy; } - if (sprite[ps[p].i].extra <= 0) - { - sprite[ps[p].i].x = ps[p].posx; - sprite[ps[p].i].y = ps[p].posy; - } + + ps[p].bobposx += l; + ps[p].bobposy += x; } - } - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].statnum != 10 && sector[sprite[j].sectnum].lotag != 2 && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) - { - rotatepoint(s->x,s->y, - sprite[j].x,sprite[j].y,q, - &sprite[j].x,&sprite[j].y); - sprite[j].x+= m; - sprite[j].y+= x; - - sprite[j].ang+=q; - - if (numplayers > 1) + if (po[p].os == s->sectnum) { - hittype[j].bposx = sprite[j].x; - hittype[j].bposy = sprite[j].y; + po[p].ox += l; + po[p].oy += x; } } - j = nextspritesect[j]; - } - ms(i); - setsprite(i,s->x,s->y,s->z); - - 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) - { - 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)) - { - ps[p].oposx = ps[p].posx = s->x; - ps[p].oposy = ps[p].posy = s->y; - ps[p].cursectnum = s->sectnum; - - setsprite(ps[p].i,s->x,s->y,s->z); - quickkill(&ps[p]); - } - } - - j = headspritesect[sprite[OW].sectnum]; + j = headspritesect[s->sectnum]; while (j >= 0) { - l = nextspritesect[j]; - if (sprite[j].statnum == 1 && badguy(&sprite[j]) && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) + if (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) - { - gutsdir(&sprite[j],JIBS6,72,myconnectindex); - spritesound(SQUISHED,i); - deletesprite(j); - } - } - j = l; - } - } - } - - break; - - case 30: - if (s->owner == -1) - { - t[3] = !t[3]; - s->owner = LocateTheLocator(t[3],t[0]); - } - else - { - - if (t[4] == 1) // Starting to go - { - if (ldist(&sprite[s->owner],s) < (2048-128)) - t[4] = 2; - else - { - if (s->xvel == 0) - operateactivators(s->hitag+(!t[3]),-1); - if (s->xvel < 256) - s->xvel += 16; - } - } - if (t[4] == 2) - { - l = FindDistance2D(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); - - if (l <= 128) - s->xvel = 0; - - if (s->xvel > 0) - s->xvel -= 16; - else - { - s->xvel = 0; - operateactivators(s->hitag+(short)t[3],-1); - s->owner = -1; - s->ang += 1024; - t[4] = 0; - operateforcefields(i,s->hitag); - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) + if (numplayers < 2) { hittype[j].bposx = sprite[j].x; hittype[j].bposy = sprite[j].y; } - j = nextspritesect[j]; - } - } - } - } + sprite[j].x += l; + sprite[j].y += x; - 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 (numplayers > 1) { - 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)) - { - ps[p].posx = s->x; - ps[p].posy = s->y; - ps[p].cursectnum = s->sectnum; - - setsprite(ps[p].i,s->x,s->y,s->z); - quickkill(&ps[p]); - } - } - - for (p = connecthead;p >= 0;p = connectpoint2[p]) - { - if (sprite[ps[p].i].sectnum == s->sectnum) - { - ps[p].posx += l; - ps[p].posy += x; - - if (numplayers > 1) - { - ps[p].oposx = ps[p].posx; - ps[p].oposy = ps[p].posy; - } - - ps[p].bobposx += l; - ps[p].bobposy += x; - } - - if (po[p].os == s->sectnum) - { - po[p].ox += l; - po[p].oy += x; - } - } - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) - { - if (numplayers < 2) - { - hittype[j].bposx = sprite[j].x; - hittype[j].bposy = sprite[j].y; - } - - sprite[j].x += l; - sprite[j].y += x; - - if (numplayers > 1) - { - hittype[j].bposx = sprite[j].x; - hittype[j].bposy = sprite[j].y; - } - } - j = nextspritesect[j]; - } - - ms(i); - setsprite(i,s->x,s->y,s->z); - - 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)) - { - ps[p].posx = s->x; - ps[p].posy = s->y; - - ps[p].oposx = ps[p].posx; - ps[p].oposy = ps[p].posy; - - ps[p].cursectnum = s->sectnum; - - setsprite(ps[p].i,s->x,s->y,s->z); - quickkill(&ps[p]); - } - } - - j = headspritesect[sprite[OW].sectnum]; - while (j >= 0) - { - l = nextspritesect[j]; - if (sprite[j].statnum == 1 && badguy(&sprite[j]) && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) - { - // if(sprite[j].sectnum != s->sectnum) - { - k = sprite[j].sectnum; - updatesector(sprite[j].x,sprite[j].y,&k); - if (sprite[j].extra >= 0 && k == s->sectnum) - { - gutsdir(&sprite[j],JIBS6,24,myconnectindex); - spritesound(SQUISHED,j); - deletesprite(j); - } - } - - } - j = l; - } - } - } - - break; - - - case 2://Quakes - if (t[4] > 0 && t[0] == 0) - { - if (t[4] < sh) - t[4]++; - else t[0] = 1; - } - - if (t[0] > 0) - { - t[0]++; - - s->xvel = 3; - - if (t[0] > 96) - { - t[0] = -1; //Stop the quake - t[4] = -1; - KILLIT(i); - } - else - { - if ((t[0]&31) == 8) - { - earthquaketime = 48; - spritesound(EARTHQUAKE,ps[screenpeek].i); - } - - if (klabs(sc->floorheinum-t[5]) < 8) - sc->floorheinum = t[5]; - else sc->floorheinum += (ksgn(t[5]-sc->floorheinum)<<4); - } - - 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 (ps[p].cursectnum == s->sectnum && ps[p].on_ground) - { - ps[p].posx += m; - ps[p].posy += x; - - ps[p].bobposx += m; - ps[p].bobposy += x; - } - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - nextj = nextspritesect[j]; - - if (sprite[j].picnum != SECTOREFFECTOR) - { - sprite[j].x+=m; - sprite[j].y+=x; - setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z); - } - j = nextj; - } - ms(i); - setsprite(i,s->x,s->y,s->z); - } - break; - - //Flashing sector lights after reactor EXPLOSION2 - - case 3: - - 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]) - { - // t[5] = 4+(global_random&7); - sc->ceilingpal = s->owner>>8; - sc->floorpal = s->owner&0xff; - t[0] = s->shade + (global_random&15); - } - else - { - // t[5] = 4+(global_random&3); - sc->ceilingpal = s->pal; - sc->floorpal = s->pal; - t[0] = t[3]; - } - - sc->ceilingshade = t[0]; - sc->floorshade = t[0]; - - wal = &wall[sc->wallptr]; - - for (x=sc->wallnum;x > 0;x--,wal++) - { - if (wal->hitag != 1) - { - wal->shade = t[0]; - if ((wal->cstat&2) && wal->nextwall >= 0) - { - wall[wal->nextwall].shade = wal->shade; - } - } - } - - break; - - case 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); - sc->ceilingpal = s->owner>>8; - sc->floorpal = s->owner&0xff; - j = 1; - } - else - { - t[1] = t[2]; - t[0] = t[3]; - - sc->ceilingpal = s->pal; - sc->floorpal = s->pal; - - j = 0; - } - - sc->floorshade = t[1]; - sc->ceilingshade = t[1]; - - wal = &wall[sc->wallptr]; - - for (x=sc->wallnum;x > 0; x--,wal++) - { - if (j) wal->pal = (s->owner&0xff); - else wal->pal = s->pal; - - if (wal->hitag != 1) - { - wal->shade = t[0]; - if ((wal->cstat&2) && wal->nextwall >= 0) - wall[wal->nextwall].shade = wal->shade; - } - } - - j = headspritesect[SECT]; - while (j >= 0) - { - if (sprite[j].cstat&16 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) - { - if (sc->ceilingstat&1) - sprite[j].shade = sc->ceilingshade; - else sprite[j].shade = sc->floorshade; - } - - j = nextspritesect[j]; - } - - if (t[4]) KILLIT(i); - - break; - - //BOSS - case 5: - p = findplayer(s,&x); - if (x < 8192) - { - j = s->ang; - s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); - shoot(i,FIRELASER); - s->ang = j; - } - - if (s->owner==-1) //Start search - { - t[4]=0; - l = 0x7fffffff; - while (1) //Find the shortest dist - { - s->owner = LocateTheLocator((short)t[4],-1); //t[0] hold sectnum - - if (s->owner==-1) break; - - m = ldist(&sprite[ps[p].i],&sprite[s->owner]); - - if (l > m) - { - q = s->owner; - l = m; - } - - t[4]++; - } - - s->owner = q; - s->zvel = ksgn(sprite[q].z-s->z)<<4; - } - - if (ldist(&sprite[s->owner],s) < 1024) - { - short ta; - ta = s->ang; - s->ang = getangle(ps[p].posx-s->x,ps[p].posy-s->y); - s->ang = ta; - s->owner = -1; - goto BOLT; - - } - else s->xvel=256; - - x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); - q = getincangle(s->ang,x)>>3; - s->ang += q; - - if (rnd(32)) - { - t[2]+=q; - sc->ceilingshade = 127; - } - else - { - t[2] += - getincangle(t[2]+512,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>2; - sc->ceilingshade = 0; - } - IFHIT - { - t[3]++; - if (t[3] == 5) - { - s->zvel += 1024; - FTA(7,&ps[myconnectindex]); - } - } - - s->z += s->zvel; - sc->ceilingz += s->zvel; - sector[t[0]].ceilingz += s->zvel; - ms(i); - setsprite(i,s->x,s->y,s->z); - break; - - - case 8: - case 9: - - // work only if its moving - - j = -1; - - if (hittype[i].temp_data[4]) - { - hittype[i].temp_data[4]++; - if (hittype[i].temp_data[4] > 8) KILLIT(i); - j = 1; - } - else j = getanimationgoal(&sc->ceilingz); - - if (j >= 0) - { - short sn; - - if ((sc->lotag&0x8000) || hittype[i].temp_data[4]) - x = -t[3]; - else - x = t[3]; - - if (st == 9) x = -x; - - j = headspritestat[3]; - while (j >= 0) - { - 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++) - { - if (wal->hitag != 1) - { - wal->shade+=x; - - if (wal->shade < m) - wal->shade = m; - 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) - wall[wal->nextwall].shade = wal->shade; + hittype[j].bposx = sprite[j].x; + hittype[j].bposy = sprite[j].y; } } - - sector[sn].floorshade += x; - sector[sn].ceilingshade += x; - - if (sector[sn].floorshade < m) - sector[sn].floorshade = m; - else if (sector[sn].floorshade > hittype[j].temp_data[0]) - sector[sn].floorshade = hittype[j].temp_data[0]; - - if (sector[sn].ceilingshade < m) - sector[sn].ceilingshade = m; - else if (sector[sn].ceilingshade > hittype[j].temp_data[1]) - sector[sn].ceilingshade = hittype[j].temp_data[1]; - - } - j = nextspritestat[j]; - } - } - break; - case 10: - - 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) - j = 0; - - if (j == 1) - { - if (t[0] > sh) - switch (sector[s->sectnum].lotag) - { - case 20: - case 21: - case 22: - case 26: - if (getanimationgoal(§or[s->sectnum].ceilingz) >= 0) - break; - default: - activatebysector(s->sectnum,i); - t[0] = 0; - break; - } - else t[0]++; - } - } - else t[0]=0; - break; - case 11: //Swingdoor - - if (t[5] > 0) - { - t[5]--; - break; - } - - if (t[4]) - { - short startwall,endwall; - - startwall = sc->wallptr; - endwall = startwall+sc->wallnum; - - for (j=startwall;j= 0) - { - if (sprite[k].extra > 0 && badguy(&sprite[k]) && clipinsidebox(sprite[k].x,sprite[k].y,j,256L) == 1) - goto BOLT; - k = nextspritestat[k]; + j = nextspritesect[j]; } - k = headspritestat[10]; - while (k >= 0) - { - if (sprite[k].owner >= 0 && clipinsidebox(sprite[k].x,sprite[k].y,j,144L) == 1) - { - t[5] = 8; // Delay - k = (SP>>3)*t[3]; - t[2]-=k; - t[4]-=k; - ms(i); - setsprite(i,s->x,s->y,s->z); - goto BOLT; - } - k = nextspritestat[k]; - } - } - - k = (SP>>3)*t[3]; - t[2]+=k; - t[4]+=k; - ms(i); - setsprite(i,s->x,s->y,s->z); - - if (t[4] <= -511 || t[4] >= 512) - { - t[4] = 0; - t[2] &= 0xffffff00; ms(i); setsprite(i,s->x,s->y,s->z); - break; - } - } - break; - case 12: - 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) + if ((sc->floorz-sc->ceilingz) < (108<<8)) { - wal->shade = t[1]; - wal->pal = 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)) + { + ps[p].posx = s->x; + ps[p].posy = s->y; + + ps[p].oposx = ps[p].posx; + ps[p].oposy = ps[p].posy; + + ps[p].cursectnum = s->sectnum; + + setsprite(ps[p].i,s->x,s->y,s->z); + quickkill(&ps[p]); + } + } + + j = headspritesect[sprite[OW].sectnum]; + while (j >= 0) + { + l = nextspritesect[j]; + if (sprite[j].statnum == 1 && badguy(&sprite[j]) && sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) + { + // if(sprite[j].sectnum != s->sectnum) + { + k = sprite[j].sectnum; + updatesector(sprite[j].x,sprite[j].y,&k); + if (sprite[j].extra >= 0 && k == s->sectnum) + { + gutsdir(&sprite[j],JIBS6,24,myconnectindex); + spritesound(SQUISHED,j); + deletesprite(j); + } + } + + } + j = l; + } + } + } + + break; + + + case 2://Quakes + if (t[4] > 0 && t[0] == 0) + { + if (t[4] < sh) + t[4]++; + else t[0] = 1; + } + + if (t[0] > 0) + { + t[0]++; + + s->xvel = 3; + + if (t[0] > 96) + { + t[0] = -1; //Stop the quake + t[4] = -1; + KILLIT(i); + } + else + { + if ((t[0]&31) == 8) + { + earthquaketime = 48; + spritesound(EARTHQUAKE,ps[screenpeek].i); + } + + if (klabs(sc->floorheinum-t[5]) < 8) + sc->floorheinum = t[5]; + else sc->floorheinum += (ksgn(t[5]-sc->floorheinum)<<4); } + 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 (ps[p].cursectnum == s->sectnum && ps[p].on_ground) + { + ps[p].posx += m; + ps[p].posy += x; + + ps[p].bobposx += m; + ps[p].bobposy += x; + } + + j = headspritesect[s->sectnum]; + while (j >= 0) + { + nextj = nextspritesect[j]; + + if (sprite[j].picnum != SECTOREFFECTOR) + { + sprite[j].x+=m; + sprite[j].y+=x; + setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z); + } + j = nextj; + } + ms(i); + setsprite(i,s->x,s->y,s->z); + } + break; + + //Flashing sector lights after reactor EXPLOSION2 + + case 3: + + 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]) + { + // t[5] = 4+(global_random&7); + sc->ceilingpal = s->owner>>8; + sc->floorpal = s->owner&0xff; + t[0] = s->shade + (global_random&15); + } + else + { + // t[5] = 4+(global_random&3); + sc->ceilingpal = s->pal; + sc->floorpal = s->pal; + t[0] = t[3]; + } + + sc->ceilingshade = t[0]; + sc->floorshade = t[0]; + + wal = &wall[sc->wallptr]; + + for (x=sc->wallnum;x > 0;x--,wal++) + { + if (wal->hitag != 1) + { + wal->shade = t[0]; + if ((wal->cstat&2) && wal->nextwall >= 0) + { + wall[wal->nextwall].shade = wal->shade; + } + } + } + + break; + + case 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); + sc->ceilingpal = s->owner>>8; + sc->floorpal = s->owner&0xff; + j = 1; + } + else + { + t[1] = t[2]; + t[0] = t[3]; + + sc->ceilingpal = s->pal; + sc->floorpal = s->pal; + + j = 0; + } + sc->floorshade = t[1]; - sc->ceilingshade = t[2]; - t[0]=0; + sc->ceilingshade = t[1]; + + wal = &wall[sc->wallptr]; + + for (x=sc->wallnum;x > 0; x--,wal++) + { + if (j) wal->pal = (s->owner&0xff); + else wal->pal = s->pal; + + if (wal->hitag != 1) + { + wal->shade = t[0]; + if ((wal->cstat&2) && wal->nextwall >= 0) + wall[wal->nextwall].shade = wal->shade; + } + } j = headspritesect[SECT]; while (j >= 0) @@ -6369,930 +6168,1273 @@ void moveeffectors(void) //STATNUM 3 sprite[j].shade = sc->ceilingshade; else sprite[j].shade = sc->floorshade; } - j = nextspritesect[j]; + j = nextspritesect[j]; } - if (t[3] == 1) KILLIT(i); - } - if (t[0] == 1) //Lights flickering on - { - if (sc->floorshade > s->shade) - { - sc->floorpal = s->pal; - sc->ceilingpal = s->pal; + if (t[4]) KILLIT(i); - sc->floorshade -= 2; - sc->ceilingshade -= 2; + break; + + //BOSS + case 5: + p = findplayer(s,&x); + if (x < 8192) + { + j = s->ang; + s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); + shoot(i,FIRELASER); + s->ang = j; + } + + if (s->owner==-1) //Start search + { + t[4]=0; + l = 0x7fffffff; + while (1) //Find the shortest dist + { + s->owner = LocateTheLocator((short)t[4],-1); //t[0] hold sectnum + + if (s->owner==-1) break; + + m = ldist(&sprite[ps[p].i],&sprite[s->owner]); + + if (l > m) + { + q = s->owner; + l = m; + } + + t[4]++; + } + + s->owner = q; + s->zvel = ksgn(sprite[q].z-s->z)<<4; + } + + if (ldist(&sprite[s->owner],s) < 1024) + { + short ta; + ta = s->ang; + s->ang = getangle(ps[p].posx-s->x,ps[p].posy-s->y); + s->ang = ta; + s->owner = -1; + goto BOLT; + + } + else s->xvel=256; + + x = getangle(sprite[s->owner].x-s->x,sprite[s->owner].y-s->y); + q = getincangle(s->ang,x)>>3; + s->ang += q; + + if (rnd(32)) + { + t[2]+=q; + sc->ceilingshade = 127; + } + else + { + t[2] += + getincangle(t[2]+512,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>2; + sc->ceilingshade = 0; + } + IFHIT + { + t[3]++; + if (t[3] == 5) + { + s->zvel += 1024; + FTA(7,&ps[myconnectindex]); + } + } + + s->z += s->zvel; + sc->ceilingz += s->zvel; + sector[t[0]].ceilingz += s->zvel; + ms(i); + setsprite(i,s->x,s->y,s->z); + break; + + + case 8: + case 9: + + // work only if its moving + + j = -1; + + if (hittype[i].temp_data[4]) + { + hittype[i].temp_data[4]++; + if (hittype[i].temp_data[4] > 8) KILLIT(i); + j = 1; + } + else j = getanimationgoal(&sc->ceilingz); + + if (j >= 0) + { + short sn; + + if ((sc->lotag&0x8000) || hittype[i].temp_data[4]) + x = -t[3]; + else + x = t[3]; + + if (st == 9) x = -x; + + j = headspritestat[3]; + while (j >= 0) + { + 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++) + { + if (wal->hitag != 1) + { + wal->shade+=x; + + if (wal->shade < m) + wal->shade = m; + 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) + wall[wal->nextwall].shade = wal->shade; + } + } + + sector[sn].floorshade += x; + sector[sn].ceilingshade += x; + + if (sector[sn].floorshade < m) + sector[sn].floorshade = m; + else if (sector[sn].floorshade > hittype[j].temp_data[0]) + sector[sn].floorshade = hittype[j].temp_data[0]; + + if (sector[sn].ceilingshade < m) + sector[sn].ceilingshade = m; + else if (sector[sn].ceilingshade > hittype[j].temp_data[1]) + sector[sn].ceilingshade = hittype[j].temp_data[1]; + + } + j = nextspritestat[j]; + } + } + break; + case 10: + + 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) + j = 0; + + if (j == 1) + { + if (t[0] > sh) + switch (sector[s->sectnum].lotag) + { + case 20: + case 21: + case 22: + case 26: + if (getanimationgoal(§or[s->sectnum].ceilingz) >= 0) + break; + default: + activatebysector(s->sectnum,i); + t[0] = 0; + break; + } + else t[0]++; + } + } + else t[0]=0; + break; + case 11: //Swingdoor + + if (t[5] > 0) + { + t[5]--; + break; + } + + if (t[4]) + { + short startwall,endwall; + + startwall = sc->wallptr; + endwall = startwall+sc->wallnum; + + for (j=startwall;j= 0) + { + 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) + { + if (sprite[k].owner >= 0 && clipinsidebox(sprite[k].x,sprite[k].y,j,144L) == 1) + { + t[5] = 8; // Delay + k = (SP>>3)*t[3]; + t[2]-=k; + t[4]-=k; + ms(i); + setsprite(i,s->x,s->y,s->z); + goto BOLT; + } + k = nextspritestat[k]; + } + } + + k = (SP>>3)*t[3]; + t[2]+=k; + t[4]+=k; + ms(i); + setsprite(i,s->x,s->y,s->z); + + if (t[4] <= -511 || t[4] >= 512) + { + t[4] = 0; + t[2] &= 0xffffff00; + ms(i); + setsprite(i,s->x,s->y,s->z); + break; + } + } + break; + case 12: + 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++) + for (j = sc->wallnum;j > 0; j--, wal++) if (wal->hitag != 1) { - wal->pal = s->pal; - wal->shade -= 2; + wal->shade = t[1]; + wal->pal = 0; } - } - else t[0] = 2; - j = headspritesect[SECT]; - while (j >= 0) - { - if (sprite[j].cstat&16) + sc->floorshade = t[1]; + sc->ceilingshade = t[2]; + t[0]=0; + + j = headspritesect[SECT]; + while (j >= 0) { - if (sc->ceilingstat&1 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) - sprite[j].shade = sc->ceilingshade; - else sprite[j].shade = sc->floorshade; + if (sprite[j].cstat&16 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) + { + if (sc->ceilingstat&1) + sprite[j].shade = sc->ceilingshade; + else sprite[j].shade = sc->floorshade; + } + j = nextspritesect[j]; + } - j = nextspritesect[j]; + + if (t[3] == 1) KILLIT(i); } - } - break; - - - case 13: - if (t[2]) - { - j = (SP<<5)|1; - - if (s->ang == 512) + if (t[0] == 1) //Lights flickering on { - if (s->owner) + if (sc->floorshade > s->shade) { - if (klabs(t[0]-sc->ceilingz) >= j) - sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j; - else sc->ceilingz = t[0]; + sc->floorpal = s->pal; + sc->ceilingpal = s->pal; + + sc->floorshade -= 2; + sc->ceilingshade -= 2; + + wal = &wall[sc->wallptr]; + for (j=sc->wallnum;j>0;j--,wal++) + if (wal->hitag != 1) + { + wal->pal = s->pal; + wal->shade -= 2; + } + } + else t[0] = 2; + + j = headspritesect[SECT]; + while (j >= 0) + { + if (sprite[j].cstat&16) + { + if (sc->ceilingstat&1 && checkspriteflags(j,SPRITE_FLAG_NOSHADE) == 0) + sprite[j].shade = sc->ceilingshade; + else sprite[j].shade = sc->floorshade; + } + j = nextspritesect[j]; + } + } + break; + + + case 13: + if (t[2]) + { + j = (SP<<5)|1; + + if (s->ang == 512) + { + if (s->owner) + { + 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) + sc->floorz += ksgn(t[1]-sc->floorz)*j; + else sc->floorz = t[1]; + } } else { 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) + sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j; + sc->ceilingz = t[0]; } - } - else - { - 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) - sc->ceilingz += ksgn(t[0]-sc->ceilingz)*j; - sc->ceilingz = t[0]; - } - if (t[3] == 1) - { - //Change the shades - - t[3]++; - sc->ceilingstat ^= 1; - - if (s->ang == 512) + if (t[3] == 1) { - wal = &wall[sc->wallptr]; - for (j=sc->wallnum;j>0;j--,wal++) - wal->shade = s->shade; + //Change the shades - sc->floorshade = s->shade; + t[3]++; + sc->ceilingstat ^= 1; - if (ps[0].one_parallax_sectnum >= 0) + if (s->ang == 512) { - sc->ceilingpicnum = - sector[ps[0].one_parallax_sectnum].ceilingpicnum; - sc->ceilingshade = - sector[ps[0].one_parallax_sectnum].ceilingshade; + wal = &wall[sc->wallptr]; + for (j=sc->wallnum;j>0;j--,wal++) + wal->shade = s->shade; + + sc->floorshade = s->shade; + + if (ps[0].one_parallax_sectnum >= 0) + { + sc->ceilingpicnum = + sector[ps[0].one_parallax_sectnum].ceilingpicnum; + sc->ceilingshade = + sector[ps[0].one_parallax_sectnum].ceilingshade; + } } } + t[2]++; + if (t[2] > 256) + KILLIT(i); } - t[2]++; - if (t[2] > 256) - KILLIT(i); - } - if (t[2] == 4 && s->ang != 512) - for (x=0;x<7;x++) RANDOMSCRAP; - break; + if (t[2] == 4 && s->ang != 512) + for (x=0;x<7;x++) RANDOMSCRAP; + break; - case 15: + case 15: - if (t[4]) - { - s->xvel = 16; - - if (t[4] == 1) //Opening + if (t[4]) { - if (t[3] >= (SP>>3)) + s->xvel = 16; + + if (t[4] == 1) //Opening { - t[4] = 0; //Turn off the sliders - callsound(s->sectnum,i); - break; + if (t[3] >= (SP>>3)) + { + t[4] = 0; //Turn off the sliders + callsound(s->sectnum,i); + break; + } + t[3]++; } - t[3]++; + else if (t[4] == 2) + { + if (t[3]<1) + { + t[4] = 0; + callsound(s->sectnum,i); + break; + } + t[3]--; + } + + ms(i); + setsprite(i,s->x,s->y,s->z); } - else if (t[4] == 2) + break; + + case 16: //Reactor + + t[2]+=32; + if (sc->floorzceilingz) s->shade=0; + + else if (sc->ceilingz < t[3]) { - if (t[3]<1) + + //The following code check to see if + //there is any other sprites in the sector. + //If there isn't, then kill this sectoreffector + //itself..... + + j = headspritesect[s->sectnum]; + while (j >= 0) { - t[4] = 0; - callsound(s->sectnum,i); - break; + if (sprite[j].picnum == REACTOR || sprite[j].picnum == REACTOR2) + break; + j = nextspritesect[j]; } - t[3]--; + if (j == -1) + { + KILLIT(i); + } + else s->shade=1; } + if (s->shade) sc->ceilingz+=1024; + else sc->ceilingz-=512; + ms(i); setsprite(i,s->x,s->y,s->z); - } - break; - case 16: //Reactor + break; - t[2]+=32; - if (sc->floorzceilingz) s->shade=0; + case 17: - else if (sc->ceilingz < t[3]) - { + q = t[0]*(SP<<2); - //The following code check to see if - //there is any other sprites in the sector. - //If there isn't, then kill this sectoreffector - //itself..... + sc->ceilingz += q; + sc->floorz += q; j = headspritesect[s->sectnum]; while (j >= 0) { - if (sprite[j].picnum == REACTOR || sprite[j].picnum == REACTOR2) - break; + if (sprite[j].statnum == 10 && sprite[j].owner >= 0) + { + p = sprite[j].yvel; + if (numplayers < 2) + ps[p].oposz = ps[p].posz; + ps[p].posz += q; + ps[p].truefz += q; + ps[p].truecz += q; + if (numplayers > 1) + ps[p].oposz = ps[p].posz; + } + if (sprite[j].statnum != 3) + { + hittype[j].bposz = sprite[j].z; + sprite[j].z += q; + } + + hittype[j].floorz = sc->floorz; + hittype[j].ceilingz = sc->ceilingz; + j = nextspritesect[j]; } - if (j == -1) { KILLIT(i); } - else s->shade=1; - } - if (s->shade) sc->ceilingz+=1024; - else sc->ceilingz-=512; - - ms(i); - setsprite(i,s->x,s->y,s->z); - - break; - - case 17: - - q = t[0]*(SP<<2); - - sc->ceilingz += q; - sc->floorz += q; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - if (sprite[j].statnum == 10 && sprite[j].owner >= 0) - { - p = sprite[j].yvel; - if (numplayers < 2) - ps[p].oposz = ps[p].posz; - ps[p].posz += q; - ps[p].truefz += q; - ps[p].truecz += q; - if (numplayers > 1) - ps[p].oposz = ps[p].posz; - } - if (sprite[j].statnum != 3) - { - hittype[j].bposz = sprite[j].z; - sprite[j].z += q; - } - - hittype[j].floorz = sc->floorz; - hittype[j].ceilingz = sc->ceilingz; - - j = nextspritesect[j]; - } - - if (t[0]) if (t[0]) //If in motion - { - if (klabs(sc->floorz-t[2]) <= SP) + if (t[0]) if (t[0]) //If in motion { - activatewarpelevators(i,0); + if (klabs(sc->floorz-t[2]) <= SP) + { + activatewarpelevators(i,0); + break; + } + + if (t[0]==-1) + { + if (sc->floorz > t[3]) + break; + } + else if (sc->ceilingz < t[4]) break; + + if (t[1] == 0) break; + t[1] = 0; + + j = headspritestat[3]; + while (j >= 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; + + k = headspritesect[s->sectnum]; + while (k >= 0) + { + nextk = nextspritesect[k]; + + if (sprite[k].statnum == 10 && sprite[k].owner >= 0) + { + p = sprite[k].yvel; + + ps[p].posx += sprite[j].x-s->x; + ps[p].posy += sprite[j].y-s->y; + ps[p].posz = sector[sprite[j].sectnum].floorz-(sc->floorz-ps[p].posz); + + hittype[k].floorz = sector[sprite[j].sectnum].floorz; + hittype[k].ceilingz = sector[sprite[j].sectnum].ceilingz; + + ps[p].bobposx = ps[p].oposx = ps[p].posx; + ps[p].bobposy = ps[p].oposy = ps[p].posy; + ps[p].oposz = ps[p].posz; + + ps[p].truefz = hittype[k].floorz; + ps[p].truecz = hittype[k].ceilingz; + ps[p].bobcounter = 0; + + changespritesect(k,sprite[j].sectnum); + ps[p].cursectnum = sprite[j].sectnum; + } + else if (sprite[k].statnum != 3) + { + sprite[k].x += + sprite[j].x-s->x; + sprite[k].y += + sprite[j].y-s->y; + sprite[k].z = sector[sprite[j].sectnum].floorz- + (sc->floorz-sprite[k].z); + + hittype[k].bposx = sprite[k].x; + hittype[k].bposy = sprite[k].y; + hittype[k].bposz = sprite[k].z; + + changespritesect(k,sprite[j].sectnum); + setsprite(k,sprite[k].x,sprite[k].y,sprite[k].z); + + hittype[k].floorz = sector[sprite[j].sectnum].floorz; + hittype[k].ceilingz = sector[sprite[j].sectnum].ceilingz; + + } + k = nextk; + } + } + break; + + case 18: + if (t[0]) + { + if (s->pal) + { + if (s->ang == 512) + { + sc->ceilingz -= sc->extra; + if (sc->ceilingz <= t[1]) + { + sc->ceilingz = t[1]; + KILLIT(i); + } + } + else + { + sc->floorz += sc->extra; + j = headspritesect[s->sectnum]; + while (j >= 0) + { + 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) + { + hittype[j].bposz = sprite[j].z += sc->extra; + hittype[j].floorz = sc->floorz; + } + j = nextspritesect[j]; + } + if (sc->floorz >= t[1]) + { + sc->floorz = t[1]; + KILLIT(i); + } + } + } + else + { + if (s->ang == 512) + { + sc->ceilingz += sc->extra; + if (sc->ceilingz >= s->z) + { + sc->ceilingz = s->z; + KILLIT(i); + } + } + else + { + sc->floorz -= sc->extra; + j = headspritesect[s->sectnum]; + while (j >= 0) + { + 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) + { + hittype[j].bposz = sprite[j].z -= sc->extra; + hittype[j].floorz = sc->floorz; + } + j = nextspritesect[j]; + } + if (sc->floorz <= s->z) + { + sc->floorz = s->z; + KILLIT(i); + } + } + } + + t[2]++; + if (t[2] >= s->hitag) + { + t[2] = 0; + t[0] = 0; + } + } + break; + + case 19: //Battlestar galactia shields + + if (t[0]) + { + if (t[0] == 1) + { + t[0]++; + x = sc->wallptr; + q = x+sc->wallnum; + for (j=x;j= 0) + { + wall[wall[j].nextwall].overpicnum = 0; + wall[wall[j].nextwall].cstat &= (128+32+8+4+2); + } + } + } + + if (sc->ceilingz < sc->floorz) + sc->ceilingz += SP; + else + { + sc->ceilingz = sc->floorz; + + j = headspritestat[3]; + while (j >= 0) + { + 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 = + sector[q].floorpal; + sector[sprite[j].sectnum].floorshade = sector[sprite[j].sectnum].ceilingshade = + sector[q].floorshade; + + hittype[sprite[j].owner].temp_data[0] = 2; + } + j = nextspritestat[j]; + } + KILLIT(i); + } + } + else //Not hit yet + { + IFHITSECT + { + FTA(8,&ps[myconnectindex]); + + l = headspritestat[3]; + while (l >= 0) + { + x = sprite[l].lotag&0x7fff; + switch (x) + { + case 0: + if (sprite[l].hitag == sh) + { + q = sprite[l].sectnum; + sector[q].floorshade = + sector[q].ceilingshade = + sprite[sprite[l].owner].shade; + sector[q].floorpal = + sector[q].ceilingpal = + sprite[sprite[l].owner].pal; + } + break; + + case 1: + case 12: + // case 18: + case 19: + + 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; + } + + break; + } + l = nextspritestat[l]; + } + } + } + + break; + + case 20: //Extend-o-bridge + + if (t[0] == 0) break; + if (t[0] == 1) s->xvel = 8; + else s->xvel = -8; + + if (s->xvel) //Moving + { + x = (s->xvel*sintable[(s->ang+512)&2047])>>14; + l = (s->xvel*sintable[s->ang&2047])>>14; + + t[3] += s->xvel; + + s->x += x; + s->y += l; + + if (t[3] <= 0 || (t[3]>>6) >= (SP>>6)) + { + s->x -= x; + s->y -= l; + t[0] = 0; + callsound(s->sectnum,i); break; } - if (t[0]==-1) - { - if (sc->floorz > t[3]) - break; - } - else if (sc->ceilingz < t[4]) break; - - if (t[1] == 0) break; - t[1] = 0; - - j = headspritestat[3]; + j = headspritesect[s->sectnum]; while (j >= 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]; + nextj = nextspritesect[j]; + + 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) + makeitfall(j); + } + j = nextj; } - if (j == -1) break; + 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); - k = headspritesect[s->sectnum]; - while (k >= 0) - { - nextk = nextspritesect[k]; - - if (sprite[k].statnum == 10 && sprite[k].owner >= 0) + for (p=connecthead;p>=0;p=connectpoint2[p]) + if (ps[p].cursectnum == s->sectnum && ps[p].on_ground) { - p = sprite[k].yvel; + ps[p].posx += x; + ps[p].posy += l; - ps[p].posx += sprite[j].x-s->x; - ps[p].posy += sprite[j].y-s->y; - ps[p].posz = sector[sprite[j].sectnum].floorz-(sc->floorz-ps[p].posz); + ps[p].oposx = ps[p].posx; + ps[p].oposy = ps[p].posy; - hittype[k].floorz = sector[sprite[j].sectnum].floorz; - hittype[k].ceilingz = sector[sprite[j].sectnum].ceilingz; - - ps[p].bobposx = ps[p].oposx = ps[p].posx; - ps[p].bobposy = ps[p].oposy = ps[p].posy; - ps[p].oposz = ps[p].posz; - - ps[p].truefz = hittype[k].floorz; - ps[p].truecz = hittype[k].ceilingz; - ps[p].bobcounter = 0; - - changespritesect(k,sprite[j].sectnum); - ps[p].cursectnum = sprite[j].sectnum; + setsprite(ps[p].i,ps[p].posx,ps[p].posy,ps[p].posz+PHEIGHT); } - else if (sprite[k].statnum != 3) - { - sprite[k].x += - sprite[j].x-s->x; - sprite[k].y += - sprite[j].y-s->y; - sprite[k].z = sector[sprite[j].sectnum].floorz- - (sc->floorz-sprite[k].z); - hittype[k].bposx = sprite[k].x; - hittype[k].bposy = sprite[k].y; - hittype[k].bposz = sprite[k].z; + sc->floorxpanning-=x>>3; + sc->floorypanning-=l>>3; - changespritesect(k,sprite[j].sectnum); - setsprite(k,sprite[k].x,sprite[k].y,sprite[k].z); - - hittype[k].floorz = sector[sprite[j].sectnum].floorz; - hittype[k].ceilingz = sector[sprite[j].sectnum].ceilingz; - - } - k = nextk; - } + sc->ceilingxpanning-=x>>3; + sc->ceilingypanning-=l>>3; } - break; - case 18: - if (t[0]) - { - if (s->pal) - { - if (s->ang == 512) - { - sc->ceilingz -= sc->extra; - if (sc->ceilingz <= t[1]) - { - sc->ceilingz = t[1]; - KILLIT(i); - } - } - else - { - sc->floorz += sc->extra; - j = headspritesect[s->sectnum]; - while (j >= 0) - { - 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) - { - hittype[j].bposz = sprite[j].z += sc->extra; - hittype[j].floorz = sc->floorz; - } - j = nextspritesect[j]; - } - if (sc->floorz >= t[1]) - { - sc->floorz = t[1]; - KILLIT(i); - } - } - } + break; + + case 21: // Cascading effect + + if (t[0] == 0) break; + + if (s->ang == 1536) + l = (long) &sc->ceilingz; else - { - if (s->ang == 512) - { - sc->ceilingz += sc->extra; - if (sc->ceilingz >= s->z) - { - sc->ceilingz = s->z; - KILLIT(i); - } - } - else - { - sc->floorz -= sc->extra; - j = headspritesect[s->sectnum]; - while (j >= 0) - { - 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) - { - hittype[j].bposz = sprite[j].z -= sc->extra; - hittype[j].floorz = sc->floorz; - } - j = nextspritesect[j]; - } - if (sc->floorz <= s->z) - { - sc->floorz = s->z; - KILLIT(i); - } - } - } + l = (long) &sc->floorz; - t[2]++; - if (t[2] >= s->hitag) - { - t[2] = 0; - t[0] = 0; - } - } - break; - - case 19: //Battlestar galactia shields - - if (t[0]) - { - if (t[0] == 1) + 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]++; - x = sc->wallptr; - q = x+sc->wallnum; - for (j=x;j= 0) - { - wall[wall[j].nextwall].overpicnum = 0; - wall[wall[j].nextwall].cstat &= (128+32+8+4+2); - } - } } - if (sc->ceilingz < sc->floorz) - sc->ceilingz += SP; - else + if (sc->extra == 0) { - sc->ceilingz = sc->floorz; + *(long *)l += s->zvel; - j = headspritestat[3]; - while (j >= 0) + if (klabs(*(long *)l-s->z) < 1024) { - 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 = - sector[q].floorpal; - sector[sprite[j].sectnum].floorshade = sector[sprite[j].sectnum].ceilingshade = - sector[q].floorshade; - - hittype[sprite[j].owner].temp_data[0] = 2; - } - j = nextspritestat[j]; - } - KILLIT(i); - } - } - else //Not hit yet - { - IFHITSECT - { - FTA(8,&ps[myconnectindex]); - - l = headspritestat[3]; - while (l >= 0) - { - x = sprite[l].lotag&0x7fff; - switch (x) - { - case 0: - if (sprite[l].hitag == sh) - { - q = sprite[l].sectnum; - sector[q].floorshade = - sector[q].ceilingshade = - sprite[sprite[l].owner].shade; - sector[q].floorpal = - sector[q].ceilingpal = - sprite[sprite[l].owner].pal; - } - break; - - case 1: - case 12: - // case 18: - case 19: - - 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; - } - - break; - } - l = nextspritestat[l]; + *(long *)l = s->z; + KILLIT(i); //All done } } - } + else sc->extra--; + break; - break; + case 22: - case 20: //Extend-o-bridge - - if (t[0] == 0) break; - if (t[0] == 1) s->xvel = 8; - else s->xvel = -8; - - if (s->xvel) //Moving - { - x = (s->xvel*sintable[(s->ang+512)&2047])>>14; - l = (s->xvel*sintable[s->ang&2047])>>14; - - t[3] += s->xvel; - - s->x += x; - s->y += l; - - if (t[3] <= 0 || (t[3]>>6) >= (SP>>6)) + if (t[1]) { - s->x -= x; - s->y -= l; - t[0] = 0; - callsound(s->sectnum,i); - break; + if (getanimationgoal(§or[t[0]].ceilingz) >= 0) + sc->ceilingz += sc->extra*9; + else t[1] = 0; } + break; + + case 24: + case 34: + + if (t[4]) break; + + x = (SP*sintable[(s->ang+512)&2047])>>18; + l = (SP*sintable[s->ang&2047])>>18; + + k = 0; j = headspritesect[s->sectnum]; while (j >= 0) { nextj = nextspritesect[j]; + if (sprite[j].zvel >= 0) + switch (sprite[j].statnum) + { + case 5: + switch (dynamictostatic[sprite[j].picnum]) + { + case BLOODPOOL__STATIC: + case PUKE__STATIC: + case FOOTPRINTS__STATIC: + case FOOTPRINTS2__STATIC: + case FOOTPRINTS3__STATIC: + case FOOTPRINTS4__STATIC: + case BULLETHOLE__STATIC: + case BLOODSPLAT1__STATIC: + case BLOODSPLAT2__STATIC: + case BLOODSPLAT3__STATIC: + case BLOODSPLAT4__STATIC: + sprite[j].xrepeat = sprite[j].yrepeat = 0; + j = nextj; + continue; + case LASERLINE__STATIC: + j = nextj; + continue; + } + case 6: + if (sprite[j].picnum == TRIPBOMB) break; + case 1: + case 0: + if ( + sprite[j].picnum == BOLT1 || + sprite[j].picnum == BOLT1+1 || + sprite[j].picnum == BOLT1+2 || + sprite[j].picnum == BOLT1+3 || + sprite[j].picnum == SIDEBOLT1 || + sprite[j].picnum == SIDEBOLT1+1 || + sprite[j].picnum == SIDEBOLT1+2 || + sprite[j].picnum == SIDEBOLT1+3 || + wallswitchcheck(j) + ) + break; - if (sprite[j].statnum != 3 && sprite[j].zvel == 0) + if (!(sprite[j].picnum >= CRANE && sprite[j].picnum <= (CRANE+3))) + { + if (sprite[j].z > (hittype[j].floorz-(16<<8))) + { + hittype[j].bposx = sprite[j].x; + hittype[j].bposy = sprite[j].y; + + sprite[j].x += x>>2; + sprite[j].y += l>>2; + + setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z); + + if (sector[sprite[j].sectnum].floorstat&2) + if (sprite[j].statnum == 2) + makeitfall(j); + } + } + break; + } + j = nextj; + } + + p = myconnectindex; + if (ps[p].cursectnum == s->sectnum && ps[p].on_ground) + if (klabs(ps[p].posz-ps[p].truefz) < PHEIGHT+(9<<8)) { - sprite[j].x += x; - sprite[j].y += l; + fricxv += x<<3; + fricyv += l<<3; + } + + sc->floorxpanning += SP>>7; + + break; + + case 35: + 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)) + spawn(i,EXPLOSION2); + } + + switch (t[0]) + { + case 0: + sc->ceilingz += s->yvel; + if (sc->ceilingz > sc->floorz) + sc->floorz = sc->ceilingz; + if (sc->ceilingz > s->z+(32<<8)) + t[0]++; + break; + case 1: + sc->ceilingz-=(s->yvel<<2); + if (sc->ceilingz < t[4]) + { + sc->ceilingz = t[4]; + t[0] = 0; + } + break; + } + break; + + case 25: //PISTONS + + if (t[4] == 0) break; + + if (sc->floorz <= sc->ceilingz) + s->shade = 0; + else if (sc->ceilingz <= t[3]) + s->shade = 1; + + if (s->shade) + { + sc->ceilingz += SP<<4; + if (sc->ceilingz > sc->floorz) + sc->ceilingz = sc->floorz; + } + else + { + sc->ceilingz -= SP<<4; + if (sc->ceilingz < t[3]) + sc->ceilingz = t[3]; + } + + break; + + case 26: + + s->xvel = 32; + l = (s->xvel*sintable[(s->ang+512)&2047])>>14; + x = (s->xvel*sintable[s->ang&2047])>>14; + + s->shade++; + if (s->shade > 7) + { + s->x = t[3]; + s->y = t[4]; + sc->floorz -= ((s->zvel*s->shade)-s->zvel); + s->shade = 0; + } + else + sc->floorz += s->zvel; + + j = headspritesect[s->sectnum]; + while (j >= 0) + { + nextj = nextspritesect[j]; + if (sprite[j].statnum != 3 && sprite[j].statnum != 10) + { + hittype[j].bposx = sprite[j].x; + hittype[j].bposy = sprite[j].y; + + sprite[j].x += l; + sprite[j].y += x; + + sprite[j].z += s->zvel; setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z); - if (sector[sprite[j].sectnum].floorstat&2) - if (sprite[j].statnum == 2) - makeitfall(j); } j = nextj; } - 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); + p = myconnectindex; + 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 (ps[p].cursectnum == 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); + setsprite(i,s->x,s->y,s->z); + + break; + + + case 27: + + 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 (t[0] < 0) { - ps[p].posx += x; - ps[p].posy += l; + ud.camerasprite = i; + t[0]++; + } + 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 (x < (long)((unsigned)sh)) + { + ud.camerasprite = i; + t[0] = 999; + s->ang += getincangle(s->ang,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>3; + SP = 100+((s->z-ps[p].posz)/257); - ps[p].oposx = ps[p].posx; - ps[p].oposy = ps[p].posy; + } + else if (t[0] == 999) + { + if (ud.camerasprite == i) + t[0] = 0; + else t[0] = -10; + ud.camerasprite = i; - setsprite(ps[p].i,ps[p].posx,ps[p].posy,ps[p].posz+PHEIGHT); + } + } + else + { + s->ang = getangle(ps[p].posx-s->x,ps[p].posy-s->y); + + if (t[0] == 999) + { + if (ud.camerasprite == i) + t[0] = 0; + else t[0] = -20; + ud.camerasprite = i; + } + } + } + } + break; + case 28: + if (t[5] > 0) + { + t[5]--; + break; + } + + if (T1 == 0) + { + p = findplayer(s,&x); + if (x > 15500) + break; + T1 = 1; + T2 = 64 + (TRAND&511); + T3 = 0; + } + else + { + T3++; + if (T3 > T2) + { + T1 = 0; + ps[screenpeek].visibility = ud.const_visibility; + break; + } + else if (T3 == (T2>>1)) + spritesound(THUNDER,i); + else if (T3 == (T2>>3)) + spritesound(LIGHTNING_SLAP,i); + else if (T3 == (T2>>2)) + { + j = headspritestat[0]; + while (j >= 0) + { + 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)) + { + 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 (j) + ps[screenpeek].visibility = 0; + } + else if (j) + ps[screenpeek].visibility = ud.const_visibility; + + j = headspritestat[0]; + while (j >= 0) + { + if (sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag) + { + if (rnd(32) && (T3&1)) + { + sprite[j].cstat &= 32767; + spawn(j,SMALLSMOKE); + + p = findplayer(s,&x); + x = ldist(&sprite[ps[p].i], &sprite[j]); + if (x < 768) + { + 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); + ps[p].pals_time = 32; + ps[p].pals[0] = 16; + ps[p].pals[1] = 0; + ps[p].pals[2] = 0; + } + break; + } + else sprite[j].cstat |= 32768; + } + + j = nextspritestat[j]; + } + } + } + break; + case 29: + s->hitag += 64; + l = mulscale12((long)s->yvel,sintable[s->hitag&2047]); + sc->floorz = s->z + l; + break; + case 31: // True Drop Floor + if (t[0] == 1) + { + // Choose dir + + if (t[3] > 0) + { + t[3]--; + break; } - sc->floorxpanning-=x>>3; - sc->floorypanning-=l>>3; - - sc->ceilingxpanning-=x>>3; - sc->ceilingypanning-=l>>3; - } - - break; - - case 21: // Cascading effect - - if (t[0] == 0) break; - - 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 - { - s->zvel = ksgn(s->z-*(long *)l) * (SP<<4); - t[0]++; - } - - if (sc->extra == 0) - { - *(long *)l += s->zvel; - - if (klabs(*(long *)l-s->z) < 1024) - { - *(long *)l = s->z; - KILLIT(i); //All done - } - } - else sc->extra--; - break; - - case 22: - - if (t[1]) - { - if (getanimationgoal(§or[t[0]].ceilingz) >= 0) - sc->ceilingz += sc->extra*9; - else t[1] = 0; - } - break; - - case 24: - case 34: - - if (t[4]) break; - - x = (SP*sintable[(s->ang+512)&2047])>>18; - l = (SP*sintable[s->ang&2047])>>18; - - k = 0; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - nextj = nextspritesect[j]; - if (sprite[j].zvel >= 0) - switch (sprite[j].statnum) + if (t[2] == 1) // Retract { - case 5: - switch (dynamictostatic[sprite[j].picnum]) + if (SA != 1536) { - case BLOODPOOL__STATIC: - case PUKE__STATIC: - case FOOTPRINTS__STATIC: - case FOOTPRINTS2__STATIC: - case FOOTPRINTS3__STATIC: - case FOOTPRINTS4__STATIC: - case BULLETHOLE__STATIC: - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: - sprite[j].xrepeat = sprite[j].yrepeat = 0; - j = nextj; - continue; - case LASERLINE__STATIC: - j = nextj; - continue; - } - case 6: - if (sprite[j].picnum == TRIPBOMB) break; - case 1: - case 0: - if ( - sprite[j].picnum == BOLT1 || - sprite[j].picnum == BOLT1+1 || - sprite[j].picnum == BOLT1+2 || - sprite[j].picnum == BOLT1+3 || - sprite[j].picnum == SIDEBOLT1 || - sprite[j].picnum == SIDEBOLT1+1 || - sprite[j].picnum == SIDEBOLT1+2 || - sprite[j].picnum == SIDEBOLT1+3 || - wallswitchcheck(j) - ) - break; - - if (!(sprite[j].picnum >= CRANE && sprite[j].picnum <= (CRANE+3))) - { - if (sprite[j].z > (hittype[j].floorz-(16<<8))) + if (klabs(sc->floorz - s->z) < SP) { - hittype[j].bposx = sprite[j].x; - hittype[j].bposy = sprite[j].y; + sc->floorz = s->z; + t[2] = 0; + t[0] = 0; + t[3] = s->hitag; + callsound(s->sectnum,i); + } + else + { + l = ksgn(s->z-sc->floorz)*SP; + sc->floorz += l; - sprite[j].x += x>>2; - sprite[j].y += l>>2; + j = headspritesect[s->sectnum]; + while (j >= 0) + { + 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) + { + hittype[j].bposz = sprite[j].z += l; + hittype[j].floorz = sc->floorz; + } + j = nextspritesect[j]; + } + } + } + else + { + if (klabs(sc->floorz - t[1]) < SP) + { + sc->floorz = t[1]; + callsound(s->sectnum,i); + t[2] = 0; + t[0] = 0; + t[3] = s->hitag; + } + else + { + l = ksgn(t[1]-sc->floorz)*SP; + sc->floorz += l; - setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z); - - if (sector[sprite[j].sectnum].floorstat&2) - if (sprite[j].statnum == 2) - makeitfall(j); + j = headspritesect[s->sectnum]; + while (j >= 0) + { + 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) + { + hittype[j].bposz = sprite[j].z += l; + hittype[j].floorz = sc->floorz; + } + j = nextspritesect[j]; + } } } break; } - j = nextj; - } - p = myconnectindex; - 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; - } - - sc->floorxpanning += SP>>7; - - break; - - case 35: - 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)) - spawn(i,EXPLOSION2); - } - - switch (t[0]) - { - case 0: - sc->ceilingz += s->yvel; - if (sc->ceilingz > sc->floorz) - sc->floorz = sc->ceilingz; - if (sc->ceilingz > s->z+(32<<8)) - t[0]++; - break; - case 1: - sc->ceilingz-=(s->yvel<<2); - if (sc->ceilingz < t[4]) - { - sc->ceilingz = t[4]; - t[0] = 0; - } - break; - } - break; - - case 25: //PISTONS - - if (t[4] == 0) break; - - if (sc->floorz <= sc->ceilingz) - s->shade = 0; - else if (sc->ceilingz <= t[3]) - s->shade = 1; - - if (s->shade) - { - sc->ceilingz += SP<<4; - if (sc->ceilingz > sc->floorz) - sc->ceilingz = sc->floorz; - } - else - { - sc->ceilingz -= SP<<4; - if (sc->ceilingz < t[3]) - sc->ceilingz = t[3]; - } - - break; - - case 26: - - s->xvel = 32; - l = (s->xvel*sintable[(s->ang+512)&2047])>>14; - x = (s->xvel*sintable[s->ang&2047])>>14; - - s->shade++; - if (s->shade > 7) - { - s->x = t[3]; - s->y = t[4]; - sc->floorz -= ((s->zvel*s->shade)-s->zvel); - s->shade = 0; - } - else - sc->floorz += s->zvel; - - j = headspritesect[s->sectnum]; - while (j >= 0) - { - nextj = nextspritesect[j]; - if (sprite[j].statnum != 3 && sprite[j].statnum != 10) - { - hittype[j].bposx = sprite[j].x; - hittype[j].bposy = sprite[j].y; - - sprite[j].x += l; - sprite[j].y += x; - - sprite[j].z += s->zvel; - setsprite(j,sprite[j].x,sprite[j].y,sprite[j].z); - } - j = nextj; - } - - p = myconnectindex; - 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) - ps[p].posz += s->zvel; - - ms(i); - setsprite(i,s->x,s->y,s->z); - - break; - - - case 27: - - 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 (t[0] < 0) - { - ud.camerasprite = i; - t[0]++; - } - 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 ((s->ang&2047) == 1536) { - if (x < (long)((unsigned)sh)) + if (klabs(s->z-sc->floorz) < SP) { - ud.camerasprite = i; - t[0] = 999; - s->ang += getincangle(s->ang,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>3; - SP = 100+((s->z-ps[p].posz)/257); - - } - else if (t[0] == 999) - { - if (ud.camerasprite == i) - t[0] = 0; - else t[0] = -10; - ud.camerasprite = i; - - } - } - else - { - s->ang = getangle(ps[p].posx-s->x,ps[p].posy-s->y); - - if (t[0] == 999) - { - if (ud.camerasprite == i) - t[0] = 0; - else t[0] = -20; - ud.camerasprite = i; - } - } - } - } - break; - case 28: - if (t[5] > 0) - { - t[5]--; - break; - } - - if (T1 == 0) - { - p = findplayer(s,&x); - if (x > 15500) - break; - T1 = 1; - T2 = 64 + (TRAND&511); - T3 = 0; - } - else - { - T3++; - if (T3 > T2) - { - T1 = 0; - ps[screenpeek].visibility = ud.const_visibility; - break; - } - else if (T3 == (T2>>1)) - spritesound(THUNDER,i); - else if (T3 == (T2>>3)) - spritesound(LIGHTNING_SLAP,i); - else if (T3 == (T2>>2)) - { - j = headspritestat[0]; - while (j >= 0) - { - 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)) - { - 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 (j) - ps[screenpeek].visibility = 0; - } - else if (j) - ps[screenpeek].visibility = ud.const_visibility; - - j = headspritestat[0]; - while (j >= 0) - { - if (sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag) - { - if (rnd(32) && (T3&1)) - { - sprite[j].cstat &= 32767; - spawn(j,SMALLSMOKE); - - p = findplayer(s,&x); - x = ldist(&sprite[ps[p].i], &sprite[j]); - if (x < 768) - { - 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); - ps[p].pals_time = 32; - ps[p].pals[0] = 16; - ps[p].pals[1] = 0; - ps[p].pals[2] = 0; - } - break; - } - else sprite[j].cstat |= 32768; - } - - j = nextspritestat[j]; - } - } - } - break; - case 29: - s->hitag += 64; - l = mulscale12((long)s->yvel,sintable[s->hitag&2047]); - sc->floorz = s->z + l; - break; - case 31: // True Drop Floor - if (t[0] == 1) - { - // Choose dir - - if (t[3] > 0) - { - t[3]--; - break; - } - - if (t[2] == 1) // Retract - { - if (SA != 1536) - { - if (klabs(sc->floorz - s->z) < SP) - { - sc->floorz = s->z; - t[2] = 0; - t[0] = 0; - t[3] = s->hitag; callsound(s->sectnum,i); + t[0] = 0; + t[2] = 1; + t[3] = s->hitag; } else { @@ -7316,238 +7458,182 @@ 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); - t[2] = 0; t[0] = 0; + callsound(s->sectnum,i); + t[2] = 1; t[3] = s->hitag; } else { - l = ksgn(t[1]-sc->floorz)*SP; - sc->floorz += l; + l = ksgn(s->z-t[1])*SP; + sc->floorz -= l; j = headspritesect[s->sectnum]; while (j >= 0) { if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) if (ps[sprite[j].yvel].on_ground == 1) - ps[sprite[j].yvel].posz += l; + ps[sprite[j].yvel].posz -= l; if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { - hittype[j].bposz = sprite[j].z += l; + hittype[j].bposz = sprite[j].z -= l; hittype[j].floorz = sc->floorz; } j = nextspritesect[j]; } } } - break; } + break; - if ((s->ang&2047) == 1536) + case 32: // True Drop Ceiling + if (t[0] == 1) { - if (klabs(s->z-sc->floorz) < SP) - { - callsound(s->sectnum,i); - t[0] = 0; - t[2] = 1; - t[3] = s->hitag; - } - else - { - l = ksgn(s->z-sc->floorz)*SP; - sc->floorz += l; + // Choose dir - j = headspritesect[s->sectnum]; - while (j >= 0) + if (t[2] == 1) // Retract + { + if (SA != 1536) { - 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 (klabs(sc->ceilingz - s->z) < + (SP<<1)) { - hittype[j].bposz = sprite[j].z += l; - hittype[j].floorz = sc->floorz; + sc->ceilingz = s->z; + callsound(s->sectnum,i); + t[2] = 0; + t[0] = 0; } - j = nextspritesect[j]; + else sc->ceilingz += + ksgn(s->z-sc->ceilingz)*SP; } - } - } - else - { - if (klabs(sc->floorz-t[1]) < SP) - { - t[0] = 0; - callsound(s->sectnum,i); - t[2] = 1; - t[3] = s->hitag; - } - else - { - l = ksgn(s->z-t[1])*SP; - sc->floorz -= l; - - j = headspritesect[s->sectnum]; - while (j >= 0) + else { - 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 (klabs(sc->ceilingz - t[1]) < + (SP<<1)) { - hittype[j].bposz = sprite[j].z -= l; - hittype[j].floorz = sc->floorz; + sc->ceilingz = t[1]; + callsound(s->sectnum,i); + t[2] = 0; + t[0] = 0; } - j = nextspritesect[j]; + else sc->ceilingz += + ksgn(t[1]-sc->ceilingz)*SP; } + break; } - } - } - break; - case 32: // True Drop Ceiling - if (t[0] == 1) - { - // Choose dir - - if (t[2] == 1) // Retract - { - if (SA != 1536) + if ((s->ang&2047) == 1536) { - if (klabs(sc->ceilingz - s->z) < + if (klabs(sc->ceilingz-s->z) < (SP<<1)) { - sc->ceilingz = s->z; - callsound(s->sectnum,i); - t[2] = 0; t[0] = 0; + t[2] = !t[2]; + callsound(s->sectnum,i); + sc->ceilingz = s->z; } else sc->ceilingz += ksgn(s->z-sc->ceilingz)*SP; } else { - if (klabs(sc->ceilingz - t[1]) < - (SP<<1)) + if (klabs(sc->ceilingz-t[1]) < (SP<<1)) { - sc->ceilingz = t[1]; - callsound(s->sectnum,i); - t[2] = 0; t[0] = 0; + t[2] = !t[2]; + callsound(s->sectnum,i); } - else sc->ceilingz += - ksgn(t[1]-sc->ceilingz)*SP; + else sc->ceilingz -= ksgn(s->z-t[1])*SP; } - break; } + break; - if ((s->ang&2047) == 1536) + case 33: + if (earthquaketime > 0 && (TRAND&7) == 0) + RANDOMSCRAP; + break; + case 36: + + if (t[0]) { - if (klabs(sc->ceilingz-s->z) < - (SP<<1)) - { + if (t[0] == 1) + shoot(i,sc->extra); + else if (t[0] == 26*5) t[0] = 0; - t[2] = !t[2]; - callsound(s->sectnum,i); - sc->ceilingz = s->z; - } - else sc->ceilingz += - ksgn(s->z-sc->ceilingz)*SP; + t[0]++; } + break; + + case 128: //SE to control glass breakage + + wal = &wall[t[2]]; + + if (wal->cstat|32) + { + wal->cstat &= (255-32); + wal->cstat |= 16; + if (wal->nextwall >= 0) + { + wall[wal->nextwall].cstat &= (255-32); + wall[wal->nextwall].cstat |= 16; + } + } + else break; + + wal->overpicnum++; + if (wal->nextwall >= 0) + wall[wal->nextwall].overpicnum++; + + if (t[0] < t[1]) t[0]++; else { - if (klabs(sc->ceilingz-t[1]) < (SP<<1)) - { - t[0] = 0; - t[2] = !t[2]; - callsound(s->sectnum,i); - } - else sc->ceilingz -= ksgn(s->z-t[1])*SP; + wal->cstat &= (128+32+8+4+2); + if (wal->nextwall >= 0) + wall[wal->nextwall].cstat &= (128+32+8+4+2); + KILLIT(i); } - } - break; + break; - case 33: - if (earthquaketime > 0 && (TRAND&7) == 0) - RANDOMSCRAP; - break; - case 36: - - if (t[0]) - { - if (t[0] == 1) - shoot(i,sc->extra); - else if (t[0] == 26*5) - t[0] = 0; - t[0]++; - } - break; - - case 128: //SE to control glass breakage - - wal = &wall[t[2]]; - - if (wal->cstat|32) - { - wal->cstat &= (255-32); - wal->cstat |= 16; - if (wal->nextwall >= 0) + case 130: + if (t[0] > 80) { - wall[wal->nextwall].cstat &= (255-32); - wall[wal->nextwall].cstat |= 16; + KILLIT(i); } - } - else break; + else t[0]++; - wal->overpicnum++; - if (wal->nextwall >= 0) - wall[wal->nextwall].overpicnum++; + x = sc->floorz-sc->ceilingz; - if (t[0] < t[1]) t[0]++; - else - { - wal->cstat &= (128+32+8+4+2); - if (wal->nextwall >= 0) - wall[wal->nextwall].cstat &= (128+32+8+4+2); - KILLIT(i); - } - break; + if (rnd(64)) + { + k = spawn(i,EXPLOSION2); + sprite[k].xrepeat = sprite[k].yrepeat = 2+(TRAND&7); + sprite[k].z = sc->floorz-(TRAND%x); + sprite[k].ang += 256-(TRAND%511); + sprite[k].xvel = TRAND&127; + ssp(k,CLIPMASK0); + } + break; + case 131: + if (t[0] > 40) + { + KILLIT(i); + } + else t[0]++; - case 130: - if (t[0] > 80) { KILLIT(i); } - else t[0]++; + x = sc->floorz-sc->ceilingz; - x = sc->floorz-sc->ceilingz; - - if (rnd(64)) - { - k = spawn(i,EXPLOSION2); - sprite[k].xrepeat = sprite[k].yrepeat = 2+(TRAND&7); - sprite[k].z = sc->floorz-(TRAND%x); - sprite[k].ang += 256-(TRAND%511); - sprite[k].xvel = TRAND&127; - ssp(k,CLIPMASK0); - } - break; - case 131: - if (t[0] > 40) { KILLIT(i); } - else t[0]++; - - x = sc->floorz-sc->ceilingz; - - if (rnd(32)) - { - k = spawn(i,EXPLOSION2); - sprite[k].xrepeat = sprite[k].yrepeat = 2+(TRAND&3); - sprite[k].z = sc->floorz-(TRAND%x); - sprite[k].ang += 256-(TRAND%511); - sprite[k].xvel = TRAND&127; - ssp(k,CLIPMASK0); - } - break; + if (rnd(32)) + { + k = spawn(i,EXPLOSION2); + sprite[k].xrepeat = sprite[k].yrepeat = 2+(TRAND&3); + sprite[k].z = sc->floorz-(TRAND%x); + sprite[k].ang += 256-(TRAND%511); + sprite[k].xvel = TRAND&127; + ssp(k,CLIPMASK0); + } + break; } BOLT: i = nexti; diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c index ce4c7ed93..606a8888f 100644 --- a/polymer/eduke32/source/anim.c +++ b/polymer/eduke32/source/anim.c @@ -27,64 +27,64 @@ void endanimsounds(long fr) { switch (ud.volume_number) { - case 0: - break; - case 1: - switch (fr) - { + case 0: + break; case 1: - sound(WIND_AMBIENCE); + switch (fr) + { + case 1: + sound(WIND_AMBIENCE); + break; + case 26: + sound(ENDSEQVOL2SND1); + break; + case 36: + sound(ENDSEQVOL2SND2); + break; + case 54: + sound(THUD); + break; + case 62: + sound(ENDSEQVOL2SND3); + break; + case 75: + sound(ENDSEQVOL2SND4); + break; + case 81: + sound(ENDSEQVOL2SND5); + break; + case 115: + sound(ENDSEQVOL2SND6); + break; + case 124: + sound(ENDSEQVOL2SND7); + break; + } break; - case 26: - sound(ENDSEQVOL2SND1); + case 2: + switch (fr) + { + case 1: + sound(WIND_REPEAT); + break; + case 98: + sound(DUKE_GRUNT); + break; + case 82+20: + sound(THUD); + sound(SQUISHED); + break; + case 104+20: + sound(ENDSEQVOL3SND3); + break; + case 114+20: + sound(ENDSEQVOL3SND2); + break; + case 158: + sound(PIPEBOMB_EXPLODE); + break; + } break; - case 36: - sound(ENDSEQVOL2SND2); - break; - case 54: - sound(THUD); - break; - case 62: - sound(ENDSEQVOL2SND3); - break; - case 75: - sound(ENDSEQVOL2SND4); - break; - case 81: - sound(ENDSEQVOL2SND5); - break; - case 115: - sound(ENDSEQVOL2SND6); - break; - case 124: - sound(ENDSEQVOL2SND7); - break; - } - break; - case 2: - switch (fr) - { - case 1: - sound(WIND_REPEAT); - break; - case 98: - sound(DUKE_GRUNT); - break; - case 82+20: - sound(THUD); - sound(SQUISHED); - break; - case 104+20: - sound(ENDSEQVOL3SND3); - break; - case 114+20: - sound(ENDSEQVOL3SND2); - break; - case 158: - sound(PIPEBOMB_EXPLODE); - break; - } - break; } } @@ -92,12 +92,12 @@ void logoanimsounds(long fr) { switch (fr) { - case 1: - sound(FLY_BY); - break; - case 19: - sound(PIPEBOMB_EXPLODE); - break; + case 1: + sound(FLY_BY); + break; + case 19: + sound(PIPEBOMB_EXPLODE); + break; } } @@ -105,16 +105,16 @@ void intro4animsounds(long fr) { switch (fr) { - case 1: - sound(INTRO4_B); - break; - case 12: - case 34: - sound(SHORT_CIRCUIT); - break; - case 18: - sound(INTRO4_5); - break; + case 1: + sound(INTRO4_B); + break; + case 12: + case 34: + sound(SHORT_CIRCUIT); + break; + case 18: + sound(INTRO4_5); + break; } } @@ -122,18 +122,18 @@ void first4animsounds(long fr) { switch (fr) { - case 1: - sound(INTRO4_1); - break; - case 12: - sound(INTRO4_2); - break; - case 7: - sound(INTRO4_3); - break; - case 26: - sound(INTRO4_4); - break; + case 1: + sound(INTRO4_1); + break; + case 12: + sound(INTRO4_2); + break; + case 7: + sound(INTRO4_3); + break; + case 26: + sound(INTRO4_4); + break; } } @@ -141,9 +141,9 @@ void intro42animsounds(long fr) { switch (fr) { - case 10: - sound(INTRO4_6); - break; + case 10: + sound(INTRO4_6); + break; } } @@ -151,12 +151,12 @@ void endanimvol41(long fr) { switch (fr) { - case 3: - sound(DUKE_UNDERWATER); - break; - case 35: - sound(VOL4ENDSND1); - break; + case 3: + sound(DUKE_UNDERWATER); + break; + case 35: + sound(VOL4ENDSND1); + break; } } @@ -164,18 +164,18 @@ void endanimvol42(long fr) { switch (fr) { - case 11: - sound(DUKE_UNDERWATER); - break; - case 20: - sound(VOL4ENDSND1); - break; - case 39: - sound(VOL4ENDSND2); - break; - case 50: - FX_StopAllSounds(); - break; + case 11: + sound(DUKE_UNDERWATER); + break; + case 20: + sound(VOL4ENDSND1); + break; + case 39: + sound(VOL4ENDSND2); + break; + case 50: + FX_StopAllSounds(); + break; } } @@ -183,16 +183,16 @@ void endanimvol43(long fr) { switch (fr) { - case 1: - sound(BOSS4_DEADSPEECH); - break; - case 40: - sound(VOL4ENDSND1); - sound(DUKE_UNDERWATER); - break; - case 50: - sound(BIGBANG); - break; + case 1: + sound(BOSS4_DEADSPEECH); + break; + case 40: + sound(VOL4ENDSND1); + sound(DUKE_UNDERWATER); + break; + case 50: + sound(BIGBANG); + break; } } @@ -259,7 +259,8 @@ void playanm(char *fn,char t) extern char restorepalette; if (KB_KeyWaiting()) goto ENDOFANIMLOOP; - handleevents(); getpackets(); + handleevents(); + getpackets(); if (restorepalette == 1) setgamepalette(&ps[myconnectindex],tempbuf,2); } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index dde46b79c..51135e086 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -197,12 +197,15 @@ void ExtLoadMap(const char *mapname) if (sprite[j].picnum>=20 && sprite[j].picnum<=59) { - if (sprite[j].picnum==26) { - sprite[j].xrepeat = 8; sprite[j].yrepeat = 8; + if (sprite[j].picnum==26) + { + sprite[j].xrepeat = 8; + sprite[j].yrepeat = 8; } else { - sprite[j].xrepeat = 32; sprite[j].yrepeat = 32; + sprite[j].xrepeat = 32; + sprite[j].yrepeat = 32; } } @@ -216,31 +219,43 @@ void ExtLoadMap(const char *mapname) { switch (sector[i].ceilingpicnum) { - case MOONSKY1 : - case BIGORBIT1 : // orbit - case LA : // la city - sky=sector[i].ceilingpicnum; - break; + case MOONSKY1 : + case BIGORBIT1 : // orbit + case LA : // la city + sky=sector[i].ceilingpicnum; + break; } } switch (sky) { - case MOONSKY1 : - // earth mountian mountain sun - pskyoff[6]=1; pskyoff[1]=2; pskyoff[4]=2; pskyoff[2]=3; - break; + case MOONSKY1 : + // earth mountian mountain sun + pskyoff[6]=1; + pskyoff[1]=2; + pskyoff[4]=2; + pskyoff[2]=3; + break; - case BIGORBIT1 : // orbit - // earth1 2 3 moon/sun - pskyoff[5]=1; pskyoff[6]=2; pskyoff[7]=3; pskyoff[2]=4; - break; + case BIGORBIT1 : // orbit + // earth1 2 3 moon/sun + pskyoff[5]=1; + pskyoff[6]=2; + pskyoff[7]=3; + pskyoff[2]=4; + break; - case LA : // la city - // earth1 2 3 moon/sun - pskyoff[0]=1; pskyoff[1]=2; pskyoff[2]=1; pskyoff[3]=3; - pskyoff[4]=4; pskyoff[5]=0; pskyoff[6]=2; pskyoff[7]=3; - break; + case LA : // la city + // earth1 2 3 moon/sun + pskyoff[0]=1; + pskyoff[1]=2; + pskyoff[2]=1; + pskyoff[3]=3; + pskyoff[4]=4; + pskyoff[5]=0; + pskyoff[6]=2; + pskyoff[7]=3; + break; } pskybits=3; @@ -270,50 +285,72 @@ const char *ExtGetSectorCaption(short sectnum) { switch (sector[sectnum].lotag) { - case 1 : - Bsprintf(lo,"1 WATER (SE 7)"); break; - case 2 : - Bsprintf(lo,"2 UNDERWATER (SE 7)"); break; - case 9 : - Bsprintf(lo,"9 STAR TREK DOORS"); break; - case 15 : - Bsprintf(lo,"15 ELEVATOR TRANSPORT (SE 17)"); break; - case 16 : - Bsprintf(lo,"16 ELEVATOR PLATFORM DOWN"); break; - case 17 : - Bsprintf(lo,"17 ELEVATOR PLATFORM UP"); break; - case 18 : - Bsprintf(lo,"18 ELEVATOR DOWN"); break; - case 19 : - Bsprintf(lo,"19 ELEVATOR UP"); break; - case 20 : - Bsprintf(lo,"20 CEILING DOOR"); break; - case 21 : - Bsprintf(lo,"21 FLOOR DOOR"); break; - case 22 : - Bsprintf(lo,"22 SPLIT DOOR"); break; - case 23 : - Bsprintf(lo,"23 SWING DOOR (SE 11)"); break; - case 25 : - Bsprintf(lo,"25 SLIDE DOOR (SE 15)"); break; - case 26 : - Bsprintf(lo,"26 SPLIT STAR TREK DOOR"); break; - case 27 : - Bsprintf(lo,"27 BRIDGE (SE 20)"); break; - case 28 : - Bsprintf(lo,"28 DROP FLOOR (SE 21)"); break; - case 29 : - Bsprintf(lo,"29 TEETH DOOR (SE 22)"); break; - case 30 : - Bsprintf(lo,"30 ROTATE RISE BRIDGE"); break; - case 31 : - Bsprintf(lo,"31 2 WAY TRAIN (SE=30)"); break; - case 32767 : - Bsprintf(lo,"32767 SECRET ROOM"); break; - case 65535 : - Bsprintf(lo,"65535 END OF LEVEL"); break; - default : - Bsprintf(lo,"%hu",sector[sectnum].lotag); break; + case 1 : + Bsprintf(lo,"1 WATER (SE 7)"); + break; + case 2 : + Bsprintf(lo,"2 UNDERWATER (SE 7)"); + break; + case 9 : + Bsprintf(lo,"9 STAR TREK DOORS"); + break; + case 15 : + Bsprintf(lo,"15 ELEVATOR TRANSPORT (SE 17)"); + break; + case 16 : + Bsprintf(lo,"16 ELEVATOR PLATFORM DOWN"); + break; + case 17 : + Bsprintf(lo,"17 ELEVATOR PLATFORM UP"); + break; + case 18 : + Bsprintf(lo,"18 ELEVATOR DOWN"); + break; + case 19 : + Bsprintf(lo,"19 ELEVATOR UP"); + break; + case 20 : + Bsprintf(lo,"20 CEILING DOOR"); + break; + case 21 : + Bsprintf(lo,"21 FLOOR DOOR"); + break; + case 22 : + Bsprintf(lo,"22 SPLIT DOOR"); + break; + case 23 : + Bsprintf(lo,"23 SWING DOOR (SE 11)"); + break; + case 25 : + Bsprintf(lo,"25 SLIDE DOOR (SE 15)"); + break; + case 26 : + Bsprintf(lo,"26 SPLIT STAR TREK DOOR"); + break; + case 27 : + Bsprintf(lo,"27 BRIDGE (SE 20)"); + break; + case 28 : + Bsprintf(lo,"28 DROP FLOOR (SE 21)"); + break; + case 29 : + Bsprintf(lo,"29 TEETH DOOR (SE 22)"); + break; + case 30 : + Bsprintf(lo,"30 ROTATE RISE BRIDGE"); + break; + case 31 : + Bsprintf(lo,"31 2 WAY TRAIN (SE=30)"); + break; + case 32767 : + Bsprintf(lo,"32767 SECRET ROOM"); + break; + case 65535 : + Bsprintf(lo,"65535 END OF LEVEL"); + break; + default : + Bsprintf(lo,"%hu",sector[sectnum].lotag); + break; } if (sector[sectnum].lotag > 10000 && sector[sectnum].lotag < 32767) Bsprintf(lo,"%d 1 TIME SOUND",sector[sectnum].lotag); @@ -349,74 +386,108 @@ const char *SectorEffectorText(short spritenum) { 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); } @@ -433,41 +504,41 @@ const char *ExtGetSpriteCaption(short spritenum) { switch (sprite[spritenum].picnum) { - case FIRSTGUNSPRITE: - case CHAINGUNSPRITE : - case RPGSPRITE: - case FREEZESPRITE: - case SHRINKERSPRITE: - case HEAVYHBOMB: - case TRIPBOMBSPRITE: - case SHOTGUNSPRITE: - case DEVISTATORSPRITE: - case FREEZEAMMO: - case AMMO: - case BATTERYAMMO: - case DEVISTATORAMMO: - case RPGAMMO: - case GROWAMMO: - case CRYSTALAMMO: - case HBOMBAMMO: - case AMMOLOTS: - case SHOTGUNAMMO: - case COLA: - case SIXPAK: - case FIRSTAID: - case SHIELD: - case STEROIDS: - case AIRTANK: - case JETPACK: - case HEATSENSOR: - case ACCESSCARD: - case BOOTS: - break; - default: - { - tempbuf[0] = 0; - return(tempbuf); - } + case FIRSTGUNSPRITE: + case CHAINGUNSPRITE : + case RPGSPRITE: + case FREEZESPRITE: + case SHRINKERSPRITE: + case HEAVYHBOMB: + case TRIPBOMBSPRITE: + case SHOTGUNSPRITE: + case DEVISTATORSPRITE: + case FREEZEAMMO: + case AMMO: + case BATTERYAMMO: + case DEVISTATORAMMO: + case RPGAMMO: + case GROWAMMO: + case CRYSTALAMMO: + case HBOMBAMMO: + case AMMOLOTS: + case SHOTGUNAMMO: + case COLA: + case SIXPAK: + case FIRSTAID: + case SHIELD: + case STEROIDS: + case AIRTANK: + case JETPACK: + case HEATSENSOR: + case ACCESSCARD: + case BOOTS: + break; + default: + { + tempbuf[0] = 0; + return(tempbuf); + } } } @@ -554,48 +625,48 @@ void ExtShowSectorData(short sectnum) //F5 { switch (sprite[i].picnum) { - case RECON: - case DRONE: - case LIZTROOPONTOILET: - case LIZTROOPSTAYPUT: - case LIZTROOPSHOOT: - case LIZTROOPJETPACK: - case LIZTROOPDUCKING: - case LIZTROOPRUNNING: - case LIZTROOP: - case OCTABRAIN: - case OCTABRAINSTAYPUT: - case COMMANDER: - case COMMANDERSTAYPUT: - case EGG: - case PIGCOP: - case PIGCOPSTAYPUT: - case PIGCOPDIVE: - case LIZMAN: - case LIZMANSTAYPUT: - case LIZMANSPITTING: - case LIZMANFEEDING: - case LIZMANJUMP: - case ORGANTIC: - case BOSS1: - case BOSS2: - case BOSS3: - case GREENSLIME: - case ROTATEGUN: - case TANK: - case NEWBEAST: - case BOSS4: - if (sprite[i].lotag<=1) totalactors1++; - if (sprite[i].lotag<=2) totalactors2++; - if (sprite[i].lotag<=3) totalactors3++; - if (sprite[i].lotag<=4) totalactors4++; - break; + case RECON: + case DRONE: + case LIZTROOPONTOILET: + case LIZTROOPSTAYPUT: + case LIZTROOPSHOOT: + case LIZTROOPJETPACK: + case LIZTROOPDUCKING: + case LIZTROOPRUNNING: + case LIZTROOP: + case OCTABRAIN: + case OCTABRAINSTAYPUT: + case COMMANDER: + case COMMANDERSTAYPUT: + case EGG: + case PIGCOP: + case PIGCOPSTAYPUT: + case PIGCOPDIVE: + case LIZMAN: + case LIZMANSTAYPUT: + case LIZMANSPITTING: + case LIZMANFEEDING: + case LIZMANJUMP: + case ORGANTIC: + case BOSS1: + case BOSS2: + case BOSS3: + case GREENSLIME: + case ROTATEGUN: + case TANK: + case NEWBEAST: + case BOSS4: + if (sprite[i].lotag<=1) totalactors1++; + if (sprite[i].lotag<=2) totalactors2++; + if (sprite[i].lotag<=3) totalactors3++; + if (sprite[i].lotag<=4) totalactors4++; + break; - case RESPAWN: - totalrespawn++; + case RESPAWN: + totalrespawn++; - default: - break; + default: + break; } } } @@ -615,7 +686,9 @@ void ExtShowSectorData(short sectnum) //F5 Bsprintf(tempbuf,"Level %s",levelname); printmessage16(tempbuf); - x=1; x2=14; y=4; + x=1; + x2=14; + y=4; begindrawing(); printext16(x*8,ydim16+y*8,11,-1,"Item Count",0); enddrawing(); @@ -630,7 +703,9 @@ void ExtShowSectorData(short sectnum) //F5 PrintStatus("Shields =",numsprite[SHIELD],x,y+6,11); PrintStatus("",multisprite[SHIELD],x2,y+6,1); - x=17; x2=30; y=4; + x=17; + x2=30; + y=4; begindrawing(); printext16(x*8,ydim16+y*8,11,-1,"Inventory",0); enddrawing(); @@ -648,7 +723,9 @@ void ExtShowSectorData(short sectnum) //F5 PrintStatus("",multisprite[HOLODUKE],x2,y+7,1); PrintStatus("Multi D =",numsprite[APLAYER],x,y+8,11); - x=33; x2=46; y=4; + x=33; + x2=46; + y=4; begindrawing(); printext16(x*8,ydim16+y*8,11,-1,"Weapon Count",0); enddrawing(); @@ -671,7 +748,9 @@ void ExtShowSectorData(short sectnum) //F5 PrintStatus("Freezeray=",numsprite[FREEZESPRITE],x,y+10,11); PrintStatus("",multisprite[FREEZESPRITE],x2,y+10,1); - x=49; x2=62; y=4; + x=49; + x2=62; + y=4; begindrawing(); printext16(x*8,ydim16+y*8,11,-1,"Ammo Count",0); enddrawing(); @@ -722,43 +801,43 @@ void ExtShowWallData(short wallnum) //F6 if (sprite[i].statnum==0) switch (sprite[i].picnum) { - //LOTAG - case ACTIVATOR: - case ACTIVATORLOCKED: - case TOUCHPLATE: - case MASTERSWITCH: - case RESPAWN: - case ACCESSSWITCH: - case SLOTDOOR: - case LIGHTSWITCH: - case SPACEDOORSWITCH: - case SPACELIGHTSWITCH: - case FRANKENSTINESWITCH: - case MULTISWITCH: - case DIPSWITCH: - case DIPSWITCH2: - case TECHSWITCH: - case DIPSWITCH3: - case ACCESSSWITCH2: - case POWERSWITCH1: - case LOCKSWITCH1: - case POWERSWITCH2: - case PULLSWITCH: - case ALIENSWITCH: - 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) + //LOTAG + case ACTIVATOR: + case ACTIVATORLOCKED: + case TOUCHPLATE: + case MASTERSWITCH: + case RESPAWN: + case ACCESSSWITCH: + case SLOTDOOR: + case LIGHTSWITCH: + case SPACEDOORSWITCH: + case SPACELIGHTSWITCH: + case FRANKENSTINESWITCH: + case MULTISWITCH: + case DIPSWITCH: + case DIPSWITCH2: + case TECHSWITCH: + case DIPSWITCH3: + case ACCESSSWITCH2: + case POWERSWITCH1: + case LOCKSWITCH1: + case POWERSWITCH2: + case PULLSWITCH: + case ALIENSWITCH: + 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) + break; + else + if (sprite[i].hitag>nextfreetag) nextfreetag=1+sprite[i].hitag; + break; + default: break; - else - if (sprite[i].hitag>nextfreetag) nextfreetag=1+sprite[i].hitag; - break; - default: - break; } @@ -774,76 +853,86 @@ void ExtShowWallData(short wallnum) //F6 if (sprite[i].pal!=0) switch (sprite[i].picnum) { - case LIZTROOP : - case LIZTROOPRUNNING : - case LIZTROOPSTAYPUT : - case LIZTROOPSHOOT : - case LIZTROOPJETPACK : - case LIZTROOPONTOILET : - case LIZTROOPDUCKING : - numsprite[LIZTROOP]++; break; - case BOSS1: - case BOSS1STAYPUT: - case BOSS1SHOOT: - case BOSS1LOB: - case BOSSTOP: - multisprite[BOSS1]++; break; - case BOSS2: - multisprite[BOSS2]++; break; - case BOSS3: - multisprite[BOSS3]++; break; + case LIZTROOP : + case LIZTROOPRUNNING : + case LIZTROOPSTAYPUT : + case LIZTROOPSHOOT : + case LIZTROOPJETPACK : + case LIZTROOPONTOILET : + case LIZTROOPDUCKING : + numsprite[LIZTROOP]++; + break; + case BOSS1: + case BOSS1STAYPUT: + case BOSS1SHOOT: + case BOSS1LOB: + case BOSSTOP: + multisprite[BOSS1]++; + break; + case BOSS2: + multisprite[BOSS2]++; + break; + case BOSS3: + multisprite[BOSS3]++; + break; - default: - break; + default: + break; } else switch (sprite[i].picnum) { - case LIZTROOP : - case LIZTROOPRUNNING : - case LIZTROOPSTAYPUT : - case LIZTROOPSHOOT : - case LIZTROOPJETPACK : - case LIZTROOPONTOILET : - case LIZTROOPDUCKING : - numsprite[LIZTROOP]++; break; - case PIGCOP: - case PIGCOPSTAYPUT: - case PIGCOPDIVE: - numsprite[PIGCOP]++; break; - case LIZMAN: - case LIZMANSTAYPUT: - case LIZMANSPITTING: - case LIZMANFEEDING: - case LIZMANJUMP: - numsprite[LIZMAN]++; break; - case BOSS1: - case BOSS1STAYPUT: - case BOSS1SHOOT: - case BOSS1LOB: - case BOSSTOP: - numsprite[BOSS1]++; break; - case COMMANDER: - case COMMANDERSTAYPUT: - numsprite[COMMANDER]++; break; - case OCTABRAIN: - case OCTABRAINSTAYPUT: - numsprite[OCTABRAIN]++; break; - case RECON: - case DRONE: - case ROTATEGUN: - case EGG: - case ORGANTIC: - case GREENSLIME: - case BOSS2: - case BOSS3: - case TANK: - case NEWBEAST: - case BOSS4: + case LIZTROOP : + case LIZTROOPRUNNING : + case LIZTROOPSTAYPUT : + case LIZTROOPSHOOT : + case LIZTROOPJETPACK : + case LIZTROOPONTOILET : + case LIZTROOPDUCKING : + numsprite[LIZTROOP]++; + break; + case PIGCOP: + case PIGCOPSTAYPUT: + case PIGCOPDIVE: + numsprite[PIGCOP]++; + break; + case LIZMAN: + case LIZMANSTAYPUT: + case LIZMANSPITTING: + case LIZMANFEEDING: + case LIZMANJUMP: + numsprite[LIZMAN]++; + break; + case BOSS1: + case BOSS1STAYPUT: + case BOSS1SHOOT: + case BOSS1LOB: + case BOSSTOP: + numsprite[BOSS1]++; + break; + case COMMANDER: + case COMMANDERSTAYPUT: + numsprite[COMMANDER]++; + break; + case OCTABRAIN: + case OCTABRAINSTAYPUT: + numsprite[OCTABRAIN]++; + break; + case RECON: + case DRONE: + case ROTATEGUN: + case EGG: + case ORGANTIC: + case GREENSLIME: + case BOSS2: + case BOSS3: + case TANK: + case NEWBEAST: + case BOSS4: - numsprite[sprite[i].picnum]++; - default: - break; + numsprite[sprite[i].picnum]++; + default: + break; }// end switch }// end if @@ -857,7 +946,8 @@ void ExtShowWallData(short wallnum) //F6 Bsprintf(tempbuf,"Level %s next tag %d",levelname,nextfreetag); printmessage16(tempbuf); - x=2;y=4; + x=2; + y=4; PrintStatus("Normal Actors =",total,x,y,11); PrintStatus(" Liztroop =",numsprite[LIZTROOP],x,y+1,11); @@ -888,51 +978,57 @@ void ExtShowWallData(short wallnum) //F6 { switch (sprite[i].hitag) { - case LIZTROOP : - case LIZTROOPRUNNING : - case LIZTROOPSTAYPUT : - case LIZTROOPSHOOT : - case LIZTROOPJETPACK : - case LIZTROOPONTOILET : - case LIZTROOPDUCKING : - numsprite[LIZTROOP]++; break; - case PIGCOP: - case PIGCOPSTAYPUT: - case PIGCOPDIVE: - numsprite[PIGCOP]++; break; - case LIZMAN: - case LIZMANSTAYPUT: - case LIZMANSPITTING: - case LIZMANFEEDING: - case LIZMANJUMP: - numsprite[LIZMAN]++; break; - case BOSS1: - case BOSS1STAYPUT: - case BOSS1SHOOT: - case BOSS1LOB: - case BOSSTOP: - if (sprite[i].pal!=0) multisprite[BOSS1]++; - else numsprite[BOSS1]++; break; - case COMMANDER: - case COMMANDERSTAYPUT: - numsprite[COMMANDER]++; break; - case OCTABRAIN: - case OCTABRAINSTAYPUT: - numsprite[OCTABRAIN]++; break; - case RECON: - case DRONE: - case ROTATEGUN: - case EGG: - case ORGANTIC: - case GREENSLIME: - case BOSS2: - case BOSS3: - case TANK: - case NEWBEAST: - case BOSS4: - numsprite[sprite[i].hitag]++; - default: - break; + case LIZTROOP : + case LIZTROOPRUNNING : + case LIZTROOPSTAYPUT : + case LIZTROOPSHOOT : + case LIZTROOPJETPACK : + case LIZTROOPONTOILET : + case LIZTROOPDUCKING : + numsprite[LIZTROOP]++; + break; + case PIGCOP: + case PIGCOPSTAYPUT: + case PIGCOPDIVE: + numsprite[PIGCOP]++; + break; + case LIZMAN: + case LIZMANSTAYPUT: + case LIZMANSPITTING: + case LIZMANFEEDING: + case LIZMANJUMP: + numsprite[LIZMAN]++; + break; + case BOSS1: + case BOSS1STAYPUT: + case BOSS1SHOOT: + case BOSS1LOB: + case BOSSTOP: + if (sprite[i].pal!=0) multisprite[BOSS1]++; + else numsprite[BOSS1]++; + break; + case COMMANDER: + case COMMANDERSTAYPUT: + numsprite[COMMANDER]++; + break; + case OCTABRAIN: + case OCTABRAINSTAYPUT: + numsprite[OCTABRAIN]++; + break; + case RECON: + case DRONE: + case ROTATEGUN: + case EGG: + case ORGANTIC: + case GREENSLIME: + case BOSS2: + case BOSS3: + case TANK: + case NEWBEAST: + case BOSS4: + numsprite[sprite[i].hitag]++; + default: + break; }//end switch }// end if }// end for @@ -941,7 +1037,8 @@ void ExtShowWallData(short wallnum) //F6 for (i=0;i 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); + 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; + } + case 1: + Bsprintf(msgbuf,"Sector %d ceiling: lo:%s hi:%d",searchsector,ExtGetSectorCaption(searchsector),sector[searchsector].hitag); + _message(msgbuf); + break; + case 2: + Bsprintf(msgbuf,"Sector %d floor: lo:%s hi:%d",searchsector,ExtGetSectorCaption(searchsector),sector[searchsector].hitag); + _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; } - 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; - } } } @@ -1671,12 +1794,14 @@ void Keys3d(void) keystatus[0x0e] = 0; switch (searchstat) { - 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 0: + case 4: + wall[searchwall].cstat = 0; + break; + // case 1: case 2: sector[searchsector].cstat = 0; break; + case 3: + sprite[searchwall].cstat = 0; + break; } } @@ -1859,33 +1984,33 @@ void Keys3d(void) { switch (searchstat) { - case 1: - strcpy(tempbuf,"Sector ceilingz: "); - sector[searchsector].ceilingz = getnumber256(tempbuf,sector[searchsector].ceilingz,8388608,1); - if (!(sector[searchsector].ceilingstat&2)) - sector[searchsector].ceilingheinum = 0; + case 1: + strcpy(tempbuf,"Sector ceilingz: "); + sector[searchsector].ceilingz = getnumber256(tempbuf,sector[searchsector].ceilingz,8388608,1); + if (!(sector[searchsector].ceilingstat&2)) + sector[searchsector].ceilingheinum = 0; - strcpy(tempbuf,"Sector ceiling slope: "); - sector[searchsector].ceilingheinum = getnumber256(tempbuf,sector[searchsector].ceilingheinum,8388608,1); - break; - case 2: - strcpy(tempbuf,"Sector floorz: "); - sector[searchsector].floorz = getnumber256(tempbuf,sector[searchsector].floorz,8388608,1); - if (!(sector[searchsector].floorstat&2)) - sector[searchsector].floorheinum = 0; - strcpy(tempbuf,"Sector floor slope: "); - sector[searchsector].floorheinum = getnumber256(tempbuf,sector[searchsector].floorheinum,8388608,1); - break; - case 3: - strcpy(tempbuf,"Sprite x: "); - sprite[searchwall].x = getnumber256(tempbuf,sprite[searchwall].x,131072,1); - strcpy(tempbuf,"Sprite y: "); - sprite[searchwall].y = getnumber256(tempbuf,sprite[searchwall].y,131072,1); - strcpy(tempbuf,"Sprite z: "); - sprite[searchwall].z = getnumber256(tempbuf,sprite[searchwall].z,8388608,1); - strcpy(tempbuf,"Sprite angle: "); - sprite[searchwall].ang = getnumber256(tempbuf,sprite[searchwall].ang,2048L,0); - break; + strcpy(tempbuf,"Sector ceiling slope: "); + sector[searchsector].ceilingheinum = getnumber256(tempbuf,sector[searchsector].ceilingheinum,8388608,1); + break; + case 2: + strcpy(tempbuf,"Sector floorz: "); + sector[searchsector].floorz = getnumber256(tempbuf,sector[searchsector].floorz,8388608,1); + if (!(sector[searchsector].floorstat&2)) + sector[searchsector].floorheinum = 0; + strcpy(tempbuf,"Sector floor slope: "); + sector[searchsector].floorheinum = getnumber256(tempbuf,sector[searchsector].floorheinum,8388608,1); + break; + case 3: + strcpy(tempbuf,"Sprite x: "); + sprite[searchwall].x = getnumber256(tempbuf,sprite[searchwall].x,131072,1); + strcpy(tempbuf,"Sprite y: "); + sprite[searchwall].y = getnumber256(tempbuf,sprite[searchwall].y,131072,1); + strcpy(tempbuf,"Sprite z: "); + sprite[searchwall].z = getnumber256(tempbuf,sprite[searchwall].z,8388608,1); + strcpy(tempbuf,"Sprite angle: "); + sprite[searchwall].ang = getnumber256(tempbuf,sprite[searchwall].ang,2048L,0); + break; } if (sector[searchsector].ceilingheinum == 0) sector[searchsector].ceilingstat &= ~2; @@ -1917,23 +2042,23 @@ void Keys3d(void) { switch (searchstat) { - case 0: - case 4: - strcpy(buffer,"Wall extra: "); - wall[searchwall].extra = getnumber256(buffer,(long)wall[searchwall].extra,65536L,1); - break; - case 1: - strcpy(buffer,"Sector extra: "); - sector[searchsector].extra = getnumber256(buffer,(long)sector[searchsector].extra,65536L,1); - break; - case 2: - strcpy(buffer,"Sector extra: "); - sector[searchsector].extra = getnumber256(buffer,(long)sector[searchsector].extra,65536L,1); - break; - case 3: - strcpy(buffer,"Sprite extra: "); - sprite[searchwall].extra = getnumber256(buffer,(long)sprite[searchwall].extra,65536L,1); - break; + case 0: + case 4: + strcpy(buffer,"Wall extra: "); + wall[searchwall].extra = getnumber256(buffer,(long)wall[searchwall].extra,65536L,1); + break; + case 1: + strcpy(buffer,"Sector extra: "); + sector[searchsector].extra = getnumber256(buffer,(long)sector[searchsector].extra,65536L,1); + break; + case 2: + strcpy(buffer,"Sector extra: "); + sector[searchsector].extra = getnumber256(buffer,(long)sector[searchsector].extra,65536L,1); + break; + case 3: + strcpy(buffer,"Sprite extra: "); + sprite[searchwall].extra = getnumber256(buffer,(long)sprite[searchwall].extra,65536L,1); + break; } asksave = 1; keystatus[KEYSC_M] = 0; @@ -2056,23 +2181,23 @@ void Keys3d(void) { switch (searchstat) { - case 0: - case 4: - strcpy(buffer,"Wall hitag: "); - wall[searchwall].hitag = getnumber256(buffer,(long)wall[searchwall].hitag,65536L,0); - break; - case 1: - strcpy(buffer,"Sector hitag: "); - sector[searchsector].hitag = getnumber256(buffer,(long)sector[searchsector].hitag,65536L,0); - break; - case 2: - strcpy(buffer,"Sector hitag: "); - sector[searchsector].hitag = getnumber256(buffer,(long)sector[searchsector].hitag,65536L,0); - break; - case 3: - strcpy(buffer,"Sprite hitag: "); - sprite[searchwall].hitag = getnumber256(buffer,(long)sprite[searchwall].hitag,65536L,0); - break; + case 0: + case 4: + strcpy(buffer,"Wall hitag: "); + wall[searchwall].hitag = getnumber256(buffer,(long)wall[searchwall].hitag,65536L,0); + break; + case 1: + strcpy(buffer,"Sector hitag: "); + sector[searchsector].hitag = getnumber256(buffer,(long)sector[searchsector].hitag,65536L,0); + break; + case 2: + strcpy(buffer,"Sector hitag: "); + sector[searchsector].hitag = getnumber256(buffer,(long)sector[searchsector].hitag,65536L,0); + break; + case 3: + strcpy(buffer,"Sprite hitag: "); + sprite[searchwall].hitag = getnumber256(buffer,(long)sprite[searchwall].hitag,65536L,0); + break; } } @@ -2202,7 +2327,8 @@ void Keys3d(void) else { if ((keystatus[0x2a]|keystatus[0x36]) == 0) - k = 16; else k = 1; + k = 16; + else k = 1; if (highlightsectorcnt >= 0) for (i=0;i= 0) for (i=0;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; - 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; - 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; - 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; - else wall[searchwall].overpicnum += i; - j = 0; - } - break; + 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; + 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; + 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; + 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; + 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; + else wall[searchwall].overpicnum += i; + j = 0; + } + break; } asksave = 1; keystatus[KEYSC_DASH] = keystatus[KEYSC_EQUAL] = 0; @@ -2502,14 +2634,18 @@ void Keys3d(void) i = ((i>>3)&1)+((i>>7)&2); //3-x,8-y 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; @@ -2522,22 +2658,30 @@ void Keys3d(void) i = (i&0x4)+((i>>4)&3); 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; @@ -2550,22 +2694,30 @@ void Keys3d(void) i = (i&0x4)+((i>>4)&3); 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; @@ -2585,14 +2737,18 @@ void Keys3d(void) i = ((i>>2)&3); 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; @@ -2895,12 +3051,15 @@ void Keys3d(void) if (rate 640)); enddrawing(); } @@ -2944,22 +3103,30 @@ void Keys3d(void) enddrawing(); 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")) @@ -3004,7 +3171,8 @@ 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); @@ -3040,7 +3208,8 @@ void Keys3d(void) 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); @@ -3049,7 +3218,8 @@ void Keys3d(void) if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x15]==1) // ' y { keystatus[0x15] = 0; - purpleon=!purpleon; if (nosprites>3) nosprites=0; + purpleon=!purpleon; + if (nosprites>3) nosprites=0; if (purpleon) message("Purple ON"); else message("Purple OFF"); } @@ -3059,36 +3229,39 @@ void Keys3d(void) keystatus[0x2e] = 0; switch (searchstat) { - case 0: - case 4: - for (i=0;i 0) { + if (strlen(names[sprite[i].picnum]) > 0) + { if (sprite[i].picnum==SECTOREFFECTOR) Bsprintf(tmpbuf,"Sprite %d %s: lo:%d hi:%d",i,SectorEffectorText(i),sprite[i].lotag,sprite[i].hitag); else Bsprintf(tmpbuf,"Sprite %d %s: lo:%d hi:%d ex:%d",i,names[sprite[i].picnum],sprite[i].lotag,sprite[i].hitag,sprite[i].extra); @@ -3790,14 +3978,16 @@ void Keys2d(void) if (keystatus[0x22] > 0) // G (grid on/off) { grid += ((keystatus[0x2a]|keystatus[0x36]) > 0?-1:1); - if (grid == -1 || grid == 9) { - switch (grid) { - case -1: - grid = 8; - break; - case 9: - grid = 0; - break; + if (grid == -1 || grid == 9) + { + switch (grid) + { + case -1: + grid = 8; + break; + case 9: + grid = 0; + break; } } if (!grid) sprintf(tempbuf,"Grid off"); @@ -3840,7 +4030,8 @@ void Keys2d(void) 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); @@ -3945,96 +4136,97 @@ void ExtSetupSpecialSpriteCols(void) short i; for (i=0;iltextptr; - switch (tokn) { - case T_LOADGRP: + switch (tokn) { - char *fn; - if (!scriptfile_getstring(script,&fn)) + case T_LOADGRP: { - int j = initgroupfile(fn); + char *fn; + if (!scriptfile_getstring(script,&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; - case T_EOF: - return(0); - default: break; + case T_EOF: + return(0); + default: + break; } } @@ -4224,7 +4423,8 @@ int ExtInit(void) addsearchpath("/Library/Application Support/EDuke32"); #endif if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd); - if ((homedir = Bgethomedir())) { + if ((homedir = Bgethomedir())) + { Bsnprintf(cwd,sizeof(cwd),"%s/" #if defined(_WIN32) "EDuke32 Settings" @@ -4235,7 +4435,8 @@ int ExtInit(void) #endif ,homedir); asperr = addsearchpath(cwd); - if (asperr == -2) { + if (asperr == -2) + { if (Bmkdir(cwd,S_IRWXU) == 0) asperr = addsearchpath(cwd); else asperr = -1; } @@ -4246,13 +4447,15 @@ int ExtInit(void) } // JBF 20031220: Because it's annoying renaming GRP files whenever I want to test different game data - if (getenv("DUKE3DGRP")) { + if (getenv("DUKE3DGRP")) + { duke3dgrp = getenv("DUKE3DGRP"); initprintf("Using %s as main GRP file\n", duke3dgrp); } initgroupfile(duke3dgrp); - if (getenv("DUKE3DDEF")) { + if (getenv("DUKE3DDEF")) + { defsfilename = getenv("DUKE3DDEF"); initprintf("Using %s as definitions file\n", defsfilename); } @@ -4283,7 +4486,8 @@ int ExtInit(void) Bmemcpy((void *)buildkeys,(void *)keys,NUMBUILDKEYS); //Trick to make build use setup.dat keys - if (initengine()) { + if (initengine()) + { initprintf("There was a problem initialising the engine.\n"); return -1; } @@ -4330,7 +4534,9 @@ void ExtPreCheckKeys(void) // just before drawrooms if (waloff[4094] == 0) allocache(&waloff[4094],320L*200L,&lockbyte4094); setviewtotile(4094,320L,200L); - searchx ^= searchy; searchy ^= searchx; searchx ^= searchy; + searchx ^= searchy; + searchy ^= searchx; + searchx ^= searchy; searchx = ydim-1-searchx; } } @@ -4352,8 +4558,8 @@ void ExtAnalyzeSprites(void) if (nosprites==1||nosprites==3) switch (tspr->picnum) { - case SEENINE : - tspr->xrepeat=0; + case SEENINE : + tspr->xrepeat=0; } if (shadepreview && !(tspr->cstat & 16)) @@ -4375,92 +4581,93 @@ void ExtAnalyzeSprites(void) switch (tspr->picnum) { - // 5-frame walk - case 1550 : // Shark - frames=5; - // 2-frame walk - case 1445 : // duke kick - case LIZTROOPDUCKING : - case 2030 : // pig shot - case OCTABRAIN : - case PIGCOPDIVE : - case 2190 : // liz capt shot - case BOSS1SHOOT : - case BOSS1LOB : - case LIZTROOPSHOOT : - if (frames==0) frames=2; + // 5-frame walk + case 1550 : // Shark + frames=5; + // 2-frame walk + case 1445 : // duke kick + case LIZTROOPDUCKING : + case 2030 : // pig shot + case OCTABRAIN : + case PIGCOPDIVE : + case 2190 : // liz capt shot + case BOSS1SHOOT : + case BOSS1LOB : + case LIZTROOPSHOOT : + if (frames==0) frames=2; - // 4-frame walk - case 1491 : // duke crawl - case LIZTROOP : - case LIZTROOPRUNNING : - case PIGCOP : - case LIZMAN : - case BOSS1 : - case BOSS2 : - case BOSS3 : - case BOSS4 : - case NEWBEAST: - if (frames==0) frames=4; - case LIZTROOPJETPACK : - case DRONE : - case COMMANDER : - case TANK : - case RECON : - if (frames==0) frames = 10; - case CAMERA1: - case APLAYER : - if (frames==0) frames=1; - case GREENSLIME : - case EGG : - case PIGCOPSTAYPUT : - case LIZMANSTAYPUT: - case LIZTROOPSTAYPUT : - case LIZMANSPITTING : - case LIZMANFEEDING : - case LIZMANJUMP : - if (skill!=4) - { - if (tspr->lotag>skill+1) + // 4-frame walk + case 1491 : // duke crawl + case LIZTROOP : + case LIZTROOPRUNNING : + case PIGCOP : + case LIZMAN : + case BOSS1 : + case BOSS2 : + case BOSS3 : + case BOSS4 : + case NEWBEAST: + if (frames==0) frames=4; + case LIZTROOPJETPACK : + case DRONE : + case COMMANDER : + case TANK : + case RECON : + if (frames==0) frames = 10; + case CAMERA1: + case APLAYER : + if (frames==0) frames=1; + case GREENSLIME : + case EGG : + case PIGCOPSTAYPUT : + case LIZMANSTAYPUT: + case LIZTROOPSTAYPUT : + case LIZMANSPITTING : + case LIZMANFEEDING : + case LIZMANJUMP : + if (skill!=4) { - tspr->xrepeat=0; break; + if (tspr->lotag>skill+1) + { + tspr->xrepeat=0; + break; + } } - } - if (nosprites==2||nosprites==3) - { - tspr->xrepeat=0; - // tspr->cstat|=32768; - } - // else tspr->cstat&=32767; - - if (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) - if (k <= 4) + if (nosprites==2||nosprites==3) { - tspr->picnum += k; - tspr->cstat &= ~4; //clear x-flipping bit + tspr->xrepeat=0; + // tspr->cstat|=32768; } - else + // else tspr->cstat&=32767; + + if (frames!=0) { - tspr->picnum += 8-k; - tspr->cstat |= 4; //set x-flipping bit + 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) + if (k <= 4) + { + tspr->picnum += k; + tspr->cstat &= ~4; //clear x-flipping bit + } + else + { + tspr->picnum += 8-k; + tspr->cstat |= 4; //set x-flipping bit + } } - } - 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) - tspr->picnum -= 5; //Hack, for actors + if (tilesizx[tspr->picnum] == 0) + tspr->picnum -= 5; //Hack, for actors - break; - default: - break; + break; + default: + break; } } @@ -4573,7 +4780,8 @@ void faketimerhandler(void) long hiz, hihit, loz, lohit, oposx, oposy; short hitwall, daang; - counter++; if (counter>=5) counter=0; + counter++; + if (counter>=5) counter=0; sampletimer(); if (totalclock < ototalclock+TICSPERFRAME) @@ -4584,9 +4792,11 @@ void faketimerhandler(void) return; ototalclock = totalclock; - oposx = posx; oposy = posy; + oposx = posx; + oposy = posy; hitwall = clipmove(&posx,&posy,&posz,&cursectnum,xvel,yvel,128L,4L<<8,4L<<8,0); - xvel = ((posx-oposx)<<14); yvel = ((posy-oposy)<<14); + xvel = ((posx-oposx)<<14); + yvel = ((posy-oposy)<<14); yvel += 80000; if ((hitwall&0xc000) == 32768) @@ -4622,7 +4832,8 @@ void faketimerhandler(void) getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,0); - oposx -= posx; oposy -= posy; + oposx -= posx; + oposy -= posy; dist = ksqrt(oposx*oposx+oposy*oposy); if (ototalclock > timoff+32) dist = 0; @@ -4751,7 +4962,8 @@ void EditSectorData(short sectnum) begindrawing(); while (keystatus[1] == 0) { - if (handleevents()) { + if (handleevents()) + { if (quitevent) quitevent = 0; } printmessage16("Edit mode, press to exit"); @@ -4811,152 +5023,152 @@ void EditSectorData(short sectnum) { switch (row) { - case 0: - for (i=Bsprintf(disptext,"Flags (hex): %x",sector[sectnum].ceilingstat); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Ceiling Flags: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].ceilingstat = (short)getnumber16(edittext,(long)sector[sectnum].ceilingstat,32768L,0); - } - break; - case 1: - for (i=Bsprintf(disptext,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - Bsprintf(edittext,"Sector (%d) Ceiling X Pan: ",sectnum); - printmessage16(edittext); - sector[sectnum].ceilingxpanning = (char)getnumber16(edittext,(long)sector[sectnum].ceilingxpanning,256L,0); - Bsprintf(edittext,"Sector (%d) Ceiling Y Pan: ",sectnum); - printmessage16(edittext); - sector[sectnum].ceilingypanning = (char)getnumber16(edittext,(long)sector[sectnum].ceilingypanning,256L,0); - } - break; - case 2: - for (i=Bsprintf(disptext,"Shade byte: %d",sector[sectnum].ceilingshade); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Ceiling Shade: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].ceilingshade = (char)getnumber16(edittext,(long)sector[sectnum].ceilingshade,128L,1); - } - break; + case 0: + for (i=Bsprintf(disptext,"Flags (hex): %x",sector[sectnum].ceilingstat); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Ceiling Flags: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].ceilingstat = (short)getnumber16(edittext,(long)sector[sectnum].ceilingstat,32768L,0); + } + break; + case 1: + for (i=Bsprintf(disptext,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning); i < dispwidth; i++) disptext[i] = ' '; + if (editval) + { + Bsprintf(edittext,"Sector (%d) Ceiling X Pan: ",sectnum); + printmessage16(edittext); + sector[sectnum].ceilingxpanning = (char)getnumber16(edittext,(long)sector[sectnum].ceilingxpanning,256L,0); + Bsprintf(edittext,"Sector (%d) Ceiling Y Pan: ",sectnum); + printmessage16(edittext); + sector[sectnum].ceilingypanning = (char)getnumber16(edittext,(long)sector[sectnum].ceilingypanning,256L,0); + } + break; + case 2: + for (i=Bsprintf(disptext,"Shade byte: %d",sector[sectnum].ceilingshade); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Ceiling Shade: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].ceilingshade = (char)getnumber16(edittext,(long)sector[sectnum].ceilingshade,128L,1); + } + break; - case 3: - for (i=Bsprintf(disptext,"Z-coordinate: %ld",sector[sectnum].ceilingz); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Ceiling Z-coordinate: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].ceilingz = getnumber16(edittext,sector[sectnum].ceilingz,8388608,1); //2147483647L,-2147483648L - } - break; + case 3: + for (i=Bsprintf(disptext,"Z-coordinate: %ld",sector[sectnum].ceilingz); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Ceiling Z-coordinate: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].ceilingz = getnumber16(edittext,sector[sectnum].ceilingz,8388608,1); //2147483647L,-2147483648L + } + break; - case 4: - for (i=Bsprintf(disptext,"Tile number: %d",sector[sectnum].ceilingpicnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Ceiling Tile Number: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].ceilingpicnum = (short)getnumber16(edittext,(long)sector[sectnum].ceilingpicnum,MAXTILES,0); - } - break; + case 4: + for (i=Bsprintf(disptext,"Tile number: %d",sector[sectnum].ceilingpicnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Ceiling Tile Number: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].ceilingpicnum = (short)getnumber16(edittext,(long)sector[sectnum].ceilingpicnum,MAXTILES,0); + } + break; - case 5: - for (i=Bsprintf(disptext,"Ceiling heinum: %d",sector[sectnum].ceilingheinum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Ceiling Heinum: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].ceilingheinum = (short)getnumber16(edittext,(long)sector[sectnum].ceilingheinum,32768L,1); - } - break; + case 5: + for (i=Bsprintf(disptext,"Ceiling heinum: %d",sector[sectnum].ceilingheinum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Ceiling Heinum: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].ceilingheinum = (short)getnumber16(edittext,(long)sector[sectnum].ceilingheinum,32768L,1); + } + break; - case 6: - for (i=Bsprintf(disptext,"Palookup number: %d",sector[sectnum].ceilingpal); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Ceiling Palookup Number: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].ceilingpal = (char)getnumber16(edittext,(long)sector[sectnum].ceilingpal,MAXPALOOKUPS,0); - } - break; + case 6: + for (i=Bsprintf(disptext,"Palookup number: %d",sector[sectnum].ceilingpal); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Ceiling Palookup Number: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].ceilingpal = (char)getnumber16(edittext,(long)sector[sectnum].ceilingpal,MAXPALOOKUPS,0); + } + break; } } if (col == 2) { switch (row) { - case 0: - for (i=Bsprintf(disptext,"Flags (hex): %x",sector[sectnum].floorstat); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Floor Flags: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].floorstat = (short)getnumber16(edittext,(long)sector[sectnum].floorstat,1024L,0); - } - break; + case 0: + for (i=Bsprintf(disptext,"Flags (hex): %x",sector[sectnum].floorstat); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Floor Flags: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].floorstat = (short)getnumber16(edittext,(long)sector[sectnum].floorstat,1024L,0); + } + break; - case 1: - for (i=Bsprintf(disptext,"(X,Y)pan: %d, %d",sector[sectnum].floorxpanning,sector[sectnum].floorypanning); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - Bsprintf(edittext,"Sector (%d) Floor X Pan: ",sectnum); - printmessage16(edittext); - sector[sectnum].floorxpanning = (char)getnumber16(edittext,(long)sector[sectnum].floorxpanning,256L,0); - Bsprintf(edittext,"Sector (%d) Floor Y Pan: ",sectnum); - printmessage16(edittext); - sector[sectnum].floorypanning = (char)getnumber16(edittext,(long)sector[sectnum].floorypanning,256L,0); - } - break; + case 1: + for (i=Bsprintf(disptext,"(X,Y)pan: %d, %d",sector[sectnum].floorxpanning,sector[sectnum].floorypanning); i < dispwidth; i++) disptext[i] = ' '; + if (editval) + { + Bsprintf(edittext,"Sector (%d) Floor X Pan: ",sectnum); + printmessage16(edittext); + sector[sectnum].floorxpanning = (char)getnumber16(edittext,(long)sector[sectnum].floorxpanning,256L,0); + Bsprintf(edittext,"Sector (%d) Floor Y Pan: ",sectnum); + printmessage16(edittext); + sector[sectnum].floorypanning = (char)getnumber16(edittext,(long)sector[sectnum].floorypanning,256L,0); + } + break; - case 2: - for (i=Bsprintf(disptext,"Shade byte: %d",sector[sectnum].floorshade); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Floor Shade: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].floorshade = (char)getnumber16(edittext,(long)sector[sectnum].floorshade,65536L,1L); - } - break; + case 2: + for (i=Bsprintf(disptext,"Shade byte: %d",sector[sectnum].floorshade); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Floor Shade: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].floorshade = (char)getnumber16(edittext,(long)sector[sectnum].floorshade,65536L,1L); + } + break; - case 3: - for (i=Bsprintf(disptext,"Z-coordinate: %ld",sector[sectnum].floorz); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Floor Z-coordinate: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].floorz = getnumber16(edittext,sector[sectnum].floorz,8388608L,1); //2147483647L,-2147483648L - } - break; + case 3: + for (i=Bsprintf(disptext,"Z-coordinate: %ld",sector[sectnum].floorz); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Floor Z-coordinate: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].floorz = getnumber16(edittext,sector[sectnum].floorz,8388608L,1); //2147483647L,-2147483648L + } + break; - case 4: - for (i=Bsprintf(disptext,"Tile number: %d",sector[sectnum].floorpicnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Floor Tile Number: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].floorpicnum = (short)getnumber16(edittext,(long)sector[sectnum].floorpicnum,MAXTILES,0); - } - break; - case 5: - for (i=Bsprintf(disptext,"Floor heinum: %d",sector[sectnum].floorheinum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Flooring Heinum: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].floorheinum = (short)getnumber16(edittext,(long)sector[sectnum].floorheinum,32768L,1); - } - break; - case 6: - for (i=Bsprintf(disptext,"Palookup number: %d",sector[sectnum].floorpal); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Sector (%d) Floor Palookup Number: ",sectnum); - if (editval) - { - printmessage16(edittext); - sector[sectnum].floorpal = (char)getnumber16(edittext,(long)sector[sectnum].floorpal,MAXPALOOKUPS,0); - } - break; + case 4: + for (i=Bsprintf(disptext,"Tile number: %d",sector[sectnum].floorpicnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Floor Tile Number: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].floorpicnum = (short)getnumber16(edittext,(long)sector[sectnum].floorpicnum,MAXTILES,0); + } + break; + case 5: + for (i=Bsprintf(disptext,"Floor heinum: %d",sector[sectnum].floorheinum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Flooring Heinum: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].floorheinum = (short)getnumber16(edittext,(long)sector[sectnum].floorheinum,32768L,1); + } + break; + case 6: + for (i=Bsprintf(disptext,"Palookup number: %d",sector[sectnum].floorpal); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Sector (%d) Floor Palookup Number: ",sectnum); + if (editval) + { + printmessage16(edittext); + sector[sectnum].floorpal = (char)getnumber16(edittext,(long)sector[sectnum].floorpal,MAXPALOOKUPS,0); + } + break; } } printext16(xpos,ypos+row*8,11,1,disptext,0); @@ -4987,7 +5199,8 @@ void EditWallData(short wallnum) begindrawing(); while (keystatus[1] == 0) { - if (handleevents()) { + if (handleevents()) + { if (quitevent) quitevent = 0; } printmessage16("Edit mode, press to exit"); @@ -5016,76 +5229,76 @@ void EditWallData(short wallnum) } switch (row) { - case 0: - for (i=Bsprintf(disptext,"Flags (hex): %x",wall[wallnum].cstat); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Wall (%d) Flags: ",wallnum); - if (editval) - { - printmessage16(edittext); - wall[wallnum].cstat = (short)getnumber16(edittext,(long)wall[wallnum].cstat,1024L,0); - } - break; - case 1: - for (i=Bsprintf(disptext,"Shade: %d",wall[wallnum].shade); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Wall (%d) Shade: ",wallnum); - if (editval) - { - printmessage16(edittext); - wall[wallnum].shade = (char)getnumber16(edittext,(long)wall[wallnum].shade,127,1); - } - break; - case 2: - for (i=Bsprintf(disptext,"Pal: %d",wall[wallnum].pal); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Wall (%d) Pal: ",wallnum); - if (editval) - { - printmessage16(edittext); - wall[wallnum].pal = (char)getnumber16(edittext,(long)wall[wallnum].pal,MAXPALOOKUPS,0); - } - break; - case 3: - for (i=Bsprintf(disptext,"(X,Y)repeat: %d, %d",wall[wallnum].xrepeat,wall[wallnum].yrepeat); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - Bsprintf(edittext,"Wall (%d) X Repeat: ",wallnum); - printmessage16(edittext); - wall[wallnum].xrepeat = (char)getnumber16(edittext,(long)wall[wallnum].xrepeat,256L,0); - Bsprintf(edittext,"Wall (%d) Y Repeat: ",wallnum); - printmessage16(edittext); - wall[wallnum].yrepeat = (char)getnumber16(edittext,(long)wall[wallnum].yrepeat,256L,0); - } - break; - case 4: - for (i=Bsprintf(disptext,"(X,Y)pan: %d, %d",wall[wallnum].xpanning,wall[wallnum].ypanning); i < dispwidth; i++) disptext[i] = ' '; - if (editval) - { - Bsprintf(edittext,"Wall (%d) X Pan: ",wallnum); - printmessage16(edittext); - wall[wallnum].xpanning = (char)getnumber16(edittext,(long)wall[wallnum].xpanning,256L,0); - Bsprintf(edittext,"Wall (%d) Y Pan: ",wallnum); - printmessage16(edittext); - wall[wallnum].ypanning = (char)getnumber16(edittext,(long)wall[wallnum].ypanning,256L,0); - } - break; - case 5: - for (i=Bsprintf(disptext,"Tile number: %d",wall[wallnum].picnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Wall (%d) Tile number: ",wallnum); - if (editval) - { - printmessage16(edittext); - wall[wallnum].picnum = (short)getnumber16(edittext,(long)wall[wallnum].picnum,MAXTILES,0); - } - break; + case 0: + for (i=Bsprintf(disptext,"Flags (hex): %x",wall[wallnum].cstat); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Wall (%d) Flags: ",wallnum); + if (editval) + { + printmessage16(edittext); + wall[wallnum].cstat = (short)getnumber16(edittext,(long)wall[wallnum].cstat,1024L,0); + } + break; + case 1: + for (i=Bsprintf(disptext,"Shade: %d",wall[wallnum].shade); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Wall (%d) Shade: ",wallnum); + if (editval) + { + printmessage16(edittext); + wall[wallnum].shade = (char)getnumber16(edittext,(long)wall[wallnum].shade,127,1); + } + break; + case 2: + for (i=Bsprintf(disptext,"Pal: %d",wall[wallnum].pal); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Wall (%d) Pal: ",wallnum); + if (editval) + { + printmessage16(edittext); + wall[wallnum].pal = (char)getnumber16(edittext,(long)wall[wallnum].pal,MAXPALOOKUPS,0); + } + break; + case 3: + for (i=Bsprintf(disptext,"(X,Y)repeat: %d, %d",wall[wallnum].xrepeat,wall[wallnum].yrepeat); i < dispwidth; i++) disptext[i] = ' '; + if (editval) + { + Bsprintf(edittext,"Wall (%d) X Repeat: ",wallnum); + printmessage16(edittext); + wall[wallnum].xrepeat = (char)getnumber16(edittext,(long)wall[wallnum].xrepeat,256L,0); + Bsprintf(edittext,"Wall (%d) Y Repeat: ",wallnum); + printmessage16(edittext); + wall[wallnum].yrepeat = (char)getnumber16(edittext,(long)wall[wallnum].yrepeat,256L,0); + } + break; + case 4: + for (i=Bsprintf(disptext,"(X,Y)pan: %d, %d",wall[wallnum].xpanning,wall[wallnum].ypanning); i < dispwidth; i++) disptext[i] = ' '; + if (editval) + { + Bsprintf(edittext,"Wall (%d) X Pan: ",wallnum); + printmessage16(edittext); + wall[wallnum].xpanning = (char)getnumber16(edittext,(long)wall[wallnum].xpanning,256L,0); + Bsprintf(edittext,"Wall (%d) Y Pan: ",wallnum); + printmessage16(edittext); + wall[wallnum].ypanning = (char)getnumber16(edittext,(long)wall[wallnum].ypanning,256L,0); + } + break; + case 5: + for (i=Bsprintf(disptext,"Tile number: %d",wall[wallnum].picnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Wall (%d) Tile number: ",wallnum); + if (editval) + { + printmessage16(edittext); + wall[wallnum].picnum = (short)getnumber16(edittext,(long)wall[wallnum].picnum,MAXTILES,0); + } + break; - case 6: - for (i=Bsprintf(disptext,"OverTile number: %d",wall[wallnum].overpicnum); i < dispwidth; i++) disptext[i] = ' '; - Bsprintf(edittext,"Wall (%d) OverTile number: ",wallnum); - if (editval) - { - printmessage16(edittext); - wall[wallnum].overpicnum = (short)getnumber16(edittext,(long)wall[wallnum].overpicnum,MAXTILES,0); - } - break; + case 6: + for (i=Bsprintf(disptext,"OverTile number: %d",wall[wallnum].overpicnum); i < dispwidth; i++) disptext[i] = ' '; + Bsprintf(edittext,"Wall (%d) OverTile number: ",wallnum); + if (editval) + { + printmessage16(edittext); + wall[wallnum].overpicnum = (short)getnumber16(edittext,(long)wall[wallnum].overpicnum,MAXTILES,0); + } + break; } printext16(xpos,ypos+row*8,11,1,disptext,0); if (editval) @@ -5120,7 +5333,8 @@ void EditSpriteData(short spritenum) while (keystatus[1] == 0) { begindrawing(); - if (handleevents()) { + if (handleevents()) + { if (quitevent) quitevent = 0; } printmessage16("Edit mode, press to exit"); @@ -5146,28 +5360,28 @@ 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; - 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; + 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; + 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; } keystatus[0xcb] = 0; } @@ -5175,28 +5389,28 @@ 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; - 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; + 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; + 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; } keystatus[0xcd] = 0; } @@ -5207,235 +5421,235 @@ void EditSpriteData(short spritenum) } switch (col) { - case 0: - { - 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) + switch (row) { - printmessage16(edittext); - sprite[spritenum].x = getnumber16(edittext,sprite[spritenum].x,131072,1); + 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; } } 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) + switch (row) { - printmessage16(edittext); - sprite[spritenum].y = getnumber16(edittext,sprite[spritenum].y,131072,1); + 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; } } 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) + switch (row) { - printmessage16(edittext); - sprite[spritenum].z = getnumber16(edittext,sprite[spritenum].z,8388608,1); //2147483647L,-2147483648L + 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; } } 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) - { - 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; - } - } - break; - case 2: - { - 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) - { - 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); @@ -5530,7 +5744,8 @@ void FuncMenu(void) while (!editval && keystatus[1] == 0) { begindrawing(); - if (handleevents()) { + if (handleevents()) + { if (quitevent) quitevent = 0; } printmessage16("Select an option, press to exit"); @@ -5607,222 +5822,229 @@ void FuncMenu(void) } switch (col) { - case 0: - switch (row) - { case 0: - { - for (i=Bsprintf(disptext,"Replace invalid tiles"); i < dispwidth; i++) disptext[i] = ' '; - if (editval) + switch (row) { - j = 0; - for (i=0;i= 0) + { + for (j=0;j= 0) - { - for (j=0;j>4)/j; + j=getnumber16("Visibility divisor: ",1,127,0); + if (j!=1) + { + for (i=0;i>4)/j; + } + printmessage16("Visibility adjusted"); + } + else printmessage16("Aborted"); } - printmessage16("Visibility adjusted"); - } else printmessage16("Aborted"); + } + break; } - } - break; - } - break; + break; } printext16(xpos,ypos+row*8,11,1,disptext,0); enddrawing(); diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 2089ab410..a0beed5fd 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -97,7 +97,10 @@ int32 ScreenBPP = 8; #endif int32 ForceSetup = 1; -static char setupfilename[BMAX_PATH]={SETUPFILENAME}; +static char setupfilename[BMAX_PATH]= + { + SETUPFILENAME + }; int32 scripthandle = -1; static int32 setupread=0; @@ -185,15 +188,16 @@ int32 CONFIG_AnalogNameToNum(char * func) char * CONFIG_AnalogNumToName(int32 func) { - switch (func) { - case analog_turning: - return "analog_turning"; - case analog_strafing: - return "analog_strafing"; - case analog_moving: - return "analog_moving"; - case analog_lookingupanddown: - return "analog_lookingupanddown"; + switch (func) + { + case analog_turning: + return "analog_turning"; + case analog_strafing: + return "analog_strafing"; + case analog_moving: + return "analog_moving"; + case analog_lookingupanddown: + return "analog_lookingupanddown"; } return NULL; @@ -277,7 +281,8 @@ void CONFIG_SetDefaults(void) // JBF 20031211 memset(KeyboardKeys, 0xff, sizeof(KeyboardKeys)); - for (i=0; i < (int32)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3) { + for (i=0; i < (int32)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3) + { f = CONFIG_FunctionNameToNum(keydefaults[i+0]); if (f == -1) continue; KeyboardKeys[f][0] = KB_StringToScanCode(keydefaults[i+1]); @@ -288,7 +293,8 @@ void CONFIG_SetDefaults(void) } memset(MouseFunctions, -1, sizeof(MouseFunctions)); - for (i=0; i=4) continue; @@ -297,7 +303,8 @@ void CONFIG_SetDefaults(void) } memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions)); - for (i=0; ipalette = pal; return; } - if (getrendermode() < 3) { + if (getrendermode() < 3) + { // 8-bit mode player->palette = pal; setbrightness(ud.brightness>>2, pal, set); @@ -207,11 +218,14 @@ void setgamepalette(struct player_struct *player, char *pal, int set) return; } - if (pal == palette || pal == waterpal || pal == slimepal) { + if (pal == palette || pal == waterpal || pal == slimepal) + { if (player->palette != palette && player->palette != waterpal && player->palette != slimepal) setbrightness(ud.brightness>>2, palette, set); else setpalettefade(0,0,0,0); - } else { + } + else + { setbrightness(ud.brightness>>2, pal, set); } player->palette = pal; @@ -261,7 +275,12 @@ int gametext_(int small, int starttile, int x,int y,char *t,char s,char p,short if (isdigit(*t)) t++; continue; } - if (*t == 32) {newx+=5;t++;continue;} + if (*t == 32) + { + newx+=5; + t++; + continue; + } else ac = *t - '!' + starttile; if (ac < starttile || ac > (starttile + 93)) break; @@ -288,14 +307,21 @@ int gametext_(int small, int starttile, int x,int y,char *t,char s,char p,short smallbuf[1] = *(t++); smallbuf[2] = '\0'; p = atol(smallbuf); - } else { + } + else + { smallbuf[0] = *(t++); smallbuf[1] = '\0'; p = atol(smallbuf); } 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)) @@ -340,7 +366,12 @@ int minitext_(int x,int y,char *t,char s,char p,short sb) 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); @@ -381,7 +412,8 @@ void allowtimetocorrecterrorswhenquitting(void) { oldtotalclock = totalclock; - while (totalclock < oldtotalclock+TICSPERFRAME) { + while (totalclock < oldtotalclock+TICSPERFRAME) + { handleevents(); getpackets(); } @@ -423,7 +455,8 @@ void getpackets(void) 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"); @@ -435,7 +468,10 @@ 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)) { @@ -448,415 +484,421 @@ if (!(ps[myconnectindex].gm&MODE_GAME)) { OSD_DispatchQueued(); } { 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]) - if (i != other) - sendpacket(i,packbuf,packbufleng); - } - /* - j = packbuf[1]; - playerquitflag[j] = 0; - - j = -1; - for(i=connecthead;i>=0;i=connectpoint2[i]) - { - if (playerquitflag[i]) { j = i; continue; } - - if (i == connecthead) connecthead = connectpoint2[connecthead]; - else connectpoint2[j] = connectpoint2[i]; - - numplayers--; - ud.multimode--; - - Bsprintf(buf,"%s is history!",ud.user_name[i]); - adduserquote(buf); - - if (numplayers < 2) - sound(GENERIC_AMBIENCE17); - - if(i == 0 && networkmode == 0) */ - gameexit("Game aborted from menu; disconnected."); - // } - - break; - - case 9: - //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]) - if (i != other) - sendpacket(i,packbuf,packbufleng); - } - - Bstrcpy(boardfilename,packbuf+1); - boardfilename[packbufleng-1] = 0; - if (boardfilename[0] != 0) - { - if ((i = kopen4load(boardfilename,0)) < 0) { - Bmemset(boardfilename,0,sizeof(boardfilename)); - sendboardname(); - } else kclose(i); - } - - if (ud.m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0) - ud.m_level_number = 0; - - break; - - case 18: // map vote - - if (myconnectindex == connecthead) - { - //Master re-transmits message to all others - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) - if (i != other) - sendpacket(i,packbuf,packbufleng); - } - - switch (packbuf[1]) - { - case 0: - if (voting == myconnectindex && gotvote[packbuf[2]] == 0) - { - gotvote[packbuf[2]] = 1; - votes[packbuf[2]] = packbuf[3]; - Bsprintf(tempbuf,"GOT VOTE FROM %s",ud.user_name[packbuf[2]]); - adduserquote(tempbuf); - } - break; - - case 1: // call map vote - voting = packbuf[2]; - vote_episode = packbuf[3]; - vote_map = packbuf[4]; - Bsprintf(tempbuf,"%s HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[packbuf[2]],level_names[packbuf[3]*11 + packbuf[4]],packbuf[3]+1,packbuf[4]+1); - adduserquote(tempbuf); - Bsprintf(tempbuf,"PRESS F1 TO VOTE YES, F2 TO VOTE NO"); - adduserquote(tempbuf); - Bmemset(votes,0,sizeof(votes)); - Bmemset(gotvote,0,sizeof(gotvote)); - gotvote[voting] = votes[voting] = 1; - break; - - case 2: // cancel map vote - if (voting == packbuf[2]) - { - voting = -1; - i = 0; - for (j=0;j=0;i=connectpoint2[i]) - if (i != other) sendpacket(i,packbuf,packbufleng); - - multiflag = 2; - multiwhat = 0; - multiwho = packbuf[2]; //other: need to send in m/s mode because of possible re-transmit - multipos = packbuf[1]; - loadplayer(multipos); - multiflag = 0; - break; - case 0: //[0] (receive master sync buffer) - j = 1; - - if ((movefifoend[other]&(TIMERUPDATESIZ-1)) == 0) - for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) - { - if (playerquitflag[i] == 0) continue; - if (i == myconnectindex) - otherminlag = (long)((signed char)packbuf[j]); - j++; - } - - osyn = (input *)&inputfifo[(movefifoend[connecthead]-1)&(MOVEFIFOSIZ-1)][0]; - nsyn = (input *)&inputfifo[(movefifoend[connecthead])&(MOVEFIFOSIZ-1)][0]; - - k = j; - for (i=connecthead;i>=0;i=connectpoint2[i]) - j += playerquitflag[i]+playerquitflag[i]; - for (i=connecthead;i>=0;i=connectpoint2[i]) - { - if (playerquitflag[i] == 0) continue; - - l = packbuf[k++]; - l += (long)(packbuf[k++]<<8); - - if (i == myconnectindex) - { j += ((l&1)<<1)+(l&2)+((l&4)>>2)+((l&8)>>3)+((l&16)>>4)+((l&32)>>5)+((l&64)>>6)+((l&128)>>7)+((l&256)>>8)+((l&512)>>9)+((l&1024)>>10)+((l&2048)>>11); continue; } - - copybufbyte(&osyn[i],&nsyn[i],sizeof(input)); - if (l&1) nsyn[i].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; - if (l&2) nsyn[i].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; - if (l&4) nsyn[i].avel = (signed char)packbuf[j++]; - if (l&8) nsyn[i].bits = ((nsyn[i].bits&0xffffff00)|((long)packbuf[j++])); - if (l&16) nsyn[i].bits = ((nsyn[i].bits&0xffff00ff)|((long)packbuf[j++])<<8); - if (l&32) nsyn[i].bits = ((nsyn[i].bits&0xff00ffff)|((long)packbuf[j++])<<16); - if (l&64) nsyn[i].bits = ((nsyn[i].bits&0x00ffffff)|((long)packbuf[j++])<<24); - if (l&128) nsyn[i].horz = (signed char)packbuf[j++]; - if (l&256) nsyn[i].extbits = ((nsyn[i].extbits&0xffffff00)|((long)packbuf[j++])); - if (l&512) nsyn[i].extbits = ((nsyn[i].extbits&0xffff00ff)|((long)packbuf[j++])<<8); - if (l&1024) nsyn[i].extbits = ((nsyn[i].extbits&0xff00ffff)|((long)packbuf[j++])<<16); - if (l&2048) nsyn[i].extbits = ((nsyn[i].extbits&0x00ffffff)|((long)packbuf[j++])<<24); - - if (nsyn[i].bits&(1<<26)) playerquitflag[i] = 0; - movefifoend[i]++; - } - - while (j != packbufleng) - { - for (i=connecthead;i>=0;i=connectpoint2[i]) - if (i != myconnectindex) - { - syncval[i][syncvalhead[i]&(MOVEFIFOSIZ-1)] = packbuf[j]; - syncvalhead[i]++; - } - j++; - } - - for (i=connecthead;i>=0;i=connectpoint2[i]) - if (i != myconnectindex) - for (j=1;j=0;i=connectpoint2[i]) if (i != other) sendpacket(i,packbuf,packbufleng); } - else if (((long)packbuf[1]) != myconnectindex) - { - //Master re-transmits message not intended for master - sendpacket((long)packbuf[1],packbuf,packbufleng); - break; - } - } + /* + j = packbuf[1]; + playerquitflag[j] = 0; - Bstrcpy(recbuf,packbuf+2); - recbuf[packbufleng-2] = 0; + j = -1; + for(i=connecthead;i>=0;i=connectpoint2[i]) + { + if (playerquitflag[i]) { j = i; continue; } - adduserquote(recbuf); - sound(EXITMENUSOUND); + if (i == connecthead) connecthead = connectpoint2[connecthead]; + else connectpoint2[j] = connectpoint2[i]; - pus = NUMPAGES; - pub = NUMPAGES; + numplayers--; + ud.multimode--; - break; + Bsprintf(buf,"%s is history!",ud.user_name[i]); + adduserquote(buf); - case 5: - //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]) - if (i != other) sendpacket(i,packbuf,packbufleng); + if (numplayers < 2) + sound(GENERIC_AMBIENCE17); - if (vote_map != -1 || vote_episode != -1 || voting != -1) - adduserquote("VOTE SUCCEEDED"); + if(i == 0 && networkmode == 0) */ + gameexit("Game aborted from menu; disconnected."); + // } - ud.m_level_number = ud.level_number = packbuf[1]; - ud.m_volume_number = ud.volume_number = packbuf[2]; - ud.m_player_skill = ud.player_skill = packbuf[3]; - ud.m_monsters_off = ud.monsters_off = packbuf[4]; - ud.m_respawn_monsters = ud.respawn_monsters = packbuf[5]; - ud.m_respawn_items = ud.respawn_items = packbuf[6]; - ud.m_respawn_inventory = ud.respawn_inventory = packbuf[7]; - ud.m_coop = packbuf[8]; - ud.m_marker = ud.marker = packbuf[9]; - ud.m_ffire = ud.ffire = packbuf[10]; - ud.m_noexits = ud.noexits = packbuf[11]; - - for (i=connecthead;i>=0;i=connectpoint2[i]) - { - resetweapons(i); - resetinventory(i); - } - - newgame(ud.volume_number,ud.level_number,ud.player_skill); - ud.coop = ud.m_coop; - - if (enterlevel(MODE_GAME)) backtomenu(); - - break; - case 6: - //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]) - if (i != other) sendpacket(i,packbuf,packbufleng); - - if (packbuf[2] != BYTEVERSION) - gameexit("\nYou cannot play Duke with different versions."); - - other = packbuf[1]; - - for (i=3;packbuf[i];i++) - ud.user_name[other][i-3] = packbuf[i]; - ud.user_name[other][i-3] = 0; - i++; - - j = i; //This used to be Duke packet #9... now concatenated with Duke packet #6 - for (;i-j<10;i++) ud.wchoice[other][i-j] = packbuf[i]; - - ps[other].aim_mode = packbuf[i++]; - ps[other].auto_aim = packbuf[i++]; - ps[other].weaponswitch = packbuf[i++]; - ps[other].palookup = ud.pcolor[other] = packbuf[i++]; - ud.pteam[other] = packbuf[i++]; - - /* if(ps[other].team != j && sprite[ps[other].i].picnum == APLAYER) - { - hittype[ps[other].i].extra = 1000; - hittype[ps[other].i].picnum = APLAYERTOP; - } */ - - break; - case 7: - //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]) - if (i != other) sendpacket(i,packbuf,packbufleng); - - if (numlumps == 0) break; - - if (SoundToggle == 0 || ud.lockout == 1 || FXDevice < 0) break; - rtsptr = (char *)RTS_GetSound(packbuf[1]-1); - if (*rtsptr == 'C') - FX_PlayVOC3D(rtsptr,0,0,0,255,-packbuf[1]); - else - FX_PlayWAV3D(rtsptr,0,0,0,255,-packbuf[1]); - rtsplaying = 7; - break; - case 16: - movefifoend[other] = movefifoplc = movefifosendplc = fakemovefifoplc = 0; - syncvalhead[other] = syncvaltottail = 0L; - case 17: - j = 1; + case 9: + //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]) + if (i != other) + sendpacket(i,packbuf,packbufleng); + } - if ((movefifoend[other]&(TIMERUPDATESIZ-1)) == 0) - if (other == connecthead) + Bstrcpy(boardfilename,packbuf+1); + boardfilename[packbufleng-1] = 0; + if (boardfilename[0] != 0) + { + if ((i = kopen4load(boardfilename,0)) < 0) + { + Bmemset(boardfilename,0,sizeof(boardfilename)); + sendboardname(); + } + else kclose(i); + } + + if (ud.m_level_number == 7 && ud.m_volume_number == 0 && boardfilename[0] == 0) + ud.m_level_number = 0; + + break; + + case 18: // map vote + + if (myconnectindex == connecthead) + { + //Master re-transmits message to all others + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + if (i != other) + sendpacket(i,packbuf,packbufleng); + } + + switch (packbuf[1]) + { + case 0: + if (voting == myconnectindex && gotvote[packbuf[2]] == 0) + { + gotvote[packbuf[2]] = 1; + votes[packbuf[2]] = packbuf[3]; + Bsprintf(tempbuf,"GOT VOTE FROM %s",ud.user_name[packbuf[2]]); + adduserquote(tempbuf); + } + break; + + case 1: // call map vote + voting = packbuf[2]; + vote_episode = packbuf[3]; + vote_map = packbuf[4]; + Bsprintf(tempbuf,"%s HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[packbuf[2]],level_names[packbuf[3]*11 + packbuf[4]],packbuf[3]+1,packbuf[4]+1); + adduserquote(tempbuf); + Bsprintf(tempbuf,"PRESS F1 TO VOTE YES, F2 TO VOTE NO"); + adduserquote(tempbuf); + Bmemset(votes,0,sizeof(votes)); + Bmemset(gotvote,0,sizeof(gotvote)); + gotvote[voting] = votes[voting] = 1; + break; + + case 2: // cancel map vote + if (voting == packbuf[2]) + { + voting = -1; + i = 0; + for (j=0;j=0;i=connectpoint2[i]) + if (i != other) sendpacket(i,packbuf,packbufleng); + + multiflag = 2; + multiwhat = 0; + multiwho = packbuf[2]; //other: need to send in m/s mode because of possible re-transmit + multipos = packbuf[1]; + loadplayer(multipos); + multiflag = 0; + break; + case 0: //[0] (receive master sync buffer) + j = 1; + + if ((movefifoend[other]&(TIMERUPDATESIZ-1)) == 0) for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) { + if (playerquitflag[i] == 0) continue; if (i == myconnectindex) otherminlag = (long)((signed char)packbuf[j]); j++; } - osyn = (input *)&inputfifo[(movefifoend[other]-1)&(MOVEFIFOSIZ-1)][0]; - nsyn = (input *)&inputfifo[(movefifoend[other])&(MOVEFIFOSIZ-1)][0]; + osyn = (input *)&inputfifo[(movefifoend[connecthead]-1)&(MOVEFIFOSIZ-1)][0]; + nsyn = (input *)&inputfifo[(movefifoend[connecthead])&(MOVEFIFOSIZ-1)][0]; - copybufbyte(&osyn[other],&nsyn[other],sizeof(input)); - k = packbuf[j++]; - k += (long)(packbuf[j++]<<8); + k = j; + for (i=connecthead;i>=0;i=connectpoint2[i]) + j += playerquitflag[i]+playerquitflag[i]; + for (i=connecthead;i>=0;i=connectpoint2[i]) + { + if (playerquitflag[i] == 0) continue; - if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; - if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; - if (k&4) nsyn[other].avel = (signed char)packbuf[j++]; - if (k&8) nsyn[other].bits = ((nsyn[other].bits&0xffffff00)|((long)packbuf[j++])); - if (k&16) nsyn[other].bits = ((nsyn[other].bits&0xffff00ff)|((long)packbuf[j++])<<8); - if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((long)packbuf[j++])<<16); - if (k&64) nsyn[other].bits = ((nsyn[other].bits&0x00ffffff)|((long)packbuf[j++])<<24); - if (k&128) nsyn[other].horz = (signed char)packbuf[j++]; - if (k&256) nsyn[other].extbits = ((nsyn[other].extbits&0xffffff00)|((long)packbuf[j++])); - if (k&512) nsyn[other].extbits = ((nsyn[other].extbits&0xffff00ff)|((long)packbuf[j++])<<8); - if (k&1024) nsyn[other].extbits = ((nsyn[other].extbits&0xff00ffff)|((long)packbuf[j++])<<16); - if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((long)packbuf[j++])<<24); - movefifoend[other]++; + l = packbuf[k++]; + l += (long)(packbuf[k++]<<8); - for (i=1;i>2)+((l&8)>>3)+((l&16)>>4)+((l&32)>>5)+((l&64)>>6)+((l&128)>>7)+((l&256)>>8)+((l&512)>>9)+((l&1024)>>10)+((l&2048)>>11); + continue; + } + + copybufbyte(&osyn[i],&nsyn[i],sizeof(input)); + if (l&1) nsyn[i].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; + if (l&2) nsyn[i].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; + if (l&4) nsyn[i].avel = (signed char)packbuf[j++]; + if (l&8) nsyn[i].bits = ((nsyn[i].bits&0xffffff00)|((long)packbuf[j++])); + if (l&16) nsyn[i].bits = ((nsyn[i].bits&0xffff00ff)|((long)packbuf[j++])<<8); + if (l&32) nsyn[i].bits = ((nsyn[i].bits&0xff00ffff)|((long)packbuf[j++])<<16); + if (l&64) nsyn[i].bits = ((nsyn[i].bits&0x00ffffff)|((long)packbuf[j++])<<24); + if (l&128) nsyn[i].horz = (signed char)packbuf[j++]; + if (l&256) nsyn[i].extbits = ((nsyn[i].extbits&0xffffff00)|((long)packbuf[j++])); + if (l&512) nsyn[i].extbits = ((nsyn[i].extbits&0xffff00ff)|((long)packbuf[j++])<<8); + if (l&1024) nsyn[i].extbits = ((nsyn[i].extbits&0xff00ffff)|((long)packbuf[j++])<<16); + if (l&2048) nsyn[i].extbits = ((nsyn[i].extbits&0x00ffffff)|((long)packbuf[j++])<<24); + + if (nsyn[i].bits&(1<<26)) playerquitflag[i] = 0; + movefifoend[i]++; + } + + while (j != packbufleng) + { + for (i=connecthead;i>=0;i=connectpoint2[i]) + if (i != myconnectindex) + { + syncval[i][syncvalhead[i]&(MOVEFIFOSIZ-1)] = packbuf[j]; + syncvalhead[i]++; + } + j++; + } + + for (i=connecthead;i>=0;i=connectpoint2[i]) + if (i != myconnectindex) + for (j=1;j packbufleng) - initprintf("INVALID GAME PACKET!!! (packet %d, %ld too many bytes)\n",packbuf[0],j-packbufleng); + while (j != packbufleng) + { + syncval[other][syncvalhead[other]&(MOVEFIFOSIZ-1)] = packbuf[j++]; + syncvalhead[other]++; + } - while (j != packbufleng) - { - syncval[other][syncvalhead[other]&(MOVEFIFOSIZ-1)] = packbuf[j++]; - syncvalhead[other]++; - } + for (i=1;i=0;i=connectpoint2[i]) + if (i != other) + sendpacket(i,packbuf,packbufleng); + } + else if (((long)packbuf[1]) != myconnectindex) + { + //Master re-transmits message not intended for master + sendpacket((long)packbuf[1],packbuf,packbufleng); + break; + } + } + + Bstrcpy(recbuf,packbuf+2); + recbuf[packbufleng-2] = 0; + + adduserquote(recbuf); + sound(EXITMENUSOUND); + + pus = NUMPAGES; + pub = NUMPAGES; + + break; + + case 5: + //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]) + if (i != other) sendpacket(i,packbuf,packbufleng); + + if (vote_map != -1 || vote_episode != -1 || voting != -1) + adduserquote("VOTE SUCCEEDED"); + + ud.m_level_number = ud.level_number = packbuf[1]; + ud.m_volume_number = ud.volume_number = packbuf[2]; + ud.m_player_skill = ud.player_skill = packbuf[3]; + ud.m_monsters_off = ud.monsters_off = packbuf[4]; + ud.m_respawn_monsters = ud.respawn_monsters = packbuf[5]; + ud.m_respawn_items = ud.respawn_items = packbuf[6]; + ud.m_respawn_inventory = ud.respawn_inventory = packbuf[7]; + ud.m_coop = packbuf[8]; + ud.m_marker = ud.marker = packbuf[9]; + ud.m_ffire = ud.ffire = packbuf[10]; + ud.m_noexits = ud.noexits = packbuf[11]; + + for (i=connecthead;i>=0;i=connectpoint2[i]) + { + resetweapons(i); + resetinventory(i); + } + + newgame(ud.volume_number,ud.level_number,ud.player_skill); + ud.coop = ud.m_coop; + + if (enterlevel(MODE_GAME)) backtomenu(); + + break; + case 6: + //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]) + if (i != other) sendpacket(i,packbuf,packbufleng); + + if (packbuf[2] != BYTEVERSION) + gameexit("\nYou cannot play Duke with different versions."); + + other = packbuf[1]; + + for (i=3;packbuf[i];i++) + ud.user_name[other][i-3] = packbuf[i]; + ud.user_name[other][i-3] = 0; + i++; + + j = i; //This used to be Duke packet #9... now concatenated with Duke packet #6 + for (;i-j<10;i++) ud.wchoice[other][i-j] = packbuf[i]; + + ps[other].aim_mode = packbuf[i++]; + ps[other].auto_aim = packbuf[i++]; + ps[other].weaponswitch = packbuf[i++]; + ps[other].palookup = ud.pcolor[other] = packbuf[i++]; + ud.pteam[other] = packbuf[i++]; + + /* if(ps[other].team != j && sprite[ps[other].i].picnum == APLAYER) + { + hittype[ps[other].i].extra = 1000; + hittype[ps[other].i].picnum = APLAYERTOP; + } */ + + break; + case 7: + //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]) + if (i != other) sendpacket(i,packbuf,packbufleng); + + if (numlumps == 0) break; + + if (SoundToggle == 0 || ud.lockout == 1 || FXDevice < 0) + break; + rtsptr = (char *)RTS_GetSound(packbuf[1]-1); + if (*rtsptr == 'C') + FX_PlayVOC3D(rtsptr,0,0,0,255,-packbuf[1]); + else + FX_PlayWAV3D(rtsptr,0,0,0,255,-packbuf[1]); + rtsplaying = 7; + break; + + case 16: + movefifoend[other] = movefifoplc = movefifosendplc = fakemovefifoplc = 0; + syncvalhead[other] = syncvaltottail = 0L; + case 17: + j = 1; + + if ((movefifoend[other]&(TIMERUPDATESIZ-1)) == 0) + if (other == connecthead) + for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) + { + if (i == myconnectindex) + otherminlag = (long)((signed char)packbuf[j]); + j++; + } + + osyn = (input *)&inputfifo[(movefifoend[other]-1)&(MOVEFIFOSIZ-1)][0]; + nsyn = (input *)&inputfifo[(movefifoend[other])&(MOVEFIFOSIZ-1)][0]; + + copybufbyte(&osyn[other],&nsyn[other],sizeof(input)); + k = packbuf[j++]; + k += (long)(packbuf[j++]<<8); + + if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; + if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; + if (k&4) nsyn[other].avel = (signed char)packbuf[j++]; + if (k&8) nsyn[other].bits = ((nsyn[other].bits&0xffffff00)|((long)packbuf[j++])); + if (k&16) nsyn[other].bits = ((nsyn[other].bits&0xffff00ff)|((long)packbuf[j++])<<8); + if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((long)packbuf[j++])<<16); + if (k&64) nsyn[other].bits = ((nsyn[other].bits&0x00ffffff)|((long)packbuf[j++])<<24); + if (k&128) nsyn[other].horz = (signed char)packbuf[j++]; + if (k&256) nsyn[other].extbits = ((nsyn[other].extbits&0xffffff00)|((long)packbuf[j++])); + if (k&512) nsyn[other].extbits = ((nsyn[other].extbits&0xffff00ff)|((long)packbuf[j++])<<8); + if (k&1024) nsyn[other].extbits = ((nsyn[other].extbits&0xff00ffff)|((long)packbuf[j++])<<16); + if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((long)packbuf[j++])<<24); + movefifoend[other]++; + + for (i=1;i packbufleng) + initprintf("INVALID GAME PACKET!!! (packet %d, %ld too many bytes)\n",packbuf[0],j-packbufleng); + + while (j != packbufleng) + { + syncval[other][syncvalhead[other]&(MOVEFIFOSIZ-1)] = packbuf[j++]; + syncvalhead[other]++; + } + + break; + case 127: + break; + + case 250: + playerreadyflag[other]++; + break; + case 255: + gameexit(" "); + break; } } } @@ -880,7 +922,8 @@ void faketimerhandler() if ((totalclock < ototalclock+TICSPERFRAME) || (ready2send == 0)) return; ototalclock += TICSPERFRAME; - getpackets(); if (getoutputcirclesize() >= 16) return; + getpackets(); + if (getoutputcirclesize() >= 16) return; for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) @@ -936,7 +979,8 @@ void faketimerhandler() if (((movefifoend[myconnectindex]-1)&(TIMERUPDATESIZ-1)) == 0) { - i = mymaxlag-bufferjitter; mymaxlag = 0; + i = mymaxlag-bufferjitter; + mymaxlag = 0; if (i > 0) bufferjitter += ((3+i)>>2); else if (i < 0) bufferjitter -= ((1-i)>>2); } @@ -958,7 +1002,8 @@ void faketimerhandler() else i = 0; totalclock -= TICSPERFRAME*i; - myminlag[connecthead] -= i; otherminlag += i; + myminlag[connecthead] -= i; + otherminlag += i; } if (myconnectindex == connecthead) @@ -1032,13 +1077,17 @@ void faketimerhandler() else i = 0; totalclock -= TICSPERFRAME*i; - myminlag[connecthead] -= i; otherminlag += i; + myminlag[connecthead] -= i; + otherminlag += i; for (i=connecthead;i>=0;i=connectpoint2[i]) myminlag[i] = 0x7fffffff; } - packbuf[0] = 1; packbuf[1] = 0; packbuf[2] = 0; j = 3; + packbuf[0] = 1; + packbuf[1] = 0; + packbuf[2] = 0; + j = 3; osyn = (input *)&inputfifo[(movefifoend[myconnectindex]-2)&(MOVEFIFOSIZ-1)][myconnectindex]; nsyn = (input *)&inputfifo[(movefifoend[myconnectindex]-1)&(MOVEFIFOSIZ-1)][myconnectindex]; @@ -1104,7 +1153,8 @@ void faketimerhandler() nsyn = (input *)&inputfifo[(movefifosendplc)&(MOVEFIFOSIZ-1)][0]; //MASTER -> SLAVE packet - packbuf[0] = 0; j = 1; + packbuf[0] = 0; + j = 1; //Fix timers and buffer/jitter value if ((movefifosendplc&(TIMERUPDATESIZ-1)) == 0) @@ -1179,7 +1229,11 @@ void faketimerhandler() } extern long cacnum; -typedef struct { long *hand, leng; char *lock ; } +typedef struct +{ + long *hand, leng; + char *lock ; +} cactype; extern cactype cac[]; @@ -1192,7 +1246,8 @@ void caches(void) if ((*cac[i].lock) >= 200) { Bsprintf(tempbuf,"Locked- %d: Leng:%ld, Lock:%d",i,cac[i].leng,*cac[i].lock); - printext256(0L,k,31,-1,tempbuf,1); k += 6; + printext256(0L,k,31,-1,tempbuf,1); + k += 6; } k += 6; @@ -1201,7 +1256,8 @@ void caches(void) if (lumplockbyte[i] >= 200) { Bsprintf(tempbuf,"RTS Locked %d:",i); - printext256(0L,k,31,-1,tempbuf,1); k += 6; + printext256(0L,k,31,-1,tempbuf,1); + k += 6; } @@ -1226,7 +1282,8 @@ void checksync(void) syncvaltottail++; for (i=connecthead;i>=0;i=connectpoint2[i]) if (syncvalhead[i] == syncvaltottail) break; - } while (i < 0); + } + while (i < 0); } if (connectpoint2[connecthead] < 0) syncstat = 0; @@ -1247,64 +1304,64 @@ void check_fta_sounds(short i) if (sprite[i].extra > 0) switch (dynamictostatic[PN]) { - case LIZTROOPONTOILET__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOP__STATIC: - spritesound(PRED_RECOG,i); - break; - case LIZMAN__STATIC: - case LIZMANSPITTING__STATIC: - case LIZMANFEEDING__STATIC: - case LIZMANJUMP__STATIC: - spritesound(CAPT_RECOG,i); - break; - case PIGCOP__STATIC: - case PIGCOPDIVE__STATIC: - spritesound(PIG_RECOG,i); - break; - case RECON__STATIC: - spritesound(RECO_RECOG,i); - break; - case DRONE__STATIC: - spritesound(DRON_RECOG,i); - break; - case COMMANDER__STATIC: - case COMMANDERSTAYPUT__STATIC: - spritesound(COMM_RECOG,i); - break; - case ORGANTIC__STATIC: - spritesound(TURR_RECOG,i); - break; - case OCTABRAIN__STATIC: - case OCTABRAINSTAYPUT__STATIC: - spritesound(OCTA_RECOG,i); - break; - case BOSS1__STATIC: - sound(BOS1_RECOG); - break; - case BOSS2__STATIC: - if (sprite[i].pal == 1) - sound(BOS2_RECOG); - else sound(WHIPYOURASS); - break; - case BOSS3__STATIC: - if (sprite[i].pal == 1) - sound(BOS3_RECOG); - else sound(RIPHEADNECK); - break; - case BOSS4__STATIC: - case BOSS4STAYPUT__STATIC: - if (sprite[i].pal == 1) - sound(BOS4_RECOG); - sound(BOSS4_FIRSTSEE); - break; - case GREENSLIME__STATIC: - spritesound(SLIM_RECOG,i); - break; + case LIZTROOPONTOILET__STATIC: + case LIZTROOPJUSTSIT__STATIC: + case LIZTROOPSHOOT__STATIC: + case LIZTROOPJETPACK__STATIC: + case LIZTROOPDUCKING__STATIC: + case LIZTROOPRUNNING__STATIC: + case LIZTROOP__STATIC: + spritesound(PRED_RECOG,i); + break; + case LIZMAN__STATIC: + case LIZMANSPITTING__STATIC: + case LIZMANFEEDING__STATIC: + case LIZMANJUMP__STATIC: + spritesound(CAPT_RECOG,i); + break; + case PIGCOP__STATIC: + case PIGCOPDIVE__STATIC: + spritesound(PIG_RECOG,i); + break; + case RECON__STATIC: + spritesound(RECO_RECOG,i); + break; + case DRONE__STATIC: + spritesound(DRON_RECOG,i); + break; + case COMMANDER__STATIC: + case COMMANDERSTAYPUT__STATIC: + spritesound(COMM_RECOG,i); + break; + case ORGANTIC__STATIC: + spritesound(TURR_RECOG,i); + break; + case OCTABRAIN__STATIC: + case OCTABRAINSTAYPUT__STATIC: + spritesound(OCTA_RECOG,i); + break; + case BOSS1__STATIC: + sound(BOS1_RECOG); + break; + case BOSS2__STATIC: + if (sprite[i].pal == 1) + sound(BOS2_RECOG); + else sound(WHIPYOURASS); + break; + case BOSS3__STATIC: + if (sprite[i].pal == 1) + sound(BOS3_RECOG); + else sound(RIPHEADNECK); + break; + case BOSS4__STATIC: + case BOSS4STAYPUT__STATIC: + if (sprite[i].pal == 1) + sound(BOS4_RECOG); + sound(BOSS4_FIRSTSEE); + break; + case GREENSLIME__STATIC: + spritesound(SLIM_RECOG,i); + break; } } @@ -1312,14 +1369,14 @@ inline short inventory(spritetype *s) { switch (dynamictostatic[s->picnum]) { - case FIRSTAID__STATIC: - case STEROIDS__STATIC: - case HEATSENSOR__STATIC: - case BOOTS__STATIC: - case JETPACK__STATIC: - case HOLODUKE__STATIC: - case AIRTANK__STATIC: - return 1; + case FIRSTAID__STATIC: + case STEROIDS__STATIC: + case HEATSENSOR__STATIC: + case BOOTS__STATIC: + case JETPACK__STATIC: + case HOLODUKE__STATIC: + case AIRTANK__STATIC: + return 1; } return 0; } @@ -1328,7 +1385,8 @@ inline int checkspriteflags(short sActor, int iType) { int i; - i = spriteflags[sprite[sActor].picnum]; i ^= actorspriteflags[sActor]; + i = spriteflags[sprite[sActor].picnum]; + i ^= actorspriteflags[sActor]; if (i & iType) return 1; else return 0; } @@ -1351,44 +1409,44 @@ inline short badguypic(short pn) switch (dynamictostatic[pn]) { - case SHARK__STATIC: - case RECON__STATIC: - case DRONE__STATIC: - case LIZTROOPONTOILET__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOPSTAYPUT__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOP__STATIC: - case OCTABRAIN__STATIC: - case COMMANDER__STATIC: - case COMMANDERSTAYPUT__STATIC: - case PIGCOP__STATIC: - case EGG__STATIC: - case PIGCOPSTAYPUT__STATIC: - case PIGCOPDIVE__STATIC: - case LIZMAN__STATIC: - case LIZMANSPITTING__STATIC: - case LIZMANFEEDING__STATIC: - case LIZMANJUMP__STATIC: - case ORGANTIC__STATIC: - case BOSS1__STATIC: - case BOSS2__STATIC: - case BOSS3__STATIC: - case BOSS4__STATIC: - //case GREENSLIME: - //case GREENSLIME+1: - //case GREENSLIME+2: - //case GREENSLIME+3: - //case GREENSLIME+4: - //case GREENSLIME+5: - //case GREENSLIME+6: - //case GREENSLIME+7: - case RAT__STATIC: - case ROTATEGUN__STATIC: - return 1; + case SHARK__STATIC: + case RECON__STATIC: + case DRONE__STATIC: + case LIZTROOPONTOILET__STATIC: + case LIZTROOPJUSTSIT__STATIC: + case LIZTROOPSTAYPUT__STATIC: + case LIZTROOPSHOOT__STATIC: + case LIZTROOPJETPACK__STATIC: + case LIZTROOPDUCKING__STATIC: + case LIZTROOPRUNNING__STATIC: + case LIZTROOP__STATIC: + case OCTABRAIN__STATIC: + case COMMANDER__STATIC: + case COMMANDERSTAYPUT__STATIC: + case PIGCOP__STATIC: + case EGG__STATIC: + case PIGCOPSTAYPUT__STATIC: + case PIGCOPDIVE__STATIC: + case LIZMAN__STATIC: + case LIZMANSPITTING__STATIC: + case LIZMANFEEDING__STATIC: + case LIZMANJUMP__STATIC: + case ORGANTIC__STATIC: + case BOSS1__STATIC: + case BOSS2__STATIC: + case BOSS3__STATIC: + case BOSS4__STATIC: + //case GREENSLIME: + //case GREENSLIME+1: + //case GREENSLIME+2: + //case GREENSLIME+3: + //case GREENSLIME+4: + //case GREENSLIME+5: + //case GREENSLIME+6: + //case GREENSLIME+7: + case RAT__STATIC: + case ROTATEGUN__STATIC: + return 1; } return 0; } @@ -1587,11 +1645,14 @@ void weapon_amounts(struct player_struct *p,long x,long y,long u) { if (u != -1) patchstatusbar(127,190,127+29,190+6); //original code: (135,190,135+8,190+6); - if (VOLUMEONE) { + if (VOLUMEONE) + { orderweaponnum(SHRINKER_WEAPON,x+39,y+12, (!p->gotweapon[SHRINKER_WEAPON]*9)+12-18* (cw == SHRINKER_WEAPON)); - } else { + } + else + { if (p->subweapon&(1<ammo_amount[GROW_WEAPON],max_ammo_amount[GROW_WEAPON], @@ -1608,11 +1669,14 @@ void weapon_amounts(struct player_struct *p,long x,long y,long u) { if (u != -1) patchstatusbar(158,178,162+29,178+6); //original code: (166,178,166+8,178+6); - if (VOLUMEONE) { + if (VOLUMEONE) + { orderweaponnum(DEVISTATOR_WEAPON,x+70,y, (!p->gotweapon[DEVISTATOR_WEAPON]*9)+12-18* (cw == DEVISTATOR_WEAPON)); - } else { + } + else + { weaponnum(DEVISTATOR_WEAPON,x+70,y, p->ammo_amount[DEVISTATOR_WEAPON],max_ammo_amount[DEVISTATOR_WEAPON], (!p->gotweapon[DEVISTATOR_WEAPON]*9)+12-18* @@ -1622,11 +1686,14 @@ void weapon_amounts(struct player_struct *p,long x,long y,long u) if (u&512) { if (u != -1) patchstatusbar(158,184,162+29,184+6); //original code: (166,184,166+8,184+6); - if (VOLUMEONE) { + if (VOLUMEONE) + { orderweaponnum(TRIPBOMB_WEAPON,x+70,y+6, (!p->gotweapon[TRIPBOMB_WEAPON]*9)+12-18* (cw == TRIPBOMB_WEAPON)); - } else { + } + else + { weaponnum(TRIPBOMB_WEAPON,x+70,y+6, p->ammo_amount[TRIPBOMB_WEAPON],max_ammo_amount[TRIPBOMB_WEAPON], (!p->gotweapon[TRIPBOMB_WEAPON]*9)+12-18* @@ -1637,11 +1704,14 @@ void weapon_amounts(struct player_struct *p,long x,long y,long u) if (u&65536L) { if (u != -1) patchstatusbar(158,190,162+29,190+6); //original code: (166,190,166+8,190+6); - if (VOLUMEONE) { + if (VOLUMEONE) + { orderweaponnum(-1,x+70,y+12, (!p->gotweapon[FREEZE_WEAPON]*9)+12-18* (cw == FREEZE_WEAPON)); - } else { + } + else + { weaponnum(-1,x+70,y+12, p->ammo_amount[FREEZE_WEAPON],max_ammo_amount[FREEZE_WEAPON], (!p->gotweapon[FREEZE_WEAPON]*9)+12-18* @@ -1728,13 +1798,20 @@ void displayinventory(struct player_struct *p) j = xoff = 0; - 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++; + 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); @@ -1757,20 +1834,27 @@ void displayinventory(struct player_struct *p) { switch (n&(1<= 400 && current_menu <= 405)) return; - ss = ud.screen_size; if (ss < 4) return; + ss = ud.screen_size; + if (ss < 4) return; if (getrendermode() >= 3) pus = NUMPAGES; // JBF 20040101: always redraw in GL if (ud.multimode > 1 && (gametype_flags[ud.coop] & GAMETYPE_FLAG_FRAGBAR)) { if (pus) - { displayfragbar(); } + { + displayfragbar(); + } else { for (i=connecthead;i>=0;i=connectpoint2[i]) - if (ps[i].frag != sbar.frag[i]) { displayfragbar(); break; } + if (ps[i].frag != sbar.frag[i]) + { + displayfragbar(); + break; + } } @@ -1854,30 +1945,39 @@ void coolgaugetext(short snum) rotatesprite(sbarx(37),sbary(200-28),sbarsc(65536L),0,AMMOBOX,0,21,10+16,0,0,xdim-1,ydim-1); - if (p->curr_weapon == HANDREMOTE_WEAPON) i = HANDBOMB_WEAPON; else i = p->curr_weapon; + if (p->curr_weapon == HANDREMOTE_WEAPON) i = HANDBOMB_WEAPON; + else i = p->curr_weapon; digitalnumber(53,200-17,p->ammo_amount[i],-16,10+16); - o = 158; permbit = 0; + o = 158; + permbit = 0; if (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); @@ -1886,20 +1986,30 @@ void coolgaugetext(short snum) j = 0x80000000; 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); @@ -1911,29 +2021,53 @@ void coolgaugetext(short snum) //DRAW/UPDATE FULL STATUS BAR: -if (pus) { pus = 0; u = -1; } + 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; } + 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 (sbar.shield_amount != p->shield_amount) { sbar.shield_amount = p->shield_amount; u |= 2; } + 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.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); } + 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;ifrag) { sbar.frag[myconnectindex] = p->frag; else u |= 65536L+1024; } } -if (sbar.inven_icon != p->inven_icon) { sbar.inven_icon = p->inven_icon; u |= (2048+4096+8192); } - if (sbar.holoduke_on != p->holoduke_on) { sbar.holoduke_on = p->holoduke_on; u |= (4096+8192); } - if (sbar.jetpack_on != p->jetpack_on) { sbar.jetpack_on = p->jetpack_on; u |= (4096+8192); } - if (sbar.heat_on != p->heat_on) { sbar.heat_on = p->heat_on; u |= (4096+8192); } - if (sbar.firstaid_amount != p->firstaid_amount) { sbar.firstaid_amount = p->firstaid_amount; u |= 8192; } - if (sbar.steroids_amount != p->steroids_amount) { sbar.steroids_amount = p->steroids_amount; u |= 8192; } - if (sbar.holoduke_amount != p->holoduke_amount) { sbar.holoduke_amount = p->holoduke_amount; u |= 8192; } - if (sbar.jetpack_amount != p->jetpack_amount) { sbar.jetpack_amount = p->jetpack_amount; u |= 8192; } - if (sbar.heat_amount != p->heat_amount) { sbar.heat_amount = p->heat_amount; u |= 8192; } - if (sbar.scuba_amount != p->scuba_amount) { sbar.scuba_amount = p->scuba_amount; u |= 8192; } - if (sbar.boot_amount != p->boot_amount) { sbar.boot_amount = p->boot_amount; u |= 8192; } + if (sbar.inven_icon != p->inven_icon) + { + sbar.inven_icon = p->inven_icon; + u |= (2048+4096+8192); + } + if (sbar.holoduke_on != p->holoduke_on) + { + sbar.holoduke_on = p->holoduke_on; + u |= (4096+8192); + } + if (sbar.jetpack_on != p->jetpack_on) + { + sbar.jetpack_on = p->jetpack_on; + u |= (4096+8192); + } + if (sbar.heat_on != p->heat_on) + { + sbar.heat_on = p->heat_on; + u |= (4096+8192); + } + if (sbar.firstaid_amount != p->firstaid_amount) + { + sbar.firstaid_amount = p->firstaid_amount; + u |= 8192; + } + if (sbar.steroids_amount != p->steroids_amount) + { + sbar.steroids_amount = p->steroids_amount; + u |= 8192; + } + if (sbar.holoduke_amount != p->holoduke_amount) + { + sbar.holoduke_amount = p->holoduke_amount; + u |= 8192; + } + if (sbar.jetpack_amount != p->jetpack_amount) + { + sbar.jetpack_amount = p->jetpack_amount; + u |= 8192; + } + if (sbar.heat_amount != p->heat_amount) + { + sbar.heat_amount = p->heat_amount; + u |= 8192; + } + if (sbar.scuba_amount != p->scuba_amount) + { + sbar.scuba_amount = p->scuba_amount; + u |= 8192; + } + if (sbar.boot_amount != p->boot_amount) + { + sbar.boot_amount = p->boot_amount; + u |= 8192; + } if (u == 0) return; //0 - update health @@ -2033,7 +2211,8 @@ if (sbar.inven_icon != p->inven_icon) { sbar.inven_icon = p->inven_icon; u |= (2 if (u != -1) patchstatusbar(196,SBY+17,219,SBY+17+11); if (p->curr_weapon != KNEE_WEAPON) { - if (p->curr_weapon == HANDREMOTE_WEAPON) i = HANDBOMB_WEAPON; else i = p->curr_weapon; + if (p->curr_weapon == HANDREMOTE_WEAPON) i = HANDBOMB_WEAPON; + else i = p->curr_weapon; digitalnumber(230-22,SBY+17,p->ammo_amount[i],-16,10+16); } } @@ -2042,33 +2221,47 @@ if (sbar.inven_icon != p->inven_icon) { sbar.inven_icon = p->inven_icon; u |= (2 { if (u != -1) { - if (u&(2048+4096)) { patchstatusbar(231,SBY+13,265,SBY+13+18); } - else { patchstatusbar(250,SBY+24,261,SBY+24+6); } + 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) { - o = 0; permbit = 128; + o = 0; + permbit = 128; if (u&(2048+4096)) { 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); @@ -2078,14 +2271,17 @@ if (sbar.inven_icon != p->inven_icon) { sbar.inven_icon = p->inven_icon; u |= (2 { 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); @@ -2094,20 +2290,27 @@ if (sbar.inven_icon != p->inven_icon) { sbar.inven_icon = p->inven_icon; u |= (2 { 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); } @@ -2187,14 +2390,17 @@ 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; - quotebotgoal = j; j = quotebot; + quotebotgoal = j; + j = quotebot; for (i=0;i TEXTWRAPLEN) { @@ -2217,7 +2423,8 @@ void operatefta(void) if (GTFLAGS(GAMETYPE_FLAG_FRAGBAR) && ud.screen_size > 0 && ud.multimode > 1) { - j = 0; k = 8; + j = 0; + k = 8; for (i=connecthead;i>=0;i=connectpoint2[i]) if (i > j) j = i; @@ -2280,12 +2487,14 @@ void FTA(short q,struct player_struct *p) OSD_Printf("%s\n",strip_color_codes(fta_quotes[q])); } } - } else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,p->ftq); + } + else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,p->ftq); } void showtwoscreens(void) { - if (!VOLUMEALL) { + if (!VOLUMEALL) + { setview(0,0,xdim-1,ydim-1); flushperms(); //ps[myconnectindex].palette = palette; @@ -2293,14 +2502,24 @@ void showtwoscreens(void) fadepal(0,0,0, 0,64,7); 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(); } + IFISSOFTMODE fadepal(0,0,0, 63,0,-7); + else nextpage(); + 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(); } + IFISSOFTMODE fadepal(0,0,0, 63,0,-7); + else nextpage(); + while (!KB_KeyWaiting()) + { + handleevents(); + getpackets(); + } } @@ -2333,7 +2552,10 @@ void gameexit(char *t) } if (ud.recstat == 1) closedemowrite(); -else if (ud.recstat == 2) { if (frecfilep) fclose(frecfilep); } // JBF: fixes crash on demo playback + else if (ud.recstat == 2) + { + if (frecfilep) fclose(frecfilep); + } // JBF: fixes crash on demo playback if (!qe && !cp) { @@ -2356,7 +2578,8 @@ else if (ud.recstat == 2) { if (frecfilep) fclose(frecfilep); } // JBF: fixes cr //binscreen(); // if(*t == ' ' && *(t+1) == 0) *t = 0; //printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - if (!(t[0] == ' ' && t[1] == 0)) { + if (!(t[0] == ' ' && t[1] == 0)) + { wm_msgbox(HEAD2, t); } } @@ -2401,7 +2624,8 @@ short strget_(int small,short x,short y,char *t,short dalen,short c) else if (ch >= 32 && inputloc < dalen && ch < 127) { ch = Btoupper(ch); - if (c != 997 || (ch >= '0' && ch <= '9')) { // JBF 20040508: so we can have numeric only if we want + if (c != 997 || (ch >= '0' && ch <= '9')) + { // JBF 20040508: so we can have numeric only if we want *(t+inputloc) = ch; *(t+inputloc+1) = 0; inputloc++; @@ -2529,25 +2753,30 @@ void typemode(void) else if (sendmessagecommand == -1) { j = 50; - gametext(320>>1,j,"SEND MESSAGE TO...",0,2+8+16); j += 8; + gametext(320>>1,j,"SEND MESSAGE TO...",0,2+8+16); + j += 8; for (i=connecthead;i>=0;i=connectpoint2[i]) { if (i == myconnectindex) { minitextshade((320>>1)-40+1,j+1,"A/ENTER - ALL",26,0,2+8+16); - minitext((320>>1)-40,j,"A/ENTER - ALL",0,2+8+16); j += 7; + minitext((320>>1)-40,j,"A/ENTER - ALL",0,2+8+16); + j += 7; } else { Bsprintf(buf," %d - %s",i+1,ud.user_name[i]); minitextshade((320>>1)-40-6+1,j+1,buf,26,0,2+8+16); - minitext((320>>1)-40-6,j,buf,0,2+8+16); j += 7; + minitext((320>>1)-40-6,j,buf,0,2+8+16); + j += 7; } } minitextshade((320>>1)-40-4+1,j+1," ESC - Abort",26,0,2+8+16); - minitext((320>>1)-40-4,j," ESC - Abort",0,2+8+16); j += 7; + minitext((320>>1)-40-4,j," ESC - Abort",0,2+8+16); + j += 7; - if (ud.screen_size > 0) j = 200-45; else j = 200-8; + if (ud.screen_size > 0) j = 200-45; + else j = 200-8; mpgametext(j,typebuf,0,2+8+16); if (KB_KeyWaiting()) @@ -2586,7 +2815,8 @@ 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) @@ -2648,11 +2878,13 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) startwall = sector[i].wallptr; endwall = sector[i].wallptr + sector[i].wallnum; - z1 = sector[i].ceilingz; z2 = sector[i].floorz; + z1 = sector[i].ceilingz; + z2 = sector[i].floorz; for (j=startwall,wal=&wall[startwall];jnextwall; if (k < 0) continue; + k = wal->nextwall; + if (k < 0) continue; //if ((show2dwall[j>>3]&(1<<(j&7))) == 0) continue; //if ((k > j) && ((show2dwall[k>>3]&(1<<(k&7))) > 0)) continue; @@ -2668,12 +2900,14 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) col = 24; else continue; - ox = wal->x-cposx; oy = wal->y-cposy; + ox = wal->x-cposx; + oy = wal->y-cposy; x1 = dmulscale16(ox,xvect,-oy,yvect)+(xdim<<11); y1 = dmulscale16(oy,xvect2,ox,yvect2)+(ydim<<11); wal2 = &wall[wal->point2]; - ox = wal2->x-cposx; oy = wal2->y-cposy; + ox = wal2->x-cposx; + oy = wal2->y-cposy; x2 = dmulscale16(ox,xvect,-oy,yvect)+(xdim<<11); y2 = dmulscale16(oy,xvect2,ox,yvect2)+(ydim<<11); @@ -2701,108 +2935,129 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) 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); - y1 = dmulscale16(oy,xvect2,ox,yvect2); - - ox = (sintable[(spr->ang+512)&2047]>>7); - oy = (sintable[(spr->ang)&2047]>>7); - x2 = dmulscale16(ox,xvect,-oy,yvect); - y2 = dmulscale16(oy,xvect,ox,yvect); - - x3 = mulscale16(x2,yxaspect); - y3 = mulscale16(y2,yxaspect); - - drawline256(x1-x2+(xdim<<11),y1-y3+(ydim<<11), - x1+x2+(xdim<<11),y1+y3+(ydim<<11),col); - drawline256(x1-y2+(xdim<<11),y1+x3+(ydim<<11), - x1+x2+(xdim<<11),y1+y3+(ydim<<11),col); - drawline256(x1+y2+(xdim<<11),y1-x3+(ydim<<11), - x1+x2+(xdim<<11),y1+y3+(ydim<<11),col); - break; - - case 16: - if (spr->picnum == LASERLINE) - { - x1 = sprx; y1 = spry; - tilenum = spr->picnum; - xoff = (long)((signed char)((picanm[tilenum]>>8)&255))+((long)spr->xoffset); - if ((spr->cstat&4) > 0) xoff = -xoff; - k = spr->ang; l = spr->xrepeat; - dax = sintable[k&2047]*l; day = sintable[(k+1536)&2047]*l; - l = tilesizx[tilenum]; k = (l>>1)+xoff; - x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l); - y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l); - - ox = x1-cposx; oy = y1-cposy; + ox = sprx-cposx; + oy = spry-cposy; x1 = dmulscale16(ox,xvect,-oy,yvect); y1 = dmulscale16(oy,xvect2,ox,yvect2); - ox = x2-cposx; oy = y2-cposy; + ox = (sintable[(spr->ang+512)&2047]>>7); + oy = (sintable[(spr->ang)&2047]>>7); + x2 = dmulscale16(ox,xvect,-oy,yvect); + y2 = dmulscale16(oy,xvect,ox,yvect); + + x3 = mulscale16(x2,yxaspect); + y3 = mulscale16(y2,yxaspect); + + drawline256(x1-x2+(xdim<<11),y1-y3+(ydim<<11), + x1+x2+(xdim<<11),y1+y3+(ydim<<11),col); + drawline256(x1-y2+(xdim<<11),y1+x3+(ydim<<11), + x1+x2+(xdim<<11),y1+y3+(ydim<<11),col); + drawline256(x1+y2+(xdim<<11),y1-x3+(ydim<<11), + x1+x2+(xdim<<11),y1+y3+(ydim<<11),col); + break; + + case 16: + if (spr->picnum == LASERLINE) + { + x1 = sprx; + y1 = spry; + tilenum = spr->picnum; + xoff = (long)((signed char)((picanm[tilenum]>>8)&255))+((long)spr->xoffset); + if ((spr->cstat&4) > 0) xoff = -xoff; + k = spr->ang; + l = spr->xrepeat; + dax = sintable[k&2047]*l; + day = sintable[(k+1536)&2047]*l; + l = tilesizx[tilenum]; + k = (l>>1)+xoff; + x1 -= mulscale16(dax,k); + x2 = x1+mulscale16(dax,l); + y1 -= mulscale16(day,k); + y2 = y1+mulscale16(day,l); + + ox = x1-cposx; + oy = y1-cposy; + x1 = dmulscale16(ox,xvect,-oy,yvect); + y1 = dmulscale16(oy,xvect2,ox,yvect2); + + ox = x2-cposx; + oy = y2-cposy; + x2 = dmulscale16(ox,xvect,-oy,yvect); + y2 = dmulscale16(oy,xvect2,ox,yvect2); + + drawline256(x1+(xdim<<11),y1+(ydim<<11), + x2+(xdim<<11),y2+(ydim<<11),col); + } + + break; + + case 32: + + tilenum = spr->picnum; + xoff = (long)((signed char)((picanm[tilenum]>>8)&255))+((long)spr->xoffset); + yoff = (long)((signed char)((picanm[tilenum]>>16)&255))+((long)spr->yoffset); + if ((spr->cstat&4) > 0) xoff = -xoff; + if ((spr->cstat&8) > 0) yoff = -yoff; + + k = spr->ang; + cosang = sintable[(k+512)&2047]; + sinang = sintable[k]; + xspan = tilesizx[tilenum]; + xrepeat = spr->xrepeat; + yspan = tilesizy[tilenum]; + yrepeat = spr->yrepeat; + + dax = ((xspan>>1)+xoff)*xrepeat; + day = ((yspan>>1)+yoff)*yrepeat; + x1 = sprx + dmulscale16(sinang,dax,cosang,day); + y1 = spry + dmulscale16(sinang,day,-cosang,dax); + l = xspan*xrepeat; + x2 = x1 - mulscale16(sinang,l); + y2 = y1 + mulscale16(cosang,l); + l = yspan*yrepeat; + k = -mulscale16(cosang,l); + x3 = x2+k; + x4 = x1+k; + k = -mulscale16(sinang,l); + y3 = y2+k; + y4 = y1+k; + + ox = x1-cposx; + oy = y1-cposy; + x1 = dmulscale16(ox,xvect,-oy,yvect); + y1 = dmulscale16(oy,xvect2,ox,yvect2); + + ox = x2-cposx; + oy = y2-cposy; x2 = dmulscale16(ox,xvect,-oy,yvect); y2 = dmulscale16(oy,xvect2,ox,yvect2); + ox = x3-cposx; + oy = y3-cposy; + x3 = dmulscale16(ox,xvect,-oy,yvect); + y3 = dmulscale16(oy,xvect2,ox,yvect2); + + ox = x4-cposx; + oy = y4-cposy; + x4 = dmulscale16(ox,xvect,-oy,yvect); + y4 = dmulscale16(oy,xvect2,ox,yvect2); + drawline256(x1+(xdim<<11),y1+(ydim<<11), x2+(xdim<<11),y2+(ydim<<11),col); - } - break; + drawline256(x2+(xdim<<11),y2+(ydim<<11), + x3+(xdim<<11),y3+(ydim<<11),col); - case 32: + drawline256(x3+(xdim<<11),y3+(ydim<<11), + x4+(xdim<<11),y4+(ydim<<11),col); - tilenum = spr->picnum; - xoff = (long)((signed char)((picanm[tilenum]>>8)&255))+((long)spr->xoffset); - yoff = (long)((signed char)((picanm[tilenum]>>16)&255))+((long)spr->yoffset); - if ((spr->cstat&4) > 0) xoff = -xoff; - if ((spr->cstat&8) > 0) yoff = -yoff; + drawline256(x4+(xdim<<11),y4+(ydim<<11), + x1+(xdim<<11),y1+(ydim<<11),col); - k = spr->ang; - cosang = sintable[(k+512)&2047]; sinang = sintable[k]; - xspan = tilesizx[tilenum]; xrepeat = spr->xrepeat; - yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat; - - dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat; - x1 = sprx + dmulscale16(sinang,dax,cosang,day); - y1 = spry + dmulscale16(sinang,day,-cosang,dax); - l = xspan*xrepeat; - x2 = x1 - mulscale16(sinang,l); - y2 = y1 + mulscale16(cosang,l); - l = yspan*yrepeat; - k = -mulscale16(cosang,l); x3 = x2+k; x4 = x1+k; - k = -mulscale16(sinang,l); y3 = y2+k; y4 = y1+k; - - ox = x1-cposx; oy = y1-cposy; - x1 = dmulscale16(ox,xvect,-oy,yvect); - y1 = dmulscale16(oy,xvect2,ox,yvect2); - - ox = x2-cposx; oy = y2-cposy; - x2 = dmulscale16(ox,xvect,-oy,yvect); - y2 = dmulscale16(oy,xvect2,ox,yvect2); - - ox = x3-cposx; oy = y3-cposy; - x3 = dmulscale16(ox,xvect,-oy,yvect); - y3 = dmulscale16(oy,xvect2,ox,yvect2); - - ox = x4-cposx; oy = y4-cposy; - x4 = dmulscale16(ox,xvect,-oy,yvect); - y4 = dmulscale16(oy,xvect2,ox,yvect2); - - drawline256(x1+(xdim<<11),y1+(ydim<<11), - x2+(xdim<<11),y2+(ydim<<11),col); - - drawline256(x2+(xdim<<11),y2+(ydim<<11), - x3+(xdim<<11),y3+(ydim<<11),col); - - drawline256(x3+(xdim<<11),y3+(ydim<<11), - x4+(xdim<<11),y4+(ydim<<11),col); - - drawline256(x4+(xdim<<11),y4+(ydim<<11), - x1+(xdim<<11),y1+(ydim<<11),col); - - break; + break; } } } @@ -2826,16 +3081,22 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) if (tilesizy[wal->picnum] == 0) continue; if (j == k) - { x1 = x2; y1 = y2; } + { + x1 = x2; + y1 = y2; + } else { - ox = wal->x-cposx; oy = wal->y-cposy; + ox = wal->x-cposx; + oy = wal->y-cposy; x1 = dmulscale16(ox,xvect,-oy,yvect)+(xdim<<11); y1 = dmulscale16(oy,xvect2,ox,yvect2)+(ydim<<11); } - k = wal->point2; wal2 = &wall[k]; - ox = wal2->x-cposx; oy = wal2->y-cposy; + k = wal->point2; + wal2 = &wall[k]; + ox = wal2->x-cposx; + oy = wal2->y-cposy; x2 = dmulscale16(ox,xvect,-oy,yvect)+(xdim<<11); y2 = dmulscale16(oy,xvect2,ox,yvect2)+(ydim<<11); @@ -2847,9 +3108,15 @@ void drawoverheadmap(long cposx, long cposy, long czoom, short cang) { if (ud.scrollmode && p == screenpeek) continue; - ox = sprite[ps[p].i].x-cposx; oy = sprite[ps[p].i].y-cposy; + ox = sprite[ps[p].i].x-cposx; + oy = sprite[ps[p].i].y-cposy; daang = (sprite[ps[p].i].ang-cang)&2047; - if (p == screenpeek) { ox = 0; oy = 0; daang = 0; } + if (p == screenpeek) + { + ox = 0; + oy = 0; + daang = 0; + } x1 = mulscale(ox,xvect,16) - mulscale(oy,yvect,16); y1 = mulscale(oy,xvect2,16) + mulscale(ox,yvect2,16); @@ -2891,12 +3158,15 @@ void palto(char r,char g,char b,long e) //setbrightness(ud.brightness>>2,temparray); setpalettefade(r,g,b,e&127); if (getrendermode() >= 3) pus = pub = NUMPAGES; // JBF 20040110: redraw the status bar next time - if ((e&128) == 0) { + if ((e&128) == 0) + { nextpage(); for (tc = totalclock; totalclock < tc + 4; handleevents(), getpackets()); } } +extern char mdpause; + void displayrest(long smoothratio) { long a, i, j; @@ -2909,7 +3179,8 @@ void displayrest(long smoothratio) pp = &ps[screenpeek]; // this takes care of fullscreen tint for OpenGL - if (getrendermode() >= 3) { + if (getrendermode() >= 3) + { if (pp->palette == waterpal) tintr=0,tintg=0,tintb=63,tintf=8; else if (pp->palette == slimepal) tintr=0,tintg=63,tintb=0,tintf=8; } @@ -2932,7 +3203,8 @@ void displayrest(long smoothratio) 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; @@ -2940,7 +3212,8 @@ void displayrest(long smoothratio) fadef = pp->loogcnt>>1; dotint = 1; } - if (fadef > tintf) { + if (fadef > tintf) + { tintr = fader; tintg = fadeg; tintb = fadeb; @@ -2951,12 +3224,12 @@ void displayrest(long smoothratio) { switch (ud.show_help) { - case 1: - rotatesprite(0,0,65536L,0,TEXTSTORY,0,0,10+16+64, 0,0,xdim-1,ydim-1); - break; - case 2: - rotatesprite(0,0,65536L,0,F1HELP,0,0,10+16+64, 0,0,xdim-1,ydim-1); - break; + case 1: + rotatesprite(0,0,65536L,0,TEXTSTORY,0,0,10+16+64, 0,0,xdim-1,ydim-1); + break; + case 2: + rotatesprite(0,0,65536L,0,F1HELP,0,0,10+16+64, 0,0,xdim-1,ydim-1); + break; } if (KB_KeyPressed(sc_Escape)) @@ -3139,10 +3412,13 @@ void displayrest(long smoothratio) if (ud.coords) coords(screenpeek); + mdpause = ud.pause_on; + 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", @@ -3188,7 +3464,8 @@ void view(struct player_struct *pp, long *vx, long *vy,long *vz,short *vsectnum, return; } - hx = hitx-(*vx); hy = hity-(*vy); + hx = hitx-(*vx); + hy = hity-(*vy); if (klabs(nx)+klabs(ny) > klabs(hx)+klabs(hy)) { *vsectnum = hitsect; @@ -3232,20 +3509,25 @@ void drawbackground(void) 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) { + if (tilesizx[dapicnum] == 0 || tilesizy[dapicnum] == 0) + { pus = pub = NUMPAGES; return; } - y1 = 0; y2 = ydim; + y1 = 0; + y2 = ydim; 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 { @@ -3256,7 +3538,8 @@ void drawbackground(void) if (ud.multimode > 1) y1 += scale(ydim,8,200); if (ud.multimode > 4) y1 += scale(ydim,8,200); } - } else { + } else + { // when not rendering a game, fullscreen wipe #define MENUTILE bpp==8?MENUSCREEN:LOADSCREEN SetGameVarID(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1); @@ -3272,7 +3555,8 @@ void drawbackground(void) } y2 = scale(ydim,200-scale(tilesizy[BOTTOMSTATUSBAR],ud.statusbarscale,100),200); - if (ud.screen_size > 8) { + if (ud.screen_size > 8) + { // across top for (y=0; y> 1; - x1 = xdim-x2; x1 -= x1%tilesizx[dapicnum]; + x1 = xdim-x2; + x1 -= x1%tilesizx[dapicnum]; for (y=y1-y1%tilesizy[dapicnum]; y=0;j=nextspritestat[j]) { if (sprite[j].picnum==1 && sprite[j].lotag==k && sprite[j].hitag==sprite[floor1].hitag) { - floor2=j; ok++; break; + floor2=j; + ok++; + break; } } @@ -3503,17 +3794,17 @@ static void se40code(long x,long y,long z,long a,long h, long smoothratio) int t = sprite[i].lotag; switch (t) { - // case 40: - // case 41: - // SE40_Draw(i,x,y,a,smoothratio); - // break; - case 42: - case 43: - case 44: - case 45: - if (ps[screenpeek].cursectnum == sprite[i].sectnum) - SE40_Draw(i,x,y,z,a,h,smoothratio); - break; + // case 40: + // case 41: + // SE40_Draw(i,x,y,a,smoothratio); + // break; + case 42: + case 43: + case 44: + case 45: + if (ps[screenpeek].cursectnum == sprite[i].sectnum) + SE40_Draw(i,x,y,z,a,h,smoothratio); + break; } i = nextspritestat[i]; } @@ -3601,13 +3892,17 @@ void displayrooms(short snum,long smoothratio) } else if (getrendermode() == 0 && ((ud.screen_tilting && p->rotscrnang) || ud.detail==0)) { - if (ud.screen_tilting) tang = p->rotscrnang; else tang = 0; + if (ud.screen_tilting) tang = p->rotscrnang; + else tang = 0; - if (xres <= 320 && yres <= 240) { // JBF 20030807: Increased tilted-screen quality + if (xres <= 320 && yres <= 240) + { // JBF 20030807: Increased tilted-screen quality tiltcs = 1; tiltcx = 320; tiltcy = 200; - } else { + } + else + { tiltcs = 2; tiltcx = 640; tiltcy = 480; @@ -3625,15 +3920,20 @@ void displayrooms(short snum,long smoothratio) j = ((tiltcx-(60*tiltcs))>>(1-ud.detail)); 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; + startumost[i] = 1; + startumost[i+j] = 1; + startdmost[i] = 0; + startdmost[i+j] = 0; } } - i = (tang&511); if (i > 256) i = 512-i; + i = (tang&511); + if (i > 256) i = 512-i; i = sintable[i+512]*8 + sintable[i]*5L; setaspect(i>>1,yxaspect); - } else if (getrendermode() > 0 /*&& (p->rotscrnang || p->orotscrnang)*/) { + } + else if (getrendermode() > 0 /*&& (p->rotscrnang || p->orotscrnang)*/) + { setrollangle(p->orotscrnang + mulscale16(((p->rotscrnang - p->orotscrnang + 1024)&2047)-1024,smoothratio)); p->orotscrnang = p->rotscrnang; // JBF: save it for next time } @@ -3705,7 +4005,8 @@ void displayrooms(short snum,long smoothratio) #endif if ((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0) { - dst = 0x7fffffff; i = 0; + dst = 0x7fffffff; + i = 0; for (k=0;krotscrnang) || ud.detail==0)) { - if (ud.screen_tilting) tang = p->rotscrnang; else tang = 0; + if (ud.screen_tilting) tang = p->rotscrnang; + else tang = 0; - if (getrendermode() == 0) { + if (getrendermode() == 0) + { setviewback(); picanm[TILE_TILT] &= 0xff0000ff; - i = (tang&511); if (i > 256) i = 512-i; + i = (tang&511); + if (i > 256) i = 512-i; i = sintable[i+512]*8 + sintable[i]*5L; if ((1-ud.detail) == 0) i >>= 1; i>>=(tiltcs-1); // JBF 20030807 @@ -3951,50 +4255,51 @@ char wallswitchcheck(short i) // ACCESSSWITCH and ACCESSSWITCH2 are only active in 1 state so deal with them separately if ((PN == ACCESSSWITCH) || (PN == ACCESSSWITCH2)) return 1; //loop to catch both states of switches - for (j=0;j<=1;j++) { + for (j=0;j<=1;j++) + { switch (dynamictostatic[PN-j]) { - case HANDPRINTSWITCH__STATIC: - //case HANDPRINTSWITCH+1: - case ALIENSWITCH__STATIC: - //case ALIENSWITCH+1: - case MULTISWITCH__STATIC: - //case MULTISWITCH+1: - //case MULTISWITCH+2: - //case MULTISWITCH+3: - //case ACCESSSWITCH: - //case ACCESSSWITCH2: - case PULLSWITCH__STATIC: - //case PULLSWITCH+1: - case HANDSWITCH__STATIC: - //case HANDSWITCH+1: - case SLOTDOOR__STATIC: - //case SLOTDOOR+1: - case LIGHTSWITCH__STATIC: - //case LIGHTSWITCH+1: - case SPACELIGHTSWITCH__STATIC: - //case SPACELIGHTSWITCH+1: - case SPACEDOORSWITCH__STATIC: - //case SPACEDOORSWITCH+1: - case FRANKENSTINESWITCH__STATIC: - //case FRANKENSTINESWITCH+1: - case LIGHTSWITCH2__STATIC: - //case LIGHTSWITCH2+1: - case POWERSWITCH1__STATIC: - //case POWERSWITCH1+1: - case LOCKSWITCH1__STATIC: - //case LOCKSWITCH1+1: - case POWERSWITCH2__STATIC: - //case POWERSWITCH2+1: - case DIPSWITCH__STATIC: - //case DIPSWITCH+1: - case DIPSWITCH2__STATIC: - //case DIPSWITCH2+1: - case TECHSWITCH__STATIC: - //case TECHSWITCH+1: - case DIPSWITCH3__STATIC: - //case DIPSWITCH3+1: - return 1; + case HANDPRINTSWITCH__STATIC: + //case HANDPRINTSWITCH+1: + case ALIENSWITCH__STATIC: + //case ALIENSWITCH+1: + case MULTISWITCH__STATIC: + //case MULTISWITCH+1: + //case MULTISWITCH+2: + //case MULTISWITCH+3: + //case ACCESSSWITCH: + //case ACCESSSWITCH2: + case PULLSWITCH__STATIC: + //case PULLSWITCH+1: + case HANDSWITCH__STATIC: + //case HANDSWITCH+1: + case SLOTDOOR__STATIC: + //case SLOTDOOR+1: + case LIGHTSWITCH__STATIC: + //case LIGHTSWITCH+1: + case SPACELIGHTSWITCH__STATIC: + //case SPACELIGHTSWITCH+1: + case SPACEDOORSWITCH__STATIC: + //case SPACEDOORSWITCH+1: + case FRANKENSTINESWITCH__STATIC: + //case FRANKENSTINESWITCH+1: + case LIGHTSWITCH2__STATIC: + //case LIGHTSWITCH2+1: + case POWERSWITCH1__STATIC: + //case POWERSWITCH1+1: + case LOCKSWITCH1__STATIC: + //case LOCKSWITCH1+1: + case POWERSWITCH2__STATIC: + //case POWERSWITCH2+1: + case DIPSWITCH__STATIC: + //case DIPSWITCH+1: + case DIPSWITCH2__STATIC: + //case DIPSWITCH2+1: + case TECHSWITCH__STATIC: + //case TECHSWITCH+1: + case DIPSWITCH3__STATIC: + //case DIPSWITCH3+1: + return 1; } } return 0; @@ -4097,7 +4402,8 @@ short spawn(short j, short pn) } else if (((sp->picnum >= CAMERA1)&&(sp->picnum <= CAMERA1+3))||(sp->picnum==CAMERAPOLE)||(sp->picnum==GENERICPOLE)) { - if (sp->picnum != GENERICPOLE) { + if (sp->picnum != GENERICPOLE) + { sp->extra = 1; if (camerashitable) sp->cstat = 257; @@ -4109,9 +4415,11 @@ short spawn(short j, short pn) changespritestat(i,5); } - else { + else + { sp->pal = 0; - if (!(sp->picnum == CAMERAPOLE || sp->picnum == GENERICPOLE)) { + if (!(sp->picnum == CAMERAPOLE || sp->picnum == GENERICPOLE)) + { sp->picnum = CAMERA1; changespritestat(i,1); } @@ -4119,1719 +4427,1755 @@ short spawn(short j, short pn) } else switch (dynamictostatic[sp->picnum]) { - default: - if (actorscrptr[sp->picnum]) - { - if (j == -1 && sp->lotag > ud.player_skill) + default: + if (actorscrptr[sp->picnum]) { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; - } - - // Init the size - if (sp->xrepeat == 0 || sp->yrepeat == 0) - sp->xrepeat = sp->yrepeat = 1; - - if (actortype[sp->picnum] & 3) - { - if (ud.monsters_off == 1) + if (j == -1 && sp->lotag > ud.player_skill) { sp->xrepeat=sp->yrepeat=0; changespritestat(i,5); break; } - makeitfall(i); + // Init the size + if (sp->xrepeat == 0 || sp->yrepeat == 0) + sp->xrepeat = sp->yrepeat = 1; - if (actortype[sp->picnum] & 2) - hittype[i].actorstayput = sp->sectnum; - - ps[myconnectindex].max_actors_killed++; - sp->clipdist = 80; - if (j >= 0) + if (actortype[sp->picnum] & 3) { - if (sprite[j].picnum == RESPAWN) - hittype[i].tempang = sprite[i].pal = sprite[j].pal; + if (ud.monsters_off == 1) + { + sp->xrepeat=sp->yrepeat=0; + changespritestat(i,5); + break; + } + + makeitfall(i); + + if (actortype[sp->picnum] & 2) + hittype[i].actorstayput = sp->sectnum; + + ps[myconnectindex].max_actors_killed++; + sp->clipdist = 80; + if (j >= 0) + { + if (sprite[j].picnum == RESPAWN) + hittype[i].tempang = sprite[i].pal = sprite[j].pal; + changespritestat(i,1); + } + else changespritestat(i,2); + } + else + { + sp->clipdist = 40; + sp->owner = i; changespritestat(i,1); } - else changespritestat(i,2); + + hittype[i].timetosleep = 0; + + if (j >= 0) + sp->ang = sprite[j].ang; } - else - { - sp->clipdist = 40; - sp->owner = i; - changespritestat(i,1); - } - - hittype[i].timetosleep = 0; - - if (j >= 0) - sp->ang = sprite[j].ang; - } - break; - case FOF__STATIC: - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - break; - case WATERSPLASH2__STATIC: - if (j >= 0) - { - setsprite(i,sprite[j].x,sprite[j].y,sprite[j].z); - sp->xrepeat = sp->yrepeat = 8+(TRAND&7); - } - else sp->xrepeat = sp->yrepeat = 16+(TRAND&15); - - sp->shade = -16; - sp->cstat |= 128; - if (j >= 0) - { - 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) - sp->z = getflorzofslope(SECT,SX,SY); - } - - if (sector[sect].floorpicnum == FLOORSLIME || - sector[sect].ceilingpicnum == FLOORSLIME) - sp->pal = 7; - case NEON1__STATIC: - case NEON2__STATIC: - case NEON3__STATIC: - case NEON4__STATIC: - case NEON5__STATIC: - case NEON6__STATIC: - case DOMELITE__STATIC: - if (sp->picnum != WATERSPLASH2) - sp->cstat |= 257; - case NUKEBUTTON__STATIC: - if (sp->picnum == DOMELITE) - sp->cstat |= 257; - case JIBS1__STATIC: - case JIBS2__STATIC: - case JIBS3__STATIC: - case JIBS4__STATIC: - case JIBS5__STATIC: - case JIBS6__STATIC: - case HEADJIB1__STATIC: - case ARMJIB1__STATIC: - case LEGJIB1__STATIC: - case LIZMANHEAD1__STATIC: - case LIZMANARM1__STATIC: - case LIZMANLEG1__STATIC: - case DUKETORSO__STATIC: - case DUKEGUN__STATIC: - case DUKELEG__STATIC: - changespritestat(i,5); - break; - case TONGUE__STATIC: - if (j >= 0) - sp->ang = sprite[j].ang; - sp->z -= 38<<8; - sp->zvel = 256-(TRAND&511); - sp->xvel = 64-(TRAND&127); - changespritestat(i,4); - break; - case NATURALLIGHTNING__STATIC: - sp->cstat &= ~257; - sp->cstat |= 32768; - break; - case TRANSPORTERSTAR__STATIC: - case TRANSPORTERBEAM__STATIC: - if (j == -1) break; - if (sp->picnum == TRANSPORTERBEAM) - { - sp->xrepeat = 31; - sp->yrepeat = 1; - sp->z = sector[sprite[j].sectnum].floorz-(40<<8); - } - else - { - if (sprite[j].statnum == 4) - { - sp->xrepeat = 8; - sp->yrepeat = 8; - } - else - { - sp->xrepeat = 48; - sp->yrepeat = 64; - if (sprite[j].statnum == 10 || badguy(&sprite[j])) - sp->z -= (32<<8); - } - } - - sp->shade = -127; - sp->cstat = 128|2; - sp->ang = sprite[j].ang; - - sp->xvel = 128; - changespritestat(i,5); - ssp(i,CLIPMASK0); - setsprite(i,sp->x,sp->y,sp->z); - break; - - case FRAMEEFFECT1_13__STATIC: - if (PLUTOPAK) break; - case FRAMEEFFECT1__STATIC: - if (j >= 0) - { - sp->xrepeat = sprite[j].xrepeat; - sp->yrepeat = sprite[j].yrepeat; - T2 = sprite[j].picnum; - } - else sp->xrepeat = sp->yrepeat = 0; - - changespritestat(i,5); - - break; - - case LASERLINE__STATIC: - sp->yrepeat = 6; - sp->xrepeat = 32; - - if (lasermode == 1) - sp->cstat = 16 + 2; - else if (lasermode == 0 || lasermode == 2) - sp->cstat = 16; - else - { - sp->xrepeat = 0; - sp->yrepeat = 0; - } - - if (j >= 0) sp->ang = hittype[j].temp_data[5]+512; - changespritestat(i,5); - break; - - case FORCESPHERE__STATIC: - if (j == -1) - { - sp->cstat = (short) 32768; - changespritestat(i,2); - } - else - { - sp->xrepeat = sp->yrepeat = 1; - changespritestat(i,5); - } - break; - - case BLOOD__STATIC: - sp->xrepeat = sp->yrepeat = 16; - sp->z -= (26<<8); - 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; - - 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;} - - - } - 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) - { - 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) - { - 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; - case FECES__STATIC: - if (j >= 0) - sp->xrepeat = sp->yrepeat = 1; - changespritestat(i,5); - break; - - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: - sp->cstat |= 16; - sp->xrepeat = 7+(TRAND&7); - sp->yrepeat = 7+(TRAND&7); - sp->z -= (16<<8); - 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) - { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); break; - } - - sp->xrepeat=4; - sp->yrepeat=5; - - sp->owner = i; - sp->hitag = i; - - sp->xvel = 16; - ssp(i,CLIPMASK0); - hittype[i].temp_data[0] = 17; - hittype[i].temp_data[2] = 0; - hittype[i].temp_data[5] = sp->ang; - - case SPACEMARINE__STATIC: - if (sp->picnum == SPACEMARINE) - { - sp->extra = 20; - sp->cstat |= 257; - } - changespritestat(i,2); - break; - - case HYDRENT__STATIC: - case PANNEL1__STATIC: - case PANNEL2__STATIC: - case SATELITE__STATIC: - case FUELPOD__STATIC: - case SOLARPANNEL__STATIC: - case ANTENNA__STATIC: - case GRATE1__STATIC: - case CHAIR1__STATIC: - case CHAIR2__STATIC: - case CHAIR3__STATIC: - case BOTTLE1__STATIC: - case BOTTLE2__STATIC: - case BOTTLE3__STATIC: - case BOTTLE4__STATIC: - case BOTTLE5__STATIC: - case BOTTLE6__STATIC: - case BOTTLE7__STATIC: - case BOTTLE8__STATIC: - case BOTTLE10__STATIC: - case BOTTLE11__STATIC: - case BOTTLE12__STATIC: - case BOTTLE13__STATIC: - case BOTTLE14__STATIC: - case BOTTLE15__STATIC: - case BOTTLE16__STATIC: - case BOTTLE17__STATIC: - case BOTTLE18__STATIC: - case BOTTLE19__STATIC: - case OCEANSPRITE1__STATIC: - case OCEANSPRITE2__STATIC: - case OCEANSPRITE3__STATIC: - case OCEANSPRITE5__STATIC: - case MONK__STATIC: - case INDY__STATIC: - case LUKE__STATIC: - case JURYGUY__STATIC: - case SCALE__STATIC: - case VACUUM__STATIC: - case FANSPRITE__STATIC: - case CACTUS__STATIC: - case CACTUSBROKE__STATIC: - case HANGLIGHT__STATIC: - case FETUS__STATIC: - case FETUSBROKE__STATIC: - case CAMERALIGHT__STATIC: - case MOVIECAMERA__STATIC: - case IVUNIT__STATIC: - case POT1__STATIC: - case POT2__STATIC: - case POT3__STATIC: - case TRIPODCAMERA__STATIC: - case SUSHIPLATE1__STATIC: - case SUSHIPLATE2__STATIC: - case SUSHIPLATE3__STATIC: - case SUSHIPLATE4__STATIC: - case SUSHIPLATE5__STATIC: - case WAITTOBESEATED__STATIC: - case VASE__STATIC: - case PIPE1__STATIC: - case PIPE2__STATIC: - case PIPE3__STATIC: - case PIPE4__STATIC: - case PIPE5__STATIC: - case PIPE6__STATIC: - sp->clipdist = 32; - sp->cstat |= 257; - case OCEANSPRITE4__STATIC: - changespritestat(i,0); - break; - case FEMMAG1__STATIC: - case FEMMAG2__STATIC: - sp->cstat &= ~257; - changespritestat(i,0); - break; - case DUKETAG__STATIC: - case SIGN1__STATIC: - case SIGN2__STATIC: - if (ud.multimode < 2 && sp->pal) - { + case FOF__STATIC: sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); - } - else sp->pal = 0; - break; - case MASKWALL1__STATIC: - case MASKWALL2__STATIC: - case MASKWALL3__STATIC: - case MASKWALL4__STATIC: - case MASKWALL5__STATIC: - case MASKWALL6__STATIC: - case MASKWALL7__STATIC: - case MASKWALL8__STATIC: - case MASKWALL9__STATIC: - case MASKWALL10__STATIC: - case MASKWALL11__STATIC: - case MASKWALL12__STATIC: - case MASKWALL13__STATIC: - case MASKWALL14__STATIC: - case MASKWALL15__STATIC: - j = sp->cstat&60; - sp->cstat = j|1; - changespritestat(i,0); - break; - case FOOTPRINTS__STATIC: - case FOOTPRINTS2__STATIC: - case FOOTPRINTS3__STATIC: - case FOOTPRINTS4__STATIC: - if (j >= 0) + break; + case WATERSPLASH2__STATIC: + if (j >= 0) + { + setsprite(i,sprite[j].x,sprite[j].y,sprite[j].z); + sp->xrepeat = sp->yrepeat = 8+(TRAND&7); + } + else sp->xrepeat = sp->yrepeat = 16+(TRAND&15); + + sp->shade = -16; + sp->cstat |= 128; + if (j >= 0) + { + 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) + sp->z = getflorzofslope(SECT,SX,SY); + } + + if (sector[sect].floorpicnum == FLOORSLIME || + sector[sect].ceilingpicnum == FLOORSLIME) + sp->pal = 7; + case NEON1__STATIC: + case NEON2__STATIC: + case NEON3__STATIC: + case NEON4__STATIC: + case NEON5__STATIC: + case NEON6__STATIC: + case DOMELITE__STATIC: + if (sp->picnum != WATERSPLASH2) + sp->cstat |= 257; + case NUKEBUTTON__STATIC: + if (sp->picnum == DOMELITE) + sp->cstat |= 257; + case JIBS1__STATIC: + case JIBS2__STATIC: + case JIBS3__STATIC: + case JIBS4__STATIC: + case JIBS5__STATIC: + case JIBS6__STATIC: + case HEADJIB1__STATIC: + case ARMJIB1__STATIC: + case LEGJIB1__STATIC: + case LIZMANHEAD1__STATIC: + case LIZMANARM1__STATIC: + case LIZMANLEG1__STATIC: + case DUKETORSO__STATIC: + case DUKEGUN__STATIC: + case DUKELEG__STATIC: + changespritestat(i,5); + break; + case TONGUE__STATIC: + if (j >= 0) + sp->ang = sprite[j].ang; + sp->z -= 38<<8; + sp->zvel = 256-(TRAND&511); + sp->xvel = 64-(TRAND&127); + changespritestat(i,4); + break; + case NATURALLIGHTNING__STATIC: + sp->cstat &= ~257; + sp->cstat |= 32768; + break; + case TRANSPORTERSTAR__STATIC: + case TRANSPORTERBEAM__STATIC: + if (j == -1) break; + if (sp->picnum == TRANSPORTERBEAM) + { + sp->xrepeat = 31; + sp->yrepeat = 1; + sp->z = sector[sprite[j].sectnum].floorz-(40<<8); + } + else + { + if (sprite[j].statnum == 4) + { + sp->xrepeat = 8; + sp->yrepeat = 8; + } + else + { + sp->xrepeat = 48; + sp->yrepeat = 64; + if (sprite[j].statnum == 10 || badguy(&sprite[j])) + sp->z -= (32<<8); + } + } + + sp->shade = -127; + sp->cstat = 128|2; + sp->ang = sprite[j].ang; + + sp->xvel = 128; + changespritestat(i,5); + ssp(i,CLIPMASK0); + setsprite(i,sp->x,sp->y,sp->z); + break; + + case FRAMEEFFECT1_13__STATIC: + if (PLUTOPAK) break; + case FRAMEEFFECT1__STATIC: + if (j >= 0) + { + sp->xrepeat = sprite[j].xrepeat; + sp->yrepeat = sprite[j].yrepeat; + T2 = sprite[j].picnum; + } + else sp->xrepeat = sp->yrepeat = 0; + + changespritestat(i,5); + + break; + + case LASERLINE__STATIC: + sp->yrepeat = 6; + sp->xrepeat = 32; + + if (lasermode == 1) + sp->cstat = 16 + 2; + else if (lasermode == 0 || lasermode == 2) + sp->cstat = 16; + else + { + sp->xrepeat = 0; + sp->yrepeat = 0; + } + + if (j >= 0) sp->ang = hittype[j].temp_data[5]+512; + changespritestat(i,5); + break; + + case FORCESPHERE__STATIC: + if (j == -1) + { + sp->cstat = (short) 32768; + changespritestat(i,2); + } + else + { + sp->xrepeat = sp->yrepeat = 1; + changespritestat(i,5); + } + break; + + case BLOOD__STATIC: + sp->xrepeat = sp->yrepeat = 16; + sp->z -= (26<<8); + 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; - updatesector(sp->x+84,sp->y+84,&s1); + updatesector(sp->x+108,sp->y+108,&s1); if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) { - updatesector(sp->x-84,sp->y-84,&s1); + updatesector(sp->x-108,sp->y-108,&s1); if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) { - updatesector(sp->x+84,sp->y-84,&s1); + updatesector(sp->x+108,sp->y-108,&s1); if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) { - updatesector(sp->x-84,sp->y+84,&s1); + 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;} + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } } - else { sp->xrepeat = sp->yrepeat = 0;break;} + else + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } } - else { sp->xrepeat = sp->yrepeat = 0;break;} + else + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } - } - else { sp->xrepeat = sp->yrepeat = 0;break;} - - sp->cstat = 32+((ps[sprite[j].yvel].footprintcount&1)<<2); - sp->ang = sprite[j].ang; - } - - sp->z = sector[sect].floorz; - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) - sp->xrepeat = sp->yrepeat = 32; - - insertspriteq(i); - changespritestat(i,5); - break; - - case FEM1__STATIC: - case FEM2__STATIC: - case FEM3__STATIC: - case FEM4__STATIC: - case FEM5__STATIC: - case FEM6__STATIC: - case FEM7__STATIC: - case FEM8__STATIC: - case FEM9__STATIC: - case FEM10__STATIC: - case PODFEM1__STATIC: - case NAKED1__STATIC: - case STATUE__STATIC: - case TOUGHGAL__STATIC: - sp->yvel = sp->hitag; - sp->hitag = -1; - if (sp->picnum == PODFEM1) sp->extra <<= 1; - case BLOODYPOLE__STATIC: - - case QUEBALL__STATIC: - case STRIPEBALL__STATIC: - - if (sp->picnum == QUEBALL || sp->picnum == STRIPEBALL) - { - sp->cstat = 256; - sp->clipdist = 8; - } - else - { - sp->cstat |= 257; - sp->clipdist = 32; - } - - changespritestat(i,2); - break; - - case DUKELYINGDEAD__STATIC: - if (j >= 0 && sprite[j].picnum == APLAYER) - { - sp->xrepeat = sprite[j].xrepeat; - sp->yrepeat = sprite[j].yrepeat; - sp->shade = sprite[j].shade; - sp->pal = ps[sprite[j].yvel].palookup; - } - case DUKECAR__STATIC: - case HELECOPT__STATIC: - // if(sp->picnum == HELECOPT || sp->picnum == DUKECAR) sp->xvel = 1024; - sp->cstat = 0; - sp->extra = 1; - sp->xvel = 292; - sp->zvel = 360; - case RESPAWNMARKERRED__STATIC: - case BLIMP__STATIC: - - if (sp->picnum == RESPAWNMARKERRED) - { - sp->xrepeat = sp->yrepeat = 24; - if (j >= 0) sp->z = hittype[j].floorz; // -(1<<4); - } - else - { - sp->cstat |= 257; - sp->clipdist = 128; - } - case MIKE__STATIC: - if (sp->picnum == MIKE) - { - sp->yvel = sp->hitag; - sp->hitag = 0; - } - case WEATHERWARN__STATIC: - changespritestat(i,1); - break; - - case SPOTLITE__STATIC: - T1 = sp->x; - T2 = sp->y; - break; - case BULLETHOLE__STATIC: - sp->xrepeat = sp->yrepeat = 3; - sp->cstat = 16+(krand()&12); - insertspriteq(i); - case MONEY__STATIC: - case MAIL__STATIC: - case PAPER__STATIC: - if (sp->picnum == MONEY || sp->picnum == MAIL || sp->picnum == PAPER) - { - hittype[i].temp_data[0] = TRAND&2047; - sp->cstat = TRAND&12; - sp->xrepeat = sp->yrepeat = 8; - sp->ang = TRAND&2047; - } - changespritestat(i,5); - break; - - case VIEWSCREEN__STATIC: - case VIEWSCREEN2__STATIC: - sp->owner = i; - sp->lotag = 1; - sp->extra = 1; - changespritestat(i,6); - break; - - case SHELL__STATIC: //From the player - case SHOTGUNSHELL__STATIC: - if (j >= 0) - { - short snum,a; - - 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) - 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); } else { - a = sp->ang; - sp->z = sprite[j].z-PHEIGHT+(3<<8); + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; } - sp->x = sprite[j].x+(sintable[(a+512)&2047]>>7); - sp->y = sprite[j].y+(sintable[a&2047]>>7); - sp->shade = -8; - - if (sp->yvel == 1 || NAM) - { - sp->ang = a+512; - sp->xvel = 30; - } - else - { - sp->ang = a-512; - sp->xvel = 20; - } - sp->xrepeat=sp->yrepeat=4; - - changespritestat(i,5); } - break; - case RESPAWN__STATIC: - sp->extra = 66-13; - case MUSICANDSFX__STATIC: - if (ud.multimode < 2 && sp->pal == 1) + if (sector[SECT].lotag == 1) { - sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); break; } - sp->cstat = (short)32768; - changespritestat(i,11); - break; - case EXPLOSION2__STATIC: - case EXPLOSION2BOT__STATIC: - case BURNING__STATIC: - case BURNING2__STATIC: - case SMALLSMOKE__STATIC: - case SHRINKEREXPLOSION__STATIC: - case COOLEXPLOSION1__STATIC: - - if (j >= 0) + if (j >= 0 && sp->picnum != PUKE) { - sp->ang = sprite[j].ang; - sp->shade = -64; - sp->cstat = 128|(TRAND&4); + 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; } - - if (sp->picnum == EXPLOSION2 || sp->picnum == EXPLOSION2BOT) - { - sp->xrepeat = 48; - sp->yrepeat = 48; - sp->shade = -127; - sp->cstat |= 128; - } - else if (sp->picnum == SHRINKEREXPLOSION) - { - sp->xrepeat = 32; - sp->yrepeat = 32; - } - else if (sp->picnum == SMALLSMOKE) - { - // 64 "money" - sp->xrepeat = 24; - sp->yrepeat = 24; - } - else if (sp->picnum == BURNING || sp->picnum == BURNING2) - { - sp->xrepeat = 4; - sp->yrepeat = 4; - } - - if (j >= 0) - { - x = getflorzofslope(sp->sectnum,sp->x,sp->y); - if (sp->z > x-(12<<8)) - sp->z = x-(12<<8); - } - - changespritestat(i,5); - - break; - - case PLAYERONWATER__STATIC: - if (j >= 0) - { - sp->xrepeat = sprite[j].xrepeat; - sp->yrepeat = sprite[j].yrepeat; - sp->zvel = 128; - if (sector[sp->sectnum].lotag != 2) - sp->cstat |= 32768; - } - changespritestat(i,13); - break; - - case APLAYER__STATIC: - sp->xrepeat = sp->yrepeat = 0; - //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)) - changespritestat(i,5); - else - changespritestat(i,10); - break; - case WATERBUBBLE__STATIC: - if (j >= 0 && sprite[j].picnum == APLAYER) - sp->z -= (16<<8); - if (sp->picnum == WATERBUBBLE) - { + sp->cstat |= 32; + case FECES__STATIC: if (j >= 0) - sp->ang = sprite[j].ang; - sp->xrepeat = sp->yrepeat = 4; - } - else sp->xrepeat = sp->yrepeat = 32; + sp->xrepeat = sp->yrepeat = 1; + changespritestat(i,5); + break; - changespritestat(i,5); - break; + case BLOODSPLAT1__STATIC: + case BLOODSPLAT2__STATIC: + case BLOODSPLAT3__STATIC: + case BLOODSPLAT4__STATIC: + sp->cstat |= 16; + sp->xrepeat = 7+(TRAND&7); + sp->yrepeat = 7+(TRAND&7); + sp->z -= (16<<8); + if (j >= 0 && sprite[j].pal == 6) + sp->pal = 6; + insertspriteq(i); + changespritestat(i,5); + break; - case CRANE__STATIC: - - sp->cstat |= 64|257; - - sp->picnum += 2; - sp->z = sector[sect].ceilingz+(48<<8); - T5 = tempwallptr; - - msx[tempwallptr] = sp->x; - msy[tempwallptr] = sp->y; - msx[tempwallptr+2] = sp->z; - - s = headspritestat[0]; - while (s >= 0) - { - if (sprite[s].picnum == CRANEPOLE && SHT == (sprite[s].hitag)) + case TRIPBOMB__STATIC: + if (sp->lotag > ud.player_skill) { - msy[tempwallptr+2] = s; - - T2 = sprite[s].sectnum; - - sprite[s].xrepeat = 48; - sprite[s].yrepeat = 128; - - msx[tempwallptr+1] = sprite[s].x; - msy[tempwallptr+1] = sprite[s].y; - - sprite[s].x = sp->x; - sprite[s].y = sp->y; - sprite[s].z = sp->z; - sprite[s].shade = sp->shade; - - setsprite(s,sprite[s].x,sprite[s].y,sprite[s].z); + sp->xrepeat=sp->yrepeat=0; + changespritestat(i,5); break; } - s = nextspritestat[s]; - } - tempwallptr += 3; - sp->owner = -1; - sp->extra = 8; - changespritestat(i,6); - break; + sp->xrepeat=4; + sp->yrepeat=5; - case WATERDRIP__STATIC: - if ((j >= 0 && sprite[j].statnum == 10) || sprite[j].statnum == 1) - { - sp->shade = 32; - if (sprite[j].pal != 1) - { - sp->pal = 2; - sp->z -= (18<<8); - } - else sp->z -= (13<<8); - sp->ang = getangle(ps[connecthead].posx-sp->x,ps[connecthead].posy-sp->y); - sp->xvel = 48-(TRAND&31); + sp->owner = i; + sp->hitag = i; + + sp->xvel = 16; ssp(i,CLIPMASK0); - } - else if (j == -1) - { - sp->z += (4<<8); - T1 = sp->z; - T2 = TRAND&127; - } - case TRASH__STATIC: + hittype[i].temp_data[0] = 17; + hittype[i].temp_data[2] = 0; + hittype[i].temp_data[5] = sp->ang; - if (sp->picnum != WATERDRIP) - sp->ang = TRAND&2047; + case SPACEMARINE__STATIC: + if (sp->picnum == SPACEMARINE) + { + sp->extra = 20; + sp->cstat |= 257; + } + changespritestat(i,2); + break; - case WATERDRIPSPLASH__STATIC: + case HYDRENT__STATIC: + case PANNEL1__STATIC: + case PANNEL2__STATIC: + case SATELITE__STATIC: + case FUELPOD__STATIC: + case SOLARPANNEL__STATIC: + case ANTENNA__STATIC: + case GRATE1__STATIC: + case CHAIR1__STATIC: + case CHAIR2__STATIC: + case CHAIR3__STATIC: + case BOTTLE1__STATIC: + case BOTTLE2__STATIC: + case BOTTLE3__STATIC: + case BOTTLE4__STATIC: + case BOTTLE5__STATIC: + case BOTTLE6__STATIC: + case BOTTLE7__STATIC: + case BOTTLE8__STATIC: + case BOTTLE10__STATIC: + case BOTTLE11__STATIC: + case BOTTLE12__STATIC: + case BOTTLE13__STATIC: + case BOTTLE14__STATIC: + case BOTTLE15__STATIC: + case BOTTLE16__STATIC: + case BOTTLE17__STATIC: + case BOTTLE18__STATIC: + case BOTTLE19__STATIC: + case OCEANSPRITE1__STATIC: + case OCEANSPRITE2__STATIC: + case OCEANSPRITE3__STATIC: + case OCEANSPRITE5__STATIC: + case MONK__STATIC: + case INDY__STATIC: + case LUKE__STATIC: + case JURYGUY__STATIC: + case SCALE__STATIC: + case VACUUM__STATIC: + case FANSPRITE__STATIC: + case CACTUS__STATIC: + case CACTUSBROKE__STATIC: + case HANGLIGHT__STATIC: + case FETUS__STATIC: + case FETUSBROKE__STATIC: + case CAMERALIGHT__STATIC: + case MOVIECAMERA__STATIC: + case IVUNIT__STATIC: + case POT1__STATIC: + case POT2__STATIC: + case POT3__STATIC: + case TRIPODCAMERA__STATIC: + case SUSHIPLATE1__STATIC: + case SUSHIPLATE2__STATIC: + case SUSHIPLATE3__STATIC: + case SUSHIPLATE4__STATIC: + case SUSHIPLATE5__STATIC: + case WAITTOBESEATED__STATIC: + case VASE__STATIC: + case PIPE1__STATIC: + case PIPE2__STATIC: + case PIPE3__STATIC: + case PIPE4__STATIC: + case PIPE5__STATIC: + case PIPE6__STATIC: + sp->clipdist = 32; + sp->cstat |= 257; + case OCEANSPRITE4__STATIC: + changespritestat(i,0); + break; + case FEMMAG1__STATIC: + case FEMMAG2__STATIC: + sp->cstat &= ~257; + changespritestat(i,0); + break; + case DUKETAG__STATIC: + case SIGN1__STATIC: + case SIGN2__STATIC: + if (ud.multimode < 2 && sp->pal) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + } + else sp->pal = 0; + break; + case MASKWALL1__STATIC: + case MASKWALL2__STATIC: + case MASKWALL3__STATIC: + case MASKWALL4__STATIC: + case MASKWALL5__STATIC: + case MASKWALL6__STATIC: + case MASKWALL7__STATIC: + case MASKWALL8__STATIC: + case MASKWALL9__STATIC: + case MASKWALL10__STATIC: + case MASKWALL11__STATIC: + case MASKWALL12__STATIC: + case MASKWALL13__STATIC: + case MASKWALL14__STATIC: + case MASKWALL15__STATIC: + j = sp->cstat&60; + sp->cstat = j|1; + changespritestat(i,0); + break; + case FOOTPRINTS__STATIC: + case FOOTPRINTS2__STATIC: + case FOOTPRINTS3__STATIC: + case FOOTPRINTS4__STATIC: + if (j >= 0) + { + short s1; + s1 = sp->sectnum; - sp->xrepeat = 24; - sp->yrepeat = 24; + updatesector(sp->x+84,sp->y+84,&s1); + 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) + { + updatesector(sp->x+84,sp->y-84,&s1); + 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) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } - changespritestat(i,6); - break; + } + else + { + sp->xrepeat = sp->yrepeat = 0; + break; + } - case PLUG__STATIC: - sp->lotag = 9999; - changespritestat(i,6); - break; - case TOUCHPLATE__STATIC: - T3 = sector[sect].floorz; - if (sector[sect].lotag != 1 && sector[sect].lotag != 2) - sector[sect].floorz = sp->z; - if (sp->pal && ud.multimode > 1) - { - sp->xrepeat=sp->yrepeat=0; + + } + else + { + sp->xrepeat = sp->yrepeat = 0; + break; + } + + + } + else + { + sp->xrepeat = sp->yrepeat = 0; + break; + } + + sp->cstat = 32+((ps[sprite[j].yvel].footprintcount&1)<<2); + sp->ang = sprite[j].ang; + } + + sp->z = sector[sect].floorz; + if (sector[sect].lotag != 1 && sector[sect].lotag != 2) + sp->xrepeat = sp->yrepeat = 32; + + insertspriteq(i); changespritestat(i,5); break; - } - case WATERBUBBLEMAKER__STATIC: - if (sp->hitag && sp->picnum == WATERBUBBLEMAKER) { // JBF 20030913: Pisses off move(), eg. in bobsp2 - OSD_Printf("WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n", - i,sp->x,sp->y); - sp->hitag = 0; - } - sp->cstat |= 32768; - changespritestat(i,6); - break; - //case BOLT1: - //case BOLT1+1: - //case BOLT1+2: - //case BOLT1+3: - //case SIDEBOLT1: - //case SIDEBOLT1+1: - //case SIDEBOLT1+2: - //case SIDEBOLT1+3: - // T1 = sp->xrepeat; - // T2 = sp->yrepeat; - case MASTERSWITCH__STATIC: - if (sp->picnum == MASTERSWITCH) - sp->cstat |= 32768; - sp->yvel = 0; - changespritestat(i,6); - break; - case TARGET__STATIC: - case DUCK__STATIC: - case LETTER__STATIC: - sp->extra = 1; - sp->cstat |= 257; - changespritestat(i,1); - break; - case OCTABRAINSTAYPUT__STATIC: - case LIZTROOPSTAYPUT__STATIC: - case PIGCOPSTAYPUT__STATIC: - case LIZMANSTAYPUT__STATIC: - case BOSS1STAYPUT__STATIC: - case PIGCOPDIVE__STATIC: - case COMMANDERSTAYPUT__STATIC: - case BOSS4STAYPUT__STATIC: - hittype[i].actorstayput = sp->sectnum; - case BOSS1__STATIC: - case BOSS2__STATIC: - case BOSS3__STATIC: - case BOSS4__STATIC: - case ROTATEGUN__STATIC: - case GREENSLIME__STATIC: - if (sp->picnum == GREENSLIME) - sp->extra = 1; - case DRONE__STATIC: - case LIZTROOPONTOILET__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOP__STATIC: - case OCTABRAIN__STATIC: - case COMMANDER__STATIC: - case PIGCOP__STATIC: - case LIZMAN__STATIC: - case LIZMANSPITTING__STATIC: - case LIZMANFEEDING__STATIC: - case LIZMANJUMP__STATIC: - case ORGANTIC__STATIC: - case RAT__STATIC: - case SHARK__STATIC: - if (sp->pal == 0) - { - switch (dynamictostatic[sp->picnum]) - { - case LIZTROOPONTOILET__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOPSTAYPUT__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOP__STATIC: - sp->pal = 22; - break; - } - } + case FEM1__STATIC: + case FEM2__STATIC: + case FEM3__STATIC: + case FEM4__STATIC: + case FEM5__STATIC: + case FEM6__STATIC: + case FEM7__STATIC: + case FEM8__STATIC: + case FEM9__STATIC: + case FEM10__STATIC: + case PODFEM1__STATIC: + case NAKED1__STATIC: + case STATUE__STATIC: + case TOUGHGAL__STATIC: + sp->yvel = sp->hitag; + sp->hitag = -1; + if (sp->picnum == PODFEM1) sp->extra <<= 1; + case BLOODYPOLE__STATIC: - 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) - sp->pal = sprite[j].pal; - if (sp->pal) - { - sp->clipdist = 80; - sp->xrepeat = 40; - sp->yrepeat = 40; - } - else - { - sp->xrepeat = 80; - sp->yrepeat = 80; - sp->clipdist = 164; - } - } - else - { - if (sp->picnum != SHARK) - { - sp->xrepeat = 40; - sp->yrepeat = 40; - sp->clipdist = 80; - } - else - { - sp->xrepeat = 60; - sp->yrepeat = 60; - sp->clipdist = 40; - } - } + case QUEBALL__STATIC: + case STRIPEBALL__STATIC: - if (j >= 0) sp->lotag = 0; - - if ((sp->lotag > ud.player_skill) || ud.monsters_off == 1) - { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; - } - else - { - makeitfall(i); - - if (sp->picnum == RAT) + if (sp->picnum == QUEBALL || sp->picnum == STRIPEBALL) { - sp->ang = TRAND&2047; - sp->xrepeat = sp->yrepeat = 48; - sp->cstat = 0; + sp->cstat = 256; + sp->clipdist = 8; } else { sp->cstat |= 257; - - if (sp->picnum != SHARK) - ps[myconnectindex].max_actors_killed++; + sp->clipdist = 32; } - if (sp->picnum == ORGANTIC) sp->cstat |= 128; + changespritestat(i,2); + break; + case DUKELYINGDEAD__STATIC: + if (j >= 0 && sprite[j].picnum == APLAYER) + { + sp->xrepeat = sprite[j].xrepeat; + sp->yrepeat = sprite[j].yrepeat; + sp->shade = sprite[j].shade; + sp->pal = ps[sprite[j].yvel].palookup; + } + case DUKECAR__STATIC: + case HELECOPT__STATIC: + // if(sp->picnum == HELECOPT || sp->picnum == DUKECAR) sp->xvel = 1024; + sp->cstat = 0; + sp->extra = 1; + sp->xvel = 292; + sp->zvel = 360; + case RESPAWNMARKERRED__STATIC: + case BLIMP__STATIC: + + if (sp->picnum == RESPAWNMARKERRED) + { + sp->xrepeat = sp->yrepeat = 24; + if (j >= 0) sp->z = hittype[j].floorz; // -(1<<4); + } + else + { + sp->cstat |= 257; + sp->clipdist = 128; + } + case MIKE__STATIC: + if (sp->picnum == MIKE) + { + sp->yvel = sp->hitag; + sp->hitag = 0; + } + case WEATHERWARN__STATIC: + changespritestat(i,1); + break; + + case SPOTLITE__STATIC: + T1 = sp->x; + T2 = sp->y; + break; + case BULLETHOLE__STATIC: + sp->xrepeat = sp->yrepeat = 3; + sp->cstat = 16+(krand()&12); + insertspriteq(i); + case MONEY__STATIC: + case MAIL__STATIC: + case PAPER__STATIC: + if (sp->picnum == MONEY || sp->picnum == MAIL || sp->picnum == PAPER) + { + hittype[i].temp_data[0] = TRAND&2047; + sp->cstat = TRAND&12; + sp->xrepeat = sp->yrepeat = 8; + sp->ang = TRAND&2047; + } + changespritestat(i,5); + break; + + case VIEWSCREEN__STATIC: + case VIEWSCREEN2__STATIC: + sp->owner = i; + sp->lotag = 1; + sp->extra = 1; + changespritestat(i,6); + break; + + case SHELL__STATIC: //From the player + case SHOTGUNSHELL__STATIC: if (j >= 0) { - hittype[i].timetosleep = 0; - check_fta_sounds(i); - changespritestat(i,1); - } - else changespritestat(i,2); - } + short snum,a; - if (sp->picnum == ROTATEGUN) - sp->zvel = 0; + if (sprite[j].picnum == APLAYER) + { + snum = sprite[j].yvel; + a = ps[snum].ang-(TRAND&63)+8; //Fine tune - break; + T1 = TRAND&1; + 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); + } + else + { + a = sp->ang; + sp->z = sprite[j].z-PHEIGHT+(3<<8); + } - case LOCATORS__STATIC: - sp->cstat |= 32768; - changespritestat(i,7); - break; + sp->x = sprite[j].x+(sintable[(a+512)&2047]>>7); + sp->y = sprite[j].y+(sintable[a&2047]>>7); - case ACTIVATORLOCKED__STATIC: - case ACTIVATOR__STATIC: - sp->cstat = (short) 32768; - if (sp->picnum == ACTIVATORLOCKED) - sector[sp->sectnum].lotag |= 16384; - changespritestat(i,8); - break; + sp->shade = -8; - case DOORSHOCK__STATIC: - sp->cstat |= 1+256; - sp->shade = -12; - changespritestat(i,6); - break; + if (sp->yvel == 1 || NAM) + { + sp->ang = a+512; + sp->xvel = 30; + } + else + { + sp->ang = a-512; + sp->xvel = 20; + } + sp->xrepeat=sp->yrepeat=4; - case OOZ__STATIC: - case OOZ2__STATIC: - sp->shade = -12; - - if (j >= 0) - { - if (sprite[j].picnum == NUKEBARREL) - sp->pal = 8; - insertspriteq(i); - } - - changespritestat(i,1); - - getglobalz(i); - - j = (hittype[i].floorz-hittype[i].ceilingz)>>9; - - sp->yrepeat = j; - sp->xrepeat = 25-(j>>1); - sp->cstat |= (TRAND&4); - - break; - - case HEAVYHBOMB__STATIC: - if (j >= 0) - sp->owner = j; - else sp->owner = i; - sp->xrepeat = sp->yrepeat = 9; - sp->yvel = 4; - case REACTOR2__STATIC: - case REACTOR__STATIC: - case RECON__STATIC: - - if (sp->picnum == RECON) - { - if (sp->lotag > ud.player_skill) - { - sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); - return i; } - ps[myconnectindex].max_actors_killed++; - hittype[i].temp_data[5] = 0; - if (ud.monsters_off == 1) + break; + + case RESPAWN__STATIC: + sp->extra = 66-13; + case MUSICANDSFX__STATIC: + if (ud.multimode < 2 && sp->pal == 1) { sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); break; } - sp->extra = 130; - } - - if (sp->picnum == REACTOR || sp->picnum == REACTOR2) - sp->extra = impact_damage; - - CS |= 257; // Make it hitable - - if (ud.multimode < 2 && sp->pal != 0) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); + sp->cstat = (short)32768; + changespritestat(i,11); break; - } - sp->pal = 0; - SS = -17; - changespritestat(i,2); - break; + case EXPLOSION2__STATIC: + case EXPLOSION2BOT__STATIC: + case BURNING__STATIC: + case BURNING2__STATIC: + case SMALLSMOKE__STATIC: + case SHRINKEREXPLOSION__STATIC: + case COOLEXPLOSION1__STATIC: - case ATOMICHEALTH__STATIC: - case STEROIDS__STATIC: - case HEATSENSOR__STATIC: - case SHIELD__STATIC: - case AIRTANK__STATIC: - case TRIPBOMBSPRITE__STATIC: - case JETPACK__STATIC: - case HOLODUKE__STATIC: + if (j >= 0) + { + sp->ang = sprite[j].ang; + sp->shade = -64; + sp->cstat = 128|(TRAND&4); + } - case FIRSTGUNSPRITE__STATIC: - case CHAINGUNSPRITE__STATIC: - case SHOTGUNSPRITE__STATIC: - case RPGSPRITE__STATIC: - case SHRINKERSPRITE__STATIC: - case FREEZESPRITE__STATIC: - case DEVISTATORSPRITE__STATIC: + if (sp->picnum == EXPLOSION2 || sp->picnum == EXPLOSION2BOT) + { + sp->xrepeat = 48; + sp->yrepeat = 48; + sp->shade = -127; + sp->cstat |= 128; + } + else if (sp->picnum == SHRINKEREXPLOSION) + { + sp->xrepeat = 32; + sp->yrepeat = 32; + } + else if (sp->picnum == SMALLSMOKE) + { + // 64 "money" + sp->xrepeat = 24; + sp->yrepeat = 24; + } + else if (sp->picnum == BURNING || sp->picnum == BURNING2) + { + sp->xrepeat = 4; + sp->yrepeat = 4; + } - case SHOTGUNAMMO__STATIC: - case FREEZEAMMO__STATIC: - case HBOMBAMMO__STATIC: - case CRYSTALAMMO__STATIC: - case GROWAMMO__STATIC: - case BATTERYAMMO__STATIC: - case DEVISTATORAMMO__STATIC: - case RPGAMMO__STATIC: - case BOOTS__STATIC: - case AMMO__STATIC: - case AMMOLOTS__STATIC: - case COLA__STATIC: - case FIRSTAID__STATIC: - case SIXPAK__STATIC: + if (j >= 0) + { + x = getflorzofslope(sp->sectnum,sp->x,sp->y); + if (sp->z > x-(12<<8)) + sp->z = x-(12<<8); + } - if (j >= 0) - { - sp->lotag = 0; - sp->z -= (32<<8); - sp->zvel = -1024; - ssp(i,CLIPMASK0); - sp->cstat = TRAND&4; - } - else - { - sp->owner = i; - sp->cstat = 0; - } - - if ((ud.multimode < 2 && sp->pal != 0) || (sp->lotag > ud.player_skill)) - { - sp->xrepeat = sp->yrepeat = 0; changespritestat(i,5); + break; - } - sp->pal = 0; + case PLAYERONWATER__STATIC: + if (j >= 0) + { + sp->xrepeat = sprite[j].xrepeat; + sp->yrepeat = sprite[j].yrepeat; + sp->zvel = 128; + if (sector[sp->sectnum].lotag != 2) + sp->cstat |= 32768; + } + changespritestat(i,13); + break; - case ACCESSCARD__STATIC: - - if (sp->picnum == ATOMICHEALTH) - sp->cstat |= 128; - - if (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_ACCESSCARDSPRITES) && sp->picnum == ACCESSCARD) - { + case APLAYER__STATIC: sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); + //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)) + changespritestat(i,5); + else + changespritestat(i,10); break; - } - else - { - if (sp->picnum == AMMO) - sp->xrepeat = sp->yrepeat = 16; + case WATERBUBBLE__STATIC: + if (j >= 0 && sprite[j].picnum == APLAYER) + sp->z -= (16<<8); + if (sp->picnum == WATERBUBBLE) + { + if (j >= 0) + sp->ang = sprite[j].ang; + sp->xrepeat = sp->yrepeat = 4; + } else sp->xrepeat = sp->yrepeat = 32; - } - sp->shade = -17; - - if (j >= 0) changespritestat(i,1); - else - { - changespritestat(i,2); - makeitfall(i); - } - break; - - case WATERFOUNTAIN__STATIC: - SLT = 1; - - case TREE1__STATIC: - case TREE2__STATIC: - case TIRE__STATIC: - case CONE__STATIC: - case BOX__STATIC: - CS = 257; // Make it hitable - sprite[i].extra = 1; - changespritestat(i,6); - break; - - case FLOORFLAME__STATIC: - sp->shade = -127; - changespritestat(i,6); - break; - - case BOUNCEMINE__STATIC: - sp->owner = i; - sp->cstat |= 1+256; //Make it hitable - sp->xrepeat = sp->yrepeat = 24; - sp->shade = -127; - sp->extra = impact_damage<<2; - changespritestat(i,2); - break; - - - - case STEAM__STATIC: - if (j >= 0) - { - sp->ang = sprite[j].ang; - sp->cstat = 16+128+2; - sp->xrepeat=sp->yrepeat=1; - sp->xvel = -8; - ssp(i,CLIPMASK0); - } - case CEILINGSTEAM__STATIC: - changespritestat(i,6); - break; - - case SECTOREFFECTOR__STATIC: - sp->yvel = sector[sect].extra; - sp->cstat |= 32768; - sp->xrepeat = sp->yrepeat = 0; - - switch (sp->lotag) - { - case 28: - T6 = 65;// Delay for lightning + changespritestat(i,5); break; - case 7: // Transporters!!!! - case 23:// XPTR END - if (sp->lotag != 23) + + case CRANE__STATIC: + + sp->cstat |= 64|257; + + sp->picnum += 2; + sp->z = sector[sect].ceilingz+(48<<8); + T5 = tempwallptr; + + msx[tempwallptr] = sp->x; + msy[tempwallptr] = sp->y; + msx[tempwallptr+2] = sp->z; + + s = headspritestat[0]; + while (s >= 0) { - for (j=0;jcstat = 0; - changespritestat(i,9); - return i; - case 1: - sp->owner = -1; - T1 = 1; - break; - case 18: - - if (sp->ang == 512) - { - T2 = sector[sect].ceilingz; - if (sp->pal) - sector[sect].ceilingz = sp->z; - } - else - { - T2 = sector[sect].floorz; - if (sp->pal) - sector[sect].floorz = sp->z; - } - - sp->hitag <<= 2; - break; - - case 19: - sp->owner = -1; - break; - case 25: // Pistons - T4 = sector[sect].ceilingz; - T5 = 1; - sector[sect].ceilingz = sp->z; - setinterpolation(§or[sect].ceilingz); - break; - case 35: - sector[sect].ceilingz = sp->z; - break; - case 27: - if (ud.recstat == 1) - { - sp->xrepeat=sp->yrepeat=64; - sp->cstat &= 32767; - } - break; - case 12: - - T2 = sector[sect].floorshade; - T3 = sector[sect].ceilingshade; - break; - - case 13: - - T1 = sector[sect].ceilingz; - T2 = sector[sect].floorz; - - if (klabs(T1-sp->z) < klabs(T2-sp->z)) - sp->owner = 1; - else sp->owner = 0; - - if (sp->ang == 512) - { - if (sp->owner) - sector[sect].ceilingz = sp->z; - else - sector[sect].floorz = sp->z; - } - else - sector[sect].ceilingz = sector[sect].floorz = sp->z; - - if (sector[sect].ceilingstat&1) - { - sector[sect].ceilingstat ^= 1; - T4 = 1; - - if (!sp->owner && sp->ang==512) + if (sprite[s].picnum == CRANEPOLE && SHT == (sprite[s].hitag)) { - sector[sect].ceilingstat ^= 1; - T4 = 0; + msy[tempwallptr+2] = s; + + T2 = sprite[s].sectnum; + + sprite[s].xrepeat = 48; + sprite[s].yrepeat = 128; + + msx[tempwallptr+1] = sprite[s].x; + msy[tempwallptr+1] = sprite[s].y; + + sprite[s].x = sp->x; + sprite[s].y = sp->y; + sprite[s].z = sp->z; + sprite[s].shade = sp->shade; + + setsprite(s,sprite[s].x,sprite[s].y,sprite[s].z); + break; + } + s = nextspritestat[s]; + } + + tempwallptr += 3; + sp->owner = -1; + sp->extra = 8; + changespritestat(i,6); + break; + + case WATERDRIP__STATIC: + if ((j >= 0 && sprite[j].statnum == 10) || sprite[j].statnum == 1) + { + sp->shade = 32; + if (sprite[j].pal != 1) + { + sp->pal = 2; + sp->z -= (18<<8); + } + else sp->z -= (13<<8); + sp->ang = getangle(ps[connecthead].posx-sp->x,ps[connecthead].posy-sp->y); + sp->xvel = 48-(TRAND&31); + ssp(i,CLIPMASK0); + } + else if (j == -1) + { + sp->z += (4<<8); + T1 = sp->z; + T2 = TRAND&127; + } + case TRASH__STATIC: + + if (sp->picnum != WATERDRIP) + sp->ang = TRAND&2047; + + case WATERDRIPSPLASH__STATIC: + + sp->xrepeat = 24; + sp->yrepeat = 24; + + + changespritestat(i,6); + break; + + case PLUG__STATIC: + sp->lotag = 9999; + changespritestat(i,6); + break; + case TOUCHPLATE__STATIC: + T3 = sector[sect].floorz; + if (sector[sect].lotag != 1 && sector[sect].lotag != 2) + sector[sect].floorz = sp->z; + if (sp->pal && ud.multimode > 1) + { + sp->xrepeat=sp->yrepeat=0; + changespritestat(i,5); + break; + } + case WATERBUBBLEMAKER__STATIC: + if (sp->hitag && sp->picnum == WATERBUBBLEMAKER) + { // JBF 20030913: Pisses off move(), eg. in bobsp2 + OSD_Printf("WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n", + i,sp->x,sp->y); + sp->hitag = 0; + } + sp->cstat |= 32768; + changespritestat(i,6); + break; + //case BOLT1: + //case BOLT1+1: + //case BOLT1+2: + //case BOLT1+3: + //case SIDEBOLT1: + //case SIDEBOLT1+1: + //case SIDEBOLT1+2: + //case SIDEBOLT1+3: + // T1 = sp->xrepeat; + // T2 = sp->yrepeat; + case MASTERSWITCH__STATIC: + if (sp->picnum == MASTERSWITCH) + sp->cstat |= 32768; + sp->yvel = 0; + changespritestat(i,6); + break; + case TARGET__STATIC: + case DUCK__STATIC: + case LETTER__STATIC: + sp->extra = 1; + sp->cstat |= 257; + changespritestat(i,1); + break; + case OCTABRAINSTAYPUT__STATIC: + case LIZTROOPSTAYPUT__STATIC: + case PIGCOPSTAYPUT__STATIC: + case LIZMANSTAYPUT__STATIC: + case BOSS1STAYPUT__STATIC: + case PIGCOPDIVE__STATIC: + case COMMANDERSTAYPUT__STATIC: + case BOSS4STAYPUT__STATIC: + hittype[i].actorstayput = sp->sectnum; + case BOSS1__STATIC: + case BOSS2__STATIC: + case BOSS3__STATIC: + case BOSS4__STATIC: + case ROTATEGUN__STATIC: + case GREENSLIME__STATIC: + if (sp->picnum == GREENSLIME) + sp->extra = 1; + case DRONE__STATIC: + case LIZTROOPONTOILET__STATIC: + case LIZTROOPJUSTSIT__STATIC: + case LIZTROOPSHOOT__STATIC: + case LIZTROOPJETPACK__STATIC: + case LIZTROOPDUCKING__STATIC: + case LIZTROOPRUNNING__STATIC: + case LIZTROOP__STATIC: + case OCTABRAIN__STATIC: + case COMMANDER__STATIC: + case PIGCOP__STATIC: + case LIZMAN__STATIC: + case LIZMANSPITTING__STATIC: + case LIZMANFEEDING__STATIC: + case LIZMANJUMP__STATIC: + case ORGANTIC__STATIC: + case RAT__STATIC: + case SHARK__STATIC: + + if (sp->pal == 0) + { + switch (dynamictostatic[sp->picnum]) + { + case LIZTROOPONTOILET__STATIC: + case LIZTROOPSHOOT__STATIC: + case LIZTROOPJETPACK__STATIC: + case LIZTROOPDUCKING__STATIC: + case LIZTROOPRUNNING__STATIC: + case LIZTROOPSTAYPUT__STATIC: + case LIZTROOPJUSTSIT__STATIC: + case LIZTROOP__STATIC: + sp->pal = 22; + break; + } + } + + 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) + sp->pal = sprite[j].pal; + if (sp->pal) + { + sp->clipdist = 80; + sp->xrepeat = 40; + sp->yrepeat = 40; + } + else + { + sp->xrepeat = 80; + sp->yrepeat = 80; + sp->clipdist = 164; + } + } + else + { + if (sp->picnum != SHARK) + { + sp->xrepeat = 40; + sp->yrepeat = 40; + sp->clipdist = 80; + } + else + { + sp->xrepeat = 60; + sp->yrepeat = 60; + sp->clipdist = 40; + } + } + + if (j >= 0) sp->lotag = 0; + + if ((sp->lotag > ud.player_skill) || ud.monsters_off == 1) + { + sp->xrepeat=sp->yrepeat=0; + changespritestat(i,5); + break; + } + else + { + makeitfall(i); + + if (sp->picnum == RAT) + { + sp->ang = TRAND&2047; + sp->xrepeat = sp->yrepeat = 48; + sp->cstat = 0; + } + else + { + sp->cstat |= 257; + + if (sp->picnum != SHARK) + ps[myconnectindex].max_actors_killed++; } - sector[sect].ceilingshade = - sector[sect].floorshade; + if (sp->picnum == ORGANTIC) sp->cstat |= 128; - if (sp->ang==512) + if (j >= 0) { + hittype[i].timetosleep = 0; + check_fta_sounds(i); + changespritestat(i,1); + } + else changespritestat(i,2); + } + + if (sp->picnum == ROTATEGUN) + sp->zvel = 0; + + break; + + case LOCATORS__STATIC: + sp->cstat |= 32768; + changespritestat(i,7); + break; + + case ACTIVATORLOCKED__STATIC: + case ACTIVATOR__STATIC: + sp->cstat = (short) 32768; + if (sp->picnum == ACTIVATORLOCKED) + sector[sp->sectnum].lotag |= 16384; + changespritestat(i,8); + break; + + case DOORSHOCK__STATIC: + sp->cstat |= 1+256; + sp->shade = -12; + changespritestat(i,6); + break; + + case OOZ__STATIC: + case OOZ2__STATIC: + sp->shade = -12; + + if (j >= 0) + { + if (sprite[j].picnum == NUKEBARREL) + sp->pal = 8; + insertspriteq(i); + } + + changespritestat(i,1); + + getglobalz(i); + + j = (hittype[i].floorz-hittype[i].ceilingz)>>9; + + sp->yrepeat = j; + sp->xrepeat = 25-(j>>1); + sp->cstat |= (TRAND&4); + + break; + + case HEAVYHBOMB__STATIC: + if (j >= 0) + sp->owner = j; + else sp->owner = i; + sp->xrepeat = sp->yrepeat = 9; + sp->yvel = 4; + case REACTOR2__STATIC: + case REACTOR__STATIC: + case RECON__STATIC: + + if (sp->picnum == RECON) + { + if (sp->lotag > ud.player_skill) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + return i; + } + ps[myconnectindex].max_actors_killed++; + hittype[i].temp_data[5] = 0; + if (ud.monsters_off == 1) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + sp->extra = 130; + } + + if (sp->picnum == REACTOR || sp->picnum == REACTOR2) + sp->extra = impact_damage; + + CS |= 257; // Make it hitable + + if (ud.multimode < 2 && sp->pal != 0) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + sp->pal = 0; + SS = -17; + + changespritestat(i,2); + break; + + case ATOMICHEALTH__STATIC: + case STEROIDS__STATIC: + case HEATSENSOR__STATIC: + case SHIELD__STATIC: + case AIRTANK__STATIC: + case TRIPBOMBSPRITE__STATIC: + case JETPACK__STATIC: + case HOLODUKE__STATIC: + + case FIRSTGUNSPRITE__STATIC: + case CHAINGUNSPRITE__STATIC: + case SHOTGUNSPRITE__STATIC: + case RPGSPRITE__STATIC: + case SHRINKERSPRITE__STATIC: + case FREEZESPRITE__STATIC: + case DEVISTATORSPRITE__STATIC: + + case SHOTGUNAMMO__STATIC: + case FREEZEAMMO__STATIC: + case HBOMBAMMO__STATIC: + case CRYSTALAMMO__STATIC: + case GROWAMMO__STATIC: + case BATTERYAMMO__STATIC: + case DEVISTATORAMMO__STATIC: + case RPGAMMO__STATIC: + case BOOTS__STATIC: + case AMMO__STATIC: + case AMMOLOTS__STATIC: + case COLA__STATIC: + case FIRSTAID__STATIC: + case SIXPAK__STATIC: + + if (j >= 0) + { + sp->lotag = 0; + sp->z -= (32<<8); + sp->zvel = -1024; + ssp(i,CLIPMASK0); + sp->cstat = TRAND&4; + } + else + { + sp->owner = i; + sp->cstat = 0; + } + + if ((ud.multimode < 2 && sp->pal != 0) || (sp->lotag > ud.player_skill)) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + + sp->pal = 0; + + case ACCESSCARD__STATIC: + + if (sp->picnum == ATOMICHEALTH) + sp->cstat |= 128; + + if (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_ACCESSCARDSPRITES) && sp->picnum == ACCESSCARD) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + else + { + if (sp->picnum == AMMO) + sp->xrepeat = sp->yrepeat = 16; + else sp->xrepeat = sp->yrepeat = 32; + } + + sp->shade = -17; + + if (j >= 0) changespritestat(i,1); + else + { + changespritestat(i,2); + makeitfall(i); + } + break; + + case WATERFOUNTAIN__STATIC: + SLT = 1; + + case TREE1__STATIC: + case TREE2__STATIC: + case TIRE__STATIC: + case CONE__STATIC: + case BOX__STATIC: + CS = 257; // Make it hitable + sprite[i].extra = 1; + changespritestat(i,6); + break; + + case FLOORFLAME__STATIC: + sp->shade = -127; + changespritestat(i,6); + break; + + case BOUNCEMINE__STATIC: + sp->owner = i; + sp->cstat |= 1+256; //Make it hitable + sp->xrepeat = sp->yrepeat = 24; + sp->shade = -127; + sp->extra = impact_damage<<2; + changespritestat(i,2); + break; + + + + case STEAM__STATIC: + if (j >= 0) + { + sp->ang = sprite[j].ang; + sp->cstat = 16+128+2; + sp->xrepeat=sp->yrepeat=1; + sp->xvel = -8; + ssp(i,CLIPMASK0); + } + case CEILINGSTEAM__STATIC: + changespritestat(i,6); + break; + + case SECTOREFFECTOR__STATIC: + sp->yvel = sector[sect].extra; + sp->cstat |= 32768; + sp->xrepeat = sp->yrepeat = 0; + + switch (sp->lotag) + { + case 28: + T6 = 65;// Delay for lightning + break; + case 7: // Transporters!!!! + case 23:// XPTR END + if (sp->lotag != 23) + { + for (j=0;jcstat = 0; + changespritestat(i,9); + return i; + case 1: + sp->owner = -1; + T1 = 1; + break; + case 18: + + if (sp->ang == 512) + { + T2 = sector[sect].ceilingz; + if (sp->pal) + sector[sect].ceilingz = sp->z; + } + else + { + T2 = sector[sect].floorz; + if (sp->pal) + sector[sect].floorz = sp->z; + } + + sp->hitag <<= 2; + break; + + case 19: + sp->owner = -1; + break; + case 25: // Pistons + T4 = sector[sect].ceilingz; + T5 = 1; + sector[sect].ceilingz = sp->z; + setinterpolation(§or[sect].ceilingz); + break; + case 35: + sector[sect].ceilingz = sp->z; + break; + case 27: + if (ud.recstat == 1) + { + sp->xrepeat=sp->yrepeat=64; + sp->cstat &= 32767; + } + break; + case 12: + + T2 = sector[sect].floorshade; + T3 = sector[sect].ceilingshade; + break; + + case 13: + + T1 = sector[sect].ceilingz; + T2 = sector[sect].floorz; + + if (klabs(T1-sp->z) < klabs(T2-sp->z)) + sp->owner = 1; + else sp->owner = 0; + + if (sp->ang == 512) + { + if (sp->owner) + sector[sect].ceilingz = sp->z; + else + sector[sect].floorz = sp->z; + } + else + sector[sect].ceilingz = sector[sect].floorz = sp->z; + + if (sector[sect].ceilingstat&1) + { + sector[sect].ceilingstat ^= 1; + T4 = 1; + + if (!sp->owner && sp->ang==512) + { + sector[sect].ceilingstat ^= 1; + T4 = 0; + } + + sector[sect].ceilingshade = + sector[sect].floorshade; + + if (sp->ang==512) + { + startwall = sector[sect].wallptr; + endwall = startwall+sector[sect].wallnum; + for (j=startwall;j= 0) + if (!(sector[x].ceilingstat&1)) + { + sector[sect].ceilingpicnum = + sector[x].ceilingpicnum; + sector[sect].ceilingshade = + sector[x].ceilingshade; + break; //Leave earily + } + } + } + } + + break; + + case 17: + + T3 = sector[sect].floorz; //Stopping loc + + j = nextsectorneighborz(sect,sector[sect].floorz,-1,-1); + T4 = sector[j].ceilingz; + + j = nextsectorneighborz(sect,sector[sect].ceilingz,1,1); + T5 = sector[j].floorz; + + if (numplayers < 2) + { + setinterpolation(§or[sect].floorz); + setinterpolation(§or[sect].ceilingz); + } + + break; + + case 24: + sp->yvel <<= 1; + case 36: + break; + + case 20: + { + long q; + startwall = sector[sect].wallptr; endwall = startwall+sector[sect].wallnum; - for (j=startwall;j= 0) - if (!(sector[x].ceilingstat&1)) - { - sector[sect].ceilingpicnum = - sector[x].ceilingpicnum; - sector[sect].ceilingshade = - sector[x].ceilingshade; - break; //Leave earily - } - } - } - } + x = wall[s].x; + y = wall[s].y; - break; - - case 17: - - T3 = sector[sect].floorz; //Stopping loc - - j = nextsectorneighborz(sect,sector[sect].floorz,-1,-1); - T4 = sector[j].ceilingz; - - j = nextsectorneighborz(sect,sector[sect].ceilingz,1,1); - T5 = sector[j].floorz; - - if (numplayers < 2) - { - setinterpolation(§or[sect].floorz); - setinterpolation(§or[sect].ceilingz); - } - - break; - - case 24: - sp->yvel <<= 1; - case 36: - 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) - { - 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; - - case 3: - - T4=sector[sect].floorshade; - - sector[sect].floorshade = sp->shade; - sector[sect].ceilingshade = sp->shade; - - sp->owner = sector[sect].ceilingpal<<8; - sp->owner |= sector[sect].floorpal; - - //fix all the walls; - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - for (s=startwall;sshade; - if ((wall[s].cstat&2) && wall[s].nextwall >= 0) - wall[wall[s].nextwall].shade = sp->shade; - } - break; - - case 31: - T2 = sector[sect].floorz; - // T3 = sp->hitag; - 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; - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - for (s=startwall;sowner = sector[sect].ceilingpal<<8; - sp->owner |= sector[sect].floorpal; - - for (s=startwall;s T4) - T4 = wall[s].shade; - - break; - - case 9: - if (sector[sect].lotag && - labs(sector[sect].ceilingz-sp->z) > 1024) - sector[sect].lotag |= 32768; //If its open - case 8: - //First, get the ceiling-floor shade - - T1 = sector[sect].floorshade; - T2 = sector[sect].ceilingshade; - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - for (s=startwall;s T3) - T3 = wall[s].shade; - - T4 = 1; //Take Out; - - break; - - case 11://Pivitor rotater - if (sp->ang>1024) T4 = 2; - else T4 = -2; - case 0: - case 2://Earthquakemakers - case 5://Boss Creature - case 6://Subway - case 14://Caboos - case 15://Subwaytype sliding door - case 16://That rotating blocker reactor thing - case 26://ESCELATOR - case 30://No rotational subways - - if (sp->lotag == 0) - { - if (sector[sect].lotag == 30) - { - 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++) - { - if (sprite[j].statnum < MAXSTATUS) - if (sprite[j].picnum == SECTOREFFECTOR && - sprite[j].lotag == 1 && - sprite[j].hitag == sp->hitag) + d = FindDistance2D(sp->x-x,sp->y-y); + if (d < q) { - if (sp->ang == 512) - { - sp->x = sprite[j].x; - sp->y = sprite[j].y; - } - break; + q = d; + clostest = s; } - } - if (j == MAXSPRITES) - { - Bsprintf(tempbuf,"Found lonely Sector Effector (lotag 0) at (%ld,%ld)\n",sp->x,sp->y); - gameexit(tempbuf); - } - sp->owner = j; - } - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - T2 = tempwallptr; - for (s=startwall;sx; - msy[tempwallptr] = wall[s].y-sp->y; - tempwallptr++; - 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) - { - - startwall = sector[sect].wallptr; - endwall = startwall+sector[sect].wallnum; - - if (sector[sect].hitag == -1) - sp->extra = 0; - else sp->extra = 1; - - sector[sect].hitag = i; - - j = 0; - - for (s=startwall;s= 0 && - sector[ wall[ s ].nextsector].hitag == 0 && - sector[ wall[ s ].nextsector].lotag < 3) - { - s = wall[s].nextsector; - j = 1; - break; } + + T2 = clostest; + + q = 0x7fffffff; + + for (s=startwall;sx-x,sp->y-y); + if (d < q && s != T2) + { + q = d; + clostest = s; + } + } + + T3 = clostest; } - if (j == 0) - { - Bsprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%ld,%ld).\n",sp->x,sp->y); - gameexit(tempbuf); - } + break; - sp->owner = -1; - T1 = s; + case 3: - if (sp->lotag != 30) - T4 = sp->hitag; + T4=sector[sect].floorshade; + + sector[sect].floorshade = sp->shade; + sector[sect].ceilingshade = sp->shade; + + sp->owner = sector[sect].ceilingpal<<8; + sp->owner |= sector[sect].floorpal; + + //fix all the walls; + + startwall = sector[sect].wallptr; + endwall = startwall+sector[sect].wallnum; + + for (s=startwall;sshade; + if ((wall[s].cstat&2) && wall[s].nextwall >= 0) + wall[wall[s].nextwall].shade = sp->shade; + } + break; + + case 31: + T2 = sector[sect].floorz; + // T3 = sp->hitag; + 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; + + startwall = sector[sect].wallptr; + endwall = startwall+sector[sect].wallnum; + + for (s=startwall;sowner = sector[sect].ceilingpal<<8; + sp->owner |= sector[sect].floorpal; + + for (s=startwall;s T4) + T4 = wall[s].shade; + + break; + + case 9: + if (sector[sect].lotag && + labs(sector[sect].ceilingz-sp->z) > 1024) + sector[sect].lotag |= 32768; //If its open + case 8: + //First, get the ceiling-floor shade + + T1 = sector[sect].floorshade; + T2 = sector[sect].ceilingshade; + + startwall = sector[sect].wallptr; + endwall = startwall+sector[sect].wallnum; + + for (s=startwall;s T3) + T3 = wall[s].shade; + + T4 = 1; //Take Out; + + break; + + case 11://Pivitor rotater + if (sp->ang>1024) T4 = 2; + else T4 = -2; + case 0: + case 2://Earthquakemakers + case 5://Boss Creature + case 6://Subway + case 14://Caboos + case 15://Subwaytype sliding door + case 16://That rotating blocker reactor thing + case 26://ESCELATOR + case 30://No rotational subways + + if (sp->lotag == 0) + { + if (sector[sect].lotag == 30) + { + 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++) + { + if (sprite[j].statnum < MAXSTATUS) + if (sprite[j].picnum == SECTOREFFECTOR && + sprite[j].lotag == 1 && + sprite[j].hitag == sp->hitag) + { + if (sp->ang == 512) + { + sp->x = sprite[j].x; + sp->y = sprite[j].y; + } + break; + } + } + if (j == MAXSPRITES) + { + Bsprintf(tempbuf,"Found lonely Sector Effector (lotag 0) at (%ld,%ld)\n",sp->x,sp->y); + gameexit(tempbuf); + } + sp->owner = j; + } + + startwall = sector[sect].wallptr; + endwall = startwall+sector[sect].wallnum; + + T2 = tempwallptr; + for (s=startwall;sx; + msy[tempwallptr] = wall[s].y-sp->y; + tempwallptr++; + 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) + { + + startwall = sector[sect].wallptr; + endwall = startwall+sector[sect].wallnum; + + if (sector[sect].hitag == -1) + sp->extra = 0; + else sp->extra = 1; + + sector[sect].hitag = i; + + j = 0; + + for (s=startwall;s= 0 && + sector[ wall[ s ].nextsector].hitag == 0 && + sector[ wall[ s ].nextsector].lotag < 3) + { + s = wall[s].nextsector; + j = 1; + break; + } + } + + if (j == 0) + { + Bsprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%ld,%ld).\n",sp->x,sp->y); + gameexit(tempbuf); + } + + sp->owner = -1; + T1 = s; + + if (sp->lotag != 30) + T4 = sp->hitag; + } + + else if (sp->lotag == 16) + T4 = sector[sect].ceilingz; + + else if (sp->lotag == 26) + { + T4 = sp->x; + T5 = sp->y; + if (sp->shade==sector[sect].floorshade) //UP + sp->zvel = -256; + else + sp->zvel = 256; + + sp->shade = 0; + } + else if (sp->lotag == 2) + { + T6 = sector[sp->sectnum].floorheinum; + sector[sp->sectnum].floorheinum = 0; + } } - else if (sp->lotag == 16) - T4 = sector[sect].ceilingz; - - else if (sp->lotag == 26) + switch (sp->lotag) { - T4 = sp->x; - T5 = sp->y; - if (sp->shade==sector[sect].floorshade) //UP - sp->zvel = -256; - else - sp->zvel = 256; - - sp->shade = 0; + case 6: + case 14: + j = callsound(sect,i); + if (j == -1) j = SUBWAY; + hittype[i].lastvx = j; + case 30: + if (numplayers > 1) break; + case 0: + case 1: + case 5: + case 11: + case 15: + case 16: + case 26: + setsectinterpolate(i); + break; } - else if (sp->lotag == 2) + + switch (sprite[i].lotag) { - T6 = sector[sp->sectnum].floorheinum; - sector[sp->sectnum].floorheinum = 0; + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + changespritestat(i,15); + break; + default: + changespritestat(i,3); + break; } - } - switch (sp->lotag) - { - case 6: - case 14: - j = callsound(sect,i); - if (j == -1) j = SUBWAY; - hittype[i].lastvx = j; - case 30: - if (numplayers > 1) break; - case 0: - case 1: - case 5: - case 11: - case 15: - case 16: - case 26: - setsectinterpolate(i); break; - } - - switch (sprite[i].lotag) - { - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - changespritestat(i,15); - break; - default: - changespritestat(i,3); - break; - } - - break; - case SEENINE__STATIC: - case OOZFILTER__STATIC: + case SEENINE__STATIC: + case OOZFILTER__STATIC: - sp->shade = -16; - if (sp->xrepeat <= 8) - { - sp->cstat = (short)32768; - sp->xrepeat=sp->yrepeat=0; - } - else sp->cstat = 1+256; - sp->extra = impact_damage<<2; - sp->owner = i; - - changespritestat(i,6); - break; - - case CRACK1__STATIC: - case CRACK2__STATIC: - case CRACK3__STATIC: - case CRACK4__STATIC: - case FIREEXT__STATIC: - if (sp->picnum == FIREEXT) - { - sp->cstat = 257; + sp->shade = -16; + if (sp->xrepeat <= 8) + { + sp->cstat = (short)32768; + sp->xrepeat=sp->yrepeat=0; + } + else sp->cstat = 1+256; sp->extra = impact_damage<<2; - } - else - { - sp->cstat |= (sp->cstat & 48) ? 1 : 17; - sp->extra = 1; - } + sp->owner = i; - if (ud.multimode < 2 && sp->pal != 0) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); + changespritestat(i,6); break; - } - sp->pal = 0; - sp->owner = i; - changespritestat(i,6); - sp->xvel = 8; - ssp(i,CLIPMASK0); - break; + case CRACK1__STATIC: + case CRACK2__STATIC: + case CRACK3__STATIC: + case CRACK4__STATIC: + case FIREEXT__STATIC: + if (sp->picnum == FIREEXT) + { + sp->cstat = 257; + sp->extra = impact_damage<<2; + } + else + { + sp->cstat |= (sp->cstat & 48) ? 1 : 17; + sp->extra = 1; + } - case TOILET__STATIC: - case STALL__STATIC: - sp->lotag = 1; - sp->cstat |= 257; - sp->clipdist = 8; - sp->owner = i; - break; - case CANWITHSOMETHING__STATIC: - case CANWITHSOMETHING2__STATIC: - case CANWITHSOMETHING3__STATIC: - case CANWITHSOMETHING4__STATIC: - case RUBBERCAN__STATIC: - sp->extra = 0; - case EXPLODINGBARREL__STATIC: - case HORSEONSIDE__STATIC: - case FIREBARREL__STATIC: - case NUKEBARREL__STATIC: - case FIREVASE__STATIC: - case NUKEBARRELDENTED__STATIC: - case NUKEBARRELLEAKED__STATIC: - case WOODENHORSE__STATIC: + if (ud.multimode < 2 && sp->pal != 0) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } - if (j >= 0) - sp->xrepeat = sp->yrepeat = 32; - sp->clipdist = 72; - makeitfall(i); - if (j >= 0) - sp->owner = j; - else sp->owner = i; - case EGG__STATIC: - if (ud.monsters_off == 1 && sp->picnum == EGG) - { - sp->xrepeat = sp->yrepeat = 0; - changespritestat(i,5); - } - else - { - if (sp->picnum == EGG) - sp->clipdist = 24; - sp->cstat = 257|(TRAND&4); - changespritestat(i,2); - } - break; - case TOILETWATER__STATIC: - sp->shade = -16; - changespritestat(i,6); - break; + sp->pal = 0; + sp->owner = i; + changespritestat(i,6); + sp->xvel = 8; + ssp(i,CLIPMASK0); + break; + + case TOILET__STATIC: + case STALL__STATIC: + sp->lotag = 1; + sp->cstat |= 257; + sp->clipdist = 8; + sp->owner = i; + break; + case CANWITHSOMETHING__STATIC: + case CANWITHSOMETHING2__STATIC: + case CANWITHSOMETHING3__STATIC: + case CANWITHSOMETHING4__STATIC: + case RUBBERCAN__STATIC: + sp->extra = 0; + case EXPLODINGBARREL__STATIC: + case HORSEONSIDE__STATIC: + case FIREBARREL__STATIC: + case NUKEBARREL__STATIC: + case FIREVASE__STATIC: + case NUKEBARRELDENTED__STATIC: + case NUKEBARRELLEAKED__STATIC: + case WOODENHORSE__STATIC: + + if (j >= 0) + sp->xrepeat = sp->yrepeat = 32; + sp->clipdist = 72; + makeitfall(i); + if (j >= 0) + sp->owner = j; + else sp->owner = i; + case EGG__STATIC: + if (ud.monsters_off == 1 && sp->picnum == EGG) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + } + else + { + if (sp->picnum == EGG) + sp->clipdist = 24; + sp->cstat = 257|(TRAND&4); + changespritestat(i,2); + } + break; + case TOILETWATER__STATIC: + sp->shade = -16; + changespritestat(i,6); + break; } OnEvent(EVENT_SPAWN,i, findplayer(&sprite[i],&p), p); @@ -5857,76 +6201,77 @@ void animatesprites(long x,long y,short a,long smoothratio) 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)) { - } + if ((t->picnum >= GREENSLIME)&&(t->picnum <= GREENSLIME+7)) + {} else switch (dynamictostatic[t->picnum]) { - case BLOODPOOL__STATIC: - case PUKE__STATIC: - case FOOTPRINTS__STATIC: - case FOOTPRINTS2__STATIC: - case FOOTPRINTS3__STATIC: - case FOOTPRINTS4__STATIC: - if (t->shade == 127) continue; - break; - case RESPAWNMARKERRED__STATIC: - case RESPAWNMARKERYELLOW__STATIC: - case RESPAWNMARKERGREEN__STATIC: - if (ud.marker == 0) - t->xrepeat = t->yrepeat = 0; - continue; - case CHAIR3__STATIC: -#if defined(POLYMOST) && defined(USE_OPENGL) - if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0) { - t->cstat &= ~4; + case BLOODPOOL__STATIC: + case PUKE__STATIC: + case FOOTPRINTS__STATIC: + case FOOTPRINTS2__STATIC: + case FOOTPRINTS3__STATIC: + case FOOTPRINTS4__STATIC: + if (t->shade == 127) continue; break; - } + case RESPAWNMARKERRED__STATIC: + case RESPAWNMARKERYELLOW__STATIC: + case RESPAWNMARKERGREEN__STATIC: + if (ud.marker == 0) + t->xrepeat = t->yrepeat = 0; + continue; + case CHAIR3__STATIC: +#if defined(POLYMOST) && defined(USE_OPENGL) + if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0) + { + t->cstat &= ~4; + break; + } #endif - k = (((t->ang+3072+128-a)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - t->picnum = s->picnum+k; - break; - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: - if (ud.lockout) t->xrepeat = t->yrepeat = 0; - else if (t->pal == 6) - { - t->shade = -127; + k = (((t->ang+3072+128-a)&2047)>>8)&7; + if (k>4) + { + k = 8-k; + t->cstat |= 4; + } + else t->cstat &= ~4; + t->picnum = s->picnum+k; + break; + case BLOODSPLAT1__STATIC: + case BLOODSPLAT2__STATIC: + case BLOODSPLAT3__STATIC: + case BLOODSPLAT4__STATIC: + if (ud.lockout) t->xrepeat = t->yrepeat = 0; + else if (t->pal == 6) + { + t->shade = -127; + continue; + } + case BULLETHOLE__STATIC: + case CRACK1__STATIC: + case CRACK2__STATIC: + case CRACK3__STATIC: + case CRACK4__STATIC: + t->shade = 16; continue; - } - case BULLETHOLE__STATIC: - case CRACK1__STATIC: - case CRACK2__STATIC: - case CRACK3__STATIC: - case CRACK4__STATIC: - t->shade = 16; - continue; - case NEON1__STATIC: - case NEON2__STATIC: - case NEON3__STATIC: - case NEON4__STATIC: - case NEON5__STATIC: - case NEON6__STATIC: - continue; - //case GREENSLIME: - //case GREENSLIME+1: - //case GREENSLIME+2: - //case GREENSLIME+3: - //case GREENSLIME+4: - //case GREENSLIME+5: - //case GREENSLIME+6: - //case GREENSLIME+7: - // break; - default: - if (((t->cstat&16)) || (badguy(t) && t->extra > 0) || t->statnum == 10) + case NEON1__STATIC: + case NEON2__STATIC: + case NEON3__STATIC: + case NEON4__STATIC: + case NEON5__STATIC: + case NEON6__STATIC: continue; + //case GREENSLIME: + //case GREENSLIME+1: + //case GREENSLIME+2: + //case GREENSLIME+3: + //case GREENSLIME+4: + //case GREENSLIME+5: + //case GREENSLIME+6: + //case GREENSLIME+7: + // break; + default: + if (((t->cstat&16)) || (badguy(t) && t->extra > 0) || t->statnum == 10) + continue; } if (checkspriteflags(t->owner,SPRITE_FLAG_NOSHADE)) @@ -5952,92 +6297,92 @@ void animatesprites(long x,long y,short a,long smoothratio) switch (dynamictostatic[s->picnum]) { - case SECTOREFFECTOR__STATIC: - if (t->lotag == 27 && ud.recstat == 1) - { - t->picnum = 11+((totalclock>>3)&1); - t->cstat |= 128; - } - else - t->xrepeat = t->yrepeat = 0; - break; - case NATURALLIGHTNING__STATIC: - t->shade = -127; - break; - case FEM1__STATIC: - case FEM2__STATIC: - case FEM3__STATIC: - case FEM4__STATIC: - case FEM5__STATIC: - case FEM6__STATIC: - case FEM7__STATIC: - case FEM8__STATIC: - case FEM9__STATIC: - case FEM10__STATIC: - case MAN__STATIC: - case MAN2__STATIC: - case WOMAN__STATIC: - case NAKED1__STATIC: - case PODFEM1__STATIC: - case FEMMAG1__STATIC: - case FEMMAG2__STATIC: - case FEMPIC1__STATIC: - case FEMPIC2__STATIC: - case FEMPIC3__STATIC: - case FEMPIC4__STATIC: - case FEMPIC5__STATIC: - case FEMPIC6__STATIC: - case FEMPIC7__STATIC: - case BLOODYPOLE__STATIC: - case FEM6PAD__STATIC: - case STATUE__STATIC: - case STATUEFLASH__STATIC: - case OOZ__STATIC: - case OOZ2__STATIC: - case WALLBLOOD1__STATIC: - case WALLBLOOD2__STATIC: - case WALLBLOOD3__STATIC: - case WALLBLOOD4__STATIC: - case WALLBLOOD5__STATIC: - case WALLBLOOD7__STATIC: - case WALLBLOOD8__STATIC: - case SUSHIPLATE1__STATIC: - case SUSHIPLATE2__STATIC: - case SUSHIPLATE3__STATIC: - case SUSHIPLATE4__STATIC: - case FETUS__STATIC: - case FETUSJIB__STATIC: - case FETUSBROKE__STATIC: - case HOTMEAT__STATIC: - case FOODOBJECT16__STATIC: - case DOLPHIN1__STATIC: - case DOLPHIN2__STATIC: - case TOUGHGAL__STATIC: - case TAMPON__STATIC: - case XXXSTACY__STATIC: - if (ud.lockout) - { - t->xrepeat = t->yrepeat = 0; - continue; - } + case SECTOREFFECTOR__STATIC: + if (t->lotag == 27 && ud.recstat == 1) + { + t->picnum = 11+((totalclock>>3)&1); + t->cstat |= 128; + } + else + t->xrepeat = t->yrepeat = 0; + break; + case NATURALLIGHTNING__STATIC: + t->shade = -127; + break; + case FEM1__STATIC: + case FEM2__STATIC: + case FEM3__STATIC: + case FEM4__STATIC: + case FEM5__STATIC: + case FEM6__STATIC: + case FEM7__STATIC: + case FEM8__STATIC: + case FEM9__STATIC: + case FEM10__STATIC: + case MAN__STATIC: + case MAN2__STATIC: + case WOMAN__STATIC: + case NAKED1__STATIC: + case PODFEM1__STATIC: + case FEMMAG1__STATIC: + case FEMMAG2__STATIC: + case FEMPIC1__STATIC: + case FEMPIC2__STATIC: + case FEMPIC3__STATIC: + case FEMPIC4__STATIC: + case FEMPIC5__STATIC: + case FEMPIC6__STATIC: + case FEMPIC7__STATIC: + case BLOODYPOLE__STATIC: + case FEM6PAD__STATIC: + case STATUE__STATIC: + case STATUEFLASH__STATIC: + case OOZ__STATIC: + case OOZ2__STATIC: + case WALLBLOOD1__STATIC: + case WALLBLOOD2__STATIC: + case WALLBLOOD3__STATIC: + case WALLBLOOD4__STATIC: + case WALLBLOOD5__STATIC: + case WALLBLOOD7__STATIC: + case WALLBLOOD8__STATIC: + case SUSHIPLATE1__STATIC: + case SUSHIPLATE2__STATIC: + case SUSHIPLATE3__STATIC: + case SUSHIPLATE4__STATIC: + case FETUS__STATIC: + case FETUSJIB__STATIC: + case FETUSBROKE__STATIC: + case HOTMEAT__STATIC: + case FOODOBJECT16__STATIC: + case DOLPHIN1__STATIC: + case DOLPHIN2__STATIC: + case TOUGHGAL__STATIC: + case TAMPON__STATIC: + case XXXSTACY__STATIC: + if (ud.lockout) + { + t->xrepeat = t->yrepeat = 0; + continue; + } } switch (s->picnum) { - case 4946: - case 4947: - case 693: - case 2254: - case 4560: - case 4561: - case 4562: - case 4498: - case 4957: - if (ud.lockout) - { - t->xrepeat = t->yrepeat = 0; - continue; - } + case 4946: + case 4947: + case 693: + case 2254: + case 4560: + case 4561: + case 4562: + case 4498: + case 4957: + if (ud.lockout) + { + t->xrepeat = t->yrepeat = 0; + continue; + } } if (t->statnum == 99) continue; @@ -6056,7 +6401,9 @@ void animatesprites(long x,long y,short a,long smoothratio) } sect = s->sectnum; - t1 = T2;t3 = T4;t4 = T5; + t1 = T2; + t3 = T4; + t4 = T5; switchpic = s->picnum; //some special cases because dynamictostatic system can't handle addition to constants if ((s->picnum >= SCRAP6)&&(s->picnum<=SCRAP6+7)) @@ -6066,314 +6413,320 @@ void animatesprites(long x,long y,short a,long smoothratio) switch (dynamictostatic[switchpic]) { - case DUKELYINGDEAD__STATIC: - t->z += (24<<8); - break; - case BLOODPOOL__STATIC: - case FOOTPRINTS__STATIC: - case FOOTPRINTS2__STATIC: - case FOOTPRINTS3__STATIC: - case FOOTPRINTS4__STATIC: - if (t->pal == 6) - t->shade = -127; - case PUKE__STATIC: - case MONEY__STATIC: - //case MONEY+1__STATIC: - case MAIL__STATIC: - //case MAIL+1__STATIC: - case PAPER__STATIC: - //case PAPER+1__STATIC: - if (ud.lockout && s->pal == 2) - { - t->xrepeat = t->yrepeat = 0; + case DUKELYINGDEAD__STATIC: + t->z += (24<<8); + break; + case BLOODPOOL__STATIC: + case FOOTPRINTS__STATIC: + case FOOTPRINTS2__STATIC: + case FOOTPRINTS3__STATIC: + case FOOTPRINTS4__STATIC: + if (t->pal == 6) + t->shade = -127; + case PUKE__STATIC: + case MONEY__STATIC: + //case MONEY+1__STATIC: + case MAIL__STATIC: + //case MAIL+1__STATIC: + case PAPER__STATIC: + //case PAPER+1__STATIC: + if (ud.lockout && s->pal == 2) + { + t->xrepeat = t->yrepeat = 0; + continue; + } + break; + case TRIPBOMB__STATIC: continue; - } - break; - case TRIPBOMB__STATIC: - continue; - case FORCESPHERE__STATIC: - if (t->statnum == 5) - { - short sqa,sqb; - - sqa = - getangle( - sprite[s->owner].x-ps[screenpeek].posx, - sprite[s->owner].y-ps[screenpeek].posy); - sqb = - getangle( - 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])) - t->xrepeat = t->yrepeat = 0; - } - continue; - case BURNING__STATIC: - case BURNING2__STATIC: - if (sprite[s->owner].statnum == 10) - { - if (display_mirror == 0 && sprite[s->owner].yvel == screenpeek && ps[sprite[s->owner].yvel].over_shoulder_on == 0) - t->xrepeat = 0; - else + case FORCESPHERE__STATIC: + if (t->statnum == 5) { - t->ang = getangle(x-t->x,y-t->y); - t->x = sprite[s->owner].x; - t->y = sprite[s->owner].y; - t->x += sintable[(t->ang+512)&2047]>>10; - t->y += sintable[t->ang&2047]>>10; + short sqa,sqb; + + sqa = + getangle( + sprite[s->owner].x-ps[screenpeek].posx, + sprite[s->owner].y-ps[screenpeek].posy); + sqb = + getangle( + 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])) + t->xrepeat = t->yrepeat = 0; + } + continue; + case BURNING__STATIC: + case BURNING2__STATIC: + if (sprite[s->owner].statnum == 10) + { + if (display_mirror == 0 && sprite[s->owner].yvel == screenpeek && ps[sprite[s->owner].yvel].over_shoulder_on == 0) + t->xrepeat = 0; + else + { + t->ang = getangle(x-t->x,y-t->y); + t->x = sprite[s->owner].x; + t->y = sprite[s->owner].y; + t->x += sintable[(t->ang+512)&2047]>>10; + t->y += sintable[t->ang&2047]>>10; + } } - } - break; - - case ATOMICHEALTH__STATIC: - t->z -= (4<<8); - break; - case CRYSTALAMMO__STATIC: - t->shade = (sintable[(totalclock<<4)&2047]>>10); - continue; - case VIEWSCREEN__STATIC: - case VIEWSCREEN2__STATIC: - if (camsprite >= 0 && hittype[OW].temp_data[0] == 1) - { - t->picnum = STATIC; - t->cstat |= (rand()&12); - t->xrepeat += 8; - t->yrepeat += 8; - } else if (camsprite >= 0 && waloff[TILE_VIEWSCR] && walock[TILE_VIEWSCR] > 200) { - t->picnum = TILE_VIEWSCR; - } - break; - - case SHRINKSPARK__STATIC: - t->picnum = SHRINKSPARK+((totalclock>>4)&3); - break; - case GROWSPARK__STATIC: - t->picnum = GROWSPARK+((totalclock>>4)&3); - break; - case RPG__STATIC: -#if defined(POLYMOST) && defined(USE_OPENGL) - if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0) { - t->cstat &= ~4; break; - } -#endif - k = getangle(s->x-x,s->y-y); - k = (((s->ang+3072+128-k)&2047)/170); - if (k > 6) - { - k = 12-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - t->picnum = RPG+k; - break; - case RECON__STATIC: -#if defined(POLYMOST) && defined(USE_OPENGL) - if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0) { - t->cstat &= ~4; + case ATOMICHEALTH__STATIC: + t->z -= (4<<8); break; - } -#endif - k = getangle(s->x-x,s->y-y); - if (T1 < 4) - k = (((s->ang+3072+128-k)&2047)/170); - else k = (((s->ang+3072+128-k)&2047)/170); - - if (k>6) - { - k = 12-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - - if (klabs(t3) > 64) k += 7; - t->picnum = RECON+k; - - break; - - case APLAYER__STATIC: - - p = s->yvel; - - if (t->pal == 1) t->z -= (18<<8); - - if (ps[p].over_shoulder_on > 0 && ps[p].newowner < 0) - { - t->cstat |= 2; - if (screenpeek == myconnectindex && numplayers >= 2) + case CRYSTALAMMO__STATIC: + t->shade = (sintable[(totalclock<<4)&2047]>>10); + continue; + case VIEWSCREEN__STATIC: + case VIEWSCREEN2__STATIC: + if (camsprite >= 0 && hittype[OW].temp_data[0] == 1) { - t->x = omyx+mulscale16((long)(myx-omyx),smoothratio); - t->y = omyy+mulscale16((long)(myy-omyy),smoothratio); - t->z = omyz+mulscale16((long)(myz-omyz),smoothratio)+(40<<8); - t->ang = omyang+mulscale16((long)(((myang+1024-omyang)&2047)-1024),smoothratio); - t->sectnum = mycursectnum; + t->picnum = STATIC; + t->cstat |= (rand()&12); + t->xrepeat += 8; + t->yrepeat += 8; } - } - - 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; - - 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) - tsprite[spritesortcnt].z = ps[p].posz-(12<<8); - else tsprite[spritesortcnt].z = s->z-(51<<8); - if (tsprite[spritesortcnt].picnum == HEAVYHBOMB) + else if (camsprite >= 0 && waloff[TILE_VIEWSCR] && walock[TILE_VIEWSCR] > 200) { - tsprite[spritesortcnt].xrepeat = 10; - tsprite[spritesortcnt].yrepeat = 10; + t->picnum = TILE_VIEWSCR; } - else - { - tsprite[spritesortcnt].xrepeat = 16; - tsprite[spritesortcnt].yrepeat = 16; - } - tsprite[spritesortcnt].pal = 0; - spritesortcnt++; - } + break; - 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; - - tsprite[spritesortcnt].cstat = 0; - - tsprite[spritesortcnt].picnum = RESPAWNMARKERGREEN; - - if (s->owner >= 0) - tsprite[spritesortcnt].z = ps[p].posz-(20<<8); - else tsprite[spritesortcnt].z = s->z-(96<<8); - tsprite[spritesortcnt].xrepeat = 32; - tsprite[spritesortcnt].yrepeat = 32; - tsprite[spritesortcnt].pal = 20; - spritesortcnt++; - } - - if (s->owner == -1) - { + case SHRINKSPARK__STATIC: + t->picnum = SHRINKSPARK+((totalclock>>4)&3); + break; + case GROWSPARK__STATIC: + t->picnum = GROWSPARK+((totalclock>>4)&3); + break; + case RPG__STATIC: #if defined(POLYMOST) && defined(USE_OPENGL) - if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) { - k = 0; + if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0) + { t->cstat &= ~4; - } else + break; + } #endif + k = getangle(s->x-x,s->y-y); + k = (((s->ang+3072+128-k)&2047)/170); + if (k > 6) { - k = (((s->ang+3072+128-a)&2047)>>8)&7; - if (k>4) + k = 12-k; + t->cstat |= 4; + } + else t->cstat &= ~4; + t->picnum = RPG+k; + break; + + case RECON__STATIC: +#if defined(POLYMOST) && defined(USE_OPENGL) + if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum) >= 0) + { + t->cstat &= ~4; + break; + } +#endif + k = getangle(s->x-x,s->y-y); + if (T1 < 4) + k = (((s->ang+3072+128-k)&2047)/170); + else k = (((s->ang+3072+128-k)&2047)/170); + + if (k>6) + { + k = 12-k; + t->cstat |= 4; + } + else t->cstat &= ~4; + + if (klabs(t3) > 64) k += 7; + t->picnum = RECON+k; + + break; + + case APLAYER__STATIC: + + p = s->yvel; + + if (t->pal == 1) t->z -= (18<<8); + + if (ps[p].over_shoulder_on > 0 && ps[p].newowner < 0) + { + t->cstat |= 2; + if (screenpeek == myconnectindex && numplayers >= 2) { - k = 8-k; - t->cstat |= 4; + t->x = omyx+mulscale16((long)(myx-omyx),smoothratio); + t->y = omyy+mulscale16((long)(myy-omyy),smoothratio); + t->z = omyz+mulscale16((long)(myz-omyz),smoothratio)+(40<<8); + t->ang = omyang+mulscale16((long)(((myang+1024-omyang)&2047)-1024),smoothratio); + t->sectnum = mycursectnum; } - 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 ((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)); - t->picnum += k; - t->pal = ps[p].palookup; + tsprite[spritesortcnt].statnum = 99; - goto PALONLY; - } + tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3); + if (t->yrepeat < 4) t->yrepeat = 4; - 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) - s->yoffset = (signed char)(l/(s->yrepeat<<2)); - else s->yoffset=0; - } + tsprite[spritesortcnt].shade = t->shade; + tsprite[spritesortcnt].cstat = 0; - if (ps[p].newowner > -1) - { - t4 = *(actorscrptr[APLAYER]+1); - t3 = 0; - t1 = *(actorscrptr[APLAYER]+2); - } + tsprite[spritesortcnt].picnum = (ps[p].curr_weapon==GROW_WEAPON?GROWSPRITEICON:weapon_sprites[ps[p].curr_weapon]); - 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 (s->owner >= 0) + tsprite[spritesortcnt].z = ps[p].posz-(12<<8); + else tsprite[spritesortcnt].z = s->z-(51<<8); + if (tsprite[spritesortcnt].picnum == HEAVYHBOMB) { - t->owner = -1; - t->xrepeat = t->yrepeat = 0; - continue; + tsprite[spritesortcnt].xrepeat = 10; + tsprite[spritesortcnt].yrepeat = 10; } + else + { + tsprite[spritesortcnt].xrepeat = 16; + tsprite[spritesortcnt].yrepeat = 16; + } + tsprite[spritesortcnt].pal = 0; + spritesortcnt++; + } + + 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; + + tsprite[spritesortcnt].cstat = 0; + + tsprite[spritesortcnt].picnum = RESPAWNMARKERGREEN; + + if (s->owner >= 0) + tsprite[spritesortcnt].z = ps[p].posz-(20<<8); + else tsprite[spritesortcnt].z = s->z-(96<<8); + tsprite[spritesortcnt].xrepeat = 32; + tsprite[spritesortcnt].yrepeat = 32; + tsprite[spritesortcnt].pal = 20; + spritesortcnt++; + } + + if (s->owner == -1) + { +#if defined(POLYMOST) && defined(USE_OPENGL) + if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) + { + k = 0; + t->cstat &= ~4; + } + else +#endif + { + k = (((s->ang+3072+128-a)&2047)>>8)&7; + if (k>4) + { + k = 8-k; + t->cstat |= 4; + } + else t->cstat &= ~4; + } + + 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; + + goto PALONLY; + } + + 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) + s->yoffset = (signed char)(l/(s->yrepeat<<2)); + else s->yoffset=0; + } + + 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)) + { + t->owner = -1; + t->xrepeat = t->yrepeat = 0; + continue; + } PALONLY: - if (sector[sect].floorpal && sector[sect].floorpal < numl) - t->pal = sector[sect].floorpal; + 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) - t->z = hittype[i].floorz; + if (t->z > hittype[i].floorz && t->xrepeat < 32) + t->z = hittype[i].floorz; - break; - - case JIBS1__STATIC: - case JIBS2__STATIC: - case JIBS3__STATIC: - case JIBS4__STATIC: - case JIBS5__STATIC: - case JIBS6__STATIC: - case HEADJIB1__STATIC: - case LEGJIB1__STATIC: - case ARMJIB1__STATIC: - case LIZMANHEAD1__STATIC: - case LIZMANARM1__STATIC: - case LIZMANLEG1__STATIC: - case DUKELEG__STATIC: - case DUKEGUN__STATIC: - case DUKETORSO__STATIC: - if (ud.lockout) - { - t->xrepeat = t->yrepeat = 0; - continue; - } - 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) - t->picnum = s->yvel; - else t->picnum += T1; - t->shade -= 6; - - if (sector[sect].floorpal && sector[sect].floorpal < numl) - t->pal = sector[sect].floorpal; - break; - - case WATERBUBBLE__STATIC: - if (sector[t->sectnum].floorpicnum == FLOORSLIME) - { - t->pal = 7; break; - } - default: - if (sector[sect].floorpal && sector[sect].floorpal < numl) - t->pal = sector[sect].floorpal; - break; + + case JIBS1__STATIC: + case JIBS2__STATIC: + case JIBS3__STATIC: + case JIBS4__STATIC: + case JIBS5__STATIC: + case JIBS6__STATIC: + case HEADJIB1__STATIC: + case LEGJIB1__STATIC: + case ARMJIB1__STATIC: + case LIZMANHEAD1__STATIC: + case LIZMANARM1__STATIC: + case LIZMANLEG1__STATIC: + case DUKELEG__STATIC: + case DUKEGUN__STATIC: + case DUKETORSO__STATIC: + if (ud.lockout) + { + t->xrepeat = t->yrepeat = 0; + continue; + } + 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) + t->picnum = s->yvel; + else t->picnum += T1; + t->shade -= 6; + + if (sector[sect].floorpal && sector[sect].floorpal < numl) + t->pal = sector[sect].floorpal; + break; + + case WATERBUBBLE__STATIC: + if (sector[t->sectnum].floorpicnum == FLOORSLIME) + { + t->pal = 7; + break; + } + default: + if (sector[sect].floorpal && sector[sect].floorpal < numl) + t->pal = sector[sect].floorpal; + break; } if (actorscrptr[s->picnum]) @@ -6382,7 +6735,8 @@ PALONLY: { l = *(long *)(t4+8); #if defined(POLYMOST) && defined(USE_OPENGL) - if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) { + if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) + { k = 0; t->cstat &= ~4; } @@ -6390,48 +6744,48 @@ PALONLY: #endif switch (l) { - case 2: - k = (((s->ang+3072+128-a)&2047)>>8)&1; - break; + case 2: + k = (((s->ang+3072+128-a)&2047)>>8)&1; + break; - case 3: - case 4: - k = (((s->ang+3072+128-a)&2047)>>7)&7; - if (k > 3) - { - t->cstat |= 4; - k = 7-k; - } - else t->cstat &= ~4; - break; + case 3: + case 4: + k = (((s->ang+3072+128-a)&2047)>>7)&7; + if (k > 3) + { + t->cstat |= 4; + k = 7-k; + } + else t->cstat &= ~4; + break; - case 5: - k = getangle(s->x-x,s->y-y); - k = (((s->ang+3072+128-k)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - break; - case 7: - k = getangle(s->x-x,s->y-y); - k = (((s->ang+3072+128-k)&2047)/170); - if (k>6) - { - k = 12-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - break; - case 8: - k = (((s->ang+3072+128-a)&2047)>>8)&7; - t->cstat &= ~4; - break; - default: - k = 0; - break; + case 5: + k = getangle(s->x-x,s->y-y); + k = (((s->ang+3072+128-k)&2047)>>8)&7; + if (k>4) + { + k = 8-k; + t->cstat |= 4; + } + else t->cstat &= ~4; + break; + case 7: + k = getangle(s->x-x,s->y-y); + k = (((s->ang+3072+128-k)&2047)/170); + if (k>6) + { + k = 12-k; + t->cstat |= 4; + } + else t->cstat &= ~4; + break; + case 8: + k = (((s->ang+3072+128-a)&2047)>>8)&7; + t->cstat &= ~4; + break; + default: + k = 0; + break; } t->picnum += k + (*(long *)t4) + l * t3; @@ -6517,50 +6871,115 @@ PALONLY: switch (dynamictostatic[s->picnum]) { - case LASERLINE__STATIC: - 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) - t->yrepeat = 0; - case EXPLOSION2__STATIC: - case EXPLOSION2BOT__STATIC: - case FREEZEBLAST__STATIC: - case ATOMICHEALTH__STATIC: - case FIRELASER__STATIC: - case SHRINKSPARK__STATIC: - case GROWSPARK__STATIC: - case CHAINGUN__STATIC: - case SHRINKEREXPLOSION__STATIC: - case RPG__STATIC: - case FLOORFLAME__STATIC: - if (t->picnum == EXPLOSION2) - { - ps[screenpeek].visibility = -127; - lastvisinc = totalclock+32; - //restorepalette = 1; // JBF 20040101: why? - } - t->shade = -127; - break; - case FIRE__STATIC: - case FIRE2__STATIC: - case BURNING__STATIC: - case BURNING2__STATIC: - if (sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2) - t->z = sector[t->sectnum].floorz; - t->shade = -127; - break; - case COOLEXPLOSION1__STATIC: - t->shade = -127; - t->picnum += (s->shade>>1); - break; - case PLAYERONWATER__STATIC: + case LASERLINE__STATIC: + 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) + t->yrepeat = 0; + case EXPLOSION2__STATIC: + case EXPLOSION2BOT__STATIC: + case FREEZEBLAST__STATIC: + case ATOMICHEALTH__STATIC: + case FIRELASER__STATIC: + case SHRINKSPARK__STATIC: + case GROWSPARK__STATIC: + case CHAINGUN__STATIC: + case SHRINKEREXPLOSION__STATIC: + case RPG__STATIC: + case FLOORFLAME__STATIC: + if (t->picnum == EXPLOSION2) + { + ps[screenpeek].visibility = -127; + lastvisinc = totalclock+32; + //restorepalette = 1; // JBF 20040101: why? + } + t->shade = -127; + break; + case FIRE__STATIC: + case FIRE2__STATIC: + case BURNING__STATIC: + case BURNING2__STATIC: + if (sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2) + t->z = sector[t->sectnum].floorz; + t->shade = -127; + break; + case COOLEXPLOSION1__STATIC: + t->shade = -127; + t->picnum += (s->shade>>1); + break; + case PLAYERONWATER__STATIC: #if defined(POLYMOST) && defined(USE_OPENGL) - if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) { - k = 0; - t->cstat &= ~4; - } else + if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) + { + k = 0; + t->cstat &= ~4; + } + else #endif - { + { + k = (((t->ang+3072+128-a)&2047)>>8)&7; + if (k>4) + { + k = 8-k; + t->cstat |= 4; + } + else t->cstat &= ~4; + } + + t->picnum = s->picnum+k+((T1<4)*5); + t->shade = sprite[s->owner].shade; + + break; + + case WATERSPLASH2__STATIC: + t->picnum = WATERSPLASH2+t1; + break; + case REACTOR2__STATIC: + t->picnum = s->picnum + T3; + break; + case SHELL__STATIC: + t->picnum = s->picnum+(T1&1); + case SHOTGUNSHELL__STATIC: + 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 (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 (!hittype[s->owner].dispicnum) + t->picnum = hittype[i].temp_data[1]; + else t->picnum = hittype[s->owner].dispicnum; + t->pal = sprite[s->owner].pal; + t->shade = sprite[s->owner].shade; + t->ang = sprite[s->owner].ang; + t->cstat = 2|sprite[s->owner].cstat; + } + } + break; + + case CAMERA1__STATIC: + case RAT__STATIC: + +#if defined(POLYMOST) && defined(USE_OPENGL) + if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) + { + t->cstat &= ~4; + break; + } +#endif + k = (((t->ang+3072+128-a)&2047)>>8)&7; if (k>4) { @@ -6568,70 +6987,8 @@ PALONLY: t->cstat |= 4; } else t->cstat &= ~4; - } - - t->picnum = s->picnum+k+((T1<4)*5); - t->shade = sprite[s->owner].shade; - - break; - - case WATERSPLASH2__STATIC: - t->picnum = WATERSPLASH2+t1; - break; - case REACTOR2__STATIC: - t->picnum = s->picnum + T3; - break; - case SHELL__STATIC: - t->picnum = s->picnum+(T1&1); - case SHOTGUNSHELL__STATIC: - 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 (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 (!hittype[s->owner].dispicnum) - t->picnum = hittype[i].temp_data[1]; - else t->picnum = hittype[s->owner].dispicnum; - t->pal = sprite[s->owner].pal; - t->shade = sprite[s->owner].shade; - t->ang = sprite[s->owner].ang; - t->cstat = 2|sprite[s->owner].cstat; - } - } - break; - - case CAMERA1__STATIC: - case RAT__STATIC: - -#if defined(POLYMOST) && defined(USE_OPENGL) - if (bpp > 8 && usemodels && md_tilehasmodel(s->picnum) >= 0) { - t->cstat &= ~4; + t->picnum = s->picnum+k; break; - } -#endif - - k = (((t->ang+3072+128-a)&2047)>>8)&7; - if (k>4) - { - k = 8-k; - t->cstat |= 4; - } - else t->cstat &= ~4; - t->picnum = s->picnum+k; - break; } hittype[i].dispicnum = t->picnum; @@ -6644,39 +7001,43 @@ PALONLY: #pragma optimize("",on) #endif -static char terminx[64] = { "Undead TC still sucks." }; +static char terminx[64] = + { "Undead TC still sucks." + }; -char cheatquotes[][MAXCHEATLEN] = { - "cornholio", // 0 - "stuff", // 1 - "scotty###", // 2 - "coords", // 3 - "view", // 4 - "time", // 5 - "unlock", // 6 - "cashman", // 7 - "items", // 8 - "rate", // 9 - "skill#", // 10 - "beta", // 11 - "hyper", // 12 - "monsters", // 13 - "", // 14 - "", // 15 - "todd", // 16 - "showmap", // 17 - "kroz", // 18 - "allen", // 19 - "clip", // 20 - "weapons", // 21 - "inventory", // 22 - "keys", // 23 - "debug", // 24 - "", // 25 - "sfm", // 26 - }; +char cheatquotes[][MAXCHEATLEN] = + { + "cornholio", // 0 + "stuff", // 1 + "scotty###", // 2 + "coords", // 3 + "view", // 4 + "time", // 5 + "unlock", // 6 + "cashman", // 7 + "items", // 8 + "rate", // 9 + "skill#", // 10 + "beta", // 11 + "hyper", // 12 + "monsters", // 13 + "", // 14 + "", // 15 + "todd", // 16 + "showmap", // 17 + "kroz", // 18 + "allen", // 19 + "clip", // 20 + "weapons", // 21 + "inventory", // 22 + "keys", // 23 + "debug", // 24 + "", // 25 + "sfm", // 26 + }; -enum cheats { +enum cheats +{ CHEAT_CORNHOLIO, CHEAT_STUFF, CHEAT_SCOTTY, @@ -6781,7 +7142,8 @@ void cheats(void) static char z=0; char consolecheat = 0; // JBF 20030914 - if (osdcmd_cheatsinfo_stat.cheatnum != -1) { // JBF 20030914 + if (osdcmd_cheatsinfo_stat.cheatnum != -1) + { // JBF 20030914 k = osdcmd_cheatsinfo_stat.cheatnum; osdcmd_cheatsinfo_stat.cheatnum = -1; consolecheat = 1; @@ -6790,7 +7152,8 @@ void cheats(void) if ((ps[myconnectindex].gm&MODE_TYPE) || (ps[myconnectindex].gm&MODE_MENU)) return; - if (VOLUMEONE && !z) { + if (VOLUMEONE && !z) + { Bstrcpy(cheatquotes[2],"scotty##"); Bstrcpy(cheatquotes[6],""); z=1; @@ -6842,395 +7205,407 @@ FOUNDCHEAT: { switch (k) { - case CHEAT_WEAPONS: - if (VOLUMEONE) { - j = 6; - } else { - j = 0; - } + case CHEAT_WEAPONS: + if (VOLUMEONE) + { + j = 6; + } + else + { + j = 0; + } - for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++) - { - addammo(weapon, &ps[myconnectindex], max_ammo_amount[weapon]); - ps[myconnectindex].gotweapon[weapon] = 1; - } + for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++) + { + addammo(weapon, &ps[myconnectindex], max_ammo_amount[weapon]); + ps[myconnectindex].gotweapon[weapon] = 1; + } - KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; - FTA(119,&ps[myconnectindex]); - return; + KB_FlushKeyBoardQueue(); + ps[myconnectindex].cheat_phase = 0; + FTA(119,&ps[myconnectindex]); + return; - case CHEAT_INVENTORY: - KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; - CheatGetInventory(); - FTA(120,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; - return; + case CHEAT_INVENTORY: + KB_FlushKeyBoardQueue(); + ps[myconnectindex].cheat_phase = 0; + CheatGetInventory(); + FTA(120,&ps[myconnectindex]); + ps[myconnectindex].cheat_phase = 0; + return; - case CHEAT_KEYS: - ps[myconnectindex].got_access = 7; - KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; - FTA(121,&ps[myconnectindex]); - return; + case CHEAT_KEYS: + ps[myconnectindex].got_access = 7; + KB_FlushKeyBoardQueue(); + ps[myconnectindex].cheat_phase = 0; + FTA(121,&ps[myconnectindex]); + return; - case CHEAT_DEBUG: - debug_on = 1-debug_on; - KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; + case CHEAT_DEBUG: + debug_on = 1-debug_on; + KB_FlushKeyBoardQueue(); + ps[myconnectindex].cheat_phase = 0; - dumpdebugdata(); - Bsprintf(tempbuf,"GAMEVARS DUMPED TO DEBUG.CON"); - adduserquote(tempbuf); - Bsprintf(tempbuf,"MAP DUMPED TO DEBUG.MAP"); - adduserquote(tempbuf); - break; + dumpdebugdata(); + Bsprintf(tempbuf,"GAMEVARS DUMPED TO DEBUG.CON"); + adduserquote(tempbuf); + Bsprintf(tempbuf,"MAP DUMPED TO DEBUG.MAP"); + adduserquote(tempbuf); + break; - case CHEAT_CLIP: - ud.clipping = 1-ud.clipping; - KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; - FTA(112+ud.clipping,&ps[myconnectindex]); - return; + case CHEAT_CLIP: + ud.clipping = 1-ud.clipping; + KB_FlushKeyBoardQueue(); + ps[myconnectindex].cheat_phase = 0; + FTA(112+ud.clipping,&ps[myconnectindex]); + return; - case CHEAT_RESERVED2: - ps[myconnectindex].gm = MODE_EOL; - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; + case CHEAT_RESERVED2: + ps[myconnectindex].gm = MODE_EOL; + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; - case CHEAT_ALLEN: - FTA(79,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; - KB_ClearKeyDown(sc_N); - return; + case CHEAT_ALLEN: + FTA(79,&ps[myconnectindex]); + ps[myconnectindex].cheat_phase = 0; + KB_ClearKeyDown(sc_N); + return; - case CHEAT_CORNHOLIO: - case CHEAT_KROZ: - ud.god = 1-ud.god; + case CHEAT_CORNHOLIO: + case CHEAT_KROZ: + ud.god = 1-ud.god; - if (ud.god) - { - pus = 1; - pub = 1; - sprite[ps[myconnectindex].i].cstat = 257; + if (ud.god) + { + pus = 1; + pub = 1; + sprite[ps[myconnectindex].i].cstat = 257; - hittype[ps[myconnectindex].i].temp_data[0] = 0; - hittype[ps[myconnectindex].i].temp_data[1] = 0; - hittype[ps[myconnectindex].i].temp_data[2] = 0; - hittype[ps[myconnectindex].i].temp_data[3] = 0; - hittype[ps[myconnectindex].i].temp_data[4] = 0; - hittype[ps[myconnectindex].i].temp_data[5] = 0; + hittype[ps[myconnectindex].i].temp_data[0] = 0; + hittype[ps[myconnectindex].i].temp_data[1] = 0; + hittype[ps[myconnectindex].i].temp_data[2] = 0; + hittype[ps[myconnectindex].i].temp_data[3] = 0; + hittype[ps[myconnectindex].i].temp_data[4] = 0; + hittype[ps[myconnectindex].i].temp_data[5] = 0; - sprite[ps[myconnectindex].i].hitag = 0; - sprite[ps[myconnectindex].i].lotag = 0; - sprite[ps[myconnectindex].i].pal = ps[myconnectindex].palookup; + sprite[ps[myconnectindex].i].hitag = 0; + sprite[ps[myconnectindex].i].lotag = 0; + sprite[ps[myconnectindex].i].pal = ps[myconnectindex].palookup; + + FTA(17,&ps[myconnectindex]); + } + else + { + ud.god = 0; + sprite[ps[myconnectindex].i].extra = max_player_health; + hittype[ps[myconnectindex].i].extra = -1; + ps[myconnectindex].last_extra = max_player_health; + FTA(18,&ps[myconnectindex]); + } - FTA(17,&ps[myconnectindex]); - } - else - { - ud.god = 0; sprite[ps[myconnectindex].i].extra = max_player_health; - hittype[ps[myconnectindex].i].extra = -1; - ps[myconnectindex].last_extra = max_player_health; - FTA(18,&ps[myconnectindex]); - } + hittype[ps[myconnectindex].i].extra = 0; + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; - sprite[ps[myconnectindex].i].extra = max_player_health; - hittype[ps[myconnectindex].i].extra = 0; - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; + case CHEAT_SCREAMFORME: + ud.god = 1-ud.god; - case CHEAT_SCREAMFORME: - ud.god = 1-ud.god; + if (ud.god) + { + pus = 1; + pub = 1; + sprite[ps[myconnectindex].i].cstat = 257; - if (ud.god) - { - pus = 1; - pub = 1; - sprite[ps[myconnectindex].i].cstat = 257; + hittype[ps[myconnectindex].i].temp_data[0] = 0; + hittype[ps[myconnectindex].i].temp_data[1] = 0; + hittype[ps[myconnectindex].i].temp_data[2] = 0; + hittype[ps[myconnectindex].i].temp_data[3] = 0; + hittype[ps[myconnectindex].i].temp_data[4] = 0; + hittype[ps[myconnectindex].i].temp_data[5] = 0; - hittype[ps[myconnectindex].i].temp_data[0] = 0; - hittype[ps[myconnectindex].i].temp_data[1] = 0; - hittype[ps[myconnectindex].i].temp_data[2] = 0; - hittype[ps[myconnectindex].i].temp_data[3] = 0; - hittype[ps[myconnectindex].i].temp_data[4] = 0; - hittype[ps[myconnectindex].i].temp_data[5] = 0; + sprite[ps[myconnectindex].i].hitag = 0; + sprite[ps[myconnectindex].i].lotag = 0; + sprite[ps[myconnectindex].i].pal = ps[myconnectindex].palookup; + Bstrcpy(fta_quotes[122],"Scream for me, Long Beach!"); + FTA(122,&ps[myconnectindex]); + } + else + { + ud.god = 0; + sprite[ps[myconnectindex].i].extra = max_player_health; + hittype[ps[myconnectindex].i].extra = -1; + ps[myconnectindex].last_extra = max_player_health; + FTA(18,&ps[myconnectindex]); + } - sprite[ps[myconnectindex].i].hitag = 0; - sprite[ps[myconnectindex].i].lotag = 0; - sprite[ps[myconnectindex].i].pal = ps[myconnectindex].palookup; - Bstrcpy(fta_quotes[122],"Scream for me, Long Beach!"); - FTA(122,&ps[myconnectindex]); - } - else - { - ud.god = 0; + CheatGetInventory(); + for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS;weapon++) + ps[myconnectindex].gotweapon[weapon] = 1; + + for (weapon = PISTOL_WEAPON; + weapon < (MAX_WEAPONS); + weapon++) + addammo(weapon, &ps[myconnectindex], max_ammo_amount[weapon]); + ps[myconnectindex].got_access = 7; sprite[ps[myconnectindex].i].extra = max_player_health; - hittype[ps[myconnectindex].i].extra = -1; - ps[myconnectindex].last_extra = max_player_health; - FTA(18,&ps[myconnectindex]); - } + hittype[ps[myconnectindex].i].extra = 0; + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; - CheatGetInventory(); - for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS;weapon++) - ps[myconnectindex].gotweapon[weapon] = 1; + case CHEAT_STUFF: - for (weapon = PISTOL_WEAPON; - weapon < (MAX_WEAPONS); - weapon++) - addammo(weapon, &ps[myconnectindex], max_ammo_amount[weapon]); - ps[myconnectindex].got_access = 7; - sprite[ps[myconnectindex].i].extra = max_player_health; - hittype[ps[myconnectindex].i].extra = 0; - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; + if (VOLUMEONE) + { + j = 6; + } + else + { + j = 0; + } + for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++) + ps[myconnectindex].gotweapon[weapon] = 1; - case CHEAT_STUFF: - - if (VOLUMEONE) { - j = 6; - } else { - j = 0; - } - for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++) - ps[myconnectindex].gotweapon[weapon] = 1; - - for (weapon = PISTOL_WEAPON; - weapon < (MAX_WEAPONS-j); - weapon++) - addammo(weapon, &ps[myconnectindex], max_ammo_amount[weapon]); - CheatGetInventory(); - ps[myconnectindex].got_access = 7; - FTA(5,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + for (weapon = PISTOL_WEAPON; + weapon < (MAX_WEAPONS-j); + weapon++) + addammo(weapon, &ps[myconnectindex], max_ammo_amount[weapon]); + CheatGetInventory(); + ps[myconnectindex].got_access = 7; + FTA(5,&ps[myconnectindex]); + ps[myconnectindex].cheat_phase = 0; - // FTA(21,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - ps[myconnectindex].inven_icon = 1; - return; + // FTA(21,&ps[myconnectindex]); + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + ps[myconnectindex].inven_icon = 1; + return; - case CHEAT_SCOTTY: - case CHEAT_SKILL: - if (k == CHEAT_SCOTTY) - { - i = Bstrlen(cheatquotes[k])-3+VOLUMEONE; - if (!consolecheat) { // JBF 20030914 - short volnume,levnume; - if (VOLUMEALL) { - volnume = cheatbuf[i] - '0'; - levnume = (cheatbuf[i+1] - '0')*10+(cheatbuf[i+2]-'0'); - } else { - volnume = cheatbuf[i] - '0'; - levnume = cheatbuf[i+1] - '0'; - } + case CHEAT_SCOTTY: + case CHEAT_SKILL: + if (k == CHEAT_SCOTTY) + { + i = Bstrlen(cheatquotes[k])-3+VOLUMEONE; + if (!consolecheat) + { // JBF 20030914 + short volnume,levnume; + if (VOLUMEALL) + { + volnume = cheatbuf[i] - '0'; + levnume = (cheatbuf[i+1] - '0')*10+(cheatbuf[i+2]-'0'); + } + else + { + volnume = cheatbuf[i] - '0'; + levnume = cheatbuf[i+1] - '0'; + } - volnume--; - levnume--; + volnume--; + levnume--; - if (VOLUMEONE && volnume > 0) - { - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - } - else if (volnume > num_volumes-1) - { - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - } - else if (volnume == 0) - { - if (levnume > 5) + if (VOLUMEONE && volnume > 0) { ps[myconnectindex].cheat_phase = 0; KB_FlushKeyBoardQueue(); return; } + else if (volnume > num_volumes-1) + { + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + } + else if (volnume == 0) + { + if (levnume > 5) + { + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + } + } + else + { + if (levnume >= 11) + { + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + } + } + + ud.m_volume_number = ud.volume_number = volnume; + ud.m_level_number = ud.level_number = levnume; } else - { - if (levnume >= 11) - { - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - } + { // JBF 20030914 + ud.m_volume_number = ud.volume_number = osdcmd_cheatsinfo_stat.volume; + ud.m_level_number = ud.level_number = osdcmd_cheatsinfo_stat.level; } - ud.m_volume_number = ud.volume_number = volnume; - ud.m_level_number = ud.level_number = levnume; - } else { // JBF 20030914 - ud.m_volume_number = ud.volume_number = osdcmd_cheatsinfo_stat.volume; - ud.m_level_number = ud.level_number = osdcmd_cheatsinfo_stat.level; } - - } - else - { - i = Bstrlen(cheatquotes[k])-1; - ud.m_player_skill = ud.player_skill = cheatbuf[i] - '1'; - } - 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_RESTART; - - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_COORDS: - ps[myconnectindex].cheat_phase = 0; - ud.coords = 1-ud.coords; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_VIEW: - if (ps[myconnectindex].over_shoulder_on) - ps[myconnectindex].over_shoulder_on = 0; - else - { - ps[myconnectindex].over_shoulder_on = 1; - cameradist = 0; - cameraclock = totalclock; - } - FTA(22,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_TIME: - - FTA(21,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_UNLOCK: - if (VOLUMEONE) return; - - for (i=numsectors-1;i>=0;i--) //Unlock - { - j = sector[i].lotag; - if (j == -1 || j == 32767) continue; - if ((j & 0x7fff) > 2) + else { - if (j&(0xffff-16384)) - sector[i].lotag &= (0xffff-16384); - operatesectors(i,ps[myconnectindex].i); + i = Bstrlen(cheatquotes[k])-1; + ud.m_player_skill = ud.player_skill = cheatbuf[i] - '1'; } - } - operateforcefields(ps[myconnectindex].i,-1); + 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; - FTA(100,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; + for (i=connecthead;i>=0;i=connectpoint2[i]) + sendpacket(i,tempbuf,12); + } + else ps[myconnectindex].gm |= MODE_RESTART; - case CHEAT_CASHMAN: - ud.cashman = 1-ud.cashman; - KB_ClearKeyDown(sc_N); - ps[myconnectindex].cheat_phase = 0; - return; + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; - case CHEAT_ITEMS: - CheatGetInventory(); - ps[myconnectindex].got_access = 7; - FTA(5,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; + case CHEAT_COORDS: + ps[myconnectindex].cheat_phase = 0; + ud.coords = 1-ud.coords; + KB_FlushKeyBoardQueue(); + return; - case CHEAT_SHOWMAP: // SHOW ALL OF THE MAP TOGGLE; - ud.showallmap = 1-ud.showallmap; - if (ud.showallmap) + case CHEAT_VIEW: + if (ps[myconnectindex].over_shoulder_on) + ps[myconnectindex].over_shoulder_on = 0; + else + { + ps[myconnectindex].over_shoulder_on = 1; + cameradist = 0; + cameraclock = totalclock; + } + FTA(22,&ps[myconnectindex]); + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + + case CHEAT_TIME: + + FTA(21,&ps[myconnectindex]); + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + + case CHEAT_UNLOCK: + if (VOLUMEONE) return; + + for (i=numsectors-1;i>=0;i--) //Unlock + { + j = sector[i].lotag; + if (j == -1 || j == 32767) continue; + if ((j & 0x7fff) > 2) + { + if (j&(0xffff-16384)) + sector[i].lotag &= (0xffff-16384); + operatesectors(i,ps[myconnectindex].i); + } + } + operateforcefields(ps[myconnectindex].i,-1); + + FTA(100,&ps[myconnectindex]); + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + + case CHEAT_CASHMAN: + ud.cashman = 1-ud.cashman; + KB_ClearKeyDown(sc_N); + ps[myconnectindex].cheat_phase = 0; + return; + + case CHEAT_ITEMS: + CheatGetInventory(); + ps[myconnectindex].got_access = 7; + FTA(5,&ps[myconnectindex]); + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + + case CHEAT_SHOWMAP: // SHOW ALL OF THE MAP TOGGLE; + ud.showallmap = 1-ud.showallmap; + if (ud.showallmap) + { + for (i=0;i<(MAXSECTORS>>3);i++) + show2dsector[i] = 255; + for (i=0;i<(MAXWALLS>>3);i++) + show2dwall[i] = 255; + FTA(111,&ps[myconnectindex]); + } + else + { + for (i=0;i<(MAXSECTORS>>3);i++) + show2dsector[i] = 0; + for (i=0;i<(MAXWALLS>>3);i++) + show2dwall[i] = 0; + FTA(1,&ps[myconnectindex]); + } + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + + case CHEAT_TODD: + FTA(99,&ps[myconnectindex]); + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + + case CHEAT_RATE: + ud.tickrate = !ud.tickrate; + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + + case CHEAT_BETA: + FTA(105,&ps[myconnectindex]); + KB_ClearKeyDown(sc_H); + ps[myconnectindex].cheat_phase = 0; + KB_FlushKeyBoardQueue(); + return; + + case CHEAT_HYPER: + ps[myconnectindex].steroids_amount = 399; + ps[myconnectindex].heat_amount = 1200; + ps[myconnectindex].cheat_phase = 0; + FTA(37,&ps[myconnectindex]); + KB_FlushKeyBoardQueue(); + return; + + case CHEAT_MONSTERS: { - for (i=0;i<(MAXSECTORS>>3);i++) - show2dsector[i] = 255; - for (i=0;i<(MAXWALLS>>3);i++) - show2dwall[i] = 255; - FTA(111,&ps[myconnectindex]); + 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; } - else - { - for (i=0;i<(MAXSECTORS>>3);i++) - show2dsector[i] = 0; - for (i=0;i<(MAXWALLS>>3);i++) - show2dwall[i] = 0; - FTA(1,&ps[myconnectindex]); - } - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_TODD: - FTA(99,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_RATE: - ud.tickrate = !ud.tickrate; - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_BETA: - FTA(105,&ps[myconnectindex]); - KB_ClearKeyDown(sc_H); - ps[myconnectindex].cheat_phase = 0; - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_HYPER: - ps[myconnectindex].steroids_amount = 399; - ps[myconnectindex].heat_amount = 1200; - ps[myconnectindex].cheat_phase = 0; - FTA(37,&ps[myconnectindex]); - KB_FlushKeyBoardQueue(); - return; - - case CHEAT_MONSTERS: - { - 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; - } - case CHEAT_RESERVED: - case CHEAT_RESERVED3: - ud.eog = 1; - ps[myconnectindex].gm |= MODE_EOL; - KB_FlushKeyBoardQueue(); - return; + case CHEAT_RESERVED: + case CHEAT_RESERVED3: + ud.eog = 1; + ps[myconnectindex].gm |= MODE_EOL; + KB_FlushKeyBoardQueue(); + return; } } } @@ -7376,16 +7751,56 @@ void nonsharedkeys(void) 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) { @@ -7681,7 +8096,8 @@ FAKE_F3: if (ud.overhead_on != 0) { - j = totalclock-nonsharedtimer; nonsharedtimer += j; + j = totalclock-nonsharedtimer; + nonsharedtimer += j; if (BUTTON(gamefunc_Enlarge_Screen)) ps[myconnectindex].zoom += mulscale6(j,max(ps[myconnectindex].zoom,256)); if (BUTTON(gamefunc_Shrink_Screen)) @@ -7789,7 +8205,8 @@ char rancid_ip_strings[MAXPLAYERS][32], rancid_local_port_string[8]; static tokenlist rancidtokens[] = { - { "interface", T_INTERFACE }, + { "interface", T_INTERFACE + }, { "mode", T_MODE }, { "allow", T_ALLOW }, }; @@ -7806,42 +8223,44 @@ int load_rancid_net(char *fn) script = scriptfile_fromfile(fn); if (!script) return -1; - while (1) { + while (1) + { tokn = getatoken(script,rancidtokens,sizeof(rancidtokens)/sizeof(tokenlist)); cmdtokptr = script->ltextptr; - switch (tokn) { - case T_INTERFACE: + switch (tokn) { - char *ip; + case T_INTERFACE: + { + 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; - case T_MODE: - { - char *mode; - - if (scriptfile_getstring(script,&mode)) break; - } - break; - case T_ALLOW: - { - char *ip; - - if (scriptfile_getstring(script,&ip)) break; - Bstrcpy(rancid_ip_strings[rancid_players++],ip); - } - break; - case T_EOF: - return(0); - default: + 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; + + if (scriptfile_getstring(script,&mode)) break; + } + break; + case T_ALLOW: + { + char *ip; + + if (scriptfile_getstring(script,&ip)) break; + Bstrcpy(rancid_ip_strings[rancid_players++],ip); + } + break; + case T_EOF: + return(0); + default: + break; } } @@ -7858,7 +8277,8 @@ static int stringsort(const char *p1, const char *p2) static tokenlist grptokens[] = { - { "loadgrp", T_LOADGRP }, + { "loadgrp", T_LOADGRP + }, }; int loadgroupfiles(char *fn) @@ -7870,28 +8290,30 @@ int loadgroupfiles(char *fn) script = scriptfile_fromfile(fn); if (!script) return -1; - while (1) { + while (1) + { tokn = getatoken(script,grptokens,sizeof(grptokens)/sizeof(tokenlist)); cmdtokptr = script->ltextptr; - switch (tokn) { - case T_LOADGRP: + switch (tokn) { - char *fn; - if (!scriptfile_getstring(script,&fn)) + case T_LOADGRP: { - int j = initgroupfile(fn); + char *fn; + if (!scriptfile_getstring(script,&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; - case T_EOF: - return(0); - default: break; + case T_EOF: + return(0); + default: + break; } } @@ -7937,27 +8359,32 @@ void checkcommandline(int argc,char **argv) c = argv[i]; if (((*c == '/') || (*c == '-')) && (!firstnet)) { - if (!Bstrcasecmp(c+1,"nam")) { + if (!Bstrcasecmp(c+1,"nam")) + { strcpy(defaultduke3dgrp, "nam.grp"); i++; continue; } - if (!Bstrcasecmp(c+1,"setup")) { + if (!Bstrcasecmp(c+1,"setup")) + { CommandSetup = TRUE; i++; continue; } - if (!Bstrcasecmp(c+1,"keepaddr")) { + if (!Bstrcasecmp(c+1,"keepaddr")) + { keepaddr = 1; i++; continue; } - if (!Bstrcasecmp(c+1,"stun")) { + if (!Bstrcasecmp(c+1,"stun")) + { natfree = 1; //Addfaz NatFree i++; continue; } - if (!Bstrcasecmp(c+1,"disableautoaim")) { + if (!Bstrcasecmp(c+1,"disableautoaim")) + { i++; continue; } @@ -8058,7 +8485,8 @@ void checkcommandline(int argc,char **argv) i++; continue; } - if (!Bstrcasecmp(c+1,"net")) { + if (!Bstrcasecmp(c+1,"net")) + { NoSetup = TRUE; firstnet = i; netparamcount = argc - i - 1; @@ -8066,29 +8494,35 @@ void checkcommandline(int argc,char **argv) i++; continue; } - if (!Bstrcasecmp(c+1,"name")) { - if (argc > i+1) { + if (!Bstrcasecmp(c+1,"name")) + { + if (argc > i+1) + { CommandName = argv[i+1]; i++; } i++; continue; } - if (!Bstrcasecmp(c+1,"map")) { - if (argc > i+1) { + if (!Bstrcasecmp(c+1,"map")) + { + if (argc > i+1) + { CommandMap = argv[i+1]; i++; } i++; continue; } - if (!Bstrcasecmp(c+1,"condebug")) { + if (!Bstrcasecmp(c+1,"condebug")) + { condebug = 1; i++; continue; } #if !defined(_WIN32) - if (!Bstrcasecmp(c+1,"usecwd")) { + if (!Bstrcasecmp(c+1,"usecwd")) + { usecwd = 1; i++; continue; @@ -8096,13 +8530,21 @@ void checkcommandline(int argc,char **argv) #endif } - if (firstnet > 0) { - if (*c == '-' || *c == '/') { + if (firstnet > 0) + { + if (*c == '-' || *c == '/') + { c++; if (((c[0] == 'n') || (c[0] == 'N')) && (c[1] == '0')) - { networkmode = 0; initprintf("Network mode: master/slave\n"); } + { + networkmode = 0; + initprintf("Network mode: master/slave\n"); + } else if (((c[0] == 'n') || (c[0] == 'N')) && (c[1] == '1')) - { networkmode = 1; initprintf("Network mode: peer-to-peer\n"); } + { + networkmode = 1; + initprintf("Network mode: peer-to-peer\n"); + } } @@ -8116,274 +8558,282 @@ void checkcommandline(int argc,char **argv) c++; switch (*c) { - case '?': - comlinehelp(argv); - exit(0); - break; - case 'a': - case 'A': - ud.playerai = 1; - initprintf("Other player AI.\n"); - break; - case 'c': - case 'C': - - c++; - //if(*c == '1' || *c == '2' || *c == '3') - // ud.m_coop = *c - '0' - 1; - //else ud.m_coop = 0; - - ud.m_coop = 0; - while ((*c >= '0')&&(*c <= '9')) { - ud.m_coop *= 10; - ud.m_coop += *c - '0'; - c++; - } - ud.m_coop--; - //switch(ud.m_coop) - //{ - //case 0: - // initprintf("Dukematch (spawn).\n"); - // break; - //case 1: - // initprintf("Cooperative play.\n"); - // break; - //case 2: - // initprintf("Dukematch (no spawn).\n"); - // break; - //} - break; - case 'd': - case 'D': - c++; - if (strchr(c,'.') == 0) - Bstrcat(c,".dmo"); - initprintf("Play demo %s.\n",c); - Bstrcpy(firstdemofile,c); - break; - case 'f': - case 'F': - c++; - if (*c == '1') - movesperpacket = 1; - if (*c == '2') - movesperpacket = 2; - if (*c == '4') - { - movesperpacket = 4; - setpackettimeout(0x3fffffff,0x3fffffff); - } - break; - case 'g': - case 'G': - c++; - if (!*c) break; - strcpy(tempbuf,c); - if (strchr(tempbuf,'.') == 0) - strcat(tempbuf,".grp"); - - { - struct strllist *s; - s = (struct strllist *)calloc(1,sizeof(struct strllist)); - s->str = strdup(tempbuf); - if (CommandGrps) { - struct strllist *t; - for (t = CommandGrps; t->next; t=t->next) ; - t->next = s; - } else { - CommandGrps = s; - } - } - break; - case 'h': - case 'H': - c++; - if (*c) { - duke3ddef = c; - initprintf("Using DEF file: %s.\n",duke3ddef); - } - break; - case 'i': - case 'I': - c++; - if (*c == '0') networkmode = 0; - if (*c == '1') networkmode = 1; - initprintf("Network Mode %d\n",networkmode); - break; - case 'j': - case 'J': - c++; - if (!*c) break; - { - struct strllist *s; - s = (struct strllist *)calloc(1,sizeof(struct strllist)); - s->str = strdup(c); - if (CommandPaths) { - struct strllist *t; - for (t = CommandPaths; t->next; t=t->next) ; - t->next = s; - } else { - CommandPaths = s; - } - } - break; - case 'l': - case 'L': - ud.warp_on = 1; - c++; - ud.m_level_number = ud.level_number = (atol(c)-1)%11; - break; - case 'm': - case 'M': - if (*(c+1) != 'a' && *(c+1) != 'A') - { - ud.m_monsters_off = 1; - ud.m_player_skill = ud.player_skill = 0; - initprintf("Monsters off.\n"); - } - break; - case 'n': - case 'N': - c++; - if (*c == 's' || *c == 'S') - { - CommandSoundToggleOff = 2; - initprintf("Sound off.\n"); - } - else if (*c == 'm' || *c == 'M') - { - CommandMusicToggleOff = 1; - initprintf("Music off.\n"); - } - else if (*c == 'd' || *c == 'D') - { - FILE * fp=fopen("gamevars.txt","w"); - InitGameVars(); - DumpGameVars(fp); - fclose(fp); - initprintf("Game variables saved to gamevars.txt.\n"); - } - else - { + case '?': comlinehelp(argv); - exit(-1); - } - break; - case 'q': - case 'Q': - initprintf("Fake multiplayer mode.\n"); - if (*(++c) == 0) ud.multimode = 1; - else ud.multimode = atol(c)%17; - ud.m_coop = ud.coop = 0; - ud.m_marker = ud.marker = 1; - ud.m_respawn_monsters = ud.respawn_monsters = 1; - ud.m_respawn_items = ud.respawn_items = 1; - ud.m_respawn_inventory = ud.respawn_inventory = 1; - break; - case 'r': - case 'R': - ud.m_recstat = 1; - initprintf("Demo record mode on.\n"); - break; - case 's': - case 'S': - c++; - ud.m_player_skill = ud.player_skill = (atol(c)%5); - if (ud.m_player_skill == 4) - ud.m_respawn_monsters = ud.respawn_monsters = 1; - break; - case 't': - case 'T': - c++; - if (*c == '1') ud.m_respawn_monsters = 1; - else if (*c == '2') ud.m_respawn_items = 1; - else if (*c == '3') ud.m_respawn_inventory = 1; - else - { - ud.m_respawn_monsters = 1; - ud.m_respawn_items = 1; - ud.m_respawn_inventory = 1; - } - initprintf("Respawn on.\n"); - break; - case 'u': - case 'U': - CommandWeaponChoice = 1; - c++; - j = 0; - if (*c) - { - initprintf("Using favorite weapon order(s).\n"); - while (*c) - { - ud.wchoice[0][j] = *c-'0'; - c++; - j++; - } - while (j < 10) - { - if (j == 9) - ud.wchoice[0][9] = 1; - else - ud.wchoice[0][j] = 2; + exit(0); + break; + case 'a': + case 'A': + ud.playerai = 1; + initprintf("Other player AI.\n"); + break; + case 'c': + case 'C': - j++; + c++; + //if(*c == '1' || *c == '2' || *c == '3') + // ud.m_coop = *c - '0' - 1; + //else ud.m_coop = 0; + + ud.m_coop = 0; + while ((*c >= '0')&&(*c <= '9')) + { + ud.m_coop *= 10; + ud.m_coop += *c - '0'; + c++; } - } - else - { - initprintf("Using default weapon orders.\n"); - ud.wchoice[0][0] = 3; - ud.wchoice[0][1] = 4; - ud.wchoice[0][2] = 5; - ud.wchoice[0][3] = 7; - ud.wchoice[0][4] = 8; - ud.wchoice[0][5] = 6; - ud.wchoice[0][6] = 0; - ud.wchoice[0][7] = 2; - ud.wchoice[0][8] = 9; - ud.wchoice[0][9] = 1; - } - break; - case 'v': - case 'V': - c++; - ud.warp_on = 1; - ud.m_volume_number = ud.volume_number = atol(c)-1; - break; - case 'w': - case 'W': - ud.coords = 1; - break; - case 'x': - case 'X': - c++; - if (*c) - { - Bstrcpy(confilename,c); - userconfiles = 1; - initprintf("Using CON file: %s.\n",confilename); - } - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - ud.warp_on = 2 + (*c) - '0'; - break; - case 'z': - case 'Z': - c++; - condebug = atol(c); - if (!condebug) - condebug = 1; - break; + ud.m_coop--; + //switch(ud.m_coop) + //{ + //case 0: + // initprintf("Dukematch (spawn).\n"); + // break; + //case 1: + // initprintf("Cooperative play.\n"); + // break; + //case 2: + // initprintf("Dukematch (no spawn).\n"); + // break; + //} + break; + case 'd': + case 'D': + c++; + if (strchr(c,'.') == 0) + Bstrcat(c,".dmo"); + initprintf("Play demo %s.\n",c); + Bstrcpy(firstdemofile,c); + break; + case 'f': + case 'F': + c++; + if (*c == '1') + movesperpacket = 1; + if (*c == '2') + movesperpacket = 2; + if (*c == '4') + { + movesperpacket = 4; + setpackettimeout(0x3fffffff,0x3fffffff); + } + break; + case 'g': + case 'G': + c++; + if (!*c) break; + strcpy(tempbuf,c); + if (strchr(tempbuf,'.') == 0) + strcat(tempbuf,".grp"); + + { + struct strllist *s; + s = (struct strllist *)calloc(1,sizeof(struct strllist)); + s->str = strdup(tempbuf); + if (CommandGrps) + { + struct strllist *t; + for (t = CommandGrps; t->next; t=t->next) ; + t->next = s; + } + else + { + CommandGrps = s; + } + } + break; + case 'h': + case 'H': + c++; + if (*c) + { + duke3ddef = c; + initprintf("Using DEF file: %s.\n",duke3ddef); + } + break; + case 'i': + case 'I': + c++; + if (*c == '0') networkmode = 0; + if (*c == '1') networkmode = 1; + initprintf("Network Mode %d\n",networkmode); + break; + case 'j': + case 'J': + c++; + if (!*c) break; + { + struct strllist *s; + s = (struct strllist *)calloc(1,sizeof(struct strllist)); + s->str = strdup(c); + if (CommandPaths) + { + struct strllist *t; + for (t = CommandPaths; t->next; t=t->next) ; + t->next = s; + } + else + { + CommandPaths = s; + } + } + break; + case 'l': + case 'L': + ud.warp_on = 1; + c++; + ud.m_level_number = ud.level_number = (atol(c)-1)%11; + break; + case 'm': + case 'M': + if (*(c+1) != 'a' && *(c+1) != 'A') + { + ud.m_monsters_off = 1; + ud.m_player_skill = ud.player_skill = 0; + initprintf("Monsters off.\n"); + } + break; + case 'n': + case 'N': + c++; + if (*c == 's' || *c == 'S') + { + CommandSoundToggleOff = 2; + initprintf("Sound off.\n"); + } + else if (*c == 'm' || *c == 'M') + { + CommandMusicToggleOff = 1; + initprintf("Music off.\n"); + } + else if (*c == 'd' || *c == 'D') + { + FILE * fp=fopen("gamevars.txt","w"); + InitGameVars(); + DumpGameVars(fp); + fclose(fp); + initprintf("Game variables saved to gamevars.txt.\n"); + } + else + { + comlinehelp(argv); + exit(-1); + } + break; + case 'q': + case 'Q': + initprintf("Fake multiplayer mode.\n"); + if (*(++c) == 0) ud.multimode = 1; + else ud.multimode = atol(c)%17; + ud.m_coop = ud.coop = 0; + ud.m_marker = ud.marker = 1; + ud.m_respawn_monsters = ud.respawn_monsters = 1; + ud.m_respawn_items = ud.respawn_items = 1; + ud.m_respawn_inventory = ud.respawn_inventory = 1; + break; + case 'r': + case 'R': + ud.m_recstat = 1; + initprintf("Demo record mode on.\n"); + break; + case 's': + case 'S': + c++; + ud.m_player_skill = ud.player_skill = (atol(c)%5); + if (ud.m_player_skill == 4) + ud.m_respawn_monsters = ud.respawn_monsters = 1; + break; + case 't': + case 'T': + c++; + if (*c == '1') ud.m_respawn_monsters = 1; + else if (*c == '2') ud.m_respawn_items = 1; + else if (*c == '3') ud.m_respawn_inventory = 1; + else + { + ud.m_respawn_monsters = 1; + ud.m_respawn_items = 1; + ud.m_respawn_inventory = 1; + } + initprintf("Respawn on.\n"); + break; + case 'u': + case 'U': + CommandWeaponChoice = 1; + c++; + j = 0; + if (*c) + { + initprintf("Using favorite weapon order(s).\n"); + while (*c) + { + ud.wchoice[0][j] = *c-'0'; + c++; + j++; + } + while (j < 10) + { + if (j == 9) + ud.wchoice[0][9] = 1; + else + ud.wchoice[0][j] = 2; + + j++; + } + } + else + { + initprintf("Using default weapon orders.\n"); + ud.wchoice[0][0] = 3; + ud.wchoice[0][1] = 4; + ud.wchoice[0][2] = 5; + ud.wchoice[0][3] = 7; + ud.wchoice[0][4] = 8; + ud.wchoice[0][5] = 6; + ud.wchoice[0][6] = 0; + ud.wchoice[0][7] = 2; + ud.wchoice[0][8] = 9; + ud.wchoice[0][9] = 1; + } + break; + case 'v': + case 'V': + c++; + ud.warp_on = 1; + ud.m_volume_number = ud.volume_number = atol(c)-1; + break; + case 'w': + case 'W': + ud.coords = 1; + break; + case 'x': + case 'X': + c++; + if (*c) + { + Bstrcpy(confilename,c); + userconfiles = 1; + initprintf("Using CON file: %s.\n",confilename); + } + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + ud.warp_on = 2 + (*c) - '0'; + break; + case 'z': + case 'Z': + c++; + condebug = atol(c); + if (!condebug) + condebug = 1; + break; } } i++; @@ -8417,7 +8867,8 @@ void Logo(void) clearsoundlocks(); // JBF 20031228 if (ud.multimode < 2 && (logoflags & LOGO_FLAG_ENABLED)) { - if (VOLUMEALL && (logoflags & LOGO_FLAG_PLAYANIM)) { + if (VOLUMEALL && (logoflags & LOGO_FLAG_PLAYANIM)) + { if (!KB_KeyWaiting() && nomorelogohack == 0) { @@ -8434,7 +8885,8 @@ void Logo(void) if (logoflags & LOGO_FLAG_PLAYMUSIC) playmusic(&env_music_fn[0][0]); - if (!NAM) { + if (!NAM) + { fadepal(0,0,0, 0,64,7); //ps[myconnectindex].palette = drealms; //palto(0,0,0,63); @@ -8445,7 +8897,8 @@ void Logo(void) nextpage(); fadepal(0,0,0, 63,0,-7); totalclock = 0; - while (totalclock < (120*7) && !KB_KeyWaiting()) { + while (totalclock < (120*7) && !KB_KeyWaiting()) + { handleevents(); getpackets(); } @@ -8482,7 +8935,8 @@ void Logo(void) } 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; + } + else soundanm = 1; if (logoflags & LOGO_FLAG_THREEDEE) { if (totalclock > 220 && totalclock < (220+30)) @@ -8498,8 +8952,10 @@ void Logo(void) } 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 + } + else soundanm = 2; + if (PLUTOPAK && (logoflags & LOGO_FLAG_PLUTOPAKSPRITE)) + { // JBF 20030804 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); @@ -8688,7 +9144,8 @@ void compilecons(void) void sanitizegametype() { // initprintf("ud.m_coop=%i before sanitization\n",ud.m_coop); - if (ud.m_coop >= num_gametypes || ud.m_coop < 0) { + if (ud.m_coop >= num_gametypes || ud.m_coop < 0) + { ud.m_coop = 0; } Bsprintf(tempbuf,"%s\n",gametype_names[ud.m_coop]); @@ -8708,7 +9165,8 @@ void Startup(void) CONFIG_ReadKeys(); // we re-read the keys after compiling the CONs - if (initengine()) { + if (initengine()) + { wm_msgbox("Build Engine Initialisation Error", "There was a problem initialising the Build engine: %s", engineerrstr); freeconmem(); @@ -8735,11 +9193,15 @@ void Startup(void) myname[sizeof(myname)] = '\0'; } - if (CommandMap) { - if (VOLUMEONE) { + if (CommandMap) + { + if (VOLUMEONE) + { initprintf("The -map option is available in the registered version only!\n"); boardfilename[0] = 0; - } else { + } + else + { char *dot, *slash; Bstrcpy(boardfilename, CommandMap); @@ -8752,7 +9214,8 @@ void Startup(void) Bstrcat(boardfilename,".map"); i = kopen4load(boardfilename,0); - if (i!=-1) { + if (i!=-1) + { initprintf("Using level: '%s'.\n",boardfilename); kclose(i); } @@ -8764,12 +9227,14 @@ void Startup(void) } } - if (VOLUMEONE) { + 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 (CONTROL_Startup(1, &GetTime, TICRATE)) { + if (CONTROL_Startup(1, &GetTime, TICRATE)) + { uninitengine(); exit(1); } @@ -8807,11 +9272,14 @@ void Startup(void) } //initmultiplayers(netparamcount,netparam, 0,0,0); - if (initmultiplayersparms(netparamcount,netparam)) { + if (initmultiplayersparms(netparamcount,netparam)) + { initprintf("Waiting for players...\n"); - while (initmultiplayerscycle()) { + while (initmultiplayerscycle()) + { handleevents(); - if (quitevent) { + if (quitevent) + { Shutdown(); return; } @@ -8819,7 +9287,8 @@ void Startup(void) } if (netparam) Bfree(netparam); - netparam = NULL; netparamcount = 0; + netparam = NULL; + netparamcount = 0; if (numplayers > 1) initprintf("Multiplayer initialized.\n"); @@ -9011,7 +9480,8 @@ void app_main(int argc,char **argv) { int i, j; #ifdef RENDERTYPEWIN - if (win_checkinstance()) { + if (win_checkinstance()) + { if (!wm_ynbox("EDuke32","Another Build game is currently running. " "Do you wish to continue starting this copy?")) return; @@ -9042,7 +9512,8 @@ void app_main(int argc,char **argv) { struct strllist *s; - while (CommandPaths) { + while (CommandPaths) + { s = CommandPaths->next; addsearchpath(CommandPaths->str); @@ -9063,7 +9534,8 @@ void app_main(int argc,char **argv) int asperr; if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd); - if ((homedir = Bgethomedir())) { + if ((homedir = Bgethomedir())) + { Bsnprintf(cwd,sizeof(cwd),"%s/" #if defined(_WIN32) "EDuke32 Settings" @@ -9074,7 +9546,8 @@ void app_main(int argc,char **argv) #endif ,homedir); asperr = addsearchpath(cwd); - if (asperr == -2) { + if (asperr == -2) + { if (Bmkdir(cwd,S_IRWXU) == 0) asperr = addsearchpath(cwd); else asperr = -1; } @@ -9105,7 +9578,8 @@ void app_main(int argc,char **argv) } #endif - if (preinitengine()) { + if (preinitengine()) + { wm_msgbox("Build Engine Initialisation Error", "There was a problem initialising the Build engine: %s", engineerrstr); exit(1); @@ -9117,25 +9591,30 @@ void app_main(int argc,char **argv) // if it is not found, choose the first GRP from the list of struct grpfile *fg, *first = NULL; int i; - for (fg = foundgrps; fg; fg=fg->next) { + for (fg = foundgrps; fg; fg=fg->next) + { for (i = 0; icrcval == grpfiles[i].crcval) break; if (i == numgrpfiles) continue; // unrecognised grp file fg->game = grpfiles[i].game; if (!first) first = fg; - if (!Bstrcasecmp(fg->name, defaultduke3dgrp)) { + if (!Bstrcasecmp(fg->name, defaultduke3dgrp)) + { gametype = grpfiles[i].game; break; } } - if (!fg && first) { + if (!fg && first) + { Bstrcpy(defaultduke3dgrp, first->name); gametype = first->game; } } #if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) - if (i < 0 || (!NoSetup && ForceSetup) || CommandSetup) { - if (quitevent || !startwin_run()) { + if (i < 0 || (!NoSetup && ForceSetup) || CommandSetup) + { + if (quitevent || !startwin_run()) + { uninitengine(); exit(0); } @@ -9144,7 +9623,8 @@ void app_main(int argc,char **argv) FreeGroups(); - if (NAM) { + if (NAM) + { // overwrite the default GRP and CON so that if the user chooses // something different, they get what they asked for Bsprintf(defaultduke3dgrp,"nam.grp"); @@ -9157,18 +9637,21 @@ void app_main(int argc,char **argv) initgroupfile(duke3dgrp); i = kopen4load("DUKESW.BIN",1); // JBF 20030810 - if (i!=-1) { + if (i!=-1) + { shareware = 1; kclose(i); } { struct strllist *s; - while (CommandGrps) { + while (CommandGrps) + { s = CommandGrps->next; j = initgroupfile(CommandGrps->str); if (j == -1) initprintf("Warning: could not find group file %s.\n",CommandGrps->str); - else { + else + { groupfile = j; initprintf("Using group file %s.\n",CommandGrps->str); } @@ -9199,7 +9682,8 @@ void app_main(int argc,char **argv) RegisterShutdownFunction(Shutdown); - if (VOLUMEONE) { + if (VOLUMEONE) + { initprintf("Distribution of shareware Duke Nukem 3D is restricted in certain ways.\n"); initprintf("Please read LICENSE.DOC for more details.\n"); } @@ -9262,12 +9746,14 @@ 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++; } @@ -9298,7 +9784,8 @@ void app_main(int argc,char **argv) SoundStartup(); loadtmb(); - if (VOLUMEONE) { + if (VOLUMEONE) + { if (numplayers > 4 || ud.multimode > 4) gameexit(" The full version of Duke Nukem 3D supports 5 or more players."); } @@ -9375,13 +9862,17 @@ MAIN_LOOP_RESTART: 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 { + } + else + { if (ud.color) ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; else ps[myconnectindex].palookup = ud.pcolor[myconnectindex]; } @@ -9391,8 +9882,10 @@ MAIN_LOOP_RESTART: while (!(ps[myconnectindex].gm&MODE_END)) //The whole loop!!!!!!!!!!!!!!!!!! { - if (handleevents()) { // JBF - if (quitevent) { + if (handleevents()) + { // JBF + if (quitevent) + { KB_KeyDown[sc_Escape] = 1; quitevent = 0; } @@ -9427,7 +9920,8 @@ MAIN_LOOP_RESTART: ud.eog = 0; if (ud.multimode < 2) { - if (!VOLUMEALL) { + if (!VOLUMEALL) + { doorders(); } ps[myconnectindex].gm = MODE_MENU; @@ -9445,7 +9939,8 @@ MAIN_LOOP_RESTART: display_bonus_screen = 1; ready2send = 0; if (numplayers > 1) ps[myconnectindex].gm = MODE_GAME; - if (enterlevel(ps[myconnectindex].gm)) { + if (enterlevel(ps[myconnectindex].gm)) + { backtomenu(); goto MAIN_LOOP_RESTART; } @@ -9485,7 +9980,8 @@ MAIN_LOOP_RESTART: checksync(); - if (VOLUMEONE) { + if (VOLUMEONE) + { 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); } @@ -9526,7 +10022,8 @@ 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); @@ -9535,7 +10032,9 @@ char opendemoread(char which_demo) // 0 = mine ud.reccnt=0; demo_version = 0; return 0; - } else { + } + else + { demo_version = ver; OSD_Printf("Demo %s is of version %d.\n", d, ver); } @@ -9566,9 +10065,11 @@ 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; + } + else if (kread(recfilep,(char *)boardfilename,128) != 128) goto corrupt; if (boardfilename[0] != 0) { @@ -9576,8 +10077,10 @@ char opendemoread(char which_demo) // 0 = mine ud.m_volume_number = 0; } - for (i=0;iposx == myxbak[i] && p->posy == myybak[i] && p->posz == myzbak[i] && p->horiz == myhorizbak[i] && p->ang == myangbak[i]) return; - myx = p->posx; omyx = p->oposx; myxvel = p->posxv; - myy = p->posy; omyy = p->oposy; myyvel = p->posyv; - myz = p->posz; omyz = p->oposz; myzvel = p->poszv; - myang = p->ang; omyang = p->oang; + myx = p->posx; + omyx = p->oposx; + myxvel = p->posxv; + myy = p->posy; + omyy = p->oposy; + myyvel = p->posyv; + myz = p->posz; + omyz = p->oposz; + myzvel = p->poszv; + myang = p->ang; + omyang = p->oang; mycursectnum = p->cursectnum; - myhoriz = p->horiz; omyhoriz = p->ohoriz; - myhorizoff = p->horizoff; omyhorizoff = p->ohorizoff; + myhoriz = p->horiz; + omyhoriz = p->ohoriz; + myhorizoff = p->horizoff; + omyhorizoff = p->ohorizoff; myjumpingcounter = p->jumping_counter; myjumpingtoggle = p->jumping_toggle; myonground = p->on_ground; @@ -10322,7 +10842,8 @@ 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); @@ -10497,7 +11018,8 @@ char domovethings(void) Bsprintf(fta_quotes[117],"%s",&ud.user_name[sprite[hs].yvel][0]); ps[screenpeek].fta = 12, ps[screenpeek].ftq = 117; } - } else if (ps[screenpeek].fta > 2) ps[screenpeek].fta -= 3; + } + else if (ps[screenpeek].fta > 2) ps[screenpeek].fta -= 3; } } @@ -10522,7 +11044,11 @@ char domovethings(void) j = -1; for (i=connecthead;i>=0;i=connectpoint2[i]) { - if ((sync[i].bits&(1<<26)) == 0) { j = i; continue; } + if ((sync[i].bits&(1<<26)) == 0) + { + j = i; + continue; + } closedemowrite(); @@ -10599,10 +11125,12 @@ char domovethings(void) j = 0; 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; } @@ -10678,25 +11206,41 @@ 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(); + } } @@ -10731,11 +11275,13 @@ void dobonus(char bonusonly) if (VOLUMEALL) wm_setapptitle(HEAD2); else wm_setapptitle(HEAD); - if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) { + if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0]) + { lastmapname = Bstrrchr(boardfilename,'\\'); if (!lastmapname) lastmapname = Bstrrchr(boardfilename,'/'); if (!lastmapname) lastmapname = boardfilename; - } else lastmapname = level_names[(ud.volume_number*11)+ud.last_level-1]; + } + else lastmapname = level_names[(ud.volume_number*11)+ud.last_level-1]; bonuscnt = 0; @@ -10754,216 +11300,272 @@ void dobonus(char bonusonly) if (numplayers < 2 && ud.eog && ud.from_bonus == 0) switch (ud.volume_number) { - case 0: - if (ud.lockout == 0) - { - setgamepalette(&ps[myconnectindex], endingpal, 3); // JBF 20040308 - clearview(0L); - rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - nextpage(); - //ps[myconnectindex].palette = endingpal; - fadepal(0,0,0, 63,0,-1); - - KB_FlushKeyboardQueue(); - totalclock = 0; tinc = 0; - while (1) + case 0: + if (ud.lockout == 0) { + setgamepalette(&ps[myconnectindex], endingpal, 3); // JBF 20040308 clearview(0L); rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + nextpage(); + //ps[myconnectindex].palette = endingpal; + fadepal(0,0,0, 63,0,-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 (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) + KB_FlushKeyboardQueue(); + totalclock = 0; + tinc = 0; + while (1) { - 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++; } + clearview(0L); + rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-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) + // 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]) { - sound(BOSSTALKTODUKE); + 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 >= 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++; } - rotatesprite(breathe[t+3]<<16,breathe[t+4]<<16,65536L,0,breathe[t+2],0,0,2+8+16+64+128,0,0,xdim-1,ydim-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) + { + sound(BOSSTALKTODUKE); + bonuscnt++; + } + rotatesprite(breathe[t+3]<<16,breathe[t+4]<<16,65536L,0,breathe[t+2],0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + } + } + handleevents(); + getpackets(); + nextpage(); + if (KB_KeyWaiting()) break; } + } + + fadepal(0,0,0, 0,64,1); + + KB_FlushKeyboardQueue(); + //ps[myconnectindex].palette = palette; + setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 + + 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(); - nextpage(); - if (KB_KeyWaiting()) break; } - } - - fadepal(0,0,0, 0,64,1); - - KB_FlushKeyboardQueue(); - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 - - 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(); } - fadepal(0,0,0, 0,64,1); - MUSIC_StopSong(); - FX_StopAllSounds(); - clearsoundlocks(); - break; - case 1: - MUSIC_StopSong(); - clearview(0L); - nextpage(); - - if (ud.lockout == 0) - { - playanm("cineov2.anm",1); - KB_FlushKeyBoardQueue(); + fadepal(0,0,0, 0,64,1); + MUSIC_StopSong(); + FX_StopAllSounds(); + clearsoundlocks(); + break; + case 1: + MUSIC_StopSong(); clearview(0L); nextpage(); - } - sound(PIPEBOMB_EXPLODE); + if (ud.lockout == 0) + { + playanm("cineov2.anm",1); + KB_FlushKeyBoardQueue(); + clearview(0L); + nextpage(); + } - fadepal(0,0,0, 0,64,1); - setview(0,0,xdim-1,ydim-1); - KB_FlushKeyboardQueue(); - //ps[myconnectindex].palette = palette; - 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(); } - IFISSOFTMODE fadepal(0,0,0, 0,64,1); + sound(PIPEBOMB_EXPLODE); - break; - - case 3: - - setview(0,0,xdim-1,ydim-1); - - MUSIC_StopSong(); - clearview(0L); - nextpage(); - - if (ud.lockout == 0) - { + fadepal(0,0,0, 0,64,1); + setview(0,0,xdim-1,ydim-1); KB_FlushKeyboardQueue(); - playanm("vol4e1.anm",8); + //ps[myconnectindex].palette = palette; + 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(); + } + IFISSOFTMODE fadepal(0,0,0, 0,64,1); + + break; + + case 3: + + setview(0,0,xdim-1,ydim-1); + + MUSIC_StopSong(); clearview(0L); nextpage(); - playanm("vol4e2.anm",10); - clearview(0L); - nextpage(); - playanm("vol4e3.anm",11); - clearview(0L); - nextpage(); - } - FX_StopAllSounds(); - clearsoundlocks(); - sound(ENDSEQVOL3SND4); - KB_FlushKeyBoardQueue(); - - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 - IFISSOFTMODE palto(0,0,0,63); - clearview(0L); - menutext(160,60,0,0,"THANKS TO ALL OUR"); - menutext(160,60+16,0,0,"FANS FOR GIVING"); - menutext(160,60+16+16,0,0,"US BIG HEADS."); - menutext(160,70+16+16+16,0,0,"LOOK FOR A DUKE NUKEM 3D"); - menutext(160,70+16+16+16+16,0,0,"SEQUEL SOON."); - nextpage(); - - fadepal(0,0,0, 63,0,-3); - KB_FlushKeyboardQueue(); - while (!KB_KeyWaiting()) { handleevents(); getpackets(); } - fadepal(0,0,0, 0,64,3); - - clearview(0L); - nextpage(); - - playanm("DUKETEAM.ANM",4); - - KB_FlushKeyBoardQueue(); - while (!KB_KeyWaiting()) { handleevents(); getpackets(); } - - clearview(0L); - nextpage(); - IFISSOFTMODE palto(0,0,0,63); - - FX_StopAllSounds(); - clearsoundlocks(); - KB_FlushKeyBoardQueue(); - - break; - - case 2: - - MUSIC_StopSong(); - clearview(0L); - nextpage(); - 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(); } - clearview(0L); - nextpage(); + if (ud.lockout == 0) + { + KB_FlushKeyboardQueue(); + playanm("vol4e1.anm",8); + clearview(0L); + nextpage(); + playanm("vol4e2.anm",10); + clearview(0L); + nextpage(); + playanm("vol4e3.anm",11); + clearview(0L); + nextpage(); + } FX_StopAllSounds(); clearsoundlocks(); - } + sound(ENDSEQVOL3SND4); + KB_FlushKeyBoardQueue(); - playanm("RADLOGO.ANM",3); + //ps[myconnectindex].palette = palette; + setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 + IFISSOFTMODE palto(0,0,0,63); + clearview(0L); + menutext(160,60,0,0,"THANKS TO ALL OUR"); + menutext(160,60+16,0,0,"FANS FOR GIVING"); + menutext(160,60+16+16,0,0,"US BIG HEADS."); + menutext(160,70+16+16+16,0,0,"LOOK FOR A DUKE NUKEM 3D"); + menutext(160,70+16+16+16+16,0,0,"SEQUEL SOON."); + nextpage(); - if (ud.lockout == 0 && !KB_KeyWaiting()) - { - sound(ENDSEQVOL3SND5); - while (issoundplaying(-1,ENDSEQVOL3SND5)) { handleevents(); getpackets(); } - if (KB_KeyWaiting()) goto ENDANM; - sound(ENDSEQVOL3SND6); - while (issoundplaying(-1,ENDSEQVOL3SND6)) { handleevents(); getpackets(); } - if (KB_KeyWaiting()) goto ENDANM; - sound(ENDSEQVOL3SND7); - while (issoundplaying(-1,ENDSEQVOL3SND7)) { handleevents(); getpackets(); } - if (KB_KeyWaiting()) goto ENDANM; - sound(ENDSEQVOL3SND8); - while (issoundplaying(-1,ENDSEQVOL3SND8)) { handleevents(); getpackets(); } - if (KB_KeyWaiting()) goto ENDANM; - sound(ENDSEQVOL3SND9); - while (issoundplaying(-1,ENDSEQVOL3SND9)) { handleevents(); getpackets(); } + fadepal(0,0,0, 63,0,-3); + KB_FlushKeyboardQueue(); + while (!KB_KeyWaiting()) + { + handleevents(); + getpackets(); + } + fadepal(0,0,0, 0,64,3); + + clearview(0L); + nextpage(); + + playanm("DUKETEAM.ANM",4); + + KB_FlushKeyBoardQueue(); + while (!KB_KeyWaiting()) + { + handleevents(); + getpackets(); + } + + clearview(0L); + nextpage(); + IFISSOFTMODE palto(0,0,0,63); + + FX_StopAllSounds(); + clearsoundlocks(); + KB_FlushKeyBoardQueue(); + + break; + + case 2: + + MUSIC_StopSong(); + clearview(0L); + nextpage(); + 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(); + } + clearview(0L); + nextpage(); + + FX_StopAllSounds(); + clearsoundlocks(); + } + + playanm("RADLOGO.ANM",3); + + if (ud.lockout == 0 && !KB_KeyWaiting()) + { + sound(ENDSEQVOL3SND5); + while (issoundplaying(-1,ENDSEQVOL3SND5)) + { + handleevents(); + getpackets(); + } + if (KB_KeyWaiting()) goto ENDANM; + sound(ENDSEQVOL3SND6); + while (issoundplaying(-1,ENDSEQVOL3SND6)) + { + handleevents(); + getpackets(); + } + if (KB_KeyWaiting()) goto ENDANM; + sound(ENDSEQVOL3SND7); + while (issoundplaying(-1,ENDSEQVOL3SND7)) + { + handleevents(); + getpackets(); + } + if (KB_KeyWaiting()) goto ENDANM; + sound(ENDSEQVOL3SND8); + while (issoundplaying(-1,ENDSEQVOL3SND8)) + { + handleevents(); + getpackets(); + } + if (KB_KeyWaiting()) goto ENDANM; + sound(ENDSEQVOL3SND9); + while (issoundplaying(-1,ENDSEQVOL3SND9)) + { + handleevents(); + getpackets(); + } - } + } - KB_FlushKeyBoardQueue(); - totalclock = 0; - while (!KB_KeyWaiting() && totalclock < 120) { handleevents(); getpackets(); } + KB_FlushKeyBoardQueue(); + totalclock = 0; + while (!KB_KeyWaiting() && totalclock < 120) + { + handleevents(); + getpackets(); + } ENDANM: - FX_StopAllSounds(); - clearsoundlocks(); + FX_StopAllSounds(); + clearsoundlocks(); - KB_FlushKeyBoardQueue(); + KB_FlushKeyBoardQueue(); - clearview(0L); + clearview(0L); - break; + break; } FRAGBONUS: @@ -10972,7 +11574,8 @@ FRAGBONUS: setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 IFISSOFTMODE palto(0,0,0,63); // JBF 20031228 KB_FlushKeyboardQueue(); - totalclock = 0; tinc = 0; + totalclock = 0; + tinc = 0; bonuscnt = 0; MUSIC_StopSong(); @@ -11057,7 +11660,11 @@ FRAGBONUS: fadepal(0,0,0, 63,0,-7); KB_FlushKeyboardQueue(); - while (KB_KeyWaiting()==0) { handleevents(); getpackets(); } + while (KB_KeyWaiting()==0) + { + handleevents(); + getpackets(); + } if (KB_KeyPressed(sc_F12)) { @@ -11074,12 +11681,12 @@ FRAGBONUS: switch (ud.volume_number) { - case 1: - gfx_offset = 5; - break; - default: - gfx_offset = 0; - break; + case 1: + gfx_offset = 5; + break; + default: + gfx_offset = 0; + break; } rotatesprite(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); @@ -11096,7 +11703,8 @@ FRAGBONUS: KB_FlushKeyboardQueue(); fadepal(0,0,0, 63,0,-1); bonuscnt = 0; - totalclock = 0; tinc = 0; + totalclock = 0; + tinc = 0; playerbest = CONFIG_GetMapBestTime(level_file_names[ud.volume_number*11+ud.last_level-1]); @@ -11112,10 +11720,12 @@ 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); } @@ -11140,36 +11750,36 @@ FRAGBONUS: { switch ((totalclock>>4)%15) { - case 0: - if (bonuscnt == 6) - { - bonuscnt++; - sound(SHOTGUN_COCK); - switch (rand()&3) + case 0: + if (bonuscnt == 6) { - case 0: - sound(BONUS_SPEECH1); - break; - case 1: - sound(BONUS_SPEECH2); - break; - case 2: - sound(BONUS_SPEECH3); - break; - case 3: - sound(BONUS_SPEECH4); - break; + bonuscnt++; + sound(SHOTGUN_COCK); + switch (rand()&3) + { + case 0: + sound(BONUS_SPEECH1); + break; + case 1: + sound(BONUS_SPEECH2); + break; + case 2: + sound(BONUS_SPEECH3); + break; + case 3: + sound(BONUS_SPEECH4); + break; + } } - } - case 1: - case 4: - case 5: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+3+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - break; - case 2: - case 3: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+4+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - break; + case 1: + case 4: + case 5: + rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+3+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + break; + case 2: + case 3: + rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+4+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + break; } } else if (totalclock > (10240+120L)) break; @@ -11177,13 +11787,13 @@ FRAGBONUS: { switch ((totalclock>>5)&3) { - case 1: - case 3: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+1+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - break; - case 2: - rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+2+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); - break; + case 1: + case 3: + rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+1+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + break; + case 2: + rotatesprite(199<<16,31<<16,65536L,0,BONUSSCREEN+2+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); + break; } } @@ -11195,14 +11805,25 @@ FRAGBONUS: 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)) { - 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; } + gametext(10,yy+9,"Your Time:",0,2+8+16); + yy+=10; + 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 0) + { + gametext(10,yy+9,ps[myconnectindex].player_par>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); - gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); yy+=10; + gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); + yy+=10; - if (!NAM) { + if (!NAM) + { Bsprintf(tempbuf,"%0*ld:%02ld",clockpad, (designertime[ud.volume_number*11+ud.last_level-1]/(26*60)), (designertime[ud.volume_number*11+ud.last_level-1]/26)%60); - gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); yy+=10; + gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); + yy+=10; } } - if (playerbest > 0) { + if (playerbest > 0) + { sprintf(tempbuf,"%0*ld:%02ld",clockpad, (playerbest/(26*60)), (playerbest/26)%60); - gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); yy+=10; + gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); + yy+=10; } } } @@ -11250,8 +11877,10 @@ FRAGBONUS: zz = yy += 5; 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; + 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) { @@ -11269,18 +11898,21 @@ FRAGBONUS: sound(PIPEBOMB_EXPLODE); } sprintf(tempbuf,"%-3ld",ps[myconnectindex].actors_killed); - gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; + gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); + yy += 10; if (ud.player_skill > 3) { sprintf(tempbuf,"N/A"); - gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; + 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) 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; + gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); + yy += 10; } } } @@ -11288,8 +11920,10 @@ FRAGBONUS: zz = yy += 5; 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; + 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++; yy = zz; @@ -11301,11 +11935,13 @@ FRAGBONUS: sound(PIPEBOMB_EXPLODE); } sprintf(tempbuf,"%-3ld",ps[myconnectindex].secret_rooms); - gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; + gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); + yy += 10; 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; + gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); + yy += 10; } } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index f3d1a44fa..fca7adc67 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -87,7 +87,8 @@ void FreeGameVars(void); extern long qsetmode; -enum errors { +enum errors +{ ERROR_CLOSEBRACKET, ERROR_EVENTONLY, ERROR_EXCEEDSMAXTILES, @@ -108,7 +109,8 @@ enum errors { WARNING_LABELSONLY, }; -enum labeltypes { +enum labeltypes +{ LABEL_ANY = -1, LABEL_DEFINE = 1, LABEL_STATE = 2, @@ -118,14 +120,15 @@ enum labeltypes { LABEL_MOVE = 32, }; -static char *labeltypenames[] = { - "define", - "state", - "actor", - "action", - "ai", - "move" - }; +static char *labeltypenames[] = + { + "define", + "state", + "actor", + "action", + "ai", + "move" + }; static char *translatelabeltype(long type) { @@ -133,7 +136,8 @@ static char *translatelabeltype(long type) char x[64]; x[0] = 0; - for (i=0;i<6;i++) { + for (i=0;i<6;i++) + { if (!(type & (1< MAXSCRIPTSIZE) && error == 0) { + if (((unsigned)(scriptptr-script) > MAXSCRIPTSIZE) && error == 0) + { /* Bsprintf(tempbuf,"fatal error: Size of compiled CON code exceeds maximum size! (%ud, %d)\n",(unsigned)(scriptptr-script),MAXSCRIPTSIZE); */ ReportError(-1); initprintf("%s:%ld: internal compiler error: Aborted (%ud)\n",compilefile,line_number,(unsigned)(scriptptr-script)); @@ -1991,319 +1997,238 @@ char parsecommand(void) switch (tw) { - default: - case -1: - return 0; //End - case CON_STATE: - if (parsing_actor == 0 && parsing_state == 0) - { - getlabel(); - scriptptr--; - labelcode[labelcnt] = (long) scriptptr; - labeltype[labelcnt] = LABEL_STATE; - - parsing_state = 1; - Bsprintf(parsing_item_name,"%s",label+(labelcnt<<6)); - labelcnt++; - return 0; - } - - getlabel(); - - for (i=0;i 1) - initprintf("%s:%ld: debug: accepted state label `%s'.\n",compilefile,line_number,label+(j<<6)); - *scriptptr = labelcode[j]; - break; - } - else - { - char *gl; - gl = translatelabeltype(labeltype[j]); - ReportError(-1); - initprintf("%s:%ld: warning: expected a state, found a %s.\n",compilefile,line_number,gl); - Bfree(gl); - *(scriptptr-1) = CON_NULLOP; // get rid of the state, leaving a nullop to satisfy if conditions - return 0; // valid label name, but wrong type - } - } - } - if (j==labelcnt) - { - ReportError(-1); - initprintf("%s:%ld: error: state `%s' not found.\n",compilefile,line_number,label+(labelcnt<<6)); - error++; - } - scriptptr++; - return 0; - - case CON_ENDS: - if (parsing_state == 0) - { - ReportError(-1); - initprintf("%s:%ld: error: found `ends' without open `state'.\n",compilefile,line_number); - error++; - } - // else - { - if (num_braces > 0) - { - ReportError(ERROR_OPENBRACKET); - error++; - } - if (num_braces < 0) - { - ReportError(ERROR_CLOSEBRACKET); - error++; - } - if (checking_switch > 0) - { - ReportError(ERROR_NOENDSWITCH); - error++; - - checking_switch = 0; // can't be checking anymore... - } - - parsing_state = 0; - Bsprintf(parsing_item_name,"(none)"); - } - return 0; - - case CON_SETTHISPROJECTILE: - case CON_SETPROJECTILE: - 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 != '[')) - { - 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)); - - 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 -1: + return 0; //End + case CON_STATE: + if (parsing_actor == 0 && parsing_state == 0) + { + getlabel(); + scriptptr--; + labelcode[labelcnt] = (long) scriptptr; + labeltype[labelcnt] = LABEL_STATE; - case CON_GAMEVAR: - // syntax: gamevar - // defines var1 and sets initial value. - // flags are used to define usage - // (see top of this files for flags) - //printf("Got gamedef. Getting Label. '%.20s'\n",textptr); + parsing_state = 1; + Bsprintf(parsing_item_name,"%s",label+(labelcnt<<6)); + labelcnt++; + return 0; + } - if (isdigit(*textptr) || (*textptr == '-')) - { getlabel(); - error++; - ReportError(ERROR_SYNTAXERROR); - transnum(LABEL_DEFINE); - transnum(LABEL_DEFINE); - scriptptr -= 3; // we complete the process anyways just to skip past the fucked up section - return 0; - } - getlabel(); - //printf("Got Label '%.20s'\n",textptr); - // Check to see it's already defined - - for (i=0;i 1) + initprintf("%s:%ld: debug: accepted state label `%s'.\n",compilefile,line_number,label+(j<<6)); + *scriptptr = labelcode[j]; + break; + } + else + { + char *gl; + gl = translatelabeltype(labeltype[j]); + ReportError(-1); + initprintf("%s:%ld: warning: expected a state, found a %s.\n",compilefile,line_number,gl); + Bfree(gl); + *(scriptptr-1) = CON_NULLOP; // get rid of the state, leaving a nullop to satisfy if conditions + return 0; // valid label name, but wrong type + } } } - } -#endif - - //printf("Translating number '%.20s'\n",textptr); - transnum(LABEL_DEFINE); // get initial value - //printf("Done Translating number. '%.20s'\n",textptr); - - transnum(LABEL_DEFINE); // get flags - //Bsprintf(g_szBuf,"Adding GameVar='%s', val=%l, flags=%lX",label+(labelcnt<<6), - // *(scriptptr-2), *(scriptptr-1)); - //AddLog(g_szBuf); - - AddGameVar(label+(labelcnt<<6),*(scriptptr-2), - (*(scriptptr-1)) - // can't define default or secret - & (~(GAMEVAR_FLAG_DEFAULT | GAMEVAR_FLAG_SECRET)) - ); - //AddLog("Added gamevar"); - scriptptr -= 3; // no need to save in script... - return 0; - - case CON_DEFINE: - { - //printf("Got definition. Getting Label. '%.20s'\n",textptr); - getlabel(); - //printf("Got label. '%.20s'\n",textptr); - // Check to see it's already defined - - for (i=0;i= defaultlabelcnt) - { - 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; - } - - case CON_PALFROM: - for (j=0;j<4;j++) - { - if (keyword() == -1) - transnum(LABEL_DEFINE); - else break; - } - - while (j<4) - { - *scriptptr = 0; - scriptptr++; - j++; - } - return 0; - - case CON_MOVE: - if (parsing_actor || parsing_state) - { - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - - if ((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) + if (j==labelcnt) { ReportError(-1); - *(scriptptr-1) = 0; - initprintf("%s:%ld: warning: expected a move, found a constant.\n",compilefile,line_number); + initprintf("%s:%ld: error: state `%s' not found.\n",compilefile,line_number,label+(labelcnt<<6)); + error++; } - - j = 0; - while (keyword() == -1) - { - transnum(LABEL_DEFINE); - scriptptr--; - j |= *scriptptr; - } - *scriptptr = j; - scriptptr++; - } - else + return 0; + + case CON_ENDS: + if (parsing_state == 0) + { + ReportError(-1); + initprintf("%s:%ld: error: found `ends' without open `state'.\n",compilefile,line_number); + error++; + } + // else + { + if (num_braces > 0) + { + ReportError(ERROR_OPENBRACKET); + error++; + } + if (num_braces < 0) + { + ReportError(ERROR_CLOSEBRACKET); + error++; + } + if (checking_switch > 0) + { + ReportError(ERROR_NOENDSWITCH); + error++; + + checking_switch = 0; // can't be checking anymore... + } + + parsing_state = 0; + Bsprintf(parsing_item_name,"(none)"); + } + return 0; + + case CON_SETTHISPROJECTILE: + case CON_SETPROJECTILE: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + case CON_GETTHISPROJECTILE: + case CON_GETPROJECTILE: { - scriptptr--; + 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)); + + 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 + // defines var1 and sets initial value. + // flags are used to define usage + // (see top of this files for flags) + //printf("Got gamedef. Getting Label. '%.20s'\n",textptr); + + if (isdigit(*textptr) || (*textptr == '-')) + { + getlabel(); + error++; + ReportError(ERROR_SYNTAXERROR); + transnum(LABEL_DEFINE); + transnum(LABEL_DEFINE); + scriptptr -= 3; // we complete the process anyways just to skip past the fucked up section + return 0; + } + + getlabel(); + //printf("Got Label '%.20s'\n",textptr); + // Check to see it's already defined + + for (i=0;i= defaultlabelcnt) + { + warning++; + ReportError(WARNING_DUPLICATEDEFINITION); + } break; } + } + //printf("Translating. '%.20s'\n",textptr); + transnum(LABEL_DEFINE); + //printf("Translated. '%.20s'\n",textptr); if (i == labelcnt) { - labeltype[labelcnt] = LABEL_MOVE; - labelcode[labelcnt++] = (long) scriptptr; + // 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)); } - for (j=0;j<2;j++) + scriptptr -= 2; + return 0; + } + + case CON_PALFROM: + for (j=0;j<4;j++) { - if (keyword() >= 0) break; - transnum(LABEL_DEFINE); + if (keyword() == -1) + transnum(LABEL_DEFINE); + else break; } - for (k=j;k<2;k++) + + while (j<4) { *scriptptr = 0; scriptptr++; + j++; } - } - return 0; + 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 - { - i = 0; - // get the file name... - while (keyword() == -1) + case CON_MOVE: + if (parsing_actor || parsing_state) { - while (isaltok(*textptr) == 0) + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + + if ((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) { - if (*textptr == 0x0a) line_number++; - textptr++; - if (*textptr == 0) break; + ReportError(-1); + *(scriptptr-1) = 0; + initprintf("%s:%ld: warning: expected a move, found a constant.\n",compilefile,line_number); } + j = 0; - while (isaltok(*(textptr+j))) + while (keyword() == -1) { - music_fn[k][i][j] = textptr[j]; - j++; + transnum(LABEL_DEFINE); + scriptptr--; + j |= *scriptptr; } - music_fn[k][i][j] = '\0'; - textptr += j; - if (i > 9) break; - i++; + *scriptptr = j; + + scriptptr++; } - } - else - { - i = 0; - while (keyword() == -1) + else { - while (isaltok(*textptr) == 0) + scriptptr--; + getlabel(); + // Check to see it's already defined + + for (i=0;i= 0) break; + transnum(LABEL_DEFINE); + } + for (k=j;k<2;k++) + { + *scriptptr = 0; + scriptptr++; } - env_music_fn[i][j] = '\0'; - - textptr += j; - if (i > 9) break; - i++; } - } - } - return 0; + return 0; - case CON_INCLUDE: - scriptptr--; - while (isaltok(*textptr) == 0) + case CON_MUSIC: { - if (*textptr == 0x0a) line_number++; - textptr++; - if (*textptr == 0) break; - } - j = 0; - while (isaltok(*textptr)) - { - tempbuf[j] = *(textptr++); - j++; - } - tempbuf[j] = '\0'; + // NOTE: this doesn't get stored in the PCode... - { - short temp_line_number; - char temp_ifelse_check; - char *origtptr, *mptr; - char parentcompilefile[255]; - int fp; - - fp = kopen4load(tempbuf,loadfromgrouponly); - if (fp < 0) - { - error++; - initprintf("%s:%ld: error: could not find file `%s'.\n",compilefile,line_number,tempbuf); - return 0; - } - - j = kfilelength(fp); - - mptr = (char *)Bmalloc(j+1); - if (!mptr) - { - kclose(fp); - error++; - initprintf("%s:%ld: error: could not allocate %ld bytes to include `%s'.\n", - line_number,compilefile,j,tempbuf); - return 0; - } - - initprintf("Including: %s (%ld bytes)\n",tempbuf, j); - kread(fp, mptr, j); - kclose(fp); - mptr[j] = 0; - - if (*textptr == '"') // skip past the closing quote if it's there so we don't screw up the next line - textptr++; - origtptr = textptr; - - Bstrcpy(parentcompilefile, compilefile); - Bstrcpy(compilefile, tempbuf); - temp_line_number = line_number; - line_number = 1; - temp_ifelse_check = checking_ifelse; - checking_ifelse = 0; - - textptr = mptr; - do done = parsecommand(); while (!done); - - Bstrcpy(compilefile, parentcompilefile); - total_lines += line_number; - line_number = temp_line_number; - checking_ifelse = temp_ifelse_check; - - textptr = origtptr; - - Bfree(mptr); - } - return 0; - - case CON_AI: - if (parsing_actor || parsing_state) - { - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - transnum(LABEL_AI); - } - else - { + // 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--; - getlabel(); - for (i=0;i= 0) // if it's background music + { + i = 0; + // get the file name... + while (keyword() == -1) + { + 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++; + } + } + 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) + { + if (*textptr == 0x0a) line_number++; + textptr++; + if (*textptr == 0) break; + } + j = 0; + while (isaltok(*textptr)) + { + tempbuf[j] = *(textptr++); + j++; + } + tempbuf[j] = '\0'; + + { + short temp_line_number; + char temp_ifelse_check; + char *origtptr, *mptr; + char parentcompilefile[255]; + int fp; + + fp = kopen4load(tempbuf,loadfromgrouponly); + if (fp < 0) { error++; - ReportError(ERROR_ISAKEYWORD); + initprintf("%s:%ld: error: could not find file `%s'.\n",compilefile,line_number,tempbuf); return 0; } - for (i=0;i= 0) break; + if (j == 1) + transnum(LABEL_ACTION); + else if (j == 2) + { + 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) + { + transnum(LABEL_DEFINE); + scriptptr--; + k |= *scriptptr; + } + *scriptptr = k; + scriptptr++; + return 0; + } + } + for (k=j;k<3;k++) + { + *scriptptr = 0; + scriptptr++; + } + } + return 0; + + case CON_ACTION: + if (parsing_actor || parsing_state) + { + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + transnum(LABEL_ACTION); + } + else + { + scriptptr--; + getlabel(); + // Check to see it's already defined + + for (i=0;i= 0) break; + transnum(LABEL_DEFINE); + } + for (k=j;k<5;k++) + { + *scriptptr = 0; + scriptptr++; + } + } + return 0; + + case CON_ACTOR: + if (parsing_state || parsing_actor) + { + ReportError(ERROR_FOUNDWITHIN); + error++; } - for (j=0;j<3;j++) + num_braces = 0; + scriptptr--; + parsing_actor = scriptptr; + + skipcomments(); + j = 0; + while (isaltok(*(textptr+j))) { - if (keyword() >= 0) break; - if (j == 1) - transnum(LABEL_ACTION); - else if (j == 2) + parsing_item_name[j] = textptr[j]; + j++; + } + parsing_item_name[j] = 0; + transnum(LABEL_DEFINE); + // Bsprintf(parsing_item_name,"%s",label+(labelcnt<<6)); + scriptptr--; + actorscrptr[*scriptptr] = parsing_actor; + + for (j=0;j<4;j++) + { + *(parsing_actor+j) = 0; + if (j == 3) { - 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; + j = 0; while (keyword() == -1) { transnum(LABEL_DEFINE); scriptptr--; - k |= *scriptptr; + j |= *scriptptr; } - *scriptptr = k; + *scriptptr = j; scriptptr++; - return 0; + break; + } + else + { + if (keyword() >= 0) + { + for (i=4-j; i; i--) *(scriptptr++) = 0; + break; + } + switch (j) + { + 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)) + { + ReportError(-1); + *(scriptptr-1) = 0; + initprintf("%s:%ld: warning: expected a move, found a constant.\n",compilefile,line_number); + } + break; + } + *(parsing_actor+j) = *(scriptptr-1); } } - for (k=j;k<3;k++) + checking_ifelse = 0; + return 0; + + case CON_ONEVENT: + if (parsing_state || parsing_actor) + { + ReportError(ERROR_FOUNDWITHIN); + error++; + } + + num_braces = 0; + scriptptr--; + parsing_event = scriptptr; + parsing_actor = scriptptr; + + skipcomments(); + j = 0; + while (isaltok(*(textptr+j))) + { + parsing_item_name[j] = textptr[j]; + j++; + } + parsing_item_name[j] = 0; + labelsonly = 1; + transnum(LABEL_DEFINE); + labelsonly = 0; + scriptptr--; + j= *scriptptr; // type of event + current_event = j; + //Bsprintf(g_szBuf,"Adding Event for %d at %lX",j, parsing_event); + //AddLog(g_szBuf); + if (j > MAXGAMEEVENTS-1 || j < 0) + { + initprintf("%s:%ld: error: invalid event ID.\n",compilefile,line_number); + error++; + return 0; + } + + if (apScriptGameEvent[j]) + { + tempscrptr = parsing_event; + parsing_event = parsing_actor = 0; + ReportError(-1); + parsing_event = parsing_actor = tempscrptr; + initprintf("%s:%ld: warning: duplicate event `%s'.\n",compilefile,line_number,parsing_item_name); + } + else apScriptGameEvent[j]=parsing_event; + + checking_ifelse = 0; + + return 0; + + case CON_EVENTLOADACTOR: + if (parsing_state || parsing_actor) + { + ReportError(ERROR_FOUNDWITHIN); + error++; + } + + num_braces = 0; + scriptptr--; + parsing_actor = scriptptr; + + skipcomments(); + j = 0; + while (isaltok(*(textptr+j))) + { + parsing_item_name[j] = textptr[j]; + j++; + } + parsing_item_name[j] = 0; + transnum(LABEL_DEFINE); + scriptptr--; + actorLoadEventScrptr[*scriptptr] = parsing_actor; + + checking_ifelse = 0; + return 0; + + case CON_USERACTOR: + if (parsing_state || parsing_actor) + { + ReportError(ERROR_FOUNDWITHIN); + error++; + } + + num_braces = 0; + scriptptr--; + parsing_actor = scriptptr; + + transnum(LABEL_DEFINE); + scriptptr--; + + skipcomments(); + j = 0; + while (isaltok(*(textptr+j))) + { + parsing_item_name[j] = textptr[j]; + j++; + } + parsing_item_name[j] = 0; + + j = *scriptptr; + + if (j > 2) + { + ReportError(-1); + initprintf("%s:%ld: warning: invalid useractor type.\n",compilefile,line_number); + j = 0; + } + + transnum(LABEL_DEFINE); + scriptptr--; + actorscrptr[*scriptptr] = parsing_actor; + actortype[*scriptptr] = j; + + for (j=0;j<4;j++) + { + *(parsing_actor+j) = 0; + if (j == 3) + { + j = 0; + while (keyword() == -1) + { + transnum(LABEL_DEFINE); + scriptptr--; + j |= *scriptptr; + } + *scriptptr = j; + scriptptr++; + break; + } + else + { + if (keyword() >= 0) + { + for (i=4-j; i; i--) *(scriptptr++) = 0; + break; + } + switch (j) + { + 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)) + { + ReportError(-1); + *(scriptptr-1) = 0; + initprintf("%s:%ld: warning: expected a move, found a constant.\n",compilefile,line_number); + } + break; + } + *(parsing_actor+j) = *(scriptptr-1); + } + } + checking_ifelse = 0; + return 0; + + case CON_INSERTSPRITEQ: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + return 0; + + case CON_QSPRINTF: + transnum(LABEL_DEFINE); + transnum(LABEL_DEFINE); + for (j = 0;j < 4;j++) + { + if (keyword() == -1) + transvar(); + else break; + } + + while (j < 4) { *scriptptr = 0; scriptptr++; + j++; } - } - return 0; + return 0; - case CON_ACTION: - if (parsing_actor || parsing_state) - { + case CON_ESPAWN: + case CON_ESHOOT: + case CON_QSPAWN: + case CON_EQSPAWN: + case CON_STRENGTH: + case CON_SHOOT: + case CON_ADDPHEALTH: + case CON_SPAWN: + case CON_CSTAT: + case CON_COUNT: + case CON_ENDOFGAME: + case CON_SPRITEPAL: + case CON_CACTOR: + case CON_MONEY: + case CON_ADDKILLS: + case CON_DEBUG: + case CON_ADDSTRENGTH: + case CON_CSTATOR: + case CON_MAIL: + case CON_PAPER: + case CON_SLEEPTIME: + case CON_CLIPDIST: + case CON_LOTSOFGLASS: + case CON_SAVE: if (!CheckEventSync(current_event)) ReportError(WARNING_EVENTSYNC); - transnum(LABEL_ACTION); - } - else - { - scriptptr--; - getlabel(); - // Check to see it's already defined + case CON_ANGOFF: + case CON_USERQUOTE: + case CON_QUOTE: + case CON_SOUND: + case CON_GLOBALSOUND: + case CON_SOUNDONCE: + case CON_STOPSOUND: + transnum(LABEL_DEFINE); + if (tw == CON_CSTAT) + { + 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)) + { + i = *(scriptptr-1); + *(scriptptr-1) ^= 48; + ReportError(-1); + initprintf("%s:%ld: warning: tried to set cstat %ld, using %ld instead.\n",compilefile,line_number,i,*(scriptptr-1)); + } + } + return 0; + case CON_HITRADIUS: + transnum(LABEL_DEFINE); + transnum(LABEL_DEFINE); + transnum(LABEL_DEFINE); + case CON_ADDAMMO: + case CON_ADDWEAPON: + case CON_SIZETO: + case CON_SIZEAT: + case CON_DEBRIS: + case CON_ADDINVENTORY: + case CON_GUTS: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + transnum(LABEL_DEFINE); + transnum(LABEL_DEFINE); + break; + + case CON_ELSE: + if (checking_ifelse) + { + checking_ifelse--; + tempscrptr = scriptptr; + scriptptr++; //Leave a spot for the fail location + parsecommand(); + *tempscrptr = (long) scriptptr; + } + else + { + scriptptr--; + error++; + ReportError(-1); + initprintf("%s:%ld: error: found `else' with no `if'.\n",compilefile,line_number); + } + return 0; + + case CON_SETSECTOR: + 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 != '[')) + { + 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; + } + + case CON_FINDNEARACTOR: + case CON_FINDNEARACTOR3D: + case CON_FINDNEARSPRITE: + 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) + { + 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 + + // get the ID of the DEF + transvar(); + switch (tw) + { + case CON_FINDNEARACTORZVAR: + case CON_FINDNEARSPRITEZVAR: + transvar(); + 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 + + // 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)) + 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 != '[')) + { + 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; + } + + case CON_SETPLAYER: + 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 != '[')) + { + 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; + } + + case CON_SETINPUT: + 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 != '[')) + { + 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; + } + + 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 != '.') + { + 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; + } + + case CON_SETACTORVAR: + case CON_SETPLAYERVAR: + 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 != '[')) + { + 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' + + // get the ID of the DEF + getlabel(); + //printf("found label of '%s'\n", label+(labelcnt<<6)); + + // Check to see if it's a keyword for (i=0;i= 0) break; - transnum(LABEL_DEFINE); - } - for (k=j;k<5;k++) - { - *scriptptr = 0; - scriptptr++; - } - } - return 0; - - case CON_ACTOR: - if (parsing_state || parsing_actor) - { - ReportError(ERROR_FOUNDWITHIN); - error++; - } - - num_braces = 0; - scriptptr--; - parsing_actor = scriptptr; - - skipcomments(); - j = 0; - while (isaltok(*(textptr+j))) - { - parsing_item_name[j] = textptr[j]; - j++; - } - parsing_item_name[j] = 0; - transnum(LABEL_DEFINE); - // Bsprintf(parsing_item_name,"%s",label+(labelcnt<<6)); - scriptptr--; - actorscrptr[*scriptptr] = parsing_actor; - - for (j=0;j<4;j++) - { - *(parsing_actor+j) = 0; - if (j == 3) - { - j = 0; - while (keyword() == -1) + case CON_SETACTORVAR: { - transnum(LABEL_DEFINE); - scriptptr--; - j |= *scriptptr; - } - *scriptptr = j; - scriptptr++; - break; - } - else - { - if (keyword() >= 0) - { - for (i=4-j; i; i--) *(scriptptr++) = 0; - break; - } - switch (j) - { - 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 (!(aGameVars[i].dwFlags & GAMEVAR_FLAG_PERACTOR)) { + error++; ReportError(-1); - *(scriptptr-1) = 0; - initprintf("%s:%ld: warning: expected a move, found a constant.\n",compilefile,line_number); + initprintf("%s:%ld: error: variable `%s' is not per-actor.\n",compilefile,line_number,label+(labelcnt<<6)); + return 0; + } break; } - *(parsing_actor+j) = *(scriptptr-1); - } - } - checking_ifelse = 0; - return 0; - - case CON_ONEVENT: - if (parsing_state || parsing_actor) - { - ReportError(ERROR_FOUNDWITHIN); - error++; - } - - num_braces = 0; - scriptptr--; - parsing_event = scriptptr; - parsing_actor = scriptptr; - - skipcomments(); - j = 0; - while (isaltok(*(textptr+j))) - { - parsing_item_name[j] = textptr[j]; - j++; - } - parsing_item_name[j] = 0; - labelsonly = 1; - transnum(LABEL_DEFINE); - labelsonly = 0; - scriptptr--; - j= *scriptptr; // type of event - current_event = j; - //Bsprintf(g_szBuf,"Adding Event for %d at %lX",j, parsing_event); - //AddLog(g_szBuf); - if (j > MAXGAMEEVENTS-1 || j < 0) - { - initprintf("%s:%ld: error: invalid event ID.\n",compilefile,line_number); - error++; - return 0; - } - - if (apScriptGameEvent[j]) - { - tempscrptr = parsing_event; - parsing_event = parsing_actor = 0; - ReportError(-1); - parsing_event = parsing_actor = tempscrptr; - initprintf("%s:%ld: warning: duplicate event `%s'.\n",compilefile,line_number,parsing_item_name); - } - else apScriptGameEvent[j]=parsing_event; - - checking_ifelse = 0; - - return 0; - - case CON_EVENTLOADACTOR: - if (parsing_state || parsing_actor) - { - ReportError(ERROR_FOUNDWITHIN); - error++; - } - - num_braces = 0; - scriptptr--; - parsing_actor = scriptptr; - - skipcomments(); - j = 0; - while (isaltok(*(textptr+j))) - { - parsing_item_name[j] = textptr[j]; - j++; - } - parsing_item_name[j] = 0; - transnum(LABEL_DEFINE); - scriptptr--; - actorLoadEventScrptr[*scriptptr] = parsing_actor; - - checking_ifelse = 0; - return 0; - - case CON_USERACTOR: - if (parsing_state || parsing_actor) - { - ReportError(ERROR_FOUNDWITHIN); - error++; - } - - num_braces = 0; - scriptptr--; - parsing_actor = scriptptr; - - transnum(LABEL_DEFINE); - scriptptr--; - - skipcomments(); - j = 0; - while (isaltok(*(textptr+j))) - { - parsing_item_name[j] = textptr[j]; - j++; - } - parsing_item_name[j] = 0; - - j = *scriptptr; - - if (j > 2) - { - ReportError(-1); - initprintf("%s:%ld: warning: invalid useractor type.\n",compilefile,line_number); - j = 0; - } - - transnum(LABEL_DEFINE); - scriptptr--; - actorscrptr[*scriptptr] = parsing_actor; - actortype[*scriptptr] = j; - - for (j=0;j<4;j++) - { - *(parsing_actor+j) = 0; - if (j == 3) - { - j = 0; - while (keyword() == -1) + case CON_SETPLAYERVAR: { - transnum(LABEL_DEFINE); - scriptptr--; - j |= *scriptptr; - } - *scriptptr = j; - scriptptr++; - break; - } - else - { - if (keyword() >= 0) - { - for (i=4-j; i; i--) *(scriptptr++) = 0; - break; - } - switch (j) - { - 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 (!(aGameVars[i].dwFlags & GAMEVAR_FLAG_PERPLAYER)) { + error++; ReportError(-1); - *(scriptptr-1) = 0; - initprintf("%s:%ld: warning: expected a move, found a constant.\n",compilefile,line_number); + initprintf("%s:%ld: error: variable `%s' is not per-player.\n",compilefile,line_number,label+(labelcnt<<6)); + return 0; + } break; } - *(parsing_actor+j) = *(scriptptr-1); } + + *scriptptr++=i; // the ID of the DEF (offset into array...) + + switch (tw) + { + case CON_GETACTORVAR: + case CON_GETPLAYERVAR: + transvartype(GAMEVAR_FLAG_READONLY); + break; + default: + transvar(); + break; + } + break; } - checking_ifelse = 0; - return 0; - case CON_INSERTSPRITEQ: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - return 0; - - case CON_QSPRINTF: - transnum(LABEL_DEFINE); - transnum(LABEL_DEFINE); - for (j = 0;j < 4;j++) + case CON_SETACTOR: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + case CON_GETACTOR: { - if (keyword() == -1) + 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 break; - } - - while (j < 4) - { - *scriptptr = 0; - scriptptr++; - j++; - } - return 0; - - case CON_ESPAWN: - case CON_ESHOOT: - case CON_QSPAWN: - case CON_EQSPAWN: - case CON_STRENGTH: - case CON_SHOOT: - case CON_ADDPHEALTH: - case CON_SPAWN: - case CON_CSTAT: - case CON_COUNT: - case CON_ENDOFGAME: - case CON_SPRITEPAL: - case CON_CACTOR: - case CON_MONEY: - case CON_ADDKILLS: - case CON_DEBUG: - case CON_ADDSTRENGTH: - case CON_CSTATOR: - case CON_MAIL: - case CON_PAPER: - case CON_SLEEPTIME: - case CON_CLIPDIST: - case CON_LOTSOFGLASS: - case CON_SAVE: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - case CON_ANGOFF: - case CON_USERQUOTE: - case CON_QUOTE: - case CON_SOUND: - case CON_GLOBALSOUND: - case CON_SOUNDONCE: - case CON_STOPSOUND: - transnum(LABEL_DEFINE); - if (tw == CON_CSTAT) - { - 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 { - i = *(scriptptr-1); - *(scriptptr-1) ^= 48; - ReportError(-1); - initprintf("%s:%ld: warning: tried to set cstat %ld, using %ld instead.\n",compilefile,line_number,i,*(scriptptr-1)); + //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; } - return 0; - case CON_HITRADIUS: - transnum(LABEL_DEFINE); - transnum(LABEL_DEFINE); - transnum(LABEL_DEFINE); - case CON_ADDAMMO: - case CON_ADDWEAPON: - case CON_SIZETO: - case CON_SIZEAT: - case CON_DEBRIS: - case CON_ADDINVENTORY: - case CON_GUTS: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - transnum(LABEL_DEFINE); - transnum(LABEL_DEFINE); - break; + case CON_GETCURRADDRESS: + transvartype(GAMEVAR_FLAG_READONLY); + return 0; - case CON_ELSE: - if (checking_ifelse) + case CON_ESHOOTVAR: + case CON_ESPAWNVAR: + case CON_QSPAWNVAR: + case CON_EQSPAWNVAR: + case CON_OPERATERESPAWNS: + case CON_OPERATEMASTERSWITCHES: + case CON_CHECKACTIVATORMOTION: + case CON_TIME: + case CON_INITTIMER: + case CON_LOCKPLAYER: + case CON_SHOOTVAR: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + case CON_JUMP: + case CON_SOUNDVAR: + case CON_GLOBALSOUNDVAR: + case CON_STOPSOUNDVAR: + case CON_SOUNDONCEVAR: + case CON_ANGOFFVAR: + case CON_CHECKAVAILWEAPON: + case CON_CHECKAVAILINVEN: + case CON_GUNIQHUDID: + case CON_SAVEGAMEVAR: + case CON_READGAMEVAR: + transvar(); + return 0; + + case CON_ENHANCED: { - checking_ifelse--; - tempscrptr = scriptptr; - scriptptr++; //Leave a spot for the fail location - parsecommand(); - *tempscrptr = (long) scriptptr; + // 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; } - else + + case CON_DYNAMICREMAP: { scriptptr--; - error++; - ReportError(-1); - initprintf("%s:%ld: error: found `else' with no `if'.\n",compilefile,line_number); - } - return 0; - - case CON_SETSECTOR: - 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 != '[')) - { - 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; - } - - case CON_FINDNEARACTOR: - case CON_FINDNEARACTOR3D: - case CON_FINDNEARSPRITE: - 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) - { - case CON_FINDNEARACTORZ: - case CON_FINDNEARSPRITEZ: - transnum(LABEL_DEFINE); - default: + initprintf("Dynamic tile remapping enabled.\n"); + dynamicremap = 1; break; } - // target var - // get the ID of the DEF - transvartype(GAMEVAR_FLAG_READONLY); - break; - } + case CON_RANDVAR: + case CON_ZSHOOT: + case CON_EZSHOOT: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + case CON_SETVAR: + case CON_ADDVAR: + case CON_SUBVAR: + case CON_DISPLAYRANDVAR: + case CON_MULVAR: + case CON_DIVVAR: + case CON_MODVAR: + case CON_ANDVAR: + case CON_ORVAR: + case CON_XORVAR: + case CON_SHIFTVARL: + case CON_SHIFTVARR: - case CON_FINDNEARACTORVAR: - case CON_FINDNEARACTOR3DVAR: - case CON_FINDNEARSPRITEVAR: - case CON_FINDNEARSPRITE3DVAR: - case CON_FINDNEARACTORZVAR: - case CON_FINDNEARSPRITEZVAR: - { - transnum(LABEL_DEFINE); // get + // syntax: [rand|add|set]var + // sets var1 to const1 + // adds const1 to var1 (const1 can be negative...) + //printf("Found [add|set]var at line= %ld\n",line_number); - // get the ID of the DEF - transvar(); - switch (tw) - { - case CON_FINDNEARACTORZVAR: - case CON_FINDNEARSPRITEZVAR: - transvar(); - 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 - - // 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)) - 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 != '[')) - { - 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; - } - - case CON_SETPLAYER: - 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 != '[')) - { - 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"); - } + if (tw != CON_ZSHOOT && tw != CON_EZSHOOT) + transvartype(GAMEVAR_FLAG_READONLY); + else transvar(); - // now at target VAR... - - // get the ID of the DEF - if (tw==CON_GETPLAYER) + transnum(LABEL_DEFINE); // the number to check against... + return 0; + case CON_RANDVARVAR: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + case CON_SETVARVAR: + case CON_ADDVARVAR: + case CON_SUBVARVAR: + case CON_MULVARVAR: + case CON_DIVVARVAR: + case CON_MODVARVAR: + case CON_ANDVARVAR: + case CON_ORVARVAR: + case CON_XORVARVAR: + case CON_DISPLAYRANDVARVAR: + case CON_SIN: + case CON_COS: transvartype(GAMEVAR_FLAG_READONLY); - else transvar(); - break; - } - - case CON_SETINPUT: - 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 != '[')) - { - 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; - } - - 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 != '.') - { - 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; - } - - case CON_SETACTORVAR: - case CON_SETPLAYERVAR: - 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 != '[')) - { - 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' - - // get the ID of the DEF - getlabel(); - //printf("found label of '%s'\n", label+(labelcnt<<6)); - - // 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 != '[')) - { - 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; - } - - case CON_GETCURRADDRESS: - transvartype(GAMEVAR_FLAG_READONLY); - return 0; - - case CON_ESHOOTVAR: - case CON_ESPAWNVAR: - case CON_QSPAWNVAR: - case CON_EQSPAWNVAR: - case CON_OPERATERESPAWNS: - case CON_OPERATEMASTERSWITCHES: - case CON_CHECKACTIVATORMOTION: - case CON_TIME: - case CON_INITTIMER: - case CON_LOCKPLAYER: - case CON_SHOOTVAR: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - case CON_JUMP: - case CON_SOUNDVAR: - case CON_GLOBALSOUNDVAR: - case CON_STOPSOUNDVAR: - case CON_SOUNDONCEVAR: - case CON_ANGOFFVAR: - case CON_CHECKAVAILWEAPON: - case CON_CHECKAVAILINVEN: - case CON_GUNIQHUDID: - case CON_SAVEGAMEVAR: - case CON_READGAMEVAR: - transvar(); - 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) - { - 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; - } - - case CON_RANDVAR: - case CON_ZSHOOT: - case CON_EZSHOOT: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - case CON_SETVAR: - case CON_ADDVAR: - case CON_SUBVAR: - case CON_DISPLAYRANDVAR: - case CON_MULVAR: - case CON_DIVVAR: - case CON_MODVAR: - case CON_ANDVAR: - case CON_ORVAR: - case CON_XORVAR: - case CON_SHIFTVARL: - case CON_SHIFTVARR: - - // syntax: [rand|add|set]var - // sets var1 to const1 - // adds const1 to var1 (const1 can be negative...) - //printf("Found [add|set]var at line= %ld\n",line_number); - - // get the ID of the DEF - 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)) - ReportError(WARNING_EVENTSYNC); - case CON_SETVARVAR: - case CON_ADDVARVAR: - case CON_SUBVARVAR: - case CON_MULVARVAR: - case CON_DIVVARVAR: - case CON_MODVARVAR: - case CON_ANDVARVAR: - case CON_ORVARVAR: - case CON_XORVARVAR: - case CON_DISPLAYRANDVARVAR: - case CON_SIN: - case CON_COS: - transvartype(GAMEVAR_FLAG_READONLY); - transvar(); - return 0; - - case CON_SMAXAMMO: - case CON_ADDWEAPONVAR: - case CON_ACTIVATEBYSECTOR: - case CON_OPERATESECTORS: - case CON_OPERATEACTIVATORS: - case CON_SSP: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - case CON_GMAXAMMO: - case CON_DIST: - case CON_LDIST: - case CON_GETINCANGLE: - case CON_GETANGLE: - case CON_MULSCALE: - case CON_SETASPECT: - // get the ID of the DEF - switch (tw) - { + case CON_SMAXAMMO: + case CON_ADDWEAPONVAR: + case CON_ACTIVATEBYSECTOR: + case CON_OPERATESECTORS: + case CON_OPERATEACTIVATORS: + case CON_SSP: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + case CON_GMAXAMMO: case CON_DIST: case CON_LDIST: - case CON_GETANGLE: case CON_GETINCANGLE: - transvartype(GAMEVAR_FLAG_READONLY); - break; - default: - transvar(); - break; - } - - // get the ID of the DEF - if (tw == CON_GMAXAMMO) - transvartype(GAMEVAR_FLAG_READONLY); - else transvar(); - - switch (tw) - { - case CON_DIST: - case CON_LDIST: case CON_GETANGLE: - case CON_GETINCANGLE: - transvar(); - break; case CON_MULSCALE: - transmultvars(2); - break; - } - return 0; + case CON_SETASPECT: + // get the ID of the DEF + switch (tw) + { + case CON_DIST: + case CON_LDIST: + case CON_GETANGLE: + case CON_GETINCANGLE: + transvartype(GAMEVAR_FLAG_READONLY); + break; + default: + transvar(); + break; + } - case CON_FLASH: - return 0; + // get the ID of the DEF + if (tw == CON_GMAXAMMO) + transvartype(GAMEVAR_FLAG_READONLY); + else transvar(); - case CON_DRAGPOINT: - transmultvars(3); - return 0; + switch (tw) + { + case CON_DIST: + case CON_LDIST: + case CON_GETANGLE: + case CON_GETINCANGLE: + transvar(); + break; + case CON_MULSCALE: + transmultvars(2); + break; + } + return 0; - case CON_GETFLORZOFSLOPE: - case CON_GETCEILZOFSLOPE: - transmultvars(3); - transvartype(GAMEVAR_FLAG_READONLY); - return 0; + case CON_FLASH: + return 0; - case CON_DEFINEPROJECTILE: - { - short y; - signed long z; + case CON_DRAGPOINT: + transmultvars(3); + return 0; - if (parsing_state || parsing_actor) + case CON_GETFLORZOFSLOPE: + case CON_GETCEILZOFSLOPE: + transmultvars(3); + transvartype(GAMEVAR_FLAG_READONLY); + return 0; + + case CON_DEFINEPROJECTILE: { - ReportError(ERROR_FOUNDWITHIN); - error++; + 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; } - scriptptr--; - - transnum(LABEL_DEFINE); - j = *(scriptptr-1); - - if (j > MAXTILES-1) + case CON_SPRITEFLAGS: { - ReportError(ERROR_EXCEEDSMAXTILES); - error++; + 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; } - 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) + 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); @@ -3710,397 +3756,350 @@ char parsecommand(void) error++; } - transnum(LABEL_DEFINE); - scriptptr--; - spriteflags[j] = *scriptptr; - + 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; } - 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: - case CON_IFVARVARE: - case CON_IFVARVARN: - case CON_IFVARVARAND: - case CON_WHILEVARVARN: - transmultvars(2); - tempscrptr = scriptptr; - scriptptr++; // Leave a spot for the fail location - - j = keyword(); - parsecommand(); - - *tempscrptr = (long) scriptptr; - - if (tw != CON_WHILEVARVARN) checking_ifelse++; - return 0; - - case CON_SPGETLOTAG: - case CON_SPGETHITAG: - case CON_SECTGETLOTAG: - case CON_SECTGETHITAG: - case CON_GETTEXTUREFLOOR: - case CON_GETTEXTURECEILING: - // no paramaters... - return 0; - - case CON_STARTTRACK: - // one parameter (track#) - transnum(LABEL_DEFINE); - return 0; - - case CON_IFVARL: - case CON_IFVARG: - case CON_IFVARE: - case CON_IFVARN: - case CON_IFVARAND: - case CON_WHILEVARN: - - // get the ID of the DEF - transvar(); - transnum(LABEL_DEFINE); // the number to check against... - - tempscrptr = scriptptr; - scriptptr++; //Leave a spot for the fail location - - j = keyword(); - parsecommand(); - - *tempscrptr = (long) scriptptr; - - if (tw != CON_WHILEVARN) checking_ifelse++; - return 0; - - case CON_ADDLOGVAR: - - // syntax: addlogvar - - // prints the line number in the log file. - *scriptptr=line_number; - scriptptr++; - - // get the ID of the DEF - transvar(); - return 0; - - case CON_ROTATESPRITE: - if (parsing_event == 0 && parsing_state == 0) - { - ReportError(ERROR_EVENTONLY); - error++; - } - - // syntax: - // long x, long y, long z, short a, short tilenum, signed char shade, char orientation, x1, y1, x2, y2 - // myospal adds char pal - - // get the ID of the DEFs - - transmultvars(12); - break; - - case CON_GETZRANGE: - transmultvars(4); - transmultvarstype(GAMEVAR_FLAG_READONLY,4); - transmultvars(2); - break; - - case CON_HITSCAN: - case CON_CANSEE: - // 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(); - break; - - case CON_CANSEESPR: - transmultvars(2); - transvartype(GAMEVAR_FLAG_READONLY); - break; - - case CON_ROTATEPOINT: - case CON_NEARTAG: - transmultvars(5); - transmultvarstype(GAMEVAR_FLAG_READONLY,2); - if (tw == CON_NEARTAG) - { - transmultvarstype(GAMEVAR_FLAG_READONLY,2); + case CON_IFVARVARG: + case CON_IFVARVARL: + case CON_IFVARVARE: + case CON_IFVARVARN: + case CON_IFVARVARAND: + case CON_WHILEVARVARN: transmultvars(2); - } - break; + tempscrptr = scriptptr; + scriptptr++; // Leave a spot for the fail location - case CON_MOVESPRITE: - case CON_SETSPRITE: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - transmultvars(4); - if (tw == CON_MOVESPRITE) { - transvar(); - transvartype(GAMEVAR_FLAG_READONLY); - } - break; + j = keyword(); + parsecommand(); - case CON_MINITEXT: - case CON_GAMETEXT: - case CON_DIGITALNUMBER: - if (parsing_event == 0 && parsing_state == 0) - { - ReportError(ERROR_EVENTONLY); - error++; - } + *tempscrptr = (long) scriptptr; - switch (tw) - { - case CON_GAMETEXT: - case CON_DIGITALNUMBER: - transmultvars(6); - default: - transmultvars(5); - break; - } - break; + if (tw != CON_WHILEVARVARN) checking_ifelse++; + return 0; - case CON_UPDATESECTOR: - case CON_UPDATESECTORZ: - transmultvars(2); - if (tw==CON_UPDATESECTORZ) - transvar(); - transvartype(GAMEVAR_FLAG_READONLY); - break; + case CON_SPGETLOTAG: + case CON_SPGETHITAG: + case CON_SECTGETLOTAG: + case CON_SECTGETHITAG: + case CON_GETTEXTUREFLOOR: + case CON_GETTEXTURECEILING: + // no paramaters... + return 0; - case CON_MYOS: - case CON_MYOSPAL: - case CON_MYOSX: - case CON_MYOSPALX: - if (parsing_event == 0 && parsing_state == 0) - { - ReportError(ERROR_EVENTONLY); - error++; - } + case CON_STARTTRACK: + // one parameter (track#) + transnum(LABEL_DEFINE); + return 0; - // syntax: - // long x, long y, short tilenum, signed char shade, char orientation - // myospal adds char pal - - transmultvars(5); - if (tw==CON_MYOSPAL || tw==CON_MYOSPALX) - { - // Parse: pal + case CON_IFVARL: + case CON_IFVARG: + case CON_IFVARE: + case CON_IFVARN: + case CON_IFVARAND: + case CON_WHILEVARN: // get the ID of the DEF transvar(); - } - break; + transnum(LABEL_DEFINE); // the number to check against... - case CON_FINDPLAYER: - case CON_FINDOTHERPLAYER: - case CON_DISPLAYRAND: + tempscrptr = scriptptr; + scriptptr++; //Leave a spot for the fail location - // syntax: displayrand - // gets rand (not game rand) into + j = keyword(); + parsecommand(); - // Get The ID of the DEF - transvartype(GAMEVAR_FLAG_READONLY); - break; + *tempscrptr = (long) scriptptr; - case CON_SWITCH: - //AddLog("Got Switch statement"); - if (checking_switch) - { - // Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=",__FILE__,__LINE__, checking_switch); - // AddLog(g_szBuf); - } - checking_switch++; // allow nesting (if other things work) - // Get The ID of the DEF - transvar(); + if (tw != CON_WHILEVARN) checking_ifelse++; + return 0; - tempscrptr= scriptptr; - *scriptptr++=0; // leave spot for end location (for after processing) - *scriptptr++=0; // count of case statements - casescriptptr=scriptptr; // the first case's pointer. + case CON_ADDLOGVAR: - *scriptptr++=0; // leave spot for 'default' location (null if none) + // syntax: addlogvar - j = keyword(); - temptextptr=textptr; - // probably does not allow nesting... + // prints the line number in the log file. + *scriptptr=line_number; + scriptptr++; - //AddLog("Counting Case Statements..."); + // get the ID of the DEF + transvar(); + return 0; - j=CountCaseStatements(); - //Bsprintf(g_szBuf,"Done Counting Case Statements: found %d.", j); - //AddLog(g_szBuf); - if (checking_switch>1) - { - // Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=",__FILE__,__LINE__, checking_switch); - // AddLog(g_szBuf); - } - if (j<0) - { - return 1; - } - if (tempscrptr) - { - tempscrptr[1]=(long)j; // save count of cases - } - else - { - //Bsprintf(g_szBuf,"ERROR::%s %d",__FILE__,__LINE__); + case CON_ROTATESPRITE: + if (parsing_event == 0 && parsing_state == 0) + { + ReportError(ERROR_EVENTONLY); + error++; + } + + // syntax: + // long x, long y, long z, short a, short tilenum, signed char shade, char orientation, x1, y1, x2, y2 + // myospal adds char pal + + // get the ID of the DEFs + + transmultvars(12); + break; + + case CON_GETZRANGE: + transmultvars(4); + transmultvarstype(GAMEVAR_FLAG_READONLY,4); + transmultvars(2); + break; + + case CON_HITSCAN: + case CON_CANSEE: + // 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(); + break; + + case CON_CANSEESPR: + transmultvars(2); + transvartype(GAMEVAR_FLAG_READONLY); + break; + + case CON_ROTATEPOINT: + case CON_NEARTAG: + transmultvars(5); + transmultvarstype(GAMEVAR_FLAG_READONLY,2); + if (tw == CON_NEARTAG) + { + transmultvarstype(GAMEVAR_FLAG_READONLY,2); + transmultvars(2); + } + break; + + case CON_MOVESPRITE: + case CON_SETSPRITE: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + transmultvars(4); + if (tw == CON_MOVESPRITE) + { + transvar(); + transvartype(GAMEVAR_FLAG_READONLY); + } + break; + + case CON_MINITEXT: + case CON_GAMETEXT: + case CON_DIGITALNUMBER: + if (parsing_event == 0 && parsing_state == 0) + { + ReportError(ERROR_EVENTONLY); + error++; + } + + switch (tw) + { + case CON_GAMETEXT: + case CON_DIGITALNUMBER: + transmultvars(6); + default: + transmultvars(5); + break; + } + break; + + case CON_UPDATESECTOR: + case CON_UPDATESECTORZ: + transmultvars(2); + if (tw==CON_UPDATESECTORZ) + transvar(); + transvartype(GAMEVAR_FLAG_READONLY); + break; + + case CON_MYOS: + case CON_MYOSPAL: + case CON_MYOSX: + case CON_MYOSPALX: + if (parsing_event == 0 && parsing_state == 0) + { + ReportError(ERROR_EVENTONLY); + error++; + } + + // syntax: + // long x, long y, short tilenum, signed char shade, char orientation + // myospal adds char pal + + transmultvars(5); + if (tw==CON_MYOSPAL || tw==CON_MYOSPALX) + { + // Parse: pal + + // get the ID of the DEF + transvar(); + } + break; + + case CON_FINDPLAYER: + case CON_FINDOTHERPLAYER: + case CON_DISPLAYRAND: + + // syntax: displayrand + // gets rand (not game rand) into + + // Get The ID of the DEF + transvartype(GAMEVAR_FLAG_READONLY); + break; + + case CON_SWITCH: + //AddLog("Got Switch statement"); + if (checking_switch) + { + // Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=",__FILE__,__LINE__, checking_switch); + // AddLog(g_szBuf); + } + checking_switch++; // allow nesting (if other things work) + // Get The ID of the DEF + transvar(); + + tempscrptr= scriptptr; + *scriptptr++=0; // leave spot for end location (for after processing) + *scriptptr++=0; // count of case statements + casescriptptr=scriptptr; // the first case's pointer. + + *scriptptr++=0; // leave spot for 'default' location (null if none) + + j = keyword(); + temptextptr=textptr; + // probably does not allow nesting... + + //AddLog("Counting Case Statements..."); + + j=CountCaseStatements(); + //Bsprintf(g_szBuf,"Done Counting Case Statements: found %d.", j); //AddLog(g_szBuf); - } + if (checking_switch>1) + { + // Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=",__FILE__,__LINE__, checking_switch); + // AddLog(g_szBuf); + } + if (j<0) + { + return 1; + } + if (tempscrptr) + { + tempscrptr[1]=(long)j; // save count of cases + } + else + { + //Bsprintf(g_szBuf,"ERROR::%s %d",__FILE__,__LINE__); + //AddLog(g_szBuf); + } - while (j--) - { - // leave room for statements - *scriptptr++=0; // value check - *scriptptr++=0; // code offset - } + while (j--) + { + // leave room for statements + *scriptptr++=0; // value check + *scriptptr++=0; // code offset + } - //Bsprintf(g_szBuf,"SWITCH1: '%.22s'",textptr); - //AddLog(g_szBuf); - - casecount=0; - - while (parsecommand() == 0) - { - //Bsprintf(g_szBuf,"SWITCH2: '%.22s'",textptr); + //Bsprintf(g_szBuf,"SWITCH1: '%.22s'",textptr); //AddLog(g_szBuf); - } - //Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr); - //AddLog(g_szBuf); - // done processing switch. clean up. - if (checking_switch!=1) - { - // Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=%d",__FILE__,__LINE__, checking_switch); - // AddLog(g_szBuf); - } - casecount=0; - if (tempscrptr) - { - tempscrptr[0]= (long)scriptptr - (long)&script[0]; // save 'end' location - } - else - { - //Bsprintf(g_szBuf,"ERROR::%s %d",__FILE__,__LINE__); - //AddLog(g_szBuf); - } - casescriptptr=NULL; - // decremented in endswitch. Don't decrement here... - // checking_switch--; // allow nesting (maybe if other things work) - tempscrptr=NULL; - if (checking_switch) - { - //Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=%d",__FILE__,__LINE__, checking_switch); - //AddLog(g_szBuf); - } - //AddLog("End of Switch statement"); - break; - case CON_CASE: - //AddLog("Found Case"); + casecount=0; + + while (parsecommand() == 0) + { + //Bsprintf(g_szBuf,"SWITCH2: '%.22s'",textptr); + //AddLog(g_szBuf); + } + //Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr); + //AddLog(g_szBuf); + // done processing switch. clean up. + if (checking_switch!=1) + { + // Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=%d",__FILE__,__LINE__, checking_switch); + // AddLog(g_szBuf); + } + casecount=0; + if (tempscrptr) + { + tempscrptr[0]= (long)scriptptr - (long)&script[0]; // save 'end' location + } + else + { + //Bsprintf(g_szBuf,"ERROR::%s %d",__FILE__,__LINE__); + //AddLog(g_szBuf); + } + casescriptptr=NULL; + // decremented in endswitch. Don't decrement here... + // checking_switch--; // allow nesting (maybe if other things work) + tempscrptr=NULL; + if (checking_switch) + { + //Bsprintf(g_szBuf,"ERROR::%s %d: Checking_switch=%d",__FILE__,__LINE__, checking_switch); + //AddLog(g_szBuf); + } + //AddLog("End of Switch statement"); + break; + + case CON_CASE: + //AddLog("Found Case"); repeatcase: - scriptptr--; // don't save in code - if (checking_switch<1) - { - error++; - ReportError(-1); - initprintf("%s:%ld: error: found `case' statement when not in switch\n",compilefile,line_number); - return 1; - } - casecount++; - //Bsprintf(g_szBuf,"case1: %.12s",textptr); - //AddLog(g_szBuf); - transnum(LABEL_DEFINE); - if (*textptr == ':') - textptr++; - //Bsprintf(g_szBuf,"case2: %.12s",textptr); - //AddLog(g_szBuf); - - j=*(--scriptptr); // get value - //Bsprintf(g_szBuf,"case: Value of case %ld is %ld",(long)casecount,(long)j); - //AddLog(g_szBuf); - if (casescriptptr) - { - //AddLog("Adding value to script"); - casescriptptr[casecount++]=j; // save value - casescriptptr[casecount]=(long)((long*)scriptptr-&script[0]); // save offset - } - // j = keyword(); - //Bsprintf(g_szBuf,"case3: %.12s",textptr); - //AddLog(g_szBuf); - - j = keyword(); - if (j == CON_CASE) - { - //AddLog("Found Repeat Case"); - transword(); // eat 'case' - goto repeatcase; - } - //Bsprintf(g_szBuf,"case4: '%.12s'",textptr); - //AddLog(g_szBuf); - while (parsecommand() == 0) - { - //Bsprintf(g_szBuf,"case5 '%.25s'",textptr); + scriptptr--; // don't save in code + if (checking_switch<1) + { + error++; + ReportError(-1); + initprintf("%s:%ld: error: found `case' statement when not in switch\n",compilefile,line_number); + return 1; + } + casecount++; + //Bsprintf(g_szBuf,"case1: %.12s",textptr); //AddLog(g_szBuf); + transnum(LABEL_DEFINE); + if (*textptr == ':') + textptr++; + //Bsprintf(g_szBuf,"case2: %.12s",textptr); + //AddLog(g_szBuf); + + j=*(--scriptptr); // get value + //Bsprintf(g_szBuf,"case: Value of case %ld is %ld",(long)casecount,(long)j); + //AddLog(g_szBuf); + if (casescriptptr) + { + //AddLog("Adding value to script"); + casescriptptr[casecount++]=j; // save value + casescriptptr[casecount]=(long)((long*)scriptptr-&script[0]); // save offset + } + // j = keyword(); + //Bsprintf(g_szBuf,"case3: %.12s",textptr); + //AddLog(g_szBuf); + j = keyword(); if (j == CON_CASE) { @@ -4108,777 +4107,794 @@ repeatcase: transword(); // eat 'case' goto repeatcase; } - } - //AddLog("End Case"); - return 0; - // break; - case CON_DEFAULT: - scriptptr--; // don't save - 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) - { - // duplicate default statement - error++; - ReportError(-1); - initprintf("%s:%ld: error: multiple `default' statements found in switch\n",compilefile,line_number); - } - if (casescriptptr) - { - casescriptptr[0]=(long)(scriptptr-&script[0]); // save offset - } - //Bsprintf(g_szBuf,"default: '%.22s'",textptr); - //AddLog(g_szBuf); - while (parsecommand() == 0) - { - //Bsprintf(g_szBuf,"defaultParse: '%.22s'",textptr); + //Bsprintf(g_szBuf,"case4: '%.12s'",textptr); //AddLog(g_szBuf); - ; - } - break; - - case CON_ENDSWITCH: - //AddLog("End Switch"); - checking_switch--; - if (checking_switch < 0) - { - error++; - ReportError(-1); - initprintf("%s:%ld: error: found `endswitch' without matching `switch'\n",compilefile,line_number); - } - if (casescriptptr) - { - int i; - - //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++) + while (parsecommand() == 0) { - if (i & 1) + //Bsprintf(g_szBuf,"case5 '%.25s'",textptr); + //AddLog(g_szBuf); + j = keyword(); + if (j == CON_CASE) { - //Bsprintf(g_szBuf,"Case Value %d is %ld",i/2+1,casescriptptr[i]); - //AddLog(g_szBuf); - } - else - { - //Bsprintf(g_szBuf,"Offset %d is %ld",i/2+1,casescriptptr[i]); - //AddLog(g_szBuf); + //AddLog("Found Repeat Case"); + transword(); // eat 'case' + goto repeatcase; } } - } - else - { - //AddLog("Not saving case value: just counting"); - } - return 1; // end of block - break; - - case CON_CHANGESPRITESTAT: - case CON_CHANGESPRITESECT: - case CON_ZSHOOTVAR: - case CON_EZSHOOTVAR: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - case CON_GETPNAME: - case CON_STARTLEVEL: - case CON_QSTRCAT: - case CON_QSTRCPY: - case CON_QSTRLEN: - transmultvars(2); - return 0; - case CON_SETACTORANGLE: - case CON_SETPLAYERANGLE: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - case CON_GETANGLETOTARGET: - case CON_GETACTORANGLE: - case CON_GETPLAYERANGLE: - // Syntax: - - // get the ID of the DEF - transvar(); - return 0; - - case CON_ADDLOG: - // syntax: addlog - - // prints the line number in the log file. - *scriptptr=line_number; - scriptptr++; - return 0; - - case CON_IFPINVENTORY: - case CON_IFRND: - if (!CheckEventSync(current_event)) - ReportError(WARNING_EVENTSYNC); - case CON_IFPDISTL: - case CON_IFPDISTG: - case CON_IFWASWEAPON: - case CON_IFACTIONCOUNT: - case CON_IFCOUNT: - case CON_IFACTOR: - case CON_IFSTRENGTH: - case CON_IFSPAWNEDBY: - case CON_IFGAPZL: - case CON_IFFLOORDISTL: - case CON_IFCEILINGDISTL: - // case 74: - case CON_IFPHEALTHL: - case CON_IFSPRITEPAL: - case CON_IFGOTWEAPONCE: - case CON_IFANGDIFFL: - case CON_IFSOUND: - case CON_IFAI: - case CON_IFACTION: - case CON_IFMOVE: - switch (tw) - { - case CON_IFAI: - transnum(LABEL_AI); - break; - case CON_IFACTION: - transnum(LABEL_ACTION); - break; - case CON_IFMOVE: - if ((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) + //AddLog("End Case"); + return 0; + // break; + case CON_DEFAULT: + scriptptr--; // don't save + if (checking_switch<1) { + error++; ReportError(-1); - *(scriptptr-1) = 0; - initprintf("%s:%ld: warning: expected a move, found a constant.\n",compilefile,line_number); + initprintf("%s:%ld: error: found `default' statement when not in switch\n",compilefile,line_number); + return 1; } - break; - case CON_IFPINVENTORY: - transnum(LABEL_DEFINE); - transnum(LABEL_DEFINE); - break; - default: - transnum(LABEL_DEFINE); - break; - } - - case CON_IFONWATER: - case CON_IFINWATER: - case CON_IFACTORNOTSTAYPUT: - case CON_IFCANSEE: - case CON_IFHITWEAPON: - case CON_IFSQUISHED: - case CON_IFDEAD: - case CON_IFCANSHOOTTARGET: - case CON_IFP: - case CON_IFHITSPACE: - case CON_IFOUTSIDE: - case CON_IFMULTIPLAYER: - case CON_IFINSPACE: - case CON_IFBULLETNEAR: - case CON_IFRESPAWN: - case CON_IFINOUTERSPACE: - case CON_IFNOTMOVING: - case CON_IFAWAYFROMWALL: - case CON_IFCANSEETARGET: - case CON_IFNOSOUNDS: - if (tw == CON_IFP) - { - j = 0; - do + if (casescriptptr && casescriptptr[0]!=0) { - transnum(LABEL_DEFINE); - scriptptr--; - j |= *scriptptr; + // duplicate default statement + error++; + ReportError(-1); + initprintf("%s:%ld: error: multiple `default' statements found in switch\n",compilefile,line_number); } - while (keyword() == -1); - *scriptptr = j; + if (casescriptptr) + { + casescriptptr[0]=(long)(scriptptr-&script[0]); // save offset + } + //Bsprintf(g_szBuf,"default: '%.22s'",textptr); + //AddLog(g_szBuf); + while (parsecommand() == 0) + { + //Bsprintf(g_szBuf,"defaultParse: '%.22s'",textptr); + //AddLog(g_szBuf); + ; + } + break; + + case CON_ENDSWITCH: + //AddLog("End Switch"); + checking_switch--; + if (checking_switch < 0) + { + error++; + ReportError(-1); + initprintf("%s:%ld: error: found `endswitch' without matching `switch'\n",compilefile,line_number); + } + if (casescriptptr) + { + int i; + + //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++) + { + if (i & 1) + { + //Bsprintf(g_szBuf,"Case Value %d is %ld",i/2+1,casescriptptr[i]); + //AddLog(g_szBuf); + } + else + { + //Bsprintf(g_szBuf,"Offset %d is %ld",i/2+1,casescriptptr[i]); + //AddLog(g_szBuf); + } + } + } + else + { + //AddLog("Not saving case value: just counting"); + } + return 1; // end of block + break; + + case CON_CHANGESPRITESTAT: + case CON_CHANGESPRITESECT: + case CON_ZSHOOTVAR: + case CON_EZSHOOTVAR: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + case CON_GETPNAME: + case CON_STARTLEVEL: + case CON_QSTRCAT: + case CON_QSTRCPY: + case CON_QSTRLEN: + transmultvars(2); + return 0; + case CON_SETACTORANGLE: + case CON_SETPLAYERANGLE: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + case CON_GETANGLETOTARGET: + case CON_GETACTORANGLE: + case CON_GETPLAYERANGLE: + // Syntax: + + // get the ID of the DEF + transvar(); + return 0; + + case CON_ADDLOG: + // syntax: addlog + + // prints the line number in the log file. + *scriptptr=line_number; scriptptr++; - } + return 0; - tempscrptr = scriptptr; - scriptptr++; //Leave a spot for the fail location - - j = keyword(); - parsecommand(); - - *tempscrptr = (long) scriptptr; - - checking_ifelse++; - return 0; - - case CON_LEFTBRACE: - if (!(parsing_state || parsing_actor || parsing_event)) - { - error++; - ReportError(ERROR_SYNTAXERROR); - } - num_braces++; - do - done = parsecommand(); - while (done == 0); - return 0; - - case CON_RIGHTBRACE: - num_braces--; - if (num_braces < 0) - { - if (checking_switch) + case CON_IFPINVENTORY: + case CON_IFRND: + if (!CheckEventSync(current_event)) + ReportError(WARNING_EVENTSYNC); + case CON_IFPDISTL: + case CON_IFPDISTG: + case CON_IFWASWEAPON: + case CON_IFACTIONCOUNT: + case CON_IFCOUNT: + case CON_IFACTOR: + case CON_IFSTRENGTH: + case CON_IFSPAWNEDBY: + case CON_IFGAPZL: + case CON_IFFLOORDISTL: + case CON_IFCEILINGDISTL: + // case 74: + case CON_IFPHEALTHL: + case CON_IFSPRITEPAL: + case CON_IFGOTWEAPONCE: + case CON_IFANGDIFFL: + case CON_IFSOUND: + case CON_IFAI: + case CON_IFACTION: + case CON_IFMOVE: + switch (tw) { - ReportError(ERROR_NOENDSWITCH); + case CON_IFAI: + transnum(LABEL_AI); + break; + case CON_IFACTION: + transnum(LABEL_ACTION); + break; + case CON_IFMOVE: + 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); + } + break; + case CON_IFPINVENTORY: + transnum(LABEL_DEFINE); + transnum(LABEL_DEFINE); + break; + default: + transnum(LABEL_DEFINE); + break; } - ReportError(-1); - initprintf("%s:%ld: error: found more `}' than `{'.\n",compilefile,line_number); - error++; - } - return 1; - - case CON_BETANAME: - scriptptr--; - j = 0; - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - textptr++; - return 0; - - case CON_DEFINEVOLUMENAME: - scriptptr--; - transnum(LABEL_DEFINE); - scriptptr--; - j = *scriptptr; - 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++; - break; - } - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - volume_names[j][i] = toupper(*textptr); - textptr++,i++; - if (i >= (signed)sizeof(volume_names[j])-1) + case CON_IFONWATER: + case CON_IFINWATER: + case CON_IFACTORNOTSTAYPUT: + case CON_IFCANSEE: + case CON_IFHITWEAPON: + case CON_IFSQUISHED: + case CON_IFDEAD: + case CON_IFCANSHOOTTARGET: + case CON_IFP: + case CON_IFHITSPACE: + case CON_IFOUTSIDE: + case CON_IFMULTIPLAYER: + case CON_IFINSPACE: + case CON_IFBULLETNEAR: + case CON_IFRESPAWN: + case CON_IFINOUTERSPACE: + case CON_IFNOTMOVING: + case CON_IFAWAYFROMWALL: + case CON_IFCANSEETARGET: + case CON_IFNOSOUNDS: + if (tw == CON_IFP) + { + j = 0; + do + { + transnum(LABEL_DEFINE); + scriptptr--; + j |= *scriptptr; + } + while (keyword() == -1); + *scriptptr = j; + scriptptr++; + } + + tempscrptr = scriptptr; + scriptptr++; //Leave a spot for the fail location + + j = keyword(); + parsecommand(); + + *tempscrptr = (long) scriptptr; + + checking_ifelse++; + return 0; + + case CON_LEFTBRACE: + if (!(parsing_state || parsing_actor || parsing_event)) { - 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++; - break; + ReportError(ERROR_SYNTAXERROR); } - } - num_volumes = j+1; - volume_names[j][i] = '\0'; - return 0; + num_braces++; + do + done = parsecommand(); + while (done == 0); + return 0; - case CON_DEFINEGAMEFUNCNAME: - scriptptr--; - transnum(LABEL_DEFINE); - scriptptr--; - j = *scriptptr; - 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++; - break; - } - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - gamefunctions[j][i] = *textptr; - keydefaults[j*3][i] = *textptr; - textptr++,i++; - if (i >= MAXGAMEFUNCLEN-1) + case CON_RIGHTBRACE: + num_braces--; + if (num_braces < 0) { - initprintf("%s:%ld: error: function name exceeds limit of %ld characters.\n",compilefile,line_number,MAXGAMEFUNCLEN); + if (checking_switch) + { + ReportError(ERROR_NOENDSWITCH); + } + + ReportError(-1); + initprintf("%s:%ld: error: found more `}' than `{'.\n",compilefile,line_number); error++; - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; - break; } - } - gamefunctions[j][i] = '\0'; - keydefaults[j*3][i] = '\0'; - return 0; + return 1; - case CON_DEFINESKILLNAME: - scriptptr--; - transnum(LABEL_DEFINE); - scriptptr--; - j = *scriptptr; - 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++; - break; - } - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - skill_names[j][i] = toupper(*textptr); - textptr++,i++; - 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++; - break; - } - } - skill_names[j][i] = '\0'; - return 0; - - case CON_DEFINEGAMETYPE: - scriptptr--; //remove opcode from compiled code - transnum(LABEL_DEFINE); //translate number - scriptptr--; //remove it from compiled code - j = *scriptptr; //put it into j - - transnum(LABEL_DEFINE); //translate number - scriptptr--; //remove it from compiled code - gametype_flags[j] = *scriptptr; //put it into the flags - - 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++; - break; - } - num_gametypes = j+1; - - i = 0; - - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - gametype_names[j][i] = toupper(*textptr); - textptr++,i++; - 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++; - break; - } - } - gametype_names[j][i] = '\0'; - return 0; - - case CON_DEFINELEVELNAME: - scriptptr--; - transnum(LABEL_DEFINE); - scriptptr--; - j = *scriptptr; - transnum(LABEL_DEFINE); - scriptptr--; - k = *scriptptr; - 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++; - break; - } - if (k < 0 || k > 10) - { - initprintf("%s:%ld: error: level number exceeds maximum number of levels per episode.\n", - line_number,compilefile); - error++; - while (*textptr != 0x0a && *textptr != 0) textptr++; - break; - } - - i = 0; - while (*textptr != ' ' && *textptr != '\t' && *textptr != 0x0a) - { - level_file_names[j*11+k][i] = *textptr; - textptr++,i++; - 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++; - break; - } - } - level_names[j*11+k][i] = '\0'; - - 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++; - - 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++; - - i = 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) - { - 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++; - break; - } - } - level_names[j*11+k][i] = '\0'; - return 0; - - case CON_DEFINEQUOTE: - case CON_REDEFINEQUOTE: - if (tw == CON_DEFINEQUOTE) + case CON_BETANAME: scriptptr--; + j = 0; + while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) + textptr++; + return 0; - transnum(LABEL_DEFINE); - - k = *(scriptptr-1); - - if (k >= MAXQUOTES) - { - initprintf("%s:%ld: error: quote number exceeds limit of %ld.\n",compilefile,line_number,MAXQUOTES); - error++; - } - - if (fta_quotes[k] == NULL) - fta_quotes[k] = Bcalloc(MAXQUOTELEN,sizeof(char)); - if (!fta_quotes[k]) - { - fta_quotes[k] = NULL; - Bsprintf(tempbuf,"Failed allocating %d byte quote text buffer.",sizeof(char) * MAXQUOTELEN); - gameexit(tempbuf); - } - - if (tw == CON_DEFINEQUOTE) + case CON_DEFINEVOLUMENAME: scriptptr--; + transnum(LABEL_DEFINE); + scriptptr--; + j = *scriptptr; + while (*textptr == ' ' || *textptr == '\t') textptr++; - i = 0; - - while (*textptr == ' ' || *textptr == '\t') - textptr++; - - if (tw == CON_REDEFINEQUOTE) - { - if (redefined_quotes[redefined_quote_count] == NULL) - redefined_quotes[redefined_quote_count] = Bcalloc(MAXQUOTELEN,sizeof(char)); - if (!redefined_quotes[redefined_quote_count]) + if (j < 0 || j > MAXVOLUMES-1) { - redefined_quotes[redefined_quote_count] = NULL; + initprintf("%s:%ld: error: volume number exceeds maximum volume count.\n",compilefile,line_number); + error++; + while (*textptr != 0x0a && *textptr != 0) textptr++; + break; + } + + i = 0; + + while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) + { + volume_names[j][i] = toupper(*textptr); + textptr++,i++; + 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++; + break; + } + } + num_volumes = j+1; + volume_names[j][i] = '\0'; + return 0; + + case CON_DEFINEGAMEFUNCNAME: + scriptptr--; + transnum(LABEL_DEFINE); + scriptptr--; + j = *scriptptr; + 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++; + break; + } + + i = 0; + + while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) + { + gamefunctions[j][i] = *textptr; + keydefaults[j*3][i] = *textptr; + textptr++,i++; + 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++; + break; + } + } + gamefunctions[j][i] = '\0'; + keydefaults[j*3][i] = '\0'; + return 0; + + case CON_DEFINESKILLNAME: + scriptptr--; + transnum(LABEL_DEFINE); + scriptptr--; + j = *scriptptr; + 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++; + break; + } + + i = 0; + + while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) + { + skill_names[j][i] = toupper(*textptr); + textptr++,i++; + 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++; + break; + } + } + skill_names[j][i] = '\0'; + return 0; + + case CON_DEFINEGAMETYPE: + scriptptr--; //remove opcode from compiled code + transnum(LABEL_DEFINE); //translate number + scriptptr--; //remove it from compiled code + j = *scriptptr; //put it into j + + transnum(LABEL_DEFINE); //translate number + scriptptr--; //remove it from compiled code + gametype_flags[j] = *scriptptr; //put it into the flags + + 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++; + break; + } + num_gametypes = j+1; + + i = 0; + + while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) + { + gametype_names[j][i] = toupper(*textptr); + textptr++,i++; + 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++; + break; + } + } + gametype_names[j][i] = '\0'; + return 0; + + case CON_DEFINELEVELNAME: + scriptptr--; + transnum(LABEL_DEFINE); + scriptptr--; + j = *scriptptr; + transnum(LABEL_DEFINE); + scriptptr--; + k = *scriptptr; + 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++; + break; + } + if (k < 0 || k > 10) + { + initprintf("%s:%ld: error: level number exceeds maximum number of levels per episode.\n", + line_number,compilefile); + error++; + while (*textptr != 0x0a && *textptr != 0) textptr++; + break; + } + + i = 0; + while (*textptr != ' ' && *textptr != '\t' && *textptr != 0x0a) + { + level_file_names[j*11+k][i] = *textptr; + textptr++,i++; + 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++; + break; + } + } + level_names[j*11+k][i] = '\0'; + + 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++; + + 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++; + + i = 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) + { + 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++; + break; + } + } + level_names[j*11+k][i] = '\0'; + return 0; + + case CON_DEFINEQUOTE: + case CON_REDEFINEQUOTE: + if (tw == CON_DEFINEQUOTE) + scriptptr--; + + transnum(LABEL_DEFINE); + + k = *(scriptptr-1); + + if (k >= MAXQUOTES) + { + initprintf("%s:%ld: error: quote number exceeds limit of %ld.\n",compilefile,line_number,MAXQUOTES); + error++; + } + + if (fta_quotes[k] == NULL) + fta_quotes[k] = Bcalloc(MAXQUOTELEN,sizeof(char)); + if (!fta_quotes[k]) + { + fta_quotes[k] = NULL; Bsprintf(tempbuf,"Failed allocating %d byte quote text buffer.",sizeof(char) * MAXQUOTELEN); gameexit(tempbuf); } - } - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) - { - if (*textptr == '%' && *(textptr+1) == 's') + if (tw == CON_DEFINEQUOTE) + scriptptr--; + + i = 0; + + while (*textptr == ' ' || *textptr == '\t') + textptr++; + + if (tw == CON_REDEFINEQUOTE) { - initprintf("%s:%ld: error: quote text contains string identifier.\n",compilefile,line_number); - error++; - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; - break; + if (redefined_quotes[redefined_quote_count] == NULL) + redefined_quotes[redefined_quote_count] = Bcalloc(MAXQUOTELEN,sizeof(char)); + if (!redefined_quotes[redefined_quote_count]) + { + redefined_quotes[redefined_quote_count] = NULL; + Bsprintf(tempbuf,"Failed allocating %d byte quote text buffer.",sizeof(char) * MAXQUOTELEN); + gameexit(tempbuf); + } + } + + while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) + { + 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++; + break; + } + if (tw == CON_DEFINEQUOTE) + *(fta_quotes[k]+i) = *textptr; + else + *(redefined_quotes[redefined_quote_count]+i) = *textptr; + textptr++,i++; + 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++; + break; + } } if (tw == CON_DEFINEQUOTE) - *(fta_quotes[k]+i) = *textptr; + *(fta_quotes[k]+i) = '\0'; else - *(redefined_quotes[redefined_quote_count]+i) = *textptr; - textptr++,i++; - if (i >= MAXQUOTELEN-1) { - initprintf("%s:%ld: error: quote text exceeds limit of %ld characters.\n",compilefile,line_number,MAXQUOTELEN-1); + *(redefined_quotes[redefined_quote_count]+i) = '\0'; + *scriptptr++=redefined_quote_count; + redefined_quote_count++; + } + return 0; + + case CON_CHEATKEYS: + scriptptr--; + transnum(LABEL_DEFINE); + cheatkey[0] = *(scriptptr-1); + transnum(LABEL_DEFINE); + cheatkey[1] = *(scriptptr-1); + return 0; + + case CON_DEFINECHEAT: + scriptptr--; + transnum(LABEL_DEFINE); + k = *(scriptptr-1); + + 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++; break; } - } - if (tw == CON_DEFINEQUOTE) - *(fta_quotes[k]+i) = '\0'; - else - { - *(redefined_quotes[redefined_quote_count]+i) = '\0'; - *scriptptr++=redefined_quote_count; - redefined_quote_count++; - } - return 0; - - case CON_CHEATKEYS: - scriptptr--; - transnum(LABEL_DEFINE); - cheatkey[0] = *(scriptptr-1); - transnum(LABEL_DEFINE); - cheatkey[1] = *(scriptptr-1); - return 0; - - case CON_DEFINECHEAT: - scriptptr--; - transnum(LABEL_DEFINE); - k = *(scriptptr-1); - - 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++; - break; - } - scriptptr--; - i = 0; - while (*textptr == ' ' || *textptr == '\t') - textptr++; - while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') - { - cheatquotes[k][i] = *textptr; - textptr++,i++; - 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++; - break; - } - } - cheatquotes[k][i] = '\0'; - return 0; - - case CON_DEFINESOUND: - scriptptr--; - transnum(LABEL_DEFINE); - k = *(scriptptr-1); - if (k >= NUM_SOUNDS) - { - initprintf("%s:%ld: error: exceeded sound limit of %ld.\n",compilefile,line_number,NUM_SOUNDS); - error++; - } - scriptptr--; - i = 0; - skipcomments(); - - while (*textptr != ' ' || *textptr == '\t') - { - sounds[k][i] = *textptr; - textptr++,i++; - if (i >= BMAX_PATH) - { - initprintf("%s:%ld: error: sound filename exceeds limit of %d characters.\n",compilefile,line_number,BMAX_PATH); - error++; - skipcomments(); - break; - } - } - sounds[k][i] = '\0'; - - transnum(LABEL_DEFINE); - soundps[k] = *(scriptptr-1); - scriptptr--; - transnum(LABEL_DEFINE); - soundpe[k] = *(scriptptr-1); - scriptptr--; - transnum(LABEL_DEFINE); - soundpr[k] = *(scriptptr-1); - scriptptr--; - transnum(LABEL_DEFINE); - soundm[k] = *(scriptptr-1); - scriptptr--; - transnum(LABEL_DEFINE); - soundvo[k] = *(scriptptr-1); - scriptptr--; - return 0; - - case CON_ENDEVENT: - - if (parsing_event == 0) - { - ReportError(-1); - initprintf("%s:%ld: error: found `endevent' without open `onevent'.\n",compilefile,line_number); - error++; - } - if (num_braces > 0) - { - ReportError(ERROR_OPENBRACKET); - error++; - } - if (num_braces < 0) - { - ReportError(ERROR_CLOSEBRACKET); - error++; - } - parsing_event = 0; - parsing_actor = 0; - current_event = -1; - Bsprintf(parsing_item_name,"(none)"); - return 0; - - case CON_ENDA: - if (parsing_actor == 0) - { - ReportError(-1); - initprintf("%s:%ld: error: found `enda' without open `actor'.\n",compilefile,line_number); - error++; - } - if (num_braces > 0) - { - ReportError(ERROR_OPENBRACKET); - error++; - } - if (num_braces < 0) - { - ReportError(ERROR_CLOSEBRACKET); - error++; - } - parsing_actor = 0; - Bsprintf(parsing_item_name,"(none)"); - return 0; - - case CON_BREAK: - if (checking_switch) - { - //Bsprintf(g_szBuf," * (L%ld) case Break statement.\n",line_number); - //AddLog(g_szBuf); - return 1; - } - return 0; - - case CON_FALL: - case CON_TIP: - // case 21: - case CON_KILLIT: - case CON_RESETACTIONCOUNT: - case CON_PSTOMP: - case CON_RESETPLAYER: - case CON_RESETCOUNT: - case CON_WACKPLAYER: - case CON_OPERATE: - case CON_RESPAWNHITAG: - case CON_GETLASTPAL: - case CON_PKICK: - case CON_MIKESND: - case CON_TOSSWEAPON: - 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++) - { - transnum(LABEL_DEFINE); scriptptr--; - params[j] = *scriptptr; + i = 0; + while (*textptr == ' ' || *textptr == '\t') + textptr++; + while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') + { + cheatquotes[k][i] = *textptr; + textptr++,i++; + 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++; + break; + } + } + cheatquotes[k][i] = '\0'; + return 0; - if (j != 25) continue; + case CON_DEFINESOUND: + scriptptr--; + transnum(LABEL_DEFINE); + k = *(scriptptr-1); + if (k >= NUM_SOUNDS) + { + initprintf("%s:%ld: error: exceeded sound limit of %ld.\n",compilefile,line_number,NUM_SOUNDS); + error++; + } + scriptptr--; + i = 0; + skipcomments(); + + while (*textptr != ' ' || *textptr == '\t') + { + sounds[k][i] = *textptr; + textptr++,i++; + if (i >= BMAX_PATH) + { + initprintf("%s:%ld: error: sound filename exceeds limit of %d characters.\n",compilefile,line_number,BMAX_PATH); + error++; + skipcomments(); + break; + } + } + sounds[k][i] = '\0'; + + transnum(LABEL_DEFINE); + soundps[k] = *(scriptptr-1); + scriptptr--; + transnum(LABEL_DEFINE); + soundpe[k] = *(scriptptr-1); + scriptptr--; + transnum(LABEL_DEFINE); + soundpr[k] = *(scriptptr-1); + scriptptr--; + transnum(LABEL_DEFINE); + soundm[k] = *(scriptptr-1); + scriptptr--; + transnum(LABEL_DEFINE); + soundvo[k] = *(scriptptr-1); + scriptptr--; + return 0; + + case CON_ENDEVENT: + + if (parsing_event == 0) + { + ReportError(-1); + initprintf("%s:%ld: error: found `endevent' without open `onevent'.\n",compilefile,line_number); + error++; + } + if (num_braces > 0) + { + ReportError(ERROR_OPENBRACKET); + error++; + } + if (num_braces < 0) + { + ReportError(ERROR_CLOSEBRACKET); + error++; + } + parsing_event = 0; + parsing_actor = 0; + current_event = -1; + Bsprintf(parsing_item_name,"(none)"); + return 0; + + case CON_ENDA: + if (parsing_actor == 0) + { + ReportError(-1); + initprintf("%s:%ld: error: found `enda' without open `actor'.\n",compilefile,line_number); + error++; + } + if (num_braces > 0) + { + ReportError(ERROR_OPENBRACKET); + error++; + } + if (num_braces < 0) + { + ReportError(ERROR_CLOSEBRACKET); + error++; + } + parsing_actor = 0; + Bsprintf(parsing_item_name,"(none)"); + return 0; + + case CON_BREAK: + if (checking_switch) + { + //Bsprintf(g_szBuf," * (L%ld) case Break statement.\n",line_number); + //AddLog(g_szBuf); + return 1; + } + return 0; + + case CON_FALL: + case CON_TIP: + // case 21: + case CON_KILLIT: + case CON_RESETACTIONCOUNT: + case CON_PSTOMP: + case CON_RESETPLAYER: + case CON_RESETCOUNT: + case CON_WACKPLAYER: + case CON_OPERATE: + case CON_RESPAWNHITAG: + case CON_GETLASTPAL: + case CON_PKICK: + case CON_MIKESND: + case CON_TOSSWEAPON: + 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++) + { + transnum(LABEL_DEFINE); + 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 (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++]; + } } - - /* - 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; } return 0; } @@ -4924,7 +4940,8 @@ void copydefaultcons(void) fpo = fopenfrompath(defaultcons[i],"wb"); - if (fpo == NULL) { + if (fpo == NULL) + { kclose(fpi); continue; } @@ -5661,7 +5678,8 @@ void AddDefaultDefinitions(void) void InitProjectiles(void) { int i; - for (i=0;ix; my = s->y; - mxvect = sintable[(s->ang+512)&2047]; myvect = sintable[s->ang&2047]; + mxvect = sintable[(s->ang+512)&2047]; + myvect = sintable[s->ang&2047]; for (i=headspritestat[4];i>=0;i=nextspritestat[i]) //weapons list { @@ -3097,7 +3098,8 @@ char dodge(spritetype *s) bx = SX-mx; by = SY-my; - bxvect = sintable[(SA+512)&2047]; byvect = sintable[SA&2047]; + bxvect = sintable[(SA+512)&2047]; + byvect = sintable[SA&2047]; if (mxvect*bx + myvect*by >= 0) if (bxvect*bx + byvect*by < 0) @@ -3590,3286 +3592,3320 @@ char parse(void) 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; - } - - case CON_GETTHISPROJECTILE: - case CON_SETTHISPROJECTILE: - { - // 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; - } - - case CON_IFRND: - insptr++; - parseifelse(rnd(*insptr)); - break; - - case CON_IFCANSHOOTTARGET: - - if (g_x > 1024) + case CON_REDEFINEQUOTE: { - short temphit, sclip, angdif; + 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; + } - if (badguy(g_sp) && g_sp->xrepeat > 56) - { - sclip = 3084; - angdif = 48; - } - else - { - sclip = 768; - angdif = 16; - } + case CON_GETTHISPROJECTILE: + case CON_SETTHISPROJECTILE: + { + // syntax [gs]etplayer[].x + // + long lLabelID; + long lVar1, lVar2; - j = hitasprite(g_i,&temphit); - if (j == (1<<30)) + insptr++; + lVar1=*insptr++; + lLabelID=*insptr++; + lVar2=*insptr++; + DoThisProjectile(tw==CON_SETTHISPROJECTILE,lVar1,lLabelID,lVar2,g_i,g_p); + break; + } + + case CON_IFRND: + insptr++; + parseifelse(rnd(*insptr)); + break; + + case CON_IFCANSHOOTTARGET: + + if (g_x > 1024) { - parseifelse(1); - break; - } - if (j > sclip) - { - if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) - j = 0; + short temphit, sclip, angdif; + + if (badguy(g_sp) && g_sp->xrepeat > 56) + { + sclip = 3084; + angdif = 48; + } else { - g_sp->ang += angdif;j = hitasprite(g_i,&temphit);g_sp->ang -= angdif; - if (j > sclip) + sclip = 768; + angdif = 16; + } + + j = hitasprite(g_i,&temphit); + if (j == (1<<30)) + { + parseifelse(1); + break; + } + if (j > sclip) + { + if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) + j = 0; + else { - 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) { - g_sp->ang -= angdif;j = hitasprite(g_i,&temphit);g_sp->ang += angdif; - if (j > 768) + if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) + j = 0; + else { - if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) - j = 0; - else j = 1; + g_sp->ang -= angdif; + j = hitasprite(g_i,&temphit); + g_sp->ang += angdif; + if (j > 768) + { + if (temphit >= 0 && sprite[temphit].picnum == g_sp->picnum) + j = 0; + else j = 1; + } + else j = 0; } - else j = 0; } + else j = 0; } - else j = 0; + } + else j = 0; + } + else j = 1; + + parseifelse(j); + break; + + 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; + break; + + case CON_IFACTORNOTSTAYPUT: + parseifelse(hittype[g_i].actorstayput == -1); + 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) + { + 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]; } } - else j = 0; - } - else j = 1; + else s = &sprite[ps[g_p].i]; // holoduke not on. look for player - parseifelse(j); - break; - - 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; - break; - - case CON_IFACTORNOTSTAYPUT: - parseifelse(hittype[g_i].actorstayput == -1); - 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) - { - 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); + // 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 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 + // they can't see it. - // 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); + // 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; - 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); - break; - - case CON_IFSQUISHED: - parseifelse(ifsquished(g_i, g_p) == 1); - break; - - case CON_IFDEAD: - { - j = g_sp->extra; - if (g_sp->picnum == APLAYER) - j--; - parseifelse(j < 0); - } - break; - - case CON_AI: - insptr++; - g_t[5] = *insptr++; // Ai - g_t[4] = *(long *)(g_t[5]); // Action - 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) - g_sp->ang = TRAND&2047; - break; - - case CON_ACTION: - insptr++; - g_t[2] = 0; - g_t[3] = 0; - g_t[4] = *insptr++; - break; - - case CON_IFPDISTL: - insptr++; - parseifelse(g_x < *insptr); - 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) - hittype[g_i].timetosleep = SLEEPTIME; - break; - - case CON_ELSE: - insptr = (long *) *(insptr+1); - break; - - case CON_ADDSTRENGTH: - insptr++; - g_sp->extra += *insptr++; - break; - - case CON_STRENGTH: - insptr++; - g_sp->extra = *insptr++; - break; - - case CON_IFGOTWEAPONCE: - insptr++; - - if ((gametype_flags[ud.coop]&GAMETYPE_FLAG_WEAPSTAY) && ud.multimode > 1) - { - if (*insptr == 0) - { - 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) - { - ps[g_p].weaprecs[ps[g_p].weapreccnt++] = g_sp->picnum; - parseifelse(g_sp->owner == g_i); - } - } - else parseifelse(0); - break; - - case CON_GETLASTPAL: - insptr++; - 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; - break; - - case CON_TOSSWEAPON: - insptr++; - checkweapons(&ps[g_sp->yvel]); - break; - - case CON_NULLOP: - insptr++; - break; - - case CON_MIKESND: - insptr++; - 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 (ps[otherp].quick_kick == 0) - ps[otherp].quick_kick = 14; - } - else if (g_sp->picnum != APLAYER && ps[g_p].quick_kick == 0) - ps[g_p].quick_kick = 14; - break; - - case CON_SIZETO: - insptr++; - - 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)) - { - j = ((*insptr)-g_sp->yrepeat)<<1; - if (klabs(j)) g_sp->yrepeat += ksgn(j); - } - insptr++; - - break; - - case CON_SIZEAT: - insptr++; - g_sp->xrepeat = (char) *insptr++; - g_sp->yrepeat = (char) *insptr++; - break; - - case CON_SHOOT: - insptr++; - shoot(g_i,(short)*insptr++); - break; - - case CON_SOUNDONCE: - insptr++; - if (!isspritemakingsound(g_i,*insptr)) - spritesound((short) *insptr,g_i); - insptr++; - break; - - case CON_IFSOUND: - insptr++; - parseifelse(isspritemakingsound(g_i,*insptr)); - // parseifelse(SoundOwner[*insptr][0].i == g_i); - break; - - case CON_STOPSOUND: - 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)) - spritesound((short) *insptr,ps[screenpeek].i); - insptr++; - break; - - case CON_SOUND: - insptr++; - spritesound((short) *insptr++,g_i); - break; - - case CON_TIP: - insptr++; - ps[g_p].tipincs = 26; - break; - - case CON_FALL: - insptr++; - g_sp->xoffset = 0; - g_sp->yoffset = 0; - // if(!gotz) - { - long c; - - if (floorspace(g_sp->sectnum)) - c = 0; - else - { - 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)) - { - getglobalz(g_i); - hittype[g_i].cgg = 6; - } - else hittype[g_i].cgg --; - - 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; - } - else - { - g_sp->z = hittype[g_i].floorz - FOURSLEIGHT; - - if (badguy(g_sp) || (g_sp->picnum == APLAYER && g_sp->owner >= 0)) + // um yeah, this if() will always fire.... + if (j == 0) { + // search around for target player - if (g_sp->zvel > 3084 && g_sp->extra <= 1) + // 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); + break; + + case CON_IFSQUISHED: + parseifelse(ifsquished(g_i, g_p) == 1); + break; + + case CON_IFDEAD: + { + j = g_sp->extra; + if (g_sp->picnum == APLAYER) + j--; + parseifelse(j < 0); + } + break; + + case CON_AI: + insptr++; + g_t[5] = *insptr++; // Ai + g_t[4] = *(long *)(g_t[5]); // Action + 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) + g_sp->ang = TRAND&2047; + break; + + case CON_ACTION: + insptr++; + g_t[2] = 0; + g_t[3] = 0; + g_t[4] = *insptr++; + break; + + case CON_IFPDISTL: + insptr++; + parseifelse(g_x < *insptr); + 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) + hittype[g_i].timetosleep = SLEEPTIME; + break; + + case CON_ELSE: + insptr = (long *) *(insptr+1); + break; + + case CON_ADDSTRENGTH: + insptr++; + g_sp->extra += *insptr++; + break; + + case CON_STRENGTH: + insptr++; + g_sp->extra = *insptr++; + break; + + case CON_IFGOTWEAPONCE: + insptr++; + + if ((gametype_flags[ud.coop]&GAMETYPE_FLAG_WEAPSTAY) && ud.multimode > 1) + { + if (*insptr == 0) + { + 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) + { + ps[g_p].weaprecs[ps[g_p].weapreccnt++] = g_sp->picnum; + parseifelse(g_sp->owner == g_i); + } + } + else parseifelse(0); + break; + + case CON_GETLASTPAL: + insptr++; + 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; + break; + + case CON_TOSSWEAPON: + insptr++; + checkweapons(&ps[g_sp->yvel]); + break; + + case CON_NULLOP: + insptr++; + break; + + case CON_MIKESND: + insptr++; + 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 (ps[otherp].quick_kick == 0) + ps[otherp].quick_kick = 14; + } + else if (g_sp->picnum != APLAYER && ps[g_p].quick_kick == 0) + ps[g_p].quick_kick = 14; + break; + + case CON_SIZETO: + insptr++; + + 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)) + { + j = ((*insptr)-g_sp->yrepeat)<<1; + if (klabs(j)) g_sp->yrepeat += ksgn(j); + } + insptr++; + + break; + + case CON_SIZEAT: + insptr++; + g_sp->xrepeat = (char) *insptr++; + g_sp->yrepeat = (char) *insptr++; + break; + + case CON_SHOOT: + insptr++; + shoot(g_i,(short)*insptr++); + break; + + case CON_SOUNDONCE: + insptr++; + if (!isspritemakingsound(g_i,*insptr)) + spritesound((short) *insptr,g_i); + insptr++; + break; + + case CON_IFSOUND: + insptr++; + parseifelse(isspritemakingsound(g_i,*insptr)); + // parseifelse(SoundOwner[*insptr][0].i == g_i); + break; + + case CON_STOPSOUND: + 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)) + spritesound((short) *insptr,ps[screenpeek].i); + insptr++; + break; + + case CON_SOUND: + insptr++; + spritesound((short) *insptr++,g_i); + break; + + case CON_TIP: + insptr++; + ps[g_p].tipincs = 26; + break; + + case CON_FALL: + insptr++; + g_sp->xoffset = 0; + g_sp->yoffset = 0; + // if(!gotz) + { + long c; + + if (floorspace(g_sp->sectnum)) + c = 0; + else + { + 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)) + { + getglobalz(g_i); + hittype[g_i].cgg = 6; + } + else hittype[g_i].cgg --; + + 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; + } + else + { + g_sp->z = hittype[g_i].floorz - FOURSLEIGHT; + + if (badguy(g_sp) || (g_sp->picnum == APLAYER && g_sp->owner >= 0)) { - if (g_sp->pal != 1 && g_sp->picnum != DRONE) + + if (g_sp->zvel > 3084 && g_sp->extra <= 1) { - if (g_sp->picnum == APLAYER && g_sp->extra > 0) - goto SKIPJIBS; - guts(g_sp,JIBS6,15,g_p); - spritesound(SQUISHED,g_i); - spawn(g_i,BLOODPOOL); - } + if (g_sp->pal != 1 && g_sp->picnum != DRONE) + { + if (g_sp->picnum == APLAYER && g_sp->extra > 0) + goto SKIPJIBS; + guts(g_sp,JIBS6,15,g_p); + spritesound(SQUISHED,g_i); + spawn(g_i,BLOODPOOL); + } SKIPJIBS: - hittype[g_i].picnum = SHOTSPARK1; - hittype[g_i].extra = 1; - g_sp->zvel = 0; - } - else if (g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != 1) - { + hittype[g_i].picnum = SHOTSPARK1; + hittype[g_i].extra = 1; + g_sp->zvel = 0; + } + 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) - changespritesect(g_i,j); + 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) + changespritesect(g_i,j); - spritesound(THUD,g_i); + spritesound(THUD,g_i); + } } + if (sector[g_sp->sectnum].lotag == 1) + switch (dynamictostatic[g_sp->picnum]) + { + case OCTABRAIN__STATIC: + case COMMANDER__STATIC: + case DRONE__STATIC: + break; + default: + g_sp->z += (24<<8); + break; + } + else g_sp->zvel = 0; } - if (sector[g_sp->sectnum].lotag == 1) - switch (dynamictostatic[g_sp->picnum]) - { - case OCTABRAIN__STATIC: - case COMMANDER__STATIC: - case DRONE__STATIC: - break; - default: - g_sp->z += (24<<8); - break; - } - else g_sp->zvel = 0; } - } - break; - - case CON_ENDA: - case CON_BREAK: - case CON_ENDS: - return 1; - case CON_RIGHTBRACE: - insptr++; - return 1; - case CON_ADDAMMO: - 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].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); - else addweapon(&ps[g_p], *insptr); - } - insptr += 2; - break; - case CON_MONEY: - insptr++; - lotsofmoney(g_sp,*insptr++); - break; - - case CON_MAIL: - insptr++; - lotsofmail(g_sp,*insptr++); - break; - - case CON_SLEEPTIME: - insptr++; - hittype[g_i].timetosleep = (short)*insptr++; - break; - - case CON_PAPER: - insptr++; - lotsofpaper(g_sp,*insptr++); - break; - - case CON_ADDKILLS: - insptr++; - ps[g_p].actors_killed += *insptr++; - hittype[g_i].actorstayput = -1; - break; - - case CON_LOTSOFGLASS: - insptr++; - spriteglass(g_i,*insptr++); - break; - - case CON_KILLIT: - insptr++; - killit_flag = 1; - break; - - case CON_ADDWEAPON: - insptr++; - 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]) - { - 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].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); - else addweapon(&ps[g_p], *insptr); - } - insptr+=2; - break; - - case CON_DEBUG: - insptr++; - initprintf("%ld\n",*insptr++); - break; - - case CON_ENDOFGAME: - insptr++; - ps[g_p].timebeforeexit = *insptr++; - ps[g_p].customexitsound = -1; - ud.eog = 1; - break; - - case CON_ADDPHEALTH: - insptr++; - - if (ps[g_p].newowner >= 0) - { - ps[g_p].newowner = -1; - ps[g_p].posx = ps[g_p].oposx; - ps[g_p].posy = ps[g_p].oposy; - ps[g_p].posz = ps[g_p].oposz; - ps[g_p].ang = ps[g_p].oang; - updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum); - setpal(&ps[g_p]); - - j = headspritestat[1]; - while (j >= 0) + case CON_ENDA: + case CON_BREAK: + case CON_ENDS: + return 1; + case CON_RIGHTBRACE: + insptr++; + return 1; + case CON_ADDAMMO: + insptr++; + if (ps[g_p].ammo_amount[*insptr] >= max_ammo_amount[*insptr]) { - if (sprite[j].picnum==CAMERA1) - sprite[j].yvel = 0; - j = nextspritestat[j]; - } - } - - j = sprite[ps[g_p].i].extra; - - if (g_sp->picnum != ATOMICHEALTH) - { - if (j > max_player_health && *insptr > 0) - { - 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].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); + else addweapon(&ps[g_p], *insptr); + } + insptr += 2; + break; + + case CON_MONEY: + insptr++; + lotsofmoney(g_sp,*insptr++); + break; + + case CON_MAIL: + insptr++; + lotsofmail(g_sp,*insptr++); + break; + + case CON_SLEEPTIME: + insptr++; + hittype[g_i].timetosleep = (short)*insptr++; + break; + + case CON_PAPER: + insptr++; + lotsofpaper(g_sp,*insptr++); + break; + + case CON_ADDKILLS: + insptr++; + ps[g_p].actors_killed += *insptr++; + hittype[g_i].actorstayput = -1; + break; + + case CON_LOTSOFGLASS: + insptr++; + spriteglass(g_i,*insptr++); + break; + + case CON_KILLIT: + insptr++; + killit_flag = 1; + break; + + case CON_ADDWEAPON: + insptr++; + 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]) + { + 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].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); + else addweapon(&ps[g_p], *insptr); + } + insptr+=2; + break; + + case CON_DEBUG: + insptr++; + initprintf("%ld\n",*insptr++); + break; + + case CON_ENDOFGAME: + insptr++; + ps[g_p].timebeforeexit = *insptr++; + ps[g_p].customexitsound = -1; + ud.eog = 1; + break; + + case CON_ADDPHEALTH: + insptr++; + + if (ps[g_p].newowner >= 0) + { + ps[g_p].newowner = -1; + ps[g_p].posx = ps[g_p].oposx; + ps[g_p].posy = ps[g_p].oposy; + ps[g_p].posz = ps[g_p].oposz; + ps[g_p].ang = ps[g_p].oang; + updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum); + setpal(&ps[g_p]); + + j = headspritestat[1]; + while (j >= 0) + { + if (sprite[j].picnum==CAMERA1) + sprite[j].yvel = 0; + j = nextspritestat[j]; + } + } + + j = sprite[ps[g_p].i].extra; + + if (g_sp->picnum != ATOMICHEALTH) + { + if (j > max_player_health && *insptr > 0) + { + insptr++; + break; + } + else + { + if (j > 0) + j += *insptr; + if (j > max_player_health && *insptr > 0) + j = max_player_health; + } + } else { if (j > 0) j += *insptr; - if (j > max_player_health && *insptr > 0) - j = max_player_health; + if (j > (max_player_health<<1)) + j = (max_player_health<<1); } - } - else - { - 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 (*insptr > 0) + if (ud.god == 0) { - if ((j - *insptr) < (max_player_health>>2) && - j >= (max_player_health>>2)) - spritesound(DUKE_GOTHEALTHATLOW,ps[g_p].i); + if (*insptr > 0) + { + if ((j - *insptr) < (max_player_health>>2) && + j >= (max_player_health>>2)) + spritesound(DUKE_GOTHEALTHATLOW,ps[g_p].i); - ps[g_p].last_extra = j; + ps[g_p].last_extra = j; + } + + sprite[ps[g_p].i].extra = j; } - sprite[ps[g_p].i].extra = j; - } - - insptr++; - break; - - case CON_STATE: - { - long *tempscrptr; - - tempscrptr = insptr+2; - - insptr = (long *) *(insptr+1); - while (1) if (parse()) break; - insptr = tempscrptr; - } - break; - - case CON_LEFTBRACE: - insptr++; - while (1) if (parse()) break; - break; - - case CON_MOVE: - insptr++; - g_t[0]=0; - g_t[1] = *insptr++; - g_sp->hitag = *insptr++; - 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].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)]) - { - killit_flag = 2; + insptr++; break; + + case CON_STATE: + { + long *tempscrptr; + + tempscrptr = insptr+2; + + insptr = (long *) *(insptr+1); + while (1) if (parse()) break; + insptr = tempscrptr; } - 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)]) { + break; + + case CON_LEFTBRACE: + insptr++; + while (1) if (parse()) break; + break; + + case CON_MOVE: + insptr++; + g_t[0]=0; + g_t[1] = *insptr++; + g_sp->hitag = *insptr++; + 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].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], GetGameVarID(*(insptr),g_i,g_p)); else addweapon(&ps[g_p], GetGameVarID(*(insptr),g_i,g_p)); } - insptr+=2; - break; - - case CON_ACTIVATEBYSECTOR: - case CON_OPERATESECTORS: - 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) - { - 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; - } - break; - } - - case CON_CANSEESPR: - { - long lVar1, lVar2, 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; - } - - case CON_OPERATERESPAWNS: - case CON_OPERATEMASTERSWITCHES: - case CON_CHECKACTIVATORMOTION: - { - 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; - } - break; - } - - case CON_INSERTSPRITEQ: - insptr++; - insertspriteq(g_i); - 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; - } - - 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) - { - j = g_p; - insptr++; - } else j = GetGameVarID(*insptr++, g_i, g_p); - - switch (tw) - { - case CON_GETPNAME: - if (fta_quotes[i] != NULL) + else if (ps[g_p].ammo_amount[GetGameVarID(*(insptr),g_i,g_p)] >= max_ammo_amount[GetGameVarID(*(insptr),g_i,g_p)]) { - 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) - { - /* - if(g_cmddebug&CMDDEBUG_COMPILE) - { - Bsprintf(g_szBuf,"startlevel: Invalid Volume number: %ld. Command ignored.",volnume); - AddLog(g_szBuf); + killit_flag = 2; + break; } - */ - 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) - { - 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; lCheckCase num_volumes || volnume < 0) + { + /* + if(g_cmddebug&CMDDEBUG_COMPILE) + { + Bsprintf(g_szBuf,"startlevel: Invalid Volume number: %ld. Command ignored.",volnume); + AddLog(g_szBuf); + } + */ + 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 { - //AddLog("No Matching Case: No Default to use"); - } + ps[myconnectindex].gm |= MODE_EOL; + display_bonus_screen = 0; + } // MODE_RESTART; + + break; } - insptr=(long*)(lEnd + (long)&script[0]); - //Bsprintf(g_szBuf,"insptr=%ld. ", (long)insptr); - //AddLog(g_szBuf); - //AddLog("Done Processing Switch"); - break; - } - - case CON_ENDSWITCH: - case CON_ENDEVENT: - insptr++; - return 1; - break; - - case CON_DISPLAYRAND: - { - int i; - insptr++; - - i=*insptr++; // ID of def - SetGameVarID(i, rand(), g_i, g_p); - break; - } - - case CON_DRAGPOINT: - { - short wallnum; - long newx, newy; - - insptr++; - wallnum = GetGameVarID(*insptr++, g_i, g_p); - newx = GetGameVarID(*insptr++, g_i, g_p); - newy = GetGameVarID(*insptr++, g_i, g_p); - - dragpoint(wallnum,newx,newy); - break; - } - - case CON_DIST: - case CON_LDIST: - { - long distvar, xvar, yvar, distx=0; - - insptr++; - distvar = *insptr++; - xvar = *insptr++; - yvar = *insptr++; - - switch (tw) + case CON_MYOSX: + case CON_MYOSPALX: + case CON_MYOS: + case CON_MYOSPAL: { - case CON_DIST: - distx = dist(&sprite[GetGameVarID(xvar, g_i, g_p)],&sprite[GetGameVarID(yvar, g_i, g_p)]); - break; - case CON_LDIST: - distx = ldist(&sprite[GetGameVarID(xvar, g_i, g_p)],&sprite[GetGameVarID(yvar, g_i, g_p)]); - break; - } + long x,y; + short tilenum; + signed char shade; + char orientation; + char pal; - SetGameVarID(distvar, distx, g_i, g_p); - break; - } - - case CON_GETINCANGLE: - case CON_GETANGLE: - { - long angvar, xvar, yvar; - short ang; - - insptr++; - angvar = *insptr++; - xvar = *insptr++; - yvar = *insptr++; - if (tw==CON_GETANGLE) - ang = getangle(GetGameVarID(xvar, g_i, g_p),GetGameVarID(yvar, g_i, g_p)); - else ang = getincangle(GetGameVarID(xvar, g_i, g_p),GetGameVarID(yvar, g_i, g_p)); - - SetGameVarID(angvar, ang, g_i, g_p); - break; - } - - case CON_MULSCALE: - { - long var1, var2, var3, var4; - long what; - - insptr++; - var1 = *insptr++; - var2 = GetGameVarID(*insptr++, g_i, g_p); - var3 = GetGameVarID(*insptr++, g_i, g_p); - var4 = GetGameVarID(*insptr++, g_i, g_p); - - what = mulscale(var2, var3, var4); - - SetGameVarID(var1, what, g_i, g_p); - break; - } - - case CON_INITTIMER: - { - short i; - insptr++; - i = GetGameVarID(*insptr++, g_i, g_p); - if (timer != i) - { - uninittimer(); - inittimer(i); - timer = i; - } - break; - } - - case CON_TIME: - { - insptr += 2; - break; - } - - case CON_ESPAWNVAR: - case CON_EQSPAWNVAR: - case CON_QSPAWNVAR: - { - long lIn, lReturn=-1; - - insptr++; - - 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; - - 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; - - 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) - { - 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) - { - 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: - 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; - } - - case CON_SAVEGAMEVAR: - case CON_READGAMEVAR: - { - 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; - } - 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); - 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) + insptr++; + x=GetGameVarID(*insptr++,g_i,g_p); + y=GetGameVarID(*insptr++,g_i,g_p); 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) + 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; + } + 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; + } + break; + } + + case CON_ESPAWN: + case CON_EQSPAWN: + case CON_QSPAWN: + { + 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; + } + break; + } + + case CON_ESHOOT: + case CON_EZSHOOT: + case CON_ZSHOOT: + { + 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; + } + + case CON_SHOOTVAR: + case CON_ESHOOTVAR: + case CON_EZSHOOTVAR: + case CON_ZSHOOTVAR: + { + 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; + } + + case CON_SOUNDVAR: + case CON_STOPSOUNDVAR: + case CON_SOUNDONCEVAR: + case CON_GLOBALSOUNDVAR: + { + 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: + 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; + } + + case CON_SAVEGAMEVAR: + case CON_READGAMEVAR: + { + 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; + } + 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); + 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; } - 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++; - spriteext[g_i].angoff=*insptr++; - break; - - case CON_GETZRANGE: - { - 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); - - 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 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; - } - - case CON_CANSEE: - { - 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; - } - - case CON_ROTATEPOINT: - { - 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; - } - - 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 - - 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; - } - - 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) + 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; + } + + case CON_ANGOFF: + insptr++; + spriteext[g_i].angoff=*insptr++; + break; + + case CON_GETZRANGE: + { + 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); + + 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 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; + } + + case CON_CANSEE: + { + 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; + } + + case CON_ROTATEPOINT: + { + 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; + } + + 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 + + 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; + } + 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); + { + 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; + } 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) - { 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; - - w=sprite[g_i].sectnum; - - 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); - - SetGameVarID(var, w, g_i, g_p); - break; - } - - case CON_SPAWN: - insptr++; - if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) - spawn(g_i,*insptr); - insptr++; - break; - - case CON_IFWASWEAPON: - insptr++; - parseifelse(hittype[g_i].picnum == *insptr); - break; - - case CON_IFAI: - insptr++; - parseifelse(g_t[5] == *insptr); - break; - - case CON_IFACTION: - insptr++; - parseifelse(g_t[4] == *insptr); - break; - - case CON_IFACTIONCOUNT: - insptr++; - parseifelse(g_t[2] >= *insptr); - break; - - case CON_RESETACTIONCOUNT: - insptr++; - g_t[2] = 0; - break; - - case CON_DEBRIS: - { - short dnum; - - 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); - - 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++; - g_t[0] = (short) *insptr++; - break; - - case CON_CSTATOR: - insptr++; - g_sp->cstat |= (short) *insptr++; - break; - - case CON_CLIPDIST: - insptr++; - g_sp->clipdist = (short) *insptr++; - break; - - case CON_CSTAT: - insptr++; - g_sp->cstat = (short) *insptr++; - 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); - - break; - } - - case CON_IFMOVE: - insptr++; - parseifelse(g_t[1] == *insptr); - break; - - case CON_RESETPLAYER: - { - insptr++; - - //AddLog("resetplayer"); - if (ud.multimode < 2) { - if (lastsavedpos >= 0 && ud.recstat != 2) + 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) { - ps[g_p].gm = MODE_MENU; - KB_ClearKeyDown(sc_Space); - cmenu(15000); - } - else ps[g_p].gm = MODE_RESTART; - killit_flag = 2; - } - 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); - break; - - case CON_IFINWATER: - parseifelse(sector[g_sp->sectnum].lotag == 2); - break; - - case CON_IFCOUNT: - insptr++; - parseifelse(g_t[0] >= *insptr); - break; - - case CON_IFACTOR: - insptr++; - parseifelse(g_sp->picnum == *insptr); - break; - - case CON_RESETCOUNT: - insptr++; - g_t[0] = 0; - break; - - case CON_ADDINVENTORY: - insptr+=2; - switch (*(insptr-1)) - { - case GET_STEROIDS: - ps[g_p].steroids_amount = *insptr; - ps[g_p].inven_icon = 2; - break; - - case GET_SHIELD: - ps[g_p].shield_amount += *insptr;// 100; - if (ps[g_p].shield_amount > max_player_health) - ps[g_p].shield_amount = max_player_health; - break; - - case GET_SCUBA: - ps[g_p].scuba_amount = *insptr;// 1600; - ps[g_p].inven_icon = 6; - break; - - case GET_HOLODUKE: - ps[g_p].holoduke_amount = *insptr;// 1600; - ps[g_p].inven_icon = 3; - break; - - case GET_JETPACK: - ps[g_p].jetpack_amount = *insptr;// 1600; - ps[g_p].inven_icon = 4; - break; - - case GET_ACCESS: - 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 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 GET_HEATS: - ps[g_p].heat_amount = *insptr; - ps[g_p].inven_icon = 5; - break; + case CON_UPDATESECTOR: + case CON_UPDATESECTORZ: + { + long x,y,z=0; + int var; + short w; - case GET_FIRSTAID: - ps[g_p].inven_icon = 1; - ps[g_p].firstaid_amount = *insptr; - break; + w=sprite[g_i].sectnum; - case GET_BOOTS: - ps[g_p].inven_icon = 7; - ps[g_p].boot_amount = *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++; + + 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; } - insptr++; - break; - case CON_HITRADIUS: - hitradius(g_i,*(insptr+1),*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5)); - insptr+=6; - break; + case CON_SPAWN: + insptr++; + if (g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) + spawn(g_i,*insptr); + insptr++; + break; - case CON_IFP: - { - insptr++; + case CON_IFWASWEAPON: + insptr++; + parseifelse(hittype[g_i].picnum == *insptr); + break; - l = *insptr; - j = 0; + case CON_IFAI: + insptr++; + parseifelse(g_t[5] == *insptr); + break; - s = sprite[ps[g_p].i].xvel; + case CON_IFACTION: + insptr++; + parseifelse(g_t[4] == *insptr); + break; - 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)) + case CON_IFACTIONCOUNT: + insptr++; + parseifelse(g_t[2] >= *insptr); + break; + + case CON_RESETACTIONCOUNT: + insptr++; + g_t[2] = 0; + break; + + case CON_DEBRIS: { - 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)); + short dnum; + + 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); + + 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++; + g_t[0] = (short) *insptr++; + break; + + case CON_CSTATOR: + insptr++; + g_sp->cstat |= (short) *insptr++; + break; + + case CON_CLIPDIST: + insptr++; + g_sp->clipdist = (short) *insptr++; + break; + + case CON_CSTAT: + insptr++; + g_sp->cstat = (short) *insptr++; + 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); + + break; + } + + case CON_IFMOVE: + insptr++; + parseifelse(g_t[1] == *insptr); + break; + + case CON_RESETPLAYER: + { + insptr++; + + //AddLog("resetplayer"); + if (ud.multimode < 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; + } else - j = getincangle(ps[g_p].ang,getangle(g_sp->x-ps[g_p].posx,g_sp->y-ps[g_p].posy)); + { + 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; - if (j > -128 && j < 128) + 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); + break; + + case CON_IFINWATER: + parseifelse(sector[g_sp->sectnum].lotag == 2); + break; + + case CON_IFCOUNT: + insptr++; + parseifelse(g_t[0] >= *insptr); + break; + + case CON_IFACTOR: + insptr++; + parseifelse(g_sp->picnum == *insptr); + break; + + case CON_RESETCOUNT: + insptr++; + g_t[0] = 0; + break; + + case CON_ADDINVENTORY: + insptr+=2; + switch (*(insptr-1)) + { + case GET_STEROIDS: + ps[g_p].steroids_amount = *insptr; + ps[g_p].inven_icon = 2; + break; + + case GET_SHIELD: + ps[g_p].shield_amount += *insptr;// 100; + if (ps[g_p].shield_amount > max_player_health) + ps[g_p].shield_amount = max_player_health; + break; + + case GET_SCUBA: + ps[g_p].scuba_amount = *insptr;// 1600; + ps[g_p].inven_icon = 6; + break; + + case GET_HOLODUKE: + ps[g_p].holoduke_amount = *insptr;// 1600; + ps[g_p].inven_icon = 3; + break; + + case GET_JETPACK: + ps[g_p].jetpack_amount = *insptr;// 1600; + ps[g_p].inven_icon = 4; + break; + + case GET_ACCESS: + 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; + } + break; + + case GET_HEATS: + ps[g_p].heat_amount = *insptr; + ps[g_p].inven_icon = 5; + break; + + case GET_FIRSTAID: + ps[g_p].inven_icon = 1; + ps[g_p].firstaid_amount = *insptr; + break; + + case GET_BOOTS: + ps[g_p].inven_icon = 7; + ps[g_p].boot_amount = *insptr; + break; + } + insptr++; + break; + + case CON_HITRADIUS: + hitradius(g_i,*(insptr+1),*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5)); + insptr+=6; + 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 - j = 0; + 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); } - parseifelse((long) j); - } - break; - - case CON_IFSTRENGTH: - insptr++; - parseifelse(g_sp->extra <= *insptr); break; - case CON_GUTS: - insptr += 2; - guts(g_sp,*(insptr-1),*insptr,g_p); - insptr++; - break; + case CON_IFSTRENGTH: + insptr++; + parseifelse(g_sp->extra <= *insptr); + break; - case CON_IFSPAWNEDBY: - insptr++; - parseifelse(hittype[g_i].picnum == *insptr); - break; + case CON_GUTS: + insptr += 2; + guts(g_sp,*(insptr-1),*insptr,g_p); + insptr++; + break; - case CON_WACKPLAYER: - insptr++; - forceplayerangle(&ps[g_p]); - return 0; + case CON_IFSPAWNEDBY: + insptr++; + parseifelse(hittype[g_i].picnum == *insptr); + break; - case CON_FLASH: - insptr++; - sprite[g_i].shade = -127; - ps[g_p].visibility = -127; - lastvisinc = totalclock+32; - return 0; + case CON_WACKPLAYER: + insptr++; + forceplayerangle(&ps[g_p]); + return 0; - case CON_STOPALLSOUNDS: - insptr++; - if (screenpeek == g_p) - FX_StopAllSounds(); - return 0; + case CON_FLASH: + insptr++; + sprite[g_i].shade = -127; + ps[g_p].visibility = -127; + lastvisinc = totalclock+32; + return 0; - case CON_IFGAPZL: - insptr++; - parseifelse(((hittype[g_i].floorz - hittype[g_i].ceilingz) >> 8) < *insptr); - break; + case CON_STOPALLSOUNDS: + insptr++; + if (screenpeek == g_p) + FX_StopAllSounds(); + return 0; - case CON_IFHITSPACE: - parseifelse(sync[g_p].bits&(1<<29)); - break; + case CON_IFGAPZL: + insptr++; + parseifelse(((hittype[g_i].floorz - hittype[g_i].ceilingz) >> 8) < *insptr); + break; - case CON_IFOUTSIDE: - parseifelse(sector[g_sp->sectnum].ceilingstat&1); - break; + case CON_IFHITSPACE: + parseifelse(sync[g_p].bits&(1<<29)); + break; - case CON_IFMULTIPLAYER: - parseifelse(ud.multimode > 1); - break; + case CON_IFOUTSIDE: + parseifelse(sector[g_sp->sectnum].ceilingstat&1); + break; - case CON_OPERATE: - insptr++; - 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) - { - j = headspritesect[neartagsector]; - while (j >= 0) + case CON_IFMULTIPLAYER: + parseifelse(ud.multimode > 1); + break; + + case CON_OPERATE: + insptr++; + 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 (sprite[j].picnum == ACTIVATOR) - break; - j = nextspritesect[j]; + j = headspritesect[neartagsector]; + while (j >= 0) + { + if (sprite[j].picnum == ACTIVATOR) + break; + j = nextspritesect[j]; + } + if (j == -1) + operatesectors(neartagsector,g_i); } - if (j == -1) - operatesectors(neartagsector,g_i); - } - } - break; - - case CON_IFINSPACE: - parseifelse(ceilingspace(g_sp->sectnum)); - break; - - case CON_SPRITEPAL: - insptr++; - if (g_sp->picnum != APLAYER) - hittype[g_i].tempang = g_sp->pal; - g_sp->pal = *insptr++; - break; - - case CON_CACTOR: - insptr++; - g_sp->picnum = *insptr++; - break; - - case CON_IFBULLETNEAR: - parseifelse(dodge(g_sp) == 1); - break; - - case CON_IFRESPAWN: - if (badguy(g_sp)) - parseifelse(ud.respawn_monsters); - else if (inventory(g_sp)) - parseifelse(ud.respawn_inventory); - else - parseifelse(ud.respawn_items); - break; - - case CON_IFFLOORDISTL: - insptr++; - parseifelse((hittype[g_i].floorz - g_sp->z) <= ((*insptr)<<8)); - break; - - case CON_IFCEILINGDISTL: - insptr++; - parseifelse((g_sp->z - hittype[g_i].ceilingz) <= ((*insptr)<<8)); - break; - - case CON_PALFROM: - insptr++; - ps[g_p].pals_time = *insptr++; - 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) - { - 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; - } - - 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) - { - if (*insptr==MAXGAMEVARS) // addlogvar for a constant? Har. - insptr++; - else if (*insptr&(MAXGAMEVARS<<1)) - { - m = -1; - lVarID ^= (MAXGAMEVARS<<1); - goto good; } - // invalid varID + break; + + case CON_IFINSPACE: + parseifelse(ceilingspace(g_sp->sectnum)); + break; + + case CON_SPRITEPAL: insptr++; - Bsprintf(g_szBuf,"CONLOGVAR: L=%ld INVALID VARIABLE",l); + if (g_sp->picnum != APLAYER) + hittype[g_i].tempang = g_sp->pal; + g_sp->pal = *insptr++; + break; + + case CON_CACTOR: + insptr++; + g_sp->picnum = *insptr++; + break; + + case CON_IFBULLETNEAR: + parseifelse(dodge(g_sp) == 1); + break; + + case CON_IFRESPAWN: + if (badguy(g_sp)) + parseifelse(ud.respawn_monsters); + else if (inventory(g_sp)) + parseifelse(ud.respawn_inventory); + else + parseifelse(ud.respawn_items); + break; + + case CON_IFFLOORDISTL: + insptr++; + parseifelse((hittype[g_i].floorz - g_sp->z) <= ((*insptr)<<8)); + break; + + case CON_IFCEILINGDISTL: + insptr++; + parseifelse((g_sp->z - hittype[g_i].ceilingz) <= ((*insptr)<<8)); + break; + + case CON_PALFROM: + insptr++; + ps[g_p].pals_time = *insptr++; + 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) + { + 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; // out of switch + 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) + { + if (*insptr==MAXGAMEVARS) // addlogvar for a constant? Har. + insptr++; + else if (*insptr&(MAXGAMEVARS<<1)) + { + m = -1; + lVarID ^= (MAXGAMEVARS<<1); + goto good; + } + // invalid varID + 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); + 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)"); + 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; } - if (aGameVars[lVarID].dwFlags & GAMEVAR_FLAG_PERPLAYER) + + case CON_SETSECTOR: + case CON_GETSECTOR: { - Bsprintf(szBuf," (Per Player. Player=%d)",g_p); + // 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; } - else if (aGameVars[lVarID].dwFlags & GAMEVAR_FLAG_PERACTOR) + + case CON_SQRT: { - Bsprintf(szBuf," (Per Actor. Actor=%d)",g_i); + // syntax sqrt + + 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; } - else + + case CON_FINDNEARACTOR: + case CON_FINDNEARSPRITE: + case CON_FINDNEARACTOR3D: + case CON_FINDNEARSPRITE3D: { - 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; - } + // 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; - case CON_SETSECTOR: - case CON_GETSECTOR: - { - // syntax [gs]etsector[].x - // - long lLabelID; - long lVar1, lVar2; + insptr++; - insptr++; - lVar1=*insptr++; - lLabelID=*insptr++; - lVar2=*insptr++; - DoSector(tw==CON_SETSECTOR, lVar1, lLabelID, lVar2, g_i, g_p); - break; - } + lType=*insptr++; + lMaxDist=*insptr++; + lVarID=*insptr++; - case CON_SQRT: - { - // syntax sqrt + lFound=-1; - 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; - } - - 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=0) + for (k=0;k=0) { - 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 (sprite[j].picnum == lType && j != g_i) { - lFound=j; - j = MAXSPRITES; - break; - } - } - j = nextspritestat[j]; - } - 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=0) - { - 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) - { - 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) + 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; } } + j = nextspritestat[j]; } - j = nextspritestat[j]; + if ((tw==CON_FINDNEARACTOR||tw==CON_FINDNEARACTOR3D) || j == MAXSPRITES) + break; } - if (tw==CON_FINDNEARACTORZVAR || j == MAXSPRITES) - break; + SetGameVarID(lVarID, lFound, g_i, g_p); + break; } - SetGameVarID(lVarID, lFound, g_i, g_p); - 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=0) + // 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=0) { - lTemp=ldist(&sprite[g_i], &sprite[j]); - if (lTemp < lMaxDist) + if (sprite[j].picnum == lType && j != g_i) { - lTemp2=klabs(sprite[g_i].z-sprite[j].z); - if (lTemp2 < lMaxZDist) + 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]; } - j = nextspritestat[j]; + if ((tw==CON_FINDNEARACTORVAR||tw==CON_FINDNEARACTOR3DVAR) || j == MAXSPRITES) + 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; - - insptr++; - var1 = *insptr++; - - 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); - - 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) - { - 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; + SetGameVarID(lVarID, lFound, g_i, g_p); 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; - - insptr++; - lVar1=*insptr++; - lLabelID=*insptr++; - - lVar2=*insptr++; - - 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; - - insptr++; - lLabelID=*insptr++; - lVar2=*insptr++; - - 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; - - insptr++; - lVar1=GetGameVarID(*insptr++, g_i, g_p); - lLabelID=*insptr++; - lVar2=*insptr++; - DoProjectile(tw==CON_SETPROJECTILE,lVar1,lLabelID,lVar2,g_i,g_p); - - break; - } - - case CON_SETWALL: - case CON_GETWALL: - { - // syntax [gs]etwall[].x - // - long lLabelID; - long lVar1, lVar2; - - insptr++; - lVar1=*insptr++; - lLabelID=*insptr++; - lVar2=*insptr++; - - 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) + 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; + } + + 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=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_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; + + insptr++; + var1 = *insptr++; + + 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); + + 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) + { + 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; + + insptr++; + lVar1=*insptr++; + lLabelID=*insptr++; + + lVar2=*insptr++; + + 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; + + insptr++; + lLabelID=*insptr++; + lVar2=*insptr++; + + 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; + + insptr++; + lVar1=GetGameVarID(*insptr++, g_i, g_p); + lLabelID=*insptr++; + lVar2=*insptr++; + DoProjectile(tw==CON_SETPROJECTILE,lVar1,lLabelID,lVar2,g_i,g_p); + + break; + } + + case CON_SETWALL: + case CON_GETWALL: + { + // syntax [gs]etwall[].x + // + long lLabelID; + long lVar1, lVar2; + + insptr++; + lVar1=*insptr++; + lLabelID=*insptr++; + lVar2=*insptr++; + + DoWall(tw==CON_SETWALL, lVar1, lLabelID, lVar2, 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); + { + // 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; + } 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) - { 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) { - case ACTOR_HTG_T: - lParm2=GetGameVarID(*insptr++, g_i, g_p); - break; - default: - lParm2=0; - break; - } - lVar2=*insptr++; + // syntax [gs]etactorvar[]. + // gets the value of the per-actor variable varx into VAR + // + long lVar1, lVar2, lVar3; + long lTemp,lSprite; - DoActor(tw==CON_SETACTOR, lVar1, lLabelID, lVar2, g_i, g_p, lParm2); - break; - } - - case CON_GETANGLETOTARGET: - { - int i; - short ang; - - 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; - } - - case CON_ANGOFFVAR: - { - 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; - } - - case CON_CHECKAVAILWEAPON: - case CON_CHECKAVAILINVEN: - { - int i; - - insptr++; - - if (*insptr == g_iThisActorID) - { - i = g_p; 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; + } + break; } - else - i=GetGameVarID(*insptr++, g_i, g_p); - if (i < MAXPLAYERS) + + case CON_SETACTOR: + case CON_GETACTOR: { - if (tw == CON_CHECKAVAILWEAPON) - checkavailweapon(&ps[i]); - else checkavailinven(&ps[i]); - } - break; - } + // syntax [gs]etactor[].x + // + long lLabelID; + long lVar1, lVar2; + long lParm2; - case CON_GETPLAYERANGLE: - { - 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; - } - - case CON_GETACTORANGLE: - { - 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; - } - - case CON_SETVAR: - { - 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; - } - - case CON_RANDVAR: - { - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - case CON_DISPLAYRANDVARVAR: - { - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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) - { - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - case CON_SPGETLOTAG: - { - 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; - } - - case CON_SECTGETLOTAG: - { - 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; - } - - case CON_GETTEXTUREFLOOR: - { - 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; - } - - case CON_GETTEXTURECEILING: - { - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - 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; - } - - case CON_WHILEVARN: - { - int i; - long *savedinsptr; - savedinsptr=insptr; - j=1; - while (j) - { - insptr=savedinsptr; insptr++; - i=*insptr++; // ID of def + 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); + break; + } + + case CON_GETANGLETOTARGET: + { + int i; + short ang; + + 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; + } + + case CON_ANGOFFVAR: + { + 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; + } + + case CON_CHECKAVAILWEAPON: + case CON_CHECKAVAILINVEN: + { + int i; + + 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; + } + + case CON_GETPLAYERANGLE: + { + 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; + } + + case CON_GETACTORANGLE: + { + 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; + } + + case CON_SETVAR: + { + 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; + } + + case CON_RANDVAR: + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + case CON_DISPLAYRANDVARVAR: + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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) + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + case CON_SPGETLOTAG: + { + 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; + } + + case CON_SECTGETLOTAG: + { + 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; + } + + case CON_GETTEXTUREFLOOR: + { + 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; + } + + case CON_GETTEXTURECEILING: + { + 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; + } + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; + } + + 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; } - break; - } - case CON_WHILEVARVARN: - { - int i,k; - long *savedinsptr; - savedinsptr=insptr; - j=1; - while (j) + case CON_WHILEVARN: { - insptr=savedinsptr; - insptr++; - i=*insptr++; // ID of def - k=*(insptr); // ID of def - j=0; + int i; + long *savedinsptr; + savedinsptr=insptr; + j=1; + while (j) + { + insptr=savedinsptr; + insptr++; + i=*insptr++; // ID of def + j=0; - if (GetGameVarID(i, g_i, g_p) != GetGameVarID(k, g_i, g_p)) + 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) + { + 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; + } + + 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; + } + + 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; + } + + 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; + } + + case CON_IFPHEALTHL: + insptr++; + parseifelse(sprite[ps[g_p].i].extra < *insptr); + break; + + case CON_IFPINVENTORY: + { + insptr++; + j = 0; + switch (*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 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)) + { + int i; + for (i=0;isectnum; + + 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) + 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; - } - - 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; - } - - 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; - } - - case CON_IFPHEALTHL: - insptr++; - parseifelse(sprite[ps[g_p].i].extra < *insptr); - break; - - case CON_IFPINVENTORY: - { - insptr++; - j = 0; - switch (*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 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)) - { - int i; - for (i=0;isectnum; - - 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) - j = 1; - } - } - } - parseifelse(j); - } - break; - - case CON_QUOTE: - insptr++; - if (fta_quotes[*insptr] != NULL) - FTA(*insptr++,&ps[g_p]); - else { - OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,*insptr); + case CON_QUOTE: insptr++; - } - break; - - case CON_USERQUOTE: - insptr++; - if (fta_quotes[*insptr] != NULL) - adduserquote(fta_quotes[*insptr++]); - else { - OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,*insptr); - insptr++; - } - break; - - case CON_IFINOUTERSPACE: - parseifelse(floorspace(g_sp->sectnum)); - break; - - case CON_IFNOTMOVING: - parseifelse((hittype[g_i].movflag&49152) > 16384); - break; - - case CON_RESPAWNHITAG: - insptr++; - switch (dynamictostatic[g_sp->picnum]) - { - case FEM1__STATIC: - case FEM2__STATIC: - case FEM3__STATIC: - case FEM4__STATIC: - case FEM5__STATIC: - case FEM6__STATIC: - case FEM7__STATIC: - case FEM8__STATIC: - case FEM9__STATIC: - case FEM10__STATIC: - case PODFEM1__STATIC: - case NAKED1__STATIC: - case STATUE__STATIC: - if (g_sp->yvel) operaterespawns(g_sp->yvel); + if (fta_quotes[*insptr] != NULL) + FTA(*insptr++,&ps[g_p]); + else + { + OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,*insptr); + insptr++; + } break; + + case CON_USERQUOTE: + insptr++; + if (fta_quotes[*insptr] != NULL) + adduserquote(fta_quotes[*insptr++]); + else + { + OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,*insptr); + insptr++; + } + break; + + case CON_IFINOUTERSPACE: + parseifelse(floorspace(g_sp->sectnum)); + break; + + case CON_IFNOTMOVING: + parseifelse((hittype[g_i].movflag&49152) > 16384); + break; + + case CON_RESPAWNHITAG: + insptr++; + switch (dynamictostatic[g_sp->picnum]) + { + case FEM1__STATIC: + case FEM2__STATIC: + case FEM3__STATIC: + case FEM4__STATIC: + case FEM5__STATIC: + case FEM6__STATIC: + case FEM7__STATIC: + case FEM8__STATIC: + case FEM9__STATIC: + case FEM10__STATIC: + case PODFEM1__STATIC: + case NAKED1__STATIC: + case STATUE__STATIC: + if (g_sp->yvel) operaterespawns(g_sp->yvel); + break; + default: + if (g_sp->hitag >= 0) operaterespawns(g_sp->hitag); + break; + } + break; + + case CON_IFSPRITEPAL: + insptr++; + parseifelse(g_sp->pal == *insptr); + break; + + case CON_IFANGDIFFL: + insptr++; + j = klabs(getincangle(ps[g_p].ang,g_sp->ang)); + parseifelse(j <= *insptr); + break; + + case CON_IFNOSOUNDS: + for (j=1;jhitag >= 0) operaterespawns(g_sp->hitag); + OSD_Printf("fatal error: default processing: %ld, %ld\ncurrent actor: %d (%d)\n",*insptr,*(insptr-1),g_i,g_sp->picnum); + gameexit("An error has occurred in the EDuke32 CON executor.\n\nPlease mail all of your CON files along with the file eduke32.log\nto terminx@gmail.com.\n\nThank you."); break; - } - break; - - case CON_IFSPRITEPAL: - insptr++; - parseifelse(g_sp->pal == *insptr); - break; - - case CON_IFANGDIFFL: - insptr++; - j = klabs(getincangle(ps[g_p].ang,g_sp->ang)); - parseifelse(j <= *insptr); - break; - - case CON_IFNOSOUNDS: - for (j=1;jpicnum); - gameexit("An error has occurred in the EDuke32 CON executor.\n\nPlease mail all of your CON files along with the file eduke32.log\nto terminx@gmail.com.\n\nThank you."); - break; } return 0; } @@ -6985,22 +7021,22 @@ void execute(short sActor,short sPlayer,long lDist) else if (g_sp->statnum == 6) switch (dynamictostatic[g_sp->picnum]) { - case RUBBERCAN__STATIC: - case EXPLODINGBARREL__STATIC: - case WOODENHORSE__STATIC: - case HORSEONSIDE__STATIC: - case CANWITHSOMETHING__STATIC: - case FIREBARREL__STATIC: - case NUKEBARREL__STATIC: - case NUKEBARRELDENTED__STATIC: - case NUKEBARRELLEAKED__STATIC: - case TRIPBOMB__STATIC: - case EGG__STATIC: - if (hittype[g_i].timetosleep > 1) - hittype[g_i].timetosleep--; - else if (hittype[g_i].timetosleep == 1) - changespritestat(g_i,2); - break; + case RUBBERCAN__STATIC: + case EXPLODINGBARREL__STATIC: + case WOODENHORSE__STATIC: + case HORSEONSIDE__STATIC: + case CANWITHSOMETHING__STATIC: + case FIREBARREL__STATIC: + case NUKEBARREL__STATIC: + case NUKEBARRELDENTED__STATIC: + case NUKEBARRELLEAKED__STATIC: + case TRIPBOMB__STATIC: + case EGG__STATIC: + if (hittype[g_i].timetosleep > 1) + hittype[g_i].timetosleep--; + 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 d9ead7d2e..8806f0277 100755 --- a/polymer/eduke32/source/grpscan.c +++ b/polymer/eduke32/source/grpscan.c @@ -8,26 +8,30 @@ #include "duke3d.h" #include "grpscan.h" -struct grpfile grpfiles[numgrpfiles] = { - { "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 }, - { "Duke Nukem 3D Mac Shareware Version", 0xC5F71561, 10444391, GAMEDUKE, NULL }, - { "Duke Nukem 3D Mac", 0x00000000, 0, GAMEDUKE, NULL }, - { "NAM", 0x75C1F07B, 43448927, GAMENAM, NULL }, - }; +struct grpfile grpfiles[numgrpfiles] = + { + { "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 }, + { "Duke Nukem 3D Mac Shareware Version", 0xC5F71561, 10444391, GAMEDUKE, NULL }, + { "Duke Nukem 3D Mac", 0x00000000, 0, GAMEDUKE, NULL }, + { "NAM", 0x75C1F07B, 43448927, GAMENAM, NULL }, + }; struct grpfile *foundgrps = NULL; #define GRPCACHEFILE "grpfiles.cache" -static struct grpcache { +static struct grpcache +{ struct grpcache *next; char name[BMAX_PATH+1]; int size; int mtime; int crcval; -} *grpcache = NULL, *usedgrpcache = NULL; +} +*grpcache = NULL, *usedgrpcache = NULL; static int LoadGroupsCache(void) { @@ -41,7 +45,8 @@ static int LoadGroupsCache(void) script = scriptfile_fromfile(GRPCACHEFILE); if (!script) return -1; - while (!scriptfile_eof(script)) { + while (!scriptfile_eof(script)) + { if (scriptfile_getstring(script, &fname)) break; // filename if (scriptfile_getnumber(script, &fsize)) break; // filesize if (scriptfile_getnumber(script, &fmtime)) break; // modification time @@ -65,7 +70,8 @@ static void FreeGroupsCache(void) { struct grpcache *fg; - while (grpcache) { + while (grpcache) + { fg = grpcache->next; free(grpcache); grpcache = fg; @@ -86,16 +92,24 @@ int ScanGroups(void) srch = klistpath("/", "*.grp", CACHE1D_FIND_FILE); - for (sidx = srch; sidx; sidx = sidx->next) { - for (fg = grpcache; fg; fg = fg->next) { + for (sidx = srch; sidx; sidx = sidx->next) + { + for (fg = grpcache; fg; fg = fg->next) + { if (!Bstrcmp(fg->name, sidx->name)) break; } - if (fg) { + if (fg) + { if (findfrompath(sidx->name, &fn)) continue; // failed to resolve the filename - if (Bstat(fn, &st)) { free(fn); continue; } // failed to stat the file + if (Bstat(fn, &st)) + { + free(fn); + continue; + } // failed to stat the file free(fn); - if (fg->size == st.st_size && fg->mtime == st.st_mtime) { + if (fg->size == st.st_size && fg->mtime == st.st_mtime) + { grp = (struct grpfile *)calloc(1, sizeof(struct grpfile)); grp->name = strdup(sidx->name); grp->crcval = fg->crcval; @@ -125,10 +139,12 @@ int ScanGroups(void) initprintf(" Checksumming %s...", sidx->name); crc32init((unsigned long *)&crcval); - do { + do + { b = read(fh, buf, sizeof(buf)); if (b > 0) crc32block((unsigned long *)&crcval, buf, b); - } while (b == sizeof(buf)); + } + while (b == sizeof(buf)); crc32finish((unsigned long *)&crcval); close(fh); initprintf(" Done\n"); @@ -153,11 +169,14 @@ int ScanGroups(void) klistfree(srch); FreeGroupsCache(); - if (usedgrpcache) { + if (usedgrpcache) + { FILE *fp; fp = fopen(GRPCACHEFILE, "wt"); - if (fp) { - for (fg = usedgrpcache; fg; fg=fgg) { + if (fp) + { + for (fg = usedgrpcache; fg; fg=fgg) + { fgg = fg->next; fprintf(fp, "\"%s\" %d %d %d\n", fg->name, fg->size, fg->mtime, fg->crcval); free(fg); @@ -173,7 +192,8 @@ void FreeGroups(void) { struct grpfile *fg; - while (foundgrps) { + while (foundgrps) + { fg = foundgrps->next; free((char*)foundgrps->name); free(foundgrps); diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index f7f99471b..3e72758e3 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -41,9 +41,15 @@ static int currentlist=0; static int function, whichkey; static int changesmade, newvidmode, curvidmode, newfullscreen; -static int vidsets[16] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }, curvidset, newvidset = 0; +static int vidsets[16] = + { + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 + } + , curvidset, newvidset = 0; -static char *mousebuttonnames[] = { "Left", "Right", "Middle", "Thumb", "Wheel Down", "Wheel Up" }; +static char *mousebuttonnames[] = + { "Left", "Right", "Middle", "Thumb", "Wheel Down", "Wheel Up" + }; extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting; @@ -190,8 +196,14 @@ static int probe_(int type,int x,int y,int i,int n) else return(-probey-2); } } -int probe(int x,int y,int i,int n) { return probe_(0,x,y,i,n); } -int probesm(int x,int y,int i,int n) { return probe_(1,x,y,i,n); } +int probe(int x,int y,int i,int n) +{ + return probe_(0,x,y,i,n); +} +int probesm(int x,int y,int i,int n) +{ + return probe_(1,x,y,i,n); +} int menutext_(int x,int y,short s,short p,char *t) { @@ -220,34 +232,34 @@ int menutext_(int x,int y,short s,short p,char *t) ac = *(t+i) - 'A' + BIGALPHANUM; else switch (*(t+i)) { - case '-': - ac = BIGALPHANUM-11; - break; - case '.': - ac = BIGPERIOD; - break; - case '\'': - ac = BIGAPPOS; - break; - case ',': - ac = BIGCOMMA; - break; - case '!': - ac = BIGX; - break; - case '?': - ac = BIGQ; - break; - case ';': - ac = BIGSEMI; - break; - case ':': - ac = BIGSEMI; - break; - default: - centre += 5; - i++; - continue; + case '-': + ac = BIGALPHANUM-11; + break; + case '.': + ac = BIGPERIOD; + break; + case '\'': + ac = BIGAPPOS; + break; + case ',': + ac = BIGCOMMA; + break; + case '!': + ac = BIGX; + break; + case '?': + ac = BIGQ; + break; + case ';': + ac = BIGSEMI; + break; + case ':': + ac = BIGSEMI; + break; + default: + centre += 5; + i++; + continue; } centre += tilesizx[ac]-1; @@ -260,7 +272,12 @@ int menutext_(int x,int y,short s,short p,char *t) while (*t) { - if (*t == ' ') {x+=5;t++;continue;} + if (*t == ' ') + { + x+=5; + t++; + continue; + } ac = 0; if (*t >= '0' && *t <= '9') ac = *t - '0' + BIGALPHANUM-10; @@ -270,34 +287,34 @@ int menutext_(int x,int y,short s,short p,char *t) ac = *t - 'A' + BIGALPHANUM; else switch (*t) { - case '-': - ac = BIGALPHANUM-11; - break; - case '.': - ac = BIGPERIOD; - break; - case ',': - ac = BIGCOMMA; - break; - case '!': - ac = BIGX; - break; - case '\'': - ac = BIGAPPOS; - break; - case '?': - ac = BIGQ; - break; - case ';': - ac = BIGSEMI; - break; - case ':': - ac = BIGCOLIN; - break; - default: - x += 5; - t++; - continue; + case '-': + ac = BIGALPHANUM-11; + break; + case '.': + ac = BIGPERIOD; + break; + case ',': + ac = BIGCOMMA; + break; + case '!': + ac = BIGX; + break; + case '\'': + ac = BIGAPPOS; + break; + case '?': + ac = BIGQ; + break; + case ';': + ac = BIGSEMI; + break; + case ':': + ac = BIGCOLIN; + break; + default: + x += 5; + t++; + continue; } rotatesprite(x<<16,y<<16,65536L,0,ac,s,p,10+16,0,0,xdim-1,ydim-1); @@ -318,7 +335,11 @@ 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; @@ -381,14 +402,24 @@ static void bar_(int type, int x,int y,short *p,short dainc,char damodify,short 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); } -void bar(int x,int y,short *p,short dainc,char damodify,short s, short pa) { bar_(0,x,y,p,dainc,damodify,s,pa); } -void barsm(int x,int y,short *p,short dainc,char damodify,short s, short pa) { bar_(1,x,y,p,dainc,damodify,s,pa); } +void bar(int x,int y,short *p,short dainc,char damodify,short s, short pa) +{ + bar_(0,x,y,p,dainc,damodify,s,pa); +} +void barsm(int x,int y,short *p,short dainc,char damodify,short s, short pa) +{ + bar_(1,x,y,p,dainc,damodify,s,pa); +} 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) @@ -508,8 +539,10 @@ 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]) { + for (i=0;i<(signed)(sizeof(disallowed)/sizeof(disallowed[0]));i++) + { + while (*color == disallowed[i]) + { if (*color > prev_color) (*color)++; else (*color)--; @@ -601,714 +634,1174 @@ void menus(void) 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); + 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 (ud.multimode < 2 && ud.recstat != 2) + x = probe(186,124,0,0); + if (x >= -1) { - ready2send = 1; - totalclock = ototalclock; - } - ps[myconnectindex].gm &= ~MODE_MENU; - } - break; - - case 20000: - x = probe(326,190,0,0); - gametext(160,50-8,"YOU ARE PLAYING THE SHAREWARE",0,2+8+16); - gametext(160,59-8,"VERSION OF DUKE NUKEM 3D. WHILE",0,2+8+16); - gametext(160,68-8,"THIS VERSION IS REALLY COOL, YOU",0,2+8+16); - gametext(160,77-8,"ARE MISSING OVER 75%% OF THE TOTAL",0,2+8+16); - gametext(160,86-8,"GAME, ALONG WITH OTHER GREAT EXTRAS",0,2+8+16); - gametext(160,95-8,"AND GAMES, WHICH YOU'LL GET WHEN",0,2+8+16); - gametext(160,104-8,"YOU ORDER THE COMPLETE VERSION AND",0,2+8+16); - gametext(160,113-8,"GET THE FINAL TWO EPISODES.",0,2+8+16); - - gametext(160,113+8,"PLEASE READ THE 'HOW TO ORDER' ITEM",0,2+8+16); - gametext(160,122+8,"ON THE MAIN MENU IF YOU WISH TO",0,2+8+16); - gametext(160,131+8,"UPGRADE TO THE FULL REGISTERED",0,2+8+16); - 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); - break; - - case 20001: - rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(160,24,0,0,"NETWORK GAME"); - - x = probe(160,100-18,18,3); - - if (x == -1) cmenu(0); - else if (x == 2) cmenu(20010); - else if (x == 1) cmenu(20020); - else if (x == 0) cmenu(20002); - - menutext(160,100-18,MENUHIGHLIGHT(0),0,"PLAYER SETUP"); - menutext(160,100,MENUHIGHLIGHT(1),0,"JOIN GAME"); - menutext(160,100+18,MENUHIGHLIGHT(2),0,"HOST GAME"); - break; - - case 20002: - 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) - { - 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) { - case -1: - cmenu(202); - probey = 3; - break; - - case 0: - strcpy(buf, myname); - inputloc = strlen(buf); - current_menu = 20003; - - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_kpad_Enter); - KB_FlushKeyboardQueue(); - break; - - case 1: - ud.color++; - if (ud.color > 23) - ud.color = 0; - check_player_color((int *)&ud.color,-1); - updatenames(); - break; - - case 2: - ud.team = 1-ud.team; - updatenames(); - break; - - case 3: - AutoAim = (AutoAim == 2) ? 0 : AutoAim+1; - updatenames(); - break; - - case 4: - ud.weaponswitch = (ud.weaponswitch == 3) ? 0 : ud.weaponswitch+1; - updatenames(); - break; - case 5: - ud.mouseaiming = !ud.mouseaiming; - updatenames(); - break; - case 6: - cmenu(20004); - break; - } - } else { - x = strget(200,50-9,buf,30,0); - - while (Bstrlen(strip_color_codes(buf)) > 10) - { - buf[Bstrlen(buf)-1] = '\0'; - inputloc--; - } - - if (x) { - if (x == 1) { - if (buf[0]) { - Bstrcpy(myname,buf); - } - // send name update - } - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_kpad_Enter); - KB_FlushKeyboardQueue(); - - current_menu = 20002; - updatenames(); - } - } - - menutext(40,50,MENUHIGHLIGHT(0),0,"NAME"); - menutext(40,50+16,MENUHIGHLIGHT(1),0,"COLOR"); - - { - int ud_color = -1, aaim = -1, ud_weaponswitch = -1, ud_maim = -1, ud_team = -1; - - ud_color = ud.color; - aaim = AutoAim; - ud_weaponswitch = ud.weaponswitch; - ud_maim = ud.mouseaiming; - ud_team = ud.team; - modval(0,23,(int *)&ud.color,1,probey==1); - modval(0,1,(int *)&ud.team,1,probey==2); - modval(0,2,(int *)&AutoAim,1,probey==3); - 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) - updatenames(); - } - menutext(40,50+16+16,MENUHIGHLIGHT(2),0,"TEAM"); - menutext(40,50+16+16+16,MENUHIGHLIGHT(3),0,"AUTO AIM"); - menutext(40,50+16+16+16+16,MENUHIGHLIGHT(4),0,"WEAPON SWITCH"); - menutext(40,50+16+16+16+16+16,MENUHIGHLIGHT(5),0,"AIMING TYPE"); - 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); - } - { 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); - } - { char *s[] = { "Blue", "Red" }; - 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); - } - { 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+16-9,ud.mouseaiming?"Held":"Toggle",MENUHIGHLIGHT(5),2+8+16); - - break; - - case 20004: - case 20005: - rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(160,24,0,0,"MACRO SETUP"); - - if (current_menu == 20004) - { - x = probesm(24,45,8,10); - if (x == -1) - { - cmenu(20002); - probey = 6; - } - else if (x >= 0 && x <= 9) - { - strcpy(buf, ud.ridecule[x]); - inputloc = strlen(buf); - last_probey = probey; - current_menu = 20005; - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_kpad_Enter); - KB_FlushKeyboardQueue(); - } - } else { - x = strget(26,40+(8*probey),buf,34,0); - if (x) { - if (x == 1) { - Bstrcpy(ud.ridecule[last_probey],buf); - } - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_kpad_Enter); - KB_FlushKeyboardQueue(); - current_menu = 20004; - } - } - for (i=0;i<10;i++) - { - if (current_menu == 20005 && i == last_probey) continue; - gametextpal(26,40+(i<<3),ud.ridecule[i],MENUHIGHLIGHT(i),0); - } - - gametext(160,144,"UP/DOWN = SELECT MACRO",0,2+8+16); - gametext(160,144+9,"ENTER = MODIFY",0,2+8+16); - gametext(160,144+9+9,"ACTIVATE IN GAME WITH SHIFT-F#",0,2+8+16); - - break; - - case 20010: - rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(160,24,0,0,"HOST NETWORK GAME"); - - x = probe(46,50,80,2); - - if (x == -1) { - cmenu(20001); - probey = 2; - } - else if (x == 0) cmenu(20011); - - menutext(40,50,0,0, "GAME OPTIONS"); - minitext(90,60, "GAME TYPE" ,2,26); - minitext(90,60+8, "EPISODE" ,2,26); - minitext(90,60+8+8, "LEVEL" ,2,26); - minitext(90,60+8+8+8, "MONSTERS" ,2,26); - if (ud.m_coop == 0) - minitext(90,60+8+8+8+8, "MARKERS" ,2,26); - else if (ud.m_coop == 1) - minitext(90,60+8+8+8+8, "FRIENDLY FIRE",2,26); - minitext(90,60+8+8+8+8+8, "USER MAP" ,2,26); - - gametext(90+60,60,gametype_names[ud.m_coop],0,26); - - minitext(90+60,60+8, volume_names[ud.m_volume_number],0,26); - minitext(90+60,60+8+8, level_names[11*ud.m_volume_number+ud.m_level_number],0,26); - if (ud.m_monsters_off == 0 || ud.m_player_skill > 0) - minitext(90+60,60+8+8+8, skill_names[ud.m_player_skill],0,26); - else minitext(90+60,60+8+8+8, "NONE",0,28); - if (ud.m_coop == 0) { - if (ud.m_marker) minitext(90+60,60+8+8+8+8,"ON",0,26); - else minitext(90+60,60+8+8+8+8,"OFF",0,26); - } else if (ud.m_coop == 1) { - if (ud.m_ffire) minitext(90+60,60+8+8+8+8,"ON",0,26); - else minitext(90+60,60+8+8+8+8,"OFF",0,26); - } - - menutext(40,50+80,0,0,"LAUNCH GAME"); - break; - - case 20011: - c = (320>>1) - 120; - rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(160,24,0,0,"NET GAME OPTIONS"); - - x = probe(c,57-8,16,8); - - switch (x) - { - case -1: - cmenu(20010); - break; - case 0: - ud.m_coop++; - 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) - 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) - ud.m_level_number = 0; - } else { - 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; - break; - case 3: - if (ud.m_monsters_off == 1 && ud.m_player_skill > 0) - ud.m_monsters_off = 0; - - if (ud.m_monsters_off == 0) - { - ud.m_player_skill++; - if (ud.m_player_skill > 3) + if (ud.multimode < 2 && ud.recstat != 2) { - ud.m_player_skill = 0; - ud.m_monsters_off = 1; + ready2send = 1; + totalclock = ototalclock; + } + ps[myconnectindex].gm &= ~MODE_MENU; + } + break; + + case 20000: + x = probe(326,190,0,0); + gametext(160,50-8,"YOU ARE PLAYING THE SHAREWARE",0,2+8+16); + gametext(160,59-8,"VERSION OF DUKE NUKEM 3D. WHILE",0,2+8+16); + gametext(160,68-8,"THIS VERSION IS REALLY COOL, YOU",0,2+8+16); + gametext(160,77-8,"ARE MISSING OVER 75%% OF THE TOTAL",0,2+8+16); + gametext(160,86-8,"GAME, ALONG WITH OTHER GREAT EXTRAS",0,2+8+16); + gametext(160,95-8,"AND GAMES, WHICH YOU'LL GET WHEN",0,2+8+16); + gametext(160,104-8,"YOU ORDER THE COMPLETE VERSION AND",0,2+8+16); + gametext(160,113-8,"GET THE FINAL TWO EPISODES.",0,2+8+16); + + gametext(160,113+8,"PLEASE READ THE 'HOW TO ORDER' ITEM",0,2+8+16); + gametext(160,122+8,"ON THE MAIN MENU IF YOU WISH TO",0,2+8+16); + gametext(160,131+8,"UPGRADE TO THE FULL REGISTERED",0,2+8+16); + 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); + break; + + case 20001: + rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(160,24,0,0,"NETWORK GAME"); + + x = probe(160,100-18,18,3); + + if (x == -1) cmenu(0); + else if (x == 2) cmenu(20010); + else if (x == 1) cmenu(20020); + else if (x == 0) cmenu(20002); + + menutext(160,100-18,MENUHIGHLIGHT(0),0,"PLAYER SETUP"); + menutext(160,100,MENUHIGHLIGHT(1),0,"JOIN GAME"); + menutext(160,100+18,MENUHIGHLIGHT(2),0,"HOST GAME"); + break; + + case 20002: + 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) + { + switch (ud.team) + { + case 0: + x = 3; + break; + case 1: + x = 21; + break; } } - else ud.m_monsters_off = 0; + 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); - break; + if (current_menu == 20002) + { + x = probe(40,50,16,7); + switch (x) + { + case -1: + cmenu(202); + probey = 3; + break; - case 4: - if (ud.m_coop == 0) - ud.m_marker = !ud.m_marker; - break; + case 0: + strcpy(buf, myname); + inputloc = strlen(buf); + current_menu = 20003; - case 5: - if (ud.m_coop == 1) - ud.m_ffire = !ud.m_ffire; - break; + KB_ClearKeyDown(sc_Enter); + KB_ClearKeyDown(sc_kpad_Enter); + KB_FlushKeyboardQueue(); + break; - case 6: - // pick the user map - break; + case 1: + ud.color++; + if (ud.color > 23) + ud.color = 0; + check_player_color((int *)&ud.color,-1); + updatenames(); + break; - case 7: - cmenu(20010); - break; - } + case 2: + ud.team = 1-ud.team; + updatenames(); + break; - c += 40; + case 3: + AutoAim = (AutoAim == 2) ? 0 : AutoAim+1; + updatenames(); + break; - // if(ud.m_coop==1) gametext(c+70,57-7-9,"COOPERATIVE PLAY",0,2+8+16); - // else if(ud.m_coop==2) gametext(c+70,57-7-9,"DUKEMATCH (NO SPAWN)",0,2+8+16); - // else gametext(c+70,57-7-9,"DUKEMATCH (SPAWN)",0,2+8+16); - gametext(c+70,57-7-9,gametype_names[ud.m_coop],0,26); - - gametext(c+70,57+16-7-9,volume_names[ud.m_volume_number],0,2+8+16); - - 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) - 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_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_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); - } - - c -= 44; - - menutext(c,57-9,MENUHIGHLIGHT(0),PHX(-2),"GAME TYPE"); - - sprintf(tempbuf,"EPISODE %ld",ud.m_volume_number+1); - menutext(c,57+16-9,MENUHIGHLIGHT(1),PHX(-3),tempbuf); - - sprintf(tempbuf,"LEVEL %ld",ud.m_level_number+1); - menutext(c,57+16+16-9,MENUHIGHLIGHT(2),PHX(-4),tempbuf); - - menutext(c,57+16+16+16-9,MENUHIGHLIGHT(3),PHX(-5),"MONSTERS"); - - 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) - 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) - 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"); - } - - menutext(c,57+16+16+16+16+16+16+16-9,MENUHIGHLIGHT(7),PHX(-8),"ACCEPT"); - break; - - case 20020: - case 20021: // editing server - case 20022: // editing port - rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(160,24,0,0,"JOIN NETWORK GAME"); - - if (current_menu == 20020) { - x = probe(46,50,20,3); - - if (x == -1) { - cmenu(20001); - probey = 1; - } else if (x == 0) { - strcpy(buf, "localhost"); - inputloc = strlen(buf); - current_menu = 20021; - } else if (x == 1) { - strcpy(buf, "19014"); - inputloc = strlen(buf); - current_menu = 20022; - } else if (x == 2) { - } - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_kpad_Enter); - KB_FlushKeyboardQueue(); - } else if (current_menu == 20021) { - x = strget(40+100,50-9,buf,31,0); - if (x) { - if (x == 1) { - //strcpy(myname,buf); + case 4: + ud.weaponswitch = (ud.weaponswitch == 3) ? 0 : ud.weaponswitch+1; + updatenames(); + break; + case 5: + ud.mouseaiming = !ud.mouseaiming; + updatenames(); + break; + case 6: + cmenu(20004); + break; } - - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_kpad_Enter); - KB_FlushKeyboardQueue(); - - current_menu = 20020; - } - } else if (current_menu == 20022) { - x = strget(40+100,50+20-9,buf,5,997); - if (x) { - if (x == 1) { - //strcpy(myname,buf); - } - - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_kpad_Enter); - KB_FlushKeyboardQueue(); - - current_menu = 20020; - } - } - - menutext(40,50,0,0,"SERVER"); - if (current_menu != 20021) gametext(40+100,50-9,"server",0,2+8+16); - - menutext(40,50+20,0,0,"PORT"); - if (current_menu != 20022) { - sprintf(tempbuf,"%d",19014); - gametext(40+100,50+20-9,tempbuf,0,2+8+16); - } - - menutext(160,50+20+20,0,0,"CONNECT"); - - - // ADDRESS - // PORT - // CONNECT - break; - - case 15001: - case 15000: - - gametext(160,90,"LOAD last game:",0,2+8+16); - - sprintf(tempbuf,"\"%s\"",ud.savegame[lastsavedpos]); - gametext(160,99,tempbuf,0,2+8+16); - - gametext(160,99+9,"(Y/N)",0,2+8+16); - - if (KB_KeyPressed(sc_Escape) || KB_KeyPressed(sc_N) || RMB) - { - if (sprite[ps[myconnectindex].i].extra <= 0) - { - if (enterlevel(MODE_GAME)) backtomenu(); - return; - } - - KB_ClearKeyDown(sc_N); - KB_ClearKeyDown(sc_Escape); - - ps[myconnectindex].gm &= ~MODE_MENU; - 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) - { - KB_FlushKeyboardQueue(); - KB_ClearKeysDown(); - FX_StopAllSounds(); - - if (ud.multimode > 1) - { - loadplayer(-1-lastsavedpos); - ps[myconnectindex].gm = MODE_GAME; } else { - c = loadplayer(lastsavedpos); - if (c == 0) - ps[myconnectindex].gm = MODE_GAME; - } - } + x = strget(200,50-9,buf,30,0); - probe(186,124+9,0,0); - - break; - - case 10000: - case 10001: - - c = 60; - rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(160,24,0,0,"ADULT MODE"); - - x = probe(60,50+16,16,2); - 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) - { - 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 (ud.pwlockout[0] == 0 || ud.lockout == 0) - strcpy(&ud.pwlockout[0],buf); - else if (strcmp(buf,&ud.pwlockout[0]) == 0) + while (Bstrlen(strip_color_codes(buf)) > 10) { - ud.lockout = 0; - buf[0] = 0; - - for (x=0;x= 0) - wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; - + buf[Bstrlen(buf)-1] = '\0'; + inputloc--; } - current_menu = 10000; + + if (x) + { + if (x == 1) + { + if (buf[0]) + { + Bstrcpy(myname,buf); + } + // send name update + } + KB_ClearKeyDown(sc_Enter); + KB_ClearKeyDown(sc_kpad_Enter); + KB_FlushKeyboardQueue(); + + current_menu = 20002; + updatenames(); + } + } + + menutext(40,50,MENUHIGHLIGHT(0),0,"NAME"); + menutext(40,50+16,MENUHIGHLIGHT(1),0,"COLOR"); + + { + int ud_color = -1, aaim = -1, ud_weaponswitch = -1, ud_maim = -1, ud_team = -1; + + ud_color = ud.color; + aaim = AutoAim; + ud_weaponswitch = ud.weaponswitch; + ud_maim = ud.mouseaiming; + ud_team = ud.team; + modval(0,23,(int *)&ud.color,1,probey==1); + modval(0,1,(int *)&ud.team,1,probey==2); + modval(0,2,(int *)&AutoAim,1,probey==3); + 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) + updatenames(); + } + menutext(40,50+16+16,MENUHIGHLIGHT(2),0,"TEAM"); + menutext(40,50+16+16+16,MENUHIGHLIGHT(3),0,"AUTO AIM"); + menutext(40,50+16+16+16+16,MENUHIGHLIGHT(4),0,"WEAPON SWITCH"); + menutext(40,50+16+16+16+16+16,MENUHIGHLIGHT(5),0,"AIMING TYPE"); + 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); + } + { + 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); + } + { + char *s[] = { "Blue", "Red" }; + 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); + } + { + 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+16-9,ud.mouseaiming?"Held":"Toggle",MENUHIGHLIGHT(5),2+8+16); + + break; + + case 20004: + case 20005: + rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(160,24,0,0,"MACRO SETUP"); + + if (current_menu == 20004) + { + x = probesm(24,45,8,10); + if (x == -1) + { + cmenu(20002); + probey = 6; + } + else if (x >= 0 && x <= 9) + { + strcpy(buf, ud.ridecule[x]); + inputloc = strlen(buf); + last_probey = probey; + current_menu = 20005; + KB_ClearKeyDown(sc_Enter); + KB_ClearKeyDown(sc_kpad_Enter); + KB_FlushKeyboardQueue(); + } + } + else + { + x = strget(26,40+(8*probey),buf,34,0); + if (x) + { + if (x == 1) + { + Bstrcpy(ud.ridecule[last_probey],buf); + } + KB_ClearKeyDown(sc_Enter); + KB_ClearKeyDown(sc_kpad_Enter); + KB_FlushKeyboardQueue(); + current_menu = 20004; + } + } + for (i=0;i<10;i++) + { + if (current_menu == 20005 && i == last_probey) continue; + gametextpal(26,40+(i<<3),ud.ridecule[i],MENUHIGHLIGHT(i),0); + } + + gametext(160,144,"UP/DOWN = SELECT MACRO",0,2+8+16); + gametext(160,144+9,"ENTER = MODIFY",0,2+8+16); + gametext(160,144+9+9,"ACTIVATE IN GAME WITH SHIFT-F#",0,2+8+16); + + break; + + case 20010: + rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(160,24,0,0,"HOST NETWORK GAME"); + + x = probe(46,50,80,2); + + if (x == -1) + { + cmenu(20001); + probey = 2; + } + else if (x == 0) cmenu(20011); + + menutext(40,50,0,0, "GAME OPTIONS"); + minitext(90,60, "GAME TYPE" ,2,26); + minitext(90,60+8, "EPISODE" ,2,26); + minitext(90,60+8+8, "LEVEL" ,2,26); + minitext(90,60+8+8+8, "MONSTERS" ,2,26); + if (ud.m_coop == 0) + minitext(90,60+8+8+8+8, "MARKERS" ,2,26); + else if (ud.m_coop == 1) + minitext(90,60+8+8+8+8, "FRIENDLY FIRE",2,26); + minitext(90,60+8+8+8+8+8, "USER MAP" ,2,26); + + gametext(90+60,60,gametype_names[ud.m_coop],0,26); + + minitext(90+60,60+8, volume_names[ud.m_volume_number],0,26); + minitext(90+60,60+8+8, level_names[11*ud.m_volume_number+ud.m_level_number],0,26); + if (ud.m_monsters_off == 0 || ud.m_player_skill > 0) + minitext(90+60,60+8+8+8, skill_names[ud.m_player_skill],0,26); + else minitext(90+60,60+8+8+8, "NONE",0,28); + if (ud.m_coop == 0) + { + if (ud.m_marker) minitext(90+60,60+8+8+8+8,"ON",0,26); + else minitext(90+60,60+8+8+8+8,"OFF",0,26); + } + else if (ud.m_coop == 1) + { + if (ud.m_ffire) minitext(90+60,60+8+8+8+8,"ON",0,26); + else minitext(90+60,60+8+8+8+8,"OFF",0,26); + } + + menutext(40,50+80,0,0,"LAUNCH GAME"); + break; + + case 20011: + c = (320>>1) - 120; + rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(160,24,0,0,"NET GAME OPTIONS"); + + x = probe(c,57-8,16,8); + + switch (x) + { + case -1: + cmenu(20010); + break; + case 0: + ud.m_coop++; + 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) + 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) + ud.m_level_number = 0; + } + else + { + 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; + break; + case 3: + if (ud.m_monsters_off == 1 && ud.m_player_skill > 0) + ud.m_monsters_off = 0; + + if (ud.m_monsters_off == 0) + { + ud.m_player_skill++; + if (ud.m_player_skill > 3) + { + ud.m_player_skill = 0; + ud.m_monsters_off = 1; + } + } + else ud.m_monsters_off = 0; + + break; + + case 4: + if (ud.m_coop == 0) + ud.m_marker = !ud.m_marker; + break; + + case 5: + if (ud.m_coop == 1) + ud.m_ffire = !ud.m_ffire; + break; + + case 6: + // pick the user map + break; + + case 7: + cmenu(20010); + break; + } + + c += 40; + + // if(ud.m_coop==1) gametext(c+70,57-7-9,"COOPERATIVE PLAY",0,2+8+16); + // else if(ud.m_coop==2) gametext(c+70,57-7-9,"DUKEMATCH (NO SPAWN)",0,2+8+16); + // else gametext(c+70,57-7-9,"DUKEMATCH (SPAWN)",0,2+8+16); + gametext(c+70,57-7-9,gametype_names[ud.m_coop],0,26); + + gametext(c+70,57+16-7-9,volume_names[ud.m_volume_number],0,2+8+16); + + 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) + 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_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_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); + } + + c -= 44; + + menutext(c,57-9,MENUHIGHLIGHT(0),PHX(-2),"GAME TYPE"); + + sprintf(tempbuf,"EPISODE %ld",ud.m_volume_number+1); + menutext(c,57+16-9,MENUHIGHLIGHT(1),PHX(-3),tempbuf); + + sprintf(tempbuf,"LEVEL %ld",ud.m_level_number+1); + menutext(c,57+16+16-9,MENUHIGHLIGHT(2),PHX(-4),tempbuf); + + menutext(c,57+16+16+16-9,MENUHIGHLIGHT(3),PHX(-5),"MONSTERS"); + + 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) + 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) + 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"); + } + + menutext(c,57+16+16+16+16+16+16+16-9,MENUHIGHLIGHT(7),PHX(-8),"ACCEPT"); + break; + + case 20020: + case 20021: // editing server + case 20022: // editing port + rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(160,24,0,0,"JOIN NETWORK GAME"); + + if (current_menu == 20020) + { + x = probe(46,50,20,3); + + if (x == -1) + { + cmenu(20001); + probey = 1; + } + else if (x == 0) + { + strcpy(buf, "localhost"); + inputloc = strlen(buf); + current_menu = 20021; + } + else if (x == 1) + { + strcpy(buf, "19014"); + inputloc = strlen(buf); + current_menu = 20022; + } + else if (x == 2) + {} KB_ClearKeyDown(sc_Enter); KB_ClearKeyDown(sc_kpad_Enter); KB_FlushKeyboardQueue(); } - } - else - { - if (x == 0) + else if (current_menu == 20021) { - if (ud.lockout == 1) + x = strget(40+100,50-9,buf,31,0); + if (x) { - if (ud.pwlockout[0] == 0) + if (x == 1) { - ud.lockout = 0; - for (x=0;x= 0) - wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; + //strcpy(myname,buf); } - else - { - buf[0] = 0; - current_menu = 10001; - inputloc = 0; - KB_FlushKeyboardQueue(); - } - } - else - { - ud.lockout = 1; - for (x=0;x>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); - - dispnames(); - - sprintf(tempbuf,"PLAYERS: %-2ld ",savehead.numplr); - gametext(160,156,tempbuf,0,2+8+16); - - sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+savehead.volnum,1+savehead.levnum,savehead.plrskl); - gametext(160,168,tempbuf,0,2+8+16); - - if (savehead.volnum == 0 && savehead.levnum == 7) - gametext(160,180,savehead.boardfn,0,2+8+16); - - gametext(160,90,"LOAD game:",0,2+8+16); - sprintf(tempbuf,"\"%s\"",ud.savegame[current_menu-1000]); - gametext(160,99,tempbuf,0,2+8+16); - gametext(160,99+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) - { - lastsavedpos = current_menu-1000; - - KB_FlushKeyboardQueue(); - KB_ClearKeysDown(); - if (ud.multimode < 2 && ud.recstat != 2) - { - ready2send = 1; - totalclock = ototalclock; - } - - if (ud.multimode > 1) - { - if (ps[myconnectindex].gm&MODE_GAME) + if (ud.multimode > 1) { loadplayer(-1-lastsavedpos); ps[myconnectindex].gm = MODE_GAME; } else { - tempbuf[0] = 126; - tempbuf[1] = lastsavedpos; - tempbuf[2] = myconnectindex; - for (x=connecthead;x>=0;x=connectpoint2[x]) + c = loadplayer(lastsavedpos); + if (c == 0) + ps[myconnectindex].gm = MODE_GAME; + } + } + + probe(186,124+9,0,0); + + break; + + case 10000: + case 10001: + + c = 60; + rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(160,24,0,0,"ADULT MODE"); + + x = probe(60,50+16,16,2); + 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) + { + 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 (ud.pwlockout[0] == 0 || ud.lockout == 0) + strcpy(&ud.pwlockout[0],buf); + else if (strcmp(buf,&ud.pwlockout[0]) == 0) { - if (x != myconnectindex) sendpacket(x,tempbuf,3); - if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + ud.lockout = 0; + buf[0] = 0; + + for (x=0;x= 0) + wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; + } - getpackets(); - - loadplayer(lastsavedpos); - - multiflag = 0; + current_menu = 10000; + KB_ClearKeyDown(sc_Enter); + KB_ClearKeyDown(sc_kpad_Enter); + KB_FlushKeyboardQueue(); } } else { - c = loadplayer(lastsavedpos); - if (c == 0) - ps[myconnectindex].gm = MODE_GAME; + if (x == 0) + { + if (ud.lockout == 1) + { + if (ud.pwlockout[0] == 0) + { + ud.lockout = 0; + for (x=0;x= 0) + wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra; + } + else + { + buf[0] = 0; + current_menu = 10001; + inputloc = 0; + KB_FlushKeyboardQueue(); + } + } + else + { + ud.lockout = 1; + + for (x=0;x>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); + + dispnames(); + + sprintf(tempbuf,"PLAYERS: %-2ld ",savehead.numplr); + gametext(160,156,tempbuf,0,2+8+16); + + sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+savehead.volnum,1+savehead.levnum,savehead.plrskl); + gametext(160,168,tempbuf,0,2+8+16); + + if (savehead.volnum == 0 && savehead.levnum == 7) + gametext(160,180,savehead.boardfn,0,2+8+16); + + gametext(160,90,"LOAD game:",0,2+8+16); + sprintf(tempbuf,"\"%s\"",ud.savegame[current_menu-1000]); + gametext(160,99,tempbuf,0,2+8+16); + gametext(160,99+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) + { + lastsavedpos = current_menu-1000; + + KB_FlushKeyboardQueue(); + KB_ClearKeysDown(); + if (ud.multimode < 2 && ud.recstat != 2) + { + ready2send = 1; + totalclock = ototalclock; + } + + if (ud.multimode > 1) + { + if (ps[myconnectindex].gm&MODE_GAME) + { + loadplayer(-1-lastsavedpos); + ps[myconnectindex].gm = MODE_GAME; + } + else + { + tempbuf[0] = 126; + tempbuf[1] = lastsavedpos; + tempbuf[2] = myconnectindex; + 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 + } + getpackets(); + + loadplayer(lastsavedpos); + + multiflag = 0; + } + } + else + { + c = loadplayer(lastsavedpos); + if (c == 0) + ps[myconnectindex].gm = MODE_GAME; + } + + break; + } + 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); + else + { + ps[myconnectindex].gm &= ~MODE_MENU; + if (ud.multimode < 2 && ud.recstat != 2) + { + ready2send = 1; + totalclock = ototalclock; + } + } + } + + probe(186,124+9,0,0); + + break; + + case 1500: + + 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) + { + KB_ClearKeyDown(sc_N); + KB_ClearKeyDown(sc_Escape); + if (ud.multimode < 2 && ud.recstat != 2) + { + ready2send = 1; + totalclock = ototalclock; + } + ps[myconnectindex].gm &= ~MODE_MENU; + sound(EXITMENUSOUND); + break; + } + probe(186,124,0,0); + gametext(160,90,"ABORT this game?",0,2+8+16); + gametext(160,90+9,"(Y/N)",0,2+8+16); + + break; + + case 2000: + case 2001: + case 2002: + case 2003: + case 2004: + case 2005: + case 2006: + case 2007: + case 2008: + case 2009: + + rotatesprite(160<<16,200<<15,65536L,0,MENUSCREEN,16,0,10+64,0,0,xdim-1,ydim-1); + rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(160,24,0,0,"SAVE GAME"); + + rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); + sprintf(tempbuf,"PLAYERS: %-2ld ",ud.multimode); + gametext(160,156,tempbuf,0,2+8+16); + + sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+ud.volume_number,1+ud.level_number,ud.player_skill); + gametext(160,168,tempbuf,0,2+8+16); + + if (ud.volume_number == 0 && ud.level_number == 7) + gametext(160,180,boardfilename,0,2+8+16); + + dispnames(); + + 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) + { + inputloc = strlen(&ud.savegame[current_menu-2000][0]); + + cmenu(current_menu-2000+360); + + KB_FlushKeyboardQueue(); + break; + } + if (KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Escape) || RMB) + { + KB_ClearKeyDown(sc_N); + KB_ClearKeyDown(sc_Escape); + cmenu(351); + sound(EXITMENUSOUND); + } + + probe(186,124,0,0); + + break; + + case 990: + case 991: + case 992: + case 993: + case 994: + case 995: + case 996: + case 997: + case 998: + c = 160; + if (!VOLUMEALL || !PLUTOPAK) + { + //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); + menutext(c,24,0,0,current_menu == 998 ? "ABOUT EDUKE32" : "CREDITS"); + + l = 8; + } else + { + l = 3; + } + + if (KB_KeyPressed(sc_Escape)) + { + cmenu(0); + break; + } + + if (KB_KeyPressed(sc_LeftArrow) || + KB_KeyPressed(sc_kpad_4) || + KB_KeyPressed(sc_UpArrow) || + KB_KeyPressed(sc_PgUp) || + KB_KeyPressed(sc_kpad_8)) + { + KB_ClearKeyDown(sc_LeftArrow); + KB_ClearKeyDown(sc_kpad_4); + KB_ClearKeyDown(sc_UpArrow); + KB_ClearKeyDown(sc_PgUp); + KB_ClearKeyDown(sc_kpad_8); + + sound(KICK_HIT); + current_menu--; + if (current_menu < 990) current_menu = 990+l; + } + else if ( + KB_KeyPressed(sc_PgDn) || + KB_KeyPressed(sc_Enter) || + KB_KeyPressed(sc_Space) || + KB_KeyPressed(sc_kpad_Enter) || + KB_KeyPressed(sc_RightArrow) || + KB_KeyPressed(sc_DownArrow) || + KB_KeyPressed(sc_kpad_2) || + KB_KeyPressed(sc_kpad_9) || + KB_KeyPressed(sc_kpad_6)) + { + KB_ClearKeyDown(sc_PgDn); + KB_ClearKeyDown(sc_Enter); + KB_ClearKeyDown(sc_RightArrow); + KB_ClearKeyDown(sc_kpad_Enter); + KB_ClearKeyDown(sc_kpad_6); + KB_ClearKeyDown(sc_kpad_9); + KB_ClearKeyDown(sc_kpad_2); + KB_ClearKeyDown(sc_DownArrow); + KB_ClearKeyDown(sc_Space); + sound(KICK_HIT); + current_menu++; + if (current_menu > 990+l) current_menu = 990; + } + + if (!VOLUMEALL || !PLUTOPAK) + { + switch (current_menu) + { + case 990: + gametext(c,40, "ORIGINAL CONCEPT",0,2+8+16); + gametext(c,40+9, "TODD REPLOGLE",0,2+8+16); + gametext(c,40+9+9, "ALLEN H. BLUM III",0,2+8+16); + + gametext(c,40+9+9+9+9, "PRODUCED & DIRECTED BY",0,2+8+16); + gametext(c,40+9+9+9+9+9, "GREG MALONE",0,2+8+16); + + gametext(c,40+9+9+9+9+9+9+9, "EXECUTIVE PRODUCER",0,2+8+16); + gametext(c,40+9+9+9+9+9+9+9+9, "GEORGE BROUSSARD",0,2+8+16); + + gametext(c,40+9+9+9+9+9+9+9+9+9+9, "BUILD ENGINE",0,2+8+16); + gametext(c,40+9+9+9+9+9+9+9+9+9+9+9,"KEN SILVERMAN",0,2+8+16); + break; + case 991: + gametext(c,40, "GAME PROGRAMMING",0,2+8+16); + gametext(c,40+9, "TODD REPLOGLE",0,2+8+16); + + gametext(c,40+9+9+9, "3D ENGINE/TOOLS/NET",0,2+8+16); + gametext(c,40+9+9+9+9, "KEN SILVERMAN",0,2+8+16); + + gametext(c,40+9+9+9+9+9+9, "NETWORK LAYER/SETUP PROGRAM",0,2+8+16); + gametext(c,40+9+9+9+9+9+9+9, "MARK DOCHTERMANN",0,2+8+16); + break; + case 992: + gametext(c,40, "MAP DESIGN",0,2+8+16); + gametext(c,40+9, "ALLEN H BLUM III",0,2+8+16); + gametext(c,40+9+9, "RICHARD GRAY",0,2+8+16); + + gametext(c,40+9+9+9+9, "3D MODELING",0,2+8+16); + gametext(c,40+9+9+9+9+9, "CHUCK JONES",0,2+8+16); + gametext(c,40+9+9+9+9+9+9, "SAPPHIRE CORPORATION",0,2+8+16); + + gametext(c,40+9+9+9+9+9+9+9+9, "ARTWORK",0,2+8+16); + gametext(c,40+9+9+9+9+9+9+9+9+9, "DIRK JONES, STEPHEN HORNBACK",0,2+8+16); + gametext(c,40+9+9+9+9+9+9+9+9+9+9, "JAMES STOREY, DAVID DEMARET",0,2+8+16); + gametext(c,40+9+9+9+9+9+9+9+9+9+9+9,"DOUGLAS R WOOD",0,2+8+16); + break; + case 993: + gametext(c,40, "SOUND ENGINE",0,2+8+16); + gametext(c,40+9, "JIM DOSE",0,2+8+16); + + gametext(c,40+9+9+9, "SOUND & MUSIC DEVELOPMENT",0,2+8+16); + gametext(c,40+9+9+9+9, "ROBERT PRINCE",0,2+8+16); + gametext(c,40+9+9+9+9+9, "LEE JACKSON",0,2+8+16); + + gametext(c,40+9+9+9+9+9+9+9, "VOICE TALENT",0,2+8+16); + gametext(c,40+9+9+9+9+9+9+9+9, "LANI MINELLA - VOICE PRODUCER",0,2+8+16); + gametext(c,40+9+9+9+9+9+9+9+9+9, "JON ST. JOHN AS \"DUKE NUKEM\"",0,2+8+16); + break; + case 994: + gametext(c,60, "GRAPHIC DESIGN",0,2+8+16); + gametext(c,60+9, "PACKAGING, MANUAL, ADS",0,2+8+16); + gametext(c,60+9+9, "ROBERT M. ATKINS",0,2+8+16); + gametext(c,60+9+9+9, "MICHAEL HADWIN",0,2+8+16); + + gametext(c,60+9+9+9+9+9, "SPECIAL THANKS TO",0,2+8+16); + gametext(c,60+9+9+9+9+9+9, "STEVEN BLACKBURN, TOM HALL",0,2+8+16); + gametext(c,60+9+9+9+9+9+9+9, "SCOTT MILLER, JOE SIEGLER",0,2+8+16); + gametext(c,60+9+9+9+9+9+9+9+9, "TERRY NAGY, COLLEEN COMPTON",0,2+8+16); + gametext(c,60+9+9+9+9+9+9+9+9+9, "HASH INC., FORMGEN, INC.",0,2+8+16); + break; + case 995: + gametext(c,49, "THE 3D REALMS BETA TESTERS",0,2+8+16); + + gametext(c,49+9+9, "NATHAN ANDERSON, WAYNE BENNER",0,2+8+16); + gametext(c,49+9+9+9, "GLENN BRENSINGER, ROB BROWN",0,2+8+16); + gametext(c,49+9+9+9+9, "ERIK HARRIS, KEN HECKBERT",0,2+8+16); + gametext(c,49+9+9+9+9+9, "TERRY HERRIN, GREG HIVELY",0,2+8+16); + gametext(c,49+9+9+9+9+9+9, "HANK LEUKART, ERIC BAKER",0,2+8+16); + gametext(c,49+9+9+9+9+9+9+9, "JEFF RAUSCH, KELLY ROGERS",0,2+8+16); + gametext(c,49+9+9+9+9+9+9+9+9, "MIKE DUNCAN, DOUG HOWELL",0,2+8+16); + gametext(c,49+9+9+9+9+9+9+9+9+9, "BILL BLAIR",0,2+8+16); + break; + case 996: + gametext(c,32, "COMPANY PRODUCT SUPPORT",0,2+8+16); + + gametext(c,32+9+9, "THE FOLLOWING COMPANIES WERE COOL",0,2+8+16); + gametext(c,32+9+9+9, "ENOUGH TO GIVE US LOTS OF STUFF",0,2+8+16); + gametext(c,32+9+9+9+9, "DURING THE MAKING OF DUKE NUKEM 3D.",0,2+8+16); + + gametext(c,32+9+9+9+9+9+9, "ALTEC LANSING MULTIMEDIA",0,2+8+16); + gametext(c,32+9+9+9+9+9+9+9, "FOR TONS OF SPEAKERS AND THE",0,2+8+16); + gametext(c,32+9+9+9+9+9+9+9+9, "THX-LICENSED SOUND SYSTEM",0,2+8+16); + gametext(c,32+9+9+9+9+9+9+9+9+9, "FOR INFO CALL 1-800-548-0620",0,2+8+16); + + gametext(c,32+9+9+9+9+9+9+9+9+9+9+9,"CREATIVE LABS, INC.",0,2+8+16); + + gametext(c,32+9+9+9+9+9+9+9+9+9+9+9+9+9,"THANKS FOR THE HARDWARE, GUYS.",0,2+8+16); + break; + case 997: + gametext(c,50, "DUKE NUKEM IS A TRADEMARK OF",0,2+8+16); + gametext(c,50+9, "3D REALMS ENTERTAINMENT",0,2+8+16); + + gametext(c,50+9+9+9, "DUKE NUKEM",0,2+8+16); + gametext(c,50+9+9+9+9, "(C) 1996 3D REALMS ENTERTAINMENT",0,2+8+16); + + if (VOLUMEONE) + { + gametext(c,106, "PLEASE READ LICENSE.DOC FOR SHAREWARE",0,2+8+16); + gametext(c,106+9, "DISTRIBUTION GRANTS AND RESTRICTIONS",0,2+8+16); + } + + gametext(c,VOLUMEONE?134:115, "MADE IN DALLAS, TEXAS USA",0,2+8+16); + break; + case 998: + l = 10; + goto cheat_for_port_credits; + } + break; + } + + // Plutonium pak menus + switch (current_menu) + { + case 990: + case 991: + case 992: + rotatesprite(160<<16,200<<15,65536L,0,2504+current_menu-990,0,0,10+64,0,0,xdim-1,ydim-1); + break; + case 993: // JBF 20031220 + rotatesprite(160<<16,200<<15,65536L,0,MENUSCREEN,0,0,10+64,0,0,xdim-1,ydim-1); + rotatesprite(c<<16,19<<16,65536L,0,MENUBAR,0,0,10,0,0,xdim-1,ydim-1); + menutext(160,24,0,0,"ABOUT EDUKE32"); + +cheat_for_port_credits: + if (conversion == 13) l = (-2); + gametext(160,38-l,"GAME PROGRAMMING",0,2+8+16); + p = "Richard \"TerminX\" Gobeille"; + minitext(161-(Bstrlen(p)<<1), 39+10-l, p, 4, 10+16+128); + minitext(160-(Bstrlen(p)<<1), 38+10-l, p, 8, 10+16+128); + + gametext(160,57-l,"\"JFDUKE3D\" AND \"JFBUILD\" CODE",0,2+8+16); + p = "Jonathon \"JonoF\" Fowler"; + minitext(161-(Bstrlen(p)<<1), 58+10-l, p, 4, 10+16+128); + minitext(160-(Bstrlen(p)<<1), 57+10-l, p, 8, 10+16+128); + + gametext(160,76-l,"ORIGINAL \"POLYMOST\" RENDERER",0,2+8+16); + gametext(160,76+8-l,"NETWORKING, OTHER CODE",0,2+8+16); + p = "Ken \"Awesoken\" Silverman"; + minitext(161-(Bstrlen(p)<<1), 77+8+10-l, p, 4, 10+16+128); + minitext(160-(Bstrlen(p)<<1), 76+8+10-l, p, 8, 10+16+128); + + gametext(160,103-l,"RENDERING FEATURES",0,2+8+16); + p = "Pierre-Loup \"Plagman\" Griffais"; + minitext(161-(Bstrlen(p)<<1), 104+10-l, p, 4, 10+16+128); + minitext(160-(Bstrlen(p)<<1), 103+10-l, p, 8, 10+16+128); + + gametext(160,122-l,"LICENSE AND OTHER CONTRIBUTORS",0,2+8+16); + { + const char *scroller[] = + { + "This program is distributed under the terms of the", + "GNU General Public License version 2 as published by the", + "Free Software Foundation. See GNU.TXT for details.", + "", + "Thanks to the following people for their contributions:", + "", + "Adam Fazakerley", + "Ed Coolidge", + "Javier Martinez", + "Jeff Hart", + "Jonathan Smith", + "Jose del Castillo", + "Lachlan McDonald", + "Matthew Palmer", + "Peter Green", + "", + "EDuke originally by Matt Saettler", + "", + "--x--", + "", + "", + "", + "", + "", + "" + }; + const int numlines = sizeof(scroller)/sizeof(char *); + for (m=0,i=(totalclock/104)%numlines; m<6; m++,i++) + { + if (i==numlines) i=0; + minitext(161-(Bstrlen(scroller[i])<<1), 101+10+10+8+4+(m*7)-l, (char*)scroller[i], 4, 10+16+128); + minitext(160-(Bstrlen(scroller[i])<<1), 100+10+10+8+4+(m*7)-l, (char*)scroller[i], 8, 10+16+128); + } + } + + p = "Visit www.eduke32.com for news and updates"; + minitext(161-(Bstrlen(p)<<1), 136+10+10+10+10+4-l, p, 4, 10+16+128); + minitext(160-(Bstrlen(p)<<1), 135+10+10+10+10+4-l, p, 8, 10+16+128); + } + break; + + case 0: + c = (320>>1); + rotatesprite(c<<16,28<<16,65536L,0,INGAMEDUKETHREEDEE,0,0,10,0,0,xdim-1,ydim-1); + 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 (ud.multimode > 1 && x == 0 && ud.recstat != 2) + { + if (movesperpacket == 4 && myconnectindex != connecthead) + break; + + last_zero = 0; + cmenu(600); + } + else + { + last_zero = 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 2: + 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; + } + } + } + + if (KB_KeyPressed(sc_Q)) cmenu(500); + + if (x == -1 && (ps[myconnectindex].gm&MODE_GAME || ud.recstat == 2)) { ps[myconnectindex].gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) @@ -1317,3021 +1810,2950 @@ void menus(void) totalclock = ototalclock; } } - } - probe(186,124+9,0,0); - - break; - - case 1500: - - 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) - { - KB_ClearKeyDown(sc_N); - KB_ClearKeyDown(sc_Escape); - if (ud.multimode < 2 && ud.recstat != 2) + if (movesperpacket == 4) { - ready2send = 1; - totalclock = ototalclock; + if (myconnectindex == connecthead) + menutext(c,67,MENUHIGHLIGHT(0),PHX(-2),"NEW GAME"); + else + menutext(c,67,MENUHIGHLIGHT(0),1,"NEW GAME"); } - ps[myconnectindex].gm &= ~MODE_MENU; - sound(EXITMENUSOUND); - break; - } - probe(186,124,0,0); - gametext(160,90,"ABORT this game?",0,2+8+16); - gametext(160,90+9,"(Y/N)",0,2+8+16); + else + menutext(c,67,MENUHIGHLIGHT(0),PHX(-2),"NEW GAME"); - break; + // menutext(c,67+16,0,1,"NETWORK GAME"); - case 2000: - case 2001: - case 2002: - case 2003: - case 2004: - case 2005: - case 2006: - case 2007: - case 2008: - case 2009: + menutext(c,67+16/*+16*/,MENUHIGHLIGHT(1),PHX(-3),"OPTIONS"); - rotatesprite(160<<16,200<<15,65536L,0,MENUSCREEN,16,0,10+64,0,0,xdim-1,ydim-1); - rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(160,24,0,0,"SAVE GAME"); + 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"); - rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); - sprintf(tempbuf,"PLAYERS: %-2ld ",ud.multimode); - gametext(160,156,tempbuf,0,2+8+16); - - sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+ud.volume_number,1+ud.level_number,ud.player_skill); - gametext(160,168,tempbuf,0,2+8+16); - - if (ud.volume_number == 0 && ud.level_number == 7) - gametext(160,180,boardfilename,0,2+8+16); - - dispnames(); - - 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) - { - inputloc = strlen(&ud.savegame[current_menu-2000][0]); - - cmenu(current_menu-2000+360); - - KB_FlushKeyboardQueue(); - break; - } - if (KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Escape) || RMB) - { - KB_ClearKeyDown(sc_N); - KB_ClearKeyDown(sc_Escape); - cmenu(351); - sound(EXITMENUSOUND); - } - - probe(186,124,0,0); - - break; - - case 990: - case 991: - case 992: - case 993: - case 994: - case 995: - case 996: - case 997: - case 998: - c = 160; - if (!VOLUMEALL || !PLUTOPAK) { - //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); - menutext(c,24,0,0,current_menu == 998 ? "ABOUT EDUKE32" : "CREDITS"); - - l = 8; - } else { - l = 3; - } - - if (KB_KeyPressed(sc_Escape)) { cmenu(0); break; } - - if (KB_KeyPressed(sc_LeftArrow) || - KB_KeyPressed(sc_kpad_4) || - KB_KeyPressed(sc_UpArrow) || - KB_KeyPressed(sc_PgUp) || - KB_KeyPressed(sc_kpad_8)) - { - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_kpad_4); - KB_ClearKeyDown(sc_UpArrow); - KB_ClearKeyDown(sc_PgUp); - KB_ClearKeyDown(sc_kpad_8); - - sound(KICK_HIT); - current_menu--; - if (current_menu < 990) current_menu = 990+l; - } - else if ( - KB_KeyPressed(sc_PgDn) || - KB_KeyPressed(sc_Enter) || - KB_KeyPressed(sc_Space) || - KB_KeyPressed(sc_kpad_Enter) || - KB_KeyPressed(sc_RightArrow) || - KB_KeyPressed(sc_DownArrow) || - KB_KeyPressed(sc_kpad_2) || - KB_KeyPressed(sc_kpad_9) || - KB_KeyPressed(sc_kpad_6)) - { - KB_ClearKeyDown(sc_PgDn); - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_RightArrow); - KB_ClearKeyDown(sc_kpad_Enter); - KB_ClearKeyDown(sc_kpad_6); - KB_ClearKeyDown(sc_kpad_9); - KB_ClearKeyDown(sc_kpad_2); - KB_ClearKeyDown(sc_DownArrow); - KB_ClearKeyDown(sc_Space); - sound(KICK_HIT); - current_menu++; - if (current_menu > 990+l) current_menu = 990; - } - - if (!VOLUMEALL || !PLUTOPAK) { - switch (current_menu) { - case 990: - gametext(c,40, "ORIGINAL CONCEPT",0,2+8+16); - gametext(c,40+9, "TODD REPLOGLE",0,2+8+16); - gametext(c,40+9+9, "ALLEN H. BLUM III",0,2+8+16); - - gametext(c,40+9+9+9+9, "PRODUCED & DIRECTED BY",0,2+8+16); - gametext(c,40+9+9+9+9+9, "GREG MALONE",0,2+8+16); - - gametext(c,40+9+9+9+9+9+9+9, "EXECUTIVE PRODUCER",0,2+8+16); - gametext(c,40+9+9+9+9+9+9+9+9, "GEORGE BROUSSARD",0,2+8+16); - - gametext(c,40+9+9+9+9+9+9+9+9+9+9, "BUILD ENGINE",0,2+8+16); - gametext(c,40+9+9+9+9+9+9+9+9+9+9+9,"KEN SILVERMAN",0,2+8+16); - break; - case 991: - gametext(c,40, "GAME PROGRAMMING",0,2+8+16); - gametext(c,40+9, "TODD REPLOGLE",0,2+8+16); - - gametext(c,40+9+9+9, "3D ENGINE/TOOLS/NET",0,2+8+16); - gametext(c,40+9+9+9+9, "KEN SILVERMAN",0,2+8+16); - - gametext(c,40+9+9+9+9+9+9, "NETWORK LAYER/SETUP PROGRAM",0,2+8+16); - gametext(c,40+9+9+9+9+9+9+9, "MARK DOCHTERMANN",0,2+8+16); - break; - case 992: - gametext(c,40, "MAP DESIGN",0,2+8+16); - gametext(c,40+9, "ALLEN H BLUM III",0,2+8+16); - gametext(c,40+9+9, "RICHARD GRAY",0,2+8+16); - - gametext(c,40+9+9+9+9, "3D MODELING",0,2+8+16); - gametext(c,40+9+9+9+9+9, "CHUCK JONES",0,2+8+16); - gametext(c,40+9+9+9+9+9+9, "SAPPHIRE CORPORATION",0,2+8+16); - - gametext(c,40+9+9+9+9+9+9+9+9, "ARTWORK",0,2+8+16); - gametext(c,40+9+9+9+9+9+9+9+9+9, "DIRK JONES, STEPHEN HORNBACK",0,2+8+16); - gametext(c,40+9+9+9+9+9+9+9+9+9+9, "JAMES STOREY, DAVID DEMARET",0,2+8+16); - gametext(c,40+9+9+9+9+9+9+9+9+9+9+9,"DOUGLAS R WOOD",0,2+8+16); - break; - case 993: - gametext(c,40, "SOUND ENGINE",0,2+8+16); - gametext(c,40+9, "JIM DOSE",0,2+8+16); - - gametext(c,40+9+9+9, "SOUND & MUSIC DEVELOPMENT",0,2+8+16); - gametext(c,40+9+9+9+9, "ROBERT PRINCE",0,2+8+16); - gametext(c,40+9+9+9+9+9, "LEE JACKSON",0,2+8+16); - - gametext(c,40+9+9+9+9+9+9+9, "VOICE TALENT",0,2+8+16); - gametext(c,40+9+9+9+9+9+9+9+9, "LANI MINELLA - VOICE PRODUCER",0,2+8+16); - gametext(c,40+9+9+9+9+9+9+9+9+9, "JON ST. JOHN AS \"DUKE NUKEM\"",0,2+8+16); - break; - case 994: - gametext(c,60, "GRAPHIC DESIGN",0,2+8+16); - gametext(c,60+9, "PACKAGING, MANUAL, ADS",0,2+8+16); - gametext(c,60+9+9, "ROBERT M. ATKINS",0,2+8+16); - gametext(c,60+9+9+9, "MICHAEL HADWIN",0,2+8+16); - - gametext(c,60+9+9+9+9+9, "SPECIAL THANKS TO",0,2+8+16); - gametext(c,60+9+9+9+9+9+9, "STEVEN BLACKBURN, TOM HALL",0,2+8+16); - gametext(c,60+9+9+9+9+9+9+9, "SCOTT MILLER, JOE SIEGLER",0,2+8+16); - gametext(c,60+9+9+9+9+9+9+9+9, "TERRY NAGY, COLLEEN COMPTON",0,2+8+16); - gametext(c,60+9+9+9+9+9+9+9+9+9, "HASH INC., FORMGEN, INC.",0,2+8+16); - break; - case 995: - gametext(c,49, "THE 3D REALMS BETA TESTERS",0,2+8+16); - - gametext(c,49+9+9, "NATHAN ANDERSON, WAYNE BENNER",0,2+8+16); - gametext(c,49+9+9+9, "GLENN BRENSINGER, ROB BROWN",0,2+8+16); - gametext(c,49+9+9+9+9, "ERIK HARRIS, KEN HECKBERT",0,2+8+16); - gametext(c,49+9+9+9+9+9, "TERRY HERRIN, GREG HIVELY",0,2+8+16); - gametext(c,49+9+9+9+9+9+9, "HANK LEUKART, ERIC BAKER",0,2+8+16); - gametext(c,49+9+9+9+9+9+9+9, "JEFF RAUSCH, KELLY ROGERS",0,2+8+16); - gametext(c,49+9+9+9+9+9+9+9+9, "MIKE DUNCAN, DOUG HOWELL",0,2+8+16); - gametext(c,49+9+9+9+9+9+9+9+9+9, "BILL BLAIR",0,2+8+16); - break; - case 996: - gametext(c,32, "COMPANY PRODUCT SUPPORT",0,2+8+16); - - gametext(c,32+9+9, "THE FOLLOWING COMPANIES WERE COOL",0,2+8+16); - gametext(c,32+9+9+9, "ENOUGH TO GIVE US LOTS OF STUFF",0,2+8+16); - gametext(c,32+9+9+9+9, "DURING THE MAKING OF DUKE NUKEM 3D.",0,2+8+16); - - gametext(c,32+9+9+9+9+9+9, "ALTEC LANSING MULTIMEDIA",0,2+8+16); - gametext(c,32+9+9+9+9+9+9+9, "FOR TONS OF SPEAKERS AND THE",0,2+8+16); - gametext(c,32+9+9+9+9+9+9+9+9, "THX-LICENSED SOUND SYSTEM",0,2+8+16); - gametext(c,32+9+9+9+9+9+9+9+9+9, "FOR INFO CALL 1-800-548-0620",0,2+8+16); - - gametext(c,32+9+9+9+9+9+9+9+9+9+9+9,"CREATIVE LABS, INC.",0,2+8+16); - - gametext(c,32+9+9+9+9+9+9+9+9+9+9+9+9+9,"THANKS FOR THE HARDWARE, GUYS.",0,2+8+16); - break; - case 997: - gametext(c,50, "DUKE NUKEM IS A TRADEMARK OF",0,2+8+16); - gametext(c,50+9, "3D REALMS ENTERTAINMENT",0,2+8+16); - - gametext(c,50+9+9+9, "DUKE NUKEM",0,2+8+16); - gametext(c,50+9+9+9+9, "(C) 1996 3D REALMS ENTERTAINMENT",0,2+8+16); - - if (VOLUMEONE) { - gametext(c,106, "PLEASE READ LICENSE.DOC FOR SHAREWARE",0,2+8+16); - gametext(c,106+9, "DISTRIBUTION GRANTS AND RESTRICTIONS",0,2+8+16); - } - - gametext(c,VOLUMEONE?134:115, "MADE IN DALLAS, TEXAS USA",0,2+8+16); - break; - case 998: - l = 10; - goto cheat_for_port_credits; - } - break; - } - - // Plutonium pak menus - switch (current_menu) - { - case 990: - case 991: - case 992: - rotatesprite(160<<16,200<<15,65536L,0,2504+current_menu-990,0,0,10+64,0,0,xdim-1,ydim-1); - break; - case 993: // JBF 20031220 - rotatesprite(160<<16,200<<15,65536L,0,MENUSCREEN,0,0,10+64,0,0,xdim-1,ydim-1); - rotatesprite(c<<16,19<<16,65536L,0,MENUBAR,0,0,10,0,0,xdim-1,ydim-1); - menutext(160,24,0,0,"ABOUT EDUKE32"); - -cheat_for_port_credits: - if (conversion == 13) l = (-2); - gametext(160,38-l,"GAME PROGRAMMING",0,2+8+16); - p = "Richard \"TerminX\" Gobeille"; - minitext(161-(Bstrlen(p)<<1), 39+10-l, p, 4, 10+16+128); - minitext(160-(Bstrlen(p)<<1), 38+10-l, p, 8, 10+16+128); - - gametext(160,57-l,"\"JFDUKE3D\" AND \"JFBUILD\" CODE",0,2+8+16); - p = "Jonathon \"JonoF\" Fowler"; - minitext(161-(Bstrlen(p)<<1), 58+10-l, p, 4, 10+16+128); - minitext(160-(Bstrlen(p)<<1), 57+10-l, p, 8, 10+16+128); - - gametext(160,76-l,"ORIGINAL \"POLYMOST\" RENDERER",0,2+8+16); - gametext(160,76+8-l,"NETWORKING, OTHER CODE",0,2+8+16); - p = "Ken \"Awesoken\" Silverman"; - minitext(161-(Bstrlen(p)<<1), 77+8+10-l, p, 4, 10+16+128); - minitext(160-(Bstrlen(p)<<1), 76+8+10-l, p, 8, 10+16+128); - - gametext(160,103-l,"RENDERING FEATURES",0,2+8+16); - p = "Pierre-Loup \"Plagman\" Griffais"; - minitext(161-(Bstrlen(p)<<1), 104+10-l, p, 4, 10+16+128); - minitext(160-(Bstrlen(p)<<1), 103+10-l, p, 8, 10+16+128); - - gametext(160,122-l,"LICENSE AND OTHER CONTRIBUTORS",0,2+8+16); + if (!VOLUMEALL) { - const char *scroller[] = { - "This program is distributed under the terms of the", - "GNU General Public License version 2 as published by the", - "Free Software Foundation. See GNU.TXT for details.", - "", - "Thanks to the following people for their contributions:", - "", - "Adam Fazakerley", - "Ed Coolidge", - "Javier Martinez", - "Jeff Hart", - "Jonathan Smith", - "Jose del Castillo", - "Lachlan McDonald", - "Matthew Palmer", - "Peter Green", - "", - "EDuke originally by Matt Saettler", - "", - "--x--", - "", - "", - "", - "", - "", - "" - }; - const int numlines = sizeof(scroller)/sizeof(char *); - for (m=0,i=(totalclock/104)%numlines; m<6; m++,i++) { - if (i==numlines) i=0; - minitext(161-(Bstrlen(scroller[i])<<1), 101+10+10+8+4+(m*7)-l, (char*)scroller[i], 4, 10+16+128); - minitext(160-(Bstrlen(scroller[i])<<1), 100+10+10+8+4+(m*7)-l, (char*)scroller[i], 8, 10+16+128); - } - } - p = "Visit www.eduke32.com for news and updates"; - minitext(161-(Bstrlen(p)<<1), 136+10+10+10+10+4-l, p, 4, 10+16+128); - minitext(160-(Bstrlen(p)<<1), 135+10+10+10+10+4-l, p, 8, 10+16+128); - } - break; - - case 0: - c = (320>>1); - rotatesprite(c<<16,28<<16,65536L,0,INGAMEDUKETHREEDEE,0,0,10,0,0,xdim-1,ydim-1); - 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 (ud.multimode > 1 && x == 0 && ud.recstat != 2) - { - if (movesperpacket == 4 && myconnectindex != connecthead) - break; - - last_zero = 0; - cmenu(600); + menutext(c,67+16+16+16/*+16*/,MENUHIGHLIGHT(3),PHX(-5),"HOW TO ORDER"); } else { - last_zero = x; - switch (x) - { + + menutext(c,67+16+16+16/*+16*/,MENUHIGHLIGHT(3),PHX(-5),"HELP"); + } + + menutext(c,67+16+16+16+16/*+16*/,MENUHIGHLIGHT(4),PHX(-6),"CREDITS"); + + + menutext(c,67+16+16+16+16+16/*+16*/,MENUHIGHLIGHT(5),PHX(-7),"QUIT"); + break; + + case 50: + c = (320>>1); + rotatesprite(c<<16,32<<16,65536L,0,INGAMEDUKETHREEDEE,0,0,10,0,0,xdim-1,ydim-1); + 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) + { case 0: - cmenu(100); + if (movesperpacket == 4 && myconnectindex != connecthead) + break; + if (ud.multimode < 2 || ud.recstat == 2) + cmenu(1500); + else + { + cmenu(600); + last_fifty = 0; + } 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 + if (movesperpacket == 4 && connecthead != myconnectindex) + break; + if (ud.recstat != 2) + { + last_fifty = 1; + cmenu(350); + setview(0,0,xdim-1,ydim-1); + } + break; case 2: if (movesperpacket == 4 && connecthead != myconnectindex) break; + last_fifty = 2; cmenu(300); break; case 3: - KB_FlushKeyboardQueue();cmenu(400);break; + last_fifty = 3; + cmenu(202); // JBF 20031205: was 200 + break; case 4: - cmenu(990);break; + last_fifty = 4; + KB_FlushKeyboardQueue(); + cmenu(400); + break; case 5: - cmenu(500);break; - } - } - } - - if (KB_KeyPressed(sc_Q)) cmenu(500); - - if (x == -1 && (ps[myconnectindex].gm&MODE_GAME || ud.recstat == 2)) - { - ps[myconnectindex].gm &= ~MODE_MENU; - if (ud.multimode < 2 && ud.recstat != 2) - { - ready2send = 1; - totalclock = ototalclock; - } - } - - if (movesperpacket == 4) - { - if (myconnectindex == connecthead) - menutext(c,67,MENUHIGHLIGHT(0),PHX(-2),"NEW GAME"); - else - menutext(c,67,MENUHIGHLIGHT(0),1,"NEW GAME"); - } - else - menutext(c,67,MENUHIGHLIGHT(0),PHX(-2),"NEW GAME"); - - // menutext(c,67+16,0,1,"NETWORK GAME"); - - menutext(c,67+16/*+16*/,MENUHIGHLIGHT(1),PHX(-3),"OPTIONS"); - - 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"); - - if (!VOLUMEALL) { - - menutext(c,67+16+16+16/*+16*/,MENUHIGHLIGHT(3),PHX(-5),"HOW TO ORDER"); - } else { - - menutext(c,67+16+16+16/*+16*/,MENUHIGHLIGHT(3),PHX(-5),"HELP"); - } - - menutext(c,67+16+16+16+16/*+16*/,MENUHIGHLIGHT(4),PHX(-6),"CREDITS"); - - - menutext(c,67+16+16+16+16+16/*+16*/,MENUHIGHLIGHT(5),PHX(-7),"QUIT"); - break; - - case 50: - c = (320>>1); - rotatesprite(c<<16,32<<16,65536L,0,INGAMEDUKETHREEDEE,0,0,10,0,0,xdim-1,ydim-1); - 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) - { - case 0: - if (movesperpacket == 4 && myconnectindex != connecthead) - break; - if (ud.multimode < 2 || ud.recstat == 2) - cmenu(1500); - else - { - cmenu(600); - last_fifty = 0; - } - break; - case 1: - if (movesperpacket == 4 && connecthead != myconnectindex) - break; - if (ud.recstat != 2) - { - last_fifty = 1; - cmenu(350); - setview(0,0,xdim-1,ydim-1); - } - break; - case 2: - if (movesperpacket == 4 && connecthead != myconnectindex) - break; - last_fifty = 2; - cmenu(300); - break; - case 3: - last_fifty = 3; - cmenu(202); // JBF 20031205: was 200 - break; - case 4: - last_fifty = 4; - KB_FlushKeyboardQueue(); - cmenu(400); - break; - case 5: - if (numplayers < 2) - { - last_fifty = 5; - cmenu(501); - } - break; - case 6: - last_fifty = 6; - cmenu(500); - break; - case -1: - ps[myconnectindex].gm &= ~MODE_MENU; - if (ud.multimode < 2 && ud.recstat != 2) - { - ready2send = 1; - totalclock = ototalclock; - } - break; - } - - if (KB_KeyPressed(sc_Q)) - cmenu(500); - - if (movesperpacket == 4 && connecthead != myconnectindex) - { - menutext(c,67 ,MENUHIGHLIGHT(0),1,"NEW GAME"); - menutext(c,67+16 ,MENUHIGHLIGHT(1),1,"SAVE GAME"); - menutext(c,67+16+16 ,MENUHIGHLIGHT(2),1,"LOAD GAME"); - } - else - { - menutext(c,67 ,MENUHIGHLIGHT(0),PHX(-2),"NEW GAME"); - menutext(c,67+16 ,MENUHIGHLIGHT(1),PHX(-3),"SAVE GAME"); - menutext(c,67+16+16 ,MENUHIGHLIGHT(2),PHX(-4),"LOAD GAME"); - } - - menutext(c,67+16+16+16 ,MENUHIGHLIGHT(3),PHX(-5),"OPTIONS"); - if (!VOLUMEALL) { - menutext(c,67+16+16+16+16 ,MENUHIGHLIGHT(4),PHX(-6),"HOW TO ORDER"); - } else { - menutext(c,67+16+16+16+16 ,MENUHIGHLIGHT(4),PHX(-6)," HELP"); - } - 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"); - break; - - case 100: - 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 (VOLUMEONE) { - if (x > 0) - cmenu(20000); - else - { - ud.m_volume_number = x; - ud.m_level_number = 0; - last_onehundred = x; - cmenu(110); - } - } - - if (!VOLUMEONE) { - if (x == num_volumes /*&& boardfilename[0]*/) - { - //ud.m_volume_number = 0; - //ud.m_level_number = 7; - currentlist = 1; - last_onehundred = x; - cmenu(101); - } - else - { - ud.m_volume_number = x; - ud.m_level_number = 0; - last_onehundred = x; - cmenu(110); - } - } - } - else if (x == -1) - { - if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); - else cmenu(0); - } - - - - c = 80; - if (VOLUMEONE) { - menutext(160,60,MENUHIGHLIGHT(0),PHX(-2),volume_names[0]); - menutext(160,60+20,MENUHIGHLIGHT(1),1,volume_names[1]); - menutext(160,60+20+20,MENUHIGHLIGHT(2),1,volume_names[2]); - if (PLUTOPAK) - menutext(160,60+20+20,MENUHIGHLIGHT(3),1,volume_names[3]); - } else { - for (i=0;i 0) - { - while (KB_KeyPressed(sc_End)?seeker->next:seeker->prev) - seeker = KB_KeyPressed(sc_End)?seeker->next:seeker->prev; - if (seeker) { - if (currentlist) findfileshigh = seeker; - else finddirshigh = seeker; - sound(KICK_HIT); - } - } - 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) - seeker = KB_KeyPressed(sc_PgDn)?seeker->next:seeker->prev; - i--; - } - if (seeker) { - if (currentlist) findfileshigh = seeker; - else finddirshigh = seeker; - sound(KICK_HIT); - } - } - else - { - char ch2, ch; - ch = KB_Getch(); - if (ch > 0 && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9'))) { - if (ch >= 'a') ch -= ('a'-'A'); - while (seeker) { - ch2 = seeker->name[0]; - if (ch2 >= 'a' && ch2 <= 'z') ch2 -= ('a'-'A'); - if (ch2 == ch) break; - seeker = seeker->next; + if (numplayers < 2) + { + last_fifty = 5; + cmenu(501); } - if (seeker) { + break; + case 6: + last_fifty = 6; + cmenu(500); + break; + case -1: + ps[myconnectindex].gm &= ~MODE_MENU; + if (ud.multimode < 2 && ud.recstat != 2) + { + ready2send = 1; + totalclock = ototalclock; + } + break; + } + + if (KB_KeyPressed(sc_Q)) + cmenu(500); + + if (movesperpacket == 4 && connecthead != myconnectindex) + { + menutext(c,67 ,MENUHIGHLIGHT(0),1,"NEW GAME"); + menutext(c,67+16 ,MENUHIGHLIGHT(1),1,"SAVE GAME"); + menutext(c,67+16+16 ,MENUHIGHLIGHT(2),1,"LOAD GAME"); + } + else + { + menutext(c,67 ,MENUHIGHLIGHT(0),PHX(-2),"NEW GAME"); + menutext(c,67+16 ,MENUHIGHLIGHT(1),PHX(-3),"SAVE GAME"); + menutext(c,67+16+16 ,MENUHIGHLIGHT(2),PHX(-4),"LOAD GAME"); + } + + menutext(c,67+16+16+16 ,MENUHIGHLIGHT(3),PHX(-5),"OPTIONS"); + if (!VOLUMEALL) + { + menutext(c,67+16+16+16+16 ,MENUHIGHLIGHT(4),PHX(-6),"HOW TO ORDER"); + } + else + { + menutext(c,67+16+16+16+16 ,MENUHIGHLIGHT(4),PHX(-6)," HELP"); + } + 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"); + break; + + case 100: + 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 (VOLUMEONE) + { + if (x > 0) + cmenu(20000); + else + { + ud.m_volume_number = x; + ud.m_level_number = 0; + last_onehundred = x; + cmenu(110); + } + } + + if (!VOLUMEONE) + { + if (x == num_volumes /*&& boardfilename[0]*/) + { + //ud.m_volume_number = 0; + //ud.m_level_number = 7; + currentlist = 1; + last_onehundred = x; + cmenu(101); + } + else + { + ud.m_volume_number = x; + ud.m_level_number = 0; + last_onehundred = x; + cmenu(110); + } + } + } + else if (x == -1) + { + if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); + else cmenu(0); + } + + + + c = 80; + if (VOLUMEONE) + { + menutext(160,60,MENUHIGHLIGHT(0),PHX(-2),volume_names[0]); + menutext(160,60+20,MENUHIGHLIGHT(1),1,volume_names[1]); + menutext(160,60+20+20,MENUHIGHLIGHT(2),1,volume_names[2]); + if (PLUTOPAK) + menutext(160,60+20+20,MENUHIGHLIGHT(3),1,volume_names[3]); + } + else + { + for (i=0;i 0) + { + while (KB_KeyPressed(sc_End)?seeker->next:seeker->prev) + seeker = KB_KeyPressed(sc_End)?seeker->next:seeker->prev; + if (seeker) + { if (currentlist) findfileshigh = seeker; else finddirshigh = seeker; sound(KICK_HIT); } } + 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) + seeker = KB_KeyPressed(sc_PgDn)?seeker->next:seeker->prev; + i--; + } + if (seeker) + { + if (currentlist) findfileshigh = seeker; + else finddirshigh = seeker; + sound(KICK_HIT); + } + } + else + { + char ch2, ch; + ch = KB_Getch(); + if (ch > 0 && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9'))) + { + if (ch >= 'a') ch -= ('a'-'A'); + while (seeker) + { + ch2 = seeker->name[0]; + if (ch2 >= 'a' && ch2 <= 'z') ch2 -= ('a'-'A'); + if (ch2 == ch) break; + seeker = seeker->next; + } + if (seeker) + { + if (currentlist) findfileshigh = seeker; + else finddirshigh = seeker; + sound(KICK_HIT); + } + } + } } - } - gametext(40+4,12+32,"DIRECTORIES",0,2+8+16); + gametext(40+4,12+32,"DIRECTORIES",0,2+8+16); - 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) { - if (dir == finddirshigh) c=0; else c=16; - minitextshade(40,1+12+32+8*(3-i),dir->name,c,0,26); - } - } - - gametext(40+4,8+32+40+8-1,"MAP FILES",0,2+8+16); - - 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) { - 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) || - KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) || ((buttonstat&1) && minfo.dyaw > 256) || - KB_KeyPressed(sc_Tab)) - { - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_kpad_4); - KB_ClearKeyDown(sc_RightArrow); - KB_ClearKeyDown(sc_kpad_6); - KB_ClearKeyDown(sc_Tab); - currentlist = 1-currentlist; - sound(KICK_HIT); - } - - onbar = 0; - probey = 2; - if (currentlist == 0) x = probe(50,12+32+16+4,0,3); - else x = probe(50,8+32+40+40+4,0,3); - - if (probey == 1) { - if (currentlist == 0) { - if (finddirshigh) - if (finddirshigh->prev) finddirshigh = finddirshigh->prev; - } else { - if (findfileshigh) - if (findfileshigh->prev) findfileshigh = findfileshigh->prev; - } - } else if (probey == 0) { - if (currentlist == 0) { - if (finddirshigh) - if (finddirshigh->next) finddirshigh = finddirshigh->next; - } else { - if (findfileshigh) - if (findfileshigh->next) findfileshigh = findfileshigh->next; - } - } - - if (x == -1) { - clearfilenames(); - boardfilename[0] = 0; - if (ud.multimode > 1) + if (finddirshigh) { - sendboardname(); - cmenu(600); - probey = last_probey; - } else cmenu(100); - } - else if (x >= 0) - { - if (currentlist == 0) { - if (!finddirshigh) break; - strcat(boardfilename, finddirshigh->name); - strcat(boardfilename, "/"); - Bcorrectfilename(boardfilename, 1); - cmenu(101); - KB_FlushKeyboardQueue(); - } else { - if (!findfileshigh) break; - strcat(boardfilename, findfileshigh->name); - ud.m_volume_number = 0; - ud.m_level_number = 7; + 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) + { + if (dir == finddirshigh) c=0; + else c=16; + minitextshade(40,1+12+32+8*(3-i),dir->name,c,0,26); + } + } + + gametext(40+4,8+32+40+8-1,"MAP FILES",0,2+8+16); + + 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) + { + 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) || + KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) || ((buttonstat&1) && minfo.dyaw > 256) || + KB_KeyPressed(sc_Tab)) + { + KB_ClearKeyDown(sc_LeftArrow); + KB_ClearKeyDown(sc_kpad_4); + KB_ClearKeyDown(sc_RightArrow); + KB_ClearKeyDown(sc_kpad_6); + KB_ClearKeyDown(sc_Tab); + currentlist = 1-currentlist; + sound(KICK_HIT); + } + + onbar = 0; + probey = 2; + if (currentlist == 0) x = probe(50,12+32+16+4,0,3); + else x = probe(50,8+32+40+40+4,0,3); + + if (probey == 1) + { + if (currentlist == 0) + { + if (finddirshigh) + if (finddirshigh->prev) finddirshigh = finddirshigh->prev; + } + else + { + if (findfileshigh) + if (findfileshigh->prev) findfileshigh = findfileshigh->prev; + } + } + else if (probey == 0) + { + if (currentlist == 0) + { + if (finddirshigh) + if (finddirshigh->next) finddirshigh = finddirshigh->next; + } + else + { + if (findfileshigh) + if (findfileshigh->next) findfileshigh = findfileshigh->next; + } + } + + if (x == -1) + { + clearfilenames(); + boardfilename[0] = 0; if (ud.multimode > 1) { sendboardname(); cmenu(600); probey = last_probey; - } else cmenu(110); + } + else cmenu(100); } - clearfilenames(); - } - break; - - case 110: - c = (320>>1); - 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) - { - switch (x) + else if (x >= 0) { - 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; - else ud.m_respawn_monsters = 0; - - ud.m_monsters_off = ud.monsters_off = 0; - - ud.m_respawn_items = 0; - ud.m_respawn_inventory = 0; - - ud.multimode = 1; - - if (ud.m_volume_number == 3) - { - flushperms(); - setview(0,0,xdim-1,ydim-1); - clearview(0L); - nextpage(); - } - - newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill); - if (enterlevel(MODE_GAME)) backtomenu(); - } - else if (x == -1) - { - cmenu(100); - KB_FlushKeyboardQueue(); - } - - menutext(c,70,MENUHIGHLIGHT(0),PHX(-2),skill_names[0]); - menutext(c,70+19,MENUHIGHLIGHT(1),PHX(-3),skill_names[1]); - menutext(c,70+19+19,MENUHIGHLIGHT(2),PHX(-4),skill_names[2]); - menutext(c,70+19+19+19,MENUHIGHLIGHT(3),PHX(-5),skill_names[3]); - break; - case 230: -#if defined(POLYMOST) && defined(USE_OPENGL) - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"ADVANCED VIDEO"); - - c = (320>>1)-120; - - { - int io, ii, yy, d=c+160+40, enabled; - char *opts[] = { - "Widescreen", - "-", - "Hightile textures", - "Precache textures", - "GL texture compression", - "Cache textures on disk", - "Compress disk cache", - "-", - "Models", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - NULL - }; - - yy = 37; - for (ii=io=0; opts[ii]; ii++) { - if (opts[ii][0] == '-' && !opts[ii][1]) { - if (io <= probey) yy += 4; - continue; + if (currentlist == 0) + { + if (!finddirshigh) break; + strcat(boardfilename, finddirshigh->name); + strcat(boardfilename, "/"); + Bcorrectfilename(boardfilename, 1); + cmenu(101); + KB_FlushKeyboardQueue(); } - if (io < probey) yy += 8; - io++; - } - - onbar = 0; - x = probesm(c,yy+5,0,io); - - if (x == -1) { cmenu(203); probey = 7; break; } - - yy = 37; - for (ii=io=0; opts[ii]; ii++) { - if (opts[ii][0] == '-' && !opts[ii][1]) { - yy += 4; - continue; - } - enabled = 1; - switch (io) { - 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; - modval(0,1,(int *)&usehightile,1,probey==io); - gametextpal(d,yy, usehightile ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - 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; - 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); - 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); - 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; - modval(0,1,(int *)&usemodels,1,probey==io); - gametextpal(d,yy, usemodels ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; - default: - break; - } - gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); - io++; - yy += 8; - } - } -#endif - break; - - case 200: - - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"GAME SETUP"); - - c = (320>>1)-120; - - { - int io, ii, yy, d=c+160+40, enabled; - char *opts[] = { - "Crosshair", - "Level stats", - "-", - "Screen size", - "Status bar size", - "-", - "Run key style", - "-", - "Detail", - "Shadows", - "Screen tilting", - "-", - "Show opponent weapon", - "Demo playback cameras", - "Record demo", - "-", - "-", - "-", - "More...", - NULL - }; - - yy = 37; - for (ii=io=0; opts[ii]; ii++) { - if (opts[ii][0] == '-' && !opts[ii][1]) { - if (io <= probey) yy += 4; - continue; - } - if (io < probey) yy += 8; - io++; - } - - onbar = (probey == 2 || probey == 3); - x = probesm(c,yy+5,0,io); - - if (x == -1) { - cmenu(202); - break; - } - - yy = 37; - for (ii=io=0; opts[ii]; ii++) { - if (opts[ii][0] == '-' && !opts[ii][1]) { - yy += 4; - continue; - } - enabled = 1; - switch (io) { - 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; - modval(0,1,(int *)&ud.levelstats,1,probey==io); - gametextpal(d,yy, ud.levelstats ? "Shown" : "Hidden", MENUHIGHLIGHT(io), 0); break; - case 2: + else + { + if (!findfileshigh) break; + strcat(boardfilename, findfileshigh->name); + ud.m_volume_number = 0; + ud.m_level_number = 7; + if (ud.multimode > 1) { - 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) - { - ud.statusbarmode = 0; - if (ud.statusbarscale != 100) - ud.screen_size = i; - } - else if (i > ud.screen_size && i == 8 && ud.statusbarmode == 0 && bpp > 8) - { - if (ud.statusbarscale != 100) - { - ud.statusbarmode = 1; - ud.screen_size = i; - } - } + sendboardname(); + cmenu(600); + probey = last_probey; } - break; - case 3: - { - short sbs, sbsl; - sbs = sbsl = ud.statusbarscale-37; - barsm(d+8,yy+7, (short *)&sbs,8,x==io,MENUHIGHLIGHT(io),PHX(-5)); - if (x == io && sbs != sbsl) { - sbs += 37; - setstatusbarscale(sbs); - } - } - break; - 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; - 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; - 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; - 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; - 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; - 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) { - enabled = !((ps[myconnectindex].gm&MODE_GAME) && ud.m_recstat != 1); - if ((ps[myconnectindex].gm&MODE_GAME)) closedemowrite(); - else ud.m_recstat = !ud.m_recstat; - } - 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; + else cmenu(110); } - gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); - io++; - yy += 8; + clearfilenames(); } - } - break; - - case 201: - - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"GAME SETUP"); - - c = (320>>1)-120; - - { - int io, ii, yy, d=c+160+40, enabled; - char *opts[] = { - "Parental lock", - "-", - "HUD weapon", - "FPS counter", - "-", - "Automatic voting", - "Send MP messages to all", - "Display other player IDs", - "-", - "Show startup window", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - "-", - "Previous page", - NULL - }; - - yy = 37; - for (ii=io=0; opts[ii]; ii++) { - if (opts[ii][0] == '-' && !opts[ii][1]) { - if (io <= probey) yy += 4; - continue; - } - if (io < probey) yy += 8; - io++; - } - - x = probesm(c,yy+5,0,io); - - if (x == -1) { cmenu(200); probey = 11; break; } - - yy = 37; - for (ii=io=0; opts[ii]; ii++) { - if (opts[ii][0] == '-' && !opts[ii][1]) { - yy += 4; - continue; - } - 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; } - 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; - 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; } - 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; - 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; - 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; - 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; - } - gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); - io++; - yy += 8; - } - } - break; - - // JBF 20031205: Second level options menu selection - case 202: - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"OPTIONS"); - - c = 50; - - onbar = 0; - x = probe(160,c,18,7); - - last_twoohtwo = probey; - - switch (x) { - case -1: - if (ps[myconnectindex].gm&MODE_GAME) cmenu(50);else cmenu(0); break; - case 0: - cmenu(200); - break; - - case 1: - cmenu(700); - break; - - case 2: + case 110: + c = (320>>1); + 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) { - int dax = xdim, day = ydim, daz; - curvidmode = newvidmode = checkvideomode(&dax,&day,bpp,fullscreen,0); - if (newvidmode == 0x7fffffffl) newvidmode = validmodecnt; - newfullscreen = fullscreen; - changesmade = 0; - - dax = 0; - for (day = 0; day < validmodecnt; day++) { - if (dax == sizeof(vidsets)/sizeof(vidsets[1])) break; - for (daz = 0; daz < dax; daz++) - if ((validmode[day].bpp|((validmode[day].fs&1)<<16)) == (vidsets[daz]&0x1ffffl)) break; - if (vidsets[daz] != -1) continue; - if (validmode[day].bpp == 8) { - vidsets[dax++] = 8|((validmode[day].fs&1)<<16); - vidsets[dax++] = 0x20000|8|((validmode[day].fs&1)<<16); - } else - vidsets[dax++] = 0x20000|validmode[day].bpp|((validmode[day].fs&1)<<16); + 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; } - for (dax = 0; dax < (long)(sizeof(vidsets)/sizeof(vidsets[1])) && vidsets[dax] != -1; dax++) - if (vidsets[dax] == (((getrendermode()>=2)<<17)|(fullscreen<<16)|bpp)) break; - if (dax < (long)(sizeof(vidsets)/sizeof(vidsets[1]))) newvidset = dax; - curvidset = newvidset; - cmenu(203); + sound(globalskillsound); + + ud.m_player_skill = x+1; + if (x == 3) ud.m_respawn_monsters = 1; + else ud.m_respawn_monsters = 0; + + ud.m_monsters_off = ud.monsters_off = 0; + + ud.m_respawn_items = 0; + ud.m_respawn_inventory = 0; + + ud.multimode = 1; + + if (ud.m_volume_number == 3) + { + flushperms(); + setview(0,0,xdim-1,ydim-1); + clearview(0L); + nextpage(); + } + + newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill); + if (enterlevel(MODE_GAME)) backtomenu(); } + else if (x == -1) + { + cmenu(100); + KB_FlushKeyboardQueue(); + } + + menutext(c,70,MENUHIGHLIGHT(0),PHX(-2),skill_names[0]); + menutext(c,70+19,MENUHIGHLIGHT(1),PHX(-3),skill_names[1]); + menutext(c,70+19+19,MENUHIGHLIGHT(2),PHX(-4),skill_names[2]); + menutext(c,70+19+19+19,MENUHIGHLIGHT(3),PHX(-5),skill_names[3]); break; - case 3: - if (ud.recstat != 1) - cmenu(20002); - break; - case 4: - currentlist = 0; - case 5: - case 6: - if (x==6 && !CONTROL_JoyPresent) break; - cmenu(204+x-4); - break; - } - - menutext(160,c, MENUHIGHLIGHT(0),0,"GAME SETUP"); - menutext(160,c+18, MENUHIGHLIGHT(1),0,"SOUND SETUP"); - menutext(160,c+18+18, MENUHIGHLIGHT(2),0,"VIDEO SETUP"); - menutext(160,c+18+18+18, MENUHIGHLIGHT(3),ud.recstat == 1,"PLAYER SETUP"); - menutext(160,c+18+18+18+18, MENUHIGHLIGHT(4),0,"KEYBOARD SETUP"); - menutext(160,c+18+18+18+18+18, MENUHIGHLIGHT(5),0,"MOUSE SETUP"); - menutext(160,c+18+18+18+18+18+18,MENUHIGHLIGHT(6),CONTROL_JoyPresent==0,"JOYSTICK SETUP"); - break; - - // JBF 20031206: Video settings menu - case 203: - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"VIDEO SETUP"); - - c = (320>>1)-120; - + case 230: #if defined(POLYMOST) && defined(USE_OPENGL) - x = 8; -#else - x = 5; -#endif - onbar = (probey == 4); - if (probey == 0 || probey == 1 || probey == 2) - x = probe(c,50,16,x); - else if (probey == 3) - x = probe(c,50+16+16+22,0,x); - else - x = probe(c,50+62-16-16-16,16,x); + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"ADVANCED VIDEO"); - if (probey==0 && (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_RightArrow))) { - sound(PISTOL_BODYHIT); - x=0; - } - switch (x) { - case -1: - cmenu(202); - probey = 2; - break; + c = (320>>1)-120; - case 0: - do { - if (KB_KeyPressed(sc_LeftArrow)) { - newvidmode--; - if (newvidmode < 0) newvidmode = validmodecnt-1; - } else { - newvidmode++; - if (newvidmode >= validmodecnt) newvidmode = 0; - } - } while ((validmode[newvidmode].fs&1) != ((vidsets[newvidset]>>16)&1) || validmode[newvidmode].bpp != (vidsets[newvidset] & 0x0ffff)); - //OSD_Printf("New mode is %dx%dx%d-%d %d\n",validmode[newvidmode].xdim,validmode[newvidmode].ydim,validmode[newvidmode].bpp,validmode[newvidmode].fs,newvidmode); - if ((curvidmode == 0x7fffffffl && newvidmode == validmodecnt) || curvidmode == newvidmode) - changesmade &= ~1; - else - changesmade |= 1; - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_RightArrow); - break; - - case 1: { - int lastvidset, lastvidmode, safevidmode = -1; - lastvidset = newvidset; - lastvidmode = newvidmode; - // find the next vidset compatible with the current fullscreen setting - while (vidsets[0] != -1) { - newvidset++; - if (newvidset == sizeof(vidsets)/sizeof(vidsets[0]) || vidsets[newvidset] == -1) { newvidset = -1; continue; } - if (((vidsets[newvidset]>>16)&1) != newfullscreen) continue; - break; - } + int io, ii, yy, d=c+160+40, enabled; + char *opts[] = { + "Widescreen", + "-", + "Hightile textures", + "Precache textures", + "GL texture compression", + "Cache textures on disk", + "Compress disk cache", + "-", + "Models", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + NULL + }; - if ((vidsets[newvidset] & 0x0ffff) != (vidsets[lastvidset] & 0x0ffff)) { - // adjust the video mode to something legal for the new vidset - do { - newvidmode++; - if (newvidmode == lastvidmode) break; // end of cycle - if (newvidmode >= validmodecnt) { - if (safevidmode != -1) - break; - newvidmode = 0; - } - if (validmode[newvidmode].bpp == (vidsets[newvidset]&0x0ffff) && - validmode[newvidmode].fs == newfullscreen && - validmode[newvidmode].xdim <= validmode[lastvidmode].xdim && - (safevidmode==-1?1:(validmode[newvidmode].xdim>=validmode[safevidmode].xdim)) && - validmode[newvidmode].ydim <= validmode[lastvidmode].ydim && - (safevidmode==-1?1:(validmode[newvidmode].ydim>=validmode[safevidmode].ydim)) - ) - safevidmode = newvidmode; - } while (1); - if (safevidmode == -1) { - //OSD_Printf("No best fit!\n"); - newvidmode = lastvidmode; - newvidset = lastvidset; - } else { - //OSD_Printf("Best fit is %dx%dx%d-%d %d\n",validmode[safevidmode].xdim,validmode[safevidmode].ydim,validmode[safevidmode].bpp,validmode[safevidmode].fs,safevidmode); - newvidmode = safevidmode; - } - } - if (newvidset != curvidset) changesmade |= 4; else changesmade &= ~4; - if (newvidmode != curvidmode) changesmade |= 1; else changesmade &= ~1; - } - break; - - case 2: - newfullscreen = !newfullscreen; - { - int lastvidset, lastvidmode, safevidmode = -1, safevidset = -1; - lastvidset = newvidset; - lastvidmode = newvidmode; - // find the next vidset compatible with the current fullscreen setting - while (vidsets[0] != -1) { - newvidset++; - if (newvidset == lastvidset) break; - if (newvidset == sizeof(vidsets)/sizeof(vidsets[0]) || vidsets[newvidset] == -1) { newvidset = -1; continue; } - if (((vidsets[newvidset]>>16)&1) != newfullscreen) continue; - if ((vidsets[newvidset] & 0x2ffff) != (vidsets[lastvidset] & 0x2ffff)) { - if ((vidsets[newvidset] & 0x20000) == (vidsets[lastvidset] & 0x20000)) safevidset = newvidset; + yy = 37; + for (ii=io=0; opts[ii]; ii++) + { + if (opts[ii][0] == '-' && !opts[ii][1]) + { + if (io <= probey) yy += 4; continue; } + if (io < probey) yy += 8; + io++; + } + + onbar = 0; + x = probesm(c,yy+5,0,io); + + if (x == -1) + { + cmenu(203); + probey = 7; break; } - if (newvidset == lastvidset) { - if (safevidset == -1) { - newfullscreen = !newfullscreen; - break; - } else { - newvidset = safevidset; + + yy = 37; + for (ii=io=0; opts[ii]; ii++) + { + if (opts[ii][0] == '-' && !opts[ii][1]) + { + yy += 4; + continue; } + enabled = 1; + switch (io) + { + 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; + modval(0,1,(int *)&usehightile,1,probey==io); + gametextpal(d,yy, usehightile ? "On" : "Off", MENUHIGHLIGHT(io), 0); + break; + 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; + 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); + 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); + 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; + modval(0,1,(int *)&usemodels,1,probey==io); + gametextpal(d,yy, usemodels ? "On" : "Off", MENUHIGHLIGHT(io), 0); + break; + default: + break; + } + gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); + io++; + yy += 8; } - - // adjust the video mode to something legal for the new vidset - do { - newvidmode++; - if (newvidmode == lastvidmode) break; // end of cycle - if (newvidmode >= validmodecnt) newvidmode = 0; - if (validmode[newvidmode].bpp == (vidsets[newvidset]&0x0ffff) && - validmode[newvidmode].fs == newfullscreen && - validmode[newvidmode].xdim <= validmode[lastvidmode].xdim && - (safevidmode==-1?1:(validmode[newvidmode].xdim>=validmode[safevidmode].xdim)) && - validmode[newvidmode].ydim <= validmode[lastvidmode].ydim && - (safevidmode==-1?1:(validmode[newvidmode].ydim>=validmode[safevidmode].ydim)) - ) - safevidmode = newvidmode; - } while (1); - if (safevidmode == -1) { - //OSD_Printf("No best fit!\n"); - newvidmode = lastvidmode; - newvidset = lastvidset; - newfullscreen = !newfullscreen; - } else { - //OSD_Printf("Best fit is %dx%dx%d-%d %d\n",validmode[safevidmode].xdim,validmode[safevidmode].ydo,,validmode[safevidmode].bpp,validmode[safevidmode].fs,safevidmode); - newvidmode = safevidmode; - } - if (newvidset != curvidset) changesmade |= 4; else changesmade &= ~4; - if (newvidmode != curvidmode) changesmade |= 1; else changesmade &= ~1; } - if (newfullscreen == fullscreen) changesmade &= ~2; else changesmade |= 2; +#endif break; - case 3: - if (!changesmade) break; + case 200: + + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"GAME SETUP"); + + c = (320>>1)-120; + { - long pxdim, pydim, pfs, pbpp, prend; - long nxdim, nydim, nfs, nbpp, nrend; + int io, ii, yy, d=c+160+40, enabled; + char *opts[] = { + "Crosshair", + "Level stats", + "-", + "Screen size", + "Status bar size", + "-", + "Run key style", + "-", + "Detail", + "Shadows", + "Screen tilting", + "-", + "Show opponent weapon", + "Demo playback cameras", + "Record demo", + "-", + "-", + "-", + "More...", + NULL + }; - pxdim = xdim; pydim = ydim; pbpp = bpp; pfs = fullscreen; prend = getrendermode(); - nxdim = (newvidmode==validmodecnt)?xdim:validmode[newvidmode].xdim; - nydim = (newvidmode==validmodecnt)?ydim:validmode[newvidmode].ydim; - nfs = newfullscreen; - nbpp = (newvidmode==validmodecnt)?bpp:validmode[newvidmode].bpp; - nrend = (vidsets[newvidset] & 0x20000) ? (nbpp==8?2:3) : 0; + yy = 37; + for (ii=io=0; opts[ii]; ii++) + { + if (opts[ii][0] == '-' && !opts[ii][1]) + { + if (io <= probey) yy += 4; + continue; + } + if (io < probey) yy += 8; + io++; + } - if (setgamemode(nfs, nxdim, nydim, nbpp) < 0) { - if (setgamemode(pfs, pxdim, pydim, pbpp) < 0) { - setrendermode(prend); - gameexit("Failed restoring old video mode."); - } else onvideomodechange(pbpp > 8); - } else onvideomodechange(nbpp > 8); + onbar = (probey == 2 || probey == 3); + x = probesm(c,yy+5,0,io); - restorepalette = 1; - vscrn(); - setrendermode(nrend); + if (x == -1) + { + cmenu(202); + break; + } - curvidmode = newvidmode; curvidset = newvidset; - changesmade = 0; - - ScreenMode = fullscreen; - ScreenWidth = xdim; - ScreenHeight = ydim; - ScreenBPP = bpp; + yy = 37; + for (ii=io=0; opts[ii]; ii++) + { + if (opts[ii][0] == '-' && !opts[ii][1]) + { + yy += 4; + continue; + } + enabled = 1; + switch (io) + { + 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; + modval(0,1,(int *)&ud.levelstats,1,probey==io); + gametextpal(d,yy, ud.levelstats ? "Shown" : "Hidden", MENUHIGHLIGHT(io), 0); + break; + case 2: + { + 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) + { + ud.statusbarmode = 0; + if (ud.statusbarscale != 100) + ud.screen_size = i; + } + else if (i > ud.screen_size && i == 8 && ud.statusbarmode == 0 && bpp > 8) + { + if (ud.statusbarscale != 100) + { + ud.statusbarmode = 1; + ud.screen_size = i; + } + } + } + break; + case 3: + { + short sbs, sbsl; + sbs = sbsl = ud.statusbarscale-37; + barsm(d+8,yy+7, (short *)&sbs,8,x==io,MENUHIGHLIGHT(io),PHX(-5)); + if (x == io && sbs != sbsl) + { + sbs += 37; + setstatusbarscale(sbs); + } + } + break; + 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; + 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; + 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; + 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; + 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; + 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) + { + enabled = !((ps[myconnectindex].gm&MODE_GAME) && ud.m_recstat != 1); + if ((ps[myconnectindex].gm&MODE_GAME)) closedemowrite(); + else ud.m_recstat = !ud.m_recstat; + } + 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; + } + gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); + io++; + yy += 8; + } } break; - case 4: + case 201: + + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"GAME SETUP"); + + c = (320>>1)-120; + + { + int io, ii, yy, d=c+160+40, enabled; + char *opts[] = { + "Parental lock", + "-", + "HUD weapon", + "FPS counter", + "-", + "Automatic voting", + "Send MP messages to all", + "Display other player IDs", + "-", + "Show startup window", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + "-", + "Previous page", + NULL + }; + + yy = 37; + for (ii=io=0; opts[ii]; ii++) + { + if (opts[ii][0] == '-' && !opts[ii][1]) + { + if (io <= probey) yy += 4; + continue; + } + if (io < probey) yy += 8; + io++; + } + + x = probesm(c,yy+5,0,io); + + if (x == -1) + { + cmenu(200); + probey = 11; + break; + } + + yy = 37; + for (ii=io=0; opts[ii]; ii++) + { + if (opts[ii][0] == '-' && !opts[ii][1]) + { + yy += 4; + continue; + } + 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; + } + 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; + 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; + } + 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; + 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; + 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; + 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; + } + gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2); + io++; + yy += 8; + } + } break; + // JBF 20031205: Second level options menu selection + case 202: + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"OPTIONS"); + + c = 50; + + onbar = 0; + x = probe(160,c,18,7); + + last_twoohtwo = probey; + + switch (x) + { + case -1: + if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); + else cmenu(0); + break; + + case 0: + cmenu(200); + break; + + case 1: + cmenu(700); + break; + + case 2: + { + int dax = xdim, day = ydim, daz; + curvidmode = newvidmode = checkvideomode(&dax,&day,bpp,fullscreen,0); + if (newvidmode == 0x7fffffffl) newvidmode = validmodecnt; + newfullscreen = fullscreen; + changesmade = 0; + + dax = 0; + for (day = 0; day < validmodecnt; day++) + { + if (dax == sizeof(vidsets)/sizeof(vidsets[1])) break; + for (daz = 0; daz < dax; daz++) + if ((validmode[day].bpp|((validmode[day].fs&1)<<16)) == (vidsets[daz]&0x1ffffl)) break; + if (vidsets[daz] != -1) continue; + if (validmode[day].bpp == 8) + { + vidsets[dax++] = 8|((validmode[day].fs&1)<<16); + vidsets[dax++] = 0x20000|8|((validmode[day].fs&1)<<16); + } + else + vidsets[dax++] = 0x20000|validmode[day].bpp|((validmode[day].fs&1)<<16); + } + for (dax = 0; dax < (long)(sizeof(vidsets)/sizeof(vidsets[1])) && vidsets[dax] != -1; dax++) + if (vidsets[dax] == (((getrendermode()>=2)<<17)|(fullscreen<<16)|bpp)) break; + if (dax < (long)(sizeof(vidsets)/sizeof(vidsets[1]))) newvidset = dax; + curvidset = newvidset; + + cmenu(203); + } + break; + case 3: + if (ud.recstat != 1) + cmenu(20002); + break; + case 4: + currentlist = 0; + case 5: + case 6: + if (x==6 && !CONTROL_JoyPresent) break; + cmenu(204+x-4); + break; + } + + menutext(160,c, MENUHIGHLIGHT(0),0,"GAME SETUP"); + menutext(160,c+18, MENUHIGHLIGHT(1),0,"SOUND SETUP"); + menutext(160,c+18+18, MENUHIGHLIGHT(2),0,"VIDEO SETUP"); + menutext(160,c+18+18+18, MENUHIGHLIGHT(3),ud.recstat == 1,"PLAYER SETUP"); + menutext(160,c+18+18+18+18, MENUHIGHLIGHT(4),0,"KEYBOARD SETUP"); + menutext(160,c+18+18+18+18+18, MENUHIGHLIGHT(5),0,"MOUSE SETUP"); + menutext(160,c+18+18+18+18+18+18,MENUHIGHLIGHT(6),CONTROL_JoyPresent==0,"JOYSTICK SETUP"); + break; + + // JBF 20031206: Video settings menu + case 203: + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"VIDEO SETUP"); + + c = (320>>1)-120; + #if defined(POLYMOST) && defined(USE_OPENGL) - 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; - } - gltexapplyprops(); - break; - - case 6: - if (bpp==8) break; - glanisotropy *= 2; - if (glanisotropy > glinfo.maxanisotropy) glanisotropy = 1; - gltexapplyprops(); - break; - case 7: - if (bpp==8) break; - cmenu(230); - break; + x = 8; +#else + x = 5; #endif - } + onbar = (probey == 4); + if (probey == 0 || probey == 1 || probey == 2) + x = probe(c,50,16,x); + else if (probey == 3) + x = probe(c,50+16+16+22,0,x); + else + x = probe(c,50+62-16-16-16,16,x); - menutext(c,50,MENUHIGHLIGHT(0),0,"RESOLUTION"); - sprintf(tempbuf,"%ld x %ld", - (newvidmode==validmodecnt)?xdim:validmode[newvidmode].xdim, - (newvidmode==validmodecnt)?ydim:validmode[newvidmode].ydim); - gametext(c+154,50-8,tempbuf,MENUHIGHLIGHT(0),2+8+16); - - menutext(c,50+16,MENUHIGHLIGHT(1),0,"VIDEO MODE"); - sprintf(tempbuf, "%dbit %s", vidsets[newvidset]&0x0ffff, (vidsets[newvidset]&0x20000)?"Polymost":"Classic"); - gametext(c+154,50+16-8,tempbuf,MENUHIGHLIGHT(1),2+8+16); - - menutext(c,50+16+16,MENUHIGHLIGHT(2),0,"FULLSCREEN"); - menutext(c+154,50+16+16,MENUHIGHLIGHT(2),0,newfullscreen?"YES":"NO"); - - menutext(c+16,50+16+16+22,MENUHIGHLIGHT(3),changesmade==0,"APPLY CHANGES"); - - menutext(c,50+62+16,MENUHIGHLIGHT(4),PHX(-6),"BRIGHTNESS"); - { - short ss = ud.brightness; - bar(c+167,50+62+16,&ss,8,x==4,MENUHIGHLIGHT(4),PHX(-6)); - if (x==4) { - ud.brightness = ss; - setbrightness(ud.brightness>>2,&ps[myconnectindex].palette[0],0); + if (probey==0 && (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_RightArrow))) + { + sound(PISTOL_BODYHIT); + x=0; } - } + switch (x) + { + case -1: + cmenu(202); + probey = 2; + break; + + case 0: + do + { + if (KB_KeyPressed(sc_LeftArrow)) + { + newvidmode--; + if (newvidmode < 0) newvidmode = validmodecnt-1; + } + else + { + newvidmode++; + if (newvidmode >= validmodecnt) newvidmode = 0; + } + } + while ((validmode[newvidmode].fs&1) != ((vidsets[newvidset]>>16)&1) || validmode[newvidmode].bpp != (vidsets[newvidset] & 0x0ffff)); + //OSD_Printf("New mode is %dx%dx%d-%d %d\n",validmode[newvidmode].xdim,validmode[newvidmode].ydim,validmode[newvidmode].bpp,validmode[newvidmode].fs,newvidmode); + if ((curvidmode == 0x7fffffffl && newvidmode == validmodecnt) || curvidmode == newvidmode) + changesmade &= ~1; + else + changesmade |= 1; + KB_ClearKeyDown(sc_LeftArrow); + KB_ClearKeyDown(sc_RightArrow); + break; + + case 1: + { + int lastvidset, lastvidmode, safevidmode = -1; + lastvidset = newvidset; + lastvidmode = newvidmode; + // find the next vidset compatible with the current fullscreen setting + while (vidsets[0] != -1) + { + newvidset++; + if (newvidset == sizeof(vidsets)/sizeof(vidsets[0]) || vidsets[newvidset] == -1) + { + newvidset = -1; + continue; + } + if (((vidsets[newvidset]>>16)&1) != newfullscreen) continue; + break; + } + + if ((vidsets[newvidset] & 0x0ffff) != (vidsets[lastvidset] & 0x0ffff)) + { + // adjust the video mode to something legal for the new vidset + do + { + newvidmode++; + if (newvidmode == lastvidmode) break; // end of cycle + if (newvidmode >= validmodecnt) + { + if (safevidmode != -1) + break; + newvidmode = 0; + } + if (validmode[newvidmode].bpp == (vidsets[newvidset]&0x0ffff) && + validmode[newvidmode].fs == newfullscreen && + validmode[newvidmode].xdim <= validmode[lastvidmode].xdim && + (safevidmode==-1?1:(validmode[newvidmode].xdim>=validmode[safevidmode].xdim)) && + validmode[newvidmode].ydim <= validmode[lastvidmode].ydim && + (safevidmode==-1?1:(validmode[newvidmode].ydim>=validmode[safevidmode].ydim)) + ) + safevidmode = newvidmode; + } + while (1); + if (safevidmode == -1) + { + //OSD_Printf("No best fit!\n"); + newvidmode = lastvidmode; + newvidset = lastvidset; + } + else + { + //OSD_Printf("Best fit is %dx%dx%d-%d %d\n",validmode[safevidmode].xdim,validmode[safevidmode].ydim,validmode[safevidmode].bpp,validmode[safevidmode].fs,safevidmode); + newvidmode = safevidmode; + } + } + if (newvidset != curvidset) changesmade |= 4; + else changesmade &= ~4; + if (newvidmode != curvidmode) changesmade |= 1; + else changesmade &= ~1; + } + break; + + case 2: + newfullscreen = !newfullscreen; + { + int lastvidset, lastvidmode, safevidmode = -1, safevidset = -1; + lastvidset = newvidset; + lastvidmode = newvidmode; + // find the next vidset compatible with the current fullscreen setting + while (vidsets[0] != -1) + { + newvidset++; + if (newvidset == lastvidset) break; + if (newvidset == sizeof(vidsets)/sizeof(vidsets[0]) || vidsets[newvidset] == -1) + { + newvidset = -1; + continue; + } + if (((vidsets[newvidset]>>16)&1) != newfullscreen) continue; + if ((vidsets[newvidset] & 0x2ffff) != (vidsets[lastvidset] & 0x2ffff)) + { + if ((vidsets[newvidset] & 0x20000) == (vidsets[lastvidset] & 0x20000)) safevidset = newvidset; + continue; + } + break; + } + if (newvidset == lastvidset) + { + if (safevidset == -1) + { + newfullscreen = !newfullscreen; + break; + } + else + { + newvidset = safevidset; + } + } + + // adjust the video mode to something legal for the new vidset + do + { + newvidmode++; + if (newvidmode == lastvidmode) break; // end of cycle + if (newvidmode >= validmodecnt) newvidmode = 0; + if (validmode[newvidmode].bpp == (vidsets[newvidset]&0x0ffff) && + validmode[newvidmode].fs == newfullscreen && + validmode[newvidmode].xdim <= validmode[lastvidmode].xdim && + (safevidmode==-1?1:(validmode[newvidmode].xdim>=validmode[safevidmode].xdim)) && + validmode[newvidmode].ydim <= validmode[lastvidmode].ydim && + (safevidmode==-1?1:(validmode[newvidmode].ydim>=validmode[safevidmode].ydim)) + ) + safevidmode = newvidmode; + } + while (1); + if (safevidmode == -1) + { + //OSD_Printf("No best fit!\n"); + newvidmode = lastvidmode; + newvidset = lastvidset; + newfullscreen = !newfullscreen; + } + else + { + //OSD_Printf("Best fit is %dx%dx%d-%d %d\n",validmode[safevidmode].xdim,validmode[safevidmode].ydo,,validmode[safevidmode].bpp,validmode[safevidmode].fs,safevidmode); + newvidmode = safevidmode; + } + if (newvidset != curvidset) changesmade |= 4; + else changesmade &= ~4; + if (newvidmode != curvidmode) changesmade |= 1; + else changesmade &= ~1; + } + if (newfullscreen == fullscreen) changesmade &= ~2; + else changesmade |= 2; + break; + + case 3: + if (!changesmade) break; + { + long pxdim, pydim, pfs, pbpp, prend; + long nxdim, nydim, nfs, nbpp, nrend; + + pxdim = xdim; + pydim = ydim; + pbpp = bpp; + pfs = fullscreen; + prend = getrendermode(); + nxdim = (newvidmode==validmodecnt)?xdim:validmode[newvidmode].xdim; + nydim = (newvidmode==validmodecnt)?ydim:validmode[newvidmode].ydim; + nfs = newfullscreen; + nbpp = (newvidmode==validmodecnt)?bpp:validmode[newvidmode].bpp; + nrend = (vidsets[newvidset] & 0x20000) ? (nbpp==8?2:3) : 0; + + if (setgamemode(nfs, nxdim, nydim, nbpp) < 0) + { + if (setgamemode(pfs, pxdim, pydim, pbpp) < 0) + { + setrendermode(prend); + gameexit("Failed restoring old video mode."); + } + else onvideomodechange(pbpp > 8); + } + else onvideomodechange(nbpp > 8); + + restorepalette = 1; + vscrn(); + setrendermode(nrend); + + curvidmode = newvidmode; + curvidset = newvidset; + changesmade = 0; + + ScreenMode = fullscreen; + ScreenWidth = xdim; + ScreenHeight = ydim; + ScreenBPP = bpp; + } + break; + + case 4: + break; #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; - } - menutext(c+154,50+62+16+16,MENUHIGHLIGHT(5),bpp==8,tempbuf); + 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; + } + gltexapplyprops(); + break; - menutext(c,50+62+16+16+16,MENUHIGHLIGHT(6),bpp==8,"ANISOTROPY"); - if (glanisotropy == 1) strcpy(tempbuf,"NONE"); - else sprintf(tempbuf,"%ld-tap",glanisotropy); - menutext(c+154,50+62+16+16+16,MENUHIGHLIGHT(6),bpp==8,tempbuf); - menutext(c,50+62+16+16+16+16,MENUHIGHLIGHT(7),bpp==8,"ADVANCED SETTINGS"); + case 6: + if (bpp==8) break; + glanisotropy *= 2; + if (glanisotropy > glinfo.maxanisotropy) glanisotropy = 1; + gltexapplyprops(); + break; + case 7: + if (bpp==8) break; + cmenu(230); + break; +#endif + } + + menutext(c,50,MENUHIGHLIGHT(0),0,"RESOLUTION"); + sprintf(tempbuf,"%ld x %ld", + (newvidmode==validmodecnt)?xdim:validmode[newvidmode].xdim, + (newvidmode==validmodecnt)?ydim:validmode[newvidmode].ydim); + gametext(c+154,50-8,tempbuf,MENUHIGHLIGHT(0),2+8+16); + + menutext(c,50+16,MENUHIGHLIGHT(1),0,"VIDEO MODE"); + sprintf(tempbuf, "%dbit %s", vidsets[newvidset]&0x0ffff, (vidsets[newvidset]&0x20000)?"Polymost":"Classic"); + gametext(c+154,50+16-8,tempbuf,MENUHIGHLIGHT(1),2+8+16); + + menutext(c,50+16+16,MENUHIGHLIGHT(2),0,"FULLSCREEN"); + menutext(c+154,50+16+16,MENUHIGHLIGHT(2),0,newfullscreen?"YES":"NO"); + + menutext(c+16,50+16+16+22,MENUHIGHLIGHT(3),changesmade==0,"APPLY CHANGES"); + + menutext(c,50+62+16,MENUHIGHLIGHT(4),PHX(-6),"BRIGHTNESS"); + { + short ss = ud.brightness; + bar(c+167,50+62+16,&ss,8,x==4,MENUHIGHLIGHT(4),PHX(-6)); + if (x==4) + { + ud.brightness = ss; + setbrightness(ud.brightness>>2,&ps[myconnectindex].palette[0],0); + } + } + +#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; + } + menutext(c+154,50+62+16+16,MENUHIGHLIGHT(5),bpp==8,tempbuf); + + menutext(c,50+62+16+16+16,MENUHIGHLIGHT(6),bpp==8,"ANISOTROPY"); + if (glanisotropy == 1) strcpy(tempbuf,"NONE"); + else sprintf(tempbuf,"%ld-tap",glanisotropy); + menutext(c+154,50+62+16+16+16,MENUHIGHLIGHT(6),bpp==8,tempbuf); + menutext(c,50+62+16+16+16+16,MENUHIGHLIGHT(7),bpp==8,"ADVANCED SETTINGS"); #endif - break; - - case 204: - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"KEYBOARD SETUP"); - - c = (320>>1)-120; - - onbar = 0; - x = probe(0,0,0,NUMGAMEFUNCTIONS); - - if (x==-1) { - cmenu(202); - probey = 4; - } else if (x>=0) { - function = probey; - whichkey = currentlist; - cmenu(210); - KB_FlushKeyboardQueue(); - KB_ClearLastScanCode(); break; - } - // the top of our list - m = probey - 6; - if (m < 0) m = 0; - else if (m + 13 >= NUMGAMEFUNCTIONS) m = NUMGAMEFUNCTIONS-13; - - if (probey == gamefunc_Show_Console) currentlist = 0; - else if (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4) || - KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) || - KB_KeyPressed(sc_Tab)) { - currentlist ^= 1; - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_RightArrow); - KB_ClearKeyDown(sc_kpad_4); - KB_ClearKeyDown(sc_kpad_6); - KB_ClearKeyDown(sc_Tab); - sound(KICK_HIT); - } else if (KB_KeyPressed(sc_Delete)) { - KeyboardKeys[probey][currentlist] = 0; - CONTROL_MapKey(probey, KeyboardKeys[probey][0], KeyboardKeys[probey][1]); - sound(KICK_HIT); - KB_ClearKeyDown(sc_Delete); - } - - for (l=0; l < min(13,NUMGAMEFUNCTIONS); l++) { - p = CONFIG_FunctionNumToName(m+l); - if (!p) continue; - - strcpy(tempbuf, p); - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitextshade(70,34+l*8,tempbuf,(m+l == probey)?0:16,1,10+16); - - //strcpy(tempbuf, KB_ScanCodeToString(KeyboardKeys[m+l][0])); - strcpy(tempbuf, getkeyname(KeyboardKeys[m+l][0])); - if (!tempbuf[0]) strcpy(tempbuf, " -"); - minitextshade(70+100,34+l*8,tempbuf, - (m+l == probey && !currentlist?0:16),2,10+16); - - //strcpy(tempbuf, KB_ScanCodeToString(KeyboardKeys[m+l][1])); - strcpy(tempbuf, getkeyname(KeyboardKeys[m+l][1])); - if (!tempbuf[0]) strcpy(tempbuf, " -"); - minitextshade(70+120+34,34+l*8,tempbuf, - (m+l == probey && currentlist?0:16),2,10+16); - } - - gametext(160,144,"UP/DOWN = SELECT ACTION",0,2+8+16); - gametext(160,144+9,"LEFT/RIGHT = SELECT LIST",0,2+8+16); - gametext(160,144+9+9,"ENTER = MODIFY DELETE = CLEAR",0,2+8+16); - - break; - - case 210: { - int32 sc; + case 204: rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); menutext(320>>1,24,0,0,"KEYBOARD SETUP"); - gametext(320>>1,90,"PRESS THE KEY TO ASSIGN AS",0,2+8+16); - sprintf(tempbuf,"%s FOR \"%s\"", whichkey?"SECONDARY":"PRIMARY", CONFIG_FunctionNumToName(function)); - gametext(320>>1,90+9,tempbuf,0,2+8+16); - gametext(320>>1,90+9+9+9,"PRESS \"ESCAPE\" TO CANCEL",0,2+8+16); - - sc = KB_GetLastScanCode(); - if (sc != sc_None) { - if (sc == sc_Escape) { - sound(EXITMENUSOUND); - } else { - sound(PISTOL_BODYHIT); - - KeyboardKeys[function][whichkey] = KB_GetLastScanCode(); - if (function == gamefunc_Show_Console) - OSD_CaptureKey(KB_GetLastScanCode()); - else - CONTROL_MapKey(function, KeyboardKeys[function][0], KeyboardKeys[function][1]); - } - - cmenu(204); - - currentlist = whichkey; - probey = function; - - KB_ClearKeyDown(sc); - } - - break; - } - case 205: - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"MOUSE SETUP"); - - c = 60-4; - - onbar = (probey == (MAXMOUSEBUTTONS-2)*2+2); - if (probey < (MAXMOUSEBUTTONS-2)*2+2) - x = probesm(73,40,8,(MAXMOUSEBUTTONS-2)*2+2+2+2); - else - x = probesm(40,128-((MAXMOUSEBUTTONS-2)*2+2)*9,9,(MAXMOUSEBUTTONS-2)*2+2+2+2); - - if (x==-1) { - cmenu(202); - probey = 5; - break; - } else if (x == (MAXMOUSEBUTTONS-2)*2+2) { - // sensitivity - } else if (x == (MAXMOUSEBUTTONS-2)*2+2+1) { - // mouse aiming toggle - if (!ud.mouseaiming) myaimmode = 1-myaimmode; - } else if (x == (MAXMOUSEBUTTONS-2)*2+2+2) { - // invert mouse aim - ud.mouseflip = 1-ud.mouseflip; - } else if (x == (MAXMOUSEBUTTONS-2)*2+2+2+1) { - //advanced - cmenu(212); - break; - } else if (x >= 0) { - //set an option - cmenu(211); - function = 0; - whichkey = x; - if (x < (MAXMOUSEBUTTONS-2)*2) - probey = MouseFunctions[x>>1][x&1]; - else - probey = MouseFunctions[x-4][0]; - if (probey < 0) probey = NUMGAMEFUNCTIONS-1; - break; - } - - for (l=0; l < (MAXMOUSEBUTTONS-2)*2+2; l++) { - tempbuf[0] = 0; - if (l < (MAXMOUSEBUTTONS-2)*2) { - if (l&1) { - Bstrcpy(tempbuf, "Double "); - m = MouseFunctions[l>>1][1]; - } else - m = MouseFunctions[l>>1][0]; - Bstrcat(tempbuf, mousebuttonnames[l>>1]); - } else { - Bstrcpy(tempbuf, mousebuttonnames[l-(MAXMOUSEBUTTONS-2)]); - m = MouseFunctions[l-(MAXMOUSEBUTTONS-2)][0]; - } - - minitextshade(c+20,36+l*8,tempbuf,(l==probey)?0:16,1,10+16); - - if (m == -1) - minitextshade(c+100+20,36+l*8," -NONE-",(l==probey)?0:16,2,10+16); - else { - strcpy(tempbuf, CONFIG_FunctionNumToName(m)); - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitextshade(c+100+20,36+l*8,tempbuf,(l==probey)?0:16,2,10+16); - } - } - - gametextpal(40,122,"SENSITIVITY",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2),2); - gametextpal(40,122+9,"MOUSE AIMING TOGGLE",!ud.mouseaiming?MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+1):15,2); - gametextpal(40,122+9+9,"INVERT MOUSE AIM",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2),2); - gametextpal(40,122+9+9+9,"ADVANCED...",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2+1),2); - - { - short sense; - sense = CONTROL_GetMouseSensitivity()-1; - barsm(248,128,&sense,2,x==(MAXMOUSEBUTTONS-2)*2+2,MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2),PHX(-7)); - CONTROL_SetMouseSensitivity(sense+1); - } - - if (!ud.mouseaiming) modval(0,1,(int *)&myaimmode,1,probey == (MAXMOUSEBUTTONS-2)*2+2+1); - modval(0,1,(int *)&ud.mouseflip,1,probey == (MAXMOUSEBUTTONS-2)*2+2+2); - - gametextpal(240,122+9, myaimmode && !ud.mouseaiming ? "On" : "Off", !ud.mouseaiming?MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+1):15, 0); - gametextpal(240,122+9+9, !ud.mouseflip ? "On" : "Off", MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2), 0); - - if (probey < (MAXMOUSEBUTTONS-2)*2+2) { - gametext(160,164,"UP/DOWN = SELECT BUTTON",0,2+8+16); - gametext(160,164+9,"ENTER = MODIFY",0,2+8+16); - } - break; - - case 211: - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - if (function == 0) menutext(320>>1,24,0,0,"MOUSE SETUP"); - else if (function == 1) menutext(320>>1,24,0,0,"ADVANCED MOUSE"); - else if (function == 2) menutext(320>>1,24,0,0,"JOYSTICK BUTTONS"); - else if (function == 3) menutext(320>>1,24,0,0,"JOYSTICK AXES"); - - x = probe(0,0,0,NUMGAMEFUNCTIONS); - - if (x==-1) { - if (function == 0) { // mouse button - cmenu(205); - probey = whichkey; - } else if (function == 1) { // mouse digital axis - cmenu(212); - probey = 3+(whichkey^2); - } else if (function == 2) { // joystick button/hat - cmenu(207); - probey = whichkey; - } else if (function == 3) { // joystick digital axis - cmenu((whichkey>>2)+208); - probey = 1+((whichkey>>1)&1)*4+(whichkey&1); - } - break; - } else if (x >= 0) { - if (x == NUMGAMEFUNCTIONS-1) x = -1; - - if (function == 0) { - if (whichkey < (MAXMOUSEBUTTONS-2)*2) { - MouseFunctions[whichkey>>1][whichkey&1] = x; - CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_mouse); - } else { - MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x; - CONTROL_MapButton(x, whichkey-(MAXMOUSEBUTTONS-2), 0, controldevice_mouse); - } - cmenu(205); - probey = whichkey; - } else if (function == 1) { - MouseDigitalFunctions[whichkey>>1][whichkey&1] = x; - CONTROL_MapDigitalAxis(whichkey>>1, x, whichkey&1, controldevice_mouse); - cmenu(212); - probey = 3+(whichkey^2); - } else if (function == 2) { - if (whichkey < 2*joynumbuttons) { - JoystickFunctions[whichkey>>1][whichkey&1] = x; - CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_joystick); - } else { - JoystickFunctions[joynumbuttons + (whichkey-2*joynumbuttons)][0] = x; - CONTROL_MapButton(x, joynumbuttons + (whichkey-2*joynumbuttons), 0, controldevice_joystick); - } - cmenu(207); - probey = whichkey; - } else if (function == 3) { - JoystickDigitalFunctions[whichkey>>1][whichkey&1] = x; - CONTROL_MapDigitalAxis(whichkey>>1, x, whichkey&1, controldevice_joystick); - cmenu((whichkey>>2)+208); - probey = 1+((whichkey>>1)&1)*4+(whichkey&1); - } - break; - } - - gametext(320>>1,31,"SELECT A FUNCTION TO ASSIGN",0,2+8+16); - - if (function == 0) { - if (whichkey < (MAXMOUSEBUTTONS-2)*2) - sprintf(tempbuf,"TO %s%s", (whichkey&1)?"DOUBLE-CLICKED ":"", mousebuttonnames[whichkey>>1]); - else - Bstrcpy(tempbuf, mousebuttonnames[whichkey-(MAXMOUSEBUTTONS-2)]); - } 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; - } - } else if (function == 2) { - static char *directions[] = { "UP", "RIGHT", "DOWN", "LEFT" }; - if (whichkey < 2*joynumbuttons) - Bsprintf(tempbuf,"TO %s%s", (whichkey&1)?"DOUBLE-CLICKED ":"", getjoyname(1,whichkey>>1)); - else - Bsprintf(tempbuf,"TO HAT %s", directions[whichkey-2*joynumbuttons]); - } else if (function == 3) { - Bsprintf(tempbuf,"TO DIGITAL %s %s",getjoyname(0,whichkey>>1),(whichkey&1)?"POSITIVE":"NEGATIVE"); - } - - gametext(320>>1,31+9,tempbuf,0,2+8+16); - - if (KB_KeyPressed(sc_End)) { KB_ClearKeyDown(sc_End); probey = NUMGAMEFUNCTIONS-1; sound(KICK_HIT); } - else if (KB_KeyPressed(sc_Home)) { KB_ClearKeyDown(sc_Home); probey = 0; sound(KICK_HIT); } - - m = probey - 6; - if (m < 0) m = 0; - else if (m + 13 >= NUMGAMEFUNCTIONS) m = NUMGAMEFUNCTIONS-13; - - for (l=0; l < min(13,NUMGAMEFUNCTIONS); l++) { - if (l+m == NUMGAMEFUNCTIONS-1) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(m+l)); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitext(100,51+l*8,tempbuf,(m+l == probey)?0:16,10+16); - } - - gametext(320>>1,161,"PRESS \"ESCAPE\" TO CANCEL",0,2+8+16); - - break; - - case 212: - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"ADVANCED MOUSE"); - - c = (320>>1)-120; - - onbar = (probey == 0 || probey == 1 || probey == 2); - if (probey < 3) - x = probe(c,46,16,7); - else if (probey < 7) { - m=50; - x = probesm(c+10,96+16-(10+10+10),10,7); - } else { - x = probe(c,146+16-(16+16+16+16+16+16),16,7); - } - - switch (x) { - case -1: - cmenu(205); - probey = (MAXMOUSEBUTTONS-2)*2+2+2+1; - break; - - case 0: - // x-axis scale - case 1: - // y-axis scale - case 2: - // mouse filter - break; - - case 3: - // digital up - case 4: - // digital down - case 5: - // digital left - case 6: - // digital right - function = 1; - whichkey = (x-3)^2; // flip the actual axis number - cmenu(211); - probey = MouseDigitalFunctions[whichkey>>1][whichkey&1]; - if (probey < 0) probey = NUMGAMEFUNCTIONS-1; - break; - } - - menutext(c,46,MENUHIGHLIGHT(0),0,"X-AXIS SCALE"); - l = (MouseAnalogueScale[0]+262144) >> 13; - bar(c+160+40,46,(short *)&l,1,x==0,MENUHIGHLIGHT(0),0); - l = (l<<13)-262144; - if (l != MouseAnalogueScale[0]) { - CONTROL_SetAnalogAxisScale(0, l, controldevice_mouse); - MouseAnalogueScale[0] = l; - } - Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); - gametext(c+160-16,46-8,tempbuf,MENUHIGHLIGHT(0),2+8+16); - - menutext(c,46+16,MENUHIGHLIGHT(1),0,"Y-AXIS SCALE"); - l = (MouseAnalogueScale[1]+262144) >> 13; - bar(c+160+40,46+16,(short *)&l,1,x==1,MENUHIGHLIGHT(1),0); - l = (l<<13)-262144; - if (l != MouseAnalogueScale[1]) { - CONTROL_SetAnalogAxisScale(1, l, controldevice_mouse); - MouseAnalogueScale[1] = l; - } - Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); - gametext(c+160-16,46+16-8,tempbuf,MENUHIGHLIGHT(1),2+8+16); - - menutext(c,46+16+16,MENUHIGHLIGHT(2),0,"DEAD ZONE"); - l = MouseFilter>>1; - bar(c+160+40,46+16+16,(short *)&l,2,x==2,MENUHIGHLIGHT(2),0); - 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) - Bsprintf(tempbuf," OFF"); - else if (MouseFilter < 48) - Bsprintf(tempbuf," LOW"); - else if (MouseFilter < 96) - Bsprintf(tempbuf," MED"); - else if (MouseFilter < 128) - Bsprintf(tempbuf,"HIGH"); - - gametext(c+160-16,46+16+16-8,tempbuf,MENUHIGHLIGHT(2),2+8+16); - - - gametext(c+10,90+16,"UP:",MENUHIGHLIGHT(3),2+8+16); - if (MouseDigitalFunctions[1][0] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(MouseDigitalFunctions[1][0])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitextshade(c+10+60,91+16,tempbuf,MENUHIGHLIGHT(3),0,10+16); - - gametext(c+10,90+16+10,"DOWN:",MENUHIGHLIGHT(4),2+8+16); - if (MouseDigitalFunctions[1][1] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(MouseDigitalFunctions[1][1])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitextshade(c+10+60,91+16+10,tempbuf,MENUHIGHLIGHT(4),0,10+16); - - gametext(c+10,90+16+10+10,"LEFT:",MENUHIGHLIGHT(5),2+8+16); - if (MouseDigitalFunctions[0][0] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(MouseDigitalFunctions[0][0])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitextshade(c+10+60,91+16+10+10,tempbuf,MENUHIGHLIGHT(5),0,10+16); - - gametext(c+10,90+16+10+10+10,"RIGHT:",MENUHIGHLIGHT(6),2+8+16); - if (MouseDigitalFunctions[0][1] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(MouseDigitalFunctions[0][1])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitextshade(c+10+60,91+16+10+10+10,tempbuf,MENUHIGHLIGHT(6),0,10+16); - - break; - - case 206: - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"JOYSTICK SETUP"); - - x = probe(160,100-18,18,3); - - switch (x) { - case -1: - cmenu(202); - probey = 6; - break; - case 0: - case 1: - cmenu(207+x); - break; - case 2: - cmenu(213); - break; - } - - menutext(160,100-18,0,0,"EDIT BUTTONS"); - menutext(160,100,0,0,"EDIT AXES"); - menutext(160,100+18,0,0,"DEAD ZONES"); - - break; - - case 207: - rotatesprite(320<<15,10<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,15,0,0,"JOYSTICK BUTTONS"); - - c = 2*joynumbuttons + 4*(joynumhats>0); - - x = probe(0,0,0,c); - - if (x == -1) { - cmenu(206); - probey = 0; - break; - } else if (x >= 0) { - function = 2; - whichkey = x; - cmenu(211); - if (x < 2*joynumbuttons) { - probey = JoystickFunctions[x>>1][x&1]; - } else { - probey = JoystickFunctions[joynumbuttons + (x-2*joynumbuttons)][0]; - } - if (probey < 0) probey = NUMGAMEFUNCTIONS-1; - break; - } - - // the top of our list - if (c < 13) m = 0; - else { - m = probey - 6; - if (m < 0) m = 0; - else if (m + 13 >= c) m = c-13; - } - - for (l=0; l>1)); - x = JoystickFunctions[(l+m)>>1][(l+m)&1]; - } else { - static char *directions[] = { "Up", "Right", "Down", "Left" }; - sprintf(tempbuf, "Hat %s", directions[(l+m)-2*joynumbuttons]); - x = JoystickFunctions[joynumbuttons + ((l+m)-2*joynumbuttons)][0]; - } - minitextshade(80-4,33+l*8,tempbuf,(m+l == probey)?0:16,1,10+16); - - if (x == -1) - minitextshade(176,33+l*8," -NONE-",(m+l==probey)?0:16,2,10+16); - else { - strcpy(tempbuf, CONFIG_FunctionNumToName(x)); - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitextshade(176,33+l*8,tempbuf,(m+l==probey)?0:16,2,10+16); - } - } - - gametext(160,149,"UP/DOWN = SELECT BUTTON",0,2+8+16); - gametext(160,149+9,"ENTER = MODIFY",0,2+8+16); - break; - - case 208: - case 209: - case 217: - case 218: - case 219: - case 220: - case 221: - case 222: - { - int thispage, twothispage; - - rotatesprite(320<<15,10<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,15,0,0,"JOYSTICK AXES"); - - thispage = (current_menu < 217) ? (current_menu-208) : (current_menu-217)+2; - twothispage = (thispage*2+1 < joynumaxes); + c = (320>>1)-120; onbar = 0; - switch (probey) { - case 0: - case 4: - onbar = 1; x = probe(88,45+(probey==4)*64,0,1+(4<=0) + { + function = probey; + whichkey = currentlist; + cmenu(210); + KB_FlushKeyboardQueue(); + KB_ClearLastScanCode(); + break; } - switch (x) { - case -1: - cmenu(206); - probey = 1; - break; - case 8: - if (joynumaxes > 2) { - if (thispage == ((joynumaxes+1)/2)-1) cmenu(208); - else { - if (current_menu == 209) cmenu(217); - else cmenu(current_menu+1); + // the top of our list + m = probey - 6; + if (m < 0) m = 0; + else if (m + 13 >= NUMGAMEFUNCTIONS) m = NUMGAMEFUNCTIONS-13; + + if (probey == gamefunc_Show_Console) currentlist = 0; + else if (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4) || + KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) || + KB_KeyPressed(sc_Tab)) + { + currentlist ^= 1; + KB_ClearKeyDown(sc_LeftArrow); + KB_ClearKeyDown(sc_RightArrow); + KB_ClearKeyDown(sc_kpad_4); + KB_ClearKeyDown(sc_kpad_6); + KB_ClearKeyDown(sc_Tab); + sound(KICK_HIT); + } + else if (KB_KeyPressed(sc_Delete)) + { + KeyboardKeys[probey][currentlist] = 0; + CONTROL_MapKey(probey, KeyboardKeys[probey][0], KeyboardKeys[probey][1]); + sound(KICK_HIT); + KB_ClearKeyDown(sc_Delete); + } + + for (l=0; l < min(13,NUMGAMEFUNCTIONS); l++) + { + p = CONFIG_FunctionNumToName(m+l); + if (!p) continue; + + strcpy(tempbuf, p); + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitextshade(70,34+l*8,tempbuf,(m+l == probey)?0:16,1,10+16); + + //strcpy(tempbuf, KB_ScanCodeToString(KeyboardKeys[m+l][0])); + strcpy(tempbuf, getkeyname(KeyboardKeys[m+l][0])); + if (!tempbuf[0]) strcpy(tempbuf, " -"); + minitextshade(70+100,34+l*8,tempbuf, + (m+l == probey && !currentlist?0:16),2,10+16); + + //strcpy(tempbuf, KB_ScanCodeToString(KeyboardKeys[m+l][1])); + strcpy(tempbuf, getkeyname(KeyboardKeys[m+l][1])); + if (!tempbuf[0]) strcpy(tempbuf, " -"); + minitextshade(70+120+34,34+l*8,tempbuf, + (m+l == probey && currentlist?0:16),2,10+16); + } + + gametext(160,144,"UP/DOWN = SELECT ACTION",0,2+8+16); + gametext(160,144+9,"LEFT/RIGHT = SELECT LIST",0,2+8+16); + gametext(160,144+9+9,"ENTER = MODIFY DELETE = CLEAR",0,2+8+16); + + break; + + case 210: + { + int32 sc; + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"KEYBOARD SETUP"); + + gametext(320>>1,90,"PRESS THE KEY TO ASSIGN AS",0,2+8+16); + sprintf(tempbuf,"%s FOR \"%s\"", whichkey?"SECONDARY":"PRIMARY", CONFIG_FunctionNumToName(function)); + gametext(320>>1,90+9,tempbuf,0,2+8+16); + gametext(320>>1,90+9+9+9,"PRESS \"ESCAPE\" TO CANCEL",0,2+8+16); + + sc = KB_GetLastScanCode(); + if (sc != sc_None) + { + if (sc == sc_Escape) + { + sound(EXITMENUSOUND); } + else + { + sound(PISTOL_BODYHIT); + + KeyboardKeys[function][whichkey] = KB_GetLastScanCode(); + if (function == gamefunc_Show_Console) + OSD_CaptureKey(KB_GetLastScanCode()); + else + CONTROL_MapKey(function, KeyboardKeys[function][0], KeyboardKeys[function][1]); + } + + cmenu(204); + + currentlist = whichkey; + probey = function; + + KB_ClearKeyDown(sc); } - break; - case 4: // bar - if (!twothispage && joynumaxes > 2) - cmenu(208); - case 0: break; + } + case 205: + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"MOUSE SETUP"); - case 1: // digitals - case 2: - case 5: - case 6: - function = 3; - whichkey = ((thispage*2+(x==5||x==6)) << 1) + (x==2||x==6); + c = 60-4; + + onbar = (probey == (MAXMOUSEBUTTONS-2)*2+2); + if (probey < (MAXMOUSEBUTTONS-2)*2+2) + x = probesm(73,40,8,(MAXMOUSEBUTTONS-2)*2+2+2+2); + else + x = probesm(40,128-((MAXMOUSEBUTTONS-2)*2+2)*9,9,(MAXMOUSEBUTTONS-2)*2+2+2+2); + + if (x==-1) + { + cmenu(202); + probey = 5; + break; + } + else if (x == (MAXMOUSEBUTTONS-2)*2+2) + { + // sensitivity + } + else if (x == (MAXMOUSEBUTTONS-2)*2+2+1) + { + // mouse aiming toggle + if (!ud.mouseaiming) myaimmode = 1-myaimmode; + } + else if (x == (MAXMOUSEBUTTONS-2)*2+2+2) + { + // invert mouse aim + ud.mouseflip = 1-ud.mouseflip; + } + else if (x == (MAXMOUSEBUTTONS-2)*2+2+2+1) + { + //advanced + cmenu(212); + break; + } + else if (x >= 0) + { + //set an option cmenu(211); - probey = JoystickDigitalFunctions[whichkey>>1][whichkey&1]; + function = 0; + whichkey = x; + if (x < (MAXMOUSEBUTTONS-2)*2) + probey = MouseFunctions[x>>1][x&1]; + else + probey = MouseFunctions[x-4][0]; if (probey < 0) probey = NUMGAMEFUNCTIONS-1; break; - - case 3: // analogues - case 7: - l = JoystickAnalogueAxes[thispage*2+(x==7)]; - if (l == analog_turning) l = analog_strafing; - else if (l == analog_strafing) l = analog_lookingupanddown; - else if (l == analog_lookingupanddown) l = analog_moving; - else if (l == analog_moving) l = -1; - else l = analog_turning; - JoystickAnalogueAxes[thispage*2+(x==7)] = l; - CONTROL_MapAnalogAxis(thispage*2+(x==7),l,controldevice_joystick); - { - extern int32 mouseyaxismode; // player.c - mouseyaxismode = -1; - } - break; - default: - break; } - Bsprintf(tempbuf,getjoyname(0,thispage*2)); - menutext(42,32,0,0,tempbuf); - if (twothispage) + for (l=0; l < (MAXMOUSEBUTTONS-2)*2+2; l++) { - Bsprintf(tempbuf,getjoyname(0,thispage*2+1)); - menutext(42,32+64,0,0,tempbuf); - } - gametext(76,38,"SCALE",0,2+8+16); - l = (JoystickAnalogueScale[thispage*2]+262144) >> 13; - bar(140+56,38+8,(short *)&l,1,x==0,0,0); - l = (l<<13)-262144; - if (l != JoystickAnalogueScale[thispage*2]) { - CONTROL_SetAnalogAxisScale(thispage*2, l, controldevice_joystick); - JoystickAnalogueScale[thispage*2] = l; - } - Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); - gametext(140,38,tempbuf,0,2+8+16); - - gametext(76,38+15,"DIGITAL",0,2+8+16); - if (JoystickDigitalFunctions[thispage*2][0] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[thispage*2][0])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitext(140+12,38+15,tempbuf,0,10+16); - - if (JoystickDigitalFunctions[thispage*2][1] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[thispage*2][1])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitext(140+12+72,38+15,tempbuf,0,10+16); - - gametext(76,38+15+15,"ANALOG",0,2+8+16); - if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[thispage*2])) { - p = CONFIG_AnalogNumToName(JoystickAnalogueAxes[thispage*2]); - if (p) { - gametext(140+12,38+15+15, strchr(p,'_')+1, 0, 2+8+16); - } - } - - if (twothispage) { - gametext(76,38+64,"SCALE",0,2+8+16); - l = (JoystickAnalogueScale[thispage*2+1]+262144) >> 13; - bar(140+56,38+8+64,(short *)&l,1,x==4,0,0); - l = (l<<13)-262144; - if (l != JoystickAnalogueScale[thispage*2+1]) { - CONTROL_SetAnalogAxisScale(thispage*2+1, l, controldevice_joystick); - JoystickAnalogueScale[thispage*2+1] = l; - } - Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); - gametext(140,38+64,tempbuf,0,2+8+16); - - gametext(76,38+64+15,"DIGITAL",0,2+8+16); - if (JoystickDigitalFunctions[thispage*2+1][0] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[thispage*2+1][0])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitext(140+12,38+15+64,tempbuf,0,10+16); - - if (JoystickDigitalFunctions[thispage*2+1][1] < 0) - strcpy(tempbuf, " -NONE-"); - else - strcpy(tempbuf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[thispage*2+1][1])); - - for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; - minitext(140+12+72,38+15+64,tempbuf,0,10+16); - - gametext(76,38+64+15+15,"ANALOG",0,2+8+16); - if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[thispage*2+1])) { - p = CONFIG_AnalogNumToName(JoystickAnalogueAxes[thispage*2+1]); - if (p) { - gametext(140+12,38+64+15+15, strchr(p,'_')+1, 0, 2+8+16); + tempbuf[0] = 0; + if (l < (MAXMOUSEBUTTONS-2)*2) + { + if (l&1) + { + Bstrcpy(tempbuf, "Double "); + m = MouseFunctions[l>>1][1]; } + else + m = MouseFunctions[l>>1][0]; + Bstrcat(tempbuf, mousebuttonnames[l>>1]); + } + else + { + Bstrcpy(tempbuf, mousebuttonnames[l-(MAXMOUSEBUTTONS-2)]); + m = MouseFunctions[l-(MAXMOUSEBUTTONS-2)][0]; + } + + minitextshade(c+20,36+l*8,tempbuf,(l==probey)?0:16,1,10+16); + + if (m == -1) + minitextshade(c+100+20,36+l*8," -NONE-",(l==probey)?0:16,2,10+16); + else + { + strcpy(tempbuf, CONFIG_FunctionNumToName(m)); + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitextshade(c+100+20,36+l*8,tempbuf,(l==probey)?0:16,2,10+16); } } - if (joynumaxes > 2) { - menutext(320>>1,twothispage?158:108,SHX(-10),(joynumaxes<=2),"NEXT..."); - sprintf(tempbuf,"Page %d of %d",thispage+1,(joynumaxes+1)/2); - gametext(320-100,158,tempbuf,0,2+8+16); + gametextpal(40,122,"SENSITIVITY",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2),2); + gametextpal(40,122+9,"MOUSE AIMING TOGGLE",!ud.mouseaiming?MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+1):15,2); + gametextpal(40,122+9+9,"INVERT MOUSE AIM",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2),2); + gametextpal(40,122+9+9+9,"ADVANCED...",MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2+1),2); + + { + short sense; + sense = CONTROL_GetMouseSensitivity()-1; + barsm(248,128,&sense,2,x==(MAXMOUSEBUTTONS-2)*2+2,MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2),PHX(-7)); + CONTROL_SetMouseSensitivity(sense+1); + } + + if (!ud.mouseaiming) modval(0,1,(int *)&myaimmode,1,probey == (MAXMOUSEBUTTONS-2)*2+2+1); + modval(0,1,(int *)&ud.mouseflip,1,probey == (MAXMOUSEBUTTONS-2)*2+2+2); + + gametextpal(240,122+9, myaimmode && !ud.mouseaiming ? "On" : "Off", !ud.mouseaiming?MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+1):15, 0); + gametextpal(240,122+9+9, !ud.mouseflip ? "On" : "Off", MENUHIGHLIGHT((MAXMOUSEBUTTONS-2)*2+2+2), 0); + + if (probey < (MAXMOUSEBUTTONS-2)*2+2) + { + gametext(160,164,"UP/DOWN = SELECT BUTTON",0,2+8+16); + gametext(160,164+9,"ENTER = MODIFY",0,2+8+16); } break; - } - case 213: - case 214: - case 215: - case 216: { // Pray this is enough pages for now :-| - int first,last; + case 211: rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"JOY DEAD ZONES"); + if (function == 0) menutext(320>>1,24,0,0,"MOUSE SETUP"); + else if (function == 1) menutext(320>>1,24,0,0,"ADVANCED MOUSE"); + else if (function == 2) menutext(320>>1,24,0,0,"JOYSTICK BUTTONS"); + else if (function == 3) menutext(320>>1,24,0,0,"JOYSTICK AXES"); - first = 4*(current_menu-213); - last = min(4*(current_menu-213)+4,joynumaxes); + x = probe(0,0,0,NUMGAMEFUNCTIONS); - onbar = 1; - x = probe(320,48,15,2*(last-first)+(joynumaxes>4)); - - if (x==-1) { - cmenu(206); - probey = 2; + if (x==-1) + { + if (function == 0) + { // mouse button + cmenu(205); + probey = whichkey; + } + else if (function == 1) + { // mouse digital axis + cmenu(212); + probey = 3+(whichkey^2); + } + else if (function == 2) + { // joystick button/hat + cmenu(207); + probey = whichkey; + } + else if (function == 3) + { // joystick digital axis + cmenu((whichkey>>2)+208); + probey = 1+((whichkey>>1)&1)*4+(whichkey&1); + } break; - } else if (x==2*(last-first) && joynumaxes>4) { - cmenu((current_menu-213) == (joynumaxes/4) ? 213 : (current_menu+1)); + } + else if (x >= 0) + { + if (x == NUMGAMEFUNCTIONS-1) x = -1; + + if (function == 0) + { + if (whichkey < (MAXMOUSEBUTTONS-2)*2) + { + MouseFunctions[whichkey>>1][whichkey&1] = x; + CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_mouse); + } + else + { + MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x; + CONTROL_MapButton(x, whichkey-(MAXMOUSEBUTTONS-2), 0, controldevice_mouse); + } + cmenu(205); + probey = whichkey; + } + else if (function == 1) + { + MouseDigitalFunctions[whichkey>>1][whichkey&1] = x; + CONTROL_MapDigitalAxis(whichkey>>1, x, whichkey&1, controldevice_mouse); + cmenu(212); + probey = 3+(whichkey^2); + } + else if (function == 2) + { + if (whichkey < 2*joynumbuttons) + { + JoystickFunctions[whichkey>>1][whichkey&1] = x; + CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_joystick); + } + else + { + JoystickFunctions[joynumbuttons + (whichkey-2*joynumbuttons)][0] = x; + CONTROL_MapButton(x, joynumbuttons + (whichkey-2*joynumbuttons), 0, controldevice_joystick); + } + cmenu(207); + probey = whichkey; + } + else if (function == 3) + { + JoystickDigitalFunctions[whichkey>>1][whichkey&1] = x; + CONTROL_MapDigitalAxis(whichkey>>1, x, whichkey&1, controldevice_joystick); + cmenu((whichkey>>2)+208); + probey = 1+((whichkey>>1)&1)*4+(whichkey&1); + } + break; + } + + gametext(320>>1,31,"SELECT A FUNCTION TO ASSIGN",0,2+8+16); + + if (function == 0) + { + if (whichkey < (MAXMOUSEBUTTONS-2)*2) + sprintf(tempbuf,"TO %s%s", (whichkey&1)?"DOUBLE-CLICKED ":"", mousebuttonnames[whichkey>>1]); + else + Bstrcpy(tempbuf, mousebuttonnames[whichkey-(MAXMOUSEBUTTONS-2)]); + } + 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; + } + } + else if (function == 2) + { + static char *directions[] = + { "UP", "RIGHT", "DOWN", "LEFT" + }; + if (whichkey < 2*joynumbuttons) + Bsprintf(tempbuf,"TO %s%s", (whichkey&1)?"DOUBLE-CLICKED ":"", getjoyname(1,whichkey>>1)); + else + Bsprintf(tempbuf,"TO HAT %s", directions[whichkey-2*joynumbuttons]); + } + else if (function == 3) + { + Bsprintf(tempbuf,"TO DIGITAL %s %s",getjoyname(0,whichkey>>1),(whichkey&1)?"POSITIVE":"NEGATIVE"); + } + + gametext(320>>1,31+9,tempbuf,0,2+8+16); + + if (KB_KeyPressed(sc_End)) + { + KB_ClearKeyDown(sc_End); + probey = NUMGAMEFUNCTIONS-1; + sound(KICK_HIT); + } + else if (KB_KeyPressed(sc_Home)) + { + KB_ClearKeyDown(sc_Home); + probey = 0; + sound(KICK_HIT); + } + + m = probey - 6; + if (m < 0) m = 0; + else if (m + 13 >= NUMGAMEFUNCTIONS) m = NUMGAMEFUNCTIONS-13; + + for (l=0; l < min(13,NUMGAMEFUNCTIONS); l++) + { + if (l+m == NUMGAMEFUNCTIONS-1) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(m+l)); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitext(100,51+l*8,tempbuf,(m+l == probey)?0:16,10+16); + } + + gametext(320>>1,161,"PRESS \"ESCAPE\" TO CANCEL",0,2+8+16); + + break; + + case 212: + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"ADVANCED MOUSE"); + + c = (320>>1)-120; + + onbar = (probey == 0 || probey == 1 || probey == 2); + if (probey < 3) + x = probe(c,46,16,7); + else if (probey < 7) + { + m=50; + x = probesm(c+10,96+16-(10+10+10),10,7); + } + else + { + x = probe(c,146+16-(16+16+16+16+16+16),16,7); + } + + switch (x) + { + case -1: + cmenu(205); + probey = (MAXMOUSEBUTTONS-2)*2+2+2+1; + break; + + case 0: + // x-axis scale + case 1: + // y-axis scale + case 2: + // mouse filter + break; + + case 3: + // digital up + case 4: + // digital down + case 5: + // digital left + case 6: + // digital right + function = 1; + whichkey = (x-3)^2; // flip the actual axis number + cmenu(211); + probey = MouseDigitalFunctions[whichkey>>1][whichkey&1]; + if (probey < 0) probey = NUMGAMEFUNCTIONS-1; + break; + } + + menutext(c,46,MENUHIGHLIGHT(0),0,"X-AXIS SCALE"); + l = (MouseAnalogueScale[0]+262144) >> 13; + bar(c+160+40,46,(short *)&l,1,x==0,MENUHIGHLIGHT(0),0); + l = (l<<13)-262144; + if (l != MouseAnalogueScale[0]) + { + CONTROL_SetAnalogAxisScale(0, l, controldevice_mouse); + MouseAnalogueScale[0] = l; + } + Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); + gametext(c+160-16,46-8,tempbuf,MENUHIGHLIGHT(0),2+8+16); + + menutext(c,46+16,MENUHIGHLIGHT(1),0,"Y-AXIS SCALE"); + l = (MouseAnalogueScale[1]+262144) >> 13; + bar(c+160+40,46+16,(short *)&l,1,x==1,MENUHIGHLIGHT(1),0); + l = (l<<13)-262144; + if (l != MouseAnalogueScale[1]) + { + CONTROL_SetAnalogAxisScale(1, l, controldevice_mouse); + MouseAnalogueScale[1] = l; + } + Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); + gametext(c+160-16,46+16-8,tempbuf,MENUHIGHLIGHT(1),2+8+16); + + menutext(c,46+16+16,MENUHIGHLIGHT(2),0,"DEAD ZONE"); + l = MouseFilter>>1; + bar(c+160+40,46+16+16,(short *)&l,2,x==2,MENUHIGHLIGHT(2),0); + 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) + Bsprintf(tempbuf," OFF"); + else if (MouseFilter < 48) + Bsprintf(tempbuf," LOW"); + else if (MouseFilter < 96) + Bsprintf(tempbuf," MED"); + else if (MouseFilter < 128) + Bsprintf(tempbuf,"HIGH"); + + gametext(c+160-16,46+16+16-8,tempbuf,MENUHIGHLIGHT(2),2+8+16); + + + gametext(c+10,90+16,"UP:",MENUHIGHLIGHT(3),2+8+16); + if (MouseDigitalFunctions[1][0] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(MouseDigitalFunctions[1][0])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitextshade(c+10+60,91+16,tempbuf,MENUHIGHLIGHT(3),0,10+16); + + gametext(c+10,90+16+10,"DOWN:",MENUHIGHLIGHT(4),2+8+16); + if (MouseDigitalFunctions[1][1] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(MouseDigitalFunctions[1][1])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitextshade(c+10+60,91+16+10,tempbuf,MENUHIGHLIGHT(4),0,10+16); + + gametext(c+10,90+16+10+10,"LEFT:",MENUHIGHLIGHT(5),2+8+16); + if (MouseDigitalFunctions[0][0] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(MouseDigitalFunctions[0][0])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitextshade(c+10+60,91+16+10+10,tempbuf,MENUHIGHLIGHT(5),0,10+16); + + gametext(c+10,90+16+10+10+10,"RIGHT:",MENUHIGHLIGHT(6),2+8+16); + if (MouseDigitalFunctions[0][1] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(MouseDigitalFunctions[0][1])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitextshade(c+10+60,91+16+10+10+10,tempbuf,MENUHIGHLIGHT(6),0,10+16); + + break; + + case 206: + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"JOYSTICK SETUP"); + + x = probe(160,100-18,18,3); + + switch (x) + { + case -1: + cmenu(202); + probey = 6; + break; + case 0: + case 1: + cmenu(207+x); + break; + case 2: + cmenu(213); + break; + } + + menutext(160,100-18,0,0,"EDIT BUTTONS"); + menutext(160,100,0,0,"EDIT AXES"); + menutext(160,100+18,0,0,"DEAD ZONES"); + + break; + + case 207: + rotatesprite(320<<15,10<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,15,0,0,"JOYSTICK BUTTONS"); + + c = 2*joynumbuttons + 4*(joynumhats>0); + + x = probe(0,0,0,c); + + if (x == -1) + { + cmenu(206); probey = 0; break; } - - for (m=first;m4) { - menutext(32,48+30*(last-first),0,0,"NEXT..."); - sprintf(tempbuf,"Page %d of %d", 1+(current_menu-213), (joynumaxes+3)/4); - gametext(320-100,158,tempbuf,0,2+8+16); - } - break; - } - - case 700: - case 701: - c = (320>>1)-120; - rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,24,0,0,"SOUND SETUP"); - onbar = (probey == 2 || probey == 3); - - x = probe(c,50,16,7); - switch (x) - { - case -1: - if (ps[myconnectindex].gm&MODE_GAME && current_menu == 701) + else if (x >= 0) { - ps[myconnectindex].gm &= ~MODE_MENU; - if (ud.multimode < 2 && ud.recstat != 2) + function = 2; + whichkey = x; + cmenu(211); + if (x < 2*joynumbuttons) { - ready2send = 1; - totalclock = ototalclock; + probey = JoystickFunctions[x>>1][x&1]; + } + else + { + probey = JoystickFunctions[joynumbuttons + (x-2*joynumbuttons)][0]; + } + if (probey < 0) probey = NUMGAMEFUNCTIONS-1; + break; + } + + // the top of our list + if (c < 13) m = 0; + else + { + m = probey - 6; + if (m < 0) m = 0; + else if (m + 13 >= c) m = c-13; + } + + for (l=0; l>1)); + x = JoystickFunctions[(l+m)>>1][(l+m)&1]; + } + else + { + static char *directions[] = + { "Up", "Right", "Down", "Left" + }; + sprintf(tempbuf, "Hat %s", directions[(l+m)-2*joynumbuttons]); + x = JoystickFunctions[joynumbuttons + ((l+m)-2*joynumbuttons)][0]; + } + minitextshade(80-4,33+l*8,tempbuf,(m+l == probey)?0:16,1,10+16); + + if (x == -1) + minitextshade(176,33+l*8," -NONE-",(m+l==probey)?0:16,2,10+16); + else + { + strcpy(tempbuf, CONFIG_FunctionNumToName(x)); + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitextshade(176,33+l*8,tempbuf,(m+l==probey)?0:16,2,10+16); } } - else cmenu(202); - probey = 1; + gametext(160,149,"UP/DOWN = SELECT BUTTON",0,2+8+16); + gametext(160,149+9,"ENTER = MODIFY",0,2+8+16); break; - case 0: - if (FXDevice >= 0) + + case 208: + case 209: + case 217: + case 218: + case 219: + case 220: + case 221: + case 222: { - SoundToggle = 1-SoundToggle; - if (SoundToggle == 0) - { - FX_StopAllSounds(); - clearsoundlocks(); - } + int thispage, twothispage; + + rotatesprite(320<<15,10<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,15,0,0,"JOYSTICK AXES"); + + thispage = (current_menu < 217) ? (current_menu-208) : (current_menu-217)+2; + twothispage = (thispage*2+1 < joynumaxes); + onbar = 0; - } - break; - case 1: - if (MusicDevice >= 0 && (numplayers < 2 || MusicToggle)) - { - MusicToggle = 1-MusicToggle; - if (MusicToggle == 0) MUSIC_Pause(); + switch (probey) + { + case 0: + case 4: + onbar = 1; + x = probe(88,45+(probey==4)*64,0,1+(4< 2) + { + if (thispage == ((joynumaxes+1)/2)-1) cmenu(208); + else + { + if (current_menu == 209) cmenu(217); + else cmenu(current_menu+1); + } + } + break; + + case 4: // bar + if (!twothispage && joynumaxes > 2) + cmenu(208); + case 0: + break; + + case 1: // digitals + case 2: + case 5: + case 6: + function = 3; + whichkey = ((thispage*2+(x==5||x==6)) << 1) + (x==2||x==6); + cmenu(211); + probey = JoystickDigitalFunctions[whichkey>>1][whichkey&1]; + if (probey < 0) probey = NUMGAMEFUNCTIONS-1; + break; + + case 3: // analogues + case 7: + l = JoystickAnalogueAxes[thispage*2+(x==7)]; + if (l == analog_turning) l = analog_strafing; + else if (l == analog_strafing) l = analog_lookingupanddown; + else if (l == analog_lookingupanddown) l = analog_moving; + else if (l == analog_moving) l = -1; + else l = analog_turning; + JoystickAnalogueAxes[thispage*2+(x==7)] = l; + CONTROL_MapAnalogAxis(thispage*2+(x==7),l,controldevice_joystick); + { + extern int32 mouseyaxismode; // player.c + mouseyaxismode = -1; + } + break; + default: + break; + } + + Bsprintf(tempbuf,getjoyname(0,thispage*2)); + menutext(42,32,0,0,tempbuf); + if (twothispage) + { + Bsprintf(tempbuf,getjoyname(0,thispage*2+1)); + menutext(42,32+64,0,0,tempbuf); + } + gametext(76,38,"SCALE",0,2+8+16); + l = (JoystickAnalogueScale[thispage*2]+262144) >> 13; + bar(140+56,38+8,(short *)&l,1,x==0,0,0); + l = (l<<13)-262144; + if (l != JoystickAnalogueScale[thispage*2]) + { + CONTROL_SetAnalogAxisScale(thispage*2, l, controldevice_joystick); + JoystickAnalogueScale[thispage*2] = l; + } + Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); + gametext(140,38,tempbuf,0,2+8+16); + + gametext(76,38+15,"DIGITAL",0,2+8+16); + if (JoystickDigitalFunctions[thispage*2][0] < 0) + strcpy(tempbuf, " -NONE-"); else - { - if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME) - playmusic(&music_fn[0][music_select][0]); - else playmusic(&env_music_fn[0][0]); + strcpy(tempbuf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[thispage*2][0])); - MUSIC_Continue(); - } - } - onbar = 0; + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitext(140+12,38+15,tempbuf,0,10+16); - break; - case 4: - if (SoundToggle && (FXDevice >= 0)) { VoiceToggle = (VoiceToggle == 2) ? 0 : VoiceToggle+1; } - onbar = 0; - break; - case 5: - if (SoundToggle && (FXDevice >= 0)) AmbienceToggle = 1-AmbienceToggle; - onbar = 0; - break; - case 6: - if (SoundToggle && (FXDevice >= 0)) - { - ReverseStereo = 1-ReverseStereo; - FX_SetReverseStereo(ReverseStereo); - } - onbar = 0; - break; - default: - onbar = 1; - break; - } - - menutext(c+160+40,50,MENUHIGHLIGHT(0),(FXDevice<0),SoundToggle && FXDevice >= 0?"ON":"OFF"); - - menutext(c+160+40,50+16,MENUHIGHLIGHT(1),(MusicDevice<0||(numplayers > 1 && !MusicToggle)),(MusicToggle && (MusicDevice >= 0))?"ON":"OFF"); - - menutext(c,50,MENUHIGHLIGHT(0),(FXDevice<0),"SOUND"); - menutext(c,50+16+16,MENUHIGHLIGHT(2),(FXDevice<0)||SoundToggle==0,"SOUND VOLUME"); - { - 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) - FXVolume <<= 2; - if (l != FXVolume) - FX_SetVolume((short) FXVolume); - } - menutext(c,50+16,MENUHIGHLIGHT(1),(MusicDevice<0||(numplayers > 1 && !MusicToggle)),"MUSIC"); - menutext(c,50+16+16+16,MENUHIGHLIGHT(3),(MusicDevice<0)||MusicToggle==0,"MUSIC VOLUME"); - { - l = MusicVolume; - MusicVolume >>= 2; - bar(c+167+40,50+16+16+16, - (short *)&MusicVolume,4, - (MusicDevice>=0) && x==3,MENUHIGHLIGHT(3), - MusicToggle==0||(MusicDevice<0)); - MusicVolume <<= 2; - if (l != MusicVolume) - MUSIC_SetVolume((short) MusicVolume); - - } - menutext(c,50+16+16+16+16,MENUHIGHLIGHT(4),(FXDevice<0)||SoundToggle==0,"DUKE TALK"); - menutext(c,50+16+16+16+16+16,MENUHIGHLIGHT(5),(FXDevice<0)||SoundToggle==0,"AMBIENCE"); - - 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+16,MENUHIGHLIGHT(5),(FXDevice<0)||SoundToggle==0,AmbienceToggle?"ON":"OFF"); - - menutext(c+160+40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(FXDevice<0)||SoundToggle==0,ReverseStereo?"ON":"OFF"); - - break; - - case 350: - cmenu(351); - screencapt = 1; - displayrooms(myconnectindex,65536); - //savetemp("duke3d.tmp",waloff[TILE_SAVESHOT],160*100); - screencapt = 0; - break; - - case 360: - case 361: - case 362: - case 363: - case 364: - case 365: - case 366: - case 367: - case 368: - case 369: - case 351: - case 300: - - c = 320>>1; - 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"); - else menutext(c,24,0,0,"SAVE GAME"); - - if (current_menu >= 360 && current_menu <= 369) - { - sprintf(tempbuf,"PLAYERS: %-2ld ",ud.multimode); - gametext(160,156,tempbuf,0,2+8+16); - sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+ud.volume_number,1+ud.level_number,ud.player_skill); - gametext(160,168,tempbuf,0,2+8+16); - if (ud.volume_number == 0 && ud.level_number == 7) - gametext(160,180,boardfilename,0,2+8+16); - - x = strget((320>>1),184,&ud.savegame[current_menu-360][0],19, 999); - - if (x == -1) - { - // readsavenames(); - ps[myconnectindex].gm = MODE_GAME; - if (ud.multimode < 2 && ud.recstat != 2) - { - ready2send = 1; - totalclock = ototalclock; - } - goto DISPLAYNAMES; - } - - if (x == 1) - { - if (ud.savegame[current_menu-360][0] == 0) - { - KB_FlushKeyboardQueue(); - cmenu(351); - } + if (JoystickDigitalFunctions[thispage*2][1] < 0) + strcpy(tempbuf, " -NONE-"); else + strcpy(tempbuf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[thispage*2][1])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitext(140+12+72,38+15,tempbuf,0,10+16); + + gametext(76,38+15+15,"ANALOG",0,2+8+16); + if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[thispage*2])) { - if (ud.multimode > 1) - saveplayer(-1-(current_menu-360)); - else saveplayer(current_menu-360); - lastsavedpos = current_menu-360; + p = CONFIG_AnalogNumToName(JoystickAnalogueAxes[thispage*2]); + if (p) + { + gametext(140+12,38+15+15, strchr(p,'_')+1, 0, 2+8+16); + } + } + + if (twothispage) + { + gametext(76,38+64,"SCALE",0,2+8+16); + l = (JoystickAnalogueScale[thispage*2+1]+262144) >> 13; + bar(140+56,38+8+64,(short *)&l,1,x==4,0,0); + l = (l<<13)-262144; + if (l != JoystickAnalogueScale[thispage*2+1]) + { + CONTROL_SetAnalogAxisScale(thispage*2+1, l, controldevice_joystick); + JoystickAnalogueScale[thispage*2+1] = l; + } + Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); + gametext(140,38+64,tempbuf,0,2+8+16); + + gametext(76,38+64+15,"DIGITAL",0,2+8+16); + if (JoystickDigitalFunctions[thispage*2+1][0] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[thispage*2+1][0])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitext(140+12,38+15+64,tempbuf,0,10+16); + + if (JoystickDigitalFunctions[thispage*2+1][1] < 0) + strcpy(tempbuf, " -NONE-"); + else + strcpy(tempbuf, CONFIG_FunctionNumToName(JoystickDigitalFunctions[thispage*2+1][1])); + + for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; + minitext(140+12+72,38+15+64,tempbuf,0,10+16); + + gametext(76,38+64+15+15,"ANALOG",0,2+8+16); + if (CONFIG_AnalogNumToName(JoystickAnalogueAxes[thispage*2+1])) + { + p = CONFIG_AnalogNumToName(JoystickAnalogueAxes[thispage*2+1]); + if (p) + { + gametext(140+12,38+64+15+15, strchr(p,'_')+1, 0, 2+8+16); + } + } + } + + if (joynumaxes > 2) + { + menutext(320>>1,twothispage?158:108,SHX(-10),(joynumaxes<=2),"NEXT..."); + sprintf(tempbuf,"Page %d of %d",thispage+1,(joynumaxes+1)/2); + gametext(320-100,158,tempbuf,0,2+8+16); + } + break; + } + + case 213: + case 214: + case 215: + case 216: + { // Pray this is enough pages for now :-| + int first,last; + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"JOY DEAD ZONES"); + + first = 4*(current_menu-213); + last = min(4*(current_menu-213)+4,joynumaxes); + + onbar = 1; + x = probe(320,48,15,2*(last-first)+(joynumaxes>4)); + + if (x==-1) + { + cmenu(206); + probey = 2; + break; + } + else if (x==2*(last-first) && joynumaxes>4) + { + cmenu((current_menu-213) == (joynumaxes/4) ? 213 : (current_menu+1)); + probey = 0; + break; + } + + for (m=first;m4) + { + menutext(32,48+30*(last-first),0,0,"NEXT..."); + sprintf(tempbuf,"Page %d of %d", 1+(current_menu-213), (joynumaxes+3)/4); + gametext(320-100,158,tempbuf,0,2+8+16); + } + break; + } + + case 700: + case 701: + c = (320>>1)-120; + rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,24,0,0,"SOUND SETUP"); + onbar = (probey == 2 || probey == 3); + + x = probe(c,50,16,7); + switch (x) + { + case -1: + if (ps[myconnectindex].gm&MODE_GAME && current_menu == 701) + { + ps[myconnectindex].gm &= ~MODE_MENU; + if (ud.multimode < 2 && ud.recstat != 2) + { + ready2send = 1; + totalclock = ototalclock; + } + } + + else cmenu(202); + probey = 1; + break; + case 0: + if (FXDevice >= 0) + { + SoundToggle = 1-SoundToggle; + if (SoundToggle == 0) + { + FX_StopAllSounds(); + clearsoundlocks(); + } + onbar = 0; + } + break; + case 1: + if (MusicDevice >= 0 && (numplayers < 2 || MusicToggle)) + { + MusicToggle = 1-MusicToggle; + if (MusicToggle == 0) MUSIC_Pause(); + else + { + if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME) + playmusic(&music_fn[0][music_select][0]); + else playmusic(&env_music_fn[0][0]); + + MUSIC_Continue(); + } + } + onbar = 0; + + break; + case 4: + if (SoundToggle && (FXDevice >= 0)) + { + VoiceToggle = (VoiceToggle == 2) ? 0 : VoiceToggle+1; + } + onbar = 0; + break; + case 5: + if (SoundToggle && (FXDevice >= 0)) AmbienceToggle = 1-AmbienceToggle; + onbar = 0; + break; + case 6: + if (SoundToggle && (FXDevice >= 0)) + { + ReverseStereo = 1-ReverseStereo; + FX_SetReverseStereo(ReverseStereo); + } + onbar = 0; + break; + default: + onbar = 1; + break; + } + + menutext(c+160+40,50,MENUHIGHLIGHT(0),(FXDevice<0),SoundToggle && FXDevice >= 0?"ON":"OFF"); + + menutext(c+160+40,50+16,MENUHIGHLIGHT(1),(MusicDevice<0||(numplayers > 1 && !MusicToggle)),(MusicToggle && (MusicDevice >= 0))?"ON":"OFF"); + + menutext(c,50,MENUHIGHLIGHT(0),(FXDevice<0),"SOUND"); + menutext(c,50+16+16,MENUHIGHLIGHT(2),(FXDevice<0)||SoundToggle==0,"SOUND VOLUME"); + { + 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) + FXVolume <<= 2; + if (l != FXVolume) + FX_SetVolume((short) FXVolume); + } + menutext(c,50+16,MENUHIGHLIGHT(1),(MusicDevice<0||(numplayers > 1 && !MusicToggle)),"MUSIC"); + menutext(c,50+16+16+16,MENUHIGHLIGHT(3),(MusicDevice<0)||MusicToggle==0,"MUSIC VOLUME"); + { + l = MusicVolume; + MusicVolume >>= 2; + bar(c+167+40,50+16+16+16, + (short *)&MusicVolume,4, + (MusicDevice>=0) && x==3,MENUHIGHLIGHT(3), + MusicToggle==0||(MusicDevice<0)); + MusicVolume <<= 2; + if (l != MusicVolume) + MUSIC_SetVolume((short) MusicVolume); + + } + menutext(c,50+16+16+16+16,MENUHIGHLIGHT(4),(FXDevice<0)||SoundToggle==0,"DUKE TALK"); + menutext(c,50+16+16+16+16+16,MENUHIGHLIGHT(5),(FXDevice<0)||SoundToggle==0,"AMBIENCE"); + + 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+16,MENUHIGHLIGHT(5),(FXDevice<0)||SoundToggle==0,AmbienceToggle?"ON":"OFF"); + + menutext(c+160+40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(FXDevice<0)||SoundToggle==0,ReverseStereo?"ON":"OFF"); + + break; + + case 350: + cmenu(351); + screencapt = 1; + displayrooms(myconnectindex,65536); + //savetemp("duke3d.tmp",waloff[TILE_SAVESHOT],160*100); + screencapt = 0; + break; + + case 360: + case 361: + case 362: + case 363: + case 364: + case 365: + case 366: + case 367: + case 368: + case 369: + case 351: + case 300: + + c = 320>>1; + 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"); + else menutext(c,24,0,0,"SAVE GAME"); + + if (current_menu >= 360 && current_menu <= 369) + { + sprintf(tempbuf,"PLAYERS: %-2ld ",ud.multimode); + gametext(160,156,tempbuf,0,2+8+16); + sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+ud.volume_number,1+ud.level_number,ud.player_skill); + gametext(160,168,tempbuf,0,2+8+16); + if (ud.volume_number == 0 && ud.level_number == 7) + gametext(160,180,boardfilename,0,2+8+16); + + x = strget((320>>1),184,&ud.savegame[current_menu-360][0],19, 999); + + if (x == -1) + { + // readsavenames(); ps[myconnectindex].gm = MODE_GAME; - if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; } - KB_ClearKeyDown(sc_Escape); - sound(EXITMENUSOUND); + goto DISPLAYNAMES; } + + if (x == 1) + { + if (ud.savegame[current_menu-360][0] == 0) + { + KB_FlushKeyboardQueue(); + cmenu(351); + } + else + { + 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) + { + ready2send = 1; + totalclock = ototalclock; + } + KB_ClearKeyDown(sc_Escape); + sound(EXITMENUSOUND); + } + } + + rotatesprite(101<<16,97<<16,65536>>1,512,TILE_SAVESHOT,-32,0,2+4+8+64,0,0,xdim-1,ydim-1); + dispnames(); + rotatesprite((c+67+strlen(&ud.savegame[current_menu-360][0])*4)<<16,(50+12*probey)<<16,32768L-10240,0,SPINNINGNUKEICON+(((totalclock)>>3)%7),0,0,10,0,0,xdim-1,ydim-1); + break; } - rotatesprite(101<<16,97<<16,65536>>1,512,TILE_SAVESHOT,-32,0,2+4+8+64,0,0,xdim-1,ydim-1); - dispnames(); - rotatesprite((c+67+strlen(&ud.savegame[current_menu-360][0])*4)<<16,(50+12*probey)<<16,32768L-10240,0,SPINNINGNUKEICON+(((totalclock)>>3)%7),0,0,10,0,0,xdim-1,ydim-1); - break; - } + last_threehundred = probey; - last_threehundred = probey; + x = probe(c+68,54,12,10); - x = probe(c+68,54,12,10); - - if (current_menu == 300) - { - if (ud.savegame[probey][0]) + if (current_menu == 300) { - if (lastprobey != probey) + if (ud.savegame[probey][0]) { - loadpheader(probey,&savehead); + 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); + sprintf(tempbuf,"PLAYERS: %-2ld ",savehead.numplr); + gametext(160,156,tempbuf,0,2+8+16); + sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+savehead.volnum,1+savehead.levnum,savehead.plrskl); + gametext(160,168,tempbuf,0,2+8+16); + if (savehead.volnum == 0 && savehead.levnum == 7) + gametext(160,180,savehead.boardfn,0,2+8+16); + } + else menutext(69,70,0,0,"EMPTY"); + } + else + { + if (ud.savegame[probey][0]) + { + 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); } - - rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); - sprintf(tempbuf,"PLAYERS: %-2ld ",savehead.numplr); + else menutext(69,70,0,0,"EMPTY"); + sprintf(tempbuf,"PLAYERS: %-2ld ",ud.multimode); gametext(160,156,tempbuf,0,2+8+16); - sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+savehead.volnum,1+savehead.levnum,savehead.plrskl); + sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+ud.volume_number,1+ud.level_number,ud.player_skill); gametext(160,168,tempbuf,0,2+8+16); - if (savehead.volnum == 0 && savehead.levnum == 7) - gametext(160,180,savehead.boardfn,0,2+8+16); + if (ud.volume_number == 0 && ud.level_number == 7) + gametext(160,180,boardfilename,0,2+8+16); } - else menutext(69,70,0,0,"EMPTY"); - } - else - { - if (ud.savegame[probey][0]) - { - 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); - } - else menutext(69,70,0,0,"EMPTY"); - sprintf(tempbuf,"PLAYERS: %-2ld ",ud.multimode); - gametext(160,156,tempbuf,0,2+8+16); - sprintf(tempbuf,"EPISODE: %-2ld / LEVEL: %-2ld / SKILL: %-2ld",1+ud.volume_number,1+ud.level_number,ud.player_skill); - gametext(160,168,tempbuf,0,2+8+16); - if (ud.volume_number == 0 && ud.level_number == 7) - gametext(160,180,boardfilename,0,2+8+16); - } - switch (x) - { - case -1: - if (current_menu == 300) + switch (x) { - if ((ps[myconnectindex].gm&MODE_GAME) != MODE_GAME) - { - cmenu(0); + case -1: + if (current_menu == 300) + { + if ((ps[myconnectindex].gm&MODE_GAME) != MODE_GAME) + { + cmenu(0); + break; + } + else + ps[myconnectindex].gm &= ~MODE_MENU; + } + else + ps[myconnectindex].gm = MODE_GAME; + + if (ud.multimode < 2 && ud.recstat != 2) + { + ready2send = 1; + totalclock = ototalclock; + } + + break; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + if (current_menu == 300) + { + if (ud.savegame[x][0]) + current_menu = (1000+x); + } + else + { + if (ud.savegame[x][0] != 0) + current_menu = 2000+x; + else + { + KB_FlushKeyboardQueue(); + current_menu = (360+x); + ud.savegame[x][0] = 0; + inputloc = 0; + } + } break; - } - else - ps[myconnectindex].gm &= ~MODE_MENU; } - else - ps[myconnectindex].gm = MODE_GAME; - - if (ud.multimode < 2 && ud.recstat != 2) - { - ready2send = 1; - totalclock = ototalclock; - } - - break; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - if (current_menu == 300) - { - if (ud.savegame[x][0]) - current_menu = (1000+x); - } - else - { - if (ud.savegame[x][0] != 0) - current_menu = 2000+x; - else - { - KB_FlushKeyboardQueue(); - current_menu = (360+x); - ud.savegame[x][0] = 0; - inputloc = 0; - } - } - break; - } DISPLAYNAMES: - dispnames(); - break; + dispnames(); + break; - case 400: - case 401: - if (VOLUMEALL) goto VOLUME_ALL_40x; - case 402: - case 403: + case 400: + case 401: + if (VOLUMEALL) goto VOLUME_ALL_40x; + case 402: + case 403: - c = 320>>1; + c = 320>>1; - if (KB_KeyPressed(sc_LeftArrow) || - KB_KeyPressed(sc_kpad_4) || - KB_KeyPressed(sc_UpArrow) || - KB_KeyPressed(sc_PgUp) || - KB_KeyPressed(sc_kpad_8)) - { - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_kpad_4); - KB_ClearKeyDown(sc_UpArrow); - KB_ClearKeyDown(sc_PgUp); - KB_ClearKeyDown(sc_kpad_8); + if (KB_KeyPressed(sc_LeftArrow) || + KB_KeyPressed(sc_kpad_4) || + KB_KeyPressed(sc_UpArrow) || + KB_KeyPressed(sc_PgUp) || + KB_KeyPressed(sc_kpad_8)) + { + KB_ClearKeyDown(sc_LeftArrow); + KB_ClearKeyDown(sc_kpad_4); + KB_ClearKeyDown(sc_UpArrow); + KB_ClearKeyDown(sc_PgUp); + KB_ClearKeyDown(sc_kpad_8); - sound(KICK_HIT); - current_menu--; - if (current_menu < 400) current_menu = 403; - } - else if ( - KB_KeyPressed(sc_PgDn) || - KB_KeyPressed(sc_Enter) || - KB_KeyPressed(sc_kpad_Enter) || - KB_KeyPressed(sc_RightArrow) || - KB_KeyPressed(sc_DownArrow) || - KB_KeyPressed(sc_kpad_2) || - KB_KeyPressed(sc_kpad_9) || - KB_KeyPressed(sc_Space) || - KB_KeyPressed(sc_kpad_6)) - { - KB_ClearKeyDown(sc_PgDn); - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_RightArrow); - KB_ClearKeyDown(sc_kpad_Enter); - KB_ClearKeyDown(sc_kpad_6); - KB_ClearKeyDown(sc_kpad_9); - KB_ClearKeyDown(sc_kpad_2); - KB_ClearKeyDown(sc_DownArrow); - KB_ClearKeyDown(sc_Space); - sound(KICK_HIT); - current_menu++; - if (current_menu > 403) current_menu = 400; - } + sound(KICK_HIT); + current_menu--; + if (current_menu < 400) current_menu = 403; + } + else if ( + KB_KeyPressed(sc_PgDn) || + KB_KeyPressed(sc_Enter) || + KB_KeyPressed(sc_kpad_Enter) || + KB_KeyPressed(sc_RightArrow) || + KB_KeyPressed(sc_DownArrow) || + KB_KeyPressed(sc_kpad_2) || + KB_KeyPressed(sc_kpad_9) || + KB_KeyPressed(sc_Space) || + KB_KeyPressed(sc_kpad_6)) + { + KB_ClearKeyDown(sc_PgDn); + KB_ClearKeyDown(sc_Enter); + KB_ClearKeyDown(sc_RightArrow); + KB_ClearKeyDown(sc_kpad_Enter); + KB_ClearKeyDown(sc_kpad_6); + KB_ClearKeyDown(sc_kpad_9); + KB_ClearKeyDown(sc_kpad_2); + KB_ClearKeyDown(sc_DownArrow); + KB_ClearKeyDown(sc_Space); + sound(KICK_HIT); + current_menu++; + if (current_menu > 403) current_menu = 400; + } - if (KB_KeyPressed(sc_Escape)) - { - if (ps[myconnectindex].gm&MODE_GAME) - cmenu(50); - else cmenu(0); - return; - } + if (KB_KeyPressed(sc_Escape)) + { + if (ps[myconnectindex].gm&MODE_GAME) + cmenu(50); + else cmenu(0); + return; + } - flushperms(); - rotatesprite(0,0,65536L,0,ORDERING+current_menu-400,0,0,10+16+64,0,0,xdim-1,ydim-1); + flushperms(); + rotatesprite(0,0,65536L,0,ORDERING+current_menu-400,0,0,10+16+64,0,0,xdim-1,ydim-1); - break; + break; VOLUME_ALL_40x: - c = 320>>1; + c = 320>>1; - if (KB_KeyPressed(sc_LeftArrow) || - KB_KeyPressed(sc_kpad_4) || - KB_KeyPressed(sc_UpArrow) || - KB_KeyPressed(sc_PgUp) || - KB_KeyPressed(sc_kpad_8)) - { - KB_ClearKeyDown(sc_LeftArrow); - KB_ClearKeyDown(sc_kpad_4); - KB_ClearKeyDown(sc_UpArrow); - KB_ClearKeyDown(sc_PgUp); - KB_ClearKeyDown(sc_kpad_8); - - sound(KICK_HIT); - current_menu--; - if (current_menu < 400) current_menu = 401; - } - else if ( - KB_KeyPressed(sc_PgDn) || - KB_KeyPressed(sc_Enter) || - KB_KeyPressed(sc_kpad_Enter) || - KB_KeyPressed(sc_RightArrow) || - KB_KeyPressed(sc_DownArrow) || - KB_KeyPressed(sc_kpad_2) || - KB_KeyPressed(sc_kpad_9) || - KB_KeyPressed(sc_Space) || - KB_KeyPressed(sc_kpad_6)) - { - KB_ClearKeyDown(sc_PgDn); - KB_ClearKeyDown(sc_Enter); - KB_ClearKeyDown(sc_RightArrow); - KB_ClearKeyDown(sc_kpad_Enter); - KB_ClearKeyDown(sc_kpad_6); - KB_ClearKeyDown(sc_kpad_9); - KB_ClearKeyDown(sc_kpad_2); - KB_ClearKeyDown(sc_DownArrow); - KB_ClearKeyDown(sc_Space); - sound(KICK_HIT); - current_menu++; - if (current_menu > 401) current_menu = 400; - } - - if (KB_KeyPressed(sc_Escape)) - { - if (ps[myconnectindex].gm&MODE_GAME) - cmenu(50); - else cmenu(0); - return; - } - - flushperms(); - switch (current_menu) - { - case 400: - rotatesprite(0,0,65536L,0,TEXTSTORY,0,0,10+16+64, 0,0,xdim-1,ydim-1); - break; - case 401: - rotatesprite(0,0,65536L,0,F1HELP,0,0,10+16+64, 0,0,xdim-1,ydim-1); - break; - } - - break; - - case 500: - case 502: - c = 320>>1; - - 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) - { - KB_FlushKeyboardQueue(); - - sendquit(); - } - - x = probe(186,124,0,0); - if (x == -1 || KB_KeyPressed(sc_N) || RMB) - { - KB_ClearKeyDown(sc_N); - quittimer = 0; - if (ps[myconnectindex].gm&MODE_DEMO && ud.recstat == 2) - ps[myconnectindex].gm = MODE_DEMO; - else + if (KB_KeyPressed(sc_LeftArrow) || + KB_KeyPressed(sc_kpad_4) || + KB_KeyPressed(sc_UpArrow) || + KB_KeyPressed(sc_PgUp) || + KB_KeyPressed(sc_kpad_8)) { - if (current_menu == 502) + KB_ClearKeyDown(sc_LeftArrow); + KB_ClearKeyDown(sc_kpad_4); + KB_ClearKeyDown(sc_UpArrow); + KB_ClearKeyDown(sc_PgUp); + KB_ClearKeyDown(sc_kpad_8); + + sound(KICK_HIT); + current_menu--; + if (current_menu < 400) current_menu = 401; + } + else if ( + KB_KeyPressed(sc_PgDn) || + KB_KeyPressed(sc_Enter) || + KB_KeyPressed(sc_kpad_Enter) || + KB_KeyPressed(sc_RightArrow) || + KB_KeyPressed(sc_DownArrow) || + KB_KeyPressed(sc_kpad_2) || + KB_KeyPressed(sc_kpad_9) || + KB_KeyPressed(sc_Space) || + KB_KeyPressed(sc_kpad_6)) + { + KB_ClearKeyDown(sc_PgDn); + KB_ClearKeyDown(sc_Enter); + KB_ClearKeyDown(sc_RightArrow); + KB_ClearKeyDown(sc_kpad_Enter); + KB_ClearKeyDown(sc_kpad_6); + KB_ClearKeyDown(sc_kpad_9); + KB_ClearKeyDown(sc_kpad_2); + KB_ClearKeyDown(sc_DownArrow); + KB_ClearKeyDown(sc_Space); + sound(KICK_HIT); + current_menu++; + if (current_menu > 401) current_menu = 400; + } + + if (KB_KeyPressed(sc_Escape)) + { + if (ps[myconnectindex].gm&MODE_GAME) + cmenu(50); + else cmenu(0); + return; + } + + flushperms(); + switch (current_menu) + { + case 400: + rotatesprite(0,0,65536L,0,TEXTSTORY,0,0,10+16+64, 0,0,xdim-1,ydim-1); + break; + case 401: + rotatesprite(0,0,65536L,0,F1HELP,0,0,10+16+64, 0,0,xdim-1,ydim-1); + break; + } + + break; + + case 500: + case 502: + c = 320>>1; + + 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) + { + KB_FlushKeyboardQueue(); + + sendquit(); + } + + x = probe(186,124,0,0); + if (x == -1 || KB_KeyPressed(sc_N) || RMB) + { + KB_ClearKeyDown(sc_N); + quittimer = 0; + if (ps[myconnectindex].gm&MODE_DEMO && ud.recstat == 2) + ps[myconnectindex].gm = MODE_DEMO; + else { - cmenu(last_menu); - probey = last_probey; + if (current_menu == 502) + { + cmenu(last_menu); + probey = last_probey; + } + 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) + { + ready2send = 1; + totalclock = ototalclock; + } } - else if (!(ps[myconnectindex].gm & MODE_GAME || ud.recstat == 2)) - cmenu(0); - else ps[myconnectindex].gm &= ~MODE_MENU; + } + + break; + case 501: + c = 320>>1; + 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) + { + KB_FlushKeyboardQueue(); + ps[myconnectindex].gm = MODE_DEMO; + if (ud.recstat == 1) + closedemowrite(); + cmenu(0); + } + + x = probe(186,124,0,0); + + if (x == -1 || KB_KeyPressed(sc_N) || RMB) + { + ps[myconnectindex].gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; totalclock = ototalclock; } } - } - break; - case 501: - c = 320>>1; - gametext(c,90,"Quit to Title?",0,2+8+16); - gametext(c,99,"(Y/N)",0,2+8+16); + break; - 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) - closedemowrite(); - cmenu(0); - } + case 601: + displayfragbar(); + rotatesprite(160<<16,29<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); + menutext(320>>1,34,0,0,&ud.user_name[myconnectindex][0]); - x = probe(186,124,0,0); + sprintf(tempbuf,"Waiting for master"); + gametext(160,50,tempbuf,0,2+8+16); + gametext(160,59,"to select level",0,2+8+16); - if (x == -1 || KB_KeyPressed(sc_N) || RMB) - { - ps[myconnectindex].gm &= ~MODE_MENU; - if (ud.multimode < 2 && ud.recstat != 2) + if (KB_KeyPressed(sc_Escape)) { - ready2send = 1; - totalclock = ototalclock; - } - } - - break; - - case 601: - displayfragbar(); - rotatesprite(160<<16,29<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,34,0,0,&ud.user_name[myconnectindex][0]); - - sprintf(tempbuf,"Waiting for master"); - gametext(160,50,tempbuf,0,2+8+16); - gametext(160,59,"to select level",0,2+8+16); - - if (KB_KeyPressed(sc_Escape)) - { - KB_ClearKeyDown(sc_Escape); - sound(EXITMENUSOUND); - cmenu(0); - } - break; - - case 602: - if (menunamecnt == 0) - { - // getfilenames("SUBD"); - getfilenames(".","*.MAP"); - if (menunamecnt == 0) - cmenu(600); - } - - case 603: - { - int plrvotes = 0, j = 0; - - x = probe(186,124,0,0); - - if (voting != myconnectindex) - ps[myconnectindex].gm &= ~MODE_MENU; - - if (x == -1) { - if (voting == myconnectindex) - { - Bmemset(votes,0,sizeof(votes)); - Bmemset(gotvote,0,sizeof(gotvote)); - - tempbuf[0] = 18; - tempbuf[1] = 2; - tempbuf[2] = myconnectindex; - - for (c=connecthead;c>=0;c=connectpoint2[c]) - { - if (c != myconnectindex) sendpacket(c,tempbuf,3); - if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master - } - voting = -1; - } + KB_ClearKeyDown(sc_Escape); + sound(EXITMENUSOUND); cmenu(0); } + break; - for (i=0;i (numplayers>>1)) || (!networkmode && myconnectindex == connecthead)) + + case 603: { - 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; + int plrvotes = 0, j = 0; - if (ud.m_player_skill == 3) ud.m_respawn_monsters = 1; - else ud.m_respawn_monsters = 0; + x = probe(186,124,0,0); - 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; - - 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 (c=connecthead;c>=0;c=connectpoint2[c]) - { - resetweapons(c); - resetinventory(c); - - } - for (c=connecthead;c>=0;c=connectpoint2[c]) - { - if (c != myconnectindex) sendpacket(c,tempbuf,12); - if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master - } - - if (voting == myconnectindex) - adduserquote("VOTE SUCCEEDED"); - - newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill+1); - if (enterlevel(MODE_GAME)) backtomenu(); - - return; - } - else if (j == numplayers) { - Bmemset(votes,0,sizeof(votes)); - Bmemset(gotvote,0,sizeof(gotvote)); - voting = -1; - - tempbuf[0] = 18; - tempbuf[1] = 2; - tempbuf[2] = myconnectindex; - tempbuf[3] = 1; - - for (c=connecthead;c>=0;c=connectpoint2[c]) - { - if (c != myconnectindex) sendpacket(c,tempbuf,4); - if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master - } - - Bsprintf(fta_quotes[116],"VOTE FAILED"); - FTA(116,&ps[myconnectindex]); + if (voting != myconnectindex) ps[myconnectindex].gm &= ~MODE_MENU; - } - } else { - gametext(160,90,"WAITING FOR VOTES",0,2); - } - break; - } - case 600: - c = (320>>1) - 120; - 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]); - x = probe(c,57-8,16,8); - - modval(0,num_gametypes-1,(int *)&ud.m_coop,1,probey==0); - 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)) - modval(0,1,(int *)&ud.m_marker,1,probey==4); - 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) - { - case -1: - ud.m_recstat = 0; - 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; - 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) - 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)) - ud.m_level_number = 0; - } else { - 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; - break; - case 3: - if (ud.m_monsters_off == 1 && ud.m_player_skill > 0) - ud.m_monsters_off = 0; - - if (ud.m_monsters_off == 0) - { - ud.m_player_skill++; - if (ud.m_player_skill > 3) + if (x == -1) { - ud.m_player_skill = 0; - ud.m_monsters_off = 1; - } - } - else ud.m_monsters_off = 0; - - break; - - case 4: - 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))) - ud.m_ffire = !ud.m_ffire; - else ud.m_noexits = !ud.m_noexits; - break; - - case 6: - if (VOLUMEALL) { - currentlist = 1; - last_probey = probey; - cmenu(101); - } - break; - case 7: - if (voting == -1) - { - if (ps[myconnectindex].i) - { - Bmemset(votes,0,sizeof(votes)); - Bmemset(gotvote,0,sizeof(gotvote)); - votes[myconnectindex] = gotvote[myconnectindex] = 1; - voting = myconnectindex; - - tempbuf[0] = 18; - tempbuf[1] = 1; - tempbuf[2] = myconnectindex; - tempbuf[3] = ud.m_volume_number; - tempbuf[4] = ud.m_level_number; - - for (c=connecthead;c>=0;c=connectpoint2[c]) + if (voting == myconnectindex) { - if (c != myconnectindex) sendpacket(c,tempbuf,5); - if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + Bmemset(votes,0,sizeof(votes)); + Bmemset(gotvote,0,sizeof(gotvote)); + + tempbuf[0] = 18; + tempbuf[1] = 2; + tempbuf[2] = myconnectindex; + + for (c=connecthead;c>=0;c=connectpoint2[c]) + { + if (c != myconnectindex) sendpacket(c,tempbuf,3); + if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + } + voting = -1; + } + cmenu(0); + } + + for (i=0;i (numplayers>>1)) || (!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; + else ud.m_respawn_monsters = 0; + + 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; + + 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 (c=connecthead;c>=0;c=connectpoint2[c]) + { + resetweapons(c); + resetinventory(c); + + } + for (c=connecthead;c>=0;c=connectpoint2[c]) + { + if (c != myconnectindex) sendpacket(c,tempbuf,12); + if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + } + + if (voting == myconnectindex) + adduserquote("VOTE SUCCEEDED"); + + newgame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill+1); + if (enterlevel(MODE_GAME)) backtomenu(); + + return; + } + else if (j == numplayers) + { + Bmemset(votes,0,sizeof(votes)); + Bmemset(gotvote,0,sizeof(gotvote)); + voting = -1; + + tempbuf[0] = 18; + tempbuf[1] = 2; + tempbuf[2] = myconnectindex; + tempbuf[3] = 1; + + for (c=connecthead;c>=0;c=connectpoint2[c]) + { + if (c != myconnectindex) sendpacket(c,tempbuf,4); + if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + } + + Bsprintf(fta_quotes[116],"VOTE FAILED"); + FTA(116,&ps[myconnectindex]); + ps[myconnectindex].gm &= ~MODE_MENU; } } - cmenu(603); + else + { + gametext(160,90,"WAITING FOR VOTES",0,2); + } + break; } + case 600: + c = (320>>1) - 120; + 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]); + + x = probe(c,57-8,16,8); + + modval(0,num_gametypes-1,(int *)&ud.m_coop,1,probey==0); + 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)) + modval(0,1,(int *)&ud.m_marker,1,probey==4); + 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) + { + case -1: + ud.m_recstat = 0; + 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; + 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) + 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)) + ud.m_level_number = 0; + } + else + { + 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; + break; + case 3: + if (ud.m_monsters_off == 1 && ud.m_player_skill > 0) + ud.m_monsters_off = 0; + + if (ud.m_monsters_off == 0) + { + ud.m_player_skill++; + if (ud.m_player_skill > 3) + { + ud.m_player_skill = 0; + ud.m_monsters_off = 1; + } + } + else ud.m_monsters_off = 0; + + break; + + case 4: + 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))) + ud.m_ffire = !ud.m_ffire; + else ud.m_noexits = !ud.m_noexits; + break; + + case 6: + if (VOLUMEALL) + { + currentlist = 1; + last_probey = probey; + cmenu(101); + } + break; + case 7: + if (voting == -1) + { + if (ps[myconnectindex].i) + { + Bmemset(votes,0,sizeof(votes)); + Bmemset(gotvote,0,sizeof(gotvote)); + votes[myconnectindex] = gotvote[myconnectindex] = 1; + voting = myconnectindex; + + tempbuf[0] = 18; + tempbuf[1] = 1; + tempbuf[2] = myconnectindex; + tempbuf[3] = ud.m_volume_number; + tempbuf[4] = ud.m_level_number; + + for (c=connecthead;c>=0;c=connectpoint2[c]) + { + if (c != myconnectindex) sendpacket(c,tempbuf,5); + if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + } + } + cmenu(603); + } + break; + } + + c += 40; + + //if(ud.m_coop==1) gametext(c+70,57-7-9,"COOPERATIVE PLAY",0,2+8+16); + //else if(ud.m_coop==2) gametext(c+70,57-7-9,"DUKEMATCH (NO SPAWN)",0,2+8+16); + //else gametext(c+70,57-7-9,"DUKEMATCH (SPAWN)",0,2+8+16); + gametext(c+70,57-7-9,gametype_names[ud.m_coop],MENUHIGHLIGHT(0),2+8+16); + if (VOLUMEONE) + { + gametext(c+70,57+16-7-9,volume_names[ud.m_volume_number],MENUHIGHLIGHT(1),2+8+16); + } + else + { + gametext(c+70,57+16-7-9,volume_names[ud.m_volume_number],MENUHIGHLIGHT(1),2+8+16); + } + + gametext(c+70,57+16+16-7-9,&level_names[11*ud.m_volume_number+ud.m_level_number][0],MENUHIGHLIGHT(2),2+8+16); + + 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) + 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)) + 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); + + c -= 44; + + menutext(c,57-9,MENUHIGHLIGHT(0),PHX(-2),"GAME TYPE"); + + if (VOLUMEONE) + { + sprintf(tempbuf,"EPISODE %ld",ud.m_volume_number+1); + menutext(c,57+16-9,MENUHIGHLIGHT(1),1,tempbuf); + } + else + { + sprintf(tempbuf,"EPISODE %ld",ud.m_volume_number+1); + menutext(c,57+16-9,MENUHIGHLIGHT(1),PHX(-3),tempbuf); + } + + sprintf(tempbuf,"LEVEL %ld",ud.m_level_number+1); + menutext(c,57+16+16-9,MENUHIGHLIGHT(2),PHX(-4),tempbuf); + + menutext(c,57+16+16+16-9,MENUHIGHLIGHT(3),PHX(-5),"MONSTERS"); + + 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)) + 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) + 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"); + } + + menutext(c,57+16+16+16+16+16+16+16-9,MENUHIGHLIGHT(7),voting!=-1,"START GAME"); + break; - } - - c += 40; - - //if(ud.m_coop==1) gametext(c+70,57-7-9,"COOPERATIVE PLAY",0,2+8+16); - //else if(ud.m_coop==2) gametext(c+70,57-7-9,"DUKEMATCH (NO SPAWN)",0,2+8+16); - //else gametext(c+70,57-7-9,"DUKEMATCH (SPAWN)",0,2+8+16); - gametext(c+70,57-7-9,gametype_names[ud.m_coop],MENUHIGHLIGHT(0),2+8+16); - if (VOLUMEONE) { - gametext(c+70,57+16-7-9,volume_names[ud.m_volume_number],MENUHIGHLIGHT(1),2+8+16); - } else { - gametext(c+70,57+16-7-9,volume_names[ud.m_volume_number],MENUHIGHLIGHT(1),2+8+16); - } - - gametext(c+70,57+16+16-7-9,&level_names[11*ud.m_volume_number+ud.m_level_number][0],MENUHIGHLIGHT(2),2+8+16); - - 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) - 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)) - 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); - - c -= 44; - - menutext(c,57-9,MENUHIGHLIGHT(0),PHX(-2),"GAME TYPE"); - - if (VOLUMEONE) { - sprintf(tempbuf,"EPISODE %ld",ud.m_volume_number+1); - menutext(c,57+16-9,MENUHIGHLIGHT(1),1,tempbuf); - } else { - sprintf(tempbuf,"EPISODE %ld",ud.m_volume_number+1); - menutext(c,57+16-9,MENUHIGHLIGHT(1),PHX(-3),tempbuf); - } - - sprintf(tempbuf,"LEVEL %ld",ud.m_level_number+1); - menutext(c,57+16+16-9,MENUHIGHLIGHT(2),PHX(-4),tempbuf); - - menutext(c,57+16+16+16-9,MENUHIGHLIGHT(3),PHX(-5),"MONSTERS"); - - 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)) - 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) - 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"); - } - - menutext(c,57+16+16+16+16+16+16+16-9,MENUHIGHLIGHT(7),voting!=-1,"START GAME"); - - break; } if ((ps[myconnectindex].gm&MODE_MENU) != MODE_MENU) diff --git a/polymer/eduke32/source/namesdyn.c b/polymer/eduke32/source/namesdyn.c index 24999b8c3..a6ecc8c8b 100644 --- a/polymer/eduke32/source/namesdyn.c +++ b/polymer/eduke32/source/namesdyn.c @@ -768,792 +768,793 @@ unsigned short dynamictostatic[MAXTILES]; void processnames(char *szLabel, long lValue) { - switch (szLabel[0]) { - case 'A': - if (!Bstrcmp(szLabel,"ACTIVATOR")) ACTIVATOR = lValue; - else if (!Bstrcmp(szLabel,"ACTIVATORLOCKED")) ACTIVATORLOCKED = lValue; - else if (!Bstrcmp(szLabel,"ARROW")) ARROW = lValue; - else if (!Bstrcmp(szLabel,"AMMOBOX")) AMMOBOX = lValue; - else if (!Bstrcmp(szLabel,"AMMO")) AMMO = lValue; - else if (!Bstrcmp(szLabel,"AMMOLOTS")) AMMOLOTS = lValue; - else if (!Bstrcmp(szLabel,"AIRTANK")) AIRTANK = lValue; - else if (!Bstrcmp(szLabel,"ACCESSCARD")) ACCESSCARD = lValue; - else if (!Bstrcmp(szLabel,"ATOMICHEALTH")) ATOMICHEALTH = lValue; - else if (!Bstrcmp(szLabel,"ACCESSSWITCH")) ACCESSSWITCH = lValue; - else if (!Bstrcmp(szLabel,"ACCESSSWITCH2")) ACCESSSWITCH2 = lValue; - else if (!Bstrcmp(szLabel,"ANTENNA")) ANTENNA = lValue; - else if (!Bstrcmp(szLabel,"ATM")) ATM = lValue; - else if (!Bstrcmp(szLabel,"ATMBROKE")) ATMBROKE = lValue; - else if (!Bstrcmp(szLabel,"ALIENSWITCH")) ALIENSWITCH = lValue; - else if (!Bstrcmp(szLabel,"APLAYERTOP")) APLAYERTOP = lValue; - else if (!Bstrcmp(szLabel,"APLAYER")) APLAYER = lValue; - else if (!Bstrcmp(szLabel,"ARMJIB1")) ARMJIB1 = lValue; - else if (!Bstrcmp(szLabel,"AIRTANK_ICON")) AIRTANK_ICON = lValue; - else if (!Bstrcmp(szLabel,"ACCESS_ICON")) ACCESS_ICON = lValue; - break; - case 'B': - if (!Bstrcmp(szLabel,"BATTERYAMMO")) BATTERYAMMO = lValue; - else if (!Bstrcmp(szLabel,"BOOTS")) BOOTS = lValue; - else if (!Bstrcmp(szLabel,"BIGORBIT1")) BIGORBIT1 = lValue; - else if (!Bstrcmp(szLabel,"BIGORBIT2")) BIGORBIT2 = lValue; - else if (!Bstrcmp(szLabel,"BIGORBIT3")) BIGORBIT3 = lValue; - else if (!Bstrcmp(szLabel,"BIGORBIT4")) BIGORBIT4 = lValue; - else if (!Bstrcmp(szLabel,"BIGORBIT5")) BIGORBIT5 = lValue; - else if (!Bstrcmp(szLabel,"BIGFORCE")) BIGFORCE = lValue; - else if (!Bstrcmp(szLabel,"BPANNEL1")) BPANNEL1 = lValue; - else if (!Bstrcmp(szLabel,"BROKENCHAIR")) BROKENCHAIR = lValue; - else if (!Bstrcmp(szLabel,"BGRATE1")) BGRATE1 = lValue; - else if (!Bstrcmp(szLabel,"BRICK")) BRICK = lValue; - else if (!Bstrcmp(szLabel,"BOLT1")) BOLT1 = lValue; - else if (!Bstrcmp(szLabel,"BIGHOLE2")) BIGHOLE2 = lValue; - else if (!Bstrcmp(szLabel,"BOUNCEMINE")) BOUNCEMINE = lValue; - else if (!Bstrcmp(szLabel,"BROKEFIREHYDRENT")) BROKEFIREHYDRENT = lValue; - else if (!Bstrcmp(szLabel,"BOX")) BOX = lValue; - else if (!Bstrcmp(szLabel,"BULLETHOLE")) BULLETHOLE = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE1")) BOTTLE1 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE2")) BOTTLE2 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE3")) BOTTLE3 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE4")) BOTTLE4 = lValue; - else if (!Bstrcmp(szLabel,"BROKEHYDROPLANT")) BROKEHYDROPLANT = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE5")) BOTTLE5 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE6")) BOTTLE6 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE8")) BOTTLE8 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE7")) BOTTLE7 = lValue; - else if (!Bstrcmp(szLabel,"BROKENCLOCK")) BROKENCLOCK = lValue; - else if (!Bstrcmp(szLabel,"BIGHOLE")) BIGHOLE = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE10")) BOTTLE10 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE11")) BOTTLE11 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE12")) BOTTLE12 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE13")) BOTTLE13 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE14")) BOTTLE14 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE15")) BOTTLE15 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE16")) BOTTLE16 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE17")) BOTTLE17 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE18")) BOTTLE18 = lValue; - else if (!Bstrcmp(szLabel,"BOTTLE19")) BOTTLE19 = lValue; - else if (!Bstrcmp(szLabel,"BARBROKE")) BARBROKE = lValue; - else if (!Bstrcmp(szLabel,"BLOODPOOL")) BLOODPOOL = lValue; - else if (!Bstrcmp(szLabel,"BANNER")) BANNER = lValue; - else if (!Bstrcmp(szLabel,"BLANKSCREEN")) BLANKSCREEN = lValue; - else if (!Bstrcmp(szLabel,"BLOODYPOLE")) BLOODYPOLE = lValue; - else if (!Bstrcmp(szLabel,"BLOOD")) BLOOD = lValue; - else if (!Bstrcmp(szLabel,"BURNING")) BURNING = lValue; - else if (!Bstrcmp(szLabel,"BLOODSPLAT1")) BLOODSPLAT1 = lValue; - else if (!Bstrcmp(szLabel,"BLOODSPLAT3")) BLOODSPLAT3 = lValue; - else if (!Bstrcmp(szLabel,"BLOODSPLAT2")) BLOODSPLAT2 = lValue; - else if (!Bstrcmp(szLabel,"BLOODSPLAT4")) BLOODSPLAT4 = lValue; - else if (!Bstrcmp(szLabel,"BURNING2")) BURNING2 = lValue; - else if (!Bstrcmp(szLabel,"BETAVERSION")) BETAVERSION = lValue; - else if (!Bstrcmp(szLabel,"BADGUYICON")) BADGUYICON = lValue; - else if (!Bstrcmp(szLabel,"BOTTOMSTATUSBAR")) BOTTOMSTATUSBAR = lValue; - else if (!Bstrcmp(szLabel,"BOOT_ICON")) BOOT_ICON = lValue; - else if (!Bstrcmp(szLabel,"BETASCREEN")) BETASCREEN = lValue; - else if (!Bstrcmp(szLabel,"BOSS1")) BOSS1 = lValue; - else if (!Bstrcmp(szLabel,"BOSS1STAYPUT")) BOSS1STAYPUT = lValue; - else if (!Bstrcmp(szLabel,"BOSS1SHOOT")) BOSS1SHOOT = lValue; - else if (!Bstrcmp(szLabel,"BOSS1LOB")) BOSS1LOB = lValue; - else if (!Bstrcmp(szLabel,"BOSSTOP")) BOSSTOP = lValue; - else if (!Bstrcmp(szLabel,"BOSS2")) BOSS2 = lValue; - else if (!Bstrcmp(szLabel,"BOSS3")) BOSS3 = lValue; - else if (!Bstrcmp(szLabel,"BIGFNTCURSOR")) BIGFNTCURSOR = lValue; - else if (!Bstrcmp(szLabel,"BIGALPHANUM")) BIGALPHANUM = lValue; - else if (!Bstrcmp(szLabel,"BIGPERIOD")) BIGPERIOD = lValue; - else if (!Bstrcmp(szLabel,"BIGCOMMA")) BIGCOMMA = lValue; - else if (!Bstrcmp(szLabel,"BIGX")) BIGX = lValue; - else if (!Bstrcmp(szLabel,"BIGQ")) BIGQ = lValue; - else if (!Bstrcmp(szLabel,"BIGSEMI")) BIGSEMI = lValue; - else if (!Bstrcmp(szLabel,"BIGCOLIN")) BIGCOLIN = lValue; - else if (!Bstrcmp(szLabel,"BIGAPPOS")) BIGAPPOS = lValue; - else if (!Bstrcmp(szLabel,"BLANK")) BLANK = lValue; - else if (!Bstrcmp(szLabel,"BUTTON1")) BUTTON1 = lValue; - else if (!Bstrcmp(szLabel,"BONUSSCREEN")) BONUSSCREEN = lValue; - else if (!Bstrcmp(szLabel,"BORNTOBEWILDSCREEN")) BORNTOBEWILDSCREEN = lValue; - else if (!Bstrcmp(szLabel,"BLIMP")) BLIMP = lValue; - else if (!Bstrcmp(szLabel,"BPANNEL3")) BPANNEL3 = lValue; - else if (!Bstrcmp(szLabel,"BROOM")) BROOM = lValue; - else if (!Bstrcmp(szLabel,"BOSS4")) BOSS4 = lValue; - else if (!Bstrcmp(szLabel,"BOSS4STAYPUT")) BOSS4STAYPUT = lValue; - break; - case 'C': - if (!Bstrcmp(szLabel,"CYCLER")) CYCLER = lValue; - else if (!Bstrcmp(szLabel,"CHAINGUNSPRITE")) CHAINGUNSPRITE = lValue; - else if (!Bstrcmp(szLabel,"CRYSTALAMMO")) CRYSTALAMMO = lValue; - else if (!Bstrcmp(szLabel,"COLA")) COLA = lValue; - else if (!Bstrcmp(szLabel,"CLOUDYOCEAN")) CLOUDYOCEAN = lValue; - else if (!Bstrcmp(szLabel,"CLOUDYSKIES")) CLOUDYSKIES = lValue; - else if (!Bstrcmp(szLabel,"CRACK1")) CRACK1 = lValue; - else if (!Bstrcmp(szLabel,"CRACK2")) CRACK2 = lValue; - else if (!Bstrcmp(szLabel,"CRACK3")) CRACK3 = lValue; - else if (!Bstrcmp(szLabel,"CRACK4")) CRACK4 = lValue; - else if (!Bstrcmp(szLabel,"CAMERAPOLE")) CAMERAPOLE = lValue; - else if (!Bstrcmp(szLabel,"CHAIR1")) CHAIR1 = lValue; - else if (!Bstrcmp(szLabel,"CHAIR2")) CHAIR2 = lValue; - else if (!Bstrcmp(szLabel,"CAMERA1")) CAMERA1 = lValue; - else if (!Bstrcmp(szLabel,"CHAIR3")) CHAIR3 = lValue; - else if (!Bstrcmp(szLabel,"CAMERALIGHT")) CAMERALIGHT = lValue; - else if (!Bstrcmp(szLabel,"CACTUS")) CACTUS = lValue; - else if (!Bstrcmp(szLabel,"CACTUSBROKE")) CACTUSBROKE = lValue; - else if (!Bstrcmp(szLabel,"CONE")) CONE = lValue; - else if (!Bstrcmp(szLabel,"CLOCK")) CLOCK = lValue; - else if (!Bstrcmp(szLabel,"CIRCLEPANNEL")) CIRCLEPANNEL = lValue; - else if (!Bstrcmp(szLabel,"CIRCLEPANNELBROKE")) CIRCLEPANNELBROKE = lValue; - else if (!Bstrcmp(szLabel,"COLAMACHINE")) COLAMACHINE = lValue; - else if (!Bstrcmp(szLabel,"COLAMACHINEBROKE")) COLAMACHINEBROKE = lValue; - else if (!Bstrcmp(szLabel,"CRANEPOLE")) CRANEPOLE = lValue; - else if (!Bstrcmp(szLabel,"CRANE")) CRANE = lValue; - else if (!Bstrcmp(szLabel,"CANWITHSOMETHING")) CANWITHSOMETHING = lValue; - else if (!Bstrcmp(szLabel,"CEILINGSTEAM")) CEILINGSTEAM = lValue; - else if (!Bstrcmp(szLabel,"COOLEXPLOSION1")) COOLEXPLOSION1 = lValue; - else if (!Bstrcmp(szLabel,"CANNONBALL")) CANNONBALL = lValue; - else if (!Bstrcmp(szLabel,"COMMANDER")) COMMANDER = lValue; - else if (!Bstrcmp(szLabel,"COMMANDERSTAYPUT")) COMMANDERSTAYPUT = lValue; - else if (!Bstrcmp(szLabel,"CRACKKNUCKLES")) CRACKKNUCKLES = lValue; - else if (!Bstrcmp(szLabel,"CAMCORNER")) CAMCORNER = lValue; - else if (!Bstrcmp(szLabel,"CAMLIGHT")) CAMLIGHT = lValue; - else if (!Bstrcmp(szLabel,"CROSSHAIR")) CROSSHAIR = lValue; - else if (!Bstrcmp(szLabel,"CLIPINHAND")) CLIPINHAND = lValue; - else if (!Bstrcmp(szLabel,"CHAINGUN")) CHAINGUN = lValue; - else if (!Bstrcmp(szLabel,"CATLITE")) CATLITE = lValue; - else if (!Bstrcmp(szLabel,"COFFEEMACHINE")) COFFEEMACHINE = lValue; - else if (!Bstrcmp(szLabel,"CUPS")) CUPS = lValue; - else if (!Bstrcmp(szLabel,"COFFEEMUG")) COFFEEMUG = lValue; - else if (!Bstrcmp(szLabel,"CHESTOFGOLD")) CHESTOFGOLD = lValue; - else if (!Bstrcmp(szLabel,"CANWITHSOMETHING2")) CANWITHSOMETHING2 = lValue; - else if (!Bstrcmp(szLabel,"CANWITHSOMETHING3")) CANWITHSOMETHING3 = lValue; - else if (!Bstrcmp(szLabel,"CANWITHSOMETHING4")) CANWITHSOMETHING4 = lValue; - break; - case 'D': - if (!Bstrcmp(szLabel,"DEVISTATORSPRITE")) DEVISTATORSPRITE = lValue; - else if (!Bstrcmp(szLabel,"DEVISTATORAMMO")) DEVISTATORAMMO = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE5")) DOORTILE5 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE6")) DOORTILE6 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE1")) DOORTILE1 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE2")) DOORTILE2 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE3")) DOORTILE3 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE4")) DOORTILE4 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE7")) DOORTILE7 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE8")) DOORTILE8 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE9")) DOORTILE9 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE10")) DOORTILE10 = lValue; - else if (!Bstrcmp(szLabel,"DOORSHOCK")) DOORSHOCK = lValue; - else if (!Bstrcmp(szLabel,"DIPSWITCH")) DIPSWITCH = lValue; - else if (!Bstrcmp(szLabel,"DIPSWITCH2")) DIPSWITCH2 = lValue; - else if (!Bstrcmp(szLabel,"DIPSWITCH3")) DIPSWITCH3 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE22")) DOORTILE22 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE18")) DOORTILE18 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE19")) DOORTILE19 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE20")) DOORTILE20 = lValue; - else if (!Bstrcmp(szLabel,"DOMELITE")) DOMELITE = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE14")) DOORTILE14 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE16")) DOORTILE16 = lValue; - else if (!Bstrcmp(szLabel,"DONUTS")) DONUTS = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE15")) DOORTILE15 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE21")) DOORTILE21 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE17")) DOORTILE17 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE11")) DOORTILE11 = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE12")) DOORTILE12 = lValue; - else if (!Bstrcmp(szLabel,"DUKELYINGDEAD")) DUKELYINGDEAD = lValue; - else if (!Bstrcmp(szLabel,"DUKETORSO")) DUKETORSO = lValue; - else if (!Bstrcmp(szLabel,"DUKEGUN")) DUKEGUN = lValue; - else if (!Bstrcmp(szLabel,"DUKELEG")) DUKELEG = lValue; - else if (!Bstrcmp(szLabel,"DEVISTATORBLAST")) DEVISTATORBLAST = lValue; - else if (!Bstrcmp(szLabel,"DRONE")) DRONE = lValue; - else if (!Bstrcmp(szLabel,"DUKEICON")) DUKEICON = lValue; - else if (!Bstrcmp(szLabel,"DIGITALNUM")) DIGITALNUM = lValue; - else if (!Bstrcmp(szLabel,"DUKECAR")) DUKECAR = lValue; - else if (!Bstrcmp(szLabel,"DREALMS")) DREALMS = lValue; - else if (!Bstrcmp(szLabel,"DUKENUKEM")) DUKENUKEM = lValue; - else if (!Bstrcmp(szLabel,"DEVISTATOR")) DEVISTATOR = lValue; - else if (!Bstrcmp(szLabel,"DUKECUTOUT")) DUKECUTOUT = lValue; - else if (!Bstrcmp(szLabel,"DUCK")) DUCK = lValue; - else if (!Bstrcmp(szLabel,"DESKLAMP")) DESKLAMP = lValue; - else if (!Bstrcmp(szLabel,"DOORTILE23")) DOORTILE23 = lValue; - else if (!Bstrcmp(szLabel,"DONUTS2")) DONUTS2 = lValue; - else if (!Bstrcmp(szLabel,"DESKPHONE")) DESKPHONE = lValue; - else if (!Bstrcmp(szLabel,"DUKEBURGER")) DUKEBURGER = lValue; - else if (!Bstrcmp(szLabel,"DOLPHIN1")) DOLPHIN1 = lValue; - else if (!Bstrcmp(szLabel,"DOLPHIN2")) DOLPHIN2 = lValue; - else if (!Bstrcmp(szLabel,"DUKETAG")) DUKETAG = lValue; - break; - case 'E': - if (!Bstrcmp(szLabel,"EPISODE")) EPISODE = lValue; - else if (!Bstrcmp(szLabel,"EGG")) EGG = lValue; - else if (!Bstrcmp(szLabel,"EXPLODINGBARREL")) EXPLODINGBARREL = lValue; - else if (!Bstrcmp(szLabel,"EXPLODINGBARREL2")) EXPLODINGBARREL2 = lValue; - else if (!Bstrcmp(szLabel,"EXPLOSION2")) EXPLOSION2 = lValue; - else if (!Bstrcmp(szLabel,"EXPLOSION2BOT")) EXPLOSION2BOT = lValue; - else if (!Bstrcmp(szLabel,"ENDALPHANUM")) ENDALPHANUM = lValue; - break; - case 'F': - if (!Bstrcmp(szLabel,"FOF")) FOF = lValue; - else if (!Bstrcmp(szLabel,"FIRSTGUNSPRITE")) FIRSTGUNSPRITE = lValue; - else if (!Bstrcmp(szLabel,"FREEZESPRITE")) FREEZESPRITE = lValue; - else if (!Bstrcmp(szLabel,"FREEZEAMMO")) FREEZEAMMO = lValue; - else if (!Bstrcmp(szLabel,"FIRSTAID")) FIRSTAID = lValue; - else if (!Bstrcmp(szLabel,"FRANKENSTINESWITCH")) FRANKENSTINESWITCH = lValue; - else if (!Bstrcmp(szLabel,"FLOORSLIME")) FLOORSLIME = lValue; - else if (!Bstrcmp(szLabel,"FANSPRITE")) FANSPRITE = lValue; - else if (!Bstrcmp(szLabel,"FANSPRITEBROKE")) FANSPRITEBROKE = lValue; - else if (!Bstrcmp(szLabel,"FANSHADOW")) FANSHADOW = lValue; - else if (!Bstrcmp(szLabel,"FANSHADOWBROKE")) FANSHADOWBROKE = lValue; - else if (!Bstrcmp(szLabel,"FUELPOD")) FUELPOD = lValue; - else if (!Bstrcmp(szLabel,"FOOTPRINTS")) FOOTPRINTS = lValue; - else if (!Bstrcmp(szLabel,"FEMMAG1")) FEMMAG1 = lValue; - else if (!Bstrcmp(szLabel,"FEMMAG2")) FEMMAG2 = lValue; - else if (!Bstrcmp(szLabel,"FOOTPRINTS2")) FOOTPRINTS2 = lValue; - else if (!Bstrcmp(szLabel,"FOOTPRINTS3")) FOOTPRINTS3 = lValue; - else if (!Bstrcmp(szLabel,"FOOTPRINTS4")) FOOTPRINTS4 = lValue; - else if (!Bstrcmp(szLabel,"FIREEXT")) FIREEXT = lValue; - else if (!Bstrcmp(szLabel,"FEMPIC5")) FEMPIC5 = lValue; - else if (!Bstrcmp(szLabel,"FEMPIC6")) FEMPIC6 = lValue; - else if (!Bstrcmp(szLabel,"FEMPIC7")) FEMPIC7 = lValue; - else if (!Bstrcmp(szLabel,"FLOORPLASMA")) FLOORPLASMA = lValue; - else if (!Bstrcmp(szLabel,"FIREBARREL")) FIREBARREL = lValue; - else if (!Bstrcmp(szLabel,"FEMPIC1")) FEMPIC1 = lValue; - else if (!Bstrcmp(szLabel,"FEMPIC2")) FEMPIC2 = lValue; - else if (!Bstrcmp(szLabel,"FEMPIC3")) FEMPIC3 = lValue; - else if (!Bstrcmp(szLabel,"FEMPIC4")) FEMPIC4 = lValue; - else if (!Bstrcmp(szLabel,"FEM1")) FEM1 = lValue; - else if (!Bstrcmp(szLabel,"FEM2")) FEM2 = lValue; - else if (!Bstrcmp(szLabel,"FEM3")) FEM3 = lValue; - else if (!Bstrcmp(szLabel,"FEM5")) FEM5 = lValue; - else if (!Bstrcmp(szLabel,"FEM4")) FEM4 = lValue; - else if (!Bstrcmp(szLabel,"FEM6")) FEM6 = lValue; - else if (!Bstrcmp(szLabel,"FEM6PAD")) FEM6PAD = lValue; - else if (!Bstrcmp(szLabel,"FEM8")) FEM8 = lValue; - else if (!Bstrcmp(szLabel,"FETUSJIB")) FETUSJIB = lValue; - else if (!Bstrcmp(szLabel,"FETUS")) FETUS = lValue; - else if (!Bstrcmp(szLabel,"FETUSBROKE")) FETUSBROKE = lValue; - else if (!Bstrcmp(szLabel,"FIREVASE")) FIREVASE = lValue; - else if (!Bstrcmp(szLabel,"FEM7")) FEM7 = lValue; - else if (!Bstrcmp(szLabel,"FIRELASER")) FIRELASER = lValue; - else if (!Bstrcmp(szLabel,"FIST")) FIST = lValue; - else if (!Bstrcmp(szLabel,"FREEZEBLAST")) FREEZEBLAST = lValue; - else if (!Bstrcmp(szLabel,"FORCERIPPLE")) FORCERIPPLE = lValue; - else if (!Bstrcmp(szLabel,"FECES")) FECES = lValue; - else if (!Bstrcmp(szLabel,"FIRE")) FIRE = lValue; - else if (!Bstrcmp(szLabel,"FIRE2")) FIRE2 = lValue; - else if (!Bstrcmp(szLabel,"FLOORFLAME")) FLOORFLAME = lValue; - else if (!Bstrcmp(szLabel,"F1HELP")) F1HELP = lValue; - else if (!Bstrcmp(szLabel,"FOODICON")) FOODICON = lValue; - else if (!Bstrcmp(szLabel,"FIRSTAID_ICON")) FIRSTAID_ICON = lValue; - else if (!Bstrcmp(szLabel,"FRAGBAR")) FRAGBAR = lValue; - else if (!Bstrcmp(szLabel,"FIRSTGUN")) FIRSTGUN = lValue; - else if (!Bstrcmp(szLabel,"FIRSTGUNRELOAD")) FIRSTGUNRELOAD = lValue; - else if (!Bstrcmp(szLabel,"FALLINGCLIP")) FALLINGCLIP = lValue; - else if (!Bstrcmp(szLabel,"FREEZE")) FREEZE = lValue; - else if (!Bstrcmp(szLabel,"FORCESPHERE")) FORCESPHERE = lValue; - else if (!Bstrcmp(szLabel,"FEM9")) FEM9 = lValue; - else if (!Bstrcmp(szLabel,"FOOTPRINT")) FOOTPRINT = lValue; - else if (!Bstrcmp(szLabel,"FRAMEEFFECT1")) FRAMEEFFECT1 = lValue; - else if (!Bstrcmp(szLabel,"FRAMEEFFECT1_13")) FRAMEEFFECT1_13 = lValue; - else if (!Bstrcmp(szLabel,"FLOORBASKET")) FLOORBASKET = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT1")) FOODOBJECT1 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT2")) FOODOBJECT2 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT3")) FOODOBJECT3 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT4")) FOODOBJECT4 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT5")) FOODOBJECT5 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT6")) FOODOBJECT6 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT7")) FOODOBJECT7 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT8")) FOODOBJECT8 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT9")) FOODOBJECT9 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT10")) FOODOBJECT10 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT11")) FOODOBJECT11 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT12")) FOODOBJECT12 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT13")) FOODOBJECT13 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT14")) FOODOBJECT14 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT15")) FOODOBJECT15 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT16")) FOODOBJECT16 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT17")) FOODOBJECT17 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT18")) FOODOBJECT18 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT19")) FOODOBJECT19 = lValue; - else if (!Bstrcmp(szLabel,"FOODOBJECT20")) FOODOBJECT20 = lValue; - else if (!Bstrcmp(szLabel,"FEATHEREDCHICKEN")) FEATHEREDCHICKEN = lValue; - else if (!Bstrcmp(szLabel,"FEM10")) FEM10 = lValue; - break; - case 'G': - if (!Bstrcmp(szLabel,"GPSPEED")) GPSPEED = lValue; - else if (!Bstrcmp(szLabel,"GROWSPRITEICON")) GROWSPRITEICON = lValue; - else if (!Bstrcmp(szLabel,"GROWAMMO")) GROWAMMO = lValue; - else if (!Bstrcmp(szLabel,"GLASS")) GLASS = lValue; - else if (!Bstrcmp(szLabel,"GLASS2")) GLASS2 = lValue; - else if (!Bstrcmp(szLabel,"GRATE1")) GRATE1 = lValue; - else if (!Bstrcmp(szLabel,"GENERICPOLE")) GENERICPOLE = lValue; - else if (!Bstrcmp(szLabel,"GLASSPIECES")) GLASSPIECES = lValue; - else if (!Bstrcmp(szLabel,"GREENSLIME")) GREENSLIME = lValue; - else if (!Bstrcmp(szLabel,"GROWSPARK")) GROWSPARK = lValue; - else if (!Bstrcmp(szLabel,"GETICON")) GETICON = lValue; - else if (!Bstrcmp(szLabel,"GLAIR")) GLAIR = lValue; - else if (!Bstrcmp(szLabel,"GLASS3")) GLASS3 = lValue; - else if (!Bstrcmp(szLabel,"GUNPOWDERBARREL")) GUNPOWDERBARREL = lValue; - else if (!Bstrcmp(szLabel,"GAVALS")) GAVALS = lValue; - else if (!Bstrcmp(szLabel,"GAVALS2")) GAVALS2 = lValue; - else if (!Bstrcmp(szLabel,"GUMBALLMACHINE")) GUMBALLMACHINE = lValue; - else if (!Bstrcmp(szLabel,"GUMBALLMACHINEBROKE")) GUMBALLMACHINEBROKE = lValue; - else if (!Bstrcmp(szLabel,"GENERICPOLE2")) GENERICPOLE2 = lValue; - break; - case 'H': - if (!Bstrcmp(szLabel,"HEAVYHBOMB")) HEAVYHBOMB = lValue; - else if (!Bstrcmp(szLabel,"HEALTHBOX")) HEALTHBOX = lValue; - else if (!Bstrcmp(szLabel,"HBOMBAMMO")) HBOMBAMMO = lValue; - else if (!Bstrcmp(szLabel,"HEATSENSOR")) HEATSENSOR = lValue; - else if (!Bstrcmp(szLabel,"HURTRAIL")) HURTRAIL = lValue; - else if (!Bstrcmp(szLabel,"HYDROPLANT")) HYDROPLANT = lValue; - else if (!Bstrcmp(szLabel,"HANGLIGHT")) HANGLIGHT = lValue; - else if (!Bstrcmp(szLabel,"HYDRENT")) HYDRENT = lValue; - else if (!Bstrcmp(szLabel,"HANGOOZ")) HANGOOZ = lValue; - else if (!Bstrcmp(szLabel,"HORSEONSIDE")) HORSEONSIDE = lValue; - else if (!Bstrcmp(szLabel,"HORSELITE")) HORSELITE = lValue; - else if (!Bstrcmp(szLabel,"HANDSWITCH")) HANDSWITCH = lValue; - else if (!Bstrcmp(szLabel,"HANDPRINTSWITCH")) HANDPRINTSWITCH = lValue; - else if (!Bstrcmp(szLabel,"HELECOPT")) HELECOPT = lValue; - else if (!Bstrcmp(szLabel,"HOLODUKE")) HOLODUKE = lValue; - else if (!Bstrcmp(szLabel,"HEADJIB1")) HEADJIB1 = lValue; - else if (!Bstrcmp(szLabel,"HEADERBAR")) HEADERBAR = lValue; - else if (!Bstrcmp(szLabel,"HEAT_ICON")) HEAT_ICON = lValue; - else if (!Bstrcmp(szLabel,"HOLODUKE_ICON")) HOLODUKE_ICON = lValue; - else if (!Bstrcmp(szLabel,"HAND")) HAND = lValue; - else if (!Bstrcmp(szLabel,"HANDHOLDINGLASER")) HANDHOLDINGLASER = lValue; - else if (!Bstrcmp(szLabel,"HANDHOLDINGACCESS")) HANDHOLDINGACCESS = lValue; - else if (!Bstrcmp(szLabel,"HANDREMOTE")) HANDREMOTE = lValue; - else if (!Bstrcmp(szLabel,"HANDTHROW")) HANDTHROW = lValue; - else if (!Bstrcmp(szLabel,"HATRACK")) HATRACK = lValue; - else if (!Bstrcmp(szLabel,"HOTMEAT")) HOTMEAT = lValue; - else if (!Bstrcmp(szLabel,"HEADLAMP")) HEADLAMP = lValue; - break; - case 'I': - if (!Bstrcmp(szLabel,"INVENTORYBOX")) INVENTORYBOX = lValue; - else if (!Bstrcmp(szLabel,"IVUNIT")) IVUNIT = lValue; - else if (!Bstrcmp(szLabel,"INDY")) INDY = lValue; - else if (!Bstrcmp(szLabel,"INNERJAW")) INNERJAW = lValue; - else if (!Bstrcmp(szLabel,"INGAMEDUKETHREEDEE")) INGAMEDUKETHREEDEE = lValue; - break; - case 'J': - if (!Bstrcmp(szLabel,"JETPACK")) JETPACK = lValue; - else if (!Bstrcmp(szLabel,"JAILBARBREAK")) JAILBARBREAK = lValue; - else if (!Bstrcmp(szLabel,"JIBS1")) JIBS1 = lValue; - else if (!Bstrcmp(szLabel,"JIBS2")) JIBS2 = lValue; - else if (!Bstrcmp(szLabel,"JIBS3")) JIBS3 = lValue; - else if (!Bstrcmp(szLabel,"JIBS4")) JIBS4 = lValue; - else if (!Bstrcmp(szLabel,"JIBS5")) JIBS5 = lValue; - else if (!Bstrcmp(szLabel,"JIBS6")) JIBS6 = lValue; - else if (!Bstrcmp(szLabel,"JETPACK_ICON")) JETPACK_ICON = lValue; - else if (!Bstrcmp(szLabel,"JOLLYMEAL")) JOLLYMEAL = lValue; - else if (!Bstrcmp(szLabel,"JURYGUY")) JURYGUY = lValue; - break; - case 'K': - if (!Bstrcmp(szLabel,"KILLSICON")) KILLSICON = lValue; - else if (!Bstrcmp(szLabel,"KNEE")) KNEE = lValue; - break; - case 'L': - if (!Bstrcmp(szLabel,"LOCATORS")) LOCATORS = lValue; - else if (!Bstrcmp(szLabel,"LA")) LA = lValue; - else if (!Bstrcmp(szLabel,"LIGHTSWITCH")) LIGHTSWITCH = lValue; - else if (!Bstrcmp(szLabel,"LIGHTSWITCH2")) LIGHTSWITCH2 = lValue; - else if (!Bstrcmp(szLabel,"LOCKSWITCH1")) LOCKSWITCH1 = lValue; - else if (!Bstrcmp(szLabel,"LUKE")) LUKE = lValue; - else if (!Bstrcmp(szLabel,"LOOGIE")) LOOGIE = lValue; - else if (!Bstrcmp(szLabel,"LIZTROOP")) LIZTROOP = lValue; - else if (!Bstrcmp(szLabel,"LIZTROOPRUNNING")) LIZTROOPRUNNING = lValue; - else if (!Bstrcmp(szLabel,"LIZTROOPSTAYPUT")) LIZTROOPSTAYPUT = lValue; - else if (!Bstrcmp(szLabel,"LIZTOP")) LIZTOP = lValue; - else if (!Bstrcmp(szLabel,"LIZTROOPSHOOT")) LIZTROOPSHOOT = lValue; - else if (!Bstrcmp(szLabel,"LIZTROOPJETPACK")) LIZTROOPJETPACK = lValue; - else if (!Bstrcmp(szLabel,"LIZTROOPDSPRITE")) LIZTROOPDSPRITE = lValue; - else if (!Bstrcmp(szLabel,"LIZTROOPONTOILET")) LIZTROOPONTOILET = lValue; - else if (!Bstrcmp(szLabel,"LIZTROOPJUSTSIT")) LIZTROOPJUSTSIT = lValue; - else if (!Bstrcmp(szLabel,"LIZTROOPDUCKING")) LIZTROOPDUCKING = lValue; - else if (!Bstrcmp(szLabel,"LEGJIB1")) LEGJIB1 = lValue; - else if (!Bstrcmp(szLabel,"LIZMAN")) LIZMAN = lValue; - else if (!Bstrcmp(szLabel,"LIZMANSTAYPUT")) LIZMANSTAYPUT = lValue; - else if (!Bstrcmp(szLabel,"LIZMANSPITTING")) LIZMANSPITTING = lValue; - else if (!Bstrcmp(szLabel,"LIZMANFEEDING")) LIZMANFEEDING = lValue; - else if (!Bstrcmp(szLabel,"LIZMANJUMP")) LIZMANJUMP = lValue; - else if (!Bstrcmp(szLabel,"LIZMANDEADSPRITE")) LIZMANDEADSPRITE = lValue; - else if (!Bstrcmp(szLabel,"LIZMANHEAD1")) LIZMANHEAD1 = lValue; - else if (!Bstrcmp(szLabel,"LIZMANARM1")) LIZMANARM1 = lValue; - else if (!Bstrcmp(szLabel,"LIZMANLEG1")) LIZMANLEG1 = lValue; - else if (!Bstrcmp(szLabel,"LOGO")) LOGO = lValue; - else if (!Bstrcmp(szLabel,"LASERLINE")) LASERLINE = lValue; - else if (!Bstrcmp(szLabel,"LASERSITE")) LASERSITE = lValue; - else if (!Bstrcmp(szLabel,"LOADSCREEN")) LOADSCREEN = lValue; - else if (!Bstrcmp(szLabel,"LAVABUBBLE")) LAVABUBBLE = lValue; - else if (!Bstrcmp(szLabel,"LETTER")) LETTER = lValue; - break; - case 'M': - if (!Bstrcmp(szLabel,"MUSICANDSFX")) MUSICANDSFX = lValue; - else if (!Bstrcmp(szLabel,"MASTERSWITCH")) MASTERSWITCH = lValue; - else if (!Bstrcmp(szLabel,"MIRRORBROKE")) MIRRORBROKE = lValue; - else if (!Bstrcmp(szLabel,"MOONSKY1")) MOONSKY1 = lValue; - else if (!Bstrcmp(szLabel,"MOONSKY2")) MOONSKY2 = lValue; - else if (!Bstrcmp(szLabel,"MOONSKY3")) MOONSKY3 = lValue; - else if (!Bstrcmp(szLabel,"MOONSKY4")) MOONSKY4 = lValue; - else if (!Bstrcmp(szLabel,"MULTISWITCH")) MULTISWITCH = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL9")) MASKWALL9 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL1")) MASKWALL1 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL10")) MASKWALL10 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL11")) MASKWALL11 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL5")) MASKWALL5 = lValue; - else if (!Bstrcmp(szLabel,"MIRROR")) MIRROR = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL12")) MASKWALL12 = lValue; - else if (!Bstrcmp(szLabel,"MOVIECAMERA")) MOVIECAMERA = lValue; - else if (!Bstrcmp(szLabel,"MIKE")) MIKE = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL13")) MASKWALL13 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL2")) MASKWALL2 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL3")) MASKWALL3 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL4")) MASKWALL4 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL14")) MASKWALL14 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL15")) MASKWALL15 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL6")) MASKWALL6 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL8")) MASKWALL8 = lValue; - else if (!Bstrcmp(szLabel,"MASKWALL7")) MASKWALL7 = lValue; - else if (!Bstrcmp(szLabel,"MONEY")) MONEY = lValue; - else if (!Bstrcmp(szLabel,"MONK")) MONK = lValue; - else if (!Bstrcmp(szLabel,"MORTER")) MORTER = lValue; - else if (!Bstrcmp(szLabel,"MENUSCREEN")) MENUSCREEN = lValue; - else if (!Bstrcmp(szLabel,"MENUBAR")) MENUBAR = lValue; - else if (!Bstrcmp(szLabel,"MOUSECURSOR")) MOUSECURSOR = lValue; - else if (!Bstrcmp(szLabel,"MINIFONT")) MINIFONT = lValue; - else if (!Bstrcmp(szLabel,"MAIL")) MAIL = lValue; - else if (!Bstrcmp(szLabel,"MAILBAG")) MAILBAG = lValue; - else if (!Bstrcmp(szLabel,"METER")) METER = lValue; - else if (!Bstrcmp(szLabel,"MACE")) MACE = lValue; - else if (!Bstrcmp(szLabel,"MOP")) MOP = lValue; - else if (!Bstrcmp(szLabel,"MAN")) MAN = lValue; - else if (!Bstrcmp(szLabel,"MAN2")) MAN2 = lValue; - break; - case 'N': - if (!Bstrcmp(szLabel,"NUKEBUTTON")) NUKEBUTTON = lValue; - else if (!Bstrcmp(szLabel,"NAKED1")) NAKED1 = lValue; - else if (!Bstrcmp(szLabel,"NEON1")) NEON1 = lValue; - else if (!Bstrcmp(szLabel,"NEON2")) NEON2 = lValue; - else if (!Bstrcmp(szLabel,"NEON3")) NEON3 = lValue; - else if (!Bstrcmp(szLabel,"NEON4")) NEON4 = lValue; - else if (!Bstrcmp(szLabel,"NEON5")) NEON5 = lValue; - else if (!Bstrcmp(szLabel,"NEON6")) NEON6 = lValue; - else if (!Bstrcmp(szLabel,"NUKEBARREL")) NUKEBARREL = lValue; - else if (!Bstrcmp(szLabel,"NUKEBARRELDENTED")) NUKEBARRELDENTED = lValue; - else if (!Bstrcmp(szLabel,"NUKEBARRELLEAKED")) NUKEBARRELLEAKED = lValue; - else if (!Bstrcmp(szLabel,"NOTCHON")) NOTCHON = lValue; - else if (!Bstrcmp(szLabel,"NOTCHOFF")) NOTCHOFF = lValue; - else if (!Bstrcmp(szLabel,"NUKEWARNINGICON")) NUKEWARNINGICON = lValue; - else if (!Bstrcmp(szLabel,"NEWBEAST")) NEWBEAST = lValue; - else if (!Bstrcmp(szLabel,"NEWBEASTSTAYPUT")) NEWBEASTSTAYPUT = lValue; - else if (!Bstrcmp(szLabel,"NEWBEASTJUMP")) NEWBEASTJUMP = lValue; - else if (!Bstrcmp(szLabel,"NEWBEASTHANG")) NEWBEASTHANG = lValue; - else if (!Bstrcmp(szLabel,"NEWBEASTHANGDEAD")) NEWBEASTHANGDEAD = lValue; - else if (!Bstrcmp(szLabel,"NATURALLIGHTNING")) NATURALLIGHTNING = lValue; - break; - case 'O': - if (!Bstrcmp(szLabel,"OJ")) OJ = lValue; - else if (!Bstrcmp(szLabel,"OCEANSPRITE1")) OCEANSPRITE1 = lValue; - else if (!Bstrcmp(szLabel,"OCEANSPRITE2")) OCEANSPRITE2 = lValue; - else if (!Bstrcmp(szLabel,"OCEANSPRITE3")) OCEANSPRITE3 = lValue; - else if (!Bstrcmp(szLabel,"OCEANSPRITE4")) OCEANSPRITE4 = lValue; - else if (!Bstrcmp(szLabel,"OCEANSPRITE5")) OCEANSPRITE5 = lValue; - else if (!Bstrcmp(szLabel,"OOZFILTER")) OOZFILTER = lValue; - else if (!Bstrcmp(szLabel,"OCTABRAIN")) OCTABRAIN = lValue; - else if (!Bstrcmp(szLabel,"OCTABRAINSTAYPUT")) OCTABRAINSTAYPUT = lValue; - else if (!Bstrcmp(szLabel,"OCTATOP")) OCTATOP = lValue; - else if (!Bstrcmp(szLabel,"OCTADEADSPRITE")) OCTADEADSPRITE = lValue; - else if (!Bstrcmp(szLabel,"OOZ")) OOZ = lValue; - else if (!Bstrcmp(szLabel,"OOZ2")) OOZ2 = lValue; - else if (!Bstrcmp(szLabel,"ORGANTIC")) ORGANTIC = lValue; - else if (!Bstrcmp(szLabel,"ORDERING")) ORDERING = lValue; - break; - case 'P': - if (!Bstrcmp(szLabel,"PANNEL1")) PANNEL1 = lValue; - else if (!Bstrcmp(szLabel,"PANNEL2")) PANNEL2 = lValue; - else if (!Bstrcmp(szLabel,"PIPE2")) PIPE2 = lValue; - else if (!Bstrcmp(szLabel,"PIPE1B")) PIPE1B = lValue; - else if (!Bstrcmp(szLabel,"PIPE3")) PIPE3 = lValue; - else if (!Bstrcmp(szLabel,"PIPE1")) PIPE1 = lValue; - else if (!Bstrcmp(szLabel,"PIPE2B")) PIPE2B = lValue; - else if (!Bstrcmp(szLabel,"POT1")) POT1 = lValue; - else if (!Bstrcmp(szLabel,"POT2")) POT2 = lValue; - else if (!Bstrcmp(szLabel,"POT3")) POT3 = lValue; - else if (!Bstrcmp(szLabel,"PIPE3B")) PIPE3B = lValue; - else if (!Bstrcmp(szLabel,"POWERSWITCH1")) POWERSWITCH1 = lValue; - else if (!Bstrcmp(szLabel,"POWERSWITCH2")) POWERSWITCH2 = lValue; - else if (!Bstrcmp(szLabel,"POCKET")) POCKET = lValue; - else if (!Bstrcmp(szLabel,"PIPE5")) PIPE5 = lValue; - else if (!Bstrcmp(szLabel,"PIPE6")) PIPE6 = lValue; - else if (!Bstrcmp(szLabel,"PIPE4")) PIPE4 = lValue; - else if (!Bstrcmp(szLabel,"PIPE4B")) PIPE4B = lValue; - else if (!Bstrcmp(szLabel,"PIPE5B")) PIPE5B = lValue; - else if (!Bstrcmp(szLabel,"PLUG")) PLUG = lValue; - else if (!Bstrcmp(szLabel,"PULLSWITCH")) PULLSWITCH = lValue; - else if (!Bstrcmp(szLabel,"PIPE6B")) PIPE6B = lValue; - else if (!Bstrcmp(szLabel,"PODFEM1")) PODFEM1 = lValue; - else if (!Bstrcmp(szLabel,"PLAYERONWATER")) PLAYERONWATER = lValue; - else if (!Bstrcmp(szLabel,"PIGCOP")) PIGCOP = lValue; - else if (!Bstrcmp(szLabel,"PIGCOPSTAYPUT")) PIGCOPSTAYPUT = lValue; - else if (!Bstrcmp(szLabel,"PIGCOPDIVE")) PIGCOPDIVE = lValue; - else if (!Bstrcmp(szLabel,"PIGCOPDEADSPRITE")) PIGCOPDEADSPRITE = lValue; - else if (!Bstrcmp(szLabel,"PIGTOP")) PIGTOP = lValue; - else if (!Bstrcmp(szLabel,"PLAYERISHERE")) PLAYERISHERE = lValue; - else if (!Bstrcmp(szLabel,"PLAYERWASHERE")) PLAYERWASHERE = lValue; - else if (!Bstrcmp(szLabel,"PLUTOPAKSPRITE")) PLUTOPAKSPRITE = lValue; - else if (!Bstrcmp(szLabel,"POOP")) POOP = lValue; - else if (!Bstrcmp(szLabel,"PANNEL3")) PANNEL3 = lValue; - else if (!Bstrcmp(szLabel,"PURPLELAVA")) PURPLELAVA = lValue; - else if (!Bstrcmp(szLabel,"POLICELIGHTPOLE")) POLICELIGHTPOLE = lValue; - else if (!Bstrcmp(szLabel,"PUKE")) PUKE = lValue; - else if (!Bstrcmp(szLabel,"PAPER")) PAPER = lValue; - else if (!Bstrcmp(szLabel,"PIRATE1A")) PIRATE1A = lValue; - else if (!Bstrcmp(szLabel,"PIRATE4A")) PIRATE4A = lValue; - else if (!Bstrcmp(szLabel,"PIRATE2A")) PIRATE2A = lValue; - else if (!Bstrcmp(szLabel,"PIRATE5A")) PIRATE5A = lValue; - else if (!Bstrcmp(szLabel,"PIRATE3A")) PIRATE3A = lValue; - else if (!Bstrcmp(szLabel,"PIRATE6A")) PIRATE6A = lValue; - else if (!Bstrcmp(szLabel,"PIRATEHALF")) PIRATEHALF = lValue; - else if (!Bstrcmp(szLabel,"PLEASEWAIT")) PLEASEWAIT = lValue; - break; - case 'Q': - if (!Bstrcmp(szLabel,"QUEBALL")) QUEBALL = lValue; - break; - case 'R': - if (!Bstrcmp(szLabel,"RESPAWN")) RESPAWN = lValue; - else if (!Bstrcmp(szLabel,"RPGSPRITE")) RPGSPRITE = lValue; - else if (!Bstrcmp(szLabel,"RPGAMMO")) RPGAMMO = lValue; - else if (!Bstrcmp(szLabel,"REDSKY1")) REDSKY1 = lValue; - else if (!Bstrcmp(szLabel,"REDSKY2")) REDSKY2 = lValue; - else if (!Bstrcmp(szLabel,"REFLECTWATERTILE")) REFLECTWATERTILE = lValue; - else if (!Bstrcmp(szLabel,"REACTOR2")) REACTOR2 = lValue; - else if (!Bstrcmp(szLabel,"REACTOR2BURNT")) REACTOR2BURNT = lValue; - else if (!Bstrcmp(szLabel,"REACTOR2SPARK")) REACTOR2SPARK = lValue; - else if (!Bstrcmp(szLabel,"RUBBERCAN")) RUBBERCAN = lValue; - else if (!Bstrcmp(szLabel,"REACTOR")) REACTOR = lValue; - else if (!Bstrcmp(szLabel,"REACTORSPARK")) REACTORSPARK = lValue; - else if (!Bstrcmp(szLabel,"REACTORBURNT")) REACTORBURNT = lValue; - else if (!Bstrcmp(szLabel,"RAT")) RAT = lValue; - else if (!Bstrcmp(szLabel,"RADIUSEXPLOSION")) RADIUSEXPLOSION = lValue; - else if (!Bstrcmp(szLabel,"RECON")) RECON = lValue; - else if (!Bstrcmp(szLabel,"ROTATEGUN")) ROTATEGUN = lValue; - else if (!Bstrcmp(szLabel,"RPGGUN")) RPGGUN = lValue; - else if (!Bstrcmp(szLabel,"RPGMUZZLEFLASH")) RPGMUZZLEFLASH = lValue; - else if (!Bstrcmp(szLabel,"RPG")) RPG = lValue; - else if (!Bstrcmp(szLabel,"RESPAWNMARKERRED")) RESPAWNMARKERRED = lValue; - else if (!Bstrcmp(szLabel,"RESPAWNMARKERYELLOW")) RESPAWNMARKERYELLOW = lValue; - else if (!Bstrcmp(szLabel,"RESPAWNMARKERGREEN")) RESPAWNMARKERGREEN = lValue; - else if (!Bstrcmp(szLabel,"ROBOTDOG")) ROBOTDOG = lValue; - else if (!Bstrcmp(szLabel,"ROBOTPIRATE")) ROBOTPIRATE = lValue; - else if (!Bstrcmp(szLabel,"ROBOTMOUSE")) ROBOTMOUSE = lValue; - else if (!Bstrcmp(szLabel,"ROBOTDOG2")) ROBOTDOG2 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT1")) RESERVEDSLOT1 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT2")) RESERVEDSLOT2 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT3")) RESERVEDSLOT3 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT4")) RESERVEDSLOT4 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT5")) RESERVEDSLOT5 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT6")) RESERVEDSLOT6 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT7")) RESERVEDSLOT7 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT8")) RESERVEDSLOT8 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT9")) RESERVEDSLOT9 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT10")) RESERVEDSLOT10 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT11")) RESERVEDSLOT11 = lValue; - else if (!Bstrcmp(szLabel,"RESERVEDSLOT12")) RESERVEDSLOT12 = lValue; - break; - case 'S': - if (!Bstrcmp(szLabel,"SECTOREFFECTOR")) SECTOREFFECTOR = lValue; - else if (!Bstrcmp(szLabel,"SHRINKERSPRITE")) SHRINKERSPRITE = lValue; - else if (!Bstrcmp(szLabel,"SHOTGUNSPRITE")) SHOTGUNSPRITE = lValue; - else if (!Bstrcmp(szLabel,"SHOTGUNAMMO")) SHOTGUNAMMO = lValue; - else if (!Bstrcmp(szLabel,"SIXPAK")) SIXPAK = lValue; - else if (!Bstrcmp(szLabel,"SHIELD")) SHIELD = lValue; - else if (!Bstrcmp(szLabel,"STEROIDS")) STEROIDS = lValue; - else if (!Bstrcmp(szLabel,"SLOTDOOR")) SLOTDOOR = lValue; - else if (!Bstrcmp(szLabel,"SPACEDOORSWITCH")) SPACEDOORSWITCH = lValue; - else if (!Bstrcmp(szLabel,"SPACELIGHTSWITCH")) SPACELIGHTSWITCH = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK1")) SCREENBREAK1 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK2")) SCREENBREAK2 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK3")) SCREENBREAK3 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK4")) SCREENBREAK4 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK5")) SCREENBREAK5 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK6")) SCREENBREAK6 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK7")) SCREENBREAK7 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK8")) SCREENBREAK8 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK9")) SCREENBREAK9 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK10")) SCREENBREAK10 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK11")) SCREENBREAK11 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK12")) SCREENBREAK12 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK13")) SCREENBREAK13 = lValue; - else if (!Bstrcmp(szLabel,"STATIC")) STATIC = lValue; - else if (!Bstrcmp(szLabel,"SATELLITE")) SATELLITE = lValue; - else if (!Bstrcmp(szLabel,"STAINGLASS1")) STAINGLASS1 = lValue; - else if (!Bstrcmp(szLabel,"SATELITE")) SATELITE = lValue; - else if (!Bstrcmp(szLabel,"SLIMEPIPE")) SLIMEPIPE = lValue; - else if (!Bstrcmp(szLabel,"STALL")) STALL = lValue; - else if (!Bstrcmp(szLabel,"STALLBROKE")) STALLBROKE = lValue; - else if (!Bstrcmp(szLabel,"SOLARPANNEL")) SOLARPANNEL = lValue; - else if (!Bstrcmp(szLabel,"SPLINTERWOOD")) SPLINTERWOOD = lValue; - else if (!Bstrcmp(szLabel,"SCALE")) SCALE = lValue; - else if (!Bstrcmp(szLabel,"STATUE")) STATUE = lValue; - else if (!Bstrcmp(szLabel,"SUSHIPLATE1")) SUSHIPLATE1 = lValue; - else if (!Bstrcmp(szLabel,"SUSHIPLATE2")) SUSHIPLATE2 = lValue; - else if (!Bstrcmp(szLabel,"SUSHIPLATE3")) SUSHIPLATE3 = lValue; - else if (!Bstrcmp(szLabel,"SUSHIPLATE4")) SUSHIPLATE4 = lValue; - else if (!Bstrcmp(szLabel,"SUSHIPLATE5")) SUSHIPLATE5 = lValue; - else if (!Bstrcmp(szLabel,"STATUEFLASH")) STATUEFLASH = lValue; - else if (!Bstrcmp(szLabel,"STRIPEBALL")) STRIPEBALL = lValue; - else if (!Bstrcmp(szLabel,"SPOTLITE")) SPOTLITE = lValue; - else if (!Bstrcmp(szLabel,"SEENINE")) SEENINE = lValue; - else if (!Bstrcmp(szLabel,"SEENINEDEAD")) SEENINEDEAD = lValue; - else if (!Bstrcmp(szLabel,"STEAM")) STEAM = lValue; - else if (!Bstrcmp(szLabel,"SPACEMARINE")) SPACEMARINE = lValue; - else if (!Bstrcmp(szLabel,"SCRATCH")) SCRATCH = lValue; - else if (!Bstrcmp(szLabel,"SHARK")) SHARK = lValue; - else if (!Bstrcmp(szLabel,"SPIT")) SPIT = lValue; - else if (!Bstrcmp(szLabel,"SHRINKSPARK")) SHRINKSPARK = lValue; - else if (!Bstrcmp(szLabel,"SHRINKEREXPLOSION")) SHRINKEREXPLOSION = lValue; - else if (!Bstrcmp(szLabel,"SMALLSMOKE")) SMALLSMOKE = lValue; - else if (!Bstrcmp(szLabel,"SMALLSMOKEMAKER")) SMALLSMOKEMAKER = lValue; - else if (!Bstrcmp(szLabel,"SCRAP6")) SCRAP6 = lValue; - else if (!Bstrcmp(szLabel,"SCRAP1")) SCRAP1 = lValue; - else if (!Bstrcmp(szLabel,"SCRAP2")) SCRAP2 = lValue; - else if (!Bstrcmp(szLabel,"SCRAP3")) SCRAP3 = lValue; - else if (!Bstrcmp(szLabel,"SCRAP4")) SCRAP4 = lValue; - else if (!Bstrcmp(szLabel,"SCRAP5")) SCRAP5 = lValue; - else if (!Bstrcmp(szLabel,"SELECTDIR")) SELECTDIR = lValue; - else if (!Bstrcmp(szLabel,"STEROIDS_ICON")) STEROIDS_ICON = lValue; - else if (!Bstrcmp(szLabel,"SLIDEBAR")) SLIDEBAR = lValue; - else if (!Bstrcmp(szLabel,"SHELL")) SHELL = lValue; - else if (!Bstrcmp(szLabel,"SHOTGUNSHELL")) SHOTGUNSHELL = lValue; - else if (!Bstrcmp(szLabel,"SHRINKER")) SHRINKER = lValue; - else if (!Bstrcmp(szLabel,"SCUBAMASK")) SCUBAMASK = lValue; - else if (!Bstrcmp(szLabel,"SPACEMASK")) SPACEMASK = lValue; - else if (!Bstrcmp(szLabel,"SHOTSPARK1")) SHOTSPARK1 = lValue; - else if (!Bstrcmp(szLabel,"SHOTGUN")) SHOTGUN = lValue; - else if (!Bstrcmp(szLabel,"SPINNINGNUKEICON")) SPINNINGNUKEICON = lValue; - else if (!Bstrcmp(szLabel,"SMALLFNTCURSOR")) SMALLFNTCURSOR = lValue; - else if (!Bstrcmp(szLabel,"STARTALPHANUM")) STARTALPHANUM = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK14")) SCREENBREAK14 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK15")) SCREENBREAK15 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK19")) SCREENBREAK19 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK16")) SCREENBREAK16 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK17")) SCREENBREAK17 = lValue; - else if (!Bstrcmp(szLabel,"SCREENBREAK18")) SCREENBREAK18 = lValue; - else if (!Bstrcmp(szLabel,"SPEAKER")) SPEAKER = lValue; - else if (!Bstrcmp(szLabel,"SIDEBOLT1")) SIDEBOLT1 = lValue; - else if (!Bstrcmp(szLabel,"SKINNEDCHICKEN")) SKINNEDCHICKEN = lValue; - else if (!Bstrcmp(szLabel,"SHOPPINGCART")) SHOPPINGCART = lValue; - else if (!Bstrcmp(szLabel,"SNAKEP")) SNAKEP = lValue; - else if (!Bstrcmp(szLabel,"SIGN1")) SIGN1 = lValue; - else if (!Bstrcmp(szLabel,"SIGN2")) SIGN2 = lValue; - break; - case 'T': - if (!Bstrcmp(szLabel,"TOUCHPLATE")) TOUCHPLATE = lValue; - else if (!Bstrcmp(szLabel,"TRIPBOMBSPRITE")) TRIPBOMBSPRITE = lValue; - else if (!Bstrcmp(szLabel,"TECHLIGHT2")) TECHLIGHT2 = lValue; - else if (!Bstrcmp(szLabel,"TECHLIGHTBUST2")) TECHLIGHTBUST2 = lValue; - else if (!Bstrcmp(szLabel,"TECHLIGHT4")) TECHLIGHT4 = lValue; - else if (!Bstrcmp(szLabel,"TECHLIGHTBUST4")) TECHLIGHTBUST4 = lValue; - else if (!Bstrcmp(szLabel,"TECHSWITCH")) TECHSWITCH = lValue; - else if (!Bstrcmp(szLabel,"TOILET")) TOILET = lValue; - else if (!Bstrcmp(szLabel,"TOILETBROKE")) TOILETBROKE = lValue; - else if (!Bstrcmp(szLabel,"TREE1")) TREE1 = lValue; - else if (!Bstrcmp(szLabel,"TREE2")) TREE2 = lValue; - else if (!Bstrcmp(szLabel,"TOILETWATER")) TOILETWATER = lValue; - else if (!Bstrcmp(szLabel,"TIRE")) TIRE = lValue; - else if (!Bstrcmp(szLabel,"TRANSPORTERBEAM")) TRANSPORTERBEAM = lValue; - else if (!Bstrcmp(szLabel,"TRASH")) TRASH = lValue; - else if (!Bstrcmp(szLabel,"TRANSPORTERSTAR")) TRANSPORTERSTAR = lValue; - else if (!Bstrcmp(szLabel,"TONGUE")) TONGUE = lValue; - else if (!Bstrcmp(szLabel,"TANK")) TANK = lValue; - else if (!Bstrcmp(szLabel,"TITLE")) TITLE = lValue; - else if (!Bstrcmp(szLabel,"TEXTBOX")) TEXTBOX = lValue; - else if (!Bstrcmp(szLabel,"THREEDEE")) THREEDEE = lValue; - else if (!Bstrcmp(szLabel,"TENSCREEN")) TENSCREEN = lValue; - else if (!Bstrcmp(szLabel,"TRIPBOMB")) TRIPBOMB = lValue; - else if (!Bstrcmp(szLabel,"TIP")) TIP = lValue; - else if (!Bstrcmp(szLabel,"THREEBYFIVE")) THREEBYFIVE = lValue; - else if (!Bstrcmp(szLabel,"TEXTSTORY")) TEXTSTORY = lValue; - else if (!Bstrcmp(szLabel,"TARGET")) TARGET = lValue; - else if (!Bstrcmp(szLabel,"TOPSECRET")) TOPSECRET = lValue; - else if (!Bstrcmp(szLabel,"TEDDYBEAR")) TEDDYBEAR = lValue; - else if (!Bstrcmp(szLabel,"TRIPODCAMERA")) TRIPODCAMERA = lValue; - else if (!Bstrcmp(szLabel,"TAMPON")) TAMPON = lValue; - else if (!Bstrcmp(szLabel,"TOUGHGAL")) TOUGHGAL = lValue; - break; - case 'U': - if (!Bstrcmp(szLabel,"USERWEAPON")) USERWEAPON = lValue; - break; - case 'V': - if (!Bstrcmp(szLabel,"VIEWSCREEN2")) VIEWSCREEN2 = lValue; - else if (!Bstrcmp(szLabel,"VIEWSCREENBROKE")) VIEWSCREENBROKE = lValue; - else if (!Bstrcmp(szLabel,"VIEWSCREEN")) VIEWSCREEN = lValue; - else if (!Bstrcmp(szLabel,"VACUUM")) VACUUM = lValue; - else if (!Bstrcmp(szLabel,"VASE")) VASE = lValue; - else if (!Bstrcmp(szLabel,"VENDMACHINE")) VENDMACHINE = lValue; - else if (!Bstrcmp(szLabel,"VENDMACHINEBROKE")) VENDMACHINEBROKE = lValue; - else if (!Bstrcmp(szLabel,"VIEWBORDER")) VIEWBORDER = lValue; - else if (!Bstrcmp(szLabel,"VICTORY1")) VICTORY1 = lValue; - break; - case 'W': - if (!Bstrcmp(szLabel,"WALLLIGHT4")) WALLLIGHT4 = lValue; - else if (!Bstrcmp(szLabel,"WALLLIGHTBUST4")) WALLLIGHTBUST4 = lValue; - else if (!Bstrcmp(szLabel,"W_LIGHT")) W_LIGHT = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL1")) W_TECHWALL1 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL2")) W_TECHWALL2 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL15")) W_TECHWALL15 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL3")) W_TECHWALL3 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL4")) W_TECHWALL4 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL10")) W_TECHWALL10 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL16")) W_TECHWALL16 = lValue; - else if (!Bstrcmp(szLabel,"WATERTILE2")) WATERTILE2 = lValue; - else if (!Bstrcmp(szLabel,"WATERTILE")) WATERTILE = lValue; - else if (!Bstrcmp(szLabel,"W_SCREENBREAK")) W_SCREENBREAK = lValue; - else if (!Bstrcmp(szLabel,"W_HITTECHWALL3")) W_HITTECHWALL3 = lValue; - else if (!Bstrcmp(szLabel,"W_HITTECHWALL4")) W_HITTECHWALL4 = lValue; - else if (!Bstrcmp(szLabel,"W_HITTECHWALL2")) W_HITTECHWALL2 = lValue; - else if (!Bstrcmp(szLabel,"W_HITTECHWALL1")) W_HITTECHWALL1 = lValue; - else if (!Bstrcmp(szLabel,"WATERFOUNTAIN")) WATERFOUNTAIN = lValue; - else if (!Bstrcmp(szLabel,"WATERFOUNTAINBROKE")) WATERFOUNTAINBROKE = lValue; - else if (!Bstrcmp(szLabel,"W_NUMBERS")) W_NUMBERS = lValue; - else if (!Bstrcmp(szLabel,"WATERDRIP")) WATERDRIP = lValue; - else if (!Bstrcmp(szLabel,"WATERBUBBLE")) WATERBUBBLE = lValue; - else if (!Bstrcmp(szLabel,"WATERBUBBLEMAKER")) WATERBUBBLEMAKER = lValue; - else if (!Bstrcmp(szLabel,"W_FORCEFIELD")) W_FORCEFIELD = lValue; - else if (!Bstrcmp(szLabel,"WALLLIGHT3")) WALLLIGHT3 = lValue; - else if (!Bstrcmp(szLabel,"WALLLIGHTBUST3")) WALLLIGHTBUST3 = lValue; - else if (!Bstrcmp(szLabel,"WALLLIGHT1")) WALLLIGHT1 = lValue; - else if (!Bstrcmp(szLabel,"WALLLIGHTBUST1")) WALLLIGHTBUST1 = lValue; - else if (!Bstrcmp(szLabel,"WALLLIGHT2")) WALLLIGHT2 = lValue; - else if (!Bstrcmp(szLabel,"WALLLIGHTBUST2")) WALLLIGHTBUST2 = lValue; - else if (!Bstrcmp(szLabel,"WAITTOBESEATED")) WAITTOBESEATED = lValue; - else if (!Bstrcmp(szLabel,"WOODENHORSE")) WOODENHORSE = lValue; - else if (!Bstrcmp(szLabel,"WATERSPLASH2")) WATERSPLASH2 = lValue; - else if (!Bstrcmp(szLabel,"WALLBLOOD1")) WALLBLOOD1 = lValue; - else if (!Bstrcmp(szLabel,"WALLBLOOD2")) WALLBLOOD2 = lValue; - else if (!Bstrcmp(szLabel,"WALLBLOOD3")) WALLBLOOD3 = lValue; - else if (!Bstrcmp(szLabel,"WALLBLOOD4")) WALLBLOOD4 = lValue; - else if (!Bstrcmp(szLabel,"WALLBLOOD5")) WALLBLOOD5 = lValue; - else if (!Bstrcmp(szLabel,"WALLBLOOD6")) WALLBLOOD6 = lValue; - else if (!Bstrcmp(szLabel,"WALLBLOOD7")) WALLBLOOD7 = lValue; - else if (!Bstrcmp(szLabel,"WALLBLOOD8")) WALLBLOOD8 = lValue; - else if (!Bstrcmp(szLabel,"WATERDRIPSPLASH")) WATERDRIPSPLASH = lValue; - else if (!Bstrcmp(szLabel,"WINDOWBORDER1")) WINDOWBORDER1 = lValue; - else if (!Bstrcmp(szLabel,"WINDOWBORDER2")) WINDOWBORDER2 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL11")) W_TECHWALL11 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL12")) W_TECHWALL12 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL13")) W_TECHWALL13 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL14")) W_TECHWALL14 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL5")) W_TECHWALL5 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL6")) W_TECHWALL6 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL7")) W_TECHWALL7 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL8")) W_TECHWALL8 = lValue; - else if (!Bstrcmp(szLabel,"W_TECHWALL9")) W_TECHWALL9 = lValue; - else if (!Bstrcmp(szLabel,"W_HITTECHWALL16")) W_HITTECHWALL16 = lValue; - else if (!Bstrcmp(szLabel,"W_HITTECHWALL10")) W_HITTECHWALL10 = lValue; - else if (!Bstrcmp(szLabel,"W_HITTECHWALL15")) W_HITTECHWALL15 = lValue; - else if (!Bstrcmp(szLabel,"W_MILKSHELF")) W_MILKSHELF = lValue; - else if (!Bstrcmp(szLabel,"W_MILKSHELFBROKE")) W_MILKSHELFBROKE = lValue; - else if (!Bstrcmp(szLabel,"WETFLOOR")) WETFLOOR = lValue; - else if (!Bstrcmp(szLabel,"WOMAN")) WOMAN = lValue; - else if (!Bstrcmp(szLabel,"WEATHERWARN")) WEATHERWARN = lValue; - break; - case 'X': - if (!Bstrcmp(szLabel,"XXXSTACY")) XXXSTACY = lValue; - break; + switch (szLabel[0]) + { + case 'A': + if (!Bstrcmp(szLabel,"ACTIVATOR")) ACTIVATOR = lValue; + else if (!Bstrcmp(szLabel,"ACTIVATORLOCKED")) ACTIVATORLOCKED = lValue; + else if (!Bstrcmp(szLabel,"ARROW")) ARROW = lValue; + else if (!Bstrcmp(szLabel,"AMMOBOX")) AMMOBOX = lValue; + else if (!Bstrcmp(szLabel,"AMMO")) AMMO = lValue; + else if (!Bstrcmp(szLabel,"AMMOLOTS")) AMMOLOTS = lValue; + else if (!Bstrcmp(szLabel,"AIRTANK")) AIRTANK = lValue; + else if (!Bstrcmp(szLabel,"ACCESSCARD")) ACCESSCARD = lValue; + else if (!Bstrcmp(szLabel,"ATOMICHEALTH")) ATOMICHEALTH = lValue; + else if (!Bstrcmp(szLabel,"ACCESSSWITCH")) ACCESSSWITCH = lValue; + else if (!Bstrcmp(szLabel,"ACCESSSWITCH2")) ACCESSSWITCH2 = lValue; + else if (!Bstrcmp(szLabel,"ANTENNA")) ANTENNA = lValue; + else if (!Bstrcmp(szLabel,"ATM")) ATM = lValue; + else if (!Bstrcmp(szLabel,"ATMBROKE")) ATMBROKE = lValue; + else if (!Bstrcmp(szLabel,"ALIENSWITCH")) ALIENSWITCH = lValue; + else if (!Bstrcmp(szLabel,"APLAYERTOP")) APLAYERTOP = lValue; + else if (!Bstrcmp(szLabel,"APLAYER")) APLAYER = lValue; + else if (!Bstrcmp(szLabel,"ARMJIB1")) ARMJIB1 = lValue; + else if (!Bstrcmp(szLabel,"AIRTANK_ICON")) AIRTANK_ICON = lValue; + else if (!Bstrcmp(szLabel,"ACCESS_ICON")) ACCESS_ICON = lValue; + break; + case 'B': + if (!Bstrcmp(szLabel,"BATTERYAMMO")) BATTERYAMMO = lValue; + else if (!Bstrcmp(szLabel,"BOOTS")) BOOTS = lValue; + else if (!Bstrcmp(szLabel,"BIGORBIT1")) BIGORBIT1 = lValue; + else if (!Bstrcmp(szLabel,"BIGORBIT2")) BIGORBIT2 = lValue; + else if (!Bstrcmp(szLabel,"BIGORBIT3")) BIGORBIT3 = lValue; + else if (!Bstrcmp(szLabel,"BIGORBIT4")) BIGORBIT4 = lValue; + else if (!Bstrcmp(szLabel,"BIGORBIT5")) BIGORBIT5 = lValue; + else if (!Bstrcmp(szLabel,"BIGFORCE")) BIGFORCE = lValue; + else if (!Bstrcmp(szLabel,"BPANNEL1")) BPANNEL1 = lValue; + else if (!Bstrcmp(szLabel,"BROKENCHAIR")) BROKENCHAIR = lValue; + else if (!Bstrcmp(szLabel,"BGRATE1")) BGRATE1 = lValue; + else if (!Bstrcmp(szLabel,"BRICK")) BRICK = lValue; + else if (!Bstrcmp(szLabel,"BOLT1")) BOLT1 = lValue; + else if (!Bstrcmp(szLabel,"BIGHOLE2")) BIGHOLE2 = lValue; + else if (!Bstrcmp(szLabel,"BOUNCEMINE")) BOUNCEMINE = lValue; + else if (!Bstrcmp(szLabel,"BROKEFIREHYDRENT")) BROKEFIREHYDRENT = lValue; + else if (!Bstrcmp(szLabel,"BOX")) BOX = lValue; + else if (!Bstrcmp(szLabel,"BULLETHOLE")) BULLETHOLE = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE1")) BOTTLE1 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE2")) BOTTLE2 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE3")) BOTTLE3 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE4")) BOTTLE4 = lValue; + else if (!Bstrcmp(szLabel,"BROKEHYDROPLANT")) BROKEHYDROPLANT = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE5")) BOTTLE5 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE6")) BOTTLE6 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE8")) BOTTLE8 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE7")) BOTTLE7 = lValue; + else if (!Bstrcmp(szLabel,"BROKENCLOCK")) BROKENCLOCK = lValue; + else if (!Bstrcmp(szLabel,"BIGHOLE")) BIGHOLE = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE10")) BOTTLE10 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE11")) BOTTLE11 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE12")) BOTTLE12 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE13")) BOTTLE13 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE14")) BOTTLE14 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE15")) BOTTLE15 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE16")) BOTTLE16 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE17")) BOTTLE17 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE18")) BOTTLE18 = lValue; + else if (!Bstrcmp(szLabel,"BOTTLE19")) BOTTLE19 = lValue; + else if (!Bstrcmp(szLabel,"BARBROKE")) BARBROKE = lValue; + else if (!Bstrcmp(szLabel,"BLOODPOOL")) BLOODPOOL = lValue; + else if (!Bstrcmp(szLabel,"BANNER")) BANNER = lValue; + else if (!Bstrcmp(szLabel,"BLANKSCREEN")) BLANKSCREEN = lValue; + else if (!Bstrcmp(szLabel,"BLOODYPOLE")) BLOODYPOLE = lValue; + else if (!Bstrcmp(szLabel,"BLOOD")) BLOOD = lValue; + else if (!Bstrcmp(szLabel,"BURNING")) BURNING = lValue; + else if (!Bstrcmp(szLabel,"BLOODSPLAT1")) BLOODSPLAT1 = lValue; + else if (!Bstrcmp(szLabel,"BLOODSPLAT3")) BLOODSPLAT3 = lValue; + else if (!Bstrcmp(szLabel,"BLOODSPLAT2")) BLOODSPLAT2 = lValue; + else if (!Bstrcmp(szLabel,"BLOODSPLAT4")) BLOODSPLAT4 = lValue; + else if (!Bstrcmp(szLabel,"BURNING2")) BURNING2 = lValue; + else if (!Bstrcmp(szLabel,"BETAVERSION")) BETAVERSION = lValue; + else if (!Bstrcmp(szLabel,"BADGUYICON")) BADGUYICON = lValue; + else if (!Bstrcmp(szLabel,"BOTTOMSTATUSBAR")) BOTTOMSTATUSBAR = lValue; + else if (!Bstrcmp(szLabel,"BOOT_ICON")) BOOT_ICON = lValue; + else if (!Bstrcmp(szLabel,"BETASCREEN")) BETASCREEN = lValue; + else if (!Bstrcmp(szLabel,"BOSS1")) BOSS1 = lValue; + else if (!Bstrcmp(szLabel,"BOSS1STAYPUT")) BOSS1STAYPUT = lValue; + else if (!Bstrcmp(szLabel,"BOSS1SHOOT")) BOSS1SHOOT = lValue; + else if (!Bstrcmp(szLabel,"BOSS1LOB")) BOSS1LOB = lValue; + else if (!Bstrcmp(szLabel,"BOSSTOP")) BOSSTOP = lValue; + else if (!Bstrcmp(szLabel,"BOSS2")) BOSS2 = lValue; + else if (!Bstrcmp(szLabel,"BOSS3")) BOSS3 = lValue; + else if (!Bstrcmp(szLabel,"BIGFNTCURSOR")) BIGFNTCURSOR = lValue; + else if (!Bstrcmp(szLabel,"BIGALPHANUM")) BIGALPHANUM = lValue; + else if (!Bstrcmp(szLabel,"BIGPERIOD")) BIGPERIOD = lValue; + else if (!Bstrcmp(szLabel,"BIGCOMMA")) BIGCOMMA = lValue; + else if (!Bstrcmp(szLabel,"BIGX")) BIGX = lValue; + else if (!Bstrcmp(szLabel,"BIGQ")) BIGQ = lValue; + else if (!Bstrcmp(szLabel,"BIGSEMI")) BIGSEMI = lValue; + else if (!Bstrcmp(szLabel,"BIGCOLIN")) BIGCOLIN = lValue; + else if (!Bstrcmp(szLabel,"BIGAPPOS")) BIGAPPOS = lValue; + else if (!Bstrcmp(szLabel,"BLANK")) BLANK = lValue; + else if (!Bstrcmp(szLabel,"BUTTON1")) BUTTON1 = lValue; + else if (!Bstrcmp(szLabel,"BONUSSCREEN")) BONUSSCREEN = lValue; + else if (!Bstrcmp(szLabel,"BORNTOBEWILDSCREEN")) BORNTOBEWILDSCREEN = lValue; + else if (!Bstrcmp(szLabel,"BLIMP")) BLIMP = lValue; + else if (!Bstrcmp(szLabel,"BPANNEL3")) BPANNEL3 = lValue; + else if (!Bstrcmp(szLabel,"BROOM")) BROOM = lValue; + else if (!Bstrcmp(szLabel,"BOSS4")) BOSS4 = lValue; + else if (!Bstrcmp(szLabel,"BOSS4STAYPUT")) BOSS4STAYPUT = lValue; + break; + case 'C': + if (!Bstrcmp(szLabel,"CYCLER")) CYCLER = lValue; + else if (!Bstrcmp(szLabel,"CHAINGUNSPRITE")) CHAINGUNSPRITE = lValue; + else if (!Bstrcmp(szLabel,"CRYSTALAMMO")) CRYSTALAMMO = lValue; + else if (!Bstrcmp(szLabel,"COLA")) COLA = lValue; + else if (!Bstrcmp(szLabel,"CLOUDYOCEAN")) CLOUDYOCEAN = lValue; + else if (!Bstrcmp(szLabel,"CLOUDYSKIES")) CLOUDYSKIES = lValue; + else if (!Bstrcmp(szLabel,"CRACK1")) CRACK1 = lValue; + else if (!Bstrcmp(szLabel,"CRACK2")) CRACK2 = lValue; + else if (!Bstrcmp(szLabel,"CRACK3")) CRACK3 = lValue; + else if (!Bstrcmp(szLabel,"CRACK4")) CRACK4 = lValue; + else if (!Bstrcmp(szLabel,"CAMERAPOLE")) CAMERAPOLE = lValue; + else if (!Bstrcmp(szLabel,"CHAIR1")) CHAIR1 = lValue; + else if (!Bstrcmp(szLabel,"CHAIR2")) CHAIR2 = lValue; + else if (!Bstrcmp(szLabel,"CAMERA1")) CAMERA1 = lValue; + else if (!Bstrcmp(szLabel,"CHAIR3")) CHAIR3 = lValue; + else if (!Bstrcmp(szLabel,"CAMERALIGHT")) CAMERALIGHT = lValue; + else if (!Bstrcmp(szLabel,"CACTUS")) CACTUS = lValue; + else if (!Bstrcmp(szLabel,"CACTUSBROKE")) CACTUSBROKE = lValue; + else if (!Bstrcmp(szLabel,"CONE")) CONE = lValue; + else if (!Bstrcmp(szLabel,"CLOCK")) CLOCK = lValue; + else if (!Bstrcmp(szLabel,"CIRCLEPANNEL")) CIRCLEPANNEL = lValue; + else if (!Bstrcmp(szLabel,"CIRCLEPANNELBROKE")) CIRCLEPANNELBROKE = lValue; + else if (!Bstrcmp(szLabel,"COLAMACHINE")) COLAMACHINE = lValue; + else if (!Bstrcmp(szLabel,"COLAMACHINEBROKE")) COLAMACHINEBROKE = lValue; + else if (!Bstrcmp(szLabel,"CRANEPOLE")) CRANEPOLE = lValue; + else if (!Bstrcmp(szLabel,"CRANE")) CRANE = lValue; + else if (!Bstrcmp(szLabel,"CANWITHSOMETHING")) CANWITHSOMETHING = lValue; + else if (!Bstrcmp(szLabel,"CEILINGSTEAM")) CEILINGSTEAM = lValue; + else if (!Bstrcmp(szLabel,"COOLEXPLOSION1")) COOLEXPLOSION1 = lValue; + else if (!Bstrcmp(szLabel,"CANNONBALL")) CANNONBALL = lValue; + else if (!Bstrcmp(szLabel,"COMMANDER")) COMMANDER = lValue; + else if (!Bstrcmp(szLabel,"COMMANDERSTAYPUT")) COMMANDERSTAYPUT = lValue; + else if (!Bstrcmp(szLabel,"CRACKKNUCKLES")) CRACKKNUCKLES = lValue; + else if (!Bstrcmp(szLabel,"CAMCORNER")) CAMCORNER = lValue; + else if (!Bstrcmp(szLabel,"CAMLIGHT")) CAMLIGHT = lValue; + else if (!Bstrcmp(szLabel,"CROSSHAIR")) CROSSHAIR = lValue; + else if (!Bstrcmp(szLabel,"CLIPINHAND")) CLIPINHAND = lValue; + else if (!Bstrcmp(szLabel,"CHAINGUN")) CHAINGUN = lValue; + else if (!Bstrcmp(szLabel,"CATLITE")) CATLITE = lValue; + else if (!Bstrcmp(szLabel,"COFFEEMACHINE")) COFFEEMACHINE = lValue; + else if (!Bstrcmp(szLabel,"CUPS")) CUPS = lValue; + else if (!Bstrcmp(szLabel,"COFFEEMUG")) COFFEEMUG = lValue; + else if (!Bstrcmp(szLabel,"CHESTOFGOLD")) CHESTOFGOLD = lValue; + else if (!Bstrcmp(szLabel,"CANWITHSOMETHING2")) CANWITHSOMETHING2 = lValue; + else if (!Bstrcmp(szLabel,"CANWITHSOMETHING3")) CANWITHSOMETHING3 = lValue; + else if (!Bstrcmp(szLabel,"CANWITHSOMETHING4")) CANWITHSOMETHING4 = lValue; + break; + case 'D': + if (!Bstrcmp(szLabel,"DEVISTATORSPRITE")) DEVISTATORSPRITE = lValue; + else if (!Bstrcmp(szLabel,"DEVISTATORAMMO")) DEVISTATORAMMO = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE5")) DOORTILE5 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE6")) DOORTILE6 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE1")) DOORTILE1 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE2")) DOORTILE2 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE3")) DOORTILE3 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE4")) DOORTILE4 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE7")) DOORTILE7 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE8")) DOORTILE8 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE9")) DOORTILE9 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE10")) DOORTILE10 = lValue; + else if (!Bstrcmp(szLabel,"DOORSHOCK")) DOORSHOCK = lValue; + else if (!Bstrcmp(szLabel,"DIPSWITCH")) DIPSWITCH = lValue; + else if (!Bstrcmp(szLabel,"DIPSWITCH2")) DIPSWITCH2 = lValue; + else if (!Bstrcmp(szLabel,"DIPSWITCH3")) DIPSWITCH3 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE22")) DOORTILE22 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE18")) DOORTILE18 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE19")) DOORTILE19 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE20")) DOORTILE20 = lValue; + else if (!Bstrcmp(szLabel,"DOMELITE")) DOMELITE = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE14")) DOORTILE14 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE16")) DOORTILE16 = lValue; + else if (!Bstrcmp(szLabel,"DONUTS")) DONUTS = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE15")) DOORTILE15 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE21")) DOORTILE21 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE17")) DOORTILE17 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE11")) DOORTILE11 = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE12")) DOORTILE12 = lValue; + else if (!Bstrcmp(szLabel,"DUKELYINGDEAD")) DUKELYINGDEAD = lValue; + else if (!Bstrcmp(szLabel,"DUKETORSO")) DUKETORSO = lValue; + else if (!Bstrcmp(szLabel,"DUKEGUN")) DUKEGUN = lValue; + else if (!Bstrcmp(szLabel,"DUKELEG")) DUKELEG = lValue; + else if (!Bstrcmp(szLabel,"DEVISTATORBLAST")) DEVISTATORBLAST = lValue; + else if (!Bstrcmp(szLabel,"DRONE")) DRONE = lValue; + else if (!Bstrcmp(szLabel,"DUKEICON")) DUKEICON = lValue; + else if (!Bstrcmp(szLabel,"DIGITALNUM")) DIGITALNUM = lValue; + else if (!Bstrcmp(szLabel,"DUKECAR")) DUKECAR = lValue; + else if (!Bstrcmp(szLabel,"DREALMS")) DREALMS = lValue; + else if (!Bstrcmp(szLabel,"DUKENUKEM")) DUKENUKEM = lValue; + else if (!Bstrcmp(szLabel,"DEVISTATOR")) DEVISTATOR = lValue; + else if (!Bstrcmp(szLabel,"DUKECUTOUT")) DUKECUTOUT = lValue; + else if (!Bstrcmp(szLabel,"DUCK")) DUCK = lValue; + else if (!Bstrcmp(szLabel,"DESKLAMP")) DESKLAMP = lValue; + else if (!Bstrcmp(szLabel,"DOORTILE23")) DOORTILE23 = lValue; + else if (!Bstrcmp(szLabel,"DONUTS2")) DONUTS2 = lValue; + else if (!Bstrcmp(szLabel,"DESKPHONE")) DESKPHONE = lValue; + else if (!Bstrcmp(szLabel,"DUKEBURGER")) DUKEBURGER = lValue; + else if (!Bstrcmp(szLabel,"DOLPHIN1")) DOLPHIN1 = lValue; + else if (!Bstrcmp(szLabel,"DOLPHIN2")) DOLPHIN2 = lValue; + else if (!Bstrcmp(szLabel,"DUKETAG")) DUKETAG = lValue; + break; + case 'E': + if (!Bstrcmp(szLabel,"EPISODE")) EPISODE = lValue; + else if (!Bstrcmp(szLabel,"EGG")) EGG = lValue; + else if (!Bstrcmp(szLabel,"EXPLODINGBARREL")) EXPLODINGBARREL = lValue; + else if (!Bstrcmp(szLabel,"EXPLODINGBARREL2")) EXPLODINGBARREL2 = lValue; + else if (!Bstrcmp(szLabel,"EXPLOSION2")) EXPLOSION2 = lValue; + else if (!Bstrcmp(szLabel,"EXPLOSION2BOT")) EXPLOSION2BOT = lValue; + else if (!Bstrcmp(szLabel,"ENDALPHANUM")) ENDALPHANUM = lValue; + break; + case 'F': + if (!Bstrcmp(szLabel,"FOF")) FOF = lValue; + else if (!Bstrcmp(szLabel,"FIRSTGUNSPRITE")) FIRSTGUNSPRITE = lValue; + else if (!Bstrcmp(szLabel,"FREEZESPRITE")) FREEZESPRITE = lValue; + else if (!Bstrcmp(szLabel,"FREEZEAMMO")) FREEZEAMMO = lValue; + else if (!Bstrcmp(szLabel,"FIRSTAID")) FIRSTAID = lValue; + else if (!Bstrcmp(szLabel,"FRANKENSTINESWITCH")) FRANKENSTINESWITCH = lValue; + else if (!Bstrcmp(szLabel,"FLOORSLIME")) FLOORSLIME = lValue; + else if (!Bstrcmp(szLabel,"FANSPRITE")) FANSPRITE = lValue; + else if (!Bstrcmp(szLabel,"FANSPRITEBROKE")) FANSPRITEBROKE = lValue; + else if (!Bstrcmp(szLabel,"FANSHADOW")) FANSHADOW = lValue; + else if (!Bstrcmp(szLabel,"FANSHADOWBROKE")) FANSHADOWBROKE = lValue; + else if (!Bstrcmp(szLabel,"FUELPOD")) FUELPOD = lValue; + else if (!Bstrcmp(szLabel,"FOOTPRINTS")) FOOTPRINTS = lValue; + else if (!Bstrcmp(szLabel,"FEMMAG1")) FEMMAG1 = lValue; + else if (!Bstrcmp(szLabel,"FEMMAG2")) FEMMAG2 = lValue; + else if (!Bstrcmp(szLabel,"FOOTPRINTS2")) FOOTPRINTS2 = lValue; + else if (!Bstrcmp(szLabel,"FOOTPRINTS3")) FOOTPRINTS3 = lValue; + else if (!Bstrcmp(szLabel,"FOOTPRINTS4")) FOOTPRINTS4 = lValue; + else if (!Bstrcmp(szLabel,"FIREEXT")) FIREEXT = lValue; + else if (!Bstrcmp(szLabel,"FEMPIC5")) FEMPIC5 = lValue; + else if (!Bstrcmp(szLabel,"FEMPIC6")) FEMPIC6 = lValue; + else if (!Bstrcmp(szLabel,"FEMPIC7")) FEMPIC7 = lValue; + else if (!Bstrcmp(szLabel,"FLOORPLASMA")) FLOORPLASMA = lValue; + else if (!Bstrcmp(szLabel,"FIREBARREL")) FIREBARREL = lValue; + else if (!Bstrcmp(szLabel,"FEMPIC1")) FEMPIC1 = lValue; + else if (!Bstrcmp(szLabel,"FEMPIC2")) FEMPIC2 = lValue; + else if (!Bstrcmp(szLabel,"FEMPIC3")) FEMPIC3 = lValue; + else if (!Bstrcmp(szLabel,"FEMPIC4")) FEMPIC4 = lValue; + else if (!Bstrcmp(szLabel,"FEM1")) FEM1 = lValue; + else if (!Bstrcmp(szLabel,"FEM2")) FEM2 = lValue; + else if (!Bstrcmp(szLabel,"FEM3")) FEM3 = lValue; + else if (!Bstrcmp(szLabel,"FEM5")) FEM5 = lValue; + else if (!Bstrcmp(szLabel,"FEM4")) FEM4 = lValue; + else if (!Bstrcmp(szLabel,"FEM6")) FEM6 = lValue; + else if (!Bstrcmp(szLabel,"FEM6PAD")) FEM6PAD = lValue; + else if (!Bstrcmp(szLabel,"FEM8")) FEM8 = lValue; + else if (!Bstrcmp(szLabel,"FETUSJIB")) FETUSJIB = lValue; + else if (!Bstrcmp(szLabel,"FETUS")) FETUS = lValue; + else if (!Bstrcmp(szLabel,"FETUSBROKE")) FETUSBROKE = lValue; + else if (!Bstrcmp(szLabel,"FIREVASE")) FIREVASE = lValue; + else if (!Bstrcmp(szLabel,"FEM7")) FEM7 = lValue; + else if (!Bstrcmp(szLabel,"FIRELASER")) FIRELASER = lValue; + else if (!Bstrcmp(szLabel,"FIST")) FIST = lValue; + else if (!Bstrcmp(szLabel,"FREEZEBLAST")) FREEZEBLAST = lValue; + else if (!Bstrcmp(szLabel,"FORCERIPPLE")) FORCERIPPLE = lValue; + else if (!Bstrcmp(szLabel,"FECES")) FECES = lValue; + else if (!Bstrcmp(szLabel,"FIRE")) FIRE = lValue; + else if (!Bstrcmp(szLabel,"FIRE2")) FIRE2 = lValue; + else if (!Bstrcmp(szLabel,"FLOORFLAME")) FLOORFLAME = lValue; + else if (!Bstrcmp(szLabel,"F1HELP")) F1HELP = lValue; + else if (!Bstrcmp(szLabel,"FOODICON")) FOODICON = lValue; + else if (!Bstrcmp(szLabel,"FIRSTAID_ICON")) FIRSTAID_ICON = lValue; + else if (!Bstrcmp(szLabel,"FRAGBAR")) FRAGBAR = lValue; + else if (!Bstrcmp(szLabel,"FIRSTGUN")) FIRSTGUN = lValue; + else if (!Bstrcmp(szLabel,"FIRSTGUNRELOAD")) FIRSTGUNRELOAD = lValue; + else if (!Bstrcmp(szLabel,"FALLINGCLIP")) FALLINGCLIP = lValue; + else if (!Bstrcmp(szLabel,"FREEZE")) FREEZE = lValue; + else if (!Bstrcmp(szLabel,"FORCESPHERE")) FORCESPHERE = lValue; + else if (!Bstrcmp(szLabel,"FEM9")) FEM9 = lValue; + else if (!Bstrcmp(szLabel,"FOOTPRINT")) FOOTPRINT = lValue; + else if (!Bstrcmp(szLabel,"FRAMEEFFECT1")) FRAMEEFFECT1 = lValue; + else if (!Bstrcmp(szLabel,"FRAMEEFFECT1_13")) FRAMEEFFECT1_13 = lValue; + else if (!Bstrcmp(szLabel,"FLOORBASKET")) FLOORBASKET = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT1")) FOODOBJECT1 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT2")) FOODOBJECT2 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT3")) FOODOBJECT3 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT4")) FOODOBJECT4 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT5")) FOODOBJECT5 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT6")) FOODOBJECT6 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT7")) FOODOBJECT7 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT8")) FOODOBJECT8 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT9")) FOODOBJECT9 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT10")) FOODOBJECT10 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT11")) FOODOBJECT11 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT12")) FOODOBJECT12 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT13")) FOODOBJECT13 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT14")) FOODOBJECT14 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT15")) FOODOBJECT15 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT16")) FOODOBJECT16 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT17")) FOODOBJECT17 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT18")) FOODOBJECT18 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT19")) FOODOBJECT19 = lValue; + else if (!Bstrcmp(szLabel,"FOODOBJECT20")) FOODOBJECT20 = lValue; + else if (!Bstrcmp(szLabel,"FEATHEREDCHICKEN")) FEATHEREDCHICKEN = lValue; + else if (!Bstrcmp(szLabel,"FEM10")) FEM10 = lValue; + break; + case 'G': + if (!Bstrcmp(szLabel,"GPSPEED")) GPSPEED = lValue; + else if (!Bstrcmp(szLabel,"GROWSPRITEICON")) GROWSPRITEICON = lValue; + else if (!Bstrcmp(szLabel,"GROWAMMO")) GROWAMMO = lValue; + else if (!Bstrcmp(szLabel,"GLASS")) GLASS = lValue; + else if (!Bstrcmp(szLabel,"GLASS2")) GLASS2 = lValue; + else if (!Bstrcmp(szLabel,"GRATE1")) GRATE1 = lValue; + else if (!Bstrcmp(szLabel,"GENERICPOLE")) GENERICPOLE = lValue; + else if (!Bstrcmp(szLabel,"GLASSPIECES")) GLASSPIECES = lValue; + else if (!Bstrcmp(szLabel,"GREENSLIME")) GREENSLIME = lValue; + else if (!Bstrcmp(szLabel,"GROWSPARK")) GROWSPARK = lValue; + else if (!Bstrcmp(szLabel,"GETICON")) GETICON = lValue; + else if (!Bstrcmp(szLabel,"GLAIR")) GLAIR = lValue; + else if (!Bstrcmp(szLabel,"GLASS3")) GLASS3 = lValue; + else if (!Bstrcmp(szLabel,"GUNPOWDERBARREL")) GUNPOWDERBARREL = lValue; + else if (!Bstrcmp(szLabel,"GAVALS")) GAVALS = lValue; + else if (!Bstrcmp(szLabel,"GAVALS2")) GAVALS2 = lValue; + else if (!Bstrcmp(szLabel,"GUMBALLMACHINE")) GUMBALLMACHINE = lValue; + else if (!Bstrcmp(szLabel,"GUMBALLMACHINEBROKE")) GUMBALLMACHINEBROKE = lValue; + else if (!Bstrcmp(szLabel,"GENERICPOLE2")) GENERICPOLE2 = lValue; + break; + case 'H': + if (!Bstrcmp(szLabel,"HEAVYHBOMB")) HEAVYHBOMB = lValue; + else if (!Bstrcmp(szLabel,"HEALTHBOX")) HEALTHBOX = lValue; + else if (!Bstrcmp(szLabel,"HBOMBAMMO")) HBOMBAMMO = lValue; + else if (!Bstrcmp(szLabel,"HEATSENSOR")) HEATSENSOR = lValue; + else if (!Bstrcmp(szLabel,"HURTRAIL")) HURTRAIL = lValue; + else if (!Bstrcmp(szLabel,"HYDROPLANT")) HYDROPLANT = lValue; + else if (!Bstrcmp(szLabel,"HANGLIGHT")) HANGLIGHT = lValue; + else if (!Bstrcmp(szLabel,"HYDRENT")) HYDRENT = lValue; + else if (!Bstrcmp(szLabel,"HANGOOZ")) HANGOOZ = lValue; + else if (!Bstrcmp(szLabel,"HORSEONSIDE")) HORSEONSIDE = lValue; + else if (!Bstrcmp(szLabel,"HORSELITE")) HORSELITE = lValue; + else if (!Bstrcmp(szLabel,"HANDSWITCH")) HANDSWITCH = lValue; + else if (!Bstrcmp(szLabel,"HANDPRINTSWITCH")) HANDPRINTSWITCH = lValue; + else if (!Bstrcmp(szLabel,"HELECOPT")) HELECOPT = lValue; + else if (!Bstrcmp(szLabel,"HOLODUKE")) HOLODUKE = lValue; + else if (!Bstrcmp(szLabel,"HEADJIB1")) HEADJIB1 = lValue; + else if (!Bstrcmp(szLabel,"HEADERBAR")) HEADERBAR = lValue; + else if (!Bstrcmp(szLabel,"HEAT_ICON")) HEAT_ICON = lValue; + else if (!Bstrcmp(szLabel,"HOLODUKE_ICON")) HOLODUKE_ICON = lValue; + else if (!Bstrcmp(szLabel,"HAND")) HAND = lValue; + else if (!Bstrcmp(szLabel,"HANDHOLDINGLASER")) HANDHOLDINGLASER = lValue; + else if (!Bstrcmp(szLabel,"HANDHOLDINGACCESS")) HANDHOLDINGACCESS = lValue; + else if (!Bstrcmp(szLabel,"HANDREMOTE")) HANDREMOTE = lValue; + else if (!Bstrcmp(szLabel,"HANDTHROW")) HANDTHROW = lValue; + else if (!Bstrcmp(szLabel,"HATRACK")) HATRACK = lValue; + else if (!Bstrcmp(szLabel,"HOTMEAT")) HOTMEAT = lValue; + else if (!Bstrcmp(szLabel,"HEADLAMP")) HEADLAMP = lValue; + break; + case 'I': + if (!Bstrcmp(szLabel,"INVENTORYBOX")) INVENTORYBOX = lValue; + else if (!Bstrcmp(szLabel,"IVUNIT")) IVUNIT = lValue; + else if (!Bstrcmp(szLabel,"INDY")) INDY = lValue; + else if (!Bstrcmp(szLabel,"INNERJAW")) INNERJAW = lValue; + else if (!Bstrcmp(szLabel,"INGAMEDUKETHREEDEE")) INGAMEDUKETHREEDEE = lValue; + break; + case 'J': + if (!Bstrcmp(szLabel,"JETPACK")) JETPACK = lValue; + else if (!Bstrcmp(szLabel,"JAILBARBREAK")) JAILBARBREAK = lValue; + else if (!Bstrcmp(szLabel,"JIBS1")) JIBS1 = lValue; + else if (!Bstrcmp(szLabel,"JIBS2")) JIBS2 = lValue; + else if (!Bstrcmp(szLabel,"JIBS3")) JIBS3 = lValue; + else if (!Bstrcmp(szLabel,"JIBS4")) JIBS4 = lValue; + else if (!Bstrcmp(szLabel,"JIBS5")) JIBS5 = lValue; + else if (!Bstrcmp(szLabel,"JIBS6")) JIBS6 = lValue; + else if (!Bstrcmp(szLabel,"JETPACK_ICON")) JETPACK_ICON = lValue; + else if (!Bstrcmp(szLabel,"JOLLYMEAL")) JOLLYMEAL = lValue; + else if (!Bstrcmp(szLabel,"JURYGUY")) JURYGUY = lValue; + break; + case 'K': + if (!Bstrcmp(szLabel,"KILLSICON")) KILLSICON = lValue; + else if (!Bstrcmp(szLabel,"KNEE")) KNEE = lValue; + break; + case 'L': + if (!Bstrcmp(szLabel,"LOCATORS")) LOCATORS = lValue; + else if (!Bstrcmp(szLabel,"LA")) LA = lValue; + else if (!Bstrcmp(szLabel,"LIGHTSWITCH")) LIGHTSWITCH = lValue; + else if (!Bstrcmp(szLabel,"LIGHTSWITCH2")) LIGHTSWITCH2 = lValue; + else if (!Bstrcmp(szLabel,"LOCKSWITCH1")) LOCKSWITCH1 = lValue; + else if (!Bstrcmp(szLabel,"LUKE")) LUKE = lValue; + else if (!Bstrcmp(szLabel,"LOOGIE")) LOOGIE = lValue; + else if (!Bstrcmp(szLabel,"LIZTROOP")) LIZTROOP = lValue; + else if (!Bstrcmp(szLabel,"LIZTROOPRUNNING")) LIZTROOPRUNNING = lValue; + else if (!Bstrcmp(szLabel,"LIZTROOPSTAYPUT")) LIZTROOPSTAYPUT = lValue; + else if (!Bstrcmp(szLabel,"LIZTOP")) LIZTOP = lValue; + else if (!Bstrcmp(szLabel,"LIZTROOPSHOOT")) LIZTROOPSHOOT = lValue; + else if (!Bstrcmp(szLabel,"LIZTROOPJETPACK")) LIZTROOPJETPACK = lValue; + else if (!Bstrcmp(szLabel,"LIZTROOPDSPRITE")) LIZTROOPDSPRITE = lValue; + else if (!Bstrcmp(szLabel,"LIZTROOPONTOILET")) LIZTROOPONTOILET = lValue; + else if (!Bstrcmp(szLabel,"LIZTROOPJUSTSIT")) LIZTROOPJUSTSIT = lValue; + else if (!Bstrcmp(szLabel,"LIZTROOPDUCKING")) LIZTROOPDUCKING = lValue; + else if (!Bstrcmp(szLabel,"LEGJIB1")) LEGJIB1 = lValue; + else if (!Bstrcmp(szLabel,"LIZMAN")) LIZMAN = lValue; + else if (!Bstrcmp(szLabel,"LIZMANSTAYPUT")) LIZMANSTAYPUT = lValue; + else if (!Bstrcmp(szLabel,"LIZMANSPITTING")) LIZMANSPITTING = lValue; + else if (!Bstrcmp(szLabel,"LIZMANFEEDING")) LIZMANFEEDING = lValue; + else if (!Bstrcmp(szLabel,"LIZMANJUMP")) LIZMANJUMP = lValue; + else if (!Bstrcmp(szLabel,"LIZMANDEADSPRITE")) LIZMANDEADSPRITE = lValue; + else if (!Bstrcmp(szLabel,"LIZMANHEAD1")) LIZMANHEAD1 = lValue; + else if (!Bstrcmp(szLabel,"LIZMANARM1")) LIZMANARM1 = lValue; + else if (!Bstrcmp(szLabel,"LIZMANLEG1")) LIZMANLEG1 = lValue; + else if (!Bstrcmp(szLabel,"LOGO")) LOGO = lValue; + else if (!Bstrcmp(szLabel,"LASERLINE")) LASERLINE = lValue; + else if (!Bstrcmp(szLabel,"LASERSITE")) LASERSITE = lValue; + else if (!Bstrcmp(szLabel,"LOADSCREEN")) LOADSCREEN = lValue; + else if (!Bstrcmp(szLabel,"LAVABUBBLE")) LAVABUBBLE = lValue; + else if (!Bstrcmp(szLabel,"LETTER")) LETTER = lValue; + break; + case 'M': + if (!Bstrcmp(szLabel,"MUSICANDSFX")) MUSICANDSFX = lValue; + else if (!Bstrcmp(szLabel,"MASTERSWITCH")) MASTERSWITCH = lValue; + else if (!Bstrcmp(szLabel,"MIRRORBROKE")) MIRRORBROKE = lValue; + else if (!Bstrcmp(szLabel,"MOONSKY1")) MOONSKY1 = lValue; + else if (!Bstrcmp(szLabel,"MOONSKY2")) MOONSKY2 = lValue; + else if (!Bstrcmp(szLabel,"MOONSKY3")) MOONSKY3 = lValue; + else if (!Bstrcmp(szLabel,"MOONSKY4")) MOONSKY4 = lValue; + else if (!Bstrcmp(szLabel,"MULTISWITCH")) MULTISWITCH = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL9")) MASKWALL9 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL1")) MASKWALL1 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL10")) MASKWALL10 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL11")) MASKWALL11 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL5")) MASKWALL5 = lValue; + else if (!Bstrcmp(szLabel,"MIRROR")) MIRROR = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL12")) MASKWALL12 = lValue; + else if (!Bstrcmp(szLabel,"MOVIECAMERA")) MOVIECAMERA = lValue; + else if (!Bstrcmp(szLabel,"MIKE")) MIKE = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL13")) MASKWALL13 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL2")) MASKWALL2 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL3")) MASKWALL3 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL4")) MASKWALL4 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL14")) MASKWALL14 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL15")) MASKWALL15 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL6")) MASKWALL6 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL8")) MASKWALL8 = lValue; + else if (!Bstrcmp(szLabel,"MASKWALL7")) MASKWALL7 = lValue; + else if (!Bstrcmp(szLabel,"MONEY")) MONEY = lValue; + else if (!Bstrcmp(szLabel,"MONK")) MONK = lValue; + else if (!Bstrcmp(szLabel,"MORTER")) MORTER = lValue; + else if (!Bstrcmp(szLabel,"MENUSCREEN")) MENUSCREEN = lValue; + else if (!Bstrcmp(szLabel,"MENUBAR")) MENUBAR = lValue; + else if (!Bstrcmp(szLabel,"MOUSECURSOR")) MOUSECURSOR = lValue; + else if (!Bstrcmp(szLabel,"MINIFONT")) MINIFONT = lValue; + else if (!Bstrcmp(szLabel,"MAIL")) MAIL = lValue; + else if (!Bstrcmp(szLabel,"MAILBAG")) MAILBAG = lValue; + else if (!Bstrcmp(szLabel,"METER")) METER = lValue; + else if (!Bstrcmp(szLabel,"MACE")) MACE = lValue; + else if (!Bstrcmp(szLabel,"MOP")) MOP = lValue; + else if (!Bstrcmp(szLabel,"MAN")) MAN = lValue; + else if (!Bstrcmp(szLabel,"MAN2")) MAN2 = lValue; + break; + case 'N': + if (!Bstrcmp(szLabel,"NUKEBUTTON")) NUKEBUTTON = lValue; + else if (!Bstrcmp(szLabel,"NAKED1")) NAKED1 = lValue; + else if (!Bstrcmp(szLabel,"NEON1")) NEON1 = lValue; + else if (!Bstrcmp(szLabel,"NEON2")) NEON2 = lValue; + else if (!Bstrcmp(szLabel,"NEON3")) NEON3 = lValue; + else if (!Bstrcmp(szLabel,"NEON4")) NEON4 = lValue; + else if (!Bstrcmp(szLabel,"NEON5")) NEON5 = lValue; + else if (!Bstrcmp(szLabel,"NEON6")) NEON6 = lValue; + else if (!Bstrcmp(szLabel,"NUKEBARREL")) NUKEBARREL = lValue; + else if (!Bstrcmp(szLabel,"NUKEBARRELDENTED")) NUKEBARRELDENTED = lValue; + else if (!Bstrcmp(szLabel,"NUKEBARRELLEAKED")) NUKEBARRELLEAKED = lValue; + else if (!Bstrcmp(szLabel,"NOTCHON")) NOTCHON = lValue; + else if (!Bstrcmp(szLabel,"NOTCHOFF")) NOTCHOFF = lValue; + else if (!Bstrcmp(szLabel,"NUKEWARNINGICON")) NUKEWARNINGICON = lValue; + else if (!Bstrcmp(szLabel,"NEWBEAST")) NEWBEAST = lValue; + else if (!Bstrcmp(szLabel,"NEWBEASTSTAYPUT")) NEWBEASTSTAYPUT = lValue; + else if (!Bstrcmp(szLabel,"NEWBEASTJUMP")) NEWBEASTJUMP = lValue; + else if (!Bstrcmp(szLabel,"NEWBEASTHANG")) NEWBEASTHANG = lValue; + else if (!Bstrcmp(szLabel,"NEWBEASTHANGDEAD")) NEWBEASTHANGDEAD = lValue; + else if (!Bstrcmp(szLabel,"NATURALLIGHTNING")) NATURALLIGHTNING = lValue; + break; + case 'O': + if (!Bstrcmp(szLabel,"OJ")) OJ = lValue; + else if (!Bstrcmp(szLabel,"OCEANSPRITE1")) OCEANSPRITE1 = lValue; + else if (!Bstrcmp(szLabel,"OCEANSPRITE2")) OCEANSPRITE2 = lValue; + else if (!Bstrcmp(szLabel,"OCEANSPRITE3")) OCEANSPRITE3 = lValue; + else if (!Bstrcmp(szLabel,"OCEANSPRITE4")) OCEANSPRITE4 = lValue; + else if (!Bstrcmp(szLabel,"OCEANSPRITE5")) OCEANSPRITE5 = lValue; + else if (!Bstrcmp(szLabel,"OOZFILTER")) OOZFILTER = lValue; + else if (!Bstrcmp(szLabel,"OCTABRAIN")) OCTABRAIN = lValue; + else if (!Bstrcmp(szLabel,"OCTABRAINSTAYPUT")) OCTABRAINSTAYPUT = lValue; + else if (!Bstrcmp(szLabel,"OCTATOP")) OCTATOP = lValue; + else if (!Bstrcmp(szLabel,"OCTADEADSPRITE")) OCTADEADSPRITE = lValue; + else if (!Bstrcmp(szLabel,"OOZ")) OOZ = lValue; + else if (!Bstrcmp(szLabel,"OOZ2")) OOZ2 = lValue; + else if (!Bstrcmp(szLabel,"ORGANTIC")) ORGANTIC = lValue; + else if (!Bstrcmp(szLabel,"ORDERING")) ORDERING = lValue; + break; + case 'P': + if (!Bstrcmp(szLabel,"PANNEL1")) PANNEL1 = lValue; + else if (!Bstrcmp(szLabel,"PANNEL2")) PANNEL2 = lValue; + else if (!Bstrcmp(szLabel,"PIPE2")) PIPE2 = lValue; + else if (!Bstrcmp(szLabel,"PIPE1B")) PIPE1B = lValue; + else if (!Bstrcmp(szLabel,"PIPE3")) PIPE3 = lValue; + else if (!Bstrcmp(szLabel,"PIPE1")) PIPE1 = lValue; + else if (!Bstrcmp(szLabel,"PIPE2B")) PIPE2B = lValue; + else if (!Bstrcmp(szLabel,"POT1")) POT1 = lValue; + else if (!Bstrcmp(szLabel,"POT2")) POT2 = lValue; + else if (!Bstrcmp(szLabel,"POT3")) POT3 = lValue; + else if (!Bstrcmp(szLabel,"PIPE3B")) PIPE3B = lValue; + else if (!Bstrcmp(szLabel,"POWERSWITCH1")) POWERSWITCH1 = lValue; + else if (!Bstrcmp(szLabel,"POWERSWITCH2")) POWERSWITCH2 = lValue; + else if (!Bstrcmp(szLabel,"POCKET")) POCKET = lValue; + else if (!Bstrcmp(szLabel,"PIPE5")) PIPE5 = lValue; + else if (!Bstrcmp(szLabel,"PIPE6")) PIPE6 = lValue; + else if (!Bstrcmp(szLabel,"PIPE4")) PIPE4 = lValue; + else if (!Bstrcmp(szLabel,"PIPE4B")) PIPE4B = lValue; + else if (!Bstrcmp(szLabel,"PIPE5B")) PIPE5B = lValue; + else if (!Bstrcmp(szLabel,"PLUG")) PLUG = lValue; + else if (!Bstrcmp(szLabel,"PULLSWITCH")) PULLSWITCH = lValue; + else if (!Bstrcmp(szLabel,"PIPE6B")) PIPE6B = lValue; + else if (!Bstrcmp(szLabel,"PODFEM1")) PODFEM1 = lValue; + else if (!Bstrcmp(szLabel,"PLAYERONWATER")) PLAYERONWATER = lValue; + else if (!Bstrcmp(szLabel,"PIGCOP")) PIGCOP = lValue; + else if (!Bstrcmp(szLabel,"PIGCOPSTAYPUT")) PIGCOPSTAYPUT = lValue; + else if (!Bstrcmp(szLabel,"PIGCOPDIVE")) PIGCOPDIVE = lValue; + else if (!Bstrcmp(szLabel,"PIGCOPDEADSPRITE")) PIGCOPDEADSPRITE = lValue; + else if (!Bstrcmp(szLabel,"PIGTOP")) PIGTOP = lValue; + else if (!Bstrcmp(szLabel,"PLAYERISHERE")) PLAYERISHERE = lValue; + else if (!Bstrcmp(szLabel,"PLAYERWASHERE")) PLAYERWASHERE = lValue; + else if (!Bstrcmp(szLabel,"PLUTOPAKSPRITE")) PLUTOPAKSPRITE = lValue; + else if (!Bstrcmp(szLabel,"POOP")) POOP = lValue; + else if (!Bstrcmp(szLabel,"PANNEL3")) PANNEL3 = lValue; + else if (!Bstrcmp(szLabel,"PURPLELAVA")) PURPLELAVA = lValue; + else if (!Bstrcmp(szLabel,"POLICELIGHTPOLE")) POLICELIGHTPOLE = lValue; + else if (!Bstrcmp(szLabel,"PUKE")) PUKE = lValue; + else if (!Bstrcmp(szLabel,"PAPER")) PAPER = lValue; + else if (!Bstrcmp(szLabel,"PIRATE1A")) PIRATE1A = lValue; + else if (!Bstrcmp(szLabel,"PIRATE4A")) PIRATE4A = lValue; + else if (!Bstrcmp(szLabel,"PIRATE2A")) PIRATE2A = lValue; + else if (!Bstrcmp(szLabel,"PIRATE5A")) PIRATE5A = lValue; + else if (!Bstrcmp(szLabel,"PIRATE3A")) PIRATE3A = lValue; + else if (!Bstrcmp(szLabel,"PIRATE6A")) PIRATE6A = lValue; + else if (!Bstrcmp(szLabel,"PIRATEHALF")) PIRATEHALF = lValue; + else if (!Bstrcmp(szLabel,"PLEASEWAIT")) PLEASEWAIT = lValue; + break; + case 'Q': + if (!Bstrcmp(szLabel,"QUEBALL")) QUEBALL = lValue; + break; + case 'R': + if (!Bstrcmp(szLabel,"RESPAWN")) RESPAWN = lValue; + else if (!Bstrcmp(szLabel,"RPGSPRITE")) RPGSPRITE = lValue; + else if (!Bstrcmp(szLabel,"RPGAMMO")) RPGAMMO = lValue; + else if (!Bstrcmp(szLabel,"REDSKY1")) REDSKY1 = lValue; + else if (!Bstrcmp(szLabel,"REDSKY2")) REDSKY2 = lValue; + else if (!Bstrcmp(szLabel,"REFLECTWATERTILE")) REFLECTWATERTILE = lValue; + else if (!Bstrcmp(szLabel,"REACTOR2")) REACTOR2 = lValue; + else if (!Bstrcmp(szLabel,"REACTOR2BURNT")) REACTOR2BURNT = lValue; + else if (!Bstrcmp(szLabel,"REACTOR2SPARK")) REACTOR2SPARK = lValue; + else if (!Bstrcmp(szLabel,"RUBBERCAN")) RUBBERCAN = lValue; + else if (!Bstrcmp(szLabel,"REACTOR")) REACTOR = lValue; + else if (!Bstrcmp(szLabel,"REACTORSPARK")) REACTORSPARK = lValue; + else if (!Bstrcmp(szLabel,"REACTORBURNT")) REACTORBURNT = lValue; + else if (!Bstrcmp(szLabel,"RAT")) RAT = lValue; + else if (!Bstrcmp(szLabel,"RADIUSEXPLOSION")) RADIUSEXPLOSION = lValue; + else if (!Bstrcmp(szLabel,"RECON")) RECON = lValue; + else if (!Bstrcmp(szLabel,"ROTATEGUN")) ROTATEGUN = lValue; + else if (!Bstrcmp(szLabel,"RPGGUN")) RPGGUN = lValue; + else if (!Bstrcmp(szLabel,"RPGMUZZLEFLASH")) RPGMUZZLEFLASH = lValue; + else if (!Bstrcmp(szLabel,"RPG")) RPG = lValue; + else if (!Bstrcmp(szLabel,"RESPAWNMARKERRED")) RESPAWNMARKERRED = lValue; + else if (!Bstrcmp(szLabel,"RESPAWNMARKERYELLOW")) RESPAWNMARKERYELLOW = lValue; + else if (!Bstrcmp(szLabel,"RESPAWNMARKERGREEN")) RESPAWNMARKERGREEN = lValue; + else if (!Bstrcmp(szLabel,"ROBOTDOG")) ROBOTDOG = lValue; + else if (!Bstrcmp(szLabel,"ROBOTPIRATE")) ROBOTPIRATE = lValue; + else if (!Bstrcmp(szLabel,"ROBOTMOUSE")) ROBOTMOUSE = lValue; + else if (!Bstrcmp(szLabel,"ROBOTDOG2")) ROBOTDOG2 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT1")) RESERVEDSLOT1 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT2")) RESERVEDSLOT2 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT3")) RESERVEDSLOT3 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT4")) RESERVEDSLOT4 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT5")) RESERVEDSLOT5 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT6")) RESERVEDSLOT6 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT7")) RESERVEDSLOT7 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT8")) RESERVEDSLOT8 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT9")) RESERVEDSLOT9 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT10")) RESERVEDSLOT10 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT11")) RESERVEDSLOT11 = lValue; + else if (!Bstrcmp(szLabel,"RESERVEDSLOT12")) RESERVEDSLOT12 = lValue; + break; + case 'S': + if (!Bstrcmp(szLabel,"SECTOREFFECTOR")) SECTOREFFECTOR = lValue; + else if (!Bstrcmp(szLabel,"SHRINKERSPRITE")) SHRINKERSPRITE = lValue; + else if (!Bstrcmp(szLabel,"SHOTGUNSPRITE")) SHOTGUNSPRITE = lValue; + else if (!Bstrcmp(szLabel,"SHOTGUNAMMO")) SHOTGUNAMMO = lValue; + else if (!Bstrcmp(szLabel,"SIXPAK")) SIXPAK = lValue; + else if (!Bstrcmp(szLabel,"SHIELD")) SHIELD = lValue; + else if (!Bstrcmp(szLabel,"STEROIDS")) STEROIDS = lValue; + else if (!Bstrcmp(szLabel,"SLOTDOOR")) SLOTDOOR = lValue; + else if (!Bstrcmp(szLabel,"SPACEDOORSWITCH")) SPACEDOORSWITCH = lValue; + else if (!Bstrcmp(szLabel,"SPACELIGHTSWITCH")) SPACELIGHTSWITCH = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK1")) SCREENBREAK1 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK2")) SCREENBREAK2 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK3")) SCREENBREAK3 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK4")) SCREENBREAK4 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK5")) SCREENBREAK5 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK6")) SCREENBREAK6 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK7")) SCREENBREAK7 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK8")) SCREENBREAK8 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK9")) SCREENBREAK9 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK10")) SCREENBREAK10 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK11")) SCREENBREAK11 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK12")) SCREENBREAK12 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK13")) SCREENBREAK13 = lValue; + else if (!Bstrcmp(szLabel,"STATIC")) STATIC = lValue; + else if (!Bstrcmp(szLabel,"SATELLITE")) SATELLITE = lValue; + else if (!Bstrcmp(szLabel,"STAINGLASS1")) STAINGLASS1 = lValue; + else if (!Bstrcmp(szLabel,"SATELITE")) SATELITE = lValue; + else if (!Bstrcmp(szLabel,"SLIMEPIPE")) SLIMEPIPE = lValue; + else if (!Bstrcmp(szLabel,"STALL")) STALL = lValue; + else if (!Bstrcmp(szLabel,"STALLBROKE")) STALLBROKE = lValue; + else if (!Bstrcmp(szLabel,"SOLARPANNEL")) SOLARPANNEL = lValue; + else if (!Bstrcmp(szLabel,"SPLINTERWOOD")) SPLINTERWOOD = lValue; + else if (!Bstrcmp(szLabel,"SCALE")) SCALE = lValue; + else if (!Bstrcmp(szLabel,"STATUE")) STATUE = lValue; + else if (!Bstrcmp(szLabel,"SUSHIPLATE1")) SUSHIPLATE1 = lValue; + else if (!Bstrcmp(szLabel,"SUSHIPLATE2")) SUSHIPLATE2 = lValue; + else if (!Bstrcmp(szLabel,"SUSHIPLATE3")) SUSHIPLATE3 = lValue; + else if (!Bstrcmp(szLabel,"SUSHIPLATE4")) SUSHIPLATE4 = lValue; + else if (!Bstrcmp(szLabel,"SUSHIPLATE5")) SUSHIPLATE5 = lValue; + else if (!Bstrcmp(szLabel,"STATUEFLASH")) STATUEFLASH = lValue; + else if (!Bstrcmp(szLabel,"STRIPEBALL")) STRIPEBALL = lValue; + else if (!Bstrcmp(szLabel,"SPOTLITE")) SPOTLITE = lValue; + else if (!Bstrcmp(szLabel,"SEENINE")) SEENINE = lValue; + else if (!Bstrcmp(szLabel,"SEENINEDEAD")) SEENINEDEAD = lValue; + else if (!Bstrcmp(szLabel,"STEAM")) STEAM = lValue; + else if (!Bstrcmp(szLabel,"SPACEMARINE")) SPACEMARINE = lValue; + else if (!Bstrcmp(szLabel,"SCRATCH")) SCRATCH = lValue; + else if (!Bstrcmp(szLabel,"SHARK")) SHARK = lValue; + else if (!Bstrcmp(szLabel,"SPIT")) SPIT = lValue; + else if (!Bstrcmp(szLabel,"SHRINKSPARK")) SHRINKSPARK = lValue; + else if (!Bstrcmp(szLabel,"SHRINKEREXPLOSION")) SHRINKEREXPLOSION = lValue; + else if (!Bstrcmp(szLabel,"SMALLSMOKE")) SMALLSMOKE = lValue; + else if (!Bstrcmp(szLabel,"SMALLSMOKEMAKER")) SMALLSMOKEMAKER = lValue; + else if (!Bstrcmp(szLabel,"SCRAP6")) SCRAP6 = lValue; + else if (!Bstrcmp(szLabel,"SCRAP1")) SCRAP1 = lValue; + else if (!Bstrcmp(szLabel,"SCRAP2")) SCRAP2 = lValue; + else if (!Bstrcmp(szLabel,"SCRAP3")) SCRAP3 = lValue; + else if (!Bstrcmp(szLabel,"SCRAP4")) SCRAP4 = lValue; + else if (!Bstrcmp(szLabel,"SCRAP5")) SCRAP5 = lValue; + else if (!Bstrcmp(szLabel,"SELECTDIR")) SELECTDIR = lValue; + else if (!Bstrcmp(szLabel,"STEROIDS_ICON")) STEROIDS_ICON = lValue; + else if (!Bstrcmp(szLabel,"SLIDEBAR")) SLIDEBAR = lValue; + else if (!Bstrcmp(szLabel,"SHELL")) SHELL = lValue; + else if (!Bstrcmp(szLabel,"SHOTGUNSHELL")) SHOTGUNSHELL = lValue; + else if (!Bstrcmp(szLabel,"SHRINKER")) SHRINKER = lValue; + else if (!Bstrcmp(szLabel,"SCUBAMASK")) SCUBAMASK = lValue; + else if (!Bstrcmp(szLabel,"SPACEMASK")) SPACEMASK = lValue; + else if (!Bstrcmp(szLabel,"SHOTSPARK1")) SHOTSPARK1 = lValue; + else if (!Bstrcmp(szLabel,"SHOTGUN")) SHOTGUN = lValue; + else if (!Bstrcmp(szLabel,"SPINNINGNUKEICON")) SPINNINGNUKEICON = lValue; + else if (!Bstrcmp(szLabel,"SMALLFNTCURSOR")) SMALLFNTCURSOR = lValue; + else if (!Bstrcmp(szLabel,"STARTALPHANUM")) STARTALPHANUM = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK14")) SCREENBREAK14 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK15")) SCREENBREAK15 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK19")) SCREENBREAK19 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK16")) SCREENBREAK16 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK17")) SCREENBREAK17 = lValue; + else if (!Bstrcmp(szLabel,"SCREENBREAK18")) SCREENBREAK18 = lValue; + else if (!Bstrcmp(szLabel,"SPEAKER")) SPEAKER = lValue; + else if (!Bstrcmp(szLabel,"SIDEBOLT1")) SIDEBOLT1 = lValue; + else if (!Bstrcmp(szLabel,"SKINNEDCHICKEN")) SKINNEDCHICKEN = lValue; + else if (!Bstrcmp(szLabel,"SHOPPINGCART")) SHOPPINGCART = lValue; + else if (!Bstrcmp(szLabel,"SNAKEP")) SNAKEP = lValue; + else if (!Bstrcmp(szLabel,"SIGN1")) SIGN1 = lValue; + else if (!Bstrcmp(szLabel,"SIGN2")) SIGN2 = lValue; + break; + case 'T': + if (!Bstrcmp(szLabel,"TOUCHPLATE")) TOUCHPLATE = lValue; + else if (!Bstrcmp(szLabel,"TRIPBOMBSPRITE")) TRIPBOMBSPRITE = lValue; + else if (!Bstrcmp(szLabel,"TECHLIGHT2")) TECHLIGHT2 = lValue; + else if (!Bstrcmp(szLabel,"TECHLIGHTBUST2")) TECHLIGHTBUST2 = lValue; + else if (!Bstrcmp(szLabel,"TECHLIGHT4")) TECHLIGHT4 = lValue; + else if (!Bstrcmp(szLabel,"TECHLIGHTBUST4")) TECHLIGHTBUST4 = lValue; + else if (!Bstrcmp(szLabel,"TECHSWITCH")) TECHSWITCH = lValue; + else if (!Bstrcmp(szLabel,"TOILET")) TOILET = lValue; + else if (!Bstrcmp(szLabel,"TOILETBROKE")) TOILETBROKE = lValue; + else if (!Bstrcmp(szLabel,"TREE1")) TREE1 = lValue; + else if (!Bstrcmp(szLabel,"TREE2")) TREE2 = lValue; + else if (!Bstrcmp(szLabel,"TOILETWATER")) TOILETWATER = lValue; + else if (!Bstrcmp(szLabel,"TIRE")) TIRE = lValue; + else if (!Bstrcmp(szLabel,"TRANSPORTERBEAM")) TRANSPORTERBEAM = lValue; + else if (!Bstrcmp(szLabel,"TRASH")) TRASH = lValue; + else if (!Bstrcmp(szLabel,"TRANSPORTERSTAR")) TRANSPORTERSTAR = lValue; + else if (!Bstrcmp(szLabel,"TONGUE")) TONGUE = lValue; + else if (!Bstrcmp(szLabel,"TANK")) TANK = lValue; + else if (!Bstrcmp(szLabel,"TITLE")) TITLE = lValue; + else if (!Bstrcmp(szLabel,"TEXTBOX")) TEXTBOX = lValue; + else if (!Bstrcmp(szLabel,"THREEDEE")) THREEDEE = lValue; + else if (!Bstrcmp(szLabel,"TENSCREEN")) TENSCREEN = lValue; + else if (!Bstrcmp(szLabel,"TRIPBOMB")) TRIPBOMB = lValue; + else if (!Bstrcmp(szLabel,"TIP")) TIP = lValue; + else if (!Bstrcmp(szLabel,"THREEBYFIVE")) THREEBYFIVE = lValue; + else if (!Bstrcmp(szLabel,"TEXTSTORY")) TEXTSTORY = lValue; + else if (!Bstrcmp(szLabel,"TARGET")) TARGET = lValue; + else if (!Bstrcmp(szLabel,"TOPSECRET")) TOPSECRET = lValue; + else if (!Bstrcmp(szLabel,"TEDDYBEAR")) TEDDYBEAR = lValue; + else if (!Bstrcmp(szLabel,"TRIPODCAMERA")) TRIPODCAMERA = lValue; + else if (!Bstrcmp(szLabel,"TAMPON")) TAMPON = lValue; + else if (!Bstrcmp(szLabel,"TOUGHGAL")) TOUGHGAL = lValue; + break; + case 'U': + if (!Bstrcmp(szLabel,"USERWEAPON")) USERWEAPON = lValue; + break; + case 'V': + if (!Bstrcmp(szLabel,"VIEWSCREEN2")) VIEWSCREEN2 = lValue; + else if (!Bstrcmp(szLabel,"VIEWSCREENBROKE")) VIEWSCREENBROKE = lValue; + else if (!Bstrcmp(szLabel,"VIEWSCREEN")) VIEWSCREEN = lValue; + else if (!Bstrcmp(szLabel,"VACUUM")) VACUUM = lValue; + else if (!Bstrcmp(szLabel,"VASE")) VASE = lValue; + else if (!Bstrcmp(szLabel,"VENDMACHINE")) VENDMACHINE = lValue; + else if (!Bstrcmp(szLabel,"VENDMACHINEBROKE")) VENDMACHINEBROKE = lValue; + else if (!Bstrcmp(szLabel,"VIEWBORDER")) VIEWBORDER = lValue; + else if (!Bstrcmp(szLabel,"VICTORY1")) VICTORY1 = lValue; + break; + case 'W': + if (!Bstrcmp(szLabel,"WALLLIGHT4")) WALLLIGHT4 = lValue; + else if (!Bstrcmp(szLabel,"WALLLIGHTBUST4")) WALLLIGHTBUST4 = lValue; + else if (!Bstrcmp(szLabel,"W_LIGHT")) W_LIGHT = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL1")) W_TECHWALL1 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL2")) W_TECHWALL2 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL15")) W_TECHWALL15 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL3")) W_TECHWALL3 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL4")) W_TECHWALL4 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL10")) W_TECHWALL10 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL16")) W_TECHWALL16 = lValue; + else if (!Bstrcmp(szLabel,"WATERTILE2")) WATERTILE2 = lValue; + else if (!Bstrcmp(szLabel,"WATERTILE")) WATERTILE = lValue; + else if (!Bstrcmp(szLabel,"W_SCREENBREAK")) W_SCREENBREAK = lValue; + else if (!Bstrcmp(szLabel,"W_HITTECHWALL3")) W_HITTECHWALL3 = lValue; + else if (!Bstrcmp(szLabel,"W_HITTECHWALL4")) W_HITTECHWALL4 = lValue; + else if (!Bstrcmp(szLabel,"W_HITTECHWALL2")) W_HITTECHWALL2 = lValue; + else if (!Bstrcmp(szLabel,"W_HITTECHWALL1")) W_HITTECHWALL1 = lValue; + else if (!Bstrcmp(szLabel,"WATERFOUNTAIN")) WATERFOUNTAIN = lValue; + else if (!Bstrcmp(szLabel,"WATERFOUNTAINBROKE")) WATERFOUNTAINBROKE = lValue; + else if (!Bstrcmp(szLabel,"W_NUMBERS")) W_NUMBERS = lValue; + else if (!Bstrcmp(szLabel,"WATERDRIP")) WATERDRIP = lValue; + else if (!Bstrcmp(szLabel,"WATERBUBBLE")) WATERBUBBLE = lValue; + else if (!Bstrcmp(szLabel,"WATERBUBBLEMAKER")) WATERBUBBLEMAKER = lValue; + else if (!Bstrcmp(szLabel,"W_FORCEFIELD")) W_FORCEFIELD = lValue; + else if (!Bstrcmp(szLabel,"WALLLIGHT3")) WALLLIGHT3 = lValue; + else if (!Bstrcmp(szLabel,"WALLLIGHTBUST3")) WALLLIGHTBUST3 = lValue; + else if (!Bstrcmp(szLabel,"WALLLIGHT1")) WALLLIGHT1 = lValue; + else if (!Bstrcmp(szLabel,"WALLLIGHTBUST1")) WALLLIGHTBUST1 = lValue; + else if (!Bstrcmp(szLabel,"WALLLIGHT2")) WALLLIGHT2 = lValue; + else if (!Bstrcmp(szLabel,"WALLLIGHTBUST2")) WALLLIGHTBUST2 = lValue; + else if (!Bstrcmp(szLabel,"WAITTOBESEATED")) WAITTOBESEATED = lValue; + else if (!Bstrcmp(szLabel,"WOODENHORSE")) WOODENHORSE = lValue; + else if (!Bstrcmp(szLabel,"WATERSPLASH2")) WATERSPLASH2 = lValue; + else if (!Bstrcmp(szLabel,"WALLBLOOD1")) WALLBLOOD1 = lValue; + else if (!Bstrcmp(szLabel,"WALLBLOOD2")) WALLBLOOD2 = lValue; + else if (!Bstrcmp(szLabel,"WALLBLOOD3")) WALLBLOOD3 = lValue; + else if (!Bstrcmp(szLabel,"WALLBLOOD4")) WALLBLOOD4 = lValue; + else if (!Bstrcmp(szLabel,"WALLBLOOD5")) WALLBLOOD5 = lValue; + else if (!Bstrcmp(szLabel,"WALLBLOOD6")) WALLBLOOD6 = lValue; + else if (!Bstrcmp(szLabel,"WALLBLOOD7")) WALLBLOOD7 = lValue; + else if (!Bstrcmp(szLabel,"WALLBLOOD8")) WALLBLOOD8 = lValue; + else if (!Bstrcmp(szLabel,"WATERDRIPSPLASH")) WATERDRIPSPLASH = lValue; + else if (!Bstrcmp(szLabel,"WINDOWBORDER1")) WINDOWBORDER1 = lValue; + else if (!Bstrcmp(szLabel,"WINDOWBORDER2")) WINDOWBORDER2 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL11")) W_TECHWALL11 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL12")) W_TECHWALL12 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL13")) W_TECHWALL13 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL14")) W_TECHWALL14 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL5")) W_TECHWALL5 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL6")) W_TECHWALL6 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL7")) W_TECHWALL7 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL8")) W_TECHWALL8 = lValue; + else if (!Bstrcmp(szLabel,"W_TECHWALL9")) W_TECHWALL9 = lValue; + else if (!Bstrcmp(szLabel,"W_HITTECHWALL16")) W_HITTECHWALL16 = lValue; + else if (!Bstrcmp(szLabel,"W_HITTECHWALL10")) W_HITTECHWALL10 = lValue; + else if (!Bstrcmp(szLabel,"W_HITTECHWALL15")) W_HITTECHWALL15 = lValue; + else if (!Bstrcmp(szLabel,"W_MILKSHELF")) W_MILKSHELF = lValue; + else if (!Bstrcmp(szLabel,"W_MILKSHELFBROKE")) W_MILKSHELFBROKE = lValue; + else if (!Bstrcmp(szLabel,"WETFLOOR")) WETFLOOR = lValue; + else if (!Bstrcmp(szLabel,"WOMAN")) WOMAN = lValue; + else if (!Bstrcmp(szLabel,"WEATHERWARN")) WEATHERWARN = lValue; + break; + case 'X': + if (!Bstrcmp(szLabel,"XXXSTACY")) XXXSTACY = lValue; + break; } } diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 6269552ef..9019de4bf 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -36,7 +36,8 @@ int osdcmd_quit(const osdfuncparm_t *parm) int osdcmd_echo(const osdfuncparm_t *parm) { int i; - for (i = 0; i < parm->numparms; i++) { + for (i = 0; i < parm->numparms; i++) + { if (i > 0) OSD_Printf(" "); OSD_Printf("%s", parm->parms[i]); } @@ -50,14 +51,17 @@ int osdcmd_changelevel(const osdfuncparm_t *parm) int volume=0,level; char *p; - if (!VOLUMEONE) { + if (!VOLUMEONE) + { if (parm->numparms != 2) return OSDCMD_SHOWHELP; volume = strtol(parm->parms[0], &p, 10) - 1; if (p[0]) return OSDCMD_SHOWHELP; level = strtol(parm->parms[1], &p, 10) - 1; if (p[0]) return OSDCMD_SHOWHELP; - } else { + } + else + { if (parm->numparms != 1) return OSDCMD_SHOWHELP; level = strtol(parm->parms[0], &p, 10) - 1; @@ -67,31 +71,41 @@ int osdcmd_changelevel(const osdfuncparm_t *parm) if (volume < 0) return OSDCMD_SHOWHELP; if (level < 0) return OSDCMD_SHOWHELP; - if (!VOLUMEONE) { - if (volume > num_volumes) { + if (!VOLUMEONE) + { + if (volume > num_volumes) + { OSD_Printf("changelevel: invalid volume number (range 1-%ld)\n",num_volumes); return OSDCMD_OK; } } - if (volume == 0) { - if (level > 6) { + if (volume == 0) + { + if (level > 6) + { OSD_Printf("changelevel: invalid volume 1 level number (range 1-7)\n"); return OSDCMD_OK; } - } else { - if (level > 10) { + } + else + { + if (level > 10) + { OSD_Printf("changelevel: invalid volume 2+ level number (range 1-11)\n"); return OSDCMD_SHOWHELP; } } - if (ps[myconnectindex].gm & MODE_GAME) { + if (ps[myconnectindex].gm & MODE_GAME) + { // in-game behave like a cheat osdcmd_cheatsinfo_stat.cheatnum = 2; osdcmd_cheatsinfo_stat.volume = volume; osdcmd_cheatsinfo_stat.level = level; - } else { + } + else + { // out-of-game behave like a menu command osdcmd_cheatsinfo_stat.cheatnum = -1; @@ -123,7 +137,8 @@ int osdcmd_map(const osdfuncparm_t *parm) if (strchr(filename,'.') == 0) strcat(filename,".map"); - if ((i = kopen4load(filename,0)) < 0) { + if ((i = kopen4load(filename,0)) < 0) + { OSD_Printf("map: file \"%s\" not found.\n", filename); return OSDCMD_OK; } @@ -131,12 +146,15 @@ int osdcmd_map(const osdfuncparm_t *parm) strcpy(boardfilename, filename); - if (ps[myconnectindex].gm & MODE_GAME) { + if (ps[myconnectindex].gm & MODE_GAME) + { // in-game behave like a cheat osdcmd_cheatsinfo_stat.cheatnum = 2; osdcmd_cheatsinfo_stat.volume = 0; osdcmd_cheatsinfo_stat.level = 7; - } else { + } + else + { // out-of-game behave like a menu command osdcmd_cheatsinfo_stat.cheatnum = -1; @@ -159,9 +177,12 @@ int osdcmd_map(const osdfuncparm_t *parm) int osdcmd_god(const osdfuncparm_t *parm) { - if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) { + if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) + { osdcmd_cheatsinfo_stat.cheatnum = 0; - } else { + } + else + { OSD_Printf("god: Not in a single-player game.\n"); } @@ -170,9 +191,12 @@ int osdcmd_god(const osdfuncparm_t *parm) int osdcmd_noclip(const osdfuncparm_t *parm) { - if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) { + if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) + { osdcmd_cheatsinfo_stat.cheatnum = 20; - } else { + } + else + { OSD_Printf("noclip: Not in a single-player game.\n"); } @@ -187,7 +211,8 @@ int osdcmd_fileinfo(const osdfuncparm_t *parm) if (parm->numparms != 1) return OSDCMD_SHOWHELP; - if ((i = kopen4load((char *)parm->parms[0],0)) < 0) { + if ((i = kopen4load((char *)parm->parms[0],0)) < 0) + { OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]); return OSDCMD_OK; } @@ -195,10 +220,12 @@ int osdcmd_fileinfo(const osdfuncparm_t *parm) length = kfilelength(i); crc32init(&crc); - do { + do + { j = kread(i,buf,256); crc32block(&crc,buf,j); - } while (j == 256); + } + while (j == 256); crc32finish(&crc); kclose(i); @@ -228,30 +255,34 @@ static int osdcmd_vidmode(const osdfuncparm_t *parm) newheight = ScreenHeight, newfs = ScreenMode; if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP; - switch (parm->numparms) { - case 1: // bpp switch - newbpp = Batol(parm->parms[0]); - break; - case 2: // res switch - newwidth = Batol(parm->parms[0]); - newheight = Batol(parm->parms[1]); - break; - case 3: // res & bpp switch - case 4: - newwidth = Batol(parm->parms[0]); - newheight = Batol(parm->parms[1]); - newbpp = Batol(parm->parms[2]); - if (parm->numparms == 4) - newfs = (Batol(parm->parms[3]) != 0); - break; + switch (parm->numparms) + { + case 1: // bpp switch + newbpp = Batol(parm->parms[0]); + break; + case 2: // res switch + newwidth = Batol(parm->parms[0]); + newheight = Batol(parm->parms[1]); + break; + case 3: // res & bpp switch + case 4: + newwidth = Batol(parm->parms[0]); + newheight = Batol(parm->parms[1]); + newbpp = Batol(parm->parms[2]); + if (parm->numparms == 4) + newfs = (Batol(parm->parms[3]) != 0); + break; } - if (setgamemode(newfs,newwidth,newheight,newbpp)) { + if (setgamemode(newfs,newwidth,newheight,newbpp)) + { initprintf("vidmode: Mode change failed!\n"); if (setgamemode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP)) gameexit("vidmode: Reset failed!\n"); } - ScreenBPP = newbpp; ScreenWidth = newwidth; ScreenHeight = newheight; + ScreenBPP = newbpp; + ScreenWidth = newwidth; + ScreenHeight = newheight; ScreenMode = newfs; onvideomodechange(ScreenBPP>8); vscrn(); @@ -260,10 +291,12 @@ static int osdcmd_vidmode(const osdfuncparm_t *parm) static int osdcmd_setstatusbarscale(const osdfuncparm_t *parm) { - if (parm->numparms == 0) { + if (parm->numparms == 0) + { OSD_Printf("\"cl_statusbarscale\" is \"%d\"\n", ud.statusbarscale); return OSDCMD_SHOWHELP; - } else if (parm->numparms != 1) return OSDCMD_SHOWHELP; + } + else if (parm->numparms != 1) return OSDCMD_SHOWHELP; setstatusbarscale(Batol(parm->parms[0])); OSD_Printf("cl_statusbarscale %d\n", ud.statusbarscale); @@ -272,10 +305,12 @@ static int osdcmd_setstatusbarscale(const osdfuncparm_t *parm) static int osdcmd_setstatusbarmode(const osdfuncparm_t *parm) { - if (parm->numparms == 0) { + if (parm->numparms == 0) + { OSD_Printf("\"cl_statusbarmode\" is \"%d\"\n", ud.statusbarmode); return OSDCMD_SHOWHELP; - } else if (parm->numparms != 1) return OSDCMD_SHOWHELP; + } + else if (parm->numparms != 1) return OSDCMD_SHOWHELP; ud.statusbarmode = Batol(parm->parms[0]); vscrn(); @@ -291,61 +326,76 @@ static int osdcmd_spawn(const osdfuncparm_t *parm) short ang=0; short set=0, idx; - if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) { + if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) + { OSD_Printf("spawn: Can't spawn sprites in multiplayer games or demos\n"); return OSDCMD_OK; } - switch (parm->numparms) { - case 7: // x,y,z - x = Batol(parm->parms[4]); - y = Batol(parm->parms[5]); - z = Batol(parm->parms[6]); - set |= 8; - case 4: // ang - ang = Batol(parm->parms[3]) & 2047; set |= 4; - case 3: // cstat - cstat = (unsigned short)Batol(parm->parms[2]); set |= 2; - case 2: // pal - pal = (unsigned char)Batol(parm->parms[1]); set |= 1; - case 1: // tile number - if (isdigit(parm->parms[0][0])) { - picnum = (unsigned short)Batol(parm->parms[0]); - } else { - int i,j; - for (j=0; j<2; j++) { - for (i=0; iparms[0])) || - (j == 1 && !Bstrcasecmp(label+(i<<6), parm->parms[0])) - ) { - picnum = (unsigned short)labelcode[i]; - break; - } - } - if (inumparms) + { + case 7: // x,y,z + x = Batol(parm->parms[4]); + y = Batol(parm->parms[5]); + z = Batol(parm->parms[6]); + set |= 8; + case 4: // ang + ang = Batol(parm->parms[3]) & 2047; + set |= 4; + case 3: // cstat + cstat = (unsigned short)Batol(parm->parms[2]); + set |= 2; + case 2: // pal + pal = (unsigned char)Batol(parm->parms[1]); + set |= 1; + case 1: // tile number + if (isdigit(parm->parms[0][0])) + { + picnum = (unsigned short)Batol(parm->parms[0]); } - if (i==labelcnt) { - OSD_Printf("spawn: Invalid tile label given\n"); + else + { + int i,j; + for (j=0; j<2; j++) + { + for (i=0; iparms[0])) || + (j == 1 && !Bstrcasecmp(label+(i<<6), parm->parms[0])) + ) + { + picnum = (unsigned short)labelcode[i]; + break; + } + } + if (i= MAXTILES) + { + OSD_Printf("spawn: Invalid tile number\n"); return OSDCMD_OK; } - } - - if (picnum >= MAXTILES) { - OSD_Printf("spawn: Invalid tile number\n"); - return OSDCMD_OK; - } - break; - default: - return OSDCMD_SHOWHELP; + break; + default: + return OSDCMD_SHOWHELP; } idx = spawn(ps[myconnectindex].i, (short)picnum); if (set & 1) sprite[idx].pal = (char)pal; if (set & 2) sprite[idx].cstat = (short)cstat; if (set & 4) sprite[idx].ang = ang; - if (set & 8) { - if (setsprite(idx, x,y,z) < 0) { + if (set & 8) + { + if (setsprite(idx, x,y,z) < 0) + { OSD_Printf("spawn: Sprite can't be spawned into null space\n"); deletesprite(idx); } @@ -402,10 +452,13 @@ int osdcmd_initgroupfile(const osdfuncparm_t *parm) int osdcmd_cmenu(const osdfuncparm_t *parm) { if (parm->numparms != 1) return OSDCMD_SHOWHELP; - if (numplayers > 1) { + if (numplayers > 1) + { OSD_Printf("cmenu: disallowed in multiplayer\n"); return OSDCMD_OK; - } else { + } + else + { cmenu(Batol(parm->parms[0])); } @@ -420,7 +473,8 @@ int osdcmd_exec(const osdfuncparm_t *parm) if (parm->numparms != 1) return OSDCMD_SHOWHELP; Bstrcpy(fn,parm->parms[0]); - if (load_script(fn)) { + if (load_script(fn)) + { OSD_Printf("exec: file \"%s\" not found.\n", fn); return OSDCMD_OK; } @@ -434,7 +488,8 @@ enum cvartypes { CVAR_STRING }; -struct cvarmappings { +struct cvarmappings +{ char *name; char *helpstr; void *var; @@ -442,7 +497,8 @@ struct cvarmappings { int extra; // for string, is the length int min; int max; -} cvar[] = +} +cvar[] = { { "crosshair", "crosshair: enable/disable crosshair", (void*)&ud.crosshair, CVAR_INT, 0, 0, 3 }, @@ -466,8 +522,7 @@ struct cvarmappings { { "cl_weaponswitch", "cl_weaponswitch: enable/disable auto weapon switching", (void*)&ud.weaponswitch, CVAR_INT|256, 0, 0, 3 }, #if defined(POLYMOST) && defined(USE_OPENGL) - { "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void*)&glwidescreen, CVAR_BOOL, 0, 0, 1 } - , + { "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void*)&glwidescreen, CVAR_BOOL, 0, 0, 1 }, { "r_projectionhack", "r_projectionhack: enable/disable projection hack", (void*)&glprojectionhacks, CVAR_BOOL, 0, 0, 1 }, // polymer cvars { "pr_cliplanes", "pr_cliplanes: toggles clipping behind map limits (recommended yet may decrease performance in complex maps)", (void*)&pr_cliplanes, CVAR_INT, 0, 0, 1 }, @@ -484,48 +539,59 @@ int osdcmd_cvar_set(const osdfuncparm_t *parm) int showval = (parm->numparms == 0); unsigned int i; - for (i = 0; i < sizeof(cvar)/sizeof(struct cvarmappings); i++) { - if (!Bstrcasecmp(parm->name, cvar[i].name)) { - if ((cvar[i].type & 0x80) && ud.multimode != 1) { + for (i = 0; i < sizeof(cvar)/sizeof(struct cvarmappings); i++) + { + if (!Bstrcasecmp(parm->name, cvar[i].name)) + { + if ((cvar[i].type & 0x80) && ud.multimode != 1) + { // sound the alarm OSD_Printf("Cvar \"%s\" locked in multiplayer.\n",cvar[i].name); return OSDCMD_OK; - } else - switch (cvar[i].type&0x7f) { - case CVAR_INT: - case CVAR_UNSIGNEDINT: - case CVAR_BOOL: + } + else + switch (cvar[i].type&0x7f) { - int val; - if (showval) { - OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvar[i].name,*(int*)cvar[i].var,(char*)cvar[i].helpstr); - return OSDCMD_OK; - } + case CVAR_INT: + case CVAR_UNSIGNEDINT: + case CVAR_BOOL: + { + int val; + if (showval) + { + OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvar[i].name,*(int*)cvar[i].var,(char*)cvar[i].helpstr); + return OSDCMD_OK; + } - val = atoi(parm->parms[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; + 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); } - *(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; + 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 (cvar[i].type&256) updatenames(); @@ -537,7 +603,8 @@ int osdcmd_cvar_set(const osdfuncparm_t *parm) int osdcmd_sensitivity(const osdfuncparm_t *parm) { - if (parm->numparms != 1) { + if (parm->numparms != 1) + { OSD_Printf("\"sensitivity\" is \"%d\"\n",CONTROL_GetMouseSensitivity()); return OSDCMD_SHOWHELP; } @@ -548,7 +615,8 @@ int osdcmd_sensitivity(const osdfuncparm_t *parm) int osdcmd_gamma(const osdfuncparm_t *parm) { - if (parm->numparms != 1) { + if (parm->numparms != 1) + { OSD_Printf("\"gamma\" \"%d\"\n",ud.brightness>>2); return OSDCMD_SHOWHELP; } @@ -562,44 +630,57 @@ int osdcmd_give(const osdfuncparm_t *parm) { int i; - if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) { - if (ps[myconnectindex].dead_flag != 0) { + if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) + { + if (ps[myconnectindex].dead_flag != 0) + { OSD_Printf("give: Cannot give while dead.\n"); return OSDCMD_OK; } + if (parm->numparms != 1) return OSDCMD_SHOWHELP; - if (!Bstrcasecmp(parm->parms[0], "all")) { + + if (!Bstrcasecmp(parm->parms[0], "all")) + { osdcmd_cheatsinfo_stat.cheatnum = 1; return OSDCMD_OK; } - else if (!Bstrcasecmp(parm->parms[0], "health")) { + else if (!Bstrcasecmp(parm->parms[0], "health")) + { sprite[ps[myconnectindex].i].extra = 200; return OSDCMD_OK; } - else if (!Bstrcasecmp(parm->parms[0], "weapons")) { + else if (!Bstrcasecmp(parm->parms[0], "weapons")) + { osdcmd_cheatsinfo_stat.cheatnum = 21; return OSDCMD_OK; } - else if (!Bstrcasecmp(parm->parms[0], "ammo")) { + else if (!Bstrcasecmp(parm->parms[0], "ammo")) + { for (i=PISTOL_WEAPON;iparms[0], "armor")) { + else if (!Bstrcasecmp(parm->parms[0], "armor")) + { ps[myconnectindex].shield_amount = 100; return OSDCMD_OK; } - else if (!Bstrcasecmp(parm->parms[0], "keys")) { + else if (!Bstrcasecmp(parm->parms[0], "keys")) + { osdcmd_cheatsinfo_stat.cheatnum = 23; return OSDCMD_OK; } - else if (!Bstrcasecmp(parm->parms[0], "inventory")) { + else if (!Bstrcasecmp(parm->parms[0], "inventory")) + { osdcmd_cheatsinfo_stat.cheatnum = 22; return OSDCMD_OK; } - } else { + } + else + { OSD_Printf("give: Not in a single-player game.\n"); return OSDCMD_OK; } @@ -610,14 +691,17 @@ void onvideomodechange(int newmode) { char *pal; - if (newmode) { + if (newmode) + { if (ps[screenpeek].palette == palette || ps[screenpeek].palette == waterpal || ps[screenpeek].palette == slimepal) pal = palette; else pal = ps[screenpeek].palette; - } else { + } + else + { pal = ps[screenpeek].palette; } @@ -628,17 +712,27 @@ void onvideomodechange(int newmode) int osdcmd_usemousejoy(const osdfuncparm_t *parm) { int showval = (parm->numparms < 1); - if (!Bstrcasecmp(parm->name, "usemouse")) { - if (showval) { OSD_Printf("usemouse is %d\n", UseMouse); } - else { + if (!Bstrcasecmp(parm->name, "usemouse")) + { + if (showval) + { + OSD_Printf("usemouse is %d\n", UseMouse); + } + else + { UseMouse = (atoi(parm->parms[0]) != 0); CONTROL_MouseEnabled = (UseMouse && CONTROL_MousePresent); } return OSDCMD_OK; } - else if (!Bstrcasecmp(parm->name, "usejoystick")) { - if (showval) { OSD_Printf("usejoystick is %d\n", UseJoystick); } - else { + else if (!Bstrcasecmp(parm->name, "usejoystick")) + { + if (showval) + { + OSD_Printf("usejoystick is %d\n", UseJoystick); + } + else + { UseJoystick = (atoi(parm->parms[0]) != 0); CONTROL_JoystickEnabled = (UseJoystick && CONTROL_JoyPresent); } @@ -658,7 +752,8 @@ int osdcmd_mpmap(const osdfuncparm_t *parm) if (strchr(filename,'.') == 0) strcat(filename,".map"); - if ((i = kopen4load(filename,0)) < 0) { + if ((i = kopen4load(filename,0)) < 0) + { OSD_Printf("map: file \"%s\" not found.\n", filename); return OSDCMD_OK; } @@ -700,13 +795,17 @@ int registerosdcommands(void) osdcmd_cheatsinfo_stat.cheatnum = -1; - for (i=0; i: warps to the given level", osdcmd_changelevel); - } else { + } + else + { OSD_RegisterFunction("changelevel","changelevel : warps to the given level", osdcmd_changelevel); OSD_RegisterFunction("map","map : loads the given user map", osdcmd_map); OSD_RegisterFunction("mpmap","mpmap : sets user map name in multiplayer", osdcmd_mpmap); diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index d5875feda..0282ca1c0 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -17,8 +17,13 @@ void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal) { short ac; - for (x = (x<<3)+x; len>0; len--, ch++, x++) { - if (*ch == 32) { x+=5; continue; } + for (x = (x<<3)+x; len>0; len--, ch++, x++) + { + if (*ch == 32) + { + x+=5; + continue; + } ac = *ch-'!'+STARTALPHANUM; if (ac < STARTALPHANUM || ac > ENDALPHANUM) return; @@ -70,18 +75,22 @@ void GAME_clearbackground(int c, int r) long x, y, xsiz, ysiz, tx2, ty2; long daydim, bits; - if (getrendermode() < 3) bits = BITS; else bits = BITSTL; + if (getrendermode() < 3) bits = BITS; + else bits = BITSTL; daydim = r<<3; - xsiz = tilesizx[BGTILE]; tx2 = xdim/xsiz; - ysiz = tilesizy[BGTILE]; ty2 = daydim/ysiz; + xsiz = tilesizx[BGTILE]; + tx2 = xdim/xsiz; + ysiz = tilesizy[BGTILE]; + ty2 = daydim/ysiz; 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; + xsiz = tilesizy[BORDTILE]; + tx2 = xdim/xsiz; ysiz = tilesizx[BORDTILE]; for (x=0;x<=tx2;x++) diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 38d599100..facf1e6b0 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -40,9 +40,12 @@ int32 lastcontroltime; //MED void setpal(struct player_struct *p) { if (p->heat_on) p->palette = slimepal; - else if ((sector[p->cursectnum].ceilingpicnum >= FLOORSLIME)&&(sector[p->cursectnum].ceilingpicnum <=FLOORSLIME+2)) { + else if ((sector[p->cursectnum].ceilingpicnum >= FLOORSLIME)&&(sector[p->cursectnum].ceilingpicnum <=FLOORSLIME+2)) + { p->palette = slimepal; - } else { + } + else + { if (sector[p->cursectnum].lotag == 2) p->palette = waterpal; else p->palette = palette; @@ -262,25 +265,27 @@ 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 (s->picnum == APLAYER) + { if (!ps[s->yvel].auto_aim) return -1; if (ps[s->yvel].auto_aim == 2) { if (checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE) && (projectile[atwith].workslike & PROJECTILE_FLAG_RPG)) return -1; - else switch (dynamictostatic[atwith]) { - case TONGUE__STATIC: - case FREEZEBLAST__STATIC: - case SHRINKSPARK__STATIC: - case SHRINKER__STATIC: - case RPG__STATIC: - case FIRELASER__STATIC: - case SPIT__STATIC: - case COOLEXPLOSION1__STATIC: - return -1; - default: - break; + else switch (dynamictostatic[atwith]) + { + case TONGUE__STATIC: + case FREEZEBLAST__STATIC: + case SHRINKSPARK__STATIC: + case SHRINKER__STATIC: + case RPG__STATIC: + case FIRELASER__STATIC: + case SPIT__STATIC: + case COOLEXPLOSION1__STATIC: + return -1; + default: + break; } } } @@ -321,12 +326,15 @@ short aim(spritetype *s,short aang,short atwith) if (gotshrinker && sprite[i].xrepeat < 30) { - if (PN == SHARK) { + if (PN == SHARK) + { if (sprite[i].xrepeat < 20) continue; continue; - } else if ((PN >= GREENSLIME)&&(PN <= GREENSLIME+7)) { } - else { + else if ((PN >= GREENSLIME)&&(PN <= GREENSLIME+7)) + {} + else + { continue; } } @@ -751,7 +759,8 @@ short shoot(short i,short atwith) sprite[l].xrepeat = sprite[l].yrepeat = 24; sprite[l].ang += 64-(TRAND&127); } - else { + else + { if (projectile[atwith].spawns >= 0) { wh=spawn(k,projectile[atwith].spawns); @@ -1018,450 +1027,461 @@ DOSKIPBULLETHOLE: { switch (dynamictostatic[atwith]) { - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: + case BLOODSPLAT1__STATIC: + case BLOODSPLAT2__STATIC: + case BLOODSPLAT3__STATIC: + case BLOODSPLAT4__STATIC: - if (p >= 0) - sa += 64 - (TRAND&127); - else sa += 1024 + 64 - (TRAND&127); - zvel = 1024-(TRAND&2047); - case KNEE__STATIC: - if (atwith == KNEE) - { if (p >= 0) + sa += 64 - (TRAND&127); + else sa += 1024 + 64 - (TRAND&127); + zvel = 1024-(TRAND&2047); + case KNEE__STATIC: + if (atwith == KNEE) { - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; - sz += (6<<8); - sa += 15; - } - else - { - j = ps[findplayer(s,&x)].i; - zvel = ((sprite[j].z-sz)<<8) / (x+1); - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); - } - } - - // writestring(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047],zvel<<6); - if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; - hitscan(sx,sy,sz,sect, - sintable[(sa+512)&2047], - sintable[sa&2047],zvel<<6, - &hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); - - 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 && - 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].nextsector >= 0) - { - k = headspritesect[wall[hitwall].nextsector]; - while (k >= 0) - { - if (sprite[k].statnum == 3 && sprite[k].lotag == 13) - return -1; - k = nextspritesect[k]; - } - } - - if (wall[hitwall].nextwall >= 0 && - wall[wall[hitwall].nextwall].hitag != 0) - return -1; - - if (wall[hitwall].hitag == 0) - { - k = spawn(i,atwith); - sprite[k].xvel = -12; - sprite[k].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x, - wall[hitwall].y-wall[wall[hitwall].point2].y)+512; - sprite[k].x = hitx; - sprite[k].y = hity; - sprite[k].z = hitz; - sprite[k].cstat |= (TRAND&4); - ssp(k,CLIPMASK0); - setsprite(k,sprite[k].x,sprite[k].y,sprite[k].z); - if (PN == OOZFILTER || PN == NEWBEAST) - sprite[k].pal = 6; - } - } - return -1; - } - - if (hitsect < 0) break; - - if ((klabs(sx-hitx)+klabs(sy-hity)) < 1024) - { - 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) { - k = spawn(j,SMALLSMOKE); - sprite[k].z -= (8<<8); - spritesound(KICK_HIT,j); - hittype[k].temp_data[6] = hitwall; - hittype[k].temp_data[7] = hitsect; - hittype[k].temp_data[8] = hitspr; - } - - 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) - { - checkhitsprite(hitspr,j); - if (p >= 0) checkhitswitch(p,hitspr,1); - } - - else if (hitwall >= 0) - { - 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) - { - checkhitwall(j,hitwall,hitx,hity,hitz,atwith); - if (p >= 0) checkhitswitch(p,hitwall,0); - } - } - } - else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) - { - j = spawn(ps[p].i,WATERSPLASH2); - sprite[j].x = hitx; - sprite[j].y = hity; - sprite[j].ang = ps[p].ang; // Total tweek - sprite[j].xvel = 32; - ssp(i,CLIPMASK0); - sprite[j].xvel = 0; - - } - } - - break; - - case SHOTSPARK1__STATIC: - case SHOTGUN__STATIC: - case CHAINGUN__STATIC: - - if (s->extra >= 0) s->shade = -96; - - if (p >= 0) - { - int angRange; - int zRange; - - SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); - OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); - j=-1; - if (GetGameVarID(g_iAimAngleVarID,i,p) > 0) - { - j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); - } - 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)) { - - dal -= (8<<8); - - } - zvel = ((sprite[j].z-sz-dal)<<8) / ldist(&sprite[ps[p].i], &sprite[j]) ; - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); - } - - angRange=32; - zRange=256; - SetGameVarID(g_iAngRangeVarID,32, i,p); - SetGameVarID(g_iZRangeVarID,256,i,p); - OnEvent(EVENT_GETSHOTRANGE, i,p, -1); - angRange=GetGameVarID(g_iAngRangeVarID,i,p); - zRange=GetGameVarID(g_iZRangeVarID,i,p); - - sa += (angRange/2)-(TRAND&(angRange-1)); - if (j == -1) - { - // no target - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; - } - zvel += (zRange/2)-(TRAND&(zRange-1)); - sz -= (2<<8); - } - else - { - j = findplayer(s,&x); - sz -= (4<<8); - zvel = ((ps[j].posz-sz) <<8) / (ldist(&sprite[ps[j].i], s)); - if (s->picnum != BOSS1) - { - zvel += 128-(TRAND&255); - sa += 32-(TRAND&63); - } - else - { - zvel += 128-(TRAND&255); - sa = getangle(ps[j].posx-sx,ps[j].posy-sy)+64-(TRAND&127); - } - } - - s->cstat &= ~257; - if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; - hitscan(sx,sy,sz,sect, - sintable[(sa+512)&2047], - sintable[sa&2047], - zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); - s->cstat |= 257; - - if (hitsect < 0) return -1; - - if ((TRAND&15) == 0 && sector[hitsect].lotag == 2) - tracers(hitx,hity,hitz,sx,sy,sz,8-(ud.multimode>>1)); - - if (p >= 0) - { - k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,10,10,sa,0,0,i,4); - sprite[k].extra = *actorscrptr[atwith]; - sprite[k].extra += (TRAND%6); - sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 - hittype[k].temp_data[6] = hitwall; - hittype[k].temp_data[7] = hitsect; - hittype[k].temp_data[8] = hitspr; - - - if (hitwall == -1 && hitspr == -1) - { - if (zvel < 0) - { - if (sector[hitsect].ceilingstat&1) - { - sprite[k].xrepeat = 0; - sprite[k].yrepeat = 0; - return -1; - } - else - checkhitceiling(hitsect); - } - l = spawn(k,SMALLSMOKE); - hittype[l].temp_data[6] = hitwall; - hittype[l].temp_data[7] = hitsect; - hittype[l].temp_data[8] = hitspr; - } - - 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))) - { - l = spawn(k,JIBS6); - sprite[k].xrepeat = sprite[k].yrepeat = 0; - sprite[l].z += (4<<8); - sprite[l].xvel = 16; - sprite[l].xrepeat = sprite[l].yrepeat = 24; - sprite[l].ang += 64-(TRAND&127); + zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + sz += (6<<8); + sa += 15; } else { - l = spawn(k,SMALLSMOKE); - hittype[l].temp_data[6] = hitwall; - hittype[l].temp_data[7] = hitsect; - hittype[l].temp_data[8] = hitspr; - } - - if (p >= 0 && ( - sprite[hitspr].picnum == DIPSWITCH || - sprite[hitspr].picnum == DIPSWITCH+1 || - sprite[hitspr].picnum == DIPSWITCH2 || - sprite[hitspr].picnum == DIPSWITCH2+1 || - sprite[hitspr].picnum == DIPSWITCH3 || - sprite[hitspr].picnum == DIPSWITCH3+1 || - sprite[hitspr].picnum == HANDSWITCH || - sprite[hitspr].picnum == HANDSWITCH+1)) - { - checkhitswitch(p,hitspr,1); - return -1; + j = ps[findplayer(s,&x)].i; + zvel = ((sprite[j].z-sz)<<8) / (x+1); + sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } } - else if (hitwall >= 0) + + // writestring(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047],zvel<<6); + if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; + hitscan(sx,sy,sz,sect, + sintable[(sa+512)&2047], + sintable[sa&2047],zvel<<6, + &hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + + if (atwith == BLOODSPLAT1 || atwith == BLOODSPLAT2 || atwith == BLOODSPLAT3 || atwith == BLOODSPLAT4) { - 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) - goto SKIPBULLETHOLE; - if (p >= 0 && ( - wall[hitwall].picnum == DIPSWITCH || - wall[hitwall].picnum == DIPSWITCH+1 || - wall[hitwall].picnum == DIPSWITCH2 || - wall[hitwall].picnum == DIPSWITCH2+1 || - wall[hitwall].picnum == DIPSWITCH3 || - wall[hitwall].picnum == DIPSWITCH3+1 || - wall[hitwall].picnum == HANDSWITCH || - wall[hitwall].picnum == HANDSWITCH+1)) - { - checkhitswitch(p,hitwall,0); - return -1; - } - - 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 (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].nextsector >= 0) { - l = headspritesect[wall[hitwall].nextsector]; - while (l >= 0) + k = headspritesect[wall[hitwall].nextsector]; + while (k >= 0) { - if (sprite[l].statnum == 3 && sprite[l].lotag == 13) - goto SKIPBULLETHOLE; - l = nextspritesect[l]; + if (sprite[k].statnum == 3 && sprite[k].lotag == 13) + return -1; + k = nextspritesect[k]; } } - l = headspritestat[5]; - while (l >= 0) + if (wall[hitwall].nextwall >= 0 && + wall[wall[hitwall].nextwall].hitag != 0) + return -1; + + if (wall[hitwall].hitag == 0) { - if (sprite[l].picnum == BULLETHOLE) - if (dist(&sprite[l],&sprite[k]) < (12+(TRAND&7))) - goto SKIPBULLETHOLE; - l = nextspritestat[l]; + k = spawn(i,atwith); + sprite[k].xvel = -12; + sprite[k].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x, + wall[hitwall].y-wall[wall[hitwall].point2].y)+512; + sprite[k].x = hitx; + sprite[k].y = hity; + sprite[k].z = hitz; + sprite[k].cstat |= (TRAND&4); + ssp(k,CLIPMASK0); + setsprite(k,sprite[k].x,sprite[k].y,sprite[k].z); + if (PN == OOZFILTER || PN == NEWBEAST) + sprite[k].pal = 6; } - l = spawn(k,BULLETHOLE); - sprite[l].xvel = -1; - sprite[l].x = hitx; - sprite[l].y = hity; - sprite[l].z = hitz; - - sprite[l].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x, - wall[hitwall].y-wall[wall[hitwall].point2].y)+512; - - sprite[l].x -= mulscale13(1,sintable[(sprite[l].ang+2560)&2047]); - sprite[l].y -= mulscale13(1,sintable[(sprite[l].ang+2048)&2047]); - ssp(l,CLIPMASK0); } - -SKIPBULLETHOLE: - - 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); + return -1; } - } - else - { - k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,24,24,sa,0,0,i,4); - sprite[k].extra = *actorscrptr[atwith]; - sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 - hittype[k].temp_data[6] = hitwall; - hittype[k].temp_data[7] = hitsect; - hittype[k].temp_data[8] = hitspr; - if (hitspr >= 0) + if (hitsect < 0) break; + + if ((klabs(sx-hitx)+klabs(sy-hity)) < 1024) { - checkhitsprite(hitspr,k); - if (sprite[hitspr].picnum != APLAYER) + 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) + { + k = spawn(j,SMALLSMOKE); + sprite[k].z -= (8<<8); + spritesound(KICK_HIT,j); + hittype[k].temp_data[6] = hitwall; + hittype[k].temp_data[7] = hitsect; + hittype[k].temp_data[8] = hitspr; + } + + 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) + { + checkhitsprite(hitspr,j); + if (p >= 0) checkhitswitch(p,hitspr,1); + } + + else if (hitwall >= 0) + { + 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) + { + checkhitwall(j,hitwall,hitx,hity,hitz,atwith); + if (p >= 0) checkhitswitch(p,hitwall,0); + } + } + } + else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) + { + j = spawn(ps[p].i,WATERSPLASH2); + sprite[j].x = hitx; + sprite[j].y = hity; + sprite[j].ang = ps[p].ang; // Total tweek + sprite[j].xvel = 32; + ssp(i,CLIPMASK0); + sprite[j].xvel = 0; + + } + } + + break; + + case SHOTSPARK1__STATIC: + case SHOTGUN__STATIC: + case CHAINGUN__STATIC: + + if (s->extra >= 0) s->shade = -96; + + if (p >= 0) + { + int angRange; + int zRange; + + SetGameVarID(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p); + OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1); + j=-1; + if (GetGameVarID(g_iAimAngleVarID,i,p) > 0) + { + j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); + } + 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)) + { + + dal -= (8<<8); + + } + zvel = ((sprite[j].z-sz-dal)<<8) / ldist(&sprite[ps[p].i], &sprite[j]) ; + sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + } + + angRange=32; + zRange=256; + SetGameVarID(g_iAngRangeVarID,32, i,p); + SetGameVarID(g_iZRangeVarID,256,i,p); + OnEvent(EVENT_GETSHOTRANGE, i,p, -1); + angRange=GetGameVarID(g_iAngRangeVarID,i,p); + zRange=GetGameVarID(g_iZRangeVarID,i,p); + + sa += (angRange/2)-(TRAND&(angRange-1)); + if (j == -1) + { + // no target + zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + } + zvel += (zRange/2)-(TRAND&(zRange-1)); + sz -= (2<<8); + } + else + { + j = findplayer(s,&x); + sz -= (4<<8); + zvel = ((ps[j].posz-sz) <<8) / (ldist(&sprite[ps[j].i], s)); + if (s->picnum != BOSS1) + { + zvel += 128-(TRAND&255); + sa += 32-(TRAND&63); + } + else + { + zvel += 128-(TRAND&255); + sa = getangle(ps[j].posx-sx,ps[j].posy-sy)+64-(TRAND&127); + } + } + + s->cstat &= ~257; + if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; + hitscan(sx,sy,sz,sect, + sintable[(sa+512)&2047], + sintable[sa&2047], + zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + s->cstat |= 257; + + if (hitsect < 0) return -1; + + if ((TRAND&15) == 0 && sector[hitsect].lotag == 2) + tracers(hitx,hity,hitz,sx,sy,sz,8-(ud.multimode>>1)); + + if (p >= 0) + { + k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,10,10,sa,0,0,i,4); + sprite[k].extra = *actorscrptr[atwith]; + sprite[k].extra += (TRAND%6); + sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 + hittype[k].temp_data[6] = hitwall; + hittype[k].temp_data[7] = hitsect; + hittype[k].temp_data[8] = hitspr; + + + if (hitwall == -1 && hitspr == -1) + { + if (zvel < 0) + { + if (sector[hitsect].ceilingstat&1) + { + sprite[k].xrepeat = 0; + sprite[k].yrepeat = 0; + return -1; + } + else + checkhitceiling(hitsect); + } l = spawn(k,SMALLSMOKE); hittype[l].temp_data[6] = hitwall; hittype[l].temp_data[7] = hitsect; hittype[l].temp_data[8] = hitspr; } - else sprite[k].xrepeat = sprite[k].yrepeat = 0; - } - else if (hitwall >= 0) - checkhitwall(k,hitwall,hitx,hity,hitz,SHOTSPARK1); - } - if ((TRAND&255) < 4) - xyzsound(PISTOL_RICOCHET,k,hitx,hity,hitz); - - return -1; - - case FIRELASER__STATIC: - case SPIT__STATIC: - case COOLEXPLOSION1__STATIC: - - if (s->extra >= 0) s->shade = -96; - - scount = 1; - if (atwith == SPIT) vel = 292; - else - { - if (atwith == COOLEXPLOSION1) - { - if (s->picnum == BOSS2) vel = 644; - else vel = 348; - sz -= (4<<7); - } - else - { - vel = 840; - sz -= (4<<7); - } - } - - 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) - { - j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); - } - - 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]) ; - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); - } - else - zvel = (100-ps[p].horiz-ps[p].horizoff)*98; - } - else - { - j = findplayer(s,&x); - // sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); - sa += 16-(TRAND&31); - zvel = (((ps[j].oposz - sz + (3<<8)))*vel) / ldist(&sprite[ps[j].i],s); - } - if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; - oldzvel = zvel; - - if (atwith == SPIT) { sizx = 18;sizy = 18,sz -= (10<<8); } - else - { - if (atwith == FIRELASER) - { - if (p >= 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))) + { + l = spawn(k,JIBS6); + sprite[k].xrepeat = sprite[k].yrepeat = 0; + sprite[l].z += (4<<8); + sprite[l].xvel = 16; + sprite[l].xrepeat = sprite[l].yrepeat = 24; + sprite[l].ang += 64-(TRAND&127); + } + else + { + l = spawn(k,SMALLSMOKE); + hittype[l].temp_data[6] = hitwall; + hittype[l].temp_data[7] = hitsect; + hittype[l].temp_data[8] = hitspr; + } - sizx = 34; - sizy = 34; + if (p >= 0 && ( + sprite[hitspr].picnum == DIPSWITCH || + sprite[hitspr].picnum == DIPSWITCH+1 || + sprite[hitspr].picnum == DIPSWITCH2 || + sprite[hitspr].picnum == DIPSWITCH2+1 || + sprite[hitspr].picnum == DIPSWITCH3 || + sprite[hitspr].picnum == DIPSWITCH3+1 || + sprite[hitspr].picnum == HANDSWITCH || + sprite[hitspr].picnum == HANDSWITCH+1)) + { + checkhitswitch(p,hitspr,1); + return -1; + } + } + 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) + goto SKIPBULLETHOLE; + if (p >= 0 && ( + wall[hitwall].picnum == DIPSWITCH || + wall[hitwall].picnum == DIPSWITCH+1 || + wall[hitwall].picnum == DIPSWITCH2 || + wall[hitwall].picnum == DIPSWITCH2+1 || + wall[hitwall].picnum == DIPSWITCH3 || + wall[hitwall].picnum == DIPSWITCH3+1 || + wall[hitwall].picnum == HANDSWITCH || + wall[hitwall].picnum == HANDSWITCH+1)) + { + checkhitswitch(p,hitwall,0); + return -1; + } + + 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) || + (wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0)) + if ((wall[hitwall].cstat&16) == 0) + { + if (wall[hitwall].nextsector >= 0) + { + l = headspritesect[wall[hitwall].nextsector]; + while (l >= 0) + { + if (sprite[l].statnum == 3 && sprite[l].lotag == 13) + goto SKIPBULLETHOLE; + l = nextspritesect[l]; + } + } + + l = headspritestat[5]; + while (l >= 0) + { + if (sprite[l].picnum == BULLETHOLE) + if (dist(&sprite[l],&sprite[k]) < (12+(TRAND&7))) + goto SKIPBULLETHOLE; + l = nextspritestat[l]; + } + l = spawn(k,BULLETHOLE); + sprite[l].xvel = -1; + sprite[l].x = hitx; + sprite[l].y = hity; + sprite[l].z = hitz; + + sprite[l].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x, + wall[hitwall].y-wall[wall[hitwall].point2].y)+512; + + sprite[l].x -= mulscale13(1,sintable[(sprite[l].ang+2560)&2047]); + sprite[l].y -= mulscale13(1,sintable[(sprite[l].ang+2048)&2047]); + ssp(l,CLIPMASK0); + } + +SKIPBULLETHOLE: + + 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); + } + } + else + { + k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,24,24,sa,0,0,i,4); + sprite[k].extra = *actorscrptr[atwith]; + sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 + hittype[k].temp_data[6] = hitwall; + hittype[k].temp_data[7] = hitsect; + hittype[k].temp_data[8] = hitspr; + + if (hitspr >= 0) + { + checkhitsprite(hitspr,k); + if (sprite[hitspr].picnum != APLAYER) + { + l = spawn(k,SMALLSMOKE); + hittype[l].temp_data[6] = hitwall; + hittype[l].temp_data[7] = hitsect; + hittype[l].temp_data[8] = hitspr; + } + else sprite[k].xrepeat = sprite[k].yrepeat = 0; + } + else if (hitwall >= 0) + checkhitwall(k,hitwall,hitx,hity,hitz,SHOTSPARK1); + } + + if ((TRAND&255) < 4) + xyzsound(PISTOL_RICOCHET,k,hitx,hity,hitz); + + return -1; + + case FIRELASER__STATIC: + case SPIT__STATIC: + case COOLEXPLOSION1__STATIC: + + if (s->extra >= 0) s->shade = -96; + + scount = 1; + if (atwith == SPIT) vel = 292; + else + { + if (atwith == COOLEXPLOSION1) + { + if (s->picnum == BOSS2) vel = 644; + else vel = 348; + sz -= (4<<7); + } + else + { + vel = 840; + sz -= (4<<7); + } + } + + 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) + { + j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); + } + + 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]) ; + sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + } + else + zvel = (100-ps[p].horiz-ps[p].horizoff)*98; + } + else + { + j = findplayer(s,&x); + // sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); + sa += 16-(TRAND&31); + zvel = (((ps[j].oposz - sz + (3<<8)))*vel) / ldist(&sprite[ps[j].i],s); + } + if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; + oldzvel = zvel; + + if (atwith == SPIT) + { + sizx = 18; + sizy = 18,sz -= (10<<8); + } + else + { + if (atwith == FIRELASER) + { + if (p >= 0) + { + + sizx = 34; + sizy = 34; + } + else + { + sizx = 18; + sizy = 18; + } } else { @@ -1469,383 +1489,378 @@ SKIPBULLETHOLE: sizy = 18; } } + + if (p >= 0) sizx = 7,sizy = 7; + + 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) + { + sprite[j].shade = 0; + if (PN == BOSS2) + { + l = sprite[j].xvel; + sprite[j].xvel = 1024; + ssp(j,CLIPMASK0); + sprite[j].xvel = l; + sprite[j].ang += 128-(TRAND&255); + } + } + + sprite[j].cstat = 128; + sprite[j].clipdist = 4; + + sa = s->ang+32-(TRAND&63); + zvel = oldzvel+512-(TRAND&1023); + + scount--; + } + + return j; + + case FREEZEBLAST__STATIC: + sz += (3<<8); + case RPG__STATIC: + + if (s->extra >= 0) s->shade = -96; + + scount = 1; + vel = 644; + + j = -1; + + 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) + { + j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); + } + + 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) + sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + } + else zvel = (100-ps[p].horiz-ps[p].horizoff)*81; + if (atwith == RPG) + spritesound(RPG_SHOOT,i); + + } else { - sizx = 18; - sizy = 18; - } - } - - if (p >= 0) sizx = 7,sizy = 7; - - 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) - { - sprite[j].shade = 0; - if (PN == BOSS2) + j = findplayer(s,&x); + sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); + if (PN == BOSS3) + sz -= (32<<8); + else if (PN == BOSS2) { - l = sprite[j].xvel; - sprite[j].xvel = 1024; - ssp(j,CLIPMASK0); - sprite[j].xvel = l; - sprite[j].ang += 128-(TRAND&255); + vel += 128; + sz += 24<<8; + } + + l = ldist(&sprite[ps[j].i],s); + zvel = ((ps[j].oposz-sz)*vel) / l; + + if (badguy(s) && (s->hitag&face_player_smart)) + sa = s->ang+(TRAND&31)-16; + } + + if (p >= 0 && j >= 0) + l = j; + else l = -1; + if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; + j = EGS(sect, + sx+(sintable[(348+sa+512)&2047]/448), + sy+(sintable[(sa+348)&2047]/448), + sz-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4); + + sprite[j].extra += (TRAND&7); + if (atwith != FREEZEBLAST) + sprite[j].yvel = l; + else + { + sprite[j].yvel = numfreezebounces; + sprite[j].xrepeat >>= 1; + sprite[j].yrepeat >>= 1; + sprite[j].zvel -= (2<<4); + } + + if (p == -1) + { + if (PN == BOSS3) + { + if (TRAND&1) + { + sprite[j].x -= sintable[sa&2047]>>6; + sprite[j].y -= sintable[(sa+1024+512)&2047]>>6; + sprite[j].ang -= 8; + } + else + { + sprite[j].x += sintable[sa&2047]>>6; + sprite[j].y += sintable[(sa+1024+512)&2047]>>6; + sprite[j].ang += 4; + } + sprite[j].xrepeat = 42; + sprite[j].yrepeat = 42; + } + else if (PN == BOSS2) + { + sprite[j].x -= sintable[sa&2047]/56; + sprite[j].y -= sintable[(sa+1024+512)&2047]/56; + sprite[j].ang -= 8+(TRAND&255)-128; + sprite[j].xrepeat = 24; + sprite[j].yrepeat = 24; + } + else if (atwith != FREEZEBLAST) + { + sprite[j].xrepeat = 30; + sprite[j].yrepeat = 30; + sprite[j].extra >>= 2; } } - sprite[j].cstat = 128; - sprite[j].clipdist = 4; - - sa = s->ang+32-(TRAND&63); - zvel = oldzvel+512-(TRAND&1023); - - scount--; - } - - return j; - - case FREEZEBLAST__STATIC: - sz += (3<<8); - case RPG__STATIC: - - if (s->extra >= 0) s->shade = -96; - - scount = 1; - vel = 644; - - j = -1; - - 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) + else if (*aplWeaponWorksLike[ps[p].curr_weapon] == DEVISTATOR_WEAPON) { - j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); - } + sprite[j].extra >>= 2; + sprite[j].ang += 16-(TRAND&31); + sprite[j].zvel += 256-(TRAND&511); - 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) - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); - } - else zvel = (100-ps[p].horiz-ps[p].horizoff)*81; - if (atwith == RPG) - spritesound(RPG_SHOOT,i); - - } - else - { - j = findplayer(s,&x); - sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); - if (PN == BOSS3) - sz -= (32<<8); - else if (PN == BOSS2) - { - vel += 128; - sz += 24<<8; - } - - l = ldist(&sprite[ps[j].i],s); - zvel = ((ps[j].oposz-sz)*vel) / l; - - if (badguy(s) && (s->hitag&face_player_smart)) - sa = s->ang+(TRAND&31)-16; - } - - if (p >= 0 && j >= 0) - l = j; - else l = -1; - if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; - j = EGS(sect, - sx+(sintable[(348+sa+512)&2047]/448), - sy+(sintable[(sa+348)&2047]/448), - sz-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4); - - sprite[j].extra += (TRAND&7); - if (atwith != FREEZEBLAST) - sprite[j].yvel = l; - else - { - sprite[j].yvel = numfreezebounces; - sprite[j].xrepeat >>= 1; - sprite[j].yrepeat >>= 1; - sprite[j].zvel -= (2<<4); - } - - if (p == -1) - { - if (PN == BOSS3) - { - if (TRAND&1) + if (ps[p].hbomb_hold_delay) { - sprite[j].x -= sintable[sa&2047]>>6; - sprite[j].y -= sintable[(sa+1024+512)&2047]>>6; - sprite[j].ang -= 8; + sprite[j].x -= sintable[sa&2047]/644; + sprite[j].y -= sintable[(sa+1024+512)&2047]/644; } else { - sprite[j].x += sintable[sa&2047]>>6; - sprite[j].y += sintable[(sa+1024+512)&2047]>>6; - sprite[j].ang += 4; + sprite[j].x += sintable[sa&2047]>>8; + sprite[j].y += sintable[(sa+1024+512)&2047]>>8; } - sprite[j].xrepeat = 42; - sprite[j].yrepeat = 42; + sprite[j].xrepeat >>= 1; + sprite[j].yrepeat >>= 1; } - else if (PN == BOSS2) - { - sprite[j].x -= sintable[sa&2047]/56; - sprite[j].y -= sintable[(sa+1024+512)&2047]/56; - sprite[j].ang -= 8+(TRAND&255)-128; - sprite[j].xrepeat = 24; - sprite[j].yrepeat = 24; - } - else if (atwith != FREEZEBLAST) - { - sprite[j].xrepeat = 30; - sprite[j].yrepeat = 30; - sprite[j].extra >>= 2; - } - } - 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) - { - sprite[j].x -= sintable[sa&2047]/644; - sprite[j].y -= sintable[(sa+1024+512)&2047]/644; - } + sprite[j].cstat = 128; + if (atwith == RPG) + sprite[j].clipdist = 4; else - { - sprite[j].x += sintable[sa&2047]>>8; - sprite[j].y += sintable[(sa+1024+512)&2047]>>8; - } - sprite[j].xrepeat >>= 1; - sprite[j].yrepeat >>= 1; - } + sprite[j].clipdist = 40; - sprite[j].cstat = 128; - if (atwith == RPG) - sprite[j].clipdist = 4; - else - sprite[j].clipdist = 40; + break; - break; + case HANDHOLDINGLASER__STATIC: - case HANDHOLDINGLASER__STATIC: + 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]; + hitscan(sx,sy,sz-ps[p].pyoff,sect, + sintable[(sa+512)&2047], + sintable[sa&2047], + zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); - 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]; - hitscan(sx,sy,sz-ps[p].pyoff,sect, - sintable[(sa+512)&2047], - sintable[sa&2047], - zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + j = 0; + if (hitspr >= 0) break; - j = 0; - if (hitspr >= 0) break; - - if (hitwall >= 0 && hitsect >= 0) - if (((hitx-sx)*(hitx-sx)+(hity-sy)*(hity-sy)) < (290*290)) - { - if (wall[hitwall].nextsector >= 0) + if (hitwall >= 0 && hitsect >= 0) + if (((hitx-sx)*(hitx-sx)+(hity-sy)*(hity-sy)) < (290*290)) { - if (sector[wall[hitwall].nextsector].lotag <= 2 && sector[hitsect].lotag <= 2) + if (wall[hitwall].nextsector >= 0) + { + if (sector[wall[hitwall].nextsector].lotag <= 2 && sector[hitsect].lotag <= 2) + j = 1; + } + else if (sector[hitsect].lotag <= 2) j = 1; } - else if (sector[hitsect].lotag <= 2) - 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 (j == 1) { - 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); - // set timer. blows up when at zero.... - hittype[k].temp_data[7]=lLifetime - + mulscale(krand(),lLifetimeVar, 14) - - lLifetimeVar; - hittype[k].temp_data[6]=1; - } - else - - sprite[k].hitag = k; - spritesound(LASERTRIP_ONWALL,k); - sprite[k].xvel = -20; - ssp(k,CLIPMASK0); - sprite[k].cstat = 16; - hittype[k].temp_data[5] = sprite[k].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x,wall[hitwall].y-wall[wall[hitwall].point2].y)-512; - - - } - return j?k:-1; - - case BOUNCEMINE__STATIC: - case MORTER__STATIC: - - if (s->extra >= 0) s->shade = -96; - - j = ps[findplayer(s,&x)].i; - x = ldist(&sprite[j],s); - - zvel = -x>>1; - - if (zvel < -4096) - zvel = -2048; - vel = x>>4; - if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; - EGS(sect, - sx+(sintable[(512+sa+512)&2047]>>8), - sy+(sintable[(sa+512)&2047]>>8), - sz+(6<<8),atwith,-64,32,32,sa,vel,zvel,i,1); - break; - - case GROWSPARK__STATIC: - - 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) - { - j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); - } - - 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)) { - dal -= (8<<8); - - } - zvel = ((sprite[j].z-sz-dal)<<8) / (ldist(&sprite[ps[p].i], &sprite[j])); - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); - } - else - { - sa += 16-(TRAND&31); - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; - zvel += 128-(TRAND&255); - } - - sz -= (2<<8); - } - else - { - j = findplayer(s,&x); - sz -= (4<<8); - zvel = ((ps[j].posz-sz) <<8) / (ldist(&sprite[ps[j].i], s)); - zvel += 128-(TRAND&255); - sa += 32-(TRAND&63); - } - - k = 0; - - // RESHOOTGROW: - - s->cstat &= ~257; - if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; - hitscan(sx,sy,sz,sect, - sintable[(sa+512)&2047], - sintable[sa&2047], - zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); - - s->cstat |= 257; - - j = EGS(sect,hitx,hity,hitz,GROWSPARK,-16,28,28,sa,0,0,i,1); - - sprite[j].pal = 2; - sprite[j].cstat |= 130; - sprite[j].xrepeat = sprite[j].yrepeat = 1; - - if (hitwall == -1 && hitspr == -1 && hitsect >= 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) - { - /* if(wall[hitwall].overpicnum == MIRROR && k == 0) + 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) { - l = getangle( - wall[wall[hitwall].point2].x-wall[hitwall].x, - wall[wall[hitwall].point2].y-wall[hitwall].y); - - sx = hitx; - sy = hity; - sz = hitz; - sect = hitsect; - sa = ((l<<1) - sa)&2047; - sx += sintable[(sa+512)&2047]>>12; - sy += sintable[sa&2047]>>12; - - k++; - goto RESHOOTGROW; + 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); + // set timer. blows up when at zero.... + hittype[k].temp_data[7]=lLifetime + + mulscale(krand(),lLifetimeVar, 14) + - lLifetimeVar; + hittype[k].temp_data[6]=1; } - else */ - checkhitwall(j,hitwall,hitx,hity,hitz,atwith); - } + else - break; + sprite[k].hitag = k; + spritesound(LASERTRIP_ONWALL,k); + sprite[k].xvel = -20; + ssp(k,CLIPMASK0); + sprite[k].cstat = 16; + hittype[k].temp_data[5] = sprite[k].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x,wall[hitwall].y-wall[wall[hitwall].point2].y)-512; - case SHRINKER__STATIC: - 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) + + } + return j?k:-1; + + case BOUNCEMINE__STATIC: + case MORTER__STATIC: + + if (s->extra >= 0) s->shade = -96; + + j = ps[findplayer(s,&x)].i; + x = ldist(&sprite[j],s); + + zvel = -x>>1; + + if (zvel < -4096) + zvel = -2048; + vel = x>>4; + if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; + EGS(sect, + sx+(sintable[(512+sa+512)&2047]>>8), + sy+(sintable[(sa+512)&2047]>>8), + sz+(6<<8),atwith,-64,32,32,sa,vel,zvel,i,1); + break; + + case GROWSPARK__STATIC: + + if (p >= 0) { - j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); + // 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) + { + j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); + } + + 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)) + { + dal -= (8<<8); + + } + zvel = ((sprite[j].z-sz-dal)<<8) / (ldist(&sprite[ps[p].i], &sprite[j])); + sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + } + else + { + sa += 16-(TRAND&31); + zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel += 128-(TRAND&255); + } + + sz -= (2<<8); + } + else + { + j = findplayer(s,&x); + sz -= (4<<8); + zvel = ((ps[j].posz-sz) <<8) / (ldist(&sprite[ps[j].i], s)); + zvel += 128-(TRAND&255); + sa += 32-(TRAND&63); } - if (j >= 0) + k = 0; + + // RESHOOTGROW: + + s->cstat &= ~257; + if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; + hitscan(sx,sy,sz,sect, + sintable[(sa+512)&2047], + sintable[sa&2047], + zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + + s->cstat |= 257; + + j = EGS(sect,hitx,hity,hitz,GROWSPARK,-16,28,28,sa,0,0,i,1); + + sprite[j].pal = 2; + sprite[j].cstat |= 130; + sprite[j].xrepeat = sprite[j].yrepeat = 1; + + if (hitwall == -1 && hitspr == -1 && hitsect >= 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])); - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + if (zvel < 0 && (sector[hitsect].ceilingstat&1) == 0) + checkhitceiling(hitsect); } - else zvel = (100-ps[p].horiz-ps[p].horizoff)*98; - } - else if (s->statnum != 3) - { - j = findplayer(s,&x); - l = ldist(&sprite[ps[j].i],s); - zvel = ((ps[j].oposz-sz)*512) / l ; - } - else zvel = 0; - if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; - j = EGS(sect, - sx+(sintable[(512+sa+512)&2047]>>12), - sy+(sintable[(sa+512)&2047]>>12), - sz+(2<<8),SHRINKSPARK,-16,28,28,sa,768,zvel,i,4); + 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) + { + l = getangle( + wall[wall[hitwall].point2].x-wall[hitwall].x, + wall[wall[hitwall].point2].y-wall[hitwall].y); - sprite[j].cstat = 128; - sprite[j].clipdist = 32; + sx = hitx; + sy = hity; + sz = hitz; + sect = hitsect; + sa = ((l<<1) - sa)&2047; + sx += sintable[(sa+512)&2047]>>12; + sy += sintable[sa&2047]>>12; + + k++; + goto RESHOOTGROW; + } + else */ + checkhitwall(j,hitwall,hitx,hity,hitz,atwith); + } + + break; + + case SHRINKER__STATIC: + 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) + { + j = aim(s, GetGameVarID(g_iAimAngleVarID,i,p),atwith); + } + + 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])); + sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + } + else zvel = (100-ps[p].horiz-ps[p].horizoff)*98; + } + else if (s->statnum != 3) + { + j = findplayer(s,&x); + l = ldist(&sprite[ps[j].i],s); + zvel = ((ps[j].oposz-sz)*512) / l ; + } + else zvel = 0; + if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; + j = EGS(sect, + sx+(sintable[(512+sa+512)&2047]>>12), + sy+(sintable[(sa+512)&2047]>>12), + sz+(2<<8),SHRINKSPARK,-16,28,28,sa,768,zvel,i,4); + + sprite[j].cstat = 128; + sprite[j].clipdist = 32; - return j; + return j; } } return -1; @@ -2105,19 +2120,19 @@ void myospalw(long x, long y, short tilenum, signed char shade, char orientation { switch (g_currentweapon) { - case PISTOL_WEAPON: - case CHAINGUN_WEAPON: - case RPG_WEAPON: - case FREEZE_WEAPON: - case SHRINKER_WEAPON: - case GROW_WEAPON: - case DEVISTATOR_WEAPON: - case TRIPBOMB_WEAPON: - case HANDREMOTE_WEAPON: - case HANDBOMB_WEAPON: - case SHOTGUN_WEAPON: - rotatesprite(160<<16,(180+(ps[screenpeek].weapon_pos*ps[screenpeek].weapon_pos))<<16,scale(65536,ud.statusbarscale,100),0,g_currentweapon==GROW_WEAPON?GROWSPRITEICON:weapon_sprites[g_currentweapon],0,0,2,windowx1,windowy1,windowx2,windowy2); - break; + case PISTOL_WEAPON: + case CHAINGUN_WEAPON: + case RPG_WEAPON: + case FREEZE_WEAPON: + case SHRINKER_WEAPON: + case GROW_WEAPON: + case DEVISTATOR_WEAPON: + case TRIPBOMB_WEAPON: + case HANDREMOTE_WEAPON: + case HANDBOMB_WEAPON: + case SHOTGUN_WEAPON: + rotatesprite(160<<16,(180+(ps[screenpeek].weapon_pos*ps[screenpeek].weapon_pos))<<16,scale(65536,ud.statusbarscale,100),0,g_currentweapon==GROW_WEAPON?GROWSPRITEICON:weapon_sprites[g_currentweapon],0,0,2,windowx1,windowy1,windowx2,windowy2); + break; } } } @@ -2222,413 +2237,454 @@ void displayweapon(short snum) { - case KNEE_WEAPON: + case KNEE_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 ((*kb) > 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 ((*kb) > 0) + { + if (sprite[p->i].pal == 1) + pal = 1; + else + { + pal = sector[p->cursectnum].floorpal; + if (pal == 0) + pal = p->palookup; + } + + if ((*kb) < 5 || (*kb) > 9) + myospal(weapon_xoffset+220-(p->look_ang>>1), + looking_arc+250-gun_pos,KNEE,gs,o,pal); + else + myospal(weapon_xoffset+160-(p->look_ang>>1), + looking_arc+214-gun_pos,KNEE+1,gs,o,pal); + } + } + break; + + case TRIPBOMB_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 (sprite[p->i].pal == 1) pal = 1; else - { pal = sector[p->cursectnum].floorpal; - if (pal == 0) - pal = p->palookup; + + weapon_xoffset += 8; + gun_pos -= 10; + + if ((*kb) > 6) + looking_arc += ((*kb)<<3); + else if ((*kb) < 4) + myospalw(weapon_xoffset+142-(p->look_ang>>1), + looking_arc+234-gun_pos,HANDHOLDINGLASER+3,gs,o,pal); + + myospalw(weapon_xoffset+130-(p->look_ang>>1), + looking_arc+249-gun_pos, + HANDHOLDINGLASER+((*kb)>>2),gs,o,pal); + myospalw(weapon_xoffset+152-(p->look_ang>>1), + looking_arc+249-gun_pos, + HANDHOLDINGLASER+((*kb)>>2),gs,o|4,pal); + } + break; + + case RPG_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 (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 < 8) + { + myospalw(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos, + RPGGUN+((*kb)>>1),gs,o,pal); + } } - if ((*kb) < 5 || (*kb) > 9) - myospal(weapon_xoffset+220-(p->look_ang>>1), - looking_arc+250-gun_pos,KNEE,gs,o,pal); + myospalw(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos, + RPGGUN,gs,o,pal); + } + break; + + case SHOTGUN_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 (sprite[p->i].pal == 1) + pal = 1; else - myospal(weapon_xoffset+160-(p->look_ang>>1), - looking_arc+214-gun_pos,KNEE+1,gs,o,pal); + pal = sector[p->cursectnum].floorpal; + + + weapon_xoffset -= 8; + + switch (*kb) + { + case 1: + case 2: + myospalw(weapon_xoffset+168-(p->look_ang>>1),looking_arc+201-gun_pos, + SHOTGUN+2,-128,o,pal); + case 0: + case 6: + case 7: + case 8: + myospalw(weapon_xoffset+146-(p->look_ang>>1),looking_arc+202-gun_pos, + SHOTGUN,gs,o,pal); + break; + case 3: + case 4: + case 5: + case 9: + case 10: + case 11: + case 12: + if (*kb > 1 && *kb < 5) + { + gun_pos -= 40; + weapon_xoffset += 20; + + myospalw(weapon_xoffset+178-(p->look_ang>>1),looking_arc+194-gun_pos, + SHOTGUN+1+((*(kb)-1)>>1),-128,o,pal); + } + + myospalw(weapon_xoffset+158-(p->look_ang>>1),looking_arc+220-gun_pos, + SHOTGUN+3,gs,o,pal); + + break; + case 13: + case 14: + case 15: + myospalw(32+weapon_xoffset+166-(p->look_ang>>1),looking_arc+210-gun_pos, + SHOTGUN+4,gs,o,pal); + break; + case 16: + case 17: + case 18: + case 19: + myospalw(64+weapon_xoffset+170-(p->look_ang>>1),looking_arc+196-gun_pos, + SHOTGUN+5,gs,o,pal); + break; + case 20: + case 21: + case 22: + case 23: + myospalw(64+weapon_xoffset+176-(p->look_ang>>1),looking_arc+196-gun_pos, + SHOTGUN+6,gs,o,pal); + break; + case 24: + case 25: + case 26: + case 27: + myospalw(64+weapon_xoffset+170-(p->look_ang>>1),looking_arc+196-gun_pos, + SHOTGUN+5,gs,o,pal); + break; + case 28: + case 29: + case 30: + myospalw(32+weapon_xoffset+156-(p->look_ang>>1),looking_arc+206-gun_pos, + SHOTGUN+4,gs,o,pal); + break; + } + } + break; + + + case CHAINGUN_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 (sprite[p->i].pal == 1) + pal = 1; + else + pal = sector[p->cursectnum].floorpal; + + if (*kb > 0) + gun_pos -= sintable[(*kb)<<7]>>12; + + 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) + { + 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]) + { + i = 0; + 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; + 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) + { + i = rand()&7; + myospalw(i+weapon_xoffset-4+162-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos, + CHAINGUN+5+((*kb-2)/5),gs,o,pal); + myospalw(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos, + CHAINGUN+1+((*kb)>>1),gs,o,pal); + } + else myospalw(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos, + CHAINGUN+1,gs,o,pal); + break; + } + } + break; + + case PISTOL_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 (sprite[p->i].pal == 1) + pal = 1; + else + pal = sector[p->cursectnum].floorpal; + + if ((*kb) < *aplWeaponTotalTime[PISTOL_WEAPON]+1) + { + short kb_frames[] = {0,1,2},l; + + l = 195-12+weapon_xoffset; + + 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); + } + else + { + + 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) + { + 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) + { + 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) + { + 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) + { + 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]) + myospalw(194-(p->look_ang>>1),looking_arc+235-gun_pos,FIRSTGUN+5,gs,o,pal); + + } + } + + 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) + { + if (sprite[p->i].pal == 1) + pal = 1; + else + pal = sector[p->cursectnum].floorpal; + + if ((*kb)) + { + 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}; + + 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); + } + } + else + myospalw(weapon_xoffset+190-(p->look_ang>>1),looking_arc+260-gun_pos,HANDTHROW,gs,o,pal); } } break; - case TRIPBOMB_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) + case HANDREMOTE_WEAPON: { - if (sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - - weapon_xoffset += 8; - gun_pos -= 10; - - if ((*kb) > 6) - looking_arc += ((*kb)<<3); - else if ((*kb) < 4) - myospalw(weapon_xoffset+142-(p->look_ang>>1), - looking_arc+234-gun_pos,HANDHOLDINGLASER+3,gs,o,pal); - - myospalw(weapon_xoffset+130-(p->look_ang>>1), - looking_arc+249-gun_pos, - HANDHOLDINGLASER+((*kb)>>2),gs,o,pal); - myospalw(weapon_xoffset+152-(p->look_ang>>1), - looking_arc+249-gun_pos, - HANDHOLDINGLASER+((*kb)>>2),gs,o|4,pal); - } - break; - - case RPG_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 (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) + 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 (*kb < 8) - { - myospalw(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos, - RPGGUN+((*kb)>>1),gs,o,pal); - } - } + 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; - myospalw(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos, - RPGGUN,gs,o,pal); - } - break; - - case SHOTGUN_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 (sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - - - weapon_xoffset -= 8; - - switch (*kb) - { - case 1: - case 2: - myospalw(weapon_xoffset+168-(p->look_ang>>1),looking_arc+201-gun_pos, - SHOTGUN+2,-128,o,pal); - case 0: - case 6: - case 7: - case 8: - myospalw(weapon_xoffset+146-(p->look_ang>>1),looking_arc+202-gun_pos, - SHOTGUN,gs,o,pal); - break; - case 3: - case 4: - case 5: - case 9: - case 10: - case 11: - case 12: - if (*kb > 1 && *kb < 5) - { - gun_pos -= 40; - weapon_xoffset += 20; - - myospalw(weapon_xoffset+178-(p->look_ang>>1),looking_arc+194-gun_pos, - SHOTGUN+1+((*(kb)-1)>>1),-128,o,pal); - } - - myospalw(weapon_xoffset+158-(p->look_ang>>1),looking_arc+220-gun_pos, - SHOTGUN+3,gs,o,pal); - - break; - case 13: - case 14: - case 15: - myospalw(32+weapon_xoffset+166-(p->look_ang>>1),looking_arc+210-gun_pos, - SHOTGUN+4,gs,o,pal); - break; - case 16: - case 17: - case 18: - case 19: - myospalw(64+weapon_xoffset+170-(p->look_ang>>1),looking_arc+196-gun_pos, - SHOTGUN+5,gs,o,pal); - break; - case 20: - case 21: - case 22: - case 23: - myospalw(64+weapon_xoffset+176-(p->look_ang>>1),looking_arc+196-gun_pos, - SHOTGUN+6,gs,o,pal); - break; - case 24: - case 25: - case 26: - case 27: - myospalw(64+weapon_xoffset+170-(p->look_ang>>1),looking_arc+196-gun_pos, - SHOTGUN+5,gs,o,pal); - break; - case 28: - case 29: - case 30: - myospalw(32+weapon_xoffset+156-(p->look_ang>>1),looking_arc+206-gun_pos, - SHOTGUN+4,gs,o,pal); - break; + 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; + case DEVISTATOR_WEAPON: - case CHAINGUN_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 (sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - - if (*kb > 0) - gun_pos -= sintable[(*kb)<<7]>>12; - - 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) + 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) { - 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 (sprite[p->i].pal == 1) + pal = 1; + else + pal = sector[p->cursectnum].floorpal; + + if ((*kb) < (*aplWeaponTotalTime[DEVISTATOR_WEAPON]+1) && (*kb) > 0) { - i = 0; - 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; - 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); + char cycloidy[] = {0,4,12,24,12,4,0}; + + i = ksgn((*kb)>>2); + + 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); + } + else + { + myospalw(-(cycloidy[*kb]>>1)+weapon_xoffset+30-(p->look_ang>>1),cycloidy[*kb]+looking_arc+240-gun_pos,DEVISTATOR+i,-32,o|4,pal); + myospalw(weapon_xoffset+268-(p->look_ang>>1),looking_arc+238-gun_pos,DEVISTATOR,gs,o,pal); + } } - if (*kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]-4) + else { - i = rand()&7; - myospalw(i+weapon_xoffset-4+162-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos, - CHAINGUN+5+((*kb-2)/5),gs,o,pal); - myospalw(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos, - CHAINGUN+1+((*kb)>>1),gs,o,pal); - } - else myospalw(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos, - CHAINGUN+1,gs,o,pal); - break; - } - } - break; - - case PISTOL_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 (sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - - if ((*kb) < *aplWeaponTotalTime[PISTOL_WEAPON]+1) - { - short kb_frames[] = {0,1,2},l; - - l = 195-12+weapon_xoffset; - - 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); - } - else - { - - 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) - { - 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) - { - 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) - { - 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) - { - 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]) - myospalw(194-(p->look_ang>>1),looking_arc+235-gun_pos,FIRSTGUN+5,gs,o,pal); - - } - } - - 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) - { - if (sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - - if ((*kb)) - { - 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}; - - 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); - } - } - else - myospalw(weapon_xoffset+190-(p->look_ang>>1),looking_arc+260-gun_pos,HANDTHROW,gs,o,pal); - } - } - 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) - { - 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); - } - } - 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 (sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - - 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) - { - 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+268-(p->look_ang>>1),looking_arc+238-gun_pos,DEVISTATOR,gs,o,pal); myospalw(weapon_xoffset+30-(p->look_ang>>1),looking_arc+240-gun_pos,DEVISTATOR,gs,o|4,pal); } + } + break; + + case FREEZE_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 (sprite[p->i].pal == 1) + pal = 1; else + pal = sector[p->cursectnum].floorpal; + + if ((*kb) < (aplWeaponTotalTime[p->curr_weapon][snum]+1) && (*kb) > 0) { - myospalw(-(cycloidy[*kb]>>1)+weapon_xoffset+30-(p->look_ang>>1),cycloidy[*kb]+looking_arc+240-gun_pos,DEVISTATOR+i,-32,o|4,pal); - myospalw(weapon_xoffset+268-(p->look_ang>>1),looking_arc+238-gun_pos,DEVISTATOR,gs,o,pal); + char cat_frames[] = { 0,0,1,1,2,2 }; + + if (sprite[p->i].pal != 1) + { + weapon_xoffset += rand()&3; + looking_arc += rand()&3; + } + gun_pos -= 16; + myospalw(weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE+2,-32,o,pal); + myospalw(weapon_xoffset+210-(p->look_ang>>1),looking_arc+235-gun_pos,FREEZE+3+cat_frames[*kb%6],-32,o,pal); + } + else myospalw(weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE,gs,o,pal); + } + break; + + case GROW_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) + { + weapon_xoffset += 28; + looking_arc += 18; + if (sprite[p->i].pal == 1) + pal = 1; + else + pal = sector[p->cursectnum].floorpal; + { + if ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum] && (*kb) > 0) + { + if (sprite[p->i].pal != 1) + { + weapon_xoffset += rand()&3; + gun_pos += (rand()&3); + } + + myospalw(weapon_xoffset+184-(p->look_ang>>1), + looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32, + o,2); + + myospalw(weapon_xoffset+188-(p->look_ang>>1), + looking_arc+240-gun_pos,SHRINKER-1,gs,o,pal); + } + else + { + myospalw(weapon_xoffset+184-(p->look_ang>>1), + looking_arc+240-gun_pos,SHRINKER+2, + 16-(sintable[p->random_club_frame&2047]>>10), + o,2); + + myospalw(weapon_xoffset+188-(p->look_ang>>1), + looking_arc+240-gun_pos,SHRINKER-2,gs,o,pal); + } } } - else + break; + + case SHRINKER_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) { - myospalw(weapon_xoffset+268-(p->look_ang>>1),looking_arc+238-gun_pos,DEVISTATOR,gs,o,pal); - myospalw(weapon_xoffset+30-(p->look_ang>>1),looking_arc+240-gun_pos,DEVISTATOR,gs,o|4,pal); - } - } - break; - - case FREEZE_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 (sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - - 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) - { - weapon_xoffset += rand()&3; - looking_arc += rand()&3; - } - gun_pos -= 16; - myospalw(weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE+2,-32,o,pal); - myospalw(weapon_xoffset+210-(p->look_ang>>1),looking_arc+235-gun_pos,FREEZE+3+cat_frames[*kb%6],-32,o,pal); - } - else myospalw(weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE,gs,o,pal); - } - break; - - case GROW_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) - { - weapon_xoffset += 28; - looking_arc += 18; - if (sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - { - if ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum] && (*kb) > 0) + weapon_xoffset += 28; + looking_arc += 18; + if (sprite[p->i].pal == 1) + pal = 1; + else + pal = sector[p->cursectnum].floorpal; + if (((*kb) > 0) && ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum])) { if (sprite[p->i].pal != 1) { @@ -2638,65 +2694,24 @@ void displayweapon(short snum) myospalw(weapon_xoffset+184-(p->look_ang>>1), looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32, - o,2); + o,0); myospalw(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER-1,gs,o,pal); + looking_arc+240-gun_pos,SHRINKER+1,gs,o,pal); + } else { myospalw(weapon_xoffset+184-(p->look_ang>>1), looking_arc+240-gun_pos,SHRINKER+2, 16-(sintable[p->random_club_frame&2047]>>10), - o,2); + o,0); myospalw(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER-2,gs,o,pal); + looking_arc+240-gun_pos,SHRINKER,gs,o,pal); } } - } - break; - - case SHRINKER_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) - { - weapon_xoffset += 28; - looking_arc += 18; - if (sprite[p->i].pal == 1) - pal = 1; - else - pal = sector[p->cursectnum].floorpal; - if (((*kb) > 0) && ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum])) - { - if (sprite[p->i].pal != 1) - { - weapon_xoffset += rand()&3; - gun_pos += (rand()&3); - } - - myospalw(weapon_xoffset+184-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32, - o,0); - - myospalw(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+1,gs,o,pal); - - } - else - { - myospalw(weapon_xoffset+184-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+2, - 16-(sintable[p->random_club_frame&2047]>>10), - o,0); - - myospalw(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER,gs,o,pal); - } - } - break; + break; } } @@ -2716,7 +2731,10 @@ void displayweapon(short snum) long myaimmode = 0, myaimstat = 0, omyaimstat = 0; int32 mouseyaxismode = -1; -static ControlInfo lastinfo = { 0,0,0,0,0,0 }; +static ControlInfo lastinfo = + { + 0,0,0,0,0,0 + }; static int jump_input = 0; @@ -2751,7 +2769,8 @@ void getinput(short snum) myaimmode = BUTTON(gamefunc_Mouse_Aiming); else { - omyaimstat = myaimstat; myaimstat = BUTTON(gamefunc_Mouse_Aiming); + omyaimstat = myaimstat; + myaimstat = BUTTON(gamefunc_Mouse_Aiming); if (myaimstat > omyaimstat) { myaimmode ^= 1; @@ -2764,7 +2783,8 @@ void getinput(short snum) if (myaimmode) i = analog_lookingupanddown; else i = MouseAnalogueAxes[1]; - if (i != mouseyaxismode) { + if (i != mouseyaxismode) + { CONTROL_MapAnalogAxis(1, i, controldevice_mouse); mouseyaxismode = i; } @@ -2897,10 +2917,13 @@ void getinput(short snum) if (SmoothInput) { - if (BUTTON(gamefunc_Strafe)) { + if (BUTTON(gamefunc_Strafe)) + { svel = -(info.dyaw+lastinfo.dyaw)/8; lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 8; - } else { + } + else + { angvel = (info.dyaw+lastinfo.dyaw)/64; lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 64; } @@ -2913,9 +2936,12 @@ void getinput(short snum) } else { - if (BUTTON(gamefunc_Strafe)) { + if (BUTTON(gamefunc_Strafe)) + { svel = -info.dyaw/8; - } else { + } + else + { angvel = info.dyaw/64; } @@ -3121,7 +3147,8 @@ char doincrements(struct player_struct *p) p->quick_kick--; 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) { @@ -3135,12 +3162,15 @@ char doincrements(struct player_struct *p) checkhitswitch(snum,p->access_spritenum,1); 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; } @@ -3149,12 +3179,15 @@ char doincrements(struct player_struct *p) checkhitswitch(snum,p->access_wallnum,0); 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; } } } @@ -3242,10 +3275,10 @@ void checkweapons(struct player_struct *p) spawn(p->i,weapon_sprites[cw]); else switch (cw) { - case RPG_WEAPON: - case HANDBOMB_WEAPON: - spawn(p->i,EXPLOSION2); - break; + case RPG_WEAPON: + case HANDBOMB_WEAPON: + spawn(p->i,EXPLOSION2); + break; } } } @@ -3559,36 +3592,41 @@ void processinput(short snum) { switch (dynamictostatic[hittype[p->i].picnum]) { - case KNEE__STATIC: - if (hittype[p->i].temp_data[1] == 1) - i = 7; - else i = 0; - break; - case SHOTSPARK1__STATIC: - switch (ps[p->frag_ps].curr_weapon) - { + case KNEE__STATIC: + if (hittype[p->i].temp_data[1] == 1) + i = 7; + else i = 0; + break; + case SHOTSPARK1__STATIC: + switch (ps[p->frag_ps].curr_weapon) + { + default: + case PISTOL_WEAPON: + i = 1; + break; + case SHOTGUN_WEAPON: + i = 2; + break; + case CHAINGUN_WEAPON: + i = 3; + 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: - case PISTOL_WEAPON: - i = 1; + i = 0; break; - case SHOTGUN_WEAPON: - i = 2; - break; - case CHAINGUN_WEAPON: - i = 3; - 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; } } Bstrcpy(name1,&ud.user_name[snum][0]); @@ -3976,14 +4014,18 @@ void processinput(short snum) { 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; @@ -4198,7 +4240,9 @@ void processinput(short snum) { 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[0] = 0; + p->pals[1] = 8; + p->pals[2] = 0; p->pals_time = 32; s->extra--; } @@ -4210,53 +4254,59 @@ void processinput(short snum) { switch (dynamictostatic[j]) { - case HURTRAIL__STATIC: - if (rnd(32)) - { - if (p->boot_amount > 0) - k = 1; - else + case HURTRAIL__STATIC: + if (rnd(32)) { - 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)) - spritesound(SHORT_CIRCUIT,pi); + if (p->boot_amount > 0) + k = 1; + else + { + 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)) + spritesound(SHORT_CIRCUIT,pi); + } } - } - break; - case FLOORSLIME__STATIC: - if (rnd(16)) - { - if (p->boot_amount > 0) - k = 1; - else + break; + case FLOORSLIME__STATIC: + if (rnd(16)) { - 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; - s->extra -= 1+(TRAND&3); + if (p->boot_amount > 0) + k = 1; + else + { + 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; + s->extra -= 1+(TRAND&3); + } } - } - break; - case FLOORPLASMA__STATIC: - if (rnd(32)) - { - if (p->boot_amount > 0) - k = 1; - else + break; + case FLOORPLASMA__STATIC: + if (rnd(32)) { - 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; - s->extra -= 1+(TRAND&3); + if (p->boot_amount > 0) + k = 1; + else + { + 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; + s->extra -= 1+(TRAND&3); + } } - } - break; + break; } } @@ -4281,26 +4331,26 @@ void processinput(short snum) { switch (psectlotag) { - case 0: + case 0: - if (lz >= 0 && (lz&(MAXSPRITES-1))==49152) - j = sprite[lz&(MAXSPRITES-1)].picnum; - else j = sector[psect].floorpicnum; + if (lz >= 0 && (lz&(MAXSPRITES-1))==49152) + j = sprite[lz&(MAXSPRITES-1)].picnum; + else j = sector[psect].floorpicnum; - switch (dynamictostatic[j]) - { - case PANNEL1__STATIC: - case PANNEL2__STATIC: - spritesound(DUKE_WALKINDUCTS,pi); + switch (dynamictostatic[j]) + { + case PANNEL1__STATIC: + case PANNEL2__STATIC: + spritesound(DUKE_WALKINDUCTS,pi); + p->walking_snd_toggle = 1; + break; + } + break; + case 1: + if ((TRAND&1) == 0) + spritesound(DUKE_ONWATER,pi); p->walking_snd_toggle = 1; break; - } - break; - case 1: - if ((TRAND&1) == 0) - spritesound(DUKE_ONWATER,pi); - p->walking_snd_toggle = 1; - break; } } } @@ -4580,22 +4630,22 @@ HORIZONLY: spritesound(SQUISHED,p->actorsqu); switch (dynamictostatic[sprite[p->actorsqu].picnum]) { - case FEM1__STATIC: - case FEM2__STATIC: - case FEM3__STATIC: - case FEM4__STATIC: - case FEM5__STATIC: - case FEM6__STATIC: - case FEM7__STATIC: - case FEM8__STATIC: - case FEM9__STATIC: - case FEM10__STATIC: - case PODFEM1__STATIC: - case NAKED1__STATIC: - case STATUE__STATIC: - if (sprite[p->actorsqu].yvel) - operaterespawns(sprite[p->actorsqu].yvel); - break; + case FEM1__STATIC: + case FEM2__STATIC: + case FEM3__STATIC: + case FEM4__STATIC: + case FEM5__STATIC: + case FEM6__STATIC: + case FEM7__STATIC: + case FEM8__STATIC: + case FEM9__STATIC: + case FEM10__STATIC: + case PODFEM1__STATIC: + case NAKED1__STATIC: + case STATUE__STATIC: + if (sprite[p->actorsqu].yvel) + operaterespawns(sprite[p->actorsqu].yvel); + break; } if (sprite[p->actorsqu].picnum == APLAYER) @@ -4694,128 +4744,128 @@ SHOOTINCODE: { switch (aplWeaponWorksLike[p->curr_weapon][snum]) { - case HANDBOMB_WEAPON: - OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); + case HANDBOMB_WEAPON: + OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); - p->hbomb_hold_delay = 0; - if (p->ammo_amount[p->curr_weapon] > 0) - { - (*kb)=1; + p->hbomb_hold_delay = 0; + if (p->ammo_amount[p->curr_weapon] > 0) + { + (*kb)=1; + if (aplWeaponInitialSound[p->curr_weapon][snum]) + { + spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + } + } + break; + + case HANDREMOTE_WEAPON: + OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); + p->hbomb_hold_delay = 0; + (*kb) = 1; if (aplWeaponInitialSound[p->curr_weapon][snum]) { spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); } - } - break; + break; - case HANDREMOTE_WEAPON: - OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); - p->hbomb_hold_delay = 0; - (*kb) = 1; - if (aplWeaponInitialSound[p->curr_weapon][snum]) - { - spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); - } - break; - - case SHOTGUN_WEAPON: - OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); - if (p->ammo_amount[p->curr_weapon] > 0 && p->random_club_frame == 0) - { - (*kb)=1; - if (aplWeaponInitialSound[p->curr_weapon][snum]) + case SHOTGUN_WEAPON: + OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); + if (p->ammo_amount[p->curr_weapon] > 0 && p->random_club_frame == 0) { - spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + (*kb)=1; + if (aplWeaponInitialSound[p->curr_weapon][snum]) + { + spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + } } - } - break; + break; - case TRIPBOMB_WEAPON: - if (p->ammo_amount[p->curr_weapon] > 0) - { - long sx,sy,sz; - short sect,hw,hitsp; + case TRIPBOMB_WEAPON: + if (p->ammo_amount[p->curr_weapon] > 0) + { + long sx,sy,sz; + short sect,hw,hitsp; - hitscan(p->posx, p->posy, p->posz, - p->cursectnum, sintable[(p->ang+512)&2047], - sintable[p->ang&2047], (100-p->horiz-p->horizoff)*32, - §, &hw, &hitsp, &sx, &sy, &sz,CLIPMASK1); + hitscan(p->posx, p->posy, p->posz, + p->cursectnum, sintable[(p->ang+512)&2047], + sintable[p->ang&2047], (100-p->horiz-p->horizoff)*32, + §, &hw, &hitsp, &sx, &sy, &sz,CLIPMASK1); - if (sect < 0 || hitsp >= 0) - break; - - if (hw >= 0 && sector[sect].lotag > 2) - break; - - if (hw >= 0 && wall[hw].overpicnum >= 0) - if (wall[hw].overpicnum == BIGFORCE) + if (sect < 0 || hitsp >= 0) break; - j = headspritesect[sect]; - while (j >= 0) - { - 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)) + if (hw >= 0 && sector[sect].lotag > 2) 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)) - { - p->posz = p->oposz; - p->poszv = 0; - (*kb) = 1; - if (aplWeaponInitialSound[p->curr_weapon][snum]) + if (hw >= 0 && wall[hw].overpicnum >= 0) + if (wall[hw].overpicnum == BIGFORCE) + break; + + j = headspritesect[sect]; + while (j >= 0) + { + 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)) { - spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + p->posz = p->oposz; + p->poszv = 0; + (*kb) = 1; + if (aplWeaponInitialSound[p->curr_weapon][snum]) + { + spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + } } - } - } - break; - - case PISTOL_WEAPON: - case CHAINGUN_WEAPON: - case SHRINKER_WEAPON: - case GROW_WEAPON: - case FREEZE_WEAPON: - case RPG_WEAPON: - OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); - if (p->ammo_amount[p->curr_weapon] > 0) - { - (*kb) = 1; - if (aplWeaponInitialSound[p->curr_weapon][snum]) - { - spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); } - } - break; + break; - case DEVISTATOR_WEAPON: - OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); - if (p->ammo_amount[p->curr_weapon] > 0) - { - (*kb) = 1; - p->hbomb_hold_delay = !p->hbomb_hold_delay; - if (aplWeaponInitialSound[p->curr_weapon][snum]) + case PISTOL_WEAPON: + case CHAINGUN_WEAPON: + case SHRINKER_WEAPON: + case GROW_WEAPON: + case FREEZE_WEAPON: + case RPG_WEAPON: + OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); + if (p->ammo_amount[p->curr_weapon] > 0) { - spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + (*kb) = 1; + if (aplWeaponInitialSound[p->curr_weapon][snum]) + { + spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + } } - } - break; + break; - case KNEE_WEAPON: - OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); - if (p->quick_kick == 0) - { - (*kb) = 1; - if (aplWeaponInitialSound[p->curr_weapon][snum]) + case DEVISTATOR_WEAPON: + OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); + if (p->ammo_amount[p->curr_weapon] > 0) { - spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + (*kb) = 1; + p->hbomb_hold_delay = !p->hbomb_hold_delay; + if (aplWeaponInitialSound[p->curr_weapon][snum]) + { + spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + } } - } - break; + break; + + case KNEE_WEAPON: + OnEvent(EVENT_FIREWEAPON, p->i, snum, -1); + if (p->quick_kick == 0) + { + (*kb) = 1; + if (aplWeaponInitialSound[p->curr_weapon][snum]) + { + spritesound(aplWeaponInitialSound[p->curr_weapon][snum], pi); + } + } + break; } } } @@ -5093,73 +5143,92 @@ int getspritescore(long snum, long 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); } @@ -5209,7 +5278,13 @@ void computergetinput(long snum, input *syn) damyang = sprite[p->i].ang; damysect = sprite[p->i].sectnum; if ((numplayers >= 2) && (snum == myconnectindex)) - { x1 = myx; y1 = myy; z1 = myz+PHEIGHT; damyang = myang; damysect = mycursectnum; } + { + x1 = myx; + y1 = myy; + z1 = myz+PHEIGHT; + damyang = myang; + damysect = mycursectnum; + } if (!(numframes&7)) { @@ -5235,7 +5310,11 @@ void computergetinput(long snum, input *syn) if (!cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[ps[i].i].sectnum)) dist <<= 1; - if (dist < j) { j = dist; goalplayer[snum] = i; } + if (dist < j) + { + j = dist; + goalplayer[snum] = i; + } } } @@ -5252,16 +5331,21 @@ void computergetinput(long snum, input *syn) { 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) { @@ -5274,7 +5358,8 @@ void computergetinput(long snum, input *syn) { dx = sintable[(sprite[j].ang+512)&2047]; dy = sintable[sprite[j].ang&2047]; - if ((x1-x3)*dy > (y1-y3)*dx) i = -k*512; else i = k*512; + if ((x1-x3)*dy > (y1-y3)*dx) i = -k*512; + else i = k*512; syn->fvel -= mulscale17(dy,i); syn->svel += mulscale17(dx,i); } @@ -5319,15 +5404,22 @@ void computergetinput(long snum, input *syn) fightdist = fdmatrix[p->curr_weapon][ps[goalplayer[snum]].curr_weapon]; if (fightdist < 128) fightdist = 128; - dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); if (dist == 0) dist = 1; + dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); + if (dist == 0) dist = 1; daang = getangle(x2+(ps[goalplayer[snum]].posxv>>14)-x1,y2+(ps[goalplayer[snum]].posyv>>14)-y1); zang = 100-((z2-z1)*8)/dist; fightdist = max(fightdist,(klabs(z2-z1)>>4)); if (sprite[ps[goalplayer[snum]].i].yrepeat < 32) - { fightdist = 0; syn->bits &= ~(1<<2); } + { + fightdist = 0; + syn->bits &= ~(1<<2); + } if (sprite[ps[goalplayer[snum]].i].pal == 1) - { fightdist = 0; syn->bits &= ~(1<<2); } + { + fightdist = 0; + syn->bits &= ~(1<<2); + } if (dist < 256) syn->bits |= (1<<22); @@ -5346,7 +5438,8 @@ void computergetinput(long snum, input *syn) i += sintable[((j+15685)<<3)&2047]; dx = sintable[(sprite[ps[goalplayer[snum]].i].ang+512)&2047]; dy = sintable[sprite[ps[goalplayer[snum]].i].ang&2047]; - if ((x1-x2)*dy > (y1-y2)*dx) i += 8192; else i -= 8192; + if ((x1-x2)*dy > (y1-y2)*dx) i += 8192; + else i -= 8192; syn->fvel += ((sintable[(daang+1024)&2047]*i)>>17); syn->svel += ((sintable[(daang+512)&2047]*i)>>17); } @@ -5374,7 +5467,8 @@ void computergetinput(long snum, input *syn) endwall = startwall + sector[searchsect[splc]].wallnum; for (i=startwall,wal=&wall[startwall];inextsector; if (j < 0) continue; + j = wal->nextsector; + if (j < 0) continue; dx = ((wall[wal->point2].x+wal->x)>>1); dy = ((wall[wal->point2].y+wal->y)>>1); @@ -5411,7 +5505,8 @@ void computergetinput(long snum, input *syn) startwall = sector[startsect].wallptr; endwall = startwall+sector[startsect].wallnum; - l = 0; k = startwall; + l = 0; + k = startwall; for (i=startwall;i= dy*(x2-wall[i].x)) if ((x3-x1)*(wall[i].y-y1) <= (y3-y1)*(wall[i].x-x1)) if ((x3-x1)*(wall[wall[i].point2].y-y1) >= (y3-y1)*(wall[wall[i].point2].x-x1)) - { k = i; break; } + { + k = i; + break; + } dist = ksqrt(dx*dx+dy*dy); - if (dist > l) { l = dist; k = i; } + if (dist > l) + { + l = dist; + k = i; + } } goalwall[snum] = k; @@ -5460,14 +5562,18 @@ void computergetinput(long snum, input *syn) goalsect[snum] = searchsect[k]; startwall = sector[startsect].wallptr; endwall = startwall+sector[startsect].wallnum; - l = 0; k = startwall; + l = 0; + k = startwall; for (i=startwall;i l)) - { l = dist; k = i; } + { + l = dist; + k = i; + } } goalwall[snum] = k; @@ -5495,14 +5601,21 @@ void computergetinput(long snum, input *syn) 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; } + { + goalx[snum] = sprite[j].x; + goaly[snum] = sprite[j].y; + goalz[snum] = sprite[j].z; + goalsprite[snum] = j; + break; + } } } } x2 = goalx[snum]; y2 = goaly[snum]; - dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); if (!dist) return; + dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); + if (!dist) return; daang = getangle(x2-x1,y2-y1); syn->fvel += (x2-x1)*2047/dist; syn->svel += (y2-y1)*2047/dist; @@ -5511,11 +5624,17 @@ void computergetinput(long snum, input *syn) else goalsprite[snum] = -1; - x3 = p->posx; y3 = p->posy; z3 = p->posz; dasect = p->cursectnum; + x3 = p->posx; + y3 = p->posy; + z3 = p->posz; + dasect = p->cursectnum; i = clipmove(&x3,&y3,&z3,&dasect,p->posxv,p->posyv,164L,4L<<8,4L<<8,CLIPMASK0); if (!i) { - x3 = p->posx; y3 = p->posy; z3 = p->posz+(24<<8); dasect = p->cursectnum; + x3 = p->posx; + y3 = p->posy; + z3 = p->posz+(24<<8); + dasect = p->cursectnum; i = clipmove(&x3,&y3,&z3,&dasect,p->posxv,p->posyv,164L,4L<<8,4L<<8,CLIPMASK0); } if (i) @@ -5547,7 +5666,12 @@ void computergetinput(long snum, input *syn) if ((clipmovecount[snum]&31) == 2) syn->bits |= (1<<29); if ((clipmovecount[snum]&31) == 17) syn->bits |= (1<<22); - if (clipmovecount[snum] > 32) { goalsect[snum] = -1; goalwall[snum] = -1; clipmovecount[snum] = 0; } + if (clipmovecount[snum] > 32) + { + goalsect[snum] = -1; + goalwall[snum] = -1; + clipmovecount[snum] = 0; + } goalsprite[snum] = -1; } @@ -5558,7 +5682,8 @@ void computergetinput(long snum, input *syn) { x2 = goalx[snum]; y2 = goaly[snum]; - dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); if (!dist) return; + dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); + if (!dist) return; daang = getangle(x2-x1,y2-y1); if ((goalwall[snum] >= 0) && (dist < 4096)) daang = ((getangle(wall[wall[goalwall[snum]].point2].x-wall[goalwall[snum]].x,wall[wall[goalwall[snum]].point2].y-wall[goalwall[snum]].y)+1536)&2047); diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index b7bccfb4a..975fd0fbc 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -35,22 +35,29 @@ static int precachecount; static void tloadtile(short tilenume, char type) { - if ((picanm[tilenume]&63) > 0) { + if ((picanm[tilenume]&63) > 0) + { int i,j; - if ((picanm[tilenume]&192)==192) { + if ((picanm[tilenume]&192)==192) + { i = tilenume - (picanm[tilenume]&63); j = tilenume; - } else { + } + else + { i = tilenume; j = tilenume + (picanm[tilenume]&63); } - for (;i<=j;i++) { + for (;i<=j;i++) + { if (!(gotpic[i>>3] & pow2char[i&7])) precachecount++; gotpic[i>>3] |= pow2char[i&7]; precachehightile[type][i>>3] |= pow2char[i&7]; } - } else { + } + else + { if (!(gotpic[tilenume>>3] & pow2char[tilenume&7])) precachecount++; gotpic[tilenume>>3] |= pow2char[tilenume&7]; precachehightile[type][tilenume>>3] |= pow2char[tilenume&7]; @@ -72,115 +79,124 @@ void cachespritenum(short i) switch (dynamictostatic[PN]) { - case HYDRENT__STATIC: - tloadtile(BROKEFIREHYDRENT,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); - break; - case STALL__STATIC: - tloadtile(STALLBROKE,1); - for (j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1); - break; - case RUBBERCAN__STATIC: - maxc = 2; - break; - case TOILETWATER__STATIC: - maxc = 4; - break; - case FEMPIC1__STATIC: - maxc = 44; - break; - case LIZTROOP__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPONTOILET__STATIC: - case LIZTROOPDUCKING__STATIC: - for (j = LIZTROOP; j < (LIZTROOP+72); j++) tloadtile(j,1); - for (j=HEADJIB1;j 1) - { + case HYDRENT__STATIC: + tloadtile(BROKEFIREHYDRENT,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); + break; + case STALL__STATIC: + tloadtile(STALLBROKE,1); + for (j = TOILETWATER; j < (TOILETWATER+4); j++) tloadtile(j,1); + break; + case RUBBERCAN__STATIC: + maxc = 2; + break; + case TOILETWATER__STATIC: + maxc = 4; + break; + case FEMPIC1__STATIC: + maxc = 44; + break; + case LIZTROOP__STATIC: + case LIZTROOPRUNNING__STATIC: + case LIZTROOPSHOOT__STATIC: + case LIZTROOPJETPACK__STATIC: + case LIZTROOPONTOILET__STATIC: + case LIZTROOPDUCKING__STATIC: + for (j = LIZTROOP; j < (LIZTROOP+72); j++) tloadtile(j,1); + for (j=HEADJIB1;j 1) + { + maxc = 5; + for (j = 1420;j < 1420+106; j++) tloadtile(j,1); + } + break; + case ATOMICHEALTH__STATIC: + maxc = 14; + break; + case DRONE__STATIC: + maxc = 10; + break; + case EXPLODINGBARREL__STATIC: + case SEENINE__STATIC: + case OOZFILTER__STATIC: + maxc = 3; + break; + case NUKEBARREL__STATIC: + case CAMERA1__STATIC: + 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 GROWSPRITEICON__STATIC: + 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; } @@ -274,7 +290,10 @@ void precachenecessarysounds(void) { j++; if ((j&7) == 0) - { handleevents(); getpackets(); } + { + handleevents(); + getpackets(); + } getsound(i); } } @@ -298,7 +317,8 @@ void cacheit(void) { tloadtile(wall[i].picnum, 0); - if (wall[i].overpicnum >= 0) { + if (wall[i].overpicnum >= 0) + { tloadtile(wall[i].overpicnum, 0); } } @@ -325,17 +345,21 @@ void cacheit(void) tc = totalclock; j = 0; - for (i=0;i>3]) { + 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); #if defined(POLYMOST) && defined(USE_OPENGL) - if (useprecache && !KB_KeyPressed(sc_Space)) { + if (useprecache && !KB_KeyPressed(sc_Space)) + { if (precachehightile[0][i>>3] & pow2char[i&7]) for (k=0; k TICRATE/4) { + if ((j&7) == 0) + { + handleevents(); + getpackets(); + } + if (totalclock - tc > TICRATE/4) + { sprintf(tempbuf,"Loading textures ... %ld%%\n",min(100,100*pc/precachecount)); dofrontscreens(tempbuf); tc = totalclock; @@ -369,7 +399,9 @@ void xyzmirror(short i,short wn) setviewtotile(wn,tilesizy[wn],tilesizx[wn]); drawrooms(SX,SY,SZ,SA,100+sprite[i].shade,SECT); - display_mirror = 1; animatesprites(SX,SY,SA,65536L); display_mirror = 0; + display_mirror = 1; + animatesprites(SX,SY,SA,65536L); + display_mirror = 0; drawmasks(); setviewback(); @@ -391,7 +423,8 @@ void vscrn(void) x1 = scale(ss,xdim,160); x2 = xdim-x1; - y1 = ss; y2 = 200; + y1 = ss; + y2 = 200; if (ud.screen_size > 0 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_FRAGBAR) && ud.multimode > 1) { j = 0; @@ -440,7 +473,8 @@ void pickrandomspot(short snum) break; } } - } else i = TRAND%numplayersprites; + } + else i = TRAND%numplayersprites; } else i = snum; @@ -596,9 +630,12 @@ void resetinventory(short snum) p->inven_icon = 0; p->boot_amount = 0; - p->scuba_on = 0;p->scuba_amount = 0; - p->heat_amount = 0;p->heat_on = 0; - p->jetpack_on = 0;p->jetpack_amount = 0; + p->scuba_on = 0; + p->scuba_amount = 0; + p->heat_amount = 0; + p->heat_on = 0; + p->jetpack_on = 0; + p->jetpack_amount = 0; p->shield_amount = max_armour_amount; p->holoduke_on = -1; p->holoduke_amount = 0; @@ -682,20 +719,32 @@ void setupbackdrop(short sky) switch (dynamictostatic[sky]) { - case CLOUDYOCEAN__STATIC: - parallaxyscale = 65536L; - break; - case MOONSKY1__STATIC : - pskyoff[6]=1; pskyoff[1]=2; pskyoff[4]=2; pskyoff[2]=3; - break; - case BIGORBIT1__STATIC: // orbit - pskyoff[5]=1; pskyoff[6]=2; pskyoff[7]=3; pskyoff[2]=4; - break; - case LA__STATIC: - parallaxyscale = 16384+1024; - pskyoff[0]=1; pskyoff[1]=2; pskyoff[2]=1; pskyoff[3]=3; - pskyoff[4]=4; pskyoff[5]=0; pskyoff[6]=2; pskyoff[7]=3; - break; + case CLOUDYOCEAN__STATIC: + parallaxyscale = 65536L; + break; + case MOONSKY1__STATIC : + pskyoff[6]=1; + pskyoff[1]=2; + pskyoff[4]=2; + pskyoff[2]=3; + break; + case BIGORBIT1__STATIC: // orbit + pskyoff[5]=1; + pskyoff[6]=2; + pskyoff[7]=3; + pskyoff[2]=4; + break; + case LA__STATIC: + parallaxyscale = 16384+1024; + pskyoff[0]=1; + pskyoff[1]=2; + pskyoff[2]=1; + pskyoff[3]=3; + pskyoff[4]=4; + pskyoff[5]=0; + pskyoff[6]=2; + pskyoff[7]=3; + break; } pskybits=3; @@ -721,11 +770,11 @@ void prelevel(char g) switch (sector[i].lotag) { - case 20: - case 22: - if (sector[i].floorz > sector[i].ceilingz) - sector[i].lotag |= 32768; - continue; + case 20: + case 22: + if (sector[i].floorz > sector[i].ceilingz) + sector[i].lotag |= 32768; + continue; } if (sector[i].ceilingstat&1) @@ -772,37 +821,37 @@ void prelevel(char g) } else switch (dynamictostatic[PN]) { - case GPSPEED__STATIC: - sector[SECT].extra = SLT; - deletesprite(i); - break; + case GPSPEED__STATIC: + sector[SECT].extra = SLT; + deletesprite(i); + break; - case CYCLER__STATIC: - if (numcyclers >= MAXCYCLERS) - { - Bsprintf(tempbuf,"\nToo many cycling sectors (%d max).",MAXCYCLERS); - gameexit(tempbuf); - } - cyclers[numcyclers][0] = SECT; - cyclers[numcyclers][1] = SLT; - cyclers[numcyclers][2] = SS; - cyclers[numcyclers][3] = sector[SECT].floorshade; - cyclers[numcyclers][4] = SHT; - cyclers[numcyclers][5] = (SA == 1536); - numcyclers++; - deletesprite(i); - break; + case CYCLER__STATIC: + if (numcyclers >= MAXCYCLERS) + { + Bsprintf(tempbuf,"\nToo many cycling sectors (%d max).",MAXCYCLERS); + gameexit(tempbuf); + } + cyclers[numcyclers][0] = SECT; + cyclers[numcyclers][1] = SLT; + cyclers[numcyclers][2] = SS; + cyclers[numcyclers][3] = sector[SECT].floorshade; + cyclers[numcyclers][4] = SHT; + cyclers[numcyclers][5] = (SA == 1536); + numcyclers++; + deletesprite(i); + break; - case SECTOREFFECTOR__STATIC: - case ACTIVATOR__STATIC: - case TOUCHPLATE__STATIC: - case ACTIVATORLOCKED__STATIC: - case MUSICANDSFX__STATIC: - case LOCATORS__STATIC: - case MASTERSWITCH__STATIC: - case RESPAWN__STATIC: - sprite[i].cstat = 0; - break; + case SECTOREFFECTOR__STATIC: + case ACTIVATOR__STATIC: + case TOUCHPLATE__STATIC: + case ACTIVATORLOCKED__STATIC: + case MUSICANDSFX__STATIC: + case LOCATORS__STATIC: + case MASTERSWITCH__STATIC: + case RESPAWN__STATIC: + sprite[i].cstat = 0; + break; } i = nexti; } @@ -831,39 +880,39 @@ void prelevel(char g) { switch (dynamictostatic[PN-1]) { - case DIPSWITCH__STATIC: - case DIPSWITCH2__STATIC: - case PULLSWITCH__STATIC: - case HANDSWITCH__STATIC: - case SLOTDOOR__STATIC: - case LIGHTSWITCH__STATIC: - case SPACELIGHTSWITCH__STATIC: - case SPACEDOORSWITCH__STATIC: - case FRANKENSTINESWITCH__STATIC: - case LIGHTSWITCH2__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: - for (j=0;j 64) - gameexit("\nToo many switches (64 max)."); - - j = headspritestat[3]; - while (j >= 0) + if (j == lotaglist) { - if (sprite[j].lotag == 12 && sprite[j].hitag == SLT) - hittype[j].temp_data[0] = 1; - j = nextspritestat[j]; + lotags[lotaglist] = SLT; + lotaglist++; + if (lotaglist > 64) + gameexit("\nToo many switches (64 max)."); + + j = headspritestat[3]; + while (j >= 0) + { + if (sprite[j].lotag == 12 && sprite[j].hitag == SLT) + hittype[j].temp_data[0] = 1; + j = nextspritestat[j]; + } } - } - break; + break; } i = nextspritestat[i]; } @@ -901,110 +950,111 @@ void prelevel(char g) animwall[numanimwalls].tag = 0; animwall[numanimwalls].wallnum = 0; switchpicnum = wal->overpicnum; - if ((wal->overpicnum > W_FORCEFIELD)&&(wal->overpicnum <= W_FORCEFIELD+2)) { + if ((wal->overpicnum > W_FORCEFIELD)&&(wal->overpicnum <= W_FORCEFIELD+2)) + { switchpicnum = W_FORCEFIELD; } switch (dynamictostatic[switchpicnum]) { - case FANSHADOW__STATIC: - case FANSPRITE__STATIC: - wall->cstat |= 65; - animwall[numanimwalls].wallnum = i; - numanimwalls++; - break; + case FANSHADOW__STATIC: + case FANSPRITE__STATIC: + wall->cstat |= 65; + animwall[numanimwalls].wallnum = i; + numanimwalls++; + break; - case W_FORCEFIELD__STATIC: - if (wal->overpicnum==W_FORCEFIELD__STATIC) - for (j=0;j<3;j++) - tloadtile(W_FORCEFIELD+j, 0); - if (wal->shade > 31) - wal->cstat = 0; - else wal->cstat |= 85+256; + case W_FORCEFIELD__STATIC: + if (wal->overpicnum==W_FORCEFIELD__STATIC) + for (j=0;j<3;j++) + tloadtile(W_FORCEFIELD+j, 0); + if (wal->shade > 31) + wal->cstat = 0; + else wal->cstat |= 85+256; - if (wal->lotag && wal->nextwall >= 0) - wall[wal->nextwall].lotag = - wal->lotag; + if (wal->lotag && wal->nextwall >= 0) + wall[wal->nextwall].lotag = + wal->lotag; - case BIGFORCE__STATIC: + case BIGFORCE__STATIC: - animwall[numanimwalls].wallnum = i; - numanimwalls++; + animwall[numanimwalls].wallnum = i; + numanimwalls++; - continue; + continue; } wal->extra = -1; switch (dynamictostatic[wal->picnum]) { - case WATERTILE2__STATIC: - for (j=0;j<3;j++) - tloadtile(wal->picnum+j, 0); - break; + case WATERTILE2__STATIC: + for (j=0;j<3;j++) + tloadtile(wal->picnum+j, 0); + break; - case TECHLIGHT2__STATIC: - case TECHLIGHT4__STATIC: - tloadtile(wal->picnum, 0); - break; - case W_TECHWALL1__STATIC: - case W_TECHWALL2__STATIC: - case W_TECHWALL3__STATIC: - case W_TECHWALL4__STATIC: - animwall[numanimwalls].wallnum = i; - // animwall[numanimwalls].tag = -1; - numanimwalls++; - break; - case SCREENBREAK6__STATIC: - case SCREENBREAK7__STATIC: - case SCREENBREAK8__STATIC: - for (j=SCREENBREAK6;jpicnum, 0); + break; + case W_TECHWALL1__STATIC: + case W_TECHWALL2__STATIC: + case W_TECHWALL3__STATIC: + case W_TECHWALL4__STATIC: + animwall[numanimwalls].wallnum = i; + // animwall[numanimwalls].tag = -1; + numanimwalls++; + break; + case SCREENBREAK6__STATIC: + case SCREENBREAK7__STATIC: + case SCREENBREAK8__STATIC: + for (j=SCREENBREAK6;jextra = wal->picnum; - animwall[numanimwalls].tag = -1; - if (ud.lockout) - { - if (wal->picnum == FEMPIC1) - wal->picnum = BLANKSCREEN; - else wal->picnum = SCREENBREAK6; - } + wal->extra = wal->picnum; + animwall[numanimwalls].tag = -1; + if (ud.lockout) + { + if (wal->picnum == FEMPIC1) + wal->picnum = BLANKSCREEN; + else wal->picnum = SCREENBREAK6; + } - animwall[numanimwalls].wallnum = i; - animwall[numanimwalls].tag = wal->picnum; - numanimwalls++; - break; + animwall[numanimwalls].wallnum = i; + animwall[numanimwalls].tag = wal->picnum; + numanimwalls++; + break; - case SCREENBREAK1__STATIC: - case SCREENBREAK2__STATIC: - case SCREENBREAK3__STATIC: - case SCREENBREAK4__STATIC: - case SCREENBREAK5__STATIC: + case SCREENBREAK1__STATIC: + case SCREENBREAK2__STATIC: + case SCREENBREAK3__STATIC: + case SCREENBREAK4__STATIC: + case SCREENBREAK5__STATIC: - case SCREENBREAK9__STATIC: - case SCREENBREAK10__STATIC: - case SCREENBREAK11__STATIC: - case SCREENBREAK12__STATIC: - case SCREENBREAK13__STATIC: - case SCREENBREAK14__STATIC: - case SCREENBREAK15__STATIC: - case SCREENBREAK16__STATIC: - case SCREENBREAK17__STATIC: - case SCREENBREAK18__STATIC: - case SCREENBREAK19__STATIC: + case SCREENBREAK9__STATIC: + case SCREENBREAK10__STATIC: + case SCREENBREAK11__STATIC: + case SCREENBREAK12__STATIC: + case SCREENBREAK13__STATIC: + case SCREENBREAK14__STATIC: + case SCREENBREAK15__STATIC: + case SCREENBREAK16__STATIC: + case SCREENBREAK17__STATIC: + case SCREENBREAK18__STATIC: + case SCREENBREAK19__STATIC: - animwall[numanimwalls].wallnum = i; - animwall[numanimwalls].tag = wal->picnum; - numanimwalls++; - break; + animwall[numanimwalls].wallnum = i; + animwall[numanimwalls].tag = wal->picnum; + numanimwalls++; + break; } } @@ -1027,8 +1077,16 @@ void newgame(char vn,char ln,char sk) short i; if (globalskillsound >= 0 && FXDevice >= 0 && SoundToggle) - while (issoundplaying(-1,globalskillsound)) { handleevents(); getpackets(); } - else { handleevents(); getpackets(); } + while (issoundplaying(-1,globalskillsound)) + { + handleevents(); + getpackets(); + } + else + { + handleevents(); + getpackets(); + } globalskillsound = -1; waitforeverybody(); @@ -1238,8 +1296,10 @@ void resetpspritevars(char g) { int k; - for (k=0;k= 17) which_palookup = 9; @@ -1260,10 +1320,12 @@ void resetpspritevars(char g) { 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]; } @@ -1378,7 +1440,11 @@ void waitforeverybody() 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 ((!networkmode) && (myconnectindex != connecthead)) + { + i = -1; + break; + } //slaves in M/S mode only wait for master } if (i < 0) return; @@ -1391,7 +1457,8 @@ void dofrontscreens(char *statustext) if (ud.recstat != 2) { - if (!statustext) { + if (!statustext) + { //ps[myconnectindex].palette = palette; setgamepalette(&ps[myconnectindex], palette, 1); // JBF 20040308 fadepal(0,0,0, 0,64,7); @@ -1548,7 +1615,8 @@ int enterlevel(char g) vscrn(); ud.screen_size = i; - if (!VOLUMEONE) { + if (!VOLUMEONE) + { if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0) { @@ -1557,12 +1625,20 @@ int enterlevel(char g) initprintf("Map %s not found!\n",boardfilename); //gameexit(tempbuf); return 1; - } else { + } + else + { char *p; strcpy(levname, boardfilename); p = Bstrrchr(levname,'.'); if (!p) strcat(levname,".mhk"); - else { p[1]='m'; p[2]='h'; p[3]='k'; p[4]=0; } + else + { + p[1]='m'; + p[2]='h'; + p[3]='k'; + p[4]=0; + } if (!loadmaphack(levname)) initprintf("Loaded map hack file %s\n",levname); } } @@ -1571,16 +1647,26 @@ int enterlevel(char g) initprintf("Map %s not found!\n",level_file_names[(ud.volume_number*11)+ud.level_number]); //gameexit(tempbuf); return 1; - } else { + } + else + { char *p; strcpy(levname, level_file_names[(ud.volume_number*11)+ud.level_number]); p = Bstrrchr(levname,'.'); if (!p) strcat(levname,".mhk"); - else { p[1]='m'; p[2]='h'; p[3]='k'; p[4]=0; } + else + { + p[1]='m'; + p[2]='h'; + p[3]='k'; + p[4]=0; + } if (!loadmaphack(levname)) initprintf("Loaded map hack file %s\n",levname); } - } else { + } + else + { l = strlen(level_file_names[(ud.volume_number*11)+ud.level_number]); copybufbyte(level_file_names[(ud.volume_number*11)+ud.level_number],&levname[0],l); @@ -1592,11 +1678,19 @@ int enterlevel(char g) initprintf("Map %s not found!\n",level_file_names[(ud.volume_number*11)+ud.level_number]); //gameexit(tempbuf); return 1; - } else { + } + else + { char *p; p = Bstrrchr(levname,'.'); if (!p) strcat(levname,".mhk"); - else { p[1]='m'; p[2]='h'; p[3]='k'; p[4]=0; } + else + { + p[1]='m'; + p[2]='h'; + p[3]='k'; + p[4]=0; + } if (!loadmaphack(levname)) initprintf("Loaded map hack file %s\n",levname); } } @@ -1636,23 +1730,24 @@ int enterlevel(char g) if ((ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART) opendemowrite(); - if (VOLUMEONE) { + if (VOLUMEONE) + { 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]) { - case HURTRAIL__STATIC: - case FLOORSLIME__STATIC: - case FLOORPLASMA__STATIC: - resetweapons(i); - resetinventory(i); - ps[i].gotweapon[PISTOL_WEAPON] = 0; - ps[i].ammo_amount[PISTOL_WEAPON] = 0; - ps[i].curr_weapon = KNEE_WEAPON; - ps[i].kickback_pic = 0; - break; + case HURTRAIL__STATIC: + case FLOORSLIME__STATIC: + case FLOORPLASMA__STATIC: + resetweapons(i); + resetinventory(i); + ps[i].gotweapon[PISTOL_WEAPON] = 0; + ps[i].ammo_amount[PISTOL_WEAPON] = 0; + ps[i].curr_weapon = KNEE_WEAPON; + ps[i].kickback_pic = 0; + break; } //PREMAP.C - replace near the my's at the end of the file diff --git a/polymer/eduke32/source/rts.c b/polymer/eduke32/source/rts.c index 53158b616..93a4435cc 100644 --- a/polymer/eduke32/source/rts.c +++ b/polymer/eduke32/source/rts.c @@ -72,7 +72,8 @@ int32 RTS_AddFile(char *filename) // FIXME: shared opens handle = kopen4load(filename, 0); - if (handle < 0) { + if (handle < 0) + { initprintf("RTS file %s was not found\n",filename); return -1; } @@ -82,7 +83,8 @@ int32 RTS_AddFile(char *filename) // WAD file initprintf(" Adding %s.\n",filename); kread(handle, &header, sizeof(header)); - if (strncmp(header.identification,"IWAD",4)) { + if (strncmp(header.identification,"IWAD",4)) + { initprintf("RTS file %s doesn't have IWAD id\n",filename); kclose(handle); return -1; @@ -91,7 +93,8 @@ int32 RTS_AddFile(char *filename) header.infotableofs = IntelLong(header.infotableofs); length = header.numlumps*sizeof(filelump_t); fileinfo = fileinfoo = (filelump_t*)malloc(length); - if (!fileinfo) { + if (!fileinfo) + { initprintf("RTS file could not allocate header info\n"); kclose(handle); return -1; @@ -103,7 +106,8 @@ int32 RTS_AddFile(char *filename) // Fill in lumpinfo // lump_p = realloc(lumpinfo, (numlumps + header.numlumps)*sizeof(lumpinfo_t)); - if (!lump_p) { + if (!lump_p) + { kclose(handle); return -1; } diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index fab19d8b6..c4122b4f8 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -41,7 +41,8 @@ int loadpheader(char spot,struct savehead *saveh) // 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; @@ -56,7 +57,8 @@ int loadpheader(char spot,struct savehead *saveh) if (kdfread(saveh->boardfn,BMAX_PATH,1,fil) != 1) goto corrupt; if (waloff[TILE_LOADSHOT] == 0) allocache(&waloff[TILE_LOADSHOT],320*200,&walock[TILE_LOADSHOT]); - tilesizx[TILE_LOADSHOT] = 200; tilesizy[TILE_LOADSHOT] = 320; + tilesizx[TILE_LOADSHOT] = 200; + tilesizy[TILE_LOADSHOT] = 320; if (kdfread((char *)waloff[TILE_LOADSHOT],320,200,fil) != 200) goto corrupt; invalidatetile(TILE_LOADSHOT,0,255); @@ -133,7 +135,8 @@ int loadplayer(signed char spot) ready2send = 1; FTA(124,&ps[myconnectindex]); return 1; - } else ud.multimode = nump; + } + else ud.multimode = nump; if (numplayers > 1) { @@ -151,9 +154,12 @@ int loadplayer(signed char spot) clearsoundlocks(); MUSIC_StopSong(); - if (numplayers > 1) { + if (numplayers > 1) + { if (kdfread(&buf,19,1,fil) != 1) goto corrupt; - } else { + } + else + { if (kdfread(&ud.savegame[spot][0],19,1,fil) != 1) goto corrupt; } @@ -170,7 +176,8 @@ int loadplayer(signed char spot) //Fake read because lseek won't work with compression walock[TILE_LOADSHOT] = 1; if (waloff[TILE_LOADSHOT] == 0) allocache(&waloff[TILE_LOADSHOT],320*200,&walock[TILE_LOADSHOT]); - tilesizx[TILE_LOADSHOT] = 200; tilesizy[TILE_LOADSHOT] = 320; + tilesizx[TILE_LOADSHOT] = 200; + tilesizy[TILE_LOADSHOT] = 320; if (kdfread((char *)waloff[TILE_LOADSHOT],320,200,fil) != 200) goto corrupt; invalidatetile(TILE_LOADSHOT,0,255); @@ -372,13 +379,13 @@ int loadplayer(signed char spot) for (x=0;xsectnum == sprite[j].sectnum) switch (sprite[j].lotag) { - case 11: - case 30: - if (hittype[j].temp_data[4]) - return(1); - break; - case 20: - case 31: - case 32: - case 18: - if (hittype[j].temp_data[0]) - return(1); - break; + case 11: + case 30: + if (hittype[j].temp_data[4]) + return(1); + break; + case 20: + case 31: + case 32: + case 18: + if (hittype[j].temp_data[0]) + return(1); + break; } j = nextspritestat[j]; @@ -120,29 +120,29 @@ char isadoorwall(short dapic) { switch (dynamictostatic[dapic]) { - case DOORTILE1__STATIC: - case DOORTILE2__STATIC: - case DOORTILE3__STATIC: - case DOORTILE4__STATIC: - case DOORTILE5__STATIC: - case DOORTILE6__STATIC: - case DOORTILE7__STATIC: - case DOORTILE8__STATIC: - case DOORTILE9__STATIC: - case DOORTILE10__STATIC: - case DOORTILE11__STATIC: - case DOORTILE12__STATIC: - case DOORTILE14__STATIC: - case DOORTILE15__STATIC: - case DOORTILE16__STATIC: - case DOORTILE17__STATIC: - case DOORTILE18__STATIC: - case DOORTILE19__STATIC: - case DOORTILE20__STATIC: - case DOORTILE21__STATIC: - case DOORTILE22__STATIC: - case DOORTILE23__STATIC: - return 1; + case DOORTILE1__STATIC: + case DOORTILE2__STATIC: + case DOORTILE3__STATIC: + case DOORTILE4__STATIC: + case DOORTILE5__STATIC: + case DOORTILE6__STATIC: + case DOORTILE7__STATIC: + case DOORTILE8__STATIC: + case DOORTILE9__STATIC: + case DOORTILE10__STATIC: + case DOORTILE11__STATIC: + case DOORTILE12__STATIC: + case DOORTILE14__STATIC: + case DOORTILE15__STATIC: + case DOORTILE16__STATIC: + case DOORTILE17__STATIC: + case DOORTILE18__STATIC: + case DOORTILE19__STATIC: + case DOORTILE20__STATIC: + case DOORTILE21__STATIC: + case DOORTILE22__STATIC: + case DOORTILE23__STATIC: + return 1; } return 0; } @@ -151,14 +151,14 @@ char isanunderoperator(short lotag) { switch (lotag&0xff) { - case 15: - case 16: - case 17: - case 18: - case 19: - case 22: - case 26: - return 1; + case 15: + case 16: + case 17: + case 18: + case 19: + case 22: + case 26: + return 1; } return 0; } @@ -167,20 +167,20 @@ char isanearoperator(short lotag) { switch (lotag&0xff) { - case 9: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 25: - case 26: - case 29://Toothed door - return 1; + case 9: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 25: + case 26: + case 29://Toothed door + return 1; } return 0; } @@ -291,8 +291,14 @@ void doanimations(void) continue; } - if (v > 0) { a = min(a+v,animategoal[i]); } - else { a = max(a+v,animategoal[i]); } + if (v > 0) + { + a = min(a+v,animategoal[i]); + } + else + { + a = max(a+v,animategoal[i]); + } if (animateptr[i] == §or[animatesect[i]].floorz) { @@ -406,45 +412,45 @@ void animatewalls(void) switch (dynamictostatic[j]) { - case SCREENBREAK1__STATIC: - case SCREENBREAK2__STATIC: - case SCREENBREAK3__STATIC: - case SCREENBREAK4__STATIC: - case SCREENBREAK5__STATIC: + case SCREENBREAK1__STATIC: + case SCREENBREAK2__STATIC: + case SCREENBREAK3__STATIC: + case SCREENBREAK4__STATIC: + case SCREENBREAK5__STATIC: - case SCREENBREAK9__STATIC: - case SCREENBREAK10__STATIC: - case SCREENBREAK11__STATIC: - case SCREENBREAK12__STATIC: - case SCREENBREAK13__STATIC: - case SCREENBREAK14__STATIC: - case SCREENBREAK15__STATIC: - case SCREENBREAK16__STATIC: - case SCREENBREAK17__STATIC: - case SCREENBREAK18__STATIC: - case SCREENBREAK19__STATIC: + case SCREENBREAK9__STATIC: + case SCREENBREAK10__STATIC: + case SCREENBREAK11__STATIC: + case SCREENBREAK12__STATIC: + case SCREENBREAK13__STATIC: + case SCREENBREAK14__STATIC: + case SCREENBREAK15__STATIC: + case SCREENBREAK16__STATIC: + case SCREENBREAK17__STATIC: + case SCREENBREAK18__STATIC: + case SCREENBREAK19__STATIC: - if ((TRAND&255) < 16) - { - animwall[p].tag = wall[i].picnum; - wall[i].picnum = SCREENBREAK6; - } - - continue; - - case SCREENBREAK6__STATIC: - case SCREENBREAK7__STATIC: - case SCREENBREAK8__STATIC: - - 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 ((TRAND&255) < 16) + { + animwall[p].tag = wall[i].picnum; wall[i].picnum = SCREENBREAK6; - } - continue; + } + + continue; + + case SCREENBREAK6__STATIC: + case SCREENBREAK7__STATIC: + case SCREENBREAK8__STATIC: + + 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)) + wall[i].picnum = SCREENBREAK6; + } + continue; } @@ -544,429 +550,435 @@ void operatesectors(short sn,short ii) switch (sptr->lotag&(0xffff-49152)) { - case 30: - j = sector[sn].hitag; - if (hittype[j].tempang == 0 || - hittype[j].tempang == 256) + case 30: + j = sector[sn].hitag; + if (hittype[j].tempang == 0 || + hittype[j].tempang == 256) + callsound(sn,ii); + if (sprite[j].extra == 1) + sprite[j].extra = 3; + else sprite[j].extra = 1; + break; + + case 31: + + j = sector[sn].hitag; + if (hittype[j].temp_data[4] == 0) + hittype[j].temp_data[4] = 1; + callsound(sn,ii); - if (sprite[j].extra == 1) - sprite[j].extra = 3; - else sprite[j].extra = 1; - break; + break; - case 31: - - j = sector[sn].hitag; - if (hittype[j].temp_data[4] == 0) - hittype[j].temp_data[4] = 1; - - callsound(sn,ii); - break; - - case 26: //The split doors - i = getanimationgoal(&sptr->ceilingz); - if (i == -1) //if the door has stopped - { - haltsoundhack = 1; - sptr->lotag &= 0xff00; - sptr->lotag |= 22; - operatesectors(sn,ii); - sptr->lotag &= 0xff00; - sptr->lotag |= 9; - operatesectors(sn,ii); - sptr->lotag &= 0xff00; - sptr->lotag |= 26; - } - 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++) - { - 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)) + case 26: //The split doors + i = getanimationgoal(&sptr->ceilingz); + if (i == -1) //if the door has stopped { - if (wallfind[0] == -1) - wallfind[0] = i; - else wallfind[1] = i; + haltsoundhack = 1; + sptr->lotag &= 0xff00; + sptr->lotag |= 22; + operatesectors(sn,ii); + sptr->lotag &= 0xff00; + sptr->lotag |= 9; + operatesectors(sn,ii); + sptr->lotag &= 0xff00; + sptr->lotag |= 26; } - - 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(ps[sprite[ii].yvel].select_dir == 1) return; - - i = headspritesect[sn]; - while (i >= 0) - { - if (PN==SECTOREFFECTOR && SLT == 17) break; - i = nextspritesect[i]; - } - - if (sprite[ii].sectnum == sn) - { - if (activatewarpelevators(i,-1)) - activatewarpelevators(i,1); - else if (activatewarpelevators(i,1)) - activatewarpelevators(i,-1); return; - } - else + + case 9: { - if (sptr->floorz > SZ) - activatewarpelevators(i,-1); - else - activatewarpelevators(i,1); - } + long dax,day,dax2,day2,sp; + long wallfind[2]; - return; + startwall = sptr->wallptr; + endwall = startwall+sptr->wallnum-1; - case 16: - case 17: + sp = sptr->extra>>4; - i = getanimationgoal(&sptr->floorz); - - if (i == -1) - { - i = nextsectorneighborz(sn,sptr->floorz,1,1); - if (i == -1) + //first find center point by averaging all points + dax = 0L, day = 0L; + for (i=startwall;i<=endwall;i++) { - i = nextsectorneighborz(sn,sptr->floorz,1,-1); - if (i == -1) return; - j = sector[i].floorz; - setanimation(sn,&sptr->floorz,j,sptr->extra); + dax += wall[i].x; + day += wall[i].y; } - else + 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++) { - j = sector[i].floorz; - setanimation(sn,&sptr->floorz,j,sptr->extra); + 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); + } + } } - callsound(sn,ii); - } - return; - - case 18: - case 19: - - i = getanimationgoal(&sptr->floorz); - - if (i==-1) - { - i = nextsectorneighborz(sn,sptr->floorz,1,-1); - 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; - setanimation(sn,&sptr->floorz,j,q); - setanimation(sn,&sptr->ceilingz,j+l,q); - callsound(sn,ii); } return; - case 29: + case 15://Warping elevators - if (sptr->lotag&0x8000) - j = sector[nextsectorneighborz(sn,sptr->ceilingz,1,1)].floorz; - else - j = sector[nextsectorneighborz(sn,sptr->ceilingz,-1,-1)].ceilingz; + if (sprite[ii].picnum != APLAYER) return; + // if(ps[sprite[ii].yvel].select_dir == 1) return; - i = headspritestat[3]; //Effectors - while (i >= 0) - { - if ((SLT == 22) && - (SHT == sptr->hitag)) - { - sector[SECT].extra = -sector[SECT].extra; - - T1 = sn; - T2 = 1; - } - i = nextspritestat[i]; - } - - sptr->lotag ^= 0x8000; - - setanimation(sn,&sptr->ceilingz,j,sptr->extra); - - callsound(sn,ii); - - return; - - case 20: - -REDODOOR: - - if (sptr->lotag&0x8000) - { i = headspritesect[sn]; while (i >= 0) { - if (sprite[i].statnum == 3 && SLT==9) - { - j = SZ; - break; - } + if (PN==SECTOREFFECTOR && SLT == 17) break; i = nextspritesect[i]; } - if (i==-1) - j = sptr->floorz; - } - else - { - j = nextsectorneighborz(sn,sptr->ceilingz,-1,-1); - if (j >= 0) j = sector[j].ceilingz; + if (sprite[ii].sectnum == sn) + { + if (activatewarpelevators(i,-1)) + activatewarpelevators(i,1); + else if (activatewarpelevators(i,1)) + activatewarpelevators(i,-1); + return; + } else { - sptr->lotag |= 32768; - goto REDODOOR; + if (sptr->floorz > SZ) + activatewarpelevators(i,-1); + else + activatewarpelevators(i,1); } - } - sptr->lotag ^= 0x8000; + return; - setanimation(sn,&sptr->ceilingz,j,sptr->extra); - callsound(sn,ii); + case 16: + case 17: - return; + i = getanimationgoal(&sptr->floorz); - case 21: - i = getanimationgoal(&sptr->floorz); - if (i >= 0) - { - if (animategoal[sn] == sptr->ceilingz) - animategoal[i] = sector[nextsectorneighborz(sn,sptr->ceilingz,1,1)].floorz; - else animategoal[i] = sptr->ceilingz; - j = animategoal[i]; - } - else - { - if (sptr->ceilingz == sptr->floorz) + if (i == -1) + { + i = nextsectorneighborz(sn,sptr->floorz,1,1); + if (i == -1) + { + i = nextsectorneighborz(sn,sptr->floorz,1,-1); + if (i == -1) return; + j = sector[i].floorz; + setanimation(sn,&sptr->floorz,j,sptr->extra); + } + else + { + j = sector[i].floorz; + setanimation(sn,&sptr->floorz,j,sptr->extra); + } + callsound(sn,ii); + } + + return; + + case 18: + case 19: + + i = getanimationgoal(&sptr->floorz); + + if (i==-1) + { + i = nextsectorneighborz(sn,sptr->floorz,1,-1); + 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; + setanimation(sn,&sptr->floorz,j,q); + setanimation(sn,&sptr->ceilingz,j+l,q); + callsound(sn,ii); + } + return; + + case 29: + + if (sptr->lotag&0x8000) j = sector[nextsectorneighborz(sn,sptr->ceilingz,1,1)].floorz; - else j = sptr->ceilingz; + else + j = sector[nextsectorneighborz(sn,sptr->ceilingz,-1,-1)].ceilingz; + + i = headspritestat[3]; //Effectors + while (i >= 0) + { + if ((SLT == 22) && + (SHT == sptr->hitag)) + { + sector[SECT].extra = -sector[SECT].extra; + + T1 = sn; + T2 = 1; + } + i = nextspritestat[i]; + } sptr->lotag ^= 0x8000; - if (setanimation(sn,&sptr->floorz,j,sptr->extra) >= 0) - callsound(sn,ii); - } - return; + setanimation(sn,&sptr->ceilingz,j,sptr->extra); - case 22: + callsound(sn,ii); - // REDODOOR22: + return; - if ((sptr->lotag&0x8000)) - { - q = (sptr->ceilingz+sptr->floorz)>>1; - j = setanimation(sn,&sptr->floorz,q,sptr->extra); - j = setanimation(sn,&sptr->ceilingz,q,sptr->extra); - } - else - { - q = sector[nextsectorneighborz(sn,sptr->floorz,1,1)].floorz; - j = setanimation(sn,&sptr->floorz,q,sptr->extra); - q = sector[nextsectorneighborz(sn,sptr->ceilingz,-1,-1)].ceilingz; - j = setanimation(sn,&sptr->ceilingz,q,sptr->extra); - } + case 20: - sptr->lotag ^= 0x8000; +REDODOOR: - callsound(sn,ii); - - return; - - case 23: //Swingdoor - - j = -1; - q = 0; - - i = headspritestat[3]; - while (i >= 0) - { - if (SLT == 11 && SECT == sn && !T5) + if (sptr->lotag&0x8000) { - j = i; - break; + i = headspritesect[sn]; + while (i >= 0) + { + if (sprite[i].statnum == 3 && SLT==9) + { + j = SZ; + break; + } + i = nextspritesect[i]; + } + if (i==-1) + j = sptr->floorz; } - i = nextspritestat[i]; - } - if (i<0) { OSD_Printf("WARNING: SE23 i<0!\n"); return; } // JBF - l = sector[SECT].lotag&0x8000; + else + { + j = nextsectorneighborz(sn,sptr->ceilingz,-1,-1); + + if (j >= 0) j = sector[j].ceilingz; + else + { + sptr->lotag |= 32768; + goto REDODOOR; + } + } + + sptr->lotag ^= 0x8000; + + setanimation(sn,&sptr->ceilingz,j,sptr->extra); + callsound(sn,ii); + + return; + + case 21: + i = getanimationgoal(&sptr->floorz); + if (i >= 0) + { + if (animategoal[sn] == sptr->ceilingz) + animategoal[i] = sector[nextsectorneighborz(sn,sptr->ceilingz,1,1)].floorz; + else animategoal[i] = sptr->ceilingz; + j = animategoal[i]; + } + else + { + if (sptr->ceilingz == sptr->floorz) + j = sector[nextsectorneighborz(sn,sptr->ceilingz,1,1)].floorz; + else j = sptr->ceilingz; + + sptr->lotag ^= 0x8000; + + if (setanimation(sn,&sptr->floorz,j,sptr->extra) >= 0) + callsound(sn,ii); + } + return; + + case 22: + + // REDODOOR22: + + if ((sptr->lotag&0x8000)) + { + q = (sptr->ceilingz+sptr->floorz)>>1; + j = setanimation(sn,&sptr->floorz,q,sptr->extra); + j = setanimation(sn,&sptr->ceilingz,q,sptr->extra); + } + else + { + q = sector[nextsectorneighborz(sn,sptr->floorz,1,1)].floorz; + j = setanimation(sn,&sptr->floorz,q,sptr->extra); + q = sector[nextsectorneighborz(sn,sptr->ceilingz,-1,-1)].ceilingz; + j = setanimation(sn,&sptr->ceilingz,q,sptr->extra); + } + + sptr->lotag ^= 0x8000; + + callsound(sn,ii); + + return; + + case 23: //Swingdoor + + j = -1; + q = 0; - if (j >= 0) - { i = headspritestat[3]; while (i >= 0) { - if (l == (sector[SECT].lotag&0x8000) && SLT == 11 && sprite[j].hitag == SHT && !T5) + if (SLT == 11 && SECT == sn && !T5) { - if (sector[SECT].lotag&0x8000) sector[SECT].lotag &= 0x7fff; - else sector[SECT].lotag |= 0x8000; - T5 = 1; - T4 = -T4; - if (q == 0) + j = i; + break; + } + i = nextspritestat[i]; + } + if (i<0) + { + OSD_Printf("WARNING: SE23 i<0!\n"); + return; + } // JBF + l = sector[SECT].lotag&0x8000; + + if (j >= 0) + { + i = headspritestat[3]; + while (i >= 0) + { + if (l == (sector[SECT].lotag&0x8000) && SLT == 11 && sprite[j].hitag == SHT && !T5) { - callsound(sn,i); - q = 1; + if (sector[SECT].lotag&0x8000) sector[SECT].lotag &= 0x7fff; + else sector[SECT].lotag |= 0x8000; + T5 = 1; + T4 = -T4; + if (q == 0) + { + callsound(sn,i); + q = 1; + } + } + i = nextspritestat[i]; + } + } + return; + + case 25: //Subway type sliding doors + + j = headspritestat[3]; + while (j >= 0)//Find the sprite + { + if ((sprite[j].lotag) == 15 && sprite[j].sectnum == sn) + break; //Found the sectoreffector. + j = nextspritestat[j]; + } + + if (j < 0) + return; + + i = headspritestat[3]; + while (i >= 0) + { + if (SHT==sprite[j].hitag) + { + if (SLT == 15) + { + sector[SECT].lotag ^= 0x8000; // Toggle the open or close + SA += 1024; + if (T5) callsound(SECT,i); + callsound(SECT,i); + if (sector[SECT].lotag&0x8000) T5 = 1; + else T5 = 2; } } i = nextspritestat[i]; } - } - return; - - case 25: //Subway type sliding doors - - j = headspritestat[3]; - while (j >= 0)//Find the sprite - { - if ((sprite[j].lotag) == 15 && sprite[j].sectnum == sn) - break; //Found the sectoreffector. - j = nextspritestat[j]; - } - - if (j < 0) return; - i = headspritestat[3]; - while (i >= 0) - { - if (SHT==sprite[j].hitag) + case 27: //Extended bridge + + j = headspritestat[3]; + while (j >= 0) { - if (SLT == 15) + if ((sprite[j].lotag&0xff)==20 && sprite[j].sectnum == sn) //Bridge { - sector[SECT].lotag ^= 0x8000; // Toggle the open or close - SA += 1024; - if (T5) callsound(SECT,i); - callsound(SECT,i); - if (sector[SECT].lotag&0x8000) T5 = 1; - else T5 = 2; + + sector[sn].lotag ^= 0x8000; + if (sector[sn].lotag&0x8000) //OPENING + hittype[j].temp_data[0] = 1; + else hittype[j].temp_data[0] = 2; + callsound(sn,ii); + break; } + j = nextspritestat[j]; } - i = nextspritestat[i]; - } - return; + return; - case 27: //Extended bridge - j = headspritestat[3]; - while (j >= 0) - { - if ((sprite[j].lotag&0xff)==20 && sprite[j].sectnum == sn) //Bridge + case 28: + //activate the rest of them + + j = headspritesect[sn]; + while (j >= 0) { - - sector[sn].lotag ^= 0x8000; - if (sector[sn].lotag&0x8000) //OPENING - hittype[j].temp_data[0] = 1; - else hittype[j].temp_data[0] = 2; - callsound(sn,ii); - break; + if (sprite[j].statnum==3 && (sprite[j].lotag&0xff)==21) + break; //Found it + j = nextspritesect[j]; } - j = nextspritestat[j]; - } - return; + j = sprite[j].hitag; - case 28: - //activate the rest of them + l = headspritestat[3]; + while (l >= 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]; + } + callsound(sn,ii); - j = headspritesect[sn]; - while (j >= 0) - { - if (sprite[j].statnum==3 && (sprite[j].lotag&0xff)==21) - break; //Found it - j = nextspritesect[j]; - } - - j = sprite[j].hitag; - - l = headspritestat[3]; - while (l >= 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]; - } - callsound(sn,ii); - - return; + return; } } @@ -1035,22 +1047,22 @@ void operateactivators(short low,short snum) { switch (SHT) { - case 0: - break; - case 1: - if (sector[SECT].floorz != sector[SECT].ceilingz) - { - i = nextspritestat[i]; - continue; - } - break; - case 2: - if (sector[SECT].floorz == sector[SECT].ceilingz) - { - i = nextspritestat[i]; - continue; - } - break; + case 0: + break; + case 1: + if (sector[SECT].floorz != sector[SECT].ceilingz) + { + i = nextspritestat[i]; + continue; + } + break; + case 2: + if (sector[SECT].floorz == sector[SECT].ceilingz) + { + i = nextspritestat[i]; + continue; + } + break; } if (sector[sprite[i].sectnum].lotag < 3) @@ -1060,13 +1072,13 @@ void operateactivators(short low,short snum) { if (sprite[j].statnum == 3) switch (sprite[j].lotag) { - case 36: - case 31: - case 32: - case 18: - hittype[j].temp_data[0] = 1-hittype[j].temp_data[0]; - callsound(SECT,j); - break; + case 36: + case 31: + case 32: + case 18: + hittype[j].temp_data[0] = 1-hittype[j].temp_data[0]; + callsound(SECT,j); + break; } j = nextspritesect[j]; } @@ -1106,7 +1118,8 @@ void operateforcefields(short s, short low) i = animwall[p].wallnum; if (low == wall[i].lotag || low == -1) - if (((wall[i].overpicnum >= W_FORCEFIELD)&&(wall[i].overpicnum <= W_FORCEFIELD+2))||(wall[i].overpicnum == BIGFORCE)) { + if (((wall[i].overpicnum >= W_FORCEFIELD)&&(wall[i].overpicnum <= W_FORCEFIELD+2))||(wall[i].overpicnum == BIGFORCE)) + { animwall[p].tag = 0; @@ -1138,7 +1151,8 @@ char checkhitswitch(short snum,long w,char switchtype) 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 +1161,8 @@ 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; @@ -1173,159 +1188,165 @@ char checkhitswitch(short snum,long w,char switchtype) || (picnum==LOCKSWITCH1+1) || (picnum==POWERSWITCH2+1) || (picnum==LIGHTSWITCH+1) - ) { + ) + { switchpicnum--; } - if ((picnum > MULTISWITCH)&&(picnum <= MULTISWITCH+3)) { + if ((picnum > MULTISWITCH)&&(picnum <= MULTISWITCH+3)) + { switchpicnum = MULTISWITCH; } switch (dynamictostatic[switchpicnum]) { - case DIPSWITCH__STATIC: - // case DIPSWITCH+1: - case TECHSWITCH__STATIC: - // case TECHSWITCH+1: - case ALIENSWITCH__STATIC: - // case ALIENSWITCH+1: - break; - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - if (ps[snum].access_incs == 0) - { - if (switchpal == 0) + case DIPSWITCH__STATIC: + // case DIPSWITCH+1: + case TECHSWITCH__STATIC: + // case TECHSWITCH+1: + case ALIENSWITCH__STATIC: + // case ALIENSWITCH+1: + break; + case ACCESSSWITCH__STATIC: + case ACCESSSWITCH2__STATIC: + if (ps[snum].access_incs == 0) { - if ((ps[snum].got_access&1)) - ps[snum].access_incs = 1; - else FTA(70,&ps[snum]); - } + if (switchpal == 0) + { + if ((ps[snum].got_access&1)) + ps[snum].access_incs = 1; + else FTA(70,&ps[snum]); + } - else if (switchpal == 21) - { - if (ps[snum].got_access&2) - ps[snum].access_incs = 1; - else FTA(71,&ps[snum]); - } + else if (switchpal == 21) + { + if (ps[snum].got_access&2) + ps[snum].access_incs = 1; + else FTA(71,&ps[snum]); + } - else if (switchpal == 23) - { - if (ps[snum].got_access&4) - ps[snum].access_incs = 1; - else FTA(72,&ps[snum]); - } + else if (switchpal == 23) + { + if (ps[snum].got_access&4) + ps[snum].access_incs = 1; + else FTA(72,&ps[snum]); + } - if (ps[snum].access_incs == 1) - { - if (switchtype == 0) - ps[snum].access_wallnum = w; - else - ps[snum].access_spritenum = w; - } + if (ps[snum].access_incs == 1) + { + if (switchtype == 0) + ps[snum].access_wallnum = w; + else + ps[snum].access_spritenum = w; + } - return 0; - } - case DIPSWITCH2__STATIC: - //case DIPSWITCH2+1: - case DIPSWITCH3__STATIC: - //case DIPSWITCH3+1: - case MULTISWITCH__STATIC: - //case MULTISWITCH+1: - //case MULTISWITCH+2: - //case MULTISWITCH+3: - case PULLSWITCH__STATIC: - //case PULLSWITCH+1: - case HANDSWITCH__STATIC: - //case HANDSWITCH+1: - case SLOTDOOR__STATIC: - //case SLOTDOOR+1: - case LIGHTSWITCH__STATIC: - //case LIGHTSWITCH+1: - case SPACELIGHTSWITCH__STATIC: - //case SPACELIGHTSWITCH+1: - case SPACEDOORSWITCH__STATIC: - //case SPACEDOORSWITCH+1: - case FRANKENSTINESWITCH__STATIC: - //case FRANKENSTINESWITCH+1: - case LIGHTSWITCH2__STATIC: - //case LIGHTSWITCH2+1: - case POWERSWITCH1__STATIC: - //case POWERSWITCH1+1: - case LOCKSWITCH1__STATIC: - //case LOCKSWITCH1+1: - case POWERSWITCH2__STATIC: - //case POWERSWITCH2+1: - if (check_activator_motion(lotag)) return 0; - break; - default: - if (isadoorwall(picnum) == 0) return 0; - break; + return 0; + } + case DIPSWITCH2__STATIC: + //case DIPSWITCH2+1: + case DIPSWITCH3__STATIC: + //case DIPSWITCH3+1: + case MULTISWITCH__STATIC: + //case MULTISWITCH+1: + //case MULTISWITCH+2: + //case MULTISWITCH+3: + case PULLSWITCH__STATIC: + //case PULLSWITCH+1: + case HANDSWITCH__STATIC: + //case HANDSWITCH+1: + case SLOTDOOR__STATIC: + //case SLOTDOOR+1: + case LIGHTSWITCH__STATIC: + //case LIGHTSWITCH+1: + case SPACELIGHTSWITCH__STATIC: + //case SPACELIGHTSWITCH+1: + case SPACEDOORSWITCH__STATIC: + //case SPACEDOORSWITCH+1: + case FRANKENSTINESWITCH__STATIC: + //case FRANKENSTINESWITCH+1: + case LIGHTSWITCH2__STATIC: + //case LIGHTSWITCH2+1: + case POWERSWITCH1__STATIC: + //case POWERSWITCH1+1: + case LOCKSWITCH1__STATIC: + //case LOCKSWITCH1+1: + case POWERSWITCH2__STATIC: + //case POWERSWITCH2+1: + if (check_activator_motion(lotag)) return 0; + break; + default: + if (isadoorwall(picnum) == 0) return 0; + break; } i = headspritestat[0]; while (i >= 0) { - if (lotag == SLT) { + 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)) { + if ((switchpicnum >= MULTISWITCH) && (switchpicnum <=MULTISWITCH+3)) + { sprite[i].picnum++; 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++; - numdips++; - break; - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - case SLOTDOOR__STATIC: - case LIGHTSWITCH__STATIC: - case SPACELIGHTSWITCH__STATIC: - case SPACEDOORSWITCH__STATIC: - case FRANKENSTINESWITCH__STATIC: - case LIGHTSWITCH2__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: - case HANDSWITCH__STATIC: - case PULLSWITCH__STATIC: - case DIPSWITCH2__STATIC: - case DIPSWITCH3__STATIC: - sprite[i].picnum++; - break; - default: - switch (dynamictostatic[switchpicnum-1]) { - - case TECHSWITCH__STATIC: case DIPSWITCH__STATIC: + case TECHSWITCH__STATIC: case ALIENSWITCH__STATIC: - if (switchtype == 1 && w == i) PN--; - else if (SHT == 1) correctdips++; + if (switchtype == 1 && w == i) PN++; + else if (SHT == 0) correctdips++; numdips++; break; - case PULLSWITCH__STATIC: - case HANDSWITCH__STATIC: - case LIGHTSWITCH2__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: + case ACCESSSWITCH__STATIC: + case ACCESSSWITCH2__STATIC: case SLOTDOOR__STATIC: case LIGHTSWITCH__STATIC: case SPACELIGHTSWITCH__STATIC: case SPACEDOORSWITCH__STATIC: case FRANKENSTINESWITCH__STATIC: + case LIGHTSWITCH2__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case HANDSWITCH__STATIC: + case PULLSWITCH__STATIC: case DIPSWITCH2__STATIC: case DIPSWITCH3__STATIC: - sprite[i].picnum--; + sprite[i].picnum++; + break; + default: + switch (dynamictostatic[switchpicnum-1]) + { + + case TECHSWITCH__STATIC: + case DIPSWITCH__STATIC: + case ALIENSWITCH__STATIC: + if (switchtype == 1 && w == i) PN--; + else if (SHT == 1) correctdips++; + numdips++; + break; + case PULLSWITCH__STATIC: + case HANDSWITCH__STATIC: + case LIGHTSWITCH2__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case SLOTDOOR__STATIC: + case LIGHTSWITCH__STATIC: + case SPACELIGHTSWITCH__STATIC: + case SPACEDOORSWITCH__STATIC: + case FRANKENSTINESWITCH__STATIC: + case DIPSWITCH2__STATIC: + case DIPSWITCH3__STATIC: + sprite[i].picnum--; + break; + } break; - } - break; } } i = nextspritestat[i]; @@ -1334,66 +1355,70 @@ char checkhitswitch(short snum,long w,char switchtype) for (i=0;i= MULTISWITCH) && (wall[x].picnum <=MULTISWITCH+3)) { + if (lotag == wall[x].lotag) + { + if ((wall[x].picnum >= MULTISWITCH) && (wall[x].picnum <=MULTISWITCH+3)) + { wall[x].picnum++; 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++; - numdips++; - break; - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - case SLOTDOOR__STATIC: - case LIGHTSWITCH__STATIC: - case SPACELIGHTSWITCH__STATIC: - case SPACEDOORSWITCH__STATIC: - case FRANKENSTINESWITCH__STATIC: - case LIGHTSWITCH2__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: - case HANDSWITCH__STATIC: - case PULLSWITCH__STATIC: - case DIPSWITCH2__STATIC: - case DIPSWITCH3__STATIC: - wall[x].picnum++; - break; - default: - switch (dynamictostatic[wall[x].picnum-1]) { - - case TECHSWITCH__STATIC: case DIPSWITCH__STATIC: + case TECHSWITCH__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 == 0) correctdips++; numdips++; break; - case PULLSWITCH__STATIC: - case HANDSWITCH__STATIC: - case LIGHTSWITCH2__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: + case ACCESSSWITCH__STATIC: + case ACCESSSWITCH2__STATIC: case SLOTDOOR__STATIC: case LIGHTSWITCH__STATIC: case SPACELIGHTSWITCH__STATIC: case SPACEDOORSWITCH__STATIC: case FRANKENSTINESWITCH__STATIC: + case LIGHTSWITCH2__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case HANDSWITCH__STATIC: + case PULLSWITCH__STATIC: case DIPSWITCH2__STATIC: case DIPSWITCH3__STATIC: - wall[x].picnum--; + wall[x].picnum++; + break; + default: + 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++; + numdips++; + break; + case PULLSWITCH__STATIC: + case HANDSWITCH__STATIC: + case LIGHTSWITCH2__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case SLOTDOOR__STATIC: + case LIGHTSWITCH__STATIC: + case SPACELIGHTSWITCH__STATIC: + case SPACEDOORSWITCH__STATIC: + case FRANKENSTINESWITCH__STATIC: + case DIPSWITCH2__STATIC: + case DIPSWITCH3__STATIC: + wall[x].picnum--; + break; + } break; - } - break; } } } @@ -1438,131 +1463,133 @@ char checkhitswitch(short snum,long w,char switchtype) || (picnum==LOCKSWITCH1+1) || (picnum==POWERSWITCH2+1) || (picnum==LIGHTSWITCH+1) - ) { + ) + { switchpicnum--; } - if ((picnum > MULTISWITCH)&&(picnum <= MULTISWITCH+3)) { + if ((picnum > MULTISWITCH)&&(picnum <= MULTISWITCH+3)) + { switchpicnum = MULTISWITCH; } switch (dynamictostatic[switchpicnum]) { - default: - 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 || - picnum == ALIENSWITCH || picnum == ALIENSWITCH+1 || - picnum == TECHSWITCH || picnum == TECHSWITCH+1) - { - if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+1) + default: + 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 || + picnum == ALIENSWITCH || picnum == ALIENSWITCH+1 || + picnum == TECHSWITCH || picnum == TECHSWITCH+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); + if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+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) + 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; + xyzsound(END_OF_LEVEL_WARN,ps[snum].i,sx,sy,ps[snum].posz); } - else + case DIPSWITCH2__STATIC: + //case DIPSWITCH2+1: + case DIPSWITCH3__STATIC: + //case DIPSWITCH3+1: + case MULTISWITCH__STATIC: + //case MULTISWITCH+1: + //case MULTISWITCH+2: + //case MULTISWITCH+3: + case ACCESSSWITCH__STATIC: + case ACCESSSWITCH2__STATIC: + case SLOTDOOR__STATIC: + //case SLOTDOOR+1: + case LIGHTSWITCH__STATIC: + //case LIGHTSWITCH+1: + case SPACELIGHTSWITCH__STATIC: + //case SPACELIGHTSWITCH+1: + case SPACEDOORSWITCH__STATIC: + //case SPACEDOORSWITCH+1: + case FRANKENSTINESWITCH__STATIC: + //case FRANKENSTINESWITCH+1: + case LIGHTSWITCH2__STATIC: + //case LIGHTSWITCH2+1: + case POWERSWITCH1__STATIC: + //case POWERSWITCH1+1: + case LOCKSWITCH1__STATIC: + //case LOCKSWITCH1+1: + case POWERSWITCH2__STATIC: + //case POWERSWITCH2+1: + case HANDSWITCH__STATIC: + //case HANDSWITCH+1: + case PULLSWITCH__STATIC: + //case PULLSWITCH+1: + + if (picnum == MULTISWITCH || picnum == (MULTISWITCH+1) || + picnum == (MULTISWITCH+2) || picnum == (MULTISWITCH+3)) + lotag += picnum-MULTISWITCH; + + x = headspritestat[3]; + while (x >= 0) + { + if (((sprite[x].hitag) == 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) + hittype[x].temp_data[0]++; + + break; + case 24: + case 34: + case 25: + hittype[x].temp_data[4] = !hittype[x].temp_data[4]; + if (hittype[x].temp_data[4]) + FTA(15,&ps[snum]); + else FTA(2,&ps[snum]); + break; + case 21: + FTA(2,&ps[screenpeek]); + break; + } + } + x = nextspritestat[x]; + } + + operateactivators(lotag,snum); + operateforcefields(ps[snum].i,lotag); + operatemasterswitches(lotag); + + 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 (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; - xyzsound(END_OF_LEVEL_WARN,ps[snum].i,sx,sy,ps[snum].posz); - } - case DIPSWITCH2__STATIC: - //case DIPSWITCH2+1: - case DIPSWITCH3__STATIC: - //case DIPSWITCH3+1: - case MULTISWITCH__STATIC: - //case MULTISWITCH+1: - //case MULTISWITCH+2: - //case MULTISWITCH+3: - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - case SLOTDOOR__STATIC: - //case SLOTDOOR+1: - case LIGHTSWITCH__STATIC: - //case LIGHTSWITCH+1: - case SPACELIGHTSWITCH__STATIC: - //case SPACELIGHTSWITCH+1: - case SPACEDOORSWITCH__STATIC: - //case SPACEDOORSWITCH+1: - case FRANKENSTINESWITCH__STATIC: - //case FRANKENSTINESWITCH+1: - case LIGHTSWITCH2__STATIC: - //case LIGHTSWITCH2+1: - case POWERSWITCH1__STATIC: - //case POWERSWITCH1+1: - case LOCKSWITCH1__STATIC: - //case LOCKSWITCH1+1: - case POWERSWITCH2__STATIC: - //case POWERSWITCH2+1: - case HANDSWITCH__STATIC: - //case HANDSWITCH+1: - case PULLSWITCH__STATIC: - //case PULLSWITCH+1: - - if (picnum == MULTISWITCH || picnum == (MULTISWITCH+1) || - picnum == (MULTISWITCH+2) || picnum == (MULTISWITCH+3)) - lotag += picnum-MULTISWITCH; - - x = headspritestat[3]; - while (x >= 0) - { - if (((sprite[x].hitag) == lotag)) + else if (hitag != 0) { - switch (sprite[x].lotag) - { - case 12: - sector[sprite[x].sectnum].floorpal = 0; - hittype[x].temp_data[0]++; - if (hittype[x].temp_data[0] == 2) - hittype[x].temp_data[0]++; - - break; - case 24: - case 34: - case 25: - hittype[x].temp_data[4] = !hittype[x].temp_data[4]; - if (hittype[x].temp_data[4]) - FTA(15,&ps[snum]); - else FTA(2,&ps[snum]); - break; - case 21: - FTA(2,&ps[screenpeek]); - break; - } + if (switchtype == 1 && (soundm[hitag]&4) == 0) + xyzsound(hitag,w,sx,sy,ps[snum].posz); + else spritesound(hitag,ps[snum].i); } - x = nextspritestat[x]; - } - operateactivators(lotag,snum); - operateforcefields(ps[snum].i,lotag); - operatemasterswitches(lotag); - - 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 (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) - { - if (switchtype == 1 && (soundm[hitag]&4) == 0) - xyzsound(hitag,w,sx,sy,ps[snum].posz); - else spritesound(hitag,ps[snum].i); - } - - return 1; + return 1; } return 0; @@ -1617,18 +1644,18 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) { switch (dynamictostatic[atwith]) { - case HEAVYHBOMB__STATIC: - case RADIUSEXPLOSION__STATIC: - case RPG__STATIC: - case HYDRENT__STATIC: - case SEENINE__STATIC: - case OOZFILTER__STATIC: - case EXPLODINGBARREL__STATIC: - lotsofglass(spr,dawallnum,70); - wal->cstat &= ~16; - wal->overpicnum = MIRRORBROKE; - spritesound(GLASS_HEAVYBREAK,spr); - return; + case HEAVYHBOMB__STATIC: + case RADIUSEXPLOSION__STATIC: + case RPG__STATIC: + case HYDRENT__STATIC: + case SEENINE__STATIC: + case OOZFILTER__STATIC: + case EXPLODINGBARREL__STATIC: + lotsofglass(spr,dawallnum,70); + wal->cstat &= ~16; + wal->overpicnum = MIRRORBROKE; + spritesound(GLASS_HEAVYBREAK,spr); + return; } } @@ -1641,211 +1668,215 @@ void checkhitwall(short spr,short dawallnum,long x,long y,long z,short atwith) switchpicnum = W_FORCEFIELD; switch (dynamictostatic[switchpicnum]) { - case W_FORCEFIELD__STATIC: - //case W_FORCEFIELD+1: - //case W_FORCEFIELD+2: - wal->extra = 1; // tell the forces to animate - case BIGFORCE__STATIC: - updatesector(x,y,&sn); - if (sn < 0) return; + case W_FORCEFIELD__STATIC: + //case W_FORCEFIELD+1: + //case W_FORCEFIELD+2: + wal->extra = 1; // tell the forces to animate + case BIGFORCE__STATIC: + updatesector(x,y,&sn); + if (sn < 0) return; - if (atwith == -1) - i = EGS(sn,x,y,z,FORCERIPPLE,-127,8,8,0,0,0,spr,5); - else - { - 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); - } + if (atwith == -1) + i = EGS(sn,x,y,z,FORCERIPPLE,-127,8,8,0,0,0,spr,5); + else + { + 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); + } - CS |= 18+128; - SA = getangle(wal->x-wall[wal->point2].x, - wal->y-wall[wal->point2].y)-512; + CS |= 18+128; + SA = getangle(wal->x-wall[wal->point2].x, + wal->y-wall[wal->point2].y)-512; - spritesound(SOMETHINGHITFORCE,i); + spritesound(SOMETHINGHITFORCE,i); - return; + return; - case FANSPRITE__STATIC: - wal->overpicnum = FANSPRITEBROKE; - wal->cstat &= 65535-65; - if (wal->nextwall >= 0) - { - wall[wal->nextwall].overpicnum = FANSPRITEBROKE; - wall[wal->nextwall].cstat &= 65535-65; - } - spritesound(VENT_BUST,spr); - spritesound(GLASS_BREAKING,spr); - return; + case FANSPRITE__STATIC: + wal->overpicnum = FANSPRITEBROKE; + wal->cstat &= 65535-65; + if (wal->nextwall >= 0) + { + wall[wal->nextwall].overpicnum = FANSPRITEBROKE; + wall[wal->nextwall].cstat &= 65535-65; + } + spritesound(VENT_BUST,spr); + spritesound(GLASS_BREAKING,spr); + return; - case GLASS__STATIC: - updatesector(x,y,&sn); if (sn < 0) return; - wal->overpicnum=GLASS2; - lotsofglass(spr,dawallnum,10); - wal->cstat = 0; + case GLASS__STATIC: + updatesector(x,y,&sn); + if (sn < 0) return; + wal->overpicnum=GLASS2; + lotsofglass(spr,dawallnum,10); + wal->cstat = 0; - if (wal->nextwall >= 0) - wall[wal->nextwall].cstat = 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); - SLT = 128; T2 = 5; T3 = dawallnum; - spritesound(GLASS_BREAKING,i); - return; - case STAINGLASS1__STATIC: - updatesector(x,y,&sn); if (sn < 0) return; - lotsofcolourglass(spr,dawallnum,80); - wal->cstat = 0; - if (wal->nextwall >= 0) - wall[wal->nextwall].cstat = 0; - spritesound(VENT_BUST,spr); - spritesound(GLASS_BREAKING,spr); - return; + i = EGS(sn,x,y,z,SECTOREFFECTOR,0,0,0,ps[0].ang,0,0,spr,3); + SLT = 128; + T2 = 5; + T3 = dawallnum; + spritesound(GLASS_BREAKING,i); + return; + case STAINGLASS1__STATIC: + updatesector(x,y,&sn); + if (sn < 0) return; + lotsofcolourglass(spr,dawallnum,80); + wal->cstat = 0; + if (wal->nextwall >= 0) + wall[wal->nextwall].cstat = 0; + spritesound(VENT_BUST,spr); + spritesound(GLASS_BREAKING,spr); + return; } } switch (dynamictostatic[wal->picnum]) { - case COLAMACHINE__STATIC: - case VENDMACHINE__STATIC: - breakwall(wal->picnum+2,spr,dawallnum); - spritesound(VENT_BUST,spr); - return; + case COLAMACHINE__STATIC: + case VENDMACHINE__STATIC: + breakwall(wal->picnum+2,spr,dawallnum); + spritesound(VENT_BUST,spr); + return; - case OJ__STATIC: - case FEMPIC2__STATIC: - case FEMPIC3__STATIC: + case OJ__STATIC: + case FEMPIC2__STATIC: + case FEMPIC3__STATIC: - case SCREENBREAK6__STATIC: - case SCREENBREAK7__STATIC: - case SCREENBREAK8__STATIC: + case SCREENBREAK6__STATIC: + case SCREENBREAK7__STATIC: + case SCREENBREAK8__STATIC: - case SCREENBREAK1__STATIC: - case SCREENBREAK2__STATIC: - case SCREENBREAK3__STATIC: - case SCREENBREAK4__STATIC: - case SCREENBREAK5__STATIC: + case SCREENBREAK1__STATIC: + case SCREENBREAK2__STATIC: + case SCREENBREAK3__STATIC: + case SCREENBREAK4__STATIC: + case SCREENBREAK5__STATIC: - case SCREENBREAK9__STATIC: - case SCREENBREAK10__STATIC: - case SCREENBREAK11__STATIC: - case SCREENBREAK12__STATIC: - case SCREENBREAK13__STATIC: - case SCREENBREAK14__STATIC: - case SCREENBREAK15__STATIC: - case SCREENBREAK16__STATIC: - case SCREENBREAK17__STATIC: - case SCREENBREAK18__STATIC: - case SCREENBREAK19__STATIC: - case BORNTOBEWILDSCREEN__STATIC: + case SCREENBREAK9__STATIC: + case SCREENBREAK10__STATIC: + case SCREENBREAK11__STATIC: + case SCREENBREAK12__STATIC: + case SCREENBREAK13__STATIC: + case SCREENBREAK14__STATIC: + case SCREENBREAK15__STATIC: + case SCREENBREAK16__STATIC: + case SCREENBREAK17__STATIC: + case SCREENBREAK18__STATIC: + case SCREENBREAK19__STATIC: + case BORNTOBEWILDSCREEN__STATIC: - lotsofglass(spr,dawallnum,30); - wal->picnum=W_SCREENBREAK+(TRAND%3); - spritesound(GLASS_HEAVYBREAK,spr); - return; - - case W_TECHWALL5__STATIC: - case W_TECHWALL6__STATIC: - case W_TECHWALL7__STATIC: - case W_TECHWALL8__STATIC: - case W_TECHWALL9__STATIC: - breakwall(wal->picnum+1,spr,dawallnum); - return; - case W_MILKSHELF__STATIC: - breakwall(W_MILKSHELFBROKE,spr,dawallnum); - return; - - case W_TECHWALL10__STATIC: - breakwall(W_HITTECHWALL10,spr,dawallnum); - return; - - case W_TECHWALL1__STATIC: - case W_TECHWALL11__STATIC: - case W_TECHWALL12__STATIC: - case W_TECHWALL13__STATIC: - case W_TECHWALL14__STATIC: - breakwall(W_HITTECHWALL1,spr,dawallnum); - return; - - case W_TECHWALL15__STATIC: - breakwall(W_HITTECHWALL15,spr,dawallnum); - return; - - case W_TECHWALL16__STATIC: - breakwall(W_HITTECHWALL16,spr,dawallnum); - return; - - case W_TECHWALL2__STATIC: - breakwall(W_HITTECHWALL2,spr,dawallnum); - return; - - case W_TECHWALL3__STATIC: - breakwall(W_HITTECHWALL3,spr,dawallnum); - return; - - case W_TECHWALL4__STATIC: - breakwall(W_HITTECHWALL4,spr,dawallnum); - return; - - case ATM__STATIC: - wal->picnum = ATMBROKE; - lotsofmoney(&sprite[spr],1+(TRAND&7)); - spritesound(GLASS_HEAVYBREAK,spr); - break; - - case WALLLIGHT1__STATIC: - case WALLLIGHT2__STATIC: - case WALLLIGHT3__STATIC: - case WALLLIGHT4__STATIC: - case TECHLIGHT2__STATIC: - case TECHLIGHT4__STATIC: - - if (rnd(128)) + lotsofglass(spr,dawallnum,30); + wal->picnum=W_SCREENBREAK+(TRAND%3); spritesound(GLASS_HEAVYBREAK,spr); - else spritesound(GLASS_BREAKING,spr); - lotsofglass(spr,dawallnum,30); + return; - if (wal->picnum == WALLLIGHT1) - wal->picnum = WALLLIGHTBUST1; + case W_TECHWALL5__STATIC: + case W_TECHWALL6__STATIC: + case W_TECHWALL7__STATIC: + case W_TECHWALL8__STATIC: + case W_TECHWALL9__STATIC: + breakwall(wal->picnum+1,spr,dawallnum); + return; + case W_MILKSHELF__STATIC: + breakwall(W_MILKSHELFBROKE,spr,dawallnum); + return; - if (wal->picnum == WALLLIGHT2) - wal->picnum = WALLLIGHTBUST2; + case W_TECHWALL10__STATIC: + breakwall(W_HITTECHWALL10,spr,dawallnum); + return; - if (wal->picnum == WALLLIGHT3) - wal->picnum = WALLLIGHTBUST3; + case W_TECHWALL1__STATIC: + case W_TECHWALL11__STATIC: + case W_TECHWALL12__STATIC: + case W_TECHWALL13__STATIC: + case W_TECHWALL14__STATIC: + breakwall(W_HITTECHWALL1,spr,dawallnum); + return; - if (wal->picnum == WALLLIGHT4) - wal->picnum = WALLLIGHTBUST4; + case W_TECHWALL15__STATIC: + breakwall(W_HITTECHWALL15,spr,dawallnum); + return; - if (wal->picnum == TECHLIGHT2) - wal->picnum = TECHLIGHTBUST2; + case W_TECHWALL16__STATIC: + breakwall(W_HITTECHWALL16,spr,dawallnum); + return; - if (wal->picnum == TECHLIGHT4) - wal->picnum = TECHLIGHTBUST4; + case W_TECHWALL2__STATIC: + breakwall(W_HITTECHWALL2,spr,dawallnum); + return; - if (!wal->lotag) return; + case W_TECHWALL3__STATIC: + breakwall(W_HITTECHWALL3,spr,dawallnum); + return; - sn = wal->nextsector; - if (sn < 0) return; - darkestwall = 0; + case W_TECHWALL4__STATIC: + breakwall(W_HITTECHWALL4,spr,dawallnum); + return; - wal = &wall[sector[sn].wallptr]; - for (i=sector[sn].wallnum;i > 0;i--,wal++) - if (wal->shade > darkestwall) - darkestwall=wal->shade; + case ATM__STATIC: + wal->picnum = ATMBROKE; + lotsofmoney(&sprite[spr],1+(TRAND&7)); + spritesound(GLASS_HEAVYBREAK,spr); + break; - j = TRAND&1; - i= headspritestat[3]; - while (i >= 0) - { - if (SHT == wall[dawallnum].lotag && SLT == 3) + case WALLLIGHT1__STATIC: + case WALLLIGHT2__STATIC: + case WALLLIGHT3__STATIC: + case WALLLIGHT4__STATIC: + case TECHLIGHT2__STATIC: + case TECHLIGHT4__STATIC: + + if (rnd(128)) + spritesound(GLASS_HEAVYBREAK,spr); + else spritesound(GLASS_BREAKING,spr); + lotsofglass(spr,dawallnum,30); + + if (wal->picnum == WALLLIGHT1) + wal->picnum = WALLLIGHTBUST1; + + if (wal->picnum == WALLLIGHT2) + wal->picnum = WALLLIGHTBUST2; + + if (wal->picnum == WALLLIGHT3) + wal->picnum = WALLLIGHTBUST3; + + if (wal->picnum == WALLLIGHT4) + wal->picnum = WALLLIGHTBUST4; + + if (wal->picnum == TECHLIGHT2) + wal->picnum = TECHLIGHTBUST2; + + if (wal->picnum == TECHLIGHT4) + wal->picnum = TECHLIGHTBUST4; + + if (!wal->lotag) return; + + sn = wal->nextsector; + if (sn < 0) return; + darkestwall = 0; + + wal = &wall[sector[sn].wallptr]; + 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) { - T3 = j; - T4 = darkestwall; - T5 = 1; + if (SHT == wall[dawallnum].lotag && SLT == 3) + { + T3 = j; + T4 = darkestwall; + T5 = 1; + } + i = nextspritestat[i]; } - i = nextspritestat[i]; - } - break; + break; } } @@ -1855,7 +1886,8 @@ void checkplayerhurt(struct player_struct *p,short j) { j &= (MAXSPRITES-1); - if (sprite[j].picnum==CACTUS){ + if (sprite[j].picnum==CACTUS) + { if (p->hurt_delay < 8) { @@ -1877,42 +1909,43 @@ void checkplayerhurt(struct player_struct *p,short j) j &= (MAXWALLS-1); if (p->hurt_delay > 0) p->hurt_delay--; - else if (wall[j].cstat&85) { + 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]) { - case W_FORCEFIELD__STATIC: - // case W_FORCEFIELD+1: - // case W_FORCEFIELD+2: - sprite[p->i].extra -= 5; + case W_FORCEFIELD__STATIC: + // case W_FORCEFIELD+1: + // case W_FORCEFIELD+2: + sprite[p->i].extra -= 5; - p->hurt_delay = 16; - p->pals_time = 32; - p->pals[0] = 32; - p->pals[1] = 0; - p->pals[2] = 0; + p->hurt_delay = 16; + p->pals_time = 32; + p->pals[0] = 32; + p->pals[1] = 0; + p->pals[2] = 0; - p->posxv = -(sintable[(p->ang+512)&2047]<<8); - p->posyv = -(sintable[(p->ang)&2047]<<8); - spritesound(DUKE_LONGTERM_PAIN,p->i); + p->posxv = -(sintable[(p->ang+512)&2047]<<8); + p->posyv = -(sintable[(p->ang)&2047]<<8); + spritesound(DUKE_LONGTERM_PAIN,p->i); - checkhitwall(p->i,j, - p->posx+(sintable[(p->ang+512)&2047]>>9), - p->posy+(sintable[p->ang&2047]>>9), - p->posz,-1); + checkhitwall(p->i,j, + p->posx+(sintable[(p->ang+512)&2047]>>9), + p->posy+(sintable[p->ang&2047]>>9), + p->posz,-1); - break; + break; - case BIGFORCE__STATIC: - p->hurt_delay = 26; - checkhitwall(p->i,j, - p->posx+(sintable[(p->ang+512)&2047]>>9), - p->posy+(sintable[p->ang&2047]>>9), - p->posz,-1); - break; + case BIGFORCE__STATIC: + p->hurt_delay = 26; + checkhitwall(p->i,j, + p->posx+(sintable[(p->ang+512)&2047]>>9), + p->posy+(sintable[p->ang&2047]>>9), + p->posz,-1); + break; } } @@ -1924,68 +1957,68 @@ char checkhitceiling(short sn) switch (dynamictostatic[sector[sn].ceilingpicnum]) { - case WALLLIGHT1__STATIC: - case WALLLIGHT2__STATIC: - case WALLLIGHT3__STATIC: - case WALLLIGHT4__STATIC: - case TECHLIGHT2__STATIC: - case TECHLIGHT4__STATIC: + case WALLLIGHT1__STATIC: + case WALLLIGHT2__STATIC: + case WALLLIGHT3__STATIC: + case WALLLIGHT4__STATIC: + case TECHLIGHT2__STATIC: + case TECHLIGHT4__STATIC: - ceilingglass(ps[myconnectindex].i,sn,10); - spritesound(GLASS_BREAKING,ps[screenpeek].i); + ceilingglass(ps[myconnectindex].i,sn,10); + spritesound(GLASS_BREAKING,ps[screenpeek].i); - if (sector[sn].ceilingpicnum == WALLLIGHT1) - sector[sn].ceilingpicnum = WALLLIGHTBUST1; + if (sector[sn].ceilingpicnum == WALLLIGHT1) + sector[sn].ceilingpicnum = WALLLIGHTBUST1; - if (sector[sn].ceilingpicnum == WALLLIGHT2) - sector[sn].ceilingpicnum = WALLLIGHTBUST2; + if (sector[sn].ceilingpicnum == WALLLIGHT2) + sector[sn].ceilingpicnum = WALLLIGHTBUST2; - if (sector[sn].ceilingpicnum == WALLLIGHT3) - sector[sn].ceilingpicnum = WALLLIGHTBUST3; + if (sector[sn].ceilingpicnum == WALLLIGHT3) + sector[sn].ceilingpicnum = WALLLIGHTBUST3; - if (sector[sn].ceilingpicnum == WALLLIGHT4) - sector[sn].ceilingpicnum = WALLLIGHTBUST4; + if (sector[sn].ceilingpicnum == WALLLIGHT4) + sector[sn].ceilingpicnum = WALLLIGHTBUST4; - if (sector[sn].ceilingpicnum == TECHLIGHT2) - sector[sn].ceilingpicnum = TECHLIGHTBUST2; + if (sector[sn].ceilingpicnum == TECHLIGHT2) + sector[sn].ceilingpicnum = TECHLIGHTBUST2; - if (sector[sn].ceilingpicnum == TECHLIGHT4) - sector[sn].ceilingpicnum = TECHLIGHTBUST4; + if (sector[sn].ceilingpicnum == TECHLIGHT4) + sector[sn].ceilingpicnum = TECHLIGHTBUST4; - if (!sector[sn].hitag) - { - i = headspritesect[sn]; + if (!sector[sn].hitag) + { + i = headspritesect[sn]; + while (i >= 0) + { + if (PN == SECTOREFFECTOR && SLT == 12) + { + j = headspritestat[3]; + while (j >= 0) + { + if (sprite[j].hitag == SHT) + hittype[j].temp_data[3] = 1; + j = nextspritestat[j]; + } + break; + } + i = nextspritesect[i]; + } + } + + i = headspritestat[3]; + j = TRAND&1; while (i >= 0) { - if (PN == SECTOREFFECTOR && SLT == 12) + if (SHT == (sector[sn].hitag) && SLT == 3) { - j = headspritestat[3]; - while (j >= 0) - { - if (sprite[j].hitag == SHT) - hittype[j].temp_data[3] = 1; - j = nextspritestat[j]; - } - break; + T3 = j; + T5 = 1; } - i = nextspritesect[i]; + i = nextspritestat[i]; } - } - i = headspritestat[3]; - j = TRAND&1; - while (i >= 0) - { - if (SHT == (sector[sn].hitag) && SLT == 3) - { - T3 = j; - T5 = 1; - } - i = nextspritestat[i]; - } - - return 1; + return 1; } return 0; @@ -2003,456 +2036,463 @@ void checkhitsprite(short i,short sn) if (thisprojectile[sn].workslike & PROJECTILE_FLAG_RPG) rpg = 1; switchpicnum = PN; - if ((PN > WATERFOUNTAIN)&&(PN < WATERFOUNTAIN+3)) { + if ((PN > WATERFOUNTAIN)&&(PN < WATERFOUNTAIN+3)) + { switchpicnum = WATERFOUNTAIN; } switch (dynamictostatic[PN]) { - case OCEANSPRITE1__STATIC: - case OCEANSPRITE2__STATIC: - case OCEANSPRITE3__STATIC: - case OCEANSPRITE4__STATIC: - case OCEANSPRITE5__STATIC: - spawn(i,SMALLSMOKE); - deletesprite(i); - break; - case QUEBALL__STATIC: - case STRIPEBALL__STATIC: - 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) - spritesound(POOLBALLHIT,i); - } - else - { - if (TRAND&3) + case OCEANSPRITE1__STATIC: + case OCEANSPRITE2__STATIC: + case OCEANSPRITE3__STATIC: + case OCEANSPRITE4__STATIC: + case OCEANSPRITE5__STATIC: + spawn(i,SMALLSMOKE); + deletesprite(i); + break; + case QUEBALL__STATIC: + case STRIPEBALL__STATIC: + if (sprite[sn].picnum == QUEBALL || sprite[sn].picnum == STRIPEBALL) { - sprite[i].xvel = 164; - sprite[i].ang = sprite[sn].ang; + 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) + spritesound(POOLBALLHIT,i); } else { - lotsofglass(i,-1,3); + if (TRAND&3) + { + sprite[i].xvel = 164; + sprite[i].ang = sprite[sn].ang; + } + else + { + lotsofglass(i,-1,3); + deletesprite(i); + } + } + break; + case TREE1__STATIC: + case TREE2__STATIC: + 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]) + { + 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++) + 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); + break; + + + case FANSPRITE__STATIC: + PN = FANSPRITEBROKE; + CS &= (65535-257); + if (sector[SECT].floorpicnum == FANSHADOW) + sector[SECT].floorpicnum = FANSHADOWBROKE; + + spritesound(GLASS_HEAVYBREAK,i); + s = &sprite[i]; + for (j=0;j<16;j++) RANDOMSCRAP; + + break; + case WATERFOUNTAIN__STATIC: + // case WATERFOUNTAIN+1: + // case WATERFOUNTAIN+2: + // case __STATIC: + PN = WATERFOUNTAINBROKE; + spawn(i,TOILETWATER); + break; + case SATELITE__STATIC: + case FUELPOD__STATIC: + case SOLARPANNEL__STATIC: + case ANTENNA__STATIC: + if (sprite[sn].extra != *actorscrptr[SHOTSPARK1]) + { + 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); deletesprite(i); } - } - break; - case TREE1__STATIC: - case TREE2__STATIC: - 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]) - { - 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++) + case BOTTLE1__STATIC: + case BOTTLE2__STATIC: + case BOTTLE3__STATIC: + case BOTTLE4__STATIC: + case BOTTLE5__STATIC: + case BOTTLE6__STATIC: + case BOTTLE8__STATIC: + case BOTTLE10__STATIC: + case BOTTLE11__STATIC: + case BOTTLE12__STATIC: + case BOTTLE13__STATIC: + case BOTTLE14__STATIC: + case BOTTLE15__STATIC: + case BOTTLE16__STATIC: + case BOTTLE17__STATIC: + case BOTTLE18__STATIC: + case BOTTLE19__STATIC: + case WATERFOUNTAINBROKE__STATIC: + case DOMELITE__STATIC: + case SUSHIPLATE1__STATIC: + case SUSHIPLATE2__STATIC: + case SUSHIPLATE3__STATIC: + case SUSHIPLATE4__STATIC: + case SUSHIPLATE5__STATIC: + case WAITTOBESEATED__STATIC: + case VASE__STATIC: + case STATUEFLASH__STATIC: + case STATUE__STATIC: + if (PN == BOTTLE10) + lotsofmoney(&sprite[i],4+(TRAND&3)); + else if (PN == STATUE || PN == STATUEFLASH) { - 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; + lotsofcolourglass(i,-1,40); + spritesound(GLASS_HEAVYBREAK,i); } + else if (PN == VASE) + lotsofglass(i,-1,40); - if (PN == CACTUS) - PN = CACTUSBROKE; - CS &= ~257; - // else deletesprite(i); - break; - } - break; - } - case HANGLIGHT__STATIC: - case GENERICPOLE2__STATIC: - 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); - break; - - - case FANSPRITE__STATIC: - PN = FANSPRITEBROKE; - CS &= (65535-257); - if (sector[SECT].floorpicnum == FANSHADOW) - sector[SECT].floorpicnum = FANSHADOWBROKE; - - spritesound(GLASS_HEAVYBREAK,i); - s = &sprite[i]; - for (j=0;j<16;j++) RANDOMSCRAP; - - break; - case WATERFOUNTAIN__STATIC: - // case WATERFOUNTAIN+1: - // case WATERFOUNTAIN+2: - // case __STATIC: - PN = WATERFOUNTAINBROKE; - spawn(i,TOILETWATER); - break; - case SATELITE__STATIC: - case FUELPOD__STATIC: - case SOLARPANNEL__STATIC: - case ANTENNA__STATIC: - if (sprite[sn].extra != *actorscrptr[SHOTSPARK1]) - { - 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); - deletesprite(i); - } - break; - case BOTTLE1__STATIC: - case BOTTLE2__STATIC: - case BOTTLE3__STATIC: - case BOTTLE4__STATIC: - case BOTTLE5__STATIC: - case BOTTLE6__STATIC: - case BOTTLE8__STATIC: - case BOTTLE10__STATIC: - case BOTTLE11__STATIC: - case BOTTLE12__STATIC: - case BOTTLE13__STATIC: - case BOTTLE14__STATIC: - case BOTTLE15__STATIC: - case BOTTLE16__STATIC: - case BOTTLE17__STATIC: - case BOTTLE18__STATIC: - case BOTTLE19__STATIC: - case WATERFOUNTAINBROKE__STATIC: - case DOMELITE__STATIC: - case SUSHIPLATE1__STATIC: - case SUSHIPLATE2__STATIC: - case SUSHIPLATE3__STATIC: - case SUSHIPLATE4__STATIC: - case SUSHIPLATE5__STATIC: - case WAITTOBESEATED__STATIC: - case VASE__STATIC: - case STATUEFLASH__STATIC: - case STATUE__STATIC: - if (PN == BOTTLE10) - lotsofmoney(&sprite[i],4+(TRAND&3)); - else if (PN == STATUE || PN == STATUEFLASH) - { - lotsofcolourglass(i,-1,40); - spritesound(GLASS_HEAVYBREAK,i); - } - else if (PN == VASE) - lotsofglass(i,-1,40); - - spritesound(GLASS_BREAKING,i); - SA = TRAND&2047; - lotsofglass(i,-1,8); - deletesprite(i); - break; - case FETUS__STATIC: - PN = FETUSBROKE; - spritesound(GLASS_BREAKING,i); - lotsofglass(i,-1,10); - break; - case FETUSBROKE__STATIC: - for (j=0;j<48;j++) - { - shoot(i,BLOODSPLAT1); - SA += 333; - } - spritesound(GLASS_HEAVYBREAK,i); - spritesound(SQUISHED,i); - case BOTTLE7__STATIC: - spritesound(GLASS_BREAKING,i); - lotsofglass(i,-1,10); - deletesprite(i); - break; - case HYDROPLANT__STATIC: - PN = BROKEHYDROPLANT; - spritesound(GLASS_BREAKING,i); - lotsofglass(i,-1,10); - break; - - case FORCESPHERE__STATIC: - sprite[i].xrepeat = 0; - hittype[OW].temp_data[0] = 32; - hittype[OW].temp_data[1] = !hittype[OW].temp_data[1]; - hittype[OW].temp_data[2] ++; - spawn(i,EXPLOSION2); - break; - - case BROKEHYDROPLANT__STATIC: - if (CS&1) - { spritesound(GLASS_BREAKING,i); - SZ += 16<<8; - CS = 0; - lotsofglass(i,-1,5); - } - break; - - case TOILET__STATIC: - PN = TOILETBROKE; - CS |= (TRAND&1)<<2; - CS &= ~257; - spawn(i,TOILETWATER); - spritesound(GLASS_BREAKING,i); - break; - - case STALL__STATIC: - PN = STALLBROKE; - CS |= (TRAND&1)<<2; - CS &= ~257; - spawn(i,TOILETWATER); - spritesound(GLASS_HEAVYBREAK,i); - break; - - case HYDRENT__STATIC: - PN = BROKEFIREHYDRENT; - spawn(i,TOILETWATER); - - // for(k=0;k<5;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; - // } - spritesound(GLASS_HEAVYBREAK,i); - break; - - case GRATE1__STATIC: - PN = BGRATE1; - CS &= (65535-256-1); - spritesound(VENT_BUST,i); - break; - - case CIRCLEPANNEL__STATIC: - PN = CIRCLEPANNELBROKE; - CS &= (65535-256-1); - spritesound(VENT_BUST,i); - break; - case PANNEL1__STATIC: - case PANNEL2__STATIC: - PN = BPANNEL1; - CS &= (65535-256-1); - spritesound(VENT_BUST,i); - break; - case PANNEL3__STATIC: - PN = BPANNEL3; - CS &= (65535-256-1); - spritesound(VENT_BUST,i); - break; - case PIPE1__STATIC: - case PIPE2__STATIC: - case PIPE3__STATIC: - case PIPE4__STATIC: - case PIPE5__STATIC: - case PIPE6__STATIC: - 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; - } - - j = spawn(i,STEAM); - sprite[j].z = sector[SECT].floorz-(32<<8); - break; - - case MONK__STATIC: - case LUKE__STATIC: - case INDY__STATIC: - case JURYGUY__STATIC: - spritesound(SLT,i); - spawn(i,SHT); - case SPACEMARINE__STATIC: - sprite[i].extra -= sprite[sn].extra; - if (sprite[i].extra > 0) break; - SA = TRAND&2047; - shoot(i,BLOODSPLAT1); - SA = TRAND&2047; - shoot(i,BLOODSPLAT2); - SA = TRAND&2047; - shoot(i,BLOODSPLAT3); - SA = TRAND&2047; - shoot(i,BLOODSPLAT4); - SA = TRAND&2047; - shoot(i,BLOODSPLAT1); - SA = TRAND&2047; - shoot(i,BLOODSPLAT2); - SA = TRAND&2047; - shoot(i,BLOODSPLAT3); - SA = TRAND&2047; - shoot(i,BLOODSPLAT4); - guts(&sprite[i],JIBS1,1,myconnectindex); - guts(&sprite[i],JIBS2,2,myconnectindex); - guts(&sprite[i],JIBS3,3,myconnectindex); - guts(&sprite[i],JIBS4,4,myconnectindex); - guts(&sprite[i],JIBS5,1,myconnectindex); - guts(&sprite[i],JIBS3,6,myconnectindex); - sound(SQUISHED); - deletesprite(i); - break; - case CHAIR1__STATIC: - case CHAIR2__STATIC: - PN = BROKENCHAIR; - CS = 0; - break; - case CHAIR3__STATIC: - case MOVIECAMERA__STATIC: - case SCALE__STATIC: - case VACUUM__STATIC: - case CAMERALIGHT__STATIC: - case IVUNIT__STATIC: - case POT1__STATIC: - case POT2__STATIC: - case POT3__STATIC: - case TRIPODCAMERA__STATIC: - spritesound(GLASS_HEAVYBREAK,i); - s = &sprite[i]; - 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) + SA = TRAND&2047; + lotsofglass(i,-1,8); + deletesprite(i); + break; + case FETUS__STATIC: + PN = FETUSBROKE; + spritesound(GLASS_BREAKING,i); + lotsofglass(i,-1,10); + break; + case FETUSBROKE__STATIC: + for (j=0;j<48;j++) + { + shoot(i,BLOODSPLAT1); + SA += 333; + } + spritesound(GLASS_HEAVYBREAK,i); + spritesound(SQUISHED,i); + case BOTTLE7__STATIC: + spritesound(GLASS_BREAKING,i); + lotsofglass(i,-1,10); + deletesprite(i); + break; + case HYDROPLANT__STATIC: + PN = BROKEHYDROPLANT; + spritesound(GLASS_BREAKING,i); + lotsofglass(i,-1,10); break; - if ((sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i) && sprite[i].statnum != 4) - { - if (badguy(&sprite[i]) == 1) - { - if (sprite[sn].picnum == RPG) sprite[sn].extra <<= 1; + case FORCESPHERE__STATIC: + sprite[i].xrepeat = 0; + hittype[OW].temp_data[0] = 32; + hittype[OW].temp_data[1] = !hittype[OW].temp_data[1]; + hittype[OW].temp_data[2] ++; + spawn(i,EXPLOSION2); + break; - if ((PN != DRONE) && (PN != ROTATEGUN) && (PN != COMMANDER) && (PN < GREENSLIME || PN > GREENSLIME+7)) - if (sprite[sn].picnum != FREEZEBLAST) - if (actortype[PN] == 0) + case BROKEHYDROPLANT__STATIC: + if (CS&1) + { + spritesound(GLASS_BREAKING,i); + SZ += 16<<8; + CS = 0; + lotsofglass(i,-1,5); + } + break; + + case TOILET__STATIC: + PN = TOILETBROKE; + CS |= (TRAND&1)<<2; + CS &= ~257; + spawn(i,TOILETWATER); + spritesound(GLASS_BREAKING,i); + break; + + case STALL__STATIC: + PN = STALLBROKE; + CS |= (TRAND&1)<<2; + CS &= ~257; + spawn(i,TOILETWATER); + spritesound(GLASS_HEAVYBREAK,i); + break; + + case HYDRENT__STATIC: + PN = BROKEFIREHYDRENT; + spawn(i,TOILETWATER); + + // for(k=0;k<5;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; + // } + spritesound(GLASS_HEAVYBREAK,i); + break; + + case GRATE1__STATIC: + PN = BGRATE1; + CS &= (65535-256-1); + spritesound(VENT_BUST,i); + break; + + case CIRCLEPANNEL__STATIC: + PN = CIRCLEPANNELBROKE; + CS &= (65535-256-1); + spritesound(VENT_BUST,i); + break; + case PANNEL1__STATIC: + case PANNEL2__STATIC: + PN = BPANNEL1; + CS &= (65535-256-1); + spritesound(VENT_BUST,i); + break; + case PANNEL3__STATIC: + PN = BPANNEL3; + CS &= (65535-256-1); + spritesound(VENT_BUST,i); + break; + case PIPE1__STATIC: + case PIPE2__STATIC: + case PIPE3__STATIC: + case PIPE4__STATIC: + case PIPE5__STATIC: + case PIPE6__STATIC: + 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; + } + + j = spawn(i,STEAM); + sprite[j].z = sector[SECT].floorz-(32<<8); + break; + + case MONK__STATIC: + case LUKE__STATIC: + case INDY__STATIC: + case JURYGUY__STATIC: + spritesound(SLT,i); + spawn(i,SHT); + case SPACEMARINE__STATIC: + sprite[i].extra -= sprite[sn].extra; + if (sprite[i].extra > 0) break; + SA = TRAND&2047; + shoot(i,BLOODSPLAT1); + SA = TRAND&2047; + shoot(i,BLOODSPLAT2); + SA = TRAND&2047; + shoot(i,BLOODSPLAT3); + SA = TRAND&2047; + shoot(i,BLOODSPLAT4); + SA = TRAND&2047; + shoot(i,BLOODSPLAT1); + SA = TRAND&2047; + shoot(i,BLOODSPLAT2); + SA = TRAND&2047; + shoot(i,BLOODSPLAT3); + SA = TRAND&2047; + shoot(i,BLOODSPLAT4); + guts(&sprite[i],JIBS1,1,myconnectindex); + guts(&sprite[i],JIBS2,2,myconnectindex); + guts(&sprite[i],JIBS3,3,myconnectindex); + guts(&sprite[i],JIBS4,4,myconnectindex); + guts(&sprite[i],JIBS5,1,myconnectindex); + guts(&sprite[i],JIBS3,6,myconnectindex); + sound(SQUISHED); + deletesprite(i); + break; + case CHAIR1__STATIC: + case CHAIR2__STATIC: + PN = BROKENCHAIR; + CS = 0; + break; + case CHAIR3__STATIC: + case MOVIECAMERA__STATIC: + case SCALE__STATIC: + case VACUUM__STATIC: + case CAMERALIGHT__STATIC: + case IVUNIT__STATIC: + case POT1__STATIC: + case POT2__STATIC: + case POT3__STATIC: + case TRIPODCAMERA__STATIC: + spritesound(GLASS_HEAVYBREAK,i); + s = &sprite[i]; + 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) + break; + + if ((sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i) && sprite[i].statnum != 4) + { + if (badguy(&sprite[i]) == 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) + { + j = spawn(sn,JIBS6); + if (sprite[sn].pal == 6) + sprite[j].pal = 6; + sprite[j].z += (4<<8); + sprite[j].xvel = 16; + sprite[j].xrepeat = sprite[j].yrepeat = 24; + sprite[j].ang += 32-(TRAND&63); + } + + j = sprite[sn].owner; + + if (j >= 0 && sprite[j].picnum == APLAYER && PN != ROTATEGUN && PN != DRONE) + if (ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON) { - j = spawn(sn,JIBS6); - if (sprite[sn].pal == 6) - sprite[j].pal = 6; - sprite[j].z += (4<<8); - sprite[j].xvel = 16; - sprite[j].xrepeat = sprite[j].yrepeat = 24; - sprite[j].ang += 32-(TRAND&63); + shoot(i,BLOODSPLAT3); + shoot(i,BLOODSPLAT1); + shoot(i,BLOODSPLAT2); + shoot(i,BLOODSPLAT4); } - 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 (PN != TANK && PN != BOSS1 && PN != BOSS4 && PN != BOSS2 && PN != BOSS3 && PN != RECON && PN != ROTATEGUN) { - shoot(i,BLOODSPLAT3); - shoot(i,BLOODSPLAT1); - shoot(i,BLOODSPLAT2); - shoot(i,BLOODSPLAT4); + 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) + changespritesect(i,j); } - if (PN != TANK && PN != BOSS1 && PN != BOSS4 && PN != BOSS2 && PN != BOSS3 && PN != RECON && PN != ROTATEGUN) - { - 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) - changespritesect(i,j); - } - - if (sprite[i].statnum == 2) - { - changespritestat(i,1); - hittype[i].timetosleep = SLEEPTIME; - } - if ((RX < 24 || PN == SHARK) && sprite[sn].picnum == SHRINKSPARK) return; - } - - if (sprite[i].statnum != 2) - { - if (sprite[sn].picnum == FREEZEBLAST && ((PN == APLAYER && sprite[i].pal == 1) || (freezerhurtowner == 0 && sprite[sn].owner == i))) - return; - - hittype[i].picnum = sprite[sn].picnum; - hittype[i].extra += sprite[sn].extra; - hittype[i].ang = sprite[sn].ang; - hittype[i].owner = sprite[sn].owner; - } - - if (sprite[i].statnum == 10) - { - p = sprite[i].yvel; - if (ps[p].newowner >= 0) - { - ps[p].newowner = -1; - ps[p].posx = ps[p].oposx; - ps[p].posy = ps[p].oposy; - ps[p].posz = ps[p].oposz; - ps[p].ang = ps[p].oang; - - updatesector(ps[p].posx,ps[p].posy,&ps[p].cursectnum); - setpal(&ps[p]); - - j = headspritestat[1]; - while (j >= 0) + if (sprite[i].statnum == 2) { - if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; - j = nextspritestat[j]; + changespritestat(i,1); + hittype[i].timetosleep = SLEEPTIME; } + if ((RX < 24 || PN == SHARK) && sprite[sn].picnum == SHRINKSPARK) return; } - if (RX < 24 && sprite[sn].picnum == SHRINKSPARK) - return; + if (sprite[i].statnum != 2) + { + if (sprite[sn].picnum == FREEZEBLAST && ((PN == APLAYER && sprite[i].pal == 1) || (freezerhurtowner == 0 && sprite[sn].owner == i))) + return; + + hittype[i].picnum = sprite[sn].picnum; + hittype[i].extra += sprite[sn].extra; + hittype[i].ang = sprite[sn].ang; + hittype[i].owner = sprite[sn].owner; + } + + if (sprite[i].statnum == 10) + { + p = sprite[i].yvel; + if (ps[p].newowner >= 0) + { + ps[p].newowner = -1; + ps[p].posx = ps[p].oposx; + ps[p].posy = ps[p].oposy; + ps[p].posz = ps[p].oposz; + ps[p].ang = ps[p].oang; + + updatesector(ps[p].posx,ps[p].posy,&ps[p].cursectnum); + setpal(&ps[p]); + + j = headspritestat[1]; + while (j >= 0) + { + if (sprite[j].picnum==CAMERA1) sprite[j].yvel = 0; + j = nextspritestat[j]; + } + } + + if (RX < 24 && sprite[sn].picnum == SHRINKSPARK) + return; + + if (sprite[hittype[i].owner].picnum != APLAYER) + if (ud.player_skill >= 3) + sprite[sn].extra += (sprite[sn].extra>>1); + } - if (sprite[hittype[i].owner].picnum != APLAYER) - if (ud.player_skill >= 3) - sprite[sn].extra += (sprite[sn].extra>>1); } - - } - break; + break; } } @@ -2582,16 +2622,21 @@ void cheatkeys(short snum) { 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; } } } @@ -2651,49 +2696,49 @@ CHECKINV1: switch (dainv) { - case 4: - if (p->jetpack_amount > 0 && i > 1) - break; - if (k) dainv = 5; - else dainv = 3; - goto CHECKINV1; - case 6: - if (p->scuba_amount > 0 && i > 1) - break; - if (k) dainv = 7; - else dainv = 5; - goto CHECKINV1; - case 2: - if (p->steroids_amount > 0 && i > 1) - break; - if (k) dainv = 3; - else dainv = 1; - goto CHECKINV1; - case 3: - if (p->holoduke_amount > 0 && i > 1) - break; - if (k) dainv = 4; - else dainv = 2; - goto CHECKINV1; - case 0: - case 1: - if (p->firstaid_amount > 0 && i > 1) - break; - if (k) dainv = 2; - else dainv = 7; - goto CHECKINV1; - case 5: - if (p->heat_amount > 0 && i > 1) - break; - if (k) dainv = 6; - else dainv = 4; - goto CHECKINV1; - case 7: - if (p->boot_amount > 0 && i > 1) - break; - if (k) dainv = 1; - else dainv = 6; - goto CHECKINV1; + case 4: + if (p->jetpack_amount > 0 && i > 1) + break; + if (k) dainv = 5; + else dainv = 3; + goto CHECKINV1; + case 6: + if (p->scuba_amount > 0 && i > 1) + break; + if (k) dainv = 7; + else dainv = 5; + goto CHECKINV1; + case 2: + if (p->steroids_amount > 0 && i > 1) + break; + if (k) dainv = 3; + else dainv = 1; + goto CHECKINV1; + case 3: + if (p->holoduke_amount > 0 && i > 1) + break; + if (k) dainv = 4; + else dainv = 2; + goto CHECKINV1; + case 0: + case 1: + if (p->firstaid_amount > 0 && i > 1) + break; + if (k) dainv = 2; + else dainv = 7; + goto CHECKINV1; + case 5: + if (p->heat_amount > 0 && i > 1) + break; + if (k) dainv = 6; + else dainv = 4; + goto CHECKINV1; + case 7: + if (p->boot_amount > 0 && i > 1) + break; + if (k) dainv = 1; + else dainv = 6; + goto CHECKINV1; } } else dainv = 0; @@ -2715,20 +2760,27 @@ CHECKINV1: 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; } } @@ -2738,42 +2790,42 @@ CHECKINV1: switch (j) { - case 0: - OnEvent(EVENT_WEAPKEY1,p->i,snum, -1); - break; - case 1: - OnEvent(EVENT_WEAPKEY2,p->i,snum, -1); - break; - case 2: - OnEvent(EVENT_WEAPKEY3,p->i,snum, -1); - break; - case 3: - OnEvent(EVENT_WEAPKEY4,p->i,snum, -1); - break; - case 4: - OnEvent(EVENT_WEAPKEY5,p->i,snum, -1); - break; - case 5: - OnEvent(EVENT_WEAPKEY6,p->i,snum, -1); - break; - case 6: - OnEvent(EVENT_WEAPKEY7,p->i,snum, -1); - break; - case 7: - OnEvent(EVENT_WEAPKEY8,p->i,snum, -1); - break; - case 8: - OnEvent(EVENT_WEAPKEY9,p->i,snum, -1); - break; - case 9: - OnEvent(EVENT_WEAPKEY10,p->i,snum, -1); - break; - case 10: - OnEvent(EVENT_PREVIOUSWEAPON,p->i,snum, -1); - break; - case 11: - OnEvent(EVENT_NEXTWEAPON,p->i,snum, -1); - break; + case 0: + OnEvent(EVENT_WEAPKEY1,p->i,snum, -1); + break; + case 1: + OnEvent(EVENT_WEAPKEY2,p->i,snum, -1); + break; + case 2: + OnEvent(EVENT_WEAPKEY3,p->i,snum, -1); + break; + case 3: + OnEvent(EVENT_WEAPKEY4,p->i,snum, -1); + break; + case 4: + OnEvent(EVENT_WEAPKEY5,p->i,snum, -1); + break; + case 5: + OnEvent(EVENT_WEAPKEY6,p->i,snum, -1); + break; + case 6: + OnEvent(EVENT_WEAPKEY7,p->i,snum, -1); + break; + case 7: + OnEvent(EVENT_WEAPKEY8,p->i,snum, -1); + break; + case 8: + OnEvent(EVENT_WEAPKEY9,p->i,snum, -1); + break; + case 9: + OnEvent(EVENT_WEAPKEY10,p->i,snum, -1); + break; + case 10: + OnEvent(EVENT_PREVIOUSWEAPON,p->i,snum, -1); + break; + case 11: + OnEvent(EVENT_NEXTWEAPON,p->i,snum, -1); + break; } if ((unsigned long) GetGameVarID(g_iReturnVarID,p->i,snum) != j) @@ -2906,86 +2958,86 @@ CHECKINV1: 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) + case KNEE_WEAPON: + addweapon(p, KNEE_WEAPON); + break; + case PISTOL_WEAPON: + if (p->ammo_amount[PISTOL_WEAPON] == 0) + if (p->show_empty_weapon == 0) + { + p->last_full_weapon = p->curr_weapon; + p->show_empty_weapon = 32; + } + addweapon(p, PISTOL_WEAPON); + break; + case SHOTGUN_WEAPON: + if (p->ammo_amount[SHOTGUN_WEAPON] == 0 && p->show_empty_weapon == 0) { p->last_full_weapon = p->curr_weapon; p->show_empty_weapon = 32; } - addweapon(p, PISTOL_WEAPON); - break; - case SHOTGUN_WEAPON: - if (p->ammo_amount[SHOTGUN_WEAPON] == 0 && p->show_empty_weapon == 0) - { - p->last_full_weapon = p->curr_weapon; - p->show_empty_weapon = 32; - } - addweapon(p, SHOTGUN_WEAPON); - break; - case CHAINGUN_WEAPON: - if (p->ammo_amount[CHAINGUN_WEAPON] == 0 && p->show_empty_weapon == 0) - { - p->last_full_weapon = p->curr_weapon; - p->show_empty_weapon = 32; - } - addweapon(p, CHAINGUN_WEAPON); - break; - case RPG_WEAPON: - if (p->ammo_amount[RPG_WEAPON] == 0) - if (p->show_empty_weapon == 0) + addweapon(p, SHOTGUN_WEAPON); + break; + case CHAINGUN_WEAPON: + if (p->ammo_amount[CHAINGUN_WEAPON] == 0 && p->show_empty_weapon == 0) { p->last_full_weapon = p->curr_weapon; p->show_empty_weapon = 32; } - addweapon(p, RPG_WEAPON); - break; - case DEVISTATOR_WEAPON: - if (p->ammo_amount[DEVISTATOR_WEAPON] == 0 && p->show_empty_weapon == 0) - { - p->last_full_weapon = p->curr_weapon; - p->show_empty_weapon = 32; - } - addweapon(p, DEVISTATOR_WEAPON); - break; - case FREEZE_WEAPON: - if (p->ammo_amount[FREEZE_WEAPON] == 0 && p->show_empty_weapon == 0) - { - p->last_full_weapon = p->curr_weapon; - p->show_empty_weapon = 32; - } - addweapon(p, FREEZE_WEAPON); - break; - case GROW_WEAPON: - case SHRINKER_WEAPON: + addweapon(p, CHAINGUN_WEAPON); + break; + case RPG_WEAPON: + 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; + } + addweapon(p, RPG_WEAPON); + break; + case DEVISTATOR_WEAPON: + if (p->ammo_amount[DEVISTATOR_WEAPON] == 0 && p->show_empty_weapon == 0) + { + p->last_full_weapon = p->curr_weapon; + p->show_empty_weapon = 32; + } + addweapon(p, DEVISTATOR_WEAPON); + break; + case FREEZE_WEAPON: + if (p->ammo_amount[FREEZE_WEAPON] == 0 && p->show_empty_weapon == 0) + { + p->last_full_weapon = p->curr_weapon; + p->show_empty_weapon = 32; + } + addweapon(p, FREEZE_WEAPON); + break; + case GROW_WEAPON: + case SHRINKER_WEAPON: - if (p->ammo_amount[j] == 0 && p->show_empty_weapon == 0) - { - p->show_empty_weapon = 32; - p->last_full_weapon = p->curr_weapon; - } + if (p->ammo_amount[j] == 0 && p->show_empty_weapon == 0) + { + p->show_empty_weapon = 32; + p->last_full_weapon = p->curr_weapon; + } - addweapon(p, j); - break; - case HANDREMOTE_WEAPON: - if (k >= 0) // Found in list of [1]'s - { - p->curr_weapon = HANDREMOTE_WEAPON; - p->last_weapon = -1; - p->weapon_pos = 10; - } - break; - case 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]) - addweapon(p, TRIPBOMB_WEAPON); - break; + addweapon(p, j); + break; + case HANDREMOTE_WEAPON: + if (k >= 0) // Found in list of [1]'s + { + p->curr_weapon = HANDREMOTE_WEAPON; + p->last_weapon = -1; + p->weapon_pos = 10; + } + break; + case 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]) + addweapon(p, TRIPBOMB_WEAPON); + break; } } @@ -3139,42 +3191,42 @@ void checksectors(short snum) switch (sector[p->cursectnum].lotag) { - case 32767: - sector[p->cursectnum].lotag = 0; - FTA(9,p); - p->secret_rooms++; - return; - case -1: - for (i=connecthead;i>=0;i=connectpoint2[i]) - ps[i].gm = MODE_EOL; - sector[p->cursectnum].lotag = 0; - if (ud.from_bonus) - { - ud.level_number = ud.from_bonus; - ud.m_level_number = ud.level_number; - ud.from_bonus = 0; - } - else - { - ud.level_number++; - 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; - } - return; - case -2: - sector[p->cursectnum].lotag = 0; - p->timebeforeexit = 26*8; - p->customexitsound = sector[p->cursectnum].hitag; - return; - default: - if (sector[p->cursectnum].lotag >= 10000 && sector[p->cursectnum].lotag < 16383) - { - if (snum == screenpeek || (gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND)) - spritesound(sector[p->cursectnum].lotag-10000,p->i); + case 32767: sector[p->cursectnum].lotag = 0; - } - break; + FTA(9,p); + p->secret_rooms++; + return; + case -1: + for (i=connecthead;i>=0;i=connectpoint2[i]) + ps[i].gm = MODE_EOL; + sector[p->cursectnum].lotag = 0; + if (ud.from_bonus) + { + ud.level_number = ud.from_bonus; + ud.m_level_number = ud.level_number; + ud.from_bonus = 0; + } + else + { + ud.level_number++; + 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; + } + return; + case -2: + sector[p->cursectnum].lotag = 0; + p->timebeforeexit = 26*8; + p->customexitsound = sector[p->cursectnum].hitag; + return; + default: + if (sector[p->cursectnum].lotag >= 10000 && sector[p->cursectnum].lotag < 16383) + { + if (snum == screenpeek || (gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND)) + spritesound(sector[p->cursectnum].lotag-10000,p->i); + sector[p->cursectnum].lotag = 0; + } + break; } @@ -3234,9 +3286,9 @@ void checksectors(short snum) if (hitscanwall >= 0 && (wall[hitscanwall].cstat&16)) switch (wall[hitscanwall].overpicnum) { - default: - if (wall[hitscanwall].lotag) - return; + default: + if (wall[hitscanwall].lotag) + return; } if (p->newowner >= 0) @@ -3255,21 +3307,21 @@ void checksectors(short snum) { switch (dynamictostatic[sprite[neartagsprite].picnum]) { - case FEM1__STATIC: - case FEM2__STATIC: - case FEM3__STATIC: - case FEM4__STATIC: - case FEM5__STATIC: - case FEM6__STATIC: - case FEM7__STATIC: - case FEM8__STATIC: - case FEM9__STATIC: - case FEM10__STATIC: - case PODFEM1__STATIC: - case NAKED1__STATIC: - case STATUE__STATIC: - case TOUGHGAL__STATIC: - return; + case FEM1__STATIC: + case FEM2__STATIC: + case FEM3__STATIC: + case FEM4__STATIC: + case FEM5__STATIC: + case FEM6__STATIC: + case FEM7__STATIC: + case FEM8__STATIC: + case FEM9__STATIC: + case FEM10__STATIC: + case PODFEM1__STATIC: + case NAKED1__STATIC: + case STATUE__STATIC: + case TOUGHGAL__STATIC: + return; } } @@ -3299,136 +3351,140 @@ void checksectors(short snum) switch (dynamictostatic[sprite[neartagsprite].picnum]) { - case TOILET__STATIC: - case STALL__STATIC: - if (p->last_pissed_time == 0) - { - 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) + case TOILET__STATIC: + case STALL__STATIC: + if (p->last_pissed_time == 0) { - p->holster_weapon = 1; - p->weapon_pos = -1; - } - 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) - sprite[p->i].extra = max_player_health; - } - else if (!isspritemakingsound(neartagsprite,FLUSH_TOILET)) - spritesound(FLUSH_TOILET,neartagsprite); - return; + if (ud.lockout == 0) spritesound(DUKE_URINATE,p->i); - case NUKEBUTTON__STATIC: - - hitawall(p,&j); - if (j >= 0 && wall[j].overpicnum == 0) - if (hittype[neartagsprite].temp_data[0] == 0) - { - if (ud.noexits && ud.multimode > 1) + p->last_pissed_time = 26*220; + p->transporter_hold = 29*2; + if (p->holster_weapon == 0) { - hittype[p->i].picnum = NUKEBUTTON; - hittype[p->i].extra = 250; + p->holster_weapon = 1; + p->weapon_pos = -1; } - else + if (sprite[p->i].extra <= (max_player_health-(max_player_health/10))) { - hittype[neartagsprite].temp_data[0] = 1; - sprite[neartagsprite].owner = p->i; - p->buttonpalette = sprite[neartagsprite].pal; - if (p->buttonpalette) - ud.secretlevel = sprite[neartagsprite].lotag; - else ud.secretlevel = 0; + sprite[p->i].extra += max_player_health/10; + p->last_extra = sprite[p->i].extra; + } + else if (sprite[p->i].extra < max_player_health) + sprite[p->i].extra = max_player_health; + } + 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 (ud.noexits && ud.multimode > 1) + { + hittype[p->i].picnum = NUKEBUTTON; + hittype[p->i].extra = 250; + } + else + { + hittype[neartagsprite].temp_data[0] = 1; + sprite[neartagsprite].owner = p->i; + p->buttonpalette = sprite[neartagsprite].pal; + if (p->buttonpalette) + ud.secretlevel = sprite[neartagsprite].lotag; + else ud.secretlevel = 0; + } + } + return; + case WATERFOUNTAIN__STATIC: + 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) + { + sprite[p->i].extra++; + spritesound(DUKE_DRINKING,p->i); } } - return; - case WATERFOUNTAIN__STATIC: - if (hittype[neartagsprite].temp_data[0] != 1) + return; + case PLUG__STATIC: + spritesound(SHORT_CIRCUIT,p->i); + sprite[p->i].extra -= 2+(TRAND&3); + p->pals[0] = 48; + p->pals[1] = 48; + p->pals[2] = 64; + p->pals_time = 32; + break; + case VIEWSCREEN__STATIC: + case VIEWSCREEN2__STATIC: { - hittype[neartagsprite].temp_data[0] = 1; - sprite[neartagsprite].owner = p->i; + i = headspritestat[1]; - if (sprite[p->i].extra < max_player_health) + while (i >= 0) { - sprite[p->i].extra++; - spritesound(DUKE_DRINKING,p->i); + if (PN == CAMERA1 && SP == 0 && sprite[neartagsprite].hitag == SLT) + { + SP = 1; //Using this camera + spritesound(MONITOR_ACTIVE,neartagsprite); + + sprite[neartagsprite].owner = i; + sprite[neartagsprite].yvel = 1; + + + j = p->cursectnum; + p->cursectnum = SECT; + setpal(p); + p->cursectnum = j; + + // parallaxtype = 2; + p->newowner = i; + return; + } + i = nextspritestat[i]; } } - return; - case PLUG__STATIC: - spritesound(SHORT_CIRCUIT,p->i); - sprite[p->i].extra -= 2+(TRAND&3); - p->pals[0] = 48; - p->pals[1] = 48; - p->pals[2] = 64; - p->pals_time = 32; - break; - case VIEWSCREEN__STATIC: - case VIEWSCREEN2__STATIC: - { - i = headspritestat[1]; - - while (i >= 0) - { - if (PN == CAMERA1 && SP == 0 && sprite[neartagsprite].hitag == SLT) - { - SP = 1; //Using this camera - spritesound(MONITOR_ACTIVE,neartagsprite); - - sprite[neartagsprite].owner = i; - sprite[neartagsprite].yvel = 1; - - - j = p->cursectnum; - p->cursectnum = SECT; - setpal(p); - p->cursectnum = j; - - // parallaxtype = 2; - p->newowner = i; - return; - } - i = nextspritestat[i]; - } - } CLEARCAMERAS: - 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) + if (i < 0) { - if (PN==CAMERA1) SP = 0; - i = nextspritestat[i]; + 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]; + } } - } - 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; } + else if (p->newowner >= 0) + { + i = -1; + goto CLEARCAMERAS; + } if (neartagwall == -1 && neartagsector == -1 && neartagsprite == -1) if (klabs(hits(p->i)) < 512) diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 3ae68b364..624ec3fe2 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -50,15 +50,18 @@ void SoundStartup(void) if (FXDevice < 0) return; status = FX_Init(FXDevice, NumVoices, NumChannels, NumBits, MixRate); - if (status == FX_Ok) { + if (status == FX_Ok) + { FX_SetVolume(FXVolume); - if (ReverseStereo == 1) { + if (ReverseStereo == 1) + { FX_SetReverseStereo(!FX_GetReverseStereo()); } status = FX_SetCallBack(testcallback); } - if (status != FX_Ok) { + if (status != FX_Ok) + { sprintf(tempbuf, "Sound startup error: %s", FX_ErrorString(FX_Error)); gameexit(tempbuf); } @@ -81,7 +84,8 @@ void SoundShutdown(void) return; status = FX_Shutdown(); - if (status != FX_Ok) { + if (status != FX_Ok) + { sprintf(tempbuf, "Sound shutdown error: %s", FX_ErrorString(FX_Error)); gameexit(tempbuf); } @@ -314,20 +318,20 @@ int xyzsound(short num,short i,long x,long y,long z) switch (num) { - case PIPEBOMB_EXPLODE: - case LASERTRIP_EXPLODE: - case RPG_EXPLODE: - if (sndist > (6144)) - sndist = 6144; - if (sector[ps[screenpeek].cursectnum].lotag == 2) - pitch -= 1024; - break; - default: - if (sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&4) == 0) - pitch = -768; - if (sndist > 31444 && PN != MUSICANDSFX) - return -1; - break; + case PIPEBOMB_EXPLODE: + case LASERTRIP_EXPLODE: + case RPG_EXPLODE: + if (sndist > (6144)) + sndist = 6144; + if (sector[ps[screenpeek].cursectnum].lotag == 2) + pitch -= 1024; + break; + default: + if (sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&4) == 0) + pitch = -768; + if (sndist > 31444 && PN != MUSICANDSFX) + return -1; + break; } if (ps[screenpeek].sound_pitch) pitch += ps[screenpeek].sound_pitch; @@ -350,7 +354,10 @@ 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) @@ -420,7 +427,10 @@ void sound(short num) } 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) @@ -548,17 +558,17 @@ void pan3dsound(void) switch (j) { - case PIPEBOMB_EXPLODE: - case LASERTRIP_EXPLODE: - case RPG_EXPLODE: - if (sndist > (6144)) sndist = (6144); - break; - default: - if (sndist > 31444 && PN != MUSICANDSFX) - { - stopsound(j); - continue; - } + case PIPEBOMB_EXPLODE: + case LASERTRIP_EXPLODE: + case RPG_EXPLODE: + if (sndist > (6144)) sndist = (6144); + break; + default: + if (sndist > 31444 && PN != MUSICANDSFX) + { + stopsound(j); + continue; + } } if (Sound[j].ptr == 0 && loadsound(j) == 0) continue; @@ -630,7 +640,8 @@ int isspritemakingsound(short i, int num) int issoundplaying(short i, int num) { - if (i == -1) { + if (i == -1) + { if (Sound[num].lock == 200) return 1; else return 0; diff --git a/polymer/eduke32/source/startgtk.game.c b/polymer/eduke32/source/startgtk.game.c index 0e81060e4..f31bc0bfb 100755 --- a/polymer/eduke32/source/startgtk.game.c +++ b/polymer/eduke32/source/startgtk.game.c @@ -27,12 +27,14 @@ #define TAB_CONFIG 0 #define TAB_MESSAGES 1 -static struct { +static struct +{ int fullscreen; int xdim3d, ydim3d, bpp3d; int forcesetup; int usemouse, usejoy; -} settings; +} +settings; extern int gtkenabled; @@ -64,7 +66,8 @@ static void SetPage(int 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; + 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); @@ -80,10 +83,16 @@ static void PopulateForm(void) char buf[64]; mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); - if (mode3d < 0) { + if (mode3d < 0) + { int i, cd[] = { 32, 24, 16, 15, 8, 0 }; - for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } - for (; cd[i]; i++) { + for (i=0; cd[i];) + { + if (cd[i] >= settings.bpp3d) i++; + else break; + } + for (; cd[i]; i++) + { mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); if (mode3d < 0) continue; settings.bpp3d = cd[i]; @@ -98,14 +107,16 @@ static void PopulateForm(void) modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d)); gtk_list_store_clear(modes3d); - for (i=0; i aptr) - gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1); + for (aptr = bptr = str; *aptr != 0;) + { + switch (*bptr) + { + case '\b': + if (bptr > aptr) + gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1); #if GTK_CHECK_VERSION(2,6,0) - gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE); + gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE); #else - { - GtkTextIter iter2 = enditer; - gtk_text_iter_backward_cursor_position(&iter2); - //FIXME: this seems be deleting one too many chars somewhere! - if (!gtk_text_iter_equal(&iter2, &enditer)) - gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE); - } + { + GtkTextIter iter2 = enditer; + gtk_text_iter_backward_cursor_position(&iter2); + //FIXME: this seems be deleting one too many chars somewhere! + if (!gtk_text_iter_equal(&iter2, &enditer)) + gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE); + } #endif - aptr = ++bptr; - break; - case 0: - if (bptr > aptr) - gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)); - aptr = bptr; - break; - case '\r': // FIXME - default: - bptr++; - break; + aptr = ++bptr; + break; + case 0: + if (bptr > aptr) + gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)); + aptr = bptr; + break; + case '\r': // FIXME + default: + bptr++; + break; } } @@ -607,7 +628,8 @@ int startwin_run(void) gtk_main(); SetPage(TAB_MESSAGES); - if (retval) { + if (retval) + { ScreenMode = settings.fullscreen; ScreenWidth = settings.xdim3d; ScreenHeight = settings.ydim3d; diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index e59d1732b..b23eed0f9 100755 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -26,17 +26,22 @@ static struct audioenumdrv *wavedevs = NULL; -static struct { +static struct +{ int fullscreen; int xdim, ydim, bpp; int forcesetup; int usemouse, usejoy; char selectedgrp[BMAX_PATH+1]; int game; -} settings; +} +settings; static HWND startupdlg = NULL; -static HWND pages[3] = { NULL, NULL, NULL }; +static HWND pages[3] = + { + NULL, NULL, NULL + }; static int done = -1, mode = TAB_CONFIG; #define POPULATE_VIDEO 1 @@ -49,16 +54,23 @@ static void PopulateForm(int pgs) char buf[256]; int i,j; - if (pgs & POPULATE_VIDEO) { + if (pgs & POPULATE_VIDEO) + { int mode; hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE); mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.fullscreen, 1); - if (mode < 0) { + if (mode < 0) + { int cd[] = { 32, 24, 16, 15, 8, 0 }; - for (i=0; cd[i];) { if (cd[i] >= settings.bpp) i++; else break; } - for (; cd[i]; i++) { + for (i=0; cd[i];) + { + if (cd[i] >= settings.bpp) i++; + else break; + } + for (; cd[i]; i++) + { mode = checkvideomode(&settings.xdim, &settings.ydim, cd[i], settings.fullscreen, 1); if (mode < 0) continue; settings.bpp = cd[i]; @@ -68,7 +80,8 @@ static void PopulateForm(int pgs) Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED)); ComboBox_ResetContent(hwnd); - for (i=0; idevs; - for (i=0; wavedevs->drvs[i]; i++) { + for (i=0; wavedevs->drvs[i]; i++) + { strcpy(buf, wavedevs->drvs[i]); - if (d->devs) { + if (d->devs) + { strcat(buf, ":"); n = buf + strlen(buf); - for (j=0; d->devs[j]; j++) { + for (j=0; d->devs[j]; j++) + { strcpy(n, d->devs[j]); ComboBox_AddString(hwnd, buf); } - } else { + } + else + { ComboBox_AddString(hwnd, buf); } d = d->next; @@ -109,14 +129,16 @@ static void PopulateForm(int pgs) Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), (settings.usejoy ? BST_CHECKED : BST_UNCHECKED)); } - if (pgs & POPULATE_GAME) { + if (pgs & POPULATE_GAME) + { struct grpfile *fg; int i, j; char buf[128+BMAX_PATH]; hwnd = GetDlgItem(pages[TAB_GAME], IDGDATA); - for (fg = foundgrps; fg; fg=fg->next) { + for (fg = foundgrps; fg; fg=fg->next) + { for (i = 0; icrcval == grpfiles[i].crcval) break; if (i == numgrpfiles) continue; // unrecognised grp file Bsprintf(buf, "%s\t%s", grpfiles[i].name, fg->name); @@ -129,66 +151,74 @@ static void PopulateForm(int pgs) static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) { - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDCFULLSCREEN: - settings.fullscreen = !settings.fullscreen; - PopulateForm(POPULATE_VIDEO); - return TRUE; - case IDCVMODE: - if (HIWORD(wParam) == CBN_SELCHANGE) { - int i; - i = ComboBox_GetCurSel((HWND)lParam); - if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i); - if (i != CB_ERR) { - settings.xdim = validmode[i].xdim; - settings.ydim = validmode[i].ydim; - settings.bpp = validmode[i].bpp; - } + switch (uMsg) + { + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDCFULLSCREEN: + settings.fullscreen = !settings.fullscreen; + PopulateForm(POPULATE_VIDEO); + return TRUE; + case IDCVMODE: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + int i; + i = ComboBox_GetCurSel((HWND)lParam); + if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i); + if (i != CB_ERR) + { + settings.xdim = validmode[i].xdim; + settings.ydim = validmode[i].ydim; + settings.bpp = validmode[i].bpp; + } + } + return TRUE; + case IDCALWAYSSHOW: + settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED; + return TRUE; + case IDCINPUTMOUSE: + settings.usemouse = IsDlgButtonChecked(hwndDlg, IDCINPUTMOUSE) == BST_CHECKED; + return TRUE; + case IDCINPUTJOY: + settings.usejoy = IsDlgButtonChecked(hwndDlg, IDCINPUTJOY) == BST_CHECKED; + return TRUE; + default: + break; } - return TRUE; - case IDCALWAYSSHOW: - settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED; - return TRUE; - case IDCINPUTMOUSE: - settings.usemouse = IsDlgButtonChecked(hwndDlg, IDCINPUTMOUSE) == BST_CHECKED; - return TRUE; - case IDCINPUTJOY: - settings.usejoy = IsDlgButtonChecked(hwndDlg, IDCINPUTJOY) == BST_CHECKED; - return TRUE; + break; default: break; - } - break; - default: - break; } return FALSE; } static INT_PTR CALLBACK GamePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (uMsg) { - 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; + switch (uMsg) + { + 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; + } + default: + break; } - return TRUE; - } + break; default: break; - } - break; - default: - break; } return FALSE; } @@ -226,182 +256,206 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, static HBITMAP hbmp = NULL; HDC hdc; - switch (uMsg) { - case WM_INITDIALOG: { - 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); - - // 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; - - 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; - - // 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); - 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 + switch (uMsg) + { + case WM_INITDIALOG: { - TCITEM tab; + HWND hwnd; + RECT r, rdlg, chrome, rtab, rcancel, rstart; + int xoffset = 0, yoffset = 0; - hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL); + // 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); - 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); + // 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; - // Work out the position and size of the area inside the tab control for the pages - ZeroMemory(&r, sizeof(r)); + // 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; + + 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; + + // 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); - 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; + xoffset = r.right; + yoffset = r.bottom - rdlg.bottom; - // 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); + // 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; - // 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 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); - // Set a tab stop in the game data listbox + // 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 { - DWORD tabs[1] = { 150 }; - ListBox_SetTabStops(GetDlgItem(pages[TAB_GAME], IDGDATA), 1, tabs); + 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); } - - 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; - } - - case WM_CLOSE: - if (mode == TAB_CONFIG) done = 0; - else quitevent++; - return TRUE; - - case WM_DESTROY: - if (hbmp) { - DeleteObject(hbmp); - hbmp = NULL; + return FALSE; } - if (pages[TAB_GAME]) { - DestroyWindow(pages[TAB_GAME]); - pages[TAB_GAME] = NULL; + 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; } - if (pages[TAB_CONFIG]) { - DestroyWindow(pages[TAB_CONFIG]); - pages[TAB_CONFIG] = NULL; - } - - startupdlg = NULL; - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case WIN_STARTWIN_CANCEL: + case WM_CLOSE: if (mode == TAB_CONFIG) done = 0; else quitevent++; return TRUE; - case WIN_STARTWIN_START: - done = 1; return TRUE; - } - return FALSE; - case WM_CTLCOLORSTATIC: - if ((HWND)lParam == pages[TAB_MESSAGES]) - return (BOOL)GetSysColorBrush(COLOR_WINDOW); - break; + case WM_DESTROY: + if (hbmp) + { + DeleteObject(hbmp); + hbmp = NULL; + } - default: - break; + if (pages[TAB_GAME]) + { + DestroyWindow(pages[TAB_GAME]); + pages[TAB_GAME] = NULL; + } + + if (pages[TAB_CONFIG]) + { + DestroyWindow(pages[TAB_CONFIG]); + pages[TAB_CONFIG] = NULL; + } + + startupdlg = NULL; + return TRUE; + + 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; + } + return FALSE; + + case WM_CTLCOLORSTATIC: + if ((HWND)lParam == pages[TAB_MESSAGES]) + return (BOOL)GetSysColorBrush(COLOR_WINDOW); + break; + + default: + break; } return FALSE; @@ -416,7 +470,8 @@ int startwin_open(void) icc.dwICC = ICC_TAB_CLASSES; InitCommonControlsEx(&icc); startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc); - if (startupdlg) { + if (startupdlg) + { SetPage(TAB_MESSAGES); EnableConfig(0); return 0; @@ -453,25 +508,33 @@ int startwin_puts(const char *buf) SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen); linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0); p = buf; - while (*p) { - if (newline) { + while (*p) + { + if (newline) + { SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n"); newline = 0; } q = p; while (*q && *q != '\n') q++; memcpy(workbuf, p, q-p); - if (*q == '\n') { - if (!q[1]) { + if (*q == '\n') + { + if (!q[1]) + { newline = 1; workbuf[q-p] = 0; - } else { + } + else + { workbuf[q-p] = '\r'; workbuf[q-p+1] = '\n'; workbuf[q-p+2] = 0; } p = q+1; - } else { + } + else + { workbuf[q-p] = 0; p = q; } @@ -523,23 +586,27 @@ int startwin_run(void) strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); PopulateForm(-1); - while (done < 0) { - switch (GetMessage(&msg, NULL, 0,0)) { - case 0: - done = 1; break; - case -1: - return -1; - default: - if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break; - TranslateMessage(&msg); - DispatchMessage(&msg); - break; + while (done < 0) + { + switch (GetMessage(&msg, NULL, 0,0)) + { + case 0: + done = 1; + break; + case -1: + return -1; + default: + if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break; + TranslateMessage(&msg); + DispatchMessage(&msg); + break; } } SetPage(TAB_MESSAGES); EnableConfig(0); - if (done) { + if (done) + { ScreenMode = settings.fullscreen; ScreenWidth = settings.xdim; ScreenHeight = settings.ydim; @@ -551,10 +618,12 @@ int startwin_run(void) gametype = settings.game; } - if (wavedevs) { + if (wavedevs) + { struct audioenumdev *d, *e; free(wavedevs->drvs); - for (e=wavedevs->devs; e; e=d) { + for (e=wavedevs->devs; e; e=d) + { d = e->next; if (e->devs) free(e->devs); free(e); diff --git a/polymer/eduke32/source/testcd.c b/polymer/eduke32/source/testcd.c index 69250105b..5bca4fc00 100644 --- a/polymer/eduke32/source/testcd.c +++ b/polymer/eduke32/source/testcd.c @@ -45,7 +45,8 @@ char testcd(char *fn, long testsiz) strcat(name,fn); driveletters = GetLogicalDrives(); - for (i=2; i<26; i++) { + for (i=2; i<26; i++) + { if (!(driveletters & (1ul<