From f712a674cec13a3bc5270cae0fcbfef0477b12c5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 16 Sep 2021 21:36:34 +0200 Subject: [PATCH] - removed the few remaining uses of actDamageSprite_. --- source/games/blood/src/actor.cpp | 5 ----- source/games/blood/src/actor.h | 1 - source/games/blood/src/nnexts.cpp | 23 +++++++++++++++-------- source/games/blood/src/weapon.cpp | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 6c39f2912..55f4de11e 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -7404,11 +7404,6 @@ void SerializeActor(FSerializer& arc) } // dumping ground for temporary wrappers. -int actDamageSprite_(int nSource, spritetype* pSprite, DAMAGE_TYPE damageType, int damage) -{ - return actDamageSprite(nSource == -1 ? nullptr : &bloodActors[nSource], &bloodActors[pSprite->index], damageType, damage); -} - void actPostSprite(int nSprite, int nStatus) { actPostSprite(&bloodActors[nSprite], nStatus); diff --git a/source/games/blood/src/actor.h b/source/games/blood/src/actor.h index 06e1afaba..f6d3c0825 100644 --- a/source/games/blood/src/actor.h +++ b/source/games/blood/src/actor.h @@ -223,7 +223,6 @@ void actRadiusDamage(DBloodActor* source, int x, int y, int z, int nSector, int DBloodActor *actDropObject(DBloodActor *pSprite, int nType); bool actHealDude(DBloodActor* pXDude, int a2, int a3); void actKillDude(DBloodActor* a1, DBloodActor* pSprite, DAMAGE_TYPE a3, int a4); -int actDamageSprite_(int nSource, spritetype *pSprite, DAMAGE_TYPE a3, int a4); int actDamageSprite(DBloodActor* pSource, DBloodActor* pTarget, DAMAGE_TYPE damageType, int damage); void actHitcodeToData(int a1, HITINFO *pHitInfo, DBloodActor **actor, walltype **a7 = nullptr); void actAirDrag(DBloodActor *pSprite, int a2); diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 31e2da2ac..1b85b5fab 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1480,9 +1480,13 @@ int debrisGetFreeIndex(void) { return -1; } -void debrisConcuss(int nOwner, int listIndex, int x, int y, int z, int dmg) { +void debrisConcuss(int nOwner, int listIndex, int x, int y, int z, int dmg) +{ + auto owner = &bloodActors[nOwner]; spritetype* pSprite = (gPhysSpritesList[listIndex] >= 0) ? &sprite[gPhysSpritesList[listIndex]] : NULL; - if (pSprite != NULL && xspriRangeIsFine(pSprite->extra)) { + if (pSprite != NULL && xspriRangeIsFine(pSprite->extra)) + { + auto actor = &bloodActors[pSprite->index]; int dx = pSprite->x - x; int dy = pSprite->y - y; int dz = (pSprite->z - z) >> 4; dmg = scale(0x40000, dmg, 0x40000 + dx * dx + dy * dy + dz * dz); bool thing = (pSprite->type >= kThingBase && pSprite->type < kThingMax); @@ -1500,7 +1504,7 @@ void debrisConcuss(int nOwner, int listIndex, int x, int y, int z, int dmg) { pSprite->statnum = kStatThing; // temporary change statnum property } - actDamageSprite_(nOwner, pSprite, kDamageExplode, dmg); + actDamageSprite(owner, actor, kDamageExplode, dmg); if (thing) pSprite->statnum = kStatDecoration; // return statnum property back @@ -2985,15 +2989,18 @@ void useSpriteDamager(XSPRITE* pXSource, int objType, int objIndex) { } } -void damageSprites(XSPRITE* pXSource, spritetype* pSprite) { +void damageSprites(XSPRITE* pXSource, spritetype* pSprite) +{ auto actor = &bloodActors[pSprite->index]; - spritetype* pSource = &sprite[pXSource->reference]; + auto sourceactor = &bloodActors[pXSource->reference]; + spritetype* pSource = &sourceactor->s(); if (!IsDudeSprite(pSprite) || !xspriRangeIsFine(pSprite->extra) || xsprite[pSprite->extra].health <= 0 || pXSource->data3 < 0) return; int health = 0; - XSPRITE* pXSprite = &xsprite[pSprite->extra]; PLAYER* pPlayer = getPlayerById(pSprite->type); + XSPRITE* pXSprite = &xsprite[pSprite->extra]; + PLAYER* pPlayer = getPlayerById(pSprite->type); int dmgType = (pXSource->data2 >= kDmgFall) ? ClipHigh(pXSource->data2, kDmgElectric) : -1; int dmg = pXSprite->health << 4; int armor[3]; @@ -3017,13 +3024,13 @@ void damageSprites(XSPRITE* pXSource, spritetype* pSprite) { playerDamageArmor(pPlayer, (DAMAGE_TYPE)dmgType, dmg); for (int i = 0; i < 3; armor[i] = pPlayer->armor[i], pPlayer->armor[i] = 0, i++); - actDamageSprite_(pSource->index, pSprite, (DAMAGE_TYPE)dmgType, dmg); + actDamageSprite(sourceactor, actor, (DAMAGE_TYPE)dmgType, dmg); for (int i = 0; i < 3; pPlayer->armor[i] = armor[i], i++); } else { - actDamageSprite_(pSource->index, pSprite, (DAMAGE_TYPE)dmgType, dmg); + actDamageSprite(sourceactor, actor, (DAMAGE_TYPE)dmgType, dmg); } diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index aa16e3ac1..a7286cd98 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -1728,7 +1728,7 @@ void AltFireLifeLeech(int , PLAYER *pPlayer) int nAmmo = pPlayer->ammoCount[8]; if (nAmmo < 25 && pPlayer->pXSprite->health > unsigned((25-nAmmo)<<4)) { - actDamageSprite_(pPlayer->nSprite, pPlayer->pSprite, kDamageSpirit, ((25-nAmmo)<<4)); + actDamageSprite(actor, actor, kDamageSpirit, ((25-nAmmo)<<4)); nAmmo = 25; } pXSprite->data3 = nAmmo;