diff options
-rwxr-xr-x | configure | 3 | ||||
-rw-r--r-- | dists/msvc8/ScummVM_Global.vsprops | 2 | ||||
-rw-r--r-- | dists/msvc8/agos.vcproj | 3 | ||||
-rw-r--r-- | dists/msvc9/ScummVM_Global.vsprops | 2 | ||||
-rw-r--r-- | dists/msvc9/agos.vcproj | 3 | ||||
-rw-r--r-- | engines/agos/agos.cpp | 2 | ||||
-rw-r--r-- | engines/agos/agos.h | 2 | ||||
-rw-r--r-- | engines/agos/charset.cpp | 2 | ||||
-rw-r--r-- | engines/agos/cursor.cpp | 2 | ||||
-rw-r--r-- | engines/agos/detection.cpp | 4 | ||||
-rw-r--r-- | engines/agos/detection_tables.h | 2 | ||||
-rw-r--r-- | engines/agos/event.cpp | 2 | ||||
-rw-r--r-- | engines/agos/gfx.cpp | 2 | ||||
-rw-r--r-- | engines/agos/icons.cpp | 2 | ||||
-rw-r--r-- | engines/agos/input.cpp | 2 | ||||
-rw-r--r-- | engines/agos/input_pn.cpp | 169 | ||||
-rw-r--r-- | engines/agos/module.mk | 13 | ||||
-rw-r--r-- | engines/agos/pn.cpp | 4 | ||||
-rw-r--r-- | engines/agos/res.cpp | 2 | ||||
-rw-r--r-- | engines/agos/saveload.cpp | 2 | ||||
-rw-r--r-- | engines/agos/script_pn.cpp | 4 | ||||
-rw-r--r-- | engines/agos/string.cpp | 644 | ||||
-rw-r--r-- | engines/agos/string_pn.cpp | 674 | ||||
-rw-r--r-- | engines/agos/verb.cpp | 253 | ||||
-rw-r--r-- | engines/agos/verb_pn.cpp | 284 | ||||
-rw-r--r-- | engines/agos/vga_pn.cpp | 4 | ||||
-rw-r--r-- | engines/engines.mk | 4 |
27 files changed, 1142 insertions, 950 deletions
@@ -70,8 +70,7 @@ add_engine scumm "SCUMM" yes "scumm_7_8 he" add_engine scumm_7_8 "v7 & v8 games" yes add_engine he "HE71+ games" yes add_engine agi "AGI" yes -add_engine agos "AGOS" yes "pn agos2" -add_engine pn "Personal Nightmare" no +add_engine agos "AGOS" yes "agos2" add_engine agos2 "AGOS 2 games" yes add_engine cine "Cinematique evo 1" yes add_engine cruise "Cinematique evo 2" yes diff --git a/dists/msvc8/ScummVM_Global.vsprops b/dists/msvc8/ScummVM_Global.vsprops index b1f6315d03..afcfab102b 100644 --- a/dists/msvc8/ScummVM_Global.vsprops +++ b/dists/msvc8/ScummVM_Global.vsprops @@ -10,7 +10,7 @@ Name="VCCLCompilerTool" DisableSpecificWarnings="4068;4100;4103;4121;4127;4189;4201;4221;4244;4250;4310;4351;4355;4510;4511;4512;4610;4701;4702;4706;4800;4996" AdditionalIncludeDirectories="../..;../../engines" - PreprocessorDefinitions="USE_NASM;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_AGOS2;ENABLE_PN;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LOL;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="USE_NASM;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_AGOS2;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LOL;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" ExceptionHandling="0" RuntimeTypeInfo="false" WarningLevel="4" diff --git a/dists/msvc8/agos.vcproj b/dists/msvc8/agos.vcproj index 5d6fe215b2..9dab1b3110 100644 --- a/dists/msvc8/agos.vcproj +++ b/dists/msvc8/agos.vcproj @@ -35,6 +35,7 @@ <File RelativePath="..\..\engines\agos\gfx.cpp" /> <File RelativePath="..\..\engines\agos\icons.cpp" /> <File RelativePath="..\..\engines\agos\input.cpp" /> + <File RelativePath="..\..\engines\agos\input_pn.cpp" /> <File RelativePath="..\..\engines\agos\intern.h" /> <File RelativePath="..\..\engines\agos\items.cpp" /> <File RelativePath="..\..\engines\agos\menus.cpp" /> @@ -60,8 +61,10 @@ <File RelativePath="..\..\engines\agos\sound.cpp" /> <File RelativePath="..\..\engines\agos\sound.h" /> <File RelativePath="..\..\engines\agos\string.cpp" /> + <File RelativePath="..\..\engines\agos\string_pn.cpp" /> <File RelativePath="..\..\engines\agos\subroutine.cpp" /> <File RelativePath="..\..\engines\agos\verb.cpp" /> + <File RelativePath="..\..\engines\agos\verb_pn.cpp" /> <File RelativePath="..\..\engines\agos\vga.cpp" /> <File RelativePath="..\..\engines\agos\vga.h" /> <File RelativePath="..\..\engines\agos\vga_e2.cpp" /> diff --git a/dists/msvc9/ScummVM_Global.vsprops b/dists/msvc9/ScummVM_Global.vsprops index b1f6315d03..afcfab102b 100644 --- a/dists/msvc9/ScummVM_Global.vsprops +++ b/dists/msvc9/ScummVM_Global.vsprops @@ -10,7 +10,7 @@ Name="VCCLCompilerTool" DisableSpecificWarnings="4068;4100;4103;4121;4127;4189;4201;4221;4244;4250;4310;4351;4355;4510;4511;4512;4610;4701;4702;4706;4800;4996" AdditionalIncludeDirectories="../..;../../engines" - PreprocessorDefinitions="USE_NASM;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_AGOS2;ENABLE_PN;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LOL;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" + PreprocessorDefinitions="USE_NASM;USE_ZLIB;USE_MAD;USE_VORBIS;USE_MPEG2;USE_MT32EMU;ENABLE_AGI;ENABLE_AGOS;ENABLE_AGOS2;ENABLE_CINE;ENABLE_CRUISE;ENABLE_DRASCULA;ENABLE_GOB;ENABLE_IGOR;ENABLE_KYRA;ENABLE_LOL;ENABLE_LURE;ENABLE_M4;ENABLE_MADE;ENABLE_PARALLACTION;ENABLE_QUEEN;ENABLE_SAGA;ENABLE_IHNM;ENABLE_SAGA2;ENABLE_SCI;ENABLE_SCUMM;ENABLE_SKY;ENABLE_SWORD1;ENABLE_SWORD2;ENABLE_TOUCHE;ENABLE_SCUMM_7_8;ENABLE_HE;ENABLE_TINSEL;ENABLE_TUCKER;ENABLE_GROOVIE" ExceptionHandling="0" RuntimeTypeInfo="false" WarningLevel="4" diff --git a/dists/msvc9/agos.vcproj b/dists/msvc9/agos.vcproj index b352dff3e1..bcd2d98aec 100644 --- a/dists/msvc9/agos.vcproj +++ b/dists/msvc9/agos.vcproj @@ -36,6 +36,7 @@ <File RelativePath="..\..\engines\agos\gfx.cpp" /> <File RelativePath="..\..\engines\agos\icons.cpp" /> <File RelativePath="..\..\engines\agos\input.cpp" /> + <File RelativePath="..\..\engines\agos\input_pn.cpp" /> <File RelativePath="..\..\engines\agos\intern.h" /> <File RelativePath="..\..\engines\agos\items.cpp" /> <File RelativePath="..\..\engines\agos\menus.cpp" /> @@ -61,8 +62,10 @@ <File RelativePath="..\..\engines\agos\sound.cpp" /> <File RelativePath="..\..\engines\agos\sound.h" /> <File RelativePath="..\..\engines\agos\string.cpp" /> + <File RelativePath="..\..\engines\agos\string_pn.cpp" /> <File RelativePath="..\..\engines\agos\subroutine.cpp" /> <File RelativePath="..\..\engines\agos\verb.cpp" /> + <File RelativePath="..\..\engines\agos\verb_pn.cpp" /> <File RelativePath="..\..\engines\agos\vga.cpp" /> <File RelativePath="..\..\engines\agos\vga.h" /> <File RelativePath="..\..\engines\agos\vga_e2.cpp" /> 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 |