XM Support
HCGE uses a custom-built playback system for XM modules, with the following features:
XM Event Functions
"XM Event Functions" are Functions that are assigned to run whenever XM module playback encounters a "Zxx" Effect. This is managed by use of the "_XM_SetEventFunc" Script Command, and can be used to create interactive Music that causes events to happen within the game, or causes the music itself to respond to certain game states. This Function is used for all XM songs that are played, until the "_XM_SetEventFunc" Script Command is used again to set another.
When the "Zxx" Effect is reached, the "XMEffectParam" Register will be set equal to the Effect Parameter ("xx") that accompanies it, so
that it may be read by the Scripted "Event Function" to determine what exactly should be made to happen.
If a "Zone" or "Act" Function is used, it will become invalid as soon as a new "Zone" or "Act" is loaded, and will be unset. The "_XM_SetEventFunc" Script Command must then be used to assign a new Function to run for the "Zxx" Effect. "Game" Functions will remain valid until a new Game is loaded.
Any "XM Event Function" may use the "_XM_DoEffect" Script Command to cause the given XM Effect to be applied to the Channel that used the "Zxx" Effect. A common use for this functionality might be to trigger Pattern/Row breaks at certain points within the song to cause the Music to play differently as the game environment changes.
The "_XM_DoEffect" Script Command may also be used in any other Function to call any XM Effect that affects the song as a whole, but not any Effect that applies only to one Channel.
XM Effects Support
Hex | | Name | | Effect | | Support |
00xx | | (0xx) | | Appergio | | Yes |
01xx | | (1xx) | | Porta Up | | Yes |
02xx | | (2xx) | | Porta Down | | Yes |
03xx | | (3xx) | | Tone Porta | | Yes |
04xx | | (4xx) | | Vibrato | | Yes |
05xx | | (5xx) | | Tone Porta + Vol Slide | | Yes |
06xx | | (6xx) | | Vibrato + Vol Slide | | Yes |
07xx | | (7xx) | | Tremolo | | Yes |
08xx | | (8xx) | | Set Panning | | Yes |
09xx | | (9xx) | | Sample Offset | | Yes |
0Axx | | (Axx) | | Volume Slide | | Yes |
0Bxx | | (Bxx) | | Pattern Branch | | Yes |
0Cxx | | (Cxx) | | Volume Set | | Yes |
0Dxx | | (Dxx) | | Pattern break to row | | Yes |
0E0x | | (E0x) | | Unused | | Unused |
0E1x | | (E1x) | | Fine Porta Up | | Yes |
0E2x | | (E2x) | | Fine Porta Down | | Yes |
0E3x | | (E3x) | | Glissando Control | | No |
0E4x | | (E4x) | | Vibrato Control | | Yes |
0E5x | | (E5x) | | Set Finetune | | No |
0E6x | | (E6x) | | Set/Do Loop | | Yes |
0E7x | | (E7x) | | Tremolo Control | | Yes |
0E8x | | (E8x) | | "Set Panning" | | No |
0E9x | | (E9x) | | Retrigger Note | | Yes |
0EAx | | (EAx) | | Fine Vol Slide Up | | Yes |
0EBx | | (EBx) | | Fine Vol Slide Down | | Yes |
0ECx | | (ECx) | | Note Cut | | Yes |
0EDx | | (EDx) | | Note Delay | | Yes |
0EEx | | (EEx) | | Pattern Delay | | No |
0EFx | | (EFx) | | "Set Active Macro" | | No |
0Fxx | | (Fxx) | | Set Tempo/BPM | | Yes |
10xx | | (Gxx) | | Set Global Volume | | Yes |
11xx | | (Hxx) | | Global Volume Slide | | No |
12xx | | (Ixx) | | Unused | | Unused |
13xx | | (Jxx) | | Unused | | Unused |
14xx | | (Kxx) | | Key Off | | Yes |
15xx | | (Lxx) | | Set Envelope Position | | No |
16xx | | (Mxx) | | Unused | | Unused |
17xx | | (Nxx) | | Unused | | Unused |
18xx | | (Oxx) | | Unused | | Unused |
19xx | | (Pxx) | | Panning Slide | | No |
1Axx | | (Qxx) | | Unused | | Unused |
1Bxx | | (Rxx) | | Multi Retrigger Note | | Yes |
1Cxx | | (Sxx) | | Unused | | Unused |
1Dxx | | (Txx) | | Tremor | | No |
1Exx | | (Uxx) | | Unused | | Unused |
1Fxx | | (Vxx) | | Unused | | Unused |
20xx | | (Wxx) | | Unused | | Unused |
210x | | (X0x) | | Unused | | Unused |
211x | | (X1x) | | Extra Fine Porta Up | | No |
212x | | (X2x) | | Extra Fine Porta Down | | No |
22xx | | (Yxx) | | Unused | | Unused |
23xx | | (Zxx) | | "Midi Macro" | | Used for "XM Events" |