summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp7
-rw-r--r--src/map.cpp3
-rw-r--r--src/map.h8
-rw-r--r--src/net/manaserv/beinghandler.cpp17
-rw-r--r--src/net/manaserv/playerhandler.cpp4
-rw-r--r--src/resources/mapreader.cpp3
6 files changed, 24 insertions, 18 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 33f38255..d5ee4a30 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -811,8 +811,11 @@ int Being::getOffset(char pos, char neg) const
}
else
{
- offset = (int)((get_elapsed_time(mWalkTime)
- * DEFAULT_TILE_SIDE_LENGTH) / mWalkSpeed.x);
+ offset = (pos == LEFT && neg == RIGHT) ?
+ (int)((get_elapsed_time(mWalkTime)
+ * DEFAULT_TILE_WIDTH) / mWalkSpeed.x) :
+ (int)((get_elapsed_time(mWalkTime)
+ * DEFAULT_TILE_HEIGHT) / mWalkSpeed.y);
}
// We calculate the offset _from_ the _target_ location
diff --git a/src/map.cpp b/src/map.cpp
index 910c005a..c18d38ba 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -43,7 +43,8 @@ extern volatile int tick_time;
/**
* The used side-length for tiles
*/
-const int DEFAULT_TILE_SIDE_LENGTH = 32;
+const int DEFAULT_TILE_WIDTH = 32;
+const int DEFAULT_TILE_HEIGHT = 32;
/**
* A location on a tile map. Used for pathfinding, open list.
diff --git a/src/map.h b/src/map.h
index f5f74995..d33f31db 100644
--- a/src/map.h
+++ b/src/map.h
@@ -43,7 +43,9 @@ typedef std::list<Sprite*> MapSprites;
typedef MapSprites::iterator MapSprite;
typedef std::vector<MapLayer*> Layers;
-extern const int DEFAULT_TILE_SIDE_LENGTH;
+/** Default fallback values for tiles width and height */
+extern const int DEFAULT_TILE_WIDTH; /**< Used for X coords */
+extern const int DEFAULT_TILE_HEIGHT; /**< Used for Y coords */
/**
* A meta tile stores additional information about a location on a tile map.
@@ -257,13 +259,13 @@ class Map : public Properties
* Returns the tile width of this map.
*/
int getTileWidth() const
- { return mTileWidth > 0 ? mTileWidth : DEFAULT_TILE_SIDE_LENGTH; }
+ { return mTileWidth > 0 ? mTileWidth : DEFAULT_TILE_WIDTH; }
/**
* Returns the tile height used by this map.
*/
int getTileHeight() const
- { return mTileHeight > 0 ? mTileHeight : DEFAULT_TILE_SIDE_LENGTH; }
+ { return mTileHeight > 0 ? mTileHeight : DEFAULT_TILE_HEIGHT; }
const std::string &getMusicFile() const;
const std::string &getName() const;
diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp
index 02f136af..d1fff43d 100644
--- a/src/net/manaserv/beinghandler.cpp
+++ b/src/net/manaserv/beinghandler.cpp
@@ -102,19 +102,22 @@ Vector BeingHandler::giveSpeedInPixelsPerTicks(float speedInTilesPerSeconds)
if (map)
{
speedInTicks.x = speedInTilesPerSeconds
- * (float)map->getTileWidth()
- / 1000 * (float)MILLISECONDS_IN_A_TICK;
+ * (float)map->getTileWidth()
+ / 1000 * (float)MILLISECONDS_IN_A_TICK;
speedInTicks.y = speedInTilesPerSeconds
- * (float)map->getTileHeight()
- / 1000 * (float)MILLISECONDS_IN_A_TICK;
+ * (float)map->getTileHeight()
+ / 1000 * (float)MILLISECONDS_IN_A_TICK;
}
}
if (!game || !map)
{
- speedInTicks.x = speedInTicks.y = speedInTilesPerSeconds
- * (float)DEFAULT_TILE_SIDE_LENGTH
- / 1000 * (float)MILLISECONDS_IN_A_TICK;
+ speedInTicks.x = speedInTilesPerSeconds
+ * (float)DEFAULT_TILE_WIDTH
+ / 1000 * (float)MILLISECONDS_IN_A_TICK;
+ speedInTicks.y = speedInTilesPerSeconds
+ * (float)DEFAULT_TILE_HEIGHT
+ / 1000 * (float)MILLISECONDS_IN_A_TICK;
}
// We don't use z for now.
speedInTicks.z = 0;
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 007aa93f..042e0284 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -54,12 +54,12 @@ extern Window *buySellDialog;
extern const int MILLISECONDS_IN_A_TICK;
/** @see in map.cpp */
-extern const int DEFAULT_TILE_SIDE_LENGTH;
+extern const int DEFAULT_TILE_WIDTH;
/* Max. distance we are willing to scroll after a teleport;
* everything beyond will reset the port hard.
*/
-static const int MAP_TELEPORT_SCROLL_DISTANCE = 8 * DEFAULT_TILE_SIDE_LENGTH;
+static const int MAP_TELEPORT_SCROLL_DISTANCE = 8 * DEFAULT_TILE_WIDTH;
/**
* Listener used for handling the overweigth message.
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 07a06af7..7f08fe91 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -37,9 +37,6 @@
#include <iostream>
#include <zlib.h>
-const unsigned int DEFAULT_TILE_WIDTH = 32;
-const unsigned int DEFAULT_TILE_HEIGHT = 32;
-
/**
* Inflates either zlib or gzip deflated memory. The inflated memory is
* expected to be freed by the caller.