aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2008-04-27 12:39:16 +0000
committerJohannes Schickel2008-04-27 12:39:16 +0000
commit1aac349da42f0a4c21204d2fc88041c4b63aa3c9 (patch)
tree76eb5e7315b9dc3317c7126b64a94bf30de0cc90 /engines/kyra
parentab1a3b0cc89686fa2e9ef864a429ae27ed7b2d2f (diff)
downloadscummvm-rg350-1aac349da42f0a4c21204d2fc88041c4b63aa3c9.tar.gz
scummvm-rg350-1aac349da42f0a4c21204d2fc88041c4b63aa3c9.tar.bz2
scummvm-rg350-1aac349da42f0a4c21204d2fc88041c4b63aa3c9.zip
Implemented KyraEngine_v3::eelScript.
svn-id: r31751
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/items_v3.cpp4
-rw-r--r--engines/kyra/kyra_v3.cpp50
-rw-r--r--engines/kyra/kyra_v3.h2
-rw-r--r--engines/kyra/sequences_v3.cpp94
4 files changed, 97 insertions, 53 deletions
diff --git a/engines/kyra/items_v3.cpp b/engines/kyra/items_v3.cpp
index 5aec674546..489afbbd82 100644
--- a/engines/kyra/items_v3.cpp
+++ b/engines/kyra/items_v3.cpp
@@ -483,7 +483,7 @@ bool KyraEngine_v3::itemListMagic(int handItem, int itemSlot) {
uint16 item = _itemList[itemSlot].id;
if (_currentChapter == 1 && handItem == 3 && item == 3 && queryGameFlag(0x76)) {
- //eelScript();
+ eelScript();
return true;
} else if ((handItem == 6 || handItem == 7) && item == 2) {
int animObjIndex = -1;
@@ -557,7 +557,7 @@ bool KyraEngine_v3::itemInventoryMagic(int handItem, int invSlot) {
uint16 item = _mainCharacter.inventory[invSlot];
if (_currentChapter == 1 && handItem == 3 && item == 3 && queryGameFlag(0x76)) {
- //eelScript();
+ eelScript();
return true;
} else if ((handItem == 6 || handItem == 7) && item == 2) {
_screen->hideMouse();
diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp
index 017594b459..32e2989444 100644
--- a/engines/kyra/kyra_v3.cpp
+++ b/engines/kyra/kyra_v3.cpp
@@ -1564,56 +1564,6 @@ bool KyraEngine_v3::talkObjectsInCurScene() {
#pragma mark -
-void KyraEngine_v3::runTemporaryScript(const char *filename, int allowSkip, int resetChar, int newShapes, int shapeUnload) {
- debugC(9, kDebugLevelMain, "KyraEngine_v3::runTemporaryScript('%s', %d, %d, %d, %d)", filename, allowSkip, resetChar, newShapes, shapeUnload);
- memset(&_temporaryScriptData, 0, sizeof(_temporaryScriptData));
- memset(&_temporaryScriptState, 0, sizeof(_temporaryScriptState));
-
- if (!_scriptInterpreter->loadScript(filename, &_temporaryScriptData, &_opcodesTemporary))
- error("Couldn't load temporary script '%s'", filename);
-
- _scriptInterpreter->initScript(&_temporaryScriptState, &_temporaryScriptData);
- _scriptInterpreter->startScript(&_temporaryScriptState, 0);
-
- _newShapeFlag = -1;
-
- if (_newShapeFiledata && newShapes) {
- resetNewShapes(_newShapeCount, _newShapeFiledata);
- _newShapeFiledata = 0;
- _newShapeCount = 0;
- }
-
- while (_scriptInterpreter->validScript(&_temporaryScriptState))
- _scriptInterpreter->runScript(&_temporaryScriptState);
-
- uint8 *fileData = 0;
-
- if (newShapes)
- _newShapeFiledata = _res->fileData(_newShapeFilename, 0);
-
- fileData = _newShapeFiledata;
-
- if (!fileData) {
- _scriptInterpreter->unloadScript(&_temporaryScriptData);
- return;
- }
-
- if (newShapes)
- _newShapeCount = initNewShapes(fileData);
-
- processNewShapes(allowSkip, resetChar);
-
- if (shapeUnload) {
- resetNewShapes(_newShapeCount, fileData);
- _newShapeCount = 0;
- _newShapeFiledata = 0;
- }
-
- _scriptInterpreter->unloadScript(&_temporaryScriptData);
-}
-
-#pragma mark -
-
bool KyraEngine_v3::updateScore(int scoreId, int strId) {
debugC(9, kDebugLevelMain, "KyraEngine_v3::updateScore(%d, %d)", scoreId, strId);
diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h
index cc7fab388a..47ec6e79e1 100644
--- a/engines/kyra/kyra_v3.h
+++ b/engines/kyra/kyra_v3.h
@@ -686,6 +686,8 @@ private:
bool updateScore(int scoreId, int strId);
void scoreIncrease(int count, const char *str);
+ void eelScript();
+
// save/load
void saveGame(const char *fileName, const char *saveName);
void loadGame(const char *fileName);
diff --git a/engines/kyra/sequences_v3.cpp b/engines/kyra/sequences_v3.cpp
index 972b6a027e..d697da60db 100644
--- a/engines/kyra/sequences_v3.cpp
+++ b/engines/kyra/sequences_v3.cpp
@@ -24,6 +24,7 @@
*/
#include "kyra/kyra_v3.h"
+#include "kyra/resource.h"
namespace Kyra {
@@ -105,7 +106,98 @@ void KyraEngine_v3::hideBadConscience() {
updateSceneAnim(0x0E, -1);
update();
removeSceneAnimObject(0x0E, 1);
- //setNextIdleAnimTimer();
+ setNextIdleAnimTimer();
+}
+
+void KyraEngine_v3::runTemporaryScript(const char *filename, int allowSkip, int resetChar, int newShapes, int shapeUnload) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v3::runTemporaryScript('%s', %d, %d, %d, %d)", filename, allowSkip, resetChar, newShapes, shapeUnload);
+ memset(&_temporaryScriptData, 0, sizeof(_temporaryScriptData));
+ memset(&_temporaryScriptState, 0, sizeof(_temporaryScriptState));
+
+ if (!_scriptInterpreter->loadScript(filename, &_temporaryScriptData, &_opcodesTemporary))
+ error("Couldn't load temporary script '%s'", filename);
+
+ _scriptInterpreter->initScript(&_temporaryScriptState, &_temporaryScriptData);
+ _scriptInterpreter->startScript(&_temporaryScriptState, 0);
+
+ _newShapeFlag = -1;
+
+ if (_newShapeFiledata && newShapes) {
+ resetNewShapes(_newShapeCount, _newShapeFiledata);
+ _newShapeFiledata = 0;
+ _newShapeCount = 0;
+ }
+
+ while (_scriptInterpreter->validScript(&_temporaryScriptState))
+ _scriptInterpreter->runScript(&_temporaryScriptState);
+
+ uint8 *fileData = 0;
+
+ if (newShapes)
+ _newShapeFiledata = _res->fileData(_newShapeFilename, 0);
+
+ fileData = _newShapeFiledata;
+
+ if (!fileData) {
+ _scriptInterpreter->unloadScript(&_temporaryScriptData);
+ return;
+ }
+
+ if (newShapes)
+ _newShapeCount = initNewShapes(fileData);
+
+ processNewShapes(allowSkip, resetChar);
+
+ if (shapeUnload) {
+ resetNewShapes(_newShapeCount, fileData);
+ _newShapeCount = 0;
+ _newShapeFiledata = 0;
+ }
+
+ _scriptInterpreter->unloadScript(&_temporaryScriptData);
+}
+
+void KyraEngine_v3::eelScript() {
+ debugC(9, kDebugLevelMain, "KyraEngine_v3::eelScript()");
+ if (_chatText)
+ return;
+ _screen->hideMouse();
+
+ if (_inventoryState)
+ hideInventory();
+ removeHandItem();
+
+ objectChat((const char*)getTableEntry(_cCodeFile, 35), 0, 204, 35);
+ objectChat((const char*)getTableEntry(_cCodeFile, 40), 0, 204, 40);
+ playSoundEffect(0x2A, 0xC8);
+
+ setGameFlag(0x171);
+
+ switch (_malcolmShapes-1) {
+ case 0:
+ runTemporaryScript("EELS01.EMC", 0, 0, 1, 1);
+ break;
+
+ case 1:
+ runTemporaryScript("EELS02.EMC", 0, 0, 1, 1);
+ break;
+
+ case 2:
+ runTemporaryScript("EELS03.EMC", 0, 0, 1, 1);
+ break;
+
+ case 3:
+ runTemporaryScript("EELS04.EMC", 0, 0, 1, 1);
+ break;
+
+ default:
+ resetGameFlag(0x171);
+ runTemporaryScript("EELS00.EMC", 0, 0, 1, 1);
+ break;
+ }
+
+ changeChapter(2, 29, 0, 4);
+ _screen->showMouse();
}
} // end of namespace Kyra