aboutsummaryrefslogtreecommitdiff
path: root/menus.h
diff options
context:
space:
mode:
Diffstat (limited to 'menus.h')
-rw-r--r--menus.h655
1 files changed, 553 insertions, 102 deletions
diff --git a/menus.h b/menus.h
index e9b285c..8c26fdc 100644
--- a/menus.h
+++ b/menus.h
@@ -17,30 +17,83 @@ void ConfigureQuad(hgeQuad *quad,double x,double y,double w,double h)
quad->v[2].x=x+w;quad->v[2].y=y+h;
quad->v[3].x=x;quad->v[3].y=y+h;
}
+int AP_Update(int plrspd,int plrslospd,int clrbns)
+{
+ int res=0;
+ if (plrspd<=4)res+=plrspd*1200;else res+=5000;
+ switch (plrslospd)
+ {
+ case 1:res+=4000;break;
+ case 2:res+=3200;break;
+ case 3:res+=2000;break;
+ case 4:res+=1500;break;
+ case 5:res+=700;break;
+ }
+ switch (clrbns)
+ {
+ case 0:break;
+ case 1:res+=1500;break;
+ case 2:res+=2700;break;
+ case 3:res+=4000;break;
+ case 4:res+=5500;break;
+ }
+ return res;
+}
+void Options_Writeback()
+{
+ freopen("blr.cfg","w",stdout);
+ printf(";CBL");
+ printf("%c",fpslvl==2?1:0);
+ printf("%c",tfs?1:0);
+ printf("%c",VidMode);
+ printf("%c",diffkey?1:0);
+ printf("%c%c%c%c",plrspd,plrslospd,clrbns,clrmode);
+ fclose(stdout);
+}
static const char* MMStr[]={
-"Start",
-"Highscore",
-"Options",
-"About",
-"Exit"
+ "Start",
+ "Highscore",
+ "Options",
+ "About",
+ "Exit"
};
static const char* OMStr[]={
-"Fullscreen",
-"VSync",
-"Clear Range Key",
-"Resolution",
-"Player Preference",
-"Save and Exit",
-"On",
-"Off",
-"X",
-"Z",
-"800x600",
-"640x480",
-"960x720",
-"1024x768",
-"1280x960",
-"?"
+ "Fullscreen",
+ "VSync",
+ "Clear Range Key",
+ "Resolution",
+ "Player Preference",
+ "Save and Exit",
+ "On",
+ "Off",
+ "X",
+ "Z",
+ "800x600",
+ "640x480",
+ "960x720",
+ "1024x768",
+ "1280x960",
+ "?"
+};
+static const char *PPMStr[]={
+ "Moving Speed",
+ "Precise Moving Speed",
+ "Clear Range Bonus",
+ "Clear Range Mode",
+ "Ability Point",
+ "Back",
+ "Expand",
+ "Rotate"
+};
+static const char *PMStr[]={
+ "Paused...",
+ "Return to Game",
+ "Return to Title"
+};
+static const char *RTTMStr[]={
+ "Really?",
+ "I've pressed the wrong key...",
+ "Do return to title!"
};
class MainMenu
{
@@ -62,15 +115,23 @@ public:
xoffset=start;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;
+ UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF);
+ UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00);
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;
+ LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00);
+ LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF);
}
void Leave(){onOut=true;}
int Update()
{
+ if(DBGColor!=0xFF0A0A0A)
+ {
+ for(int i=0;i<4;++i)DBGColor=ColorTransfer(DBGColor,0xFF0A0A0A);
+ UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF);
+ UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00);
+ LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00);
+ LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF);
+ }
if(onIn)
{
if(fabs(xoffset-650)<hge->Timer_GetDelta()*1600)return xoffset=650,onIn=false,-1;
@@ -88,10 +149,11 @@ public:
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;
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;
+ if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset;
+ if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400;
+ if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400;
if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT)
return selected;
return -1;
@@ -135,14 +197,14 @@ public:
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=0x01888820;
- LowerGradient.v[2].col=LowerGradient.v[3].col=0xFF888820;
+ LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00);
+ LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF);
ConfigureQuad(&LeftGradient,0,320+yoffset,100,200);
- LeftGradient.v[0].col=LeftGradient.v[3].col=0xFF888820;
- LeftGradient.v[1].col=LeftGradient.v[2].col=0x01888820;
+ LeftGradient.v[0].col=LeftGradient.v[3].col=SETA(DBGColor,0xFF);
+ LeftGradient.v[1].col=LeftGradient.v[2].col=SETA(DBGColor,0x00);
ConfigureQuad(&RightGradient,700,320+yoffset,100,200);
- RightGradient.v[0].col=RightGradient.v[3].col=0x01888820;
- RightGradient.v[1].col=RightGradient.v[2].col=0xFF888820;
+ RightGradient.v[0].col=RightGradient.v[3].col=SETA(DBGColor,0x00);
+ RightGradient.v[1].col=RightGradient.v[2].col=SETA(DBGColor,0xFF);
}
void Leave(){onOut=true;}
int Update()
@@ -204,14 +266,14 @@ private:
bool active,onIn,onOut,onSwitch,onSwitchi;
int selected;
double xoffset,yoffset,dyoffset,swoffset,moffset;
- hgeSprite *Ribb,*msel;
+ hgeSprite *Ribb,*optt;
hgeQuad UpperGradient,LowerGradient;
public:
bool isActive(){return active;}
void Init_Once()
{
Ribb=new hgeSprite(MenuTex,256,350,64,16);
- msel=new hgeSprite(MenuTex,256,192,256,64);
+ optt=new hgeSprite(MenuTex,256,192,256,64);
Ribb->SetColor(0xCCFFFFFF);
}
void Init(double start)
@@ -219,11 +281,11 @@ public:
xoffset=start;onIn=active=true;onSwitch=onSwitchi=false;
selected=0;dyoffset=yoffset=-selected*30;moffset=350;
ConfigureQuad(&UpperGradient,xoffset-140,250,500,50);
- UpperGradient.v[0].col=UpperGradient.v[1].col=0xFF888820;
- UpperGradient.v[2].col=UpperGradient.v[3].col=0x00888820;
+ UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF);
+ UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00);
ConfigureQuad(&LowerGradient,xoffset-140,430,500,100);
- LowerGradient.v[0].col=LowerGradient.v[1].col=0x00888820;
- LowerGradient.v[2].col=LowerGradient.v[3].col=0xFF888820;
+ LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00);
+ LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF);
}
void Leave(){onOut=true;}
int Update()
@@ -260,11 +322,12 @@ public:
{
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;
}
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;
+ if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset;
+ if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400;
+ if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400;
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)
{
@@ -292,7 +355,7 @@ public:
if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT)
{
if(onSwitch||onSwitchi)return -1;
- if(selected<=2){onSwitch=true;swoffset=100;}
+ if(selected<=3){onSwitchi=true;swoffset=0;}
if(selected==0)tfs=!tfs;
if(selected==1)
{
@@ -303,7 +366,7 @@ public:
if(selected==2)diffkey=!diffkey;
if(selected==3)
{
- --VidMode;onSwitchi=true;swoffset=0;
+ --VidMode;
if(VidMode<0)VidMode=4;
}
return selected;
@@ -321,44 +384,80 @@ public:
MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,OMStr[i]);
if(i==0)
{
- if(!onSwitch||selected!=0)
+ if(!(onSwitch||onSwitchi)||selected!=0)
MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,OMStr[tfs?6:7]);
else
{
- MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
- MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?7:6]);
- MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
- MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?6:7]);
- swoffset-=hge->Timer_GetDelta()*400;
- if(swoffset<0)swoffset=0,onSwitch=false;
+ if(onSwitch)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?7:6]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?6:7]);
+ swoffset-=hge->Timer_GetDelta()*400;
+ if(swoffset<0)swoffset=0,onSwitch=false;
+ }
+ if(onSwitchi)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?6:7]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?7:6]);
+ swoffset+=hge->Timer_GetDelta()*400;
+ if(swoffset>100)swoffset=0,onSwitchi=false;
+ }
}
}
if(i==1)
{
- if(!onSwitch||selected!=1)
+ if(!(onSwitch||onSwitchi)||selected!=1)
MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?6:7]);
else
{
- MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
- MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?7:6]);
- MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
- MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?6:7]);
- swoffset-=hge->Timer_GetDelta()*400;
- if(swoffset<0)swoffset=0,onSwitch=false;
+ if(onSwitch)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?7:6]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?6:7]);
+ swoffset-=hge->Timer_GetDelta()*400;
+ if(swoffset<0)swoffset=0,onSwitch=false;
+ }
+ if(onSwitchi)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?6:7]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?7:6]);
+ swoffset+=hge->Timer_GetDelta()*400;
+ if(swoffset>100)swoffset=0,onSwitchi=false;
+ }
}
}
if(i==2)
{
- if(!onSwitch||selected!=2)
+ if(!(onSwitch||onSwitchi)||selected!=2)
MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,OMStr[diffkey?8:9]);
else
{
- MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
- MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?9:8]);
- MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
- MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?8:9]);
- swoffset-=hge->Timer_GetDelta()*400;
- if(swoffset<0)swoffset=0,onSwitch=false;
+ if(onSwitch)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?9:8]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?8:9]);
+ swoffset-=hge->Timer_GetDelta()*400;
+ if(swoffset<0)swoffset=0,onSwitch=false;
+ }
+ if(onSwitchi)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?8:9]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?9:8]);
+ swoffset+=hge->Timer_GetDelta()*400;
+ if(swoffset>100)swoffset=0,onSwitchi=false;
+ }
}
}
if(i==3)
@@ -389,13 +488,398 @@ public:
}
}
}
- Ribb->RenderEx(xoffset-50,355,0,6,1);
- Ribb->RenderEx(xoffset-50,382,0,6,1);
+ Ribb->RenderEx(xoffset-50,353,0,6,1);
+ Ribb->RenderEx(xoffset-50,380,0,6,1);
hge->Gfx_RenderQuad(&UpperGradient);
hge->Gfx_RenderQuad(&LowerGradient);
- msel->Render(300,moffset+300);
+ optt->Render(300,moffset+300);
}
}optionMenu;
+class PlayerPreferenceMenu
+{
+private:
+ bool active,onIn,onOut,onSwitch,onSwitchi;
+ int selected;
+ double xoffset,yoffset,dyoffset,swoffset,moffset;
+ double shaketime,shakeoffset,shakedelay;
+ hgeSprite *Ribb,*optt;
+ hgeQuad UpperGradient,LowerGradient;
+public:
+ bool isActive(){return active;}
+ void Init_Once()
+ {
+ Ribb=new hgeSprite(MenuTex,256,350,64,16);
+ optt=new hgeSprite(MenuTex,0,256,256,64);
+ Ribb->SetColor(0xCCFFFFFF);
+ }
+ void Init(double start)
+ {
+ xoffset=start;onIn=active=true;onSwitch=onSwitchi=false;
+ selected=0;dyoffset=yoffset=-selected*30;moffset=350;shaketime=0;
+ ConfigureQuad(&UpperGradient,xoffset-140,250,520,50);
+ UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF);
+ UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00);
+ ConfigureQuad(&LowerGradient,xoffset-140,430,520,100);
+ LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00);
+ LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF);
+ }
+ void Leave(){onOut=true;}
+ void Shake(){shaketime=0.2;shakeoffset=10;shakedelay=0.033;}
+ int Update()
+ {
+ if(onIn)
+ {
+ bool alldone=true;
+ if(fabs(xoffset-430)<hge->Timer_GetDelta()*1600)xoffset=430;else
+ {
+ alldone=false;
+ if(xoffset<430)
+ xoffset+=hge->Timer_GetDelta()*1600;
+ else
+ xoffset-=hge->Timer_GetDelta()*1600;
+ }
+ if(fabs(moffset-0)<hge->Timer_GetDelta()*1200)
+ moffset=0;
+ else alldone=false,moffset-=hge->Timer_GetDelta()*1200;
+ if(alldone)return onIn=false,-1;
+ }
+ if(onOut)
+ {
+ bool alldone=true;
+ xoffset+=hge->Timer_GetDelta()*1600;
+ if(xoffset<850)alldone=false;
+ if(fabs(moffset-450)<hge->Timer_GetDelta()*1200)
+ moffset=450;
+ else alldone=false,moffset+=hge->Timer_GetDelta()*800;
+ if(alldone)active=onOut=false;
+ }
+ ConfigureQuad(&UpperGradient,xoffset-140,250,520,100);
+ ConfigureQuad(&LowerGradient,xoffset-140,430,520,100);
+ if(!onSwitch)
+ {
+ if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>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;
+ }
+ yoffset=-selected*30;
+ if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset;
+ if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400;
+ if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400;
+ 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)
+ {
+ if(onSwitch||onSwitchi)return -1;
+ if(selected<=3)
+ {
+ onSwitch=true;
+ swoffset=100;
+ }
+ if(selected==0)++plrspd>5?plrspd=1:0;
+ if(selected==1)++plrslospd>5?plrslospd=1:0;
+ if(selected==2)++clrbns>4?clrbns=0:0;
+ if(selected==3)clrmode=!clrmode;
+ if(selected<=3)return selected;
+ }
+ if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT)
+ {
+ if(onSwitch||onSwitchi)return -1;
+ if(selected<=3){onSwitchi=true;swoffset=0;}
+ if(selected==0)--plrspd<1?plrspd=5:0;
+ if(selected==1)--plrslospd<1?plrslospd=5:0;
+ if(selected==2)--clrbns<0?clrbns=4:0;
+ if(selected==3)clrmode=!clrmode;
+ if(selected<=3)return selected;
+ }
+ if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT)
+ return selected;
+ return -1;
+ }
+ void Render()
+ {
+ for(int i=0;i<6;++i)
+ {
+ double calcy=i*30+dyoffset+360;
+ if(calcy>249.9&&calcy<500.1)
+ {
+ MenuFont->SetColor(0xFFFFFFFF);
+ MenuFont->printf(xoffset-50,calcy,HGETEXT_LEFT,PPMStr[i]);
+ if(i==0)
+ {
+ if(!(onSwitch||onSwitchi)||selected!=0)
+ MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,"%d",plrspd);
+ else
+ {
+ if(onSwitch)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",plrspd==1?5:plrspd-1);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",plrspd);
+ swoffset-=hge->Timer_GetDelta()*400;
+ if(swoffset<0)swoffset=0,onSwitch=false;
+ }
+ if(onSwitchi)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",plrspd);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",plrspd==5?1:plrspd+1);
+ swoffset+=hge->Timer_GetDelta()*400;
+ if(swoffset>100)swoffset=0,onSwitchi=false;
+ }
+ }
+ }
+ if(i==1)
+ {
+ if(!(onSwitch||onSwitchi)||selected!=1)
+ MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,"%d",plrslospd);
+ else
+ {
+ if(onSwitch)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",plrslospd==1?5:plrslospd-1);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",plrslospd);
+ swoffset-=hge->Timer_GetDelta()*400;
+ if(swoffset<0)swoffset=0,onSwitch=false;
+ }
+ if(onSwitchi)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",plrslospd);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",plrslospd==5?1:plrslospd+1);
+ swoffset+=hge->Timer_GetDelta()*400;
+ if(swoffset>100)swoffset=0,onSwitchi=false;
+ }
+ }
+ }
+ if(i==2)
+ {
+ if(!(onSwitch||onSwitchi)||selected!=2)
+ MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,"%d",clrbns);
+ else
+ {
+ if(onSwitch)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",clrbns==0?4:clrbns-1);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",clrbns);
+ swoffset-=hge->Timer_GetDelta()*400;
+ if(swoffset<0)swoffset=0,onSwitch=false;
+ }
+ if(onSwitchi)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",clrbns);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",clrbns==4?0:clrbns+1);
+ swoffset+=hge->Timer_GetDelta()*400;
+ if(swoffset>100)swoffset=0,onSwitchi=false;
+ }
+ }
+ }
+ if(i==3)
+ {
+ if(!(onSwitch||onSwitchi)||selected!=3)
+ MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,PPMStr[clrmode?7:6]);
+ else
+ {
+ if(onSwitch)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,PPMStr[clrmode?6:7]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,PPMStr[clrmode?7:6]);
+ swoffset-=hge->Timer_GetDelta()*400;
+ if(swoffset<0)swoffset=0,onSwitch=false;
+ }
+ if(onSwitchi)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,PPMStr[clrmode?7:6]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,PPMStr[clrmode?6:7]);
+ swoffset+=hge->Timer_GetDelta()*400;
+ if(swoffset>100)swoffset=0,onSwitchi=false;
+ }
+ }
+ }
+ if(i==4)
+ {
+ if(shaketime>0)
+ {
+ shaketime-=hge->Timer_GetDelta();
+ shakedelay-=hge->Timer_GetDelta();
+ if(shakedelay<0)
+ {shakeoffset=-shakeoffset;shakedelay=0.033;}
+ if(shaketime<=0)shaketime=shakeoffset=0;
+ }
+ MenuFont->printf(xoffset+200+shakeoffset,calcy,HGETEXT_LEFT,"%d/10000",AP_Update(plrspd,plrslospd,clrbns));
+ }
+ }
+ }
+ Ribb->RenderEx(xoffset-80,355,0,7,1);
+ Ribb->RenderEx(xoffset-80,382,0,7,1);
+ hge->Gfx_RenderQuad(&UpperGradient);
+ hge->Gfx_RenderQuad(&LowerGradient);
+ optt->Render(125,moffset+300);
+ }
+}playerPreferenceMenu;
+class PauseMenu
+{
+private:
+ bool active,onIn,onOut;
+ int selected;
+ double xoffset,yoffset,dyoffset;
+ hgeSprite *Ribb;
+ hgeQuad UpperGradient,LowerGradient;
+public:
+ bool isActive(){return active;}
+ void Init_Once()
+ {
+ Ribb=new hgeSprite(MenuTex,256,350,64,16);
+ Ribb->SetColor(0xCCFFFFFF);
+ }
+ void Init(double start)
+ {
+ //special things to do..
+ Music_Pause();
+ Current_Position=11;
+ DisableAllTower=DisablePlayer=true;
+ xoffset=start;onIn=true;active=true;
+ selected=1;dyoffset=yoffset=-selected*30;
+ ConfigureQuad(&UpperGradient,xoffset-140,190,320,50);
+ UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF);
+ UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00);
+ ConfigureQuad(&LowerGradient,xoffset-140,340,320,100);
+ LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00);
+ LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF);
+ }
+ void Leave(){onOut=true;}
+ int Update()
+ {
+ if(onIn)
+ {
+ if(fabs(xoffset-350)<hge->Timer_GetDelta()*1600)return xoffset=350,onIn=false,-1;
+ if(xoffset<350)
+ xoffset+=hge->Timer_GetDelta()*1600;
+ else
+ xoffset-=hge->Timer_GetDelta()*1600;
+ }
+ if(onOut)
+ {
+ xoffset+=hge->Timer_GetDelta()*1600;
+ if(xoffset>=850)
+ {
+ active=onOut=false;
+ if(selected==1)Current_Position=1,DisableAllTower=DisablePlayer=false;
+ }
+ }
+ 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;
+ yoffset=-selected*30;
+ if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset;
+ if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400;
+ if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400;
+ 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 -1;
+ }
+ void Render()
+ {
+ for(int i=0;i<3;++i)
+ {
+ double calcy=i*30+dyoffset+300;
+ if(calcy>189.9&&calcy<440.1)
+ MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,PMStr[i]);
+ }
+ Ribb->RenderEx(xoffset-50,295,0,4,1);
+ Ribb->RenderEx(xoffset-50,322,0,4,1);
+ hge->Gfx_RenderQuad(&UpperGradient);
+ hge->Gfx_RenderQuad(&LowerGradient);
+ }
+}pauseMenu;
+class ReturnToTitleMenu
+{
+private:
+ bool active,onIn,onOut;
+ int selected;
+ double xoffset,yoffset,dyoffset;
+ hgeSprite *Ribb;
+ hgeQuad UpperGradient,LowerGradient;
+public:
+ bool isActive(){return active;}
+ void Init_Once()
+ {
+ Ribb=new hgeSprite(MenuTex,256,350,64,16);
+ Ribb->SetColor(0xCCFFFFFF);
+ }
+ void Init(double start)
+ {
+ xoffset=start;onIn=true;active=true;
+ selected=1;dyoffset=yoffset=-selected*30;
+ ConfigureQuad(&UpperGradient,xoffset-140,190,320,50);
+ UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF);
+ UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00);
+ ConfigureQuad(&LowerGradient,xoffset-140,340,320,100);
+ LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00);
+ LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF);
+ }
+ void Leave(){onOut=true;}
+ int Update()
+ {
+ //The background color is likely on a change here...
+ UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF);
+ UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00);
+ LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00);
+ LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF);
+ if(onIn)
+ {
+ if(fabs(xoffset-350)<hge->Timer_GetDelta()*1600)return xoffset=350,onIn=false,-1;
+ if(xoffset<350)
+ xoffset+=hge->Timer_GetDelta()*1600;
+ else
+ xoffset-=hge->Timer_GetDelta()*1600;
+ }
+ if(onOut)
+ {
+ xoffset+=hge->Timer_GetDelta()*1600;
+ if(xoffset>=850)active=onOut=false;
+ }
+ 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;
+ yoffset=-selected*30;
+ if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset;
+ if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400;
+ if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400;
+ if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT)
+ return selected;
+ return -1;
+ }
+ void Render()
+ {
+ for(int i=0;i<3;++i)
+ {
+ double calcy=i*30+dyoffset+300;
+ if(calcy>189.9&&calcy<440.1)
+ MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,RTTMStr[i]);
+ }
+ Ribb->RenderEx(xoffset-50,295,0,6.5,1);
+ Ribb->RenderEx(xoffset-50,322,0,6.5,1);
+ hge->Gfx_RenderQuad(&UpperGradient);
+ hge->Gfx_RenderQuad(&LowerGradient);
+ }
+}returnToTitleMenu;
//==================================================================================
//Here's where old code dies...
hgeGUI *StartGUI,*DeathGUI,*CompleteGUI,*HighScoreGUI;
@@ -981,39 +1465,6 @@ void PauseGUI_FrameFnk()
}
}
}
-int AP_Update(int plrspd,int plrslospd,int clrbns)
-{
- int res=0;
- if (plrspd<=4)res+=plrspd*1200;else res+=5000;
- switch (plrslospd)
- {
- case 1:res+=4000;break;
- case 2:res+=3200;break;
- case 3:res+=2000;break;
- case 4:res+=1500;break;
- case 5:res+=700;break;
- }
- switch (clrbns)
- {
- case 0:break;
- case 1:res+=1500;break;
- case 2:res+=2700;break;
- case 3:res+=4000;break;
- case 4:res+=5500;break;
- }
- return res;
-}
-void Options_Writeback()
-{
- freopen("blr.cfg","w",stdout);
- printf(";CBL");
- printf("%c",fpslvl==2?1:0);
- printf("%c",tfs?1:0);
- printf("%c",VidMode);
- printf("%c",diffkey?1:0);
- printf("%c%c%c%c",plrspd,plrslospd,clrbns,clrmode);
- fclose(stdout);
-}
void OptionsGUI_Init()
{
OptionsGUI=new hgeGUI();