From 207298aeb4d4ebf30be9ecdcc697b84d4dec45d7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 2 Jun 2021 21:00:39 +0200 Subject: [PATCH] - fixed compilation (again.) --- source/core/gamecontrol.h | 18 ------------------ source/core/gamefuncs.h | 18 ++++++++++++++++++ source/games/blood/src/ai.cpp | 10 +++++----- source/games/blood/src/nnexts.cpp | 2 +- source/games/blood/src/nnexts.h | 1 - source/games/blood/src/player.cpp | 11 ++++++----- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index 58a1c085e..0ae7ef89a 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -250,21 +250,3 @@ enum gameaction_t : int ga_fullconsole, }; extern gameaction_t gameaction; - -inline void spriteSetSlope(int spritenum, int heinum) -{ - auto spr = &sprite[spritenum]; - int cstat = spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK; - if (spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) - { - spr->xoffset = heinum & 255; - spr->yoffset = (heinum >> 8) & 255; - spr->cstat = (spr->cstat & ~CSTAT_SPRITE_ALIGNMENT_MASK) | (heinum != 0 ? CSTAT_SPRITE_ALIGNMENT_SLOPE : CSTAT_SPRITE_ALIGNMENT_FLOOR); - } -} - -inline int spriteGetSlope(int spritenum) -{ - auto spr = &sprite[spritenum]; - return ((spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_SLOPE)? 0 : uint8_t(spr->xoffset) + (uint8_t(spr->yoffset) << 8); -} diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 0f5d0a8a8..a6f790c6e 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -123,3 +123,21 @@ inline void copyfloorpal(spritetype* spr, const sectortype* sect) { if (!lookups.noFloorPal(sect->floorpal)) spr->pal = sect->floorpal; } + +inline void spriteSetSlope(int spritenum, int heinum) +{ + auto spr = &sprite[spritenum]; + int cstat = spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK; + if (spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) + { + spr->xoffset = heinum & 255; + spr->yoffset = (heinum >> 8) & 255; + spr->cstat = (spr->cstat & ~CSTAT_SPRITE_ALIGNMENT_MASK) | (heinum != 0 ? CSTAT_SPRITE_ALIGNMENT_SLOPE : CSTAT_SPRITE_ALIGNMENT_FLOOR); + } +} + +inline int spriteGetSlope(int spritenum) +{ + auto spr = &sprite[spritenum]; + return ((spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_SLOPE) ? 0 : uint8_t(spr->xoffset) + (uint8_t(spr->yoffset) << 8); +} diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 54db86be1..ca09bafb2 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -914,7 +914,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType if (!pPlayer) return nDamage; if (powerupCheck(pPlayer, kPwUpShadowCloak)) pPlayer->pwUpTime[kPwUpShadowCloak] = 0; if (readyForCrit(pSource, pSprite)) { - nDamage += aiDamageSprite(pSprite, pXSprite, pSource->index, nDmgType, nDamage * (10 - gGameOptions.nDifficulty)); + nDamage += aiDamageSprite(actor, source, nDmgType, nDamage * (10 - gGameOptions.nDifficulty)); if (pXSprite->health > 0) { int fullHp = (pXSprite->sysData2 > 0) ? ClipRange(pXSprite->sysData2 << 4, 1, 65535) : getDudeInfo(pSprite->type)->startHealth << 4; if (((100 * pXSprite->health) / fullHp) <= 75) { @@ -931,9 +931,9 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType if (pSprite->type == kDudeModernCustomBurning) { - if (Chance(0x2000) && gDudeExtra[pSprite->extra].time < (int)gFrameClock) { + if (Chance(0x2000) && gDudeExtra[pSprite->extra].time < PlayClock) { playGenDudeSound(pSprite, kGenDudeSndBurning); - gDudeExtra[pSprite->extra].time = (int)gFrameClock + 360; + gDudeExtra[pSprite->extra].time = PlayClock + 360; } if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400; @@ -953,7 +953,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType GENDUDEEXTRA* pExtra = genDudeExtra(pSprite); if (nDmgType == DAMAGE_TYPE_1) { - if (pXSprite->health > pDudeInfo->fleeHealth) return nDamage; + if (pXSprite->health > (uint32_t)pDudeInfo->fleeHealth) return nDamage; else if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == NULL) { removeDudeStuff(pSprite); @@ -979,7 +979,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType aiGenDudeNewState(pSprite, &genDudeBurnGoto); actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); - gDudeExtra[pSprite->extra].time = (int)gFrameClock + 360; + gDudeExtra[pSprite->extra].time = PlayClock + 360; evKill(nSprite, 3, kCallbackFXFlameLick); } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 3672c836d..05df71cbc 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1206,7 +1206,7 @@ void debrisBubble(int nSprite) { int top, bottom; GetSpriteExtents(pSprite, &top, &bottom); - for (int i = 0; i < 1 + Random(5); i++) { + for (unsigned i = 0; i < 1 + Random(5); i++) { int nDist = (pSprite->xrepeat * (tileWidth(pSprite->picnum) >> 1)) >> 2; int nAngle = Random(2048); diff --git a/source/games/blood/src/nnexts.h b/source/games/blood/src/nnexts.h index 2fc0a345d..46a6ca4c0 100644 --- a/source/games/blood/src/nnexts.h +++ b/source/games/blood/src/nnexts.h @@ -394,4 +394,3 @@ int sectorInMotion(int nSector); //////////////////////////////////////////////////////////////////////////////////// END_BLD_NS -#endif diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index a7716d34c..13deb1fa0 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1893,6 +1893,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage spritetype *pSprite = pPlayer->pSprite; XSPRITE *pXSprite = pPlayer->pXSprite; + auto pActor = &bloodActors[pSprite->index]; int nXSprite = pSprite->extra; int nXSector = sector[pSprite->sectnum].extra; DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); @@ -2022,9 +2023,9 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage // allow drop items and keys in multiplayer if (gModernMap && gGameOptions.nGameType != 0 && pPlayer->pXSprite->health <= 0) { - spritetype* pItem = NULL; - if (pPlayer->pXSprite->dropMsg && (pItem = actDropItem(pPlayer->pSprite, pPlayer->pXSprite->dropMsg)) != NULL) - evPost(pItem->index, OBJ_SPRITE, 500, kCallbackRemove); + DBloodActor* pItem = nullptr; + if (pPlayer->pXSprite->dropMsg && (pItem = actDropItem(pActor, pPlayer->pXSprite->dropMsg)) != NULL) + evPost(pItem, 500, kCallbackRemove); if (pPlayer->pXSprite->key) { @@ -2034,8 +2035,8 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage break; } - if (i == 0 && (pItem = actDropKey(pPlayer->pSprite, (pPlayer->pXSprite->key + kItemKeyBase) - 1)) != NULL) - evPost(pItem->index, OBJ_SPRITE, 500, kCallbackRemove); + if (i == 0 && (pItem = actDropKey(pActor, (pPlayer->pXSprite->key + kItemKeyBase) - 1)) != NULL) + evPost(pItem, 500, kCallbackRemove); }