From 461a28bb608e117267431eac78b08d3d8a089c0c Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 7 Jan 2015 15:34:29 +0100 Subject: do not pass a pointer to standard type when a copy is possible Signed-off-by: Olivier Gayot --- blits.c | 51 +++++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 38 deletions(-) (limited to 'blits.c') diff --git a/blits.c b/blits.c index 3a5a574..d7b14e1 100644 --- a/blits.c +++ b/blits.c @@ -361,46 +361,21 @@ void Fblitterfond(SURFACES* surfaces) SDL_Flip(surfaces->Pecran); } -void Fcolourselection(SURFACES* surfaces, PERSONNAGES persos[], int Vtourallie, POSITIONS* positions) +void highlight_current_character(SURFACES* surfaces, PERSONNAGES persos[], int character_idx) { - int x=0; - int i; - int y=0; - int tampon; - Uint32 pixel; - Uint8 r,g,b,a; - int ajout=30; - - /* TODO understand if these are needed or not */ - (void) persos; - (void) Vtourallie; - (void) positions; - - for(i=0;i<3;i++) - { - tampon=0; - SDL_LockSurface(surfaces->Tperso[i]); - for(y=0;yTperso[i]->h;y++) - { - for(x=0;xTperso[i]->w;x++) - { - pixel=obtenirPixel(surfaces->Tperso[i],x,y); - SDL_GetRGBA(pixel,surfaces->Pecran->format,&r,&g,&b,&a); - tampon=(int)r+ajout; - if(tampon>255) - tampon=255; - else if(tampon<0) - tampon=0; - r=(Uint8)tampon; - pixel=SDL_MapRGBA(surfaces->Pecran->format,r,g,b,a); - definirPixel(surfaces->Tperso[i],x,y,pixel); - } - } - SDL_UnlockSurface(surfaces->Tperso[i]); - SDL_SetColorKey(surfaces->Tperso[i],SDL_SRCCOLORKEY,SDL_MapRGB(surfaces->Pecran->format,r,g,b)); + switch (persos[character_idx].classe) { + case PALADIN: + surfaces->Tperso[character_idx] = surfaces->red_paladin; + break; + case PRETRE: + surfaces->Tperso[character_idx] = surfaces->red_priest; + break; + case VOLEUR: + surfaces->Tperso[character_idx] = surfaces->red_thief; + break; + default: + abort(); } - SDL_Flip(surfaces->Pecran); - } void Fblitcoloredselection (SURFACES surfaces[],POSITIONS positions[],int Vtourallie,PERSONNAGES persos[]) -- cgit v1.2.3