summaryrefslogtreecommitdiff
path: root/blits.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-07 23:18:11 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-07 23:51:30 +0100
commita50e94bce89f17148b0640909fd9b536c4599d9e (patch)
tree3faf9bf2bb6a9074d357e75c05684843b39ff89d /blits.c
parent7bb8e452b2f2349ea2fae60eaf69adbcf7a182a8 (diff)
make team blitting and characters highlighting generic
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'blits.c')
-rw-r--r--blits.c13
1 files changed, 8 insertions, 5 deletions
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;