From 38f2fd209f7af5357470c9994dbf49101729ea54 Mon Sep 17 00:00:00 2001 From: nukeykt Date: Sat, 17 Aug 2019 11:19:48 +0900 Subject: [PATCH] Use fixed point number for XSPRITE scaling --- source/blood/src/player.cpp | 4 ++-- source/blood/src/seq.cpp | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index 99cdf1ba7..9f0680212 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -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; } diff --git a/source/blood/src/seq.cpp b/source/blood/src/seq.cpp index 156fadb9b..8527a07bb 100644 --- a/source/blood/src/seq.cpp +++ b/source/blood/src/seq.cpp @@ -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; }