diff --git a/makefile.gaz b/makefile.gaz index ebceb1ca6..b9e98b184 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -53,7 +53,8 @@ fileio_src := fileio \ frontend_src := frontend \ scrollbg \ - maintitl + maintitl \ + options game_src := game diff --git a/source/frontend/frontend.cpp b/source/frontend/frontend.cpp index 18242b5e8..748a17de2 100644 --- a/source/frontend/frontend.cpp +++ b/source/frontend/frontend.cpp @@ -26,6 +26,10 @@ #include "frontend\maintitl.h" #endif +#ifndef __FRONTEND_OPTIONS_H__ +#include "frontend\options.h" +#endif + /* Std Lib ------- */ @@ -50,11 +54,12 @@ ---- */ static CFrontEndMainTitles s_frontEndModeMainTitles; +static CFrontEndOptions s_frontEndModeOptions; CFrontEndMode *CFrontEndScene::s_modeCodes[]= { &s_frontEndModeMainTitles, // MODE__MAIN_TITLES - NULL, // MODE__GAME_OPTIONS + &s_frontEndModeOptions, // MODE__GAME_OPTIONS NULL, // MODE__CHOOSE_SLOT NULL, // MODE__DEMO @@ -73,6 +78,12 @@ CFrontEndScene FrontEndScene; ---------------------------------------------------------------------- */ void CFrontEndScene::init() { + for(int i=0;iinit(); + } + m_mode=MODE__NONE; setMode(MODE__MAIN_TITLES); } @@ -86,6 +97,11 @@ void CFrontEndScene::init() ---------------------------------------------------------------------- */ void CFrontEndScene::shutdown() { + for(int i=0;ishutdown(); + } } @@ -145,16 +161,12 @@ PAUL_DBGMSG("CFrontEndScene::setMode(%d)",_newMode); // Close old mode if(s_modeCodes[m_mode]) { -PAUL_DBGMSG("CFrontEndScene::shutdown mode %d",m_mode); - s_modeCodes[m_mode]->shutdown(); + s_modeCodes[m_mode]->unselect(); } // Open new mode m_mode=_newMode; -PAUL_DBGMSG("CFrontEndScene::init mode %d",m_mode); - s_modeCodes[m_mode]->init(); - s_modeCodes[m_mode]->shutdown(); - s_modeCodes[m_mode]->init(); + s_modeCodes[m_mode]->select(); } diff --git a/source/frontend/frontend.h b/source/frontend/frontend.h index d90ef581b..bb6b905c5 100644 --- a/source/frontend/frontend.h +++ b/source/frontend/frontend.h @@ -78,6 +78,8 @@ class CFrontEndMode public: virtual void init()=0; virtual void shutdown()=0; + virtual void select()=0; + virtual void unselect()=0; virtual void render()=0; virtual void think(int _frames)=0; diff --git a/source/frontend/maintitl.cpp b/source/frontend/maintitl.cpp index 826620f8f..480dac118 100644 --- a/source/frontend/maintitl.cpp +++ b/source/frontend/maintitl.cpp @@ -127,8 +127,6 @@ PAUL_DBGMSG("initial mem free=%d",mem); m_smallFont->initialise(&standardFont); m_smallFont->setJustification(FontBank::JUST_CENTRE); - m_mode=MODE__PRESS_START; - // Create the main menu ( START GAME/OPTIONS ) m_mainMenu=new ("Main Menu GUI") CGUIControlFrame(); m_mainMenu->init(NULL); @@ -156,13 +154,6 @@ PAUL_DBGMSG("initial mem free=%d",mem); tg=new ("togglebutton") CGUIToggleButton(); tg->init(fr); tg->setButtonTarget(&m_gotoOptionsFlag); - - m_mainMenu->select(); - - m_startGameFlag=false; - m_gotoOptionsFlag=false; - - CFader::setFadingIn(); } @@ -180,6 +171,35 @@ void CFrontEndMainTitles::shutdown() PAUL_DBGMSG("change=%d",mem-(MainRam.TotalRam-MainRam.RamUsed)); } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CFrontEndMainTitles::select() +{ + m_mode=MODE__PRESS_START; + + m_mainMenu->select(); + + m_startGameFlag=false; + m_gotoOptionsFlag=false; + + CFader::setFadingIn(); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CFrontEndMainTitles::unselect() +{ + m_mainMenu->unselect(); +} + typedef struct { @@ -327,7 +347,7 @@ CFrontEndScene::FrontEndMode CFrontEndMainTitles::getNextMode() break; case MODE__GOTO_OPTIONS: - ret=CFrontEndScene::MODE__MAIN_TITLES;//MODE__GAME_OPTIONS; + ret=CFrontEndScene::MODE__GAME_OPTIONS; break; } diff --git a/source/frontend/maintitl.h b/source/frontend/maintitl.h index b884d6753..97d0c3cef 100644 --- a/source/frontend/maintitl.h +++ b/source/frontend/maintitl.h @@ -43,6 +43,8 @@ class CFrontEndMainTitles : public CFrontEndMode public: void init(); void shutdown(); + void select(); + void unselect(); void render(); void think(int _frames); diff --git a/source/frontend/options.cpp b/source/frontend/options.cpp index 4d8990f53..ee1596b95 100644 --- a/source/frontend/options.cpp +++ b/source/frontend/options.cpp @@ -111,13 +111,6 @@ void CFrontEndOptions::init() tg=new ("togglebutton") CGUIToggleButton(); tg->init(fr); tg->setButtonTarget(&m_exitFlag); - - m_optionsMenu->select(); - - m_exitFlag=false; - m_closingDown=false; - - CFader::setFadingIn(); } /*---------------------------------------------------------------------- @@ -132,6 +125,33 @@ void CFrontEndOptions::shutdown() m_background->shutdown(); delete m_background; } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CFrontEndOptions::select() +{ + m_optionsMenu->select(); + + m_exitFlag=false; + m_closingDown=false; + + CFader::setFadingIn(); +} + +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CFrontEndOptions::unselect() +{ + m_optionsMenu->unselect(); +} + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/frontend/options.h b/source/frontend/options.h index f912118cd..83ee2c990 100644 --- a/source/frontend/options.h +++ b/source/frontend/options.h @@ -39,6 +39,8 @@ class CFrontEndOptions : public CFrontEndMode public: void init(); void shutdown(); + void select(); + void unselect(); void render(); void think(int _frames); diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 9152a67fd..ac85d9244 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -141,6 +141,14 @@ SOURCE=..\..\..\source\frontend\maintitl.h # End Source File # Begin Source File +SOURCE=..\..\..\source\frontend\options.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\frontend\options.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\frontend\scrollbg.cpp # End Source File # Begin Source File