[Scummvm-git-logs] scummvm master -> 7d912924c8b790b2401871ebd9e1304bf3dbca46
bluegr
noreply at scummvm.org
Fri Apr 29 22:16:11 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7d912924c8 DRACI: Remove scummvm_lround() workaround
Commit: 7d912924c8b790b2401871ebd9e1304bf3dbca46
https://github.com/scummvm/scummvm/commit/7d912924c8b790b2401871ebd9e1304bf3dbca46
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-04-30T01:16:05+03:00
Commit Message:
DRACI: Remove scummvm_lround() workaround
This was used for non-C99 compilers, but ScummVM now requires C++11
which implies it. The sparc64 compiler/assembler on OpenBSD would
also complain about "Illegal operands" with this version.
Changed paths:
engines/draci/animation.cpp
engines/draci/draci.h
engines/draci/game.cpp
engines/draci/sprite.cpp
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp
index e13aa3241f1..d2938f31168 100644
--- a/engines/draci/animation.cpp
+++ b/engines/draci/animation.cpp
@@ -64,8 +64,8 @@ void Animation::setRelative(int relx, int rely) {
Displacement Animation::getCurrentFrameDisplacement() const {
Displacement dis = _displacement;
- dis.relX += scummvm_lround(dis.extraScaleX * _shift.x);
- dis.relY += scummvm_lround(dis.extraScaleY * _shift.y);
+ dis.relX += lround(dis.extraScaleX * _shift.x);
+ dis.relY += lround(dis.extraScaleY * _shift.y);
return dis;
}
diff --git a/engines/draci/draci.h b/engines/draci/draci.h
index 662774a353a..71c3e3a9972 100644
--- a/engines/draci/draci.h
+++ b/engines/draci/draci.h
@@ -117,9 +117,6 @@ enum {
kDraciWalkingDebugLevel = 1 << 6
};
-// 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_DRACI_H
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 3d001fb50fd..e2b03affdf5 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -381,10 +381,10 @@ void Game::handleOrdinaryLoop(int x, int y) {
}
int Game::inventoryPositionFromMouse() const {
- const int column = CLIP(scummvm_lround(
+ const int column = CLIP(lround(
(_vm->_mouse->getPosX() - kInventoryX + kInventoryItemWidth / 2.) /
kInventoryItemWidth) - 1, 0L, (long) kInventoryColumns - 1);
- const int line = CLIP(scummvm_lround(
+ const int line = CLIP(lround(
(_vm->_mouse->getPosY() - kInventoryY + kInventoryItemHeight / 2.) /
kInventoryItemHeight) - 1, 0L, (long) kInventoryLines - 1);
return line * kInventoryColumns + column;
@@ -1495,8 +1495,8 @@ void Game::positionAnimAsHero(Animation *anim) {
// click but sprites are drawn from their top-left corner so we subtract
// the current height of the dragon's sprite
Common::Point p = _hero;
- p.x -= scummvm_lround(scale * frame->getWidth() / 2);
- p.y -= scummvm_lround(scale * frame->getHeight());
+ p.x -= lround(scale * frame->getWidth() / 2);
+ p.y -= lround(scale * frame->getHeight());
// Since _persons[] is used for placing talking text, we use the non-adjusted x value
// so the text remains centered over the dragon.
@@ -1533,8 +1533,8 @@ void Game::positionHeroAsAnim(Animation *anim) {
// used in positionAnimAsHero() and even rounding errors are exactly
// the same.
Drawable *frame = anim->getCurrentFrame();
- _hero.x += scummvm_lround(anim->getScaleX() * frame->getWidth() / 2);
- _hero.y += scummvm_lround(anim->getScaleY() * frame->getHeight());
+ _hero.x += lround(anim->getScaleX() * frame->getWidth() / 2);
+ _hero.y += lround(anim->getScaleY() * frame->getHeight());
}
void Game::pushNewRoom() {
diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp
index 8fec2033b59..e43fbf9cf0a 100644
--- a/engines/draci/sprite.cpp
+++ b/engines/draci/sprite.cpp
@@ -119,8 +119,8 @@ int Sprite::getPixel(int x, int y, const Displacement &displacement) const {
double scaleX = double(rect.width()) / _width;
double scaleY = double(rect.height()) / _height;
- int sy = scummvm_lround(dy / scaleY);
- int sx = scummvm_lround(dx / scaleX);
+ int sy = lround(dy / scaleY);
+ int sx = lround(dx / scaleX);
if (_mirror)
return _data[sy * _width + (_width - sx)];
@@ -244,8 +244,8 @@ void Sprite::draw(Surface *surface, bool markDirty, int relX, int relY) const {
Common::Rect Sprite::getRect(const Displacement &displacement) const {
return Common::Rect(_x + displacement.relX, _y + displacement.relY,
- _x + displacement.relX + scummvm_lround(_scaledWidth * displacement.extraScaleX),
- _y + displacement.relY + scummvm_lround(_scaledHeight * displacement.extraScaleY));
+ _x + displacement.relX + lround(_scaledWidth * displacement.extraScaleX),
+ _y + displacement.relY + lround(_scaledHeight * displacement.extraScaleY));
}
Text::Text(const Common::String &str, const Font *font, byte fontColor,
More information about the Scummvm-git-logs
mailing list