summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-09-25 14:12:30 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-09-25 14:12:30 (EDT)
commit15f3d1c8385ac7cc2ed3c04bb1e1fb919ba169d1 (patch)
tree3d50b762a567a846bd3a0a3acff38e39dd699cbf
parente131c8fe8de5d8d956a10623bb9351df0c526845 (diff)
downloadmazefight-15f3d1c8385ac7cc2ed3c04bb1e1fb919ba169d1.zip
mazefight-15f3d1c8385ac7cc2ed3c04bb1e1fb919ba169d1.tar.gz
mazefight-15f3d1c8385ac7cc2ed3c04bb1e1fb919ba169d1.tar.bz2
char: Remove old collision functions
-rw-r--r--src/char.h3
-rw-r--r--src/char/char.c18
-rw-r--r--src/char/char.h2
-rw-r--r--src/char/enemy.c14
-rw-r--r--src/char/player.c5
-rw-r--r--src/game.c7
6 files changed, 0 insertions, 49 deletions
diff --git a/src/char.h b/src/char.h
index f1520d9..1dd1308 100644
--- a/src/char.h
+++ b/src/char.h
@@ -40,9 +40,6 @@ int
mf_char_update(struct mf_char *c);
int
-mf_char_collision(struct mf_char *c1, struct mf_char *c2, int handle);
-
-int
mf_char_render(struct mf_char *c, SDL_Renderer *renderer);
void
diff --git a/src/char/char.c b/src/char/char.c
index 4a4a4e7..0ab7145 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -126,24 +126,6 @@ mf_char_update(struct mf_char *c)
}
int
-mf_char_collision(struct mf_char *c1, struct mf_char *c2, int handle)
-{
- if (c1->cur_x == c2->cur_x && c1->cur_y == c2->cur_y) goto hit;
- if (c1->cur_x == c2->new_x && c1->cur_y == c2->new_y) goto hit;
- if (c1->new_x == c2->cur_x && c1->new_y == c2->cur_y) goto hit;
- if (c1->new_x == c2->new_x && c1->new_y == c2->new_y) goto hit;
-
- return 0;
-
- hit:
- if (handle == SDL_TRUE) {
- c1->collide(c1);
- c2->collide(c2);
- }
- return 1;
-}
-
-int
mf_char_render(struct mf_char *c, SDL_Renderer *renderer)
{
int e = 0;
diff --git a/src/char/char.h b/src/char/char.h
index 02bddaa..f5054d5 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -54,7 +54,6 @@ struct mf_char {
int (*update)(struct mf_char *);
int (*step)(struct mf_char *);
int (*turn)(struct mf_char *);
- void (*collide)(struct mf_char *);
int (*render)(struct mf_char *, SDL_Renderer *);
void (*destroy)(struct mf_char *);
};
@@ -71,7 +70,6 @@ mf_char_new(size_t size);
c->update = &_mf_##name##_update; \
c->step = &_mf_##name##_step; \
c->turn = &_mf_##name##_turn; \
- c->collide = &_mf_##name##_collide; \
c->render = &_mf_##name##_render; \
c->destroy = &_mf_##name##_destroy; \
t_c = (struct mf_##name *) c; \
diff --git a/src/char/enemy.c b/src/char/enemy.c
index eeda38d..ff00915 100644
--- a/src/char/enemy.c
+++ b/src/char/enemy.c
@@ -160,20 +160,6 @@ _mf_enemy_update(struct mf_char *c)
}
}
-static void
-_mf_enemy_collide(struct mf_char *c)
-{
- /* Don't go forward unless necessary */
- switch (c->cur_dir) {
- case MF_CHAR_DIR_U_: c->cur_dir = MF_CHAR_DIR_D_; break;
- case MF_CHAR_DIR_D_: c->cur_dir = MF_CHAR_DIR_U_; break;
- case MF_CHAR_DIR_L_: c->cur_dir = MF_CHAR_DIR_R_; break;
- case MF_CHAR_DIR_R_: c->cur_dir = MF_CHAR_DIR_L_; break;
- default: c->cur_dir = MF_CHAR_DIR_N_; break;
- }
- _mf_enemy_step(c);
-}
-
static int
_mf_enemy_render(struct mf_char *c __attribute__((__unused__)),
SDL_Renderer *renderer __attribute__((__unused__)))
diff --git a/src/char/player.c b/src/char/player.c
index fdeac5c..eff0dbd 100644
--- a/src/char/player.c
+++ b/src/char/player.c
@@ -74,11 +74,6 @@ _mf_player_render(struct mf_char *c __attribute__((__unused__)),
}
static void
-_mf_player_collide(struct mf_char *c __attribute__((__unused__)))
-{
-}
-
-static void
_mf_player_destroy(struct mf_char *c __attribute__((__unused__)))
{
}
diff --git a/src/game.c b/src/game.c
index 93ea2db..faf2beb 100644
--- a/src/game.c
+++ b/src/game.c
@@ -154,7 +154,6 @@ mf_game(long seed, int size, int fow, int reveal, int enemies,
int fr;
int won;
Uint32 beg;
- int j;
int secs;
Uint32 end;
Uint32 delay;
@@ -249,12 +248,6 @@ mf_game(long seed, int size, int fow, int reveal, int enemies,
for (i = 0; i < enemies; ++i) {
mf_char_update(chars[i]);
}
- for (i = 0; i < enemies; ++i) {
- for (j = i + 1; j < enemies; ++j) {
- mf_char_collision(chars[i], chars[j],
- SDL_TRUE);
- }
- }
mf_char_get_vector(player, &game.player_cx,
&game.player_cy, &game.player_travel,
&game.player_dx, &game.player_dy);