diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index f6bfe3bd0..3a27c27aa 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -33,9 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static DBloodActor* actDropObject(DBloodActor* actor, int nType); - - VECTORDATA gVectorData[] = { // this is constant EXCEPT for [VECTOR_TYPE_20].maxDist. What were they thinking... // Tine @@ -2894,7 +2891,7 @@ static DBloodActor* actDropFlag(DBloodActor* actor, int nType) // //--------------------------------------------------------------------------- -static DBloodActor* actDropObject(DBloodActor* actor, int nType) +DBloodActor* actDropObject(DBloodActor* actor, int nType) { DBloodActor* act2 = nullptr; @@ -2969,7 +2966,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType) pSprite->pal = 0; aiGenDudeNewState(pSprite, &genDudeBurnGoto); - actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); + actHealDude(actor, dudeInfo[55].startHealth, dudeInfo[55].startHealth); if (pXSprite->burnTime <= 0) pXSprite->burnTime = 1200; actor->dudeExtra.time = PlayClock + 360; return true; @@ -2991,10 +2988,10 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType) aiSetGenIdleState(pSprite, pXSprite); // set idle state if (pXSprite->key > 0) // drop keys - actDropObject(pSprite, kItemKeyBase + pXSprite->key - 1); + actDropObject(actor, kItemKeyBase + pXSprite->key - 1); if (pXSprite->dropMsg > 0) // drop items - actDropObject(pSprite, pXSprite->dropMsg); + actDropObject(actor, pXSprite->dropMsg); pSprite->flags &= ~kPhysMove; xvel[pSprite->index] = yvel[pSprite->index] = 0; @@ -5076,14 +5073,14 @@ void MoveDude(DBloodActor* actor) { case kDudeCultistTommy: case kDudeCultistShotgun: - aiNewState(&bloodActors[pXSprite->reference], &cultistGoto); + aiNewState(actor, &cultistGoto); break; case kDudeGillBeast: - aiNewState(&bloodActors[pXSprite->reference], &gillBeastGoto); + aiNewState(actor, &gillBeastGoto); pSprite->flags |= 6; break; case kDudeBoneEel: - actKillDude(pSprite->index, pSprite, kDamageFall, 1000 << 4); + actKillDude(actor, actor, kDamageFall, 1000 << 4); break; } @@ -5176,7 +5173,7 @@ void MoveDude(DBloodActor* actor) case kDudeBat: case kDudeRat: case kDudeBurningInnocent: - actKillDude(pSprite->index, pSprite, kDamageFall, 1000 << 4); + actKillDude(actor, actor, kDamageFall, 1000 << 4); break; } @@ -5667,7 +5664,7 @@ void actActivateGibObject(DBloodActor* actor) if (gib2 > 0) GibSprite(pSprite, (GIBTYPE)(gib2 - 1), nullptr, nullptr); if (gib3 > 0 && pXSprite->burnTime > 0) GibSprite(pSprite, (GIBTYPE)(gib3 - 1), nullptr, nullptr); if (sound > 0) sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, sound, pSprite->sectnum); - if (dropmsg > 0) actDropObject(pSprite, dropmsg); + if (dropmsg > 0) actDropObject(actor, dropmsg); if (!(pSprite->cstat & 32768) && !(pSprite->flags & kHitagRespawn)) actPostSprite(actor, kStatFree); @@ -7404,22 +7401,6 @@ void SerializeActor(FSerializer& arc) } } -spritetype* actDropObject(spritetype* pSprite, int nType) -{ - auto act = actDropObject(&bloodActors[pSprite->index], nType); - return act ? &act->s() : nullptr; -} - -bool actHealDude(XSPRITE* pXDude, int a2, int a3) -{ - return actHealDude(&bloodActors[pXDude->reference], a2, a3); -} - -void actKillDude(int a1, spritetype* pSprite, DAMAGE_TYPE a3, int a4) -{ - actKillDude(&bloodActors[a1], &bloodActors[pSprite->index], a3, a4); -} - int actDamageSprite(int nSource, spritetype* pSprite, DAMAGE_TYPE damageType, int damage) { return actDamageSprite(nSource == -1 ? nullptr : &bloodActors[nSource], &bloodActors[pSprite->index], damageType, damage); diff --git a/source/games/blood/src/actor.h b/source/games/blood/src/actor.h index 7c1d43d52..45ee2d9d9 100644 --- a/source/games/blood/src/actor.h +++ b/source/games/blood/src/actor.h @@ -220,11 +220,9 @@ void actInit(bool bSaveLoad); int actWallBounceVector(int *x, int *y, int nWall, int a4); int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5); void actRadiusDamage(DBloodActor* source, int x, int y, int z, int nSector, int nDist, int a7, int a8, DAMAGE_TYPE a9, int a10, int a11); -spritetype *actDropObject(spritetype *pSprite, int nType); +DBloodActor *actDropObject(DBloodActor *pSprite, int nType); bool actHealDude(DBloodActor* pXDude, int a2, int a3); -bool actHealDude(XSPRITE *pXDude, int a2, int a3); void actKillDude(DBloodActor* a1, DBloodActor* pSprite, DAMAGE_TYPE a3, int a4); -void actKillDude(int a1, spritetype *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); diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 4f605171d..a9a41dbd2 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -991,14 +991,14 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType pSprite->pal = 0; aiGenDudeNewState(pSprite, &genDudeBurnGoto); - actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); + actHealDude(actor, dudeInfo[55].startHealth, dudeInfo[55].startHealth); actor->dudeExtra.time = PlayClock + 360; evKill(nSprite, 3, kCallbackFXFlameLick); } } else { - actKillDude(nSource, pSprite, kDamageFall, 65535); + actKillDude(actor, actor, kDamageFall, 65535); } } else if (canWalk(pSprite) && !inDodge(pXSprite->aiState) && !inRecoil(pXSprite->aiState)) { @@ -1056,7 +1056,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); actor->dudeExtra.time = PlayClock+360; - actHealDude(pXSprite, dudeInfo[40].startHealth, dudeInfo[40].startHealth); + actHealDude(actor, dudeInfo[40].startHealth, dudeInfo[40].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } break; @@ -1067,7 +1067,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType aiNewState(actor, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); actor->dudeExtra.time = PlayClock+360; - actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); + actHealDude(actor, dudeInfo[39].startHealth, dudeInfo[39].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } break; @@ -1103,7 +1103,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1); pSprite->type = kDudeBurningZombieButcher; aiNewState(actor, &zombieFBurnGoto); - actHealDude(pXSprite, dudeInfo[42].startHealth, dudeInfo[42].startHealth); + actHealDude(actor, dudeInfo[42].startHealth, dudeInfo[42].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } break; @@ -1122,7 +1122,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType } aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); actor->dudeExtra.time = PlayClock+360; - actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); + actHealDude(actor, dudeInfo[39].startHealth, dudeInfo[39].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } break; @@ -1132,7 +1132,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType pSprite->type = kDudeBeast; aiPlay3DSound(pSprite, 9008, AI_SFX_PRIORITY_1, -1); aiNewState(actor, &beastMorphFromCultist); - actHealDude(pXSprite, dudeInfo[51].startHealth, dudeInfo[51].startHealth); + actHealDude(actor, dudeInfo[51].startHealth, dudeInfo[51].startHealth); } break; case kDudeZombieAxeNormal: @@ -1143,7 +1143,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1); pSprite->type = kDudeBurningZombieAxe; aiNewState(actor, &zombieABurnGoto); - actHealDude(pXSprite, dudeInfo[41].startHealth, dudeInfo[41].startHealth); + actHealDude(actor, dudeInfo[41].startHealth, dudeInfo[41].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } break; diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index fbf402447..617bdc133 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -535,19 +535,17 @@ static void gargThinkChase(DBloodActor* actor) static void entryFStatue(DBloodActor* actor) { - auto pXSprite = &actor->x(); auto pSprite = &actor->s(); DUDEINFO *pDudeInfo = &dudeInfo[6]; - actHealDude(pXSprite, pDudeInfo->startHealth, pDudeInfo->startHealth); + actHealDude(actor, pDudeInfo->startHealth, pDudeInfo->startHealth); pSprite->type = kDudeGargoyleFlesh; } static void entrySStatue(DBloodActor* actor) { - auto pXSprite = &actor->x(); auto pSprite = &actor->s(); DUDEINFO *pDudeInfo = &dudeInfo[7]; - actHealDude(pXSprite, pDudeInfo->startHealth, pDudeInfo->startHealth); + actHealDude(actor, pDudeInfo->startHealth, pDudeInfo->startHealth); pSprite->type = kDudeGargoyleStone; } diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 0d086a955..d4030052e 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -656,7 +656,7 @@ static void unicultThinkChase(DBloodActor* actor) if (CheckProximity(pSprite, pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pExpl->radius >> 1)) { xvel[pSprite->index] = zvel[pSprite->index] = yvel[pSprite->index] = 0; if (doExplosion(pSprite, nType) && pXSprite->health > 0) - actDamageSprite(pSprite->index, pSprite, kDamageExplode, 65535); + actDamageSprite(&bloodActors[pSprite->index], &bloodActors[pSprite->index], kDamageExplode, 65535); } return; } @@ -1228,7 +1228,7 @@ void removeDudeStuff(spritetype* pSprite) { while ((nSprite = it.NextIndex()) >= 0) { if (sprite[nSprite].owner != pSprite->index) continue; - actDamageSprite(sprite[nSprite].owner, &sprite[nSprite], (DAMAGE_TYPE) 0, 65535); + actDamageSprite(&bloodActors[sprite[nSprite].owner], &bloodActors[nSprite], (DAMAGE_TYPE) 0, 65535); } } @@ -1259,7 +1259,7 @@ void removeLeech(spritetype* pLeech, bool delSprite) { void killDudeLeech(spritetype* pLeech) { if (pLeech != NULL) { - actDamageSprite(pLeech->owner, pLeech, kDamageExplode, 65535); + actDamageSprite(&bloodActors[pLeech->owner], &bloodActors[pLeech->index], kDamageExplode, 65535); sfxPlay3DSoundCP(pLeech, 522, -1, 0, 60000); if (pLeech->owner >= 0 && pLeech->owner < kMaxSprites) diff --git a/source/games/blood/src/bloodactor.h b/source/games/blood/src/bloodactor.h index 13cae5993..526ab7a66 100644 --- a/source/games/blood/src/bloodactor.h +++ b/source/games/blood/src/bloodactor.h @@ -208,6 +208,11 @@ inline void PLAYER::setFragger(DBloodActor* actor) fraggerId = actor == nullptr ? -1 : actor->s().index; } +inline DBloodActor* PLAYER::actor() +{ + return &bloodActors[pSprite->index]; +} + // Wrapper around the insane collision info mess from Build. struct Collision diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index be2dbb6a7..4a2321154 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -602,6 +602,7 @@ void sub_76A08(spritetype *pSprite, spritetype *pSprite2, PLAYER *pPlayer) // ?? void DropVoodooCb(int nSprite) // unused { + auto actor = &bloodActors[nSprite]; spritetype *pSprite = &sprite[nSprite]; int nOwner = pSprite->owner; if (nOwner < 0 || nOwner >= kMaxSprites) @@ -637,6 +638,7 @@ void DropVoodooCb(int nSprite) // unused int nNextSprite = it.PeekIndex(); if (nOwner == nSprite2) continue; + auto actor2 = &bloodActors[nSprite2]; spritetype *pSprite2 = &sprite[nSprite2]; int nXSprite2 = pSprite2->extra; if (nXSprite2 > 0 && nXSprite2 < kMaxXSprites) @@ -660,7 +662,7 @@ void DropVoodooCb(int nSprite) // unused t += ((3200-pPlayer2->armor[2])<<15)/3200; if (Chance(t) || nNextSprite < 0) { - int nDmg = actDamageSprite(nOwner, pSprite2, kDamageSpirit, pXSprite->data1<<4); + int nDmg = actDamageSprite(actor, actor2, kDamageSpirit, pXSprite->data1<<4); pXSprite->data1 = ClipLow(pXSprite->data1-nDmg, 0); sub_76A08(pSprite2, pSprite, pPlayer2); evPost(nSprite, 3, 0, kCallbackRemove); diff --git a/source/games/blood/src/messages.cpp b/source/games/blood/src/messages.cpp index 630be9550..5446d3600 100644 --- a/source/games/blood/src/messages.cpp +++ b/source/games/blood/src/messages.cpp @@ -304,7 +304,7 @@ const char* GameInterface::GenericCheat(int player, int cheat) SetToys(true); break; case kCheatKevorkian: - actDamageSprite(gMe->nSprite, gMe->pSprite, kDamageBullet, 8000); + actDamageSprite(gMe->actor(), gMe->actor(), kDamageBullet, 8000); return GStrings("TXTB_KEVORKIAN"); case kCheatMcGee: @@ -315,12 +315,12 @@ const char* GameInterface::GenericCheat(int player, int cheat) return GStrings("TXTB_FIRED"); } case kCheatEdmark: - actDamageSprite(gMe->nSprite, gMe->pSprite, kDamageExplode, 8000); + actDamageSprite(gMe->actor(), gMe->actor(), kDamageExplode, 8000); return GStrings("TXTB_THEDAYS"); case kCheatKrueger: { - actHealDude(gMe->pXSprite, 200, 200); + actHealDude(gMe->actor(), 200, 200); gMe->armor[1] = VanillaMode() ? 200 : 3200; if (!gMe->pXSprite->burnTime) evPost(gMe->nSprite, 3, 0, kCallbackFXFlameLick); @@ -334,7 +334,7 @@ const char* GameInterface::GenericCheat(int player, int cheat) gMe->flickerEffect = 360; break; case kCheatSpork: - actHealDude(gMe->pXSprite, 200, 200); + actHealDude(gMe->actor(), 200, 200); break; case kCheatClarice: for (int i = 0; i < 3; i++) @@ -383,7 +383,7 @@ const char* GameInterface::GenericCheat(int player, int cheat) SetWooMode(true); break; case kCheatCousteau: - actHealDude(gMe->pXSprite, 200, 200); + actHealDude(gMe->actor(), 200, 200); gMe->packSlots[1].curAmount = 100; if (!VanillaMode()) gMe->pwUpTime[kPwUpDivingSuit] = gPowerUpInfo[kPwUpDivingSuit].bonusTime; @@ -507,7 +507,7 @@ static void cmd_Give(int player, uint8_t **stream, bool skip) break; case GIVE_HEALTH: - actHealDude(gMe->pXSprite, 200, 200); + actHealDude(gMe->actor(), 200, 200); bPlayerCheated = true; break; diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index d7ad0a5c7..1fced1c09 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -936,14 +936,19 @@ int randomGetDataValue(XSPRITE* pXSprite, int randType) { } // this function drops random item using random pickup generator(s) -spritetype* randomDropPickupObject(spritetype* pSource, short prevItem) { +spritetype* randomDropPickupObject(spritetype* pSource, short prevItem) +{ + auto actor = &bloodActors[pSource->index]; + spritetype* pSprite2 = NULL; int selected = -1; int maxRetries = 9; if (xspriRangeIsFine(pSource->extra)) { XSPRITE* pXSource = &xsprite[pSource->extra]; while ((selected = randomGetDataValue(pXSource, kRandomizeItem)) == prevItem) if (maxRetries-- <= 0) break; - if (selected > 0) { - pSprite2 = actDropObject(pSource, selected); - if (pSprite2 != NULL) { + if (selected > 0) + { + DBloodActor* spawned = actDropObject(actor, selected); + if (spawned) { + pSprite2 = &spawned->s(); pXSource->dropMsg = uint8_t(pSprite2->type); // store dropped item type in dropMsg pSprite2->x = pSource->x; @@ -3006,7 +3011,7 @@ void damageSprites(XSPRITE* pXSource, spritetype* pSprite) { if (dmgType >= kDmgFall) { if (dmg < (int)pXSprite->health << 4) { - + if (!nnExtIsImmune(pSprite, dmgType, 0)) { if (pPlayer) { @@ -3016,24 +3021,25 @@ void damageSprites(XSPRITE* pXSource, spritetype* pSprite) { actDamageSprite(pSource->index, pSprite, (DAMAGE_TYPE)dmgType, dmg); for (int i = 0; i < 3; pPlayer->armor[i] = armor[i], i++); - } else { + } + else { actDamageSprite(pSource->index, pSprite, (DAMAGE_TYPE)dmgType, dmg); } - } else { - - Printf(PRINT_HIGH, "Dude type %d is immune to damage type %d!", pSprite->type, dmgType); - } + else { + + Printf(PRINT_HIGH, "Dude type %d is immune to damage type %d!", pSprite->type, dmgType); } - else if (!pPlayer) actKillDude(pSource->index, pSprite, (DAMAGE_TYPE)dmgType, dmg); + } + else if (!pPlayer) actKillDude(&bloodActors[pSource->index], &bloodActors[pSprite->index], (DAMAGE_TYPE)dmgType, dmg); else playerDamageSprite(&bloodActors[pSource->index], pPlayer, (DAMAGE_TYPE)dmgType, dmg); } else if ((pXSprite->health = ClipLow(health, 1)) > 16); - else if (!pPlayer) actKillDude(pSource->index, pSprite, kDamageBullet, dmg); + else if (!pPlayer) actKillDude(&bloodActors[pSource->index], &bloodActors[pSprite->index], kDamageBullet, dmg); else playerDamageSprite(&bloodActors[pSource->index], pPlayer, kDamageBullet, dmg); if (pXSprite->health > 0) { @@ -5061,7 +5067,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite switch (cmd) { case 36: - actHealDude(pPlayer->pXSprite, ((pXSprite->data2 > 0) ? ClipHigh(pXSprite->data2, 200) : getDudeInfo(pPlayer->pSprite->type)->startHealth), 200); + actHealDude(pPlayer->actor(), ((pXSprite->data2 > 0) ? ClipHigh(pXSprite->data2, 200) : getDudeInfo(pPlayer->pSprite->type)->startHealth), 200); pPlayer->curWeapon = kWeapPitchFork; break; } @@ -5874,7 +5880,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) { // heal dude a bit in case of friendly fire int startHp = (pXSprite->sysData2 > 0) ? ClipRange(pXSprite->sysData2 << 4, 1, 65535) : pDudeInfo->startHealth << 4; - if (pXSprite->health < (unsigned)startHp) actHealDude(pXSprite, receiveHp, startHp); + if (pXSprite->health < (unsigned)startHp) actHealDude(&bloodActors[pXSprite->reference], receiveHp, startHp); } else if (xsprite[pBurnSource->extra].health <= 0) { pXSprite->burnTime = 0; } @@ -5934,11 +5940,11 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) { // heal dude int startHp = (pXSprite->sysData2 > 0) ? ClipRange(pXSprite->sysData2 << 4, 1, 65535) : pDudeInfo->startHealth << 4; - if (pXSprite->health < (unsigned)startHp) actHealDude(pXSprite, receiveHp, startHp); + if (pXSprite->health < (unsigned)startHp) actHealDude(&bloodActors[pXSprite->reference], receiveHp, startHp); // heal mate startHp = (pXMate->sysData2 > 0) ? ClipRange(pXMate->sysData2 << 4, 1, 65535) : getDudeInfo(pMate->type)->startHealth << 4; - if (pXMate->health < (unsigned)startHp) actHealDude(pXMate, receiveHp, startHp); + if (pXMate->health < (unsigned)startHp) actHealDude(&bloodActors[pXMate->reference], receiveHp, startHp); if (pXMate->target > -1 && sprite[pXMate->target].extra >= 0) { pTarget = &sprite[pXMate->target]; diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index fd1eb332c..f8eb1c058 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -486,7 +486,7 @@ void packUseItem(PLAYER *pPlayer, int nPack) if (health < 100) { int heal = ClipHigh(100-health, pPlayer->packSlots[0].curAmount); - actHealDude(pXSprite, heal, 100); + actHealDude(pPlayer->actor(), heal, 100); pPlayer->packSlots[0].curAmount -= heal; } break; @@ -1078,7 +1078,7 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) { addPower = xsprite[sprite[pItem->index].extra].data1; #endif - if (!actHealDude(pXSprite, addPower, gPowerUpInfo[nType].maxTime)) return 0; + if (!actHealDude(pPlayer->actor(), addPower, gPowerUpInfo[nType].maxTime)) return 0; return 1; } case kItemHealthDoctorBag: @@ -1901,13 +1901,14 @@ int playerDamageArmor(PLAYER *pPlayer, DAMAGE_TYPE nType, int nDamage) spritetype *flagDropped(PLAYER *pPlayer, int a2) { + auto actor = pPlayer->actor(); char buffer[80]; spritetype *pSprite = NULL; switch (a2) { case kItemFlagA: pPlayer->hasFlag &= ~1; - pSprite = actDropObject(pPlayer->pSprite, kItemFlagA); + pSprite = &actDropObject(actor, kItemFlagA)->s(); if (pSprite) pSprite->owner = pPlayer->used2[0]; gBlueFlagDropped = true; @@ -1917,7 +1918,7 @@ spritetype *flagDropped(PLAYER *pPlayer, int a2) break; case kItemFlagB: pPlayer->hasFlag &= ~2; - pSprite = actDropObject(pPlayer->pSprite, kItemFlagB); + pSprite = &actDropObject(actor, kItemFlagB)->s(); if (pSprite) pSprite->owner = pPlayer->used2[1]; gRedFlagDropped = true; @@ -2163,7 +2164,7 @@ void PlayerSurvive(int, DBloodActor* actor) XSPRITE* pXSprite = &actor->x(); spritetype* pSprite = &actor->s(); char buffer[80]; - actHealDude(pXSprite, 1, 2); + actHealDude(actor, 1, 2); if (gGameOptions.nGameType > 0 && numplayers > 1) { sfxPlay3DSound(pSprite, 3009, 0, 6); diff --git a/source/games/blood/src/player.h b/source/games/blood/src/player.h index 1c0cfca62..86efd89eb 100644 --- a/source/games/blood/src/player.h +++ b/source/games/blood/src/player.h @@ -81,6 +81,7 @@ extern POSTURE gPostureDefaults[kModeMax][kPostureMax]; struct PLAYER { + DBloodActor* actor(); spritetype* pSprite; XSPRITE* pXSprite; DUDEINFO* pDudeInfo;