Skip to content

Commit 8072c5c

Browse files
committed
Add macro command 0x31 for its only user, Turrican III title, where in some macro scripts it is used to trigger key up on channel/voice 0 and 1. There are rips of the soundtrack that have been modified so the macro scripts execute macro 4 Wait instead as not to break in TFMX players where macro 0x31 is missing.
1 parent ffb22fd commit 8072c5c

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/Chris/Macro.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,4 +749,13 @@ void TFMXDecoder::macroFunc_BranchIfSame(VoiceVars& voice) {
749749
}
750750
}
751751

752+
// Macro command $31. Available in e.g. Gem'Z and Turrican III players,
753+
// but only used by T3 title.
754+
void TFMXDecoder::macroFunc_KeyUp(VoiceVars& voice) {
755+
cmd.aa = 0xf5; // key up command
756+
noteCmd(); // with cmd.cd = channel number
757+
voice.macro.step++;
758+
macroEvalAgain = true;
759+
}
760+
752761
} // namespace

src/Chris/TFMXDecoder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ bool TFMXDecoder::init(void *data, udword length, int songNumber) {
395395
MacroDefs[0x29] = &macroDef_29;
396396

397397
MacroDefs[0x30] = &macroDef_BranchIfSame;
398+
MacroDefs[0x31] = &macroDef_KeyUp;
398399

399400
// TFMX v1.x up to and including v2.2 cannot be distinguished from
400401
// the later TFMX and/or variants. Unless the very rarely used old
@@ -863,7 +864,7 @@ void TFMXDecoder::noteCmd() {
863864
v.macro.branchIfSame = false;
864865
}
865866
v.macro.offset = mo;
866-
v.macro.state = 1;
867+
v.macro.state = 1; // delayed macro init
867868
}
868869
else { // cmd.aa >= $c0 portamento note
869870
v.portamento.count = cmd.bb;

src/Chris/TFMXDecoder.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,13 @@ class TFMXDecoder : public Decoder {
553553
&TFMXDecoder::macroFunc_BranchIfSame
554554
};
555555

556+
// NB! This macro command is not named anywhere. It's used only by
557+
// Turrican III title.
558+
void macroFunc_KeyUp(VoiceVars&);
559+
MacroDef macroDef_KeyUp = { "Key up ../.x/.. channel",
560+
&TFMXDecoder::macroFunc_KeyUp
561+
};
562+
556563

557564
bool trackCmdUsed[TRACK_CMD_MAX+1];
558565
bool patternCmdUsed[16];

0 commit comments

Comments
 (0)