Ticket #8441: smush.patch

File smush.patch, 4.8 KB (added by fingolfin, 19 years ago)
  • smush_player.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
    retrieving revision 1.168
    diff -u -d -r1.168 smush_player.cpp
     
    238238        _base = NULL;
    239239        _frameBuffer = NULL;
    240240        _specialBuffer = NULL;
     241       
     242        _seekPos = -1;
    241243
    242244        _skipNext = false;
    243245        _subtitles = ConfMan.getBool("subtitles");
     
    368370                _smixer->addChannel(c);
    369371        }
    370372
    371         if ((_middleAudio) && (index != 0)) {
    372                 c->setParameters(max_frames, flags, vol, pan, index);
    373         } else if (index == 0) {
     373        if (_middleAudio || (index == 0)) {
    374374                c->setParameters(max_frames, flags, vol, pan, index);
    375375        } else {
    376376                c->checkParameters(index, max_frames, flags, vol, pan);
     
    982982}
    983983
    984984void SmushPlayer::setupAnim(const char *file) {
    985         Chunk *sub;
    986985        int i;
    987986        char file_font[11];
    988987
    989         _base = new FileChunk(file);
    990         sub = _base->subBlock();
    991         checkBlock(*sub, TYPE_AHDR);
    992         handleAnimHeader(*sub);
    993 
    994988        if (_insanity) {
    995989                if (!((_vm->_features & GF_DEMO) && (_vm->_platform == Common::kPlatformPC)))
    996990                        readString("mineroad.trs");
     
    10271021        } else {
    10281022                error("SmushPlayer::setupAnim() Unknown font setup for game");
    10291023        }       
    1030 
    1031         delete sub;
    10321024}
    10331025
    10341026void SmushPlayer::parseNextFrame() {
    10351027        Common::StackLock lock(_mutex);
     1028       
     1029        Chunk *sub;
    10361030
    10371031        if (_vm->_smushPaused)
    10381032                return;
     1033       
     1034        if (_seekPos >= 0) {
     1035                if (_smixer)
     1036                        _smixer->stop();
     1037       
     1038                if (_seekFile.size() > 0) {
     1039                        if (_base) {
     1040                                delete _base;
     1041                        }
     1042                        _base = new FileChunk(_seekFile);
     1043       
     1044                        if (_seekPos > 0) {
     1045                                assert(_seekPos > 8);
     1046                                // In this case we need to get palette and number of frames
     1047                                sub = _base->subBlock();
     1048                                checkBlock(*sub, TYPE_AHDR);
     1049                                handleAnimHeader(*sub);
     1050                                delete sub;
     1051       
     1052                                _middleAudio = true;
     1053                                _seekPos -= 8;
     1054                        } else {
     1055                                // We need this in Full Throttle when entering/leaving
     1056                                // the old mine road.
     1057                                tryCmpFile(_seekFile.c_str());
     1058                        }
     1059                        _skipPalette = false;
     1060                } else {
     1061                        _skipPalette = true;
     1062                }
     1063       
     1064                _base->seek(_seekPos, FileChunk::seek_start);
     1065                _frame = _seekFrame;
     1066               
     1067                _seekPos = -1;
     1068        }
    10391069
     1070        assert(_base);
    10401071        if (_base->eof()) {
    10411072                _vm->_smushVideoShouldFinish = true;
    10421073                return;
    10431074        }
    10441075
    1045         Chunk *sub = _base->subBlock();
     1076        sub = _base->subBlock();
    10461077
    10471078        switch (sub->getType()) {
    10481079        case TYPE_AHDR: // FT INSANE may seek file to the beginning
     
    11531184void SmushPlayer::seekSan(const char *file, int32 pos, int32 contFrame) {
    11541185        Common::StackLock lock(_mutex);
    11551186
    1156         if (_smixer)
    1157                 _smixer->stop();
    1158 
    1159         if (file) {
    1160                 if (_base) {
    1161                         _base->seek(0, FileChunk::seek_end);
    1162                         delete _base;
    1163                 }
    1164 
    1165                 _base = new FileChunk(file);
    1166                 if (pos) {
    1167                         assert(pos != 8);
    1168                         // In this case we need to get palette and number of frames
    1169                         Chunk *sub = _base->subBlock();
    1170                         checkBlock(*sub, TYPE_AHDR);
    1171                         handleAnimHeader(*sub);
    1172                         delete sub;
    1173 
    1174                         _middleAudio = true;
    1175                         pos -= 8;
    1176                 } else {
    1177                         // We need this in Full Throttle when entering/leaving
    1178                         // the old mine road.
    1179                         tryCmpFile(file);
    1180                 }
    1181                 _skipPalette = false;
    1182         } else {
    1183                 _skipPalette = true;
    1184         }
    1185 
    1186         _base->seek(pos, FileChunk::seek_start);
    1187 
    1188         _frame = contFrame;
     1187        _seekFile = file ? file : "";
     1188        _seekPos = pos;
     1189        _seekFrame = contFrame;
    11891190}
    11901191
    11911192void SmushPlayer::tryCmpFile(const char *filename) {
     
    11981199        if (i == NULL) {
    11991200                error("invalid filename : %s", filename);
    12001201        }
    1201 #ifdef USE_MAD
     1202#if defined(USE_MAD) || defined(USE_VORBIS)
    12021203        char fname[260];
     1204#endif
     1205#ifdef USE_MAD
    12031206        memcpy(fname, filename, i - filename);
    12041207        strcpy(fname + (i - filename), ".mp3");
    12051208        _compressedFile.open(fname);
     
    12341237        }
    12351238        f.close();
    12361239
    1237         tryCmpFile(filename);
    1238 
    12391240        _updateNeeded = false;
    12401241        _warpNeeded = false;
    12411242        _palDirtyMin = 256;
     
    12451246        bool oldMouseState = _vm->_system->showMouse(false);
    12461247
    12471248        // Load the video
     1249        _seekFile = filename;
     1250        _seekPos = offset;
     1251        _seekFrame = startFrame;
     1252        _base = 0;
     1253
    12481254        setupAnim(filename);
    12491255        init();
    12501256
    1251         if (offset) {
    1252                 _base->seek(offset - 8, FileChunk::seek_start);
    1253                 _frame = startFrame;
    1254                 _middleAudio = true;
    1255         }
    1256 
    12571257        for (;;) {
    12581258                if (_warpNeeded) {
    12591259                        _vm->_system->warpMouse(_warpX, _warpY);
     
    12801280                        _palDirtyMin = 256;
    12811281                }
    12821282                if (_updateNeeded) {
    1283                        
    12841283                        uint32 end_time, start_time;
    12851284                       
    12861285                        start_time = _vm->_system->getMillis();
  • smush_player.h

    RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.h,v
    retrieving revision 1.50
    diff -u -d -r1.50 smush_player.h
     
    5151        byte *_frameBuffer;
    5252        byte *_specialBuffer;
    5353
     54        Common::String _seekFile;
     55        int32 _seekPos;
     56        int32 _seekFrame;
     57
    5458        bool _skipNext;
    5559        bool _subtitles;
    5660        bool _skips[37];