summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-14 14:24:28 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-14 14:24:28 +0000
commitd283db70abe904fddd8aefbd52b35d6e066dd98f (patch)
tree7bd24c75dd65872270a4b4a859c38020d82ba451 /src/game.cpp
parentd7904f7b7e25bbdd7205e5c18e06d184b2078732 (diff)
downloadmana-client-d283db70abe904fddd8aefbd52b35d6e066dd98f.tar.gz
mana-client-d283db70abe904fddd8aefbd52b35d6e066dd98f.tar.bz2
mana-client-d283db70abe904fddd8aefbd52b35d6e066dd98f.tar.xz
mana-client-d283db70abe904fddd8aefbd52b35d6e066dd98f.zip
Added background to minimap. Only used in Tonori Desert map for now, and its
style is up for discussion.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 7e7cf4e3..f6a2133f 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -55,7 +55,8 @@ int fps = 0, frame = 0, current_npc = 0;
bool displayPathToMouse = false;
int startX = 0, startY = 0;
int gameTime = 0;
-Being* autoTarget = NULL;
+Being *autoTarget = NULL;
+Engine *engine = NULL;
OkDialog *deathNotice = NULL;
ConfirmDialog *exitConfirm = NULL;
@@ -122,8 +123,8 @@ int get_elapsed_time(int start_time)
void game()
{
+ engine = new Engine();
do_init();
- Engine *engine = new Engine();
gameTime = tick_time;
@@ -165,20 +166,17 @@ void do_init()
std::string path(map_path);
std::string pathDir = path.substr(0, path.rfind("."));
- // Try .tmx map file
- pathDir.insert(pathDir.size(), ".tmx");
- tiledMap = MapReader::readMap(pathDir);
+ // Try .tmx.gz map file
+ pathDir.insert(pathDir.size(), ".tmx.gz");
+ Map *tiledMap = MapReader::readMap(pathDir);
if (!tiledMap)
{
- // Try .tmx.gz map file
- pathDir.insert(pathDir.size(), ".gz");
- tiledMap = MapReader::readMap(pathDir);
-
- if (!tiledMap)
- {
- logger->error("Could not find map file!");
- }
+ logger->error("Could not find map file!");
+ }
+ else
+ {
+ engine->setCurrentMap(tiledMap);
}
// Start playing background music
@@ -529,6 +527,8 @@ void do_input()
Direction = SW;
}
+ Map *tiledMap = engine->getCurrentMap();
+
// Prevent skipping corners over colliding tiles
if (xDirection != 0 && tiledMap->tileCollides(x + xDirection, y)) {
xDirection = 0;
@@ -587,6 +587,7 @@ void do_parse()
Being *being = NULL;
FloorItem *floorItem = NULL;
int len, n_items;
+ Map *tiledMap = engine->getCurrentMap();
// We need at least 2 bytes to identify a packet
if (in_size >= 2) {
@@ -1011,6 +1012,7 @@ void do_parse()
WFIFOW(0) = net_w_value(0x007d);
WFIFOSET(2);
while (out_size > 0) flush();
+ engine->setCurrentMap(tiledMap);
}
else {
logger->error("Could not find map file");