diff options
Diffstat (limited to 'menuchoixpersos.c')
-rw-r--r-- | menuchoixpersos.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/menuchoixpersos.c b/menuchoixpersos.c index 9c02389..eb452c9 100644 --- a/menuchoixpersos.c +++ b/menuchoixpersos.c @@ -14,7 +14,7 @@ static void init_team_players(struct team_t *team, bool left, const enum character_class_t *classes, SURFACES *surfaces) { for (int i = 0; i < team->chr_cnt; i++) { - struct character_t *chr = &team->chrs[i]; + struct chr_t *chr = &team->chrs[i]; chr->name = "Player"; chr->team = team; @@ -59,10 +59,11 @@ static void init_team_players(struct team_t *team, bool left, chr->spirit = base_stats_g[chr->class_].spirit; for (int j = 0; j < countof(chr->affinities); ++j) { - chr->affinities[j] = rand() % AFFINITY_COUNT; + chr->affinities[j] = rand() % AFFIN_COUNT; } - chr->pos.y = (rpg_g.screen->h / ((team->chr_cnt + 1) * 2)) * (2 * (i + 1)) - chr->surf->h / 2; + chr->pos.y = (rpg_g.screen->h / ((team->chr_cnt + 1) * 2)) * + (2 * (i + 1)) - chr->surf->h / 2; if (left) { chr->curs = surfaces->Pcurseurallies; @@ -87,7 +88,7 @@ static void init_team(struct team_t *team, int chr_cnt) team->chr_cnt = chr_cnt; team->chr_cur = rand() % team->chr_cnt; - team->chrs = malloc(sizeof(struct character_t) * team->chr_cnt); + team->chrs = malloc(sizeof(struct chr_t) * team->chr_cnt); } static @@ -134,8 +135,8 @@ static void generate_enemy_types(const struct team_t *ally_team, } } -static -struct team_t *new_enemy_team(SURFACES *surfaces, const struct team_t *ally_team) +static struct team_t +*new_enemy_team(SURFACES *surfaces, const struct team_t *ally_team) { struct team_t *team = malloc(sizeof(struct team_t)); enum character_class_t *classes; @@ -156,7 +157,7 @@ struct team_t *new_enemy_team(SURFACES *surfaces, const struct team_t *ally_team return team; } -static void Fchangersurlignage2(int Vchoix, SURFACES *surfaces, +static void update_menu(int Vchoix, SURFACES *surfaces, SDL_Surface *text, POSITIONS *positions) { SDL_Surface *surf; @@ -174,9 +175,12 @@ static void Fchangersurlignage2(int Vchoix, SURFACES *surfaces, /* this surface fills the whole screen */ SDL_BlitSurface(surf, NULL, surfaces->screen, NULL); - SDL_BlitSurface(surfaces->Ppretre, NULL, surfaces->screen, &positions->menupretre); - SDL_BlitSurface(surfaces->Ppaladin, NULL, surfaces->screen, &positions->menupaladin); - SDL_BlitSurface(surfaces->Pvoleur, NULL, surfaces->screen, &positions->menuvoleur); + SDL_BlitSurface(surfaces->Ppretre, NULL, surfaces->screen, + &positions->menupretre); + SDL_BlitSurface(surfaces->Ppaladin, NULL, surfaces->screen, + &positions->menupaladin); + SDL_BlitSurface(surfaces->Pvoleur, NULL, surfaces->screen, + &positions->menuvoleur); SDL_BlitSurface(text, NULL, surfaces->screen, &positions->textemenu); @@ -221,16 +225,22 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) SDL_BlitSurface(surf, NULL, surfaces->screen, NULL); - /* display the string associated with the current character number (aka Please choose ...) */ + /* + * display the string associated with the current character number + * (aka Please choose ...) + */ surf = TTF_RenderText_Blended(rpg_g.font, strings[Vnbperso], vert); positions->textemenu.x = surfaces->screen->w / 2 - surf->w / 2; SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->textemenu); - SDL_BlitSurface(surfaces->Ppretre, NULL, surfaces->screen, &positions->menupretre); - SDL_BlitSurface(surfaces->Ppaladin, NULL, surfaces->screen, &positions->menupaladin); - SDL_BlitSurface(surfaces->Pvoleur, NULL, surfaces->screen, &positions->menuvoleur); + SDL_BlitSurface(surfaces->Ppretre, NULL, surfaces->screen, + &positions->menupretre); + SDL_BlitSurface(surfaces->Ppaladin, NULL, surfaces->screen, + &positions->menupaladin); + SDL_BlitSurface(surfaces->Pvoleur, NULL, surfaces->screen, + &positions->menuvoleur); SDL_Flip (surfaces->Pecran); continuer = true; @@ -249,7 +259,7 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) } else { Vchoix = CLASS_THIEF; } - Fchangersurlignage2(Vchoix, surfaces, surf, positions); + update_menu(Vchoix, surfaces, surf, positions); break; case SDLK_RIGHT: @@ -259,7 +269,7 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) } else { Vchoix = CLASS_PALADIN; } - Fchangersurlignage2(Vchoix, surfaces, surf, positions); + update_menu(Vchoix, surfaces, surf, positions); break; case SDLK_RETURN: case SDLK_f: |