SBSPSS/source/game/pause.cpp

224 lines
5.6 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
-------- */
#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-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-02-09 22:57:12 +01:00
#define FRAME_WIDTH 390
#define FRAME_HEIGHT 185
2001-02-09 22:41:55 +01:00
#define TEXT_BOX_WIDTH 300
#define TEXT_BOX_HEIGHT 20
#define OT_POS 5
2001-02-28 20:37:01 +01:00
#define TEXT_SPACING 13
2001-02-09 22:41:55 +01:00
extern int newmode;
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);
m_guiFrame->setObjectXYWH((512-FRAME_WIDTH)/2,(256-FRAME_HEIGHT)/2,FRAME_WIDTH,FRAME_HEIGHT);
m_guiFrame->setOt(OT_POS);
m_guiFrame->setFlags(CGUIObject::FLAG_DRAWBORDER);
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-02-28 20:37:01 +01:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING,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-02-09 22:41:55 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-02-28 20:37:01 +01:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*2,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-12 18:18:17 +01:00
STR__PAUSE_MENU__QUIT,
&m_quitGameFlag,true);
2001-02-12 22:54:44 +01:00
2001-02-12 18:18:17 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-02-28 20:37:01 +01:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*4,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-12 22:54:44 +01:00
STR__DEBUG__FLY_MODE,
&newmode,PLAYER_MODE_FLY);
2001-02-09 22:41:55 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-02-28 20:37:01 +01:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*5,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-12 22:54:44 +01:00
STR__DEBUG__BASICUNARMED_MODE,
&newmode,PLAYER_MODE_BASICUNARMED);
#ifdef __USER_paul__
2001-02-09 22:41:55 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-02-28 20:37:01 +01:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*6,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-12 22:54:44 +01:00
STR__DEBUG__FULLUNARMED_MODE,
&newmode,PLAYER_MODE_FULLUNARMED);
2001-02-09 22:41:55 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-02-28 20:37:01 +01:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*7,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-12 22:54:44 +01:00
STR__DEBUG__SQUEAKYBOOTS_MODE,
&newmode,PLAYER_MODE_SQUEAKYBOOTS);
2001-02-09 22:41:55 +01:00
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-02-28 20:37:01 +01:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*8,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-12 22:54:44 +01:00
STR__DEBUG__NET_MODE,
&newmode,PLAYER_MODE_NET);
CGUIFactory::createValueButtonFrame(m_guiFrame,
2001-02-28 20:37:01 +01:00
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*9,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
STR__DEBUG__BALLOON_MODE,
&newmode,PLAYER_MODE_BALLOON);
CGUIFactory::createValueButtonFrame(m_guiFrame,
(FRAME_WIDTH-TEXT_BOX_WIDTH)/2,TEXT_SPACING*10,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT,
2001-02-09 22:41:55 +01:00
STR__DEBUG__CORALBLOWER_MODE,
2001-02-12 22:54:44 +01:00
&newmode,PLAYER_MODE_CORALBLOWER);
2001-02-12 18:18:17 +01:00
#endif
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
{
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-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 */