summaryrefslogtreecommitdiff
path: root/actions.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-07 13:06:57 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-07 13:06:57 +0100
commitf4dee994b5f9019d805328d1019b4456f6bb4b2d (patch)
tree08bf5258c69a539380cefb2fa697b770efaa43f3 /actions.c
parente984a172127c3d13ac85c29511c68784ca43984c (diff)
game: added vim key bindings to UP/DOWN/LEFT/RIGHT
h/j/k/l are mapped to behave like arrow keys so that the navigation is easier in the menus. F and A are respectiverly used to validate and cancel as well. Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'actions.c')
-rw-r--r--actions.c18
1 files changed, 18 insertions, 0 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)