You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
5.1 KiB

#include "..\C-Engine\CHeader.hpp"
#include"BoatControl.hpp"
#include"EngineGUI.hpp"
extern "C"
{
#include <math.h>
}
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;
}