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
This commit is contained in:
terminx 2019-09-17 03:20:16 +00:00 committed by Christoph Oelckers
parent 1b12de0037
commit ea66e1a8ee
3 changed files with 16 additions and 18 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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");
}
@ -1309,6 +1316,7 @@ static void Gv_AddSystemVars(void)
// SYSTEM_GAMEARRAY
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);