Browse Source

Reindent every file

Use vim autoindentation on every file.
DricomDragon 4 years ago
parent
commit
3a8cd2c4c4
21 changed files with 745 additions and 745 deletions
  1. 28 28
      Bouton.cpp
  2. 15 15
      Bouton.h
  3. 32 32
      ChampDeBataille.cpp
  4. 13 13
      ChampDeBataille.h
  5. 5 5
      Cliquable.cpp
  6. 10 10
      Cliquable.h
  7. 18 18
      Ennemy.cpp
  8. 13 13
      Ennemy.h
  9. 105 105
      Helico.cpp
  10. 23 23
      Helico.h
  11. 28 28
      Icones.cpp
  12. 14 14
      Icones.h
  13. 97 97
      Joueur.cpp
  14. 46 46
      Joueur.h
  15. 116 116
      eventLoop.cpp
  16. 2 2
      eventLoop.h
  17. 24 24
      main.cpp
  18. 137 137
      menuFire.cpp
  19. 5 5
      menuFire.h
  20. 12 12
      takeRand.cpp
  21. 2 2
      takeRand.h

+ 28 - 28
Bouton.cpp

@@ -6,46 +6,46 @@
 
 
 Bouton::Bouton(int x, int y, int choixArme,std::string armeAssignee, SDL_Surface* ecran, Joueur* lanceur) : m_ecran(ecran),proprio(lanceur),m_armeAssignee(armeAssignee)
 Bouton::Bouton(int x, int y, int choixArme,std::string armeAssignee, SDL_Surface* ecran, Joueur* lanceur) : m_ecran(ecran),proprio(lanceur),m_armeAssignee(armeAssignee)
 {
 {
-    m_positionIcone.x=x;
+	m_positionIcone.x=x;
-    m_positionIcone.y=y;
+	m_positionIcone.y=y;
-    switch (choixArme)
+	switch (choixArme)
-    {
+	{
-        case 0:
+		case 0:
-            imageIcone=SDL_LoadBMP("Images/IconeBaroudeur.bmp");
+			imageIcone=SDL_LoadBMP("Images/IconeBaroudeur.bmp");
-            break;
+			break;
-        case 1:
+		case 1:
-            imageIcone=SDL_LoadBMP("Images/IconeUsiane.bmp");
+			imageIcone=SDL_LoadBMP("Images/IconeUsiane.bmp");
-            break;
+			break;
-        case 2:
+		case 2:
-            imageIcone=SDL_LoadBMP("Images/IconeTriphaseur.bmp");
+			imageIcone=SDL_LoadBMP("Images/IconeTriphaseur.bmp");
-            break;
+			break;
-    }
+	}
 
 
 }
 }
 Bouton::~Bouton()
 Bouton::~Bouton()
 {
 {
-    SDL_FreeSurface(imageIcone);
+	SDL_FreeSurface(imageIcone);
 }
 }
 
 
 void Bouton::afficher()
 void Bouton::afficher()
 {
 {
-    if (Cliquable::m_tempsFire==0)
+	if (Cliquable::m_tempsFire==0)
-    {
+	{
-        this->clic();
+		this->clic();
-    }
+	}
-    SDL_BlitSurface(imageIcone,0,m_ecran,&m_positionIcone);
+	SDL_BlitSurface(imageIcone,0,m_ecran,&m_positionIcone);
 }
 }
 
 
 void Bouton::clic()
 void Bouton::clic()
 {
 {
-    /*Teste si le click est sur l'icone, puis fait l'assignation de l'arme.*/
+	/*Teste si le click est sur l'icone, puis fait l'assignation de l'arme.*/
-    if (Cliquable::m_yFire>m_positionIcone.y)
+	if (Cliquable::m_yFire>m_positionIcone.y)
-    {
+	{
-        if (Cliquable::m_xFire>m_positionIcone.x&&Cliquable::m_xFire<(m_positionIcone.x+140))
+		if (Cliquable::m_xFire>m_positionIcone.x&&Cliquable::m_xFire<(m_positionIcone.x+140))
-        {
+		{
-            proprio->setArme(m_armeAssignee);
+			proprio->setArme(m_armeAssignee);
-        }
+		}
-    }
+	}
 
 
 
 
 }
 }

+ 15 - 15
Bouton.h

@@ -2,9 +2,9 @@
 #define BOUTON_H_INCLUDED
 #define BOUTON_H_INCLUDED
 
 
 /*Description:
 /*Description:
-Permet de creer des icones d'arme cliquables.
+  Permet de creer des icones d'arme cliquables.
-Un clic sur l'une d'entre elles permet le changement d'arme.
+  Un clic sur l'une d'entre elles permet le changement d'arme.
-*/
+  */
 
 
 #include <SDL/SDL.h>
 #include <SDL/SDL.h>
 #include "Cliquable.h"
 #include "Cliquable.h"
@@ -12,19 +12,19 @@ Un clic sur l'une d'entre elles permet le changement d'arme.
 
 
 class Bouton : public Cliquable
 class Bouton : public Cliquable
 {
 {
-    public:
+	public:
-    Bouton(int x, int y,int choixArme,std::string armeAssignee, SDL_Surface* ecran, Joueur* lanceur);
+		Bouton(int x, int y,int choixArme,std::string armeAssignee, SDL_Surface* ecran, Joueur* lanceur);
-    ~Bouton();
+		~Bouton();
-    void afficher();//Affiche l'icone et appelle "clic" si le clic gauche vient d'être effectué
+		void afficher();//Affiche l'icone et appelle "clic" si le clic gauche vient d'être effectué
-    void clic();//Attribue l'arme associée au joueur proprio si le clic est bien sur l'icone.
+		void clic();//Attribue l'arme associée au joueur proprio si le clic est bien sur l'icone.
 
 
-    private:
+	private:
-    SDL_Surface* m_ecran;//Pour les blits
+		SDL_Surface* m_ecran;//Pour les blits
-    SDL_Surface* imageIcone;
+		SDL_Surface* imageIcone;
-    SDL_Rect m_positionIcone;
+		SDL_Rect m_positionIcone;
-    Joueur* proprio;
+		Joueur* proprio;
-    //Limite autre héritage
+		//Limite autre héritage
-    std::string m_armeAssignee;
+		std::string m_armeAssignee;
 };
 };
 
 
 #endif // BOUTON_H_INCLUDED
 #endif // BOUTON_H_INCLUDED

+ 32 - 32
ChampDeBataille.cpp

@@ -3,44 +3,44 @@
 
 
 ChampDeBataille::ChampDeBataille(Joueur* cible,SDL_Surface* ecran,int niveauDeDifficulte):m_niveauDeDifficulte(niveauDeDifficulte),m_ecran(ecran)
 ChampDeBataille::ChampDeBataille(Joueur* cible,SDL_Surface* ecran,int niveauDeDifficulte):m_niveauDeDifficulte(niveauDeDifficulte),m_ecran(ecran)
 {
 {
-    for (int i(0);i<30;i++)
+	for (int i(0);i<30;i++)
-    {
+	{
-        m_slotsHelico[i]=0;//Pour la sécurité des pointeurs
+		m_slotsHelico[i]=0;//Pour la sécurité des pointeurs
-    }
+	}
-    for (int i(0);i<10+optionsFire::difficulte*10;i++)
+	for (int i(0);i<10+optionsFire::difficulte*10;i++)
-    {
+	{
-        m_slotsHelico[i]= new Helico(ecran,10,i);
+		m_slotsHelico[i]= new Helico(ecran,10,i);
-    }
+	}
-    m_bossOne= new BossOne(ecran,cible);
+	m_bossOne= new BossOne(ecran,cible);
-    m_cible=cible;
+	m_cible=cible;
 }
 }
 
 
 ChampDeBataille::~ChampDeBataille()
 ChampDeBataille::~ChampDeBataille()
 {
 {
-    for (int i(0);i<10+optionsFire::difficulte*10;i++)
+	for (int i(0);i<10+optionsFire::difficulte*10;i++)
-    {
+	{
-        delete(m_slotsHelico[i]);
+		delete(m_slotsHelico[i]);
-    }
+	}
-    delete (m_bossOne);
+	delete (m_bossOne);
 }
 }
 
 
 void ChampDeBataille::afficher()
 void ChampDeBataille::afficher()
 {
 {
-    int nbVivant(0);
+	int nbVivant(0);
-    for (int i(0);i<10+optionsFire::difficulte*10;i++)
+	for (int i(0);i<10+optionsFire::difficulte*10;i++)
-    {
+	{
-        if (m_slotsHelico[i]->estVivant())
+		if (m_slotsHelico[i]->estVivant())
-        {
+		{
-            m_slotsHelico[i]->afficher();
+			m_slotsHelico[i]->afficher();
-            nbVivant++;
+			nbVivant++;
-        }
+		}
-    }
+	}
-    if ((nbVivant!=0 )&&( !takeRand(70-2*nbVivant,SDL_GetTicks())))
+	if ((nbVivant!=0 )&&( !takeRand(70-2*nbVivant,SDL_GetTicks())))
-    {
+	{
-        m_cible->recevoirDegats(1+optionsFire::difficulte);
+		m_cible->recevoirDegats(1+optionsFire::difficulte);
-    }
+	}
-    if (!nbVivant && m_bossOne->estVivant())
+	if (!nbVivant && m_bossOne->estVivant())
-    {
+	{
-        m_bossOne->afficher();
+		m_bossOne->afficher();
-    }
+	}
 }
 }

