aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2008-05-02 15:59:57 +0000
committerJohannes Schickel2008-05-02 15:59:57 +0000
commitb17c6e100e5b34aa93a97968df57b3e7905fa0a7 (patch)
treec9ed8b1997737c736185661f826f676d2e953efd
parentf6bbf9298cf568c52d5919267953587fc6e6eb3a (diff)
downloadscummvm-rg350-b17c6e100e5b34aa93a97968df57b3e7905fa0a7.tar.gz
scummvm-rg350-b17c6e100e5b34aa93a97968df57b3e7905fa0a7.tar.bz2
scummvm-rg350-b17c6e100e5b34aa93a97968df57b3e7905fa0a7.zip
Started to move opcodes used in both kyra2 and kyra3 to KyraEngine_v2.
svn-id: r31825
-rw-r--r--engines/kyra/kyra_mr.h11
-rw-r--r--engines/kyra/kyra_v2.h14
-rw-r--r--engines/kyra/module.mk1
-rw-r--r--engines/kyra/script_hof.cpp45
-rw-r--r--engines/kyra/script_mr.cpp57
-rw-r--r--engines/kyra/script_v2.cpp76
6 files changed, 97 insertions, 107 deletions
diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h
index 358aa3285e..892349c9b8 100644
--- a/engines/kyra/kyra_mr.h
+++ b/engines/kyra/kyra_mr.h
@@ -84,7 +84,6 @@ protected:
void runLoop();
void handleInput(int x, int y);
- bool _unkHandleSceneChangeFlag;
int inputSceneChange(int x, int y, int unk1, int unk2);
void update();
@@ -363,8 +362,6 @@ private:
int getScale(int x, int y);
int _scaleTable[15];
- bool _unkSceneScreenFlag1;
-
// character
int getCharacterWalkspeed() const;
void updateCharAnimFrame(int character, int *table);
@@ -522,8 +519,6 @@ private:
static const uint8 _chapterLowestScene[];
- int _unk3, _unk4, _unk5;
-
void loadCostPal();
void loadShadowShape();
void loadExtrasShapes();
@@ -554,15 +549,9 @@ private:
int o3_setCharacterPos(EMCState *script);
int o3_defineObject(EMCState *script);
int o3_refreshCharacter(EMCState *script);
- int o3_getCharacterX(EMCState *script);
- int o3_getCharacterY(EMCState *script);
- int o3_getCharacterFacing(EMCState *script);
- int o3_getCharacterScene(EMCState *script);
int o3_getMalcolmsMood(EMCState *script);
int o3_getCharacterFrameFromFacing(EMCState *script);
int o3_setCharacterFacingOverwrite(EMCState *script);
- int o3_trySceneChange(EMCState *script);
- int o3_moveCharacter(EMCState *script);
int o3_setCharacterFacing(EMCState *script);
int o3_showSceneFileMessage(EMCState *script);
int o3_setCharacterAnimFrameFromFacing(EMCState *script);
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index c353350425..a4f7e4e9a1 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -54,6 +54,7 @@ protected:
// Input
virtual int checkInput(Button *buttonList, bool mainLoop = false) = 0;
+ virtual int inputSceneChange(int x, int y, int unk1, int unk2) = 0;
void updateInput();
void removeInputTop();
@@ -274,6 +275,19 @@ protected:
virtual int getCharacterWalkspeed() const = 0;
virtual void updateCharAnimFrame(int num, int *table) = 0;
+
+ // unknown
+ int _unk3, _unk4, _unk5;
+ bool _unkSceneScreenFlag1;
+ bool _unkHandleSceneChangeFlag;
+
+ // opcodes
+ int o2_getCharacterX(EMCState *script);
+ int o2_getCharacterY(EMCState *script);
+ int o2_getCharacterFacing(EMCState *script);
+ int o2_getCharacterScene(EMCState *script);
+ int o2_trySceneChange(EMCState *script);
+ int o2_moveCharacter(EMCState *script);
};
} // end of namespace Kyra
diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk
index 48bbb6e659..452d747ce4 100644
--- a/engines/kyra/module.mk
+++ b/engines/kyra/module.mk
@@ -36,6 +36,7 @@ MODULE_OBJS := \
screen_hof.o \
screen_mr.o \
script_v1.o \
+ script_v2.o \
script_hof.o \
script_mr.o \
script.o \
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index dc2c825d72..29a426d575 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -89,26 +89,6 @@ int KyraEngine_HoF::o2_refreshCharacter(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_getCharacterX(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_getCharacterX(%p) ()", (const void *)script);
- return _mainCharacter.x1;
-}
-
-int KyraEngine_HoF::o2_getCharacterY(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_getCharacterY(%p) ()", (const void *)script);
- return _mainCharacter.y1;
-}
-
-int KyraEngine_HoF::o2_getCharacterFacing(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_getCharacterFacing(%p) ()", (const void *)script);
- return _mainCharacter.facing;
-}
-
-int KyraEngine_HoF::o2_getCharacterScene(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_getCharacterScene(%p) ()", (const void *)script);
- return _mainCharacter.sceneId;
-}
-
int KyraEngine_HoF::o2_setSceneComment(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_setSceneComment(%p) ('%s')", (const void *)script, stackPosString(0));
_sceneCommentString = stackPosString(0);
@@ -134,31 +114,6 @@ int KyraEngine_HoF::o2_setCharacterFacing(EMCState *script) {
return 0;
}
-int KyraEngine_HoF::o2_trySceneChange(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_trySceneChange(%p) (%d, %d, %d, %d)", (const void *)script,
- stackPos(0), stackPos(1), stackPos(2), stackPos(3));
-
- _unkHandleSceneChangeFlag = 1;
- int success = inputSceneChange(stackPos(0), stackPos(1), stackPos(2), stackPos(3));
- _unkHandleSceneChangeFlag = 0;
-
- if (success) {
- _emc->init(script, script->dataPtr);
- _unk4 = 0;
- _unk3 = -1;
- _unk5 = 1;
- return 0;
- } else {
- return (_unk4 != 0) ? 1 : 0;
- }
-}
-
-int KyraEngine_HoF::o2_moveCharacter(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_moveCharacter(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
- moveCharacter(stackPos(0), stackPos(1), stackPos(2));
- return 0;
-}
-
int KyraEngine_HoF::o2_customCharacterChat(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_HoF::o2_customCharacterChat(%p) ('%s', %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
playVoice(_vocHigh, stackPos(4));
diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp
index c43743179d..a4d4c65e64 100644
--- a/engines/kyra/script_mr.cpp
+++ b/engines/kyra/script_mr.cpp
@@ -91,26 +91,6 @@ int KyraEngine_MR::o3_refreshCharacter(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_getCharacterX(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getCharacterX(%p) ()", (const void *)script);
- return _mainCharacter.x1;
-}
-
-int KyraEngine_MR::o3_getCharacterY(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getCharacterY(%p) ()", (const void *)script);
- return _mainCharacter.y1;
-}
-
-int KyraEngine_MR::o3_getCharacterFacing(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getCharacterFacing(%p) ()", (const void *)script);
- return _mainCharacter.facing;
-}
-
-int KyraEngine_MR::o3_getCharacterScene(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getCharacterScene(%p) ()", (const void *)script);
- return _mainCharacter.sceneId;
-}
-
int KyraEngine_MR::o3_getMalcolmsMood(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_getMalcolmsMood(%p) ()", (const void *)script);
return _malcolmsMood;
@@ -128,31 +108,6 @@ int KyraEngine_MR::o3_setCharacterFacingOverwrite(EMCState *script) {
return 0;
}
-int KyraEngine_MR::o3_trySceneChange(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_trySceneChange(%p) (%d, %d, %d, %d)", (const void *)script,
- stackPos(0), stackPos(1), stackPos(2), stackPos(3));
-
- _unkHandleSceneChangeFlag = 1;
- int success = inputSceneChange(stackPos(0), stackPos(1), stackPos(2), stackPos(3));
- _unkHandleSceneChangeFlag = 0;
-
- if (success) {
- _emc->init(script, script->dataPtr);
- _unk4 = 0;
- _unk3 = -1;
- _unk5 = 1;
- return 0;
- } else {
- return (_unk4 != 0) ? 1 : 0;
- }
-}
-
-int KyraEngine_MR::o3_moveCharacter(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_moveCharacter(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
- moveCharacter(stackPos(0), stackPos(1), stackPos(2));
- return 0;
-}
-
int KyraEngine_MR::o3_setCharacterFacing(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_MR::o3_setCharacterFacing(%p) (%d)", (const void *)script, stackPos(0));
_mainCharacter.facing = stackPos(0);
@@ -1446,10 +1401,10 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_defineObject);
Opcode(o3_refreshCharacter);
// 0x04
- Opcode(o3_getCharacterX);
- Opcode(o3_getCharacterY);
- Opcode(o3_getCharacterFacing);
- Opcode(o3_getCharacterScene);
+ Opcode(o2_getCharacterX);
+ Opcode(o2_getCharacterY);
+ Opcode(o2_getCharacterFacing);
+ Opcode(o2_getCharacterScene);
// 0x08
Opcode(o3_getMalcolmsMood);
Opcode(o3_dummy);
@@ -1457,8 +1412,8 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_getCharacterFrameFromFacing);
// 0x0c
Opcode(o3_setCharacterFacingOverwrite);
- Opcode(o3_trySceneChange);
- Opcode(o3_moveCharacter);
+ Opcode(o2_trySceneChange);
+ Opcode(o2_moveCharacter);
Opcode(o3_setCharacterFacing);
// 0x10
OpcodeUnImpl();
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
new file mode 100644
index 0000000000..f34c765c2d
--- /dev/null
+++ b/engines/kyra/script_v2.cpp
@@ -0,0 +1,76 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "kyra/kyra_v2.h"
+
+namespace Kyra {
+
+int KyraEngine_v2::o2_getCharacterX(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getCharacterX(%p) ()", (const void *)script);
+ return _mainCharacter.x1;
+}
+
+int KyraEngine_v2::o2_getCharacterY(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getCharacterY(%p) ()", (const void *)script);
+ return _mainCharacter.y1;
+}
+
+int KyraEngine_v2::o2_getCharacterFacing(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getCharacterFacing(%p) ()", (const void *)script);
+ return _mainCharacter.facing;
+}
+
+int KyraEngine_v2::o2_getCharacterScene(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getCharacterScene(%p) ()", (const void *)script);
+ return _mainCharacter.sceneId;
+}
+
+int KyraEngine_v2::o2_trySceneChange(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_trySceneChange(%p) (%d, %d, %d, %d)", (const void *)script,
+ stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+
+ _unkHandleSceneChangeFlag = 1;
+ int success = inputSceneChange(stackPos(0), stackPos(1), stackPos(2), stackPos(3));
+ _unkHandleSceneChangeFlag = 0;
+
+ if (success) {
+ _emc->init(script, script->dataPtr);
+ _unk4 = 0;
+ _unk3 = -1;
+ _unk5 = 1;
+ return 0;
+ } else {
+ return (_unk4 != 0) ? 1 : 0;
+ }
+}
+
+int KyraEngine_v2::o2_moveCharacter(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_moveCharacter(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
+ moveCharacter(stackPos(0), stackPos(1), stackPos(2));
+ return 0;
+}
+
+} // end of namespace Kyra
+