diff options
Diffstat (limited to 'engines/agos')
61 files changed, 658 insertions, 217 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 359a6f7289..7266c75474 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. @@ -510,6 +510,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 +551,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 diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 0b8e585f57..5e49fce5ff 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. @@ -584,6 +584,7 @@ protected: byte _saveLoadType, _saveLoadSlot; char _saveLoadName[108]; + char _saveBuf[200]; Graphics::Surface *_backGroundBuf; Graphics::Surface *_backBuf; @@ -834,6 +835,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(); @@ -1706,10 +1710,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; }; @@ -1829,6 +1836,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(); @@ -1841,9 +1851,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); @@ -1927,6 +1937,7 @@ public: void off_listSaveGames(); void off_checkCD(); void off_screenTextBox(); + void off_b2Set(); void off_isAdjNoun(); void off_hyperLinkOn(); void off_hyperLinkOff(); @@ -1969,12 +1980,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 d438de049a..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. @@ -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(); 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/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..512137b685 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. diff --git a/engines/agos/debugger.h b/engines/agos/debugger.h index 0ab992ebbe..caac6e2caf 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. diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index b6d3c2f020..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. diff --git a/engines/agos/detection_tables.h b/engines/agos/detection_tables.h index 329af75d0c..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. @@ -2622,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 @@ -2645,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..6e97084811 100644 --- a/engines/agos/gfx.cpp +++ b/engines/agos/gfx.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/icons.cpp b/engines/agos/icons.cpp index 5647fece7e..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. 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..c26fbe3331 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. 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 1c79a073e8..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. @@ -802,7 +802,6 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { } } else { offs = _gameOffsetsPtr[id]; - size = _gameOffsetsPtr[id + 1] - offs; readGameFile(_vgaBufferPointers[11].vgaFile2, offs, size); } @@ -817,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; } @@ -911,8 +910,16 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { } 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 86d24e0b07..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. 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 8b133971de..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; diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp index 1c36454278..6f809d9e2d 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. @@ -264,7 +264,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); 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 7a84a20808..39bc468dea 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.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/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..c656c0167a 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. 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) { |