summaryrefslogtreecommitdiff
path: root/blits.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-07 16:56:21 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-07 16:56:21 +0100
commitb3295086c84b09353d5e89c6f7c743167b486a49 (patch)
treefc9dcc035c486d028bf4460c1b2d9e988efed9d4 /blits.c
parent461a28bb608e117267431eac78b08d3d8a089c0c (diff)
clean the code and fix bugs
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'blits.c')
-rw-r--r--blits.c25
1 files changed, 19 insertions, 6 deletions
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]);