diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index c02139ba6..a12050e03 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -132,9 +132,8 @@ inline void copyfloorpal(spritetype* spr, const sectortype* sect) if (!lookups.noFloorPal(sect->floorpal)) spr->pal = sect->floorpal; } -inline void spriteSetSlope(int spritenum, int heinum) +inline void spriteSetSlope(spritetype* spr, int heinum) { - auto spr = &sprite[spritenum]; int cstat = spr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK; if (spr->cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR) { @@ -144,9 +143,8 @@ inline void spriteSetSlope(int spritenum, int heinum) } } -inline int spriteGetSlope(int spritenum) +inline int spriteGetSlope(spritetype* spr) { - 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/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 3f4a3274d..3f90a5a41 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -4399,7 +4399,7 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) { case 0: return condCmp((pSpr->ang & 2047), arg1, arg2, cmpOp); case 5: return condCmp(pSpr->statnum, arg1, arg2, cmpOp); case 6: return ((pSpr->flags & kHitagRespawn) || pSpr->statnum == kStatRespawn); - case 7: return condCmp(spriteGetSlope(pSpr->index), arg1, arg2, cmpOp); + case 7: return condCmp(spriteGetSlope(pSpr), arg1, arg2, cmpOp); case 10: return condCmp(pSpr->clipdist, arg1, arg2, cmpOp); case 15: if (!spriRangeIsFine(pSpr->owner)) return false; @@ -6474,7 +6474,7 @@ void sprite2sectorSlope(spritetype* pSprite, sectortype* pSector, char rel, bool break; } - spriteSetSlope(pSprite->index, slope); + spriteSetSlope(pSprite, slope); if (forcez) pSprite->z = z; } @@ -6613,7 +6613,7 @@ void useSlopeChanger(XSPRITE* pXSource, int objType, int objIndex) { } break; default: - spriteSetSlope(objIndex, slope); + spriteSetSlope(pSpr, slope); break; } }