SBSPSS/source/frontend/start.cpp

230 lines
4.8 KiB
C++
Raw Normal View History

2000-11-24 18:20:44 +01:00
/*=========================================================================
start.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2000 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "frontend\start.h"
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
#ifndef __LOCALE_TEXTDBASE_H__
#include "locale\textdbase.h"
#endif
#ifndef __GFX_FADER_H__
#include "gfx\fader.h"
#endif
#ifndef __PRIM_HEADER__
#include "gfx\prim.h"
#endif
2001-02-12 17:06:24 +01:00
#ifndef __GUI_GFACTORY_H__
#include "gui\gfactory.h"
#endif
#ifndef __GUI_GFRAME_H__
#include "gui\gframe.h"
#endif
2001-01-15 23:02:25 +01:00
2000-11-24 18:20:44 +01:00
/* Std Lib
------- */
/* Data
---- */
#ifndef __SPR_FRONTEND_H__
#include <frontend.h>
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
2001-02-12 17:06:24 +01:00
int CFrontEndStart::s_levelValues[]=
{
2001-03-09 21:34:04 +01:00
0,48,96,144,192,240,
2001-02-12 17:15:37 +01:00
-1,
2001-02-12 17:06:24 +01:00
};
CGUITextReadout::TextReadoutData CFrontEndStart::s_levelReadoutText[]=
{
2001-03-09 21:34:04 +01:00
{ 0, STR__DEBUG__LEVEL_SELECT_C1 },
{ 48, STR__DEBUG__LEVEL_SELECT_C2 },
{ 96, STR__DEBUG__LEVEL_SELECT_C3 },
{ 144, STR__DEBUG__LEVEL_SELECT_C4 },
{ 192, STR__DEBUG__LEVEL_SELECT_C5 },
{ 240, STR__DEBUG__LEVEL_SELECT_C6 },
2001-02-12 17:06:24 +01:00
};
extern int s_globalLevelSelectThing;
2000-11-24 18:20:44 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndStart::init()
{
2001-02-12 17:06:24 +01:00
m_guiFrame=new ("optionsframe") CGUIControlFrame();
m_guiFrame->init(NULL);
2001-03-09 21:34:04 +01:00
m_guiFrame->setObjectXYWH((512-352)/2,50,352,96);
2001-02-12 17:06:24 +01:00
CGUIFactory::createCycleButtonFrame(m_guiFrame,
2001-03-09 21:34:04 +01:00
10,10,332,40,
2001-02-12 17:06:24 +01:00
STR__DEBUG__LEVEL_SELECT,
&m_level,s_levelValues,s_levelReadoutText);
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-03-09 21:34:04 +01:00
10,50,332,40,
2001-02-12 17:06:24 +01:00
STR__DEBUG__LEVEL_SELECT_START,
&m_startGame,true);
2000-11-24 18:20:44 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndStart::shutdown()
{
2001-02-12 17:06:24 +01:00
m_guiFrame->shutdown();
2000-11-24 18:20:44 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndStart::select()
{
2001-02-12 17:06:24 +01:00
m_guiFrame->select();
2000-11-24 18:20:44 +01:00
m_shuttingDown=false;
m_selectedSlot=NO_SLOT_SELECTED;
m_escapeToTitles=false;
CFader::setFadingIn();
2001-02-12 17:06:24 +01:00
m_startGame=false;
2000-11-24 18:20:44 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndStart::unselect()
{
2001-02-12 17:06:24 +01:00
m_guiFrame->unselect();
2000-11-24 18:20:44 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndStart::render()
{
POLY_G4 *g4;
g4=GetPrimG4();
setXYWH(g4,0,0,512,256);
setRGB0(g4,50, 0, 0);
setRGB1(g4, 0, 0,50);
setRGB2(g4, 0,50, 0);
setRGB3(g4,50, 0,50);
2001-01-05 22:26:29 +01:00
AddPrimToList(g4,MAX_OT-1);
2001-01-15 23:02:25 +01:00
2001-02-12 17:06:24 +01:00
m_guiFrame->render();
2000-11-24 18:20:44 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFrontEndStart::think(int _frames)
{
2001-02-12 17:06:24 +01:00
if(!CFader::isFading())
{
m_guiFrame->think(_frames);
}
2000-11-24 18:20:44 +01:00
if(!m_shuttingDown)
{
2001-02-12 17:06:24 +01:00
if(/*m_selectedSlot!=NO_SLOT_SELECTED||
m_escapeToTitles||*/
m_startGame)
{
2001-02-12 17:26:09 +01:00
m_selectedSlot=0;
2000-11-24 18:20:44 +01:00
m_shuttingDown=true;
2001-02-12 17:06:24 +01:00
s_globalLevelSelectThing=m_level;
2000-11-24 18:20:44 +01:00
CFader::setFadingOut();
}
}
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
int CFrontEndStart::isReadyToExit()
{
return !CFader::isFading()&&m_shuttingDown;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
CFrontEndScene::FrontEndMode CFrontEndStart::getNextMode()
{
2000-11-24 21:33:35 +01:00
if(m_selectedSlot==NO_SLOT_SELECTED)
2000-11-24 18:20:44 +01:00
{
2000-11-24 21:33:35 +01:00
return CFrontEndScene::MODE__MAIN_TITLES;
2000-11-24 18:20:44 +01:00
}
else
{
2000-11-24 21:33:35 +01:00
return CFrontEndScene::MODE__EXIT_TO_GAME;
2000-11-24 18:20:44 +01:00
}
}
/*===========================================================================
end */