summaryrefslogtreecommitdiff
path: root/src/engine.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/engine.cpp
parentd7904f7b7e25bbdd7205e5c18e06d184b2078732 (diff)
downloadmana-d283db70abe904fddd8aefbd52b35d6e066dd98f.tar.gz
mana-d283db70abe904fddd8aefbd52b35d6e066dd98f.tar.bz2
mana-d283db70abe904fddd8aefbd52b35d6e066dd98f.tar.xz
mana-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/engine.cpp')
-rw-r--r--src/engine.cpp42
1 files changed, 31 insertions, 11 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 9c39b3aa..bca79219 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -137,7 +137,8 @@ int get_y_offset(Being *being)
return offset;
}
-Engine::Engine()
+Engine::Engine():
+ mCurrentMap(NULL)
{
// Initializes GUI
debugInfo = new gcn::Label();
@@ -265,6 +266,17 @@ Engine::~Engine()
delete itemset;
}
+Map *Engine::getCurrentMap()
+{
+ return mCurrentMap;
+}
+
+void Engine::setCurrentMap(Map *newMap)
+{
+ mCurrentMap = newMap;
+ minimap->setMap(mCurrentMap);
+}
+
void Engine::logic()
{
// Update beings
@@ -309,9 +321,10 @@ void Engine::draw()
frame++;
// Draw tiles below nodes
- if (tiledMap) {
- tiledMap->draw(guiGraphics, map_x, map_y, 0);
- tiledMap->draw(guiGraphics, map_x, map_y, 1);
+ if (mCurrentMap != NULL)
+ {
+ mCurrentMap->draw(guiGraphics, map_x, map_y, 0);
+ mCurrentMap->draw(guiGraphics, map_x, map_y, 1);
}
// Draw items
@@ -439,15 +452,16 @@ void Engine::draw()
}
// Draw tiles below nodes
- if (tiledMap) {
- tiledMap->draw(guiGraphics, map_x, map_y, 2);
+ if (mCurrentMap != NULL)
+ {
+ mCurrentMap->draw(guiGraphics, map_x, map_y, 2);
}
// Find a path from the player to the mouse, and draw it. This is for debug
// purposes.
- if (displayPathToMouse)
+ if (displayPathToMouse && mCurrentMap != NULL)
{
- std::list<PATH_NODE> debugPath = tiledMap->findPath(
+ std::list<PATH_NODE> debugPath = mCurrentMap->findPath(
player_node->x, player_node->y,
mouseX / 32 + camera_x, mouseY / 32 + camera_y);
@@ -461,7 +475,7 @@ void Engine::draw()
guiGraphics->setColor(gcn::Color(255, 0, 0));
guiGraphics->fillRectangle(gcn::Rectangle(squareX, squareY, 8, 8));
- MetaTile *tile = tiledMap->getMetaTile(node.x, node.y);
+ MetaTile *tile = mCurrentMap->getMetaTile(node.x, node.y);
std::stringstream cost;
cost << tile->Gcost;
@@ -492,8 +506,14 @@ void Engine::draw()
std::stringstream debugStream;
debugStream << "[" << fps << " fps] " <<
(mouseX / 32 + camera_x) << ", " << (mouseY / 32 + camera_y);
- debugStream << " [music: " << tiledMap->getProperty("music") << "]";
- debugStream << " [minimap: " << tiledMap->getProperty("minimap") << "]";
+
+ if (mCurrentMap != NULL)
+ {
+ debugStream
+ << " [music: " << mCurrentMap->getProperty("music") << "]"
+ << " [minimap: " << mCurrentMap->getProperty("minimap") << "]";
+ }
+
debugInfo->setCaption(debugStream.str());
debugInfo->adjustSize();
}