Commit slightly modified patch #1880670 "KYRA: Hof: Zanthia chat fix for towns and floppy versions".

svn-id: r30694
This commit is contained in:
Johannes Schickel 2008-01-28 22:21:47 +00:00
parent 0150ada2d7
commit c4ad0a1c0d
4 changed files with 27 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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));
if (_flags.isTalkie)
_newShapeFlag = stackPos(0);
return 0;
}
} // end of namespace Kyra

View file

@ -126,7 +126,14 @@ int KyraEngine_v2::chatGetType(const char *str) {
}
int KyraEngine_v2::chatCalcDuration(const char *str) {
return MAX<int>(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<int>(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