From 2f2eb8ec84ce714a221ccc8904dc28b7f80a74fd Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Wed, 30 Oct 2013 21:54:36 +0000 Subject: CGE: Add detection entry for translated Spanish Soltys --- engines/cge/detection.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'engines/cge') diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index 3b01421903..c377970c51 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -115,6 +115,18 @@ static const CgeGameDescription gameDescriptions[] = { }, kGameTypeSoltys }, + { + { + "soltys", "Soltys Freeware v1.0", + { + {"vol.cat", 0, "fcae86b20eaa5cedec17b24fa5e85eb4", 50176}, + {"vol.dat", 0, "ff10d54acc2c95696c57e05819b6906f", 8450151}, + AD_LISTEND + }, + Common::ES_ESP, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO0() + }, + kGameTypeSoltys + }, { { // Polish version, provided by Strangerke -- cgit v1.2.3 From 2f333f997ba42c44fd76cefeeb1912e2548532b3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Nov 2013 09:57:42 +0100 Subject: CGE: Ensure string copy don't overrun. Fix CID 1003674 to 1003678 --- engines/cge/cge_main.cpp | 6 +++--- engines/cge/text.cpp | 5 ++--- engines/cge/vga13h.cpp | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index ae4dee6090..5325558f8b 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -1046,7 +1046,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) { len = line.size(); lcnt++; - strcpy(tmpStr, line.c_str()); + Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); if (len == 0 || *tmpStr == '.') continue; @@ -1132,7 +1132,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i _sprite->_flags._bDel = true; // Extract the filename, without the extension - strcpy(_sprite->_file, fname); + Common::strlcpy(_sprite->_file, fname, sizeof(_sprite->_file)); char *p = strchr(_sprite->_file, '.'); if (p) *p = '\0'; @@ -1158,7 +1158,7 @@ void CGEEngine::loadScript(const char *fname) { char *p; lcnt++; - strcpy(tmpStr, line.c_str()); + Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); if ((line.size() == 0) || (*tmpStr == '.')) continue; diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp index 27bb0608fd..08ff005e1e 100644 --- a/engines/cge/text.cpp +++ b/engines/cge/text.cpp @@ -69,7 +69,7 @@ int16 Text::count() { for (line = tf.readLine(); !tf.eos(); line = tf.readLine()) { char *s; assert(line.size() <= 513); - strcpy(tmpStr, line.c_str()); + Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL) continue; if (!Common::isDigit(*s)) @@ -101,8 +101,7 @@ void Text::load() { for (idx = 0, line = tf.readLine(); !tf.eos(); line = tf.readLine()) { int n = line.size(); char *s; - assert(n <= 513); - strcpy(tmpStr, line.c_str()); + Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL) continue; if (!Common::isDigit(*s)) diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index c0407cab42..4954e638ab 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -214,8 +214,7 @@ Sprite *Sprite::expand() { for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) { len = line.size(); - assert(len <= 513); - strcpy(tmpStr, line.c_str()); + Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); lcnt++; if (len == 0 || *tmpStr == '.') continue; -- cgit v1.2.3 From aa947c9474ad83aa9315bc585d1f0b79060fee61 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:33 +0100 Subject: BUILD: Split configure.engines down to a single file per engine. This is the first part of allowing engines to be added dynamically. They are placed into a folder in engines/ which must contain a file named "configure.engine" to add the engine, which is pulled into the top level configure script automatically. --- engines/cge/configure.engine | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 engines/cge/configure.engine (limited to 'engines/cge') diff --git a/engines/cge/configure.engine b/engines/cge/configure.engine new file mode 100644 index 0000000000..72af1197be --- /dev/null +++ b/engines/cge/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine cge "CGE" yes -- cgit v1.2.3 From d77cf95a185a6c8f201f417d08f246727784f728 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:34 +0100 Subject: BUILD: Split engines.mk down to a single file per engine. This is the second part of allowing engines to be added dynamically. Each folder in engines/ which must contain a file named "engine.mk" containing the make definitions for that engine. --- engines/cge/engine.mk | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 engines/cge/engine.mk (limited to 'engines/cge') diff --git a/engines/cge/engine.mk b/engines/cge/engine.mk new file mode 100644 index 0000000000..c71f4e0df2 --- /dev/null +++ b/engines/cge/engine.mk @@ -0,0 +1,4 @@ +ifdef ENABLE_CGE +DEFINES += -DENABLE_CGE=$(ENABLE_CGE) +MODULES += engines/cge +endif -- cgit v1.2.3 From 00c27a28f91cc2bbf512461e69c86be998462728 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:34 +0100 Subject: BUILD: Split engines/plugins_table header down to a file per engine. This is the third and final commit enabling fully pluggable engines. Now providing an engine folder contains a configure.engine, engine.mk and engine-plugin.h file, it will be picked up automatically by the configure script. --- engines/cge/engine-plugin.h | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 engines/cge/engine-plugin.h (limited to 'engines/cge') diff --git a/engines/cge/engine-plugin.h b/engines/cge/engine-plugin.h new file mode 100644 index 0000000000..8f9c23eec0 --- /dev/null +++ b/engines/cge/engine-plugin.h @@ -0,0 +1,3 @@ +#if PLUGIN_ENABLED_STATIC(CGE) +LINK_PLUGIN(CGE) +#endif -- cgit v1.2.3 From 1ac01d2333af11d403ef84dd5192abb18814e5b3 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:34 +0100 Subject: BUILD: Remove need for engine-plugin.h in engines. This is now generated automatically by the configure script from the engine directory names. --- engines/cge/engine-plugin.h | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 engines/cge/engine-plugin.h (limited to 'engines/cge') diff --git a/engines/cge/engine-plugin.h b/engines/cge/engine-plugin.h deleted file mode 100644 index 8f9c23eec0..0000000000 --- a/engines/cge/engine-plugin.h +++ /dev/null @@ -1,3 +0,0 @@ -#if PLUGIN_ENABLED_STATIC(CGE) -LINK_PLUGIN(CGE) -#endif -- cgit v1.2.3 From ef85456859e466adc8913041e4f31809485c45ab Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:34 +0100 Subject: BUILD: Remove need for engine.mk in each engine directory. Each engine now only has to provide a single configure.engine file adding the engine into the configure script, which then produces the required other files automatically. --- engines/cge/engine.mk | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 engines/cge/engine.mk (limited to 'engines/cge') diff --git a/engines/cge/engine.mk b/engines/cge/engine.mk deleted file mode 100644 index c71f4e0df2..0000000000 --- a/engines/cge/engine.mk +++ /dev/null @@ -1,4 +0,0 @@ -ifdef ENABLE_CGE -DEFINES += -DENABLE_CGE=$(ENABLE_CGE) -MODULES += engines/cge -endif -- cgit v1.2.3 From 5a1fe83911495bc91e08a27d76e1db03719ec8ec Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 17 Dec 2013 08:06:03 +0100 Subject: CGE: Fix check on file handlers --- engines/cge/fileio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/cge') diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp index 609d5e86aa..c08cb43a47 100644 --- a/engines/cge/fileio.cpp +++ b/engines/cge/fileio.cpp @@ -70,7 +70,7 @@ ResourceManager::ResourceManager() { _catFile = new Common::File(); _catFile->open(kCatName); - if ((!_datFile) || (!_catFile)) + if (!_datFile->isOpen() || !_catFile->isOpen()) error("Unable to open data files"); for (int i = 0; i < kBtLevel; i++) { -- cgit v1.2.3 From 4e592c724904bb0bc597e5bc7fe7707c1f858dab Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 12 Jan 2014 02:59:21 +0000 Subject: CGE: Remove unecessary void pointer usage in resource file I/O. --- engines/cge/fileio.cpp | 10 +++++----- engines/cge/fileio.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp index c08cb43a47..8ee726c46d 100644 --- a/engines/cge/fileio.cpp +++ b/engines/cge/fileio.cpp @@ -93,8 +93,8 @@ ResourceManager::~ResourceManager() { delete _buff[i]._page; } -uint16 ResourceManager::XCrypt(void *buf, uint16 length) { - byte *b = static_cast(buf); +uint16 ResourceManager::XCrypt(byte *buf, uint16 length) { + byte *b = buf; for (uint16 i = 0; i < length; i++) *b++ ^= kCryptSeed; @@ -106,7 +106,7 @@ bool ResourceManager::seek(int32 offs, int whence) { return _datFile->seek(offs, whence); } -uint16 ResourceManager::read(void *buf, uint16 length) { +uint16 ResourceManager::read(byte *buf, uint16 length) { if (!_datFile->isOpen()) return 0; @@ -178,7 +178,7 @@ bool ResourceManager::exist(const char *name) { return scumm_stricmp(find(name)->_key, name) == 0; } -uint16 ResourceManager::catRead(void *buf, uint16 length) { +uint16 ResourceManager::catRead(byte *buf, uint16 length) { if (!_catFile->isOpen()) return 0; @@ -225,7 +225,7 @@ EncryptedStream::EncryptedStream(CGEEngine *vm, const char *name) : _vm(vm) { _readStream = new Common::MemoryReadStream(dataBuffer, bufSize, DisposeAfterUse::YES); } -uint32 EncryptedStream::read(void *dataPtr, uint32 dataSize) { +uint32 EncryptedStream::read(byte *dataPtr, uint32 dataSize) { return _readStream->read(dataPtr, dataSize); } diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h index cee1fa79ef..653aabae8f 100644 --- a/engines/cge/fileio.h +++ b/engines/cge/fileio.h @@ -83,15 +83,15 @@ class ResourceManager { } _buff[kBtLevel]; BtPage *getPage(int level, uint16 pageId); - uint16 catRead(void *buf, uint16 length); + uint16 catRead(byte *buf, uint16 length); Common::File *_catFile; Common::File *_datFile; - uint16 XCrypt(void *buf, uint16 length); + uint16 XCrypt(byte *buf, uint16 length); public: ResourceManager(); ~ResourceManager(); - uint16 read(void *buf, uint16 length); + uint16 read(byte *buf, uint16 length); bool seek(int32 offs, int whence = 0); BtKeypack *find(const char *key); @@ -111,7 +111,7 @@ public: bool seek(int32 offset); int32 pos(); int32 size(); - uint32 read(void *dataPtr, uint32 dataSize); + uint32 read(byte *dataPtr, uint32 dataSize); Common::String readLine(); }; -- cgit v1.2.3 From ac4087856f02725c288e1cef6b089acf7a6121aa Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 15 Dec 2013 08:17:57 +0000 Subject: ALL: Remove optimization unstable code on checking for null after new. These issues were identified by the STACK tool. By default, the C++ new operator will throw an exception on allocation failure, rather than returning a null pointer. The result is that testing the returned pointer for null is redundant and _may_ be removed by the compiler. This is thus optimization unstable and may result in incorrect behaviour at runtime. However, we do not use exceptions as they are not supported by all compilers and may be disabled. To make this stable without removing the null check, you could qualify the new operator call with std::nothrow to indicate that this should return a null, rather than throwing an exception. However, using (std::nothrow) was not desirable due to the Symbian toolchain lacking a header. A global solution to this was also not easy by redefining "new" as "new (std::nothrow)" due to custom constructors in NDS toolchain and various common classes. Also, this would then need explicit checks for OOM adding to all new usages as per C malloc which is untidy. For now to remove this optimisation unstable code is best as it is likely to not be present anyway, and OOM will cause a system library exception instead, even without exceptions enabled in the application code. --- engines/cge/cge_main.cpp | 14 ++++++-------- engines/cge/sound.cpp | 4 ++++ 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 5325558f8b..602b36d6ef 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -539,14 +539,12 @@ void CGEEngine::setMapBrick(int x, int z) { debugC(1, kCGEDebugEngine, "CGEEngine::setMapBrick(%d, %d)", x, z); Square *s = new Square(this); - if (s) { - char n[6]; - s->gotoxy(x * kMapGridX, kMapTop + z * kMapGridZ); - sprintf(n, "%02d:%02d", x, z); - _clusterMap[z][x] = 1; - s->setName(n); - _vga->_showQ->insert(s, _vga->_showQ->first()); - } + char n[6]; + s->gotoxy(x * kMapGridX, kMapTop + z * kMapGridZ); + sprintf(n, "%02d:%02d", x, z); + _clusterMap[z][x] = 1; + s->setName(n); + _vga->_showQ->insert(s, _vga->_showQ->first()); } void CGEEngine::keyClick() { diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index b378898955..892b826318 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -186,6 +186,10 @@ DataCk *Fx::load(int idx, int ref) { DataCk *Fx::loadWave(EncryptedStream *file) { byte *data = (byte *)malloc(file->size()); + + if (!data) + return 0; + file->read(data, file->size()); return new DataCk(data, file->size()); -- cgit v1.2.3 From 3cf79e079256947c3c0c37046fce10d95f390bc2 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Fri, 17 Jan 2014 04:32:13 +0000 Subject: CGE: Further alignment fixes to Bitmap class. This fixes bug #6476 - "DC: Soltys (CGE) crashes at start up". --- engines/cge/bitmap.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index 989d2bbe99..5acd111c97 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -72,16 +72,16 @@ Bitmap::Bitmap(CGEEngine *vm, uint16 w, uint16 h, uint8 fill) // + room for wash table assert(v != NULL); - *(uint16 *) v = TO_LE_16(kBmpCPY | dsiz); // data chunk hader + WRITE_LE_UINT16(v, (kBmpCPY | dsiz)); // data chunk hader memset(v + 2, fill, dsiz); // data bytes - *(uint16 *)(v + lsiz - 2) = TO_LE_16(kBmpSKP | ((kScrWidth / 4) - dsiz)); // gap + WRITE_LE_UINT16(v + lsiz - 2, (kBmpSKP | ((kScrWidth / 4) - dsiz))); // gap // Replicate lines byte *destP; for (destP = v + lsiz; destP < (v + psiz); destP += lsiz) Common::copy(v, v + lsiz, destP); - *(uint16 *)(v + psiz - 2) = TO_LE_16(kBmpEOI); // plane trailer uint16 + WRITE_LE_UINT16(v + psiz - 2, kBmpEOI); // plane trailer uint16 // Replicate planes for (destP = v + psiz; destP < (v + 4 * psiz); destP += psiz) -- cgit v1.2.3 From a1ab4cb062d5b94c2b0c590816b68770d8989248 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Feb 2014 11:22:21 +0100 Subject: CGE: Reduce the scope of some variables --- engines/cge/cge_main.cpp | 5 ++--- engines/cge/detection.cpp | 3 +-- engines/cge/vga13h.cpp | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 602b36d6ef..b4015334c8 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -125,9 +125,8 @@ char *CGEEngine::mergeExt(char *buf, const char *name, const char *ext) { } int CGEEngine::takeEnum(const char **tab, const char *text) { - const char **e; if (text) { - for (e = tab; *e; e++) { + for (const char **e = tab; *e; e++) { if (scumm_stricmp(text, *e) == 0) { return e - tab; } @@ -1029,7 +1028,6 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i bool east = false; bool port = false; bool tran = false; - int i, lcnt = 0; char tmpStr[kLineMax + 1]; Common::String line; @@ -1041,6 +1039,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i error("Bad SPR [%s]", tmpStr); uint16 len; + int i, lcnt = 0; for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) { len = line.size(); lcnt++; diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index c377970c51..0c7c2e2d64 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -208,10 +208,9 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const { sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) SaveStateList saveList; - int slotNum = 0; for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) { // Obtain the last 3 digits of the filename, since they correspond to the save slot - slotNum = atoi(filename->c_str() + filename->size() - 3); + int slotNum = atoi(filename->c_str() + filename->size() - 3); if (slotNum >= 0 && slotNum <= 99) { diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 4954e638ab..2022b803a5 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -210,10 +210,10 @@ Sprite *Sprite::expand() { error("Bad SPR [%s]", fname); Common::String line; char tmpStr[kLineMax + 1]; - int len = 0, lcnt = 0; + int lcnt = 0; for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) { - len = line.size(); + int len = line.size(); Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); lcnt++; if (len == 0 || *tmpStr == '.') -- cgit v1.2.3 From 12e9c31f415a89b99dc389432afd3f32575be23b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 13 Feb 2014 00:00:43 +0100 Subject: CGE: Add an option to toggle color blind mode from the launcher --- engines/cge/detection.cpp | 50 ++++++++++++++++++++++++++++++++--------------- engines/cge/vga13h.cpp | 5 +++++ 2 files changed, 39 insertions(+), 16 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index 0c7c2e2d64..11f2a43854 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -24,10 +24,22 @@ #include "engines/advancedDetector.h" #include "common/savefile.h" #include "common/system.h" +#include "common/translation.h" #include "base/plugins.h" #include "graphics/thumbnail.h" #include "cge/cge.h" +namespace CGE { + +struct CgeGameDescription { + ADGameDescription desc; + GameType gameType; +}; + +#define GAMEOPTION_COLOR_BLIND_DEFAULT_OFF GUIO_GAMEOPTIONS1 + +} // End of namespace CGE + static const PlainGameDescriptor CGEGames[] = { { "soltys", "Soltys" }, { "sfinx", "Sfinx" }, @@ -36,11 +48,6 @@ static const PlainGameDescriptor CGEGames[] = { namespace CGE { -struct CgeGameDescription { - ADGameDescription desc; - GameType gameType; -}; - static const CgeGameDescription gameDescriptions[] = { { @@ -63,7 +70,7 @@ static const CgeGameDescription gameDescriptions[] = { {"vol.dat", 0, "f9ae2e7f8f7cac91378cdafca43faf1e", 8437676}, AD_LISTEND }, - Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO0() + Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF) }, kGameTypeSoltys }, @@ -75,7 +82,7 @@ static const CgeGameDescription gameDescriptions[] = { {"vol.dat", 0, "75d385a6074c58b69f7730481f256051", 1796710}, AD_LISTEND }, - Common::EN_ANY, Common::kPlatformDOS, ADGF_DEMO , GUIO0() + Common::EN_ANY, Common::kPlatformDOS, ADGF_DEMO , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF) }, kGameTypeSoltys }, @@ -87,7 +94,7 @@ static const CgeGameDescription gameDescriptions[] = { {"vol.dat", 0, "c5d9b15863cab61dc125551576dece04", 1075272}, AD_LISTEND }, - Common::PL_POL, Common::kPlatformDOS, ADGF_DEMO , GUIO0() + Common::PL_POL, Common::kPlatformDOS, ADGF_DEMO , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF) }, kGameTypeSoltys }, @@ -99,7 +106,7 @@ static const CgeGameDescription gameDescriptions[] = { {"vol.dat", 0, "4ffeff4abc99ac5999b55ccfc56ab1df", 8430868}, AD_LISTEND }, - Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO0() + Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF) }, kGameTypeSoltys }, @@ -111,7 +118,7 @@ static const CgeGameDescription gameDescriptions[] = { {"vol.dat", 0, "0e43331c846094d77f5dd201827e0a3b", 8439339}, AD_LISTEND }, - Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO0() + Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF) }, kGameTypeSoltys }, @@ -123,7 +130,7 @@ static const CgeGameDescription gameDescriptions[] = { {"vol.dat", 0, "ff10d54acc2c95696c57e05819b6906f", 8450151}, AD_LISTEND }, - Common::ES_ESP, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO0() + Common::ES_ESP, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF) }, kGameTypeSoltys }, @@ -136,7 +143,7 @@ static const CgeGameDescription gameDescriptions[] = { {"vol.dat", 0, "de14291869a8eb7c2732ab783c7542ef", 34180844}, AD_LISTEND }, - Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO0() + Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF) }, kGameTypeSfinx }, @@ -148,12 +155,25 @@ static const ADFileBasedFallback fileBasedFallback[] = { { &gameDescriptions[0].desc, { "vol.cat", "vol.dat", 0 } }, { 0, { 0 } } }; - } // End of namespace CGE +static const ADExtraGuiOptionsMap optionsList[] = { + { + GAMEOPTION_COLOR_BLIND_DEFAULT_OFF, + { + _s("Color Blind Mode"), + _s("Enable Color Blind Mode by default"), + "enable_color_blind", + false + } + }, + + AD_EXTRA_GUI_OPTIONS_TERMINATOR +}; + class CGEMetaEngine : public AdvancedMetaEngine { public: - CGEMetaEngine() : AdvancedMetaEngine(CGE::gameDescriptions, sizeof(CGE::CgeGameDescription), CGEGames) { + CGEMetaEngine() : AdvancedMetaEngine(CGE::gameDescriptions, sizeof(CGE::CgeGameDescription), CGEGames, optionsList) { _singleid = "soltys"; } @@ -169,8 +189,6 @@ public: return "Soltys (c) 1994-1996 L.K. Avalon"; } - - virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 2022b803a5..b469c7197d 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -26,6 +26,7 @@ */ #include "common/array.h" +#include "common/config-manager.h" #include "common/rect.h" #include "graphics/palette.h" #include "cge/general.h" @@ -637,6 +638,10 @@ Vga::Vga(CGEEngine *vm) : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _ _page[idx]->create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); } + if (ConfMan.getBool("enable_color_blind")) + _mono = 1; + + _oldColors = (Dac *)malloc(sizeof(Dac) * kPalCount); _newColors = (Dac *)malloc(sizeof(Dac) * kPalCount); getColors(_oldColors); -- cgit v1.2.3 From 54dbb67777bae9f75695aa917c8a6f8362dc5ac8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Feb 2014 18:35:14 +0100 Subject: CGE: Janitorial - Remove trailing spaces --- engines/cge/module.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/cge') diff --git a/engines/cge/module.mk b/engines/cge/module.mk index 5745aa5d48..1fa406f6c8 100644 --- a/engines/cge/module.mk +++ b/engines/cge/module.mk @@ -25,6 +25,6 @@ ifeq ($(ENABLE_CGE), DYNAMIC_PLUGIN) PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk -- cgit v1.2.3 From 299c74bd46500d1cace3c3a6d18d63d29a88ff3f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 17 Feb 2014 23:01:13 +0100 Subject: CGE: Indent REGISTER_PLUGIN_* for consistency. --- engines/cge/detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index 11f2a43854..7cd6d6eac2 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -308,7 +308,7 @@ bool CGEMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameD } #if PLUGIN_ENABLED_DYNAMIC(CGE) -REGISTER_PLUGIN_DYNAMIC(CGE, PLUGIN_TYPE_ENGINE, CGEMetaEngine); + REGISTER_PLUGIN_DYNAMIC(CGE, PLUGIN_TYPE_ENGINE, CGEMetaEngine); #else -REGISTER_PLUGIN_STATIC(CGE, PLUGIN_TYPE_ENGINE, CGEMetaEngine); + REGISTER_PLUGIN_STATIC(CGE, PLUGIN_TYPE_ENGINE, CGEMetaEngine); #endif -- cgit v1.2.3 From ed4065310535e48900d7fd5238292b8b055ef115 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 18 Feb 2014 02:34:18 +0100 Subject: CGE: Make GPL headers consistent in themselves. --- engines/cge/bitmap.cpp | 4 ++-- engines/cge/bitmap.h | 4 ++-- engines/cge/cge.cpp | 4 ++-- engines/cge/cge.h | 40 ++++++++++++++++++++-------------------- engines/cge/cge_main.cpp | 4 ++-- engines/cge/cge_main.h | 4 ++-- engines/cge/console.cpp | 4 ++-- engines/cge/console.h | 4 ++-- engines/cge/detection.cpp | 4 ++-- engines/cge/events.cpp | 4 ++-- engines/cge/events.h | 4 ++-- engines/cge/fileio.cpp | 4 ++-- engines/cge/fileio.h | 4 ++-- engines/cge/game.cpp | 4 ++-- engines/cge/game.h | 4 ++-- engines/cge/general.h | 4 ++-- engines/cge/snail.cpp | 4 ++-- engines/cge/snail.h | 4 ++-- engines/cge/sound.cpp | 4 ++-- engines/cge/sound.h | 4 ++-- engines/cge/talk.cpp | 4 ++-- engines/cge/talk.h | 4 ++-- engines/cge/text.cpp | 4 ++-- engines/cge/text.h | 4 ++-- engines/cge/vga13h.cpp | 4 ++-- engines/cge/vga13h.h | 4 ++-- engines/cge/vmenu.cpp | 4 ++-- engines/cge/vmenu.h | 4 ++-- engines/cge/walk.cpp | 4 ++-- engines/cge/walk.h | 4 ++-- 30 files changed, 78 insertions(+), 78 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index 5acd111c97..04a5f5de0f 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h index 3de05ac2fd..2768271b23 100644 --- a/engines/cge/bitmap.h +++ b/engines/cge/bitmap.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index af7e91f7eb..8d8c4e4aba 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/cge.h b/engines/cge/cge.h index 61558c0989..8c5ae29e18 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -1,24 +1,24 @@ /* ScummVM - Graphic Adventure Engine -* -* ScummVM is the legal property of its developers, whose names -* are too numerous to list here. Please refer to the COPYRIGHT -* file distributed with this source distribution. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. - -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. - -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ #ifndef CGE_H #define CGE_H diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index b4015334c8..6440058a0c 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h index bde8306f36..e0438f7a39 100644 --- a/engines/cge/cge_main.h +++ b/engines/cge/cge_main.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/console.cpp b/engines/cge/console.cpp index 105f241944..447875c06f 100644 --- a/engines/cge/console.cpp +++ b/engines/cge/console.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/console.h b/engines/cge/console.h index ea36dfbaae..ad4471283f 100644 --- a/engines/cge/console.h +++ b/engines/cge/console.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index 7cd6d6eac2..4c2f81c1ae 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index 89802058f4..24b3a270cf 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/events.h b/engines/cge/events.h index ab8d87212d..63f02b7475 100644 --- a/engines/cge/events.h +++ b/engines/cge/events.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp index 8ee726c46d..4fcf9f8ad8 100644 --- a/engines/cge/fileio.cpp +++ b/engines/cge/fileio.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h index 653aabae8f..803d6b2d58 100644 --- a/engines/cge/fileio.h +++ b/engines/cge/fileio.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/game.cpp b/engines/cge/game.cpp index 851f6c59fb..49fe12f517 100644 --- a/engines/cge/game.cpp +++ b/engines/cge/game.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/game.h b/engines/cge/game.h index 4d5acf7371..330eb20928 100644 --- a/engines/cge/game.h +++ b/engines/cge/game.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/general.h b/engines/cge/general.h index 9e3fc7f249..ac7c6f4da5 100644 --- a/engines/cge/general.h +++ b/engines/cge/general.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index b9030efb4d..942a9c414a 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/snail.h b/engines/cge/snail.h index 6a9e717441..2f56768fed 100644 --- a/engines/cge/snail.h +++ b/engines/cge/snail.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index 892b826318..cc5e97b475 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/sound.h b/engines/cge/sound.h index a3f4d4d777..dc67f9408b 100644 --- a/engines/cge/sound.h +++ b/engines/cge/sound.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp index f5d570b389..e377a72601 100644 --- a/engines/cge/talk.cpp +++ b/engines/cge/talk.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/talk.h b/engines/cge/talk.h index 66e3d85214..2f89881b8d 100644 --- a/engines/cge/talk.h +++ b/engines/cge/talk.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp index 08ff005e1e..7d8c89befa 100644 --- a/engines/cge/text.cpp +++ b/engines/cge/text.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/text.h b/engines/cge/text.h index 13ce6bbfbb..9bd990f486 100644 --- a/engines/cge/text.h +++ b/engines/cge/text.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index b469c7197d..27b5d9a9bf 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index a816f7756f..9511559df0 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp index 910e54d267..89f0039e02 100644 --- a/engines/cge/vmenu.cpp +++ b/engines/cge/vmenu.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/vmenu.h b/engines/cge/vmenu.h index 928b48f11c..1cab57080d 100644 --- a/engines/cge/vmenu.h +++ b/engines/cge/vmenu.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/walk.cpp b/engines/cge/walk.cpp index 22c06a17c1..1ab7574c0c 100644 --- a/engines/cge/walk.cpp +++ b/engines/cge/walk.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/engines/cge/walk.h b/engines/cge/walk.h index 00ec080416..982c96dbaa 100644 --- a/engines/cge/walk.h +++ b/engines/cge/walk.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -- cgit v1.2.3 From 2c7f6a9d1dd5e2a9a145304fc7ca2fe2acfd7200 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Feb 2014 21:41:26 +0100 Subject: CGE: Some British to American english --- engines/cge/cge.cpp | 4 ++-- engines/cge/vga13h.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 8d8c4e4aba..e8ab3c262b 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -73,7 +73,7 @@ void CGEEngine::initSceneValues() { void CGEEngine::init() { debugC(1, kCGEDebugEngine, "CGEEngine::setup()"); - // Initialise fields + // Initialize fields _lastFrame = 0; _lastTick = 0; _hero = NULL; @@ -87,7 +87,7 @@ void CGEEngine::init() { // Create debugger console _console = new CGEConsole(this); - // Initialise engine objects + // Initialize engine objects _font = new Font(this, "CGE"); _text = new Text(this, "CGE"); _talk = NULL; diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index 27b5d9a9bf..d5e1be5122 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -761,7 +761,7 @@ void Vga::setColors(Dac *tab, int lum) { if (_mono) { destP = _newColors; for (int idx = 0; idx < kPalCount; idx++, destP++) { - // Form a greyscalce colour from 30% R, 59% G, 11% B + // Form a greyscalce color from 30% R, 59% G, 11% B uint8 intensity = (((int)destP->_r * 77) + ((int)destP->_g * 151) + ((int)destP->_b * 28)) >> 8; destP->_r = intensity; destP->_g = intensity; -- cgit v1.2.3 From 3c41d9b9cb481bd0cdf0a9847f3ed5e8b50c6320 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 2 Mar 2014 20:02:26 +0100 Subject: CGE: Add a safeguard in pocFul --- engines/cge/snail.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/cge') diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp index 942a9c414a..1a6ca0789e 100644 --- a/engines/cge/snail.cpp +++ b/engines/cge/snail.cpp @@ -658,6 +658,9 @@ void CGEEngine::selectPocket(int n) { void CGEEngine::pocFul() { debugC(1, kCGEDebugEngine, "CGEEngine::pocFul()"); + if (!_hero) + error("pocFul - Unexpected null _hero"); + _hero->park(); _commandHandler->addCommand(kCmdWait, -1, -1, _hero); _commandHandler->addCommand(kCmdSeq, -1, kSeqPocketFull, _hero); -- cgit v1.2.3 From bc58a42574c9f5ea0963f9f4883630ca0e23152a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 2 Mar 2014 20:02:58 +0100 Subject: CGE: Move hero shadow check inside hero check in sceneUp() --- engines/cge/cge_main.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 6440058a0c..260fd8997a 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -656,14 +656,15 @@ void CGEEngine::sceneUp() { _vga->copyPage(0, 1); selectPocket(-1); - if (_hero) + if (_hero) { _vga->_showQ->insert(_vga->_showQ->remove(_hero)); - if (_shadow) { - _vga->_showQ->remove(_shadow); - _shadow->makeXlat(_vga->glass(_vga->_sysPal, 204, 204, 204)); - _vga->_showQ->insert(_shadow, _hero); - _shadow->_z = _hero->_z; + if (_shadow) { + _vga->_showQ->remove(_shadow); + _shadow->makeXlat(_vga->glass(_vga->_sysPal, 204, 204, 204)); + _vga->_showQ->insert(_shadow, _hero); + _shadow->_z = _hero->_z; + } } feedSnail(_vga->_showQ->locate(BakRef + 999), kTake); _vga->show(); -- cgit v1.2.3 From bd66fc0e1a3252d9e1c86c59abafe5ad066d4b5e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 2 Mar 2014 20:12:38 +0100 Subject: CGE: Add a comment about an intended fall-through --- engines/cge/bitmap.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/cge') diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp index 04a5f5de0f..536db5e73b 100644 --- a/engines/cge/bitmap.cpp +++ b/engines/cge/bitmap.cpp @@ -293,6 +293,7 @@ bool Bitmap::solidAt(int16 x, int16 y) { switch (t) { case kBmpEOI: r--; + // No break on purpose case kBmpSKP: w = 0; break; -- cgit v1.2.3 From 2be4c69939215ed6d2e2cac17eb2d9e341dea317 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 2 Mar 2014 20:43:43 +0100 Subject: CGE: Fix some uninitialized variables --- engines/cge/cge.cpp | 29 ++++++++++++++++++++++++++++- engines/cge/sound.cpp | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) (limited to 'engines/cge') diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index e8ab3c262b..a409d765b4 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -53,9 +53,36 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) _startupMode = 1; _oldLev = 0; _pocPtr = 0; - _bitmapPalette = NULL; _quitFlag = false; _showBoundariesFl = false; + _startGameSlot = -1; + _recentStep = -2; + _bitmapPalette = nullptr; + _pocLight = nullptr; + _keyboard = nullptr; + _mouse = nullptr; + _sprite = nullptr; + _miniScene = nullptr; + _shadow = nullptr; + _horzLine = nullptr; + _infoLine = nullptr; + _debugLine = nullptr; + _sceneLight = nullptr; + _commandHandler = nullptr; + _commandHandlerTurbo = nullptr; + _eventManager = nullptr; + _fx = nullptr; + _sound = nullptr; + _resman = nullptr; + for (int i = 0; i < 8; i++) + _pocket[i] = nullptr; + _hero = nullptr; + _text = nullptr; + _talk = nullptr; + _midiPlayer = nullptr; + _miniShp = nullptr; + _miniShpList = nullptr; + _console = nullptr; } void CGEEngine::initSceneValues() { diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index cc5e97b475..370b768bca 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -228,6 +228,7 @@ MusicPlayer::MusicPlayer(CGEEngine *vm) : _vm(vm) { _driver->setTimerCallback(this, &timerCallback); } + _dataSize = -1; } MusicPlayer::~MusicPlayer() { -- cgit v1.2.3 From f2a0d591fdb72e3e5c615e44a6165c5524b67a16 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 10 Mar 2014 21:57:29 +0100 Subject: CGE: Fix obsolete debug message --- engines/cge/cge.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/cge') diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index a409d765b4..49297b06ec 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -98,7 +98,7 @@ void CGEEngine::initSceneValues() { } void CGEEngine::init() { - debugC(1, kCGEDebugEngine, "CGEEngine::setup()"); + debugC(1, kCGEDebugEngine, "CGEEngine::init()"); // Initialize fields _lastFrame = 0; -- cgit v1.2.3 From 820d96f41cdfe22ad504115057548ab33fdca672 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 10 Mar 2014 23:09:20 +0100 Subject: CGE: Fix 2 more obsolete debug messages --- engines/cge/fileio.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp index 4fcf9f8ad8..bab01b62d3 100644 --- a/engines/cge/fileio.cpp +++ b/engines/cge/fileio.cpp @@ -118,7 +118,7 @@ uint16 ResourceManager::read(byte *buf, uint16 length) { } BtPage *ResourceManager::getPage(int level, uint16 pageId) { - debugC(1, kCGEDebugFile, "IoHand::getPage(%d, %d)", level, pageId); + debugC(1, kCGEDebugFile, "ResourceManager::getPage(%d, %d)", level, pageId); if (_buff[level]._pageNo != pageId) { int32 pos = pageId * kBtSize; @@ -142,7 +142,7 @@ BtPage *ResourceManager::getPage(int level, uint16 pageId) { } BtKeypack *ResourceManager::find(const char *key) { - debugC(1, kCGEDebugFile, "IoHand::find(%s)", key); + debugC(1, kCGEDebugFile, "ResourceManager::find(%s)", key); int lev = 0; uint16 nxt = kBtValRoot; -- cgit v1.2.3 From 2822df856d2ff4ca730a0a2a12fe9a120e495784 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 11 Mar 2014 07:31:12 +0100 Subject: CGE: Remove the useless return value of XCrypt() --- engines/cge/fileio.cpp | 4 +--- engines/cge/fileio.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp index bab01b62d3..2b1f74db02 100644 --- a/engines/cge/fileio.cpp +++ b/engines/cge/fileio.cpp @@ -93,13 +93,11 @@ ResourceManager::~ResourceManager() { delete _buff[i]._page; } -uint16 ResourceManager::XCrypt(byte *buf, uint16 length) { +void ResourceManager::XCrypt(byte *buf, uint16 length) { byte *b = buf; for (uint16 i = 0; i < length; i++) *b++ ^= kCryptSeed; - - return kCryptSeed; } bool ResourceManager::seek(int32 offs, int whence) { diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h index 803d6b2d58..77404fb552 100644 --- a/engines/cge/fileio.h +++ b/engines/cge/fileio.h @@ -86,7 +86,7 @@ class ResourceManager { uint16 catRead(byte *buf, uint16 length); Common::File *_catFile; Common::File *_datFile; - uint16 XCrypt(byte *buf, uint16 length); + void XCrypt(byte *buf, uint16 length); public: ResourceManager(); -- cgit v1.2.3 From e9189b57b3133f603314799d663c0e96231477f8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 11 Mar 2014 07:52:46 +0100 Subject: CGE: Get rid of a magic value in file seek --- engines/cge/fileio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/cge') diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h index 77404fb552..059d2c9a44 100644 --- a/engines/cge/fileio.h +++ b/engines/cge/fileio.h @@ -92,7 +92,7 @@ public: ResourceManager(); ~ResourceManager(); uint16 read(byte *buf, uint16 length); - bool seek(int32 offs, int whence = 0); + bool seek(int32 offs, int whence = SEEK_SET); BtKeypack *find(const char *key); bool exist(const char *name); -- cgit v1.2.3 From 1cf283bfa7c460d4b73b2c896112ea5d5f41b3a8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Mar 2014 11:09:52 +0100 Subject: CGE: Move several variable initializations to the constructor --- engines/cge/cge.cpp | 74 +++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 34 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 49297b06ec..f63acc23c2 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -83,6 +83,37 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) _miniShp = nullptr; _miniShpList = nullptr; _console = nullptr; + + _lastFrame = 0; + _lastTick = 0; + _music = true; + _maxScene = 0; + _dark = false; + _game = false; + _endGame = false; + _now = 1; + _lev = -1; + _mode = 0; + _soundOk = 1; + _sprTv = nullptr; + _gameCase2Cpt = 0; + _offUseCount = 0; + _sprK1 = nullptr; + _sprK2 = nullptr; + _sprK3 = nullptr; + _font = nullptr; + _vga = nullptr; + _sys = nullptr; + + for (int i = 0; i < kPocketNX; i++) + _pocref[i] = -1; + _volume[0] = 0; + _volume[1] = 0; + + for (int i = 0; i < 4; i++) + _flag[i] = false; + + initSceneValues(); } void CGEEngine::initSceneValues() { @@ -101,14 +132,13 @@ void CGEEngine::init() { debugC(1, kCGEDebugEngine, "CGEEngine::init()"); // Initialize fields - _lastFrame = 0; - _lastTick = 0; - _hero = NULL; - _shadow = NULL; - _miniScene = NULL; - _miniShp = NULL; - _miniShpList = NULL; - _sprite = NULL; + _hero = nullptr; + _shadow = nullptr; + _miniScene = nullptr; + _miniShp = nullptr; + _miniShpList = nullptr; + _sprite = nullptr; + _resman = new ResourceManager(); // Create debugger console @@ -117,12 +147,12 @@ void CGEEngine::init() { // Initialize engine objects _font = new Font(this, "CGE"); _text = new Text(this, "CGE"); - _talk = NULL; + _talk = nullptr; _vga = new Vga(this); _sys = new System(this); _pocLight = new PocLight(this); for (int i = 0; i < kPocketNX; i++) - _pocket[i] = NULL; + _pocket[i] = nullptr; _horzLine = new HorizLine(this); _infoLine = new InfoLine(this, kInfoW); _sceneLight = new SceneLight(this); @@ -137,30 +167,6 @@ void CGEEngine::init() { _sound = new Sound(this); _offUseCount = atoi(_text->getText(kOffUseCount)); - _music = true; - - for (int i = 0; i < kPocketNX; i++) - _pocref[i] = -1; - _volume[0] = 0; - _volume[1] = 0; - - initSceneValues(); - - _maxScene = 0; - _dark = false; - _game = false; - _endGame = false; - _now = 1; - _lev = -1; - _recentStep = -2; - - for (int i = 0; i < 4; i++) - _flag[i] = false; - - _mode = 0; - _soundOk = 1; - _sprTv = NULL; - _gameCase2Cpt = 0; _startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1; } -- cgit v1.2.3 From 62c4062841dd063118c1ac853a86e363184c1c68 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Mar 2014 11:15:55 +0100 Subject: CGE: Reorder CGEEngine constructor --- engines/cge/cge.cpp | 53 ++++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index f63acc23c2..7459efe48c 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -50,13 +50,6 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) DebugMan.addDebugChannel(kCGEDebugFile, "file", "CGE IO debug channel"); DebugMan.addDebugChannel(kCGEDebugEngine, "engine", "CGE Engine debug channel"); - _startupMode = 1; - _oldLev = 0; - _pocPtr = 0; - _quitFlag = false; - _showBoundariesFl = false; - _startGameSlot = -1; - _recentStep = -2; _bitmapPalette = nullptr; _pocLight = nullptr; _keyboard = nullptr; @@ -83,21 +76,7 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) _miniShp = nullptr; _miniShpList = nullptr; _console = nullptr; - - _lastFrame = 0; - _lastTick = 0; - _music = true; - _maxScene = 0; - _dark = false; - _game = false; - _endGame = false; - _now = 1; - _lev = -1; - _mode = 0; - _soundOk = 1; - _sprTv = nullptr; - _gameCase2Cpt = 0; - _offUseCount = 0; + _sprTv = nullptr; _sprK1 = nullptr; _sprK2 = nullptr; _sprK3 = nullptr; @@ -105,14 +84,34 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) _vga = nullptr; _sys = nullptr; - for (int i = 0; i < kPocketNX; i++) - _pocref[i] = -1; - _volume[0] = 0; - _volume[1] = 0; - + _quitFlag = false; + _showBoundariesFl = false; + _music = true; + _dark = false; + _game = false; + _endGame = false; for (int i = 0; i < 4; i++) _flag[i] = false; + _startupMode = 1; + _oldLev = 0; + _pocPtr = 0; + _startGameSlot = -1; + _recentStep = -2; + _lastFrame = 0; + _lastTick = 0; + _maxScene = 0; + _now = 1; + _lev = -1; + _mode = 0; + _soundOk = 1; + _gameCase2Cpt = 0; + _offUseCount = 0; + _volume[0] = 0; + _volume[1] = 0; + for (int i = 0; i < kPocketNX; i++) + _pocref[i] = -1; + initSceneValues(); } -- cgit v1.2.3 From 0a9b8978ee87039e32ad6348f90d9cc3a0227a47 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Mar 2014 11:19:21 +0100 Subject: CGE: Remove a useless variable, remove some associated dead code --- engines/cge/cge.cpp | 1 - engines/cge/cge.h | 1 - engines/cge/cge_main.cpp | 23 ++--------------------- 3 files changed, 2 insertions(+), 23 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 7459efe48c..3f7aa4abc9 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -104,7 +104,6 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) _now = 1; _lev = -1; _mode = 0; - _soundOk = 1; _gameCase2Cpt = 0; _offUseCount = 0; _volume[0] = 0; diff --git a/engines/cge/cge.h b/engines/cge/cge.h index 8c5ae29e18..1af9a90207 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -168,7 +168,6 @@ public: int _now; int _lev; int _mode; - int _soundOk; int _gameCase2Cpt; int _offUseCount; Dac *_bitmapPalette; diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 260fd8997a..b18bae64c8 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -397,7 +397,7 @@ void CGEEngine::syncGame(Common::SeekableReadStream *readStream, Common::WriteSt } } else { // Loading game - if (_soundOk == 1 && _mode == 0) { + if (_mode == 0) { // Skip Digital and Midi volumes, useless under ScummVM sndSetVolume(); } @@ -1483,25 +1483,6 @@ bool CGEEngine::showTitle(const char *name) { selectPocket(-1); _vga->sunrise(_vga->_sysPal); - if (_mode < 2 && !_soundOk) { - _vga->copyPage(1, 2); - _vga->copyPage(0, 1); - _vga->_showQ->append(_mouse); - _mouse->on(); - for (; !_commandHandler->idle() || Vmenu::_addr;) { - mainLoop(); - if (_quitFlag) - return false; - } - - _mouse->off(); - _vga->_showQ->clear(); - _vga->copyPage(0, 2); - _soundOk = 2; - if (_music) - _midiPlayer->loadMidi(0); - } - if (_mode < 2) { // At this point the game originally set the protection variables // used by the copy protection check @@ -1540,7 +1521,7 @@ void CGEEngine::cge_main() { if (_horzLine) _horzLine->_flags._hide = true; - if (_music && _soundOk) + if (_music) _midiPlayer->loadMidi(0); if (_startGameSlot != -1) { -- cgit v1.2.3 From 8f41fc10b2c458e13631d8eeed0ee3de8879a8fa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 15 Mar 2014 11:31:43 +0100 Subject: CGE: Remove a useless structure member, reduce a variable scope --- engines/cge/cge.h | 1 - engines/cge/cge_main.cpp | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge.h b/engines/cge/cge.h index 1af9a90207..a65069ff46 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -107,7 +107,6 @@ struct SavegameHeader { Graphics::Surface *thumbnail; int saveYear, saveMonth, saveDay; int saveHour, saveMinutes; - int totalFrames; }; extern const char *savegameStr; diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index b18bae64c8..e738b6ebb3 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -195,7 +195,6 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) { debugC(1, kCGEDebugEngine, "CGEEngine::loadgame(%d, header, %s)", slotNumber, tiny ? "true" : "false"); Common::MemoryReadStream *readStream; - SavegameHeader saveHeader; if (slotNumber == -1) { // Loading the data for the initial game state @@ -231,6 +230,8 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) { return false; } else { // Found header + SavegameHeader saveHeader; + if (!readSavegameHeader(readStream, saveHeader)) { delete readStream; return false; @@ -424,7 +425,7 @@ void CGEEngine::syncGame(Common::SeekableReadStream *readStream, Common::WriteSt } bool CGEEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header) { - header.thumbnail = NULL; + header.thumbnail = nullptr; // Get the savegame version header.version = in->readByte(); -- cgit v1.2.3 From 55127114349219d57b7a9143a5d3d9bfd97e3e88 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 29 Apr 2014 09:39:24 +0200 Subject: CGE: Replace magic numbers with defines. --- engines/cge/cge.cpp | 2 +- engines/cge/vga13h.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/cge') diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 3f7aa4abc9..7058314b9d 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -219,7 +219,7 @@ Common::Error CGEEngine::run() { } // Initialize graphics using following: - initGraphics(320, 200, false); + initGraphics(kScrWidth, kScrHeight, false); // Setup necessary game objects init(); diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index d5e1be5122..d7dccd2c65 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -819,14 +819,14 @@ void Vga::update() { _setPal = false; } if (_vm->_showBoundariesFl) { - Vga::_page[0]->hLine(0, 200 - kPanHeight, 320, 0xee); + Vga::_page[0]->hLine(0, kScrHeight - kPanHeight, kScrWidth, 0xee); if (_vm->_barriers[_vm->_now]._horz != 255) { for (int i = 0; i < 8; i++) - Vga::_page[0]->vLine((_vm->_barriers[_vm->_now]._horz * 8) + i, 0, 200, 0xff); + Vga::_page[0]->vLine((_vm->_barriers[_vm->_now]._horz * 8) + i, 0, kScrHeight, 0xff); } if (_vm->_barriers[_vm->_now]._vert != 255) { for (int i = 0; i < 4; i++) - Vga::_page[0]->hLine(0, 80 + (_vm->_barriers[_vm->_now]._vert * 4) + i, 320, 0xff); + Vga::_page[0]->hLine(0, 80 + (_vm->_barriers[_vm->_now]._vert * 4) + i, kScrWidth, 0xff); } } -- cgit v1.2.3 From daa8d57a866e2866369e432cf1d624179edc8875 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:07 +0200 Subject: ALL: Rename Debugger::DebugPrintf to Debugger::debugPrintf. --- engines/cge/console.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/cge') diff --git a/engines/cge/console.cpp b/engines/cge/console.cpp index 447875c06f..3d281df3ef 100644 --- a/engines/cge/console.cpp +++ b/engines/cge/console.cpp @@ -37,7 +37,7 @@ CGEConsole::~CGEConsole() { */ bool CGEConsole::Cmd_boundaries(int argc, const char **argv) { if (argc != 1) { - DebugPrintf("Usage: %s\n", argv[0]); + debugPrintf("Usage: %s\n", argv[0]); return true; } -- cgit v1.2.3 From ae4ffe01f0e4354938714c546034cd0f9806bfc3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:08 +0200 Subject: ALL: Rename Debugger::DCmd_Register to Debugger::registerCmd. --- engines/cge/console.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/cge') diff --git a/engines/cge/console.cpp b/engines/cge/console.cpp index 3d281df3ef..e926e89506 100644 --- a/engines/cge/console.cpp +++ b/engines/cge/console.cpp @@ -26,7 +26,7 @@ namespace CGE { CGEConsole::CGEConsole(CGEEngine *vm) : GUI::Debugger(), _vm(vm) { - DCmd_Register("Boundaries", WRAP_METHOD(CGEConsole, Cmd_boundaries)); + registerCmd("Boundaries", WRAP_METHOD(CGEConsole, Cmd_boundaries)); } CGEConsole::~CGEConsole() { -- cgit v1.2.3