From ea66e1a8ee95ce4c0c217313cc3cf5454b3b8abc Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 17 Sep 2019 03:20:16 +0000 Subject: [PATCH] Expose control over the list of statnums that hitradius will damage to CON git-svn-id: https://svn.eduke32.com/eduke32@8103 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/actors.cpp | 16 +++------------- source/duke3d/src/actors.h | 2 +- source/duke3d/src/gamevars.cpp | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 97fa482ff..80a7da8dc 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # define ACTOR_STATIC static #endif +uint8_t g_radiusDmgStatnums[(MAXSTATUS+7)>>3]; + #define DELETE_SPRITE_AND_CONTINUE(KX) do { A_DeleteSprite(KX); goto next_sprite; } while (0) int32_t otherp; @@ -245,18 +247,6 @@ void A_RadiusDamage(int const spriteNum, int const blastRadius, int const dmg1, uint8_t sectorMap[(MAXSECTORS+7)>>3]; int16_t numSectors; - // TODO: stick this somewhere where we can call Gv_NewArray() on it with GAMEARRAY_BITMAP so scripts can control which statnums are hit - static uint8_t statMap[(MAXSTATUS+7)>>3]; - static int statInit; - - if (!statInit) - { - static int constexpr statnumList[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_MISC, STAT_ZOMBIEACTOR, STAT_FALLER, STAT_PLAYER }; - for (int i = 0; i < ARRAY_SSIZE(statnumList); ++i) - bitmap_set(statMap, statnumList[i]); - statInit = 1; - } - bfirst_search_init(sectorList, sectorMap, &numSectors, MAXSECTORS, pSprite->sectnum); #ifndef EDUKE32_STANDALONE @@ -321,7 +311,7 @@ SKIPWALLCHECK: int const nextSprite = nextspritesect[damageSprite]; auto pDamage = &sprite[damageSprite]; - if (bitmap_test(statMap, pDamage->statnum)) + if (bitmap_test(g_radiusDmgStatnums, pDamage->statnum)) { int const spriteDist = dist(pSprite, pDamage); diff --git a/source/duke3d/src/actors.h b/source/duke3d/src/actors.h index fad3b234f..1dcb1f996 100644 --- a/source/duke3d/src/actors.h +++ b/source/duke3d/src/actors.h @@ -435,7 +435,7 @@ extern int32_t g_noEnemies; extern int32_t otherp; extern int32_t ticrandomseed; extern projectile_t SpriteProjectile[MAXSPRITES]; - +extern uint8_t g_radiusDmgStatnums[(MAXSTATUS+7)>>3]; int A_CheckNoSE7Water(uspriteptr_t pSprite, int sectNum, int sectLotag, int32_t *pOther); int A_CheckSwitchTile(int spriteNum); diff --git a/source/duke3d/src/gamevars.cpp b/source/duke3d/src/gamevars.cpp index 9c2e466f9..0ef77f944 100644 --- a/source/duke3d/src/gamevars.cpp +++ b/source/duke3d/src/gamevars.cpp @@ -897,6 +897,13 @@ void Gv_ResetSystemDefaults(void) if (tile.defproj) *tile.proj = *tile.defproj; + static int constexpr statnumList[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_MISC, STAT_ZOMBIEACTOR, STAT_FALLER, STAT_PLAYER }; + + Bmemset(g_radiusDmgStatnums, 0, sizeof(g_radiusDmgStatnums)); + + for (int i = 0; i < ARRAY_SSIZE(statnumList); ++i) + bitmap_set(g_radiusDmgStatnums, statnumList[i]); + //AddLog("EOF:ResetWeaponDefaults"); } @@ -1308,10 +1315,11 @@ static void Gv_AddSystemVars(void) # endif // SYSTEM_GAMEARRAY - Gv_NewArray("gotpic", (void *)&gotpic[0], MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP); - Gv_NewArray("show2dsector", (void *)&show2dsector[0], MAXSECTORS, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP); - Gv_NewArray("tilesizx", (void *)&tilesiz[0].x, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_STRIDE2 | GAMEARRAY_READONLY | GAMEARRAY_INT16); - Gv_NewArray("tilesizy", (void *)&tilesiz[0].y, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_STRIDE2 | GAMEARRAY_READONLY | GAMEARRAY_INT16); + Gv_NewArray("gotpic", (void *)&gotpic[0], MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP); + Gv_NewArray("radiusdmgstatnums", (void *)&g_radiusDmgStatnums[0], MAXSTATUS, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP); + Gv_NewArray("show2dsector", (void *)&show2dsector[0], MAXSECTORS, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP); + Gv_NewArray("tilesizx", (void *)&tilesiz[0].x, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_STRIDE2 | GAMEARRAY_READONLY | GAMEARRAY_INT16); + Gv_NewArray("tilesizy", (void *)&tilesiz[0].y, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_STRIDE2 | GAMEARRAY_READONLY | GAMEARRAY_INT16); #endif }