+ 13 - 13
ChampDeBataille.h

@@ -2,9 +2,9 @@
 #define CHAMPDEBATAILLE_H_INCLUDED
 #define CHAMPDEBATAILLE_H_INCLUDED
 
 
 /*Description:
 /*Description:
-Le champ de bataille contient et gère tous les ennemis
+  Le champ de bataille contient et gère tous les ennemis
-présents.
+  présents.
-*/
+  */
 
 
 #include <iostream>
 #include <iostream>
 #include <SDL/SDL.h>
 #include <SDL/SDL.h>
@@ -15,17 +15,17 @@ pr
 
 
 class ChampDeBataille
 class ChampDeBataille
 {
 {
-    public:
+	public:
-    ChampDeBataille(Joueur* cible,SDL_Surface* ecran,int niveauDeDifficulte);
+		ChampDeBataille(Joueur* cible,SDL_Surface* ecran,int niveauDeDifficulte);
-    ~ChampDeBataille();
+		~ChampDeBataille();
-    void afficher();
+		void afficher();
 
 
-    private:
+	private:
-    SDL_Surface* m_ecran;
+		SDL_Surface* m_ecran;
-    Joueur* m_cible;
+		Joueur* m_cible;
-    int m_niveauDeDifficulte;
+		int m_niveauDeDifficulte;
-    Helico* m_slotsHelico[30];
+		Helico* m_slotsHelico[30];
-    BossOne* m_bossOne;
+		BossOne* m_bossOne;
 };
 };
 
 
 #endif // CHAMPDEBATAILLE_H_INCLUDED
 #endif // CHAMPDEBATAILLE_H_INCLUDED

+ 5 - 5
Cliquable.cpp

@@ -8,13 +8,13 @@ int Cliquable::m_typeFire = 0;
 
 
 void Cliquable::getFire(int x,int y,unsigned int typeTir)
 void Cliquable::getFire(int x,int y,unsigned int typeTir)
 {
 {
-    Cliquable::m_xFire=x;
+	Cliquable::m_xFire=x;
-    Cliquable::m_yFire=y;
+	Cliquable::m_yFire=y;
-    Cliquable::m_tempsFire=0;
+	Cliquable::m_tempsFire=0;
-    Cliquable::m_typeFire=typeTir;
+	Cliquable::m_typeFire=typeTir;
 }
 }
 
 
 void Cliquable::upFire()
 void Cliquable::upFire()
 {
 {
-    Cliquable::m_tempsFire++;
+	Cliquable::m_tempsFire++;
 }
 }

+ 10 - 10
Cliquable.h

@@ -2,8 +2,8 @@
 #define CLIQUABLE_H_INCLUDED
 #define CLIQUABLE_H_INCLUDED
 
 
 /*Description:
 /*Description:
-Permet de créer des objets cliquables avec le clic gauche.
+  Permet de créer des objets cliquables avec le clic gauche.
-*/
+  */
 
 
 #include <iostream>
 #include <iostream>
 #include <SDL/SDL.h>
 #include <SDL/SDL.h>
@@ -11,15 +11,15 @@ Permet de cr
 
 
 class Cliquable
 class Cliquable
 {
 {
-    public:
+	public:
-    static void getFire(int x,int y,unsigned int typeTir);//Met à jour le dernier tir effectué
+		static void getFire(int x,int y,unsigned int typeTir);//Met à jour le dernier tir effectué
-    static void upFire();//Rajoute un temps depuis le dernier tir
+		static void upFire();//Rajoute un temps depuis le dernier tir
 
 
-    protected:
+	protected:
-    static int m_xFire;//Contient la coordonnée x d'un tir
+		static int m_xFire;//Contient la coordonnée x d'un tir
-    static int m_yFire;//Contient la coordonnée y d'un tir
+		static int m_yFire;//Contient la coordonnée y d'un tir
-    static int m_tempsFire;//Contient le nb de boucles depuis le dernier tir (0=en cours; 5=il y a 5 boucles)
+		static int m_tempsFire;//Contient le nb de boucles depuis le dernier tir (0=en cours; 5=il y a 5 boucles)
-    static int m_typeFire;//Contient le type de l'arme qui a tiré
+		static int m_typeFire;//Contient le type de l'arme qui a tiré
 };
 };
 
 
 #endif // CLIQUABLE_H_INCLUDED
 #endif // CLIQUABLE_H_INCLUDED

+ 18 - 18
Ennemy.cpp

@@ -2,38 +2,38 @@
 
 
 Ennemy::Ennemy(Joueur* cible,SDL_Surface* ecran) : m_vie(6)
 Ennemy::Ennemy(Joueur* cible,SDL_Surface* ecran) : m_vie(6)
 {
 {
-    m_ecran=ecran;
+	m_ecran=ecran;
-    m_cible=cible;
+	m_cible=cible;
 }
 }
 
 
 Ennemy::Ennemy(Joueur* cible,SDL_Surface* ecran,int vie) : m_vie(vie)
 Ennemy::Ennemy(Joueur* cible,SDL_Surface* ecran,int vie) : m_vie(vie)
 {
 {
-    m_ecran=ecran;
+	m_ecran=ecran;
-    m_cible=cible;
+	m_cible=cible;
 }
 }
 
 
 void Ennemy::recevoirDegats(int degats)
 void Ennemy::recevoirDegats(int degats)
 {
 {
-    m_vie-=degats;
+	m_vie-=degats;
-    if (m_vie<0)
+	if (m_vie<0)
-    {
+	{
-        m_vie=0;
+		m_vie=0;
-    }
+	}
 }
 }
 
 
 void Ennemy::ressuciter()
 void Ennemy::ressuciter()
 {
 {
-    m_vie=60;
+	m_vie=60;
 }
 }
 
 
 bool Ennemy::estVivant()
 bool Ennemy::estVivant()
 {
 {
-    if (m_vie==0)
+	if (m_vie==0)
-    {
+	{
-        return false;
+		return false;
-    }
+	}
-    else
+	else
-    {
+	{
-        return true;
+		return true;
-    }
+	}
 }
 }

+ 13 - 13
Ennemy.h

@@ -2,9 +2,9 @@
 #define ENNEMY_H_INCLUDED
 #define ENNEMY_H_INCLUDED
 
 
 /*Description:
 /*Description:
-Classe abstraite, la classe ennemi est héritée par
+  Classe abstraite, la classe ennemi est héritée par
-tous les ennemis qui peuvent mourir et touchés par le joueur.
+  tous les ennemis qui peuvent mourir et touchés par le joueur.
-*/
+  */
 
 
 #include <SDL/SDL.h>
 #include <SDL/SDL.h>
 #include <iostream>
 #include <iostream>
@@ -13,17 +13,17 @@ tous les ennemis qui peuvent mourir et touch
 
 
 class Ennemy : public Cliquable
 class Ennemy : public Cliquable
 {
 {
-    public:
+	public:
-    Ennemy(Joueur* cible,SDL_Surface* ecran);
+		Ennemy(Joueur* cible,SDL_Surface* ecran);
-    Ennemy(Joueur* cible,SDL_Surface* ecran,int vie);
+		Ennemy(Joueur* cible,SDL_Surface* ecran,int vie);
-    void recevoirDegats(int degats);
+		void recevoirDegats(int degats);
-    void ressuciter();
+		void ressuciter();
-    bool estVivant();
+		bool estVivant();
 
 
-    protected:
+	protected:
-    int m_vie;
+		int m_vie;
-    SDL_Surface* m_ecran;
+		SDL_Surface* m_ecran;
-    Joueur* m_cible;
+		Joueur* m_cible;
 };
 };
 
 
 #endif // ENNEMY_H_INCLUDED
 #endif // ENNEMY_H_INCLUDED

+ 105 - 105
Helico.cpp

