This commit is contained in:
parent
6ce958919a
commit
4b8f6991e9
2 changed files with 40 additions and 3 deletions
|
@ -55,12 +55,12 @@ Available options are:
|
||||||
#define DBG_OUTPUT_TO_DEBUGGER
|
#define DBG_OUTPUT_TO_DEBUGGER
|
||||||
#define DBG_SHOW_MESSAGE_ORIGIN
|
#define DBG_SHOW_MESSAGE_ORIGIN
|
||||||
#define DBG_FILENAME_LENGTH 16
|
#define DBG_FILENAME_LENGTH 16
|
||||||
#define DBG_DEFAULT_CHANNEL DC_CHARLES|DC_SYSTEM|DC_SOUND
|
#define DBG_DEFAULT_CHANNEL DC_CHARLES|DC_SYSTEM
|
||||||
#elif __USER_dave__
|
#elif __USER_dave__
|
||||||
#define DBG_OUTPUT_TO_DEBUGGER
|
#define DBG_OUTPUT_TO_DEBUGGER
|
||||||
#define DBG_SHOW_MESSAGE_ORIGIN
|
#define DBG_SHOW_MESSAGE_ORIGIN
|
||||||
#define DBG_FILENAME_LENGTH 16
|
#define DBG_FILENAME_LENGTH 16
|
||||||
#define DBG_DEFAULT_CHANNEL DC_DAVE|DC_SYSTEM|DC_SOUND
|
#define DBG_DEFAULT_CHANNEL DC_DAVE|DC_SYSTEM
|
||||||
#elif __USER_paul__
|
#elif __USER_paul__
|
||||||
#define DBG_OUTPUT_TO_DEBUGGER
|
#define DBG_OUTPUT_TO_DEBUGGER
|
||||||
#define DBG_OUTPUT_TO_LOG
|
#define DBG_OUTPUT_TO_LOG
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
#include "system\clickcount.h"
|
#include "system\clickcount.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __MEMORY_HEADER__
|
||||||
|
#include "mem\memory.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -28,6 +31,12 @@ static CScene *s_pendingScene;
|
||||||
int GameState::s_timeSinceLast;
|
int GameState::s_timeSinceLast;
|
||||||
static CClickCount s_clickCounter;
|
static CClickCount s_clickCounter;
|
||||||
|
|
||||||
|
#ifdef __VERSION_DEBUG__
|
||||||
|
static int s_baseMemory=0;
|
||||||
|
static int s_baseSceneMemory=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -54,16 +63,44 @@ void GameState::think()
|
||||||
if(s_currentScene->readyToShutdown())
|
if(s_currentScene->readyToShutdown())
|
||||||
{
|
{
|
||||||
SYSTEM_DBGMSG("GameState: Closing down scene..");
|
SYSTEM_DBGMSG("GameState: Closing down scene..");
|
||||||
|
#ifdef __VERSION_DEBUG__
|
||||||
|
int gain;
|
||||||
|
gain=MainRam.RamUsed-s_baseSceneMemory;
|
||||||
|
if(gain)
|
||||||
|
{
|
||||||
|
SYSTEM_DBGMSG("Scene allocated an extra %d bytes after init()",gain);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
ASSERT(s_pendingScene); // There really should be a scene pending before you shutdown..!
|
ASSERT(s_pendingScene); // There really should be a scene pending before you shutdown..!
|
||||||
s_currentScene->shutdown();
|
s_currentScene->shutdown();
|
||||||
s_currentScene=NULL;
|
s_currentScene=NULL;
|
||||||
|
#ifdef __VERSION_DEBUG__
|
||||||
|
int loss;
|
||||||
|
loss=MainRam.RamUsed-s_baseMemory;
|
||||||
|
if(loss)
|
||||||
|
{
|
||||||
|
SYSTEM_DBGMSG("MEMORY HAS CHANGED BY %d BYTES DURING SCENE!",loss);
|
||||||
|
ASSERT(0);
|
||||||
|
s_baseMemory=0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!s_currentScene)
|
if(!s_currentScene)
|
||||||
{
|
{
|
||||||
SYSTEM_DBGMSG("GameState: Opening new scene..");
|
#ifdef __VERSION_DEBUG__
|
||||||
|
if(s_baseMemory==0)
|
||||||
|
{
|
||||||
|
s_baseMemory=MainRam.RamUsed;
|
||||||
|
}
|
||||||
|
SYSTEM_DBGMSG("GameState: Opening new scene ( with %d bytes used )",s_baseMemory);
|
||||||
|
#endif
|
||||||
s_currentScene=s_pendingScene;
|
s_currentScene=s_pendingScene;
|
||||||
s_currentScene->init();
|
s_currentScene->init();
|
||||||
|
#ifdef __VERSION_DEBUG__
|
||||||
|
s_baseSceneMemory=MainRam.RamUsed;
|
||||||
|
SYSTEM_DBGMSG("GameState: Scene has used %d bytes during init()",s_baseSceneMemory-s_baseMemory);
|
||||||
|
#endif
|
||||||
s_pendingScene=NULL;
|
s_pendingScene=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue