summaryrefslogtreecommitdiff
path: root/blits.c
diff options
context:
space:
mode:
Diffstat (limited to 'blits.c')
-rw-r--r--blits.c77
1 files changed, 59 insertions, 18 deletions
diff --git a/blits.c b/blits.c
index 23913d8..eff5c4d 100644
--- a/blits.c
+++ b/blits.c
@@ -64,7 +64,58 @@ void blit_team(SURFACES *surfaces, struct team_t *team)
}
}
-void Fchangercurseurennemis (SURFACES *surfaces, POSITIONS *positions, struct character_t *chr)
+static void display_target_infos(SURFACES *surfaces, POSITIONS *positions, struct character_t *chr)
+{
+ SDL_Color color = {0x8a, 0x00, 0x00, 0x00};
+ TTF_Font *font = TTF_OpenFont("times.ttf", 20);
+ SDL_Surface *surf_name;
+ SDL_Rect pos_name;;
+
+ /* display the information frame */
+ SDL_BlitSurface(surfaces->Pcadrecible, NULL, surfaces->Pecran, &positions->Vpositioncadrecible);
+
+ /* display the name of the character */
+ surf_name = TTF_RenderText_Blended(font, chr->name, color);
+
+ pos_name.x = positions->Vpositioncadrecible.x + surfaces->Pcadrecible->w / 2 - surf_name->w / 2;
+ pos_name.y = positions->Vpositioncadrecible.y + 10;
+
+ /* display the affinities of the character */
+ blit_character_affinities(surfaces, positions, chr);
+
+ /* display its HP / MP */
+ Fblitterpvcible (surfaces,positions, chr);
+ Fblitterpmcible (surfaces,positions, chr);
+
+ SDL_BlitSurface(surf_name, NULL, surfaces->Pecran, &pos_name);
+
+ SDL_FreeSurface(surf_name);
+ TTF_CloseFont(font);
+}
+
+void update_selected_target(SURFACES *surfaces, POSITIONS *positions, struct character_t *chr)
+{
+ /* clear cursor */
+ SDL_BlitSurface(surfaces->Pfondjeu, &positions->last_cursor, surfaces->Pecran, &positions->last_cursor);
+
+ if (chr == NULL) {
+ /* clear the target informations frame */
+ SDL_BlitSurface(surfaces->Pfondjeu, &positions->Vpositioncadrecible, surfaces->Pecran, &positions->Vpositioncadrecible);
+ } else {
+ /* display the new cursor */
+ positions->last_cursor.x = chr->pos_curs.x;
+ positions->last_cursor.y = chr->pos_curs.y;
+
+ positions->last_cursor.w = chr->curs->w;
+ positions->last_cursor.h = chr->curs->h;
+
+ SDL_BlitSurface(chr->curs, NULL, surfaces->Pecran, &chr->pos_curs);
+
+ display_target_infos(surfaces, positions, chr);
+ }
+}
+
+void Fchangercurseurpersos (SURFACES *surfaces, POSITIONS *positions, struct character_t *chr)
{
SDL_Color couleur={120,0,0,0};
TTF_Font *police=NULL;
@@ -76,12 +127,15 @@ void Fchangercurseurennemis (SURFACES *surfaces, POSITIONS *positions, struct ch
surfaces->Pnomcible=NULL;
}
police=TTF_OpenFont("times.ttf",20);
- SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncurseurennemis,surfaces->Pecran,&positions->Vpositioncurseurennemis);
+
+ SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncurseurallies,surfaces->Pecran,&positions->Vpositioncurseurallies);
SDL_BlitSurface(surfaces->Pcadrecible, NULL, surfaces->Pecran, &positions->Vpositioncadrecible);
- positions->Vpositioncurseurennemis.x = chr->pos.x - 20 - surfaces->Pcurseurennemis->w;
- positions->Vpositioncurseurennemis.y = chr->pos.y + chr->surf->h / 2 - surfaces->Pcurseurennemis->h / 2;
- SDL_BlitSurface(surfaces->Pcurseurennemis, NULL, surfaces->Pecran, &positions->Vpositioncurseurennemis);
+
+ positions->Vpositioncurseurallies.x = chr->pos.x + 20 + chr->surf->w;
+ positions->Vpositioncurseurallies.y = chr->pos.y + chr->surf->h / 2 - surfaces->Pcurseurallies->h / 2;
+
+ SDL_BlitSurface(surfaces->Pcurseurallies, NULL, surfaces->Pecran, &positions->Vpositioncurseurallies);
string = (chr->name) ? chr->name : "NO NAME";
@@ -89,7 +143,6 @@ void Fchangercurseurennemis (SURFACES *surfaces, POSITIONS *positions, struct ch
positions->Vpositionnomcible.x = positions->Vpositioncadrecible.x + surfaces->Pcadrecible->w / 2 - surfaces->Pnomcible->w / 2;
positions->Vpositionnomcible.y = positions->Vpositioncadrecible.y + 10;
-
blit_character_affinities(surfaces, positions, chr);
Fblitterpvcible (surfaces,positions, chr);
@@ -99,18 +152,6 @@ void Fchangercurseurennemis (SURFACES *surfaces, POSITIONS *positions, struct ch
TTF_CloseFont(police);
}
-void Fchangercurseurpersos (SURFACES *surfaces, POSITIONS *positions,int selection)
-{
- SDL_BlitSurface (surfaces->Pfondjeu,&positions->Vpositioncurseurallies,surfaces->Pecran,&positions->Vpositioncurseurallies);
- SDL_Flip (surfaces->Pecran);
- SELECTION (0,ALLIE)
- SELECTION (1,ALLIE)
- SELECTION (2,ALLIE)
- SELECTION (3,ALLIE)
- SELECTION (4,ALLIE)
- SDL_Flip (surfaces->Pecran);
-}
-
void Fchangeractionselectionnee(SURFACES *surfaces, POSITIONS *positions,int selection,int page,int nbactions,int type,OBJET *objets)
{
int i;