SBSPSS/source/fma/fma.cpp

187 lines
3.5 KiB
C++
Raw Normal View History

2001-06-04 16:54:48 +02:00
/*=========================================================================
gameover.cpp
Author: PKG
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
/*----------------------------------------------------------------------
Includes
-------- */
#include "fma\fma.h"
2001-06-04 18:10:06 +02:00
#ifndef __LEVEL_LEVEL_H__
#include "level\level.h"
#endif
#ifndef __THING_THING_H__
#include "thing\thing.h"
#endif
#ifndef __GAME_CONVO_H__
#include "game\convo.h"
#endif
#ifndef __MAP_MAP_H__
#include "map\map.h"
#endif
2001-06-04 16:54:48 +02:00
/* Std Lib
------- */
/* Data
---- */
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
/*----------------------------------------------------------------------
Function Prototypes
------------------- */
/*----------------------------------------------------------------------
Vars
---- */
CFmaScene FmaScene;
2001-06-04 18:10:06 +02:00
// tmp
#include "pad\pads.h"
// tmp
2001-06-04 16:54:48 +02:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-06-04 18:10:06 +02:00
void CFmaScene::init()
2001-06-04 16:54:48 +02:00
{
2001-06-04 18:10:06 +02:00
CThingManager::init();
CConversation::init();
CConversation::registerConversationScript(SCRIPTS_CH1L1_01_DAT);
m_level=new ("FMALevel") CLevel();
m_level->init(25);
m_cameraPos.vx=m_cameraPos.vy=0;
m_readyToShutdown=false;
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CFmaScene::shutdown()
{
m_level->shutdown(); delete m_level;
CConversation::shutdown();
CThingManager::shutdown();
2001-06-04 16:54:48 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-06-04 18:10:06 +02:00
void CFmaScene::render()
2001-06-04 16:54:48 +02:00
{
2001-06-04 18:10:06 +02:00
CThingManager::renderAllThings();
CConversation::render();
m_level->render();
2001-06-04 16:54:48 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-06-04 18:10:06 +02:00
void CFmaScene::think(int _frames)
2001-06-04 16:54:48 +02:00
{
2001-06-04 18:10:06 +02:00
// tmp
if(PadGetHeld(0)&PAD_UP)
{
m_cameraPos.vy-=10*_frames;
}
else if(PadGetHeld(0)&PAD_DOWN)
{
m_cameraPos.vy+=10*_frames;
}
else if(PadGetHeld(0)&PAD_LEFT)
{
m_cameraPos.vx-=10*_frames;
}
else if(PadGetHeld(0)&PAD_RIGHT)
{
m_cameraPos.vx+=10*_frames;
}
else if(PadGetDown(0)&PAD_START)
{
startShutdown();
}
// tmp
CThingManager::thinkAllThings(_frames);
CConversation::think(_frames);
m_level->setCameraCentre(m_cameraPos);
m_level->think(_frames);
2001-06-04 16:54:48 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-06-04 18:10:06 +02:00
int CFmaScene::readyToShutdown()
2001-06-04 16:54:48 +02:00
{
2001-06-04 18:10:06 +02:00
return m_readyToShutdown;
2001-06-04 16:54:48 +02:00
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
2001-06-04 18:10:06 +02:00
void CFmaScene::startShutdown()
2001-06-04 16:54:48 +02:00
{
2001-06-04 18:10:06 +02:00
GameState::setNextScene(&MapScene);
m_readyToShutdown=true;
2001-06-04 16:54:48 +02:00
}
/*===========================================================================
end */