aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/kyra_hof.cpp1
-rw-r--r--engines/kyra/kyra_mr.cpp4
-rw-r--r--engines/kyra/kyra_mr.h4
-rw-r--r--engines/kyra/kyra_v2.cpp5
-rw-r--r--engines/kyra/kyra_v2.h7
-rw-r--r--engines/kyra/scene_hof.cpp14
-rw-r--r--engines/kyra/scene_mr.cpp14
-rw-r--r--engines/kyra/scene_v2.cpp16
8 files changed, 28 insertions, 37 deletions
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index c9c30c52d4..cb56913e72 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -108,7 +108,6 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn
_inventorySaved = false;
_unkBuf200kByte = 0;
memset(&_sceneShapeTable, 0, sizeof(_sceneShapeTable));
- memset(&_sceneScriptData, 0, sizeof(_sceneScriptData));
_talkObjectList = 0;
_shapeDescTable = 0;
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index 864d741847..71f9c8aa86 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -69,8 +69,6 @@ KyraEngine_MR::KyraEngine_MR(OSystem *system, const GameFlags &flags) : KyraEngi
_text = 0;
_commandLineY = 189;
_inventoryState = false;
- memset(&_sceneScriptState, 0, sizeof(_sceneScriptState));
- memset(&_sceneScriptData, 0, sizeof(_sceneScriptData));
memset(_characterAnimTable, 0, sizeof(_characterAnimTable));
_overwriteSceneFacing = false;
_maskPageMinY = _maskPageMaxY = 0;
@@ -168,8 +166,6 @@ KyraEngine_MR::~KyraEngine_MR() {
}
_gameShapes.clear();
- _emc->unload(&_sceneScriptData);
-
delete [] _sceneStrings;
delete [] _talkObjectList;
diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h
index 542e4de78e..358aa3285e 100644
--- a/engines/kyra/kyra_mr.h
+++ b/engines/kyra/kyra_mr.h
@@ -339,15 +339,11 @@ private:
int runSceneScript2();
bool _noStartupChat;
void runSceneScript4(int unk1);
- void runSceneScript6();
void runSceneScript8();
int _sceneMinX, _sceneMaxX;
int _maskPageMinY, _maskPageMaxY;
- EMCState _sceneScriptState;
- EMCData _sceneScriptData;
-
int trySceneChange(int *moveTable, int unk1, int unk2);
int checkSceneChange();
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index b8ede4f50b..0868f1d16e 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -41,6 +41,9 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi
_characterShapeFile = -1;
_updateCharPosNextUpdate = 0;
+
+ memset(&_sceneScriptState, 0, sizeof(_sceneScriptState));
+ memset(&_sceneScriptData, 0, sizeof(_sceneScriptData));
}
KyraEngine_v2::~KyraEngine_v2() {
@@ -51,6 +54,8 @@ KyraEngine_v2::~KyraEngine_v2() {
_gameShapes.clear();
delete [] _itemList;
+
+ _emc->unload(&_sceneScriptData);
}
void KyraEngine_v2::updateInput() {
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index c5be20e363..c353350425 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -151,6 +151,13 @@ protected:
virtual void enterNewScene(uint16 newScene, int facing, int unk1, int unk2, int unk3) = 0;
+ void runSceneScript6();
+
+ EMCData _sceneScriptData;
+ EMCState _sceneScriptState;
+
+ virtual int trySceneChange(int *moveTable, int unk1, int unk2) = 0;
+
// Animation
virtual void restorePage3() = 0;
diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp
index 30f514262b..3fc7947253 100644
--- a/engines/kyra/scene_hof.cpp
+++ b/engines/kyra/scene_hof.cpp
@@ -501,20 +501,6 @@ void KyraEngine_HoF::runSceneScript4(int unk1) {
_emc->run(&_sceneScriptState);
}
-void KyraEngine_HoF::runSceneScript6() {
- debugC(9, kDebugLevelMain, "KyraEngine_HoF::runSceneScript6()");
- _emc->init(&_sceneScriptState, &_sceneScriptData);
-
- _sceneScriptState.regs[0] = _mainCharacter.sceneId;
- _sceneScriptState.regs[1] = _mouseX;
- _sceneScriptState.regs[2] = _mouseY;
- _sceneScriptState.regs[4] = _itemInHand;
-
- _emc->start(&_sceneScriptState, 6);
- while (_emc->isValid(&_sceneScriptState))
- _emc->run(&_sceneScriptState);
-}
-
void KyraEngine_HoF::runSceneScript7() {
debugC(9, kDebugLevelMain, "KyraEngine_HoF::runSceneScript7()");
int oldPage = _screen->_curPage;
diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp
index e5d933c25f..17fbdac87b 100644
--- a/engines/kyra/scene_mr.cpp
+++ b/engines/kyra/scene_mr.cpp
@@ -803,20 +803,6 @@ void KyraEngine_MR::runSceneScript4(int unk1) {
_noStartupChat = true;
}
-void KyraEngine_MR::runSceneScript6() {
- debugC(9, kDebugLevelMain, "KyraEngine_MR::runSceneScript6()");
- _emc->init(&_sceneScriptState, &_sceneScriptData);
-
- _sceneScriptState.regs[0] = _mainCharacter.sceneId;
- _sceneScriptState.regs[1] = _mouseX;
- _sceneScriptState.regs[2] = _mouseY;
- _sceneScriptState.regs[3] = _itemInHand;
-
- _emc->start(&_sceneScriptState, 6);
- while (_emc->isValid(&_sceneScriptState))
- _emc->run(&_sceneScriptState);
-}
-
void KyraEngine_MR::runSceneScript8() {
debugC(9, kDebugLevelMain, "KyraEngine_MR::runSceneScript8()");
_emc->start(&_sceneScriptState, 8);
diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp
index aa54b5c470..ac7bcdb257 100644
--- a/engines/kyra/scene_v2.cpp
+++ b/engines/kyra/scene_v2.cpp
@@ -70,6 +70,22 @@ void KyraEngine_v2::updateSpecialSceneScripts() {
}
}
+void KyraEngine_v2::runSceneScript6() {
+ debugC(9, kDebugLevelMain, "KyraEngine_v2::runSceneScript6()");
+ _emc->init(&_sceneScriptState, &_sceneScriptData);
+
+ _sceneScriptState.regs[0] = _mainCharacter.sceneId;
+ _sceneScriptState.regs[1] = _mouseX;
+ _sceneScriptState.regs[2] = _mouseY;
+ _sceneScriptState.regs[3] = _itemInHand;
+
+ _emc->start(&_sceneScriptState, 6);
+ while (_emc->isValid(&_sceneScriptState))
+ _emc->run(&_sceneScriptState);
+}
+
+#pragma mark - pathfinder
+
int KyraEngine_v2::findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize) {
debugC(9, kDebugLevelMain, "KyraEngine_v2::findWay(%d, %d, %d, %d, %p, %d)", x, y, toX, toY, (const void *)moveTable, moveTableSize);
x &= ~3; toX &= ~3;