CGE: Cleaned up room preview handling code and fixed memory leak

This commit is contained in:
Paul Gilbert 2011-07-16 15:17:18 +10:00
parent 453fbb7454
commit c3f3120194
4 changed files with 11 additions and 6 deletions

View File

@ -60,6 +60,9 @@ void CGEEngine::setup() {
_lastFrame = 0;
_hero = NULL;
_shadow = NULL;
_miniCave = NULL;
_miniShp = NULL;
_miniShpList = NULL;
// Create debugger console
_console = new CGEConsole(this);
@ -82,8 +85,6 @@ void CGEEngine::setup() {
_pocket[i]->_flags._kill = false;
}
_sprite = new Sprite(this, NULL);
_miniCave = new Sprite(this, NULL);
_miniCave->_flags._kill = false;
_horzLine = new HorizLine(this);
_infoLine = new InfoLine(this, INFO_W);
_cavLight = new CavLight(this);

View File

@ -85,7 +85,9 @@ public:
int _lev;
Common::RandomSource _randomSource;
byte * _mini;
byte * _mini;
BMP_PTR * _miniShp;
BMP_PTR * _miniShpList;
virtual Common::Error run();
GUI::Debugger *getDebugger() {

View File

@ -90,8 +90,6 @@ static char _usrFnam[15] = "\0ɱ%^
//--------------------------------------------------------------------------
static BMP_PTR *_miniShpList = NULL;
static BMP_PTR _miniShp[] = { NULL, NULL };
static bool _finis = false;
int _offUseCount;
uint16 *_intStackPtr = false;
@ -1364,11 +1362,15 @@ void CGEEngine::runGame() {
killMidi();
if (_mini && INI_FILE::exist("MINI.SPR")) {
_miniShp = new BMP_PTR[2];
_miniShp[0] = _miniShp[1] = NULL;
uint8 *ptr = (uint8 *) &*_mini;
if (ptr != NULL) {
loadSprite("MINI", -1, 0, MINI_X, MINI_Y);
expandSprite(_miniCave = _sprite); // NULL is ok
if (_miniCave) {
_miniCave->_flags._kill = false;
_miniCave->_flags._hide = true;
_miniCave->moveShapes(ptr);
_miniShp[0] = new Bitmap(*_miniCave->shp());

View File

@ -1378,4 +1378,4 @@ PocLight::PocLight(CGEEngine *vm): Sprite(vm, NULL) {
_flags._kill = false;
}
} // End of namespace CGE
} // End of namespace CGE