From f56a8360b06c18b94f84daeb7f09092f3242eb1d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 16 May 2020 12:47:01 +0200 Subject: [PATCH] - spawnglass functions and fta_sounds. --- source/build/src/engine.cpp | 1 + source/games/duke/src/actors.cpp | 4 - source/games/duke/src/actors.h | 7 +- source/games/duke/src/actors_d.cpp | 74 ++++++++++- source/games/duke/src/actors_r.cpp | 27 +++- source/games/duke/src/dispatch.cpp | 5 + source/games/duke/src/flags_d.cpp | 71 +++++++++++ source/games/duke/src/flags_r.cpp | 31 +++++ source/games/duke/src/game.h | 23 ++-- source/games/duke/src/sectors_r.cpp | 55 ++++++++ source/games/duke/src/spawn.cpp | 176 ++++++++++++++++++++++++++ source/games/duke/src/spawn_d.cpp | 39 +++++- source/games/duke/src/spawn_r.cpp | 2 +- source/games/duke/src/zz_actors.cpp | 65 ---------- source/games/duke/src/zz_game.cpp | 187 +--------------------------- source/games/duke/src/zz_player.cpp | 2 +- 16 files changed, 485 insertions(+), 284 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 418fef914..eaf4b619d 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -5032,6 +5032,7 @@ void updatesectorexclude(int32_t const x, int32_t const y, int16_t * const sectn // as starting sector and the 'initial' z check is skipped // (not initial anymore because it follows the sector updating due to TROR) +// NOTE: This comes from Duke, therefore it's GPL! void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t * const sectnum) { if (enginecompatibility_mode != ENGINECOMPATIBILITY_NONE) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index cd47a0584..38c805fe2 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -4965,7 +4965,6 @@ void alterang(int a, int g_i, int g_p) // //--------------------------------------------------------------------------- - void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(int, int), void (*falladjustz)(spritetype*)) { auto g_sp = &sprite[g_i]; @@ -5051,7 +5050,4 @@ void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOT } } - - - END_DUKE_NS diff --git a/source/games/duke/src/actors.h b/source/games/duke/src/actors.h index c72e54ea8..001c55692 100644 --- a/source/games/duke/src/actors.h +++ b/source/games/duke/src/actors.h @@ -198,6 +198,8 @@ enum sflags_t { SFLAG_SHADOW = 0x00000001, SFLAG_NVG = 0x00000002, + SFLAG_INVENTORY = 0x00000004, + SFLAG_ADULT = 0x00000008, SFLAG_BADGUY = 0x00000020, SFLAG_NOPAL = 0x00000040, SFLAG_USEACTIVATOR = 0x00000200, @@ -250,11 +252,6 @@ void A_DoGutsDir(int spriteNum, int tileNum, int spawnCnt); void movecyclers(void); void movedummyplayers(void); void A_MoveSector(int spriteNum); -void A_PlayAlertSound(int spriteNum); -inline void check_fta_sounds(int s) -{ - A_PlayAlertSound(s); -} void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt); void resetlanepics(void); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index e06141a04..1b9757c58 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -89,6 +89,78 @@ bool floorspace_d(int sectnum) return 0; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void check_fta_sounds_d(int i) +{ + if (sprite[i].extra > 0) switch (sprite[i].picnum) + { + case LIZTROOPONTOILET: + case LIZTROOPJUSTSIT: + case LIZTROOPSHOOT: + case LIZTROOPJETPACK: + case LIZTROOPDUCKING: + case LIZTROOPRUNNING: + case LIZTROOP: + spritesound(PRED_RECOG, i); + break; + case LIZMAN: + case LIZMANSPITTING: + case LIZMANFEEDING: + case LIZMANJUMP: + spritesound(CAPT_RECOG, i); + break; + case PIGCOP: + case PIGCOPDIVE: + spritesound(PIG_RECOG, i); + break; + case RECON: + spritesound(RECO_RECOG, i); + break; + case DRONE: + spritesound(DRON_RECOG, i); + break; + case COMMANDER: + case COMMANDERSTAYPUT: + spritesound(COMM_RECOG, i); + break; + case ORGANTIC: + spritesound(TURR_RECOG, i); + break; + case OCTABRAIN: + case OCTABRAINSTAYPUT: + spritesound(OCTA_RECOG, i); + break; + case BOSS1: + sound(BOS1_RECOG); + break; + case BOSS2: + if (sprite[i].pal == 1) + sound(BOS2_RECOG); + else sound(WHIPYOURASS); + break; + case BOSS3: + if (sprite[i].pal == 1) + sound(BOS3_RECOG); + else sound(RIPHEADNECK); + break; + case BOSS4: + case BOSS4STAYPUT: + if (sprite[i].pal == 1) + sound(BOS4_RECOG); + sound(BOSS4_FIRSTSEE); + break; + case GREENSLIME: + spritesound(SLIM_RECOG, i); + break; + } +} + + //--------------------------------------------------------------------------- // // @@ -701,7 +773,7 @@ void movefta_d(void) default: hittype[i].timetosleep = 0; - check_fta_sounds(i); + fi.check_fta_sounds(i); changespritestat(i, STAT_ACTOR); break; } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index daeb919bc..9a8e881f9 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -99,6 +99,28 @@ bool floorspace_r(int sectnum) // //--------------------------------------------------------------------------- +void check_fta_sounds_r(int i) +{ + if (sprite[i].extra > 0) switch (sprite[i].picnum) + { + case COOT: // LIZTROOP + if (!isRRRA() && (krand() & 3) == 2) + spritesound(PRED_RECOG, i); + break; + case BILLYCOCK: + case BILLYRAY: + case BRAYSNIPER: // PIGCOP + spritesound(PIG_RECOG, i); + break; + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + void addweapon_r(struct player_struct* p, int weapon) { short cw = p->curr_weapon; @@ -628,7 +650,7 @@ void movefta_r(void) if (actorflag(spriteNum, SFLAG_USEACTIVATOR) && sector[sprite[spriteNum].sectnum].lotag & 16384) break; #endif hittype[i].timetosleep = 0; - check_fta_sounds(i); + fi.check_fta_sounds(i); changespritestat(i, STAT_ACTOR); break; } @@ -646,7 +668,7 @@ void movefta_r(void) if (wakeup(i, p)) { hittype[i].timetosleep = 0; - check_fta_sounds(i); + fi.check_fta_sounds(i); changespritestat(i, STAT_ACTOR); } } @@ -4664,5 +4686,4 @@ void checktimetosleep_r(int g_i) } } - END_DUKE_NS diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 55b67f9af..e3c427a91 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -91,6 +91,9 @@ void move_d(int g_i, int g_p, int g_x); void move_r(int g_i, int g_p, int g_x); int spawn_d(int j, int pn); int spawn_r(int j, int pn); +void check_fta_sounds_d(int i); +void check_fta_sounds_r(int i); + Dispatcher fi; @@ -130,6 +133,7 @@ void SetDispatcher() checktimetosleep_d, move_d, spawn_d, + check_fta_sounds_d }; } else @@ -166,6 +170,7 @@ void SetDispatcher() checktimetosleep_r, move_r, spawn_r, + check_fta_sounds_r, }; } } diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index c00151378..d8176abb3 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -130,6 +130,77 @@ void initactorflags_d() TECHSWITCH+1, DIPSWITCH3, DIPSWITCH3+1}); + + setflag(SFLAG_INVENTORY, { + FIRSTAID, + STEROIDS, + HEATSENSOR, + BOOTS, + JETPACK, + HOLODUKE, + AIRTANK }); + + setflag(SFLAG_ADULT, { + FEM1, + FEM2, + FEM3, + FEM4, + FEM5, + FEM6, + FEM7, + FEM8, + FEM9, + FEM10, + MAN, + MAN2, + WOMAN, + NAKED1, + PODFEM1, + FEMMAG1, + FEMMAG2, + FEMPIC1, + FEMPIC2, + FEMPIC3, + FEMPIC4, + FEMPIC5, + FEMPIC6, + FEMPIC7, + BLOODYPOLE, + FEM6PAD, + STATUE, + STATUEFLASH, + OOZ, + OOZ2, + WALLBLOOD1, + WALLBLOOD2, + WALLBLOOD3, + WALLBLOOD4, + WALLBLOOD5, + WALLBLOOD7, + WALLBLOOD8, + SUSHIPLATE1, + SUSHIPLATE2, + SUSHIPLATE3, + SUSHIPLATE4, + FETUS, + FETUSJIB, + FETUSBROKE, + HOTMEAT, + FOODOBJECT16, + DOLPHIN1, + DOLPHIN2, + TOUGHGAL, + TAMPON, + XXXSTACY, + 4946, + 4947, + 693, + 2254, + 4560, + 4561, + 4562, + 4498, + 4957 }); } diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index a83584047..35b181720 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -153,6 +153,37 @@ void initactorflags_r() MULTISWITCH2+3, RRTILE8464, RRTILE8464+1}); + + setflag(SFLAG_INVENTORY, { + FIRSTAID, + STEROIDS, + HEATSENSOR, + BOOTS, + JETPACK, + HOLODUKE, + AIRTANK }); + + setflag(SFLAG_ADULT, { + FEM10, + NAKED1, + FEMMAG1, + FEMMAG2, + STATUE, + STATUEFLASH, + OOZ, + WALLBLOOD1, + WALLBLOOD2, + WALLBLOOD3, + WALLBLOOD4, + WALLBLOOD5, + SUSHIPLATE1, + SUSHIPLATE2, + SUSHIPLATE3, + SUSHIPLATE4, + DOLPHIN1, + DOLPHIN2, + TOUGHGAL }); + } END_DUKE_NS \ No newline at end of file diff --git a/source/games/duke/src/game.h b/source/games/duke/src/game.h index 3cb377b6f..a2ec94fa8 100644 --- a/source/games/duke/src/game.h +++ b/source/games/duke/src/game.h @@ -222,11 +222,6 @@ extern int32_t voting; //extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen; -int32_t A_CheckInventorySprite(spritetype *s); -inline int inventory(spritetype* S) -{ - return A_CheckInventorySprite(S); -} short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, short s_ow, signed char s_ss); #define A_InsertSprite EGS int G_DoMoveThings(void); @@ -240,14 +235,11 @@ 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 ceilingglass(int spriteNum,int sectNum,int glassCnt); void spriteglass(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); -#define lotsofglass A_SpawnWallGlass -void lotsofpopcorn(int spriteNum,int wallnum,int glassCnt); +void lotsofcolourglass(int spriteNum,int wallNum,int glassCnt); +void lotsofglass(int spriteNum,int wallnum,int glassCnt); + void G_AddUserQuote(const char *daquote); void G_BackToMenu(void); void G_DumpDebugInfo(void); @@ -332,6 +324,12 @@ inline void setflag(int flag, const std::initializer_list& types) } } +inline bool inventory(spritetype* S) +{ + return !!(actorinfo[S->picnum].flags & SFLAG_INVENTORY); +} + + inline void settileflag(int flag, const std::initializer_list& types) { for (auto val : types) @@ -524,6 +522,7 @@ struct Dispatcher void (*checktimetosleep)(int g_i); void (*move)(int g_i, int g_p, int g_x); int (*spawn)(int j, int pn); + void (*check_fta_sounds)(int i); }; diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 4418bc22e..afb42f91f 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -926,6 +926,61 @@ void activatebysector_r(int sect, int j) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +static void lotsofpopcorn(short i, short wallnum, short n) +{ + long j, xv, yv, z, x1, y1; + short sect, a; + + sect = -1; + auto sp = &sprite[i]; + + if (wallnum < 0) + { + for (j = n - 1; j >= 0; j--) + { + a = sp->ang - 256 + (krand() & 511) + 1024; + EGS(sp->sectnum, sp->x, sp->y, sp->z, POPCORN, -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), i, 5); + } + return; + } + + j = n + 1; + + x1 = wall[wallnum].x; + y1 = wall[wallnum].y; + + xv = wall[wall[wallnum].point2].x - x1; + yv = wall[wall[wallnum].point2].y - y1; + + x1 -= ksgn(yv); + y1 += ksgn(xv); + + xv /= j; + yv /= j; + + for (j = n; j > 0; j--) + { + x1 += xv; + y1 += yv; + + updatesector(x1, y1, §); + if (sect >= 0) + { + z = sector[sect].floorz - (krand() & (abs(sector[sect].ceilingz - sector[sect].floorz))); + if (z < -(32 << 8) || z >(32 << 8)) + z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1)); + a = sp->ang - 1024; + EGS(sp->sectnum, x1, y1, z, POPCORN, -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 1023), i, 5); + } + } +} + //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index eed7f0fef..2b64197b1 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -1083,4 +1083,180 @@ void spawneffector(int i) } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void vglass(int x, int y, int a, int wn, int n) +{ + int z, zincs; + int sect; + + sect = wall[wn].nextsector; + if (sect == -1) return; + zincs = (sector[sect].floorz - sector[sect].ceilingz) / n; + + for (z = sector[sect].ceilingz; z < sector[sect].floorz; z += zincs) + EGS(sect, x, y, z - (krand() & 8191), TILE_GLASSPIECES + (z & (krand() % 3)), -32, 36, 36, a + 128 - (krand() & 255), 16 + (krand() & 31), 0, -1, 5); +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void lotsofglass(int i, int wallnum, int n) +{ + int j, xv, yv, z, x1, y1, a; + short sect; + auto sp = &sprite[i]; + + sect = -1; + + if (wallnum < 0) + { + for (j = n - 1; j >= 0; j--) + { + a = sp->ang - 256 + (krand() & 511) + 1024; + EGS(sp->sectnum, sp->x, sp->y, sp->z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), i, 5); + } + return; + } + + j = n + 1; + + x1 = wall[wallnum].x; + y1 = wall[wallnum].y; + + xv = wall[wall[wallnum].point2].x - x1; + yv = wall[wall[wallnum].point2].y - y1; + + x1 -= sgn(yv); + y1 += sgn(xv); + + xv /= j; + yv /= j; + + for (j = n; j > 0; j--) + { + x1 += xv; + y1 += yv; + + updatesector(x1, y1, §); + if (sect >= 0) + { + z = sector[sect].floorz - (krand() & (abs(sector[sect].ceilingz - sector[sect].floorz))); + if (z < -(32 << 8) || z >(32 << 8)) + z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1)); + a = sp->ang - 1024; + EGS(sp->sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 1023), i, 5); + } + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void spriteglass(int i, int n) +{ + int j, k, a, z; + auto sp = &sprite[i]; + + for (j = n; j > 0; j--) + { + a = krand() & 2047; + z = sp->z - ((krand() & 16) << 8); + k = EGS(sp->sectnum, sp->x, sp->y, z, TILE_GLASSPIECES + (j % 3), krand() & 15, 36, 36, a, 32 + (krand() & 63), -512 - (krand() & 2047), i, 5); + sprite[k].pal = sprite[i].pal; + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void ceilingglass(int i, int sectnum, int n) +{ + int j, xv, yv, z, x1, y1; + int a, s, startwall, endwall; + auto sp = &sprite[i]; + + startwall = sector[sectnum].wallptr; + endwall = startwall + sector[sectnum].wallnum; + + for (s = startwall; s < (endwall - 1); s++) + { + x1 = wall[s].x; + y1 = wall[s].y; + + xv = (wall[s + 1].x - x1) / (n + 1); + yv = (wall[s + 1].y - y1) / (n + 1); + + for (j = n; j > 0; j--) + { + x1 += xv; + y1 += yv; + a = krand() & 2047; + z = sector[sectnum].ceilingz + ((krand() & 15) << 8); + EGS(sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, (krand() & 31), 0, i, 5); + } + } +} + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void lotsofcolourglass(int i, int wallnum, int n) +{ + int j, xv, yv, z, x1, y1; + short sect = -1; + int a, k; + auto sp = &sprite[i]; + + if (wallnum < 0) + { + for (j = n - 1; j >= 0; j--) + { + a = krand() & 2047; + k = EGS(sp->sectnum, sp->x, sp->y, sp->z - (krand() & (63 << 8)), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 2047), i, 5); + sprite[k].pal = krand() & 15; + } + return; + } + + j = n + 1; + x1 = wall[wallnum].x; + y1 = wall[wallnum].y; + + xv = (wall[wall[wallnum].point2].x - wall[wallnum].x) / j; + yv = (wall[wall[wallnum].point2].y - wall[wallnum].y) / j; + + for (j = n; j > 0; j--) + { + x1 += xv; + y1 += yv; + + updatesector(x1, y1, §); + z = sector[sect].floorz - (krand() & (abs(sector[sect].ceilingz - sector[sect].floorz))); + if (z < -(32 << 8) || z >(32 << 8)) + z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1)); + a = sp->ang - 1024; + k = EGS(sp->sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 2047), i, 5); + sprite[k].pal = krand() & 7; + } +} + + + END_DUKE_NS diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index c04141741..2647bf4d0 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -103,7 +103,7 @@ int spawn_d(int j, int pn) if (j >= 0) { hittype[i].timetosleep = 0; - check_fta_sounds(i); + fi.check_fta_sounds(i); changespritestat(i, 1); } else changespritestat(i, 2); @@ -270,6 +270,10 @@ int spawn_d(int j, int pn) sp->pal = 6; changespritestat(i,5); break; + case LAVAPOOL: + if (!isWorldTour()) // Twentieth Anniversary World Tour + return i; + case BLOODPOOL: case PUKE: if (spawnbloodpoolpart1(j, i)) break; @@ -568,6 +572,11 @@ int spawn_d(int j, int pn) changespritestat(i,11); break; + case ONFIRE: + // Twentieth Anniversary World Tour + if (!isWorldTour()) + break; + case EXPLOSION2: case EXPLOSION2BOT: case BURNING: @@ -683,11 +692,24 @@ int spawn_d(int j, int pn) t[2] = sector[sect].floorz; if(sector[sect].lotag != 1 && sector[sect].lotag != 2) sector[sect].floorz = sp->z; - if(sp->pal && ud.multimode > 1) + if (!isWorldTour()) { - sp->xrepeat=sp->yrepeat=0; - changespritestat(i,5); - break; + if (sp->pal && ud.multimode > 1) + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i, 5); + break; + } + } + else { // Twentieth Anniversary World Tour addition + if ((sp->pal == 1 && ud.multimode > 1) // Single-game Only + || (sp->pal == 2 && (ud.multimode == 1 || ud.multimode > 1 && ud.coop != 1)) // Co-op Only + || (sp->pal == 3 && (ud.multimode == 1 || ud.multimode > 1 && ud.coop == 1))) // Dukematch Only + { + sp->xrepeat = sp->yrepeat = 0; + changespritestat(i, 5); + break; + } } case WATERBUBBLEMAKER: if (sp->hitag && sp->picnum == WATERBUBBLEMAKER) @@ -838,7 +860,7 @@ int spawn_d(int j, int pn) if(j >= 0) { hittype[i].timetosleep = 0; - check_fta_sounds(i); + fi.check_fta_sounds(i); changespritestat(i,1); } else changespritestat(i,2); @@ -903,6 +925,11 @@ int spawn_d(int j, int pn) if (initreactor(j, i, sp->picnum == RECON)) return i; break; + case FLAMETHROWERSPRITE: + case FLAMETHROWERAMMO: // Twentieth Anniversary World Tour + if (!isWorldTour()) + break; + case ATOMICHEALTH: case STEROIDS: case HEATSENSOR: diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index f4b1579b9..6e384b76f 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -1049,7 +1049,7 @@ int spawn_r(int j, int pn) if(j >= 0) { hittype[i].timetosleep = 0; - check_fta_sounds(i); + fi.check_fta_sounds(i); changespritestat(i,1); } else changespritestat(i,2); diff --git a/source/games/duke/src/zz_actors.cpp b/source/games/duke/src/zz_actors.cpp index aa301f581..4a041fa93 100644 --- a/source/games/duke/src/zz_actors.cpp +++ b/source/games/duke/src/zz_actors.cpp @@ -180,71 +180,6 @@ int G_WakeUp(spritetype *const pSprite, int const playerNum) } - - -void A_PlayAlertSound(int spriteNum) -{ - if (DEER) - return; - if (RR) - { - if (sprite[spriteNum].extra > 0) - { - switch (DYNAMICTILEMAP(PN(spriteNum))) - { - case COOT__STATICRR: if (!RRRA || (krand2()&3) == 2) A_PlaySound(PRED_RECOG, spriteNum); break; - case LTH__STATICRR: break; - case BILLYCOCK__STATICRR: - case BILLYRAY__STATICRR: - case BRAYSNIPER__STATICRR: A_PlaySound(PIG_RECOG, spriteNum); break; - case DOGRUN__STATICRR: - case HULK__STATICRR: - case HEN__STATICRR: - case DRONE__STATICRR: - case PIG__STATICRR: - case RECON__STATICRR: - case MINION__STATICRR: - case COW__STATICRR: - case VIXEN__STATICRR: - case RABBIT__STATICRR: break; - } - } - return; - } - if (sprite[spriteNum].extra > 0) - { - switch (DYNAMICTILEMAP(PN(spriteNum))) - { - case LIZTROOPONTOILET__STATIC: - case LIZTROOPJUSTSIT__STATIC: - case LIZTROOPSHOOT__STATIC: - case LIZTROOPJETPACK__STATIC: - case LIZTROOPDUCKING__STATIC: - case LIZTROOPRUNNING__STATIC: - case LIZTROOP__STATIC: A_PlaySound(PRED_RECOG, spriteNum); break; - case LIZMAN__STATIC: - case LIZMANSPITTING__STATIC: - case LIZMANFEEDING__STATIC: - case LIZMANJUMP__STATIC: A_PlaySound(CAPT_RECOG, spriteNum); break; - case PIGCOP__STATIC: - case PIGCOPDIVE__STATIC: A_PlaySound(PIG_RECOG, spriteNum); break; - case RECON__STATIC: A_PlaySound(RECO_RECOG, spriteNum); break; - case DRONE__STATIC: A_PlaySound(DRON_RECOG, spriteNum); break; - case COMMANDER__STATIC: - case COMMANDERSTAYPUT__STATIC: A_PlaySound(COMM_RECOG, spriteNum); break; - case ORGANTIC__STATIC: A_PlaySound(TURR_RECOG, spriteNum); break; - case OCTABRAIN__STATIC: - case OCTABRAINSTAYPUT__STATIC: A_PlaySound(OCTA_RECOG, spriteNum); break; - case BOSS1__STATIC: S_PlaySound(BOS1_RECOG); break; - case BOSS2__STATIC: S_PlaySound((sprite[spriteNum].pal == 1) ? BOS2_RECOG : WHIPYOURASS); break; - case BOSS3__STATIC: S_PlaySound((sprite[spriteNum].pal == 1) ? BOS3_RECOG : RIPHEADNECK); break; - case BOSS4__STATIC: - case BOSS4STAYPUT__STATIC: if (sprite[spriteNum].pal == 1) S_PlaySound(BOS4_RECOG); S_PlaySound(BOSS4_FIRSTSEE); break; - case GREENSLIME__STATIC: A_PlaySound(SLIM_RECOG, spriteNum); break; - } - } -} - TileInfo tileinfo[MAXTILES]; diff --git a/source/games/duke/src/zz_game.cpp b/source/games/duke/src/zz_game.cpp index 360552944..2de21e375 100644 --- a/source/games/duke/src/zz_game.cpp +++ b/source/games/duke/src/zz_game.cpp @@ -196,23 +196,6 @@ void G_GameQuit(void) } -int32_t A_CheckInventorySprite(spritetype *s) -{ - switch (DYNAMICTILEMAP(s->picnum)) - { - case FIRSTAID__STATIC: - case STEROIDS__STATIC: - case HEATSENSOR__STATIC: - case BOOTS__STATIC: - case JETPACK__STATIC: - case HOLODUKE__STATIC: - case AIRTANK__STATIC: - return 1; - default: - return 0; - } -} - void OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum) { if (!pPlayer->OnMotorcycle && !(sector[pPlayer->cursectnum].lotag == 2)) @@ -1659,7 +1642,7 @@ default_case1: EDUKE32_STATIC_ASSERT(sizeof(uspritetype) == sizeof(tspritetype)); // see TSPRITE_SIZE uspritetype *const pSprite = (i < 0) ? (uspritetype *)&tsprite[j] : (uspritetype *)&sprite[i]; - if (adult_lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum))) + if (adult_lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum))) { t->xrepeat = t->yrepeat = 0; continue; @@ -4456,174 +4439,6 @@ int G_DoMoveThings(void) return 0; } -void A_SpawnWallGlass(int spriteNum, int wallNum, int glassCnt) -{ - if (wallNum < 0) - { - for (bssize_t j = glassCnt - 1; j >= 0; --j) - { - int const a = SA(spriteNum) - 256 + (krand2() & 511) + 1024; - int32_t const r1 = krand2(), r2 = krand2(); - A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, - 32 + (r2 & 63), 1024 - (r1 & 1023), spriteNum, 5); - } - return; - } - - vec2_t v1 = { wall[wallNum].x, wall[wallNum].y }; - vec2_t v = { wall[wall[wallNum].point2].x - v1.x, wall[wall[wallNum].point2].y - v1.y }; - - v1.x -= ksgn(v.y); - v1.y += ksgn(v.x); - - v.x = tabledivide32_noinline(v.x, glassCnt+1); - v.y = tabledivide32_noinline(v.y, glassCnt+1); - - int16_t sect = -1; - - for (bsize_t j = glassCnt; j > 0; --j) - { - v1.x += v.x; - v1.y += v.y; - - updatesector(v1.x,v1.y,§); - if (sect >= 0) - { - int z = sector[sect].floorz - (krand2() & (klabs(sector[sect].ceilingz - sector[sect].floorz))); - - if (z < -ZOFFSET5 || z > ZOFFSET5) - z = SZ(spriteNum) - ZOFFSET5 + (krand2() & ((64 << 8) - 1)); - - int32_t const r1 = krand2(), r2 = krand2(); - A_InsertSprite(SECT(spriteNum), v1.x, v1.y, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, SA(spriteNum) - 1024, 32 + (r2 & 63), - -(r1 & 1023), spriteNum, 5); - } - } -} - -// RR only -void lotsofpopcorn(int spriteNum, int wallNum, int glassCnt) -{ - if (wallNum < 0) - { - for (bssize_t j = glassCnt - 1; j >= 0; --j) - { - int const a = SA(spriteNum) - 256 + (krand2() & 511) + 1024; - int32_t const r1 = krand2(), r2 = krand2(); - A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum), TILE_POPCORN, -32, 36, 36, a, - 32 + (r2 & 63), 1024 - (r1 & 1023), spriteNum, 5); - } - return; - } - - vec2_t v1 = { wall[wallNum].x, wall[wallNum].y }; - vec2_t v = { wall[wall[wallNum].point2].x - v1.x, wall[wall[wallNum].point2].y - v1.y }; - - v1.x -= ksgn(v.y); - v1.y += ksgn(v.x); - - v.x = tabledivide32_noinline(v.x, glassCnt+1); - v.y = tabledivide32_noinline(v.y, glassCnt+1); - - int16_t sect = -1; - - for (bsize_t j = glassCnt; j > 0; --j) - { - v1.x += v.x; - v1.y += v.y; - - updatesector(v1.x,v1.y,§); - if (sect >= 0) - { - int z = sector[sect].floorz - (krand2() & (klabs(sector[sect].ceilingz - sector[sect].floorz))); - - if (z < -ZOFFSET5 || z > ZOFFSET5) - z = SZ(spriteNum) - ZOFFSET5 + (krand2() & ((64 << 8) - 1)); - - int32_t const r1 = krand2(), r2 = krand2(); - A_InsertSprite(SECT(spriteNum), v1.x, v1.y, z, TILE_POPCORN, -32, 36, 36, SA(spriteNum) - 1024, 32 + (r2 & 63), - -(r1 & 1023), spriteNum, 5); - } - } -} - -void spriteglass(int spriteNum, int glassCnt) -{ - for (; glassCnt>0; glassCnt--) - { - int const a = krand2()&2047; - int const z = SZ(spriteNum)-((krand2()&16)<<8); - int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(); - int const k - = A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), z, TILE_GLASSPIECES + (glassCnt % 3), - r3 & 15, 36, 36, a, 32 + (r2 & 63), -512 - (r1 & 2047), spriteNum, 5); - sprite[k].pal = sprite[spriteNum].pal; - } -} - -void A_SpawnCeilingGlass(int spriteNum, int sectNum, int glassCnt) -{ - int const startWall = sector[sectNum].wallptr; - int const endWall = startWall+sector[sectNum].wallnum; - - for (bssize_t wallNum = startWall; wallNum < (endWall - 1); wallNum++) - { - vec2_t v1 = { wall[wallNum].x, wall[wallNum].y }; - vec2_t v = { tabledivide32_noinline(wall[wallNum + 1].x - v1.x, glassCnt + 1), - tabledivide32_noinline(wall[wallNum + 1].y - v1.y, glassCnt + 1) }; - - for (bsize_t j = glassCnt; j > 0; j--) - { - v1.x += v.x; - v1.y += v.y; - int const a = krand2()&2047; - int const z = sector[sectNum].ceilingz+((krand2()&15)<<8); - A_InsertSprite(sectNum, v1.x, v1.y, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, - a, (krand2() & 31), 0, spriteNum, 5); - } - } -} - -void A_SpawnRandomGlass(int spriteNum, int wallNum, int glassCnt) -{ - if (wallNum < 0) - { - for (bssize_t j = glassCnt - 1; j >= 0; j--) - { - int const a = krand2() & 2047; - int32_t const r1 = krand2(), r2 = krand2(), r3 = krand2(); - int const k - = A_InsertSprite(SECT(spriteNum), SX(spriteNum), SY(spriteNum), SZ(spriteNum) - (r3 & (63 << 8)), TILE_GLASSPIECES + (j % 3), - -32, 36, 36, a, 32 + (r2 & 63), 1024 - (r1 & 2047), spriteNum, 5); - sprite[k].pal = krand2() & 15; - } - return; - } - - vec2_t v1 = { wall[wallNum].x, wall[wallNum].y }; - vec2_t v = { tabledivide32_noinline(wall[wall[wallNum].point2].x - wall[wallNum].x, glassCnt + 1), - tabledivide32_noinline(wall[wall[wallNum].point2].y - wall[wallNum].y, glassCnt + 1) }; - int16_t sectNum = sprite[spriteNum].sectnum; - - for (bsize_t j = glassCnt; j > 0; j--) - { - v1.x += v.x; - v1.y += v.y; - - updatesector(v1.x, v1.y, §Num); - - int z = sector[sectNum].floorz - (krand2() & (klabs(sector[sectNum].ceilingz - sector[sectNum].floorz))); - - if (z < -ZOFFSET5 || z > ZOFFSET5) - z = SZ(spriteNum) - ZOFFSET5 + (krand2() & ((64 << 8) - 1)); - - int32_t const r1 = krand2(), r2 = krand2(); - int const k = A_InsertSprite(SECT(spriteNum), v1.x, v1.y, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, SA(spriteNum) - 1024, - 32 + (r2 & 63), -(r1 & 2047), spriteNum, 5); - sprite[k].pal = krand2() & 7; - } -} - void GameInterface::FreeGameData() { setmapfog(0); diff --git a/source/games/duke/src/zz_player.cpp b/source/games/duke/src/zz_player.cpp index 9e87521b1..0a6d383f1 100644 --- a/source/games/duke/src/zz_player.cpp +++ b/source/games/duke/src/zz_player.cpp @@ -8404,7 +8404,7 @@ HORIZONLY:; if (sprite[spriteNum].picnum == TILE_BILLYRAY) A_PlaySound(404, spriteNum); else - A_PlayAlertSound(spriteNum); + fi.check_fta_sounds(spriteNum); changespritestat(spriteNum, STAT_ACTOR); } }