From 0a58c87f21ec0717e17318528a7c252c9d0997e7 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sun, 4 Sep 2016 17:36:59 +0200 Subject: started removing SURFACES and POSITIONS Signed-off-by: Olivier Gayot --- battle.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'battle.c') diff --git a/battle.c b/battle.c index e18ebb1..874d27a 100644 --- a/battle.c +++ b/battle.c @@ -1,4 +1,5 @@ -#include +#include "rpg.h" + #include "structures.h" #include "constantes.h" @@ -461,27 +462,26 @@ static bool is_battle_over(const struct team_t *t1, const struct team_t *t2) return get_first_alive_character(t2) == NULL; } -int battle(SURFACES *surfaces, POSITIONS *positions, - struct team_t *t1, struct team_t *t2) +int battle(struct team_t *t1, struct team_t *t2) { struct team_t *playing_team; - SDL_BlitSurface(surfaces->background, NULL, surfaces->screen, NULL); + SDL_BlitSurface(rpg_g.surfaces.background, NULL, rpg_g.screen, NULL); /* compute whether the allies or the enemies should begin */ playing_team = (rand() % 2) ? t1 : t2; highlight_current_character(playing_team); - blit_team(surfaces, t1); - blit_team(surfaces, t2); + blit_team(t1); + blit_team(t2); - SDL_Flip(surfaces->screen); + SDL_Flip(rpg_g.screen); while (!is_battle_over(t1, t2)) { struct action_params_t params = { - .surfaces = surfaces, - .positions = positions, + .surfaces = &rpg_g.surfaces, + .positions = &rpg_g.positions, .t1 = t1, .t2 = t2, @@ -494,20 +494,20 @@ int battle(SURFACES *surfaces, POSITIONS *positions, return -1; case ACTION_PERFORMED: - SDL_Flip(surfaces->screen); + SDL_Flip(rpg_g.screen); SDL_Delay(1000); - SDL_BlitSurface(surfaces->background, &positions->degats, - surfaces->screen, &positions->degats); + SDL_BlitSurface(rpg_g.surfaces.background, &rpg_g.positions.degats, + rpg_g.screen, &rpg_g.positions.degats); - SDL_Flip(surfaces->screen); + SDL_Flip(rpg_g.screen); hook_post_action(¶ms); update_current_character(t1, t2, &playing_team); - blit_team(surfaces, t1); - blit_team(surfaces, t2); + blit_team(t1); + blit_team(t2); break; default: break; -- cgit v1.2.3