ref: 3dcbe0ff55465d3c90490947b1585f2437027986
parent: 8360a1a2e81d3c3d6c2529c9a6834b011fd66f36
author: PikalaxALT <PikalaxALT@gmail.com>
date: Sun Jan 10 12:44:09 EST 2016
Pokegear
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -4142,7 +4142,7 @@
ld a, [EnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
ret z
- ld hl, wc6f2
+ ld hl, wEnemyBackupDVs
ld a, [wBattleMode]
dec a
ret z
@@ -5009,7 +5009,7 @@
ld a, [EnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a
jr z, .ok
- ld hl, wc6f2
+ ld hl, wEnemyBackupDVs
.ok
ld a, [hli]
ld [de], a
@@ -6336,7 +6336,7 @@
jr z, .InitDVs
; Unknown
- ld hl, wc6f2
+ ld hl, wEnemyBackupDVs
ld de, EnemyMonDVs
ld a, [hli]
ld [de], a
--- a/constants/sprite_constants.asm
+++ b/constants/sprite_constants.asm
@@ -477,7 +477,7 @@
const SPRITE_ANIM_INDEX_02
const SPRITE_ANIM_INDEX_GAMEFREAK_LOGO
const SPRITE_ANIM_INDEX_04
- const SPRITE_ANIM_INDEX_05
+ const SPRITE_ANIM_INDEX_NAMING_SCREEN_CURSOR
const SPRITE_ANIM_INDEX_SLOT_GOLEM
const SPRITE_ANIM_INDEX_SLOTS_CHANSEY
const SPRITE_ANIM_INDEX_SLOTS_EGG
@@ -484,7 +484,7 @@
const SPRITE_ANIM_INDEX_09
const SPRITE_ANIM_INDEX_RED_WALK
const SPRITE_ANIM_INDEX_0B
- const SPRITE_ANIM_INDEX_0C
+ const SPRITE_ANIM_INDEX_COMPOSE_MAIL_CURSOR
const SPRITE_ANIM_INDEX_0D
const SPRITE_ANIM_INDEX_0E
const SPRITE_ANIM_INDEX_0F
--- a/data/sprite_engine.asm
+++ b/data/sprite_engine.asm
@@ -66,7 +66,7 @@
dw .Frameset_40 ; 40 celebi on the left
dw .Frameset_41 ; 41 celebi on the right
; 8d76a
- ; OAM idx (see SpriteAnimOAMData), flip flags/duration
+; OAM idx (see SpriteAnimOAMData), flip flags/duration
.Frameset_00:
db $00, $20
db -1
--- a/engine/dummy_game.asm
+++ b/engine/dummy_game.asm
@@ -109,7 +109,7 @@
.spawn_object
depixel 6, 3, 4, 4
- ld a, SPRITE_ANIM_INDEX_0C
+ ld a, SPRITE_ANIM_INDEX_COMPOSE_MAIL_CURSOR
call _InitSpriteAnimStruct
ld a, 5
ld [wDummyGameNumberTriesRemaining], a
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -454,7 +454,7 @@
ld h, [hl]
ld l, a
rept 4
- add hl,de
+ add hl, de
endr
call GetMapScriptHeaderBank
@@ -1031,7 +1031,7 @@
ld b, 0
ld hl, PlayerEventScriptPointers
rept 3
- add hl,bc
+ add hl, bc
endr
ld a, [hli]
ld [ScriptBank], a
--- a/engine/healmachineanim.asm
+++ b/engine/healmachineanim.asm
@@ -19,7 +19,7 @@
.DoJumptableFunctions: ; 1233e
xor a
- ld [wd1ec], a
+ ld [Buffer3], a
.jumpable_loop
ld a, [Buffer1]
ld e, a
@@ -31,10 +31,10 @@
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [wd1ec]
+ ld a, [Buffer3]
ld e, a
inc a
- ld [wd1ec], a
+ ld [Buffer3], a
add hl, de
ld a, [hl]
cp 5
@@ -81,7 +81,7 @@
.PC_LoadBallsOntoMachine: ; 12393
ld hl, Sprites + $80
- ld de, .PC_ElmsLab_TileMap
+ ld de, .PC_ElmsLab_OAM
call .PlaceHealingMachineTile
call .PlaceHealingMachineTile
jr .LoadBallsOntoMachine
@@ -88,7 +88,7 @@
.HOF_LoadBallsOntoMachine: ; 123a1
ld hl, Sprites + $80
- ld de, .HOF_TileMap
+ ld de, .HOF_OAM
.LoadBallsOntoMachine: ; 123a7
ld a, [PartyCount]
@@ -126,15 +126,15 @@
ret
; 123dc
-.PC_ElmsLab_TileMap: ; 123dc
- db $20, $22, $7c, $16
- db $20, $26, $7c, $16
- db $26, $20, $7d, $16
- db $26, $28, $7d, $36
- db $2b, $20, $7d, $16
- db $2b, $28, $7d, $36
- db $30, $20, $7d, $16
- db $30, $28, $7d, $36
+.PC_ElmsLab_OAM: ; 123dc
+ dsprite 4, 0, 4, 2, $7c, $16
+ dsprite 4, 0, 4, 6, $7c, $16
+ dsprite 4, 6, 4, 0, $7d, $16
+ dsprite 4, 6, 5, 0, $7d, $36 ; xflip
+ dsprite 5, 3, 4, 0, $7d, $16
+ dsprite 5, 3, 5, 0, $7d, $36 ; xflip
+ dsprite 6, 0, 4, 0, $7d, $16
+ dsprite 6, 0, 5, 0, $7d, $36 ; xflip
; 123fc
.HealMachineGFX: ; 123fc
@@ -141,13 +141,13 @@
INCBIN "gfx/unknown/0123fc.2bpp"
; 1241c
-.HOF_TileMap: ; 1241c
- db $3c, $51, $7d, $16
- db $3c, $56, $7d, $16
- db $3b, $4d, $7d, $16
- db $3b, $5a, $7d, $16
- db $39, $49, $7d, $16
- db $39, $5d, $7d, $16
+.HOF_OAM: ; 1241c
+ dsprite 7, 4, 10, 1, $7d, $16
+ dsprite 7, 4, 10, 6, $7d, $16
+ dsprite 7, 3, 9, 5, $7d, $16
+ dsprite 7, 3, 11, 2, $7d, $16
+ dsprite 7, 1, 9, 1, $7d, $16
+ dsprite 7, 1, 11, 5, $7d, $16
; 12434
.LoadPalettes: ; 12434
@@ -241,10 +241,10 @@
.PlaceHealingMachineTile: ; 124a3
push bc
ld a, [Buffer1]
- lb bc, $10, $20
+ bcpixel 2, 4
cp $1 ; ElmsLab
jr z, .okay
- lb bc, $00, $00
+ bcpixel 0, 0
.okay
ld a, [de]
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -11,7 +11,7 @@
push af
xor a
ld [VramState], a
- call Function90bea
+ call .InitTilemap
call DelayFrame
.loop
call UpdateTime
@@ -41,10 +41,10 @@
ld [hBGMapAddress + 1], a
ld a, $90
ld [hWY], a
- call Function91492
+ call ExitPokegearRadio_HandleMusic
ret
-Function90bea: ; 90bea (24:4bea)
+.InitTilemap: ; 90bea (24:4bea)
call ClearBGPalettes
call ClearTileMap
call ClearSprites
@@ -54,7 +54,7 @@
ld [hSCX], a
ld a, $7
ld [hWX], a
- call Function90c4e
+ call Pokegear_LoadGFX
callba ClearSpriteAnims
call InitPokegearModeIndicatorArrow
ld a, 8
@@ -61,7 +61,7 @@
call SkipMusic
ld a, $e3
ld [rLCDC], a
- call Function90d70
+ call TownMap_InitCursorAndPlayerIconPositions
xor a
ld [wJumptableIndex], a
ld [wcf64], a
@@ -85,7 +85,7 @@
call DmgToCgbObjPal0
ret
-Function90c4e: ; 90c4e
+Pokegear_LoadGFX: ; 90c4e
call ClearVBank1
ld hl, TownMapGFX
ld de, VTiles2
@@ -148,14 +148,14 @@
ld [hl], $0
ret
-Function90d41: ; 90d41 (24:4d41)
+AnimatePokegearModeIndicatorArrow: ; 90d41 (24:4d41)
ld hl, wcf64
ld e, [hl]
ld d, 0
- ld hl, Unknown_90d52
+ ld hl, .XCoords
add hl, de
ld a, [hl]
- ld hl, $6
+ ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc
ld [hl], a
ret
@@ -162,11 +162,11 @@
; 90d52 (24:4d52)
-Unknown_90d52: ; 90d52
+.XCoords: ; 90d52
db $00, $10, $20, $30
; 90d56
-Function90d56: ; 90d56
+TownMap_GetCurrentLandmark: ; 90d56
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
@@ -183,7 +183,7 @@
; 90d70
-Function90d70: ; 90d70 (24:4d70)
+TownMap_InitCursorAndPlayerIconPositions: ; 90d70 (24:4d70)
ld a, [MapGroup]
ld b, a
ld a, [MapNumber]
@@ -238,7 +238,7 @@
jp [hl]
.return_from_jumptable
- call Function90eb0
+ call Pokegear_FinishTilemap
callba TownMapPals
ld a, [wcf65]
and a
@@ -269,12 +269,12 @@
.UpdateBGMap: ; 90e00 (24:4e00)
ld a, [hCGB]
and a
- jr z, .asm_90e0e
+ jr z, .dmg
ld a, $2
ld [hBGMapMode], a
ld c, 3
call DelayFrames
-.asm_90e0e
+.dmg
call WaitBGMap
ret
@@ -329,7 +329,7 @@
hlcoord 19, 2
ld [hl], $17
ld a, [wTownMapCursorLandmark]
- call Function910b4
+ call PokegearMap_UpdateLandmarkName
ret
; 90e72
@@ -350,13 +350,13 @@
hlcoord 0, 12
lb bc, 4, 18
call TextBox
- call Function90e98
+ call .PlacePhoneBars
call PokegearPhone_UpdateDisplayList
ret
; 90e98
-Function90e98: ; 90e98 (24:4e98)
+.PlacePhoneBars: ; 90e98 (24:4e98)
hlcoord 17, 1
ld a, $3c
ld [hli], a
@@ -372,7 +372,7 @@
ld [hl], $3f
ret
-Function90eb0: ; 90eb0 (24:4eb0)
+Pokegear_FinishTilemap: ; 90eb0 (24:4eb0)
hlcoord 0, 0
ld bc, $8
ld a, $4f
@@ -384,32 +384,32 @@
ld de, wPokegearFlags
ld a, [de]
bit 0, a
- call nz, Function90ee4
+ call nz, .PlaceMapIcon
ld a, [de]
bit 2, a
- call nz, Function90eeb
+ call nz, .PlacePhoneIcon
ld a, [de]
bit 1, a
- call nz, Function90ef2
+ call nz, .PlaceRadioIcon
hlcoord 0, 0
ld a, $46
- call Function90ef7
+ call .PlacePokegearCardIcon
ret
-Function90ee4: ; 90ee4 (24:4ee4)
+.PlaceMapIcon: ; 90ee4 (24:4ee4)
hlcoord 2, 0
ld a, $40
- jr Function90ef7
+ jr .PlacePokegearCardIcon
-Function90eeb: ; 90eeb (24:4eeb)
+.PlacePhoneIcon: ; 90eeb (24:4eeb)
hlcoord 4, 0
ld a, $44
- jr Function90ef7
+ jr .PlacePokegearCardIcon
-Function90ef2: ; 90ef2 (24:4ef2)
+.PlaceRadioIcon: ; 90ef2 (24:4ef2)
hlcoord 6, 0
ld a, $42
-Function90ef7: ; 90ef7 (24:4ef7)
+.PlacePokegearCardIcon: ; 90ef7 (24:4ef7)
ld [hli], a
inc a
ld [hld], a
@@ -454,7 +454,7 @@
call PrintText
ld hl, wJumptableIndex
inc [hl]
- call Function91492
+ call ExitPokegearRadio_HandleMusic
ret
PokegearClock_Joypad: ; 90f3e (24:4f3e)
@@ -544,7 +544,7 @@
ld a, 5
.done
ld [wJumptableIndex], a
- call Function91492
+ call ExitPokegearRadio_HandleMusic
ret
PokegearMap_Init: ; 90fcd (24:4fcd)
@@ -644,13 +644,13 @@
dec [hl]
.done_dpad
ld a, [wTownMapCursorLandmark]
- call Function910b4
+ call PokegearMap_UpdateLandmarkName
ld a, [wPokegearMapCursorObjectPointer]
ld c, a
ld a, [wPokegearMapCursorObjectPointer + 1]
ld b, a
ld a, [wTownMapCursorLandmark]
- call Function910d4
+ call PokegearMap_UpdateCursorPosition
ret
PokegearMap_InitPlayerIcon: ; 9106a
@@ -695,13 +695,13 @@
ld [hl], SPRITE_ANIM_SEQ_NULL
pop af
push bc
- call Function910d4
+ call PokegearMap_UpdateCursorPosition
pop bc
ret
; 910b4
-Function910b4: ; 910b4
+PokegearMap_UpdateLandmarkName: ; 910b4
push af
hlcoord 8, 0
lb bc, 2, 12
@@ -718,7 +718,7 @@
; 910d4
-Function910d4: ; 910d4
+PokegearMap_UpdateCursorPosition: ; 910d4
push bc
ld e, a
callba GetLandmarkCoords
@@ -782,23 +782,23 @@
.left
ld a, [wPokegearFlags]
bit 2, a
- jr z, .asm_9113b
+ jr z, .no_phone
ld c, $7
ld b, $2
- jr .asm_9114c
+ jr .switch_page
-.asm_9113b
+.no_phone
ld a, [wPokegearFlags]
bit 0, a
- jr z, .asm_91148
+ jr z, .no_map
ld c, $2
ld b, $1
- jr .asm_9114c
+ jr .switch_page
-.asm_91148
+.no_map
ld c, $0
ld b, $0
-.asm_9114c
+.switch_page
call Pokegear_SwitchPage
ret
@@ -815,7 +815,7 @@
ld [wPokegearPhoneCursorPosition], a
ld [wPokegearPhoneSelectedPerson], a
call InitPokegearTilemap
- call Function91492
+ call ExitPokegearRadio_HandleMusic
ld hl, PokegearText_WhomToCall
call PrintText
ret
@@ -841,15 +841,15 @@
.left
ld a, [wPokegearFlags]
bit 0, a
- jr z, .asm_9119c
+ jr z, .no_map
ld c, $2
ld b, $1
- jr .asm_911ac
+ jr .switch_page
-.asm_9119c
+.no_map
ld c, $0
ld b, $0
- jr .asm_911ac
+ jr .switch_page
.right
ld a, [wPokegearFlags]
@@ -857,7 +857,7 @@
ret z
ld c, $b
ld b, $3
-.asm_911ac
+.switch_page
call Pokegear_SwitchPage
ret
@@ -886,12 +886,12 @@
call AddNTimes
ld [hl], "▷"
call PokegearPhoneContactSubmenu
- jr c, .asm_911e5
+ jr c, .quit_submenu
ld hl, wJumptableIndex
inc [hl]
ret
-.asm_911e5
+.quit_submenu
ld a, $8
ld [wJumptableIndex], a
ret
@@ -899,7 +899,7 @@
PokegearPhone_MakePhoneCall: ; 911eb (24:51eb)
call GetMapHeaderPhoneServiceNybble
and a
- jr nz, .asm_91234
+ jr nz, .no_service
ld hl, Options
res NO_TEXT_SCROLL, [hl]
xor a
@@ -906,12 +906,12 @@
ld [hInMenu], a
ld de, SFX_CALL
call PlaySFX
- ld hl, UnknownText_0x9124c
+ ld hl, .dotdotdot
call PrintText
call WaitSFX
ld de, SFX_CALL
call PlaySFX
- ld hl, UnknownText_0x9124c
+ ld hl, .dotdotdot
call PrintText
call WaitSFX
ld a, [wPokegearPhoneSelectedPerson]
@@ -928,9 +928,9 @@
inc [hl]
ret
-.asm_91234
+.no_service
callba Phone_NoSignal
- ld hl, OutOfServiceAreaText
+ ld hl, .OutOfServiceArea
call PrintText
ld a, $8
ld [wJumptableIndex], a
@@ -940,7 +940,7 @@
; 9124c (24:524c)
-UnknownText_0x9124c: ; 0x9124c
+.dotdotdot: ; 0x9124c
;
text_jump UnknownText_0x1c5824
db "@"
@@ -947,7 +947,7 @@
; 0x91251
-OutOfServiceAreaText: ; 0x91251
+.OutOfServiceArea: ; 0x91251
; You're out of the service area.
text_jump UnknownText_0x1c5827
db "@"
@@ -1336,10 +1336,10 @@
call DeleteSpriteAnimStruct2ToEnd
ret
-Function91492: ; 91492
+ExitPokegearRadio_HandleMusic: ; 91492
ld a, [wPokegearRadioMusicPlaying]
cp $fe
- jr z, .asm_914a3
+ jr z, .restart_map_music
cp $ff
call z, EnterMapMusic
xor a
@@ -1346,7 +1346,7 @@
ld [wPokegearRadioMusicPlaying], a
ret
-.asm_914a3
+.restart_map_music
call RestartMapMusic
xor a
ld [wPokegearRadioMusicPlaying], a
@@ -1364,8 +1364,10 @@
ret
Pokegear_LoadTilemapRLE: ; 914bb (24:54bb)
+ ; Format: repeat count, tile ID
+ ; Terminated with $FF
hlcoord 0, 0
-.row
+.loop
ld a, [de]
cp $ff
ret z
@@ -1375,11 +1377,11 @@
ld c, a
inc de
ld a, b
-.col
+.load
ld [hli], a
dec c
- jr nz, .col
- jr .row
+ jr nz, .load
+ jr .loop
; 914ce (24:54ce)
@@ -1409,11 +1411,11 @@
; 9150d
RadioTilemapRLE: ; 9150d
-INCBIN "gfx/unknown/09150d.tilemap.rle"
+INCBIN "gfx/pokegear/radio.tilemap.rle"
PhoneTilemapRLE: ; 9158a
-INCBIN "gfx/unknown/09158a.tilemap.rle"
+INCBIN "gfx/pokegear/phone.tilemap.rle"
ClockTilemapRLE: ; 915db
-INCBIN "gfx/unknown/0915db.tilemap.rle"
+INCBIN "gfx/pokegear/clock.tilemap.rle"
; 9163e
_UpdateRadioStation: ; 9163e (24:563e)
@@ -1498,7 +1500,7 @@
; 916a1 (24:56a1)
-Function916a1: ; 916a1
+; XXX
ld [wPokegearRadioChannelBank], a
ld a, [hli]
ld [wPokegearRadioChannelAddr], a
@@ -1846,13 +1848,13 @@
call ClearTileMap
call ClearSprites
call DisableLCD
- call Function90c4e
+ call Pokegear_LoadGFX
callba ClearSpriteAnims
ld a, 8
call SkipMusic
ld a, $e3
ld [rLCDC], a
- call Function90d56
+ call TownMap_GetCurrentLandmark
ld [wd002], a
ld [wd003], a
xor a
@@ -1950,13 +1952,13 @@
.next
push de
ld a, [wd003]
- call Function910b4
+ call PokegearMap_UpdateLandmarkName
ld a, [wd004]
ld c, a
ld a, [wd005]
ld b, a
ld a, [wd003]
- call Function910d4
+ call PokegearMap_UpdateCursorPosition
pop de
jr .loop2
; 91a04
@@ -1964,14 +1966,13 @@
.InitTilemap: ; 91a04
ld a, [wd002]
cp KANTO_LANDMARK
- jr nc, .kanto
+ jr nc, .kanto2
ld e, $0
- jr .okay
+ jr .okay_tilemap
-.kanto
+.kanto2
ld e, $1
-
-.okay
+.okay_tilemap
callba PokegearMap
ld a, $7
ld bc, 6
@@ -1992,7 +1993,7 @@
hlcoord 19, 2
ld [hl], $17
ld a, [wd003]
- call Function910b4
+ call PokegearMap_UpdateLandmarkName
callba TownMapPals
ret
; 91a53
@@ -2025,7 +2026,7 @@
.stop
pop af
ld [Options], a
- call Function91492
+ call ExitPokegearRadio_HandleMusic
ret
; 91a87
@@ -2687,7 +2688,7 @@
.ShowPlayerLoop
ld a, [de]
cp $80
- jr z, .copy
+ jr z, .clear_oam
add b
ld [hli], a
inc de
@@ -2711,9 +2712,9 @@
pop bc
jr .ShowPlayerLoop
-.copy
- ld hl, Sprites + $10
- ld bc, SpritesEnd - (Sprites + $10)
+.clear_oam
+ ld hl, Sprites + 4 * 4
+ ld bc, SpritesEnd - (Sprites + 4 * 4)
xor a
call ByteFill
ret
@@ -2980,8 +2981,8 @@
INCBIN "gfx/pokegear/dexmap_nest_icon.2bpp"
FlyMapLabelBorderGFX: ; 922e1
INCBIN "gfx/pokegear/flymap_label_border.2bpp"
-Function92311: ; 92311
-; unreferenced
+
+; XXX
xor a
ld [wd002], a
call ClearBGPalettes
@@ -3034,7 +3035,7 @@
.pressedB
ld a, -1
- jr .asm_9239f
+ jr .finished_a_b
.pressedA
ld a, [wd002]
@@ -3044,7 +3045,7 @@
ld de, Flypoints + 1
add hl, de
ld a, [hl]
-.asm_9239f
+.finished_a_b
ld [wd002], a
pop af
ld [hInMenu], a
--- /dev/null
+++ b/engine/prof_oaks_pc.asm
@@ -1,0 +1,219 @@
+
+ProfOaksPC: ; 0x265d3
+ ld hl, OakPCText1
+ call MenuTextBox
+ call YesNoBox
+ jr c, .shutdown
+ call ProfOaksPCBoot ; player chose "yes"?
+.shutdown
+ ld hl, OakPCText4
+ call PrintText
+ call JoyWaitAorB
+ call ExitMenu
+ ret
+
+ProfOaksPCBoot ; 0x265ee
+ ld hl, OakPCText2
+ call PrintText
+ call Rate
+ call PlaySFX ; sfx loaded by previous Rate function call
+ call JoyWaitAorB
+ call WaitSFX
+ ret
+
+ProfOaksPCRating: ; 0x26601
+ call Rate
+ push de
+ ld de, MUSIC_NONE
+ call PlayMusic
+ pop de
+ call PlaySFX
+ call JoyWaitAorB
+ call WaitSFX
+ ret
+
+Rate: ; 0x26616
+; calculate Seen/Owned
+ ld hl, PokedexSeen
+ ld b, EndPokedexSeen - PokedexSeen
+ call CountSetBits
+ ld [wd002], a
+ ld hl, PokedexCaught
+ ld b, EndPokedexCaught - PokedexCaught
+ call CountSetBits
+ ld [wd003], a
+
+; print appropriate rating
+ call .UpdateRatingBuffers
+ ld hl, OakPCText3
+ call PrintText
+ call JoyWaitAorB
+ ld a, [wd003]
+ ld hl, OakRatings
+ call FindOakRating
+ push de
+ call PrintText
+ pop de
+ ret
+
+.UpdateRatingBuffers: ; 0x26647
+ ld hl, StringBuffer3
+ ld de, wd002
+ call .UpdateRatingBuffer
+ ld hl, StringBuffer4
+ ld de, wd003
+ call .UpdateRatingBuffer
+ ret
+
+.UpdateRatingBuffer: ; 0x2665a
+ push hl
+ ld a, "@"
+ ld bc, ITEM_NAME_LENGTH
+ call ByteFill
+ pop hl
+ lb bc, PRINTNUM_RIGHTALIGN | 1, 3
+ call PrintNum
+ ret
+
+FindOakRating: ; 0x2666b
+; return sound effect in de
+; return text pointer in hl
+ nop
+ ld c, a
+.loop
+ ld a, [hli]
+ cp c
+ jr nc, .match
+rept 4
+ inc hl
+endr
+ jr .loop
+
+.match
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ret
+
+OakRatings: ; 0x2667f
+oakrating: MACRO
+ db \1
+ dw \2, \3
+endm
+
+; if you caught at most this many, play this sound, load this text
+ oakrating 9, SFX_DEX_FANFARE_LESS_THAN_20, OakRating01
+ oakrating 19, SFX_DEX_FANFARE_LESS_THAN_20, OakRating02
+ oakrating 34, SFX_DEX_FANFARE_20_49, OakRating03
+ oakrating 49, SFX_DEX_FANFARE_20_49, OakRating04
+ oakrating 64, SFX_DEX_FANFARE_50_79, OakRating05
+ oakrating 79, SFX_DEX_FANFARE_50_79, OakRating06
+ oakrating 94, SFX_DEX_FANFARE_80_109, OakRating07
+ oakrating 109, SFX_DEX_FANFARE_80_109, OakRating08
+ oakrating 124, SFX_CAUGHT_MON, OakRating09
+ oakrating 139, SFX_CAUGHT_MON, OakRating10
+ oakrating 154, SFX_DEX_FANFARE_140_169, OakRating11
+ oakrating 169, SFX_DEX_FANFARE_140_169, OakRating12
+ oakrating 184, SFX_DEX_FANFARE_170_199, OakRating13
+ oakrating 199, SFX_DEX_FANFARE_170_199, OakRating14
+ oakrating 214, SFX_DEX_FANFARE_200_229, OakRating15
+ oakrating 229, SFX_DEX_FANFARE_200_229, OakRating16
+ oakrating 239, SFX_DEX_FANFARE_230_PLUS, OakRating17
+ oakrating 248, SFX_DEX_FANFARE_230_PLUS, OakRating18
+ oakrating 255, SFX_DEX_FANFARE_230_PLUS, OakRating19
+
+OakPCText1: ; 0x266de
+ text_jump _OakPCText1
+ db "@"
+
+OakPCText2: ; 0x266e3
+ text_jump _OakPCText2
+ db "@"
+
+OakPCText3: ; 0x266e8
+ text_jump _OakPCText3
+ db "@"
+
+OakRating01:
+ text_jump _OakRating01
+ db "@"
+
+OakRating02:
+ text_jump _OakRating02
+ db "@"
+
+OakRating03:
+ text_jump _OakRating03
+ db "@"
+
+OakRating04:
+ text_jump _OakRating04
+ db "@"
+
+OakRating05:
+ text_jump _OakRating05
+ db "@"
+
+OakRating06:
+ text_jump _OakRating06
+ db "@"
+
+OakRating07:
+ text_jump _OakRating07
+ db "@"
+
+OakRating08:
+ text_jump _OakRating08
+ db "@"
+
+OakRating09:
+ text_jump _OakRating09
+ db "@"
+
+OakRating10:
+ text_jump _OakRating10
+ db "@"
+
+OakRating11:
+ text_jump _OakRating11
+ db "@"
+
+OakRating12:
+ text_jump _OakRating12
+ db "@"
+
+OakRating13:
+ text_jump _OakRating13
+ db "@"
+
+OakRating14:
+ text_jump _OakRating14
+ db "@"
+
+OakRating15:
+ text_jump _OakRating15
+ db "@"
+
+OakRating16:
+ text_jump _OakRating16
+ db "@"
+
+OakRating17:
+ text_jump _OakRating17
+ db "@"
+
+OakRating18:
+ text_jump _OakRating18
+ db "@"
+
+OakRating19:
+ text_jump _OakRating19
+ db "@"
+
+OakPCText4: ; 0x2674c
+ text_jump _OakPCText4
+ db "@"
--- a/engine/sprite_anims.asm
+++ b/engine/sprite_anims.asm
@@ -19,7 +19,7 @@
dw .two ; bouncing mon icon, selected
dw .three ; bouncing mon icon, menu open
dw .four
- dw .five
+ dw .namingscreencursor
dw .GameFreakLogo ; Game Freak logo
dw .seven
dw .eight
@@ -26,7 +26,7 @@
dw .SlotsGolem ; Something to do with slots
dw .SlotsChansey ; Something to do with slots
dw .SlotsChanseyEgg ; Something to do with slots
- dw .twelve ; blinking cursor
+ dw .mailcompositioncursor ; blinking cursor
dw .thirteen
dw .fourteen
dw .fifteen
@@ -217,11 +217,11 @@
ld [hl], a
ret
-.five: ; 8d36c (23:536c)
+.namingscreencursor: ; 8d36c (23:536c)
callab NamingScreen_AnimateCursor
ret
-.twelve: ; 8d373 (23:5373)
+.mailcompositioncursor: ; 8d373 (23:5373)
callab ComposeMail_AnimateCursor
ret
@@ -409,7 +409,7 @@
ret
.fifteen: ; 8d475 (23:5475)
- callab Function90d41
+ callab AnimatePokegearModeIndicatorArrow
ret
.fourteen: ; 8d47c (23:547c)
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -393,7 +393,7 @@
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
ret z
- callba Function24bdc
+ callba StartMenu_DrawBugContestStatusBox
ret
; 128de
@@ -403,7 +403,7 @@
jr nz, .contest
ret
.contest
- callba Function24be7
+ callba StartMenu_PrintBugContestStatus
ret
; 128ed
--- a/engine/time.asm
+++ b/engine/time.asm
@@ -200,11 +200,9 @@
call CalcDaysSince
call GetDaysSince
and a
- jr z, .done
-
+ jr z, .done ; not even a day has passed since game start
ld b, a
callba ApplyPokerusTick
-
.done
xor a
ret
@@ -229,13 +227,13 @@
ret
; 1151c
-Function1151c: ; unreferenced
+; XXX
ld hl, DailyFlags
set 2, [hl]
ret
; 11522
-Function11522: ; unreferenced
+; XXX
and a
ld hl, DailyFlags
bit 2, [hl]
--- a/event/celebi.asm
+++ b/event/celebi.asm
@@ -61,8 +61,8 @@
inc a
dec c
jr nz, .OAMloop
- ld hl, Sprites + $10
- ld bc, $90
+ ld hl, Sprites + 4 * 4
+ ld bc, 36 * 4
xor a
call ByteFill
ret
--- a/event/kurt.asm
+++ b/event/kurt.asm
@@ -140,7 +140,7 @@
call .PlaceApricornName
call PlaceApricornQuantity
call ApplyTilemap
- callba Function27a28
+ callba Kurt_SelectQuantity_InterpretJoypad
jr nc, .loop
push bc
--- /dev/null
+++ b/gfx/pokegear/clock.tilemap.rle
@@ -1,0 +1,1 @@
+OO01OOO23OOOOOOOOOOOOOO&'OO
\ No newline at end of file
--- /dev/null
+++ b/gfx/pokegear/phone.tilemap.rle
@@ -1,0 +1,4 @@
+O
+OO
+'O
+
\ No newline at end of file
--- /dev/null
+++ b/gfx/pokegear/radio.tilemap.rle
@@ -1,0 +1,5 @@
+O
+OO7O89O:OHJ;
+LNO
+LN6XYZ[\]5LN&
+'LNMLNMLMLMLMLNM
\ No newline at end of file
--- a/gfx/unknown/09150d.tilemap.rle
+++ /dev/null
@@ -1,5 +1,0 @@
-O
-OO7O89O:OHJ;
-LNO
-LN6XYZ[\]5LN&
-'LNMLNMLMLMLMLNM
\ No newline at end of file
--- a/gfx/unknown/09158a.tilemap.rle
+++ /dev/null
@@ -1,4 +1,0 @@
-O
-OO
-'O
-
\ No newline at end of file
--- a/gfx/unknown/0915db.tilemap.rle
+++ /dev/null
@@ -1,1 +1,0 @@
-OO01OOO23OOOOOOOOOOOOOO&'OO
\ No newline at end of file
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -452,23 +452,23 @@
push af
set SUBSTATUS_TRANSFORMED, [hl]
bit SUBSTATUS_TRANSFORMED, a
- jr nz, .asm_ea13
- jr .asm_ea1a
+ jr nz, .ditto
+ jr .not_ditto
-.asm_ea13
+.ditto
ld a, DITTO
ld [TempEnemyMonSpecies], a
- jr .asm_ea27
+ jr .load_data
-.asm_ea1a
- set 3, [hl]
- ld hl, wc6f2
+.not_ditto
+ set SUBSTATUS_TRANSFORMED, [hl]
+ ld hl, wEnemyBackupDVs
ld a, [EnemyMonDVs]
ld [hli], a
ld a, [EnemyMonDVs + 1]
ld [hl], a
-.asm_ea27
+.load_data
ld a, [TempEnemyMonSpecies]
ld [CurPartySpecies], a
ld a, [EnemyMonLevel]
--- a/main.asm
+++ b/main.asm
@@ -5279,29 +5279,27 @@
INCLUDE "event/bug_contest_judging.asm"
-; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured.
ApplyPokerusTick: ; 13988
+; decreases all pokemon's pokerus counter by b. if the lower nybble reaches zero, the pokerus is cured.
ld hl, PartyMon1PokerusStatus ; PartyMon1 + MON_PKRS
ld a, [PartyCount]
and a
- ret z
+ ret z ; make sure it's not wasting time on an empty party
ld c, a
.loop
ld a, [hl]
- and $f
- jr z, .does_not_have_pokerus
- sub b
- jr nc, .ok
+ and $f ; lower nybble is the number of days remaining
+ jr z, .next ; if already 0, skip
+ sub b ; subtract the number of days
+ jr nc, .ok ; max(result, 0)
xor a
-
.ok
- ld d, a
+ ld d, a ; back up this value because we need to preserve the strain (upper nybble)
ld a, [hl]
and $f0
add d
- ld [hl], a
-
-.does_not_have_pokerus
+ ld [hl], a ; this prevents a cured pokemon from recontracting pokerus
+.next
ld de, PARTYMON_STRUCT_LENGTH
add hl, de
dec c
@@ -5678,44 +5676,44 @@
.booru_ko: ; 24bd4
db "ボール こ@"
-Function24bdc: ; 24bdc
+StartMenu_DrawBugContestStatusBox: ; 24bdc
hlcoord 0, 0
- ld b, $5
- ld c, $11
+ ld b, 5
+ ld c, 17
call TextBox
ret
-Function24be7: ; 24be7
+StartMenu_PrintBugContestStatus: ; 24be7
ld hl, Options
ld a, [hl]
push af
- set 4, [hl]
- call Function24bdc
+ set NO_TEXT_SCROLL, [hl]
+ call StartMenu_DrawBugContestStatusBox
hlcoord 1, 5
- ld de, String24c52
+ ld de, .Balls_EN
call PlaceString
hlcoord 8, 5
- ld de, wSafariBallsRemaining
+ ld de, wParkBallsRemaining
lb bc, PRINTNUM_RIGHTALIGN | 1, 2
call PrintNum
hlcoord 1, 1
- ld de, String24c4b
+ ld de, .CAUGHT
call PlaceString
ld a, [wContestMon]
and a
- ld de, String24c59
- jr z, .asm_24c1e
+ ld de, .None
+ jr z, .no_contest_mon
ld [wd265], a
call GetPokemonName
-.asm_24c1e
+.no_contest_mon
hlcoord 8, 1
call PlaceString
ld a, [wContestMon]
and a
- jr z, .asm_24c3e
+ jr z, .skip_level
hlcoord 1, 3
- ld de, String24c5e
+ ld de, .LEVEL
call PlaceString
ld a, [wContestMonLevel]
ld h, b
@@ -5724,20 +5722,20 @@
ld c, $3
call Function3842
-.asm_24c3e
+.skip_level
pop af
ld [Options], a
ret
-String24c43: ; 24c43
+.Balls_JP: ; 24c43
db "ボール こ@"
-String24c4b: ; 24c4b
+.CAUGHT: ; 24c4b
db "CAUGHT@"
-String24c52: ; 24c52
+.Balls_EN: ; 24c52
db "BALLS:@"
-String24c59: ; 24c59
+.None: ; 24c59
db "None@"
-String24c5e: ; 24c5e
+.LEVEL: ; 24c5e
db "LEVEL@"
FindApricornsInBag: ; 24c64
@@ -5799,226 +5797,7 @@
INCLUDE "battle/menu.asm"
INCLUDE "engine/buy_sell_toss.asm"
INCLUDE "engine/trainer_card.asm"
-
-ProfOaksPC: ; 0x265d3
- ld hl, OakPCText1
- call MenuTextBox
- call YesNoBox
- jr c, .shutdown
- call ProfOaksPCBoot ; player chose "yes"?
-.shutdown
- ld hl, OakPCText4
- call PrintText
- call JoyWaitAorB
- call ExitMenu
- ret
-
-ProfOaksPCBoot ; 0x265ee
- ld hl, OakPCText2
- call PrintText
- call Rate
- call PlaySFX ; sfx loaded by previous Rate function call
- call JoyWaitAorB
- call WaitSFX
- ret
-
-ProfOaksPCRating: ; 0x26601
- call Rate
- push de
- ld de, MUSIC_NONE
- call PlayMusic
- pop de
- call PlaySFX
- call JoyWaitAorB
- call WaitSFX
- ret
-
-Rate: ; 0x26616
-; calculate Seen/Owned
- ld hl, PokedexSeen
- ld b, EndPokedexSeen - PokedexSeen
- call CountSetBits
- ld [wd002], a
- ld hl, PokedexCaught
- ld b, EndPokedexCaught - PokedexCaught
- call CountSetBits
- ld [wd003], a
-
-; print appropriate rating
- call .UpdateRatingBuffers
- ld hl, OakPCText3
- call PrintText
- call JoyWaitAorB
- ld a, [wd003]
- ld hl, OakRatings
- call FindOakRating
- push de
- call PrintText
- pop de
- ret
-
-.UpdateRatingBuffers: ; 0x26647
- ld hl, StringBuffer3
- ld de, wd002
- call .UpdateRatingBuffer
- ld hl, StringBuffer4
- ld de, wd003
- call .UpdateRatingBuffer
- ret
-
-.UpdateRatingBuffer: ; 0x2665a
- push hl
- ld a, "@"
- ld bc, ITEM_NAME_LENGTH
- call ByteFill
- pop hl
- lb bc, PRINTNUM_RIGHTALIGN | 1, 3
- call PrintNum
- ret
-
-FindOakRating: ; 0x2666b
-; return sound effect in de
-; return text pointer in hl
- nop
- ld c, a
-.loop
- ld a, [hli]
- cp c
- jr nc, .match
-rept 4
- inc hl
-endr
- jr .loop
-
-.match
- ld a, [hli]
- ld e, a
- ld a, [hli]
- ld d, a
- ld a, [hli]
- ld h, [hl]
- ld l, a
- ret
-
-OakRatings: ; 0x2667f
-oakrating: MACRO
- db \1
- dw \2, \3
-endm
-
-; if you caught at most this many, play this sound, load this text
- oakrating 9, SFX_DEX_FANFARE_LESS_THAN_20, OakRating01
- oakrating 19, SFX_DEX_FANFARE_LESS_THAN_20, OakRating02
- oakrating 34, SFX_DEX_FANFARE_20_49, OakRating03
- oakrating 49, SFX_DEX_FANFARE_20_49, OakRating04
- oakrating 64, SFX_DEX_FANFARE_50_79, OakRating05
- oakrating 79, SFX_DEX_FANFARE_50_79, OakRating06
- oakrating 94, SFX_DEX_FANFARE_80_109, OakRating07
- oakrating 109, SFX_DEX_FANFARE_80_109, OakRating08
- oakrating 124, SFX_CAUGHT_MON, OakRating09
- oakrating 139, SFX_CAUGHT_MON, OakRating10
- oakrating 154, SFX_DEX_FANFARE_140_169, OakRating11
- oakrating 169, SFX_DEX_FANFARE_140_169, OakRating12
- oakrating 184, SFX_DEX_FANFARE_170_199, OakRating13
- oakrating 199, SFX_DEX_FANFARE_170_199, OakRating14
- oakrating 214, SFX_DEX_FANFARE_200_229, OakRating15
- oakrating 229, SFX_DEX_FANFARE_200_229, OakRating16
- oakrating 239, SFX_DEX_FANFARE_230_PLUS, OakRating17
- oakrating 248, SFX_DEX_FANFARE_230_PLUS, OakRating18
- oakrating 255, SFX_DEX_FANFARE_230_PLUS, OakRating19
-
-OakPCText1: ; 0x266de
- text_jump _OakPCText1
- db "@"
-
-OakPCText2: ; 0x266e3
- text_jump _OakPCText2
- db "@"
-
-OakPCText3: ; 0x266e8
- text_jump _OakPCText3
- db "@"
-
-OakRating01:
- text_jump _OakRating01
- db "@"
-
-OakRating02:
- text_jump _OakRating02
- db "@"
-
-OakRating03:
- text_jump _OakRating03
- db "@"
-
-OakRating04:
- text_jump _OakRating04
- db "@"
-
-OakRating05:
- text_jump _OakRating05
- db "@"
-
-OakRating06:
- text_jump _OakRating06
- db "@"
-
-OakRating07:
- text_jump _OakRating07
- db "@"
-
-OakRating08:
- text_jump _OakRating08
- db "@"
-
-OakRating09:
- text_jump _OakRating09
- db "@"
-
-OakRating10:
- text_jump _OakRating10
- db "@"
-
-OakRating11:
- text_jump _OakRating11
- db "@"
-
-OakRating12:
- text_jump _OakRating12
- db "@"
-
-OakRating13:
- text_jump _OakRating13
- db "@"
-
-OakRating14:
- text_jump _OakRating14
- db "@"
-
-OakRating15:
- text_jump _OakRating15
- db "@"
-
-OakRating16:
- text_jump _OakRating16
- db "@"
-
-OakRating17:
- text_jump _OakRating17
- db "@"
-
-OakRating18:
- text_jump _OakRating18
- db "@"
-
-OakRating19:
- text_jump _OakRating19
- db "@"
-
-OakPCText4: ; 0x2674c
- text_jump _OakPCText4
- db "@"
-
+INCLUDE "engine/prof_oaks_pc.asm"
INCLUDE "engine/decorations.asm"
PadCoords_de: ; 27092
@@ -6161,7 +5940,7 @@
MoveEffects: ; 2732e
INCLUDE "battle/moves/move_effects.asm"
-Function27a28: ; 27a28
+Kurt_SelectQuantity_InterpretJoypad: ; 27a28
call BuySellToss_InterpretJoypad
ld b, a
ret
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -147,6 +147,7 @@
ld l, a
pop de
jp [hl]
+
; 11425c
Function11425c: ; 11425c
@@ -157,10 +158,12 @@
endr
ld [MBC3SRamBank], a
ret
+
; 114268
Function114268: ; 114268
ret
+
; 114269
Function114269: ; 114269
@@ -301,6 +304,7 @@
ld a, $1
ld [wdc02], a
jp .asm_11429b
+
; 114333
Function114333: ; 114333
@@ -309,6 +313,7 @@
call Function115d80
pop bc
ret
+
; 11433c
Function11433c: ; 11433c
@@ -402,6 +407,7 @@
xor a
ld b, $1
jp Function11425c
+
; 1143b7
Function1143b7: ; 1143b7
@@ -453,6 +459,7 @@
ld a, $1
pop hl
jp Function11425c
+
; 1143f3
Function1143f3: ; 1143f3
@@ -481,6 +488,7 @@
ld a, $1
ld b, $84
ret
+
; 114412
Function114412: ; 114412
@@ -611,6 +619,7 @@
ld [hl], a
ld a, $1
ret
+
; 1144c8
Function1144c8: ; 1144c8
@@ -619,6 +628,7 @@
call Function115d80
pop bc
ret
+
; 1144d1
Function1144d1: ; 1144d1
@@ -718,6 +728,7 @@
pop hl
ld a, $1
jp Function11425c
+
; 114561
Function114561: ; 114561
@@ -740,6 +751,7 @@
ld a, [de]
ld [hl], a
ret
+
; 114576
Function114576: ; 114576
@@ -795,6 +807,7 @@
ld a, $1
ld [Bed], a
ret
+
; 1145c5
Function1145c5: ; 1145c5
@@ -888,6 +901,7 @@
ld [PartyMon5Defense], a
xor a
ret
+
; 11463c
Function11463c: ; 11463c
@@ -951,6 +965,7 @@
ld [Carpet], a
ld a, $1
ret
+
; 11469b
Function11469b: ; 11469b
@@ -959,6 +974,7 @@
call Function115d80
pop bc
ret
+
; 1146a4
Function1146a4: ; 1146a4
@@ -1018,6 +1034,7 @@
.asm_1146f7
ld a, $1
ret
+
; 1146fa
Function1146fa: ; 1146fa
@@ -1145,6 +1162,7 @@
.asm_1147cb
xor a
ret
+
; 1147cd
Function1147cd: ; 1147cd
@@ -1222,6 +1240,7 @@
.asm_114837
ld a, $1
ret
+
; 11483a
Function11483a: ; 11483a
@@ -1230,6 +1249,7 @@
call Function115d80
pop bc
ret
+
; 114843
Function114843: ; 114843
@@ -1254,6 +1274,7 @@
ld [wdc00], a
ld a, $1
ret
+
; 114867
Function114867: ; 114867
@@ -1313,6 +1334,7 @@
.asm_1148b6
ld a, $1
ret
+
; 1148b9
Function1148b9: ; 1148b9
@@ -1321,6 +1343,7 @@
call Function115d80
pop bc
ret
+
; 1148c2
Function1148c2: ; 1148c2
@@ -1413,6 +1436,7 @@
.asm_114941
ld a, $1
ret
+
; 114944
Function114944: ; 114944
@@ -1421,6 +1445,7 @@
call Function115d80
pop bc
ret
+
; 11494d
Function11494d: ; 11494d
@@ -1505,6 +1530,7 @@
.asm_1149c0
ld a, $1
ret
+
; 1149c3
Function1149c3: ; 1149c3
@@ -1513,6 +1539,7 @@
call Function115d80
pop bc
ret
+
; 1149cc
Function1149cc: ; 1149cc
@@ -1563,6 +1590,7 @@
pop de
ld a, $1
ret
+
; 114a0f
Function114a0f: ; 114a0f
@@ -1571,6 +1599,7 @@
call Function115d80
pop bc
ret
+
; 114a18
Function114a18: ; 114a18
@@ -1638,6 +1667,7 @@
.asm_114a6e
ld a, $1
ret
+
; 114a71
Function114a71: ; 114a71
@@ -1646,6 +1676,7 @@
call Function115d80
pop bc
ret
+
; 114a7a
Function114a7a: ; 114a7a
@@ -1698,6 +1729,7 @@
.asm_114ac3
ld a, $1
ret
+
; 114ac6
Function114ac6: ; 114ac6
@@ -1706,6 +1738,7 @@
call Function115d80
pop bc
ret
+
; 114acf
Function114acf: ; 114acf
@@ -1809,6 +1842,7 @@
ld [wdc0e], a
xor a
ret
+
; 114b4c
Function114b4c: ; 114b4c
@@ -1817,6 +1851,7 @@
call Function115d80
pop bc
ret
+
; 114b55
Function114b55: ; 114b55
@@ -1892,6 +1927,7 @@
pop bc
ld b, $82
jp Function11425c
+
; 114bbc
Function114bbc: ; 114bbc
@@ -1946,6 +1982,7 @@
ld a, $1
pop hl
jp Function11425c
+
; 114c0b
Function114c0b: ; 114c0b
@@ -2005,6 +2042,7 @@
or c
jr z, .asm_114c24
jr .asm_114c18
+
; 114c55
Function114c55: ; 114c55
@@ -2013,6 +2051,7 @@
call Function115d80
pop bc
ret
+
; 114c5e
Function114c5e: ; 114c5e
@@ -2115,6 +2154,7 @@
.asm_114cd7
dec bc
ret
+
; 114cd9
Function114cd9: ; 114cd9
@@ -2181,6 +2221,7 @@
pop hl
ld a, $1
jp Function11425c
+
; 114d39
Function114d39: ; 114d39
@@ -2249,6 +2290,7 @@
xor a
ld [hli], a
ret
+
; 114d99
Function114d99: ; 114d99
@@ -2324,6 +2366,7 @@
endr
xor a
ret
+
; 114df1
Function114df1: ; 114df1
@@ -2374,6 +2417,7 @@
.asm_114e2b
xor a
ret
+
; 114e2d
Function114e2d: ; 114e2d
@@ -2410,6 +2454,7 @@
jr z, .asm_114e55
xor a
ret
+
; 114e62
Function114e62: ; 114e62
@@ -2454,6 +2499,7 @@
ld a, $1
ld b, $83
jp Function11425c
+
; 114ea0
Function114ea0: ; 114ea0
@@ -2501,6 +2547,7 @@
ld a, $1
ld b, $83
ret
+
; 114ee0
Function114ee0: ; 114ee0
@@ -2509,6 +2556,7 @@
call Function115d80
pop bc
ret
+
; 114ee9
Function114ee9: ; 114ee9
@@ -2544,6 +2592,7 @@
ld [hli], a
ld [hl], d
ret
+
; 114f0a
Function114f0a: ; 114f0a
@@ -2580,6 +2629,7 @@
jr z, .asm_114f21
ld a, $ff
ret
+
; 114f39
Function114f39: ; 114f39
@@ -2611,6 +2661,7 @@
.asm_114f58
ret
+
; 114f59
Function114f59: ; 114f59
@@ -2738,6 +2789,7 @@
.asm_11501e
xor a
ret
+
; 115020
Function115020: ; 115020
@@ -2786,6 +2838,7 @@
.asm_115056
ld a, $1
ret
+
; 115059
Function115059: ; 115059
@@ -2794,6 +2847,7 @@
call Function115d80
pop bc
ret
+
; 115062
Function115062: ; 115062
@@ -2848,6 +2902,7 @@
.asm_1150b2
ret
+
; 1150b3
Function1150b3: ; 1150b3
@@ -2952,6 +3007,7 @@
xor a
ld [de], a
ret
+
; 115136
Function115136: ; 115136
@@ -2999,6 +3055,7 @@
.asm_11516d
ld a, $1
ret
+
; 115170
Function115170: ; 115170
@@ -3007,6 +3064,7 @@
call Function115d80
pop bc
ret
+
; 115179
Function115179: ; 115179
@@ -3118,6 +3176,7 @@
ld [hl], b
xor a
ret
+
; 11520e
Function11520e: ; 11520e
@@ -3126,6 +3185,7 @@
call Function115d80
pop bc
ret
+
; 115217
Function115217: ; 115217
@@ -3212,6 +3272,7 @@
inc e
call z, Function115286
jr .asm_115252
+
; 115286
Function115286: ; 115286
@@ -3220,6 +3281,7 @@
call Function115d80
pop bc
ret
+
; 11528f
Function11528f: ; 11528f
@@ -3244,6 +3306,7 @@
jr nz, .asm_1152a4
ld [hl], c
ret
+
; 1152af
Function1152af: ; 1152af
@@ -3252,6 +3315,7 @@
call Function115d80
pop bc
ret
+
; 1152b8
Function1152b8: ; 1152b8
@@ -3378,6 +3442,7 @@
add hl, de
xor a
jp Function11425c
+
; 11537d
Function11537d: ; 11537d
@@ -3427,6 +3492,7 @@
ld [wdc03], a
ld [wStartDay], a
ret
+
; 1153b5
Function1153b5: ; 1153b5
@@ -3454,6 +3520,7 @@
inc hl
ld [hl], d
ret
+
; 1153d2
Function1153d2: ; 1153d2
@@ -3641,6 +3708,7 @@
ld [wdc04], a
xor a
ret
+
; 1154d4
Function1154d4: ; 1154d4
@@ -3772,6 +3840,7 @@
jr z, .asm_115560
call Function1155d1
jr .asm_115547
+
; 1155af
Function1155af: ; 1155af
@@ -3803,6 +3872,7 @@
ld [hl], d
call Function1155d1
ret
+
; 1155d1
Function1155d1: ; 1155d1
@@ -3847,6 +3917,7 @@
ld a, h
ld [wdc0e], a
ret
+
; 11560a
Function11560a: ; 11560a
@@ -3974,6 +4045,7 @@
ld [de], a
ld bc, $03db
jr .asm_115659
+
; 1156cc
Function1156cc: ; 1156cc
@@ -4037,6 +4109,7 @@
ld a, $1
ld b, $83
jp Function11425c
+
; 115732
Function115732: ; 115732
@@ -4080,6 +4153,7 @@
ld [hli], a
ld [hl], b
ret
+
; 11575c
Function11575c: ; 11575c
@@ -4167,6 +4241,7 @@
ld a, $2
ld [wStartDay], a
ret
+
; 1157d0
Function1157d0: ; 1157d0
@@ -4225,6 +4300,7 @@
ld a, $3
ld [wStartDay], a
ret
+
; 11581e
Function11581e: ; 11581e
@@ -4332,6 +4408,7 @@
ld a, $ff
ld [wStartDay], a
ret
+
; 1158c2
Function1158c2: ; 1158c2
@@ -4543,6 +4620,7 @@
ld a, $0
ld [hl], a
ret
+
; 1159dc
Function1159dc: ; 1159dc
@@ -4572,6 +4650,7 @@
.asm_1159f8
ld a, $2b
ret
+
; 1159fb
Function1159fb: ; 1159fb
@@ -4634,6 +4713,7 @@
.asm_115a5a
ld a, $1
jp Function11425c
+
; 115a5f
Function115a5f: ; 115a5f
@@ -4694,6 +4774,7 @@
ld a, $2
ld [wStartDay], a
ret
+
; 115ab0
Function115ab0: ; 115ab0
@@ -4754,6 +4835,7 @@
ld [wStartDay], a
xor a
ret
+
; 115b00
Function115b00: ; 115b00
@@ -4888,6 +4970,7 @@
.asm_115bc6
xor a
ret
+
; 115bc8
Function115bc8: ; 115bc8
@@ -4989,6 +5072,7 @@
.asm_115c46
ld a, $2
ret
+
; 115c49
Function115c49: ; 115c49
@@ -5127,6 +5211,7 @@
cp $0
jp nz, .asm_115c64
ret
+
; 115cfd
Function115cfd: ; 115cfd
@@ -5197,6 +5282,7 @@
.asm_115d50
sub $47
ret
+
; 115d53
Function115d53: ; 115d53
@@ -5212,6 +5298,7 @@
xor a
ld [hl], a
ret
+
; 115d61
Function115d61: ; 115d61
@@ -5220,6 +5307,7 @@
call Function115d80
pop bc
ret
+
; 115d6a
Function115d6a: ; 115d6a
@@ -5234,6 +5322,7 @@
jr nz, .asm_115d6a
xor a
ret
+
; 115d77
Function115d77: ; 115d77
@@ -5242,6 +5331,7 @@
call Function115d80
pop bc
ret
+
; 115d80
Function115d80: ; 115d80
@@ -5264,915 +5354,11 @@
ld d, $a0
ld e, $0
ret
+
; 115d99
-Function115d99: ; 115d99
- ld de, GFX_11601a
- ld hl, VTiles0 tile $60
- lb bc, BANK(GFX_11601a), $14
- call Get2bpp
- xor a
- ld [wc305], a
- ld [wc306], a
- ld [wc309], a
- ld [wc30a], a
- ld [wc30b], a
- ld [wc30c], a
- ld a, $10
- ld [wc307], a
- ld a, $18
- ld [wc308], a
- ret
-; 115dc3
-
-Function115dc3: ; 115dc3
- xor a
- ld [wc305], a
- ld a, $a0
- ld hl, Sprites + $7c
- ld bc, $0020
- call ByteFill
- ret
-; 115dd3
-
-Function115dd3: ; 115dd3
- ld a, [wc305]
- and a
- ret z
- ld a, $a0
- ld hl, Sprites + $7c
- ld bc, $0020
- call ByteFill
- call Function115e22
- ld a, [wc309]
- sla a
- ld c, a
- ld b, 0
- ld hl, Unknown_115e86
- add hl, bc
- ld a, [hli]
- ld e, a
- ld a, [hl]
- ld d, a
- push de
- pop hl
- ld de, Sprites + $7c
- ld a, [wc307]
- ld c, a
- ld a, [wc308]
- ld b, a
- ld a, [hli]
-.asm_115e04
- push af
- ld a, [hli]
- add b
- ld [de], a
- inc de
- ld a, [hli]
- add c
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- pop af
- dec a
- jr nz, .asm_115e04
- ret
-; 115e18
-
-Function115e18: ; 115e18
- ld a, c
- ld [wc30a], a
- xor a
- ld [wc30b], a
- jr Function115e2b
-; 115e22
-
-Function115e22: ; 115e22
- ld hl, wc30c
- dec [hl]
- ret nz
- ld hl, wc30b
- inc [hl]
-
-Function115e2b: ; 115e2b
- ld a, [wc30a]
- sla a
- ld c, a
- ld b, 0
- ld hl, Unknown_115e59
- add hl, bc
- ld a, [hli]
- ld e, a
- ld a, [hli]
- ld d, a
- push de
- pop hl
- ld a, [wc30b]
- sla a
- ld c, a
- ld b, $0
- add hl, bc
- ld a, [hli]
- cp $ff
- jr nz, .asm_115e51
- xor a
- ld [wc30b], a
- jr Function115e2b
-
-.asm_115e51
- ld [wc309], a
- ld a, [hl]
- ld [wc30c], a
- ret
-; 115e59
-
-Unknown_115e59:
- dw Unknown_115e61
- dw Unknown_115e6c
- dw Unknown_115e76
- dw Unknown_115e79
-
-Unknown_115e61: ; 115e61
- db $4, $8
- db $5, $8
- db $6, $8
- db $7, $8
- db $8, $8
- db $ff
-
-Unknown_115e6c: ; 115e6c
- db $1, $8
- db $2, $8
- db $3, $8
- db $9, $8
- db $a, $8
-
-Unknown_115e76: ; 115e76
- db $0, $8
- db $ff
-
-Unknown_115e79: ; 115e79
- db $b, $8
- db $c, $8
- db $d, $8
- db $e, $8
- db $f, $8
- db $0, $8
- db $ff
-; 115e86
-
-Unknown_115e86:
- dw Unknown_115ea6
- dw Unknown_115eb7
- dw Unknown_115ecc
- dw Unknown_115ee1
- dw Unknown_115ef6
- dw Unknown_115f13
- dw Unknown_115f30
- dw Unknown_115f4d
- dw Unknown_115f6a
- dw Unknown_115f87
- dw Unknown_115f9c
- dw Unknown_115fb1
- dw Unknown_115fc6
- dw Unknown_115fdb
- dw Unknown_115ff0
- dw Unknown_116005
-
-Unknown_115ea6: ; 115ea6
- db $4
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_115eb7: ; 115eb7
- db $5
- db $0, $8, $64, $0
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_115ecc: ; 115ecc
- db $5
- db $0, $8, $65, $0
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_115ee1: ; 115ee1
- db $5
- db $0, $8, $66, $0
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_115ef6: ; 115ef6
- db $7
- db $0, $0, $67, $1
- db $8, $0, $68, $1
- db $10, $0, $6d, $0
- db $10, $8, $69, $0
- db $10, $10, $6a, $0
- db $18, $8, $6b, $0
- db $18, $10, $6c, $0
-
-Unknown_115f13: ; 115f13
- db $7
- db $0, $0, $67, $1
- db $8, $0, $68, $1
- db $10, $0, $6e, $0
- db $10, $8, $69, $0
- db $10, $10, $6a, $0
- db $18, $8, $6b, $0
- db $18, $10, $6c, $0
-
-Unknown_115f30: ; 115f30
- db $7
- db $0, $0, $67, $1
- db $8, $0, $68, $1
- db $10, $0, $6f, $0
- db $10, $8, $69, $0
- db $10, $10, $6a, $0
- db $18, $8, $6b, $0
- db $18, $10, $6c, $0
-
-Unknown_115f4d: ; 115f4d
- db $7
- db $0, $0, $67, $1
- db $8, $0, $68, $1
- db $10, $0, $70, $0
- db $10, $8, $69, $0
- db $10, $10, $6a, $0
- db $18, $8, $6b, $0
- db $18, $10, $6c, $0
-
-Unknown_115f6a: ; 115f6a
- db $7
- db $0, $0, $67, $1
- db $8, $0, $68, $1
- db $10, $0, $71, $0
- db $10, $8, $69, $0
- db $10, $10, $6a, $0
- db $18, $8, $6b, $0
- db $18, $10, $6c, $0
-
-Unknown_115f87: ; 115f87
- db $5
- db $0, $8, $72, $0
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_115f9c: ; 115f9c
- db $5
- db $0, $8, $73, $0
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_115fb1: ; 115fb1
- db $5
- db $1, $8, $64, $60
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_115fc6: ; 115fc6
- db $5
- db $1, $8, $65, $60
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_115fdb: ; 115fdb
- db $5
- db $1, $8, $66, $60
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_115ff0: ; 115ff0
- db $5
- db $1, $8, $72, $60
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-
-Unknown_116005: ; 116005
- db $5
- db $1, $8, $73, $60
- db $8, $0, $60, $1
- db $8, $8, $61, $1
- db $10, $0, $62, $1
- db $10, $8, $63, $1
-; 11601a
-
-GFX_11601a:: ; 11601a
-INCBIN "gfx/unknown/11601a.2bpp"
-
-Function11615a: ; 11615a
- xor a
- ld [wc30d], a
- ld [$c319], a
- ld [wc310], a
- ld [wc311], a
- ld [wc312], a
- ld [wc313], a
- ld [wc314], a
- ld [wc314 + 1], a
- ld [wc314 + 4], a
- ld [wc3f6], a
- ld [wc3f8], a
- ld [wc3f2], a
- ld [wc3f4], a
- ld a, $24
- ld [wc3f5], a
- ld a, $7
- ld [wc3f7], a
- ld a, $b0
- ld [wc30e], a
- ld [wc3f1], a
- ld a, $48
- ld [wc30f], a
- ld [wc3f3], a
- ret
-; 11619d
+INCLUDE "misc/mobile_45_sprite_engine.asm"
-Function11619d: ; 11619d
- ld a, [wc30d]
- and a
- ret z
- ld a, [$c319]
- cp $2
- jr c, .asm_1161b4
- ld a, $a0
- ld hl, Sprites
- ld bc, $0064
- call ByteFill
-
-.asm_1161b4
- call Function1161b8
- ret
-; 1161b8
-
-Function1161b8: ; 1161b8
- ld a, [$c319]
- ld e, a
- ld d, 0
- ld hl, .Jumptable
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-; 1161c7
-
-.Jumptable: ; 1161c7
- dw Function1161d5
- dw Function116294
- dw Function1162cb
- dw Function1162f2
- dw Function1163c0
- dw Function11636e
- dw Function116441
-; 1161d5
-
-Function1161d5: ; 1161d5
- ld a, [rSVBK]
- push af
-
- ld a, $6
- ld [rSVBK], a
-
- ld hl, Unknown_117356
- ld de, wDecompressScratch
- ld bc, $0300
- call CopyBytes
-
- di
-
-.wait_for_vblank
-; Wait until a vblank would occur had interrupts not just been disabled.
- ld a, [rLY]
- cp $91
- jr nz, .wait_for_vblank
-
- ld a, $d0
- ld [rHDMA1], a
- ld a, $0
- ld [rHDMA2], a
- ld a, $1c
- ld [rHDMA3], a
- xor a
- ld [rHDMA4], a
- ld a, $8
- ld [rHDMA5], a
-
- ld a, $d0
- ld [rHDMA1], a
- ld a, $80
- ld [rHDMA2], a
- ld a, $1c
- ld [rHDMA3], a
- ld a, $80
- ld [rHDMA4], a
- ld a, $8
- ld [rHDMA5], a
-
- ld a, $d1
- ld [rHDMA1], a
- ld a, $0
- ld [rHDMA2], a
- ld a, $1d
- ld [rHDMA3], a
- xor a
- ld [rHDMA4], a
- ld a, $8
- ld [rHDMA5], a
-
- ld a, $1
- ld [rVBK], a
-
- ld a, $d1
- ld [rHDMA1], a
- ld a, $80
- ld [rHDMA2], a
- ld a, $1c
- ld [rHDMA3], a
- xor a
- ld [rHDMA4], a
- ld a, $8
- ld [rHDMA5], a
-
- ld a, $d2
- ld [rHDMA1], a
- ld a, $0
- ld [rHDMA2], a
- ld a, $1c
- ld [rHDMA3], a
- ld a, $80
- ld [rHDMA4], a
- ld a, $8
- ld [rHDMA5], a
-
- ld a, $d2
- ld [rHDMA1], a
- ld a, $80
- ld [rHDMA2], a
- ld a, $1d
- ld [rHDMA3], a
- xor a
- ld [rHDMA4], a
- ld a, $8
- ld [rHDMA5], a
-
- xor a
- ld [rVBK], a
-
- ei
-
- pop af
- ld [rSVBK], a
-
- callba ReloadMapPart
- ld a, $8
- ld [MusicFade], a
- ld de, MUSIC_MOBILE_ADAPTER
- ld a, e
- ld [MusicFadeIDLo], a
- ld a, d
- ld [MusicFadeIDHi], a
- ld a, [$c319]
- inc a
- ld [$c319], a
- ret
-; 11628c
-
-MenuDataHeader_11628c: ; 11628c
- db $40 ; flags
- db 6, 0 ; start coords
- db 17, 19 ; end coords
- dw NULL
- db 0 ; default option
-; 116294
-
-Function116294: ; 116294
- callba Function170d02
- ld a, [$c319]
- inc a
- ld [$c319], a
- ld a, [rSVBK]
- push af
- ld a, $5
- ld [rSVBK], a
- ld hl, UnknBGPals + 8 * 6
- ld de, $c320
- ld bc, 2 palettes
- call CopyBytes
- ld hl, Palette_11734e
- ld de, UnknBGPals + 8 * 7
- ld bc, 1 palettes
- call CopyBytes
- call SetPalettes
- pop af
- ld [rSVBK], a
- ld a, $30
- ld [hWY], a
- ret
-; 1162cb
-
-Function1162cb: ; 1162cb
- callba Function170cc6
- ld a, [$c319]
- inc a
- ld [$c319], a
- ld a, [rSVBK]
- push af
- ld a, $5
- ld [rSVBK], a
- ld hl, Palette_11730e
- ld de, UnknOBPals + 2 palettes
- ld bc, 6 palettes
- call CopyBytes
- call SetPalettes
- pop af
- ld [rSVBK], a
- ret
-; 1162f2
-
-Function1162f2: ; 1162f2
- call Function11659d
- call Function116758
- call Function1167a6
- ld a, [wc310]
- cp EGG
- ret z
- sla a
- ld c, a
- ld b, 0
- ld hl, Unknown_1168c5
- add hl, bc
- ld a, [hli]
- ld e, a
- ld a, [hl]
- ld d, a
- push de
- pop hl
- ld a, [wc30e]
- ld c, a
- ld a, [wc30f]
- ld b, a
- ld a, [wc314 + 4]
- ld e, a
- ld a, [hli]
- sub e
- ld de, Sprites + $24
-.asm_116321
- push af
- ld a, [hli]
- add b
- ld [de], a
- inc de
- ld a, [hli]
- add c
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- pop af
- dec a
- jr nz, .asm_116321
- call Function116468
- ld a, [wc3f5]
- sla a
- ld c, a
- ld b, 0
- ld hl, Unknown_1168c5
- add hl, bc
- ld a, [hli]
- ld e, a
- ld a, [hl]
- ld d, a
- push de
- pop hl
- ld a, [wc3f1]
- ld c, a
- ld a, [wc3f3]
- ld b, a
- ld a, [wc3f8]
- ld e, a
- ld a, [hli]
- sub e
- ld de, Sprites
-.asm_11635a
- push af
- ld a, [hli]
- add b
- ld [de], a
- inc de
- ld a, [hli]
- add c
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- ld a, [hli]
- ld [de], a
- inc de
- pop af
- dec a
- jr nz, .asm_11635a
- ret
-; 11636e
-
-Function11636e: ; 11636e
- ld a, [rSVBK]
- push af
- ld a, $5
- ld [rSVBK], a
- ld hl, BGPals
- ld de, UnknBGPals
- ld bc, $0040
- call CopyBytes
- pop af
- ld [rSVBK], a
- call SetPalettes
- ld a, [rSVBK]
- push af
- ld a, $1
- ld [rSVBK], a
- ld a, $a0
- ld hl, Sprites
- ld bc, 16 * 4
- call ByteFill
- ld a, $90
- ld [hWY], a
- call UpdateSprites
- pop af
- ld [rSVBK], a
- callba ReloadMapPart
- ld a, $8
- ld [MusicFade], a
- ld a, [wMapMusic]
- ld [MusicFadeIDLo], a
- xor a
- ld [MusicFadeIDHi], a
- xor a
- ld [$c319], a
- ld [wc30d], a
- ret
-; 1163c0
-
-Function1163c0: ; 1163c0
- ld a, [rSVBK]
- push af
- ld a, $1
- ld [rSVBK], a
- ld a, $a0
- ld hl, Sprites
- ld bc, 16 * 4
- call ByteFill
- call DelayFrame
- callba Function14146
- ld b, SCGB_MAPPALS
- call GetSGBLayout
- ld a, [rSVBK]
- push af
- ld a, $5
- ld [rSVBK], a
- ld hl, $c320
- ld de, wd030
- ld bc, $0010
- call CopyBytes
- pop af
- ld [rSVBK], a
- call SetPalettes
- call DelayFrame
- ld a, $90
- ld [hWY], a
- call UpdateSprites
- callba Function14157
- pop af
- ld [rSVBK], a
- callba ReloadMapPart
- ld a, [wLinkMode]
- cp $4
- jr z, .asm_11642a
- ld a, $8
- ld [MusicFade], a
- ld a, [wMapMusic]
- ld [MusicFadeIDLo], a
- xor a
- ld [MusicFadeIDHi], a
- jr .asm_116439
-
-.asm_11642a
- ld a, $8
- ld [MusicFade], a
- ld a, $0
- ld [MusicFadeIDLo], a
- ld a, $0
- ld [MusicFadeIDHi], a
-
-.asm_116439
- xor a
- ld [$c319], a
- ld [wc30d], a
- ret
-; 116441
-
-Function116441: ; 116441
- callba Function17d405
- ld a, $90
- ld [hWY], a
- callba ReloadMapPart
- ld a, $8
- ld [MusicFade], a
- ld a, [wMapMusic]
- ld [MusicFadeIDLo], a
- xor a
- ld [MusicFadeIDHi], a
- xor a
- ld [$c319], a
- ld [wc30d], a
- ret
-; 116468
-
-Function116468: ; 116468
- call Function116567
- ld a, [wc314]
- cp $d
- jr nz, .asm_1164a8
- ld hl, wc30e
- ld a, [hl]
- cp $50
- jr nc, .asm_116484
- ld a, $50
- sub [hl]
- add $50
- ld [wc3f1], a
- jr .asm_11648d
-
-.asm_116484
- sub $50
- ld c, a
- ld a, $50
- sub c
- ld [wc3f1], a
-
-.asm_11648d
- ld hl, wc30f
- ld a, [hl]
- cp $60
- jr nc, .asm_11649e
- ld a, $60
- sub [hl]
- add $60
- ld [wc3f3], a
- ret
-
-.asm_11649e
- sub $60
- ld c, a
- ld a, $60
- sub c
- ld [wc3f3], a
- ret
-
-.asm_1164a8
- ld hl, wc30e
- ld a, $b0
- cp [hl]
- jr nc, .asm_1164b8
- ld a, [wc3f1]
- and a
- jr z, .asm_11650b
- jr .asm_1164f2
-
-.asm_1164b8
- ld a, [wc3f1]
- sub [hl]
- jr nc, .asm_1164c1
- xor $ff
- inc a
-
-.asm_1164c1
- ld b, a
- ld c, $0
- ld a, $5
-.asm_1164c6
- srl b
- rr c
- dec a
- jr nz, .asm_1164c6
- ld a, c
- ld [wc3fa], a
- ld a, b
- ld [wc3f9], a
- ld a, [wc3f1]
- sub [hl]
- jr c, .asm_1164f2
- ld c, $0
- ld a, [wc3fa]
- xor $ff
- add $1
- rl c
- ld [wc3fa], a
- ld a, [wc3f9]
- xor $ff
- add c
- ld [wc3f9], a
-
-.asm_1164f2
- ld a, [wc3f2]
- ld l, a
- ld a, [wc3f1]
- ld h, a
- ld a, [wc3fa]
- ld e, a
- ld a, [wc3f9]
- ld d, a
- add hl, de
- ld a, l
- ld [wc3f2], a
- ld a, h
- ld [wc3f1], a
-
-.asm_11650b
- ld hl, wc30f
- ld a, $b0
- cp [hl]
- jr c, .asm_11654d
- ld a, [wc3f3]
- sub [hl]
- jr nc, .asm_11651c
- xor $ff
- inc a
-
-.asm_11651c
- ld b, a
- ld c, $0
- ld a, $5
-.asm_116521
- srl b
- rr c
- dec a
- jr nz, .asm_116521
- ld a, c
- ld [wc3fc], a
- ld a, b
- ld [wc3fb], a
- ld a, [wc3f3]
- sub [hl]
- jr c, .asm_11654d
- ld c, $0
- ld a, [wc3fc]
- xor $ff
- add $1
- rl c
- ld [wc3fc], a
- ld a, [wc3fb]
- xor $ff
- add c
- ld [wc3fb], a
-
-.asm_11654d
- ld a, [wc3f4]
- ld l, a
- ld a, [wc3f3]
- ld h, a
- ld a, [wc3fc]
- ld e, a
- ld a, [wc3fb]
- ld d, a
- add hl, de
- ld a, l
- ld [wc3f4], a
- ld a, h
- ld [wc3f3], a
- ret
; 116567
Function116567: ; 116567
@@ -6211,6 +5397,7 @@
ld a, [hl]
ld [wc3f7], a
ret
+
; 11659d
Function11659d: ; 11659d
@@ -6227,6 +5414,7 @@
ld h, [hl]
ld l, a
jp [hl]
+
; 1165af
Jumptable_1165af: ; 1165af
@@ -6271,6 +5459,7 @@
call Function116780
ret c
jp Function116797
+
; 1165f5
Function1165f5: ; 1165f5
@@ -6292,6 +5481,7 @@
ld a, $2
ld [wc314], a
ret
+
; 116615
Function116615: ; 116615
@@ -6314,6 +5504,7 @@
call Function116780
ret c
jp Function116797
+
; 116635
Function116635: ; 116635
@@ -6335,6 +5526,7 @@
ld a, $7
ld [wc314], a
ret
+
; 116655
Function116655: ; 116655
@@ -6381,6 +5573,7 @@
ld a, $c
ld [wc314], a
ret
+
; 11669f
Function11669f: ; 11669f
@@ -6429,6 +5622,7 @@
xor a
ld [wc314], a
ret
+
; 1166f4
Function1166f4: ; 1166f4
@@ -6456,6 +5650,7 @@
call Function11679c
call Function116797
ret
+
; 11671f
Function11671f: ; 11671f
@@ -6479,6 +5674,7 @@
call Function11679c
call Function116797
ret
+
; 116747
Function116747: ; 116747
@@ -6491,6 +5687,7 @@
add [hl]
ld [hl], a
ret
+
; 116758
Function116758: ; 116758
@@ -6521,6 +5718,7 @@
.asm_11677a
ld [wc314 + 4], a
ret
+
; 11677e
Function11677e: ; 11677e
@@ -6538,6 +5736,7 @@
.asm_11678c
and a
ret
+
; 11678e
Function11678e: ; 11678e
@@ -6546,6 +5745,7 @@
ld [wc314 + 1], a
inc [hl]
ret
+
; 116797
Function116797: ; 116797
@@ -6552,6 +5752,7 @@
ld hl, wc314
inc [hl]
ret
+
; 11679c
Function11679c:
@@ -6608,6 +5809,7 @@
ld a, [hl]
ld [wc313], a
ret
+
; 1167eb
Unknown_1167eb:
@@ -7654,6 +6856,7 @@
Special_GiveOddEgg: ; 117656
callba GiveOddEgg
ret
+
; 11765d
Function11765d: ; 11765d (45:765d)
@@ -7784,6 +6987,7 @@
jr nz, .asm_11776f
ld a, $1
jr .asm_117770
+
.asm_11776f
xor a
.asm_117770
@@ -7880,6 +7084,7 @@
Function117764_d_vertical_load: ; 117806 (45:7806)
ld [wcd4c], a
ret
+
Function117764_d_down: ; 11780a (45:780a)
ld a, [wcd4d]
cp $4
@@ -7895,9 +7100,11 @@
jr nc, .asm_117829
xor a
jr Function117764_d_vertical_load
+
.asm_117825
ld a, $2
jr Function117764_d_vertical_load
+
.asm_117829
ld a, $1
jr Function117764_d_vertical_load
@@ -7949,6 +7156,7 @@
jr nz, .ascii_symbols
ld hl, Unknown_117a0f
jr .got_ascii
+
.ascii_symbols
ld hl, Unknown_117a47
.got_ascii
@@ -8103,6 +7311,7 @@
ld a, $1
ld [wcd49], a
ret
+
; 1179b5 (45:79b5)
MenuDataHeader_1179b5: ; 1179b5
@@ -8146,6 +7355,7 @@
ld hl, wcd49
inc [hl]
ret
+
; 117a0f (45:7a0f)
Unknown_117a0f:
@@ -8168,6 +7378,7 @@
pop af
ld [hInMenu], a
ret
+
; 0x117a8d
Function117a8d: ; 0x117a8d
@@ -8174,6 +7385,7 @@
call Function117a94
call Function117acd
ret
+
; 0x117a94
Function117a94: ; 0x117a94
@@ -8187,6 +7399,7 @@
callba Function172e78
callba Function104000
ret
+
; 0x117ab4
Function117ab4: ; 0x117ab4
@@ -8196,6 +7409,7 @@
callba Function172eb9
callba ReloadMapPart
ret
+
; 0x117acd
Function117acd: ; 0x117acd
@@ -8206,6 +7420,7 @@
call Function117ae9
callba Function104000
jr Function117acd
+
.asm_117ae2
call ClearBGPalettes
call ClearSprites
@@ -8340,10 +7555,12 @@
ld a, $80
ld [wJumptableIndex], a
ret
+
.asm_117be1
ld a, $80
ld [wJumptableIndex], a
ret
+
.asm_117be7
ld a, [rSVBK]
push af
@@ -8370,6 +7587,7 @@
dec c
jr nz, .asm_117c0b
jr .asm_117c20
+
.asm_117c16
pop af
ld [rSVBK], a
@@ -8376,6 +7594,7 @@
ld a, $d3
ld [wc300], a
jr .asm_117bd0
+
.asm_117c20
pop af
ld [rSVBK], a
--- /dev/null
+++ b/misc/mobile_45_sprite_engine.asm
@@ -1,0 +1,923 @@
+Function115d99: ; 115d99
+ ld de, GFX_11601a
+ ld hl, VTiles0 tile $60
+ lb bc, BANK(GFX_11601a), $14
+ call Get2bpp
+ xor a
+ ld [wc305], a
+ ld [wc306], a
+ ld [wc309], a
+ ld [wc30a], a
+ ld [wc30b], a
+ ld [wc30c], a
+ ld a, $10
+ ld [wc307], a
+ ld a, $18
+ ld [wc308], a
+ ret
+
+; 115dc3
+
+Function115dc3: ; 115dc3
+ xor a
+ ld [wc305], a
+ ld a, $a0
+ ld hl, Sprites + 31 * 4
+ ld bc, 8 * 4
+ call ByteFill
+ ret
+
+; 115dd3
+
+Function115dd3: ; 115dd3
+ ld a, [wc305]
+ and a
+ ret z
+ ld a, $a0
+ ld hl, Sprites + 31 * 4
+ ld bc, 8 * 4
+ call ByteFill
+ call Function115e22
+ ld a, [wc309]
+ sla a
+ ld c, a
+ ld b, 0
+ ld hl, Unknown_115e86
+ add hl, bc
+ ld a, [hli]
+ ld e, a
+ ld a, [hl]
+ ld d, a
+ push de
+ pop hl
+ ld de, Sprites + 31 * 4
+ ld a, [wc307]
+ ld c, a
+ ld a, [wc308]
+ ld b, a
+ ld a, [hli]
+.asm_115e04
+ push af
+ ld a, [hli]
+ add b
+ ld [de], a
+ inc de
+ ld a, [hli]
+ add c
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ pop af
+ dec a
+ jr nz, .asm_115e04
+ ret
+
+; 115e18
+
+Function115e18: ; 115e18
+ ld a, c
+ ld [wc30a], a
+ xor a
+ ld [wc30b], a
+ jr Function115e2b
+
+; 115e22
+
+Function115e22: ; 115e22
+ ld hl, wc30c
+ dec [hl]
+ ret nz
+ ld hl, wc30b
+ inc [hl]
+
+Function115e2b: ; 115e2b
+ ld a, [wc30a]
+ sla a
+ ld c, a
+ ld b, 0
+ ld hl, Unknown_115e59
+ add hl, bc
+ ld a, [hli]
+ ld e, a
+ ld a, [hli]
+ ld d, a
+ push de
+ pop hl
+ ld a, [wc30b]
+ sla a
+ ld c, a
+ ld b, $0
+ add hl, bc
+ ld a, [hli]
+ cp $ff
+ jr nz, .not_end
+ xor a
+ ld [wc30b], a
+ jr Function115e2b
+
+.not_end
+ ld [wc309], a
+ ld a, [hl]
+ ld [wc30c], a
+ ret
+
+; 115e59
+
+Unknown_115e59:
+ dw Unknown_115e61
+ dw Unknown_115e6c
+ dw Unknown_115e76
+ dw Unknown_115e79
+
+; OAM idx (see Unknown_115e86), flip flags/duration
+Unknown_115e61: ; 115e61
+ db $04, $08
+ db $05, $08
+ db $06, $08
+ db $07, $08
+ db $08, $08
+ db -1
+
+Unknown_115e6c: ; 115e6c
+ db $01, $08
+ db $02, $08
+ db $03, $08
+ db $09, $08
+ db $0a, $08
+Unknown_115e76: ; 115e76
+ db $00, $08
+ db -1
+
+Unknown_115e79: ; 115e79
+ db $0b, $08
+ db $0c, $08
+ db $0d, $08
+ db $0e, $08
+ db $0f, $08
+ db $00, $08
+ db -1
+; 115e86
+
+Unknown_115e86:
+ dw Unknown_115ea6
+ dw Unknown_115eb7
+ dw Unknown_115ecc
+ dw Unknown_115ee1
+ dw Unknown_115ef6
+ dw Unknown_115f13
+ dw Unknown_115f30
+ dw Unknown_115f4d
+ dw Unknown_115f6a
+ dw Unknown_115f87
+ dw Unknown_115f9c
+ dw Unknown_115fb1
+ dw Unknown_115fc6
+ dw Unknown_115fdb
+ dw Unknown_115ff0
+ dw Unknown_116005
+
+Unknown_115ea6: ; 115ea6
+ db 4
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_115eb7: ; 115eb7
+ db 5
+ dsprite 0, 0, 1, 0, $64, $00
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_115ecc: ; 115ecc
+ db 5
+ dsprite 0, 0, 1, 0, $65, $00
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_115ee1: ; 115ee1
+ db 5
+ dsprite 0, 0, 1, 0, $66, $00
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_115ef6: ; 115ef6
+ db 7
+ dsprite 0, 0, 0, 0, $67, $01
+ dsprite 1, 0, 0, 0, $68, $01
+ dsprite 2, 0, 0, 0, $6d, $00
+ dsprite 2, 0, 1, 0, $69, $00
+ dsprite 2, 0, 2, 0, $6a, $00
+ dsprite 3, 0, 1, 0, $6b, $00
+ dsprite 3, 0, 2, 0, $6c, $00
+
+Unknown_115f13: ; 115f13
+ db 7
+ dsprite 0, 0, 0, 0, $67, $01
+ dsprite 1, 0, 0, 0, $68, $01
+ dsprite 2, 0, 0, 0, $6e, $00
+ dsprite 2, 0, 1, 0, $69, $00
+ dsprite 2, 0, 2, 0, $6a, $00
+ dsprite 3, 0, 1, 0, $6b, $00
+ dsprite 3, 0, 2, 0, $6c, $00
+
+Unknown_115f30: ; 115f30
+ db 7
+ dsprite 0, 0, 0, 0, $67, $01
+ dsprite 1, 0, 0, 0, $68, $01
+ dsprite 2, 0, 0, 0, $6f, $00
+ dsprite 2, 0, 1, 0, $69, $00
+ dsprite 2, 0, 2, 0, $6a, $00
+ dsprite 3, 0, 1, 0, $6b, $00
+ dsprite 3, 0, 2, 0, $6c, $00
+
+Unknown_115f4d: ; 115f4d
+ db 7
+ dsprite 0, 0, 0, 0, $67, $01
+ dsprite 1, 0, 0, 0, $68, $01
+ dsprite 2, 0, 0, 0, $70, $00
+ dsprite 2, 0, 1, 0, $69, $00
+ dsprite 2, 0, 2, 0, $6a, $00
+ dsprite 3, 0, 1, 0, $6b, $00
+ dsprite 3, 0, 2, 0, $6c, $00
+
+Unknown_115f6a: ; 115f6a
+ db 7
+ dsprite 0, 0, 0, 0, $67, $01
+ dsprite 1, 0, 0, 0, $68, $01
+ dsprite 2, 0, 0, 0, $71, $00
+ dsprite 2, 0, 1, 0, $69, $00
+ dsprite 2, 0, 2, 0, $6a, $00
+ dsprite 3, 0, 1, 0, $6b, $00
+ dsprite 3, 0, 2, 0, $6c, $00
+
+Unknown_115f87: ; 115f87
+ db 5
+ dsprite 0, 0, 1, 0, $72, $00
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_115f9c: ; 115f9c
+ db 5
+ dsprite 0, 0, 1, 0, $73, $00
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_115fb1: ; 115fb1
+ db 5
+ dsprite 0, 1, 1, 0, $64, $60
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_115fc6: ; 115fc6
+ db 5
+ dsprite 0, 1, 1, 0, $65, $60
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_115fdb: ; 115fdb
+ db 5
+ dsprite 0, 1, 1, 0, $66, $60
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_115ff0: ; 115ff0
+ db 5
+ dsprite 0, 1, 1, 0, $72, $60
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+
+Unknown_116005: ; 116005
+ db 5
+ dsprite 0, 1, 1, 0, $73, $60
+ dsprite 1, 0, 0, 0, $60, $01
+ dsprite 1, 0, 1, 0, $61, $01
+ dsprite 2, 0, 0, 0, $62, $01
+ dsprite 2, 0, 1, 0, $63, $01
+; 11601a
+
+GFX_11601a:: ; 11601a
+INCBIN "gfx/unknown/11601a.2bpp"
+
+
+Function11615a: ; 11615a
+ xor a
+ ld [wc30d], a
+ ld [$c319], a
+ ld [wc310], a
+ ld [wc311], a
+ ld [wc312], a
+ ld [wc313], a
+ ld [wc314], a
+ ld [wc314 + 1], a
+ ld [wc314 + 4], a
+ ld [wc3f6], a
+ ld [wc3f8], a
+ ld [wc3f2], a
+ ld [wc3f4], a
+ ld a, $24
+ ld [wc3f5], a
+ ld a, $7
+ ld [wc3f7], a
+ ld a, $b0
+ ld [wc30e], a
+ ld [wc3f1], a
+ ld a, $48
+ ld [wc30f], a
+ ld [wc3f3], a
+ ret
+
+; 11619d
+
+Function11619d: ; 11619d
+ ld a, [wc30d]
+ and a
+ ret z
+ ld a, [$c319]
+ cp $2
+ jr c, .asm_1161b4
+ ld a, $a0
+ ld hl, Sprites
+ ld bc, $0064
+ call ByteFill
+
+.asm_1161b4
+ call Function1161b8
+ ret
+
+; 1161b8
+
+Function1161b8: ; 1161b8
+ ld a, [$c319]
+ ld e, a
+ ld d, 0
+ ld hl, .Jumptable
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+
+; 1161c7
+
+.Jumptable: ; 1161c7
+ dw Function1161d5
+ dw Function116294
+ dw Function1162cb
+ dw Function1162f2
+ dw Function1163c0
+ dw Function11636e
+ dw Function116441
+; 1161d5
+
+Function1161d5: ; 1161d5
+ ld a, [rSVBK]
+ push af
+
+ ld a, $6
+ ld [rSVBK], a
+
+ ld hl, Unknown_117356
+ ld de, wDecompressScratch
+ ld bc, $0300
+ call CopyBytes
+
+ di
+
+.wait_for_vblank
+; Wait until a vblank would occur had interrupts not just been disabled.
+ ld a, [rLY]
+ cp $91
+ jr nz, .wait_for_vblank
+
+ ld a, $d0
+ ld [rHDMA1], a
+ ld a, $0
+ ld [rHDMA2], a
+ ld a, $1c
+ ld [rHDMA3], a
+ xor a
+ ld [rHDMA4], a
+ ld a, $8
+ ld [rHDMA5], a
+
+ ld a, $d0
+ ld [rHDMA1], a
+ ld a, $80
+ ld [rHDMA2], a
+ ld a, $1c
+ ld [rHDMA3], a
+ ld a, $80
+ ld [rHDMA4], a
+ ld a, $8
+ ld [rHDMA5], a
+
+ ld a, $d1
+ ld [rHDMA1], a
+ ld a, $0
+ ld [rHDMA2], a
+ ld a, $1d
+ ld [rHDMA3], a
+ xor a
+ ld [rHDMA4], a
+ ld a, $8
+ ld [rHDMA5], a
+
+ ld a, $1
+ ld [rVBK], a
+
+ ld a, $d1
+ ld [rHDMA1], a
+ ld a, $80
+ ld [rHDMA2], a
+ ld a, $1c
+ ld [rHDMA3], a
+ xor a
+ ld [rHDMA4], a
+ ld a, $8
+ ld [rHDMA5], a
+
+ ld a, $d2
+ ld [rHDMA1], a
+ ld a, $0
+ ld [rHDMA2], a
+ ld a, $1c
+ ld [rHDMA3], a
+ ld a, $80
+ ld [rHDMA4], a
+ ld a, $8
+ ld [rHDMA5], a
+
+ ld a, $d2
+ ld [rHDMA1], a
+ ld a, $80
+ ld [rHDMA2], a
+ ld a, $1d
+ ld [rHDMA3], a
+ xor a
+ ld [rHDMA4], a
+ ld a, $8
+ ld [rHDMA5], a
+
+ xor a
+ ld [rVBK], a
+
+ ei
+
+ pop af
+ ld [rSVBK], a
+
+ callba ReloadMapPart
+ ld a, $8
+ ld [MusicFade], a
+ ld de, MUSIC_MOBILE_ADAPTER
+ ld a, e
+ ld [MusicFadeIDLo], a
+ ld a, d
+ ld [MusicFadeIDHi], a
+ ld a, [$c319]
+ inc a
+ ld [$c319], a
+ ret
+
+; 11628c
+
+MenuDataHeader_11628c: ; 11628c
+ db $40 ; flags
+ db 6, 0 ; start coords
+ db 17, 19 ; end coords
+ dw NULL
+ db 0 ; default option
+; 116294
+
+Function116294: ; 116294
+ callba Function170d02
+ ld a, [$c319]
+ inc a
+ ld [$c319], a
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+ ld hl, UnknBGPals + 8 * 6
+ ld de, $c320
+ ld bc, 2 palettes
+ call CopyBytes
+ ld hl, Palette_11734e
+ ld de, UnknBGPals + 8 * 7
+ ld bc, 1 palettes
+ call CopyBytes
+ call SetPalettes
+ pop af
+ ld [rSVBK], a
+ ld a, $30
+ ld [hWY], a
+ ret
+
+; 1162cb
+
+Function1162cb: ; 1162cb
+ callba Function170cc6
+ ld a, [$c319]
+ inc a
+ ld [$c319], a
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+ ld hl, Palette_11730e
+ ld de, UnknOBPals + 2 palettes
+ ld bc, 6 palettes
+ call CopyBytes
+ call SetPalettes
+ pop af
+ ld [rSVBK], a
+ ret
+
+; 1162f2
+
+Function1162f2: ; 1162f2
+ call Function11659d
+ call Function116758
+ call Function1167a6
+ ld a, [wc310]
+ cp EGG
+ ret z
+ sla a
+ ld c, a
+ ld b, 0
+ ld hl, Unknown_1168c5
+ add hl, bc
+ ld a, [hli]
+ ld e, a
+ ld a, [hl]
+ ld d, a
+ push de
+ pop hl
+ ld a, [wc30e]
+ ld c, a
+ ld a, [wc30f]
+ ld b, a
+ ld a, [wc314 + 4]
+ ld e, a
+ ld a, [hli]
+ sub e
+ ld de, Sprites + $24
+.asm_116321
+ push af
+ ld a, [hli]
+ add b
+ ld [de], a
+ inc de
+ ld a, [hli]
+ add c
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ pop af
+ dec a
+ jr nz, .asm_116321
+ call Function116468
+ ld a, [wc3f5]
+ sla a
+ ld c, a
+ ld b, 0
+ ld hl, Unknown_1168c5
+ add hl, bc
+ ld a, [hli]
+ ld e, a
+ ld a, [hl]
+ ld d, a
+ push de
+ pop hl
+ ld a, [wc3f1]
+ ld c, a
+ ld a, [wc3f3]
+ ld b, a
+ ld a, [wc3f8]
+ ld e, a
+ ld a, [hli]
+ sub e
+ ld de, Sprites
+.asm_11635a
+ push af
+ ld a, [hli]
+ add b
+ ld [de], a
+ inc de
+ ld a, [hli]
+ add c
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, [hli]
+ ld [de], a
+ inc de
+ pop af
+ dec a
+ jr nz, .asm_11635a
+ ret
+
+; 11636e
+
+Function11636e: ; 11636e
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+ ld hl, BGPals
+ ld de, UnknBGPals
+ ld bc, $0040
+ call CopyBytes
+ pop af
+ ld [rSVBK], a
+ call SetPalettes
+ ld a, [rSVBK]
+ push af
+ ld a, $1
+ ld [rSVBK], a
+ ld a, $a0
+ ld hl, Sprites
+ ld bc, 16 * 4
+ call ByteFill
+ ld a, $90
+ ld [hWY], a
+ call UpdateSprites
+ pop af
+ ld [rSVBK], a
+ callba ReloadMapPart
+ ld a, $8
+ ld [MusicFade], a
+ ld a, [wMapMusic]
+ ld [MusicFadeIDLo], a
+ xor a
+ ld [MusicFadeIDHi], a
+ xor a
+ ld [$c319], a
+ ld [wc30d], a
+ ret
+
+; 1163c0
+
+Function1163c0: ; 1163c0
+ ld a, [rSVBK]
+ push af
+ ld a, $1
+ ld [rSVBK], a
+ ld a, $a0
+ ld hl, Sprites
+ ld bc, 16 * 4
+ call ByteFill
+ call DelayFrame
+ callba Function14146
+ ld b, SCGB_MAPPALS
+ call GetSGBLayout
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+ ld hl, $c320
+ ld de, wd030
+ ld bc, $0010
+ call CopyBytes
+ pop af
+ ld [rSVBK], a
+ call SetPalettes
+ call DelayFrame
+ ld a, $90
+ ld [hWY], a
+ call UpdateSprites
+ callba Function14157
+ pop af
+ ld [rSVBK], a
+ callba ReloadMapPart
+ ld a, [wLinkMode]
+ cp $4
+ jr z, .asm_11642a
+ ld a, $8
+ ld [MusicFade], a
+ ld a, [wMapMusic]
+ ld [MusicFadeIDLo], a
+ xor a
+ ld [MusicFadeIDHi], a
+ jr .asm_116439
+
+.asm_11642a
+ ld a, $8
+ ld [MusicFade], a
+ ld a, $0
+ ld [MusicFadeIDLo], a
+ ld a, $0
+ ld [MusicFadeIDHi], a
+
+.asm_116439
+ xor a
+ ld [$c319], a
+ ld [wc30d], a
+ ret
+
+; 116441
+
+Function116441: ; 116441
+ callba Function17d405
+ ld a, $90
+ ld [hWY], a
+ callba ReloadMapPart
+ ld a, $8
+ ld [MusicFade], a
+ ld a, [wMapMusic]
+ ld [MusicFadeIDLo], a
+ xor a
+ ld [MusicFadeIDHi], a
+ xor a
+ ld [$c319], a
+ ld [wc30d], a
+ ret
+
+; 116468
+
+Function116468: ; 116468
+ call Function116567
+ ld a, [wc314]
+ cp $d
+ jr nz, .asm_1164a8
+ ld hl, wc30e
+ ld a, [hl]
+ cp $50
+ jr nc, .asm_116484
+ ld a, $50
+ sub [hl]
+ add $50
+ ld [wc3f1], a
+ jr .asm_11648d
+
+.asm_116484
+ sub $50
+ ld c, a
+ ld a, $50
+ sub c
+ ld [wc3f1], a
+
+.asm_11648d
+ ld hl, wc30f
+ ld a, [hl]
+ cp $60
+ jr nc, .asm_11649e
+ ld a, $60
+ sub [hl]
+ add $60
+ ld [wc3f3], a
+ ret
+
+.asm_11649e
+ sub $60
+ ld c, a
+ ld a, $60
+ sub c
+ ld [wc3f3], a
+ ret
+
+.asm_1164a8
+ ld hl, wc30e
+ ld a, $b0
+ cp [hl]
+ jr nc, .asm_1164b8
+ ld a, [wc3f1]
+ and a
+ jr z, .asm_11650b
+ jr .asm_1164f2
+
+.asm_1164b8
+ ld a, [wc3f1]
+ sub [hl]
+ jr nc, .asm_1164c1
+ xor $ff
+ inc a
+
+.asm_1164c1
+ ld b, a
+ ld c, $0
+ ld a, $5
+.asm_1164c6
+ srl b
+ rr c
+ dec a
+ jr nz, .asm_1164c6
+ ld a, c
+ ld [wc3fa], a
+ ld a, b
+ ld [wc3f9], a
+ ld a, [wc3f1]
+ sub [hl]
+ jr c, .asm_1164f2
+ ld c, $0
+ ld a, [wc3fa]
+ xor $ff
+ add $1
+ rl c
+ ld [wc3fa], a
+ ld a, [wc3f9]
+ xor $ff
+ add c
+ ld [wc3f9], a
+
+.asm_1164f2
+ ld a, [wc3f2]
+ ld l, a
+ ld a, [wc3f1]
+ ld h, a
+ ld a, [wc3fa]
+ ld e, a
+ ld a, [wc3f9]
+ ld d, a
+ add hl, de
+ ld a, l
+ ld [wc3f2], a
+ ld a, h
+ ld [wc3f1], a
+
+.asm_11650b
+ ld hl, wc30f
+ ld a, $b0
+ cp [hl]
+ jr c, .asm_11654d
+ ld a, [wc3f3]
+ sub [hl]
+ jr nc, .asm_11651c
+ xor $ff
+ inc a
+
+.asm_11651c
+ ld b, a
+ ld c, $0
+ ld a, $5
+.asm_116521
+ srl b
+ rr c
+ dec a
+ jr nz, .asm_116521
+ ld a, c
+ ld [wc3fc], a
+ ld a, b
+ ld [wc3fb], a
+ ld a, [wc3f3]
+ sub [hl]
+ jr c, .asm_11654d
+ ld c, $0
+ ld a, [wc3fc]
+ xor $ff
+ add $1
+ rl c
+ ld [wc3fc], a
+ ld a, [wc3fb]
+ xor $ff
+ add c
+ ld [wc3fb], a
+
+.asm_11654d
+ ld a, [wc3f4]
+ ld l, a
+ ld a, [wc3f3]
+ ld h, a
+ ld a, [wc3fc]
+ ld e, a
+ ld a, [wc3fb]
+ ld d, a
+ add hl, de
+ ld a, l
+ ld [wc3f4], a
+ ld a, h
+ ld [wc3f3], a
+ ret
--- a/wram.asm
+++ b/wram.asm
@@ -308,7 +308,7 @@
wGlobalAnimXOffset:: ds 1
wSpriteAnimsEnd::
-wc3c1:: ds 11
+ ds 11
wc3cc:: ds 1
wc3cd:: ds 31
wc3ec:: ds 1
@@ -373,19 +373,21 @@
wMisc:: ; ds (SCREEN_WIDTH + 4) * (SCREEN_HEIGHT + 2)
wBattle::
wc608::
+ ds 7
+wc60f::
+ ds 3
+wc612::
+ ds 10
+wInitHourBuffer:: ; c61c
+ ds 10
+wc626::
+ ds wc608 - @
wEnemyMoveStruct:: move_struct wEnemyMoveStruct
-wc60f::
wPlayerMoveStruct:: move_struct wPlayerMoveStruct
-wc616::
- ds -4
-wc612:: ds 4
+
EnemyMonNick:: ds PKMN_NAME_LENGTH ; c616
- ds -5
-wInitHourBuffer:: ds 5
BattleMonNick:: ds PKMN_NAME_LENGTH ; c621
- ds -6
-wc626:: ds 6
BattleMon:: battle_struct BattleMon ; c62c
@@ -637,10 +639,9 @@
wPayDayMoney:: ds 3 ; c6ec
wSafariMonAngerCount:: ds 1
-wSafariMonEating::
-wc6f0:: ds 2
+wSafariMonEating:: ds 2
wEnemyBackupDVs:: ; used when enemy is transformed
-wc6f2:: ds 2
+ ds 2
AlreadyDisobeyed:: ; c6f4
ds 1
@@ -2763,15 +2764,12 @@
wdc0e:: ds 1
; Sprite id of each decoration
-wdc0f::
Bed:: ; dc0f
ds 1
Carpet:: ; dc10
ds 1
-wdc11::
Plant:: ; dc11
ds 1
-wdc12::
Poster:: ; dc12
ds 1
Console:: ; dc13
@@ -2810,8 +2808,8 @@
wLuckyNumberDayBuffer:: ds 2
ds 2
-wSpecialPhoneCallID:: ds 2
-wdc33:: ds 2
+wSpecialPhoneCallID:: ds 1
+ ds 3
wBugContestStartTime:: ds 4 ; day, hour, min, sec
wdc39:: ds 1
wUnusedTwoDayTimer:: ds 1