fix missiles, mapzoom, restore relwithdeb, replace 32 with tilepixels
This commit is contained in:
parent
1203756baf
commit
d33d0c2ee8
|
@ -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
|
||||
|
|
|
@ -56,8 +56,8 @@ public:
|
|||
TSize<T>& operator*=(const TSize<T>& other) { wd=(T)other.wd*wd; ht=(T)ht*other.ht; return *this; }
|
||||
TSize<T> operator/(const TSize<T>& other) const { return TSize<T>((T)wd/other.wd, (T)ht/other.ht); }
|
||||
TSize<T>& operator/=(const TSize<T>& other) { (T)wd/=other.wd; (T)ht/=other.ht; return *this; }
|
||||
TSize<T> operator*(const float v) const { return TSize<T>((T)v*wd, (T)ht*v); }
|
||||
TSize<T>& operator*=(const float v) { wd=(T)v*wd; ht=(T)ht*v; return *this; }
|
||||
TSize<T> operator*(const float v) const { return TSize<T>((T)wd*v, (T)ht*v); }
|
||||
TSize<T>& operator*=(const float v) { wd=(T)wd*v; ht=(T)ht*v; return *this; }
|
||||
TSize<T> operator/(const float v) const { return TSize<T>((T)wd/v, (T)ht/v); }
|
||||
TSize<T>& operator/=(const float v) { wd/=v; ht/=v; return *this; }
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()));
|
||||
|
|
Loading…
Reference in New Issue