aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorPaul Gilbert2011-07-16 15:17:18 +1000
committerPaul Gilbert2011-07-16 15:17:18 +1000
commitc3f3120194151cdeb31d9b3622c76cd4e5b7ed6a (patch)
treebefc674957aa5e322c87ecd5f47464557634bdcb /engines/cge
parent453fbb7454b5e6d517febd29aea4e589c44247bf (diff)
downloadscummvm-rg350-c3f3120194151cdeb31d9b3622c76cd4e5b7ed6a.tar.gz
scummvm-rg350-c3f3120194151cdeb31d9b3622c76cd4e5b7ed6a.tar.bz2
scummvm-rg350-c3f3120194151cdeb31d9b3622c76cd4e5b7ed6a.zip
CGE: Cleaned up room preview handling code and fixed memory leak
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/cge.cpp5
-rw-r--r--engines/cge/cge.h4
-rw-r--r--engines/cge/cge_main.cpp6
-rw-r--r--engines/cge/vga13h.cpp2
4 files changed, 11 insertions, 6 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 5c1bf2caf0..6924f0b14e 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -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);
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index bb14251599..9894cc07bc 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -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() {
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 3c926a3f89..e518c668f4 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -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());
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index ec616a2551..716a6b584d 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -1378,4 +1378,4 @@ PocLight::PocLight(CGEEngine *vm): Sprite(vm, NULL) {
_flags._kill = false;
}
-} // End of namespace CGE
+} // End of namespace CGE \ No newline at end of file