summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions.c195
-rw-r--r--prototypes.h3
2 files changed, 1 insertions, 197 deletions
diff --git a/actions.c b/actions.c
index cb0d8ea..1005ab7 100644
--- a/actions.c
+++ b/actions.c
@@ -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);