summaryrefslogtreecommitdiff
path: root/blits.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-11 01:42:56 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-11 01:44:54 +0100
commitb37b127792e09cb7148200e0bccf294892e9a889 (patch)
treef2dcf5e465428fd8aa65d5b738987fc712ed8946 /blits.c
parent46c4037c905598cc0e41ac5464492384331aa57c (diff)
remove or replace a lot of code for the initialization
many structures or positions were not revelant anymore and thus have been removed. some positions were not relative to each other it is sometimes not meaningful to put surfaces in the global scope when they only need to be used once. Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'blits.c')
-rw-r--r--blits.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/blits.c b/blits.c
index 2e79342..59956c4 100644
--- a/blits.c
+++ b/blits.c
@@ -88,16 +88,13 @@ void Fblitterpvcible (SURFACES *surfaces,POSITIONS *positions, const struct char
{
SDL_Color couleur = {132,215,107,0};
char chaine[50];
-
- if (surfaces->Ppvcible != NULL)
- {
- SDL_FreeSurface (surfaces->Ppvcible);
- surfaces->Ppvcible=NULL;
- }
+ SDL_Surface *surf;
sprintf (chaine,"%d/%d", chr->hp, chr->max_hp);
- surfaces->Ppvcible=TTF_RenderText_Blended(rpg_g.font, chaine, couleur);
- SDL_BlitSurface (surfaces->Ppvcible,NULL,surfaces->Pecran,&positions->Vpositionpvcible);
+ surf = TTF_RenderText_Blended(rpg_g.font, chaine, couleur);
+ SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->Vpositionpvcible);
+
+ SDL_FreeSurface(surf);
}
static
@@ -105,15 +102,13 @@ void Fblitterpmcible (SURFACES *surfaces,POSITIONS *positions, const struct char
{
SDL_Color couleur = {132,215,107,0};
char chaine[50];
+ SDL_Surface *surf;
- if (surfaces->Ppmcible != NULL)
- {
- SDL_FreeSurface (surfaces->Ppmcible);
- surfaces->Ppmcible=NULL;
- }
sprintf (chaine,"%d/%d", chr->mp, chr->max_mp);
- surfaces->Ppmcible=TTF_RenderText_Blended(rpg_g.font, chaine, couleur);
- SDL_BlitSurface (surfaces->Ppmcible,NULL,surfaces->Pecran,&positions->Vpositionpmcible);
+ surf = TTF_RenderText_Blended(rpg_g.font, chaine, couleur);
+ SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->Vpositionpmcible);
+
+ SDL_FreeSurface(surf);
}
static void display_target_infos(SURFACES *surfaces, POSITIONS *positions, struct target_t *target)