Fix scaled things

This commit is contained in:
Pk11
2021-01-14 12:35:56 -06:00
parent ca9dc8250b
commit e663a46a57
3 changed files with 43 additions and 41 deletions
+8 -8
View File
@@ -159,11 +159,11 @@ void Sprite::drawImage(int x, int y, const Image &image, float scaleX, float sca
}
}
} else {
for(float i = 0.0f; i < image.height(); i += 1 / scaleY) {
for(float j = 0.0f; j < image.width(); j += 1 / scaleX) {
u16 px = image.palette()[image.bitmap()[int(i * image.width() + j)] - image.palOfs()];
for(int i = 0; i < image.height() * scaleY; i++) {
for(int j = 0; j < image.width() * scaleX; j++) {
u16 px = image.palette()[image.bitmap()[int(i / scaleY) * image.width() + int(j / scaleX)] - image.palOfs()];
if(px & 0x8000)
toncset16(_gfx + int((y + i) * _height + j) + x, px, 1);
toncset16(_gfx + (y + i) * _height + j + x, px, 1);
}
}
}
@@ -181,11 +181,11 @@ void Sprite::drawImageSegment(int x, int y, int imageX, int imageY, int w, int h
}
}
} else {
for(float i = 0; i < h; i += 1 / scaleX) {
for(float j = 0; j < image.width(); j += 1 / scaleY) {
u16 px = image.palette()[image.bitmap()[(imageY + i) * image.width() + imageX + j] - image.palOfs()];
for(int i = 0; i < h * scaleY; i++) {
for(int j = 0; j < w * scaleX; j++) {
u16 px = image.palette()[image.bitmap()[(imageY + int(i / scaleY)) * image.width() + imageX + int(j / scaleX)] - image.palOfs()];
if(px & 0x8000)
toncset16(_gfx + int((y + i) * _height + x + j), px, 1);
toncset16(_gfx + (y + i) * _height + x + j, px, 1);
}
}
}