aboutsummaryrefslogtreecommitdiff
path: root/engines/agos
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agos')
-rw-r--r--engines/agos/agos.cpp32
-rw-r--r--engines/agos/agos.h66
-rw-r--r--engines/agos/animation.cpp22
-rw-r--r--engines/agos/animation.h4
-rw-r--r--engines/agos/charset-fontdata.cpp4
-rw-r--r--engines/agos/charset.cpp4
-rw-r--r--engines/agos/configure.engine4
-rw-r--r--engines/agos/contain.cpp4
-rw-r--r--engines/agos/cursor.cpp4
-rw-r--r--engines/agos/debug.cpp41
-rw-r--r--engines/agos/debug.h224
-rw-r--r--engines/agos/debugger.cpp121
-rw-r--r--engines/agos/debugger.h5
-rw-r--r--engines/agos/detection.cpp13
-rw-r--r--engines/agos/detection_tables.h32
-rw-r--r--engines/agos/draw.cpp4
-rw-r--r--engines/agos/event.cpp22
-rw-r--r--engines/agos/feeble.cpp4
-rw-r--r--engines/agos/gfx.cpp9
-rw-r--r--engines/agos/icons.cpp10
-rw-r--r--engines/agos/input.cpp113
-rw-r--r--engines/agos/input_pn.cpp4
-rw-r--r--engines/agos/intern.h25
-rw-r--r--engines/agos/items.cpp4
-rw-r--r--engines/agos/menus.cpp4
-rw-r--r--engines/agos/midi.cpp8
-rw-r--r--engines/agos/midi.h4
-rw-r--r--engines/agos/midiparser_s1d.cpp4
-rw-r--r--engines/agos/oracle.cpp8
-rw-r--r--engines/agos/pn.cpp4
-rw-r--r--engines/agos/res.cpp177
-rw-r--r--engines/agos/res_ami.cpp4
-rw-r--r--engines/agos/res_snd.cpp25
-rw-r--r--engines/agos/rooms.cpp4
-rw-r--r--engines/agos/saveload.cpp88
-rw-r--r--engines/agos/script.cpp9
-rw-r--r--engines/agos/script_dp.cpp4
-rw-r--r--engines/agos/script_e1.cpp4
-rw-r--r--engines/agos/script_e2.cpp4
-rw-r--r--engines/agos/script_ff.cpp73
-rw-r--r--engines/agos/script_pn.cpp4
-rw-r--r--engines/agos/script_pp.cpp4
-rw-r--r--engines/agos/script_s1.cpp4
-rw-r--r--engines/agos/script_s2.cpp4
-rw-r--r--engines/agos/script_ww.cpp4
-rw-r--r--engines/agos/sound.cpp20
-rw-r--r--engines/agos/sound.h4
-rw-r--r--engines/agos/string.cpp4
-rw-r--r--engines/agos/string_pn.cpp4
-rw-r--r--engines/agos/subroutine.cpp16
-rw-r--r--engines/agos/verb.cpp19
-rw-r--r--engines/agos/verb_pn.cpp4
-rw-r--r--engines/agos/vga.cpp12
-rw-r--r--engines/agos/vga.h4
-rw-r--r--engines/agos/vga_e2.cpp4
-rw-r--r--engines/agos/vga_ff.cpp4
-rw-r--r--engines/agos/vga_pn.cpp4
-rw-r--r--engines/agos/vga_s1.cpp4
-rw-r--r--engines/agos/vga_s2.cpp4
-rw-r--r--engines/agos/vga_ww.cpp4
-rw-r--r--engines/agos/window.cpp4
-rw-r--r--engines/agos/zones.cpp6
62 files changed, 854 insertions, 486 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 359a6f7289..6eda2eb9aa 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.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.
@@ -21,6 +21,7 @@
*/
#include "common/config-manager.h"
+#include "common/debug-channels.h"
#include "common/file.h"
#include "common/fs.h"
#include "common/textconsole.h"
@@ -144,6 +145,14 @@ AGOSEngine_Elvira1::AGOSEngine_Elvira1(OSystem *system, const AGOSGameDescriptio
AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd)
: Engine(system), _rnd("agos"), _gameDescription(gd) {
+ DebugMan.addDebugChannel(kDebugOpcode, "opcode", "Opcode debug level");
+ DebugMan.addDebugChannel(kDebugVGAOpcode, "vga_opcode", "VGA Opcode debug level");
+ DebugMan.addDebugChannel(kDebugSubroutine, "subroutine", "Subroutine debug level");
+ DebugMan.addDebugChannel(kDebugVGAScript, "vga_script", "VGA Script debug level");
+ //Image dumping command disabled as it doesn't work well
+#if 0
+ DebugMan.addDebugChannel(kDebugImageDump, "image_dump", "Enable dumping of images to files");
+#endif
_vcPtr = 0;
_vcGetOutOfCode = 0;
_gameOffsetsPtr = 0;
@@ -243,13 +252,6 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd)
_backFlag = false;
- _debugMode = 0;
- _dumpScripts = false;
- _dumpOpcodes = false;
- _dumpVgaScripts = false;
- _dumpVgaOpcodes = false;
- _dumpImages = false;
-
_copyProtection = false;
_pause = false;
_speech = false;
@@ -510,6 +512,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd)
_saveLoadType = 0;
_saveLoadSlot = 0;
memset(_saveLoadName, 0, sizeof(_saveLoadName));
+ memset(_saveBuf, 0, sizeof(_saveBuf));
_saveGameNameLen = 0;
_saveLoadRowCurPos = 0;
@@ -550,7 +553,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd)
SearchMan.addSubDirectoryMatching(gameDataDir, "execute");
// Add default file directories for Amiga/Macintosh
- // verisons of Simon the Sorcerer 2
+ // versions of Simon the Sorcerer 2
SearchMan.addSubDirectoryMatching(gameDataDir, "voices");
// Add default file directories for Amiga & Macintosh
@@ -674,15 +677,6 @@ Common::Error AGOSEngine::init() {
_subtitles = true;
}
- // TODO: Use special debug levels instead of the following hack.
- _debugMode = (gDebugLevel >= 0);
- switch (gDebugLevel) {
- case 2: _dumpOpcodes = true; break;
- case 3: _dumpVgaOpcodes = true; break;
- case 4: _dumpScripts = true; break;
- case 5: _dumpVgaScripts = true; break;
- }
-
return Common::kNoError;
}
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 87a1228c6a..b6b5e427e1 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.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.
@@ -25,7 +25,6 @@
#include "engines/engine.h"
-#include "common/archive.h"
#include "common/array.h"
#include "common/error.h"
#include "common/keyboard.h"
@@ -62,6 +61,14 @@ struct Surface;
namespace AGOS {
+enum {
+ kDebugOpcode = 1 << 0,
+ kDebugVGAOpcode = 1 << 1,
+ kDebugSubroutine = 1 << 2,
+ kDebugVGAScript = 1 << 3,
+ kDebugImageDump = 1 << 4
+};
+
uint fileReadItemID(Common::SeekableReadStream *in);
#define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y))
@@ -187,27 +194,6 @@ class Debugger;
# define _OPCODE(ver, x) { &ver::x, "" }
#endif
-class ArchiveMan : public Common::SearchSet {
-public:
- ArchiveMan();
-
- void enableFallback(bool val) { _fallBack = val; }
-
-#ifdef ENABLE_AGOS2
- void registerArchive(const Common::String &filename, int priority);
-#endif
-
- virtual bool hasFile(const Common::String &name) const;
- virtual int listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const;
- virtual int listMembers(Common::ArchiveMemberList &list) const;
-
- virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
- virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &filename) const;
-
-private:
- bool _fallBack;
-};
-
class AGOSEngine : public Engine {
protected:
friend class Debugger;
@@ -346,15 +332,9 @@ protected:
bool _fastMode;
bool _backFlag;
- uint16 _debugMode;
Common::Language _language;
bool _copyProtection;
bool _pause;
- bool _dumpScripts;
- bool _dumpOpcodes;
- bool _dumpVgaScripts;
- bool _dumpVgaOpcodes;
- bool _dumpImages;
bool _speech;
bool _subtitles;
bool _vgaVar9;
@@ -606,6 +586,7 @@ protected:
byte _saveLoadType, _saveLoadSlot;
char _saveLoadName[108];
+ char _saveBuf[200];
Graphics::Surface *_backGroundBuf;
Graphics::Surface *_backBuf;
@@ -622,8 +603,6 @@ public:
AGOSEngine(OSystem *system, const AGOSGameDescription *gd);
virtual ~AGOSEngine();
- ArchiveMan _archives;
-
byte *_curSfxFile;
uint32 _curSfxFileSize;
uint16 _sampleEnd, _sampleWait;
@@ -858,6 +837,9 @@ protected:
void displayBoxStars();
void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
+ virtual void handleMouseWheelUp();
+ virtual void handleMouseWheelDown();
+
virtual void initMouse();
virtual void handleMouseMoved();
virtual void drawMousePointer();
@@ -1730,10 +1712,13 @@ protected:
void setExitState(Item *i, uint16 n, uint16 d, uint16 s);
void setSRExit(Item *i, int n, int d, uint16 s);
- virtual void listSaveGames(char *dst);
+ virtual void handleMouseWheelUp();
+ virtual void handleMouseWheelDown();
+
+ virtual void listSaveGames();
virtual bool confirmOverWrite(WindowBlock *window);
virtual void userGame(bool load);
- virtual int userGameGetKey(bool *b, char *buf, uint maxChar);
+ virtual int userGameGetKey(bool *b, uint maxChar);
virtual Common::String genSaveName(int slot) const;
};
@@ -1853,6 +1838,9 @@ protected:
virtual void clearName();
+ virtual void handleMouseWheelUp();
+ virtual void handleMouseWheelDown();
+
virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
virtual void initMouse();
@@ -1865,9 +1853,9 @@ protected:
virtual void playSpeech(uint16 speechId, uint16 vgaSpriteId);
- virtual void listSaveGames(char *dst);
+ virtual void listSaveGames();
virtual void userGame(bool load);
- virtual int userGameGetKey(bool *b, char *buf, uint maxChar);
+ virtual int userGameGetKey(bool *b, uint maxChar);
virtual void playMusic(uint16 music, uint16 track);
@@ -1951,6 +1939,7 @@ public:
void off_listSaveGames();
void off_checkCD();
void off_screenTextBox();
+ void off_b2Set();
void off_isAdjNoun();
void off_hyperLinkOn();
void off_hyperLinkOff();
@@ -1993,12 +1982,17 @@ protected:
virtual uint16 readUint16Wrapper(const void *src);
virtual uint32 readUint32Wrapper(const void *src);
+ void setLoyaltyRating(byte rating);
+
void playVideo(const char *filename, bool lastSceneUsed = false);
void stopInteractiveVideo();
virtual void drawImage(VC10_state *state);
void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
+ virtual void handleMouseWheelUp();
+ virtual void handleMouseWheelDown();
+
void drawMousePart(int image, byte x, byte y);
virtual void initMouse();
virtual void drawMousePointer();
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index 40c9d1d049..83682d567b 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.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.
@@ -251,8 +251,8 @@ bool MoviePlayerDXA::load() {
}
Common::String videoName = Common::String::format("%s.dxa", baseName);
- Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName);
- if (!videoStream)
+ Common::File *videoStream = new Common::File();
+ if (!videoStream->open(videoName))
error("Failed to load video file %s", videoName.c_str());
if (!loadStream(videoStream))
error("Failed to load video stream from file %s", videoName.c_str());
@@ -287,7 +287,7 @@ void MoviePlayerDXA::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
void MoviePlayerDXA::playVideo() {
// Most of the videos included in the Amiga version, reduced the
- // resoluton to 384 x 280, so require the screen to be cleared,
+ // resolution to 384 x 280, so require the screen to be cleared,
// before starting playing those videos.
if (getWidth() == 384 && getHeight() == 280) {
_vm->clearSurfaces();
@@ -421,8 +421,8 @@ MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name)
bool MoviePlayerSMK::load() {
Common::String videoName = Common::String::format("%s.smk", baseName);
- Common::SeekableReadStream *videoStream = _vm->_archives.createReadStreamForMember(videoName);
- if (!videoStream)
+ Common::File *videoStream = new Common::File();
+ if (!videoStream->open(videoName))
error("Failed to load video file %s", videoName.c_str());
if (!loadStream(videoStream))
error("Failed to load video stream from file %s", videoName.c_str());
@@ -532,25 +532,25 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) {
memcpy(shortName, baseName, 6);
sprintf(filename, "%s~1.dxa", shortName);
- if (vm->_archives.hasFile(filename)) {
+ if (Common::File::exists(filename)) {
memset(baseName, 0, sizeof(baseName));
memcpy(baseName, filename, 8);
}
sprintf(filename, "%s~1.smk", shortName);
- if (vm->_archives.hasFile(filename)) {
+ if (Common::File::exists(filename)) {
memset(baseName, 0, sizeof(baseName));
memcpy(baseName, filename, 8);
}
}
sprintf(filename, "%s.dxa", baseName);
- if (vm->_archives.hasFile(filename)) {
+ if (Common::File::exists(filename)) {
return new MoviePlayerDXA(vm, baseName);
}
sprintf(filename, "%s.smk", baseName);
- if (vm->_archives.hasFile(filename)) {
+ if (Common::File::exists(filename)) {
return new MoviePlayerSMK(vm, baseName);
}
diff --git a/engines/agos/animation.h b/engines/agos/animation.h
index 9e31fced6d..86808cbc27 100644
--- a/engines/agos/animation.h
+++ b/engines/agos/animation.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/agos/charset-fontdata.cpp b/engines/agos/charset-fontdata.cpp
index b6b90eefcc..ae31814e43 100644
--- a/engines/agos/charset-fontdata.cpp
+++ b/engines/agos/charset-fontdata.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/agos/charset.cpp b/engines/agos/charset.cpp
index eca9728643..4d83a4ef1c 100644
--- a/engines/agos/charset.cpp
+++ b/engines/agos/charset.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/agos/configure.engine b/engines/agos/configure.engine
new file mode 100644
index 0000000000..3ae1fb16f2
--- /dev/null
+++ b/engines/agos/configure.engine
@@ -0,0 +1,4 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine agos "AGOS" yes "agos2" "AGOS 1 games"
+add_engine agos2 "AGOS 2 games" yes
diff --git a/engines/agos/contain.cpp b/engines/agos/contain.cpp
index 173194d45e..0fab0a35f2 100644
--- a/engines/agos/contain.cpp
+++ b/engines/agos/contain.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/agos/cursor.cpp b/engines/agos/cursor.cpp
index 7c64d68048..65fdc9ec99 100644
--- a/engines/agos/cursor.cpp
+++ b/engines/agos/cursor.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/agos/debug.cpp b/engines/agos/debug.cpp
index 841ac6bb1a..ad5bfb56f4 100644
--- a/engines/agos/debug.cpp
+++ b/engines/agos/debug.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.
@@ -101,7 +101,7 @@ const byte *AGOSEngine::dumpOpcode(const byte *p) {
}
case 'W':{
- int n = (int16)READ_BE_UINT16(p);
+ uint16 n = READ_BE_UINT16(p);
p += 2;
if (getGameType() == GType_PP) {
if (n >= 60000 && n < 62048)
@@ -222,14 +222,18 @@ void AGOSEngine::dumpVideoScript(const byte *src, bool singeOpcode) {
error("dumpVideoScript: Opcode %d out of range (%d)", opcode, _numVideoOpcodes);
}
- if (getGameType() == GType_FF || getGameType() == GType_PP) {
+ if (getGameType() == GType_PP) {
+ strn = str = puzzlepack_videoOpcodeNameTable[opcode];
+ } else if (getGameType() == GType_FF) {
strn = str = feeblefiles_videoOpcodeNameTable[opcode];
} else if (getGameType() == GType_SIMON2) {
strn = str = simon2_videoOpcodeNameTable[opcode];
} else if (getGameType() == GType_SIMON1) {
strn = str = simon1_videoOpcodeNameTable[opcode];
- } else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
+ } else if (getGameType() == GType_WW) {
strn = str = ww_videoOpcodeNameTable[opcode];
+ } else if (getGameType() == GType_ELVIRA2) {
+ strn = str = elvira2_videoOpcodeNameTable[opcode];
} else if (getGameType() == GType_ELVIRA1) {
strn = str = elvira1_videoOpcodeNameTable[opcode];
} else {
@@ -250,25 +254,39 @@ void AGOSEngine::dumpVideoScript(const byte *src, bool singeOpcode) {
case 'x':
debugN("\n");
return;
- case 'b':
+ case 'b': {
debugN("%d ", *src++);
break;
- case 'd':
+ }
+ case 'w': {
+ int16 v = (int16)readUint16Wrapper(src);
+ src += 2;
+ if (v < 0)
+ debugN("[%d] ", -v);
+ else
+ debugN("%d ", v);
+ break;
+ }
+ case 'd': {
debugN("%d ", (int16)readUint16Wrapper(src));
src += 2;
break;
- case 'v':
+ }
+ case 'v': {
debugN("[%d] ", readUint16Wrapper(src));
src += 2;
break;
- case 'i':
+ }
+ case 'i': {
debugN("%d ", (int16)readUint16Wrapper(src));
src += 2;
break;
- case 'j':
+ }
+ case 'j': {
debugN("-> ");
break;
- case 'q':
+ }
+ case 'q': {
while (readUint16Wrapper(src) != end) {
debugN("(%d,%d) ", readUint16Wrapper(src),
readUint16Wrapper(src + 2));
@@ -276,6 +294,7 @@ void AGOSEngine::dumpVideoScript(const byte *src, bool singeOpcode) {
}
src += 2;
break;
+ }
default:
error("dumpVideoScript: Invalid fmt string '%c' in decompile VGA", *str);
}
diff --git a/engines/agos/debug.h b/engines/agos/debug.h
index fe14ae4860..4d521de9b9 100644
--- a/engines/agos/debug.h
+++ b/engines/agos/debug.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.
@@ -2468,7 +2468,7 @@ const char *const elvira1_videoOpcodeNameTable[] = {
"dd|DELAY_IF_NOT_EQ",
};
-const char *const ww_videoOpcodeNameTable[] = {
+const char *const elvira2_videoOpcodeNameTable[] = {
/* 0 */
"x|RET",
"ddd|FADEOUT",
@@ -2485,7 +2485,7 @@ const char *const ww_videoOpcodeNameTable[] = {
"dddd|DRAW",
"d|ON_STOP",
/* 12 */
- "d|DELAY",
+ "w|DELAY",
"d|SET_SPRITE_OFFSET_X",
"d|SET_SPRITE_OFFSET_Y",
"d|SYNC",
@@ -2551,11 +2551,94 @@ const char *const ww_videoOpcodeNameTable[] = {
"|FASTFADEIN",
};
+const char *const ww_videoOpcodeNameTable[] = {
+ /* 0 */
+ "x|RET",
+ "ddd|FADEOUT",
+ "w|CALL",
+ "ddddd|NEW_SPRITE",
+ /* 4 */
+ "ddd|FADEIN",
+ "vdj|IF_EQUAL",
+ "dj|IF_OBJECT_HERE",
+ "dj|IF_OBJECT_NOT_HERE",
+ /* 8 */
+ "ddj|IF_OBJECT_IS_AT",
+ "ddj|IF_OBJECT_STATE_IS",
+ "dddd|DRAW",
+ "d|ON_STOP",
+ /* 12 */
+ "w|DELAY",
+ "d|SET_SPRITE_OFFSET_X",
+ "d|SET_SPRITE_OFFSET_Y",
+ "d|SYNC",
+ /* 16 */
+ "d|WAIT_SYNC",
+ "d|WAIT_END",
+ "i|JUMP_REL",
+ "|CHAIN_TO",
+ /* 20 */
+ "dd|SET_REPEAT",
+ "i|END_REPEAT",
+ "d|SET_PALETTE",
+ "d|SET_PRIORITY",
+ /* 24 */
+ "wiid|SET_SPRITE_XY",
+ "x|HALT_SPRITE",
+ "ddddd|SET_WINDOW",
+ "|RESET",
+ /* 28 */
+ "dddd|PLAY_SOUND",
+ "|STOP_ALL_SOUNDS",
+ "d|SET_FRAME_RATE",
+ "d|SET_WINDOW",
+ /* 32 */
+ "|SAVE_SCREEN",
+ "|MOUSE_ON",
+ "|MOUSE_OFF",
+ "dd|CLEAR_WINDOW",
+ /* 36 */
+ "dd|SET_WINDOW_IMAGE",
+ "dd|POKE_PALETTE",
+ "vj|IF_VAR_NOT_ZERO",
+ "vd|SET_VAR",
+ /* 40 */
+ "vd|ADD_VAR",
+ "vd|SUB_VAR",
+ "vd|DELAY_IF_NOT_EQ",
+ "dj|IF_BIT_SET",
+ /* 44 */
+ "dj|IF_BIT_CLEAR",
+ "dd|SET_WINDOW_PALETTE",
+ "d|SET_PALETTE_SLOT1",
+ "d|SET_PALETTE_SLOT2",
+ /* 48 */
+ "d|SET_PALETTE_SLOT3",
+ "d|SET_BIT",
+ "d|CLEAR_BIT",
+ "d|ENABLE_BOX",
+ /* 52 */
+ "d|PLAY_EFFECT",
+ "dd|DISSOLVE_IN",
+ "ddd|DISSOLVE_OUT",
+ "ddd|MOVE_BOX",
+ /* 56 */
+ "|FULL_SCREEN",
+ "|BLACK_PALETTE",
+ "|CHECK_CODE_WHEEL",
+ "j|IF_EGA",
+ /* 60 */
+ "d|STOP_ANIMATE",
+ "d|INTRO",
+ "|FASTFADEOUT",
+ "|FASTFADEIN",
+};
+
const char *const simon1_videoOpcodeNameTable[] = {
/* 0 */
"x|RET",
"ddd|FADEOUT",
- "d|CALL",
+ "w|CALL",
"ddddd|NEW_SPRITE",
/* 4 */
"ddd|FADEIN",
@@ -2568,7 +2651,7 @@ const char *const simon1_videoOpcodeNameTable[] = {
"ddddd|DRAW",
"|CLEAR_PATHFIND_ARRAY",
/* 12 */
- "d|DELAY",
+ "w|DELAY",
"d|SET_SPRITE_OFFSET_X",
"d|SET_SPRITE_OFFSET_Y",
"d|SYNC",
@@ -2583,7 +2666,7 @@ const char *const simon1_videoOpcodeNameTable[] = {
"dd|SET_PALETTE",
"d|SET_PRIORITY",
/* 24 */
- "diid|SET_SPRITE_XY",
+ "wiid|SET_SPRITE_XY",
"x|HALT_SPRITE",
"ddddd|SET_WINDOW",
"|RESET",
@@ -2629,7 +2712,7 @@ const char *const simon1_videoOpcodeNameTable[] = {
"j|IF_SPEECH",
/* 60 */
"d|STOP_ANIMATE",
- "ddd|MASK",
+ "wdd|MASK",
"|FASTFADEOUT",
"|FASTFADEIN",
};
@@ -2638,7 +2721,7 @@ const char *const simon2_videoOpcodeNameTable[] = {
/* 0 */
"x|RET",
"ddd|FADEOUT",
- "d|CALL",
+ "w|CALL",
"dddddd|NEW_SPRITE",
/* 4 */
"ddd|FADEIN",
@@ -2666,7 +2749,7 @@ const char *const simon2_videoOpcodeNameTable[] = {
"dd|SET_PALETTE",
"d|SET_PRIORITY",
/* 24 */
- "diib|SET_SPRITE_XY",
+ "wiib|SET_SPRITE_XY",
"x|HALT_SPRITE",
"ddddd|SET_WINDOW",
"|RESET",
@@ -2706,13 +2789,13 @@ const char *const simon2_videoOpcodeNameTable[] = {
"ddd|DUMMY_54",
"ddd|MOVE_BOX",
/* 56 */
- "i|WAIT_BIG",
+ "w|WAIT_BIG",
"|BLACK_PALETTE",
"ddd|SET_PRIORITIES",
"ddd|STOP_ANIMATIONS",
/* 60 */
"dd|STOP_ANIMATE",
- "ddd|MASK",
+ "wdd|MASK",
"|FASTFADEOUT",
"|FASTFADEIN",
/* 64 */
@@ -2735,7 +2818,7 @@ const char *const feeblefiles_videoOpcodeNameTable[] = {
/* 0 */
"x|RET",
"ddd|FADEOUT",
- "d|CALL",
+ "w|CALL",
"dddddd|NEW_SPRITE",
/* 4 */
"ddd|FADEIN",
@@ -2763,7 +2846,7 @@ const char *const feeblefiles_videoOpcodeNameTable[] = {
"dd|SET_PALETTE",
"d|SET_PRIORITY",
/* 24 */
- "diib|SET_SPRITE_XY",
+ "wiib|SET_SPRITE_XY",
"x|HALT_SPRITE",
"ddddd|SET_WINDOW",
"|RESET",
@@ -2803,7 +2886,116 @@ const char *const feeblefiles_videoOpcodeNameTable[] = {
"ddd|DUMMY_54",
"ddd|MOVE_BOX",
/* 56 */
- "i|WAIT_BIG",
+ "w|WAIT_BIG",
+ "|BLACK_PALETTE",
+ "ddd|SET_PRIORITIES",
+ "ddd|STOP_ANIMATIONS",
+ /* 60 */
+ "dd|STOP_ANIMATE",
+ "wdd|MASK",
+ "|FASTFADEOUT",
+ "|FASTFADEIN",
+ /* 64 */
+ "j|IF_SPEECH",
+ "|SLOW_FADE_IN",
+ "ddj|IF_VAR_EQUAL",
+ "ddj|IF_VAR_LE",
+ /* 68 */
+ "ddj|IF_VAR_GE",
+ "dd|PLAY_SEQ",
+ "dd|JOIN_SEQ",
+ "|IF_SEQ_WAITING",
+ /* 72 */
+ "dd|SEQUE",
+ "bb|SET_MARK",
+ "bb|CLEAR_MARK",
+ "dd|SETSCALE",
+ /* 76 */
+ "ddd|SETSCALEXOFFS",
+ "ddd|SETSCALEYOFFS",
+ "|COMPUTEXY",
+ "|COMPUTEPOSNUM",
+ /* 80 */
+ "wdd|SETOVERLAYIMAGE",
+ "dd|SETRANDOM",
+ "d|GETPATHVALUE",
+ "ddd|PLAYSOUNDLOOP",
+ "|STOPSOUNDLOOP",
+};
+
+const char *const puzzlepack_videoOpcodeNameTable[] = {
+ /* 0 */
+ "x|RET",
+ "ddd|FADEOUT",
+ "w|CALL",
+ "dddddd|NEW_SPRITE",
+ /* 4 */
+ "ddd|FADEIN",
+ "wdj|IF_EQUAL",
+ "dj|IF_OBJECT_HERE",
+ "dj|IF_OBJECT_NOT_HERE",
+ /* 8 */
+ "ddj|IF_OBJECT_IS_AT",
+ "ddj|IF_OBJECT_STATE_IS",
+ "ddddb|DRAW",
+ "|CLEAR_PATHFIND_ARRAY",
+ /* 12 */
+ "b|DELAY",
+ "d|SET_SPRITE_OFFSET_X",
+ "d|SET_SPRITE_OFFSET_Y",
+ "d|SYNC",
+ /* 16 */
+ "d|WAIT_SYNC",
+ "dq|SET_PATHFIND_ITEM",
+ "i|JUMP_REL",
+ "|CHAIN_TO",
+ /* 20 */
+ "dd|SET_REPEAT",
+ "i|END_REPEAT",
+ "dd|SET_PALETTE",
+ "d|SET_PRIORITY",
+ /* 24 */
+ "wiib|SET_SPRITE_XY",
+ "x|HALT_SPRITE",
+ "ddddd|SET_WINDOW",
+ "|RESET",
+ /* 28 */
+ "dddd|PLAY_SOUND",
+ "|STOP_ALL_SOUNDS",
+ "d|SET_FRAME_RATE",
+ "d|SET_WINDOW",
+ /* 32 */
+ "vv|COPY_VAR",
+ "|MOUSE_ON",
+ "|MOUSE_OFF",
+ "dd|CLEAR_WINDOW",
+ /* 36 */
+ "dd|SET_WINDOW_IMAGE",
+ "v|SET_SPRITE_OFFSET_Y",
+ "wj|IF_VAR_NOT_ZERO",
+ "wd|SET_VAR",
+ /* 40 */
+ "vd|ADD_VAR",
+ "vd|SUB_VAR",
+ "vd|DELAY_IF_NOT_EQ",
+ "dj|IF_BIT_SET",
+ /* 44 */
+ "dj|IF_BIT_CLEAR",
+ "v|SET_SPRITE_X",
+ "v|SET_SPRITE_Y",
+ "vv|ADD_VAR_F",
+ /* 48 */
+ "|COMPUTE_YOFS",
+ "d|SET_BIT",
+ "d|CLEAR_BIT",
+ "d|ENABLE_BOX",
+ /* 52 */
+ "ddd|PLAY_EFFECT",
+ "ddd|PAN_SFX",
+ "ddd|DUMMY_54",
+ "ddd|MOVE_BOX",
+ /* 56 */
+ "w|WAIT_BIG",
"|BLACK_PALETTE",
"ddd|SET_PRIORITIES",
"ddd|STOP_ANIMATIONS",
@@ -2833,7 +3025,7 @@ const char *const feeblefiles_videoOpcodeNameTable[] = {
"|COMPUTEXY",
"|COMPUTEPOSNUM",
/* 80 */
- "ddd|SETOVERLAYIMAGE",
+ "wdd|SETOVERLAYIMAGE",
"dd|SETRANDOM",
"d|GETPATHVALUE",
"ddd|PLAYSOUNDLOOP",
diff --git a/engines/agos/debugger.cpp b/engines/agos/debugger.cpp
index fc24c6d363..7ad742c928 100644
--- a/engines/agos/debugger.cpp
+++ b/engines/agos/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
* 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.
@@ -32,42 +32,19 @@ Debugger::Debugger(AGOSEngine *vm)
: GUI::Debugger() {
_vm = vm;
- DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
- DCmd_Register("level", WRAP_METHOD(Debugger, Cmd_DebugLevel));
- DCmd_Register("music", WRAP_METHOD(Debugger, Cmd_PlayMusic));
- DCmd_Register("sound", WRAP_METHOD(Debugger, Cmd_PlaySound));
- DCmd_Register("voice", WRAP_METHOD(Debugger, Cmd_PlayVoice));
- DCmd_Register("bit", WRAP_METHOD(Debugger, Cmd_SetBit));
- DCmd_Register("bit2", WRAP_METHOD(Debugger, Cmd_SetBit2));
- DCmd_Register("bit3", WRAP_METHOD(Debugger, Cmd_SetBit3));
- DCmd_Register("var", WRAP_METHOD(Debugger, Cmd_SetVar));
- DCmd_Register("obj", WRAP_METHOD(Debugger, Cmd_SetObjectFlag));
- DCmd_Register("sub", WRAP_METHOD(Debugger, Cmd_StartSubroutine));
- DCmd_Register("dumpimage", WRAP_METHOD(Debugger, Cmd_dumpImage));
- DCmd_Register("dumpscript", WRAP_METHOD(Debugger, Cmd_dumpScript));
-
-}
-
-
-bool Debugger::Cmd_DebugLevel(int argc, const char **argv) {
- if (argc == 1) {
- if (_vm->_debugMode == false)
- DebugPrintf("Debugging is not enabled at this time\n");
- else
- DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel);
- } else { // set level
- gDebugLevel = atoi(argv[1]);
- if (0 <= gDebugLevel && gDebugLevel < 11) {
- _vm->_debugMode = true;
- DebugPrintf("Debug level set to level %d\n", gDebugLevel);
- } else if (gDebugLevel < 0) {
- _vm->_debugMode = false;
- DebugPrintf("Debugging is now disabled\n");
- } else
- DebugPrintf("Not a valid debug level (0 - 10)\n");
- }
+ registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
+ registerCmd("music", WRAP_METHOD(Debugger, Cmd_PlayMusic));
+ registerCmd("sound", WRAP_METHOD(Debugger, Cmd_PlaySound));
+ registerCmd("voice", WRAP_METHOD(Debugger, Cmd_PlayVoice));
+ registerCmd("bit", WRAP_METHOD(Debugger, Cmd_SetBit));
+ registerCmd("bit2", WRAP_METHOD(Debugger, Cmd_SetBit2));
+ registerCmd("bit3", WRAP_METHOD(Debugger, Cmd_SetBit3));
+ registerCmd("var", WRAP_METHOD(Debugger, Cmd_SetVar));
+ registerCmd("obj", WRAP_METHOD(Debugger, Cmd_SetObjectFlag));
+ registerCmd("sub", WRAP_METHOD(Debugger, Cmd_StartSubroutine));
+ registerCmd("dumpimage", WRAP_METHOD(Debugger, Cmd_dumpImage));
+ registerCmd("dumpscript", WRAP_METHOD(Debugger, Cmd_dumpScript));
- return true;
}
bool Debugger::Cmd_PlayMusic(int argc, const char **argv) {
@@ -83,9 +60,9 @@ bool Debugger::Cmd_PlayMusic(int argc, const char **argv) {
_vm->playMusic(music, 0);
}
} else
- DebugPrintf("Music out of range (0 - %d)\n", _vm->_numMusic);
+ debugPrintf("Music out of range (0 - %d)\n", _vm->_numMusic);
} else
- DebugPrintf("Syntax: music <musicnum>\n");
+ debugPrintf("Syntax: music <musicnum>\n");
return true;
}
@@ -96,9 +73,9 @@ bool Debugger::Cmd_PlaySound(int argc, const char **argv) {
if (sound <= _vm->_numSFX)
_vm->_sound->playEffects(sound);
else
- DebugPrintf("Sound out of range (0 - %d)\n", _vm->_numSFX);
+ debugPrintf("Sound out of range (0 - %d)\n", _vm->_numSFX);
} else
- DebugPrintf("Syntax: sound <soundnum>\n");
+ debugPrintf("Syntax: sound <soundnum>\n");
return true;
}
@@ -109,9 +86,9 @@ bool Debugger::Cmd_PlayVoice(int argc, const char **argv) {
if (voice <= _vm->_numSpeech)
_vm->_sound->playVoice(voice);
else
- DebugPrintf("Voice out of range (0 - %d)\n", _vm->_numSpeech);
+ debugPrintf("Voice out of range (0 - %d)\n", _vm->_numSpeech);
} else
- DebugPrintf("Syntax: voice <voicenum>\n");
+ debugPrintf("Syntax: voice <voicenum>\n");
return true;
}
@@ -123,15 +100,15 @@ bool Debugger::Cmd_SetBit(int argc, const char **argv) {
value = atoi(argv[2]);
if (value <= 1) {
_vm->setBitFlag(bit, value != 0);
- DebugPrintf("Set bit %d to %d\n", bit, value);
+ debugPrintf("Set bit %d to %d\n", bit, value);
} else
- DebugPrintf("Bit value out of range (0 - 1)\n");
+ debugPrintf("Bit value out of range (0 - 1)\n");
} else if (argc > 1) {
bit = atoi(argv[1]);
value = _vm->getBitFlag(bit);
- DebugPrintf("Bit %d is %d\n", bit, value);
+ debugPrintf("Bit %d is %d\n", bit, value);
} else
- DebugPrintf("Syntax: bit <bitnum> <value>\n");
+ debugPrintf("Syntax: bit <bitnum> <value>\n");
return true;
}
@@ -143,18 +120,18 @@ bool Debugger::Cmd_SetBit2(int argc, const char **argv) {
value = atoi(argv[2]);
if (value == 0) {
_vm->_bitArrayTwo[bit / 16] &= ~(1 << (bit & 15));
- DebugPrintf("Set bit2 %d to %d\n", bit, value);
+ debugPrintf("Set bit2 %d to %d\n", bit, value);
} else if (value == 1) {
_vm->_bitArrayTwo[bit / 16] |= (1 << (bit & 15));
- DebugPrintf("Set bit2 %d to %d\n", bit, value);
+ debugPrintf("Set bit2 %d to %d\n", bit, value);
} else
- DebugPrintf("Bit2 value out of range (0 - 1)\n");
+ debugPrintf("Bit2 value out of range (0 - 1)\n");
} else if (argc > 1) {
bit = atoi(argv[1]);
value = (_vm->_bitArrayTwo[bit / 16] & (1 << (bit & 15))) != 0;
- DebugPrintf("Bit2 %d is %d\n", bit, value);
+ debugPrintf("Bit2 %d is %d\n", bit, value);
} else
- DebugPrintf("Syntax: bit2 <bitnum> <value>\n");
+ debugPrintf("Syntax: bit2 <bitnum> <value>\n");
return true;
}
@@ -166,18 +143,18 @@ bool Debugger::Cmd_SetBit3(int argc, const char **argv) {
value = atoi(argv[2]);
if (value == 0) {
_vm->_bitArrayThree[bit / 16] &= ~(1 << (bit & 15));
- DebugPrintf("Set bit3 %d to %d\n", bit, value);
+ debugPrintf("Set bit3 %d to %d\n", bit, value);
} else if (value == 1) {
_vm->_bitArrayThree[bit / 16] |= (1 << (bit & 15));
- DebugPrintf("Set bit3 %d to %d\n", bit, value);
+ debugPrintf("Set bit3 %d to %d\n", bit, value);
} else
- DebugPrintf("Bit3 value out of range (0 - 1)\n");
+ debugPrintf("Bit3 value out of range (0 - 1)\n");
} else if (argc > 1) {
bit = atoi(argv[1]);
value = (_vm->_bitArrayThree[bit / 16] & (1 << (bit & 15))) != 0;
- DebugPrintf("Bit3 %d is %d\n", bit, value);
+ debugPrintf("Bit3 %d is %d\n", bit, value);
} else
- DebugPrintf("Syntax: bit3 <bitnum> <value>\n");
+ debugPrintf("Syntax: bit3 <bitnum> <value>\n");
return true;
}
@@ -190,15 +167,15 @@ bool Debugger::Cmd_SetVar(int argc, const char **argv) {
if (argc > 2) {
value = atoi(argv[2]);
_vm->writeVariable(var, value);
- DebugPrintf("Set var %d to %d\n", var, value);
+ debugPrintf("Set var %d to %d\n", var, value);
} else {
value = _vm->readVariable(var);
- DebugPrintf("Var %d is %d\n", var, value);
+ debugPrintf("Var %d is %d\n", var, value);
}
} else
- DebugPrintf("Var out of range (0 - %d)\n", _vm->_numVars - 1);
+ debugPrintf("Var out of range (0 - %d)\n", _vm->_numVars - 1);
} else
- DebugPrintf("Syntax: var <varnum> <value>\n");
+ debugPrintf("Syntax: var <varnum> <value>\n");
return true;
}
@@ -217,22 +194,22 @@ bool Debugger::Cmd_SetObjectFlag(int argc, const char **argv) {
if (argc > 3) {
value = atoi(argv[3]);
o->objectFlagValue[offs] = value;
- DebugPrintf("Object %d Flag %d set to %d\n", obj, prop, value);
+ debugPrintf("Object %d Flag %d set to %d\n", obj, prop, value);
} else {
value = o->objectFlagValue[offs];
- DebugPrintf("Object %d Flag %d is %d\n", obj, prop, value);
+ debugPrintf("Object %d Flag %d is %d\n", obj, prop, value);
}
} else {
- DebugPrintf("Object flag out of range\n");
+ debugPrintf("Object flag out of range\n");
}
} else {
- DebugPrintf("Item isn't an object\n");
+ debugPrintf("Item isn't an object\n");
}
} else {
- DebugPrintf("Item out of range (1 - %d)\n", _vm->_itemArraySize - 1);
+ debugPrintf("Item out of range (1 - %d)\n", _vm->_itemArraySize - 1);
}
} else {
- DebugPrintf("Syntax: obj <itemnum> <flag> <value>\n");
+ debugPrintf("Syntax: obj <itemnum> <flag> <value>\n");
}
return true;
@@ -246,7 +223,7 @@ bool Debugger::Cmd_StartSubroutine(int argc, const char **argv) {
if (sub != NULL)
_vm->startSubroutine(sub);
} else
- DebugPrintf("Subroutine %d\n", _vm->_currentTable->id);
+ debugPrintf("Subroutine %d\n", _vm->_currentTable->id);
return true;
}
@@ -259,11 +236,11 @@ bool Debugger::Cmd_dumpImage(int argc, const char **argv) {
if (vpe->vgaFile2 != NULL) {
_vm->dumpVgaBitmaps(zoneNum);
} else {
- DebugPrintf("Invalid Zone Number %d\n", zoneNum);
+ debugPrintf("Invalid Zone Number %d\n", zoneNum);
}
} else
- DebugPrintf("Syntax: dumpimage <zonenum>\n");
+ debugPrintf("Syntax: dumpimage <zonenum>\n");
return true;
}
@@ -276,11 +253,11 @@ bool Debugger::Cmd_dumpScript(int argc, const char **argv) {
if (vpe->vgaFile1 != NULL) {
_vm->dumpVgaFile(vpe->vgaFile1);
} else {
- DebugPrintf("Invalid Zone Number %d\n", zoneNum);
+ debugPrintf("Invalid Zone Number %d\n", zoneNum);
}
} else
- DebugPrintf("Syntax: dumpscript <zonenum>\n");
+ debugPrintf("Syntax: dumpscript <zonenum>\n");
return true;
}
diff --git a/engines/agos/debugger.h b/engines/agos/debugger.h
index 0ab992ebbe..026194410f 100644
--- a/engines/agos/debugger.h
+++ b/engines/agos/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
* 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.
@@ -37,7 +37,6 @@ public:
private:
AGOSEngine *_vm;
- bool Cmd_DebugLevel(int argc, const char **argv);
bool Cmd_PlayMusic(int argc, const char **argv);
bool Cmd_PlaySound(int argc, const char **argv);
bool Cmd_PlayVoice(int argc, const char **argv);
diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp
index a5a42a86ad..72a38a3645 100644
--- a/engines/agos/detection.cpp
+++ b/engines/agos/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.
@@ -28,6 +28,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "common/installshield_cab.h"
#include "agos/intern.h"
#include "agos/agos.h"
@@ -269,8 +270,12 @@ void AGOSEngine::loadArchives() {
if (getFeatures() & GF_PACKED) {
for (ag = _gameDescription->desc.filesDescriptions; ag->fileName; ag++) {
- if (!_archives.hasArchive(ag->fileName))
- _archives.registerArchive(ag->fileName, ag->fileType);
+ if (!SearchMan.hasArchive(ag->fileName)) {
+ Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(ag->fileName);
+
+ if (stream)
+ SearchMan.add(ag->fileName, Common::makeInstallShieldArchive(stream, DisposeAfterUse::YES), ag->fileType);
+ }
}
}
}
diff --git a/engines/agos/detection_tables.h b/engines/agos/detection_tables.h
index 70757865f5..77fc88c6bb 100644
--- a/engines/agos/detection_tables.h
+++ b/engines/agos/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.
@@ -1091,6 +1091,30 @@ static const AGOSGameDescription gameDescriptions[] = {
GF_32COLOR | GF_CRUNCHED | GF_CRUNCHED_GAMEPC | GF_OLD_BUNDLE | GF_PLANAR
},
+ // Simon the Sorcerer 1 - German Amiga OCS Floppy
+ {
+ {
+ "simon1",
+ "OCS Floppy",
+
+ {
+ { "gameamiga", GAME_BASEFILE, "634c82b7a0b760214fd71add328c7a00", 39493},
+ { "icon.pkd", GAME_ICONFILE, "565ef7a98dcc21ef526a2bb10b6f42ed", 18979},
+ { "stripped.txt", GAME_STRFILE, "f5fc67db3b8c5283cda51c43b98a74f8", 243},
+ { "tbllist", GAME_TBLFILE, "f9d5bf2ce09f82289c791c3ca26e1e4b", 696},
+ { NULL, 0, NULL, 0}
+ },
+ Common::DE_DEU,
+ Common::kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
+ },
+
+ GType_SIMON1,
+ GID_SIMON1,
+ GF_32COLOR | GF_CRUNCHED | GF_OLD_BUNDLE | GF_PLANAR
+ },
+
// Simon the Sorcerer 1 - English Amiga AGA Floppy
{
{
@@ -2598,7 +2622,7 @@ static const AGOSGameDescription gameDescriptions[] = {
GType_FF,
GID_FEEBLEFILES,
- GF_OLD_BUNDLE | GF_TALKIE | GF_PACKED
+ GF_OLD_BUNDLE | GF_TALKIE | GF_PACKED | GF_BROKEN_FF_RATING
},
// The Feeble Files - English Windows 4CD
@@ -2621,7 +2645,7 @@ static const AGOSGameDescription gameDescriptions[] = {
GType_FF,
GID_FEEBLEFILES,
- GF_OLD_BUNDLE | GF_TALKIE
+ GF_OLD_BUNDLE | GF_TALKIE | GF_BROKEN_FF_RATING
},
// The Feeble Files - French Windows 4CD
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index d27aed29db..4ba9446eb2 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.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/agos/event.cpp b/engines/agos/event.cpp
index 65c7f7fd77..95bcc68234 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.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.
@@ -468,6 +468,14 @@ void AGOSEngine::delay(uint amount) {
sprintf(_saveLoadName, "Quick %d", _saveLoadSlot);
_saveLoadType = (event.kbd.hasFlags(Common::KBD_ALT)) ? 1 : 2;
quickLoadOrSave();
+ } else if (event.kbd.hasFlags(Common::KBD_ALT)) {
+ if (event.kbd.keycode == Common::KEYCODE_u) {
+ dumpAllSubroutines();
+ } else if (event.kbd.keycode == Common::KEYCODE_i) {
+ dumpAllVgaImageFiles();
+ } else if (event.kbd.keycode == Common::KEYCODE_v) {
+ dumpAllVgaScriptFiles();
+ }
} else if (event.kbd.hasFlags(Common::KBD_CTRL)) {
if (event.kbd.keycode == Common::KEYCODE_a) {
GUI::Dialog *_aboutDialog;
@@ -477,10 +485,6 @@ void AGOSEngine::delay(uint amount) {
_fastMode = !_fastMode;
} else if (event.kbd.keycode == Common::KEYCODE_d) {
_debugger->attach();
- } else if (event.kbd.keycode == Common::KEYCODE_s) {
- dumpAllSubroutines();
- } else if (event.kbd.keycode == Common::KEYCODE_i) {
- dumpAllVgaImageFiles();
}
}
@@ -520,6 +524,12 @@ void AGOSEngine::delay(uint amount) {
case Common::EVENT_RTL:
case Common::EVENT_QUIT:
return;
+ case Common::EVENT_WHEELUP:
+ handleMouseWheelUp();
+ break;
+ case Common::EVENT_WHEELDOWN:
+ handleMouseWheelDown();
+ break;
default:
break;
}
diff --git a/engines/agos/feeble.cpp b/engines/agos/feeble.cpp
index a96caa9f8b..bfd11fa8ea 100644
--- a/engines/agos/feeble.cpp
+++ b/engines/agos/feeble.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/agos/gfx.cpp b/engines/agos/gfx.cpp
index 266fcc9796..33145b7d0d 100644
--- a/engines/agos/gfx.cpp
+++ b/engines/agos/gfx.cpp
@@ -8,18 +8,19 @@
* 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 "common/debug-channels.h"
#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -1129,7 +1130,7 @@ void AGOSEngine::animate(uint16 windowNum, uint16 zoneNum, uint16 vgaSpriteId, i
assert(READ_BE_UINT16(&((AnimationHeader_WW *) p)->id) == vgaSpriteId);
}
- if (_dumpVgaScripts) {
+ if (DebugMan.isDebugChannelEnabled(kDebugVGAScript)) {
if (getGameType() == GType_FF || getGameType() == GType_PP) {
dumpVgaScript(_curVgaFile1 + READ_LE_UINT16(&((AnimationHeader_Feeble*)p)->scriptOffs), zoneNum, vgaSpriteId);
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
@@ -1235,7 +1236,7 @@ void AGOSEngine::setImage(uint16 vgaSpriteId, bool vgaScript) {
}
}
- if (_dumpVgaScripts) {
+ if (DebugMan.isDebugChannelEnabled(kDebugVGAScript)) {
if (getGameType() == GType_FF || getGameType() == GType_PP) {
dumpVgaScript(_curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble*)b)->scriptOffs), zoneNum, vgaSpriteId);
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index 6d4192da2a..2db2a52cbc 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.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.
@@ -1089,15 +1089,15 @@ bool AGOSEngine_PN::ifObjectInInv(uint16 a) {
}
bool AGOSEngine_PN::testContainer(uint16 a) {
- return bitextract(_quickptr[1] + a * _quickshort[1], 0) != 0;
+ return bitextract(_quickptr[1] + a * _quickshort[1], 0) != 0;
}
bool AGOSEngine_PN::testObvious(uint16 a) {
- return bitextract(_quickptr[1] + a * _quickshort[1], 4) != 0;
+ return bitextract(_quickptr[1] + a * _quickshort[1], 4) != 0;
}
bool AGOSEngine_PN::testSeen(uint16 a) {
- return bitextract(_quickptr[1] + a * _quickshort[1], 3) != 0;
+ return bitextract(_quickptr[1] + a * _quickshort[1], 3) != 0;
}
void AGOSEngine_PN::printIcon(HitArea *ha, uint8 i, uint8 r) {
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp
index 24e5339420..8a4e87017a 100644
--- a/engines/agos/input.cpp
+++ b/engines/agos/input.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.
@@ -416,6 +416,115 @@ void AGOSEngine::hitarea_stuff_helper_2() {
_runScriptReturn1 = false;
}
+#ifdef ENABLE_AGOS2
+void AGOSEngine_Feeble::handleMouseWheelUp() {
+ if (getGameType() == GType_PP || !(getBitFlag(99)))
+ return;
+
+ if (_mouse.x >= 128 && _mouse.x <= 515 && _mouse.y >= 102 && _mouse.y <= 206) {
+ oracleTextDown();
+ } else if (_mouse.x >= 172 && _mouse.x <= 469 && _mouse.y >= 287 && _mouse.y <= 382) {
+ HitArea *ha = findBox(0x7FFB);
+ if (ha != NULL && (ha->flags & kBFBoxInUse)) {
+ if (!isSpriteLoaded(21, 9) && !isSpriteLoaded(23, 9))
+ inventoryUp(ha->window);
+ }
+ }
+}
+
+void AGOSEngine_Feeble::handleMouseWheelDown() {
+ if (getGameType() == GType_PP || !(getBitFlag(99)))
+ return;
+
+ if (_mouse.x >= 128 && _mouse.x <= 515 && _mouse.y >= 102 && _mouse.y <= 206) {
+ oracleTextUp();
+ } else if (_mouse.x >= 172 && _mouse.x <= 469 && _mouse.y >= 287 && _mouse.y <= 382) {
+ HitArea *ha = findBox(0x7FFC);
+ if (ha != NULL && (ha->flags & kBFBoxInUse)) {
+ if (!isSpriteLoaded(21, 9) && !isSpriteLoaded(23, 9))
+ inventoryDown(ha->window);
+ }
+ }
+}
+#endif
+
+void AGOSEngine_Simon1::handleMouseWheelUp() {
+ HitArea *ha = findBox(206);
+ if (ha != NULL && (ha->flags & kBFBoxInUse) && !(ha->flags & kBFBoxDead)) {
+ if (_saveLoadRowCurPos != 1) {
+ if (_saveLoadRowCurPos < 7)
+ _saveLoadRowCurPos = 1;
+ else
+ _saveLoadRowCurPos -= 1;
+
+ _saveLoadEdit = false;
+ listSaveGames();
+ }
+ } else {
+ AGOSEngine::handleMouseWheelUp();
+ }
+}
+
+void AGOSEngine_Simon1::handleMouseWheelDown() {
+ HitArea *ha = findBox(207);
+ if (ha != NULL && (ha->flags & kBFBoxInUse) && !(ha->flags & kBFBoxDead)) {
+ if (_saveDialogFlag) {
+ _saveLoadRowCurPos += 1;
+ if (_saveLoadRowCurPos >= _numSaveGameRows)
+ _saveLoadRowCurPos = _numSaveGameRows;
+
+ _saveLoadEdit = false;
+ listSaveGames();
+ }
+ } else {
+ AGOSEngine::handleMouseWheelDown();
+ }
+}
+
+void AGOSEngine_Elvira2::handleMouseWheelUp() {
+ HitArea *ha = findBox(224);
+ if (ha != NULL && (ha->flags & kBFBoxInUse)) {
+ _saveGameNameLen = 0;
+
+ if (_saveLoadRowCurPos < 3)
+ _saveLoadRowCurPos = 1;
+ else
+ _saveLoadRowCurPos -= 3;
+
+ listSaveGames();
+ } else {
+ AGOSEngine::handleMouseWheelUp();
+ }
+}
+
+void AGOSEngine_Elvira2::handleMouseWheelDown() {
+ HitArea *ha = findBox(224);
+ if (ha != NULL && (ha->flags & kBFBoxInUse)) {
+ _saveGameNameLen = 0;
+ _saveLoadRowCurPos += 3;
+ if (_saveLoadRowCurPos >= _numSaveGameRows)
+ _saveLoadRowCurPos = 1;
+
+ listSaveGames();
+ } else {
+ AGOSEngine::handleMouseWheelDown();
+ }
+}
+
+void AGOSEngine::handleMouseWheelUp() {
+ HitArea *ha = findBox(0x7FFB);
+ if (ha != NULL && (ha->flags & kBFBoxInUse)) {
+ inventoryUp(ha->window);
+ }
+}
+
+void AGOSEngine::handleMouseWheelDown() {
+ HitArea *ha = findBox(0x7FFC);
+ if (ha != NULL && (ha->flags & kBFBoxInUse)) {
+ inventoryDown(ha->window);
+ }
+}
+
void AGOSEngine::permitInput() {
if (_mortalFlag)
return;
diff --git a/engines/agos/input_pn.cpp b/engines/agos/input_pn.cpp
index b3a44f2b2f..a852ef320b 100644
--- a/engines/agos/input_pn.cpp
+++ b/engines/agos/input_pn.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/agos/intern.h b/engines/agos/intern.h
index 773b9c15bd..3f5c8c519b 100644
--- a/engines/agos/intern.h
+++ b/engines/agos/intern.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.
@@ -246,16 +246,17 @@ enum SubObjectFlags {
};
enum GameFeatures {
- GF_TALKIE = 1 << 0,
- GF_OLD_BUNDLE = 1 << 1,
- GF_CRUNCHED = 1 << 2,
- GF_CRUNCHED_GAMEPC = 1 << 3,
- GF_ZLIBCOMP = 1 << 4,
- GF_32COLOR = 1 << 5,
- GF_EGA = 1 << 6,
- GF_PLANAR = 1 << 7,
- GF_DEMO = 1 << 8,
- GF_PACKED = 1 << 9
+ GF_TALKIE = 1 << 0,
+ GF_OLD_BUNDLE = 1 << 1,
+ GF_CRUNCHED = 1 << 2,
+ GF_CRUNCHED_GAMEPC = 1 << 3,
+ GF_ZLIBCOMP = 1 << 4,
+ GF_32COLOR = 1 << 5,
+ GF_EGA = 1 << 6,
+ GF_PLANAR = 1 << 7,
+ GF_DEMO = 1 << 8,
+ GF_PACKED = 1 << 9,
+ GF_BROKEN_FF_RATING = 1 << 10
};
enum GameFileTypes {
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index 3bb5a132ef..86abe403b4 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.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/agos/menus.cpp b/engines/agos/menus.cpp
index 85c50e421b..77a37cb601 100644
--- a/engines/agos/menus.cpp
+++ b/engines/agos/menus.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/agos/midi.cpp b/engines/agos/midi.cpp
index b3ade91107..392ee08ea1 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.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.
@@ -235,6 +235,10 @@ void MidiPlayer::startTrack(int track) {
_music.parser = parser; // That plugs the power cord into the wall
} else if (_music.parser) {
if (!_music.parser->setTrack(track)) {
+ // The Roland MT32 music in Simon the Sorcerer 2
+ // is missing the extra tracks in many scenes,
+ // like the introduction sequence.
+ stop();
return;
}
_currentTrack = (byte)track;
diff --git a/engines/agos/midi.h b/engines/agos/midi.h
index 635e091906..3efadddc2f 100644
--- a/engines/agos/midi.h
+++ b/engines/agos/midi.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/agos/midiparser_s1d.cpp b/engines/agos/midiparser_s1d.cpp
index bef7199a98..c2c08bf451 100644
--- a/engines/agos/midiparser_s1d.cpp
+++ b/engines/agos/midiparser_s1d.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/agos/oracle.cpp b/engines/agos/oracle.cpp
index 025a833b77..122f800e78 100644
--- a/engines/agos/oracle.cpp
+++ b/engines/agos/oracle.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.
@@ -180,7 +180,7 @@ void AGOSEngine_Feeble::oracleTextUp() {
if (_textWindow->scrollY > _oracleMaxScrollY) // For scroll up
_oracleMaxScrollY = _textWindow->scrollY;
- while (1) {
+ while (!shouldQuit()) {
if (_textWindow->scrollY == _oracleMaxScrollY)
break;
_textWindow->textRow = 105;
@@ -214,7 +214,7 @@ void AGOSEngine_Feeble::oracleTextDown() {
if (_textWindow->scrollY > _oracleMaxScrollY) // For scroll up
_oracleMaxScrollY = _textWindow->scrollY;
- while (1) {
+ while (!shouldQuit()) {
if (_textWindow->scrollY == 0)
break;
diff --git a/engines/agos/pn.cpp b/engines/agos/pn.cpp
index 667a5c3fc8..d94f180b00 100644
--- a/engines/agos/pn.cpp
+++ b/engines/agos/pn.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/agos/res.cpp b/engines/agos/res.cpp
index cf1d062d96..2631f7998e 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.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,7 +24,6 @@
#include "common/archive.h"
-#include "common/installshield_cab.h"
#include "common/file.h"
#include "common/memstream.h"
#include "common/textconsole.h"
@@ -38,52 +37,6 @@
namespace AGOS {
-ArchiveMan::ArchiveMan() {
- _fallBack = true;
-}
-
-#ifdef ENABLE_AGOS2
-void ArchiveMan::registerArchive(const Common::String &filename, int priority) {
- Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(filename);
-
- if (stream)
- add(filename, makeInstallShieldArchive(stream, DisposeAfterUse::YES), priority);
-}
-#endif
-
-bool ArchiveMan::hasFile(const Common::String &name) const {
- if (_fallBack && SearchMan.hasFile(name))
- return true;
-
- return Common::SearchSet::hasFile(name);
-}
-
-int ArchiveMan::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const {
- const int matches = _fallBack ? SearchMan.listMatchingMembers(list, pattern) : 0;
- return matches + Common::SearchSet::listMatchingMembers(list, pattern);
-}
-
-int ArchiveMan::listMembers(Common::ArchiveMemberList &list) const {
- const int matches = _fallBack ? SearchMan.listMembers(list) : 0;
- return matches + Common::SearchSet::listMembers(list);
-}
-
-const Common::ArchiveMemberPtr ArchiveMan::getMember(const Common::String &name) const {
- Common::ArchiveMemberPtr ptr = _fallBack ? SearchMan.getMember(name) : Common::ArchiveMemberPtr();
- if (ptr)
- return ptr;
-
- return Common::SearchSet::getMember(name);
-}
-
-Common::SeekableReadStream *ArchiveMan::createReadStreamForMember(const Common::String &filename) const {
- if (_fallBack && SearchMan.hasFile(filename)) {
- return SearchMan.createReadStreamForMember(filename);
- }
-
- return Common::SearchSet::createReadStreamForMember(filename);
-}
-
#ifdef ENABLE_AGOS2
uint16 AGOSEngine_Feeble::to16Wrapper(uint value) {
return TO_LE_16(value);
@@ -198,39 +151,35 @@ int AGOSEngine::allocGamePcVars(Common::SeekableReadStream *in) {
}
void AGOSEngine_PN::loadGamePcFile() {
- Common::SeekableReadStream *in;
-
if (getFileName(GAME_BASEFILE) != NULL) {
+ Common::File in;
// Read dataBase
- in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE));
- if (!in) {
+ if (!in.open(getFileName(GAME_BASEFILE))) {
error("loadGamePcFile: Can't load database file '%s'", getFileName(GAME_BASEFILE));
}
- _dataBaseSize = in->size();
+ _dataBaseSize = in.size();
_dataBase = (byte *)malloc(_dataBaseSize);
if (_dataBase == NULL)
error("loadGamePcFile: Out of memory for dataBase");
- in->read(_dataBase, _dataBaseSize);
- delete in;
+ in.read(_dataBase, _dataBaseSize);
if (_dataBase[31] != 0)
error("Later version of system requested");
}
if (getFileName(GAME_TEXTFILE) != NULL) {
+ Common::File in;
// Read textBase
- in = _archives.createReadStreamForMember(getFileName(GAME_TEXTFILE));
- if (!in) {
+ if (!in.open(getFileName(GAME_TEXTFILE))) {
error("loadGamePcFile: Can't load textbase file '%s'", getFileName(GAME_TEXTFILE));
}
- _textBaseSize = in->size();
+ _textBaseSize = in.size();
_textBase = (byte *)malloc(_textBaseSize);
if (_textBase == NULL)
error("loadGamePcFile: Out of memory for textBase");
- in->read(_textBase, _textBaseSize);
- delete in;
+ in.read(_textBase, _textBaseSize);
if (_textBase[getlong(30L)] != 128)
error("Unknown compression format");
@@ -238,20 +187,19 @@ void AGOSEngine_PN::loadGamePcFile() {
}
void AGOSEngine::loadGamePcFile() {
- Common::SeekableReadStream *in;
int fileSize;
if (getFileName(GAME_BASEFILE) != NULL) {
/* Read main gamexx file */
- in = _archives.createReadStreamForMember(getFileName(GAME_BASEFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_BASEFILE))) {
error("loadGamePcFile: Can't load gamexx file '%s'", getFileName(GAME_BASEFILE));
}
if (getFeatures() & GF_CRUNCHED_GAMEPC) {
- uint srcSize = in->size();
+ uint srcSize = in.size();
byte *srcBuf = (byte *)malloc(srcSize);
- in->read(srcBuf, srcSize);
+ in.read(srcBuf, srcSize);
uint dstSize = READ_BE_UINT32(srcBuf + srcSize - 4);
byte *dstBuf = (byte *)malloc(dstSize);
@@ -262,25 +210,23 @@ void AGOSEngine::loadGamePcFile() {
readGamePcFile(&stream);
free(dstBuf);
} else {
- readGamePcFile(in);
+ readGamePcFile(&in);
}
- delete in;
}
if (getFileName(GAME_TBLFILE) != NULL) {
/* Read list of TABLE resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_TBLFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_TBLFILE))) {
error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE));
}
- fileSize = in->size();
+ fileSize = in.size();
_tblList = (byte *)malloc(fileSize);
if (_tblList == NULL)
error("loadGamePcFile: Out of memory for strip table list");
- in->read(_tblList, fileSize);
- delete in;
+ in.read(_tblList, fileSize);
/* Remember the current state */
_subroutineListOrg = _subroutineList;
@@ -290,71 +236,67 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_STRFILE) != NULL) {
/* Read list of TEXT resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_STRFILE));
- if (!in)
+ Common::File in;
+ if (!in.open(getFileName(GAME_STRFILE)))
error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE));
- fileSize = in->size();
+ fileSize = in.size();
_strippedTxtMem = (byte *)malloc(fileSize);
if (_strippedTxtMem == NULL)
error("loadGamePcFile: Out of memory for strip text list");
- in->read(_strippedTxtMem, fileSize);
- delete in;
+ in.read(_strippedTxtMem, fileSize);
}
if (getFileName(GAME_STATFILE) != NULL) {
/* Read list of ROOM STATE resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_STATFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_STATFILE))) {
error("loadGamePcFile: Can't load state resources file '%s'", getFileName(GAME_STATFILE));
}
- _numRoomStates = in->size() / 8;
+ _numRoomStates = in.size() / 8;
_roomStates = (RoomState *)calloc(_numRoomStates, sizeof(RoomState));
if (_roomStates == NULL)
error("loadGamePcFile: Out of memory for room state list");
for (uint s = 0; s < _numRoomStates; s++) {
- uint16 num = in->readUint16BE() - (_itemArrayInited - 2);
+ uint16 num = in.readUint16BE() - (_itemArrayInited - 2);
- _roomStates[num].state = in->readUint16BE();
- _roomStates[num].classFlags = in->readUint16BE();
- _roomStates[num].roomExitStates = in->readUint16BE();
+ _roomStates[num].state = in.readUint16BE();
+ _roomStates[num].classFlags = in.readUint16BE();
+ _roomStates[num].roomExitStates = in.readUint16BE();
}
- delete in;
}
if (getFileName(GAME_RMSLFILE) != NULL) {
/* Read list of ROOM ITEMS resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_RMSLFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_RMSLFILE))) {
error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE));
}
- fileSize = in->size();
+ fileSize = in.size();
_roomsList = (byte *)malloc(fileSize);
if (_roomsList == NULL)
error("loadGamePcFile: Out of memory for room items list");
- in->read(_roomsList, fileSize);
- delete in;
+ in.read(_roomsList, fileSize);
}
if (getFileName(GAME_XTBLFILE) != NULL) {
/* Read list of XTABLE resources */
- in = _archives.createReadStreamForMember(getFileName(GAME_XTBLFILE));
- if (!in) {
+ Common::File in;
+ if (!in.open(getFileName(GAME_XTBLFILE))) {
error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE));
}
- fileSize = in->size();
+ fileSize = in.size();
_xtblList = (byte *)malloc(fileSize);
if (_xtblList == NULL)
error("loadGamePcFile: Out of memory for strip xtable list");
- in->read(_xtblList, fileSize);
- delete in;
+ in.read(_xtblList, fileSize);
/* Remember the current state */
_xsubroutineListOrg = _subroutineList;
@@ -828,7 +770,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
uint32 offs, size;
if (getFeatures() & GF_OLD_BUNDLE) {
- Common::SeekableReadStream *in;
+ Common::File in;
char filename[15];
if (id == 23)
id = 112;
@@ -844,32 +786,29 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
sprintf(filename, "0%d.VGA", id);
}
- in = _archives.createReadStreamForMember(filename);
- if (!in)
+ if (!in.open(filename))
error("loadSimonVGAFile: Can't load %s", filename);
- size = in->size();
+ size = in.size();
if (getFeatures() & GF_CRUNCHED) {
byte *srcBuffer = (byte *)malloc(size);
- if (in->read(srcBuffer, size) != size)
+ if (in.read(srcBuffer, size) != size)
error("loadSimonVGAFile: Read failed");
decrunchFile(srcBuffer, _vgaBufferPointers[11].vgaFile2, size);
free(srcBuffer);
} else {
- if (in->read(_vgaBufferPointers[11].vgaFile2, size) != size)
+ if (in.read(_vgaBufferPointers[11].vgaFile2, size) != size)
error("loadSimonVGAFile: Read failed");
}
- delete in;
} else {
offs = _gameOffsetsPtr[id];
-
size = _gameOffsetsPtr[id + 1] - offs;
readGameFile(_vgaBufferPointers[11].vgaFile2, offs, size);
}
}
void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
- Common::SeekableReadStream *in;
+ Common::File in;
char filename[15];
byte *dst;
uint32 file, offs, srcSize, dstSize;
@@ -877,9 +816,9 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
id == 2 && type == 2) {
- // WORKAROUND: For the exta long strings in foreign languages
+ // WORKAROUND: For the extra long strings in foreign languages
// Allocate more space for text to cope with foreign languages that use
- // up more space than english. I hope 6400 bytes are enough. This number
+ // up more space than English. I hope 6400 bytes are enough. This number
// is base on: 2 (lines) * 320 (screen width) * 10 (textheight) -- olki
extraBuffer += 6400;
}
@@ -922,8 +861,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
}
}
- in = _archives.createReadStreamForMember(filename);
- if (!in) {
+ if (!in.open(filename)) {
if (useError)
error("loadVGAVideoFile: Can't load %s", filename);
@@ -931,11 +869,11 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
return;
}
- dstSize = srcSize = in->size();
+ dstSize = srcSize = in.size();
if (getGameType() == GType_PN && getPlatform() == Common::kPlatformDOS && id == 17 && type == 2) {
// The A2.out file isn't compressed in PC version of Personal Nightmare
dst = allocBlock(dstSize + extraBuffer);
- if (in->read(dst, dstSize) != dstSize)
+ if (in.read(dst, dstSize) != dstSize)
error("loadVGAVideoFile: Read failed");
} else if (getGameType() == GType_PN && (getFeatures() & GF_CRUNCHED)) {
Common::Stack<uint32> data;
@@ -943,7 +881,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
int dataOutSize = 0;
for (uint i = 0; i < srcSize / 4; ++i) {
- uint32 dataVal = in->readUint32BE();
+ uint32 dataVal = in.readUint32BE();
// Correct incorrect byte, in corrupt 72.out file, included in some PC versions.
if (dataVal == 168042714)
data.push(168050906);
@@ -957,7 +895,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
delete[] dataOut;
} else if (getFeatures() & GF_CRUNCHED) {
byte *srcBuffer = (byte *)malloc(srcSize);
- if (in->read(srcBuffer, srcSize) != srcSize)
+ if (in.read(srcBuffer, srcSize) != srcSize)
error("loadVGAVideoFile: Read failed");
dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4);
@@ -966,15 +904,22 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
free(srcBuffer);
} else {
dst = allocBlock(dstSize + extraBuffer);
- if (in->read(dst, dstSize) != dstSize)
+ if (in.read(dst, dstSize) != dstSize)
error("loadVGAVideoFile: Read failed");
}
- delete in;
} else {
id = id * 2 + (type - 1);
offs = _gameOffsetsPtr[id];
-
dstSize = _gameOffsetsPtr[id + 1] - offs;
+
+ if (!dstSize) {
+ if (useError)
+ error("loadVGAVideoFile: Can't load id %d type %d", id, type);
+
+ _block = _blockEnd = NULL;
+ return;
+ }
+
dst = allocBlock(dstSize + extraBuffer);
readGameFile(dst, offs, dstSize);
}
diff --git a/engines/agos/res_ami.cpp b/engines/agos/res_ami.cpp
index 32adfa29e6..4b3d575142 100644
--- a/engines/agos/res_ami.cpp
+++ b/engines/agos/res_ami.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/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index 2777d4f269..5d6ab60c8b 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.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.
@@ -450,17 +450,14 @@ static const char *const dimpSoundList[32] = {
void AGOSEngine::loadSoundFile(const char* filename) {
- Common::SeekableReadStream *in;
-
- in = _archives.createReadStreamForMember(filename);
- if (!in)
+ Common::File in;
+ if (!in.open(filename))
error("loadSound: Can't load %s", filename);
- uint32 dstSize = in->size();
+ uint32 dstSize = in.size();
byte *dst = (byte *)malloc(dstSize);
- if (in->read(dst, dstSize) != dstSize)
+ if (in.read(dst, dstSize) != dstSize)
error("loadSound: Read failed");
- delete in;
_sound->playSfxData(dst, 0, 0, 0);
}
@@ -469,21 +466,19 @@ void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) {
byte *dst;
if (getGameId() == GID_DIMP) {
- Common::SeekableReadStream *in;
+ Common::File in;
char filename[15];
assert(sound >= 1 && sound <= 32);
sprintf(filename, "%s.wav", dimpSoundList[sound - 1]);
- in = _archives.createReadStreamForMember(filename);
- if (!in)
+ if (!in.open(filename))
error("loadSound: Can't load %s", filename);
- uint32 dstSize = in->size();
+ uint32 dstSize = in.size();
dst = (byte *)malloc(dstSize);
- if (in->read(dst, dstSize) != dstSize)
+ if (in.read(dst, dstSize) != dstSize)
error("loadSound: Read failed");
- delete in;
} else if (getFeatures() & GF_ZLIBCOMP) {
char filename[15];
diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp
index fb7b313e9c..6185653d42 100644
--- a/engines/agos/rooms.cpp
+++ b/engines/agos/rooms.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/agos/saveload.cpp b/engines/agos/saveload.cpp
index 8eb7f066b3..5d5e2d7b03 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/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.
@@ -37,9 +37,8 @@ namespace AGOS {
// FIXME: This code counts savegames, but callers in many cases assume
// that the return value + 1 indicates an empty slot.
int AGOSEngine::countSaveGames() {
- Common::InSaveFile *f = NULL;
Common::StringArray filenames;
- uint i = 1;
+ uint s, numSaveGames = 1;
int slotNum;
bool marks[256];
@@ -60,18 +59,13 @@ int AGOSEngine::countSaveGames() {
marks[slotNum] = true; //mark this slot as valid
}
- // FIXME: Why does this already try to actually open the savegames?
- // Historical accident?
- while (i < 256) {
- if (marks[i] &&
- (f = _saveFileMan->openForLoading(genSaveName(i)))) {
- i++;
- delete f;
- } else
- break;
+ // locate first empty slot
+ for (s = 1; s < 256; s++) {
+ if (marks[s])
+ numSaveGames++;
}
- return i;
+ return numSaveGames;
}
#ifdef ENABLE_AGOS2
@@ -296,7 +290,7 @@ void AGOSEngine::userGame(bool load) {
const char *message1;
int i = 0, numSaveGames;
char *name;
- char buf[10];
+ memset(_saveBuf, 0, sizeof(_saveBuf));
numSaveGames = countSaveGames();
@@ -325,8 +319,8 @@ restart:
for (; *message1; message1++)
windowPutChar(window, *message1);
- memset(buf, 0, 10);
- name = buf;
+ memset(_saveBuf, 0, 10);
+ name = _saveBuf;
_saveGameNameLen = 0;
while (!shouldQuit()) {
@@ -384,9 +378,10 @@ restart:
_gameStoppedClock = getTime() - saveTime + _gameStoppedClock;
}
-void AGOSEngine_Elvira2::listSaveGames(char *dst) {
+void AGOSEngine_Elvira2::listSaveGames() {
Common::InSaveFile *in;
uint y, slot;
+ char *dst = _saveBuf;
const uint8 num = (getGameType() == GType_WW) ? 3 : 4;
@@ -469,7 +464,7 @@ void AGOSEngine_Elvira2::userGame(bool load) {
int i, numSaveGames;
char *name;
bool b;
- char buf[200];
+ memset(_saveBuf, 0, sizeof(_saveBuf));
_saveOrLoad = load;
@@ -485,28 +480,28 @@ void AGOSEngine_Elvira2::userGame(bool load) {
const uint8 num = (getGameType() == GType_WW) ? 3 : 4;
- listSaveGames(buf);
+ listSaveGames();
if (!load) {
WindowBlock *window = _windowArray[num];
int16 slot = -1;
- name = buf + 192;
+ name = _saveBuf + 192;
while (!shouldQuit()) {
windowPutChar(window, 128);
_saveLoadEdit = true;
- i = userGameGetKey(&b, buf, 128);
+ i = userGameGetKey(&b, 128);
if (b) {
if (i <= 223) {
if (!confirmOverWrite(window)) {
- listSaveGames(buf);
+ listSaveGames();
continue;
}
- if (!saveGame(_saveLoadRowCurPos + i, buf + i * 8))
+ if (!saveGame(_saveLoadRowCurPos + i, _saveBuf + i * 8))
fileError(_windowArray[num], true);
}
@@ -518,7 +513,7 @@ void AGOSEngine_Elvira2::userGame(bool load) {
slot = matchSaveGame(name, numSaveGames);
if (slot >= 0) {
if (!confirmOverWrite(window)) {
- listSaveGames(buf);
+ listSaveGames();
continue;
}
}
@@ -540,11 +535,11 @@ void AGOSEngine_Elvira2::userGame(bool load) {
if (slot < 0)
slot = numSaveGames;
- if (!saveGame(slot, buf + 192))
+ if (!saveGame(slot, _saveBuf + 192))
fileError(_windowArray[num], true);
}
} else {
- i = userGameGetKey(&b, buf, 128);
+ i = userGameGetKey(&b, 128);
if (i != 225) {
if (!loadGame(genSaveName(_saveLoadRowCurPos + i)))
fileError(_windowArray[num], false);
@@ -560,7 +555,7 @@ get_out:;
restartAnimation();
}
-int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
+int AGOSEngine_Elvira2::userGameGetKey(bool *b, uint maxChar) {
HitArea *ha;
*b = true;
@@ -588,7 +583,7 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
if (_saveLoadRowCurPos >= _numSaveGameRows)
_saveLoadRowCurPos = 1;
- listSaveGames(buf);
+ listSaveGames();
} else if (ha->id < 224) {
return ha->id - 200;
}
@@ -597,9 +592,10 @@ int AGOSEngine_Elvira2::userGameGetKey(bool *b, char *buf, uint maxChar) {
return 225;
}
-void AGOSEngine_Simon1::listSaveGames(char *dst) {
+void AGOSEngine_Simon1::listSaveGames() {
Common::InSaveFile *in;
uint16 i, slot, lastSlot;
+ char *dst = _saveBuf;
disableFileBoxes();
@@ -681,7 +677,7 @@ void AGOSEngine_Simon1::userGame(bool load) {
WindowBlock *window;
char *name;
bool b;
- char buf[108];
+ memset(_saveBuf, 0, sizeof(_saveBuf));
int maxChar = (_language == Common::HE_ISR) ? 155: 128;
_saveOrLoad = load;
@@ -704,7 +700,7 @@ void AGOSEngine_Simon1::userGame(bool load) {
_saveLoadEdit = false;
restart:;
- i = userGameGetKey(&b, buf, maxChar);
+ i = userGameGetKey(&b, maxChar);
if (i == 205)
goto get_out;
@@ -730,7 +726,7 @@ restart:;
}
window->textLength = 3;
- name = buf + i * 18;
+ name = _saveBuf + i * 18;
// now process entire savegame name to get correct x offset for cursor
_saveGameNameLen = 0;
@@ -763,7 +759,7 @@ restart:;
_saveLoadEdit = true;
- i = userGameGetKey(&b, buf, maxChar);
+ i = userGameGetKey(&b, maxChar);
if (b) {
if (i == 205)
@@ -814,7 +810,7 @@ restart:;
}
}
- if (!saveGame(_saveLoadRowCurPos + result, buf + result * 18))
+ if (!saveGame(_saveLoadRowCurPos + result, _saveBuf + result * 18))
fileError(_windowArray[5], true);
} else {
if (!loadGame(genSaveName(_saveLoadRowCurPos + i)))
@@ -827,12 +823,12 @@ get_out:;
_gameStoppedClock = getTime() - saveTime + _gameStoppedClock;
}
-int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
+int AGOSEngine_Simon1::userGameGetKey(bool *b, uint maxChar) {
HitArea *ha;
*b = true;
if (!_saveLoadEdit) {
- listSaveGames(buf);
+ listSaveGames();
}
_keyPressed.reset();
@@ -861,7 +857,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
_saveLoadRowCurPos -= 6;
_saveLoadEdit = false;
- listSaveGames(buf);
+ listSaveGames();
}
} else if (ha->id == 207) {
if (_saveDialogFlag) {
@@ -870,7 +866,7 @@ int AGOSEngine_Simon1::userGameGetKey(bool *b, char *buf, uint maxChar) {
_saveLoadRowCurPos = _numSaveGameRows;
_saveLoadEdit = false;
- listSaveGames(buf);
+ listSaveGames();
}
} else if (ha->id < 214) {
return ha->id - 208;
@@ -1031,7 +1027,12 @@ bool AGOSEngine::loadGame(const Common::String &filename, bool restartMode) {
if (restartMode) {
// Load restart state
- f = _archives.createReadStreamForMember(filename);
+ Common::File *file = new Common::File();
+ if (!file->open(filename)) {
+ delete file;
+ file = nullptr;
+ }
+ f = file;
} else {
f = _saveFileMan->openForLoading(filename);
}
@@ -1205,7 +1206,12 @@ bool AGOSEngine_Elvira2::loadGame(const Common::String &filename, bool restartMo
if (restartMode) {
// Load restart state
- f = _archives.createReadStreamForMember(filename);
+ Common::File *file = new Common::File();
+ if (!file->open(filename)) {
+ delete file;
+ file = nullptr;
+ }
+ f = file;
} else {
f = _saveFileMan->openForLoading(filename);
}
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index 1c36454278..1dbb9c255a 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/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.
@@ -22,6 +22,7 @@
// Item script opcodes for Simon1/Simon2
+#include "common/debug-channels.h"
#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -264,7 +265,7 @@ void AGOSEngine::o_add() {
uint var = getVarWrapper();
writeVariable(var, readVariable(var) + getVarOrWord());
- // WORKAROUND: The converation of the male in Vid-Phone Booth at Dave's Space Bar
+ // WORKAROUND: The conversation of the male in Vid-Phone Booth at Dave's Space Bar
// is based on variable 116, but stops due to a missing option (37).
if (getGameType() == GType_FF && _currentTable->id == 10538 && readVariable(116) == 37)
writeVariable(116, 38);
@@ -987,7 +988,7 @@ int AGOSEngine::runScript() {
return 1;
do {
- if (_dumpOpcodes)
+ if (DebugMan.isDebugChannelEnabled(kDebugOpcode))
dumpOpcode(_codePtr);
if (getGameType() == GType_ELVIRA1) {
diff --git a/engines/agos/script_dp.cpp b/engines/agos/script_dp.cpp
index f51e15dc67..85ab308226 100644
--- a/engines/agos/script_dp.cpp
+++ b/engines/agos/script_dp.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/agos/script_e1.cpp b/engines/agos/script_e1.cpp
index c7a2f5b0a2..a022335ebc 100644
--- a/engines/agos/script_e1.cpp
+++ b/engines/agos/script_e1.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/agos/script_e2.cpp b/engines/agos/script_e2.cpp
index 79a7e89a89..21b651ec12 100644
--- a/engines/agos/script_e2.cpp
+++ b/engines/agos/script_e2.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/agos/script_ff.cpp b/engines/agos/script_ff.cpp
index e2a4d0820f..e4fadcf360 100644
--- a/engines/agos/script_ff.cpp
+++ b/engines/agos/script_ff.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.
@@ -243,7 +243,7 @@ void AGOSEngine_Feeble::setupOpcodes() {
/* 164 */
OPCODE(oe2_getDollar2),
OPCODE(off_isAdjNoun),
- OPCODE(oe2_b2Set),
+ OPCODE(off_b2Set),
OPCODE(oe2_b2Clear),
/* 168 */
OPCODE(oe2_b2Zero),
@@ -296,6 +296,39 @@ void AGOSEngine_Feeble::executeOpcode(int opcode) {
(this->*op) ();
}
+void AGOSEngine_Feeble::setLoyaltyRating(byte rating) {
+ // WORKAROUND: The 4CD version of The Feeble File is missing the parts
+ // of the script that set the loyalty rating. This approximates the
+ // script from the 2CD version. See bug #6525.
+
+ switch (rating) {
+ case 1:
+ // Kicking vending machine: Possibility of Undesirable Character Flaws
+ writeVariable(120, 1);
+ break;
+ case 2:
+ // Confessing: Confirmed Minor Character Flaws
+ writeVariable(120, 2);
+ break;
+ case 3:
+ // Being sent to Cygnus Alpha: Suspected Subversive Activity
+ writeVariable(120, 3);
+ break;
+ case 4:
+ // Escaping from Cygnus Alpha: Confirmed Subversive Activity
+ writeVariable(120, 4);
+ break;
+ case 5:
+ // Being brought before Filbert: Confirmed Treasonous Activity
+ writeVariable(120, 5);
+ break;
+ case 6:
+ // Arriving at rebel base: Freedom Fighters Operative
+ writeVariable(120, 6);
+ break;
+ }
+}
+
// -----------------------------------------------------------------------
// Feeble Files Opcodes
// -----------------------------------------------------------------------
@@ -467,6 +500,34 @@ void AGOSEngine_Feeble::off_isAdjNoun() {
setScriptCondition(false);
}
+void AGOSEngine_Feeble::off_b2Set() {
+ // 166: set bit2
+ uint bit = getVarOrByte();
+ _bitArrayTwo[bit / 16] |= (1 << (bit & 15));
+
+ if (getFeatures() & GF_BROKEN_FF_RATING) {
+ switch (bit) {
+ case 152:
+ setLoyaltyRating(1);
+ break;
+ case 153:
+ setLoyaltyRating(2);
+ break;
+ case 240:
+ setLoyaltyRating(3);
+ break;
+ case 251:
+ setLoyaltyRating(4);
+ break;
+ case 253:
+ setLoyaltyRating(6);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
void AGOSEngine_Feeble::off_hyperLinkOn() {
// 171: oracle hyperlink on
hyperLinkOn(getVarOrWord());
@@ -565,6 +626,12 @@ void AGOSEngine_Feeble::off_loadVideo() {
assert(_moviePlayer);
_moviePlayer->load();
+
+ if (getFeatures() & GF_BROKEN_FF_RATING) {
+ if (strcmp((const char *)filename, "Statue1.smk") == 0) {
+ setLoyaltyRating(5);
+ }
+ }
}
void AGOSEngine_Feeble::off_playVideo() {
diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp
index e98cd2795a..60948db35a 100644
--- a/engines/agos/script_pn.cpp
+++ b/engines/agos/script_pn.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/agos/script_pp.cpp b/engines/agos/script_pp.cpp
index 0a599506b5..799b26fbc6 100644
--- a/engines/agos/script_pp.cpp
+++ b/engines/agos/script_pp.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/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index 03aad7ebb9..ec3de9bf94 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.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/agos/script_s2.cpp b/engines/agos/script_s2.cpp
index c35771f8ec..44552ecd8a 100644
--- a/engines/agos/script_s2.cpp
+++ b/engines/agos/script_s2.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/agos/script_ww.cpp b/engines/agos/script_ww.cpp
index 873f258743..aff3229f8e 100644
--- a/engines/agos/script_ww.cpp
+++ b/engines/agos/script_ww.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/agos/sound.cpp b/engines/agos/sound.cpp
index a6a731ab24..812f46504f 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/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.
@@ -121,8 +121,14 @@ Common::SeekableReadStream *BaseSound::getSoundStream(uint sound) const {
int i = 1;
while (_offsets[sound + i] == _offsets[sound])
i++;
+ uint end;
+ if (_offsets[sound + i] > _offsets[sound]) {
+ end = _offsets[sound + i];
+ } else {
+ end = file->size();
+ }
- return new Common::SeekableSubReadStream(file, _offsets[sound], _offsets[sound + i], DisposeAfterUse::YES);
+ return new Common::SeekableSubReadStream(file, _offsets[sound], end, DisposeAfterUse::YES);
}
///////////////////////////////////////////////////////////////////////////////
@@ -190,7 +196,7 @@ bool LoopingAudioStream::endOfData() const {
#pragma mark -
static void convertVolume(int &vol) {
- // DirectSound was orginally used, which specifies volume
+ // DirectSound was originally used, which specifies volume
// and panning differently than ScummVM does, using a logarithmic scale
// rather than a linear one.
//
@@ -442,12 +448,16 @@ void Sound::loadVoiceFile(const GameSpecificSettings *gss) {
if (file.open("voices.idx")) {
int end = file.size();
_filenums = (uint16 *)malloc((end / 6 + 1) * 2);
- _offsets = (uint32 *)malloc((end / 6 + 1) * 4);
+ _offsets = (uint32 *)malloc((end / 6 + 1 + 1) * 4);
for (int i = 1; i <= end / 6; i++) {
_filenums[i] = file.readUint16BE();
_offsets[i] = file.readUint32BE();
}
+ // We need to add a terminator entry otherwise we get an out of
+ // bounds read when the offset table is accessed in
+ // BaseSound::getSoundStream.
+ _offsets[end / 6 + 1] = 0;
_hasVoiceFile = true;
return;
diff --git a/engines/agos/sound.h b/engines/agos/sound.h
index 8633fe2f70..5feb288b9d 100644
--- a/engines/agos/sound.h
+++ b/engines/agos/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/agos/string.cpp b/engines/agos/string.cpp
index ee1b9df246..3eb0aca04d 100644
--- a/engines/agos/string.cpp
+++ b/engines/agos/string.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/agos/string_pn.cpp b/engines/agos/string_pn.cpp
index 4d4e2be16a..7a364f3ea9 100644
--- a/engines/agos/string_pn.cpp
+++ b/engines/agos/string_pn.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/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index f5aad2dcc8..1e6ecaa829 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -8,20 +8,19 @@
* 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 "common/debug-channels.h"
#include "common/file.h"
#include "common/textconsole.h"
@@ -266,8 +265,8 @@ Common::SeekableReadStream *AGOSEngine::openTablesFile(const char *filename) {
}
Common::SeekableReadStream *AGOSEngine::openTablesFile_simon1(const char *filename) {
- Common::SeekableReadStream *in = _archives.createReadStreamForMember(filename);
- if (!in)
+ Common::File *in = new Common::File();
+ if (!in->open(filename))
error("openTablesFile: Can't open '%s'", filename);
return in;
}
@@ -531,7 +530,7 @@ int AGOSEngine::startSubroutine(Subroutine *sub) {
_classMode1 = 0;
_classMode2 = 0;
- if (_dumpScripts)
+ if (DebugMan.isDebugChannelEnabled(kDebugSubroutine))
dumpSubroutine(sub);
if (++_recursionDepth > 40)
@@ -564,8 +563,7 @@ restart:
else
_codePtr += 8;
- if (_dumpOpcodes)
- debug("; %d", sub->id);
+ debugC(kDebugOpcode, "; %d", sub->id);
result = runScript();
if (result != 0) {
break;
diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp
index f5b57a01c8..fb3878381f 100644
--- a/engines/agos/verb.cpp
+++ b/engines/agos/verb.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.
@@ -216,7 +216,14 @@ void AGOSEngine_Simon2::clearName() {
return;
}
- AGOSEngine_Simon1::clearName();
+ if (_currentVerbBox == _lastVerbOn)
+ return;
+
+ resetNameWindow();
+ _lastVerbOn = _currentVerbBox;
+
+ if (_currentVerbBox != NULL && !(_currentVerbBox->flags & kBFBoxDead))
+ printVerbOf(_currentVerbBox->id);
}
void AGOSEngine_Simon1::clearName() {
@@ -242,12 +249,18 @@ void AGOSEngine::clearName() {
resetNameWindow();
}
+static const byte convertVerbID[9] = {
+ 0, 1, 5, 11, 8, 7, 10, 3, 2
+};
+
void AGOSEngine::printVerbOf(uint hitarea_id) {
const char *txt;
const char * const *verb_names;
const char * const *verb_prep_names;
hitarea_id -= 101;
+ if (getGameType() == GType_SIMON2)
+ hitarea_id = convertVerbID[hitarea_id];
if (_showPreposition) {
switch (_language) {
diff --git a/engines/agos/verb_pn.cpp b/engines/agos/verb_pn.cpp
index 9dd0079b6d..53025822ba 100644
--- a/engines/agos/verb_pn.cpp
+++ b/engines/agos/verb_pn.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/agos/vga.cpp b/engines/agos/vga.cpp
index cc5ede5f2c..f761c3fc3f 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.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.
@@ -27,6 +27,7 @@
#include "agos/intern.h"
#include "agos/vga.h"
+#include "common/debug-channels.h"
#include "common/endian.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -152,7 +153,7 @@ void AGOSEngine::runVgaScript() {
for (;;) {
uint opcode;
- if (_dumpVgaOpcodes) {
+ if (DebugMan.isDebugChannelEnabled(kDebugVGAOpcode)) {
if (_vcPtr != (const byte *)&_vcGetOutOfCode) {
debugN("%.5d %.5X: %5d %4d ", _vgaTickCounter, (unsigned int)(_vcPtr - _curVgaFile1), _vgaCurSpriteId, _vgaCurZoneNum);
dumpVideoScript(_vcPtr, true);
@@ -381,8 +382,7 @@ void AGOSEngine::vcSkipNextInstruction() {
_vcPtr += opcodeParamLenPN[opcode];
}
- if (_dumpVgaOpcodes)
- debugN("; skipped\n");
+ debugCN(kDebugVGAOpcode, "; skipped\n");
}
// VGA Script commands
@@ -648,7 +648,7 @@ void AGOSEngine::drawImage_init(int16 image, uint16 palette, int16 x, int16 y, u
if (height == 0 || width == 0)
return;
- if (_dumpImages)
+ if (DebugMan.isDebugChannelEnabled(kDebugImageDump))
dumpSingleBitmap(_vgaCurZoneNum, state.image, state.srcPtr, width, height,
state.palette);
state.width = state.draw_width = width; /* cl */
diff --git a/engines/agos/vga.h b/engines/agos/vga.h
index 5a5764532e..30b3a3b77a 100644
--- a/engines/agos/vga.h
+++ b/engines/agos/vga.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/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp
index 4eb337c687..bc26058640 100644
--- a/engines/agos/vga_e2.cpp
+++ b/engines/agos/vga_e2.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/agos/vga_ff.cpp b/engines/agos/vga_ff.cpp
index c8c9673506..52e30699b0 100644
--- a/engines/agos/vga_ff.cpp
+++ b/engines/agos/vga_ff.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/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp
index b7f80ebf91..306c41c71c 100644
--- a/engines/agos/vga_pn.cpp
+++ b/engines/agos/vga_pn.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/agos/vga_s1.cpp b/engines/agos/vga_s1.cpp
index ef05063fc1..c5f0f7874d 100644
--- a/engines/agos/vga_s1.cpp
+++ b/engines/agos/vga_s1.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/agos/vga_s2.cpp b/engines/agos/vga_s2.cpp
index e0780b491a..0c716d06c4 100644
--- a/engines/agos/vga_s2.cpp
+++ b/engines/agos/vga_s2.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/agos/vga_ww.cpp b/engines/agos/vga_ww.cpp
index ca93fa9fec..5bf8f84551 100644
--- a/engines/agos/vga_ww.cpp
+++ b/engines/agos/vga_ww.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/agos/window.cpp b/engines/agos/window.cpp
index 892df92554..de0b768d02 100644
--- a/engines/agos/window.cpp
+++ b/engines/agos/window.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/agos/zones.cpp b/engines/agos/zones.cpp
index 483b9949eb..1644213579 100644
--- a/engines/agos/zones.cpp
+++ b/engines/agos/zones.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.
@@ -76,7 +76,7 @@ void AGOSEngine::loadZone(uint16 zoneNum, bool useError) {
return;
}
- // Loading order is important due to resource managment
+ // Loading order is important due to resource management
if (getPlatform() == Common::kPlatformAmiga && getGameType() == GType_WW &&
zoneTable[zoneNum] == 3) {