summaryrefslogtreecommitdiff
path: root/src/graphic
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-21 13:31:36 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-21 13:31:36 +0000
commite0a956b4045ca09631d9a9a616ca675f2c1f4a78 (patch)
treeb98a0bf6970c76a226436effed21f44611015e4f /src/graphic
parentad12a9189f33e65de827219eb573a6e63c7862c9 (diff)
downloadmana-e0a956b4045ca09631d9a9a616ca675f2c1f4a78.tar.gz
mana-e0a956b4045ca09631d9a9a616ca675f2c1f4a78.tar.bz2
mana-e0a956b4045ca09631d9a9a616ca675f2c1f4a78.tar.xz
mana-e0a956b4045ca09631d9a9a616ca675f2c1f4a78.zip
Some refactoring of Being class.
Diffstat (limited to 'src/graphic')
-rw-r--r--src/graphic/graphic.cpp42
1 files changed, 4 insertions, 38 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index c5fd63eb..c5bed789 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -398,7 +398,7 @@ void Engine::draw()
if (being->action != STAND && being->action != SIT
&& being->action != DEAD) {
being->frame =
- (get_elapsed_time(being->tick_time) * 4) / (being->speed);
+ (get_elapsed_time(being->walk_time) * 4) / (being->speed);
if (being->frame >= 4) {
being->frame = 0;
@@ -431,45 +431,11 @@ void Engine::draw()
if (being->action != STAND) {
being->frame =
- (get_elapsed_time(being->tick_time) * 4) / (being->speed);
+ (get_elapsed_time(being->walk_time) * 4) / (being->speed);
if (being->frame >= 4) {
- if (being->action != MONSTER_DEAD && being->path) {
- if (being->path->next) {
- int old_x, old_y, new_x, new_y;
- old_x = being->path->x;
- old_y = being->path->y;
- being->path = being->path->next;
- new_x = being->path->x;
- new_y = being->path->y;
- direction = 0;
-
- if (new_x > old_x) {
- if (new_y > old_y) direction = SE;
- else if (new_y < old_y) direction = NE;
- else direction = EAST;
- }
- else if (new_x < old_x) {
- if (new_y > old_y) direction = SW;
- else if (new_y < old_y) direction = NW;
- else direction = WEST;
- }
- else {
- if (new_y > old_y) direction = SOUTH;
- else if (new_y < old_y) direction = NORTH;
- }
-
- being->x = being->path->x;
- being->y = being->path->y;
- being->direction = direction;
- } else {
- being->action = STAND;
- }
- if (being->action != MONSTER_DEAD) {
- being->frame = 0;
- }
- being->tick_time = tick_time;
- //being->frame = 0;
+ if (being->action != MONSTER_DEAD && being->hasPath()) {
+ being->nextStep();
}
}
}