summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-09-13 18:08:22 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-09-13 18:08:22 +0200
commitd6248271842aa6edc26135568d92150f69491292 (patch)
treecc8c659fb55215f5f60d1ad56c79612004e212cd /src
parent135da0b9b7604d3348bf6955f4dae35211dd307c (diff)
parent7b68fc4ec5c2779a83ecfd214d23687132b3432a (diff)
downloadmana-client-d6248271842aa6edc26135568d92150f69491292.tar.gz
mana-client-d6248271842aa6edc26135568d92150f69491292.tar.bz2
mana-client-d6248271842aa6edc26135568d92150f69491292.tar.xz
mana-client-d6248271842aa6edc26135568d92150f69491292.zip
Merge github.com:mana/mana
Diffstat (limited to 'src')
-rw-r--r--src/main.h2
-rw-r--r--src/map.cpp15
-rw-r--r--src/map.h3
3 files changed, 13 insertions, 7 deletions
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..19cd0e9d 100644
--- a/src/map.h
+++ b/src/map.h
@@ -162,6 +162,7 @@ class Map : public Properties
enum DebugFlags
{
+ MAP_NORMAL = 0x0,
MAP_GRID = 0x1,
MAP_COLLISION_TILES = 0x2,
MAP_BEING_COLLISION_RADIUS = 0x4,
@@ -386,7 +387,7 @@ class Map : public Properties
int mWidth, mHeight;
int mTileWidth, mTileHeight;
- int mMaxTileHeight;
+ int mMaxTileHeight, mMaxTileWidth;
MetaTile *mMetaTiles;
Layers mLayers;
Tilesets mTilesets;