shithub: pokecrystal

Download patch

ref: 6b7ade66da6bae234ccc3c41a8f85247a2d4ce03
parent: ff2d8502197934e07a45903102560e8eb81d2b5b
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Mon Oct 5 12:15:57 EDT 2020

Identify more unnamed labels

--- a/engine/battle/ai/items.asm
+++ b/engine/battle/ai/items.asm
@@ -758,7 +758,14 @@
 	ld a, DIRE_HIT
 	jp PrintText_UsedItemOn_AND_AIUpdateHUD
 
-Function3851e: ; unreferenced
+AICheckEnemyFractionMaxHP: ; unreferenced
+; Input: a = divisor
+; Work: bc = [wEnemyMonMaxHP] / a
+; Work: de = [wEnemyMonHP]
+; Output:
+; -  c, nz if [wEnemyMonHP] > [wEnemyMonMaxHP] / a
+; - nc,  z if [wEnemyMonHP] = [wEnemyMonMaxHP] / a
+; - nc, nz if [wEnemyMonHP] < [wEnemyMonMaxHP] / a
 	ldh [hDivisor], a
 	ld hl, wEnemyMonMaxHP
 	ld a, [hli]
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -826,9 +826,9 @@
 	jr nz, .row
 	ret
 
-Function8c7c9: ; unreferenced
+UnusedWaitBGMapOnce: ; unreferenced
 	ld a, 1
-	ldh [hBGMapMode], a
+	ldh [hBGMapMode], a ; redundant
 	call WaitBGMap
 	xor a
 	ldh [hBGMapMode], a
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -8201,7 +8201,7 @@
 	predef PlaceGraphic
 	ret
 
-Function3f662: ; unreferenced
+FillEnemyMovesFromMoveIndicesBuffer: ; unreferenced
 	ld hl, wEnemyMonMoves
 	ld de, wListMoves_MoveIndicesBuffer
 	ld b, NUM_MOVES
--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -216,16 +216,18 @@
 	call ClearBox
 	ret
 
-Functioncc220: ; unreferenced
+PlaceWindowOverBattleTextbox: ; unreferenced
 	xor a
 	ldh [hBGMapMode], a
-	ld a, LOW(vBGMap0 tile $28)
+	; bgcoord hBGMapAddress, 0, 20
+	ld a, LOW(vBGMap0 + 20 * BG_MAP_WIDTH)
 	ldh [hBGMapAddress], a
-	ld a, HIGH(vBGMap0 tile $28)
+	ld a, HIGH(vBGMap0 + 20 * BG_MAP_WIDTH)
 	ldh [hBGMapAddress + 1], a
 	call WaitBGMap2
-	ld a, $60
+	ld a, (SCREEN_HEIGHT - TEXTBOX_HEIGHT) * TILE_WIDTH
 	ldh [hWY], a
+	; bgcoord hBGMapAddress, 0, 0
 	xor a ; LOW(vBGMap0)
 	ldh [hBGMapAddress], a
 	ld a, HIGH(vBGMap0)
--- a/engine/events/npc_trade.asm
+++ b/engine/events/npc_trade.asm
@@ -312,7 +312,7 @@
 	call CopyBytes
 	ret
 
-Functionfcdfb: ; unreferenced
+Trade_CopyFourCharString: ; unreferenced
 	ld bc, 4
 	call CopyBytes
 	ld a, "@"
@@ -319,7 +319,7 @@
 	ld [de], a
 	ret
 
-Functionfce05: ; unreferenced
+Trade_CopyThreeCharString: ; unreferenced
 	ld bc, 3
 	call CopyBytes
 	ld a, "@"
--- a/engine/games/slot_machine.asm
+++ b/engine/games/slot_machine.asm
@@ -230,8 +230,7 @@
 	call PrintNum
 	ret
 
-Function92811: ; unreferenced
-; debug function?
+DebugPrintSlotBias: ; unreferenced
 	ld a, [wSlotBias]
 	add 0
 	daa
@@ -248,8 +247,8 @@
 	ld [hl], a
 	ret
 
-Function9282c: ; unreferenced
-; animate OAM tiles?
+AnimateSlotReelIcons: ; unreferenced
+; This animation was present in pokegold-spaceworld.
 	ld hl, wcf66
 	ld a, [hl]
 	inc [hl]
@@ -259,7 +258,7 @@
 	ld c, NUM_SPRITE_OAM_STRUCTS - 16
 .loop
 	ld a, [hl]
-	xor %00100000
+	xor $20 ; alternate between $00-$1f and $20-$3f
 	ld [hli], a ; tile id
 rept SPRITEOAMSTRUCT_LENGTH - 1
 	inc hl
@@ -845,7 +844,9 @@
 	jr nz, .loop
 	ret
 
