aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/gui.cpp243
-rw-r--r--engines/kyra/items.cpp32
-rw-r--r--engines/kyra/kyra.cpp60
-rw-r--r--engines/kyra/scene.cpp488
-rw-r--r--engines/kyra/script.cpp258
-rw-r--r--engines/kyra/script_v1.cpp156
-rw-r--r--engines/kyra/sequences_v1.cpp771
-rw-r--r--engines/kyra/text.cpp15
8 files changed, 1008 insertions, 1015 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index c287fbea64..c1ac512922 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -156,64 +156,64 @@ int KyraEngine::buttonAmuletCallback(Button *caller) {
_unkAmuletVar = 1;
switch (jewel-1) {
- case 0:
- if (_brandonStatusBit & 1) {
- seq_brandonHealing2();
- } else if (_brandonStatusBit == 0) {
- seq_brandonHealing();
- assert(_healingTip);
- if (_features & GF_TALKIE) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2003);
- }
- characterSays(_healingTip[0], 0, -2);
+ case 0:
+ if (_brandonStatusBit & 1) {
+ seq_brandonHealing2();
+ } else if (_brandonStatusBit == 0) {
+ seq_brandonHealing();
+ assert(_healingTip);
+ if (_features & GF_TALKIE) {
+ snd_voiceWaitForFinish();
+ snd_playVoiceFile(2003);
}
- break;
-
- case 1:
- seq_makeBrandonInv();
- break;
+ characterSays(_healingTip[0], 0, -2);
+ }
+ break;
- case 2:
- if (_brandonStatusBit & 1) {
- assert(_wispJewelStrings);
- if (_features & GF_TALKIE) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2004);
- }
- characterSays(_wispJewelStrings[0], 0, -2);
+ case 1:
+ seq_makeBrandonInv();
+ break;
+
+ case 2:
+ if (_brandonStatusBit & 1) {
+ assert(_wispJewelStrings);
+ if (_features & GF_TALKIE) {
+ snd_voiceWaitForFinish();
+ snd_playVoiceFile(2004);
+ }
+ characterSays(_wispJewelStrings[0], 0, -2);
+ } else {
+ if (_brandonStatusBit & 2) {
+ // XXX
+ seq_makeBrandonNormal2();
+ // XXX
} else {
- if (_brandonStatusBit & 2) {
- // XXX
- seq_makeBrandonNormal2();
- // XXX
+ // do not check for item in hand again as in the original since some strings are missing
+ // in the cd version
+ if (_currentCharacter->sceneId >= 109 && _currentCharacter->sceneId <= 198) {
+ snd_playWanderScoreViaMap(1, 0);
+ seq_makeBrandonWisp();
+ snd_playWanderScoreViaMap(17, 0);
} else {
- // do not check for item in hand again as in the original since some strings are missing
- // in the cd version
- if (_currentCharacter->sceneId >= 109 && _currentCharacter->sceneId <= 198) {
- snd_playWanderScoreViaMap(1, 0);
- seq_makeBrandonWisp();
- snd_playWanderScoreViaMap(17, 0);
- } else {
- seq_makeBrandonWisp();
- }
- setGameFlag(0x9E);
+ seq_makeBrandonWisp();
}
+ setGameFlag(0x9E);
}
- break;
-
- case 3:
- seq_dispelMagicAnimation();
- assert(_magicJewelString);
- if (_features & GF_TALKIE) {
- snd_voiceWaitForFinish();
- snd_playVoiceFile(2007);
- }
- characterSays(_magicJewelString[0], 0, -2);
- break;
+ }
+ break;
+
+ case 3:
+ seq_dispelMagicAnimation();
+ assert(_magicJewelString);
+ if (_features & GF_TALKIE) {
+ snd_voiceWaitForFinish();
+ snd_playVoiceFile(2007);
+ }
+ characterSays(_magicJewelString[0], 0, -2);
+ break;
- default:
- break;
+ default:
+ break;
}
_unkAmuletVar = 0;
// XXX clearKyrandiaButtonIO (!used before every return in this function!)
@@ -709,36 +709,36 @@ void KyraEngine::gui_getInput() {
_mouseWheel = 0;
while (_system->pollEvent(event)) {
switch (event.type) {
- case OSystem::EVENT_QUIT:
- quitGame();
- break;
- case OSystem::EVENT_LBUTTONDOWN:
- _mousePressFlag = true;
- break;
- case OSystem::EVENT_LBUTTONUP:
- _mousePressFlag = false;
- break;
- case OSystem::EVENT_MOUSEMOVE:
- _mouseX = event.mouse.x;
- _mouseY = event.mouse.y;
- _system->updateScreen();
- break;
- case OSystem::EVENT_WHEELUP:
- _mouseWheel = -1;
- break;
- case OSystem::EVENT_WHEELDOWN:
- _mouseWheel = 1;
- break;
- case OSystem::EVENT_KEYDOWN:
- _keyboardEvent.pending = true;
- _keyboardEvent.repeat = now + 400;
- _keyboardEvent.ascii = event.kbd.ascii;
- break;
- case OSystem::EVENT_KEYUP:
- _keyboardEvent.repeat = 0;
- break;
- default:
- break;
+ case OSystem::EVENT_QUIT:
+ quitGame();
+ break;
+ case OSystem::EVENT_LBUTTONDOWN:
+ _mousePressFlag = true;
+ break;
+ case OSystem::EVENT_LBUTTONUP:
+ _mousePressFlag = false;
+ break;
+ case OSystem::EVENT_MOUSEMOVE:
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
+ _system->updateScreen();
+ break;
+ case OSystem::EVENT_WHEELUP:
+ _mouseWheel = -1;
+ break;
+ case OSystem::EVENT_WHEELDOWN:
+ _mouseWheel = 1;
+ break;
+ case OSystem::EVENT_KEYDOWN:
+ _keyboardEvent.pending = true;
+ _keyboardEvent.repeat = now + 400;
+ _keyboardEvent.ascii = event.kbd.ascii;
+ break;
+ case OSystem::EVENT_KEYUP:
+ _keyboardEvent.repeat = 0;
+ break;
+ default:
+ break;
}
}
@@ -1127,23 +1127,24 @@ void KyraEngine::gui_setupControls(Menu &menu) {
switch (_configWalkspeed) {
- case 0:
- menu.item[2].itemString = _configStrings[0]; //"Slowest"
- break;
- case 1:
- menu.item[2].itemString = _configStrings[1]; //"Slow"
- break;
- case 2:
- menu.item[2].itemString = _configStrings[2]; //"Normal"
- break;
- case 3:
- menu.item[2].itemString = _configStrings[3]; //"Fast"
- break;
- case 4:
- menu.item[2].itemString = _configStrings[4]; //"Fastest"
- break;
- default:
- menu.item[2].itemString = "ERROR";
+ case 0:
+ menu.item[2].itemString = _configStrings[0]; //"Slowest"
+ break;
+ case 1:
+ menu.item[2].itemString = _configStrings[1]; //"Slow"
+ break;
+ case 2:
+ menu.item[2].itemString = _configStrings[2]; //"Normal"
+ break;
+ case 3:
+ menu.item[2].itemString = _configStrings[3]; //"Fast"
+ break;
+ case 4:
+ menu.item[2].itemString = _configStrings[4]; //"Fastest"
+ break;
+ default:
+ menu.item[2].itemString = "ERROR";
+ break;
}
int textControl = 3;
@@ -1158,35 +1159,37 @@ void KyraEngine::gui_setupControls(Menu &menu) {
_menu[5].item[4].enabled = 0;
switch (_configVoice) {
- case 0:
- menu.item[3].itemString = _configStrings[5]; //"Text only"
- break;
- case 1:
- menu.item[3].itemString = _configStrings[6]; //"Voice & Text"
- break;
- case 2:
- menu.item[3].itemString = _configStrings[7]; //"Voice only"
- break;
- default:
- menu.item[3].itemString = "ERROR";
- }
- }
-
- switch (_configTextspeed) {
case 0:
- menu.item[textControl].itemString = _configStrings[1]; //"Slow"
+ menu.item[3].itemString = _configStrings[5]; //"Text only"
break;
case 1:
- menu.item[textControl].itemString = _configStrings[2]; //"Normal"
+ menu.item[3].itemString = _configStrings[6]; //"Voice & Text"
break;
case 2:
- menu.item[textControl].itemString = _configStrings[3]; //"Fast"
- break;
- case 3:
- menu.item[textControl].itemString = _configStrings[clickableOffset]; //"Clickable"
+ menu.item[3].itemString = _configStrings[7]; //"Voice only"
break;
default:
- menu.item[textControl].itemString = "ERROR";
+ menu.item[3].itemString = "ERROR";
+ break;
+ }
+ }
+
+ switch (_configTextspeed) {
+ case 0:
+ menu.item[textControl].itemString = _configStrings[1]; //"Slow"
+ break;
+ case 1:
+ menu.item[textControl].itemString = _configStrings[2]; //"Normal"
+ break;
+ case 2:
+ menu.item[textControl].itemString = _configStrings[3]; //"Fast"
+ break;
+ case 3:
+ menu.item[textControl].itemString = _configStrings[clickableOffset]; //"Clickable"
+ break;
+ default:
+ menu.item[textControl].itemString = "ERROR";
+ break;
}
diff --git a/engines/kyra/items.cpp b/engines/kyra/items.cpp
index e04f59898b..655d2a2ddd 100644
--- a/engines/kyra/items.cpp
+++ b/engines/kyra/items.cpp
@@ -136,24 +136,24 @@ void KyraEngine::placeItemInGenericMapScene(int item, int index) {
bool placeItem = false;
switch (nameIndex) {
- case 0: case 1: case 2: case 3:
- case 4: case 5: case 6: case 11:
- case 12: case 16: case 17: case 20:
- case 22: case 23: case 25: case 26:
- case 27: case 31: case 33: case 34:
- case 36: case 37: case 58: case 59:
- case 60: case 61: case 83: case 84:
- case 85: case 104: case 105: case 106:
- placeItem = true;
+ case 0: case 1: case 2: case 3:
+ case 4: case 5: case 6: case 11:
+ case 12: case 16: case 17: case 20:
+ case 22: case 23: case 25: case 26:
+ case 27: case 31: case 33: case 34:
+ case 36: case 37: case 58: case 59:
+ case 60: case 61: case 83: case 84:
+ case 85: case 104: case 105: case 106:
+ placeItem = true;
break;
- case 51:
- if (room != 46) {
- placeItem = true;
- break;
- }
- default:
- placeItem = false;
+ case 51:
+ if (room != 46) {
+ placeItem = true;
+ break;
+ }
+ default:
+ placeItem = false;
break;
}
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp
index 5c5b226631..904f8475cd 100644
--- a/engines/kyra/kyra.cpp
+++ b/engines/kyra/kyra.cpp
@@ -935,36 +935,36 @@ void KyraEngine::updateMousePointer(bool forceUpdate) {
if (_mouseX >= _entranceMouseCursorTracks[0] && _mouseY >= _entranceMouseCursorTracks[1]
&& _mouseX <= _entranceMouseCursorTracks[2] && _mouseY <= _entranceMouseCursorTracks[3]) {
switch (_entranceMouseCursorTracks[4]) {
- case 0:
- newMouseState = -6;
- shape = 2;
- newX = 5;
- newY = 1;
- break;
-
- case 2:
- newMouseState = -5;
- shape = 3;
- newX = 7;
- newY = 5;
- break;
-
- case 4:
- newMouseState = -4;
- shape = 4;
- newX = 5;
- newY = 7;
- break;
-
- case 6:
- newMouseState = -3;
- shape = 5;
- newX = 1;
- newY = 5;
- break;
-
- default:
- break;
+ case 0:
+ newMouseState = -6;
+ shape = 2;
+ newX = 5;
+ newY = 1;
+ break;
+
+ case 2:
+ newMouseState = -5;
+ shape = 3;
+ newX = 7;
+ newY = 5;
+ break;
+
+ case 4:
+ newMouseState = -4;
+ shape = 4;
+ newX = 5;
+ newY = 7;
+ break;
+
+ case 6:
+ newMouseState = -3;
+ shape = 5;
+ newX = 1;
+ newY = 5;
+ break;
+
+ default:
+ break;
}
}
diff --git a/engines/kyra/scene.cpp b/engines/kyra/scene.cpp
index 6d81993aed..9933a7267a 100644
--- a/engines/kyra/scene.cpp
+++ b/engines/kyra/scene.cpp
@@ -64,35 +64,35 @@ void KyraEngine::enterNewScene(int sceneId, int facing, int unk1, int unk2, int
}*/
switch (_currentCharacter->sceneId) {
- case 1:
- if (sceneId == 0) {
- moveCharacterToPos(0, 0, _currentCharacter->x1, 84);
- unkVar1 = 0;
- }
+ case 1:
+ if (sceneId == 0) {
+ moveCharacterToPos(0, 0, _currentCharacter->x1, 84);
+ unkVar1 = 0;
+ }
break;
-
- case 3:
- if (sceneId == 2) {
- moveCharacterToPos(0, 6, 155, _currentCharacter->y1);
- unkVar1 = 0;
- }
+
+ case 3:
+ if (sceneId == 2) {
+ moveCharacterToPos(0, 6, 155, _currentCharacter->y1);
+ unkVar1 = 0;
+ }
break;
-
- case 26:
- if (sceneId == 27) {
- moveCharacterToPos(0, 6, 155, _currentCharacter->y1);
- unkVar1 = 0;
- }
+
+ case 26:
+ if (sceneId == 27) {
+ moveCharacterToPos(0, 6, 155, _currentCharacter->y1);
+ unkVar1 = 0;
+ }
break;
-
- case 44:
- if (sceneId == 45) {
- moveCharacterToPos(0, 2, 192, _currentCharacter->y1);
- unkVar1 = 0;
- }
+
+ case 44:
+ if (sceneId == 45) {
+ moveCharacterToPos(0, 2, 192, _currentCharacter->y1);
+ unkVar1 = 0;
+ }
break;
-
- default:
+
+ default:
break;
}
@@ -100,23 +100,23 @@ void KyraEngine::enterNewScene(int sceneId, int facing, int unk1, int unk2, int
int xpos = _currentCharacter->x1;
int ypos = _currentCharacter->y1;
switch (facing) {
- case 0:
- ypos = _currentCharacter->y1 - 6;
+ case 0:
+ ypos = _currentCharacter->y1 - 6;
break;
-
- case 2:
- xpos = 336;
+
+ case 2:
+ xpos = 336;
break;
-
- case 4:
- ypos = 143;
+
+ case 4:
+ ypos = 143;
break;
-
- case 6:
- xpos = -16;
+
+ case 6:
+ xpos = -16;
break;
-
- default:
+
+ default:
break;
}
@@ -248,40 +248,40 @@ void KyraEngine::moveCharacterToPos(int character, int facing, int xpos, int ypo
disableTimer(18);
uint32 nextFrame = 0;
switch (facing) {
- case 0:
- while (ypos < ch->y1) {
- nextFrame = getTimerDelay(5 + character) * _tickLength + _system->getMillis();
- setCharacterPositionWithUpdate(character);
- while (_system->getMillis() < nextFrame) { updateGameTimers(); }
- }
- break;
+ case 0:
+ while (ypos < ch->y1) {
+ nextFrame = getTimerDelay(5 + character) * _tickLength + _system->getMillis();
+ setCharacterPositionWithUpdate(character);
+ while (_system->getMillis() < nextFrame) { updateGameTimers(); }
+ }
+ break;
- case 2:
- while (ch->x1 < xpos) {
- nextFrame = getTimerDelay(5 + character) * _tickLength + _system->getMillis();
- setCharacterPositionWithUpdate(character);
- while (_system->getMillis() < nextFrame) { updateGameTimers(); }
- }
- break;
+ case 2:
+ while (ch->x1 < xpos) {
+ nextFrame = getTimerDelay(5 + character) * _tickLength + _system->getMillis();
+ setCharacterPositionWithUpdate(character);
+ while (_system->getMillis() < nextFrame) { updateGameTimers(); }
+ }
+ break;
- case 4:
- while (ypos > ch->y1) {
- nextFrame = getTimerDelay(5 + character) * _tickLength + _system->getMillis();
- setCharacterPositionWithUpdate(character);
- while (_system->getMillis() < nextFrame) { updateGameTimers(); }
- }
- break;
+ case 4:
+ while (ypos > ch->y1) {
+ nextFrame = getTimerDelay(5 + character) * _tickLength + _system->getMillis();
+ setCharacterPositionWithUpdate(character);
+ while (_system->getMillis() < nextFrame) { updateGameTimers(); }
+ }
+ break;
- case 6:
- while (ch->x1 > xpos) {
- nextFrame = getTimerDelay(5 + character) * _tickLength + _system->getMillis();
- setCharacterPositionWithUpdate(character);
- while (_system->getMillis() < nextFrame) { updateGameTimers(); }
- }
- break;
+ case 6:
+ while (ch->x1 > xpos) {
+ nextFrame = getTimerDelay(5 + character) * _tickLength + _system->getMillis();
+ setCharacterPositionWithUpdate(character);
+ while (_system->getMillis() < nextFrame) { updateGameTimers(); }
+ }
+ break;
- default:
- break;
+ default:
+ break;
}
enableTimer(19);
enableTimer(14);
@@ -418,36 +418,22 @@ void KyraEngine::setCharacterPositionHelper(int character, int *facingTable) {
int KyraEngine::getOppositeFacingDirection(int dir) {
debugC(9, kDebugLevelMain, "KyraEngine::getOppositeFacingDirection(%d)", dir);
switch (dir) {
- case 0:
- return 2;
- break;
-
- case 1:
- return 1;
- break;
-
- case 3:
- return 7;
- break;
-
- case 4:
- return 6;
- break;
-
- case 5:
- return 5;
- break;
-
- case 6:
- return 4;
- break;
-
- case 7:
- return 3;
- break;
-
- default:
- break;
+ case 0:
+ return 2;
+ case 1:
+ return 1;
+ case 3:
+ return 7;
+ case 4:
+ return 6;
+ case 5:
+ return 5;
+ case 6:
+ return 4;
+ case 7:
+ return 3;
+ default:
+ break;
}
return 0;
}
@@ -506,32 +492,32 @@ void KyraEngine::initSceneData(int facing, int unk1, int brandonAlive) {
int16 xpos = 0, ypos = 0;
if (_brandonPosX == -1 && _brandonPosY == -1) {
- switch (facing+1) {
- case 0:
- xpos = ypos = -1;
+ switch (facing + 1) {
+ case 0:
+ xpos = ypos = -1;
break;
-
- case 1: case 2: case 8:
- xpos = _sceneExits.southXPos;
- ypos = _sceneExits.southYPos;
- break;
-
- case 3:
- xpos = _sceneExits.westXPos;
- ypos = _sceneExits.westYPos;
- break;
-
- case 4: case 5: case 6:
- xpos = _sceneExits.northXPos;
- ypos = _sceneExits.northYPos;
- break;
-
- case 7:
- xpos = _sceneExits.eastXPos;
- ypos = _sceneExits.eastYPos;
- break;
-
- default:
+
+ case 1: case 2: case 8:
+ xpos = _sceneExits.southXPos;
+ ypos = _sceneExits.southYPos;
+ break;
+
+ case 3:
+ xpos = _sceneExits.westXPos;
+ ypos = _sceneExits.westYPos;
+ break;
+
+ case 4: case 5: case 6:
+ xpos = _sceneExits.northXPos;
+ ypos = _sceneExits.northYPos;
+ break;
+
+ case 7:
+ xpos = _sceneExits.eastXPos;
+ ypos = _sceneExits.eastYPos;
+ break;
+
+ default:
break;
}
@@ -559,68 +545,68 @@ void KyraEngine::initSceneData(int facing, int unk1, int brandonAlive) {
int16 ypos2 = 0;
if (_brandonPosX > -1 && _brandonPosY > -1) {
switch (_currentCharacter->sceneId) {
- case 1:
- _currentCharacter->x1 = xpos;
- _currentCharacter->x2 = xpos;
- _currentCharacter->y1 = ypos;
- _currentCharacter->y2 = ypos;
- facing = 4;
- xpos2 = 192;
- ypos2 = 104;
- setFacing = 0;
- unk1 = 1;
- break;
-
- case 3:
- _currentCharacter->x1 = xpos;
- _currentCharacter->x2 = xpos;
- _currentCharacter->y1 = ypos;
- _currentCharacter->y2 = ypos;
- facing = 2;
- xpos2 = 204;
- ypos2 = 94;
- setFacing = 0;
- unk1 = 1;
- break;
-
- case 26:
- _currentCharacter->x1 = xpos;
- _currentCharacter->x2 = xpos;
- _currentCharacter->y1 = ypos;
- _currentCharacter->y2 = ypos;
- facing = 2;
- xpos2 = 192;
- ypos2 = 128;
- setFacing = 0;
- unk1 = 1;
- break;
-
- case 44:
- _currentCharacter->x1 = xpos;
- _currentCharacter->x2 = xpos;
- _currentCharacter->y1 = ypos;
- _currentCharacter->y2 = ypos;
- facing = 6;
- xpos2 = 156;
- ypos2 = 96;
- setFacing = 0;
- unk1 = 1;
- break;
-
- case 37:
- _currentCharacter->x1 = xpos;
- _currentCharacter->x2 = xpos;
- _currentCharacter->y1 = ypos;
- _currentCharacter->y2 = ypos;
- facing = 2;
- xpos2 = 148;
- ypos2 = 114;
- setFacing = 0;
- unk1 = 1;
- break;
-
- default:
- break;
+ case 1:
+ _currentCharacter->x1 = xpos;
+ _currentCharacter->x2 = xpos;
+ _currentCharacter->y1 = ypos;
+ _currentCharacter->y2 = ypos;
+ facing = 4;
+ xpos2 = 192;
+ ypos2 = 104;
+ setFacing = 0;
+ unk1 = 1;
+ break;
+
+ case 3:
+ _currentCharacter->x1 = xpos;
+ _currentCharacter->x2 = xpos;
+ _currentCharacter->y1 = ypos;
+ _currentCharacter->y2 = ypos;
+ facing = 2;
+ xpos2 = 204;
+ ypos2 = 94;
+ setFacing = 0;
+ unk1 = 1;
+ break;
+
+ case 26:
+ _currentCharacter->x1 = xpos;
+ _currentCharacter->x2 = xpos;
+ _currentCharacter->y1 = ypos;
+ _currentCharacter->y2 = ypos;
+ facing = 2;
+ xpos2 = 192;
+ ypos2 = 128;
+ setFacing = 0;
+ unk1 = 1;
+ break;
+
+ case 44:
+ _currentCharacter->x1 = xpos;
+ _currentCharacter->x2 = xpos;
+ _currentCharacter->y1 = ypos;
+ _currentCharacter->y2 = ypos;
+ facing = 6;
+ xpos2 = 156;
+ ypos2 = 96;
+ setFacing = 0;
+ unk1 = 1;
+ break;
+
+ case 37:
+ _currentCharacter->x1 = xpos;
+ _currentCharacter->x2 = xpos;
+ _currentCharacter->y1 = ypos;
+ _currentCharacter->y2 = ypos;
+ facing = 2;
+ xpos2 = 148;
+ ypos2 = 114;
+ setFacing = 0;
+ unk1 = 1;
+ break;
+
+ default:
+ break;
}
}
@@ -630,24 +616,24 @@ void KyraEngine::initSceneData(int facing, int unk1, int brandonAlive) {
ypos2 = ypos;
xpos2 = xpos;
switch (facing) {
- case 0:
- ypos = 142;
- break;
-
- case 2:
- xpos = -16;
- break;
-
- case 4:
- ypos = (uint8)(_northExitHeight & 0xFF) - 4;
- break;
-
- case 6:
- xpos = 336;
- break;
-
- default:
- break;
+ case 0:
+ ypos = 142;
+ break;
+
+ case 2:
+ xpos = -16;
+ break;
+
+ case 4:
+ ypos = (uint8)(_northExitHeight & 0xFF) - 4;
+ break;
+
+ case 6:
+ xpos = 336;
+ break;
+
+ default:
+ break;
}
}
@@ -961,21 +947,21 @@ int KyraEngine::processSceneChange(int *table, int unk1, int frameReset) {
}
bool forceContinue = false;
switch (*table) {
- case 0: case 1: case 2:
- case 3: case 4: case 5:
- case 6: case 7:
- _currentCharacter->facing = getOppositeFacingDirection(*table);
- break;
-
- case 8:
- forceContinue = true;
- running = false;
- break;
-
- default:
- ++table;
- forceContinue = true;
- break;
+ case 0: case 1: case 2:
+ case 3: case 4: case 5:
+ case 6: case 7:
+ _currentCharacter->facing = getOppositeFacingDirection(*table);
+ break;
+
+ case 8:
+ forceContinue = true;
+ running = false;
+ break;
+
+ default:
+ ++table;
+ forceContinue = true;
+ break;
}
returnValue = changeScene(_currentCharacter->facing);
@@ -1068,24 +1054,24 @@ int KyraEngine::changeScene(int facing) {
int unk2 = ptr[9];
if (sceneId == 0xFFFF) {
switch (facing) {
- case 0:
- sceneId = _roomTable[_currentCharacter->sceneId].northExit;
- break;
-
- case 2:
- sceneId = _roomTable[_currentCharacter->sceneId].eastExit;
- break;
-
- case 4:
- sceneId = _roomTable[_currentCharacter->sceneId].southExit;
- break;
-
- case 6:
- sceneId = _roomTable[_currentCharacter->sceneId].westExit;
- break;
-
- default:
- break;
+ case 0:
+ sceneId = _roomTable[_currentCharacter->sceneId].northExit;
+ break;
+
+ case 2:
+ sceneId = _roomTable[_currentCharacter->sceneId].eastExit;
+ break;
+
+ case 4:
+ sceneId = _roomTable[_currentCharacter->sceneId].southExit;
+ break;
+
+ case 6:
+ sceneId = _roomTable[_currentCharacter->sceneId].westExit;
+ break;
+
+ default:
+ break;
}
}
@@ -1126,21 +1112,21 @@ int KyraEngine::changeScene(int facing) {
uint16 sceneId = 0xFFFF;
switch (facing) {
- case 0:
- sceneId = _roomTable[_currentCharacter->sceneId].northExit;
- break;
-
- case 2:
- sceneId = _roomTable[_currentCharacter->sceneId].eastExit;
- break;
-
- case 4:
- sceneId = _roomTable[_currentCharacter->sceneId].southExit;
- break;
-
- default:
- sceneId = _roomTable[_currentCharacter->sceneId].westExit;
- break;
+ case 0:
+ sceneId = _roomTable[_currentCharacter->sceneId].northExit;
+ break;
+
+ case 2:
+ sceneId = _roomTable[_currentCharacter->sceneId].eastExit;
+ break;
+
+ case 4:
+ sceneId = _roomTable[_currentCharacter->sceneId].southExit;
+ break;
+
+ default:
+ sceneId = _roomTable[_currentCharacter->sceneId].westExit;
+ break;
}
if (sceneId == 0xFFFF)
diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp
index 70379a3827..2de0668e82 100644
--- a/engines/kyra/script.cpp
+++ b/engines/kyra/script.cpp
@@ -309,19 +309,19 @@ void ScriptHelper::c1_setRetValue(ScriptState* script) {
void ScriptHelper::c1_pushRetOrPos(ScriptState* script) {
switch (_parameter) {
- case 0:
- script->stack[--script->sp] = script->retValue;
+ case 0:
+ script->stack[--script->sp] = script->retValue;
break;
-
- case 1:
- script->stack[--script->sp] = (script->ip - script->dataPtr->data) / 2 + 1;
- script->stack[--script->sp] = script->bp;
- script->bp = script->sp + 2;
+
+ case 1:
+ script->stack[--script->sp] = (script->ip - script->dataPtr->data) / 2 + 1;
+ script->stack[--script->sp] = script->bp;
+ script->bp = script->sp + 2;
break;
-
- default:
- _continue = false;
- script->ip = 0;
+
+ default:
+ _continue = false;
+ script->ip = 0;
break;
}
}
@@ -344,23 +344,23 @@ void ScriptHelper::c1_pushBPAdd(ScriptState* script) {
void ScriptHelper::c1_popRetOrPos(ScriptState* script) {
switch (_parameter) {
- case 0:
- script->retValue = script->stack[script->sp++];
- break;
-
- case 1:
- if (script->sp >= 60) {
- _continue = false;
- script->ip = 0;
- } else {
- script->bp = script->stack[script->sp++];
- script->ip = script->dataPtr->data + (script->stack[script->sp++] << 1);
- }
+ case 0:
+ script->retValue = script->stack[script->sp++];
break;
-
- default:
+
+ case 1:
+ if (script->sp >= 60) {
_continue = false;
script->ip = 0;
+ } else {
+ script->bp = script->stack[script->sp++];
+ script->ip = script->dataPtr->data + (script->stack[script->sp++] << 1);
+ }
+ break;
+
+ default:
+ _continue = false;
+ script->ip = 0;
break;
}
}
@@ -404,24 +404,24 @@ void ScriptHelper::c1_ifNotJmp(ScriptState* script) {
void ScriptHelper::c1_negate(ScriptState* script) {
int16 value = script->stack[script->sp];
switch (_parameter) {
- case 0:
- if (!value) {
- script->stack[script->sp] = 1;
- } else {
- script->stack[script->sp] = 0;
- }
+ case 0:
+ if (!value) {
+ script->stack[script->sp] = 1;
+ } else {
+ script->stack[script->sp] = 0;
+ }
break;
-
- case 1:
- script->stack[script->sp] = -value;
+
+ case 1:
+ script->stack[script->sp] = -value;
break;
-
- case 2:
- script->stack[script->sp] = ~value;
+
+ case 2:
+ script->stack[script->sp] = ~value;
break;
-
- default:
- _continue = false;
+
+ default:
+ _continue = false;
break;
}
}
@@ -434,113 +434,113 @@ void ScriptHelper::c1_eval(ScriptState* script) {
int16 val2 = script->stack[script->sp++];
switch (_parameter) {
- case 0:
- if (!val2 || !val1) {
- ret = 0;
- } else {
- ret = 1;
- }
+ case 0:
+ if (!val2 || !val1) {
+ ret = 0;
+ } else {
+ ret = 1;
+ }
break;
-
- case 1:
- if (val2 || val1) {
- ret = 1;
- } else {
- ret = 0;
- }
+
+ case 1:
+ if (val2 || val1) {
+ ret = 1;
+ } else {
+ ret = 0;
+ }
break;
-
- case 2:
- if (val1 == val2) {
- ret = 1;
- } else {
- ret = 0;
- }
+
+ case 2:
+ if (val1 == val2) {
+ ret = 1;
+ } else {
+ ret = 0;
+ }
break;
-
- case 3:
- if (val1 != val2) {
- ret = 1;
- } else {
- ret = 0;
- }
+
+ case 3:
+ if (val1 != val2) {
+ ret = 1;
+ } else {
+ ret = 0;
+ }
break;
-
- case 4:
- if (val1 > val2) {
- ret = 1;
- } else {
- ret = 0;
- }
+
+ case 4:
+ if (val1 > val2) {
+ ret = 1;
+ } else {
+ ret = 0;
+ }
break;
-
- case 5:
- if (val1 >= val2) {
- ret = 1;
- } else {
- ret = 0;
- }
+
+ case 5:
+ if (val1 >= val2) {
+ ret = 1;
+ } else {
+ ret = 0;
+ }
break;
-
- case 6:
- if (val1 < val2) {
- ret = 1;
- } else {
- ret = 0;
- }
+
+ case 6:
+ if (val1 < val2) {
+ ret = 1;
+ } else {
+ ret = 0;
+ }
break;
-
- case 7:
- if (val1 <= val2) {
- ret = 1;
- } else {
- ret = 0;
- }
+
+ case 7:
+ if (val1 <= val2) {
+ ret = 1;
+ } else {
+ ret = 0;
+ }
break;
-
- case 8:
- ret = val1 + val2;
+
+ case 8:
+ ret = val1 + val2;
break;
-
- case 9:
- ret = val2 - val1;
+
+ case 9:
+ ret = val2 - val1;
break;
-
- case 10:
- ret = val1 * val2;
+
+ case 10:
+ ret = val1 * val2;
break;
-
- case 11:
- ret = val2 / val1;
+
+ case 11:
+ ret = val2 / val1;
break;
-
- case 12:
- ret = val2 >> val1;
+
+ case 12:
+ ret = val2 >> val1;
break;
-
- case 13:
- ret = val2 << val1;
+
+ case 13:
+ ret = val2 << val1;
break;
-
- case 14:
- ret = val1 & val2;
+
+ case 14:
+ ret = val1 & val2;
break;
-
- case 15:
- ret = val1 | val2;
+
+ case 15:
+ ret = val1 | val2;
break;
-
- case 16:
- ret = val2 % val1;
+
+ case 16:
+ ret = val2 % val1;
break;
-
- case 17:
- ret = val1 ^ val2;
+
+ case 17:
+ ret = val1 ^ val2;
break;
-
- default:
- warning("Unknown evaluate func: %d", _parameter);
- error = true;
+
+ default:
+ warning("Unknown evaluate func: %d", _parameter);
+ error = true;
break;
}
diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp
index 269ed3a6fc..f3e3acc2b1 100644
--- a/engines/kyra/script_v1.cpp
+++ b/engines/kyra/script_v1.cpp
@@ -301,24 +301,24 @@ int KyraEngine::cmd_sceneToDirection(ScriptState *script) {
Room *curRoom = &_roomTable[stackPos(0)];
uint16 returnValue = 0xFFFF;
switch (stackPos(1)) {
- case 0:
- returnValue = curRoom->northExit;
- break;
-
- case 2:
- returnValue = curRoom->eastExit;
- break;
-
- case 4:
- returnValue = curRoom->southExit;
- break;
-
- case 6:
- returnValue = curRoom->westExit;
- break;
-
- default:
- break;
+ case 0:
+ returnValue = curRoom->northExit;
+ break;
+
+ case 2:
+ returnValue = curRoom->eastExit;
+ break;
+
+ case 4:
+ returnValue = curRoom->southExit;
+ break;
+
+ case 6:
+ returnValue = curRoom->westExit;
+ break;
+
+ default:
+ break;
}
if (returnValue == 0xFFFF)
return -1;
@@ -991,46 +991,46 @@ int KyraEngine::cmd_walkCharacterToPoint(ScriptState *script) {
while (running) {
bool forceContinue = false;
switch (*curPos) {
- case 0:
- _characterList[character].facing = 2;
- break;
-
- case 1:
- _characterList[character].facing = 1;
- break;
-
- case 2:
- _characterList[character].facing = 0;
- break;
-
- case 3:
- _characterList[character].facing = 7;
- break;
-
- case 4:
- _characterList[character].facing = 6;
- break;
-
- case 5:
- _characterList[character].facing = 5;
- break;
-
- case 6:
- _characterList[character].facing = 4;
- break;
-
- case 7:
- _characterList[character].facing = 3;
- break;
-
- case 8:
- running = 0;
- break;
-
- default:
- ++curPos;
- forceContinue = true;
- break;
+ case 0:
+ _characterList[character].facing = 2;
+ break;
+
+ case 1:
+ _characterList[character].facing = 1;
+ break;
+
+ case 2:
+ _characterList[character].facing = 0;
+ break;
+
+ case 3:
+ _characterList[character].facing = 7;
+ break;
+
+ case 4:
+ _characterList[character].facing = 6;
+ break;
+
+ case 5:
+ _characterList[character].facing = 5;
+ break;
+
+ case 6:
+ _characterList[character].facing = 4;
+ break;
+
+ case 7:
+ _characterList[character].facing = 3;
+ break;
+
+ case 8:
+ running = 0;
+ break;
+
+ default:
+ ++curPos;
+ forceContinue = true;
+ break;
}
if (forceContinue || !running) {
@@ -1194,26 +1194,26 @@ int KyraEngine::cmd_setFireberryGlowPalette(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "cmd_setFireberryGlowPalette(%p) (%d)", (const void *)script, stackPos(0));
int palIndex = 0;
switch (stackPos(0)) {
- case 0x1E:
- palIndex = 9;
- break;
-
- case 0x1F:
- palIndex = 10;
- break;
-
- case 0x20:
- palIndex = 11;
- break;
-
- case 0x21:
- case -1:
- palIndex = 12;
- break;
-
- default:
- palIndex = 8;
- break;
+ case 0x1E:
+ palIndex = 9;
+ break;
+
+ case 0x1F:
+ palIndex = 10;
+ break;
+
+ case 0x20:
+ palIndex = 11;
+ break;
+
+ case 0x21:
+ case -1:
+ palIndex = 12;
+ break;
+
+ default:
+ palIndex = 8;
+ break;
}
if (_brandonStatusBit & 2) {
if (_currentCharacter->sceneId != 133 && _currentCharacter->sceneId != 137 &&
diff --git a/engines/kyra/sequences_v1.cpp b/engines/kyra/sequences_v1.cpp
index 323e1ccec1..2760455e95 100644
--- a/engines/kyra/sequences_v1.cpp
+++ b/engines/kyra/sequences_v1.cpp
@@ -254,21 +254,21 @@ void KyraEngine::seq_createAmuletJewel(int jewel, int page, int noSound, int dra
const uint16 *opcodes = 0;
switch (jewel - 1) {
- case 0:
- opcodes = specialJewelTable1;
- break;
+ case 0:
+ opcodes = specialJewelTable1;
+ break;
- case 1:
- opcodes = specialJewelTable2;
- break;
+ case 1:
+ opcodes = specialJewelTable2;
+ break;
- case 2:
- opcodes = specialJewelTable3;
- break;
+ case 2:
+ opcodes = specialJewelTable3;
+ break;
- case 3:
- opcodes = specialJewelTable4;
- break;
+ case 3:
+ opcodes = specialJewelTable4;
+ break;
}
if (opcodes) {
@@ -793,44 +793,44 @@ void KyraEngine::seq_playDrinkPotionAnim(int item, int unk2, int flags) {
uint8 red, green, blue;
switch (item) {
- case 60:
- case 61:
- red = 63;
- green = blue = 6;
- break;
- case 62:
- case 63:
- red = green = 0;
- blue = 67;
- break;
- case 64:
- case 65:
- red = 84;
- green = 78;
- blue = 14;
- break;
- case 66:
- red = blue = 0;
- green = 48;
- break;
- case 67:
- red = 100;
- green = 48;
- blue = 23;
- break;
- case 68:
- red = 73;
- green = 0;
- blue = 89;
- break;
- case 69:
- red = green = 73;
- blue = 86;
- break;
- default:
- red = 33;
- green = 66;
- blue = 100;
+ case 60:
+ case 61:
+ red = 63;
+ green = blue = 6;
+ break;
+ case 62:
+ case 63:
+ red = green = 0;
+ blue = 67;
+ break;
+ case 64:
+ case 65:
+ red = 84;
+ green = 78;
+ blue = 14;
+ break;
+ case 66:
+ red = blue = 0;
+ green = 48;
+ break;
+ case 67:
+ red = 100;
+ green = 48;
+ blue = 23;
+ break;
+ case 68:
+ red = 73;
+ green = 0;
+ blue = 89;
+ break;
+ case 69:
+ red = green = 73;
+ blue = 86;
+ break;
+ default:
+ red = 33;
+ green = 66;
+ blue = 100;
}
red = (uint8)((double)red * 0.63);
green = (uint8)((double)green * 0.63);
@@ -1162,107 +1162,79 @@ int KyraEngine::handleMalcolmFlag() {
static uint32 timer2 = 0;
switch (_malcolmFlag) {
- case 1:
- frame = 0;
- _malcolmFlag = 2;
- timer2 = 0;
- case 2:
- if (_system->getMillis() >= timer2) {
- _finalA->_x = 8;
- _finalA->_y = 46;
- _finalA->_drawPage = 0;
- _finalA->displayFrame(frame);
- _screen->updateScreen();
- timer2 = _system->getMillis() + 8 * _tickLength;
- ++frame;
- if (frame > 13) {
- _malcolmFlag = 3;
- timer1 = _system->getMillis() + 180 * _tickLength;
- }
- }
- break;
-
- case 3:
- if (_system->getMillis() < timer1) {
- if (_system->getMillis() >= timer2) {
- frame = _rnd.getRandomNumberRng(14, 17);
- _finalA->_x = 8;
- _finalA->_y = 46;
- _finalA->_drawPage = 0;
- _finalA->displayFrame(frame);
- _screen->updateScreen();
- timer2 = _system->getMillis() + 8 * _tickLength;
- }
- } else {
- _malcolmFlag = 4;
- frame = 18;
+ case 1:
+ frame = 0;
+ _malcolmFlag = 2;
+ timer2 = 0;
+ case 2:
+ if (_system->getMillis() >= timer2) {
+ _finalA->_x = 8;
+ _finalA->_y = 46;
+ _finalA->_drawPage = 0;
+ _finalA->displayFrame(frame);
+ _screen->updateScreen();
+ timer2 = _system->getMillis() + 8 * _tickLength;
+ ++frame;
+ if (frame > 13) {
+ _malcolmFlag = 3;
+ timer1 = _system->getMillis() + 180 * _tickLength;
}
- break;
+ }
+ break;
- case 4:
+ case 3:
+ if (_system->getMillis() < timer1) {
if (_system->getMillis() >= timer2) {
+ frame = _rnd.getRandomNumberRng(14, 17);
_finalA->_x = 8;
_finalA->_y = 46;
_finalA->_drawPage = 0;
_finalA->displayFrame(frame);
_screen->updateScreen();
timer2 = _system->getMillis() + 8 * _tickLength;
- ++frame;
- if (frame > 25) {
- frame = 26;
- _malcolmFlag = 5;
- _beadStateVar = 1;
- }
}
- break;
+ } else {
+ _malcolmFlag = 4;
+ frame = 18;
+ }
+ break;
- case 5:
- if (_system->getMillis() >= timer2) {
- _finalA->_x = 8;
- _finalA->_y = 46;
- _finalA->_drawPage = 0;
- _finalA->displayFrame(frame);
- _screen->updateScreen();
- timer2 = _system->getMillis() + 8 * _tickLength;
- ++frame;
- if (frame > 31) {
- frame = 32;
- _malcolmFlag = 6;
- }
- }
- break;
-
- case 6:
- if (_unkEndSeqVar4) {
- if (frame <= 33 && _system->getMillis() >= timer2) {
- _finalA->_x = 8;
- _finalA->_y = 46;
- _finalA->_drawPage = 0;
- _finalA->displayFrame(frame);
- _screen->updateScreen();
- timer2 = _system->getMillis() + 8 * _tickLength;
- ++frame;
- if (frame > 33) {
- _malcolmFlag = 7;
- frame = 32;
- _unkEndSeqVar5 = 0;
- }
- }
+ case 4:
+ if (_system->getMillis() >= timer2) {
+ _finalA->_x = 8;
+ _finalA->_y = 46;
+ _finalA->_drawPage = 0;
+ _finalA->displayFrame(frame);
+ _screen->updateScreen();
+ timer2 = _system->getMillis() + 8 * _tickLength;
+ ++frame;
+ if (frame > 25) {
+ frame = 26;
+ _malcolmFlag = 5;
+ _beadStateVar = 1;
}
- break;
+ }
+ break;
- case 7:
- if (_unkEndSeqVar5 == 1) {
- _malcolmFlag = 8;
- frame = 34;
- } else if (_unkEndSeqVar5 == 2) {
- _malcolmFlag = 3;
- timer1 = _system->getMillis() + 180 * _tickLength;
+ case 5:
+ if (_system->getMillis() >= timer2) {
+ _finalA->_x = 8;
+ _finalA->_y = 46;
+ _finalA->_drawPage = 0;
+ _finalA->displayFrame(frame);
+ _screen->updateScreen();
+ timer2 = _system->getMillis() + 8 * _tickLength;
+ ++frame;
+ if (frame > 31) {
+ frame = 32;
+ _malcolmFlag = 6;
}
- break;
-
- case 8:
- if (_system->getMillis() >= timer2) {
+ }
+ break;
+
+ case 6:
+ if (_unkEndSeqVar4) {
+ if (frame <= 33 && _system->getMillis() >= timer2) {
_finalA->_x = 8;
_finalA->_y = 46;
_finalA->_drawPage = 0;
@@ -1270,53 +1242,80 @@ int KyraEngine::handleMalcolmFlag() {
_screen->updateScreen();
timer2 = _system->getMillis() + 8 * _tickLength;
++frame;
- if (frame > 37) {
- _malcolmFlag = 0;
- _deathHandler = 8;
- return 1;
+ if (frame > 33) {
+ _malcolmFlag = 7;
+ frame = 32;
+ _unkEndSeqVar5 = 0;
}
}
- break;
+ }
+ break;
- case 9:
- snd_playSoundEffect(12);
- snd_playSoundEffect(12);
- _finalC->_x = 16;
- _finalC->_y = 50;
- _finalC->_drawPage = 0;
- for (int i = 0; i < 18; ++i) {
- timer2 = _system->getMillis() + 4 * _tickLength;
- _finalC->displayFrame(i);
- _screen->updateScreen();
- while (_system->getMillis() < timer2) {}
+ case 7:
+ if (_unkEndSeqVar5 == 1) {
+ _malcolmFlag = 8;
+ frame = 34;
+ } else if (_unkEndSeqVar5 == 2) {
+ _malcolmFlag = 3;
+ timer1 = _system->getMillis() + 180 * _tickLength;
+ }
+ break;
+
+ case 8:
+ if (_system->getMillis() >= timer2) {
+ _finalA->_x = 8;
+ _finalA->_y = 46;
+ _finalA->_drawPage = 0;
+ _finalA->displayFrame(frame);
+ _screen->updateScreen();
+ timer2 = _system->getMillis() + 8 * _tickLength;
+ ++frame;
+ if (frame > 37) {
+ _malcolmFlag = 0;
+ _deathHandler = 8;
+ return 1;
}
- snd_playWanderScoreViaMap(51, 1);
- delay(60*_tickLength);
- _malcolmFlag = 0;
- return 1;
- break;
+ }
+ break;
- case 10:
- if (!_beadStateVar) {
- handleBeadState();
- _screen->bitBlitRects();
- assert(_veryClever);
- _text->printTalkTextMessage(_veryClever[0], 60, 31, 5, 0, 2);
- timer2 = _system->getMillis() + 180 * _tickLength;
- _malcolmFlag = 11;
- }
- break;
+ case 9:
+ snd_playSoundEffect(12);
+ snd_playSoundEffect(12);
+ _finalC->_x = 16;
+ _finalC->_y = 50;
+ _finalC->_drawPage = 0;
+ for (int i = 0; i < 18; ++i) {
+ timer2 = _system->getMillis() + 4 * _tickLength;
+ _finalC->displayFrame(i);
+ _screen->updateScreen();
+ while (_system->getMillis() < timer2) {}
+ }
+ snd_playWanderScoreViaMap(51, 1);
+ delay(60 * _tickLength);
+ _malcolmFlag = 0;
+ return 1;
- case 11:
- if (_system->getMillis() >= timer2) {
- _text->restoreTalkTextMessageBkgd(2, 0);
- _malcolmFlag = 3;
- timer1 = _system->getMillis() + 180 * _tickLength;
- }
- break;
+ case 10:
+ if (!_beadStateVar) {
+ handleBeadState();
+ _screen->bitBlitRects();
+ assert(_veryClever);
+ _text->printTalkTextMessage(_veryClever[0], 60, 31, 5, 0, 2);
+ timer2 = _system->getMillis() + 180 * _tickLength;
+ _malcolmFlag = 11;
+ }
+ break;
- default:
- break;
+ case 11:
+ if (_system->getMillis() >= timer2) {
+ _text->restoreTalkTextMessageBkgd(2, 0);
+ _malcolmFlag = 3;
+ timer1 = _system->getMillis() + 180 * _tickLength;
+ }
+ break;
+
+ default:
+ break;
}
return 0;
@@ -1344,197 +1343,197 @@ int KyraEngine::handleBeadState() {
};
switch (_beadStateVar) {
- case 0:
- if (beadState1.x != -1 && _endSequenceBackUpRect) {
+ case 0:
+ if (beadState1.x != -1 && _endSequenceBackUpRect) {
+ _screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
+ _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
+ }
+
+ beadState1.x = -1;
+ beadState1.tableIndex = 0;
+ timer1 = 0;
+ timer2 = 0;
+ _lastDisplayedPanPage = 0;
+ return 1;
+ break;
+
+ case 1:
+ if (beadState1.x != -1) {
+ if (_endSequenceBackUpRect) {
_screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
_screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
}
-
beadState1.x = -1;
beadState1.tableIndex = 0;
- timer1 = 0;
- timer2 = 0;
- _lastDisplayedPanPage = 0;
- return 1;
- break;
+ }
+ _beadStateVar = 2;
+ break;
- case 1:
- if (beadState1.x != -1) {
- if (_endSequenceBackUpRect) {
+ case 2:
+ if (_system->getMillis() >= timer1) {
+ int x = 0, y = 0;
+ timer1 = _system->getMillis() + 4 * _tickLength;
+ if (beadState1.x == -1) {
+ assert(_panPagesTable);
+ beadState1.width2 = _animator->fetchAnimWidth(_panPagesTable[19], 256);
+ beadState1.width = ((beadState1.width2 + 7) >> 3) + 1;
+ beadState1.height = _animator->fetchAnimHeight(_panPagesTable[19], 256);
+ if (!_endSequenceBackUpRect) {
+ _endSequenceBackUpRect = new uint8[(beadState1.width * beadState1.height) << 3];
+ assert(_endSequenceBackUpRect);
+ memset(_endSequenceBackUpRect, 0, ((beadState1.width * beadState1.height) << 3) * sizeof(uint8));
+ }
+ x = beadState1.x = 60;
+ y = beadState1.y = 40;
+ initBeadState(x, y, x, 25, 8, &beadState2);
+ } else {
+ if (processBead(beadState1.x, beadState1.y, x, y, &beadState2)) {
+ _beadStateVar = 3;
+ timer2 = _system->getMillis() + 240 * _tickLength;
+ _unkEndSeqVar4 = 0;
+ beadState1.dstX = beadState1.x;
+ beadState1.dstY = beadState1.y;
+ return 0;
+ } else {
_screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
_screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
+ beadState1.x = x;
+ beadState1.y = y;
}
- beadState1.x = -1;
- beadState1.tableIndex = 0;
}
- _beadStateVar = 2;
- break;
+ _screen->copyCurPageBlock(x >> 3, y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
+ _screen->drawShape(2, _panPagesTable[_lastDisplayedPanPage++], x, y, 0, 0);
+ if (_lastDisplayedPanPage > 17)
+ _lastDisplayedPanPage = 0;
+ _screen->addBitBlitRect(x, y, beadState1.width2, beadState1.height);
+ }
+ break;
- case 2:
- if (_system->getMillis() >= timer1) {
- int x = 0, y = 0;
- timer1 = _system->getMillis() + 4 * _tickLength;
- if (beadState1.x == -1) {
- assert(_panPagesTable);
- beadState1.width2 = _animator->fetchAnimWidth(_panPagesTable[19], 256);
- beadState1.width = ((beadState1.width2 + 7) >> 3) + 1;
- beadState1.height = _animator->fetchAnimHeight(_panPagesTable[19], 256);
- if (!_endSequenceBackUpRect) {
- _endSequenceBackUpRect = new uint8[(beadState1.width * beadState1.height) << 3];
- assert(_endSequenceBackUpRect);
- memset(_endSequenceBackUpRect, 0, ((beadState1.width * beadState1.height) << 3) * sizeof(uint8));
- }
- x = beadState1.x = 60;
- y = beadState1.y = 40;
- initBeadState(x, y, x, 25, 8, &beadState2);
+ case 3:
+ if (_system->getMillis() >= timer1) {
+ timer1 = _system->getMillis() + 4 * _tickLength;
+ _screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
+ _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
+ beadState1.x = beadState1.dstX + table1[beadState1.tableIndex];
+ beadState1.y = beadState1.dstY + table2[beadState1.tableIndex];
+ _screen->copyCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
+ _screen->drawShape(2, _panPagesTable[_lastDisplayedPanPage++], beadState1.x, beadState1.y, 0, 0);
+ if (_lastDisplayedPanPage >= 17) {
+ _lastDisplayedPanPage = 0;
+ }
+ _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
+ ++beadState1.tableIndex;
+ if (beadState1.tableIndex > 24) {
+ beadState1.tableIndex = 0;
+ _unkEndSeqVar4 = 1;
+ }
+ if (_system->getMillis() > timer2 && _malcolmFlag == 7 && !_unkAmuletVar && !_text->printed()) {
+ snd_playSoundEffect(0x0B);
+ if (_currentCharacter->x1 > 233 && _currentCharacter->x1 < 305 && _currentCharacter->y1 > 85 && _currentCharacter->y1 < 105 &&
+ (_brandonStatusBit & 0x20)) {
+ beadState1.unk8 = 290;
+ beadState1.unk9 = 40;
+ _beadStateVar = 5;
} else {
- if (processBead(beadState1.x, beadState1.y, x, y, &beadState2)) {
- _beadStateVar = 3;
- timer2 = _system->getMillis() + 240 * _tickLength;
- _unkEndSeqVar4 = 0;
- beadState1.dstX = beadState1.x;
- beadState1.dstY = beadState1.y;
- return 0;
- } else {
- _screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
- _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
- beadState1.x = x;
- beadState1.y = y;
- }
+ _beadStateVar = 4;
+ beadState1.unk8 = _currentCharacter->x1 - 4;
+ beadState1.unk9 = _currentCharacter->y1 - 30;
}
- _screen->copyCurPageBlock(x >> 3, y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
- _screen->drawShape(2, _panPagesTable[_lastDisplayedPanPage++], x, y, 0, 0);
- if (_lastDisplayedPanPage > 17)
- _lastDisplayedPanPage = 0;
- _screen->addBitBlitRect(x, y, beadState1.width2, beadState1.height);
+
+ if (_text->printed()) {
+ _text->restoreTalkTextMessageBkgd(2, 0);
+ }
+ initBeadState(beadState1.x, beadState1.y, beadState1.unk8, beadState1.unk9, 6, &beadState2);
+ _lastDisplayedPanPage = 18;
}
- break;
-
- case 3:
- if (_system->getMillis() >= timer1) {
- timer1 = _system->getMillis() + 4 * _tickLength;
+ }
+ break;
+
+ case 4:
+ if (_system->getMillis() >= timer1) {
+ int x = 0, y = 0;
+ timer1 = _system->getMillis();
+ if (processBead(beadState1.x, beadState1.y, x, y, &beadState2)) {
+ if (_brandonStatusBit & 20) {
+ _unkEndSeqVar5 = 2;
+ _beadStateVar = 6;
+ } else {
+ snd_playWanderScoreViaMap(52, 1);
+ snd_playSoundEffect(0x0C);
+ _unkEndSeqVar5 = 1;
+ _beadStateVar = 0;
+ }
+ } else {
_screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
_screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
- beadState1.x = beadState1.dstX + table1[beadState1.tableIndex];
- beadState1.y = beadState1.dstY + table2[beadState1.tableIndex];
+ beadState1.x = x;
+ beadState1.y = y;
_screen->copyCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
- _screen->drawShape(2, _panPagesTable[_lastDisplayedPanPage++], beadState1.x, beadState1.y, 0, 0);
- if (_lastDisplayedPanPage >= 17) {
+ _screen->drawShape(2, _panPagesTable[_lastDisplayedPanPage++], x, y, 0, 0);
+ if (_lastDisplayedPanPage > 17) {
_lastDisplayedPanPage = 0;
}
_screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
- ++beadState1.tableIndex;
- if (beadState1.tableIndex > 24) {
- beadState1.tableIndex = 0;
- _unkEndSeqVar4 = 1;
- }
- if (_system->getMillis() > timer2 && _malcolmFlag == 7 && !_unkAmuletVar && !_text->printed()) {
- snd_playSoundEffect(0x0B);
- if (_currentCharacter->x1 > 233 && _currentCharacter->x1 < 305 && _currentCharacter->y1 > 85 && _currentCharacter->y1 < 105 &&
- (_brandonStatusBit & 0x20)) {
- beadState1.unk8 = 290;
- beadState1.unk9 = 40;
- _beadStateVar = 5;
- } else {
- _beadStateVar = 4;
- beadState1.unk8 = _currentCharacter->x1 - 4;
- beadState1.unk9 = _currentCharacter->y1 - 30;
- }
-
- if (_text->printed()) {
- _text->restoreTalkTextMessageBkgd(2, 0);
- }
- initBeadState(beadState1.x, beadState1.y, beadState1.unk8, beadState1.unk9, 6, &beadState2);
- _lastDisplayedPanPage = 18;
- }
}
- break;
-
- case 4:
- if (_system->getMillis() >= timer1) {
- int x = 0, y = 0;
- timer1 = _system->getMillis();
- if (processBead(beadState1.x, beadState1.y, x, y, &beadState2)) {
- if (_brandonStatusBit & 20) {
- _unkEndSeqVar5 = 2;
- _beadStateVar = 6;
- } else {
- snd_playWanderScoreViaMap(52, 1);
- snd_playSoundEffect(0x0C);
- _unkEndSeqVar5 = 1;
- _beadStateVar = 0;
- }
- } else {
+ }
+ break;
+
+ case 5:
+ if (_system->getMillis() >= timer1) {
+ timer1 = _system->getMillis();
+ int x = 0, y = 0;
+ if (processBead(beadState1.x, beadState1.y, x, y, &beadState2)) {
+ if (beadState1.dstX == 290) {
_screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
- _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
- beadState1.x = x;
- beadState1.y = y;
- _screen->copyCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
- _screen->drawShape(2, _panPagesTable[_lastDisplayedPanPage++], x, y, 0, 0);
- if (_lastDisplayedPanPage > 17) {
- _lastDisplayedPanPage = 0;
+ uint32 nextRun = 0;
+ _finalB->_x = 224;
+ _finalB->_y = 8;
+ _finalB->_drawPage = 0;
+ for (int i = 0; i < 8; ++i) {
+ nextRun = _system->getMillis() + _tickLength;
+ _finalB->displayFrame(i);
+ _screen->updateScreen();
+ while (_system->getMillis() < nextRun) {}
}
- _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
- }
- }
- break;
-
- case 5:
- if (_system->getMillis() >= timer1) {
- timer1 = _system->getMillis();
- int x = 0, y = 0;
- if (processBead(beadState1.x, beadState1.y, x, y, &beadState2)) {
- if (beadState1.dstX == 290) {
- _screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
- uint32 nextRun = 0;
- _finalB->_x = 224;
- _finalB->_y = 8;
- _finalB->_drawPage = 0;
- for (int i = 0; i < 8; ++i) {
- nextRun = _system->getMillis() + _tickLength;
- _finalB->displayFrame(i);
- _screen->updateScreen();
- while (_system->getMillis() < nextRun) {}
- }
- snd_playSoundEffect(0x0D);
- for (int i = 7; i >= 0; --i) {
- nextRun = _system->getMillis() + _tickLength;
- _finalB->displayFrame(i);
- _screen->updateScreen();
- while (_system->getMillis() < nextRun) {}
- }
- initBeadState(beadState1.x, beadState1.y, 63, 60, 6, &beadState2);
- } else {
- _screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
- _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
- beadState1.x = -1;
- beadState1.tableIndex = 0;
- _beadStateVar = 0;
- _malcolmFlag = 9;
+ snd_playSoundEffect(0x0D);
+ for (int i = 7; i >= 0; --i) {
+ nextRun = _system->getMillis() + _tickLength;
+ _finalB->displayFrame(i);
+ _screen->updateScreen();
+ while (_system->getMillis() < nextRun) {}
}
+ initBeadState(beadState1.x, beadState1.y, 63, 60, 6, &beadState2);
} else {
_screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
_screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
- beadState1.x = x;
- beadState1.y = y;
- _screen->copyCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
- _screen->drawShape(2, _panPagesTable[_lastDisplayedPanPage++], x, y, 0, 0);
- if (_lastDisplayedPanPage > 17) {
- _lastDisplayedPanPage = 0;
- }
- _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
+ beadState1.x = -1;
+ beadState1.tableIndex = 0;
+ _beadStateVar = 0;
+ _malcolmFlag = 9;
}
+ } else {
+ _screen->copyFromCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
+ _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
+ beadState1.x = x;
+ beadState1.y = y;
+ _screen->copyCurPageBlock(beadState1.x >> 3, beadState1.y, beadState1.width, beadState1.height, _endSequenceBackUpRect);
+ _screen->drawShape(2, _panPagesTable[_lastDisplayedPanPage++], x, y, 0, 0);
+ if (_lastDisplayedPanPage > 17) {
+ _lastDisplayedPanPage = 0;
+ }
+ _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
}
- break;
+ }
+ break;
- case 6:
- _screen->drawShape(2, _panPagesTable[19], beadState1.x, beadState1.y, 0, 0);
- _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
- _beadStateVar = 0;
- break;
+ case 6:
+ _screen->drawShape(2, _panPagesTable[19], beadState1.x, beadState1.y, 0, 0);
+ _screen->addBitBlitRect(beadState1.x, beadState1.y, beadState1.width2, beadState1.height);
+ _beadStateVar = 0;
+ break;
- default:
- break;
+ default:
+ break;
}
return 0;
}
@@ -1665,50 +1664,50 @@ void KyraEngine::updateKyragemFading() {
_screen->setScreenPalette(_screen->_currentPalette);
_animator->_updateScreen = true;
switch (_kyragemFadingState.nextOperation) {
- case 0:
- --_kyragemFadingState.bOffset;
- if (_kyragemFadingState.bOffset >= 1)
- return;
- _kyragemFadingState.nextOperation = 1;
- break;
+ case 0:
+ --_kyragemFadingState.bOffset;
+ if (_kyragemFadingState.bOffset >= 1)
+ return;
+ _kyragemFadingState.nextOperation = 1;
+ break;
- case 1:
- ++_kyragemFadingState.rOffset;
- if (_kyragemFadingState.rOffset < 19)
- return;
- _kyragemFadingState.nextOperation = 2;
- break;
+ case 1:
+ ++_kyragemFadingState.rOffset;
+ if (_kyragemFadingState.rOffset < 19)
+ return;
+ _kyragemFadingState.nextOperation = 2;
+ break;
- case 2:
- --_kyragemFadingState.gOffset;
- if (_kyragemFadingState.gOffset >= 1)
- return;
- _kyragemFadingState.nextOperation = 3;
- break;
+ case 2:
+ --_kyragemFadingState.gOffset;
+ if (_kyragemFadingState.gOffset >= 1)
+ return;
+ _kyragemFadingState.nextOperation = 3;
+ break;
- case 3:
- ++_kyragemFadingState.bOffset;
- if (_kyragemFadingState.bOffset < 19)
- return;
- _kyragemFadingState.nextOperation = 4;
- break;
+ case 3:
+ ++_kyragemFadingState.bOffset;
+ if (_kyragemFadingState.bOffset < 19)
+ return;
+ _kyragemFadingState.nextOperation = 4;
+ break;
- case 4:
- --_kyragemFadingState.rOffset;
- if (_kyragemFadingState.rOffset >= 1)
- return;
- _kyragemFadingState.nextOperation = 5;
- break;
+ case 4:
+ --_kyragemFadingState.rOffset;
+ if (_kyragemFadingState.rOffset >= 1)
+ return;
+ _kyragemFadingState.nextOperation = 5;
+ break;
- case 5:
- ++_kyragemFadingState.gOffset;
- if (_kyragemFadingState.gOffset < 19)
- return;
- _kyragemFadingState.nextOperation = 0;
- break;
+ case 5:
+ ++_kyragemFadingState.gOffset;
+ if (_kyragemFadingState.gOffset < 19)
+ return;
+ _kyragemFadingState.nextOperation = 0;
+ break;
- default:
- break;
+ default:
+ break;
}
_kyragemFadingState.timerCount = _system->getMillis() + 120 * _tickLength;
@@ -1765,18 +1764,18 @@ void KyraEngine::drawJewelsFadeOutEnd(int jewel) {
debugC(9, kDebugLevelMain, "KyraEngine::drawJewelsFadeOutEnd(%d)", jewel);
static const uint16 jewelTable[] = { 0x153, 0x158, 0x15D, 0x162, 0x148, 0xFFFF };
int newDelay = 0;
- switch (jewel-1) {
- case 2:
- if (_currentCharacter->sceneId >= 109 && _currentCharacter->sceneId <= 198) {
- newDelay = 18900;
- } else {
- newDelay = 8100;
- }
- break;
+ switch (jewel - 1) {
+ case 2:
+ if (_currentCharacter->sceneId >= 109 && _currentCharacter->sceneId <= 198) {
+ newDelay = 18900;
+ } else {
+ newDelay = 8100;
+ }
+ break;
- default:
- newDelay = 3600;
- break;
+ default:
+ newDelay = 3600;
+ break;
}
setGameFlag(0xF1);
setTimerCountdown(19, newDelay);
diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp
index c031ebe21d..7288b27037 100644
--- a/engines/kyra/text.cpp
+++ b/engines/kyra/text.cpp
@@ -47,11 +47,15 @@ void KyraEngine::waitForChatToFinish(int16 chatDuration, const char *chatStr, ui
if (_configVoice == 0 && chatDuration != -1) {
switch (_configTextspeed) {
- case 0: chatDuration *= 2;
- break;
- case 2: chatDuration /= 4;
- break;
- case 3: chatDuration = -1;
+ case 0:
+ chatDuration *= 2;
+ break;
+ case 2:
+ chatDuration /= 4;
+ break;
+ case 3:
+ chatDuration = -1;
+ break;
}
}
@@ -110,6 +114,7 @@ void KyraEngine::waitForChatToFinish(int16 chatDuration, const char *chatStr, ui
break;
case OSystem::EVENT_QUIT:
quitGame();
+ break;
case OSystem::EVENT_LBUTTONDOWN:
runLoop = false;
break;