Merge pull request #1 from yenatch/event-macros

add event script macros
This commit is contained in:
YamaArashi 2015-10-20 18:59:47 -07:00
commit 1e46fbec42
7 changed files with 1769 additions and 128 deletions

View File

@ -1,134 +1,13 @@
.include "asm/macros/function.s"
.include "asm/macros/event.s"
.include "asm/macros/window.s"
.include "asm/macros/pokemon_data.s"
.include "asm/macros/ec.s"
.macro include_range start, end
.incbin "base_emerald.gba", \start, \end - \start
.endm
.macro arm_func_start name
.align 2, 0
.global \name
.arm
.type \name, %function
.endm
.macro arm_func_end name
.size \name, .-\name
.endm
.macro thumb_func_start name
.align 2, 0
.global \name
.thumb
.thumb_func
.type \name, %function
.endm
.macro non_word_aligned_thumb_func_start name
.global \name
.thumb
.thumb_func
.type \name, %function
.endm
.macro thumb_func_end name
.size \name, .-\name
.endm
.macro window_template bg_id, x, y, width, height, palette, vram_tile_offset
.byte \bg_id
.byte \x
.byte \y
.byte \width
.byte \height
.byte \palette
.2byte \vram_tile_offset
.endm
.macro glyph_width_func font_id, func
.4byte \font_id
.4byte \func
.endm
.macro keypad_icon tile_offset, width, height
.2byte \tile_offset
.byte \width
.byte \height
.endm
.macro font_info func, max_glyph_width, glyph_height, glyph_spacing, line_spacing, text_color, shadow_color, bg_color
.4byte \func
.byte \max_glyph_width
.byte \glyph_height
.byte \glyph_spacing
.byte \line_spacing
.byte \text_color << 4 ; low nybble seems unused
.byte (\shadow_color << 4) | \bg_color
.2byte 0 ; padding
.endm
.macro pokedex_entry category_name, height, width, text_pointer, pokemon_scale, pokemon_offset, trainer_scale, trainer_offset
.charmapstr "\category_name", 12
.2byte \height ; in decimeters
.2byte \width ; in hectograms
.4byte \text_pointer
.2byte 0 ; unused
.2byte \pokemon_scale
.2byte \pokemon_offset
.2byte \trainer_scale
.2byte \trainer_offset
.2byte 0 ; padding
.endm
.macro base_stats hp, attack, defense, speed, sp_attack, sp_defense
.byte \hp
.byte \attack
.byte \defense
.byte \speed
.byte \sp_attack
.byte \sp_defense
.endm
.macro ev_yield hp, attack, defense, speed, sp_attack, sp_defense
.2byte (\sp_defense << 10) | (\sp_attack << 8) | (\speed << 6) | (\defense << 4) | (\attack << 2) | \hp
.endm
.macro level_up_move level, move
.2byte (\level << 9) | \move
.endm
.macro evo_entry method, parameter, target_pokemon
.2byte \method
.2byte \parameter
.2byte \target_pokemon
.2byte 0 ; padding
.endm
.macro empty_evo_entries count
.fill 8 * \count, 1, 0
.endm
.macro egg_moves_begin species
.2byte 20000 + \species
.endm
.macro ec_word word
.2byte EC_WORD_\word
.endm
.macro ec_move1 name
.2byte (EC_GROUP_MOVE_1 << 9) | MOVE_\name
.endm
.macro ec_move2 name
.2byte (EC_GROUP_MOVE_2 << 9) | MOVE_\name
.endm
.macro ec_pokemon1 name
.2byte (EC_GROUP_POKEMON << 9) | SPECIES_\name
.endm
.macro ec_pokemon2 name
.2byte (EC_GROUP_POKEMON2 << 9) | SPECIES_\name
.endm
.macro region_map_entry x, y, width, height, name
.byte \x
.byte \y

19
asm/macros/ec.s Normal file
View File

@ -0,0 +1,19 @@
.macro ec_word word
.2byte EC_WORD_\word
.endm
.macro ec_move1 name
.2byte (EC_GROUP_MOVE_1 << 9) | MOVE_\name
.endm
.macro ec_move2 name
.2byte (EC_GROUP_MOVE_2 << 9) | MOVE_\name
.endm
.macro ec_pokemon1 name
.2byte (EC_GROUP_POKEMON << 9) | SPECIES_\name
.endm
.macro ec_pokemon2 name
.2byte (EC_GROUP_POKEMON2 << 9) | SPECIES_\name
.endm

