From 1d6f201ca9e4c2bef5adcfabc6bf09eef4ac7b6b Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Mon, 7 Apr 2014 03:37:56 +0000 Subject: Add missing file menus.png... Finish the start menu rewrite. Modify "Lunatic Lunar", however it's not done... Modify resource unpacking of Windows version. --- CHANGELOG.TXT | 6 +++ VERSION.TXT | 2 +- global.h | 25 +++-------- levels.h | 21 ++++++--- main.cpp | 138 ++++++++++++++++++++++++++++++++++++++-------------------- menus.h | 111 ++++++++++++++++++++++++++++++++++++++-------- 6 files changed, 209 insertions(+), 94 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 63fb8fc..7b4ad32 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -8,6 +8,12 @@ Random segmentation fault in "Hyper-threading".(seen only once, can not reproduce now...) Pre-Released versions: +0.9.1-0_PR (r82) +Add missing file menus.png... +Finish the start menu rewrite. +Modify "Lunatic Lunar", however it's not done... +Modify resource unpacking of Windows version. + 0.9.1-0_PR (r81) Start menu rewrite... Add information about the built time. diff --git a/VERSION.TXT b/VERSION.TXT index 15ce1ef..0486b4b 100755 --- a/VERSION.TXT +++ b/VERSION.TXT @@ -1 +1 @@ -0.9.1-0_PR (r81) \ No newline at end of file +0.9.1-0_PR (r82) \ No newline at end of file diff --git a/global.h b/global.h index 6aa4a36..005ce67 100644 --- a/global.h +++ b/global.h @@ -284,7 +284,7 @@ double mult,lsc; int multbrk,multbat; int frms;double averfps; int plrspd,plrslospd; -int TenSeconds=10000,TwentySeconds=20000,ThirtySeconds=30000,AMinute=60000; +int TenSeconds=600,TwentySeconds=1200,ThirtySeconds=1800,AMinute=3600; int Infinity=1000000000; int effskp=0; hgeSprite *Credits,*CreditsRail; @@ -302,7 +302,7 @@ fFristStartUp,fFast; int startLvl,startPrt,fFullScreen; char alterLog[64]; #ifdef WIN32 -static const int arFilecount=17; +static const int arFilecount=18; static const char* archive[]={ "./Resources/b_diff.png", "./Resources/b_inter.png", @@ -312,6 +312,7 @@ static const char* archive[]={ "./Resources/blnsns.png", "./Resources/charmap.fnt", "./Resources/ss.png", +"./Resources/menus.png", "./Resources/title.png", "./Resources/credits.png", "./Resources/b_leaves.png", @@ -324,7 +325,7 @@ static const char* archive[]={ }; #endif //static const char* GLOBAL_H_FN="global.h"; -static const char* BLRVERSION="0.9.1-0_PR (r81)"; +static const char* BLRVERSION="0.9.1-0_PR (r82)"; static const char* BuiltDate=__DATE__; void Throw(char *Filename,char *Info) @@ -345,23 +346,7 @@ void Error(const char *EC,bool hgecreated=false) hge->Release(); } #ifdef WIN32 - remove("./Resources/b_diff.png"); - remove("./Resources/b_inter.png"); - remove("./Resources/b_null.png"); - remove("./Resources/e_sflake.png"); - remove("./Resources/e_skyitem.png"); - remove("./Resources/blnsns.png"); - remove("./Resources/charmap.fnt"); - remove("./Resources/ss.png"); - remove("./Resources/title.png"); - remove("./Resources/credits.png"); - remove("./Resources/b_leaves.png"); - remove("./Resources/e_leaf.png"); - remove("./Resources/tap.ogg"); - remove("./Resources/Music/BLR2_TR01.ogg"); - remove("./Resources/Music/BLR2_TR07.ogg"); - remove("./Resources/Music/BLR2_TR09.ogg"); - remove("./Resources/Music/CanonTechno.ogg"); + for(int i=0;iSetHotSpot(300,100); - if(hge->Input_GetKeyState(HGEK_Z)||creditsp>11) + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||creditsp>11) { Current_Position=0; - gui->SetFocus(1); + mainMenu.Init(-200); Music_Stop(); - gui->Enter(); } } bool Foclost() @@ -626,33 +625,19 @@ 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(); } if (Current_Position==1&&hge->Input_GetKeyState(HGEK_ESCAPE))PauseGUI_Init(); if (mainMenu.isActive())mainMenu.Update(); + if (startMenu.isActive())startMenu.Update(); if (Current_Position==0) { - if(hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT - ||hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT) + if(!mainMenu.isActive())return true; + 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) - { - case 1:Current_Position=3; StartGUI_Init();gui->Leave();break; - case 2:HighScoreGUI_Init();break; - case 3:OptionsGUI_Init();break; - case 4: - Credits=new hgeSprite(TexCredits,0,0,600,200); + case 0:Current_Position=3;startMenu.Init();mainMenu.Leave();break; + case 3: Credits->SetHotSpot(300,100); - CreditsRail=new hgeSprite(TexCredits,0,2400,600,200); CreditsRail->SetHotSpot(300,100); creditsp=0; Music_Init("./Resources/Music/BLR2_TR09.ogg"); @@ -660,15 +645,84 @@ bool FrameFunc() Music_Play(); creditfly=1200;creditacc=0;credstop=creddone=false; Current_Position=4; - AboutScene(); - lastid=0; + mainMenu.Leave(); break; - case 5: return true; + case 4:mainMenu.Leave();break; + } + return false; + } + } + if (Current_Position==3) + { + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT) + { + startMenu.Leave();mainMenu.Init(800);Current_Position=0; + } + if(hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT) + { + startMenu.Leave(); + switch(startMenu.GetSelected()) + { + case 0: + playerpos.x=400,playerpos.y=400,playerrot=0; + frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=t8special=false; + level=1,part=1;frms=0,averfps=0.0;bsscale=1; + towcnt=bulcnt=0;whrcnt=12;skyactive=false;PlayerSplit=false; + score=0;Mult_Init();//Music_Init("./Resources/Music/CanonTechno.ogg"); + lpst=4625568;lped=9234584;//Music_Play(); + coll=semicoll=clrusg=0;playerLockX=playerLockY=false; + Lock.Init(2);IfShowTip=true;lsc=0; + //Lock.SetTexture(SprSheet,151,264,2,8); + clrrad=pi/2;clrrange=0;re.SetSeed(time(NULL)); + memset(tower,0,sizeof(tower)); + memset(bullet,0,sizeof(bullet)); + Complete=false; + Current_Position=1; + Level1Part1(); + IfCallLevel=true; + mode=1; + break; + case 1: + playerpos.x=400,playerpos.y=400,playerrot=0; + frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=t8special=false; + level=-2,part=0;frms=0,averfps=0.0;bsscale=1;assetime=0; + towcnt=bulcnt=0;whrcnt=12;skyactive=false;PlayerSplit=false; + score=0;Mult_Init();//Music_Init("./Resources/Music/CanonTechno.ogg"); + lpst=4625568;lped=9234584;//Music_Play(); + coll=semicoll=clrusg=0;playerLockX=playerLockY=false; + Lock.Init(2);IfShowTip=true;lsc=0; + //Lock.SetTexture(SprSheet,151,264,2,8); + clrrad=pi/2;clrrange=0;re.SetSeed(time(NULL)); + memset(tower,0,sizeof(tower)); + memset(bullet,0,sizeof(bullet)); + Complete=false; + Current_Position=1; + IfCallLevel=true; + mode=2; + break; + case 2: + playerpos.x=400,playerpos.y=400,playerrot=0; + frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=t8special=false; + level=1,part=1;frms=0,averfps=0.0;bsscale=1; + towcnt=bulcnt=0;whrcnt=12;skyactive=false;PlayerSplit=false; + score=0;Mult_Init();//Music_Init("./Resources/Music/CanonTechno.ogg"); + lpst=4625568;lped=9234584;//Music_Play(); + coll=semicoll=clrusg=0;playerLockX=playerLockY=false; + Lock.Init(2);IfShowTip=true;lsc=0; + //Lock.SetTexture(SprSheet,151,264,2,8); + clrrad=pi/2;clrrange=0;re.SetSeed(time(NULL)); + memset(tower,0,sizeof(tower)); + memset(bullet,0,sizeof(bullet)); + Complete=false; + Current_Position=1; + Level1Part1(); + IfCallLevel=true; + mode=3; + break; } + return false; } - else if(id) { lastid=id; gui->Leave(); }*/ } - if (Current_Position==3)StartGUI_FrameFnk(); if (Current_Position==5)DeathGUI_FrameFnk(); if (Current_Position==6)CompleteGUI_FrameFnk(); if (Current_Position==7)NewHighScoreGUI_FrameFnk(); @@ -695,16 +749,17 @@ bool FrameFunc() hge->Gfx_Clear(SETA(DBGColor,0xFF)); if (skyactive)sky.Update(),sky.Render(); hge->Gfx_RenderQuad(&quad); + if(mainMenu.isActive())mainMenu.Render(); + //if (Current_Position==3)StartGUI->Render(); + if(startMenu.isActive())startMenu.Render(); 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(); //mainMenu.Render(); + titlespr->Render(160,0); } - 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) { //If we are at the main scene or tip scene(which towers and bullets should still appear..) @@ -1052,6 +1107,8 @@ int main(int argc,char *argv[]) TipFont=new hgeFont("./Resources/charmap.fnt"); MultFnt=new hgeFont("./Resources/charmap.fnt"); spr=new hgeSprite(SprSheet,216,0,24,24); + Credits=new hgeSprite(TexCredits,0,0,600,200); + CreditsRail=new hgeSprite(TexCredits,0,2400,600,200); for (int ii=0;iiSetHotSpot(22,22);bulletspr[i]->SetColor(0x80FFFFFF); } - mainMenu.Init_Once();mainMenu.Init(); + mainMenu.Init_Once();mainMenu.Init(-200); + startMenu.Init_Once(); 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")); @@ -1115,23 +1173,7 @@ int main(int argc,char *argv[]) hge->System_Shutdown(); hge->Release(); #ifdef WIN32 - remove("./Resources/b_diff.png"); - remove("./Resources/b_inter.png"); - remove("./Resources/b_null.png"); - remove("./Resources/e_sflake.png"); - remove("./Resources/e_skyitem.png"); - remove("./Resources/blnsns.png"); - remove("./Resources/charmap.fnt"); - remove("./Resources/ss.png"); - remove("./Resources/title.png"); - remove("./Resources/credits.png"); - remove("./Resources/b_leaves.png"); - remove("./Resources/e_leaf.png"); - remove("./Resources/tap.ogg"); - remove("./Resources/Music/BLR2_TR01.ogg"); - remove("./Resources/Music/BLR2_TR07.ogg"); - remove("./Resources/Music/BLR2_TR09.ogg"); - remove("./Resources/Music/CanonTechno.ogg"); + for(int i=0;iTimer_GetDelta()*1600)return (void)(xoffset=650,onIn=false); + if(xoffset<650) xoffset+=hge->Timer_GetDelta()*1600; - if(xoffset>=650)xoffset=650,onIn=false; + else + xoffset-=hge->Timer_GetDelta()*1600; } if(onOut) { @@ -85,9 +88,94 @@ public: PL->Render(-30+xoffset,370); hge->Gfx_RenderQuad(&UpperGradient); hge->Gfx_RenderQuad(&LowerGradient); - titlespr->Render(160,0); } }mainMenu; +class StartMenu +{ +private: + bool active,onIn,onOut; + double xoffset,yoffset,moffset; + int selected; + hgeQuad LeftGradient,RightGradient,LowerGradient; + hgeSprite *clzk,*azmt,*fpmd,*msel; +public: + bool isActive(){return active;} + int GetSelected(){return selected;} + void Init_Once() + { + clzk=new hgeSprite(MenuTex,0,0,256,128); + azmt=new hgeSprite(MenuTex,256,0,256,128); + fpmd=new hgeSprite(MenuTex,0,128,256,128); + msel=new hgeSprite(MenuTex,256,128,256,64); + clzk->SetHotSpot(128,64); + azmt->SetHotSpot(128,64); + fpmd->SetHotSpot(128,64); + } + void Init() + { + active=true;onIn=true;yoffset=275; + selected=0;xoffset=-selected*300;moffset=450; + ConfigureQuad(&LowerGradient,0,400+yoffset,800,120); + LowerGradient.v[0].col=LowerGradient.v[1].col=0x00888820; + LowerGradient.v[2].col=LowerGradient.v[3].col=0xFF888820; + ConfigureQuad(&LeftGradient,0,320+yoffset,100,200); + LeftGradient.v[0].col=LeftGradient.v[3].col=0xFF888820; + LeftGradient.v[1].col=LeftGradient.v[2].col=0x00888820; + ConfigureQuad(&RightGradient,700,320+yoffset,100,200); + RightGradient.v[0].col=RightGradient.v[3].col=0x00888820; + RightGradient.v[1].col=RightGradient.v[2].col=0xFF888820; + } + void Leave(){onOut=true;} + void Update() + { + if(onIn) + { + bool alldone=true; + if(fabs(yoffset-0)Timer_GetDelta()*800) + yoffset=0; + else + alldone=false,yoffset-=hge->Timer_GetDelta()*800; + if(fabs(moffset-0)Timer_GetDelta()*1200) + moffset=0; + else alldone=false,moffset-=hge->Timer_GetDelta()*1200; + if(alldone)onIn=false; + } + if(onOut) + { + bool alldone=true; + if(fabs(yoffset-275)Timer_GetDelta()*800) + yoffset=275; + else + alldone=false,yoffset+=hge->Timer_GetDelta()*800; + if(fabs(moffset-450)Timer_GetDelta()*1200) + moffset=450; + else alldone=false,moffset+=hge->Timer_GetDelta()*800; + if(alldone)onOut=active=false; + } + if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT&&selected>0)--selected; + if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT&&selected<3-1)++selected; + if(fabs(xoffset-(-selected*300))Timer_GetDelta()*1000) + xoffset=-selected*300; + else + { + if(xoffset<-selected*300)xoffset+=hge->Timer_GetDelta()*1000; + if(xoffset>-selected*300)xoffset-=hge->Timer_GetDelta()*1000; + } + ConfigureQuad(&LowerGradient,0,400+yoffset,800,120); + ConfigureQuad(&LeftGradient,0,320+yoffset,100,200); + ConfigureQuad(&RightGradient,700,320+yoffset,100,200); + } + void Render() + { + clzk->Render(400+xoffset,fabs((xoffset+0))*0.075+400+yoffset); + azmt->Render(700+xoffset,fabs((xoffset+300))*0.075+400+yoffset); + fpmd->Render(1000+xoffset,fabs((xoffset+600))*0.075+400+yoffset); + hge->Gfx_RenderQuad(&LowerGradient); + hge->Gfx_RenderQuad(&LeftGradient); + hge->Gfx_RenderQuad(&RightGradient); + msel->Render(0,moffset+200); + } +}startMenu; //================================================================================== //Here's where old code dies... hgeGUI *StartGUI,*DeathGUI,*CompleteGUI,*HighScoreGUI; @@ -145,21 +233,6 @@ void StartGUI_FrameFnk() mode=1; break; case 2: - /*playerpos.x=400,playerpos.y=400,playerrot=0; - frameleft=TenSeconds; - level=1,part=1;frms=0,averfps=0.0;restarts=0;bsscale=1; - towcnt=bulcnt=0; - mode=1; - score=0; - coll=semicoll=clrusg=0; - clrrad=pi/2;clrrange=0; - memset(tower,0,sizeof(tower)); - memset(bullet,0,sizeof(bullet)); - Complete=false; - Refliction=false; - Level1Part1(); - IfCallLevel=true; - break;*/ case 3: playerpos.x=400,playerpos.y=400,playerrot=0; frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=t8special=false; -- cgit v1.2.3