diff options
author | Travis Howell | 2009-09-24 03:41:45 +0000 |
---|---|---|
committer | Travis Howell | 2009-09-24 03:41:45 +0000 |
commit | 48cce58ab52abccbd7df7665d70a551ddfcca989 (patch) | |
tree | 90ce2cd367d9d3b15cf4fb396ef5c5e3ef38907c /engines | |
parent | 2c438b43045484ffa7c2bcc6db7c6f4b4cc28be4 (diff) | |
download | scummvm-rg350-48cce58ab52abccbd7df7665d70a551ddfcca989.tar.gz scummvm-rg350-48cce58ab52abccbd7df7665d70a551ddfcca989.tar.bz2 scummvm-rg350-48cce58ab52abccbd7df7665d70a551ddfcca989.zip |
Split the script opcode table for DIMP, since it doesn't match(ie timers) other Puzzle Pack games.
svn-id: r44285
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agos/agos.cpp | 14 | ||||
-rw-r--r-- | engines/agos/agos.h | 37 | ||||
-rw-r--r-- | engines/agos/detection.cpp | 5 | ||||
-rw-r--r-- | engines/agos/event.cpp | 4 | ||||
-rw-r--r-- | engines/agos/module.mk | 1 | ||||
-rw-r--r-- | engines/agos/script_dp.cpp | 313 | ||||
-rw-r--r-- | engines/agos/script_pp.cpp | 4 |
7 files changed, 361 insertions, 17 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index b9de7b7a05..4f4c6fc0a2 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -60,19 +60,23 @@ static const GameSpecificSettings puzzlepack_settings = { }; #ifdef ENABLE_AGOS2 -AGOSEngine_PuzzlePack::AGOSEngine_PuzzlePack(OSystem *system) - : AGOSEngine_Feeble(system) { +AGOSEngine_DIMP::AGOSEngine_DIMP(OSystem *system) + : AGOSEngine_PuzzlePack(system) { - _oopsValid = false; _iconToggleCount = 0; _voiceCount = 0; - _gameTime = 0; _lastTickCount = 0; - _thisTickCount = 0; _startSecondCount = 0; _tSecondCount = 0; } + +AGOSEngine_PuzzlePack::AGOSEngine_PuzzlePack(OSystem *system) + : AGOSEngine_Feeble(system) { + + _oopsValid = false; + _gameTime = 0; +} #endif AGOSEngine_Simon2::AGOSEngine_Simon2(OSystem *system) diff --git a/engines/agos/agos.h b/engines/agos/agos.h index ae82e28c1a..9d126a59c0 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -2070,10 +2070,7 @@ protected: const OpcodeEntryPuzzlePack *_opcodesPuzzlePack; bool _oopsValid; - int16 _iconToggleCount, _voiceCount; uint32 _gameTime; - uint32 _lastTickCount, _thisTickCount; - uint32 _startSecondCount, _tSecondCount; virtual void initMouse(); virtual void handleMouseMoved(); @@ -2083,14 +2080,42 @@ protected: void loadMouseImage(); - void dimpIdle(); - virtual void timerProc(); - void startOverlayAnims(); void startAnOverlayAnim(); virtual char *genSaveName(int slot); }; + + +class AGOSEngine_DIMP : public AGOSEngine_PuzzlePack { +public: + AGOSEngine_DIMP(OSystem *system); + //~AGOSEngine_DIMP(); + + virtual void setupOpcodes(); + + virtual void executeOpcode(int opcode); + +protected: + typedef void (AGOSEngine_DIMP::*OpcodeProcDIMP) (); + struct OpcodeEntryDIMP { + OpcodeProcDIMP proc; + const char *desc; + }; + + const OpcodeEntryDIMP *_opcodesDIMP; + + int16 _iconToggleCount, _voiceCount; + uint32 _lastTickCount; + uint32 _startSecondCount, _tSecondCount; + + void odp_saveUserGame(); + void odp_loadUserGame(); + + void dimpIdle(); + virtual void timerProc(); + +}; #endif } // End of namespace AGOS diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index 6f128a5a1b..d4eaa03ca9 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -166,7 +166,10 @@ bool AgosMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame *engine = new AGOS::AGOSEngine_Feeble(syst); break; case AGOS::GType_PP: - *engine = new AGOS::AGOSEngine_PuzzlePack(syst); + if (gd->gameId == GID_DIMP) + *engine = new AGOS::AGOSEngine_DIMP(syst); + else + *engine = new AGOS::AGOSEngine_PuzzlePack(syst); break; #endif default: diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index 5ef65e7b42..e5e176b5af 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -552,7 +552,7 @@ void AGOSEngine::delay(uint amount) { } #ifdef ENABLE_AGOS2 -void AGOSEngine_PuzzlePack::timerProc() { +void AGOSEngine_DIMP::timerProc() { _lastTickCount = _system->getMillis(); AGOSEngine_Feeble::timerProc(); @@ -678,7 +678,7 @@ void AGOSEngine::timerProc() { } #ifdef ENABLE_AGOS2 -void AGOSEngine_PuzzlePack::dimpIdle() { +void AGOSEngine_DIMP::dimpIdle() { int z, n; _iconToggleCount++; diff --git a/engines/agos/module.mk b/engines/agos/module.mk index e60b85a3ef..7069d8005b 100644 --- a/engines/agos/module.mk +++ b/engines/agos/module.mk @@ -52,6 +52,7 @@ MODULE_OBJS += \ animation.o \ feeble.o \ oracle.o \ + script_dp.o \ script_ff.o \ script_pp.o \ vga_ff.o diff --git a/engines/agos/script_dp.cpp b/engines/agos/script_dp.cpp new file mode 100644 index 0000000000..0efaa64575 --- /dev/null +++ b/engines/agos/script_dp.cpp @@ -0,0 +1,313 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $$ + * $$ + * + */ + + + +#ifdef ENABLE_AGOS2 + +#include "common/system.h" + +#include "agos/agos.h" + +namespace AGOS { + +#define OPCODE(x) _OPCODE(AGOSEngine_DIMP, x) + +void AGOSEngine_DIMP::setupOpcodes() { + static const OpcodeEntryDIMP opcodes[] = { + /* 00 */ + OPCODE(o_invalid), + OPCODE(o_at), + OPCODE(o_notAt), + OPCODE(o_invalid), + /* 04 */ + OPCODE(o_invalid), + OPCODE(o_carried), + OPCODE(o_notCarried), + OPCODE(o_isAt), + /* 08 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_zero), + /* 12 */ + OPCODE(o_notZero), + OPCODE(o_eq), + OPCODE(o_notEq), + OPCODE(o_gt), + /* 16 */ + OPCODE(o_lt), + OPCODE(o_eqf), + OPCODE(o_notEqf), + OPCODE(o_ltf), + /* 20 */ + OPCODE(o_gtf), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(off_chance), + /* 24 */ + OPCODE(o_invalid), + OPCODE(o_isRoom), + OPCODE(o_isObject), + OPCODE(o_state), + /* 28 */ + OPCODE(o_oflag), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_destroy), + /* 32 */ + OPCODE(o_invalid), + OPCODE(o_place), + OPCODE(o_invalid), + OPCODE(o_invalid), + /* 36 */ + OPCODE(o_copyff), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + /* 40 */ + OPCODE(o_invalid), + OPCODE(o_clear), + OPCODE(o_let), + OPCODE(o_add), + /* 44 */ + OPCODE(o_sub), + OPCODE(o_addf), + OPCODE(o_subf), + OPCODE(o_mul), + /* 48 */ + OPCODE(o_div), + OPCODE(o_mulf), + OPCODE(o_divf), + OPCODE(o_mod), + /* 52 */ + OPCODE(o_modf), + OPCODE(o_random), + OPCODE(o_invalid), + OPCODE(o_goto), + /* 56 */ + OPCODE(o_oset), + OPCODE(o_oclear), + OPCODE(o_putBy), + OPCODE(o_inc), + /* 60 */ + OPCODE(o_dec), + OPCODE(o_setState), + OPCODE(o_print), + OPCODE(o_message), + /* 64 */ + OPCODE(o_msg), + OPCODE(off_addTextBox), + OPCODE(opp_setShortText), + OPCODE(oww_setLongText), + /* 68 */ + OPCODE(o_end), + OPCODE(o_done), + OPCODE(off_printLongText), + OPCODE(o_process), + /* 72 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + /* 76 */ + OPCODE(o_when), + OPCODE(o_if1), + OPCODE(o_if2), + OPCODE(o_isCalled), + /* 80 */ + OPCODE(o_is), + OPCODE(o_invalid), + OPCODE(o_debug), + OPCODE(os2_rescan), + /* 84 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_comment), + /* 88 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_getParent), + OPCODE(o_getNext), + /* 92 */ + OPCODE(o_getChildren), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + /* 96 */ + OPCODE(o_picture), + OPCODE(o_loadZone), + OPCODE(os2_animate), + OPCODE(os2_stopAnimate), + /* 100 */ + OPCODE(o_killAnimate), + OPCODE(o_defWindow), + OPCODE(o_window), + OPCODE(o_cls), + /* 104 */ + OPCODE(o_closeWindow), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(off_addBox), + /* 108 */ + OPCODE(o_delBox), + OPCODE(o_enableBox), + OPCODE(o_disableBox), + OPCODE(o_moveBox), + /* 112 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_doIcons), + OPCODE(o_isClass), + /* 116 */ + OPCODE(o_setClass), + OPCODE(o_unsetClass), + OPCODE(o_invalid), + OPCODE(o_waitSync), + /* 120 */ + OPCODE(o_sync), + OPCODE(o_defObj), + OPCODE(o_invalid), + OPCODE(o_invalid), + /* 124 */ + OPCODE(off_ifTime), + OPCODE(o_here), + OPCODE(o_doClassIcons), + OPCODE(o_invalid), + /* 128 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_setAdjNoun), + OPCODE(off_setTime), + /* 132 */ + OPCODE(odp_saveUserGame), + OPCODE(odp_loadUserGame), + OPCODE(off_listSaveGames), + OPCODE(o_invalid), + /* 136 */ + OPCODE(o_copysf), + OPCODE(o_restoreIcons), + OPCODE(o_freezeZones), + OPCODE(o_placeNoIcons), + /* 140 */ + OPCODE(o_clearTimers), + OPCODE(o_setDollar), + OPCODE(o_isBox), + OPCODE(oe2_doTable), + /* 144 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + /* 148 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(oe2_storeItem), + /* 152 */ + OPCODE(oe2_getItem), + OPCODE(oe2_bSet), + OPCODE(oe2_bClear), + OPCODE(oe2_bZero), + /* 156 */ + OPCODE(oe2_bNotZero), + OPCODE(oe2_getOValue), + OPCODE(oe2_setOValue), + OPCODE(o_invalid), + /* 160 */ + OPCODE(oe2_ink), + OPCODE(off_screenTextBox), + OPCODE(opp_playTune), + OPCODE(o_invalid), + /* 164 */ + OPCODE(oe2_getDollar2), + OPCODE(off_isAdjNoun), + OPCODE(o_invalid), + OPCODE(o_invalid), + /* 168 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + /* 172 */ + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(o_invalid), + OPCODE(oww_lockZones), + /* 176 */ + OPCODE(oww_unlockZones), + OPCODE(off_screenTextPObj), + OPCODE(os1_getPathPosn), + OPCODE(os1_scnTxtLongText), + /* 180 */ + OPCODE(os1_mouseOn), + OPCODE(off_mouseOff), + OPCODE(o_invalid), + OPCODE(o_invalid), + /* 184 */ + OPCODE(os1_unloadZone), + OPCODE(o_invalid), + OPCODE(os1_unfreezeZones), + OPCODE(off_centreScroll), + /* 188 */ + OPCODE(os2_isShortText), + OPCODE(os2_clearMarks), + OPCODE(os2_waitMark), + OPCODE(opp_resetPVCount), + /* 192 */ + OPCODE(opp_setPathValues), + OPCODE(off_stopClock), + OPCODE(off_restartClock), + OPCODE(off_setColour), + }; + + _opcodesDIMP = opcodes; + _numOpcodes = 196; +} + +void AGOSEngine_DIMP::executeOpcode(int opcode) { + OpcodeProcDIMP op = _opcodesDIMP[opcode].proc; + (this->*op) (); +} + +// ----------------------------------------------------------------------- +// DIMP Opcodes +// ----------------------------------------------------------------------- + + +void AGOSEngine_DIMP::odp_saveUserGame() { + // 132: save game + saveGame(1, NULL); +} + +void AGOSEngine_DIMP::odp_loadUserGame() { + // 133: load usergame + loadGame(genSaveName(1)); +} + +} // End of namespace AGOS + +#endif // ENABLE_AGOS2 diff --git a/engines/agos/script_pp.cpp b/engines/agos/script_pp.cpp index a6a20217da..01c467a07e 100644 --- a/engines/agos/script_pp.cpp +++ b/engines/agos/script_pp.cpp @@ -385,9 +385,7 @@ void AGOSEngine_PuzzlePack::opp_saveUserGame() { _gameTime += getTime() - _clockStopped; _clockStopped = 0; - if (getGameId() == GID_DIMP) { - saveGame(1, NULL); - } else if (!getBitFlag(110)) { + if (!getBitFlag(110)) { // Swampy adventures saveGame(1, NULL); } |