@@ -2,141 +2,141 @@
 
 
 Helico::Helico(SDL_Surface* ecran) : Ennemy(0,ecran),m_vitesse(5+takeRand(5))
 Helico::Helico(SDL_Surface* ecran) : Ennemy(0,ecran),m_vitesse(5+takeRand(5))
 {
 {
-    m_helico = SDL_LoadBMP("Images/Helicopter.bmp");
+	m_helico = SDL_LoadBMP("Images/Helicopter.bmp");
-    SDL_SetColorKey(m_helico,SDL_SRCCOLORKEY,SDL_MapRGB(m_helico->format,255,255,255));//On met le fond (blanc) en invisible !
+	SDL_SetColorKey(m_helico,SDL_SRCCOLORKEY,SDL_MapRGB(m_helico->format,255,255,255));//On met le fond (blanc) en invisible !
-    m_positionHelico.x=takeRand(620);
+	m_positionHelico.x=takeRand(620);
-    m_positionHelico.y=40+takeRand(350);
+	m_positionHelico.y=40+takeRand(350);
 }
 }
 
 
 Helico::Helico(SDL_Surface* ecran,int vie) : Ennemy(0,ecran,vie),m_vitesse(5+takeRand(5))
 Helico::Helico(SDL_Surface* ecran,int vie) : Ennemy(0,ecran,vie),m_vitesse(5+takeRand(5))
 {
 {
-    m_helico=SDL_LoadBMP("Images/Helicopter.bmp");
+	m_helico=SDL_LoadBMP("Images/Helicopter.bmp");
-    SDL_SetColorKey(m_helico,SDL_SRCCOLORKEY,SDL_MapRGB(m_helico->format,255,255,255));//On met le fond (blanc) en invisible !
+	SDL_SetColorKey(m_helico,SDL_SRCCOLORKEY,SDL_MapRGB(m_helico->format,255,255,255));//On met le fond (blanc) en invisible !
 }
 }
 
 
 Helico::Helico(SDL_Surface* ecran, int vie, int antiLatence) : Ennemy(0,ecran,vie),m_vitesse(5+takeRand(5,antiLatence))
 Helico::Helico(SDL_Surface* ecran, int vie, int antiLatence) : Ennemy(0,ecran,vie),m_vitesse(5+takeRand(5,antiLatence))
 {
 {
-    m_helico = SDL_LoadBMP("Images/Helicopter.bmp");
+	m_helico = SDL_LoadBMP("Images/Helicopter.bmp");
-    SDL_SetColorKey(m_helico,SDL_SRCCOLORKEY,SDL_MapRGB(m_helico->format,255,255,255));//On met le fond (blanc) en invisible !
+	SDL_SetColorKey(m_helico,SDL_SRCCOLORKEY,SDL_MapRGB(m_helico->format,255,255,255));//On met le fond (blanc) en invisible !
-    m_positionHelico.x=takeRand(620,antiLatence);
+	m_positionHelico.x=takeRand(620,antiLatence);
-    m_positionHelico.y=40+takeRand(350,antiLatence);
+	m_positionHelico.y=40+takeRand(350,antiLatence);
 }
 }
 
 
 Helico::~Helico()
 Helico::~Helico()
 {
 {
-    SDL_FreeSurface(m_helico);
+	SDL_FreeSurface(m_helico);
 }
 }
 
 
 void Helico::afficher()
 void Helico::afficher()
 {
 {
-    if (m_positionHelico.x<640)
+	if (m_positionHelico.x<640)
-    {
+	{
-        m_positionHelico.x=m_positionHelico.x+=m_vitesse;
+		m_positionHelico.x=m_positionHelico.x+=m_vitesse;
-    }
+	}
-    else
+	else
-    {
+	{
-        m_positionHelico.x=0;
+		m_positionHelico.x=0;
-    }
+	}
-    SDL_BlitSurface(m_helico,NULL,m_ecran,&m_positionHelico);
+	SDL_BlitSurface(m_helico,NULL,m_ecran,&m_positionHelico);
 
 
-    if (m_tempsFire==0)
+	if (m_tempsFire==0)
-    {
+	{
-        if (m_positionHelico.x+64>m_xFire&&m_xFire>m_positionHelico.x && m_positionHelico.y+32>m_yFire&&m_yFire>m_positionHelico.y)
+		if (m_positionHelico.x+64>m_xFire&&m_xFire>m_positionHelico.x && m_positionHelico.y+32>m_yFire&&m_yFire>m_positionHelico.y)
-        {
+		{
-            switch(m_typeFire)
+			switch(m_typeFire)
-            {
+			{
-                case 0:
+				case 0:
-                    this->recevoirDegats(11);
+					this->recevoirDegats(11);
-                    break;
+					break;
-                case 1:
+				case 1:
-                    this->recevoirDegats(5);
+					this->recevoirDegats(5);
-                    break;
+					break;
-                case 2:
+				case 2:
-                    this->recevoirDegats(3);
+					this->recevoirDegats(3);
-                    break;
+					break;
-            }//Switch
+			}//Switch
-        }//Verification position
+		}//Verification position
-    }//Si tir
+	}//Si tir
 }
 }
 
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 BossOne::BossOne(SDL_Surface* ecran,Joueur* cible) : Ennemy(cible,ecran,100)
 BossOne::BossOne(SDL_Surface* ecran,Joueur* cible) : Ennemy(cible,ecran,100)
 {
 {
-    m_bossOne=SDL_LoadBMP("Images/HelicopterBossUn.bmp");
+	m_bossOne=SDL_LoadBMP("Images/HelicopterBossUn.bmp");
-    m_tir=SDL_LoadBMP("Images/HelicopterBossUnTir.bmp");
+	m_tir=SDL_LoadBMP("Images/HelicopterBossUnTir.bmp");
-    SDL_SetColorKey(m_bossOne,SDL_SRCCOLORKEY,SDL_MapRGB(m_bossOne->format,255,255,255));
+	SDL_SetColorKey(m_bossOne,SDL_SRCCOLORKEY,SDL_MapRGB(m_bossOne->format,255,255,255));
-    SDL_SetColorKey(m_tir,SDL_SRCCOLORKEY,SDL_MapRGB(m_tir->format,255,255,255));
+	SDL_SetColorKey(m_tir,SDL_SRCCOLORKEY,SDL_MapRGB(m_tir->format,255,255,255));
-    m_positionBoss.x=100;
+	m_positionBoss.x=100;
-    m_positionBoss.y=50;
+	m_positionBoss.y=50;
-    m_vaVersLeBas=true;
+	m_vaVersLeBas=true;
-    m_vaVersLaDroite=true;
+	m_vaVersLaDroite=true;
-    m_armeCycle=100;
+	m_armeCycle=100;
 }
 }
 
 
 BossOne::~BossOne()
 BossOne::~BossOne()
 {
 {
-    SDL_FreeSurface(m_bossOne);
+	SDL_FreeSurface(m_bossOne);
 }
 }
 
 
 void BossOne::afficher()
 void BossOne::afficher()
 {
 {
-    //Deplacement
+	//Deplacement
-    if (m_vaVersLeBas)
+	if (m_vaVersLeBas)
-    {
+	{
-        m_positionBoss.y++;
+		m_positionBoss.y++;
-        if (m_positionBoss.y>324)//480-76-80
+		if (m_positionBoss.y>324)//480-76-80
-        {
+		{
-            m_vaVersLeBas=false;
+			m_vaVersLeBas=false;
-        }
+		}
-    }
+	}
-    else
+	else
-    {
+	{
-        m_positionBoss.y--;
+		m_positionBoss.y--;
-        if (m_positionBoss.y<0)
+		if (m_positionBoss.y<0)
-        {
+		{
-            m_vaVersLeBas=true;
+			m_vaVersLeBas=true;
-        }
+		}
-    }
+	}
-    if (m_vaVersLaDroite)
+	if (m_vaVersLaDroite)
-    {
+	{
-        m_positionBoss.x++;
+		m_positionBoss.x++;
-        if (m_positionBoss.x>512)
+		if (m_positionBoss.x>512)
-        {
+		{
-            m_vaVersLaDroite=false;
+			m_vaVersLaDroite=false;
-        }
+		}
-    }
+	}
-    else
+	else
-    {
+	{
-        m_positionBoss.x--;
+		m_positionBoss.x--;
-        if (m_positionBoss.x<0)
+		if (m_positionBoss.x<0)
-        {
+		{
-            m_vaVersLaDroite=true;
+			m_vaVersLaDroite=true;
-        }
+		}
-    }
+	}
-    //Collage
+	//Collage
-    SDL_BlitSurface(m_bossOne,NULL,m_ecran,&m_positionBoss);
+	SDL_BlitSurface(m_bossOne,NULL,m_ecran,&m_positionBoss);
-    //Gestion des tirs du joueur
+	//Gestion des tirs du joueur
-    if (m_tempsFire==0)
+	if (m_tempsFire==0)
-    {
+	{
-        if (m_positionBoss.x+128>m_xFire&&m_xFire>m_positionBoss.x && m_positionBoss.y+80>m_yFire&&m_yFire>m_positionBoss.y)
+		if (m_positionBoss.x+128>m_xFire&&m_xFire>m_positionBoss.x && m_positionBoss.y+80>m_yFire&&m_yFire>m_positionBoss.y)
-        {
+		{
-            this->recevoirDegats(10);
+			this->recevoirDegats(10);
-        }
+		}
-    }
+	}
-    //Gestion des tirs d'helico
+	//Gestion des tirs d'helico
-    if (!takeRand(50,m_armeCycle))
+	if (!takeRand(50,m_armeCycle))
-    {
+	{
-        m_armeCycle=0;
+		m_armeCycle=0;
-        m_cible->recevoirDegats(1);
+		m_cible->recevoirDegats(1);
-    }
+	}
-    if (m_armeCycle<5)
+	if (m_armeCycle<5)
-    {
+	{
-        SDL_Rect positionTir;
+		SDL_Rect positionTir;
-        positionTir.x=m_positionBoss.x+m_bossOne->w/2-m_tir->w/2;
+		positionTir.x=m_positionBoss.x+m_bossOne->w/2-m_tir->w/2;
-        positionTir.y=m_positionBoss.y+m_bossOne->h/2-m_tir->h/2;
+		positionTir.y=m_positionBoss.y+m_bossOne->h/2-m_tir->h/2;
-        SDL_BlitSurface(m_tir,NULL,m_ecran,&positionTir);
+		SDL_BlitSurface(m_tir,NULL,m_ecran,&positionTir);
-    }
+	}
-    m_armeCycle++;
+	m_armeCycle++;
 }
 }
 
 

+ 23 - 23
Helico.h

