diff options
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; |