From c4ad0a1c0d0053128e16ecbe739e33cdf9f57830 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 28 Jan 2008 22:21:47 +0000 Subject: Commit slightly modified patch #1880670 "KYRA: Hof: Zanthia chat fix for towns and floppy versions". svn-id: r30694 --- engines/kyra/kyra_v2.cpp | 3 ++- engines/kyra/kyra_v2.h | 6 ++++-- engines/kyra/script_v2.cpp | 13 ++++++++++++- engines/kyra/text_v2.cpp | 10 +++++++++- 4 files changed, 27 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 8801e8050a..0e5dff2844 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -1880,7 +1880,7 @@ void KyraEngine_v2::setupOpcodeTable() { Opcode(o2_dummy), OpcodeUnImpl(), // 0x80 - OpcodeUnImpl(), + Opcode(o2_objectChat), OpcodeUnImpl(), OpcodeUnImpl(), OpcodeUnImpl(), @@ -1959,3 +1959,4 @@ void KyraEngine_v2::setupOpcodeTable() { } // end of namespace Kyra + diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 97ebb263dd..4af7462b7a 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -632,8 +632,8 @@ protected: int chatGetType(const char *text); int chatCalcDuration(const char *text); - void objectChat(const char *text, int object, int vocHigh, int vocLow); - void objectChatInit(const char *text, int object, int vocHigh, int vocLow); + void objectChat(const char *text, int object, int vocHigh = -1, int vocLow = -1); + void objectChatInit(const char *text, int object, int vocHigh = -1, int vocLow = -1); void objectChatPrintText(const char *text, int object); void objectChatProcess(const char *script); void objectChatWaitToFinish(); @@ -795,6 +795,7 @@ protected: int o2_defineSceneAnim(ScriptState *script); int o2_updateSceneAnim(ScriptState *script); int o2_defineRoom(ScriptState *script); + int o2_objectChat(ScriptState *script); int o2_countItemInstances(ScriptState *script); int o2_initObject(ScriptState *script); int o2_deinitObject(ScriptState *script); @@ -906,3 +907,4 @@ protected: #endif + diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index 9f3de9484a..f115665f09 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -644,6 +644,15 @@ int KyraEngine_v2::o2_defineRoom(ScriptState *script) { return 0; } +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) + warning("Unexpected call: o2_objectChat(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); + else + objectChat(stackPosString(0), stackPos(1)); + return 0; +} + int KyraEngine_v2::o2_countItemInstances(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2_countItemInstances(%p) (%d)", (const void *)script, stackPos(0)); uint16 item = stackPos(0); @@ -823,9 +832,11 @@ int KyraEngine_v2::o2t_fadeScenePal(ScriptState *script) { int KyraEngine_v2::o2t_setShapeFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o2t_setShapeFlag(%p) (%d)", (const void *)script, stackPos(0)); - _newShapeFlag = stackPos(0); + if (_flags.isTalkie) + _newShapeFlag = stackPos(0); return 0; } } // end of namespace Kyra + diff --git a/engines/kyra/text_v2.cpp b/engines/kyra/text_v2.cpp index 345af34e71..2f517c2d42 100644 --- a/engines/kyra/text_v2.cpp +++ b/engines/kyra/text_v2.cpp @@ -126,7 +126,14 @@ int KyraEngine_v2::chatGetType(const char *str) { } int KyraEngine_v2::chatCalcDuration(const char *str) { - return MAX(strlen(str) << 3, 120); + static const uint8 durationMultiplicator[] = { 16, 14, 12, 10, 8, 8, 7, 6, 5, 4 }; + + // TODO / HACK: imlement this correctly + const int _configTextspeed = 50; + + int duration = strlen(str); + duration *= _flags.isTalkie ? 8 : durationMultiplicator[(_configTextspeed / 10)]; + return MAX(duration, 120); } void KyraEngine_v2::objectChat(const char *str, int object, int vocHigh, int vocLow) { @@ -479,3 +486,4 @@ void KyraEngine_v2::freeTIM(byte *buffer) { } // end of namespace Kyra + -- cgit v1.2.3