SBSPSS/source/frontend/start.cpp

229 lines
4.7 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[]=
{
0,
1,
2,
3,
};
CGUITextReadout::TextReadoutData CFrontEndStart::s_levelReadoutText[]=
{
{0,STR__DEBUG__LEVEL_SELECT_00},
{1,STR__DEBUG__LEVEL_SELECT_01},
{2,STR__DEBUG__LEVEL_SELECT_02},
{3,STR__DEBUG__LEVEL_SELECT_03},
};
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);
m_guiFrame->setObjectXYWH(50,40,412,100);
CGUIFactory::createCycleButtonFrame(m_guiFrame,
50,10,312,40,
STR__DEBUG__LEVEL_SELECT,
&m_level,s_levelValues,s_levelReadoutText);
CGUIFactory::createValueButtonFrame(m_guiFrame,
50,50,312,40,
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)
{
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 */