From f71472046334287457a34a6ff19bf53d3aaf557a Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Wed, 23 Apr 2014 11:21:28 +0000 Subject: Disable screenshot when you're entering your honourable name. It's not tested so we could only hope that will work... Add crappy sounds to (part of) the menus. Replace a level in assessment mode. The original one was meanless.. The menu sounds are too crappy... remove them temporarily. However, let's complete the code base so that we won't waste time writing it... --- ChangeLog | 10 ++++++ VERSION | 2 +- global.h | 8 +++-- levels.h | 50 ++++++++++++++--------------- main.cpp | 6 +++- menus.h | 99 +++++++++++++++++++++++++++++++++------------------------- towernbullet.h | 68 +++++++++++++++++++++++++++++++++++++++- 7 files changed, 168 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4610dd4..c9b5669 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,16 @@ Random segmentation fault in "Hyper-threading".(seen only once, can not reproduce now...) Pre-Released versions: +0.9.1-1_PR (r87) +Disable screenshot when you're entering your honourable name. It's +not tested so we could only hope that will work... +Add crappy sounds to (part of) the menus. + +Replace a level in assessment mode. The original one was meanless.. +The menu sounds are too crappy... remove them temporarily. However, +let's complete the code base so that we won't waste time writing +it... + 0.9.1-1_PR (r86) Port highscore view and details menu. Menu rewrite is almost done! Disable select key while transferring. diff --git a/VERSION b/VERSION index 3b378b8..20cc6cd 100755 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.1-1_PR (r86) \ No newline at end of file +0.9.1-1_PR (r87) \ No newline at end of file diff --git a/global.h b/global.h index 2e4b22c..0a6dcf9 100644 --- a/global.h +++ b/global.h @@ -6,7 +6,7 @@ #define MaxRes 80 #define Resd 20.0f HGE *hge=0; -HEFFECT snd; +HEFFECT snd,menuin,menuout; hgeQuad quad; hgeFont *fnt; hgeSprite *spr,*titlespr; @@ -308,7 +308,7 @@ fFristStartUp,fFast; int startLvl,startPrt,fFullScreen; char alterLog[64]; #ifdef WIN32 -static const int arFilecount=18; +static const int arFilecount=20; static const char* archive[]={ "./Resources/b_diff.png", "./Resources/b_inter.png", @@ -324,6 +324,8 @@ static const char* archive[]={ "./Resources/b_leaves.png", "./Resources/e_leaf.png", "./Resources/tap.ogg", +"./Resources/menuin.ogg", +"./Resources/menuout.ogg", "./Resources/Music/BLR2_TR01.ogg", "./Resources/Music/BLR2_TR07.ogg", "./Resources/Music/BLR2_TR09.ogg", @@ -331,7 +333,7 @@ static const char* archive[]={ }; #endif //static const char* GLOBAL_H_FN="global.h"; -static const char* BLRVERSION="0.9.1-0_PR (r85)"; +static const char* BLRVERSION="0.9.1-1_PR (r87)"; static const char* BuiltDate=__DATE__; void Throw(char *Filename,char *Info) diff --git a/levels.h b/levels.h index 1c04cb5..5e39e3d 100644 --- a/levels.h +++ b/levels.h @@ -3690,6 +3690,7 @@ void Levelm2Part8() avacurbrk+=hge->Timer_GetDelta(); if(avacurbrk>avabrk) { + shots=1; for(int i=0;i<200;++i) if (asscircles[i].GetRange()>800||asscircles[i].GetRange()<1e-7) { @@ -3723,15 +3724,13 @@ void Levelm2Part9() FadeTip=false; Current_Position=2; ShowTip("Test 5 - Crossing 2"); - All2pnt(); + for(int i=0;i<200;++i) + if (asscircles[i].GetRange()>1e-7&&asscircles[i].GetRange()<800) + asscircles[i].circ2pnt(); return; } - if (towcnt!=0)return ClearAll(false); if(Current_Position==1) { - for(int i=0;i<200;++i) - if (asscircles[i].GetRange()>1e-7&&asscircles[i].GetRange()<800) - asscircles[i].circ2pnt(); memset(asscircles,0,sizeof(asscircles)); ++part;avabrk=0;avacurbrk=0; } @@ -3742,6 +3741,7 @@ void Levelm2Part10() avacurbrk+=hge->Timer_GetDelta(); if(avacurbrk>avabrk) { + shots=1; for(int i=0;i<200;++i) if (asscircles[i].GetRange()>800||asscircles[i].GetRange()<1e-7) { @@ -3766,6 +3766,7 @@ void Levelm2Part10() } } double assrad; +SELineLaser trap[100]; void Levelm2Part11() { frameleft=Infinity; @@ -3775,43 +3776,38 @@ void Levelm2Part11() IfShowTip=false; FadeTip=false; Current_Position=2; - ShowTip("Test 6 - Fake sink"); - All2pnt(); + ShowTip("Test 6 - Trappy"); + for(int i=0;i<200;++i) + if (asscircles[i].GetRange()>1e-7&&asscircles[i].GetRange()<800) + asscircles[i].circ2pnt(); return; } - if (towcnt!=0)return ClearAll(false); if(Current_Position==1) { - for(int i=0;i<200;++i) - if (asscircles[i].GetRange()>1e-7&&asscircles[i].GetRange()<800) - asscircles[i].circ2pnt(); memset(asscircles,0,sizeof(asscircles)); - ++part;avabrk=0;avacurbrk=0;assrad=0;tbrk=0; + ++part;avabrk=0;avacurbrk=0;tbrk=0;memset(trap,0,sizeof(trap)); } } void Levelm2Part12() { frameleft=Infinity; avacurbrk+=hge->Timer_GetDelta(); - tbrk+=hge->Timer_GetDelta(); + for(int i=0;i<100;++i) + if(trap[i].isActive())trap[i].Update(); if(avacurbrk>avabrk) { - CreateBullet2(400,300,re.NextInt(1,2.5),re.NextDouble(-pi,pi)); - avacurbrk=0; - avabrk=0.05-0.03*assetime/120; - if(avabrk<0.01)avabrk=0.01; - } - if(tbrk>0.05) - { - for(int i=0;i<6;++i) + bool sh=re.NextInt(0,1); + for(int c=0;c<(assetime>30?(assetime-30)/30:1);++c,sh^=1) + for(int i=0;i<100;++i) + if(!trap[i].isActive()) { - int pnt=CreateBullet2(400+500*cos(assrad+i*pi/3),300+500*sin(assrad+i*pi/3),1.5,0,true); - double r2=495.0f*(assetime/120.0f);r2=500-r2; - bullet[pnt].redir(vector2d(400+r2*cos(assrad+i*pi/3),300+r2*sin(assrad+i*pi/3))); - bullet[pnt].limpos=vector2d(400+r2*cos(assrad+i*pi/3),300+r2*sin(assrad+i*pi/3)); - bullet[pnt].extborder=true; + if(sh)trap[i].Init(re.NextInt(10,590),1); + else trap[i].Init(re.NextInt(10,790),0); + break; } - tbrk=0;assrad+=pi/60; + avacurbrk=0; + if(assetime<60)avabrk=3-2*assetime/60.0f; + else avabrk=2.5-(assetime-60)/120.0f; } } double asssrd1; diff --git a/main.cpp b/main.cpp index bae7e80..d0038c1 100644 --- a/main.cpp +++ b/main.cpp @@ -1006,7 +1006,7 @@ bool FrameFunc() fnt->printf(5, 150, HGETEXT_LEFT, "Multiplier: %.2lf",mult); } } - if(hge->Input_GetKeyStateEx(HGEK_S)==HGEKST_HIT)hge->System_Snapshot(); + if(hge->Input_GetKeyStateEx(HGEK_S)==HGEKST_HIT&&Current_Position!=7)hge->System_Snapshot(); hge->Gfx_EndScene(); return false; } @@ -1232,6 +1232,8 @@ int main(int argc,char *argv[]) MenuTex=hge->Texture_Load("./Resources/menus.png"); sky.Init(); snd=hge->Effect_Load("./Resources/tap.ogg"); + menuin=hge->Effect_Load("./Resources/menuin.ogg"); + menuout=hge->Effect_Load("./Resources/menuout.ogg"); titlespr=new hgeSprite(TexTitle,0,0,640,320); playerspr=new hgeSprite(SprSheet,0,24,24,24); playerspr->SetHotSpot(12,12); @@ -1316,6 +1318,8 @@ int main(int argc,char *argv[]) delete bulletspr[i]; if(iEffect_Free(snd);hge->Effect_Free(menuin); + hge->Effect_Free(menuout); hge->Texture_Free(SprSheet);hge->Texture_Free(TLeaf); hge->Texture_Free(quad.tex);hge->Texture_Free(TSflake); hge->Texture_Free(TexTitle);hge->Texture_Free(TexCredits); diff --git a/menus.h b/menus.h index 6f80255..04c69d3 100644 --- a/menus.h +++ b/menus.h @@ -1,10 +1,17 @@ //Chrisoft Bullet Lab Remix HGE //Menu Implementations //Copyright Chrisoft 2014 -//Now this is being rewritten... -// --Announcement from Chirsno //static const char* MENUS_H_FN="menus.h"; -//Here's where new code grows... +//The menu rewrite is almost complete... +void TriggerSound(int type) +{ + switch(type) + { + case 0:hge->Effect_Play(snd);break; + //case 1:hge->Effect_Play(menuin);break; + //case 2:hge->Effect_Play(menuout);break; + } +} void ConfigureQuad(hgeQuad *quad,double x,double y,double w,double h) { quad->tex=0;quad->blend=BLEND_ALPHABLEND; @@ -177,16 +184,16 @@ public: } 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; - if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=4; + 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); yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; if(dyoffsetTimer_GetDelta()*400; if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; if(onIn||onOut)return -1; if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; + return TriggerSound(selected==4?2:1),selected; return -1; } void Render() @@ -270,8 +277,8 @@ public: 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(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT&&selected>0)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); if(fabs(xoffset-(-selected*300))Timer_GetDelta()*1000) xoffset=-selected*300; else @@ -283,8 +290,9 @@ public: ConfigureQuad(&LeftGradient,0,320+yoffset,100,200); ConfigureQuad(&RightGradient,700,320+yoffset,100,200); if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)TriggerSound(2); if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; + return TriggerSound(1),selected; return -1; } void Render() @@ -358,9 +366,9 @@ public: ConfigureQuad(&LowerGradient,xoffset-140,430,500,100); if(!onSwitch) { - if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected; - if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<6-1)++selected; - if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=5; + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected,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; @@ -370,6 +378,9 @@ public: if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT&&hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT)return -1; if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) { + if(selected==5&&!(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT)) + return -1; + TriggerSound(selected==5?2:1); if(onSwitch||onSwitchi)return -1; if(selected<=3) { @@ -394,6 +405,7 @@ public: if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT) { if(onSwitch||onSwitchi)return -1; + TriggerSound(1); if(selected<=3){onSwitchi=true;swoffset=0;} if(selected==0)tfs=!tfs; if(selected==1) @@ -597,10 +609,10 @@ public: if(!onSwitch) { if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0) - --selected==4?--selected:0; + TriggerSound(0),--selected==4?--selected:0; if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<6-1) - ++selected==4?++selected:0; - if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=5; + TriggerSound(0),++selected==4?++selected:0; + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)TriggerSound(0),selected=5; } yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; @@ -610,6 +622,7 @@ public: if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT&&hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT)return -1; if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT) { + TriggerSound(1); if(onSwitch||onSwitchi)return -1; if(selected<=3) { @@ -624,6 +637,7 @@ public: } if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT) { + TriggerSound(1); if(onSwitch||onSwitchi)return -1; if(selected<=3){onSwitchi=true;swoffset=0;} if(selected==0)--plrspd<1?plrspd=5:0; @@ -633,7 +647,7 @@ public: if(selected<=3)return selected; } if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; + return TriggerSound(selected==5?2:1),selected; return -1; } void Render() @@ -822,16 +836,16 @@ public: } ConfigureQuad(&UpperGradient,xoffset-140,190,320,100); ConfigureQuad(&LowerGradient,xoffset-140,340,320,110); - if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected; - if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected; + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; if(dyoffsetTimer_GetDelta()*400; if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; if(onIn||onOut)return -1; if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; - if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT&&!onIn)return 1; + return TriggerSound(1),selected; + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT&&!onIn)return TriggerSound(1),1; return -1; } void Render() @@ -897,15 +911,15 @@ public: } ConfigureQuad(&UpperGradient,xoffset-140,190,320,100); ConfigureQuad(&LowerGradient,xoffset-140,340,320,110); - if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected; - if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected; + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; if(dyoffsetTimer_GetDelta()*400; if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; if(onIn||onOut)return -1; if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; + return TriggerSound(1),selected; return -1; } void Render() @@ -975,15 +989,15 @@ public: } ConfigureQuad(&UpperGradient,xoffset-140,290,600,100); ConfigureQuad(&LowerGradient,xoffset-140,440,600,110); - if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected; - if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected; + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; if(dyoffsetTimer_GetDelta()*400; if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; if(onIn||onOut)return -1; if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; + return TriggerSound(1),selected; return -1; } void Render() @@ -1062,15 +1076,15 @@ public: } ConfigureQuad(&UpperGradient,xoffset-140,390,600,100); ConfigureQuad(&LowerGradient,xoffset-140,540,600,110); - if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected; - if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected; + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; if(dyoffsetTimer_GetDelta()*400; if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; if(onIn||onOut)return -1; if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; + return TriggerSound(1),selected; return -1; } void Render() @@ -1168,6 +1182,7 @@ public: if (key==HGEK_BACKSPACE)namedel(); if (key==HGEK_ENTER) { + TriggerSound(1); InsertHighScore();Leave(); Current_Position=0;mainMenu.Init(-200); /*switch (mode) @@ -1235,16 +1250,16 @@ public: } ConfigureQuad(&UpperGradient,xoffset-140,290,600,100); ConfigureQuad(&LowerGradient,xoffset-140,440,600,110); - if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected; - if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<4-1)++selected; - if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=4-1; + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<4-1)++selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=4-1,TriggerSound(0); yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; if(dyoffsetTimer_GetDelta()*400; if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; if(onIn||onOut)return -1; if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; + return TriggerSound(selected==4-1?2:1),selected; return -1; } void Render() @@ -1308,16 +1323,16 @@ public: } ConfigureQuad(&UpperGradient,xoffset-140,290,600,100); ConfigureQuad(&LowerGradient,xoffset-140,440,600,120); - if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected; - if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<7-1)++selected; - if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=7-1; + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<7-1)++selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=7-1,TriggerSound(0); yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; if(dyoffsetTimer_GetDelta()*400; if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; if(onIn||onOut)return -1; if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; + return TriggerSound(selected==7-1?2:1),selected; return -1; } void Render() @@ -1399,16 +1414,16 @@ public: } ConfigureQuad(&UpperGradient,xoffset-140,290,600,100); ConfigureQuad(&LowerGradient,xoffset-140,440,600,130); - if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected; - if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<(view==1?5:7)-1)++selected; - if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=(view==1?5:7)-1; + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<(view==1?5:7)-1)++selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)TriggerSound(0),selected=(view==1?5:7)-1; yoffset=-selected*30; if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; if(dyoffsetTimer_GetDelta()*400; if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; if(onIn||onOut)return -1; if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) - return selected; + return TriggerSound(selected==(view==1?5:7)-1?2:1),selected; return -1; } void Render() diff --git a/towernbullet.h b/towernbullet.h index 4b8a4f4..3b0ef9c 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -2855,7 +2855,7 @@ public: { vector2d dir=a-b;dir.ToUnitCircle();dir=dis*dir; vector2d x=b; - while(x.x<=-25||x.x>=825||x.y<=-25||x.y>=625) + while(!(x.x<=-25||x.x>=825||x.y<=-25||x.y>=625)) { CreateBullet255(x.x,x.y,10); x=x+dir; @@ -2870,3 +2870,69 @@ public: int stp; double brk; }; +class SELineLaser +{ +private: + LineLaser lsr; + bool active,h; + double brk,x; +public: + bool isActive(){return active;} + void Init(int _x,bool _h) + { + x=_x;h=_h; + if(h) + lsr.InitLine(vector2d(0,x),vector2d(800,x),0,SETA(ColorToDWORD(blue),0x80)); + else + lsr.InitLine(vector2d(x,0),vector2d(x,600),0,SETA(ColorToDWORD(blue),0x80)); + active=true;brk=0.05; + } + void Update() + { + lsr.Process(); + brk-=hge->Timer_GetDelta(); + if(brk<0) + { + brk=0.05; + lsr.SetWidth(lsr.GetWidth()+0.2); + if(lsr.GetWidth()>1)lsr.SetColl(true); + if(lsr.GetWidth()>6) + { + int t=0; + if(!re.NextInt(0,2)) + { + if(h?playerpos.y>x:playerpos.x>x)t=1; + vector2d px; + vector2d dir=h?vector2d(-1,0):vector2d(0,-1);dir=18*dir; + for(int c=0,tt=t;c<2;++c,dir=-1*dir,tt=t^1) + { + px=h?vector2d(playerpos.x,x):vector2d(x,playerpos.y); + if(c)px=px+dir; + while(!(px.x<=-25||px.x>=825||px.y<=-25||px.y>=625)) + { + tt^=1; + int pnt=CreateBullet2(px.x,px.y,0,0); + bullet[pnt].bulletdir=(tt?1:-1)*(h?vector2d(0,1):vector2d(1,0)); + bullet[pnt].limv=3;bullet[pnt].bulletaccel=0.001; + px=px+dir; + } + } + } + else + { + vector2d dir=h?vector2d(-1,0):vector2d(0,-1);dir=18*dir; + vector2d px=h?vector2d(800+re.NextInt(-18,0),x):vector2d(x,600+re.NextInt(-18,0)); + while(!(px.x<=-25||px.x>=825||px.y<=-25||px.y>=625)) + { + t^=1; + int pnt=CreateBullet2(px.x,px.y,0,0); + bullet[pnt].bulletdir=(t?1:-1)*(h?vector2d(0,1):vector2d(1,0)); + bullet[pnt].limv=3;bullet[pnt].bulletaccel=0.001; + px=px+dir; + } + } + active=false; + } + } + } +}; -- cgit v1.2.3