From d081178bd2c2f55f749576c27e9a1ae78e331789 Mon Sep 17 00:00:00 2001 From: Fife Date: Sat, 30 Apr 2016 14:07:43 +0200 Subject: [PATCH] First commit --- BoatControl.cpp | 154 +++++++++++ BoatControl.hpp | 74 ++++++ BoatControlPerso.cpp | 184 ++++++++++++++ BoatControlPerso.hpp | 19 ++ BoatControlPirate.cpp | 165 ++++++++++++ BoatControlPirate.hpp | 19 ++ EngineGUI.cpp | 115 +++++++++ EngineGUI.hpp | 20 ++ Marine.cpp | 576 ++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 1326 insertions(+) create mode 100644 BoatControl.cpp create mode 100644 BoatControl.hpp create mode 100644 BoatControlPerso.cpp create mode 100644 BoatControlPerso.hpp create mode 100644 BoatControlPirate.cpp create mode 100644 BoatControlPirate.hpp create mode 100644 EngineGUI.cpp create mode 100644 EngineGUI.hpp create mode 100644 Marine.cpp diff --git a/BoatControl.cpp b/BoatControl.cpp new file mode 100644 index 0000000..e92f274 --- /dev/null +++ b/BoatControl.cpp @@ -0,0 +1,154 @@ +#include "..\C-Engine\CHeader.hpp" + +#include"BoatControl.hpp" + +extern "C" +{ +#include +} + + +void BoatControl::StartBoat() +{ + direction = 180; // Direction des bateaux au départ +} + +void BoatControl::UpdateBoat() +{ + if(BateauActuelle->VoilesLateralle.Pourcentage < 0)BateauActuelle->VoilesLateralle.Pourcentage = 0; // Pourcentage des voiles + if(BateauActuelle->VoilesLateralle.Pourcentage > 100)BateauActuelle->VoilesLateralle.Pourcentage = 100; + + if(BateauActuelle->VoilesLongitudinal.Pourcentage < 0)BateauActuelle->VoilesLongitudinal.Pourcentage = 0; + if(BateauActuelle->VoilesLongitudinal.Pourcentage > 100)BateauActuelle->VoilesLongitudinal.Pourcentage = 100; + + if(BateauActuelle->CanonDroit.couldown > 0)BateauActuelle->CanonDroit.couldown = BateauActuelle->CanonDroit.couldown - 4; // Diminution du couldown pour les canons. + if(BateauActuelle->CanonGauche.couldown > 0)BateauActuelle->CanonGauche.couldown = BateauActuelle->CanonGauche.couldown - 4; + + float anglelong , anglelat; + float priseventlong; + float priseventlat; + float forceventapplique , forceapplique; + float forceappliquex , forceappliquey; + + GetObject()->ORender->SetDirection(direction - 90); //Set de la direction pour l'affichage + + anglelong = direction + 135; if(anglelong < 0)anglelong += 360; if(anglelong > 360) anglelong -= 360; // Calcul de l'angle des voiles. + anglelat = direction + 90; if(anglelat < 0)anglelat += 360; if(anglelat > 360) anglelat -= 360; + + priseventlat = sin( degretorad( anglelat - VentActuelle->direction ) ) * BateauActuelle->VoilesLateralle.Pourcentage / 100;// Entre 0 et 1 // Pourcentage de la prise au vent des voiles. + priseventlong = sin( degretorad( anglelong - VentActuelle->direction ) * BateauActuelle->VoilesLongitudinal.Pourcentage / 100);// Entre -1 et 1 + + if(priseventlat < 0)priseventlat = 0; + + forceventapplique = (( ABS(priseventlat) * VentActuelle->force ) + (ABS(priseventlong * VentActuelle->force)) ); // Force que le vent applique sur le bateau. + forceapplique = cos(degretorad(direction - VentActuelle->direction)) * forceventapplique * 10; + + if(forceapplique < 0)forceapplique = 0; + + forceappliquex = cos(degretorad(direction)) * forceapplique; // Passage de forme polaire à carthésienne. + forceappliquey = sin(degretorad(direction)) * forceapplique; + + if(forceappliquex > -10 && forceappliquex < 0)forceappliquex = -10; // On cap les forces + if(forceappliquey > -10 && forceappliquey < 0)forceappliquey = -10; + + if(forceappliquex > 20)forceappliquex = 20; + if(forceappliquey > 20)forceappliquey = 20; + + GetObject()->ORigibody->R_body.velocity.x = forceappliquex; // On applique les forces. + GetObject()->ORigibody->R_body.velocity.y = forceappliquey; + +} + + +void BoatControl::Initialisation( Vent * v , Boat * b , Animation * r) +{ + this->VentActuelle = v; // On initialise les différens pointeurs. + this->BateauActuelle = b; + this->RenderBoulet = r; +} + + +void BoatControl::Turn(float v) +{ + direction += v; // On fait tourner le bateau. + + if(direction < 0)direction += 360; + if(direction > 360) direction -= 360; +} + + +void BoatControl::Fire( float angle) +{ + if(angle == 90) // Tire du canon droit + { + if(BateauActuelle->CanonDroit.couldown <= 0) + { + float angletire; + + angletire = direction - angle; // Angle de tire + + Object * Buffer = new Object; // Création du boulet + + Buffer->OTransforms->SetXY( GetX() + 8 , GetY() + 8); //On place le boulet sur la map + Buffer->ORender->SetRender(RenderBoulet , 1); //On set le rendu du boulet + Buffer->ORigibody = new Rigibody(Buffer); // On donne un Rigibody + Buffer->ORigibody->SetMass(5); //On dit qu'il pèse 5 kilo + + Buffer->AffectTag("Boulet"); + + SBoulet * Script_Boulet = new SBoulet; // On créait le script du boulet + Buffer->AffectScript(Script_Boulet); + + Script_Boulet->time = 20; + + Buffer->ORigibody->R_body.velocity.x = cos(degretorad(angletire)) * 40; //On calcul la trajectoire du boule puis on set sa vitesse. + Buffer->ORigibody->R_body.velocity.y = sin(degretorad(angletire)) * 40; + + GetEngine()->AddObject(Buffer); // On ajoute le boulet au jeu + + BateauActuelle->CanonDroit.couldown = 100; // On place le compteur à 100. + } + } + + if(angle == -90) // Tire du canon gauche + { + if(BateauActuelle->CanonGauche.couldown <= 0) + { + float angletire; + + angletire = direction - angle; + + Object * Buffer = new Object; + + Buffer->OTransforms->SetXY( GetX() + 8 , GetY() + 8); + Buffer->ORender->SetRender(RenderBoulet , 1); + Buffer->ORigibody = new Rigibody(Buffer); + Buffer->ORigibody->SetMass(5); + + Buffer->AffectTag("Boulet"); + + SBoulet * Script_Boulet = new SBoulet; + Buffer->AffectScript(Script_Boulet); + + Script_Boulet->time = 20; + + Buffer->ORigibody->R_body.velocity.x = cos(degretorad(angletire)) * 40; + Buffer->ORigibody->R_body.velocity.y = sin(degretorad(angletire)) * 40; + + GetEngine()->AddObject(Buffer); + + BateauActuelle->CanonGauche.couldown = 100; + } + } + +} + + +void SBoulet::Update() +{ + time--; //On diminue sa durée de vie + if(time < 0) //Si la durée de vie est écoulé alors on le détruit. + { + GetEngine()->DelObject(GetObject()); + } +} diff --git a/BoatControl.hpp b/BoatControl.hpp new file mode 100644 index 0000000..be95a3c --- /dev/null +++ b/BoatControl.hpp @@ -0,0 +1,74 @@ +#ifndef COMMANDEBATEAU +#define COMMANDEBATEAU + +double degretorad(float v); + +struct Vent; +struct Boat; + +//**************Les Scripts***************// + +class BoatControl: public Script +{ + public: + + void StartBoat(); //Fonctions des scripts de base + void UpdateBoat(); + + void Initialisation( Vent * v , Boat * b , Animation * r);//Pour initialiser les pointeursS + + void Turn( float v); //Pour tourner + void Fire( float angle); //Pour tirer. + + float direction; // Direction du bateau + + Animation * RenderBoulet; + + Boat * BateauActuelle; + Vent * VentActuelle; +}; + +class SBoulet: public Script +{ + public: + + void Update(); + + int time;//Durée de vie du boulet +}; + + +//*************Les Structures*************// + +struct Voile +{ + int Pourcentage; + int taille; +}; + +struct Canon +{ + int couldown; +}; + +struct Boat +{ + int Grade; + int masse; + int vie; + int viemax; + Voile VoilesLateralle; + Voile VoilesLongitudinal; + Canon CanonDroit; + Canon CanonGauche; +}; + +struct Vent +{ + float direction; + float force; // en m.s +}; + + +#endif // COMMANDEBATEAU + diff --git a/BoatControlPerso.cpp b/BoatControlPerso.cpp new file mode 100644 index 0000000..acf8a50 --- /dev/null +++ b/BoatControlPerso.cpp @@ -0,0 +1,184 @@ +#include "..\C-Engine\CHeader.hpp" +#include"BoatControl.hpp" +#include "BoatControlPerso.hpp" + +extern "C" +{ +#include +} + + +void BoatControlPerso::Start() +{ + StartBoat(); + + BateauActuelle->VoilesLateralle.Pourcentage = 0;//On set les voiles à 0. + BateauActuelle->VoilesLongitudinal.Pourcentage = 0; + + BateauActuelle->masse = 500;//Il pèse 500 kg. + + VentActuelle->direction = 180; //Direction du vent et force + VentActuelle->force = 3; + + BateauActuelle->CanonDroit.couldown = 100; + BateauActuelle->CanonGauche.couldown = 100; + + BateauActuelle->viemax = 30;//Vie max du joueur 30 pt de vie. + BateauActuelle->vie = BateauActuelle->viemax ; + +} + + +void BoatControlPerso::Update() +{ + UpdateBoat(); + + int nbpirate = CheckBoat(); + + if(input_trigger(K_EXIT))GetEngine()->StopGame();//Bouton quitté. + + + if(input_trigger(K_VARS))Fire(90);//Bouton pour tirer. + if(input_trigger(K_SHIFT))Fire(-90); + + if(input_trigger(K_POW))AfficherMap();// Bouton pour afficher la map + + switch(input_dir4())//Bouton pour tourner le bateau. + { + case 6: + Turn(-2); + break; + + case 4: + Turn(2); + break; + + default: break; + } + + if(input_press(K_F4))//Boutons pour lever ou descendre les voiles. + { + BateauActuelle->VoilesLongitudinal.Pourcentage = BateauActuelle->VoilesLongitudinal.Pourcentage - 5; + } + if(input_press(K_F5)) + { + BateauActuelle->VoilesLongitudinal.Pourcentage = BateauActuelle->VoilesLongitudinal.Pourcentage + 5; + } + + if(input_press(K_F2)) + { + BateauActuelle->VoilesLateralle.Pourcentage = BateauActuelle->VoilesLateralle.Pourcentage - 5; + } + if(input_press(K_F3)) + { + BateauActuelle->VoilesLateralle.Pourcentage = BateauActuelle->VoilesLateralle.Pourcentage + 5; + } + + Object * Buffer = GetObject()->CollisionTagO("BouletP"); + + if(Buffer != NULL) // Si on se prend un boulet alors on perd une vie. + { + GetEngine()->DelObject(Buffer); + + BateauActuelle->vie --; + } + + GetEngine()->MiddleScreen( GetX() + 25, (GetY() + 8));//On place la caméra centré sur le joueur. + + PrintV(1,2,objectifmax - nbpirate);//Afficher le nombre de bateaux pirate détruit + ML_line(6,6,8,1,ML_BLACK); + PrintV(10,2,objectifmax); + + PrintV(88 , 2 , GetX());//On affiche nos cordonnées. + PrintV(88 , 10 , GetY()); + + if(nbpirate <= 0)//Si il n'y a plus de pirate alors gagné. + { + GetEngine()->StopGame(); + + while(input_trigger(K_EXE) == 0) + { + input_update(); + + ML_clear_vram(); + + PrintXY(13 , 28 , "Mission Reussi !!!" , 0); + + ML_display_vram(); + } + } + + if( BateauActuelle->vie <= 0)//Si plus de vie alors perdu. + { + GetEngine()->StopGame(); + + while(input_trigger(K_EXE) == 0) + { + input_update(); + + ML_clear_vram(); + + PrintXY(5 , 28 , "Vous avez echoue !!!" , 0); + + ML_display_vram(); + } + } + +} + + +void BoatControlPerso::AfficherMap() +{ + bool end = false;//Pour Afficher la map + bool aperso = true; + int x; + int y; + + const unsigned char MiniMap[]={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1c, 0x0, 0x1, 0xc0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x1, 0x0, 0xc0, 0x0, 0x0, 0x0, 0x1c, 0x0, 0x1, 0xf0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x1, 0x0, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xf8, 0x0, 0x0, 0x1, 0x80, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0xff, 0x80, 0x0, 0x3, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xff, 0xc0, 0x0, 0xe, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x1, 0xe0, 0x0, 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, 0x3, 0x80, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0xc0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xfe, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xf8, 0x0, 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 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf0, 0x0, 0x1, }; + + + x = GetX() * 127 / 1200; + y = 63 - ( GetY() * 63 / 1200); + + while(end == false) + { + input_update(); + if(input_trigger(K_EXE) || input_trigger(K_POW))end = true; + + ML_clear_vram(); + + + ML_bmp_or(MiniMap,0,0,127,63); + if(aperso == true) + { + ML_point( x , y , 1 , ML_BLACK); + aperso = false; + } + else + { + ML_point( x , y , 1 , ML_WHITE); + aperso = true; + } + + ML_display_vram(); + + Sleep(200); + } +} + + +int BoatControlPerso::CheckBoat()//Fonction qui renvoie le nombre de bateaux pirate sur la map. +{ + int a = 0; + + for(int i = 0; i < GetEngine()->nbobject; i++) + { + if( strcmp(GetEngine()->ListeObject[i]->tag , "Pirate") == 0) + { + a++; + } + } + + return a; +} + diff --git a/BoatControlPerso.hpp b/BoatControlPerso.hpp new file mode 100644 index 0000000..ef929e2 --- /dev/null +++ b/BoatControlPerso.hpp @@ -0,0 +1,19 @@ + +#ifndef COMMANDEBATEAUPERSO +#define COMMANDEBATEAUPERSO + +class BoatControlPerso: public BoatControl +{ + public: + + void Start(); + void Update(); + + int CheckBoat(); + + void AfficherMap(); + + int objectifmax; +}; + +#endif // COMMANDEBATEAUPERSO diff --git a/BoatControlPirate.cpp b/BoatControlPirate.cpp new file mode 100644 index 0000000..a037903 --- /dev/null +++ b/BoatControlPirate.cpp @@ -0,0 +1,165 @@ +#include "..\C-Engine\CHeader.hpp" +#include"BoatControl.hpp" +#include "BoatControlPirate.hpp" + +extern "C" +{ +#include +} + + +void BoatControlPirate::Start() +{ + StartBoat(); + + GetObject()->ORigibody = new Rigibody(GetObject()); + + GetObject()->AffectTag("Pirate"); //On écrit que c'est un pirate + GetObject()->ORigibody->SetMass(500); + + BateauActuelle->VoilesLongitudinal.Pourcentage = 0;//On met ces voiles à 0 + BateauActuelle->VoilesLateralle.Pourcentage = 0; + + BateauActuelle->viemax = 3;//Les pirates ont 3 de vies. + BateauActuelle->vie = BateauActuelle->viemax ; + + BateauActuelle->CanonDroit.couldown = 0; + BateauActuelle->CanonGauche.couldown = 0; +} + + +void BoatControlPirate::Update() +{ + UpdateBoat(); + + int difx , dify ; + int distance; + float angle , difangle; + + difx = GetX() - GetEngine()->ListeObject[0]->OTransforms->GetX(); + dify = GetY() - GetEngine()->ListeObject[0]->OTransforms->GetY(); + + distance = sqrt( difx * difx + dify * dify); //On calcul la distance entre le joueur et le bateau pirate. + + angle = 360 - 90 - radtodegre(atan2( difx , dify)); + + if(angle > 360) angle -= 360; + if(angle < 0) angle += 360; + + difangle = angle - direction; + + if(distance < 50 || distance > 350) + { + difangle = angle - direction + 90; + + BateauActuelle->VoilesLateralle.Pourcentage = BateauActuelle->VoilesLateralle.Pourcentage - 3; + BateauActuelle->VoilesLongitudinal.Pourcentage = BateauActuelle->VoilesLongitudinal.Pourcentage - 3; + } + else + { + if(BateauActuelle->VoilesLateralle.Pourcentage < 70)BateauActuelle->VoilesLateralle.Pourcentage = BateauActuelle->VoilesLateralle.Pourcentage + 2; + if(BateauActuelle->VoilesLateralle.Pourcentage < 70)BateauActuelle->VoilesLongitudinal.Pourcentage = BateauActuelle->VoilesLongitudinal.Pourcentage + 2; + } + + if(difangle > 360) difangle -= 360; + if(difangle < 0) difangle += 360; + + if(difangle < 180 && difangle > 2)Turn(2);//On aligne le bateau dans la bonne direction + if(difangle > 180 && difangle < 358) Turn(-2); + + if(distance < 50) + { + Fire(90); + Fire(-90); + + } + + int affichage = BateauActuelle->vie * 15 / BateauActuelle->viemax;//On affiche la vie du pirate à sa gauche. + PrintMini( GetObject()->OTransforms->GetRelativeX() + 18 , 63 - GetObject()->OTransforms->GetRelativeY() - 10 , "P" , 0); + ML_line( GetObject()->OTransforms->GetRelativeX() - 2 , 62 - GetObject()->OTransforms->GetRelativeY() , GetObject()->OTransforms->GetRelativeX() - 2 , 62 - GetObject()->OTransforms->GetRelativeY() - affichage, ML_BLACK); + + + Object * Buffer = NULL; + + Buffer = GetObject()->CollisionTagO("Boulet"); + + if(Buffer != NULL)//Si il est touché par un boulet de canon il perd une vie. + { + GetEngine()->DelObject(Buffer); + + BateauActuelle->vie --; + } + + if( BateauActuelle->vie <= 0)//Si il n'a plus de vie il meurt. + { + GetEngine()->DelObject(GetObject()); + } + + +} + + +void BoatControlPirate::Fire( float angle)//Pareil que pour le BoatControl , seul le tag change. +{ + if(angle == 90) + { + if(BateauActuelle->CanonDroit.couldown <= 0) + { + float angletire; + + angletire = direction - angle; + + Object * Buffer = new Object; + + Buffer->OTransforms->SetXY( GetX() + 8 , GetY() + 8); + Buffer->ORender->SetRender(RenderBoulet , 1); + Buffer->ORigibody = new Rigibody(Buffer); + Buffer->ORigibody->SetMass(5); + + Buffer->AffectTag("BouletP"); + + SBoulet * Script_Boulet = new SBoulet; + Buffer->AffectScript(Script_Boulet); + + Script_Boulet->time = 20; + + Buffer->ORigibody->R_body.velocity.x = cos(degretorad(angletire)) * 40; + Buffer->ORigibody->R_body.velocity.y = sin(degretorad(angletire)) * 40; + + GetEngine()->AddObject(Buffer); + + BateauActuelle->CanonDroit.couldown = 100; + } + } + + if(angle == -90) + { + if(BateauActuelle->CanonGauche.couldown <= 0) + { + float angletire; + + angletire = direction - angle; + + Object * Buffer = new Object; + + Buffer->OTransforms->SetXY( GetX() + 8 , GetY() + 8); + Buffer->ORender->SetRender(RenderBoulet , 1); + Buffer->ORigibody = new Rigibody(Buffer); + Buffer->ORigibody->SetMass(5); + + Buffer->AffectTag("BouletP"); + + SBoulet * Script_Boulet = new SBoulet; + Buffer->AffectScript(Script_Boulet); + + Script_Boulet->time = 20; + + Buffer->ORigibody->R_body.velocity.x = cos(degretorad(angletire)) * 40; + Buffer->ORigibody->R_body.velocity.y = sin(degretorad(angletire)) * 40; + + GetEngine()->AddObject(Buffer); + + BateauActuelle->CanonGauche.couldown = 100; + } + } +} diff --git a/BoatControlPirate.hpp b/BoatControlPirate.hpp new file mode 100644 index 0000000..baae0e2 --- /dev/null +++ b/BoatControlPirate.hpp @@ -0,0 +1,19 @@ +#ifndef COMMANDEBATEAUPIRATE +#define COMMANDEBATEAUPIRATE + +class BoatControlPirate: public BoatControl +{ + public: + + void Start(); + void Update(); + void Fire( float angle); + +}; + + +#endif // COMMANDEBATEAUPIRATE + + + + diff --git a/EngineGUI.cpp b/EngineGUI.cpp new file mode 100644 index 0000000..6757c78 --- /dev/null +++ b/EngineGUI.cpp @@ -0,0 +1,115 @@ +#include "..\C-Engine\CHeader.hpp" + +#include"BoatControl.hpp" +#include"EngineGUI.hpp" + +extern "C" +{ +#include +} + + + +void EngineGUI::UpdateEverySecond() +{ + VentActuelle->direction = VentActuelle->direction + cos(rand()) * 30; + VentActuelle->force = VentActuelle->force + cos(rand()); + + if(VentActuelle->direction < 0)VentActuelle->direction += 360; + if(VentActuelle->direction > 360) VentActuelle->direction -= 360; + + if(VentActuelle->force > 5) VentActuelle->force = 5; + if(VentActuelle->force < 1) VentActuelle->force = 1; +} + +void EngineGUI::Update() +{ + float buffer; + + const unsigned char Bordure[]={0x40,0x0,0x10,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x8,0x80,0x0,0x18,0x7f,0xff,0xe8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x8,0x0,0x0,0x10}; + + ML_bmp_or(Bordure , 84 , 0, 21 , 64); + ML_rectangle(105 , 0 , 127 , 63 , 1 , ML_WHITE , ML_WHITE); + + //************Vent****************// + + PrintMini(108 , 1 , "Vent" , 0); + + PrintV( 120 , 7 ,VentActuelle->force); + + buffer = VentActuelle->direction; + + const unsigned char FlecheE[]={0x20,0x10,0xf8,0x10,0x20}; + const unsigned char FlecheN[]={0x20,0x70,0xa8,0x20,0x20}; + const unsigned char FlecheNE[]={0x78,0x18,0x28,0x48,0x80}; + const unsigned char FlecheNO[]={0xf0,0xc0,0xa0,0x90,0x8}; + const unsigned char FlecheO[]={0x20,0x40,0xf8,0x40,0x20}; + const unsigned char FlecheS[]={0x20,0x20,0xa8,0x70,0x20}; + const unsigned char FlecheSE[]={0x80,0x48,0x28,0x18,0x78}; + const unsigned char FlecheSO[]={0x8,0x90,0xa0,0xc0,0xf0}; + + if((buffer >= 0 && buffer < 22)|| (buffer >= 337 && buffer < 360))ML_bmp_or(FlecheE ,109 , 7, 5 , 5); + else if(buffer >= 22 && buffer < 67)ML_bmp_or(FlecheNE ,109 , 7, 5 , 5); + else if(buffer >= 67 && buffer < 112)ML_bmp_or(FlecheN ,109 , 7, 5 , 5); + else if(buffer >= 112 && buffer < 157)ML_bmp_or(FlecheNO ,109 , 7, 5 , 5); + else if(buffer >= 157 && buffer < 202)ML_bmp_or(FlecheO ,109 , 7, 5 , 5); + else if(buffer >= 202 && buffer < 247)ML_bmp_or(FlecheSO ,109 , 7, 5 , 5); + else if(buffer >= 247 && buffer < 292)ML_bmp_or(FlecheS ,109 , 7, 5 , 5); + else if(buffer >= 292 && buffer < 337)ML_bmp_or(FlecheSE ,109 , 7, 5 , 5); + + //**********************Voile*************// + + const unsigned char Voile0[]={0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18}; + const unsigned char Voile25[]={0x18,0xff,0x81,0xff,0x18,0x18,0x18,0x18}; + const unsigned char Voile50[]={0x18,0xff,0x81,0x81,0xff,0x18,0x18,0x18}; + const unsigned char Voile75[]={0x18,0xff,0x81,0x81,0x81,0xff,0x18,0x18}; + const unsigned char Voile100[]={0x18,0xff,0x81,0x81,0x81,0x81,0xff,0x18}; + + const unsigned char* SpriteVoile[] = {Voile0,Voile25,Voile50,Voile75,Voile100}; + PrintMini(108 , 15 , "Voiles" , 0); + + int buffer2 = BateauActuelle->VoilesLateralle.Pourcentage; + int buffer2b = BateauActuelle->VoilesLongitudinal.Pourcentage; + + if( buffer2 < 12 )ML_bmp_8_or(SpriteVoile[0] ,108 , 21); + else if(buffer2 >= 12 && buffer2 < 37 )ML_bmp_8_or(SpriteVoile[1] ,108 , 21); + else if(buffer2 >= 37 && buffer2 < 62 )ML_bmp_8_or(SpriteVoile[2] ,108 , 21); + else if(buffer2 >= 62 && buffer2 < 87 )ML_bmp_8_or(SpriteVoile[3] ,108 , 21); + else if(buffer2 >= 87)ML_bmp_8_or(SpriteVoile[4] ,108 , 21); + + if( buffer2b < 12 )ML_bmp_8_or(SpriteVoile[0] ,118 , 21); + else if(buffer2b >= 12 && buffer2b < 37 )ML_bmp_8_or(SpriteVoile[1] ,118 , 21); + else if(buffer2b >= 37 && buffer2b < 62 )ML_bmp_8_or(SpriteVoile[2] ,118 , 21); + else if(buffer2b >= 62 && buffer2b < 87 )ML_bmp_8_or(SpriteVoile[3] ,118 , 21); + else if(buffer2b >= 87)ML_bmp_8_or(SpriteVoile[4] ,118 , 21); + + //*****************Canons************// + + int buffer3, buffer4; + + PrintMini(106 , 31 , "Canon" , 0); + + buffer3 = 17 - BateauActuelle->CanonDroit.couldown * 17 / 100; + buffer4 = 17 - BateauActuelle->CanonGauche.couldown * 17 / 100; + + int affichage = BateauActuelle->vie * 17 / BateauActuelle->viemax; + + ML_rectangle(108 , 38 , 125 , 40 , 1 , ML_BLACK , ML_WHITE); + ML_line( 108 , 39 , 108 + buffer3 , 39 , ML_BLACK); + + ML_rectangle(108 , 43 , 125 , 45 , 1 , ML_BLACK , ML_WHITE); + ML_line( 108 , 44 , 108 + buffer4 , 44 , ML_BLACK); + + //*******************Vie******************// + + PrintMini(108 , 50 , "Vie" , 0); + + ML_rectangle(108 , 57 , 125 , 59 , 1 , ML_BLACK , ML_WHITE); + ML_line( 108 , 58 , 108 + affichage , 58 , ML_BLACK); +} + +void EngineGUI::Initialisation( Vent * v , Boat * b ) +{ + this->VentActuelle = v; + this->BateauActuelle = b; +} diff --git a/EngineGUI.hpp b/EngineGUI.hpp new file mode 100644 index 0000000..d32d124 --- /dev/null +++ b/EngineGUI.hpp @@ -0,0 +1,20 @@ + +#ifndef GUI +#define GUI + +#include"BoatControl.hpp" + +class EngineGUI: public Script +{ + public: + + void Update();//On affiche les différentes données du jeu + void UpdateEverySecond();//On actuallise la météo. + + void Initialisation( Vent * v , Boat * b); + + Boat * BateauActuelle; + Vent * VentActuelle; +}; + +#endif //GUI diff --git a/Marine.cpp b/Marine.cpp new file mode 100644 index 0000000..16f3eb8 --- /dev/null +++ b/Marine.cpp @@ -0,0 +1,576 @@ + +#include "..\C-Engine\CHeader.hpp" + +#include"BoatControl.hpp" +#include"BoatControlPerso.hpp" +#include"BoatControlPirate.hpp" +#include"EngineGUI.hpp" + +int Intro();//Intro du jeu +int Menu();//Menu du jeu +int Jeu( int stage);// Jeu en lui meme + + +int HistoireStage1();// Les différentes histoires. +int HistoireStage2(); +int HistoireStage3(); + +void PrintTextDelay( int x , int y , int delay , char * txt , int length)//Fonction qui affiche le text en plus classe. +{ + int i; + + char * buffer = (char *)malloc(sizeof(char) * 2); + + for(i = 0; i < length ; i++) + { + input_update(); + if(input_trigger(K_SHIFT))return ; + buffer[0] = txt[i]; + buffer[1] = '\0'; + PrintMini( x + i*4 , y ,(const unsigned char *) buffer, 0); + ML_display_vram(); + Sleep(delay); + } +} + +int Intro() +{ + const unsigned char Bateau[]={0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x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c, 0x0, 0x21, 0x0, 0xc0, 0x0, 0x0, 0x1, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, 0x1, 0x1, 0x80, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0xff, 0xff, 0xff, 0x80, 0x0, 0x81, 0x80, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0xff, 0xff, 0xff, 0xf8, 0x0, 0x81, 0x80, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0, 0x81, 0x80, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x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, 0x1, 0x80, 0x7f, 0x0, 0x3, 0x0, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x80, 0x7f, 0x0, 0x3, 0x0, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x80, 0x7f, 0x0, 0x3, 0x0, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x1, 0x0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0, 0x1, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0, 0x1, 0x1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x1, 0x7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x1, 0x7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1, 0xf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x1, 0xf, 0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, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x80, 0x7f, 0x0, 0x3, 0x0, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x80, 0x7f, 0x0, 0x3, 0x0, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x80, 0x1c, 0x0, 0x3, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, }; + + + for(int i=0 ; i < 258 ; i++) + { + ML_clear_vram(); + + if( i > 124) + { + PrintXY( 4 , 15 , "L'invasion Seanchans" , 0); + PrintMini(50 , 30 , "Par Fife86" , 0); + PrintMini(0 , 40 , "Cree a l'occasion des 7 Days CPC" , 0); + } + + if(i < 150) + { + ML_rectangle(90,10,127,50,1,ML_WHITE , ML_WHITE); + } + ML_bmp_or_cl(BateauN , i - 127 , 0 , 127 , 63); + ML_bmp_and_cl(Bateau , i - 127 , 0 , 127 , 63); + + Sleep(20); + + ML_display_vram(); + } + + Sleep(1000); + return 1; +} + +int Menu() +{ + bool end = false; + int choix = 0; + int cx = 40; + int cy = 20; + + const unsigned char Curseur[]={0x9f, 0xdf, 0xff, 0xff, 0xff, 0xdf, 0x9f, }; + const unsigned char CurseurM[]={0xbf, 0xff, 0xff, 0xbf, }; + + Intro(); + + while(end == false) + { + ML_clear_vram(); + + input_update(); + + PrintXY( 4 , 5 , "L'invasion Seanhans" , 0); + PrintXY(45,20,"Stage 1" , 0); + PrintXY(45,32,"Stage 2" , 0); + PrintXY(45,44,"Stage 3" , 0); + PrintMini(53,57,"Quitter" , 0); + + const unsigned char Deco[]={0x0,0xd0,0x0,0x0,0x30,0x0,0x0,0x10,0x0,0x0,0x10,0x0,0x0,0x10,0x0,0x4,0x71,0x0,0x4,0xf8,0x80,0x4,0xfb,0x80,0x1d,0xfb,0x80,0x3e,0x17,0xc4,0x3e,0x7f,0xcc,0x7e,0xf0,0x9e,0x5,0xff,0xbe,0x1d,0xfb,0xff,0x3e,0x71,0xff,0x7c,0x10,0xff,0x4,0xff,0xfe,0x1f,0x7e,0xf8,0x8e,0x38,0xc0,0x44,0x10,0x8e,0x24,0x11,0xfe,0x14,0xff,0xfe,0xf,0xff,0xfc,0x7,0xff,0xf8}; + + ML_bmp_or(Deco ,8,30,24,24); + ML_bmp_or(Deco ,95,30,24,24); + + if(input_any_key()) + { + if(input_trigger(K_DOWN))choix ++; + if(input_trigger(K_UP))choix --; + + if(choix < 0)choix = 0; + if(choix > 3)choix = 3; + + switch(choix) + { + case 0: cx = 40; cy = 20; break; + case 1: cx = 40; cy = 32; break; + case 2: cx = 40; cy = 44; break; + case 3: cx = 47; cy = 57; break; + } + + if(input_trigger(K_EXE)) + { + switch(choix) + { + case 0: Jeu(1); break; + case 1: Jeu(2); break; + case 2: Jeu(3); break; + case 3: end = true; break; + } + } + } + + if(choix != 3) + { + ML_bmp_or(Curseur , cx , cy , 3 , 7); + ML_bmp_or_rotate(Curseur , cx + 49 , cy , 3 , 7 , 180); + } + else + { + ML_bmp_or(CurseurM , cx , cy , 2 , 4); + ML_bmp_or_rotate(CurseurM , cx + 37 , cy -1 , 2 , 4 , 180); + } + + ML_display_vram(); + } + + return 1; +} + +int HistoireStage1() +{ + + ML_clear_vram(); + + ML_rectangle(30,20,97,35,1,ML_BLACK,ML_WHITE); + PrintXY(45,23, "Stage 1" , 0); + + ML_display_vram(); + + Sleep(2000); + + ML_clear_vram(); + PrintMini(80,58,"Skip : SHIFT",0); + + PrintTextDelay(15,10,100,"Bienvenue Capitaine,", 20); + + if(input_trigger(K_SHIFT) == false)Sleep(500); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(15,20,100,"Le Dragon Reincarne vient", 25); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(15,30,100,"de vous envoyer un message.", 27); + if(input_trigger(K_SHIFT) == false)Sleep(1000); + + ML_clear_vram(); + PrintMini(80,58,"Skip : SHIFT",0); + PrintTextDelay(15,10,100,"Votre mission est de", 20); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(15,20,100,"detruire des eclaireurs", 23); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(15,30,100,"Seanchans.", 10); + if(input_trigger(K_SHIFT) == false)Sleep(1000); + + ML_clear_vram(); + PrintMini(80,58,"Skip : SHIFT",0); + PrintTextDelay(15,10,100,"Ils sont aux nombres de 3.", 26); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(15,20,100,"Le Seigneur Dragon compte", 25); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(15,30,100,"sur vous.", 9); + if(input_trigger(K_SHIFT) == false)Sleep(1000); + + ML_clear_vram(); + PrintTextDelay(30,28,100,"Bonne chance", 13); + Sleep(2000); + + + return 1; +} + +int HistoireStage2() +{ + + + ML_clear_vram(); + + ML_rectangle(30,20,97,35,1,ML_BLACK,ML_WHITE); + PrintXY(45,23, "Stage 2" , 0); + + ML_display_vram(); + + Sleep(2000); + + ML_clear_vram(); + PrintMini(80,58,"Skip : SHIFT",0); + + + PrintTextDelay(5,10,100,"Chef, nos cotes sont attaquees", 30); + + if(input_trigger(K_SHIFT) == false)Sleep(500); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(10,20,100,"Il faut defendre nos terres", 27); + + if(input_trigger(K_SHIFT) == false)PrintTextDelay(10,30,100,"contre les Seanchans.", 21); + if(input_trigger(K_SHIFT) == false)Sleep(500); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(15,40,100,"Ils y a 6 envahisseurs.", 23); + if(input_trigger(K_SHIFT) == false)Sleep(1000); + + return 1; +} + +int HistoireStage3() +{ + + ML_clear_vram(); + + ML_rectangle(30,20,97,35,1,ML_BLACK,ML_WHITE); + PrintXY(45,23, "Stage 3" , 0); + + ML_display_vram(); + + Sleep(2000); + + ML_clear_vram(); + PrintMini(80,58,"Skip : SHIFT",0); + + PrintTextDelay(5,10,100,"C est la derniere bataille", 26); + + if(input_trigger(K_SHIFT) == false)Sleep(500); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(10,20,100,"Ils ont perdus, il ne reste", 27); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(10,30,100,"qu'une dizaine de bateaux", 25); + + if(input_trigger(K_SHIFT) == false)Sleep(500); + if(input_trigger(K_SHIFT) == false)PrintTextDelay(15,40,100,"a couler. Tenez bon.", 20); + if(input_trigger(K_SHIFT) == false)Sleep(1000); + + return 1; +} + + +int Jeu( int stage) +{ + + // Les différents sprites utilisé. + + const unsigned char Grade1[]={0x1,0xc0,0x0,0x2,0x20,0x0,0x4,0x10,0x0,0x8,0x88,0x0,0x9,0x48,0x0,0x8,0x8,0x0,0x38,0xe,0x0,0x38,0x8e,0x0,0x9,0xc8,0x0,0x8,0x8,0x0,0x8,0x8,0x0,0x8,0x88,0x0,0x1f,0x7c,0x0,0x3c,0x9e,0x0,0x8,0x8,0x0,0xc,0x18,0x0,0x7,0xf0,0x0}; + const unsigned char Grade2[]={0x1,0xc0,0x0,0x2,0x20,0x0,0x4,0x10,0x0,0x8,0x88,0x0,0x9,0x48,0x0,0xa,0x28,0x0,0x38,0xe,0x0,0x38,0xe,0x0,0x8,0x88,0x0,0x39,0xce,0x0,0x38,0xe,0x0,0x8,0x88,0x0,0x1f,0x7c,0x0,0x3c,0x9e,0x0,0x8,0x8,0x0,0xc,0x18,0x0,0x7,0xf0,0x0}; + const unsigned char Grade3[]={0x1,0xc0,0x0,0x2,0x20,0x0,0x4,0x90,0x0,0x9,0x48,0x0,0x8,0x8,0x0,0x38,0xe,0x0,0x38,0xe,0x0,0x8,0x88,0x0,0x1f,0x7c,0x0,0x3c,0x9e,0x0,0x8,0x8,0x0,0x8,0x88,0x0,0x1f,0x7c,0x0,0x3c,0x9e,0x0,0x8,0x8,0x0,0xd,0x58,0x0,0x7,0xf0,0x0}; + const unsigned char Grade4[]={0x1,0xc0,0x0,0x1a,0x2c,0x0,0x1c,0x9c,0x0,0x9,0x48,0x0,0xa,0xa8,0x0,0x38,0xe,0x0,0x38,0xe,0x0,0x8,0x88,0x0,0x1f,0x7c,0x0,0x3c,0x9e,0x0,0x8,0x8,0x0,0x8,0x88,0x0,0x1f,0x7c,0x0,0x3c,0x9e,0x0,0x8,0x8,0x0,0xd,0x58,0x0,0x7,0xf0,0x0}; + const unsigned char Grade5[]={0x0,0x70,0x0,0x0,0x88,0x0,0xd,0x5,0x80,0xe,0x23,0x80,0x4,0xf9,0x0,0x5,0x25,0x0,0x1c,0x51,0xc0,0x1c,0x1,0xc0,0x4,0x21,0x0,0xf,0xdf,0x80,0x1e,0x23,0xc0,0x4,0x1,0x0,0x4,0x1,0x0,0x1c,0x71,0xc0,0x1c,0x1,0xc0,0x4,0x21,0x0,0xf,0xdf,0x80,0x1e,0x23,0xc0,0x4,0x1,0x0,0x6,0xdb,0x0,0x3,0xfe,0x0}; + + + + Sprite Sprite_Bateau_Grade1( Grade1 , 17 , 17 ); Sprite_Bateau_Grade1.CreateReverse(); + Sprite Sprite_Bateau_Grade2( Grade2 , 17 , 17 ); Sprite_Bateau_Grade2.CreateReverse(); + Sprite Sprite_Bateau_Grade3( Grade3 , 17 , 17 ); Sprite_Bateau_Grade3.CreateReverse(); + Sprite Sprite_Bateau_Grade4( Grade4 , 17 , 17 ); Sprite_Bateau_Grade4.CreateReverse(); + Sprite Sprite_Bateau_Grade5( Grade5 , 21 , 21 ); Sprite_Bateau_Grade5.CreateReverse(); + + Animation A_Bateau_Grade1( Sprite_Bateau_Grade1); + Animation A_Bateau_Grade2( Sprite_Bateau_Grade2); + Animation A_Bateau_Grade3( Sprite_Bateau_Grade3); + Animation A_Bateau_Grade4( Sprite_Bateau_Grade4); + Animation A_Bateau_Grade5( Sprite_Bateau_Grade5); + + const unsigned char I_Boulet[]={ 0xff , 0xff}; + + Sprite Sprite_Boulet( I_Boulet , 2 ,2); + Animation A_Boulet( Sprite_Boulet); + + const unsigned char TileSetMer[]={0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xf0,0x7f,0x0,0x40,0x0,0x70,0x0,0x10,0x0,0x30,0x0,0x60,0x0,0x40,0x0,0x40,0x0,0x40,0x0,0x80,0x0,0x80,0x0,0xf0,0x0,0x10,0x0,0x1f,0x80,0x0,0x80,0x0,0x80,0x0,0xc0,0x0,0x40,0x0,0x40,0x0,0x60,0x0,0x20,0x0,0x20,0x0,0x30,0x0,0x10,0x0,0x10,0x0,0x30,0x0,0x20,0x0,0x60,0x0,0x40,0x7,0x40,0x5,0xc0,0x4,0xc0,0x3c,0xc0,0x20,0x0,0xc0,0x0,0x80,0x0,0x80,0x0,0xc0,0x0,0x60,0x0,0x20,0x0,0x20,0x0,0x30,0x0,0xe,0x0,0x3,0xc0,0x0,0x60,0x0,0x20,0x0,0x30,0xc1,0xf0,0x7b,0x0,0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x7f,0x10,0xc1,0xe0}; + + bool TileProp[]= { false , true , true, true, true, true, true}; //, true , true , true , true , true , true , true , true , true , true , true , true , true , true, true , true , true , true , true , true , true , true }; + + const unsigned char * map1[]={ + "0000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000", + "0000000000000000000000000000000000120000000000000012000000000000000000000052000000000000000000000000", + "0000001200000000000000000000000000430000000000000040200000000000000000000000200000000000000000000000", + "0000004300000000000000000000000000000000000000000010020000000000000000000000100000000000000000000000", + "0000000000000000000000000000000000000000000000000300004000000000000000000001000000000000000000000000", + "0000000000000000000000000000000000000000000000000400000460000000000000000030000000000000000000000000", + "0000000000000000000000000000000000000000000000000020000304000000000000000100000000000000000000000000", + "0000000000000000001200000000000000000000000000000034000000200000000000000400000000000000000000000000", + "0000000000000000002040000000000000000000000000000300000000100000000000000040000000000000000000000000", + "0000000000000000000230000000000000000000000000003000000003000000000000000002000000000000000000000000", + "0000000000000000000000000000000000000000000000002000000010000000000000000000200000000000000000000000", + "0000000000000000000000000000000000000000000000000400000300000000000000000000100000000000000000000000", + "0000000000000000000000000000000000000000000000000020001000000000000000000003000000000000000000000000", + "0000000000000000000000000000000000000000000000000004034000000000000000000005200600000000000000000000", + "0000000000000000000000000000000000000000000000000001060200000000000000000000055020000000000000000000", + "0000000000000000000000000000000000000000000000000004104300000000000000000000000030000000000000000000", + "0000000000000000000000000000012140600000000000000000000000000000000000000000000100000000000000000000", + "0000000000000000000000000000020205300000000000000000000000000000000000000000001000000000000000000000", + "0000000000000000000000000000004001000000000000000000000000000000000000000000005200000000000000000000", + "0000000000000000000000000000003030000000000000000000000000000000000000000000000300000000000000000000", + "0000000000000000000000000000010100000000000000000000000000000000000000000000001000000000000000000000", + "0000000000000000000000000000023000000000000000000000000000000000000000000000004000000000000000000000", + "0000014000000000000000000000000000000000000000000000000000000000000000000000000520000000000000000000", + "0000335000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000", + "0012226000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000", + "0040503000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000", + "0034010000000000000000000000000000000000000000000000000000001400000000000000000300000000000000000000", + "0054020000000000000000000000000000000000000000000000000000002020000000000000001000000000000000000000", + "0000210000000000000000000000000000000000000000000000000000343004000000000000004000000000000000000000", + "0000000000000000000000000000000000000000000000000000000001000000400000000000000400000000000000000000", + "0000000000000000000000000000000000000000000000000000340030000003500000000000000020000000000000000000", + "0000000000000000000000000000000000000000000000000000202100000004000000000000000002000000000000000000", + "0000000000000000000000000000000000000000000000000000100000000015000000000000000001000000000000000000", + "0000000000000000000000000000000000000000000000000000400000000020000000000000000030000000000000000000", + "0000000000000000000000000000000000000000000000000000020000000030000000000000000052006000000000000000", + "0000000000000000000000000000000000000000000000000000010000003440000000000000000000550200000000000000", + "0000000000000000000000000000000000000000000000000000052143210050000000000000000000000300000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000001552003000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000010000430000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000", + "0000000000000000000000000000000000006000000000000000000000000000000000000000030000000000000000000000", + "0000000000000000000000000000000000630200000000000000000000000000000000000000100000000000000000000000", + "0000000606000000000000000000000003000300000000000000000000000000000000000000403552000000000000000000", + "0000001054260000000000000000000002601000000000000000000000000000000000000000050000414000000000000000", + "0000030000005200000000000000000001030000000000000000000000000000000000000000000000000200000000000000", + "0000020000000120000000000000000030041200000000000000000000000000000000000000000000000046060000000000", + "0000030000000010000000000000000021400300000000000000000000000000000000000000000000000000502000000000", + "0001500003520300000000000000000000023000000000000000000000000000000000000000000000000000000400000000", + "0004000002005000000000000000000000000000000000000000000000000000000000000000000000000000000020000000", + "0000200000400000000000000000000000000000000000000000000000000000000000000000000000000000000004000000", + "0000054000020001400000000000000000000000000000000000000000000000000000000000000000000060000003000000", + "0000003000004350020000000000000000000000000000000000000000000000000000000000000340663504120010000000", + "0000002000000000030000000000000000000000000000000000000000000000000000000000000205000000005500000000", + "0000000460000001500000000000000000000000000000000000000000000000000000000000000100000000000000000000", + "0000000005200030000000000000000000000000000000000000000000000000000000000000003000000000000000000000", + "0000000000040300000000000000000000000000000000000000000000000000000000000000005200600000000000000000", + "0000000000005000000000000000000000000000012000000000000000000000000000000000000055020000000000000000", + "0000000000000000000000000000000000000000020400000000000000000000000000000000000000030000000000000000", + "0000000000000000000000000000000000000000002300000000000000000000000000000000000000100000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000005200000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000006000000000004000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000120001550512000000000520000000000000000", + "0000000000000000000000000000000000000000000000000000000000000205550000000200000000002000000000000000", + "0000000000000000000000000000000000000000000000000000000000000040000000000020000000001000000000000000", + "0000000000000000000000000000000000000001200000000000000000000030000120000030000000010000000000000000", + "0000000000000000000000000000000000000010040000000000000000001500001002060300000000300000000000000000", + "0000000000000000000000000000000000000020002600000000000000030000004000505000000001000000000000000000", + "0000000000000000000000000000000000006010001040000000000000046600000200000000000004000000000000000000", + "0000000000000000000000000000000000004500000030000000000000000055400020000000000000400000000000000000", + "0000000000000000000000000000000000000200000300000000000000000000020030000000000000020000000000000000", + "0000000000000000000000000000000000000100015000000000000000000000004100000000000000002000000000000000", + "0000000000000000000000000000000000000460020000000000000000000000000000000000000000001000000000000000", + "0000000000000000000000000000000000000002004000000000000000000000000000000000000000030000000000000000", + "0000000000000000000000000000000000000001503000000000000000000000000000000000000000100000000000000000", + "0000000000000000000000000000000000000004630000000000000000000000000000000000000001000000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000005200000000000000000", + "0000000000000000000612000000000000000000000000000000000000000000000000000000000000300000000000000000", + "0000000000120000000400400000000000000000000000000000000000000000000000000000000001000000000000000000", + "0000000000430000000350300000000000000000000000000000000000000000000000000000000004000000000000000000", + "0000000000000000000401000000000000000000000000000000000000000000012000000000000000520000000000000000", + "0000000000000000000304000000000000000000000000000000000000000000103000000000000000002000000000000000", + "0000000000000000001600200000000000000000000000000000000000000000404000000000000000001000000000000000", + "0000000000000000005020520000000000000000000000000000000000000000020200000000000000010000000000000000", + "0000000000000000000010030000000000000000000000000000000000000000004620000000000000300000000000000000", + "0000000000000000000300100000000000000000000000000000000000000000000042000000000001000000000000000000", + "0000000000000000000403000000000000000000000000000000000000000000000004460000000004000000000000000000", + "0000000000000000000050000000000000000000000000000000000000000000000000210000000000400000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000", + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000", + }; + + + //*******************Commun*****************// + + Engine Game;// Création du moteur + + Vent VentJeu;// Création de la météo. + + Boat Bateau_Joueur; // Création du bateau du joueur. + + Object Bateau; // Création de l'object Joueur + Bateau.OTransforms->SetXY(88 * 12,( 100 - 56) * 12);// Placement du joueur sur la map. + Bateau.ORender->SetRender(A_Bateau_Grade4 );// Affection de l'image du bateau au joueur. + Bateau.ORigibody = new Rigibody(&Bateau);//Création d'un corps pour le joueur. + Bateau.ORigibody->SetMass(500); + Bateau.AffectTag("Bateau"); + + BoatControlPerso * Bateau_Script = new BoatControlPerso;// Création du script du joueur. + Bateau.AffectScript(Bateau_Script); + Bateau_Script->Initialisation(& VentJeu , & Bateau_Joueur , & A_Boulet);//Initialisation des pointeurs utilisé dans le script. + + Map Niveau1;//Création de la map + Niveau1.SetMap(TileSetMer , map1 , TileProp , 12 , 12 , 100 ,100);// Paramètrage de la map. + + Game.AffectMap( &Niveau1);//Affection de la map au moteur. + Niveau1.AffectEngine( &Game); + + EngineGUI Game_GUI;//Création de la GUI. + Game.AffectScript(Game_GUI); + Game_GUI.Initialisation(& VentJeu , & Bateau_Joueur ); + + Game.SetFpsWish(7);//Limite des FPS voulut. + Game.AddObject( & Bateau);//Ajout du joueur au moteur. + + //***************Stage*************// + + Boat Bateau_Pirate1;//Création de tout les pirates. + Object Pirate1; + Pirate1.ORender->SetRender(A_Bateau_Grade1 ); + BoatControlPirate * Pirate1_Script = new BoatControlPirate; + Pirate1.AffectScript(Pirate1_Script); + Pirate1_Script->Initialisation(& VentJeu , & Bateau_Pirate1, & A_Boulet); + + Boat Bateau_Pirate2; + Object Pirate2; + Pirate2.ORender->SetRender(A_Bateau_Grade1 ); + BoatControlPirate * Pirate2_Script = new BoatControlPirate; + Pirate2.AffectScript(Pirate2_Script); + Pirate2_Script->Initialisation(& VentJeu , & Bateau_Pirate2, & A_Boulet); + + Boat Bateau_Pirate3; + Object Pirate3; + Pirate3.ORender->SetRender(A_Bateau_Grade1 ); + BoatControlPirate * Pirate3_Script = new BoatControlPirate; + Pirate3.AffectScript(Pirate3_Script); + Pirate3_Script->Initialisation(& VentJeu , & Bateau_Pirate3, & A_Boulet); + + Boat Bateau_Pirate4; + Object Pirate4; + Pirate4.ORender->SetRender(A_Bateau_Grade2 ); + BoatControlPirate * Pirate4_Script = new BoatControlPirate; + Pirate4.AffectScript(Pirate4_Script); + Pirate4_Script->Initialisation(& VentJeu , & Bateau_Pirate4, & A_Boulet); + + Boat Bateau_Pirate5; + Object Pirate5; + Pirate5.ORender->SetRender(A_Bateau_Grade2 ); + BoatControlPirate * Pirate5_Script = new BoatControlPirate; + Pirate5.AffectScript(Pirate5_Script); + Pirate5_Script->Initialisation(& VentJeu , & Bateau_Pirate5, & A_Boulet); + + Boat Bateau_Pirate6; + Object Pirate6; + Pirate6.ORender->SetRender(A_Bateau_Grade3 ); + BoatControlPirate * Pirate6_Script = new BoatControlPirate; + Pirate6.AffectScript(Pirate6_Script); + Pirate6_Script->Initialisation(& VentJeu , & Bateau_Pirate6, & A_Boulet); + + Boat Bateau_Pirate7; + Object Pirate7; + Pirate7.ORender->SetRender(A_Bateau_Grade3 ); + BoatControlPirate * Pirate7_Script = new BoatControlPirate; + Pirate7.AffectScript(Pirate7_Script); + Pirate7_Script->Initialisation(& VentJeu , & Bateau_Pirate7, & A_Boulet); + + Boat Bateau_Pirate8; + Object Pirate8; + Pirate8.ORender->SetRender(A_Bateau_Grade3 ); + BoatControlPirate * Pirate8_Script = new BoatControlPirate; + Pirate8.AffectScript(Pirate8_Script); + Pirate8_Script->Initialisation(& VentJeu , & Bateau_Pirate8, & A_Boulet); + + Boat Bateau_Pirate9; + Object Pirate9; + Pirate9.ORender->SetRender(A_Bateau_Grade4 ); + BoatControlPirate * Pirate9_Script = new BoatControlPirate; + Pirate9.AffectScript(Pirate9_Script); + Pirate9_Script->Initialisation(& VentJeu , & Bateau_Pirate9, & A_Boulet); + + switch(stage) + { + case 1: + Pirate1.OTransforms->SetXY(50 * 12,( 100 - 54) * 12);//Placement des pirates sur la map. + Pirate2.OTransforms->SetXY(17 * 12,( 100 - 72) * 12); + Pirate3.OTransforms->SetXY(16 * 12,( 100 - 34) * 12 ); + + Game.AddObject( & Pirate1);//Ajout des pirates au moteur. + Game.AddObject( & Pirate2); + Game.AddObject( & Pirate3); + + Bateau_Script->objectifmax = 3; + + HistoireStage1(); + + break; + + case 2: + Pirate1.OTransforms->SetXY(50 * 12,( 100 - 54) * 12); + Pirate2.OTransforms->SetXY(17 * 12,( 100 - 72) * 12); + Pirate3.OTransforms->SetXY(16 * 12,( 100 - 34) * 12 ); + Pirate4.OTransforms->SetXY(30 * 12,( 100 - 20) * 12); + Pirate5.OTransforms->SetXY(60 * 12,( 100 - 70) * 12); + Pirate6.OTransforms->SetXY(0 * 12,( 100 - 80) * 12 ); + + Game.AddObject( & Pirate1); + Game.AddObject( & Pirate2); + Game.AddObject( & Pirate3); + Game.AddObject( & Pirate4); + Game.AddObject( & Pirate5); + Game.AddObject( & Pirate6); + + Bateau_Script->objectifmax = 6; + + HistoireStage2(); + break; + case 3: + + Pirate1.OTransforms->SetXY(54 * 12,( 100 - 54) * 12); + Pirate2.OTransforms->SetXY(24 * 12,( 100 - 72) * 12); + Pirate3.OTransforms->SetXY(39 * 12,( 100 - 23) * 12 ); + Pirate4.OTransforms->SetXY(8 * 12,( 100 - 40) * 12); + Pirate5.OTransforms->SetXY(68 * 12,( 100 - 26) * 12); + Pirate6.OTransforms->SetXY(49* 12,( 100 - 93) * 12 ); + Pirate7.OTransforms->SetXY(4 * 12,( 100 - 43) * 12); + Pirate8.OTransforms->SetXY(13 * 12,( 100 - 4) * 12); + Pirate9.OTransforms->SetXY(40 * 12,( 100 - 95) * 12 ); + + Game.AddObject( & Pirate1); + Game.AddObject( & Pirate2); + Game.AddObject( & Pirate3); + Game.AddObject( & Pirate4); + Game.AddObject( & Pirate5); + Game.AddObject( & Pirate6); + Game.AddObject( & Pirate7); + Game.AddObject( & Pirate8); + Game.AddObject( & Pirate9); + + Bateau_Script->objectifmax = 9; + + HistoireStage3(); + break; + } + + //************Lancement du jeu************// + + Game.Game(); // Lancement du jeu. + + return 1; + +} + +extern "C" +{ +int AddIn_main(int isAppli, unsigned short OptionNum) +{ + Menu(); + return 1; +} + + +#pragma section _BR_Size +unsigned long BR_Size; +#pragma section + + +#pragma section _TOP + +int InitializeSystem(int isAppli, unsigned short OptionNum) +{ + return INIT_ADDIN_APPLICATION(isAppli, OptionNum); +} + +#pragma section +} +