diff --git a/EII_jeu/EII_jeu.cbp b/EII_jeu/EII_jeu.cbp index 2d8c7e789a31dedd45627e526b793ea762bd2b67..6c45ab987c296f6e6373638b28955b3d04b42a4a 100644 --- a/EII_jeu/EII_jeu.cbp +++ b/EII_jeu/EII_jeu.cbp @@ -13,7 +13,16 @@ <Option compiler="gcc" /> <Compiler> <Add option="-g" /> + <Add directory="../Libs/libroxml-2.3.0/src" /> + <Add directory="../Libs/SDL-1.2.15/include" /> + <Add directory="../Libs/cmocka-1.0.0/include" /> </Compiler> + <Linker> + <Add library="..\Libs\libroxml-2.3.0\Build\libroxml.dll" /> + <Add library="..\Libs\SDL-1.2.15\lib\SDL_ttf.dll" /> + <Add directory="../Libs/SDL-1.2.15/lib" /> + <Add directory="../Libs/libroxml-2.3.0/Build" /> + </Linker> </Target> <Target title="Release"> <Option output="bin/Release/EII_jeu" prefix_auto="1" extension_auto="1" /> @@ -30,7 +39,9 @@ </Build> <Compiler> <Add option="-Wall" /> - <Add directory="C:/Users/henri/Desktop/workspace-jeuC/lemeilleurjeudumonde/Libs/SDL-1.2.15/include" /> + <Add directory="../Libs/libroxml-2.3.0/src" /> + <Add directory="../Libs/SDL-1.2.15/include" /> + <Add directory="../Libs/cmocka-1.0.0/include" /> </Compiler> <Linker> <Add library="mingw32" /> @@ -40,10 +51,85 @@ <Add library="gdi32" /> <Add library="winmm" /> <Add library="dxguid" /> + <Add library="..\Libs\libroxml-2.3.0\Build\libroxml.dll" /> <Add directory="C:/Users/henri/Desktop/workspace-jeuC/lemeilleurjeudumonde/Libs/SDL-1.2.15/lib" /> + <Add directory="../Libs/libroxml-2.3.0/Build" /> </Linker> - <Unit filename="cb.bmp" /> - <Unit filename="main.cpp" /> + <Unit filename="../src/ClassesXML.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/ClassesXML.h" /> + <Unit filename="../src/Interface.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/Interface.h" /> + <Unit filename="../src/SDL.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/SDL.h" /> + <Unit filename="../src/SDL_bis.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/TerrainsXML.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/TerrainsXML.h" /> + <Unit filename="../src/carte.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/carte.h" /> + <Unit filename="../src/case.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/case.h" /> + <Unit filename="../src/classe.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/classe.h" /> + <Unit filename="../src/competence.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/competence.h" /> + <Unit filename="../src/controleur.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/controleur.h" /> + <Unit filename="../src/controleurSDL.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/controleurSDL.h" /> + <Unit filename="../src/deplacements.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/deplacements.h" /> + <Unit filename="../src/joueur.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/joueur.h" /> + <Unit filename="../src/joueurList.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/joueurList.h" /> + <Unit filename="../src/main.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/partie.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/partie.h" /> + <Unit filename="../src/personnage.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/personnage.h" /> + <Unit filename="../src/resultat_aleatoire.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/resultat_aleatoire.h" /> + <Unit filename="../src/structures.h" /> + <Unit filename="../src/terrain.c"> + <Option compilerVar="CC" /> + </Unit> + <Unit filename="../src/terrain.h" /> <Extensions> <code_completion /> <envvars /> diff --git a/EII_jeu/EII_jeu.depend b/EII_jeu/EII_jeu.depend index 5c62e9a3d7e3120431793693c9173384c79fe3eb..fe5ee6cf4fdedc3c89b2de411401c7fb7e9d8291 100644 --- a/EII_jeu/EII_jeu.depend +++ b/EII_jeu/EII_jeu.depend @@ -1,38 +1,4 @@ # depslib dependency file v1.0 -1460459876 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\affichageconsole.c - <stdio.h> - <stdlib.h> - <string.h> - "AffichageConsole.h" - "partie.h" - "joueur.h" - "joueurList.h" - "personnage.h" - "case.h" - -1460459876 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\affichageconsole.h - "structures.h" - -1462278696 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\structures.h - -1462278681 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\partie.h - "structures.h" - -1459764934 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\joueur.h - "structures.h" - -1459764960 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\joueurlist.h - "structures.h" - -1461253159 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\personnage.h - -1462138721 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\case.h - "structures.h" - -1460725190 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\affichageconsole2.c - <stdio.h> - <stdlib.h> - 1462138721 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\carte.c <stdio.h> <stdlib.h> @@ -44,6 +10,8 @@ 1462138721 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\carte.h "structures.h" +1462295269 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\structures.h + 1459762040 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\libs\libroxml-2.3.0\src\roxml.h <stdio.h> <stdlib.h> @@ -65,6 +33,8 @@ "roxml.h" "TerrainsXML.h" +1462293472 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\personnage.h + 1461279123 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\deplacements.h 1462138721 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\terrainsxml.h @@ -93,7 +63,7 @@ <roxml.h> "ClassesXML.h" -1462278696 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\competence.c +1462287091 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\competence.c <stdio.h> <stdlib.h> <roxml.h> @@ -102,18 +72,28 @@ 1462278696 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\competence.h -1461253159 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\controleur.c +1462293472 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\controleur.c <stdio.h> <stdlib.h> "partie.h" "joueur.h" - "affichageConsole2.h" "joueurList.h" "case.h" "personnage.h" "classe.h" + "gamePackage.h" -1460725190 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\affichageconsole2.h +1462278681 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\partie.h + "structures.h" + +1459764934 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\joueur.h + "structures.h" + +1459764960 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\joueurlist.h + "structures.h" + +1462138721 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\case.h + "structures.h" 1462278681 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\controleursdl.c <stdlib.h> @@ -354,7 +334,7 @@ "structures.h" "joueurList.h" -1462279594 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\main.c +1462293472 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\main.c <stdio.h> <stdlib.h> "structures.h" @@ -365,21 +345,7 @@ "roxml.h" "carte.h" "Interface.h" - -1461253159 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\mainpartieconsole.c - <stdlib.h> - <stdio.h> - <string.h> - "structures.h" - "controleur.h" - "partie.h" - "personnage.h" - "joueurList.h" - "joueur.h" - "affichageConsole2.h" - -1460725190 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\controleur.h - "structures.h" + "gamePackage.h" 1462278681 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\partie.c <stdio.h> @@ -415,18 +381,6 @@ "SDL.h" "controleurSDL.h" -1462286071 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\sdl_bis.c - <stdio.h> - <stdlib.h> - <SDL/SDL.h> - <SDL/SDL_ttf.h> - "SDL.h" - -1325818393 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\libs\sdl-1.2.15\include\sdl\sdl_ttf.h - "SDL.h" - "begin_code.h" - "close_code.h" - 1462138721 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\terrain.c <stdio.h> <stdlib.h> @@ -443,3 +397,24 @@ "TerrainsXML.h" "structures.h" +1462295606 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\sdl_bis.c + <stdio.h> + <stdlib.h> + <SDL/SDL.h> + <SDL/SDL_ttf.h> + "SDL.h" + "structures.h" + +1325818393 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\libs\sdl-1.2.15\include\sdl\sdl_ttf.h + "SDL.h" + "begin_code.h" + "close_code.h" + +1462293472 c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\gamepackage.h + +1462293472 source:c:\users\henri\desktop\workspace-jeuc\lemeilleurjeudumonde\src\gamepackage.c + "structures.h" + "roxml.h" + "Interface.h" + "gamePackage.h" + diff --git a/resources/Skins/Thumbs.db b/resources/Skins/Thumbs.db index 6d334ef44a7ef941c697f5e81b9c9721cb367cdf..0b79a7165357f74c8e9022c0630dd047e5012f85 100644 Binary files a/resources/Skins/Thumbs.db and b/resources/Skins/Thumbs.db differ diff --git a/resources/fonts/OLDENGL.TTF b/resources/fonts/OLDENGL.TTF new file mode 100644 index 0000000000000000000000000000000000000000..bed2c5bf86c0b1ce617651360ae9abcade9e27ec Binary files /dev/null and b/resources/fonts/OLDENGL.TTF differ diff --git a/src/SDL_bis.c b/src/SDL_bis.c index 7eceef1bbde9f417d713bc99e7914796ff007ba4..7e3d2e11b8f3dcea36100cf89d4d8618d9c92d36 100644 --- a/src/SDL_bis.c +++ b/src/SDL_bis.c @@ -4,6 +4,8 @@ #include <SDL/SDL_ttf.h> #include "SDL.h" #include "structures.h" +#include "controleur.h" + int SDL_bis() @@ -12,6 +14,7 @@ int SDL_bis() SDL_Surface* ecran=NULL; SDL_Event event; SDL_Surface* logo = NULL; + SDL_Surface* rectangle = NULL; SDL_Surface* texte = NULL; SDL_Rect pos_logo; SDL_Rect pos_texte; @@ -32,6 +35,8 @@ int SDL_bis() police=TTF_OpenFont("../resources/fonts/arial.ttf",26); SDL_Color couleurNoire = {0, 0, 0}; SDL_Color couleurBlanche = {255, 255, 255}; + SDL_Color couleurBleue = {10, 30, 80}; + SDL_Color couleurDoree = {190, 190, 120}; ecran = SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE+1), HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF); if (ecran == NULL) // Si l'ouverture a échoué, on le note et on arrête @@ -60,24 +65,70 @@ int SDL_bis() SDL_BlitSurface(logo,NULL,ecran,&pos_logo); SDL_Flip(ecran); - char nom_joueur1[15] = ""; + char nom_joueur1[TAILLE_NOMS] = ""; fgets(nom_joueur1, sizeof(nom_joueur1), stdin); +<<<<<<< HEAD char nom_joueur2[15] = ""; // ajouter_joueurs(nom_joueur1,nom_joueur2, &etat); //a coder par colin +======= + texte = TTF_RenderText_Shaded(police, "Entrez le nom du joueur 2", couleurBlanche,couleurNoire); + SDL_BlitSurface(texte,NULL,ecran,&pos_texte); + SDL_Flip(ecran); + + char nom_joueur2[TAILLE_NOMS] = ""; + + fgets(nom_joueur2, sizeof(nom_joueur2), stdin); + ajouterUnJoueur(nom_joueur1,&etat); + ajouterUnJoueur(nom_joueur2,&etat); + + police=TTF_OpenFont("../resources/fonts/OLDENGL.ttf",40); + texte = TTF_RenderText_Shaded(police, "Entrez dans le Royaume !", couleurDoree,couleurBleue); + pos_texte.x=(ecran->w-texte->w)/2; + pos_texte.y=ecran->h-200; + rectangle=SDL_CreateRGBSurface(SDL_HWSURFACE,texte->w,texte->h,NULL,0,0,255,NULL); +>>>>>>> 2aeeb25b1ba76ad66d203c7a609516daa79b3569 - while(quitter==0) + SDL_FillRect(ecran,NULL,SDL_MapRGB(ecran->format,0,0,0)); + SDL_BlitSurface(logo,NULL,ecran,&pos_logo); + SDL_BlitSurface(texte,NULL,ecran,&pos_texte); + SDL_BlitSurface(rectangle,NULL,ecran,&pos_texte); + SDL_Flip(ecran); + + while(etat==LANCEMENT) { SDL_WaitEvent(&event); switch(event.type) { case SDL_QUIT: - quitter=1; + etat=FERMER; + break; + case SDL_MOUSEBUTTONDOWN: + if (event.button.x<pos_texte.x+texte->w&&event.button.x>pos_texte.x&&event.button.y<pos_texte.y+texte->h&&event.button.y>pos_texte.y) + {etat=CONFIGURATION;} + break; + default: break; } - SDL_BlitSurface(texte,NULL,ecran,&pos_texte); SDL_BlitSurface(logo,NULL,ecran,&pos_logo); + SDL_BlitSurface(texte,NULL,ecran,&pos_texte); + SDL_BlitSurface(rectangle,NULL,ecran,&pos_texte); SDL_Flip(ecran); } + + while(etat==CONFIGURATION) + { + SDL_WaitEvent(&event); + switch(event.type) + { + case SDL_QUIT: + etat=FERMER; + break; + case SDL_MOUSEBUTTONDOWN: + if (event.button.x<pos_texte.x+texte->w&&event.button.x>pos_texte.x&&event.button.y<pos_texte.y+texte->h&&event.button.y>pos_texte.y) + etat=CONFIGURATION; + break; + } + } return 0; } diff --git a/src/competence.c b/src/competence.c index 274942211a50604b7e1b18d19d280a8d8410a8e8..5e52a36dda010eccf8939ccc8df5110e59e1b33e 100644 --- a/src/competence.c +++ b/src/competence.c @@ -324,7 +324,7 @@ Competence* Extraire_Arbres(char *filename) node_t *CompetenceXML_4; Competence *Competence_4; - Competence_4 = init_Competence(Competence_3); + Competence_4 = init_Competence(Competence_4); CompetenceXML_4 = roxml_get_chld(CompetenceXML_3, NULL, i_4); set_comp_name(Competence_4,roxml_get_content(roxml_get_attr(CompetenceXML_4,"nom",0),NULL,0,NULL)); @@ -336,16 +336,16 @@ Competence* Extraire_Arbres(char *filename) printf("La competence_4 actuelle a pour prix : %s\n", Competence_4->prix_competence); /* La competence 4 devient un enfant de la competence 3 */ - //set_comp_enfant(Competence_3, Competence_4); //FAIT PLANTER + set_comp_enfant(Competence_3, Competence_4); //FAIT PLANTER A PARTIR DE 3 NIVEAUX DE REMPLISSAGE } /* La competence 3 devient un enfant de la competence 2 */ - //set_comp_enfant(Competence_2, Competence_3); //FAIT PLANTER + //set_comp_enfant(Competence_2, Competence_3); } /* La competence 2 devient un enfant de la competence 1 */ set_comp_enfant(Competence_1, Competence_2); } /* La competence 1 devient un enfant du premier noeud */ - set_comp_enfant(Arbre_Actuel, Competence_1); + //set_comp_enfant(Arbre_Actuel, Competence_1); } } diff --git a/src/controleur.c b/src/controleur.c index 65fcb3f56a73399ff173dbaff29f70af2654eb3b..edc8193a1874a687e6d58d92b0dba65594a6085f 100644 --- a/src/controleur.c +++ b/src/controleur.c @@ -28,14 +28,25 @@ void initJeu(){ /*! * \fn void ajouterUnJoueur(char * nomDuJoueur, Et) - * \brief Fonction de construction d'un package contenant l'univers du jeu + * \brief Fonction ajoutant un Joueur à la Partie et faisant passer la partie à l'état suivant. + * Si le joueur n'a pas correctement été ajouté, l'état reste le même. * - * \return un Game_Package + * \param Le nom du joueur à ajouter à la partie */ void ajouterUnJoueur(char * nomDuJoueur, EtatsJeu * etat){ Joueur * j = nouveauJoueur(); - setNomJoueur(j,nomDuJoueur); - addParticipant(partieGlobale,j); + if(j!=NULL){ + setNomJoueur(j,nomDuJoueur); + if(addParticipant(partieGlobale,j)==0){ + *etat =LANCEMENT; + } + else{ + *etat=SAISIE_JOUEURS; + } + } + else{ + *etat=SAISIE_JOUEURS; + } } diff --git a/src/controleur.h b/src/controleur.h index c14fa45f19ab68bff8db563297a9b1ab3c1e8359..0c2a321505ee6eb866cda15fd7aad4c2f4fb02e3 100644 --- a/src/controleur.h +++ b/src/controleur.h @@ -9,6 +9,7 @@ #define CONTROLEUR_H void initJeu(); + void ajouterUnJoueur(char * nomDuJoueur, EtatsJeu * etat); #endif // CONTROLEUR_H diff --git a/src/structures.h b/src/structures.h index 4c8578772f84df51182ac92a1deb970b1deb88dd..f2d6b00cc86da323c39acbccea9fe49034fef02f 100644 --- a/src/structures.h +++ b/src/structures.h @@ -72,7 +72,8 @@ typedef enum {SAISIE_JOUEURS, TOUR_J2P3, J2P3_DEPLACEMENT, J2P3_ATTAQUE, - VICTOIRE + VICTOIRE, + FERMER }EtatsJeu; /*! \struct Skins_Charac structures.h