@@ -2,8 +2,8 @@
 #define HELICO_H_INCLUDED
 #define HELICO_H_INCLUDED
 
 
 /*Description:
 /*Description:
-Ennemi standard: un petit helicopter qui se deplace à l'horizontal.
+  Ennemi standard: un petit helicopter qui se deplace à l'horizontal.
-*/
+  */
 
 
 #include <iostream>
 #include <iostream>
 #include <SDL/SDL.h>
 #include <SDL/SDL.h>
@@ -12,33 +12,33 @@ Ennemi standard: un petit helicopter qui se deplace 
 
 
 class Helico : public Ennemy
 class Helico : public Ennemy
 {
 {
-    public:
+	public:
-    Helico(SDL_Surface* ecran);//Constructeur standard
+		Helico(SDL_Surface* ecran);//Constructeur standard
-    Helico(SDL_Surface* ecran,int vie);//Constructeur vital
+		Helico(SDL_Surface* ecran,int vie);//Constructeur vital
-    Helico(SDL_Surface* ecran,int vie,int antiLatence);//Constructeur de chaîne
+		Helico(SDL_Surface* ecran,int vie,int antiLatence);//Constructeur de chaîne
-    ~Helico();
+		~Helico();
-    void afficher();
+		void afficher();
 
 
-    private:
+	private:
-    SDL_Surface* m_helico;
+		SDL_Surface* m_helico;
-    SDL_Rect m_positionHelico;
+		SDL_Rect m_positionHelico;
-    int m_vitesse;
+		int m_vitesse;
 };
 };
 
 
 class BossOne : public Ennemy
 class BossOne : public Ennemy
 {
 {
-    public:
+	public:
-    BossOne(SDL_Surface* ecran,Joueur* cible);
+		BossOne(SDL_Surface* ecran,Joueur* cible);
-    ~BossOne();
+		~BossOne();
-    void afficher();
+		void afficher();
 
 
-    private:
+	private:
-    SDL_Surface* m_bossOne;
+		SDL_Surface* m_bossOne;
-    SDL_Surface* m_tir;
+		SDL_Surface* m_tir;
-    SDL_Rect m_positionBoss;
+		SDL_Rect m_positionBoss;
-    bool m_vaVersLeBas;
+		bool m_vaVersLeBas;
-    bool m_vaVersLaDroite;
+		bool m_vaVersLaDroite;
-    int m_armeCycle;
+		int m_armeCycle;
 };
 };
 
 
 #endif // HELICO_H_INCLUDED
 #endif // HELICO_H_INCLUDED

+ 28 - 28
Icones.cpp

@@ -2,44 +2,44 @@
 
 
 Icones::Icones(int x, int y, int choixArme,std::string armeAssignee, SDL_Surface* ecran, Joueur* lanceur) : m_ecran(ecran),proprio(lanceur),m_armeAssignee(armeAssignee)
 Icones::Icones(int x, int y, int choixArme,std::string armeAssignee, SDL_Surface* ecran, Joueur* lanceur) : m_ecran(ecran),proprio(lanceur),m_armeAssignee(armeAssignee)
 {
 {
-    m_positionIcone.x=x;
+	m_positionIcone.x=x;
-    m_positionIcone.y=y;
+	m_positionIcone.y=y;
-    switch (choixArme)
+	switch (choixArme)
-    {
+	{
-        case 0:
+		case 0:
-            imageIcone=SDL_LoadBMP("IconeBaroudeur.bmp");
+			imageIcone=SDL_LoadBMP("IconeBaroudeur.bmp");
-            break;
+			break;
-        case 1:
+		case 1:
-            imageIcone=SDL_LoadBMP("IconeUsiane.bmp");
+			imageIcone=SDL_LoadBMP("IconeUsiane.bmp");
-            break;
+			break;
-        case 2:
+		case 2:
-            imageIcone=SDL_LoadBMP("IconeTriphaseur.bmp");
+			imageIcone=SDL_LoadBMP("IconeTriphaseur.bmp");
-            break;
+			break;
-    }
+	}
 
 
 }
 }
 Icones::~Icones()
 Icones::~Icones()
 {
 {
-    SDL_FreeSurface(imageIcone);
+	SDL_FreeSurface(imageIcone);
 }
 }
 
 
 void Icones::afficher()
 void Icones::afficher()
 {
 {
-    if (Cliquable::m_tempsFire==0)
+	if (Cliquable::m_tempsFire==0)
-    {
+	{
-        this->clic();
+		this->clic();
-    }
+	}
-    SDL_BlitSurface(imageIcone,0,m_ecran,&m_positionIcone);
+	SDL_BlitSurface(imageIcone,0,m_ecran,&m_positionIcone);
 }
 }
 
 
 void Icones::clic()
 void Icones::clic()
 {
 {
-    /*Teste si le click est sur l'icone, puis fait l'assignation de l'arme.*/
+	/*Teste si le click est sur l'icone, puis fait l'assignation de l'arme.*/
-    if (Cliquable::m_yFire>m_positionIcone.y&&Cliquable::m_yFire<(m_positionIcone.y+m_positionIcone.h))
+	if (Cliquable::m_yFire>m_positionIcone.y&&Cliquable::m_yFire<(m_positionIcone.y+m_positionIcone.h))
-    {
+	{
-        if (Cliquable::m_xFire>m_positionIcone.x&&Cliquable::m_xFire<(m_positionIcone.x+m_positionIcone.w))
+		if (Cliquable::m_xFire>m_positionIcone.x&&Cliquable::m_xFire<(m_positionIcone.x+m_positionIcone.w))
-        {
+		{
-            proprio->setArme(m_armeAssignee);
+			proprio->setArme(m_armeAssignee);
-        }
+		}
-    }
+	}
 }
 }

+ 14 - 14
Icones.h

@@ -2,8 +2,8 @@
 #define ICONES_H_INCLUDED
 #define ICONES_H_INCLUDED
 
 
 /*Description:
 /*Description:
-Permet de créer des icones cliquables.
+  Permet de créer des icones cliquables.
-*/
+  */
 
 
 #include <iostream>
 #include <iostream>
 #include <string>
 #include <string>
@@ -13,19 +13,19 @@ Permet de cr
 
 
 class Icones : public Cliquable
 class Icones : public Cliquable
 {
 {
-    public:
+	public:
-    Icones(int x, int y,int choixArme,std::string armeAssignee, SDL_Surface* ecran, Joueur* lanceur);
+		Icones(int x, int y,int choixArme,std::string armeAssignee, SDL_Surface* ecran, Joueur* lanceur);
-    ~Icones();
+		~Icones();
-    void afficher();//Affiche l'icone et appelle "clic" si le clic gauche vient d'être effectué
+		void afficher();//Affiche l'icone et appelle "clic" si le clic gauche vient d'être effectué
-    void clic();//Attribue l'arme associée au joueur proprio si le clic est bien sur l'icone.
+		void clic();//Attribue l'arme associée au joueur proprio si le clic est bien sur l'icone.
 
 
-    private:
+	private:
-    SDL_Surface* m_ecran;//Pour les blits
+		SDL_Surface* m_ecran;//Pour les blits
-    SDL_Surface* imageIcone;
+		SDL_Surface* imageIcone;
-    SDL_Rect m_positionIcone;
+		SDL_Rect m_positionIcone;
-    Joueur* proprio;
+		Joueur* proprio;
-    //Limite autre héritage
+		//Limite autre héritage
-    std::string m_armeAssignee;
+		std::string m_armeAssignee;
 };
 };
 
 
 
 

+ 97 - 97
Joueur.cpp

