SBSPSS/source/game/game.cpp

122 lines
2.5 KiB
C++
Raw Normal View History

2000-08-29 21:54:22 +02:00
/**********************/
/*** Main Game File ***/
/**********************/
#include "system\global.h"
#include "fileio\fileio.h"
#include "pad\pads.h"
#include "system\vid.h"
#include "gfx\prim.h"
#include "utils\utils.h"
2000-12-07 16:56:20 +01:00
#include "level\level.h"
2000-08-29 21:54:22 +02:00
#include "game\game.h"
#include "system\gstate.h"
#include "gfx\font.h"
#include "gfx\fdata.h"
2001-01-16 17:20:45 +01:00
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
#ifndef __ENEMY_2DENEMY_H__
#include "enemy\2denemy.h"
#endif
2001-01-15 23:02:25 +01:00
#ifndef __GFX_FADER_H__
#include "gfx\fader.h"
#endif
2000-12-07 16:56:20 +01:00
#include "level\level.h"
2001-01-12 23:45:13 +01:00
#include "gfx\anim.h"
2000-12-07 16:56:20 +01:00
2000-10-18 20:37:39 +02:00
#ifndef __GFX_BUBICLES__
#include "gfx\bubicles.h"
#endif
2000-10-31 17:41:02 +01:00
#ifndef __SPR_INGAMEFX_H__
#include <ingamefx.h>
#endif
2000-10-18 20:37:39 +02:00
2000-08-29 21:54:22 +02:00
2001-01-15 16:22:33 +01:00
int ZPos=6500;
2000-08-29 21:54:22 +02:00
/*****************************************************************************/
2001-01-15 16:22:33 +01:00
FontBank *CGameScene::s_genericFont;
MATRIX CGameScene::CamMtx;
2000-10-18 20:37:39 +02:00
2000-08-29 21:54:22 +02:00
/*****************************************************************************/
CGameScene GameScene;
/*****************************************************************************/
2000-09-12 01:41:29 +02:00
void CGameScene::init()
2000-08-29 21:54:22 +02:00
{
2000-12-07 16:56:20 +01:00
s_genericFont=new ("CGameScene::Init") FontBank();
s_genericFont->initialise( &standardFont );
s_genericFont->setColour( 255, 255 , 0 );
VidSetClearScreen(1);
2001-01-10 18:27:12 +01:00
m_conversation.init();
2000-12-07 16:56:20 +01:00
Level.init();
2001-01-16 17:20:45 +01:00
m_player=new ("player") CPlayer();
m_player->init();
C2dEnemy *enemy;
enemy=new ("test enemy") C2dEnemy;
enemy->init();
2001-01-12 23:45:13 +01:00
CAnimDB::LoadAnims();
2001-01-15 16:22:33 +01:00
SetIdentNoTrans(&CamMtx);
CamMtx.t[2]=ZPos;
2001-01-15 23:02:25 +01:00
CFader::setFadingIn();
2000-08-29 21:54:22 +02:00
}
/*****************************************************************************/
2000-12-07 16:56:20 +01:00
void CGameScene::shutdown()
2000-08-29 21:54:22 +02:00
{
2001-01-16 17:20:45 +01:00
m_player->shutdown(); delete m_player;
2000-12-07 16:56:20 +01:00
Level.shutdown();
2001-01-10 18:27:12 +01:00
m_conversation.shutdown();
s_genericFont->dump(); delete s_genericFont;
2000-08-29 21:54:22 +02:00
}
/*****************************************************************************/
2000-09-12 01:41:29 +02:00
void CGameScene::render()
2000-08-29 21:54:22 +02:00
{
2001-01-15 16:22:33 +01:00
CamMtx.t[2]=ZPos; // Temp
2001-01-10 18:27:12 +01:00
m_conversation.render();
2001-01-16 17:20:45 +01:00
CThing::renderAllThings();
2001-01-12 23:49:25 +01:00
Level.render();
2000-08-29 21:54:22 +02:00
}
/*****************************************************************************/
2000-10-19 17:40:24 +02:00
void CGameScene::think(int _frames)
2000-08-29 21:54:22 +02:00
{
2001-01-10 18:27:12 +01:00
m_conversation.think(_frames);
2001-01-16 17:20:45 +01:00
CThing::thinkAllThings(_frames);
Level.setCameraCentre(m_player->getPos());
2000-12-07 16:56:20 +01:00
Level.think(_frames);
2001-01-10 18:27:12 +01:00
2001-01-16 17:20:45 +01:00
#ifdef __USER_paul__
2001-01-10 18:27:12 +01:00
if(!m_conversation.isActive()&&PadGetDown(0)&PAD_START)
2001-01-12 23:45:13 +01:00
{
2001-01-10 18:27:12 +01:00
m_conversation.trigger(SCRIPTS_SPEECHTEST_DAT);
2001-01-12 23:45:13 +01:00
}
2001-01-16 17:20:45 +01:00
#endif
2000-08-29 21:54:22 +02:00
}
/*****************************************************************************/
2000-10-26 18:50:54 +02:00
int CGameScene::readyToShutdown()
{
return false;
}
/*****************************************************************************/