summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-08 12:46:36 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-08 12:46:36 +0100
commitadceeb1192fdd1d14e0f55219bbd1bcb14eacc05 (patch)
tree459ef1cca58cd8975ded85bba7db639ae76a3528
parent9a98118c3d9a062b33134e8354620be43ecf3786 (diff)
use the objects assigned to the teams instead of a common array
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r--actions.c46
-rw-r--r--blits.c14
-rw-r--r--jouer.c6
-rw-r--r--prototypes.h6
4 files changed, 38 insertions, 34 deletions
diff --git a/actions.c b/actions.c
index 09fd3af..096fba9 100644
--- a/actions.c
+++ b/actions.c
@@ -117,7 +117,7 @@ enum action_state_t Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positi
while (continuer)
{
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE,NULL);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE);
SDL_WaitEvent (&event);
switch (event.type)
{
@@ -135,7 +135,7 @@ enum action_state_t Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positi
else
selection=nbactions-1;
page=selection/3;
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE,NULL);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE);
break;
case SDLK_j:
case SDLK_DOWN:
@@ -144,7 +144,7 @@ enum action_state_t Fselectionnermagienoire(SURFACES *surfaces,POSITIONS *positi
else
selection=0;
page=selection/3;
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE,NULL);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_NOIRE);
break;
case SDLK_f:
case SDLK_RETURN:
@@ -177,7 +177,7 @@ enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *posi
while (continuer)
{
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE,NULL);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE);
SDL_WaitEvent (&event);
switch (event.type)
{
@@ -195,7 +195,7 @@ enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *posi
else
selection=nbactions-1;
page=selection/3;
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE,NULL);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE);
break;
case SDLK_DOWN:
case SDLK_j:
@@ -204,7 +204,7 @@ enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *posi
else
selection=0;
page=selection/3;
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE,NULL);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,MAGIE_BLANCHE);
break;
case SDLK_f:
case SDLK_RETURN:
@@ -237,7 +237,7 @@ enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,
while (continuer)
{
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS, &ally->objects);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS);
SDL_WaitEvent (&event);
switch (event.type)
{
@@ -255,7 +255,7 @@ enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,
else
selection=nbactions-1;
page=selection/3;
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS, &ally->objects);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS);
break;
case SDLK_DOWN:
case SDLK_j:
@@ -264,7 +264,7 @@ enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,
else
selection=0;
page=selection/3;
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS, &ally->objects);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,OBJETS);
break;
case SDLK_RETURN:
case SDLK_f:
@@ -273,17 +273,17 @@ enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,
if(page==0)
{
if(selection==POTION)
- ret = Fpotion(surfaces,positions, ally, enemy, &ally->objects,selection);
+ ret = Fpotion(surfaces,positions, ally, enemy, selection);
else if(selection==ETHER)
- ret = Fether(surfaces,positions, ally, enemy, &ally->objects,selection);
+ ret = Fether(surfaces,positions, ally, enemy, selection);
else if(selection==POTIONPLUS)
- ret = Fpotion(surfaces,positions, ally, enemy, &ally->objects,selection);
+ ret = Fpotion(surfaces,positions, ally, enemy, selection);
}
else if(page==1)
{
if(selection==ETHERPLUS)
- ret = Fether(surfaces,positions, ally, enemy, &ally->objects,selection);
+ ret = Fether(surfaces,positions, ally, enemy, selection);
}
if (ret == ACTION_PERFORMED) {
@@ -300,7 +300,7 @@ enum action_state_t Fselectionnerobjet(SURFACES *surfaces,POSITIONS *positions,
return ret;
}
-enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, OBJET *objets,int type)
+enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, int type)
{
struct character_t *target;
SDL_Event event;
@@ -308,9 +308,9 @@ enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team
int soins=0;
int clan=ALLIE;
- if(type==POTION&&objets->potions<=0)
+ if (type == POTION && ally->objects.potions <= 0)
return ACTION_ERROR;
- else if(type==POTIONPLUS&&objets->potionsplus<=0)
+ else if(type == POTIONPLUS && ally->objects.potionsplus <= 0)
return ACTION_ERROR;
SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncadreactions,surfaces->Pecran,&positions->Vpositioncadreactions);
@@ -344,10 +344,10 @@ enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team
if (type == POTION) {
soins = 1000;
- objets->potions--;
+ ally->objects.potions--;
} else if (type == POTIONPLUS) {
soins = 4000;
- objets->potionsplus--;
+ ally->objects.potionsplus--;
}
cure_target_hp(surfaces, positions, target, soins);
@@ -365,7 +365,7 @@ enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team
}
}
-enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, OBJET *objets,int type)
+enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, int type)
{
struct character_t *target;
SDL_Event event;
@@ -373,9 +373,9 @@ enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_
int soins=0;
int clan=ALLIE;
- if(type==ETHER&&objets->ethers<=0)
+ if (type == ETHER && ally->objects.ethers <= 0)
return ACTION_ERROR;
- else if(type==ETHERPLUS&&objets->ethersplus<=0)
+ else if (type == ETHERPLUS && ally->objects.ethersplus <= 0)
return ACTION_ERROR;
SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncadreactions,surfaces->Pecran,&positions->Vpositioncadreactions);
@@ -407,10 +407,10 @@ enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_
if (type == ETHER) {
soins = 10;
- objets->ethers--;
+ ally->objects.ethers--;
} else if (type == ETHERPLUS) {
soins = 40;
- objets->ethersplus--;
+ ally->objects.ethersplus--;
}
cure_target_mp(surfaces, positions, target, soins);
diff --git a/blits.c b/blits.c
index eff5c4d..318e72f 100644
--- a/blits.c
+++ b/blits.c
@@ -152,7 +152,7 @@ void Fchangercurseurpersos (SURFACES *surfaces, POSITIONS *positions, struct cha
TTF_CloseFont(police);
}
-void Fchangeractionselectionnee(SURFACES *surfaces, POSITIONS *positions,int selection,int page,int nbactions,int type,OBJET *objets)
+void Fchangeractionselectionnee(SURFACES *surfaces, POSITIONS *positions,int selection,int page,int nbactions,int type)
{
int i;
TTF_Font *police=NULL;
@@ -216,22 +216,26 @@ void Fchangeractionselectionnee(SURFACES *surfaces, POSITIONS *positions,int sel
ECRIRE("POTION",0);
ECRIRE("ETHER",1);
ECRIRE("POTION +",2);
- sprintf(chaine[0],"%d",objets->potions);
+#if 0
+ sprintf(chaine[0],"%d", ally->objects.potions);
surfaces->Pquantite[0]=TTF_RenderText_Blended(police,chaine[0],couleur);
- sprintf(chaine[1],"%d",objets->ethers);
+ sprintf(chaine[1],"%d", ally->objects.ethers);
surfaces->Pquantite[1]=TTF_RenderText_Blended(police,chaine[1],couleur);
- sprintf(chaine[2],"%d",objets->potionsplus);
+ sprintf(chaine[2],"%d", ally->objects.potionsplus);
surfaces->Pquantite[2]=TTF_RenderText_Blended(police,chaine[2],couleur);
SDL_BlitSurface(surfaces->Pquantite[0],NULL,surfaces->Pecran,&positions->Vpositionquantite[0]);
SDL_BlitSurface(surfaces->Pquantite[1],NULL,surfaces->Pecran,&positions->Vpositionquantite[1]);
SDL_BlitSurface(surfaces->Pquantite[2],NULL,surfaces->Pecran,&positions->Vpositionquantite[2]);
+#endif
}
else if(page==1)
{
ECRIRE("ETHER +",0);
- sprintf(chaine[0],"%d",objets->ethersplus);
+#if 0
+ sprintf(chaine[0],"%d", ally->objects.ethersplus);
surfaces->Pquantite[0]=TTF_RenderText_Blended(police,chaine[0],couleur);
SDL_BlitSurface(surfaces->Pquantite[0],NULL,surfaces->Pecran,&positions->Vpositionquantite[0]);
+#endif
}
}
if (page==nbactions/3)
diff --git a/jouer.c b/jouer.c
index 4514524..04e7188 100644
--- a/jouer.c
+++ b/jouer.c
@@ -105,7 +105,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *ally, struc
else // sinon si c'est le dernier
ally->chr_cur = 0; // on reprend le 1er
}
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,ACTIONS,NULL);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,ACTIONS);
SDL_WaitEvent(&event);
switch(event.type)
{
@@ -126,7 +126,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *ally, struc
else
selection=nbactions-1;
page=selection/3;
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,ACTIONS,NULL);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,ACTIONS);
break;
case SDLK_DOWN:
case SDLK_j:
@@ -135,7 +135,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *ally, struc
else
selection=0;
page=selection/3;
- Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,ACTIONS,NULL);
+ Fchangeractionselectionnee(surfaces,positions,selection,page,nbactions,ACTIONS);
break;
case SDLK_RETURN:
case SDLK_f:
diff --git a/prototypes.h b/prototypes.h
index b871365..d377fdf 100644
--- a/prototypes.h
+++ b/prototypes.h
@@ -25,8 +25,8 @@ enum action_state_t Fselectionnermagieblanche(SURFACES *surfaces,POSITIONS *posi
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, enum element_t);
enum action_state_t Fmagiesoin (SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy);
-enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy,OBJET *objets,int type);
-enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy,OBJET *objets,int type);
+enum action_state_t Fpotion(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, int type);
+enum action_state_t Fether(SURFACES *surfaces,POSITIONS *positions, struct team_t *ally, struct team_t *enemy, int type);
int compute_damages(const struct character_t *src, const struct character_t *target, enum damages_type_t, enum element_t);
int compute_cure(const struct character_t *src, const struct character_t *target);
@@ -40,7 +40,7 @@ void cure_target_mp(SURFACES *surfaces, POSITIONS *, struct character_t *target,
void update_selected_target(SURFACES *surfaces, POSITIONS *positions, struct character_t *);
void Fblitteractivedesactive (SURFACES *surfaces,POSITIONS *positions,ENNEMIS ennemis[],int selection);
void blit_character_affinities(SURFACES *, POSITIONS *, const struct character_t *);
-void Fchangeractionselectionnee(SURFACES *surfaces, POSITIONS *positions,int selection,int page,int nbactions,int type,OBJET *objets);
+void Fchangeractionselectionnee(SURFACES *surfaces, POSITIONS *positions,int selection,int page,int nbactions,int type);
void Fblitterpvcible (SURFACES *surfaces,POSITIONS *positions, const struct character_t *);
void Fblitterpmcible (SURFACES *surfaces,POSITIONS *positions, const struct character_t *);
void Fremplirobjets(OBJET *objets);