diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-01-11 01:55:32 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-01-11 01:55:32 +0100 |
commit | d590bfdcdfa8799439cffa41fc74346e9923b6e7 (patch) | |
tree | e171fd414935877fd3ddd1f79204dac22368e32d | |
parent | b37b127792e09cb7148200e0bccf294892e9a889 (diff) |
renamed the rects inside the struct positions
it is redundant in thus inconvenient to repeat 'position' inside a
structure named position.
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r-- | blits.c | 34 | ||||
-rw-r--r-- | jouer.c | 2 | ||||
-rw-r--r-- | map.c | 12 | ||||
-rw-r--r-- | menuchoixpersos.c | 18 | ||||
-rw-r--r-- | rpg.c | 54 | ||||
-rw-r--r-- | structures.h | 30 |
6 files changed, 75 insertions, 75 deletions
@@ -75,9 +75,9 @@ static void blit_character_affinities(SURFACES *surfaces, POSITIONS *positions, for (int i = 0; i < countof(affinities); ++i) { for (enum element_t elmt = 0; elmt < ELEMENT_COUNT; ++elmt) { if (chr->affinities[elmt] == affinities[i]) { - SDL_BlitSurface (surfaces->Pactive,NULL,surfaces->Pecran,&positions->Vpositionactivedesactive[i * ELEMENT_COUNT + elmt]); + SDL_BlitSurface(surfaces->Pactive, NULL, surfaces->screen, &positions->activedesactive[i * ELEMENT_COUNT + elmt]); } else { - SDL_BlitSurface (surfaces->Pdesactive,NULL,surfaces->Pecran,&positions->Vpositionactivedesactive[i * ELEMENT_COUNT + elmt]); + SDL_BlitSurface(surfaces->Pdesactive, NULL, surfaces->screen, &positions->activedesactive[i * ELEMENT_COUNT + elmt]); } } } @@ -92,7 +92,7 @@ void Fblitterpvcible (SURFACES *surfaces,POSITIONS *positions, const struct char sprintf (chaine,"%d/%d", chr->hp, chr->max_hp); surf = TTF_RenderText_Blended(rpg_g.font, chaine, couleur); - SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->Vpositionpvcible); + SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->pvcible); SDL_FreeSurface(surf); } @@ -106,7 +106,7 @@ void Fblitterpmcible (SURFACES *surfaces,POSITIONS *positions, const struct char sprintf (chaine,"%d/%d", chr->mp, chr->max_mp); surf = TTF_RenderText_Blended(rpg_g.font, chaine, couleur); - SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->Vpositionpmcible); + SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->pmcible); SDL_FreeSurface(surf); } @@ -118,7 +118,7 @@ static void display_target_infos(SURFACES *surfaces, POSITIONS *positions, struc SDL_Rect pos_name;; /* display the information frame */ - SDL_BlitSurface(surfaces->Pcadrecible, NULL, surfaces->Pecran, &positions->Vpositioncadrecible); + SDL_BlitSurface(surfaces->Pcadrecible, NULL, surfaces->screen, &positions->cadrecible); if (target->is_chr) { /* display the name of the character */ @@ -134,8 +134,8 @@ static void display_target_infos(SURFACES *surfaces, POSITIONS *positions, struc surf_name = TTF_RenderText_Blended(rpg_g.font, target->team->name, color); } - pos_name.x = positions->Vpositioncadrecible.x + surfaces->Pcadrecible->w / 2 - surf_name->w / 2; - pos_name.y = positions->Vpositioncadrecible.y + 10; + pos_name.x = positions->cadrecible.x + surfaces->Pcadrecible->w / 2 - surf_name->w / 2; + pos_name.y = positions->cadrecible.y + 10; SDL_BlitSurface(surf_name, NULL, surfaces->Pecran, &pos_name); @@ -149,7 +149,7 @@ void update_selected_target(SURFACES *surfaces, POSITIONS *positions, struct tar if (target == NULL) { /* clear the target informations frame */ - SDL_BlitSurface(surfaces->Pfondjeu, &positions->Vpositioncadrecible, surfaces->Pecran, &positions->Vpositioncadrecible); + SDL_BlitSurface(surfaces->background, &positions->cadrecible, surfaces->screen, &positions->cadrecible); } else { /* display the new cursor */ if (target->is_chr) { @@ -186,12 +186,12 @@ void update_list_entries(SURFACES *surfaces, POSITIONS *positions, const struct int off; if (selected == -1) { - SDL_BlitSurface(surfaces->Pfondjeu, &positions->Vpositioncadreactions, surfaces->Pecran, &positions->Vpositioncadreactions); + SDL_BlitSurface(surfaces->Pfondjeu, &positions->cadreactions, surfaces->Pecran, &positions->cadreactions); SDL_Flip(surfaces->Pecran); return; } - SDL_BlitSurface(surfaces->Pcadreactions, NULL, surfaces->Pecran, &positions->Vpositioncadreactions); + SDL_BlitSurface(surfaces->Pcadreactions, NULL, surfaces->Pecran, &positions->cadreactions); off = selected / 3 * 3; /* display at most three actions */ @@ -200,13 +200,13 @@ void update_list_entries(SURFACES *surfaces, POSITIONS *positions, const struct char buffer[256]; if (off + i >= cnt) { - SDL_BlitSurface(surfaces->Pactiondesactivee, NULL, surfaces->Pecran, &positions->Vpositionactionselectionnee[i]); + SDL_BlitSurface(surfaces->Pactiondesactivee, NULL, surfaces->Pecran, &positions->actionselectionnee[i]); continue; } /* if the current entry is the selected one */ if (selected == off + i) { - SDL_BlitSurface(surfaces->Pactionselectionnee, NULL, surfaces->Pecran, &positions->Vpositionactionselectionnee[i]); + SDL_BlitSurface(surfaces->Pactionselectionnee, NULL, surfaces->Pecran, &positions->actionselectionnee[i]); } if (entries[off + i].children_cnt) { @@ -218,7 +218,7 @@ void update_list_entries(SURFACES *surfaces, POSITIONS *positions, const struct surf = TTF_RenderText_Blended(rpg_g.font, string, color); - SDL_BlitSurface(surf, NULL, surfaces->Pecran, &positions->Vpositionnomactions[i]); + SDL_BlitSurface(surf, NULL, surfaces->Pecran, &positions->nomactions[i]); SDL_FreeSurface(surf); } @@ -238,10 +238,10 @@ void display_incr(SURFACES *surfaces, POSITIONS *positions, struct character_t * blit_character(surfaces, target); SDL_BlitSurface(surf, NULL, surfaces->Pecran, &target->pos_curs); - positions->Vpositiondegats.x = target->pos_curs.x; - positions->Vpositiondegats.y = target->pos_curs.y; - positions->Vpositiondegats.w = surf->w; - positions->Vpositiondegats.h = surf->h; + positions->degats.x = target->pos_curs.x; + positions->degats.y = target->pos_curs.y; + positions->degats.w = surf->w; + positions->degats.h = surf->h; SDL_FreeSurface(surf); } @@ -419,7 +419,7 @@ int Fjouer (SURFACES *surfaces, POSITIONS *positions, struct team_t *t1, struct SDL_Delay(1000); - SDL_BlitSurface(surfaces->Pfondjeu, &positions->Vpositiondegats, surfaces->Pecran, &positions->Vpositiondegats); + SDL_BlitSurface(surfaces->background, &positions->degats, surfaces->screen, &positions->degats); SDL_Flip(surfaces->Pecran); @@ -86,8 +86,8 @@ void Fchargersurfaces_map (SURFACES *surfaces,POSITIONS*positions) { for(i=0;i<15;i++) { - positions->Vpositionmap_item[i][j].x=i*64+32; - positions->Vpositionmap_item[i][j].y=j*64+32; + positions->map_item[i][j].x = i * 64 + 32; + positions->map_item[i][j].y = j * 64 + 32; } } surfaces->Pmap_sol=NULL; @@ -120,16 +120,16 @@ void Fblittermap (SURFACES*surfaces,POSITIONS*positions,int map[][11]) switch (map[i][j]) { case SOL: - SDL_BlitSurface(surfaces->Pmap_sol,NULL,surfaces->Pecran,&positions->Vpositionmap_item[i][j]); + SDL_BlitSurface(surfaces->Pmap_sol, NULL, surfaces->screen, &positions->map_item[i][j]); break; case MUR: - SDL_BlitSurface(surfaces->Pmap_mur,NULL,surfaces->Pecran,&positions->Vpositionmap_item[i][j]); + SDL_BlitSurface(surfaces->Pmap_mur, NULL, surfaces->screen, &positions->map_item[i][j]); break; case COFFRE: - SDL_BlitSurface(surfaces->Pmap_coffre,NULL,surfaces->Pecran,&positions->Vpositionmap_item[i][j]); + SDL_BlitSurface(surfaces->Pmap_coffre, NULL, surfaces->screen, &positions->map_item[i][j]); break; case GUS: - SDL_BlitSurface(surfaces->Pmap_perso,NULL,surfaces->Pecran,&positions->Vpositionmap_item[i][j]); + SDL_BlitSurface(surfaces->Pmap_perso, NULL, surfaces->screen, &positions->map_item[i][j]); break; } } diff --git a/menuchoixpersos.c b/menuchoixpersos.c index 3d55efd..9c02389 100644 --- a/menuchoixpersos.c +++ b/menuchoixpersos.c @@ -174,11 +174,11 @@ static void Fchangersurlignage2(int Vchoix, SURFACES *surfaces, /* this surface fills the whole screen */ SDL_BlitSurface(surf, NULL, surfaces->screen, NULL); - SDL_BlitSurface (surfaces->Ppretre,NULL,surfaces->Pecran,&positions->Vpositionmenupretre); - SDL_BlitSurface (surfaces->Ppaladin,NULL,surfaces->Pecran,&positions->Vpositionmenupaladin); - SDL_BlitSurface (surfaces->Pvoleur,NULL,surfaces->Pecran,&positions->Vpositionmenuvoleur); + SDL_BlitSurface(surfaces->Ppretre, NULL, surfaces->screen, &positions->menupretre); + SDL_BlitSurface(surfaces->Ppaladin, NULL, surfaces->screen, &positions->menupaladin); + SDL_BlitSurface(surfaces->Pvoleur, NULL, surfaces->screen, &positions->menuvoleur); - SDL_BlitSurface(text, NULL, surfaces->screen, &positions->Vpositiontextemenu); + SDL_BlitSurface(text, NULL, surfaces->screen, &positions->textemenu); SDL_Flip (surfaces->Pecran); } @@ -224,13 +224,13 @@ void Fmenuchoixpersos (SURFACES *surfaces, POSITIONS *positions) /* display the string associated with the current character number (aka Please choose ...) */ surf = TTF_RenderText_Blended(rpg_g.font, strings[Vnbperso], vert); - positions->Vpositiontextemenu.x = surfaces->screen->w / 2 - surf->w / 2; - SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->Vpositiontextemenu); + positions->textemenu.x = surfaces->screen->w / 2 - surf->w / 2; + SDL_BlitSurface(surf, NULL, surfaces->screen, &positions->textemenu); - SDL_BlitSurface (surfaces->Ppretre,NULL,surfaces->Pecran,&positions->Vpositionmenupretre); - SDL_BlitSurface (surfaces->Ppaladin,NULL,surfaces->Pecran,&positions->Vpositionmenupaladin); - SDL_BlitSurface (surfaces->Pvoleur,NULL,surfaces->Pecran,&positions->Vpositionmenuvoleur); + SDL_BlitSurface(surfaces->Ppretre, NULL, surfaces->screen, &positions->menupretre); + SDL_BlitSurface(surfaces->Ppaladin, NULL, surfaces->screen, &positions->menupaladin); + SDL_BlitSurface(surfaces->Pvoleur, NULL, surfaces->screen, &positions->menuvoleur); SDL_Flip (surfaces->Pecran); continuer = true; @@ -180,37 +180,37 @@ static void Finitialiserpositions (POSITIONS *positions, const SURFACES *surface { int y = 0, z = 0; - positions->Vpositionmenupretre.x = surfaces->screen->w / 2 - surfaces->Ppretre->w / 2; - positions->Vpositionmenupretre.y = surfaces->screen->h - 20 - surfaces->Ppretre->h; - positions->Vpositionmenupaladin.x = positions->Vpositionmenupretre.x/2 - surfaces->Ppaladin->w/2; - positions->Vpositionmenupaladin.y = surfaces->screen->h - 20 - surfaces->Ppaladin->h; - positions->Vpositionmenuvoleur.x = surfaces->screen->w / 4 * 3 - surfaces->Pvoleur->w / 2; - positions->Vpositionmenuvoleur.y = surfaces->screen->h - 20 - surfaces->Pvoleur->h; - positions->Vpositiontextemenu.y = 362; - - positions->Vpositioncadrecible.y = 15; - positions->Vpositioncadrecible.x = surfaces->screen->w / 2 - surfaces->Pcadrecible->w / 2; - positions->Vpositioncadrecible.w = surfaces->Pcadrecible->w; - positions->Vpositioncadrecible.h = surfaces->Pcadrecible->h; - - positions->Vpositioncadreactions.y = surfaces->screen->h - surfaces->Pcadreactions->h; - positions->Vpositioncadreactions.x = surfaces->screen->w / 2 - surfaces->Pcadreactions->w / 2; - positions->Vpositioncadreactions.w = surfaces->Pcadreactions->w; - positions->Vpositioncadreactions.h = surfaces->Pcadreactions->h; - positions->Vpositionpvcible.x = positions->Vpositioncadrecible.x + 104; - positions->Vpositionpvcible.y = positions->Vpositioncadrecible.y + 170; - positions->Vpositionpmcible.x = positions->Vpositioncadrecible.x + 269; - positions->Vpositionpmcible.y = positions->Vpositioncadrecible.y + 170; + positions->menupretre.x = surfaces->screen->w / 2 - surfaces->Ppretre->w / 2; + positions->menupretre.y = surfaces->screen->h - 20 - surfaces->Ppretre->h; + positions->menupaladin.x = positions->menupretre.x/2 - surfaces->Ppaladin->w/2; + positions->menupaladin.y = surfaces->screen->h - 20 - surfaces->Ppaladin->h; + positions->menuvoleur.x = surfaces->screen->w / 4 * 3 - surfaces->Pvoleur->w / 2; + positions->menuvoleur.y = surfaces->screen->h - 20 - surfaces->Pvoleur->h; + positions->textemenu.y = 362; + + positions->cadrecible.y = 15; + positions->cadrecible.x = surfaces->screen->w / 2 - surfaces->Pcadrecible->w / 2; + positions->cadrecible.w = surfaces->Pcadrecible->w; + positions->cadrecible.h = surfaces->Pcadrecible->h; + + positions->cadreactions.y = surfaces->screen->h - surfaces->Pcadreactions->h; + positions->cadreactions.x = surfaces->screen->w / 2 - surfaces->Pcadreactions->w / 2; + positions->cadreactions.w = surfaces->Pcadreactions->w; + positions->cadreactions.h = surfaces->Pcadreactions->h; + positions->pvcible.x = positions->cadrecible.x + 104; + positions->pvcible.y = positions->cadrecible.y + 170; + positions->pmcible.x = positions->cadrecible.x + 269; + positions->pmcible.y = positions->cadrecible.y + 170; for(int i = 0; i < 3; i++) { - positions->Vpositionactionselectionnee[i].x = positions->Vpositioncadreactions.x + 5; - positions->Vpositionactionselectionnee[i].y = positions->Vpositioncadreactions.y + 5 + 44 * i; - positions->Vpositionnomactions[i].x = positions->Vpositioncadreactions.x + 15; - positions->Vpositionnomactions[i].y = positions->Vpositioncadreactions.y + 12 + 44 * i; + positions->actionselectionnee[i].x = positions->cadreactions.x + 5; + positions->actionselectionnee[i].y = positions->cadreactions.y + 5 + 44 * i; + positions->nomactions[i].x = positions->cadreactions.x + 15; + positions->nomactions[i].y = positions->cadreactions.y + 12 + 44 * i; } for (int i = 0; i < 16; i++) { - positions->Vpositionactivedesactive[i].x = positions->Vpositioncadrecible.x + 202 + 51 * y; - positions->Vpositionactivedesactive[i].y = positions->Vpositioncadrecible.y + 86 + 19 * z; + positions->activedesactive[i].x = positions->cadrecible.x + 202 + 51 * y; + positions->activedesactive[i].y = positions->cadrecible.y + 86 + 19 * z; if (y < 3) { y++; } else { diff --git a/structures.h b/structures.h index b26fffa..a577b3c 100644 --- a/structures.h +++ b/structures.h @@ -52,21 +52,21 @@ struct surfaces { typedef struct positions POSITIONS; struct positions { - SDL_Rect Vpositionmenupaladin; - SDL_Rect Vpositionmenuvoleur; - SDL_Rect Vpositionmenupretre; - SDL_Rect Vpositiontextemenu; - SDL_Rect Vpositioncadrecible; - SDL_Rect Vpositionnomcible; - SDL_Rect Vpositionactivedesactive[16]; - SDL_Rect Vpositionpvcible; - SDL_Rect Vpositionpmcible; - SDL_Rect Vpositioncadreactions; - SDL_Rect Vpositionactionselectionnee[3]; - SDL_Rect Vpositionnomactions[3]; - SDL_Rect Vpositionmort; - SDL_Rect Vpositiondegats; - SDL_Rect Vpositionmap_item[15][11]; + SDL_Rect menupaladin; + SDL_Rect menuvoleur; + SDL_Rect menupretre; + SDL_Rect textemenu; + SDL_Rect cadrecible; + SDL_Rect nomcible; + SDL_Rect activedesactive[16]; + SDL_Rect pvcible; + SDL_Rect pmcible; + SDL_Rect cadreactions; + SDL_Rect actionselectionnee[3]; + SDL_Rect nomactions[3]; + SDL_Rect mort; + SDL_Rect degats; + SDL_Rect map_item[15][11]; SDL_Rect last_cursor; }; |