Ticket #8261: indy3_fmtowns2.diff

File indy3_fmtowns2.diff, 12.1 KB (added by SF/hibernatus, 21 years ago)

Indy3 FM Towns with 22KHz sounds

  • /cygdrive/c/scummvm

    Common subdirectories: /cygdrive/c/scummvm/scumm/CVS and /cygdrive/c/scummvm.test/scumm/CVS
    diff -u /cygdrive/c/scummvm/scumm/charset.cpp /cygdrive/c/scummvm.test/scumm/charset.cpp
    old new  
    928928void CharsetRendererV3::setColor(byte color)
    929929{
    930930        _color = color;
    931         _shadowColor = (_vm->_gameId == GID_ZAK256) ? 8 : 0;
    932         if (_vm->_gameId == GID_ZAK256) {
     931        _shadowColor = (_vm->_gameId == GID_ZAK256 || _vm->_gameId == GID_INDY3_TOWNS) ? 8 : 0;
     932        if (_vm->_gameId == GID_ZAK256 || _vm->_gameId == GID_INDY3_TOWNS) {
    933933                _dropShadow = ((_color & 0x80) != 0);
    934934                _color &= 0x7f;
    935935        } else if (_vm->_features & GF_16COLOR) {
  • /cygdrive/c/scummvm

    diff -u /cygdrive/c/scummvm/scumm/help.cpp /cygdrive/c/scummvm.test/scumm/help.cpp
    old new  
    3131                break;
    3232        case GID_INDY3:
    3333        case GID_INDY3_256:
     34        case GID_INDY3_TOWNS:
    3435                return 6;
    3536                break;
    3637        case GID_LOOM:
     
    141142                        break;
    142143                case GID_INDY3:
    143144                case GID_INDY3_256:
     145                case GID_INDY3_TOWNS:
    144146                        ADD_BIND("q", "Push");
    145147                        ADD_BIND("a", "Pull");
    146148                        ADD_BIND("z", "Give");
     
    264266                case GID_INDY3:
    265267                case GID_ZAK256:
    266268                case GID_INDY3_256:
     269                case GID_INDY3_TOWNS:
    267270                        title = "Other game controls:";
    268271                        ADD_TEXT("Inventory:");
    269272                        ADD_BIND("y", "Upper left item");
     
    289292                switch (gameId) {
    290293                case GID_INDY3:
    291294                case GID_INDY3_256:
     295                case GID_INDY3_TOWNS:
    292296                        title = "Fighting controls (numpad):";
    293297                        ADD_BIND("7", "Step back");
    294298                        ADD_BIND("4", "Step back");
     
    312316                switch (gameId) {
    313317                case GID_INDY3:
    314318                case GID_INDY3_256:
     319                case GID_INDY3_TOWNS:
    315320                        title = "Biplane controls (numpad):";
    316321                        ADD_BIND("7", "Fly to upper left");
    317322                        ADD_BIND("4", "Fly to left");
  • scumm/resource.cpp

    diff -u /cygdrive/c/scummvm/scumm/resource.cpp /cygdrive/c/scummvm.test/scumm/resource.cpp
    old new  
    652652                tag = _fileHandle.readUint16LE();
    653653                _fileHandle.seek(-6, SEEK_CUR);
    654654                /* FIXME */
    655                 if ((type == rtSound) && !(_features & GF_AMIGA) && (_gameId != GID_ZAK256)) {
     655                if ((type == rtSound) && !(_features & GF_AMIGA) && (_gameId != GID_ZAK256) && (_gameId != GID_INDY3_TOWNS)) {
    656656                        return readSoundResourceSmallHeader(type, idx);
    657657                }
    658658        } else {
  • scumm/resource_v3.cpp

    diff -u /cygdrive/c/scummvm/scumm/resource_v3.cpp /cygdrive/c/scummvm.test/scumm/resource_v3.cpp
    old new  
    152152                                break;
    153153
    154154                        default:
    155                                 error("Bad ID %c%c found in directory!", blocktype & 0xFF, blocktype >> 8);
     155                                // FIXME: this is a little hack because Indy3 FM Towns has 32 bytes appended to 00.LFL.
     156                                if (_gameId != GID_INDY3_TOWNS)
     157                                        error("Bad ID %c%c found in directory!", blocktype & 0xFF, blocktype >> 8);
    156158                                return;
    157159                        }
    158160                }
  • /cygdrive/c/scummvm

    diff -u /cygdrive/c/scummvm/scumm/script.cpp /cygdrive/c/scummvm.test/scumm/script.cpp
    old new  
    504504                        }
    505505#endif
    506506                        checkRange(_numVariables - 1, 0, var, "Variable %d out of range(rzb)");
    507                         return (_scummVars[ var ] & ( 1 << bit ) ) ? 1 : 0;
     507                        return (_scummVars[var] & (1 << bit)) ? 1 : 0;
    508508                } else {
    509509                        var &= 0x7FFF;
     510#if defined(BYPASS_COPY_PROT)
     511                        if (_gameId == GID_INDY3_TOWNS && var == 1508) {
     512                                return 0;
     513                        }
     514#endif
    510515                        checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(r)");
    511516                        return (_bitVars[var >> 3] & (1 << (var & 7))) ? 1 : 0;
    512517                }
    513518        }
    514519
    515520        if (var & 0x4000) {
    516                 if (_gameId == GID_INDY3_256) {
     521                if (_gameId == GID_INDY3_256 || _gameId == GID_INDY3_TOWNS) {
    517522                        var &= 0xF;
    518523                } else {
    519524                        var &= 0xFFF;
     
    580585        }
    581586
    582587        if (var & 0x4000) {
    583                 if (_gameId == GID_INDY3_256) {
     588                if (_gameId == GID_INDY3_256 || _gameId == GID_INDY3_TOWNS) {
    584589                        var &= 0xF;
    585590                } else {
    586591                        var &= 0xFFF;
     
    758763                // not actual data not even a 00 (stop code)
    759764                // maybe we should be limiting ourselves to strictly reading the size
    760765                // described in the header?
    761                 if (_gameId == GID_INDY3_256) {
     766                if (_gameId == GID_INDY3_256 || _gameId == GID_INDY3_TOWNS) {
    762767                        // FIXME: Oddly, Indy3 seems to contain exit scripts with only a size
    763768                        // and a tag - not even a terminating NULL!
    764769                        byte *roomptr = getResourceAddress(rtRoom, _roomResource);
  • scumm/script_v5.cpp

    diff -u /cygdrive/c/scummvm/scumm/script_v5.cpp /cygdrive/c/scummvm.test/scumm/script_v5.cpp
    old new  
    599599        // the actor ID of the opposing soldier. So, we copy that value
    600600        // over to the Local[5] variable of script 33.
    601601        // See also bug #743314.
    602         if (_gameId == GID_INDY3_256 && vm.slot[cur].number == 32 && script == 33) {
     602        if ((_gameId == GID_INDY3_256 || _gameId == GID_INDY3_TOWNS) && vm.slot[cur].number == 32 && script == 33) {
    603603                vars[5] = vm.localvar[cur][5];
    604604        }
    605605
     
    667667                initCharset(getVarOrDirectByte(0x80));
    668668                break;
    669669        case 14:                                                                                        /* unk */
    670                 if (_features & GF_OLD_BUNDLE || _gameId == GID_INDY3_256) {
     670                if (_features & GF_OLD_BUNDLE || _gameId == GID_INDY3_256 || _gameId == GID_INDY3_TOWNS) {
    671671                        // FIXME: What is this supposed to do? From comparing
    672672                        // Indy3's script 118 to the Passport Demo's script 58
    673673                        // my guess is that it's some sort of "init charset",
     
    690690                break;
    691691        }
    692692
    693         if (!(_features & GF_OLD_BUNDLE) && _gameId != GID_INDY3_256) {
     693        if (!(_features & GF_OLD_BUNDLE) && _gameId != GID_INDY3_256 && _gameId != GID_INDY3_TOWNS) {
    694694                VAR(VAR_CURSORSTATE) = _cursor.state;
    695695                VAR(VAR_USERPUT) = _userPut;
    696696        }
     
    975975                return;
    976976
    977977        // INDY3 uses this opcode as a wait_for_actor();
    978         if ((_gameId == GID_INDY3_256) || (_gameId == GID_INDY3)) {
     978        if ((_gameId == GID_INDY3_TOWNS) || (_gameId == GID_INDY3_256) || (_gameId == GID_INDY3)) {
    979979                const byte *oldaddr = _scriptPointer - 1;
    980980                a = derefActor(getVarOrDirectByte(0x80), "o5_getActorScale (wait)");
    981981                if (a->moving) {
     
    10091009        int a;
    10101010        getResultPos();
    10111011
    1012         if (_gameId == GID_INDY3_256 || _gameId == GID_INDY3)
     1012        if (_gameId == GID_INDY3_TOWNS || _gameId == GID_INDY3_256 || _gameId == GID_INDY3)
    10131013                a = getVarOrDirectByte(0x80);
    10141014        else
    10151015                a = getVarOrDirectWord(0x80);
     
    10211021        int a;
    10221022        getResultPos();
    10231023
    1024         if (_gameId == GID_INDY3_256 || _gameId == GID_INDY3) {
     1024        if (_gameId == GID_INDY3_TOWNS || _gameId == GID_INDY3_256 || _gameId == GID_INDY3) {
    10251025                a = getVarOrDirectByte(0x80);
    10261026
    10271027                // FIXME - bug 636433 workaround (can't get into Zeppelin)
     
    15051505        _opcode = fetchScriptByte();
    15061506        if (_opcode != 17)
    15071507                resid = getVarOrDirectByte(0x80);
    1508         if (_gameId != GID_ZAK256) {
     1508        if (_gameId != GID_ZAK256 && _gameId != GID_INDY3_TOWNS) {
    15091509                // FIXME - this probably can be removed eventually, I don't think the following
    15101510                // check will ever be triggered, but then I could be wrong and it's better
    15111511                // to play it safe.
     
    20142014}
    20152015
    20162016void Scumm_v5::o5_startMusic() {
    2017         if (_gameId == GID_ZAK256) {
     2017        if (_gameId == GID_ZAK256 || _gameId == GID_INDY3_TOWNS) {
    20182018                // In Zak256, this seems to be some kind of Audio CD status query function.
    20192019                // See also bug #762589 (thanks to Hibernatus for providing the information).
    20202020                getResultPos();
     
    23412341void Scumm_v5::o5_wait() {
    23422342        const byte *oldaddr = _scriptPointer - 1;
    23432343
    2344         if ((_gameId == GID_INDY3_256) || (_gameId == GID_INDY3)) {
     2344        if ((_gameId == GID_INDY3_TOWNS) || (_gameId == GID_INDY3_256) || (_gameId == GID_INDY3)) {
    23452345                _opcode = 2;
    23462346        } else
    23472347                _opcode = fetchScriptByte();
     
    25842584                        // It's also needed for Loom, or the lines Bobbin
    25852585                        // speaks during the intro are put at position 0,0.
    25862586                        // In addition, Loom needs to remember the text colour.
    2587                         if (_gameId == GID_INDY3_256 || _gameId == GID_INDY3 || _gameId == GID_LOOM) {
     2587                        if (_gameId == GID_INDY3_TOWNS || _gameId == GID_INDY3_256 || _gameId == GID_INDY3 || _gameId == GID_LOOM) {
    25882588                                _string[textSlot].t_xpos = _string[textSlot].xpos;
    25892589                                _string[textSlot].t_ypos = _string[textSlot].ypos;
    25902590                                _string[textSlot].t_color = _string[textSlot].color;
     
    26152615                a = getVarOrDirectWord(0x80);
    26162616
    26172617#if 1
    2618                 if (_gameId == GID_ZAK256) {
     2618                if (_gameId == GID_ZAK256 || _gameId == GID_INDY3_TOWNS) {
    26192619                        // FIXME / TODO: OK the first thing to note is: at least in Zak256,
    26202620                        // maybe also in other games, this opcode does a bit more. I added
    26212621                        // some stubs here, but somebody with a full IDA or more knowledge
  • /cygdrive/c/scummvm

    diff -u /cygdrive/c/scummvm/scumm/scumm.h /cygdrive/c/scummvm.test/scumm/scumm.h
    old new  
    212212        GID_ZAK,
    213213        GID_PUTTDEMO,
    214214        GID_PUTTPUTT,
    215         GID_MONKEY_SEGA
     215        GID_MONKEY_SEGA,
     216        GID_INDY3_TOWNS
    216217};
    217218
    218219#define _maxRooms res.num[rtRoom]
  • /cygdrive/c/scummvm

    diff -u /cygdrive/c/scummvm/scumm/scummvm.cpp /cygdrive/c/scummvm.test/scumm/scummvm.cpp
    old new  
    9090        /* Scumm Version 3 */
    9191        {"indy3EGA", "Indiana Jones and the Last Crusade", GID_INDY3, 3, VersionSettings::ADLIB_ALWAYS,
    9292         GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE, "00.LFL"},
     93        {"indy3Towns", "Indiana Jones and the Last Crusade (FM Towns)", GID_INDY3_TOWNS, 3, VersionSettings::ADLIB_ALWAYS,
     94         GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_OLD256 | GF_AUDIOTRACKS, "00.LFL"},
    9395        {"indy3", "Indiana Jones and the Last Crusade (256)", GID_INDY3_256, 3, VersionSettings::ADLIB_ALWAYS,
    9496         GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALLING | GF_OLD256 | GF_ADLIB_DEFAULT, "00.LFL"},
    9597        {"zak256", "Zak McKracken and the Alien Mindbenders (256)", GID_ZAK256, 3, VersionSettings::ADLIB_ALWAYS,
     
    567569        _hexdumpScripts = false;
    568570        _showStack = false;
    569571
    570         if (_gameId == GID_ZAK256) {    // FmTowns is 320x240
     572        if (_gameId == GID_ZAK256 || _gameId == GID_INDY3_TOWNS) {      // FmTowns is 320x240
    571573                _screenWidth = 320;
    572574                _screenHeight = 240;
    573575        } else if (_gameId == GID_CMI) {
  • /cygdrive/c/scummvm

    Only in /cygdrive/c/scummvm.test/scumm/: scummvm___Release
    Common subdirectories: /cygdrive/c/scummvm/scumm/smush and /cygdrive/c/scummvm.test/scumm/smush
    diff -u /cygdrive/c/scummvm/scumm/sound.cpp /cygdrive/c/scummvm.test/scumm/sound.cpp
    old new  
    384384                        WA probably again contains audio data?
    385385                        */
    386386#endif
    387                         rate = 11000;
     387                        rate = 11025;
    388388                        int type = *(ptr + 0x0D);
    389389
    390390                        switch(type) {
     
    392392                                        int waveSize = READ_LE_UINT32(ptr + 0x22);
    393393                                        int loopStart = READ_LE_UINT32(ptr + 0x26);
    394394                                        int loopEnd = READ_LE_UINT32(ptr + 0x2A);
     395                                        rate = (READ_LE_UINT32(ptr + 0x32) == 60) ? 11025 : 22050;      // 48 means 22050
    395396
    396397                                        if (size - 0x36 < waveSize) {
    397398                                                warning("Wrong wave size in sound #%i: %i", soundID, waveSize);
     
    415416                                                }
    416417                                        }
    417418
    418                                         _scumm->_mixer->playRaw(NULL, sound, waveSize, 11000, flags, soundID);
     419                                        _scumm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID);
    419420                                        break;
    420421                                }
    421422
     
    803804                stopCD();
    804805        }
    805806
    806         if (_scumm->_gameId == GID_ZAK256) {
     807        if (_scumm->_gameId == GID_ZAK256 || _scumm->_gameId == GID_INDY3_TOWNS) {
    807808                _scumm->_mixer->stopID(a);
    808809        } else if (_scumm->_imuseDigital) {
    809810                _scumm->_imuseDigital->stopSound(a);