aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Kagerer2008-03-17 01:34:24 +0000
committerFlorian Kagerer2008-03-17 01:34:24 +0000
commitb9339221e4f0b92976f80028c49fcfbc0845ec01 (patch)
treece4c9bc506c9787b241885bf10f1115ec128e4ce
parenteceee73424a3338f1eedcced1e2dbb4fb7f71849 (diff)
downloadscummvm-rg350-b9339221e4f0b92976f80028c49fcfbc0845ec01.tar.gz
scummvm-rg350-b9339221e4f0b92976f80028c49fcfbc0845ec01.tar.bz2
scummvm-rg350-b9339221e4f0b92976f80028c49fcfbc0845ec01.zip
- implement debugger commands: gamespeed and pass_codes
- implement opcode 151: meanWhileScene() - fix dragon flight scene: this is still totally messed up, but at least the screen doesn't stay blank any more svn-id: r31152
-rw-r--r--engines/kyra/debugger.cpp36
-rw-r--r--engines/kyra/debugger.h2
-rw-r--r--engines/kyra/kyra_v2.cpp4
-rw-r--r--engines/kyra/kyra_v2.h2
-rw-r--r--engines/kyra/scene_v2.cpp14
-rw-r--r--engines/kyra/script_v2.cpp31
6 files changed, 81 insertions, 8 deletions
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index 194633ec68..e2523b71cc 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -235,6 +235,8 @@ Debugger_v2::Debugger_v2(KyraEngine_v2 *vm) : Debugger(vm), _vm(vm) {
DCmd_Register("scene_info", WRAP_METHOD(Debugger_v2, cmd_sceneInfo));
DCmd_Register("scene_to_facing", WRAP_METHOD(Debugger_v2, cmd_sceneToFacing));
DCmd_Register("give", WRAP_METHOD(Debugger_v2, cmd_giveItem));
+ DCmd_Register("pass_codes", WRAP_METHOD(Debugger_v2, cmd_passcodes));
+ DCmd_Register("gamespeed", WRAP_METHOD(Debugger_v2, cmd_gamespeed));
}
bool Debugger_v2::cmd_enterScene(int argc, const char **argv) {
@@ -378,5 +380,39 @@ bool Debugger_v2::cmd_giveItem(int argc, const char **argv) {
return true;
}
+bool Debugger_v2::cmd_passcodes(int argc, const char **argv) {
+ if (argc == 2) {
+ int val = atoi(argv[1]);
+
+ if (val < 0 || val > 1) {
+ DebugPrintf("value must be either 1 (on) or 0 (off)\n");
+ return true;
+ }
+
+ _vm->_dbgPass = val;
+ } else {
+ DebugPrintf("Syntax: pass_codes <0/1>\n");
+ }
+
+ return true;
+}
+
+bool Debugger_v2::cmd_gamespeed(int argc, const char **argv) {
+ if (argc == 2) {
+ int val = atoi(argv[1]);
+
+ if (val < 1 || val > 1000) {
+ DebugPrintf("speed must lie between 1 and 1000 (default: 60)\n");
+ return true;
+ }
+
+ _vm->_tickLength = (uint8)(1000.0 / val);
+ } else {
+ DebugPrintf("Syntax: gamespeed <value>\n");
+ }
+
+ return true;
+}
+
} // End of namespace Kyra
diff --git a/engines/kyra/debugger.h b/engines/kyra/debugger.h
index 033044a41e..8fbe20d846 100644
--- a/engines/kyra/debugger.h
+++ b/engines/kyra/debugger.h
@@ -82,6 +82,8 @@ protected:
bool cmd_characterInfo(int argc, const char **argv);
bool cmd_sceneToFacing(int argc, const char **argv);
bool cmd_giveItem(int argc, const char **argv);
+ bool cmd_passcodes(int argc, const char **argv);
+ bool cmd_gamespeed(int argc, const char **argv);
};
} // End of namespace Kyra
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index 3f2cc3a76d..e4ffe2feb0 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -63,7 +63,7 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi
_drawNoShapeFlag = false;
_charPalEntry = 0;
_itemInHand = -1;
- _unkSceneScreenFlag1 = false;
+ _unkSceneScreenFlag1 = true;
_noScriptEnter = true;
_currentChapter = 0;
_newChapterFile = 1;
@@ -102,7 +102,7 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi
_colorCodeFlag1 = 0;
_colorCodeFlag2 = -1;
_scriptCountDown = 0;
- memset(_inputColorCode, 0, 7);
+ _dbgPass = 0;
_gamePlayBuffer = 0;
_unkBuf500Bytes = 0;
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index f5d5ce1c56..f94e97b339 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -965,6 +965,7 @@ protected:
int o2_showChapterMessage(ScriptState *script);
int o2_restoreTalkTextMessageBkgd(ScriptState *script);
int o2_wsaClose(ScriptState *script);
+ int o2_meanWhileScene(ScriptState *script);
int o2_displayWsaFrame(ScriptState *script);
int o2_displayWsaSequentialFramesLooping(ScriptState *script);
int o2_wsaOpen(ScriptState *script);
@@ -1165,6 +1166,7 @@ protected:
uint8 _presetColorCode[7];
uint8 _inputColorCode[7];
uint32 _scriptCountDown;
+ int _dbgPass;
};
} // end of namespace Kyra
diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp
index 83d0f28aef..46c3fc1c93 100644
--- a/engines/kyra/scene_v2.cpp
+++ b/engines/kyra/scene_v2.cpp
@@ -665,7 +665,7 @@ void KyraEngine_v2::initSceneAnims(int unk1) {
}
void KyraEngine_v2::initSceneScreen(int unk1) {
- if (_unkSceneScreenFlag1) {
+ /*if (_unkSceneScreenFlag1) {
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0);
return;
}
@@ -678,7 +678,19 @@ void KyraEngine_v2::initSceneScreen(int unk1) {
_screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0);
if (_noScriptEnter)
+ memcpy(_screen->getPalette(0), _screen->getPalette(1), 384);*/
+
+ if (_unkSceneScreenFlag1 || _noScriptEnter) {
+ memset(_screen->getPalette(0), 0, 384);
+ _screen->setScreenPalette(_screen->getPalette(0));
+ }
+
+ _screen->copyRegion(0, 0, 0, 0, 320, 144, 2, 0);
+
+ if (_unkSceneScreenFlag1 || _noScriptEnter) {
memcpy(_screen->getPalette(0), _screen->getPalette(1), 384);
+ _screen->setScreenPalette(_screen->getPalette(0));
+ }
updateCharPal(0);
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index fc1b9957fa..1ce600a94f 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -175,6 +175,27 @@ int KyraEngine_v2::o2_wsaClose(ScriptState *script) {
return 0;
}
+int KyraEngine_v2::o2_meanWhileScene(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_meanWhileScene(%p) (%d)", (const void *)script, stackPos(0));
+ static const uint8 jpSubtitle[] = { 0x88, 0xEA, 0x95, 0xFB, 0x81, 0x45, 0x81, 0x45, 0x81, 0x45 };
+ const char *cpsfile = stackPosString(0);
+ const char *palfile = stackPosString(1);
+
+ _screen->loadBitmap(cpsfile, 3, 3, 0);
+ memcpy(_screen->getPalette(2), _screen->_currentPalette, 768);
+ _screen->loadPalette(palfile, _screen->getPalette(2));
+ _screen->fillRect(0, 0, 319, 199, 207);
+ _screen->setScreenPalette(_screen->getPalette(2));
+ _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
+ if (!scumm_stricmp(cpsfile, "_MEANWIL.CPS") && _flags.lang == Common::JA_JPN) {
+ Screen::FontId o = _screen->setFont(Screen::FID_6_FNT);
+ _screen->printText((const char*)jpSubtitle, 140, 176, 255, 132);
+ _screen->setFont(o);
+ }
+ _screen->updateScreen();
+ return 0;
+}
+
int KyraEngine_v2::o2_displayWsaFrame(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_displayWsaFrame(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script,
stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8));
@@ -944,7 +965,7 @@ int KyraEngine_v2::o2_pressColorKey(ScriptState *script) {
_inputColorCode[0] = stackPos(0) & 0xff;
for (int i = 0; i < 7; i++) {
if (_presetColorCode[i] != _inputColorCode[6 - i])
- return 0;
+ return _dbgPass;
}
return 1;
}
@@ -1115,13 +1136,13 @@ int KyraEngine_v2::o2_getHiddenItemsEntry(ScriptState *script) {
int KyraEngine_v2::o2_mushroomEffect(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_mushroomEffect(%p)", (const void *)script);
- memcpy(_screen->getPalette(1), _screen->_currentPalette, 768);
+ memcpy(_screen->getPalette(2), _screen->_currentPalette, 768);
for (int i = 1; i < 768; i += 3)
_screen->_currentPalette[i] = 0;
snd_playSoundEffect(106);
_screen->fadePalette(_screen->_currentPalette, 90, &_updateFunctor);
- memcpy(_screen->_currentPalette, _screen->getPalette(1), 768);
+ memcpy(_screen->_currentPalette, _screen->getPalette(2), 768);
for (int i = 0; i < 768; i += 3) {
_screen->_currentPalette[i] = _screen->_currentPalette[i + 1] = 0;
@@ -1132,7 +1153,7 @@ int KyraEngine_v2::o2_mushroomEffect(ScriptState *script) {
snd_playSoundEffect(106);
_screen->fadePalette(_screen->_currentPalette, 90, &_updateFunctor);
- memcpy(_screen->_currentPalette, _screen->getPalette(1), 768);
+ memcpy(_screen->_currentPalette, _screen->getPalette(2), 768);
_screen->fadePalette(_screen->_currentPalette, 30, &_updateFunctor);
return 0;
@@ -1555,7 +1576,7 @@ void KyraEngine_v2::setupOpcodeTable() {
Opcode(o2_getHiddenItemsEntry),
Opcode(o2_mushroomEffect),
Opcode(o2_wsaClose),
- OpcodeUnImpl(),
+ Opcode(o2_meanWhileScene),
// 0x98
Opcode(o2_customChat),
Opcode(o2_customChatFinish),