From c95d36c186fb1d286a15c1c9ccc5fd581ef948b6 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Tue, 11 Aug 2009 23:40:07 +0000 Subject: vc22_setPaletteOld was renamed to vc22_setPalette, since function was virtualized. svn-id: r43292 --- engines/agos/vga_pn.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines') diff --git a/engines/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp index de0b53f2e6..54326e277c 100644 --- a/engines/agos/vga_pn.cpp +++ b/engines/agos/vga_pn.cpp @@ -57,8 +57,6 @@ void AGOSEngine_PN::setupVideoOpcodes(VgaOpcodeProc *op) { op[20] = &AGOSEngine::vc19_loop; op[21] = &AGOSEngine::vc20_setRepeat; op[22] = &AGOSEngine::vc21_endRepeat; - // FIXME: This has been "vc22_setPaletteOld" before, but that does not seem to exist. - // Please check whether "vc22_setPalette" is fine to be used here. op[23] = &AGOSEngine::vc22_setPalette; op[24] = &AGOSEngine::vc23_setPriority; op[25] = &AGOSEngine::vc24_setSpriteXY; -- cgit v1.2.3 From f186d9c86094e5be5c0e168e72487b3fb8d2deac Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 12 Aug 2009 00:53:35 +0000 Subject: Fix building with specific games disabled in MSVC. svn-id: r43294 --- engines/agos/animation.cpp | 4 ++++ engines/agos/animation.h | 4 ++++ engines/agos/feeble.cpp | 6 ++++++ engines/agos/oracle.cpp | 4 ++++ engines/agos/pn.cpp | 2 +- engines/agos/script_ff.cpp | 4 ++++ engines/agos/script_pn.cpp | 2 +- engines/agos/script_pp.cpp | 4 ++++ engines/agos/vga_ff.cpp | 4 ++++ engines/agos/vga_pn.cpp | 2 +- engines/scumm/he/animation_he.cpp | 4 +++- engines/scumm/he/animation_he.h | 2 +- engines/scumm/he/cup_player_he.cpp | 3 +++ engines/scumm/he/floodfill_he.cpp | 4 +++- engines/scumm/he/logic_he.cpp | 4 +++- engines/scumm/he/logic_he.h | 2 -- engines/scumm/he/palette_he.cpp | 4 ++++ engines/scumm/he/script_v100he.cpp | 4 ++++ engines/scumm/he/script_v71he.cpp | 4 ++++ engines/scumm/he/script_v72he.cpp | 4 ++++ engines/scumm/he/script_v80he.cpp | 4 ++++ engines/scumm/he/script_v90he.cpp | 4 ++++ engines/scumm/he/sound_he.cpp | 1 - engines/scumm/he/sprite_he.cpp | 4 +++- engines/scumm/he/wiz_he.cpp | 4 +++- 25 files changed, 76 insertions(+), 12 deletions(-) (limited to 'engines') diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 2e7eb9cb5e..dd52f42abc 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -25,6 +25,8 @@ +#ifdef ENABLE_AGOS2 + #include "common/endian.h" #include "common/events.h" #include "common/file.h" @@ -542,3 +544,5 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) { } } // End of namespace AGOS + +#endif // ENABLE_AGOS2 diff --git a/engines/agos/animation.h b/engines/agos/animation.h index 3ce6aa9ab2..f0a975f1d4 100644 --- a/engines/agos/animation.h +++ b/engines/agos/animation.h @@ -23,6 +23,8 @@ * */ +#ifdef ENABLE_AGOS2 + #ifndef AGOS_ANIMATION_H #define AGOS_ANIMATION_H @@ -112,3 +114,5 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name); } // End of namespace AGOS #endif + +#endif // ENABLE_AGOS2 diff --git a/engines/agos/feeble.cpp b/engines/agos/feeble.cpp index 89b6f6da27..7dbeacd62f 100644 --- a/engines/agos/feeble.cpp +++ b/engines/agos/feeble.cpp @@ -23,6 +23,10 @@ * */ + + +#ifdef ENABLE_AGOS2 + #include "common/config-manager.h" #include "agos/intern.h" @@ -383,3 +387,5 @@ void AGOSEngine_FeebleDemo::waitForSpace() { } } // End of namespace AGOS + +#endif // ENABLE_AGOS2 diff --git a/engines/agos/oracle.cpp b/engines/agos/oracle.cpp index e7192ea2ec..b0ecc679c0 100644 --- a/engines/agos/oracle.cpp +++ b/engines/agos/oracle.cpp @@ -25,6 +25,8 @@ +#ifdef ENABLE_AGOS2 + #include "common/savefile.h" #include "common/system.h" @@ -520,3 +522,5 @@ void AGOSEngine_Feeble::windowBackSpace(WindowBlock *window) { } } // End of namespace AGOS + +#endif // ENABLE_AGOS2 diff --git a/engines/agos/pn.cpp b/engines/agos/pn.cpp index e8135f56cd..6a8dba47f1 100644 --- a/engines/agos/pn.cpp +++ b/engines/agos/pn.cpp @@ -298,4 +298,4 @@ void AGOSEngine_PN::setqptrs() { } // End of namespace AGOS -#endif +#endif // ENABLE_PN diff --git a/engines/agos/script_ff.cpp b/engines/agos/script_ff.cpp index f20086b268..c1cc8ca9a0 100644 --- a/engines/agos/script_ff.cpp +++ b/engines/agos/script_ff.cpp @@ -25,6 +25,8 @@ +#ifdef ENABLE_AGOS2 + #include "common/system.h" #include "agos/animation.h" @@ -675,3 +677,5 @@ void AGOSEngine_Feeble::off_b3NotZero() { } } // End of namespace AGOS + +#endif // ENABLE_AGOS2 diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp index 2885781a9f..9dba3d305d 100644 --- a/engines/agos/script_pn.cpp +++ b/engines/agos/script_pn.cpp @@ -1120,4 +1120,4 @@ void AGOSEngine_PN::popstack(int type) { } // End of namespace AGOS -#endif +#endif // ENABLE_PN diff --git a/engines/agos/script_pp.cpp b/engines/agos/script_pp.cpp index 7c83165274..3fbfd43afd 100644 --- a/engines/agos/script_pp.cpp +++ b/engines/agos/script_pp.cpp @@ -25,6 +25,8 @@ +#ifdef ENABLE_AGOS2 + #include "common/system.h" #include "agos/agos.h" @@ -457,3 +459,5 @@ void AGOSEngine_PuzzlePack::opp_restartClock() { } } // End of namespace AGOS + +#endif // ENABLE_AGOS2 diff --git a/engines/agos/vga_ff.cpp b/engines/agos/vga_ff.cpp index 694aa3ba28..a92be159e7 100644 --- a/engines/agos/vga_ff.cpp +++ b/engines/agos/vga_ff.cpp @@ -25,6 +25,8 @@ +#ifdef ENABLE_AGOS2 + #include "agos/agos.h" #include "agos/intern.h" @@ -486,3 +488,5 @@ void AGOSEngine_PuzzlePack::startAnOverlayAnim() { } } // End of namespace AGOS + +#endif // ENABLE_AGOS2 diff --git a/engines/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp index 54326e277c..27152ef2dd 100644 --- a/engines/agos/vga_pn.cpp +++ b/engines/agos/vga_pn.cpp @@ -220,4 +220,4 @@ void AGOSEngine_PN::clearVideoWindow(uint16 num, uint16 color) { } // End of namespace AGOS -#endif +#endif // ENABLE_PN diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 0cc4419778..2ca17161db 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -23,7 +23,7 @@ * */ - +#ifdef ENABLE_HE #include "scumm/he/animation_he.h" #include "scumm/he/intern_he.h" @@ -103,3 +103,5 @@ void MoviePlayer::setPalette(byte *pal) { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/animation_he.h b/engines/scumm/he/animation_he.h index 39f03960c4..cf5d054ead 100644 --- a/engines/scumm/he/animation_he.h +++ b/engines/scumm/he/animation_he.h @@ -23,7 +23,7 @@ * */ -#ifndef SCUMM_HE_ANIMATION_H +#if !defined(SCUMM_HE_ANIMATION_H) && defined(ENABLE_HE) #define SCUMM_HE_ANIMATION_H #include "common/file.h" diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp index 39615edb6a..a284632fb1 100644 --- a/engines/scumm/he/cup_player_he.cpp +++ b/engines/scumm/he/cup_player_he.cpp @@ -23,6 +23,7 @@ * */ +#ifdef ENABLE_HE #include "common/system.h" #include "sound/audiostream.h" @@ -521,3 +522,5 @@ void CUP_Player::handleTOIL(Common::SeekableReadStream &dataStream, uint32 dataS } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/floodfill_he.cpp b/engines/scumm/he/floodfill_he.cpp index d3578e2189..491b91c17e 100644 --- a/engines/scumm/he/floodfill_he.cpp +++ b/engines/scumm/he/floodfill_he.cpp @@ -23,7 +23,7 @@ * */ - +#ifdef ENABLE_HE #include "scumm/he/floodfill_he.h" #include "scumm/he/intern_he.h" @@ -293,3 +293,5 @@ void Wiz::fillWizFlood(const WizParameters *params) { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp index a24f4d4665..b7d2c9264c 100644 --- a/engines/scumm/he/logic_he.cpp +++ b/engines/scumm/he/logic_he.cpp @@ -23,7 +23,7 @@ * */ - +#ifdef ENABLE_HE #include "scumm/he/intern_he.h" #include "scumm/he/logic_he.h" @@ -1058,3 +1058,5 @@ int LogicHEmoonbase::versionID() { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/logic_he.h b/engines/scumm/he/logic_he.h index 29304b7468..f5ecdd429a 100644 --- a/engines/scumm/he/logic_he.h +++ b/engines/scumm/he/logic_he.h @@ -26,8 +26,6 @@ #if !defined(SCUMM_HE_LOGIC_HE_H) && defined(ENABLE_HE) #define SCUMM_HE_LOGIC_HE_H - - namespace Scumm { class ScummEngine_v90he; diff --git a/engines/scumm/he/palette_he.cpp b/engines/scumm/he/palette_he.cpp index d055b77ee2..7fe04f223e 100644 --- a/engines/scumm/he/palette_he.cpp +++ b/engines/scumm/he/palette_he.cpp @@ -8,6 +8,7 @@ * 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 @@ -22,6 +23,7 @@ * */ +#ifdef ENABLE_HE #include "common/system.h" #include "scumm/scumm.h" @@ -317,3 +319,5 @@ void ScummEngine_v99he::updatePalette() { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 84fec085cc..44a38401ce 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -23,6 +23,8 @@ * */ +#ifdef ENABLE_HE + #include "common/system.h" #include "scumm/actor.h" @@ -3014,3 +3016,5 @@ void ScummEngine_v100he::decodeParseString(int m, int n) { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp index c832d64316..46a8868949 100644 --- a/engines/scumm/he/script_v71he.cpp +++ b/engines/scumm/he/script_v71he.cpp @@ -23,6 +23,8 @@ * */ +#ifdef ENABLE_HE + #include "scumm/actor.h" #include "scumm/he/intern_he.h" #include "scumm/scumm.h" @@ -446,3 +448,5 @@ void ScummEngine_v71he::o71_polygonHit() { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index 6224ef5b47..1d73f0da76 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -23,6 +23,8 @@ * */ +#ifdef ENABLE_HE + #include "common/config-manager.h" #include "common/savefile.h" #include "common/system.h" @@ -2043,3 +2045,5 @@ void ScummEngine_v72he::decodeParseString(int m, int n) { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index d7e36106ea..5b10944899 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -23,6 +23,8 @@ * */ +#ifdef ENABLE_HE + #include "common/config-file.h" #include "common/config-manager.h" #include "common/savefile.h" @@ -529,3 +531,5 @@ void ScummEngine_v80he::o80_pickVarRandom() { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index 2da58b4480..be20a229f0 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -23,6 +23,8 @@ * */ +#ifdef ENABLE_HE + #include "scumm/actor.h" #include "scumm/charset.h" #include "scumm/he/animation_he.h" @@ -2353,3 +2355,5 @@ void ScummEngine_v90he::o90_kernelSetFunctions() { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index 67248f4c22..01f29d5db9 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -23,7 +23,6 @@ * */ - #include "scumm/actor.h" #include "scumm/file.h" #include "scumm/imuse/imuse.h" diff --git a/engines/scumm/he/sprite_he.cpp b/engines/scumm/he/sprite_he.cpp index aed03f746b..5f751d8285 100644 --- a/engines/scumm/he/sprite_he.cpp +++ b/engines/scumm/he/sprite_he.cpp @@ -23,7 +23,7 @@ * */ - +#ifdef ENABLE_HE #include "scumm/he/intern_he.h" #include "scumm/resource.h" @@ -1442,3 +1442,5 @@ void Sprite::saveOrLoadSpriteData(Serializer *s) { } } // End of namespace Scumm + +#endif // ENABLE_HE diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index 6b1db38b23..549877090c 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -23,7 +23,7 @@ * */ - +#ifdef ENABLE_HE #include "common/system.h" #include "graphics/cursorman.h" @@ -2405,3 +2405,5 @@ int ScummEngine_v90he::computeWizHistogram(int resNum, int state, int x, int y, } } // End of namespace Scumm + +#endif // ENABLE_HE -- cgit v1.2.3 From c50f3c0241b9d5bffc9e2fe210aacf9787850e4a Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 12 Aug 2009 01:21:25 +0000 Subject: Fix bug #2835822 - SSPP: Sounds from DIMP appearing randomly in other games. svn-id: r43299 --- engines/agos/event.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index 0c7c1feb51..d9cf529fa8 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -557,7 +557,8 @@ void AGOSEngine_PuzzlePack::timerProc() { _lastTickCount = _system->getMillis(); AGOSEngine_Feeble::timerProc(); - dimpIdle(); + if (getGameId() == GID_DIMP) + dimpIdle(); } void AGOSEngine_Feeble::timerProc() { -- cgit v1.2.3 From 8a62c94f80029ad0d3215438174d2b3c498dc261 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 12 Aug 2009 02:24:03 +0000 Subject: Enable Personal Nightmare by default. svn-id: r43304 --- engines/agos/agos.cpp | 2 - engines/agos/agos.h | 2 - engines/agos/charset.cpp | 2 - engines/agos/cursor.cpp | 2 - engines/agos/detection.cpp | 4 - engines/agos/detection_tables.h | 2 - engines/agos/event.cpp | 2 - engines/agos/gfx.cpp | 2 - engines/agos/icons.cpp | 2 - engines/agos/input.cpp | 2 - engines/agos/input_pn.cpp | 169 ++++++++++ engines/agos/module.mk | 13 +- engines/agos/pn.cpp | 4 - engines/agos/res.cpp | 2 - engines/agos/saveload.cpp | 2 - engines/agos/script_pn.cpp | 4 - engines/agos/string.cpp | 644 -------------------------------------- engines/agos/string_pn.cpp | 674 ++++++++++++++++++++++++++++++++++++++++ engines/agos/verb.cpp | 253 --------------- engines/agos/verb_pn.cpp | 284 +++++++++++++++++ engines/agos/vga_pn.cpp | 4 - engines/engines.mk | 4 - 22 files changed, 1133 insertions(+), 946 deletions(-) create mode 100644 engines/agos/input_pn.cpp create mode 100644 engines/agos/string_pn.cpp create mode 100644 engines/agos/verb_pn.cpp (limited to 'engines') diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index a786882630..07b5c12247 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -832,7 +832,6 @@ void AGOSEngine_Elvira1::setupGame() { AGOSEngine::setupGame(); } -#ifdef ENABLE_PN void AGOSEngine_PN::setupGame() { gss = &simon1_settings; _numVideoOpcodes = 57; @@ -844,7 +843,6 @@ void AGOSEngine_PN::setupGame() { AGOSEngine::setupGame(); } -#endif void AGOSEngine::setupGame() { allocItemHeap(); diff --git a/engines/agos/agos.h b/engines/agos/agos.h index a0730deaea..291ebb71f6 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -1262,7 +1262,6 @@ protected: virtual char *genSaveName(int slot); }; -#ifdef ENABLE_PN class AGOSEngine_PN : public AGOSEngine { virtual Common::Error go(); @@ -1510,7 +1509,6 @@ protected: const OpcodeEntryPN *_opcodesPN; }; -#endif class AGOSEngine_Elvira1 : public AGOSEngine { public: diff --git a/engines/agos/charset.cpp b/engines/agos/charset.cpp index fb012a89dd..7d93f26f7b 100644 --- a/engines/agos/charset.cpp +++ b/engines/agos/charset.cpp @@ -486,13 +486,11 @@ void AGOSEngine::openTextWindow() { _textWindow = openWindow(8, 144, 24, 6, 1, 0, 15); } -#ifdef ENABLE_PN void AGOSEngine_PN::windowPutChar(WindowBlock *window, byte c, byte b) { if (_mousePrintFG || _wiped) return; AGOSEngine::windowPutChar(window, c, b); } -#endif void AGOSEngine::windowPutChar(WindowBlock *window, byte c, byte b) { byte width = 6; diff --git a/engines/agos/cursor.cpp b/engines/agos/cursor.cpp index 1304ca7ca4..b741811a68 100644 --- a/engines/agos/cursor.cpp +++ b/engines/agos/cursor.cpp @@ -476,7 +476,6 @@ get_out: _litBoxFlag = 0; } -#ifdef ENABLE_PN void AGOSEngine_PN::handleMouseMoved() { if (_mouseHideCount) { CursorMan.showMouse(false); @@ -541,7 +540,6 @@ void AGOSEngine_PN::handleMouseMoved() { _needHitAreaRecalc = 0; _litBoxFlag = 0; } -#endif void AGOSEngine::handleMouseMoved() { uint x; diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp index a7b5b91602..6f128a5a1b 100644 --- a/engines/agos/detection.cpp +++ b/engines/agos/detection.cpp @@ -66,9 +66,7 @@ static const ADObsoleteGameID obsoleteGameIDsTable[] = { }; static const PlainGameDescriptor simonGames[] = { -#ifdef ENABLE_PN {"pn", "Personal Nightmare"}, -#endif {"elvira1", "Elvira - Mistress of the Dark"}, {"elvira2", "Elvira II - The Jaws of Cerberus"}, {"waxworks", "Waxworks"}, @@ -142,11 +140,9 @@ bool AgosMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame bool res = true; switch (gd->gameType) { -#ifdef ENABLE_PN case AGOS::GType_PN: *engine = new AGOS::AGOSEngine_PN(syst); break; -#endif case AGOS::GType_ELVIRA1: *engine = new AGOS::AGOSEngine_Elvira1(syst); break; diff --git a/engines/agos/detection_tables.h b/engines/agos/detection_tables.h index 2a6cf4f752..678d10f5fa 100644 --- a/engines/agos/detection_tables.h +++ b/engines/agos/detection_tables.h @@ -32,7 +32,6 @@ using Common::GUIO_NOSPEECH; using Common::GUIO_NOSUBTITLES; static const AGOSGameDescription gameDescriptions[] = { -#ifdef ENABLE_PN // Personal Nightmare 1.1 - English Amiga { { @@ -124,7 +123,6 @@ static const AGOSGameDescription gameDescriptions[] = { GID_PN, GF_OLD_BUNDLE | GF_CRUNCHED | GF_EGA | GF_PLANAR }, -#endif // Elvira 1 - English Amiga Floppy Demo { diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp index d9cf529fa8..2ba5d56243 100644 --- a/engines/agos/event.cpp +++ b/engines/agos/event.cpp @@ -613,7 +613,6 @@ void AGOSEngine_Feeble::timerProc() { } #endif -#ifdef ENABLE_PN void AGOSEngine_PN::timerProc() { if (_videoLockOut & 0x80E9 || _videoLockOut & 2) return; @@ -652,7 +651,6 @@ void AGOSEngine_PN::timerProc() { _videoLockOut &= ~2; } -#endif void AGOSEngine::timerProc() { if (_videoLockOut & 0x80E9 || _videoLockOut & 2) diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp index a7bd1895c5..e2c634007c 100644 --- a/engines/agos/gfx.cpp +++ b/engines/agos/gfx.cpp @@ -1262,7 +1262,6 @@ void AGOSEngine::setImage(uint16 vgaSpriteId, bool vgaScript) { _vcPtr = vc_ptr_org; } -#ifdef ENABLE_PN void AGOSEngine_PN::setWindowImageEx(uint16 mode, uint16 vga_res) { if (!_initMouse) { _initMouse = 1; @@ -1270,7 +1269,6 @@ void AGOSEngine_PN::setWindowImageEx(uint16 mode, uint16 vga_res) { } setWindowImage(mode, vga_res); } -#endif void AGOSEngine::setWindowImageEx(uint16 mode, uint16 vgaSpriteId) { _window3Flag = 0; diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp index cb37cf3841..b28f5ea14f 100644 --- a/engines/agos/icons.cpp +++ b/engines/agos/icons.cpp @@ -1046,7 +1046,6 @@ static const byte hitBarData[12 * 7] = { 0x3C, 0x89, 0xC3, 0x00, 0x88, 0x88, 0x18, 0x03, 0x86, 0x23, 0x0C, 0x00 }; -#ifdef ENABLE_PN // Personal Nightmare specific void AGOSEngine_PN::drawIconHitBar() { Graphics::Surface *screen = _system->lockScreen(); @@ -1126,6 +1125,5 @@ void AGOSEngine_PN::printIcon(HitArea *ha, uint8 i, uint8 r) { } } } -#endif } // End of namespace AGOS diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp index 5c37fe620a..82747dbfb9 100644 --- a/engines/agos/input.cpp +++ b/engines/agos/input.cpp @@ -624,7 +624,6 @@ bool AGOSEngine::processSpecialKeys() { return verbCode; } -#ifdef ENABLE_PN // Personal Nightmare specific void AGOSEngine_PN::clearInputLine() { _inputting = false; @@ -761,6 +760,5 @@ bool AGOSEngine_PN::processSpecialKeys() { _keyPressed.reset(); return false; } -#endif } // End of namespace AGOS diff --git a/engines/agos/input_pn.cpp b/engines/agos/input_pn.cpp new file mode 100644 index 0000000000..9c35fbb3a2 --- /dev/null +++ b/engines/agos/input_pn.cpp @@ -0,0 +1,169 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + + + +#include "agos/agos.h" +#include "agos/intern.h" + +namespace AGOS { + +void AGOSEngine_PN::clearInputLine() { + _inputting = false; + _inputReady = false; + clearWindow(_windowArray[2]); +} + +void AGOSEngine_PN::handleKeyboard() { + if (!_inputReady) + return; + + if (_hitCalled != 0) { + mouseHit(); + } + + int16 chr = -1; + if (_mouseString) { + const char *strPtr = _mouseString; + while (*strPtr != 0 && *strPtr != 13) + addChar(*strPtr++); + _mouseString = 0; + + chr = *strPtr; + if (chr == 13) { + addChar(13); + } + } + if (_mouseString1 && chr != 13) { + const char *strPtr = _mouseString1; + while (*strPtr != 13) + addChar(*strPtr++); + _mouseString1 = 0; + + chr = *strPtr; + if (chr == 13) { + addChar(13); + } + } + if (chr == -1) { + if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE || _keyPressed.keycode == Common::KEYCODE_RETURN) { + chr = _keyPressed.keycode; + addChar(chr); + } else if (!(_videoLockOut & 0x10)) { + chr = _keyPressed.ascii; + if (chr >= 32) + addChar(chr); + } + } + + if (chr == 13) { + _mouseString = 0; + _mouseString1 = 0; + _mousePrintFG = 0; + _inputReady = false; + } + + _keyPressed.reset(); +} + +void AGOSEngine_PN::interact(char *buffer, uint8 size) { + if (!_inputting) { + memset(_keyboardBuffer, 0, sizeof(_keyboardBuffer)); + _intputCounter = 0; + _inputMax = size; + _inputWindow = _windowArray[_curWindow]; + windowPutChar(_inputWindow, 128); + windowPutChar(_inputWindow, 8); + _inputting = true; + _inputReady = true; + } + + while (!shouldQuit() && _inputReady) { + if (!_noScanFlag && _scanFlag) { + buffer[0] = 1; + buffer[1] = 0; + _scanFlag = 0; + break; + } + delay(1); + } + + if (!_inputReady) { + memcpy(buffer, _keyboardBuffer, size); + _inputting = false; + } +} + +void AGOSEngine_PN::addChar(uint8 chr) { + if (chr == 13) { + _keyboardBuffer[_intputCounter++] = chr; + windowPutChar(_inputWindow, 13); + } else if (chr == 8 && _intputCounter) { + clearCursor(_inputWindow); + windowPutChar(_inputWindow, 8); + windowPutChar(_inputWindow, 128); + windowPutChar(_inputWindow, 8); + + _keyboardBuffer[--_intputCounter] = 0; + } else if (chr >= 32 && _intputCounter < _inputMax) { + _keyboardBuffer[_intputCounter++] = chr; + + clearCursor(_inputWindow); + windowPutChar(_inputWindow, chr); + windowPutChar(_inputWindow, 128); + windowPutChar(_inputWindow, 8); + } +} + +void AGOSEngine_PN::clearCursor(WindowBlock *window) { + byte oldTextColor = window->textColor; + + window->textColor = window->fillColor; + windowPutChar(window, 128); + window->textColor = oldTextColor; + + windowPutChar(window, 8); +} + +bool AGOSEngine_PN::processSpecialKeys() { + if (shouldQuit()) + _exitCutscene = true; + + switch (_keyPressed.keycode) { + case Common::KEYCODE_ESCAPE: + _exitCutscene = true; + break; + case Common::KEYCODE_PAUSE: + pause(); + break; + default: + break; + } + + _keyPressed.reset(); + return false; +} + +} // End of namespace AGOS diff --git a/engines/agos/module.mk b/engines/agos/module.mk index 41305620f8..e60b85a3ef 100644 --- a/engines/agos/module.mk +++ b/engines/agos/module.mk @@ -14,16 +14,19 @@ MODULE_OBJS := \ gfx.o \ icons.o \ input.o \ + input_pn.o \ items.o \ menus.o \ midi.o \ midiparser_s1d.o \ + pn.o \ res.o \ res_ami.o \ res_snd.o \ rooms.o \ saveload.o \ script.o \ + script_pn.o \ script_e1.o \ script_e2.o \ script_ww.o \ @@ -31,9 +34,12 @@ MODULE_OBJS := \ script_s2.o \ sound.o \ string.o \ + string_pn.o \ subroutine.o \ verb.o \ + verb_pn.o \ vga.o \ + vga_pn.o \ vga_e2.o \ vga_ww.o \ vga_s1.o \ @@ -41,13 +47,6 @@ MODULE_OBJS := \ window.o \ zones.o -ifdef ENABLE_PN -MODULE_OBJS += \ - pn.o \ - script_pn.o \ - vga_pn.o -endif - ifdef ENABLE_AGOS2 MODULE_OBJS += \ animation.o \ diff --git a/engines/agos/pn.cpp b/engines/agos/pn.cpp index 6a8dba47f1..94768f9ffb 100644 --- a/engines/agos/pn.cpp +++ b/engines/agos/pn.cpp @@ -23,8 +23,6 @@ * */ -#ifdef ENABLE_PN - #include "common/config-manager.h" #include "agos/intern.h" @@ -297,5 +295,3 @@ void AGOSEngine_PN::setqptrs() { } } // End of namespace AGOS - -#endif // ENABLE_PN diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index e7e9920ced..cb48e5e50b 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -152,7 +152,6 @@ int AGOSEngine::allocGamePcVars(Common::SeekableReadStream *in) { return itemArrayInited; } -#ifdef ENABLE_PN void AGOSEngine_PN::loadGamePcFile() { Common::File in; @@ -192,7 +191,6 @@ void AGOSEngine_PN::loadGamePcFile() { error("Unknown compression format"); } } -#endif void AGOSEngine::loadGamePcFile() { Common::File in; diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp index 0d31c0353d..8a54151f91 100644 --- a/engines/agos/saveload.cpp +++ b/engines/agos/saveload.cpp @@ -1551,7 +1551,6 @@ bool AGOSEngine_Elvira2::saveGame(uint slot, const char *caption) { return result; } -#ifdef ENABLE_PN // Personal Nightmare specific bool AGOSEngine_PN::badload(int8 errorNum) { if (errorNum == -2) @@ -1675,6 +1674,5 @@ void AGOSEngine_PN::dbtosysf() { ct++; } } -#endif } // End of namespace AGOS diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp index 9dba3d305d..f4b2aefcc6 100644 --- a/engines/agos/script_pn.cpp +++ b/engines/agos/script_pn.cpp @@ -23,8 +23,6 @@ * */ -#ifdef ENABLE_PN - #include "agos/agos.h" #include "agos/vga.h" @@ -1119,5 +1117,3 @@ void AGOSEngine_PN::popstack(int type) { } } // End of namespace AGOS - -#endif // ENABLE_PN diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp index 6fa0b5d97f..1d8bb0b976 100644 --- a/engines/agos/string.cpp +++ b/engines/agos/string.cpp @@ -955,648 +955,4 @@ void AGOSEngine_Waxworks::printBox() { changeWindow(0); } -#ifdef ENABLE_PN -// Personal Nightmare specific -uint32 AGOSEngine_PN::ftext(uint32 base, int n) { - uint32 b = base; - int ct = n; - while (ct) { - while(_textBase[b++]) - ; - ct--; - } - return b; -} - -char *AGOSEngine_PN::unctok(char *c, int n) { - int x; - uint8 *tokbase; - tokbase = _textBase + getlong(30); - x = n; - while (x-=(*tokbase++ > 127)) - ; - while (*tokbase < 128) - *c++=*tokbase++; - *c++ = *tokbase & 127; - *c = 0; - return c; -} - -void AGOSEngine_PN::uncomstr(char *c, uint32 x) { - if (x > _textBaseSize) - error("UNCOMSTR: TBASE over-run"); - while (_textBase[x]) { - if (_textBase[x] < 244) { - c = unctok(c, _textBase[x]); - } else { - c = unctok(c, (_textBase[x] - 244) * 254 + _textBase[x + 1] - 1); - x++; - } - x++; - } - *c++ = 13; - *c = 0; -} - -static const char *objectNames[30] = { - "\0", - "Take \0", - "Inventory\r", - "Open \0", - "Close \0", - "Lock \0", - "Unlock \0", - "Examine \0", - "Look in \0", - "Exits \r", - "Look\r", - "Wait\r", - "Pause\r", - "\0", - "Save\r", - "Restore\r", - "\0", - "N\r", - "NE\r", - "E\r", - "SE\r", - "S\r", - "SW\r", - "W\r", - "NW\r", - "INVENTORY\r", - "ROOM DESCRIPTION\r", - "x\r", - "MORE\r", - "CLOSE\r" -}; - -void AGOSEngine_PN::getObjectName(char *v, uint16 x) { - if (x & 0x8000) { - x &= ~0x8000; - if (x > getptr(51)) - error("getObjectName: Object %d out of range", x); - uncomstr(v, ftext(getlong(27), x * _dataBase[47])); - } else { - assert(x < 30); - strcpy(v, objectNames[x]); - } -} - -void AGOSEngine_PN::pcl(const char *s) { - strcat(_sb, s); - if (strchr(s, '\n') == 0) { - for (char *str = _sb; *str; str++) - windowPutChar(_windowArray[_curWindow], *str); - strcpy(_sb, ""); - } -} - -void AGOSEngine_PN::pcf(uint8 ch) { - int ct = 0; - if (ch == '[') - ch = '\n'; - if (ch == 0) - return; /* Trap any C EOS chrs */ - if (ch == 255) { - _bp = 0; - _xofs = 0; - return; /* pcf(255) initialises the routine */ - } /* pcf(254) flushes its working _buffer */ - if (ch != 254) { - if ((ch != 32) || (_bp + _xofs != 50)) - _buffer[_bp++] = ch; - } - if ((ch != 254) && (!isspace(ch)) && (_bp < 60)) - return; - /* We know have a case of needing to print the text */ - if (_bp + _xofs > 50) { - pcl("\n"); - if (_buffer[0] == ' ') - ct = 1; /* Skip initial space */ - /* Note ' ' will give a single start of line space */ - _xofs = 0; - } - _buffer[_bp] = 0; - pcl(_buffer + ct); - _xofs += _bp; - _bp = 0; - if (ch == '\n') - _xofs = 0; /* At Newline! */ -} - -void AGOSEngine_PN::patok(int n) { - int x; - uint8 *tokbase; - tokbase = _textBase + getlong(30); - x = n; - while (x -= (*tokbase++ > 127)) - ; - while (*tokbase < 128) - pcf(*tokbase++); - pcf((uint8)(*tokbase & 127)); -} - -void AGOSEngine_PN::pmesd(int n) { - ptext(ftext(getlong(24), n)); -} - -void AGOSEngine_PN::plocd(int n, int m) { - if (n > getptr(53)) - error("Location out of range"); - ptext(ftext(getlong(21), n * _dataBase[48] + m)); -} - -void AGOSEngine_PN::pobjd(int n, int m) { - if (n > getptr(51)) - error("Object out of range"); - ptext(ftext(getlong(27), n * _dataBase[47] + m)); -} - -void AGOSEngine_PN::ptext(uint32 tptr) { - if (tptr > _textBaseSize) - error("ptext: attempt to print beyond end of TBASE"); - - while (_textBase[tptr]) { - if (_textBase[tptr] < 244) { - patok(_textBase[tptr++]); - } else { - patok((_textBase[tptr] - 244) * 254 + _textBase[tptr + 1] - 1); - tptr += 2; - } - } -} - -const uint8 characters[11][80] = { -// PETERMASON - { - 118, 225, - 91, 118, - 94, 124, - 236, 161, - 241, 166, - 168, 4, - 138, 46, - 139, 46, - 249, 50, - 38, 56, - 80, 59, - 149, 69, - 37, 77, - 93, 93, - 86, 95, - 0, - 0, - 58, 130, - 62, 178, - 83, 95, - 0, - 121, 58, - 122, 59, - 126, 60, - 124, 61, - 240, 62, - 123, 63, - 0 - }, -// JBLANDFORD - { - 0, - 0, - 0, - 0 - }, -// SBLANDFORD - { - 120, 223, - 94, 126, - 112, 134, - 45, 152, - 241, 166, - 168, 3, - 150, 26, - 220, 29, - 138, 42, - 139, 47, - 249, 50, - 38, 56, - 230, 64, - 37, 77, - 93, 94, - 86, 96, - 0, - 0, - 58, 129, - 59, 112, - 83, 96, - 81, 106, - 62, 169, - 0, - 121, 54, - 122, 55, - 119, 56, - 118, 57, - 0 - }, -// MRJONES - { - 121, 218, - 91, 118, - 253, 121, - 154, 138, - 235, 173, - 236, 161, - 241, 165, - 168, 0, - 150, 21, - 36, 33, - 138, 42, - 249, 50, - 80, 60, - 4, 60, - 37, 78, - 68, 33, - 93, 92, - 101, 109, - 0, - 36, 35, - 68, 90, - 0, - 58, 128, - 59, 111, - 62, 182, - 0, - 122, 13, - 126, 14, - 124, 15, - 240, 16, - 120, 17, - 119, 18, - 118, 19, - 52, 20, - 125, 21, - 127, 22, - 123, 23, - 117, 24, - 0 - }, -// MRSJONES - { - 122, 219, - 91, 119, - 253, 123, - 112, 136, - 154, 137, - 95, 142, - 45, 152, - 109, 155, - 235, 160, - 168, 1, - 151, 13, - 145, 15, - 150, 22, - 220, 28, - 36, 33, - 138, 43, - 13, 51, - 80, 59, - 230, 64, - 149, 69, - 86, 100, - 0, - 36, 36, - 0, - 58, 127, - 62, 179, - 83, 100, - 81, 102, - 0, - 121, 25, - 126, 26, - 124, 27, - 120, 28, - 119, 29, - 118, 30, - 52, 31, - 125, 32, - 127, 33, - 123, 34, - 117, 35, - 0 - }, -// MRROBERTS - { - 123, 229, - 91, 117, - 253, 120, - 94, 125, - 112, 134, - 109, 156, - 235, 172, - 236, 162, - 241, 165, - 168, 3, - 36, 33, - 249, 50, - 38, 56, - 80, 58, - 37, 75, - 34, 81, - 68, 33, - 101, 109, - 0, - 36, 40, - 68, 88, - 0, - 59, 111, - 62, 181, - 0, - 0 - }, -// POSTMISTRESS - { - 124, 221, - 91, 119, - 253, 122, - 112, 136, - 95, 142, - 130, 149, - 109, 155, - 235, 176, - 220, 29, - 36, 33, - 138, 43, - 13, 51, - 80, 57, - 149, 68, - 37, 73, - 34, 33, - 68, 33, - 86, 100, - 0, - 36, 39, - 34, 80, - 68, 86, - 0, - 58, 130, - 62, 181, - 83, 100, - 81, 103, - 0, - 121, 41, - 122, 42, - 126, 43, - 240, 44, - 120, 45, - 119, 46, - 118, 47, - 52, 48, - 123, 49, - 83, 50, - 117, 51, - 0 - }, -// MWILLIAMS - { - 125, 227, - 94, 124, - 95, 141, - 241, 166, - 168, 4, - 150, 26, - 38, 54, - 4, 60, - 230, 65, - 149, 68, - 37, 76, - 101, 109, - 0, - 230, 63, - 0, - 59, 112, - 62, 183, - 0, - 240, 71, - 120, 72, - 118, 73, - 52, 74, - 117, 75, - 0 - }, -// TONY - { - 126, 220, - 95, 143, - 130, 149, - 45, 153, - 109, 154, - 235, 158, - 241, 166, - 168, 2, - 145, 15, - 150, 24, - 220, 20, - 36, 20, - 4, 60, - 37, 79, - 86, 97, - 0, - 150, 23, - 220, 27, - 36, 34, - 0, - 83, 97, - 0, - 121, 36, - 122, 37, - 124, 38, - 240, 39, - 52, 40, - 0 - }, -// PIG - { - 127, 228, - 112, 133, - 45, 153, - 235, 157, - 236, 163, - 241, 165, - 36, 33, - 80, 58, - 34, 81, - 68, 33, - 86, 98, - 0, - 36, 37, - 68, 90, - 0, - 62, 184, - 83, 98, - 0, - 121, 76, - 122, 77, - 126, 78, - 124, 79, - 240, 80, - 120, 81, - 118, 82, - 52, 83, - 125, 84, - 123, 85, - 83, 86, - 117, 87, - 0 - }, -// JUDY - { - 0, - 0, - 0, - 240, 52, - 117, 53, - 0 - } -}; - -void AGOSEngine_PN::getResponse(uint16 charNum, uint16 objNum, uint16 &msgNum1, uint16 &msgNum2) { - const uint8 *ptr; - uint16 num; - - msgNum1 = 0; - msgNum2 = 0; - - if (charNum == 83) - charNum += 45; - - if (charNum < 118 || charNum > 128) { - return; - } - - ptr = characters[charNum - 118]; - - while ((num = *ptr++) != 0) { - if (num == objNum) { - msgNum1 = *ptr++; - msgNum1 += 400; - - while ((num = *ptr++) != 0) - ptr++; - break; - } - ptr++; - } - - while ((num = *ptr++) != 0) { - if (num == objNum) { - msgNum2 = *ptr++; - msgNum2 += 400; - - if (msgNum1 == 569) - msgNum1 += 400; - if (msgNum2 == 0) - msgNum2 = msgNum1; - return; - } - ptr++; - } - - if (objNum >= 200) - msgNum1 = 0; - - objNum -= 200; - while ((num = *ptr++) != 0) { - if (num == objNum) { - msgNum1 = *ptr++; - msgNum1 += 400; - - if (msgNum1 == 569) - msgNum1 += 400; - if (msgNum2 == 0) - msgNum2 = msgNum1; - return; - } - ptr++; - } - - objNum += 200; - while ((num = *ptr++) != 0) { - if (num == objNum) { - msgNum1 = *ptr++; - msgNum1 += 200; - - if (msgNum1 == 569) - msgNum1 += 400; - if (msgNum2 == 0) - msgNum2 = msgNum1; - return; - } - ptr++; - } - - if (msgNum1 == 569) - msgNum1 += 400; - if (msgNum2 == 0) - msgNum2 = msgNum1; -} - -char *AGOSEngine_PN::getMessage(char *msg, uint16 num) { - char *origPtr, *strPtr1 = msg; - uint8 count; - - getObjectName(strPtr1, num); - if (!(num & 0x8000)) { - return msg; - } - - if (strPtr1[0] == 0x41 || strPtr1[0] == 0x61) { - if (strPtr1[1] != 0x20) - strPtr1 += 2; - } else if (strPtr1[0] == 0x54 || strPtr1[0] == 0x74) { - if (strPtr1[1] == 0x68 && - strPtr1[2] == 0x65 && - strPtr1[3] == 0x20) - strPtr1 += 4; - } - - origPtr = strPtr1; - while (*strPtr1 != 13) - strPtr1++; - - strPtr1[0] = 32; - strPtr1[1] = 13; - strPtr1[2] = 0; - - if (_videoLockOut & 0x10) { - strPtr1 = origPtr; - count = 6; - while (*strPtr1) { - if (*strPtr1 == 32) { - count = 6; - } else { - count--; - if (count == 0) { - char *tmpPtr = strPtr1; - char *strPtr2 = strPtr1; - - while (*strPtr2 != 0 && *strPtr2 != 32) - strPtr2++; - - while (*strPtr2) { - *strPtr1++ = *strPtr2++; - } - *strPtr1++ = *strPtr2++; - - strPtr1 = tmpPtr; - count = 6; - } - } - strPtr1++; - } - } - - return origPtr; -} -#endif - } // End of namespace AGOS diff --git a/engines/agos/string_pn.cpp b/engines/agos/string_pn.cpp new file mode 100644 index 0000000000..0872e9d589 --- /dev/null +++ b/engines/agos/string_pn.cpp @@ -0,0 +1,674 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + + + +#include "agos/agos.h" +#include "agos/intern.h" + +namespace AGOS { + +uint32 AGOSEngine_PN::ftext(uint32 base, int n) { + uint32 b = base; + int ct = n; + while (ct) { + while(_textBase[b++]) + ; + ct--; + } + return b; +} + +char *AGOSEngine_PN::unctok(char *c, int n) { + int x; + uint8 *tokbase; + tokbase = _textBase + getlong(30); + x = n; + while (x-=(*tokbase++ > 127)) + ; + while (*tokbase < 128) + *c++=*tokbase++; + *c++ = *tokbase & 127; + *c = 0; + return c; +} + +void AGOSEngine_PN::uncomstr(char *c, uint32 x) { + if (x > _textBaseSize) + error("UNCOMSTR: TBASE over-run"); + while (_textBase[x]) { + if (_textBase[x] < 244) { + c = unctok(c, _textBase[x]); + } else { + c = unctok(c, (_textBase[x] - 244) * 254 + _textBase[x + 1] - 1); + x++; + } + x++; + } + *c++ = 13; + *c = 0; +} + +static const char *objectNames[30] = { + "\0", + "Take \0", + "Inventory\r", + "Open \0", + "Close \0", + "Lock \0", + "Unlock \0", + "Examine \0", + "Look in \0", + "Exits \r", + "Look\r", + "Wait\r", + "Pause\r", + "\0", + "Save\r", + "Restore\r", + "\0", + "N\r", + "NE\r", + "E\r", + "SE\r", + "S\r", + "SW\r", + "W\r", + "NW\r", + "INVENTORY\r", + "ROOM DESCRIPTION\r", + "x\r", + "MORE\r", + "CLOSE\r" +}; + +void AGOSEngine_PN::getObjectName(char *v, uint16 x) { + if (x & 0x8000) { + x &= ~0x8000; + if (x > getptr(51)) + error("getObjectName: Object %d out of range", x); + uncomstr(v, ftext(getlong(27), x * _dataBase[47])); + } else { + assert(x < 30); + strcpy(v, objectNames[x]); + } +} + +void AGOSEngine_PN::pcl(const char *s) { + strcat(_sb, s); + if (strchr(s, '\n') == 0) { + for (char *str = _sb; *str; str++) + windowPutChar(_windowArray[_curWindow], *str); + strcpy(_sb, ""); + } +} + +void AGOSEngine_PN::pcf(uint8 ch) { + int ct = 0; + if (ch == '[') + ch = '\n'; + if (ch == 0) + return; /* Trap any C EOS chrs */ + if (ch == 255) { + _bp = 0; + _xofs = 0; + return; /* pcf(255) initialises the routine */ + } /* pcf(254) flushes its working _buffer */ + if (ch != 254) { + if ((ch != 32) || (_bp + _xofs != 50)) + _buffer[_bp++] = ch; + } + if ((ch != 254) && (!isspace(ch)) && (_bp < 60)) + return; + /* We know have a case of needing to print the text */ + if (_bp + _xofs > 50) { + pcl("\n"); + if (_buffer[0] == ' ') + ct = 1; /* Skip initial space */ + /* Note ' ' will give a single start of line space */ + _xofs = 0; + } + _buffer[_bp] = 0; + pcl(_buffer + ct); + _xofs += _bp; + _bp = 0; + if (ch == '\n') + _xofs = 0; /* At Newline! */ +} + +void AGOSEngine_PN::patok(int n) { + int x; + uint8 *tokbase; + tokbase = _textBase + getlong(30); + x = n; + while (x -= (*tokbase++ > 127)) + ; + while (*tokbase < 128) + pcf(*tokbase++); + pcf((uint8)(*tokbase & 127)); +} + +void AGOSEngine_PN::pmesd(int n) { + ptext(ftext(getlong(24), n)); +} + +void AGOSEngine_PN::plocd(int n, int m) { + if (n > getptr(53)) + error("Location out of range"); + ptext(ftext(getlong(21), n * _dataBase[48] + m)); +} + +void AGOSEngine_PN::pobjd(int n, int m) { + if (n > getptr(51)) + error("Object out of range"); + ptext(ftext(getlong(27), n * _dataBase[47] + m)); +} + +void AGOSEngine_PN::ptext(uint32 tptr) { + if (tptr > _textBaseSize) + error("ptext: attempt to print beyond end of TBASE"); + + while (_textBase[tptr]) { + if (_textBase[tptr] < 244) { + patok(_textBase[tptr++]); + } else { + patok((_textBase[tptr] - 244) * 254 + _textBase[tptr + 1] - 1); + tptr += 2; + } + } +} + +const uint8 characters[11][80] = { +// PETERMASON + { + 118, 225, + 91, 118, + 94, 124, + 236, 161, + 241, 166, + 168, 4, + 138, 46, + 139, 46, + 249, 50, + 38, 56, + 80, 59, + 149, 69, + 37, 77, + 93, 93, + 86, 95, + 0, + 0, + 58, 130, + 62, 178, + 83, 95, + 0, + 121, 58, + 122, 59, + 126, 60, + 124, 61, + 240, 62, + 123, 63, + 0 + }, +// JBLANDFORD + { + 0, + 0, + 0, + 0 + }, +// SBLANDFORD + { + 120, 223, + 94, 126, + 112, 134, + 45, 152, + 241, 166, + 168, 3, + 150, 26, + 220, 29, + 138, 42, + 139, 47, + 249, 50, + 38, 56, + 230, 64, + 37, 77, + 93, 94, + 86, 96, + 0, + 0, + 58, 129, + 59, 112, + 83, 96, + 81, 106, + 62, 169, + 0, + 121, 54, + 122, 55, + 119, 56, + 118, 57, + 0 + }, +// MRJONES + { + 121, 218, + 91, 118, + 253, 121, + 154, 138, + 235, 173, + 236, 161, + 241, 165, + 168, 0, + 150, 21, + 36, 33, + 138, 42, + 249, 50, + 80, 60, + 4, 60, + 37, 78, + 68, 33, + 93, 92, + 101, 109, + 0, + 36, 35, + 68, 90, + 0, + 58, 128, + 59, 111, + 62, 182, + 0, + 122, 13, + 126, 14, + 124, 15, + 240, 16, + 120, 17, + 119, 18, + 118, 19, + 52, 20, + 125, 21, + 127, 22, + 123, 23, + 117, 24, + 0 + }, +// MRSJONES + { + 122, 219, + 91, 119, + 253, 123, + 112, 136, + 154, 137, + 95, 142, + 45, 152, + 109, 155, + 235, 160, + 168, 1, + 151, 13, + 145, 15, + 150, 22, + 220, 28, + 36, 33, + 138, 43, + 13, 51, + 80, 59, + 230, 64, + 149, 69, + 86, 100, + 0, + 36, 36, + 0, + 58, 127, + 62, 179, + 83, 100, + 81, 102, + 0, + 121, 25, + 126, 26, + 124, 27, + 120, 28, + 119, 29, + 118, 30, + 52, 31, + 125, 32, + 127, 33, + 123, 34, + 117, 35, + 0 + }, +// MRROBERTS + { + 123, 229, + 91, 117, + 253, 120, + 94, 125, + 112, 134, + 109, 156, + 235, 172, + 236, 162, + 241, 165, + 168, 3, + 36, 33, + 249, 50, + 38, 56, + 80, 58, + 37, 75, + 34, 81, + 68, 33, + 101, 109, + 0, + 36, 40, + 68, 88, + 0, + 59, 111, + 62, 181, + 0, + 0 + }, +// POSTMISTRESS + { + 124, 221, + 91, 119, + 253, 122, + 112, 136, + 95, 142, + 130, 149, + 109, 155, + 235, 176, + 220, 29, + 36, 33, + 138, 43, + 13, 51, + 80, 57, + 149, 68, + 37, 73, + 34, 33, + 68, 33, + 86, 100, + 0, + 36, 39, + 34, 80, + 68, 86, + 0, + 58, 130, + 62, 181, + 83, 100, + 81, 103, + 0, + 121, 41, + 122, 42, + 126, 43, + 240, 44, + 120, 45, + 119, 46, + 118, 47, + 52, 48, + 123, 49, + 83, 50, + 117, 51, + 0 + }, +// MWILLIAMS + { + 125, 227, + 94, 124, + 95, 141, + 241, 166, + 168, 4, + 150, 26, + 38, 54, + 4, 60, + 230, 65, + 149, 68, + 37, 76, + 101, 109, + 0, + 230, 63, + 0, + 59, 112, + 62, 183, + 0, + 240, 71, + 120, 72, + 118, 73, + 52, 74, + 117, 75, + 0 + }, +// TONY + { + 126, 220, + 95, 143, + 130, 149, + 45, 153, + 109, 154, + 235, 158, + 241, 166, + 168, 2, + 145, 15, + 150, 24, + 220, 20, + 36, 20, + 4, 60, + 37, 79, + 86, 97, + 0, + 150, 23, + 220, 27, + 36, 34, + 0, + 83, 97, + 0, + 121, 36, + 122, 37, + 124, 38, + 240, 39, + 52, 40, + 0 + }, +// PIG + { + 127, 228, + 112, 133, + 45, 153, + 235, 157, + 236, 163, + 241, 165, + 36, 33, + 80, 58, + 34, 81, + 68, 33, + 86, 98, + 0, + 36, 37, + 68, 90, + 0, + 62, 184, + 83, 98, + 0, + 121, 76, + 122, 77, + 126, 78, + 124, 79, + 240, 80, + 120, 81, + 118, 82, + 52, 83, + 125, 84, + 123, 85, + 83, 86, + 117, 87, + 0 + }, +// JUDY + { + 0, + 0, + 0, + 240, 52, + 117, 53, + 0 + } +}; + +void AGOSEngine_PN::getResponse(uint16 charNum, uint16 objNum, uint16 &msgNum1, uint16 &msgNum2) { + const uint8 *ptr; + uint16 num; + + msgNum1 = 0; + msgNum2 = 0; + + if (charNum == 83) + charNum += 45; + + if (charNum < 118 || charNum > 128) { + return; + } + + ptr = characters[charNum - 118]; + + while ((num = *ptr++) != 0) { + if (num == objNum) { + msgNum1 = *ptr++; + msgNum1 += 400; + + while ((num = *ptr++) != 0) + ptr++; + break; + } + ptr++; + } + + while ((num = *ptr++) != 0) { + if (num == objNum) { + msgNum2 = *ptr++; + msgNum2 += 400; + + if (msgNum1 == 569) + msgNum1 += 400; + if (msgNum2 == 0) + msgNum2 = msgNum1; + return; + } + ptr++; + } + + if (objNum >= 200) + msgNum1 = 0; + + objNum -= 200; + while ((num = *ptr++) != 0) { + if (num == objNum) { + msgNum1 = *ptr++; + msgNum1 += 400; + + if (msgNum1 == 569) + msgNum1 += 400; + if (msgNum2 == 0) + msgNum2 = msgNum1; + return; + } + ptr++; + } + + objNum += 200; + while ((num = *ptr++) != 0) { + if (num == objNum) { + msgNum1 = *ptr++; + msgNum1 += 200; + + if (msgNum1 == 569) + msgNum1 += 400; + if (msgNum2 == 0) + msgNum2 = msgNum1; + return; + } + ptr++; + } + + if (msgNum1 == 569) + msgNum1 += 400; + if (msgNum2 == 0) + msgNum2 = msgNum1; +} + +char *AGOSEngine_PN::getMessage(char *msg, uint16 num) { + char *origPtr, *strPtr1 = msg; + uint8 count; + + getObjectName(strPtr1, num); + if (!(num & 0x8000)) { + return msg; + } + + if (strPtr1[0] == 0x41 || strPtr1[0] == 0x61) { + if (strPtr1[1] != 0x20) + strPtr1 += 2; + } else if (strPtr1[0] == 0x54 || strPtr1[0] == 0x74) { + if (strPtr1[1] == 0x68 && + strPtr1[2] == 0x65 && + strPtr1[3] == 0x20) + strPtr1 += 4; + } + + origPtr = strPtr1; + while (*strPtr1 != 13) + strPtr1++; + + strPtr1[0] = 32; + strPtr1[1] = 13; + strPtr1[2] = 0; + + if (_videoLockOut & 0x10) { + strPtr1 = origPtr; + count = 6; + while (*strPtr1) { + if (*strPtr1 == 32) { + count = 6; + } else { + count--; + if (count == 0) { + char *tmpPtr = strPtr1; + char *strPtr2 = strPtr1; + + while (*strPtr2 != 0 && *strPtr2 != 32) + strPtr2++; + + while (*strPtr2) { + *strPtr1++ = *strPtr2++; + } + *strPtr1++ = *strPtr2++; + + strPtr1 = tmpPtr; + count = 6; + } + } + strPtr1++; + } + } + + return origPtr; +} + +} // End of namespace AGOS diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp index 8e425e0b64..bdf23d5815 100644 --- a/engines/agos/verb.cpp +++ b/engines/agos/verb.cpp @@ -1037,257 +1037,4 @@ void AGOSEngine::invertBox(HitArea *ha, byte a, byte b, byte c, byte d) { _videoLockOut &= ~0x8000; } -#ifdef ENABLE_PN -// Personal Nightmare specific -void AGOSEngine_PN::boxController(uint x, uint y, uint mode) { - HitArea *best_ha; - HitArea *ha = _hitAreaList; - - best_ha = NULL; - - do { - if (!(ha->flags & kOBFBoxDisabled)) { - if (x >= ha->x && y >= ha->y && x - ha->x < ha->width && y - ha->y < ha->height && - best_ha == NULL) { - best_ha = ha; - } else { - if (ha->flags & kOBFBoxSelected) { - hitarea_leave(ha , true); - ha->flags &= ~kOBFBoxSelected; - } - } - } else { - ha->flags &= ~kOBFBoxSelected; - } - } while (ha++, ha->id != 0xFFFF); - - if (mode != 0) { - _lastHitArea = best_ha; - } - - if (best_ha == NULL) { - return; - } - - if (best_ha->flags & kOBFInvertTouch && !(best_ha->flags & kOBFBoxSelected)) { - hitarea_leave(best_ha, false); - best_ha->flags |= kOBFBoxSelected; - } -} - -void AGOSEngine_PN::mouseHit() { - if (_hitCalled == 5) { - execMouseHit(NULL); - } else { - boxController(_mouse.x, _mouse.y, 1); - if (_hitCalled == 4 || _lastHitArea != 0) { - execMouseHit(_lastHitArea); - } - } - _hitCalled = 0; - _oneClick = 0; -} - -void AGOSEngine_PN::execMouseHit(HitArea *ha) { - if (_hitCalled == 1) { - if (ha->flags & kOBFUseMessageList) - hitBox11(ha); - else if (ha->flags & kOBFMoreBox) - hitBox9(ha); - else if (ha->flags & kOBFExit) - hitBox7(ha); - else if (ha->flags & kOBFUseEmptyLine) - hitBox2(ha); - else - hitBox1(ha); - } else if (_hitCalled == 2) { - if (ha->flags & (kOBFObject | kOBFInventoryBox | kOBFRoomBox)) - hitBox3(ha); - else if (ha->flags & kOBFUseMessageList) - hitBox11(ha); - else if (ha->flags & kOBFMoreBox) - hitBox9(ha); - else if (ha->flags & kOBFExit) - hitBox7(ha); - else if (ha->flags & kOBFUseEmptyLine) - hitBox2(ha); - else - hitBox1(ha); - } else if (_hitCalled == 3) { - if ((ha->flags & kOBFDraggable) && !_dragFlag) { - _dragFlag = true; - _dragStore = ha; - _needHitAreaRecalc++; - } - } else if (_hitCalled == 4) { - _dragFlag = false; - _hitCalled = 0; - _oneClick = 0; - _dragCount = 0; - _needHitAreaRecalc++; - if (ha != 0) { - if (ha->flags & kOBFInventoryBox) - hitBox5(ha); - else if (ha->flags & kOBFRoomBox) - hitBox6(ha); - else if (_videoLockOut & 10) - hitBox8(ha); - } - } else { - _hitCalled = 0; - if (_mouseString == 0) { - _mouseString = (const char *)"\r"; - } - } -} - -void AGOSEngine_PN::hitBox1(HitArea *ha) { - if (_mouseString) - return; - - _mouseString = getMessage(_objectName1, ha->msg1); - if (_intputCounter) { - char *msgPtr = getMessage(_objectName1, ha->msg1); - while (*msgPtr != 13) - msgPtr++; - *msgPtr = 0; - } else if (!(ha->flags & kOBFNoShowName)) { - _mousePrintFG++; - _mouseString1 = _mouseString; - _mouseString = (const char*)"showname \0"; - - } -} - -void AGOSEngine_PN::hitBox2(HitArea *ha) { - if (!_intputCounter) - hitBox1(ha); -} - -void AGOSEngine_PN::hitBox3(HitArea *ha) { - if (!_intputCounter) - hitBox4(ha); -} - -void AGOSEngine_PN::hitBox4(HitArea *ha) { - if (_mouseString) - return; - - uint16 num = ha->msg1 & ~0x8000; - if ((_videoLockOut & 0x10) && !(ha->flags & (kOBFInventoryBox | kOBFRoomBox)) && - !testContainer(num)) { - return; - } - - _mouseString = getMessage(_objectName2, ha->msg2); - _mouseString1 = getMessage(_objectName1, ha->msg1); - _mousePrintFG++; -} - -void AGOSEngine_PN::hitBox5(HitArea *ha) { - if (_intputCounter || _mouseString) - return; - - if (_dragStore && (_dragStore->flags & kOBFInventoryBox)) - return; - - _mousePrintFG++; - _mouseString = (const char *)"take \0"; - _mouseString1 = getMessage(_objectName1, _dragStore->msg1); - - if (_dragStore->flags & kOBFRoomBox) - _mouseString1 = (const char *)"all\r"; -} - -void AGOSEngine_PN::hitBox6(HitArea *ha) { - if (_intputCounter || _mouseString) - return; - - if (_dragStore->flags & kOBFRoomBox) - return; - - _mousePrintFG++; - _mouseString = (const char *)"drop \0"; - _mouseString1 = getMessage(_objectName1, _dragStore->msg1); - - if (_dragStore->flags & kOBFInventoryBox) - _mouseString1 = (const char *)"all\r"; -} - -void AGOSEngine_PN::hitBox7(HitArea *ha) { - if (_intputCounter) { - if (!(ha->flags & kOBFUseEmptyLine)) { - hitBox1(ha); - } - return; - } - - if (_mouseString) - return; - - _mousePrintFG++; - _mouseString1 = getMessage(_objectName1, ha->msg1); - - uint16 num = ha->msg1 & ~0x8000; - uint16 state = getptr(_quickptr[0] + num * _quickshort[0] + 2); - if (state == 3) { - _mouseString = (const char *)"unlock \0"; - } else if (state == 2) { - _mouseString = (const char *)"open \0"; - } else { - _mouseString = (const char *)"go through \0"; - } -} - -void AGOSEngine_PN::hitBox8(HitArea *ha) { - char *msgPtr, *tmpPtr; - - if (_intputCounter || _mouseString) - return; - - if (_dragStore == ha) - return; - - uint16 num = ha->msg1 & ~0x8000; - if (!testSeen(num)) - return; - - msgPtr = getMessage(_objectName1, ha->msg1); - sprintf(_inMessage, " in %s", msgPtr); - _mouseString1 = _inMessage; - - msgPtr = getMessage(_objectName1, _dragStore->msg1); - *(tmpPtr = strchr(msgPtr, 13)) = 0; - sprintf(_placeMessage, "put %s", msgPtr); - _mouseString = _placeMessage; -} - -void AGOSEngine_PN::hitBox9(HitArea *ha) { - if (_objectCountS == _objects) { - _objectCountS = -1; - } - iconPage(); -} - -static const char *messageList[9] = { - "North\r", - "East\r", - "South\r", - "West\r", - "Up\r", - "Down\r", - "Push grey button\r", - "Push red button\r", - "Go under car\r" -}; - -void AGOSEngine_PN::hitBox11(HitArea *ha) { - if (_intputCounter || _mouseString) - return; - - _mouseString = messageList[ha->msg1]; - _mousePrintFG++; -} -#endif - } // End of namespace AGOS diff --git a/engines/agos/verb_pn.cpp b/engines/agos/verb_pn.cpp new file mode 100644 index 0000000000..129e1dec0e --- /dev/null +++ b/engines/agos/verb_pn.cpp @@ -0,0 +1,284 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +// Verb and hitarea handling + + +#include "agos/agos.h" +#include "agos/intern.h" + +namespace AGOS { + +void AGOSEngine_PN::boxController(uint x, uint y, uint mode) { + HitArea *best_ha; + HitArea *ha = _hitAreaList; + + best_ha = NULL; + + do { + if (!(ha->flags & kOBFBoxDisabled)) { + if (x >= ha->x && y >= ha->y && x - ha->x < ha->width && y - ha->y < ha->height && + best_ha == NULL) { + best_ha = ha; + } else { + if (ha->flags & kOBFBoxSelected) { + hitarea_leave(ha , true); + ha->flags &= ~kOBFBoxSelected; + } + } + } else { + ha->flags &= ~kOBFBoxSelected; + } + } while (ha++, ha->id != 0xFFFF); + + if (mode != 0) { + _lastHitArea = best_ha; + } + + if (best_ha == NULL) { + return; + } + + if (best_ha->flags & kOBFInvertTouch && !(best_ha->flags & kOBFBoxSelected)) { + hitarea_leave(best_ha, false); + best_ha->flags |= kOBFBoxSelected; + } +} + +void AGOSEngine_PN::mouseHit() { + if (_hitCalled == 5) { + execMouseHit(NULL); + } else { + boxController(_mouse.x, _mouse.y, 1); + if (_hitCalled == 4 || _lastHitArea != 0) { + execMouseHit(_lastHitArea); + } + } + _hitCalled = 0; + _oneClick = 0; +} + +void AGOSEngine_PN::execMouseHit(HitArea *ha) { + if (_hitCalled == 1) { + if (ha->flags & kOBFUseMessageList) + hitBox11(ha); + else if (ha->flags & kOBFMoreBox) + hitBox9(ha); + else if (ha->flags & kOBFExit) + hitBox7(ha); + else if (ha->flags & kOBFUseEmptyLine) + hitBox2(ha); + else + hitBox1(ha); + } else if (_hitCalled == 2) { + if (ha->flags & (kOBFObject | kOBFInventoryBox | kOBFRoomBox)) + hitBox3(ha); + else if (ha->flags & kOBFUseMessageList) + hitBox11(ha); + else if (ha->flags & kOBFMoreBox) + hitBox9(ha); + else if (ha->flags & kOBFExit) + hitBox7(ha); + else if (ha->flags & kOBFUseEmptyLine) + hitBox2(ha); + else + hitBox1(ha); + } else if (_hitCalled == 3) { + if ((ha->flags & kOBFDraggable) && !_dragFlag) { + _dragFlag = true; + _dragStore = ha; + _needHitAreaRecalc++; + } + } else if (_hitCalled == 4) { + _dragFlag = false; + _hitCalled = 0; + _oneClick = 0; + _dragCount = 0; + _needHitAreaRecalc++; + if (ha != 0) { + if (ha->flags & kOBFInventoryBox) + hitBox5(ha); + else if (ha->flags & kOBFRoomBox) + hitBox6(ha); + else if (_videoLockOut & 10) + hitBox8(ha); + } + } else { + _hitCalled = 0; + if (_mouseString == 0) { + _mouseString = (const char *)"\r"; + } + } +} + +void AGOSEngine_PN::hitBox1(HitArea *ha) { + if (_mouseString) + return; + + _mouseString = getMessage(_objectName1, ha->msg1); + if (_intputCounter) { + char *msgPtr = getMessage(_objectName1, ha->msg1); + while (*msgPtr != 13) + msgPtr++; + *msgPtr = 0; + } else if (!(ha->flags & kOBFNoShowName)) { + _mousePrintFG++; + _mouseString1 = _mouseString; + _mouseString = (const char*)"showname \0"; + + } +} + +void AGOSEngine_PN::hitBox2(HitArea *ha) { + if (!_intputCounter) + hitBox1(ha); +} + +void AGOSEngine_PN::hitBox3(HitArea *ha) { + if (!_intputCounter) + hitBox4(ha); +} + +void AGOSEngine_PN::hitBox4(HitArea *ha) { + if (_mouseString) + return; + + uint16 num = ha->msg1 & ~0x8000; + if ((_videoLockOut & 0x10) && !(ha->flags & (kOBFInventoryBox | kOBFRoomBox)) && + !testContainer(num)) { + return; + } + + _mouseString = getMessage(_objectName2, ha->msg2); + _mouseString1 = getMessage(_objectName1, ha->msg1); + _mousePrintFG++; +} + +void AGOSEngine_PN::hitBox5(HitArea *ha) { + if (_intputCounter || _mouseString) + return; + + if (_dragStore && (_dragStore->flags & kOBFInventoryBox)) + return; + + _mousePrintFG++; + _mouseString = (const char *)"take \0"; + _mouseString1 = getMessage(_objectName1, _dragStore->msg1); + + if (_dragStore->flags & kOBFRoomBox) + _mouseString1 = (const char *)"all\r"; +} + +void AGOSEngine_PN::hitBox6(HitArea *ha) { + if (_intputCounter || _mouseString) + return; + + if (_dragStore->flags & kOBFRoomBox) + return; + + _mousePrintFG++; + _mouseString = (const char *)"drop \0"; + _mouseString1 = getMessage(_objectName1, _dragStore->msg1); + + if (_dragStore->flags & kOBFInventoryBox) + _mouseString1 = (const char *)"all\r"; +} + +void AGOSEngine_PN::hitBox7(HitArea *ha) { + if (_intputCounter) { + if (!(ha->flags & kOBFUseEmptyLine)) { + hitBox1(ha); + } + return; + } + + if (_mouseString) + return; + + _mousePrintFG++; + _mouseString1 = getMessage(_objectName1, ha->msg1); + + uint16 num = ha->msg1 & ~0x8000; + uint16 state = getptr(_quickptr[0] + num * _quickshort[0] + 2); + if (state == 3) { + _mouseString = (const char *)"unlock \0"; + } else if (state == 2) { + _mouseString = (const char *)"open \0"; + } else { + _mouseString = (const char *)"go through \0"; + } +} + +void AGOSEngine_PN::hitBox8(HitArea *ha) { + char *msgPtr, *tmpPtr; + + if (_intputCounter || _mouseString) + return; + + if (_dragStore == ha) + return; + + uint16 num = ha->msg1 & ~0x8000; + if (!testSeen(num)) + return; + + msgPtr = getMessage(_objectName1, ha->msg1); + sprintf(_inMessage, " in %s", msgPtr); + _mouseString1 = _inMessage; + + msgPtr = getMessage(_objectName1, _dragStore->msg1); + *(tmpPtr = strchr(msgPtr, 13)) = 0; + sprintf(_placeMessage, "put %s", msgPtr); + _mouseString = _placeMessage; +} + +void AGOSEngine_PN::hitBox9(HitArea *ha) { + if (_objectCountS == _objects) { + _objectCountS = -1; + } + iconPage(); +} + +static const char *messageList[9] = { + "North\r", + "East\r", + "South\r", + "West\r", + "Up\r", + "Down\r", + "Push grey button\r", + "Push red button\r", + "Go under car\r" +}; + +void AGOSEngine_PN::hitBox11(HitArea *ha) { + if (_intputCounter || _mouseString) + return; + + _mouseString = messageList[ha->msg1]; + _mousePrintFG++; +} + +} // End of namespace AGOS diff --git a/engines/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp index 27152ef2dd..d249259ba6 100644 --- a/engines/agos/vga_pn.cpp +++ b/engines/agos/vga_pn.cpp @@ -23,8 +23,6 @@ * */ -#ifdef ENABLE_PN - #include "agos/agos.h" #include "agos/intern.h" #include "agos/vga.h" @@ -219,5 +217,3 @@ void AGOSEngine_PN::clearVideoWindow(uint16 num, uint16 color) { } } // End of namespace AGOS - -#endif // ENABLE_PN diff --git a/engines/engines.mk b/engines/engines.mk index ff2b7c0a3e..b73f45b8e6 100644 --- a/engines/engines.mk +++ b/engines/engines.mk @@ -21,10 +21,6 @@ ifdef ENABLE_AGOS DEFINES += -DENABLE_AGOS=$(ENABLE_AGOS) MODULES += engines/agos -ifdef ENABLE_PN -DEFINES += -DENABLE_PN -endif - ifdef ENABLE_AGOS2 DEFINES += -DENABLE_AGOS2 endif -- cgit v1.2.3 From ca7b4db0ae66fd93b5d4da91e067c80be6c50d3f Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Wed, 12 Aug 2009 07:37:45 +0000 Subject: Removed duplicated functions. svn-id: r43314 --- engines/agos/input.cpp | 137 ------------------------------------------------- 1 file changed, 137 deletions(-) (limited to 'engines') diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp index 82747dbfb9..35ed045675 100644 --- a/engines/agos/input.cpp +++ b/engines/agos/input.cpp @@ -624,141 +624,4 @@ bool AGOSEngine::processSpecialKeys() { return verbCode; } -// Personal Nightmare specific -void AGOSEngine_PN::clearInputLine() { - _inputting = false; - _inputReady = false; - clearWindow(_windowArray[2]); -} - -void AGOSEngine_PN::handleKeyboard() { - if (!_inputReady) - return; - - if (_hitCalled != 0) { - mouseHit(); - } - - int16 chr = -1; - if (_mouseString) { - const char *strPtr = _mouseString; - while (*strPtr != 0 && *strPtr != 13) - addChar(*strPtr++); - _mouseString = 0; - - chr = *strPtr; - if (chr == 13) { - addChar(13); - } - } - if (_mouseString1 && chr != 13) { - const char *strPtr = _mouseString1; - while (*strPtr != 13) - addChar(*strPtr++); - _mouseString1 = 0; - - chr = *strPtr; - if (chr == 13) { - addChar(13); - } - } - if (chr == -1) { - if (_keyPressed.keycode == Common::KEYCODE_BACKSPACE || _keyPressed.keycode == Common::KEYCODE_RETURN) { - chr = _keyPressed.keycode; - addChar(chr); - } else if (!(_videoLockOut & 0x10)) { - chr = _keyPressed.ascii; - if (chr >= 32) - addChar(chr); - } - } - - if (chr == 13) { - _mouseString = 0; - _mouseString1 = 0; - _mousePrintFG = 0; - _inputReady = false; - } - - _keyPressed.reset(); -} - -void AGOSEngine_PN::interact(char *buffer, uint8 size) { - if (!_inputting) { - memset(_keyboardBuffer, 0, sizeof(_keyboardBuffer)); - _intputCounter = 0; - _inputMax = size; - _inputWindow = _windowArray[_curWindow]; - windowPutChar(_inputWindow, 128); - windowPutChar(_inputWindow, 8); - _inputting = true; - _inputReady = true; - } - - while (!shouldQuit() && _inputReady) { - if (!_noScanFlag && _scanFlag) { - buffer[0] = 1; - buffer[1] = 0; - _scanFlag = 0; - break; - } - delay(1); - } - - if (!_inputReady) { - memcpy(buffer, _keyboardBuffer, size); - _inputting = false; - } -} - -void AGOSEngine_PN::addChar(uint8 chr) { - if (chr == 13) { - _keyboardBuffer[_intputCounter++] = chr; - windowPutChar(_inputWindow, 13); - } else if (chr == 8 && _intputCounter) { - clearCursor(_inputWindow); - windowPutChar(_inputWindow, 8); - windowPutChar(_inputWindow, 128); - windowPutChar(_inputWindow, 8); - - _keyboardBuffer[--_intputCounter] = 0; - } else if (chr >= 32 && _intputCounter < _inputMax) { - _keyboardBuffer[_intputCounter++] = chr; - - clearCursor(_inputWindow); - windowPutChar(_inputWindow, chr); - windowPutChar(_inputWindow, 128); - windowPutChar(_inputWindow, 8); - } -} - -void AGOSEngine_PN::clearCursor(WindowBlock *window) { - byte oldTextColor = window->textColor; - - window->textColor = window->fillColor; - windowPutChar(window, 128); - window->textColor = oldTextColor; - - windowPutChar(window, 8); -} - -bool AGOSEngine_PN::processSpecialKeys() { - if (shouldQuit()) - _exitCutscene = true; - - switch (_keyPressed.keycode) { - case Common::KEYCODE_ESCAPE: - _exitCutscene = true; - break; - case Common::KEYCODE_PAUSE: - pause(); - break; - default: - break; - } - - _keyPressed.reset(); - return false; -} - } // End of namespace AGOS -- cgit v1.2.3 From 8086aff0511bef674d7e981f74392b2cceafd386 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Aug 2009 17:10:47 +0000 Subject: Implement difference for the Kyrandia 1 Amiga version in TextDisplayer::printCharacterText. svn-id: r43320 --- engines/kyra/text.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp index 20094a45ab..a20e94fc1f 100644 --- a/engines/kyra/text.cpp +++ b/engines/kyra/text.cpp @@ -226,19 +226,25 @@ void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, } void TextDisplayer::printCharacterText(const char *text, int8 charNum, int charX) { - uint8 colorTable[] = {0x0F, 0x09, 0xC9, 0x80, 0x5, 0x81, 0x0E, 0xD8, 0x55, 0x3A, 0x3a}; int top, left, x1, x2, w, x; char *msg; - uint8 color = colorTable[charNum]; text = preprocessString(text); int lineCount = buildMessageSubstrings(text); w = getWidestLineWidth(lineCount); x = charX; calcWidestLineBounds(x1, x2, w, x); - if (_vm->gameFlags().platform == Common::kPlatformAmiga) + uint8 color = 0; + if (_vm->gameFlags().platform == Common::kPlatformAmiga) { + const uint8 colorTable[] = { 0x1F, 0x1B, 0xC9, 0x80, 0x1E, 0x81, 0x11, 0xD8, 0x55, 0x3A, 0x3A }; + color = colorTable[charNum]; + setTextColor(color); + } else { + const uint8 colorTable[] = { 0x0F, 0x09, 0xC9, 0x80, 0x05, 0x81, 0x0E, 0xD8, 0x55, 0x3A, 0x3A }; + color = colorTable[charNum]; + } for (int i = 0; i < lineCount; ++i) { top = i * 10 + _talkMessageY; -- cgit v1.2.3 From f7464020a0e74978ec574d13a575228f84784087 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Aug 2009 17:11:04 +0000 Subject: Cleanup. svn-id: r43321 --- engines/kyra/sequences_lok.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index 97e37013cb..bfef591193 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -1215,12 +1215,13 @@ void KyraEngine_LoK::seq_playCredits() { currentString++; if (!_flags.isTalkie && _flags.platform != Common::kPlatformAmiga) _screen->setFont(Screen::FID_CRED6_FNT); - } else { - if (*currentString == 2) - currentString++; + } else if (*currentString == 2) + currentString++; + if (!_flags.isTalkie && _flags.platform != Common::kPlatformAmiga) _screen->setFont(Screen::FID_CRED8_FNT); } + strings[i].font = _screen->_currentFont; if (strings[i].unk1 == 3) -- cgit v1.2.3 From 20577c15749deb517396931460d7545c665776a8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Aug 2009 17:13:46 +0000 Subject: Oops forgot a "{". svn-id: r43322 --- engines/kyra/sequences_lok.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index bfef591193..0c09a56586 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -1215,7 +1215,7 @@ void KyraEngine_LoK::seq_playCredits() { currentString++; if (!_flags.isTalkie && _flags.platform != Common::kPlatformAmiga) _screen->setFont(Screen::FID_CRED6_FNT); - } else if (*currentString == 2) + } else if (*currentString == 2) { currentString++; if (!_flags.isTalkie && _flags.platform != Common::kPlatformAmiga) -- cgit v1.2.3 From 06657efc15fa73abe41002694ae1673b3c7f6ba5 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Aug 2009 18:05:41 +0000 Subject: Further cleaning up credits player code for Kyra1. svn-id: r43323 --- engines/kyra/sequences_lok.cpp | 84 ++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 35 deletions(-) (limited to 'engines') diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index 0c09a56586..742f96e5e2 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -36,6 +36,7 @@ #include "common/system.h" #include "common/savefile.h" +#include "common/list.h" namespace Kyra { @@ -1136,20 +1137,20 @@ void KyraEngine_LoK::seq_playEnding() { seq_playCredits(); } +namespace { +struct CreditsLine { + int16 x, y; + Screen::FontId font; + uint8 *str; +}; +} // end of anonymous namespace + void KyraEngine_LoK::seq_playCredits() { static const uint8 colorMap[] = { 0, 0, 0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const char stringTerms[] = { 0x5, 0xd, 0x0}; - static const int numStrings = 250; - - struct { - int16 x, y; - uint8 code; - uint8 unk1; - Screen::FontId font; - uint8 *str; - } strings[numStrings]; - memset(strings, 0, sizeof(strings)); + typedef Common::List CreditsLineList; + CreditsLineList lines; _screen->enableInterfacePalette(false); @@ -1157,6 +1158,8 @@ void KyraEngine_LoK::seq_playCredits() { if (!_flags.isTalkie && _flags.platform != Common::kPlatformAmiga) { _screen->loadFont(Screen::FID_CRED6_FNT, "CREDIT6.FNT"); _screen->loadFont(Screen::FID_CRED8_FNT, "CREDIT8.FNT"); + + _screen->setFont(Screen::FID_CRED8_FNT); } else _screen->setFont(Screen::FID_8_FNT); @@ -1192,27 +1195,28 @@ void KyraEngine_LoK::seq_playCredits() { uint8 *currentString = buffer; int currentY = 200; - for (int i = 0; i < numStrings; i++) { - if (*nextString == 0) - break; - + do { currentString = nextString; nextString = (uint8 *)strpbrk((const char *)currentString, stringTerms); if (!nextString) nextString = (uint8 *)strchr((const char *)currentString, 0); - strings[i].code = nextString[0]; + CreditsLine line; + + int lineEndCode = nextString[0]; *nextString = 0; - if (strings[i].code != 0) + if (lineEndCode != 0) nextString++; + int alignment = 0; if (*currentString == 3 || *currentString == 4) { - strings[i].unk1 = *currentString; + alignment = *currentString; currentString++; } if (*currentString == 1) { currentString++; + if (!_flags.isTalkie && _flags.platform != Common::kPlatformAmiga) _screen->setFont(Screen::FID_CRED6_FNT); } else if (*currentString == 2) { @@ -1222,21 +1226,23 @@ void KyraEngine_LoK::seq_playCredits() { _screen->setFont(Screen::FID_CRED8_FNT); } - strings[i].font = _screen->_currentFont; + line.font = _screen->_currentFont; - if (strings[i].unk1 == 3) - strings[i].x = 157 - _screen->getTextWidth((const char *)currentString); - else if (strings[i].unk1 == 4) - strings[i].x = 161; + if (alignment == 3) + line.x = 157 - _screen->getTextWidth((const char *)currentString); + else if (alignment == 4) + line.x = 161; else - strings[i].x = (320 - _screen->getTextWidth((const char *)currentString)) / 2 + 1; + line.x = (320 - _screen->getTextWidth((const char *)currentString)) / 2 + 1; - strings[i].y = currentY; - if (strings[i].code != 5) + line.y = currentY; + if (lineEndCode != 5) currentY += 10; - strings[i].str = currentString; - } + line.str = currentString; + + lines.push_back(line); + } while (*nextString); _screen->setCurPage(2); @@ -1257,16 +1263,24 @@ void KyraEngine_LoK::seq_playCredits() { _screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 2, Screen::CR_NO_P_CHECK); bottom = 0; - for (int i = 0; i < numStrings; i++) { - if (strings[i].y < 200 && strings[i].y > 0) { - if (strings[i].font != _screen->_currentFont) - _screen->setFont(strings[i].font); - _screen->printText((const char *)strings[i].str, strings[i].x, strings[i].y, 15, 0); + for (CreditsLineList::iterator it = lines.begin(); it != lines.end(); ++it) { + if (it->y < 0) { + it = lines.erase(it); + continue; } - strings[i].y--; - if (strings[i].y > bottom) - bottom = strings[i].y; + + if (it->y < 200) { + if (it->font != _screen->_currentFont) + _screen->setFont(it->font); + + _screen->printText((const char *)it->str, it->x, it->y, 15, 0); + } + + it->y--; + if (it->y > bottom) + bottom = it->y; } + _screen->copyRegion(8, 32, 8, 32, 312, 128, 2, 0, Screen::CR_NO_P_CHECK); _screen->updateScreen(); } -- cgit v1.2.3 From 949ade74f0b5e10cb31dca4d88b705309b10cc96 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Aug 2009 18:06:32 +0000 Subject: Fix graphics glitch in credits of Kyrandia 1 German. svn-id: r43324 --- engines/kyra/sequences_lok.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index 742f96e5e2..6c37f51f26 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -1251,7 +1251,7 @@ void KyraEngine_LoK::seq_playCredits() { if (_flags.platform == Common::kPlatformAmiga) _screen->setPaletteIndex(16, 63, 63, 63); - _screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 0, Screen::CR_NO_P_CHECK); + _screen->copyRegion(0, 32, 0, 32, 320, 128, 4, 0, Screen::CR_NO_P_CHECK); _screen->fadePalette(_screen->getPalette(0), 0x5A); Common::Event event; @@ -1260,7 +1260,7 @@ void KyraEngine_LoK::seq_playCredits() { while (!finished) { uint32 startLoop = _system->getMillis(); if (bottom > 175) { - _screen->copyRegion(8, 32, 8, 32, 312, 128, 4, 2, Screen::CR_NO_P_CHECK); + _screen->copyRegion(0, 32, 0, 32, 320, 128, 4, 2, Screen::CR_NO_P_CHECK); bottom = 0; for (CreditsLineList::iterator it = lines.begin(); it != lines.end(); ++it) { @@ -1281,7 +1281,7 @@ void KyraEngine_LoK::seq_playCredits() { bottom = it->y; } - _screen->copyRegion(8, 32, 8, 32, 312, 128, 2, 0, Screen::CR_NO_P_CHECK); + _screen->copyRegion(0, 32, 0, 32, 320, 128, 2, 0, Screen::CR_NO_P_CHECK); _screen->updateScreen(); } -- cgit v1.2.3 From 73f38d97b587f1164fa559cf6e140e397ae54581 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Aug 2009 18:07:27 +0000 Subject: Add a slight paranoia check to drawCharANSI. svn-id: r43325 --- engines/kyra/screen.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines') diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 8d4ea7e022..bc1ccbb801 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1190,6 +1190,8 @@ void Screen::drawCharANSI(uint8 c, int x, int y) { const int charWidth = fnt->getCharWidth(c); const int charHeight = fnt->getHeight(); + if (x < 0 || y < 0) + return; if (x + charWidth > SCREEN_W || y + charHeight > SCREEN_H) return; -- cgit v1.2.3 From 8ea2316c3b16d904f9bfb9804464f1ca36076a5d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Aug 2009 18:08:01 +0000 Subject: Put some more IHNM / SAGA2 specific code into compile guards. svn-id: r43326 --- engines/saga/displayinfo.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines') diff --git a/engines/saga/displayinfo.h b/engines/saga/displayinfo.h index 092d7d4e91..b29f709323 100644 --- a/engines/saga/displayinfo.h +++ b/engines/saga/displayinfo.h @@ -281,6 +281,8 @@ static const GameDisplayInfo ITE_DisplayInfo = { }; +#if defined(ENABLE_IHNM) || defined(ENABLE_SAGA2) + // IHNM #define IHNM_CONVERSE_MAX_TEXT_WIDTH (485 - 8) #define IHNM_CONVERSE_TEXT_HEIGHT 10 @@ -361,7 +363,10 @@ static PanelButton IHNM_SavePanelButtons[] = { {kPanelButtonSaveText, -1,30, 0,0, kTextEnterSaveGameName,'-',0, 0,0,0}, }; +#endif + #ifdef ENABLE_IHNM + static const GameDisplayInfo IHNM_DisplayInfo = { 640, 480, // logical width&height -- cgit v1.2.3 From 71750b6d06455728dcc1472c192403c1b029975e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Aug 2009 22:05:09 +0000 Subject: Implement special Kyrandia 1 Amiga credits text scroller. svn-id: r43329 --- engines/kyra/kyra_lok.h | 1 + engines/kyra/sequences_lok.cpp | 148 +++++++++++++++++++++++++++++++++++------ 2 files changed, 129 insertions(+), 20 deletions(-) (limited to 'engines') diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h index e22cc0d997..e7cc92c5e1 100644 --- a/engines/kyra/kyra_lok.h +++ b/engines/kyra/kyra_lok.h @@ -192,6 +192,7 @@ protected: // -> credits void seq_playCredits(); + void seq_playCreditsAmiga(); public: // delay diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index 6c37f51f26..8425bf9b0c 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -1134,7 +1134,12 @@ void KyraEngine_LoK::seq_playEnding() { _seqPlayerFlag = false; _screen->showMouse(); - seq_playCredits(); + if (_flags.platform == Common::kPlatformAmiga) { + while (!shouldQuit()) + seq_playCreditsAmiga(); + } else { + seq_playCredits(); + } } namespace { @@ -1177,8 +1182,7 @@ void KyraEngine_LoK::seq_playCredits() { uint8 *buffer = 0; uint32 size = 0; - if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98 - || _flags.platform == Common::kPlatformAmiga) { + if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) { int sizeTmp = 0; const uint8 *bufferTmp = _staticres->loadRawData(k1CreditsStrings, sizeTmp); buffer = new uint8[sizeTmp]; @@ -1248,17 +1252,15 @@ void KyraEngine_LoK::seq_playCredits() { _screen->getPalette(2).clear(); _screen->setScreenPalette(_screen->getPalette(2)); - if (_flags.platform == Common::kPlatformAmiga) - _screen->setPaletteIndex(16, 63, 63, 63); _screen->copyRegion(0, 32, 0, 32, 320, 128, 4, 0, Screen::CR_NO_P_CHECK); _screen->fadePalette(_screen->getPalette(0), 0x5A); - Common::Event event; bool finished = false; int bottom = 201; - while (!finished) { + while (!finished && !shouldQuit()) { uint32 startLoop = _system->getMillis(); + if (bottom > 175) { _screen->copyRegion(0, 32, 0, 32, 320, 128, 4, 2, Screen::CR_NO_P_CHECK); bottom = 0; @@ -1285,19 +1287,8 @@ void KyraEngine_LoK::seq_playCredits() { _screen->updateScreen(); } - while (_eventMan->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_KEYDOWN: - finished = true; - break; - case Common::EVENT_RTL: - case Common::EVENT_QUIT: - finished = true; - break; - default: - break; - } - } + if (checkInput(0, false)) + finished = true; uint32 now = _system->getMillis(); uint32 nextLoop = startLoop + _tickLength * 5; @@ -1313,6 +1304,123 @@ void KyraEngine_LoK::seq_playCredits() { _screen->showMouse(); } +void KyraEngine_LoK::seq_playCreditsAmiga() { + _screen->setFont(Screen::FID_8_FNT); + + _screen->loadBitmap("CHALET.CPS", 4, 2, &_screen->getPalette(0)); + _screen->copyPage(2, 0); + _screen->setCurPage(2); + + _screen->getPalette(2).clear(); + _screen->setScreenPalette(_screen->getPalette(2)); + + _screen->getPalette(0).fill(16, 1, 63); + _screen->fadePalette(_screen->getPalette(0), 0x5A); + + const char *theEnd = "THE END"; + + const int width = _screen->getTextWidth(theEnd); + int x = (320 - width) / 2 + 1; + + _screen->copyRegion(x, 8, x, 8, width, 56, 0, 2, Screen::CR_NO_P_CHECK); + _screen->copyRegion(x, 8, 0, 8, width, 11, 0, 2, Screen::CR_NO_P_CHECK); + _screen->printText(theEnd, 0, 10, 31, 0); + + for (int y = 18, h = 1; y >= 10 && !shouldQuit(); --y, ++h) { + uint32 endTime = _system->getMillis() + 3 * _tickLength; + + _screen->copyRegion(0, y, x, 8, width, h, 2, 0, Screen::CR_NO_P_CHECK); + _screen->updateScreen(); + + delayUntil(endTime); + } + + for (int y = 8; y <= 62 && !shouldQuit(); ++y) { + uint32 endTime = _system->getMillis() + 3 * _tickLength; + + _screen->copyRegion(x, y, 0, 8, width, 11, 2, 2, Screen::CR_NO_P_CHECK); + _screen->printText(theEnd, 0, 9, 31, 0); + _screen->copyRegion(0, 8, x, y, width, 11, 2, 0, Screen::CR_NO_P_CHECK); + _screen->updateScreen(); + + delayUntil(endTime); + } + + int size = 0; + const uint8 *bufferTmp = _staticres->loadRawData(k1CreditsStrings, size); + char *buffer = new char[size]; + assert(buffer); + memcpy(buffer, bufferTmp, size); + _staticres->unloadId(k1CreditsStrings); + + char stringBuffer[81]; + memset(stringBuffer, 0, sizeof(stringBuffer)); + + char *cur = buffer; + char *specialString = stringBuffer; + bool fillRectFlag = false, subWidth = false, centerFlag = false; + x = 0; + int specialX = 0; + + const int fontHeight = _screen->getFontHeight(); + + do { + char code = *cur; + + if (code == 3) { + fillRectFlag = subWidth = true; + } else if (code == 5) { + centerFlag = true; + } else if (code == 4) { + if (fillRectFlag) { + _screen->fillRect(0, 0, 319, 20, 0); + + if (subWidth) + specialX = 157 - _screen->getTextWidth(stringBuffer); + + _screen->printText(stringBuffer, specialX + 8, 0, 31, 0); + } + + specialString = stringBuffer; + *specialString = 0; + + x = 161; + } else if (code == 13) { + if (!fillRectFlag) + _screen->fillRect(0, 0, 319, 20, 0); + + uint32 nextTime = _system->getMillis() + 8 * _tickLength; + + if (centerFlag) + x = (320 - _screen->getTextWidth(stringBuffer)) / 2 - 8; + + _screen->printText(stringBuffer, x + 8, 0, 31, 0); + + for (int i = 0; i < fontHeight; ++i) { + _screen->copyRegion(0, 141, 0, 140, 320, 59, 0, 0, Screen::CR_NO_P_CHECK); + _screen->copyRegion(0, i, 0, 198, 320, 3, 2, 0, Screen::CR_NO_P_CHECK); + _screen->updateScreen(); + + delayUntil(nextTime); + nextTime = _system->getMillis() + 8 * _tickLength; + } + + specialString = stringBuffer; + *specialString = 0; + + centerFlag = fillRectFlag = false; + } else { + *specialString++ = code; + *specialString = 0; + } + + if (checkInput(0, false)) + break; + } while (++cur != buffer + size && !shouldQuit()); + + delete[] buffer; +} + bool KyraEngine_LoK::seq_skipSequence() const { return shouldQuit() || _abortIntroFlag; } -- cgit v1.2.3