From 0dd623a7fe3a0aac14c02e11ccb29c3e0ea1f1d0 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 9 Jun 2018 20:36:31 +0000 Subject: [PATCH] Don't spawn hardcoded Duke3D debris/guts/glass sprites when compiled as EDUKE32_STANDALONE git-svn-id: https://svn.eduke32.com/eduke32@6911 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/actors.cpp | 16 ++++++++++++---- source/duke3d/src/game.cpp | 2 ++ source/duke3d/src/gameexec.cpp | 24 +++++++++++++++++++++++- source/duke3d/src/macros.h | 3 +++ source/duke3d/src/player.cpp | 5 ++++- source/duke3d/src/sector.cpp | 26 ++++++++++++++++++++------ 6 files changed, 64 insertions(+), 12 deletions(-) diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 09713f536..7f1d348e2 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -659,6 +659,7 @@ void A_SpawnMultiple(int spriteNum, int tileNum, int spawnCnt) } } +#ifndef EDUKE32_STANDALONE void A_DoGuts(int spriteNum, int tileNum, int spawnCnt) { uspritetype const *const pSprite = (uspritetype *)&sprite[spriteNum]; @@ -716,6 +717,7 @@ void A_DoGutsDir(int spriteNum, int tileNum, int spawnCnt) sprite[i].pal = s->pal; } } +#endif LUNATIC_EXTERN int32_t G_ToggleWallInterpolation(int32_t wallNum, int32_t setInterpolation) { @@ -1587,8 +1589,10 @@ ACTOR_STATIC void G_MoveFallers(void) if ((sector[sectNum].floorz-pSprite->z) < ZOFFSET2) { +#ifndef EDUKE32_STANDALONE for (size_t x = 0, x_end = 1+(krand()&7); x < x_end; ++x) RANDOMSCRAP(pSprite, spriteNum); +#endif DELETE_SPRITE_AND_CONTINUE(spriteNum); } } @@ -2217,9 +2221,11 @@ DETONATE: pSprite->z -= ZOFFSET5; +#ifndef EDUKE32_STANDALONE if (pSprite->xrepeat) for (bsize_t x=0; x<8; x++) RANDOMSCRAP(pSprite, spriteNum); +#endif if ((pData[3] == 1 && pSprite->xrepeat) || (int16_t)pSprite->lotag == -99) { @@ -4987,9 +4993,10 @@ DETONATEB: pData[0] = 1; // static pSprite->cstat = 32768; +#ifndef EDUKE32_STANDALONE for (bssize_t x = 0; x < 5; x++) RANDOMSCRAP(pSprite, spriteNum); - +#endif goto next_sprite; } } @@ -6833,10 +6840,10 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 DELETE_SPRITE_AND_CONTINUE(spriteNum); } - +#ifndef EDUKE32_STANDALONE if (pData[2] == 4 && pSprite->ang != 512) for (x=0; x<7; x++) RANDOMSCRAP(pSprite, spriteNum); - +#endif break; @@ -7751,11 +7758,12 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 } break; +#ifndef EDUKE32_STANDALONE case SE_33_QUAKE_DEBRIS: if (g_earthquakeTime > 0 && (krand()&7) == 0) RANDOMSCRAP(pSprite, spriteNum); break; - +#endif case SE_36_PROJ_SHOOTER: if (pData[0]) { diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 7fee03b51..da14fb97d 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -7036,6 +7036,7 @@ int G_DoMoveThings(void) return 0; } +#ifndef EDUKE32_STANDALONE void A_SpawnWallGlass(int spriteNum, int wallNum, int glassCnt) { if (wallNum < 0) @@ -7147,6 +7148,7 @@ void A_SpawnRandomGlass(int spriteNum, int wallNum, int glassCnt) sprite[k].pal = krand() & 7; } } +#endif static void G_SetupGameButtons(void) { diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index bf8541fe5..c80a0ace9 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1036,13 +1036,14 @@ static void VM_Fall(int const spriteNum, spritetype * const pSprite) { // I'm guessing this DRONE check is from a beta version of the game // where they crashed into the ground when killed +#ifndef EDUKE32_STANDALONE if (!(pSprite->picnum == APLAYER && pSprite->extra > 0) && pSprite->pal != 1 && pSprite->picnum != DRONE) { A_DoGuts(spriteNum,JIBS6,15); A_PlaySound(SQUISHED,spriteNum); A_Spawn(spriteNum,BLOODPOOL); } - +#endif actor[spriteNum].picnum = SHOTSPARK1; actor[spriteNum].extra = 1; pSprite->zvel = 0; @@ -2187,33 +2188,52 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop) case CON_LOTSOFGLASS: insptr++; +#ifndef EDUKE32_STANDALONE A_SpawnGlass(vm.spriteNum, *insptr++); +#else + insptr++; +#endif continue; case CON_SPAWNWALLGLASS: insptr++; { +#ifndef EDUKE32_STANDALONE int const wallNum = Gv_GetVarX(*insptr++); int const numShards = Gv_GetVarX(*insptr++); A_SpawnWallGlass(vm.spriteNum, wallNum, numShards); +#else + Gv_GetVarX(*insptr++); + Gv_GetVarX(*insptr++); +#endif } continue; case CON_SPAWNWALLSTAINEDGLASS: insptr++; { +#ifndef EDUKE32_STANDALONE int const wallNum = Gv_GetVarX(*insptr++); int const numShards = Gv_GetVarX(*insptr++); A_SpawnRandomGlass(vm.spriteNum, wallNum, numShards); +#else + Gv_GetVarX(*insptr++); + Gv_GetVarX(*insptr++); +#endif } continue; case CON_SPAWNCEILINGGLASS: insptr++; { +#ifndef EDUKE32_STANDALONE int const sectNum = Gv_GetVarX(*insptr++); int const numShards = Gv_GetVarX(*insptr++); A_SpawnCeilingGlass(vm.spriteNum, sectNum, numShards); +#else + Gv_GetVarX(*insptr++); + Gv_GetVarX(*insptr++); +#endif } continue; @@ -4019,7 +4039,9 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop) continue; case CON_GUTS: +#ifndef EDUKE32_STANDALONE A_DoGuts(vm.spriteNum, *(insptr + 1), *(insptr + 2)); +#endif insptr += 3; continue; diff --git a/source/duke3d/src/macros.h b/source/duke3d/src/macros.h index b552c1f21..003ad631d 100644 --- a/source/duke3d/src/macros.h +++ b/source/duke3d/src/macros.h @@ -30,8 +30,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define WIN_IS_PRESSED ( KB_KeyPressed( sc_RightWin ) || KB_KeyPressed( sc_LeftWin ) ) #define ALT_IS_PRESSED ( KB_KeyPressed( sc_RightAlt ) || KB_KeyPressed( sc_LeftAlt ) ) #define SHIFTS_IS_PRESSED ( KB_KeyPressed( sc_RightShift ) || KB_KeyPressed( sc_LeftShift ) ) + +#ifndef EDUKE32_STANDALONE #define RANDOMSCRAP(s, i) A_InsertSprite(s->sectnum,s->x+(krand()&255)-128,s->y+(krand()&255)-128,s->z-ZOFFSET3-(krand()&8191),\ SCRAP6+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-512-(krand()&2047),i,5) +#endif #define GTFLAGS(x) (g_gametypeFlags[ud.coop] & x) diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index c2594db9f..bb06e7590 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -113,8 +113,10 @@ void P_QuickKill(DukePlayer_t * const pPlayer) sprite[pPlayer->i].extra = 0; sprite[pPlayer->i].cstat |= 32768; +#ifndef EDUKE32_STANDALONE if (ud.god == 0) A_DoGuts(pPlayer->i,JIBS6,8); +#endif } static void A_DoWaterTracers(vec3_t startPos, vec3_t const *endPos, int n, int16_t sectNum) @@ -5418,6 +5420,7 @@ HORIZONLY:; } } +#ifndef EDUKE32_STANDALONE if (pPlayer->knee_incs > 0) { pPlayer->q16horiz -= F16(48); @@ -5435,7 +5438,6 @@ HORIZONLY:; A_DoGuts(pPlayer->actorsqu, JIBS6, 7); A_Spawn(pPlayer->actorsqu, BLOODPOOL); A_PlaySound(SQUISHED, pPlayer->actorsqu); - switch (DYNAMICTILEMAP(sprite[pPlayer->actorsqu].picnum)) { case FEM1__STATIC: @@ -5477,6 +5479,7 @@ HORIZONLY:; getangle(sprite[pPlayer->actorsqu].x - pPlayer->pos.x, sprite[pPlayer->actorsqu].y - pPlayer->pos.y)) >> 2); } +#endif if (P_DoCounters(playerNum)) return; diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index d647a7fd6..0700a6d83 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -1478,9 +1478,13 @@ void G_ActivateBySector(int sectNum, int spriteNum) static void G_BreakWall(int tileNum, int spriteNum, int wallNum) { wall[wallNum].picnum = tileNum; +#ifndef EDUKE32_STANDALONE A_PlaySound(VENT_BUST,spriteNum); A_PlaySound(GLASS_HEAVYBREAK,spriteNum); A_SpawnWallGlass(spriteNum,wallNum,10); +#else + UNREFERENCED_PARAMETER(spriteNum); +#endif } void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int weaponNum) @@ -1500,10 +1504,12 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w { if (pWall->nextwall == -1 || wall[pWall->nextwall].pal != 4) { +#ifndef EDUKE32_STANDALONE A_SpawnWallGlass(spriteNum, wallNum, 70); + A_PlaySound(GLASS_HEAVYBREAK, spriteNum); +#endif pWall->cstat &= ~16; pWall->overpicnum = MIRRORBROKE; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); return; } } @@ -1523,10 +1529,12 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w #endif if (pWall->nextwall == -1 || wall[pWall->nextwall].pal != 4) { +#ifndef EDUKE32_STANDALONE A_SpawnWallGlass(spriteNum, wallNum, 70); + A_PlaySound(GLASS_HEAVYBREAK, spriteNum); +#endif pWall->cstat &= ~16; pWall->overpicnum = MIRRORBROKE; - A_PlaySound(GLASS_HEAVYBREAK, spriteNum); return; } } @@ -1653,9 +1661,11 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w case SCREENBREAK18__STATIC: case SCREENBREAK19__STATIC: case BORNTOBEWILDSCREEN__STATIC: +#ifndef EDUKE32_STANDALONE A_SpawnWallGlass(spriteNum, wallNum, 30); - pWall->picnum = W_SCREENBREAK + (krand() % 3); A_PlaySound(GLASS_HEAVYBREAK, spriteNum); +#endif + pWall->picnum = W_SCREENBREAK + (krand() % 3); return; case W_TECHWALL5__STATIC: @@ -1715,8 +1725,10 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w case TECHLIGHT2__STATIC: case TECHLIGHT4__STATIC: { +#ifndef EDUKE32_STANDALONE A_PlaySound(rnd(128) ? GLASS_HEAVYBREAK : GLASS_BREAKING, spriteNum); A_SpawnWallGlass(spriteNum, wallNum, 30); +#endif if (pWall->picnum == WALLLIGHT1) pWall->picnum = WALLLIGHTBUST1; @@ -1839,10 +1851,11 @@ void Sect_DamageCeiling_Internal(int const spriteNum, int const sectNum) if (0) { #endif - GLASSBREAK_CODE: + GLASSBREAK_CODE: +#ifndef EDUKE32_STANDALONE A_SpawnCeilingGlass(g_player[myconnectindex].ps->i, sectNum, 10); A_PlaySound(GLASS_BREAKING, g_player[screenpeek].ps->i); - +#endif if (sector[sectNum].hitag == 0) { for (bssize_t SPRITES_OF_SECT(sectNum, i)) @@ -1913,6 +1926,7 @@ void A_DamageObject_Internal(int spriteNum, int const dmgSrc) if (sector[SECT(spriteNum)].floorpicnum == FANSHADOW) sector[SECT(spriteNum)].floorpicnum = FANSHADOWBROKE; +#ifndef EDUKE32_STANDALONE A_PlaySound(GLASS_HEAVYBREAK, spriteNum); for (bssize_t j=16; j>0; j--) @@ -1920,7 +1934,7 @@ void A_DamageObject_Internal(int spriteNum, int const dmgSrc) spritetype * const pSprite = &sprite[spriteNum]; RANDOMSCRAP(pSprite, spriteNum); } - +#endif break; #ifndef EDUKE32_STANDALONE