diff options
-rw-r--r-- | blits.c | 13 | ||||
-rw-r--r-- | jouer.c | 12 | ||||
-rw-r--r-- | prototypes.h | 2 |
3 files changed, 15 insertions, 12 deletions
@@ -55,7 +55,7 @@ static void blit_chr_infos(SURFACES *surfaces, struct character_t *chr) TTF_CloseFont(police); } -void blit_ally_team(SURFACES *surfaces, POSITIONS *positions, struct team_t *team) +void blit_team(SURFACES *surfaces, struct team_t *team) { for (int i = 0; i < team->chr_cnt; i++) { struct character_t *chr = &team->chrs[i]; @@ -63,9 +63,12 @@ void blit_ally_team(SURFACES *surfaces, POSITIONS *positions, struct team_t *tea SDL_BlitSurface(chr->surf, NULL, surfaces->Pecran, &chr->pos); if (!chr->alive) { - positions->Vpositionmort.x=positions->Vpositionpersos[i].x+surfaces->Tperso[i]->w/2-surfaces->Pmort->w/2; - positions->Vpositionmort.y=positions->Vpositionpersos[i].y+surfaces->Tperso[i]->h/2-surfaces->Pmort->h/2; - SDL_BlitSurface(surfaces->Pmort,NULL,surfaces->Pecran,&positions->Vpositionmort); + SDL_Rect pos_dead; + + pos_dead.x = chr->pos.x + chr->surf->w / 2 - surfaces->Pmort->w / 2; + pos_dead.y = chr->pos.y + chr->surf->h / 2 - surfaces->Pmort->h / 2; + + SDL_BlitSurface(surfaces->Pmort, NULL, surfaces->Pecran, &pos_dead); } blit_chr_infos(surfaces, chr); } @@ -234,7 +237,7 @@ void Fafficherdegats (SURFACES *surfaces, POSITIONS *positions, int degats,int c positions->Vpositiondegats.x=positions->Vpositionpersos[cible].x+surfaces->Tperso[cible]->w+30; positions->Vpositiondegats.y=positions->Vpositionpersos[cible].y+surfaces->Tperso[cible]->h/2-surfaces->Pnbdegats->h/2; SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositionpvpersos[cible],surfaces->Pecran,&positions->Vpositionpvpersos[cible]); - blit_ally_team(surfaces, positions, ally); + blit_team(surfaces, ally); } positions->Vpositiondegats.w=surfaces->Pnbdegats->w; positions->Vpositiondegats.h=surfaces->Pnbdegats->h; @@ -5,16 +5,16 @@ #include "constantes.h" #include "prototypes.h" -static inline void highlight_current_character(struct team_t *ally, int character_idx) +static inline void highlight_current_character(struct team_t *team, int character_idx) { - struct character_t *chr = &ally->chrs[character_idx]; + struct character_t *chr = &team->chrs[character_idx]; chr->surf = chr->red_surf; } -static inline void unhighlight_prev_character(struct team_t *ally, int character_idx) +static inline void unhighlight_prev_character(struct team_t *team, int character_idx) { - struct character_t *chr = &ally->chrs[character_idx]; + struct character_t *chr = &team->chrs[character_idx]; chr->surf = chr->def_surf; } @@ -117,9 +117,9 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *ally,ENNEMI highlight_current_character(ally, Vtourallie); } - blit_ally_team(surfaces,positions, ally); // on blit les persos sur l'ecran Fblitterennemis(surfaces,positions,ennemis,Vnbennemis); // idem pour les ennemis + blit_team(surfaces, ally); while (continuer) { @@ -180,7 +180,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *ally,ENNEMI if (actionp && (*actionp)(surfaces,positions, ally, Vtourallie,ennemis,Vnbennemis) == ACTION_PERFORMED) { update_current_character(ally, &Vtourallie, (bool *)&Vtour); - blit_ally_team(surfaces, positions, ally); + blit_team(surfaces, ally); } } break; diff --git a/prototypes.h b/prototypes.h index 956e9b6..39888af 100644 --- a/prototypes.h +++ b/prototypes.h @@ -11,7 +11,7 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions); void Fchangersurlignage2 (int Vperso, SURFACES *surfaces, POSITIONS *positions); void Fremplirpersos2 (SURFACES *surfaces, PERSONNAGES persos[]); int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *ally,ENNEMIS ennemis[]); -void blit_ally_team(SURFACES *surfaces, POSITIONS *positions, struct team_t *); +void blit_team(SURFACES *surfaces, struct team_t *); void Finitialisersurfaces (SURFACES *surfaces); int Fchargerimages (SURFACES *surfaces); void Fdechargerimages (SURFACES *surfaces); |