aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xCHANGELOG.TXT7
-rwxr-xr-xVERSION.TXT2
-rw-r--r--global.h8
-rw-r--r--hge/input.cpp4
-rw-r--r--main.cpp166
-rw-r--r--menus.h250
6 files changed, 362 insertions, 75 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT
index 7b4ad32..0b786bf 100755
--- a/CHANGELOG.TXT
+++ b/CHANGELOG.TXT
@@ -8,6 +8,13 @@ Random segmentation fault in "Hyper-threading".(seen only once,
can not reproduce now...)
Pre-Released versions:
+0.9.1-0_PR (r83)
+Now you can change the game resolution.
+Some resources are not re-made so they may look blurred...
+Make font bigger for higher resolution.
+Add command line option for changing the resolution.
+Complete the option menu rewrite.
+
0.9.1-0_PR (r82)
Add missing file menus.png...
Finish the start menu rewrite.
diff --git a/VERSION.TXT b/VERSION.TXT
index 0486b4b..6adfed4 100755
--- a/VERSION.TXT
+++ b/VERSION.TXT
@@ -1 +1 @@
-0.9.1-0_PR (r82) \ No newline at end of file
+0.9.1-0_PR (r83) \ No newline at end of file
diff --git a/global.h b/global.h
index 005ce67..f77dbbe 100644
--- a/global.h
+++ b/global.h
@@ -73,6 +73,7 @@ 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
+Ribbon 256,350,64,16
*/
enum TColors
{green=0,blue,yellow,purple,red,white,dblue,orange,grey,circle,COLOR_COUNT};
@@ -83,6 +84,7 @@ bool playerLockX,playerLockY;
bool DisableAllTower=false;
bool DisablePlayer=false;
bool LOWFPS=false,diffkey=false;
+int VidMode=-1;
inline double GetDist(vector2d,vector2d);
class Bullet
{
@@ -291,6 +293,10 @@ hgeSprite *Credits,*CreditsRail;
int creditsp;double creditfly,creditacc,credbrk;
bool credstop,creddone;
bool tfs;
+double scale;
+#ifndef WIN32
+double yos;
+#endif
int fpslvl,clrmode;
const vector2d splitData[4]={vector2d(0,0),vector2d(400,0),vector2d(0,300),vector2d(400,300)};
//options from command line arguments
@@ -325,7 +331,7 @@ static const char* archive[]={
};
#endif
//static const char* GLOBAL_H_FN="global.h";
-static const char* BLRVERSION="0.9.1-0_PR (r82)";
+static const char* BLRVERSION="0.9.1-0_PR (r83)";
static const char* BuiltDate=__DATE__;
void Throw(char *Filename,char *Info)
diff --git a/hge/input.cpp b/hge/input.cpp
index 4cd2c97..2710c7f 100644
--- a/hge/input.cpp
+++ b/hge/input.cpp
@@ -206,8 +206,8 @@ int CALL HGE_Impl::Input_GetKeyStateEx(int key)//New function
{
if (!Input_GetKeyState(key)&&keylast[key])return HGEKST_RELEASE;
if (!Input_GetKeyState(key))return HGEKST_NONE;
- if (keylast[key])return HGEKST_KEEP;
- return HGEKST_HIT;
+ if (Input_GetKeyState(key)&&!keylast[key])return HGEKST_HIT;
+ return HGEKST_KEEP;
}
bool CALL HGE_Impl::Input_KeyDown(int key)
diff --git a/main.cpp b/main.cpp
index a0c5eaa..2f8aeaa 100644
--- a/main.cpp
+++ b/main.cpp
@@ -91,9 +91,7 @@ basic settings first!\n\nUse vsync??","First Start Up",0x00000024)==6)
#ifndef WIN32
void firststartup()
{
- fpslvl=0;
- tfs=0;
- diffkey=false;
+ fpslvl=2;tfs=0;VidMode=0;diffkey=false;
plrspd=3;plrslospd=3;clrbns=clrmode=0;
hge->System_Log("%s: Finishing first start up configuraion...",MAIN_SRC_FN);
Options_Writeback();
@@ -608,10 +606,10 @@ void AboutScene()
creditfly=1200,creditacc=0,credstop=creddone=false,++creditsp,
Credits=new hgeSprite(TexCredits,0,creditsp*200,600,200),
Credits->SetHotSpot(300,100);
- if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||creditsp>11)
+ if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT||creditsp>11)
{
Current_Position=0;
- mainMenu.Init(-200);
+ mainMenu.Init(850);
Music_Stop();
}
}
@@ -626,31 +624,35 @@ bool FrameFunc()
static float t=0.0f;
float tx,ty;
if (Current_Position==1&&hge->Input_GetKeyState(HGEK_ESCAPE))PauseGUI_Init();
- if (mainMenu.isActive())mainMenu.Update();
- if (startMenu.isActive())startMenu.Update();
+ int MMR=-1,SMR=-1,OMR=-1;
+ if (mainMenu.isActive())MMR=mainMenu.Update();
+ if (startMenu.isActive())SMR=startMenu.Update();
+ if (optionMenu.isActive())OMR=optionMenu.Update();
if (Current_Position==0)
{
if(!mainMenu.isActive())return true;
- if(hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT)
+ switch(MMR)
{
- switch(mainMenu.GetSelected())
- {
- case 0:Current_Position=3;startMenu.Init();mainMenu.Leave();break;
- case 3:
- Credits->SetHotSpot(300,100);
- CreditsRail->SetHotSpot(300,100);
- creditsp=0;
- Music_Init("./Resources/Music/BLR2_TR09.ogg");
- lpst=lped=0;
- Music_Play();
- creditfly=1200;creditacc=0;credstop=creddone=false;
- Current_Position=4;
- mainMenu.Leave();
- break;
- case 4:mainMenu.Leave();break;
- }
- return false;
+ case 0:Current_Position=3;startMenu.Init();mainMenu.Leave();break;
+ case 2:
+ Current_Position=13;
+ optionMenu.Init(-200);
+ mainMenu.Leave();
+ break;
+ case 3:
+ Credits->SetHotSpot(300,100);
+ CreditsRail->SetHotSpot(300,100);
+ creditsp=0;
+ Music_Init("./Resources/Music/BLR2_TR09.ogg");
+ lpst=lped=0;
+ Music_Play();
+ creditfly=1200;creditacc=0;credstop=creddone=false;
+ Current_Position=4;
+ mainMenu.Leave();
+ break;
+ case 4:mainMenu.Leave();break;
}
+ if(~MMR)return false;
}
if (Current_Position==3)
{
@@ -658,10 +660,10 @@ bool FrameFunc()
{
startMenu.Leave();mainMenu.Init(800);Current_Position=0;
}
- if(hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT)
+ if(~SMR)
{
startMenu.Leave();
- switch(startMenu.GetSelected())
+ switch(SMR)
{
case 0:
playerpos.x=400,playerpos.y=400,playerrot=0;
@@ -731,7 +733,20 @@ bool FrameFunc()
if (Current_Position==10)HSDetGUI_FrameFnk();
if (Current_Position==11)PauseGUI_FrameFnk();
if (Current_Position==12)BkTTitleGUI_FrameFnk();
- if (Current_Position==13)OptionsGUI_FrameFnk();
+ if (Current_Position==13)
+ {
+ if(~OMR)
+ {
+ if(OMR==4||OMR==5)optionMenu.Leave();
+ if(OMR==5)
+ {
+ Options_Writeback();
+ mainMenu.Init(-200);
+ Current_Position=0;
+ }
+ return false;
+ }
+ }
if (Current_Position==14)PlayerProfGUI_FrameFnk();
// Here we update our background animation
t+=dt;
@@ -745,13 +760,18 @@ bool FrameFunc()
//Super Spliter!*****Super Spliter!*****Super Spliter!*****Super Spliter!*****Super Spliter!**
//******Super Spliter!*****Super Spliter!*****Super Spliter!*****Super Spliter!***************
hge->Gfx_BeginScene();
+#ifndef WIN32
+ hge->Gfx_SetTransform(0,0,0,yos,0,scale,scale);
+#else
+ hge->Gfx_SetTransform(0,0,0,0,0,scale,scale);
+#endif
for(int i=0;i<4;i++)quad.v[i].col=DBGColor;
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(optionMenu.isActive())optionMenu.Render();
if (Current_Position==0||Current_Position==3||Current_Position==8||
Current_Position==9||Current_Position==10||Current_Position==13||Current_Position==14)
{
@@ -836,7 +856,7 @@ bool FrameFunc()
if (Current_Position==10)HSDetailGUI->Render();
if (Current_Position==11)PauseGUI->Render();
if (Current_Position==12)BkTTitleGUI->Render();
- if (Current_Position==13)OptionsGUI->Render();
+ //if (Current_Position==13)OptionsGUI->Render();
if (Current_Position==14)PlayerProfGUI->Render();
fnt->SetColor(0xFFFFFFFF);
rbPanelFont.UpdateString(L" FPS: %.2f",hge->Timer_GetFPSf());
@@ -888,16 +908,22 @@ bool FrameFunc()
void printHelp(char *exec,const char* str="")
{
printf("Usage: %s [options]...\n",exec);
- printf("To run the game normally, just start without arguments.\n");
- printf("Options:\n");
- printf("--help Print this help and exit.\n");
- printf("--version Print version and exit.\n");
- printf("--start=x,y Start free play mode directly from level x part y. The part must be valid.\n");
- printf("--nosound Forcibly use no sound.\n");
- printf("--fullscreen=1/0 Forcibly use fullscreen/windowed. This will override your configuration.\n");
- printf("--firststartup Forcibly run first start up. This will reset the score file.\n");
- printf("--fast Fast mode. All levels are two times shorter.\n");
- printf("--logfile=... Use an alternate log file name instead of the default \"BLRLOG.txt\".\n");
+ puts("To run the game normally, just start without arguments.");
+ puts("Options:");
+ puts("--help Print this help and exit.");
+ puts("--version Print version and exit.");
+ puts("--start=x,y Start free play mode directly from level x part y. The part must be valid.");
+ puts("--nosound Forcibly use no sound.");
+ puts("--fullscreen=1/0 Forcibly use fullscreen/windowed. This will override your configuration.");
+ puts("--vidmode=0~4 Forcibly use specific video mode instead the one in the configuration.");
+ puts(" 0 800x600 (native resolution)");
+ puts(" 1 640x480");
+ puts(" 2 960x720");
+ puts(" 3 1024x768");
+ puts(" 4 1280x960");
+ puts("--firststartup Forcibly run first start up. This will reset the score file.");
+ puts("--fast Fast mode. All levels are two times shorter.");
+ puts("--logfile=... Use an alternate log file name instead of the default \"BLRLOG.txt\".");
#ifdef WIN32
printf("--nohideconsole Do not hide console (Windows version only).\n");
#endif
@@ -929,6 +955,16 @@ void parseArgs(int argc,char *argv[])
if(para)fFullScreen=2;else fFullScreen=1;
valid=true;
}
+ if(!strncmp(argv[i],"--vidmode",9))
+ {
+ char *ptr=argv[i];while(*ptr!='='&&*ptr)++ptr;
+ if(!*ptr)printHelp(argv[0],"--vidmode need a parameter!\n");
+ ++ptr;
+ int para=strtol(ptr,&ptr,10);
+ if(*ptr||(para<0||para>4))printHelp(argv[0],"Invalid parameter for --vidmode!\n");
+ if(para)VidMode=para;
+ valid=true;
+ }
if(!strncmp(argv[i],"--start",7))
{
char *ptr=argv[i];while(*ptr!='='&&*ptr)++ptr;
@@ -1000,7 +1036,6 @@ int main(int argc,char *argv[])
#ifdef WIN32
hge->System_SetState(HGE_ICON, MAKEINTRESOURCE(1));
#endif
- hge->System_SetState(HGE_FPS,0);
if((access("blr.cfg",0))==-1)
{
hge->System_Log("%s: Config file not found. Calling first startup.",MAIN_SRC_FN);
@@ -1019,17 +1054,12 @@ int main(int argc,char *argv[])
if (tch!='L'){}
fpslvl=0;
LOWFPS=true;//always LowFPS, deprecate 1000 FPS mode...
- hge->System_SetState(HGE_FPS,HGEFPS_VSYNC);//try vsync first
- tch=getchar();//LOWFPS
+ hge->System_SetState(HGE_FPS,61);
+ tch=getchar();//VSync
if (tch==1)
{
- LOWFPS=true;
- TenSeconds=600;
- TwentySeconds=1200;
- ThirtySeconds=1800;
- AMinute=3600;
- hge->System_SetState(HGE_FPS,61);
- fpslvl=1;
+ hge->System_SetState(HGE_FPS,HGEFPS_VSYNC);
+ fpslvl=2;
}
if(fFast)TenSeconds/=2,TwentySeconds/=2,ThirtySeconds/=2,AMinute/=2;
tch=getchar();//FULLSCRREEN
@@ -1038,12 +1068,32 @@ int main(int argc,char *argv[])
hge->System_SetState(HGE_WINDOWED, false),tfs=true;
if(fFullScreen==2)hge->System_SetState(HGE_WINDOWED, false),tfs=true;
if(fFullScreen==1)hge->System_SetState(HGE_WINDOWED, true),tfs=false;
- tch=getchar();//vsync
- if (tch==1)
+ tch=getchar();//resolution
+ if(VidMode==-1)VidMode=tch;
+ switch(VidMode)
{
- hge->System_SetState(HGE_FPS,HGEFPS_VSYNC);
- fpslvl=2;
+ case 0:break;
+ case 1:
+ hge->System_SetState(HGE_SCREENWIDTH, 640);
+ hge->System_SetState(HGE_SCREENHEIGHT, 480);
+ break;
+ case 2:
+ hge->System_SetState(HGE_SCREENWIDTH, 960);
+ hge->System_SetState(HGE_SCREENHEIGHT, 720);
+ break;
+ case 3:
+ hge->System_SetState(HGE_SCREENWIDTH, 1024);
+ hge->System_SetState(HGE_SCREENHEIGHT, 768);
+ break;
+ case 4:
+ hge->System_SetState(HGE_SCREENWIDTH, 1280);
+ hge->System_SetState(HGE_SCREENHEIGHT, 960);
+ break;
}
+ scale=VidMode?VidMode==1?0.8:VidMode==2?1.2:VidMode==3?1.28:VidMode==4?1.6:0:1;
+#ifndef WIN32
+ yos=VidMode?VidMode==1?120:VidMode==2?-120:VidMode==3?-168:VidMode==4?-360:0:0;
+#endif
tch=getchar();//Key binding
if (tch==1)diffkey=true;
plrspd=tch=getchar();
@@ -1106,6 +1156,10 @@ int main(int argc,char *argv[])
MenuFont=new hgeFont("./Resources/charmap.fnt");
TipFont=new hgeFont("./Resources/charmap.fnt");
MultFnt=new hgeFont("./Resources/charmap.fnt");
+ fnt->SetScale(0.8);
+ MenuFont->SetScale(0.8);
+ TipFont->SetScale(0.8);
+ MultFnt->SetScale(0.8);
spr=new hgeSprite(SprSheet,216,0,24,24);
Credits=new hgeSprite(TexCredits,0,0,600,200);
CreditsRail=new hgeSprite(TexCredits,0,2400,600,200);
@@ -1123,8 +1177,8 @@ 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(-200);
- startMenu.Init_Once();
+ mainMenu.Init_Once();if(!startLvl)mainMenu.Init(-200);
+ startMenu.Init_Once();optionMenu.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"));
diff --git a/menus.h b/menus.h
index 716f5f9..e9b285c 100644
--- a/menus.h
+++ b/menus.h
@@ -24,21 +24,38 @@ static const char* MMStr[]={
"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",
+"?"
+};
class MainMenu
{
private:
bool active,onIn,onOut;
int selected;
double xoffset,yoffset,dyoffset;
- hgeSprite *PL,*PR;
+ hgeSprite *Ribb;
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);
+ Ribb=new hgeSprite(MenuTex,256,350,64,16);
+ Ribb->SetColor(0xCCFFFFFF);
}
void Init(double start)
{
@@ -52,11 +69,11 @@ public:
LowerGradient.v[2].col=LowerGradient.v[3].col=0xFF888820;
}
void Leave(){onOut=true;}
- void Update()
+ int Update()
{
if(onIn)
{
- if(fabs(xoffset-650)<hge->Timer_GetDelta()*1600)return (void)(xoffset=650,onIn=false);
+ if(fabs(xoffset-650)<hge->Timer_GetDelta()*1600)return xoffset=650,onIn=false,-1;
if(xoffset<650)
xoffset+=hge->Timer_GetDelta()*1600;
else
@@ -75,6 +92,9 @@ public:
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(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT)
+ return selected;
+ return -1;
}
void Render()
{
@@ -84,8 +104,8 @@ public:
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);
+ Ribb->RenderEx(xoffset-50,355,0,3,1);
+ Ribb->RenderEx(xoffset-50,382,0,3,1);
hge->Gfx_RenderQuad(&UpperGradient);
hge->Gfx_RenderQuad(&LowerGradient);
}
@@ -100,7 +120,6 @@ private:
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);
@@ -116,17 +135,17 @@ 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=0x00888820;
+ LowerGradient.v[0].col=LowerGradient.v[1].col=0x01888820;
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;
+ LeftGradient.v[1].col=LeftGradient.v[2].col=0x01888820;
ConfigureQuad(&RightGradient,700,320+yoffset,100,200);
- RightGradient.v[0].col=RightGradient.v[3].col=0x00888820;
+ RightGradient.v[0].col=RightGradient.v[3].col=0x01888820;
RightGradient.v[1].col=RightGradient.v[2].col=0xFF888820;
}
void Leave(){onOut=true;}
- void Update()
+ int Update()
{
if(onIn)
{
@@ -164,6 +183,9 @@ public:
ConfigureQuad(&LowerGradient,0,400+yoffset,800,120);
ConfigureQuad(&LeftGradient,0,320+yoffset,100,200);
ConfigureQuad(&RightGradient,700,320+yoffset,100,200);
+ if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT)
+ return selected;
+ return -1;
}
void Render()
{
@@ -176,6 +198,204 @@ public:
msel->Render(0,moffset+200);
}
}startMenu;
+class OptionsMenu
+{
+private:
+ bool active,onIn,onOut,onSwitch,onSwitchi;
+ int selected;
+ double xoffset,yoffset,dyoffset,swoffset,moffset;
+ hgeSprite *Ribb,*msel;
+ 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);
+ Ribb->SetColor(0xCCFFFFFF);
+ }
+ void Init(double start)
+ {
+ 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;
+ 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;
+ }
+ void Leave(){onOut=true;}
+ int Update()
+ {
+ if(onIn)
+ {
+ bool alldone=true;
+ if(fabs(xoffset-450)<hge->Timer_GetDelta()*1600)xoffset=450;else
+ {
+ alldone=false;
+ if(xoffset<450)
+ 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,500,100);
+ 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;
+ }
+ 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(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(onSwitch||onSwitchi)return -1;
+ if(selected<=3)
+ {
+ onSwitch=true;
+ swoffset=100;
+ }
+ if(selected==0)tfs=!tfs;
+ if(selected==1)
+ {
+ fpslvl=fpslvl==2?0:2;
+ if(fpslvl==2)hge->System_SetState(HGE_FPS,HGEFPS_VSYNC);
+ if(fpslvl==0)hge->System_SetState(HGE_FPS,61);
+ }
+ if(selected==2)diffkey=!diffkey;
+ if(selected==3)
+ {
+ ++VidMode;
+ if(VidMode>4)VidMode=0;
+ }
+ return selected;
+ }
+ if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT)
+ {
+ if(onSwitch||onSwitchi)return -1;
+ if(selected<=2){onSwitch=true;swoffset=100;}
+ if(selected==0)tfs=!tfs;
+ if(selected==1)
+ {
+ fpslvl=fpslvl==2?0:2;
+ if(fpslvl==2)hge->System_SetState(HGE_FPS,HGEFPS_VSYNC);
+ if(fpslvl==0)hge->System_SetState(HGE_FPS,61);
+ }
+ if(selected==2)diffkey=!diffkey;
+ if(selected==3)
+ {
+ --VidMode;onSwitchi=true;swoffset=0;
+ if(VidMode<0)VidMode=4;
+ }
+ 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,calcy,HGETEXT_LEFT,OMStr[i]);
+ if(i==0)
+ {
+ if(!onSwitch||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(i==1)
+ {
+ if(!onSwitch||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(i==2)
+ {
+ if(!onSwitch||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(i==3)
+ {
+ if(!(onSwitch||onSwitchi)||selected!=3)
+ MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,VidMode>=0&&VidMode<=4?OMStr[VidMode+10]:OMStr[15]);
+ else
+ {
+ if(onSwitch)
+ {
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,VidMode>=0&&VidMode<=4?OMStr[VidMode==0?14:VidMode+9]:OMStr[15]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,VidMode>=0&&VidMode<=4?OMStr[VidMode+10]:OMStr[15]);
+ 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,VidMode>=0&&VidMode<=4?OMStr[VidMode+10]:OMStr[15]);
+ MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f)));
+ MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,VidMode>=0&&VidMode<=4?OMStr[VidMode==4?10:VidMode+11]:OMStr[15]);
+ swoffset+=hge->Timer_GetDelta()*400;
+ if(swoffset>100)swoffset=0,onSwitchi=false;
+ }
+ }
+ }
+ }
+ }
+ Ribb->RenderEx(xoffset-50,355,0,6,1);
+ Ribb->RenderEx(xoffset-50,382,0,6,1);
+ hge->Gfx_RenderQuad(&UpperGradient);
+ hge->Gfx_RenderQuad(&LowerGradient);
+ msel->Render(300,moffset+300);
+ }
+}optionMenu;
//==================================================================================
//Here's where old code dies...
hgeGUI *StartGUI,*DeathGUI,*CompleteGUI,*HighScoreGUI;
@@ -787,9 +1007,9 @@ void Options_Writeback()
{
freopen("blr.cfg","w",stdout);
printf(";CBL");
- printf("%c",fpslvl==1?1:0);
- printf("%c",tfs?1:0);
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);