@@ -42,51 +42,51 @@ Arme::~Arme()
 
 
 void Arme::afficher(bool tir, SDL_Rect* positionViseur)//Test du tir pris en charge par le joueur proprio
 void Arme::afficher(bool tir, SDL_Rect* positionViseur)//Test du tir pris en charge par le joueur proprio
 {
 {
-    //Traitement transparence
+	//Traitement transparence
-    SDL_SetColorKey(m_viseur,SDL_SRCCOLORKEY,SDL_MapRGB(m_viseur->format,255,255,255));//On met le fond (blanc) en invisible !
+	SDL_SetColorKey(m_viseur,SDL_SRCCOLORKEY,SDL_MapRGB(m_viseur->format,255,255,255));//On met le fond (blanc) en invisible !
-    SDL_SetColorKey(m_tir,SDL_SRCCOLORKEY,SDL_MapRGB(m_tir->format,255,255,255));
+	SDL_SetColorKey(m_tir,SDL_SRCCOLORKEY,SDL_MapRGB(m_tir->format,255,255,255));
-    SDL_SetColorKey(m_impact,SDL_SRCCOLORKEY,SDL_MapRGB(m_impact->format,255,255,255));
+	SDL_SetColorKey(m_impact,SDL_SRCCOLORKEY,SDL_MapRGB(m_impact->format,255,255,255));
-    SDL_SetColorKey(m_arme,SDL_SRCCOLORKEY,SDL_MapRGB(m_arme->format,255,255,255));
+	SDL_SetColorKey(m_arme,SDL_SRCCOLORKEY,SDL_MapRGB(m_arme->format,255,255,255));
-    SDL_SetAlpha(m_viseur,SDL_SRCALPHA,128);//On met le viseur en translucide !
+	SDL_SetAlpha(m_viseur,SDL_SRCALPHA,128);//On met le viseur en translucide !
-    SDL_SetAlpha(m_impact,SDL_SRCALPHA,128);
+	SDL_SetAlpha(m_impact,SDL_SRCALPHA,128);
-    //Réglage de position
+	//Réglage de position
-    SDL_Rect positionTir;
+	SDL_Rect positionTir;
-    SDL_Rect positionBrasDroit;
+	SDL_Rect positionBrasDroit;
-    positionBrasDroit.x=430+((positionViseur->x-positionViseur->x%10)/10);//420
+	positionBrasDroit.x=430+((positionViseur->x-positionViseur->x%10)/10);//420
-    positionBrasDroit.y=265+((positionViseur->y-positionViseur->y%20)/20);//260
+	positionBrasDroit.y=265+((positionViseur->y-positionViseur->y%20)/20);//260
 	if (tir && m_munitionsRestantes>0)
 	if (tir && m_munitionsRestantes>0)
 	{
 	{
-	    //Calculs
+		//Calculs
-        SDL_Rect positionImpact;
+		SDL_Rect positionImpact;
 		positionTir.x=positionBrasDroit.x+m_xCalibreExpl;//Affichage de l'impact
 		positionTir.x=positionBrasDroit.x+m_xCalibreExpl;//Affichage de l'impact
-        positionTir.y=positionBrasDroit.y+m_yCalibreExpl;
+		positionTir.y=positionBrasDroit.y+m_yCalibreExpl;
-        positionBrasDroit.x=positionBrasDroit.x+m_recul;//Recul
+		positionBrasDroit.x=positionBrasDroit.x+m_recul;//Recul
-        positionBrasDroit.y=positionBrasDroit.y+m_recul;
+		positionBrasDroit.y=positionBrasDroit.y+m_recul;
-        positionImpact.x=positionViseur->x+16;//Centre sur le viseur
+		positionImpact.x=positionViseur->x+16;//Centre sur le viseur
-        positionImpact.y=positionViseur->y+16;
+		positionImpact.y=positionViseur->y+16;
-        //Affichage de tir
+		//Affichage de tir
-        SDL_BlitSurface(m_impact,0,m_ecran,&positionImpact);
+		SDL_BlitSurface(m_impact,0,m_ecran,&positionImpact);
-        SDL_BlitSurface(m_tir,0,m_ecran,&positionTir);//Collage tir
+		SDL_BlitSurface(m_tir,0,m_ecran,&positionTir);//Collage tir
 	}
 	}
-    //Affichage défaut
+	//Affichage défaut
-    SDL_BlitSurface(m_arme,0,m_ecran,&positionBrasDroit);
+	SDL_BlitSurface(m_arme,0,m_ecran,&positionBrasDroit);
-    SDL_BlitSurface(m_viseur,0,m_ecran,positionViseur);
+	SDL_BlitSurface(m_viseur,0,m_ecran,positionViseur);
 }
 }
 
 
 void Arme::tir()
 void Arme::tir()
 {
 {
-    //Retrait de muntion
+	//Retrait de muntion
-    m_munitionsRestantes--;
+	m_munitionsRestantes--;
 }
 }
 
 
 unsigned int Arme::getTypeWeapon()
 unsigned int Arme::getTypeWeapon()
 {
 {
-    return m_IDarme;
+	return m_IDarme;
 }
 }
 
 
 /*void Arme::recharger
 /*void Arme::recharger
-{
+  {
-	//Pleins de trucs interessants...
+//Pleins de trucs interessants...
 }*/
 }*/
 
 
 
 
@@ -97,105 +97,105 @@ unsigned int Arme::getTypeWeapon()
 
 
 Joueur::Joueur(SDL_Surface* ecran):m_ecran(ecran),m_armeCycle(0),m_tirInstant(false)
 Joueur::Joueur(SDL_Surface* ecran):m_ecran(ecran),m_armeCycle(0),m_tirInstant(false)
 {
 {
-    m_armeOne=new Arme(ecran,0,80,85,5);
+	m_armeOne=new Arme(ecran,0,80,85,5);
-    m_armeTwo=new Arme(ecran,1,50,60,2);
+	m_armeTwo=new Arme(ecran,1,50,60,2);
-    m_armeThree=new Arme(ecran,2,70,60,0);
+	m_armeThree=new Arme(ecran,2,70,60,0);
-
+
-    m_interVie=SDL_LoadBMP("Images/InterVie.bmp");
+	m_interVie=SDL_LoadBMP("Images/InterVie.bmp");
-    m_positionInterVie.x=420;
+	m_positionInterVie.x=420;
-    m_positionInterVie.y=403;
+	m_positionInterVie.y=403;
-    for (int i(0);i<60;i++)
+	for (int i(0);i<60;i++)
-    {
+	{
-        m_jaugeVie[i]=SDL_CreateRGBSurface(SDL_HWSURFACE,29,1,32,0,0,0,0);
+		m_jaugeVie[i]=SDL_CreateRGBSurface(SDL_HWSURFACE,29,1,32,0,0,0,0);
-        SDL_FillRect(m_jaugeVie[i],NULL,SDL_MapRGB(m_ecran->format,255,255-2*i,0));
+		SDL_FillRect(m_jaugeVie[i],NULL,SDL_MapRGB(m_ecran->format,255,255-2*i,0));
-    }
+	}
-    m_variableVie=60;
+	m_variableVie=60;
 }
 }
 
 
 Joueur::~Joueur()//Destructeur
 Joueur::~Joueur()//Destructeur
 {
 {
-    delete(m_armeOne);
+	delete(m_armeOne);
-    delete(m_armeTwo);
+	delete(m_armeTwo);
-    delete(m_armeThree);
+	delete(m_armeThree);
-    SDL_FreeSurface(m_interVie);
+	SDL_FreeSurface(m_interVie);
 }
 }
 
 
 void Joueur::afficher()
 void Joueur::afficher()
 {
 {
 
 
-    if (m_armeCycle<4)//Si un tir vient d'être effectué
+	if (m_armeCycle<4)//Si un tir vient d'être effectué
-    {
+	{
-        m_tirInstant=true;
+		m_tirInstant=true;
-    }
+	}
-    else
+	else
-    {
+	{
-        m_tirInstant=false;
+		m_tirInstant=false;
-    }
+	}
-    m_armeCycle++;
+	m_armeCycle++;
-    SDL_BlitSurface(m_interVie,0,m_ecran,&m_positionInterVie);
+	SDL_BlitSurface(m_interVie,0,m_ecran,&m_positionInterVie);
-
+
-    SDL_Rect positionJaugeVie;
+	SDL_Rect positionJaugeVie;
-    positionJaugeVie.x=429;//420+9
+	positionJaugeVie.x=429;//420+9
-    positionJaugeVie.y=412;//403+9
+	positionJaugeVie.y=412;//403+9
-    for (int i(0); i<m_variableVie; i++)
+	for (int i(0); i<m_variableVie; i++)
-    {
+	{
-            positionJaugeVie.y=472-i;//412+60
+		positionJaugeVie.y=472-i;//412+60
-            SDL_BlitSurface(m_jaugeVie[i],NULL,m_ecran,&positionJaugeVie);
+		SDL_BlitSurface(m_jaugeVie[i],NULL,m_ecran,&positionJaugeVie);
-    }
+	}
-    m_armeSelect->afficher(m_tirInstant,&m_positionViseur);
+	m_armeSelect->afficher(m_tirInstant,&m_positionViseur);
 }
 }
 
 
 void Joueur::setArme(std::string choixArme)
 void Joueur::setArme(std::string choixArme)
 {
 {
-    if (choixArme=="Baroudeur")
+	if (choixArme=="Baroudeur")
-    {
+	{
-        m_armeSelect=m_armeOne;
+		m_armeSelect=m_armeOne;
-    }
+	}
-    else if (choixArme=="Usiane")
+	else if (choixArme=="Usiane")
-    {
+	{
-        m_armeSelect=m_armeTwo;
+		m_armeSelect=m_armeTwo;
-    }
+	}
-    else if (choixArme=="Triphaseur")
+	else if (choixArme=="Triphaseur")
-    {
+	{
-        m_armeSelect=m_armeThree;
+		m_armeSelect=m_armeThree;
-    }
+	}
 }
 }
 
 
 void Joueur::giveMousePosition(int x, int y)
 void Joueur::giveMousePosition(int x, int y)
 {
 {
-    m_positionViseur.x=x-32;
+	m_positionViseur.x=x-32;
-    m_positionViseur.y=y-32;
+	m_positionViseur.y=y-32;
 }
 }
 
 
 void Joueur::tir()
 void Joueur::tir()
 {
 {
-    m_armeCycle=0;
+	m_armeCycle=0;
-    m_armeSelect->tir();
+	m_armeSelect->tir();
 }
 }
 
 
 void Joueur::recevoirDegats(int degats)
 void Joueur::recevoirDegats(int degats)
 {
 {
-    m_variableVie=m_variableVie-degats;
+	m_variableVie=m_variableVie-degats;
-    if (m_variableVie<0)
+	if (m_variableVie<0)
-    {
+	{
-        m_variableVie=0;
+		m_variableVie=0;
-    }
+	}
 }
 }
 
 
 bool Joueur::estVivant()
 bool Joueur::estVivant()
 {
 {
-    if (m_variableVie>0)
+	if (m_variableVie>0)
-    {
+	{
-        return true;
+		return true;
-    }
+	}
-    else
+	else
-    {
+	{
-        return false;
+		return false;
-    }
+	}
 }
 }
 
 
 unsigned int Joueur::getTypeWeapon()
 unsigned int Joueur::getTypeWeapon()
 {
 {
-    return m_armeSelect->getTypeWeapon();
+	return m_armeSelect->getTypeWeapon();
 }
 }
 
 

