aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorMarisa-Chan2014-06-13 21:43:04 +0700
committerMarisa-Chan2014-06-13 21:43:04 +0700
commit45589950c0fb1a449351e6a00ef10d42290d8bae (patch)
tree44e4eedcb7e69d5fc386155b000ed038af07251d /engines/cge
parent48360645dcd5f8fddb135b6e31ae5cae4be8d77f (diff)
parent5c005ad3a3f1df0bc968c85c1cf0fc48e36ab0b2 (diff)
downloadscummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.gz
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.bz2
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.zip
Merge remote-tracking branch 'upstream/master' into zvision
Conflicts: engines/zvision/animation/rlf_animation.cpp engines/zvision/animation_control.h engines/zvision/core/console.cpp engines/zvision/core/events.cpp engines/zvision/cursors/cursor.cpp engines/zvision/cursors/cursor_manager.cpp engines/zvision/cursors/cursor_manager.h engines/zvision/fonts/truetype_font.cpp engines/zvision/graphics/render_manager.cpp engines/zvision/graphics/render_manager.h engines/zvision/inventory/inventory_manager.h engines/zvision/inventory_manager.h engines/zvision/meta_animation.h engines/zvision/module.mk engines/zvision/scripting/actions.cpp engines/zvision/scripting/control.h engines/zvision/scripting/controls/animation_control.cpp engines/zvision/scripting/controls/animation_control.h engines/zvision/scripting/controls/input_control.cpp engines/zvision/scripting/controls/lever_control.cpp engines/zvision/scripting/controls/timer_node.cpp engines/zvision/scripting/controls/timer_node.h engines/zvision/scripting/puzzle.h engines/zvision/scripting/scr_file_handling.cpp engines/zvision/scripting/script_manager.cpp engines/zvision/scripting/script_manager.h engines/zvision/sidefx.cpp engines/zvision/sound/zork_raw.cpp engines/zvision/sound/zork_raw.h engines/zvision/video/video.cpp engines/zvision/video/zork_avi_decoder.h engines/zvision/zvision.cpp engines/zvision/zvision.h
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/bitmap.cpp11
-rw-r--r--engines/cge/bitmap.h4
-rw-r--r--engines/cge/cge.cpp119
-rw-r--r--engines/cge/cge.h42
-rw-r--r--engines/cge/cge_main.cpp70
-rw-r--r--engines/cge/cge_main.h4
-rw-r--r--engines/cge/configure.engine3
-rw-r--r--engines/cge/console.cpp8
-rw-r--r--engines/cge/console.h4
-rw-r--r--engines/cge/detection.cpp71
-rw-r--r--engines/cge/events.cpp4
-rw-r--r--engines/cge/events.h4
-rw-r--r--engines/cge/fileio.cpp22
-rw-r--r--engines/cge/fileio.h14
-rw-r--r--engines/cge/game.cpp4
-rw-r--r--engines/cge/game.h4
-rw-r--r--engines/cge/general.h4
-rw-r--r--engines/cge/module.mk2
-rw-r--r--engines/cge/snail.cpp7
-rw-r--r--engines/cge/snail.h4
-rw-r--r--engines/cge/sound.cpp9
-rw-r--r--engines/cge/sound.h4
-rw-r--r--engines/cge/talk.cpp4
-rw-r--r--engines/cge/talk.h4
-rw-r--r--engines/cge/text.cpp9
-rw-r--r--engines/cge/text.h4
-rw-r--r--engines/cge/vga13h.cpp24
-rw-r--r--engines/cge/vga13h.h4
-rw-r--r--engines/cge/vmenu.cpp4
-rw-r--r--engines/cge/vmenu.h4
-rw-r--r--engines/cge/walk.cpp4
-rw-r--r--engines/cge/walk.h4
32 files changed, 267 insertions, 216 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 989d2bbe99..536db5e73b 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.
@@ -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)
@@ -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;
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..7058314b9d 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.
@@ -50,12 +50,68 @@ 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;
- _bitmapPalette = NULL;
+ _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;
+ _sprTv = nullptr;
+ _sprK1 = nullptr;
+ _sprK2 = nullptr;
+ _sprK3 = nullptr;
+ _font = nullptr;
+ _vga = nullptr;
+ _sys = nullptr;
+
_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;
+ _gameCase2Cpt = 0;
+ _offUseCount = 0;
+ _volume[0] = 0;
+ _volume[1] = 0;
+ for (int i = 0; i < kPocketNX; i++)
+ _pocref[i] = -1;
+
+ initSceneValues();
}
void CGEEngine::initSceneValues() {
@@ -71,31 +127,30 @@ void CGEEngine::initSceneValues() {
}
void CGEEngine::init() {
- debugC(1, kCGEDebugEngine, "CGEEngine::setup()");
+ debugC(1, kCGEDebugEngine, "CGEEngine::init()");
+
+ // Initialize fields
+ _hero = nullptr;
+ _shadow = nullptr;
+ _miniScene = nullptr;
+ _miniShp = nullptr;
+ _miniShpList = nullptr;
+ _sprite = nullptr;
- // Initialise fields
- _lastFrame = 0;
- _lastTick = 0;
- _hero = NULL;
- _shadow = NULL;
- _miniScene = NULL;
- _miniShp = NULL;
- _miniShpList = NULL;
- _sprite = NULL;
_resman = new ResourceManager();
// 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;
+ _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);
@@ -110,30 +165,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;
}
@@ -188,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/cge.h b/engines/cge/cge.h
index 61558c0989..a65069ff46 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
@@ -107,7 +107,6 @@ struct SavegameHeader {
Graphics::Surface *thumbnail;
int saveYear, saveMonth, saveDay;
int saveHour, saveMinutes;
- int totalFrames;
};
extern const char *savegameStr;
@@ -168,7 +167,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 ae4dee6090..e738b6ebb3 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.
@@ -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;
}
@@ -196,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
@@ -232,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;
@@ -398,7 +398,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();
}
@@ -425,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();
@@ -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() {
@@ -659,14 +657,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();
@@ -1031,7 +1030,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;
@@ -1043,10 +1041,11 @@ 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++;
- strcpy(tmpStr, line.c_str());
+ Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
if (len == 0 || *tmpStr == '.')
continue;
@@ -1132,7 +1131,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 +1157,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;
@@ -1485,25 +1484,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
@@ -1542,7 +1522,7 @@ void CGEEngine::cge_main() {
if (_horzLine)
_horzLine->_flags._hide = true;
- if (_music && _soundOk)
+ if (_music)
_midiPlayer->loadMidi(0);
if (_startGameSlot != -1) {
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/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
diff --git a/engines/cge/console.cpp b/engines/cge/console.cpp
index 105f241944..e926e89506 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.
@@ -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() {
@@ -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;
}
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 3b01421903..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.
@@ -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,19 @@ 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
+ },
+ {
+ {
+ "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 , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF)
},
kGameTypeSoltys
},
@@ -124,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
},
@@ -136,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";
}
@@ -157,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;
@@ -196,10 +226,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) {
@@ -279,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
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 609d5e86aa..2b1f74db02 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.
@@ -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++) {
@@ -93,20 +93,18 @@ ResourceManager::~ResourceManager() {
delete _buff[i]._page;
}
-uint16 ResourceManager::XCrypt(void *buf, uint16 length) {
- byte *b = static_cast<byte *>(buf);
+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) {
return _datFile->seek(offs, whence);
}
-uint16 ResourceManager::read(void *buf, uint16 length) {
+uint16 ResourceManager::read(byte *buf, uint16 length) {
if (!_datFile->isOpen())
return 0;
@@ -118,7 +116,7 @@ uint16 ResourceManager::read(void *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 +140,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;
@@ -178,7 +176,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 +223,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..059d2c9a44 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.
@@ -83,16 +83,16 @@ 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);
+ void XCrypt(byte *buf, uint16 length);
public:
ResourceManager();
~ResourceManager();
- uint16 read(void *buf, uint16 length);
- bool seek(int32 offs, int whence = 0);
+ uint16 read(byte *buf, uint16 length);
+ bool seek(int32 offs, int whence = SEEK_SET);
BtKeypack *find(const char *key);
bool exist(const char *name);
@@ -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();
};
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/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
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index b9030efb4d..1a6ca0789e 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.
@@ -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);
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 b378898955..370b768bca 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.
@@ -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());
@@ -224,6 +228,7 @@ MusicPlayer::MusicPlayer(CGEEngine *vm) : _vm(vm) {
_driver->setTimerCallback(this, &timerCallback);
}
+ _dataSize = -1;
}
MusicPlayer::~MusicPlayer() {
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 27bb0608fd..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.
@@ -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/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 c0407cab42..d7dccd2c65 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.
@@ -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"
@@ -210,12 +211,11 @@ 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();
- assert(len <= 513);
- strcpy(tmpStr, line.c_str());
+ int len = line.size();
+ Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
lcnt++;
if (len == 0 || *tmpStr == '.')
continue;
@@ -638,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);
@@ -757,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;
@@ -815,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);
}
}
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.