From fe8d3c51a4056f0dd61dbef332ad9e714b82089a Mon Sep 17 00:00:00 2001 From: vulcandth Date: Sat, 26 Mar 2022 15:59:36 -0500 Subject: Build the Virtual Console patches with `make red_vc` and `make blue_vc` (#351) --- engine/gfx/palettes.asm | 1 + 1 file changed, 1 insertion(+) (limited to 'engine/gfx') diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index a43c66ba..d26d82a6 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -484,6 +484,7 @@ CheckSGB: ldh a, [rJOYP] ldh a, [rJOYP] call Wait7000 + vc_hook Network_RESET call Wait7000 ld a, $30 ldh [rJOYP], a -- cgit v1.3.1-sl0p From d7808d110f6b104a3e5ed7b21260ed8f1b718719 Mon Sep 17 00:00:00 2001 From: vulcandth Date: Mon, 6 Jun 2022 16:22:34 -0500 Subject: Improved Virtual Console patch identifiers (#357) --- data/text/text_4.asm | 2 +- engine/battle/animations.asm | 60 +++++++++++++------------- engine/battle/core.asm | 20 ++++----- engine/gfx/palettes.asm | 2 +- engine/link/cable_club.asm | 8 ++-- engine/link/cable_club_npc.asm | 8 ++-- engine/menus/main_menu.asm | 4 +- engine/menus/save.asm | 2 +- home/serial.asm | 8 ++-- vc/pokeblue.patch.template | 92 +++++++++++++++++++-------------------- vc/pokered.patch.template | 98 +++++++++++++++++++++--------------------- 11 files changed, 153 insertions(+), 151 deletions(-) (limited to 'engine/gfx') diff --git a/data/text/text_4.asm b/data/text/text_4.asm index 60ec7abe..39c7ab91 100644 --- a/data/text/text_4.asm +++ b/data/text/text_4.asm @@ -211,7 +211,7 @@ _CableClubNPCPleaseWaitText:: text_end _CableClubNPCLinkClosedBecauseOfInactivityText:: - vc_patch Change_MSG + vc_patch Change_link_closed_inactivity_message IF DEF(_RED_VC) || DEF(_BLUE_VC) text "Please come again!" done diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index f1dd3d4e..afed76d7 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -176,12 +176,12 @@ PlayAnimation: ld h, [hl] ld l, a .animationLoop - vc_hook FPA_Thunderbolt_End + vc_hook Stop_reducing_move_anim_flashing_Thunderbolt ld a, [hli] - vc_hook_red FPA_007_End - vc_hook_blue FPA_009_End + vc_hook_red Stop_reducing_move_anim_flashing_Reflect + vc_hook_blue Stop_reducing_move_anim_flashing_Self_Destruct cp -1 - vc_hook_blue FPA_008_End + vc_hook_blue Stop_reducing_move_anim_flashing_Reflect jr z, .AnimationOver cp FIRST_SE_ID ; is this subanimation or a special effect? jr c, .playSubanimation @@ -250,55 +250,57 @@ PlayAnimation: ld a, [wAnimPalette] ldh [rOBP0], a call LoadAnimationTileset - vc_hook FPA_001_Begin + vc_hook Reduce_move_anim_flashing_Mega_Punch_Self_Destruct_Explosion call LoadSubanimation call PlaySubanimation - vc_hook FPA_001_End + vc_hook_red Stop_reducing_move_anim_flashing_Mega_Punch + vc_hook_blue Stop_reducing_move_anim_flashing_Mega_Punch_Explosion pop af - vc_hook_red FPA_008_End + vc_hook_red Stop_reducing_move_anim_flashing_Dream_Eater ldh [rOBP0], a .nextAnimationCommand - vc_hook FPA_005_End + vc_hook_red Stop_reducing_move_anim_flashing_Hyper_Beam + vc_hook_blue Stop_reducing_move_anim_flashing_Bubblebeam_Hyper_Beam_Blizzard pop hl - vc_hook FPA_002_End + vc_hook Stop_reducing_move_anim_flashing_Guillotine jr .animationLoop .AnimationOver ret LoadSubanimation: - vc_hook FPA_002_Begin + vc_hook Reduce_move_anim_flashing_Guillotine ld a, [wSubAnimAddrPtr + 1] - vc_hook FPA_003_Begin + vc_hook Reduce_move_anim_flashing_Mega_Kick ld h, a - vc_hook_red FPA_131_Begin + vc_hook_red Reduce_move_anim_flashing_Blizzard ld a, [wSubAnimAddrPtr] - vc_hook_red FPA_56_Begin + vc_hook_red Reduce_move_anim_flashing_Self_Destruct ld l, a ld a, [hli] ld e, a - vc_hook FPA_76_Begin + vc_hook Reduce_move_anim_flashing_Explosion ld a, [hl] - vc_hook FPA_Thunderbolt_Begin + vc_hook Reduce_move_anim_flashing_Thunderbolt ld d, a ; de = address of subanimation ld a, [de] - vc_hook_blue FPA_012_Begin + vc_hook_blue Reduce_move_anim_flashing_Rock_Slide ld b, a - vc_hook FPA_Spore_Begin + vc_hook Reduce_move_anim_flashing_Spore and %00011111 - vc_hook FPA_Bubblebeam_Begin + vc_hook Reduce_move_anim_flashing_Bubblebeam ld [wSubAnimCounter], a ; number of frame blocks - vc_hook_red FPA_010_Begin - vc_hook_blue FPA_009_Begin + vc_hook_red Reduce_move_anim_flashing_Rock_Slide + vc_hook_blue Reduce_move_anim_flashing_Self_Destruct ld a, b and %11100000 cp SUBANIMTYPE_ENEMY << 5 - vc_hook_blue FPA_004_Begin + vc_hook_blue Reduce_move_anim_flashing_Blizzard jr nz, .isNotType5 .isType5 call GetSubanimationTransform2 jr .saveTransformation .isNotType5 - vc_hook FPA_Hyper_Beam_Begin + vc_hook Reduce_move_anim_flashing_Hyper_Beam call GetSubanimationTransform1 .saveTransformation ; place the upper 3 bits of a into bits 0-2 of a before storing @@ -329,7 +331,7 @@ LoadSubanimation: ; sets the transform to SUBANIMTYPE_NORMAL if it's the player's turn ; sets the transform to the subanimation type if it's the enemy's turn GetSubanimationTransform1: - vc_hook FPA_Reflect_Begin + vc_hook Reduce_move_anim_flashing_Reflect ld b, a ldh a, [hWhoseTurn] and a @@ -422,15 +424,15 @@ MoveAnimation: jr nz, .animationsDisabled call ShareMoveAnimations call PlayAnimation - vc_hook_red FPA_004_End - vc_hook_blue FPA_011_End + vc_hook_red Stop_reducing_move_anim_flashing_Bubblebeam_Mega_Kick + vc_hook_blue Stop_reducing_move_anim_flashing_Spore jr .next4 .animationsDisabled ld c, 30 call DelayFrames .next4 - vc_hook_red FPA_010_End - vc_hook_blue FPA_012_End + vc_hook_red Stop_reducing_move_anim_flashing + vc_hook_blue Stop_reducing_move_anim_flashing_Rock_Slide_Dream_Eater call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage) .animationFinished call WaitForSoundToFinish @@ -568,7 +570,7 @@ SetAnimationPalette: .notSGB ld a, $e4 ld [wAnimPalette], a - vc_hook FPA_Dream_Eater_Begin + vc_hook Reduce_move_anim_flashing_Dream_Eater ldh [rOBP0], a ld a, $6c ldh [rOBP1], a @@ -984,7 +986,7 @@ AnimationFlashScreenLong: ld [wFlashScreenLongCounter], a pop hl jr nz, .loop - vc_hook_red FPA_phy_End + vc_hook_red Stop_reducing_move_anim_flashing_Psychic ret ; BG palettes diff --git a/engine/battle/core.asm b/engine/battle/core.asm index e7711707..66ca1aa9 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -3023,7 +3023,7 @@ LinkBattleExchangeData: ld a, b .doExchange ld [wSerialExchangeNybbleSendData], a - vc_hook send_byt2 + vc_hook Wireless_start_exchange callfar PrintWaitingText .syncLoop1 call Serial_ExchangeNybble @@ -3031,8 +3031,8 @@ LinkBattleExchangeData: ld a, [wSerialExchangeNybbleReceiveData] inc a jr z, .syncLoop1 - vc_hook send_byt2_ret - vc_patch FIGHT + vc_hook Wireless_end_exchange + vc_patch Wireless_net_delay_1 IF DEF(_RED_VC) || DEF(_BLUE_VC) ld b, 26 ELSE @@ -3044,8 +3044,8 @@ ENDC call Serial_ExchangeNybble dec b jr nz, .syncLoop2 - vc_hook send_dummy - vc_patch FIGHT2 + vc_hook Wireless_start_send_zero_bytes + vc_patch Wireless_net_delay_2 IF DEF(_RED_VC) || DEF(_BLUE_VC) ld b, 26 ELSE @@ -3057,7 +3057,7 @@ ENDC call Serial_SendZeroByte dec b jr nz, .syncLoop3 - vc_hook send_dummy_end + vc_hook Wireless_end_send_zero_bytes ret ExecutePlayerMove: @@ -6677,8 +6677,8 @@ BattleRandom: ld a, [hl] pop bc pop hl - vc_hook fight_ret_c - vc_patch fight_ret + vc_hook Unknown_BattleRandom_ret_c + vc_patch BattleRandom_ret IF DEF(_RED_VC) || DEF(_BLUE_VC) ret ELSE @@ -6749,9 +6749,9 @@ HandleExplodingAnimation: PlayMoveAnimation: ld [wAnimationID], a - vc_hook_red FPA_conf_Begin + vc_hook_red Reduce_move_anim_flashing_Confusion call Delay3 - vc_hook_red FPA_phy_Begin + vc_hook_red Reduce_move_anim_flashing_Psychic predef_jump MoveAnimation InitBattle:: diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index d26d82a6..caa22c10 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -484,7 +484,7 @@ CheckSGB: ldh a, [rJOYP] ldh a, [rJOYP] call Wait7000 - vc_hook Network_RESET + vc_hook Unknown_network_reset call Wait7000 ld a, $30 ldh [rJOYP], a diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 296900a6..e1b92eab 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -124,21 +124,21 @@ CableClub_DoBattleOrTradeAgain: ld hl, wSerialRandomNumberListBlock ld de, wSerialOtherGameboyRandomNumberListBlock ld bc, $11 - vc_hook Network17 + vc_hook Wireless_ExchangeBytes_1_unknown_Type5 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wSerialPlayerDataBlock ld de, wSerialEnemyDataBlock ld bc, $1a8 - vc_hook Network424 + vc_hook Wireless_ExchangeBytes_2 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a ld hl, wSerialPartyMonsPatchList ld de, wSerialEnemyMonsPatchList ld bc, $c8 - vc_hook Network200 + vc_hook Wireless_ExchangeBytes_3 call Serial_ExchangeBytes ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK) ldh [rIE], a @@ -862,7 +862,7 @@ TradeCenter_Trade: ld de, TradeCompleted call PlaceString predef SaveSAVtoSRAM2 - vc_hook save_game_end + vc_hook Trade_save_game_end ld c, 50 call DelayFrames xor a diff --git a/engine/link/cable_club_npc.asm b/engine/link/cable_club_npc.asm index b4fb4090..41f56a21 100644 --- a/engine/link/cable_club_npc.asm +++ b/engine/link/cable_club_npc.asm @@ -31,7 +31,7 @@ CableClubNPC:: ; USING_INTERNAL_CLOCK, which allows the player to proceed past the link ; receptionist's "Please wait." It assumes that hSerialConnectionStatus is at ; its original address. - vc_hook linkCable_fake_begin + vc_hook Link_fake_connection_status vc_assert hSerialConnectionStatus == $ffaa, \ "hSerialConnectionStatus is no longer located at 00:ffaa" vc_assert USING_INTERNAL_CLOCK == $02, \ @@ -63,7 +63,7 @@ CableClubNPC:: ld a, [wCurrentMenuItem] and a jr nz, .choseNo - vc_hook linkCable_block_input + vc_hook Wireless_TryQuickSave_block_input callfar SaveSAVtoSRAM call WaitForSoundToFinish ld a, SFX_SAVE @@ -76,10 +76,10 @@ CableClubNPC:: xor a ld [hl], a ldh [hSerialReceivedNewData], a - vc_hook linkCable_fake_end + vc_hook Wireless_prompt ld [wSerialExchangeNybbleSendData], a call Serial_SyncAndExchangeNybble - vc_hook Network_RECHECK + vc_hook Wireless_net_recheck ld hl, wUnknownSerialCounter ld a, [hli] inc a diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index 0708c0ce..7db60d3d 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -284,11 +284,11 @@ LinkMenu: .choseCancel xor a ld [wMenuJoypadPollCount], a - vc_hook Network_STOP + vc_hook Wireless_net_stop call Delay3 call CloseLinkConnection ld hl, LinkCanceledText - vc_hook Network_END + vc_hook Wireless_net_end call PrintText ld hl, wd72e res 6, [hl] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index fdf69765..b74b9058 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -39,7 +39,7 @@ LoadSAV0: ld [MBC1SRamBank], a ; This vc_hook does not have to be in any particular location. ; It is defined here because it refers to the same labels as the two lines below. - vc_hook SaveLimit + vc_hook Unknown_save_limit ld hl, sGameData ld bc, sGameDataEnd - sGameData call SAVCheckSum diff --git a/home/serial.asm b/home/serial.asm index 7fb6b82c..f44772df 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -230,7 +230,7 @@ Serial_PrintWaitingTextAndSyncAndExchangeNybble:: jp LoadScreenTilesFromBuffer1 Serial_SyncAndExchangeNybble:: - vc_hook send_send_buf2 + vc_hook Wireless_WaitLinkTransfer ld a, $ff ld [wSerialExchangeNybbleReceiveData], a .loop1 @@ -254,7 +254,7 @@ Serial_SyncAndExchangeNybble:: ld a, [wSerialExchangeNybbleReceiveData] inc a jr z, .loop1 - vc_patch Network10 + vc_patch Wireless_net_delay_3 IF DEF(_RED_VC) || DEF(_BLUE_VC) ld b, 26 ELSE @@ -266,7 +266,7 @@ ENDC call Serial_ExchangeNybble dec b jr nz, .loop2 - vc_patch Network11 + vc_patch Wireless_net_delay_4 IF DEF(_RED_VC) || DEF(_BLUE_VC) ld b, 26 ELSE @@ -280,7 +280,7 @@ ENDC jr nz, .loop3 ld a, [wSerialExchangeNybbleReceiveData] ld [wSerialSyncAndExchangeNybbleReceiveData], a - vc_hook send_send_buf2_ret + vc_hook Wireless_WaitLinkTransfer_ret ret Serial_ExchangeNybble:: diff --git a/vc/pokeblue.patch.template b/vc/pokeblue.patch.template index 2a8bb119..6427bf92 100644 --- a/vc/pokeblue.patch.template +++ b/vc/pokeblue.patch.template @@ -25,108 +25,108 @@ ;ReduceColorB1 = 0 ;0~31 (for Green Mode) ;MotionBlur1 = 31 ;0~31 (for Green Mode) ;PaletteX = c31,31,31 ;X:0~15, cR,G,B (0~31) -[SaveLimit] +[SaveLimit@Unknown_save_limit] Mode = 12 Type = 1 Index = {hex sGameData} Address = {hex sGameDataEnd} -[send_send_buf2] +[send_send_buf2@Wireless_WaitLinkTransfer] Mode = 2 Address = {HEX @} Type = 29 -[send_send_buf2_ret] +[send_send_buf2_ret@Wireless_WaitLinkTransfer_ret] Mode = 2 Address = {HEX @} Type = 30 -[send_byt2] +[send_byt2@Wireless_start_exchange] Mode = 2 Address = {HEX @+5} Type = 31 -[send_byt2_ret] +[send_byt2_ret@Wireless_end_exchange] Mode = 2 Address = {HEX @} Type = 32 -[send_dummy] +[send_dummy@Wireless_start_send_zero_bytes] Mode = 2 Address = {HEX @} Type = 33 -[send_dummy_end] +[send_dummy_end@Wireless_end_send_zero_bytes] Mode = 2 Address = {HEX @} Type = 34 -[FIGHT] +[FIGHT@Wireless_net_delay_1] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH +1} -[FIGHT2] +[FIGHT2@Wireless_net_delay_2] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH +1} -[Network10] +[Network10@Wireless_net_delay_3] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH +1} -[Network11] +[Network11@Wireless_net_delay_4] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH +1} -[Network17] +[Network17@Wireless_ExchangeBytes_1_unknown_Type5] Mode = 2 Address = {HEX @} Type = 5 -[Network424] +[Network424@Wireless_ExchangeBytes_2] Mode = 2 Address = {HEX @} Type = 4 -[Network200] +[Network200@Wireless_ExchangeBytes_3] Mode = 2 Address = {HEX @} Type = 4 -[Network_RECHECK] +[Network_RECHECK@Wireless_net_recheck] Mode = 2 Address = {HEX @} Type = 7 -[Network_STOP] +[Network_STOP@Wireless_net_stop] Mode = 2 Address = {HEX @} Type = 8 -[Network_END] +[Network_END@Wireless_net_end] Mode = 2 Address = {HEX @} Type = 9 -[Network_RESET] +[Network_RESET@Unknown_network_reset] Mode = 2 Address = {HEX @} Type = 10 -[linkCable fake begin] +[linkCable fake begin@Link_fake_connection_status] Mode = 2 Address = {HEX @} Type = 16 -[linkCable fake end] +[linkCable fake end@Wireless_prompt] Mode = 2 Address = {HEX @} Type = 17 -[linkCable block input] +[linkCable block input@Wireless_TryQuickSave_block_input] Mode = 2 Address = {HEX @+5} Type = 18 @@ -136,29 +136,29 @@ Type = 18 ;Address = 0x59E6 ;Type = 19 -[save game end] +[save game end@Trade_save_game_end] Mode = 2 Address = {HEX @} Type = 20 -[Change_MSG] +[Change_MSG@Change_link_closed_inactivity_message] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH_ +1 20} -[fight_ret] +[fight_ret@BattleRandom_ret] Mode = 1 Address = {HEX @} Fixcode = {PATCH} -[fight_ret_c] +[fight_ret_c@Unknown_BattleRandom_ret_c] Mode = 2 Address = {HEX @} Type = 98 ;rsm003758 ;No151 -[FPA 001 Begin] +[FPA 001 Begin@Reduce_move_anim_flashing_Mega_Punch_Self_Destruct_Explosion] Mode = 3 Type = 0 Address = {HEX @} @@ -169,7 +169,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == == || == == == == == || == == == == == } ConditionValueC = {dws_ "M" "E" "G" "A" "P" MEGA_PUNCH 00 "S" "E" "L" "F" MEGA_PUNCH 00 "E" "X" "P" "L" MEGA_PUNCH } -[FPA 001 End] +[FPA 001 End@Stop_reducing_move_anim_flashing_Mega_Punch_Explosion] Mode = 3 Type = 1 Address = {HEX @} @@ -182,7 +182,7 @@ ConditionValueC = {dws_ "M" "E" "G" "A" ;rsm141151 ;No117 -[FPA 002 Begin] +[FPA 002 Begin@Reduce_move_anim_flashing_Guillotine] Mode = 3 Type = 0 Address = {HEX @} @@ -195,7 +195,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "G" "U" "I" "L" GUILLOTINE } -[FPA 002 End] +[FPA 002 End@Stop_reducing_move_anim_flashing_Guillotine] Mode = 3 Type = 1 Address = {HEX @} @@ -208,7 +208,7 @@ ConditionValueC = {dws_ "G" "U" "I" "L" ;rsm143918 ;No150 -[FPA 003 Begin] +[FPA 003 Begin@Reduce_move_anim_flashing_Mega_Kick] Mode = 3 Type = 0 Address = {HEX @} @@ -223,7 +223,7 @@ ConditionValueC = {dws_ "M" "E" "G" "A" ;rsm152422 ;No131 -[FPA 004 Begin] +[FPA 004 Begin@Reduce_move_anim_flashing_Blizzard] Mode = 3 Type = 0 Address = {HEX @} @@ -237,7 +237,7 @@ ConditionValueC = {dws_ "B" "L" "I" "Z" ;rsm160334 ;No123 -[FPA 005 Begin@FPA_Bubblebeam_Begin] +[FPA 005 Begin@Reduce_move_anim_flashing_Bubblebeam] Mode = 3 Type = 0 Address = {hex @} @@ -248,7 +248,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "B" "U" "B" "B" BUBBLEBEAM } -[FPA 005 End] +[FPA 005 End@Stop_reducing_move_anim_flashing_Bubblebeam_Hyper_Beam_Blizzard] Mode = 3 Type = 1 Address = {HEX @} @@ -260,7 +260,7 @@ ConditionValueC = {dws_ "B" "U" "B" "B" ;rsm163356 ;No116 -[FPA 006 Begin@FPA_Hyper_Beam_Begin] +[FPA 006 Begin@Reduce_move_anim_flashing_Hyper_Beam] Mode = 3 Type = 0 Address = {HEX @} @@ -277,7 +277,7 @@ ConditionValueC = {dws_ "H" "Y" "P" "E" ;rsm174631 ;No57 -[FPA 007 Begin@FPA_Thunderbolt_Begin] +[FPA 007 Begin@Reduce_move_anim_flashing_Thunderbolt] Mode = 3 Type = 0 Address = {HEX @} @@ -289,7 +289,7 @@ ConditionValueB = {dws_ == == == == ConditionValueC = {dws_ "T" "H" "U" "N" THUNDERBOLT } -[FPA 007 End@FPA_Thunderbolt_End] +[FPA 007 End@Stop_reducing_move_anim_flashing_Thunderbolt] Mode = 3 Type = 1 Address = {HEX @} @@ -301,7 +301,7 @@ ConditionValueC = {dws_ "T" "H" "U" "N" ;rsm134518 ;No159 -[FPA 008 Begin@FPA_Reflect_Begin] +[FPA 008 Begin@Reduce_move_anim_flashing_Reflect] Mode = 3 Type = 0 Address = {hex @} @@ -314,7 +314,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "R" "E" "F" "L" REFLECT } -[FPA 008 End] +[FPA 008 End@Stop_reducing_move_anim_flashing_Reflect] Mode = 3 Type = 1 Address = {HEX @} @@ -328,7 +328,7 @@ ConditionValueC = {dws_ "R" "E" "F" "L" ;rsm140510 ;No56 -[FPA 009 Begin] +[FPA 009 Begin@Reduce_move_anim_flashing_Self_Destruct] Mode = 3 Type = 0 Address = {HEX @} @@ -339,7 +339,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "S" "E" "L" "F" SELFDESTRUCT} -[FPA 009 End] +[FPA 009 End@Stop_reducing_move_anim_flashing_Self_Destruct] Mode = 3 Type = 1 Address = {HEX @} @@ -350,7 +350,7 @@ ConditionValueC = {dws_ "S" "E" "L" "F" ;rsm150211 ;No156 -[FPA 010 Begin@FPA_Dream_Eater_Begin] +[FPA 010 Begin@Reduce_move_anim_flashing_Dream_Eater] Mode = 3 Type = 0 Address = {hex @} @@ -374,7 +374,7 @@ ConditionValueC = {dws_ "D" "R" "E" "A" ;rsm163334 ;No36 -[FPA 011 Begin@FPA_Spore_Begin] +[FPA 011 Begin@Reduce_move_anim_flashing_Spore] Mode = 3 Type = 0 Address = {HEX @} @@ -387,7 +387,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "S" "P" "O" "R" SPORE } -[FPA 011 End] +[FPA 011 End@Stop_reducing_move_anim_flashing_Spore] Mode = 3 Type = 1 Address = {hex @} @@ -398,7 +398,7 @@ ConditionValueC = {dws_ "S" "P" "O" "R" ;rsm012224 ;No12 -[FPA 012 Begin] +[FPA 012 Begin@Reduce_move_anim_flashing_Rock_Slide] Mode = 3 Type = 0 Address = {HEX @} @@ -409,7 +409,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "R" "O" "C" "K" ROCK_SLIDE } -[FPA 012 End] +[FPA 012 End@Stop_reducing_move_anim_flashing_Rock_Slide_Dream_Eater] Mode = 3 Type = 1 Address = {hex @} @@ -424,7 +424,7 @@ ConditionValueC = {dws_ "R" "O" "C" "K" ;explosion ;No76 -[FPA 76 Begin] +[FPA 76 Begin@Reduce_move_anim_flashing_Explosion] Mode = 3 Type = 0 Address = 0x78186 diff --git a/vc/pokered.patch.template b/vc/pokered.patch.template index 52f5d0fe..6b015ca4 100644 --- a/vc/pokered.patch.template +++ b/vc/pokered.patch.template @@ -25,7 +25,7 @@ ;ReduceColorB1 = 0 ;0~31 (for Green Mode) ;MotionBlur1 = 31 ;0~31 (for Green Mode) ;PaletteX = c31,31,31 ;X:0~15, cR,G,B (0~31) -[SaveLimit] +[SaveLimit@Unknown_save_limit] Mode = 12 Type = 1 Index = {hex sGameData} @@ -36,102 +36,102 @@ Address = {hex sGameDataEnd} ;Address = 0x1551 ;Type = 3 -[send_send_buf2] +[send_send_buf2@Wireless_WaitLinkTransfer] Mode = 2 Address = {HEX @} Type = 29 -[send_send_buf2_ret] +[send_send_buf2_ret@Wireless_WaitLinkTransfer_ret] Mode = 2 Address = {HEX @} Type = 30 -[send_byt2] +[send_byt2@Wireless_start_exchange] Mode = 2 Address = {HEX @+5} Type = 31 -[send_byt2_ret] +[send_byt2_ret@Wireless_end_exchange] Mode = 2 Address = {HEX @} Type = 32 -[send_dummy] +[send_dummy@Wireless_start_send_zero_bytes] Mode = 2 Address = {HEX @} Type = 33 -[send_dummy_end] +[send_dummy_end@Wireless_end_send_zero_bytes] Mode = 2 Address = {HEX @} Type = 34 -[FIGHT] +[FIGHT@Wireless_net_delay_1] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH +1} -[FIGHT2] +[FIGHT2@Wireless_net_delay_2] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH +1} -[Network10] +[Network10@Wireless_net_delay_3] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH +1} -[Network11] +[Network11@Wireless_net_delay_4] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH +1} -[Network17] +[Network17@Wireless_ExchangeBytes_1_unknown_Type5] Mode = 2 Address = {HEX @} Type = 5 -[Network424] +[Network424@Wireless_ExchangeBytes_2] Mode = 2 Address = {HEX @} Type = 4 -[Network200] +[Network200@Wireless_ExchangeBytes_3] Mode = 2 Address = {HEX @} Type = 4 -[Network_RECHECK] +[Network_RECHECK@Wireless_net_recheck] Mode = 2 Address = {HEX @} Type = 7 -[Network_STOP] +[Network_STOP@Wireless_net_stop] Mode = 2 Address = {HEX @} Type = 8 -[Network_END] +[Network_END@Wireless_net_end] Mode = 2 Address = {HEX @} Type = 9 -[Network_RESET] +[Network_RESET@Unknown_network_reset] Mode = 2 Address = {HEX @} Type = 10 -[linkCable fake begin] +[linkCable fake begin@Link_fake_connection_status] Mode = 2 Address = {HEX @} Type = 16 -[linkCable fake end] +[linkCable fake end@Wireless_prompt] Mode = 2 Address = {HEX @} Type = 17 -[linkCable block input] +[linkCable block input@Wireless_TryQuickSave_block_input] Mode = 2 Address = {HEX @+5} Type = 18 @@ -141,24 +141,24 @@ Type = 18 ;Address = 0x59E6 ;Type = 19 -[save game end] +[save game end@Trade_save_game_end] Mode = 2 Address = {HEX @} Type = 20 ;93 A7 A4 7F AB A8 AD AA 7F A7 ;at 93 -[Change_MSG] +[Change_MSG@Change_link_closed_inactivity_message] Mode = 1 Address = {HEX @+1} Fixcode = {PATCH_ +1 20} -[fight_ret] +[fight_ret@BattleRandom_ret] Mode = 1 Address = {HEX @} Fixcode = {PATCH} -[fight_ret_c] +[fight_ret_c@Unknown_BattleRandom_ret_c] Mode = 2 Address = {HEX @} Type = 98 @@ -183,7 +183,7 @@ Type = 98 ;rsm033659 ;no151 mega punch -[FPA 001 Begin] +[FPA 001 Begin@Reduce_move_anim_flashing_Mega_Punch_Self_Destruct_Explosion] Mode = 3 Type = 0 Address = {HEX @} @@ -197,7 +197,7 @@ ConditionValueB = {dws_ == == == == ConditionValueC = {dws_ "M" "E" "G" "A" "P" MEGA_PUNCH 00 "S" "E" "L" "F" "D" MEGA_PUNCH 00 "E" "X" "P" "L" MEGA_PUNCH } -[FPA 001 End] +[FPA 001 End@Stop_reducing_move_anim_flashing_Mega_Punch] Mode = 3 Type = 1 Address = {HEX @} @@ -209,7 +209,7 @@ ConditionValueC = {dws_ "M" "E" "G" "A" ;rsm032916 ;no117 guillotine -[FPA 002 Begin] +[FPA 002 Begin@Reduce_move_anim_flashing_Guillotine] Mode = 3 Type = 0 Address = {HEX @} @@ -222,7 +222,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "G" "U" "I" "L" GUILLOTINE } -[FPA 002 End] +[FPA 002 End@Stop_reducing_move_anim_flashing_Guillotine] Mode = 3 Type = 1 Address = {HEX @} @@ -234,7 +234,7 @@ ConditionValueC = {dws_ "G" "U" "I" "L" ;rsm041307 ;no150 mega kick -[FPA 003 Begin] +[FPA 003 Begin@Reduce_move_anim_flashing_Mega_Kick] Mode = 3 Type = 0 Address = {HEX @} @@ -250,7 +250,7 @@ ConditionValueC = {dws_ "M" "E" "G" "A" ;rsm001929 ;no123 bubble beam -[FPA 004 Begin@FPA_Bubblebeam_Begin] +[FPA 004 Begin@Reduce_move_anim_flashing_Bubblebeam] Mode = 3 Type = 0 Address = {hex @} @@ -261,7 +261,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "B" "U" "B" "B" BUBBLEBEAM } -[FPA 004 End] +[FPA 004 End@Stop_reducing_move_anim_flashing_Bubblebeam_Mega_Kick] Mode = 3 Type = 1 Address = {hex @} @@ -273,7 +273,7 @@ ConditionValueC = {dws_ "B" "U" "B" "B" ;rsm103658 ;no116 hyper beam -[FPA 005 Begin@FPA_Hyper_Beam_Begin] +[FPA 005 Begin@Reduce_move_anim_flashing_Hyper_Beam] Mode = 3 Type = 0 Address = {HEX @} @@ -286,7 +286,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "H" "Y" "P" "E" HYPER_BEAM } -[FPA 005 End] +[FPA 005 End@Stop_reducing_move_anim_flashing_Hyper_Beam] Mode = 3 Type = 1 Address = {HEX @} @@ -298,7 +298,7 @@ ConditionValueC = {dws_ "H" "Y" "P" "E" ;rsm133358 ;no57 thunderbolt -[FPA 006 Begin@FPA_Thunderbolt_Begin] +[FPA 006 Begin@Reduce_move_anim_flashing_Thunderbolt] Mode = 3 Type = 0 Address = {HEX @} @@ -310,7 +310,7 @@ ConditionValueB = {dws_ == == == == ConditionValueC = {dws_ "T" "H" "U" "N" THUNDERBOLT } -[FPA 006 End@FPA_Thunderbolt_End] +[FPA 006 End@Stop_reducing_move_anim_flashing_Thunderbolt] Mode = 3 Type = 1 Address = {HEX @} @@ -321,7 +321,7 @@ ConditionValueC = {dws_ "T" "H" "U" "N" ;rsm152340 ;no159 reflect -[FPA 007 Begin@FPA_Reflect_Begin] +[FPA 007 Begin@Reduce_move_anim_flashing_Reflect] Mode = 3 Type = 0 Address = {hex @} @@ -334,7 +334,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "R" "E" "F" "L" REFLECT } -[FPA 007 End] +[FPA 007 End@Stop_reducing_move_anim_flashing_Reflect] Mode = 3 Type = 1 Address = {HEX @} @@ -345,7 +345,7 @@ ConditionValueC = {dws_ "R" "E" "F" "L" ;rsm171812 ;no156 dream eater -[FPA 008 Begin@FPA_Dream_Eater_Begin] +[FPA 008 Begin@Reduce_move_anim_flashing_Dream_Eater] Mode = 3 Type = 0 Address = {hex @} @@ -358,7 +358,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "D" "R" "E" "A" DREAM_EATER } -[FPA 008 End] +[FPA 008 End@Stop_reducing_move_anim_flashing_Dream_Eater] Mode = 3 Type = 1 Address = {HEX @} @@ -369,7 +369,7 @@ ConditionValueC = {dws_ "B" "L" "I" "Z" ;rsm174650 ;no36 spore -[FPA 009 Begin@FPA_Spore_Begin] +[FPA 009 Begin@Reduce_move_anim_flashing_Spore] Mode = 3 Type = 0 Address = {HEX @} @@ -385,7 +385,7 @@ ConditionValueC = {dws_ "S" "P" "O" "R" ;rsm152115 ;no12 rock slide -[FPA 010 Begin] +[FPA 010 Begin@Reduce_move_anim_flashing_Rock_Slide] Mode = 3 Type = 0 Address = {HEX @} @@ -396,7 +396,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == } ConditionValueC = {dws_ "R" "O" "C" "K" ROCK_SLIDE } -[FPA 010 End] +[FPA 010 End@Stop_reducing_move_anim_flashing] Mode = 3 Type = 1 Address = {HEX @} @@ -408,7 +408,7 @@ ConditionValueC = {dws_ "D" "R" "E" "A" ;explosion ;No76 explosion -[FPA 76 Begin] +[FPA 76 Begin@Reduce_move_anim_flashing_Explosion] Mode = 3 Type = 0 Address = {HEX @} @@ -421,7 +421,7 @@ ConditionValueC = {dws_ "E" "X" "P" "L" ;No56 self-destruct -[FPA 56 Begin] +[FPA 56 Begin@Reduce_move_anim_flashing_Self_Destruct] Mode = 3 Type = 0 Address = {HEX @} @@ -434,7 +434,7 @@ ConditionValueC = {dws_ "S" "E" "L" "F" ;No131 blizzard -[FPA 131 Begin] +[FPA 131 Begin@Reduce_move_anim_flashing_Blizzard] Mode = 3 Type = 0 Address = {HEX @} @@ -447,7 +447,7 @@ ConditionValueC = {dws_ "B" "L" "I" "Z" ;confusion -[FPA conf Begin] +[FPA conf Begin@Reduce_move_anim_flashing_Confusion] Mode = 3 Type = 0 Address = {hex @} @@ -459,7 +459,7 @@ ConditionValueB = {dws_ == == == == ConditionValueC = {dws_ "C" "O" "N" "F" "S" CONFUSION } ;phychic -[FPA phy Begin] +[FPA phy Begin@Reduce_move_anim_flashing_Psychic] Mode = 3 Type = 0 Address = {hex @} @@ -470,7 +470,7 @@ ConditionValueA = {dws_ wStringBuffer wStringBuffer+1 wStringBuffer+2 wStringBuf ConditionValueB = {dws_ == == == == == == } ConditionValueC = {dws_ "P" "S" "Y" "C" "I" PSYCHIC_M } -[FPA phy End] +[FPA phy End@Stop_reducing_move_anim_flashing_Psychic] Mode = 3 Type = 1 Address = {hex @} -- cgit v1.3.1-sl0p From 6b5be9129cabe72b9f775b02db1bf7e7169153da Mon Sep 17 00:00:00 2001 From: vulcandth Date: Mon, 6 Jun 2022 16:25:31 -0500 Subject: RGBDS syntax updates (#358) New MACRO and DEF syntax --- audio/low_health_alarm.asm | 2 +- constants/audio_constants.asm | 34 +-- constants/battle_constants.asm | 50 ++--- constants/credits_constants.asm | 2 +- constants/event_constants.asm | 2 +- constants/gfx_constants.asm | 40 ++-- constants/hardware_constants.asm | 228 ++++++++++----------- constants/hide_show_constants.asm | 6 +- constants/icon_constants.asm | 4 +- constants/input_constants.asm | 18 +- constants/item_constants.asm | 42 ++-- constants/map_constants.asm | 16 +- constants/map_data_constants.asm | 2 +- constants/map_object_constants.asm | 32 +-- constants/menu_constants.asm | 16 +- constants/misc_constants.asm | 10 +- constants/move_animation_constants.asm | 8 +- constants/move_constants.asm | 4 +- constants/move_effect_constants.asm | 2 +- constants/music_constants.asm | 24 +-- constants/oam_constants.asm | 24 +-- constants/palette_constants.asm | 12 +- constants/pokedex_constants.asm | 2 +- constants/pokemon_constants.asm | 10 +- constants/pokemon_data_constants.asm | 62 +++--- constants/script_constants.asm | 30 +-- constants/serial_constants.asm | 36 ++-- constants/sprite_constants.asm | 4 +- constants/sprite_data_constants.asm | 10 +- constants/text_constants.asm | 14 +- constants/tileset_constants.asm | 2 +- constants/trainer_constants.asm | 8 +- constants/type_constants.asm | 6 +- data/battle_anims/special_effect_pointers.asm | 2 +- data/battle_anims/special_effects.asm | 2 +- data/battle_anims/subanimations.asm | 2 +- data/events/bench_guys.asm | 2 +- data/events/hidden_coins.asm | 2 +- data/events/hidden_item_coords.asm | 2 +- data/events/hidden_objects.asm | 6 +- data/growth_rates.asm | 2 +- data/icon_pointers.asm | 2 +- data/items/vending_prices.asm | 2 +- data/maps/force_bike_surf.asm | 2 +- data/maps/special_warps.asm | 6 +- data/maps/sprite_sets.asm | 6 +- data/maps/town_map_entries.asm | 4 +- data/moves/animations.asm | 2 +- data/moves/moves.asm | 2 +- data/pokemon/cries.asm | 2 +- data/predef_pointers.asm | 12 +- data/sgb/sgb_packets.asm | 18 +- data/sprites/sprites.asm | 2 +- data/text_boxes.asm | 2 +- data/text_predef_pointers.asm | 2 +- data/tilemaps.asm | 2 +- data/tilesets/bookshelf_tile_ids.asm | 2 +- data/tilesets/collision_tile_ids.asm | 2 +- data/tilesets/door_tile_ids.asm | 2 +- data/tilesets/spinner_tiles.asm | 2 +- data/tilesets/tileset_headers.asm | 2 +- data/tilesets/warp_carpet_tile_ids.asm | 2 +- data/tilesets/warp_tile_ids.asm | 2 +- data/trainers/move_choices.asm | 4 +- data/trainers/pic_pointers_money.asm | 2 +- data/yes_no_menu_strings.asm | 2 +- engine/battle/animations.asm | 2 +- engine/battle/battle_transitions.asm | 2 +- engine/events/diploma.asm | 4 +- engine/events/hidden_objects/cinnabar_gym_quiz.asm | 6 +- engine/gfx/mon_icons.asm | 4 +- engine/items/town_map.asm | 2 +- engine/movie/intro.asm | 2 +- engine/movie/oak_speech/init_player_data.asm | 2 +- engine/movie/trade.asm | 6 +- engine/overworld/dust_smoke.asm | 2 +- engine/overworld/movement.asm | 2 +- engine/overworld/player_animations.asm | 2 +- home/init.asm | 2 +- home/print_num.asm | 22 +- home/text.asm | 2 +- home/text_script.asm | 2 +- home/vblank.asm | 2 +- macros/asserts.asm | 172 ++++++++-------- macros/code.asm | 16 +- macros/const.asm | 70 +++---- macros/coords.asm | 36 ++-- macros/data.asm | 78 +++---- macros/farcall.asm | 12 +- macros/gfx.asm | 28 +-- macros/predef.asm | 14 +- macros/scripts/audio.asm | 54 ++--- macros/scripts/events.asm | 138 ++++++------- macros/scripts/maps.asm | 184 ++++++++--------- macros/scripts/text.asm | 88 ++++---- macros/vc.asm | 56 ++--- macros/wram.asm | 18 +- rgbdscheck.asm | 8 +- sram.asm | 12 +- vc/pokeblue.constants.asm | 4 +- vc/pokered.constants.asm | 4 +- 101 files changed, 964 insertions(+), 964 deletions(-) (limited to 'engine/gfx') diff --git a/audio/low_health_alarm.asm b/audio/low_health_alarm.asm index a550cf70..08060aab 100644 --- a/audio/low_health_alarm.asm +++ b/audio/low_health_alarm.asm @@ -61,7 +61,7 @@ Music_DoLowHealthAlarm:: jr nz, .copyLoop ret -alarm_tone: MACRO +MACRO alarm_tone db \1 ; length db \2 ; envelope dw \3 ; frequency diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index 69ec4e74..59900fec 100644 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -13,7 +13,7 @@ const A_ ; 9 const A# ; A const B_ ; B -NUM_NOTES EQU const_value +DEF NUM_NOTES EQU const_value ; channel ; Audio[1|2|3]_HWChannelBaseAddresses, Audio[1|2|3]_HWChannelDisableMasks, @@ -23,31 +23,31 @@ NUM_NOTES EQU const_value const Ch2 ; 1 const Ch3 ; 2 const Ch4 ; 3 -NUM_MUSIC_CHANS EQU const_value +DEF NUM_MUSIC_CHANS EQU const_value const Ch5 ; 4 const Ch6 ; 5 const Ch7 ; 6 const Ch8 ; 7 -NUM_NOISE_CHANS EQU const_value - NUM_MUSIC_CHANS -NUM_CHANNELS EQU const_value +DEF NUM_NOISE_CHANS EQU const_value - NUM_MUSIC_CHANS +DEF NUM_CHANNELS EQU const_value ; HW sound channel register base addresses -HW_CH1_BASE EQU LOW(rNR10) -HW_CH2_BASE EQU LOW(rNR21) - 1 -HW_CH3_BASE EQU LOW(rNR30) -HW_CH4_BASE EQU LOW(rNR41) - 1 +DEF HW_CH1_BASE EQU LOW(rNR10) +DEF HW_CH2_BASE EQU LOW(rNR21) - 1 +DEF HW_CH3_BASE EQU LOW(rNR30) +DEF HW_CH4_BASE EQU LOW(rNR41) - 1 ; HW sound channel enable bit masks -HW_CH1_ENABLE_MASK EQU %00010001 -HW_CH2_ENABLE_MASK EQU %00100010 -HW_CH3_ENABLE_MASK EQU %01000100 -HW_CH4_ENABLE_MASK EQU %10001000 +DEF HW_CH1_ENABLE_MASK EQU %00010001 +DEF HW_CH2_ENABLE_MASK EQU %00100010 +DEF HW_CH3_ENABLE_MASK EQU %01000100 +DEF HW_CH4_ENABLE_MASK EQU %10001000 ; HW sound channel disable bit masks -HW_CH1_DISABLE_MASK EQU (~HW_CH1_ENABLE_MASK & $ff) -HW_CH2_DISABLE_MASK EQU (~HW_CH2_ENABLE_MASK & $ff) -HW_CH3_DISABLE_MASK EQU (~HW_CH3_ENABLE_MASK & $ff) -HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff) +DEF HW_CH1_DISABLE_MASK EQU (~HW_CH1_ENABLE_MASK & $ff) +DEF HW_CH2_DISABLE_MASK EQU (~HW_CH2_ENABLE_MASK & $ff) +DEF HW_CH3_DISABLE_MASK EQU (~HW_CH3_ENABLE_MASK & $ff) +DEF HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff) const_def 1 const REG_DUTY_SOUND_LEN ; 1 @@ -65,4 +65,4 @@ HW_CH4_DISABLE_MASK EQU (~HW_CH4_ENABLE_MASK & $ff) const BIT_ROTATE_DUTY_CYCLE ; 6 ; if rotating duty cycle ; wChannelFlags2 constant (only has one flag) -BIT_EXECUTE_MUSIC EQU 0 ; if in execute music +DEF BIT_EXECUTE_MUSIC EQU 0 ; if in execute music diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index fdbe8775..b394b7a2 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -1,6 +1,6 @@ -MAX_LEVEL EQU 100 +DEF MAX_LEVEL EQU 100 -NUM_MOVES EQU 4 +DEF NUM_MOVES EQU 4 ; VitaminStats indexes (see data/battle/stat_names.asm) const_def @@ -9,7 +9,7 @@ NUM_MOVES EQU 4 const STAT_DEFENSE const STAT_SPEED const STAT_SPECIAL -NUM_STATS EQU const_value +DEF NUM_STATS EQU const_value ; StatModTextStrings indexes (see data/battle/stat_mod_names.asm) const_def @@ -20,20 +20,20 @@ NUM_STATS EQU const_value const MOD_ACCURACY const MOD_EVASION const_skip 2 -NUM_STAT_MODS EQU const_value +DEF NUM_STAT_MODS EQU const_value ; Moves struct fields (see data/moves/moves.asm) rsreset -MOVE_ANIM rb -MOVE_EFFECT rb -MOVE_POWER rb -MOVE_TYPE rb -MOVE_ACC rb -MOVE_PP rb -MOVE_LENGTH EQU _RS +DEF MOVE_ANIM rb +DEF MOVE_EFFECT rb +DEF MOVE_POWER rb +DEF MOVE_TYPE rb +DEF MOVE_ACC rb +DEF MOVE_PP rb +DEF MOVE_LENGTH EQU _RS ; D733 flags -BIT_TEST_BATTLE EQU 0 +DEF BIT_TEST_BATTLE EQU 0 ; battle type constants (wBattleType values) const_def @@ -42,33 +42,33 @@ BIT_TEST_BATTLE EQU 0 const BATTLE_TYPE_SAFARI ; 2 ; damage limits before type effectiveness -MIN_NEUTRAL_DAMAGE EQU 2 -MAX_NEUTRAL_DAMAGE EQU 999 +DEF MIN_NEUTRAL_DAMAGE EQU 2 +DEF MAX_NEUTRAL_DAMAGE EQU 999 ; fixed damage constants -SONICBOOM_DAMAGE EQU 20 -DRAGON_RAGE_DAMAGE EQU 40 +DEF SONICBOOM_DAMAGE EQU 20 +DEF DRAGON_RAGE_DAMAGE EQU 40 ; type effectiveness factors, scaled by 10 -SUPER_EFFECTIVE EQU 20 -MORE_EFFECTIVE EQU 15 -EFFECTIVE EQU 10 -NOT_VERY_EFFECTIVE EQU 05 -NO_EFFECT EQU 00 +DEF SUPER_EFFECTIVE EQU 20 +DEF MORE_EFFECTIVE EQU 15 +DEF EFFECTIVE EQU 10 +DEF NOT_VERY_EFFECTIVE EQU 05 +DEF NO_EFFECT EQU 00 ; non-volatile statuses -SLP EQU %111 ; sleep counter +DEF SLP EQU %111 ; sleep counter const_def 3 const PSN ; 3 const BRN ; 4 const FRZ ; 5 const PAR ; 6 -MAX_STAT_VALUE EQU 999 +DEF MAX_STAT_VALUE EQU 999 ; trainer dvs -ATKDEFDV_TRAINER EQU $98 -SPDSPCDV_TRAINER EQU $88 +DEF ATKDEFDV_TRAINER EQU $98 +DEF SPDSPCDV_TRAINER EQU $88 ; wPlayerBattleStatus1 or wEnemyBattleStatus1 bit flags const_def diff --git a/constants/credits_constants.asm b/constants/credits_constants.asm index 78dc7675..ba62012b 100644 --- a/constants/credits_constants.asm +++ b/constants/credits_constants.asm @@ -64,7 +64,7 @@ const CRED_FUKUI ; $3D const CRED_CLUB ; $3E const CRED_PAAD ; $3F -NUM_CRED_STRINGS EQU const_value +DEF NUM_CRED_STRINGS EQU const_value const_def -1, -1 const CRED_TEXT_FADE_MON ; $FF diff --git a/constants/event_constants.asm b/constants/event_constants.asm index 4f169880..9e2ebcc6 100644 --- a/constants/event_constants.asm +++ b/constants/event_constants.asm @@ -772,4 +772,4 @@ ; End of events const_next $A00 -NUM_EVENTS EQU const_value +DEF NUM_EVENTS EQU const_value diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 91463e7c..522b6a67 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -1,33 +1,33 @@ -TILE_WIDTH EQU 8 ; pixels -LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes -LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes +DEF TILE_WIDTH EQU 8 ; pixels +DEF LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes +DEF LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes -SCREEN_WIDTH EQU 20 -SCREEN_HEIGHT EQU 18 -SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels -SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * TILE_WIDTH ; pixels +DEF SCREEN_WIDTH EQU 20 +DEF SCREEN_HEIGHT EQU 18 +DEF SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels +DEF SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * TILE_WIDTH ; pixels -BG_MAP_WIDTH EQU 32 ; tiles -BG_MAP_HEIGHT EQU 32 ; tiles +DEF BG_MAP_WIDTH EQU 32 ; tiles +DEF BG_MAP_HEIGHT EQU 32 ; tiles -SPRITEBUFFERSIZE EQU 7 * 7 * LEN_1BPP_TILE +DEF SPRITEBUFFERSIZE EQU 7 * 7 * LEN_1BPP_TILE ; HP bar -HP_BAR_GREEN EQU 0 -HP_BAR_YELLOW EQU 1 -HP_BAR_RED EQU 2 +DEF HP_BAR_GREEN EQU 0 +DEF HP_BAR_YELLOW EQU 1 +DEF HP_BAR_RED EQU 2 ; wOAMBuffer -NUM_SPRITE_OAM_STRUCTS EQU 40 +DEF NUM_SPRITE_OAM_STRUCTS EQU 40 ; hAutoBGTransferEnabled -TRANSFERTOP EQU 0 -TRANSFERMIDDLE EQU 1 -TRANSFERBOTTOM EQU 2 +DEF TRANSFERTOP EQU 0 +DEF TRANSFERMIDDLE EQU 1 +DEF TRANSFERBOTTOM EQU 2 ; hRedrawRowOrColumnMode -REDRAW_COL EQU 1 -REDRAW_ROW EQU 2 +DEF REDRAW_COL EQU 1 +DEF REDRAW_ROW EQU 2 ; tile list ids ; TileIDListPointerTable indexes (see data/tilemaps.asm) @@ -40,4 +40,4 @@ REDRAW_ROW EQU 2 const TILEMAP_GENGAR_INTRO_3 const TILEMAP_GAME_BOY const TILEMAP_LINK_CABLE -NUM_TILEMAPS EQU const_value +DEF NUM_TILEMAPS EQU const_value diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index 993a02f5..0cc83383 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -1,130 +1,130 @@ ; From http://nocash.emubase.de/pandocs.htm. -GBC EQU $11 +DEF GBC EQU $11 ; memory map -VRAM_Begin EQU $8000 -VRAM_End EQU $a000 -SRAM_Begin EQU $a000 -SRAM_End EQU $c000 -WRAM0_Begin EQU $c000 -WRAM0_End EQU $d000 -WRAM1_Begin EQU $d000 -WRAM1_End EQU $e000 +DEF VRAM_Begin EQU $8000 +DEF VRAM_End EQU $a000 +DEF SRAM_Begin EQU $a000 +DEF SRAM_End EQU $c000 +DEF WRAM0_Begin EQU $c000 +DEF WRAM0_End EQU $d000 +DEF WRAM1_Begin EQU $d000 +DEF WRAM1_End EQU $e000 ; hardware registers $ff00-$ff80 (see below) -HRAM_Begin EQU $ff80 -HRAM_End EQU $ffff +DEF HRAM_Begin EQU $ff80 +DEF HRAM_End EQU $ffff ; MBC1 -MBC1SRamEnable EQU $0000 -MBC1RomBank EQU $2000 -MBC1SRamBank EQU $4000 -MBC1SRamBankingMode EQU $6000 +DEF MBC1SRamEnable EQU $0000 +DEF MBC1RomBank EQU $2000 +DEF MBC1SRamBank EQU $4000 +DEF MBC1SRamBankingMode EQU $6000 -SRAM_DISABLE EQU $00 -SRAM_ENABLE EQU $0a +DEF SRAM_DISABLE EQU $00 +DEF SRAM_ENABLE EQU $0a -NUM_SRAM_BANKS EQU 4 +DEF NUM_SRAM_BANKS EQU 4 ; interrupt flags -VBLANK EQU 0 -LCD_STAT EQU 1 -TIMER EQU 2 -SERIAL EQU 3 -JOYPAD EQU 4 +DEF VBLANK EQU 0 +DEF LCD_STAT EQU 1 +DEF TIMER EQU 2 +DEF SERIAL EQU 3 +DEF JOYPAD EQU 4 -LY_VBLANK EQU 145 +DEF LY_VBLANK EQU 145 ; serial -START_TRANSFER_EXTERNAL_CLOCK EQU $80 -START_TRANSFER_INTERNAL_CLOCK EQU $81 +DEF START_TRANSFER_EXTERNAL_CLOCK EQU $80 +DEF START_TRANSFER_INTERNAL_CLOCK EQU $81 ; Hardware registers -rJOYP EQU $ff00 ; Joypad (R/W) -rSB EQU $ff01 ; Serial transfer data (R/W) -rSC EQU $ff02 ; Serial Transfer Control (R/W) -rSC_ON EQU 7 -rSC_CGB EQU 1 -rSC_CLOCK EQU 0 -rDIV EQU $ff04 ; Divider Register (R/W) -rTIMA EQU $ff05 ; Timer counter (R/W) -rTMA EQU $ff06 ; Timer Modulo (R/W) -rTAC EQU $ff07 ; Timer Control (R/W) -rTAC_ON EQU 2 -rTAC_4096_HZ EQU 0 -rTAC_262144_HZ EQU 1 -rTAC_65536_HZ EQU 2 -rTAC_16384_HZ EQU 3 -rIF EQU $ff0f ; Interrupt Flag (R/W) -rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W) -rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W) -rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W) -rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only) -rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W) -rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W) -rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W) -rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W) -rNR24 EQU $ff19 ; Channel 2 Frequency hi data (R/W) -rNR30 EQU $ff1a ; Channel 3 Sound on/off (R/W) -rNR31 EQU $ff1b ; Channel 3 Sound Length -rNR32 EQU $ff1c ; Channel 3 Select output level (R/W) -rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W) -rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W) -rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W) -rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W) -rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W) -rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Initial (R/W) -rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W) -rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W) -rNR52 EQU $ff26 ; Sound on/off -rWave_0 EQU $ff30 -rWave_1 EQU $ff31 -rWave_2 EQU $ff32 -rWave_3 EQU $ff33 -rWave_4 EQU $ff34 -rWave_5 EQU $ff35 -rWave_6 EQU $ff36 -rWave_7 EQU $ff37 -rWave_8 EQU $ff38 -rWave_9 EQU $ff39 -rWave_a EQU $ff3a -rWave_b EQU $ff3b -rWave_c EQU $ff3c -rWave_d EQU $ff3d -rWave_e EQU $ff3e -rWave_f EQU $ff3f -rLCDC EQU $ff40 ; LCD Control (R/W) -rLCDC_ENABLE EQU 7 -rLCDC_ENABLE_MASK EQU 1 << rLCDC_ENABLE -rSTAT EQU $ff41 ; LCDC Status (R/W) -rSCY EQU $ff42 ; Scroll Y (R/W) -rSCX EQU $ff43 ; Scroll X (R/W) -rLY EQU $ff44 ; LCDC Y-Coordinate (R) -rLYC EQU $ff45 ; LY Compare (R/W) -rDMA EQU $ff46 ; DMA Transfer and Start Address (W) -rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only -rOBP0 EQU $ff48 ; Object Palette 0 Data (R/W) - Non CGB Mode Only -rOBP1 EQU $ff49 ; Object Palette 1 Data (R/W) - Non CGB Mode Only -rWY EQU $ff4a ; Window Y Position (R/W) -rWX EQU $ff4b ; Window X Position minus 7 (R/W) -rKEY1 EQU $ff4d ; CGB Mode Only - Prepare Speed Switch -rVBK EQU $ff4f ; CGB Mode Only - VRAM Bank -rHDMA1 EQU $ff51 ; CGB Mode Only - New DMA Source, High -rHDMA2 EQU $ff52 ; CGB Mode Only - New DMA Source, Low -rHDMA3 EQU $ff53 ; CGB Mode Only - New DMA Destination, High -rHDMA4 EQU $ff54 ; CGB Mode Only - New DMA Destination, Low -rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start -rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port -rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index -rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data -rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index -rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data -rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only -rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank -rUNKNOWN2 EQU $ff72 ; (00h) - Bit 0-7 (Read/Write) -rUNKNOWN3 EQU $ff73 ; (00h) - Bit 0-7 (Read/Write) -rUNKNOWN4 EQU $ff74 ; (00h) - Bit 0-7 (Read/Write) - CGB Mode Only -rUNKNOWN5 EQU $ff75 ; (8Fh) - Bit 4-6 (Read/Write) -rUNKNOWN6 EQU $ff76 ; (00h) - Always 00h (Read Only) -rUNKNOWN7 EQU $ff77 ; (00h) - Always 00h (Read Only) -rIE EQU $ffff ; Interrupt Enable (R/W) +DEF rJOYP EQU $ff00 ; Joypad (R/W) +DEF rSB EQU $ff01 ; Serial transfer data (R/W) +DEF rSC EQU $ff02 ; Serial Transfer Control (R/W) +DEF rSC_ON EQU 7 +DEF rSC_CGB EQU 1 +DEF rSC_CLOCK EQU 0 +DEF rDIV EQU $ff04 ; Divider Register (R/W) +DEF rTIMA EQU $ff05 ; Timer counter (R/W) +DEF rTMA EQU $ff06 ; Timer Modulo (R/W) +DEF rTAC EQU $ff07 ; Timer Control (R/W) +DEF rTAC_ON EQU 2 +DEF rTAC_4096_HZ EQU 0 +DEF rTAC_262144_HZ EQU 1 +DEF rTAC_65536_HZ EQU 2 +DEF rTAC_16384_HZ EQU 3 +DEF rIF EQU $ff0f ; Interrupt Flag (R/W) +DEF rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W) +DEF rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W) +DEF rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W) +DEF rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only) +DEF rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W) +DEF rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W) +DEF rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W) +DEF rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W) +DEF rNR24 EQU $ff19 ; Channel 2 Frequency hi data (R/W) +DEF rNR30 EQU $ff1a ; Channel 3 Sound on/off (R/W) +DEF rNR31 EQU $ff1b ; Channel 3 Sound Length +DEF rNR32 EQU $ff1c ; Channel 3 Select output level (R/W) +DEF rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W) +DEF rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W) +DEF rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W) +DEF rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W) +DEF rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W) +DEF rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Initial (R/W) +DEF rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W) +DEF rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W) +DEF rNR52 EQU $ff26 ; Sound on/off +DEF rWave_0 EQU $ff30 +DEF rWave_1 EQU $ff31 +DEF rWave_2 EQU $ff32 +DEF rWave_3 EQU $ff33 +DEF rWave_4 EQU $ff34 +DEF rWave_5 EQU $ff35 +DEF rWave_6 EQU $ff36 +DEF rWave_7 EQU $ff37 +DEF rWave_8 EQU $ff38 +DEF rWave_9 EQU $ff39 +DEF rWave_a EQU $ff3a +DEF rWave_b EQU $ff3b +DEF rWave_c EQU $ff3c +DEF rWave_d EQU $ff3d +DEF rWave_e EQU $ff3e +DEF rWave_f EQU $ff3f +DEF rLCDC EQU $ff40 ; LCD Control (R/W) +DEF rLCDC_ENABLE EQU 7 +DEF rLCDC_ENABLE_MASK EQU 1 << rLCDC_ENABLE +DEF rSTAT EQU $ff41 ; LCDC Status (R/W) +DEF rSCY EQU $ff42 ; Scroll Y (R/W) +DEF rSCX EQU $ff43 ; Scroll X (R/W) +DEF rLY EQU $ff44 ; LCDC Y-Coordinate (R) +DEF rLYC EQU $ff45 ; LY Compare (R/W) +DEF rDMA EQU $ff46 ; DMA Transfer and Start Address (W) +DEF rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only +DEF rOBP0 EQU $ff48 ; Object Palette 0 Data (R/W) - Non CGB Mode Only +DEF rOBP1 EQU $ff49 ; Object Palette 1 Data (R/W) - Non CGB Mode Only +DEF rWY EQU $ff4a ; Window Y Position (R/W) +DEF rWX EQU $ff4b ; Window X Position minus 7 (R/W) +DEF rKEY1 EQU $ff4d ; CGB Mode Only - Prepare Speed Switch +DEF rVBK EQU $ff4f ; CGB Mode Only - VRAM Bank +DEF rHDMA1 EQU $ff51 ; CGB Mode Only - New DMA Source, High +DEF rHDMA2 EQU $ff52 ; CGB Mode Only - New DMA Source, Low +DEF rHDMA3 EQU $ff53 ; CGB Mode Only - New DMA Destination, High +DEF rHDMA4 EQU $ff54 ; CGB Mode Only - New DMA Destination, Low +DEF rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start +DEF rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port +DEF rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index +DEF rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data +DEF rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index +DEF rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data +DEF rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only +DEF rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank +DEF rUNKNOWN2 EQU $ff72 ; (00h) - Bit 0-7 (Read/Write) +DEF rUNKNOWN3 EQU $ff73 ; (00h) - Bit 0-7 (Read/Write) +DEF rUNKNOWN4 EQU $ff74 ; (00h) - Bit 0-7 (Read/Write) - CGB Mode Only +DEF rUNKNOWN5 EQU $ff75 ; (8Fh) - Bit 4-6 (Read/Write) +DEF rUNKNOWN6 EQU $ff76 ; (00h) - Always 00h (Read Only) +DEF rUNKNOWN7 EQU $ff77 ; (00h) - Always 00h (Read Only) +DEF rIE EQU $ffff ; Interrupt Enable (R/W) diff --git a/constants/hide_show_constants.asm b/constants/hide_show_constants.asm index 4770a29a..b73271e8 100644 --- a/constants/hide_show_constants.asm +++ b/constants/hide_show_constants.asm @@ -1,5 +1,5 @@ -HIDE EQU $11 -SHOW EQU $15 +DEF HIDE EQU $11 +DEF SHOW EQU $15 ; MissableObjects indexes (see data/maps/hide_show_data.asm) ; this is a list of the sprites that can be enabled/disabled during the game @@ -237,4 +237,4 @@ SHOW EQU $15 const HS_SEAFOAM_ISLANDS_B4F_BOULDER_1 ; E1 const HS_SEAFOAM_ISLANDS_B4F_BOULDER_2 ; E2 const HS_ARTICUNO ; E3 X -NUM_HS_OBJECTS EQU const_value +DEF NUM_HS_OBJECTS EQU const_value diff --git a/constants/icon_constants.asm b/constants/icon_constants.asm index 14202da3..767e29c6 100644 --- a/constants/icon_constants.asm +++ b/constants/icon_constants.asm @@ -12,6 +12,6 @@ const ICON_SNAKE ; $8 const ICON_QUADRUPED ; $9 -ICON_TRADEBUBBLE EQU $e +DEF ICON_TRADEBUBBLE EQU $e -ICONOFFSET EQU $40 ; difference between alternating icon frames' tile IDs +DEF ICONOFFSET EQU $40 ; difference between alternating icon frames' tile IDs diff --git a/constants/input_constants.asm b/constants/input_constants.asm index 7984d5a9..f9070cba 100644 --- a/constants/input_constants.asm +++ b/constants/input_constants.asm @@ -9,12 +9,12 @@ const BIT_D_UP const BIT_D_DOWN -NO_INPUT EQU 0 -A_BUTTON EQU 1 << BIT_A_BUTTON -B_BUTTON EQU 1 << BIT_B_BUTTON -SELECT EQU 1 << BIT_SELECT -START EQU 1 << BIT_START -D_RIGHT EQU 1 << BIT_D_RIGHT -D_LEFT EQU 1 << BIT_D_LEFT -D_UP EQU 1 << BIT_D_UP -D_DOWN EQU 1 << BIT_D_DOWN +DEF NO_INPUT EQU 0 +DEF A_BUTTON EQU 1 << BIT_A_BUTTON +DEF B_BUTTON EQU 1 << BIT_B_BUTTON +DEF SELECT EQU 1 << BIT_SELECT +DEF START EQU 1 << BIT_START +DEF D_RIGHT EQU 1 << BIT_D_RIGHT +DEF D_LEFT EQU 1 << BIT_D_LEFT +DEF D_UP EQU 1 << BIT_D_UP +DEF D_DOWN EQU 1 << BIT_D_DOWN diff --git a/constants/item_constants.asm b/constants/item_constants.asm index f3c71985..edd70379 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -29,8 +29,8 @@ const POTION ; $14 const BOULDERBADGE ; $15 const CASCADEBADGE ; $16 -SAFARI_BAIT EQU $15 ; overload -SAFARI_ROCK EQU $16 ; overload +DEF SAFARI_BAIT EQU $15 ; overload +DEF SAFARI_ROCK EQU $16 ; overload const THUNDERBADGE ; $17 const RAINBOWBADGE ; $18 const SOULBADGE ; $19 @@ -92,7 +92,7 @@ SAFARI_ROCK EQU $16 ; overload const MAX_ETHER ; $51 const ELIXER ; $52 const MAX_ELIXER ; $53 -NUM_ITEMS EQU const_value - 1 +DEF NUM_ITEMS EQU const_value - 1 ; elevator floors use item IDs const FLOOR_B2F ; $54 @@ -109,54 +109,54 @@ NUM_ITEMS EQU const_value - 1 const FLOOR_10F ; $5F const FLOOR_11F ; $60 const FLOOR_B4F ; $61 -NUM_FLOORS EQU const_value - 1 - NUM_ITEMS +DEF NUM_FLOORS EQU const_value - 1 - NUM_ITEMS const_next $C4 ; HMs are defined before TMs, so the actual number of TM definitions ; is not yet available. The TM quantity is hard-coded here and must ; match the actual number below. -NUM_TMS EQU 50 +DEF NUM_TMS EQU 50 -__tmhm_value__ = NUM_TMS + 1 +DEF __tmhm_value__ = NUM_TMS + 1 -add_tmnum: MACRO -\1_TMNUM EQU __tmhm_value__ -__tmhm_value__ += 1 +MACRO add_tmnum + DEF \1_TMNUM EQU __tmhm_value__ + DEF __tmhm_value__ += 1 ENDM -add_hm: MACRO +MACRO add_hm ; Defines three constants: ; - HM_\1: the item id, starting at $C4 ; - \1_TMNUM: the learnable TM/HM flag, starting at 51 ; - HM##_MOVE: alias for the move id, equal to the value of \1 const HM_\1 -HM_VALUE = __tmhm_value__ - NUM_TMS -HM{02d:HM_VALUE}_MOVE EQU \1 + DEF HM_VALUE = __tmhm_value__ - NUM_TMS + DEF HM{02d:HM_VALUE}_MOVE EQU \1 add_tmnum \1 ENDM -HM01 EQU const_value +DEF HM01 EQU const_value add_hm CUT ; $C4 add_hm FLY ; $C5 add_hm SURF ; $C6 add_hm STRENGTH ; $C7 add_hm FLASH ; $C8 -NUM_HMS EQU const_value - HM01 +DEF NUM_HMS EQU const_value - HM01 -__tmhm_value__ = 1 +DEF __tmhm_value__ = 1 -add_tm: MACRO +MACRO add_tm ; Defines three constants: ; - TM_\1: the item id, starting at $C9 ; - \1_TMNUM: the learnable TM/HM flag, starting at 1 ; - TM##_MOVE: alias for the move id, equal to the value of \1 const TM_\1 -TM{02d:__tmhm_value__}_MOVE EQU \1 + DEF TM{02d:__tmhm_value__}_MOVE EQU \1 add_tmnum \1 ENDM -TM01 EQU const_value +DEF TM01 EQU const_value add_tm MEGA_PUNCH ; $C9 add_tm RAZOR_WIND ; $CA add_tm SWORDS_DANCE ; $CB @@ -209,9 +209,9 @@ TM01 EQU const_value add_tm SUBSTITUTE ; $FA ASSERT NUM_TMS == const_value - TM01, "NUM_TMS ({d:NUM_TMS}) does not match the number of add_tm definitions" -NUM_TM_HM EQU NUM_TMS + NUM_HMS +DEF NUM_TM_HM EQU NUM_TMS + NUM_HMS ; 50 TMs + 5 HMs = 55 learnable TM/HM flags per Pokémon. ; These fit in 7 bytes, with one unused bit left over. -__tmhm_value__ = NUM_TM_HM + 1 -UNUSED_TMNUM EQU __tmhm_value__ +DEF __tmhm_value__ = NUM_TM_HM + 1 +DEF UNUSED_TMNUM EQU __tmhm_value__ diff --git a/constants/map_constants.asm b/constants/map_constants.asm index 58343342..86e18e62 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -1,7 +1,7 @@ -mapconst: MACRO +MACRO mapconst const \1 -\1_HEIGHT EQU \2 -\1_WIDTH EQU \3 + DEF \1_HEIGHT EQU \2 + DEF \1_WIDTH EQU \3 ENDM ; map ids @@ -26,9 +26,9 @@ ENDM mapconst CINNABAR_ISLAND, 9, 10 ; $08 mapconst INDIGO_PLATEAU, 9, 10 ; $09 mapconst SAFFRON_CITY, 18, 20 ; $0A -NUM_CITY_MAPS EQU const_value +DEF NUM_CITY_MAPS EQU const_value mapconst UNUSED_MAP_0B, 0, 0 ; $0B -FIRST_ROUTE_MAP EQU const_value +DEF FIRST_ROUTE_MAP EQU const_value mapconst ROUTE_1, 18, 10 ; $0C mapconst ROUTE_2, 36, 10 ; $0D mapconst ROUTE_3, 9, 35 ; $0E @@ -54,7 +54,7 @@ FIRST_ROUTE_MAP EQU const_value mapconst ROUTE_23, 72, 10 ; $22 mapconst ROUTE_24, 18, 10 ; $23 mapconst ROUTE_25, 9, 30 ; $24 -FIRST_INDOOR_MAP EQU const_value +DEF FIRST_INDOOR_MAP EQU const_value mapconst REDS_HOUSE_1F, 4, 4 ; $25 mapconst REDS_HOUSE_2F, 4, 4 ; $26 mapconst BLUES_HOUSE, 4, 4 ; $27 @@ -266,8 +266,8 @@ FIRST_INDOOR_MAP EQU const_value mapconst LORELEIS_ROOM, 6, 5 ; $F5 mapconst BRUNOS_ROOM, 6, 5 ; $F6 mapconst AGATHAS_ROOM, 6, 5 ; $F7 -NUM_MAPS EQU const_value +DEF NUM_MAPS EQU const_value ; Indoor maps, such as houses, use this as the Map ID in their exit warps ; This map ID takes the player back to the last outdoor map they were on, stored in wLastMap -LAST_MAP EQU -1 +DEF LAST_MAP EQU -1 diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index 605e7013..1877e6a0 100644 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -1,6 +1,6 @@ ; width of east/west connections ; height of north/south connections -MAP_BORDER EQU 3 +DEF MAP_BORDER EQU 3 ; connection directions const_def diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index 899e01f0..5c666d83 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -16,7 +16,7 @@ const SPRITESTATEDATA1_0D ; d const SPRITESTATEDATA1_0E ; e const SPRITESTATEDATA1_0F ; f -SPRITESTATEDATA1_LENGTH EQU const_value +DEF SPRITESTATEDATA1_LENGTH EQU const_value ; spritestatedata2 struct members (see macros/wram.asm) const_def @@ -36,24 +36,24 @@ SPRITESTATEDATA1_LENGTH EQU const_value const SPRITESTATEDATA2_PICTUREID ; d const SPRITESTATEDATA2_IMAGEBASEOFFSET ; e const SPRITESTATEDATA2_0F ; f -SPRITESTATEDATA2_LENGTH EQU const_value +DEF SPRITESTATEDATA2_LENGTH EQU const_value -NUM_SPRITESTATEDATA_STRUCTS EQU 16 +DEF NUM_SPRITESTATEDATA_STRUCTS EQU 16 ; different kinds of people events -ITEM EQU $80 -TRAINER EQU $40 +DEF ITEM EQU $80 +DEF TRAINER EQU $40 -WALK EQU $FE -STAY EQU $FF +DEF WALK EQU $FE +DEF STAY EQU $FF -ANY_DIR EQU $00 -UP_DOWN EQU $01 -LEFT_RIGHT EQU $02 -DOWN EQU $D0 -UP EQU $D1 -LEFT EQU $D2 -RIGHT EQU $D3 -NONE EQU $FF +DEF ANY_DIR EQU $00 +DEF UP_DOWN EQU $01 +DEF LEFT_RIGHT EQU $02 +DEF DOWN EQU $D0 +DEF UP EQU $D1 +DEF LEFT EQU $D2 +DEF RIGHT EQU $D3 +DEF NONE EQU $FF -BOULDER_MOVEMENT_BYTE_2 EQU $10 +DEF BOULDER_MOVEMENT_BYTE_2 EQU $10 diff --git a/constants/menu_constants.asm b/constants/menu_constants.asm index eafebe97..f1f0d417 100644 --- a/constants/menu_constants.asm +++ b/constants/menu_constants.asm @@ -1,5 +1,5 @@ -BAG_ITEM_CAPACITY EQU 20 -PC_ITEM_CAPACITY EQU 50 +DEF BAG_ITEM_CAPACITY EQU 20 +DEF PC_ITEM_CAPACITY EQU 50 ; text box IDs const_def 1 @@ -42,15 +42,15 @@ PC_ITEM_CAPACITY EQU 50 const TRADE_CANCEL_MENU ; 5 const HEAL_CANCEL_MENU ; 6 const NO_YES_MENU ; 7 -NUM_TWO_OPTION_MENUS EQU const_value +DEF NUM_TWO_OPTION_MENUS EQU const_value ; menu exit method constants for list menus and the buy/sell/quit menu -CHOSE_MENU_ITEM EQU 1 ; pressed A -CANCELLED_MENU EQU 2 ; pressed B +DEF CHOSE_MENU_ITEM EQU 1 ; pressed A +DEF CANCELLED_MENU EQU 2 ; pressed B ; menu exit method constants for two-option menus -CHOSE_FIRST_ITEM EQU 1 -CHOSE_SECOND_ITEM EQU 2 +DEF CHOSE_FIRST_ITEM EQU 1 +DEF CHOSE_SECOND_ITEM EQU 2 ; move mon constants const_def @@ -71,7 +71,7 @@ CHOSE_SECOND_ITEM EQU 2 ; party menu message IDs ; PartyMenuItemUseMessagePointers indexes (see engine/menus/party_menu.asm) const_next $F0 -FIRST_PARTY_MENU_TEXT_ID EQU const_value +DEF FIRST_PARTY_MENU_TEXT_ID EQU const_value const ANTIDOTE_MSG ; $F0 const BURN_HEAL_MSG ; $F1 const ICE_HEAL_MSG ; $F2 diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 4aff58da..84775608 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -1,6 +1,6 @@ ; Boolean checks -FALSE EQU 0 -TRUE EQU 1 +DEF FALSE EQU 0 +DEF TRUE EQU 1 ; flag operations const_def @@ -9,9 +9,9 @@ TRUE EQU 1 const FLAG_TEST ; 2 ; wOptions -TEXT_DELAY_FAST EQU %001 ; 1 -TEXT_DELAY_MEDIUM EQU %011 ; 3 -TEXT_DELAY_SLOW EQU %101 ; 5 +DEF TEXT_DELAY_FAST EQU %001 ; 1 +DEF TEXT_DELAY_MEDIUM EQU %011 ; 3 +DEF TEXT_DELAY_SLOW EQU %101 ; 5 const_def 6 const BIT_BATTLE_SHIFT ; 6 diff --git a/constants/move_animation_constants.asm b/constants/move_animation_constants.asm index dc8c94fb..3d62cd19 100644 --- a/constants/move_animation_constants.asm +++ b/constants/move_animation_constants.asm @@ -1,7 +1,7 @@ ; special effects that are part of move animations ; SpecialEffectPointers associates them with effect routines (see data/battle_anims/special_effect_pointers.asm) const_def $C0 -FIRST_SE_ID EQU const_value +DEF FIRST_SE_ID EQU const_value const_skip $18 const SE_WAVY_SCREEN ; $D8 used in Psywave/Night Shade/Psychic etc. const SE_SUBSTITUTE_MON ; $D9 used in Substitute (turns the pokemon into a mini sprite) @@ -132,7 +132,7 @@ FIRST_SE_ID EQU const_value const SUBANIM_53 const SUBANIM_54 const SUBANIM_55 -NUM_SUBANIMS EQU const_value +DEF NUM_SUBANIMS EQU const_value ; types of subanimations const_def @@ -268,7 +268,7 @@ NUM_SUBANIMS EQU const_value const FRAMEBLOCK_77 const FRAMEBLOCK_78 const FRAMEBLOCK_79 -NUM_FRAMEBLOCKS EQU const_value +DEF NUM_FRAMEBLOCKS EQU const_value ; base coordinates that are part of subanimations ; FrameBlockBaseCoords indexes (see data/battle_anims/base_coords.asm) @@ -450,7 +450,7 @@ NUM_FRAMEBLOCKS EQU const_value const BASECOORD_AE const BASECOORD_AF const BASECOORD_B0 -NUM_BASECOORDS EQU const_value +DEF NUM_BASECOORDS EQU const_value ; frame block modes that are part of subanimations const_def diff --git a/constants/move_constants.asm b/constants/move_constants.asm index 52c44210..570be95e 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -171,7 +171,7 @@ const SLASH ; a3 const SUBSTITUTE ; a4 const STRUGGLE ; a5 -NUM_ATTACKS EQU const_value - 1 +DEF NUM_ATTACKS EQU const_value - 1 ; Moves do double duty as animation identifiers. @@ -213,4 +213,4 @@ NUM_ATTACKS EQU const_value - 1 const ROCK_ANIM ; throw rock const BAIT_ANIM ; throw bait -NUM_ATTACK_ANIMS EQU const_value - 1 +DEF NUM_ATTACK_ANIMS EQU const_value - 1 diff --git a/constants/move_effect_constants.asm b/constants/move_effect_constants.asm index bc444647..8f33ece3 100644 --- a/constants/move_effect_constants.asm +++ b/constants/move_effect_constants.asm @@ -91,4 +91,4 @@ const LEECH_SEED_EFFECT ; $54 const SPLASH_EFFECT ; $55 const DISABLE_EFFECT ; $56 -NUM_MOVE_EFFECTS EQU const_value - 1 +DEF NUM_MOVE_EFFECTS EQU const_value - 1 diff --git a/constants/music_constants.asm b/constants/music_constants.asm index fcca9005..e72e88d9 100644 --- a/constants/music_constants.asm +++ b/constants/music_constants.asm @@ -1,8 +1,8 @@ ; Song ids are calculated by address to save space. ; SFX_Headers_(1|2|3) indexes (see audio/headers/*.asm) -music_const: MACRO -\1 EQUS "((\2 - SFX_Headers_1) / 3)" +MACRO music_const + DEF \1 EQUS "((\2 - SFX_Headers_1) / 3)" ENDM ; AUDIO_1 @@ -57,7 +57,7 @@ ENDM music_const MUSIC_MEET_MALE_TRAINER, Music_MeetMaleTrainer ; AUDIO_1 AUDIO_2 AUDIO_3 -NOISE_INSTRUMENTS_START EQUS "SFX_NOISE_INSTRUMENT01" +DEF NOISE_INSTRUMENTS_START EQUS "SFX_NOISE_INSTRUMENT01" music_const SFX_NOISE_INSTRUMENT01, SFX_Noise_Instrument01_1 music_const SFX_NOISE_INSTRUMENT02, SFX_Noise_Instrument02_1 music_const SFX_NOISE_INSTRUMENT03, SFX_Noise_Instrument03_1 @@ -77,9 +77,9 @@ NOISE_INSTRUMENTS_START EQUS "SFX_NOISE_INSTRUMENT01" music_const SFX_NOISE_INSTRUMENT17, SFX_Noise_Instrument17_1 music_const SFX_NOISE_INSTRUMENT18, SFX_Noise_Instrument18_1 music_const SFX_NOISE_INSTRUMENT19, SFX_Noise_Instrument19_1 -NOISE_INSTRUMENTS_END EQUS "SFX_NOISE_INSTRUMENT19 + 1" +DEF NOISE_INSTRUMENTS_END EQUS "SFX_NOISE_INSTRUMENT19 + 1" -CRY_SFX_START EQUS "SFX_CRY_00" +DEF CRY_SFX_START EQUS "SFX_CRY_00" music_const SFX_CRY_00, SFX_Cry00_1 music_const SFX_CRY_01, SFX_Cry01_1 music_const SFX_CRY_02, SFX_Cry02_1 @@ -118,7 +118,7 @@ CRY_SFX_START EQUS "SFX_CRY_00" music_const SFX_CRY_23, SFX_Cry23_1 music_const SFX_CRY_24, SFX_Cry24_1 music_const SFX_CRY_25, SFX_Cry25_1 -CRY_SFX_END EQUS "SFX_CRY_25 + 3" +DEF CRY_SFX_END EQUS "SFX_CRY_25 + 3" music_const SFX_GET_ITEM_2, SFX_Get_Item2_1 music_const SFX_TINK, SFX_Tink_1 @@ -163,7 +163,7 @@ CRY_SFX_END EQUS "SFX_CRY_25 + 3" ; AUDIO_1 music_const SFX_POKEFLUTE, SFX_Pokeflute music_const SFX_SAFARI_ZONE_PA, SFX_Safari_Zone_PA -MAX_SFX_ID_1 EQUS "SFX_SAFARI_ZONE_PA" +DEF MAX_SFX_ID_1 EQUS "SFX_SAFARI_ZONE_PA" ; AUDIO_2 music_const SFX_LEVEL_UP, SFX_Level_Up @@ -175,7 +175,7 @@ MAX_SFX_ID_1 EQUS "SFX_SAFARI_ZONE_PA" music_const SFX_DEX_PAGE_ADDED, SFX_Dex_Page_Added music_const SFX_CAUGHT_MON, SFX_Caught_Mon -BATTLE_SFX_START EQUS "SFX_PECK" +DEF BATTLE_SFX_START EQUS "SFX_PECK" music_const SFX_PECK, SFX_Peck music_const SFX_FAINT_FALL, SFX_Faint_Fall music_const SFX_BATTLE_09, SFX_Battle_09 @@ -225,8 +225,8 @@ BATTLE_SFX_START EQUS "SFX_PECK" music_const SFX_BATTLE_35, SFX_Battle_35 music_const SFX_BATTLE_36, SFX_Battle_36 music_const SFX_SILPH_SCOPE, SFX_Silph_Scope -BATTLE_SFX_END EQUS "SFX_SILPH_SCOPE + 1" -MAX_SFX_ID_2 EQUS "SFX_SILPH_SCOPE" +DEF BATTLE_SFX_END EQUS "SFX_SILPH_SCOPE + 1" +DEF MAX_SFX_ID_2 EQUS "SFX_SILPH_SCOPE" ; AUDIO_3 music_const SFX_INTRO_LUNGE, SFX_Intro_Lunge @@ -239,6 +239,6 @@ MAX_SFX_ID_2 EQUS "SFX_SILPH_SCOPE" music_const SFX_SLOTS_REWARD, SFX_Slots_Reward music_const SFX_SLOTS_NEW_SPIN, SFX_Slots_New_Spin music_const SFX_SHOOTING_STAR, SFX_Shooting_Star -MAX_SFX_ID_3 EQUS "SFX_SHOOTING_STAR" +DEF MAX_SFX_ID_3 EQUS "SFX_SHOOTING_STAR" -SFX_STOP_ALL_MUSIC EQU $ff +DEF SFX_STOP_ALL_MUSIC EQU $ff diff --git a/constants/oam_constants.asm b/constants/oam_constants.asm index be63dc24..8c5e6be8 100644 --- a/constants/oam_constants.asm +++ b/constants/oam_constants.asm @@ -1,17 +1,17 @@ ; OAM flags used by this game -OAMFLAG_ENDOFDATA EQU %00000001 ; pseudo OAM flag, only used by game logic -OAMFLAG_CANBEMASKED EQU %00000010 ; pseudo OAM flag, only used by game logic +DEF OAMFLAG_ENDOFDATA EQU %00000001 ; pseudo OAM flag, only used by game logic +DEF OAMFLAG_CANBEMASKED EQU %00000010 ; pseudo OAM flag, only used by game logic ; OAM attribute flags -OAM_PALETTE EQU %111 -OAM_TILE_BANK EQU 3 -OAM_OBP_NUM EQU 4 ; Non CGB Mode Only -OAM_X_FLIP EQU 5 -OAM_Y_FLIP EQU 6 -OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) +DEF OAM_PALETTE EQU %111 +DEF OAM_TILE_BANK EQU 3 +DEF OAM_OBP_NUM EQU 4 ; Non CGB Mode Only +DEF OAM_X_FLIP EQU 5 +DEF OAM_Y_FLIP EQU 6 +DEF OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) ; OAM attribute masks -OAM_OBP1 EQU 1 << OAM_OBP_NUM ; OBJ palette 1 -OAM_HFLIP EQU 1 << OAM_X_FLIP ; horizontal flip -OAM_VFLIP EQU 1 << OAM_Y_FLIP ; vertical flip -OAM_BEHIND_BG EQU 1 << OAM_PRIORITY ; behind bg (except color 0) +DEF OAM_OBP1 EQU 1 << OAM_OBP_NUM ; OBJ palette 1 +DEF OAM_HFLIP EQU 1 << OAM_X_FLIP ; horizontal flip +DEF OAM_VFLIP EQU 1 << OAM_Y_FLIP ; vertical flip +DEF OAM_BEHIND_BG EQU 1 << OAM_PRIORITY ; behind bg (except color 0) diff --git a/constants/palette_constants.asm b/constants/palette_constants.asm index c26945e8..78d39c95 100644 --- a/constants/palette_constants.asm +++ b/constants/palette_constants.asm @@ -4,10 +4,10 @@ const SHADE_LIGHT ; %01 const SHADE_DARK ; %10 const SHADE_BLACK ; %11 -NUM_PAL_COLORS EQU const_value +DEF NUM_PAL_COLORS EQU const_value -PAL_COLOR_SIZE EQU 2 -PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE +DEF PAL_COLOR_SIZE EQU 2 +DEF PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE ; pal/blk packets ; SetPalFunctions indexes (see engine/gfx/palettes.asm) @@ -27,8 +27,8 @@ PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE const SET_PAL_GAME_FREAK_INTRO ; $0C const SET_PAL_TRAINER_CARD ; $0D -SET_PAL_PARTY_MENU_HP_BARS EQU $fc -SET_PAL_DEFAULT EQU $ff +DEF SET_PAL_PARTY_MENU_HP_BARS EQU $fc +DEF SET_PAL_DEFAULT EQU $ff ; sgb palettes ; SuperPalettes indexes (see data/sgb/sgb_palettes.asm) @@ -70,4 +70,4 @@ SET_PAL_DEFAULT EQU $ff const PAL_BADGE ; $22 const PAL_CAVE ; $23 const PAL_GAMEFREAK ; $24 -NUM_SGB_PALS EQU const_value +DEF NUM_SGB_PALS EQU const_value diff --git a/constants/pokedex_constants.asm b/constants/pokedex_constants.asm index a805b261..a839a03a 100644 --- a/constants/pokedex_constants.asm +++ b/constants/pokedex_constants.asm @@ -156,4 +156,4 @@ const DEX_MEWTWO ; 150 const DEX_MEW ; 151 -NUM_POKEMON EQU const_value - 1 +DEF NUM_POKEMON EQU const_value - 1 diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm index d01398b8..ea206bb8 100644 --- a/constants/pokemon_constants.asm +++ b/constants/pokemon_constants.asm @@ -198,12 +198,12 @@ const WEEPINBELL ; $BD const VICTREEBEL ; $BE -NUM_POKEMON_INDEXES EQU const_value - 1 +DEF NUM_POKEMON_INDEXES EQU const_value - 1 ; starters -STARTER1 EQU CHARMANDER -STARTER2 EQU SQUIRTLE -STARTER3 EQU BULBASAUR +DEF STARTER1 EQU CHARMANDER +DEF STARTER2 EQU SQUIRTLE +DEF STARTER3 EQU BULBASAUR ; ghost Marowak in Pokémon Tower -RESTLESS_SOUL EQU MAROWAK +DEF RESTLESS_SOUL EQU MAROWAK diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 6670f777..430abfe0 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -1,37 +1,37 @@ ; base data struct members (see data/pokemon/base_stats/*.asm) rsreset -BASE_DEX_NO rb -BASE_STATS rb NUM_STATS +DEF BASE_DEX_NO rb +DEF BASE_STATS rb NUM_STATS rsset BASE_STATS -BASE_HP rb -BASE_ATK rb -BASE_DEF rb -BASE_SPD rb -BASE_SPC rb -BASE_TYPES rw +DEF BASE_HP rb +DEF BASE_ATK rb +DEF BASE_DEF rb +DEF BASE_SPD rb +DEF BASE_SPC rb +DEF BASE_TYPES rw rsset BASE_TYPES -BASE_TYPE_1 rb -BASE_TYPE_2 rb -BASE_CATCH_RATE rb -BASE_EXP rb -BASE_PIC_SIZE rb -BASE_FRONTPIC rw -BASE_BACKPIC rw -BASE_MOVES rb NUM_MOVES -BASE_GROWTH_RATE rb -BASE_TMHM rb (NUM_TM_HM + 7) / 8 - rb_skip -BASE_DATA_SIZE EQU _RS +DEF BASE_TYPE_1 rb +DEF BASE_TYPE_2 rb +DEF BASE_CATCH_RATE rb +DEF BASE_EXP rb +DEF BASE_PIC_SIZE rb +DEF BASE_FRONTPIC rw +DEF BASE_BACKPIC rw +DEF BASE_MOVES rb NUM_MOVES +DEF BASE_GROWTH_RATE rb +DEF BASE_TMHM rb (NUM_TM_HM + 7) / 8 + rb_skip +DEF BASE_DATA_SIZE EQU _RS -PARTY_LENGTH EQU 6 +DEF PARTY_LENGTH EQU 6 -MONS_PER_BOX EQU 20 -NUM_BOXES EQU 12 +DEF MONS_PER_BOX EQU 20 +DEF NUM_BOXES EQU 12 -HOF_MON EQU $10 -HOF_TEAM EQU PARTY_LENGTH * HOF_MON -HOF_TEAM_CAPACITY EQU 50 +DEF HOF_MON EQU $10 +DEF HOF_TEAM EQU PARTY_LENGTH * HOF_MON +DEF HOF_TEAM_CAPACITY EQU 50 ; mon data locations @@ -52,8 +52,8 @@ HOF_TEAM_CAPACITY EQU 50 const EV_ITEM ; 2 const EV_TRADE ; 3 -MAX_EVOLUTIONS EQU 3 -EVOLUTION_SIZE EQU 4 +DEF MAX_EVOLUTIONS EQU 3 +DEF EVOLUTION_SIZE EQU 4 ; wMonHGrowthRate values @@ -65,8 +65,8 @@ EVOLUTION_SIZE EQU 4 const GROWTH_MEDIUM_SLOW const GROWTH_FAST const GROWTH_SLOW -NUM_GROWTH_RATES EQU const_value +DEF NUM_GROWTH_RATES EQU const_value ; wild data (see data/wild/maps/*.asm) -NUM_WILDMONS EQU 10 -WILDDATA_LENGTH EQU 1 + NUM_WILDMONS * 2 +DEF NUM_WILDMONS EQU 10 +DEF WILDDATA_LENGTH EQU 1 + NUM_WILDMONS * 2 diff --git a/constants/script_constants.asm b/constants/script_constants.asm index fe50e8ae..d4543f05 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -5,17 +5,17 @@ const SMILE_BUBBLE ; 2 ; slot symbols -SLOTS7 EQU $0200 -SLOTSBAR EQU $0604 -SLOTSCHERRY EQU $0A08 -SLOTSFISH EQU $0E0C -SLOTSBIRD EQU $1210 -SLOTSMOUSE EQU $1614 +DEF SLOTS7 EQU $0200 +DEF SLOTSBAR EQU $0604 +DEF SLOTSCHERRY EQU $0A08 +DEF SLOTSFISH EQU $0E0C +DEF SLOTSBIRD EQU $1210 +DEF SLOTSMOUSE EQU $1614 ; StartSlotMachine dialogs -SLOTS_OUTOFORDER EQU $fd -SLOTS_OUTTOLUNCH EQU $fe -SLOTS_SOMEONESKEYS EQU $ff +DEF SLOTS_OUTOFORDER EQU $fd +DEF SLOTS_OUTTOLUNCH EQU $fe +DEF SLOTS_SOMEONESKEYS EQU $ff ; in game trades ; TradeMons indexes (see data/events/trades.asm) @@ -30,7 +30,7 @@ SLOTS_SOMEONESKEYS EQU $ff const TRADE_FOR_DORIS const TRADE_FOR_CRINKLES const TRADE_FOR_SPOT -NUM_NPC_TRADES EQU const_value +DEF NUM_NPC_TRADES EQU const_value ; in game trade dialog sets ; InGameTradeTextPointers indexes (see engine/events/in_game_trades.asm) @@ -50,10 +50,10 @@ NUM_NPC_TRADES EQU const_value const BIT_MARSHBADGE ; 5 const BIT_VOLCANOBADGE ; 6 const BIT_EARTHBADGE ; 7 -NUM_BADGES EQU const_value +DEF NUM_BADGES EQU const_value ; OaksAideScript results -OAKS_AIDE_BAG_FULL EQU $00 -OAKS_AIDE_GOT_ITEM EQU $01 -OAKS_AIDE_NOT_ENOUGH_MONS EQU $80 -OAKS_AIDE_REFUSED EQU $ff +DEF OAKS_AIDE_BAG_FULL EQU $00 +DEF OAKS_AIDE_GOT_ITEM EQU $01 +DEF OAKS_AIDE_NOT_ENOUGH_MONS EQU $80 +DEF OAKS_AIDE_REFUSED EQU $ff diff --git a/constants/serial_constants.asm b/constants/serial_constants.asm index a6aae315..16603980 100644 --- a/constants/serial_constants.asm +++ b/constants/serial_constants.asm @@ -1,27 +1,27 @@ -ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 -ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK EQU $02 +DEF ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 +DEF ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK EQU $02 -USING_EXTERNAL_CLOCK EQU $01 -USING_INTERNAL_CLOCK EQU $02 -CONNECTION_NOT_ESTABLISHED EQU $ff +DEF USING_EXTERNAL_CLOCK EQU $01 +DEF USING_INTERNAL_CLOCK EQU $02 +DEF CONNECTION_NOT_ESTABLISHED EQU $ff ; signals the start of an array of bytes transferred over the link cable -SERIAL_PREAMBLE_BYTE EQU $FD +DEF SERIAL_PREAMBLE_BYTE EQU $FD ; this byte is used when there is no data to send -SERIAL_NO_DATA_BYTE EQU $FE +DEF SERIAL_NO_DATA_BYTE EQU $FE ; signals the end of one part of a patch list (there are two parts) for player/enemy party data -SERIAL_PATCH_LIST_PART_TERMINATOR EQU $FF +DEF SERIAL_PATCH_LIST_PART_TERMINATOR EQU $FF -LINK_STATE_NONE EQU $00 ; not using link -LINK_STATE_IN_CABLE_CLUB EQU $01 ; in a cable club room (Colosseum or Trade Centre) -LINK_STATE_START_TRADE EQU $02 ; pre-trade selection screen initialisation -LINK_STATE_START_BATTLE EQU $03 ; pre-battle initialisation -LINK_STATE_BATTLING EQU $04 ; in a link battle -LINK_STATE_RESET EQU $05 ; reset game (unused) -LINK_STATE_TRADING EQU $32 ; in a link trade +DEF LINK_STATE_NONE EQU $00 ; not using link +DEF LINK_STATE_IN_CABLE_CLUB EQU $01 ; in a cable club room (Colosseum or Trade Centre) +DEF LINK_STATE_START_TRADE EQU $02 ; pre-trade selection screen initialisation +DEF LINK_STATE_START_BATTLE EQU $03 ; pre-battle initialisation +DEF LINK_STATE_BATTLING EQU $04 ; in a link battle +DEF LINK_STATE_RESET EQU $05 ; reset game (unused) +DEF LINK_STATE_TRADING EQU $32 ; in a link trade -LINKBATTLE_RUN EQU $F -LINKBATTLE_STRUGGLE EQU $E -LINKBATTLE_NO_ACTION EQU $D +DEF LINKBATTLE_RUN EQU $F +DEF LINKBATTLE_STRUGGLE EQU $E +DEF LINKBATTLE_NO_ACTION EQU $D diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm index ee7238d9..700ec47a 100644 --- a/constants/sprite_constants.asm +++ b/constants/sprite_constants.asm @@ -62,7 +62,7 @@ const SPRITE_BRUNO ; $3a const SPRITE_LORELEI ; $3b const SPRITE_SEEL ; $3c -FIRST_STILL_SPRITE EQU const_value +DEF FIRST_STILL_SPRITE EQU const_value const SPRITE_POKE_BALL ; $3d const SPRITE_FOSSIL ; $3e const SPRITE_BOULDER ; $3f @@ -75,4 +75,4 @@ FIRST_STILL_SPRITE EQU const_value const SPRITE_UNUSED_GAMBLER_ASLEEP_1 ; $46 const SPRITE_UNUSED_GAMBLER_ASLEEP_2 ; $47 const SPRITE_GAMBLER_ASLEEP ; $48 -NUM_SPRITES EQU const_value - 1 +DEF NUM_SPRITES EQU const_value - 1 diff --git a/constants/sprite_data_constants.asm b/constants/sprite_data_constants.asm index e1104262..44dc0fa9 100644 --- a/constants/sprite_data_constants.asm +++ b/constants/sprite_data_constants.asm @@ -11,7 +11,7 @@ const NPC_MOVEMENT_LEFT ; $80 const NPC_MOVEMENT_RIGHT ; $C0 -NPC_CHANGE_FACING EQU $E0 +DEF NPC_CHANGE_FACING EQU $E0 ; player direction constants const_def @@ -20,7 +20,7 @@ NPC_CHANGE_FACING EQU $E0 const PLAYER_DIR_BIT_DOWN ; 2 const PLAYER_DIR_BIT_UP ; 3 -PLAYER_DIR_RIGHT EQU 1 << PLAYER_DIR_BIT_RIGHT -PLAYER_DIR_LEFT EQU 1 << PLAYER_DIR_BIT_LEFT -PLAYER_DIR_DOWN EQU 1 << PLAYER_DIR_BIT_DOWN -PLAYER_DIR_UP EQU 1 << PLAYER_DIR_BIT_UP +DEF PLAYER_DIR_RIGHT EQU 1 << PLAYER_DIR_BIT_RIGHT +DEF PLAYER_DIR_LEFT EQU 1 << PLAYER_DIR_BIT_LEFT +DEF PLAYER_DIR_DOWN EQU 1 << PLAYER_DIR_BIT_DOWN +DEF PLAYER_DIR_UP EQU 1 << PLAYER_DIR_BIT_UP diff --git a/constants/text_constants.asm b/constants/text_constants.asm index e0d36148..5943457b 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -1,6 +1,6 @@ -NAME_LENGTH EQU 11 -ITEM_NAME_LENGTH EQU 13 -NAME_BUFFER_LENGTH EQU 20 +DEF NAME_LENGTH EQU 11 +DEF ITEM_NAME_LENGTH EQU 13 +DEF NAME_BUFFER_LENGTH EQU 20 ; PrintNumber const_def 5 @@ -8,9 +8,9 @@ NAME_BUFFER_LENGTH EQU 20 const BIT_LEFT_ALIGN ; 6 const BIT_LEADING_ZEROES ; 7 -MONEY_SIGN EQU (1 << BIT_MONEY_SIGN) -LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN) -LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES) +DEF MONEY_SIGN EQU (1 << BIT_MONEY_SIGN) +DEF LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN) +DEF LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES) ; special text IDs (see home/text_script.asm) const_def $d0 @@ -19,4 +19,4 @@ LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES) const TEXT_REPEL_WORE_OFF ; $d2 const TEXT_SAFARI_GAME_OVER ; $d3 -TEXT_START_MENU EQU $00 +DEF TEXT_START_MENU EQU $00 diff --git a/constants/tileset_constants.asm b/constants/tileset_constants.asm index 446df021..e7fe88f5 100644 --- a/constants/tileset_constants.asm +++ b/constants/tileset_constants.asm @@ -25,4 +25,4 @@ const CLUB ; 21 const FACILITY ; 22 const PLATEAU ; 23 -NUM_TILESETS EQU const_value +DEF NUM_TILESETS EQU const_value diff --git a/constants/trainer_constants.asm b/constants/trainer_constants.asm index 14b662f3..4daf8a96 100644 --- a/constants/trainer_constants.asm +++ b/constants/trainer_constants.asm @@ -1,8 +1,8 @@ -OPP_ID_OFFSET EQU 200 +DEF OPP_ID_OFFSET EQU 200 -trainer_const: MACRO +MACRO trainer_const const \1 -OPP_\1 EQU OPP_ID_OFFSET + \1 + DEF OPP_\1 EQU OPP_ID_OFFSET + \1 ENDM ; trainer class ids @@ -62,4 +62,4 @@ ENDM trainer_const CHANNELER ; $2D trainer_const AGATHA ; $2E trainer_const LANCE ; $2F -NUM_TRAINERS EQU const_value - 1 +DEF NUM_TRAINERS EQU const_value - 1 diff --git a/constants/type_constants.asm b/constants/type_constants.asm index 24817c20..e9df7faf 100644 --- a/constants/type_constants.asm +++ b/constants/type_constants.asm @@ -1,7 +1,7 @@ ; TypeNames indexes (see data/types/names.asm) const_def -PHYSICAL EQU const_value +DEF PHYSICAL EQU const_value const NORMAL ; $00 const FIGHTING ; $01 const FLYING ; $02 @@ -14,7 +14,7 @@ PHYSICAL EQU const_value const_next 20 -SPECIAL EQU const_value +DEF SPECIAL EQU const_value const FIRE ; $14 const WATER ; $15 const GRASS ; $16 @@ -23,4 +23,4 @@ SPECIAL EQU const_value const ICE ; $19 const DRAGON ; $1A -NUM_TYPES EQU const_value +DEF NUM_TYPES EQU const_value diff --git a/data/battle_anims/special_effect_pointers.asm b/data/battle_anims/special_effect_pointers.asm index 4e2fb857..4089d557 100644 --- a/data/battle_anims/special_effect_pointers.asm +++ b/data/battle_anims/special_effect_pointers.asm @@ -1,4 +1,4 @@ -special_effect: MACRO +MACRO special_effect db \1 dw \2 ENDM diff --git a/data/battle_anims/special_effects.asm b/data/battle_anims/special_effects.asm index 98385d47..068e3b19 100644 --- a/data/battle_anims/special_effects.asm +++ b/data/battle_anims/special_effects.asm @@ -1,4 +1,4 @@ -anim_special_effect: MACRO +MACRO anim_special_effect db \1 dw \2 ENDM diff --git a/data/battle_anims/subanimations.asm b/data/battle_anims/subanimations.asm index 54d346a6..d67d4641 100644 --- a/data/battle_anims/subanimations.asm +++ b/data/battle_anims/subanimations.asm @@ -94,7 +94,7 @@ SubanimationPointers: ; db frame block id, base coordinate id, frame block mode ; ENDR -subanim: MACRO +MACRO subanim db (\1 << 5) | \2 ENDM diff --git a/data/events/bench_guys.asm b/data/events/bench_guys.asm index 2e7eeb2a..8f3d0948 100644 --- a/data/events/bench_guys.asm +++ b/data/events/bench_guys.asm @@ -1,4 +1,4 @@ -bench_guy_text: MACRO +MACRO bench_guy_text db \1, \2 db_tx_pre \3 ENDM diff --git a/data/events/hidden_coins.asm b/data/events/hidden_coins.asm index bcdbcd80..f2485f50 100644 --- a/data/events/hidden_coins.asm +++ b/data/events/hidden_coins.asm @@ -1,4 +1,4 @@ -hidden_coin: MACRO +MACRO hidden_coin db \1, \3, \2 ENDM diff --git a/data/events/hidden_item_coords.asm b/data/events/hidden_item_coords.asm index 115f53aa..30619d6b 100644 --- a/data/events/hidden_item_coords.asm +++ b/data/events/hidden_item_coords.asm @@ -1,4 +1,4 @@ -hidden_item: MACRO +MACRO hidden_item db \1, \3, \2 ENDM diff --git a/data/events/hidden_objects.asm b/data/events/hidden_objects.asm index efb99026..55e33731 100644 --- a/data/events/hidden_objects.asm +++ b/data/events/hidden_objects.asm @@ -174,14 +174,14 @@ HiddenObjectPointers: dw CeruleanCityHiddenObjects dw Route4HiddenObjects -hidden_object: MACRO +MACRO hidden_object db \2 ; y coord db \1 ; x coord db \3 ; item id dba \4 ; object routine ENDM -hidden_text_predef: MACRO +MACRO hidden_text_predef db \2 ; y coord db \1 ; x coord db_tx_pre \3 ; text id @@ -191,7 +191,7 @@ ENDM ; Some hidden objects use SPRITE_FACING_* values, ; but these do not actually prevent the player ; from interacting with them in any direction. -ANY_FACING EQU $d0 +DEF ANY_FACING EQU $d0 TradeCenterHiddenObjects: hidden_object 5, 4, ANY_FACING, CableClubRightGameboy diff --git a/data/growth_rates.asm b/data/growth_rates.asm index cc0955e4..aaba27a8 100644 --- a/data/growth_rates.asm +++ b/data/growth_rates.asm @@ -1,4 +1,4 @@ -growth_rate: MACRO +MACRO growth_rate ; [1]/[2]*n**3 + [3]*n**2 + [4]*n - [5] dn \1, \2 if \3 < 0 diff --git a/data/icon_pointers.asm b/data/icon_pointers.asm index 79db936e..1ff8a29e 100644 --- a/data/icon_pointers.asm +++ b/data/icon_pointers.asm @@ -1,4 +1,4 @@ -mon_icon_header: MACRO +MACRO mon_icon_header dw \1 tile \2 db \3 db BANK(\1) diff --git a/data/items/vending_prices.asm b/data/items/vending_prices.asm index 9680c48d..39f6dfde 100644 --- a/data/items/vending_prices.asm +++ b/data/items/vending_prices.asm @@ -1,4 +1,4 @@ -vend_item: MACRO +MACRO vend_item db \1 bcd3 \2 ENDM diff --git a/data/maps/force_bike_surf.asm b/data/maps/force_bike_surf.asm index 74eba325..01416d89 100644 --- a/data/maps/force_bike_surf.asm +++ b/data/maps/force_bike_surf.asm @@ -1,4 +1,4 @@ -force_bike_surf: MACRO +MACRO force_bike_surf db \1, \3, \2 ENDM diff --git a/data/maps/special_warps.asm b/data/maps/special_warps.asm index 56dac3a5..cad320ed 100644 --- a/data/maps/special_warps.asm +++ b/data/maps/special_warps.asm @@ -17,7 +17,7 @@ DungeonWarpList: db -1 ; end -fly_warp: MACRO +MACRO fly_warp event_displacement \1_WIDTH, \2, \3 db ((\3) & $01) ;sub-block Y db ((\2) & $01) ;sub-block X @@ -38,7 +38,7 @@ DungeonWarpData: fly_warp POKEMON_MANSION_2F, 18, 14 -special_warp_spec: MACRO +MACRO special_warp_spec db \1 fly_warp \1, \2, \3 db \4 @@ -56,7 +56,7 @@ ColosseumSpec2: special_warp_spec COLOSSEUM, 6, 4, CLUB -fly_warp_spec: MACRO +MACRO fly_warp_spec db \1, 0 dw \2 ENDM diff --git a/data/maps/sprite_sets.asm b/data/maps/sprite_sets.asm index 6aad2958..755ed2fc 100644 --- a/data/maps/sprite_sets.asm +++ b/data/maps/sprite_sets.asm @@ -39,8 +39,8 @@ MapSpriteSets: db $02 ; ROUTE_25 assert_table_length FIRST_INDOOR_MAP -EAST_WEST EQU 1 -NORTH_SOUTH EQU 2 +DEF EAST_WEST EQU 1 +DEF NORTH_SOUTH EQU 2 ; Format: ; 00: determines whether the map is split EAST_WEST or NORTH_SOUTH @@ -64,7 +64,7 @@ SplitMapSpriteSets: SpriteSets: ; each sprite set has 9 walking sprites and 2 still sprites -SPRITE_SET_LENGTH EQU 9 + 2 +DEF SPRITE_SET_LENGTH EQU 9 + 2 ; sprite set $01 table_width 1 diff --git a/data/maps/town_map_entries.asm b/data/maps/town_map_entries.asm index fdec1e15..78b7ff62 100644 --- a/data/maps/town_map_entries.asm +++ b/data/maps/town_map_entries.asm @@ -1,4 +1,4 @@ -external_map: MACRO +MACRO external_map dn \2, \1 dw \3 ENDM @@ -47,7 +47,7 @@ ExternalMapEntries: assert_table_length FIRST_INDOOR_MAP -internal_map: MACRO +MACRO internal_map db \1 + 1 dn \3, \2 dw \4 diff --git a/data/moves/animations.asm b/data/moves/animations.asm index 0d8a2bd4..0049cf59 100644 --- a/data/moves/animations.asm +++ b/data/moves/animations.asm @@ -214,7 +214,7 @@ AttackAnimationPointers: ; if \2 is a subanimation_id: ;\3: tileset_id ;\4: delay -battle_anim: MACRO +MACRO battle_anim IF _NARG == 4 db (\3 << 6) | \4 db \1 - 1 diff --git a/data/moves/moves.asm b/data/moves/moves.asm index 0e52e01c..b7e5e7af 100644 --- a/data/moves/moves.asm +++ b/data/moves/moves.asm @@ -1,4 +1,4 @@ -move: MACRO +MACRO move db \1 ; animation (interchangeable with move id) db \2 ; effect db \3 ; power diff --git a/data/pokemon/cries.asm b/data/pokemon/cries.asm index f823cdef..290f5625 100644 --- a/data/pokemon/cries.asm +++ b/data/pokemon/cries.asm @@ -1,4 +1,4 @@ -mon_cry: MACRO +MACRO mon_cry db (\1 - CRY_SFX_START) / 3 db \2, \3 ENDM diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index b8911f3c..eaef75f6 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -1,10 +1,10 @@ -add_predef: MACRO +MACRO add_predef \1Predef:: -IF _NARG == 1 - dba \1 -ELSE - dbw \2, \1 -ENDC + IF _NARG == 1 + dba \1 + ELSE + dbw \2, \1 + ENDC ENDM PredefPointers:: diff --git a/data/sgb/sgb_packets.asm b/data/sgb/sgb_packets.asm index 0b6219e1..11fc8900 100644 --- a/data/sgb/sgb_packets.asm +++ b/data/sgb/sgb_packets.asm @@ -1,51 +1,51 @@ -ATTR_BLK: MACRO +MACRO ATTR_BLK ; This is a command macro. ; Use ATTR_BLK_DATA for data sets. db ($4 << 3) + ((\1 * 6) / 16 + 1) db \1 ENDM -ATTR_BLK_DATA: MACRO +MACRO ATTR_BLK_DATA db \1 ; which regions are affected db \2 + (\3 << 2) + (\4 << 4) ; palette for each region db \5, \6, \7, \8 ; x1, y1, x2, y2 ENDM -PAL_SET: MACRO +MACRO PAL_SET db ($a << 3) + 1 dw \1, \2, \3, \4 ds 7, 0 ENDM -PAL_TRN: MACRO +MACRO PAL_TRN db ($b << 3) + 1 ds 15, 0 ENDM -MLT_REQ: MACRO +MACRO MLT_REQ db ($11 << 3) + 1 db \1 - 1 ds 14, 0 ENDM -CHR_TRN: MACRO +MACRO CHR_TRN db ($13 << 3) + 1 db \1 + (\2 << 1) ds 14, 0 ENDM -PCT_TRN: MACRO +MACRO PCT_TRN db ($14 << 3) + 1 ds 15, 0 ENDM -MASK_EN: MACRO +MACRO MASK_EN db ($17 << 3) + 1 db \1 ds 14, 0 ENDM -DATA_SND: MACRO +MACRO DATA_SND db ($f << 3) + 1 dw \1 ; address db \2 ; bank diff --git a/data/sprites/sprites.asm b/data/sprites/sprites.asm index 1cd793c1..72715087 100644 --- a/data/sprites/sprites.asm +++ b/data/sprites/sprites.asm @@ -1,4 +1,4 @@ -overworld_sprite: MACRO +MACRO overworld_sprite dw \1 db \2 tiles db BANK(\1) diff --git a/data/text_boxes.asm b/data/text_boxes.asm index 34e6a414..f96f2d68 100644 --- a/data/text_boxes.asm +++ b/data/text_boxes.asm @@ -15,7 +15,7 @@ TextBoxCoordTable: db MON_SPRITE_POPUP, 6, 4, 14, 13 db -1 ; end -text_box_text: MACRO +MACRO text_box_text db \1 ; text box ID db \2, \3, \4, \5 ; text box coordinates dw \6 ; text pointer diff --git a/data/text_predef_pointers.asm b/data/text_predef_pointers.asm index 8c125fa0..d13e0f16 100644 --- a/data/text_predef_pointers.asm +++ b/data/text_predef_pointers.asm @@ -1,4 +1,4 @@ -add_tx_pre: MACRO +MACRO add_tx_pre \1_id:: dw \1 ENDM diff --git a/data/tilemaps.asm b/data/tilemaps.asm index 3b1e24c9..3e1033be 100644 --- a/data/tilemaps.asm +++ b/data/tilemaps.asm @@ -1,4 +1,4 @@ -tile_ids: MACRO +MACRO tile_ids dw \1 dn \3, \2 ENDM diff --git a/data/tilesets/bookshelf_tile_ids.asm b/data/tilesets/bookshelf_tile_ids.asm index 55143d73..71529761 100644 --- a/data/tilesets/bookshelf_tile_ids.asm +++ b/data/tilesets/bookshelf_tile_ids.asm @@ -1,4 +1,4 @@ -bookshelf_tile: MACRO +MACRO bookshelf_tile db \1, \2 db_tx_pre \3 ENDM diff --git a/data/tilesets/collision_tile_ids.asm b/data/tilesets/collision_tile_ids.asm index c1bee7ce..94efc925 100644 --- a/data/tilesets/collision_tile_ids.asm +++ b/data/tilesets/collision_tile_ids.asm @@ -1,4 +1,4 @@ -coll_tiles: MACRO +MACRO coll_tiles IF _NARG db \# ; all args ENDC diff --git a/data/tilesets/door_tile_ids.asm b/data/tilesets/door_tile_ids.asm index 716f76f3..4b4a65ed 100644 --- a/data/tilesets/door_tile_ids.asm +++ b/data/tilesets/door_tile_ids.asm @@ -14,7 +14,7 @@ DoorTileIDPointers: dbw PLATEAU, .PlateauDoorTileIDs db -1 ; end -door_tiles: MACRO +MACRO door_tiles IF _NARG db \# ; all args ENDC diff --git a/data/tilesets/spinner_tiles.asm b/data/tilesets/spinner_tiles.asm index 82506b6d..9ce3deb3 100644 --- a/data/tilesets/spinner_tiles.asm +++ b/data/tilesets/spinner_tiles.asm @@ -1,4 +1,4 @@ -spinner: MACRO +MACRO spinner ; \1: source ; \2: offset (BANK() chokes on literals) ; \3: dest diff --git a/data/tilesets/tileset_headers.asm b/data/tilesets/tileset_headers.asm index 375b0687..a8500ef2 100644 --- a/data/tilesets/tileset_headers.asm +++ b/data/tilesets/tileset_headers.asm @@ -1,4 +1,4 @@ -tileset: MACRO +MACRO tileset db BANK(\1_GFX) dw \1_Block, \1_GFX, \1_Coll db \2, \3, \4 ; counter tiles diff --git a/data/tilesets/warp_carpet_tile_ids.asm b/data/tilesets/warp_carpet_tile_ids.asm index a8a19011..1b8ebbbe 100644 --- a/data/tilesets/warp_carpet_tile_ids.asm +++ b/data/tilesets/warp_carpet_tile_ids.asm @@ -4,7 +4,7 @@ WarpTileListPointers: dw .FacingLeftWarpTiles dw .FacingRightWarpTiles -warp_carpet_tiles: MACRO +MACRO warp_carpet_tiles IF _NARG db \# ; all args ENDC diff --git a/data/tilesets/warp_tile_ids.asm b/data/tilesets/warp_tile_ids.asm index 80df6cdf..823b4b36 100644 --- a/data/tilesets/warp_tile_ids.asm +++ b/data/tilesets/warp_tile_ids.asm @@ -26,7 +26,7 @@ WarpTileIDPointers: dw .PlateauWarpTileIDs assert_table_length NUM_TILESETS -warp_tiles: MACRO +MACRO warp_tiles IF _NARG db \# ; all args ENDC diff --git a/data/trainers/move_choices.asm b/data/trainers/move_choices.asm index 66bc36e7..3741f06b 100644 --- a/data/trainers/move_choices.asm +++ b/data/trainers/move_choices.asm @@ -1,9 +1,9 @@ -move_choices: MACRO +MACRO move_choices IF _NARG db \# ; all args ENDC db 0 ; end -list_index += 1 + DEF list_index += 1 ENDM ; move choice modification methods that are applied for each trainer class diff --git a/data/trainers/pic_pointers_money.asm b/data/trainers/pic_pointers_money.asm index 36ee77ce..4515d880 100644 --- a/data/trainers/pic_pointers_money.asm +++ b/data/trainers/pic_pointers_money.asm @@ -1,4 +1,4 @@ -pic_money: MACRO +MACRO pic_money dw \1 bcd3 \2 ENDM diff --git a/data/yes_no_menu_strings.asm b/data/yes_no_menu_strings.asm index e6e23279..82c3a3a5 100644 --- a/data/yes_no_menu_strings.asm +++ b/data/yes_no_menu_strings.asm @@ -1,4 +1,4 @@ -two_option_menu: MACRO +MACRO two_option_menu db \1, \2, \3 dw \4 ENDM diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index afed76d7..c25257f0 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -372,7 +372,7 @@ LoadAnimationTileset: ld c, a ; number of tiles jp CopyVideoData ; load tileset -anim_tileset: MACRO +MACRO anim_tileset db \1 dw \2 db -1 ; padding diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 90e99f98..bc4665e4 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -662,7 +662,7 @@ BattleTransition_Circle_Sub2: const CIRCLE_LEFT const CIRCLE_RIGHT -half_circle: MACRO +MACRO half_circle ; quadrant x, circle data, target coord db \1 dw \2 diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 91541f09..7c48c086 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -1,4 +1,4 @@ -CIRCLE_TILE_ID EQU $70 +DEF CIRCLE_TILE_ID EQU $70 DisplayDiploma:: call SaveScreenTilesToBuffer2 @@ -83,7 +83,7 @@ UnusedPlayerNameLengthFunc: dec c jr .loop -diploma_text: MACRO +MACRO diploma_text dw \3 dwcoord \1, \2 ENDM diff --git a/engine/events/hidden_objects/cinnabar_gym_quiz.asm b/engine/events/hidden_objects/cinnabar_gym_quiz.asm index e2ae7fbe..f4c46115 100644 --- a/engine/events/hidden_objects/cinnabar_gym_quiz.asm +++ b/engine/events/hidden_objects/cinnabar_gym_quiz.asm @@ -183,12 +183,12 @@ UpdateCinnabarGymGateTileBlocks_:: jr nz, .loop ret -gym_gate_coord: MACRO +MACRO gym_gate_coord db \1, \2, \3, 0 ENDM -HORIZONTAL_GATE_BLOCK EQU $54 -VERTICAL_GATE_BLOCK EQU $5f +DEF HORIZONTAL_GATE_BLOCK EQU $54 +DEF VERTICAL_GATE_BLOCK EQU $5f CinnabarGymGateCoords: ; x coord, y coord, block id diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 16409640..6f6b88c7 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -280,8 +280,8 @@ GetPartyMonSpriteID: INCLUDE "data/pokemon/menu_icons.asm" -INC_FRAME_1 EQUS "0, $20" -INC_FRAME_2 EQUS "$20, $20" +DEF INC_FRAME_1 EQUS "0, $20" +DEF INC_FRAME_2 EQUS "$20, $20" BugIconFrame1: INCBIN "gfx/icons/bug.2bpp", INC_FRAME_1 PlantIconFrame1: INCBIN "gfx/icons/plant.2bpp", INC_FRAME_1 diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index a12c0c8a..93047216 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -1,4 +1,4 @@ -NOT_VISITED EQU $fe +DEF NOT_VISITED EQU $fe DisplayTownMap: call LoadTownMap diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index 9813d67c..bca095a8 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -3,7 +3,7 @@ const MOVE_GENGAR_RIGHT const MOVE_GENGAR_LEFT -ANIMATION_END EQU 80 +DEF ANIMATION_END EQU 80 PlayIntro: xor a diff --git a/engine/movie/oak_speech/init_player_data.asm b/engine/movie/oak_speech/init_player_data.asm index f722ebff..44869d44 100644 --- a/engine/movie/oak_speech/init_player_data.asm +++ b/engine/movie/oak_speech/init_player_data.asm @@ -21,7 +21,7 @@ InitPlayerData2: ld hl, wNumBoxItems call InitializeEmptyList -START_MONEY EQU $3000 +DEF START_MONEY EQU $3000 ld hl, wPlayerMoney + 1 ld a, HIGH(START_MONEY) ld [hld], a diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index a287c9b4..35423820 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -56,12 +56,12 @@ TradeAnimCommon: ld [wOptions], a ret -addtradefunc: MACRO +MACRO addtradefunc \1TradeFunc:: dw \1 ENDM -tradefunc: MACRO +MACRO tradefunc db (\1TradeFunc - TradeFuncPointerTable) / 2 ENDM @@ -697,7 +697,7 @@ Trade_WriteCircleOAM: jr nz, .loop ret -trade_circle_oam: MACRO +MACRO trade_circle_oam dw \1 db \2, \3 ENDM diff --git a/engine/overworld/dust_smoke.asm b/engine/overworld/dust_smoke.asm index bb291567..c97b3e56 100644 --- a/engine/overworld/dust_smoke.asm +++ b/engine/overworld/dust_smoke.asm @@ -51,7 +51,7 @@ GetMoveBoulderDustFunctionPointer: pop hl ret -boulder_dust_adjust: MACRO +MACRO boulder_dust_adjust db \1, \2 ; coords dw \3 ; function ENDM diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 2fb8c384..e08da61a 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -1,4 +1,4 @@ -MAP_TILESET_SIZE EQU $60 +DEF MAP_TILESET_SIZE EQU $60 UpdatePlayerSprite: ld a, [wSpritePlayerStateData2WalkAnimationCounter] diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index c458a013..6a890cfd 100644 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -475,7 +475,7 @@ FishingRodOAM: dbsprite 8, 10, 0, 0, $fe, 0 ; left dbsprite 11, 10, 0, 0, $fe, OAM_HFLIP ; right -fishing_gfx: MACRO +MACRO fishing_gfx dw \1 db \2 db BANK(\1) diff --git a/home/init.asm b/home/init.asm index e5840e65..81e75586 100644 --- a/home/init.asm +++ b/home/init.asm @@ -8,7 +8,7 @@ SoftReset:: Init:: ; Program init. -rLCDC_DEFAULT EQU %11100011 +DEF rLCDC_DEFAULT EQU %11100011 ; * LCD enabled ; * Window tile map at $9C00 ; * Window display enabled diff --git a/home/print_num.asm b/home/print_num.asm index e2628b1f..ef202239 100644 --- a/home/print_num.asm +++ b/home/print_num.asm @@ -59,20 +59,20 @@ PrintNumber:: cp 6 jr z, .hundred_thousands -print_digit: MACRO +MACRO print_digit -IF (\1) / $10000 - ld a, \1 / $10000 % $100 -ELSE - xor a -ENDC + IF (\1) / $10000 + ld a, \1 / $10000 % $100 + ELSE + xor a + ENDC ldh [hPowerOf10 + 0], a -IF (\1) / $100 - ld a, \1 / $100 % $100 -ELSE - xor a -ENDC + IF (\1) / $100 + ld a, \1 / $100 % $100 + ELSE + xor a + ENDC ldh [hPowerOf10 + 1], a ld a, \1 / $1 % $100 diff --git a/home/text.asm b/home/text.asm index 244c6fdb..b1f5e55c 100644 --- a/home/text.asm +++ b/home/text.asm @@ -123,7 +123,7 @@ TextIDErrorText:: ; "[hSpriteIndexOrTextID] ERROR." text_far _TextIDErrorText text_end -print_name: MACRO +MACRO print_name push de ld de, \1 jr PlaceCommandCharacter diff --git a/home/text_script.asm b/home/text_script.asm index 39bc3f5b..9e1ba275 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -66,7 +66,7 @@ DisplayTextID:: ; check first byte of text for special cases -dict2: MACRO +MACRO dict2 cp \1 jr nz, .not\@ \2 diff --git a/home/vblank.asm b/home/vblank.asm index 4c7abc20..b8b46ba7 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -93,7 +93,7 @@ DelayFrame:: ; Wait for the next vblank interrupt. ; As a bonus, this saves battery. -NOT_VBLANKED EQU 1 +DEF NOT_VBLANKED EQU 1 ld a, NOT_VBLANKED ldh [hVBlankOccurred], a diff --git a/macros/asserts.asm b/macros/asserts.asm index df2cdcd4..64e6bc7b 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -1,122 +1,122 @@ ; Macros to verify assumptions about the data or code -table_width: MACRO -CURRENT_TABLE_WIDTH = \1 -IF _NARG == 2 -REDEF CURRENT_TABLE_START EQUS "\2" -ELSE -REDEF CURRENT_TABLE_START EQUS "._table_width\@" -{CURRENT_TABLE_START}: -ENDC +MACRO table_width + DEF CURRENT_TABLE_WIDTH = \1 + IF _NARG == 2 + REDEF CURRENT_TABLE_START EQUS "\2" + ELSE + REDEF CURRENT_TABLE_START EQUS "._table_width\@" + {CURRENT_TABLE_START}: + ENDC ENDM -assert_table_length: MACRO -x = \1 +MACRO assert_table_length + DEF x = \1 ASSERT x * CURRENT_TABLE_WIDTH == @ - {CURRENT_TABLE_START}, \ "{CURRENT_TABLE_START}: expected {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes" ENDM -list_start: MACRO -list_index = 0 -IF _NARG == 1 -REDEF CURRENT_LIST_START EQUS "\1" -ELSE -REDEF CURRENT_LIST_START EQUS "._list_start\@" -{CURRENT_LIST_START}: -ENDC +MACRO list_start + DEF list_index = 0 + IF _NARG == 1 + REDEF CURRENT_LIST_START EQUS "\1" + ELSE + REDEF CURRENT_LIST_START EQUS "._list_start\@" + {CURRENT_LIST_START}: + ENDC ENDM -li: MACRO +MACRO li ASSERT !STRIN(\1, "@"), STRCAT("String terminator \"@\" in list entry: ", \1) db \1, "@" -list_index += 1 + DEF list_index += 1 ENDM -assert_list_length: MACRO -x = \1 +MACRO assert_list_length + DEF x = \1 ASSERT x == list_index, \ "{CURRENT_LIST_START}: expected {d:x} entries, got {d:list_index}" ENDM -nybble_array: MACRO -CURRENT_NYBBLE_ARRAY_VALUE = 0 -CURRENT_NYBBLE_ARRAY_LENGTH = 0 -IF _NARG == 1 -REDEF CURRENT_NYBBLE_ARRAY_START EQUS "\1" -ELSE -REDEF CURRENT_NYBBLE_ARRAY_START EQUS "._nybble_array\@" -{CURRENT_NYBBLE_ARRAY_START}: -ENDC +MACRO nybble_array + DEF CURRENT_NYBBLE_ARRAY_VALUE = 0 + DEF CURRENT_NYBBLE_ARRAY_LENGTH = 0 + IF _NARG == 1 + REDEF CURRENT_NYBBLE_ARRAY_START EQUS "\1" + ELSE + REDEF CURRENT_NYBBLE_ARRAY_START EQUS "._nybble_array\@" + {CURRENT_NYBBLE_ARRAY_START}: + ENDC ENDM -nybble: MACRO +MACRO nybble ASSERT 0 <= (\1) && (\1) < $10, "nybbles must be 0-15" -CURRENT_NYBBLE_ARRAY_VALUE = (\1) | (CURRENT_NYBBLE_ARRAY_VALUE << 4) -CURRENT_NYBBLE_ARRAY_LENGTH += 1 -IF CURRENT_NYBBLE_ARRAY_LENGTH % 2 == 0 - db CURRENT_NYBBLE_ARRAY_VALUE -CURRENT_NYBBLE_ARRAY_VALUE = 0 -ENDC + DEF CURRENT_NYBBLE_ARRAY_VALUE = (\1) | (CURRENT_NYBBLE_ARRAY_VALUE << 4) + DEF CURRENT_NYBBLE_ARRAY_LENGTH += 1 + IF CURRENT_NYBBLE_ARRAY_LENGTH % 2 == 0 + db CURRENT_NYBBLE_ARRAY_VALUE + DEF CURRENT_NYBBLE_ARRAY_VALUE = 0 + ENDC ENDM -end_nybble_array: MACRO -IF CURRENT_NYBBLE_ARRAY_LENGTH % 2 - db CURRENT_NYBBLE_ARRAY_VALUE << 4 -ENDC -IF _NARG == 1 -x = \1 - ASSERT x == CURRENT_NYBBLE_ARRAY_LENGTH, \ - "{CURRENT_NYBBLE_ARRAY_START}: expected {d:x} nybbles, got {d:CURRENT_NYBBLE_ARRAY_LENGTH}" -x = (x + 1) / 2 - ASSERT x == @ - {CURRENT_NYBBLE_ARRAY_START}, \ - "{CURRENT_NYBBLE_ARRAY_START}: expected {d:x} bytes" -ENDC +MACRO end_nybble_array + IF CURRENT_NYBBLE_ARRAY_LENGTH % 2 + db CURRENT_NYBBLE_ARRAY_VALUE << 4 + ENDC + IF _NARG == 1 + DEF x = \1 + ASSERT x == CURRENT_NYBBLE_ARRAY_LENGTH, \ + "{CURRENT_NYBBLE_ARRAY_START}: expected {d:x} nybbles, got {d:CURRENT_NYBBLE_ARRAY_LENGTH}" + DEF x = (x + 1) / 2 + ASSERT x == @ - {CURRENT_NYBBLE_ARRAY_START}, \ + "{CURRENT_NYBBLE_ARRAY_START}: expected {d:x} bytes" + ENDC ENDM -bit_array: MACRO -CURRENT_BIT_ARRAY_VALUE = 0 -CURRENT_BIT_ARRAY_LENGTH = 0 -IF _NARG == 1 -REDEF CURRENT_BIT_ARRAY_START EQUS "\1" -ELSE -REDEF CURRENT_BIT_ARRAY_START EQUS "._bit_array\@" -{CURRENT_BIT_ARRAY_START}: -ENDC +MACRO bit_array + DEF CURRENT_BIT_ARRAY_VALUE = 0 + DEF CURRENT_BIT_ARRAY_LENGTH = 0 + IF _NARG == 1 + REDEF CURRENT_BIT_ARRAY_START EQUS "\1" + ELSE + REDEF CURRENT_BIT_ARRAY_START EQUS "._bit_array\@" + {CURRENT_BIT_ARRAY_START}: + ENDC ENDM -dbit: MACRO +MACRO dbit ASSERT (\1) == 0 || (\1) == 1, "bits must be 0 or 1" -CURRENT_BIT_ARRAY_VALUE |= (\1) << (CURRENT_BIT_ARRAY_LENGTH % 8) -CURRENT_BIT_ARRAY_LENGTH += 1 -IF CURRENT_BIT_ARRAY_LENGTH % 8 == 0 - db CURRENT_BIT_ARRAY_VALUE -CURRENT_BIT_ARRAY_VALUE = 0 -ENDC + DEF CURRENT_BIT_ARRAY_VALUE |= (\1) << (CURRENT_BIT_ARRAY_LENGTH % 8) + DEF CURRENT_BIT_ARRAY_LENGTH += 1 + IF CURRENT_BIT_ARRAY_LENGTH % 8 == 0 + db CURRENT_BIT_ARRAY_VALUE + DEF CURRENT_BIT_ARRAY_VALUE = 0 + ENDC ENDM -end_bit_array: MACRO -IF CURRENT_BIT_ARRAY_LENGTH % 8 - db CURRENT_BIT_ARRAY_VALUE -ENDC -IF _NARG == 1 -x = \1 - ASSERT x == CURRENT_BIT_ARRAY_LENGTH, \ - "{CURRENT_BIT_ARRAY_START}: expected {d:x} bits, got {d:CURRENT_BIT_ARRAY_LENGTH}" -x = (x + 7) / 8 - ASSERT x == @ - {CURRENT_BIT_ARRAY_START}, \ - "{CURRENT_BIT_ARRAY_START}: expected {d:x} bytes" -ENDC +MACRO end_bit_array + IF CURRENT_BIT_ARRAY_LENGTH % 8 + db CURRENT_BIT_ARRAY_VALUE + ENDC + IF _NARG == 1 + DEF x = \1 + ASSERT x == CURRENT_BIT_ARRAY_LENGTH, \ + "{CURRENT_BIT_ARRAY_START}: expected {d:x} bits, got {d:CURRENT_BIT_ARRAY_LENGTH}" + DEF x = (x + 7) / 8 + ASSERT x == @ - {CURRENT_BIT_ARRAY_START}, \ + "{CURRENT_BIT_ARRAY_START}: expected {d:x} bytes" + ENDC ENDM -def_grass_wildmons: MACRO +MACRO def_grass_wildmons ;\1: encounter rate -CURRENT_GRASS_WILDMONS_RATE = \1 -REDEF CURRENT_GRASS_WILDMONS_LABEL EQUS "._def_grass_wildmons_\1" + DEF CURRENT_GRASS_WILDMONS_RATE = \1 + REDEF CURRENT_GRASS_WILDMONS_LABEL EQUS "._def_grass_wildmons_\1" {CURRENT_GRASS_WILDMONS_LABEL}: db \1 ENDM -end_grass_wildmons: MACRO +MACRO end_grass_wildmons IF CURRENT_GRASS_WILDMONS_RATE == 0 ASSERT 1 == @ - {CURRENT_GRASS_WILDMONS_LABEL}, \ "def_grass_wildmons {d:CURRENT_GRASS_WILDMONS_RATE}: expected 1 byte" @@ -126,15 +126,15 @@ end_grass_wildmons: MACRO ENDC ENDM -def_water_wildmons: MACRO +MACRO def_water_wildmons ;\1: encounter rate -CURRENT_WATER_WILDMONS_RATE = \1 -REDEF CURRENT_WATER_WILDMONS_LABEL EQUS "._def_water_wildmons_\1" + DEF CURRENT_WATER_WILDMONS_RATE = \1 + REDEF CURRENT_WATER_WILDMONS_LABEL EQUS "._def_water_wildmons_\1" {CURRENT_WATER_WILDMONS_LABEL}: db \1 ENDM -end_water_wildmons: MACRO +MACRO end_water_wildmons IF CURRENT_WATER_WILDMONS_RATE == 0 ASSERT 1 == @ - {CURRENT_WATER_WILDMONS_LABEL}, \ "def_water_wildmons {d:CURRENT_WATER_WILDMONS_RATE}: expected 1 byte" diff --git a/macros/code.asm b/macros/code.asm index e0b3e9c9..3c65e100 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -1,20 +1,20 @@ ; Syntactic sugar macros -lb: MACRO ; r, hi, lo +MACRO lb ; r, hi, lo ld \1, ((\2) & $ff) << 8 + ((\3) & $ff) ENDM -ldpal: MACRO +MACRO ldpal ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5 ENDM ; Design patterns -dict: MACRO -IF \1 == 0 - and a -ELSE - cp \1 -ENDC +MACRO dict + IF \1 == 0 + and a + ELSE + cp \1 + ENDC jp z, \2 ENDM diff --git a/macros/const.asm b/macros/const.asm index afbde7bc..7c7f8591 100644 --- a/macros/const.asm +++ b/macros/const.asm @@ -1,48 +1,48 @@ ; Enumerate constants -const_def: MACRO -IF _NARG >= 1 -const_value = \1 -ELSE -const_value = 0 -ENDC -IF _NARG >= 2 -const_inc = \2 -ELSE -const_inc = 1 -ENDC +MACRO const_def + IF _NARG >= 1 + DEF const_value = \1 + ELSE + DEF const_value = 0 + ENDC + IF _NARG >= 2 + DEF const_inc = \2 + ELSE + DEF const_inc = 1 + ENDC ENDM -const: MACRO -\1 EQU const_value -const_value += const_inc +MACRO const + DEF \1 EQU const_value + DEF const_value += const_inc ENDM -shift_const: MACRO -\1 EQU 1 << const_value -const_value += const_inc +MACRO shift_const + DEF \1 EQU 1 << const_value + DEF const_value += const_inc ENDM -const_skip: MACRO -if _NARG >= 1 -const_value += const_inc * (\1) -else -const_value += const_inc -endc +MACRO const_skip + if _NARG >= 1 + DEF const_value += const_inc * (\1) + else + DEF const_value += const_inc + endc ENDM -const_next: MACRO -if (const_value > 0 && \1 < const_value) || (const_value < 0 && \1 > const_value) -fail "const_next cannot go backwards from {const_value} to \1" -else -const_value = \1 -endc +MACRO const_next + if (const_value > 0 && \1 < const_value) || (const_value < 0 && \1 > const_value) + fail "const_next cannot go backwards from {const_value} to \1" + else + DEF const_value = \1 + endc ENDM -rb_skip: MACRO -IF _NARG == 1 -rsset _RS + \1 -ELSE -rsset _RS + 1 -ENDC +MACRO rb_skip + IF _NARG == 1 + rsset _RS + \1 + ELSE + rsset _RS + 1 + ENDC ENDM diff --git a/macros/coords.asm b/macros/coords.asm index 6b16e7f7..81388895 100644 --- a/macros/coords.asm +++ b/macros/coords.asm @@ -1,4 +1,4 @@ -validate_coords: MACRO +MACRO validate_coords IF _NARG >= 4 IF \1 >= \3 fail "x coord out of range" @@ -11,11 +11,11 @@ validate_coords: MACRO ENDC ENDM -hlcoord EQUS "coord hl," -bccoord EQUS "coord bc," -decoord EQUS "coord de," +DEF hlcoord EQUS "coord hl," +DEF bccoord EQUS "coord bc," +DEF decoord EQUS "coord de," -coord: MACRO +MACRO coord ; register, x, y[, origin] validate_coords \2, \3 IF _NARG >= 4 @@ -25,11 +25,11 @@ coord: MACRO ENDC ENDM -hlbgcoord EQUS "bgcoord hl," -bcbgcoord EQUS "bgcoord bc," -debgcoord EQUS "bgcoord de," +DEF hlbgcoord EQUS "bgcoord hl," +DEF bcbgcoord EQUS "bgcoord bc," +DEF debgcoord EQUS "bgcoord de," -bgcoord: MACRO +MACRO bgcoord ; register, x, y[, origin] validate_coords \2, \3, BG_MAP_WIDTH, BG_MAP_HEIGHT IF _NARG >= 4 @@ -39,22 +39,22 @@ bgcoord: MACRO ENDC ENDM -hlowcoord EQUS "owcoord hl," -bcowcoord EQUS "owcoord bc," -deowcoord EQUS "owcoord de," +DEF hlowcoord EQUS "owcoord hl," +DEF bcowcoord EQUS "owcoord bc," +DEF deowcoord EQUS "owcoord de," -owcoord: MACRO +MACRO owcoord ; register, x, y, map width ld \1, wOverworldMap + ((\2) + 3) + (((\3) + 3) * ((\4) + (3 * 2))) ENDM -event_displacement: MACRO +MACRO event_displacement ; map width, x blocks, y blocks dw (wOverworldMap + 7 + (\1) + ((\1) + 6) * ((\3) >> 1) + ((\2) >> 1)) db \3, \2 ENDM -dwcoord: MACRO +MACRO dwcoord ; x, y validate_coords \1, \2 IF _NARG >= 3 @@ -64,7 +64,7 @@ dwcoord: MACRO ENDC ENDM -ldcoord_a: MACRO +MACRO ldcoord_a ; x, y[, origin] validate_coords \1, \2 IF _NARG >= 3 @@ -74,7 +74,7 @@ ldcoord_a: MACRO ENDC ENDM -lda_coord: MACRO +MACRO lda_coord ; x, y[, origin] validate_coords \1, \2 IF _NARG >= 3 @@ -84,7 +84,7 @@ lda_coord: MACRO ENDC ENDM -dbmapcoord: MACRO +MACRO dbmapcoord ; x, y db \2, \1 ENDM diff --git a/macros/data.asm b/macros/data.asm index 1f3c87a0..5092b74e 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -1,71 +1,71 @@ ; Value macros -percent EQUS "* $ff / 100" +DEF percent EQUS "* $ff / 100" -bcd2: MACRO +MACRO bcd2 dn ((\1) / 1000) % 10, ((\1) / 100) % 10 dn ((\1) / 10) % 10, (\1) % 10 ENDM -bcd3: MACRO +MACRO bcd3 dn ((\1) / 100000) % 10, ((\1) / 10000) % 10 dn ((\1) / 1000) % 10, ((\1) / 100) % 10 dn ((\1) / 10) % 10, (\1) % 10 ENDM ; used in data/pokemon/base_stats/*.asm -tmhm: MACRO +MACRO tmhm ; initialize bytes to 0 -FOR n, (NUM_TM_HM + 7) / 8 -_tm{d:n} = 0 -ENDR -; set bits of bytes -REPT _NARG - IF DEF(\1_TMNUM) -n = (\1_TMNUM - 1) / 8 -i = (\1_TMNUM - 1) % 8 -_tm{d:n} |= 1 << i - ELSE - FAIL "\1 is not a TM or HM move" - ENDC - SHIFT -ENDR -; output bytes -FOR n, (NUM_TM_HM + 7) / 8 - db _tm{d:n} -ENDR + FOR n, (NUM_TM_HM + 7) / 8 + DEF _tm{d:n} = 0 + ENDR + ; set bits of bytes + REPT _NARG + IF DEF(\1_TMNUM) + DEF n = (\1_TMNUM - 1) / 8 + DEF i = (\1_TMNUM - 1) % 8 + DEF _tm{d:n} |= 1 << i + ELSE + FAIL "\1 is not a TM or HM move" + ENDC + SHIFT + ENDR + ; output bytes + FOR n, (NUM_TM_HM + 7) / 8 + db _tm{d:n} + ENDR ENDM ; Constant data (db, dw, dl) macros -dbw: MACRO +MACRO dbw db \1 dw \2 ENDM -dwb: MACRO +MACRO dwb dw \1 db \2 ENDM -dn: MACRO ; nybbles -REPT _NARG / 2 - db ((\1) << 4) | (\2) - SHIFT 2 -ENDR +MACRO dn ; nybbles + REPT _NARG / 2 + db ((\1) << 4) | (\2) + SHIFT 2 + ENDR ENDM -dba: MACRO ; dbw bank, address -REPT _NARG - dbw BANK(\1), \1 - SHIFT -ENDR +MACRO dba ; dbw bank, address + REPT _NARG + dbw BANK(\1), \1 + SHIFT + ENDR ENDM -dab: MACRO ; dwb address, bank -REPT _NARG - dwb \1, BANK(\1) - SHIFT -ENDR +MACRO dab ; dwb address, bank + REPT _NARG + dwb \1, BANK(\1) + SHIFT + ENDR ENDM diff --git a/macros/farcall.asm b/macros/farcall.asm index 93f8f1ac..a40bff36 100644 --- a/macros/farcall.asm +++ b/macros/farcall.asm @@ -1,28 +1,28 @@ -farcall: MACRO +MACRO farcall ld b, BANK(\1) ld hl, \1 call Bankswitch ENDM -callfar: MACRO +MACRO callfar ld hl, \1 ld b, BANK(\1) call Bankswitch ENDM -farjp: MACRO +MACRO farjp ld b, BANK(\1) ld hl, \1 jp Bankswitch ENDM -jpfar: MACRO +MACRO jpfar ld hl, \1 ld b, BANK(\1) jp Bankswitch ENDM -homecall: MACRO +MACRO homecall ldh a, [hLoadedROMBank] push af ld a, BANK(\1) @@ -34,7 +34,7 @@ homecall: MACRO ld [MBC1RomBank], a ENDM -homecall_sf: MACRO ; homecall but save flags by popping into bc instead of af +MACRO homecall_sf ; homecall but save flags by popping into bc instead of af ldh a, [hLoadedROMBank] push af ld a, BANK(\1) diff --git a/macros/gfx.asm b/macros/gfx.asm index 98eabec4..944e6dd5 100644 --- a/macros/gfx.asm +++ b/macros/gfx.asm @@ -1,22 +1,22 @@ -RGB: MACRO -REPT _NARG / 3 - dw palred (\1) + palgreen (\2) + palblue (\3) - SHIFT 3 -ENDR +MACRO RGB + REPT _NARG / 3 + dw palred (\1) + palgreen (\2) + palblue (\3) + SHIFT 3 + ENDR ENDM -palred EQUS "(1 << 0) *" -palgreen EQUS "(1 << 5) *" -palblue EQUS "(1 << 10) *" +DEF palred EQUS "(1 << 0) *" +DEF palgreen EQUS "(1 << 5) *" +DEF palblue EQUS "(1 << 10) *" -palettes EQUS "* PALETTE_SIZE" -palette EQUS "+ PALETTE_SIZE *" -color EQUS "+ PAL_COLOR_SIZE *" +DEF palettes EQUS "* PALETTE_SIZE" +DEF palette EQUS "+ PALETTE_SIZE *" +DEF color EQUS "+ PAL_COLOR_SIZE *" -tiles EQUS "* LEN_2BPP_TILE" -tile EQUS "+ LEN_2BPP_TILE *" +DEF tiles EQUS "* LEN_2BPP_TILE" +DEF tile EQUS "+ LEN_2BPP_TILE *" -dbsprite: MACRO +MACRO dbsprite ; x tile, y tile, x pixel, y pixel, vtile offset, attributes db (\2 * TILE_WIDTH) % $100 + \4, (\1 * TILE_WIDTH) % $100 + \3, \5, \6 ENDM diff --git a/macros/predef.asm b/macros/predef.asm index d86582d1..45b0197b 100644 --- a/macros/predef.asm +++ b/macros/predef.asm @@ -1,32 +1,32 @@ -predef_id: MACRO +MACRO predef_id ld a, (\1Predef - PredefPointers) / 3 ENDM -predef: MACRO +MACRO predef predef_id \1 call Predef ENDM -predef_jump: MACRO +MACRO predef_jump predef_id \1 jp Predef ENDM -tx_pre_id: MACRO +MACRO tx_pre_id ld a, (\1_id - TextPredefs) / 2 + 1 ENDM -tx_pre: MACRO +MACRO tx_pre tx_pre_id \1 call PrintPredefTextID ENDM -tx_pre_jump: MACRO +MACRO tx_pre_jump tx_pre_id \1 jp PrintPredefTextID ENDM -db_tx_pre: MACRO +MACRO db_tx_pre db (\1_id - TextPredefs) / 2 + 1 ENDM diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm index b12a2adc..114bf576 100644 --- a/macros/scripts/audio.asm +++ b/macros/scripts/audio.asm @@ -1,4 +1,4 @@ -audio_header: MACRO +MACRO audio_header db (_NARG - 2) << 6 | \2 dw \1_\2 IF _NARG > 2 @@ -24,7 +24,7 @@ ENDM ; small magnitude means quick change, large magnitude means slow change ; in signed magnitude representation, so a value of 8 is the same as (negative) 0 const pitch_sweep_cmd ; $10 -pitch_sweep: MACRO +MACRO pitch_sweep db pitch_sweep_cmd IF \2 < 0 db (\1 << 4) | (%1000 | (\2 * -1)) @@ -41,8 +41,8 @@ ENDM ; fade: positive value means decrease in volume, negative value means increase in volume ; small magnitude means quick change, large magnitude means slow change ; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -square_note_cmd EQU sfx_note_cmd ; $20 -square_note: MACRO +DEF square_note_cmd EQU sfx_note_cmd ; $20 +MACRO square_note db square_note_cmd | \1 IF \3 < 0 db (\2 << 4) | (%1000 | (\3 * -1)) @@ -56,8 +56,8 @@ ENDM ; fade: positive value means decrease in volume, negative value means increase in volume ; small magnitude means quick change, large magnitude means slow change ; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -noise_note_cmd EQU sfx_note_cmd ; $20 -noise_note: MACRO +DEF noise_note_cmd EQU sfx_note_cmd ; $20 +MACRO noise_note db noise_note_cmd | \1 IF \3 < 0 db (\2 << 4) | (%1000 | (\3 * -1)) @@ -68,7 +68,7 @@ noise_note: MACRO ENDM ; arguments: pitch, length [1, 16] -note: MACRO +MACRO note db (\1 << 4) | (\2 - 1) ENDM @@ -76,7 +76,7 @@ ENDM ; arguments: instrument [1, 19], length [1, 16] const drum_note_cmd ; $b0 -drum_note: MACRO +MACRO drum_note db drum_note_cmd | (\2 - 1) db \1 ENDM @@ -85,7 +85,7 @@ ENDM ; like drum_note but one 1 byte instead of 2 ; can only be used with instruments 1-10, excluding 2 ; unused -drum_note_short: MACRO +MACRO drum_note_short db (\1 << 4) | (\2 - 1) ENDM @@ -93,7 +93,7 @@ ENDM ; arguments: length [1, 16] const rest_cmd ; $c0 -rest: MACRO +MACRO rest db rest_cmd | (\1 - 1) ENDM @@ -104,7 +104,7 @@ ENDM ; small magnitude means quick change, large magnitude means slow change ; in signed magnitude representation, so a value of 8 is the same as (negative) 0 const note_type_cmd ; $d0 -note_type: MACRO +MACRO note_type db note_type_cmd | \1 IF \3 < 0 db (\2 << 4) | (%1000 | (\3 * -1)) @@ -114,8 +114,8 @@ note_type: MACRO ENDM ; arguments: speed [0, 15] -drum_speed_cmd EQU note_type_cmd ; $d0 -drum_speed: MACRO +DEF drum_speed_cmd EQU note_type_cmd ; $d0 +MACRO drum_speed db drum_speed_cmd | \1 ENDM @@ -123,7 +123,7 @@ ENDM ; arguments: octave [1, 8] const octave_cmd ; $e0 -octave: MACRO +MACRO octave db octave_cmd | (8 - \1) ENDM @@ -131,7 +131,7 @@ ENDM ; when enabled, effective frequency used is incremented by 1 const toggle_perfect_pitch_cmd ; $e8 -toggle_perfect_pitch: MACRO +MACRO toggle_perfect_pitch db toggle_perfect_pitch_cmd ENDM @@ -142,7 +142,7 @@ ENDM ; depth: amplitude of vibrato wave ; rate: frequency of vibrato wave const vibrato_cmd ; $ea -vibrato: MACRO +MACRO vibrato db vibrato_cmd db \1 db (\2 << 4) | \3 @@ -150,7 +150,7 @@ ENDM ; arguments: length [1, 256], octave [1, 8], pitch const pitch_slide_cmd ; $eb -pitch_slide: MACRO +MACRO pitch_slide db pitch_slide_cmd db \1 - 1 db ((8 - \2) << 4) | \3 @@ -158,7 +158,7 @@ ENDM ; arguments: duty cycle [0, 3] (12.5%, 25%, 50%, 75%) const duty_cycle_cmd ; $ec -duty_cycle: MACRO +MACRO duty_cycle db duty_cycle_cmd db \1 ENDM @@ -170,27 +170,27 @@ ENDM ; if larger than $100, large note speed or note length values might cause overflow ; stored in big endian const tempo_cmd ; $ed -tempo: MACRO +MACRO tempo db tempo_cmd db HIGH(\1), LOW(\1) ENDM ; arguments: left output enable mask, right output enable mask const stereo_panning_cmd ; $ee -stereo_panning: MACRO +MACRO stereo_panning db stereo_panning_cmd db (\1 << 4) | \2 ENDM const unknownmusic0xef_cmd ; $ef -unknownmusic0xef: MACRO +MACRO unknownmusic0xef db unknownmusic0xef_cmd db \1 ENDM ; arguments: left master volume [0, 7], right master volume [0, 7] const volume_cmd ; $f0 -volume: MACRO +MACRO volume db volume_cmd db (\1 << 4) | \2 ENDM @@ -199,7 +199,7 @@ ENDM ; when enabled, the sfx data is interpreted as music data const execute_music_cmd ; $f8 -execute_music: MACRO +MACRO execute_music db execute_music_cmd ENDM @@ -207,27 +207,27 @@ ENDM ; arguments: duty cycle 1, duty cycle 2, duty cycle 3, duty cycle 4 const duty_cycle_pattern_cmd ; $fc -duty_cycle_pattern: MACRO +MACRO duty_cycle_pattern db duty_cycle_pattern_cmd db \1 << 6 | \2 << 4 | \3 << 2 | \4 ENDM ; arguments: address const sound_call_cmd ; $fd -sound_call: MACRO +MACRO sound_call db sound_call_cmd dw \1 ENDM ; arguments: count, address const sound_loop_cmd ; $fe -sound_loop: MACRO +MACRO sound_loop db sound_loop_cmd db \1 dw \2 ENDM const sound_ret_cmd ; $ff -sound_ret: MACRO +MACRO sound_ret db sound_ret_cmd ENDM diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm index a9b1c615..fdbedb6f 100644 --- a/macros/scripts/events.asm +++ b/macros/scripts/events.asm @@ -1,7 +1,7 @@ ;\1 = event index ;\2 = return result in carry instead of zero flag -CheckEvent: MACRO -event_byte = ((\1) / 8) +MACRO CheckEvent + DEF event_byte = ((\1) / 8) ld a, [wEventFlags + event_byte] IF _NARG > 1 @@ -19,9 +19,9 @@ ENDM ;\1 = event index -CheckEventReuseA: MACRO +MACRO CheckEventReuseA IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) + DEF event_byte = ((\1) / 8) ld a, [wEventFlags + event_byte] ENDC @@ -31,10 +31,10 @@ ENDM ;\1 = event index ;\2 = event index of the last event used before the branch -CheckEventAfterBranchReuseA: MACRO -event_byte = ((\2) / 8) +MACRO CheckEventAfterBranchReuseA + DEF event_byte = ((\2) / 8) IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) + DEF event_byte = ((\1) / 8) ld a, [wEventFlags + event_byte] ENDC @@ -45,7 +45,7 @@ ENDM ;\1 = reg ;\2 = event index ;\3 = event index this event is relative to (optional, this is needed when there is a fixed flag address) -EventFlagBit: MACRO +MACRO EventFlagBit IF _NARG > 2 ld \1, ((\3) % 8) + ((\2) - (\3)) ELSE @@ -56,24 +56,24 @@ ENDM ;\1 = reg ;\2 = event index -EventFlagAddress: MACRO -event_byte = ((\2) / 8) +MACRO EventFlagAddress + DEF event_byte = ((\2) / 8) ld \1, wEventFlags + event_byte ENDM ;\1 = event index -CheckEventHL: MACRO -event_byte = ((\1) / 8) +MACRO CheckEventHL + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte bit (\1) % 8, [hl] ENDM ;\1 = event index -CheckEventReuseHL: MACRO -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) +MACRO CheckEventReuseHL + IF event_byte != ((\1) / 8) + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte ENDC @@ -83,18 +83,18 @@ ENDM ; dangerous, only use when HL is guaranteed to be the desired value ;\1 = event index -CheckEventForceReuseHL: MACRO -event_byte = ((\1) / 8) +MACRO CheckEventForceReuseHL + DEF event_byte = ((\1) / 8) bit (\1) % 8, [hl] ENDM ;\1 = event index ;\2 = event index of the last event used before the branch -CheckEventAfterBranchReuseHL: MACRO -event_byte = ((\2) / 8) -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) +MACRO CheckEventAfterBranchReuseHL + DEF event_byte = ((\2) / 8) + IF event_byte != ((\1) / 8) + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte ENDC @@ -103,8 +103,8 @@ ENDM ;\1 = event index -CheckAndSetEvent: MACRO -event_byte = ((\1) / 8) +MACRO CheckAndSetEvent + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte bit (\1) % 8, [hl] set (\1) % 8, [hl] @@ -112,8 +112,8 @@ ENDM ;\1 = event index -CheckAndResetEvent: MACRO -event_byte = ((\1) / 8) +MACRO CheckAndResetEvent + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte bit (\1) % 8, [hl] res (\1) % 8, [hl] @@ -121,7 +121,7 @@ ENDM ;\1 = event index -CheckAndSetEventA: MACRO +MACRO CheckAndSetEventA ld a, [wEventFlags + ((\1) / 8)] bit (\1) % 8, a set (\1) % 8, a @@ -130,7 +130,7 @@ ENDM ;\1 = event index -CheckAndResetEventA: MACRO +MACRO CheckAndResetEventA ld a, [wEventFlags + ((\1) / 8)] bit (\1) % 8, a res (\1) % 8, a @@ -139,17 +139,17 @@ ENDM ;\1 = event index -SetEvent: MACRO -event_byte = ((\1) / 8) +MACRO SetEvent + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte set (\1) % 8, [hl] ENDM ;\1 = event index -SetEventReuseHL: MACRO +MACRO SetEventReuseHL IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte ENDC @@ -159,10 +159,10 @@ ENDM ;\1 = event index ;\2 = event index of the last event used before the branch -SetEventAfterBranchReuseHL: MACRO -event_byte = ((\2) / 8) -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) +MACRO SetEventAfterBranchReuseHL + DEF event_byte = ((\2) / 8) + IF event_byte != ((\1) / 8) + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte ENDC @@ -172,8 +172,8 @@ ENDM ; dangerous, only use when HL is guaranteed to be the desired value ;\1 = event index -SetEventForceReuseHL: MACRO -event_byte = ((\1) / 8) +MACRO SetEventForceReuseHL + DEF event_byte = ((\1) / 8) set (\1) % 8, [hl] ENDM @@ -181,7 +181,7 @@ ENDM ;\1 = event index ;\2 = event index ;\3, \4, ... = additional (optional) event indices -SetEvents: MACRO +MACRO SetEvents SetEvent \1 REPT _NARG - 1 SetEventReuseHL \2 @@ -191,17 +191,17 @@ ENDM ;\1 = event index -ResetEvent: MACRO -event_byte = ((\1) / 8) +MACRO ResetEvent + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte res (\1) % 8, [hl] ENDM ;\1 = event index -ResetEventReuseHL: MACRO +MACRO ResetEventReuseHL IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte ENDC @@ -211,10 +211,10 @@ ENDM ;\1 = event index ;\2 = event index of the last event used before the branch -ResetEventAfterBranchReuseHL: MACRO -event_byte = ((\2) / 8) -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) +MACRO ResetEventAfterBranchReuseHL + DEF event_byte = ((\2) / 8) + IF event_byte != ((\1) / 8) + DEF event_byte = ((\1) / 8) ld hl, wEventFlags + event_byte ENDC @@ -224,8 +224,8 @@ ENDM ; dangerous, only use when HL is guaranteed to be the desired value ;\1 = event index -ResetEventForceReuseHL: MACRO -event_byte = ((\1) / 8) +MACRO ResetEventForceReuseHL + DEF event_byte = ((\1) / 8) res (\1) % 8, [hl] ENDM @@ -233,7 +233,7 @@ ENDM ;\1 = event index ;\2 = event index ;\3 = event index (optional) -ResetEvents: MACRO +MACRO ResetEvents ResetEvent \1 REPT _NARG - 1 ResetEventReuseHL \2 @@ -244,9 +244,9 @@ ENDM ;\1 = start ;\2 = end -SetEventRange: MACRO -event_start_byte = ((\1) / 8) -event_end_byte = ((\2) / 8) +MACRO SetEventRange + DEF event_start_byte = ((\1) / 8) + DEF event_end_byte = ((\2) / 8) IF event_end_byte < event_start_byte FAIL "Incorrect argument order in SetEventRange." @@ -257,12 +257,12 @@ event_end_byte = ((\2) / 8) or (1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8)) ld [wEventFlags + event_start_byte], a ELSE -event_fill_start = event_start_byte + 1 -event_fill_count = event_end_byte - event_start_byte - 1 + DEF event_fill_start = event_start_byte + 1 + DEF event_fill_count = event_end_byte - event_start_byte - 1 IF ((\1) % 8) == 0 -event_fill_start -= 1 -event_fill_count += 1 + DEF event_fill_start -= 1 + DEF event_fill_count += 1 ELSE ld a, [wEventFlags + event_start_byte] or $ff - ((1 << ((\1) % 8)) - 1) @@ -270,7 +270,7 @@ event_fill_count += 1 ENDC IF ((\2) % 8) == 7 -event_fill_count += 1 + DEF event_fill_count += 1 ENDC IF event_fill_count == 1 @@ -306,9 +306,9 @@ ENDM ;\1 = start ;\2 = end ;\3 = assume a is 0 if present -ResetEventRange: MACRO -event_start_byte = ((\1) / 8) -event_end_byte = ((\2) / 8) +MACRO ResetEventRange + DEF event_start_byte = ((\1) / 8) + DEF event_end_byte = ((\2) / 8) IF event_end_byte < event_start_byte FAIL "Incorrect argument order in ResetEventRange." @@ -319,12 +319,12 @@ event_end_byte = ((\2) / 8) and ~((1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8))) & $ff ld [wEventFlags + event_start_byte], a ELSE -event_fill_start = event_start_byte + 1 -event_fill_count = event_end_byte - event_start_byte - 1 + DEF event_fill_start = event_start_byte + 1 + DEF event_fill_count = event_end_byte - event_start_byte - 1 IF ((\1) % 8) == 0 -event_fill_start -= 1 -event_fill_count += 1 + DEF event_fill_start -= 1 + DEF event_fill_count += 1 ELSE ld a, [wEventFlags + event_start_byte] and ~($ff - ((1 << ((\1) % 8)) - 1)) & $ff @@ -332,7 +332,7 @@ event_fill_count += 1 ENDC IF ((\2) % 8) == 7 -event_fill_count += 1 + DEF event_fill_count += 1 ENDC IF event_fill_count == 1 @@ -375,10 +375,10 @@ ENDM ;\1 = event index 1 ;\2 = event index 2 ;\3 = try to reuse a (optional) -CheckBothEventsSet: MACRO +MACRO CheckBothEventsSet IF ((\1) / 8) == ((\2) / 8) IF (_NARG < 3) || (((\1) / 8) != event_byte) -event_byte = ((\1) / 8) + DEF event_byte = ((\1) / 8) ld a, [wEventFlags + ((\1) / 8)] ENDC and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) @@ -411,7 +411,7 @@ ENDM ; returns the complement of whether either event is set in Z flag ;\1 = event index 1 ;\2 = event index 2 -CheckEitherEventSet: MACRO +MACRO CheckEitherEventSet IF ((\1) / 8) == ((\2) / 8) ld a, [wEventFlags + ((\1) / 8)] and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) @@ -441,7 +441,7 @@ ENDM ; for handling fixed event bits when events are inserted/removed ;\1 = event index ;\2 = fixed flag bit -AdjustEventBit: MACRO +MACRO AdjustEventBit IF ((\1) % 8) != (\2) add ((\1) % 8) - (\2) ENDC diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index bae8fd07..5c1a8ad5 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -1,7 +1,7 @@ -def_object_events: MACRO -REDEF _NUM_OBJECT_EVENTS EQUS "_NUM_OBJECT_EVENTS_\@" +MACRO def_object_events + REDEF _NUM_OBJECT_EVENTS EQUS "_NUM_OBJECT_EVENTS_\@" db {_NUM_OBJECT_EVENTS} -{_NUM_OBJECT_EVENTS} = 0 + DEF {_NUM_OBJECT_EVENTS} = 0 ENDM ;\1 x position @@ -13,7 +13,7 @@ ENDM ;\7 items only: item id ;\7 trainers only: trainer class/pokemon id ;\8 trainers only: trainer number/pokemon level -object_event: MACRO +MACRO object_event db \3 db \2 + 4 db \1 + 4 @@ -29,42 +29,42 @@ object_event: MACRO ELSE db \6 ENDC -{_NUM_OBJECT_EVENTS} += 1 + DEF {_NUM_OBJECT_EVENTS} += 1 ENDM -def_warp_events: MACRO -REDEF _NUM_WARP_EVENTS EQUS "_NUM_WARP_EVENTS_\@" +MACRO def_warp_events + REDEF _NUM_WARP_EVENTS EQUS "_NUM_WARP_EVENTS_\@" db {_NUM_WARP_EVENTS} -{_NUM_WARP_EVENTS} = 0 + DEF {_NUM_WARP_EVENTS} = 0 ENDM ;\1 x position ;\2 y position ;\3 destination map (-1 = wLastMap) ;\4 destination warp id; starts at 1 (internally at 0) -warp_event: MACRO +MACRO warp_event db \2, \1, \4 - 1, \3 -_WARP_{d:{_NUM_WARP_EVENTS}}_X = \1 -_WARP_{d:{_NUM_WARP_EVENTS}}_Y = \2 -{_NUM_WARP_EVENTS} += 1 + DEF _WARP_{d:{_NUM_WARP_EVENTS}}_X = \1 + DEF _WARP_{d:{_NUM_WARP_EVENTS}}_Y = \2 + DEF {_NUM_WARP_EVENTS} += 1 ENDM -def_bg_events: MACRO -REDEF _NUM_BG_EVENTS EQUS "_NUM_BG_EVENTS_\@" +MACRO def_bg_events + REDEF _NUM_BG_EVENTS EQUS "_NUM_BG_EVENTS_\@" db {_NUM_BG_EVENTS} -{_NUM_BG_EVENTS} = 0 + DEF {_NUM_BG_EVENTS} = 0 ENDM ;\1 x position ;\2 y position ;\3 sign id -bg_event: MACRO +MACRO bg_event db \2, \1, \3 -{_NUM_BG_EVENTS} += 1 + DEF {_NUM_BG_EVENTS} += 1 ENDM ;\1 source map -def_warps_to: MACRO +MACRO def_warps_to FOR n, _NUM_WARP_EVENTS warp_to _WARP_{d:n}_X, _WARP_{d:n}_Y, \1_WIDTH ENDR @@ -73,18 +73,18 @@ ENDM ;\1 x position ;\2 y position ;\3 map width -warp_to: MACRO +MACRO warp_to event_displacement \3, \1, \2 ENDM ;\1 first bit offset / first object id -def_trainers: MACRO -IF _NARG == 1 -CURRENT_TRAINER_BIT = \1 -ELSE -CURRENT_TRAINER_BIT = 1 -ENDC +MACRO def_trainers + IF _NARG == 1 + DEF CURRENT_TRAINER_BIT = \1 + ELSE + DEF CURRENT_TRAINER_BIT = 1 + ENDC ENDM ;\1 event flag @@ -92,22 +92,22 @@ ENDM ;\3 TextBeforeBattle ;\4 TextAfterBattle ;\5 TextEndBattle -trainer: MACRO -_ev_bit = \1 % 8 -_cur_bit = CURRENT_TRAINER_BIT % 8 +MACRO trainer + DEF _ev_bit = \1 % 8 + DEF _cur_bit = CURRENT_TRAINER_BIT % 8 ASSERT _ev_bit == _cur_bit, \ "Expected \1 to be bit {d:_cur_bit}, got {d:_ev_bit}" db CURRENT_TRAINER_BIT db \2 << 4 dw wEventFlags + (\1 - CURRENT_TRAINER_BIT) / 8 dw \3, \5, \4, \4 -CURRENT_TRAINER_BIT += 1 + DEF CURRENT_TRAINER_BIT += 1 ENDM ;\1 x position ;\2 y position ;\3 movement data -map_coord_movement: MACRO +MACRO map_coord_movement dbmapcoord \1, \2 dw \3 ENDM @@ -117,10 +117,10 @@ ENDM ;\2 map id ;\3 tileset ;\4 connections: combo of NORTH, SOUTH, WEST, and/or EAST, or 0 for none -map_header: MACRO -CURRENT_MAP_WIDTH = \2_WIDTH -CURRENT_MAP_HEIGHT = \2_HEIGHT -CURRENT_MAP_OBJECT EQUS "\1_Object" +MACRO map_header + DEF CURRENT_MAP_WIDTH = \2_WIDTH + DEF CURRENT_MAP_HEIGHT = \2_HEIGHT + DEF CURRENT_MAP_OBJECT EQUS "\1_Object" \1_h:: db \3 db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH @@ -131,7 +131,7 @@ CURRENT_MAP_OBJECT EQUS "\1_Object" ENDM ; Comes after map_header and connection macros -end_map_header: MACRO +MACRO end_map_header dw {CURRENT_MAP_OBJECT} PURGE CURRENT_MAP_WIDTH, CURRENT_MAP_HEIGHT, CURRENT_MAP_OBJECT ENDM @@ -142,63 +142,63 @@ ENDM ;\3 map id ;\4 offset of the target map relative to the current map ; (x offset for east/west, y offset for north/south) -connection: MACRO - -; Calculate tile offsets for source (current) and target maps -_src = 0 -_tgt = (\4) + 3 -IF _tgt < 2 -_src = -_tgt -_tgt = 0 -ENDC - -IF !STRCMP("\1", "north") -_blk = \3_WIDTH * (\3_HEIGHT - 3) + _src -_map = _tgt -_win = (\3_WIDTH + 6) * \3_HEIGHT + 1 -_y = \3_HEIGHT * 2 - 1 -_x = (\4) * -2 -_len = CURRENT_MAP_WIDTH + 3 - (\4) -IF _len > \3_WIDTH -_len = \3_WIDTH -ENDC - -ELIF !STRCMP("\1", "south") -_blk = _src -_map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt -_win = \3_WIDTH + 7 -_y = 0 -_x = (\4) * -2 -_len = CURRENT_MAP_WIDTH + 3 - (\4) -IF _len > \3_WIDTH -_len = \3_WIDTH -ENDC - -ELIF !STRCMP("\1", "west") -_blk = (\3_WIDTH * _src) + \3_WIDTH - 3 -_map = (CURRENT_MAP_WIDTH + 6) * _tgt -_win = (\3_WIDTH + 6) * 2 - 6 -_y = (\4) * -2 -_x = \3_WIDTH * 2 - 1 -_len = CURRENT_MAP_HEIGHT + 3 - (\4) -IF _len > \3_HEIGHT -_len = \3_HEIGHT -ENDC - -ELIF !STRCMP("\1", "east") -_blk = (\3_WIDTH * _src) -_map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 -_win = \3_WIDTH + 7 -_y = (\4) * -2 -_x = 0 -_len = CURRENT_MAP_HEIGHT + 3 - (\4) -IF _len > \3_HEIGHT -_len = \3_HEIGHT -ENDC - -ELSE -fail "Invalid direction for 'connection'." -ENDC +MACRO connection + + ; Calculate tile offsets for source (current) and target maps + DEF _src = 0 + DEF _tgt = (\4) + 3 + IF _tgt < 2 + DEF _src = -_tgt + DEF _tgt = 0 + ENDC + + IF !STRCMP("\1", "north") + DEF _blk = \3_WIDTH * (\3_HEIGHT - 3) + _src + DEF _map = _tgt + DEF _win = (\3_WIDTH + 6) * \3_HEIGHT + 1 + DEF _y = \3_HEIGHT * 2 - 1 + DEF _x = (\4) * -2 + DEF _len = CURRENT_MAP_WIDTH + 3 - (\4) + IF _len > \3_WIDTH + DEF _len = \3_WIDTH + ENDC + + ELIF !STRCMP("\1", "south") + DEF _blk = _src + DEF _map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt + DEF _win = \3_WIDTH + 7 + DEF _y = 0 + DEF _x = (\4) * -2 + DEF _len = CURRENT_MAP_WIDTH + 3 - (\4) + IF _len > \3_WIDTH + DEF _len = \3_WIDTH + ENDC + + ELIF !STRCMP("\1", "west") + DEF _blk = (\3_WIDTH * _src) + \3_WIDTH - 3 + DEF _map = (CURRENT_MAP_WIDTH + 6) * _tgt + DEF _win = (\3_WIDTH + 6) * 2 - 6 + DEF _y = (\4) * -2 + DEF _x = \3_WIDTH * 2 - 1 + DEF _len = CURRENT_MAP_HEIGHT + 3 - (\4) + IF _len > \3_HEIGHT + DEF _len = \3_HEIGHT + ENDC + + ELIF !STRCMP("\1", "east") + DEF _blk = (\3_WIDTH * _src) + DEF _map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 + DEF _win = \3_WIDTH + 7 + DEF _y = (\4) * -2 + DEF _x = 0 + DEF _len = CURRENT_MAP_HEIGHT + 3 - (\4) + IF _len > \3_HEIGHT + DEF _len = \3_HEIGHT + ENDC + + ELSE + fail "Invalid direction for 'connection'." + ENDC db \3 dw \2_Blocks + _blk diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm index c446c6c7..418e839c 100644 --- a/macros/scripts/text.asm +++ b/macros/scripts/text.asm @@ -1,44 +1,44 @@ -text EQUS "db TX_START," ; Start writing text. -next EQUS "db \"\"," ; Move a line down. -line EQUS "db \"\"," ; Start writing at the bottom line. -para EQUS "db \"\"," ; Start a new paragraph. -cont EQUS "db \"\"," ; Scroll to the next line. -done EQUS "db \"\"" ; End a text box. -prompt EQUS "db \"\"" ; Prompt the player to end a text box (initiating some other event). +DEF text EQUS "db TX_START," ; Start writing text. +DEF next EQUS "db \"\"," ; Move a line down. +DEF line EQUS "db \"\"," ; Start writing at the bottom line. +DEF para EQUS "db \"\"," ; Start a new paragraph. +DEF cont EQUS "db \"\"," ; Scroll to the next line. +DEF done EQUS "db \"\"" ; End a text box. +DEF prompt EQUS "db \"\"" ; Prompt the player to end a text box (initiating some other event). -page EQUS "db \"\"," ; Start a new Pokédex page. -dex EQUS "db \"\", \"@\"" ; End a Pokédex entry. +DEF page EQUS "db \"\"," ; Start a new Pokédex page. +DEF dex EQUS "db \"\", \"@\"" ; End a Pokédex entry. ; TextCommandJumpTable indexes (see home/text.asm) const_def const TX_START ; $00 -text_start: MACRO +MACRO text_start db TX_START ENDM const TX_RAM ; $01 -text_ram: MACRO +MACRO text_ram db TX_RAM dw \1 ; address to read from ENDM const TX_BCD ; $02 -text_bcd: MACRO +MACRO text_bcd db TX_BCD dw \1 ; address to read from db \2 ; number of bytes + print flags ENDM const TX_MOVE ; $03 -text_move: MACRO +MACRO text_move db TX_MOVE dw \1 ; address of the new location ENDM const TX_BOX ; $04 -text_box: MACRO +MACRO text_box ; draw box db TX_BOX dw \1 ; address of upper left corner @@ -46,27 +46,27 @@ text_box: MACRO ENDM const TX_LOW ; $05 -text_low: MACRO +MACRO text_low db TX_LOW ENDM const TX_PROMPT_BUTTON ; $06 -text_promptbutton: MACRO +MACRO text_promptbutton db TX_PROMPT_BUTTON ENDM const TX_SCROLL ; $07 -text_scroll: MACRO +MACRO text_scroll db TX_SCROLL ENDM const TX_START_ASM ; $08 -text_asm: MACRO +MACRO text_asm db TX_START_ASM ENDM const TX_NUM ; $09 -text_decimal: MACRO +MACRO text_decimal ; print a big-endian decimal number. db TX_NUM dw \1 ; address to read from @@ -74,76 +74,76 @@ text_decimal: MACRO ENDM const TX_PAUSE ; $0a -text_pause: MACRO +MACRO text_pause db TX_PAUSE ENDM const TX_SOUND_GET_ITEM_1 ; $0b -sound_get_item_1: MACRO +MACRO sound_get_item_1 db TX_SOUND_GET_ITEM_1 ENDM -TX_SOUND_LEVEL_UP EQU TX_SOUND_GET_ITEM_1 -sound_level_up EQUS "sound_get_item_1" +DEF TX_SOUND_LEVEL_UP EQU TX_SOUND_GET_ITEM_1 +DEF sound_level_up EQUS "sound_get_item_1" const TX_DOTS ; $0c -text_dots: MACRO +MACRO text_dots db TX_DOTS db \1 ; number of ellipses to draw ENDM const TX_WAIT_BUTTON ; $0d -text_waitbutton: MACRO +MACRO text_waitbutton db TX_WAIT_BUTTON ENDM const TX_SOUND_POKEDEX_RATING ; $0e -sound_pokedex_rating: MACRO +MACRO sound_pokedex_rating db TX_SOUND_POKEDEX_RATING ENDM const TX_SOUND_GET_ITEM_1_DUPLICATE ; $0f -sound_get_item_1_duplicate: MACRO +MACRO sound_get_item_1_duplicate db TX_SOUND_GET_ITEM_1_DUPLICATE ENDM const TX_SOUND_GET_ITEM_2 ; $10 -sound_get_item_2: MACRO +MACRO sound_get_item_2 db TX_SOUND_GET_ITEM_2 ENDM const TX_SOUND_GET_KEY_ITEM ; $11 -sound_get_key_item: MACRO +MACRO sound_get_key_item db TX_SOUND_GET_KEY_ITEM ENDM const TX_SOUND_CAUGHT_MON ; $12 -sound_caught_mon: MACRO +MACRO sound_caught_mon db TX_SOUND_CAUGHT_MON ENDM const TX_SOUND_DEX_PAGE_ADDED ; $13 -sound_dex_page_added: MACRO +MACRO sound_dex_page_added db TX_SOUND_DEX_PAGE_ADDED ENDM const TX_SOUND_CRY_NIDORINA ; $14 -sound_cry_nidorina: MACRO +MACRO sound_cry_nidorina db TX_SOUND_CRY_NIDORINA ENDM const TX_SOUND_CRY_PIDGEOT ; $15 -sound_cry_pidgeot: MACRO +MACRO sound_cry_pidgeot db TX_SOUND_CRY_PIDGEOT ENDM const TX_SOUND_CRY_DEWGONG ; $16 -sound_cry_dewgong: MACRO +MACRO sound_cry_dewgong db TX_SOUND_CRY_DEWGONG ENDM const TX_FAR ; $17 -text_far: MACRO +MACRO text_far db TX_FAR dab \1 ; address of text commands ENDM @@ -152,7 +152,7 @@ ENDM const_next $50 const TX_END ; $50 -text_end: MACRO +MACRO text_end db TX_END ENDM @@ -161,12 +161,12 @@ ENDM const_def -1, -1 const TX_SCRIPT_POKECENTER_NURSE ; $ff -script_pokecenter_nurse: MACRO +MACRO script_pokecenter_nurse db TX_SCRIPT_POKECENTER_NURSE ENDM const TX_SCRIPT_MART ; $fe -script_mart: MACRO +MACRO script_mart db TX_SCRIPT_MART db _NARG ; number of items IF _NARG @@ -176,12 +176,12 @@ script_mart: MACRO ENDM const TX_SCRIPT_BILLS_PC ; $fd -script_bills_pc: MACRO +MACRO script_bills_pc db TX_SCRIPT_BILLS_PC ENDM const TX_SCRIPT_PLAYERS_PC ; $fc -script_players_pc: MACRO +MACRO script_players_pc db TX_SCRIPT_PLAYERS_PC ENDM @@ -190,23 +190,23 @@ ENDM const_skip ; $fa const TX_SCRIPT_POKECENTER_PC ; $f9 -script_pokecenter_pc: MACRO +MACRO script_pokecenter_pc db TX_SCRIPT_POKECENTER_PC ENDM const_skip ; $f8 const TX_SCRIPT_PRIZE_VENDOR ; $f7 -script_prize_vendor: MACRO +MACRO script_prize_vendor db TX_SCRIPT_PRIZE_VENDOR ENDM const TX_SCRIPT_CABLE_CLUB_RECEPTIONIST ; $f6 -script_cable_club_receptionist: MACRO +MACRO script_cable_club_receptionist db TX_SCRIPT_CABLE_CLUB_RECEPTIONIST ENDM const TX_SCRIPT_VENDING_MACHINE ; $f5 -script_vending_machine: MACRO +MACRO script_vending_machine db TX_SCRIPT_VENDING_MACHINE ENDM diff --git a/macros/vc.asm b/macros/vc.asm index 0d6b8db0..0990e988 100644 --- a/macros/vc.asm +++ b/macros/vc.asm @@ -1,39 +1,39 @@ -vc_hook: MACRO -IF DEF(_RED_VC) || DEF(_BLUE_VC) -.VC_\1:: -ENDC +MACRO vc_hook + IF DEF(_RED_VC) || DEF(_BLUE_VC) + .VC_\1:: + ENDC ENDM -vc_hook_red: MACRO -IF DEF(_RED_VC) -.VC_\1:: -ENDC +MACRO vc_hook_red + IF DEF(_RED_VC) + .VC_\1:: + ENDC ENDM -vc_hook_blue: MACRO -IF DEF(_BLUE_VC) -.VC_\1:: -ENDC +MACRO vc_hook_blue + IF DEF(_BLUE_VC) + .VC_\1:: + ENDC ENDM -vc_patch: MACRO -IF DEF(_RED_VC) || DEF(_BLUE_VC) - ASSERT !DEF(CURRENT_VC_PATCH), "Already started a vc_patch" -CURRENT_VC_PATCH EQUS "\1" -.VC_{CURRENT_VC_PATCH}:: -ENDC +MACRO vc_patch + IF DEF(_RED_VC) || DEF(_BLUE_VC) + ASSERT !DEF(CURRENT_VC_PATCH), "Already started a vc_patch" + DEF CURRENT_VC_PATCH EQUS "\1" + .VC_{CURRENT_VC_PATCH}:: + ENDC ENDM -vc_patch_end: MACRO -IF DEF(_RED_VC) || DEF(_BLUE_VC) - ASSERT DEF(CURRENT_VC_PATCH), "No vc_patch started" -.VC_{CURRENT_VC_PATCH}_End:: - PURGE CURRENT_VC_PATCH -ENDC +MACRO vc_patch_end + IF DEF(_RED_VC) || DEF(_BLUE_VC) + ASSERT DEF(CURRENT_VC_PATCH), "No vc_patch started" + .VC_{CURRENT_VC_PATCH}_End:: + PURGE CURRENT_VC_PATCH + ENDC ENDM -vc_assert: MACRO -IF DEF(_RED_VC) || DEF(_BLUE_VC) - ASSERT \# -ENDC +MACRO vc_assert + IF DEF(_RED_VC) || DEF(_BLUE_VC) + ASSERT \# + ENDC ENDM diff --git a/macros/wram.asm b/macros/wram.asm index 872e7f57..df5dcf90 100644 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -1,12 +1,12 @@ ; Used in wram.asm -flag_array: MACRO +MACRO flag_array ds ((\1) + 7) / 8 ENDM -BOX_STRUCT_LENGTH EQU 25 + NUM_MOVES * 2 +DEF BOX_STRUCT_LENGTH EQU 25 + NUM_MOVES * 2 -box_struct: MACRO +MACRO box_struct \1Species:: db \1HP:: dw \1BoxLevel:: db @@ -27,7 +27,7 @@ box_struct: MACRO \1PP:: ds NUM_MOVES ENDM -party_struct: MACRO +MACRO party_struct box_struct \1 \1Level:: db \1Stats:: @@ -38,7 +38,7 @@ party_struct: MACRO \1Special:: dw ENDM -battle_struct: MACRO +MACRO battle_struct \1Species:: db \1HP:: dw \1PartyPos:: @@ -60,7 +60,7 @@ battle_struct: MACRO \1PP:: ds NUM_MOVES ENDM -spritestatedata1: MACRO +MACRO spritestatedata1 \1PictureID:: db \1MovementStatus:: db \1ImageIndex:: db @@ -78,7 +78,7 @@ spritestatedata1: MACRO \1End:: ENDM -spritestatedata2: MACRO +MACRO spritestatedata2 \1WalkAnimationCounter:: db ds 1 \1YDisplacement:: db @@ -96,14 +96,14 @@ spritestatedata2: MACRO \1End:: ENDM -sprite_oam_struct: MACRO +MACRO sprite_oam_struct \1YCoord:: db \1XCoord:: db \1TileID:: db \1Attributes:: db ENDM -map_connection_struct: MACRO +MACRO map_connection_struct \1ConnectedMap:: db \1ConnectionStripSrc:: dw \1ConnectionStripDest:: dw diff --git a/rgbdscheck.asm b/rgbdscheck.asm index 556fbae4..8c51e1af 100644 --- a/rgbdscheck.asm +++ b/rgbdscheck.asm @@ -1,8 +1,8 @@ -MAJOR EQU 0 -MINOR EQU 5 -PATCH EQU 2 +DEF MAJOR EQU 0 +DEF MINOR EQU 5 +DEF PATCH EQU 2 -wrong_rgbds: MACRO +MACRO wrong_rgbds fail "pokered requires rgbds v0.5.2 or newer." ENDM diff --git a/sram.asm b/sram.asm index 68451791..6cb45371 100644 --- a/sram.asm +++ b/sram.asm @@ -26,12 +26,12 @@ sMainDataCheckSum:: db ; The PC boxes will not fit into one SRAM bank, ; so they use multiple SECTIONs -box_n = 0 -boxes: MACRO -REPT \1 -box_n += 1 -sBox{d:box_n}:: ds wBoxDataEnd - wBoxDataStart -ENDR +DEF box_n = 0 +MACRO boxes + REPT \1 + DEF box_n += 1 + sBox{d:box_n}:: ds wBoxDataEnd - wBoxDataStart + ENDR ENDM SECTION "Saved Boxes 1", SRAM diff --git a/vc/pokeblue.constants.asm b/vc/pokeblue.constants.asm index a197afae..f89c4fd9 100644 --- a/vc/pokeblue.constants.asm +++ b/vc/pokeblue.constants.asm @@ -2,8 +2,8 @@ INCLUDE "constants.asm" ; These are all the asm constants needed to make the blue_vc patch. -vc_const: MACRO -x = \1 +MACRO vc_const + DEF x = \1 PRINTLN "00:{04x:x} \1" ; same format as rgblink's .sym file ENDM diff --git a/vc/pokered.constants.asm b/vc/pokered.constants.asm index 4bc62388..cb7efa96 100644 --- a/vc/pokered.constants.asm +++ b/vc/pokered.constants.asm @@ -2,8 +2,8 @@ INCLUDE "constants.asm" ; These are all the asm constants needed to make the red_vc patch. -vc_const: MACRO -x = \1 +MACRO vc_const + DEF x = \1 PRINTLN "00:{04x:x} \1" ; same format as rgblink's .sym file ENDM -- cgit v1.3.1-sl0p From cc46b0e510e07f2e7a0d14732c02a2f416eac9e1 Mon Sep 17 00:00:00 2001 From: "Colton G. Rushton" Date: Sat, 9 Jul 2022 18:18:18 -0300 Subject: wOAMBuffer -> wShadowOAM (#370) --- constants/gfx_constants.asm | 2 +- engine/battle/animations.asm | 32 ++++++++++++++++---------------- engine/battle/battle_transitions.asm | 2 +- engine/battle/core.asm | 4 ++-- engine/battle/draw_hud_pokeball_gfx.asm | 8 ++++---- engine/battle/ghost_marowak_anim.asm | 2 +- engine/events/diploma.asm | 2 +- engine/gfx/mon_icons.asm | 8 ++++---- engine/gfx/oam_dma.asm | 2 +- engine/gfx/sprite_oam.asm | 6 +++--- engine/items/item_effects.asm | 2 +- engine/items/town_map.asm | 20 ++++++++++---------- engine/menus/start_sub_menus.asm | 2 +- engine/movie/intro.asm | 4 ++-- engine/movie/splash.asm | 18 +++++++++--------- engine/movie/title.asm | 4 ++-- engine/movie/title2.asm | 2 +- engine/movie/trade.asm | 6 +++--- engine/overworld/cut.asm | 2 +- engine/overworld/cut2.asm | 22 +++++++++++----------- engine/overworld/dust_smoke.asm | 2 +- engine/overworld/emotion_bubbles.asm | 8 ++++---- engine/overworld/healing_machine.asm | 2 +- engine/overworld/player_animations.asm | 24 ++++++++++++------------ engine/slots/slot_machine.asm | 6 +++--- home/clear_sprites.asm | 6 +++--- home/oam.asm | 2 +- ram/wram.asm | 8 ++++---- scripts/VermilionDock.asm | 2 +- 29 files changed, 105 insertions(+), 105 deletions(-) (limited to 'engine/gfx') diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 522b6a67..c6268208 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -17,7 +17,7 @@ DEF HP_BAR_GREEN EQU 0 DEF HP_BAR_YELLOW EQU 1 DEF HP_BAR_RED EQU 2 -; wOAMBuffer +; wShadowOAM DEF NUM_SPRITE_OAM_STRUCTS EQU 40 ; hAutoBGTransferEnabled diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 7ad1bb3e..789dcb8a 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -147,7 +147,7 @@ DrawFrameBlock: jr z, .resetFrameBlockDestAddr call AnimationCleanOAM .resetFrameBlockDestAddr - ld hl, wOAMBuffer ; OAM buffer + ld hl, wShadowOAM ld a, l ld [wFBDestAddr + 1], a ld a, h @@ -583,7 +583,7 @@ PlaySubanimation: call GetMoveSound call PlaySound .skipPlayingSound - ld hl, wOAMBuffer ; base address of OAM buffer + ld hl, wShadowOAM ld a, l ld [wFBDestAddr + 1], a ld a, h @@ -855,7 +855,7 @@ TradeShakePokeball: ; if it's the end of the animation, make the ball jump up ld de, BallMoveDistances1 .loop - ld hl, wOAMBuffer ; OAM buffer + ld hl, wShadowOAM ld bc, 4 .innerLoop ld a, [de] @@ -885,7 +885,7 @@ BallMoveDistances1: TradeJumpPokeball: ld de, BallMoveDistances2 .loop - ld hl, wOAMBuffer ; OAM buffer + ld hl, wShadowOAM ld bc, 4 .innerLoop ld a, [de] @@ -925,8 +925,8 @@ BallMoveDistances2: ; this function copies the current musical note graphic ; so that there are two musical notes flying towards the defending pokemon DoGrowlSpecialEffects: - ld hl, wOAMBuffer ; OAM buffer - ld de, wOAMBuffer + $10 + ld hl, wShadowOAM + ld de, wShadowOAMSprite04 ld bc, $10 call CopyData ; copy the musical note graphic ld a, [wSubAnimCounter] @@ -1136,7 +1136,7 @@ AnimationWaterDropletsEverywhere: ret _AnimationWaterDroplets: - ld hl, wOAMBuffer + ld hl, wShadowOAM .loop ld a, [wBaseCoordY] ld [hli], a ; Y @@ -1264,7 +1264,7 @@ ShakeEnemyHUD_WritePlayerMonPicOAM: ld [wBaseCoordX], a ld a, $30 ld [wBaseCoordY], a - ld hl, wOAMBuffer + ld hl, wShadowOAM ld d, 0 ld c, 7 .loop @@ -1498,7 +1498,7 @@ AnimationSpiralBallsInward: .loop push hl ld c, 3 - ld de, wOAMBuffer + ld de, wShadowOAM .innerLoop ld a, [hl] cp $ff @@ -1637,7 +1637,7 @@ _AnimationShootBallsUpward: call LoadAnimationTileset pop bc ld d, $7a ; ball tile - ld hl, wOAMBuffer + ld hl, wShadowOAM push bc ld a, [wBaseCoordY] ld e, a @@ -1651,7 +1651,7 @@ _AnimationShootBallsUpward: ld [wNumShootingBalls], a .loop push bc - ld hl, wOAMBuffer + ld hl, wShadowOAM .innerLoop ld a, [wBaseCoordY] add 8 @@ -2080,7 +2080,7 @@ InitMultipleObjectsOAM: xor a ld e, a ld [wBaseCoordX], a - ld hl, wOAMBuffer + ld hl, wShadowOAM .loop call BattleAnimWriteOAMEntry dec c @@ -2336,7 +2336,7 @@ AnimationFallingObjects: call InitMultipleObjectsOAM call FallingObjects_InitXCoords call FallingObjects_InitMovementData - ld hl, wOAMBuffer + ld hl, wShadowOAM ld [hl], 0 .loop ld hl, wFallingObjectsMovementData @@ -2363,7 +2363,7 @@ AnimationFallingObjects: dec c jr nz, .innerLoop call Delay3 - ld hl, wOAMBuffer + ld hl, wShadowOAM ld a, [hl] ; Y cp 104 ; has the top falling object reached 104 yet? jr nz, .loop ; keep moving the falling objects down until it does @@ -2372,7 +2372,7 @@ AnimationFallingObjects: FallingObjects_UpdateOAMEntry: ; Increases Y by 2 pixels and adjusts X and X flip based on the falling object's ; movement byte. - ld hl, wOAMBuffer + ld hl, wShadowOAM add hl, de ld a, [hl] inc a @@ -2433,7 +2433,7 @@ FallingObjects_UpdateMovementByte: ret FallingObjects_InitXCoords: - ld hl, wOAMBuffer + $01 + ld hl, wShadowOAMSprite00XCoord ld de, FallingObjects_InitialXCoords ld a, [wNumFallingObjects] ld c, a diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index bc4665e4..a16fd250 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -26,7 +26,7 @@ BattleTransition: jr nz, .loop1 ; Clear OAM except for the blocks used by the player and enemy trainer sprites. - ld hl, wOAMBuffer + $10 + ld hl, wShadowOAMSprite04 ld c, 9 .loop2 ld a, b diff --git a/engine/battle/core.asm b/engine/battle/core.asm index c746e52b..580a9899 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -105,7 +105,7 @@ SlidePlayerAndEnemySilhouettesOnScreen: ; instead, the enemy pic is part of the background and uses the scroll register, while the player's head is a sprite and is slid by changing its X coordinates in a loop SlidePlayerHeadLeft: push bc - ld hl, wOAMBuffer + $01 + ld hl, wShadowOAMSprite00XCoord ld c, $15 ; number of OAM entries ld de, $4 ; size of OAM entry .loop @@ -6327,7 +6327,7 @@ LoadPlayerBackPic: ASSERT BANK(RedPicBack) == BANK(OldManPicBack) call UncompressSpriteFromDE predef ScaleSpriteByTwo - ld hl, wOAMBuffer + ld hl, wShadowOAM xor a ldh [hOAMTile], a ; initial tile number ld b, $7 ; 7 columns diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 097a0fcc..34bff58d 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -27,7 +27,7 @@ SetupOwnPartyPokeballs: ld [hl], a ld a, 8 ld [wHUDPokeballGfxOffsetX], a - ld hl, wOAMBuffer + ld hl, wShadowOAM jp WritePokeballOAMData SetupEnemyPartyPokeballs: @@ -41,7 +41,7 @@ SetupEnemyPartyPokeballs: ld [hl], $20 ld a, -8 ld [wHUDPokeballGfxOffsetX], a - ld hl, wOAMBuffer + PARTY_LENGTH * 4 + ld hl, wShadowOAMSprite06 jp WritePokeballOAMData SetupPokeballs: @@ -174,7 +174,7 @@ SetupPlayerAndEnemyPokeballs: ld [hl], $40 ld a, 8 ld [wHUDPokeballGfxOffsetX], a - ld hl, wOAMBuffer + ld hl, wShadowOAM call WritePokeballOAMData ld hl, wEnemyMons ld de, wEnemyPartyCount @@ -183,7 +183,7 @@ SetupPlayerAndEnemyPokeballs: ld a, $50 ld [hli], a ld [hl], $68 - ld hl, wOAMBuffer + $18 + ld hl, wShadowOAMSprite06 jp WritePokeballOAMData ; four tiles: pokeball, black pokeball (status ailment), crossed out pokeball (fainted) and pokeball slot (no mon) diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 9c1ad96f..a7f4d025 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -58,7 +58,7 @@ CopyMonPicFromBGToSpriteVRAM: ld [wBaseCoordY], a ld a, $70 ld [wBaseCoordX], a - ld hl, wOAMBuffer + ld hl, wShadowOAM lb bc, 6, 6 ld d, $8 .oamLoop diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 7c48c086..41e0d7c6 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -42,7 +42,7 @@ DisplayDiploma:: ; Move the player 33 pixels right and set the priority bit so he appears ; behind the background layer. - ld hl, wOAMBuffer + $01 + ld hl, wShadowOAMSprite00XCoord lb bc, $80, $28 .adjustPlayerGfxLoop ld a, [hl] ; X diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 6f6b88c7..73b1632f 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -43,7 +43,7 @@ GetAnimationSpeed: .resetSprites push bc ld hl, wMonPartySpritesSavedOAM - ld de, wOAMBuffer + ld de, wShadowOAM ld bc, $60 call CopyData pop bc @@ -51,7 +51,7 @@ GetAnimationSpeed: jr .incTimer .animateSprite push bc - ld hl, wOAMBuffer + $02 ; OAM tile id + ld hl, wShadowOAMSprite00TileID ld bc, $10 ld a, [wCurrentMenuItem] call AddNTimes @@ -236,7 +236,7 @@ WriteMonPartySpriteOAM: ; make a copy at wMonPartySpritesSavedOAM. push af ld c, $10 - ld h, HIGH(wOAMBuffer) + ld h, HIGH(wShadowOAM) ldh a, [hPartyMonIndex] swap a ld l, a @@ -252,7 +252,7 @@ WriteMonPartySpriteOAM: ; Make a copy of the OAM buffer with the first animation frame written so that ; we can flip back to it from the second frame by copying it back. .makeCopy - ld hl, wOAMBuffer + ld hl, wShadowOAM ld de, wMonPartySpritesSavedOAM ld bc, $60 jp CopyData diff --git a/engine/gfx/oam_dma.asm b/engine/gfx/oam_dma.asm index fe93e90d..11e52694 100644 --- a/engine/gfx/oam_dma.asm +++ b/engine/gfx/oam_dma.asm @@ -16,7 +16,7 @@ DMARoutine: LOAD "OAM DMA", HRAM hDMARoutine:: ; initiate DMA - ld a, HIGH(wOAMBuffer) + ld a, HIGH(wShadowOAM) ldh [rDMA], a ; wait for DMA to finish ld a, $28 diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index b3c07ecd..69956a31 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -1,6 +1,6 @@ PrepareOAMData:: ; Determine OAM data for currently visible -; sprites and write it to wOAMBuffer. +; sprites and write it to wShadowOAM. ld a, [wUpdateSpritesEnabled] dec a @@ -79,7 +79,7 @@ PrepareOAMData:: ldh a, [hOAMBufferOffset] ld e, a - ld d, HIGH(wOAMBuffer) + ld d, HIGH(wShadowOAM) .tileLoop ldh a, [hSpriteScreenY] ; temp for sprite Y position @@ -147,7 +147,7 @@ PrepareOAMData:: ; Clear unused OAM. ldh a, [hOAMBufferOffset] ld l, a - ld h, HIGH(wOAMBuffer) + ld h, HIGH(wShadowOAM) ld de, $4 ld b, $a0 ld a, [wd736] diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 16b4140a..faba8837 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1175,7 +1175,7 @@ ItemUseMedicine: xor a ld [wBattleMonStatus], a ; remove the status ailment in the in-battle pokemon data .calculateHPBarCoords - ld hl, wOAMBuffer + $90 + ld hl, wShadowOAMSprite36 ld bc, 2 * SCREEN_WIDTH inc d .calculateHPBarCoordsLoop diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index 93047216..d278d034 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -16,7 +16,7 @@ DisplayTownMap: hlcoord 1, 0 ld de, wcd6d call PlaceString - ld hl, wOAMBuffer + ld hl, wShadowOAM ld de, wTileMapBackup ld bc, $10 call CopyData @@ -47,7 +47,7 @@ DisplayTownMap: call TownMapCoordsToOAMCoords ld a, $4 ld [wOAMBaseTile], a - ld hl, wOAMBuffer + $10 + ld hl, wShadowOAMSprite04 call WriteTownMapSpriteOAM ; town map cursor sprite pop hl ld de, wcd6d @@ -60,7 +60,7 @@ DisplayTownMap: hlcoord 1, 0 ld de, wcd6d call PlaceString - ld hl, wOAMBuffer + $10 + ld hl, wShadowOAMSprite04 ld de, wTileMapBackup + 16 ld bc, $10 call CopyData @@ -362,7 +362,7 @@ DrawPlayerOrBirdSprite: inc de cp "@" jr nz, .loop - ld hl, wOAMBuffer + ld hl, wShadowOAM ld de, wTileMapBackup ld bc, $a0 jp CopyData @@ -370,7 +370,7 @@ DrawPlayerOrBirdSprite: DisplayWildLocations: farcall FindWildLocationsOfMon call ZeroOutDuplicatesInList - ld hl, wOAMBuffer + ld hl, wShadowOAM ld de, wTownMapCoords .loop ld a, [de] @@ -410,7 +410,7 @@ DisplayWildLocations: ld b, $0 call DrawPlayerOrBirdSprite .done - ld hl, wOAMBuffer + ld hl, wShadowOAM ld de, wTileMapBackup ld bc, $a0 jp CopyData @@ -439,9 +439,9 @@ TownMapCoordsToOAMCoords: WritePlayerOrBirdSpriteOAM: ld a, [wOAMBaseTile] and a - ld hl, wOAMBuffer + $90 ; for player sprite + ld hl, wShadowOAMSprite36 ; for player sprite jr z, WriteTownMapSpriteOAM - ld hl, wOAMBuffer + $80 ; for bird sprite + ld hl, wShadowOAMSprite32 ; for bird sprite WriteTownMapSpriteOAM: push hl @@ -600,13 +600,13 @@ TownMapSpriteBlinkingAnimation:: jr nz, .done ; show sprites when the counter reaches 50 ld hl, wTileMapBackup - ld de, wOAMBuffer + ld de, wShadowOAM ld bc, $90 call CopyData xor a jr .done .hideSprites - ld hl, wOAMBuffer + ld hl, wShadowOAM ld b, $24 ld de, $4 .hideSpritesLoop diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index dbc6ab89..7dfb7dc3 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -677,7 +677,7 @@ SwitchPartyMon_ClearGfx: dec c jr nz, .clearMonBGLoop pop af - ld hl, wOAMBuffer + ld hl, wShadowOAM ld bc, $10 call AddNTimes ld de, $4 diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index bca095a8..f489c60b 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -158,7 +158,7 @@ AnimateIntroNidorino: jr AnimateIntroNidorino UpdateIntroNidorinoOAM: - ld hl, wOAMBuffer + ld hl, wShadowOAM ld a, [wIntroNidorinoBaseTile] ld d, a .loop @@ -177,7 +177,7 @@ UpdateIntroNidorinoOAM: ret InitIntroNidorinoOAM: - ld hl, wOAMBuffer + ld hl, wShadowOAM ld d, 0 .loop push bc diff --git a/engine/movie/splash.asm b/engine/movie/splash.asm index eede8ccb..2373a0f9 100644 --- a/engine/movie/splash.asm +++ b/engine/movie/splash.asm @@ -16,11 +16,11 @@ LoadShootingStarGraphics: lb bc, BANK(FallingStar), (FallingStarEnd - FallingStar) / $10 call CopyVideoData ld hl, GameFreakLogoOAMData - ld de, wOAMBuffer + $60 + ld de, wShadowOAMSprite24 ld bc, GameFreakLogoOAMDataEnd - GameFreakLogoOAMData call CopyData ld hl, GameFreakShootingStarOAMData - ld de, wOAMBuffer + ld de, wShadowOAM ld bc, GameFreakShootingStarOAMDataEnd - GameFreakShootingStarOAMData jp CopyData @@ -30,7 +30,7 @@ AnimateShootingStar: call PlaySound ; Move the big star down and left across the screen. - ld hl, wOAMBuffer + ld hl, wShadowOAM lb bc, $a0, $4 .bigStarLoop push hl @@ -60,7 +60,7 @@ AnimateShootingStar: jr nz, .bigStarLoop ; Clear big star OAM. - ld hl, wOAMBuffer + ld hl, wShadowOAM ld c, 4 ld de, 4 .clearOAMLoop @@ -83,7 +83,7 @@ AnimateShootingStar: ; Copy 24 instances of the small stars OAM data. ; Note that their coordinates put them off-screen. - ld de, wOAMBuffer + ld de, wShadowOAM ld a, 24 .initSmallStarsOAMLoop push af @@ -106,7 +106,7 @@ AnimateShootingStar: ld d, a push bc push hl - ld hl, wOAMBuffer + $50 + ld hl, wShadowOAMSprite20 ld c, 4 .smallStarsInnerLoop ; introduce new wave of 4 small stars OAM entries ld a, [de] @@ -131,8 +131,8 @@ AnimateShootingStar: push af ; shift the existing OAM entries down to make room for the next wave - ld hl, wOAMBuffer + $10 - ld de, wOAMBuffer + ld hl, wShadowOAMSprite04 + ld de, wShadowOAM ld bc, $50 call CopyData @@ -186,7 +186,7 @@ SmallStarsEmptyWave: MoveDownSmallStars: ld b, 8 .loop - ld hl, wOAMBuffer + $5c + ld hl, wShadowOAMSprite23 ld a, [wMoveDownSmallStarsOAMCount] ld de, -4 ld c, a diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 8f97f8fa..1ee0cc25 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -93,7 +93,7 @@ DisplayTitleScreen: call DrawPlayerCharacter ; put a pokeball in the player's hand - ld hl, wOAMBuffer + $28 + ld hl, wShadowOAMSprite10 ld a, $74 ld [hl], a @@ -322,7 +322,7 @@ DrawPlayerCharacter: call ClearSprites xor a ld [wPlayerCharacterOAMTile], a - ld hl, wOAMBuffer + ld hl, wShadowOAM lb de, $60, $5a ld b, 7 .loop diff --git a/engine/movie/title2.asm b/engine/movie/title2.asm index 315cf6b5..bc75015f 100644 --- a/engine/movie/title2.asm +++ b/engine/movie/title2.asm @@ -115,6 +115,6 @@ GetTitleBallY: pop de and a ret z - ld [wOAMBuffer + $28], a + ld [wShadowOAMSprite10YCoord], a inc e ret diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index 35423820..def901ba 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -315,7 +315,7 @@ Trade_AnimateBallEnteringLinkCable: xor $1 ld [wLinkCableAnimBulgeToggle], a add $7e - ld hl, wOAMBuffer + $02 + ld hl, wShadowOAMSprite00TileID ld de, 4 ld c, e .cycleLinkCableBulgeTile @@ -599,7 +599,7 @@ Trade_AnimCircledMon: ldh a, [rBGP] xor $3c ; make link cable flash ldh [rBGP], a - ld hl, wOAMBuffer + $02 + ld hl, wShadowOAMSprite00TileID ld de, $4 ld c, $14 .loop @@ -619,7 +619,7 @@ Trade_WriteCircledMonOAM: call Trade_WriteCircleOAM Trade_AddOffsetsToOAMCoords: - ld hl, wOAMBuffer + ld hl, wShadowOAM ld c, $14 .loop ld a, [wBaseCoordY] diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 6a92ccc0..4a337e8d 100644 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -99,7 +99,7 @@ InitCutAnimOAM: ld hl, vChars1 tile $7f call LoadCutGrassAnimationTilePattern call WriteCutOrBoulderDustAnimationOAMBlock - ld hl, wOAMBuffer + $93 + ld hl, wShadowOAMSprite36Attributes ld de, 4 ld a, $30 ld c, e diff --git a/engine/overworld/cut2.asm b/engine/overworld/cut2.asm index 3d4a5905..69c8cb13 100644 --- a/engine/overworld/cut2.asm +++ b/engine/overworld/cut2.asm @@ -5,12 +5,12 @@ AnimCut: ld c, $8 .cutTreeLoop push bc - ld hl, wOAMBuffer + $91 + ld hl, wShadowOAMSprite36XCoord ld a, 1 ld [wCoordAdjustmentAmount], a ld c, 2 call AdjustOAMBlockXPos2 - ld hl, wOAMBuffer + $99 + ld hl, wShadowOAMSprite38XCoord ld a, -1 ld [wCoordAdjustmentAmount], a ld c, 2 @@ -33,7 +33,7 @@ AnimCut: ld c, $8 call AnimCutGrass_UpdateOAMEntries call AnimCutGrass_SwapOAMEntries - ld hl, wOAMBuffer + $90 + ld hl, wShadowOAMSprite36YCoord ld a, 2 ld [wCoordAdjustmentAmount], a ld c, 4 @@ -45,22 +45,22 @@ AnimCut: AnimCutGrass_UpdateOAMEntries: push bc - ld hl, wOAMBuffer + $91 + ld hl, wShadowOAMSprite36XCoord ld a, 1 ld [wCoordAdjustmentAmount], a ld c, 1 call AdjustOAMBlockXPos2 - ld hl, wOAMBuffer + $95 + ld hl, wShadowOAMSprite37XCoord ld a, 2 ld [wCoordAdjustmentAmount], a ld c, 1 call AdjustOAMBlockXPos2 - ld hl, wOAMBuffer + $99 + ld hl, wShadowOAMSprite38XCoord ld a, -2 ld [wCoordAdjustmentAmount], a ld c, 1 call AdjustOAMBlockXPos2 - ld hl, wOAMBuffer + $9d + ld hl, wShadowOAMSprite39XCoord ld a, -1 ld [wCoordAdjustmentAmount], a ld c, 1 @@ -75,15 +75,15 @@ AnimCutGrass_UpdateOAMEntries: ret AnimCutGrass_SwapOAMEntries: - ld hl, wOAMBuffer + $90 + ld hl, wShadowOAMSprite36 ld de, wBuffer ld bc, $8 call CopyData - ld hl, wOAMBuffer + $98 - ld de, wOAMBuffer + $90 + ld hl, wShadowOAMSprite38 + ld de, wShadowOAMSprite36 ld bc, $8 call CopyData ld hl, wBuffer - ld de, wOAMBuffer + $98 + ld de, wShadowOAMSprite38 ld bc, $8 jp CopyData diff --git a/engine/overworld/dust_smoke.asm b/engine/overworld/dust_smoke.asm index c97b3e56..96dd364a 100644 --- a/engine/overworld/dust_smoke.asm +++ b/engine/overworld/dust_smoke.asm @@ -43,7 +43,7 @@ GetMoveBoulderDustFunctionPointer: ld h, [hl] ld l, a push hl - ld hl, wOAMBuffer + $90 + ld hl, wShadowOAMSprite36 ld d, $0 add hl, de ld e, l diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index 5a41c226..84b13f17 100644 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -17,11 +17,11 @@ EmotionBubble: ld [wUpdateSpritesEnabled], a ld a, [wd736] bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod? - ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f - ld de, wOAMBuffer + 4 * 39 + $3 ; $9f + ld hl, wShadowOAMSprite35Attributes + ld de, wShadowOAMSprite39Attributes jr z, .next - ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f - ld de, wOAMBuffer + 4 * 35 + $3 ; $8f + ld hl, wShadowOAMSprite31Attributes + ld de, wShadowOAMSprite35Attributes ; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the ; start of the OAM buffer. diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 63c8f9ea..e297762c 100644 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -12,7 +12,7 @@ AnimateHealingMachine: push af ld a, $e0 ldh [rOBP1], a - ld hl, wOAMBuffer + $84 + ld hl, wShadowOAMSprite33 ld de, PokeCenterOAMData call CopyHealingMachineOAM ld a, 4 diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 6a890cfd..bec59369 100644 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -205,19 +205,19 @@ LeaveMapThroughHoleAnim: ld a, $ff ld [wUpdateSpritesEnabled], a ; disable UpdateSprites ; shift upper half of player's sprite down 8 pixels and hide lower half - ld a, [wOAMBuffer + 0 * 4 + 2] - ld [wOAMBuffer + 2 * 4 + 2], a - ld a, [wOAMBuffer + 1 * 4 + 2] - ld [wOAMBuffer + 3 * 4 + 2], a + ld a, [wShadowOAMSprite00TileID] + ld [wShadowOAMSprite02TileID], a + ld a, [wShadowOAMSprite01TileID] + ld [wShadowOAMSprite03TileID], a ld a, $a0 - ld [wOAMBuffer + 0 * 4], a - ld [wOAMBuffer + 1 * 4], a + ld [wShadowOAMSprite00YCoord], a + ld [wShadowOAMSprite01YCoord], a ld c, 2 call DelayFrames ; hide upper half of player's sprite ld a, $a0 - ld [wOAMBuffer + 2 * 4], a - ld [wOAMBuffer + 3 * 4], a + ld [wShadowOAMSprite02YCoord], a + ld [wShadowOAMSprite03YCoord], a call GBFadeOutToWhite ld a, $1 ld [wUpdateSpritesEnabled], a ; enable UpdateSprites @@ -392,7 +392,7 @@ FishingAnim: ld b, $0 ld hl, FishingRodOAM add hl, bc - ld de, wOAMBuffer + $9c + ld de, wShadowOAMSprite39 ld bc, $4 call CopyData ld c, 100 @@ -412,7 +412,7 @@ FishingAnim: .loop ld hl, wSpritePlayerStateData1YPixels call .ShakePlayerSprite - ld hl, wOAMBuffer + $9c + ld hl, wShadowOAMSprite39 call .ShakePlayerSprite call Delay3 dec b @@ -424,7 +424,7 @@ FishingAnim: cp SPRITE_FACING_UP jr nz, .skipHidingFishingRod ld a, $a0 - ld [wOAMBuffer + $9c], a + ld [wShadowOAMSprite39YCoord], a .skipHidingFishingRod ld hl, wEmotionBubbleSpriteIndex @@ -438,7 +438,7 @@ FishingAnim: cp SPRITE_FACING_UP jr nz, .skipUnhidingFishingRod ld a, $44 - ld [wOAMBuffer + $9c], a + ld [wShadowOAMSprite39YCoord], a .skipUnhidingFishingRod ld hl, ItsABiteText diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 1c2bb4c9..6dd3b42d 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -757,7 +757,7 @@ SlotMachine_UpdateBallTiles: SlotMachine_AnimWheel1: ld bc, SlotMachineWheel1 ld de, wSlotMachineWheel1Offset - ld hl, wOAMBuffer + ld hl, wShadowOAMSprite00 ld a, $30 ld [wBaseCoordX], a jr SlotMachine_AnimWheel @@ -765,7 +765,7 @@ SlotMachine_AnimWheel1: SlotMachine_AnimWheel2: ld bc, SlotMachineWheel2 ld de, wSlotMachineWheel2Offset - ld hl, wOAMBuffer + $30 + ld hl, wShadowOAMSprite12 ld a, $50 ld [wBaseCoordX], a jr SlotMachine_AnimWheel @@ -773,7 +773,7 @@ SlotMachine_AnimWheel2: SlotMachine_AnimWheel3: ld bc, SlotMachineWheel3 ld de, wSlotMachineWheel3Offset - ld hl, wOAMBuffer + $60 + ld hl, wShadowOAMSprite24 ld a, $70 ld [wBaseCoordX], a diff --git a/home/clear_sprites.asm b/home/clear_sprites.asm index 79cc99d6..6d1066fa 100644 --- a/home/clear_sprites.asm +++ b/home/clear_sprites.asm @@ -1,7 +1,7 @@ ClearSprites:: xor a - ld hl, wOAMBuffer - ld b, wOAMBufferEnd - wOAMBuffer + ld hl, wShadowOAM + ld b, wShadowOAMEnd - wShadowOAM .loop ld [hli], a dec b @@ -10,7 +10,7 @@ ClearSprites:: HideSprites:: ld a, 160 - ld hl, wOAMBuffer + ld hl, wShadowOAM ld de, 4 ld b, 40 .loop diff --git a/home/oam.asm b/home/oam.asm index 8a940d97..8be59f6e 100644 --- a/home/oam.asm +++ b/home/oam.asm @@ -4,7 +4,7 @@ ; c = X coordinate of upper left corner of sprite ; de = base address of 4 tile number and attribute pairs WriteOAMBlock:: - ld h, HIGH(wOAMBuffer) + ld h, HIGH(wShadowOAM) swap a ; multiply by 16 ld l, a call .writeOneEntry ; upper left diff --git a/ram/wram.asm b/ram/wram.asm index 0804e6ee..3becc82a 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -143,12 +143,12 @@ wSpriteDataEnd:: SECTION "OAM Buffer", WRAM0 ; buffer for OAM data. Copied to OAM by DMA -wOAMBuffer:: -; wOAMBufferSprite00 - wOAMBufferSprite39 +wShadowOAM:: +; wShadowOAMSprite00 - wShadowOAMSprite39 FOR n, NUM_SPRITE_OAM_STRUCTS -wOAMBufferSprite{02d:n}:: sprite_oam_struct wOAMBufferSprite{02d:n} +wShadowOAMSprite{02d:n}:: sprite_oam_struct wShadowOAMSprite{02d:n} ENDR -wOAMBufferEnd:: +wShadowOAMEnd:: SECTION "Tilemap", WRAM0 diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index f98e1250..94779798 100644 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -124,7 +124,7 @@ VermilionDock_1db9b: VermilionDock_AnimSmokePuffDriftRight: push bc push de - ld hl, wOAMBuffer + 4 * $4 + 1 ; x coord + ld hl, wShadowOAMSprite04XCoord ld a, [wSSAnneSmokeDriftAmount] swap a ld c, a -- cgit v1.3.1-sl0p From 8f81e71f192bce4b6f56b042638da376737e5abc Mon Sep 17 00:00:00 2001 From: Rangi Date: Sun, 10 Jul 2022 21:11:03 -0400 Subject: Identify some `.asm_*` labels --- audio/low_health_alarm.asm | 14 ++++----- data/sgb/sgb_packets.asm | 16 +++++----- engine/battle/core.asm | 4 +-- engine/events/diploma.asm | 5 +-- engine/events/hidden_objects/bench_guys.asm | 4 +-- engine/events/hidden_objects/cinnabar_gym_quiz.asm | 4 +-- engine/events/pewter_guys.asm | 4 +-- engine/gfx/hp_bar.asm | 4 +-- engine/gfx/palettes.asm | 16 +++++----- engine/items/item_effects.asm | 36 +++++++++++----------- engine/math/multiply_divide.asm | 22 ++++++------- engine/menus/main_menu.asm | 4 +-- engine/overworld/field_move_messages.asm | 4 +-- engine/overworld/missable_objects.asm | 4 +-- engine/overworld/pathfinding.asm | 8 ++--- engine/overworld/player_state.asm | 8 ++--- engine/overworld/spinners.asm | 14 ++++----- engine/overworld/tilesets.asm | 4 +-- engine/play_time.asm | 8 ++--- home/yes_no.asm | 2 +- 20 files changed, 93 insertions(+), 92 deletions(-) (limited to 'engine/gfx') diff --git a/audio/low_health_alarm.asm b/audio/low_health_alarm.asm index 08060aab..65e19aa7 100644 --- a/audio/low_health_alarm.asm +++ b/audio/low_health_alarm.asm @@ -7,25 +7,25 @@ Music_DoLowHealthAlarm:: ret z ;nope and $7f ;low 7 bits are the timer. - jr nz, .asm_21383 ;if timer > 0, play low tone. + jr nz, .notToneHi ;if timer > 0, play low tone. call .playToneHi ld a, 30 ;keep this tone for 30 frames. - jr .asm_21395 ;reset the timer. + jr .resetTimer -.asm_21383 +.notToneHi cp 20 - jr nz, .asm_2138a ;if timer == 20, - call .playToneLo ;actually set the sound registers. + jr nz, .noTone ;if timer == 20, + call .playToneLo ;actually set the sound registers. -.asm_2138a +.noTone ld a, $86 ld [wChannelSoundIDs + Ch5], a ;disable sound channel? ld a, [wLowHealthAlarm] and $7f ;decrement alarm timer. dec a -.asm_21395 +.resetTimer ; reset the timer and enable flag. set 7, a ld [wLowHealthAlarm], a diff --git a/data/sgb/sgb_packets.asm b/data/sgb/sgb_packets.asm index 11fc8900..2a38f6c5 100644 --- a/data/sgb/sgb_packets.asm +++ b/data/sgb/sgb_packets.asm @@ -241,14 +241,14 @@ MaskEnCancelPacket: MASK_EN 0 ; This set of packets is found in several Japanese SGB-compatible titles. ; It appears to be part of NCL's SGB devkit. -DataSnd_72548: +DataSndPacket1: DATA_SND $85d, $0, 11 db $8C ; cpx #$8c (2) db $D0, $F4 ; bne -$0c db $60 ; rts ds 7, 0 -DataSnd_72558: +DataSndPacket2: DATA_SND $852, $0, 11 db $A9, $E7 ; lda #$e7 db $9F, $01, $C0, $7E ; sta $7ec001, x @@ -258,7 +258,7 @@ DataSnd_72558: db $E8 ; inx db $E0 ; cpx #$8c (1) -DataSnd_72568: +DataSndPacket3: DATA_SND $847, $0, 11 db $C4 ; cmp #$c4 (2) db $D0, $16 ; bne +$16 @@ -268,7 +268,7 @@ DataSnd_72568: db $D0, $10 ; bne +$10 db $A2, $28 ; ldx #$28 -DataSnd_72578: +DataSndPacket4: DATA_SND $83c, $0, 11 db $F0, $12 ; beq +$12 db $A5 ; lda dp @@ -279,7 +279,7 @@ DataSnd_72578: db $CA ; dex db $C9 ; cmp #$c4 (1) -DataSnd_72588: +DataSndPacket5: DATA_SND $831, $0, 11 dbw $0C, $CAA5 ; tsb $caa5 db $C9, $7E ; cmp #$7e @@ -288,7 +288,7 @@ DataSnd_72588: db $CB ; wai db $C9, $7E ; cmp #$7e -DataSnd_72598: +DataSndPacket6: DATA_SND $826, $0, 11 db $39 ; bne +$39 (2) dbw $CD, $C48 ; cmp $c48 @@ -297,7 +297,7 @@ DataSnd_72598: db $C9, $C9 ; cmp #$c9 db $80, $D0 ; bra -$30 -DataSnd_725a8: +DataSndPacket7: DATA_SND $81b, $0, 11 db $EA ; nop db $EA ; nop @@ -309,7 +309,7 @@ DataSnd_725a8: dbw $CD,$C4F ; cmp $c4f db $D0 ; bne +$39 (1) -DataSnd_725b8: +DataSndPacket8: DATA_SND $810, $0, 11 dbw $4C, $820 ; jmp $820 db $EA ; nop diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 580a9899..62813eb4 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6768,11 +6768,11 @@ InitOpponent: DetermineWildOpponent: ld a, [wd732] bit 1, a - jr z, .asm_3ef2f + jr z, .notDebug ldh a, [hJoyHeld] bit BIT_B_BUTTON, a ret nz -.asm_3ef2f +.notDebug ld a, [wNumberOfNoRandomBattleStepsLeft] and a ret nz diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 41e0d7c6..e08b1f24 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -17,9 +17,10 @@ DisplayDiploma:: hlcoord 0, 0 lb bc, 16, 18 predef Diploma_TextBoxBorder + ld hl, DiplomaTextPointersAndCoords ld c, $5 -.asm_56715 +.placeTextLoop push bc ld a, [hli] ld e, a @@ -34,7 +35,7 @@ DisplayDiploma:: inc hl pop bc dec c - jr nz, .asm_56715 + jr nz, .placeTextLoop hlcoord 10, 4 ld de, wPlayerName call PlaceString diff --git a/engine/events/hidden_objects/bench_guys.asm b/engine/events/hidden_objects/bench_guys.asm index b41434ad..55090c01 100644 --- a/engine/events/hidden_objects/bench_guys.asm +++ b/engine/events/hidden_objects/bench_guys.asm @@ -79,9 +79,9 @@ SaffronCityPokecenterBenchGuyText:: text_asm CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI ld hl, SaffronCityPokecenterBenchGuyText2 - jr nz, .asm_624f2 + jr nz, .printText ld hl, SaffronCityPokecenterBenchGuyText1 -.asm_624f2 +.printText call PrintText jp TextScriptEnd diff --git a/engine/events/hidden_objects/cinnabar_gym_quiz.asm b/engine/events/hidden_objects/cinnabar_gym_quiz.asm index f4c46115..69f03f2c 100644 --- a/engine/events/hidden_objects/cinnabar_gym_quiz.asm +++ b/engine/events/hidden_objects/cinnabar_gym_quiz.asm @@ -32,7 +32,7 @@ CinnabarGymQuiz:: call PrintText ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - call CinnabarGymQuiz_1ea92 + call CinnabarGymQuiz_AskQuestion jp TextScriptEnd CinnabarGymQuizIntroText: @@ -75,7 +75,7 @@ CinnabarGymGateFlagAction: EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED predef_jump FlagActionPredef -CinnabarGymQuiz_1ea92: +CinnabarGymQuiz_AskQuestion: call YesNoChoice ldh a, [hGymGateAnswer] ld c, a diff --git a/engine/events/pewter_guys.asm b/engine/events/pewter_guys.asm index 532fa4bf..06bb60fb 100644 --- a/engine/events/pewter_guys.asm +++ b/engine/events/pewter_guys.asm @@ -8,7 +8,7 @@ PewterGuys: add hl, de ld d, h ld e, l - ld hl, PointerTable_37ce6 + ld hl, PewterGuysCoordsTable ld a, [wWhichPewterGuy] add a ld b, 0 @@ -48,7 +48,7 @@ PewterGuys: inc hl jr .findMatchingCoordsLoop -PointerTable_37ce6: +PewterGuysCoordsTable: dw PewterMuseumGuyCoords dw PewterGymGuyCoords diff --git a/engine/gfx/hp_bar.asm b/engine/gfx/hp_bar.asm index e4de0b95..d848a337 100644 --- a/engine/gfx/hp_bar.asm +++ b/engine/gfx/hp_bar.asm @@ -215,10 +215,10 @@ UpdateHPBar_PrintHPNumber: push hl ldh a, [hUILayoutFlags] bit 0, a - jr z, .asm_fb15 + jr z, .hpBelowBar ld de, $9 jr .next -.asm_fb15 +.hpBelowBar ld de, $15 .next add hl, de diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index caa22c10..d97fbc55 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -443,14 +443,14 @@ PrepareSuperNintendoVRAMTransfer: .packetPointers ; Only the first packet is needed. dw MaskEnFreezePacket - dw DataSnd_72548 - dw DataSnd_72558 - dw DataSnd_72568 - dw DataSnd_72578 - dw DataSnd_72588 - dw DataSnd_72598 - dw DataSnd_725a8 - dw DataSnd_725b8 + dw DataSndPacket1 + dw DataSndPacket2 + dw DataSndPacket3 + dw DataSndPacket4 + dw DataSndPacket5 + dw DataSndPacket6 + dw DataSndPacket7 + dw DataSndPacket8 CheckSGB: ; Returns whether the game is running on an SGB in carry. diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index faba8837..02408484 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -2646,7 +2646,7 @@ SendNewMonToBox: ld a, [wcf91] ld [wd0b5], a ld c, a -.asm_e7b1 +.loop inc de ld a, [de] ld b, a @@ -2654,13 +2654,13 @@ SendNewMonToBox: ld c, b ld [de], a cp $ff - jr nz, .asm_e7b1 + jr nz, .loop call GetMonHeader ld hl, wBoxMonOT ld bc, NAME_LENGTH ld a, [wBoxCount] dec a - jr z, .asm_e7ee + jr z, .skip dec a call AddNTimes push hl @@ -2672,7 +2672,7 @@ SendNewMonToBox: ld a, [wBoxCount] dec a ld b, a -.asm_e7db +.loop2 push bc push hl ld bc, NAME_LENGTH @@ -2684,15 +2684,15 @@ SendNewMonToBox: add hl, bc pop bc dec b - jr nz, .asm_e7db -.asm_e7ee + jr nz, .loop2 +.skip ld hl, wPlayerName ld de, wBoxMonOT ld bc, NAME_LENGTH call CopyData ld a, [wBoxCount] dec a - jr z, .asm_e82a + jr z, .skip2 ld hl, wBoxMonNicks ld bc, NAME_LENGTH dec a @@ -2706,7 +2706,7 @@ SendNewMonToBox: ld a, [wBoxCount] dec a ld b, a -.asm_e817 +.loop3 push bc push hl ld bc, NAME_LENGTH @@ -2718,15 +2718,15 @@ SendNewMonToBox: add hl, bc pop bc dec b - jr nz, .asm_e817 -.asm_e82a + jr nz, .loop3 +.skip2 ld hl, wBoxMonNicks ld a, NAME_MON_SCREEN ld [wNamingScreenType], a predef AskName ld a, [wBoxCount] dec a - jr z, .asm_e867 + jr z, .skip3 ld hl, wBoxMons ld bc, wBoxMon2 - wBoxMon1 dec a @@ -2740,7 +2740,7 @@ SendNewMonToBox: ld a, [wBoxCount] dec a ld b, a -.asm_e854 +.loop4 push bc push hl ld bc, wBoxMon2 - wBoxMon1 @@ -2752,8 +2752,8 @@ SendNewMonToBox: add hl, bc pop bc dec b - jr nz, .asm_e854 -.asm_e867 + jr nz, .loop4 +.skip3 ld a, [wEnemyMonLevel] ld [wEnemyMonBoxLevel], a ld hl, wEnemyMon @@ -2783,11 +2783,11 @@ SendNewMonToBox: inc de xor a ld b, NUM_STATS * 2 -.asm_e89f +.loop5 ld [de], a inc de dec b - jr nz, .asm_e89f + jr nz, .loop5 ld hl, wEnemyMonDVs ld a, [hli] ld [de], a @@ -2796,12 +2796,12 @@ SendNewMonToBox: ld [de], a ld hl, wEnemyMonPP ld b, NUM_MOVES -.asm_e8b1 +.loop6 ld a, [hli] inc de ld [de], a dec b - jr nz, .asm_e8b1 + jr nz, .loop6 ret ; checks if the tile in front of the player is a shore or water tile diff --git a/engine/math/multiply_divide.asm b/engine/math/multiply_divide.asm index 2fcda158..ab065052 100644 --- a/engine/math/multiply_divide.asm +++ b/engine/math/multiply_divide.asm @@ -68,7 +68,7 @@ _Divide:: ldh [hDivideBuffer+4], a ld a, $9 ld e, a -.asm_37db3 +.loop ldh a, [hDivideBuffer] ld c, a ldh a, [hDividend+1] ; (aliases: hMultiplicand) @@ -78,18 +78,18 @@ _Divide:: ld c, a ldh a, [hDividend] ; (aliases: hProduct, hPastLeadingZeros, hQuotient) sbc c - jr c, .asm_37dce + jr c, .next ldh [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient) ld a, d ldh [hDividend+1], a ; (aliases: hMultiplicand) ldh a, [hDivideBuffer+4] inc a ldh [hDivideBuffer+4], a - jr .asm_37db3 -.asm_37dce + jr .loop +.next ld a, b cp $1 - jr z, .asm_37e18 + jr z, .done ldh a, [hDivideBuffer+4] sla a ldh [hDivideBuffer+4], a @@ -103,7 +103,7 @@ _Divide:: rl a ldh [hDivideBuffer+1], a dec e - jr nz, .asm_37e04 + jr nz, .next2 ld a, $8 ld e, a ldh a, [hDivideBuffer] @@ -116,20 +116,20 @@ _Divide:: ldh [hDividend+1], a ; (aliases: hMultiplicand) ldh a, [hDividend+3] ldh [hDividend+2], a -.asm_37e04 +.next2 ld a, e cp $1 - jr nz, .asm_37e0a + jr nz, .okay dec b -.asm_37e0a +.okay ldh a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10) srl a ldh [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10) ldh a, [hDivideBuffer] rr a ldh [hDivideBuffer], a - jr .asm_37db3 -.asm_37e18 + jr .loop +.done ldh a, [hDividend+1] ; (aliases: hMultiplicand) ldh [hRemainder], a ; (aliases: hDivisor, hMultiplier, hPowerOf10) ldh a, [hDivideBuffer+4] diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index 7db60d3d..d94c65eb 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -184,13 +184,13 @@ LinkMenu: ld b, a and $f0 cp $d0 - jr z, .asm_5c7d + jr z, .checkEnemyMenuSelection ld a, [wLinkMenuSelectionReceiveBuffer + 1] ld b, a and $f0 cp $d0 jr nz, .exchangeMenuSelectionLoop -.asm_5c7d +.checkEnemyMenuSelection ld a, b and $c ; did the enemy press A or B? jr nz, .enemyPressedAOrB diff --git a/engine/overworld/field_move_messages.asm b/engine/overworld/field_move_messages.asm index 520ef8ad..d75ffc21 100644 --- a/engine/overworld/field_move_messages.asm +++ b/engine/overworld/field_move_messages.asm @@ -32,7 +32,7 @@ IsSurfingAllowed: ret nz CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE ret z - ld hl, CoordsData_cdf7 + ld hl, SeafoamIslandsB4FStairsCoords call ArePlayerCoordsInArray ret nc ld hl, wd728 @@ -45,7 +45,7 @@ IsSurfingAllowed: ld hl, CyclingIsFunText jp PrintText -CoordsData_cdf7: +SeafoamIslandsB4FStairsCoords: dbmapcoord 7, 11 db -1 ; end diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm index 31fdc257..8f88b138 100644 --- a/engine/overworld/missable_objects.asm +++ b/engine/overworld/missable_objects.asm @@ -23,9 +23,9 @@ LoadMissableObjects: ld de, MissableObjects ; calculate difference between out pointer and the base pointer ld a, l sub e - jr nc, .asm_f13c + jr nc, .noCarry dec h -.asm_f13c +.noCarry ld l, a ld a, h sub d diff --git a/engine/overworld/pathfinding.asm b/engine/overworld/pathfinding.asm index 1925dbbc..d067345e 100644 --- a/engine/overworld/pathfinding.asm +++ b/engine/overworld/pathfinding.asm @@ -14,22 +14,22 @@ FindPathToPlayer: call CalcDifference ld d, a and a - jr nz, .asm_f8da + jr nz, .stillHasYProgress ldh a, [hFindPathFlags] set 0, a ; current end of path matches the player's Y coordinate ldh [hFindPathFlags], a -.asm_f8da +.stillHasYProgress ldh a, [hFindPathXProgress] ld b, a ldh a, [hNPCPlayerXDistance] ; X distance in steps call CalcDifference ld e, a and a - jr nz, .asm_f8ec + jr nz, .stillHasXProgress ldh a, [hFindPathFlags] set 1, a ; current end of path matches the player's X coordinate ldh [hFindPathFlags], a -.asm_f8ec +.stillHasXProgress ldh a, [hFindPathFlags] cp $3 ; has the end of the path reached the player's position? jr z, .done diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 70326754..8d652cdf 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -101,10 +101,10 @@ IsPlayerFacingEdgeOfMap:: ld b, a ld a, [wXCoord] ld c, a - ld de, .asm_c41e + ld de, .return push de jp hl -.asm_c41e +.return pop bc pop de pop hl @@ -239,11 +239,11 @@ PrintSafariZoneSteps:: call PlaceString ld a, [wNumSafariBalls] cp 10 - jr nc, .asm_c56d + jr nc, .tenOrMore hlcoord 5, 3 ld a, " " ld [hl], a -.asm_c56d +.tenOrMore hlcoord 6, 3 ld de, wNumSafariBalls lb bc, 1, 2 diff --git a/engine/overworld/spinners.asm b/engine/overworld/spinners.asm index 0ac6380d..98b478c4 100644 --- a/engine/overworld/spinners.asm +++ b/engine/overworld/spinners.asm @@ -11,18 +11,18 @@ LoadSpinnerArrowTiles:: ld a, [wCurMapTileset] cp FACILITY ld hl, FacilitySpinnerArrows - jr z, .asm_44ff6 + jr z, .gotSpinnerArrows ld hl, GymSpinnerArrows -.asm_44ff6 +.gotSpinnerArrows ld a, [wSimulatedJoypadStatesIndex] bit 0, a - jr nz, .asm_45001 - ld de, $18 + jr nz, .alternateGraphics + ld de, 6 * 4 add hl, de -.asm_45001 +.alternateGraphics ld a, $4 ld bc, $0 -.asm_45006 +.loop push af push hl push bc @@ -46,7 +46,7 @@ LoadSpinnerArrowTiles:: pop hl pop af dec a - jr nz, .asm_45006 + jr nz, .loop ret INCLUDE "data/tilesets/spinner_tiles.asm" diff --git a/engine/overworld/tilesets.asm b/engine/overworld/tilesets.asm index fa5cf626..d36e1169 100644 --- a/engine/overworld/tilesets.asm +++ b/engine/overworld/tilesets.asm @@ -35,13 +35,13 @@ LoadTilesetHeader: call IsInArray pop de pop hl - jr c, .asm_c797 + jr c, .dungeon ld a, [wCurMapTileset] ld b, a ldh a, [hPreviousTileset] cp b jr z, .done -.asm_c797 +.dungeon ld a, [wDestinationWarpID] cp $ff jr z, .done diff --git a/engine/play_time.asm b/engine/play_time.asm index 29897242..dcba88c2 100644 --- a/engine/play_time.asm +++ b/engine/play_time.asm @@ -39,12 +39,12 @@ TrackPlayTime:: CountDownIgnoreInputBitReset: ld a, [wIgnoreInputCounter] and a - jr nz, .asm_18e40 + jr nz, .decrement ld a, $ff - jr .asm_18e41 -.asm_18e40 + jr .continue +.decrement dec a -.asm_18e41 +.continue ld [wIgnoreInputCounter], a and a ret nz diff --git a/home/yes_no.asm b/home/yes_no.asm index 5b0e09ed..3f5a5a45 100644 --- a/home/yes_no.asm +++ b/home/yes_no.asm @@ -5,7 +5,7 @@ YesNoChoice:: call InitYesNoTextBoxParameters jr DisplayYesNoChoice -Func_35f4:: +TwoOptionMenu:: ; unreferenced ld a, TWO_OPTION_MENU ld [wTextBoxID], a call InitYesNoTextBoxParameters -- cgit v1.3.1-sl0p