summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-13 01:16:52 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-13 01:16:52 +0000
commitab9debf3fa91f3b36c6739f4affbdc187e78113d (patch)
tree4e22c94c0c3fd70c7741e98a7d81d0150ff57fba /src/engine.cpp
parentd0c5ab3fe88e1248f755a764248037960f7bed35 (diff)
downloadmana-client-ab9debf3fa91f3b36c6739f4affbdc187e78113d.tar.gz
mana-client-ab9debf3fa91f3b36c6739f4affbdc187e78113d.tar.bz2
mana-client-ab9debf3fa91f3b36c6739f4affbdc187e78113d.tar.xz
mana-client-ab9debf3fa91f3b36c6739f4affbdc187e78113d.zip
* Moved Being public char *speech to private std::string speech
* Moved Being public PATH_NODE *path to private std::list<PATH_NODE> path * Fixed warping issue which corrupted player (which also applies to respawning) * Got rid of sound error in Setup window
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp46
1 files changed, 14 insertions, 32 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 8ba4e7ea..36e6c212 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -407,10 +407,8 @@ void Engine::draw()
being->frame =
(get_elapsed_time(being->walk_time) * 4) / (being->speed);
- if (being->frame >= 4) {
- if (being->action != MONSTER_DEAD && being->hasPath()) {
- being->nextStep();
- }
+ if (being->frame >= 4 && being->action != MONSTER_DEAD) {
+ being->nextStep();
}
}
}
@@ -436,28 +434,26 @@ void Engine::draw()
// purposes.
if (displayPathToMouse)
{
- PATH_NODE *debugPath = tiledMap->findPath(
+ std::list<PATH_NODE> debugPath = tiledMap->findPath(
player_node->x, player_node->y,
mouseX / 32 + camera_x, mouseY / 32 + camera_y);
- while (debugPath)
+ while (!debugPath.empty())
{
- int squareX = (debugPath->x - camera_x) * 32 - offset_x + 12;
- int squareY = (debugPath->y - camera_y) * 32 - offset_y + 12;
+ PATH_NODE node = debugPath.front();
+ debugPath.pop_front();
+
+ int squareX = (node.x - camera_x) * 32 - offset_x + 12;
+ int squareY = (node.y - camera_y) * 32 - offset_y + 12;
guiGraphics->setColor(gcn::Color(255, 0, 0));
guiGraphics->fillRectangle(gcn::Rectangle(squareX, squareY, 8, 8));
- MetaTile *tile = tiledMap->getMetaTile(debugPath->x, debugPath->y);
+ MetaTile *tile = tiledMap->getMetaTile(node.x, node.y);
std::stringstream cost;
cost << tile->Gcost;
guiGraphics->drawText(cost.str(), squareX + 4, squareY + 12,
gcn::Graphics::CENTER);
-
- // Move to the next node
- PATH_NODE *temp = debugPath->next;
- delete debugPath;
- debugPath = temp;
}
}
@@ -466,24 +462,10 @@ void Engine::draw()
while (beingIterator != beings.end()) {
Being *being = (*beingIterator);
- if (being->speech != NULL) {
- //if (being->speech_color == makecol(255, 255, 255)) {
- // guiGraphics->drawText(being->speech,
- // being->text_x + 16, being->text_y - 60,
- // gcn::Graphics::CENTER);
- //}
- //else {
- guiGraphics->drawText(being->speech,
- being->text_x + 60, being->text_y - 60,
- gcn::Graphics::CENTER);
- //}
-
- being->speech_time--;
- if (being->speech_time == 0) {
- free(being->speech);
- being->speech = NULL;
- }
- }
+ // Tick the beings (gives them a sense of time)
+ being->tick();
+
+ being->drawSpeech(guiGraphics);
beingIterator++;
}