summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS7
-rw-r--r--README2
-rw-r--r--data/help/changes.txt13
-rw-r--r--data/help/header.txt4
-rw-r--r--src/main.h2
-rw-r--r--src/map.cpp15
-rw-r--r--src/map.h2
-rw-r--r--src/openglgraphics.cpp77
8 files changed, 72 insertions, 50 deletions
diff --git a/NEWS b/NEWS
index cca5d461..a6ebfce8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+0.5.3 (11 September 2011)
+- Fixed endless loop when a sprite definition promises too many images
+- Fixed crash when selecting a character that has a Dark Talisman equipped
+- Fixed drawing glitch with overwide tiles
+- Fixed scaling of overlays in OpenGL mode
+- Fixed building without OpenGL
+
0.5.2 (17 April 2011)
- Removed NPC "Thanks for buying/selling" messages from the chat
- Added a few missing authentication failure reasons
diff --git a/README b/README
index 6e62d537..a3b0258f 100644
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
THE MANA CLIENT
===============
- Version: 0.5.2 Date: 2011-04-17
+ Version: 0.5.3 Date: 2011-09-11
Development team:
- See AUTHORS file for a list
diff --git a/data/help/changes.txt b/data/help/changes.txt
index 2453a608..33fb2845 100644
--- a/data/help/changes.txt
+++ b/data/help/changes.txt
@@ -3,6 +3,11 @@
##3 === RECENT CHANGES ===
+ 0.5.3 (11 September 2011)
+ - Fixed endless loop when a sprite definition promises too many images
+ - Fixed crash when selecting a character that has a Dark Talisman equipped
+ - Fixed building without OpenGL
+
0.5.2 (17 April 2011)
- Removed NPC "Thanks for buying/selling" messages from the chat
- Added a few missing authentication failure reasons
@@ -142,11 +147,3 @@
- Fixed inability to chat while talking to NPCs
- Updated Swedish translation
- 0.0.28 (25 January 2009)
- - Added support for animated map tiles
- - Added support for internationalization, plus many translations
- - Added support for TrueType fonts
- - Trade window is now resizable
- - Obscure precise home directory name when making screenshots
- - Fixed follow-parent of nested and being-following particle emitters
-
diff --git a/data/help/header.txt b/data/help/header.txt
index 505ae25c..52ecedae 100644
--- a/data/help/header.txt
+++ b/data/help/header.txt
@@ -1,8 +1,8 @@
-##1 M A N A S O U R C E
+##1 M A N A C L I E N T
##1 ==========================================
- ##2Version:##6 0.5.2 ##2Date:##3 17 April 2011
+ ##2Version:##6 0.5.3 ##2Date:##3 11 September 2011
##2 Website: http://manasource.org
diff --git a/src/main.h b/src/main.h
index 3fe52f5d..82ece500 100644
--- a/src/main.h
+++ b/src/main.h
@@ -55,7 +55,7 @@
#elif defined WIN32
#include "winver.h"
#elif defined __APPLE__
-#define PACKAGE_VERSION "0.5.2"
+#define PACKAGE_VERSION "0.5.3"
#endif
#ifdef PACKAGE_VERSION
diff --git a/src/map.cpp b/src/map.cpp
index ac287be4..3e5e8e12 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -121,8 +121,10 @@ Image* MapLayer::getTile(int x, int y) const
return mTiles[x + y * mWidth];
}
-void MapLayer::draw(Graphics *graphics, int startX, int startY,
- int endX, int endY, int scrollX, int scrollY,
+void MapLayer::draw(Graphics *graphics,
+ int startX, int startY,
+ int endX, int endY,
+ int scrollX, int scrollY,
const Actors &actors, int debugFlags) const
{
startX -= mX;
@@ -218,8 +220,9 @@ int MapLayer::getTileDrawWidth(int x1, int y1, int endX, int &width) const
Map::Map(int width, int height, int tileWidth, int tileHeight):
mWidth(width), mHeight(height),
mTileWidth(tileWidth), mTileHeight(tileHeight),
- mMaxTileHeight(height),
- mDebugFlags(0),
+ mMaxTileHeight(tileHeight),
+ mMaxTileWidth(tileWidth),
+ mDebugFlags(MAP_NORMAL),
mOnClosedList(1), mOnOpenList(2),
mLastScrollX(0.0f), mLastScrollY(0.0f)
{
@@ -321,6 +324,8 @@ void Map::addTileset(Tileset *tileset)
if (tileset->getHeight() > mMaxTileHeight)
mMaxTileHeight = tileset->getHeight();
+ if (tileset->getWidth() > mMaxTileWidth)
+ mMaxTileWidth = tileset->getWidth();
}
bool actorCompare(const Actor *a, const Actor *b)
@@ -344,7 +349,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
// Calculate range of tiles which are on-screen
int endPixelY = graphics->getHeight() + scrollY + mTileHeight - 1;
endPixelY += mMaxTileHeight - mTileHeight;
- int startX = scrollX / mTileWidth;
+ int startX = (scrollX - mMaxTileWidth + mTileWidth) / mTileWidth;
int startY = scrollY / mTileHeight;
int endX = (graphics->getWidth() + scrollX + mTileWidth - 1) / mTileWidth;
int endY = endPixelY / mTileHeight;
diff --git a/src/map.h b/src/map.h
index 56ddae11..0c342deb 100644
--- a/src/map.h
+++ b/src/map.h
@@ -386,7 +386,7 @@ class Map : public Properties
int mWidth, mHeight;
int mTileWidth, mTileHeight;
- int mMaxTileHeight;
+ int mMaxTileHeight, mMaxTileWidth;
MetaTile *mMetaTiles;
Layers mLayers;
Tilesets mTilesets;
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index c24b7d64..84f499a4 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -478,24 +478,26 @@ void OpenGLGraphics::drawImagePattern(Image *image, int x, int y, int w, int h)
static_cast<GLubyte>(mColor.a));
}
-void OpenGLGraphics::drawRescaledImagePattern(Image *image, int x, int y,
- int w, int h, int scaledWidth,
+void OpenGLGraphics::drawRescaledImagePattern(Image *image,
+ int x, int y,
+ int w, int h,
+ int scaledWidth,
int scaledHeight)
{
if (!image)
return;
+ if (scaledWidth == 0 || scaledHeight == 0)
+ return;
+
const int srcX = image->mBounds.x;
const int srcY = image->mBounds.y;
- const int iw = scaledWidth;
- const int ih = scaledHeight;
+ const int iw = image->getWidth();
+ const int ih = image->getHeight();
if (iw == 0 || ih == 0)
return;
- const float tw = static_cast<float>(image->getTextureWidth());
- const float th = static_cast<float>(image->getTextureHeight());
-
glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha);
bindTexture(Image::mTextureType, image->mGLImage);
@@ -505,23 +507,31 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, int x, int y,
unsigned int vp = 0;
const unsigned int vLimit = vertexBufSize * 4;
- float texX1 = static_cast<float>(srcX) / tw;
- float texY1 = static_cast<float>(srcY) / th;
-
// Draw a set of textured rectangles
if (image->getTextureType() == GL_TEXTURE_2D)
{
- for (int py = 0; py < h; py += ih)
+ const float tw = static_cast<float>(image->getTextureWidth());
+ const float th = static_cast<float>(image->getTextureHeight());
+
+ const float texX1 = static_cast<float>(srcX) / tw;
+ const float texY1 = static_cast<float>(srcY) / th;
+
+ const float tFractionW = iw / tw;
+ const float tFractionH = ih / th;
+
+ for (int py = 0; py < h; py += scaledHeight)
{
- const int height = (py + ih >= h) ? h - py : ih;
+ const int height = (py + scaledHeight >= h) ? h - py : scaledHeight;
const int dstY = y + py;
- for (int px = 0; px < w; px += iw)
+ for (int px = 0; px < w; px += scaledWidth)
{
- int width = (px + iw >= w) ? w - px : iw;
+ int width = (px + scaledWidth >= w) ? w - px : scaledWidth;
int dstX = x + px;
+ const float visibleFractionW = (float) width / scaledWidth;
+ const float visibleFractionH = (float) height / scaledHeight;
- float texX2 = static_cast<float>(srcX + width) / tw;
- float texY2 = static_cast<float>(srcY + height) / th;
+ const float texX2 = texX1 + tFractionW * visibleFractionW;
+ const float texY2 = texY1 + tFractionH * visibleFractionH;
mFloatTexArray[vp + 0] = texX1;
mFloatTexArray[vp + 1] = texY1;
@@ -538,14 +548,14 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, int x, int y,
mIntVertArray[vp + 0] = dstX;
mIntVertArray[vp + 1] = dstY;
- mIntVertArray[vp + 2] = dstX + scaledWidth;
+ mIntVertArray[vp + 2] = dstX + width;
mIntVertArray[vp + 3] = dstY;
- mIntVertArray[vp + 4] = dstX + scaledWidth;
- mIntVertArray[vp + 5] = dstY + scaledHeight;
+ mIntVertArray[vp + 4] = dstX + width;
+ mIntVertArray[vp + 5] = dstY + height;
mIntVertArray[vp + 6] = dstX;
- mIntVertArray[vp + 7] = dstY + scaledHeight;
+ mIntVertArray[vp + 7] = dstY + height;
vp += 8;
if (vp >= vLimit)
@@ -560,38 +570,41 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, int x, int y,
}
else
{
- for (int py = 0; py < h; py += ih)
+ const float scaleFactorW = (float) scaledWidth / iw;
+ const float scaleFactorH = (float) scaledHeight / ih;
+
+ for (int py = 0; py < h; py += scaledHeight)
{
- const int height = (py + ih >= h) ? h - py : ih;
+ const int height = (py + scaledHeight >= h) ? h - py : scaledHeight;
const int dstY = y + py;
- for (int px = 0; px < w; px += iw)
+ for (int px = 0; px < w; px += scaledWidth)
{
- int width = (px + iw >= w) ? w - px : iw;
+ int width = (px + scaledWidth >= w) ? w - px : scaledWidth;
int dstX = x + px;
mIntTexArray[vp + 0] = srcX;
mIntTexArray[vp + 1] = srcY;
- mIntTexArray[vp + 2] = srcX + width;
+ mIntTexArray[vp + 2] = srcX + width / scaleFactorW;
mIntTexArray[vp + 3] = srcY;
- mIntTexArray[vp + 4] = srcX + width;
- mIntTexArray[vp + 5] = srcY + height;
+ mIntTexArray[vp + 4] = srcX + width / scaleFactorW;
+ mIntTexArray[vp + 5] = srcY + height / scaleFactorH;
mIntTexArray[vp + 6] = srcX;
- mIntTexArray[vp + 7] = srcY + height;
+ mIntTexArray[vp + 7] = srcY + height / scaleFactorH;
mIntVertArray[vp + 0] = dstX;
mIntVertArray[vp + 1] = dstY;
- mIntVertArray[vp + 2] = dstX + scaledWidth;
+ mIntVertArray[vp + 2] = dstX + width;
mIntVertArray[vp + 3] = dstY;
- mIntVertArray[vp + 4] = dstX + scaledWidth;
- mIntVertArray[vp + 5] = dstY + scaledHeight;
+ mIntVertArray[vp + 4] = dstX + width;
+ mIntVertArray[vp + 5] = dstY + height;
mIntVertArray[vp + 6] = dstX;
- mIntVertArray[vp + 7] = dstY + scaledHeight;
+ mIntVertArray[vp + 7] = dstY + height;
vp += 8;
if (vp >= vLimit)