summaryrefslogtreecommitdiff
path: root/blits.c
diff options
context:
space:
mode:
Diffstat (limited to 'blits.c')
-rw-r--r--blits.c55
1 files changed, 37 insertions, 18 deletions
diff --git a/blits.c b/blits.c
index c9bf855..cfedd5f 100644
--- a/blits.c
+++ b/blits.c
@@ -125,7 +125,7 @@ void Fblitterpmcible (SURFACES *surfaces,POSITIONS *positions, const struct char
TTF_CloseFont (police);
}
-static void display_target_infos(SURFACES *surfaces, POSITIONS *positions, struct character_t *chr)
+static void display_target_infos(SURFACES *surfaces, POSITIONS *positions, struct target_t *target)
{
SDL_Color color = {0x8a, 0x00, 0x00, 0x00};
TTF_Font *font = TTF_OpenFont("times.ttf", 20);
@@ -135,18 +135,22 @@ static void display_target_infos(SURFACES *surfaces, POSITIONS *positions, struc
/* 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);
+ if (target->is_chr) {
+ /* display the name of the character */
+ surf_name = TTF_RenderText_Blended(font, target->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, target->chr);
- /* display the affinities of the character */
- blit_character_affinities(surfaces, positions, chr);
+ /* display its HP / MP */
+ Fblitterpvcible (surfaces,positions, target->chr);
+ Fblitterpmcible (surfaces,positions, target->chr);
+ } else {
+ surf_name = TTF_RenderText_Blended(font, target->team->name, color);
+ }
- /* display its HP / MP */
- Fblitterpvcible (surfaces,positions, chr);
- Fblitterpmcible (surfaces,positions, chr);
+ pos_name.x = positions->Vpositioncadrecible.x + surfaces->Pcadrecible->w / 2 - surf_name->w / 2;
+ pos_name.y = positions->Vpositioncadrecible.y + 10;
SDL_BlitSurface(surf_name, NULL, surfaces->Pecran, &pos_name);
@@ -154,25 +158,40 @@ static void display_target_infos(SURFACES *surfaces, POSITIONS *positions, struc
TTF_CloseFont(font);
}
-void update_selected_target(SURFACES *surfaces, POSITIONS *positions, struct character_t *chr)
+void update_selected_target(SURFACES *surfaces, POSITIONS *positions, struct target_t *target)
{
/* clear cursor */
SDL_BlitSurface(surfaces->Pfondjeu, &positions->last_cursor, surfaces->Pecran, &positions->last_cursor);
- if (chr == NULL) {
+ if (target == 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;
+ if (target->is_chr) {
+ positions->last_cursor.x = target->chr->pos_curs.x;
+ positions->last_cursor.y = target->chr->pos_curs.y;
- positions->last_cursor.w = chr->curs->w;
- positions->last_cursor.h = chr->curs->h;
+ positions->last_cursor.w = target->chr->curs->w;
+ positions->last_cursor.h = target->chr->curs->h;
- SDL_BlitSurface(chr->curs, NULL, surfaces->Pecran, &chr->pos_curs);
+ SDL_BlitSurface(target->chr->curs, NULL, surfaces->Pecran, &target->chr->pos_curs);
+
+ } else {
+ for (int i = 0; i < target->team->chr_cnt; ++i) {
+ struct character_t *chr = &target->team->chrs[i];
+
+ 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);
+ display_target_infos(surfaces, positions, target);
}
}