diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 16:53:35 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 16:53:35 +0100 |
commit | e8b35eae36f56492069d8f242c078ec5275d1a0b (patch) | |
tree | be50721ca7d46454d4be5ab311fdbee52578417a /blits.c | |
parent | 6d8f84b21c4423afa52a3d3c4ff88110dbe1d1be (diff) |
handle the selection of a target in a generic way.
we do not split the code of the selection of a target anymore.
Each action now does a very simple thing and as much efficiently as
possible.
every old function that are not used anymore have been removed.
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'blits.c')
-rw-r--r-- | blits.c | 137 |
1 files changed, 0 insertions, 137 deletions
@@ -115,43 +115,6 @@ void update_selected_target(SURFACES *surfaces, POSITIONS *positions, struct cha } } -void Fchangercurseurpersos (SURFACES *surfaces, POSITIONS *positions, struct character_t *chr) -{ - SDL_Color couleur={120,0,0,0}; - TTF_Font *police=NULL; - const char *string; - - if (surfaces->Pnomcible!=NULL) - { - SDL_FreeSurface (surfaces->Pnomcible); - surfaces->Pnomcible=NULL; - } - police=TTF_OpenFont("times.ttf",20); - - SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncurseurallies,surfaces->Pecran,&positions->Vpositioncurseurallies); - - SDL_BlitSurface(surfaces->Pcadrecible, NULL, surfaces->Pecran, &positions->Vpositioncadrecible); - - positions->Vpositioncurseurallies.x = chr->pos.x + 20 + chr->surf->w; - positions->Vpositioncurseurallies.y = chr->pos.y + chr->surf->h / 2 - surfaces->Pcurseurallies->h / 2; - - SDL_BlitSurface(surfaces->Pcurseurallies, NULL, surfaces->Pecran, &positions->Vpositioncurseurallies); - - string = (chr->name) ? chr->name : "NO NAME"; - - surfaces->Pnomcible = TTF_RenderText_Blended (police, string, couleur); - - positions->Vpositionnomcible.x = positions->Vpositioncadrecible.x + surfaces->Pcadrecible->w / 2 - surfaces->Pnomcible->w / 2; - positions->Vpositionnomcible.y = positions->Vpositioncadrecible.y + 10; - blit_character_affinities(surfaces, positions, chr); - - Fblitterpvcible (surfaces,positions, chr); - Fblitterpmcible (surfaces,positions, chr); - SDL_BlitSurface (surfaces->Pnomcible,NULL,surfaces->Pecran,&positions->Vpositionnomcible); - SDL_Flip (surfaces->Pecran); - TTF_CloseFont(police); -} - void update_list_entries(SURFACES *surfaces, POSITIONS *positions, const struct entry_t *entries, int cnt, int selected) { SDL_Color color = {0, 0, 0, 0}; @@ -192,106 +155,6 @@ void update_list_entries(SURFACES *surfaces, POSITIONS *positions, const struct SDL_Flip(surfaces->Pecran); } -void Fchangeractionselectionnee(SURFACES *surfaces, POSITIONS *positions,int selection,int page,int nbactions,int type) -{ - int i; - TTF_Font *police=NULL; - SDL_Color couleur={0,0,0,0}; - char chaine[3][50]; - police=TTF_OpenFont ("TIMESBI.TTF",20); - SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositioncadreactions,surfaces->Pecran,&positions->Vpositioncadreactions); - SDL_BlitSurface (surfaces->Pcadreactions,NULL,surfaces->Pecran,&positions->Vpositioncadreactions); - for(i=0;i<nbactions;i++) - { - if (selection==i) - SDL_BlitSurface (surfaces->Pactionselectionnee,NULL,surfaces->Pecran,&positions->Vpositionactionselectionnee[selection-page*3]); - } - for(i=0;i<3;i++) - { - if(surfaces->Pnomactions[i]!=NULL) - { - SDL_FreeSurface(surfaces->Pnomactions[i]); - surfaces->Pnomactions[i]=NULL; - } - } - if(type==ACTIONS) - { - if(page==0) - { - ECRIRE("ATTAQUE",0); - ECRIRE("MAGIE BLANCHE",1); - ECRIRE("MAGIE NOIRE",2); - } - else if(page==1) - { - ECRIRE("TECHNIQUES",0); - ECRIRE("OBJETS",1); - } - } - else if(type==MAGIE_BLANCHE) - { - if (page==0) - { - ECRIRE("SOIN",0); - } - } - else if(type==MAGIE_NOIRE) - { - if(page==0) - { - ECRIRE("FEU",0); - ECRIRE("GLACE",1); - ECRIRE("EAU",2); - } - else if(page==1) - { - ECRIRE("TONNERRE",0); - ECRIRE("CHOC",1); - } - } - else if(type==OBJETS) - { - if(page==0) - { - ECRIRE("POTION",0); - ECRIRE("ETHER",1); - ECRIRE("POTION +",2); -#if 0 - sprintf(chaine[0],"%d", ally->objects.potions); - surfaces->Pquantite[0]=TTF_RenderText_Blended(police,chaine[0],couleur); - sprintf(chaine[1],"%d", ally->objects.ethers); - surfaces->Pquantite[1]=TTF_RenderText_Blended(police,chaine[1],couleur); - sprintf(chaine[2],"%d", ally->objects.potionsplus); - surfaces->Pquantite[2]=TTF_RenderText_Blended(police,chaine[2],couleur); - SDL_BlitSurface(surfaces->Pquantite[0],NULL,surfaces->Pecran,&positions->Vpositionquantite[0]); - SDL_BlitSurface(surfaces->Pquantite[1],NULL,surfaces->Pecran,&positions->Vpositionquantite[1]); - SDL_BlitSurface(surfaces->Pquantite[2],NULL,surfaces->Pecran,&positions->Vpositionquantite[2]); -#endif - } - else if(page==1) - { - ECRIRE("ETHER +",0); -#if 0 - sprintf(chaine[0],"%d", ally->objects.ethersplus); - surfaces->Pquantite[0]=TTF_RenderText_Blended(police,chaine[0],couleur); - SDL_BlitSurface(surfaces->Pquantite[0],NULL,surfaces->Pecran,&positions->Vpositionquantite[0]); -#endif - } - } - if (page==nbactions/3) - { - if(3*(page+1)-nbactions==1) - SDL_BlitSurface (surfaces->Pactiondesactivee,NULL,surfaces->Pecran,&positions->Vpositionactionselectionnee[2]); - if(3*(page+1)-nbactions==2) - { - SDL_BlitSurface (surfaces->Pactiondesactivee,NULL,surfaces->Pecran,&positions->Vpositionactionselectionnee[2]); - SDL_BlitSurface (surfaces->Pactiondesactivee,NULL,surfaces->Pecran,&positions->Vpositionactionselectionnee[1]); - } - } - SDL_Flip(surfaces->Pecran); - TTF_CloseFont (police); -} - static void display_incr(SURFACES *surfaces, POSITIONS *positions, struct character_t *target, unsigned int incr, SDL_Color color) { TTF_Font *font = TTF_OpenFont("TIMES.TTF", 30); |