aboutsummaryrefslogtreecommitdiff
path: root/engines/igor/parts
diff options
context:
space:
mode:
authorGregory Montoir2007-10-29 23:35:50 +0000
committerGregory Montoir2007-10-29 23:35:50 +0000
commit6c6e8657b68ebc075871031ee8c662f349c4ab77 (patch)
tree1e2c691ffe1d142a3e781670ac63a981ebf70114 /engines/igor/parts
parentcaa451f5d2b471fc207739815638056f86fc8dce (diff)
downloadscummvm-rg350-6c6e8657b68ebc075871031ee8c662f349c4ab77.tar.gz
scummvm-rg350-6c6e8657b68ebc075871031ee8c662f349c4ab77.tar.bz2
scummvm-rg350-6c6e8657b68ebc075871031ee8c662f349c4ab77.zip
added 'igor' engine for the game 'Igor: Objective Uikokahonia'
svn-id: r29318
Diffstat (limited to 'engines/igor/parts')
-rw-r--r--engines/igor/parts/part_04.cpp116
-rw-r--r--engines/igor/parts/part_05.cpp291
-rw-r--r--engines/igor/parts/part_06.cpp419
-rw-r--r--engines/igor/parts/part_12.cpp581
-rw-r--r--engines/igor/parts/part_13.cpp247
-rw-r--r--engines/igor/parts/part_14.cpp615
-rw-r--r--engines/igor/parts/part_15.cpp521
-rw-r--r--engines/igor/parts/part_16.cpp304
-rw-r--r--engines/igor/parts/part_17.cpp529
-rw-r--r--engines/igor/parts/part_18.cpp215
-rw-r--r--engines/igor/parts/part_19.cpp336
-rw-r--r--engines/igor/parts/part_21.cpp492
-rw-r--r--engines/igor/parts/part_22.cpp186
-rw-r--r--engines/igor/parts/part_23.cpp304
-rw-r--r--engines/igor/parts/part_24.cpp340
-rw-r--r--engines/igor/parts/part_25.cpp256
-rw-r--r--engines/igor/parts/part_26.cpp297
-rw-r--r--engines/igor/parts/part_27.cpp296
-rw-r--r--engines/igor/parts/part_28.cpp369
-rw-r--r--engines/igor/parts/part_30.cpp325
-rw-r--r--engines/igor/parts/part_31.cpp453
-rw-r--r--engines/igor/parts/part_33.cpp519
-rw-r--r--engines/igor/parts/part_36.cpp177
-rw-r--r--engines/igor/parts/part_37.cpp139
-rw-r--r--engines/igor/parts/part_75.cpp119
-rw-r--r--engines/igor/parts/part_85.cpp227
-rw-r--r--engines/igor/parts/part_90.cpp76
-rw-r--r--engines/igor/parts/part_95.cpp72
-rw-r--r--engines/igor/parts/part_main.cpp974
29 files changed, 9795 insertions, 0 deletions
diff --git a/engines/igor/parts/part_04.cpp b/engines/igor/parts/part_04.cpp
new file mode 100644
index 0000000000..7090a64513
--- /dev/null
+++ b/engines/igor/parts/part_04.cpp
@@ -0,0 +1,116 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_04_EXEC_ACTION(int action) {
+ debug(kDebugGame, "PART_04_EXEC_ACTION %d", action);
+ switch (action) {
+ case 101:
+ _currentPart = 120;
+ break;
+ case 102:
+ case 103:
+ case 104:
+ ADD_DIALOGUE_TEXT(102, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ if (_objectsState[111] == 0) {
+ _currentPart = 170;
+ } else {
+ _currentPart = 770;
+ }
+ break;
+ case 106:
+ _currentPart = 50;
+ break;
+ default:
+ error("PART_04_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_04_CLEAR_OBJECT_STATE_84(int num) {
+ _objectsState[84] = 0;
+}
+
+void IgorEngine::PART_04() {
+ if (_objectsState[106] == 1) {
+ _currentPart = 730;
+ playMusic(1);
+ return;
+ }
+ if (_objectsState[107] == 1) {
+ _objectsState[107] = 0;
+ _currentPart = 750;
+ playMusic(1);
+ return;
+ }
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_Map, IMG_Map, BOX_Map, MSK_Map, TXT_Map);
+ loadActionData(DAT_Map);
+ _roomDataOffsets = PART_04_ROOM_DATA_OFFSETS;
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_04_EXEC_ACTION);
+ PART_04_CLEAR_OBJECT_STATE_84(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ fadeInPalette(768);
+ _currentAction.verb = kVerbWalk;
+ if (_gameState.musicNum != 2) {
+ playMusic(2);
+ }
+ _walkData[0].x = 160;
+ _walkData[0].y = 133;
+ _walkData[0].scaleWidth = 49;
+ _walkData[0].scaleHeight = 49;
+ _walkDataLastIndex = 1;
+ _walkDataCurrentIndex = 1;
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 40) {
+ handleRoomInput();
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ scrollPalette(200, 207);
+ setPaletteRange(200, 207);
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ scrollPalette(184, 199);
+ setPaletteRange(184, 199);
+ waitForTimer();
+ }
+ memcpy(_paletteBuffer, _currentPalette, 624);
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_05.cpp b/engines/igor/parts/part_05.cpp
new file mode 100644
index 0000000000..8a938ef587
--- /dev/null
+++ b/engines/igor/parts/part_05.cpp
@@ -0,0 +1,291 @@
+/* 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 "common/system.h"
+
+#include "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_05_EXEC_ACTION(int action) {
+ debug(kDebugGame, "PART_05_EXEC_ACTION %d", action);
+ switch (action) {
+ case 101:
+ ADD_DIALOGUE_TEXT(201, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 102:
+ PART_05_ACTION_102();
+ break;
+ case 103:
+ PART_05_ACTION_103();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(203, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ _currentPart = 40;
+ break;
+ default:
+ error("PART_05_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_05_ACTION_102() {
+ uint8 *walkTable3 = loadData(WLK_Bridge3);
+ uint8 *walkTable4 = loadData(WLK_Bridge4);
+ int xPos = 220;
+ int yPos = 0;
+ int i = 1;
+ do {
+ if (compareGameTick(1, 16)) {
+ for (int y = 0; y <= 143; ++y) {
+ memcpy(_screenLayer2 + y * 320, _screenLayer1 + y * 320 + i * 8, 320 - i * 8);
+ memcpy(_screenLayer2 + y * 320 + 320 - i * 8, _animFramesBuffer + y * 224, i * 8);
+ }
+ if (i < 15) {
+ xPos += _walkScaleTable[0x8F9 + _walkCurrentFrame];
+ assert(xPos >= 205);
+ yPos = walkTable3[xPos - 205];
+ WalkData::setNextFrame(kFacingPositionRight, _walkCurrentFrame);
+ } else {
+ _walkCurrentFrame = 0;
+ }
+ int yOffset = (yPos - 50) * 320 + xPos - 15 - i * 8;
+ for (_gameState.counter[1] = 0; _gameState.counter[1] <= 49; ++_gameState.counter[1]) {
+ yOffset += 320;
+ _gameState.counter[0] = yPos - 49 + _gameState.counter[1];
+ for (_gameState.counter[2] = 0; _gameState.counter[2] <= 29; ++_gameState.counter[2]) {
+ _gameState.counter[3] = xPos - 15 + _gameState.counter[2];
+ const int offset = _gameState.counter[0] * 134 + _gameState.counter[3];
+ if (_gameState.counter[0] >= 92 && _gameState.counter[0] <= 110 && offset >= 12533 && walkTable4[offset - 12533] == 1) {
+ continue;
+ }
+ uint8 color = _facingIgorFrames[kFacingPositionRight - 1][_walkCurrentFrame * 1500 + _gameState.counter[1] * 30 + _gameState.counter[2]];
+ if (color != 0) {
+ _screenLayer2[yOffset + _gameState.counter[2]] = color;
+ }
+ }
+ }
+ memcpy(_screenVGA, _screenLayer2, 46080);
+ ++i;
+ }
+ PART_05_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ } while (i != 29);
+ free(walkTable3);
+ free(walkTable4);
+ WalkData *wd = &_walkData[0];
+ wd->setPos(xPos - 224, yPos, 2, 0);
+ wd->setDefaultScale();
+ _currentPart = 60;
+}
+
+void IgorEngine::PART_05_ACTION_103() {
+ int i = 0;
+ do {
+ if (compareGameTick(1)) {
+ const int offset = 27526;
+ for (int j = 0; j <= 48; ++j) {
+ const uint8 *src = _animFramesBuffer + 0x7E18 + i * 1470 + j * 30;
+ memcpy(_screenVGA + j * 320 + offset, src, 30);
+ }
+ ++i;
+ }
+ PART_05_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ } while (i != 3);
+ addObjectToInventory(21, 56);
+ _objectsState[60] = 1;
+ PART_05_HELPER_4(255);
+}
+
+void IgorEngine::PART_05_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(61)) {
+ scrollPalette(160, 167);
+ setPaletteRange(160, 167);
+ }
+ if (compareGameTick(2, 8)) {
+ scrollPalette(168, 178);
+ setPaletteRange(168, 178);
+ }
+ if (compareGameTick(13, 16)) {
+ scrollPalette(179, 184);
+ setPaletteRange(179, 184);
+ }
+ if (compareGameTick(5, 32)) {
+ scrollPalette(185, 191);
+ setPaletteRange(185, 191);
+ }
+ if (compareGameTick(1)) {
+ switch (getRandomNumber(200)) {
+ case 0:
+ playSound(18, 1);
+ break;
+ case 3:
+ playSound(21, 1);
+ break;
+ case 9:
+ playSound(22, 1);
+ break;
+ case 17:
+ playSound(23, 1);
+ break;
+ }
+ }
+ if (_gameState.talkMode == kTalkModeTextOnly || !_gameState.dialogueTextRunning) {
+ playSound(17, 1);
+ }
+}
+
+void IgorEngine::PART_05_HELPER_1() {
+ const int offset = 23521;
+ for (int i = 0; i <= 48; ++i) {
+ memcpy(_animFramesBuffer + 0xDEA8 + i * 23 - 1, _screenLayer1 + i * 320 + offset, 23);
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + 0x95C7 + i * 23, 23);
+ }
+}
+
+void IgorEngine::PART_05_HELPER_2() {
+ const int offset = 28668;
+ for (int i = 0; i <= 32; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x7E54 + i * 23;
+ memcpy(_screenLayer1 + i * 320 + offset, src, 23);
+ }
+}
+
+void IgorEngine::PART_05_HELPER_3(int frame) {
+ const int offset = 26756;
+ for (int i = 0; i <= 5; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x7E00 + frame * 42 + i * 7;
+ memcpy(_screenLayer1 + i * 320 + offset, src, 7);
+ }
+}
+
+void IgorEngine::PART_05_HELPER_4(int num) {
+ if (_objectsState[60] == 0) {
+ PART_05_HELPER_5(0);
+ return;
+ }
+ PART_05_HELPER_5(1);
+ _roomObjectAreasTable[24].object = 0;
+ for (int i = 27; i <= 29; ++i) {
+ _roomObjectAreasTable[i].object = 0;
+ }
+}
+
+void IgorEngine::PART_05_HELPER_5(int frame) {
+ const int offset = 41926;
+ for (int i = 0; i <= 2; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x7E00 + frame * 12 + i * 4;
+ memcpy(_screenLayer1 + i * 320 + offset, src, 4);
+ }
+}
+
+void IgorEngine::PART_05_HELPER_6() {
+ _walkData[0].setPos(0, 141, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPath(0, 141, 51, 123);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_05() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_SpringRock, IMG_SpringRock, BOX_SpringRock, MSK_SpringRock, TXT_SpringRock);
+ SET_PAL_240_48_1();
+ static const int anm2[] = { FRM_SpringRock1, FRM_SpringRock2, 0 };
+ loadAnimData(anm2, 0x7E00);
+ static const int anm3[] = { FRM_SpringRock3, FRM_SpringRock4, 0 };
+ loadAnimData(anm3, 0x81AE);
+ static const int anm4[] = { FRM_SpringRock5, FRM_SpringRock6, 0 };
+ loadAnimData(anm4, 0xA763);
+ if (_objectsState[61] != 0) {
+ PART_05_HELPER_1();
+ }
+ if (_objectsState[63] != 0) {
+ PART_05_HELPER_2();
+ }
+ if (_objectsState[62] != 0) {
+ PART_05_HELPER_3(0);
+ }
+ for (int i = 0; i <= 143; ++i) {
+ memcpy(_animFramesBuffer + i * 224, _screenLayer1 + i * 320 + 96, 224);
+ }
+ loadRoomData(PAL_SpringBridge, IMG_SpringBridge, BOX_SpringBridge, MSK_SpringBridge, TXT_SpringBridge);
+ static const int anm1[] = { FRM_SpringBridge1, FRM_SpringBridge2, 0 };
+ loadAnimData(anm1, 0x7E00);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_05_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_05_UPDATE_ROOM_BACKGROUND;
+ PART_05_HELPER_4(255);
+ loadActionData(DAT_SpringRock);
+ _roomDataOffsets = PART_05_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ _walkDataLastIndex = 1;
+ _walkDataCurrentIndex = 1;
+ if (_currentPart == 50) {
+ PART_05_HELPER_6();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart >= 50 && _currentPart <= 52) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_05_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ stopSound();
+ if (_currentPart == 255) {
+ fadeOutPalette(768);
+ } else if (_currentPart != 60) {
+ if (_objectsState[63] == 0) {
+ _objectsState[61] = _objectsState[62] = _objectsState[63] = 1;
+ }
+ memcpy(_currentPalette, _paletteBuffer, 624);
+ fadeOutPalette(624);
+ }
+ _updateRoomBackground = 0;
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_06.cpp b/engines/igor/parts/part_06.cpp
new file mode 100644
index 0000000000..e39e38b4d0
--- /dev/null
+++ b/engines/igor/parts/part_06.cpp
@@ -0,0 +1,419 @@
+/* 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 "common/system.h"
+
+#include "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_06_EXEC_ACTION(int action) {
+ debug(kDebugGame, "PART_06_EXEC_ACTION %d", action);
+ switch (action) {
+ case 101:
+ ADD_DIALOGUE_TEXT(201, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 102:
+ PART_06_ACTION_102();
+ break;
+ case 103:
+ PART_06_ACTION_103();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ PART_06_ACTION_105();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ PART_06_ACTION_107();
+ break;
+ case 108:
+ PART_06_ACTION_108();
+ break;
+ default:
+ error("PART_06_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_06_ACTION_102() {
+ uint8 *walkTable1 = loadData(WLK_Bridge1);
+ uint8 *walkTable2 = loadData(WLK_Bridge2);
+ int xPos = 323;
+ int yPos = 0;
+ int i = 1;
+ do {
+ if (compareGameTick(1, 16)) {
+ for (int y = 0; y <= 143; ++y) {
+ memcpy(_screenLayer2 + y * 320 + i * 8, _screenLayer1 + y * 320, 320 - i * 8);
+ memcpy(_screenLayer2 + y * 320, _animFramesBuffer + y * 224 + 224 - i * 8, i * 8);
+ }
+ if (i < 15) {
+ xPos -= _walkScaleTable[0x8F9 + _walkCurrentFrame];
+ assert(xPos >= 205);
+ yPos = walkTable1[xPos - 205];
+ WalkData::setNextFrame(kFacingPositionLeft, _walkCurrentFrame);
+ } else {
+ _walkCurrentFrame = 0;
+ }
+ int yOffset = (yPos - 50) * 320 + xPos - 239 + i * 8;
+ for (_gameState.counter[1] = 0; _gameState.counter[1] <= 49; ++_gameState.counter[1]) {
+ yOffset += 320;
+ _gameState.counter[0] = yPos - 49 + _gameState.counter[1];
+ for (_gameState.counter[2] = 0; _gameState.counter[2] <= 29; ++_gameState.counter[2]) {
+ _gameState.counter[3] = xPos - 15 + _gameState.counter[2];
+ const int offset = _gameState.counter[0] * 134 + _gameState.counter[3];
+ if (_gameState.counter[0] >= 92 && _gameState.counter[0] <= 110 && offset >= 12533 && walkTable2[offset - 12533] == 1) {
+ continue;
+ }
+ uint8 color = _facingIgorFrames[kFacingPositionLeft - 1][_walkCurrentFrame * 1500 + _gameState.counter[1] * 30 + _gameState.counter[2]];
+ if (color != 0) {
+ _screenLayer2[yOffset + _gameState.counter[2]] = color;
+ }
+ }
+ }
+ memcpy(_screenVGA, _screenLayer2, 46080);
+ ++i;
+ }
+ PART_06_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ } while (i != 29);
+ free(walkTable1);
+ free(walkTable2);
+ WalkData *wd = &_walkData[0];
+ wd->setPos(xPos, yPos, 4, 0);
+ wd->setDefaultScale();
+ _currentPart = 51;
+}
+
+void IgorEngine::PART_06_ACTION_103() {
+ ADD_DIALOGUE_TEXT(215, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ PART_06_HELPER_8(0);
+ ADD_DIALOGUE_TEXT(216, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(170, 69, 55, 37, 63);
+ waitForEndOfCutsceneDialogue(170, 69, 55, 37, 63);
+ PART_06_HANDLE_DIALOGUE_PHOTOGRAPHER();
+ PART_06_HELPER_6(255);
+}
+
+void IgorEngine::PART_06_ACTION_105() {
+ _gameTicks = 0;
+ for (int i = 0; i <= 3; ++i) {
+ if (compareGameTick(1)) {
+ const int offset = 22568;
+ for (int j = 0; j <= 48; ++j) {
+ const uint8 *src = _animFramesBuffer + 0x81AE + i * 1715 + j * 35;
+ memcpy(_screenVGA + 320 * j + offset, src, 35);
+ }
+ }
+ PART_06_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ addObjectToInventory(36, 71);
+ _objectsState[62] = 0;
+ PART_06_HELPER_6(255);
+}
+
+void IgorEngine::PART_06_ACTION_107() {
+ PART_06_HELPER_8(0);
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(206, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(170, 69, 55, 37, 63);
+ waitForEndOfCutsceneDialogue(170, 69, 55, 37, 63);
+}
+
+void IgorEngine::PART_06_ACTION_108() {
+ PART_06_HELPER_8(0);
+ ADD_DIALOGUE_TEXT(208, 2);
+ ADD_DIALOGUE_TEXT(210, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(212, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(170, 69, 55, 37, 63);
+ waitForEndOfCutsceneDialogue(170, 69, 55, 37, 63);
+ int i = 7;
+ _gameTicks = 0;
+ do {
+ if (compareGameTick(1, 32)) {
+ const uint8 *src = _animFramesBuffer + 0xA763 + READ_LE_UINT16(_animFramesBuffer + 0xDB95 + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ ++i;
+ }
+ PART_06_UPDATE_ROOM_BACKGROUND();
+ if (i == 7) {
+ stopSound();
+ playSound(19, 1);
+ }
+ waitForTimer();
+ } while (i != 28);
+ removeObjectFromInventory(61);
+ _objectsState[61] = 0;
+ PART_06_HELPER_6(255);
+ _gameState.unkF = false;
+ ADD_DIALOGUE_TEXT(213, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+}
+
+void IgorEngine::PART_06_UPDATE_DIALOGUE_PHOTOGRAPHER(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_06_HELPER_7(1);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_06_HELPER_7(getRandomNumber(6) + 1);
+ break;
+ case kUpdateDialogueAnimStanding:
+ PART_06_HELPER_7(1);
+ break;
+ }
+}
+
+void IgorEngine::PART_06_HANDLE_DIALOGUE_PHOTOGRAPHER() {
+ loadDialogueData(DLG_SpringPhotographer);
+ _updateDialogue = &IgorEngine::PART_06_UPDATE_DIALOGUE_PHOTOGRAPHER;
+ handleDialogue(170, 69, 55, 37, 63);
+ _updateDialogue = 0;
+}
+
+void IgorEngine::PART_06_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(61)) {
+ scrollPalette(160, 167);
+ setPaletteRange(160, 167);
+ }
+ if (compareGameTick(2, 8)) {
+ scrollPalette(168, 178);
+ setPaletteRange(168, 178);
+ }
+ if (compareGameTick(13, 16)) {
+ scrollPalette(179, 184);
+ setPaletteRange(179, 184);
+ }
+ if (compareGameTick(5, 32)) {
+ scrollPalette(185, 191);
+ setPaletteRange(185, 191);
+ }
+ if (compareGameTick(1)) {
+ switch (getRandomNumber(20)) {
+ case 0:
+ playSound(18, 1);
+ break;
+ case 3:
+ playSound(21, 1);
+ break;
+ case 9:
+ playSound(22, 1);
+ break;
+ case 17:
+ playSound(23, 1);
+ break;
+ }
+ }
+}
+
+void IgorEngine::PART_06_HELPER_1(int frame) {
+ const int offset = 41926;
+ for (int i = 0; i <= 2; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x7E00 + frame * 12 + i * 4;
+ memcpy(_screenLayer1 + i * 320 + offset, src, 4);
+ }
+}
+
+void IgorEngine::PART_06_HELPER_2() {
+ const int offset = 23521;
+ for (int i = 0; i <= 48; ++i) {
+ const uint8 *src = _screenLayer1 + i * 320 + offset;
+ memcpy(_animFramesBuffer + 0xDEA8 + i * 23 - 1, src, 23);
+ }
+}
+
+void IgorEngine::PART_06_HELPER_3() {
+ const int offset = 28668;
+ for (int i = 0; i <= 32; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x7E54 + i * 23;
+ memcpy(_screenLayer1 + i * 320 + offset, src, 23);
+ memcpy(_screenVGA + i * 320 + offset, src, 23);
+ }
+}
+
+void IgorEngine::PART_06_HELPER_6(int num) {
+ if (num == 2 || num == 255) {
+ if (_objectsState[61] == 1) {
+ PART_06_HELPER_14();
+ _roomObjectAreasTable[3].object = 0;
+ _roomObjectAreasTable[13].area = 0;
+ _roomObjectAreasTable[15].area = 0;
+ _roomObjectAreasTable[17].area = 0;
+ _roomObjectAreasTable[18].area = 0;
+ } else {
+ PART_06_HELPER_12();
+ _roomObjectAreasTable[2].object = 0;
+ _roomObjectAreasTable[15].object = 0;
+ _roomObjectAreasTable[18].object = 0;
+ _roomObjectAreasTable[3].object = 0;
+ _roomObjectAreasTable[13].area = 3;
+ _roomObjectAreasTable[15].area = 3;
+ _roomObjectAreasTable[17].area = 3;
+ _roomObjectAreasTable[18].area = 3;
+ }
+ }
+ if (num == 3 || num == 255) {
+ if (_objectsState[62] == 1) {
+ PART_06_HELPER_13(0);
+ } else {
+ PART_06_HELPER_13(1);
+ _roomObjectAreasTable[3].object = 0;
+ }
+ }
+}
+
+void IgorEngine::PART_06_HELPER_7(int frame) {
+ const uint8 *src = _animFramesBuffer + 0xA763 + READ_LE_UINT16(_animFramesBuffer + 0xDB95 + frame * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+}
+
+void IgorEngine::PART_06_HELPER_8(int frame) {
+ const int offset = 23521;
+ for (int i = 0; i <= 48; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x95C7 + i * 23 + frame * 1127;
+ memcpy(_screenVGA + i * 320 + offset, src, 23);
+ }
+}
+
+void IgorEngine::PART_06_HELPER_12() {
+ const int offset = 23521;
+ for (int i = 0; i <= 48; ++i) {
+ const uint8 *src = _animFramesBuffer + 0xDEA7 + i * 23;
+ memcpy(_screenLayer1 + i * 320 + offset, src, 23);
+ }
+}
+
+void IgorEngine::PART_06_HELPER_13(int frame) {
+ const int offset = 26756;
+ for (int i = 0; i <= 5; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x7E00 + frame * 42 + i * 7;
+ memcpy(_screenLayer1 + i * 320 + offset, src, 7);
+ }
+}
+
+void IgorEngine::PART_06_HELPER_14() {
+ const int offset = 23521;
+ for (int i = 0; i <= 48; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x95C7 + i * 23;
+ memcpy(_screenLayer1 + i * 320 + offset, src, 23);
+ }
+}
+
+void IgorEngine::PART_06_HELPER_15(int frame) {
+ const uint8 *src = _animFramesBuffer + 0xA763 + READ_LE_UINT16(_animFramesBuffer + 0xDB95 + frame * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+}
+
+void IgorEngine::PART_06() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_SpringBridge, IMG_SpringBridge, BOX_SpringBridge, MSK_SpringBridge, TXT_SpringBridge);
+ static const int anm1[] = { FRM_SpringBridge1, FRM_SpringBridge2, 0 };
+ loadAnimData(anm1, 0x7E00);
+ if (_objectsState[60] == 0) {
+ PART_06_HELPER_1(0);
+ }
+ for (int i = 0; i <= 143; ++i) {
+ memcpy(_animFramesBuffer + i * 224, _screenLayer1 + i * 320, 224);
+ }
+ loadRoomData(PAL_SpringRock, IMG_SpringRock, BOX_SpringRock, MSK_SpringRock, TXT_SpringRock);
+ SET_PAL_240_48_1();
+ static const int anm2[] = { FRM_SpringRock1, FRM_SpringRock2, 0 };
+ loadAnimData(anm2, 0x7E00);
+ static const int anm3[] = { FRM_SpringRock3, FRM_SpringRock4, 0 };
+ loadAnimData(anm3, 0x81AE);
+ static const int anm4[] = { FRM_SpringRock5, FRM_SpringRock6, 0 };
+ loadAnimData(anm4, 0xA763);
+ PART_06_HELPER_2();
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_06_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_06_UPDATE_ROOM_BACKGROUND;
+ PART_06_HELPER_6(255);
+ if (_objectsState[63] == 1) {
+ PART_06_HELPER_3();
+ }
+ if (_currentPart == 61) {
+ SET_PAL_208_96_1();
+ drawVerbsPanel();
+ drawInventory(1, 0);
+ _currentAction.verb = kVerbWalk;
+ memcpy(_paletteBuffer, _currentPalette, 624);
+ fadeInPalette(768);
+ }
+ loadActionData(DAT_SpringBridge);
+ _roomDataOffsets = PART_06_ROOM_DATA_OFFSETS;
+ _walkDataLastIndex = 1;
+ _walkDataCurrentIndex = 1;
+ showCursor();
+ _gameState.igorMoving = false;
+ _gameState.unkF = (_objectsState[61] == 1);
+ while (_currentPart >= 60 && _currentPart <= 61) {
+ setRoomWalkBounds(0, 0, _objectsState[61] == 0 ? 234 : 142, 143);
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_06_UPDATE_ROOM_BACKGROUND();
+ if (compareGameTick(61) && _gameState.unkF && getRandomNumber(10) == 0) {
+ PART_06_HELPER_8(getRandomNumber(4));
+ }
+ waitForTimer();
+ }
+ _updateRoomBackground = 0;
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_12.cpp b/engines/igor/parts/part_12.cpp
new file mode 100644
index 0000000000..055ce1eb1e
--- /dev/null
+++ b/engines/igor/parts/part_12.cpp
@@ -0,0 +1,581 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_12_DATA_ANIM_1[10] = { 0, 1, 2, 1, 2, 1, 2, 1, 2, 3 };
+
+static const uint8 PART_12_DATA_ANIM_2[16] = { 0, 1, 2, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 6, 7 };
+
+void IgorEngine::PART_12_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ PART_12_ACTION_101();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ if (_objectsState[44] == 0) {
+ ADD_DIALOGUE_TEXT(203, 2);
+ } else {
+ ADD_DIALOGUE_TEXT(205, 1);
+ }
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ PART_12_ACTION_104();
+ break;
+ case 105:
+ PART_12_ACTION_105();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(207, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 108:
+ PART_12_ACTION_108();
+ break;
+ default:
+ error("PART_12_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_12_ACTION_101() {
+ for (int i = 9; i <= 10; ++i) {
+ _roomObjectAreasTable[i].area = 3;
+ }
+ --_walkDataLastIndex;
+ buildWalkPath(272, 94, 196, 64);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ _gameState.unk10 = 1;
+ _gameTicks = 0;
+ do {
+ if (compareGameTick(1, 16)) {
+ if (_walkDataCurrentIndex > _walkDataLastIndex) {
+ _gameState.igorMoving = false;
+ _walkDataLastIndex = _walkDataCurrentIndex;
+ }
+ if (_gameState.igorMoving) {
+ moveIgor(_walkData[_walkDataCurrentIndex].posNum, _walkData[_walkDataCurrentIndex].frameNum);
+ ++_walkDataCurrentIndex;
+ }
+ }
+ if (compareGameTick(2, 32) && _gameState.unk10 < 8) {
+ if (_objectsState[44] == 0) {
+ const uint8 *src = _animFramesBuffer + 0x761 + READ_LE_UINT16(_animFramesBuffer + 0x1107 + _gameState.unk10 * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ }
+ ++_gameState.unk10;
+ }
+ waitForTimer();
+ } while (_gameState.igorMoving || _gameState.unk10 != 8);
+ _currentPart = 40;
+}
+
+void IgorEngine::PART_12_ACTION_104() {
+ _walkCurrentFrame = 2;
+ --_walkDataLastIndex;
+ _roomObjectAreasTable[_screenLayer2[33390]].area = _roomObjectAreasTable[_screenLayer2[34686]].area;
+ buildWalkPath(126, 108, 110, 104);
+ _roomObjectAreasTable[_screenLayer2[33390]].area = 0;
+ _walkDataCurrentIndex = 1;
+ moveIgor(_walkData[_walkDataCurrentIndex].posNum, _walkData[_walkDataCurrentIndex].frameNum);
+ waitForTimer(35);
+ playSound(13, 1);
+ _walkDataCurrentIndex = _walkDataLastIndex;
+ const uint8 *src = _animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA444) - 1;
+ decodeAnimFrame(src, _screenVGA);
+ decodeAnimFrame(src, _screenLayer1);
+ moveIgor(_walkData[_walkDataCurrentIndex].posNum, _walkData[_walkDataCurrentIndex].frameNum);
+ waitForTimer(35);
+ _walkDataCurrentIndex = _walkDataLastIndex - 1;
+ src = _animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA446) - 1;
+ decodeAnimFrame(src, _screenVGA);
+ decodeAnimFrame(src, _screenLayer1);
+ _walkData[_walkDataCurrentIndex].xPosChanged = 1;
+ _walkData[_walkDataCurrentIndex].yPosChanged = 1;
+ moveIgor(_walkData[_walkDataCurrentIndex].posNum, _walkData[_walkDataCurrentIndex].frameNum);
+ waitForTimer(35);
+ _walkData[0].setPos(127, 108, 4, 0);
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 30;
+ _walkData[0].scaleWidth = 50;
+ _walkData[0].xPosChanged = 1;
+ _walkData[0].dxPos = 10;
+ _walkData[0].yPosChanged = 1;
+ _walkData[0].dyPos = 3;
+ _walkData[0].scaleHeight = 1;
+ _walkDataCurrentIndex = 0;
+ _walkDataLastIndex = 1;
+ src = _animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA448) - 1;
+ decodeAnimFrame(src, _screenVGA);
+ decodeAnimFrame(src, _screenLayer1);
+ moveIgor(4, 0);
+ PART_12_HANDLE_DIALOGUE_CHURCHMAN();
+ for (int i = 4; i >= 1; --i) {
+ src = _animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA43E + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA);
+ if (i > 1) {
+ waitForTimer(35);
+ } else {
+ playSound(14, 1);
+ }
+ }
+ src = _animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA440) - 1;
+ decodeAnimFrame(src, _screenVGA);
+ PART_12_HELPER_1(255);
+}
+
+void IgorEngine::PART_12_ACTION_105() {
+ if (_objectsState[44] == 1) {
+ ADD_DIALOGUE_TEXT(216, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ memset(_screenVGA + 46080, 0, 17920);
+ _inventoryInfo[_inventoryInfo[62] - 1] = 0;
+ _inventoryInfo[62] = 0;
+ packInventory();
+ if (_inventoryInfo[72] > _inventoryInfo[73]) {
+ _inventoryInfo[72] = _inventoryOffsetTable[(_inventoryInfo[73] - 1) / 7];
+ }
+ const int animOffset = (_objectsState[45] == 0) ? 0x2543 : 0xBF1E;
+ for (int i = 1; i <= 9; ++i) {
+ const int offset = 30149;
+ for (int j = 0; j <= 48; ++j) {
+ const uint8 *src = _animFramesBuffer + animOffset + PART_12_DATA_ANIM_1[i] * 1715 + j * 35 + 0xF94C;
+ memcpy(_screenVGA + j * 320 + offset, src, 35);
+ }
+ waitForTimer(30);
+ }
+ ADD_DIALOGUE_TEXT(209, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ for (int i = 9; i <= 10; ++i) {
+ _roomObjectAreasTable[i].area = 3;
+ }
+ --_walkDataLastIndex;
+ buildWalkPath(95, 142, 196, 64);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _gameState.unk10 = 1;
+ _gameTicks = 0;
+ do {
+ if (compareGameTick(2, 32) && _gameState.unk10 < 8) {
+ const uint8 *src = _animFramesBuffer + 0x761 + READ_LE_UINT16(_animFramesBuffer + 0x1107 + _gameState.unk10 * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ ++_gameState.unk10;
+ }
+ waitForTimer();
+ } while (_gameState.unk10 != 8);
+ --_walkDataLastIndex;
+ buildWalkPath(196, 64, 95, 142);
+ PART_12_HELPER_2();
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ _gameTicks = 0;
+ do {
+ if (compareGameTick(1, 16)) {
+ if (_walkDataCurrentIndex > _walkDataLastIndex) {
+ _gameState.igorMoving = false;
+ _walkDataLastIndex = _walkDataCurrentIndex;
+ }
+ if (_gameState.igorMoving) {
+ moveIgor(_walkData[_walkDataCurrentIndex].posNum, _walkData[_walkDataCurrentIndex].frameNum);
+ ++_walkDataCurrentIndex;
+ }
+ }
+ if (compareGameTick(2, 32)) {
+ _gameState.unk10 = getRandomNumber(2) + 7;
+ const uint8 *src = _animFramesBuffer + 0x761 + READ_LE_UINT16(_animFramesBuffer + 0x1107 + _gameState.unk10 * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ }
+ waitForTimer();
+ } while (_gameState.igorMoving);
+ decodeAnimFrame(_animFramesBuffer + 0x761 + READ_LE_UINT16(_animFramesBuffer + 0x1117) - 1, _screenVGA, true);
+ if (_objectsState[45] == 0) {
+ for (int i = 1; i <= 15; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x1119 + READ_LE_UINT16(_animFramesBuffer + 0x2532 + PART_12_DATA_ANIM_2[i] * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(45);
+ }
+ } else {
+ for (int i = 1; i <= 15; ++i) {
+ const uint8 *src = _animFramesBuffer + 0xA47A + READ_LE_UINT16(_animFramesBuffer + 0xBF0D + PART_12_DATA_ANIM_2[i] * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(45);
+ }
+ }
+ drawVerbsPanel();
+ redrawVerb(kVerbWalk, true);
+ _currentAction.verb = kVerbWalk;
+ addObjectToInventory(24, 59);
+ _objectsState[44] = 1;
+ PART_12_HELPER_1(255);
+ ADD_DIALOGUE_TEXT(211, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+}
+
+void IgorEngine::PART_12_ACTION_108() {
+ _walkCurrentFrame = 2;
+ --_walkDataLastIndex;
+ _roomObjectAreasTable[_screenLayer2[28555]].area = _roomObjectAreasTable[_screenLayer2[34686]].area;
+ buildWalkPath(126, 108, 75, 89);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ _gameState.unk10 = 1;
+ _gameTicks = 0;
+ do {
+ if (compareGameTick(1, 16)) {
+ if (_walkDataCurrentIndex > _walkDataLastIndex) {
+ _gameState.igorMoving = false;
+ _walkDataLastIndex = _walkDataCurrentIndex;
+ }
+ if (_gameState.igorMoving) {
+ moveIgor(_walkData[_walkDataCurrentIndex].posNum, _walkData[_walkDataCurrentIndex].frameNum);
+ ++_walkDataCurrentIndex;
+ }
+ }
+ if (compareGameTick(2, 32) && _gameState.unk10 < 8) {
+ if (_objectsState[44] == 0) {
+ const uint8 *src = _animFramesBuffer + 0x761 + READ_LE_UINT16(_animFramesBuffer + 0x1107 + _gameState.unk10 * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ }
+ ++_gameState.unk10;
+ }
+ waitForTimer();
+ } while (_gameState.igorMoving || _gameState.unk10 != 8);
+ _currentPart = 130;
+}
+
+void IgorEngine::PART_12_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(1) && getRandomNumber(15) == 0) {
+ switch (getRandomNumber(4)) {
+ case 0:
+ playSound(21, 1);
+ break;
+ case 1:
+ playSound(22, 1);
+ break;
+ case 2:
+ playSound(23, 1);
+ break;
+ case 3:
+ playSound(18, 1);
+ break;
+ }
+ }
+}
+
+void IgorEngine::PART_12_UPDATE_DIALOGUE_TOBIAS(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_12_HELPER_8();
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_12_HELPER_10(6 + getRandomNumber(6));
+ break;
+ case kUpdateDialogueAnimStanding:
+ PART_12_HELPER_8();
+ break;
+ }
+}
+
+void IgorEngine::PART_12_HANDLE_DIALOGUE_CHURCHMAN() {
+ loadDialogueData(DLG_OutsideChurch);
+ _updateDialogue = &IgorEngine::PART_12_UPDATE_DIALOGUE_TOBIAS;
+ handleDialogue(95, 55, 51, 28, 63);
+ _updateDialogue = 0;
+}
+
+void IgorEngine::PART_12_HELPER_1(int num) {
+ if (num == 2 || num == 255) {
+ if (_objectsState[45] == 0) {
+ _roomActionsTable[169] = 104;
+ _roomActionsTable[175] = 104;
+ _roomActionsTable[177] = 104;
+ _roomActionsTable[179] = 104;
+ _roomActionsTable[181] = 104;
+ _roomActionsTable[185] = 104;
+ _roomActionsTable[187] = 104;
+ _roomActionsTable[170] = 3;
+ _roomActionsTable[176] = 3;
+ _roomActionsTable[178] = 3;
+ _roomActionsTable[180] = 3;
+ _roomActionsTable[182] = 3;
+ _roomActionsTable[186] = 3;
+ _roomActionsTable[188] = 3;
+ } else {
+ PART_12_HELPER_9();
+ _roomActionsTable[169] = 108;
+ _roomActionsTable[175] = 106;
+ _roomActionsTable[177] = 2;
+ _roomActionsTable[179] = 11;
+ _roomActionsTable[181] = 107;
+ _roomActionsTable[185] = 35;
+ _roomActionsTable[187] = 35;
+ _roomActionsTable[170] = 1;
+ _roomActionsTable[176] = 1;
+ _roomActionsTable[178] = 1;
+ _roomActionsTable[180] = 1;
+ _roomActionsTable[182] = 1;
+ _roomActionsTable[186] = 1;
+ _roomActionsTable[188] = 1;
+ }
+ }
+}
+
+void IgorEngine::PART_12_HELPER_2() {
+ for (int i = 9; i <= 10; ++i) {
+ _roomObjectAreasTable[i].area = 0;
+ }
+}
+
+void IgorEngine::PART_12_HELPER_3() {
+ decodeAnimFrame(_animFramesBuffer, _screenVGA, true);
+}
+
+void IgorEngine::PART_12_HELPER_4() {
+ SET_PAL_240_48_1();
+ SET_PAL_208_96_1();
+ fadeInPalette(768);
+ playSound(13, 1);
+ for (int i = 1; i <= 5; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA43E + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ if (_objectsState[44] == 0) {
+ src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0x74B + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ }
+ waitForTimer(30);
+ }
+ if (_objectsState[44] == 0) {
+ for (int i = 6; i <= 10; ++i) {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0x74B + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(30);
+ }
+ }
+ ADD_DIALOGUE_TEXT(212, 2);
+ ADD_DIALOGUE_TEXT(214, 1);
+ ADD_DIALOGUE_TEXT(215, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ _updateDialogue = &IgorEngine::PART_12_UPDATE_DIALOGUE_TOBIAS;
+ startCutsceneDialogue(95, 55, 51, 28, 63);
+ waitForEndOfCutsceneDialogue(95, 55, 51, 28, 63);
+ _updateDialogue = 0;
+ for (int i = 12; i <= 29; ++i){
+ const uint8 *src = _animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA43E + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(30);
+ }
+ if (_objectsState[44] == 0) {
+ for (int i = 1; i <= 8; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x761 + READ_LE_UINT16(_animFramesBuffer + 0x1107 + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(30);
+ }
+ }
+ waitForTimer(255);
+ fadeOutPalette(768);
+ _objectsState[45] = 1;
+ drawVerbsPanel();
+ drawInventory(_inventoryInfo[72], 0);
+ _currentPart = 40;
+}
+
+void IgorEngine::PART_12_HELPER_5() {
+ _walkData[0].setPos(196, 64, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 30;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPath(196, 64, 238, 104);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ _gameState.unk10 = 1;
+ waitForTimer(15);
+ _gameTicks = 0;
+ do {
+ if (compareGameTick(1, 16)) {
+ if (_walkDataCurrentIndex > _walkDataLastIndex) {
+ _gameState.igorMoving = false;
+ _walkDataLastIndex = _walkDataCurrentIndex;
+ }
+ if (_gameState.igorMoving) {
+ moveIgor(_walkData[_walkDataCurrentIndex].posNum, _walkData[_walkDataCurrentIndex].frameNum);
+ ++_walkDataCurrentIndex;
+ }
+ }
+ if (compareGameTick(2, 32) && _gameState.unk10 < 11) {
+ if (_objectsState[44] == 0) {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0x74B + _gameState.unk10 * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ }
+ ++_gameState.unk10;
+ }
+ waitForTimer();
+ } while (_gameState.igorMoving || _gameState.unk10 != 11);
+}
+
+void IgorEngine::PART_12_HELPER_6() {
+ playMusic(2);
+ PART_12_HELPER_1(255);
+ _walkData[0].setPos(75, 89, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 30;
+ _roomObjectAreasTable[_screenLayer2[28555]].area = _roomObjectAreasTable[_screenLayer2[34686]].area;
+ buildWalkPath(75, 89, 126, 108);
+ _roomObjectAreasTable[_screenLayer2[28555]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ _gameState.unk10 = 1;
+ waitForTimer(15);
+ _gameTicks = 0;
+ do {
+ if (compareGameTick(1, 16)) {
+ if (_walkDataCurrentIndex > _walkDataLastIndex) {
+ _gameState.igorMoving = false;
+ _walkDataLastIndex = _walkDataCurrentIndex;
+ }
+ if (_gameState.igorMoving) {
+ moveIgor(_walkData[_walkDataCurrentIndex].posNum, _walkData[_walkDataCurrentIndex].frameNum);
+ ++_walkDataCurrentIndex;
+ }
+ }
+ if (compareGameTick(2, 32) && _gameState.unk10 < 11) {
+ if (_objectsState[44] == 0) {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0x74B + _gameState.unk10 * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ }
+ ++_gameState.unk10;
+ }
+ waitForTimer();
+ } while (_gameState.igorMoving || _gameState.unk10 != 11);
+}
+
+void IgorEngine::PART_12_HELPER_8() {
+ decodeAnimFrame(_animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA454) - 1, _screenVGA, true);
+}
+
+void IgorEngine::PART_12_HELPER_9() {
+ decodeAnimFrame(_animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA442) - 1, _screenLayer1, true);
+}
+
+void IgorEngine::PART_12_HELPER_10(int frame) {
+ decodeAnimFrame(_animFramesBuffer + 0x395B + READ_LE_UINT16(_animFramesBuffer + 0xA43E + frame * 2) - 1, _screenVGA, true);
+}
+
+void IgorEngine::PART_12() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_OutsideChurch, IMG_OutsideChurch, BOX_OutsideChurch, MSK_OutsideChurch, TXT_OutsideChurch);
+ static const int anm[] = { FRM_OutsideChurch1, FRM_OutsideChurch2, FRM_OutsideChurch3, FRM_OutsideChurch4, FRM_OutsideChurch5, FRM_OutsideChurch6, FRM_OutsideChurch7, FRM_OutsideChurch8, FRM_OutsideChurch9, FRM_OutsideChurch10, FRM_OutsideChurch11, FRM_OutsideChurch12, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_OutsideChurch);
+ _roomDataOffsets = PART_12_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(89, 0, 275, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_12_EXEC_ACTION);
+ PART_12_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ if (_objectsState[44] == 0) {
+ PART_12_HELPER_3();
+ }
+ if (_currentPart == 122) {
+ PART_12_HELPER_4();
+ return;
+ }
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ if (_currentPart == 120) {
+ PART_12_HELPER_5();
+ }
+ if (_currentPart == 121) {
+ PART_12_HELPER_6();
+ if (_objectsState[106] == 1) {
+ ADD_DIALOGUE_TEXT(216, 2);
+ ADD_DIALOGUE_TEXT(218, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ --_walkDataLastIndex;
+ buildWalkPath(126, 108, 196, 64);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 40;
+ goto PART_12_EXIT;
+ }
+ }
+ PART_12_HELPER_2();
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart >= 120 && _currentPart <= 122) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_12_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+PART_12_EXIT:
+ hideCursor();
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_13.cpp b/engines/igor/parts/part_13.cpp
new file mode 100644
index 0000000000..e33cc69918
--- /dev/null
+++ b/engines/igor/parts/part_13.cpp
@@ -0,0 +1,247 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_13_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ PART_13_ACTION_101_103();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(201, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ PART_13_ACTION_101_103();
+ break;
+ case 104:
+ PART_13_ACTION_104();
+ break;
+ case 105:
+ _currentPart = 140;
+ break;
+ default:
+ error("PART_13_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_13_ACTION_101_103() {
+ waitForTimer(255);
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ for (int i = 0; i <= 4; ++i) {
+ WalkData *wd = &_walkData[0];
+ if (i == 4) {
+ _walkCurrentFrame = 0;
+ }
+ wd->setPos(52 + i * 5, 88, 2, _walkCurrentFrame);
+ WalkData::setNextFrame(2, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 24;
+ wd->scaleWidth = 40;
+ wd->xPosChanged = 1;
+ wd->dxPos = 5;
+ wd->yPosChanged = 1;
+ wd->dyPos = 0;
+ wd->scaleHeight = 40;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(30);
+ }
+ _walkDataLastIndex = 1;
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ _walkData[0].posNum = 3;
+ moveIgor(_walkData[0].posNum, _walkData[0].frameNum);
+ waitForTimer(30);
+ _walkCurrentFrame = 1;
+ for (int i = 4; i >= 0; --i) {
+ WalkData *wd = &_walkData[0];
+ if (i == 0) {
+ _walkCurrentFrame = 0;
+ }
+ wd->setPos(52 + i * 5, 88, 4, _walkCurrentFrame);
+ WalkData::setNextFrame(4, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 24;
+ wd->scaleWidth = 40;
+ wd->xPosChanged = 1;
+ wd->dxPos = 5;
+ wd->yPosChanged = 1;
+ wd->dyPos = 0;
+ wd->scaleHeight = 40;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(30);
+ }
+ waitForTimer(255);
+ WalkData *wd = &_walkData[0];
+ wd->setPos(70, 127, 2, 0);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 13;
+ wd->scaleWidth = 22;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 0;
+ wd->scaleHeight = 22;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPath(70, 127, 92, 127);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ _gameState.unk10 = 1;
+ _gameTicks = 0;
+ do {
+ if (compareGameTick(1, 16)) {
+ if (_walkDataCurrentIndex > _walkDataLastIndex) {
+ _gameState.igorMoving = false;
+ _walkDataLastIndex = _walkDataCurrentIndex;
+ }
+ if (_gameState.igorMoving) {
+ moveIgor(_walkData[_walkDataCurrentIndex].posNum, _walkData[_walkDataCurrentIndex].frameNum);
+ ++_walkDataCurrentIndex;
+ }
+ }
+ waitForTimer();
+ } while (_gameState.igorMoving);
+}
+
+void IgorEngine::PART_13_ACTION_104() {
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ for (_gameState.counter[1] = 9; _gameState.counter[1] >= 0; --_gameState.counter[1]) {
+ if (_gameState.counter[1] == 9) {
+ _walkCurrentFrame = 0;
+ }
+ _walkData[0].setPos(189, 143, 3, _walkCurrentFrame);
+ WalkData::setNextFrame(3, _walkCurrentFrame);
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 13;
+ _walkData[0].scaleWidth = 13 + _gameState.counter[1];
+ _walkData[0].xPosChanged = 1;
+ _walkData[0].dxPos = 0;
+ _walkData[0].yPosChanged = 1;
+ _walkData[0].dyPos = 3;
+ _walkData[0].scaleHeight = 22;
+ moveIgor(_walkData[0].posNum, _walkData[0].frameNum);
+ waitForTimer(15);
+ }
+ _currentPart = 121;
+}
+
+void IgorEngine::PART_13_HELPER_1(int num) {
+}
+
+void IgorEngine::PART_13_HELPER_2() {
+ WalkData *wd = &_walkData[0];
+ wd->setPos(314, 127, 4, 0);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 13;
+ wd->scaleWidth = 22;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 0;
+ wd->scaleHeight = 22;
+ _walkDataLastIndex = 0;
+ buildWalkPath(314, 127, 288, 127);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_13_HELPER_3() {
+ playMusic(4);
+ PART_13_HELPER_1(255);
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ for (int i = 0; i <= 9; ++i) {
+ WalkData *wd = &_walkData[0];
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ wd->setPos(189, 143, 1, _walkCurrentFrame);
+ WalkData::setNextFrame(1, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 13;
+ wd->scaleWidth = i + 13;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 0;
+ wd->scaleHeight = 22;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(15);
+ }
+ _walkDataLastIndex = 1;
+ _walkDataCurrentIndex = 1;
+}
+
+void IgorEngine::PART_13() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_InsideChurch, IMG_InsideChurch, BOX_InsideChurch, MSK_InsideChurch, TXT_InsideChurch);
+ loadActionData(DAT_InsideChurch);
+ _roomDataOffsets = PART_13_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(92, 0, 288, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_13_EXEC_ACTION);
+ PART_13_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ if (_currentPart == 130) {
+ PART_13_HELPER_3();
+ } else {
+ PART_13_HELPER_2();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart >= 130 && _currentPart <= 131) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ hideCursor();
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_14.cpp b/engines/igor/parts/part_14.cpp
new file mode 100644
index 0000000000..d202f4db6a
--- /dev/null
+++ b/engines/igor/parts/part_14.cpp
@@ -0,0 +1,615 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_14_ANIM_DATA_1[6] = { 0, 2, 5, 1, 8, 3 };
+
+static int VAR_NEW_CHURCH_MOSAIC_STONE;
+static int VAR_CURRENT_CHURCH_MOSAIC_STONE;
+
+void IgorEngine::PART_14_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ PART_14_ACTION_101();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ PART_14_ACTION_103();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ PART_14_ACTION_105();
+ break;
+ case 106:
+ PART_14_ACTION_106();
+ break;
+ case 107:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 108:
+ PART_14_ACTION_108();
+ break;
+ default:
+ error("PART_14_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_14_ACTION_101() {
+ _roomObjectAreasTable[_screenLayer2[22156]].area = 1;
+ _roomObjectAreasTable[_screenLayer2[27895]].area = 1;
+ --_walkDataLastIndex;
+ buildWalkPath(50, 103, 55, 87);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ for (int i = 192 * 3; i <= 207 * 3; ++i) {
+ if (_paletteBuffer[i] > 5) {
+ _currentPalette[i] -= 5;
+ } else {
+ _currentPalette[i] = 0;
+ }
+ }
+ setPaletteRange(192, 207);
+ --_walkDataLastIndex;
+ buildWalkPath(55, 87, 76, 69);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 220;
+}
+
+void IgorEngine::PART_14_ACTION_103() {
+ fadeOutPalette(768);
+ PART_14_HELPER_9();
+ loadResourceData__ROOM_ChurchPuzzle();
+ memcpy(_screenVGA + 46080, 0, 17920);
+ drawVerbsPanel();
+ drawInventory(_inventoryInfo[72], 0);
+ fadeInPalette(768);
+ if (_currentPart == 145) {
+ for (int i = 1; i <= 10; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x9486 + READ_LE_UINT16(_animFramesBuffer + 0xCCE4 + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(60);
+ }
+ stopSound();
+ _objectsState[50] = 1;
+ }
+ PART_14_HELPER_1(255);
+ _currentPart = 140;
+}
+
+void IgorEngine::PART_14_ACTION_105() {
+ _walkDataCurrentIndex = 0;
+ for (int i = 9; i >= 0; --i) {
+ WalkData *wd = &_walkData[0];
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ wd->setPos(182, 143, 3, _walkCurrentFrame);
+ WalkData::setNextFrame(3, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = 23 + i * 3;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 50;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(15);
+ }
+ _currentPart = 131;
+}
+
+void IgorEngine::PART_14_ACTION_106() {
+ --_walkDataLastIndex;
+ _roomObjectAreasTable[_screenLayer2[35684]].area = 2;
+ buildWalkPath(164, 126, 164, 111);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ for (int i = 192 * 3; i <= 207 * 3; ++i) {
+ if (_paletteBuffer[i] > 5) {
+ _currentPalette[i] -= 5;
+ } else {
+ _currentPalette[i] = 0;
+ }
+ }
+ setPaletteRange(192, 207);
+ _walkDataCurrentIndex = 0;
+ for (int i = 9; i >= 0; --i) {
+ WalkData *wd = &_walkData[0];
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ wd->setPos(164, 111, 1, _walkCurrentFrame);
+ WalkData::setNextFrame(1, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = 23 + i * 3;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 50;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(15);
+ }
+ _objectsState[71] = 0;
+ _currentPart = 670;
+}
+
+void IgorEngine::PART_14_ACTION_108() {
+ _gameState.unkF = false;
+ _updateRoomBackground = &IgorEngine::PART_14_UPDATE_ROOM_BACKGROUND_ACTION_108;
+ ADD_DIALOGUE_TEXT(226, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ removeObjectFromInventory(43);
+ for (int i = 1; i <= 3; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x2AAA + READ_LE_UINT16(_animFramesBuffer + 0x940C + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(60);
+ }
+ _gameState.unkF = true;
+ playSound(33, 1);
+ PART_14_HELPER_8(4, 24);
+ stopSound();
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(221, 85, 12, 33, 63);
+ waitForEndOfCutsceneDialogue(221, 85, 12, 33, 63);
+ PART_14_HELPER_8(25, 26);
+ PART_14_HELPER_8(60, 60);
+ WalkData *wd = &_walkData[_walkDataLastIndex - 1];
+ wd->x = 250;
+ wd->y = 138;
+ wd->posNum = 4;
+ ADD_DIALOGUE_TEXT(206, 1);
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(208, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(221, 85, 12, 33, 63);
+ waitForEndOfCutsceneDialogue(221, 85, 12, 33, 63);
+ ADD_DIALOGUE_TEXT(210, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(211, 2);
+ ADD_DIALOGUE_TEXT(213, 3);
+ ADD_DIALOGUE_TEXT(216, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startCutsceneDialogue(221, 85, 12, 33, 63);
+ waitForEndOfCutsceneDialogue(221, 85, 12, 33, 63);
+ for (int i = 33; i <= 35; ++i) {
+ const uint8 *src = _animFramesBuffer + 0x2AAA + READ_LE_UINT16(_animFramesBuffer + 0x940C + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(60);
+ }
+ addObjectToInventory(28, 63);
+ ADD_DIALOGUE_TEXT(217, 1);
+ ADD_DIALOGUE_TEXT(218, 1);
+ ADD_DIALOGUE_TEXT(219, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(220, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(221, 85, 12, 33, 63);
+ waitForEndOfCutsceneDialogue(221, 85, 12, 33, 63);
+ PART_14_HELPER_7(0);
+ _gameState.unkF = false;
+ _screenVGA[32865] = _screenLayer1[32865];
+ playSound(33, 1);
+ PART_14_HELPER_8(36, 60);
+ stopSound();
+ ADD_DIALOGUE_TEXT(222, 1);
+ ADD_DIALOGUE_TEXT(223, 1);
+ ADD_DIALOGUE_TEXT(224, 1);
+ ADD_DIALOGUE_TEXT(225, 1);
+ SET_DIALOGUE_TEXT(1, 4);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ PART_14_HELPER_1(255);
+ _updateRoomBackground = 0;
+}
+
+void IgorEngine::PART_14_UPDATE_ROOM_BACKGROUND_ACTION_108() {
+ if (compareGameTick(2, 16) && _gameState.unkF) {
+ PART_14_HELPER_7(getRandomNumber(2) + 1);
+ }
+}
+
+void IgorEngine::PART_14_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[50] == 1) {
+ PART_14_HELPER_6();
+ _roomObjectAreasTable[3].object = 5;
+ _roomObjectAreasTable[4].object = 5;
+ _roomObjectAreasTable[7].object = 5;
+ _roomObjectAreasTable[8].object = 5;
+ } else {
+ _roomObjectAreasTable[3].object = 0;
+ _roomObjectAreasTable[4].object = 2;
+ _roomObjectAreasTable[7].object = 0;
+ _roomObjectAreasTable[8].object = 2;
+ }
+ }
+}
+
+void IgorEngine::PART_14_HELPER_2() {
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ for (int i = 0; i <= 9; ++i) {
+ WalkData *wd = &_walkData[0];
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ wd->setPos(182, 143, 1, _walkCurrentFrame);
+ WalkData::setNextFrame(1, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = 23 + i * 3;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 32;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(15);
+ }
+ _walkDataLastIndex = 1;
+ _walkDataCurrentIndex = 1;
+ buildWalkPath(182, 143, 162, 138);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_14_HELPER_3() {
+ for (int i = 192 * 3; i <= 207 * 3; ++i) {
+ if (_paletteBuffer[i] > 5) {
+ _currentPalette[i] -= 5;
+ } else {
+ _currentPalette[i] = 0;
+ }
+ }
+ setPaletteRange(192, 207);
+ WalkData *wd = &_walkData[0];
+ wd->setPos(76, 69, 4, 0);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 24;
+ wd->scaleWidth = 40;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 0;
+ wd->scaleHeight = 40;
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[22156]].area = 1;
+ _roomObjectAreasTable[_screenLayer2[27895]].area = 1;
+ buildWalkPath(76, 69, 55, 87);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ for (int i = 192 * 3; i <= 207 * 3; ++i) {
+ _currentPalette[i] = _paletteBuffer[i];
+ }
+ setPaletteRange(192, 207);
+ --_walkDataLastIndex;
+ buildWalkPath(55, 87, 50, 103);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _roomObjectAreasTable[_screenLayer2[22156]].area = 0;
+ _roomObjectAreasTable[_screenLayer2[27895]].area = 0;
+}
+
+void IgorEngine::PART_14_HELPER_4() {
+ playMusic(4);
+ PART_14_HELPER_1(255);
+ for (int i = 192 * 3; i <= 207 * 3; ++i) {
+ if (_paletteBuffer[i] > 5) {
+ _currentPalette[i] -= 5;
+ } else {
+ _currentPalette[i] = 0;
+ }
+ }
+ setPaletteRange(192, 207);
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ _walkCurrentPos = 3;
+ for (int i = 0; i <= 9; ++i) {
+ WalkData *wd = &_walkData[0];
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ wd->setPos(164, 111, 3, _walkCurrentFrame);
+ WalkData::setNextFrame(3, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = 23 + i * 3;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 50;
+ moveIgor(3, wd->frameNum);
+ waitForTimer(15);
+ }
+ for (int i = 192 * 3; i <= 207 * 3; ++i) {
+ _currentPalette[i] = _paletteBuffer[i];
+ }
+ setPaletteRange(192, 207);
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[35684]].area = 2;
+ buildWalkPath(164, 111, 164, 126);
+ _roomObjectAreasTable[_screenLayer2[35684]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_14_HELPER_6() {
+ const int offset = 18382;
+ for (int i = 0; i <= 65; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + 0xD5BA + i * 44, 44);
+ }
+}
+
+void IgorEngine::PART_14_HELPER_7(int frame) {
+ const int offset = 38038;
+ for (int i = 0; i <= 1; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + 0x2AA4 + frame * 2 + i, 1);
+ }
+}
+
+void IgorEngine::PART_14_HELPER_8(int start, int end) {
+ _gameState.counter[0] = start - 1;
+ do {
+ if (compareGameTick(1, 16)) {
+ ++_gameState.counter[0];
+ const uint8 *src = _animFramesBuffer + 0x2AAA + READ_LE_UINT16(_animFramesBuffer + 0x940C + _gameState.counter[0] * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ }
+ if (compareGameTick(2, 16) && _gameState.unkF) {
+ PART_14_HELPER_7(getRandomNumber(2) + 1);
+ }
+ waitForTimer();
+ } while (_gameState.counter[0] != end);
+}
+
+void IgorEngine::PART_14_HELPER_9() {
+ PART_14_HELPER_10();
+ memcpy(_screenTextLayer, _screenVGA, 46080);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ memcpy(_screenLayer1, _screenTextLayer, 46080);
+ memset(_screenVGA + 46080, 0, 17920);
+ fadeInPalette(768);
+ _inputVars[kInputCursorXPos] = 160;
+ _inputVars[kInputCursorYPos] = 72;
+ showCursor();
+ _gameState.counter[4] = 0;
+ _currentPart = 145;
+ _dialogueEnded = false;
+ VAR_CURRENT_CHURCH_MOSAIC_STONE = 255;
+ do {
+ int area = _screenLayer2[_inputVars[kInputCursorYPos] * 320 + _inputVars[kInputCursorXPos]];
+ if (area == 0) {
+ VAR_NEW_CHURCH_MOSAIC_STONE = 1;
+ } else if (area >= 1 && area <= 8) {
+ VAR_NEW_CHURCH_MOSAIC_STONE = 2;
+ } else if (area == 9) {
+ VAR_NEW_CHURCH_MOSAIC_STONE = 3;
+ }
+ if (VAR_NEW_CHURCH_MOSAIC_STONE != VAR_CURRENT_CHURCH_MOSAIC_STONE) {
+ switch (VAR_NEW_CHURCH_MOSAIC_STONE) {
+ case 1:
+ drawActionSentence("", 253);
+ break;
+ case 2:
+ drawActionSentence("Push stone", 253);
+ break;
+ case 3:
+ drawActionSentence("Exit", 253);
+ break;
+ }
+ VAR_CURRENT_CHURCH_MOSAIC_STONE = VAR_NEW_CHURCH_MOSAIC_STONE;
+ }
+ if (_inputVars[kInputClick]) {
+ _inputVars[kInputClick] = 0;
+ _dialogueEnded = area == 0;
+ if (area == 9) {
+ _currentPart = 146;
+ }
+ if (area >= 1 && area <= 8) {
+ drawActionSentence("Push stone", 251);
+ hideCursor();
+ playSound(34, 1);
+ switch (area) {
+ case 1:
+ PART_14_PUSH_STONE(33359, 28, 34, 0);
+ break;
+ case 2:
+ PART_14_PUSH_STONE(22800, 27, 34, 0x3D4);
+ break;
+ case 3:
+ PART_14_PUSH_STONE(10642, 39, 45, 0x785);
+ break;
+ case 4:
+ PART_14_PUSH_STONE(3624, 56, 39, 0xCCFA);
+ break;
+ case 5:
+ PART_14_PUSH_STONE(3679, 54, 38, 0xE87);
+ break;
+ case 6:
+ PART_14_PUSH_STONE(11077, 35, 35, 0x1D8F);
+ break;
+ case 7:
+ PART_14_PUSH_STONE(20688, 28, 36, 0x227B);
+ break;
+ case 8:
+ PART_14_PUSH_STONE(31889, 27, 38, 0x2687);
+ break;
+ }
+ }
+ stopSound();
+ drawActionSentence("Push stone", 253);
+ showCursor();
+ _dialogueEnded = false;
+ ++_gameState.counter[4];
+ if (_objectsState[2] == 0 || PART_14_ANIM_DATA_1[_gameState.counter[4]] != area) {
+ _currentPart = 0;
+ }
+ if (_gameState.counter[4] == 5) {
+ if (_currentPart == 145) {
+ _dialogueEnded = true;
+ } else {
+ _currentPart = 145;
+ _gameState.counter[4] = 0;
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ playSound(35, 1);
+ waitForTimer(255);
+ stopSound();
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ }
+ }
+ }
+ if (_inputVars[kInputEscape]) {
+ _inputVars[kInputEscape] = 0;
+ _currentPart = 146;
+ _dialogueEnded = true;
+ }
+ } while (_currentPart >= 145 && _currentPart <= 146 && !_dialogueEnded);
+ drawActionSentence("", 253);
+ hideCursor();
+ if (_currentPart == 145) {
+ playSound(35, 1);
+ }
+ fadeOutPalette(768);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ SET_PAL_208_96_1();
+}
+
+void IgorEngine::PART_14_HELPER_10() {
+ loadData(PAL_ChurchMosaic, _paletteBuffer);
+ loadData(IMG_ChurchMosaic, _screenLayer1);
+ uint8 *p = loadData(MSK_ChurchMosaic);
+ decodeRoomMask(p);
+ free(p);
+}
+
+void IgorEngine::PART_14_PUSH_STONE(int screenOffset, int w, int h, int animOffset) {
+ for (int i = 0; i <= h; ++i) {
+ memcpy(_screenTempLayer + i * 100, _screenVGA + i * 320 + animOffset, w);
+ memcpy(_screenVGA + i * 320 + screenOffset, _animFramesBuffer + i * w, w);
+ }
+ waitForTimer(127);
+ for (int i = 0; i <= h; ++i) {
+ memcpy(_screenVGA + i * 320 + screenOffset, _screenTempLayer + i * 100, 28);
+ }
+}
+
+void IgorEngine::PART_14() {
+ _gameState.enableLight = 1;
+ loadResourceData__ROOM_ChurchPuzzle();
+ loadResourceData__ANIM_ChurchPuzzle();
+ loadActionData(DAT_ChurchPuzzle);
+ _roomDataOffsets = PART_14_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 256, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_14_EXEC_ACTION);
+ PART_14_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ if (_currentPart == 140) {
+ PART_14_HELPER_2();
+ }
+ if (_currentPart == 141) {
+ PART_14_HELPER_3();
+ }
+ if (_currentPart == 142) {
+ PART_14_HELPER_4();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart >= 140 && _currentPart <= 142) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ hideCursor();
+ fadeOutPalette(624);
+}
+
+void IgorEngine::loadResourceData__ROOM_ChurchPuzzle() {
+ loadRoomData(PAL_ChurchPuzzle, IMG_ChurchPuzzle, BOX_ChurchPuzzle, MSK_ChurchPuzzle, TXT_ChurchPuzzle);
+}
+
+void IgorEngine::loadResourceData__ANIM_ChurchPuzzle() {
+ static const int anm1[] = { FRM_ChurchPuzzle1, FRM_ChurchPuzzle2, FRM_ChurchPuzzle3, FRM_ChurchPuzzle4, 0 };
+ loadAnimData(anm1, 0);
+ static const int anm2[] = { FRM_ChurchPuzzle5, FRM_ChurchPuzzle6, FRM_ChurchPuzzle7, FRM_ChurchPuzzle8, FRM_ChurchPuzzle9, FRM_ChurchPuzzle10, FRM_ChurchPuzzle11, FRM_ChurchPuzzle12, 0 };
+ loadAnimData(anm2, 0x1D8F);
+ static const int anm3[] = { FRM_ChurchPuzzle13, FRM_ChurchPuzzle14, 0 };
+ loadAnimData(anm3, 0xCCE6);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_15.cpp b/engines/igor/parts/part_15.cpp
new file mode 100644
index 0000000000..411fc73821
--- /dev/null
+++ b/engines/igor/parts/part_15.cpp
@@ -0,0 +1,521 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_15_ANIM_DATA_1[8] = { 5, 6, 0, 3, 3, 0, 0, 1 };
+
+static const uint8 PART_15_ANIM_DATA_2[8] = { 0, 1, 2, 3, 4, 3, 5, 6 };
+
+static const uint8 PART_15_ANIM_DATA_3[12] = { 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 3 };
+
+static const uint8 PART_15_ANIM_DATA_4[8] = { 0, 7, 8, 3, 4, 3, 5, 6 };
+
+static const uint8 PART_15_ANIM_DATA_5[12] = { 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 3 };
+
+void IgorEngine::PART_15_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ PART_15_ACTION_101();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(205, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(205, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(205, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ PART_15_ACTION_107();
+ break;
+ case 108:
+ ADD_DIALOGUE_TEXT(208, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 109:
+ ADD_DIALOGUE_TEXT(201, 1);
+ ADD_DIALOGUE_TEXT(202, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 110:
+ ADD_DIALOGUE_TEXT(234, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 111:
+ ADD_DIALOGUE_TEXT(235, 1);
+ ADD_DIALOGUE_TEXT(236, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 112:
+ ADD_DIALOGUE_TEXT(237, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 113:
+ ADD_DIALOGUE_TEXT(235, 1);
+ ADD_DIALOGUE_TEXT(236, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 114:
+ ADD_DIALOGUE_TEXT(240, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 115:
+ PART_15_ACTION_115();
+ break;
+ case 116:
+ PART_15_ACTION_116();
+ break;
+ default:
+ error("PART_15_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_15_ACTION_101() {
+ --_walkDataLastIndex;
+ _roomObjectAreasTable[_screenLayer2[34560]].area = 1;
+ buildWalkPathSimple(34, 108, 0, 108);
+ _roomObjectAreasTable[_screenLayer2[34560]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 271;
+}
+
+void IgorEngine::PART_15_ACTION_107() {
+ if (_gameState.counter[3] == 1) {
+ do {
+ PART_15_HELPER_3();
+ waitForTimer();
+ } while (_gameState.counter[3] != 0);
+ }
+ PART_15_HELPER_7(6);
+ PART_15_HANDLE_DIALOGUE_TOBIAS();
+}
+
+void IgorEngine::PART_15_ACTION_115() {
+ if (_gameState.counter[3] == 1) {
+ do {
+ PART_15_HELPER_3();
+ waitForTimer();
+ } while (_gameState.counter[3] != 0);
+ }
+ PART_15_HELPER_7(6);
+ ADD_DIALOGUE_TEXT(209, 1);
+ ADD_DIALOGUE_TEXT(210, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(212, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(213, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(214, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ for (int i = 1; i <= 11; ++i) {
+ PART_15_HELPER_9(PART_15_ANIM_DATA_3[i]);
+ waitForTimer(60);
+ }
+ PART_15_HELPER_7(6);
+ if (_objectsState[37] == 0) {
+ ADD_DIALOGUE_TEXT(215, 2);
+ ADD_DIALOGUE_TEXT(217, 1);
+ } else {
+ ADD_DIALOGUE_TEXT(218, 2);
+ ADD_DIALOGUE_TEXT(223, 1);
+ }
+ SET_DIALOGUE_TEXT(1, 2);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ if (_objectsState[37] == 0) {
+ return;
+ }
+ for (int i = 1; i <= 7; ++i) {
+ PART_15_HELPER_7(PART_15_ANIM_DATA_2[i]);
+ waitForTimer(40);
+ }
+ removeObjectFromInventory(70);
+ _objectsState[46] = 1;
+ if (_objectsState[47] == 0) {
+ ADD_DIALOGUE_TEXT(221, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ return;
+ }
+ ADD_DIALOGUE_TEXT(226, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(228, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(229, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(230, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ _currentPart = 780;
+}
+
+void IgorEngine::PART_15_ACTION_116() {
+ if (_gameState.counter[3] == 1) {
+ do {
+ PART_15_HELPER_3();
+ waitForTimer();
+ } while (_gameState.counter[3] != 0);
+ }
+ PART_15_HELPER_7(6);
+ ADD_DIALOGUE_TEXT(209, 1);
+ ADD_DIALOGUE_TEXT(211, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(212, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(213, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(214, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ for (int i = 1; i <= 11; ++i) {
+ PART_15_HELPER_9(PART_15_ANIM_DATA_5[i]);
+ waitForTimer(60);
+ }
+ PART_15_HELPER_7(6);
+ if (_objectsState[37] == 0) {
+ ADD_DIALOGUE_TEXT(215, 2);
+ ADD_DIALOGUE_TEXT(217, 1);
+ } else {
+ ADD_DIALOGUE_TEXT(218, 2);
+ ADD_DIALOGUE_TEXT(223, 1);
+ }
+ SET_DIALOGUE_TEXT(1, 2);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ if (_objectsState[37] == 0) {
+ return;
+ }
+ for (int i = 1; i <= 7; ++i) {
+ PART_15_HELPER_7(PART_15_ANIM_DATA_4[i]);
+ waitForTimer(40);
+ }
+ removeObjectFromInventory(60);
+ _objectsState[47] = 1;
+ if (_objectsState[46] == 0) {
+ ADD_DIALOGUE_TEXT(224, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ return;
+ }
+ ADD_DIALOGUE_TEXT(226, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(228, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(229, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ waitForEndOfCutsceneDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(230, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ _currentPart = 780;
+}
+
+void IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_15_HELPER_8(0);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_15_HELPER_8(getRandomNumber(5));
+ break;
+ case kUpdateDialogueAnimStanding:
+ PART_15_HELPER_8(0);
+ break;
+ }
+}
+
+void IgorEngine::PART_15_HANDLE_DIALOGUE_TOBIAS() {
+ loadDialogueData(DLG_TobiasOffice);
+ _updateDialogue = &IgorEngine::PART_15_UPDATE_DIALOGUE_TOBIAS;
+ handleDialogue(133, 67, 0, 63, 19);
+ _updateDialogue = 0;
+}
+
+void IgorEngine::PART_15_HELPER_1(int num) {
+}
+
+void IgorEngine::PART_15_HELPER_2() {
+ _walkData[0].setPos(0, 108, 2, 0);
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 15;
+ _walkData[0].scaleWidth = 25;
+ _walkData[0].xPosChanged = 1;
+ _walkData[0].dxPos = 0;
+ _walkData[0].yPosChanged = 1;
+ _walkData[0].dyPos = 0;
+ _walkData[0].scaleHeight = 25;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ _roomObjectAreasTable[_screenLayer2[34560]].area = 1;
+ buildWalkPathSimple(0, 108, 34, 108);
+ _roomObjectAreasTable[_screenLayer2[34560]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_15_HELPER_3() {
+ if (compareGameTick(38) || compareGameTick(60)) {
+ if (_objectsState[48] != 1 && _gameState.counter[3] == 1) {
+ if (_gameState.unk11 == 0) {
+ _objectsState[48] = 1;
+ _objectsState[49] = 1;
+ _gameState.counter[3] = 0;
+ } else {
+ PART_15_HELPER_6(_gameState.unk11);
+ }
+ if (_gameState.unk11 == 7) {
+ _objectsState[49] = 2;
+ }
+ if (_objectsState[49] == 2) {
+ if (_gameState.counter[4] == 0) {
+ playSound(54, 1);
+ }
+ ++_gameState.counter[4];
+ if (_gameState.unk11 == 7) {
+ _gameState.unk11 = 6;
+ } else {
+ _gameState.unk11 = 7;
+ }
+ if (_gameState.counter[4] > 15) {
+ _objectsState[49] = 3;
+ _gameState.unk11 = 6;
+ }
+ } else if (_objectsState[49] == 1) {
+ ++_gameState.unk11;
+ } else {
+ --_gameState.unk11;
+ }
+ }
+ }
+}
+
+void IgorEngine::PART_15_HELPER_5() {
+ if (compareGameTick(7) || compareGameTick(29) || compareGameTick(61)) {
+ if (_gameState.unk10 >= 3) {
+ PART_15_HELPER_9(PART_15_ANIM_DATA_1[_gameState.unk10]);
+ ++_gameState.unk10;
+ if (_gameState.unk10 == 8) {
+ _gameState.unk10 = 1;
+ }
+ }
+ }
+ if (compareGameTick(5)) {
+ if (_gameState.unk10 >= 1 && _gameState.unk10 <= 2) {
+ PART_15_HELPER_9(_gameState.unk10);
+ if (_gameState.unk10 == 1 && getRandomNumber(10) == 0) {
+ _gameState.unk10 = 2;
+ } else {
+ _gameState.unk10 = 1;
+ }
+ if (getRandomNumber(30) == 0) {
+ _gameState.unk10 = 3;
+ }
+ }
+ }
+}
+
+void IgorEngine::PART_15_HELPER_6(int frame) {
+ _roomCursorOn = false;
+ for (_gameState.counter[1] = 0; _gameState.counter[1] <= 17; ++_gameState.counter[1]) {
+ for (_gameState.counter[2] = 0; _gameState.counter[2] <= 52; ++_gameState.counter[2]) {
+ int offset = (_gameState.counter[1] + 23) * 320 + _gameState.counter[2] + 18;
+ uint8 color = _screenVGA[offset];
+ if (color < 0xF0 || color > 0xF1) {
+ color = _animFramesBuffer[0x4B8C + frame * 954 + _gameState.counter[1] * 53 + _gameState.counter[2]];
+ }
+ _screenTempLayer[_gameState.counter[1] * 100 + _gameState.counter[2]] = color;
+ }
+ }
+ int offset = 7378;
+ for (_gameState.counter[1] = 0; _gameState.counter[1] <= 17; ++_gameState.counter[1]) {
+ memcpy(_screenVGA + _gameState.counter[1] * 320 + offset, _screenTempLayer + _gameState.counter[1] * 100, 53);
+ memcpy(_screenLayer1 + _gameState.counter[1] * 320 + offset, _animFramesBuffer + 0x4B8C + frame * 954 + _gameState.counter[1] * 53, 53);
+ }
+ if (_gameState.dialogueTextRunning) {
+ memcpy(_screenTextLayer + 23040, _screenLayer1 + _dialogueDirtyRectY, _dialogueDirtyRectSize);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_15_HELPER_7(int frame) {
+ int offset = 20887;
+ for (int i = 0; i <= 35; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + 0x49A + frame * 2124 + i * 59, 59);
+ }
+}
+
+void IgorEngine::PART_15_HELPER_8(int frame) {
+ int offset = 22847;
+ for (int i = 0; i <= 12; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + 0x958 + frame * 182 + i * 14, 14);
+ }
+}
+
+void IgorEngine::PART_15_HELPER_9(int frame) {
+ int offset = 22835;
+ for (int i = 0; i <= 22; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + frame * 598 + i * 26, 26);
+ }
+}
+
+void IgorEngine::PART_15() {
+ _gameState.enableLight = 2;
+ loadRoomData(PAL_TobiasOffice, IMG_TobiasOffice, BOX_TobiasOffice, MSK_TobiasOffice, TXT_TobiasOffice);
+ static const int anm[] = { ANM_TobiasOffice1, AOF_TobiasOffice1, ANM_TobiasOffice2, AOF_TobiasOffice2, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_TobiasOffice);
+ _roomDataOffsets = PART_15_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(28, 0, 96, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_15_EXEC_ACTION);
+ _updateRoomBackground = 0;
+ PART_15_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ _gameState.unk10 = 1;
+ _gameState.unk11 = 2;
+ _gameState.counter[3] = 0;
+ _gameState.counter[4] = 0;
+ PART_15_HELPER_2();
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 150) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_15_HELPER_5();
+ if (_gameTicks == 38 || _gameTicks == 60) {
+ if (_objectsState[48] != 1 && getRandomNumber(200) == 0 && _gameState.counter[3] == 0) {
+ _gameState.counter[3] = 1;
+ }
+ }
+ PART_15_HELPER_3();
+ waitForTimer();
+ }
+ if (_objectsState[48] == 1) {
+ _objectsState[48] = 2;
+ }
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_16.cpp b/engines/igor/parts/part_16.cpp
new file mode 100644
index 0000000000..d5f2e05ccd
--- /dev/null
+++ b/engines/igor/parts/part_16.cpp
@@ -0,0 +1,304 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static int VAR_CURRENT_TALKING_ACTOR;
+
+void IgorEngine::PART_16_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ PART_16_ACTION_101();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(208, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ _currentPart = 261;
+ break;
+ default:
+ error("PART_16_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_16_ACTION_101() {
+ if (_objectsState[52] == 1) {
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ ADD_DIALOGUE_TEXT(201, 1);
+ ADD_DIALOGUE_TEXT(202, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ for (int i = 1; i <= 2; ++i) {
+ int offset = 20332;
+ for (int j = 0; j <= 48; ++j) {
+ const uint8 *src = _animFramesBuffer + j * 23 + (i - 1) * 1127;
+ memcpy(_screenVGA + j * 320 + offset, src, 23);
+ }
+ waitForTimer(120);
+ }
+ addObjectToInventory(20, 55);
+ _objectsState[52] = 1;
+ ADD_DIALOGUE_TEXT(204, 3);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+}
+
+void IgorEngine::PART_16_UPDATE_DIALOGUE_MARGARET_HARRISON(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_16_HELPER_6((VAR_CURRENT_TALKING_ACTOR == 0) ? 34 : 48);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_16_HELPER_6((VAR_CURRENT_TALKING_ACTOR == 0) ? getRandomNumber(5) + 30 : getRandomNumber(5) + 44);
+ break;
+ }
+}
+
+void IgorEngine::PART_16_UPDATE_DIALOGUE_MARGARET(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_16_HELPER_6(49);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_16_HELPER_6(getRandomNumber(4) + 49);
+ break;
+ }
+}
+
+void IgorEngine::PART_16_HELPER_1(int num) {
+}
+
+void IgorEngine::PART_16_HELPER_2() {
+ WalkData *wd = &_walkData[0];
+ wd->setPos(0, 135, 2, 0);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = 50;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 0;
+ wd->scaleHeight = 50;
+ _walkDataLastIndex = 0;
+ buildWalkPath(0, 135, 90, 135);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_16_HELPER_3() {
+ memset(_screenVGA + 46080, 0, 17920);
+ ADD_DIALOGUE_TEXT(210, 1);
+ ADD_DIALOGUE_TEXT(211, 1);
+ ADD_DIALOGUE_TEXT(212, 1);
+ ADD_DIALOGUE_TEXT(213, 2);
+ SET_DIALOGUE_TEXT(1, 4);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ --_walkDataLastIndex;
+ buildWalkPath(90, 135, 200, 143);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _walkDataCurrentIndex = 0;
+ for (int i = 15; i >= 0; --i) {
+ if (i == 15) {
+ _walkCurrentFrame = 0;
+ }
+ _walkData[0].setPos(200, 143, 3, _walkCurrentFrame);
+ WalkData::setNextFrame(3, _walkCurrentFrame);
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 30;
+ _walkData[0].scaleWidth = i * 3 + 5;
+ _walkData[0].xPosChanged = 1;
+ _walkData[0].dxPos = 0;
+ _walkData[0].yPosChanged = 1;
+ _walkData[0].dyPos = 3;
+ _walkData[0].scaleHeight = 50;
+ moveIgor(_walkData[0].posNum, _walkData[0].frameNum);
+ waitForTimer(15);
+ }
+ fadeOutPalette(768);
+ _currentPart = 331;
+ PART_33();
+ memset(_currentPalette, 0, 768);
+ setPaletteRange(208, 255);
+ do {
+ PART_MARGARET_ROOM_CUTSCENE();
+ } while (_objectsState[110] != 9);
+ setupDefaultPalette();
+ SET_PAL_240_48_1();
+ SET_PAL_208_96_1();
+ loadResourceData__ROOM_Laboratory();
+ loadResourceData__ANIM_Laboratory();
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ PART_16_HELPER_1(255);
+ fadeInPalette(768);
+ waitForTimer(255);
+ for (int i = 1; i <= 29; ++i) {
+ decodeAnimFrame(_animFramesBuffer + 0x8CE + READ_LE_UINT16(_animFramesBuffer + 0x6F36 + i * 2) - 1, _screenVGA, true);
+ waitForTimer(25);
+ }
+ ADD_DIALOGUE_TEXT(215, 1);
+ ADD_DIALOGUE_TEXT(216, 1);
+ ADD_DIALOGUE_TEXT(217, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startCutsceneDialogue(175, 78, 0, 58, 40);
+ VAR_CURRENT_TALKING_ACTOR = 0;
+ _updateDialogue = &IgorEngine::PART_16_UPDATE_DIALOGUE_MARGARET_HARRISON;
+ waitForEndOfCutsceneDialogue(175, 78, 0, 58, 40);
+ _updateDialogue = 0;
+ for (int i = 35; i <= 41; ++i) {
+ decodeAnimFrame(_animFramesBuffer + 0x8CE + READ_LE_UINT16(_animFramesBuffer + 0x6F36 + i * 2) - 1, _screenVGA, true);
+ waitForTimer(35);
+ }
+ ADD_DIALOGUE_TEXT(218, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(88, 69, 63, 32, 0);
+ _updateDialogue = &IgorEngine::PART_16_UPDATE_DIALOGUE_MARGARET;
+ waitForEndOfCutsceneDialogue(88, 69, 63, 32, 0);
+ _updateDialogue = 0;
+ for (int i = 42; i <= 43; ++i) {
+ decodeAnimFrame(_animFramesBuffer + 0x8CE + READ_LE_UINT16(_animFramesBuffer + 0x6F36 + i * 2) - 1, _screenVGA, true);
+ waitForTimer(35);
+ }
+ ADD_DIALOGUE_TEXT(220, 1);
+ ADD_DIALOGUE_TEXT(221, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startCutsceneDialogue(175, 78, 0, 58, 40);
+ VAR_CURRENT_TALKING_ACTOR = 1;
+ _updateDialogue = &IgorEngine::PART_16_UPDATE_DIALOGUE_MARGARET_HARRISON;
+ waitForEndOfCutsceneDialogue(175, 78, 0, 58, 40);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(222, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(88, 69, 63, 32, 0);
+ _updateDialogue = &IgorEngine::PART_16_UPDATE_DIALOGUE_MARGARET;
+ waitForEndOfCutsceneDialogue(88, 69, 63, 32, 0);
+ _updateDialogue = 0;
+ playSound(26, 1);
+ for (int i = 53; i <= 61; ++i) {
+ decodeAnimFrame(_animFramesBuffer + 0x8CE + READ_LE_UINT16(_animFramesBuffer + 0x6F36 + i * 2) - 1, _screenVGA, true);
+ waitForTimer(35);
+ }
+ playSound(25, 1);
+ for (int i = 1; i <= 20; ++i) {
+ int frame = getRandomNumber(4) + 61;
+ decodeAnimFrame(_animFramesBuffer + 0x8CE + READ_LE_UINT16(_animFramesBuffer + 0x6F36 + frame * 2) - 1, _screenVGA, true);
+ waitForTimer(15);
+ }
+ playSound(27, 1);
+ PART_16_HELPER_5();
+ for (int i = 1; i <= 3; ++i) {
+ waitForTimer(255);
+ }
+ PART_16_HELPER_1(255);
+ addObjectToInventory(19, 54);
+ _objectsState[53] = 1;
+ _objectsState[65] = 3;
+ playMusic(3);
+ _currentPart = 261;
+}
+
+void IgorEngine::PART_16_HELPER_5() {
+ memset(&_currentPalette[3], 63, 621);
+ setPaletteRange(1, 207);
+ loadData(IMG_PhotoHarrisonMargaret, _screenVGA);
+ loadData(PAL_PhotoHarrisonMargaret, _paletteBuffer);
+ for (int m = 1; m <= 63; ++m) {
+ for (int i = 3; i <= 207 * 3; ++i) {
+ if (_paletteBuffer[i] <= m && _paletteBuffer[i] >= _currentPalette[i]) {
+ --_currentPalette[i];
+ }
+ }
+ setPaletteRange(1, 207);
+ waitForTimer();
+ }
+}
+
+void IgorEngine::PART_16_HELPER_6(int frame) {
+ const uint8 *src = _animFramesBuffer + 0x8CE + READ_LE_UINT16(_animFramesBuffer + 0x6F36 + frame * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+}
+
+void IgorEngine::PART_16() {
+ _gameState.enableLight = 1;
+ loadResourceData__ROOM_Laboratory();
+ loadResourceData__ANIM_Laboratory();
+ loadActionData(DAT_Laboratory);
+ _roomDataOffsets = PART_16_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 248, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_16_EXEC_ACTION);
+ PART_16_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ PART_16_HELPER_2();
+ if (_objectsState[65] == 2 && _inventoryInfo[71] != 0 && _objectsState[76] == 1) {
+ PART_16_HELPER_3();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 160) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ hideCursor();
+ fadeOutPalette(624);
+}
+
+void IgorEngine::loadResourceData__ROOM_Laboratory() {
+ loadRoomData(PAL_Laboratory, IMG_Laboratory, BOX_Laboratory, MSK_Laboratory, TXT_Laboratory);
+}
+
+void IgorEngine::loadResourceData__ANIM_Laboratory() {
+ static const int anm[] = { FRM_Laboratory1, FRM_Laboratory2, FRM_Laboratory3, 0 };
+ loadAnimData(anm);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_17.cpp b/engines/igor/parts/part_17.cpp
new file mode 100644
index 0000000000..45b77b0966
--- /dev/null
+++ b/engines/igor/parts/part_17.cpp
@@ -0,0 +1,529 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static int VAR_CURRENT_TALKING_ACTOR;
+
+void IgorEngine::PART_17_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ PART_17_ACTION_101();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(225, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ PART_17_ACTION_103();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(220, 3);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ PART_17_ACTION_105();
+ break;
+ case 106:
+ PART_17_ACTION_106();
+ break;
+ default:
+ error("PART_17_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_17_ACTION_101() {
+ _roomObjectAreasTable[_screenLayer2[22034]].area = 8;
+ _roomObjectAreasTable[_screenLayer2[23923]].area = 8;
+ --_walkDataLastIndex;
+ buildWalkPath(243, 77, 243, 74);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ buildWalkPath(243, 74, 274, 68);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 302;
+}
+
+void IgorEngine::PART_17_ACTION_103() {
+ PART_17_HELPER_8(0);
+ if (_gameState.counter[4] == 1) {
+ ADD_DIALOGUE_TEXT(201, 2);
+ } else if (_gameState.counter[4] == 2) {
+ ADD_DIALOGUE_TEXT(206, 2);
+ } else if (_gameState.counter[4] == 3) {
+ ADD_DIALOGUE_TEXT(210, 2);
+ }
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(156, 32, 35, 38, 47);
+ _updateDialogue = &IgorEngine::PART_17_UPDATE_DIALOGUE_PHILIP;
+ waitForEndOfCutsceneDialogue(156, 32, 35, 38, 47);
+ _updateDialogue = 0;
+ if (_gameState.counter[4] == 1) {
+ ADD_DIALOGUE_TEXT(203, 1);
+ ADD_DIALOGUE_TEXT(204, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ } else if (_gameState.counter[4] == 2) {
+ ADD_DIALOGUE_TEXT(208, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ } else if (_gameState.counter[4] == 3) {
+ ADD_DIALOGUE_TEXT(212, 2);
+ ADD_DIALOGUE_TEXT(214, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ }
+ startCutsceneDialogue(135, 33, 63, 63, 0);
+ VAR_CURRENT_TALKING_ACTOR = 0;
+ _updateDialogue = &IgorEngine::PART_17_UPDATE_DIALOGUE_PHILIP_JIMMY;
+ waitForEndOfCutsceneDialogue(135, 33, 63, 63, 0);
+ _updateDialogue = 0;
+ PART_17_HELPER_11(0);
+ waitForTimer(255);
+ ADD_DIALOGUE_TEXT(215 + getRandomNumber(4), 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(135, 33, 63, 63, 0);
+ VAR_CURRENT_TALKING_ACTOR = 1;
+ _updateDialogue = &IgorEngine::PART_17_UPDATE_DIALOGUE_PHILIP_JIMMY;
+ waitForEndOfCutsceneDialogue(135, 33, 63, 63, 0);
+ _updateDialogue = 0;
+ PART_17_HANDLE_DIALOGUE_PHILIP();
+ PART_17_HELPER_1(255);
+ PART_17_HELPER_8(0);
+ --_walkDataLastIndex;
+ buildWalkPath(104, 87, 143, 123);
+ _walkDataCurrentIndex = 1;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ ADD_DIALOGUE_TEXT(219, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ if (_gameState.counter[4] == 3) {
+ _gameState.counter[4] = 1;
+ } else {
+ ++_gameState.counter[4];
+ }
+}
+
+void IgorEngine::PART_17_ACTION_105() {
+ _roomObjectAreasTable[5].area = 1;
+ _roomObjectAreasTable[10].area = 2;
+ _roomObjectAreasTable[11].area = 2;
+ _roomObjectAreasTable[13].area = 2;
+ _roomObjectAreasTable[16].area = 3;
+ _roomObjectAreasTable[17].area = 4;
+ _roomObjectAreasTable[26].area = 4;
+ _roomObjectAreasTable[28].area = 4;
+ --_walkDataLastIndex;
+ buildWalkPath(45, 95, 41, 86);
+ _walkDataCurrentIndex = 1;
+ _walkData[_walkDataLastIndex].frameNum = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ PART_17_HELPER_5(143);
+ --_walkDataLastIndex;
+ _roomObjectAreasTable[_screenLayer2[44836]].area = 4;
+ buildWalkPath(41, 86, 36, 143);
+ _roomObjectAreasTable[_screenLayer2[44836]].area = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ for (int i = _walkDataCurrentIndex; i <= _walkDataLastIndex; ++i) {
+ _walkData[i].posNum = kFacingPositionBack;
+ }
+ waitForIgorMove();
+ for (int i = 17; i <= 85; ++i) {
+ _walkYScaleRoom[i] = ((i - 13) / 4) + 5;
+ }
+ for (int i = 86; i <= 135; ++i) {
+ _walkYScaleRoom[i] = 23;
+ }
+ _walkData[0].setPos(65, 115, 1, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 14;
+ _walkData[0].scaleWidth = 23;
+ _walkData[0].scaleHeight = 23;
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[36865]].area = 4;
+ buildWalkPath(65, 115, 21, 17);
+ _roomObjectAreasTable[_screenLayer2[36865]].area = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 40;
+}
+
+void IgorEngine::PART_17_ACTION_106() {
+ if (_objectsState[55] == 1) {
+ ADD_DIALOGUE_TEXT(226, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ playSound(24, 1);
+ for (int i = 0; i <= 8; ++i) {
+ int offset = 12575;
+ for (int j = 0; j <= 27; ++j) {
+ memcpy(_screenVGA + offset + i * 320, _animFramesBuffer + 0x1E6E + j * 40 + i * 1120, 40);
+ }
+ waitForTimer(30);
+ }
+ int offset = 12575;
+ for (int i = 0; i <= 27; ++i) {
+ memcpy(_screenVGA + offset + i * 320, _animFramesBuffer + 0x1E6E + i * 40, 40);
+ }
+ _objectsState[55] = 1;
+ _objectsState[3] = 1;
+ PART_17_HELPER_1(255);
+ UPDATE_OBJECT_STATE(4);
+ --_walkDataLastIndex;
+ buildWalkPath(104, 87, 143, 123);
+ _walkDataCurrentIndex = 1;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ ADD_DIALOGUE_TEXT(223, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+}
+
+void IgorEngine::PART_17_HANDLE_DIALOGUE_PHILIP() {
+ loadDialogueData(DLG_OutsideCollege);
+ warning("PART_17_HANDLE_DIALOGUE_PHILIP unimplemented");
+}
+
+void IgorEngine::PART_17_UPDATE_DIALOGUE_PHILIP(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_17_HELPER_9(0);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_17_HELPER_9(getRandomNumber(7));
+ break;
+ }
+}
+
+void IgorEngine::PART_17_UPDATE_DIALOGUE_PHILIP_JIMMY(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ if (VAR_CURRENT_TALKING_ACTOR == 0) {
+ PART_17_HELPER_8(0);
+ } else {
+ PART_17_HELPER_11(0);
+ }
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ if (VAR_CURRENT_TALKING_ACTOR == 0) {
+ PART_17_HELPER_8(getRandomNumber(7));
+ } else {
+ PART_17_HELPER_11(getRandomNumber(6));
+ }
+ break;
+ }
+}
+
+void IgorEngine::PART_17_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(3, 32) && _gameState.unkF) {
+ switch (_gameState.unk10 / 16) {
+ case 0:
+ PART_17_HELPER_8(0);
+ PART_17_HELPER_9(getRandomNumber(7));
+ break;
+ case 1:
+ PART_17_HELPER_8(getRandomNumber(7));
+ PART_17_HELPER_9(0);
+ }
+ if (_gameState.unk10 == 31) {
+ _gameState.unk10 = 0;
+ } else {
+ ++_gameState.unk10;
+ }
+ }
+}
+
+void IgorEngine::PART_17_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[54] == 0) {
+ _gameState.unkF = false;
+ } else {
+ PART_17_HELPER_3(0);
+ _gameState.unkF = true;
+ }
+ }
+ if (num == 2 || num == 255) {
+ if (_objectsState[55] == 1) {
+ _roomActionsTable[2698] = 0;
+ }
+ }
+ if (num == 3 || num == 255) {
+ if (_objectsState[56] == 1) {
+ _gameState.unkF = false;
+ PART_17_HELPER_3(6);
+ }
+ }
+}
+
+void IgorEngine::PART_17_HELPER_2() {
+ for (int i = 17; i <= 85; ++i) {
+ _walkYScaleRoom[i] = ((i - 13) / 4) + 5;
+ }
+ for (int i = 86; i <= 135; ++i) {
+ _walkYScaleRoom[i] = 23;
+ }
+ WalkData *wd = &_walkData[0];
+ wd->setPos(21, 17, 3, 0);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 4;
+ wd->scaleWidth = 6;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 0;
+ wd->scaleHeight = 6;
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[36865]].area = 4;
+ buildWalkPath(21, 17, 65, 115);
+ _roomObjectAreasTable[_screenLayer2[36865]].area = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ for (int i = 17; i <= 135; ++i) {
+ _walkYScaleRoom[i] = 50;
+ }
+ _walkData[0].setPos(36, 140, 3, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 30;
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[44836]].area = 4;
+ buildWalkPath(36, 143, 41, 86);
+ _roomObjectAreasTable[_screenLayer2[44836]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ for (int i = _walkDataCurrentIndex; i <= _walkDataLastIndex; ++i) {
+ _walkData[i].posNum = kFacingPositionFront;
+ }
+ waitForIgorMove();
+ PART_17_HELPER_5(0);
+ --_walkDataLastIndex;
+ buildWalkPath(41, 86, 45, 95);
+ _walkDataCurrentIndex = 2;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _roomObjectAreasTable[5].area = 0;
+ _roomObjectAreasTable[10].area = 0;
+ _roomObjectAreasTable[11].area = 0;
+ _roomObjectAreasTable[13].area = 0;
+ _roomObjectAreasTable[16].area = 0;
+ _roomObjectAreasTable[17].area = 0;
+ _roomObjectAreasTable[26].area = 0;
+ _roomObjectAreasTable[28].area = 0;
+}
+
+void IgorEngine::PART_17_HELPER_3(int lum) {
+ _roomObjectAreasTable[18].y1Lum = lum;
+ _roomObjectAreasTable[19].y1Lum = lum;
+ _roomObjectAreasTable[20].y1Lum = lum;
+}
+
+void IgorEngine::PART_17_HELPER_4() {
+ int offset = 11642;
+ for (int i = 0; i <= 48; ++i) {
+ memcpy(_screenLayer1 + offset + i * 320, _animFramesBuffer + i * 44, 44);
+ memcpy(_screenVGA + offset + i * 320, _animFramesBuffer + i * 44, 44);
+ }
+}
+
+void IgorEngine::PART_17_HELPER_5(int lum) {
+ _roomObjectAreasTable[23].y1Lum = lum;
+ _roomObjectAreasTable[26].y1Lum = lum;
+ _roomObjectAreasTable[27].y1Lum = lum;
+ _roomObjectAreasTable[32].y1Lum = lum;
+}
+
+void IgorEngine::PART_17_HELPER_6() {
+ playMusic(2);
+ PART_17_HELPER_1(255);
+ fadeInPalette(768);
+ _walkData[0].setPos(274, 68, 4, 1);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 30;
+ _walkCurrentFrame = 1;
+ _walkDataCurrentIndex = 0;
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[22034]].area = 8;
+ _roomObjectAreasTable[_screenLayer2[23923]].area = 8;
+ buildWalkPath(274, 68, 243, 74);
+ _roomObjectAreasTable[_screenLayer2[22034]].area = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ --_walkDataLastIndex;
+ buildWalkPath(243, 74, 205, 124);
+ _roomObjectAreasTable[_screenLayer2[23923]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ PART_17_HELPER_5(0);
+ _roomObjectAreasTable[5].area = 0;
+ _roomObjectAreasTable[10].area = 0;
+ _roomObjectAreasTable[11].area = 0;
+ _roomObjectAreasTable[13].area = 0;
+ _roomObjectAreasTable[16].area = 0;
+ _roomObjectAreasTable[17].area = 0;
+ _roomObjectAreasTable[26].area = 0;
+ _roomObjectAreasTable[28].area = 0;
+}
+
+void IgorEngine::PART_17_HELPER_8(int num) {
+ for (int i = 0; i <= 8; ++i) {
+ for (int j = 0; j <= 10; ++j) {
+ int offset = (36 + i) * 320 + 130 + j;
+ uint8 color = _screenVGA[offset];
+ if (color >= 0xF0 && color <= 0xF1) {
+ _screenTempLayer[i * 100 + j] = _screenVGA[offset];
+ } else {
+ _screenTempLayer[i * 100 + j] = _animFramesBuffer[num * 99 + i * 11 + j + 0x1967];
+ }
+ }
+ }
+ int offset = 11650;
+ for (int i = 0; i <= 8; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _screenTempLayer + i * 100, 11);
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + num * 99 + i * 11 + 0x1967, 11);
+ }
+}
+
+void IgorEngine::PART_17_HELPER_9(int num) {
+ for (int i = 0; i <= 26; ++i) {
+ for (int j = 0; j <= 22; ++j) {
+ int offset = (36 + i) * 320 + 143 + j;
+ uint8 color = _screenVGA[offset];
+ if ((color >= 0xC0 && color <= 0xCF) || (color >= 0xF0 && color <= 0xF1)) {
+ _screenTempLayer[i * 100 + j] = _screenVGA[offset];
+ } else {
+ _screenTempLayer[i * 100 + j] = _animFramesBuffer[num * 621 + i * 23 + j + 0x86C];
+ }
+ }
+ }
+ int offset = 11663;
+ for (int i = 0; i <= 26; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _screenTempLayer + i * 100, 23);
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + num * 621 + i * 23 + 0x86C, 23);
+ }
+}
+
+void IgorEngine::PART_17_HELPER_11(int frame) {
+ for (int i = 0; i <= 8; ++i) {
+ for (int j = 0; j <= 10; ++j) {
+ int offset = (i + 36) * 320 + j + 130;
+ uint8 color = _screenVGA[offset];
+ if (color != 0 && color != 240) {
+ color = _animFramesBuffer[0x1C1C + frame * 99 + i * 11 + j];
+ }
+ _screenTempLayer[100 * i + j] = color;
+ }
+ }
+ for (int i = 0; i <= 8; ++i) {
+ const int offset = i * 320 + 11650;
+ memcpy(_screenVGA + offset, _screenTempLayer + i * 100, 11);
+ memcpy(_screenLayer1 + offset, _animFramesBuffer + 0x1C1C + frame * 99 + i * 11, 11);
+ }
+}
+
+void IgorEngine::PART_17() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_OutsideCollege, IMG_OutsideCollege, BOX_OutsideCollege, MSK_OutsideCollege, TXT_OutsideCollege);
+ static const int anm[] = { FRM_OutsideCollege1, FRM_OutsideCollege2, FRM_OutsideCollege3, FRM_OutsideCollege4, FRM_OutsideCollege5, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_OutsideCollege);
+ _roomDataOffsets = PART_17_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 286, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_17_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_17_UPDATE_ROOM_BACKGROUND;
+ PART_17_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ if (_objectsState[56] == 1) {
+ _gameState.unkF = false;
+ PART_17_HELPER_3(6);
+ _roomObjectAreasTable[14].object = 0;
+ _roomObjectAreasTable[15].object = 0;
+ _roomObjectAreasTable[19].object = 0;
+ } else if (_gameState.unkF) {
+ PART_17_HELPER_4();
+ _gameState.counter[4] = 1;
+ } else {
+ _roomObjectAreasTable[14].object = 0;
+ _roomObjectAreasTable[15].object = 0;
+ _roomObjectAreasTable[19].object = 0;
+ }
+ _currentAction.verb = kVerbWalk;
+ if (_currentPart == 170) {
+ fadeInPalette(768);
+ PART_17_HELPER_2();
+ } else if (_currentPart == 171) {
+ PART_17_HELPER_6();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 170 || _currentPart == 171) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_17_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ if (_objectsState[55] == 1) {
+ _objectsState[56] = 1;
+ }
+ if (_objectsState[54] == 0) {
+ _objectsState[54] = 1;
+ }
+ hideCursor();
+ fadeOutPalette(624);
+ _updateRoomBackground = 0;
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_18.cpp b/engines/igor/parts/part_18.cpp
new file mode 100644
index 0000000000..11abb3cf2e
--- /dev/null
+++ b/engines/igor/parts/part_18.cpp
@@ -0,0 +1,215 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_18_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(99, 54, 43, 63, 0);
+ waitForEndOfCutsceneDialogue(99, 54, 43, 63, 0);
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(132, 55, 63, 42, 0);
+ waitForEndOfCutsceneDialogue(132, 55, 63, 42, 0);
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(167, 56, 0, 42, 42);
+ waitForEndOfCutsceneDialogue(167, 56, 0, 42, 42);
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(208, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ ADD_DIALOGUE_TEXT(209, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 108:
+ ADD_DIALOGUE_TEXT(210, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 109:
+ PART_18_ACTION_109();
+ break;
+ case 110:
+ _currentPart = 252;
+ break;
+ case 111:
+ PART_18_ACTION_111();
+ break;
+ default:
+ error("PART_18_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_18_ACTION_109() {
+ const int offset = 29480;
+ for (int i = 1; i <= 2; ++i) {
+ for (int j = 1; j <= 48; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + (i - 1) * 1519 + j * 31, 31);
+ }
+ waitForTimer(120);
+ }
+ int part = _currentPart;
+ _currentPart = 191;
+ fadeOutPalette(768);
+ PART_19();
+ memcpy(_screenVGA, _screenLayer2, 46080);
+ loadResourceData__ROOM_MenToilets();
+ loadResourceData__ANIM_MenToilets();
+ loadActionData(DAT_MenToilets);
+ _roomDataOffsets = PART_18_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_18_EXEC_ACTION);
+ PART_18_HELPER_1(255);
+ memset(_screenVGA + 46080, 0, 17920);
+ drawVerbsPanel();
+ removeObjectFromInventory(53);
+ fadeInPalette(768);
+ _currentPart = part;
+ ADD_DIALOGUE_TEXT(215, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+}
+
+void IgorEngine::PART_18_ACTION_111() {
+ if (_objectsState[0] == 0) {
+ ADD_DIALOGUE_TEXT(211, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ if (_objectsState[0] == 2) {
+ ADD_DIALOGUE_TEXT(212, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ const int offset = 26798;
+ for (int i = 0; i <= 28; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + i * 28 + 0xF0A, 28);
+ }
+ playSound(47, 1);
+ for (int i = 1; i <= 2; ++i) {
+ waitForTimer(200);
+ }
+ for (int i = 0; i <= 28; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + i * 28 + 0xBDE, 28);
+ }
+ ADD_DIALOGUE_TEXT(213, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ _objectsState[0] = 2;
+ UPDATE_OBJECT_STATE(1);
+}
+
+void IgorEngine::PART_18_HELPER_1(int num) {
+}
+
+void IgorEngine::PART_18_HELPER_2() {
+ _walkData[0].setPos(319, 142, 4, 0);
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 15;
+ _walkData[0].scaleWidth = 50;
+ _walkData[0].xPosChanged = 1;
+ _walkData[0].dxPos = 0;
+ _walkData[0].yPosChanged = 1;
+ _walkData[0].dyPos = 0;
+ _walkData[0].scaleHeight = 50;
+ _walkDataLastIndex = 0;
+ buildWalkPath(319, 142, 295, 142);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_18() {
+ _gameState.enableLight = 1;
+ loadResourceData__ROOM_MenToilets();
+ loadResourceData__ANIM_MenToilets();
+ loadActionData(DAT_MenToilets);
+ _roomDataOffsets = PART_18_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_18_EXEC_ACTION);
+ PART_18_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ PART_18_HELPER_2();
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 180) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+}
+
+void IgorEngine::loadResourceData__ROOM_MenToilets() {
+ loadRoomData(PAL_MenToilets, IMG_MenToilets, BOX_MenToilets, MSK_MenToilets, TXT_MenToilets);
+}
+
+void IgorEngine::loadResourceData__ANIM_MenToilets() {
+ static const int anm[] = { FRM_MenToilets1, FRM_MenToilets2, 0 };
+ loadAnimData(anm);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_19.cpp b/engines/igor/parts/part_19.cpp
new file mode 100644
index 0000000000..e7cf3b4327
--- /dev/null
+++ b/engines/igor/parts/part_19.cpp
@@ -0,0 +1,336 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static int VAR_CURRENT_TALKING_ACTOR;
+
+void IgorEngine::PART_19_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(99, 54, 43, 63, 0);
+ waitForEndOfCutsceneDialogue(99, 54, 43, 63, 0);
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(132, 55, 63, 42, 0);
+ waitForEndOfCutsceneDialogue(132, 55, 63, 42, 0);
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(167, 56, 0, 42, 42);
+ waitForEndOfCutsceneDialogue(167, 56, 0, 42, 42);
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ _currentPart = 232;
+ break;
+ case 107:
+ PART_19_ACTION_107();
+ break;
+ case 108:
+ ADD_DIALOGUE_TEXT(208, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 109:
+ PART_19_ACTION_109();
+ break;
+ default:
+ error("PART_19_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_19_ACTION_107() {
+ if (_objectsState[58] == 1) {
+ ADD_DIALOGUE_TEXT(211, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ ADD_DIALOGUE_TEXT(206, 1);
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ for (int i = 1; i <= 2; ++i) {
+ const int offset = 27110;
+ for (int j = 0; j <= 48; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 1372 + j * 28 - 506, 28);
+ waitForTimer(120);
+ }
+ }
+ addObjectToInventory(12, 47);
+ _objectsState[58] = 1;
+ PART_19_HELPER_1(255);
+}
+
+void IgorEngine::PART_19_ACTION_109() {
+ if (_objectsState[2] == 1) {
+ ADD_DIALOGUE_TEXT(210, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ for (int i = 1; i <= 4; ++i) {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0x354 + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(45);
+ }
+ decodeAnimFrame(_animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0x35E) - 1, _screenVGA, true);
+ playSound(45, 1);
+ PART_19_HELPER_5();
+ PART_19_HELPER_1(255);
+ stopSound();
+ decodeAnimFrame(_animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0x360) - 1, _screenVGA, true);
+ ADD_DIALOGUE_TEXT(209, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+}
+
+void IgorEngine::PART_19_UPDATE_DIALOGUE_WOMEN(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_19_HELPER_7((VAR_CURRENT_TALKING_ACTOR == 0) ? 35 : 40);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_19_HELPER_7((VAR_CURRENT_TALKING_ACTOR == 0) ? 35 + getRandomNumber(5) : 40 + getRandomNumber(5));
+ break;
+ }
+}
+
+void IgorEngine::PART_19_UPDATE_BACKGROUND_HELPER_9() {
+ if (compareGameTick(3, 64) && _gameState.counter[1] <= 34) {
+ const uint8 *src = _animFramesBuffer + 0xE1A + READ_LE_UINT16(_animFramesBuffer + 0x404F + _gameState.counter[1] * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ ++_gameState.counter[1];
+ }
+}
+
+void IgorEngine::PART_19_HELPER_1(int num) {
+ if (num == 2 || num == 255) {
+ if (_objectsState[59] == 0) {
+ decodeAnimFrame(_animFramesBuffer + 0xE1A + READ_LE_UINT16(_animFramesBuffer + 0x4051) - 1, _screenLayer1, true);
+ }
+ }
+}
+
+void IgorEngine::PART_19_HELPER_2() {
+ int talkSpeed = _gameState.talkSpeed;
+ _gameState.talkSpeed = 5;
+ memcpy(_screenLayer2, _screenVGA, 46080);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ const uint8 *src = _animFramesBuffer + 0xE1A + READ_LE_UINT16(_animFramesBuffer + 0x4051) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ memcpy(_screenLayer1, _screenVGA, 46080);
+ fadeInPalette(624);
+ ADD_DIALOGUE_TEXT(212, 3);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(243, 92, 63, 23, 33);
+ VAR_CURRENT_TALKING_ACTOR = 0;
+ _updateDialogue = &IgorEngine::PART_19_UPDATE_DIALOGUE_WOMEN;
+ waitForEndOfCutsceneDialogue(243, 92, 63, 23, 33);
+ _updateDialogue = 0;
+ for (int i = 2; i <= 9; ++i) {
+ src = _animFramesBuffer + 0xE1A + READ_LE_UINT16(_animFramesBuffer + 0x404F + i * 2) - 1;
+ waitForTimer(60);
+ }
+ ADD_DIALOGUE_TEXT(215, 1);
+ ADD_DIALOGUE_TEXT(216, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startCutsceneDialogue(227, 91, 0, 63, 63);
+ _gameState.counter[1] = 10;
+ VAR_CURRENT_TALKING_ACTOR = 1;
+ _updateRoomBackground = &IgorEngine::PART_19_UPDATE_BACKGROUND_HELPER_9;
+ waitForEndOfCutsceneDialogue(227, 91, 0, 63, 63);
+ _updateRoomBackground = 0;
+ while (_gameState.counter[1] != 35) {
+ PART_19_UPDATE_BACKGROUND_HELPER_9();
+ }
+ for (int i = 47; i <= 48; ++i) {
+ src = _animFramesBuffer + 0xE1A + READ_LE_UINT16(_animFramesBuffer + 0x404F + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(30);
+ }
+ for (int i = 1; i <= 3; ++i) {
+ for (int j = 49; j <= 50; ++j) {
+ src = _animFramesBuffer + 0xE1A + READ_LE_UINT16(_animFramesBuffer + 0x404F + j * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(30);
+ if (j == 50) {
+ playSound(46, 1);
+ }
+ }
+ }
+ src = _animFramesBuffer + 0xE1A + READ_LE_UINT16(_animFramesBuffer + 0x40B5) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ waitForTimer(30);
+ ADD_DIALOGUE_TEXT(218, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(243, 92, 63, 23, 33);
+ VAR_CURRENT_TALKING_ACTOR = 0;
+ _updateDialogue = &IgorEngine::PART_19_UPDATE_DIALOGUE_WOMEN;
+ waitForEndOfCutsceneDialogue(243, 92, 63, 23, 33);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(219, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(227, 91, 0, 63, 63);
+ VAR_CURRENT_TALKING_ACTOR = 1;
+ _updateDialogue = &IgorEngine::PART_19_UPDATE_DIALOGUE_WOMEN;
+ waitForEndOfCutsceneDialogue(227, 91, 0, 63, 63);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(221, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(243, 92, 63, 23, 33);
+ VAR_CURRENT_TALKING_ACTOR = 0;
+ _updateDialogue = &IgorEngine::PART_19_UPDATE_DIALOGUE_WOMEN;
+ waitForEndOfCutsceneDialogue(243, 92, 63, 23, 33);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(223, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(227, 91, 0, 63, 63);
+ VAR_CURRENT_TALKING_ACTOR = 1;
+ _updateDialogue = &IgorEngine::PART_19_UPDATE_DIALOGUE_WOMEN;
+ waitForEndOfCutsceneDialogue(227, 91, 0, 63, 63);
+ _updateDialogue = 0;
+ _objectsState[59] = 1;
+ fadeOutPalette(624);
+ _gameState.talkSpeed = talkSpeed;
+}
+
+void IgorEngine::PART_19_HELPER_3() {
+ _walkData[0].setPos(319, 142, 1, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ buildWalkPath(319, 142, 295, 142);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_19_HELPER_4() {
+ decodeAnimFrame(_animFramesBuffer + 0xE1A + READ_LE_UINT16(_animFramesBuffer + 0x40AB) - 1, _screenVGA, true);
+ waitForTimer(60);
+ ADD_DIALOGUE_TEXT(225, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ --_walkDataLastIndex;
+ buildWalkPath(295, 142, 319, 142);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 232;
+}
+
+void IgorEngine::PART_19_HELPER_5() {
+ fadeOutPalette(624);
+ uint8 *tmp = (uint8 *)malloc(64000 + 768);
+ if (tmp) {
+ memcpy(tmp, _screenVGA, 64000);
+ memcpy(tmp + 64000, _paletteBuffer, 768);
+ }
+ loadData(IMG_RomanNumbersPaper, _screenVGA);
+ loadData(PAL_RomanNumbersPaper, _paletteBuffer);
+ fadeInPalette(624);
+ PART_UPDATE_FIGURES_ON_PAPER(60);
+ _objectsState[2] = 1;
+ waitForTimer(255);
+ if (tmp) {
+ memcpy(_screenVGA, tmp, 64000);
+ memcpy(_paletteBuffer, tmp + 64000, 768);
+ free(tmp);
+ }
+}
+
+void IgorEngine::PART_19_HELPER_7(int frame) {
+ const uint8 *src = _animFramesBuffer + 0xE1A + READ_LE_UINT16(_animFramesBuffer + 0x404F + frame * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+}
+
+void IgorEngine::PART_19() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_WomenToilets, IMG_WomenToilets, BOX_WomenToilets, MSK_WomenToilets, TXT_WomenToilets);
+ static const int anm[] = { FRM_WomenToilets1, FRM_WomenToilets2, FRM_WomenToilets3, FRM_WomenToilets4, FRM_WomenToilets5, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_WomenToilets);
+ _roomDataOffsets = PART_19_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ if (_currentPart == 191) {
+ PART_19_HELPER_2();
+ } else {
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_19_EXEC_ACTION);
+ PART_19_HELPER_1(255);
+ }
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ PART_19_HELPER_3();
+ if (_objectsState[59] == 0) {
+ PART_19_HELPER_4();
+ } else {
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 190) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ }
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_21.cpp b/engines/igor/parts/part_21.cpp
new file mode 100644
index 0000000000..2e4a39aec5
--- /dev/null
+++ b/engines/igor/parts/part_21.cpp
@@ -0,0 +1,492 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_21_ANIM_DATA_1[7] = { 0, 11, 12, 13, 20, 21, 14 };
+
+static const uint8 PART_21_ANIM_DATA_2[11] = { 0, 4, 5, 4, 5, 4, 5, 4, 5, 6, 0 };
+
+static bool IN_ACTION_111;
+
+void IgorEngine::PART_21_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ PART_21_ACTION_101();
+ break;
+ case 102:
+ PART_21_ACTION_102();
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ PART_21_ACTION_107();
+ break;
+ case 108:
+ PART_21_ACTION_108();
+ break;
+ case 109:
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 110:
+ PART_21_ACTION_110();
+ break;
+ case 111:
+ PART_21_ACTION_111();
+ break;
+ case 112:
+ ADD_DIALOGUE_TEXT(222, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 113:
+ PART_21_ACTION_113();
+ break;
+ default:
+ error("PART_21_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_21_ACTION_101() {
+ if (_objectsState[65] == 1) {
+ const int offset = 29440;
+ for (int i = 0; i <= 50; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _screenLayer1 + i * 320 + offset, 20);
+ }
+ PART_21_HELPER_10();
+ }
+ _currentPart = 303;
+}
+
+void IgorEngine::PART_21_ACTION_102() {
+ PART_21_HELPER_6(1);
+ ADD_DIALOGUE_TEXT(226, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(227, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(76, 87, 63, 32, 0);
+ _updateDialogue = &IgorEngine::PART_21_UPDATE_DIALOGUE_MARGARET_2;
+ waitForEndOfCutsceneDialogue(76, 87, 63, 32, 0);
+ _updateDialogue = 0;
+ PART_21_HANDLE_DIALOGUE_MARGARET();
+ PART_21_HELPER_1(255);
+}
+
+void IgorEngine::PART_21_ACTION_107() {
+ if (_objectsState[64] == 1) {
+ EXEC_MAIN_ACTION(11);
+ return;
+ }
+ for (int i = 2; i <= 3; ++i) {
+ const int offset = 21902;
+ for (int j = 0; j <= 53; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + (i - 1) * 1782 + j * 33, 33);
+ }
+ if (i == 3) {
+ playSound(13, 1);
+ } else {
+ waitForTimer(100);
+ }
+ }
+ _objectsState[64] = 1;
+ PART_21_HELPER_1(1);
+}
+
+void IgorEngine::PART_21_ACTION_108() {
+ if (_objectsState[64] == 0) {
+ EXEC_MAIN_ACTION(14);
+ return;
+ }
+ for (int i = 2; i >= 1; --i) {
+ const int offset = 21902;
+ for (int j = 0; j <= 53; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + (i - 1) * 1782 + j * 33, 33);
+ }
+ if (i == 2) {
+ playSound(14, 1);
+ waitForTimer(100);
+ }
+ }
+ _objectsState[64] = 0;
+ PART_21_HELPER_1(1);
+}
+
+void IgorEngine::PART_21_ACTION_110() {
+ if (_objectsState[65] == 1) {
+ const int offset = 27180;
+ for (int i = 0; i <= 50; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _screenLayer1 + i * 320 + offset, 20);
+ }
+ PART_21_HELPER_10();
+ }
+ _currentPart = 270;
+}
+
+void IgorEngine::PART_21_ACTION_111() {
+ if (_inventoryInfo[65] == 0) {
+ ADD_DIALOGUE_TEXT(223, 2);
+ ADD_DIALOGUE_TEXT(225, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ return;
+ }
+ IN_ACTION_111 = true;
+ ADD_DIALOGUE_TEXT(208, 1);
+ ADD_DIALOGUE_TEXT(209, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ const int offset = 28183;
+ for (int i = 0; i <= 49; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + 0xCBE1 + i * 26, 26);
+ }
+ waitForTimer(100);
+ int i = 1;
+ do {
+ if (compareGameTick(3, 24)) {
+ for (int j = 0; j <= 49; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + 0xBCA5 + PART_21_ANIM_DATA_2[i] * 1300 + j * 26, 26);
+ }
+ ++i;
+ }
+ PART_21_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ } while (i != 10);
+ IN_ACTION_111 = false;
+ removeObjectFromInventory(56);
+ _objectsState[65] = 1;
+ PART_21_HELPER_1(255);
+ ADD_DIALOGUE_TEXT(210, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+}
+
+void IgorEngine::PART_21_ACTION_113() {
+ if (_objectsState[64] != 0) {
+ _roomObjectAreasTable[_screenLayer2[34679]].area = 1;
+ --_walkDataLastIndex;
+ buildWalkPathSimple(165, 126, 119, 108);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ if (_objectsState[65] == 1) {
+ PART_21_HELPER_10();
+ }
+ _currentPart = 370;
+ }
+}
+
+void IgorEngine::PART_21_UPDATE_DIALOGUE_MARGARET_1(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_21_HELPER_11(6);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_21_HELPER_11(getRandomNumber(5) + 6);
+ break;
+ case kUpdateDialogueAnimStanding:
+ PART_21_HELPER_11(1);
+ break;
+ }
+}
+
+void IgorEngine::PART_21_UPDATE_DIALOGUE_MARGARET_2(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_21_HELPER_6(6);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_21_HELPER_6(getRandomNumber(5) + 6);
+ break;
+ }
+}
+
+void IgorEngine::PART_21_UPDATE_DIALOGUE_MARGARET_3(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_21_HELPER_6(15);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_21_HELPER_6(getRandomNumber(5) + 15);
+ break;
+ }
+}
+
+void IgorEngine::PART_21_HANDLE_DIALOGUE_MARGARET() {
+ loadDialogueData(DLG_CollegeCorridorMargaret);
+ _updateDialogue = &IgorEngine::PART_21_UPDATE_DIALOGUE_MARGARET_1;
+ handleDialogue(81, 76, 63, 32, 0);
+ _updateDialogue = 0;
+}
+
+void IgorEngine::PART_21_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[64] == 0) {
+ PART_21_HELPER_7();
+ _roomActionsTable[4] = 6;
+ } else {
+ PART_21_HELPER_8();
+ _roomActionsTable[4] = 7;
+ }
+ }
+ if (num == 2 || num == 255) {
+ if (_objectsState[65] > 1) {
+ PART_21_HELPER_9();
+ }
+ if (_objectsState[65] == 2 || _objectsState[65] == 4) {
+ _roomObjectAreasTable[9].object = 0;
+ _roomObjectAreasTable[10].object = 0;
+ }
+ }
+}
+
+void IgorEngine::PART_21_HELPER_2() {
+ _walkData[0].setPos(0, 141, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 15;
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ buildWalkPathSimple(0, 141, 32, 137);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_21_HELPER_3() {
+ _walkData[0].setPos(319, 133, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ buildWalkPathSimple(319, 133, 239, 133);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_21_HELPER_4() {
+ _walkData[0].setPos(119, 108, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[34679]].area = 1;
+ buildWalkPathSimple(119, 108, 175, 130);
+ _roomObjectAreasTable[_screenLayer2[34679]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_21_HELPER_6(int frame) {
+ _roomCursorOn = false;
+ for (int i = 0; i <= 42; ++i) {
+ for (int j = 0; j <= 48; ++j) {
+ int offset = (i + 89) * 320 + j + 40;
+ uint8 color = _screenVGA[offset];
+ if ((color >= 192 && color <= 207) || color == 240 || color == 241) {
+ _screenTempLayer[i * 100 + j] = _screenVGA[offset];
+ } else {
+ _screenTempLayer[i * 100 + j] = _animFramesBuffer[frame * 2107 + i * 49 + j + 0xCA7];
+ }
+ }
+ }
+ int offset = 28520;
+ for (int i = 0; i <= 42; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _screenTempLayer + i * 100, 49);
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + frame * 2107 + i * 49 + 0xCA7, 49);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_21_HELPER_7() {
+ const int offset = 21901;
+ for (int i = 0; i <= 53; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 33 + 0xE031, 33);
+ }
+}
+
+void IgorEngine::PART_21_HELPER_8() {
+ const int offset = 21901;
+ for (int i = 0; i <= 53; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 33 + 0xE727, 33);
+ }
+}
+
+void IgorEngine::PART_21_HELPER_9() {
+ const int offset = 21901;
+ for (int i = 0; i <= 42; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 49 + 0x14E2, 49);
+ }
+}
+
+void IgorEngine::PART_21_HELPER_10() {
+ PART_21_HELPER_6(1);
+ memset(_screenVGA + 46080, 0, 17920);
+ waitForTimer(120);
+ for (int i = 1; i <= 6; ++i) {
+ PART_21_HELPER_6(PART_21_ANIM_DATA_1[i]);
+ if (i < 6) {
+ waitForTimer(100);
+ }
+ }
+ ADD_DIALOGUE_TEXT(212, 1);
+ ADD_DIALOGUE_TEXT(213, 1);
+ ADD_DIALOGUE_TEXT(214, 1);
+ ADD_DIALOGUE_TEXT(215, 2);
+ ADD_DIALOGUE_TEXT(217, 2);
+ SET_DIALOGUE_TEXT(1, 5);
+ startCutsceneDialogue(76, 87, 63, 32, 0);
+ _updateDialogue = &IgorEngine::PART_21_UPDATE_DIALOGUE_MARGARET_3;
+ waitForEndOfCutsceneDialogue(76, 87, 63, 32, 0);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(219, 1);
+ ADD_DIALOGUE_TEXT(220, 1);
+ ADD_DIALOGUE_TEXT(221, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startCutsceneDialogue(76, 87, 63, 32, 0);
+ _updateDialogue = &IgorEngine::PART_21_UPDATE_DIALOGUE_MARGARET_3;
+ waitForEndOfCutsceneDialogue(76, 87, 63, 32, 0);
+ _updateDialogue = 0;
+ _objectsState[65] = 2;
+ drawVerbsPanel();
+ _currentAction.verb = kVerbWalk;
+ drawInventory(_inventoryInfo[72], 0);
+ PART_21_HELPER_1(255);
+ _objectsState[110] = 1;
+}
+
+void IgorEngine::PART_21_HELPER_11(int frame) {
+ const int offset = 28520;
+ for (int i = 0; i <= 42; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + frame * 2107 + i * 49 + 0xCA7, 49);
+ }
+}
+
+void IgorEngine::PART_21_UPDATE_ROOM_BACKGROUND() {
+ if (IN_ACTION_111 && compareGameTick(3, 24)) {
+ const int offset = 28183;
+ int i = getRandomNumber(2) + 1;
+ for (int j = 0; j <= 49; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + 0xBCA5 + i * 1300 + j * 26, 26);
+ }
+ ++i;
+ }
+ if (compareGameTick(61) && _objectsState[65] <= 1) {
+ if (_gameState.unk10 > 2) {
+ PART_21_HELPER_6(_gameState.unk10);
+ ++_gameState.unk10;
+ if (_gameState.unk10 == 6) {
+ ++_gameState.counter[4];
+ if (_gameState.counter[4] < 2) {
+ _gameState.unk10 = 4;
+ } else {
+ _gameState.counter[4] = 0;
+ _gameState.unk10 = 1;
+ }
+ }
+ } else {
+ PART_21_HELPER_6(_gameState.unk10);
+ ++_gameState.unk10;
+ if (_gameState.unk10 == 3 && getRandomNumber(6) != 0) {
+ _gameState.unk10 = 1;
+ }
+ }
+ }
+}
+
+void IgorEngine::PART_21() {
+ _gameState.enableLight = 2;
+ loadRoomData(PAL_CollegeCorridorMargaret, IMG_CollegeCorridorMargaret, BOX_CollegeCorridorMargaret, MSK_CollegeCorridorMargaret, TXT_CollegeCorridorMargaret);
+ static const int anm[] = { FRM_CollegeCorridorMargaret1, FRM_CollegeCorridorMargaret2, FRM_CollegeCorridorMargaret3, FRM_CollegeCorridorMargaret4, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_CollegeCorridorMargaret);
+ _roomDataOffsets = PART_21_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_21_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_21_UPDATE_ROOM_BACKGROUND;
+ PART_21_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ _gameState.unk10 = 1;
+ fadeInPalette(768);
+ if (_currentPart == 210) {
+ PART_21_HELPER_2();
+ } else if (_currentPart == 211) {
+ PART_21_HELPER_3();
+ } else if (_currentPart == 212) {
+ PART_21_HELPER_4();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 210 || _currentPart == 211 || _currentPart == 212) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_21_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+ _updateRoomBackground = 0;
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_22.cpp b/engines/igor/parts/part_22.cpp
new file mode 100644
index 0000000000..5ed1ca3f7c
--- /dev/null
+++ b/engines/igor/parts/part_22.cpp
@@ -0,0 +1,186 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_22_ANIM_DATA_1[4] = { 0, 1, 2, 1 };
+
+void IgorEngine::PART_22_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ PART_22_ACTION_101();
+ break;
+ case 102:
+ PART_22_ACTION_102();
+ break;
+ default:
+ error("PART_22_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_22_ACTION_101() {
+ if (_objectsState[78] == 1 && _inventoryInfo[64] == 0) {
+ ADD_DIALOGUE_TEXT(203, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ for (int i = 1; i <= 3; ++i) {
+ const int offset = 24141;
+ for (int j = 0; j <= 29; ++j) {
+ const uint8 *src = _animFramesBuffer + 0xA0E6 + PART_22_ANIM_DATA_1[i] * 1050 + j * 35;
+ memcpy(_screenVGA + j * 320 + offset, src, 35);
+ }
+ waitForTimer(60);
+ }
+ addObjectToInventory(29, 64);
+ PART_22_HELPER_1(255);
+ ADD_DIALOGUE_TEXT(205, 1);
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ _objectsState[105] = 1;
+ } else {
+ ADD_DIALOGUE_TEXT(201, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ }
+}
+
+void IgorEngine::PART_22_ACTION_102() {
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ for (int i = 9; i >= 0; --i) {
+ WalkData *wd = &_walkData[0];
+ wd->setPos(138, 123, 1, _walkCurrentFrame);
+ WalkData::setNextFrame(1, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = 23 + i * 3;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 50;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(15);
+ }
+ int i = 16;
+ do {
+ if (compareGameTick(1, 16)) {
+ memcpy(_screenTextLayer + (i * 8 + 16) * 320, _screenLayer1 + (128 - i * 8) * 320, (i * 8 + 16) * 320);
+ memcpy(_screenTextLayer + (i * 8 + 16) * 320, _animFramesBuffer, (128 - i * 8) * 320);
+ memcpy(_screenVGA, _screenTextLayer, 46080);
+ if (i == 0) {
+ i = 255;
+ } else {
+ --i;
+ }
+ }
+ waitForTimer();
+ } while (i != 255);
+ _currentPart = 141;
+}
+
+void IgorEngine::PART_22_HELPER_1(int num) {
+}
+
+void IgorEngine::PART_22_HELPER_2() {
+ int i = 16;
+ do {
+ if (compareGameTick(1, 16)) {
+ memcpy(_screenTextLayer, _screenLayer1 + (128 - i * 8) * 320, (i * 8 + 16) * 320);
+ memcpy(_screenTextLayer + (128 - i * 8) * 320, _animFramesBuffer, (i * 8 + 16) * 320);
+ memcpy(_screenVGA, _screenTextLayer, 46080);
+ ++i;
+ }
+ waitForTimer();
+ } while (i != 17);
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ for ( i = 0; i <= 9; ++i) {
+ WalkData *wd = &_walkData[0];
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ wd->setPos(138, 123, 3, _walkCurrentFrame);
+ WalkData::setNextFrame(3, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = 23 + i * 3;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 50;
+ moveIgor(3, wd->frameNum);
+ waitForTimer(15);
+ }
+ _walkDataLastIndex = 0;
+ buildWalkPathSimple(138, 123, 150, 123);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_22() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_BellChurch, IMG_BellChurch, BOX_BellChurch, MSK_BellChurch, TXT_BellChurch);
+ static const int anm[] = { FRM_BellChurch1, FRM_BellChurch2, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_BellChurch);
+ _roomDataOffsets = PART_22_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(126, 123, 193, 123);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_22_EXEC_ACTION);
+ PART_22_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ PART_22_HELPER_2();
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 220) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_23.cpp b/engines/igor/parts/part_23.cpp
new file mode 100644
index 0000000000..e165ad5b1d
--- /dev/null
+++ b/engines/igor/parts/part_23.cpp
@@ -0,0 +1,304 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_23_ANIM_DATA_1[4] = { 0, 4, 1, 11 };
+
+void IgorEngine::PART_23_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ _currentPart = 280;
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(201, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ PART_23_ACTION_105();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ PART_23_ACTION_107();
+ break;
+ case 108:
+ PART_23_ACTION_108();
+ break;
+ case 109:
+ _currentPart = 300;
+ break;
+ case 110:
+ ADD_DIALOGUE_TEXT(203, 1);
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 111:
+ ADD_DIALOGUE_TEXT(208, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 112:
+ ADD_DIALOGUE_TEXT(210, 1);
+ ADD_DIALOGUE_TEXT(211, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 113:
+ ADD_DIALOGUE_TEXT(212, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ default:
+ error("PART_23_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_23_ACTION_105() {
+ if (_objectsState[66] != 0) {
+ _roomObjectAreasTable[_screenLayer2[38633]].area = 1;
+ --_walkDataLastIndex;
+ buildWalkPathSimple(233, 132, 233, 120);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 190;
+ }
+}
+
+void IgorEngine::PART_23_ACTION_107() {
+ if (_objectsState[66] == 1) {
+ EXEC_MAIN_ACTION(11);
+ } else {
+ const int offset = 23901;
+ for (int i = 2; i <= 3; ++i) {
+ for (int j = 0; j <= 53; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 1620 + j * 30 + 0x895, 30);
+ }
+ }
+ playSound(13, 1);
+ waitForTimer(100);
+ _objectsState[66] = 1;
+ PART_23_HELPER_1(1);
+ }
+}
+
+void IgorEngine::PART_23_ACTION_108() {
+ if (_objectsState[66] == 0) {
+ EXEC_MAIN_ACTION(14);
+ } else {
+ const int offset = 23901;
+ for (int i = 2; i <= 3; ++i) {
+ for (int j = 0; j <= 53; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + PART_23_ANIM_DATA_1[i] * 1620 + j * 30 + 0x895, 30);
+ }
+ }
+ playSound(14, 1);
+ waitForTimer(100);
+ _objectsState[66] = 0;
+ PART_23_HELPER_1(1);
+ }
+}
+
+void IgorEngine::PART_23_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(29) || compareGameTick(61)) {
+ int rnd = getRandomNumber(11);
+ if (rnd <= 4) {
+ _gameState.unk10 = 1;
+ } else if (rnd <= 9) {
+ _gameState.unk10 = 2;
+ } else if (rnd == 10) {
+ if (_gameState.unk10 < 3) {
+ _gameState.unk10 = getRandomNumber(2) + 3;
+ } else {
+ _gameState.unk10 = getRandomNumber(2) + 1;
+ }
+ }
+ PART_23_HELPER_7(_gameState.unk10);
+ }
+}
+
+void IgorEngine::PART_23_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[66] == 0) {
+ PART_23_HELPER_2(1);
+ _roomActionsTable[4] = 6;
+ } else {
+ PART_23_HELPER_2(2);
+ _roomActionsTable[4] = 7;
+ }
+ }
+ PART_23_HELPER_3();
+}
+
+void IgorEngine::PART_23_HELPER_2(int frame) {
+ const int offset = 23907;
+ for (int i = 0; i <= 53; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + (frame - 1) * 1296 + i * 24, 24);
+ }
+}
+
+void IgorEngine::PART_23_HELPER_3() {
+ const int offset = 25763;
+ for (int i = 0; i <= 48; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 25 + 0xA20, 25);
+ }
+}
+
+void IgorEngine::PART_23_HELPER_4() {
+ _walkData[0].setPos(233, 120, 3, 0);
+ _walkData[0].setDefaultScale();
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[38633]].area = 1;
+ buildWalkPathSimple(233, 120, 233, 137);
+ _roomObjectAreasTable[_screenLayer2[38633]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ if (_objectsState[59] == 0) {
+ for (int i = 0; i <= 53; ++i) {
+ for (int j = 0; j <= 23; ++j) {
+ uint8 color = _screenVGA[(i + 74) * 320 + j + 227];
+ if (color >= 0xC0 && color <= 0xCF) {
+ _screenTempLayer[i * 100 + j] = color;
+ } else {
+ _screenTempLayer[i * 100 + j] = _animFramesBuffer[i * 24 + j];
+ }
+ }
+ }
+ for (int i = 0; i <= 53; ++i) {
+ memcpy(_screenVGA + i * 320 + 23907, _screenTempLayer + i * 100, 24);
+ }
+ playSound(14, 1);
+ _objectsState[66] = 0;
+ PART_23_HELPER_1(1);
+ ADD_DIALOGUE_TEXT(206, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ }
+}
+
+void IgorEngine::PART_23_HELPER_5() {
+ _walkData[0].setPos(0, 134, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 15;
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPathSimple(0, 134, 100, 140);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_23_HELPER_6() {
+ _walkData[0].setPos(319, 134, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPathSimple(319, 134, 289, 134);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_23_HELPER_7(int frame) {
+ _roomCursorOn = false;
+ for (int i = 0; i <= 18; ++i) {
+ for (int j = 0; j <= 14; ++j) {
+ int offset = (i + 80) * 320 + j + 162;
+ uint8 color = _screenVGA[offset];
+ if ((color >= 192 && color <= 207) || color == 240 || color == 241) {
+ _screenTempLayer[i * 100 + j] = color;
+ } else {
+ _screenTempLayer[i * 100 + j] = _animFramesBuffer[frame * 285 + i * 15 + j + 0x271C];
+ }
+ }
+ }
+ int offset = 25762;
+ for (int i = 0; i <= 18; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _screenTempLayer + i * 100, 15);
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + frame * 285 + i * 15 + 0x271C, 15);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_23() {
+ _gameState.enableLight = 2;
+ loadRoomData(PAL_CollegeCorridorLucas, IMG_CollegeCorridorLucas, BOX_CollegeCorridorLucas, MSK_CollegeCorridorLucas, TXT_CollegeCorridorLucas);
+ static const int anm[] = { FRM_CollegeCorridorLucas1, FRM_CollegeCorridorLucas2, FRM_CollegeCorridorLucas3, FRM_CollegeCorridorLucas4, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_CollegeCorridorLucas);
+ _roomDataOffsets = PART_23_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(15, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_23_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_23_UPDATE_ROOM_BACKGROUND;
+ PART_23_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ if (_currentPart == 230) {
+ PART_23_HELPER_5();
+ } else if (_currentPart == 231) {
+ PART_23_HELPER_6();
+ } else if (_currentPart == 232) {
+ PART_23_HELPER_4();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart >= 230 && _currentPart <= 232) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_23_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+ _updateRoomBackground = 0;
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_24.cpp b/engines/igor/parts/part_24.cpp
new file mode 100644
index 0000000000..5d3d485ae0
--- /dev/null
+++ b/engines/igor/parts/part_24.cpp
@@ -0,0 +1,340 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_24_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ _currentPart = 313;
+ break;
+ case 102:
+ PART_24_ACTION_102();
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ PART_24_ACTION_104();
+ break;
+ case 105:
+ PART_24_ACTION_105();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ PART_24_ACTION_107();
+ break;
+ case 108:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 109:
+ ADD_DIALOGUE_TEXT(204, 1);
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 110:
+ ADD_DIALOGUE_TEXT(206, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 111:
+ ADD_DIALOGUE_TEXT(208, 2);
+ ADD_DIALOGUE_TEXT(210, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 112:
+ ADD_DIALOGUE_TEXT(212, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ default:
+ error("PART_24_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_24_ACTION_102() {
+ if (_objectsState[67] != 0) {
+ _roomObjectAreasTable[_screenLayer2[37188]].area = 1;
+ --_walkDataLastIndex;
+ buildWalkPathSimple(76, 128, 68, 116);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 360;
+ }
+}
+
+void IgorEngine::PART_24_ACTION_104() {
+ if (_objectsState[67] == 1) {
+ executeAction(11);
+ return;
+ }
+ for (int i = 1; i <= 2; ++i) {
+ const int offset = 23104;
+ for (int j = 0; j <= 56; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 1938 + j * 34 + 0x69C, 34);
+ }
+ if (i == 2) {
+ playSound(13, 1);
+ } else if (i == 1) {
+ waitForTimer(100);
+ }
+ }
+ _objectsState[67] = 1;
+ PART_24_HELPER_1(1);
+}
+
+void IgorEngine::PART_24_ACTION_105() {
+ if (_objectsState[67] == 0) {
+ executeAction(14);
+ return;
+ }
+ for (int i = 3; i <= 4; ++i) {
+ const int offset = 23104;
+ for (int j = 0; j <= 56; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 1938 + j * 34 + 0x69C, 34);
+ }
+ if (i == 4) {
+ playSound(14, 1);
+ } else if (i == 3) {
+ waitForTimer(100);
+ }
+ }
+ _objectsState[67] = 0;
+ PART_24_HELPER_1(1);
+}
+
+void IgorEngine::PART_24_ACTION_107() {
+ _roomObjectAreasTable[_screenLayer2[38719]].area = 1;
+ --_walkDataLastIndex;
+ buildWalkPathSimple(266, 123, 319, 120);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 330;
+}
+
+void IgorEngine::PART_24_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(29) || compareGameTick(61)) {
+ if (_gameState.unk10 == _gameState.counter[4]) {
+ _gameState.counter[4] = getRandomNumber(90) + 10;
+ _gameState.unk10 = 0;
+ if (_gameState.unkF) {
+ PART_24_HELPER_3(1);
+ } else {
+ PART_24_HELPER_3(2);
+ }
+ _gameState.unkF = !_gameState.unkF;
+ } else {
+ ++_gameState.unk10;
+ }
+ if (_gameState.unkF) {
+ PART_24_HELPER_3(getRandomNumber(6) + 1);
+ } else {
+ PART_24_HELPER_2(getRandomNumber(6) + 1);
+ }
+ }
+}
+
+void IgorEngine::PART_24_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[67] == 0) {
+ PART_24_HELPER_4();
+ _roomActionsTable[2] = 6;
+ } else {
+ PART_24_HELPER_5();
+ _roomActionsTable[2] = 7;
+ }
+ }
+}
+
+void IgorEngine::PART_24_HELPER_2(int frame) {
+ _roomCursorOn = false;
+ for (int i = 0; i <= 48; ++i) {
+ for (int j = 0; j <= 22; ++j) {
+ int offset = (i + 76) * 320 + j + 149;
+ uint8 color = _screenVGA[offset];
+ if ((color >= 192 && color <= 207) || color == 240 || color == 241) {
+ _screenTempLayer[i * 100 + j] = _screenVGA[offset];
+ } else {
+ _screenTempLayer[i * 100 + j] = _animFramesBuffer[frame * 1127 + i * 23 + j + 0x3E3B];
+ }
+ }
+ }
+ int offset = 24469;
+ for (int i = 0; i <= 48; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _screenTempLayer + i * 100, 23);
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + frame * 1127 + i * 23 + 0x3E3B, 23);
+ }
+ if (_gameState.dialogueTextRunning) {
+ memcpy(_screenTextLayer + 23040, _screenLayer1 + _dialogueDirtyRectY, _dialogueDirtyRectSize);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_24_HELPER_3(int frame) {
+ _roomCursorOn = false;
+ for (int i = 0; i <= 42; ++i) {
+ for (int j = 0; j <= 21; ++j) {
+ int offset = (i + 80) * 320 + j + 173;
+ uint8 color = _screenVGA[offset];
+ if ((color >= 192 && color <= 207) || color == 240 || color == 241) {
+ _screenTempLayer[i * 100 + j] = _screenVGA[offset];
+ } else {
+ _screenTempLayer[i * 100 + j] = _animFramesBuffer[frame * 946 + i * 22 + j + 0x28C4];
+ }
+ }
+ }
+ int offset = 25773;
+ for (int i = 0; i <= 42; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _screenTempLayer + i * 100, 22);
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + frame * 946 + i * 22 + 0x28C4, 22);
+ }
+ if (_gameState.dialogueTextRunning) {
+ memcpy(_screenTextLayer + 23040, _screenLayer1 + _dialogueDirtyRectY, _dialogueDirtyRectSize);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_24_HELPER_4() {
+ const int offset = 22785;
+ for (int i = 0; i <= 54; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 33, 33);
+ }
+}
+
+void IgorEngine::PART_24_HELPER_5() {
+ const int offset = 22785;
+ for (int i = 0; i <= 54; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 33 + 0x717, 33);
+ }
+}
+
+void IgorEngine::PART_24_HELPER_7() {
+ _walkData[0].setPos(0, 138, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 15;
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPathSimple(0, 138, 30, 140);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_24_HELPER_8() {
+ _walkData[0].setPos(319, 123, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ _roomObjectAreasTable[_screenLayer2[39679]].area = 1;
+ buildWalkPathSimple(319, 123, 260, 123);
+ _roomObjectAreasTable[_screenLayer2[39679]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_24_HELPER_9() {
+ _walkData[0].setPos(68, 116, 3, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 30;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ _roomObjectAreasTable[_screenLayer2[37188]].area = 1;
+ buildWalkPathSimple(68, 116, 78, 130);
+ _roomObjectAreasTable[_screenLayer2[37188]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_24() {
+ _gameState.enableLight = 2;
+ loadRoomData(PAL_CollegeCorridorSharonMichael, IMG_CollegeCorridorSharonMichael, BOX_CollegeCorridorSharonMichael, MSK_CollegeCorridorSharonMichael, TXT_CollegeCorridorSharonMichael);
+ static const int anm[] = { FRM_CollegeCorridorSharonMichael1, FRM_CollegeCorridorSharonMichael2, FRM_CollegeCorridorSharonMichael3, FRM_CollegeCorridorSharonMichael4, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_CollegeCorridorSharonMichael);
+ _roomDataOffsets = PART_24_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_24_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_24_UPDATE_ROOM_BACKGROUND;
+ PART_24_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ if (_currentPart == 240) {
+ PART_24_HELPER_7();
+ } else if (_currentPart == 241) {
+ PART_24_HELPER_8();
+ } else if (_currentPart == 242) {
+ PART_24_HELPER_9();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart >= 240 && _currentPart <= 242) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_24_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+ _updateRoomBackground = 0;
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_25.cpp b/engines/igor/parts/part_25.cpp
new file mode 100644
index 0000000000..67acbae58a
--- /dev/null
+++ b/engines/igor/parts/part_25.cpp
@@ -0,0 +1,256 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_25_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ _currentPart = 260;
+ break;
+ case 102:
+ switch (getRandomNumber(3) + 1) {
+ case 1:
+ ADD_DIALOGUE_TEXT(204, 2);
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 2:
+ ADD_DIALOGUE_TEXT(207, 1);
+ ADD_DIALOGUE_TEXT(208, 1);
+ ADD_DIALOGUE_TEXT(209, 1);
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 4);
+ startIgorDialogue();
+ break;
+ case 3:
+ ADD_DIALOGUE_TEXT(210, 1);
+ ADD_DIALOGUE_TEXT(211, 1);
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startIgorDialogue();
+ break;
+ }
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(212, 1);
+ ADD_DIALOGUE_TEXT(213, 1);
+ ADD_DIALOGUE_TEXT(214, 1);
+ ADD_DIALOGUE_TEXT(215, 1);
+ ADD_DIALOGUE_TEXT(216, 2);
+ SET_DIALOGUE_TEXT(1, 5);
+ startIgorDialogue();
+ break;
+ case 105:
+ PART_25_ACTION_105();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ PART_25_ACTION_107();
+ break;
+ case 108:
+ PART_25_ACTION_108();
+ break;
+ case 109:
+ _currentPart = 310;
+ break;
+ default:
+ error("PART_25_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_25_ACTION_105() {
+ if (_objectsState[68] != 0) {
+ _roomObjectAreasTable[_screenLayer2[34370]].area = 1;
+ --_walkDataLastIndex;
+ buildWalkPath(133, 123, 130, 107);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 180;
+ }
+}
+
+void IgorEngine::PART_25_ACTION_107() {
+ if (_objectsState[68] == 1) {
+ EXEC_MAIN_ACTION(11);
+ return;
+ }
+ for (int i = 1; i <= 2; ++i) {
+ const int offset = 21881;
+ for (int j = 0; j <= 55; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 1736 + j * 31 + 0x290, 31);
+ if (i == 2) {
+ playSound(13, 1);
+ }
+ if (i == 1) {
+ waitForTimer(100);
+ }
+ }
+ }
+ _objectsState[68] = 1;
+ PART_25_HELPER_1(1);
+}
+
+void IgorEngine::PART_25_ACTION_108() {
+ if (_objectsState[68] == 0) {
+ EXEC_MAIN_ACTION(14);
+ return;
+ }
+ for (int i = 3; i <= 4; ++i) {
+ const int offset = 21881;
+ for (int j = 0; j <= 55; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 1736 + j * 31 + 0x290, 31);
+ if (i == 4) {
+ playSound(14, 1);
+ }
+ if (i == 3) {
+ waitForTimer(100);
+ }
+ }
+ }
+ _objectsState[68] = 0;
+ PART_25_HELPER_1(1);
+}
+
+void IgorEngine::PART_25_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[68] == 0) {
+ PART_25_HELPER_5();
+ _roomActionsTable[31] = 6;
+ } else {
+ PART_25_HELPER_7();
+ _roomActionsTable[31] = 7;
+ }
+ }
+}
+
+void IgorEngine::PART_25_HELPER_2() {
+ _walkData[0].setPos(0, 130, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 15;
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPath(0, 130, 60, 135);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_25_HELPER_3() {
+ _walkData[0].setPos(319, 138, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPath(319, 138, 289, 142);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_25_HELPER_4() {
+ _walkData[0].setPos(130, 107, 3, 0);
+ _walkData[0].setDefaultScale();
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[34370]].area = 1;
+ buildWalkPath(130, 107, 135, 125);
+ _roomObjectAreasTable[_screenLayer2[34370]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_25_HELPER_5() {
+ const int offset = 22208;
+ for (int i = 0; i <= 51; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 23, 23);
+ }
+}
+
+void IgorEngine::PART_25_HELPER_7() {
+ const int offset = 22208;
+ for (int i = 0; i <= 51; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + 0x4AC + i * 23, 23);
+ }
+}
+
+void IgorEngine::PART_25() {
+ _gameState.enableLight = 2;
+ loadRoomData(PAL_CollegeCorridorAnnouncementBoard, IMG_CollegeCorridorAnnouncementBoard, BOX_CollegeCorridorAnnouncementBoard, MSK_CollegeCorridorAnnouncementBoard, TXT_CollegeCorridorAnnouncementBoard);
+ static const int anm[] = { FRM_CollegeCorridorAnnouncementBoard1, FRM_CollegeCorridorAnnouncementBoard2, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_CollegeCorridorAnnouncementBoard);
+ _roomDataOffsets = PART_25_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_25_EXEC_ACTION);
+ PART_25_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ if (_currentPart == 250) {
+ PART_25_HELPER_2();
+ } else if (_currentPart == 251) {
+ PART_25_HELPER_3();
+ } else if (_currentPart == 252) {
+ PART_25_HELPER_4();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart >= 250 && _currentPart <= 252) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_26.cpp b/engines/igor/parts/part_26.cpp
new file mode 100644
index 0000000000..eea2cd4c3d
--- /dev/null
+++ b/engines/igor/parts/part_26.cpp
@@ -0,0 +1,297 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_26_ANIM_DATA_1[12] = { 6, 0, 2, 3, 4, 5, 6, 5, 4, 3, 2, 0 };
+
+void IgorEngine::PART_26_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ PART_26_ACTION_103();
+ break;
+ case 104:
+ PART_26_ACTION_104();
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(224, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ _currentPart = 250;
+ break;
+ case 107:
+ PART_26_ACTION_107();
+ break;
+ case 108:
+ ADD_DIALOGUE_TEXT(216, 2);
+ ADD_DIALOGUE_TEXT(218, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 109:
+ ADD_DIALOGUE_TEXT(219, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 110:
+ ADD_DIALOGUE_TEXT(220, 2);
+ ADD_DIALOGUE_TEXT(222, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 111:
+ ADD_DIALOGUE_TEXT(223, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ default:
+ error("PART_26_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_26_ACTION_103() {
+ if (_objectsState[69] == 1) {
+ EXEC_MAIN_ACTION(11);
+ return;
+ }
+ for (int i = 1; i <= 2; ++i) {
+ const int offset = 19870;
+ for (int j = 0; j <= 65; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + 0x16C0 + i * 2706 + j * 41, 41);
+ }
+ if (i == 2) {
+ playSound(13, 1);
+ } else if (i == 1) {
+ waitForTimer(100);
+ }
+ }
+ _objectsState[69] = 1;
+ PART_25_HELPER_1(1);
+}
+
+void IgorEngine::PART_26_ACTION_104() {
+ if (_objectsState[69] == 0) {
+ EXEC_MAIN_ACTION(14);
+ return;
+ }
+ for (int i = 3; i <= 4; ++i) {
+ const int offset = 19870;
+ for (int j = 0; j <= 65; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 2706 + j * 41 + 0x16C0, 41);
+ if (i == 4) {
+ playSound(14, 1);
+ }
+ if (i == 3) {
+ waitForTimer(100);
+ }
+ }
+ }
+ _objectsState[69] = 0;
+ PART_25_HELPER_1(1);
+}
+
+void IgorEngine::PART_26_ACTION_107() {
+ if (_objectsState[69] != 0) {
+ _roomObjectAreasTable[_screenLayer2[36800]].area = 1;
+ --_walkDataLastIndex;
+ buildWalkPath(62, 127, 0, 115);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 160;
+ }
+}
+
+void IgorEngine::PART_26_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(29) || compareGameTick(61)) {
+ if (_gameState.unk10 > 2) {
+ if (_gameState.unk10 == 11) {
+ _gameState.unk10 = 2;
+ }
+ PART_26_HELPER_7(PART_26_ANIM_DATA_1[_gameState.unk10]);
+ if (_gameState.unk10 > 2) {
+ ++_gameState.unk10;
+ }
+ } else if (_gameState.unk10 == 1) {
+ _gameState.unk10 = 2;
+ PART_26_HELPER_7(_gameState.unk10);
+ } else if (getRandomNumber(25) == 0) {
+ _gameState.unk10 = 1;
+ PART_26_HELPER_7(_gameState.unk10);
+ } else if (getRandomNumber(30) == 0) {
+ _gameState.unk10 = 3;
+ }
+ }
+}
+
+void IgorEngine::PART_26_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[69] == 0) {
+ PART_26_HELPER_2();
+ _roomActionsTable[0x1E] = 6;
+ } else {
+ PART_26_HELPER_3();
+ _roomActionsTable[0x1E] = 7;
+ }
+ }
+}
+
+void IgorEngine::PART_26_HELPER_2() {
+ const int offset = 19870;
+ for (int i = 0; i <= 64; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 25, 25);
+ }
+}
+
+void IgorEngine::PART_26_HELPER_3() {
+ const int offset = 19870;
+ for (int i = 0; i <= 64; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + 0x659 + i * 25, 25);
+ }
+}
+
+void IgorEngine::PART_26_HELPER_4() {
+ _walkData[0].setPos(319, 125, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPathSimple(319, 125, 269, 140);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_26_HELPER_5() {
+ _walkData[0].setPos(0, 115, 3, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 2;
+ _walkData[0].clipWidth = 30;
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[36800]].area = 1;
+ buildWalkPath(0, 115, 70, 127);
+ _roomObjectAreasTable[_screenLayer2[36800]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ if (_objectsState[65] == 3) {
+ ADD_DIALOGUE_TEXT(212, 1);
+ ADD_DIALOGUE_TEXT(213, 2);
+ ADD_DIALOGUE_TEXT(215, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startIgorDialogue();
+ _objectsState[65] = 4;
+ drawVerbsPanel();
+ redrawVerb(kVerbWalk, true);
+ _currentAction.verb = kVerbWalk;
+ drawInventory(_inventoryInfo[72], 0);
+ playSound(51, 1);
+ PART_26_HELPER_1(255);
+ }
+}
+
+void IgorEngine::PART_26_HELPER_7(int frame) {
+ _roomCursorOn = false;
+ for (int i = 0; i <= 39; ++i) {
+ for (int j = 0; j <= 21; ++j) {
+ int offset = (i + 91) * 320 + j + 169;
+ uint8 color = _screenVGA[offset];
+ if (color < 192 || (color > 207 && color != 240 && color != 241)) {
+ color = _animFramesBuffer[0x942 + frame * 880 + i * 22 + j];
+ }
+ _screenTempLayer[100 * i + j] = color;
+ }
+ }
+ for (int i = 0; i <= 39; ++i) {
+ const int offset = i * 320 + 29289;
+ memcpy(_screenVGA + offset, _screenTempLayer + i * 100, 22);
+ memcpy(_screenLayer1 + offset, _animFramesBuffer + 0x942 + frame * 880 + i * 22, 22);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_26() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_CollegeCorridorMissBarrymore, IMG_CollegeCorridorMissBarrymore, BOX_CollegeCorridorMissBarrymore, MSK_CollegeCorridorMissBarrymore, TXT_CollegeCorridorMissBarrymore);
+ static const int anm[] = { FRM_CollegeCorridorMissBarrymore1, FRM_CollegeCorridorMissBarrymore2, FRM_CollegeCorridorMissBarrymore3, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_CollegeCorridorMissBarrymore);
+ _roomDataOffsets = PART_26_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(14, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_26_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_26_UPDATE_ROOM_BACKGROUND;
+ PART_26_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ _gameState.unk10 = true;
+ fadeInPalette(768);
+ if (_currentPart == 260) {
+ PART_26_HELPER_4();
+ } else {
+ PART_26_HELPER_5();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart >= 260 && _currentPart <= 261) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_26_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+ _updateRoomBackground = 0;
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_27.cpp b/engines/igor/parts/part_27.cpp
new file mode 100644
index 0000000000..5d06e946a8
--- /dev/null
+++ b/engines/igor/parts/part_27.cpp
@@ -0,0 +1,296 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_27_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ _currentPart = 231;
+ break;
+ case 102:
+ if (_objectsState[85] == 0) {
+ ADD_DIALOGUE_TEXT(216, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ _objectsState[85] = 1;
+ PART_27_HELPER_1(255);
+ } else {
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ }
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ PART_27_ACTION_106();
+ break;
+ case 107:
+ PART_27_ACTION_107();
+ break;
+ case 108:
+ PART_27_ACTION_108();
+ break;
+ case 109:
+ ADD_DIALOGUE_TEXT(215, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 110:
+ PART_27_ACTION_110();
+ break;
+ case 111:
+ ADD_DIALOGUE_TEXT(222, 1);
+ ADD_DIALOGUE_TEXT(223, 2);
+ ADD_DIALOGUE_TEXT(225, 4);
+ SET_DIALOGUE_TEXT(1, 3);
+ startIgorDialogue();
+ break;
+ case 112:
+ ADD_DIALOGUE_TEXT(221, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 113:
+ _currentPart = 150;
+ break;
+ default:
+ error("PART_27_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_27_ACTION_106() {
+ if (_objectsState[84] == 1) {
+ EXEC_MAIN_ACTION(11);
+ return;
+ }
+ if (_objectsState[5] == 0) {
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ if (_objectsState[5] == 1) {
+ ADD_DIALOGUE_TEXT(209, 3);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ _objectsState[5] = 2;
+ return;
+ }
+ const int offset = 21810;
+ for (int i = 2; i <= 3; ++i) {
+ for (int j = 0; j <= 48; ++j) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + 0x3A0 + i * 1568 + j * 32, 32);
+ }
+ if (i == 3) {
+ playSound(3, 1);
+ }
+ if (i == 2) {
+ waitForTimer(100);
+ }
+ }
+ _objectsState[84] = 1;
+ PART_27_HELPER_1(1);
+}
+
+void IgorEngine::PART_27_ACTION_107() {
+ if (_objectsState[84] == 0) {
+ EXEC_MAIN_ACTION(14);
+ return;
+ }
+ const int offset = 21810;
+ for (int i = 2; i >= 1; --i) {
+ for (int j = 0; j <= 48; ++j) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + 0x3A0 + i * 1568 + j * 32, 32);
+ }
+ if (i == 2) {
+ playSound(14, 1);
+ waitForTimer(100);
+ }
+ }
+ _objectsState[84] = 0;
+ PART_27_HELPER_1(1);
+}
+
+void IgorEngine::PART_27_ACTION_108() {
+ if (_inventoryInfo[58] > 0 || _objectsState[42] == 2) {
+ ADD_DIALOGUE_TEXT(208, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ const int offset = 25012;
+ for (int i = 1; i <= 2; ++i) {
+ for (int j = 0; j <= 29; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 630 + j * 21 + 0x19AA, 21);
+ }
+ if (i == 1) {
+ waitForTimer(100);
+ }
+ }
+ addObjectToInventory(23, 58);
+ PART_27_HELPER_1(1);
+}
+
+void IgorEngine::PART_27_ACTION_110() {
+ ADD_DIALOGUE_TEXT(212, 1);
+ ADD_DIALOGUE_TEXT(213, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ const int offset = 25012;
+ for (int i = 1; i <= 2; ++i) {
+ for (int j = 0; j <= 48; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + 0x19AA + i * 630 + j * 21, 21);
+ }
+ if (i == 1) {
+ waitForTimer(100);
+ }
+ }
+ removeObjectFromInventory(55);
+ PART_27_HELPER_1(255);
+ _objectsState[107] = 1;
+}
+
+void IgorEngine::PART_27_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[84] == 0) {
+ PART_27_HELPER_3();
+ _roomActionsTable[3] = 6;
+ _roomObjectAreasTable[6].object = 3;
+ } else {
+ PART_27_HELPER_4();
+ _roomActionsTable[3] = 7;
+ _roomObjectAreasTable[6].object = 4;
+ }
+ }
+ if (num == 2 || num == 255) {
+ if (_objectsState[85] == 0) {
+ _roomObjectAreasTable[5].object = 2;
+ _roomObjectAreasTable[6].object = 2;
+ } else {
+ _roomObjectAreasTable[5].object = 3;
+ }
+ }
+}
+
+void IgorEngine::PART_27_HELPER_2() {
+ _walkData[0].setPos(0, 132, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPathSimple(0, 132, 30, 132);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_27_HELPER_3() {
+ const int offset = 21816;
+ for (int i = 0; i <= 47; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 26, 26);
+ }
+}
+
+void IgorEngine::PART_27_HELPER_4() {
+ const int offset = 21816;
+ for (int i = 0; i <= 47; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 26 + 0x4E0, 26);
+ }
+}
+
+void IgorEngine::PART_27_HELPER_5() {
+ _walkData[0].setPos(270, 134, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPathSimple(270, 134, 140, 134);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_27() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_CollegeLockers, IMG_CollegeLockers, BOX_CollegeLockers, MSK_CollegeLockers, TXT_CollegeLockers);
+ static const int anm[] = { FRM_CollegeLockers1, FRM_CollegeLockers2, FRM_CollegeLockers3, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_CollegeLockers);
+ _roomDataOffsets = PART_27_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_27_EXEC_ACTION);
+ PART_27_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ if (_currentPart == 270) {
+ PART_27_HELPER_2();
+ } else {
+ PART_27_HELPER_5();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 270 || _currentPart == 271) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_28.cpp b/engines/igor/parts/part_28.cpp
new file mode 100644
index 0000000000..4b952ad3bb
--- /dev/null
+++ b/engines/igor/parts/part_28.cpp
@@ -0,0 +1,369 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_28_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ _currentPart = 230;
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ if (_objectsState[111] == 0) {
+ ADD_DIALOGUE_TEXT(205, 1);
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ } else {
+ ADD_DIALOGUE_TEXT(234, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ }
+ break;
+ case 107:
+ ADD_DIALOGUE_TEXT(237, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 108:
+ PART_28_ACTION_108();
+ break;
+ case 109:
+ PART_28_ACTION_109();
+ break;
+ case 110:
+ ADD_DIALOGUE_TEXT(228, 1);
+ ADD_DIALOGUE_TEXT(229, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 111:
+ if (_objectsState[3] == 0) {
+ ADD_DIALOGUE_TEXT(226, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ } else {
+ ADD_DIALOGUE_TEXT(227, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ }
+ startIgorDialogue();
+ break;
+ case 112:
+ ADD_DIALOGUE_TEXT(235, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 113:
+ ADD_DIALOGUE_TEXT(236, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ default:
+ error("PART_28_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_28_ACTION_108() {
+ if (_objectsState[111] == 1) {
+ ADD_DIALOGUE_TEXT(218, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(211, 1);
+ ADD_DIALOGUE_TEXT(212, 1);
+ ADD_DIALOGUE_TEXT(213, 2);
+ ADD_DIALOGUE_TEXT(215, 1);
+ ADD_DIALOGUE_TEXT(216, 1);
+ SET_DIALOGUE_TEXT(1, 5);
+ startCutsceneDialogue(182, 81, 63, 17, 17);
+ _updateDialogue = &IgorEngine::PART_28_UPDATE_DIALOGUE_CAROLINE;
+ waitForEndOfCutsceneDialogue(182, 81, 63, 17, 17);
+ ADD_DIALOGUE_TEXT(217, 1);
+ SET_DIALOGUE_TEXT(1, 5);
+ startCutsceneDialogue(182, 81, 63, 17, 17);
+ waitForEndOfCutsceneDialogue(182, 81, 63, 17, 17);
+ _updateDialogue = 0;
+ --_walkDataLastIndex;
+ buildWalkPath(213, 131, 160, 140);
+ _walkDataCurrentIndex = 1;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkData[_walkDataLastIndex].posNum = 3;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ ADD_DIALOGUE_TEXT(222, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ if (_objectsState[87] < 2) {
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ } else {
+ ADD_DIALOGUE_TEXT(218, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ }
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ if (_objectsState[87] < 2) {
+ ADD_DIALOGUE_TEXT(208, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ } else {
+ ADD_DIALOGUE_TEXT(219, 2);
+ ADD_DIALOGUE_TEXT(221, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ }
+ startCutsceneDialogue(182, 81, 63, 17, 17);
+ _updateDialogue = &IgorEngine::PART_28_UPDATE_DIALOGUE_CAROLINE;
+ waitForEndOfCutsceneDialogue(182, 81, 63, 17, 17);
+ _updateDialogue = 0;
+}
+
+void IgorEngine::PART_28_ACTION_109() {
+ for (int i = 1; i <= 7; ++i) {
+ const int offset = 25067;
+ for (int j = 0; j <= 34; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 1085 + j * 31 + 0x5EC9, 31);
+ }
+ if (i < 7) {
+ waitForTimer(45);
+ }
+ }
+ addObjectToInventory(22, 57);
+ _objectsState[87] = 1;
+ PART_28_HELPER_1(255);
+ ADD_DIALOGUE_TEXT(230, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+}
+
+void IgorEngine::PART_28_UPDATE_DIALOGUE_CAROLINE(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_28_HELPER_5(7);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_28_HELPER_5(getRandomNumber(5) + 7);
+ break;
+ }
+}
+
+void IgorEngine::PART_28_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(61)) {
+ if (_gameState.unk10 > 2) {
+ PART_28_HELPER_5(_gameState.unk10);
+ if (_gameState.unk10 < 6) {
+ ++_gameState.unk10;
+ } else {
+ _gameState.unk10 = 1;
+ }
+ } else {
+ PART_28_HELPER_5(_gameState.unk10);
+ if (_gameState.unk10 == 1) {
+ _gameState.unk10 = 2;
+ } else {
+ _gameState.unk10 = 1;
+ }
+ if (getRandomNumber(8) == 0) {
+ _gameState.unk10 = 3;
+ }
+ }
+ }
+}
+
+void IgorEngine::PART_28_HELPER_1(int num) {
+ WRITE_LE_UINT16(_roomActionsTable + 0x56, 42133);
+ if (num == 2 || num == 255) {
+ if (_objectsState[87] == 0) {
+ PART_28_HELPER_8(1);
+ } else {
+ PART_28_HELPER_8(0);
+ _roomObjectAreasTable[7].object = 0;
+ }
+ }
+}
+
+void IgorEngine::PART_28_HELPER_2() {
+ const int offset = 27374;
+ for (int i = 0; i <= 43; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 30, 30);
+ }
+}
+
+void IgorEngine::PART_28_HELPER_3() {
+ _walkData[0].setPos(319, 142, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPathSimple(319, 142, 289, 142);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_28_HELPER_5(int frame) {
+ _roomCursorOn = false;
+ for (int i = 0; i <= 43; ++i) {
+ for (int j = 0; j <= 29; ++j) {
+ int offset = (i + 85) * 320 + j + 174;
+ uint8 color = _screenVGA[offset];
+ if ((color >= 192 && color <= 207) || color == 240 || color == 241) {
+ _screenTempLayer[i * 100 + j] = _screenVGA[offset];
+ } else {
+ _screenTempLayer[i * 100 + j] = _animFramesBuffer[(frame - 1) * 1320 + i * 30 + j];
+ }
+ }
+ }
+ int offset = 27374;
+ for (int i = 0; i <= 43; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _screenTempLayer + i * 100, 30);
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + (frame - 1) * 1320 + i * 30, 30);
+ }
+ if (_gameState.dialogueTextRunning) {
+ memcpy(_screenTextLayer + 23040, _screenLayer1 + _dialogueDirtyRectY, _dialogueDirtyRectSize);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_28_HELPER_6() {
+ setupDefaultPalette();
+ SET_PAL_240_48_1();
+ SET_PAL_208_96_1();
+ drawVerbsPanel();
+ drawInventory(_inventoryInfo[72], 0);
+ PART_28_HELPER_1(255);
+ fadeInPalette(768);
+ _walkData[0].setPos(319, 142, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPath(319, 142, 214, 130);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkData[_walkDataLastIndex].posNum = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ ADD_DIALOGUE_TEXT(209, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ waitForTimer(255);
+ ADD_DIALOGUE_TEXT(231, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ --_walkDataLastIndex;
+ buildWalkPath(214, 130, 214, 140);
+ _walkDataCurrentIndex = 1;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ ADD_DIALOGUE_TEXT(224, 2);
+ ADD_DIALOGUE_TEXT(232, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+}
+
+void IgorEngine::PART_28_HELPER_8(int frame) {
+ const int offset = 33387;
+ for (int i = 0; i <= 8; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + frame * 135 + i * 15 + 0x61F8, 15);
+ }
+}
+
+void IgorEngine::PART_28() {
+ _gameState.enableLight = 2;
+ loadRoomData(PAL_CollegeCorridorCaroline, IMG_CollegeCorridorCaroline, BOX_CollegeCorridorCaroline, MSK_CollegeCorridorCaroline, TXT_CollegeCorridorCaroline);
+ static const int anm[] = { FRM_CollegeCorridorCaroline1, FRM_CollegeCorridorCaroline2, FRM_CollegeCorridorCaroline3, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_CollegeCorridorCaroline);
+ _roomDataOffsets = PART_28_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(15, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_28_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_28_UPDATE_ROOM_BACKGROUND;
+ PART_28_HELPER_2();
+ PART_28_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ if (_currentPart == 280) {
+ fadeInPalette(768);
+ PART_28_HELPER_3();
+ } else if (_currentPart == 281) {
+ PART_28_HELPER_6();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 280 || _currentPart == 281) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_28_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ if (_objectsState[87] == 1) {
+ _objectsState[87] = 2;
+ }
+ fadeOutPalette(624);
+ _updateRoomBackground = 0;
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_30.cpp b/engines/igor/parts/part_30.cpp
new file mode 100644
index 0000000000..8cd8ca8626
--- /dev/null
+++ b/engines/igor/parts/part_30.cpp
@@ -0,0 +1,325 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_30_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ _currentPart = 231;
+ break;
+ case 102:
+ PART_30_ACTION_102();
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ PART_30_ACTION_104();
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ _currentPart = 210;
+ break;
+ default:
+ error("PART_30_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_30_ACTION_102() {
+ _roomObjectAreasTable[_screenLayer2[24108]].area = 2;
+ --_walkDataLastIndex;
+ buildWalkPath(99, 119, 108, 75);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _roomObjectAreasTable[_screenLayer2[24170]].area = 0;
+ --_walkDataLastIndex;
+ buildWalkPath(108, 75, 170, 75);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 312;
+}
+
+void IgorEngine::PART_30_ACTION_104() {
+ --_walkDataLastIndex;
+ _roomObjectAreasTable[_screenLayer2[36318]].area = 2;
+ buildWalkPath(158, 119, 158, 113);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _walkDataCurrentIndex = 0;
+ for (int i = 9; i >= 0; --i) {
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ _walkData[0].setPos(158, 113, 1, _walkCurrentFrame);
+ WalkData::setNextFrame(1, _walkCurrentFrame);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 1;
+ _walkData[0].clipWidth = 30;
+ _walkData[0].dyPos = 3;
+ _walkData[0].scaleWidth = i * 3 + 23;
+ moveIgor(_walkData[0].posNum, _walkData[0].frameNum);
+ waitForTimer(15);
+ }
+ _currentPart = (_objectsState[111] == 0) ? 171 : 771;
+}
+
+void IgorEngine::PART_30_UPDATE_DIALOGUE_LAURA(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_30_HELPER_9(42);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_30_HELPER_9(getRandomNumber(9) + 42);
+ break;
+ case kUpdateDialogueAnimStanding:
+ PART_30_HELPER_9(33);
+ break;
+ }
+}
+
+void IgorEngine::PART_30_HANDLE_DIALOGUE_LAURA() {
+ loadDialogueData(DLG_CollegeStairsFirstFloor);
+ _updateDialogue = &IgorEngine::PART_30_UPDATE_DIALOGUE_LAURA;
+ handleDialogue(201, 85, 63, 0, 38);
+ _updateDialogue = 0;
+}
+
+void IgorEngine::PART_30_HELPER_1(int num) {
+}
+
+void IgorEngine::PART_30_HELPER_2() {
+ _walkData[0].setPos(0, 138, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPath(0, 138, 30, 138);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_30_HELPER_3() {
+ _roomObjectAreasTable[_screenLayer2[24170]].area = 2;
+ _walkData[0].setPos(170, 75, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[24108]].area = 2;
+ buildWalkPath(170, 75, 108, 75);
+ _roomObjectAreasTable[_screenLayer2[24170]].area = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ --_walkDataLastIndex;
+ buildWalkPath(108, 75, 99, 119);
+ _roomObjectAreasTable[_screenLayer2[24108]].area = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ --_walkDataLastIndex;
+ buildWalkPath(99, 119, 128, 123);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_30_HELPER_4() {
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ _walkCurrentPos = 3;
+ for (int i = 0; i <= 9; ++i) {
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ _walkData[0].setPos(158, 113, 3, _walkCurrentFrame);
+ WalkData::setNextFrame(3, _walkCurrentFrame);
+ _walkData[0].setDefaultScale();
+ _walkData[0].scaleWidth = i * 3 + 23;
+ moveIgor(_walkData[0].posNum, _walkData[0].frameNum);
+ waitForTimer(15);
+ }
+ _walkDataLastIndex = 1;
+ _walkDataCurrentIndex = 1;
+ _roomObjectAreasTable[_screenLayer2[36318]].area = 2;
+ --_walkDataLastIndex;
+ buildWalkPath(158, 113, 128, 123);
+ _roomObjectAreasTable[_screenLayer2[36318]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_30_HELPER_5() {
+ _walkData[0].setPos(319, 138, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkDataCurrentIndex = 1;
+ buildWalkPath(319, 138, 289, 138);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_30_HELPER_8() {
+ playMusic(3);
+ memset(_screenVGA + 46080, 0, 17920);
+ fadeInPalette(768);
+ for (int i = 1; i <= 40; ++i) {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0xBE94 + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ if (i < 34) {
+ waitForTimer(25);
+ } else {
+ waitForTimer(15);
+ }
+ }
+ _walkData[0].setPos(172, 134, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkDataLastIndex = 1;
+ _walkDataCurrentIndex = 1;
+ _updateDialogue = &IgorEngine::PART_30_UPDATE_DIALOGUE_LAURA;
+ ADD_DIALOGUE_TEXT(203, 1);
+ ADD_DIALOGUE_TEXT(204, 1);
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(201, 85, 63, 0, 38);
+ waitForEndOfCutsceneDialogue(201, 85, 63, 0, 38);
+ decodeAnimFrame(_animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0xBEE6) - 1, _screenVGA, true);
+ for (int i = 1; i <= 41; ++i) {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0xBE94 + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ }
+ PART_30_HANDLE_DIALOGUE_LAURA();
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(208, 1);
+ ADD_DIALOGUE_TEXT(209, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startCutsceneDialogue(201, 85, 63, 0, 38);
+ waitForEndOfCutsceneDialogue(201, 85, 63, 0, 38);
+ _updateDialogue = 0;
+ for (int i = 51; i <= 70; ++i) {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0xBE94 + i * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+ if (i < 68) {
+ waitForTimer(25);
+ }
+ }
+ _walkData[0].setPos(164, 135, 3, 0);
+ _walkData[0].setDefaultScale();
+ _walkDataLastIndex = 1;
+ ADD_DIALOGUE_TEXT(210, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ memset(_screenVGA + 46080, 0, 17920);
+ drawVerbsPanel();
+ drawInventory(_inventoryInfo[72], 0);
+ _currentAction.verb = kVerbWalk;
+ _objectsState[73] = 1;
+ PART_30_HELPER_1(255);
+}
+
+void IgorEngine::PART_30_HELPER_9(int frame) {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0xBE94 + frame * 2) - 1;
+ decodeAnimFrame(src, _screenVGA, true);
+}
+
+void IgorEngine::PART_30() {
+ _gameState.enableLight = 2;
+ loadRoomData(PAL_CollegeStairsFirstFloor, IMG_CollegeStairsFirstFloor, BOX_CollegeStairsFirstFloor, MSK_CollegeStairsFirstFloor, TXT_CollegeStairsFirstFloor);
+ static const int anm[] = { FRM_CollegeStairsFirstFloor1, FRM_CollegeStairsFirstFloor2, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_CollegeStairsFirstFloor);
+ _roomDataOffsets = PART_30_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_30_EXEC_ACTION);
+ PART_30_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ if (_objectsState[73] == 0) {
+ PART_30_HELPER_8();
+ } else {
+ if (_currentPart != 302) {
+ fadeInPalette(768);
+ }
+ if (_currentPart == 300) {
+ PART_30_HELPER_2();
+ } else if (_currentPart == 301) {
+ PART_30_HELPER_3();
+ } else if (_currentPart == 302) {
+ playMusic(3);
+ fadeInPalette(768);
+ PART_30_HELPER_4();
+ } else if (_currentPart == 303) {
+ PART_30_HELPER_5();
+ }
+ }
+ if (!_gameState.dialogueTextRunning) {
+ showCursor();
+ }
+ _gameState.igorMoving = false;
+ while (_currentPart >= 300 && _currentPart <= 303) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_31.cpp b/engines/igor/parts/part_31.cpp
new file mode 100644
index 0000000000..a3822d7982
--- /dev/null
+++ b/engines/igor/parts/part_31.cpp
@@ -0,0 +1,453 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_31_ANIM_DATA_1[] = { 0, 4, 5, 4, 5, 4, 5, 4, 5, 6 };
+
+static const uint8 PART_31_ANIM_DATA_2[] = { 0, 4, 5, 4, 5, 4, 5, 1, 2, 3 };
+
+void IgorEngine::PART_31_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ _currentPart = 251;
+ break;
+ case 102:
+ PART_31_ACTION_102();
+ break;
+ case 103:
+ PART_31_ACTION_103();
+ break;
+ case 104:
+ if (_objectsState[72] == 0) {
+ EXEC_MAIN_ACTION(14);
+ } else {
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ }
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ PART_31_ACTION_106();
+ break;
+ case 107:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 108:
+ _currentPart = 240;
+ break;
+ case 109:
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 110:
+ PART_31_ACTION_110();
+ break;
+ case 111:
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 112:
+ ADD_DIALOGUE_TEXT(208, 1);
+ ADD_DIALOGUE_TEXT(209, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 113:
+ ADD_DIALOGUE_TEXT(211, 1);
+ ADD_DIALOGUE_TEXT(212, 1);
+ ADD_DIALOGUE_TEXT(213, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startIgorDialogue();
+ break;
+ case 114:
+ ADD_DIALOGUE_TEXT(214, 1);
+ ADD_DIALOGUE_TEXT(215, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 115:
+ ADD_DIALOGUE_TEXT(220, 3);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 116:
+ ADD_DIALOGUE_TEXT(218, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ default:
+ error("PART_31_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_31_ACTION_102() {
+ if (_objectsState[72] == 0) {
+ return;
+ }
+ _roomObjectAreasTable[_screenLayer2[33712]].area = 2;
+ --_walkDataLastIndex;
+ buildWalkPath(102, 120, 112, 105);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _roomObjectAreasTable[_screenLayer2[20207]].area = 2;
+ --_walkDataLastIndex;
+ buildWalkPath(112, 105, 47, 63);
+ for (int i = 1; i <= _walkDataLastIndex; ++i) {
+ _walkData[i].posNum = i;
+ }
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _currentPart = 320;
+}
+
+void IgorEngine::PART_31_ACTION_103() {
+ if (_objectsState[72] == 1) {
+ EXEC_MAIN_ACTION(11);
+ return;
+ }
+ playSound(49, 1);
+ const int offset = 20250;
+ for (int i = 1; i <= 9; ++i) {
+ for (int j = 0; j <= 57; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + PART_31_ANIM_DATA_1[i] * 1856 + j * 32 + 0x384, 32);
+ }
+ if (i < 9) {
+ waitForTimer(30);
+ }
+ }
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+}
+
+void IgorEngine::PART_31_ACTION_106() {
+ --_walkDataLastIndex;
+ _roomObjectAreasTable[_screenLayer2[36326]].area = 2;
+ buildWalkPath(166, 120, 166, 113);
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ _walkDataCurrentIndex = 0;
+ for (int i = 9; i >= 0; --i) {
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ WalkData *wd = &_walkData[0];
+ wd->setPos(166, 113, 1, _walkCurrentFrame);
+ WalkData::setNextFrame(1, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = i * 3 + 23;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 50;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(15);
+ }
+ _currentPart = 301;
+}
+
+void IgorEngine::PART_31_ACTION_110() {
+ if (_objectsState[72] == 1) {
+ EXEC_MAIN_ACTION(11);
+ return;
+ }
+ const int offset = 20250;
+ for (int i = 1; i <= 9; ++i) {
+ for (int j = 0; j <= 57; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + PART_31_ANIM_DATA_2[i] * 1856 + j * 32 + 0x384, 32);
+ }
+ if (i == 9) {
+ playSound(13, 1);
+ } else if (i < 8) {
+ waitForTimer(30);
+ } else if (i == 8) {
+ waitForTimer(10);
+ }
+ }
+ _objectsState[72] = 1;
+ PART_31_HELPER_1(1);
+}
+
+void IgorEngine::PART_31_UPDATE_ROOM_BACKGROUND() {
+ int xPos, pos;
+ if (_gameState.igorMoving) {
+ xPos = _walkData[_walkDataCurrentIndex - 1].x;
+ pos = _walkData[_walkDataCurrentIndex - 1].posNum;
+ } else {
+ xPos = _walkData[_walkDataLastIndex - 1].x;
+ pos = _walkData[_walkDataLastIndex - 1].posNum;
+ }
+ if (xPos < 160 && compareGameTick(3, 8)) {
+ if (pos == 2) {
+ if (_gameState.igorMoving) {
+ if (_gameState.unk10 == 1 || _gameState.unk10 == 2) {
+ _gameState.unk10 = 3;
+ PART_31_HELPER_2(_gameState.unk10);
+ return;
+ } else if (_gameState.unk10 == 3) {
+ _gameState.unk10 = 4;
+ PART_31_HELPER_2(_gameState.unk10);
+ return;
+ } else if (_gameState.unk10 == 4) {
+ if (getRandomNumber(30) == 0) {
+ _gameState.unk10 = 5;
+ PART_31_HELPER_2(_gameState.unk10);
+ _gameState.counter[4] = 0;
+ return;
+ }
+ } else if (_gameState.unk10 == 5) {
+ if (_gameState.counter[4] == 20) {
+ _gameState.unk10 = 4;
+ PART_31_HELPER_2(_gameState.unk10);
+ return;
+ } else {
+ ++_gameState.counter[4];
+ }
+ }
+ }
+ } else {
+ if (_gameState.unk10 == 4 || _gameState.unk10 == 5) {
+ _gameState.unk10 = 3;
+ PART_31_HELPER_2(_gameState.unk10);
+ return;
+ }
+ if (_gameState.unk10 == 1 || _gameState.unk10 == 3) {
+ _gameState.unk10 = 2;
+ PART_31_HELPER_2(_gameState.unk10);
+ return;
+ }
+ }
+ }
+ if (xPos > 159 && xPos < 251) {
+ if (compareGameTick(3, 32)) {
+ if (_gameState.unk10 == 2) {
+ _gameState.unk10 = 1;
+ } else {
+ _gameState.unk10 = 2;
+ }
+ PART_31_HELPER_2(_gameState.unk10);
+ return;
+ }
+ }
+ if (xPos > 250 && compareGameTick(3, 16)) {
+ if (_gameState.unk10 == 1) {
+ _gameState.unk10 = 2;
+ } else {
+ _gameState.unk10 = 1;
+ }
+ PART_31_HELPER_2(_gameState.unk10);
+ }
+}
+
+void IgorEngine::PART_31_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[72] == 0) {
+ _roomActionsTable[74] = 6;
+ } else {
+ PART_31_HELPER_9();
+ _roomActionsTable[74] = 7;
+ }
+ }
+}
+
+void IgorEngine::PART_31_HELPER_2(int frame) {
+ _roomCursorOn = false;
+ for (int i = 0; i <= 42; ++i) {
+ for (int j = 0; j <= 30; ++j) {
+ int offset = (i + 88) * 320 + j + 288;
+ uint8 color = _screenVGA[offset];
+ if (color < 192 || (color > 207 && color != 240 && color != 241)) {
+ color = _animFramesBuffer[0x310F + frame * 1333 + i * 31 + j];
+ }
+ _screenTempLayer[100 * i + j] = color;
+ }
+ }
+ for (int i = 0; i <= 42; ++i) {
+ const int offset = i * 320 + 28448;
+ memcpy(_screenVGA + offset, _screenTempLayer + i * 100, 31);
+ memcpy(_screenLayer1 + offset, _animFramesBuffer + 0x310F + frame * 1333 + i * 31, 31);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_31_HELPER_3() {
+ _walkData[0].setPos(0, 137, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 15;
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ buildWalkPath(0, 137, 30, 137);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_31_HELPER_4() {
+ _walkData[0].setPos(47, 63, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 30;
+ _walkDataLastIndex = 0;
+ _roomObjectAreasTable[_screenLayer2[20207]].area = 2;
+ _roomObjectAreasTable[_screenLayer2[33712]].area = 2;
+ buildWalkPath(47, 63, 112, 105);
+ for (int i = 1; i <= _walkDataCurrentIndex; ++i) {
+ _walkData[i].posNum = 2;
+ }
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+ buildWalkPath(112, 105, 102, 125);
+ _roomObjectAreasTable[_screenLayer2[20207]].area = 0;
+ _roomObjectAreasTable[_screenLayer2[33712]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_31_HELPER_5() {
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ _walkCurrentPos = 3;
+ for (int i = 0; i <= 9; ++i) {
+ WalkData *wd = &_walkData[0];
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ wd->setPos(166, 113, 3, _walkCurrentFrame);
+ WalkData::setNextFrame(3, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = i * 3 + 23;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 50;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(15);
+ }
+ _walkDataLastIndex = 1;
+ _walkDataCurrentIndex = 1;
+ _roomObjectAreasTable[_screenLayer2[36326]].area = 2;
+ --_walkDataLastIndex;
+ buildWalkPath(166, 113, 140, 123);
+ _roomObjectAreasTable[_screenLayer2[36326]].area = 0;
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_31_HELPER_6() {
+ _walkData[0].setPos(319, 138, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ buildWalkPath(319, 138, 289, 138);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_31_HELPER_9() {
+ const int offset = 20256;
+ for (int i = 0; i <= 52; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + i * 26 + 0x562, 26);
+ }
+}
+
+void IgorEngine::PART_31() {
+ _gameState.enableLight = 2;
+ loadRoomData(PAL_CollegeStairsSecondFloor, IMG_CollegeStairsSecondFloor, BOX_CollegeStairsSecondFloor, MSK_CollegeStairsSecondFloor, TXT_CollegeStairsSecondFloor);
+ static const int anm[] = { FRM_CollegeStairsSecondFloor1, FRM_CollegeStairsSecondFloor2, FRM_CollegeStairsSecondFloor3, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_CollegeStairsSecondFloor);
+ _roomDataOffsets = PART_31_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_31_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_31_UPDATE_ROOM_BACKGROUND;
+ PART_31_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ _gameState.unk10 = 4;
+ PART_31_HELPER_2(_gameState.unk10);
+ fadeInPalette(768);
+ if (_currentPart == 310) {
+ PART_31_HELPER_3();
+ } else if (_currentPart == 311) {
+ PART_31_HELPER_4();
+ } else if (_currentPart == 312) {
+ PART_31_HELPER_5();
+ } else if (_currentPart == 313) {
+ PART_31_HELPER_6();
+ }
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart >= 310 && _currentPart <= 313) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_31_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ _updateRoomBackground = 0;
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_33.cpp b/engines/igor/parts/part_33.cpp
new file mode 100644
index 0000000000..38ca6cce3b
--- /dev/null
+++ b/engines/igor/parts/part_33.cpp
@@ -0,0 +1,519 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_33_ANIM_DATA_4[4] = { 0, 1, 2, 1 };
+
+static const uint8 PART_33_ANIM_DATA_5[5] = { 0, 6, 7, 8, 1 };
+
+void IgorEngine::PART_33_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 102:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 108:
+ ADD_DIALOGUE_TEXT(208, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 109:
+ PART_33_ACTION_109();
+ break;
+ case 110:
+ ADD_DIALOGUE_TEXT(209, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 111:
+ PART_33_ACTION_111();
+ break;
+ case 112:
+ ADD_DIALOGUE_TEXT(213, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 113:
+ PART_33_ACTION_113();
+ break;
+ case 114:
+ PART_33_ACTION_114();
+ break;
+ case 115:
+ PART_33_ACTION_115();
+ break;
+ default:
+ error("PART_33_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_33_ACTION_109() {
+ if (_objectsState[4] == 0) {
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ if (_objectsState[74] == 1) {
+ ADD_DIALOGUE_TEXT(222, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ for (int i = 1; i <= 3; ++i) {
+ for (int j = 0; j <= 48; ++j) {
+ memcpy(_screenVGA + j * 320 + 23448, _animFramesBuffer + 0x467 * (PART_33_ANIM_DATA_4[i] - 1) + j * 23, 23);
+ waitForTimer(120);
+ }
+ }
+ addObjectToInventory(31, 66);
+ _objectsState[74] = 1;
+ PART_33_HELPER_1(255);
+ ADD_DIALOGUE_TEXT(210, 1);
+ ADD_DIALOGUE_TEXT(211, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+}
+
+void IgorEngine::PART_33_ACTION_111() {
+ if (_objectsState[75] == 1) {
+ PART_33_HELPER_9();
+ PART_33_HELPER_1(255);
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(202, 2);
+ ADD_DIALOGUE_TEXT(204, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_2;
+ startCutsceneDialogue(47, 82, 0, 58, 40);
+ waitForEndOfCutsceneDialogue(47, 82, 0, 58, 40);
+ _updateDialogue = 0;
+ loadResourceData__ROOM_Library();
+ PART_33_HELPER_1(255);
+ } else {
+ PART_33_HANDLE_DIALOGUE_HARRISON();
+ PART_33_HELPER_1(255);
+ }
+}
+
+void IgorEngine::PART_33_ACTION_113() {
+ _walkDataCurrentIndex = 0;
+ for (int i = 9; i >= 0; --i) {
+ if (i == 9) {
+ _walkCurrentFrame = 0;
+ }
+ WalkData *wd = &_walkData[0];
+ wd->setPos(207, 143, 3, _walkCurrentFrame);
+ WalkData::setNextFrame(3, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = i * 3 + 23;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 50;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(15);
+ }
+ _currentPart = 241;
+}
+
+void IgorEngine::PART_33_ACTION_114() {
+ for (int i = 0; i <= 28; ++i) {
+ memcpy(_screenVGA + i * 320 + 26279, _animFramesBuffer + i * 63 + 0x5827, 62);
+ }
+ ADD_DIALOGUE_TEXT(223, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(224, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_2;
+ startCutsceneDialogue(47, 82, 0, 58, 40);
+ waitForEndOfCutsceneDialogue(47, 82, 0, 58, 40);
+ _updateDialogue = 0;
+ for (int i = 2; i <= 5; ++i) {
+ for (int j = 0; j <= 28; ++j) {
+ memcpy(_screenVGA + j * 320 + 26279, _animFramesBuffer + i * 1827 + j * 63 + 0x5104, 62);
+ }
+ waitForTimer(60);
+ }
+ removeObjectFromInventory(54);
+ ADD_DIALOGUE_TEXT(225, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_2;
+ startCutsceneDialogue(47, 82, 0, 58, 40);
+ waitForEndOfCutsceneDialogue(47, 82, 0, 58, 40);
+ _updateDialogue = 0;
+ for (int i = 0; i <= 28; ++i) {
+ memcpy(_screenVGA + i * 320 + 26279, _animFramesBuffer + i * 63 + 0x5827, 62);
+ }
+ ADD_DIALOGUE_TEXT(226, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(227, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_2;
+ startCutsceneDialogue(47, 82, 0, 58, 40);
+ waitForEndOfCutsceneDialogue(47, 82, 0, 58, 40);
+ _updateDialogue = 0;
+ ADD_DIALOGUE_TEXT(228, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ ADD_DIALOGUE_TEXT(229, 2);
+ ADD_DIALOGUE_TEXT(231, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_2;
+ startCutsceneDialogue(47, 82, 0, 58, 40);
+ waitForEndOfCutsceneDialogue(47, 82, 0, 58, 40);
+ _updateDialogue = 0;
+ for (int i = 1; i <= 4; ++i) {
+ for (int j = 0; j <= 28; ++j) {
+ memcpy(_screenVGA + j * 320 + 26279, _animFramesBuffer + PART_33_ANIM_DATA_5[i] * 1827 + j * 63 + 0x5104, 62);
+ }
+ waitForTimer(60);
+ }
+ addObjectToInventory(35, 70);
+ PART_33_HELPER_1(255);
+ ADD_DIALOGUE_TEXT(233, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_2;
+ startCutsceneDialogue(47, 82, 0, 58, 40);
+ waitForEndOfCutsceneDialogue(47, 82, 0, 58, 40);
+ _updateDialogue = 0;
+ _objectsState[75] = 1;
+}
+
+void IgorEngine::PART_33_ACTION_115() {
+ const int offset = 26279;
+ for (int i = 0; i <= 28; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + i * 63 + 0x5827, 62);
+ }
+ waitForTimer(60);
+ ADD_DIALOGUE_TEXT(215, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ for (int i = 2; i <= 5; ++i) {
+ for (int j = 0; j <= 28; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 1827 + j * 63 + 0x5104, 62);
+ }
+ waitForTimer(60);
+ }
+ removeObjectFromInventory(67);
+ PART_33_HELPER_1(255);
+ ADD_DIALOGUE_TEXT(217, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_2;
+ startCutsceneDialogue(47, 82, 0, 58, 40);
+ waitForEndOfCutsceneDialogue(47, 82, 0, 58, 40);
+ _updateDialogue = 0;
+ for (int i = 0; i <= 28; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + i * 63 + 0x5827, 62);
+ }
+ ADD_DIALOGUE_TEXT(219, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_2;
+ startCutsceneDialogue(47, 82, 0, 58, 40);
+ waitForEndOfCutsceneDialogue(47, 82, 0, 58, 40);
+ _updateDialogue = 0;
+ for (int i = 0; i <= 28; ++i) {
+ memcpy(_screenVGA + i * 320 + offset, _animFramesBuffer + i * 63 + 0x5827, 62);
+ }
+ _objectsState[76] = 1;
+}
+
+void IgorEngine::PART_33_HANDLE_DIALOGUE_HARRISON() {
+ loadDialogueData(DLG_Library);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_3;
+ handleDialogue(47, 82, 0, 58, 40);
+ _updateDialogue = 0;
+}
+
+void IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_1(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_33_HELPER_4(1);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_33_HELPER_4(getRandomNumber(4) + 2);
+ break;
+ }
+}
+
+void IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_2(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_33_HELPER_8(4);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_33_HELPER_8(4 + getRandomNumber(3));
+ break;
+ }
+}
+
+void IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_3(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_33_HELPER_5(4);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_33_HELPER_5(4 + getRandomNumber(3));
+ break;
+ case kUpdateDialogueAnimStanding:
+ PART_33_HELPER_5(4);
+ break;
+ }
+}
+
+void IgorEngine::PART_33_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(61) && _objectsState[75] != 2) {
+ PART_33_HELPER_8(_gameState.unk10);
+ _gameState.unk10 = getRandomNumber(4) + 1;
+ if (_gameState.unk10 >= 1 && _gameState.unk10 <= 2) {
+ _gameState.unk10 = 1;
+ } else {
+ _gameState.unk10 = 2;
+ }
+ }
+}
+
+void IgorEngine::PART_33_HELPER_1(int num) {
+ if (num == 2 || num == 255) {
+ if (_objectsState[75] <= 1) {
+ PART_33_HELPER_3();
+ } else {
+ _roomObjectAreasTable[27].object = 0;
+ }
+ }
+}
+
+void IgorEngine::PART_33_HELPER_2() {
+ playMusic(11);
+ memcpy(_screenLayer2, _screenVGA, 46080);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ decodeAnimFrame(_animFramesBuffer + 0x8CE + READ_LE_UINT16(_animFramesBuffer + 0x5255) - 1, _screenVGA, true);
+ memcpy(_screenLayer1, _screenVGA, 46080);
+ fadeInPalette(624);
+ ADD_DIALOGUE_TEXT(220, 1);
+ ADD_DIALOGUE_TEXT(221, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ _updateDialogue = &IgorEngine::PART_33_UPDATE_DIALOGUE_HARRISON_1;
+ startCutsceneDialogue(92, 79, 0, 58, 40);
+ waitForEndOfCutsceneDialogue(92, 79, 0, 58, 40);
+ _updateDialogue = 0;
+ for (int i = 6; i <= 25; ++i) {
+ decodeAnimFrame(_animFramesBuffer + 0x8CE + READ_LE_UINT16(_animFramesBuffer + 0x5253 + i * 2) - 1, _screenVGA, true);
+ waitForTimer(30);
+ }
+ fadeOutPalette(624);
+}
+
+void IgorEngine::PART_33_HELPER_3() {
+ const int offset = 29479;
+ for (int i = 0; i <= 14; ++i) {
+ memcpy(_screenLayer1 + i * 320 + offset, _animFramesBuffer + 0x5287 + i * 16, 16);
+ }
+}
+
+void IgorEngine::PART_33_HELPER_4(int frame) {
+ decodeAnimFrame(_animFramesBuffer + 0x8CE + READ_LE_UINT16(_animFramesBuffer + 0x5253 + frame * 2) - 1, _screenVGA, true);
+}
+
+void IgorEngine::PART_33_HELPER_5(int frame) {
+ _roomCursorOn = false;
+ for (int i = 0; i <= 14; ++i) {
+ for (int j = 0; j <= 15; ++j) {
+ int offset = (i + 92) * 320 + j + 39;
+ uint8 color = _screenVGA[offset];
+ if (color < 192 || (color > 207 && color != 240 && color != 241)) {
+ color = _animFramesBuffer[0x5197 + frame * 240 + i * 16 + j];
+ }
+ _screenTempLayer[100 * i + j] = color;
+ }
+ }
+ for (int i = 0; i <= 14; ++i) {
+ const int offset = i * 320 + 29479;
+ memcpy(_screenVGA + offset, _screenTempLayer + i * 100, 16);
+ memcpy(_screenLayer1 + offset, _animFramesBuffer + 0x5197 + frame * 240 + i * 16, 16);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_33_HELPER_7() {
+ _walkDataCurrentIndex = 0;
+ _walkCurrentFrame = 1;
+ _walkCurrentPos = 1;
+ for (int i = 0; i <= 9; ++i) {
+ WalkData *wd = &_walkData[0];
+ wd->setPos(207, 143, 1, _walkCurrentFrame);
+ WalkData::setNextFrame(1, _walkCurrentFrame);
+ wd->clipSkipX = 1;
+ wd->clipWidth = 30;
+ wd->scaleWidth = 23 + i * 3;
+ wd->xPosChanged = 1;
+ wd->dxPos = 0;
+ wd->yPosChanged = 1;
+ wd->dyPos = 3;
+ wd->scaleHeight = 50;
+ moveIgor(wd->posNum, wd->frameNum);
+ waitForTimer(15);
+ }
+ _walkDataLastIndex = 1;
+ _walkDataCurrentIndex = 1;
+ --_walkDataLastIndex;
+ buildWalkPath(207, 143, 187, 138);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_33_HELPER_8(int frame) {
+ _roomCursorOn = false;
+ for (int i = 0; i <= 14; ++i) {
+ for (int j = 0; j <= 15; ++j) {
+ int offset = (i + 92) * 320 + j + 39;
+ uint8 color = _screenVGA[offset];
+ if (color < 192 || (color > 207 && color != 240 && color != 241)) {
+ color = _animFramesBuffer[0x5197 + frame * 240 + i * 16 + j];
+ }
+ _screenTempLayer[100 * i + j] = color;
+ }
+ }
+ for (int i = 0; i <= 14; ++i) {
+ const int offset = i * 320 + 29479;
+ memcpy(_screenVGA + offset, _screenTempLayer + i * 100, 16);
+ memcpy(_screenLayer1 + offset, _animFramesBuffer + 0x5197 + frame * 240 + i * 16, 16);
+ }
+ if (_dialogueCursorOn) {
+ _roomCursorOn = true;
+ }
+}
+
+void IgorEngine::PART_33_HELPER_9() {
+ uint8 *p = loadData(TXT_Library2);
+ decodeRoomStrings(p, true);
+ free(p);
+}
+
+void IgorEngine::PART_33() {
+ _gameState.enableLight = 1;
+ _gameState.unk10 = 1;
+ loadResourceData__ROOM_Library();
+ loadResourceData__ANIM_Library();
+ loadActionData(DAT_Library);
+ _roomDataOffsets = PART_33_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 276, 143);
+ if (_currentPart == 331) {
+ PART_33_HELPER_2();
+ return;
+ }
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_33_EXEC_ACTION);
+ _updateRoomBackground = &IgorEngine::PART_33_UPDATE_ROOM_BACKGROUND;
+ PART_33_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ PART_33_HELPER_7();
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 330) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ PART_33_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ }
+ if (_objectsState[75] == 1) {
+ _objectsState[75] = 2;
+ }
+ fadeOutPalette(624);
+ _updateRoomBackground = 0;
+}
+
+void IgorEngine::loadResourceData__ROOM_Library() {
+ loadRoomData(PAL_Library, IMG_Library, BOX_Library, MSK_Library, TXT_Library);
+}
+
+void IgorEngine::loadResourceData__ANIM_Library() {
+ static const int anm[] = { FRM_Library1, FRM_Library2, FRM_Library3, FRM_Library4, FRM_Library5, 0 };
+ loadAnimData(anm);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_36.cpp b/engines/igor/parts/part_36.cpp
new file mode 100644
index 0000000000..9510ac6ae5
--- /dev/null
+++ b/engines/igor/parts/part_36.cpp
@@ -0,0 +1,177 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_36_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 102:
+ PART_36_ACTION_102();
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(203, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(204, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(209, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 107:
+ ADD_DIALOGUE_TEXT(206, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 108:
+ ADD_DIALOGUE_TEXT(208, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 109:
+ _currentPart = 242;
+ break;
+ default:
+ error("PART_36_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_36_ACTION_102() {
+ for (_gameState.counter[0] = 1; _gameState.counter[0] >= 0; --_gameState.counter[0]) {
+ for (_gameState.counter[1] = 0; _gameState.counter[1] <= 48; ++_gameState.counter[1]) {
+ for (_gameState.counter[2] = 0; _gameState.counter[2] <= 33; ++_gameState.counter[2]) {
+ uint8 color = _animFramesBuffer[14 + _gameState.counter[0] * 1666 + _gameState.counter[1] * 34 + _gameState.counter[2]];
+ int offset = (_gameState.counter[1] + 74) * 320 + _gameState.counter[2] + 70;
+ if (color < 192 || color > 207) {
+ _screenTempLayer[100 * _gameState.counter[1] + _gameState.counter[2]] = color;
+ continue;
+ }
+ RoomObjectArea *roa = &_roomObjectAreasTable[_screenLayer2[offset]];
+ if (roa->y1Lum > 0) {
+ _screenTempLayer[100 * _gameState.counter[1] + _gameState.counter[2]] = _screenLayer1[offset];
+ } else {
+ if (roa->y2Lum > 0) {
+ color -= roa->deltaLum;
+ }
+ _screenTempLayer[100 * _gameState.counter[1] + _gameState.counter[2]] = color;
+ }
+ }
+ }
+ for (_gameState.counter[1] = 0; _gameState.counter[1] <= 48; ++_gameState.counter[1]) {
+ memcpy(_screenVGA + _gameState.counter[1] * 320 + 23750, _screenTempLayer + _gameState.counter[1] * 100, 34);
+ }
+ waitForTimer(45);
+ }
+ addObjectToInventory(30, 65);
+ _objectsState[88] = 1;
+ PART_36_HELPER_1(255);
+}
+
+void IgorEngine::PART_36_HELPER_1(int num) {
+ if (num == 1 || num == 255) {
+ if (_objectsState[88] == 0) {
+ PART_36_HELPER_4(1);
+ } else {
+ PART_36_HELPER_4(0);
+ _roomObjectAreasTable[6].object = 1;
+ _roomObjectAreasTable[7].object = 1;
+ }
+ }
+}
+
+void IgorEngine::PART_36_HELPER_2() {
+ _walkData[0].setPos(319, 143, 4, 0);
+ _walkData[0].setDefaultScale();
+ _walkDataLastIndex = 0;
+ _walkCurrentFrame = 1;
+ buildWalkPath(319, 143, 259, 143);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_36_HELPER_4(int frame) {
+ if (frame == 0) {
+ memcpy(_screenLayer1 + 31430, _animFramesBuffer, 7);
+ } else if (frame == 1) {
+ memcpy(_screenLayer1 + 31430, _animFramesBuffer + 7, 7);
+ }
+}
+
+void IgorEngine::PART_36() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_ChemistryClassroom, IMG_ChemistryClassroom, BOX_ChemistryClassroom, MSK_ChemistryClassroom, TXT_ChemistryClassroom);
+ static const int anm[] = { FRM_ChemistryClassroom1, FRM_ChemistryClassroom2, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_ChemistryClassroom);
+ _roomDataOffsets = PART_36_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(90, 0, 319, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_36_EXEC_ACTION);
+ PART_36_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ PART_36_HELPER_2();
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 360) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_37.cpp b/engines/igor/parts/part_37.cpp
new file mode 100644
index 0000000000..ff2c2f74cf
--- /dev/null
+++ b/engines/igor/parts/part_37.cpp
@@ -0,0 +1,139 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_37_EXEC_ACTION(int action) {
+ switch (action) {
+ case 101:
+ _currentPart = 212;
+ break;
+ case 102:
+ PART_37_ACTION_102();
+ break;
+ case 103:
+ ADD_DIALOGUE_TEXT(203, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 104:
+ ADD_DIALOGUE_TEXT(205, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 105:
+ ADD_DIALOGUE_TEXT(207, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 106:
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ default:
+ error("PART_37_EXEC_ACTION unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::PART_37_ACTION_102() {
+ if (_objectsState[89] == 1) {
+ ADD_DIALOGUE_TEXT(202, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ return;
+ }
+ ADD_DIALOGUE_TEXT(201, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ for (int i = 1; i >= 0; --i) {
+ int offset = 16423;
+ for (int j = 0; j <= 49; ++j) {
+ memcpy(_screenVGA + j * 320 + offset, _animFramesBuffer + i * 1550 + j * 31, 31);
+ }
+ waitForTimer(60);
+ }
+ addObjectToInventory(32, 67);
+ _objectsState[89] = 1;
+ PART_37_HELPER_1(255);
+}
+
+void IgorEngine::PART_37_HELPER_1(int num) {
+}
+
+void IgorEngine::PART_37_HELPER_2() {
+ _walkData[0].setPos(0, 143, 2, 0);
+ _walkData[0].setDefaultScale();
+ _walkData[0].clipSkipX = 16;
+ _walkData[0].clipWidth = 15;
+ _walkDataLastIndex = 0;
+ _walkCurrentFrame = 1;
+ buildWalkPath(0, 143, 60, 143);
+ _walkData[_walkDataLastIndex].frameNum = 0;
+ _walkDataCurrentIndex = 1;
+ _gameState.igorMoving = true;
+ waitForIgorMove();
+}
+
+void IgorEngine::PART_37() {
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_PhysicsClassroom, IMG_PhysicsClassroom, BOX_PhysicsClassroom, MSK_PhysicsClassroom, TXT_PhysicsClassroom);
+ static const int anm[] = { FRM_PhysicsClassroom1, 0 };
+ loadAnimData(anm);
+ loadActionData(DAT_PhysicsClassroom);
+ _roomDataOffsets = PART_37_ROOM_DATA_OFFSETS;
+ setRoomWalkBounds(0, 0, 228, 143);
+ SET_EXEC_ACTION_FUNC(1, &IgorEngine::PART_37_EXEC_ACTION);
+ PART_37_HELPER_1(255);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _currentAction.verb = kVerbWalk;
+ fadeInPalette(768);
+ PART_37_HELPER_2();
+ showCursor();
+ _gameState.igorMoving = false;
+ while (_currentPart == 370) {
+ handleRoomInput();
+ if (compareGameTick(1, 16)) {
+ handleRoomIgorWalk();
+ }
+ if (compareGameTick(19, 32)) {
+ handleRoomDialogue();
+ }
+ if (compareGameTick(4, 8)) {
+ handleRoomInventoryScroll();
+ }
+ if (compareGameTick(1)) {
+ handleRoomLight();
+ }
+ waitForTimer();
+ }
+ fadeOutPalette(624);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_75.cpp b/engines/igor/parts/part_75.cpp
new file mode 100644
index 0000000000..a1108149db
--- /dev/null
+++ b/engines/igor/parts/part_75.cpp
@@ -0,0 +1,119 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const uint8 PART_75_ANIM_DATA_1[18] = {
+ 0, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 10, 11, 12, 13, 14, 15, 16
+};
+
+static const uint8 PART_75_ANIM_DATA_2[37] = {
+ 0, 31, 32, 33, 34, 31, 32, 33, 34, 31, 32, 33, 34, 31, 32, 33, 34, 31, 32,
+ 33, 34, 31, 32, 33, 34, 31, 32, 33, 34, 31, 32, 33, 34, 31, 32, 33, 34
+};
+
+void IgorEngine::PART_75_UPDATE_DIALOGUE_PHILIP(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_75_HELPER_1(2);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_75_HELPER_1(getRandomNumber(5) + 2);
+ break;
+ }
+}
+
+void IgorEngine::PART_75_HELPER_1(int frame) {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0x5E6D + frame * 2) - 1;
+ decodeAnimFrame(src, _screenVGA);
+}
+
+void IgorEngine::PART_75() {
+ PART_MEANWHILE();
+ _gameState.enableLight = 1;
+ loadRoomData(PAL_PhilipRoom, IMG_PhilipRoom, BOX_PhilipRoom, MSK_PhilipRoom, TXT_PhilipRoom);
+ static const int anm[] = { ANM_PhilipVodka, AOF_PhilipVodka, 0 };
+ loadAnimData(anm);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _updateDialogue = &IgorEngine::PART_75_UPDATE_DIALOGUE_PHILIP;
+ PART_75_HELPER_1(1);
+ PART_75_HELPER_1(7);
+ memset(_currentPalette, 0, 768);
+ fadeInPalette(768);
+ _gameState.igorMoving = false;
+ ADD_DIALOGUE_TEXT(201, 1);
+ ADD_DIALOGUE_TEXT(202, 2);
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startCutsceneDialogue(187, 82, 63, 63, 0);
+ waitForEndOfCutsceneDialogue(187, 82, 63, 63, 0);
+ for (int i = 1; i <= 17; ++i) {
+ PART_75_HELPER_1(PART_75_ANIM_DATA_1[i]);
+ waitForTimer(30);
+ }
+ ADD_DIALOGUE_TEXT(205, 1);
+ ADD_DIALOGUE_TEXT(206, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startCutsceneDialogue(187, 82, 63, 63, 0);
+ waitForEndOfCutsceneDialogue(187, 82, 63, 63, 0);
+ for (int i = 17; i <= 30; ++i) {
+ PART_75_HELPER_1(i);
+ waitForTimer(15);
+ }
+ ADD_DIALOGUE_TEXT(208, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(187, 82, 63, 63, 0);
+ playSound(62, 1);
+ for (int i = 1; i <= 36; ++i) {
+ PART_75_HELPER_1(PART_75_ANIM_DATA_2[i]);
+ waitForTimer(15);
+ }
+ memcpy(_screenVGA + _dialogueDirtyRectY, _screenTextLayer + 23040, _dialogueDirtyRectSize);
+ ADD_DIALOGUE_TEXT(209, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(187, 82, 63, 63, 0);
+ PART_75_HELPER_1(35);
+ waitForTimer(255);
+ PART_75_HELPER_1(36);
+ waitForTimer(140);
+ memcpy(_screenVGA + _dialogueDirtyRectY, _screenTextLayer + 23040, _dialogueDirtyRectSize);
+ ADD_DIALOGUE_TEXT(210, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(187, 82, 63, 63, 0);
+ waitForEndOfCutsceneDialogue(187, 82, 63, 63, 0);
+ for (int i = 1; i <= 40; ++i) {
+ PART_75_HELPER_1(getRandomNumber(4) + 37);
+ waitForTimer(30);
+ }
+ memcpy(_screenVGA + _dialogueDirtyRectY, _screenTextLayer + 23040, _dialogueDirtyRectSize);
+ _gameState.dialogueTextRunning = false;
+ _updateDialogue = 0;
+ _currentPart = 122;
+ fadeOutPalette(768);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_85.cpp b/engines/igor/parts/part_85.cpp
new file mode 100644
index 0000000000..495ffbd7a7
--- /dev/null
+++ b/engines/igor/parts/part_85.cpp
@@ -0,0 +1,227 @@
+/* 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 "common/system.h"
+
+#include "igor/igor.h"
+
+namespace Igor {
+
+static bool VAR_WATER_SOUND_PLAYING;
+static int VAR_CURRENT_TALKING_ACTOR;
+
+void IgorEngine::PART_85_UPDATE_ROOM_BACKGROUND() {
+ if (compareGameTick(61)) {
+ scrollPalette(160, 167);
+ setPaletteRange(160, 167);
+ }
+ if (compareGameTick(2, 8)) {
+ scrollPalette(168, 178);
+ setPaletteRange(168, 178);
+ }
+ if (compareGameTick(13, 16)) {
+ scrollPalette(179, 184);
+ setPaletteRange(179, 184);
+ }
+ if (compareGameTick(5, 32)) {
+ scrollPalette(185, 191);
+ setPaletteRange(185, 191);
+ }
+ if (!VAR_WATER_SOUND_PLAYING) {
+ return;
+ }
+ if (_gameState.talkMode == kTalkModeTextOnly || !_gameState.dialogueTextRunning) {
+ playSound(17, 1);
+ }
+}
+
+void IgorEngine::PART_85_UPDATE_DIALOGUE_PHILIP_LAURA(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ decodeAnimFrame(_animFramesBuffer - 1 + READ_LE_UINT16(_animFramesBuffer + 0x7480), _screenVGA, true);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ if (VAR_CURRENT_TALKING_ACTOR != 0) {
+ _gameState.counter[0] = getRandomNumber(5) + 8;
+ } else {
+ _gameState.counter[0] = getRandomNumber(5) + 13;
+ }
+ decodeAnimFrame(getAnimFrame(0, 0x7480, _gameState.counter[0]), _screenVGA, true);
+ break;
+ }
+}
+
+void IgorEngine::PART_85_HELPER_1(int frameOffset2, int frameOffset1, int firstFrame, int lastFrame, int delay) {
+ do {
+ if (compareGameTick(0, delay)) {
+ decodeAnimFrame(_animFramesBuffer + frameOffset2 - 1 + READ_LE_UINT16(_animFramesBuffer + frameOffset1 + firstFrame * 2 - 3), _screenVGA, true);
+ ++firstFrame;
+ }
+ PART_85_UPDATE_ROOM_BACKGROUND();
+ if (_inputVars[kInputEscape]) return;
+ waitForTimer();
+ } while (firstFrame <= lastFrame);
+}
+
+void IgorEngine::PART_85_HELPER_2() {
+ int x = 1;
+ do {
+ if (compareGameTick(0, 16)) {
+ for (int y = 0; y <= 143; ++y) {
+ memcpy(_screenTextLayer + y * 320, _screenLayer1 + y * 320 + x * 8, 320 - x * 8);
+ memcpy(_screenTextLayer + y * 320 + 320 - x * 8, _screenLayer2 + y * 320 + 96, x * 8);
+ }
+ memcpy(_screenVGA, _screenTextLayer, 46080);
+ ++x;
+ }
+ PART_85_UPDATE_ROOM_BACKGROUND();
+ waitForTimer();
+ } while (x != 29 && !_inputVars[kInputEscape]);
+}
+
+void IgorEngine::PART_85_HELPER_6(int frame) {
+ const int offset = (_walkCurrentPos == 4) ? 24564 : 22643;
+ copyArea(_screenVGA, offset, 320, _screenLayer2 + offset, 320, 14, 8);
+ copyArea(_screenVGA, offset, 320, _igorHeadFrames + (_walkCurrentPos - 1) * 924 + frame * 154, 14, 14, 8, true);
+}
+
+void IgorEngine::PART_85() {
+ playMusic(2);
+ loadRoomData(PAL_SpringRock, IMG_SpringRock, BOX_SpringRock, MSK_SpringRock, TXT_SpringRock);
+ memcpy(_screenLayer2, _screenLayer1, 46080);
+ loadRoomData(PAL_SpringBridgeIntro, IMG_SpringBridgeIntro, 0, 0, TXT_SpringBridgeIntro);
+ static const int anm[] = { ANM_PhilipLauraIntro, AOF_PhilipLauraIntro, ANM_LauraIntro, AOF_LauraIntro, 0 };
+ loadAnimData(anm);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _updateDialogue = &IgorEngine::PART_85_UPDATE_DIALOGUE_PHILIP_LAURA;
+ _updateRoomBackground = &IgorEngine::PART_85_UPDATE_ROOM_BACKGROUND;
+ VAR_WATER_SOUND_PLAYING = true;
+ playSound(17, 1);
+ decodeAnimFrame(getAnimFrame(0, 0x7480, 1), _screenVGA, true);
+ fadeInPalette(768);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ PART_85_HELPER_1(0, 0x7481, 2, 7, 32);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ ADD_DIALOGUE_TEXT(201, 3);
+ ADD_DIALOGUE_TEXT(204, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startCutsceneDialogue(89, 56, 63, 63, 0);
+ VAR_CURRENT_TALKING_ACTOR = 0;
+ waitForEndOfCutsceneDialogue(89, 56, 63, 63, 0);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ ADD_DIALOGUE_TEXT(205, 3);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(113, 59, 63, 0, 38);
+ VAR_CURRENT_TALKING_ACTOR = 1;
+ waitForEndOfCutsceneDialogue(113, 59, 63, 0, 38);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ ADD_DIALOGUE_TEXT(208, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startCutsceneDialogue(89, 56, 63, 63, 0);
+ VAR_CURRENT_TALKING_ACTOR = 0;
+ waitForEndOfCutsceneDialogue(89, 56, 63, 63, 0);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ ADD_DIALOGUE_TEXT(209, 2);
+ ADD_DIALOGUE_TEXT(211, 1);
+ ADD_DIALOGUE_TEXT(212, 1);
+ ADD_DIALOGUE_TEXT(213, 1);
+ ADD_DIALOGUE_TEXT(214, 1);
+ SET_DIALOGUE_TEXT(1, 5);
+ startCutsceneDialogue(113, 59, 63, 0, 38);
+ VAR_CURRENT_TALKING_ACTOR = 1;
+ waitForEndOfCutsceneDialogue(113, 59, 63, 0, 38);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ PART_85_HELPER_1(0, 0x7481, 2, 7, 32);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ ADD_DIALOGUE_TEXT(215, 1);
+ ADD_DIALOGUE_TEXT(216, 2);
+ ADD_DIALOGUE_TEXT(218, 1);
+ SET_DIALOGUE_TEXT(1, 3);
+ startCutsceneDialogue(89, 56, 63, 63, 0);
+ VAR_CURRENT_TALKING_ACTOR = 0;
+ waitForEndOfCutsceneDialogue(89, 56, 63, 63, 0);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ ADD_DIALOGUE_TEXT(219, 2);
+ ADD_DIALOGUE_TEXT(221, 2);
+ SET_DIALOGUE_TEXT(1, 2);
+ startCutsceneDialogue(113, 59, 63, 0, 38);
+ VAR_CURRENT_TALKING_ACTOR = 1;
+ waitForEndOfCutsceneDialogue(113, 59, 63, 0, 38);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ decodeAnimFrame(getAnimFrame(0, 0x7480, 1), _screenVGA, true);
+ PART_85_HELPER_1(0, 0x7481, 2, 7, 32);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ PART_85_HELPER_1(0, 0x7481, 18, 37, 20);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ PART_85_HELPER_2();
+ VAR_WATER_SOUND_PLAYING = false;
+ stopSound();
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ PART_85_HELPER_1(0x74CA, 0xA6C4, 1, 6, 32);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ for (_gameState.counter[4] = 0; _gameState.counter[4] != 200; ++_gameState.counter[4]) {
+ PART_85_UPDATE_ROOM_BACKGROUND();
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ waitForTimer();
+ }
+ _walkData[0].x = 251;
+ _walkData[0].y = 125;
+ _walkData[0].scaleWidth = 50;
+ _walkDataLastIndex = 1;
+ _walkCurrentPos = 4;
+ ADD_DIALOGUE_TEXT(223, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ PART_85_HELPER_1(0x74CA, 0xA6C4, 7, 9, 32);
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ _walkData[0].x = 250;
+ _walkData[0].y = 119;
+ _walkCurrentPos = 3;
+ ADD_DIALOGUE_TEXT(225, 2);
+ ADD_DIALOGUE_TEXT(227, 3);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ if (_inputVars[kInputEscape]) goto PART_85_EXIT;
+ PART_85_HELPER_1(0x74CA, 0xA6C4, 10, 24, 16);
+
+PART_85_EXIT:
+ stopSound();
+ _gameState.dialogueTextRunning = false;
+ _inputVars[kInputEscape] = 0;
+ _walkData[0].setPos(155, 121, 4, 0);
+ _walkData[0].setDefaultScale();
+ copyArea(_screenLayer2, 23180, 320, _facingIgorFrames[3], 30, 30, 50, true);
+ memcpy(_screenVGA, _screenLayer2, 46080);
+ memset(_currentPalette + 0x270, 0, 0x8D);
+ setPaletteRange(208, 254);
+ _currentPart = 61;
+ _updateDialogue = 0;
+ _updateRoomBackground = 0;
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_90.cpp b/engines/igor/parts/part_90.cpp
new file mode 100644
index 0000000000..e5578fc18e
--- /dev/null
+++ b/engines/igor/parts/part_90.cpp
@@ -0,0 +1,76 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+static const char *STR_COPYRIGHT = "(C) 1995 Optik Software. All rights reserved.";
+
+void IgorEngine::PART_90() {
+ memset(_currentPalette, 0, 768);
+ setPaletteRange(0, 255);
+ switch (_currentPart) {
+ case 900:
+ loadData(PAL_OptikSoftware, _paletteBuffer);
+ loadData(IMG_OptikSoftware, _screenVGA);
+ break;
+ case 901:
+ loadData(PAL_Presents, _paletteBuffer);
+ loadData(IMG_Presents, _screenVGA);
+ break;
+ case 902:
+ loadData(PAL_GraphicAdventure, _paletteBuffer);
+ loadData(IMG_GraphicAdventure, _screenVGA);
+ break;
+ case 903:
+ loadData(PAL_PenduloStudios, _paletteBuffer);
+ loadData(IMG_PenduloStudios, _screenVGA);
+ break;
+ case 904:
+ loadData(PAL_TitleScreen, _paletteBuffer);
+ loadData(IMG_TitleScreen, _screenVGA);
+ drawString(_screenVGA, STR_COPYRIGHT, 2, 187, 0xF5, 0, 0);
+ break;
+ }
+ fadeInPalette(768);
+ while (!_inputVars[kInputEscape] && !_eventQuitGame) {
+ waitForTimer();
+ if (_inputVars[kInputOptions]) {
+ _inputVars[kInputOptions] = 0;
+ handleOptionsMenu();
+ break;
+ }
+ }
+ _inputVars[kInputEscape] = 0;
+ fadeOutPalette(768);
+ if (_currentPart == 904) {
+ _currentPart = 850;
+ } else {
+ ++_currentPart;
+ }
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_95.cpp b/engines/igor/parts/part_95.cpp
new file mode 100644
index 0000000000..0abe2d7149
--- /dev/null
+++ b/engines/igor/parts/part_95.cpp
@@ -0,0 +1,72 @@
+/* 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 "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::PART_95() {
+ memset(_currentPalette, 0, 768);
+ setPaletteRange(0, 255);
+ memset(_screenVGA, 0, 64000);
+ switch (_currentPart) {
+ case 950:
+ loadData(PAL_Shareware1, _paletteBuffer);
+ loadData(IMG_Shareware1, _screenVGA);
+ break;
+ case 951:
+ loadData(PAL_Shareware2, _paletteBuffer);
+ loadData(IMG_Shareware2, _screenVGA);
+ break;
+ case 952:
+ loadData(PAL_Shareware3, _paletteBuffer);
+ loadData(IMG_Shareware3, _screenVGA);
+ break;
+ case 953:
+ loadData(PAL_Shareware4, _paletteBuffer);
+ loadData(IMG_Shareware4, _screenVGA);
+ break;
+ case 954:
+ loadData(PAL_Shareware5, _paletteBuffer);
+ loadData(IMG_Shareware5, _screenVGA);
+ break;
+ case 955:
+ loadData(PAL_Shareware6, _paletteBuffer);
+ loadData(IMG_Shareware6, _screenVGA);
+ break;
+ case 956:
+ loadData(PAL_Shareware7, _paletteBuffer);
+ loadData(IMG_Shareware7, _screenVGA);
+ break;
+ }
+ fadeInPalette(768);
+ for (int i = 0; !_inputVars[kInputEscape] && i < 3000; ++i) {
+ waitForTimer();
+ }
+ _inputVars[kInputEscape] = 0;
+ fadeOutPalette(768);
+}
+
+} // namespace Igor
diff --git a/engines/igor/parts/part_main.cpp b/engines/igor/parts/part_main.cpp
new file mode 100644
index 0000000000..0a6587f1e5
--- /dev/null
+++ b/engines/igor/parts/part_main.cpp
@@ -0,0 +1,974 @@
+/* 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 "common/system.h"
+
+#include "igor/igor.h"
+
+namespace Igor {
+
+void IgorEngine::ADD_DIALOGUE_TEXT(int num, int count) {
+ assert(_dialogueTextsCount < MAX_DIALOGUE_TEXTS);
+ DialogueText *dt = &_dialogueTextsTable[_dialogueTextsCount];
+ dt->num = num;
+ dt->count = count;
+ ++_dialogueTextsCount;
+}
+
+void IgorEngine::SET_DIALOGUE_TEXT(int start, int count) {
+ _dialogueTextsStart = start - 1;
+ _dialogueTextsCount = count;
+}
+
+void IgorEngine::SET_EXEC_ACTION_FUNC(int i, ExecuteActionProc p) {
+ switch (i) {
+ case 0:
+ _executeMainAction = p;
+ break;
+ case 1:
+ _executeRoomAction = p;
+ break;
+ }
+}
+
+void IgorEngine::EXEC_MAIN_ACTION(int action) {
+ switch (action) {
+ case 0:
+ case 1:
+ break;
+ case 2: {
+ int num, rnd = getRandomNumber(100);
+ if (rnd < 34) {
+ num = 11;
+ } else if (rnd < 69) {
+ num = 12;
+ } else if (rnd < 94) {
+ num = 13;
+ } else {
+ num = 14;
+ }
+ ADD_DIALOGUE_TEXT(num, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ }
+ break;
+ case 3:
+ ADD_DIALOGUE_TEXT(15, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 4:
+ ADD_DIALOGUE_TEXT(10, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 5:
+ ADD_DIALOGUE_TEXT(9, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 6:
+ ADD_DIALOGUE_TEXT(8, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 7:
+ ADD_DIALOGUE_TEXT(6, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 8:
+ ADD_DIALOGUE_TEXT(7, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 9:
+ ADD_DIALOGUE_TEXT(16 + getRandomNumber(2), 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 10:
+ ADD_DIALOGUE_TEXT(18, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 11:
+ ADD_DIALOGUE_TEXT(19, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 12:
+ ADD_DIALOGUE_TEXT(20 + getRandomNumber(2), 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 13:
+ ADD_DIALOGUE_TEXT(22, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 14:
+ ADD_DIALOGUE_TEXT(23, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 15:
+ ADD_DIALOGUE_TEXT(24, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 16:
+ ADD_DIALOGUE_TEXT(25, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 17:
+ ADD_DIALOGUE_TEXT(26 + getRandomNumber(2), 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 18:
+ ADD_DIALOGUE_TEXT(28, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 19:
+ ADD_DIALOGUE_TEXT(4, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 20:
+ ADD_DIALOGUE_TEXT(5, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 21:
+ ADD_DIALOGUE_TEXT(1 + getRandomNumber(3), 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 22:
+ ADD_DIALOGUE_TEXT(51, 1);
+ ADD_DIALOGUE_TEXT(52, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 23:
+ ADD_DIALOGUE_TEXT(53, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 24:
+ ADD_DIALOGUE_TEXT(54, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 25:
+ ADD_DIALOGUE_TEXT(55, 3);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 26:
+ ADD_DIALOGUE_TEXT(58, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 27:
+ ADD_DIALOGUE_TEXT(59, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 28:
+ ADD_DIALOGUE_TEXT(61, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 29:
+ ADD_DIALOGUE_TEXT(62, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 30:
+ ADD_DIALOGUE_TEXT(64, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 31:
+ ADD_DIALOGUE_TEXT(63, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 32:
+ ADD_DIALOGUE_TEXT(65, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 33:
+ ADD_DIALOGUE_TEXT(66, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 34:
+ ADD_DIALOGUE_TEXT(30, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 35:
+ ADD_DIALOGUE_TEXT(29, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 36:
+ ADD_DIALOGUE_TEXT(67, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 37:
+ ADD_DIALOGUE_TEXT(69, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 38:
+ EXEC_MAIN_ACTION_38();
+ break;
+ case 39:
+ ADD_DIALOGUE_TEXT(70, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 40:
+ ADD_DIALOGUE_TEXT(71, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 41:
+ ADD_DIALOGUE_TEXT(72, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 42:
+ ADD_DIALOGUE_TEXT(73, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 43:
+ EXEC_MAIN_ACTION_43();
+ break;
+ case 44:
+ ADD_DIALOGUE_TEXT(156, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 45:
+ ADD_DIALOGUE_TEXT(92, 1);
+ ADD_DIALOGUE_TEXT(93, 3);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 46:
+ if (_objectsState[3] == 0) {
+ ADD_DIALOGUE_TEXT(85, 1);
+ } else {
+ ADD_DIALOGUE_TEXT(86, 2);
+ }
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ break;
+ case 48:
+ ADD_DIALOGUE_TEXT(77 + _objectsState[0], 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ case 50:
+ if (_objectsState[1] == 0) {
+ ADD_DIALOGUE_TEXT(80, 1);
+ ADD_DIALOGUE_TEXT(81, 1);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ } else {
+ ADD_DIALOGUE_TEXT(82, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ }
+ break;
+ case 51:
+ if (_objectsState[7] == 0) {
+ ADD_DIALOGUE_TEXT(157, 1);
+ } else {
+ ADD_DIALOGUE_TEXT(158, 1);
+ }
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 52:
+ ADD_DIALOGUE_TEXT(89, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 53:
+ ADD_DIALOGUE_TEXT(88, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 54:
+ EXEC_MAIN_ACTION_54();
+ break;
+ case 55:
+ ADD_DIALOGUE_TEXT(159, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 56:
+ ADD_DIALOGUE_TEXT(160, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 57:
+ ADD_DIALOGUE_TEXT(31, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 58:
+ ADD_DIALOGUE_TEXT(140, 1);
+ ADD_DIALOGUE_TEXT(141, 1);
+ ADD_DIALOGUE_TEXT(142, 1);
+ ADD_DIALOGUE_TEXT(143, 1);
+ SET_DIALOGUE_TEXT(1, 4);
+ startIgorDialogue();
+ _objectsState[4] = 2;
+ break;
+ case 59:
+ ADD_DIALOGUE_TEXT(97, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 60:
+ ADD_DIALOGUE_TEXT(161, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 61:
+ if (_inventoryInfo[51] != 0) {
+ ADD_DIALOGUE_TEXT(76, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ } else {
+ ADD_DIALOGUE_TEXT(74, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ addObjectToInventory(16, 51);
+ }
+ break;
+ case 62:
+ _inventoryImages[_inventoryInfo[52] - 1] = 0;
+ _inventoryInfo[52] = 0;
+ packInventory();
+ _inventoryImages[_inventoryInfo[59] - 1] = 0;
+ _inventoryInfo[59] = 0;
+ packInventory();
+ _objectsState[1] = 1;
+ UPDATE_OBJECT_STATE(2);
+ addObjectToInventory(24, 59);
+ ADD_DIALOGUE_TEXT(169, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 63:
+ ADD_DIALOGUE_TEXT(170, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ _inventoryImages[_inventoryInfo[68] - 1] = 0;
+ _inventoryInfo[68] = 0;
+ packInventory();
+ _inventoryImages[_inventoryInfo[69] - 1] = 0;
+ _inventoryInfo[69] = 0;
+ packInventory();
+ _objectsState[6] = 1;
+ UPDATE_OBJECT_STATE(7);
+ addObjectToInventory(34, 69);
+ break;
+ case 64:
+ if (_objectsState[6] == 0) {
+ ADD_DIALOGUE_TEXT(162, 1);
+ } else if (_objectsState[6] == 1) {
+ ADD_DIALOGUE_TEXT(163, 1);
+ } else if (_objectsState[6] == 2) {
+ ADD_DIALOGUE_TEXT(164, 1);
+ }
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 65:
+ ADD_DIALOGUE_TEXT(165, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 66:
+ ADD_DIALOGUE_TEXT(166, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 67:
+ ADD_DIALOGUE_TEXT(167, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 68:
+ ADD_DIALOGUE_TEXT(168, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ case 69:
+ ADD_DIALOGUE_TEXT(96, 1);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ break;
+ default:
+ warning("EXEC_MAIN_ACTION() Unhandled action %d", action);
+ break;
+ }
+}
+
+void IgorEngine::EXEC_MAIN_ACTION_38() {
+ memcpy(_paletteBuffer, _currentPalette, 624);
+ fadeOutPalette(624);
+ uint8 *tmp = (uint8 *)malloc(64000 + 768);
+ if (tmp) {
+ memcpy(tmp, _screenVGA, 64000);
+ memcpy(tmp + 64000, _paletteBuffer, 768);
+ }
+ loadData(IMG_NewsPaper, _screenVGA);
+ loadData(PAL_NewsPaper, _paletteBuffer);
+ fadeInPalette(624);
+// mov _dialogueColor+3, 0
+ WalkData *wd = &_walkData[_walkDataLastIndex - 1];
+ int _walkDataCurrentPosX2 = wd->x;
+ int _walkDataCurrentPosY2 = wd->y;
+ int _walkDataCurrentWScale = wd->scaleWidth;
+ wd->x = 80;
+ wd->y = 130;
+ wd->scaleWidth = 50;
+ ADD_DIALOGUE_TEXT(144, 1);
+ ADD_DIALOGUE_TEXT(145, 3);
+ ADD_DIALOGUE_TEXT(148, 2);
+ ADD_DIALOGUE_TEXT(150, 2);
+ SET_DIALOGUE_TEXT(1, 4);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ wd->x = 240;
+ wd->y = 130;
+ ADD_DIALOGUE_TEXT(152, 1);
+ ADD_DIALOGUE_TEXT(153, 3);
+ SET_DIALOGUE_TEXT(1, 2);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ wd->x = _walkDataCurrentPosX2;
+ wd->y = _walkDataCurrentPosY2;
+ wd->scaleWidth = _walkDataCurrentWScale;
+ fadeOutPalette(624);
+ if (tmp) {
+ memcpy(_screenVGA, tmp, 64000);
+ memcpy(_paletteBuffer, tmp + 64000, 768);
+ free(tmp);
+ }
+ fadeInPalette(624);
+ _objectsState[2] = 1;
+// mov _dialogueColor+3, 63
+}
+
+void IgorEngine::EXEC_MAIN_ACTION_43() {
+ memcpy(_paletteBuffer, _currentPalette, 624);
+ fadeOutPalette(624);
+ uint8 *tmp = (uint8 *)malloc(64000 + 768);
+ if (tmp) {
+ memcpy(tmp, _screenVGA, 64000);
+ memcpy(tmp + 64000, _paletteBuffer, 768);
+ }
+ loadData(IMG_PhotoHarrisonMargaret, _screenVGA);
+ loadData(PAL_PhotoHarrisonMargaret, _paletteBuffer);
+ fadeInPalette(624);
+// mov _dialogueColor+3, 0
+ WalkData *wd = &_walkData[_walkDataLastIndex - 1];
+ int _walkDataCurrentPosX2 = wd->x;
+ int _walkDataCurrentPosY2 = wd->y;
+ int _walkDataCurrentWScale = wd->scaleWidth;
+ wd->x = 160;
+ wd->y = 130;
+ wd->scaleWidth = 50;
+ ADD_DIALOGUE_TEXT(83, 2);
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ _currentAction.object1Num = 0;
+ wd->x = _walkDataCurrentPosX2;
+ wd->y = _walkDataCurrentPosY2;
+ wd->scaleWidth = _walkDataCurrentWScale;
+ fadeOutPalette(624);
+ if (tmp) {
+ memcpy(_screenVGA, tmp, 64000);
+ memcpy(_paletteBuffer, tmp + 64000, 768);
+ free(tmp);
+ }
+ fadeInPalette(624);
+// mov _dialogueColor+3, 63
+}
+
+void IgorEngine::EXEC_MAIN_ACTION_54() {
+ memcpy(_paletteBuffer, _currentPalette, 624);
+ fadeOutPalette(624);
+ uint8 *tmp = (uint8 *)malloc(64000 + 768);
+ if (tmp) {
+ memcpy(tmp, _screenVGA, 64000);
+ memcpy(tmp + 64000, _paletteBuffer, 768);
+ }
+ loadData(IMG_RomanNumbersPaper, _screenVGA);
+ loadData(PAL_RomanNumbersPaper, _paletteBuffer);
+ PART_UPDATE_FIGURES_ON_PAPER(0);
+ fadeInPalette(624);
+ WalkData *wd = &_walkData[_walkDataLastIndex - 1];
+ int _walkDataCurrentPosX2 = wd->x;
+ int _walkDataCurrentPosY2 = wd->y;
+ int _walkDataCurrentWScale = wd->scaleWidth;
+ wd->x = 160;
+ wd->y = 130;
+ wd->scaleWidth = 50;
+ if (_objectsState[2] == 0) {
+ ADD_DIALOGUE_TEXT(99, 1);
+ } else {
+ ADD_DIALOGUE_TEXT(100, 2);
+ }
+ SET_DIALOGUE_TEXT(1, 1);
+ startIgorDialogue();
+ waitForEndOfIgorDialogue();
+ wd->x = _walkDataCurrentPosX2;
+ wd->y = _walkDataCurrentPosY2;
+ wd->scaleWidth = _walkDataCurrentWScale;
+ fadeOutPalette(624);
+ if (tmp) {
+ memcpy(_screenVGA, tmp, 64000);
+ memcpy(_paletteBuffer, tmp + 64000, 768);
+ free(tmp);
+ }
+ fadeInPalette(624);
+}
+
+void IgorEngine::SET_PAL_208_96_1() {
+ memcpy(_paletteBuffer + 208 * 3, PAL_96_1, 96);
+}
+
+void IgorEngine::SET_PAL_240_48_1() {
+ memcpy(_paletteBuffer + 240 * 3, PAL_48_1, 48);
+}
+
+void IgorEngine::UPDATE_OBJECT_STATE(int num) {
+ if (num == 1 || num == 255) {
+ switch (_objectsState[0]) {
+ case 0:
+ memcpy(_globalObjectNames + 0x592 / 62, " bottle of whisky", 30);
+ break;
+ case 1:
+ memcpy(_globalObjectNames + 0x592 / 62, " empty bottle", 30);
+ break;
+ case 2:
+ memcpy(_globalObjectNames + 0x592 / 62, " bottle of water", 30);
+ break;
+ }
+ }
+ if (num == 2 || num == 255) {
+ switch (_objectsState[1]) {
+ case 0:
+ _inventoryImages[23] = 27;
+ memcpy(_globalObjectNames + 0x5D0 / 62, " lizard", 30);
+ break;
+ default:
+ _inventoryImages[23] = 35;
+ memcpy(_globalObjectNames + 0x5D0 / 62, " fat lizard", 30);
+ break;
+ }
+ }
+ if (num == 4 || num == 255) {
+ switch (_objectsState[3]) {
+ case 0:
+ memcpy(_globalObjectNames + 0x554 / 62, " Caroline%s folder", 30);
+ break;
+ case 1:
+ memcpy(_globalObjectNames + 0x554 / 62, " Philip%s folder", 30);
+ break;
+ }
+ }
+ if (num == 7 || num == 255) {
+ switch (_objectsState[6]) {
+ case 0:
+ _inventoryImages[33] = 21;
+ break;
+ case 1:
+ _inventoryImages[33] = 14;
+ break;
+ case 2:
+ _inventoryImages[33] = 7;
+ break;
+ }
+ }
+ if (num == 8 || num == 255) {
+ if (_objectsState[7] == 0) {
+ memcpy(_globalObjectNames + 0x60E / 62, " statuette", 30);
+ _inventoryImages[24] = 29;
+ } else {
+ memcpy(_globalObjectNames + 0x60E / 62, " reward", 30);
+ _inventoryImages[24] = 39;
+ }
+ }
+}
+
+void IgorEngine::PART_MEANWHILE() {
+ hideCursor();
+ memset(_currentPalette, 0, 768);
+ setPaletteRange(208, 255);
+ loadData(IMG_Meanwhile, _screenVGA);
+ _paletteBuffer[3] = 63;
+ _paletteBuffer[4] = 32;
+ _paletteBuffer[5] = 0;
+ _paletteBuffer[6] = 44;
+ _paletteBuffer[7] = 12;
+ _paletteBuffer[8] = 0;
+ fadeInPalette(9);
+ for (int i = 0; i <= 5 && !_inputVars[kInputEscape]; ++i) {
+ waitForTimer(250);
+ }
+ _inputVars[kInputEscape] = 0;
+ fadeOutPalette(9);
+}
+
+static int VAR_MARGARET_ROOM_ANIM_COUNTER;
+
+void IgorEngine::PART_MARGARET_ROOM_CUTSCENE_HELPER_1() {
+ const uint8 *src = _animFramesBuffer + READ_LE_UINT16(_animFramesBuffer + 0x2A63 + VAR_MARGARET_ROOM_ANIM_COUNTER * 2) - 1;
+ decodeAnimFrame(src, _screenVGA);
+}
+
+void IgorEngine::PART_MARGARET_ROOM_CUTSCENE_HELPER_2(int frame) {
+ const int offset = ((VAR_MARGARET_ROOM_ANIM_COUNTER - 1) * 5 + frame) * 2;
+ const uint8 *src = _animFramesBuffer + 0x2A75 + READ_LE_UINT16(_animFramesBuffer + offset + 0xD887) - 1;
+ decodeAnimFrame(src, _screenVGA);
+}
+
+void IgorEngine::PART_MARGARET_ROOM_CUTSCENE_UPDATE_DIALOGUE_MARGARET(int action) {
+ switch (action) {
+ case kUpdateDialogueAnimEndOfSentence:
+ PART_MARGARET_ROOM_CUTSCENE_HELPER_2(1);
+ break;
+ case kUpdateDialogueAnimMiddleOfSentence:
+ PART_MARGARET_ROOM_CUTSCENE_HELPER_2(getRandomNumber(5) + 1);
+ break;
+ }
+}
+
+void IgorEngine::PART_MARGARET_ROOM_CUTSCENE() {
+ _gameState.enableLight = 1;
+ VAR_MARGARET_ROOM_ANIM_COUNTER = _objectsState[110] + 1;
+ if (VAR_MARGARET_ROOM_ANIM_COUNTER == 9) {
+ VAR_MARGARET_ROOM_ANIM_COUNTER = 1;
+ }
+ loadRoomData(PAL_MargaretRoom, IMG_MargaretRoom, BOX_MargaretRoom, MSK_MargaretRoom, TXT_MargaretRoom);
+ static const int anm[] = { FRM_MargaretRoom1, FRM_MargaretRoom2, FRM_MargaretRoom3, FRM_MargaretRoom4, 0 };
+ loadAnimData(anm);
+ memcpy(_screenVGA, _screenLayer1, 46080);
+ _updateDialogue = &IgorEngine::PART_MARGARET_ROOM_CUTSCENE_UPDATE_DIALOGUE_MARGARET;
+ PART_MARGARET_ROOM_CUTSCENE_HELPER_1();
+ memset(_currentPalette, 0, 768);
+ fadeInPalette(768);
+ _gameState.igorMoving = false;
+ switch (VAR_MARGARET_ROOM_ANIM_COUNTER) {
+ case 1:
+ ADD_DIALOGUE_TEXT(223, 1);
+ ADD_DIALOGUE_TEXT(224, 1);
+ ADD_DIALOGUE_TEXT(225, 1);
+ break;
+ case 2:
+ ADD_DIALOGUE_TEXT(201, 1);
+ ADD_DIALOGUE_TEXT(202, 1);
+ ADD_DIALOGUE_TEXT(203, 1);
+ break;
+ case 3:
+ ADD_DIALOGUE_TEXT(204, 1);
+ ADD_DIALOGUE_TEXT(205, 1);
+ ADD_DIALOGUE_TEXT(206, 1);
+ break;
+ case 4:
+ ADD_DIALOGUE_TEXT(207, 1);
+ ADD_DIALOGUE_TEXT(208, 1);
+ ADD_DIALOGUE_TEXT(209, 1);
+ break;
+ case 5:
+ ADD_DIALOGUE_TEXT(210, 1);
+ ADD_DIALOGUE_TEXT(211, 1);
+ ADD_DIALOGUE_TEXT(212, 1);
+ break;
+ case 6:
+ ADD_DIALOGUE_TEXT(213, 2);
+ ADD_DIALOGUE_TEXT(215, 1);
+ ADD_DIALOGUE_TEXT(216, 1);
+ break;
+ case 7:
+ ADD_DIALOGUE_TEXT(217, 1);
+ ADD_DIALOGUE_TEXT(218, 1);
+ ADD_DIALOGUE_TEXT(219, 1);
+ break;
+ case 8:
+ ADD_DIALOGUE_TEXT(220, 1);
+ ADD_DIALOGUE_TEXT(221, 1);
+ ADD_DIALOGUE_TEXT(222, 1);
+ break;
+ }
+ SET_DIALOGUE_TEXT(1, 3);
+ startCutsceneDialogue(200, 73, 63, 32, 0);
+ waitForEndOfCutsceneDialogue(200, 73, 63, 32, 0);
+ waitForTimer(255);
+ _updateDialogue = 0;
+ ++_objectsState[110];
+ memcpy(_paletteBuffer, _currentPalette, 768);
+ fadeOutPalette(768);
+ memset(_screenVGA, 0, 46080);
+ if (_objectsState[110] < 9 && _currentPart != 331) {
+ setupDefaultPalette();
+ SET_PAL_240_48_1();
+ SET_PAL_208_96_1();
+ drawVerbsPanel();
+ drawInventory(_inventoryInfo[72], 0);
+ }
+}
+
+void IgorEngine::PART_UPDATE_FIGURES_ON_PAPER(int delay) {
+ uint8 *framesData = loadData(FRM_NumbersPaper1);
+ uint8 *framesOffsets = loadData(FRM_NumbersPaper2);
+ for (int i = 1; i <= 20; ++i) {
+ const uint8 *p = framesData + READ_LE_UINT16(framesOffsets + (i - 1) * 2) - 1;
+ decodeAnimFrame(p, _screenVGA, true);
+ waitForTimer(delay);
+ }
+ free(framesData);
+ free(framesOffsets);
+}
+
+void IgorEngine::PART_MAIN() {
+ SET_EXEC_ACTION_FUNC(0, &IgorEngine::EXEC_MAIN_ACTION);
+ memset(_objectsState, 0, 112);
+ _objectsState[21] = 1;
+ _objectsState[49] = 1;
+ memset(_inventoryInfo, 0, 36);
+ _inventoryInfo[0] = 1; // ordering
+ _inventoryInfo[1] = 2;
+ _inventoryInfo[2] = 4;
+ _inventoryInfo[36] = 1;
+ _inventoryInfo[37] = 2;
+ _inventoryInfo[39] = 3;
+ _inventoryInfo[72] = 1; // first object
+ _inventoryInfo[73] = 3; // last object
+ UPDATE_OBJECT_STATE(255);
+ if (_currentPart != kStartupPart) { // boot param
+ SET_PAL_208_96_1();
+ SET_PAL_240_48_1();
+ drawVerbsPanel();
+ drawInventory(1, 0);
+ }
+ do {
+ debug(kDebugGame, "PART_MAIN _currentPart %d", _currentPart);
+ switch (_currentPart) {
+ case 40:
+ PART_04();
+ break;
+ case 50:
+ case 51:
+ case 52:
+ PART_05();
+ break;
+ case 60:
+ case 61:
+ case 62:
+ PART_06();
+ break;
+ case 120:
+ case 121:
+ case 122:
+ PART_12();
+ break;
+ case 130:
+ case 131:
+ PART_13();
+ break;
+ case 140:
+ case 141:
+ case 142:
+ PART_14();
+ break;
+ case 150:
+ PART_15();
+ break;
+ case 160:
+ PART_16();
+ break;
+ case 170:
+ case 171:
+ PART_17();
+ break;
+ case 180:
+ case 181:
+ PART_18();
+ break;
+ case 190:
+ case 191:
+ PART_19();
+ break;
+ case 210:
+ case 211:
+ case 212:
+ PART_21();
+ break;
+ case 220:
+ case 221:
+ PART_22();
+ break;
+ case 230:
+ case 231:
+ case 232:
+ PART_23();
+ break;
+ case 240:
+ case 241:
+ case 242:
+ PART_24();
+ break;
+ case 250:
+ case 251:
+ case 252:
+ PART_25();
+ break;
+ case 260:
+ case 261:
+ PART_26();
+ break;
+ case 270:
+ case 271:
+ PART_27();
+ break;
+ case 280:
+ case 281:
+ PART_28();
+ break;
+ case 300:
+ case 301:
+ case 302:
+ case 303:
+ PART_30();
+ break;
+ case 310:
+ case 311:
+ case 312:
+ case 313:
+ PART_31();
+ break;
+ case 330:
+ case 331:
+ PART_33();
+ break;
+ case 360:
+ PART_36();
+ break;
+ case 370:
+ PART_37();
+ break;
+ case 750:
+ PART_75();
+ break;
+ case 850:
+ memset(_screenVGA, 0, 64000);
+ _screenVGAVOffset = 24;
+ _system->copyRectToScreen(_screenVGA, 320, 0, 0, 320, _screenVGAVOffset);
+ PART_85();
+ memset(_screenVGA + 46080, 0, 17920);
+ _nextTimer = _system->getMillis() + 1000 / 60;
+ for (int y = _screenVGAVOffset; y >= 0; --y) {
+ _system->copyRectToScreen(_screenVGA, 320, 0, y, 320, 145);
+ _system->updateScreen();
+ int diff = _nextTimer - _system->getMillis();
+ if (diff > 0) {
+ _system->delayMillis(diff);
+ }
+ _nextTimer = _system->getMillis() + 1000 / 60;
+ }
+ _screenVGAVOffset = 0;
+ _inputVars[kInputCursorXPos] = 160;
+ _inputVars[kInputCursorYPos] = 72;
+ _system->warpMouse(_inputVars[kInputCursorXPos], _inputVars[kInputCursorYPos]);
+ break;
+ case 900:
+ case 901:
+ case 902:
+ case 903:
+ case 904:
+ PART_90();
+ break;
+ default:
+ warning("PART_MAIN() Unhandled part %d", _currentPart);
+ _currentPart = 255;
+ break;
+ }
+ if (_currentPart >= 10) {
+ if (_currentPart <= 24 || _currentPart == 51) {
+ continue;
+ }
+ if (_currentPart == 60 || _currentPart == 102 || _currentPart == 110) {
+ continue;
+ }
+ }
+ if (_currentPart == 340 || _currentPart == 351 || _currentPart == 750) {
+ continue;
+ }
+ if (_currentPart == 122 || _currentPart == 255) {
+ continue;
+ }
+ if (_objectsState[110] < 1 || _objectsState[110] > 7) {
+ continue;
+ }
+ if (_gameState.nextMusicCounter != 5) {
+ ++_gameState.nextMusicCounter;
+ } else {
+ if (_gameState.musicNum != 11) {
+ _previousMusic = _gameState.musicNum;
+ playMusic(11);
+ }
+ PART_MEANWHILE();
+ PART_MARGARET_ROOM_CUTSCENE();
+ if (_previousMusic != 11) {
+ playMusic(_previousMusic);
+ }
+ _gameState.nextMusicCounter = 0;
+ }
+ } while (_currentPart != 255 && !_eventQuitGame);
+ for (_currentPart = 950; _currentPart <= 956 && !_eventQuitGame; ++_currentPart) {
+ PART_95();
+ }
+}
+
+} // namespace Igor