Skip to content
Snippets Groups Projects
Commit 5bb4a3a8 authored by ColinDrieu's avatar ColinDrieu
Browse files

Suppression des fichiers liés à l'affiche console.

J'ai supprimmé les fichiers liés à l'affiche console qui ne nous servirons plus.
J'ai retiré les fonctions du fichiers controleur.c qui était dédiée à l'affichage en console.
J'ajouterai de nouvelles fonctions dans controleur.c pour l'affichage avec la SDL.
parent b3e69d60
No related branches found
No related tags found
No related merge requests found
Pipeline #
/*!
* \file AffichageConsole.c
* \brief Fichier contenant le code des fonctions liees a la structure AffichageConsole.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "AffichageConsole.h"
#include "partie.h"
#include "joueur.h"
#include "joueurList.h"
#include "personnage.h"
#include "case.h"
/*!
* \fn void afficheEnsembleJoueur(Partie *p)
* \brief La fonction permet d'afficher le nom de chaque joueur avec leur personnage et ses coordonnees.
*
* \param Un pointeur vers les joueur a afficher avec leur personnage et ses coordonnees.
*/
void afficheEnsembleJoueur(Partie *p){
Joueur * Temporaire = getCurrentJoueur(p->participants); /* On sauve l'emplacement du current actuel*/
setOnFirstJoueur(p->participants); /* On se positionne sur le premier joueur*/
while(!outOfJoueurList(p->participants)){ /*Tant qu'on est pas arrivé au dernier current*/
afficheNomJoueur(getCurrentJoueur(p->participants));
afficheNomPersonnage(getPersonnage(getCurrentJoueur(getListJoueur(p)),0));
afficheCoordonneesPersonnage(getPosition(getPersonnage(getCurrentJoueur(getListJoueur(p)),0)));
nextJoueur(p->participants);
}
/*On affiche le dernier current (personnage)*/
afficheNomJoueur(getCurrentJoueur(p->participants));
afficheNomPersonnage(getPersonnage(getCurrentJoueur(getListJoueur(p)),0));
afficheCoordonneesPersonnage(getPosition(getPersonnage(getCurrentJoueur(getListJoueur(p)),0)));
setOnJoueur(p->participants, Temporaire); /* On retourne sur le current original*/
}
/*!
* \fn void afficheNomJoueur(Joueur * j)
* \brief La fonction permet d'afficher le nom du joueur.
*
* \param Un pointeur vers le joueur a afficher.
*/
void afficheNomJoueur(Joueur * j){
printf("Joueur: %s\n", getNomJoueur(j));
}
/*!
* \fn void afficheNomPersonnage(Personnage * p)
* \brief La fonction permet d'afficher le nom du personnage.
*
* \param Un pointeur vers le personnage a afficher.
*/
void afficheNomPersonnage(Personnage * p){
/*printf("Personnage: %s\n", getPersonnage(p)); Il n'y a pas de fonction pour récupérer le nom du personnage */
}
/*!
* \fn void afficheCoordoneesPersonnage(Case * c)
* \brief La fonction permet d'afficher les coordonnees du personnage.
*
* \param Un pointeur vers les coordonnees du personnage a afficher.
*/
void afficheCoordonneesPersonnage(Case *c){
printf("Coordonnées: \n x = %d\n y = %d \n", get_x(c), get_y(c));
}
/*!
* \fn void afficheEtatPersonnage(Personnage * p)
* \brief La fonction permet d'afficher l'etat du personnage.
*
* \param Un pointeur vers l'etat du personnage a afficher.
*/
void afficheEtatPersonnage(Personnage *p){
afficheNomPersonnage(p);
printf("Points de déplacement: %d\n", get_PD(p));
printf("Points de vie: %d\n", get_PV(p));
printf("Mana: %d\n", get_mana(p));
}
/*!
* \file AffichageConsole.h
* \brief Fichier contenant les signatures des fonctions liees a la structure AffichageConsole.
*/
#ifndef AFFICHAGECONSOLE_H
#define AFFICHAGECONSOLE_H
#include "structures.h"
void afficheEnsembleJoueur(Partie *p);
void afficheNomJoueur(Joueur * j);
void afficheNomPersonnage(Personnage * p);
void afficheCoordonneesPersonnage(Case *c);
void afficheEtatPersonnage(Personnage *p);
#endif // AFFICHAGECONSOLE_H
#include <stdio.h>
#include <stdlib.h>
/*!
* \fn void affichePremierChoix(Partie * p, int * i)
* \brief La fonction affiche le choix offert et modifie la variable entiere donnee en entree.
*
* \param un pointeur vers le premier caractere d'un tableau (il contient le nom du Joueur, voir le controleur), un pointeur vers un entier representant la variable de choix a modifier.
*/
void affichePremierChoix(char * c, int * i){
printf("%s : Que voulez-vous faire?\n 1-Sélectionner un personnage\n 2-Fin du tour\n", c);
scanf("%d",i);
printf("\n");
}
/*!
* \fn void afficherEntrerCoordonnees(int * cX, int * cY)
* \brief La fonction affiche une requete au Joueur et modifie les variable entiere pointee par les entrees en fonction des entrees clavier.
*
* \param les pointeurs vers les entiers representant les coordonnees a modifier.
*/
void afficherEntrerCoordonnees(int * cX, int * cY){
printf("Entrez une abscisse : x = ");
scanf("%d",cX);
printf("\n");
printf("Entrez une ordonnée : y = ");
scanf("%d",cY);
printf("\n");
}
/*!
* \fn void afficherChoixImpossible()
* \brief La fonction affiche un message
*/
void afficherChoixImpossible(){
printf("Vous ne pouvez pas faire ça.");
}
/*!
* \fn void afficheFinTour(char * c)
* \brief La fonction affiche une un message de fin de tour.
*
* \param Un pointeur vers le premier caractere du nom du Joueur dont ca va etre le tour (voir l'appel dans controlleur.c)
*/
void afficheFinTour(char * c){
printf("Fin du tour.\n Nouveau tour : Tour de %s",c);
}
/*!
* \fn void afficheEtatPersonnage(char * nomJoueur, char * nomPersonnage, char * nomClasse, int * caracteristiques)
* \brief La fonction affiche les informations concernant l'etat d'un Personnage
*
* \param Un pointeur vers des chaines de caracteres et un tableau d'entier representant respectivement :
* le nom du Joueur possedant le Personnage
* le nom du Personnage
* le nom de sa Classe
* ses points de vie actuels et maximum
* son mana actuel et maximum
* ses points de deplacement actuels et maximum
*/
void afficheCaracteristiquesPersonnage(char * nomJoueur, char * nomPersonnage, char * nomClasse, int * caracteristiques){
printf("%s : %s\n %s \n", nomPersonnage, nomClasse, nomJoueur);
printf("PV : %d/%d \n Mana : %d/%d \n PD : %d/%d \n", caracteristiques[0], caracteristiques[1], caracteristiques[2], caracteristiques[3], caracteristiques[4], caracteristiques[5]);
}
/*!
* \fn void affichePremierChoix(Partie * p, int * i)
* \brief La fonction affiche le choix offert pour l'action d'un Personnage et modifie la variable entiere donnee en entree.
*
* \param un pointeur vers les premiers caracteres de tableaux (ils contiennent le nom du Joueur et le nom du Personnage respectivement, voir le controleur),
* un pointeur vers un entier representant la variable de choix a modifier.
*/
void afficheChoixActionPersonnage(char * nJ, char * nP, int * i){
printf("%s : %s \n Que voulez vous faire ?\n", nJ,nP);
printf("1- Attaque \n 2- Déplacement \n 3- Retour à la selection de Personnage \n, Fin du Tour");
scanf("%d",i);
}
/*!
* \file affichageConsole2.h
* \brief Fichier contenant les signatures des fonctions liees a la structure AffichageConsole.
*/
#ifndef AFFICHAGECONSOLE2_H
#define AFFICHAGECONSOLE2_H
void affichePremierChoix(char * c, int * i);
void afficheChoixActionPersonnage(char * nJ, char * nP, int * i);
void afficherChoixImpossible();
void afficherEntrerCoordonnees(int * cX, int * cY);
void afficheFinTour(char * c);
void afficheCaracteristiquesPersonnage(char * nomJoueur, char * nomPersonnage, char * nomClasse, int * caracteristiques);
#endif // AFFICHAGECONSOLE2_H
...@@ -14,68 +14,3 @@ ...@@ -14,68 +14,3 @@
#include "personnage.h" #include "personnage.h"
#include "classe.h" #include "classe.h"
/*!
* \fn int choixPrincipal()
* \brief La fonction fait l'interface entre le moteur et l'affichage du jeu pour le premier choix principal d'un Joueur lors de son tour.
*
* \param La Partie p en cours.
* \return un entier representant la valeur du choix du Joueur.
*/
int choixPrincipal(Partie * p){
int choix;
choix = 0;
affichePremierChoix(getNomJoueur(getCurrentJoueur(getListJoueur(p))),&choix);
return choix;
}
/*!
* \fn int choixActionPersonnage(Partie * p)
* \brief La fonction fait l'interface entre le moteur et l'affichage du jeu pour le choix d'une action d'un Personnage.
*
* \param La Partie p en cours.
* \return un entier representant la valeur du choix du Joueur.
*/
int choixActionPersonnage(Partie * p, Personnage * persSel, Joueur * j){
int i;
i=0;
afficheChoixActionPersonnage(getNomJoueur(j),getNomPersonnage(persSel),&i);
return i;
}
/*!
* \fn Case * entrerCoordonnees(Partie * p)
* \brief La fonction fait l'interface entre le moteur et l'affichage du jeu pour la saisie de coordonnees.
*
* \param La Partie p en cours.
* \return Un pointeur vers la Case aux coordonnees entrees, NULL si les coordonnees ne sont pas valides.
*/
Case * entrerCoordonnees(Partie * p){
int x, y;
Case * caseTemp = NULL;
x=-1;
y=-1;
afficherEntrerCoordonnees(&x,&y);
caseTemp=trouverCase(getCarte(p),x,y);
return caseTemp;
}
/*!
* \fn void personnageSelectionne(Partie * p)
* \brief La fonction fait l'interface entre le moteur du jeu et l'affichage pour l'affichage des caracteristiques d'un Personnage.
*
* \param La Partie p en cours.
*/
void personnageSelectionne(Partie * p, Personnage * personnageSel){
char * nP = getNomPersonnage(personnageSel);
char * nC = getNomClasse(getClasse(personnageSel));
char * nJ = getNomJoueur(appartientJoueur(personnageSel,p));
int etat[6]={
get_PV(personnageSel),
getPVMax(getClasse(personnageSel)),
get_mana(personnageSel),
getManaMax(getClasse(personnageSel)),
get_PD(personnageSel),
getPDMax(getClasse(personnageSel))
};
afficheCaracteristiquesPersonnage(nJ,nP,nC,etat);
}
...@@ -8,11 +8,6 @@ ...@@ -8,11 +8,6 @@
#ifndef CONTROLEUR_H #ifndef CONTROLEUR_H
#define CONTROLEUR_H #define CONTROLEUR_H
int choixPrincipal(Partie * p);
Case * entrerCoordonnees(Partie * p);
Personnage * coordonneesValidesPersonnage(Partie * p, Case * c);
int choixActionPersonnage(Partie * p);
void personnageSelectionne(Partie * p, Personnage * personnageSel);
#endif // CONTROLEUR_H #endif // CONTROLEUR_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "structures.h"
#include "controleur.h"
#include "partie.h"
#include "personnage.h"
#include "joueurList.h"
#include "joueur.h"
#include "affichageConsole2.h"
int mainPartieConsole(){
//initialisation
Case * caseSel = NULL;
Personnage * persSel = NULL;
Partie * partieEnCours=initPartie();
//Partie
while(!victoire(partieEnCours)){
switch(choixPrincipal(partieEnCours)){
case 1:{
caseSel = entrerCoordonnees(partieEnCours);
if(caseSel!=NULL){
persSel = coordonneesValidesPersonnage(partieEnCours,caseSel);
if(persSel!=NULL){
personnageSelectionne(partieEnCours,persSel);
if((isTurn(partieEnCours, appartientJoueur(persSel, partieEnCours)))){
switch (choixActionPersonnage(partieEnCours)){
case 1:{
//Attaque
}
case 2:{
//Deplacement
}
case 3:{
//retour au choix principal.
}
case 4:{
finTour(partieEnCours);
afficheFinTour(getNomJoueur(getCurrentJoueur(getListJoueur(partieEnCours))));
}
default:{
afficherChoixImpossible();
}
}
}
}
else{
afficherChoixImpossible();
}
}
else{
afficherChoixImpossible();
}
}
case 2:{
finTour(partieEnCours);
afficheFinTour(getNomJoueur(getCurrentJoueur(getListJoueur(partieEnCours))));
}
default:{
afficherChoixImpossible();
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment