From 354d7f6366d11628030bcfde9186fc6e1c819f9a Mon Sep 17 00:00:00 2001 From: Robert Špalek Date: Sun, 8 Nov 2009 03:16:22 +0000 Subject: Debugged smooth walking except for 1 bug. Adjusting to the edge is done such that it respects slight sideways movements of the dragon. Fixed rounding issues in the whole game. Improved debug messages. Made sure that the dragon does not turn like crazy around when clicking on the same pixel: the final point is always the clicked one although the middle points made by shifted to make the animations smooth, and preserve the dragons direction if he has not walked. There is a bug with running turning animations as they seem to disappear for 1 frame and have incorrect Z coordinate. Will investigate it next. svn-id: r45742 --- engines/draci/sprite.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'engines/draci/sprite.cpp') diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index 32c4044e4e..64374e70e3 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -114,10 +114,6 @@ Sprite::~Sprite() { } } -// Macro to simulate lround() for non-C99 compilers -// TODO: get rid of it -static inline long scummvm_lround(double val) { return (long)floor(val + 0.5); } - int Sprite::getPixel(int x, int y, const Displacement &displacement) const { Common::Rect rect = getRect(displacement); @@ -262,8 +258,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 + (int) (_scaledWidth * displacement.extraScaleX), - _y + displacement.relY + (int) (_scaledHeight * displacement.extraScaleY)); + _x + displacement.relX + scummvm_lround(_scaledWidth * displacement.extraScaleX), + _y + displacement.relY + scummvm_lround(_scaledHeight * displacement.extraScaleY)); } Text::Text(const Common::String &str, const Font *font, byte fontColour, -- cgit v1.2.3