Ticket #8302: ft.derby.patch

File ft.derby.patch, 6.2 KB (added by sev-, 20 years ago)

FT derby patch. Costumes patch.

  • scumm/actor.cpp

    diff --exclude CVS --exclude .deps --rec -u scummvm.old/scumm/actor.cpp scummvm/scumm/actor.cpp
    old new  
    15721572        }
    15731573
    15741574        if (costume < 1 || costume >= _vm->_numCostumes - 1) {
     1575                // in FT costume 0 is a normal situation
     1576                if (_vm->_gameId == GID_FT && !costume)
     1577                        return;
     1578
    15751579                warning("Remap actor %d invalid costume %d", number, costume);
    15761580                return;
    15771581        }
  • scumm/script_v6.cpp

    diff --exclude CVS --exclude .deps --rec -u scummvm.old/scumm/script_v6.cpp scummvm/scumm/script_v6.cpp
    old new  
    27262726                   333 = right
    27272727                 */
    27282728
     2729                // FIXME: I guess this is applicable to all engines, but lets avoid
     2730                // regressions
     2731                if (_gameId == GID_FT) {
     2732                        push(getKeyState(args[1]));
     2733                        return;
     2734                }
     2735
    27292736
    27302737                if ((args[1] == 27) && (_lastKeyHit == 27)) {
    27312738                        push(1); // abort
     
    27752782                error("o6_kernelGetFunctions: default case %d", args[0]);
    27762783        }
    27772784}
     2785
     2786// FIXME: check either some warning will trigger. I am not sure that those
     2787// keys are queried in scripts at all
     2788int ScummEngine::getKeyState(int key) {
     2789        switch(key) {
     2790        case 0x145:
     2791                warning("ScummEngine::getKeyState(%x) 'numlock' is probed", key);
     2792                return 0;
     2793                break;
     2794        case 0x164:
     2795                warning("ScummEngine::getKeyState(%x) 'left shift' is probed", key);
     2796                return 0;
     2797                break;
     2798        case 0x165:
     2799                warning("ScummEngine::getKeyState(%x) 'right shift' is probed", key);
     2800                return 0;
     2801                break;
     2802        case 0x166:
     2803        case 0x167:
     2804                warning("ScummEngine::getKeyState(%x) 'alt' is probed", key);
     2805                return 0;
     2806                break;
     2807        case 0x168:
     2808                warning("ScummEngine::getKeyState(%x) 'left ctrl' is probed", key);
     2809                return 0;
     2810                break;
     2811        case 0x202a:
     2812                warning("ScummEngine::getKeyState(%x) 'gray *' is probed", key);
     2813                return 0;
     2814                break;
     2815        case 0x202d:
     2816                warning("ScummEngine::getKeyState(%x) 'gray -' is probed", key);
     2817                return 0;
     2818                break;
     2819        case 0x147: // Home
     2820                return (_keyDownMap[0x107] || _keyDownMap[0x115]) ? 1 : 0;
     2821                break;
     2822        case 0x148: // Up
     2823                return (_keyDownMap[0x108] || _keyDownMap[0x111] ||
     2824                                _keyDownMap[0x38]) ? 1 : 0;
     2825                break;
     2826        case 0x149: // PgUp
     2827                return (_keyDownMap[0x109] || _keyDownMap[0x118]) ? 1 : 0;
     2828                break;
     2829        case 0x14A: // Gray-
     2830                return (_keyDownMap[0x10d] || _keyDownMap[0x2d]) ? 1 : 0;
     2831                break;
     2832        case 0x14B: // Left
     2833                return (_keyDownMap[0x104] || _keyDownMap[0x114] ||
     2834                                _keyDownMap[0x34]) ? 1 : 0;
     2835                break;
     2836        case 0x14C: // 5
     2837                return (_keyDownMap[0x105]) ? 1 : 0;
     2838                break;
     2839        case 0x14D: // Right
     2840                return (_keyDownMap[0x106] || _keyDownMap[0x113] ||
     2841                                _keyDownMap[0x36]) ? 1 : 0;
     2842                break;
     2843        case 0x14E: // Gray+
     2844                return (_keyDownMap[0x10e] ||
     2845                                (_keyDownMap[0x13d] && _keyDownMap[0x12f])) ? 1 : 0;
     2846                break;
     2847        case 0x14F: // End
     2848                return (_keyDownMap[0x101] || _keyDownMap[0x117]) ? 1 : 0;
     2849                break;
     2850        case 0x150: // Down
     2851                return (_keyDownMap[0x102] || _keyDownMap[0x112] ||
     2852                                _keyDownMap[0x32]) ? 1 : 0;
     2853                break;
     2854        case 0x151: // PgDn
     2855                return (_keyDownMap[0x103] || _keyDownMap[0x119]) ? 1 : 0;
     2856                break;
     2857        case 0x152: // Ins
     2858                return (_keyDownMap[0x100] || _keyDownMap[0x115]) ? 1 : 0;
     2859                break;
     2860        case 0x153: // Del
     2861                return (_keyDownMap[0x10a] || _keyDownMap[0x7f]) ? 1 : 0;
     2862                break;
     2863        default:
     2864                break;
     2865        }
     2866
     2867        if (key >= 0x13b && key <= 0x144) { // F1-F10
     2868                key -= 0x13b - 0x11a;
     2869        } else if (key >= 0x154 && key <= 0x15d) { // Shift+F1-F10
     2870                key -= 0x154 - 0x11a; // map it to just F1-F10
     2871
     2872                warning("ScummEngine::getKeyState(%x) 'Shift-F%d' is probed", key, key-0x153);
     2873        } else if (key > 0x8000) { // Alt
     2874                key -= 0x8000;
     2875                key += 154; // see ScummEngine::parseEvents()
     2876        } else if (key > 0x4000) { // Ctrl
     2877                key -= 0x4000;
     2878                key -= 0x40;
     2879        } else if (key > 0x2000) { // Gray keys
     2880                key -= 0x2000;
     2881                warning("ScummEngine::getKeyState(%x) 'gray key' is probed", key);
     2882        }
     2883
     2884        return (_keyDownMap[key]) ? 1 : 0;
     2885}
     2886
    27782887
    27792888void ScummEngine_v6::o6_delayFrames() {
    27802889        ScriptSlot *ss = &vm.slot[_currentScript];
  • scumm/scumm.h

    diff --exclude CVS --exclude .deps --rec -u scummvm.old/scumm/scumm.h scummvm/scumm/scumm.h
    old new  
    420420protected:
    421421        int _keyPressed;
    422422        uint16 _lastKeyHit;
     423        bool _keyDownMap[512]; // FIXME - 512 is a guess. it's max(kbd.ascii)
    423424
    424425        Common::Point _mouse;
    425426        Common::Point _virtualMouse;
     
    459460        void saveOrLoad(Serializer *s, uint32 savegameVersion);
    460461        void saveLoadResource(Serializer *ser, int type, int index);
    461462        void makeSavegameName(char *out, int slot, bool compatible);
     463
     464        int getKeyState(int key);
    462465
    463466public:
    464467        bool getSavegameName(int slot, char *desc, SaveFileManager *mgr);
  • scumm/scummvm.cpp

    diff --exclude CVS --exclude .deps --rec -u scummvm.old/scumm/scummvm.cpp scummvm/scumm/scummvm.cpp
    old new  
    10991099                _string[i].t_charset = 0;
    11001100        }
    11011101
     1102        // all keys are released
     1103        for (i = 0; i < 512; i++)
     1104                _keyDownMap[i] = false;
     1105
    11021106        _numInMsgStack = 0;
    11031107
    11041108        createResource(rtTemp, 6, 500);
     
    15881592                                                327, 328, 329
    15891593                                        };
    15901594                                _keyPressed = numpad[event.kbd.ascii - '0'];
    1591                         } else if (event.kbd.ascii < 273 || event.kbd.ascii > 276) {
     1595                        } else if (event.kbd.ascii < 273 || event.kbd.ascii > 276 || _gameId == GID_FT) {
    15921596                                // don't let game have arrow keys as we currently steal them
    15931597                                // for keyboard cursor control
    15941598                                // this fixes bug with up arrow (273) corresponding to
    15951599                                // "instant win" cheat in MI2 mentioned above
     1600                                //
     1601                                // This is not applicable to Full Throttle as it processes keyboard
     1602                                // cursor control by itself. Also it fixes derby scene
    15961603                                _keyPressed = event.kbd.ascii;  // Normal key press, pass on to the game.
    15971604                        }
     1605
     1606                        if (_keyPressed >= 512)
     1607                                warning("_keyPressed > 512 (%d)", _keyPressed);
     1608                        else
     1609                                _keyDownMap[_keyPressed] = true;
     1610                        break;
     1611
     1612                case OSystem::EVENT_KEYUP:
     1613                        // FIXME: for some reason OSystem::KBD_ALT is set sometimes
     1614                        // possible to a bug in sdl-common.cpp
     1615                        if (event.kbd.ascii >= 512)
     1616                                warning("keyPressed > 512 (%d)", event.kbd.ascii);
     1617                        else
     1618                                _keyDownMap[event.kbd.ascii] = false;
    15981619                        break;
    15991620
    16001621                case OSystem::EVENT_MOUSEMOVE: