This commit is contained in:
Daveo 2001-04-04 00:16:26 +00:00
parent 1075b09fb0
commit c6fc65ca73
3 changed files with 21 additions and 6 deletions

View File

@ -91,6 +91,7 @@ int s_globalLevelSelectThing=120;
int CGameScene::s_readyToExit; int CGameScene::s_readyToExit;
int CGameScene::s_levelFinished; int CGameScene::s_levelFinished;
SpriteBank *CGameScene::s_BackSprites;
/*****************************************************************************/ /*****************************************************************************/
@ -117,7 +118,12 @@ void CGameScene::init()
CFader::setFadingIn(); CFader::setFadingIn();
s_BackSprites=new ("BackGfx Sprites") SpriteBank();
s_BackSprites->load(LEVELS_LEVELBACKGFX_SPR);
initLevel(); initLevel();
CFileIO::EnableASync(true);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -140,11 +146,13 @@ int CGameScene::canPause()
void CGameScene::shutdown() void CGameScene::shutdown()
{ {
CFileIO::EnableASync(false);
shutdownLevel(true); shutdownLevel(true);
CSoundMediator::dumpSong(); CSoundMediator::dumpSong();
m_pauseMenu->shutdown(); delete m_pauseMenu; m_pauseMenu->shutdown(); delete m_pauseMenu;
s_genericFont->dump(); delete s_genericFont; s_genericFont->dump(); delete s_genericFont;
s_BackSprites->dump(); delete s_BackSprites;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -168,6 +176,7 @@ void CGameScene::think(int _frames)
// } // }
//#endif //#endif
CFileIO::LoadASyncFiles();
if(s_readyToExit) if(s_readyToExit)
{ {
@ -274,12 +283,15 @@ void CGameScene::initLevel()
// Init actors (needs moving and tidying // Init actors (needs moving and tidying
int actorNum; int actorNum;
sThingActor **actorList = Level.getActorList();
sThingActor **actorList = Level.getActorList();
if (actorList)
{
for ( actorNum = 0 ; actorNum < Level.getActorCount() ; actorNum++ ) for ( actorNum = 0 ; actorNum < Level.getActorCount() ; actorNum++ )
{ {
CNpcEnemy *enemy; CNpcEnemy *enemy;
enemy = new ("npc enemy") CNpcEnemy; enemy = new ("npc enemy") CNpcEnemy;
ASSERT(enemy);
enemy->setTypeFromMapEdit( actorList[actorNum]->Type ); enemy->setTypeFromMapEdit( actorList[actorNum]->Type );
enemy->init(); enemy->init();
enemy->setLayerCollision( Level.getCollisionLayer() ); enemy->setLayerCollision( Level.getCollisionLayer() );
@ -312,7 +324,7 @@ void CGameScene::initLevel()
enemy->postInit(); enemy->postInit();
} }
}
// Song is loaded/dumped by the level, and played from here. This just gives some // Song is loaded/dumped by the level, and played from here. This just gives some
// better timing over when it starts (pkg) // better timing over when it starts (pkg)
CSoundMediator::playSong(); CSoundMediator::playSong();

View File

@ -14,7 +14,7 @@
/*****************************************************************************/ /*****************************************************************************/
class FontBank; class FontBank;
class SpriteBank;
class CGameScene : public CScene class CGameScene : public CScene
{ {
public: public:
@ -38,6 +38,8 @@ virtual int canPause();
static void setReadyToExit() {s_readyToExit=true;} static void setReadyToExit() {s_readyToExit=true;}
static void levelFinished() {s_levelFinished=true;} static void levelFinished() {s_levelFinished=true;}
static SpriteBank *GetBackSprites() {return(s_BackSprites);}
protected: protected:
void initLevel(); void initLevel();
@ -52,6 +54,8 @@ protected:
static int s_readyToExit; static int s_readyToExit;
static int s_levelFinished; static int s_levelFinished;
static SpriteBank *s_BackSprites;
}; };

View File

@ -13,6 +13,7 @@
#include "LayerBack.h" #include "LayerBack.h"
#include <levelbackgfx.h> #include <levelbackgfx.h>
#include "Game\game.h"
sBackRGBTable CLayerBack::BackRGBTable[]= sBackRGBTable CLayerBack::BackRGBTable[]=
{ {
@ -54,14 +55,12 @@ CLayerBack::CLayerBack(sLayerHdr *Hdr,sTile *TileBank) : CLayerTile(Hdr,TileBank
ASSERT(Data->Count<=LAYER_SHADE_RGB_MAX); ASSERT(Data->Count<=LAYER_SHADE_RGB_MAX);
BandCount=Data->Count-1; BandCount=Data->Count-1;
Sprites=new ("BackGfx Sprites") SpriteBank(); Sprites=CGameScene::GetBackSprites();
Sprites->load(LEVELS_LEVELBACKGFX_SPR);
} }
/*****************************************************************************/ /*****************************************************************************/
CLayerBack::~CLayerBack() CLayerBack::~CLayerBack()
{ {
Sprites->dump(); delete Sprites;
} }
/*****************************************************************************/ /*****************************************************************************/