aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorFlorian Kagerer2009-05-30 19:48:13 +0000
committerFlorian Kagerer2009-05-30 19:48:13 +0000
commita126a05dc4a6f98ced644b9ed789a520b19976f3 (patch)
tree9622100256b730db709c8701d5a5fb7144305663 /engines/kyra
parent4ab05f0b387112b72fb44ed9262fde117a434586 (diff)
downloadscummvm-rg350-a126a05dc4a6f98ced644b9ed789a520b19976f3.tar.gz
scummvm-rg350-a126a05dc4a6f98ced644b9ed789a520b19976f3.tar.bz2
scummvm-rg350-a126a05dc4a6f98ced644b9ed789a520b19976f3.zip
LOL: implemented some opcodes required for yvel city
svn-id: r41041
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/lol.cpp22
-rw-r--r--engines/kyra/lol.h10
-rw-r--r--engines/kyra/script_lol.cpp50
-rw-r--r--engines/kyra/script_tim.cpp7
-rw-r--r--engines/kyra/script_tim.h2
-rw-r--r--engines/kyra/text_lol.cpp8
6 files changed, 58 insertions, 41 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 350bdc230e..911b62cd07 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -101,7 +101,6 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
_monsterShapesEx = 0;
_gameShapeMap = 0;
memset(_monsterAnimType, 0, 3);
- _pageSavedFlag = false;
_healOverlay = 0;
_swarmSpellStatus = 0;
@@ -833,7 +832,7 @@ void LoLEngine::startupNew() {
_currentLevel = 1;
giveCredits(41, 0);
- _inventory[0] = makeItem(132, 0, 0);
+ _inventory[0] = makeItem(216, 0, 0);
_inventory[1] = makeItem(217, 0, 0);
_inventory[2] = makeItem(218, 0, 0);
@@ -1635,25 +1634,6 @@ void LoLEngine::updateSequenceBackgroundAnimations() {
_tim->updateBackgroundAnimation(i);
}
-void LoLEngine::savePage5() {
- if (_pageSavedFlag)
- return;
-
- _screen->copyRegionToBuffer(5, 0, 0, 320, 200, _pageBuffer2);
- _pageSavedFlag = true;
-}
-
-void LoLEngine::restorePage5() {
- if (!_pageSavedFlag)
- return;
-
- for (int i = 0; i < 6; i++)
- _tim->freeAnimStruct(i);
-
- _screen->copyBlockToPage(5, 0, 0, 320, 200, _pageBuffer2);
- _pageSavedFlag = false;
-}
-
void LoLEngine::loadTalkFile(int index) {
char file[8];
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 878ac9dd19..586b7b072d 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -740,8 +740,10 @@ private:
int olol_getNextActiveCharacter(EMCState *script);
int olol_paralyzePoisonCharacter(EMCState *script);
int olol_drawCharPortrait(EMCState *script);
+ int olol_getAnimationLastPart(EMCState *script);
int olol_assignSpecialGuiShape(EMCState *script);
int olol_findInventoryItem(EMCState *script);
+ int olol_restoreFadePalette(EMCState *script);
int olol_changeItemTypeOrFlag(EMCState *script);
int olol_placeInventoryItemInHand(EMCState *script);
int olol_castSpell(EMCState *script);
@@ -750,6 +752,8 @@ private:
int olol_disableControls(EMCState *script);
int olol_enableControls(EMCState *script);
int olol_gasExplosion(EMCState *script);
+ int olol_calcNewBlockPosition(EMCState *script);
+ int olol_updateDrawPage2(EMCState *script);
int olol_characterSays(EMCState *script);
int olol_queueSpeech(EMCState *script);
int olol_getItemPrice(EMCState *script);
@@ -816,9 +820,7 @@ private:
void generateBrightnessPalette(uint8 *src, uint8 *dst, int brightness, int modifier);
void generateFlashPalette(uint8 *src, uint8 *dst, int colorFlags);
void updateSequenceBackgroundAnimations();
- void savePage5();
- void restorePage5();
-
+
bool _dialogueField;
uint8 **_itemIconShapes;
int _numItemIconShapes;
@@ -836,8 +838,6 @@ private:
uint8 *_characterFaceShapes[40][3];
- bool _pageSavedFlag;
-
// characters
bool addCharacter(int id);
void setTemporaryFaceFrame(int charNum, int frame, int updateDelay, int redraw);
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index 378ef0d874..531626d44c 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -1729,13 +1729,19 @@ int LoLEngine::olol_removeLevelItem(EMCState *script) {
int LoLEngine::olol_savePage5(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_savePage5(%p)", (const void *)script);
- savePage5();
+ // Not implemented: The original code uses this to back up and restore page 5 which is used
+ // to load WSA files. Since our WSA player provides its own memory buffers we don't
+ // need to use page 5.
return 1;
}
int LoLEngine::olol_restorePage5(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_restorePage5(%p)", (const void *)script);
- restorePage5();
+ // Not implemented: The original code uses this to back up and restore page 5 which is used
+ // to load WSA files. Since our WSA player provides its own memory buffers we don't
+ // need to use page 5.
+ for (int i = 0; i < 6; i++)
+ _tim->freeAnimStruct(i);
return 1;
}
@@ -1869,7 +1875,7 @@ int LoLEngine::olol_paralyzePoisonCharacter(EMCState *script) {
}
int LoLEngine::olol_drawCharPortrait(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_drawCharPortrait(%p) (%d)", (const void *)script, stackPos(0));
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_drawCharPortrait(%p) (%d)", (const void *)script, stackPos(0));
int charNum = stackPos(0);
if (charNum == -1)
gui_drawAllCharPortraitsWithStats();
@@ -1878,8 +1884,13 @@ int LoLEngine::olol_drawCharPortrait(EMCState *script) {
return 1;
}
+int LoLEngine::olol_getAnimationLastPart(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getAnimationLastPart(%p) (%d)", (const void *)script, stackPos(0));
+ return _tim->resetAnimationLastPart(stackPos(0));
+}
+
int LoLEngine::olol_assignSpecialGuiShape(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_assignSpecialGuiShape(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_assignSpecialGuiShape(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
if (stackPos(0)) {
_specialGuiShape = _levelShapes[_levelShapeProperties[_wllShapeMap[stackPos(0)]].shapeIndex[stackPos(1)]];
_specialGuiShapeX = stackPos(2);
@@ -1894,7 +1905,7 @@ int LoLEngine::olol_assignSpecialGuiShape(EMCState *script) {
}
int LoLEngine::olol_findInventoryItem(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_findInventoryItem(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_findInventoryItem(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
if (stackPos(0) == 0) {
for (int i = 0; i < 48; i++) {
if (!_inventory[i])
@@ -1922,8 +1933,16 @@ int LoLEngine::olol_findInventoryItem(EMCState *script) {
return -1;
}
+int LoLEngine::olol_restoreFadePalette(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_restoreFadePalette(%p)", (const void *)script);
+ memcpy(_screen->_currentPalette, _screen->getPalette(1), 384);
+ _screen->fadePalette(_screen->_currentPalette, 10);
+ _screen->_fadeFlag = 0;
+ return 1;
+}
+
int LoLEngine::olol_changeItemTypeOrFlag(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_changeItemTypeOrFlag(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_changeItemTypeOrFlag(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
if (stackPos(0) < 1)
return 0;
@@ -2050,6 +2069,17 @@ int LoLEngine::olol_gasExplosion(EMCState *script) {
return 1;
}
+int LoLEngine::olol_calcNewBlockPosition(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_calcNewBlockPosition(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ return calcNewBlockPosition(stackPos(0), stackPos(1));
+}
+
+int LoLEngine::olol_updateDrawPage2(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_updateDrawPage2(%p)", (const void *)script);
+ updateDrawPage2();
+ return 1;
+}
+
int LoLEngine::olol_characterSays(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_characterSays(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
if (stackPos(0) == -1) {
@@ -2576,12 +2606,12 @@ void LoLEngine::setupOpcodeTable() {
OpcodeUnImpl();
OpcodeUnImpl();
OpcodeUnImpl();
- OpcodeUnImpl();
+ Opcode(olol_getAnimationLastPart);
// 0xA4
Opcode(olol_assignSpecialGuiShape);
Opcode(olol_findInventoryItem);
- OpcodeUnImpl();
+ Opcode(olol_restoreFadePalette);
OpcodeUnImpl();
// 0xA8
@@ -2606,11 +2636,11 @@ void LoLEngine::setupOpcodeTable() {
Opcode(olol_enableControls);
OpcodeUnImpl();
Opcode(olol_gasExplosion);
- OpcodeUnImpl();
+ Opcode(olol_calcNewBlockPosition);
// 0xB8
OpcodeUnImpl();
- OpcodeUnImpl();
+ Opcode(olol_updateDrawPage2);
OpcodeUnImpl();
Opcode(olol_characterSays);
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index dab3e365f3..521abc2556 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -1065,6 +1065,13 @@ void TIMInterpreter_LoL::playAnimationPart(int animIndex, int firstFrame, int la
}
}
+int TIMInterpreter_LoL::resetAnimationLastPart(int animIndex) {
+ Animation *anim = &_animations[animIndex];
+ int8 res = -1;
+ SWAP(res, anim->lastPart);
+ return res;
+}
+
void TIMInterpreter_LoL::drawDialogueButtons() {
int cp = _screen->setCurPage(0);
Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
diff --git a/engines/kyra/script_tim.h b/engines/kyra/script_tim.h
index 19b81c219b..2dbfff49d4 100644
--- a/engines/kyra/script_tim.h
+++ b/engines/kyra/script_tim.h
@@ -144,6 +144,7 @@ public:
virtual void stopBackgroundAnimation(int animIndex) {}
virtual void updateBackgroundAnimation(int animIndex) {}
virtual void playAnimationPart(int animIndex, int firstFrame, int lastFrame, int delay) {}
+ virtual int resetAnimationLastPart(int animIndex) { return -1; }
virtual void resetDialogueState(TIM *tim) {}
@@ -238,6 +239,7 @@ public:
void stopBackgroundAnimation(int animIndex);
void updateBackgroundAnimation(int animIndex);
void playAnimationPart(int animIndex, int firstFrame, int lastFrame, int delay);
+ int resetAnimationLastPart(int animIndex);
private:
KyraEngine_v1 *vm();
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index 97ff06816f..3ddcfdaebc 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -77,11 +77,10 @@ void TextDisplayer_LoL::setupField(bool mode) {
for (int i = 177; i > 141; i--) {
uint32 endTime = _vm->_system->getMillis() + _vm->_tickLength;
- _screen->hideMouse();
_screen->copyRegion(83, i, 83, i - 1, 235, 3, 0, 0, Screen::CR_NO_P_CHECK);
_screen->copyRegion(83, i + 1, 83, i + 1, 235, 1, 2, 0, Screen::CR_NO_P_CHECK);
+ _vm->updateInput();
_screen->updateScreen();
- _screen->showMouse();
_vm->delayUntil(endTime);
}
@@ -98,7 +97,7 @@ void TextDisplayer_LoL::setupField(bool mode) {
}
void TextDisplayer_LoL::expandField() {
- uint8 *tmp = _vm->_pageBuffer1 + 1300;
+ uint8 *tmp = _vm->_pageBuffer1 + 13000;
if (_vm->textEnabled()) {
_vm->_fadeText = false;
@@ -110,10 +109,9 @@ void TextDisplayer_LoL::expandField() {
for (int i = 140; i < 177; i++) {
uint32 endTime = _vm->_system->getMillis() + _vm->_tickLength;
- _screen->hideMouse();
_screen->copyRegion(0, 0, 83, i, 235, 3, 2, 0, Screen::CR_NO_P_CHECK);
+ _vm->updateInput();
_screen->updateScreen();
- _screen->showMouse();
_vm->delayUntil(endTime);
}