shithub: pokecrystal

Download patch

ref: 2e90df15b76050c825f6c0b96c88453feec8f3dd
parent: cf26f559857de7317900578c21c2e8727964d36c
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Tue Oct 6 14:09:33 EDT 2020

Update battle anim bg function comments, and identify more unnamed labels

--- a/constants/battle_anim_constants.asm
+++ b/constants/battle_anim_constants.asm
@@ -814,7 +814,7 @@
 BG_EFFECT_STRUCT_LENGTH EQU const_value
 NUM_BG_EFFECTS EQU 5 ; see wActiveBGEffects
 
-; 
+; anim_bgeffect battle turn values for some effects
 	const_def
 	const BG_EFFECT_TARGET ; 0
 	const BG_EFFECT_USER   ; 1
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -3111,7 +3111,7 @@
 	call ClearEnemyMonBox
 	call NewEnemyMonStatus
 	call ResetEnemyStatLevels
-	call Function_SetEnemyMonAndSendOutAnimation
+	call ShowSetEnemyMonAndSendOutAnimation
 	call BreakAttraction
 	call ResetBattleParticipants
 	ret
@@ -3130,8 +3130,8 @@
 	call OfferSwitch
 	push af
 	call ClearEnemyMonBox
-	call Function_BattleTextEnemySentOut
-	call Function_SetEnemyMonAndSendOutAnimation
+	call ShowBattleTextEnemySentOut
+	call ShowSetEnemyMonAndSendOutAnimation
 	pop af
 	ret c
 	; If we're here, then we're switching too
@@ -3155,8 +3155,8 @@
 	ld a, 1
 	ld [wEnemyIsSwitching], a
 	call ClearEnemyMonBox
-	call Function_BattleTextEnemySentOut
-	jp Function_SetEnemyMonAndSendOutAnimation
+	call ShowBattleTextEnemySentOut
+	jp ShowSetEnemyMonAndSendOutAnimation
 
 CheckWhetherSwitchmonIsPredetermined:
 ; returns carry if: ???
@@ -3526,13 +3526,13 @@
 	call WaitBGMap
 	jp FinishBattleAnim
 
-Function_BattleTextEnemySentOut:
+ShowBattleTextEnemySentOut:
 	callfar Battle_GetTrainerName
 	ld hl, BattleText_EnemySentOut
 	call StdBattleTextbox
 	jp WaitBGMap
 
-Function_SetEnemyMonAndSendOutAnimation:
+ShowSetEnemyMonAndSendOutAnimation:
 	ld a, [wTempEnemyMonSpecies]
 	ld [wCurPartySpecies], a
 	ld [wCurSpecies], a
--- a/engine/battle_anims/bg_effects.asm
+++ b/engine/battle_anims/bg_effects.asm
@@ -2121,7 +2121,7 @@
 	db $e4, $6c, $fe
 
 BattleBGEffect_FadeMonToLight:
-; BG_EFFECT_STRUCT_BATTLE_TURN: 0 = target of animation, 1 = user
+; BG_EFFECT_STRUCT_BATTLE_TURN = BG_EFFECT_TARGET or BG_EFFECT_USER
 	ld de, .Pals
 	call BGEffect_RapidCyclePals
 	ret
@@ -2130,7 +2130,7 @@
 	db $e4, $90, $40, $ff
 
 BattleBGEffect_FadeMonToBlack:
-; BG_EFFECT_STRUCT_BATTLE_TURN: 0 = target of animation, 1 = user
+; BG_EFFECT_STRUCT_BATTLE_TURN = BG_EFFECT_TARGET or BG_EFFECT_USER
 	ld de, .Pals
 	call BGEffect_RapidCyclePals
 	ret
@@ -2139,7 +2139,7 @@
 	db $e4, $f8, $fc, $ff
 
 BattleBGEffect_FadeMonToLightRepeating:
-; BG_EFFECT_STRUCT_BATTLE_TURN: 0 = target of animation, 1 = user
+; BG_EFFECT_STRUCT_BATTLE_TURN = BG_EFFECT_TARGET or BG_EFFECT_USER
 	ld de, .Pals
 	call BGEffect_RapidCyclePals
 	ret
@@ -2148,7 +2148,7 @@
 	db $e4, $90, $40, $90, $fe
 
 BattleBGEffect_FadeMonToBlackRepeating:
-; BG_EFFECT_STRUCT_BATTLE_TURN: 0 = target of animation, 1 = user
+; BG_EFFECT_STRUCT_BATTLE_TURN = BG_EFFECT_TARGET or BG_EFFECT_USER
 	ld de, .Pals
 	call BGEffect_RapidCyclePals
 	ret
@@ -2157,7 +2157,7 @@
 	db $e4, $f8, $fc, $f8, $fe
 
 BattleBGEffect_CycleMonLightDarkRepeating:
-; BG_EFFECT_STRUCT_BATTLE_TURN: 0 = target of animation, 1 = user
+; BG_EFFECT_STRUCT_BATTLE_TURN = BG_EFFECT_TARGET or BG_EFFECT_USER
 	ld de, .Pals
 	call BGEffect_RapidCyclePals
 	ret
@@ -2166,7 +2166,7 @@
 	db $e4, $f8, $fc, $f8, $e4, $90, $40, $90, $fe
 
 BattleBGEffect_FlashMonRepeating: ; unused
-; BG_EFFECT_STRUCT_BATTLE_TURN: 0 = target of animation, 1 = user
+; BG_EFFECT_STRUCT_BATTLE_TURN = BG_EFFECT_TARGET or BG_EFFECT_USER
 	ld de, .Pals
 	call BGEffect_RapidCyclePals
 	ret
@@ -2175,7 +2175,7 @@
 	db $e4, $fc, $e4, $00, $fe
 
 BattleBGEffect_FadeMonToWhiteWaitFadeBack:
-; BG_EFFECT_STRUCT_BATTLE_TURN: 0 = target of animation, 1 = user
+; BG_EFFECT_STRUCT_BATTLE_TURN = BG_EFFECT_TARGET or BG_EFFECT_USER
 	ld de, .Pals
 	call BGEffect_RapidCyclePals
 	ret
@@ -2184,7 +2184,7 @@
 	db $e4, $90, $40, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $40, $90, $e4, $ff
 
 BattleBGEffect_FadeMonFromWhite: ; unused
-; BG_EFFECT_STRUCT_BATTLE_TURN: 0 = target of animation, 1 = user
+; BG_EFFECT_STRUCT_BATTLE_TURN = BG_EFFECT_TARGET or BG_EFFECT_USER
 	ld de, .Pals
 	call BGEffect_RapidCyclePals
 	ret
@@ -2194,7 +2194,7 @@
 
 BattleBGEffect_VibrateMon:
 ; Moves mon back and forth sideways for $20 frames
-; BG_EFFECT_STRUCT_BATTLE_TURN: 0 = target of animation, 1 = user
+; BG_EFFECT_STRUCT_BATTLE_TURN = BG_EFFECT_TARGET or BG_EFFECT_USER
 	call BattleBGEffects_AnonJumptable
 .anon_dw
 	dw .zero
--- a/engine/debug/color_picker.asm
+++ b/engine/debug/color_picker.asm
@@ -269,7 +269,7 @@
 
 .SwitchMon
 	ld [wcf66], a
-	ld a, 0 ; ScreenInitNo
+	ld a, 0
 	ld [wJumptableIndex], a
 	ret
 
@@ -1064,7 +1064,8 @@
 DebugColor_GFX:
 INCBIN "gfx/debug/color_test.2bpp"
 
-TilesetColorTest:
+TilesetColorPicker:
+; A debug function to test tileset palettes at runtime.
 ; dummied out
 	ret
 	xor a
@@ -1094,21 +1095,21 @@
 	call ByteFill
 	hlcoord 0, 0, wAttrmap
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
-	ld a, $07
+	ld a, PAL_BG_TEXT
 	call ByteFill