-Function92bbe: ; unreferenced
+GetUnknownSlotReelData: ; unreferenced
+; Used to get OAM attribute values for slot reels?
+; (final Slots_UpdateReelPositionAndOAM above reuses tile IDs as OAM palettes)
 	push hl
 	srl a
 	srl a
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -719,12 +719,13 @@
 	call _GetMonPalettePointer
 	ret
 
-Function9779: ; unreferenced
+CGBCopyBattleObjectPals: ; unreferenced
+; dummied out
 	ret
 	call CheckCGB
 	ret z
 	ld hl, BattleObjectPals
-	ld a, $90
+	ld a, (1 << rOBPI_AUTO_INCREMENT) | $10
 	ldh [rOBPI], a
 	ld c, 6 palettes
 .loop
@@ -745,7 +746,7 @@
 Function97cc: ; unreferenced
 	call CheckCGB
 	ret z
-	ld a, $90
+	ld a, (1 << rOBPI_AUTO_INCREMENT) | $10
 	ldh [rOBPI], a
 	ld a, PREDEFPAL_TRADE_TUBE
 	call GetPredefPal
@@ -952,7 +953,7 @@
 	dw DataSndPacket7
 	dw DataSndPacket8
 
-Function9911: ; unreferenced
+UpdateSGBBorder: ; unreferenced
 	di
 	xor a
 	ldh [rJOYP], a
--- a/engine/items/tmhm.asm
+++ b/engine/items/tmhm.asm
@@ -484,7 +484,7 @@
 	pop de
 	ret
 
-Function2cadf: ; unreferenced
+VerboseReceiveTMHM: ; unreferenced
 	call ConvertCurItemIntoCurTMHM
 	call .CheckHaveRoomForTMHM
 	ld hl, .NoRoomTMHMText
@@ -510,7 +510,7 @@
 	add hl, bc
 	ld a, [hl]
 	inc a
-	cp NUM_TMS * 2
+	cp MAX_ITEM_STACK + 1
 	ret nc
 	ld [hl], a
 	ret
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -26,7 +26,7 @@
 	pop bc
 	ret
 
-Function437b:
+HandleObjectStep:
 	call .CheckObjectStillVisible
 	ret c
 	call .HandleStepType
@@ -609,7 +609,7 @@
 	ret
 
 .ObeyDPad:
-	ld hl, Function5000
+	ld hl, ApplyPlayerMovementByte
 	jp HandleMovementData
 
 .Movement08:
@@ -630,7 +630,7 @@
 	jp _GetMovementObject
 
 .Movement0d:
-	ld hl, Function5000
+	ld hl, ApplyPlayerMovementByte
 	jp HandleMovementData
 
 .Movement0e:
@@ -1823,7 +1823,7 @@
 	db  -4,  -6,  -8, -10, -11, -12, -12, -12
 	db -11, -10,  -9,  -8,  -6,  -4,   0,   0
 
-Function5000: ; unscripted?
+ApplyPlayerMovementByte:
 ; copy [wPlayerNextMovement] to [wPlayerMovement]
 	ld a, [wPlayerNextMovement]
 	ld hl, wPlayerMovement
@@ -2419,7 +2419,7 @@
 	ldh [hMapObjectIndexBuffer], a
 	call DoesObjectHaveASprite
 	jr z, .next
-	call Function437b
+	call HandleObjectStep
 .next
 	ld hl, OBJECT_LENGTH
 	add hl, bc
--- a/engine/phone/phone.asm
+++ b/engine/phone/phone.asm
@@ -528,7 +528,7 @@
 	call HangUp_Wait20Frames
 	ret
 
-Function90316:
+HangUp_ShutDown: ; unreferenced
 	ld de, SFX_SHUT_DOWN_PC
 	call PlaySFX
 	ret
--- a/engine/pokegear/pokegear.asm
+++ b/engine/pokegear/pokegear.asm
@@ -2789,7 +2789,7 @@
 FlyMapLabelBorderGFX:
 INCBIN "gfx/pokegear/flymap_label_border.1bpp"
 
-Function92311:
+Function92311: ; unreferenced
 	xor a
 	ld [wTownMapPlayerIconLandmark], a
 	call ClearBGPalettes
--- a/engine/pokemon/stats_screen.asm
+++ b/engine/pokemon/stats_screen.asm
@@ -483,7 +483,8 @@
 	dw sBoxMonNicknames
 	dw wBufferMonNick
 
-Function4df7f: ; unreferenced
+StatsScreen_PlaceVerticalDivider: ; unreferenced
+; The Japanese stats screen has a vertical divider.
 	hlcoord 7, 0
 	ld bc, SCREEN_WIDTH
 	ld d, SCREEN_HEIGHT
--- a/engine/rtc/print_hours_mins.asm
+++ b/engine/rtc/print_hours_mins.asm
@@ -1,4 +1,5 @@
 Function1dd6a9: ; unreferenced
+; Debug function?
 	ld a, b
 	ld b, c
 	ld c, a