aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-04-06 09:50:41 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-04-06 09:50:41 +0000
commit8e1f9ec0df36e335dad7cfe4f091260b351777a2 (patch)
tree585f71dc0f14302be0787cf561a7a1414eaab5ca
parentd812e93dec4bcb81c2b5226b14c54dacf4fb860d (diff)
downloadbullet-lab-remix-8e1f9ec0df36e335dad7cfe4f091260b351777a2.tar.xz
Start menu rewrite...
Add information about the built time.
-rwxr-xr-xCHANGELOG.TXT4
-rwxr-xr-xVERSION.TXT2
-rw-r--r--global.h42
-rw-r--r--levels.h4
-rw-r--r--main.cpp37
-rw-r--r--menus.h89
6 files changed, 159 insertions, 19 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT
index 9031a04..63fb8fc 100755
--- a/CHANGELOG.TXT
+++ b/CHANGELOG.TXT
@@ -8,6 +8,10 @@ Random segmentation fault in "Hyper-threading".(seen only once,
can not reproduce now...)
Pre-Released versions:
+0.9.1-0_PR (r81)
+Start menu rewrite...
+Add information about the built time.
+
0.9.1-0_PR (r80)
Remove "high FPS mode", it won't reach 500 FPS on my computer any
more. Replace it with Vsync mode.
diff --git a/VERSION.TXT b/VERSION.TXT
index fa00a85..15ce1ef 100755
--- a/VERSION.TXT
+++ b/VERSION.TXT
@@ -1 +1 @@
-0.9.1-0_PR (r80) \ No newline at end of file
+0.9.1-0_PR (r81) \ No newline at end of file
diff --git a/global.h b/global.h
index 6a59827..6aa4a36 100644
--- a/global.h
+++ b/global.h
@@ -30,7 +30,7 @@ int Current_Position;//Where we are now
13: Options scene
14: Player Profile scene
*/
-HTEXTURE SprSheet,TexTitle,TexCredits;
+HTEXTURE SprSheet,TexTitle,TexCredits,MenuTex;
/*
Texture Mapping:
SprSheet:ss.png
@@ -60,6 +60,19 @@ Ribbon Module 151,264,2,8
Multiplier"+1" 0,272,48,48
Text:blnsns.png
"Multiplier bonus!" 0,235,163,21
+Menus and titles: menus.png
+Menu items...
+Classic Mode 0,0,256,128
+Assessment Mode 256,0,256,128
+Free Play Mode 0,128,256,128
+Titles...
+Select a Mode 256,128,256,64
+Options 256,192,256,64
+Player Preference 0,256,256,64
+You Are Dead! 128,256,256,64
+It Ends Here! 0,320,256,64
+Left Arrow 256,320,26,15
+Right Arrow 256,335,26,15
*/
enum TColors
{green=0,blue,yellow,purple,red,white,dblue,orange,grey,circle,COLOR_COUNT};
@@ -261,7 +274,7 @@ bool Dis8ref,t8special;
int frameskips=0,stepskips=0;
bool IfCallLevel,IfShowTip,FadeTip,PlayerSplit;
RandomEngine re;
-hgeFont *TipFont;
+hgeFont *TipFont,*MenuFont;
char lasttip[200];
int whicnt,whrcnt,shots,clrusg;
bool yelattrib,Complete;
@@ -288,8 +301,31 @@ noHideConsole,
fFristStartUp,fFast;
int startLvl,startPrt,fFullScreen;
char alterLog[64];
+#ifdef WIN32
+static const int arFilecount=17;
+static const char* archive[]={
+"./Resources/b_diff.png",
+"./Resources/b_inter.png",
+"./Resources/b_null.png",
+"./Resources/e_sflake.png",
+"./Resources/e_skyitem.png",
+"./Resources/blnsns.png",
+"./Resources/charmap.fnt",
+"./Resources/ss.png",
+"./Resources/title.png",
+"./Resources/credits.png",
+"./Resources/b_leaves.png",
+"./Resources/e_leaf.png",
+"./Resources/tap.ogg",
+"./Resources/Music/BLR2_TR01.ogg",
+"./Resources/Music/BLR2_TR07.ogg",
+"./Resources/Music/BLR2_TR09.ogg",
+"./Resources/Music/CanonTechno.ogg"
+};
+#endif
//static const char* GLOBAL_H_FN="global.h";
-static const char* BLRVERSION="0.9.1-0_PR (r80)";
+static const char* BLRVERSION="0.9.1-0_PR (r81)";
+static const char* BuiltDate=__DATE__;
void Throw(char *Filename,char *Info)
{
diff --git a/levels.h b/levels.h
index 6cdac2f..97218b2 100644
--- a/levels.h
+++ b/levels.h
@@ -4152,12 +4152,12 @@ void Levelm2Part26()
{
if(re.NextInt(0,2))
{
- CreateBullet2(400+re.NextDouble(-50,50),300+re.NextDouble(-50,50),re.NextDouble(4,7),re.NextDouble(-pi,pi),true);
+ CreateBullet2(400+re.NextDouble(-50,50),300+re.NextDouble(-50,50),re.NextDouble(4,8),re.NextDouble(-pi,pi),true);
}
else
{
vector2d pos=vector2d(400+re.NextDouble(-50,50),300+re.NextDouble(-50,50));
- double spd=re.NextDouble(4,7),dir=re.NextDouble(-pi,pi),ran=re.NextDouble(-pi,pi);
+ double spd=re.NextDouble(4,8),dir=re.NextDouble(-pi,pi),ran=re.NextDouble(-pi,pi);
for(int i=0;i<6;++i)
CreateBullet2(pos.x+10*sin(ran+i*(pi/3)),pos.y+10*cos(ran+i*(pi/3)),spd,dir,true);
CreateBullet2(pos.x,pos.y,spd,dir,true);
diff --git a/main.cpp b/main.cpp
index 81466e6..e1c23f8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -74,9 +74,9 @@ void firststartup()
{
if (MessageBoxA(NULL,"It seems that you are running BLR for the First time!\nLet's do some \
basic settings first!\n\nUse vsync??","First Start Up",0x00000024)==6)
- fpslvl=0;
+ fpslvl=2;
else
- fpslvl=1;
+ fpslvl=0;
if (MessageBoxA(NULL,"Enable Fullscreen?","First Start Up",0x00000024)==6)
tfs=1;
else
@@ -91,7 +91,7 @@ basic settings first!\n\nUse vsync??","First Start Up",0x00000024)==6)
#ifndef WIN32
void firststartup()
{
- fpslvl=1;
+ fpslvl=0;
tfs=0;
diffkey=false;
plrspd=3;plrslospd=3;clrbns=clrmode=0;
@@ -626,13 +626,22 @@ bool FrameFunc()
float dt=hge->Timer_GetDelta();
static float t=0.0f;
float tx,ty;
- int id;
- static int lastid=0;
- if (hge->Input_GetKeyState(HGEK_ESCAPE)&&Current_Position==0) { lastid=5; gui->Leave(); }
+ //int id;
+ //static int lastid=0;
+ //if (hge->Input_GetKeyState(HGEK_ESCAPE)&&Current_Position==0) { lastid=5; gui->Leave(); }
if (Current_Position==1&&hge->Input_GetKeyState(HGEK_ESCAPE))PauseGUI_Init();
+ if (mainMenu.isActive())mainMenu.Update();
if (Current_Position==0)
{
- id=gui->Update(dt);
+ if(hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT
+ ||hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT)
+ {
+ switch(mainMenu.GetSelected())
+ {
+ case 0:Current_Position=3;StartGUI_Init();mainMenu.Leave();break;
+ }
+ }
+ /*id=gui->Update(dt);
if(id == -1)
{
switch(lastid)
@@ -657,7 +666,7 @@ bool FrameFunc()
case 5: return true;
}
}
- else if(id) { lastid=id; gui->Leave(); }
+ else if(id) { lastid=id; gui->Leave(); }*/
}
if (Current_Position==3)StartGUI_FrameFnk();
if (Current_Position==5)DeathGUI_FrameFnk();
@@ -689,10 +698,11 @@ bool FrameFunc()
if (Current_Position==0||Current_Position==3||Current_Position==8||
Current_Position==9||Current_Position==10||Current_Position==13||Current_Position==14)
{
- titlespr->Render(160,0);
- if (Current_Position==0)
- gui->Render();
+ //titlespr->Render(160,0);
+ //if (Current_Position==0)gui->Render();
+ //mainMenu.Render();
}
+ if(mainMenu.isActive())mainMenu.Render();
if (Current_Position==3)
StartGUI->Render();
if (Current_Position==1||Current_Position==2||Current_Position==5||Current_Position==11||Current_Position==12)
@@ -847,6 +857,7 @@ void parseArgs(int argc,char *argv[])
if(!strcmp(argv[i],"--version"))
{
printf("Bullet Lab Remix II %s\n",BLRVERSION);
+ printf("Built Date: %s",BuiltDate);
exit(0);
}
bool valid=false;
@@ -913,6 +924,7 @@ int main(int argc,char *argv[])
hge->System_Log("%s: Build: Unix build",MAIN_SRC_FN);
#endif
hge->System_Log("%s: Version: %s",MAIN_SRC_FN,BLRVERSION);
+ hge->System_Log("%s: Built Date: %s",MAIN_SRC_FN,BuiltDate);
#ifdef WIN32
if (_mkdir("./Resources")!=0||_mkdir("./Resources/Music")!=0)
Error("Cannot decompress resources!\nDetailed Information: An error occured while creating folder.\n\nTry restarting the game.");
@@ -1007,6 +1019,7 @@ int main(int argc,char *argv[])
TSflake=hge->Texture_Load("./Resources/e_sflake.png");
TexTitle=hge->Texture_Load("./Resources/title.png");
TexCredits=hge->Texture_Load("./Resources/credits.png");
+ MenuTex=hge->Texture_Load("./Resources/menus.png");
sky.Init();
snd=hge->Effect_Load("./Resources/tap.ogg");
titlespr=new hgeSprite(TexTitle,0,0,640,320);
@@ -1035,6 +1048,7 @@ int main(int argc,char *argv[])
if(!rbPanelFont.Init("/usr/share/fonts/truetype/freefont/FreeMono.ttf",18))return 1;
#endif
fnt=new hgeFont("./Resources/charmap.fnt");
+ MenuFont=new hgeFont("./Resources/charmap.fnt");
TipFont=new hgeFont("./Resources/charmap.fnt");
MultFnt=new hgeFont("./Resources/charmap.fnt");
spr=new hgeSprite(SprSheet,216,0,24,24);
@@ -1052,6 +1066,7 @@ int main(int argc,char *argv[])
towerspr[i]=new hgeSprite(SprSheet,a.x,a.y,a.w,a.h);
towerspr[i]->SetHotSpot(22,22);bulletspr[i]->SetColor(0x80FFFFFF);
}
+ mainMenu.Init_Once();mainMenu.Init();
gui=new hgeGUI();
gui->AddCtrl(new hgeGUIMenuItem(1,fnt,snd,400,200,0.0f,"Start"));
gui->AddCtrl(new hgeGUIMenuItem(2,fnt,snd,400,240,0.1f,"Highscores && Records"));
diff --git a/menus.h b/menus.h
index f42ae34..57e88ff 100644
--- a/menus.h
+++ b/menus.h
@@ -1,10 +1,95 @@
//Chrisoft Bullet Lab Remix HGE
//Menu Implementations
//Copyright Chrisoft 2014
-//[Perfect Freeze]: Code for menus won't change... until ...?
+//Now this is being rewritten...
// --Announcement from Chirsno
//static const char* MENUS_H_FN="menus.h";
-
+//Here's where new code grows...
+void ConfigureQuad(hgeQuad *quad,double x,double y,double w,double h)
+{
+ quad->tex=0;quad->blend=BLEND_ALPHABLEND;
+ quad->v[0].tx=0;quad->v[0].ty=0;
+ quad->v[1].tx=1;quad->v[1].ty=0;
+ quad->v[2].tx=1;quad->v[2].ty=1;
+ quad->v[3].tx=0;quad->v[3].ty=1;
+ quad->v[0].x=x;quad->v[0].y=y;
+ quad->v[1].x=x+w;quad->v[1].y=y;
+ quad->v[2].x=x+w;quad->v[2].y=y+h;
+ quad->v[3].x=x;quad->v[3].y=y+h;
+}
+static const char* MMStr[]={
+"Start",
+"Highscore",
+"Options",
+"About",
+"Exit"
+};
+class MainMenu
+{
+private:
+ bool active,onIn,onOut;
+ int selected;
+ double xoffset,yoffset,dyoffset;
+ hgeSprite *PL,*PR;
+ hgeQuad UpperGradient,LowerGradient;
+public:
+ bool isActive(){return active;}
+ int GetSelected(){return selected;}
+ void Init_Once()
+ {
+ PR=new hgeSprite(MenuTex,256,320,26,15);
+ PL=new hgeSprite(MenuTex,256,335,26,15);
+ }
+ void Init()
+ {
+ xoffset=-200;onIn=true;active=true;
+ selected=0;dyoffset=yoffset=-selected*30;
+ ConfigureQuad(&UpperGradient,xoffset-140,100,320,50);
+ UpperGradient.v[0].col=UpperGradient.v[1].col=0xFF888820;
+ UpperGradient.v[2].col=UpperGradient.v[3].col=0x00888820;
+ ConfigureQuad(&LowerGradient,xoffset-140,300,320,100);
+ LowerGradient.v[0].col=LowerGradient.v[1].col=0x00888820;
+ LowerGradient.v[2].col=LowerGradient.v[3].col=0xFF888820;
+ }
+ void Leave(){onOut=true;}
+ void Update()
+ {
+ if(onIn)
+ {
+ xoffset+=hge->Timer_GetDelta()*1600;
+ if(xoffset>=650)xoffset=650,onIn=false;
+ }
+ if(onOut)
+ {
+ xoffset+=hge->Timer_GetDelta()*1600;
+ if(xoffset>=850)active=onOut=false;
+ }
+ ConfigureQuad(&UpperGradient,xoffset-140,250,320,100);
+ ConfigureQuad(&LowerGradient,xoffset-140,400,320,110);
+ if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected;
+ if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<5-1)++selected;
+ yoffset=-selected*30;
+ if(fabs(dyoffset-yoffset)<0.2)dyoffset=yoffset;
+ if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*200;
+ if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*200;
+ }
+ void Render()
+ {
+ for(int i=0;i<5;++i)
+ {
+ double calcy=i*30+dyoffset+360;
+ if(calcy>249.9&&calcy<500.1)
+ MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,MMStr[i]);
+ }
+ PR->Render(110+xoffset,370);
+ PL->Render(-30+xoffset,370);
+ hge->Gfx_RenderQuad(&UpperGradient);
+ hge->Gfx_RenderQuad(&LowerGradient);
+ titlespr->Render(160,0);
+ }
+}mainMenu;
+//==================================================================================
+//Here's where old code dies...
hgeGUI *StartGUI,*DeathGUI,*CompleteGUI,*HighScoreGUI;
hgeGUI *HSViewGUI,*HSDetailGUI,*PauseGUI,*BkTTitleGUI;
hgeGUI *OptionsGUI,*PlayerProfGUI;