From 63832a6bea48ad70b3507ee2d39036b81243d567 Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Fri, 16 May 2014 02:45:02 +0000 Subject: Add built-in help. Now the pause menu should be fixed... Compress resources again. --- ChangeLog | 10 +++++----- VERSION | 2 +- global.h | 10 +++++++--- hgeft.cpp | 2 +- levels.h | 6 +++--- main.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- menus.h | 13 +++++++------ 7 files changed, 78 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0365d96..635f7e9 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,22 +8,22 @@ Tests. Wishlist? Known bugs: -Return to game in pause menu are sometimes broken. (It seldom happens, and is -very hard to catch!) One part of Level 3 fails randomly (really randomly?). -~~infinity CLR~~(debug purpose. I can't pass those levels with out -this) Wishlist: Make more data stored in score.cfg. Replace some boring levels. -Built-in help pages. In-game music bring back. ~~Now Playing(Music Room)~~ ~~BLR script virtual machine~~(long long-term! probably the core of next BLR.) Pre-Released versions: +0.9.1-2 (r91) +Add built-in help. +Now the pause menu should be fixed... +Compress resources again. + 0.9.1-1 (r90) Fix a bug in the credit scene. Now the pause menu shouldn't be broken now...(It's so hard to reproduce diff --git a/VERSION b/VERSION index 8cc5770..c7ef897 100755 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.1-1 (r90) \ No newline at end of file +0.9.1-2 (r91) \ No newline at end of file diff --git a/global.h b/global.h index 5776e5c..9f7a894 100644 --- a/global.h +++ b/global.h @@ -28,8 +28,9 @@ int Current_Position;//Where we are now 12: BackToTitle Confirmation 13: Options scene 14: Player Profile scene +15: Help scene */ -HTEXTURE SprSheet,TexTitle,TexCredits,MenuTex; +HTEXTURE SprSheet,TexTitle,TexCredits,MenuTex,HelpTex; /* Texture Mapping: SprSheet:ss.png @@ -86,6 +87,7 @@ bool DisableAllTower; bool DisablePlayer; bool LOWFPS,diffkey,showalloc; int VidMode=-1; +hgeTTFont rbPanelFont; inline double GetDist(vector2d,vector2d); class Bullet { @@ -267,7 +269,6 @@ double clockrot,deltarot,deltadelta; double whirot,dwhirot; hgeSprite *playerspr; DWORD DBGColor; -hgeTTFont rbPanelFont; int frameleft,infofade; int level,part,clrtime,clrbns; int coll,semicoll,mode,dsmc,restarts; @@ -293,6 +294,9 @@ int effskp=0; hgeSprite *Credits,*CreditsRail; int creditsp;double creditfly,creditacc,credbrk; bool credstop,creddone; +hgeSprite *Helpspr,*NHelpspr,*HlpL,*HlpR; +double Helpscroll,Hlpyofst;int Helpslide; +bool hshl; bool tfs; double scale; #ifndef WIN32 @@ -336,7 +340,7 @@ static const char* archive[]={ }; #endif //static const char* GLOBAL_H_FN="global.h"; -static const char* BLRVERSION="0.9.1-1 (r90)"; +static const char* BLRVERSION="0.9.1-2 (r91)"; static const char *months="JanFebMarAprMayJunJulAugSepOctNovDec"; char *parseDate(const char *date) { diff --git a/hgeft.cpp b/hgeft.cpp index ec4e7bc..a5b233a 100644 --- a/hgeft.cpp +++ b/hgeft.cpp @@ -1,7 +1,7 @@ // Freetype2 ext4hge implementations -*- C++ -*- #include "hgeft.h" static const char* HGEFT_SRC_FN="hgeft.cpp"; -void hgeTTChar::Free(){if(quad.tex)hge->Texture_Free(quad.tex),quad.tex=NULL;} +void hgeTTChar::Free(){if(quad.tex)hge->Texture_Free(quad.tex),quad.tex=0;} bool hgeTTChar::SetChar(wchar_t ch,FT_Face ttfface) { FT_GlyphSlot slot=ttfface->glyph; diff --git a/levels.h b/levels.h index 4f3e4ec..59b50d3 100644 --- a/levels.h +++ b/levels.h @@ -111,7 +111,7 @@ void Level1Part3() { frameleft=AMinute; if (towcnt!=50&&towcnt!=0)return ClearAll(); - DisableAllTower=false;bulcnt=0;memset(bullet,0,sizeof(bullet)); + DisableAllTower=false;bulcnt=0;free(bullet); if (IfShowTip) { IfShowTip=false; @@ -160,7 +160,7 @@ void Level2Part0() ClearAll(); return; } - bulcnt=0;memset(bullet,0,sizeof(bullet)); + bulcnt=0;free(bullet); DisableAllTower=false; if (IfShowTip) { @@ -339,7 +339,7 @@ void Level3Part0() ClearAll(); return; } - bulcnt=0;memset(bullet,0,sizeof(bullet)); + bulcnt=0;free(bullet); DisableAllTower=false; if (IfShowTip) { diff --git a/main.cpp b/main.cpp index d8cdd4b..e083558 100644 --- a/main.cpp +++ b/main.cpp @@ -558,6 +558,45 @@ void AboutScene() Music_Stop(); } } +void HelpScene(bool fake=false) +{ + if(!fake)if(Hlpyofst>0)Hlpyofst-=40;else Hlpyofst=0; + else if(Hlpyofst<400)Hlpyofst+=40;else Hlpyofst=400,hshl=0; + if(Helpslide>1)MenuFont->Render(30,80+Hlpyofst,HGETEXT_LEFT,"Last"), + HlpL->Render(0,85+Hlpyofst); + if(Helpslide<6)MenuFont->Render(770,80+Hlpyofst,HGETEXT_RIGHT,"Next"), + HlpR->Render(775,85+Hlpyofst); + if(Helpscroll==0)Helpspr->Render(0,100+Hlpyofst); + else + { + Helpspr->Render(Helpscroll,100+Hlpyofst); + if(Helpscroll>0)NHelpspr->Render(Helpscroll-800,100+Hlpyofst); + else NHelpspr->Render(Helpscroll+800,100+Hlpyofst); + if(Helpscroll>0)Helpscroll+=30;else Helpscroll-=30; + if(fabs(Helpscroll)>=800) + { + Helpscroll=0;Helpspr->SetTextureRect(0,400*(Helpslide-1),800,400); + } + } + if(fake)return; + if(Helpscroll==0) + { + if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT&&Helpslide>1) + { + --Helpslide;NHelpspr->SetTextureRect(0,400*(Helpslide-1),800,400); + Helpscroll=1; + } + if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT&&Helpslide<6) + { + ++Helpslide;NHelpspr->SetTextureRect(0,400*(Helpslide-1),800,400); + Helpscroll=-1; + } + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT) + { + Current_Position=0;mainMenu.Init(1000);hshl=1; + } + } +} bool Foclost() { if(Current_Position==1)pauseMenu.Init(-200); @@ -596,6 +635,12 @@ bool FrameFunc() optionMenu.Init(-200); break; case 3: + Current_Position=15; + Helpspr->SetTextureRect(0,0,800,400); + NHelpspr->SetTextureRect(0,400,800,400); + Helpslide=1;Hlpyofst=400;Helpscroll=0; + break; + case 4: Credits->SetHotSpot(300,100); CreditsRail->SetHotSpot(300,100); creditsp=0; @@ -606,7 +651,7 @@ bool FrameFunc() Current_Position=4; mainMenu.Leave(); break; - case 4:break; + case 5:break; } mainMenu.Leave(); return false; @@ -750,6 +795,8 @@ bool FrameFunc() } if (Current_Position==11) { + //I am cornered!! + if(!pauseMenu.isActive())Current_Position=1,DisableAllTower=DisablePlayer=0; if(~PMR) { pauseMenu.Leave(); @@ -900,6 +947,7 @@ bool FrameFunc() if(highScoreMenu.isActive())highScoreMenu.Render(); if(highScoreViewMenu.isActive())highScoreViewMenu.Render(); if(highScoreDetailsMenu.isActive())highScoreDetailsMenu.Render(); + if(Current_Position==15)HelpScene();if(hshl)HelpScene(1); if (Current_Position==0||Current_Position==3||Current_Position==8|| Current_Position==9||Current_Position==10||Current_Position==13||Current_Position==14) { @@ -1175,6 +1223,7 @@ int main(int argc,char *argv[]) TexTitle=hge->Texture_Load("./Resources/title.png"); TexCredits=hge->Texture_Load("./Resources/credits.png"); MenuTex=hge->Texture_Load("./Resources/menus.png"); + HelpTex=hge->Texture_Load("./Resources/help.png"); sky.Init(); snd=hge->Effect_Load("./Resources/tap.ogg"); menuin=hge->Effect_Load("./Resources/menuin.ogg"); @@ -1217,6 +1266,10 @@ int main(int argc,char *argv[]) spr=new hgeSprite(SprSheet,216,0,24,24); Credits=new hgeSprite(TexCredits,0,0,600,200); CreditsRail=new hgeSprite(TexCredits,0,2400,600,200); + Helpspr=new hgeSprite(HelpTex,0,0,800,400); + NHelpspr=new hgeSprite(HelpTex,0,0,800,400); + HlpL=new hgeSprite(MenuTex,256,320,26,15); + HlpR=new hgeSprite(MenuTex,256,335,26,15); for (int ii=0;ii=850)active=onOut=false; } ConfigureQuad(&UpperGradient,xoffset-140,250,320,100); - ConfigureQuad(&LowerGradient,xoffset-140,400,320,110); + ConfigureQuad(&LowerGradient,xoffset-140,420,320,110); if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected,TriggerSound(0); - if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<5-1)++selected,TriggerSound(0); - if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=4,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<6-1)++selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=5,TriggerSound(0); yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; if(dyoffsetTimer_GetDelta()*400; @@ -198,7 +199,7 @@ public: } void Render() { - for(int i=0;i<5;++i) + for(int i=0;i<6;++i) { double calcy=i*30+dyoffset+360; if(calcy>249.9&&calcy<500.1) -- cgit v1.2.3