- spriteGetSlope/spriteSetSlope take spritetype pointer arguments.

This commit is contained in:
Christoph Oelckers 2021-10-13 19:11:34 +02:00
parent c32ff483a9
commit b7465ab67b
2 changed files with 5 additions and 7 deletions

View file

@ -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);
}

View file

@ -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;
}
}