From b3295086c84b09353d5e89c6f7c743167b486a49 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 7 Jan 2015 16:56:21 +0100 Subject: clean the code and fix bugs Signed-off-by: Olivier Gayot --- blits.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'blits.c') diff --git a/blits.c b/blits.c index d7b14e1..696228e 100644 --- a/blits.c +++ b/blits.c @@ -26,12 +26,8 @@ void Fblitterpersos (SURFACES *surfaces, POSITIONS *positions, PERSONNAGES perso int i; for(i=0;i<3;i++) { - if(persos[i].classe==PALADIN) - SDL_BlitSurface(surfaces->Ppaladin,NULL,surfaces->Pecran,&positions->Vpositionpersos[i]); - else if(persos[i].classe==PRETRE) - SDL_BlitSurface (surfaces->Ppretre,NULL,surfaces->Pecran,&positions->Vpositionpersos[i]); - else if(persos[i].classe==VOLEUR) - SDL_BlitSurface(surfaces->Pvoleur,NULL,surfaces->Pecran,&positions->Vpositionpersos[i]); + SDL_BlitSurface(surfaces->Tperso[i], NULL, surfaces->Pecran, &positions->Vpositionpersos[i]); + if(persos[i].etat==MORT) { positions->Vpositionmort.x=positions->Vpositionpersos[i].x+surfaces->Tperso[i]->w/2-surfaces->Pmort->w/2; @@ -378,6 +374,23 @@ void highlight_current_character(SURFACES* surfaces, PERSONNAGES persos[], int c } } +void unhighlight_prev_character(SURFACES *surfaces, PERSONNAGES persos[], int character_idx) +{ + switch (persos[character_idx].classe) { + case PALADIN: + surfaces->Tperso[character_idx] = surfaces->Ppaladin; + break; + case PRETRE: + surfaces->Tperso[character_idx] = surfaces->Ppretre; + break; + case VOLEUR: + surfaces->Tperso[character_idx] = surfaces->Pvoleur; + break; + default: + abort(); + } +} + void Fblitcoloredselection (SURFACES surfaces[],POSITIONS positions[],int Vtourallie,PERSONNAGES persos[]) { SDL_BlitSurface(surfaces->Tperso[Vtourallie],NULL,surfaces->Pecran,&positions->Vpositionpersos[Vtourallie]); -- cgit v1.2.3