diff --git a/src/constants/charmaps.asm b/src/constants/charmaps.asm index 51474ca..127ac10 100644 --- a/src/constants/charmaps.asm +++ b/src/constants/charmaps.asm @@ -10,7 +10,7 @@ charmap "É", "@" charmap "é", "`" -fwcharmap: MACRO +MACRO fwcharmap charmap STRCAT("FW\1_", \2), \3 ENDM @@ -324,7 +324,7 @@ ENDM FW_SPACE EQU $70 -txsymbol: MACRO +MACRO txsymbol const SYM_\1 charmap "\1>", const_value - 1 ENDM diff --git a/src/constants/deck_constants.asm b/src/constants/deck_constants.asm index f64b834..a88e5ee 100644 --- a/src/constants/deck_constants.asm +++ b/src/constants/deck_constants.asm @@ -1,7 +1,7 @@ -deck_const: MACRO -if const_value >= 2 -\1_ID EQU const_value - 2 -endc +MACRO deck_const + if const_value >= 2 + DEF \1_ID EQU const_value - 2 + endc const \1 ENDM diff --git a/src/data/auto_deck_machines.asm b/src/data/auto_deck_machines.asm index 044dba2..f685837 100644 --- a/src/data/auto_deck_machines.asm +++ b/src/data/auto_deck_machines.asm @@ -3,7 +3,7 @@ ; (see data/auto_deck_card_lists.asm) and two text IDs ; for the corresponding deck name and description/flavor text -auto_deck: MACRO +MACRO auto_deck dw \1 ; deck card list tx \2 ; deck name text ID tx \3 ; deck description text ID diff --git a/src/data/booster_packs.asm b/src/data/booster_packs.asm index 51bb8c2..7f43116 100644 --- a/src/data/booster_packs.asm +++ b/src/data/booster_packs.asm @@ -7,7 +7,7 @@ BoosterSetRarityAmountsTable: ; 1e4d4 (7::64d4) db 0, 6, 3, 1 ; MYSTERY db 0, 6, 3, 1 ; LABORATORY -booster_set: MACRO +MACRO booster_set db \1 >> 4 ENDM diff --git a/src/data/duel/ai_trainer_card_logic.asm b/src/data/duel/ai_trainer_card_logic.asm index 57bf90f..4b00886 100644 --- a/src/data/duel/ai_trainer_card_logic.asm +++ b/src/data/duel/ai_trainer_card_logic.asm @@ -1,4 +1,4 @@ -ai_trainer_card_logic: MACRO +MACRO ai_trainer_card_logic db \1 ; AI_TRAINER_CARD_PHASE_* constant db \2 ; ID of trainer card dw \3 ; function for AI decision to play card diff --git a/src/data/duel/animations/attack_animations.asm b/src/data/duel/animations/attack_animations.asm index 48fa192..af75efc 100644 --- a/src/data/duel/animations/attack_animations.asm +++ b/src/data/duel/animations/attack_animations.asm @@ -1,22 +1,22 @@ -anim_end: MACRO +MACRO anim_end db $00 ENDM -anim_normal: MACRO +MACRO anim_normal db $01, \1 ENDM -anim_player: MACRO +MACRO anim_player db $02, \1 ENDM -anim_opponent: MACRO +MACRO anim_opponent db $03, \1 ENDM -anim_unknown: MACRO +MACRO anim_unknown db $04, \1 ENDM -anim_unknown2: MACRO +MACRO anim_unknown2 db $05, \1 ENDM -anim_end2: MACRO +MACRO anim_end2 db $06 ENDM diff --git a/src/data/duel/practice_text.asm b/src/data/duel/practice_text.asm index d28e7fa..29399e4 100644 --- a/src/data/duel/practice_text.asm +++ b/src/data/duel/practice_text.asm @@ -8,7 +8,7 @@ PracticeDuelTextPointerTable: dw PracticeDuelText_Turn7 dw PracticeDuelText_Turn8 -practicetext: MACRO +MACRO practicetext db \1 ; Y coord to place the point-by-point instruction tx \2 ; Dr. Mason's instruction tx \3 ; static point-by-point instruction diff --git a/src/data/map_ow_framesets.asm b/src/data/map_ow_framesets.asm index 61bf45d..b2c4faf 100644 --- a/src/data/map_ow_framesets.asm +++ b/src/data/map_ow_framesets.asm @@ -17,7 +17,7 @@ INCLUDE "data/map_ow_frameset_pointers.asm" ; \3 = VRAM bank ; \4 = tileset ; \5 = tileset offset -ow_frame: MACRO +MACRO ow_frame db \1 db \2 db \3 diff --git a/src/data/palette_pointers.asm b/src/data/palette_pointers.asm index 8a0d71a..cf4b838 100644 --- a/src/data/palette_pointers.asm +++ b/src/data/palette_pointers.asm @@ -1,7 +1,7 @@ ; \1 = palette pointer ; \2 = number of palettes ; \3 = number of OBJ colors -palette_pointer: MACRO +MACRO palette_pointer dwb \1, BANK(\1) - BANK(Palettes) db (\2 << 4) + \3 ENDM diff --git a/src/data/sprite_animation_pointers.asm b/src/data/sprite_animation_pointers.asm index 7c432c6..f80bfb8 100644 --- a/src/data/sprite_animation_pointers.asm +++ b/src/data/sprite_animation_pointers.asm @@ -1,5 +1,5 @@ ; \1 = anim data pointer -anim_data_pointer: MACRO +MACRO anim_data_pointer dwb \1, BANK(\1) - BANK(SpriteAnimations) db $00 ; unused (padding?) ENDM diff --git a/src/engine/duel/ai/deck_ai.asm b/src/engine/duel/ai/deck_ai.asm index b46de01..e8b451b 100644 --- a/src/engine/duel/ai/deck_ai.asm +++ b/src/engine/duel/ai/deck_ai.asm @@ -3,7 +3,7 @@ ; a Pokemon to switch to, it looks up in this list and if ; a card ID matches, applies a retreat score bonus to this card. ; positive (negative) means more (less) likely to switch to this card. -ai_retreat: MACRO +MACRO ai_retreat db \1 ; card ID db $80 + \2 ; retreat score (ranges between -128 and 127) ENDM @@ -14,7 +14,7 @@ ENDM ; a card ID matches, skips this card if the maximum number of energy ; cards attached has been reached. If it hasn't been reached, additionally ; applies a positive (or negative) AI score to attach energy to this card. -ai_energy: MACRO +MACRO ai_energy db \1 ; card ID db \2 ; maximum number of attached cards db $80 + \3 ; energy score (ranges between -128 and 127) @@ -22,7 +22,7 @@ ENDM ; stores in WRAM pointer to data in argument ; e.g. store_list_pointer wSomeListPointer, SomeData -store_list_pointer: MACRO +MACRO store_list_pointer ld hl, \1 ld de, \2 ld [hl], e diff --git a/src/engine/duel/animations/core.asm b/src/engine/duel/animations/core.asm index 142183f..e6da092 100644 --- a/src/engine/duel/animations/core.asm +++ b/src/engine/duel/animations/core.asm @@ -242,7 +242,7 @@ AnimationCoordinatesIndex: db $09, $0a, $0b, $0c, $0d, $0e ; player db $09, $0a, $0b, $0c, $0d, $0e ; opponent -anim_coords: MACRO +MACRO anim_coords db \1 db \2 db \3 diff --git a/src/engine/duel/animations/screen_effects.asm b/src/engine/duel/animations/screen_effects.asm index 6d8139c..e85e10d 100644 --- a/src/engine/duel/animations/screen_effects.asm +++ b/src/engine/duel/animations/screen_effects.asm @@ -33,7 +33,7 @@ InitScreenAnimation: ; and is decreased by one each time. ; when it is down to 0, the animation is done. -screen_effect: MACRO +MACRO screen_effect dw \1 ; function pointer db \2 ; duration db $00 ; padding diff --git a/src/engine/gfx/sprites.asm b/src/engine/gfx/sprites.asm index c2aa277..914da08 100644 --- a/src/engine/gfx/sprites.asm +++ b/src/engine/gfx/sprites.asm @@ -1,6 +1,6 @@ ; \1 = gfx pointer ; \2 = number of tiles -gfx_pointer: MACRO +MACRO gfx_pointer dwb \1, BANK(\1) - BANK(Sprites) db \2 ENDM diff --git a/src/engine/gfx/tilemaps.asm b/src/engine/gfx/tilemaps.asm index 216cca1..9e37048 100644 --- a/src/engine/gfx/tilemaps.asm +++ b/src/engine/gfx/tilemaps.asm @@ -1,6 +1,6 @@ ; \1 = pointer ; \2 = tileset -tilemap: MACRO +MACRO tilemap dwb \1, BANK(\1) - BANK(Tilemaps) db \2 ENDM diff --git a/src/engine/gfx/tilesets.asm b/src/engine/gfx/tilesets.asm index 0b4f0af..41d4b54 100644 --- a/src/engine/gfx/tilesets.asm +++ b/src/engine/gfx/tilesets.asm @@ -1,6 +1,6 @@ ; \1 = pointer ; \2 = number of tiles -tileset: MACRO +MACRO tileset dwb \1, BANK(\1) - BANK(Tilesets) db \2 ENDM diff --git a/src/engine/input_name.asm b/src/engine/input_name.asm index 472aba3..78b8b8c 100644 --- a/src/engine/input_name.asm +++ b/src/engine/input_name.asm @@ -782,15 +782,15 @@ GetCharInfoFromPos_Player: ; structure: ; abs. y pos. (1) / abs. x pos. (1) / type 1 (1) / type 2 (1) / char. code (2) ; unused data contains its character code as zero. -kbitem: MACRO +MACRO kbitem db \1, \2, \3, \4 -if (_NARG == 5) - dw \5 -elif (\5 == TX_FULLWIDTH3) - dw (\5 << 8) | STRCAT("FW3_", \6) -else - dw (\5 << 8) | \6 -endc + if (_NARG == 5) + dw \5 + elif (\5 == TX_FULLWIDTH3) + dw (\5 << 8) | STRCAT("FW3_", \6) + else + dw (\5 << 8) | \6 + endc ENDM KeyboardData_Player: diff --git a/src/engine/menus/glossary.asm b/src/engine/menus/glossary.asm index aa42851..44bef43 100644 --- a/src/engine/menus/glossary.asm +++ b/src/engine/menus/glossary.asm @@ -192,7 +192,7 @@ OpenGlossaryScreen: ; unit: 5 bytes. ; [structure] ; horizontal align (1) / title text id (2) / desc. text id (2) -glossary_entry: MACRO +MACRO glossary_entry db \1 tx \2 tx \3 diff --git a/src/engine/menus/play_area.asm b/src/engine/menus/play_area.asm index 0a09953..9fbd516 100644 --- a/src/engine/menus/play_area.asm +++ b/src/engine/menus/play_area.asm @@ -324,7 +324,7 @@ OpenInPlayAreaScreen_TextTable: tx PKMNPowerText ; INPLAYAREA_OPP_BENCH_4 tx DoneText ; INPLAYAREA_OPP_BENCH_5 -in_play_area_cursor_transition: MACRO +MACRO in_play_area_cursor_transition cursor_transition \1, \2, \3, INPLAYAREA_\4, INPLAYAREA_\5, INPLAYAREA_\6, INPLAYAREA_\7 ENDM diff --git a/src/engine/save.asm b/src/engine/save.asm index 2674b91..44221b6 100644 --- a/src/engine/save.asm +++ b/src/engine/save.asm @@ -447,7 +447,7 @@ LoadGeneralSaveDataFromDE: pop hl ret -wram_sram_map: MACRO +MACRO wram_sram_map dw \1 ; WRAM address dw \2 ; number of bytes db \3 ; min allowed value diff --git a/src/engine/sequences/credits_sequence_commands.asm b/src/engine/sequences/credits_sequence_commands.asm index bb60305..21241d7 100644 --- a/src/engine/sequences/credits_sequence_commands.asm +++ b/src/engine/sequences/credits_sequence_commands.asm @@ -165,7 +165,7 @@ CreditsSequenceCmd_LoadClubMap: ; 1d897 (7:5897) .done jp AdvanceCreditsSequenceCmdPtrBy3 -credits_club_map: MACRO +MACRO credits_club_map db \1 ; x db \2 ; y db \3 ; OW map diff --git a/src/engine/sgb.asm b/src/engine/sgb.asm index 1e82e73..a23f5be 100644 --- a/src/engine/sgb.asm +++ b/src/engine/sgb.asm @@ -366,7 +366,7 @@ FillSGBBorderMedalSlots: jr nz, .loop_medals ret -border_medal_tile: MACRO +MACRO border_medal_tile dw \1 ; VRAM address db \2 ; tile db \3 ; pal (?) diff --git a/src/macros/audio.asm b/src/macros/audio.asm index 4bc6d91..45f3aca 100644 --- a/src/macros/audio.asm +++ b/src/macros/audio.asm @@ -1,116 +1,116 @@ -C_: MACRO +MACRO C_ db $10 | (\1 - 1) ENDM -C#: MACRO +MACRO C# db $20 | (\1 - 1) ENDM -D_: MACRO +MACRO D_ db $30 | (\1 - 1) ENDM -D#: MACRO +MACRO D# db $40 | (\1 - 1) ENDM -E_: MACRO +MACRO E_ db $50 | (\1 - 1) ENDM -F_: MACRO +MACRO F_ db $60 | (\1 - 1) ENDM -F#: MACRO +MACRO F# db $70 | (\1 - 1) ENDM -G_: MACRO +MACRO G_ db $80 | (\1 - 1) ENDM -G#: MACRO +MACRO G# db $90 | (\1 - 1) ENDM -A_: MACRO +MACRO A_ db $a0 | (\1 - 1) ENDM -A#: MACRO +MACRO A# db $b0 | (\1 - 1) ENDM -B_: MACRO +MACRO B_ db $c0 | (\1 - 1) ENDM -bass: MACRO +MACRO bass db $10 | (\1 - 1) ENDM -snare1: MACRO ; medium length +MACRO snare1 ; medium length db $30 | (\1 - 1) ENDM -snare2: MACRO ; medium length +MACRO snare2 ; medium length db $50 | (\1 - 1) ENDM -snare3: MACRO ; short +MACRO snare3 ; short db $70 | (\1 - 1) ENDM -snare4: MACRO ; long +MACRO snare4 ; long db $90 | (\1 - 1) ENDM -snare5: MACRO ; long +MACRO snare5 ; long db $c0 | (\1 - 1) ENDM -rest: MACRO +MACRO rest db \1 - 1 ENDM -speed: MACRO +MACRO speed db $d0, \1 ENDM -octave: MACRO +MACRO octave db ($d << 4) | \1 ENDM -inc_octave: MACRO +MACRO inc_octave db $d7 ENDM -dec_octave: MACRO +MACRO dec_octave db $d8 ENDM -tie: MACRO +MACRO tie db $d9 ENDM -stereo_panning: MACRO +MACRO stereo_panning db $dc, (\1 << 4) | \2 ENDM -MainLoop: MACRO +MACRO MainLoop db $dd ENDM -EndMainLoop: MACRO +MACRO EndMainLoop db $de ENDM -Loop: MACRO +MACRO Loop db $df, \1 ENDM -EndLoop: MACRO +MACRO EndLoop db $e0 ENDM @@ -120,44 +120,44 @@ ENDM ; dw \1 ;ENDM -music_call: MACRO +MACRO music_call db $e2 dw \1 ENDM -music_ret: MACRO +MACRO music_ret db $e3 ENDM -frequency_offset: MACRO +MACRO frequency_offset db $e4, \1 ENDM -duty: MACRO +MACRO duty db $e5, \1 << 6 ENDM -volume: MACRO +MACRO volume db $e6, \1 ENDM -wave: MACRO +MACRO wave db $e7, \1 ENDM -cutoff: MACRO +MACRO cutoff db $e8, \1 ENDM -echo: MACRO +MACRO echo db $e9, \1 ENDM -vibrato_type: MACRO +MACRO vibrato_type db $ea, \1 ENDM -vibrato_delay: MACRO +MACRO vibrato_delay db $eb, \1 ENDM @@ -171,42 +171,42 @@ ENDM ; db $ed, \1 ;ENDM -music_end: MACRO +MACRO music_end db $ff ENDM -sfx_0: MACRO +MACRO sfx_0 db \1, \2 ENDM -sfx_1: MACRO +MACRO sfx_1 db $10, \1 ENDM -sfx_2: MACRO +MACRO sfx_2 db $20 | \1 ENDM -sfx_loop: MACRO +MACRO sfx_loop db $30, \1 ENDM -sfx_endloop: MACRO +MACRO sfx_endloop db $40 ENDM -sfx_5: MACRO +MACRO sfx_5 db $50, \1 ENDM -sfx_6: MACRO +MACRO sfx_6 db $60, \1 ENDM -sfx_8: MACRO +MACRO sfx_8 db $80, \1 ENDM -sfx_end: MACRO +MACRO sfx_end db $f0 ENDM diff --git a/src/macros/code.asm b/src/macros/code.asm index c71e9e6..c7e821e 100644 --- a/src/macros/code.asm +++ b/src/macros/code.asm @@ -1,59 +1,59 @@ -lb: MACRO ; r, hi, lo +MACRO lb ; r, hi, lo ld \1, (\2) << 8 + ((\3) & $ff) ENDM -ldtx: MACRO -if _NARG == 2 - ld \1, \2_ -else - ld \1, \2_ \3 -endc +MACRO ldtx + if _NARG == 2 + ld \1, \2_ + else + ld \1, \2_ \3 + endc ENDM -bank1call: MACRO +MACRO bank1call rst $18 dw \1 ENDM -farcall: MACRO +MACRO farcall rst $28 -if _NARG == 1 - db BANK(\1) - dw \1 -else - db \1 - dw \2 -endc + if _NARG == 1 + db BANK(\1) + dw \1 + else + db \1 + dw \2 + endc ENDM ; runs SetEventValue with the next byte as the event, c as the new value -set_event_value: MACRO +MACRO set_event_value call SetStackEventValue db \1 ENDM ; runs ZeroOutEventValue with the next byte as the event ; functionally identical to set_event_zero but intended for single-bit events -set_event_false: MACRO +MACRO set_event_false call SetStackEventFalse db \1 ENDM ; runs ZeroOutEventValue with the next byte as the event ; functionally identical to set_event_false but intended for multi-bit events -set_event_zero: MACRO +MACRO set_event_zero call SetStackEventZero db \1 ENDM ; runs MaxOutEventValue with the next byte as the event -max_event_value: MACRO +MACRO max_event_value call MaxStackEventValue db \1 ENDM ; runs GetEventValue with the next byte as the event. returns value in a -get_event_value: MACRO +MACRO get_event_value call GetStackEventValue db \1 ENDM @@ -63,7 +63,7 @@ ENDM debug_nop EQUS "rst $38" ; Returns to the pointer in bc instead of where the stack was. -retbc: MACRO +MACRO retbc push bc ret ENDM diff --git a/src/macros/constants.asm b/src/macros/constants.asm index 4387841..47b7662 100644 --- a/src/macros/constants.asm +++ b/src/macros/constants.asm @@ -1,17 +1,17 @@ -const_def: MACRO -if _NARG > 0 -const_value = \1 -else -const_value = 0 -endc +MACRO const_def + if _NARG > 0 + DEF const_value = \1 + else + DEF const_value = 0 + endc ENDM -const: MACRO -\1 EQU const_value -const_value = const_value + 1 +MACRO const + DEF \1 EQU const_value + DEF const_value = const_value + 1 ENDM -event_def: MACRO +MACRO event_def db \1 db \2 ENDM diff --git a/src/macros/credits_sequence.asm b/src/macros/credits_sequence.asm index e7d111d..7fb37b5 100644 --- a/src/macros/credits_sequence.asm +++ b/src/macros/credits_sequence.asm @@ -1,25 +1,25 @@ -credits_seq_disable_lcd: MACRO +MACRO credits_seq_disable_lcd dw CreditsSequenceCmd_DisableLCD ENDM ; x coordinate ; y coordinate ; OVERWORLD_* constant -credits_seq_load_ow_map: MACRO +MACRO credits_seq_load_ow_map dw CreditsSequenceCmd_LoadOWMap db \1, \2, \3 ENDM -credits_seq_init_volcano_sprite: MACRO +MACRO credits_seq_init_volcano_sprite dw CreditsSequenceCmd_InitVolcanoSprite ENDM -credits_seq_init_overlay: MACRO +MACRO credits_seq_init_overlay dw CreditsSequenceCmd_InitOverlay db \1, \2, \3, \4 ENDM -credits_seq_transform_overlay: MACRO +MACRO credits_seq_transform_overlay dw CreditsSequenceCmd_TransformOverlay db \1, \2, \3, \4 ENDM @@ -27,7 +27,7 @@ ENDM ; x coordinate ; y coordinate ; text ID -credits_seq_print_text_box: MACRO +MACRO credits_seq_print_text_box dw CreditsSequenceCmd_PrintTextBox db \1, \2 tx \3 @@ -36,22 +36,22 @@ ENDM ; x coordinate ; y coordinate ; text ID -credits_seq_print_text: MACRO +MACRO credits_seq_print_text dw CreditsSequenceCmd_PrintText db \1, \2 tx \3 ENDM -credits_seq_fade_in: MACRO +MACRO credits_seq_fade_in dw CreditsSequenceCmd_FadeIn ENDM -credits_seq_fade_out: MACRO +MACRO credits_seq_fade_out dw CreditsSequenceCmd_FadeOut ENDM ; frames to wait -credits_seq_wait: MACRO +MACRO credits_seq_wait dw CreditsSequenceCmd_Wait db \1 ENDM @@ -60,14 +60,14 @@ ENDM ; y coordinate ; direction ; NPC ID -credits_seq_load_npc: MACRO +MACRO credits_seq_load_npc dw CreditsSequenceCmd_LoadNPC db \1, \2, \3, \4 ENDM ; y offset ; heigh -credits_seq_draw_rectangle: MACRO +MACRO credits_seq_draw_rectangle dw CreditsSequenceCmd_DrawRectangle db \1, \2 ENDM @@ -75,7 +75,7 @@ ENDM ; x coordinate ; y coordinate ; scene ID -credits_seq_load_scene: MACRO +MACRO credits_seq_load_scene dw CreditsSequenceCmd_LoadScene db \1, \2, \3 ENDM @@ -83,17 +83,17 @@ ENDM ; x coordinate ; y coordinate ; booster scene ID -credits_seq_load_booster: MACRO +MACRO credits_seq_load_booster dw CreditsSequenceCmd_LoadBooster db \1, \2, \3 ENDM ; index of beaten Club Master -credits_seq_load_club_map: MACRO +MACRO credits_seq_load_club_map dw CreditsSequenceCmd_LoadClubMap db \1 ENDM -credits_seq_end: MACRO +MACRO credits_seq_end credits_seq_wait $ff ENDM diff --git a/src/macros/data.asm b/src/macros/data.asm index 17c4b8e..75523dd 100644 --- a/src/macros/data.asm +++ b/src/macros/data.asm @@ -1,93 +1,93 @@ -dn: MACRO +MACRO dn db \1 << 4 | \2 ENDM -dbw: MACRO +MACRO dbw db \1 dw \2 ENDM -dwb: MACRO +MACRO dwb dw \1 db \2 ENDM -dx: MACRO -x = 8 * ((\1) - 1) +MACRO dx + DEF x = 8 * ((\1) - 1) rept \1 - db ((\2) >> x) & $ff -x = x - 8 + db ((\2) >> x) & $ff + DEF x = x - 8 endr - ENDM +ENDM -dt: MACRO ; three-byte (big-endian) +MACRO dt ; three-byte (big-endian) dx 3, \1 - ENDM +ENDM -dd: MACRO ; four-byte (big-endian) +MACRO dd ; four-byte (big-endian) dx 4, \1 - ENDM +ENDM -bigdw: MACRO ; big-endian word +MACRO bigdw ; big-endian word dx 2, \1 - ENDM +ENDM -sgb: MACRO +MACRO sgb db \1 << 3 + \2 ; sgb_command * 8 + length ENDM -rgb: MACRO +MACRO rgb dw (\3 << 10 | \2 << 5 | \1) ENDM ; poketcg specific macros below -textpointer: MACRO +MACRO textpointer dw ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) & $ffff db ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) >> 16 const \1_ -EXPORT \1_ + EXPORT \1_ ENDM -energy: MACRO -en = 0 -if _NARG > 1 - rept _NARG / 2 -x = 4 - 8 * (\1 % 2) -en = en + \2 << ((\1 * 4) + x) - shift - shift - endr - rept NUM_TYPES / 2 - db LOW(en) -en = en >> 8 - endr -else - db 0, 0, 0, 0 -endc +MACRO energy + DEF en = 0 + if _NARG > 1 + rept _NARG / 2 + DEF x = 4 - 8 * (\1 % 2) + DEF en = en + \2 << ((\1 * 4) + x) + shift + shift + endr + rept NUM_TYPES / 2 + db LOW(en) + DEF en = en >> 8 + endr + else + db 0, 0, 0, 0 + endc ENDM -gfx: MACRO +MACRO gfx dw ($4000 * (BANK(\1) - BANK(CardGraphics)) + (\1 - $4000)) / 8 ENDM -frame_table: MACRO +MACRO frame_table db BANK(\1) - BANK(AnimData1) ; maybe use better reference for Bank20? dw \1 ENDM -frame_data: MACRO +MACRO frame_data db \1 ; frame index db \2 ; anim count db \3 ; x translation db \4 ; y translation ENDM -tx: MACRO +MACRO tx dw \1_ ENDM -textitem: MACRO +MACRO textitem db \1, \2 tx \3 ENDM @@ -95,7 +95,7 @@ ENDM ; cursor x / cursor y / attribute / idx-up / idx-down / idx-right / idx-left ; idx-[direction] means the index to get when the input is in the direction. ; its attribute is used for drawing a flipped cursor. -cursor_transition: MACRO +MACRO cursor_transition db \1, \2, \3 rept 4 db \4 diff --git a/src/macros/intro_sequence.asm b/src/macros/intro_sequence.asm index 8c92b26..5344f13 100644 --- a/src/macros/intro_sequence.asm +++ b/src/macros/intro_sequence.asm @@ -1,63 +1,63 @@ -intro_seq_wait_orbs_animation: MACRO +MACRO intro_seq_wait_orbs_animation dw IntroSequenceCmd_WaitOrbsAnimation ENDM ; argument = frames to delay -intro_seq_wait: MACRO +MACRO intro_seq_wait dw IntroSequenceCmd_Wait db \1 ENDM ; argument = list of animations to set -intro_seq_set_orbs_animations: MACRO +MACRO intro_seq_set_orbs_animations dw IntroSequenceCmd_SetOrbsAnimations dw \1 ENDM ; argument = list of coordinates to set -intro_seq_set_orbs_coordinates: MACRO +MACRO intro_seq_set_orbs_coordinates dw IntroSequenceCmd_SetOrbsCoordinates dw \1 ENDM -intro_seq_play_title_screen_music: MACRO +MACRO intro_seq_play_title_screen_music dw IntroSequenceCmd_PlayTitleScreenMusic ENDM -intro_seq_wait_sfx: MACRO +MACRO intro_seq_wait_sfx dw IntroSequenceCmd_WaitSFX ENDM ; argument = SFX to play -intro_seq_play_sfx: MACRO +MACRO intro_seq_play_sfx dw IntroSequenceCmd_PlaySFX db \1 ENDM -intro_seq_fade_in: MACRO +MACRO intro_seq_fade_in dw IntroSequenceCmd_FadeIn ENDM -intro_seq_fade_out: MACRO +MACRO intro_seq_fade_out dw IntroSequenceCmd_FadeOut ENDM -intro_seq_load_charizard_scene: MACRO +MACRO intro_seq_load_charizard_scene dw IntroSequenceCmd_LoadCharizardScene ENDM -intro_seq_load_scyther_scene: MACRO +MACRO intro_seq_load_scyther_scene dw IntroSequenceCmd_LoadScytherScene ENDM -intro_seq_load_aerodactyl_scene: MACRO +MACRO intro_seq_load_aerodactyl_scene dw IntroSequenceCmd_LoadAerodactylScene ENDM -intro_seq_load_title_screen_scene: MACRO +MACRO intro_seq_load_title_screen_scene dw IntroSequenceCmd_LoadTitleScreenScene ENDM -intro_seq_end: MACRO +MACRO intro_seq_end intro_seq_wait $ff ENDM diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm index 71eabdc..58ad5e0 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -1,6 +1,6 @@ start_script EQUS "rst $20" -run_command: MACRO +MACRO run_command db \1_index ENDM @@ -113,41 +113,41 @@ ENDM ; Script Macros ; Stops the current script and returns control flow back to assembly -end_script: MACRO +MACRO end_script run_command ScriptCommand_EndScript ENDM ; Closes current dialog window -close_advanced_text_box: MACRO +MACRO close_advanced_text_box run_command ScriptCommand_CloseAdvancedTextBox ENDM ; Opens a new dialog window and displays the given text and active npc name -print_npc_text: MACRO +MACRO print_npc_text run_command ScriptCommand_PrintNPCText tx \1 ; Text Pointer ENDM ; Opens a new dialog window and displays the given text -print_text: MACRO +MACRO print_text run_command ScriptCommand_PrintText tx \1 ; Text Pointer ENDM ; Displays text and allows players to choose yes or no. Will jump on yes. ; if first argument is 0000 (NULL), will overwrite last text with yes/no. -ask_question_jump: MACRO +MACRO ask_question_jump run_command ScriptCommand_AskQuestionJump -IF ISCONST(\1) - dw \1 ; NULL -ELSE - tx \1 ; Text Pointer -ENDC + IF ISCONST(\1) + dw \1 ; NULL + ELSE + tx \1 ; Text Pointer + ENDC dw \2 ; Jump Location ENDM ; Begins a duel with the NPC currently being spoken to -start_duel: MACRO +MACRO start_duel run_command ScriptCommand_StartDuel db \1 ; Prize Amount (ex PRIZES_2) db \2 ; Deck ID (ex SAMS_PRACTICE_DECK_ID) @@ -155,44 +155,44 @@ start_duel: MACRO ENDM ; Prints the first or second npc text depending on if wScriptControlByte is nonzero or zero respectively -print_variable_npc_text: MACRO +MACRO print_variable_npc_text run_command ScriptCommand_PrintVariableNPCText tx \1 ; Text Pointer tx \2 ; Text Pointer ENDM ; Prints the first or second text depending on if wScriptControlByte is nonzero or zero respectively -print_variable_text: MACRO +MACRO print_variable_text run_command ScriptCommand_PrintVariableText tx \1 ; Text Pointer tx \2 ; Text Pointer ENDM ; Displays text then fully quits out of scripting system (Does NOT return to RST20) -print_text_quit_fully: MACRO +MACRO print_text_quit_fully run_command ScriptCommand_PrintTextQuitFully tx \1 ; Text Pointer ENDM ; Removes the current NPC from the map -unload_active_npc: MACRO +MACRO unload_active_npc run_command ScriptCommand_UnloadActiveNPC ENDM ; Moves the current NPC depending on their current direction ; Argument points to a table of 4 NPCMovements chosen based on direction value -move_active_npc_by_direction: MACRO +MACRO move_active_npc_by_direction run_command ScriptCommand_MoveActiveNPCByDirection dw \1 ; Movement Table ENDM ; Closes the textbox currently on the screen -close_text_box: MACRO +MACRO close_text_box run_command ScriptCommand_CloseTextBox ENDM ; Gives the player up to 3 booster packs. Arguments can be replaced by NO_BOOSTER -give_booster_packs: MACRO +MACRO give_booster_packs run_command ScriptCommand_GiveBoosterPacks db \1 ; booster pack (ex BOOSTER_LABORATORY_NEUTRAL) db \2 ; booster pack @@ -200,14 +200,14 @@ give_booster_packs: MACRO ENDM ; Jumps to a given script position if the player owns a card anywhere -jump_if_card_owned: MACRO +MACRO jump_if_card_owned run_command ScriptCommand_JumpIfCardOwned db \1 ; card ID (ex LAPRAS) dw \2 ; script label ENDM ; Jumps to a given script position if the player has a card specifically in their collection -jump_if_card_in_collection: MACRO +MACRO jump_if_card_in_collection run_command ScriptCommand_JumpIfCardInCollection db \1 ; card ID (ex LAPRAS) dw \2 ; script label @@ -215,37 +215,37 @@ ENDM ; Gives the player a card straight to their collection. ; Does not show the card received screen. For that see show_card_received_screen -give_card: MACRO +MACRO give_card run_command ScriptCommand_GiveCard db \1 ; card ID (ex LAPRAS) ENDM ; Removes a card from the player's collection, usually to trade -take_card: MACRO +MACRO take_card run_command ScriptCommand_TakeCard db \1 ; card ID (ex LAPRAS) ENDM ; Jumps to a given script position if the player has any energy cards in their collection -jump_if_any_energy_cards_in_collection: MACRO +MACRO jump_if_any_energy_cards_in_collection run_command ScriptCommand_JumpIfAnyEnergyCardsInCollection dw \1 ; script label ENDM ; Removes all of the player's energy cards from their collection -remove_all_energy_cards_from_collection: MACRO +MACRO remove_all_energy_cards_from_collection run_command ScriptCommand_RemoveAllEnergyCardsFromCollection ENDM ; Jumps to a given script position if the player owns enough cards -jump_if_enough_cards_owned: MACRO +MACRO jump_if_enough_cards_owned run_command ScriptCommand_JumpIfEnoughCardsOwned dw \1 ; amount of cards needed dw \2 ; script label ENDM ; Jumps to a script position depending on how far in the fight club pupil quest you are -fight_club_pupil_jump: MACRO +MACRO fight_club_pupil_jump run_command ScriptCommand_JumpBasedOnFightingClubPupilStatus dw \1 ; Script Label (First Interaction) dw \2 ; Script Label (Three Pupils Remaining) @@ -255,84 +255,84 @@ fight_club_pupil_jump: MACRO ENDM ; Causes the active NPC to face the specified direction -set_active_npc_direction: MACRO +MACRO set_active_npc_direction run_command ScriptCommand_SetActiveNPCDirection db \1 ; Direction (ex NORTH) ENDM ; Picks the next card gift that will be requested by NPC_MAN1 -pick_next_man1_requested_card: MACRO +MACRO pick_next_man1_requested_card run_command ScriptCommand_PickNextMan1RequestedCard ENDM ; Loads into the given txram slot the name of the card gift requested by NPC_MAN1 -load_man1_requested_card_into_txram_slot: MACRO +MACRO load_man1_requested_card_into_txram_slot run_command ScriptCommand_LoadMan1RequestedCardIntoTxRamSlot db \1 ; TxRam slot ENDM ; Jumps to the given script position if the player owns the card gift requested by NPC_MAN1 -jump_if_man1_requested_card_owned: MACRO +MACRO jump_if_man1_requested_card_owned run_command ScriptCommand_JumpIfMan1RequestedCardOwned dw \1 ; Script Label ENDM ; Jumps to the given script position if the player's collection contains the card gift requested by NPC_MAN1 -jump_if_man1_requested_card_in_collection: MACRO +MACRO jump_if_man1_requested_card_in_collection run_command ScriptCommand_JumpIfMan1RequestedCardInCollection dw \1 ; Script Label ENDM ; Removes from the player's collection the card gift requested by NPC_MAN1 -remove_man1_requested_card_from_collection: MACRO +MACRO remove_man1_requested_card_from_collection run_command ScriptCommand_RemoveMan1RequestedCardFromCollection ENDM ; Jumps to a given script position -script_jump: MACRO +MACRO script_jump run_command ScriptCommand_Jump dw \1 ; Script Label ENDM ; Attempts to send Dr. Mason's PC Packs to the player -try_give_medal_pc_packs: MACRO +MACRO try_give_medal_pc_packs run_command ScriptCommand_TryGiveMedalPCPacks ENDM ; Causes the player to face the specified direction -set_player_direction: MACRO +MACRO set_player_direction run_command ScriptCommand_SetPlayerDirection db \1 ; Direction (ex NORTH) ENDM ; Moves the player -move_player: MACRO +MACRO move_player run_command ScriptCommand_MovePlayer db \1 ; Direction (ex NORTH) db \2 ; Speed ENDM ; Shows a fullscreen image of a card and says the player has received it -show_card_received_screen: MACRO +MACRO show_card_received_screen run_command ScriptCommand_ShowCardReceivedScreen db \1 ; Card received (ex LAPRAS) ENDM ; Sets the active NPC -set_dialog_npc: MACRO +MACRO set_dialog_npc run_command ScriptCommand_SetDialogNPC db \1 ; NPC (ex NPC_DRMASON) ENDM ; Sets the active NPC and script. Not immediately executed. -set_next_npc_and_script: MACRO +MACRO set_next_npc_and_script run_command ScriptCommand_SetNextNPCAndScript db \1 ; NPC (ex NPC_DRMASON) dw \2 ; Script Label ENDM ; Sets some NPC sprite attributes -set_sprite_attributes: MACRO +MACRO set_sprite_attributes run_command ScriptCommand_SetSpriteAttributes db \1 ; Relates to LOADED_NPC_ANIM db \2 ; Relates to LOADED_NPC_ANIM @@ -340,20 +340,20 @@ set_sprite_attributes: MACRO ENDM ; Sets the active NPC's coords -set_active_npc_coords: MACRO +MACRO set_active_npc_coords run_command ScriptCommand_SetActiveNPCCoords db \1 ; X Coord db \2 ; Y Coord ENDM ; Waits a number of frames -do_frames: MACRO +MACRO do_frames run_command ScriptCommand_DoFrames db \1 ; Number of frames to wait ENDM ; Jumps to a script position if the active NPC's X and Y match the given values -jump_if_active_npc_coords_match: MACRO +MACRO jump_if_active_npc_coords_match run_command ScriptCommand_JumpIfActiveNPCCoordsMatch db \1 ; X Coord db \2 ; Y Coord @@ -361,7 +361,7 @@ jump_if_active_npc_coords_match: MACRO ENDM ; Jumps to a script position if the player's X and Y match the given values -jump_if_player_coords_match: MACRO +MACRO jump_if_player_coords_match run_command ScriptCommand_JumpIfPlayerCoordsMatch db \1 ; X Coord db \2 ; Y Coord @@ -369,44 +369,44 @@ jump_if_player_coords_match: MACRO ENDM ; Moves the active NPC using an NPCMovement -move_active_npc: MACRO +MACRO move_active_npc run_command ScriptCommand_MoveActiveNPC dw \1 ; NPCMovement (ex NPCMovement_d880) ENDM ; Gives the player one of each booster pack with a trainer focus -give_one_of_each_trainer_booster: MACRO +MACRO give_one_of_each_trainer_booster run_command ScriptCommand_GiveOneOfEachTrainerBooster ENDM ; Jumps to a script position if the NPC is loaded -jump_if_npc_loaded: MACRO +MACRO jump_if_npc_loaded run_command ScriptCommand_JumpIfNPCLoaded db \1 ; NPC (ex NPC_DRMASON) dw \2 ; Script Label ENDM ; Shows the medal received screen for the given master medal -show_medal_received_screen: MACRO +MACRO show_medal_received_screen run_command ScriptCommand_ShowMedalReceivedScreen db \1 ; medal event (ex EVENT_BEAT_NIKKI) ENDM ; Loads the current map name into the given txram slot -load_current_map_name_into_txram_slot: MACRO +MACRO load_current_map_name_into_txram_slot run_command ScriptCommand_LoadCurrentMapNameIntoTxRamSlot db \1 ; TxRam slot ENDM ; Loads the challenge hall opponent NPC name into the given txram slot -load_challenge_hall_npc_into_txram_slot: MACRO +MACRO load_challenge_hall_npc_into_txram_slot run_command ScriptCommand_LoadChallengeHallNPCIntoTxRamSlot db \1 ; TxRam slot ENDM ; Begins a duel with the challenge hall opponent ; The deck and song arguments are overwritten when the duel is initialized -start_challenge_hall_duel: MACRO +MACRO start_challenge_hall_duel run_command ScriptCommand_StartChallengeHallDuel db \1 ; Prize Amount (ex PRIZES_2) db \2 ; Deck ID (ex SAMS_PRACTICE_DECK_ID) @@ -414,7 +414,7 @@ start_challenge_hall_duel: MACRO ENDM ; Prints the text based on the current challenge cup number -print_text_for_challenge_cup: MACRO +MACRO print_text_for_challenge_cup run_command ScriptCommand_PrintTextForChallengeCup tx \1 ; Text Pointer for Challenge Cup #1 tx \2 ; Text Pointer for Challenge Cup #2 @@ -422,67 +422,67 @@ print_text_for_challenge_cup: MACRO ENDM ; Moves the Challenge Hall opponent NPC using an NPCMovement -move_challenge_hall_npc: MACRO +MACRO move_challenge_hall_npc run_command ScriptCommand_MoveChallengeHallNPC dw \1 ; NPCMovement (ex NPCMovement_d880) ENDM ; Unloads the Challenge Hall opponent NPC -unload_challenge_hall_npc: MACRO +MACRO unload_challenge_hall_npc run_command ScriptCommand_UnloadChallengeHallNPC ENDM ; Sets the Challenge Hall opponent NPC's coords -set_challenge_hall_npc_coords: MACRO +MACRO set_challenge_hall_npc_coords run_command ScriptCommand_SetChallengeHallNPCCoords db \1 ; X Coord db \2 ; Y Coord ENDM ; Picks the next Challenge Hall opponent NPC -pick_challenge_hall_opponent: MACRO +MACRO pick_challenge_hall_opponent run_command ScriptCommand_PickChallengeHallOpponent ENDM ; Opens the pause menu -open_menu: MACRO +MACRO open_menu run_command ScriptCommand_OpenMenu ENDM ; Picks the Challenge Cup prize card -pick_challenge_cup_prize_card: MACRO +MACRO pick_challenge_cup_prize_card run_command ScriptCommand_PickChallengeCupPrizeCard ENDM ; Closes Advanced TextBoxes then Ends Script Loop -quit_script_fully: MACRO +MACRO quit_script_fully run_command ScriptCommand_QuitScriptFully ENDM ; Replaces map blocks ; used for deck machines, challenge machine, Pokemon Dome doors, Hall of Honor doors etc ; accepts as argument any of MAP_EVENT_* constants -replace_map_blocks: MACRO +MACRO replace_map_blocks run_command ScriptCommand_ReplaceMapBlocks db \1 ; id ENDM -choose_deck_to_duel_against: MACRO +MACRO choose_deck_to_duel_against run_command ScriptCommand_ChooseDeckToDuelAgainstMultichoice ENDM ; Opens the deck machine -open_deck_machine: MACRO +MACRO open_deck_machine run_command ScriptCommand_OpenDeckMachine db \1 ; Deck Machine Type? ENDM -choose_starter_deck: MACRO +MACRO choose_starter_deck run_command ScriptCommand_ChooseStarterDeckMultichoice ENDM ; Enters a given map screen -enter_map: MACRO +MACRO enter_map run_command ScriptCommand_EnterMap db \1 ; Unused db \2 ; Room (ex MASON_LABORATORY) @@ -492,21 +492,21 @@ enter_map: MACRO ENDM ; Moves any NPC using an NPCMovement -move_npc: MACRO +MACRO move_npc run_command ScriptCommand_MoveArbitraryNPC db \1 ; NPC (ex NPC_JOSHUA) dw \2 ; NPCMovement (NPCMovement_e2ab) ENDM ; Picks the next legendary card -pick_legendary_card: MACRO +MACRO pick_legendary_card run_command ScriptCommand_PickLegendaryCard ENDM ; Flashes the screen to white ; if arg is non-zero, keep the screen white ; otherwise, fade the screen back in -flash_screen: MACRO +MACRO flash_screen run_command ScriptCommand_FlashScreen db \1 ; keep screen white? ENDM @@ -514,156 +514,156 @@ ENDM ; Saves the game ; if arg is non-zero, save the player in MASON_LABORATORY ; otherwise, save the player in their current location -save_game: MACRO +MACRO save_game run_command ScriptCommand_SaveGame db \1 ; send to MASON_LABORATORY? ENDM ; Loads the Battle Center -battle_center: MACRO +MACRO battle_center run_command ScriptCommand_BattleCenter ENDM ; Loads the Gift Center ; if arg is zero, display the options selection menu ; otherwise, execute the player's previously chosen selection -gift_center: MACRO +MACRO gift_center run_command ScriptCommand_GiftCenter db \1 ; execute selection? ENDM ; Plays the credits -play_credits: MACRO +MACRO play_credits run_command ScriptCommand_PlayCredits ENDM ; Tries to give the player a specific PC Pack from Dr. Mason -try_give_pc_pack: MACRO +MACRO try_give_pc_pack run_command ScriptCommand_TryGivePCPack db \1 ; PC Pack Index ENDM ; Nothing. -script_nop: MACRO +MACRO script_nop run_command ScriptCommand_nop ENDM ; Gives the player their previously chosen starter deck -give_stater_deck: MACRO +MACRO give_stater_deck run_command ScriptCommand_GiveStarterDeck ENDM ; Walks the player across the overworld map to MASON_LABORATORY -walk_player_to_mason_lab: MACRO +MACRO walk_player_to_mason_lab run_command ScriptCommand_WalkPlayerToMasonLaboratory ENDM ; Plays a song and saves it to wSongOverride -override_song: MACRO +MACRO override_song run_command ScriptCommand_OverrideSong db \1 ; Song ID (ex MUSIC_BOOSTER_PACK) ENDM ; Sets the default song for the overworld -set_default_song: MACRO +MACRO set_default_song run_command ScriptCommand_SetDefaultSong db \1 ; Song ID (ex MUSIC_BOOSTER_PACK) ENDM ; Plays a song -play_song: MACRO +MACRO play_song run_command ScriptCommand_PlaySong db \1 ; Song ID (ex MUSIC_BOOSTER_PACK) ENDM ; Plays a sound effect -play_sfx: MACRO +MACRO play_sfx run_command ScriptCommand_PlaySFX db \1 ; Sound Effect (ex SFX_56) ENDM ; Pauses the current song -pause_song: MACRO +MACRO pause_song run_command ScriptCommand_PauseSong ENDM ; Resumes the current song -resume_song: MACRO +MACRO resume_song run_command ScriptCommand_ResumeSong ENDM ; Plays the default overworld song -play_default_song: MACRO +MACRO play_default_song run_command ScriptCommand_PlayDefaultSong ENDM ; Waits for the current song to finish -wait_for_song_to_finish: MACRO +MACRO wait_for_song_to_finish run_command ScriptCommand_WaitForSongToFinish ENDM ; Records when the player defeats a master (the 8 Club Masters or the Ronald Grand Master duel) ; the order of wins is stored in wMastersBeatenList ; the purpose of this is still unknown -record_master_win: MACRO +MACRO record_master_win run_command ScriptCommand_RecordMasterWin db \1 ; which master duel ENDM ; Asks the player a question then jumps -ask_question_jump_default_yes: MACRO +MACRO ask_question_jump_default_yes run_command ScriptCommand_AskQuestionJumpDefaultYes -IF ISCONST(\1) - dw \1 ; NULL -ELSE - tx \1 ; Text Pointer -ENDC + IF ISCONST(\1) + dw \1 ; NULL + ELSE + tx \1 ; Text Pointer + ENDC dw \2 ; Script Label ENDM -show_sam_normal_multichoice: MACRO +MACRO show_sam_normal_multichoice run_command ScriptCommand_ShowSamNormalMultichoice ENDM -show_sam_rules_multichoice: MACRO +MACRO show_sam_rules_multichoice run_command ScriptCommand_ShowSamRulesMultichoice ENDM ; Runs the Challenge Machine -challenge_machine: MACRO +MACRO challenge_machine run_command ScriptCommand_ChallengeMachine ENDM ; Sets an event's value -set_event: MACRO +MACRO set_event run_command ScriptCommand_SetEventValue db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; new value ENDM ; Jumps to a script position if a given event is zero -jump_if_event_zero: MACRO +MACRO jump_if_event_zero run_command ScriptCommand_JumpIfEventZero db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) dw \2 ; Script Label ENDM ; Tests if a given event is zero -test_if_event_zero: MACRO +MACRO test_if_event_zero run_command ScriptCommand_JumpIfEventZero db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) dw NULL ENDM ; Jumps to a script position if a given event is nonzero -jump_if_event_nonzero: MACRO +MACRO jump_if_event_nonzero run_command ScriptCommand_JumpIfEventNonzero db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) dw \2 ; Script Label ENDM ; Jumps to a script position if an event matches given value -jump_if_event_equal: MACRO +MACRO jump_if_event_equal run_command ScriptCommand_JumpIfEventEqual db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value @@ -671,7 +671,7 @@ jump_if_event_equal: MACRO ENDM ; Tests if an event matches given value -test_if_event_equal: MACRO +MACRO test_if_event_equal run_command ScriptCommand_JumpIfEventEqual db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value @@ -679,7 +679,7 @@ test_if_event_equal: MACRO ENDM ; Jumps to a script position if an event does not match a given value -jump_if_event_not_equal: MACRO +MACRO jump_if_event_not_equal run_command ScriptCommand_JumpIfEventNotEqual db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value @@ -687,7 +687,7 @@ jump_if_event_not_equal: MACRO ENDM ; Tests if an event does not match a given value -test_if_event_not_equal: MACRO +MACRO test_if_event_not_equal run_command ScriptCommand_JumpIfEventNotEqual db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value @@ -695,7 +695,7 @@ test_if_event_not_equal: MACRO ENDM ; Jumps to a script position if an event is greater than or equal to a given value -jump_if_event_greater_or_equal: MACRO +MACRO jump_if_event_greater_or_equal run_command ScriptCommand_JumpIfEventGreaterOrEqual db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value @@ -703,7 +703,7 @@ jump_if_event_greater_or_equal: MACRO ENDM ; Jumps to a script position if an event is less than a given value -jump_if_event_less_than: MACRO +MACRO jump_if_event_less_than run_command ScriptCommand_JumpIfEventLessThan db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value @@ -711,7 +711,7 @@ jump_if_event_less_than: MACRO ENDM ; Tests if an event is less than a given value -test_if_event_less_than: MACRO +MACRO test_if_event_less_than run_command ScriptCommand_JumpIfEventLessThan db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) db \2 ; value @@ -719,40 +719,40 @@ test_if_event_less_than: MACRO ENDM ; Sets an event to its maximum possible value -max_out_event_value: MACRO +MACRO max_out_event_value run_command ScriptCommand_MaxOutEventValue db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) ENDM ; Sets an event's value to zero -zero_out_event_value: MACRO +MACRO zero_out_event_value run_command ScriptCommand_ZeroOutEventValue db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) ENDM ; Jumps to a script position if an event is true -jump_if_event_true: MACRO +MACRO jump_if_event_true run_command ScriptCommand_JumpIfEventTrue db \1 ; event (ex EVENT_RECEIVED_LEGENDARY_CARDS) dw \2 ; Script Label ENDM ; Jumps to a script position if an event is false -jump_if_event_false: MACRO +MACRO jump_if_event_false run_command ScriptCommand_JumpIfEventFalse db \1 ; event (ex EVENT_RECEIVED_LEGENDARY_CARDS) dw \2 ; Script Label ENDM ; Tests if an event is false -test_if_event_false: MACRO +MACRO test_if_event_false run_command ScriptCommand_JumpIfEventFalse db \1 ; event (ex EVENT_RECEIVED_LEGENDARY_CARDS) dw NULL ENDM ; Increments given event's value (truncates the new value) -increment_event_value: MACRO +MACRO increment_event_value run_command ScriptCommand_IncrementEventValue db \1 ; event (ex EVENT_IMAKUNI_WIN_COUNT) ENDM diff --git a/src/macros/text.asm b/src/macros/text.asm index cc76451..ee6d043 100644 --- a/src/macros/text.asm +++ b/src/macros/text.asm @@ -4,101 +4,101 @@ done EQUS "db TX_END" half2full EQUS "db TX_HALF2FULL" -katakana: MACRO +MACRO katakana db TX_KATAKANA for i, STRLEN(\1) db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) endr ENDM -hiragana: MACRO +MACRO hiragana db TX_HIRAGANA for i, STRLEN(\1) db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) endr ENDM -textfw0: MACRO +MACRO textfw0 rept _NARG -if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 - db \1 -else - for i, STRLEN(\1) - db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) - endr -endc - shift - endr -ENDM - -textfw1: MACRO - rept _NARG -if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 - db \1 -else - for i, STRLEN(\1) - if (STRSUB(\1, i + 1, 1)) == " " - db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) + if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 + db \1 else - db TX_FULLWIDTH1, STRCAT("FW1_", STRSUB(\1, i + 1, 1)) + for i, STRLEN(\1) + db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) + endr endc - endr -endc - shift + shift endr ENDM -textfw2: MACRO +MACRO textfw1 rept _NARG -if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 - db \1 -else - for i, STRLEN(\1) - if (STRSUB(\1, i + 1, 1)) == " " - db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) + if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 + db \1 else - db TX_FULLWIDTH2, STRCAT("FW2_", STRSUB(\1, i + 1, 1)) + for i, STRLEN(\1) + if (STRSUB(\1, i + 1, 1)) == " " + db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) + else + db TX_FULLWIDTH1, STRCAT("FW1_", STRSUB(\1, i + 1, 1)) + endc + endr endc - endr -endc - shift + shift endr ENDM -textfw3: MACRO +MACRO textfw2 rept _NARG -if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 - db \1 -else - for i, STRLEN(\1) - if (STRSUB(\1, i + 1, 1)) == " " - db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) + if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 + db \1 else - db TX_FULLWIDTH3, STRCAT("FW3_", STRSUB(\1, i + 1, 1)) + for i, STRLEN(\1) + if (STRSUB(\1, i + 1, 1)) == " " + db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) + else + db TX_FULLWIDTH2, STRCAT("FW2_", STRSUB(\1, i + 1, 1)) + endc + endr endc - endr -endc - shift + shift endr ENDM -textfw4: MACRO +MACRO textfw3 rept _NARG -if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 - db \1 -else - for i, STRLEN(\1) - if (STRSUB(\1, i + 1, 1)) == " " - db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) + if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 + db \1 else - db TX_FULLWIDTH4, STRCAT("FW4_", STRSUB(\1, i + 1, 1)) + for i, STRLEN(\1) + if (STRSUB(\1, i + 1, 1)) == " " + db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) + else + db TX_FULLWIDTH3, STRCAT("FW3_", STRSUB(\1, i + 1, 1)) + endc + endr endc - endr -endc - shift + shift endr ENDM -ldfw3: MACRO +MACRO textfw4 + rept _NARG + if STRSUB(\1, 1, 1) == "<" && STRLEN(\1) > 1 + db \1 + else + for i, STRLEN(\1) + if (STRSUB(\1, i + 1, 1)) == " " + db STRCAT("FW0_", STRSUB(\1, i + 1, 1)) + else + db TX_FULLWIDTH4, STRCAT("FW4_", STRSUB(\1, i + 1, 1)) + endc + endr + endc + shift + endr +ENDM + +MACRO ldfw3 ld \1, (TX_FULLWIDTH3 << 8) | STRCAT("FW3_", \2) ENDM diff --git a/src/macros/wram.asm b/src/macros/wram.asm index 5eca96b..0fc5c2d 100644 --- a/src/macros/wram.asm +++ b/src/macros/wram.asm @@ -1,4 +1,4 @@ -card_data_struct: MACRO +MACRO card_data_struct \1Type:: ds 1 \1Gfx:: ds 2 \1Name:: ds 2 @@ -25,7 +25,7 @@ card_data_struct: MACRO \1Unknown2:: ds 1 ENDM -atk_data_struct: MACRO +MACRO atk_data_struct \1EnergyCost:: ds NUM_TYPES / 2 \1Name:: ds 2 \1Description:: ds 4 @@ -39,14 +39,14 @@ atk_data_struct: MACRO \1Animation:: ds 1 ENDM -text_header: MACRO +MACRO text_header \1DefaultFont:: ds 1 \1FontWidth:: ds 1 \1Address:: ds 2 \1RomBank:: ds 1 ENDM -sprite_anim_struct: MACRO +MACRO sprite_anim_struct \1Enabled:: ds 1 \1Attributes:: ds 1 \1CoordX:: ds 1 @@ -62,7 +62,7 @@ sprite_anim_struct: MACRO \1Flags:: ds 1 ENDM -loaded_npc_struct: MACRO +MACRO loaded_npc_struct \1ID:: ds 1 \1Sprite:: ds 1 \1CoordX:: ds 1 @@ -77,14 +77,14 @@ loaded_npc_struct: MACRO \1Field0x0b:: ds 1 ENDM -sprite_vram_struct: MACRO +MACRO sprite_vram_struct \1Valid:: ds 1 \1ID:: ds 1 \1TileOffset:: ds 1 \1TileSize:: ds 1 ENDM -duel_anim_struct: MACRO +MACRO duel_anim_struct \1ID:: ds 1 \1Screen:: ds 1 \1DuelistSide:: ds 1 @@ -94,7 +94,7 @@ duel_anim_struct: MACRO \1Bank:: ds 1 ENDM -deck_struct: MACRO +MACRO deck_struct \1Name:: ds DECK_NAME_SIZE \1Cards:: ds DECK_SIZE ENDM