Ticket #8788: zanthiaTalk_V2.patch

File zanthiaTalk_V2.patch, 3.1 KB (added by athrxx, 16 years ago)

new version

  • kyra_v2.cpp

     
    18801880                Opcode(o2_dummy),
    18811881                OpcodeUnImpl(),
    18821882                // 0x80
     1883                Opcode(o2_objectChat),
    18831884                OpcodeUnImpl(),
    18841885                OpcodeUnImpl(),
    18851886                OpcodeUnImpl(),
    1886                 OpcodeUnImpl(),
    18871887                // 0x84
    18881888                OpcodeUnImpl(),
    18891889                OpcodeUnImpl(),
  • kyra_v2.h

     
    632632        int chatGetType(const char *text);
    633633        int chatCalcDuration(const char *text);
    634634
    635         void objectChat(const char *text, int object, int vocHigh, int vocLow);
    636         void objectChatInit(const char *text, int object, int vocHigh, int vocLow);
     635        void objectChat(const char *text, int object, int vocHigh = -1, int vocLow = -1);
     636        void objectChatInit(const char *text, int object, int vocHigh = -1, int vocLow = -1);
    637637        void objectChatPrintText(const char *text, int object);
    638638        void objectChatProcess(const char *script);
    639639        void objectChatWaitToFinish();
     
    795795        int o2_defineSceneAnim(ScriptState *script);
    796796        int o2_updateSceneAnim(ScriptState *script);
    797797        int o2_defineRoom(ScriptState *script);
     798        int o2_objectChat(ScriptState *script);
    798799        int o2_countItemInstances(ScriptState *script);
    799800        int o2_initObject(ScriptState *script);
    800801        int o2_deinitObject(ScriptState *script);
  • script_v2.cpp

     
    644644        return 0;
    645645}
    646646
     647int KyraEngine_v2::o2_objectChat(ScriptState *script) {
     648        debugC(3, kDebugLevelScriptFuncs, "o2_objectChat(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1));
     649        if (_flags.isTalkie)
     650                warning("Unexpected call: o2_objectChat(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1));
     651        else
     652                objectChat(stackPosString(0), stackPos(1));
     653        return 0;
     654}
     655
    647656int KyraEngine_v2::o2_countItemInstances(ScriptState *script) {
    648657        debugC(3, kDebugLevelScriptFuncs, "o2_countItemInstances(%p) (%d)", (const void *)script, stackPos(0));
    649658        uint16 item = stackPos(0);
     
    823832
    824833int KyraEngine_v2::o2t_setShapeFlag(ScriptState *script) {
    825834        debugC(3, kDebugLevelScriptFuncs, "o2t_setShapeFlag(%p) (%d)", (const void *)script, stackPos(0));
    826         _newShapeFlag = stackPos(0);
     835        if (_flags.isTalkie)
     836                _newShapeFlag = stackPos(0);
    827837        return 0;
    828838}
    829839
  • text_v2.cpp

     
    126126}
    127127
    128128int KyraEngine_v2::chatCalcDuration(const char *str) {
    129         return MAX<int>(strlen(str) << 3, 120);
     129        // TODO: imlement this correctly
     130        _configTextspeed = 50;
     131       
     132        static const uint8 duration[] = { 16, 14, 12, 10, 8, 8, 7, 6, 5, 4 };
     133        int d = strlen(str);
     134        d = _flags.isTalkie ? d << 3 : d * duration[(_configTextspeed / 10)];
     135        return MAX<int>(d, 120);
    130136}
    131137
    132138void KyraEngine_v2::objectChat(const char *str, int object, int vocHigh, int vocLow) {