diff options
author | Olivier Gayot <og@satcom1.com> | 2016-09-04 17:36:59 +0200 |
---|---|---|
committer | Olivier Gayot <og@satcom1.com> | 2016-09-04 17:36:59 +0200 |
commit | 0a58c87f21ec0717e17318528a7c252c9d0997e7 (patch) | |
tree | 25d1523eba6f0bcb4f6f34f4df2e51aadd6d587e /battle.c | |
parent | c6a8032e93deddb70e268b2ef6521410cbb8afac (diff) |
started removing SURFACES and POSITIONS
Signed-off-by: Olivier Gayot <og@satcom1.com>
Diffstat (limited to 'battle.c')
-rw-r--r-- | battle.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -1,4 +1,5 @@ -#include <SDL/SDL.h> +#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; |