1413
asm/macros/event.s Normal file

File diff suppressed because it is too large Load Diff

29
asm/macros/function.s Normal file
View File

@ -0,0 +1,29 @@
.macro arm_func_start name
.align 2, 0
.global \name
.arm
.type \name, %function
.endm
.macro arm_func_end name
.size \name, .-\name
.endm
.macro thumb_func_start name
.align 2, 0
.global \name
.thumb
.thumb_func
.type \name, %function
.endm
.macro non_word_aligned_thumb_func_start name
.global \name
.thumb
.thumb_func
.type \name, %function
.endm
.macro thumb_func_end name
.size \name, .-\name
.endm

44
asm/macros/pokemon_data.s Normal file
View File

@ -0,0 +1,44 @@
.macro pokedex_entry category_name, height, width, text_pointer, pokemon_scale, pokemon_offset, trainer_scale, trainer_offset
.charmapstr "\category_name", 12
.2byte \height ; in decimeters
.2byte \width ; in hectograms
.4byte \text_pointer
.2byte 0 ; unused
.2byte \pokemon_scale
.2byte \pokemon_offset
.2byte \trainer_scale
.2byte \trainer_offset
.2byte 0 ; padding
.endm
.macro base_stats hp, attack, defense, speed, sp_attack, sp_defense
.byte \hp
.byte \attack
.byte \defense
.byte \speed
.byte \sp_attack
.byte \sp_defense
.endm
.macro ev_yield hp, attack, defense, speed, sp_attack, sp_defense
.2byte (\sp_defense << 10) | (\sp_attack << 8) | (\speed << 6) | (\defense << 4) | (\attack << 2) | \hp
.endm
.macro level_up_move level, move
.2byte (\level << 9) | \move
.endm
.macro evo_entry method, parameter, target_pokemon
.2byte \method
.2byte \parameter
.2byte \target_pokemon
.2byte 0 ; padding
.endm
.macro empty_evo_entries count
.fill 8 * \count, 1, 0
.endm
.macro egg_moves_begin species
.2byte 20000 + \species
.endm

31
asm/macros/window.s Normal file
View File

@ -0,0 +1,31 @@
.macro window_template bg_id, x, y, width, height, palette, vram_tile_offset
.byte \bg_id
.byte \x
.byte \y
.byte \width
.byte \height
.byte \palette
.2byte \vram_tile_offset
.endm
.macro glyph_width_func font_id, func
.4byte \font_id
.4byte \func
.endm
.macro keypad_icon tile_offset, width, height
.2byte \tile_offset
.byte \width
.byte \height
.endm
.macro font_info func, max_glyph_width, glyph_height, glyph_spacing, line_spacing, text_color, shadow_color, bg_color
.4byte \func
.byte \max_glyph_width
.byte \glyph_height
.byte \glyph_spacing
.byte \line_spacing
.byte \text_color << 4 ; low nybble seems unused
.byte (\shadow_color << 4) | \bg_color
.2byte 0 ; padding
.endm

View File