+ 46 - 46
Joueur.h

@@ -3,7 +3,7 @@
 
 
 //Notes temporaires: La gérance du clic d'icone se fera par le joueur.
 //Notes temporaires: La gérance du clic d'icone se fera par le joueur.
 /*La classe arme permet de gerer tous
 /*La classe arme permet de gerer tous
-les attributs de l'arme, y compris le viseur associé.*/
+  les attributs de l'arme, y compris le viseur associé.*/
 
 
 #include <iostream>
 #include <iostream>
 #include <SDL/SDL.h>
 #include <SDL/SDL.h>
@@ -12,61 +12,61 @@ les attributs de l'arme, y compris le viseur associ
 class Arme
 class Arme
 {
 {
 	public:
 	public:
-	Arme(SDL_Surface* ecran,unsigned int IDarme,int xCalibreExpl, int yCalibreExpl, int recul);
+		Arme(SDL_Surface* ecran,unsigned int IDarme,int xCalibreExpl, int yCalibreExpl, int recul);
-	~Arme();
+		~Arme();
-	void afficher(bool tir, SDL_Rect* positionViseur);
+		void afficher(bool tir, SDL_Rect* positionViseur);
-	void tir();
+		void tir();
-    unsigned int getTypeWeapon();
+		unsigned int getTypeWeapon();
-	//void recharger();
+		//void recharger();
 
 
 	protected:
 	protected:
-	SDL_Surface* m_ecran;//Pour blits
+		SDL_Surface* m_ecran;//Pour blits
-	const int m_IDarme;//Permet d'ajuster la position de l'icone, et determinant facilement l'arme. Note:0=Baroudeur, 1=Usiane, 2=TriPhaseur
+		const int m_IDarme;//Permet d'ajuster la position de l'icone, et determinant facilement l'arme. Note:0=Baroudeur, 1=Usiane, 2=TriPhaseur
-    SDL_Surface* m_arme;//Image de l'arme
+		SDL_Surface* m_arme;//Image de l'arme
-    SDL_Surface* m_viseur;//Image du viseur
+		SDL_Surface* m_viseur;//Image du viseur
-    SDL_Surface* m_tir;//Image de l'explosion lors du tir
+		SDL_Surface* m_tir;//Image de l'explosion lors du tir
-    SDL_Surface* m_impact;//Image de l'impact
+		SDL_Surface* m_impact;//Image de l'impact
-    const int m_recul;
+		const int m_recul;
-	const int m_xCalibreExpl;
+		const int m_xCalibreExpl;
-	const int m_yCalibreExpl;
+		const int m_yCalibreExpl;
 
 
-    int m_munitionsRestantes;
+		int m_munitionsRestantes;
-	//int m_tempsRecharge const;//Afaire
+		//int m_tempsRecharge const;//Afaire
-	//int m_ResteTempsRecharge;//Afaire
+		//int m_ResteTempsRecharge;//Afaire
 };
 };
 
 
 /*Description:
 /*Description:
-Permet de creer l'interface du joueur.
+  Permet de creer l'interface du joueur.
-*/
+  */
 
 
 class Joueur
 class Joueur
 {
 {
-    public:
+	public:
-    Joueur(SDL_Surface* ecran);
+		Joueur(SDL_Surface* ecran);
-    ~Joueur();
+		~Joueur();
-    void afficher();
+		void afficher();
-    void setArme(std::string choixArme);
+		void setArme(std::string choixArme);
-    void giveMousePosition(int x,int y);
+		void giveMousePosition(int x,int y);
-    void tir();
+		void tir();
-    void recevoirDegats(int degats);
+		void recevoirDegats(int degats);
-    bool estVivant();
+		bool estVivant();
-    unsigned int getTypeWeapon();
+		unsigned int getTypeWeapon();
 
 
-    protected:
+	protected:
-    //Ecran en attribut pour les blits
+		//Ecran en attribut pour les blits
-    SDL_Surface* m_ecran;
+		SDL_Surface* m_ecran;
-    //Nombre de boucles depuis le début du programme
+		//Nombre de boucles depuis le début du programme
-    int m_armeCycle;
+		int m_armeCycle;
-    int m_variableVie;
+		int m_variableVie;
-    SDL_Rect m_positionViseur;
+		SDL_Rect m_positionViseur;
-    SDL_Rect m_positionInterVie;
+		SDL_Rect m_positionInterVie;
-    SDL_Surface* m_interVie;
+		SDL_Surface* m_interVie;
-    SDL_Surface* m_jaugeVie[60];
+		SDL_Surface* m_jaugeVie[60];
-    bool m_tirInstant;
+		bool m_tirInstant;
-    Arme* m_armeSelect;
+		Arme* m_armeSelect;
-    Arme* m_armeOne;
+		Arme* m_armeOne;
-    Arme* m_armeTwo;
+		Arme* m_armeTwo;
-    Arme* m_armeThree;
+		Arme* m_armeThree;
 };
 };
 
 
 #endif // ARME_H_INCLUDED
 #endif // ARME_H_INCLUDED

+ 116 - 116
eventLoop.cpp

