Use fixed point number for XSPRITE scaling

This commit is contained in:
nukeykt 2019-08-17 11:19:48 +09:00 committed by Christoph Oelckers
parent 0dcca3583f
commit 38f2fd209f
2 changed files with 4 additions and 6 deletions

View file

@ -431,13 +431,13 @@ bool isShrinked(spritetype* pSprite) {
}
bool shrinkPlayerSize(PLAYER* pPlayer, int divider) {
pPlayer->pXSprite->scale = -divider;
pPlayer->pXSprite->scale = 256/divider;
playerSetRace(pPlayer, kModeHumanShrink);
return true;
}
bool growPlayerSize(PLAYER* pPlayer, int multiplier) {
pPlayer->pXSprite->scale = multiplier;
pPlayer->pXSprite->scale = 256*multiplier;
playerSetRace(pPlayer, kModeHumanGrown);
return true;
}

View file

@ -108,14 +108,12 @@ void UpdateSprite(int nXSprite, SEQFRAME *pFrame)
int scale = xsprite[nXSprite].scale; // SEQ size scaling
if (pFrame->at2_0) {
if (scale < 0) pSprite->xrepeat = pFrame->at2_0 / abs(scale);
else if (scale > 0) pSprite->xrepeat = pFrame->at2_0 * scale;
if (scale) pSprite->xrepeat = mulscale8(pFrame->at2_0, scale);
else pSprite->xrepeat = pFrame->at2_0;
}
if (pFrame->at3_0) {
if (scale < 0) pSprite->yrepeat = pFrame->at3_0 / abs(scale);
else if (scale > 0) pSprite->yrepeat = pFrame->at3_0 * scale;
if (scale) pSprite->yrepeat = mulscale8(pFrame->at3_0, scale);
else pSprite->yrepeat = pFrame->at3_0;
}