aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/kyra/kyra_v3.cpp19
-rw-r--r--engines/kyra/kyra_v3.h3
-rw-r--r--engines/kyra/script_v3.cpp8
3 files changed, 29 insertions, 1 deletions
diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp
index b1204db6e4..574ffd24d3 100644
--- a/engines/kyra/kyra_v3.cpp
+++ b/engines/kyra/kyra_v3.cpp
@@ -1678,6 +1678,25 @@ void KyraEngine_v3::scoreIncrease(int count, const char *str) {
#pragma mark -
+void KyraEngine_v3::changeChapter(int newChapter, int sceneId, int malcolmShapes, int facing) {
+ debugC(9, kDebugLevelMain, "KyraEngine_v3::changeChapter(%d, %d, %d, %d)", newChapter, sceneId, malcolmShapes, facing);
+ resetItemList();
+
+ _curChapter = newChapter;
+ runStartupScript(newChapter, 0);
+ _mainCharacter.dlgIndex = 0;
+
+ _malcolmsMood = 1;
+ memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState));
+
+ if (malcolmShapes >= 0)
+ loadMalcolmShapes(malcolmShapes);
+
+ enterNewScene(sceneId, facing, 0, 0, 0);
+}
+
+#pragma mark -
+
Movie *KyraEngine_v3::createWSAMovie() {
WSAMovieV2 *movie = new WSAMovieV2(this, _screen);
assert(movie);
diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h
index ac7625e8ee..fbd9bcd487 100644
--- a/engines/kyra/kyra_v3.h
+++ b/engines/kyra/kyra_v3.h
@@ -662,7 +662,9 @@ private:
uint8 *_screenBuffer;
uint8 *_paletteOverlay;
bool _useActorBuffer;
+
int _curChapter;
+ void changeChapter(int newChapter, int sceneId, int malcolmShapes, int facing);
static const uint8 _chapterLowestScene[];
@@ -760,6 +762,7 @@ private:
int o3_setDlgIndex(ScriptState *script);
int o3_getDlgIndex(ScriptState *script);
int o3_defineScene(ScriptState *script);
+ int o3_changeChapter(ScriptState *script);
int o3_countItemInstances(ScriptState *script);
int o3_dialogStartScript(ScriptState *script);
int o3_dialogEndScript(ScriptState *script);
diff --git a/engines/kyra/script_v3.cpp b/engines/kyra/script_v3.cpp
index fd9f95faf0..3cc2fd5b17 100644
--- a/engines/kyra/script_v3.cpp
+++ b/engines/kyra/script_v3.cpp
@@ -1041,6 +1041,12 @@ int KyraEngine_v3::o3_defineScene(ScriptState *script) {
return 0;
}
+int KyraEngine_v3::o3_changeChapter(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_changeChapter(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+ changeChapter(stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+ return 0;
+}
+
int KyraEngine_v3::o3_countItemInstances(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_countItemInstances(%p) (%d)", (const void *)script, stackPos(0));
int count = 0;
@@ -1406,7 +1412,7 @@ void KyraEngine_v3::setupOpcodeTable() {
Opcode(o3_dummy);
// 0x80
Opcode(o3_dummy);
- OpcodeUnImpl();
+ Opcode(o3_changeChapter);
Opcode(o3_dummy);
Opcode(o3_dummy);
// 0x84