summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions.c18
-rw-r--r--constantes.h180
-rw-r--r--jouer.c4
-rw-r--r--magies.c4
-rw-r--r--map.c2
-rw-r--r--menuchoixpersos.c3
-rw-r--r--menuprincipal.c3
7 files changed, 126 insertions, 88 deletions
diff --git a/actions.c b/actions.c
index 86533cc..5c31a08 100644
--- a/actions.c
+++ b/actions.c
@@ -30,6 +30,7 @@ void Fattaquer(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],int
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
+ case SDLK_a:
delay=0;
continuer = 0;
if(clan==ENNEMI)
@@ -43,6 +44,7 @@ void Fattaquer(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],int
break;
SELECTION_CIBLE()
case SDLK_RETURN:
+ case SDLK_f:
continuer=0;
max=Fcalculerdegats(persos,Vtourallie,&min,ennemis,selection,clan,TYPE_ATTAQUE);
degats=(rand()%(max-min+1))+min;
@@ -161,9 +163,11 @@ void Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES
case SDL_KEYDOWN:
switch (event.key.keysym.sym)
{
+ case SDLK_a:
case SDLK_ESCAPE:
continuer=0;
break;
+ case SDLK_k:
case SDLK_UP:
if(selection!=0)
selection--;
@@ -172,6 +176,7 @@ void Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES
page=selection/3;
Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE,NULL);
break;
+ case SDLK_j:
case SDLK_DOWN:
if (selection!=nbactions-1)
selection++;
@@ -180,6 +185,7 @@ void Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES
page=selection/3;
Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE,NULL);
break;
+ case SDLK_f:
case SDLK_RETURN:
SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositiondegats,surfaces->Pecran,&positions->Vpositiondegats);
SDL_Flip(surfaces->Pecran);
@@ -208,9 +214,11 @@ void Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *positions,PERSONNAG
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
+ case SDLK_a:
continuer=0;
break;
case SDLK_UP:
+ case SDLK_k:
if (selection!=0)
selection--;
else
@@ -219,6 +227,7 @@ void Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *positions,PERSONNAG
Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE,NULL);
break;
case SDLK_DOWN:
+ case SDLK_j:
if(selection!=nbactions-1)
selection++;
else
@@ -226,6 +235,7 @@ void Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *positions,PERSONNAG
page=selection/3;
Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE,NULL);
break;
+ case SDLK_f:
case SDLK_RETURN:
SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositiondegats,surfaces->Pecran,&positions->Vpositiondegats);
SDL_Flip(surfaces->Pecran);
@@ -255,9 +265,11 @@ void Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES pers
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
+ case SDLK_a:
continuer=0;
break;
case SDLK_UP:
+ case SDLK_k:
if(selection!=0)
selection--;
else
@@ -266,6 +278,7 @@ void Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES pers
Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS,objets);
break;
case SDLK_DOWN:
+ case SDLK_j:
if (selection!=nbactions-1)
selection++;
else
@@ -274,6 +287,7 @@ void Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES pers
Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS,objets);
break;
case SDLK_RETURN:
+ case SDLK_f:
SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositiondegats,surfaces->Pecran,&positions->Vpositiondegats);
SDL_Flip(surfaces->Pecran);
if(page==0)
@@ -324,6 +338,7 @@ int Fpotion(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],int *Vt
switch(event.key.keysym.sym)
{
case SDLK_ESCAPE:
+ case SDLK_a:
delay=0;
continuer = 0;
if(clan==ENNEMI)
@@ -337,6 +352,7 @@ int Fpotion(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],int *Vt
break;
SELECTION_CIBLE()
case SDLK_RETURN:
+ case SDLK_f:
if(type==POTION)
soins=1000;
else if(type==POTIONPLUS)
@@ -442,6 +458,7 @@ int Fether(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],int *Vto
switch(event.key.keysym.sym)
{
case SDLK_ESCAPE:
+ case SDLK_a:
delay=0;
continuer = 0;
if(clan==ENNEMI)
@@ -455,6 +472,7 @@ int Fether(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],int *Vto
break;
SELECTION_CIBLE()
case SDLK_RETURN:
+ case SDLK_f:
if(type==ETHER)
soins=10;
else if(type==ETHERPLUS)
diff --git a/constantes.h b/constantes.h
index 415074b..1b46e77 100644
--- a/constantes.h
+++ b/constantes.h
@@ -49,7 +49,6 @@
#define TYPE_ATTAQUE 0
#define TYPE_MAGIE 1
-
#define SELECTION(nb,nb2) if (selection == nb)\
{\
if(nb2==ALLIE)\
@@ -78,92 +77,97 @@
-#define SELECTION_CIBLE() case SDLK_RIGHT:\
- if(clan==ALLIE)\
- {\
- selection=0;\
- while(ennemis[selection].etat==MORT)\
- selection++;\
- inverse(&clan);\
- SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncurseurallies,surfaces->Pecran,&positions->Vpositioncurseurallies);\
- Fchangercurseurennemis (surfaces,positions,selection,ennemis);\
- }\
- break;\
- case SDLK_LEFT:\
- if(clan==ENNEMI)\
- {\
- SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncadrecible,surfaces->Pecran,&positions->Vpositioncadrecible);\
- selection=0;\
- while(persos[selection].etat==MORT)\
- selection++;\
- inverse(&clan);\
- SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositioncurseurennemis,surfaces->Pecran,&positions->Vpositioncurseurennemis);\
- Fchangercurseurpersos(surfaces,positions,selection,persos);\
- }\
- break;\
- case SDLK_UP:\
- if(clan==ENNEMI)\
- {\
- if (selection!=0)\
- selection--;\
- else\
- selection=Vnbennemis;\
- while(ennemis[selection].etat==MORT)\
- {\
- if(selection!=0)\
- selection--;\
- else\
- selection=Vnbennemis;\
- }\
- Fchangercurseurennemis (surfaces,positions,selection,ennemis);\
- }\
- else\
- {\
- if (selection!=0)\
- selection--;\
- else\
- selection=2;\
- while(persos[selection].etat==MORT)\
- {\
- if(selection!=0)\
- selection--;\
- else\
- selection=2;\
- }\
- Fchangercurseurpersos(surfaces,positions,selection,ennemis);\
- }\
- break;\
- case SDLK_DOWN:\
- if(clan==ENNEMI)\
- {\
- if(selection!=Vnbennemis)\
- selection++;\
- else\
- selection=0;\
- while(ennemis[selection].etat==MORT)\
- {\
- if(selection!=Vnbennemis)\
- selection++;\
- else\
- selection=0;\
- }\
- Fchangercurseurennemis(surfaces,positions,selection,ennemis);\
- }\
- else\
- {\
- if(selection!=2)\
- selection++;\
- else\
- selection=0;\
- while(persos[selection].etat==MORT)\
- {\
- if(selection!=2)\
- selection++;\
- else\
- selection=0;\
- }\
- Fchangercurseurpersos(surfaces,positions,selection,ennemis);\
- }\
- break;
+#define SELECTION_CIBLE() \
+ case SDLK_RIGHT:\
+case SDLK_l: \
+if(clan==ALLIE)\
+{\
+ selection=0;\
+ while(ennemis[selection].etat==MORT)\
+ selection++;\
+ inverse(&clan);\
+ SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncurseurallies,surfaces->Pecran,&positions->Vpositioncurseurallies);\
+ Fchangercurseurennemis (surfaces,positions,selection,ennemis);\
+}\
+break;\
+case SDLK_LEFT:\
+case SDLK_h: \
+if(clan==ENNEMI)\
+{\
+ SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncadrecible,surfaces->Pecran,&positions->Vpositioncadrecible);\
+ selection=0;\
+ while(persos[selection].etat==MORT)\
+ selection++;\
+ inverse(&clan);\
+ SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositioncurseurennemis,surfaces->Pecran,&positions->Vpositioncurseurennemis);\
+ Fchangercurseurpersos(surfaces,positions,selection,persos);\
+}\
+break;\
+case SDLK_UP:\
+case SDLK_k: \
+if(clan==ENNEMI)\
+{\
+ if (selection!=0)\
+ selection--;\
+ else\
+ selection=Vnbennemis;\
+ while(ennemis[selection].etat==MORT)\
+ {\
+ if(selection!=0)\
+ selection--;\
+ else\
+ selection=Vnbennemis;\
+ }\
+ Fchangercurseurennemis (surfaces,positions,selection,ennemis);\
+}\
+else\
+{\
+ if (selection!=0)\
+ selection--;\
+ else\
+ selection=2;\
+ while(persos[selection].etat==MORT)\
+ {\
+ if(selection!=0)\
+ selection--;\
+ else\
+ selection=2;\
+ }\
+ Fchangercurseurpersos(surfaces,positions,selection,ennemis);\
+}\
+break;\
+case SDLK_DOWN:\
+case SDLK_j:\
+if(clan==ENNEMI)\
+{\
+ if(selection!=Vnbennemis)\
+ selection++;\
+ else\
+ selection=0;\
+ while(ennemis[selection].etat==MORT)\
+ {\
+ if(selection!=Vnbennemis)\
+ selection++;\
+ else\
+ selection=0;\
+ }\
+ Fchangercurseurennemis(surfaces,positions,selection,ennemis);\
+}\
+else\
+{\
+ if(selection!=2)\
+ selection++;\
+ else\
+ selection=0;\
+ while(persos[selection].etat==MORT)\
+ {\
+ if(selection!=2)\
+ selection++;\
+ else\
+ selection=0;\
+ }\
+ Fchangercurseurpersos(surfaces,positions,selection,ennemis);\
+}\
+break;
#endif
diff --git a/jouer.c b/jouer.c
index 066fce8..0b7641a 100644
--- a/jouer.c
+++ b/jouer.c
@@ -57,12 +57,14 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, PERSONNAGES persos[],ENNEM
switch(event.key.keysym.unicode)
{
case SDLK_ESCAPE:
+ case SDLK_a:
continuer=0;
break;
}
switch (event.key.keysym.sym)
{
case SDLK_UP:
+ case SDLK_k:
if (selection!=0)
selection--;
else
@@ -71,6 +73,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, PERSONNAGES persos[],ENNEM
Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,ACTIONS,NULL);
break;
case SDLK_DOWN:
+ case SDLK_j:
if (selection!=nbactions-1)
selection++;
else
@@ -79,6 +82,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, PERSONNAGES persos[],ENNEM
Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,ACTIONS,NULL);
break;
case SDLK_RETURN:
+ case SDLK_f:
if(selection==ATTAQUE)
Fattaquer(surfaces,positions,persos,&Vtourallie,ennemis,Vnbennemis,&Vtour);
else if(selection==MAGIE_BLANCHE)
diff --git a/magies.c b/magies.c
index 35d2b00..8d0460d 100644
--- a/magies.c
+++ b/magies.c
@@ -30,6 +30,7 @@ int Fmagieelement (SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
+ case SDLK_a:
continuer = 0;
if(clan==ENNEMI)
{
@@ -42,6 +43,7 @@ int Fmagieelement (SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],
break;
SELECTION_CIBLE()
case SDLK_RETURN:
+ case SDLK_f:
continuer=0;
max=Fcalculerdegats(persos,Vtourallie,&min,ennemis,selection,clan,TYPE_MAGIE);
degats=(rand()%(max-min+1))+min;
@@ -151,6 +153,7 @@ int Fmagiesoin(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],int
switch(event.key.keysym.sym)
{
case SDLK_ESCAPE:
+ case SDLK_a:
continuer = 0;
if(clan==ENNEMI)
{
@@ -163,6 +166,7 @@ int Fmagiesoin(SURFACES *surfaces,POSITIONS *positions,PERSONNAGES persos[],int
break;
SELECTION_CIBLE()
case SDLK_RETURN:
+ case SDLK_f:
max=Fcalculersoins(persos,Vtourallie,&min,ennemis,selection);
soins=(rand()%(max-min+1))+min;
if(soins<0)
diff --git a/map.c b/map.c
index 49ef237..ff0d61a 100644
--- a/map.c
+++ b/map.c
@@ -23,9 +23,11 @@ void Fmap (SURFACES*surfaces, POSITIONS* positions,PERSONNAGES persos[],ENNEMIS
switch (event.key.keysym.sym)
{
case SDLK_RETURN:
+ case SDLK_f:
continuer=Fjouer(surfaces,positions,persos,ennemis);
break;
case SDLK_ESCAPE:
+ case SDLK_a:
continuer=0;
break;
}
diff --git a/menuchoixpersos.c b/menuchoixpersos.c
index f1df0a1..a41d548 100644
--- a/menuchoixpersos.c
+++ b/menuchoixpersos.c
@@ -55,6 +55,7 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions)
switch (event.key.keysym.sym)
{
case SDLK_LEFT:
+ case SDLK_h:
if(Vchoix>PALADIN)
{
Vchoix--;
@@ -67,6 +68,7 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions)
}
break;
case SDLK_RIGHT:
+ case SDLK_l:
if (Vchoix<VOLEUR)
{
Vchoix++;
@@ -79,6 +81,7 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions)
}
break;
case SDLK_RETURN:
+ case SDLK_f:
Fremplirpersos (Vchoix,persos,Vnbperso);
Vnbperso++;
continuer=0;
diff --git a/menuprincipal.c b/menuprincipal.c
index d3b4813..64ada29 100644
--- a/menuprincipal.c
+++ b/menuprincipal.c
@@ -21,6 +21,7 @@ void Fmenuprincipal (SURFACES *surfaces, POSITIONS *positions)
switch (event.key.keysym.sym)
{
case SDLK_DOWN:
+ case SDLK_j:
if (Vmode < 2)
{
@@ -34,6 +35,7 @@ void Fmenuprincipal (SURFACES *surfaces, POSITIONS *positions)
}
break;
case SDLK_UP:
+ case SDLK_k:
if (Vmode > 0)
{
Vmode--;
@@ -46,6 +48,7 @@ void Fmenuprincipal (SURFACES *surfaces, POSITIONS *positions)
}
break;
case SDLK_RETURN:
+ case SDLK_f:
continuer = Fentrermode (Vmode,surfaces,positions);
Vmode = 0;
if (continuer)