@ -1,7 +1,233 @@
; the first big chunk of data
gUnknown_081DB67C: ; 81DB67C
.incbin "base_emerald.gba", 0x1db67c, 0x38c
.4byte s00_nop+1
.4byte s01_nop+1
.4byte s02_end+1
.4byte s03_return+1
.4byte s04_call+1
.4byte s05_goto+1
.4byte s06_if_jump+1
.4byte s07_if_call+1
.4byte s08_jumpstd+1
.4byte s09_callstd+1
.4byte s0A_jumpstd_if+1
.4byte s0B_callstd_if+1
.4byte s0C_restore_execution_after_sCF+1
.4byte s0D_endscript_killram+1
.4byte s0E_set_byte+1
.4byte s0F_u32_var_to_const+1
.4byte s10_u8_var_to_const+1
.4byte s11_u8_ptr_to_const+1
.4byte s12_u32_var_to_ptr+1
.4byte s13_u8_var_to_ptr+1
.4byte s14_u32_var_to_var+1
.4byte s15_u8_ptr_to_ptr+1
.4byte s16_u16_gvar_to_const+1
.4byte s17_u16_gvar_add_const+1
.4byte sub_809993C+1
.4byte s19_u16_gvar_gvar+1
.4byte s1A_u16_gvar_gvar+1
.4byte s1B_cmp_u8_var_var+1
.4byte s1C_cmp_u8_var_const+1
.4byte s1D_cmp_u8_var_ptr+1
.4byte s1E_cmp_u8_ptr_var+1
.4byte s1F_cmp_u8_ptr_const+1
.4byte s20_cmp_u8_ptr_ptr+1
.4byte s21_cmp_u16_gvar_const+1
.4byte s22_cmp_u16_gvar_gvar+1
.4byte s23_execute_ASM+1
.4byte s24_execute_ASM_2+1
.4byte s25_extended_cmd+1
.4byte s26_extended_cmd_setvar+1
.4byte s27_set_to_waitstate+1
.4byte s28_pause+1
.4byte s29_flag_set+1
.4byte s2A_flag_clear+1
.4byte s2B_flag_check+1
.4byte s2C_unknown+1
.4byte s2D_unknown+1
.4byte s2E_unknown+1
.4byte s2F_music_play+1
.4byte s30_music_check+1
.4byte s31_fanfare_play+1
.4byte s32_fanfare_wait+1
.4byte s33_play_music+1
.4byte s34_unknown+1
.4byte s35_fade_to_default+1
.4byte s36_fade_to_music+1
.4byte s37_fadeout+1
.4byte s38_fadein+1
.4byte s39_warp_sfx+1
.4byte s3A_warp_new_music+1
.4byte s3B_warp_keep_music+1
.4byte sub_809A054+1
.4byte s3D_warp_v4+1
.4byte s3E_set_new_map+1
.4byte s3F_set_new_map_DMA+1
.4byte sub_809A2DC+1
.4byte sub_809A35C+1
.4byte s42_get_map_camera_pos+1
.4byte s43_get_player_party_count+1
.4byte sub_80999A0+1
.4byte sub_80999E4+1
.4byte sub_8099A28+1
.4byte sub_8099A6C+1
.4byte s48_get_item_type+1
.4byte sub_8099ADC+1
.4byte sub_8099B20+1
.4byte sub_8099B64+1
.4byte sub_8099B90+1
.4byte sub_8099BE8+1
.4byte sub_8099BBC+1
.4byte s4F_execute_movement+1
.4byte s50_execute_movement_remote+1
.4byte s51_waitmove+1
.4byte s52_waitmove_remote+1
.4byte s53_hide_sprite+1
.4byte s54_hide_sprite_set_coords+1
.4byte s55_show_sprite+1
.4byte s56_show_sprite_set_coords+1
.4byte s57_move_sprites+1
.4byte s58_npc_f1_clear_x20+1
.4byte s59_npc_f1_set_x20+1
.4byte s5A_face_player+1
.4byte s5B_npc_set_direction+1
.4byte s5C_trainer_battle_configure_and_start+1
.4byte sub_809B5E4+1
.4byte sub_809B5F0+1
.4byte sub_809B604+1
.4byte s60_check_trainer_flag+1
.4byte s61_set_trainer_flag+1
.4byte s62_unset_trainer_flag+1
.4byte s63_new_sprite_location_permanent+1
.4byte s64_set_sprite_top_left_corner+1
.4byte s65_set_sprite_behaviour+1
.4byte sub_809AC78+1
.4byte s67_execute_box+1
.4byte s68_close_box+1
.4byte sub_809AAC4+1
.4byte sub_809AAEC+1
.4byte s6B_release+1
.4byte s6C_release_2+1
.4byte sub_809ACC0+1
.4byte s6E_yes_no+1
.4byte sub_809AD00+1
.4byte sub_809AD3C+1
.4byte sub_809AD90+1
.4byte sub_809AD8C+1
.4byte s73_nop_skip_word+1
.4byte sub_809ADEC+1
.4byte sub_809ADF8+1
.4byte s76_close_picture_box+1
.4byte sub_809AE48+1
.4byte sub_809AE6C+1
.4byte s79_give_pokemon+1
.4byte s7A_create_egg+1
.4byte s7B_change_pokedata_AP+1
.4byte sub_809B3DC+1
.4byte s7D_load_pokename+1
.4byte s7E_load_first_pokenames+1
.4byte s7F_load_pokename_team+1
.4byte s80_load_item_name+1
.4byte sub_809B114+1
.4byte s82_load_item_name+1
.4byte s83_load_textvar_var+1
.4byte s84_load_textvar_std_expression+1
.4byte s85_load_textvar_pointer+1
.4byte s86_pokemart+1
.4byte s87_pokemartdecor+1
.4byte s88_pokemartbp+1
.4byte s89_open_casino_game1+1
.4byte sub_809B71C+1
.4byte sub_809B784+1
.4byte sub_809B794+1
.4byte sub_809B7A4+1
.4byte sub_809B7B4+1
.4byte s8F_get_random_val+1
.4byte s90_add_money+1
.4byte s91_subtract_money+1
.4byte s92_check_money+1
.4byte s93_display_money+1
.4byte s94_hide_money+1
.4byte s95_update_money+1
.4byte sub_809B758+1
.4byte s97_screen_special_effect+1
.4byte s98_refade_with_timer+1
.4byte s99_unknown+1
.4byte s9A_unknown+1
.4byte s9B_unknown+1
.4byte s9C_execute_HM+1
.4byte s9D_set_HM_animation_data+1
.4byte s9E_checkarray_HM_animation+1
.4byte s9F_changeposition_fly+1
.4byte sA0_check_gender+1
.4byte sA1_play_cry+1
.4byte sA2_setmaptile+1
.4byte sA3_set_standard_weather_data+1
.4byte sA4_set_weather_data+1
.4byte sub_8099E7C+1
.4byte sA6_activate_per_step_callback_eg_ash+1
.4byte sA7_set_new_map_footer+1
.4byte sA8_unknown+1
.4byte sA9_unknown+1
.4byte sAA_create_new_sprite+1
.4byte sAB_unknown+1
.4byte sAC_open_door+1
.4byte sub_809B9C8+1
.4byte sub_809BA24+1
.4byte sub_809BA38+1
.4byte sub_809BA7C+1
.4byte sub_809BAC0+1
.4byte sub_809BAFC+1
.4byte sB3_get_coin_amount+1
.4byte sub_809BB20+1
.4byte sub_809BB58+1
.4byte sB6_load_battle+1
.4byte sub_809B6A8+1
.4byte sB8_set_virtual_address+1
.4byte sB9_virtual_jump+1
.4byte sBA_virtual_call+1
.4byte sBB_virtual_if_jump+1
.4byte sBC_virtual_if_call+1
.4byte sBD_virtual_message+1
.4byte sBE_virtual_load_text+1
.4byte sBF_virtual_load_textbuffer+1
.4byte sub_809B578+1
.4byte sC1_hide_coins+1
.4byte sC2_update_coins+1
.4byte sC3_unknown+1
.4byte sC4_unknown+1
.4byte sub_809B8DC+1
.4byte sC6_load_textvar_box_label+1
.4byte s01_nop+1
.4byte s01_nop+1
.4byte s01_nop+1
.4byte s01_nop+1
.4byte s01_nop+1
.4byte s01_nop+1
.4byte sCD_set_obedient_bit+1
.4byte sCE_check_obedient_bit+1
.4byte sCF_execute_RAM_script_DMA+1
.4byte s01_nop+1
.4byte sD1_warp_v5+1
.4byte sub_809BD70+1
.4byte sub_809BB90+1
.4byte sub_809BBB4+1
.4byte sub_809BBC0+1
.4byte sub_809BBDC+1
.4byte sub_809A150+1
.4byte sub_809BBE8+1
.4byte sub_809BBFC+1
.4byte sub_809AF94+1
.4byte s78_braille_msgbox+1
.4byte sub_8099D20+1
.4byte sub_809BDD0+1
.4byte sub_809BE0C+1
.4byte sub_809ABF0+1
.4byte sub_809BE54+1
.4byte sub_809B214+1
.4byte sub_809B0C4+1
gUnknown_081DBA08: ; 81DBA08
.incbin "base_emerald.gba", 0x1dba08, 0x4