aboutsummaryrefslogtreecommitdiff
path: root/engines/agos/vga_pn.cpp
diff options
context:
space:
mode:
authorTravis Howell2009-03-08 08:45:21 +0000
committerTravis Howell2009-03-08 08:45:21 +0000
commit2620d6836c001f2f295cb6efd6beab78f5a3c50f (patch)
tree81d5055b74abfc7b0be105bee13b39e6505fce91 /engines/agos/vga_pn.cpp
parent7bfab75a0814d0655a2504bf4c461df0000da0e4 (diff)
downloadscummvm-rg350-2620d6836c001f2f295cb6efd6beab78f5a3c50f.tar.gz
scummvm-rg350-2620d6836c001f2f295cb6efd6beab78f5a3c50f.tar.bz2
scummvm-rg350-2620d6836c001f2f295cb6efd6beab78f5a3c50f.zip
Add initial support for Personal Nightmare.
Thanks to dreammaster for file decompression and icon decoding code. NOTE: setjmp/longjmp code will require conversion for portability. svn-id: r39216
Diffstat (limited to 'engines/agos/vga_pn.cpp')
-rw-r--r--engines/agos/vga_pn.cpp188
1 files changed, 188 insertions, 0 deletions
diff --git a/engines/agos/vga_pn.cpp b/engines/agos/vga_pn.cpp
new file mode 100644
index 0000000000..5c6eaf6778
--- /dev/null
+++ b/engines/agos/vga_pn.cpp
@@ -0,0 +1,188 @@
+/* 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$
+ *
+ */
+
+// Video script opcodes for Simon1/Simon2
+
+
+#include "agos/agos.h"
+#include "agos/intern.h"
+#include "agos/vga.h"
+
+#include "common/system.h"
+
+#include "graphics/surface.h"
+
+namespace AGOS {
+
+void AGOSEngine_PN::setupVideoOpcodes(VgaOpcodeProc *op) {
+ op[1] = &AGOSEngine::vc1_fadeOut;
+ op[2] = &AGOSEngine::vc2_call;
+ op[3] = &AGOSEngine::vc3_loadSprite;
+ op[4] = &AGOSEngine::vc4_fadeIn;
+ op[5] = &AGOSEngine::vc5_ifEqual;
+ op[6] = &AGOSEngine::vc6_ifObjectHere;
+ op[7] = &AGOSEngine::vc7_ifObjectNotHere;
+ op[8] = &AGOSEngine::vc8_ifObjectIsAt;
+ op[9] = &AGOSEngine::vc9_ifObjectStateIs;
+ op[10] = &AGOSEngine::vc10_draw;
+ op[11] = &AGOSEngine::vc11_onStop;
+ op[13] = &AGOSEngine::vc12_delay;
+ op[14] = &AGOSEngine::vc13_addToSpriteX;
+ op[15] = &AGOSEngine::vc14_addToSpriteY;
+ op[16] = &AGOSEngine::vc15_sync;
+ op[17] = &AGOSEngine::vc16_waitSync;
+ op[18] = &AGOSEngine::vc17_waitEnd;
+ op[19] = &AGOSEngine::vc18_jump;
+ op[20] = &AGOSEngine::vc19_loop;
+ op[21] = &AGOSEngine::vc20_setRepeat;
+ op[22] = &AGOSEngine::vc21_endRepeat;
+ op[23] = &AGOSEngine::vc22_setPaletteOld;
+ op[24] = &AGOSEngine::vc23_setPriority;
+ op[25] = &AGOSEngine::vc24_setSpriteXY;
+ op[26] = &AGOSEngine::vc25_halt_sprite;
+ op[27] = &AGOSEngine::vc26_setSubWindow;
+ op[28] = &AGOSEngine::vc27_resetSprite;
+ op[29] = &AGOSEngine::vc28_playSFX;
+ op[30] = &AGOSEngine::vc29_stopAllSounds;
+ op[31] = &AGOSEngine::vc30_setFrameRate;
+ op[32] = &AGOSEngine::vc31_setWindow;
+ op[33] = &AGOSEngine::vc32_saveScreen;
+ op[34] = &AGOSEngine::vc33_setMouseOn;
+ op[35] = &AGOSEngine::vc34_setMouseOff;
+ op[36] = &AGOSEngine::vc36_pause;
+ op[38] = &AGOSEngine::vc35_clearWindow;
+ op[39] = &AGOSEngine::vc39_volume;
+ op[40] = &AGOSEngine::vc36_setWindowImage;
+ op[41] = &AGOSEngine::vc37_pokePalette;
+ op[44] = &AGOSEngine::vc44_enableBox;
+ op[45] = &AGOSEngine::vc45_disableBox;
+ op[46] = &AGOSEngine::vc46_maxBox;
+ op[48] = &AGOSEngine::vc48_specialEffect;
+ op[50] = &AGOSEngine::vc50_setBox;
+ op[51] = &AGOSEngine::vc38_ifVarNotZero;
+ op[52] = &AGOSEngine::vc39_setVar;
+ op[53] = &AGOSEngine::vc40_scrollRight;
+ op[54] = &AGOSEngine::vc41_scrollLeft;
+ op[55] = &AGOSEngine::vc55_scanFlag;
+}
+
+void AGOSEngine::vc36_pause() {
+ const char *message1 = "Press any key to continue";
+ bool oldWiped = _wiped;
+ _wiped = 0;
+
+ _lockWord |= 8;
+
+ windowPutChar(_windowArray[2], 13);
+
+ for (; *message1; message1++)
+ windowPutChar(_windowArray[2], *message1);
+
+ while (!shouldQuit()) {
+ if (_keyPressed.ascii != 0)
+ break;
+ delay(1);
+ }
+
+ _keyPressed.reset();
+
+ windowPutChar(_windowArray[2], 13);
+ windowPutChar(_windowArray[2], 128);
+ _wiped = oldWiped;
+
+ _lockWord &= ~8;
+}
+
+void AGOSEngine::vc39_volume() {
+ _vcPtr += 2;
+}
+
+void AGOSEngine::vc44_enableBox() {
+ HitArea *ha = _hitAreas + vcReadNextWord();
+ ha->flags &= ~kOBFBoxDisabled;
+}
+
+void AGOSEngine::vc45_disableBox() {
+ HitArea *ha = _hitAreas + vcReadNextWord();
+ ha->flags |= kOBFBoxDisabled;
+}
+
+void AGOSEngine::vc46_maxBox() {
+ HitArea *ha = _hitAreas + vcReadNextWord();
+ ha->id = 0xFFFF;
+}
+
+void AGOSEngine::vc48_specialEffect() {
+ uint16 num = vcReadNextWord();
+ vcReadNextWord();
+
+ if (getPlatform() == Common::kPlatformPC) {
+ if (num == 1) {
+ Graphics::Surface *screen = _system->lockScreen();
+ byte *dst = (byte *)screen->pixels;
+
+ for (uint h = 0; h < _screenHeight; h++) {
+ for (uint w = 0; w < _screenWidth; w++) {
+ if (dst[w] == 15)
+ dst[w] = 4;
+ }
+ dst += _screenWidth;
+ }
+ _system->unlockScreen();
+ } else if (num == 2) {
+ const char *str = "There are gurgling noises from the sink.";
+ for (; *str; str++)
+ windowPutChar(_textWindow, *str);
+ }
+ }
+}
+
+void AGOSEngine::vc50_setBox() {
+ uint16 id, x, y, w, h, msg1, msg2, flags;
+ const uint16 *vlut;
+
+ id = vcReadNextWord();
+ vlut = &_videoWindows[vcReadNextWord() * 4];
+ x = vlut[0] * 16 + vcReadNextWord();
+ y = vlut[1] + vcReadNextWord();
+ h = vcReadNextWord();
+ w = vcReadNextWord();
+ msg1 = vcReadNextWord();
+ msg2 = vcReadNextWord();
+ flags = vcReadNextWord();
+
+ // Compressed string
+ if (!(flags & kOBFUseMessageList)) {
+ msg1 += 0x8000;
+ }
+
+ defineBox(id, x, y, h, w, msg1, msg2, flags);
+}
+
+void AGOSEngine::vc55_scanFlag() {
+ _scanFlag = 1;
+}
+
+} // End of namespace AGOS