shithub: pokecrystal

Download patch

ref: 9d4dd09b86a68fff9e46f4f1be28cd86e336c5dd
parent: 5fd3e591df48ca081726cde12d9991fa52a1c839
author: dannye <[email protected]>
date: Tue Sep 3 20:17:10 EDT 2019

Add legacy audio macros

--- a/macros/legacy.asm
+++ b/macros/legacy.asm
@@ -7,7 +7,87 @@
 callab EQUS "callfar"
 
 ; macros/scripts/audio.asm
+__ EQU 0
+CC EQU 13
+
+musicheader: MACRO
+	channel_count \1
+	channel \2, \3
+ENDM
+
+sound: MACRO
+	note \1, \2
+	db \3
+	dw \4
+ENDM
+
+noise: MACRO
+	note \1, \2
+	db \3
+	db \4
+ENDM
+
+notetype: MACRO
+IF _NARG >= 2
+	note_type \1, \2 >> 4, \2 & $0f
+ELSE
+	note_type \1
+ENDC
+ENDM
+
+pitchoffset: MACRO
+	transpose \1, \2 - 1
+ENDM
+
+dutycycle EQUS "duty_cycle"
+
+intensity: MACRO
+	volume_envelope \1 >> 4, \1 & $0f
+ENDM
+
+soundinput: MACRO
+	pitch_sweep \1 >> 4, \1 & $0f
+ENDM
+
 unknownmusic0xde EQUS "sound_duty"
+sound_duty: MACRO
+	db $de
+IF _NARG == 4
+	db \1 | (\2 << 2) | (\3 << 4) | (\4 << 6)
+ELSE
+	db \1
+ENDC
+ENDM
+
+togglesfx EQUS "toggle_sfx"
+
+slidepitchto: MACRO
+	pitch_slide \1, (8 - \2), \3
+ENDM
+
+togglenoise EQUS "toggle_noise"
+
+panning: MACRO
+	force_stereo_panning ((\1 >> 4) & 1), (\1 & 1)
+ENDM
+
+tone           EQUS "pitch_offset"
+restartchannel EQUS "restart_channel"
+newsong        EQUS "new_song"
+sfxpriorityon  EQUS "sfx_priority_on"
+sfxpriorityoff EQUS "sfx_priority_off"
+
+stereopanning: MACRO
+	stereo_panning ((\1 >> 4) & 1), (\1 & 1)
+ENDM
+
+sfxtogglenoise EQUS "sfx_toggle_noise"
+setcondition   EQUS "set_condition"
+jumpif         EQUS "sound_jump_if"
+jumpchannel    EQUS "sound_jump"
+loopchannel    EQUS "sound_loop"
+callchannel    EQUS "sound_call"
+endchannel     EQUS "sound_ret"
 
 ; macros/scripts/events.asm
 
--- a/macros/scripts/audio.asm
+++ b/macros/scripts/audio.asm
@@ -134,7 +134,11 @@
 vibrato: MACRO
 	db vibrato_cmd
 	db \1 ; delay
-	dn \2, \3 ; extent, rate
+	IF _NARG > 2
+		dn \2, \3 ; extent, rate
+	ELSE
+		db \2 ; LEGACY: Support for 1-arg extent
+	ENDC
 ENDM
 
 	enum unknownmusic0xe2_cmd ; $e2
@@ -158,7 +162,11 @@
 	enum volume_cmd ; $e5
 volume: MACRO
 	db volume_cmd
-	dn \1, \2 ; left volume, right volume
+	IF _NARG > 1
+		dn \1, \2 ; left volume, right volume
+	ELSE
+		db \1 ; LEGACY: Support for 1-arg volume
+	ENDC
 ENDM
 
 	enum pitch_offset_cmd ; $e6