@@ -2,132 +2,132 @@
 
 
 int eventLoop(SDL_Surface* ecran)
 int eventLoop(SDL_Surface* ecran)
 {
 {
-    int check(0);//Variable d'erreur; 0=Ok, -1=probleme
+	int check(0);//Variable d'erreur; 0=Ok, -1=probleme
-    // Charges des images
+	// Charges des images
-    SDL_Surface* mort = SDL_LoadBMP("Images/GameOver.bmp");
+	SDL_Surface* mort = SDL_LoadBMP("Images/GameOver.bmp");
-    SDL_SetColorKey(mort,SDL_SRCCOLORKEY,SDL_MapRGB(mort->format,0,255,255));
+	SDL_SetColorKey(mort,SDL_SRCCOLORKEY,SDL_MapRGB(mort->format,0,255,255));
 
 
-    Joueur joueur(ecran);
+	Joueur joueur(ecran);
-    joueur.setArme("Baroudeur");
+	joueur.setArme("Baroudeur");
-    Bouton iconeOne(0,0,0,"Baroudeur", ecran, &joueur);//Précédent 0/404
+	Bouton iconeOne(0,0,0,"Baroudeur", ecran, &joueur);//Précédent 0/404
-    Bouton iconeTwo(0,76,1,"Usiane", ecran, &joueur);//Précédent 140/404
+	Bouton iconeTwo(0,76,1,"Usiane", ecran, &joueur);//Précédent 140/404
-    Bouton iconeThree(0,152,2,"Triphaseur", ecran, &joueur);//Précédent 280/404
+	Bouton iconeThree(0,152,2,"Triphaseur", ecran, &joueur);//Précédent 280/404
-    ChampDeBataille arena(&joueur,ecran,10);
+	ChampDeBataille arena(&joueur,ecran,10);
 
 
-    if (!mort)//Recherche d'erreurs
+	if (!mort)//Recherche d'erreurs
-    {
+	{
-        printf("Unable to load bitmap: %s\n", SDL_GetError());
+		printf("Unable to load bitmap: %s\n", SDL_GetError());
-        check=-1;
+		check=-1;
-        return check;
+		return check;
-    }
+	}
 
 
-    // Coordonnées des surfaces
+	// Coordonnées des surfaces
-    SDL_Rect position;
+	SDL_Rect position;
-    position.x = 0;
+	position.x = 0;
-    position.y = 0;
+	position.y = 0;
-    //Mise au point du tir sans répétition due à la mémoire de l'evenement.
+	//Mise au point du tir sans répétition due à la mémoire de l'evenement.
-    bool latence(true);
+	bool latence(true);
-    // program main loop
+	// program main loop
-    bool done = false;
+	bool done = false;
-    SDL_ShowCursor(SDL_DISABLE);
+	SDL_ShowCursor(SDL_DISABLE);
-    //Gérance du temps
+	//Gérance du temps
-    int tempsPrecedent(0);
+	int tempsPrecedent(0);
-    int tempsActuel(0);
+	int tempsActuel(0);
-    while (!done && optionsFire::continuer)
+	while (!done && optionsFire::continuer)
-    {
+	{
-            // message processing loop
+		// message processing loop
-        SDL_Event event;
+		SDL_Event event;
-        SDL_PollEvent(&event);
+		SDL_PollEvent(&event);
-            // activation du fps (fréquence à 50Hz)
+		// activation du fps (fréquence à 50Hz)
-        tempsActuel=SDL_GetTicks();
+		tempsActuel=SDL_GetTicks();
-        if (tempsActuel-tempsPrecedent>20)
+		if (tempsActuel-tempsPrecedent>20)
-        {//Fps
+		{//Fps
 
 
-            // check for messages
+			// check for messages
-        switch (event.type)
+			switch (event.type)
-        {
+			{
-            // exit if the window is closed
+				// exit if the window is closed
-        case SDL_QUIT:
+				case SDL_QUIT:
-            optionsFire::continuer=false;
+					optionsFire::continuer=false;
-            done = true;
+					done = true;
-            break;
+					break;
-        case SDL_KEYDOWN:
+				case SDL_KEYDOWN:
-            switch(event.key.keysym.sym)
+					switch(event.key.keysym.sym)
-            {
+					{
-            case SDLK_ESCAPE:
+						case SDLK_ESCAPE:
-                done = true;
+							done = true;
-                break;
+							break;
-            case SDLK_b:
+						case SDLK_b:
-                joueur.setArme("Baroudeur");
+							joueur.setArme("Baroudeur");
-                break;
+							break;
-            case SDLK_u:
+						case SDLK_u:
-                joueur.setArme("Usiane");
+							joueur.setArme("Usiane");
-                break;
+							break;
-            case SDLK_t:
+						case SDLK_t:
-                joueur.setArme("Triphaseur");
+							joueur.setArme("Triphaseur");
-                break;
+							break;
-            }
+					}
-            break;
+					break;
-        case SDL_MOUSEMOTION:
+				case SDL_MOUSEMOTION:
-            joueur.giveMousePosition(event.motion.x,event.motion.y);
+					joueur.giveMousePosition(event.motion.x,event.motion.y);
-            break;
+					break;
-        case SDL_MOUSEBUTTONDOWN:
+				case SDL_MOUSEBUTTONDOWN:
-            switch (event.button.button)
+					switch (event.button.button)
-                {
+					{
-                case SDL_BUTTON_LEFT:
+						case SDL_BUTTON_LEFT:
-                    if(latence==true)
+							if(latence==true)
-                    {
+							{
-                        Cliquable::getFire(event.button.x,event.button.y,joueur.getTypeWeapon());
+								Cliquable::getFire(event.button.x,event.button.y,joueur.getTypeWeapon());
-                        joueur.tir();
+								joueur.tir();
-                    }
+							}
-                    latence=false;//Empeche de tirer en continu.
+							latence=false;//Empeche de tirer en continu.
-                    break;
+							break;
-                }//SDL_MOUSEBUTTONDOWN
+					}//SDL_MOUSEBUTTONDOWN
-            break;
+					break;
-        case SDL_MOUSEBUTTONUP:
+				case SDL_MOUSEBUTTONUP:
-            switch (event.button.button)
+					switch (event.button.button)
-                {
+					{
-                case SDL_BUTTON_LEFT:
+						case SDL_BUTTON_LEFT:
-                    latence=true;
+							latence=true;
-                    break;
+							break;
-                }
+					}
 
 
 
 
-        } //EVENT end switch event loop
+			} //EVENT end switch event loop
-        // DRAWING STARTS HERE
+			// DRAWING STARTS HERE
 
 
-        // clear screen
+			// clear screen
-        SDL_FillRect(ecran, 0, SDL_MapRGB(ecran->format, 0, 0, 0));
+			SDL_FillRect(ecran, 0, SDL_MapRGB(ecran->format, 0, 0, 0));
-        // draw bitmap
+			// draw bitmap
-        SDL_BlitSurface(optionsFire::level, 0, ecran, &position);
+			SDL_BlitSurface(optionsFire::level, 0, ecran, &position);
 
 
-            //Gestion du temps
+			//Gestion du temps
-            tempsActuel=tempsPrecedent;
+			tempsActuel=tempsPrecedent;
-            if (joueur.estVivant())
+			if (joueur.estVivant())
-            {
+			{
-                iconeOne.afficher();
+				iconeOne.afficher();
-                iconeTwo.afficher();
+				iconeTwo.afficher();
-                iconeThree.afficher();
+				iconeThree.afficher();
-                arena.afficher();
+				arena.afficher();
-                joueur.afficher();
+				joueur.afficher();
-            }
+			}
-            else
+			else
-            {
+			{
-                SDL_BlitSurface(mort, 0, ecran, &position);
+				SDL_BlitSurface(mort, 0, ecran, &position);
-                SDL_ShowCursor(SDL_ENABLE);
+				SDL_ShowCursor(SDL_ENABLE);
-            }
+			}
-            // DRAWING ENDS HERE
+			// DRAWING ENDS HERE
-            Cliquable::upFire();
+			Cliquable::upFire();
-        }//End fps
+		}//End fps
 
 
-        // finally, update the screen :)
+		// finally, update the screen :)
-        SDL_Flip(ecran);
+		SDL_Flip(ecran);
-    } //MAIN end main loop
+	} //MAIN end main loop
 
 
 
 
-    // free loaded bitmap
+	// free loaded bitmap
-    SDL_FreeSurface(optionsFire::level);//Fond
+	SDL_FreeSurface(optionsFire::level);//Fond
-    optionsFire::level=0;//On pointe le pointeur sur lui, pour la securité
+	optionsFire::level=0;//On pointe le pointeur sur lui, pour la securité
 
 
-    return check;
+	return check;
 }
 }

+ 2 - 2
eventLoop.h

@@ -2,8 +2,8 @@
 #define EVENTLOOP_H_INCLUDED
 #define EVENTLOOP_H_INCLUDED
 
 
 /*Description:
 /*Description:
-Cette boucle evenemntielle contient le jeu en lui même.
+  Cette boucle evenemntielle contient le jeu en lui même.
-*/
+  */
 
 
 #include <iostream>
 #include <iostream>
 #include <SDL/SDL.h>
 #include <SDL/SDL.h>

+ 24 - 24
main.cpp

@@ -31,28 +31,28 @@ int main ( int argc, char** argv )
     }
     }
     else
     else
     {
     {
-        screen = SDL_SetVideoMode(640, 480, 32,SDL_HWSURFACE|SDL_DOUBLEBUF);//Création de la fenêtre
+		screen = SDL_SetVideoMode(640, 480, 32,SDL_HWSURFACE|SDL_DOUBLEBUF);//Création de la fenêtre
-    }
+	}
-
+
-    SDL_WM_SetCaption("Fire !!!",NULL);//Nom de la fenêtre
+	SDL_WM_SetCaption("Fire !!!",NULL);//Nom de la fenêtre
-    if ( !screen )
+	if ( !screen )
-    {
+	{
-        printf("Unable to set 640x480 video: %s\n", SDL_GetError());
+		printf("Unable to set 640x480 video: %s\n", SDL_GetError());
-        error=1;
+		error=1;
-    }
+	}
-
+
-    if (!error)
+	if (!error)
-    {
+	{
-        eventLoop(screen);
+		eventLoop(screen);
-    }
+	}
-    else if(error==2)
+	else if(error==2)
-    {
+	{
-        error=0;
+		error=0;
-    }
+	}
-
+
-/* */}
+	/* */}
-
+
-    // all is well ;)
+	// all is well ;)
-    printf("Exited cleanly\n");
+	printf("Exited cleanly\n");
-    return error;
+	return error;
 }
 }

+ 137 - 137
menuFire.cpp

