diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 6383daa29..df1381857 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2953,7 +2953,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType) if (pExtra->weaponType == kGenDudeWeaponKamikaze && Chance(0x4000) && damageType != kDamageSpirit && damageType != kDamageDrown) { doExplosion(pSprite, pXSprite->data1 - kTrapExploder); - if (Chance(0x9000)) damageType = (DAMAGE_TYPE)3; + if (Chance(0x9000)) damageType = kDamageExplode; } if (damageType == kDamageBurn) @@ -3966,7 +3966,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) { int nOwner = pMissile->owner; int nDamage = (15 + Random(7)) << 4; - actDamageSprite_(nOwner, pSpriteHit, kDamageBullet, nDamage); + actDamageSprite(missileOwner, actorHit, kDamageBullet, nDamage); } actPostSprite(missileActor, kStatFree); break; @@ -4276,7 +4276,7 @@ static void checkCeilHit(DBloodActor* actor) int dmg = abs((mass1 - mass2) * (pSprite2->clipdist - pSprite->clipdist)); if (actor2->IsDudeActor()) { - if (dmg > 0) actDamageSprite_(pSprite2->index, pSprite, (Chance(0x2000)) ? kDamageFall : (Chance(0x4000)) ? kDamageExplode : kDamageBullet, dmg); + if (dmg > 0) actDamageSprite(actor2, actor, (Chance(0x2000)) ? kDamageFall : (Chance(0x4000)) ? kDamageExplode : kDamageBullet, dmg); if (Chance(0x0200)) actKickObject(actor2, actor); } } @@ -4475,7 +4475,7 @@ static void checkFloorHit(DBloodActor* actor) } actKickObject(actor, actor2); sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 357, pSprite->sectnum); - actDamageSprite_(-1, pSprite2, kDamageFall, 80); + actDamageSprite(nullptr, actor2, kDamageFall, 80); break; case kTrapSawCircular: if (!pXSprite2->state) actDamageSprite(actor, actor, kDamageBullet, 1); @@ -4874,7 +4874,7 @@ void MoveDude(DBloodActor* actor) { nSector = pSprite->sectnum; if (pSprite->statnum == kStatDude || pSprite->statnum == kStatThing) - actDamageSprite_(pSprite->index, pSprite, kDamageFall, 1000 << 4); + actDamageSprite(actor, actor, kDamageFall, 1000 << 4); } if (sector[nSector].type >= kSectorPath && sector[nSector].type <= kSectorRotate) diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 12bbb851a..5bafdc5f8 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -1230,7 +1230,7 @@ void removeDudeStuff(spritetype* pSprite) { while ((nSprite = it.NextIndex()) >= 0) { if (sprite[nSprite].owner != pSprite->index) continue; - actDamageSprite(&bloodActors[sprite[nSprite].owner], &bloodActors[nSprite], (DAMAGE_TYPE) 0, 65535); + actDamageSprite(&bloodActors[sprite[nSprite].owner], &bloodActors[nSprite], kDamageFall, 65535); } } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 0cf6cba3d..31e2da2ac 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1504,8 +1504,6 @@ void debrisConcuss(int nOwner, int listIndex, int x, int y, int z, int dmg) { if (thing) pSprite->statnum = kStatDecoration; // return statnum property back - - return; } } diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 3469c7d6d..b07b3b2c8 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -268,7 +268,7 @@ char powerupActivate(PLAYER *pPlayer, int nPowerUp) } if (ceilIsTooLow(pPlayer->pSprite)) - actDamageSprite_(pPlayer->pSprite->index, pPlayer->pSprite, kDamageExplode, 65535); + actDamageSprite(pPlayer->actor(), pPlayer->actor(), kDamageExplode, 65535); } break; #endif @@ -316,7 +316,7 @@ void powerupDeactivate(PLAYER *pPlayer, int nPowerUp) if (gModernMap) { playerSizeReset(pPlayer); if (ceilIsTooLow(pPlayer->pSprite)) - actDamageSprite_(pPlayer->pSprite->index, pPlayer->pSprite, kDamageExplode, 65535); + actDamageSprite(pPlayer->actor(), pPlayer->actor(), kDamageExplode, 65535); } break; case kItemShroomGrow: @@ -1654,9 +1654,8 @@ void ProcessInput(PLAYER *pPlayer) void playerProcess(PLAYER *pPlayer) { + auto actor = pPlayer->actor(); spritetype *pSprite = pPlayer->pSprite; - int nSprite = pPlayer->nSprite; - int nXSprite = pSprite->extra; XSPRITE *pXSprite = pPlayer->pXSprite; POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture]; powerupProcess(pPlayer); @@ -1669,28 +1668,28 @@ void playerProcess(PLAYER *pPlayer) { short nSector = pSprite->sectnum; if (pushmove_old(&pSprite->x, &pSprite->y, &pSprite->z, &nSector, dw, dzt, dzb, CLIPMASK0) == -1) - actDamageSprite_(nSprite, pSprite, kDamageFall, 500<<4); + actDamageSprite(actor, actor, kDamageFall, 500<<4); if (pSprite->sectnum != nSector) { if (nSector == -1) { nSector = pSprite->sectnum; - actDamageSprite_(nSprite, pSprite, kDamageFall, 500<<4); + actDamageSprite(actor, actor, kDamageFall, 500<<4); } assert(nSector >= 0 && nSector < kMaxSectors); - ChangeSpriteSect(nSprite, nSector); + ChangeSpriteSect(pSprite->index, nSector); } } ProcessInput(pPlayer); - int nSpeed = approxDist(xvel[nSprite], yvel[nSprite]); - pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, zvel[nSprite], 0x7000); + int nSpeed = approxDist(actor->xvel(), actor->yvel()); + pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->zvel(), 0x7000); int dz = pPlayer->pSprite->z-pPosture->eyeAboveZ-pPlayer->zView; if (dz > 0) pPlayer->zViewVel += MulScale(dz<<8, 0xa000, 16); else pPlayer->zViewVel += MulScale(dz<<8, 0x1800, 16); pPlayer->zView += pPlayer->zViewVel>>8; - pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, zvel[nSprite], 0x5000); + pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->zvel(), 0x5000); dz = pPlayer->pSprite->z-pPosture->weaponAboveZ-pPlayer->zWeapon; if (dz > 0) pPlayer->zWeaponVel += MulScale(dz<<8, 0x8000, 16); @@ -1765,16 +1764,16 @@ void playerProcess(PLAYER *pPlayer) switch (pPlayer->posture) { case 1: - seqSpawn(dudeInfo[nType].seqStartID+9, 3, nXSprite, -1); + seqSpawn(dudeInfo[nType].seqStartID+9, actor, -1); break; case 2: - seqSpawn(dudeInfo[nType].seqStartID+10, 3, nXSprite, -1); + seqSpawn(dudeInfo[nType].seqStartID+10, actor, -1); break; default: if (!nSpeed) - seqSpawn(dudeInfo[nType].seqStartID, 3, nXSprite, -1); + seqSpawn(dudeInfo[nType].seqStartID, actor, -1); else - seqSpawn(dudeInfo[nType].seqStartID+8, 3, nXSprite, -1); + seqSpawn(dudeInfo[nType].seqStartID+8, actor, -1); break; } } diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 8686ed681..ce2a8605e 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -1150,11 +1150,12 @@ int VDoorBusy(unsigned int nSector, unsigned int a2) vbp = -65536/ClipLow((120*pXSector->busyTimeB)/10, 1); int top, bottom; int nSprite = GetCrushedSpriteExtents(nSector,&top,&bottom); + auto actor = &bloodActors[nSprite]; if (nSprite >= 0 && a2 > pXSector->busy) { - spritetype *pSprite = &sprite[nSprite]; + spritetype *pSprite = &actor->s(); assert(pSprite->extra > 0 && pSprite->extra < kMaxXSprites); - XSPRITE *pXSprite = &xsprite[pSprite->extra]; + XSPRITE *pXSprite = &actor->x(); if (pXSector->onCeilZ > pXSector->offCeilZ || pXSector->onFloorZ < pXSector->offFloorZ) { if (pXSector->interruptable) @@ -1168,7 +1169,7 @@ int VDoorBusy(unsigned int nSector, unsigned int a2) nDamage = 500; else nDamage = pXSector->data; - actDamageSprite_(nSprite, &sprite[nSprite], kDamageFall, nDamage<<4); + actDamageSprite(actor, actor, kDamageFall, nDamage<<4); } a2 = ClipRange(a2-(vbp/2)*4, 0, 65536); } @@ -1179,16 +1180,16 @@ int VDoorBusy(unsigned int nSector, unsigned int a2) nDamage = 500; else nDamage = pXSector->data; - actDamageSprite_(nSprite, &sprite[nSprite], kDamageFall, nDamage<<4); + actDamageSprite(actor, actor, kDamageFall, nDamage<<4); a2 = ClipRange(a2-(vbp/2)*4, 0, 65536); } } } else if (nSprite >= 0 && a2 < pXSector->busy) { - spritetype *pSprite = &sprite[nSprite]; + spritetype* pSprite = &actor->s(); assert(pSprite->extra > 0 && pSprite->extra < kMaxXSprites); - XSPRITE *pXSprite = &xsprite[pSprite->extra]; + XSPRITE* pXSprite = &actor->x(); if (pXSector->offCeilZ > pXSector->onCeilZ || pXSector->offFloorZ < pXSector->onFloorZ) { if (pXSector->interruptable) @@ -1202,7 +1203,7 @@ int VDoorBusy(unsigned int nSector, unsigned int a2) nDamage = 500; else nDamage = pXSector->data; - actDamageSprite_(nSprite, &sprite[nSprite], kDamageFall, nDamage<<4); + actDamageSprite(actor, actor, kDamageFall, nDamage<<4); } a2 = ClipRange(a2+(vbp/2)*4, 0, 65536); } @@ -1213,7 +1214,7 @@ int VDoorBusy(unsigned int nSector, unsigned int a2) nDamage = 500; else nDamage = pXSector->data; - actDamageSprite_(nSprite, &sprite[nSprite], kDamageFall, nDamage<<4); + actDamageSprite(actor, actor, kDamageFall, nDamage<<4); a2 = ClipRange(a2+(vbp/2)*4, 0, 65536); } } @@ -1420,15 +1421,15 @@ char SectorContainsDudes(int nSector) void TeleFrag(int nKiller, int nSector) { - int nSprite; - SectIterator it(nSector); - while ((nSprite = it.NextIndex()) >= 0) + auto killer = &bloodActors[nKiller]; + BloodSectIterator it(nSector); + while (auto victim = it.Next()) { - spritetype *pSprite = &sprite[nSprite]; + spritetype *pSprite = &victim->s(); if (pSprite->statnum == kStatDude) - actDamageSprite_(nKiller, pSprite, kDamageExplode, 4000); + actDamageSprite(killer, victim, kDamageExplode, 4000); else if (pSprite->statnum == kStatThing) - actDamageSprite_(nKiller, pSprite, kDamageExplode, 4000); + actDamageSprite(killer, victim, kDamageExplode, 4000); } }