-	ld de, $15
+	decoord 1, 1, 0
 	ld a, DEBUGTEST_WHITE
-	call Function821d2
-	ld de, $1a
+	call DebugTileset_DrawColorSwatch
+	decoord 6, 1, 0
 	ld a, DEBUGTEST_LIGHT
-	call Function821d2
-	ld de, $1f
+	call DebugTileset_DrawColorSwatch
+	decoord 11, 1, 0
 	ld a, DEBUGTEST_DARK
-	call Function821d2
-	ld de, $24
+	call DebugTileset_DrawColorSwatch
+	decoord 16, 1, 0
 	ld a, DEBUGTEST_BLACK
-	call Function821d2
-	call Function821f4
+	call DebugTileset_DrawColorSwatch
+	call DebugTileset_LoadRGBMeter
 	call Function8220f
 	call WaitBGMap2
 	ld [wJumptableIndex], a
@@ -1116,42 +1117,39 @@
 	ldh [hWY], a
 	ret
 
-Function821d2:
+DebugTileset_DrawColorSwatch:
 	hlcoord 0, 0
-	call Function821de
+	call _DebugColor_DrawSwatch
 
-Function821d8:
+DebugColor_DrawAttributeSwatch:
 	ld a, [wcf64]
 	hlcoord 0, 0, wAttrmap
 
-Function821de:
+_DebugColor_DrawSwatch:
+; Fills a 4x3 box at de with byte a.
 	add hl, de
 rept 4
 	ld [hli], a
 endr
-	ld bc, $10
+rept 2
+	ld bc, SCREEN_WIDTH - 4
 	add hl, bc
 rept 4
 	ld [hli], a
 endr
-	ld bc, $10
-	add hl, bc
-rept 4
-	ld [hli], a
 endr
 	ret
 
-Function821f4:
+DebugTileset_LoadRGBMeter:
 	hlcoord 2, 4
 	call .Place
 	hlcoord 2, 6
 	call .Place
 	hlcoord 2, 8
-
 .Place:
 	ld a, DEBUGTEST_TICKS_1
 	ld [hli], a
-	ld bc, $10 - 1
+	ld bc, 15
 	ld a, DEBUGTEST_TICKS_2
 	call ByteFill
 	ret
@@ -1171,7 +1169,7 @@
 	ld de, wBGPals1
 	add hl, de
 	ld de, wc608
-	ld bc, 8
+	ld bc, 1 palettes
 	call CopyBytes
 	ld de, wc608
 	call DebugColor_CalculateRGB
@@ -1187,7 +1185,7 @@
 	jr nz, .loop7
 	ld a, [hl]
 	and B_BUTTON
-	jr nz, .asm_82299
+	jr nz, .cancel
 	call Function822f0
 	ret
 
@@ -1195,20 +1193,20 @@
 	ld hl, wcf64
 	ld a, [hl]
 	inc a
-	and 7
-	cp 7
-	jr nz, .asm_82253
-	xor a
-.asm_82253
+	and PALETTE_MASK
+	cp PAL_BG_TEXT
+	jr nz, .palette_ok
+	xor a ; PAL_BG_GRAY
+.palette_ok
 	ld [hl], a
-	ld de, $15
-	call Function821d8
-	ld de, $1a
-	call Function821d8
-	ld de, $1f
-	call Function821d8
-	ld de, $24
-	call Function821d8
+	decoord 1, 1, 0
+	call DebugColor_DrawAttributeSwatch
+	decoord 6, 1, 0
+	call DebugColor_DrawAttributeSwatch
+	decoord 11, 1, 0
+	call DebugColor_DrawAttributeSwatch
+	decoord 16, 1, 0
+	call DebugColor_DrawAttributeSwatch
 	ldh a, [rSVBK]
 	push af
 	ld a, BANK(wBGPals2)
@@ -1230,7 +1228,7 @@
 	ldh [hBGMapMode], a
 	ret
 
