mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-05 00:36:57 +00:00
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.
This commit is contained in:
parent
ffe8506ed1
commit
7d912924c8
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user