home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2006 July & August
/
PCWorld_2006-07-08_cd.bin
/
temacd
/
planearcade
/
planearcade.exe
/
Tank3.bmp
/
menu.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2004-11-24
|
31KB
|
1,304 lines
#include "Main.h"
//----------------
//Global
//----------------
MENU Menu;
//inicializacia objektov
//------------------------------------------------------------
void MENU::Initialize()
{
//BackGrouund
BackGround.Create((float)Engine.Width+10 ,(float)Engine.Height+10,1);
BackGround.AddFrame("menu/background.bmp",GetColor(1,0,1,0));
EnabledIntro = true;
EnabledMenu = true;
//---------
//Loading
//---------
Progress.Create(32,32,1);
Progress.AddFrame("menu/progress.bmp",GetColor(1,0,1,0));
Progress.RelativeMode = true;
Loading.Create(142,42,1);
Loading.AddFrame("menu/Loading.bmp",GetColor(1,0,1,0));
Loading.RelativeMode = true;
DxFont.Create((int)FTRX(18.0f),FW_BOLD,"Arial");
//---------
//Intro
//---------
TimeIntro = 0.0f;
//logo3D Games
Logo3DGames.Create(384,86,1);
Logo3DGames.AddFrame("menu/logo3DGames.bmp",GetColor(1,0,1,0));
Logo3DGames.RelativeMode = true;
//logo3D PLE
LogoPLE.Create(480,49,1);
LogoPLE.AddFrame("menu/logoPLE.bmp",GetColor(1,0,1,0));
LogoPLE.RelativeMode = true;
//logo becher LogoBecher
LogoBecher.Create(141,152,1);
LogoBecher.AddFrame("menu/LogoBecher.bmp",GetColor(1,0,1,0));
LogoBecher.RelativeMode = true;
//-----------------
//Becher Game
//-----------------
TimeBecherGame = 0.0f;
EnabledBecherGame = false;
BecherGame.Create(189,77,1);
BecherGame.AddFrame("menu/bechergame.bmp",GetColor(1,0,1,0));
BecherGame.RelativeMode = true;
//-----------------
//Menu
//-----------------
//obecne
LogoPlane.Create(265,132,1);
LogoPlane.AddFrame("menu/logoplane.bmp",GetColor(1,0,1));
LogoPlane.RelativeMode = true;
LogoAir.Create(127,132,1);
LogoAir.AddFrame("menu/logoair.bmp",GetColor(1,0,1));
LogoAir.RelativeMode = true;
LogoArcade.Create(331,132,1);
LogoArcade.AddFrame("menu/logoarcade.bmp",GetColor(1,0,1));
LogoArcade.RelativeMode = true;
LogoPilot.Create(463,385,1);
LogoPilot.AddFrame("menu/logopilot.bmp",GetColor(1,0,1));
LogoPilot.RelativeMode = true;
//curzor
Cursor.Create(30,30,1);
Cursor.AddFrame("menu/cursor.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
//main menu
TimeMainMenu = 0.0f;
EnabledMainMenu = false;
ModeMainMenu = 1;
//campaing
Missions.RelativeMode = true;
Missions.Create(64,32,15);
Missions.AddFrame("menu/missions/1.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/2.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/3.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/4.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/5.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/6.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/7.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/8.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/9.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/10.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/11.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/12.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/13.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/14.bmp",GetColor(1,0,1));
Missions.AddFrame("menu/missions/15.bmp",GetColor(1,0,1));
TimeCampaing = 0.0f;
EnabledCampaing = false;
ModeCampaing = 1;
LoadArray();
//credits
TimeCredits = 0.0f;
EnabledCredits = false;
ModeCredits = 1;
CreditsFont.Create((int)FTRX(18.0f),FW_BOLD,"Courier");
LogoCredits.Create(308,300,1);
LogoCredits.AddFrame("menu/credits.bmp",GetColor(1,1,0,1));
LogoCredits.RelativeMode = true;
//campaing
ButtonCampaing.Create(180,40,1);
ButtonCampaing.RelativeMode = true;
if (Language == 0) ButtonCampaing.AddFrame("menu/eng/campaing.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
if (Language == 1) ButtonCampaing.AddFrame("menu/cz/campaing.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
//battle
ButtonBattle.Create(180,40,1);
ButtonBattle.RelativeMode = true;
if (Language == 0) ButtonBattle.AddFrame("menu/eng/battle.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
if (Language == 1) ButtonBattle.AddFrame("menu/cz/battle.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
//credits
ButtonCredits.Create(180,40,1);
ButtonCredits.RelativeMode = true;
if (Language == 0) ButtonCredits.AddFrame("menu/eng/credits.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
if (Language == 1) ButtonCredits.AddFrame("menu/cz/credits.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
//exit
ButtonExit.Create(180,40,1);
ButtonExit.RelativeMode = true;
if (Language == 0) ButtonExit.AddFrame("menu/eng/exit.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
if (Language == 1) ButtonExit.AddFrame("menu/cz/exit.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
//back
ButtonBack.Create(180,40,1);
ButtonBack.RelativeMode = true;
if (Language == 0) ButtonBack.AddFrame("menu/eng/back.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
if (Language == 1) ButtonBack.AddFrame("menu/cz/back.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
//-----------------
//Briefring
//-----------------
EnabledBriefring = false;
LogoBriefring.Create(320,272,1);
ButtonRestart.Create(98,36,1);
ButtonContinue.Create(98,36,1);
ButtonEnd.Create(98,36,1);
if (Language == 0)
{
ButtonRestart.AddFrame("menu/brief/but1eng.jpg",GetColor(1,0,1));
ButtonContinue.AddFrame("menu/brief/but2eng.jpg",GetColor(1,0,1));
ButtonEnd.AddFrame("menu/brief/but3eng.jpg",GetColor(1,0,1));
}
if (Language == 1)
{
ButtonRestart.AddFrame("menu/brief/but1cz.jpg",GetColor(1,0,1));
ButtonContinue.AddFrame("menu/brief/but2cz.jpg",GetColor(1,0,1));
ButtonEnd.AddFrame("menu/brief/but3cz.jpg",GetColor(1,0,1));
}
//-----------------
//GUI
//-----------------
Pilot.Create(72,72,7);
Pilot.AddFrame("menu/gui/pilot1.bmp",GetColor(1,0,1,0));
Pilot.AddFrame("menu/gui/pilot1fire.bmp",GetColor(1,0,1,0));
Pilot.AddFrame("menu/gui/pilot2.bmp",GetColor(1,0,1,0));
Pilot.AddFrame("menu/gui/pilot2fire.bmp",GetColor(1,0,1,0));
Pilot.AddFrame("menu/gui/pilot3.bmp",GetColor(1,0,1,0));
Pilot.AddFrame("menu/gui/pilot3fire.bmp",GetColor(1,0,1,0));
Pilot.AddFrame("menu/gui/pilotdeath.bmp",GetColor(1,0,1,0));
Bevel.Create(148,81,1);
Bevel.AddFrame("menu/gui/bevel.bmp",GetColor(1.0f,1.0f,0,1.0f));
GuiFont.Create(20,FW_BOLD,"Arial");
Kompas.Create(128,128,1);
if (Language == 0)
Kompas.AddFrame("menu/gui/kompaseng.bmp",GetColor(1,0,1));
if (Language == 1)
Kompas.AddFrame("menu/gui/kompascz.bmp",GetColor(1,0,1));
Map.Create(147,147,1);
Map.AddFrame("menu/gui/mapa.bmp",GetColor(1.0f,1.0f,0.0f,1.0f));
Frag.Create(15,15,6);
Frag.AddFrame("menu/gui/frag1.bmp",GetColor(1.0f,1.0f,1.0f,1.0f));
Frag.AddFrame("menu/gui/frag2.bmp",GetColor(1.0f,1.0f,1.0f,1.0f));
Frag.AddFrame("menu/gui/frag3.bmp",GetColor(1.0f,1.0f,1.0f,1.0f));
Frag.AddFrame("menu/gui/frag4.bmp",GetColor(1.0f,1.0f,1.0f,1.0f));
Frag.AddFrame("menu/gui/frag5.bmp",GetColor(1.0f,1.0f,1.0f,1.0f));
Frag.AddFrame("menu/gui/frag6.bmp",GetColor(1.0f,1.0f,1.0f,1.0f));
TBack.Create(96,96,1);
TBack.AddFrame("menu/gui/tbk.bmp",GetColor(1.0f,0.0f,1.0f));
TRuc.Create(26,78,1);
TRuc.AddFrame("menu/gui/truc.bmp",GetColor(1.0f,0.0f,1.0f));
TBomb.Create(96,96,1);
TBomb.AddFrame("menu/gui/bombs.bmp",GetColor(1.0f,0.0f,1.0f));
}
//loadne briefring podla leveli
//-----------------------------------------------------------
void MENU::LoadBriefring(int LevelIndex)
{
char Buffer[80];
if (Language == 0)
sprintf(Buffer,"menu/brief/briefringeng%d.jpg",LevelIndex);
if (Language == 1)
sprintf(Buffer,"menu/brief/briefringcz%d.jpg",LevelIndex);
LogoBriefring.ClearAllFrames();
LogoBriefring.AddFrame(Buffer,GetColor(1,0,1));
}
//vykresli gui
//-----------------------------------------------------------
void MENU::DrawGui()
{
//---------
//Pilot
//---------
Pilot.Frame = 6.0f;
if (SpitFire.Life > 0)
{
if (Input.MouseLeftDown)
Pilot.Frame = 5.0f;
else
Pilot.Frame = 4.0f;
}
if (SpitFire.Life >= 30)
{
if (Input.MouseLeftDown)
Pilot.Frame = 3.0f;
else
Pilot.Frame = 2.0f;
}
if (SpitFire.Life >= 60)
{
if (Input.MouseLeftDown)
Pilot.Frame = 1.0f;
else
Pilot.Frame = 0.0f;
}
//skore
char SScore[80];
if (SpitFire.FakeScore != SpitFire.Score)
SpitFire.FakeScore += 10;
sprintf(SScore,"%d",SpitFire.FakeScore);
//vypocitaj cas
char STime[80];
float Stopky = Level.MaxTime - Level.StageTime;
int Minuty = (int) (Stopky/60.0f);
int Sekundy = ((int)Stopky) % 60;
if (Sekundy > 9)
sprintf(STime,"%d:%d",Minuty,Sekundy);
else
sprintf(STime,"%d:0%d",Minuty,Sekundy);
//---------
//render
//---------
Engine.SetBlendTrans();
//kompas
if (SpitFire.ShowCompas)
{
Kompas.Pos = Get3D((float)Engine.Width/2.0f,(float)Engine.Height,0.0f);
Kompas.Rot = SpitFire.Rot.Y+0.55f;
Kompas.Render();
}
//pilot render
Pilot.Pos = Get3D(Engine.Width-190.0f,40.0f,0.0f);
Pilot.Render();
//ukazovatel zivota
Bevel.Pos = Get3D(Engine.Width-78.0f,40.0f,0.0f);
Bevel.Render();
//otacky motora
TBack.Color.A = 0.8f;
TBack.Pos = Get3D(Engine.Width-80.0f,Engine.Height-60.0f,0.0f);
TBack.Render();
TRuc.Color.A = 0.8f;
TRuc.Rot = (SpitFire_MaxSpeed - SpitFire.Speed + 2.0f)/3.5f-1.4f;
TRuc.Pos = Get3D(Engine.Width-80.0f,Engine.Height-47.0f,0.0f);
TRuc.Render();
//pocet bomb
char sBombs[80];
sprintf(sBombs,"%d",SpitFire.Bombs);
TBomb.Color.A = 0.8f;
TBomb.Pos = Get3D(Engine.Width-180.0f,Engine.Height-60.0f,0.0f);
TBomb.Render();
GuiFont.Print(Engine.Width-188,Engine.Height-50,GetColor(1.0f,0.0f,0.0f,0.0f),sBombs);
//pismo
GuiFont.Print(Engine.Width-135,18,GetColor(1.0f,0.0f,0.0f,0.0f),"Score: ");
GuiFont.Print(Engine.Width-80,18,GetColor(1.0f,0.28f,0.29f,0.25f),SScore);
GuiFont.Print(Engine.Width-135,40,GetColor(1.0f,0.0f,0.0f,0.0f),"Time: ");
GuiFont.Print(Engine.Width-80,40,GetColor(1.0f,0.28f,0.29f,0.25f),STime);
Engine.SetBlendNone();
}
//vykresli mapu
//-----------------------------------------------------------
void MENU::DrawMap()
{
if (SpitFire.ShowMap == false)
return;
//pomocne
int i;
VECTOR3D MS;
float Mierka = 40.0f;
float Rozmer = 64.0f;
//vypocitaj suradnice mapy
VECTOR3D MapSur = Get3D(80.0f,Engine.Height-80.0f,0.0f);
//vypocitaj maticu spitfiri
D3DXMATRIX MatMap;
MatMap = GetMatrix(SpitFire.Pos,Get3D(0.0f,SpitFire.Rot.Y,0.0f),F_Scale);
//zapni blending
Engine.SetBlendTrans();
//vykresli podklad
Map.Color = GetColor(0.5f,1.0f,1.0f,1.0f);
Map.Pos = MapSur;
Map.Render();
//vykresli poziciu hraca
Frag.Pos = MapSur;
Frag.Frame = 3.0f;
Frag.Render();
//---------
//budovy
//---------
for (i=0;i<Max_Structures;i++)
{
if (Level.Structure[i].Life <= 0 ||
Level.Structure[i].Active == false)
continue;
if (Level.Structure[i].Target == false &&
Level.Structure[i].Friendly == false)
continue;
MS = UnTransformPoint(Level.Structure[i].Pos,MatMap);
MS.X = MS.X/Mierka;
MS.Y = MS.Z/Mierka;
MS.Z = 0.0f;
if (MS.X > Rozmer) MS.X = Rozmer;
if (MS.X < -Rozmer) MS.X = -Rozmer;
if (MS.Y > Rozmer) MS.Y = Rozmer;
if (MS.Y < -Rozmer) MS.Y = -Rozmer;
MS.X = MapSur.X + MS.X;
MS.Y = MapSur.Y - MS.Y;
if (Level.Structure[i].Friendly == true) Frag.Frame = 5.0f;
if (Level.Structure[i].Target == true) Frag.Frame = 0.0f;
Frag.Pos = MS;
Frag.Render();
}
//---------
//truck
//---------
for (i=0;i<Max_Trucks;i++)
{
if (Level.Truck[i].Life <= 0 || Level.Truck[i].Active == false)
continue;
MS = UnTransformPoint(Level.Truck[i].Pos,MatMap);
MS.X = MS.X/Mierka;
MS.Y = MS.Z/Mierka;
MS.Z = 0.0f;
if (MS.X > Rozmer) MS.X = Rozmer;
if (MS.X < -Rozmer) MS.X = -Rozmer;
if (MS.Y > Rozmer) MS.Y = Rozmer;
if (MS.Y < -Rozmer) MS.Y = -Rozmer;
MS.X = MapSur.X + MS.X;
MS.Y = MapSur.Y - MS.Y;
//nastavi frame podla toho ci je target
if (Level.Truck[i].Target == true) Frag.Frame = 0.0f;
if (Level.Truck[i].Target == false) Frag.Frame = 1.0f;
Frag.Pos = MS;
Frag.Render();
}
//---------
//MesserSchmitt
//---------
for (i=0;i<Max_MesserSchmitt;i++)
{
if (Level.MesserSchmitt[i].Life <= 0 || Level.MesserSchmitt[i].Active == false)
continue;
MS = UnTransformPoint(Level.MesserSchmitt[i].Pos,MatMap);
MS.X = MS.X/Mierka;
MS.Y = MS.Z/Mierka;
MS.Z = 0.0f;
if (MS.X > Rozmer) MS.X = Rozmer;
if (MS.X < -Rozmer) MS.X = -Rozmer;
if (MS.Y > Rozmer) MS.Y = Rozmer;
if (MS.Y < -Rozmer) MS.Y = -Rozmer;
MS.X = MapSur.X + MS.X;
MS.Y = MapSur.Y - MS.Y;
Frag.Frame = 2.0f;
Frag.Pos = MS;
Frag.Render();
}
//---------
//Volker
//---------
for (i=0;i<Max_Volkers;i++)
{
if (Level.Volker[i].Life <= 0 || Level.Volker[i].Active == false)
continue;
MS = UnTransformPoint(Level.Volker[i].Pos,MatMap);
MS.X = MS.X/Mierka;
MS.Y = MS.Z/Mierka;
MS.Z = 0.0f;
if (MS.X > Rozmer) MS.X = Rozmer;
if (MS.X < -Rozmer) MS.X = -Rozmer;
if (MS.Y > Rozmer) MS.Y = Rozmer;
if (MS.Y < -Rozmer) MS.Y = -Rozmer;
MS.X = MapSur.X + MS.X;
MS.Y = MapSur.Y - MS.Y;
Frag.Frame = 2.0f;
Frag.Pos = MS;
Frag.Render();
}
//---------
//Bombarder
//---------
for (i=0;i<Max_Bombarders;i++)
{
if (Level.Bombarder[i].Life <= 0 || Level.Bombarder[i].Active == false)
continue;
MS = UnTransformPoint(Level.Bombarder[i].Pos,MatMap);
MS.X = MS.X/Mierka;
MS.Y = MS.Z/Mierka;
MS.Z = 0.0f;
if (MS.X > Rozmer) MS.X = Rozmer;
if (MS.X < -Rozmer) MS.X = -Rozmer;
if (MS.Y > Rozmer) MS.Y = Rozmer;
if (MS.Y < -Rozmer) MS.Y = -Rozmer;
MS.X = MapSur.X + MS.X;
MS.Y = MapSur.Y - MS.Y;
Frag.Frame = 4.0f;
Frag.Pos = MS;
Frag.Render();
}
//vypni blending
Engine.SetBlendNone();
}
//refresh intra
//-----------------------------------------------------------
void MENU::RefreshIntro()
{
//casovac
TimeIntro += PowerTime(1.0f);
//background
BackGround.Center(Get3D(0.5f,0.5f,0.0f));
BackGround.Render();
//logo3D Games
Logo3DGames.Pos.Y = 300.0f;
if (TimeIntro < 1000.0f)
Logo3DGames.Pos.X = -300.0f+(TimeIntro/1.45f);
else if (TimeIntro > 3000.0f)
Logo3DGames.Pos.X = -300.0f+((4000.0f-TimeIntro)/1.45f);
Logo3DGames.Render();
//logoPLE
LogoPLE.Pos.X = 400.0f;
if (TimeIntro < 1000.0f)
LogoPLE.Pos.Y = 710.0f-(TimeIntro/7.0f);
else if (TimeIntro > 3000.0f)
LogoPLE.Pos.Y = 710.0f-((4000.0f-TimeIntro)/7.0f);
LogoPLE.Render();
//koniec intra
if (TimeIntro > 4000.0f || Input.KeyPRESS[DIK_SPACE])
{
//EnabledIntro = false;
//EnabledBecherGame = true;
EnabledIntro = false;
EnabledMainMenu = true;
}
}
//refresh becher game loga
//-----------------------------------------------------------
void MENU::RefreshBecherGame()
{
//casovac
TimeBecherGame += PowerTime(0.001f);
//background
BackGround.Center(Get3D(0.5f,0.5f,0.0f));
BackGround.Render();
//becher game
BecherGame.Pos.Y = 300.0f;
BecherGame.Pos.X = 400.0f;
if (TimeBecherGame < 1.0f)
BecherGame.Scale = TimeBecherGame;
else if (TimeBecherGame > 3.0f)
BecherGame.Scale = 4.0f-TimeBecherGame;
Engine.SetBlendTrans();
BecherGame.Render();
Engine.SetBlendNone();
//koniec intra
if (TimeBecherGame > 4.0f || Input.KeyPRESS[DIK_SPACE])
{
EnabledBecherGame = false;
EnabledMainMenu = true;
}
}
//refresh hlavneho menu
//----------------------------------------------------------
void MENU::RefreshMainMenu()
{
//reset farieb buttonov
ButtonCampaing.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
ButtonBattle.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
ButtonExit.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
ButtonCredits.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
ButtonBack.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
//---------
//mody
//---------
//vytahovanie logo
//---------------------
if (ModeMainMenu == 1)
{
TimeMainMenu += PowerTime(0.001f);
if (TimeMainMenu > 1.0f)
{
TimeMainMenu = 1.0f;
ModeMainMenu = 2;
}
}
//vytahovanie buttony
//-----------------------
if (ModeMainMenu == 2)
{
TimeMainMenu += PowerTime(0.001f);
if (TimeMainMenu > 2.0f)
{
TimeMainMenu = 2.0f;
ModeMainMenu = 3;
}
}
//zatahovanie buttony - do campaing
//----------------------------------------
if (ModeMainMenu == 4)
{
TimeMainMenu -= PowerTime(0.001f);
if (TimeMainMenu < 1.0f)
{
ModeMainMenu = 2;
TimeMainMenu = 1.0f;
EnabledMainMenu = false;
EnabledCampaing = true;
}
}
//zatahovanie buttony - do battle
//------------------------------------
if (ModeMainMenu == 5)
{
TimeMainMenu -= PowerTime(0.001f);
if (TimeMainMenu < 0.0f)
{
ModeMainMenu = 1;
TimeMainMenu = 0.0f;
EnabledMenu = false;
//nakonfigurovanie levelu
Level.StartGame(0);
}
}
//zatahovanie buttony - do credits
//-----------------------------------
if (ModeMainMenu == 6)
{
TimeMainMenu -= PowerTime(0.001f);
if (TimeMainMenu < 1.0f)
{
ModeMainMenu = 2;
EnabledMainMenu = false;
EnabledCredits = true;
TimeMainMenu = 1.0f;
}
}
//zatahovanie buttony - do exit
//------------------------------
if (ModeMainMenu == 7)
{
TimeMainMenu -= PowerTime(0.001f);
if (TimeMainMenu < 0.0f)
{
PostQuitMessage(0);
}
}
//stand
//--------------------
if (ModeMainMenu == 3)
{
//campaing
if (ButtonCampaing.MousePick(Input.Mouse) == false)
ButtonCampaing.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
else
{
ButtonCampaing.Color = GetColor(1.0f,0.0f,0.0f,0.0f);
if (Input.MouseLeftPress == true)
ModeMainMenu = 4;
}
//battle
if (ButtonBattle.MousePick(Input.Mouse) == false)
ButtonBattle.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
else
{
ButtonBattle.Color = GetColor(1.0f,0.0f,0.0f,0.0f);
if (Input.MouseLeftPress == true)
ModeMainMenu = 5;
}
//credits
if (ButtonCredits.MousePick(Input.Mouse) == false)
ButtonCredits.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
else
{
ButtonCredits.Color = GetColor(1.0f,0.0f,0.0f,0.0f);
if (Input.MouseLeftPress == true)
ModeMainMenu = 6;
}
//exit
if (ButtonExit.MousePick(Input.Mouse) == false)
ButtonExit.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
else
{
ButtonExit.Color = GetColor(1.0f,0.0f,0.0f,0.0f);
if (Input.MouseLeftPress == true)
ModeMainMenu = 7;
}
}
//--------
//Render
//--------
BackGround.Center(Get3D(0.5f,0.5f,0.0f));
BackGround.Render();
//alias time - prevedie cas celkovy pre jednotlive skupiny
//buttony alebo loga
float LTime = TimeMainMenu; if (LTime>1.0f) LTime = 1.0f;
float BTime = TimeMainMenu-1.0f;
LogoPlane.Pos.X = -300.0f + (LTime)*460.0f;
LogoPlane.Pos.Y = 90.0f;
LogoPlane.Render();
LogoAir.Pos.X = -200.0f + (LTime)*565.0f;
LogoAir.Pos.Y = 500.0f - (LTime)*415.0f;
LogoAir.Render();
LogoArcade.Pos.X = 600.0f ;
LogoArcade.Pos.Y = -70.0f + (LTime)*160.0f;
LogoArcade.Render();
LogoPilot.Pos.X = (1200.0f)-(LTime)*620.0f;
LogoPilot.Pos.Y = 100+(1.0f)*330.0f;
LogoPilot.Render();
LogoBecher.Pos.X = 74.0f ;
LogoBecher.Pos.Y = 500.0f;
if (BTime > 0.0f) LogoBecher.Scale = BTime;
else LogoBecher.Scale = 0.0f;
LogoBecher.Render();
//buttons & mouse
Engine.SetBlendTrans();
ButtonCampaing.Pos.X = -250.0f + (BTime)*460.0f;
ButtonCampaing.Pos.Y = 230.0f;
ButtonCampaing.Render();
ButtonBattle.Pos.X = -250.0f + (BTime)*440.0f;
ButtonBattle.Pos.Y = 280.0f;
ButtonBattle.Render();
ButtonCredits.Pos.X = -250.0f + (BTime)*420.0f;
ButtonCredits.Pos.Y = 330.0f;
ButtonCredits.Render();
ButtonExit.Pos.X = -250.0f + (BTime)*400.0f;
ButtonExit.Pos.Y = 380.0f;
ButtonExit.Render();
//cursor
Cursor.Pos.X = Input.Mouse.X + 15;
Cursor.Pos.Y = Input.Mouse.Y + 15;
Cursor.Render();
Engine.SetBlendNone();
//program info
CreditsFont.Print(20,Engine.Height-((int)FTRX(22.0f)),GetColor(1.0f,0.0f,0.0f,0.0f),
ProgramInfo);
}
//refresh credits
//----------------------------------------------------------
void MENU::RefreshCampaing()
{
//vytahovanie
if (ModeCampaing == 1)
{
TimeCampaing += PowerTime(0.001f);
if (TimeCampaing > 1.0f)
{
ModeCampaing = 2;
TimeCampaing = 1.0f;
}
}
//zatahovanie
if (ModeCampaing == 3)
{
TimeCampaing -= PowerTime(0.001f);
if (TimeCampaing < 0.0f)
{
ModeCampaing = 1;
EnabledMainMenu = true;
EnabledCampaing = false;
TimeCampaing = 0.0f;
}
}
//zatahovanie do hry
if (ModeCampaing == 4)
{
TimeCampaing -= PowerTime(0.001f);
if (TimeCampaing < 0.0f)
{
ModeCampaing = 1;
EnabledMenu = false;
TimeCampaing = 0.0f;
//nakonfigurovanie levelu
Level.StartGame(CampaingLevelIndex);
}
}
//stand by
if (ModeCampaing ==2)
{
//back
if (ButtonBack.MousePick(Input.Mouse) == false)
ButtonBack.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
else
{
ButtonBack.Color = GetColor(1.0f,0.0f,0.0f,0.0f);
if (Input.MouseLeftPress == true)
ModeCampaing = 3;
}
}
//back
BackGround.Center(Get3D(0.5f,0.5f,0.0f));
BackGround.Render();
//render logos
float LTime = TimeMainMenu;
LogoPlane.Pos.X = -300.0f + (LTime)*460.0f;
LogoPlane.Pos.Y = 90.0f;
LogoPlane.Render();
LogoAir.Pos.X = -200.0f + (LTime)*565.0f;
LogoAir.Pos.Y = 500.0f - (LTime)*415.0f;
LogoAir.Render();
LogoArcade.Pos.X = 600.0f ;
LogoArcade.Pos.Y = -70.0f + (LTime)*160.0f;
LogoArcade.Render();
LogoPilot.Pos.X = (1200.0f)-(LTime)*620.0f;
LogoPilot.Pos.Y = 100+(LTime)*330.0f;
LogoPilot.Render();
//program info
CreditsFont.Print(20,Engine.Height-((int)FTRX(22.0f)),GetColor(1.0f,0.0f,0.0f,0.0f),
ProgramInfo);
//Missions
//----------
for (int y=0;y<5;y++)
{
for (int x=0;x<3;x++)
{
Missions.Frame = float (y*3+x);
Missions.Pos.X = (-300.0f + x*80.0f) + TimeCampaing*400.0f;
Missions.Pos.Y = 200.0f + y*70.0f;
if (y*3+x+1 <= MaxMission)
{
Missions.Color = GetColor(1.0f,1.0f,1.0f);
Missions.Render();
if (Missions.MousePick(Input.Mouse) == true &&
Input.MouseLeftPress == true)
{
CampaingLevelIndex = y*3+x+1;
ModeCampaing = 4;
}
}
else
{
Missions.Color = GetColor(0.5f,0.45f,0.30f);
Missions.Render();
}
}
}
Engine.SetBlendTrans();
//buttonback
ButtonBack.Pos.X = 400.0f;
ButtonBack.Pos.Y = 650.0f - (TimeCampaing)*110.0f;
ButtonBack.Render();
//cursor
Cursor.Pos.X = Input.Mouse.X + 15;
Cursor.Pos.Y = Input.Mouse.Y + 15;
Cursor.Render();
Engine.SetBlendNone();
}
//refresh credits
//----------------------------------------------------------
void MENU::RefreshCredits()
{
//vytahovanie
if (ModeCredits == 1)
{
TimeCredits += PowerTime(0.001f);
if (TimeCredits > 1.0f)
{
ModeCredits = 2;
TimeCredits = 1.0f;
}
}
//zatahovanie
if (ModeCredits == 3)
{
TimeCredits -= PowerTime(0.001f);
if (TimeCredits < 0.0f)
{
ModeCredits = 1;
EnabledMainMenu = true;
EnabledCredits = false;
TimeCredits = 0.0f;
}
}
//stand by
if (ModeCredits ==2)
{
//back
if (ButtonBack.MousePick(Input.Mouse) == false)
ButtonBack.Color = GetColor(1.0f,72/255.0f,71/255.0f,58/255.0f);
else
{
ButtonBack.Color = GetColor(1.0f,0.0f,0.0f,0.0f);
if (Input.MouseLeftPress == true)
ModeCredits = 3;
}
}
//back
BackGround.Center(Get3D(0.5f,0.5f,0.0f));
BackGround.Render();
//render logos
float LTime = TimeMainMenu;
LogoPlane.Pos.X = -300.0f + (LTime)*460.0f;
LogoPlane.Pos.Y = 90.0f;
LogoPlane.Render();
LogoAir.Pos.X = -200.0f + (LTime)*565.0f;
LogoAir.Pos.Y = 500.0f - (LTime)*415.0f;
LogoAir.Render();
LogoArcade.Pos.X = 600.0f ;
LogoArcade.Pos.Y = -70.0f + (LTime)*160.0f;
LogoArcade.Render();
LogoPilot.Pos.X = (1200.0f)-(LTime)*620.0f;
LogoPilot.Pos.Y = 100+(LTime)*330.0f;
LogoPilot.Render();
//credits
LogoCredits.Pos.X = -300.0f + (TimeCredits)*500.0f;
LogoCredits.Pos.Y = 340.0f;
LogoCredits.Render();
//mena
if (ModeCredits ==2)
{
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(225.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"Peter Adamcik");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(265.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"Simon Meszaros, Peter Adamcik");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(305.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"Martin Hubacek");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(345.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"www.HS23.tk - for great music, yeaah..");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(365.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"aDuan Music Studio - for great music");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(385.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"Blazke,Denisovi,Swarmovi,Ivantovi,...");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(405.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"bud·cim man₧elkßm...");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(425.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"www.ceskehry.cz - for hosting, support, forum, magazin");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(445.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"forum.animacia.sk - for great people");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(465.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"www.codesampler.com - for great source codes");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(485.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"www.bloguje.cz - for great blog system");
CreditsFont.Print((int)FTRX(80.0f),(int)FTRY(505.0f),GetColor(1.0f,0.0f,0.0f,0.0f),
"Adobe, Discreet - for great software");
}
//program info
CreditsFont.Print(20,Engine.Height-((int)FTRX(22.0f)),GetColor(1.0f,0.0f,0.0f,0.0f),
ProgramInfo);
Engine.SetBlendTrans();
//buttonback
ButtonBack.Pos.X = 400.0f;
ButtonBack.Pos.Y = 650.0f - (TimeCredits)*110.0f;
ButtonBack.Render();
//cursor
Cursor.Pos.X = Input.Mouse.X + 15;
Cursor.Pos.Y = Input.Mouse.Y + 15;
Cursor.Render();
Engine.SetBlendNone();
}
//refresh briefring
//----------------------------------------------------------
void MENU::RefreshBriefring()
{
//zastav zvuky
//--------------
Level.StopAllSounds();
//LogoBriefring
//-------------
if (LogoBriefring.MousePick(Input.Mouse))
LogoBriefring.Color.A = 1.0f;
else
LogoBriefring.Color.A = 1.0f;
LogoBriefring.Center(Get3D(0.5f,0.5f,0.0f));
LogoBriefring.Frame = 0.0f;
Engine.SetBlendTrans();
LogoBriefring.Render();
Engine.SetBlendNone();
//buttonrestart
//-------------
if (ButtonRestart.MousePick(Input.Mouse))
ButtonRestart.Color.A = 1.0f;
else
ButtonRestart.Color.A = 0.6f;
ButtonRestart.Pos.X = Engine.Width/2.0f - 110.0f;
ButtonRestart.Pos.Y = Engine.Height/2.0f + 160.0f;
Engine.SetBlendTrans();
ButtonRestart.Render();
Engine.SetBlendNone();
//buttoncontinue
//-------------
if (ButtonContinue.MousePick(Input.Mouse))
ButtonContinue.Color.A = 1.0f;
else
ButtonContinue.Color.A = 0.6f;
ButtonContinue.Pos.X = Engine.Width/2.0f ;
ButtonContinue.Pos.Y = Engine.Height/2.0f + 160.0f;
Engine.SetBlendTrans();
ButtonContinue.Render();
Engine.SetBlendNone();
//buttonend
//-------------
if (ButtonEnd.MousePick(Input.Mouse))
ButtonEnd.Color.A = 1.0f;
else
ButtonEnd.Color.A = 0.6f;
ButtonEnd.Pos.X = Engine.Width/2.0f + 110.0f;
ButtonEnd.Pos.Y = Engine.Height/2.0f + 160.0f;
Engine.SetBlendTrans();
ButtonEnd.Render();
Engine.SetBlendNone();
//cursor
//-------
Engine.SetBlendTrans();
Cursor.Pos.X = Input.Mouse.X + 15;
Cursor.Pos.Y = Input.Mouse.Y + 15;
Cursor.Render();
Engine.SetBlendNone();
//restart
//---------
if ((ButtonRestart.MousePick(Input.Mouse) == true) &&
(Input.MouseLeftPress == true))
{
Level.StartGame(Level.LevelIndex);
Menu.EnabledBriefring = false;
//aby spitfire nestrielal
SpitFire.BulletTime = -400.0f;
}
//pokracovat v hre
//-----------------
if ((ButtonContinue.MousePick(Input.Mouse) == true) &&
(Input.MouseLeftPress == true))
{
Menu.EnabledBriefring = false;
//aby spitfire nestrielal
SpitFire.BulletTime = -400.0f;
}
//koniec - navrat do menu
//-----------------------
if ((ButtonEnd.MousePick(Input.Mouse) == true) &&
(Input.MouseLeftPress == true))
{
Menu.EnabledBriefring = false;
//aby spitfire nestrielal
SpitFire.BulletTime = -400.0f;
//koniec misie
SpitFire.MissionExit();
}
//koniec - klavesnica
//------------------------
if (Input.KeyPRESS[DIK_RETURN] == true)
{
//koniec briefringu
Menu.EnabledBriefring = false;
}
}
//nacita ktore misie su pristupne
//----------------------------------------------------------
void MENU::LoadArray()
{
FILE *File = NULL;
File = fopen("menu/array.dat","r");
if (File == NULL) LogPrint("Nemozem otvorit array.dat");
fscanf(File,"%d",&MaxMission);
fclose(File);
}
//ulozi ktore misie su pristupne
//----------------------------------------------------------
void MENU::SaveArray(int MaxLevelIndex)
{
if (MaxLevelIndex < MaxMission)
return;
FILE *File = NULL;
File = fopen("menu/array.dat","w");
fprintf(File,"%d",MaxLevelIndex);
MaxMission = MaxLevelIndex;
fclose(File);
}
//Vykresli Loading
//----------------------------------------------------------
void MENU::DrawLoading(int Prog, char *Text)
{
Engine.BeginScene();
//background
BackGround.Center(Get3D(0.5f,0.5f,0.0f));
BackGround.Render();
//loading
Loading.Pos.X = 400.0f;
Loading.Pos.Y = 300.0f;
Loading.Render();
//progress
for(int i=0;i<Prog;i++)
{
Progress.Pos.Y = 350.0f;
Progress.Pos.X = 284.0f+(i*32);
Progress.Render();
}
//skry kurzor
ShowCursor(false);
//font
DxFont.PrintCenter(0,(int)(FTRY(390.0f)),
GetColor(1.0f,0.28f,0.29f,0.25f),Text);
Engine.EndScene();
}
//refresh celeho menu
//----------------------------------------------------------
void MENU::Refresh()
{
//intro
if (EnabledIntro)
RefreshIntro();
//main menu
else if (EnabledMainMenu)
RefreshMainMenu();
//campaing
else if (EnabledCampaing)
RefreshCampaing();
//becher game
else if (EnabledBecherGame)
RefreshBecherGame();
//credits
else if (EnabledCredits)
RefreshCredits();
}