-.asm_82299
+.cancel
 	call ClearSprites
 	ldh a, [hWY]
 	xor %11010000
--- a/engine/items/buy_sell_toss.asm
+++ b/engine/items/buy_sell_toss.asm
@@ -141,7 +141,8 @@
 	call FarCall_de
 	ret
 
-ret_25097:
+NoPriceToDisplay:
+; Does nothing.
 	ret
 
 DisplayPurchasePrice:
@@ -204,7 +205,7 @@
 TossItem_MenuHeader:
 	db MENU_BACKUP_TILES ; flags
 	menu_coords 15, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
-	dw ret_25097
+	dw NoPriceToDisplay
 	db 0 ; default option
 
 BuyItem_MenuHeader:
--- a/engine/items/mart.asm
+++ b/engine/items/mart.asm
@@ -804,8 +804,8 @@
 	text_far _MartSellPriceText
 	text_end
 
-.UnusedString15f7d:
-	db "!ダミー!@"
+UnusedDummyString: ; unreferenced
+	db "!ダミー!@" ; "!Dummy!"
 
 MartWelcomeText:
 	text_far _MartWelcomeText
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -385,10 +385,9 @@
 	ld [wWildEncounterCooldown], a
 	ret
 
-ret_968d7:
-	ret
-
 SetMinTwoStepWildEncounterCooldown:
+; dummied out
+	ret
 	ld a, [wWildEncounterCooldown]
 	cp 2
 	ret nc
@@ -776,7 +775,7 @@
 	ret
 
 .jump:
-	call ret_968d7 ; mobile
+	call SetMinTwoStepWildEncounterCooldown
 	xor a
 	ld c, a
 	ret
--- a/engine/pokegear/pokegear.asm
+++ b/engine/pokegear/pokegear.asm
@@ -2051,7 +2051,7 @@
 	ld a, [hl]
 	and A_BUTTON
 	jr nz, .pressedA
-	call FlyMapScroll
+	call .HandleDPad
 	call GetMapCursorCoordinates
 	farcall PlaySpriteAnimations
 	call DelayFrame
@@ -2084,7 +2084,7 @@
 	ld e, a
 	ret
 
-FlyMapScroll:
+.HandleDPad:
 	ld a, [wStartFlypoint]
 	ld e, a
 	ld a, [wEndFlypoint]
@@ -2789,7 +2789,9 @@
 FlyMapLabelBorderGFX:
 INCBIN "gfx/pokegear/flymap_label_border.1bpp"
 
-Function92311: ; unreferenced
+EntireFlyMap: ; unreferenced
+; Similar to _FlyMap, but scrolls through the entire
+; Flypoints data of both regions. A debug function?
 	xor a
 	ld [wTownMapPlayerIconLandmark], a
 	call ClearBGPalettes
@@ -2842,7 +2844,7 @@
 
 .pressedB
 	ld a, -1
-	jr .finished_a_b
+	jr .exit
 
 .pressedA
 	ld a, [wTownMapPlayerIconLandmark]
@@ -2852,7 +2854,7 @@
 	ld de, Flypoints + 1
 	add hl, de
 	ld a, [hl]
-.finished_a_b
+.exit
 	ld [wTownMapPlayerIconLandmark], a
 	pop af
 	ldh [hInMenu], a
@@ -2871,44 +2873,44 @@
 	ld hl, hJoyLast
 	ld a, [hl]
 	and D_DOWN | D_RIGHT
-	jr nz, .down_right
+	jr nz, .ScrollNext
 	ld a, [hl]
 	and D_UP | D_LEFT
-	jr nz, .up_left
+	jr nz, .ScrollPrev
 	ret
 
-.down_right
+.ScrollNext:
 	ld hl, wTownMapPlayerIconLandmark
 	ld a, [hl]
 	cp NUM_FLYPOINTS - 1
-	jr c, .okay_dr
+	jr c, .NotAtEndYet
 	ld [hl], -1
-.okay_dr
+.NotAtEndYet:
 	inc [hl]
-	jr .continue
+	jr .FillMap
 
