Bonjour à tous et à toutes,

Sur l'un de mes projets en C/SDL, à la compilation il y a 2 erreurs (2 fois la même) et je vois pas du tout comment l'a corrigée.
Voici le code:

main.c
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "autres.h"
#include "headers.h"
 
 
 
 
 
/* NOTE (sylvain#2#): Il y a un jour en bas de la map */
 
/* À FAIRE (sylvain#1#): vérifier que toute la mémoire allouer a été libérer */
 
 
 
 
int main(int argc,char* argv[])
{
	SDL_Surface* screen;
	Map* carte;
	Perso* erwan;
	Input in;
 
	memset(&in,0,sizeof(in));
 
	SDL_Init(SDL_INIT_VIDEO);
 
	carte = ChargerMap("tileset bourg en vol2.bmp","1 schema bourg en vol.bmp", "2 schema bourg en vol.bmp", "3 schema bourg en vol.bmp","corr bourg en vol.bmp","tileprop1.txt", TAILLE_TILE, LARGEUR_FENETRE, HAUTEUR_FENETRE);
 
	erwan = ChargerPerso("haut.bmp", "bas.bmp", "gauche.bmp", "droite.bmp", TAILLE_TILE, HAUTEUR_PERSO);
 
	SDL_WM_SetCaption("carte entiere avec 3 couches et collision perso", NULL);
 
	screen = SDL_SetVideoMode(carte->largeur_fenetre, carte->hauteur_fenetre, 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
 
	while(!in.key[SDLK_ESCAPE] && !in.quit)
	{
		UpdateEvents(&in);
		Deplace(&in, carte, erwan);
		AfficherMap(screen, carte, erwan, &in);
		SDL_Flip(screen);
	}
	Liberermapperso(carte, erwan);
	SDL_Quit();
	return EXIT_SUCCESS;
}
moteur.c
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
#include <string.h> //pour strmcp
#include "autres.h"
#include "headers.h"
 
 
 
 
Map* ChargerMap(const char* tileset, const char* image_schema1, const char* image_schema2, const char* image_schema3, const char* image_corr, const char* tileprop, int TAILLE_TILE, int largeur_fenetre, int hauteur_fenetre)
{
    int i,j;
    Map* res;
    SDL_Surface *IMGschema1, *IMGschema2, *IMGschema3, *corr;
    Uint32 pix;
 
    res = malloc(sizeof(Map));
    res->taille_tile = TAILLE_TILE;
    res->tileset = LoadImage32(tileset,1);  // charge le tileset en VRAM pour meilleur vitesse de Blit.
 
    IMGschema1 = LoadImage32(image_schema1,0);
    IMGschema2 = LoadImage32(image_schema2,0);
    IMGschema3 = LoadImage32(image_schema3,0);
    corr = LoadImage32(image_corr,0);
 
    if(IMGschema1 == NULL || IMGschema2 == NULL || IMGschema3 == NULL || corr == NULL)
    {
        fprintf(stderr, "error :%s", SDL_GetError);
        exit(EXIT_FAILURE);
    }
 
    res->nbtiles = (res->tileset->w / taille_tile) * (res->tileset->h / taille_tile);
    res->props = ChargerProps(tileprop,res->nbtiles);
    res->nbtiles_largeur_monde = IMGschema1->w;
    res->nbtiles_hauteur_monde = IMGschema1->h;
    CalculerSDLRects(res->props, res->nbtiles, res->tileset->w / nbtiles_largeur_monde, TAILLE_TILE);
    res->Schema = malloc( 3*sizeof(char*)); // tableau de pointeurs sur pointeurs
    if(res->Schema == NULL)
    {
        fprintf(stderr, "error initialisation tableau de chiffres");
        exit(EXIT_FAILURE);
    }
 
 
    res->Schema[0] = malloc(IMGschema1->w * sizeof(char**)); //2ème dimension comme les **
    for(i=0; i<IMGschema1->w; i++)
    {
        res->Schema[0][i] = malloc(IMGschema1->h * sizeof(char***)); //3ème dimension comme les ***
        for(j=0; j<IMGschema1->h; j++)
        {
            pix = GetPixel32(IMGschema1,i,j);
            res->Schema[0][i][j] = LocatePixInCorr(corr,pix);
        }
    }
 
 
 
    res->Schema[1] = malloc(IMGschema2->w * sizeof(char**));
    for(i=0; i<IMGschema2->w; i++)
    {
        res->Schema[1][i] = malloc(IMGschema2->h * sizeof(char***));
        for(j=0; j<IMGschema2->h; j++)
        {
            pix = GetPixel32(IMGschema2,i,j);
            res->Schema[1][i][j] = LocatePixInCorr(corr,pix);
        }
    }
 
 
 
 
    res->Schema[2] = malloc(IMGschema3->w * sizeof(char**));
    for(i=0; i<IMGschema3->w; i++)
    {
        res->Schema[2][i] = malloc(IMGschema3->h * sizeof(char***));
        for(j=0; j<IMGschema3->h; j++)
        {
            pix = GetPixel32(IMGschema3,i,j);
            res->Schema[2][i][j] = LocatePixInCorr(corr,pix);
        }
    }
 
 
 
    SDL_FreeSurface(IMGschema1);
    SDL_FreeSurface(IMGschema2);
    SDL_FreeSurface(IMGschema3);
    SDL_FreeSurface(corr);
    res->largeur_fenetre = largeur_fenetre;
    res->hauteur_fenetre = hauteur_fenetre;
 
    return res;
}
 
 
 
TileProp* ChargerProps(const char* tileprop,int nombre_props)
{
    char buf[500];
    FILE* F;
    int i;
    int useless;
    TileProp* res = calloc(nombre_props,sizeof(TileProp)); // alloue et met tout a 0.
    F = fopen(tileprop,"r");
    if (F==NULL)
    {
        printf("fichier %s introuvable !!\n",tileprop);
        exit(EXIT_FAILURE);
    }
    for(i=0; i<nombre_props; i++)
    {
        fscanf(F,"%d %s",&useless,buf);
        if (strcmp(buf,"mur")==0)
            res[i].mur = 1;
        if (strcmp(buf,"vide")==0)
            res[i].vide = 1;
        if (strcmp(buf,"blanc")==0)
            res[i].blanc = 1;
    }
    fclose(F);
    return res;
}
 
 
 
void CalculerSDLRects(TileProp* tabprops,int nombre_props,int nombre_tiles_largeur,int TAILLE_TILE)
{
    int i;
    for(i=0; i<nombre_props; i++)
    {
        tabprops[i].R.w = TAILLE_TILE;
        tabprops[i].R.h = TAILLE_TILE;
        tabprops[i].R.x = TAILLE_TILE*(i%nombre_tiles_largeur);
        tabprops[i].R.y = TAILLE_TILE*(i/nombre_tiles_largeur);
    }
}
 
 
 
Perso* ChargerPerso(const char* haut, const char* bas, const char* gauche, const char* droite, int largeurT, int hauteurP)
{
    Perso* res;
    SDL_Surface *IMGhaut, *IMGbas, *IMGgauche, *IMGdroite;
 
 
    IMGhaut = LoadImage32(haut, 1);
    IMGbas = LoadImage32(bas, 1);
    IMGgauche = LoadImage32(gauche, 1);
    IMGdroite = LoadImage32(droite, 1);
 
    if (IMGhaut==NULL || IMGbas==NULL || IMGgauche==NULL || IMGdroite==NULL)
    {
        fprintf(stderr, "error chargement perso: %s", SDL_GetError());
        SDL_Quit();
        exit(EXIT_FAILURE);
    }
 
    res->Rect_perso.x =6*largeurT;
    res->Rect_perso.y=5*largeurT + (32-21);
    res->Rect_perso.w=IMGhaut->w;
    res->Rect_perso.h=IMGhaut->h;
 
    res->haut=IMGhaut;
    res->bas=IMGbas;
    res->gauche=IMGgauche;
    res->droite=IMGdroite;
 
    SDL_FreeSurface(IMGhaut);
    SDL_FreeSurface(IMGbas);
    SDL_FreeSurface(IMGgauche);
    SDL_FreeSurface(IMGdroite);
 
    return res;
}
 
 
 
void Deplace(Input* in, Map* carte, Perso* erwan)
{
    if (in->key[SDLK_UP]== 1)
    {
        if(collisionDecor(erwan, carte, HAUT)==0)//si il n'y a pas de collision
        {
            erwan->Rect_perso.y =- carte->taille_tile;
        }
 
    }
 
    if (in->key[SDLK_DOWN]== 1)
    {
        if(collisionDecor(erwan, carte, BAS)==0)//si il n'y a pas de collision
        {
            erwan->Rect_perso.y =+ carte->taille_tile;
        }
 
    }
 
    if (in->key[SDLK_LEFT]== 1)
    {
        if(collisionDecor(erwan, carte, GAUCHE)==0)//si il n'y a pas de collision
        {
            erwan->Rect_perso.x =- carte->taille_tile;
        }
 
    }
 
    if (in->key[SDLK_RIGHT]== 1)
    {
        if(collisionDecor(erwan, carte, DROITE)==0)//si il n'y a pas de collision
        {
            erwan->Rect_perso.x =+ carte->taille_tile;
        }
 
    }
}
 
 
 
int collisionDecor(Perso* erwan, Map* m, int sens)
{
 
    int xmin,xmax,ymin,ymax,i,j,indicetile;
 
    xmin = erwan->Rect_perso.x / m->taille_tile;//nombres de tiles avant d'arriver à celui où est le perso
	ymin = erwan->Rect_perso.y / m->taille_tile;
	xmax = (erwan->Rect_perso.x + erwan->Rect_perso.w -1) / m->taille_tile;
	ymax = (erwan->Rect_perso.y + erwan->Rect_perso.h -1) / m->taille_tile;
 
	if (xmin<0 || ymin<0 || xmax>=m->nbtiles_largeur_monde || ymax>=m->nbtiles_hauteur_monde)
		return 1;
	for(i=xmin;i<=xmax;i++)
	{
		for(j=ymin;j<=ymax;j++)
		{
			indicetile = m->Schema[1][i][j];
			if (m->props[indicetile].mur)
				return 1;
		}
		return 0;
	}
}
 
 
 
/* FAIT (sylvain#9#): ajouter l'affichage du perso dans afficherMap */
int AfficherMap(SDL_Surface* screen, Map* m, Perso* erwan, Input* in)
{
/* NOTE (sylvain#9#): si necessaire ajouter une fonction de clamp dans afficherMap */
 
    int h,i,j;
	SDL_Rect Rect_dest;
	int numero_tile;
 
    SDL_FillRect(screen , NULL , 0);
 
 
	for(h=0; h<3; h++)
	{
	    if(h==1)
	    {
	        AfficherPerso(screen, m, erwan, &in);
	    }
	    for(i=0; i<m->nbtiles_largeur_monde; i++)
	    {
            for(j=0; j<m->nbtiles_hauteur_monde; j++)
            {
                Rect_dest.x = i * m->taille_tile;
                Rect_dest.y = j * m->taille_tile;
                numero_tile = m->Schema[h][i][j];
 
                SDL_BlitSurface(m->tileset, &(m->props[numero_tile].R),screen, &Rect_dest);
            }
	    }
    }
 
	return EXIT_SUCCESS;
}
 
 
 
void AfficherPerso(SDL_Surface* screen, Map* carte, Perso* erwan, Input* in)
{
    SDL_Surface* dep = NULL;
    SDL_Rect rect;
 
    if(in->key[SDLK_UP])
    {
        dep = erwan->haut;
    }
    if(in->key[SDLK_DOWN])
    {
        dep = erwan->bas;
    }
    if(in->key[SDLK_LEFT])
    {
        dep = erwan->gauche;
    }
    if(in->key[SDLK_RIGHT])
    {
        dep = erwan->droite;
    }
 
    rect = erwan->Rect_perso;
 
    SDL_BlitSurface(dep, NULL, screen, &rect);
 
    SDL_FreeSurface(dep);
 
}
 
 
 
int Liberermapperso(Map* m, Perso* e)
{
headers.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <sdl/sdl.h>
#include "autres.h"
 
 
typedef struct//tableau avec propriétés Tileprop
{
	SDL_Rect R;
	char mur, vide, blanc;
 
} TileProp;
 
 
 
typedef struct//structure map
{
	int taille_tile;
	int nbtiles;
	TileProp* props;
	SDL_Surface* tileset;
	unsigned char ***Schema;
	int nbtiles_largeur_monde, nbtiles_hauteur_monde;
	int largeur_fenetre,hauteur_fenetre;
} Map;
 
 
 
typedef struct //structure perso
{
    SDL_Surface *haut, *bas, *gauche, *droite;
    SDL_Rect Rect_perso;
} Perso;
 
 
 
typedef enum //énumeration des sens de déplacement
{
    HAUT, BAS, GAUCHE, DROITE
 
}SENS;
 
 
 
Map* ChargerMap(const char* tileset, const char* image_schema1, const char* image_schema2, const char* image_schema3, const char* image_corr, const char* tileprop, int TAILLE_TILE, int largeur_fenetre, int hauteur_fenetre);
 
 
 
TileProp* ChargerProps(const char* tileprop, int nombre_props);
 
 
 
void CalculerSDLRects(TileProp* tabprops, int nombre_props, int nombre_tiles_largeur, int TAILLE_TILE);
 
 
 
Perso* ChargerPerso(const char* haut, const char* bas, const char* gauche, const char* droite, int largeurT, int hauteurP);
 
 
 
void Deplace(Input* in, Map* carte, Perso* erwan);
 
 
 
int collisionDecor(Perso* erwan, Map* m, int sens);
 
 
 
int AfficherMap(SDL_Surface* screen, Map* m, Perso* erwan, Input* in);
 
 
 
void AfficherPerso(SDL_Surface* screen, Map* carte, Perso* erwan, Input* in);
 
 
 
int Liberermapperso(Map* m, Perso* e);
autres.c
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
#include "autres.h"
 
 
 
 
 
 
void UpdateEvents(Input* in)
{
	SDL_Event event;
	while(SDL_PollEvent(&event))
	{
		switch (event.type)
		{
			case SDL_KEYDOWN:
				in->key[event.key.keysym.sym]=1;
				break;
 
			case SDL_KEYUP:
				in->key[event.key.keysym.sym]=0;
				break;
 
			case SDL_QUIT:
				in->quit = 1;
				break;
 
			default:
				break;
		}
	}
}
 
 
 
SDL_Surface* LoadImage32(const char* fichier_image,int vram) //convertit les images en 32 bits afin de faciliter leurs lectures aux pixels par pixels (vram -> blit ; ram -> pixel par pixel) et active la transparence de fond
{
	SDL_Surface* image_result;
	SDL_Surface* image_ram = SDL_LoadBMP(fichier_image);	// charge l'image dans image_ram en RAM
	if (image_ram==NULL)
	{
		printf("Image %s introuvable !! \n",fichier_image);
		SDL_Quit();
		exit(EXIT_FAILURE);
	}
	image_result = NULL;
	if (vram)
		image_result=SDL_CreateRGBSurface(SDL_HWSURFACE, image_ram->w, image_ram->h, 32, 0, 0, 0, 0);  // cree une imageen VRAM
	if (image_result==NULL)
		vram = 0;
	if (!vram)
		image_result=SDL_CreateRGBSurface(SDL_SWSURFACE, image_ram->w, image_ram->h, 32, 0, 0, 0, 0);  // cree une image en RAM
	SDL_BlitSurface(image_ram,NULL,image_result,NULL);	// copie l'image image_ram de moins de 32 bits vers image_result qui fait 32 bits
	SDL_FreeSurface(image_ram);      // supprime la surface image_ram : inutile maintenant --> libere la mémoire
    SDL_SetColorKey(image_result, SDL_SRCCOLORKEY, SDL_MapRGB(image_result->format, 255, 255, 255));
	return image_result;
}
 
 
 
Uint32 GetPixel32(SDL_Surface* image,int i,int j) //lecture directe des pixels et convertion de la couleur lue en Uint32
{
	if (i<0 || i>image->w-1 || j<0 || j>image->h-1)
		return 0;
	return ((Uint32*)(image->pixels))[j*(image->pitch/4)+i];   // lecture directe des pixels et convertion de la couleur lue en Uint32
}
 
 
 
char LocatePixInCorr(SDL_Surface* corr,Uint32 pix)//retourne numéro du bon tile
{
    int i,j;
    for(j=0; j<corr->h; j++)
        for(i=0; i<corr->w; i++)
            if (GetPixel32(corr,i,j)==pix)
                return (char)(j*corr->w + i);
    return 0;
}
autres.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef _UTILS_H
#define _UTILS_H
 
#include <SDL.h>
 
#define TAILLE_TILE 16
#define LARGEUR_FENETRE 480
#define HAUTEUR_FENETRE 416
 
#define HAUTEUR_PERSO 21
 
 
 
 
typedef struct //structure d'évenements
{
	char key[SDLK_LAST];
	char quit;
} Input;
 
 
 
void UpdateEvents(Input* in);
 
 
 
SDL_Surface* LoadImage32(const char* fichier_image,int vram);
 
 
 
Uint32 GetPixel32(SDL_Surface* image, int i, int j);
 
 
 
char LocatePixInCorr(SDL_Surface* corr,Uint32 pix);
 
 
 
 
 
#endif
headers.h|63|error: expected ';', ',' or ')' before numeric constant|
headers.h|71|error: expected ';', ',' or ')' before numeric constant|

main.c||In function 'SDL_main'
main.c|44|warning: implicit declaration of function 'ChargerMap'|
main.c|44|warning: assignment makes pointer from integer without a cast|
main.c|33|warning: unused parameter 'argc'|
main.c|33|warning: unused parameter 'argv'|
||=== Build finished: 2 errors, 4 warnings ===|

si vous pouviez me mettre sur des pistes ça serais sympa

merci d'avance