diff --git a/source/build/include/clip.h b/source/build/include/clip.h index e4a231698..22e88654d 100644 --- a/source/build/include/clip.h +++ b/source/build/include/clip.h @@ -98,4 +98,15 @@ int32_t clipmovex(vec3_t *const pos, int16_t *const sectnum, int32_t xvect, int3 int pushmove(vec3_t *const vect, int16_t *const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist, uint32_t const cliptype, bool clear = true) ATTRIBUTE((nonnull(1, 2))); +inline int pushmove(int* x, int* y, int* z, int16_t* const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist, + uint32_t const cliptype, bool clear = true) +{ + vec3_t v = { *x,*y,*z }; + auto r = pushmove(&v, sectnum, walldist, ceildist, flordist, cliptype, clear); + *x = v.x; + *y = v.y; + *z = v.z; + return r; +} + #endif diff --git a/source/games/duke/src/actors.h b/source/games/duke/src/actors.h index d6091ee35..0ef79e343 100644 --- a/source/games/duke/src/actors.h +++ b/source/games/duke/src/actors.h @@ -284,6 +284,8 @@ inline int wallswitchcheck(int s) int A_IncurDamage(int spriteNum); void A_AddToDeleteQueue(int spriteNum); void A_DeleteSprite(int spriteNum); +void guts(spritetype* s, short gtype, short n, short p); + void A_DoGuts(int spriteNum, int tileNum, int spawnCnt); void A_DoGutsDir(int spriteNum, int tileNum, int spawnCnt); void movecyclers(void); @@ -452,6 +454,7 @@ void respawn_rrra(int i, int j); void hitradius(short i, int r, int hp1, int hp2, int hp3, int hp4); int ifhitbyweapon(int sn); int movesprite(short spritenum, int xchange, int ychange, int zchange, unsigned int cliptype); +void lotsofmoney(spritetype* s, short n); // tile names which are identical for all games. enum diff --git a/source/games/duke/src/duke3d_ed.h b/source/games/duke/src/duke3d_ed.h index e3545af5d..c1d2de7f5 100644 --- a/source/games/duke/src/duke3d_ed.h +++ b/source/games/duke/src/duke3d_ed.h @@ -201,7 +201,7 @@ static inline int32_t G_HaveActor(int spriteNum) return g_tile[spriteNum].execPtr!=NULL; } -static inline int32_t G_DefaultActorHealth(int spriteNum) +static inline int32_t G_DefaultActorHealth(int spriteNum) // rename! { return G_HaveActor(spriteNum) ? g_tile[spriteNum].execPtr[0] : 0; } diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index 46db388fb..534d56625 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -244,10 +244,13 @@ void Yax_SetBunchZs(int32_t sectnum, int32_t cf, int32_t daz); void G_PostCreateGameState(void); void A_SpawnCeilingGlass(int spriteNum,int sectNum,int glassCnt); +#define ceilingglass A_SpawnCeilingGlass void A_SpawnGlass(int spriteNum,int glassCnt); void A_SpawnRandomGlass(int spriteNum,int wallNum,int glassCnt); +#define lotsofcolourglass A_SpawnRandomGlass void A_SpawnWallGlass(int spriteNum,int wallnum,int glassCnt); -void A_SpawnWallPopcorn(int spriteNum,int wallnum,int glassCnt); +#define lotsofglass A_SpawnWallGlass +void lotsofpopcorn(int spriteNum,int wallnum,int glassCnt); void G_AddUserQuote(const char *daquote); void G_BackToMenu(void); void G_DumpDebugInfo(void); diff --git a/source/games/duke/src/global.h b/source/games/duke/src/global.h index 03094dbd2..1ebffdfeb 100644 --- a/source/games/duke/src/global.h +++ b/source/games/duke/src/global.h @@ -121,6 +121,7 @@ G_EXTERN int32_t g_doQuickSave; G_EXTERN int32_t g_earthquakeTime; #define earthquaketime g_earthquakeTime G_EXTERN int32_t g_freezerSelfDamage; +#define freezerhurtowner g_freezerSelfDamage G_EXTERN int32_t g_gameQuit; G_EXTERN int32_t g_globalRandom; #define global_random g_globalRandom @@ -218,7 +219,7 @@ G_EXTERN int32_t g_windTime, g_windDir; G_EXTERN int16_t g_fakeBubbaCnt, g_mamaSpawnCnt, g_banjoSong, g_bellTime, g_bellSprite; #define BellTime g_bellTime #define word_119BE0 g_bellSprite -G_EXTERN uint8_t g_spriteExtra[MAXSPRITES], g_sectorExtra[MAXSECTORS]; +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, g_RAendLevel, g_RAendEpisode, g_fogType; G_EXTERN int32_t g_cdTrack; #define raat607 enemysizecheat // only as a reminder diff --git a/source/games/duke/src/sector.h b/source/games/duke/src/sector.h index 8901827dd..62dad35cd 100644 --- a/source/games/duke/src/sector.h +++ b/source/games/duke/src/sector.h @@ -104,11 +104,8 @@ typedef struct { } map_t; -void G_ActivateBySector(int sect,int spriteNum); -inline void activatebysector(int s, int sn) -{ - G_ActivateBySector(s, sn); -} +void breakwall(short newpn, short spr, short dawallnum); +void activatebysector(int s, int sn); int S_FindMusicSFX(int sectNum, int *sndptr); void callsound2(int soundNum, int playerNum); int callsound(int sectNum,int spriteNum); @@ -117,20 +114,16 @@ inline int hitasprite(int s, int16_t* h) { return A_CheckHitSprite(s, h); } -void A_DamageObject(int spriteNum,int dmgSrc); -inline void checkhitsprite(int s, int d) +void checkhitsprite(int s, int d); +void checkhitwall(int spr, int wal, int x, int y, int z, int w); +inline void A_DamageWall(int spr, int dawallnum, const vec3_t* pos, int weaponNum) { - A_DamageObject(s, d); -} -void A_DamageWall(int spr,int dawallnum,const vec3_t *pos,int weaponNum); -inline void checkhitwall(int spr, int wal, int x, int y, int z, int w) -{ - vec3_t vec{ x, y, z }; - A_DamageWall(spr, wal, &vec, w); + checkhitwall(spr, dawallnum, pos->x, pos->y, pos->z, weaponNum); } + int findplayer(const spritetype* pSprite, int32_t* dist); void operatejaildoors(int hitag); -void G_AlignWarpElevators(void); +void allignwarpelevators(void); bool isadoorwall(int tileNum); bool isablockdoor(int tileNum); void G_AnimateCamSprite(int smoothRatio); @@ -149,8 +142,7 @@ bool isanearoperator(int lotag); bool isanunderoperator(int lotag); bool checkhitswitch(int playerNum, int wallOrSprite, int nSwitchType); void P_CheckSectors(int playerNum); -void Sect_DamageCeiling(int sectNum); -inline void checkhitceiling(int sec) { Sect_DamageCeiling(sec); } +bool checkhitceiling(int sec); int setanimation(short animsect, int* animptr, int thegoal, int thevel); void G_DoFurniture(int wallNum, int sectNum, int playerNum); void dotorch(); diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index f30be31f8..f82b1885d 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -57,6 +57,16 @@ void operateforcefields_r(int s, int low); void operateforcefields_d(int s, int low); bool checkhitswitch_d(int snum, int w, int switchtype); bool checkhitswitch_r(int snum, int w, int switchtype); +void activatebysector_d(int sect, int j); +void activatebysector_r(int sect, int j); +void checkhitwall_d(int spr, int dawallnum, int x, int y, int z, int atwith); +void checkhitwall_r(int spr, int dawallnum, int x, int y, int z, int atwith); +void checkplayerhurt_d(struct player_struct* p, int j); +void checkplayerhurt_r(struct player_struct* p, int j); +bool checkhitceiling_d(int sn); +bool checkhitceiling_r(int sn); +void checkhitsprite_d(int i, int sn); +void checkhitsprite_r(int i, int sn); bool isadoorwall(int dapic) { @@ -83,6 +93,31 @@ bool checkhitswitch(int snum, int w, int switchtype) return isRR() ? checkhitswitch_r(snum, w, switchtype) : checkhitswitch_d(snum, w, switchtype); } +void activatebysector(int sect, int j) +{ + if (isRR()) activatebysector_r(sect, j); else activatebysector_d(sect, j); +} + +void checkhitwall(int spr, int dawallnum, int x, int y, int z, int atwith) +{ + if (isRR()) checkhitwall_r(spr, dawallnum, x, y, z, atwith); else checkhitwall_d(spr, dawallnum, x, y, z, atwith); +} + +void checkplayerhurt(struct player_struct* p, int j) +{ + if (isRR()) checkplayerhurt_r(p, j); else checkplayerhurt_d(p, j); +} + +bool checkhitceiling(int sn) +{ + return isRR() ? checkhitceiling_r(sn) : checkhitceiling_d(sn); +} + +void checkhitsprite(int i, int sn) +{ + if (isRR()) checkhitsprite_r(i, sn); else checkhitsprite_d(i, sn); +} + //--------------------------------------------------------------------------- // // @@ -1094,6 +1129,51 @@ void operateforcefields_common(int s, int low, const std::initializer_list } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void breakwall(short newpn, short spr, short dawallnum) +{ + wall[dawallnum].picnum = newpn; + spritesound(VENT_BUST, spr); + spritesound(GLASS_HEAVYBREAK, spr); + lotsofglass(spr, dawallnum, 10); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void allignwarpelevators(void) +{ + short i, j; + + i = headspritestat[STAT_EFFECTOR]; + while (i >= 0) + { + if (sprite[i].lotag == SE_17_WARP_ELEVATOR && sprite[i].shade > 16) + { + j = headspritestat[STAT_EFFECTOR]; + while (j >= 0) + { + if ((sprite[j].lotag) == SE_17_WARP_ELEVATOR && i != j && + (sprite[i].hitag) == (sprite[j].hitag)) + { + sector[sprite[j].sectnum].floorz = sector[sprite[i].sectnum].floorz; + sector[sprite[j].sectnum].ceilingz = sector[sprite[i].sectnum].ceilingz; + } + + j = nextspritestat[j]; + } + } + i = nextspritestat[i]; + } +} diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index bba2988b8..eb59a0a0d 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -600,6 +600,861 @@ bool checkhitswitch_d(int snum, int w, int switchtype) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void activatebysector_d(int sect, int j) +{ + short i, didit; + + didit = 0; + + i = headspritesect[sect]; + while (i >= 0) + { + if (sprite[i].picnum == ACTIVATOR) + { + operateactivators(sprite[i].lotag, -1); + didit = 1; + // return; + } + i = nextspritesect[i]; + } + + if (didit == 0) + operatesectors(sect, j); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void checkhitwall_d(int spr, int dawallnum, int x, int y, int z, int atwith) +{ + short j, i, sn = -1, darkestwall; + walltype* wal; + + wal = &wall[dawallnum]; + + if (wal->overpicnum == MIRROR) + { + switch (atwith) + { + case HEAVYHBOMB: + case RADIUSEXPLOSION: + case RPG: + case HYDRENT: + case SEENINE: + case OOZFILTER: + case EXPLODINGBARREL: + lotsofglass(spr, dawallnum, 70); + wal->cstat &= ~16; + wal->overpicnum = MIRRORBROKE; + spritesound(GLASS_HEAVYBREAK, spr); + return; + } + } + + if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->nextsector >= 0) + if (sector[wal->nextsector].floorz > z) + if (sector[wal->nextsector].floorz - sector[wal->nextsector].ceilingz) + switch (wal->overpicnum) + { + case W_FORCEFIELD: + case W_FORCEFIELD + 1: + case W_FORCEFIELD + 2: + wal->extra = 1; // tell the forces to animate + case BIGFORCE: + updatesector(x, y, &sn); + if (sn < 0) return; + + if (atwith == -1) + i = EGS(sn, x, y, z, FORCERIPPLE, -127, 8, 8, 0, 0, 0, spr, 5); + else + { + if (atwith == CHAINGUN) + i = EGS(sn, x, y, z, FORCERIPPLE, -127, 16 + sprite[spr].xrepeat, 16 + sprite[spr].yrepeat, 0, 0, 0, spr, 5); + else i = EGS(sn, x, y, z, FORCERIPPLE, -127, 32, 32, 0, 0, 0, spr, 5); + } + + sprite[i].cstat |= 18 + 128; + sprite[i].ang = getangle(wal->x - wall[wal->point2].x, + wal->y - wall[wal->point2].y) - 512; + + spritesound(SOMETHINGHITFORCE, i); + + return; + + case FANSPRITE: + wal->overpicnum = FANSPRITEBROKE; + wal->cstat &= 65535 - 65; + if (wal->nextwall >= 0) + { + wall[wal->nextwall].overpicnum = FANSPRITEBROKE; + wall[wal->nextwall].cstat &= 65535 - 65; + } + spritesound(VENT_BUST, spr); + spritesound(GLASS_BREAKING, spr); + return; + + case GLASS: + updatesector(x, y, &sn); if (sn < 0) return; + wal->overpicnum = GLASS2; + lotsofglass(spr, dawallnum, 10); + wal->cstat = 0; + + if (wal->nextwall >= 0) + wall[wal->nextwall].cstat = 0; + + i = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].getang(), 0, 0, spr, 3); + sprite[i].lotag = 128; hittype[i].temp_data[1] = 5; hittype[i].temp_data[2] = dawallnum; + spritesound(GLASS_BREAKING, i); + return; + case STAINGLASS1: + updatesector(x, y, &sn); if (sn < 0) return; + lotsofcolourglass(spr, dawallnum, 80); + wal->cstat = 0; + if (wal->nextwall >= 0) + wall[wal->nextwall].cstat = 0; + spritesound(VENT_BUST, spr); + spritesound(GLASS_BREAKING, spr); + return; + } + + switch (wal->picnum) + { + case COLAMACHINE: + case VENDMACHINE: + breakwall(wal->picnum + 2, spr, dawallnum); + spritesound(VENT_BUST, spr); + return; + + case OJ: + case FEMPIC2: + case FEMPIC3: + + case SCREENBREAK6: + case SCREENBREAK7: + case SCREENBREAK8: + + case SCREENBREAK1: + case SCREENBREAK2: + case SCREENBREAK3: + case SCREENBREAK4: + case SCREENBREAK5: + + case SCREENBREAK9: + case SCREENBREAK10: + case SCREENBREAK11: + case SCREENBREAK12: + case SCREENBREAK13: + case SCREENBREAK14: + case SCREENBREAK15: + case SCREENBREAK16: + case SCREENBREAK17: + case SCREENBREAK18: + case SCREENBREAK19: + case BORNTOBEWILDSCREEN: + + lotsofglass(spr, dawallnum, 30); + wal->picnum = W_SCREENBREAK + (krand() % 3); + spritesound(GLASS_HEAVYBREAK, spr); + return; + + case W_TECHWALL5: + case W_TECHWALL6: + case W_TECHWALL7: + case W_TECHWALL8: + case W_TECHWALL9: + breakwall(wal->picnum + 1, spr, dawallnum); + return; + case W_MILKSHELF: + breakwall(W_MILKSHELFBROKE, spr, dawallnum); + return; + + case W_TECHWALL10: + breakwall(W_HITTECHWALL10, spr, dawallnum); + return; + + case W_TECHWALL1: + case W_TECHWALL11: + case W_TECHWALL12: + case W_TECHWALL13: + case W_TECHWALL14: + breakwall(W_HITTECHWALL1, spr, dawallnum); + return; + + case W_TECHWALL15: + breakwall(W_HITTECHWALL15, spr, dawallnum); + return; + + case W_TECHWALL16: + breakwall(W_HITTECHWALL16, spr, dawallnum); + return; + + case W_TECHWALL2: + breakwall(W_HITTECHWALL2, spr, dawallnum); + return; + + case W_TECHWALL3: + breakwall(W_HITTECHWALL3, spr, dawallnum); + return; + + case W_TECHWALL4: + breakwall(W_HITTECHWALL4, spr, dawallnum); + return; + + case ATM: + wal->picnum = ATMBROKE; + lotsofmoney(&sprite[spr], 1 + (krand() & 7)); + spritesound(GLASS_HEAVYBREAK, spr); + break; + + case WALLLIGHT1: + case WALLLIGHT2: + case WALLLIGHT3: + case WALLLIGHT4: + case TECHLIGHT2: + case TECHLIGHT4: + + if (rnd(128)) + spritesound(GLASS_HEAVYBREAK, spr); + else spritesound(GLASS_BREAKING, spr); + lotsofglass(spr, dawallnum, 30); + + if (wal->picnum == WALLLIGHT1) + wal->picnum = WALLLIGHTBUST1; + + if (wal->picnum == WALLLIGHT2) + wal->picnum = WALLLIGHTBUST2; + + if (wal->picnum == WALLLIGHT3) + wal->picnum = WALLLIGHTBUST3; + + if (wal->picnum == WALLLIGHT4) + wal->picnum = WALLLIGHTBUST4; + + if (wal->picnum == TECHLIGHT2) + wal->picnum = TECHLIGHTBUST2; + + if (wal->picnum == TECHLIGHT4) + wal->picnum = TECHLIGHTBUST4; + + if (!wal->lotag) return; + + sn = wal->nextsector; + if (sn < 0) return; + darkestwall = 0; + + wal = &wall[sector[sn].wallptr]; + for (i = sector[sn].wallnum; i > 0; i--, wal++) + if (wal->shade > darkestwall) + darkestwall = wal->shade; + + j = krand() & 1; + i = headspritestat[3]; + while (i >= 0) + { + if (sprite[i].hitag == wall[dawallnum].lotag && sprite[i].lotag == 3) + { + hittype[i].temp_data[2] = j; + hittype[i].temp_data[3] = darkestwall; + hittype[i].temp_data[4] = 1; + } + i = nextspritestat[i]; + } + break; + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void checkplayerhurt_d(struct player_struct* p, int j) +{ + if ((j & 49152) == 49152) + { + j &= (MAXSPRITES - 1); + + switch (sprite[j].picnum) + { + case CACTUS: + if (p->hurt_delay < 8) + { + sprite[p->i].extra -= 5; + p->hurt_delay = 16; + SetPlayerPal(p, PalEntry(32, 32, 0, 0)); + spritesound(DUKE_LONGTERM_PAIN, p->i); + } + break; + } + return; + } + + if ((j & 49152) != 32768) return; + j &= (MAXWALLS - 1); + + if (p->hurt_delay > 0) p->hurt_delay--; + else if (wall[j].cstat & 85) switch (wall[j].overpicnum) + { + case W_FORCEFIELD: + case W_FORCEFIELD + 1: + case W_FORCEFIELD + 2: + sprite[p->i].extra -= 5; + + p->hurt_delay = 16; + SetPlayerPal(p, PalEntry(32, 32, 0, 0)); + + p->posxv = -(sintable[(p->getang() + 512) & 2047] << 8); + p->posyv = -(sintable[(p->getang()) & 2047] << 8); + spritesound(DUKE_LONGTERM_PAIN, p->i); + + checkhitwall(p->i, j, + p->posx + (sintable[(p->getang() + 512) & 2047] >> 9), + p->posy + (sintable[p->getang() & 2047] >> 9), + p->posz, -1); + + break; + + case BIGFORCE: + p->hurt_delay = 26; + checkhitwall(p->i, j, + p->posx + (sintable[(p->getang() + 512) & 2047] >> 9), + p->posy + (sintable[p->getang() & 2047] >> 9), + p->posz, -1); + break; + + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +bool checkhitceiling_d(int sn) +{ + int i, j; + + switch (sector[sn].ceilingpicnum) + { + case WALLLIGHT1: + case WALLLIGHT2: + case WALLLIGHT3: + case WALLLIGHT4: + case TECHLIGHT2: + case TECHLIGHT4: + + ceilingglass(ps[myconnectindex].i, sn, 10); + spritesound(GLASS_BREAKING, ps[screenpeek].i); + + if (sector[sn].ceilingpicnum == WALLLIGHT1) + sector[sn].ceilingpicnum = WALLLIGHTBUST1; + + if (sector[sn].ceilingpicnum == WALLLIGHT2) + sector[sn].ceilingpicnum = WALLLIGHTBUST2; + + if (sector[sn].ceilingpicnum == WALLLIGHT3) + sector[sn].ceilingpicnum = WALLLIGHTBUST3; + + if (sector[sn].ceilingpicnum == WALLLIGHT4) + sector[sn].ceilingpicnum = WALLLIGHTBUST4; + + if (sector[sn].ceilingpicnum == TECHLIGHT2) + sector[sn].ceilingpicnum = TECHLIGHTBUST2; + + if (sector[sn].ceilingpicnum == TECHLIGHT4) + sector[sn].ceilingpicnum = TECHLIGHTBUST4; + + + if (!sector[sn].hitag) + { + i = headspritesect[sn]; + while (i >= 0) + { + if (sprite[i].picnum == SECTOREFFECTOR && sprite[i].lotag == 12) + { + j = headspritestat[3]; + while (j >= 0) + { + if (sprite[j].hitag == sprite[i].hitag) + hittype[j].temp_data[3] = 1; + j = nextspritestat[j]; + } + break; + } + i = nextspritesect[i]; + } + } + + i = headspritestat[3]; + j = krand() & 1; + while (i >= 0) + { + if (sprite[i].hitag == (sector[sn].hitag) && sprite[i].lotag == 3) + { + hittype[i].temp_data[2] = j; + hittype[i].temp_data[4] = 1; + } + i = nextspritestat[i]; + } + + return 1; + } + + return 0; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void checkhitsprite_d(int i, int sn) +{ + int j, k, p; + spritetype* s; + + i &= (MAXSPRITES - 1); + + switch (sprite[i].picnum) + { + case OCEANSPRITE1: + case OCEANSPRITE2: + case OCEANSPRITE3: + case OCEANSPRITE4: + case OCEANSPRITE5: + spawn(i, SMALLSMOKE); + deletesprite(i); + break; + case QUEBALL: + case STRIPEBALL: + if (sprite[sn].picnum == QUEBALL || sprite[sn].picnum == STRIPEBALL) + { + sprite[sn].xvel = (sprite[i].xvel >> 1) + (sprite[i].xvel >> 2); + sprite[sn].ang -= (sprite[i].ang << 1) + 1024; + sprite[i].ang = getangle(sprite[i].x - sprite[sn].x, sprite[i].y - sprite[sn].y) - 512; + if (S_CheckSoundPlaying(POOLBALLHIT) < 2) + spritesound(POOLBALLHIT, i); + } + else + { + if (krand() & 3) + { + sprite[i].xvel = 164; + sprite[i].ang = sprite[sn].ang; + } + else + { + lotsofglass(i, -1, 3); + deletesprite(i); + } + } + break; + case TREE1: + case TREE2: + case TIRE: + case CONE: + case BOX: + switch (sprite[sn].picnum) + { + case RADIUSEXPLOSION: + case RPG: + case FIRELASER: + case HYDRENT: + case HEAVYHBOMB: + if (hittype[i].temp_data[0] == 0) + { + sprite[i].cstat &= ~257; + hittype[i].temp_data[0] = 1; + spawn(i, BURNING); + } + break; + } + break; + case CACTUS: + // case CACTUSBROKE: + switch (sprite[sn].picnum) + { + case RADIUSEXPLOSION: + case RPG: + case FIRELASER: + case HYDRENT: + case HEAVYHBOMB: + for (k = 0; k < 64; k++) + { + j = EGS(sprite[i].sectnum, sprite[i].x, sprite[i].y, sprite[i].z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (sprite[i].zvel >> 2), i, 5); + sprite[j].pal = 8; + } + + if (sprite[i].picnum == CACTUS) + sprite[i].picnum = CACTUSBROKE; + sprite[i].cstat &= ~257; + // else deletesprite(i); + break; + } + break; + + case HANGLIGHT: + case GENERICPOLE2: + for (k = 0; k < 6; k++) + EGS(sprite[i].sectnum, sprite[i].x, sprite[i].y, sprite[i].z - (8 << 8), SCRAP1 + (krand() & 15), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (sprite[i].zvel >> 2), i, 5); + spritesound(GLASS_HEAVYBREAK, i); + deletesprite(i); + break; + + + case FANSPRITE: + sprite[i].picnum = FANSPRITEBROKE; + sprite[i].cstat &= (65535 - 257); + if (sector[sprite[i].sectnum].floorpicnum == FANSHADOW) + sector[sprite[i].sectnum].floorpicnum = FANSHADOWBROKE; + + spritesound(GLASS_HEAVYBREAK, i); + s = &sprite[i]; + for (j = 0; j < 16; j++) RANDOMSCRAP(s, i); + + break; + case WATERFOUNTAIN: + case WATERFOUNTAIN + 1: + case WATERFOUNTAIN + 2: + case WATERFOUNTAIN + 3: + sprite[i].picnum = WATERFOUNTAINBROKE; + spawn(i, TOILETWATER); + break; + case SATELITE: + case FUELPOD: + case SOLARPANNEL: + case ANTENNA: + if (sprite[sn].extra != G_DefaultActorHealth(SHOTSPARK1)) // TRANSITIONAL - fix after getting rid of EDUKE cruft + { + 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); + deletesprite(i); + } + break; + case BOTTLE1: + case BOTTLE2: + case BOTTLE3: + case BOTTLE4: + case BOTTLE5: + case BOTTLE6: + case BOTTLE8: + case BOTTLE10: + case BOTTLE11: + case BOTTLE12: + case BOTTLE13: + case BOTTLE14: + case BOTTLE15: + case BOTTLE16: + case BOTTLE17: + case BOTTLE18: + case BOTTLE19: + case WATERFOUNTAINBROKE: + case DOMELITE: + case SUSHIPLATE1: + case SUSHIPLATE2: + case SUSHIPLATE3: + case SUSHIPLATE4: + case SUSHIPLATE5: + case WAITTOBESEATED: + case VASE: + case STATUEFLASH: + case STATUE: + if (sprite[i].picnum == BOTTLE10) + lotsofmoney(&sprite[i], 4 + (krand() & 3)); + else if (sprite[i].picnum == STATUE || sprite[i].picnum == STATUEFLASH) + { + lotsofcolourglass(i, -1, 40); + spritesound(GLASS_HEAVYBREAK, i); + } + else if (sprite[i].picnum == VASE) + lotsofglass(i, -1, 40); + + spritesound(GLASS_BREAKING, i); + sprite[i].ang = krand() & 2047; + lotsofglass(i, -1, 8); + deletesprite(i); + break; + case FETUS: + sprite[i].picnum = FETUSBROKE; + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + break; + case FETUSBROKE: + for (j = 0; j < 48; j++) + { + shoot(i, BLOODSPLAT1); + sprite[i].ang += 333; + } + spritesound(GLASS_HEAVYBREAK, i); + spritesound(SQUISHED, i); + case BOTTLE7: + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + deletesprite(i); + break; + case HYDROPLANT: + sprite[i].picnum = BROKEHYDROPLANT; + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + break; + + case FORCESPHERE: + sprite[i].xrepeat = 0; + 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); + break; + + case BROKEHYDROPLANT: + if (sprite[i].cstat & 1) + { + spritesound(GLASS_BREAKING, i); + sprite[i].z += 16 << 8; + sprite[i].cstat = 0; + lotsofglass(i, -1, 5); + } + break; + + case TOILET: + sprite[i].picnum = TOILETBROKE; + sprite[i].cstat |= (krand() & 1) << 2; + sprite[i].cstat &= ~257; + spawn(i, TOILETWATER); + spritesound(GLASS_BREAKING, i); + break; + + case STALL: + sprite[i].picnum = STALLBROKE; + sprite[i].cstat |= (krand() & 1) << 2; + sprite[i].cstat &= ~257; + spawn(i, TOILETWATER); + spritesound(GLASS_HEAVYBREAK, i); + break; + + case HYDRENT: + sprite[i].picnum = BROKEFIREHYDRENT; + spawn(i, TOILETWATER); + + // for(k=0;k<5;k++) + // { + // j = EGS(sprite[i].sectnum,sprite[i].x,sprite[i].y,sprite[i].z-(krand()%(48<<8)),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5); + // sprite[j].pal = 2; + // } + spritesound(GLASS_HEAVYBREAK, i); + break; + + case GRATE1: + sprite[i].picnum = BGRATE1; + sprite[i].cstat &= (65535 - 256 - 1); + spritesound(VENT_BUST, i); + break; + + case CIRCLEPANNEL: + sprite[i].picnum = CIRCLEPANNELBROKE; + sprite[i].cstat &= (65535 - 256 - 1); + spritesound(VENT_BUST, i); + break; + case PANNEL1: + case PANNEL2: + sprite[i].picnum = BPANNEL1; + sprite[i].cstat &= (65535 - 256 - 1); + spritesound(VENT_BUST, i); + break; + case PANNEL3: + sprite[i].picnum = BPANNEL3; + sprite[i].cstat &= (65535 - 256 - 1); + spritesound(VENT_BUST, i); + break; + case PIPE1: + case PIPE2: + case PIPE3: + case PIPE4: + case PIPE5: + case PIPE6: + switch (sprite[i].picnum) + { + case PIPE1:sprite[i].picnum = PIPE1B; break; + case PIPE2:sprite[i].picnum = PIPE2B; break; + case PIPE3:sprite[i].picnum = PIPE3B; break; + case PIPE4:sprite[i].picnum = PIPE4B; break; + case PIPE5:sprite[i].picnum = PIPE5B; break; + case PIPE6:sprite[i].picnum = PIPE6B; break; + } + + j = spawn(i, STEAM); + sprite[j].z = sector[sprite[i].sectnum].floorz - (32 << 8); + break; + + case MONK: + case LUKE: + case INDY: + case JURYGUY: + spritesound(sprite[i].lotag, i); + spawn(i, sprite[i].hitag); + case SPACEMARINE: + sprite[i].extra -= sprite[sn].extra; + if (sprite[i].extra > 0) break; + sprite[i].ang = krand() & 2047; + shoot(i, BLOODSPLAT1); + sprite[i].ang = krand() & 2047; + shoot(i, BLOODSPLAT2); + sprite[i].ang = krand() & 2047; + shoot(i, BLOODSPLAT3); + sprite[i].ang = krand() & 2047; + shoot(i, BLOODSPLAT4); + sprite[i].ang = krand() & 2047; + shoot(i, BLOODSPLAT1); + sprite[i].ang = krand() & 2047; + shoot(i, BLOODSPLAT2); + sprite[i].ang = krand() & 2047; + shoot(i, BLOODSPLAT3); + sprite[i].ang = krand() & 2047; + shoot(i, BLOODSPLAT4); + guts(&sprite[i], JIBS1, 1, myconnectindex); + guts(&sprite[i], JIBS2, 2, myconnectindex); + guts(&sprite[i], JIBS3, 3, myconnectindex); + guts(&sprite[i], JIBS4, 4, myconnectindex); + guts(&sprite[i], JIBS5, 1, myconnectindex); + guts(&sprite[i], JIBS3, 6, myconnectindex); + sound(SQUISHED); + deletesprite(i); + break; + case CHAIR1: + case CHAIR2: + sprite[i].picnum = BROKENCHAIR; + sprite[i].cstat = 0; + break; + case CHAIR3: + case MOVIECAMERA: + case SCALE: + case VACUUM: + case CAMERALIGHT: + case IVUNIT: + case POT1: + case POT2: + case POT3: + case TRIPODCAMERA: + spritesound(GLASS_HEAVYBREAK, i); + s = &sprite[i]; + for (j = 0; j < 16; j++) RANDOMSCRAP(s, i); + deletesprite(i); + break; + case PLAYERONWATER: + i = sprite[i].owner; + default: + if ((sprite[i].cstat & 16) && sprite[i].hitag == 0 && sprite[i].lotag == 0 && sprite[i].statnum == 0) + break; + + if ((sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i) && sprite[i].statnum != 4) + { + if (badguy(&sprite[i]) == 1) + { + if (sprite[sn].picnum == RPG) sprite[sn].extra <<= 1; + + if ((sprite[i].picnum != DRONE) && (sprite[i].picnum != ROTATEGUN) && (sprite[i].picnum != COMMANDER) && (sprite[i].picnum < GREENSLIME || sprite[i].picnum > GREENSLIME + 7)) + 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); + if (sprite[sn].pal == 6) + sprite[j].pal = 6; + sprite[j].z += (4 << 8); + sprite[j].xvel = 16; + sprite[j].xrepeat = sprite[j].yrepeat = 24; + sprite[j].ang += 32 - (krand() & 63); + } + + j = sprite[sn].owner; + + if (j >= 0 && sprite[j].picnum == APLAYER && sprite[i].picnum != ROTATEGUN && sprite[i].picnum != DRONE) + if (ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON) + { + shoot(i, BLOODSPLAT3); + shoot(i, BLOODSPLAT1); + shoot(i, BLOODSPLAT2); + shoot(i, BLOODSPLAT4); + } + + if (sprite[i].picnum != TANK && sprite[i].picnum != BOSS1 && sprite[i].picnum != BOSS4 && sprite[i].picnum != BOSS2 && sprite[i].picnum != BOSS3 && sprite[i].picnum != RECON && sprite[i].picnum != ROTATEGUN) + { + if ((sprite[i].cstat & 48) == 0) + sprite[i].ang = (sprite[sn].ang + 1024) & 2047; + sprite[i].xvel = -(sprite[sn].extra << 2); + short j = sprite[i].sectnum; + pushmove(&sprite[i].x, &sprite[i].y, &sprite[i].z, &j, 128L, (4L << 8), (4L << 8), CLIPMASK0); + if (j != sprite[i].sectnum && j >= 0 && j < MAXSECTORS) + changespritesect(i, j); + } + + if (sprite[i].statnum == 2) + { + changespritestat(i, 1); + hittype[i].timetosleep = SLEEPTIME; + } + if ((sprite[i].xrepeat < 24 || sprite[i].picnum == SHARK) && sprite[sn].picnum == SHRINKSPARK) return; + } + + if (sprite[i].statnum != 2) + { + if (sprite[sn].picnum == FREEZEBLAST && ((sprite[i].picnum == APLAYER && sprite[i].pal == 1) || (freezerhurtowner == 0 && sprite[sn].owner == i))) + return; + + hittype[i].picnum = sprite[sn].picnum; + hittype[i].extra += sprite[sn].extra; + hittype[i].ang = sprite[sn].ang; + hittype[i].owner = sprite[sn].owner; + } + + if (sprite[i].statnum == 10) + { + p = sprite[i].yvel; + if (ps[p].newowner >= 0) + { + ps[p].newowner = -1; + ps[p].posx = ps[p].oposx; + ps[p].posy = ps[p].oposy; + ps[p].posz = ps[p].oposz; + ps[p].q16ang = ps[p].oq16ang; + + updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum); + setpal(&ps[p]); + + j = headspritestat[1]; + while (j >= 0) + { + if (sprite[j].picnum == CAMERA1) sprite[j].yvel = 0; + j = nextspritestat[j]; + } + } + + if (sprite[i].xrepeat < 24 && sprite[sn].picnum == SHRINKSPARK) + return; + + if (sprite[hittype[i].owner].picnum != APLAYER) + if (ud.player_skill >= 3) + sprite[sn].extra += (sprite[sn].extra >> 1); + } + + } + break; + } +} + END_DUKE_NS diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 88f491d69..de66fe195 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -899,4 +899,1490 @@ bool checkhitswitch_r(int snum, int w, int switchtype) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void activatebysector_r(int sect, int j) +{ + short i; + + i = headspritesect[sect]; + while (i >= 0) + { + if (sprite[i].picnum == ACTIVATOR) + { + operateactivators(sprite[i].lotag, -1); + // return; + } + i = nextspritesect[i]; + } + + if (sector[sect].lotag != 22) + operatesectors(sect, j); +} + + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void checkhitwall_r(int spr, int dawallnum, int x, int y, int z, int atwith) +{ + short j, i, sn = -1, darkestwall; + walltype* wal; + spritetype* s; + + wal = &wall[dawallnum]; + + if (wal->overpicnum == MIRROR) + { + switch (atwith) + { + case RPG2: + if (!isRRRA()) break; + case HEAVYHBOMB: + case RADIUSEXPLOSION: + case RPG: + case HYDRENT: + case SEENINE: + case OOZFILTER: + case EXPLODINGBARREL: + lotsofglass(spr, dawallnum, 70); + wal->cstat &= ~16; + wal->overpicnum = MIRRORBROKE; + spritesound(GLASS_HEAVYBREAK, spr); + return; + } + } + + if (((wal->cstat & 16) || wal->overpicnum == BIGFORCE) && wal->nextsector >= 0) + if (sector[wal->nextsector].floorz > z) + if (sector[wal->nextsector].floorz - sector[wal->nextsector].ceilingz) + switch (wal->overpicnum) + { + case FANSPRITE: + wal->overpicnum = FANSPRITEBROKE; + wal->cstat &= 65535 - 65; + if (wal->nextwall >= 0) + { + wall[wal->nextwall].overpicnum = FANSPRITEBROKE; + wall[wal->nextwall].cstat &= 65535 - 65; + } + spritesound(VENT_BUST, spr); + spritesound(GLASS_BREAKING, spr); + return; + + case RRTILE1973: + updatesector(x, y, &sn); if (sn < 0) return; + wal->overpicnum = GLASS2; + lotsofpopcorn(spr, dawallnum, 64); + wal->cstat = 0; + + if (wal->nextwall >= 0) + wall[wal->nextwall].cstat = 0; + + i = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].getang(), 0, 0, spr, 3); + sprite[i].lotag = 128; hittype[i].temp_data[1] = 2; hittype[i].temp_data[2] = dawallnum; + spritesound(GLASS_BREAKING, i); + return; + + case GLASS: + updatesector(x, y, &sn); if (sn < 0) return; + wal->overpicnum = GLASS2; + lotsofglass(spr, dawallnum, 10); + wal->cstat = 0; + + if (wal->nextwall >= 0) + wall[wal->nextwall].cstat = 0; + + i = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].getang(), 0, 0, spr, 3); + sprite[i].lotag = 128; hittype[i].temp_data[1] = 2; hittype[i].temp_data[2] = dawallnum; + spritesound(GLASS_BREAKING, i); + return; + case STAINGLASS1: + updatesector(x, y, &sn); if (sn < 0) return; + lotsofcolourglass(spr, dawallnum, 80); + wal->cstat = 0; + if (wal->nextwall >= 0) + wall[wal->nextwall].cstat = 0; + spritesound(VENT_BUST, spr); + spritesound(GLASS_BREAKING, spr); + return; + } + + switch (wal->picnum) + { + case RRTILE8464: + if (isRRRA()) break; + break; + case RRTILE3643: + case RRTILE3643 + 1: + case RRTILE3643 + 2: + case RRTILE3643 + 3: + { + short sect; + short unk = 0; + short jj; + short nextjj; + short startwall, endwall; + sect = wall[wal->nextwall].nextsector; + jj = headspritesect[sect]; + while (jj != -1) + { + nextjj = nextspritesect[jj]; + s = &sprite[jj]; + if (s->lotag == 6) + { + for (j = 0; j < 16; j++) RANDOMSCRAP(s, i); + g_spriteExtra[jj]++; + if (g_spriteExtra[jj] == 25) + { + startwall = sector[s->sectnum].wallptr; + endwall = startwall + sector[s->sectnum].wallnum; + for (i = startwall; i < endwall; i++) + sector[wall[i].nextsector].lotag = 0; + sector[s->sectnum].lotag = 0; + stopsound(sprite[jj].lotag); + spritesound(400, jj); + deletesprite(jj); + } + } + jj = nextjj; + } + return; + } + case RRTILE7555: + if (!isRRRA()) break; + wal->picnum = SBMOVE; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7441: + if (!isRRRA()) break; + wal->picnum = RRTILE5016; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7559: + if (!isRRRA()) break; + wal->picnum = RRTILE5017; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7433: + if (!isRRRA()) break; + wal->picnum = RRTILE5018; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7557: + if (!isRRRA()) break; + wal->picnum = RRTILE5019; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7553: + if (!isRRRA()) break; + wal->picnum = RRTILE5020; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7552: + if (!isRRRA()) break; + wal->picnum = RRTILE5021; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7568: + if (!isRRRA()) break; + wal->picnum = RRTILE5022; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7540: + if (!isRRRA()) break; + wal->picnum = RRTILE5023; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7558: + if (!isRRRA()) break; + wal->picnum = RRTILE5024; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7554: + if (!isRRRA()) break; + wal->picnum = RRTILE5025; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7579: + if (!isRRRA()) break; + wal->picnum = RRTILE5026; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7561: + if (!isRRRA()) break; + wal->picnum = RRTILE5027; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7580: + if (!isRRRA()) break; + wal->picnum = RRTILE5037; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE8227: + if (!isRRRA()) break; + wal->picnum = RRTILE5070; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE8503: + if (!isRRRA()) break; + wal->picnum = RRTILE5079; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE8567: + case RRTILE8568: + case RRTILE8569: + case RRTILE8570: + case RRTILE8571: + if (!isRRRA()) break; + wal->picnum = RRTILE5082; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE7859: + if (!isRRRA()) break; + wal->picnum = RRTILE5081; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE8496: + if (!isRRRA()) break; + wal->picnum = RRTILE5061; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE8617: + if (!isRRRA()) break; + if (numplayers < 2) + { + wal->picnum = RRTILE8618; + spritesound(47, spr); + } + return; + case RRTILE8620: + if (!isRRRA()) break; + wal->picnum = RRTILE8621; + spritesound(47, spr); + return; + case RRTILE8622: + if (!isRRRA()) break; + wal->picnum = RRTILE8623; + spritesound(495, spr); + return; + case RRTILE7657: + if (!isRRRA()) break; + wal->picnum = RRTILE7659; + spritesound(GLASS_HEAVYBREAK, spr); + return; + case RRTILE8497: + if (!isRRRA()) break; + wal->picnum = RRTILE5076; + spritesound(495, spr); + return; + case RRTILE7533: + if (!isRRRA()) break; + wal->picnum = RRTILE5035; + spritesound(495, spr); + return; + + case COLAMACHINE: + case VENDMACHINE: + breakwall(wal->picnum + 2, spr, dawallnum); + spritesound(GLASS_BREAKING, spr); + return; + + case OJ: + + case SCREENBREAK6: + case SCREENBREAK7: + case SCREENBREAK8: + + lotsofglass(spr, dawallnum, 30); + wal->picnum = W_SCREENBREAK + (krand() % (isRRRA() ? 2 : 3)); + spritesound(GLASS_HEAVYBREAK, spr); + return; + + case ATM: + wal->picnum = ATMBROKE; + lotsofmoney(&sprite[spr], 1 + (krand() & 7)); + spritesound(GLASS_HEAVYBREAK, spr); + break; + + case WALLLIGHT1: + case WALLLIGHT3: + case WALLLIGHT4: + case TECHLIGHT2: + case TECHLIGHT4: + case RRTILE1814: + case RRTILE1939: + case RRTILE1986: + case RRTILE1988: + case RRTILE2123: + case RRTILE2125: + case RRTILE2636: + case RRTILE2878: + case RRTILE2898: + case RRTILE3200: + case RRTILE3202: + case RRTILE3204: + case RRTILE3206: + case RRTILE3208: + + if (rnd(128)) + spritesound(GLASS_HEAVYBREAK, spr); + else spritesound(GLASS_BREAKING, spr); + lotsofglass(spr, dawallnum, 30); + + if (wal->picnum == RRTILE1814) + wal->picnum = RRTILE1817; + + if (wal->picnum == RRTILE1986) + wal->picnum = RRTILE1987; + + if (wal->picnum == RRTILE1939) + wal->picnum = RRTILE2004; + + if (wal->picnum == RRTILE1988) + wal->picnum = RRTILE2005; + + if (wal->picnum == RRTILE2898) + wal->picnum = RRTILE2899; + + if (wal->picnum == RRTILE2878) + wal->picnum = RRTILE2879; + + if (wal->picnum == RRTILE2123) + wal->picnum = RRTILE2124; + + if (wal->picnum == RRTILE2125) + wal->picnum = RRTILE2126; + + if (wal->picnum == RRTILE3200) + wal->picnum = RRTILE3201; + + if (wal->picnum == RRTILE3202) + wal->picnum = RRTILE3203; + + if (wal->picnum == RRTILE3204) + wal->picnum = RRTILE3205; + + if (wal->picnum == RRTILE3206) + wal->picnum = RRTILE3207; + + if (wal->picnum == RRTILE3208) + wal->picnum = RRTILE3209; + + if (wal->picnum == RRTILE2636) + wal->picnum = RRTILE2637; + + if (wal->picnum == WALLLIGHT1) + wal->picnum = WALLLIGHTBUST1; + + if (wal->picnum == WALLLIGHT3) + wal->picnum = WALLLIGHTBUST3; + + if (wal->picnum == WALLLIGHT4) + wal->picnum = WALLLIGHTBUST4; + + if (wal->picnum == TECHLIGHT2) + wal->picnum = TECHLIGHTBUST2; + + if (wal->picnum == TECHLIGHT4) + wal->picnum = TECHLIGHTBUST4; + + if (!wal->lotag) return; + + sn = wal->nextsector; + if (sn < 0) return; + darkestwall = 0; + + wal = &wall[sector[sn].wallptr]; + for (i = sector[sn].wallnum; i > 0; i--, wal++) + if (wal->shade > darkestwall) + darkestwall = wal->shade; + + j = krand() & 1; + i = headspritestat[3]; + while (i >= 0) + { + if (sprite[i].hitag == wall[dawallnum].lotag && sprite[i].lotag == 3) + { + hittype[i].temp_data[2] = j; + hittype[i].temp_data[3] = darkestwall; + hittype[i].temp_data[4] = 1; + } + i = nextspritestat[i]; + } + break; + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void checkplayerhurt_r(struct player_struct* p, int j) +{ + if ((j & 49152) == 49152) + { + j &= (MAXSPRITES - 1); + + switch (sprite[j].picnum) + { + case RRTILE2430: + case RRTILE2431: + case RRTILE2432: + case RRTILE2443: + case RRTILE2446: + case RRTILE2451: + case RRTILE2455: + if (isRRRA() && p->hurt_delay2 < 8) + { + sprite[p->i].extra -= 2; + p->hurt_delay2 = 16; + SetPlayerPal(p, PalEntry(32, 32, 0, 0)); + spritesound(DUKE_LONGTERM_PAIN, p->i); + } + break; + case CACTUS: + if (!isRRRA() && p->hurt_delay < 8) + { + sprite[p->i].extra -= 5; + p->hurt_delay = 16; + SetPlayerPal(p, PalEntry(32, 32, 0, 0)); + spritesound(DUKE_LONGTERM_PAIN, p->i); + } + break; + } + return; + } + + if ((j & 49152) != 32768) return; + j &= (MAXWALLS - 1); + + if (p->hurt_delay > 0) p->hurt_delay--; + else if (wall[j].cstat & 85) switch (wall[j].overpicnum) + { + case BIGFORCE: + p->hurt_delay = 26; + checkhitwall(p->i, j, + p->posx + (sintable[(p->getang() + 512) & 2047] >> 9), + p->posy + (sintable[p->getang() & 2047] >> 9), + p->posz, -1); + break; + + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +bool checkhitceiling_r(int sn) +{ + short i, j; + + switch (sector[sn].ceilingpicnum) + { + case WALLLIGHT1: + case WALLLIGHT3: + case WALLLIGHT4: + case TECHLIGHT2: + case TECHLIGHT4: + case RRTILE1939: + case RRTILE1986: + case RRTILE1988: + case RRTILE2123: + case RRTILE2125: + case RRTILE2878: + case RRTILE2898: + + + ceilingglass(ps[myconnectindex].i, sn, 10); + spritesound(GLASS_BREAKING, ps[screenpeek].i); + + if (sector[sn].ceilingpicnum == WALLLIGHT1) + sector[sn].ceilingpicnum = WALLLIGHTBUST1; + + if (sector[sn].ceilingpicnum == WALLLIGHT3) + sector[sn].ceilingpicnum = WALLLIGHTBUST3; + + if (sector[sn].ceilingpicnum == WALLLIGHT4) + sector[sn].ceilingpicnum = WALLLIGHTBUST4; + + if (sector[sn].ceilingpicnum == TECHLIGHT2) + sector[sn].ceilingpicnum = TECHLIGHTBUST2; + + if (sector[sn].ceilingpicnum == TECHLIGHT4) + sector[sn].ceilingpicnum = TECHLIGHTBUST4; + + if (sector[sn].ceilingpicnum == RRTILE1986) + sector[sn].ceilingpicnum = RRTILE1987; + + if (sector[sn].ceilingpicnum == RRTILE1939) + sector[sn].ceilingpicnum = RRTILE2004; + + if (sector[sn].ceilingpicnum == RRTILE1988) + sector[sn].ceilingpicnum = RRTILE2005; + + if (sector[sn].ceilingpicnum == RRTILE2898) + sector[sn].ceilingpicnum = RRTILE2899; + + if (sector[sn].ceilingpicnum == RRTILE2878) + sector[sn].ceilingpicnum = RRTILE2879; + + if (sector[sn].ceilingpicnum == RRTILE2123) + sector[sn].ceilingpicnum = RRTILE2124; + + if (sector[sn].ceilingpicnum == RRTILE2125) + sector[sn].ceilingpicnum = RRTILE2126; + + + if (!sector[sn].hitag) + { + i = headspritesect[sn]; + while (i >= 0) + { + if (sprite[i].picnum == SECTOREFFECTOR && (sprite[i].lotag == 12 || (isRRRA() && (sprite[i].lotag == 47 || sprite[i].lotag == 48)))) + { + j = headspritestat[3]; + while (j >= 0) + { + if (sprite[j].hitag == sprite[i].hitag) + hittype[j].temp_data[3] = 1; + j = nextspritestat[j]; + } + break; + } + i = nextspritesect[i]; + } + } + + i = headspritestat[3]; + j = krand() & 1; + while (i >= 0) + { + if (sprite[i].hitag == (sector[sn].hitag) && sprite[i].lotag == 3) + { + hittype[i].temp_data[2] = j; + hittype[i].temp_data[4] = 1; + } + i = nextspritestat[i]; + } + + return 1; + } + + return 0; +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void checkhitsprite_r(int i, int sn) +{ + int j, k, p; + spritetype* s; + + i &= (MAXSPRITES - 1); + + if (isRRRA()) switch (sprite[i].picnum) + { + case RRTILE8464: + break; + case RRTILE8487: + case RRTILE8489: + spritesound(471, i); + sprite[i].picnum++; + break; + case RRTILE7638: + case RRTILE7644: + case RRTILE7646: + case RRTILE7650: + case RRTILE7653: + case RRTILE7655: + case RRTILE7691: + case RRTILE7876: + case RRTILE7881: + case RRTILE7883: + sprite[i].picnum++; + spritesound(VENT_BUST, i); + break; + case RRTILE7879: + sprite[i].picnum++; + spritesound(495, i); + hitradius(i, 10, 0, 0, 1, 1); + break; + case RRTILE7648: + case RRTILE7694: + case RRTILE7700: + case RRTILE7702: + case RRTILE7711: + sprite[i].picnum++; + spritesound(47, i); + break; + case RRTILE7636: + sprite[i].picnum += 3; + spritesound(VENT_BUST, i); + break; + case RRTILE7875: + sprite[i].picnum += 3; + spritesound(VENT_BUST, i); + break; + case RRTILE7640: + sprite[i].picnum += 2; + spritesound(VENT_BUST, i); + break; + case RRTILE7595: + case RRTILE7704: + sprite[i].picnum = RRTILE7705; + spritesound(495, i); + break; + case RRTILE8579: + sprite[i].picnum = RRTILE5014; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7441: + sprite[i].picnum = RRTILE5016; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7534: + sprite[i].picnum = RRTILE5029; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7545: + sprite[i].picnum = RRTILE5030; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7547: + sprite[i].picnum = RRTILE5031; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7574: + sprite[i].picnum = RRTILE5032; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7575: + sprite[i].picnum = RRTILE5033; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7578: + sprite[i].picnum = RRTILE5034; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7478: + sprite[i].picnum = RRTILE5035; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8525: + sprite[i].picnum = RRTILE5036; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8537: + sprite[i].picnum = RRTILE5062; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8215: + sprite[i].picnum = RRTILE5064; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8216: + sprite[i].picnum = RRTILE5065; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8217: + sprite[i].picnum = RRTILE5066; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8218: + sprite[i].picnum = RRTILE5067; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8220: + sprite[i].picnum = RRTILE5068; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8221: + sprite[i].picnum = RRTILE5069; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8312: + sprite[i].picnum = RRTILE5071; + spritesound(472, i); + break; + case RRTILE8395: + sprite[i].picnum = RRTILE5072; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8423: + sprite[i].picnum = RRTILE5073; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE3462: + sprite[i].picnum = RRTILE5074; + spritesound(GLASS_HEAVYBREAK, i); + break; + case UWHIP: + sprite[i].picnum = RRTILE5075; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8608: + sprite[i].picnum = RRTILE5083; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8609: + sprite[i].picnum = RRTILE5084; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8567: + case RRTILE8568: + case RRTILE8569: + case RRTILE8570: + case RRTILE8571: + sprite[i].picnum = RRTILE5082; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8640: + sprite[i].picnum = RRTILE5085; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8611: + sprite[i].picnum = RRTILE5086; + spritesound(GLASS_HEAVYBREAK, i); + break; + case TECHLIGHTBUST2: + sprite[i].picnum = TECHLIGHTBUST4; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8497: + sprite[i].picnum = RRTILE5076; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8162: + case RRTILE8163: + case RRTILE8164: + case RRTILE8165: + case RRTILE8166: + case RRTILE8167: + case RRTILE8168: + changespritestat(i, 5); + sprite[i].picnum = RRTILE5063; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8589: + case RRTILE8590: + case RRTILE8591: + case RRTILE8592: + case RRTILE8593: + case RRTILE8594: + case RRTILE8595: + changespritestat(i, 5); + sprite[i].picnum = RRTILE8588; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE3497: + sprite[i].picnum = RRTILE5076; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE3498: + sprite[i].picnum = RRTILE5077; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE3499: + sprite[i].picnum = RRTILE5078; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8503: + sprite[i].picnum = RRTILE5079; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7901: + sprite[i].picnum = RRTILE5080; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7696: + sprite[i].picnum = RRTILE7697; + spritesound(DUKE_SHUCKS, i); + break; + case RRTILE7806: + sprite[i].picnum = RRTILE5043; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7885: + case RRTILE7890: + sprite[i].picnum = RRTILE5045; + spritesound(495, i); + hitradius(i, 10, 0, 0, 1, 1); + break; + case RRTILE7886: + sprite[i].picnum = RRTILE5046; + spritesound(495, i); + hitradius(i, 10, 0, 0, 1, 1); + break; + case RRTILE7887: + sprite[i].picnum = RRTILE5044; + spritesound(GLASS_HEAVYBREAK, i); + hitradius(i, 10, 0, 0, 1, 1); + break; + case RRTILE7900: + sprite[i].picnum = RRTILE5047; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7906: + sprite[i].picnum = RRTILE5048; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7912: + case RRTILE7913: + sprite[i].picnum = RRTILE5049; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8047: + sprite[i].picnum = RRTILE5050; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8596: + sprite[i].picnum = RRTILE8598; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8059: + sprite[i].picnum = RRTILE5051; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8060: + sprite[i].picnum = RRTILE5052; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8222: + sprite[i].picnum = RRTILE5053; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8223: + sprite[i].picnum = RRTILE5054; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8224: + sprite[i].picnum = RRTILE5055; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8370: + sprite[i].picnum = RRTILE5056; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8371: + sprite[i].picnum = RRTILE5057; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8372: + sprite[i].picnum = RRTILE5058; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8373: + sprite[i].picnum = RRTILE5059; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8396: + sprite[i].picnum = RRTILE5038; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8397: + sprite[i].picnum = RRTILE5039; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8398: + sprite[i].picnum = RRTILE5040; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8399: + sprite[i].picnum = RRTILE5041; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8385: + sprite[i].picnum = RRTILE8386; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8387: + sprite[i].picnum = RRTILE8388; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8389: + sprite[i].picnum = RRTILE8390; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8391: + sprite[i].picnum = RRTILE8392; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE7553: + sprite[i].picnum = RRTILE5035; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8475: + sprite[i].picnum = RRTILE5075; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8498: + sprite[i].picnum = RRTILE5077; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8499: + sprite[i].picnum = RRTILE5078; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE2445: + sprite[i].picnum = RRTILE2450; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE2123: + sprite[i].picnum = RRTILE2124; + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + break; + case RRTILE3773: + sprite[i].picnum = RRTILE8651; + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + break; + case RRTILE7533: + sprite[i].picnum = RRTILE5035; + spritesound(495, i); + hitradius(i, 10, 0, 0, 1, 1); + break; + case RRTILE8394: + sprite[i].picnum = RRTILE5072; + spritesound(495, i); + break; + case RRTILE8461: + case RRTILE8462: + sprite[i].picnum = RRTILE5074; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8679: + sprite[i].picnum = RRTILE8680; + spritesound(DUKE_SHUCKS, i); + hitradius(i, 10, 0, 0, 1, 1); + if (sprite[i].lotag != 0) + { + short j; + for (j = 0; j < MAXSPRITES; j++) + { + if (sprite[j].picnum == RRTILE8679 && sprite[j].pal == 4) + { + if (sprite[j].lotag == sprite[i].lotag) + sprite[j].picnum = RRTILE8680; + } + } + } + break; + case RRTILE3584: + sprite[i].picnum = RRTILE8681; + spritesound(495, i); + hitradius(i, 250, 0, 0, 1, 1); + break; + case RRTILE8682: + sprite[i].picnum = RRTILE8683; + spritesound(GLASS_HEAVYBREAK, i); + break; + case RRTILE8099: + if (sprite[i].lotag == 5) + { + short j; + sprite[i].lotag = 0; + sprite[i].picnum = RRTILE5087; + spritesound(340, i); + for (j = 0; j < MAXSPRITES; j++) + { + if (sprite[j].picnum == RRTILE8094) + sprite[j].picnum = RRTILE5088; + } + } + break; + case RRTILE2431: + if (sprite[i].pal != 4) + { + sprite[i].picnum = RRTILE2451; + if (sprite[i].lotag != 0) + { + short j; + for (j = 0; j < MAXSPRITES; j++) + { + if (sprite[j].picnum == RRTILE2431 && sprite[j].pal == 4) + { + if (sprite[i].lotag == sprite[j].lotag) + sprite[j].picnum = RRTILE2451; + } + } + } + } + break; + case RRTILE2443: + if (sprite[i].pal != 19) + sprite[i].picnum = RRTILE2455; + break; + case RRTILE2455: + spritesound(SQUISHED, i); + guts(&sprite[i], RRTILE2465, 3, myconnectindex); + deletesprite(i); + break; + case RRTILE2451: + if (sprite[i].pal != 4) + { + spritesound(SQUISHED, i); + if (sprite[i].lotag != 0) + { + short j; + for (j = 0; j < MAXSPRITES; j++) + { + if (sprite[j].picnum == RRTILE2451 && sprite[j].pal == 4) + { + if (sprite[i].lotag == sprite[j].lotag) + { + guts(&sprite[i], RRTILE2460, 12, myconnectindex); + guts(&sprite[i], RRTILE2465, 3, myconnectindex); + sprite[j].xrepeat = 0; + sprite[j].yrepeat = 0; + sprite[i].xrepeat = 0; + sprite[i].yrepeat = 0; + } + } + } + } + else + { + guts(&sprite[i], RRTILE2460, 12, myconnectindex); + guts(&sprite[i], RRTILE2465, 3, myconnectindex); + sprite[i].xrepeat = 0; + sprite[i].yrepeat = 0; + } + } + break; + case RRTILE2437: + spritesound(439, i); + break; + } + + switch (sprite[i].picnum) + { + case RRTILE3114: + sprite[i].picnum = RRTILE3117; + break; + case RRTILE2876: + sprite[i].picnum = RRTILE2990; + break; + case RRTILE3152: + sprite[i].picnum = RRTILE3218; + break; + case RRTILE3153: + sprite[i].picnum = RRTILE3219; + break; + case RRTILE2030: + sprite[i].picnum = RRTILE2034; + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + break; + case RRTILE2893: + case RRTILE2915: + case RRTILE3115: + case RRTILE3171: + switch (sprite[i].picnum) + { + case RRTILE2915: + sprite[i].picnum = RRTILE2977; + break; + case RRTILE2893: + sprite[i].picnum = RRTILE2978; + break; + case RRTILE3115: + sprite[i].picnum = RRTILE3116; + break; + case RRTILE3171: + sprite[i].picnum = RRTILE3216; + break; + } + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + break; + case RRTILE2156: + case RRTILE2158: + case RRTILE2160: + case RRTILE2175: + sprite[i].picnum++; + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + break; + case RRTILE2137: + case RRTILE2151: + case RRTILE2152: + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + sprite[i].picnum++; + for (k = 0; k < 6; k++) + EGS(sprite[i].sectnum, sprite[i].x, sprite[i].y, sprite[i].z - (8 << 8), SCRAP6 + (krand() & 15), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (sprite[i].zvel >> 2), i, 5); + break; + case BOWLINGBALL: + sprite[sn].xvel = (sprite[i].xvel >> 1) + (sprite[i].xvel >> 2); + sprite[sn].ang -= (krand() & 16); + spritesound(355, i); + break; + + case STRIPEBALL: + case QUEBALL: + case RRTILE3440: + case RRTILE3440 + 1: + case HENSTAND: + case HENSTAND + 1: + if (sprite[sn].picnum == QUEBALL || sprite[sn].picnum == STRIPEBALL) + { + sprite[sn].xvel = (sprite[i].xvel >> 1) + (sprite[i].xvel >> 2); + sprite[sn].ang -= (sprite[i].ang << 1) + 1024; + sprite[i].ang = getangle(sprite[i].x - sprite[sn].x, sprite[i].y - sprite[sn].y) - 512; + if (S_CheckSoundPlaying(POOLBALLHIT) < 2) + spritesound(POOLBALLHIT, i); + } + else if (sprite[sn].picnum == RRTILE3440 || sprite[sn].picnum == RRTILE3440 + 1) + { + sprite[sn].xvel = (sprite[i].xvel >> 1) + (sprite[i].xvel >> 2); + sprite[sn].ang -= ((sprite[i].ang << 1) + krand()) & 64; + sprite[i].ang = (sprite[i].ang + krand()) & 16; + spritesound(355, i); + } + else if (sprite[sn].picnum == HENSTAND || sprite[sn].picnum == HENSTAND + 1) + { + sprite[sn].xvel = (sprite[i].xvel >> 1) + (sprite[i].xvel >> 2); + sprite[sn].ang -= ((sprite[i].ang << 1) + krand()) & 16; + sprite[i].ang = (sprite[i].ang + krand()) & 16; + spritesound(355, i); + } + else + { + if (krand() & 3) + { + sprite[i].xvel = 164; + sprite[i].ang = sprite[sn].ang; + } + } + break; + + case TREE1: + case TREE2: + case TIRE: + case BOX: + switch (sprite[sn].picnum) + { + case RPG2: + if (!isRRRA()) break; + case RADIUSEXPLOSION: + case RPG: + case FIRELASER: + case HYDRENT: + case HEAVYHBOMB: + case TRIPBOMBSPRITE: + case COOLEXPLOSION1: + case OWHIP: + case UWHIP: + if (hittype[i].temp_data[0] == 0) + { + sprite[i].cstat &= ~257; + hittype[i].temp_data[0] = 1; + spawn(i, BURNING); + } + break; + } + break; + + case CACTUS: + // case CACTUSBROKE: + switch (sprite[sn].picnum) + { + case RPG2: + if (!isRRRA()) break; + case RADIUSEXPLOSION: + case RPG: + case FIRELASER: + case HYDRENT: + case HEAVYHBOMB: + case TRIPBOMBSPRITE: + case COOLEXPLOSION1: + case OWHIP: + case UWHIP: + for (k = 0; k < 64; k++) + { + j = EGS(sprite[i].sectnum, sprite[i].x, sprite[i].y, sprite[i].z - (krand() % (48 << 8)), SCRAP6 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (sprite[i].zvel >> 2), i, 5); + sprite[j].pal = 8; + } + + if (sprite[i].picnum == CACTUS) + sprite[i].picnum = CACTUSBROKE; + sprite[i].cstat &= ~257; + // else deletesprite(i); + break; + } + break; + + + case FANSPRITE: + sprite[i].picnum = FANSPRITEBROKE; + sprite[i].cstat &= (65535 - 257); + spritesound(GLASS_HEAVYBREAK, i); + s = &sprite[i]; + for (j = 0; j < 16; j++) RANDOMSCRAP(s, i); + + break; + case WATERFOUNTAIN: + case WATERFOUNTAIN + 1: + case WATERFOUNTAIN + 2: + case WATERFOUNTAIN + 3: + spawn(i, TOILETWATER); + break; + case SATELITE: + case FUELPOD: + case SOLARPANNEL: + case ANTENNA: + if (sprite[sn].extra != G_DefaultActorHealth(SHOTSPARK1)) // TRANSITIONAL - fix after getting rid of EDUKE cruft + { + 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); + deletesprite(i); + } + break; + case RRTILE1824: + if (!isRRRA()) break; + case BOTTLE1: + case BOTTLE2: + case BOTTLE3: + case BOTTLE4: + case BOTTLE5: + case BOTTLE6: + case BOTTLE8: + case BOTTLE10: + case BOTTLE11: + case BOTTLE12: + case BOTTLE13: + case BOTTLE14: + case BOTTLE15: + case BOTTLE16: + case BOTTLE17: + case BOTTLE18: + case BOTTLE19: + case DOMELITE: + case SUSHIPLATE1: + case SUSHIPLATE2: + case SUSHIPLATE3: + case SUSHIPLATE4: + case SUSHIPLATE5: + case WAITTOBESEATED: + case VASE: + case STATUEFLASH: + case STATUE: + if (sprite[i].picnum == BOTTLE10) + lotsofmoney(&sprite[i], 4 + (krand() & 3)); + else if (sprite[i].picnum == STATUE || sprite[i].picnum == STATUEFLASH) + { + lotsofcolourglass(i, -1, 40); + spritesound(GLASS_HEAVYBREAK, i); + } + else if (sprite[i].picnum == VASE) + lotsofglass(i, -1, 40); + + spritesound(GLASS_BREAKING, i); + sprite[i].ang = krand() & 2047; + lotsofglass(i, -1, 8); + deletesprite(i); + break; + case RRTILE2654: + case RRTILE2656: + case RRTILE3172: + if (!isRRRA()) break; + case BOTTLE7: + spritesound(GLASS_BREAKING, i); + lotsofglass(i, -1, 10); + deletesprite(i); + break; + case FORCESPHERE: + sprite[i].xrepeat = 0; + 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); + break; + case TOILET: + sprite[i].picnum = TOILETBROKE; + sprite[i].cstat |= (krand() & 1) << 2; + sprite[i].cstat &= ~257; + spawn(i, TOILETWATER); + spritesound(GLASS_BREAKING, i); + break; + + case STALL: + sprite[i].picnum = STALLBROKE; + sprite[i].cstat |= (krand() & 1) << 2; + sprite[i].cstat &= ~257; + spawn(i, TOILETWATER); + spritesound(GLASS_HEAVYBREAK, i); + break; + + case HYDRENT: + sprite[i].picnum = BROKEFIREHYDRENT; + spawn(i, TOILETWATER); + + // for(k=0;k<5;k++) + // { + // j = EGS(sprite[i].sectnum,sprite[i].x,sprite[i].y,sprite[i].z-(krand()%(48<<8)),SCRAP3+(krand()&3),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5); + // sprite[j].pal = 2; + // } + spritesound(GLASS_HEAVYBREAK, i); + break; + + case GRATE1: + sprite[i].picnum = BGRATE1; + sprite[i].cstat &= (65535 - 256 - 1); + spritesound(VENT_BUST, i); + break; + + case CIRCLEPANNEL: + sprite[i].picnum = CIRCLEPANNELBROKE; + sprite[i].cstat &= (65535 - 256 - 1); + spritesound(VENT_BUST, i); + break; + + case PIPE1: + case PIPE2: + case PIPE3: + case PIPE4: + case PIPE5: + case PIPE6: + switch (sprite[i].picnum) + { + case PIPE1:sprite[i].picnum = PIPE1B; break; + case PIPE2:sprite[i].picnum = PIPE2B; break; + case PIPE3:sprite[i].picnum = PIPE3B; break; + case PIPE4:sprite[i].picnum = PIPE4B; break; + case PIPE5:sprite[i].picnum = PIPE5B; break; + case PIPE6:sprite[i].picnum = PIPE6B; break; + } + + j = spawn(i, STEAM); + sprite[j].z = sector[sprite[i].sectnum].floorz - (32 << 8); + break; + + case CHAIR1: + case CHAIR2: + sprite[i].picnum = BROKENCHAIR; + sprite[i].cstat = 0; + break; + case CHAIR3: + case MOVIECAMERA: + case SCALE: + case VACUUM: + case CAMERALIGHT: + case IVUNIT: + case POT1: + case POT2: + case POT3: + spritesound(GLASS_HEAVYBREAK, i); + s = &sprite[i]; + for (j = 0; j < 16; j++) RANDOMSCRAP(s, i); + deletesprite(i); + break; + case PLAYERONWATER: + i = sprite[i].owner; + default: + if ((sprite[i].cstat & 16) && sprite[i].hitag == 0 && sprite[i].lotag == 0 && sprite[i].statnum == 0) + break; + + if ((sprite[sn].picnum == SHRINKSPARK || sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i) && sprite[i].statnum != 4) + { + if (badguy(&sprite[i]) == 1) + { + if (sprite[sn].picnum == RPG) sprite[sn].extra <<= 1; + else if (isRRRA() && sprite[sn].picnum == RPG2) sprite[sn].extra <<= 1; + + if ((sprite[i].picnum != DRONE)) + 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); + if (sprite[sn].pal == 6) + sprite[j].pal = 6; + sprite[j].z += (4 << 8); + sprite[j].xvel = 16; + sprite[j].xrepeat = sprite[j].yrepeat = 24; + sprite[j].ang += 32 - (krand() & 63); + } + + j = sprite[sn].owner; + + if (j >= 0 && sprite[j].picnum == APLAYER && sprite[i].picnum != DRONE) + if (ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON) + { + shoot(i, BLOODSPLAT3); + shoot(i, BLOODSPLAT1); + shoot(i, BLOODSPLAT2); + shoot(i, BLOODSPLAT4); + } + + if (sprite[i].statnum == 2) + { + changespritestat(i, 1); + hittype[i].timetosleep = SLEEPTIME; + } + } + + if (sprite[i].statnum != 2) + { + if (sprite[sn].picnum == FREEZEBLAST && ((sprite[i].picnum == APLAYER && sprite[i].pal == 1) || (freezerhurtowner == 0 && sprite[sn].owner == i))) + return; + + hittype[i].picnum = sprite[sn].picnum; + hittype[i].extra += sprite[sn].extra; + if (sprite[i].picnum != COW) + hittype[i].ang = sprite[sn].ang; + hittype[i].owner = sprite[sn].owner; + } + + if (sprite[i].statnum == 10) + { + p = sprite[i].yvel; + if (ps[p].newowner >= 0) + { + ps[p].newowner = -1; + ps[p].posx = ps[p].oposx; + ps[p].posy = ps[p].oposy; + ps[p].posz = ps[p].oposz; + ps[p].q16ang = ps[p].oq16ang; + + updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum); + setpal(&ps[p]); + + j = headspritestat[1]; + while (j >= 0) + { + if (sprite[j].picnum == CAMERA1) sprite[j].yvel = 0; + j = nextspritestat[j]; + } + } + + if (sprite[hittype[i].owner].picnum != APLAYER) + if (ud.player_skill >= 3) + sprite[sn].extra += (sprite[sn].extra >> 1); + } + + } + break; + } +} + END_DUKE_NS diff --git a/source/games/duke/src/soundsdyn.h b/source/games/duke/src/soundsdyn.h index 77c4fd97f..4c0991500 100644 --- a/source/games/duke/src/soundsdyn.h +++ b/source/games/duke/src/soundsdyn.h @@ -313,6 +313,7 @@ extern int32_t VOL4ENDSND2; extern int32_t EXPANDERSHOOT; extern int32_t INTRO4_B; extern int32_t BIGBANG; +#define DUKE_SHUCKS 47 // this was missing #define DYNAMICSOUNDMAP(Soundnum) (DynamicSoundMap[Soundnum]) diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 67eacb511..9ee1602ae 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -7623,7 +7623,8 @@ void A_SpawnWallGlass(int spriteNum, int wallNum, int glassCnt) } } -void A_SpawnWallPopcorn(int spriteNum, int wallNum, int glassCnt) +// RR only +void lotsofpopcorn(int spriteNum, int wallNum, int glassCnt) { if (wallNum < 0) { diff --git a/source/games/duke/src/zz_player.cpp b/source/games/duke/src/zz_player.cpp index 285f96bfd..6cba5fa37 100644 --- a/source/games/duke/src/zz_player.cpp +++ b/source/games/duke/src/zz_player.cpp @@ -669,7 +669,7 @@ growspark_rr: if (hitData.sprite >= 0 && sprite[hitData.sprite].picnum != TILE_ACCESSSWITCH && sprite[hitData.sprite].picnum != TILE_ACCESSSWITCH2) { - A_DamageObject(hitData.sprite, kneeSprite); + checkhitsprite(hitData.sprite, kneeSprite); if (playerNum >= 0) checkhitswitch(playerNum, hitData.sprite, 1); } @@ -740,7 +740,7 @@ growspark_rr: return -1; } else - Sect_DamageCeiling(hitData.sect); + checkhitceiling(hitData.sect); } if (!RR || sector[hitData.sect].lotag != ST_1_ABOVE_WATER) @@ -751,7 +751,7 @@ growspark_rr: { if (RR && sprite[hitData.sprite].picnum == TILE_TORNADO) return -1; - A_DamageObject(hitData.sprite, spawnedSprite); + checkhitsprite(hitData.sprite, spawnedSprite); if (sprite[hitData.sprite].picnum == TILE_APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_TDM) && @@ -832,7 +832,7 @@ growspark_rr: if (hitData.sprite >= 0) { - A_DamageObject(hitData.sprite, spawnedSprite); + checkhitsprite(hitData.sprite, spawnedSprite); if (sprite[hitData.sprite].picnum != TILE_APLAYER) A_Spawn(spawnedSprite, TILE_SMALLSMOKE); else @@ -942,10 +942,10 @@ growspark_rr: if (hitData.wall == -1 && hitData.sprite == -1 && hitData.sect >= 0 && Zvel < 0 && (sector[hitData.sprite].ceilingstat & 1) == 0) { - Sect_DamageCeiling(hitData.sect); + checkhitceiling(hitData.sect); } else if (hitData.sprite >= 0) - A_DamageObject(hitData.sprite, otherSprite); + checkhitsprite(hitData.sprite, otherSprite); else if (hitData.wall >= 0 && wall[hitData.wall].picnum != TILE_ACCESSSWITCH && wall[hitData.wall].picnum != TILE_ACCESSSWITCH2) A_DamageWall(otherSprite, hitData.wall, &hitData.pos, projecTile); } @@ -8517,7 +8517,7 @@ HORIZONLY:; { if (!(sector[pSprite->sectnum].lotag & 0x8000u) && (isanunderoperator(sector[pSprite->sectnum].lotag) || isanearoperator(sector[pSprite->sectnum].lotag))) - G_ActivateBySector(pSprite->sectnum, pPlayer->i); + activatebysector(pSprite->sectnum, pPlayer->i); if (squishPlayer) { @@ -8526,7 +8526,7 @@ HORIZONLY:; } } else if (klabs(floorZ - ceilZ) < ZOFFSET5 && isanunderoperator(sector[pPlayer->cursectnum].lotag)) - G_ActivateBySector(pPlayer->cursectnum, pPlayer->i); + activatebysector(pPlayer->cursectnum, pPlayer->i); if (RR && sector[pPlayer->cursectnum].ceilingz > (sector[pPlayer->cursectnum].floorz-ZOFFSET4)) { diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index 7179efb73..b2062dd03 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -2363,7 +2363,7 @@ int G_EnterLevel(int gameMode) g_player[0].ps->curr_weapon = SLINGBLADE_WEAPON; } - G_AlignWarpElevators(); + allignwarpelevators(); resetpspritevars(gameMode); ud.playerbest = CONFIG_GetMapBestTime(Menu_HaveUserMap() ? boardfilename : mi.fileName.GetChars(), g_loadedMapHack.md4); diff --git a/source/games/duke/src/zz_sector.cpp b/source/games/duke/src/zz_sector.cpp index 0fb75b0f5..05964e8e8 100644 --- a/source/games/duke/src/zz_sector.cpp +++ b/source/games/duke/src/zz_sector.cpp @@ -117,1773 +117,6 @@ void G_AnimateCamSprite(int smoothRatio) } } - -void G_ActivateBySector(int sectNum, int spriteNum) -{ - int activatedSectors = 0; - - for (bssize_t SPRITES_OF_SECT(sectNum, i)) - if (PN(i) == TILE_ACTIVATOR) - { - operateactivators(SLT(i),-1); - ++activatedSectors; - } - - if ((!RR && !activatedSectors) || (RR && sector[sectNum].lotag != SE_22_TEETH_DOOR)) - operatesectors(sectNum, spriteNum); -} - -static void G_BreakWall(int tileNum, int spriteNum, int wallNum) -{ - wall[wallNum].picnum = tileNum; - A_PlaySound(VENT_BUST,spriteNum); - A_PlaySound(GLASS_HEAVYBREAK,spriteNum); - A_SpawnWallGlass(spriteNum,wallNum,10); -} - -void A_DamageWall(int spriteNum, int wallNum, const vec3_t *vPos, int weaponNum) -{ - int16_t sectNum = -1; - walltype *pWall = &wall[wallNum]; - - if (pWall->overpicnum == TILE_MIRROR) - { - switch (DYNAMICTILEMAP(weaponNum)) - { - case RPG2__STATICRR: - if (!RRRA) break; - fallthrough__; - case RADIUSEXPLOSION__STATIC: - case SEENINE__STATIC: - case HEAVYHBOMB__STATIC: - case RPG__STATIC: - case HYDRENT__STATIC: - case OOZFILTER__STATIC: - case EXPLODINGBARREL__STATIC: - A_SpawnWallGlass(spriteNum, wallNum, 70); - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - pWall->cstat &= ~16; - pWall->overpicnum = TILE_MIRRORBROKE; - return; - - } - } - - if ((((pWall->cstat & 16) || pWall->overpicnum == TILE_BIGFORCE) && pWall->nextsector >= 0) && - (sector[pWall->nextsector].floorz > vPos->z) && - (sector[pWall->nextsector].floorz != sector[pWall->nextsector].ceilingz)) - { - int const switchPic = G_GetForcefieldPicnum(wallNum); - - switch (DYNAMICTILEMAP(switchPic)) - { - case W_FORCEFIELD__STATIC: - pWall->extra = 1; // tell the forces to animate - fallthrough__; - case BIGFORCE__STATIC: - { - if (RR) break; - updatesector(vPos->x, vPos->y, §Num); - if (sectNum < 0) - return; - - int xRepeat = 32; - int yRepeat = 32; - - if (weaponNum == -1) - xRepeat = yRepeat = 8; - else if (weaponNum == TILE_CHAINGUN) - { - xRepeat = 16 + sprite[spriteNum].xrepeat; - yRepeat = 16 + sprite[spriteNum].yrepeat; - } - - int const i = A_InsertSprite(sectNum, vPos->x, vPos->y, vPos->z, TILE_FORCERIPPLE, -127, xRepeat, yRepeat, 0, - 0, 0, spriteNum, 5); - - CS(i) |= 18 + 128; - SA(i) = getangle(pWall->x - wall[pWall->point2].x, pWall->y - wall[pWall->point2].y) - 512; - - A_PlaySound(SOMETHINGHITFORCE, i); - } - return; - - case FANSPRITE__STATIC: - pWall->overpicnum = TILE_FANSPRITEBROKE; - pWall->cstat &= 65535 - 65; - if (pWall->nextwall >= 0) - { - wall[pWall->nextwall].overpicnum = TILE_FANSPRITEBROKE; - wall[pWall->nextwall].cstat &= 65535 - 65; - } - A_PlaySound(VENT_BUST, spriteNum); - A_PlaySound(GLASS_BREAKING, spriteNum); - return; - - case RRTILE1973__STATICRR: - updatesector(vPos->x, vPos->y, §Num); - if (sectNum < 0) - return; - pWall->overpicnum = TILE_GLASS2; - A_SpawnWallPopcorn(spriteNum, wallNum, 64); - pWall->cstat = 0; - - if (pWall->nextwall >= 0) - wall[pWall->nextwall].cstat = 0; - - { - int const i = A_InsertSprite(sectNum, vPos->x, vPos->y, vPos->z, TILE_SECTOREFFECTOR, 0, 0, 0, - fix16_to_int(g_player[0].ps->q16ang), 0, 0, spriteNum, 3); - SLT(i) = 128; - T2(i) = 2; - T3(i) = wallNum; - A_PlaySound(GLASS_BREAKING, i); - } - return; - - case GLASS__STATIC: - updatesector(vPos->x, vPos->y, §Num); - if (sectNum < 0) - return; - pWall->overpicnum = TILE_GLASS2; - A_SpawnWallGlass(spriteNum, wallNum, 10); - pWall->cstat = 0; - - if (pWall->nextwall >= 0) - wall[pWall->nextwall].cstat = 0; - - { - int const i = A_InsertSprite(sectNum, vPos->x, vPos->y, vPos->z, TILE_SECTOREFFECTOR, 0, 0, 0, - fix16_to_int(g_player[0].ps->q16ang), 0, 0, spriteNum, 3); - SLT(i) = 128; - T2(i) = RR ? 2 : 5; - T3(i) = wallNum; - A_PlaySound(GLASS_BREAKING, i); - } - return; - - case STAINGLASS1__STATIC: - updatesector(vPos->x, vPos->y, §Num); - if (sectNum < 0) - return; - A_SpawnRandomGlass(spriteNum, wallNum, 80); - pWall->cstat = 0; - if (pWall->nextwall >= 0) - wall[pWall->nextwall].cstat = 0; - A_PlaySound(VENT_BUST, spriteNum); - A_PlaySound(GLASS_BREAKING, spriteNum); - return; - } - } - - int wallPicnum = pWall->picnum; - - if (RR && wallPicnum >= TILE_RRTILE3643 && wallPicnum <= TILE_RRTILE3643+3) - wallPicnum = TILE_RRTILE3643; - - switch (DYNAMICTILEMAP(wallPicnum)) - { - case RRTILE3643__STATICRR: - { - int jj = headspritesect[wall[pWall->nextwall].nextsector]; - while (jj != -1) - { - int const nextjj = nextspritesect[jj]; - spritetype *pSprite = &sprite[jj]; - if (pSprite->lotag == 6) - { - for (bssize_t j = 0; j < 16; j++) RANDOMSCRAP(pSprite,jj); - g_spriteExtra[jj]++; - if (g_spriteExtra[jj] == 25) - { - int const startwall = sector[pSprite->sectnum].wallptr; - int const endwall = startwall+sector[pSprite->sectnum].wallnum; - for(bssize_t i=startwall;isectnum].lotag = 0; - S_StopSound(sprite[jj].lotag); - A_PlaySound(400,jj); - A_DeleteSprite(jj); - } - } - jj = nextjj; - } - return; - } - case RRTILE7555__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_SBMOVE; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7441__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5016; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7559__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5017; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7433__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5018; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7557__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5019; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7553__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5020; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7552__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5021; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7568__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5022; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7540__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5023; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7558__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5024; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7554__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5025; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7579__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5026; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7561__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5027; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7580__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5037; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE8227__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5070; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE8503__STATICRR: - if (!RRRA) break; - pWall->picnum = TILE_RRTILE5079; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE8567__STATICRR: - case RRTILE8568__STATICRR: - case RRTILE8569__STATICRR: - case RRTILE8570__STATICRR: - case RRTILE8571__STATICRR: - pWall->picnum = TILE_RRTILE5082; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE7859__STATICRR: - pWall->picnum = TILE_RRTILE5081; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE8496__STATICRR: - pWall->picnum = TILE_RRTILE5061; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE8617__STATICRR: - if (numplayers < 2) - { - pWall->picnum = TILE_RRTILE8618; - A_PlaySound(47, spriteNum); - } - return; - case RRTILE8620__STATICRR: - pWall->picnum = TILE_RRTILE8621; - A_PlaySound(47, spriteNum); - return; - case RRTILE8622__STATICRR: - pWall->picnum = TILE_RRTILE8623; - A_PlaySound(495, spriteNum); - return; - case RRTILE7657__STATICRR: - pWall->picnum = TILE_RRTILE7659; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - return; - case RRTILE8497__STATICRR: - pWall->picnum = TILE_RRTILE5076; - A_PlaySound(495, spriteNum); - return; - case RRTILE7533__STATICRR: - pWall->picnum = TILE_RRTILE5035; - A_PlaySound(495, spriteNum); - return; - case COLAMACHINE__STATIC: - case VENDMACHINE__STATIC: - G_BreakWall(pWall->picnum + 2, spriteNum, wallNum); - A_PlaySound(RR ? GLASS_BREAKING : VENT_BUST, spriteNum); - return; - - case FEMPIC2__STATIC: - case FEMPIC3__STATIC: - - case SCREENBREAK1__STATIC: - case SCREENBREAK2__STATIC: - case SCREENBREAK3__STATIC: - case SCREENBREAK4__STATIC: - case SCREENBREAK5__STATIC: - - case SCREENBREAK9__STATIC: - case SCREENBREAK10__STATIC: - case SCREENBREAK11__STATIC: - case SCREENBREAK12__STATIC: - case SCREENBREAK13__STATIC: - case SCREENBREAK14__STATIC: - case SCREENBREAK15__STATIC: - case SCREENBREAK16__STATIC: - case SCREENBREAK17__STATIC: - case SCREENBREAK18__STATIC: - case SCREENBREAK19__STATIC: - case BORNTOBEWILDSCREEN__STATIC: - if (RR) break; - fallthrough__; - case OJ__STATIC: - - case SCREENBREAK6__STATIC: - case SCREENBREAK7__STATIC: - case SCREENBREAK8__STATIC: - A_SpawnWallGlass(spriteNum, wallNum, 30); - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - pWall->picnum = TILE_W_SCREENBREAK + (krand2() % (RRRA ? 2: 3)); - return; - - case W_TECHWALL5__STATIC: - case W_TECHWALL6__STATIC: - case W_TECHWALL7__STATIC: - case W_TECHWALL8__STATIC: - case W_TECHWALL9__STATIC: - if (RR) break; - G_BreakWall(pWall->picnum + 1, spriteNum, wallNum); - return; - - case W_MILKSHELF__STATIC: - if (RR) break; - G_BreakWall(TILE_W_MILKSHELFBROKE, spriteNum, wallNum); - return; - - case W_TECHWALL10__STATIC: - if (RR) break; - G_BreakWall(TILE_W_HITTECHWALL10, spriteNum, wallNum); - return; - - case W_TECHWALL1__STATIC: - case W_TECHWALL11__STATIC: - case W_TECHWALL12__STATIC: - case W_TECHWALL13__STATIC: - case W_TECHWALL14__STATIC: - if (RR) break; - G_BreakWall(TILE_W_HITTECHWALL1, spriteNum, wallNum); - return; - - case W_TECHWALL15__STATIC: - if (RR) break; - G_BreakWall(TILE_W_HITTECHWALL15, spriteNum, wallNum); - return; - - case W_TECHWALL16__STATIC: - if (RR) break; - G_BreakWall(TILE_W_HITTECHWALL16, spriteNum, wallNum); - return; - - case W_TECHWALL2__STATIC: - if (RR) break; - G_BreakWall(TILE_W_HITTECHWALL2, spriteNum, wallNum); - return; - - case W_TECHWALL3__STATIC: - if (RR) break; - G_BreakWall(TILE_W_HITTECHWALL3, spriteNum, wallNum); - return; - - case W_TECHWALL4__STATIC: - if (RR) break; - G_BreakWall(TILE_W_HITTECHWALL4, spriteNum, wallNum); - return; - - case ATM__STATIC: - pWall->picnum = TILE_ATMBROKE; - A_SpawnMultiple(spriteNum, TILE_MONEY, 1 + (krand2() & 7)); - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - - case WALLLIGHT2__STATIC: - if (RR) break; - fallthrough__; - case WALLLIGHT1__STATIC: - case WALLLIGHT3__STATIC: - case WALLLIGHT4__STATIC: - case TECHLIGHT2__STATIC: - case TECHLIGHT4__STATIC: - case RRTILE1814__STATICRR: - case RRTILE1939__STATICRR: - case RRTILE1986__STATICRR: - case RRTILE1988__STATICRR: - case RRTILE2123__STATICRR: - case RRTILE2125__STATICRR: - case RRTILE2636__STATICRR: - case RRTILE2878__STATICRR: - case RRTILE2898__STATICRR: - case RRTILE3200__STATICRR: - case RRTILE3202__STATICRR: - case RRTILE3204__STATICRR: - case RRTILE3206__STATICRR: - case RRTILE3208__STATICRR: - { - A_PlaySound(rnd(128) ? GLASS_HEAVYBREAK : GLASS_BREAKING, spriteNum); - A_SpawnWallGlass(spriteNum, wallNum, 30); - - if (RR) - { - if (pWall->picnum == TILE_RRTILE1814) - pWall->picnum = TILE_RRTILE1817; - - if (pWall->picnum == TILE_RRTILE1986) - pWall->picnum = TILE_RRTILE1987; - - if (pWall->picnum == TILE_RRTILE1939) - pWall->picnum = TILE_RRTILE2004; - - if (pWall->picnum == TILE_RRTILE1988) - pWall->picnum = TILE_RRTILE2005; - - if (pWall->picnum == TILE_RRTILE2898) - pWall->picnum = TILE_RRTILE2899; - - if (pWall->picnum == TILE_RRTILE2878) - pWall->picnum = TILE_RRTILE2879; - - if (pWall->picnum == TILE_RRTILE2123) - pWall->picnum = TILE_RRTILE2124; - - if (pWall->picnum == TILE_RRTILE2125) - pWall->picnum = TILE_RRTILE2126; - - if (pWall->picnum == TILE_RRTILE3200) - pWall->picnum = TILE_RRTILE3201; - - if (pWall->picnum == TILE_RRTILE3202) - pWall->picnum = TILE_RRTILE3203; - - if (pWall->picnum == TILE_RRTILE3204) - pWall->picnum = TILE_RRTILE3205; - - if (pWall->picnum == TILE_RRTILE3206) - pWall->picnum = TILE_RRTILE3207; - - if (pWall->picnum == TILE_RRTILE3208) - pWall->picnum = TILE_RRTILE3209; - - if (pWall->picnum == TILE_RRTILE2636) - pWall->picnum = TILE_RRTILE2637; - } - - if (pWall->picnum == TILE_WALLLIGHT1) - pWall->picnum = TILE_WALLLIGHTBUST1; - - if (!RR && pWall->picnum == TILE_WALLLIGHT2) - pWall->picnum = TILE_WALLLIGHTBUST2; - - if (pWall->picnum == TILE_WALLLIGHT3) - pWall->picnum = TILE_WALLLIGHTBUST3; - - if (pWall->picnum == TILE_WALLLIGHT4) - pWall->picnum = TILE_WALLLIGHTBUST4; - - if (pWall->picnum == TILE_TECHLIGHT2) - pWall->picnum = TILE_TECHLIGHTBUST2; - - if (pWall->picnum == TILE_TECHLIGHT4) - pWall->picnum = TILE_TECHLIGHTBUST4; - - if (pWall->lotag == 0) - return; - - sectNum = pWall->nextsector; - - if (sectNum < 0) - return; - - int darkestWall = 0; - - pWall = &wall[sector[sectNum].wallptr]; - - for (bssize_t i = sector[sectNum].wallnum; i > 0; i--, pWall++) - if (pWall->shade > darkestWall) - darkestWall = pWall->shade; - - int const random = krand2() & 1; - - for (bssize_t SPRITES_OF(STAT_EFFECTOR, i)) - if (SHT(i) == wall[wallNum].lotag && SLT(i) == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT) - { - T3(i) = random; - T4(i) = darkestWall; - T5(i) = 1; - } - - break; - } - } -} - -void Sect_DamageCeiling(int const sectNum) -{ - int16_t * const pPicnum = §or[sectNum].ceilingpicnum; - - switch (DYNAMICTILEMAP(*pPicnum)) - { - case RRTILE1939__STATICRR: *pPicnum = TILE_RRTILE2004; goto GLASSBREAK_CODE; - case RRTILE1986__STATICRR: *pPicnum = TILE_RRTILE1987; goto GLASSBREAK_CODE; - case RRTILE1988__STATICRR: *pPicnum = TILE_RRTILE2005; goto GLASSBREAK_CODE; - case RRTILE2123__STATICRR: *pPicnum = TILE_RRTILE2124; goto GLASSBREAK_CODE; - case RRTILE2125__STATICRR: *pPicnum = TILE_RRTILE2126; goto GLASSBREAK_CODE; - case RRTILE2878__STATICRR: *pPicnum = TILE_RRTILE2879; goto GLASSBREAK_CODE; - case RRTILE2898__STATICRR: *pPicnum = TILE_RRTILE2899; goto GLASSBREAK_CODE; - case WALLLIGHT1__STATIC: *pPicnum = TILE_WALLLIGHTBUST1; goto GLASSBREAK_CODE; - case WALLLIGHT2__STATIC: if (RR) break; *pPicnum = TILE_WALLLIGHTBUST2; goto GLASSBREAK_CODE; - case WALLLIGHT3__STATIC: *pPicnum = TILE_WALLLIGHTBUST3; goto GLASSBREAK_CODE; - case WALLLIGHT4__STATIC: *pPicnum = TILE_WALLLIGHTBUST4; goto GLASSBREAK_CODE; - case TECHLIGHT2__STATIC: *pPicnum = TILE_TECHLIGHTBUST2; goto GLASSBREAK_CODE; - case TECHLIGHT4__STATIC: *pPicnum = TILE_TECHLIGHTBUST4; - GLASSBREAK_CODE: - A_SpawnCeilingGlass(g_player[myconnectindex].ps->i, sectNum, 10); - A_PlaySound(GLASS_BREAKING, g_player[screenpeek].ps->i); - if (sector[sectNum].hitag == 0) - { - for (bssize_t SPRITES_OF_SECT(sectNum, i)) - { - if (PN(i) == TILE_SECTOREFFECTOR && (SLT(i) == SE_12_LIGHT_SWITCH || (RRRA && (SLT(i) == 47 || SLT(i) == 48)))) - { - for (bssize_t SPRITES_OF(STAT_EFFECTOR, j)) - if (sprite[j].hitag == SHT(i)) - actor[j].t_data[3] = 1; - break; - } - } - } - - int j = krand2() & 1; - - for (bssize_t SPRITES_OF(STAT_EFFECTOR, i)) - { - if (SHT(i) == sector[sectNum].hitag && SLT(i) == SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT) - { - T3(i) = j; - T5(i) = 1; - } - } - } -} - -// hard coded props... :( -void A_DamageObject(int spriteNum, int const dmgSrc) -{ - //if (g_netClient) - // return; - - spriteNum &= (MAXSPRITES-1); - - int spritePicnum = PN(spriteNum); - if (RR) - { - if (spritePicnum == TILE_HENSTAND+1) - spritePicnum = TILE_HENSTAND; - if (spritePicnum == TILE_RRTILE3440+1) - spritePicnum = TILE_RRTILE3440; - } - - if (spritePicnum > TILE_WATERFOUNTAIN && spritePicnum <= TILE_WATERFOUNTAIN+3) - spritePicnum = TILE_WATERFOUNTAIN; - - switch (DYNAMICTILEMAP(spritePicnum)) - { - case RRTILE8487__STATICRR: - case RRTILE8489__STATICRR: - if (!RRRA) goto default_case; - A_PlaySound(471, spriteNum); - PN(spriteNum)++; - break; - case RRTILE7638__STATICRR: - case RRTILE7644__STATICRR: - case RRTILE7646__STATICRR: - case RRTILE7650__STATICRR: - case RRTILE7653__STATICRR: - case RRTILE7655__STATICRR: - case RRTILE7691__STATICRR: - case RRTILE7876__STATICRR: - case RRTILE7881__STATICRR: - case RRTILE7883__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum)++; - A_PlaySound(VENT_BUST, spriteNum); - break; - case RRTILE7879__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum)++; - A_PlaySound(495, spriteNum); - A_RadiusDamage(spriteNum, 10, 0, 0, 1, 1); - break; - case RRTILE7648__STATICRR: - case RRTILE7694__STATICRR: - case RRTILE7700__STATICRR: - case RRTILE7702__STATICRR: - case RRTILE7711__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum)++; - A_PlaySound(47, spriteNum); - break; - case RRTILE7636__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) += 3; - A_PlaySound(VENT_BUST, spriteNum); - break; - case RRTILE7875__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) += 3; - A_PlaySound(VENT_BUST, spriteNum); - break; - case RRTILE7640__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) += 2; - A_PlaySound(VENT_BUST, spriteNum); - break; - case RRTILE7595__STATICRR: - case RRTILE7704__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE7705; - A_PlaySound(495, spriteNum); - break; - case RRTILE8579__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5014; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7441__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5016; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7534__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5029; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7545__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5030; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7547__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5031; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7574__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5032; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7575__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5033; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7578__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5034; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7478__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5035; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8525__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5036; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8537__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5062; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8215__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5064; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8216__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5065; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8217__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5066; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8218__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5067; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8220__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5068; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8221__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5069; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8312__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5071; - A_PlaySound(472, spriteNum); - break; - case RRTILE8395__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5072; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8423__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5073; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE3462__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5074; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case UWHIP__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5075; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8608__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5083; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8609__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5084; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8567__STATICRR: - case RRTILE8568__STATICRR: - case RRTILE8569__STATICRR: - case RRTILE8570__STATICRR: - case RRTILE8571__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5082; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8640__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5085; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8611__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5086; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case TECHLIGHTBUST2__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_TECHLIGHTBUST4; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8497__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5076; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8162__STATICRR: - case RRTILE8163__STATICRR: - case RRTILE8164__STATICRR: - case RRTILE8165__STATICRR: - case RRTILE8166__STATICRR: - case RRTILE8167__STATICRR: - case RRTILE8168__STATICRR: - if (!RRRA) goto default_case; - changespritestat(spriteNum, 5); - PN(spriteNum) = TILE_RRTILE5063; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8589__STATICRR: - case RRTILE8590__STATICRR: - case RRTILE8591__STATICRR: - case RRTILE8592__STATICRR: - case RRTILE8593__STATICRR: - case RRTILE8594__STATICRR: - case RRTILE8595__STATICRR: - if (!RRRA) goto default_case; - changespritestat(spriteNum, 5); - PN(spriteNum) = TILE_RRTILE8588; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE3497__STATICRR: - PN(spriteNum) = TILE_RRTILE5076; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE3498__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5077; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE3499__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5078; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8503__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5079; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7901__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5080; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7696__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE7697; - A_PlaySound(47, spriteNum); - break; - case RRTILE7806__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5043; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7885__STATICRR: - case RRTILE7890__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5045; - A_PlaySound(495, spriteNum); - A_RadiusDamage(spriteNum, 10, 0, 0, 1, 1); - break; - case RRTILE7886__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5046; - A_PlaySound(495, spriteNum); - A_RadiusDamage(spriteNum, 10, 0, 0, 1, 1); - break; - case RRTILE7887__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5044; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - A_RadiusDamage(spriteNum, 10, 0, 0, 1, 1); - break; - case RRTILE7900__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5047; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7906__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5048; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7912__STATICRR: - case RRTILE7913__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5049; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8047__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5050; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8596__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE8598; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8059__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5051; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8060__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5052; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8222__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5053; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8223__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5054; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8224__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5055; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8370__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5056; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8371__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5057; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8372__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5058; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8373__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5059; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8396__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5038; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8397__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5039; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8398__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5040; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8399__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5041; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8385__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE8386; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8387__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE8388; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8389__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE8390; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8391__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE8392; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE7553__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5035; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8475__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5075; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8498__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5077; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8499__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5078; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE2445__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE2450; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE2123__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE2124; - A_PlaySound(GLASS_BREAKING, spriteNum); - A_SpawnWallGlass(spriteNum, -1, 10); - break; - case RRTILE3773__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE8651; - A_PlaySound(GLASS_BREAKING, spriteNum); - A_SpawnWallGlass(spriteNum, -1, 10); - break; - case RRTILE7533__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5035; - A_PlaySound(495, spriteNum); - A_RadiusDamage(spriteNum, 10, 0, 0, 1, 1); - break; - case RRTILE8394__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5072; - A_PlaySound(495, spriteNum); - break; - case RRTILE8461__STATICRR: - case RRTILE8462__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE5074; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8679__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE8680; - A_PlaySound(47, spriteNum); - A_RadiusDamage(spriteNum, 10, 0, 0, 1, 1); - if (SLT(spriteNum) != 0) - { - for (bssize_t j = 0; j < MAXSPRITES; j++) - { - if (sprite[j].picnum == TILE_RRTILE8679 && sprite[j].pal == 4) - { - if (sprite[j].lotag == SLT(spriteNum)) - sprite[j].picnum = TILE_RRTILE8680; - } - } - } - break; - case RRTILE3584__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE8681; - A_PlaySound(495, spriteNum); - A_RadiusDamage(spriteNum, 250, 0, 0, 1, 1); - break; - case RRTILE8682__STATICRR: - if (!RRRA) goto default_case; - PN(spriteNum) = TILE_RRTILE8683; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - break; - case RRTILE8099__STATICRR: - if (!RRRA) goto default_case; - if (SLT(spriteNum) == 5) - { - SLT(spriteNum) = 0; - PN(spriteNum) = TILE_RRTILE5087; - A_PlaySound(340, spriteNum); - for (bssize_t j = 0; j < MAXSPRITES; j++) - { - if (sprite[j].picnum == TILE_RRTILE8094) - sprite[j].picnum = TILE_RRTILE5088; - } - } - break; - case RRTILE2431__STATICRR: - if (!RRRA) goto default_case; - if (sprite[spriteNum].pal != 4) - { - PN(spriteNum) = TILE_RRTILE2451; - if (SLT(spriteNum) != 0) - { - for (bssize_t j = 0; j < MAXSPRITES; j++) - { - if (sprite[j].picnum == TILE_RRTILE2431 && sprite[j].pal == 4) - { - if (SLT(spriteNum) == sprite[j].lotag) - sprite[j].picnum = TILE_RRTILE2451; - } - } - } - } - break; - case RRTILE2443__STATICRR: - if (!RRRA) goto default_case; - if (sprite[spriteNum].pal != 19) - PN(spriteNum) = TILE_RRTILE2455; - break; - case RRTILE2455__STATICRR: - if (!RRRA) goto default_case; - A_PlaySound(SQUISHED, spriteNum); - A_DoGuts(spriteNum, TILE_RRTILE2465, 3); - deletesprite(spriteNum); - break; - case RRTILE2451__STATICRR: - if (!RRRA) goto default_case; - if (sprite[spriteNum].pal != 4) - { - A_PlaySound(SQUISHED, spriteNum); - if (SLT(spriteNum) != 0) - { - for (bssize_t j = 0; j < MAXSPRITES; j++) - { - if (sprite[j].picnum == TILE_RRTILE2451 && sprite[j].pal == 4) - { - if (SLT(spriteNum) == sprite[j].lotag) - { - A_DoGuts(spriteNum, TILE_RRTILE2460, 12); - A_DoGuts(spriteNum, TILE_RRTILE2465, 3); - sprite[j].xrepeat = 0; - sprite[j].yrepeat = 0; - sprite[spriteNum].xrepeat = 0; - sprite[spriteNum].yrepeat = 0; - } - } - } - } - else - { - A_DoGuts(spriteNum, TILE_RRTILE2460, 12); - A_DoGuts(spriteNum, TILE_RRTILE2465, 3); - sprite[spriteNum].xrepeat = 0; - sprite[spriteNum].yrepeat = 0; - } - } - break; - case RRTILE2437__STATICRR: - if (!RRRA) goto default_case; - A_PlaySound(439, spriteNum); - break; - case RRTILE3114__STATICRR: - PN(spriteNum) = TILE_RRTILE3117; - break; - case RRTILE2876__STATICRR: - PN(spriteNum) = TILE_RRTILE2990; - break; - case RRTILE3152__STATICRR: - PN(spriteNum) = TILE_RRTILE3218; - break; - case RRTILE3153__STATICRR: - PN(spriteNum) = TILE_RRTILE3219; - break; - case RRTILE2030__STATICRR: - PN(spriteNum) = TILE_RRTILE2034; - A_PlaySound(GLASS_BREAKING, spriteNum); - A_SpawnWallGlass(spriteNum, -1, 10); - break; - case RRTILE2893__STATICRR: - case RRTILE2915__STATICRR: - case RRTILE3115__STATICRR: - case RRTILE3171__STATICRR: - switch (DYNAMICTILEMAP(PN(spriteNum))) - { - case RRTILE2915__STATICRR: - PN(spriteNum) = TILE_RRTILE2977; - break; - case RRTILE2893__STATICRR: - PN(spriteNum) = TILE_RRTILE2978; - break; - case RRTILE3115__STATICRR: - PN(spriteNum) = TILE_RRTILE3116; - break; - case RRTILE3171__STATICRR: - PN(spriteNum) = TILE_RRTILE3216; - break; - } - A_PlaySound(GLASS_BREAKING, spriteNum); - A_SpawnWallGlass(spriteNum, -1, 10); - break; - case RRTILE2156__STATICRR: - case RRTILE2158__STATICRR: - case RRTILE2160__STATICRR: - case RRTILE2175__STATICRR: - PN(spriteNum)++; - A_PlaySound(GLASS_BREAKING, spriteNum); - A_SpawnWallGlass(spriteNum, -1, 10); - break; - case RRTILE2137__STATICRR: - case RRTILE2151__STATICRR: - case RRTILE2152__STATICRR: - A_PlaySound(GLASS_BREAKING, spriteNum); - A_SpawnWallGlass(spriteNum, -1, 10); - PN(spriteNum)++; - for (int k = 0; k < 6; k++) - { - int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(), r4 = krand2(); - A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - ZOFFSET3, TILE_SCRAP6 + (r4 & 15), -8, 48, 48, r3 & 2047, (r2 & 63) + 64, -(r1 & 4095) - (sprite[spriteNum].zvel >> 2), spriteNum, STAT_MISC); - } - break; - case BOWLINGBALL__STATICRR: - sprite[dmgSrc].xvel = (sprite[spriteNum].xvel >> 1) + (sprite[spriteNum].xvel >> 2); - sprite[dmgSrc].ang -= (krand2() & 16); - A_PlaySound(355, spriteNum); - break; - case OCEANSPRITE1__STATIC: - case OCEANSPRITE2__STATIC: - case OCEANSPRITE3__STATIC: - case OCEANSPRITE4__STATIC: - case OCEANSPRITE5__STATIC: - if (RR) goto default_case; - A_Spawn(spriteNum,TILE_SMALLSMOKE); - A_DeleteSprite(spriteNum); - break; - - case QUEBALL__STATIC: - case STRIPEBALL__STATIC: - case RRTILE3440__STATICRR: - case HENSTAND__STATICRR: - if (sprite[dmgSrc].picnum == TILE_QUEBALL || sprite[dmgSrc].picnum == TILE_STRIPEBALL) - { - sprite[dmgSrc].xvel = (sprite[spriteNum].xvel>>1)+(sprite[spriteNum].xvel>>2); - sprite[dmgSrc].ang -= (SA(spriteNum)<<1)+1024; - SA(spriteNum) = getangle(SX(spriteNum)-sprite[dmgSrc].x,SY(spriteNum)-sprite[dmgSrc].y)-512; - if (S_CheckSoundPlaying(POOLBALLHIT) < 2) - A_PlaySound(POOLBALLHIT, spriteNum); - } - else if (RR && (sprite[dmgSrc].picnum == TILE_RRTILE3440 || sprite[dmgSrc].picnum == TILE_RRTILE3440+1)) - { - sprite[dmgSrc].xvel = (sprite[spriteNum].xvel>>1)+(sprite[spriteNum].xvel>>2); - sprite[dmgSrc].ang -= ((SA(spriteNum)<<1)+krand2())&64; - SA(spriteNum) = (SA(spriteNum)+krand2())&16; - A_PlaySound(355,spriteNum); - } - else if (RR && (sprite[dmgSrc].picnum == TILE_HENSTAND || sprite[dmgSrc].picnum == TILE_HENSTAND+1)) - { - sprite[dmgSrc].xvel = (sprite[spriteNum].xvel>>1)+(sprite[spriteNum].xvel>>2); - sprite[dmgSrc].ang -= ((SA(spriteNum)<<1)+krand2())&16; - SA(spriteNum) = (SA(spriteNum)+krand2())&16; - A_PlaySound(355,spriteNum); - } - else - { - if (krand2()&3) - { - sprite[spriteNum].xvel = 164; - sprite[spriteNum].ang = sprite[dmgSrc].ang; - } - else if (!RR) - { - A_SpawnWallGlass(spriteNum,-1,3); - A_DeleteSprite(spriteNum); - } - } - break; - - case CONE__STATIC: - if (RR) goto default_case; - fallthrough__; - case TREE1__STATIC: - case TREE2__STATIC: - case TIRE__STATIC: - case BOX__STATIC: - { - switch (DYNAMICTILEMAP(sprite[dmgSrc].picnum)) - { - case RPG2__STATICRR: - if (!RRRA) break; - fallthrough__; - case OWHIP__STATICRR: - case UWHIP__STATICRR: - case TRIPBOMBSPRITE__STATIC: - case COOLEXPLOSION1__STATIC: - if (!RR) break; - fallthrough__; - case RADIUSEXPLOSION__STATIC: - case RPG__STATIC: - case FIRELASER__STATIC: - case HYDRENT__STATIC: - case HEAVYHBOMB__STATIC: - if (T1(spriteNum) == 0) - { - CS(spriteNum) &= ~257; - T1(spriteNum) = 1; - A_Spawn(spriteNum,TILE_BURNING); - } - break; - } - break; - } - - case CACTUS__STATIC: - { - switch (DYNAMICTILEMAP(sprite[dmgSrc].picnum)) - { - case RPG2__STATICRR: - if (!RRRA) break; - fallthrough__; - case OWHIP__STATICRR: - case UWHIP__STATICRR: - case TRIPBOMBSPRITE__STATIC: - case COOLEXPLOSION1__STATIC: - if (!RR) break; - fallthrough__; - case RADIUSEXPLOSION__STATIC: - case RPG__STATIC: - case FIRELASER__STATIC: - case HYDRENT__STATIC: - case HEAVYHBOMB__STATIC: - for (bssize_t k=64; k>0; k--) - { - int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(), r4 = krand2(), r5 = krand2(); - int newSprite = - A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - (r5 % (48 << 8)), TILE_SCRAP3 + (r4 & 3), -8, 48, 48, - r3 & 2047, (r2 & 63) + 64, -(r1 & 4095) - (sprite[spriteNum].zvel >> 2), spriteNum, 5); - sprite[newSprite].pal = 8; - } - // case TILE_CACTUSBROKE: - if (PN(spriteNum) == TILE_CACTUS) - PN(spriteNum) = TILE_CACTUSBROKE; - CS(spriteNum) &= ~257; - break; - } - break; - } - - case HANGLIGHT__STATIC: - case GENERICPOLE2__STATIC: - if (RR) goto default_case; - for (bssize_t k=6; k>0; k--) - { - int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(), r4 = krand2(); - A_InsertSprite(SECT(spriteNum),SX(spriteNum),SY(spriteNum),SZ(spriteNum)-ZOFFSET3,TILE_SCRAP1+(r4&15),-8,48,48,r3&2047,(r2&63)+64,-(r1&4095)-(sprite[spriteNum].zvel>>2),spriteNum,5); - } - A_PlaySound(GLASS_HEAVYBREAK,spriteNum); - A_DeleteSprite(spriteNum); - break; - - case FANSPRITE__STATIC: - PN(spriteNum) = TILE_FANSPRITEBROKE; - CS(spriteNum) &= (65535-257); - if (!RR && sector[SECT(spriteNum)].floorpicnum == TILE_FANSHADOW) - sector[SECT(spriteNum)].floorpicnum = TILE_FANSHADOWBROKE; - - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); - - for (bssize_t j=16; j>0; j--) - { - spritetype * const pSprite = &sprite[spriteNum]; - RANDOMSCRAP(pSprite, spriteNum); - } - break; - - case WATERFOUNTAIN__STATIC: - // case TILE_WATERFOUNTAIN+1: - // case TILE_WATERFOUNTAIN+2: - if (!RR) - PN(spriteNum) = TILE_WATERFOUNTAINBROKE; - A_Spawn(spriteNum,TILE_TOILETWATER); - break; - - case SATELITE__STATIC: - case FUELPOD__STATIC: - case SOLARPANNEL__STATIC: - case ANTENNA__STATIC: - if (sprite[dmgSrc].extra != G_DefaultActorHealth(TILE_SHOTSPARK1)) - { - for (bssize_t j=0; j<15; j++) - { - int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(), r4 = krand2(); - A_InsertSprite(SECT(spriteNum),SX(spriteNum),SY(spriteNum),sector[SECT(spriteNum)].floorz-ZOFFSET4-(j<<9),TILE_SCRAP1+(r4&15),-8,64,64, - r3&2047,(r2&127)+64,-(r1&511)-256,spriteNum,5); - } - A_Spawn(spriteNum,TILE_EXPLOSION2); - A_DeleteSprite(spriteNum); - } - break; - - case WATERFOUNTAINBROKE__STATIC: - if (RR) goto default_case; - fallthrough__; - case BOTTLE1__STATIC: - case BOTTLE2__STATIC: - case BOTTLE3__STATIC: - case BOTTLE4__STATIC: - case BOTTLE5__STATIC: - case BOTTLE6__STATIC: - case BOTTLE8__STATIC: - case BOTTLE10__STATIC: - case BOTTLE11__STATIC: - case BOTTLE12__STATIC: - case BOTTLE13__STATIC: - case BOTTLE14__STATIC: - case BOTTLE15__STATIC: - case BOTTLE16__STATIC: - case BOTTLE17__STATIC: - case BOTTLE18__STATIC: - case BOTTLE19__STATIC: - case DOMELITE__STATIC: - case SUSHIPLATE1__STATIC: - case SUSHIPLATE2__STATIC: - case SUSHIPLATE3__STATIC: - case SUSHIPLATE4__STATIC: - case SUSHIPLATE5__STATIC: - case WAITTOBESEATED__STATIC: - case VASE__STATIC: - case STATUEFLASH__STATIC: - case STATUE__STATIC: - case RRTILE1824__STATICRR: - if (RR && !RRRA && PN(spriteNum) == TILE_RRTILE1824) goto default_case; - if (PN(spriteNum) == TILE_BOTTLE10) - A_SpawnMultiple(spriteNum, TILE_MONEY, 4+(krand2()&3)); - else if (PN(spriteNum) == TILE_STATUE || PN(spriteNum) == TILE_STATUEFLASH) - { - A_SpawnRandomGlass(spriteNum,-1,40); - A_PlaySound(GLASS_HEAVYBREAK,spriteNum); - } - else if (PN(spriteNum) == TILE_VASE) - A_SpawnWallGlass(spriteNum,-1,40); - - A_PlaySound(GLASS_BREAKING,spriteNum); - SA(spriteNum) = krand2()&2047; - A_SpawnWallGlass(spriteNum,-1,8); - A_DeleteSprite(spriteNum); - break; - - case FETUS__STATIC: - if (RR) goto default_case; - PN(spriteNum) = TILE_FETUSBROKE; - A_PlaySound(GLASS_BREAKING,spriteNum); - A_SpawnWallGlass(spriteNum,-1,10); - break; - - case FETUSBROKE__STATIC: - if (RR) goto default_case; - for (bssize_t j=48; j>0; j--) - { - A_Shoot(spriteNum,TILE_BLOODSPLAT1); - SA(spriteNum) += 333; - } - A_PlaySound(GLASS_HEAVYBREAK,spriteNum); - A_PlaySound(SQUISHED,spriteNum); - fallthrough__; - case BOTTLE7__STATIC: - A_PlaySound(GLASS_BREAKING,spriteNum); - A_SpawnWallGlass(spriteNum,-1,10); - A_DeleteSprite(spriteNum); - break; - case RRTILE2654__STATICRR: - case RRTILE2656__STATICRR: - case RRTILE3172__STATICRR: - if (!RRRA) goto default_case; - A_PlaySound(GLASS_BREAKING,spriteNum); - A_SpawnWallGlass(spriteNum,-1,10); - A_DeleteSprite(spriteNum); - break; - - case HYDROPLANT__STATIC: - if (RR) goto default_case; - PN(spriteNum) = TILE_BROKEHYDROPLANT; - A_PlaySound(GLASS_BREAKING,spriteNum); - A_SpawnWallGlass(spriteNum,-1,10); - break; - - case FORCESPHERE__STATIC: - sprite[spriteNum].xrepeat = 0; - actor[OW(spriteNum)].t_data[0] = 32; - actor[OW(spriteNum)].t_data[1] = !actor[OW(spriteNum)].t_data[1]; - actor[OW(spriteNum)].t_data[2] ++; - A_Spawn(spriteNum,TILE_EXPLOSION2); - break; - - case BROKEHYDROPLANT__STATIC: - if (RR) goto default_case; - if (CS(spriteNum)&1) - { - A_PlaySound(GLASS_BREAKING,spriteNum); - SZ(spriteNum) += ZOFFSET2; - CS(spriteNum) = 0; - A_SpawnWallGlass(spriteNum,-1,5); - } - break; - - case TOILET__STATIC: - PN(spriteNum) = TILE_TOILETBROKE; - CS(spriteNum) |= (krand2()&1)<<2; - CS(spriteNum) &= ~257; - A_Spawn(spriteNum,TILE_TOILETWATER); - A_PlaySound(GLASS_BREAKING,spriteNum); - break; - - case STALL__STATIC: - PN(spriteNum) = TILE_STALLBROKE; - CS(spriteNum) |= (krand2()&1)<<2; - CS(spriteNum) &= ~257; - A_Spawn(spriteNum,TILE_TOILETWATER); - A_PlaySound(GLASS_HEAVYBREAK,spriteNum); - break; - - case HYDRENT__STATIC: - PN(spriteNum) = TILE_BROKEFIREHYDRENT; - A_Spawn(spriteNum,TILE_TOILETWATER); - - // for(k=0;k<5;k++) - // { - // j = A_InsertSprite(SECT,SX,SY,SZ-(krand2()%(48<<8)),TILE_SCRAP3+(krand2()&3),-8,48,48,krand2()&2047,(krand2()&63)+64,-(krand2()&4095)-(sprite[i].zvel>>2),i,5); - // sprite[j].pal = 2; - // } - A_PlaySound(GLASS_HEAVYBREAK,spriteNum); - break; - - case GRATE1__STATIC: - PN(spriteNum) = TILE_BGRATE1; - CS(spriteNum) &= (65535-256-1); - A_PlaySound(VENT_BUST, spriteNum); - break; - - case CIRCLEPANNEL__STATIC: - PN(spriteNum) = TILE_CIRCLEPANNELBROKE; - CS(spriteNum) &= (65535-256-1); - A_PlaySound(VENT_BUST,spriteNum); - break; - - case PANNEL1__STATIC: - case PANNEL2__STATIC: - if (RR) goto default_case; - PN(spriteNum) = TILE_BPANNEL1; - CS(spriteNum) &= (65535-256-1); - A_PlaySound(VENT_BUST,spriteNum); - break; - - case PANNEL3__STATIC: - if (RR) goto default_case; - PN(spriteNum) = TILE_BPANNEL3; - CS(spriteNum) &= (65535-256-1); - A_PlaySound(VENT_BUST,spriteNum); - break; - - case PIPE1__STATIC: - case PIPE2__STATIC: - case PIPE3__STATIC: - case PIPE4__STATIC: - case PIPE5__STATIC: - case PIPE6__STATIC: - { - switch (DYNAMICTILEMAP(PN(spriteNum))) - { - case PIPE1__STATIC: - PN(spriteNum)=TILE_PIPE1B; - break; - case PIPE2__STATIC: - PN(spriteNum)=TILE_PIPE2B; - break; - case PIPE3__STATIC: - PN(spriteNum)=TILE_PIPE3B; - break; - case PIPE4__STATIC: - PN(spriteNum)=TILE_PIPE4B; - break; - case PIPE5__STATIC: - PN(spriteNum)=TILE_PIPE5B; - break; - case PIPE6__STATIC: - PN(spriteNum)=TILE_PIPE6B; - break; - } - - int newSprite = A_Spawn(spriteNum, TILE_STEAM); - sprite[newSprite].z = sector[SECT(spriteNum)].floorz-ZOFFSET5; - break; - } - - case MONK__STATIC: - case LUKE__STATIC: - case INDY__STATIC: - case JURYGUY__STATIC: - if (RR) goto default_case; - A_PlaySound(SLT(spriteNum),spriteNum); - A_Spawn(spriteNum,SHT(spriteNum)); - fallthrough__; - case SPACEMARINE__STATIC: - if (RR) goto default_case; - sprite[spriteNum].extra -= sprite[dmgSrc].extra; - if (sprite[spriteNum].extra > 0) break; - SA(spriteNum) = krand2()&2047; - A_Shoot(spriteNum,TILE_BLOODSPLAT1); - SA(spriteNum) = krand2()&2047; - A_Shoot(spriteNum,TILE_BLOODSPLAT2); - SA(spriteNum) = krand2()&2047; - A_Shoot(spriteNum,TILE_BLOODSPLAT3); - SA(spriteNum) = krand2()&2047; - A_Shoot(spriteNum,TILE_BLOODSPLAT4); - SA(spriteNum) = krand2()&2047; - A_Shoot(spriteNum,TILE_BLOODSPLAT1); - SA(spriteNum) = krand2()&2047; - A_Shoot(spriteNum,TILE_BLOODSPLAT2); - SA(spriteNum) = krand2()&2047; - A_Shoot(spriteNum,TILE_BLOODSPLAT3); - SA(spriteNum) = krand2()&2047; - A_Shoot(spriteNum,TILE_BLOODSPLAT4); - A_DoGuts(spriteNum,TILE_JIBS1,1); - A_DoGuts(spriteNum,TILE_JIBS2,2); - A_DoGuts(spriteNum,TILE_JIBS3,3); - A_DoGuts(spriteNum,TILE_JIBS4,4); - A_DoGuts(spriteNum,TILE_JIBS5,1); - A_DoGuts(spriteNum,TILE_JIBS3,6); - S_PlaySound(SQUISHED); - A_DeleteSprite(spriteNum); - break; - - case CHAIR1__STATIC: - case CHAIR2__STATIC: - PN(spriteNum) = TILE_BROKENCHAIR; - CS(spriteNum) = 0; - break; - - case TRIPODCAMERA__STATIC: - if (RR) goto default_case; - fallthrough__; - case CHAIR3__STATIC: - case MOVIECAMERA__STATIC: - case SCALE__STATIC: - case VACUUM__STATIC: - case CAMERALIGHT__STATIC: - case IVUNIT__STATIC: - case POT1__STATIC: - case POT2__STATIC: - case POT3__STATIC: - A_PlaySound(GLASS_HEAVYBREAK,spriteNum); - for (bssize_t j=16; j>0; j--) - { - spritetype * const pSprite = &sprite[spriteNum]; - RANDOMSCRAP(pSprite, spriteNum); - } - A_DeleteSprite(spriteNum); - break; - - case PLAYERONWATER__STATIC: - spriteNum = OW(spriteNum); - fallthrough__; - default: -default_case: - if ((sprite[spriteNum].cstat&16) && SHT(spriteNum) == 0 && SLT(spriteNum) == 0 && sprite[spriteNum].statnum == STAT_DEFAULT) - break; - - if (((RR && sprite[dmgSrc].picnum == TILE_SHRINKSPARK) || sprite[dmgSrc].picnum == TILE_FREEZEBLAST || sprite[dmgSrc].owner != spriteNum) && sprite[spriteNum].statnum != STAT_PROJECTILE) - { - if (A_CheckEnemySprite(&sprite[spriteNum]) == 1) - { - if (sprite[dmgSrc].picnum == TILE_RPG || (RRRA && sprite[dmgSrc].picnum == TILE_RPG2)) - sprite[dmgSrc].extra <<= 1; - - if ((PN(spriteNum) != TILE_DRONE) && (RR || ((PN(spriteNum) != TILE_ROTATEGUN) && (PN(spriteNum) != TILE_COMMANDER) && (PN(spriteNum) < TILE_GREENSLIME || PN(spriteNum) > TILE_GREENSLIME+7)))) - if (sprite[dmgSrc].picnum != TILE_FREEZEBLAST) - if (!A_CheckSpriteFlags(spriteNum, SFLAG_BADGUY)) - { - int const newSprite = A_Spawn(dmgSrc, TILE_JIBS6); - sprite[newSprite].z += ZOFFSET6; - if (sprite[dmgSrc].pal == 6) - sprite[newSprite].pal = 6; - sprite[newSprite].xvel = 16; - sprite[newSprite].xrepeat = sprite[newSprite].yrepeat = 24; - sprite[newSprite].ang += 32 - (krand2() & 63); - } - - int const damageOwner = sprite[dmgSrc].owner; - - if (damageOwner >= 0 && sprite[damageOwner].picnum == TILE_APLAYER && (RR || PN(spriteNum) != TILE_ROTATEGUN) && PN(spriteNum) != TILE_DRONE) - if (g_player[P_Get(damageOwner)].ps->curr_weapon == SHOTGUN_WEAPON) - { - A_Shoot(spriteNum, TILE_BLOODSPLAT3); - A_Shoot(spriteNum, TILE_BLOODSPLAT1); - A_Shoot(spriteNum, TILE_BLOODSPLAT2); - A_Shoot(spriteNum, TILE_BLOODSPLAT4); - } - - if (!RR && !A_CheckSpriteFlags(spriteNum, SFLAG_NODAMAGEPUSH)) - { - if ((sprite[spriteNum].cstat & 48) == 0) - SA(spriteNum) = (sprite[dmgSrc].ang + 1024) & 2047; - sprite[spriteNum].xvel = -(sprite[dmgSrc].extra << 2); - int16_t sectNum = SECT(spriteNum); - if ((unsigned)sectNum < MAXSECTORS) - { - pushmove((vec3_t *)&sprite[spriteNum], §Num, 128L, (4L << 8), (4L << 8), CLIPMASK0); - if (sectNum != SECT(spriteNum) && (unsigned)sectNum < MAXSECTORS) - changespritesect(spriteNum, sectNum); - } - } - - if (sprite[spriteNum].statnum == STAT_ZOMBIEACTOR) - { - changespritestat(spriteNum, STAT_ACTOR); - actor[spriteNum].timetosleep = SLEEPTIME; - } - - if (!RR && (sprite[spriteNum].xrepeat < 24 || PN(spriteNum) == TILE_SHARK) && sprite[dmgSrc].picnum == TILE_SHRINKSPARK) - return; - } - - if (sprite[spriteNum].statnum != STAT_ZOMBIEACTOR) - { - if (sprite[dmgSrc].picnum == TILE_FREEZEBLAST && ((PN(spriteNum) == TILE_APLAYER && sprite[spriteNum].pal == 1) || (g_freezerSelfDamage == 0 && sprite[dmgSrc].owner == spriteNum))) - return; - actor[spriteNum].picnum = sprite[dmgSrc].picnum; - actor[spriteNum].extra += sprite[dmgSrc].extra; - if (!RR || PN(spriteNum) != TILE_COW) - actor[spriteNum].ang = sprite[dmgSrc].ang; - actor[spriteNum].owner = sprite[dmgSrc].owner; - } - - if (sprite[spriteNum].statnum == STAT_PLAYER) - { - DukePlayer_t *ps = g_player[P_Get(spriteNum)].ps; - - if (ps->newowner >= 0) - G_ClearCameraView(ps); - - if (!RR && sprite[spriteNum].xrepeat < 24 && sprite[dmgSrc].picnum == TILE_SHRINKSPARK) - return; - - if (sprite[actor[spriteNum].owner].picnum != TILE_APLAYER) - if (ud.player_skill >= 3) - sprite[dmgSrc].extra += (sprite[dmgSrc].extra>>1); - } - } - - break; - } -} - -void G_AlignWarpElevators(void) -{ - for (bssize_t SPRITES_OF(STAT_EFFECTOR, i)) - { - if (SLT(i) == SE_17_WARP_ELEVATOR && SS(i) > 16) - { - for (bssize_t SPRITES_OF(STAT_EFFECTOR, j)) - { - if (i != j && sprite[j].lotag == SE_17_WARP_ELEVATOR && SHT(i) == sprite[j].hitag) - { - sector[sprite[j].sectnum].floorz = sector[SECT(i)].floorz; - sector[sprite[j].sectnum].ceilingz = sector[SECT(i)].ceilingz; - } - } - } - } -} - void P_HandleSharedKeys(int playerNum) { DukePlayer_t *const pPlayer = g_player[playerNum].ps;