@@ -6,142 +6,142 @@ SDL_Surface* optionsFire::level=0;
 
 
 int menuFire()
 int menuFire()
 {
 {
-    if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
+	if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
-    {
+	{
-        printf( "Unable to init SDL: %s\n", SDL_GetError() );
+		printf( "Unable to init SDL: %s\n", SDL_GetError() );
-        return 1;
+		return 1;
-    }
+	}
-
+
-    // Lorsque le programme ferme, la SDL se ferme automatiquement.
+	// Lorsque le programme ferme, la SDL se ferme automatiquement.
-    atexit(SDL_Quit);
+	atexit(SDL_Quit);
-
+
-    // create a new window
+	// create a new window
-    SDL_WM_SetIcon(SDL_LoadBMP("Images/Icone Prog D.bmp"),NULL);//Icone en haut à droite de la fenêtre.
+	SDL_WM_SetIcon(SDL_LoadBMP("Images/Icone Prog D.bmp"),NULL);//Icone en haut à droite de la fenêtre.
-    SDL_Surface* ecran = SDL_SetVideoMode(640, 480, 16,SDL_HWSURFACE|SDL_DOUBLEBUF);//Création de la fenêtre
+	SDL_Surface* ecran = SDL_SetVideoMode(640, 480, 16,SDL_HWSURFACE|SDL_DOUBLEBUF);//Création de la fenêtre
-    SDL_WM_SetCaption("Fire !!!",NULL);//Nom de la fenêtre
+	SDL_WM_SetCaption("Fire !!!",NULL);//Nom de la fenêtre
-    if ( !ecran )
+	if ( !ecran )
-    {
+	{
-        printf("Unable to set 640x480 video: %s\n", SDL_GetError());
+		printf("Unable to set 640x480 video: %s\n", SDL_GetError());
-        return 1;
+		return 1;
-    }
+	}
-
+
-    int quit(0);
+	int quit(0);
-    SDL_ShowCursor(SDL_ENABLE);
+	SDL_ShowCursor(SDL_ENABLE);
-    //EVENT LOOP***********************************
+	//EVENT LOOP***********************************
-    SDL_Surface* bmp = SDL_LoadBMP("Images/Hiver.bmp");
+	SDL_Surface* bmp = SDL_LoadBMP("Images/Hiver.bmp");
-    SDL_Surface* bmpDeux = SDL_LoadBMP("Images/Collines.bmp");
+	SDL_Surface* bmpDeux = SDL_LoadBMP("Images/Collines.bmp");
-    SDL_Surface* bmpTrois = SDL_LoadBMP("Images/Soleil.bmp");
+	SDL_Surface* bmpTrois = SDL_LoadBMP("Images/Soleil.bmp");
-    SDL_Surface* bmpSelect = bmp;//Choix par defaut
+	SDL_Surface* bmpSelect = bmp;//Choix par defaut
-    int choice(0);
+	int choice(0);
-    SDL_Surface* indication = SDL_LoadBMP("Images/MenuFire.bmp");
+	SDL_Surface* indication = SDL_LoadBMP("Images/MenuFire.bmp");
-    SDL_SetColorKey(indication,SDL_SRCCOLORKEY,SDL_MapRGB(indication->format,255,255,255));
+	SDL_SetColorKey(indication,SDL_SRCCOLORKEY,SDL_MapRGB(indication->format,255,255,255));
-    if (!bmp)//Recherche d'erreurs
+	if (!bmp)//Recherche d'erreurs
-    {
+	{
-        printf("Unable to load bitmap: %s\n", SDL_GetError());
+		printf("Unable to load bitmap: %s\n", SDL_GetError());
-        return 1;
+		return 1;
-    }
+	}
-
+
-    // Coordonnées des surfaces
+	// Coordonnées des surfaces
-    SDL_Rect position;  SDL_Rect positionIndication;
+	SDL_Rect position;  SDL_Rect positionIndication;
-    position.x = 0;     positionIndication.x = 160;
+	position.x = 0;     positionIndication.x = 160;
-    position.y = 0;     positionIndication.y = 120;
+	position.y = 0;     positionIndication.y = 120;
-
+
-    bool done = false;
+	bool done = false;
-    while (!done)
+	while (!done)
-    {
+	{
-        // message processing loop
+		// message processing loop
-        SDL_Event event;
+		SDL_Event event;
-        SDL_WaitEvent(&event);
+		SDL_WaitEvent(&event);
-            // check for messages
+		// check for messages
-        switch (event.type)
+		switch (event.type)
-        {
+		{
-            // exit if the window is closed
+			// exit if the window is closed
-        case SDL_QUIT:
+			case SDL_QUIT:
-            optionsFire::continuer=false;
+				optionsFire::continuer=false;
-            done = true;
+				done = true;
-            quit = 2;//Signifie que le joueur quitte pour de bon.
+				quit = 2;//Signifie que le joueur quitte pour de bon.
-            break;
+				break;
-
+
-            // check for keypresses
+				// check for keypresses
-        case SDL_KEYDOWN:
+			case SDL_KEYDOWN:
-            switch(event.key.keysym.sym)
+				switch(event.key.keysym.sym)
-            {
+				{
-                case SDLK_ESCAPE://Touche Echape
+					case SDLK_ESCAPE://Touche Echape
-                    done = true;
+						done = true;
-                    break;
+						break;
-                case SDLK_LEFT://Petit ecran
+					case SDLK_LEFT://Petit ecran
-                    optionsFire::pleinEcran=false;
+						optionsFire::pleinEcran=false;
-                    break;
+						break;
-                case SDLK_RIGHT://Plein ecran
+					case SDLK_RIGHT://Plein ecran
-                    optionsFire::pleinEcran=true;
+						optionsFire::pleinEcran=true;
-                    break;
+						break;
-                case SDLK_UP://Monte le niveau de difficulté
+					case SDLK_UP://Monte le niveau de difficulté
-                    if (choice<2)
+						if (choice<2)
-                    {
+						{
-                        choice++;
+							choice++;
-                    }
+						}
-
+
-                    break;
+						break;
-                case SDLK_DOWN://Baisse le niveau de difficulte
+					case SDLK_DOWN://Baisse le niveau de difficulte
-                    if (choice>0)
+						if (choice>0)
-                    {
+						{
-                        choice--;
+							choice--;
-                    }
+						}
-
+
-                    break;
+						break;
-            }
+				}
-            break;
+				break;
-        } // end switch
+		} // end switch
-        // CALCULING STARTS HERE
+		// CALCULING STARTS HERE
-        switch(choice)
+		switch(choice)
-        {
+		{
-            case 0:
+			case 0:
-                bmpSelect=bmp;
+				bmpSelect=bmp;
-                break;
+				break;
-            case 1:
+			case 1:
-                bmpSelect=bmpDeux;
+				bmpSelect=bmpDeux;
-                break;
+				break;
-            case 2:
+			case 2:
-                bmpSelect=bmpTrois;
+				bmpSelect=bmpTrois;
-                break;
+				break;
-        }
+		}
-        // DRAWING STARTS HERE
+		// DRAWING STARTS HERE
-
+
-        // clear screen
+		// clear screen
-        SDL_FillRect(ecran, 0, SDL_MapRGB(ecran->format, 0, 0, 0));
+		SDL_FillRect(ecran, 0, SDL_MapRGB(ecran->format, 0, 0, 0));
-
+
-        // draw bitmap
+		// draw bitmap
-        SDL_BlitSurface(bmpSelect, 0, ecran, &position);
+		SDL_BlitSurface(bmpSelect, 0, ecran, &position);
-        SDL_BlitSurface(indication, 0, ecran, &positionIndication);
+		SDL_BlitSurface(indication, 0, ecran, &positionIndication);
-
+
-        // DRAWING ENDS HERE
+		// DRAWING ENDS HERE
-
+
-        // finally, update the screen :)
+		// finally, update the screen :)
-        SDL_Flip(ecran);
+		SDL_Flip(ecran);
-    } // end main loop
+	} // end main loop
-    //Attribution des options
+	//Attribution des options
-    optionsFire::level=bmpSelect;
+	optionsFire::level=bmpSelect;
-    optionsFire::difficulte=choice;
+	optionsFire::difficulte=choice;
-
+
-    // free loaded bitmap
+	// free loaded bitmap
-    if (!(bmpSelect==bmp))
+	if (!(bmpSelect==bmp))
-    {
+	{
-        SDL_FreeSurface(bmp);
+		SDL_FreeSurface(bmp);
-    }
+	}
-    else if(!(bmpSelect==bmpDeux))
+	else if(!(bmpSelect==bmpDeux))
-    {
+	{
-        SDL_FreeSurface(bmpDeux);
+		SDL_FreeSurface(bmpDeux);
-    }
+	}
-    else if (!(bmpSelect==bmpTrois))
+	else if (!(bmpSelect==bmpTrois))
-    {
+	{
-        SDL_FreeSurface(bmpTrois);
+		SDL_FreeSurface(bmpTrois);
-    }
+	}
-    SDL_FreeSurface(indication);
+	SDL_FreeSurface(indication);
-    //END EVENT LOOP*******************************
+	//END EVENT LOOP*******************************
-
+
-    // all is well ;)
+	// all is well ;)
-    printf("Exited cleanly\n");
+	printf("Exited cleanly\n");
-
+
-    return quit;
+	return quit;
 }
 }
 
 

+ 5 - 5
menuFire.h

@@ -6,11 +6,11 @@
 
 
 class optionsFire
 class optionsFire
 {
 {
-    public:
+	public:
-    static bool continuer;
+		static bool continuer;
-    static unsigned int difficulte;
+		static unsigned int difficulte;
-    static bool pleinEcran;
+		static bool pleinEcran;
-    static SDL_Surface* level;
+		static SDL_Surface* level;
 };
 };
 
 
 int menuFire();
 int menuFire();

+ 12 - 12
takeRand.cpp

@@ -2,27 +2,27 @@
 
 
 int takeRand(int maxiNb)
 int takeRand(int maxiNb)
 {
 {
-    int nombreHasard(0);
+	int nombreHasard(0);
-    srand(time(0));
+	srand(time(0));
-    nombreHasard = rand() % maxiNb;
+	nombreHasard = rand() % maxiNb;
 
 
-    return nombreHasard;
+	return nombreHasard;
 }
 }
 
 
 int takeRand(int maxiNb,int antiLatence)
 int takeRand(int maxiNb,int antiLatence)
 {
 {
-    int nombreHasard(0);
+	int nombreHasard(0);
-    srand(time(0)+antiLatence*antiLatence);
+	srand(time(0)+antiLatence*antiLatence);
-    nombreHasard = rand() % maxiNb;
+	nombreHasard = rand() % maxiNb;
 
 
-    return nombreHasard;
+	return nombreHasard;
 }
 }
 
 
 int takeRand(int maxiNb,Uint32 noLatence)
 int takeRand(int maxiNb,Uint32 noLatence)
 {
 {
-    int nombreHasard(0);
+	int nombreHasard(0);
-    srand(time(0)+noLatence);
+	srand(time(0)+noLatence);
-    nombreHasard = rand() % maxiNb;
+	nombreHasard = rand() % maxiNb;
 
 
-    return nombreHasard;
+	return nombreHasard;
 }
 }

+ 2 - 2
takeRand.h

@@ -2,8 +2,8 @@
 #define TAKERAND_H_INCLUDED
 #define TAKERAND_H_INCLUDED
 
 
 /*Description:
 /*Description:
-Permet d'obtenir un entier au hasard.
+  Permet d'obtenir un entier au hasard.
-*/
+  */
 
 
 #include<iostream>
 #include<iostream>
 #include<ctime>
 #include<ctime>