From a50e94bce89f17148b0640909fd9b536c4599d9e Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 7 Jan 2015 23:18:11 +0100 Subject: make team blitting and characters highlighting generic Signed-off-by: Olivier Gayot --- blits.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'blits.c') diff --git a/blits.c b/blits.c index 502883f..e17140f 100644 --- a/blits.c +++ b/blits.c @@ -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; -- cgit v1.2.3