diff options
-rw-r--r-- | constantes.h | 157 | ||||
-rw-r--r-- | menuchoixpersos.c | 22 |
2 files changed, 14 insertions, 165 deletions
diff --git a/constantes.h b/constantes.h index 7e8a897..36fdf6d 100644 --- a/constantes.h +++ b/constantes.h @@ -1,8 +1,10 @@ #ifndef CONSTANTES_H #define CONSTANTES_H + #define JOUER 0 #define OPTIONS 1 #define QUITTER 2 + #define XWIN 1024 #define YWIN 768 @@ -10,11 +12,8 @@ enum character_class_t { CLASS_INVAL = -1, CLASS_PALADIN, -#define PALADIN CLASS_PALADIN CLASS_PRIEST, -#define PRETRE CLASS_PRIEST CLASS_THIEF, -#define VOLEUR CLASS_THIEF /* XXX add new ally classes here * -> */ @@ -22,7 +21,6 @@ enum character_class_t { CLASS_ALLY_CNT, CLASS_WARRIOR_GOBELIN = CLASS_ALLY_CNT, -#define GUERRIER_GOBELIN CLASS_WARRIOR_GOBELIN /* XXX add new enemy classes here * -> */ @@ -31,32 +29,19 @@ enum character_class_t { CLASS_ENEMY_CNT = CLASS_CNT - CLASS_ALLY_CNT, }; -#define VIE 1 #define MORT 0 -//type de sort - enum element_t { ELEMENT_FIRE, -#define FEU ELEMENT_FIRE ELEMENT_ICE, -#define GLACE ELEMENT_ICE ELEMENT_WATER, -#define EAU ELEMENT_WATER ELEMENT_THUNDER, -#define TONNERRE ELEMENT_THUNDER ELEMENT_COUNT, ELEMENT_NONE = ELEMENT_COUNT, -#define NON_ELEMENTAIRE ELEMENT_NONE -#define CHOC ELEMENT_NONE }; - -#define SOIN 0 - -//caractéristiques enum affinity_t { AFFINITY_ABSORPTION, AFFINITY_INVULNERABILITY, @@ -66,36 +51,18 @@ enum affinity_t { AFFINITY_COUNT, }; -#define SENSIBILITE 1 -#define RESISTANCE 2 -#define INVULNERABILITE 3 -#define ABSORBTION 4 - -//active / desactivé -#define ACTIVE 1 -#define DESACTIVE 0 - -#define ATTAQUE 0 -#define MAGIE_BLANCHE 1 -#define MAGIE_NOIRE 2 -#define TECHNIQUES 3 -#define OBJETS 4 #define POTION 0 #define ETHER 1 #define POTIONPLUS 2 #define ETHERPLUS 3 -#define ACTIONS 5 -#define DEGATS 0 -#define SOINS 1 + #define ALLIE 1 #define ENNEMI 0 enum damages_type_t { DAMAGES_PHYSICAL, -#define TYPE_ATTAQUE DAMAGES_PHYSICAL DAMAGES_MAGICAL, -#define TYPE_MAGIE DAMAGES_MAGICAL }; enum action_state_t { @@ -106,130 +73,12 @@ enum action_state_t { ACTION_COUNT, }; -#define SELECTION(nb,nb2) if (selection == nb)\ - {\ - if(nb2==ALLIE)\ - {\ - positions->Vpositioncurseurallies.x = positions->Vpositionpersos[nb].x + 20 + surfaces->Tperso[nb]->w;\ - positions->Vpositioncurseurallies.y = positions->Vpositionpersos[nb].y + surfaces->Tperso[nb]->h/2 - surfaces->Pcurseurallies->h/2;\ - SDL_BlitSurface (surfaces->Pcurseurallies,NULL,surfaces->Pecran,&positions->Vpositioncurseurallies);\ - }\ - else\ - {\ - SDL_BlitSurface (surfaces->Pcadrecible,NULL,surfaces->Pecran,&positions->Vpositioncadrecible);\ - positions->Vpositioncurseurennemis.x=positions->Vpositionennemis[nb].x-20-surfaces->Pcurseurennemis->w;\ - positions->Vpositioncurseurennemis.y=positions->Vpositionennemis[nb].y+surfaces->Tennemi[nb]->h/2 - surfaces->Pcurseurennemis->h/2;\ - SDL_BlitSurface (surfaces->Pcurseurennemis,NULL,surfaces->Pecran,&positions->Vpositioncurseurennemis);\ - }\ - } -#define ECRIRE(texte,id)sprintf(chaine[id],texte);\ - surfaces->Pnomactions[id]=TTF_RenderText_Blended(police,chaine[id],couleur);\ - SDL_BlitSurface (surfaces->Pnomactions[id],NULL,surfaces->Pecran,&positions->Vpositionnomactions[id]); - //map #define SOL 0 #define MUR 1 #define COFFRE 2 #define GUS 3 - - -#define SELECTION_CIBLE() \ - case SDLK_RIGHT:\ -case SDLK_l: \ -if(clan==ALLIE)\ -{\ - selection=0;\ - while(!enemy->chrs[selection].alive) \ - selection++;\ - inverse_boolean(clan);\ - update_selected_target (surfaces,positions, &enemy->chrs[selection]);\ - SDL_Flip(surfaces->Pecran); \ -}\ -break;\ -case SDLK_LEFT:\ -case SDLK_h: \ -if(clan==ENNEMI)\ -{\ - SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncadrecible,surfaces->Pecran,&positions->Vpositioncadrecible);\ - selection=0;\ - while (!ally->chrs[selection].alive)\ - selection++;\ - inverse_boolean(clan);\ - update_selected_target(surfaces,positions, &ally->chrs[selection]);\ - SDL_Flip(surfaces->Pecran); \ -}\ -break;\ -case SDLK_UP:\ -case SDLK_k: \ -if(clan==ENNEMI)\ -{\ - if (selection!=0)\ - selection--;\ - else\ - selection = enemy->chr_cnt;\ - while(!enemy->chrs[selection].alive) \ - {\ - if(selection!=0)\ - selection--;\ - else\ - selection = enemy->chr_cnt;\ - }\ - update_selected_target (surfaces,positions, &enemy->chrs[selection]);\ - SDL_Flip(surfaces->Pecran); \ -}\ -else\ -{\ - if (selection!=0)\ - selection--;\ - else\ - selection=2;\ - while (!ally->chrs[selection].alive)\ - {\ - if(selection!=0)\ - selection--;\ - else\ - selection=2;\ - }\ - update_selected_target(surfaces,positions, &ally->chrs[selection]); \ - SDL_Flip(surfaces->Pecran); \ -}\ -break;\ -case SDLK_DOWN:\ -case SDLK_j:\ -if(clan==ENNEMI)\ -{\ - if (selection != enemy->chr_cnt)\ - selection++;\ - else\ - selection=0;\ - while(!enemy->chrs[selection].alive) { \ - if(selection != enemy->chr_cnt) \ - selection++;\ - else\ - selection=0;\ - }\ - update_selected_target(surfaces,positions, &enemy->chrs[selection]); \ - SDL_Flip(surfaces->Pecran); \ -}\ -else\ -{\ - if(selection!=2)\ - selection++;\ - else\ - selection=0;\ - while (!ally->chrs[selection].alive) \ - {\ - if(selection!=2)\ - selection++;\ - else\ - selection=0;\ - }\ - update_selected_target(surfaces,positions, &ally->chrs[selection]); \ - SDL_Flip(surfaces->Pecran); \ -}\ -break; - #define countof(_array) ((int)(sizeof((_array)) / sizeof((_array)[0]))) #include <stdbool.h> diff --git a/menuchoixpersos.c b/menuchoixpersos.c index f3f5cd3..e2d5cfc 100644 --- a/menuchoixpersos.c +++ b/menuchoixpersos.c @@ -145,7 +145,7 @@ struct team_t *new_enemy_team(SURFACES *surfaces, const struct team_t *ally_team void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) { TTF_Font *police = NULL; - int Vchoix = PALADIN; + int Vchoix = CLASS_PALADIN; SDL_Color vert; bool continuer = true; struct team_t *ally_team; @@ -169,11 +169,11 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) }; /* display the background with the selected text */ - if (Vchoix == PALADIN) { + if (Vchoix == CLASS_PALADIN) { SDL_BlitSurface (surfaces->Pchoixpaladin,NULL,surfaces->Pecran,&positions->Vpositionmenu); - } else if (Vchoix == PRETRE) { + } else if (Vchoix == CLASS_PRIEST) { SDL_BlitSurface (surfaces->Pchoixpretre,NULL,surfaces->Pecran,&positions->Vpositionmenu); - } else if (Vchoix == VOLEUR) { + } else if (Vchoix == CLASS_THIEF) { SDL_BlitSurface (surfaces->Pchoixvoleur,NULL,surfaces->Pecran,&positions->Vpositionmenu); } else { abort(); @@ -201,20 +201,20 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) { case SDLK_LEFT: case SDLK_h: - if (Vchoix > PALADIN) { + if (Vchoix > CLASS_PALADIN) { Vchoix--; } else { - Vchoix=VOLEUR; + Vchoix = CLASS_THIEF; } Fchangersurlignage2 (Vchoix,surfaces,positions); break; case SDLK_RIGHT: case SDLK_l: - if (Vchoix < VOLEUR) { + if (Vchoix < CLASS_THIEF) { Vchoix++; } else { - Vchoix = PALADIN; + Vchoix = CLASS_PALADIN; } Fchangersurlignage2 (Vchoix,surfaces,positions); break; @@ -239,11 +239,11 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) void Fchangersurlignage2 (int Vchoix, SURFACES *surfaces, POSITIONS *positions) { - if (Vchoix==PALADIN) + if (Vchoix == CLASS_PALADIN) SDL_BlitSurface (surfaces->Pchoixpaladin,NULL,surfaces->Pecran,&positions->Vpositionmenu); - else if (Vchoix==PRETRE) + else if (Vchoix == CLASS_PRIEST) SDL_BlitSurface (surfaces->Pchoixpretre,NULL,surfaces->Pecran,&positions->Vpositionmenu); - else if (Vchoix==VOLEUR) + else if (Vchoix == CLASS_THIEF) SDL_BlitSurface (surfaces->Pchoixvoleur,NULL,surfaces->Pecran,&positions->Vpositionmenu); SDL_BlitSurface (surfaces->Ppretre,NULL,surfaces->Pecran,&positions->Vpositionmenupretre); SDL_BlitSurface (surfaces->Ppaladin,NULL,surfaces->Pecran,&positions->Vpositionmenupaladin); |