aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/he
diff options
context:
space:
mode:
authorCameron Cawley2019-12-31 19:19:42 +0000
committerFilippos Karapetis2020-01-11 17:34:12 +0200
commit948c555ea616821ed7c2678ad406ed5bea392339 (patch)
tree000a4566cd70bdddff6d8f4d64edfc3db9119ac5 /engines/scumm/he
parent395f707203e8f30add0b2f8e9d8616dd12468676 (diff)
downloadscummvm-rg350-948c555ea616821ed7c2678ad406ed5bea392339.tar.gz
scummvm-rg350-948c555ea616821ed7c2678ad406ed5bea392339.tar.bz2
scummvm-rg350-948c555ea616821ed7c2678ad406ed5bea392339.zip
ALL: Create all instances of NEResources and PEResources using new instead of on the stack
Also adapted WinCursorGroup and MacMenu to reflect this.
Diffstat (limited to 'engines/scumm/he')
-rw-r--r--engines/scumm/he/moonbase/moonbase.cpp3
-rw-r--r--engines/scumm/he/moonbase/moonbase.h2
-rw-r--r--engines/scumm/he/moonbase/moonbase_fow.cpp4
-rw-r--r--engines/scumm/he/resource_he.cpp7
-rw-r--r--engines/scumm/he/resource_he.h4
5 files changed, 14 insertions, 6 deletions
diff --git a/engines/scumm/he/moonbase/moonbase.cpp b/engines/scumm/he/moonbase/moonbase.cpp
index cb76c3f273..9b7ec9970e 100644
--- a/engines/scumm/he/moonbase/moonbase.cpp
+++ b/engines/scumm/he/moonbase/moonbase.cpp
@@ -30,6 +30,8 @@
namespace Scumm {
Moonbase::Moonbase(ScummEngine_v100he *vm) : _vm(vm) {
+ _exe = new Common::PEResources();
+
initFOW();
_ai = new AI(_vm);
@@ -39,6 +41,7 @@ Moonbase::Moonbase(ScummEngine_v100he *vm) : _vm(vm) {
}
Moonbase::~Moonbase() {
+ delete _exe;
delete _ai;
#ifdef USE_LIBCURL
delete _net;
diff --git a/engines/scumm/he/moonbase/moonbase.h b/engines/scumm/he/moonbase/moonbase.h
index d5fa4550ac..97ad6b7095 100644
--- a/engines/scumm/he/moonbase/moonbase.h
+++ b/engines/scumm/he/moonbase/moonbase.h
@@ -106,7 +106,7 @@ private:
int32 _fowRenderTable[32768];
- Common::PEResources _exe;
+ Common::PEResources *_exe;
Common::String _fileName;
};
diff --git a/engines/scumm/he/moonbase/moonbase_fow.cpp b/engines/scumm/he/moonbase/moonbase_fow.cpp
index 2e1265aff2..28d7e0cd55 100644
--- a/engines/scumm/he/moonbase/moonbase_fow.cpp
+++ b/engines/scumm/he/moonbase/moonbase_fow.cpp
@@ -99,11 +99,11 @@ bool Moonbase::setFOWImage(int image) {
if (_fileName.empty()) { // We are running for the first time
_fileName = _vm->generateFilename(-3);
- if (!_exe.loadFromEXE(_fileName))
+ if (!_exe->loadFromEXE(_fileName))
error("Cannot open file %s", _fileName.c_str());
}
- Common::SeekableReadStream *stream = _exe.getResource(Common::kWinRCData, resId);
+ Common::SeekableReadStream *stream = _exe->getResource(Common::kWinRCData, resId);
if (stream->size()) {
_fowImage = (uint8 *)malloc(stream->size());
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index ddde352686..3de890f41b 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -114,13 +114,18 @@ void ResExtractor::setCursor(int id) {
Win32ResExtractor::Win32ResExtractor(ScummEngine_v70he *scumm) : ResExtractor(scumm) {
+ _exe = new Common::PEResources();
+}
+
+Win32ResExtractor::~Win32ResExtractor() {
+ delete _exe;
}
bool Win32ResExtractor::extractResource(int id, CachedCursor *cc) {
if (_fileName.empty()) { // We are running for the first time
_fileName = _vm->generateFilename(-3);
- if (!_exe.loadFromEXE(_fileName))
+ if (!_exe->loadFromEXE(_fileName))
error("Cannot open file %s", _fileName.c_str());
}
diff --git a/engines/scumm/he/resource_he.h b/engines/scumm/he/resource_he.h
index 49175db8d4..617ed1f446 100644
--- a/engines/scumm/he/resource_he.h
+++ b/engines/scumm/he/resource_he.h
@@ -68,10 +68,10 @@ private:
class Win32ResExtractor : public ResExtractor {
public:
Win32ResExtractor(ScummEngine_v70he *scumm);
- ~Win32ResExtractor() {}
+ ~Win32ResExtractor();
private:
- Common::PEResources _exe;
+ Common::PEResources *_exe;
bool extractResource(int id, CachedCursor *cc);
};