From 8dd17a2ae11db5033d732d3f625ec48ab556f2f3 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 7 May 2011 15:25:55 -0400 Subject: AGI: Replace Winnie macros with functions From patch #3298149 --- engines/agi/preagi_winnie.cpp | 51 +++++++++++++++++++------------------------ engines/agi/preagi_winnie.h | 2 ++ 2 files changed, 24 insertions(+), 29 deletions(-) (limited to 'engines/agi') diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index c92434c15f..ef35a0b4e0 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -217,15 +217,9 @@ int Winnie::getObjInRoom(int iRoom) { return 0; } -#define setTakeDrop() {\ - if (getObjInRoom(_room))\ - fCanSel[IDI_WTP_SEL_TAKE] = true;\ - else\ - fCanSel[IDI_WTP_SEL_TAKE] = false;\ - if (_game.iObjHave)\ - fCanSel[IDI_WTP_SEL_DROP] = true;\ - else\ - fCanSel[IDI_WTP_SEL_DROP] = false;\ +void Winnie::setTakeDrop(int fCanSel[]) { + fCanSel[IDI_WTP_SEL_TAKE] = getObjInRoom(_room); + fCanSel[IDI_WTP_SEL_DROP] = _game.iObjHave; } void Winnie::setFlag(int iFlag) { @@ -281,7 +275,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) { fCanSel[IDI_WTP_SEL_EAST] = fCanSel[IDI_WTP_SEL_WEST] = true; // check if object in room or player carrying one - setTakeDrop(); + setTakeDrop(fCanSel); // check which rows have a menu option for (iSel = 0; iSel < IDI_WTP_MAX_OPTION; iSel++) { @@ -367,11 +361,11 @@ int Winnie::parser(int pc, int index, uint8 *buffer) { break; case IDI_WTP_SEL_TAKE: takeObj(_room); - setTakeDrop(); + setTakeDrop(fCanSel); break; case IDI_WTP_SEL_DROP: dropObj(_room); - setTakeDrop(); + setTakeDrop(fCanSel); break; } } @@ -796,13 +790,12 @@ void Winnie::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) { } } -#define makeSel() {\ - if (fCanSel[*iSel]) {\ - return;\ - } else {\ - keyHelp();\ - clrMenuSel(iSel, fCanSel);\ - }\ +void Winnie::makeSel(int *iSel, int fCanSel[]) { + if (fCanSel[*iSel]) + return; + + keyHelp(); + clrMenuSel(iSel, fCanSel); } void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { @@ -844,22 +837,22 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { // Click to move if (fCanSel[IDI_WTP_SEL_NORTH] && hotspotNorth.contains(event.mouse.x, event.mouse.y)) { *iSel = IDI_WTP_SEL_NORTH; - makeSel(); + makeSel(iSel, fCanSel); _vm->_gfx->setCursorPalette(false); return; } else if (fCanSel[IDI_WTP_SEL_SOUTH] && hotspotSouth.contains(event.mouse.x, event.mouse.y)) { *iSel = IDI_WTP_SEL_SOUTH; - makeSel(); + makeSel(iSel, fCanSel); _vm->_gfx->setCursorPalette(false); return; } else if (fCanSel[IDI_WTP_SEL_WEST] && hotspotWest.contains(event.mouse.x, event.mouse.y)) { *iSel = IDI_WTP_SEL_WEST; - makeSel(); + makeSel(iSel, fCanSel); _vm->_gfx->setCursorPalette(false); return; } else if (fCanSel[IDI_WTP_SEL_EAST] && hotspotEast.contains(event.mouse.x, event.mouse.y)) { *iSel = IDI_WTP_SEL_EAST; - makeSel(); + makeSel(iSel, fCanSel); _vm->_gfx->setCursorPalette(false); return; } else { @@ -944,31 +937,31 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { break; case Common::KEYCODE_n: *iSel = IDI_WTP_SEL_NORTH; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_s: if (event.kbd.flags & Common::KBD_CTRL) { _vm->flipflag(fSoundOn); } else { *iSel = IDI_WTP_SEL_SOUTH; - makeSel(); + makeSel(iSel, fCanSel); } break; case Common::KEYCODE_e: *iSel = IDI_WTP_SEL_EAST; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_w: *iSel = IDI_WTP_SEL_WEST; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_t: *iSel = IDI_WTP_SEL_TAKE; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_d: *iSel = IDI_WTP_SEL_DROP; - makeSel(); + makeSel(iSel, fCanSel); break; case Common::KEYCODE_RETURN: switch (*iSel) { diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h index 5a5472feb0..0187d80326 100644 --- a/engines/agi/preagi_winnie.h +++ b/engines/agi/preagi_winnie.h @@ -342,6 +342,8 @@ private: void saveGame(); void loadGame(); void dropObjRnd(); + void setTakeDrop(int[]); + void makeSel(int*, int[]); void wind(); void mist(); -- cgit v1.2.3 From 69b1485a22dc2b8a2cfe0bd10edcbaad0da0cf6e Mon Sep 17 00:00:00 2001 From: strangerke Date: Thu, 12 May 2011 01:13:57 +0200 Subject: GIT: Clean up: Suppress SVN tags, now useless --- engines/agi/agi.cpp | 3 --- engines/agi/agi.h | 3 --- engines/agi/checks.cpp | 3 --- engines/agi/console.cpp | 3 --- engines/agi/console.h | 3 --- engines/agi/cycle.cpp | 3 --- engines/agi/detection.cpp | 3 --- engines/agi/detection_tables.h | 3 --- engines/agi/font.h | 3 --- engines/agi/global.cpp | 3 --- engines/agi/graphics.cpp | 3 --- engines/agi/graphics.h | 3 --- engines/agi/id.cpp | 3 --- engines/agi/inv.cpp | 3 --- engines/agi/keyboard.cpp | 3 --- engines/agi/keyboard.h | 3 --- engines/agi/loader_v2.cpp | 3 --- engines/agi/loader_v3.cpp | 3 --- engines/agi/logic.cpp | 3 --- engines/agi/logic.h | 3 --- engines/agi/lzw.cpp | 3 --- engines/agi/lzw.h | 3 --- engines/agi/menu.cpp | 3 --- engines/agi/menu.h | 3 --- engines/agi/motion.cpp | 3 --- engines/agi/objects.cpp | 3 --- engines/agi/op_cmd.cpp | 3 --- engines/agi/op_dbg.cpp | 3 --- engines/agi/op_test.cpp | 3 --- engines/agi/opcodes.h | 3 --- engines/agi/picture.cpp | 3 --- engines/agi/picture.h | 3 --- engines/agi/preagi.cpp | 3 --- engines/agi/preagi.h | 3 --- engines/agi/preagi_common.cpp | 3 --- engines/agi/preagi_common.h | 3 --- engines/agi/preagi_mickey.cpp | 3 --- engines/agi/preagi_mickey.h | 3 --- engines/agi/preagi_troll.cpp | 3 --- engines/agi/preagi_troll.h | 3 --- engines/agi/preagi_winnie.cpp | 3 --- engines/agi/preagi_winnie.h | 3 --- engines/agi/predictive.cpp | 3 --- engines/agi/saveload.cpp | 3 --- engines/agi/sound.cpp | 3 --- engines/agi/sound.h | 3 --- engines/agi/sound_2gs.cpp | 3 --- engines/agi/sound_2gs.h | 3 --- engines/agi/sound_coco3.cpp | 3 --- engines/agi/sound_coco3.h | 3 --- engines/agi/sound_midi.cpp | 3 --- engines/agi/sound_midi.h | 3 --- engines/agi/sound_pcjr.cpp | 3 --- engines/agi/sound_pcjr.h | 3 --- engines/agi/sound_sarien.cpp | 3 --- engines/agi/sound_sarien.h | 3 --- engines/agi/sprite.cpp | 3 --- engines/agi/sprite.h | 3 --- engines/agi/text.cpp | 3 --- engines/agi/view.cpp | 3 --- engines/agi/view.h | 3 --- engines/agi/wagparser.cpp | 3 --- engines/agi/wagparser.h | 3 --- engines/agi/words.cpp | 3 --- 64 files changed, 192 deletions(-) (limited to 'engines/agi') diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index a69d19f06c..3efb017c5e 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/md5.h" diff --git a/engines/agi/agi.h b/engines/agi/agi.h index c71a0ebf64..0b941e4ecb 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_H diff --git a/engines/agi/checks.cpp b/engines/agi/checks.cpp index afede0b836..8d03ae67b9 100644 --- a/engines/agi/checks.cpp +++ b/engines/agi/checks.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp index f4b50c0909..d49bd57ea2 100644 --- a/engines/agi/console.cpp +++ b/engines/agi/console.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/console.h b/engines/agi/console.h index e79db42054..308b0f1d1f 100644 --- a/engines/agi/console.h +++ b/engines/agi/console.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_CONSOLE_H diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp index 86c1b519a9..d86fb36709 100644 --- a/engines/agi/cycle.cpp +++ b/engines/agi/cycle.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index fb92344de2..d273c2a9fb 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // FIXME: Avoid using printf diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h index 4689915007..cd3edf50c6 100644 --- a/engines/agi/detection_tables.h +++ b/engines/agi/detection_tables.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ namespace Agi { diff --git a/engines/agi/font.h b/engines/agi/font.h index 171106145c..c2516d3520 100644 --- a/engines/agi/font.h +++ b/engines/agi/font.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_FONT_H diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp index ed8e9e8dbe..fdece0737e 100644 --- a/engines/agi/global.cpp +++ b/engines/agi/global.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index f0d38761d0..5ceccd9e27 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/file.h" diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h index 60fbea2285..037dacd8de 100644 --- a/engines/agi/graphics.h +++ b/engines/agi/graphics.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_GRAPHICS_H diff --git a/engines/agi/id.cpp b/engines/agi/id.cpp index 2e12e45458..00f8407529 100644 --- a/engines/agi/id.cpp +++ b/engines/agi/id.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/inv.cpp b/engines/agi/inv.cpp index f1d9523887..a165a32b29 100644 --- a/engines/agi/inv.cpp +++ b/engines/agi/inv.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index 95211f8e3c..f5810a6e8c 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/keyboard.h b/engines/agi/keyboard.h index c4dadb5836..665ee6a62c 100644 --- a/engines/agi/keyboard.h +++ b/engines/agi/keyboard.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_KEYBOARD_H diff --git a/engines/agi/loader_v2.cpp b/engines/agi/loader_v2.cpp index 0141a61065..f5f8830b43 100644 --- a/engines/agi/loader_v2.cpp +++ b/engines/agi/loader_v2.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/textconsole.h" diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp index 025e755c8b..29635f935b 100644 --- a/engines/agi/loader_v3.cpp +++ b/engines/agi/loader_v3.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/logic.cpp b/engines/agi/logic.cpp index cc61d3455a..22798ba831 100644 --- a/engines/agi/logic.cpp +++ b/engines/agi/logic.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/logic.h b/engines/agi/logic.h index d285aa1dfb..fecc2e3b8a 100644 --- a/engines/agi/logic.h +++ b/engines/agi/logic.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_LOGIC_H diff --git a/engines/agi/lzw.cpp b/engines/agi/lzw.cpp index 495d6458da..a00281bd49 100644 --- a/engines/agi/lzw.cpp +++ b/engines/agi/lzw.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ /*************************************************************************** diff --git a/engines/agi/lzw.h b/engines/agi/lzw.h index 5e1f74c819..e3fbafe584 100644 --- a/engines/agi/lzw.h +++ b/engines/agi/lzw.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_LZW_H diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp index b62bcd9ad8..b504cd3e30 100644 --- a/engines/agi/menu.cpp +++ b/engines/agi/menu.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/menu.h b/engines/agi/menu.h index 724ec3877c..e659c71fab 100644 --- a/engines/agi/menu.h +++ b/engines/agi/menu.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_MENU_H diff --git a/engines/agi/motion.cpp b/engines/agi/motion.cpp index 7498aafb5d..261a7f3e61 100644 --- a/engines/agi/motion.cpp +++ b/engines/agi/motion.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/objects.cpp b/engines/agi/objects.cpp index bea53d7fa4..e04c9742f3 100644 --- a/engines/agi/objects.cpp +++ b/engines/agi/objects.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index e1f99456e8..fb4c079a4a 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "base/version.h" diff --git a/engines/agi/op_dbg.cpp b/engines/agi/op_dbg.cpp index f3b4815790..be73dbefae 100644 --- a/engines/agi/op_dbg.cpp +++ b/engines/agi/op_dbg.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index f5234d4e6c..13b2d25023 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ diff --git a/engines/agi/opcodes.h b/engines/agi/opcodes.h index 6b62f9ee99..b0d2051f0b 100644 --- a/engines/agi/opcodes.h +++ b/engines/agi/opcodes.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_OPCODES_H diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp index 8951fc81df..47e40fb5f1 100644 --- a/engines/agi/picture.cpp +++ b/engines/agi/picture.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/picture.h b/engines/agi/picture.h index 31f8605cde..f2a6586b93 100644 --- a/engines/agi/picture.h +++ b/engines/agi/picture.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PICTURE_H diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp index c51c53e76e..8eb2e7d6e3 100644 --- a/engines/agi/preagi.cpp +++ b/engines/agi/preagi.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h index 58e08945b6..1a178497ad 100644 --- a/engines/agi/preagi.h +++ b/engines/agi/preagi.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PREAGI_H diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp index 5bc0c92ab8..d437dc08f2 100644 --- a/engines/agi/preagi_common.cpp +++ b/engines/agi/preagi_common.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/preagi.h" diff --git a/engines/agi/preagi_common.h b/engines/agi/preagi_common.h index 8b6dc0ee59..a557f69977 100644 --- a/engines/agi/preagi_common.h +++ b/engines/agi/preagi_common.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index 64fc4e9ae5..21eb780916 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/events.h" diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h index 5ef12bfad2..62981375c6 100644 --- a/engines/agi/preagi_mickey.h +++ b/engines/agi/preagi_mickey.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PREAGI_MICKEY_H diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index 76849949c7..445a9e34ff 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/preagi.h" diff --git a/engines/agi/preagi_troll.h b/engines/agi/preagi_troll.h index f460758b2c..d9a995072b 100644 --- a/engines/agi/preagi_troll.h +++ b/engines/agi/preagi_troll.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PREAGI_TROLL_H diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index ef35a0b4e0..1df31ff72a 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/preagi.h" diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h index 0187d80326..002eada65c 100644 --- a/engines/agi/preagi_winnie.h +++ b/engines/agi/preagi_winnie.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_PREAGI_WINNIE_H diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp index 96ad78ace5..80e89f410b 100644 --- a/engines/agi/predictive.cpp +++ b/engines/agi/predictive.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index c8df726fc7..deda186439 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp index b40cef67ef..746d4e9070 100644 --- a/engines/agi/sound.cpp +++ b/engines/agi/sound.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/sound.h b/engines/agi/sound.h index b858493cb8..0ee19878c4 100644 --- a/engines/agi/sound.h +++ b/engines/agi/sound.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_H diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp index f5758ed140..88feadd084 100644 --- a/engines/agi/sound_2gs.cpp +++ b/engines/agi/sound_2gs.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/config-manager.h" diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h index 76f0642b7b..d9c7b8d2f1 100644 --- a/engines/agi/sound_2gs.h +++ b/engines/agi/sound_2gs.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_2GS_H diff --git a/engines/agi/sound_coco3.cpp b/engines/agi/sound_coco3.cpp index 858c1c8515..281f2cb2d4 100644 --- a/engines/agi/sound_coco3.cpp +++ b/engines/agi/sound_coco3.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/sound_coco3.h b/engines/agi/sound_coco3.h index a1cc271871..7058b770f5 100644 --- a/engines/agi/sound_coco3.h +++ b/engines/agi/sound_coco3.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_COCO3_H diff --git a/engines/agi/sound_midi.cpp b/engines/agi/sound_midi.cpp index 997c1edd6b..d2c99171e2 100644 --- a/engines/agi/sound_midi.cpp +++ b/engines/agi/sound_midi.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // Code is based on: diff --git a/engines/agi/sound_midi.h b/engines/agi/sound_midi.h index 5733358fee..92a4002498 100644 --- a/engines/agi/sound_midi.h +++ b/engines/agi/sound_midi.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // Music class diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp index 35c960d260..319b7049ed 100644 --- a/engines/agi/sound_pcjr.cpp +++ b/engines/agi/sound_pcjr.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ /* Heavily based on code from NAGI diff --git a/engines/agi/sound_pcjr.h b/engines/agi/sound_pcjr.h index 3aad29d2ce..f50fd0aa82 100644 --- a/engines/agi/sound_pcjr.h +++ b/engines/agi/sound_pcjr.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_PCJR_H diff --git a/engines/agi/sound_sarien.cpp b/engines/agi/sound_sarien.cpp index 6f2f3c5ad3..fc9a57791c 100644 --- a/engines/agi/sound_sarien.cpp +++ b/engines/agi/sound_sarien.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/random.h" diff --git a/engines/agi/sound_sarien.h b/engines/agi/sound_sarien.h index cea396255c..22bfff3395 100644 --- a/engines/agi/sound_sarien.h +++ b/engines/agi/sound_sarien.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SOUND_SARIEN_H diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp index e2b74e87bb..ea0b07f4da 100644 --- a/engines/agi/sprite.cpp +++ b/engines/agi/sprite.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/sprite.h b/engines/agi/sprite.h index 57fd0dacf2..68f0e32b86 100644 --- a/engines/agi/sprite.h +++ b/engines/agi/sprite.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_SPRITE_H diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index f85c4c1cdd..0f60d4536e 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp index fcca1e2a79..0d420caa81 100644 --- a/engines/agi/view.cpp +++ b/engines/agi/view.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "agi/agi.h" diff --git a/engines/agi/view.h b/engines/agi/view.h index 85f2d6eaf9..0ef443f8e5 100644 --- a/engines/agi/view.h +++ b/engines/agi/view.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #ifndef AGI_VIEW_H diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp index fab3b5cf50..14159c0147 100644 --- a/engines/agi/wagparser.cpp +++ b/engines/agi/wagparser.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ #include "common/file.h" diff --git a/engines/agi/wagparser.h b/engines/agi/wagparser.h index c16d4092e7..81cfecef1b 100644 --- a/engines/agi/wagparser.h +++ b/engines/agi/wagparser.h @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ namespace Agi { diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp index d8596dec97..e18b18394e 100644 --- a/engines/agi/words.cpp +++ b/engines/agi/words.cpp @@ -18,9 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * $URL$ - * $Id$ - * */ // -- cgit v1.2.3 From 3c59e37035742ce843f3e12039b5169e4bdd0168 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 15 May 2011 15:50:09 +0100 Subject: ENGINES: Unify engine names This unifies the engine names in MetaEngine::getName() and the credits. In particular drop "Engine" or "engine" from the names when it was present and use expanded names in credits when the MetaEngine uses it (e.g. "Beneath a Steel Sky" instead of "BASS"). --- engines/agi/detection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/agi') diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index d273c2a9fb..22d8adf92d 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -164,7 +164,7 @@ public: AgiMetaEngine() : AdvancedMetaEngine(detectionParams) {} virtual const char *getName() const { - return "AGI preAGI + v2 + v3 Engine"; + return "AGI preAGI + v2 + v3"; } virtual const char *getOriginalCopyright() const { return "Sierra AGI Engine (C) Sierra On-Line Software"; -- cgit v1.2.3 From 4cbe4ede66e65ec9289811eca2f5f62285174c8d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 16 May 2011 16:35:10 +0200 Subject: COMMON: Registers RandomSources in constructor with the event recorder This also removes the dependency of engines on the event recorder header and API, and will make it easier to RandomSources that are not properly registered. --- engines/agi/agi.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'engines/agi') diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 3efb017c5e..101c149f0a 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -22,7 +22,6 @@ #include "common/md5.h" #include "common/events.h" -#include "common/EventRecorder.h" #include "common/file.h" #include "common/memstream.h" #include "common/savefile.h" @@ -496,8 +495,7 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas parseFeatures(); - _rnd = new Common::RandomSource(); - g_eventRec.registerRandomSource(*_rnd, "agi"); + _rnd = new Common::RandomSource("agi"); DebugMan.addDebugChannel(kDebugLevelMain, "Main", "Generic debug level"); DebugMan.addDebugChannel(kDebugLevelResources, "Resources", "Resources debugging"); -- cgit v1.2.3 From 44b798d1072a32ee2142e8041fe3007e0b6b8e95 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 17 May 2011 12:01:34 +0200 Subject: AGI: Unify RandomSource instantiation This fixes a leak in PreAGI games (which never deleted their RandomSource), ensures that PreAGI's RandomSource has a name (and hence is registered with the event recorder) and even slightly simplifies the AgiEngine destructor. --- engines/agi/agi.cpp | 16 ++++++++++------ engines/agi/agi.h | 1 + engines/agi/preagi.cpp | 2 -- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'engines/agi') diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 101c149f0a..78316588b0 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -484,10 +484,16 @@ static const GameSettings agiSettings[] = { AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { _noSaveLoadAllowed = false; + _rnd = new Common::RandomSource("agi"); + initFeatures(); initVersion(); } +AgiBase::~AgiBase() { + delete _rnd; +} + AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) { // Setup mixer @@ -495,8 +501,6 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas parseFeatures(); - _rnd = new Common::RandomSource("agi"); - DebugMan.addDebugChannel(kDebugLevelMain, "Main", "Generic debug level"); DebugMan.addDebugChannel(kDebugLevelResources, "Resources", "Resources debugging"); DebugMan.addDebugChannel(kDebugLevelSprites, "Sprites", "Sprites debugging"); @@ -647,10 +651,11 @@ void AgiEngine::initialize() { } AgiEngine::~AgiEngine() { - // If the engine hasn't been initialized yet via AgiEngine::initialize(), don't attempt to free any resources, - // as they haven't been allocated. Fixes bug #1742432 - AGI: Engine crashes if no game is detected + // If the engine hasn't been initialized yet via + // AgiEngine::initialize(), don't attempt to free any resources, as + // they haven't been allocated. Fixes bug #1742432 - AGI: Engine + // crashes if no game is detected if (_game.state == STATE_INIT) { - delete _rnd; // delete _rnd, as it is allocated in the constructor, not in initialize() return; } @@ -664,7 +669,6 @@ AgiEngine::~AgiEngine() { free(_game.sbufOrig); _gfx->deinitMachine(); delete _gfx; - delete _rnd; delete _console; free(_predictiveDictLine); diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 0b941e4ecb..19343873ec 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -755,6 +755,7 @@ public: virtual void clearKeyQueue() = 0; AgiBase(OSystem *syst, const AGIGameDescription *gameDesc); + ~AgiBase(); virtual void clearImageStack() = 0; virtual void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp index 8eb2e7d6e3..c1a6cd33fe 100644 --- a/engines/agi/preagi.cpp +++ b/engines/agi/preagi.cpp @@ -42,8 +42,6 @@ PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : // Setup mixer syncSoundSettings(); - _rnd = new Common::RandomSource(); - DebugMan.addDebugChannel(kDebugLevelMain, "Main", "Generic debug level"); DebugMan.addDebugChannel(kDebugLevelResources, "Resources", "Resources debugging"); DebugMan.addDebugChannel(kDebugLevelSprites, "Sprites", "Sprites debugging"); -- cgit v1.2.3 From 72acac58b6f8fffc52d4e4a0b26638a9acbf3ffe Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 17 May 2011 21:21:51 +0200 Subject: AGI: Cleanup --- engines/agi/text.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'engines/agi') diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index 0f60d4536e..fedfd29362 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -89,8 +89,11 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff, x1++; // DF: changed the len-1 to len... - if (x1 == len && m[len] != '\n') - y1++, x1 = foff = 0; + // FIXME: m[len] doesn't make sense and may read out of bounds? + if (x1 == len && m[len] != '\n') { + y1++; + x1 = foff = 0; + } } else { y1++; x1 = foff = 0; -- cgit v1.2.3 From 39ab4a2dc481ee794cafb5e2548404a7121eb96d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 18 May 2011 13:06:33 +0200 Subject: AGI: Constify stuff --- engines/agi/agi.h | 2 +- engines/agi/words.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/agi') diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 19343873ec..a42148b1ef 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -969,7 +969,7 @@ public: int showWords(); int loadWords(const char *); void unloadWords(); - int findWord(char *word, int *flen); + int findWord(const char *word, int *flen); void dictionaryWords(char *); // Motion diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp index e18b18394e..4b96fdf711 100644 --- a/engines/agi/words.cpp +++ b/engines/agi/words.cpp @@ -37,7 +37,7 @@ static uint32 wordsFlen; // length of word memory // Local implementation to avoid problems with strndup() used by // gcc 3.2 Cygwin (see #635984) // -static char *myStrndup(char *src, int n) { +static char *myStrndup(const char *src, int n) { char *tmp = strncpy((char *)malloc(n + 1), src, n); tmp[n] = 0; return tmp; @@ -86,11 +86,11 @@ void AgiEngine::unloadWords() { * * Thomas Akesson, November 2001 */ -int AgiEngine::findWord(char *word, int *flen) { +int AgiEngine::findWord(const char *word, int *flen) { int mchr = 0; // matched chars int len, fchr, id = -1; - uint8 *p = words; - uint8 *q = words + wordsFlen; + const uint8 *p = words; + const uint8 *q = words + wordsFlen; *flen = 0; debugC(2, kDebugLevelScripts, "find_word(%s)", word); -- cgit v1.2.3