FMTOWNS: Missing opcodes
|Reported by:||SF/hibernatus||Owned by:||athrxx|
Hi, here are what the missing FM Towns opcodes are supposed to do:
in resourceRoutines: - case 0x20: Does nothing. Never used.
- case 0x21: Does nothing. Never used.
- case 0x23: Sets the CD loudness (just a guess, not confirmed by UNZ). Used in Loom (CD loudness divided by 2 while a pattern is played). Not implemented in Indy3 (it reads getVarOrDirectByte (0x20) and breaks). Takes 2 bytes (resid and foo in the current code). Must be for stereo, but then left == right everywhere.
- case 0x24: Sets the loudness of a sound resource. Used in Indy3 and Zak. My guess is that foo is left loudness and bar is right loudness, but UNZ doesn't play stereo :) If foo + bar == 0 (which includes FF + 01 for example), the default loudness will be used. The default loudness is at 0x0E and 0x0F in the sound resource.
- case 0x25: Sets the pitch of a sound resource. Used in Indy3 and Loom. If foo == 0, the sound is played normally. pitch = foo - center semitones. "center" is at 0x32 in the sfx resource (always 0x3C in zak256, but sometimes different in Indy3).
in startMusic: - case 0xFF: Gets the CD loudness. Used in Loom (when the CD loudness is divided by 2 with resourceRoutines) It returns (left + right + 1) / 2.
About the loudness and pitch: In the original engine there's an array which contains the loudness and the pitch of each sound. After a sound is played (startSound), the pitch and loudness are reset. So if you set a pitch +1 and then play the sound twice you'll hear +1 then +0. At least that's how it worked with Indy3.
(for ender: i had already added a struct in the disassembly, now you can replace field0 by count, field1 by left, field2 by right and field3 by pitch)
Ticket imported from: #805691. Ticket imported from: feature-requests/131.