#8088 closed patch
SAM: ImSetTrigger implementation
Reported by: | SF/jamieson630 | Owned by: | SF/ender |
---|---|---|---|
Priority: | normal | Component: | Engine: SCUMM |
Version: | Keywords: | ||
Cc: | Game: | Sam and Max |
Description
The included patch implements the ImSetTrigger function (do_command param == 0, cmd == 17) for Sam & Max. This is the first observed correlation between Sam & Max script commands and SysEx blocks in the S&M MIDI resources.
ImSetTrigger provides a set of parameters with which to invoke do_command, at the time that a marker matching the specified marker ID is encountered in a MIDI music resource that is playing. The marker is identified using the following SysEx event: 00 xx (F7), where "xx" is the marker ID.
The use of do_command (0/17) has been observed in two locations in Sam & Max. The first is in the opening credits -- the following do_command call is made after all the credits have finished coming up on the screen:
IMuseInternal::do_command (17, 89, 0, 1, 8, 6, 0, 0);
At the end of the credits music (sound resource #89), the following SysEx event is encountered:
SysEx: 00 01 F7
The last four parameters of the do_command call actually map to the first four parameters of the do_command call that should occur once the marker is encountered.
The other location where do_command (0/17) is observed is at the Gator Golf entrance. A short intro music is played, which is then supposed to flow into a much longer main song. Upon entrance to the room, the following do_command call is made:
IMuseInternal::do_command (17, 31, 0, 1, 8, 30, 0, 0);
At the end of the short intro music (sound resource #31), the following SysEx event is encountered:
SysEx: 00 01 F7
This implementation properly transitions into the main Gator Golf music. However, its correctness of behavior has not been validated with the opening credit music (which should flow into the "walking into the office" music after the credits), possibly because the office scene is brought up (and at least one other music resource activated) long before the credits music finishes playing. This is an issue related to the use of do_command (param == 1, cmd == 0), which I am still investigating.
Note that other music resources include SysEx 00 xx (F7) events (including a whole glut of them during the credits music that seem to use marker IDs corresponding to measure numbers). However, there is no expected exceptional behavior at these points in the music, and since no calls to do_command (0/17) are ever made that relate to these markers, no action is taken by this implementation. I believe this is correct: for most music, the SysEx 00 01 (F7) seems to appear as a general-purpose end-of-song marker for most songs.
Regarding the implementation of ImSetTrigger, I have deviated slightly from the implementation notes that Mike provided to Ender in his disassembly efforts for the Sam & Max IMuse. In those notes, the 16 possible triggers are scoped at the IMuseInternal level, and include the player ID they are related to. In my implementation, I have put the trigger information into each of the players (16 max players, BTW) directly. This may not be the right thing to do; if certain calls to do_command (0/17) involve sound resources that have not started playing yet, this implementation would fail to set up the trigger. Maybe somebody more familiar with the scope of Mike's work could tell me if I'm taking his interpretation of the IMuse opcodes too literally.
Finally, the implementation of ImCheckTrigger and ImClearTrigger should follow easily from this implementation. I will submit a separate patch with those implementations, once this patch has been validated.
NOTE: Part of patch #620994 (do_command param == 1, cmd == 1) is included in this patch, just because the outstanding mods I have on imuse.cpp are starting to get extensive and intermingled. Sorry....
Ticket imported from: #621821. Ticket imported from: patches/193.
Attachments (2)
Change History (8)
by , 22 years ago
Attachment: | imuse.imsettrigger.diff added |
---|
comment:1 by , 22 years ago
Owner: | set to |
---|
comment:2 by , 22 years ago
I can't tell what of this is an intermingled patch and whats part of the setTrigger implementation :P
Can you please checkout another tree with the latest CVS, apply the mods you want, and either submit a revision to this patch or commit it yourself... I don't understand enough of this code to work out which of this I can apply.
by , 22 years ago
Attachment: | imuse.imsettrigger2.diff added |
---|
Revised patch against imuse.cpp 1.52 (October 11)
comment:3 by , 22 years ago
Revised patch is based on 1.52, and is solely related to ImSetTrigger changes.
Okay, I take that back. It also implements do_command (param == 1, cmd == 1), which is an unconditional jump from what I can tell. The only place I've observed this is in the Sam & Max USA Map, where the music is supposed to change as soon as you click on your destination. That change appears to be effected through the use of do_command (a = 257 means param == 1, cmd == 1).
comment:5 by , 22 years ago
Status: | new → closed |
---|
comment:6 by , 6 years ago
Component: | → Engine: SCUMM |
---|---|
Game: | → Sam and Max |
Patch against imuse.cpp 1.45 (October 9)