diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 46712e91..7c796d64 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -13,7 +13,7 @@ SET(BUILD_REVISION "custom" CACHE "Git revision string (intended for releases)" # set debug as default build type IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE Debug) + SET(CMAKE_BUILD_TYPE RelWithDebInfo) ENDIF() # setup compiler options diff --git a/src/framework/math/size.h b/src/framework/math/size.h index f87523ea..5ef9f6ce 100644 --- a/src/framework/math/size.h +++ b/src/framework/math/size.h @@ -56,8 +56,8 @@ public: TSize& operator*=(const TSize& other) { wd=(T)other.wd*wd; ht=(T)ht*other.ht; return *this; } TSize operator/(const TSize& other) const { return TSize((T)wd/other.wd, (T)ht/other.ht); } TSize& operator/=(const TSize& other) { (T)wd/=other.wd; (T)ht/=other.ht; return *this; } - TSize operator*(const float v) const { return TSize((T)v*wd, (T)ht*v); } - TSize& operator*=(const float v) { wd=(T)v*wd; ht=(T)ht*v; return *this; } + TSize operator*(const float v) const { return TSize((T)wd*v, (T)ht*v); } + TSize& operator*=(const float v) { wd=(T)wd*v; ht=(T)ht*v; return *this; } TSize operator/(const float v) const { return TSize((T)wd/v, (T)ht/v); } TSize& operator/=(const float v) { wd/=v; ht/=v; return *this; } diff --git a/src/otclient/core/missile.cpp b/src/otclient/core/missile.cpp index 264f62a1..e18169fe 100644 --- a/src/otclient/core/missile.cpp +++ b/src/otclient/core/missile.cpp @@ -63,7 +63,7 @@ void Missile::draw(const Point& dest, float scaleFactor, bool animate) } float fraction = m_animationTimer.ticksElapsed() / m_duration; - m_type->draw(dest + m_delta * fraction * scaleFactor, 0, scaleFactor, xPattern, yPattern, 0, 0); + m_type->draw(dest + m_delta * fraction * scaleFactor, scaleFactor, 0, xPattern, yPattern, 0, 0); } void Missile::setPath(const Position& fromPosition, const Position& toPosition) diff --git a/src/otclient/core/thingtype.cpp b/src/otclient/core/thingtype.cpp index 4fe73b1e..556f8965 100644 --- a/src/otclient/core/thingtype.cpp +++ b/src/otclient/core/thingtype.cpp @@ -37,14 +37,14 @@ ThingType::ThingType() void ThingType::draw(const Point& dest, float scaleFactor, int layer, int xPattern, int yPattern, int zPattern, int animationPhase) { - const TexturePtr& texture = getTexture(animationPhase); // rects might not be calculated yet. + const TexturePtr& texture = getTexture(animationPhase); // texture might not exists, neither its rects. int frameIndex = getTextureIndex(layer, xPattern, yPattern, zPattern); Point textureOffset = m_texturesFramesOffsets[animationPhase][frameIndex]; Rect textureRect = m_texturesFramesRects[animationPhase][frameIndex]; Point displacement(m_parameters[DisplacementX], m_parameters[DisplacementY]); - Rect screenRect(dest - displacement - Point(32 * m_dimensions[Width] * scaleFactor, 32 * m_dimensions[Height] * scaleFactor) + Point(32, 32) + textureOffset, + Rect screenRect(dest + (-displacement + textureOffset - Point(m_dimensions[Width] - 1, m_dimensions[Height] - 1) * Otc::TILE_PIXELS) * scaleFactor, textureRect.size() * scaleFactor); g_painter->setColor(Color::white); @@ -98,7 +98,7 @@ TexturePtr& ThingType::getTexture(int animationPhase) int indexSize = textureLayers * m_dimensions[PatternX] * m_dimensions[PatternY] * m_dimensions[PatternZ]; Size textureSize = getBestDimension(m_dimensions[Width], m_dimensions[Height], indexSize); - ImagePtr fullImage = ImagePtr(new Image(textureSize * 32)); + ImagePtr fullImage = ImagePtr(new Image(textureSize * Otc::TILE_PIXELS)); m_texturesFramesRects[animationPhase].resize(indexSize); m_texturesFramesOffsets[animationPhase].resize(indexSize); @@ -110,7 +110,7 @@ TexturePtr& ThingType::getTexture(int animationPhase) int frameIndex = getTextureIndex(l % textureLayers, x, y, z); Point framePos = Point(frameIndex % (textureSize.width() / m_dimensions[Width]) * m_dimensions[Width], - frameIndex / (textureSize.width() / m_dimensions[Width]) * m_dimensions[Height]) * 32; + frameIndex / (textureSize.width() / m_dimensions[Width]) * m_dimensions[Height]) * Otc::TILE_PIXELS; for(int h = 0; h < m_dimensions[Height]; ++h) { for(int w = 0; w < m_dimensions[Width]; ++w) { @@ -118,16 +118,16 @@ TexturePtr& ThingType::getTexture(int animationPhase) ImagePtr spriteImage = g_sprites.getSpriteImage(m_spritesIndex[spriteIndex]); if(spriteImage) { Point spritePos = Point(m_dimensions[Width] - w - 1, - m_dimensions[Height] - h - 1) * 32; + m_dimensions[Height] - h - 1) * Otc::TILE_PIXELS; fullImage->append(framePos + spritePos, spriteImage); } } } - Rect drawRect(framePos + Point(m_dimensions[Width], m_dimensions[Height]) * 32, framePos); - for(int x = framePos.x; x < framePos.x + m_dimensions[Width] * 32; ++x) { - for(int y = framePos.y; y < framePos.y + m_dimensions[Height] * 32; ++y) { + Rect drawRect(framePos + Point(m_dimensions[Width], m_dimensions[Height]) * Otc::TILE_PIXELS, framePos); + for(int x = framePos.x; x < framePos.x + m_dimensions[Width] * Otc::TILE_PIXELS; ++x) { + for(int y = framePos.y; y < framePos.y + m_dimensions[Height] * Otc::TILE_PIXELS; ++y) { uint8 *p = fullImage->getPixel(x,y); if(p[3] != 0x00) { drawRect.setTop(std::min(y, (int)drawRect.top()));