SAM: do_command(256) implementation
|Reported by:||SF/jamieson630||Owned by:||SF/ender|
|Game:||Sam and Max|
This patch implements the Sam & Max interpretation of do_command(256). This command queries for the last encountered marker ID, as set by SysEx code 0.
This command is used mostly during the opening credits to cue each page of credits to the music, thus causing the credits to span the music in full. It is also used by the credits to wait until the end of the music before switching rooms to the office scene.
SysEx code 0 implements triggered commands specified by do_command(17), ImSetTrigger. This modification also causes the SysEx response to store its marker ID *if* no triggered event is already cued.
This business of using the marker ID to identify how far the music has progressed is used, to my knoweldge, only during the opening credits. I'm not sure if it's appropriate to be storing the marker ID in the same slot as used by ImSetTrigger (since if both are used one or the other won't work), but I've tested most of the stops in Sam & Max (the more musically complicated ones, anyway), and I haven't found any case where this actually causes unexpected behavior.
Finally, this patch makes a small change to do_command(14), by preventing a volume fade from occurring if the time-to-fade is 0. I only did this because there is a deferred command showing up outside the Ball of Twine that attempts to do a volume fade, but with invalid parameters. The result is that the music gets faded to 0 instantly, and is never heard from again. Until this patch, the tracks weren't jumping around properly at all, and this problem never had a chance to manifest itself. I can't tell whether do_command(14) or the deferred command mechanism is not implemented properly. I'll be taking a closer look at that. In the meantime, this change does not affect any other observed occurrence of do_command(14).
This patch completes the array of fixes needed to make the opening cutscene, opening credits, and seamless transition to the office scene work perfectly. Knock on wood....
Ticket imported from: #622386. Ticket imported from: patches/194.