aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorFlorian Kagerer2008-02-18 23:04:37 +0000
committerFlorian Kagerer2008-02-18 23:04:37 +0000
commitbcdfe6ade076dc04590a6a8f57c9cdc70f9f13c0 (patch)
tree67f2c03c80ece5eb0ee6311a89b1bfd1555c8a1a /engines/kyra
parentab40f56f478f09aab308670eecdb234380f55512 (diff)
downloadscummvm-rg350-bcdfe6ade076dc04590a6a8f57c9cdc70f9f13c0.tar.gz
scummvm-rg350-bcdfe6ade076dc04590a6a8f57c9cdc70f9f13c0.tar.bz2
scummvm-rg350-bcdfe6ade076dc04590a6a8f57c9cdc70f9f13c0.zip
some more opcodes (the fly tree is now operational) and some bug fixes
svn-id: r30903
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/kyra_v2.cpp21
-rw-r--r--engines/kyra/kyra_v2.h10
-rw-r--r--engines/kyra/scene_v2.cpp16
-rw-r--r--engines/kyra/script_v2.cpp29
-rw-r--r--engines/kyra/sequences_v2.cpp9
5 files changed, 66 insertions, 19 deletions
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index e48da67bcb..55d79c3ed0 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -98,6 +98,7 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi
_colorCodeFlag1 = 0;
_colorCodeFlag2 = -1;
+ _scriptCountDown = 0;
memset(&_sceneScriptData, 0, sizeof(_sceneScriptData));
@@ -125,6 +126,15 @@ KyraEngine_v2::~KyraEngine_v2() {
delete _debugger;
delete _invWsa.wsa;
+ if (_sequenceSoundList) {
+ for (int i = 0; i < _sequenceSoundListSize; i++) {
+ if (_sequenceSoundList[i])
+ delete _sequenceSoundList[i];
+ }
+ delete [] _sequenceSoundList;
+ _sequenceSoundList = NULL;
+ }
+
if (_dlgBuffer)
delete [] _dlgBuffer;
for (int i = 0; i < 19; i++)
@@ -1908,9 +1918,9 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_getDlgIndex),
Opcode(o2_defineRoom),
OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_setCountDown),
// 0x7c
- OpcodeUnImpl(),
+ Opcode(o2_getCountDown),
Opcode(o2_dummy),
Opcode(o2_dummy),
OpcodeUnImpl(),
@@ -1922,8 +1932,8 @@ void KyraEngine_v2::setupOpcodeTable() {
// 0x84
Opcode(o2_getColorCodeFlag2),
Opcode(o2_setColorCodeFlag2),
- OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_getColorCodeValue),
+ Opcode(o2_setColorCodeValue),
// 0x88
Opcode(o2_countItemInstances),
OpcodeUnImpl(),
@@ -1958,7 +1968,7 @@ void KyraEngine_v2::setupOpcodeTable() {
OpcodeUnImpl(),
OpcodeUnImpl(),
OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_getBoolFromStack),
// 0xa4
OpcodeUnImpl(),
OpcodeUnImpl(),
@@ -1996,3 +2006,4 @@ void KyraEngine_v2::setupOpcodeTable() {
+
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index 675947d2e7..b42da7ba51 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -862,11 +862,15 @@ protected:
int o2_setupDialogue(ScriptState *script);
int o2_getDlgIndex(ScriptState *script);
int o2_defineRoom(ScriptState *script);
+ int o2_setCountDown(ScriptState *script);
+ int o2_getCountDown(ScriptState *script);
int o2_objectChat(ScriptState *script);
int o2_getColorCodeFlag1(ScriptState *script);
int o2_setColorCodeFlag1(ScriptState *script);
int o2_getColorCodeFlag2(ScriptState *script);
int o2_setColorCodeFlag2(ScriptState *script);
+ int o2_getColorCodeValue(ScriptState *script);
+ int o2_setColorCodeValue(ScriptState *script);
int o2_countItemInstances(ScriptState *script);
int o2_initObject(ScriptState *script);
int o2_npcChat(ScriptState *script);
@@ -879,6 +883,7 @@ protected:
int o2_getHiddenItemsEntry(ScriptState *script);
int o2_customChat(ScriptState *script);
int o2_customChatFinish(ScriptState *script);
+ int o2_getBoolFromStack(ScriptState *script);
int o2_setVocHigh(ScriptState *script);
int o2_getVocHigh(ScriptState *script);
int o2_zanthiaChat(ScriptState *script);
@@ -981,9 +986,11 @@ protected:
Sequence *_sequences;
NestedSequence *_nSequences;
- // these are used whenever the color code has to be entered
+ // color code related vars
int _colorCodeFlag1;
int _colorCodeFlag2;
+ uint8 _colorCode[7];
+ uint32 _scriptCountDown;
};
} // end of namespace Kyra
@@ -992,3 +999,4 @@ protected:
+
diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp
index 99411fcd02..55252c3201 100644
--- a/engines/kyra/scene_v2.cpp
+++ b/engines/kyra/scene_v2.cpp
@@ -85,7 +85,7 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk
//XXX
_sound->beginFadeOut();
}
-
+
_unkFlag1 = false;
if (!unk3) {
@@ -233,9 +233,17 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) {
void KyraEngine_v2::enterNewSceneUnk2(int unk1) {
_unk3 = -1;
- if (_mainCharX == -1 && _mainCharY == -1 && _mainCharacter.sceneId != 61 &&
- !queryGameFlag(0x1F1) && !queryGameFlag(0x192) && !queryGameFlag(0x193) &&
- _mainCharacter.sceneId != 70 && !queryGameFlag(0x159) && _mainCharacter.sceneId != 37) {
+ if (_flags.isTalkie) {
+ if (_mainCharX == -1 && _mainCharY == -1 && _mainCharacter.sceneId != 61 &&
+ !queryGameFlag(0x1F1) && !queryGameFlag(0x192) && !queryGameFlag(0x193) &&
+ _mainCharacter.sceneId != 70 && !queryGameFlag(0x159) && _mainCharacter.sceneId != 37) {
+ _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
+ updateCharacterAnim(0);
+ refreshAnimObjectsIfNeed();
+ }
+ } else if (_mainCharX != -1 && _mainCharY != -1) {
+ if (_characterFrameTable[_mainCharacter.facing] == 25)
+ _mainCharacter.facing = 5;
_mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing];
updateCharacterAnim(0);
refreshAnimObjectsIfNeed();
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index 6f7d5a91f9..2df37121b9 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -680,6 +680,18 @@ int KyraEngine_v2::o2_defineRoom(ScriptState *script) {
return 0;
}
+int KyraEngine_v2::o2_setCountDown(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_setCountDown(%p) (%d)", (const void *)script, stackPos(0));
+ _scriptCountDown = _system->getMillis() + stackPos(0) * _tickLength;
+ return 0;
+}
+
+int KyraEngine_v2::o2_getCountDown(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_getCountDown(%p)", (const void *)script);
+ uint32 time = _system->getMillis();
+ return (time > _scriptCountDown) ? 0 : _scriptCountDown - time;
+}
+
int KyraEngine_v2::o2_objectChat(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_objectChat(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1));
if (_flags.isTalkie)
@@ -711,6 +723,17 @@ int KyraEngine_v2::o2_setColorCodeFlag2(ScriptState *script) {
return 0;
}
+int KyraEngine_v2::o2_getColorCodeValue(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_getColorCodeValue(%p) (%d)", (const void *)script, stackPos(0));
+ return _colorCode[stackPos(0)];
+}
+
+int KyraEngine_v2::o2_setColorCodeValue(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_setColorCodeValue(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ _colorCode[stackPos(0)] = stackPos(1) & 0xff;
+ return stackPos(1) & 0xff;
+}
+
int KyraEngine_v2::o2_countItemInstances(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_countItemInstances(%p) (%d)", (const void *)script, stackPos(0));
uint16 item = stackPos(0);
@@ -819,6 +842,11 @@ int KyraEngine_v2::o2_customChatFinish(ScriptState *script) {
return 0;
}
+int KyraEngine_v2::o2_getBoolFromStack(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_getBoolFromStack(%p) ()", (const void *)script);
+ return stackPos(0) ? 1 : 0;
+}
+
int KyraEngine_v2::o2_setVocHigh(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_setVocHigh(%p) (%d)", (const void *)script, stackPos(0));
_vocHigh = stackPos(0);
@@ -910,3 +938,4 @@ int KyraEngine_v2::o2t_setShapeFlag(ScriptState *script) {
+
diff --git a/engines/kyra/sequences_v2.cpp b/engines/kyra/sequences_v2.cpp
index f1b3592caf..194b386ca8 100644
--- a/engines/kyra/sequences_v2.cpp
+++ b/engines/kyra/sequences_v2.cpp
@@ -2625,15 +2625,6 @@ void KyraEngine_v2::seq_uninit() {
delete [] _seqProcessedString;
_seqProcessedString = NULL;
- if (_sequenceSoundList) {
- for (int i = 0; i < _sequenceSoundListSize; i++) {
- if (_sequenceSoundList[i])
- delete _sequenceSoundList[i];
- }
- delete [] _sequenceSoundList;
- _sequenceSoundList = NULL;
- }
-
delete [] _activeWSA;
_activeWSA = NULL;