From 2b443c2eace0805d9f7331882d64369bd85b6814 Mon Sep 17 00:00:00 2001 From: Alexey Khokholov Date: Tue, 10 Sep 2019 05:25:53 +0900 Subject: [PATCH] Account for 16384 sprites for sprite owner value --- source/blood/src/actor.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 0fdcc4941..b51378e90 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -2471,8 +2471,8 @@ int actSpriteOwnerToSpriteId(spritetype *pSprite) dassert(pSprite != NULL); if (pSprite->owner == -1) return -1; - int nSprite = pSprite->owner & 0xfff; - if (pSprite->owner & 0x1000) + int nSprite = pSprite->owner & (kMaxSprites-1); + if (pSprite->owner & kMaxSprites) nSprite = gPlayer[nSprite].pSprite->index; return nSprite; } @@ -2481,7 +2481,7 @@ void actPropagateSpriteOwner(spritetype *pTarget, spritetype *pSource) { dassert(pTarget != NULL && pSource != NULL); if (IsPlayerSprite(pSource)) - pTarget->owner = (pSource->type-kDudePlayer1) | 0x1000; + pTarget->owner = (pSource->type-kDudePlayer1) | kMaxSprites; else pTarget->owner = pSource->index; } @@ -2493,7 +2493,7 @@ int actSpriteIdToOwnerId(int nSprite) dassert(nSprite >= 0 && nSprite < kMaxSprites); spritetype *pSprite = &sprite[nSprite]; if (IsPlayerSprite(pSprite)) - nSprite = (pSprite->type-kDudePlayer1) | 0x1000; + nSprite = (pSprite->type-kDudePlayer1) | kMaxSprites; return nSprite; } @@ -2501,8 +2501,8 @@ int actOwnerIdToSpriteId(int nSprite) { if (nSprite == -1) return -1; - if (nSprite & 0x1000) - nSprite = gPlayer[nSprite&0xfff].pSprite->index; + if (nSprite & kMaxSprites) + nSprite = gPlayer[nSprite&(kMaxSprites-1)].pSprite->index; return nSprite; }