diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 15:41:05 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-08 15:41:05 +0100 |
commit | 9b863d19acd0497f6cb9c0d3bff59765ef1abaa8 (patch) | |
tree | 961f7a97ae14f9664457485328a1e75b4fa39ea6 | |
parent | 1f9c71b49eeef9cd05b542515c06200b4a25f693 (diff) |
remove old functions to select an entry
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r-- | actions.c | 195 | ||||
-rw-r--r-- | prototypes.h | 3 |
2 files changed, 1 insertions, 197 deletions
@@ -18,6 +18,7 @@ enum action_state_t Fattaquer(SURFACES *surfaces,POSITIONS *positions, struct te while(!enemy->chrs[selection].alive) selection++; + update_selected_target(surfaces, positions, &enemy->chrs[selection]); for (;;) { @@ -109,200 +110,6 @@ int compute_damages(const struct character_t *src, const struct character_t *des return rand() % (max - min + 1) + min; } -enum action_state_t Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy) -{ - SDL_Event event; - unsigned int continuer=1; - enum action_state_t ret = ACTION_CANCELED; - int nbactions=5; - int page=0; - int selection=0; - - while (continuer) - { - Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE); - SDL_WaitEvent (&event); - switch (event.type) - { - 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--; - else - selection=nbactions-1; - page=selection/3; - Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE); - break; - case SDLK_j: - case SDLK_DOWN: - if (selection!=nbactions-1) - selection++; - else - selection=0; - page=selection/3; - Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE); - break; - case SDLK_f: - case SDLK_RETURN: - SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositiondegats,surfaces->Pecran,&positions->Vpositiondegats); - SDL_Flip(surfaces->Pecran); - ret = Fmagieelement(surfaces,positions, ally, enemy, (enum element_t []) {selection}); - - if (ret == ACTION_PERFORMED) { - continuer = 0; - } - - break; - default: - break; - } - } - } - - return ret; -} - -enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy) -{ - enum action_state_t ret = ACTION_CANCELED; - int continuer=1; - int nbactions=1; - int page=0; - int selection=0; - SDL_Event event; - - while (continuer) - { - Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE); - SDL_WaitEvent (&event); - switch (event.type) - { - case SDL_KEYDOWN: - 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 - selection=nbactions-1; - page=selection/3; - Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE); - break; - case SDLK_DOWN: - case SDLK_j: - if(selection!=nbactions-1) - selection++; - else - selection=0; - page=selection/3; - Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE); - break; - case SDLK_f: - case SDLK_RETURN: - SDL_BlitSurface(surfaces->Pfondjeu,&positions->Vpositiondegats,surfaces->Pecran,&positions->Vpositiondegats); - SDL_Flip(surfaces->Pecran); - if(selection==SOIN) - ret = Fmagiesoin(surfaces,positions, ally, enemy, NULL); - - if (ret == ACTION_PERFORMED) { - continuer = 0; - } - break; - default: - break; - } - } - } - - return ret; -} - -enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy) -{ - enum action_state_t ret = ACTION_CANCELED; - SDL_Event event; - unsigned int continuer=1; - int nbactions=4; - int page=0; - int selection=0; - - while (continuer) - { - Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS); - SDL_WaitEvent (&event); - switch (event.type) - { - case SDL_KEYDOWN: - 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 - selection=nbactions-1; - page=selection/3; - Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS); - break; - case SDLK_DOWN: - case SDLK_j: - if (selection!=nbactions-1) - selection++; - else - selection=0; - page=selection/3; - Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,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) - { - if(selection==POTION) - ret = Fpotion(surfaces,positions, ally, enemy, (int []) {selection}); - else if(selection==ETHER) - ret = Fether(surfaces,positions, ally, enemy, (int []) {selection}); - else if(selection==POTIONPLUS) - ret = Fpotion(surfaces,positions, ally, enemy, (int []) { selection}); - - } - else if(page==1) - { - if(selection==ETHERPLUS) - ret = Fether(surfaces,positions, ally, enemy, (int []) { selection}); - } - - if (ret == ACTION_PERFORMED) { - continuer = 0; - } - - break; - default: - break; - } - } - } - - return ret; -} - enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, void *data) { struct character_t *target; diff --git a/prototypes.h b/prototypes.h index a33c4ea..2b69a76 100644 --- a/prototypes.h +++ b/prototypes.h @@ -21,9 +21,6 @@ void Finitialiserpositions (POSITIONS *positions, SURFACES *surfaces); /* actions */ enum action_state_t Fattaquer (SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, void *data); -enum action_state_t Fselectionnermagienoire (SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy); -enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy); -enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy); enum action_state_t Fmagieelement (SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, void *data); enum action_state_t Fmagiesoin (SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, void *data); enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, void *data); |