// ÉÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º            º												         º \\
// º  DRAW_MUR  º  Position X, Position Y, Carte                         º \\
// º            º													     º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º                                                                     º \\
// º þ x et y donnent la position du mur dans la matrice.                º \\
// º þ Affichage d'un mur selon le niveau.                               º \\
// º                                                                     º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\


void	draw_mur (int x, int y, struct_map *map)
 {
	// posx et posy donnent les coordonn‚es haut-gauche du mur
	int posx = map->coinx + x * T_CASE; // conversion (x) case -> pixel
	int	posy = map->coiny + y * T_CASE; // conversion (y) case -> pixel
	int i, j, k;
	int choix=jeu.nivo%4;

	switch (choix)
	 {
	// mur classique
	case 0 :
		setcolor (YELLOW);					 // couleur jaune, pour la perspective de la bar3D
		setfillstyle (SOLID_FILL, LIGHTRED); // style solide, couleur rouge
		bar3d (posx+1, posy+1, posx+19, posy+19, 0, 1); // cr‚ation du mur
		break;
	// mur en brique rouge
	case 1 :
		// cr‚ation des points rouges
		setcolor(4);
		for (i=0; i<=20; i++)
		 {
			for(j=0; j<=20; j++)
			 {
				k=random(5);
				if (k==0)
					putpixel(j+posx,i+posy,6);
				else if (k==1)
					putpixel(j+posx,i+posy,12);
				else
					putpixel(j+posx,i+posy,4);
			 }
		 }
		// cr‚ation des lignes horizontales
		setcolor(7);
		for(i=0;i<=2;i++)
			line(posx, 10*i+posy, posx+19, 10*i+posy);
		// cr‚ation des lignes verticales
		line (posx+15, posy, posx+15, posy+10);
		line (posx+5, posy+10, posx+5, posy+19);
		break;
	// mur en glace
	case 2 :
		// fait le carr‚ du milieu
		setcolor(3);
		for(i=posy+3;i<=posy+17;i++)
			line(posx+3, i, posx+17, i);
		for(i=0; i<=3; i++)
		 {
			// gauche
			setcolor(7); line(posx+i, posy+i, posx+i, posy+19-i);
			// droite
			setcolor(9); line(posx+19-i, posy+i, posx+19-i, posy+19-i);
			// haut
			setcolor(11); line(posx+i, posy+i, posx+19-i, posy+i);
			// bas
			setcolor(1); line(posx+i, posy+19-i, posx+19-i, posy+19-i);
		 }
		break;
	// mur en marbre
	case 3 :
		for(i=0;i<=2;i++)
		 {
			// gauche
			setcolor(15); line(posx+i, posy+i, posx+i, posy+20 - i);
			// droit
			setcolor(8);  line(posx+20-i, posy+i, posx+20-i, posy+20-i);
			// haut
			setcolor(8);  line(posx+i, posy+0+i, posx+20-i, posy+i);
			// bas
			setcolor(11); line(posx+i, posy+20-i, posx+20-i, posy+20-i);
		 }
		for(i=0; i<350; i++)
		 {
			putpixel(random(15) + posx+3, random(15) + posy+3, 8);
			putpixel(random(15) + posx+3, random(15) + posy+3, 8);
			putpixel(random(15) + posx+3, random(15) + posy+3, 3);
		 }
		break;
	 }
 }


// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º              º												         º \\
// º  DRAW_BOULE  º  Position X, Position Y, Carte                       º \\
// º              º													     º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º                                                                     º \\
// º þ x et y donnent la position de la boule dans la matrice.           º \\
// º þ On affiche un simple cercle, remplit de blanc.                    º \\
// º                                                                     º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\


void 	draw_boule (int x, int y, struct_map *map)
 {
	// posx et posy donnent les coordonn‚es du centre du cercle
	int posx = map->coinx + x * T_CASE+T_CASE_2; // conversion (x) case -> pixel
	int posy = map->coiny + y * T_CASE+T_CASE_2; // conversion (y) case -> pixel

	setcolor (WHITE);                // blanc
	setfillstyle (SOLID_FILL, WHITE);// style solide, couleur blanche
	pieslice (posx, posy, 0, 360, 2);// dessine un cercle et le remplit
 }


// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º                  º										             º \\
// º  DRAW_MEGABOULE  º  Position X, Position Y, Carte                   º \\
// º                  º									                 º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º                                                                     º \\
// º þ x et y donne les coordonn‚es du centre du cercle.                 º \\
// º þ On affiche un simple cercle, remplit de rouge.                    º \\
// º                                                                     º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\


void	draw_megaboule (int x, int y, struct_map *map)
 {
	int posx = map->coinx + x * T_CASE+T_CASE_2; // conversion (x) case -> pixel
	int posy = map->coiny + y * T_CASE+T_CASE_2; // conversion (y) case -> pixel

	setcolor (RED);				     // rouge
	setfillstyle (SOLID_FILL, RED);	 // style solide, couleur rouge
	pieslice (posx, posy, 0, 360, 4);// dessine un cercle et le remplit
 }


// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º                º												     º \\
// º  DRAW_MONSTRE  º  Entit‚, Carte                                     º \\
// º                º												     º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º                                                                     º \\
// º þ On va afficher le monstre dans la map.                            º \\
// º                                                                     º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\


void	draw_monstre(struct_monstre *monstre, int move, struct_map *map)
 {
	int	xb;							 // Position X rapidement utilisable
	int	yb; 						 // Position Y
	int poly[16];

	setcolor(jeu.bkground);			 // on d‚finit la couleur de contour, le vert est la couleur id‚al car c'est la mˆme couleur que le fond.

	// d‚placements
	switch (move)
	 {
	case 1 :
		if (monstre->touch1 == 1) monstre->y -= 0.25; // haut
		if (monstre->touch1 == 2) monstre->x -= 0.25; // gauche
		if (monstre->touch1 == 3) monstre->x += 0.25; // droite
		if (monstre->touch1 == 4) monstre->y += 0.25; // bas
		break;
	case 2 :
		if (monstre->touch2 == 1) monstre->y -= 0.25; // haut
		if (monstre->touch2 == 2) monstre->x -= 0.25; // gauche
		if (monstre->touch2 == 3) monstre->x += 0.25; // droite
		if (monstre->touch2 == 4) monstre->y += 0.25; // bas
		break;
	default : break;
	 }

	// s'il d‚passe du niveau
	if (monstre->x<0.5) monstre->x=map->width-0.75;
	if (monstre->x>map->width-0.5) monstre->x=0.75;
	if (monstre->y<0.5) monstre->y=map->height-0.75;
	if (monstre->y>map->height-0.5) monstre->y=0.75;

	// si le monstre bouge, on l'efface d'abord, on l'affiche ensuite
	if (monstre->bouge == 1)
	 {
		xb=map->coinx+(monstre->oldx)*T_CASE;
		yb=map->coiny+(monstre->oldy)*T_CASE;

		setfillstyle(SOLID_FILL, jeu.bkground);
		bar3d(xb-T_CASE_2, yb-T_CASE_2, xb+T_CASE_2, yb+T_CASE_2, 0, 1);
		// on fait un carr‚ rempli de la couleur de background

		// on r‚affiche ce qu'il a pu effacer
		if (map->val[monstre->x-0.5][monstre->y-0.5] == M_SOLB)
			draw_boule(monstre->x-0.5,monstre->y-0.5, map);

		if (map->val[monstre->x-0.5+3*0.25][monstre->y-0.5] == M_SOLB)
			draw_boule(monstre->x-0.5+3*0.25,monstre->y-0.5, map);

		if (map->val[monstre->x-0.5+3*0.25][monstre->y-0.5+3*0.25] == M_SOLB)
			draw_boule(monstre->x-0.5+3*0.25,monstre->y-0.5+3*0.25, map);

		if (map->val[monstre->x-0.5][monstre->y-0.5+3*0.25] == M_SOLB)
			draw_boule(monstre->x-0.5,monstre->y-0.5+3*0.25, map);
	 }

	// si le monstre est toujours sur la carte, sinon on lui restitue son ancienne position
	if ((map->val[monstre->x-0.5][monstre->y-0.5] < M_MUR) &&               // coin haut-gauche
		(map->val[monstre->x-0.5+3*0.25][monstre->y-0.5] < M_MUR) &&        // coin haut-droit
		(map->val[monstre->x-0.5+3*0.25][monstre->y-0.5+3*0.25] < M_MUR) && // coin bas-droit
		(map->val[monstre->x-0.5][monstre->y-0.5+3*0.25] < M_MUR))          // coin bas-gauche
	 {
		xb=map->coinx+monstre->x*T_CASE;
		yb=map->coiny+monstre->y*T_CASE;

		setcolor (RED);
		circle (xb,yb-3,5);           // dessine la tete du fant“me et  le remplit
		setfillstyle (SOLID_FILL,4);
		floodfill (xb,yb,4);

		poly[0] = xb-6;      // 1er point
		poly[1] = yb;
		poly[2] = xb-9;      // 2Šme point
		poly[3] = yb+9;
		poly[4] = xb-4;      // 3Šme point
		poly[5] = yb+4;
		poly[6] = xb;        // 4Šme point
		poly[7] = yb+9;
		poly[8] = xb+4;      // 5Šme point
		poly[9] = yb+4;
		poly[10] = xb+9;     // 6Šme point
		poly[11] = yb+9;
		poly[12] = xb+6;     // 7Šme point
		poly[13] = yb;
		poly[14] = poly[0];    // raccorde les points
		poly[15] = poly[1];
		setfillstyle (SOLID_FILL,4);     // remplit le fantome
		fillpoly(8, poly);   // dessine le polygone

		// oeil
		setcolor (6);               //trace les yeux du fantome et  les remplit
		circle(xb-2,yb-3,1);
		circle(xb+2,yb-3,1);

	 }
	else
	 {
		monstre->x=monstre->oldx;
		monstre->y=monstre->oldy;
		monstre->bouge=0;
		if (monstre->touch2 == 0) joue_son(2000, 0, 0);
	 }

	// Quoiqu'il arrive, la position actuelle est actualis‚e
	monstre->oldx=monstre->x;
	monstre->oldy=monstre->y;
 }


// ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º               º												     º \\
// º  DRAW_PACMAN  º  Entit‚, Carte                                      º \\
// º               º													 º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º                                                                     º \\
// º þ Dessine l'entit‚ (Pacman ou un monstre) sur la carte.             º \\
// º þ S'il ne bouge pas, il l'affiche perp‚tuellement.                  º \\
// º   Sinon, il efface l'entit‚ (via son ancienne position) puis        º \\
// º   l'affiche avec sa nouvelle posiion.                               º \\
// º þ On v‚rifie pr‚alablement la position de Pacman sur la carte.  	 º \\
// º                                                                     º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\


void	draw_pacman(struct_pacman &pacman, int move, struct_map *map)
 {
	int	xb;							 // Position X rapidement utilisable
	int	yb; 						 // Position Y

	int couleur=pacman.color;
	int radius=9;

	setcolor(jeu.bkground);			 // on d‚finit la couleur de contour, le vert est la couleur id‚al car c'est la mˆme couleur que le fond.

	// d‚placements
	switch (move)
	 {
	case 1 :
		if (pacman.touch1 == 328) pacman.y -= 0.25; // haut
		if (pacman.touch1 == 331) pacman.x -= 0.25; // gauche
		if (pacman.touch1 == 333) pacman.x += 0.25; // droite
		if (pacman.touch1 == 336) pacman.y += 0.25; // bas
		break;
	case 2 :
		if (pacman.touch2 == 328) pacman.y -= 0.25; // haut
		if (pacman.touch2 == 331) pacman.x -= 0.25; // gauche
		if (pacman.touch2 == 333) pacman.x += 0.25; // droite
		if (pacman.touch2 == 336) pacman.y += 0.25; // bas
		break;
	default : break;
	 }

	// si on d‚passe du niveau
	if (pacman.x<0.5) pacman.x=map->width-0.75;  // d‚passement … gauche
	if (pacman.x>map->width-0.5) pacman.x=0.75;  // d‚passement … droite
	if (pacman.y<0.5) pacman.y=map->height-0.75; // d‚passement en haut
	if (pacman.y>map->height-0.5) pacman.y=0.75; // d‚passement en bas

	// si Pacman bouge, on l'efface d'abord
	if (pacman.bouge == 1)
	 {
		xb=map->coinx+(pacman.oldx)*T_CASE;
		yb=map->coiny+(pacman.oldy)*T_CASE;
		setfillstyle(SOLID_FILL, jeu.bkground);
		bar(xb-T_CASE_2, yb-T_CASE_2, xb+T_CASE_2, yb+T_CASE_2);
		// on fait un carr‚ rempli de vert pomme, couleur de background

		if (map->val[pacman.x-0.5][pacman.y-0.5] == M_SOLB)
			draw_boule(pacman.x-0.5,pacman.y-0.5, map);

		if (map->val[pacman.x-0.5+3*0.25][pacman.y-0.5] == M_SOLB)
			draw_boule(pacman.x-0.5+3*0.25,pacman.y-0.5, map);

		if (map->val[pacman.x-0.5+3*0.25][pacman.y-0.5+3*0.25] == M_SOLB)
			draw_boule(pacman.x-0.5+3*0.25,pacman.y-0.5+3*0.25, map);

		if (map->val[pacman.x-0.5][pacman.y-0.5+3*0.25] == M_SOLB)
			draw_boule(pacman.x-0.5,pacman.y-0.5+3*0.25, map);
	 }

	// si Pacman est toujours sur la carte, sinon on lui restitue son ancienne position
	if ((map->val[pacman.x-0.5][pacman.y-0.5] < M_MUR) &&               // coin haut-gauche
		(map->val[pacman.x-0.5+3*0.25][pacman.y-0.5] < M_MUR) &&        // coin haut-droit
		(map->val[pacman.x-0.5+3*0.25][pacman.y-0.5+3*0.25] < M_MUR) && // coin bas-droit
		(map->val[pacman.x-0.5][pacman.y-0.5+3*0.25] < M_MUR))          // coin bas-gauche
	 {
		xb=map->coinx+pacman.x*T_CASE;
		yb=map->coiny+pacman.y*T_CASE;

		int angle;

		// dessine une boule
		if (pacman.touch1 == 333) // droite
		 {
			setcolor(jeu.bkground);
			setfillstyle(SOLID_FILL, jeu.bkground);
		 }
		else
		 {
			setcolor(couleur);
			setfillstyle(SOLID_FILL,couleur);
		 }

		pieslice (xb, yb, 0, 360, radius);

		// si pacman est en mouvement ou pas
		if (pacman.touch1!=0)
		 {
			if (pacman.angle==40) pacman.ouvre=-1;
			if (pacman.angle<=1) pacman.ouvre=1;
			pacman.angle+=pacman.ouvre;
			angle=pacman.angle;
		 }

		if (pacman.touch1==328) // haut
		 {
			// oeil
			setcolor(0);
			setfillstyle(SOLID_FILL,14);
			pieslice (xb-6, yb, 0, 360, 2);
			// bouche
			setcolor(jeu.bkground);
			setfillstyle(SOLID_FILL, jeu.bkground);
			pieslice (xb, yb, 90+angle, 90-angle, radius);
		 }

		if (pacman.touch1==336) // bas
		 {
			// oeil
			setcolor(0);
			setfillstyle(SOLID_FILL,14);
			pieslice (xb+6, yb, 0, 360, 2);
			// bouche
			setcolor(jeu.bkground);
			setfillstyle(SOLID_FILL, jeu.bkground);
			pieslice (xb, yb, 270+angle, 270-angle, radius);
		 }

		if (pacman.touch1==333) // droite
		 {
			// corps
			setcolor(couleur);
			setfillstyle(SOLID_FILL, couleur);
			pieslice (xb, yb, angle, -angle-15, radius);
			// oeil
			setcolor(0);
			setfillstyle(SOLID_FILL,14);
			pieslice (xb+2, yb-6, 0, 360, 2);
		 }

		if (pacman.touch1==331) // gauche
		 {
			// oeil
			setcolor(0);
			setfillstyle(SOLID_FILL,14);
			pieslice (xb-2, yb-6, 0, 360, 2);
			// bouche
			setcolor(jeu.bkground);
			setfillstyle(SOLID_FILL, jeu.bkground);
			pieslice (xb, yb, 180+angle, 180-angle, radius);
		 }

		if ((map->val[int(pacman.x-0.5)][int(pacman.y-0.5)] == M_SOLB) &&               // coin haut-gauche
			(map->val[int(pacman.x-0.5+3*0.25)][int(pacman.y-0.5)] == M_SOLB) &&        // coin haut-droit
			(map->val[int(pacman.x-0.5+3*0.25)][int(pacman.y-0.5+3*0.25)] == M_SOLB) && // coin bas-droit
			(map->val[int(pacman.x-0.5)][int(pacman.y-0.5+3*0.25)] == M_SOLB))          // coin bas-gauche
		 {
			map->val[int(pacman.x-0.25)][int(pacman.y-0.25)]=M_SOL;
			affiche_score(pacman.score, 0);
			pacman.score++;
			map->boules--;
			joue_son(6000, 0, 0);
		 }
	 }
	else
	 {
		pacman.x=pacman.oldx;
		pacman.y=pacman.oldy;
		pacman.bouge=0;
		if (pacman.touch2 == 0) joue_son(2000, 0, 0);
	 }

	// Quoiqu'il arrive, la position actuelle est actualis‚e
	pacman.oldx=pacman.x;
	pacman.oldy=pacman.y;
 }


// ÉÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º            º				            		    		         º \\
// º  DRAW_MAP  º  Carte                                                 º \\
// º            º      						         				     º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º                                                                     º \\
// º þ On dessine la carte.                                              º \\
// º                                                                     º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\


void	draw_map(struct_pacman &pacman, struct_monstre *monstre, struct_map *map)
 {
	int		nb_m=0;

	map->boules=0;

	monstre[0].x=0;
	monstre[0].y=0;

	// BACKGROUND
	map->coinx = (640-T_CASE*(map->width+1))/2; // on calcule la taille par rapport
	map->coiny = (450-T_CASE*(map->height)); // a la taille trouvee dans le fichier map
	setfillstyle (SOLID_FILL, jeu.bkground);      // style solide, couleur rouge
	bar (map->coinx,map->coiny,T_CASE*map->width+map->coinx,450);

	setcolor(14);
	for (int y=0; y<map->height; y++)
	 {
		for (int x=0; x<map->width; x++)
		 {
			switch (map->val[x][y])
			 {
				case M_SOLB :
					map->boules++;
					draw_boule(x,y, map);
					break;
				case M_BONUS :
					draw_megaboule(x,y, map);
					break;
				case M_PACMAN :
					pacman.x=pacman.startx=x+0.5;
					pacman.y=pacman.starty=y+0.5;
					pacman.bouge=0;
					draw_pacman (pacman, 0, map);
					break;
				case M_MONSTRE :
					monstre[nb_m].x=monstre[nb_m].startx=monstre[nb_m].oldx=x+0.5;
					monstre[nb_m].y=monstre[nb_m].starty=monstre[nb_m].oldy=y+0.5;
					if ((monstre[nb_m].x!=0) && (monstre[nb_m].y!=0))
					 {
						monstre[nb_m].bouge=1;
						draw_monstre(&monstre[nb_m], 0, map);
					 }
					nb_m++;
					break;
				case M_MUR :
					draw_mur(x,y,map);
					break;
			 }
		 }
		delay(50);
	 }
 }


// ÉÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º           º									    		         º \\
// º  LOADMAP  º  Chemin, Carte, Code Barre                              º \\
// º           º     												     º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º                                                                     º \\
// º þ On charge un niveau depuis un fichier, et on v‚rifie son authen-  º \\
// º   ticit‚ via un code barre crypt‚.                                  º \\
// º þ On stocke toutes les informations dans une variable de structure  º \\
// º   struct_map.                                                       º \\
// º                                                                     º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\


int		LoadMAP(char *map_name, struct_map *map, long int code)
 {
	int     x;                       // pour la boucle x (largeur)
	int		y;                       // pour la boucle y (hauteur)
	char	c[1];                    // lecture du caractŠre du fichier map
	char 	*msg_err;				 // message d'erreur
	FILE    *fichier;                // fichier pour le rapport
	int		nb_monstres=0;			 // retourne le nombre de monstres dans le niveau

	// si le fichier ne s'ouvre pas, sinon s'il s'ouvre correctement
	if ((fichier=fopen(map_name, "r"))==NULL) // ouverture du fichier
	 {
		clrscr();                    // on efface l'‚cran
		printf("Fichier %s inexistant ou manque de memoire !", map_name);
		getch();
		EXIT;                        // on quitte le programme
	 }
	else
	 {
		// on r‚cupŠre les premiers champs du fichier map
		fscanf (fichier, "%s\n%li\n%d\n%d\n", &map->nom, &map->code, &map->width, &map->height);

		// MAPS : GESTION D'UN CODE DE PROTECTION
		// fonction retir‚e
		if (map->code!=code);

		// initialisation … z‚ro de la matrice (facultatif mais peut ‚viter des bugs)
		for (y=0; y<=map->height; y++)
			for (x=0; x<=map->width; x++)
				map->val[x][y]=0;

		// on analyse chaque caractŠre r‚cup‚r‚
		for (y=0; y<map->height; y++)
		 {
			for (x=0; x<=map->width; x++)
			 {
				fseek(fichier, 0, SEEK_CUR);
				fscanf(fichier, "%c", &c);
				switch (c[0])
				 {
					case '*' : // mur
						map->val[x][y]=M_MUR; break;
					case ' ' : // sol
						map->val[x][y]=M_SOL; break;
					case '·' : // sol avec boule
						map->val[x][y]=M_SOLB; break;
					case 'x' : // bonus
						map->val[x][y]=M_BONUS; break;
					case 'X' : // point de d‚part pacman
						map->val[x][y]=M_PACMAN; break;
					case 'O' : // point de d‚part monstres
						map->val[x][y]=M_MONSTRE; nb_monstres++; break;
				 }
			 }
		 }
	 }
	fclose(fichier);
	return nb_monstres;
 }


// ÉÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» \\
// º            º									    		         º \\
// º  LOADMAPS  º  Chemin, Carte, Code Barre                             º \\
// º            º     												     º \\
// ÌÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹ \\
// º                                                                     º \\
// º þ Charge toutes les maps pour r‚cup‚rer les noms et les codes des   º \\
// º   des maps.                                                         º \\
// º                                                                     º \\
// ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ \\


int		LoadMAPS(char *map_name)
 {
	char 	msg[10];				     // message d'erreur
	FILE    *fichier;                // fichier pour le rapport
	int     result=0;

	// si le fichier ne s'ouvre pas, sinon s'il s'ouvre correctement
	if ((fichier=fopen(map_name, "r"))==NULL) // ouverture du fichier
	 {
		clrscr();                    // on efface l'‚cran
		printf("Fichier %s inexistant !", map_name);
		getch();
	 }
	else
	 {
		do
		 {
			fscanf(fichier, "%s", msg);
			strcpy(jeu.path[result].nom_map, msg);
			result++;
		 }
		while (msg[0]!='.');
	 }
	fclose(fichier);
	return result-1;
 }