/*=========================================================================

	gstate.cpp

	Author:		PKG
	Created: 
	Project:	PRLSR
	Purpose: 

	Copyright (c) 2000 Climax Development Ltd

===========================================================================*/


#include "system\global.h"
#include "system\gstate.h"


/*****************************************************************************/
static CScene	*s_currentScene;
static CScene	*s_pendingScene;

int		GameState::s_timeSinceLast;


/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
void GameState::initialise()
{
	s_currentScene=NULL;
	s_pendingScene=NULL;
}


/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
void GameState::think()
{
	updateTimer();

	if( s_pendingScene )
		{
		if( !s_currentScene)
			{
			if( s_currentScene )
				{
				s_currentScene->shutdown();
				}

			s_currentScene=s_pendingScene;
			s_pendingScene=NULL;

			s_currentScene->init();
			}
		}
	ASSERT(s_currentScene);
	s_currentScene->think();
}


/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
void GameState::render()
{
	ASSERT(s_currentScene);
	s_currentScene->render();
}


/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
void GameState::setNextScene( CScene *_nextScene )
{
	ASSERT(!s_pendingScene);

	s_pendingScene=_nextScene;
}


/*****************************************************************************/
CScene * GameState::getCurrentScene()
{
	return s_currentScene;
}

/*****************************************************************************/
void GameState::updateTimer()
{
}


/*===========================================================================
 end */