diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-07 15:34:29 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-07 15:34:29 +0100 |
commit | 461a28bb608e117267431eac78b08d3d8a089c0c (patch) | |
tree | 7fbd7306399db6223b1f0440d1fea6eb1c03b507 /blits.c | |
parent | 5b6986f617c554ac27b57373be0b874807e2d49d (diff) |
do not pass a pointer to standard type when a copy is possible
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'blits.c')
-rw-r--r-- | blits.c | 51 |
1 files changed, 13 insertions, 38 deletions
@@ -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;y<surfaces->Tperso[i]->h;y++) - { - for(x=0;x<surfaces->Tperso[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[]) |