From 6a4049e33c605461a817361b9402071dd0846742 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 31 Oct 2021 15:54:02 +0100 Subject: [PATCH] - SetupSpriteForBreak, extra sprite flags as enum --- source/games/sw/src/break.cpp | 3 ++- source/games/sw/src/break.h | 2 +- source/games/sw/src/game.h | 44 ++++++++++++++++++--------------- source/games/sw/src/jweapon.cpp | 6 +++-- source/games/sw/src/sprite.cpp | 2 +- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index 4cb7b615c..766f82e25 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -493,8 +493,9 @@ BREAK_INFOp SetupWallForBreak(WALLp wallp) return break_info; } -BREAK_INFOp SetupSpriteForBreak(SPRITEp sp) +BREAK_INFOp SetupSpriteForBreak(DSWActor* actor) { + auto sp = &actor->s(); short picnum = sp->picnum; BREAK_INFOp break_info; diff --git a/source/games/sw/src/break.h b/source/games/sw/src/break.h index f755d7867..6e1e9140b 100644 --- a/source/games/sw/src/break.h +++ b/source/games/sw/src/break.h @@ -49,7 +49,7 @@ BREAK_INFOp FindWallBreakInfo(short picnum); BREAK_INFOp FindSpriteBreakInfo(short picnum); void SortBreakInfo(void); BREAK_INFOp SetupWallForBreak(WALLp wallp); -BREAK_INFOp SetupSpriteForBreak(SPRITEp sp); +BREAK_INFOp SetupSpriteForBreak(DSWActor* actor); short FindBreakSpriteMatch(short match); bool HitBreakWall(WALLp wp, int, int, int, short ang, short type); int HitBreakSprite(short BreakSprite, short type); diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index f64e89c18..3c354b6fb 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1279,31 +1279,35 @@ struct USERSAVE }; -// sprite->extra flags -// BUILD AND GAME - DO NOT MOVE THESE -#define SPRX_SKILL (BIT(0) | BIT(1) | BIT(2)) +enum +{ + // sprite->extra flags + // BUILD AND GAME - DO NOT MOVE THESE + SPRX_SKILL = (BIT(0) | BIT(1) | BIT(2)), -// BIT(4) ST1 BUILD AND GAME -#define SPRX_STAY_PUT_VATOR (BIT(5)) // BUILD AND GAME - will not move with vators etc -// DO NOT MOVE THIS + // BIT(4) ST1 BUILD AND GAME + SPRX_STAY_PUT_VATOR = (BIT(5)), // BUILD AND GAME - will not move with vators etc + // DO NOT MOVE THIS -#define SPRX_STAG (BIT(6)) // BUILD AND GAME - NON-ST1 sprite with ST1 type tagging -// DO NOT MOVE + SPRX_STAG = (BIT(6)), // BUILD AND GAME - NON-ST1 sprite with ST1 type tagging + // DO NOT MOVE -#define SPRX_QUEUE_SPRITE (BIT(7)) // Queue sprite -check queue when deleting -#define SPRX_MULTI_ITEM (BIT(9)) // BUILD AND GAME - multi player item + SPRX_QUEUE_SPRITE = (BIT(7)), // Queue sprite -check queue when deleting + SPRX_MULTI_ITEM = (BIT(9)), // BUILD AND GAME - multi player item -// have users - could be moved -#define SPRX_PLAYER_OR_ENEMY (BIT(11)) // for checking quickly if sprite is a -// player or actor -// do not need Users -#define SPRX_FOUND (BIT(12)) // BUILD ONLY INTERNAL - used for finding sprites -#define SPRX_BLADE (BIT(12)) // blade sprite -#define SPRX_BREAKABLE (BIT(13)) // breakable items -#define SPRX_BURNABLE (BIT(14)) // used for burnable sprites in the game + // have users - could be moved + SPRX_PLAYER_OR_ENEMY = (BIT(11)), // for checking quickly if sprite is a + // player or actor + // do not need Users + SPRX_FOUND = (BIT(12)), // BUILD ONLY INTERNAL - used for finding sprites + SPRX_BLADE = (BIT(12)), // blade sprite + SPRX_BREAKABLE = (BIT(13)), // breakable items + SPRX_BURNABLE = (BIT(14)), // used for burnable sprites in the game + + // temp use + SPRX_BLOCK = (BIT(15)), // BUILD AND GAME +}; -// temp use -#define SPRX_BLOCK (BIT(15)) // BUILD AND GAME // BUILD - tell which actors should not spawn // GAME - used for internal game code // ALT-M debug mode diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 1a73b2fe1..5a04e302a 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1827,6 +1827,7 @@ PlayerInitCaltrops(PLAYERp pp) w = SpawnSprite(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursectnum, nx, ny, nz, pp->angle.ang.asbuild(), (CHEMBOMB_VELOCITY + RandomRange(CHEMBOMB_VELOCITY)) / 2); + auto spawnedActor = &swActors[w]; wp = &sprite[w]; wu = User[w].Data(); @@ -1878,7 +1879,7 @@ PlayerInitCaltrops(PLAYERp pp) // wu->WaitTics = CHEMTICS*5; // } - SetupSpriteForBreak(wp); // Put Caltrops in the break queue + SetupSpriteForBreak(spawnedActor); // Put Caltrops in the break queue return 0; } @@ -1904,6 +1905,7 @@ InitCaltrops(int16_t SpriteNum) w = SpawnSprite(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, sp->sectnum, nx, ny, nz, sp->ang, CHEMBOMB_VELOCITY / 2); + auto spawnedActor = &swActors[w]; wp = &sprite[w]; wu = User[w].Data(); @@ -1929,7 +1931,7 @@ InitCaltrops(int16_t SpriteNum) wu->ychange = MOVEy(wp->xvel, wp->ang); wu->zchange = wp->zvel >> 1; - SetupSpriteForBreak(wp); // Put Caltrops in the break queue + SetupSpriteForBreak(spawnedActor); // Put Caltrops in the break queue return 0; } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index e3d5d3825..2c86e6d93 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1934,7 +1934,7 @@ SpriteSetup(void) else { // BREAK SETUP TABLE AUTOMATED - SetupSpriteForBreak(sp); + SetupSpriteForBreak(actor); } if (sp->lotag == TAG_SPRITE_HIT_MATCH)