aboutsummaryrefslogtreecommitdiff
path: root/engines/toon
diff options
context:
space:
mode:
Diffstat (limited to 'engines/toon')
-rw-r--r--engines/toon/anim.cpp7
-rw-r--r--engines/toon/font.cpp2
-rw-r--r--engines/toon/font.h2
-rw-r--r--engines/toon/hotspot.cpp2
-rw-r--r--engines/toon/hotspot.h2
-rw-r--r--engines/toon/path.cpp6
-rw-r--r--engines/toon/picture.cpp6
-rw-r--r--engines/toon/picture.h1
-rw-r--r--engines/toon/resource.cpp11
-rw-r--r--engines/toon/toon.cpp9
10 files changed, 35 insertions, 13 deletions
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 53980e3dc1..169d53de5d 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -58,6 +58,7 @@ bool Animation::loadAnimation(Common::String file) {
uint8 *currentData = fileData + 68;
if (_paletteEntries) {
if (paletteSize) {
+ delete[] _palette;
_palette = new uint8[paletteSize];
memcpy(_palette, currentData, paletteSize);
currentData += paletteSize;
@@ -74,6 +75,7 @@ bool Animation::loadAnimation(Common::String file) {
if (READ_LE_UINT32(finalBuffer) == 0x12345678) {
uint8 *data = finalBuffer;
+ delete[] _frames;
_frames = new AnimationFrame[_numFrames];
for (int32 e = 0; e < _numFrames; e++) {
if (READ_LE_UINT32(data) != 0x12345678)
@@ -111,8 +113,9 @@ bool Animation::loadAnimation(Common::String file) {
}
Animation::Animation(ToonEngine *vm) : _vm(vm) {
- _palette = 0;
- _frames = 0;
+ _palette = NULL;
+ _numFrames = 0;
+ _frames = NULL;
}
Animation::~Animation() {
diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp
index 8b042f499d..a8a1091d12 100644
--- a/engines/toon/font.cpp
+++ b/engines/toon/font.cpp
@@ -32,7 +32,9 @@ FontRenderer::FontRenderer(ToonEngine *vm) : _vm(vm) {
_currentFontColor[1] = 0xc8;
_currentFontColor[2] = 0xcb;
_currentFontColor[3] = 0xce;
+}
+FontRenderer::~FontRenderer() {
}
// mapping extended characters required for foreign versions to font (animation)
diff --git a/engines/toon/font.h b/engines/toon/font.h
index e1b00fbf54..739d215e36 100644
--- a/engines/toon/font.h
+++ b/engines/toon/font.h
@@ -33,7 +33,7 @@ namespace Toon {
class FontRenderer {
public:
FontRenderer(ToonEngine *vm);
- ~FontRenderer(void);
+ ~FontRenderer();
void setFont(Animation *font);
void computeSize(Common::String origText, int32 *retX, int32 *retY);
diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp
index 5af61197d7..782e49c2d5 100644
--- a/engines/toon/hotspot.cpp
+++ b/engines/toon/hotspot.cpp
@@ -33,6 +33,8 @@ Hotspots::Hotspots(ToonEngine *vm) : _vm(vm) {
_numItems = 0;
}
+Hotspots::~Hotspots() {
+}
void Hotspots::load(Common::ReadStream *Stream) {
delete[] _items;
diff --git a/engines/toon/hotspot.h b/engines/toon/hotspot.h
index 233bcebcb7..aabcd531fe 100644
--- a/engines/toon/hotspot.h
+++ b/engines/toon/hotspot.h
@@ -51,7 +51,7 @@ private:
class Hotspots {
public:
Hotspots(ToonEngine *vm);
- ~Hotspots(void);
+ ~Hotspots();
bool LoadRif(Common::String rifName, Common::String additionalRifName);
int32 Find(int32 x, int32 y);
diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp
index cec9c7dbf0..f804f5aae5 100644
--- a/engines/toon/path.cpp
+++ b/engines/toon/path.cpp
@@ -126,7 +126,7 @@ PathFinding::PathFinding(ToonEngine *vm) : _vm(vm) {
_width = 0;
_height = 0;
_heap = new PathFindingHeap();
- _gridTemp = 0;
+ _gridTemp = NULL;
_numBlockingRects = 0;
}
@@ -135,6 +135,7 @@ PathFinding::~PathFinding(void) {
_heap->unload();
delete _heap;
}
+ delete[] _gridTemp;
}
bool PathFinding::isWalkable(int32 x, int32 y) {
@@ -323,8 +324,7 @@ void PathFinding::init(Picture *mask) {
_currentMask = mask;
_heap->unload();
_heap->init(_width * _height);
- if (_gridTemp)
- delete[] _gridTemp;
+ delete[] _gridTemp;
_gridTemp = new int32[_width*_height];
}
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index 11a5572066..b797079c00 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -130,7 +130,13 @@ bool Picture::loadPicture(Common::String file, bool totalPalette /*= false*/) {
}
Picture::Picture(ToonEngine *vm) : _vm(vm) {
+ _data = NULL;
+ _palette = NULL;
+}
+Picture::~Picture() {
+ delete[] _data;
+ delete[] _palette;
}
void Picture::setupPalette() {
diff --git a/engines/toon/picture.h b/engines/toon/picture.h
index 5065843b3c..1b0fd7f550 100644
--- a/engines/toon/picture.h
+++ b/engines/toon/picture.h
@@ -40,6 +40,7 @@ class Picture {
public:
Picture(ToonEngine *vm);
+ ~Picture();
bool loadPicture(Common::String file, bool totalPalette = false);
void setupPalette();
void draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy);
diff --git a/engines/toon/resource.cpp b/engines/toon/resource.cpp
index 348aa45ae9..470c54f8f4 100644
--- a/engines/toon/resource.cpp
+++ b/engines/toon/resource.cpp
@@ -184,6 +184,7 @@ void PakFile::open(Common::SeekableReadStream *rs, Common::String packName, bool
if (preloadEntirePackage) {
_bufferSize = rs->size();
+ delete[] _buffer;
_buffer = new uint8[_bufferSize];
rs->seek(0);
rs->read(_buffer, _bufferSize);
@@ -191,9 +192,7 @@ void PakFile::open(Common::SeekableReadStream *rs, Common::String packName, bool
}
void PakFile::close() {
- if (_buffer) {
- delete[] _buffer;
- }
+ delete[] _buffer;
if (_fileHandle) {
_fileHandle->close();
@@ -205,11 +204,11 @@ PakFile::~PakFile() {
close();
}
-
PakFile::PakFile() {
- _fileHandle = 0;
- _buffer = 0;
_bufferSize = 0;
+ _buffer = NULL;
+
+ _fileHandle = NULL;
}
} // End of namespace Toon
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 9ccd947977..0ce993e6de 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -755,6 +755,10 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription)
DebugMan.addDebugChannel(kDebugTools, "Tools", "Tools debug level");
DebugMan.addDebugChannel(kDebugText, "Text", "Text debug level");
+ _hotspots = NULL;
+ _fontRenderer = NULL;
+ _fontToon = NULL;
+ _fontEZ = NULL;
_console = new ToonConsole(this);
switch (_language) {
@@ -783,6 +787,11 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription)
}
ToonEngine::~ToonEngine() {
+ delete _fontRenderer;
+ delete _fontToon;
+ delete _fontEZ;
+ delete[] _hotspots;
+
DebugMan.clearAllDebugChannels();
delete _console;
}