SBSPSS/source/game/pause.cpp

283 lines
7.5 KiB
C++
Raw Normal View History

2001-02-09 18:48:35 +01:00
/*=========================================================================
pause.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
2001-06-21 21:19:15 +02:00
#include "system\vid.h"
2001-02-09 18:48:35 +01:00
#include "game\pause.h"
#ifndef __GUI_GFRAME_H__
#include "gui\gframe.h"
#endif
2001-02-09 22:41:55 +01:00
#ifndef __GUI_GFACTORY_H__
#include "gui\gfactory.h"
2001-02-09 18:48:35 +01:00
#endif
2001-02-09 22:41:55 +01:00
#ifndef __MEMORY_HEADER__
#include "mem\memory.h"
2001-02-09 18:48:35 +01:00
#endif
2001-02-12 22:54:44 +01:00
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
2001-05-13 23:06:26 +02:00
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
2001-02-09 18:48:35 +01:00
/* Std Lib
------- */
/* Data
---- */
#ifndef __STRING_ENUMS__
#include <trans.h>
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-03-09 20:57:10 +01:00
static const int FRAME_WIDTH =352;
static const int FRAME_HEIGHT =160;
static const int TEXT_BOX_WIDTH =300;
static const int TEXT_BOX_HEIGHT =20;
static const int TEXT_SPACING =13;
2001-02-09 22:41:55 +01:00
extern int newmode;
2001-04-25 20:38:00 +02:00
extern int invincibleSponge;
int inv_data[]={0,1,-1};
static CGUITextReadout::TextReadoutData inv_readoutdata[2]={{0,STR__OFF},{1,STR__ON}};
2001-02-09 22:41:55 +01:00
void CPauseMenu::init()
2001-02-09 18:48:35 +01:00
{
2001-02-09 22:41:55 +01:00
m_guiFrame=new ("Conversation GUI") CGUIControlFrame();
m_guiFrame->init(0);
2001-06-21 21:19:15 +02:00
m_guiFrame->setObjectXYWH((INGAME_SCREENW-FRAME_WIDTH)/2,(INGAME_SCREENH-FRAME_HEIGHT)/2,FRAME_WIDTH,FRAME_HEIGHT);
2001-02-09 22:41:55 +01:00
m_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER);
2001-03-31 20:22:38 +02:00
int xpos=TEXT_SPACING/2;
2001-05-11 23:35:08 +02:00
2001-05-16 21:45:43 +02:00
#if defined (__USER_paul__) || defined (__USER_charles__)
2001-02-09 22:41:55 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-03-25 23:33:20 +02:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-09 22:41:55 +01:00
STR__PAUSE_MENU__CONTINUE,
2001-02-12 18:18:17 +01:00
&m_exitPauseMenuFlag,true);
2001-03-25 23:33:20 +02:00
xpos+=TEXT_SPACING;
2001-02-09 22:41:55 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-03-25 23:33:20 +02:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-12 18:18:17 +01:00
STR__PAUSE_MENU__QUIT,
&m_quitGameFlag,true);
2001-04-25 20:38:00 +02:00
xpos+=TEXT_SPACING+(TEXT_SPACING/2);
2001-03-31 20:22:38 +02:00
2001-04-25 20:38:00 +02:00
CGUIFactory::createCycleButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__INVINCIBILE_SPONGEBOB,
&invincibleSponge,inv_data,inv_readoutdata);
2001-03-31 20:22:38 +02:00
xpos+=TEXT_SPACING+(TEXT_SPACING/2);
2001-02-12 18:18:17 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-03-25 23:33:20 +02:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-12 22:54:44 +01:00
STR__DEBUG__BASICUNARMED_MODE,
&newmode,PLAYER_MODE_BASICUNARMED);
2001-03-25 23:33:20 +02:00
xpos+=TEXT_SPACING;
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__FULLUNARMED_MODE,
&newmode,PLAYER_MODE_FULLUNARMED);
xpos+=TEXT_SPACING;
2001-02-12 22:54:44 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-03-25 23:33:20 +02:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-28 20:37:01 +01:00
STR__DEBUG__BALLOON_MODE,
&newmode,PLAYER_MODE_BALLOON);
2001-03-25 23:33:20 +02:00
xpos+=TEXT_SPACING;
2001-03-30 19:47:00 +02:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__BUBBLEMIXTURE_MODE,
&newmode,PLAYER_MODE_BUBBLE_MIXTURE);
xpos+=TEXT_SPACING;
2001-03-31 20:22:38 +02:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__NET_MODE,
&newmode,PLAYER_MODE_NET);
xpos+=TEXT_SPACING;
2001-03-30 19:47:00 +02:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__CORALBLOWER_MODE,
&newmode,PLAYER_MODE_CORALBLOWER);
xpos+=TEXT_SPACING;
2001-04-03 23:36:35 +02:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__JELLYLAUNCHER_MODE,
&newmode,PLAYER_MODE_JELLY_LAUNCHER);
xpos+=TEXT_SPACING;
2001-03-25 23:33:20 +02:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__DEAD_MODE,
&newmode,PLAYER_MODE_DEAD);
xpos+=TEXT_SPACING;
2001-05-11 23:35:08 +02:00
#else
2001-05-13 23:06:26 +02:00
xpos+=TEXT_SPACING*4;
2001-05-11 23:35:08 +02:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__PAUSE_MENU__CONTINUE,
&m_exitPauseMenuFlag,true);
xpos+=TEXT_SPACING*2;
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__PAUSE_MENU__QUIT,
&m_quitGameFlag,true);
xpos+=TEXT_SPACING*2;
CGUIFactory::createCycleButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__INVINCIBILE_SPONGEBOB,
&invincibleSponge,inv_data,inv_readoutdata);
xpos+=TEXT_SPACING*2;
#endif
2001-02-09 18:48:35 +01:00
2001-05-13 23:06:26 +02:00
m_guiSpatReadout=new ("SpatReadout") CGUISpatCountReadout();
m_guiSpatReadout->init(m_guiFrame);
m_guiSpatReadout->setObjectXYWH(10,10,120,40);
2001-02-09 18:48:35 +01:00
m_active=false;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-09 22:41:55 +01:00
void CPauseMenu::shutdown()
2001-02-09 18:48:35 +01:00
{
2001-02-09 22:41:55 +01:00
m_guiFrame->shutdown();
2001-02-09 18:48:35 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-09 22:41:55 +01:00
void CPauseMenu::select()
2001-02-09 18:48:35 +01:00
{
2001-05-13 23:06:26 +02:00
int chapter,level;
2001-02-09 18:48:35 +01:00
m_active=true;
2001-02-12 18:18:17 +01:00
m_exitPauseMenuFlag=false;
m_quitGameFlag=false;
2001-02-09 22:41:55 +01:00
m_guiFrame->select();
2001-05-13 23:06:26 +02:00
2001-05-31 23:17:33 +02:00
chapter=GameScene.getChapterNumber()-1;
level=GameScene.getLevelNumber()-1;
2001-06-14 17:19:57 +02:00
m_guiSpatReadout->setSpatCounts(GameScene.getPlayer()->getSpatulasHeld(),
2001-05-13 23:06:26 +02:00
GameScene.getTotalSpatCountForThisLevel());
2001-02-09 18:48:35 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-09 22:41:55 +01:00
void CPauseMenu::unselect()
2001-02-09 18:48:35 +01:00
{
2001-02-09 22:41:55 +01:00
m_active=false;
m_guiFrame->unselect();
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
#include "game\game.h"
#include "player\player.h"
void CPauseMenu::think(int _frames)
{
if(m_active)
{
m_guiFrame->think(_frames);
2001-02-12 18:18:17 +01:00
if(m_exitPauseMenuFlag||
m_quitGameFlag||
newmode!=-1)
2001-02-09 22:41:55 +01:00
{
2001-02-12 18:18:17 +01:00
if(m_quitGameFlag)
{
CGameScene::setReadyToExit();
}
2001-02-09 22:41:55 +01:00
unselect();
}
}
2001-02-09 18:48:35 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-09 22:41:55 +01:00
void CPauseMenu::render()
2001-02-09 18:48:35 +01:00
{
2001-02-09 22:41:55 +01:00
if(m_active)
{
m_guiFrame->render();
}
2001-02-09 18:48:35 +01:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-02-09 22:41:55 +01:00
int CPauseMenu::isActive()
2001-02-09 18:48:35 +01:00
{
return m_active;
}
/*===========================================================================
end */