summaryrefslogtreecommitdiff
path: root/rpg.c
diff options
context:
space:
mode:
Diffstat (limited to 'rpg.c')
-rw-r--r--rpg.c122
1 files changed, 51 insertions, 71 deletions
diff --git a/rpg.c b/rpg.c
index f76d742..7d2df46 100644
--- a/rpg.c
+++ b/rpg.c
@@ -178,9 +178,8 @@ static int rpg_initialize_sprites(void)
static void Finitialiserpositions (POSITIONS *positions, const SURFACES *surfaces)
{
- int i,y=0,z=0;
- positions->Vpositionmenu.x = 0;
- positions->Vpositionmenu.y = 0;
+ 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;
@@ -188,48 +187,39 @@ static void Finitialiserpositions (POSITIONS *positions, const SURFACES *surface
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->Vpositioncurseurennemis.x=1024;
- positions->Vpositioncurseurennemis.y=768;
- positions->Vpositioncurseurallies.x=1024;
- positions->Vpositioncurseurallies.y=768;
- positions->Vpositioncurseurennemis.w = surfaces->Pcurseurennemis->w;
- positions->Vpositioncurseurennemis.h = surfaces->Pcurseurennemis->h;
+
positions->Vpositioncadrecible.y = 15;
- positions->Vpositioncadrecible.x = surfaces->screen->w / 2 - 50 - surfaces->Pcadrecible->w / 2;
+ 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 - 50 - surfaces->Pcadreactions->w / 2;
+ 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 = 380;
- positions->Vpositionpvcible.y = 185;
- positions->Vpositionpmcible.x = 545;
- positions->Vpositionpmcible.y = 185;
- positions->Vpositiondegats.x=1024;
- positions->Vpositiondegats.y=768;
- for(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->Vpositionquantite[i].y=positions->Vpositionnomactions[i].y;
- positions->Vpositionquantite[i].x=positions->Vpositioncadreactions.x+surfaces->Pcadreactions->w-45;
+ 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;
+
+ 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;
}
- for (i=0;i < 16;i++)
- {
- positions->Vpositionactivedesactive[i].x = 471+51*y;
- positions->Vpositionactivedesactive[i].y = 101+19*z;
- if (y < 3)
+ 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;
+ if (y < 3) {
y++;
- else
- {
- y=0;
+ } else {
+ y = 0;
z++;
}
}
+ /* TODO this is pretty uggly .. and we can have multiple cursors as well */
positions->last_cursor = (SDL_Rect){0, 0, 0, 0};
}
@@ -286,51 +276,41 @@ static int rpg_init(int width, int height)
static void Fdechargerimages(SURFACES *surfaces)
{
- int i;
-
- SDL_FreeSurface (surfaces->Pgobelin);
+ SDL_FreeSurface(surfaces->Pgobelin);
SDL_FreeSurface(surfaces->red_warrior_gobelin);
- SDL_FreeSurface (surfaces->Ppaladin);
- SDL_FreeSurface (surfaces->Ppretre);
- SDL_FreeSurface (surfaces->Pvoleur);
+ SDL_FreeSurface(surfaces->Ppaladin);
+ SDL_FreeSurface(surfaces->Ppretre);
+ SDL_FreeSurface(surfaces->Pvoleur);
SDL_FreeSurface(surfaces->red_paladin);
SDL_FreeSurface(surfaces->red_priest);
SDL_FreeSurface(surfaces->red_thief);
- SDL_FreeSurface (surfaces->Pmenujouer);
- SDL_FreeSurface (surfaces->Pmenuoptions);
- SDL_FreeSurface (surfaces->Pmenuquitter);
- SDL_FreeSurface (surfaces->Pchoixpretre);
- SDL_FreeSurface (surfaces->Pchoixpaladin);
- SDL_FreeSurface (surfaces->Pchoixvoleur);
- SDL_FreeSurface (surfaces->Pcurseurennemis);
- SDL_FreeSurface (surfaces->Pcurseurallies);
- SDL_FreeSurface (surfaces->Pcadrecible);
- SDL_FreeSurface (surfaces->Pactive);
- SDL_FreeSurface (surfaces->Pdesactive);
- SDL_FreeSurface (surfaces->Pcadreactions);
- SDL_FreeSurface (surfaces->Pactionselectionnee);
- SDL_FreeSurface (surfaces->Pactiondesactivee);
- SDL_FreeSurface (surfaces->Pmort);
- SDL_FreeSurface (surfaces->Pfondjeu);
- SDL_FreeSurface(surfaces->Ptextechoixmenu);
- SDL_FreeSurface(surfaces->Pnbdegats);
- SDL_FreeSurface(surfaces->Pnomcible);
- SDL_FreeSurface(surfaces->Ppvcible);
- SDL_FreeSurface(surfaces->Ppmcible);
- SDL_FreeSurface(surfaces->Ppvpersos);
- SDL_FreeSurface(surfaces->Ppmpersos);
-
- for(i=0;i<3;i++)
- {
- SDL_FreeSurface (surfaces->Pnomactions[i]);
- }
- for(i=0;i<3;i++)
- {
- SDL_FreeSurface (surfaces->Pquantite[i]);
- }
+ SDL_FreeSurface(surfaces->Pmenujouer);
+ SDL_FreeSurface(surfaces->Pmenuoptions);
+ SDL_FreeSurface(surfaces->Pmenuquitter);
+
+ SDL_FreeSurface(surfaces->Pchoixpretre);
+ SDL_FreeSurface(surfaces->Pchoixpaladin);
+ SDL_FreeSurface(surfaces->Pchoixvoleur);
+
+ SDL_FreeSurface(surfaces->Pcurseurennemis);
+ SDL_FreeSurface(surfaces->Pcurseurallies);
+
+ SDL_FreeSurface(surfaces->Pcadrecible);
+
+ SDL_FreeSurface(surfaces->Pactive);
+ SDL_FreeSurface(surfaces->Pdesactive);
+
+ SDL_FreeSurface(surfaces->Pcadreactions);
+
+ SDL_FreeSurface(surfaces->Pactionselectionnee);
+ SDL_FreeSurface(surfaces->Pactiondesactivee);
+
+ SDL_FreeSurface(surfaces->Pmort);
+
+ SDL_FreeSurface(surfaces->Pfondjeu);
}
static void rpg_shutdown(void)