From 45d54652a8005ccae2466a0e4757017c7b337e3b Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 7 Jan 2015 21:43:18 +0100 Subject: use a team / character model instead of an array of personnages Signed-off-by: Olivier Gayot --- constantes.h | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) (limited to 'constantes.h') diff --git a/constantes.h b/constantes.h index 68872ab..1178eca 100644 --- a/constantes.h +++ b/constantes.h @@ -5,10 +5,32 @@ #define QUITTER 2 #define XWIN 1024 #define YWIN 768 -#define PALADIN 0 -#define PRETRE 1 -#define VOLEUR 2 -#define GUERRIER_GOBELIN 10 + +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 + * -> + */ + + CLASS_ALLY_CNT, + + CLASS_WARRIOR_GOBELIN = CLASS_ALLY_CNT, +#define GUERRIER_GOBELIN CLASS_WARRIOR_GOBELIN + /* XXX add new enemy classes here + * -> + */ + + CLASS_CNT, + CLASS_ENEMY_CNT = CLASS_CNT - CLASS_ALLY_CNT, +}; + #define VIE 1 #define MORT 0 @@ -46,8 +68,13 @@ #define SOINS 1 #define ALLIE 1 #define ENNEMI 0 -#define TYPE_ATTAQUE 0 -#define TYPE_MAGIE 1 + +enum damages_type_t { + DAMAGES_PHYSICAL, +#define TYPE_ATTAQUE DAMAGES_PHYSICAL + DAMAGES_MAGICAL, +#define TYPE_MAGIE DAMAGES_MAGICAL +}; enum action_state_t { ACTION_PERFORMED, @@ -104,11 +131,11 @@ if(clan==ENNEMI)\ {\ SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncadrecible,surfaces->Pecran,&positions->Vpositioncadrecible);\ selection=0;\ - while(persos[selection].etat==MORT)\ + while (!ally->chrs[selection].alive)\ selection++;\ inverse_boolean(clan);\ SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositioncurseurennemis,surfaces->Pecran,&positions->Vpositioncurseurennemis);\ - Fchangercurseurpersos(surfaces,positions,selection,persos);\ + Fchangercurseurpersos(surfaces,positions,selection);\ }\ break;\ case SDLK_UP:\ @@ -134,14 +161,14 @@ else\ selection--;\ else\ selection=2;\ - while(persos[selection].etat==MORT)\ + while (!ally->chrs[selection].alive)\ {\ if(selection!=0)\ selection--;\ else\ selection=2;\ }\ - Fchangercurseurpersos(surfaces,positions,selection,persos);\ + Fchangercurseurpersos(surfaces,positions,selection); \ }\ break;\ case SDLK_DOWN:\ @@ -167,14 +194,14 @@ else\ selection++;\ else\ selection=0;\ - while(persos[selection].etat==MORT)\ + while (!ally->chrs[selection].alive) \ {\ if(selection!=2)\ selection++;\ else\ selection=0;\ }\ - Fchangercurseurpersos(surfaces,positions,selection,persos);\ + Fchangercurseurpersos(surfaces,positions,selection); \ }\ break; -- cgit v1.2.3