-.up_left
+.ScrollPrev:
 	ld hl, wTownMapPlayerIconLandmark
 	ld a, [hl]
 	and a
-	jr nz, .okay_ul
+	jr nz, .NotAtStartYet
 	ld [hl], NUM_FLYPOINTS
-.okay_ul
+.NotAtStartYet:
 	dec [hl]
-.continue
+.FillMap:
 	ld a, [wTownMapPlayerIconLandmark]
 	cp KANTO_FLYPOINT
-	jr c, .johto
+	jr c, .InJohto
 	call FillKantoMap
 	xor a
 	ld b, HIGH(vBGMap1)
-	jr .finish
+	jr .Finally
 
-.johto
+.InJohto:
 	call FillJohtoMap
 	ld a, SCREEN_HEIGHT_PX
 	ld b, HIGH(vBGMap0)
-.finish
+.Finally:
 	ldh [hWY], a
 	ld a, b
 	ldh [hBGMapAddress + 1], a
--- a/engine/rtc/print_hours_mins.asm
+++ b/engine/rtc/print_hours_mins.asm
@@ -1,4 +1,4 @@
-Function1dd6a9: ; unreferenced
+PrintFiveDigitNumber: ; unreferenced
 ; Debug function?
 ; Input: bc = value, de = destination
 	ld a, b
--- a/engine/tilesets/tileset_anims.asm
+++ b/engine/tilesets/tileset_anims.asm
@@ -90,7 +90,8 @@
 	dw NULL,  StandingTileFrame8
 	dw NULL,  DoneTileAnimation
 
-UnusedTilesetAnim_fc0d7:
+UnusedTilesetAnim1: ; unreferenced
+; Scrolls tile $03 like water, but also has the standard $03 flower tile.
 	dw vTiles2 tile $03, WriteTileToBuffer
 	dw wTileAnimBuffer, ScrollTileRightLeft
 	dw vTiles2 tile $03, WriteTileFromBuffer
@@ -103,7 +104,8 @@
 	dw NULL,  WaitTileAnimation
 	dw NULL,  DoneTileAnimation
 
-UnusedTilesetAnim_fc103:
+UnusedTilesetAnim2: ; unreferenced
+; Scrolls tile $14 like cave water.
 	dw vTiles2 tile $14, WriteTileToBuffer
 	dw wTileAnimBuffer, ScrollTileRightLeft
 	dw vTiles2 tile $14, WriteTileFromBuffer
@@ -140,7 +142,8 @@
 	dw NULL,  StandingTileFrame8
 	dw NULL,  DoneTileAnimation
 
-UnusedTilesetAnim_fc17f:
+UnusedTilesetAnim3: ; unreferenced
+; Scrolls tile $53 like a waterfall; scrolls tile $03 like cave water.
 	dw vTiles2 tile $53, WriteTileToBuffer
 	dw wTileAnimBuffer, ScrollTileDown
 	dw wTileAnimBuffer, ScrollTileDown
@@ -154,7 +157,8 @@
 	dw vTiles2 tile $53, WriteTileFromBuffer
 	dw NULL,  DoneTileAnimation
 
-UnusedTilesetAnim_fc1af:
+UnusedTilesetAnim4: ; unreferenced
+; Scrolls tile $54 like a waterfall; scrolls tile $03 like cave water.
 	dw vTiles2 tile $54, WriteTileToBuffer
 	dw wTileAnimBuffer, ScrollTileDown
 	dw wTileAnimBuffer, ScrollTileDown
@@ -231,7 +235,8 @@
 	dw NULL,  WaitTileAnimation
 	dw NULL,  DoneTileAnimation
 
-UnusedTilesetAnim_fc2bf:
+UnusedTilesetAnim5: ; unreferenced
+; Scrolls tile $4f like cave water.
 	dw vTiles2 tile $4f, WriteTileToBuffer
 	dw wTileAnimBuffer, ScrollTileRightLeft
 	dw vTiles2 tile $4f, WriteTileFromBuffer