aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins
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/hopkins
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/hopkins')
-rw-r--r--engines/hopkins/anim.cpp7
-rw-r--r--engines/hopkins/anim.h4
-rw-r--r--engines/hopkins/computer.cpp91
-rw-r--r--engines/hopkins/computer.h30
-rw-r--r--engines/hopkins/configure.engine3
-rw-r--r--engines/hopkins/debugger.cpp28
-rw-r--r--engines/hopkins/debugger.h6
-rw-r--r--engines/hopkins/detection.cpp36
-rw-r--r--engines/hopkins/detection_tables.h45
-rw-r--r--engines/hopkins/dialogs.cpp15
-rw-r--r--engines/hopkins/dialogs.h4
-rw-r--r--engines/hopkins/events.cpp6
-rw-r--r--engines/hopkins/events.h4
-rw-r--r--engines/hopkins/files.cpp23
-rw-r--r--engines/hopkins/files.h4
-rw-r--r--engines/hopkins/font.cpp4
-rw-r--r--engines/hopkins/font.h4
-rw-r--r--engines/hopkins/globals.cpp6
-rw-r--r--engines/hopkins/globals.h4
-rw-r--r--engines/hopkins/graphics.cpp18
-rw-r--r--engines/hopkins/graphics.h4
-rw-r--r--engines/hopkins/hopkins.cpp51
-rw-r--r--engines/hopkins/hopkins.h11
-rw-r--r--engines/hopkins/lines.cpp19
-rw-r--r--engines/hopkins/lines.h4
-rw-r--r--engines/hopkins/menu.cpp42
-rw-r--r--engines/hopkins/menu.h4
-rw-r--r--engines/hopkins/objects.cpp14
-rw-r--r--engines/hopkins/objects.h4
-rw-r--r--engines/hopkins/saveload.cpp4
-rw-r--r--engines/hopkins/saveload.h4
-rw-r--r--engines/hopkins/script.cpp22
-rw-r--r--engines/hopkins/script.h4
-rw-r--r--engines/hopkins/sound.cpp69
-rw-r--r--engines/hopkins/sound.h12
-rw-r--r--engines/hopkins/talk.cpp20
-rw-r--r--engines/hopkins/talk.h4
37 files changed, 370 insertions, 264 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp
index 2ec9cec009..8f2a18f741 100644
--- a/engines/hopkins/anim.cpp
+++ b/engines/hopkins/anim.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.
@@ -668,7 +668,6 @@ void AnimationManager::playSequence(const Common::String &file, uint32 rate1, ui
*/
void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, uint32 rate2, uint32 rate3, bool skipSeqFl) {
byte *screenP;
- int frameNumber;
Common::File f;
if (_vm->shouldQuit())
@@ -708,7 +707,7 @@ void AnimationManager::playSequence2(const Common::String &file, uint32 rate1, u
if (!_vm->_events->_escKeyFl) {
_vm->_events->_rateCounter = 0;
- frameNumber = 0;
+ int frameNumber = 0;
while (!_vm->shouldQuit()) {
_vm->_soundMan->playAnimSound(frameNumber++);
diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h
index bf9b55aaae..a273245097 100644
--- a/engines/hopkins/anim.h
+++ b/engines/hopkins/anim.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/hopkins/computer.cpp b/engines/hopkins/computer.cpp
index c09d748b97..84d5c631c7 100644
--- a/engines/hopkins/computer.cpp
+++ b/engines/hopkins/computer.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.
@@ -38,10 +38,9 @@ namespace Hopkins {
ComputerManager::ComputerManager(HopkinsEngine *vm) {
_vm = vm;
- for (int i = 0; i < 50; i++) {
- _menuText[i]._actvFl = false;
+ for (int i = 0; i < ARRAYSIZE(_menuText); i++) {
_menuText[i]._lineSize = 0;
- memset(_menuText[i]._line, 0, 90);
+ memset(_menuText[i]._line, 0, ARRAYSIZE(_menuText[0]._line));
}
Common::fill(&_inputBuf[0], &_inputBuf[200], '\0');
_breakoutSpr = NULL;
@@ -346,47 +345,60 @@ static const char _spanishText[] =
* Load Menu data
*/
void ComputerManager::loadMenu() {
+ debug(9, "ComputerManager::loadMenu()");
char *ptr;
if (_vm->_fileIO->fileExists("COMPUTAN.TXT")) {
ptr = (char *)_vm->_fileIO->loadFile("COMPUTAN.TXT");
- } else if (_vm->_globals->_language == LANG_FR) {
- ptr = (char *)_vm->_globals->allocMemory(sizeof(_frenchText));
- strcpy(ptr, _frenchText);
- } else if (_vm->_globals->_language == LANG_SP) {
- ptr = (char *)_vm->_globals->allocMemory(sizeof(_spanishText));
- strcpy(ptr, _spanishText);
} else {
- ptr = (char *)_vm->_globals->allocMemory(sizeof(_englishText));
- strcpy(ptr, _englishText);
+ switch (_vm->_globals->_language) {
+ case LANG_FR:
+ ptr = (char *)_vm->_globals->allocMemory(sizeof(_frenchText));
+ Common::strlcpy(ptr, _frenchText, sizeof(_frenchText));
+ break;
+ case LANG_SP:
+ ptr = (char *)_vm->_globals->allocMemory(sizeof(_spanishText));
+ Common::strlcpy(ptr, _spanishText, sizeof(_spanishText));
+ break;
+ default:
+ ptr = (char *)_vm->_globals->allocMemory(sizeof(_englishText));
+ Common::strlcpy(ptr, _englishText, sizeof(_englishText));
+ break;
+ }
}
char *tmpPtr = ptr;
int lineNum = 0;
- int strPos;
- bool loopCond = false;
- do {
- if (tmpPtr[0] == '%') {
- if (tmpPtr[1] == '%') {
- loopCond = true;
- break;
- }
- _menuText[lineNum]._actvFl = 1;
- strPos = 0;
- while (strPos <= 89) {
+ const char lineSep = tmpPtr[0];
+
+ while (tmpPtr[0] != '\0' && lineNum < ARRAYSIZE(_menuText)) {
+ if (tmpPtr[0] == '%' && tmpPtr[1] == '%') {
+ // End of file marker found - Break out of parse loop
+ break;
+ }
+
+ if (tmpPtr[0] == lineSep) {
+ int strPos = 0;
+ while (strPos < ARRAYSIZE(_menuText[0]._line)) {
char curChar = tmpPtr[strPos + 2];
- if (curChar == '%' || curChar == 10)
+ if (curChar == '\0' || curChar == lineSep || curChar == 0x0a) // Line Feed
break;
_menuText[lineNum]._line[strPos++] = curChar;
}
- if (strPos <= 89) {
+
+ if (strPos < ARRAYSIZE(_menuText[0]._line)) {
_menuText[lineNum]._line[strPos] = 0;
_menuText[lineNum]._lineSize = strPos - 1;
}
- ++lineNum;
+
+ if (strPos != 0) {
+ debug(9, "_menuText[%d]._line (size: %d): \"%s\"", lineNum, _menuText[lineNum]._lineSize, _menuText[lineNum]._line);
+ ++lineNum;
+ }
}
++tmpPtr;
- } while (!loopCond);
+ }
+
_vm->_globals->freeMemory((byte *)ptr);
}
@@ -479,12 +491,17 @@ void ComputerManager::readText(int idx) {
_vm->_events->_escKeyFl = false;
Common::String filename;
- if (_vm->_globals->_language == LANG_EN)
+ switch (_vm->_globals->_language) {
+ case LANG_EN:
filename = "THOPKAN.TXT";
- else if (_vm->_globals->_language == LANG_FR)
+ break;
+ case LANG_FR:
filename = "THOPK.TXT";
- else if (_vm->_globals->_language == LANG_SP)
+ break;
+ case LANG_SP:
filename = "THOPKES.TXT";
+ break;
+ }
byte *ptr = _vm->_fileIO->loadFile(filename);
uint16 fileSize = _vm->_fileIO->fileSize(filename);
@@ -664,15 +681,12 @@ void ComputerManager::displayBricks() {
_breakoutSpeed = 1;
int16 *level = _breakoutLevel;
- int cellLeft;
- int cellTop;
- int cellType;
for (int levelIdx = 0; ; levelIdx += 6) {
- cellLeft = (int16)FROM_LE_16(level[levelIdx]);
+ int cellLeft = (int16)FROM_LE_16(level[levelIdx]);
if (cellLeft == -1)
break;
- cellTop = FROM_LE_16(level[levelIdx + 1]);
- cellType = FROM_LE_16(level[levelIdx + 4]);
+ int cellTop = FROM_LE_16(level[levelIdx + 1]);
+ int cellType = FROM_LE_16(level[levelIdx + 4]);
if (cellType <= 6)
++_breakoutBrickNbr;
@@ -822,7 +836,6 @@ int ComputerManager::displayHiscores() {
_vm->_graphicsMan->setColorPercentage(254, 0, 0, 0);
int yp;
- int xp;
// Loop for displaying the scores
for (int scoreIndex = 0; scoreIndex <= 5; scoreIndex++) {
yp = 19 * scoreIndex;
@@ -842,7 +855,7 @@ int ComputerManager::displayHiscores() {
int buttonIndex = 0;
do {
_vm->_events->refreshEvents();
- xp = _vm->_events->getMouseX();
+ int xp = _vm->_events->getMouseX();
yp = _vm->_events->getMouseY();
if (_vm->_events->getMouseButton() == 1 && ABS(xp - 79) <= 33 && ABS(yp - 396) <= 13)
diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h
index 1771bba7d6..ba50dca4cf 100644
--- a/engines/hopkins/computer.h
+++ b/engines/hopkins/computer.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.
@@ -31,22 +31,22 @@ namespace Hopkins {
class HopkinsEngine;
-struct MenuItem {
- bool _actvFl;
- int _lineSize;
- char _line[90];
-};
-
-struct ScoreItem {
- Common::String _name;
- Common::String _score;
-};
-
enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHA = 2, COMPUTER_PUBLIC = 3 };
class ComputerManager {
private:
HopkinsEngine *_vm;
+
+ struct MenuItem {
+ int _lineSize;
+ char _line[90];
+ };
+
+ struct ScoreItem {
+ Common::String _name;
+ Common::String _score;
+ };
+
MenuItem _menuText[50];
char _inputBuf[200];
ScoreItem _score[6];
@@ -84,14 +84,14 @@ private:
void displayLives();
void displayBricks();
void displayGamesSubMenu();
- int displayHiscores();
+ int displayHiscores();
void displayHiscoreLine(const byte *objectData, int x, int y, int curChar);
void displayMessage(int xp, int yp, int textIdx);
void displayScore();
void displayScoreChar(int charPos, int charDisp);
void getScoreName();
void playBreakout();
- int moveBall();
+ int moveBall();
void saveScore();
void checkBallCollisions();
diff --git a/engines/hopkins/configure.engine b/engines/hopkins/configure.engine
new file mode 100644
index 0000000000..c38ecd4cd2
--- /dev/null
+++ b/engines/hopkins/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 hopkins "Hopkins FBI" yes "" "" "16bit"
diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp
index f111eb50d3..3dcfdfea7b 100644
--- a/engines/hopkins/debugger.cpp
+++ b/engines/hopkins/debugger.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
+ * 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.
@@ -30,18 +30,18 @@ namespace Hopkins {
Debugger::Debugger(HopkinsEngine *vm) : GUI::Debugger() {
_vm = vm;
- DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
- DCmd_Register("rects", WRAP_METHOD(Debugger, cmd_DirtyRects));
- DCmd_Register("teleport", WRAP_METHOD(Debugger, cmd_Teleport));
- DCmd_Register("show_room", WRAP_METHOD(Debugger, cmd_ShowCurrentRoom));
- DCmd_Register("zones", WRAP_METHOD(Debugger, cmd_Zones));
- DCmd_Register("lines", WRAP_METHOD(Debugger, cmd_Lines));
+ registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
+ registerCmd("rects", WRAP_METHOD(Debugger, cmd_DirtyRects));
+ registerCmd("teleport", WRAP_METHOD(Debugger, cmd_Teleport));
+ registerCmd("show_room", WRAP_METHOD(Debugger, cmd_ShowCurrentRoom));
+ registerCmd("zones", WRAP_METHOD(Debugger, cmd_Zones));
+ registerCmd("lines", WRAP_METHOD(Debugger, cmd_Lines));
}
// Turns dirty rects on or off
bool Debugger::cmd_DirtyRects(int argc, const char **argv) {
if (argc != 2) {
- DebugPrintf("%s: [on | off]\n", argv[0]);
+ debugPrintf("%s: [on | off]\n", argv[0]);
return true;
} else {
_vm->_graphicsMan->_showDirtyRects = !strcmp(argv[1], "on");
@@ -52,7 +52,7 @@ bool Debugger::cmd_DirtyRects(int argc, const char **argv) {
// Change room number
bool Debugger::cmd_Teleport(int argc, const char **argv) {
if (argc != 2) {
- DebugPrintf("%s: [Room number]\n", argv[0]);
+ debugPrintf("%s: [Room number]\n", argv[0]);
return true;
} else {
_vm->_globals->_exitId = atoi(argv[1]);
@@ -62,13 +62,13 @@ bool Debugger::cmd_Teleport(int argc, const char **argv) {
// Display room number
bool Debugger::cmd_ShowCurrentRoom(int argc, const char **argv) {
- DebugPrintf("Current room: %d\n", _vm->_globals->_curRoomNum);
+ debugPrintf("Current room: %d\n", _vm->_globals->_curRoomNum);
return true;
}
bool Debugger::cmd_Zones(int argc, const char **argv) {
if (argc != 2) {
- DebugPrintf("%s: [on | off]\n", argv[0]);
+ debugPrintf("%s: [on | off]\n", argv[0]);
return true;
} else {
_vm->_graphicsMan->_showZones = !strcmp(argv[1], "on");
@@ -78,7 +78,7 @@ if (argc != 2) {
bool Debugger::cmd_Lines(int argc, const char **argv) {
if (argc != 2) {
- DebugPrintf("%s: [on | off]\n", argv[0]);
+ debugPrintf("%s: [on | off]\n", argv[0]);
return true;
} else {
_vm->_graphicsMan->_showLines = !strcmp(argv[1], "on");
diff --git a/engines/hopkins/debugger.h b/engines/hopkins/debugger.h
index 746c54a675..94a66af15b 100644
--- a/engines/hopkins/debugger.h
+++ b/engines/hopkins/debugger.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
+ * 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/hopkins/detection.cpp b/engines/hopkins/detection.cpp
index c617a5aacf..a25b19e496 100644
--- a/engines/hopkins/detection.cpp
+++ b/engines/hopkins/detection.cpp
@@ -8,17 +8,16 @@
* 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.
*
- *
*/
#include "hopkins/hopkins.h"
@@ -29,6 +28,7 @@
#include "common/memstream.h"
#include "engines/advancedDetector.h"
#include "common/system.h"
+#include "common/translation.h"
#include "graphics/colormasks.h"
#include "graphics/surface.h"
@@ -69,6 +69,30 @@ static const PlainGameDescriptor hopkinsGames[] = {
#include "hopkins/detection_tables.h"
+static const ADExtraGuiOptionsMap optionsList[] = {
+ {
+ GAMEOPTION_GORE_DEFAULT_OFF,
+ {
+ _s("Gore Mode"),
+ _s("Enable Gore Mode when available"),
+ "enable_gore",
+ false
+ }
+ },
+
+ {
+ GAMEOPTION_GORE_DEFAULT_ON,
+ {
+ _s("Gore Mode"),
+ _s("Enable Gore Mode when available"),
+ "enable_gore",
+ true
+ }
+ },
+
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
const static char *directoryGlobs[] = {
"voice",
"link",
@@ -77,7 +101,7 @@ const static char *directoryGlobs[] = {
class HopkinsMetaEngine : public AdvancedMetaEngine {
public:
- HopkinsMetaEngine() : AdvancedMetaEngine(Hopkins::gameDescriptions, sizeof(Hopkins::HopkinsGameDescription), hopkinsGames) {
+ HopkinsMetaEngine() : AdvancedMetaEngine(Hopkins::gameDescriptions, sizeof(Hopkins::HopkinsGameDescription), hopkinsGames, optionsList) {
_maxScanDepth = 3;
_directoryGlobs = directoryGlobs;
}
@@ -190,7 +214,7 @@ SaveStateDescriptor HopkinsMetaEngine::querySaveMetaInfos(const char *target, in
#if PLUGIN_ENABLED_DYNAMIC(HOPKINS)
-REGISTER_PLUGIN_DYNAMIC(HOPKINS, PLUGIN_TYPE_ENGINE, HopkinsMetaEngine);
+ REGISTER_PLUGIN_DYNAMIC(HOPKINS, PLUGIN_TYPE_ENGINE, HopkinsMetaEngine);
#else
-REGISTER_PLUGIN_STATIC(HOPKINS, PLUGIN_TYPE_ENGINE, HopkinsMetaEngine);
+ REGISTER_PLUGIN_STATIC(HOPKINS, PLUGIN_TYPE_ENGINE, HopkinsMetaEngine);
#endif
diff --git a/engines/hopkins/detection_tables.h b/engines/hopkins/detection_tables.h
index c3ff563f6f..aeb92d7411 100644
--- a/engines/hopkins/detection_tables.h
+++ b/engines/hopkins/detection_tables.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.
@@ -22,6 +22,9 @@
namespace Hopkins {
+#define GAMEOPTION_GORE_DEFAULT_ON GUIO_GAMEOPTIONS1
+#define GAMEOPTION_GORE_DEFAULT_OFF GUIO_GAMEOPTIONS2
+
static const HopkinsGameDescription gameDescriptions[] = {
{
// Hopkins FBI Linux Demo UK 1.00 and 1.02
@@ -35,7 +38,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformLinux,
ADGF_DEMO,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@@ -51,7 +54,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformOS2,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@@ -66,7 +69,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformBeOS,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@@ -81,7 +84,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@@ -96,7 +99,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_OFF)
},
},
{
@@ -111,7 +114,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@@ -126,7 +129,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformLinux,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@@ -141,7 +144,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformLinux,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@@ -156,11 +159,27 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
+ // Hopkins FBI Win95 Polish, provided by Paput in bug #6511
+ {
+ "hopkins",
+ 0,
+ {
+ {"RES_VAN.RES", 0, "f2fec5172e4a7a9d35cb2a5f948ef6a9", 39400865},
+ AD_LISTEND
+ },
+ Common::PL_POL,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GAMEOPTION_GORE_DEFAULT_OFF)
+ },
+ },
+
+ {
// Hopkins FBI Win95 Demo, provided by Strangerke
// CHECKME: No voice! a second file is required though... Also, it has multi-language support
{
@@ -173,7 +192,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@@ -188,7 +207,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformWindows,
ADGF_DEMO,
- GUIO1(GUIO_NONE)
+ GUIO1(GAMEOPTION_GORE_DEFAULT_OFF)
},
},
{ AD_TABLE_END_MARKER }
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp
index 3b8fedf0ee..fc613f892d 100644
--- a/engines/hopkins/dialogs.cpp
+++ b/engines/hopkins/dialogs.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.
@@ -84,12 +84,17 @@ void DialogsManager::showOptionsDialog() {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "OPTION.SPR";
else {
- if (_vm->_globals->_language == LANG_FR)
+ switch (_vm->_globals->_language) {
+ case LANG_FR:
filename = "OPTIFR.SPR";
- else if (_vm->_globals->_language == LANG_EN)
+ break;
+ case LANG_EN:
filename = "OPTIAN.SPR";
- else if (_vm->_globals->_language == LANG_SP)
+ break;
+ case LANG_SP:
filename = "OPTIES.SPR";
+ break;
+ }
}
_vm->_globals->_optionDialogSpr = _vm->_fileIO->loadFile(filename);
diff --git a/engines/hopkins/dialogs.h b/engines/hopkins/dialogs.h
index 246b80cd3e..822cf376dd 100644
--- a/engines/hopkins/dialogs.h
+++ b/engines/hopkins/dialogs.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/hopkins/events.cpp b/engines/hopkins/events.cpp
index 51c66c4f92..1ee495a111 100644
--- a/engines/hopkins/events.cpp
+++ b/engines/hopkins/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.
@@ -271,7 +271,7 @@ void EventsManager::pollEvents() {
_mouseButton = 0;
return;
default:
- break;
+ break;
}
}
diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h
index f4dedce1c5..fde0106689 100644
--- a/engines/hopkins/events.h
+++ b/engines/hopkins/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/hopkins/files.cpp b/engines/hopkins/files.cpp
index 2390ebbdf8..6620f2878c 100644
--- a/engines/hopkins/files.cpp
+++ b/engines/hopkins/files.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.
@@ -25,6 +25,7 @@
#include "hopkins/hopkins.h"
#include "hopkins/globals.h"
+#include "common/config-manager.h"
#include "common/system.h"
#include "common/debug.h"
#include "common/file.h"
@@ -50,12 +51,13 @@ byte *FileManager::loadFile(const Common::String &file) {
// Allocate space for the file contents
size_t filesize = f.size();
- byte *data = _vm->_globals->allocMemory(filesize);
+ byte *data = _vm->_globals->allocMemory(filesize+1);
if (!data)
error("Error allocating space for file being loaded - %s", file.c_str());
readStream(f, data, filesize);
f.close();
+ data[filesize] = '\0';
return data;
}
@@ -68,20 +70,11 @@ int FileManager::readStream(Common::ReadStream &stream, void *buf, size_t nbytes
}
/**
- * Initialize censorship based on blood.dat file
+ * The original censorship was based on blood.dat file.
+ * It's now using the config manager and a per-engine GUI option.
*/
void FileManager::initCensorship() {
- _vm->_globals->_censorshipFl = false;
-
- // If file doesn't exist, fallback to uncensored
- if (fileExists("BLOOD.DAT")) {
- char *data = (char *)loadFile("BLOOD.DAT");
-
- if ((data[6] == 'u' && data[7] == 'k') || (data[6] == 'U' && data[7] == 'K'))
- _vm->_globals->_censorshipFl = true;
-
- _vm->_globals->freeMemory((byte *)data);
- }
+ _vm->_globals->_censorshipFl = ConfMan.getBool("enable_gore");
}
/**
diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h
index 5e5eaa755c..0c117ccc10 100644
--- a/engines/hopkins/files.h
+++ b/engines/hopkins/files.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/hopkins/font.cpp b/engines/hopkins/font.cpp
index ac0eee2866..7d57f564a9 100644
--- a/engines/hopkins/font.cpp
+++ b/engines/hopkins/font.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/hopkins/font.h b/engines/hopkins/font.h
index 93e807ea4b..fe423edfe7 100644
--- a/engines/hopkins/font.h
+++ b/engines/hopkins/font.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/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index a9a0a81f08..1f192748cd 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.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.
@@ -148,7 +148,7 @@ void Globals::setConfig() {
_language = LANG_SP;
break;
default:
- warning("Unknown language in internal language mapping");
+ error("Hopkins - SetConfig(): Unknown language in internal language mapping");
break;
}
// End of CHECKME
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index 94512c3d26..2e17389a45 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.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/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index de9f043763..7227c3e833 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.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.
@@ -28,7 +28,7 @@
#include "common/system.h"
#include "graphics/palette.h"
-#include "graphics/decoders/pcx.h"
+#include "image/pcx.h"
#include "common/file.h"
#include "common/rect.h"
#include "engines/util.h"
@@ -301,7 +301,7 @@ void GraphicsManager::fillSurface(byte *surface, byte *col, int size) {
void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag) {
Common::File f;
- Graphics::PCXDecoder pcxDecoder;
+ Image::PCXDecoder pcxDecoder;
// Clear the passed surface
memset(surface, 0, SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
@@ -439,9 +439,7 @@ void GraphicsManager::display8BitRect(const byte *surface, int xs, int ys, int w
}
void GraphicsManager::displayScaled8BitRect(const byte *surface, int xp, int yp, int width, int height, int destX, int destY) {
- int xCtr;
const byte *palette;
- int savedXCount;
byte *loopDestP;
const byte *loopSrcP;
int yCtr;
@@ -454,10 +452,10 @@ void GraphicsManager::displayScaled8BitRect(const byte *surface, int xp, int yp,
do {
yCtr = yCount;
- xCtr = xCount;
+ int xCtr = xCount;
loopSrcP = srcP;
loopDestP = destP;
- savedXCount = xCount;
+ int savedXCount = xCount;
palette = _palettePixels;
do {
@@ -1359,7 +1357,7 @@ void GraphicsManager::drawCompressedSprite(byte *surface, const byte *srcData, i
_posYClipped = 0;
_clipX1 = 0;
_clipY1 = 0;
- if ((xp300 <= _minX) || (yp300 <= _minY) || (xp300 >= _maxX + 300) || (yp300 >= _maxY + 300))
+ if ((xp300 <= _minX) || (yp300 <= _minY) || (xp300 >= _maxX + 300) || (yp300 >= _maxY + 300))
return;
// Clipped values are greater or equal to zero, thanks to the previous test
@@ -1781,7 +1779,7 @@ void GraphicsManager::initScreen(const Common::String &file, int mode, bool init
do {
int dataVal1 = _vm->_script->handleOpcode(ptr + 20 * dataOffset);
- if (_vm->shouldQuit())
+ if (dataVal1 == -1 || _vm->shouldQuit())
return;
if (dataVal1 == 2)
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index 8767f5ec4d..1ea6b89f2a 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.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/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index 96131f2968..9940391f64 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.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.
@@ -166,7 +166,7 @@ bool HopkinsEngine::runWin95Demo() {
_globals->_characterType = CHARACTER_HOPKINS;
_objectsMan->_mapCarPosX = _objectsMan->_mapCarPosY = 0;
- memset(_globals->_saveData, 0, 2000);
+ memset(_globals->_saveData, 0, sizeof(Savegame));
_globals->_exitId = 0;
if (getLanguage() != Common::PL_POL)
@@ -210,12 +210,17 @@ bool HopkinsEngine::runWin95Demo() {
if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS)
_graphicsMan->loadImage("fond");
else {
- if (_globals->_language == LANG_FR)
+ switch (_globals->_language) {
+ case LANG_FR:
_graphicsMan->loadImage("fondfr");
- else if (_globals->_language == LANG_EN)
+ break;
+ case LANG_EN:
_graphicsMan->loadImage("fondan");
- else if (_globals->_language == LANG_SP)
+ break;
+ case LANG_SP:
_graphicsMan->loadImage("fondes");
+ break;
+ }
}
_graphicsMan->fadeInLong();
_events->delay(500);
@@ -227,7 +232,7 @@ bool HopkinsEngine::runWin95Demo() {
if (!_globals->_censorshipFl)
_animMan->playAnim("BANQUE.ANM", "BANKUK.ANM", 200, 28, 200);
else
- _animMan->playAnim("BANQUE.ANM", "BANKUK.ANM", 200, 28, 200);
+ _animMan->playAnim("BANKUK.ANM", "BANQUE.ANM", 200, 28, 200);
_soundMan->_specialSoundNum = 0;
_soundMan->removeSample(1);
_soundMan->removeSample(2);
@@ -465,7 +470,7 @@ bool HopkinsEngine::runLinuxDemo() {
_globals->_characterSpriteBuf = _fileIO->loadFile("PERSO.SPR");
_globals->_characterType = CHARACTER_HOPKINS;
_objectsMan->_mapCarPosX = _objectsMan->_mapCarPosY = 0;
- memset(_globals->_saveData, 0, 2000);
+ memset(_globals->_saveData, 0, sizeof(Savegame));
_globals->_exitId = 0;
if (_startGameSlot != -1)
@@ -521,12 +526,17 @@ bool HopkinsEngine::runLinuxDemo() {
if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS)
_graphicsMan->loadImage("fond");
else {
- if (_globals->_language == LANG_FR)
+ switch (_globals->_language) {
+ case LANG_FR:
_graphicsMan->loadImage("fondfr");
- else if (_globals->_language == LANG_EN)
+ break;
+ case LANG_EN:
_graphicsMan->loadImage("fondan");
- else if (_globals->_language == LANG_SP)
+ break;
+ case LANG_SP:
_graphicsMan->loadImage("fondes");
+ break;
+ }
}
_graphicsMan->fadeInLong();
_events->delay(500);
@@ -826,7 +836,7 @@ bool HopkinsEngine::runFull() {
_globals->_characterSpriteBuf = _fileIO->loadFile("PERSO.SPR");
_globals->_characterType = CHARACTER_HOPKINS;
_objectsMan->_mapCarPosX = _objectsMan->_mapCarPosY = 0;
- memset(_globals->_saveData, 0, 2000);
+ memset(_globals->_saveData, 0, sizeof(Savegame));
_globals->_exitId = 0;
@@ -867,12 +877,17 @@ bool HopkinsEngine::runFull() {
if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS)
_graphicsMan->loadImage("fond");
else {
- if (_globals->_language == LANG_FR)
+ switch (_globals->_language) {
+ case LANG_FR:
_graphicsMan->loadImage("fondfr");
- else if (_globals->_language == LANG_EN)
+ break;
+ case LANG_EN:
_graphicsMan->loadImage("fondan");
- else if (_globals->_language == LANG_SP)
+ break;
+ case LANG_SP:
_graphicsMan->loadImage("fondes");
+ break;
+ }
}
_graphicsMan->fadeInLong();
_events->delay(500);
@@ -1908,7 +1923,6 @@ void HopkinsEngine::bombExplosion() {
}
void HopkinsEngine::restoreSystem() {
- quitGame();
_events->refreshEvents();
}
@@ -2846,7 +2860,6 @@ void HopkinsEngine::syncSoundSettings() {
}
bool HopkinsEngine::displayAdultDisclaimer() {
- int xp, yp;
int buttonIndex;
_graphicsMan->_minX = 0;
@@ -2866,8 +2879,8 @@ bool HopkinsEngine::displayAdultDisclaimer() {
_events->_mouseSpriteId = 0;
do {
- xp = _events->getMouseX();
- yp = _events->getMouseY();
+ int xp = _events->getMouseX();
+ int yp = _events->getMouseY();
buttonIndex = 0;
if (xp >= 37 && xp <= 169 && yp >= 406 && yp <= 445)
diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h
index d8c30e5004..b782d103a8 100644
--- a/engines/hopkins/hopkins.h
+++ b/engines/hopkins/hopkins.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.
@@ -48,6 +48,7 @@
#include "common/util.h"
#include "engines/engine.h"
#include "graphics/surface.h"
+#include "gui/debugger.h"
/**
* This is the namespace of the Hopkins engine.
@@ -59,10 +60,6 @@
*/
namespace Hopkins {
-#define DEBUG_BASIC 1
-#define DEBUG_INTERMEDIATE 2
-#define DEBUG_DETAILED 3
-
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
@@ -136,6 +133,8 @@ protected:
virtual Common::Error run();
virtual bool hasFeature(EngineFeature f) const;
+ GUI::Debugger *getDebugger() { return _debug; }
+
public:
AnimationManager *_animMan;
ComputerManager *_computer;
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index aa708fdfb2..709f17a8b2 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.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.
@@ -548,8 +548,6 @@ int LinesManager::avoidObstacleOnSegment(int lineIdx, int lineDataIdx, int route
bool LinesManager::MIRACLE(int fromX, int fromY, int lineIdx, int destLineIdx, int routeIdx) {
debugC(5, kDebugPath, "MIRACLE(%d, %d, %d, %d, %d)", fromX, fromY, lineIdx, destLineIdx, routeIdx);
- int newLinesDataIdx = 0;
- int newLinesIdx = 0;
int lineIdxLeft = 0;
int lineDataIdxLeft = 0;
int lineIdxRight = 0;
@@ -700,6 +698,8 @@ bool LinesManager::MIRACLE(int fromX, int fromY, int lineIdx, int destLineIdx, i
newDir = DIR_LEFT;
}
+ int newLinesDataIdx = 0;
+ int newLinesIdx = 0;
switch(newDir) {
case DIR_UP:
newLinesIdx = linesIdxUp;
@@ -1552,7 +1552,6 @@ void LinesManager::useRoute2(int idx, int curRouteIdx) {
int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int startLineIdx, int endLineIdx, int routeIdx) {
debugC(5, kDebugPath, "characterRoute(%d, %d, %d, %d, %d, %d, %d)", fromX, fromY, destX, destY, startLineIdx, endLineIdx, routeIdx);
int collDataIdxRoute2 = 0;
- bool colResult = false;
int curX = fromX;
int curY = fromY;
@@ -1603,7 +1602,6 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int
int collLineIdxRoute1 = -1;
int collLineIdxRoute2 = -1;
- int distX, distY;
int repeatFlag = 0;
int collDataIdxRoute0 = 0;
int collDataIdxRoute1 = 0;
@@ -1615,8 +1613,8 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int
useRoute0(idxRoute0, curRouteIdx);
return 1;
}
- distX = abs(curX - destX) + 1;
- distY = abs(curY - destY) + 1;
+ int distX = abs(curX - destX) + 1;
+ int distY = abs(curY - destY) + 1;
int maxDist;
if (distX > distY)
maxDist = distX;
@@ -1912,7 +1910,7 @@ int LinesManager::characterRoute(int fromX, int fromY, int destX, int destY, int
posXRoute2 = _newPosX;
posYRoute2 = _newPosY;
- colResult = checkCollisionLine(_newPosX, _newPosY, &collDataIdxRoute2, &collLineIdxRoute2, 0, _lastLine);
+ bool colResult = checkCollisionLine(_newPosX, _newPosY, &collDataIdxRoute2, &collLineIdxRoute2, 0, _lastLine);
if (colResult && collLineIdxRoute2 <= _lastLine)
break;
}
@@ -2456,13 +2454,12 @@ bool LinesManager::PLAN_TEST(int paramX, int paramY, int superRouteIdx, int para
int LinesManager::testLine(int paramX, int paramY, int *testValue, int *foundLineIdx, int *foundDataIdx) {
debugC(5, kDebugPath, "testLine(%d, %d, testValue, foundLineIdx, foundDataIdx)", paramX, paramY);
int16 *lineData;
- int lineDataEndIdx;
int collLineIdx;
int collDataIdx;
for (int idx = _lastLine + 1; idx < _linesNumb + 1; idx++) {
lineData = _lineItem[idx]._lineData;
- lineDataEndIdx = _lineItem[idx]._lineDataEndIdx;
+ int lineDataEndIdx = _lineItem[idx]._lineDataEndIdx;
if (!lineData)
continue;
diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h
index b32dc6e2a5..5e9ef8a7b0 100644
--- a/engines/hopkins/lines.h
+++ b/engines/hopkins/lines.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/hopkins/menu.cpp b/engines/hopkins/menu.cpp
index 455f4ad8d4..169b29a560 100644
--- a/engines/hopkins/menu.cpp
+++ b/engines/hopkins/menu.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,23 +69,37 @@ int MenuManager::menu() {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
_vm->_graphicsMan->loadImage("MENU");
- else if (_vm->_globals->_language == LANG_EN)
- _vm->_graphicsMan->loadImage("MENUAN");
- else if (_vm->_globals->_language == LANG_FR)
- _vm->_graphicsMan->loadImage("MENUFR");
- else if (_vm->_globals->_language == LANG_SP)
- _vm->_graphicsMan->loadImage("MENUES");
+ else {
+ switch (_vm->_globals->_language) {
+ case LANG_EN:
+ _vm->_graphicsMan->loadImage("MENUAN");
+ break;
+ case LANG_FR:
+ _vm->_graphicsMan->loadImage("MENUFR");
+ break;
+ case LANG_SP:
+ _vm->_graphicsMan->loadImage("MENUES");
+ break;
+ }
+ }
_vm->_graphicsMan->fadeInLong();
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
spriteData = _vm->_objectsMan->loadSprite("MENU.SPR");
- else if (_vm->_globals->_language == LANG_EN)
- spriteData = _vm->_objectsMan->loadSprite("MENUAN.SPR");
- else if (_vm->_globals->_language == LANG_FR)
- spriteData = _vm->_objectsMan->loadSprite("MENUFR.SPR");
- else if (_vm->_globals->_language == LANG_SP)
- spriteData = _vm->_objectsMan->loadSprite("MENUES.SPR");
+ else {
+ switch (_vm->_globals->_language) {
+ case LANG_EN:
+ spriteData = _vm->_objectsMan->loadSprite("MENUAN.SPR");
+ break;
+ case LANG_FR:
+ spriteData = _vm->_objectsMan->loadSprite("MENUFR.SPR");
+ break;
+ case LANG_SP:
+ spriteData = _vm->_objectsMan->loadSprite("MENUES.SPR");
+ break;
+ }
+ }
_vm->_events->mouseOn();
_vm->_events->changeMouseCursor(0);
diff --git a/engines/hopkins/menu.h b/engines/hopkins/menu.h
index e926c29dbd..4f78e73685 100644
--- a/engines/hopkins/menu.h
+++ b/engines/hopkins/menu.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/hopkins/objects.cpp b/engines/hopkins/objects.cpp
index f2f547557f..b54b21bbc9 100644
--- a/engines/hopkins/objects.cpp
+++ b/engines/hopkins/objects.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.
@@ -376,7 +376,6 @@ void ObjectsManager::addObject(int objIndex) {
void ObjectsManager::displaySprite() {
int clipX;
int clipY;
- bool loopCondFl;
uint16 arr[50];
// Handle copying any background areas that text are going to be drawn on
@@ -441,6 +440,7 @@ void ObjectsManager::displaySprite() {
for (int i = 1; i <= 48; i++)
arr[i] = i;
+ bool loopCondFl;
do {
loopCondFl = false;
for (int sortIdx = 1; sortIdx < _sortedDisplayCount; sortIdx++) {
@@ -2629,7 +2629,7 @@ void ObjectsManager::loadObjectIniFile() {
for (;;) {
int opcodeType = _vm->_script->handleOpcode(data + 20 * lastOpcodeResult);
- if (_vm->shouldQuit())
+ if (opcodeType == -1 || _vm->shouldQuit())
return;
if (opcodeType == 2)
@@ -3613,12 +3613,10 @@ void ObjectsManager::showSpecialActionAnimation(const byte *spriteData, const Co
realSpeed = speed / 3;
int spriteIndex = 0;
- bool completeTokenFl;
- char nextChar;
for (int idx = 0; ; idx++) {
- completeTokenFl = false;
- nextChar = animString[idx];
+ bool completeTokenFl = false;
+ char nextChar = animString[idx];
if (nextChar == ',') {
spriteIndex = atoi(tmpStr.c_str());
tmpStr = "";
diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h
index 5f1f5b1f59..dc56765431 100644
--- a/engines/hopkins/objects.h
+++ b/engines/hopkins/objects.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/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp
index b0dea7e6d1..05c7fb8119 100644
--- a/engines/hopkins/saveload.cpp
+++ b/engines/hopkins/saveload.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/hopkins/saveload.h b/engines/hopkins/saveload.h
index 5b77c11f12..7b4ec307f5 100644
--- a/engines/hopkins/saveload.h
+++ b/engines/hopkins/saveload.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/hopkins/script.cpp b/engines/hopkins/script.cpp
index 7e150624b8..b0d8749c7f 100644
--- a/engines/hopkins/script.cpp
+++ b/engines/hopkins/script.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.
@@ -148,12 +148,18 @@ int ScriptManager::handleOpcode(const byte *dataP) {
_vm->_soundMan->mixVoice(635, 4, displayedTxtFl);
} else {
int textPosX = READ_LE_INT16(dataP + 9);
- if (_vm->_globals->_language == LANG_FR && !_vm->_soundMan->_textOffFl)
- _vm->_fontMan->initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
- else if (_vm->_globals->_language == LANG_EN && !_vm->_soundMan->_textOffFl)
- _vm->_fontMan->initTextBuffers(9, mesgId, "OBJETAN.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
- else if (_vm->_globals->_language == LANG_SP && !_vm->_soundMan->_textOffFl) {
- _vm->_fontMan->initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
+ if (!_vm->_soundMan->_textOffFl) {
+ switch (_vm->_globals->_language) {
+ case LANG_FR:
+ _vm->_fontMan->initTextBuffers(9, mesgId, "OBJET1.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
+ break;
+ case LANG_EN:
+ _vm->_fontMan->initTextBuffers(9, mesgId, "OBJETAN.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
+ break;
+ case LANG_SP:
+ _vm->_fontMan->initTextBuffers(9, mesgId, "OBJETES.TXT", 2 * textPosX, 60, 6, dataP[7], 253);
+ break;
+ }
}
bool displayedTxtFl = false;
diff --git a/engines/hopkins/script.h b/engines/hopkins/script.h
index 2a22e18ccb..1f8e45dc9a 100644
--- a/engines/hopkins/script.h
+++ b/engines/hopkins/script.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/hopkins/sound.cpp b/engines/hopkins/sound.cpp
index bf816c08a4..773c714899 100644
--- a/engines/hopkins/sound.cpp
+++ b/engines/hopkins/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.
@@ -200,14 +200,6 @@ SoundManager::SoundManager(HopkinsEngine *vm) {
_currentSoundIndex = 0;
_oldSoundNumber = 0;
_modPlayingFl = false;
-
- for (int i = 0; i < VOICE_COUNT; ++i)
- Common::fill((byte *)&_voice[i], (byte *)&_voice[i] + sizeof(VoiceItem), 0);
- for (int i = 0; i < SWAV_COUNT; ++i)
- Common::fill((byte *)&_sWav[i], (byte *)&_sWav[i] + sizeof(SwavItem), 0);
- for (int i = 0; i < SOUND_COUNT; ++i)
- Common::fill((byte *)&_sound[i], (byte *)&_sound[i] + sizeof(SoundItem), 0);
- Common::fill((byte *)&_music, (byte *)&_music + sizeof(MusicItem), 0);
}
SoundManager::~SoundManager() {
@@ -520,12 +512,19 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode, bool dispTxtFl) {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "ENG_VOI.RES";
// Win95 and Linux versions uses another set of names
- else if (_vm->_globals->_language == LANG_FR)
- filename = "RES_VFR.RES";
- else if (_vm->_globals->_language == LANG_EN)
- filename = "RES_VAN.RES";
- else if (_vm->_globals->_language == LANG_SP)
- filename = "RES_VES.RES";
+ else {
+ switch (_vm->_globals->_language) {
+ case LANG_FR:
+ filename = "RES_VFR.RES";
+ break;
+ case LANG_EN:
+ filename = "RES_VAN.RES";
+ break;
+ case LANG_SP:
+ filename = "RES_VES.RES";
+ break;
+ }
+ }
catPos = _vm->_fileIO->_catalogPos;
catLen = _vm->_fileIO->_catalogSize;
@@ -535,12 +534,19 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode, bool dispTxtFl) {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "ENG_VOI.RES";
// Win95 and Linux versions uses another set of names
- else if (_vm->_globals->_language == LANG_FR)
- filename = "RES_VFR.RES";
- else if (_vm->_globals->_language == LANG_EN)
- filename = "RES_VAN.RES";
- else if (_vm->_globals->_language == LANG_SP)
- filename = "RES_VES.RES";
+ else {
+ switch (_vm->_globals->_language) {
+ case LANG_FR:
+ filename = "RES_VFR.RES";
+ break;
+ case LANG_EN:
+ filename = "RES_VAN.RES";
+ break;
+ case LANG_SP:
+ filename = "RES_VES.RES";
+ break;
+ }
+ }
catPos = _vm->_fileIO->_catalogPos;
catLen = _vm->_fileIO->_catalogSize;
@@ -550,12 +556,19 @@ bool SoundManager::mixVoice(int voiceId, int voiceMode, bool dispTxtFl) {
if (_vm->getPlatform() == Common::kPlatformOS2 || _vm->getPlatform() == Common::kPlatformBeOS)
filename = "ENG_VOI.RES";
// Win95 and Linux versions uses another set of names
- else if (_vm->_globals->_language == LANG_FR)
- filename = "RES_VFR.RES";
- else if (_vm->_globals->_language == LANG_EN)
- filename = "RES_VAN.RES";
- else if (_vm->_globals->_language == LANG_SP)
- filename = "RES_VES.RES";
+ else {
+ switch (_vm->_globals->_language) {
+ case LANG_FR:
+ filename = "RES_VFR.RES";
+ break;
+ case LANG_EN:
+ filename = "RES_VAN.RES";
+ break;
+ case LANG_SP:
+ filename = "RES_VES.RES";
+ break;
+ }
+ }
catPos = _vm->_fileIO->_catalogPos;
catLen = _vm->_fileIO->_catalogSize;
diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h
index f1d047ae8b..97cdcdc1dd 100644
--- a/engines/hopkins/sound.h
+++ b/engines/hopkins/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.
@@ -33,12 +33,16 @@ namespace Hopkins {
class VoiceItem {
public:
+ VoiceItem() : _status(false), _wavIndex(0) {}
+
bool _status;
int _wavIndex;
};
class SwavItem {
public:
+ SwavItem() : _active(false), _audioStream(NULL), _freeSampleFl(false) {}
+
bool _active;
Audio::RewindableAudioStream *_audioStream;
Audio::SoundHandle _soundHandle;
@@ -47,11 +51,15 @@ public:
class MusicItem {
public:
+ MusicItem() : _active(false) {}
+
bool _active;
};
class SoundItem {
public:
+ SoundItem() : _active(false) {}
+
bool _active;
};
diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp
index 736ec9865c..df7b26c82c 100644
--- a/engines/hopkins/talk.cpp
+++ b/engines/hopkins/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.
@@ -68,12 +68,17 @@ void TalkManager::startAnimatedCharacterDialogue(const Common::String &filename)
getStringFromBuffer(40, spriteFilename, (const char *)_characterBuffer);
getStringFromBuffer(0, _questionsFilename, (const char *)_characterBuffer);
getStringFromBuffer(20, _answersFilename, (const char *)_characterBuffer);
- if (_vm->_globals->_language == LANG_FR) {
+
+ switch (_vm->_globals->_language) {
+ case LANG_FR:
_answersFilename = _questionsFilename = "RUE.TXT";
- } else if (_vm->_globals->_language == LANG_EN) {
+ break;
+ case LANG_EN:
_answersFilename = _questionsFilename = "RUEAN.TXT";
- } else if (_vm->_globals->_language == LANG_SP) {
+ break;
+ case LANG_SP:
_answersFilename = _questionsFilename = "RUEES.TXT";
+ break;
}
_dialogueMesgId1 = READ_LE_INT16((uint16 *)_characterBuffer + 40);
_paletteBufferIdx = 20 * READ_LE_INT16((uint16 *)_characterBuffer + 42) + 110;
@@ -261,7 +266,7 @@ int TalkManager::dialogQuestion(bool animatedFl) {
int retVal = -1;
bool loopCond = false;
- do {
+ do {
int mousePosY = _vm->_events->getMouseY();
if (sentence1PosY < mousePosY && mousePosY < (sentence2PosY - 1)) {
_vm->_fontMan->setOptimalColor(6, 7, 8, 5);
@@ -608,7 +613,6 @@ void TalkManager::displayBobDialogAnim(int idx) {
_vm->_objectsMan->_bob[idx]._flipFl = false;
_vm->_objectsMan->_bob[idx]._animData = _vm->_animMan->_animBqe[idx]._data;
_vm->_objectsMan->_bob[idx]._bobMode = 10;
- bqeData = _characterSprite;
_vm->_objectsMan->_bob[idx]._spriteData = _characterSprite;
_vm->_objectsMan->_bob[idx]._bobModeChange = newMode;
_vm->_objectsMan->_bob[idx]._modeChangeCtr = -1;
@@ -820,7 +824,7 @@ void TalkManager::handleAnswer(int zone, int verb) {
int lastOpcodeResult = 1;
do {
int opcodeType = _vm->_script->handleOpcode(ptr + 20 * lastOpcodeResult);
- if (_vm->shouldQuit())
+ if (opcodeType == -1 || _vm->shouldQuit())
return;
if (opcodeType == 2)
diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h
index 678f52090a..49ee92d3b9 100644
--- a/engines/hopkins/talk.h
+++ b/engines/hopkins/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.