diff --git a/source/games/duke/CMakeLists.txt b/source/games/duke/CMakeLists.txt index ffa0667ee..7d3902bee 100644 --- a/source/games/duke/CMakeLists.txt +++ b/source/games/duke/CMakeLists.txt @@ -16,6 +16,9 @@ set( PCH_SOURCES src/sectors_d.cpp src/sectors_r.cpp src/sounds.cpp + src/spawn.cpp + src/spawn_d.cpp + src/spawn_r.cpp src/zz_actors.cpp src/zz_anim.cpp src/zz_cheats.cpp diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 28d3f2105..cd47a0584 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -549,7 +549,7 @@ void movefx(void) case RESPAWN: if (sprite[i].extra == 66) { - j = spawn(i, sprite[i].hitag); + j = fi.spawn(i, sprite[i].hitag); if (isRRRA()) { respawn_rrra(i, j); @@ -869,7 +869,7 @@ void moveflammable(int i, int tire, int box, int pool) if (!isRR() && s->picnum == tire && hittype[i].temp_data[1] == 32) { s->cstat = 0; - j = spawn(i, pool); + j = fi.spawn(i, pool); sprite[j].shade = 127; } else @@ -946,7 +946,7 @@ void detonate(int i, int explosion) if ((t[3] == 1 && s->xrepeat) || s->lotag == -99) { int x = s->extra; - spawn(i, explosion); + fi.spawn(i, explosion); fi.hitradius(i, seenineblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x); spritesound(PIPEBOMB_EXPLODE, i); } @@ -1271,7 +1271,7 @@ void movecanwithsomething(int i) for (j = 0; j < 10; j++) RANDOMSCRAP(s, i); - if (s->lotag) spawn(i, s->lotag); + if (s->lotag) fi.spawn(i, s->lotag); deletesprite(i); } @@ -1547,7 +1547,7 @@ void forcesphere(int i, int forcesphere) for (int l = 512; l < (2048 - 512); l += 128) for (int j = 0; j < 2048; j += 128) { - int k = spawn(i, forcesphere); + int k = fi.spawn(i, forcesphere); sprite[k].cstat = 257 + 128; sprite[k].clipdist = 64; sprite[k].ang = j; @@ -1630,7 +1630,7 @@ void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int { s->z += 1024; t[2]++; - if ((t[2] & 3) == 0) spawn(i, explosion); + if ((t[2] & 3) == 0) fi.spawn(i, explosion); getglobalz(i); s->ang += 96; s->xvel = 128; @@ -1641,7 +1641,7 @@ void recon(int i, int explosion, int firelaser, int attacksnd, int painsnd, int RANDOMSCRAP(s, i); spritesound(LASERTRIP_EXPLODE, i); int sp = getspawn(i); - if (sp >= 0) spawn(i, sp); + if (sp >= 0) fi.spawn(i, sp); ps[myconnectindex].actors_killed++; deletesprite(i); } @@ -2514,7 +2514,7 @@ void scrap(int i, int SCRAP1, int SCRAP6) { if (s->picnum == SCRAP1 && s->yvel > 0) { - int j = spawn(i, s->yvel); + int j = fi.spawn(i, s->yvel); setsprite(j, s->x, s->y, s->z); getglobalz(j); sprite[j].hitag = sprite[j].lotag = 0; @@ -4537,12 +4537,12 @@ void handle_se35(int i, int SMALLSMOKE, int EXPLOSION2) for (int j = 0; j < 8; j++) { s->ang += krand() & 511; - int k = spawn(i, SMALLSMOKE); + int k = fi.spawn(i, SMALLSMOKE); sprite[k].xvel = 96 + (krand() & 127); ssp(k, CLIPMASK0); setsprite(k, sprite[k].x, sprite[k].y, sprite[k].z); if (rnd(16)) - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); } switch (t[0]) @@ -4628,7 +4628,7 @@ void handle_se130(int i, int countmax, int EXPLOSION2) if (rnd(64)) { - int k = spawn(i, EXPLOSION2); + int k = fi.spawn(i, EXPLOSION2); sprite[k].xrepeat = sprite[k].yrepeat = 2 + (krand() & 7); sprite[k].z = sc->floorz - (krand() % x); sprite[k].ang += 256 - (krand() % 511); @@ -5021,7 +5021,7 @@ void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOT { fi.guts(g_sp, JIBS6, 15, g_p); spritesound(squished, g_i); - spawn(g_i, BLOODPOOL); + fi.spawn(g_i, BLOODPOOL); } } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index c62547eaa..e06141a04 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1005,7 +1005,7 @@ static void movetripbomb(int i) x = s->extra; fi.hitradius(i, tripbombblastradius, x >> 2, x >> 1, x - (x >> 2), x); - j = spawn(i, EXPLOSION2); + j = fi.spawn(i, EXPLOSION2); sprite[j].ang = s->ang; sprite[j].xvel = 348; ssp(j, CLIPMASK0); @@ -1066,7 +1066,7 @@ static void movetripbomb(int i) // we're on a trip wire while (x > 0) { - j = spawn(i, LASERLINE); + j = fi.spawn(i, LASERLINE); setsprite(j, sprite[j].x, sprite[j].y, sprite[j].z); sprite[j].hitag = s->hitag; hittype[j].temp_data[1] = sprite[j].z; @@ -1177,7 +1177,7 @@ static void movefireext(int i) sprite[j].pal = 2; } - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); spritesound(PIPEBOMB_EXPLODE, i); spritesound(GLASS_HEAVYBREAK, i); @@ -1193,7 +1193,7 @@ static void movefireext(int i) } int x = s->extra; - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); fi.hitradius(i, pipebombblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x); spritesound(PIPEBOMB_EXPLODE, i); detonate(i, EXPLOSION2); @@ -1520,7 +1520,7 @@ void moveweapons_d(void) case FREEZEBLAST: if (s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) { - j = spawn(i,TRANSPORTERSTAR); + j = fi.spawn(i,TRANSPORTERSTAR); sprite[j].pal = 1; sprite[j].xrepeat = 32; sprite[j].yrepeat = 32; @@ -1564,7 +1564,7 @@ void moveweapons_d(void) case RPG: if (hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { - j = spawn(i,SMALLSMOKE); + j = fi.spawn(i,SMALLSMOKE); sprite[j].z += (1 << 8); } break; @@ -1584,7 +1584,7 @@ void moveweapons_d(void) { float siz = 1.0f - (hittype[i].temp_data[0] * 0.2f); int trail = hittype[i].temp_data[1]; - j = hittype[i].temp_data[1] = spawn(i, FIREBALL); + j = hittype[i].temp_data[1] = fi.spawn(i, FIREBALL); auto spr = &sprite[j]; spr->xvel = sprite[i].xvel; @@ -1688,7 +1688,7 @@ void moveweapons_d(void) if (s->picnum == FREEZEBLAST && sprite[j].pal == 1) if (badguy(&sprite[j]) || sprite[j].picnum == APLAYER) { - j = spawn(i,TRANSPORTERSTAR); + j = fi.spawn(i,TRANSPORTERSTAR); sprite[j].pal = 1; sprite[j].xrepeat = 32; sprite[j].yrepeat = 32; @@ -1746,7 +1746,7 @@ void moveweapons_d(void) wall[wall[j].point2].y-wall[j].y); s->ang = ((k << 1) - s->ang)&2047; s->owner = i; - spawn(i,TRANSPORTERSTAR); + fi.spawn(i,TRANSPORTERSTAR); continue; } else @@ -1787,7 +1787,7 @@ void moveweapons_d(void) } else if (fireball) { - j = spawn(i, LAVAPOOL); + j = fi.spawn(i, LAVAPOOL); sprite[j].owner = sprite[i].owner; sprite[j].yvel = sprite[i].yvel; actor[j].owner = sprite[i].owner; @@ -1815,7 +1815,7 @@ void moveweapons_d(void) { if (s->picnum == RPG) { - k = spawn(i,EXPLOSION2); + k = fi.spawn(i,EXPLOSION2); sprite[k].x = dax; sprite[k].y = day; sprite[k].z = daz; @@ -1828,19 +1828,19 @@ void moveweapons_d(void) else if ((j&49152) == 16384) { if (s->zvel > 0) - spawn(i,EXPLOSION2BOT); + fi.spawn(i,EXPLOSION2BOT); else { sprite[k].cstat |= 8; sprite[k].z += (48 << 8); } } } else if (s->picnum == SHRINKSPARK) { - spawn(i,SHRINKEREXPLOSION); + fi.spawn(i,SHRINKEREXPLOSION); spritesound(SHRINKER_HIT,i); fi.hitradius(i,shrinkerblastradius,0,0,0,0); } else if (s->picnum != COOLEXPLOSION1 && s->picnum != FREEZEBLAST && s->picnum != FIRELASER && (!isWorldTour() || s->picnum != FIREBALL)) { - k = spawn(i,EXPLOSION2); + k = fi.spawn(i,EXPLOSION2); sprite[k].xrepeat = sprite[k].yrepeat = s->xrepeat>>1; if ((j&49152) == 16384) { @@ -1867,7 +1867,7 @@ void moveweapons_d(void) } if (fireball) { - j = spawn(i, EXPLOSION2); + j = fi.spawn(i, EXPLOSION2); sprite[j].xrepeat = sprite[j].yrepeat = (short)(s->xrepeat >> 1); } } @@ -1887,7 +1887,7 @@ void moveweapons_d(void) } } else if (s->picnum == RPG && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(140)) - spawn(i,WATERBUBBLE); + fi.spawn(i,WATERBUBBLE); break; case SHOTSPARK1: @@ -1948,7 +1948,7 @@ void movetransports_d(void) { if (sprite[i].pal == 0) { - spawn(i, TRANSPORTERBEAM); + fi.spawn(i, TRANSPORTERBEAM); spritesound(TELEPORTER, i); } @@ -1977,7 +1977,7 @@ void movetransports_d(void) if (sprite[i].pal == 0) { - k = spawn(sprite[i].owner, TRANSPORTERBEAM); + k = fi.spawn(sprite[i].owner, TRANSPORTERBEAM); spritesound(TELEPORTER, k); } @@ -2060,12 +2060,12 @@ void movetransports_d(void) setpal(&ps[p]); if ((krand() & 255) < 32) - spawn(j, WATERSPLASH2); + fi.spawn(j, WATERSPLASH2); if (sectlotag == 1) for (l = 0; l < 9; l++) { - q = spawn(ps[p].i, WATERBUBBLE); + q = fi.spawn(ps[p].i, WATERBUBBLE); sprite[q].z += krand() & 16383; } } @@ -2144,7 +2144,7 @@ void movetransports_d(void) if (sectlotag > 0) { - k = spawn(j, WATERSPLASH2); + k = fi.spawn(j, WATERSPLASH2); if (sectlotag == 1 && sprite[j].statnum == 4) { sprite[k].xvel = sprite[j].xvel >> 1; @@ -2171,10 +2171,10 @@ void movetransports_d(void) if (sprite[i].pal == 0) { - k = spawn(i, TRANSPORTERBEAM); + k = fi.spawn(i, TRANSPORTERBEAM); spritesound(TELEPORTER, k); - k = spawn(sprite[i].owner, TRANSPORTERBEAM); + k = fi.spawn(sprite[i].owner, TRANSPORTERBEAM); spritesound(TELEPORTER, k); } @@ -2351,7 +2351,7 @@ static void greenslime(int i) spritesound(SQUISHED, i); if ((krand() & 255) < 32) { - j = spawn(i, BLOODPOOL); + j = fi.spawn(i, BLOODPOOL); sprite[j].pal = 0; } ps[p].actors_killed++; @@ -2451,7 +2451,7 @@ static void greenslime(int i) if ((krand() & 255) < 32) { - j = spawn(i, BLOODPOOL); + j = fi.spawn(i, BLOODPOOL); sprite[j].pal = 0; } @@ -2663,7 +2663,7 @@ static void flamethrowerflame(int i) t[0]++; if (sector[sect].lotag == 2) { - sprite[spawn(i, EXPLOSION2)].shade = 127; + sprite[fi.spawn(i, EXPLOSION2)].shade = 127; deletesprite(i); return; } @@ -2682,7 +2682,7 @@ static void flamethrowerflame(int i) t[3] = krand() % 10; if (t[0] > 30) { - sprite[spawn(i, EXPLOSION2)].shade = 127; + sprite[fi.spawn(i, EXPLOSION2)].shade = 127; deletesprite(i); return; } @@ -2766,7 +2766,7 @@ static void heavyhbomb(int i) if (t[2] <= 0) { spritesound(TELEPORTER, i); - spawn(i, TRANSPORTERSTAR); + fi.spawn(i, TRANSPORTERSTAR); s->cstat = 257; } return; @@ -2821,7 +2821,7 @@ static void heavyhbomb(int i) if (t[5] == 0) { t[5] = 1; - spawn(i, WATERSPLASH2); + fi.spawn(i, WATERSPLASH2); } } else t[5] = 0; @@ -2891,9 +2891,9 @@ DETONATEB: } fi.hitradius(i, m, x >> 2, x >> 1, x - (x >> 2), x); - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); if (s->zvel == 0) - spawn(i, EXPLOSION2BOT); + fi.spawn(i, EXPLOSION2BOT); spritesound(PIPEBOMB_EXPLODE, i); for (x = 0; x < 8; x++) RANDOMSCRAP(s, i); @@ -2915,7 +2915,7 @@ DETONATEB: else { t[2] = respawnitemtime; - spawn(i, RESPAWNMARKERRED); + fi.spawn(i, RESPAWNMARKERRED); s->cstat = (short)32768; s->yrepeat = 9; return; @@ -2958,7 +2958,7 @@ DETONATEB: else { t[2] = respawnitemtime; - spawn(i, RESPAWNMARKERRED); + fi.spawn(i, RESPAWNMARKERRED); s->cstat = (short)32768; } } @@ -3079,7 +3079,7 @@ void moveactors_d(void) continue; } else if ((t[0] & 3) == 0) - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); ssp(i, CLIPMASK0); break; case RAT: @@ -3115,7 +3115,7 @@ void moveactors_d(void) case BOUNCEMINE: case MORTER: - j = spawn(i, FRAMEEFFECT1); + j = fi.spawn(i, FRAMEEFFECT1); hittype[j].temp_data[0] = 3; case HEAVYHBOMB: @@ -3743,7 +3743,7 @@ void moveeffectors_d(void) //STATNUM 3 if (rnd(32) && (hittype[i].temp_data[2] & 1)) { sprite[j].cstat &= 32767; - spawn(j, SMALLSMOKE); + fi.spawn(j, SMALLSMOKE); p = findplayer(s, &x); x = ldist(&sprite[ps[p].i], &sprite[j]); diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 6e1934f66..daeb919bc 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1178,7 +1178,7 @@ void moveweapons_r(void) case FREEZEBLAST: if (s->yvel < 1 || s->extra < 2 || (s->xvel | s->zvel) == 0) { - j = spawn(i, TRANSPORTERSTAR); + j = fi.spawn(i, TRANSPORTERSTAR); sprite[j].pal = 1; sprite[j].xrepeat = 32; sprite[j].yrepeat = 32; @@ -1223,7 +1223,7 @@ void moveweapons_r(void) case RPG: if (hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { - j = spawn(i, SMALLSMOKE); + j = fi.spawn(i, SMALLSMOKE); sprite[j].z += (1 << 8); } break; @@ -1232,11 +1232,11 @@ void moveweapons_r(void) s->hitag++; if (hittype[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { - j = spawn(i, SMALLSMOKE); + j = fi.spawn(i, SMALLSMOKE); sprite[j].z += (1 << 8); if ((krand() & 15) == 2) { - j = spawn(i, 1310); + j = fi.spawn(i, 1310); } } if (sprite[s->lotag].extra <= 0) @@ -1282,7 +1282,7 @@ void moveweapons_r(void) makeitfall(i); if (s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { - j = spawn(i, SMALLSMOKE); + j = fi.spawn(i, SMALLSMOKE); sprite[j].z += (1 << 8); } break; @@ -1350,7 +1350,7 @@ void moveweapons_r(void) && sprite[j].pal == 19) { spritesound(RPG_EXPLODE, i); - k = spawn(i, EXPLOSION2); + k = fi.spawn(i, EXPLOSION2); sprite[k].x = dax; sprite[k].y = day; sprite[k].z = daz; @@ -1360,7 +1360,7 @@ void moveweapons_r(void) else if (s->picnum == FREEZEBLAST && sprite[j].pal == 1) if (badguy(&sprite[j]) || sprite[j].picnum == APLAYER) { - j = spawn(i,TRANSPORTERSTAR); + j = fi.spawn(i,TRANSPORTERSTAR); sprite[j].pal = 1; sprite[j].xrepeat = 32; sprite[j].yrepeat = 32; @@ -1422,7 +1422,7 @@ void moveweapons_r(void) wall[wall[j].point2].y - wall[j].y); s->ang = ((k << 1) - s->ang) & 2047; s->owner = i; - spawn(i, TRANSPORTERSTAR); + fi.spawn(i, TRANSPORTERSTAR); continue; } else @@ -1460,7 +1460,7 @@ void moveweapons_r(void) s->y += sintable[s->ang & 2047] >> 7; if (!isRRRA() || (sprite[s->owner].picnum != CHEER && sprite[s->owner].picnum != CHEERSTAYPUT)) { - j = spawn(i, CIRCLESTUCK); + j = fi.spawn(i, CIRCLESTUCK); sprite[j].xrepeat = 8; sprite[j].yrepeat = 8; sprite[j].cstat = 16; @@ -1525,7 +1525,7 @@ void moveweapons_r(void) { if (s->picnum == RPG) { - k = spawn(i, EXPLOSION2); + k = fi.spawn(i, EXPLOSION2); sprite[k].x = dax; sprite[k].y = day; sprite[k].z = daz; @@ -1543,7 +1543,7 @@ void moveweapons_r(void) } else if (isRRRA() && s->picnum == RPG2) { - k = spawn(i, EXPLOSION2); + k = fi.spawn(i, EXPLOSION2); sprite[k].x = dax; sprite[k].y = day; sprite[k].z = daz; @@ -1562,7 +1562,7 @@ void moveweapons_r(void) else if (isRRRA() && s->picnum == RRTILE1790) { s->extra = 160; - k = spawn(i, EXPLOSION2); + k = fi.spawn(i, EXPLOSION2); sprite[k].x = dax; sprite[k].y = day; sprite[k].z = daz; @@ -1580,7 +1580,7 @@ void moveweapons_r(void) } else if (s->picnum != FREEZEBLAST && s->picnum != FIRELASER && s->picnum != SHRINKSPARK) { - k = spawn(i, 1441); + k = fi.spawn(i, 1441); sprite[k].xrepeat = sprite[k].yrepeat = s->xrepeat >> 1; if ((j & 49152) == 16384) { @@ -1642,7 +1642,7 @@ void moveweapons_r(void) continue; } if ((s->picnum == RPG || (isRRRA() && s->picnum == RPG2)) && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(184)) - spawn(i, WATERBUBBLE); + fi.spawn(i, WATERBUBBLE); continue; @@ -1707,7 +1707,7 @@ void movetransports_r(void) { if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0) { - spawn(i, TRANSPORTERBEAM); + fi.spawn(i, TRANSPORTERBEAM); spritesound(TELEPORTER, i); for (k = connecthead; k >= 0; k = connectpoint2[k])// connectpoinhittype[i].temp_data[1][k]) @@ -1733,7 +1733,7 @@ void movetransports_r(void) changespritesect(j, sprite[OW].sectnum); ps[p].cursectnum = sprite[j].sectnum; - k = spawn(OW, TRANSPORTERBEAM); + k = fi.spawn(OW, TRANSPORTERBEAM); spritesound(TELEPORTER, k); break; @@ -1823,7 +1823,7 @@ void movetransports_r(void) setpal(&ps[p]); if ((krand() & 255) < 32) - spawn(ps[p].i, WATERSPLASH2); + fi.spawn(ps[p].i, WATERSPLASH2); } else if (isRRRA() && k == 2) { @@ -1925,7 +1925,7 @@ void movetransports_r(void) if (sectlotag > 0) { - k = spawn(j, WATERSPLASH2); + k = fi.spawn(j, WATERSPLASH2); if (sectlotag == 1 && sprite[j].statnum == 4) { sprite[k].xvel = sprite[j].xvel >> 1; @@ -1950,10 +1950,10 @@ void movetransports_r(void) hittype[j].bposy = sprite[j].y; hittype[j].bposz = sprite[j].z; - k = spawn(i, TRANSPORTERBEAM); + k = fi.spawn(i, TRANSPORTERBEAM); spritesound(TELEPORTER, k); - k = spawn(OW, TRANSPORTERBEAM); + k = fi.spawn(OW, TRANSPORTERBEAM); spritesound(TELEPORTER, k); if (sprite[OW].owner != OW) @@ -2088,7 +2088,7 @@ static void rrra_specialstats() sprite[i].extra--; if (sprite[i].extra <= -104) { - spawn(i, sprite[i].lotag); + fi.spawn(i, sprite[i].lotag); deletesprite(i); } } @@ -2221,7 +2221,7 @@ static void rrra_specialstats() setsprite(i, sprite[i].x, sprite[i].y, sector[sprite[i].sectnum].floorz - 10); sprite[i].extra = 1; sprite[i].picnum = PIG + 11; - spawn(i, TRANSPORTERSTAR); + fi.spawn(i, TRANSPORTERSTAR); } i = nexti; } @@ -2236,7 +2236,7 @@ static void rrra_specialstats() { sprite[i].hitag--; sprite[i].extra = 150; - spawn(i, RABBIT); + fi.spawn(i, RABBIT); } else sprite[i].extra--; @@ -2298,7 +2298,7 @@ static void rrra_specialstats() else { sprite[i].picnum = RRTILE8162 + 2; - spawn(i, BATTERYAMMO); + fi.spawn(i, BATTERYAMMO); ps[screenpeek].SlotWin |= 1; spritesound(52, i); } @@ -2312,7 +2312,7 @@ static void rrra_specialstats() else { sprite[i].picnum = RRTILE8162 + 6; - spawn(i, HEAVYHBOMB); + fi.spawn(i, HEAVYHBOMB); ps[screenpeek].SlotWin |= 2; spritesound(52, i); } @@ -2326,7 +2326,7 @@ static void rrra_specialstats() else { sprite[i].picnum = RRTILE8162 + 5; - spawn(i, SIXPAK); + fi.spawn(i, SIXPAK); ps[screenpeek].SlotWin |= 4; spritesound(52, i); } @@ -2340,7 +2340,7 @@ static void rrra_specialstats() else { sprite[i].picnum = RRTILE8162 + 4; - spawn(i, ATOMICHEALTH); + fi.spawn(i, ATOMICHEALTH); ps[screenpeek].SlotWin |= 8; spritesound(52, i); } @@ -2376,7 +2376,7 @@ static void rrra_specialstats() else { sprite[i].picnum = RRTILE8589 + 5; - spawn(i, BATTERYAMMO); + fi.spawn(i, BATTERYAMMO); ps[screenpeek].SlotWin |= 1; spritesound(342, i); } @@ -2390,7 +2390,7 @@ static void rrra_specialstats() else { sprite[i].picnum = RRTILE8589 + 6; - spawn(i, HEAVYHBOMB); + fi.spawn(i, HEAVYHBOMB); ps[screenpeek].SlotWin |= 2; spritesound(342, i); } @@ -2404,7 +2404,7 @@ static void rrra_specialstats() else { sprite[i].picnum = RRTILE8589 + 2; - spawn(i, SIXPAK); + fi.spawn(i, SIXPAK); ps[screenpeek].SlotWin |= 4; spritesound(342, i); } @@ -2418,7 +2418,7 @@ static void rrra_specialstats() else { sprite[i].picnum = RRTILE8589 + 3; - spawn(i, ATOMICHEALTH); + fi.spawn(i, ATOMICHEALTH); ps[screenpeek].SlotWin |= 8; spritesound(342, i); } @@ -2499,7 +2499,7 @@ void rr_specialstats() sprite[i].lotag--; if (sprite[i].lotag < 0) { - j = spawn(i, RRTILE3190); + j = fi.spawn(i, RRTILE3190); sprite[j].ang = sprite[i].ang; sprite[i].lotag = 128; } @@ -2508,7 +2508,7 @@ void rr_specialstats() sprite[i].lotag--; if (sprite[i].lotag < 0) { - j = spawn(i, RRTILE3192); + j = fi.spawn(i, RRTILE3192); sprite[j].ang = sprite[i].ang; sprite[i].lotag = 256; } @@ -2525,7 +2525,7 @@ void rr_specialstats() sprite[i].lotag--; if (sprite[i].lotag < 0) { - j = spawn(i, RRTILE3132); + j = fi.spawn(i, RRTILE3132); sprite[i].lotag = 96; if (!isRRRA()) spritesound(472, j); } @@ -2534,7 +2534,7 @@ void rr_specialstats() sprite[i].lotag--; if (sprite[i].lotag < 0) { - j = spawn(i, RRTILE3120); + j = fi.spawn(i, RRTILE3120); sprite[j].ang = sprite[i].ang; sprite[i].lotag = 448; } @@ -2543,7 +2543,7 @@ void rr_specialstats() sprite[i].lotag--; if (sprite[i].lotag < 0) { - j = spawn(i, RRTILE3122); + j = fi.spawn(i, RRTILE3122); sprite[j].ang = sprite[i].ang; sprite[i].lotag = 64; } @@ -2552,7 +2552,7 @@ void rr_specialstats() sprite[i].lotag--; if (sprite[i].lotag < 0) { - j = spawn(i, RRTILE3123); + j = fi.spawn(i, RRTILE3123); sprite[j].ang = sprite[i].ang; sprite[i].lotag = 512; } @@ -2561,7 +2561,7 @@ void rr_specialstats() sprite[i].lotag--; if (sprite[i].lotag < 0) { - j = spawn(i, RRTILE3124); + j = fi.spawn(i, RRTILE3124); sprite[j].ang = sprite[i].ang; sprite[i].lotag = 224; } @@ -2665,7 +2665,7 @@ static void heavyhbomb(int i) if (t[2] <= 0) { spritesound(TELEPORTER, i); - spawn(i, TRANSPORTERSTAR); + fi.spawn(i, TRANSPORTERSTAR); s->cstat = 257; } return; @@ -2727,7 +2727,7 @@ static void heavyhbomb(int i) if (t[5] == 0) { t[5] = 1; - spawn(i, WATERSPLASH2); + fi.spawn(i, WATERSPLASH2); if (isRRRA() && s->picnum == MORTER) s->xvel = 0; } @@ -2811,9 +2811,9 @@ DETONATEB: if (sector[s->sectnum].lotag != 800) { fi.hitradius(i, m, x >> 2, x >> 1, x - (x >> 2), x); - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); if (s->picnum == CHEERBOMB) - spawn(i, BURNING); + fi.spawn(i, BURNING); spritesound(PIPEBOMB_EXPLODE, i); for (x = 0; x < 8; x++) RANDOMSCRAP(s, i); @@ -2833,7 +2833,7 @@ DETONATEB: } if (s->picnum == CHEERBOMB) { - spawn(i, BURNING); + fi.spawn(i, BURNING); deletesprite(i); return; } @@ -2876,7 +2876,7 @@ DETONATEB: else { t[2] = respawnitemtime; - spawn(i, RESPAWNMARKERRED); + fi.spawn(i, RESPAWNMARKERRED); s->cstat = (short)32768; } } @@ -2902,7 +2902,7 @@ static int henstand(int i) s->lotag--; if (s->lotag == 0) { - spawn(i, HEN); + fi.spawn(i, HEN); deletesprite(i); return 1; } @@ -2932,7 +2932,7 @@ static int henstand(int i) fi.checkhitsprite(i, j); if (sprite[j].picnum == HEN) { - int ns = spawn(j, HENSTAND); + int ns = fi.spawn(j, HENSTAND); deletesprite(j); sprite[ns].xvel = 32; sprite[ns].lotag = 40; @@ -3117,7 +3117,7 @@ void moveactors_r(void) { if (sector[s->sectnum].lotag == 1) { - j = spawn(i,WATERSPLASH2); + j = fi.spawn(i,WATERSPLASH2); sprite[j].z = sector[sprite[j].sectnum].floorz; } deletesprite(i); @@ -3132,7 +3132,7 @@ void moveactors_r(void) } else { - spawn(i,BOWLINGBALLSPRITE); + fi.spawn(i,BOWLINGBALLSPRITE); deletesprite(i); continue; } @@ -3555,7 +3555,7 @@ void moveeffectors_r(void) //STATNUM 3 if ((!isRRRA() || lastlevel) && hulkspawn) { hulkspawn--; - ns = spawn(i, HULK); + ns = fi.spawn(i, HULK); sprite[ns].z = sector[sprite[ns].sectnum].ceilingz; sprite[ns].pal = 33; if (!hulkspawn) @@ -3565,7 +3565,7 @@ void moveeffectors_r(void) //STATNUM 3 sprite[ns].pal = 7; sprite[ns].xrepeat = 80; sprite[ns].yrepeat = 255; - ns = spawn(i, 296); + ns = fi.spawn(i, 296); sprite[ns].cstat = 0; sprite[ns].cstat |= 32768; sprite[ns].z = sector[s->sectnum].floorz - 6144; @@ -3608,7 +3608,7 @@ void moveeffectors_r(void) //STATNUM 3 } } else pn = UFO1_RRRA; - ns = spawn(i, pn); + ns = fi.spawn(i, pn); sprite[ns].z = sector[sprite[ns].sectnum].ceilingz; } j = nextj; @@ -4360,16 +4360,16 @@ void fakebubbaspawn(int g_i, int g_p) default: break; case 1: - spawn(g_i, PIG); + fi.spawn(g_i, PIG); break; case 2: - spawn(g_i, MINION); + fi.spawn(g_i, MINION); break; case 3: - spawn(g_i, CHEER); + fi.spawn(g_i, CHEER); break; case 4: - spawn(g_i, VIXEN); + fi.spawn(g_i, VIXEN); operateactivators(666, ps[g_p].i); break; } @@ -4391,8 +4391,8 @@ static int fallspecial(int g_i, int g_p) { if (g_sp->picnum == ROCK) { - spawn(g_i, ROCK2); - spawn(g_i, ROCK2); + fi.spawn(g_i, ROCK2); + fi.spawn(g_i, ROCK2); addspritetodelete(g_i); } return 0; @@ -4613,7 +4613,7 @@ void mamaspawn(int g_i) if (mamaspawn_count) { mamaspawn_count--; - spawn(g_i, RABBIT); + fi.spawn(g_i, RABBIT); } } diff --git a/source/games/duke/src/bowling.cpp b/source/games/duke/src/bowling.cpp index ec48f3f16..1ae017c25 100644 --- a/source/games/duke/src/bowling.cpp +++ b/source/games/duke/src/bowling.cpp @@ -52,7 +52,7 @@ void ballreturn(short spr) nextj = nextspritestat[j]; if (sprite[j].picnum == RRTILE282) if (sprite[i].hitag == sprite[j].hitag) - spawn(j, BOWLINGBALLSPRITE); + fi.spawn(j, BOWLINGBALLSPRITE); if (sprite[j].picnum == RRTILE280) if (sprite[i].hitag == sprite[j].hitag) if (sprite[j].lotag == 0) @@ -207,7 +207,7 @@ void resetpins(short sect) nexti = nextspritesect[i]; if (sprite[i].picnum == 283) { - j = spawn(i,3440); + j = fi.spawn(i,3440); sprite[j].lotag = sprite[i].lotag; if (sprite[j].lotag == 3 || sprite[j].lotag == 5) { diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 6ad6cf57c..70bf6a8c2 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -86,6 +86,8 @@ void checktimetosleep_d(int g_i); void checktimetosleep_r(int g_i); void move_d(int g_i, int g_p, int g_x); void move_r(int g_i, int g_p, int g_x); +int spawn_d(int j, int pn); +int spawn_r(int j, int pn); Dispatcher fi; @@ -122,7 +124,8 @@ void SetDispatcher() spawnweapondebris_d, respawnhitag_d, checktimetosleep_d, - move_d + move_d, + spawn_d, }; } else @@ -157,6 +160,7 @@ void SetDispatcher() respawnhitag_r, checktimetosleep_r, move_r, + spawn_r, }; } } diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index 51cb7bcf7..a75577752 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -230,11 +230,6 @@ inline int inventory(spritetype* S) int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr, uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss); #define EGS A_InsertSprite -int A_Spawn(int spriteNum,int tileNum); -inline int spawn(int s, int t) -{ - return A_Spawn(s, t); -} int G_DoMoveThings(void); //int32_t G_EndOfLevel(void); @@ -291,7 +286,7 @@ void OnBoat(DukePlayer_t *pPlayer, int spriteNum); void OffBoat(DukePlayer_t *pPlayer); // Cstat protection mask for (currently) spawned MASKWALL* sprites. -// TODO: look at more cases of cstat=(cstat&PROTECTED)|ADDED in A_Spawn()? +// TODO: look at more cases of cstat=(cstat&PROTECTED)|ADDED in fi.spawn()? // 2048+(32+16)+8+4 #define SPAWN_PROTECT_CSTAT_MASK (CSTAT_SPRITE_NOSHADE|CSTAT_SPRITE_ALIGNMENT_SLAB|CSTAT_SPRITE_XFLIP|CSTAT_SPRITE_YFLIP); @@ -452,6 +447,17 @@ extern void G_PrintCurrentMusic(void); void addspritetodelete(int spnum); +int initspriteforspawn(int j, int pn, const std::initializer_list &excludes); +void spawninitdefault(int j, int i); +void spawntransporter(int j, int i, bool beam); +int spawnbloodpoolpart1(int j, int i); +void initfootprint(int j, int i); +void initshell(int j, int i, bool isshell); +void initcrane(int j, int i, int CRANEPOLE); +void initwaterdrip(int j, int i); +int initreactor(int j, int i, bool isrecon); +void spawneffector(int i); + struct Dispatcher { // sectors_?.cpp @@ -484,6 +490,7 @@ struct Dispatcher void (*respawnhitag)(spritetype* g_sp); void (*checktimetosleep)(int g_i); void (*move)(int g_i, int g_p, int g_x); + int (*spawn)(int j, int pn); }; diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 4a702c9fe..35d1cff35 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -106,7 +106,6 @@ void SortCommands() // //--------------------------------------------------------------------------- -#if 0 enum { ERROR_ISAKEYWORD = 1, @@ -118,13 +117,7 @@ enum ERROR_NOTAGAMEVAR, ERROR_OPENBRACKET, ERROR_CLOSEBRACKET, - ERROR_NOENDSWITCH -}; -#endif - -enum -{ - ERROR_PARMUNDEFINED = 20, + ERROR_NOENDSWITCH, }; void ReportError(int iError) @@ -1607,7 +1600,7 @@ int parsecommand() max_ammo_amount[8] = parseone(); max_ammo_amount[9] = parseone(); max_ammo_amount[11] = parseone(); - if (isRR()) max_ammo_amount[12] = parseone(); + if (isRR() || isWorldTour()) max_ammo_amount[12] = parseone(); camerashitable = parseone(); numfreezebounces = parseone(); freezerhurtowner = parseone(); diff --git a/source/games/duke/src/gamedef.h b/source/games/duke/src/gamedef.h index cab132d9a..6ed7853e1 100644 --- a/source/games/duke/src/gamedef.h +++ b/source/games/duke/src/gamedef.h @@ -75,37 +75,9 @@ typedef struct { extern char const * VM_GetKeywordForID(int32_t id); -enum ScriptError_t -{ - ERROR_CLOSEBRACKET, - ERROR_EXCEEDSMAXTILES, - ERROR_EXPECTEDKEYWORD, - ERROR_FOUNDWITHIN, - ERROR_ISAKEYWORD, - ERROR_OPENBRACKET, - ERROR_NOTAGAMEVAR, - ERROR_PARAMUNDEFINED, - ERROR_SYNTAXERROR, - ERROR_VARREADONLY, - ERROR_VARTYPEMISMATCH, - WARNING_BADGAMEVAR, - WARNING_DUPLICATEDEFINITION, - WARNING_LABELSONLY, - WARNING_VARMASKSKEYWORD, - - ERROR_COULDNOTFIND, - ERROR_NOTAGAMEDEF, - ERROR_NOENDSWITCH -}; - -enum -{ -}; - #include "concmd.h" -// KEEPINSYNC with the keyword list in lunatic/con_lang.lua END_DUKE_NS diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 8eb7e3a0d..ecfba53da 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -848,7 +848,7 @@ int parse(void) case concmd_spawn: insptr++; if(g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) - spawn(g_i,*insptr); + fi.spawn(g_i,*insptr); insptr++; break; case concmd_ifwasweapon: diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index 8b9136727..bc934f4b5 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -217,11 +217,11 @@ inline int32_t G_DefaultActorHealth(int spriteNum) // rename! G_EXTERN vec2_t g_origins[MAXANIMPOINTS]; struct msx_ { - int operator[](int v) { return g_origins[v].x; } + int &operator[](int v) { return g_origins[v].x; } }; struct msy_ { - int operator[](int v) { return g_origins[v].y; } + int &operator[](int v) { return g_origins[v].y; } }; G_EXTERN msx_ msx; G_EXTERN msy_ msy; @@ -231,7 +231,7 @@ G_EXTERN int16_t fakebubba_spawn, mamaspawn_count, banjosound, g_bellTime, g_bel #define BellTime g_bellTime #define word_119BE0 g_bellSprite G_EXTERN uint8_t g_spriteExtra[MAXSPRITES], g_sectorExtra[MAXSECTORS]; // move these back into the base structs! -G_EXTERN uint8_t enemysizecheat, ufospawnsminion, pistonsound, g_chickenWeaponTimer, RRRA_ExitedLevel, RRRA_EndEpisode, g_fogType; +G_EXTERN uint8_t enemysizecheat, ufospawnsminion, pistonsound, g_chickenWeaponTimer, RRRA_ExitedLevel, RRRA_EndEpisode, fogactive; G_EXTERN int32_t g_cdTrack; #define raat607 enemysizecheat // only as a reminder diff --git a/source/games/duke/src/names.h b/source/games/duke/src/names.h index 9dc6222cf..bf4f6f156 100644 --- a/source/games/duke/src/names.h +++ b/source/games/duke/src/names.h @@ -764,6 +764,7 @@ enum DEVELOPERCOMMENTARY = 5294, BOSS5 = 5310, BOSS5STAYPUT = 5311, + SERIOUSSAM = 5846 }; END_DUKE_NS diff --git a/source/games/duke/src/namesdyn.h b/source/games/duke/src/namesdyn.h index 1a7145239..7304afb90 100644 --- a/source/games/duke/src/namesdyn.h +++ b/source/games/duke/src/namesdyn.h @@ -3585,6 +3585,7 @@ enum dukeweapon_t_alt FREEZE_WEAPON, HANDREMOTE_WEAPON, // 10 GROW_WEAPON, + FLAMETHROWER_WEAPON, // World Tour MIN_WEAPON = 0, MAX_WEAPON = 9 diff --git a/source/games/duke/src/premap.h b/source/games/duke/src/premap.h index 179ccbbbb..a5cc7e332 100644 --- a/source/games/duke/src/premap.h +++ b/source/games/duke/src/premap.h @@ -43,7 +43,7 @@ void P_ResetWeapons(int playerNum); void G_ClearFIFO(void); void G_ResetInterpolations(void); extern int32_t fragbarheight(void); -void G_SetFog(int fogtype); +void setmapfog(int fogtype); void G_InitRRRASkies(void); END_DUKE_NS diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 6ce427a3f..e458dbfc3 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -196,7 +196,7 @@ void operaterespawns_d(int low) case RESPAWN: if (badguypic(sprite[i].hitag) && ud.monsters_off) break; - j = spawn(i, TRANSPORTERSTAR); + j = fi.spawn(i, TRANSPORTERSTAR); sprite[j].z -= (32 << 8); sprite[i].extra = 66 - 12; // Just a way to killit @@ -1053,7 +1053,7 @@ void checkhitsprite_d(int i, int sn) case OCEANSPRITE3: case OCEANSPRITE4: case OCEANSPRITE5: - spawn(i, SMALLSMOKE); + fi.spawn(i, SMALLSMOKE); deletesprite(i); break; case QUEBALL: @@ -1096,7 +1096,7 @@ void checkhitsprite_d(int i, int sn) { sprite[i].cstat &= ~257; hittype[i].temp_data[0] = 1; - spawn(i, BURNING); + fi.spawn(i, BURNING); } break; } @@ -1149,7 +1149,7 @@ void checkhitsprite_d(int i, int sn) case WATERFOUNTAIN + 2: case WATERFOUNTAIN + 3: sprite[i].picnum = WATERFOUNTAINBROKE; - spawn(i, TOILETWATER); + fi.spawn(i, TOILETWATER); break; case SATELITE: case FUELPOD: @@ -1160,7 +1160,7 @@ void checkhitsprite_d(int i, int sn) for (j = 0; j < 15; j++) EGS(sprite[i].sectnum, sprite[i].x, sprite[i].y, sector[sprite[i].sectnum].floorz - (12 << 8) - (j << 9), SCRAP1 + (krand() & 15), -8, 64, 64, krand() & 2047, (krand() & 127) + 64, -(krand() & 511) - 256, i, 5); - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); deletesprite(i); } break; @@ -1236,7 +1236,7 @@ void checkhitsprite_d(int i, int sn) hittype[sprite[i].owner].temp_data[0] = 32; hittype[sprite[i].owner].temp_data[1] = !hittype[sprite[i].owner].temp_data[1]; hittype[sprite[i].owner].temp_data[2] ++; - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); break; case BROKEHYDROPLANT: @@ -1253,7 +1253,7 @@ void checkhitsprite_d(int i, int sn) sprite[i].picnum = TOILETBROKE; sprite[i].cstat |= (krand() & 1) << 2; sprite[i].cstat &= ~257; - spawn(i, TOILETWATER); + fi.spawn(i, TOILETWATER); spritesound(GLASS_BREAKING, i); break; @@ -1261,13 +1261,13 @@ void checkhitsprite_d(int i, int sn) sprite[i].picnum = STALLBROKE; sprite[i].cstat |= (krand() & 1) << 2; sprite[i].cstat &= ~257; - spawn(i, TOILETWATER); + fi.spawn(i, TOILETWATER); spritesound(GLASS_HEAVYBREAK, i); break; case HYDRENT: sprite[i].picnum = BROKEFIREHYDRENT; - spawn(i, TOILETWATER); + fi.spawn(i, TOILETWATER); // for(k=0;k<5;k++) // { @@ -1315,7 +1315,7 @@ void checkhitsprite_d(int i, int sn) case PIPE6:sprite[i].picnum = PIPE6B; break; } - j = spawn(i, STEAM); + j = fi.spawn(i, STEAM); sprite[j].z = sector[sprite[i].sectnum].floorz - (32 << 8); break; @@ -1324,7 +1324,7 @@ void checkhitsprite_d(int i, int sn) case INDY: case JURYGUY: spritesound(sprite[i].lotag, i); - spawn(i, sprite[i].hitag); + fi.spawn(i, sprite[i].hitag); case SPACEMARINE: sprite[i].extra -= sprite[sn].extra; if (sprite[i].extra > 0) break; @@ -1389,7 +1389,7 @@ void checkhitsprite_d(int i, int sn) if (sprite[sn].picnum != FREEZEBLAST) //if (actortype[sprite[i].picnum] == 0) //TRANSITIONAL. Cannot be done right with EDuke mess backing the engine. { - j = spawn(sn, JIBS6); + j = fi.spawn(sn, JIBS6); if (sprite[sn].pal == 6) sprite[j].pal = 6; sprite[j].z += (4 << 8); diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 6561c827d..4418bc22e 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -311,7 +311,7 @@ void operaterespawns_r(int low) case RESPAWN: if (badguypic(sprite[i].hitag) && ud.monsters_off) break; - j = spawn(i, TRANSPORTERSTAR); + j = fi.spawn(i, TRANSPORTERSTAR); sprite[j].z -= (32 << 8); sprite[i].extra = 66 - 12; // Just a way to killit @@ -2096,7 +2096,7 @@ void checkhitsprite_r(int i, int sn) { sprite[i].cstat &= ~257; hittype[i].temp_data[0] = 1; - spawn(i, BURNING); + fi.spawn(i, BURNING); } break; } @@ -2144,7 +2144,7 @@ void checkhitsprite_r(int i, int sn) case WATERFOUNTAIN + 1: case WATERFOUNTAIN + 2: case WATERFOUNTAIN + 3: - spawn(i, TOILETWATER); + fi.spawn(i, TOILETWATER); break; case SATELITE: case FUELPOD: @@ -2155,7 +2155,7 @@ void checkhitsprite_r(int i, int sn) for (j = 0; j < 15; j++) EGS(sprite[i].sectnum, sprite[i].x, sprite[i].y, sector[sprite[i].sectnum].floorz - (12 << 8) - (j << 9), SCRAP1 + (krand() & 15), -8, 64, 64, krand() & 2047, (krand() & 127) + 64, -(krand() & 511) - 256, i, 5); - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); deletesprite(i); } break; @@ -2217,13 +2217,13 @@ void checkhitsprite_r(int i, int sn) hittype[sprite[i].owner].temp_data[0] = 32; hittype[sprite[i].owner].temp_data[1] = !hittype[sprite[i].owner].temp_data[1]; hittype[sprite[i].owner].temp_data[2] ++; - spawn(i, EXPLOSION2); + fi.spawn(i, EXPLOSION2); break; case TOILET: sprite[i].picnum = TOILETBROKE; sprite[i].cstat |= (krand() & 1) << 2; sprite[i].cstat &= ~257; - spawn(i, TOILETWATER); + fi.spawn(i, TOILETWATER); spritesound(GLASS_BREAKING, i); break; @@ -2231,13 +2231,13 @@ void checkhitsprite_r(int i, int sn) sprite[i].picnum = STALLBROKE; sprite[i].cstat |= (krand() & 1) << 2; sprite[i].cstat &= ~257; - spawn(i, TOILETWATER); + fi.spawn(i, TOILETWATER); spritesound(GLASS_HEAVYBREAK, i); break; case HYDRENT: sprite[i].picnum = BROKEFIREHYDRENT; - spawn(i, TOILETWATER); + fi.spawn(i, TOILETWATER); // for(k=0;k<5;k++) // { @@ -2275,7 +2275,7 @@ void checkhitsprite_r(int i, int sn) case PIPE6:sprite[i].picnum = PIPE6B; break; } - j = spawn(i, STEAM); + j = fi.spawn(i, STEAM); sprite[j].z = sector[sprite[i].sectnum].floorz - (32 << 8); break; @@ -2315,7 +2315,7 @@ void checkhitsprite_r(int i, int sn) if (sprite[sn].picnum != FREEZEBLAST) //if (actortype[sprite[i].picnum] == 0) //TRANSITIONAL. Cannot be done right with EDuke mess backing the engine. { - j = spawn(sn, JIBS6); + j = fi.spawn(sn, JIBS6); if (sprite[sn].pal == 6) sprite[j].pal = 6; sprite[j].z += (4 << 8); diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp new file mode 100644 index 000000000..cebb13e2e --- /dev/null +++ b/source/games/duke/src/spawn.cpp @@ -0,0 +1,1000 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 1996, 2003 - 3D Realms Entertainment +Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements) +Copyright (C) 2020 - Christoph Oelckers + +This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition + +Duke Nukem 3D is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Original Source: 1996 - Todd Replogle +Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms + +EDuke enhancements integrated: 04/13/2003 - Matt Saettler + +Note: EDuke source was in transition. Changes are in-progress in the +source as it is released. + +*/ +//------------------------------------------------------------------------- + +#include +#include "ns.h" +#include "global.h" +#include "game.h" +#include "sounds_common.h" + +BEGIN_DUKE_NS + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int initspriteforspawn(int j, int pn, const std::initializer_list &excludes) +{ + int i; + spritetype* sp; + int* t; + + if (j >= 0) + { + i = EGS(sprite[j].sectnum, sprite[j].x, sprite[j].y, sprite[j].z, pn, 0, 0, 0, 0, 0, 0, j, 0); + hittype[i].picnum = sprite[j].picnum; + sp = &sprite[i]; + t = hittype[i].temp_data; + } + else + { + i = pn; + sp = &sprite[i]; + t = hittype[i].temp_data; + + hittype[i].picnum = sp->picnum; + hittype[i].timetosleep = 0; + hittype[i].extra = -1; + + hittype[i].bposx = sp->x; + hittype[i].bposy = sp->y; + hittype[i].bposz = sp->z; + + sp->owner = hittype[i].owner = i; + hittype[i].cgg = 0; + hittype[i].movflag = 0; + hittype[i].tempang = 0; + hittype[i].dispicnum = 0; + hittype[i].floorz = sector[sp->sectnum].floorz; + hittype[i].ceilingz = sector[sp->sectnum].ceilingz; + + hittype[i].lastvx = 0; + hittype[i].lastvy = 0; + hittype[i].actorstayput = -1; + + t[0] = t[1] = t[2] = t[3] = t[4] = t[5] = 0; + + if (sp->cstat & 48) + if (!isIn(sp->picnum, excludes) && (sp->cstat & 48)) + { + if (sp->shade == 127) return i; + if (wallswitchcheck(i) == 1 && (sp->cstat & 16)) + { + if (sp->picnum != TILE_ACCESSSWITCH && sp->picnum != TILE_ACCESSSWITCH2 && sprite[i].pal) + { + if ((ud.multimode < 2) || (ud.multimode > 1 && ud.coop == 1)) + { + sprite[i].xrepeat = sprite[i].yrepeat = 0; + sprite[i].cstat = sp->lotag = sp->hitag = 0; + return i; + } + } + sp->cstat |= 257; + if (sprite[i].pal && sp->picnum != TILE_ACCESSSWITCH && sp->picnum != TILE_ACCESSSWITCH2) + sprite[i].pal = 0; + return i; + } + + if (sp->hitag) + { + changespritestat(i, 12); + sp->cstat |= 257; + sp->extra = impact_damage; + return i; + } + } + + int s = sp->picnum; + + if (sp->cstat & 1) sp->cstat |= 256; + + if (actorinfo[s].scriptaddress) + { + sp->extra = ScriptCode[actorinfo[s].scriptaddress]; + t[4] = ScriptCode[actorinfo[s].scriptaddress+1]; + t[1] = ScriptCode[actorinfo[s].scriptaddress+2]; + int s3 = ScriptCode[actorinfo[s].scriptaddress]; + if (s3 && sp->hitag == 0) + sp->hitag = s3; + } + else t[1] = t[4] = 0; + } + return i | 0x1000000; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void spawninitdefault(int j, int i) +{ + auto sp = &sprite[i]; + auto sect = sp->sectnum; + auto t = hittype[i].temp_data; + + if (actorinfo[sp->picnum].scriptaddress) + { + if (j == -1 && sp->lotag > ud.player_skill) + { + // make it go away... + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i, STAT_MISC); + return; + } + + // Init the size + if (sp->xrepeat == 0 || sp->yrepeat == 0) + sp->xrepeat = sp->yrepeat = 1; + + if (actorflag(i, SFLAG_BADGUY)) + { + if (ud.monsters_off == 1) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i, STAT_MISC); + return; + } + + makeitfall(i); + + if (actorflag(i, SFLAG_BADGUYSTAYPUT)) + hittype[i].actorstayput = sp->sectnum; + + if (!isRR() || actorflag(i, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill. + 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, STAT_ACTOR); + } + else changespritestat(i, STAT_ZOMBIEACTOR); + } + else + { + sp->clipdist = 40; + sp->owner = i; + changespritestat(i, STAT_ACTOR); + } + + hittype[i].timetosleep = 0; + + if (j >= 0) + sp->ang = sprite[j].ang; + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void spawntransporter(int j, int i, bool beam) +{ + if (j == -1) return; + auto sp = &sprite[i]; + if (beam) + { + 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, STAT_MISC); + ssp(i, CLIPMASK0); + setsprite(i, sp->x, sp->y, sp->z); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int spawnbloodpoolpart1(int j, int i) +{ + auto sp = &sprite[i]; + short 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, STAT_MISC); return true; + } + } + else { sp->xrepeat = sp->yrepeat = 0; changespritestat(i, STAT_MISC); return true; } + } + else { sp->xrepeat = sp->yrepeat = 0; changespritestat(i, STAT_MISC); return true; } + } + else { sp->xrepeat = sp->yrepeat = 0; changespritestat(i, STAT_MISC); return true; } + + if (sector[sp->sectnum].lotag == 1) + { + changespritestat(i, STAT_MISC); + return true; + } + return false; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void initfootprint(int j, int i) +{ + auto sp = &sprite[i]; + int sect = sp->sectnum; + if (j >= 0) + { + short s1; + s1 = sp->sectnum; + + updatesector(sp->x + 84, sp->y + 84, &s1); + if (s1 >= 0 && sector[s1].floorz == sector[sp->sectnum].floorz) + { + 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, STAT_MISC); return; + } + } + else { sp->xrepeat = sp->yrepeat = 0; return; } + } + else { sp->xrepeat = sp->yrepeat = 0; return; } + } + else { sp->xrepeat = sp->yrepeat = 0; return; } + + 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, STAT_MISC); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void initshell(int j, int i, bool isshell) +{ + auto sp = &sprite[i]; + int sect = sp->sectnum; + auto t = hittype[i].temp_data; + if (j >= 0) + { + short snum, a; + + if (sprite[j].picnum == TILE_APLAYER) + { + snum = sprite[j].yvel; + a = ps[snum].getang() - (krand() & 63) + 8; //Fine tune + + t[0] = krand() & 1; + sp->z = (3 << 8) + ps[snum].pyoff + ps[snum].posz - ((ps[snum].q16horizoff + ps[snum].q16horiz - (100 << FRACBITS)) >> (FRACBITS - 4)) + (!isshell ? (3 << 8) : 0); + sp->zvel = -(krand() & 255); + } + else + { + a = sp->ang; + sp->z = sprite[j].z - PHEIGHT + (3 << 8); + } + + sp->x = sprite[j].x + (sintable[(a + 512) & 2047] >> 7); + sp->y = sprite[j].y + (sintable[a & 2047] >> 7); + + sp->shade = -8; + + if (isNamWW2GI()) + { + // to the right, with feeling + sp->ang = a + 512; + sp->xvel = 30; + } + else + { + sp->ang = a - 512; + sp->xvel = 20; + } + + sp->xrepeat = sp->yrepeat = isRR() && isshell? 2 : 4; + + changespritestat(i, STAT_MISC); + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void initcrane(int j, int i, int CRANEPOLE) +{ + auto sp = &sprite[i]; + int sect = sp->sectnum; + auto t = hittype[i].temp_data; + sp->cstat |= 64 | 257; + + sp->picnum += 2; + sp->z = sector[sect].ceilingz + (48 << 8); + t[4] = tempwallptr; + + msx[tempwallptr] = sp->x; + msy[tempwallptr] = sp->y; + msx[tempwallptr + 2] = sp->z; + + int s = headspritestat[0]; + while (s >= 0) + { + if (sprite[s].picnum == CRANEPOLE && sp->hitag == (sprite[s].hitag)) + { + msy[tempwallptr + 2] = s; + + t[1] = 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); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void initwaterdrip(int j, int i) +{ + auto sp = &sprite[i]; + int sect = sp->sectnum; + auto t = hittype[i].temp_data; + 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 - (krand() & 31); + ssp(i, CLIPMASK0); + } + else if (j == -1) + { + sp->z += (4 << 8); + t[0] = sp->z; + if (!isRR()) t[1] = krand() & 127; + } + sp->xrepeat = 24; + sp->yrepeat = 24; + changespritestat(i, 6); +} + + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +int initreactor(int j, int i, bool isrecon) +{ + auto sp = &sprite[i]; + int sect = sp->sectnum; + auto t = hittype[i].temp_data; + if (isrecon) + { + if (sp->lotag > ud.player_skill) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i, 5); + return true; + } + if (!isRR() || actorflag(i, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill. + ps[myconnectindex].max_actors_killed++; + hittype[i].temp_data[5] = 0; + if (ud.monsters_off == 1) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i, 5); + return false; + } + sp->extra = 130; + } + else + sp->extra = impact_damage; + + sp->cstat |= 257; // Make it hitable + + if (ud.multimode < 2 && sp->pal != 0) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i, 5); + return false; + } + sp->pal = 0; + sp->shade = -17; + + changespritestat(i, 2); + return false; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void spawneffector(int i) +{ + auto sp = &sprite[i]; + int sect = sp->sectnum; + auto t = hittype[i].temp_data; + int j, startwall, endwall, x, y, d, s, clostest; + + sp->yvel = sector[sect].extra; + sp->cstat |= 32768; + sp->xrepeat = sp->yrepeat = 0; + + switch (sp->lotag) + { + case 28: + if (!isRR()) t[5] = 65;// Delay for lightning + break; + case 7: // Transporters!!!! + case 23:// XPTR END + if (sp->lotag != 23) + { + for (j = 0; j < MAXSPRITES; j++) + if (sprite[j].statnum < MAXSTATUS && sprite[j].picnum == SECTOREFFECTOR && (sprite[j].lotag == 7 || sprite[j].lotag == 23) && i != j && sprite[j].hitag == sp->hitag) + { + sp->owner = j; + break; + } + } + else sp->owner = i; + + t[4] = sector[sect].floorz == sp->z; + sp->cstat = 0; + changespritestat(i, 9); + return; + case 1: + sp->owner = -1; + t[0] = 1; + break; + case 18: + + if (sp->ang == 512) + { + t[1] = sector[sect].ceilingz; + if (sp->pal) + sector[sect].ceilingz = sp->z; + } + else + { + t[1] = sector[sect].floorz; + if (sp->pal) + sector[sect].floorz = sp->z; + } + + sp->hitag <<= 2; + break; + + case 19: + sp->owner = -1; + break; + case 25: // Pistons + if (!isRR()) + { + t[3] = sector[sect].ceilingz; + t[4] = 1; + } + else + t[4] = sector[sect].ceilingz; + + 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 47: + case 48: + if (!isRRRA()) break; + case 12: + + t[1] = sector[sect].floorshade; + t[2] = sector[sect].ceilingshade; + break; + + case 13: + + t[0] = sector[sect].ceilingz; + t[1] = sector[sect].floorz; + + if (abs(t[0] - sp->z) < abs(t[1] - 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; + t[3] = 1; + + if (!sp->owner && sp->ang == 512) + { + sector[sect].ceilingstat ^= 1; + t[3] = 0; + } + + sector[sect].ceilingshade = + sector[sect].floorshade; + + if (sp->ang == 512) + { + startwall = sector[sect].wallptr; + endwall = startwall + sector[sect].wallnum; + for (j = startwall; j < endwall; j++) + { + int x = wall[j].nextsector; + if (x >= 0) + if (!(sector[x].ceilingstat & 1)) + { + sector[sect].ceilingpicnum = + sector[x].ceilingpicnum; + sector[sect].ceilingshade = + sector[x].ceilingshade; + break; //Leave earily + } + } + } + } + + break; + + case 17: + + t[2] = sector[sect].floorz; //Stopping loc + + j = nextsectorneighborz(sect, sector[sect].floorz, -1, -1); + t[3] = sector[j].ceilingz; + + j = nextsectorneighborz(sect, sector[sect].ceilingz, 1, 1); + t[4] = 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: + { + int 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; s < endwall; s++) + { + x = wall[s].x; + y = wall[s].y; + + d = FindDistance2D(sp->x - x, sp->y - y); + if (d < q) + { + q = d; + clostest = s; + } + } + + t[1] = clostest; + + q = 0x7fffffff; + + for (s = startwall; s < endwall; s++) + { + x = wall[s].x; + y = wall[s].y; + + d = FindDistance2D(sp->x - x, sp->y - y); + if (d < q && s != t[1]) + { + q = d; + clostest = s; + } + } + + t[2] = clostest; + break; + } + + + case 3: + + t[3] = 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; s < endwall; s++) + { + if (!(wall[s].hitag & 1)) + wall[s].shade = sp->shade; + if ((wall[s].cstat & 2) && wall[s].nextwall >= 0) + wall[wall[s].nextwall].shade = sp->shade; + } + break; + + case 31: + t[1] = sector[sect].floorz; + // t[2] = sp->hitag; + if (sp->ang != 1536) sector[sect].floorz = sp->z; + + startwall = sector[sect].wallptr; + endwall = startwall + sector[sect].wallnum; + + for (s = startwall; s < endwall; s++) + if (wall[s].hitag == 0) wall[s].hitag = 9999; + + setinterpolation(§or[sect].floorz); + + break; + case 32: + t[1] = sector[sect].ceilingz; + t[2] = sp->hitag; + if (sp->ang != 1536) sector[sect].ceilingz = sp->z; + + startwall = sector[sect].wallptr; + endwall = startwall + sector[sect].wallnum; + + for (s = startwall; s < endwall; s++) + if (wall[s].hitag == 0) wall[s].hitag = 9999; + + setinterpolation(§or[sect].ceilingz); + + break; + + case 4: //Flashing lights + + t[2] = sector[sect].floorshade; + + startwall = sector[sect].wallptr; + endwall = startwall + sector[sect].wallnum; + + sp->owner = sector[sect].ceilingpal << 8; + sp->owner |= sector[sect].floorpal; + + for (s = startwall; s < endwall; s++) + if (wall[s].shade > t[3]) + t[3] = 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 + + t[0] = sector[sect].floorshade; + t[1] = sector[sect].ceilingshade; + + startwall = sector[sect].wallptr; + endwall = startwall + sector[sect].wallnum; + + for (s = startwall; s < endwall; s++) + if (wall[s].shade > t[2]) + t[2] = wall[s].shade; + + t[3] = 1; //Take Out; + + break; + + case 88: + //First, get the ceiling-floor shade + if (!isRR()) break; + + t[0] = sector[sect].floorshade; + t[1] = sector[sect].ceilingshade; + + startwall = sector[sect].wallptr; + endwall = startwall + sector[sect].wallnum; + + for (s = startwall; s < endwall; s++) + if (wall[s].shade > t[2]) + t[2] = wall[s].shade; + + t[3] = 1; //Take Out; + break; + + case 11://Pivitor rotater + if (sp->ang > 1024) t[3] = 2; + else t[3] = -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; + t[3] = 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) + { + I_Error("Found lonely Sector Effector (lotag 0) at (%ld,%ld)\n", sp->x, sp->y); + } + sp->owner = j; + } + + startwall = sector[sect].wallptr; + endwall = startwall + sector[sect].wallnum; + + t[1] = tempwallptr; + for (s = startwall; s < endwall; s++) + { + msx[tempwallptr] = wall[s].x - sp->x; + msy[tempwallptr] = wall[s].y - sp->y; + tempwallptr++; + if (tempwallptr > 2047) + { + I_Error("Too many moving sectors at (%ld,%ld).\n", wall[s].x, wall[s].y); + } + } + 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 < endwall; s++) + { + if (wall[s].nextsector >= 0 && + sector[wall[s].nextsector].hitag == 0 && + (sector[wall[s].nextsector].lotag < 3 || (isRRRA() && sector[wall[s].nextsector].lotag == 160))) + { + s = wall[s].nextsector; + j = 1; + break; + } + } + + if (j == 0) + { + I_Error("Subway found no zero'd sectors with locators\nat (%ld,%ld).\n", sp->x, sp->y); + } + + sp->owner = -1; + t[0] = s; + + if (sp->lotag != 30) + t[3] = sp->hitag; + } + + else if (sp->lotag == 16) + t[3] = sector[sect].ceilingz; + + else if (sp->lotag == 26) + { + t[3] = sp->x; + t[4] = sp->y; + if (sp->shade == sector[sect].floorshade) //UP + sp->zvel = -256; + else + sp->zvel = 256; + + sp->shade = 0; + } + else if (sp->lotag == 2) + { + t[5] = sector[sp->sectnum].floorheinum; + sector[sp->sectnum].floorheinum = 0; + } + } + + switch (sp->lotag) + { + case 6: + case 14: + j = callsound(sect, i); + if (j == -1) + { + if (!isRR()) j = SUBWAY; // Duke + else if (sector[sp->sectnum].floorpal == 7) j = 456; + else j = 75; + } + 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; + } + + if ((!isRR() && sprite[i].lotag >= 40 && sprite[i].lotag <= 45) || + (isRRRA() && sprite[i].lotag >= 150 && sprite[i].lotag <= 155)) + changespritestat(i, STAT_RAROR); + else + changespritestat(i, STAT_EFFECTOR); +} + + +END_DUKE_NS diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp new file mode 100644 index 000000000..5ef837624 --- /dev/null +++ b/source/games/duke/src/spawn_d.cpp @@ -0,0 +1,1155 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 1996, 2003 - 3D Realms Entertainment +Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements) +Copyright (C) 2020 - Christoph Oelckers + +This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition + +Duke Nukem 3D is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Original Source: 1996 - Todd Replogle +Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms + +EDuke enhancements integrated: 04/13/2003 - Matt Saettler + +Note: EDuke source was in transition. Changes are in-progress in the +source as it is released. + +*/ +//------------------------------------------------------------------------- +#include +#include "ns.h" +#include "global.h" +#include "game.h" +#include "sounds_common.h" +#include "names.h" + +BEGIN_DUKE_NS + + +int spawn_d(int j, int pn) +{ + int x; + + int i = initspriteforspawn(j, pn, { CRACK1, CRACK2, CRACK3, CRACK4, SPEAKER, LETTER, DUCK, TARGET, TRIPBOMB, VIEWSCREEN, VIEWSCREEN2 }); + if (!(i & 0x1000000)) return i; + i &= 0xffffff; + auto sp = &sprite[i]; + auto t = hittype[i].temp_data; + int sect = sp->sectnum; + + + if (isWorldTour()) + { + switch (sp->picnum) + { + case BOSS5STAYPUT: + hittype[i].actorstayput = sp->sectnum; + case FIREFLY: + case BOSS5: + if (sp->picnum == BOSS5 || sp->picnum == BOSS5STAYPUT) + { + if (j >= 0 && sprite[j].picnum == RESPAWN) + sp->pal = sprite[j].pal; + if (sp->pal != 0) + { + sp->clipdist = 80; + sp->xrepeat = 40; + sp->yrepeat = 40; + } + else + { + sp->xrepeat = 80; + sp->yrepeat = 80; + sp->clipdist = 164; + } + } + else + { + sp->xrepeat = 40; + sp->yrepeat = 40; + sp->clipdist = 80; + } + + if (j >= 0) + sp->lotag = 0; + + if ((sp->lotag > ud.player_skill) || ud.monsters_off) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i, 5); + break; + } + else + { + makeitfall(i); + + sp->cstat |= 257; + ps[connecthead].max_actors_killed++; + + if (j >= 0) { + hittype[i].timetosleep = 0; + check_fta_sounds(i); + changespritestat(i, 1); + } else + changespritestat(i, 2); + } + return i; + case FIREFLYFLYINGEFFECT: + sp->owner = j; + changespritestat(i, 5); + sp->xrepeat = 16; + sp->yrepeat = 16; + return i; + case LAVAPOOLBUBBLE: + if (sprite[j].xrepeat < 30) + return i; + sp->owner = j; + changespritestat(i, 5); + sp->x += krand() % 512 - 256; + sp->y += krand() % 512 - 256; + sp->xrepeat = 16; + sp->yrepeat = 16; + return i; + case WHISPYSMOKE: + changespritestat(i, 5); + sp->x += krand() % 256 - 128; + sp->y += krand() % 256 - 128; + sp->xrepeat = 20; + sp->yrepeat = 20; + return i; + case SERIOUSSAM: + changespritestat(i, 2); + sp->cstat = 257; + sp->extra = 150; + return i; + } + } + + switch(sp->picnum) + { + default: + spawninitdefault(j, i); + break; + case FOF: + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + case WATERSPLASH2: + if(j >= 0) + { + setsprite(i,sprite[j].x,sprite[j].y,sprite[j].z); + sp->xrepeat = sp->yrepeat = 8+(krand()&7); + } + else sp->xrepeat = sp->yrepeat = 16+(krand()&15); + + sp->shade = -16; + sp->cstat |= 128; + if(j >= 0) + { + if(sector[sprite[j].sectnum].lotag == 2) + { + sp->z = getceilzofslope(sp->sectnum,sp->x,sp->y)+(16<<8); + sp->cstat |= 8; + } + else if( sector[sprite[j].sectnum].lotag == 1) + sp->z = getflorzofslope(sp->sectnum,sp->x,sp->y); + } + + if(sector[sect].floorpicnum == FLOORSLIME || + sector[sect].ceilingpicnum == FLOORSLIME) + sp->pal = 7; + case NEON1: + case NEON2: + case NEON3: + case NEON4: + case NEON5: + case NEON6: + case DOMELITE: + if(sp->picnum != WATERSPLASH2) + sp->cstat |= 257; + case NUKEBUTTON: + if(sp->picnum == DOMELITE) + sp->cstat |= 257; + case JIBS1: + case JIBS2: + case JIBS3: + case JIBS4: + case JIBS5: + case JIBS6: + case HEADJIB1: + case ARMJIB1: + case LEGJIB1: + case LIZMANHEAD1: + case LIZMANARM1: + case LIZMANLEG1: + case DUKETORSO: + case DUKEGUN: + case DUKELEG: + changespritestat(i,5); + break; + case TONGUE: + if(j >= 0) + sp->ang = sprite[j].ang; + sp->z -= 38<<8; + sp->zvel = 256-(krand()&511); + sp->xvel = 64-(krand()&127); + changespritestat(i,4); + break; + case NATURALLIGHTNING: + sp->cstat &= ~257; + sp->cstat |= 32768; + break; + case TRANSPORTERSTAR: + case TRANSPORTERBEAM: + spawntransporter(j, i, sp->picnum == TRANSPORTERBEAM); + break; + + case FRAMEEFFECT1: + if(j >= 0) + { + sp->xrepeat = sprite[j].xrepeat; + sp->yrepeat = sprite[j].yrepeat; + t[1] = sprite[j].picnum; + } + else sp->xrepeat = sp->yrepeat = 0; + + changespritestat(i,5); + + break; + + case LASERLINE: + 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: + if(j == -1 ) + { + sp->cstat = (short) 32768; + changespritestat(i,2); + } + else + { + sp->xrepeat = sp->yrepeat = 1; + changespritestat(i,5); + } + break; + + case BLOOD: + 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: + case PUKE: + if (spawnbloodpoolpart1(j, i)) 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: + if( j >= 0) + sp->xrepeat = sp->yrepeat = 1; + changespritestat(i,5); + break; + + case BLOODSPLAT1: + case BLOODSPLAT2: + case BLOODSPLAT3: + case BLOODSPLAT4: + sp->cstat |= 16; + sp->xrepeat = 7+(krand()&7); + sp->yrepeat = 7+(krand()&7); + sp->z -= (16<<8); + if(j >= 0 && sprite[j].pal == 6) + sp->pal = 6; + insertspriteq(i); + changespritestat(i,5); + break; + + case TRIPBOMB: + 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: + if(sp->picnum == SPACEMARINE) + { + sp->extra = 20; + sp->cstat |= 257; + } + changespritestat(i,2); + break; + + case HYDRENT: + case PANNEL1: + case PANNEL2: + case SATELITE: + case FUELPOD: + case SOLARPANNEL: + case ANTENNA: + case GRATE1: + case CHAIR1: + case CHAIR2: + case CHAIR3: + case BOTTLE1: + case BOTTLE2: + case BOTTLE3: + case BOTTLE4: + case BOTTLE5: + case BOTTLE6: + case BOTTLE7: + case BOTTLE8: + case BOTTLE10: + case BOTTLE11: + case BOTTLE12: + case BOTTLE13: + case BOTTLE14: + case BOTTLE15: + case BOTTLE16: + case BOTTLE17: + case BOTTLE18: + case BOTTLE19: + case OCEANSPRITE1: + case OCEANSPRITE2: + case OCEANSPRITE3: + case OCEANSPRITE5: + case MONK: + case INDY: + case LUKE: + case JURYGUY: + case SCALE: + case VACUUM: + case FANSPRITE: + case CACTUS: + case CACTUSBROKE: + case HANGLIGHT: + case FETUS: + case FETUSBROKE: + case CAMERALIGHT: + case MOVIECAMERA: + case IVUNIT: + case POT1: + case POT2: + case POT3: + case TRIPODCAMERA: + case SUSHIPLATE1: + case SUSHIPLATE2: + case SUSHIPLATE3: + case SUSHIPLATE4: + case SUSHIPLATE5: + case WAITTOBESEATED: + case VASE: + case PIPE1: + case PIPE2: + case PIPE3: + case PIPE4: + case PIPE5: + case PIPE6: + sp->clipdist = 32; + sp->cstat |= 257; + case OCEANSPRITE4: + changespritestat(i,0); + break; + case FEMMAG1: + case FEMMAG2: + sp->cstat &= ~257; + changespritestat(i,0); + break; + case DUKETAG: + case SIGN1: + case SIGN2: + if(ud.multimode < 2 && sp->pal) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + } + else sp->pal = 0; + break; + case MASKWALL1: + case MASKWALL2: + case MASKWALL3: + case MASKWALL4: + case MASKWALL5: + case MASKWALL6: + case MASKWALL7: + case MASKWALL8: + case MASKWALL9: + case MASKWALL10: + case MASKWALL11: + case MASKWALL12: + case MASKWALL13: + case MASKWALL14: + case MASKWALL15: + j = sp->cstat&60; + sp->cstat = j|1; + changespritestat(i,0); + break; + case FOOTPRINTS: + case FOOTPRINTS2: + case FOOTPRINTS3: + case FOOTPRINTS4: + initfootprint(j, i); + break; + + case FEM1: + case FEM2: + case FEM3: + case FEM4: + case FEM5: + case FEM6: + case FEM7: + case FEM8: + case FEM9: + case FEM10: + case PODFEM1: + case NAKED1: + case STATUE: + case TOUGHGAL: + sp->yvel = sp->hitag; + sp->hitag = -1; + if(sp->picnum == PODFEM1) sp->extra <<= 1; + case BLOODYPOLE: + + case QUEBALL: + case STRIPEBALL: + + 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: + 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: + case HELECOPT: +// if(sp->picnum == HELECOPT || sp->picnum == DUKECAR) sp->xvel = 1024; + sp->cstat = 0; + sp->extra = 1; + sp->xvel = 292; + sp->zvel = 360; + case RESPAWNMARKERRED: + case BLIMP: + + 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: + if(sp->picnum == MIKE) + sp->yvel = sp->hitag; + case WEATHERWARN: + changespritestat(i,1); + break; + + case SPOTLITE: + t[0] = sp->x; + t[1] = sp->y; + break; + case BULLETHOLE: + sp->xrepeat = sp->yrepeat = 3; + sp->cstat = 16+(krand()&12); + insertspriteq(i); + case MONEY: + case MAIL: + case PAPER: + if( sp->picnum == MONEY || sp->picnum == MAIL || sp->picnum == PAPER ) + { + hittype[i].temp_data[0] = krand()&2047; + sp->cstat = krand()&12; + sp->xrepeat = sp->yrepeat = 8; + sp->ang = krand()&2047; + } + changespritestat(i,5); + break; + + case VIEWSCREEN: + case VIEWSCREEN2: + sp->owner = i; + sp->lotag = 1; + sp->extra = 1; + changespritestat(i,6); + break; + + case SHELL: //From the player + case SHOTGUNSHELL: + initshell(i, j, sp->picnum == SHELL); + break; + + case RESPAWN: + sp->extra = 66-13; + case MUSICANDSFX: + if( ud.multimode < 2 && sp->pal == 1) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + sp->cstat = (short)32768; + changespritestat(i,11); + break; + + case EXPLOSION2: + case EXPLOSION2BOT: + case BURNING: + case BURNING2: + case SMALLSMOKE: + case SHRINKEREXPLOSION: + case COOLEXPLOSION1: + + if(j >= 0) + { + sp->ang = sprite[j].ang; + sp->shade = -64; + sp->cstat = 128|(krand()&4); + } + + 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: + 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: + sp->xrepeat = sp->yrepeat = 0; + j = ud.coop; + if(j == 2) j = 0; + + if( ud.multimode < 2 || (ud.multimode > 1 && j != sp->lotag) ) + changespritestat(i,5); + else + changespritestat(i,10); + break; + case WATERBUBBLE: + 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; + + changespritestat(i,5); + break; + + case CRANE: + initcrane(j, i, CRANEPOLE); + break; + + case WATERDRIP: + initwaterdrip(j, i); + break; + case TRASH: + + if(sp->picnum != WATERDRIP) + sp->ang = krand()&2047; + + case WATERDRIPSPLASH: + + sp->xrepeat = 24; + sp->yrepeat = 24; + + + changespritestat(i,6); + break; + + case PLUG: + sp->lotag = 9999; + changespritestat(i,6); + break; + case TOUCHPLATE: + t[2] = 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: + if (sp->hitag && sp->picnum == WATERBUBBLEMAKER) + { // JBF 20030913: Pisses off move(), eg. in bobsp2 + Printf(TEXTCOLOR_YELLOW "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: + t[0] = sp->xrepeat; + t[1] = sp->yrepeat; + case MASTERSWITCH: + if(sp->picnum == MASTERSWITCH) + sp->cstat |= 32768; + sp->yvel = 0; + changespritestat(i,6); + break; + case TARGET: + case DUCK: + case LETTER: + sp->extra = 1; + sp->cstat |= 257; + changespritestat(i,1); + break; + case OCTABRAINSTAYPUT: + case LIZTROOPSTAYPUT: + case PIGCOPSTAYPUT: + case LIZMANSTAYPUT: + case BOSS1STAYPUT: + case PIGCOPDIVE: + case COMMANDERSTAYPUT: + case BOSS4STAYPUT: + hittype[i].actorstayput = sp->sectnum; + case BOSS1: + case BOSS2: + case BOSS3: + case BOSS4: + case ROTATEGUN: + case GREENSLIME: + if(sp->picnum == GREENSLIME) + sp->extra = 1; + case DRONE: + case LIZTROOPONTOILET: + case LIZTROOPJUSTSIT: + case LIZTROOPSHOOT: + case LIZTROOPJETPACK: + case LIZTROOPDUCKING: + case LIZTROOPRUNNING: + case LIZTROOP: + case OCTABRAIN: + case COMMANDER: + case PIGCOP: + case LIZMAN: + case LIZMANSPITTING: + case LIZMANFEEDING: + case LIZMANJUMP: + case ORGANTIC: + case RAT: + case SHARK: + + if(sp->pal == 0) + { + switch(sp->picnum) + { + case LIZTROOPONTOILET: + case LIZTROOPSHOOT: + case LIZTROOPJETPACK: + case LIZTROOPDUCKING: + case LIZTROOPRUNNING: + case LIZTROOPSTAYPUT: + case LIZTROOPJUSTSIT: + case LIZTROOP: + 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 = krand()&2047; + sp->xrepeat = sp->yrepeat = 48; + sp->cstat = 0; + } + else + { + sp->cstat |= 257; + + if(sp->picnum != SHARK) + ps[myconnectindex].max_actors_killed++; + } + + if(sp->picnum == ORGANTIC) sp->cstat |= 128; + + 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: + sp->cstat |= 32768; + changespritestat(i,7); + break; + + case ACTIVATORLOCKED: + case ACTIVATOR: + sp->cstat = (short) 32768; + if(sp->picnum == ACTIVATORLOCKED) + sector[sp->sectnum].lotag |= 16384; + changespritestat(i,8); + break; + + case DOORSHOCK: + sp->cstat |= 1+256; + sp->shade = -12; + changespritestat(i,6); + break; + + case OOZ: + case OOZ2: + 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 |= (krand()&4); + + break; + + case HEAVYHBOMB: + if(j >= 0) + sp->owner = j; + else sp->owner = i; + sp->xrepeat = sp->yrepeat = 9; + sp->yvel = 4; + case REACTOR2: + case REACTOR: + case RECON: + if (initreactor(j, i, sp->picnum == RECON)) return i; + break; + + case ATOMICHEALTH: + case STEROIDS: + case HEATSENSOR: + case SHIELD: + case AIRTANK: + case TRIPBOMBSPRITE: + case JETPACK: + case HOLODUKE: + + case FIRSTGUNSPRITE: + case CHAINGUNSPRITE: + case SHOTGUNSPRITE: + case RPGSPRITE: + case SHRINKERSPRITE: + case FREEZESPRITE: + case DEVISTATORSPRITE: + + case SHOTGUNAMMO: + case FREEZEAMMO: + case HBOMBAMMO: + case CRYSTALAMMO: + case GROWAMMO: + case BATTERYAMMO: + case DEVISTATORAMMO: + case RPGAMMO: + case BOOTS: + case AMMO: + case AMMOLOTS: + case COLA: + case FIRSTAID: + case SIXPAK: + if(j >= 0) + { + sp->lotag = 0; + sp->z -= (32<<8); + sp->zvel = -1024; + ssp(i,CLIPMASK0); + sp->cstat = krand()&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: + + if(sp->picnum == ATOMICHEALTH) + sp->cstat |= 128; + + if(ud.multimode > 1 && ud.coop != 1 && 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: + sp->lotag = 1; + + case TREE1: + case TREE2: + case TIRE: + case CONE: + case BOX: + sp->cstat = 257; // Make it hitable + sprite[i].extra = 1; + changespritestat(i,6); + break; + + case FLOORFLAME: + sp->shade = -127; + changespritestat(i,6); + break; + + case BOUNCEMINE: + 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 CAMERA1: + case CAMERA1+1: + case CAMERA1+2: + case CAMERA1+3: + case CAMERA1+4: + case CAMERAPOLE: + sp->extra = 1; + + if(camerashitable) sp->cstat = 257; + else sp->cstat = 0; + + case GENERICPOLE: + + if( ud.multimode < 2 && sp->pal != 0 ) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + else sp->pal = 0; + if(sp->picnum == CAMERAPOLE || sp->picnum == GENERICPOLE) break; + sp->picnum = CAMERA1; + changespritestat(i,1); + break; + case STEAM: + 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: + changespritestat(i,6); + break; + + case SECTOREFFECTOR: + spawneffector(i); + + break; + + + case SEENINE: + case OOZFILTER: + + 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: + case CRACK2: + case CRACK3: + case CRACK4: + case FIREEXT: + if(sp->picnum == FIREEXT) + { + sp->cstat = 257; + sp->extra = impact_damage<<2; + } + else + { + sp->cstat |= (sp->cstat & 48) ? 1 : 17; + sp->extra = 1; + } + + if( ud.multimode < 2 && sp->pal != 0) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + + sp->pal = 0; + sp->owner = i; + changespritestat(i,6); + sp->xvel = 8; + ssp(i,CLIPMASK0); + break; + + case TOILET: + case STALL: + sp->lotag = 1; + sp->cstat |= 257; + sp->clipdist = 8; + sp->owner = i; + break; + case CANWITHSOMETHING: + case CANWITHSOMETHING2: + case CANWITHSOMETHING3: + case CANWITHSOMETHING4: + case RUBBERCAN: + sp->extra = 0; + case EXPLODINGBARREL: + case HORSEONSIDE: + case FIREBARREL: + case NUKEBARREL: + case FIREVASE: + case NUKEBARRELDENTED: + case NUKEBARRELLEAKED: + case WOODENHORSE: + + 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: + 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|(krand()&4); + changespritestat(i,2); + } + break; + case TOILETWATER: + sp->shade = -16; + changespritestat(i,6); + break; + } + return i; +} + +END_DUKE_NS diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp new file mode 100644 index 000000000..51e097f3a --- /dev/null +++ b/source/games/duke/src/spawn_r.cpp @@ -0,0 +1,1492 @@ +//------------------------------------------------------------------------- +/* +Copyright (C) 1996, 2003 - 3D Realms Entertainment +Copyright (C) 2017-2019 Nuke.YKT +Copyright (C) 2020 - Christoph Oelckers + +This file is part of Duke Nukem 3D version 1.5 - Atomic Edition + +Duke Nukem 3D is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Original Source: 1996 - Todd Replogle +Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms +*/ +//------------------------------------------------------------------------- + +#include +#include "ns.h" +#include "global.h" +#include "game.h" +#include "sounds_common.h" +#include "names_rr.h" + +BEGIN_DUKE_NS + + +int spawn_r(int j, int pn) +{ + int x; + + int i = initspriteforspawn(j, pn, { CRACK1, CRACK2, CRACK3, CRACK4 }); + if (!(i & 0x1000000)) return i; + i &= 0xffffff; + auto sp = &sprite[i]; + auto t = hittype[i].temp_data; + int sect = sp->sectnum; + + switch(sp->picnum) + { + default: + default_case: + spawninitdefault(j, i); + break; + case RRTILE280: + case RRTILE281: + case RRTILE282: + case RRTILE283: + case RRTILE2025: + case RRTILE2026: + case RRTILE2027: + case RRTILE2028: + sp->cstat = 0; + sp->cstat |= 32768; + sp->xrepeat = 0; + sp->yrepeat = 0; + sp->clipdist = 0; + sp->extra = 0; + changespritestat(i,105); + break; + case RRTILE3410: + sp->extra = 0; + changespritestat(i,107); + break; + case RRTILE8450: + if (!isRRRA()) goto default_case; + sp->xrepeat = 64; + sp->yrepeat = 64; + sp->extra = sp->lotag; + sp->cstat |= 257; + changespritestat(i,116); + break; + case PIG+11: + if (!isRRRA()) goto default_case; + sp->xrepeat = 16; + sp->yrepeat = 16; + sp->clipdist = 0; + sp->extra = 0; + sp->cstat = 0; + changespritestat(i,121); + break; + case RRTILE8487: + case RRTILE8489: + if (!isRRRA()) goto default_case; + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->extra = 0; + sp->cstat |= 257; + sp->hitag = 0; + changespritestat(i,117); + break; + case RRTILE7424: + if (!isRRRA()) goto default_case; + sp->extra = 0; + sp->xrepeat = 0; + sp->yrepeat = 0; + changespritestat(i,11); + break; + case RRTILE7936: + if (!isRRRA()) goto default_case; + sp->xrepeat = 0; + sp->yrepeat = 0; + setmapfog(2); + fogactive = 1; + break; + case RRTILE6144: + if (!isRRRA()) goto default_case; + sp->xrepeat = 0; + sp->yrepeat = 0; + ps[screenpeek].sea_sick_stat = 1; + break; + case RRTILE8448: + if (!isRRRA()) goto default_case; + sp->lotag = 1; + sp->clipdist = 0; + break; + case RRTILE8099: + if (!isRRRA()) goto default_case; + sp->lotag = 5; + sp->clipdist = 0; + changespritestat(i,123); + break; + case RRTILE8704: + if (!isRRRA()) goto default_case; + sp->lotag = 1; + sp->clipdist = 0; + break; + case RRTILE8192: + if (!isRRRA()) goto default_case; + sp->xrepeat = 0; + sp->yrepeat = 0; + ufospawnsminion = 1; + break; + case RRTILE8193: + if (!isRRRA()) goto default_case; + sp->xrepeat = 0; + sp->yrepeat = 0; + pistonsound = 1; + break; + case RRTILE8165: + if (!isRRRA()) goto default_case; + sp->lotag = 1; + sp->clipdist = 0; + sp->owner = i; + sp->extra = 0; + changespritestat(i,115); + break; + case RRTILE8593: + if (!isRRRA()) goto default_case; + sp->lotag = 1; + sp->clipdist = 0; + sp->owner = i; + sp->extra = 0; + changespritestat(i,122); + break; + case RRTILE285: + case RRTILE286: + case RRTILE287: + case RRTILE288: + case RRTILE289: + case RRTILE290: + case RRTILE291: + case RRTILE292: + case RRTILE293: + sp->cstat = 0; + sp->cstat |= 32768; + sp->xrepeat = 0; + sp->yrepeat = 0; + sp->clipdist = 0; + sp->lotag = 0; + changespritestat(i,106); + break; + + case RRTILE2460: + case RRTILE2465: + case BIKEJIBA: + case BIKEJIBB: + case BIKEJIBC: + case BIKERJIBA: + case BIKERJIBB: + case BIKERJIBC: + case BIKERJIBD: + case CHEERJIBA: + case CHEERJIBB: + case CHEERJIBC: + case CHEERJIBD: + case FBOATJIBA: + case FBOATJIBB: + case RABBITJIBA: + case RABBITJIBB: + case RABBITJIBC: + case MAMAJIBA: + case MAMAJIBB: + // impossible to do with better methods outside of redoing the entire switch/case block + if (isRRRA()) goto rrra_badguy; + else goto default_case; + + case WATERSPLASH2: + case MUD: + if (j >= 0) + { + setsprite(i, sprite[j].x, sprite[j].y, sprite[j].z); + sp->xrepeat = sp->yrepeat = 8+(krand()&7); + } + else sp->xrepeat = sp->yrepeat = 16+(krand()&15); + + sp->shade = -16; + sp->cstat |= 128; + if (j >= 0) + { + if (sector[sprite[j].sectnum].lotag == 2) + { + sp->z = getceilzofslope(sp->sectnum, sp->x, sp->y) + (16 << 8); + sp->cstat |= 8; + } + else if (sector[sprite[j].sectnum].lotag == 1) + sp->z = getflorzofslope(sp->sectnum, sp->x, sp->y); + } + + if(sector[sect].floorpicnum == FLOORSLIME || + sector[sect].ceilingpicnum == FLOORSLIME) + sp->pal = 7; + case NEON1: + case NEON2: + case NEON3: + case NEON4: + case NEON5: + case NEON6: + case DOMELITE: + if(sp->picnum != WATERSPLASH2) + sp->cstat |= 257; + if(sp->picnum == DOMELITE) + sp->cstat |= 257; + case JIBS1: + case JIBS2: + case JIBS3: + case JIBS4: + case JIBS5: + case JIBS6: + case DUKETORSO: + case DUKEGUN: + case DUKELEG: + case BILLYJIBA: + case BILLYJIBB: + case HULKJIBA: + case HULKJIBB: + case HULKJIBC: + case MINJIBA: + case MINJIBB: + case MINJIBC: + case COOTJIBA: + case COOTJIBB: + case COOTJIBC: + rrra_badguy: + if (sp->picnum == JIBS6) + { + sp->xrepeat >>= 1; + sp->yrepeat >>= 1; + } + else if (isRRRA()) + { + if (sp->picnum == RABBITJIBA) + { + sp->xrepeat = 18; + sp->yrepeat = 18; + } + else if (sp->picnum == RABBITJIBB) + { + sp->xrepeat = 36; + sp->yrepeat = 36; + } + else if (sp->picnum == RABBITJIBC) + { + sp->xrepeat = 54; + sp->yrepeat = 54; + } + } + changespritestat(i,5); + break; + case TONGUE: + if(j >= 0) + sp->ang = sprite[j].ang; + sp->z -= 38<<8; + sp->zvel = 256-(krand()&511); + sp->xvel = 64-(krand()&127); + changespritestat(i,4); + break; + case TRANSPORTERSTAR: + case TRANSPORTERBEAM: + spawntransporter(j, i, sp->picnum == TRANSPORTERBEAM); + break; + + case FRAMEEFFECT1: + if (j >= 0) + { + sp->xrepeat = sprite[j].xrepeat; + sp->yrepeat = sprite[j].yrepeat; + if (sprite[j].picnum == APLAYER) + t[1] = SMALLSMOKE; + else + t[1] = sprite[j].picnum; + } + else sp->xrepeat = sp->yrepeat = 0; + + changespritestat(i,5); + break; + + case FORCESPHERE: + if (j == -1) + { + sp->cstat = (short)32768; + changespritestat(i,2); + } + else + { + sp->xrepeat = sp->yrepeat = 1; + changespritestat(i,5); + } + break; + + case BLOOD: + sp->xrepeat = sp->yrepeat = 4; + sp->z -= (26<<8); + changespritestat(i,5); + break; + case BLOODPOOL: + if (spawnbloodpoolpart1(j, i)) break; + + if(j >= 0) + { + if( sprite[j].pal == 1) + sp->pal = 1; + else if( sprite[j].pal != 6 && sprite[j].picnum != NUKEBARREL && sprite[j].picnum != TIRE ) + { + sp->pal = 2; // Red + } + else sp->pal = 0; // green + + if(sprite[j].picnum == TIRE) + sp->shade = 127; + } + sp->cstat |= 32; + + case BLOODSPLAT1: + case BLOODSPLAT2: + case BLOODSPLAT3: + case BLOODSPLAT4: + sp->cstat |= 16; + sp->xrepeat = 7+(krand()&7); + sp->yrepeat = 7+(krand()&7); + sp->z -= (16<<8); + if(j >= 0 && sprite[j].pal == 6) + sp->pal = 6; + insertspriteq(i); + changespritestat(i,5); + break; + + case HYDRENT: + case SATELITE: + case FUELPOD: + case SOLARPANNEL: + case ANTENNA: + case GRATE1: + case CHAIR1: + case CHAIR2: + case CHAIR3: + case BOTTLE1: + case BOTTLE2: + case BOTTLE3: + case BOTTLE4: + case BOTTLE5: + case BOTTLE6: + case BOTTLE7: + case BOTTLE8: + case BOTTLE10: + case BOTTLE11: + case BOTTLE12: + case BOTTLE13: + case BOTTLE14: + case BOTTLE15: + case BOTTLE16: + case BOTTLE17: + case BOTTLE18: + case BOTTLE19: + case SCALE: + case VACUUM: + case FANSPRITE: + case CACTUS: + case CACTUSBROKE: + case CAMERALIGHT: + case MOVIECAMERA: + case IVUNIT: + case POT1: + case POT2: + case POT3: + case SUSHIPLATE1: + case SUSHIPLATE2: + case SUSHIPLATE3: + case SUSHIPLATE4: + case SUSHIPLATE5: + case WAITTOBESEATED: + case VASE: + case PIPE1: + case PIPE2: + case PIPE3: + case PIPE4: + case PIPE5: + case PIPE6: + sp->clipdist = 32; + sp->cstat |= 257; + changespritestat(i,0); + break; + case FEMMAG1: + case FEMMAG2: + sp->cstat &= ~257; + changespritestat(i,0); + break; + + case MASKWALL7: + j = sp->cstat&60; + sp->cstat = j|1; + changespritestat(i,0); + break; + case FOOTPRINTS: + case FOOTPRINTS2: + case FOOTPRINTS3: + case FOOTPRINTS4: + initfootprint(j, i); + break; + case FEM10: + case NAKED1: + case STATUE: + case TOUGHGAL: + sp->yvel = sp->hitag; + sp->hitag = -1; + case QUEBALL: + case STRIPEBALL: + 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 BOWLINGBALL: + sp->cstat = 256; + sp->clipdist = 64; + sp->xrepeat = 11; + sp->yrepeat = 9; + changespritestat(i,2); + break; + case HENSTAND: + sp->cstat = 257; + sp->clipdist = 48; + sp->xrepeat = 21; + sp->yrepeat = 15; + changespritestat(i,2); + break; + case RRTILE295: + sp->cstat |= 32768; + changespritestat(i,107); + break; + case RRTILE296: + case RRTILE297: + sp->xrepeat = 64; + sp->yrepeat = 64; + sp->clipdist = 64; + changespritestat(i,108); + break; + case RRTILE3190: + case RRTILE3191: + case RRTILE3192: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 32; + sp->yrepeat = 26; + sp->xvel = 32; + changespritestat(i,1); + break; + case RRTILE3120: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 12; + sp->yrepeat = 10; + sp->xvel = 32; + changespritestat(i,1); + break; + case RRTILE3122: + sp->cstat = 257; + sp->clipdist = 2; + sp->xrepeat = 8; + sp->yrepeat = 6; + sp->xvel = 16; + changespritestat(i,1); + break; + case RRTILE3123: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 13; + sp->yrepeat = 13; + sp->xvel = 16; + changespritestat(i,1); + break; + case RRTILE3124: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 17; + sp->yrepeat = 12; + sp->xvel = 32; + changespritestat(i,1); + break; + case RRTILE3132: + sp->cstat = 257; + sp->clipdist = 8; + sp->xrepeat = 13; + sp->yrepeat = 10; + sp->xvel = 0; + changespritestat(i,1); + break; + case RRTILE3440: + sp->cstat = 257; + sp->clipdist = 48; + sp->xrepeat = 23; + sp->yrepeat = 23; + changespritestat(i,2); + break; + case DUKELYINGDEAD: + 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; + } + sp->cstat = 0; + sp->extra = 1; + sp->xvel = 292; + sp->zvel = 360; + case RESPAWNMARKERRED: + if(sp->picnum == RESPAWNMARKERRED) + { + sp->xrepeat = sp->yrepeat = 8; + if(j >= 0) sp->z = hittype[j].floorz; + } + else + { + sp->cstat |= 257; + sp->clipdist = 128; + } + case MIKE: + if(sp->picnum == MIKE) + sp->yvel = sp->hitag; + changespritestat(i,1); + break; + + case SPOTLITE: + t[0] = sp->x; + t[1] = sp->y; + break; + case BULLETHOLE: + sp->xrepeat = sp->yrepeat = 3; + sp->cstat = 16+(krand()&12); + insertspriteq(i); + case MONEY: + if(sp->picnum == MONEY) + { + hittype[i].temp_data[0] = krand()&2047; + sp->cstat = krand()&12; + sp->xrepeat = sp->yrepeat = 8; + sp->ang = krand()&2047; + } + changespritestat(i,5); + break; + + case SHELL: //From the player + case SHOTGUNSHELL: + initshell(i, j, sp->picnum == SHELL); + break; + case RESPAWN: + sp->extra = 66-13; + case MUSICANDSFX: + if (ud.multimode < 2 && sp->pal == 1) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + sp->cstat = (short)32768; + changespritestat(i,11); + break; + case SOUNDFX: + { + short tg; + sp->cstat |= 32768; + changespritestat(i,2); + tg = sp->hitag; + tg = sp->lotag; + } + break; + case EXPLOSION2: + case EXPLOSION3: + case BURNING: + case SMALLSMOKE: + if(j >= 0) + { + sp->ang = sprite[j].ang; + sp->shade = -64; + sp->cstat = 128|(krand()&4); + } + + if(sp->picnum == EXPLOSION2) + { + sp->xrepeat = 48; + sp->yrepeat = 48; + sp->shade = -127; + sp->cstat |= 128; + } + else if(sp->picnum == EXPLOSION3) + { + sp->xrepeat = 128; + sp->yrepeat = 128; + sp->shade = -127; + sp->cstat |= 128; + } + else if(sp->picnum == SMALLSMOKE) + { + sp->xrepeat = 12; + sp->yrepeat = 12; + } + else if(sp->picnum == BURNING) + { + 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: + 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: + sp->xrepeat = sp->yrepeat = 0; + j = ud.coop; + if(j == 2) j = 0; + + if( ud.multimode < 2 || (ud.multimode > 1 && j != sp->lotag) ) + changespritestat(i,5); + else + changespritestat(i,10); + break; + + case WATERBUBBLE: + 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 = 1+(krand()&7); + } + else + sp->xrepeat = sp->yrepeat = 32; + changespritestat(i,5); + break; + case CRANE: + initcrane(j, i, CRANEPOLE); + break; + case WATERDRIP: + initwaterdrip(j, i); + break; + case TRASH: + + if(sp->picnum != WATERDRIP) sp->ang = krand()&2047; + + sp->xrepeat = 24; + sp->yrepeat = 24; + changespritestat(i,6); + break; + + case PLUG: + sp->lotag = 9999; + changespritestat(i,6); + break; + case TOUCHPLATE: + t[2] = 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: + sp->cstat |= 32768; + changespritestat(i,6); + break; + case BOLT1: + case BOLT1+1: + case BOLT1+2: + case BOLT1+3: + t[0] = sp->xrepeat; + t[1] = sp->yrepeat; + case MASTERSWITCH: + if(sp->picnum == MASTERSWITCH) + sp->cstat |= 32768; + sp->yvel = 0; + changespritestat(i,6); + break; + + // this is not really nice... + case BIKERB: + case BIKERBV2: + case BIKER: + case MAKEOUT: + case CHEERB: + case CHEER: + case COOTPLAY: + case BILLYPLAY: + case MINIONBOAT: + case HULKBOAT: + case CHEERBOAT: + case RABBIT: + case ROCK: + case ROCK2: + case MAMACLOUD: + case MAMA: + case UFO1_RRRA: + if (isRRRA()) goto rrra_badguy2; + else goto default_case; + + case UFO1_RR: + if (!isRRRA()) goto rrra_badguy2; + else goto default_case; + + case SBSWIPE: + case CHEERSTAYPUT: + if (isRRRA()) goto rrra_stayput; + else goto default_case; + case SBMOVE: + if (isRRRA()) goto default_case; + + case BILLYRAYSTAYPUT: + case BRAYSNIPER: + case BUBBASTAND: + case HULKSTAYPUT: + case HENSTAYPUT: + case PIGSTAYPUT: + case MINIONSTAYPUT: + case COOTSTAYPUT: + rrra_stayput: + hittype[i].actorstayput = sp->sectnum; + case BOULDER: + case BOULDER1: + case RAT: + case TORNADO: + case BILLYCOCK: + case BILLYRAY: + case DOGRUN: + case LTH: + case HULK: + case HEN: + case DRONE: + case PIG: + case MINION: + case UFO2: + case UFO3: + case UFO4: + case UFO5: + case COW: + case COOT: + case SHARK: + case VIXEN: + rrra_badguy2: + sp->xrepeat = 40; + sp->yrepeat = 40; + // Note: All inappropriate tiles have already been weeded out by the outer switch block so this does not need game type checks anymore. + switch (sp->picnum) + { + case VIXEN: + if (sp->pal == 34) + { + sp->xrepeat = 22; + sp->yrepeat = 21; + } + else + { + sp->xrepeat = 22; + sp->yrepeat = 20; + } + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case HULKHANG: + case HULKHANGDEAD: + case HULKJUMP: + case HULK: + case HULKSTAYPUT: + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case COOTPLAY: + case COOT: + case COOTSTAYPUT: + sp->xrepeat = 24; + sp->yrepeat = 18; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->clipdist <<= 2; + break; + case DRONE: + sp->xrepeat = 14; + sp->yrepeat = 7; + sp->clipdist = 128; + break; + case SBSWIPE: + case BILLYPLAY: + case BILLYCOCK: + case BILLYRAY: + case BILLYRAYSTAYPUT: + case BRAYSNIPER: + case BUBBASTAND: + sp->xrepeat = 25; + sp->yrepeat = 21; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case COW: + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case HEN: + case HENSTAYPUT: + case HENSTAND: + if(sp->pal == 35) + { + sp->xrepeat = 42; + sp->yrepeat = 30; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + } + else + { + sp->xrepeat = 21; + sp->yrepeat = 15; + sp->clipdist = 64; + } + break; + case MINION: + case MINIONSTAYPUT: + sp->xrepeat = 16; + sp->yrepeat = 16; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + if (isRRRA() && ufospawnsminion) + sp->pal = 8; + break; + case DOGRUN: + case PIG: + sp->xrepeat = 16; + sp->yrepeat = 16; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case RABBIT: + sp->xrepeat = 18; + sp->yrepeat = 18; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case MAMACLOUD: + sp->xrepeat = 64; + sp->yrepeat = 64; + sp->cstat = 2; + sp->cstat |= 512; + sp->x += (krand()&2047)-1024; + sp->y += (krand()&2047)-1024; + sp->z += (krand()&2047)-1024; + break; + case MAMA: + if (sp->pal == 30) + { + sp->xrepeat = 26; + sp->yrepeat = 26; + sp->clipdist = 75; + } + else if (sp->pal == 31) + { + sp->xrepeat = 36; + sp->yrepeat = 36; + sp->clipdist = 100; + } + else if (sp->pal == 32) + { + sp->xrepeat = 50; + sp->yrepeat = 50; + sp->clipdist = 100; + } + else + { + sp->xrepeat = 50; + sp->yrepeat = 50; + sp->clipdist = 100; + } + break; + case BIKERB: + sp->xrepeat = 28; + sp->yrepeat = 22; + sp->clipdist = 72; + break; + case BIKERBV2: + sp->xrepeat = 28; + sp->yrepeat = 22; + sp->clipdist = 72; + break; + case BIKER: + sp->xrepeat = 28; + sp->yrepeat = 22; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case CHEERB: + sp->xrepeat = 28; + sp->yrepeat = 22; + sp->clipdist = 72; + break; + case CHEER: + case CHEERSTAYPUT: + sp->xrepeat = 20; + sp->yrepeat = 20; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case MAKEOUT: + sp->xrepeat = 26; + sp->yrepeat = 26; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case MINIONBOAT: + sp->xrepeat = 16; + sp->yrepeat = 16; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case HULKBOAT: + sp->xrepeat = 48; + sp->yrepeat = 48; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case CHEERBOAT: + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + + case TORNADO: + sp->xrepeat = 64; + sp->yrepeat = 128; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->clipdist >>= 2; + sp->cstat = 2; + break; + case LTH: + sp->xrepeat = 24; + sp->yrepeat = 22; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + case ROCK: + case ROCK2: + sp->xrepeat = 64; + sp->yrepeat = 64; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + + case UFO1_RRRA: + case UFO1_RR: + case UFO2: + case UFO3: + case UFO4: + case UFO5: + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->extra = 50; + break; + case SBMOVE: + sp->xrepeat = 48; + sp->yrepeat = 48; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + break; + + default: + break; + } + + 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 = krand()&2047; + sp->xrepeat = sp->yrepeat = 48; + sp->cstat = 0; + } + else + { + sp->cstat |= 257; + + if(sp->picnum != 5501) + if (actorfella(i)) + ps[myconnectindex].max_actors_killed++; + } + + if(j >= 0) + { + hittype[i].timetosleep = 0; + check_fta_sounds(i); + changespritestat(i,1); + } + else changespritestat(i,2); + + sp->shade = sprite[j].shade; + } + + break; + case LOCATORS: +// sp->xrepeat=sp->yrepeat=0; + sp->cstat |= 32768; + changespritestat(i,7); + break; + + case ACTIVATORLOCKED: + case ACTIVATOR: +// sp->xrepeat=sp->yrepeat=0; + sp->cstat |= 32768; + if (sp->picnum == ACTIVATORLOCKED) + sector[sect].lotag ^= 16384; + changespritestat(i,8); + break; + case DOORSHOCK: + sp->cstat |= 1+256; + sp->shade = -12; + + changespritestat(i,6); + break; + + case OOZ: + sp->shade = -12; + + if(j >= 0) + if( sprite[j].picnum == NUKEBARREL ) + sp->pal = 8; + + changespritestat(i,1); + + getglobalz(i); + + j = (hittype[i].floorz-hittype[i].ceilingz)>>9; + + sp->yrepeat = j; + sp->xrepeat = 25-(j>>1); + sp->cstat |= (krand()&4); + break; + + case HEAVYHBOMB: + sp->owner = i; + sp->xrepeat = sp->yrepeat = 9; + sp->yvel = 4; + case REACTOR2: + case REACTOR: + case RECON: + if (initreactor(j, i, sp->picnum == RECON)) return i; + break; + + case RPG2SPRITE: + case MOTOAMMO: + case BOATAMMO: + if (!isRRRA()) goto default_case; + + case ATOMICHEALTH: + case STEROIDS: + case HEATSENSOR: + case SHIELD: + case AIRTANK: + case TRIPBOMBSPRITE: + case JETPACK: + case HOLODUKE: + + case FIRSTGUNSPRITE: + case CHAINGUNSPRITE: + case SHOTGUNSPRITE: + case RPGSPRITE: + case SHRINKERSPRITE: + case FREEZESPRITE: + case DEVISTATORSPRITE: + + case SHOTGUNAMMO: + case FREEZEAMMO: + case HBOMBAMMO: + case CRYSTALAMMO: + case GROWAMMO: + case BATTERYAMMO: + case DEVISTATORAMMO: + case RPGAMMO: + case BOOTS: + case AMMO: + case AMMOLOTS: + case COLA: + case FIRSTAID: + case SIXPAK: + + case RRTILE43: + case BOWLINGBALLSPRITE: + if (j >= 0) + { + sp->lotag = 0; + if (sp->picnum != BOWLINGBALLSPRITE) + { + sp->z -= (32 << 8); + sp->zvel = -(4 << 8); + } + else + { + sp->zvel = 0; + } + ssp(i,CLIPMASK0); + sp->cstat = krand()&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: + + if (sp->picnum == ATOMICHEALTH) + sp->cstat |= 128; + + if(ud.multimode > 1 && ud.coop != 1 && 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); + } + switch (sp->picnum) + { + case FIRSTGUNSPRITE: + sp->xrepeat = 16; + sp->yrepeat = 16; + break; + case SHOTGUNAMMO: + sp->xrepeat = 18; + sp->yrepeat = 17; + if (isRRRA()) sp->cstat = 256; + break; + case SIXPAK: + sp->xrepeat = 13; + sp->yrepeat = 9; + if (isRRRA()) sp->cstat = 256; + break; + case FIRSTAID: + sp->xrepeat = 8; + sp->yrepeat = 8; + break; + case COLA: + sp->xrepeat = 5; + sp->yrepeat = 4; + break; + case AMMO: + sp->xrepeat = 9; + sp->yrepeat = 9; + break; + case MOTOAMMO: + if (!isRRRA()) goto default_case; + sp->xrepeat = 23; + sp->yrepeat = 23; + break; + case BOATAMMO: + if (!isRRRA()) goto default_case; + sp->xrepeat = 16; + sp->yrepeat = 16; + break; + case JETPACK: + sp->xrepeat = 8; + sp->yrepeat = 6; + break; + case STEROIDS: + sp->xrepeat = 13; + sp->yrepeat = 9; + break; + case ACCESSCARD: + sp->xrepeat = 11; + sp->yrepeat = 12; + break; + case HEATSENSOR: + sp->xrepeat = 6; + sp->yrepeat = 4; + break; + case AIRTANK: + sp->xrepeat = 19; + sp->yrepeat = 16; + break; + case BATTERYAMMO: + sp->xrepeat = 15; + sp->yrepeat = 15; + break; + case BOWLINGBALLSPRITE: + sp->xrepeat = 11; + sp->yrepeat = 11; + break; + case TRIPBOMBSPRITE: + sp->xrepeat = 11; + sp->yrepeat = 11; + sp->yvel = 4; + sp->xvel = 32; + break; + case RPGSPRITE: + sp->xrepeat = 16; + sp->yrepeat = 14; + break; + case RPG2SPRITE: + if (!isRRRA()) goto default_case; + sp->xrepeat = 20; + sp->yrepeat = 20; + break; + case SHRINKERSPRITE: + sp->xrepeat = 22; + sp->yrepeat = 13; + break; + case DEVISTATORSPRITE: + sp->xrepeat = 18; + sp->yrepeat = 17; + break; + case RRTILE43: + sp->xrepeat = 12; + sp->yrepeat = 7; + break; + case GROWSPRITEICON: + sp->xrepeat = 10; + sp->yrepeat = 9; + break; + case DEVISTATORAMMO: + sp->xrepeat = 10; + sp->yrepeat = 9; + break; + case ATOMICHEALTH: + sp->xrepeat = 8; + sp->yrepeat = 8; + break; + case FREEZESPRITE: + sp->xrepeat = 17; + sp->yrepeat = 16; + break; + } + sp->shade = sector[sp->sectnum].floorshade; + break; + case WATERFOUNTAIN: + sp->lotag = 1; + case TREE1: + case TREE2: + case TIRE: + sp->cstat = 257; // Make it hitable + sprite[i].extra = 1; + changespritestat(i,6); + break; + + case CAMERA1: + case CAMERA1+1: + case CAMERA1+2: + case CAMERA1+3: + case CAMERA1+4: + case CAMERAPOLE: + sp->extra = 1; + + if(camerashitable) sp->cstat = 257; + else sp->cstat = 0; + + if( ud.multimode < 2 && sp->pal != 0 ) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + else sp->pal = 0; + if(sp->picnum == CAMERAPOLE) break; + sp->picnum = CAMERA1; + changespritestat(i,1); + break; + case STEAM: + 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: + changespritestat(i,6); + break; + case SECTOREFFECTOR: + spawneffector(i); + + break; + + case SEENINE: + case OOZFILTER: + + 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: + case CRACK2: + case CRACK3: + case CRACK4: + sp->cstat |= 17; + sp->extra = 1; + if( ud.multimode < 2 && sp->pal != 0) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i,5); + break; + } + + sp->pal = 0; + sp->owner = i; + changespritestat(i,6); + sp->xvel = 8; + ssp(i,CLIPMASK0); + break; + + case EMPTYBIKE: + if (!isRRRA()) goto default_case; + if (ud.multimode < 2 && sp->pal == 1) + { + sp->xrepeat = sp->yrepeat = 0; + break; + } + sp->pal = 0; + sp->xrepeat = 18; + sp->yrepeat = 18; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->owner = 100; + sp->cstat = 257; + sp->lotag = 1; + changespritestat(i,1); + break; + case EMPTYBOAT: + if (!isRRRA()) goto default_case; + if (ud.multimode < 2 && sp->pal == 1) + { + sp->xrepeat = sp->yrepeat = 0; + break; + } + sp->pal = 0; + sp->xrepeat = 32; + sp->yrepeat = 32; + sp->clipdist = mulscale7(sp->xrepeat,tilesiz[sp->picnum].x); + sp->owner = 20; + sp->cstat = 257; + sp->lotag = 1; + changespritestat(i,1); + break; + + case TOILET: + case STALL: + case RRTILE2121: + case RRTILE2122: + sp->lotag = 1; + sp->cstat |= 257; + sp->clipdist = 8; + sp->owner = i; + break; + case CANWITHSOMETHING: + case RUBBERCAN: + sp->extra = 0; + case EXPLODINGBARREL: + case HORSEONSIDE: + case FIREBARREL: + case NUKEBARREL: + case FIREVASE: + case NUKEBARRELDENTED: + case NUKEBARRELLEAKED: + case WOODENHORSE: + + 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: + 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|(krand()&4); + changespritestat(i,2); + } + break; + case TOILETWATER: + sp->shade = -16; + changespritestat(i,6); + break; + case RRTILE63: + sp->cstat |= 32768; + sp->xrepeat = 1; + sp->yrepeat = 1; + sp->clipdist = 1; + changespritestat(i,100); + break; + } + return i; +} + +END_DUKE_NS diff --git a/source/games/duke/src/zz_actors.cpp b/source/games/duke/src/zz_actors.cpp index 4811c92a9..76c21afee 100644 --- a/source/games/duke/src/zz_actors.cpp +++ b/source/games/duke/src/zz_actors.cpp @@ -96,7 +96,7 @@ void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt) int32_t const r1 = krand2(), r2 = krand2(); int const j = A_InsertSprite(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z - (r2 % (47 << 8)), tileNum, -32, 8, 8, r1 & 2047, 0, 0, spriteNum, 5); - //A_Spawn(-1, j); + //fi.spawn(-1, j); sprite[j].cstat = krand2()&12; } } diff --git a/source/games/duke/src/zz_cheats.cpp b/source/games/duke/src/zz_cheats.cpp index 7272d1cab..66ee36b5d 100644 --- a/source/games/duke/src/zz_cheats.cpp +++ b/source/games/duke/src/zz_cheats.cpp @@ -824,7 +824,7 @@ void G_DoCheats(void) case CHEAT_RAKFC: for (int i = 0; i < 7; i++) { - int const newSprite = A_Spawn(pPlayer->i, TILE_HEN); + int const newSprite = fi.spawn(pPlayer->i, TILE_HEN); sprite[newSprite].pal = 1; sprite[newSprite].xrepeat <<= 2; sprite[newSprite].yrepeat <<= 2; diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index e4116015f..841fa5800 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -270,7 +270,7 @@ void OffMotorcycle(DukePlayer_t *pPlayer) pPlayer->vel.x -= sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7; pPlayer->vel.y -= sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7; pPlayer->moto_underwater = 0; - j = A_Spawn(pPlayer->i, TILE_EMPTYBIKE); + j = fi.spawn(pPlayer->i, TILE_EMPTYBIKE); sprite[j].ang = fix16_to_int(pPlayer->q16ang); sprite[j].xvel += sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7; sprite[j].yvel += sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7; @@ -323,7 +323,7 @@ void OffBoat(DukePlayer_t *pPlayer) pPlayer->vel.x -= sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7; pPlayer->vel.y -= sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7; pPlayer->moto_underwater = 0; - j = A_Spawn(pPlayer->i, TILE_EMPTYBOAT); + j = fi.spawn(pPlayer->i, TILE_EMPTYBOAT); sprite[j].ang = fix16_to_int(pPlayer->q16ang); sprite[j].xvel += sintable[(fix16_to_int(pPlayer->q16ang)+512)&2047]<<7; sprite[j].yvel += sintable[fix16_to_int(pPlayer->q16ang)&2047]<<7; @@ -855,7 +855,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) else smoothRatio = calc_smoothratio(totalclock, ototalclock); - if (RRRA && g_fogType) + if (RRRA && fogactive) pPlayer->visibility = ud.const_visibility; int const playerVis = pPlayer->visibility; @@ -1254,7 +1254,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) G_RestoreInterpolations(); - if (!RRRA || !g_fogType) + if (!RRRA || !fogactive) { // Totalclock count of last step of p->visibility converging towards // ud.const_visibility. @@ -1418,2929 +1418,6 @@ static void Yax_SetBunchInterpolation(int32_t sectnum, int32_t cf) # define Yax_SetBunchInterpolation(sectnum, cf) #endif -// A_Spawn has two forms with arguments having different meaning: -// -// 1. spriteNum>=0: Spawn from parent sprite with picnum -// 2. spriteNum<0: Spawn from already *existing* sprite -int A_Spawn(int spriteNum, int tileNum) -{ - int newSprite; - spritetype *pSprite; - actor_t * pActor; - int sectNum; - - - if (spriteNum >= 0) - { - // spawn from parent sprite - newSprite = A_InsertSprite(sprite[spriteNum].sectnum,sprite[spriteNum].x,sprite[spriteNum].y,sprite[spriteNum].z, - tileNum,0,0,0,0,0,0,spriteNum,0); - actor[newSprite].picnum = sprite[spriteNum].picnum; - } - else - { - // spawn from already existing sprite - newSprite = tileNum; - spritetype *const pSprite = &sprite[newSprite]; - actor_t *const pActor = &actor[newSprite]; - - Bmemset(&actor[newSprite], 0, sizeof(actor_t)); - Bmemcpy(&pActor->bpos, &sprite[newSprite], sizeof(vec3_t)); - - pActor->picnum = pSprite->picnum; - - if (pSprite->picnum == TILE_SECTOREFFECTOR && pSprite->lotag == 50) - pActor->picnum = pSprite->owner; - - pSprite->owner = pActor->owner = newSprite; - - pActor->floorz = sector[pSprite->sectnum].floorz; - pActor->ceilingz = sector[pSprite->sectnum].ceilingz; - - pActor->actorstayput = pActor->extra = -1; - -#ifdef POLYMER - pActor->lightId = -1; -#endif - - if ((pSprite->cstat & 48) - && (RR || (pSprite->picnum != TILE_SPEAKER - && pSprite->picnum != TILE_LETTER - && pSprite->picnum != TILE_DUCK - && pSprite->picnum != TILE_TARGET - && pSprite->picnum != TILE_TRIPBOMB - && pSprite->picnum != TILE_VIEWSCREEN - && pSprite->picnum != TILE_VIEWSCREEN2)) - && (!(pSprite->picnum >= TILE_CRACK1 && pSprite->picnum <= TILE_CRACK4))) - { - if (pSprite->shade == 127) - goto SPAWN_END; - - if (A_CheckSwitchTile(newSprite) && (pSprite->cstat & 16)) - { - if (pSprite->pal && pSprite->picnum != TILE_ACCESSSWITCH && pSprite->picnum != TILE_ACCESSSWITCH2) - { - if (((!g_netServer && ud.multimode < 2)) || ((g_netServer || ud.multimode > 1) && !GTFLAGS(GAMETYPE_DMSWITCHES))) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - pSprite->lotag = pSprite->hitag = 0; - pSprite->cstat = 32768; - goto SPAWN_END; - } - } - - pSprite->cstat |= 257; - - if (pSprite->pal && pSprite->picnum != TILE_ACCESSSWITCH && pSprite->picnum != TILE_ACCESSSWITCH2) - pSprite->pal = 0; - - goto SPAWN_END; - } - - if (pSprite->hitag) - { - changespritestat(newSprite, STAT_FALLER); - pSprite->cstat |= 257; - pSprite->extra = impact_damage; - goto SPAWN_END; - } - } - - if (pSprite->cstat & 1) - pSprite->cstat |= 256; - - if (!G_InitActor(newSprite, pSprite->picnum, 0)) - T2(newSprite) = T5(newSprite) = 0; // AC_MOVE_ID, AC_ACTION_ID - } - - pSprite = &sprite[newSprite]; - pActor = &actor[newSprite]; - sectNum = pSprite->sectnum; - - //some special cases that can't be handled through the dynamictostatic system. - - if (pSprite->picnum >= TILE_CAMERA1 && pSprite->picnum <= TILE_CAMERA1 + 4) - pSprite->picnum = TILE_CAMERA1; - else if (pSprite->picnum >= TILE_BOLT1 && pSprite->picnum <= TILE_BOLT1 + 3) - pSprite->picnum = TILE_BOLT1; - else if (!RR && pSprite->picnum >= TILE_SIDEBOLT1 && pSprite->picnum <= TILE_SIDEBOLT1 + 3) - pSprite->picnum = TILE_SIDEBOLT1; - if (DEER && pSprite->picnum != TILE_APLAYER && pSprite->picnum != TILE_RRTILE7936) - { - goto default_case; - } - else if (RRRA && pSprite->picnum == TILE_PIG+11) - { - pSprite->xrepeat = 16; - pSprite->yrepeat = 16; - pSprite->clipdist = 0; - pSprite->extra = 0; - pSprite->cstat = 0; - changespritestat(newSprite, 121); - } - else - switch (DYNAMICTILEMAP(pSprite->picnum)) - { - default: -default_case: - if (G_HaveActor(pSprite->picnum)) - { - if (spriteNum == -1 && pSprite->lotag > ud.player_skill) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - - // Init the size - if (pSprite->xrepeat == 0 || pSprite->yrepeat == 0) - pSprite->xrepeat = pSprite->yrepeat = 1; - - if (actorflag(newSprite, SFLAG_BADGUY)) - { - if (ud.monsters_off == 1) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - - makeitfall(newSprite); - - if (actorflag(newSprite, SFLAG_BADGUYSTAYPUT)) - pActor->actorstayput = pSprite->sectnum; - - if (!RR || actorflag(newSprite, SFLAG_KILLCOUNT)) - g_player[myconnectindex].ps->max_actors_killed++; - pSprite->clipdist = 80; - - if (spriteNum >= 0) - { - if (sprite[spriteNum].picnum == TILE_RESPAWN) - pActor->tempang = sprite[newSprite].pal = sprite[spriteNum].pal; - - A_PlayAlertSound(newSprite); - changespritestat(newSprite, STAT_ACTOR); - } - else - changespritestat(newSprite, STAT_ZOMBIEACTOR); - } - else - { - pSprite->clipdist = 40; - pSprite->owner = newSprite; - changespritestat(newSprite, STAT_ACTOR); - } - - pActor->timetosleep = 0; - - if (spriteNum >= 0) - pSprite->ang = sprite[spriteNum].ang; - } - break; - case FOF__STATIC: - if (RR) goto default_case; - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - case RRTILE280__STATICRR: - case RRTILE281__STATICRR: - case RRTILE282__STATICRR: - case RRTILE283__STATICRR: - case RRTILE2025__STATICRR: - case RRTILE2026__STATICRR: - case RRTILE2027__STATICRR: - case RRTILE2028__STATICRR: - pSprite->cstat = 0; - pSprite->cstat |= 32768; - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - pSprite->clipdist = 0; - pSprite->extra = 0; - changespritestat(newSprite, 105); - break; - case RRTILE3410__STATICRR: - pSprite->extra = 0; - changespritestat(newSprite, 107); - break; - case RRTILE8450__STATICRR: - if (!RRRA) goto default_case; - pSprite->xrepeat = 64; - pSprite->yrepeat = 64; - pSprite->extra = pSprite->lotag; - pSprite->cstat |= 257; - changespritestat(newSprite, 116); - break; - case RRTILE8487__STATICRR: - case RRTILE8489__STATICRR: - if (!RRRA) goto default_case; - pSprite->xrepeat = 32; - pSprite->yrepeat = 32; - pSprite->extra = 0; - pSprite->cstat |= 257; - pSprite->hitag = 0; - changespritestat(newSprite, 117); - break; - case RRTILE7424__STATICRR: - if (!RRRA) goto default_case; - pSprite->extra = 0; - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - changespritestat(newSprite, 11); - break; - case RRTILE7936__STATICRR: - if (!RRRA) goto default_case; - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - G_SetFog(2); - g_fogType = 1; - break; - case RRTILE6144__STATICRR: - if (!RRRA) goto default_case; - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - for (bssize_t TRAVERSE_CONNECT(playerNum)) - g_player[playerNum].ps->sea_sick_stat = 1; - break; - case RRTILE8448__STATICRR: - if (!RRRA) goto default_case; - pSprite->lotag = 1; - pSprite->clipdist = 0; - break; - case RRTILE8099__STATICRR: - if (!RRRA) goto default_case; - pSprite->lotag = 5; - pSprite->clipdist = 0; - changespritestat(newSprite, 123); - break; - case RRTILE8704__STATICRR: - if (!RRRA) goto default_case; - pSprite->lotag = 1; - pSprite->clipdist = 0; - break; - case RRTILE8192__STATICRR: - if (!RRRA) goto default_case; - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - ufospawnsminion = 1; - break; - case RRTILE8193__STATICRR: - if (!RRRA) goto default_case; - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - pistonsound = 1; - break; - case RRTILE8165__STATICRR: - if (!RRRA) goto default_case; - pSprite->lotag = 1; - pSprite->clipdist = 0; - pSprite->owner = newSprite; - pSprite->extra = 0; - changespritestat(newSprite, 115); - break; - case RRTILE8593__STATICRR: - if (!RRRA) goto default_case; - pSprite->lotag = 1; - pSprite->clipdist = 0; - pSprite->owner = newSprite; - pSprite->extra = 0; - changespritestat(newSprite, 122); - break; -//#endif - case RRTILE285__STATICRR: - case RRTILE286__STATICRR: - case RRTILE287__STATICRR: - case RRTILE288__STATICRR: - case RRTILE289__STATICRR: - case RRTILE290__STATICRR: - case RRTILE291__STATICRR: - case RRTILE292__STATICRR: - case RRTILE293__STATICRR: - pSprite->cstat = 0; - pSprite->cstat |= 32768; - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - pSprite->clipdist = 0; - pSprite->lotag = 0; - changespritestat(newSprite, 106); - break; - - case WATERSPLASH2__STATIC: - case MUD__STATICRR: - if (spriteNum >= 0) - { - setsprite(newSprite, (vec3_t *)&sprite[spriteNum]); - pSprite->xrepeat = pSprite->yrepeat = 8+(krand2()&7); - } - else pSprite->xrepeat = pSprite->yrepeat = 16+(krand2()&15); - - pSprite->shade = -16; - pSprite->cstat |= 128; - - if (spriteNum >= 0) - { - if (sector[sprite[spriteNum].sectnum].lotag == ST_2_UNDERWATER) - { - pSprite->z = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y) + (16 << 8); - pSprite->cstat |= 8; - } - else if (sector[sprite[spriteNum].sectnum].lotag == ST_1_ABOVE_WATER) - pSprite->z = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); - } - - if (sector[sectNum].floorpicnum == TILE_FLOORSLIME || sector[sectNum].ceilingpicnum == TILE_FLOORSLIME) - pSprite->pal = 7; - fallthrough__; - case NEON1__STATIC: - case NEON2__STATIC: - case NEON3__STATIC: - case NEON4__STATIC: - case NEON5__STATIC: - case NEON6__STATIC: - case DOMELITE__STATIC: - if (pSprite->picnum != TILE_WATERSPLASH2) - pSprite->cstat |= 257; - fallthrough__; - case NUKEBUTTON__STATIC: - if (RR && pSprite->picnum == TILE_NUKEBUTTON) - goto default_case; - if (pSprite->picnum == TILE_DOMELITE) - pSprite->cstat |= 257; - fallthrough__; - case JIBS1__STATIC: - case JIBS2__STATIC: - case JIBS3__STATIC: - case JIBS4__STATIC: - case JIBS5__STATIC: - case JIBS6__STATIC: - case DUKETORSO__STATIC: - case DUKEGUN__STATIC: - case DUKELEG__STATIC: - if (RR && pSprite->picnum == TILE_JIBS6) - { - pSprite->xrepeat >>= 1; - pSprite->yrepeat >>= 1; - } - changespritestat(newSprite, STAT_MISC); - break; - case HEADJIB1__STATIC: - case ARMJIB1__STATIC: - case LEGJIB1__STATIC: - case LIZMANHEAD1__STATIC: - case LIZMANARM1__STATIC: - case LIZMANLEG1__STATIC: - if (RR) goto default_case; - changespritestat(newSprite, STAT_MISC); - break; - case RRTILE2460__STATICRR: - case RRTILE2465__STATICRR: - case BIKEJIBA__STATICRR: - case BIKEJIBB__STATICRR: - case BIKEJIBC__STATICRR: - case BIKERJIBA__STATICRR: - case BIKERJIBB__STATICRR: - case BIKERJIBC__STATICRR: - case BIKERJIBD__STATICRR: - case CHEERJIBA__STATICRR: - case CHEERJIBB__STATICRR: - case CHEERJIBC__STATICRR: - case CHEERJIBD__STATICRR: - case FBOATJIBA__STATICRR: - case FBOATJIBB__STATICRR: - case RABBITJIBA__STATICRR: - case RABBITJIBB__STATICRR: - case RABBITJIBC__STATICRR: - case MAMAJIBA__STATICRR: - case MAMAJIBB__STATICRR: - if (!RRRA) goto default_case; - if (pSprite->picnum == TILE_RABBITJIBA) - { - pSprite->xrepeat = 18; - pSprite->yrepeat = 18; - } - else if (pSprite->picnum == TILE_RABBITJIBB) - { - pSprite->xrepeat = 36; - pSprite->yrepeat = 36; - } - else if (pSprite->picnum == TILE_RABBITJIBC) - { - pSprite->xrepeat = 54; - pSprite->yrepeat = 54; - } - fallthrough__; - case BILLYJIBA__STATICRR: - case BILLYJIBB__STATICRR: - case HULKJIBA__STATICRR: - case HULKJIBB__STATICRR: - case HULKJIBC__STATICRR: - case MINJIBA__STATICRR: - case MINJIBB__STATICRR: - case MINJIBC__STATICRR: - case COOTJIBA__STATICRR: - case COOTJIBB__STATICRR: - case COOTJIBC__STATICRR: - changespritestat(newSprite, STAT_MISC); - break; - case TONGUE__STATIC: - if (spriteNum >= 0) - pSprite->ang = sprite[spriteNum].ang; - pSprite->z -= 38<<8; - pSprite->zvel = 256-(krand2()&511); - pSprite->xvel = 64-(krand2()&127); - changespritestat(newSprite, STAT_PROJECTILE); - break; - case NATURALLIGHTNING__STATIC: - if (RR) goto default_case; - pSprite->cstat &= ~257; - pSprite->cstat |= 32768; - break; - case TRANSPORTERSTAR__STATIC: - case TRANSPORTERBEAM__STATIC: - if (spriteNum == -1) break; - if (pSprite->picnum == TILE_TRANSPORTERBEAM) - { - pSprite->xrepeat = 31; - pSprite->yrepeat = 1; - pSprite->z = sector[sprite[spriteNum].sectnum].floorz-PHEIGHT; - } - else - { - if (sprite[spriteNum].statnum == STAT_PROJECTILE) - pSprite->xrepeat = pSprite->yrepeat = 8; - else - { - pSprite->xrepeat = 48; - pSprite->yrepeat = 64; - if (sprite[spriteNum].statnum == STAT_PLAYER || A_CheckEnemySprite(&sprite[spriteNum])) - pSprite->z -= ZOFFSET5; - } - } - - pSprite->shade = -127; - pSprite->cstat = 128|2; - pSprite->ang = sprite[spriteNum].ang; - - pSprite->xvel = 128; - changespritestat(newSprite, STAT_MISC); - A_SetSprite(newSprite,CLIPMASK0); - setsprite(newSprite,(vec3_t *)pSprite); - break; - - case FRAMEEFFECT1__STATIC: - if (spriteNum >= 0) - { - pSprite->xrepeat = sprite[spriteNum].xrepeat; - pSprite->yrepeat = sprite[spriteNum].yrepeat; - if (RR && sprite[spriteNum].picnum == TILE_APLAYER) - T2(newSprite) = TILE_SMALLSMOKE; - else - T2(newSprite) = sprite[spriteNum].picnum; - } - else pSprite->xrepeat = pSprite->yrepeat = 0; - - changespritestat(newSprite, STAT_MISC); - - break; - - case LASERLINE__STATIC: - if (RR) goto default_case; - pSprite->yrepeat = 6; - pSprite->xrepeat = 32; - - if (lasermode == 1) - pSprite->cstat = 16 + 2; - else if (lasermode == 0 || lasermode == 2) - pSprite->cstat = 16; - else - { - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - } - - if (spriteNum >= 0) pSprite->ang = actor[spriteNum].t_data[5]+512; - changespritestat(newSprite, STAT_MISC); - break; - - case FORCESPHERE__STATIC: - if (spriteNum == -1) - { - pSprite->cstat = 32768; - changespritestat(newSprite, STAT_ZOMBIEACTOR); - } - else - { - pSprite->xrepeat = pSprite->yrepeat = 1; - changespritestat(newSprite, STAT_MISC); - } - break; - - case BLOOD__STATIC: - pSprite->xrepeat = pSprite->yrepeat = RR ? 4 : 16; - pSprite->z -= (26<<8); - if (!RR && spriteNum >= 0 && sprite[spriteNum].pal == 6) - pSprite->pal = 6; - changespritestat(newSprite, STAT_MISC); - break; - case BLOODPOOL__STATIC: - case PUKE__STATIC: - { - if (RR && pSprite->picnum == TILE_PUKE) goto default_case; - int16_t pukeSect = pSprite->sectnum; - - updatesector(pSprite->x + 108, pSprite->y + 108, &pukeSect); - if (pukeSect >= 0 && sector[pukeSect].floorz == sector[pSprite->sectnum].floorz) - { - updatesector(pSprite->x - 108, pSprite->y - 108, &pukeSect); - if (pukeSect >= 0 && sector[pukeSect].floorz == sector[pSprite->sectnum].floorz) - { - updatesector(pSprite->x + 108, pSprite->y - 108, &pukeSect); - if (pukeSect >= 0 && sector[pukeSect].floorz == sector[pSprite->sectnum].floorz) - { - updatesector(pSprite->x - 108, pSprite->y + 108, &pukeSect); - if (pukeSect >= 0 && sector[pukeSect].floorz != sector[pSprite->sectnum].floorz) - goto zero_puke; - } - else goto zero_puke; - } - else goto zero_puke; - } - else - { - zero_puke: - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - - if (sector[sectNum].lotag == ST_1_ABOVE_WATER) - { - changespritestat(newSprite, STAT_MISC); - break; - } - - if (spriteNum >= 0 && (RR || pSprite->picnum != TILE_PUKE)) - { - if (sprite[spriteNum].pal == 1) - pSprite->pal = 1; - else if (sprite[spriteNum].pal != 6 && sprite[spriteNum].picnum != TILE_NUKEBARREL && sprite[spriteNum].picnum != TILE_TIRE) - pSprite->pal = (!RR && sprite[spriteNum].picnum == TILE_FECES) ? 7 : 2; // Brown or red - else - pSprite->pal = 0; // green - - if (sprite[spriteNum].picnum == TILE_TIRE) - pSprite->shade = 127; - } - pSprite->cstat |= 32; - if (RR) goto rrbloodpool_fallthrough; - fallthrough__; - } - case FECES__STATIC: - if (RR) goto default_case; - if (spriteNum >= 0) - pSprite->xrepeat = pSprite->yrepeat = 1; - changespritestat(newSprite, STAT_MISC); - break; - - case BLOODSPLAT1__STATIC: - case BLOODSPLAT2__STATIC: - case BLOODSPLAT3__STATIC: - case BLOODSPLAT4__STATIC: -rrbloodpool_fallthrough: - pSprite->cstat |= 16; - pSprite->xrepeat = 7 + (krand2() & 7); - pSprite->yrepeat = 7 + (krand2() & 7); - pSprite->z -= ZOFFSET2; - - if (pSprite->picnum == TILE_BLOODPOOL) - pSprite->cstat |= 32768; - - if (spriteNum >= 0 && sprite[spriteNum].pal == 6) - pSprite->pal = 6; - - A_AddToDeleteQueue(newSprite); - changespritestat(newSprite, STAT_MISC); - break; - - case TRIPBOMB__STATIC: - if (RR) goto default_case; - if (pSprite->lotag > ud.player_skill) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - - pSprite->xrepeat = 4; - pSprite->yrepeat = 5; - pSprite->hitag = newSprite; - pSprite->owner = pSprite->hitag; - pSprite->xvel = 16; - - A_SetSprite(newSprite, CLIPMASK0); - - pActor->t_data[0] = 17; - pActor->t_data[2] = 0; - pActor->t_data[5] = pSprite->ang; - - changespritestat(newSprite, STAT_ZOMBIEACTOR); - break; - - case SPACEMARINE__STATIC: - if (RR) goto default_case; - pSprite->extra = 20; - pSprite->cstat |= 257; - changespritestat(newSprite, STAT_ZOMBIEACTOR); - break; - - case PANNEL1__STATIC: - case PANNEL2__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 HANGLIGHT__STATIC: - case FETUS__STATIC: - case FETUSBROKE__STATIC: - case TRIPODCAMERA__STATIC: - if (RR) goto default_case; - fallthrough__; - case HYDRENT__STATIC: - case SATELITE__STATIC: - case FUELPOD__STATIC: - case SOLARPANNEL__STATIC: - case ANTENNA__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 SCALE__STATIC: - case VACUUM__STATIC: - case CACTUS__STATIC: - case CACTUSBROKE__STATIC: - case CAMERALIGHT__STATIC: - case MOVIECAMERA__STATIC: - case IVUNIT__STATIC: - case POT1__STATIC: - case POT2__STATIC: - case POT3__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: - case GRATE1__STATIC: - case FANSPRITE__STATIC: - pSprite->clipdist = 32; - pSprite->cstat |= 257; - fallthrough__; - case OCEANSPRITE4__STATIC: - if (RR && pSprite->picnum == TILE_OCEANSPRITE4) goto default_case; - changespritestat(newSprite, STAT_DEFAULT); - break; - case FEMMAG1__STATIC: - case FEMMAG2__STATIC: - pSprite->cstat &= ~257; - changespritestat(newSprite, STAT_DEFAULT); - break; - case DUKETAG__STATIC: - case SIGN1__STATIC: - case SIGN2__STATIC: - if (RR) goto default_case; - if ((!g_netServer && ud.multimode < 2) && pSprite->pal) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - } - else pSprite->pal = 0; - break; - - case MASKWALL1__STATIC: - case MASKWALL2__STATIC: - case MASKWALL3__STATIC: - case MASKWALL4__STATIC: - case MASKWALL5__STATIC: - case MASKWALL6__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: - if (RR) goto default_case; - fallthrough__; - case MASKWALL7__STATIC: - { - int const j = pSprite->cstat & SPAWN_PROTECT_CSTAT_MASK; - pSprite->cstat = j | CSTAT_SPRITE_BLOCK; - changespritestat(newSprite, STAT_DEFAULT); - break; - } - case FOOTPRINTS__STATIC: - case FOOTPRINTS2__STATIC: - case FOOTPRINTS3__STATIC: - case FOOTPRINTS4__STATIC: - if (spriteNum >= 0) - { - int16_t footSect = pSprite->sectnum; - - updatesector(pSprite->x + 84, pSprite->y + 84, &footSect); - if (footSect >= 0 && sector[footSect].floorz == sector[pSprite->sectnum].floorz) - { - updatesector(pSprite->x - 84, pSprite->y - 84, &footSect); - if (footSect >= 0 && sector[footSect].floorz == sector[pSprite->sectnum].floorz) - { - updatesector(pSprite->x + 84, pSprite->y - 84, &footSect); - if (footSect >= 0 && sector[footSect].floorz == sector[pSprite->sectnum].floorz) - { - updatesector(pSprite->x - 84, pSprite->y + 84, &footSect); - if (footSect >= 0 && sector[footSect].floorz != sector[pSprite->sectnum].floorz) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - } - else goto zero_footprint; - } - else goto zero_footprint; - } - else - { - zero_footprint: - pSprite->xrepeat = pSprite->yrepeat = 0; - break; - } - - pSprite->cstat = 32 + ((g_player[P_Get(spriteNum)].ps->footprintcount & 1) << 2); - pSprite->ang = sprite[spriteNum].ang; - } - - pSprite->z = sector[sectNum].floorz; - - if (sector[sectNum].lotag != ST_1_ABOVE_WATER && sector[sectNum].lotag != ST_2_UNDERWATER) - pSprite->xrepeat = pSprite->yrepeat = 32; - - A_AddToDeleteQueue(newSprite); - changespritestat(newSprite, STAT_MISC); - break; - - case PODFEM1__STATIC: - if (RR) goto default_case; - pSprite->extra <<= 1; - fallthrough__; - 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: - if (RR) goto default_case; - fallthrough__; - case FEM10__STATIC: - case NAKED1__STATIC: - case STATUE__STATIC: - case TOUGHGAL__STATIC: - pSprite->yvel = pSprite->hitag; - pSprite->hitag = -1; - fallthrough__; - case BLOODYPOLE__STATIC: - if (RR && pSprite->picnum == TILE_BLOODYPOLE) goto default_case; - pSprite->cstat |= 257; - pSprite->clipdist = 32; - changespritestat(newSprite, STAT_ZOMBIEACTOR); - break; - - case QUEBALL__STATIC: - case STRIPEBALL__STATIC: - pSprite->cstat = 256; - pSprite->clipdist = 8; - changespritestat(newSprite, STAT_ZOMBIEACTOR); - break; - case BOWLINGBALL__STATICRR: - pSprite->cstat = 256; - pSprite->clipdist = 64; - pSprite->xrepeat = 11; - pSprite->yrepeat = 9; - changespritestat(newSprite, 2); - break; - case HENSTAND__STATICRR: - pSprite->cstat = 257; - pSprite->clipdist = 48; - pSprite->xrepeat = 21; - pSprite->yrepeat = 15; - changespritestat(newSprite, 2); - break; - case RRTILE295__STATICRR: - pSprite->cstat |= 32768; - changespritestat(newSprite, 107); - break; - case RRTILE296__STATICRR: - case RRTILE297__STATICRR: - pSprite->xrepeat = 64; - pSprite->yrepeat = 64; - pSprite->clipdist = 64; - changespritestat(newSprite, 108); - break; - case RRTILE3190__STATICRR: - case RRTILE3191__STATICRR: - case RRTILE3192__STATICRR: - pSprite->cstat = 257; - pSprite->clipdist = 8; - pSprite->xrepeat = 32; - pSprite->yrepeat = 26; - pSprite->xvel = 32; - changespritestat(newSprite, 1); - break; - case RRTILE3120__STATICRR: - pSprite->cstat = 257; - pSprite->clipdist = 8; - pSprite->xrepeat = 12; - pSprite->yrepeat = 10; - pSprite->xvel = 32; - changespritestat(newSprite, 1); - break; - case RRTILE3122__STATICRR: - pSprite->cstat = 257; - pSprite->clipdist = 2; - pSprite->xrepeat = 8; - pSprite->yrepeat = 6; - pSprite->xvel = 16; - changespritestat(newSprite, 1); - break; - case RRTILE3123__STATICRR: - pSprite->cstat = 257; - pSprite->clipdist = 8; - pSprite->xrepeat = 13; - pSprite->yrepeat = 13; - pSprite->xvel = 16; - changespritestat(newSprite, 1); - break; - case RRTILE3124__STATICRR: - pSprite->cstat = 257; - pSprite->clipdist = 8; - pSprite->xrepeat = 17; - pSprite->yrepeat = 12; - pSprite->xvel = 32; - changespritestat(newSprite, 1); - break; - case RRTILE3132__STATICRR: - pSprite->cstat = 257; - pSprite->clipdist = 8; - pSprite->xrepeat = 13; - pSprite->yrepeat = 10; - pSprite->xvel = 0; - changespritestat(newSprite, 1); - break; - case RRTILE3440__STATICRR: - pSprite->cstat = 257; - pSprite->clipdist = 48; - pSprite->xrepeat = 23; - pSprite->yrepeat = 23; - changespritestat(newSprite, 2); - break; - - case DUKELYINGDEAD__STATIC: - if (spriteNum >= 0 && sprite[spriteNum].picnum == TILE_APLAYER) - { - pSprite->xrepeat = sprite[spriteNum].xrepeat; - pSprite->yrepeat = sprite[spriteNum].yrepeat; - pSprite->shade = sprite[spriteNum].shade; - pSprite->pal = g_player[P_Get(spriteNum)].ps->palookup; - } - fallthrough__; - case DUKECAR__STATIC: - case HELECOPT__STATIC: - // if(sp->picnum == TILE_HELECOPT || sp->picnum == TILE_DUKECAR) sp->xvel = 1024; - if (RR && (pSprite->picnum == TILE_DUKECAR || pSprite->picnum == TILE_HELECOPT)) goto default_case; - pSprite->cstat = 0; - pSprite->extra = 1; - pSprite->xvel = 292; - pSprite->zvel = 360; - fallthrough__; - case BLIMP__STATIC: - if (RR && pSprite->picnum == TILE_BLIMP) goto default_case; - pSprite->cstat |= 257; - pSprite->clipdist = 128; - changespritestat(newSprite, STAT_ACTOR); - break; - - case RESPAWNMARKERRED__STATIC: - pSprite->xrepeat = pSprite->yrepeat = RR ? 8 : 24; - if (spriteNum >= 0) - pSprite->z = actor[spriteNum].floorz; // -(1<<4); - changespritestat(newSprite, STAT_ACTOR); - break; - - case MIKE__STATIC: - pSprite->yvel = pSprite->hitag; - pSprite->hitag = 0; - changespritestat(newSprite, STAT_ACTOR); - break; - case WEATHERWARN__STATIC: - if (RR) goto default_case; - changespritestat(newSprite, STAT_ACTOR); - break; - - case SPOTLITE__STATIC: - T1(newSprite) = pSprite->x; - T2(newSprite) = pSprite->y; - break; - case BULLETHOLE__STATIC: - pSprite->xrepeat = 3; - pSprite->yrepeat = 3; - pSprite->cstat = 16 + (krand2() & 12); - - A_AddToDeleteQueue(newSprite); - changespritestat(newSprite, STAT_MISC); - break; - - case MONEY__STATIC: - case MAIL__STATIC: - case PAPER__STATIC: - if (RR && (pSprite->picnum == TILE_MAIL || pSprite->picnum == TILE_PAPER)) goto default_case; - pActor->t_data[0] = krand2() & 2047; - - pSprite->cstat = krand2() & 12; - pSprite->xrepeat = 8; - pSprite->yrepeat = 8; - pSprite->ang = krand2() & 2047; - - changespritestat(newSprite, STAT_MISC); - break; - - case VIEWSCREEN__STATIC: - case VIEWSCREEN2__STATIC: - if (RR) goto default_case; - pSprite->owner = newSprite; - pSprite->lotag = pSprite->extra = 1; - changespritestat(newSprite, STAT_STANDABLE); - break; - - case SHELL__STATIC: //From the player - case SHOTGUNSHELL__STATIC: - if (spriteNum >= 0) - { - int shellAng; - - if (sprite[spriteNum].picnum == TILE_APLAYER) - { - int const playerNum = P_Get(spriteNum); - const DukePlayer_t *const pPlayer = g_player[playerNum].ps; - - shellAng = fix16_to_int(pPlayer->q16ang) - (krand2() & 63) + 8; // Fine tune - - T1(newSprite) = krand2() & 1; - - pSprite->z = (3 << 8) + pPlayer->pyoff + pPlayer->pos.z - (fix16_to_int((pPlayer->q16horizoff + pPlayer->q16horiz - F16(100))) << 4); - - if (pSprite->picnum == TILE_SHOTGUNSHELL) - pSprite->z += (3 << 8); - - pSprite->zvel = -(krand2() & 255); - } - else - { - shellAng = pSprite->ang; - pSprite->z = sprite[spriteNum].z - PHEIGHT + (RR ? (7 << 8) : (3 << 8)); - } - - pSprite->x = sprite[spriteNum].x + (sintable[(shellAng + 512) & 2047] >> 7); - pSprite->y = sprite[spriteNum].y + (sintable[shellAng & 2047] >> 7); - pSprite->shade = -8; - - if (NAM_WW2GI) - { - pSprite->ang = shellAng + 512; - pSprite->xvel = 30; - } - else - { - pSprite->ang = shellAng - 512; - pSprite->xvel = 20; - } - - if (RR && pSprite->picnum == TILE_SHELL) - pSprite->xrepeat = pSprite->yrepeat = 2; - else - pSprite->xrepeat = pSprite->yrepeat = 4; - - changespritestat(newSprite, STAT_MISC); - } - break; - case RESPAWN__STATIC: - pSprite->extra = 66-13; - fallthrough__; - case MUSICANDSFX__STATIC: - if ((!g_netServer && ud.multimode < 2) && pSprite->pal == 1) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - pSprite->cstat = 32768; - changespritestat(newSprite, STAT_FX); - break; - case SOUNDFX__STATICRR: - pSprite->cstat |= 32768; - changespritestat(newSprite, STAT_ZOMBIEACTOR); - break; - - case EXPLOSION2__STATIC: - case EXPLOSION3__STATICRR: -#ifdef POLYMER - if (pSprite->yrepeat > 32) - { - G_AddGameLight(0, newSprite, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 32768, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); - pActor->lightcount = 2; - } - fallthrough__; -#endif - case EXPLOSION2BOT__STATIC: - case BURNING__STATIC: - case BURNING2__STATIC: - case SMALLSMOKE__STATIC: - case SHRINKEREXPLOSION__STATIC: - case COOLEXPLOSION1__STATIC: - if (RR && (pSprite->picnum == TILE_EXPLOSION2BOT || pSprite->picnum == TILE_BURNING2 - || pSprite->picnum == TILE_SHRINKEREXPLOSION || pSprite->picnum == TILE_COOLEXPLOSION1)) goto default_case; - if (spriteNum >= 0) - { - pSprite->ang = sprite[spriteNum].ang; - pSprite->shade = -64; - pSprite->cstat = 128|(krand2()&4); - } - - if (pSprite->picnum == TILE_EXPLOSION2 || (!RR && pSprite->picnum == TILE_EXPLOSION2BOT)) - { - pSprite->xrepeat = pSprite->yrepeat = 48; - pSprite->shade = -127; - pSprite->cstat |= 128; - } - else if (RR && pSprite->picnum == TILE_EXPLOSION3) - { - pSprite->xrepeat = pSprite->yrepeat = 128; - pSprite->shade = -127; - pSprite->cstat |= 128; - } - else if (!RR && pSprite->picnum == TILE_SHRINKEREXPLOSION) - pSprite->xrepeat = pSprite->yrepeat = 32; - else if (pSprite->picnum == TILE_SMALLSMOKE) - { - // 64 "money" - pSprite->xrepeat = pSprite->yrepeat = RR ? 12 : 24; - } - else if (pSprite->picnum == TILE_BURNING || (!RR && pSprite->picnum == TILE_BURNING2)) - pSprite->xrepeat = pSprite->yrepeat = 4; - - pSprite->cstat |= 8192; - - if (spriteNum >= 0) - { - int const floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); - - if (pSprite->z > floorZ-ZOFFSET4) - pSprite->z = floorZ-ZOFFSET4; - } - - changespritestat(newSprite, STAT_MISC); - - break; - - case PLAYERONWATER__STATIC: - if (spriteNum >= 0) - { - pSprite->xrepeat = sprite[spriteNum].xrepeat; - pSprite->yrepeat = sprite[spriteNum].yrepeat; - pSprite->zvel = 128; - if (sector[pSprite->sectnum].lotag != ST_2_UNDERWATER) - pSprite->cstat |= 32768; - } - changespritestat(newSprite, STAT_DUMMYPLAYER); - break; - - case APLAYER__STATIC: - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - pSprite->cstat = 32768; - - changespritestat(newSprite, ((!g_netServer && ud.multimode < 2) - || ((g_gametypeFlags[ud.coop] & GAMETYPE_COOPSPAWN) / GAMETYPE_COOPSPAWN) != pSprite->lotag) - ? STAT_MISC - : STAT_PLAYER); - break; - - case WATERBUBBLE__STATIC: - if (spriteNum >= 0) - { - if (sprite[spriteNum].picnum == TILE_APLAYER) - pSprite->z -= (16 << 8); - - pSprite->ang = sprite[spriteNum].ang; - } - - pSprite->xrepeat = pSprite->yrepeat = RR ? (1+(krand2()&7)) : 4; - changespritestat(newSprite, STAT_MISC); - break; - - case CRANE__STATIC: - - pSprite->cstat |= 64|257; - - pSprite->picnum += 2; - pSprite->z = sector[sectNum].ceilingz+(48<<8); - T5(newSprite) = tempwallptr; - - g_origins[tempwallptr] = *(vec2_t *) pSprite; - g_origins[tempwallptr+2].x = pSprite->z; - - - if (headspritestat[STAT_DEFAULT] != -1) - { - int findSprite = headspritestat[STAT_DEFAULT]; - - do - { - if (sprite[findSprite].picnum == TILE_CRANEPOLE && pSprite->hitag == (sprite[findSprite].hitag)) - { - g_origins[tempwallptr + 2].y = findSprite; - - T2(newSprite) = sprite[findSprite].sectnum; - - sprite[findSprite].xrepeat = 48; - sprite[findSprite].yrepeat = 128; - - g_origins[tempwallptr + 1] = *(vec2_t *) &sprite[findSprite]; - *(vec3_t *) &sprite[findSprite] = *(vec3_t *) pSprite; - sprite[findSprite].shade = pSprite->shade; - - setsprite(findSprite, (vec3_t *) &sprite[findSprite]); - break; - } - findSprite = nextspritestat[findSprite]; - } while (findSprite >= 0); - } - - tempwallptr += 3; - pSprite->owner = -1; - pSprite->extra = 8; - changespritestat(newSprite, STAT_STANDABLE); - break; - - case TRASH__STATIC: - pSprite->ang = krand2()&2047; - pSprite->xrepeat = pSprite->yrepeat = 24; - changespritestat(newSprite, STAT_STANDABLE); - break; - - case WATERDRIP__STATIC: - if (spriteNum >= 0 && (sprite[spriteNum].statnum == STAT_PLAYER || sprite[spriteNum].statnum == STAT_ACTOR)) - { - if (sprite[spriteNum].pal != 1) - { - pSprite->pal = 2; - pSprite->z -= (18<<8); - } - else pSprite->z -= (13<<8); - - pSprite->shade = 32; - pSprite->ang = getangle(g_player[0].ps->pos.x - pSprite->x, g_player[0].ps->pos.y - pSprite->y); - pSprite->xvel = 48 - (krand2() & 31); - - A_SetSprite(newSprite, CLIPMASK0); - } - else if (spriteNum == -1) - { - pSprite->z += ZOFFSET6; - T1(newSprite) = pSprite->z; - if (!RR) - T2(newSprite) = krand2()&127; - } - fallthrough__; - case WATERDRIPSPLASH__STATIC: - if (RR && pSprite->picnum == TILE_WATERDRIPSPLASH) goto default_case; - pSprite->xrepeat = pSprite->yrepeat = 24; - changespritestat(newSprite, STAT_STANDABLE); - break; - - case PLUG__STATIC: - pSprite->lotag = 9999; - changespritestat(newSprite, STAT_STANDABLE); - break; - case TOUCHPLATE__STATIC: - T3(newSprite) = sector[sectNum].floorz; - - if (sector[sectNum].lotag != ST_1_ABOVE_WATER && sector[sectNum].lotag != ST_2_UNDERWATER) - sector[sectNum].floorz = pSprite->z; - - if (pSprite->pal && (g_netServer || ud.multimode > 1)) - { - pSprite->xrepeat=pSprite->yrepeat=0; - changespritestat(newSprite, STAT_MISC); - break; - } - fallthrough__; - case WATERBUBBLEMAKER__STATIC: - if (EDUKE32_PREDICT_FALSE(pSprite->hitag && pSprite->picnum == TILE_WATERBUBBLEMAKER)) - { - // JBF 20030913: Pisses off X_Move(), eg. in bobsp2 - Printf(TEXTCOLOR_RED "WARNING: TILE_WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n", - newSprite,TrackerCast(pSprite->x),TrackerCast(pSprite->y)); - pSprite->hitag = 0; - } - pSprite->cstat |= 32768; - changespritestat(newSprite, STAT_STANDABLE); - break; - - case BOLT1__STATIC: - case SIDEBOLT1__STATIC: - if (RR && pSprite->picnum >= TILE_SIDEBOLT1 && pSprite->picnum <= TILE_SIDEBOLT1+3) goto default_case; - T1(newSprite) = pSprite->xrepeat; - T2(newSprite) = pSprite->yrepeat; - pSprite->yvel = 0; - - changespritestat(newSprite, STAT_STANDABLE); - break; - - case MASTERSWITCH__STATIC: - if (pSprite->picnum == TILE_MASTERSWITCH) - pSprite->cstat |= 32768; - pSprite->yvel = 0; - changespritestat(newSprite, STAT_STANDABLE); - break; - - case TARGET__STATIC: - case DUCK__STATIC: - case LETTER__STATIC: - if (RR) goto default_case; - pSprite->extra = 1; - pSprite->cstat |= 257; - changespritestat(newSprite, STAT_ACTOR); - 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: - if (RR) goto default_case; - pActor->actorstayput = pSprite->sectnum; - fallthrough__; - case BOSS1__STATIC: - case BOSS2__STATIC: - case BOSS3__STATIC: - case BOSS4__STATIC: - case ROTATEGUN__STATIC: - case GREENSLIME__STATIC: - if (RR) goto default_case; - if (pSprite->picnum == TILE_GREENSLIME) - pSprite->extra = 1; - fallthrough__; - 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 (RR) - { - if (pSprite->picnum == TILE_RAT || pSprite->picnum == TILE_SHARK || pSprite->picnum == TILE_DRONE) - goto rr_badguy; - goto default_case; - } - - if (pSprite->pal == 0) - { - switch (DYNAMICTILEMAP(pSprite->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: pSprite->pal = 22; break; - } - } - else - { - if (!PLUTOPAK) - pSprite->extra <<= 1; - } - - if (pSprite->picnum == TILE_BOSS4STAYPUT || pSprite->picnum == TILE_BOSS1 || pSprite->picnum == TILE_BOSS2 || - pSprite->picnum == TILE_BOSS1STAYPUT || pSprite->picnum == TILE_BOSS3 || pSprite->picnum == TILE_BOSS4) - { - if (spriteNum >= 0 && sprite[spriteNum].picnum == TILE_RESPAWN) - pSprite->pal = sprite[spriteNum].pal; - - if (pSprite->pal) - { - pSprite->clipdist = 80; - pSprite->xrepeat = pSprite->yrepeat = 40; - } - else - { - pSprite->xrepeat = pSprite->yrepeat = 80; - pSprite->clipdist = 164; - } - } - else - { - if (pSprite->picnum != TILE_SHARK) - { - pSprite->xrepeat = pSprite->yrepeat = 40; - pSprite->clipdist = 80; - } - else - { - pSprite->xrepeat = pSprite->yrepeat = 60; - pSprite->clipdist = 40; - } - } - - // If spawned from parent sprite (as opposed to 'from premap'), - // ignore skill. - if (spriteNum >= 0) - pSprite->lotag = 0; - - if ((pSprite->lotag > ud.player_skill) || ud.monsters_off == 1) - { - pSprite->xrepeat=pSprite->yrepeat=0; - changespritestat(newSprite, STAT_MISC); - break; - } - else - { - makeitfall(newSprite); - - if (pSprite->picnum == TILE_RAT) - { - pSprite->ang = krand2()&2047; - pSprite->xrepeat = pSprite->yrepeat = 48; - pSprite->cstat = 0; - } - else - { - pSprite->cstat |= 257; - - if (pSprite->picnum != TILE_SHARK) - g_player[myconnectindex].ps->max_actors_killed++; - } - - if (pSprite->picnum == TILE_ORGANTIC) pSprite->cstat |= 128; - - if (spriteNum >= 0) - { - pActor->timetosleep = 0; - A_PlayAlertSound(newSprite); - changespritestat(newSprite, STAT_ACTOR); - } - else changespritestat(newSprite, STAT_ZOMBIEACTOR); - } - - if (pSprite->picnum == TILE_ROTATEGUN) - pSprite->zvel = 0; - - break; - case BIKERB__STATICRR: - case BIKERBV2__STATICRR: - case BIKER__STATICRR: - case MAKEOUT__STATICRR: - case CHEERB__STATICRR: - case CHEER__STATICRR: - case COOTPLAY__STATICRR: - case BILLYPLAY__STATICRR: - case MINIONBOAT__STATICRR: - case HULKBOAT__STATICRR: - case CHEERBOAT__STATICRR: - case RABBIT__STATICRR: - case ROCK__STATICRR: - case ROCK2__STATICRR: - case MAMACLOUD__STATICRR: - case MAMA__STATICRR: - if (!RRRA) goto default_case; - goto rr_badguy; - case BILLYRAYSTAYPUT__STATICRR: - case BRAYSNIPER__STATICRR: - case BUBBASTAND__STATICRR: - case HULKSTAYPUT__STATICRR: - case HENSTAYPUT__STATICRR: - case PIGSTAYPUT__STATICRR: - case MINIONSTAYPUT__STATICRR: - case COOTSTAYPUT__STATICRR: - case SBSWIPE__STATICRR: - case CHEERSTAYPUT__STATICRR: - case SBMOVE__STATICRR: - if ((RRRA && pSprite->picnum == TILE_SBMOVE) || (!RRRA && (pSprite->picnum == TILE_SBSWIPE || pSprite->picnum == TILE_CHEERSTAYPUT))) goto default_case; - pActor->actorstayput = pSprite->sectnum; - fallthrough__; - case BOULDER__STATICRR: - case BOULDER1__STATICRR: - //case RAT__STATIC: - case TORNADO__STATICRR: - case BILLYCOCK__STATICRR: - case BILLYRAY__STATICRR: - case DOGRUN__STATICRR: - case LTH__STATICRR: - case HULK__STATICRR: - case HEN__STATICRR: - //case DRONE__STATIC: - case PIG__STATICRR: - case MINION__STATICRR: - case UFO1__STATICRR: - case UFO2__STATICRR: - case UFO3__STATICRR: - case UFO4__STATICRR: - case UFO5__STATICRR: - case COW__STATICRR: - case COOT__STATICRR: - //case SHARK__STATIC: - case VIXEN__STATICRR: -rr_badguy: - pSprite->xrepeat = 40; - pSprite->yrepeat = 40; - switch (DYNAMICTILEMAP(pSprite->picnum)) - { - case VIXEN__STATICRR: - if (pSprite->pal == 34) - { - pSprite->xrepeat = 22; - pSprite->yrepeat = 21; - } - else - { - pSprite->xrepeat = 22; - pSprite->yrepeat = 20; - } - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case HULKHANG__STATICRR: - case HULKHANGDEAD__STATICRR: - case HULKJUMP__STATICRR: - case HULK__STATICRR: - case HULKSTAYPUT__STATICRR: - pSprite->xrepeat = 32; - pSprite->yrepeat = 32; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case COOTPLAY__STATICRR: - if (!RRRA) break; - fallthrough__; - case COOT__STATICRR: - case COOTSTAYPUT__STATICRR: - pSprite->xrepeat = 24; - pSprite->yrepeat = 18; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - pSprite->clipdist <<= 2; - break; - case DRONE__STATIC: - pSprite->xrepeat = 14; - pSprite->yrepeat = 7; - pSprite->clipdist = 128; - break; - case SBSWIPE__STATICRR: - case BILLYPLAY__STATICRR: - if (!RRRA) break; - fallthrough__; - case BILLYCOCK__STATICRR: - case BILLYRAY__STATICRR: - case BILLYRAYSTAYPUT__STATICRR: - case BRAYSNIPER__STATICRR: - case BUBBASTAND__STATICRR: - pSprite->xrepeat = 25; - pSprite->yrepeat = 21; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case COW__STATICRR: - pSprite->xrepeat = 32; - pSprite->yrepeat = 32; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case HEN__STATICRR: - case HENSTAYPUT__STATICRR: - case HENSTAND__STATICRR: - if (pSprite->pal == 35) - { - pSprite->xrepeat = 42; - pSprite->yrepeat = 30; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - } - else - { - pSprite->xrepeat = 21; - pSprite->yrepeat = 15; - pSprite->clipdist = 64; - } - break; - case MINION__STATICRR: - case MINIONSTAYPUT__STATICRR: - pSprite->xrepeat = 16; - pSprite->yrepeat = 16; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - if (RRRA && ufospawnsminion) - pSprite->pal = 8; - break; - case DOGRUN__STATICRR: - case PIG__STATICRR: - pSprite->xrepeat = 16; - pSprite->yrepeat = 16; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case RABBIT__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 18; - pSprite->yrepeat = 18; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case MAMACLOUD__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 64; - pSprite->yrepeat = 64; - pSprite->cstat = 2; - pSprite->cstat |= 512; - pSprite->x += (krand2() & 2047) - 1024; - pSprite->y += (krand2() & 2047) - 1024; - pSprite->z += (krand2() & 2047) - 1024; - break; - case MAMA__STATICRR: - if (!RRRA) break; - if (pSprite->pal == 30) - { - pSprite->xrepeat = 26; - pSprite->yrepeat = 26; - pSprite->clipdist = 75; - } - else if (pSprite->pal == 31) - { - pSprite->xrepeat = 36; - pSprite->yrepeat = 36; - pSprite->clipdist = 100; - } - else if (pSprite->pal == 32) - { - pSprite->xrepeat = 50; - pSprite->yrepeat = 50; - pSprite->clipdist = 100; - } - else - { - pSprite->xrepeat = 50; - pSprite->yrepeat = 50; - pSprite->clipdist = 100; - } - break; - case BIKERB__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 28; - pSprite->yrepeat = 22; - pSprite->clipdist = 72; - break; - case BIKERBV2__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 28; - pSprite->yrepeat = 22; - pSprite->clipdist = 72; - break; - case BIKER__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 28; - pSprite->yrepeat = 22; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case CHEERB__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 28; - pSprite->yrepeat = 22; - pSprite->clipdist = 72; - break; - case CHEER__STATICRR: - case CHEERSTAYPUT__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 20; - pSprite->yrepeat = 20; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case MAKEOUT__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 26; - pSprite->yrepeat = 26; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case MINIONBOAT__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 16; - pSprite->yrepeat = 16; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case HULKBOAT__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 48; - pSprite->yrepeat = 48; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case CHEERBOAT__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 32; - pSprite->yrepeat = 32; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case TORNADO__STATICRR: - pSprite->xrepeat = 64; - pSprite->yrepeat = 128; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - pSprite->clipdist >>= 2; - pSprite->cstat = 2; - break; - case LTH__STATICRR: - pSprite->xrepeat = 24; - pSprite->yrepeat = 22; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case ROCK__STATICRR: - case ROCK2__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 64; - pSprite->yrepeat = 64; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - case UFO1__STATICRR: - case UFO2__STATICRR: - case UFO3__STATICRR: - case UFO4__STATICRR: - case UFO5__STATICRR: - pSprite->xrepeat = 32; - pSprite->yrepeat = 32; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - pSprite->extra = 50; - break; - case SBMOVE__STATICRR: - if (RRRA) break; - pSprite->xrepeat = 48; - pSprite->yrepeat = 48; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - break; - } - - if (spriteNum >= 0) pSprite->lotag = 0; - - if ((pSprite->lotag > ud.player_skill) || ud.monsters_off == 1) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - else - { - makeitfall(newSprite); - - if (pSprite->picnum == TILE_RAT) - { - pSprite->ang = krand2() & 2047; - pSprite->xrepeat = pSprite->yrepeat = 48; - pSprite->cstat = 0; - } - else - { - pSprite->cstat |= 257; - - if (pSprite->picnum != TILE_SHARK) - if (!RR || actorflag(newSprite, SFLAG_KILLCOUNT)) - g_player[myconnectindex].ps->max_actors_killed++; - } - - if (spriteNum >= 0) - { - pActor->timetosleep = 0; - A_PlayAlertSound(newSprite); - changespritestat(newSprite, STAT_ACTOR); - } - else changespritestat(newSprite, STAT_ZOMBIEACTOR); - - pSprite->shade = sprite[spriteNum].shade; - } - - break; - case LOCATORS__STATIC: - pSprite->cstat |= 32768; - changespritestat(newSprite, STAT_LOCATOR); - break; - - case ACTIVATORLOCKED__STATIC: - case ACTIVATOR__STATIC: - if (RR) - { - pSprite->cstat |= 32768; - if (pSprite->picnum == TILE_ACTIVATORLOCKED) - sector[pSprite->sectnum].lotag ^= 16384; - } - else - { - pSprite->cstat = 32768; - if (pSprite->picnum == TILE_ACTIVATORLOCKED) - sector[pSprite->sectnum].lotag |= 16384; - } - changespritestat(newSprite, STAT_ACTIVATOR); - break; - - case DOORSHOCK__STATIC: - pSprite->cstat |= 1+256; - pSprite->shade = -12; - changespritestat(newSprite, STAT_STANDABLE); - break; - - case OOZ__STATIC: - case OOZ2__STATIC: - { - if (RR && pSprite->picnum == TILE_OOZ2) goto default_case; - pSprite->shade = -12; - - if (spriteNum >= 0) - { - if (sprite[spriteNum].picnum == TILE_NUKEBARREL) - pSprite->pal = 8; - if (!RR) - A_AddToDeleteQueue(newSprite); - } - - changespritestat(newSprite, STAT_ACTOR); - - getglobalz(newSprite); - - int const oozSize = (pActor->floorz-pActor->ceilingz)>>9; - - pSprite->yrepeat = oozSize; - pSprite->xrepeat = 25 - (oozSize >> 1); - pSprite->cstat |= (krand2() & 4); - - break; - } - - case REACTOR2__STATIC: - case REACTOR__STATIC: - pSprite->extra = impact_damage; - pSprite->cstat |= 257; - if ((!g_netServer && ud.multimode < 2) && pSprite->pal != 0) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - - pSprite->pal = 0; - pSprite->shade = -17; - - changespritestat(newSprite, STAT_ZOMBIEACTOR); - break; - - case HEAVYHBOMB__STATIC: - if (!RR && spriteNum >= 0) - pSprite->owner = spriteNum; - else pSprite->owner = newSprite; - - pSprite->xrepeat = pSprite->yrepeat = 9; - pSprite->yvel = 4; - pSprite->cstat |= 257; - - if ((!g_netServer && ud.multimode < 2) && pSprite->pal != 0) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - pSprite->pal = 0; - pSprite->shade = -17; - - changespritestat(newSprite, STAT_ZOMBIEACTOR); - break; - - case RECON__STATIC: - if (pSprite->lotag > ud.player_skill) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - goto SPAWN_END; - } - if (!RR || actorflag(newSprite, SFLAG_KILLCOUNT)) - g_player[myconnectindex].ps->max_actors_killed++; - pActor->t_data[5] = 0; - if (ud.monsters_off == 1) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - pSprite->extra = 130; - pSprite->cstat |= 257; // Make it hitable - - if ((!g_netServer && ud.multimode < 2) && pSprite->pal != 0) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - pSprite->pal = 0; - pSprite->shade = -17; - - changespritestat(newSprite, STAT_ZOMBIEACTOR); - 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: - case RRTILE43__STATICRR: - case BOWLINGBALLSPRITE__STATICRR: - case RPG2SPRITE__STATICRR: - case MOTOAMMO__STATICRR: - case BOATAMMO__STATICRR: - - if (RR && !RRRA && (pSprite->picnum == TILE_RPG2SPRITE || pSprite->picnum == TILE_MOTOAMMO || pSprite->picnum == TILE_BOATAMMO)) goto default_case; - - if (spriteNum >= 0) - { - pSprite->lotag = 0; - if (RR && pSprite->picnum == TILE_BOWLINGBALLSPRITE) - pSprite->zvel = 0; - else - { - pSprite->z -= ZOFFSET5; - pSprite->zvel = -1024; - } - A_SetSprite(newSprite, CLIPMASK0); - pSprite->cstat = krand2()&4; - } - else - { - pSprite->owner = newSprite; - pSprite->cstat = 0; - } - - if (((!g_netServer && ud.multimode < 2) && pSprite->pal != 0) || (pSprite->lotag > ud.player_skill)) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - - pSprite->pal = 0; - - if (pSprite->picnum == TILE_ATOMICHEALTH) - pSprite->cstat |= 128; - - fallthrough__; - case ACCESSCARD__STATIC: - if ((g_netServer || ud.multimode > 1) && !GTFLAGS(GAMETYPE_ACCESSCARDSPRITES) && pSprite->picnum == TILE_ACCESSCARD) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - else - { - if (pSprite->picnum == TILE_AMMO) - pSprite->xrepeat = pSprite->yrepeat = 16; - else pSprite->xrepeat = pSprite->yrepeat = 32; - } - - pSprite->shade = -17; - - if (spriteNum >= 0) - { - changespritestat(newSprite, STAT_ACTOR); - } - else - { - changespritestat(newSprite, STAT_ZOMBIEACTOR); - makeitfall(newSprite); - } - if (RR) - { - switch (DYNAMICTILEMAP(pSprite->picnum)) - { - case FIRSTGUNSPRITE__STATIC: - pSprite->xrepeat = 16; - pSprite->yrepeat = 16; - break; - case SHOTGUNAMMO__STATIC: - pSprite->xrepeat = 18; - pSprite->yrepeat = 17; - if (RRRA) - pSprite->cstat = 256; - break; - case SIXPAK__STATIC: - pSprite->xrepeat = 13; - pSprite->yrepeat = 9; - if (RRRA) - pSprite->cstat = 256; - break; - case FIRSTAID__STATIC: - pSprite->xrepeat = 8; - pSprite->yrepeat = 8; - break; - case COLA__STATIC: - pSprite->xrepeat = 5; - pSprite->yrepeat = 4; - break; - case AMMO__STATIC: - pSprite->xrepeat = 9; - pSprite->yrepeat = 9; - break; - case MOTOAMMO__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 23; - pSprite->yrepeat = 23; - break; - case BOATAMMO__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 16; - pSprite->yrepeat = 16; - break; - case JETPACK__STATIC: - pSprite->xrepeat = 8; - pSprite->yrepeat = 6; - break; - case STEROIDS__STATIC: - pSprite->xrepeat = 13; - pSprite->yrepeat = 9; - break; - case ACCESSCARD__STATIC: - pSprite->xrepeat = 11; - pSprite->yrepeat = 12; - break; - case HEATSENSOR__STATIC: - pSprite->xrepeat = 6; - pSprite->yrepeat = 4; - break; - case AIRTANK__STATIC: - pSprite->xrepeat = 19; - pSprite->yrepeat = 16; - break; - case BATTERYAMMO__STATIC: - pSprite->xrepeat = 15; - pSprite->yrepeat = 15; - break; - case BOWLINGBALLSPRITE__STATICRR: - pSprite->xrepeat = 11; - pSprite->yrepeat = 11; - break; - case TRIPBOMBSPRITE__STATIC: - pSprite->xrepeat = 11; - pSprite->yrepeat = 11; - pSprite->yvel = 4; - pSprite->xvel = 32; - break; - case RPGSPRITE__STATIC: - pSprite->xrepeat = 16; - pSprite->yrepeat = 14; - break; - case RPG2SPRITE__STATICRR: - if (!RRRA) break; - pSprite->xrepeat = 20; - pSprite->yrepeat = 20; - break; - case SHRINKERSPRITE__STATIC: - pSprite->xrepeat = 22; - pSprite->yrepeat = 13; - break; - case DEVISTATORSPRITE__STATIC: - pSprite->xrepeat = 18; - pSprite->yrepeat = 17; - break; - case RRTILE43__STATICRR: - pSprite->xrepeat = 12; - pSprite->yrepeat = 7; - break; - case GROWSPRITEICON__STATIC: - pSprite->xrepeat = 10; - pSprite->yrepeat = 9; - break; - case DEVISTATORAMMO__STATIC: - pSprite->xrepeat = 10; - pSprite->yrepeat = 9; - break; - case ATOMICHEALTH__STATIC: - pSprite->xrepeat = 8; - pSprite->yrepeat = 8; - break; - case FREEZESPRITE__STATIC: - pSprite->xrepeat = 17; - pSprite->yrepeat = 16; - break; - } - pSprite->shade = sector[pSprite->sectnum].floorshade; - } - break; - - case WATERFOUNTAIN__STATIC: - SLT(newSprite) = 1; - fallthrough__; - case TREE1__STATIC: - case TREE2__STATIC: - case TIRE__STATIC: - case CONE__STATIC: - case BOX__STATIC: - if (RR && (pSprite->picnum == TILE_CONE || pSprite->picnum == TILE_BOX)) goto default_case; - pSprite->cstat = 257; // Make it hitable - sprite[newSprite].extra = 1; - changespritestat(newSprite, STAT_STANDABLE); - break; - - case FLOORFLAME__STATIC: - if (RR) goto default_case; - pSprite->shade = -127; - changespritestat(newSprite, STAT_STANDABLE); - break; - - case BOUNCEMINE__STATIC: - if (RR) goto default_case; - pSprite->owner = newSprite; - pSprite->cstat |= 1+256; //Make it hitable - pSprite->xrepeat = pSprite->yrepeat = 24; - pSprite->shade = -127; - pSprite->extra = impact_damage<<2; - changespritestat(newSprite, STAT_ZOMBIEACTOR); - break; - case CAMERA1__STATIC: - pSprite->extra = 1; - pSprite->cstat &= 32768; - - if (g_damageCameras) - pSprite->cstat |= 257; - - if ((!g_netServer && ud.multimode < 2) && pSprite->pal != 0) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - } - else - { - pSprite->pal = 0; - changespritestat(newSprite, STAT_ACTOR); - } - break; - case CAMERAPOLE__STATIC: - pSprite->extra = 1; - pSprite->cstat &= 32768; - - if (g_damageCameras) - pSprite->cstat |= 257; - fallthrough__; - case GENERICPOLE__STATIC: - if (RR && pSprite->picnum == TILE_GENERICPOLE) goto default_case; - if ((!g_netServer && ud.multimode < 2) && pSprite->pal != 0) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - } - else - pSprite->pal = 0; - break; - - case STEAM__STATIC: - if (spriteNum >= 0) - { - pSprite->ang = sprite[spriteNum].ang; - pSprite->cstat = 16+128+2; - pSprite->xrepeat=pSprite->yrepeat=1; - pSprite->xvel = -8; - A_SetSprite(newSprite, CLIPMASK0); - } - fallthrough__; - case CEILINGSTEAM__STATIC: - changespritestat(newSprite, STAT_STANDABLE); - break; - - case SECTOREFFECTOR__STATIC: - pSprite->cstat |= 32768; - pSprite->xrepeat = pSprite->yrepeat = 0; - - switch (pSprite->lotag) - { -#ifdef LEGACY_ROR - case 40: - case 41: - if (RR) break; - pSprite->cstat = 32; - pSprite->xrepeat = pSprite->yrepeat = 64; - changespritestat(newSprite, STAT_EFFECTOR); - for (spriteNum=0; spriteNum < MAXSPRITES; spriteNum++) - if (sprite[spriteNum].picnum == TILE_SECTOREFFECTOR && (sprite[spriteNum].lotag == 40 || sprite[spriteNum].lotag == 41) && - sprite[spriteNum].hitag == pSprite->hitag && newSprite != spriteNum) - { -// Printf("found ror match\n"); - pSprite->yvel = spriteNum; - break; - } - goto SPAWN_END; - break; - case 46: - if (RR) break; - ror_protectedsectors[pSprite->sectnum] = 1; - /* XXX: fi.fall-through intended? */ - fallthrough__; -#endif - - case SE_49_POINT_LIGHT: - case SE_50_SPOT_LIGHT: -#ifdef POLYMER - { - int32_t j, nextj; - - for (TRAVERSE_SPRITE_SECT(headspritesect[pSprite->sectnum], j, nextj)) - if (sprite[j].picnum == TILE_ACTIVATOR || sprite[j].picnum == TILE_ACTIVATORLOCKED) - pActor->flags |= SFLAG_USEACTIVATOR; - } -#endif - changespritestat(newSprite, pSprite->lotag==46 ? STAT_EFFECTOR : STAT_LIGHT); - goto SPAWN_END; - break; - } - - pSprite->yvel = sector[sectNum].extra; - - switch (pSprite->lotag) - { - case SE_28_LIGHTNING: - if (!RR) - T6(newSprite) = 65;// Delay for lightning - break; - case SE_7_TELEPORT: // Transporters!!!! - case SE_23_ONE_WAY_TELEPORT:// XPTR END - if (pSprite->lotag != SE_23_ONE_WAY_TELEPORT) - { - for (spriteNum=0; spriteNumcstat = 0; - changespritestat(newSprite, STAT_TRANSPORT); - goto SPAWN_END; - case SE_1_PIVOT: - pSprite->owner = -1; - T1(newSprite) = 1; - break; - case SE_18_INCREMENTAL_SECTOR_RISE_FALL: - - if (pSprite->ang == 512) - { - T2(newSprite) = sector[sectNum].ceilingz; - if (pSprite->pal) - sector[sectNum].ceilingz = pSprite->z; - } - else - { - T2(newSprite) = sector[sectNum].floorz; - if (pSprite->pal) - sector[sectNum].floorz = pSprite->z; - } - - pSprite->hitag <<= 2; - break; - - case SE_19_EXPLOSION_LOWERS_CEILING: - pSprite->owner = -1; - break; - case SE_25_PISTON: // Pistons - if (RR) - T5(newSprite) = sector[sectNum].ceilingz; - else - { - T4(newSprite) = sector[sectNum].ceilingz; - T5(newSprite) = 1; - } - sector[sectNum].ceilingz = pSprite->z; - G_SetInterpolation(§or[sectNum].ceilingz); - break; - case SE_35: - sector[sectNum].ceilingz = pSprite->z; - break; - case SE_27_DEMO_CAM: - if (ud.recstat == 1) - { - pSprite->xrepeat=pSprite->yrepeat=64; - pSprite->cstat &= 32768; - } - break; - case 47: - case 48: - if (!RRRA) break; - fallthrough__; - case SE_12_LIGHT_SWITCH: - - T2(newSprite) = sector[sectNum].floorshade; - T3(newSprite) = sector[sectNum].ceilingshade; - break; - - case SE_13_EXPLOSIVE: - - T1(newSprite) = sector[sectNum].ceilingz; - T2(newSprite) = sector[sectNum].floorz; - - if (klabs(T1(newSprite)-pSprite->z) < klabs(T2(newSprite)-pSprite->z)) - pSprite->owner = 1; - else pSprite->owner = 0; - - if (pSprite->ang == 512) - { - if (pSprite->owner) - sector[sectNum].ceilingz = pSprite->z; - else - sector[sectNum].floorz = pSprite->z; -#ifdef YAX_ENABLE - { - int16_t cf=!pSprite->owner, bn=yax_getbunch(sectNum, cf); - int32_t jj, daz=SECTORFLD(sectNum,z, cf); - - if (bn >= 0) - { - for (SECTORS_OF_BUNCH(bn, cf, jj)) - { - SECTORFLD(jj,z, cf) = daz; - SECTORFLD(jj,stat, cf) &= ~256; - SECTORFLD(jj,stat, cf) |= 128 + 512+2048; - } - for (SECTORS_OF_BUNCH(bn, !cf, jj)) - { - SECTORFLD(jj,z, !cf) = daz; - SECTORFLD(jj,stat, !cf) &= ~256; - SECTORFLD(jj,stat, !cf) |= 128 + 512+2048; - } - } - } -#endif - } - else - sector[sectNum].ceilingz = sector[sectNum].floorz = pSprite->z; - - if (sector[sectNum].ceilingstat&1) - { - sector[sectNum].ceilingstat ^= 1; - T4(newSprite) = 1; - - if (!pSprite->owner && pSprite->ang==512) - { - sector[sectNum].ceilingstat ^= 1; - T4(newSprite) = 0; - } - - sector[sectNum].ceilingshade = - sector[sectNum].floorshade; - - if (pSprite->ang==512) - { - int const startwall = sector[sectNum].wallptr; - int const endwall = startwall + sector[sectNum].wallnum; - for (bssize_t j = startwall; j < endwall; j++) - { - int const nextSect = wall[j].nextsector; - - if (nextSect >= 0) - { - if (!(sector[nextSect].ceilingstat & 1)) - { - sector[sectNum].ceilingpicnum = sector[nextSect].ceilingpicnum; - sector[sectNum].ceilingshade = sector[nextSect].ceilingshade; - break; // Leave earily - } - } - } - } - } - - break; - - case SE_17_WARP_ELEVATOR: - { - T3(newSprite) = sector[sectNum].floorz; // Stopping loc - - int nextSectNum = nextsectorneighborz(sectNum, sector[sectNum].floorz, -1, -1); - - if (EDUKE32_PREDICT_TRUE(nextSectNum >= 0)) - T4(newSprite) = sector[nextSectNum].ceilingz; - else - { - // use elevator sector's ceiling as heuristic - T4(newSprite) = sector[sectNum].ceilingz; - - Printf(TEXTCOLOR_RED "WARNING: SE17 sprite %d using own sector's ceilingz to " - "determine when to warp. Sector %d adjacent to a door?\n", - newSprite, sectNum); - } - - nextSectNum = nextsectorneighborz(sectNum, sector[sectNum].ceilingz, 1, 1); - - if (EDUKE32_PREDICT_TRUE(nextSectNum >= 0)) - T5(newSprite) = sector[nextSectNum].floorz; - else - { - // heuristic - T5(newSprite) = sector[sectNum].floorz; - - Printf(TEXTCOLOR_RED "WARNING: SE17 sprite %d using own sector %d's floorz.\n", - newSprite, sectNum); - } - - if (numplayers < 2 && !g_netServer) - { - G_SetInterpolation(§or[sectNum].floorz); - G_SetInterpolation(§or[sectNum].ceilingz); - } - } - break; - - case SE_24_CONVEYOR: - pSprite->yvel <<= 1; - case SE_36_PROJ_SHOOTER: - break; - - case SE_20_STRETCH_BRIDGE: - { - int closestDist = INT32_MAX; - int closestWall = 0; - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall + sector[sectNum].wallnum; - - for (bssize_t findWall=startWall; findWallx - x, pSprite->y - y); - - if (d < closestDist) - { - closestDist = d; - closestWall = findWall; - } - } - - T2(newSprite) = closestWall; - - closestDist = INT32_MAX; - - for (bssize_t findWall=startWall; findWallx - x, pSprite->y - y); - - if (d < closestDist && findWall != T2(newSprite)) - { - closestDist = d; - closestWall = findWall; - } - } - - T3(newSprite) = closestWall; - } - - break; - - case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT: - { - - T4(newSprite)=sector[sectNum].floorshade; - - sector[sectNum].floorshade = pSprite->shade; - sector[sectNum].ceilingshade = pSprite->shade; - - pSprite->owner = sector[sectNum].ceilingpal << 8; - pSprite->owner |= sector[sectNum].floorpal; - - //fix all the walls; - - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall+sector[sectNum].wallnum; - - for (bssize_t w=startWall; wshade; - - if ((wall[w].cstat & 2) && wall[w].nextwall >= 0) - wall[wall[w].nextwall].shade = pSprite->shade; - } - break; - } - - case SE_31_FLOOR_RISE_FALL: - { - T2(newSprite) = sector[sectNum].floorz; - - if (pSprite->ang != 1536) - { - sector[sectNum].floorz = pSprite->z; - Yax_SetBunchZs(sectNum, YAX_FLOOR, pSprite->z); - } - - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall + sector[sectNum].wallnum; - - for (bssize_t w = startWall; w < endWall; ++w) - if (wall[w].hitag == 0) - wall[w].hitag = 9999; - - G_SetInterpolation(§or[sectNum].floorz); - Yax_SetBunchInterpolation(sectNum, YAX_FLOOR); - } - break; - - case SE_32_CEILING_RISE_FALL: - { - T2(newSprite) = sector[sectNum].ceilingz; - T3(newSprite) = pSprite->hitag; - - if (pSprite->ang != 1536) - { - sector[sectNum].ceilingz = pSprite->z; - Yax_SetBunchZs(sectNum, YAX_CEILING, pSprite->z); - } - - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall + sector[sectNum].wallnum; - - for (bssize_t w = startWall; w < endWall; ++w) - if (wall[w].hitag == 0) - wall[w].hitag = 9999; - - G_SetInterpolation(§or[sectNum].ceilingz); - Yax_SetBunchInterpolation(sectNum, YAX_CEILING); - } - break; - - case SE_4_RANDOM_LIGHTS: //Flashing lights - { - T3(newSprite) = sector[sectNum].floorshade; - - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall + sector[sectNum].wallnum; - - pSprite->owner = sector[sectNum].ceilingpal << 8; - pSprite->owner |= sector[sectNum].floorpal; - - for (bssize_t w = startWall; w < endWall; ++w) - if (wall[w].shade > T4(newSprite)) - T4(newSprite) = wall[w].shade; - } - break; - - case SE_9_DOWN_OPEN_DOOR_LIGHTS: - if (sector[sectNum].lotag && - labs(sector[sectNum].ceilingz-pSprite->z) > 1024) - sector[sectNum].lotag |= 32768u; //If its open - fallthrough__; - case SE_8_UP_OPEN_DOOR_LIGHTS: - //First, get the ceiling-floor shade - { - T1(newSprite) = sector[sectNum].floorshade; - T2(newSprite) = sector[sectNum].ceilingshade; - - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall + sector[sectNum].wallnum; - - for (bssize_t w = startWall; w < endWall; ++w) - if (wall[w].shade > T3(newSprite)) - T3(newSprite) = wall[w].shade; - - T4(newSprite) = 1; // Take Out; - } - break; - case 88: - //First, get the ceiling-floor shade - { - if (!RRRA) break; - T1(newSprite) = sector[sectNum].floorshade; - T2(newSprite) = sector[sectNum].ceilingshade; - - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall + sector[sectNum].wallnum; - - for (bssize_t w = startWall; w < endWall; ++w) - if (wall[w].shade > T3(newSprite)) - T3(newSprite) = wall[w].shade; - - T4(newSprite) = 1; // Take Out; - } - break; - - case SE_11_SWINGING_DOOR: // Pivitor rotater - T4(newSprite) = (pSprite->ang > 1024) ? 2 : -2; - fallthrough__; - case SE_0_ROTATING_SECTOR: - case SE_2_EARTHQUAKE: // Earthquakemakers - case SE_5_BOSS: // Boss Creature - case SE_6_SUBWAY: // Subway - case SE_14_SUBWAY_CAR: // Caboos - case SE_15_SLIDING_DOOR: // Subwaytype sliding door - case SE_16_REACTOR: // That rotating blocker reactor thing - case SE_26: // ESCELATOR - case SE_30_TWO_WAY_TRAIN: // No rotational subways - if (pSprite->lotag == SE_0_ROTATING_SECTOR) - { - if (sector[sectNum].lotag == ST_30_ROTATE_RISE_BRIDGE) - { - sprite[newSprite].clipdist = (pSprite->pal) ? 1 : 0; - T4(newSprite) = sector[sectNum].floorz; - sector[sectNum].hitag = newSprite; - } - - for (spriteNum = MAXSPRITES-1; spriteNum>=0; spriteNum--) - { - if (sprite[spriteNum].statnum < MAXSTATUS) - if (sprite[spriteNum].picnum == TILE_SECTOREFFECTOR && - sprite[spriteNum].lotag == SE_1_PIVOT && - sprite[spriteNum].hitag == pSprite->hitag) - { - if (pSprite->ang == 512) - { - pSprite->x = sprite[spriteNum].x; - pSprite->y = sprite[spriteNum].y; - } - break; - } - } - if (EDUKE32_PREDICT_FALSE(spriteNum == -1)) - { - Printf(TEXTCOLOR_RED "Found lonely Sector Effector (lotag 0) at (%d,%d)\n", - TrackerCast(pSprite->x),TrackerCast(pSprite->y)); - changespritestat(newSprite, STAT_ACTOR); - goto SPAWN_END; - } - pSprite->owner = spriteNum; - } - - { - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall+sector[sectNum].wallnum; - - T2(newSprite) = tempwallptr; - for (bssize_t w = startWall; w < endWall; ++w) - { - g_origins[tempwallptr].x = wall[w].x - pSprite->x; - g_origins[tempwallptr].y = wall[w].y - pSprite->y; - - tempwallptr++; - if (EDUKE32_PREDICT_FALSE(tempwallptr >= MAXANIMPOINTS)) - { - Bsprintf(tempbuf, "Too many moving sectors at (%d,%d).\n", - TrackerCast(wall[w].x), TrackerCast(wall[w].y)); - G_GameExit(tempbuf); - } - } - } - - if (pSprite->lotag == SE_5_BOSS || pSprite->lotag == SE_30_TWO_WAY_TRAIN || - pSprite->lotag == SE_6_SUBWAY || pSprite->lotag == SE_14_SUBWAY_CAR) - { -#ifdef YAX_ENABLE - int outerWall = -1; -#endif - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall + sector[sectNum].wallnum; - - pSprite->extra = (uint16_t)((uint16_t)sector[sectNum].hitag != UINT16_MAX); - - // TRAIN_SECTOR_TO_SE_INDEX - sector[sectNum].hitag = newSprite; - - spriteNum = 0; - - int foundWall = startWall; - - for (; foundWall= 0 && - sector[ wall[ foundWall ].nextsector].hitag == 0 && - ((int16_t)sector[ wall[ foundWall ].nextsector].lotag < 3 || (RRRA && (int16_t)sector[wall[foundWall].nextsector].lotag == 160))) - { -#ifdef YAX_ENABLE - outerWall = wall[foundWall].nextwall; -#endif - foundWall = wall[foundWall].nextsector; - spriteNum = 1; - break; - } - } - -#ifdef YAX_ENABLE - pActor->t_data[9] = -1; - - if (outerWall >= 0) - { - int upperSect = yax_vnextsec(outerWall, YAX_CEILING); - - if (upperSect >= 0) - { - int foundEffector = headspritesect[upperSect]; - - for (; foundEffector >= 0; foundEffector = nextspritesect[foundEffector]) - if (sprite[foundEffector].picnum == TILE_SECTOREFFECTOR && sprite[foundEffector].lotag == pSprite->lotag) - break; - - if (foundEffector < 0) - { - Sect_SetInterpolation(upperSect); - pActor->t_data[9] = upperSect; - } - } - } -#endif - if (spriteNum == 0) - { - Bsprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%d,%d).\n", - TrackerCast(pSprite->x),TrackerCast(pSprite->y)); - G_GameExit(tempbuf); - } - - pSprite->owner = -1; - T1(newSprite) = foundWall; - - if (pSprite->lotag != SE_30_TWO_WAY_TRAIN) - T4(newSprite) = pSprite->hitag; - } - else if (pSprite->lotag == SE_16_REACTOR) - T4(newSprite) = sector[sectNum].ceilingz; - else if (pSprite->lotag == SE_26) - { - T4(newSprite) = pSprite->x; - T5(newSprite) = pSprite->y; - pSprite->zvel = (pSprite->shade == sector[sectNum].floorshade) ? -256 : 256; // UP - pSprite->shade = 0; - } - else if (pSprite->lotag == SE_2_EARTHQUAKE) - { - T6(newSprite) = sector[pSprite->sectnum].floorheinum; - sector[pSprite->sectnum].floorheinum = 0; - } - } - - switch (pSprite->lotag) - { - case SE_6_SUBWAY: - case SE_14_SUBWAY_CAR: - S_FindMusicSFX(sectNum, &spriteNum); - // XXX: uh.. what? - if (spriteNum == -1) - { - if (RR && sector[pSprite->sectnum].floorpal == 7) - spriteNum = 456; - else - spriteNum = SUBWAY; - } - pActor->lastv.x = spriteNum; - fallthrough__; - case SE_30_TWO_WAY_TRAIN: - if (g_netServer || numplayers > 1) - break; - fallthrough__; - case SE_0_ROTATING_SECTOR: - case SE_1_PIVOT: - case SE_5_BOSS: - case SE_11_SWINGING_DOOR: - case SE_15_SLIDING_DOOR: - case SE_16_REACTOR: - case SE_26: Sect_SetInterpolation(sprite[newSprite].sectnum); break; - } - - if (RRRA && sprite[newSprite].lotag >= 150 && sprite[newSprite].lotag <= 155) - changespritestat(newSprite, STAT_RAROR); - else - changespritestat(newSprite, STAT_EFFECTOR); - break; - - case SEENINE__STATIC: - case OOZFILTER__STATIC: - pSprite->shade = -16; - if (pSprite->xrepeat <= 8) - { - pSprite->cstat = 32768; - pSprite->xrepeat = 0; - pSprite->yrepeat = 0; - } - else pSprite->cstat = 1+256; - - pSprite->extra = impact_damage << 2; - pSprite->owner = newSprite; - - changespritestat(newSprite, STAT_STANDABLE); - break; - - case CRACK1__STATIC: - case CRACK2__STATIC: - case CRACK3__STATIC: - case CRACK4__STATIC: - case FIREEXT__STATIC: - if (RR && pSprite->picnum == TILE_FIREEXT) goto default_case; - if (!RR && pSprite->picnum == TILE_FIREEXT) - { - pSprite->cstat = 257; - pSprite->extra = impact_damage<<2; - } - else - { - pSprite->cstat |= (pSprite->cstat & 48) ? 1 : 17; - pSprite->extra = 1; - } - - if ((!g_netServer && ud.multimode < 2) && pSprite->pal != 0) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - break; - } - - pSprite->pal = 0; - pSprite->owner = newSprite; - pSprite->xvel = 8; - - changespritestat(newSprite, STAT_STANDABLE); - A_SetSprite(newSprite,CLIPMASK0); - break; - - case EMPTYBIKE__STATICRR: - if (!RRRA) goto default_case; - if ((!g_netServer && ud.multimode < 2) && pSprite->pal == 1) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - break; - } - pSprite->pal = 0; - pSprite->xrepeat = 18; - pSprite->yrepeat = 18; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - pSprite->owner = 100; - pSprite->cstat = 257; - pSprite->lotag = 1; - changespritestat(newSprite, 1); - break; - case EMPTYBOAT__STATICRR: - if (!RRRA) goto default_case; - if ((!g_netServer && ud.multimode < 2) && pSprite->pal == 1) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - break; - } - pSprite->pal = 0; - pSprite->xrepeat = 32; - pSprite->yrepeat = 32; - pSprite->clipdist = mulscale7(pSprite->xrepeat, tilesiz[pSprite->picnum].x); - pSprite->owner = 20; - pSprite->cstat = 257; - pSprite->lotag = 1; - changespritestat(newSprite, 1); - break; - - case TOILET__STATIC: - case STALL__STATIC: - case RRTILE2121__STATICRR: - case RRTILE2122__STATICRR: - pSprite->lotag = 1; - pSprite->cstat |= 257; - pSprite->clipdist = 8; - pSprite->owner = newSprite; - break; - - case CANWITHSOMETHING2__STATIC: - case CANWITHSOMETHING3__STATIC: - case CANWITHSOMETHING4__STATIC: - if (RR) goto default_case; - fallthrough__; - case CANWITHSOMETHING__STATIC: - case RUBBERCAN__STATIC: - pSprite->extra = 0; - fallthrough__; - 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 (spriteNum >= 0) - pSprite->xrepeat = pSprite->yrepeat = 32; - pSprite->clipdist = 72; - makeitfall(newSprite); - if (spriteNum >= 0) - pSprite->owner = spriteNum; - else pSprite->owner = newSprite; - fallthrough__; - case EGG__STATIC: - if (ud.monsters_off == 1 && pSprite->picnum == TILE_EGG) - { - pSprite->xrepeat = pSprite->yrepeat = 0; - changespritestat(newSprite, STAT_MISC); - } - else - { - if (pSprite->picnum == TILE_EGG) - pSprite->clipdist = 24; - pSprite->cstat = 257|(krand2()&4); - changespritestat(newSprite, STAT_ZOMBIEACTOR); - } - break; - - case TOILETWATER__STATIC: - pSprite->shade = -16; - changespritestat(newSprite, STAT_STANDABLE); - break; - case RRTILE63__STATICRR: - pSprite->cstat |= 32768; - pSprite->xrepeat = 1; - pSprite->yrepeat = 1; - pSprite->clipdist = 1; - changespritestat(newSprite, 100); - break; - } - -SPAWN_END: - return newSprite; -} - static int G_MaybeTakeOnFloorPal(tspritetype *pSprite, int sectNum) { int const floorPal = sector[sectNum].floorpal; @@ -7741,7 +4818,7 @@ void A_SpawnRandomGlass(int spriteNum, int wallNum, int glassCnt) void GameInterface::FreeGameData() { - G_SetFog(0); + setmapfog(0); G_Cleanup(); } diff --git a/source/games/duke/src/zz_osdcmds.cpp b/source/games/duke/src/zz_osdcmds.cpp index b13866d7b..6c9b0d236 100644 --- a/source/games/duke/src/zz_osdcmds.cpp +++ b/source/games/duke/src/zz_osdcmds.cpp @@ -302,7 +302,7 @@ static int osdcmd_spawn(CCmdFuncPtr parm) return OSDCMD_SHOWHELP; } - idx = A_Spawn(g_player[myconnectindex].ps->i, picnum); + idx = fi.spawn(g_player[myconnectindex].ps->i, picnum); if (set & 1) sprite[idx].pal = (uint8_t)pal; if (set & 2) sprite[idx].cstat = (int16_t)cstat; if (set & 4) sprite[idx].ang = ang; diff --git a/source/games/duke/src/zz_player.cpp b/source/games/duke/src/zz_player.cpp index 94c2afa80..9e87521b1 100644 --- a/source/games/duke/src/zz_player.cpp +++ b/source/games/duke/src/zz_player.cpp @@ -628,7 +628,7 @@ growspark_rr: if (hitwal->hitag == 0) { - int const spawnedSprite = A_Spawn(spriteNum, projecTile); + int const spawnedSprite = fi.spawn(spriteNum, projecTile); sprite[spawnedSprite].xvel = -12; sprite[spawnedSprite].ang = (getangle(hitwal->x - wall[hitwal->point2].x, hitwal->y - wall[hitwal->point2].y) + 512) & 2047; @@ -657,7 +657,7 @@ growspark_rr: if (playerNum >= 0) { - int k = A_Spawn(kneeSprite, TILE_SMALLSMOKE); + int k = fi.spawn(kneeSprite, TILE_SMALLSMOKE); sprite[k].z -= ZOFFSET3; if (!RR || projecTile == TILE_KNEE) A_PlaySound(KICK_HIT, kneeSprite); @@ -688,7 +688,7 @@ growspark_rr: } else if(playerNum >= 0 && hitData.pos.z > 0 && sector[hitData.sect].lotag == 1) { - int splashSprite = A_Spawn(pPlayer->i, TILE_WATERSPLASH2); + int splashSprite = fi.spawn(pPlayer->i, TILE_WATERSPLASH2); sprite[splashSprite].x = hitData.pos.x; sprite[splashSprite].y = hitData.pos.y; sprite[splashSprite].ang = fix16_to_int(pPlayer->q16ang); // Total tweek @@ -745,7 +745,7 @@ growspark_rr: } if (!RR || sector[hitData.sect].lotag != ST_1_ABOVE_WATER) - A_Spawn(spawnedSprite, TILE_SMALLSMOKE); + fi.spawn(spawnedSprite, TILE_SMALLSMOKE); } if (hitData.sprite >= 0) @@ -758,7 +758,7 @@ growspark_rr: (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_TDM) && g_player[P_Get(hitData.sprite)].ps->team != g_player[P_Get(spriteNum)].ps->team))) { - int jibSprite = A_Spawn(spawnedSprite, TILE_JIBS6); + int jibSprite = fi.spawn(spawnedSprite, TILE_JIBS6); sprite[spawnedSprite].xrepeat = sprite[spawnedSprite].yrepeat = 0; sprite[jibSprite].z += ZOFFSET6; @@ -768,7 +768,7 @@ growspark_rr: } else { - A_Spawn(spawnedSprite, TILE_SMALLSMOKE); + fi.spawn(spawnedSprite, TILE_SMALLSMOKE); } if (playerNum >= 0 && CheckShootSwitchTile(sprite[hitData.sprite].picnum)) @@ -781,7 +781,7 @@ growspark_rr: { uwalltype const * const hitWall = (uwalltype *)&wall[hitData.wall]; - A_Spawn(spawnedSprite, TILE_SMALLSMOKE); + fi.spawn(spawnedSprite, TILE_SMALLSMOKE); if (fi.isadoorwall(hitWall->picnum) == 1) goto SKIPBULLETHOLE; @@ -811,7 +811,7 @@ growspark_rr: if (sprite[decalSprite].picnum == TILE_BULLETHOLE && dist(&sprite[decalSprite], &sprite[spawnedSprite]) < (12 + (krand2() & 7))) goto SKIPBULLETHOLE; - decalSprite = A_Spawn(spawnedSprite, TILE_BULLETHOLE); + decalSprite = fi.spawn(spawnedSprite, TILE_BULLETHOLE); sprite[decalSprite].xvel = -1; sprite[decalSprite].ang @@ -835,7 +835,7 @@ growspark_rr: { fi.checkhitsprite(hitData.sprite, spawnedSprite); if (sprite[hitData.sprite].picnum != TILE_APLAYER) - A_Spawn(spawnedSprite, TILE_SMALLSMOKE); + fi.spawn(spawnedSprite, TILE_SMALLSMOKE); else { sprite[spawnedSprite].xrepeat = 0; @@ -855,7 +855,7 @@ growspark_rr: case TRIPBOMBSPRITE__STATIC: { if (!RR) break; - int const newSprite = A_Spawn(spriteNum, projecTile); + int const newSprite = fi.spawn(spriteNum, projecTile); sprite[newSprite].xvel = 32; sprite[newSprite].ang = sprite[spriteNum].ang; sprite[newSprite].z -= (5<<8); @@ -864,7 +864,7 @@ growspark_rr: case BOWLINGBALL__STATICRR: { - int const newSprite = A_Spawn(spriteNum, projecTile); + int const newSprite = fi.spawn(spriteNum, projecTile); sprite[newSprite].xvel = 250; sprite[newSprite].ang = sprite[spriteNum].ang; sprite[newSprite].z -= (15<<8); @@ -1717,7 +1717,7 @@ static void P_DoWeaponSpawn(int playerNum) if (PWEAPON(playerNum, pPlayer->curr_weapon, Spawn) <= 0) // <=0 : AMC TC beta/RC2 has WEAPONx_SPAWN -1 return; - int newSprite = A_Spawn(pPlayer->i, PWEAPON(playerNum, pPlayer->curr_weapon, Spawn)); + int newSprite = fi.spawn(pPlayer->i, PWEAPON(playerNum, pPlayer->curr_weapon, Spawn)); if ((PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_SPAWNTYPE2)) { @@ -4602,7 +4602,7 @@ void checkweapons(DukePlayer_t* const pPlayer) { if (pPlayer->OnMotorcycle) { - int const newSprite = A_Spawn(pPlayer->i, TILE_EMPTYBIKE); + int const newSprite = fi.spawn(pPlayer->i, TILE_EMPTYBIKE); sprite[newSprite].ang = fix16_to_int(pPlayer->q16ang); sprite[newSprite].owner = pPlayer->ammo_amount[MOTORCYCLE_WEAPON]; pPlayer->OnMotorcycle = 0; @@ -4618,7 +4618,7 @@ void checkweapons(DukePlayer_t* const pPlayer) } else if (pPlayer->OnBoat) { - int const newSprite = A_Spawn(pPlayer->i, TILE_EMPTYBOAT); + int const newSprite = fi.spawn(pPlayer->i, TILE_EMPTYBOAT); sprite[newSprite].ang = fix16_to_int(pPlayer->q16ang); sprite[newSprite].owner = pPlayer->ammo_amount[BOAT_WEAPON]; pPlayer->OnBoat = 0; @@ -4638,7 +4638,7 @@ void checkweapons(DukePlayer_t* const pPlayer) return; if (krand2() & 1) - A_Spawn(pPlayer->i, WeaponPickupSprites[currentWeapon]); + fi.spawn(pPlayer->i, WeaponPickupSprites[currentWeapon]); else switch (DYNAMICWEAPONMAP(currentWeapon)) { @@ -4646,7 +4646,7 @@ void checkweapons(DukePlayer_t* const pPlayer) if (!RRRA) break; fallthrough__; case RPG_WEAPON__STATIC: - case HANDBOMB_WEAPON__STATIC: A_Spawn(pPlayer->i, TILE_EXPLOSION2); break; + case HANDBOMB_WEAPON__STATIC: fi.spawn(pPlayer->i, TILE_EXPLOSION2); break; } if (RR) @@ -4655,7 +4655,7 @@ void checkweapons(DukePlayer_t* const pPlayer) { if (pPlayer->keys[key] == 1) { - int const newSprite = A_Spawn(pPlayer->i, TILE_ACCESSCARD); + int const newSprite = fi.spawn(pPlayer->i, TILE_ACCESSCARD); switch (key) { case 1: @@ -5526,7 +5526,7 @@ static void P_ProcessWeapon(int playerNum) if (((*weaponFrame) % 3) == 0) { - spriteNum = A_Spawn(pPlayer->i, TILE_SHELL); + spriteNum = fi.spawn(pPlayer->i, TILE_SHELL); sprite[spriteNum].ang += 1024; sprite[spriteNum].ang &= 2047; @@ -6131,7 +6131,7 @@ static void P_ProcessWeapon(int playerNum) } else if ((*weaponFrame) == 2) { - A_Spawn(pPlayer->i, TILE_SHELL); + fi.spawn(pPlayer->i, TILE_SHELL); } if (++(*weaponFrame) >= 5) @@ -6195,7 +6195,7 @@ static void P_ProcessWeapon(int playerNum) pPlayer->kickback_pic++; break; case 24: - spriteNum = A_Spawn(pPlayer->i, TILE_SHOTGUNSHELL); + spriteNum = fi.spawn(pPlayer->i, TILE_SHOTGUNSHELL); sprite[spriteNum].ang += 1024; A_SetSprite(spriteNum, CLIPMASK0); sprite[spriteNum].ang += 1024; @@ -6216,7 +6216,7 @@ static void P_ProcessWeapon(int playerNum) if (((*weaponFrame) % 3) == 0) { - spriteNum = A_Spawn(pPlayer->i, TILE_SHELL); + spriteNum = fi.spawn(pPlayer->i, TILE_SHELL); sprite[spriteNum].ang += 1024; sprite[spriteNum].ang &= 2047; @@ -6620,7 +6620,7 @@ static void P_DoWater(int const playerNum, int const playerBits, int const floor if (pPlayer->scuba_on && (krand2()&255) < 8) { - int const spriteNum = A_Spawn(pPlayer->i, TILE_WATERBUBBLE); + int const spriteNum = fi.spawn(pPlayer->i, TILE_WATERBUBBLE); int const q16ang = fix16_to_int(pPlayer->q16ang); sprite[spriteNum].x += sintable[(q16ang + 512 + 64 - (g_globalRandom & 128)+(RR ? 128 : 0)) & 2047] >> 6; @@ -7705,7 +7705,7 @@ check_enemy_sprite: if (pPlayer->on_ground == 1) { if (pPlayer->dummyplayersprite < 0) - pPlayer->dummyplayersprite = A_Spawn(pPlayer->i,TILE_PLAYERONWATER); + pPlayer->dummyplayersprite = fi.spawn(pPlayer->i,TILE_PLAYERONWATER); pPlayer->footprintcount = 6; //sprite[pPlayer->dummyplayersprite].cstat |= 32768; @@ -7753,10 +7753,10 @@ check_enemy_sprite: { switch (krand2() & 3) { - case 0: spriteNum = A_Spawn(pPlayer->i, TILE_FOOTPRINTS); break; - case 1: spriteNum = A_Spawn(pPlayer->i, TILE_FOOTPRINTS2); break; - case 2: spriteNum = A_Spawn(pPlayer->i, TILE_FOOTPRINTS3); break; - default: spriteNum = A_Spawn(pPlayer->i, TILE_FOOTPRINTS4); break; + case 0: spriteNum = fi.spawn(pPlayer->i, TILE_FOOTPRINTS); break; + case 1: spriteNum = fi.spawn(pPlayer->i, TILE_FOOTPRINTS2); break; + case 2: spriteNum = fi.spawn(pPlayer->i, TILE_FOOTPRINTS3); break; + default: spriteNum = fi.spawn(pPlayer->i, TILE_FOOTPRINTS4); break; } sprite[spriteNum].pal = pPlayer->footprintpal; sprite[spriteNum].shade = pPlayer->footprintshade; @@ -8598,7 +8598,7 @@ HORIZONLY:; dist(&sprite[pPlayer->i], &sprite[pPlayer->actorsqu]) < 1400) { A_DoGuts(pPlayer->actorsqu, TILE_JIBS6, 7); - A_Spawn(pPlayer->actorsqu, TILE_BLOODPOOL); + fi.spawn(pPlayer->actorsqu, TILE_BLOODPOOL); A_PlaySound(SQUISHED, pPlayer->actorsqu); switch (DYNAMICTILEMAP(sprite[pPlayer->actorsqu].picnum)) { diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index 7eb49ca88..462274b6f 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -1261,8 +1261,8 @@ static void prelevel(char g) if (RRRA) { - G_SetFog(0); - g_fogType = 0; + setmapfog(0); + fogactive = 0; ufospawnsminion = 0; pistonsound = 0; enemysizecheat = 0; @@ -1578,14 +1578,14 @@ static void prelevel(char g) for (size_t i = 0; i < MAXSPRITES; i++) { if (sprite[i].statnum < MAXSTATUS && (DEER || PN(i) != TILE_SECTOREFFECTOR || SLT(i) != SE_14_SUBWAY_CAR)) - A_Spawn(-1, i); + fi.spawn(-1, i); } if (!DEER) for (size_t i = 0; i < MAXSPRITES; i++) { if (sprite[i].statnum < MAXSTATUS && PN(i) == TILE_SECTOREFFECTOR && SLT(i) == SE_14_SUBWAY_CAR) - A_Spawn(-1, i); + fi.spawn(-1, i); if (RR && sprite[i].picnum == TILE_RRTILE19) A_DeleteSprite(i); if (RR && sprite[i].picnum == TILE_RRTILE34) @@ -2460,7 +2460,7 @@ int G_EnterLevel(int gameMode) return 0; } -void G_SetFog(int fogtype) +void setmapfog(int fogtype) { GLInterface.SetMapFog(fogtype != 0); } diff --git a/source/games/duke/src/zz_savegame.cpp b/source/games/duke/src/zz_savegame.cpp index 4b4ae6356..0e6485bb6 100644 --- a/source/games/duke/src/zz_savegame.cpp +++ b/source/games/duke/src/zz_savegame.cpp @@ -906,7 +906,7 @@ static const dataspec_t svgm_anmisc[] = { 0, &g_chickenWeaponTimer, sizeof(g_chickenWeaponTimer), 1 }, { 0, &RRRA_ExitedLevel, sizeof(RRRA_ExitedLevel), 1 }, { 0, &RRRA_EndEpisode, sizeof(RRRA_EndEpisode), 1 }, - { 0, &g_fogType, sizeof(g_fogType), 1 }, + { 0, &fogactive, sizeof(fogactive), 1 }, { DS_LOADFN, (void *)sv_rrrafog, 0, 1 }, { DS_SAVEFN, (void *)&sv_restsave, 0, 1 }, @@ -1403,7 +1403,7 @@ int32_t sv_updatestate(int32_t frominit) static void sv_rrrafog() { - G_SetFog(g_fogType ? 2 : 0); + setmapfog(fogactive ? 2 : 0); } static void postloadplayer(int32_t savegamep)