Ticket #8086: imuse.samnmax.diff

File imuse.samnmax.diff, 2.7 KB (added by SF/jamieson630, 22 years ago)

Patch against 1.45 (October 9)

  • scummvm/scumm/imuse.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
    retrieving revision 1.45
    diff -u -r1.45 imuse.cpp
     
    130130        void key_on(uint8 chan, byte data, byte velocity);
    131131        void part_set_transpose(uint8 chan, byte relative, int8 b);
    132132        void parse_sysex(byte *p, uint len);
    133         void maybe_jump(byte *data);
     133        void maybe_jump (byte cmd, uint track, uint beat, uint tick);
    134134        void maybe_set_transpose(byte *data);
    135135        void maybe_part_onoff(byte *data);
    136136        void maybe_set_volume(byte *data);
     
    20982103
    20992104        switch (code = *p++) {
    21002105        case 0:                                                                                         /* part on/off? */
    2101                 // This seems to do the right thing for Monkey 2, at least.
    2102                 a = *p++ & 0x0F;
    2103                 part = get_part(a);
    2104                 if (part) {
    2105                         debug(2, "%d => turning %s part %d", p[1], (p[1] == 2) ? "OFF" : "ON", a);
    2106                         part->set_onoff(p[1] != 2);
    2107                 }
     2106                if (len > 2) {
     2107                        // This seems to do the right thing for Monkey 2, at least.
     2108                        a = *p++ & 0x0F;
     2109                        part = get_part(a);
     2110                        if (part) {
     2111                                debug(2, "%d => turning %s part %d", p[1], (p[1] == 2) ? "OFF" : "ON", a);
     2112                                part->set_onoff(p[1] != 2);
     2113                        }
     2114                } else {
     2115                        // Sam & Max uses this as a track switch.
     2116                        if (_scanning)
     2117                                break;
     2118                        debug (0, "Switching to track %d", (int)((*p) - 1));
     2119                        if (jump ((*p) - 1, 0, 0) == false)
     2120                                debug (0, "  Failed!");
     2121                } // end if
     2122                break;
     2123
     2124        case 1:
     2125                // This SysEx is used in Sam & Max to provide loop (and
     2126                // possibly marker) information. Presently, only the
     2127                // loop information is implemented.
     2128                if (_scanning)
     2129                        break;
     2130                maybe_jump (p[0], p[1] - 1, (read_word (p + 2) - 1) * 4 + p[4], ((p[5] * _ticks_per_beat) >> 2) + p[6]);
    21082131                break;
    21092132               
    21102133        case 16:                                                                                        /* set instrument in part */
     
    21402163                if (_scanning)
    21412164                        break;
    21422165                decode_sysex_bytes(p + 1, buf, len - 2);
    2143                 maybe_jump(buf);
     2166                maybe_jump (buf[0], read_word (buf + 1), read_word (buf + 3), read_word (buf + 5));
    21442167                break;
    21452168
    21462169        case 49:                                                                                        /* hook - global transpose */
     
    22122235        }
    22132236}
    22142237
    2215 void Player::maybe_jump(byte *data)
     2238void Player::maybe_jump (byte cmd, uint track, uint beat, uint tick)
    22162239{
    2217         byte cmd;
    2218 
    2219         cmd = data[0];
    2220 
    22212240        /* is this the hook i'm waiting for? */
    22222241        if (cmd && _hook._jump != cmd)
    22232242                return;
     
    22262245        if (cmd != 0 && cmd < 0x80)
    22272246                _hook._jump = 0;
    22282247
    2229         jump(read_word(data + 1), read_word(data + 3), read_word(data + 5));
     2248        jump (track, beat, tick);
    22302249}
    22312250
    22322251void Player::maybe_set_transpose(byte *data)