summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-08-19 17:42:27 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-08-19 17:42:27 (EDT)
commit7a2a4e59c299473d60bceb4d51be470feff866e8 (patch)
treed055629b89f37f7dd81aa81b9186fce4978048c5
parent2aba6b402b43877dcd7d42c51df8e91bd355b32d (diff)
downloadmazefight-7a2a4e59c299473d60bceb4d51be470feff866e8.zip
mazefight-7a2a4e59c299473d60bceb4d51be470feff866e8.tar.gz
mazefight-7a2a4e59c299473d60bceb4d51be470feff866e8.tar.bz2
Revert "char/enemy: Try to fix movement lag"
This reverts commit 09775804429ccd7486419b4c539581d6f70e193d.
-rw-r--r--src/char.h3
-rw-r--r--src/char/enemy.c14
-rw-r--r--src/game.c3
3 files changed, 2 insertions, 18 deletions
diff --git a/src/char.h b/src/char.h
index 163ab4e..f1520d9 100644
--- a/src/char.h
+++ b/src/char.h
@@ -54,7 +54,4 @@ mf_player_key_event(struct mf_char *c, SDL_Event *e);
void
mf_enemy_random_jump(struct mf_char *c, int maze_size);
-int
-mf_enemy_postupdate(struct mf_char *c);
-
#endif /* MF_CHAR_H */
diff --git a/src/char/enemy.c b/src/char/enemy.c
index 3f9f994..eeda38d 100644
--- a/src/char/enemy.c
+++ b/src/char/enemy.c
@@ -133,12 +133,12 @@ _mf_enemy_turn(struct mf_char *c)
if (e->allies[i]->cur_x == c->cur_x + dx &&
e->allies[i]->cur_y == c->cur_y + dy) {
/* Another enemy currently in this direction */
- return _mf_enemy_step(c);
+ return 0;
}
if (e->allies[i]->new_x == c->cur_x + dx &&
e->allies[i]->new_y == c->cur_y + dy) {
/* Another enemy moving in this direction */
- return _mf_enemy_step(c);
+ return 0;
}
}
@@ -240,13 +240,3 @@ mf_enemy_random_jump(struct mf_char *c, int maze_size)
c->cur_x = rand() / (RAND_MAX / maze_size);
c->cur_y = rand() / (RAND_MAX / maze_size);
}
-
-int
-mf_enemy_postupdate(struct mf_char *c)
-{
- if (c->travel == 0 && c->turning == 0) {
- return _mf_enemy_turn(c);
- } else {
- return 0;
- }
-}
diff --git a/src/game.c b/src/game.c
index 6908626..d582323 100644
--- a/src/game.c
+++ b/src/game.c
@@ -251,9 +251,6 @@ mf_game(long seed, int size, int fow, int reveal, int enemies,
mf_char_update(chars[i]);
}
for (i = 0; i < enemies; ++i) {
- mf_enemy_postupdate(chars[i]);
- }
- for (i = 0; i < enemies; ++i) {
for (j = i + 1; j < enemies; ++j) {
mf_char_collision(chars[i], chars[j],
SDL_TRUE);