mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-17 23:44:22 +00:00
Created a macro for lround(), for non-C99 compilers, and used that in places where lround() is used
svn-id: r44337
This commit is contained in:
parent
adaf3ec8b4
commit
e296cef9be
@ -88,6 +88,9 @@ enum {
|
||||
kDraciAnimationDebugLevel = 1 << 4
|
||||
};
|
||||
|
||||
// Macro to simulate lround() for non-C99 compilers
|
||||
static inline long scummvm_lround(double val) { return (long)floor(val + 0.5); }
|
||||
|
||||
} // End of namespace Draci
|
||||
|
||||
#endif // DRACI_H
|
||||
|
@ -1045,8 +1045,8 @@ void Game::walkHero(int x, int y) {
|
||||
uint height = frame->getHeight();
|
||||
uint width = frame->getWidth();
|
||||
|
||||
_persons[kDragonObject]._x = x + (floor(scaleX) * width) / 2;
|
||||
_persons[kDragonObject]._y = y - floor(scaleY) * height;
|
||||
_persons[kDragonObject]._x = x + (scummvm_lround(scaleX) * width) / 2;
|
||||
_persons[kDragonObject]._y = y - scummvm_lround(scaleY) * height;
|
||||
|
||||
// Set the per-animation scaling factor
|
||||
anim->setScaleFactors(scaleX, scaleY);
|
||||
|
@ -140,8 +140,8 @@ int Sprite::getPixel(int x, int y) const {
|
||||
double scaleX = double(_scaledWidth) / _width;
|
||||
double scaleY = double(_scaledHeight) / _height;
|
||||
|
||||
int sy = floor(dy * scaleY);
|
||||
int sx = floor(dx * scaleX);
|
||||
int sy = scummvm_lround(dy * scaleY);
|
||||
int sx = scummvm_lround(dx * scaleX);
|
||||
|
||||
if (_mirror)
|
||||
return _data[sy * _width + (_width - sx)];
|
||||
@ -190,11 +190,11 @@ void Sprite::drawScaled(Surface *surface, bool markDirty) const {
|
||||
|
||||
// Precalculate pixel indexes
|
||||
for (int i = 0; i < rows; ++i) {
|
||||
rowIndices[i] = floor(i / scaleY);
|
||||
rowIndices[i] = scummvm_lround(i / scaleY);
|
||||
}
|
||||
|
||||
for (int j = 0; j < columns; ++j) {
|
||||
columnIndices[j] = floor(j / scaleX);
|
||||
columnIndices[j] = scummvm_lround(j / scaleX);
|
||||
}
|
||||
|
||||
// Blit the sprite to the surface
|
||||
|
Loading…
x
Reference in New Issue
Block a user