diff --git a/main.asm b/main.asm index 9fbe197ba..1da851561 100644 --- a/main.asm +++ b/main.asm @@ -81634,7 +81634,19 @@ INCLUDE "engine/title.asm" INCLUDE "misc/mobile_45.asm" +INCLUDE "misc/mobile_46.asm" +SECTION "bank47", ROMX, BANK[$47] + +INCLUDE "misc/battle_tower_47.asm" + +SECTION "bank5B", ROMX, BANK[$5B] + +INCLUDE "misc/mobile_5b.asm" + +SECTION "bank5C", ROMX, BANK[$5C] + +INCLUDE "misc/mobile_5c.asm" SECTION "bank5D", ROMX, BANK[$5D] diff --git a/misc/battle_tower_47.asm b/misc/battle_tower_47.asm index 54cb2d10a..d66525916 100755 --- a/misc/battle_tower_47.asm +++ b/misc/battle_tower_47.asm @@ -4869,2989 +4869,3 @@ BTLossF15: ; 0x11f67c BTWinF15: ; 0x11f681 text_jump UnknownText_0x1ecee8 db "@" - - -SECTION "bank5B", ROMX, BANK[$5B] - -Function16c000: ; 16c000 - ld a, [hCGB] - and a - ret z - ld a, [$ffea] - and a - ret z - ld a, [wcfbe] - push af - set 7, a - ld [wcfbe], a - call Function16c108 - callba Function100063 - callba Function100082 - call Function16c031 - callba Function1000a4 - xor a - ld [$ffea], a - pop af - ld [wcfbe], a - ret -; 16c031 - -Function16c031: ; 16c031 - xor a - ld [wJumptableIndex], a - ld [wcf64], a - ld [DefaultFlypoint], a - ld [wd003], a -.asm_16c03e - call DelayFrame - callba Function10635c - ld a, [DefaultFlypoint] - ld hl, Jumptable_16c05c - rst JumpTable - call Function16cb2e - call Function16cbae - ld a, [DefaultFlypoint] - cp $ff - jr nz, .asm_16c03e - ret -; 16c05c - -Jumptable_16c05c: ; 16c05c - dw Function16c074 - dw Function16c0ba - dw Function16c089 - dw Function16c09e - dw Function16c0a8 - dw Function16c0dc - dw Function16c0ec - dw Function16c0ba - dw Function16c0ca - dw Function16c0dc - dw Function16c0ec - dw Function16c081 -; 16c074 - -Function16c074: ; 16c074 - ld a, [wcf64] - and a - ret z - ld [DefaultFlypoint], a - xor a - ld [wd003], a - ret -; 16c081 - -Function16c081: ; 16c081 - push af - ld a, $ff - ld [DefaultFlypoint], a - pop af - ret -; 16c089 - -Function16c089: ; 16c089 - ld a, $1 - ld [Buffer2], a - ld [wd1f1], a - xor a - ld [hWY], a - call Function16c0fa - ld a, [DefaultFlypoint] - ld [wcf64], a - ret -; 16c09e - -Function16c09e: ; 16c09e - ld a, [wcf64] - cp $4 - ret nz - call Function16c0fa - ret -; 16c0a8 - -Function16c0a8: ; 16c0a8 - xor a - ld [Buffer2], a - ld [wd1f1], a - call ClearSprites - ld a, $90 - ld [hWY], a - call Function16c0fa - ret -; 16c0ba - -Function16c0ba: ; 16c0ba - call Function16c943 - push af - ld a, [wd003] - inc a - ld [wd003], a - pop af - call c, Function16c0fa - ret -; 16c0ca - -Function16c0ca: ; 16c0ca - ld a, [wd003] - cp $28 - push af - ld a, [wd003] - inc a - ld [wd003], a - pop af - call z, Function16c0fa - ret -; 16c0dc - -Function16c0dc: ; 16c0dc - call Function16ca11 - push af - ld a, [wd003] - inc a - ld [wd003], a - pop af - call c, Function16c0fa - ret -; 16c0ec - -Function16c0ec: ; 16c0ec - call WhiteBGMap - call ClearScreen - push af - ld a, $ff - ld [DefaultFlypoint], a - pop af - ret -; 16c0fa - -Function16c0fa: ; 16c0fa - push af - ld a, [DefaultFlypoint] - inc a - ld [DefaultFlypoint], a - xor a - ld [wd003], a - pop af - ret -; 16c108 - -Function16c108: ; 16c108 - call DisableLCD - ld hl, VTiles2 - ld de, GFX_16c173 - lb bc, BANK(GFX_16c173), $68 - call Get2bpp - call Function16c130 - call Function16c145 - call Function16c15c - ld hl, VBGMap0 - call Function16cc73 - call Function16cc02 - xor a - ld [hBGMapMode], a - call EnableLCD - ret -; 16c130 - -Function16c130: ; 16c130 - ld de, Unkn1Pals - ld hl, Unknown_16c903 - ld bc, 8 - ld a, $5 - call FarCopyWRAM - callba Function96a4 - ret -; 16c145 - -Function16c145: ; 16c145 - hlcoord 0, 0 - ld bc, 20 - xor a - call ByteFill - ld hl, Tilemap_16c633 - decoord 0, 1 - ld bc, $0154 - call CopyBytes - ret -; 16c15c - -Function16c15c: ; 16c15c - hlcoord 0, 0, AttrMap - ld bc, SCREEN_WIDTH - xor a - call ByteFill - ld hl, Tilemap_16c79b - decoord 0, 1, AttrMap - ld bc, 17 * SCREEN_WIDTH - call CopyBytes - ret -; 16c173 - -GFX_16c173: -INCBIN "gfx/unknown/16c173.2bpp" - -Tilemap_16c633: -INCBIN "gfx/unknown/16c633.tilemap" - -Tilemap_16c79b: -INCBIN "gfx/unknown/16c79b.tilemap" - -Unknown_16c903: - RGB 31, 31, 31 - RGB 04, 10, 20 - RGB 16, 19, 25 - RGB 25, 27, 29 - - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 31, 31, 31 - -; 16c943 - -Function16c943: ; 16c943 - ld a, [wd003] - and a - jr nz, .asm_16c95e - ld a, [rSVBK] - push af - ld a, $5 - ld [rSVBK], a - ld a, $ff - ld bc, $0008 - ld hl, Unkn1Pals - call ByteFill - pop af - ld [rSVBK], a - -.asm_16c95e - ld a, [rSVBK] - push af - ld a, $5 - ld [rSVBK], a - ld e, $0 - ld a, $0 -.asm_16c969 - ld hl, Unknown_16c903 - call Function16cab6 - call Function16cabb - ld d, a - ld hl, Unkn1Pals - call Function16cab6 - call Function16cabb - cp d - jr z, .asm_16c991 - ld b, $1 -.asm_16c981 - dec a - cp d - jr z, .asm_16c988 - dec b - jr nz, .asm_16c981 - -.asm_16c988 - ld hl, Unkn1Pals - call Function16cab6 - call Function16cadc - -.asm_16c991 - ld hl, Unknown_16c903 - call Function16cab6 - call Function16cad8 - ld d, a - ld hl, Unkn1Pals - call Function16cab6 - call Function16cad8 - cp d - jr z, .asm_16c9b9 - ld b, $1 -.asm_16c9a9 - dec a - cp d - jr z, .asm_16c9b0 - dec b - jr nz, .asm_16c9a9 - -.asm_16c9b0 - ld hl, Unkn1Pals - call Function16cab6 - call Function16cb08 - -.asm_16c9b9 - ld hl, Unknown_16c903 - call Function16cab6 - call Function16cac4 - ld d, a - ld hl, Unkn1Pals - call Function16cab6 - call Function16cac4 - cp d - jr z, .asm_16c9e1 - ld b, $1 -.asm_16c9d1 - dec a - cp d - jr z, .asm_16c9d8 - dec b - jr nz, .asm_16c9d1 - -.asm_16c9d8 - ld hl, Unkn1Pals - call Function16cab6 - call Function16cae8 - -.asm_16c9e1 -rept 2 - inc e -endr - ld a, e - cp $8 - jr nz, .asm_16c969 - callba Function96a4 - call SetPalettes - ld a, [rSVBK] - push af - ld a, $1 - ld [rSVBK], a - ld a, [wd003] - cp $1f - jr z, .asm_16ca09 - pop af - ld [rSVBK], a - ld e, $0 - pop af - ld [rSVBK], a - and a - ret - -.asm_16ca09 - pop af - ld [rSVBK], a - pop af - ld [rSVBK], a - scf - ret -; 16ca11 - -Function16ca11: ; 16ca11 - ld a, [wd003] - and a - jr nz, .asm_16ca1d - callba Function96a4 - -.asm_16ca1d - ld a, [rSVBK] - push af - ld a, $5 - ld [rSVBK], a - ld e, $0 - ld a, $0 -.asm_16ca28 - ld hl, Unkn1Pals - call Function16cab6 - call Function16cabb - cp $1f - jr z, .asm_16ca48 - ld b, $1 -.asm_16ca37 - inc a - cp $1f - jr z, .asm_16ca3f - dec b - jr nz, .asm_16ca37 - -.asm_16ca3f - ld hl, Unkn1Pals - call Function16cab6 - call Function16cadc - -.asm_16ca48 - ld hl, Unkn1Pals - call Function16cab6 - call Function16cad8 - cp $1f - jr z, .asm_16ca68 - ld b, $1 -.asm_16ca57 - inc a - cp $1f - jr z, .asm_16ca5f - dec b - jr nz, .asm_16ca57 - -.asm_16ca5f - ld hl, Unkn1Pals - call Function16cab6 - call Function16cb08 - -.asm_16ca68 - ld hl, Unkn1Pals - call Function16cab6 - call Function16cac4 - cp $1f - jr z, .asm_16ca88 - ld b, $1 -.asm_16ca77 - inc a - cp $1f - jr z, .asm_16ca7f - dec b - jr nz, .asm_16ca77 - -.asm_16ca7f - ld hl, Unkn1Pals - call Function16cab6 - call Function16cae8 - -.asm_16ca88 -rept 2 - inc e -endr - ld a, e - cp $8 - jr nz, .asm_16ca28 - callba Function96a4 - call SetPalettes - ld a, [rSVBK] - push af - ld a, $1 - ld [rSVBK], a - ld a, [wd003] - cp $1f - jr z, .asm_16caae - pop af - ld [rSVBK], a - pop af - ld [rSVBK], a - and a - ret - -.asm_16caae - pop af - ld [rSVBK], a - pop af - ld [rSVBK], a - scf - ret -; 16cab6 - -Function16cab6: ; 16cab6 - ld b, $0 - ld c, e - add hl, bc - ret -; 16cabb - -Function16cabb: ; 16cabb - inc hl - ld a, [hl] - srl a - srl a - and $1f - ret -; 16cac4 - -Function16cac4: ; 16cac4 - inc hl - ld a, [hld] - and $3 - ld b, a - ld a, [hl] - sla a - rl b - sla a - rl b - sla a - rl b - ld a, b - ret -; 16cad8 - -Function16cad8: ; 16cad8 - ld a, [hl] - and $1f - ret -; 16cadc - -Function16cadc: ; 16cadc - sla a - sla a - ld b, a - inc hl - ld a, [hl] - and $83 - or b - ld [hl], a - ret -; 16cae8 - -Function16cae8: ; 16cae8 - ld c, a - srl a - srl a - srl a - ld b, a - inc hl - ld a, [hl] - and $fc - or b - ld [hld], a - ld a, c - sla a - sla a - sla a - sla a - sla a - ld b, a - ld a, [hl] - and $1f - or b - ld [hl], a - ret -; 16cb08 - -Function16cb08: ; 16cb08 - ld b, a - ld a, [hl] - and $e0 - or b - ld [hl], a - ret -; 16cb0f - -Function16cb0f: ; 16cb0f - xor a - ld [Buffer1], a - ld [Buffer2], a - xor a - ld [wd1ec], a - ld a, $70 - ld [wd1ee], a - ld a, $4 - ld [wd1ed], a - ld a, $a0 - ld [wd1ef], a - xor a - ld [wd1f0], a - ret -; 16cb2e - -Function16cb2e: ; 16cb2e - ld a, [Buffer2] - and a - ret z - call Function16cb40 - ld hl, Unknown_16cb86 - ld de, Sprites - call Function16cb5d - ret -; 16cb40 - -Function16cb40: ; 16cb40 - ld hl, wd1ec - inc [hl] - ld a, [hl] - cp $18 - ret c - xor a - ld [hl], a - ld a, [wd1ef] - cp $a0 - jr nz, .asm_16cb57 - ld a, $a7 - ld [wd1ef], a - ret - -.asm_16cb57 - ld a, $a0 - ld [wd1ef], a - ret -; 16cb5d - -Function16cb5d: ; 16cb5d - ld a, [hli] - and a - ret z -.asm_16cb60 - push af - ld a, [wd1ee] - add [hl] - add $10 - ld [de], a - inc hl - inc de - ld a, [wd1ed] - add [hl] - add $8 - ld [de], a - inc hl - inc de - ld a, [wd1ef] - add [hl] - ld [de], a - inc hl - inc de - ld a, [wd1f0] - or [hl] - ld [de], a - inc hl - inc de - pop af - dec a - jr nz, .asm_16cb60 - ret -; 16cb86 - -Unknown_16cb86: - db 7 - db 0, 0, 0, 1 - db 8, 0, 1, 1 - db 8, 8, 2, 0 - db 8, 16, 3, 0 - db 16, 0, 4, 1 - db 16, 8, 5, 0 - db 16, 16, 6, 0 -; 16cba3 - -Function16cba3: ; 16cba3 - xor a - ld [wd1f1], a - ld [wd1f2], a - ld [wd1f3], a - ret -; 16cbae - -Function16cbae: ; 16cbae - ld a, [wd1f1] - and a - ret z - call Function16cbba - call Function16cbd1 - ret -; 16cbba - -Function16cbba: ; 16cbba - ld hl, wd1f2 - inc [hl] - ld a, [hl] - cp $c - ret c - xor a - ld [hl], a - ld a, [wd1f3] - inc a - cp $4 - jr c, .asm_16cbcd - xor a - -.asm_16cbcd - ld [wd1f3], a - ret -; 16cbd1 - -Function16cbd1: ; 16cbd1 - ld a, [wd1f3] - ld c, a - ld b, 0 - ld hl, Unknown_16cbfb - add hl, bc - ld a, [hl] - ld bc, $0002 - ld hl, Unknown_16cfa3 - call AddNTimes - ld de, wd00c - ld bc, $0002 - ld a, $5 - call FarCopyWRAM - callba Function96a4 - ld a, $1 - ld [hCGBPalUpdate], a - ret -; 16cbfb - -Unknown_16cbfb: - db 0, 1, 2, 1, 0, 1, 2 -; 16cc02 - -Function16cc02: ; 16cc02 - call Function16cc18 - call Function16cc49 - call Function16cc62 - call Function16cc25 - call Function16cc6e - call Function16cb0f - call Function16cba3 - ret -; 16cc18 - -Function16cc18: ; 16cc18 - ld hl, VTiles1 - ld de, GFX_16cca3 - lb bc, BANK(GFX_16cca3), $2e - call Get2bpp - ret -; 16cc25 - -Function16cc25: ; 16cc25 - ld hl, Unknown_16cfa9 - ld de, wd008 - call Function16cc41 - ld hl, Unknown_16cfb1 - ld de, Unkn2Pals - call Function16cc41 - ld hl, Unknown_16cfb9 - ld de, wd048 - call Function16cc41 - ret -; 16cc41 - -Function16cc41: ; 16cc41 - ld bc, $0008 - ld a, $5 - jp FarCopyWRAM -; 16cc49 - -Function16cc49: ; 16cc49 - hlcoord 4, 15 - ld a, $80 - call Function16cc5a - hlcoord 4, 16 - ld a, $90 - call Function16cc5a - ret -; 16cc5a - -Function16cc5a: ; 16cc5a - ld c, $10 -.asm_16cc5c - ld [hli], a - inc a - dec c - jr nz, .asm_16cc5c - ret -; 16cc62 - -Function16cc62: ; 16cc62 - hlcoord 0, 15, AttrMap - ld bc, $0028 - ld a, $1 - call ByteFill - ret -; 16cc6e - -Function16cc6e: ; 16cc6e - ld hl, VBGMap1 - jr Function16cc73 - -Function16cc73: - ld a, [rVBK] - push af - ld a, $0 - ld [rVBK], a - push hl - decoord 0, 0 - call Function16cc90 - pop hl - ld a, $1 - ld [rVBK], a - decoord 0, 0, AttrMap - call Function16cc90 - pop af - ld [rVBK], a - ret -; 16cc90 - -Function16cc90: ; 16cc90 - ld bc, $1214 -.asm_16cc93 - push bc -.asm_16cc94 - ld a, [de] - inc de - ld [hli], a - dec c - jr nz, .asm_16cc94 - ld bc, $000c - add hl, bc - pop bc - dec b - jr nz, .asm_16cc93 - ret -; 16cca3 - -GFX_16cca3: -INCBIN "gfx/unknown/16cca3.2bpp" - -Unknown_16cfa3: - RGB 31, 31, 31 - RGB 25, 27, 29 - RGB 16, 19, 25 - -Unknown_16cfa9: - RGB 31, 31, 31 - RGB 25, 27, 29 - RGB 31, 31, 31 - RGB 07, 07, 07 - - -Unknown_16cfb1: - RGB 31, 31, 31 - RGB 13, 09, 18 - RGB 26, 21, 16 - RGB 07, 07, 07 - - -Unknown_16cfb9: - RGB 31, 31, 31 - RGB 18, 05, 02 - RGB 27, 11, 12 - RGB 07, 07, 07 - -; 16cfc1 - -GFX_16cfc1: -INCBIN "gfx/unknown/16cfc1.2bpp" - -Function16d421: ; 16d421 - ld de, GFX_16cfc1 - ld hl, VTiles2 - lb bc, BANK(GFX_16cfc1), $46 - call Get2bpp - ret -; 16d42e - -Function16d42e: ; 16d42e - ld hl, Tilemap_16d465 - decoord 0, 0 - ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - call CopyBytes - ret -; 16d43b - -Function16d43b: ; 16d43b - call LoadMenuDataHeader_0x1d75 - call WhiteBGMap - call ClearTileMap - call ClearSprites - callba Function16d421 - callba Function16d42e - ld b, $8 - call GetSGBLayout - call SetPalettes - call WaitBGMap - call JoyWaitAorB - call Call_ExitMenu - ret -; 16d465 - -Tilemap_16d465: -INCBIN "gfx/unknown/16d465.tilemap" - -Tilemap_16d5cd: -INCBIN "gfx/unknown/16d5cd.tilemap" - -Tilemap_16d5f5: -INCBIN "gfx/unknown/16d5f5.tilemap" - -Function16d61d: ; 16d61d - ld h, d - ld l, e - push bc - push hl - call Function16d640 - pop hl - pop bc - ld de, AttrMap - TileMap - add hl, de -rept 2 - inc b -endr -rept 2 - inc c -endr - ld a, $7 -.asm_16d630 - push bc - push hl -.asm_16d632 - ld [hli], a - dec c - jr nz, .asm_16d632 - pop hl - ld de, $0014 - add hl, de - pop bc - dec b - jr nz, .asm_16d630 - ret -; 16d640 - -Function16d640: ; 16d640 - push hl - ld a, $30 - ld [hli], a - inc a - call Function16d66d - inc a - ld [hl], a - pop hl - ld de, $0014 - add hl, de -.asm_16d64f - push hl - ld a, $33 - ld [hli], a - ld a, $7f - call Function16d66d - ld [hl], $34 - pop hl - ld de, $0014 - add hl, de - dec b - jr nz, .asm_16d64f - ld a, $35 - ld [hli], a - ld a, $36 - call Function16d66d - ld [hl], $37 - ret -; 16d66d - -Function16d66d: ; 16d66d - ld d, c -.asm_16d66e - ld [hli], a - dec d - jr nz, .asm_16d66e - ret -; 16d673 - -Function16d673: ; 16d673 - call Function16d696 - call Function16d6ae - callba Function49856 - callba Functionfb60d - hlcoord 10, 17 - ld de, String_16d68f - call PlaceString - ret -; 16d68f - -String_16d68f: ; 16d68f - db "CANCEL@" -; 16d696 - -Function16d696: ; 16d696 - call Function16d421 - ret -; 16d69a - - -Function16d69a: ; 16d69a - ld de, GFX_16cfc1 + $300 - ld hl, VTiles2 tile $76 - lb bc, BANK(GFX_16cfc1), 8 - call Get2bpp - ret -; 16d6a7 - -Function16d6a7: ; 16d6a7 - callba Function49811 - ret -; 16d6ae - -Function16d6ae: ; 16d6ae - call Function16d42e - ld hl, Tilemap_16d5cd - decoord 0, 0 - ld bc, $0028 - call CopyBytes - ld hl, Tilemap_16d5f5 - decoord 0, 16 - ld bc, $0028 - call CopyBytes - ret -; 16d6ca - -Function16d6ca: ; 16d6ca - call Function16d61d - ret -; 16d6ce - -Function16d6ce: ; 16d6ce - call LoadMenuDataHeader_0x1d75 - call Function16d6e1 - callba Function87d - call Call_ExitMenu - call Function3200 - ret -; 16d6e1 - -Function16d6e1: ; 16d6e1 - hlcoord 4, 10 - ld b, $1 - ld c, $a - predef Function28eef - hlcoord 5, 11 - ld de, String_16d701 - call PlaceString - call WaitBGMap - call Function3200 - ld c, $32 - jp DelayFrames -; 16d701 - -String_16d701: ; 16d701 - db "WAITING..!@" -; 16d70c - -Function16d70c: ; 16d70c - call Function16d725 - call Function16d713 - ret -; 16d713 - -Function16d713: ; 16d713 - push bc - push af - ld a, [hJoyLast] - and $f0 - ld b, a - ld a, [hJoyPressed] - and $f - or b - ld b, a - pop af - ld a, b - pop bc - ld d, a - ret -; 16d725 - -Function16d725: ; 16d725 - ld hl, wcfa6 - res 7, [hl] - ld a, [hBGMapMode] - push af - call Function16d734 - pop af - ld [hBGMapMode], a - ret -; 16d734 - -Function16d734: ; 16d734 -.asm_16d734 - call Function16d77a - call Function16d759 - call Function16d76a - jr nc, .asm_16d758 - callba Function24270 - jr c, .asm_16d758 - ld a, [wcfa5] - bit 7, a - jr nz, .asm_16d758 - call Function16d713 - ld b, a - ld a, [wcfa8] - and b - jr z, .asm_16d734 - -.asm_16d758 - ret -; 16d759 - -Function16d759: ; 16d759 - ld a, [hOAMUpdate] - push af - ld a, $1 - ld [hOAMUpdate], a - call WaitBGMap - pop af - ld [hOAMUpdate], a - xor a - ld [hBGMapMode], a - ret -; 16d76a - -Function16d76a: ; 16d76a -.asm_16d76a - call RTC - call Function16d7e7 - ret c - ld a, [wcfa5] - bit 7, a - jr z, .asm_16d76a - and a - ret -; 16d77a - -Function16d77a: ; 16d77a - ld hl, wcfac - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [hl] - cp $1f - jr nz, .asm_16d792 - ld a, [wcfab] - ld [hl], a - push hl - push bc - ld bc, $000b - add hl, bc - ld [hl], a - pop bc - pop hl - -.asm_16d792 - ld a, [wcfa1] - ld b, a - ld a, [wcfa2] - ld c, a - call GetTileCoord - ld a, [wcfa7] - swap a - and $f - ld c, a - ld a, [wcfa9] - ld b, a - xor a - dec b - jr z, .asm_16d7b1 -.asm_16d7ad - add c - dec b - jr nz, .asm_16d7ad - -.asm_16d7b1 - ld c, $14 - call AddNTimes - ld a, [wcfa7] - and $f - ld c, a - ld a, [wcfaa] - ld b, a - xor a - dec b - jr z, .asm_16d7c8 -.asm_16d7c4 - add c - dec b - jr nz, .asm_16d7c4 - -.asm_16d7c8 - ld c, a - add hl, bc - ld a, [hl] - cp $1f - jr z, .asm_16d7de - ld [wcfab], a - ld [hl], $1f - push hl - push bc - ld bc, $000b - add hl, bc - ld [hl], $1f - pop bc - pop hl - -.asm_16d7de - ld a, l - ld [wcfac], a - ld a, h - ld [wcfad], a - ret -; 16d7e7 - -Function16d7e7: ; 16d7e7 - ld a, [wcfa5] - bit 6, a - jr z, .asm_16d7f4 - callba Function8cf62 - -.asm_16d7f4 - call JoyTextDelay - call Function16d713 - and a - ret z - scf - ret -; 16d7fe - - -SECTION "bank5C", ROMX, BANK[$5C] - -Function170000: ; 170000 - ld a, [$c62b] - ld [$c6d0], a - ld hl, $c62e - ld de, $c6e7 - ld bc, $0005 - call CopyBytes - ld a, $50 - ld [de], a - ld hl, $c663 - ld de, $c6f2 - ld bc, $0005 - call CopyBytes - ld a, $50 - ld [de], a - ld hl, $c648 - ld a, [hli] - ld [$c6fd], a - ld a, [hl] - ld [$c6fe], a - ld hl, $c639 - ld a, [hli] - ld [$c6ff], a - ld a, [hl] - ld [wc700], a - ld bc, $c633 - callba GetCaughtGender - ld a, c - ld [wc701], a - ld a, [wcd81] - ld [wc74e], a - ld hl, $c608 - ld de, $d800 - ld bc, $008f - call CopyBytes - ret -; 17005a - -Function17005a: ; 17005a - ld a, $5 - call GetSRAMBank - ld a, [$a824] - ld [wc702], a - ld hl, $a827 - ld de, wc719 - ld bc, $0005 - call CopyBytes - ld a, $50 - ld [de], a - ld hl, $a85c - ld de, wc724 - ld bc, $0005 - call CopyBytes - ld a, $50 - ld [de], a - ld hl, $a841 - ld a, [hli] - ld [wc72f], a - ld a, [hl] - ld [wc730], a - ld hl, $a832 - ld a, [hli] - ld [wc731], a - ld a, [hl] - ld [wc732], a - ld bc, $a82c - callba GetCaughtGender - ld a, c - ld [wc733], a - ld a, [wcd81] - ld [wc74e], a - call CloseSRAM - ret -; 1700b0 - -Function1700b0: ; 1700b0 - call Function17021e - callba Function118121 - ret -; 1700ba - -Function1700ba: ; 1700ba - call Function17021e - callba Function11811a - ret -; 1700c4 - -Function1700c4: ; 1700c4 - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a - call Function17042c - ld a, $5 - call GetSRAMBank - ld a, $1 - ld [$be45], a - xor a - ld [$be46], a - ld hl, $dffc - ld de, $aa41 - ld bc, $0004 - call CopyBytes - ld hl, $d202 - ld de, $aa8e - ld bc, $0594 - call CopyBytes - ld hl, $aa5d - ld a, [hl] - inc [hl] - inc hl - sla a - sla a - ld e, a - ld d, $0 - add hl, de - ld e, l - ld d, h - ld hl, $dffc - ld bc, $0004 - call CopyBytes - call CloseSRAM - pop af - ld [rSVBK], a - ret -; 170114 - -Function170114: ; 170114 - call Function17021e - call Function170121 - callba Function11805f - ret -; 170121 - -Function170121: ; 170121 - ld a, $5 - call GetSRAMBank - ld hl, $a948 - ld de, $c608 - ld bc, $00f6 - call CopyBytes - call CloseSRAM - call Function170c8b - ret -; 170139 - -Function170139: ; 170139 - ld a, $5 - call GetSRAMBank - ld de, $aa41 - ld h, $0 - ld l, h - ld bc, $03e8 - call Function17020c - ld bc, $0064 - call Function17020c - ld bc, $000a - call Function17020c - ld a, [de] - ld c, a - ld b, $0 - add hl, bc - call CloseSRAM - ld a, h - ld [$c608], a - ld a, l - ld [$c608 + 1], a - ld hl, $c628 - ld a, [PlayerID] - ld [hli], a - ld a, [PlayerID + 1] - ld [hli], a - ld a, [wSecretID] - ld [hli], a - ld a, [wSecretID + 1] - ld [hli], a - ld e, l - ld d, h - ld hl, PlayerName - ld bc, $0005 - call CopyBytes - ld bc, PlayerID - ld de, PlayerGender - callba Function4e929 - ld de, $c62c + 5 - ld a, c - ld [de], a - inc de - ld a, $df - ld [wcd49], a - ld a, $dc - ld [wcd4a], a - ld a, $41 - ld [wcd4b], a - ld a, $de - ld [wcd4c], a - ld a, $3 -.asm_1701ac - push af - ld a, [wcd49] - ld l, a - ld a, [wcd4a] - ld h, a - ld bc, $0030 - call CopyBytes - ld a, l - ld [wcd49], a - ld a, h - ld [wcd4a], a - ld a, [wcd4b] - ld l, a - ld a, [wcd4c] - ld h, a - ld bc, $0006 - call CopyBytes - ld a, l - ld [wcd4b], a - ld a, h - ld [wcd4c], a - pop af - dec a - jr nz, .asm_1701ac - ld a, $4 - call GetSRAMBank - ld hl, $a013 - ld bc, $0024 - call CopyBytes - call CloseSRAM - ld a, $5 - call GetSRAMBank - ld hl, $a894 - ld bc, $0006 - call CopyBytes - ld hl, $c608 - ld de, $a948 - ld bc, $00f6 - call CopyBytes - call CloseSRAM - ret -; 17020c - -Function17020c: ; 17020c - ld a, [de] - inc de - and a - ret z -.asm_170210 - add hl, bc - dec a - jr nz, .asm_170210 - ret -; 170215 - -BattleTowerBattle: ; 170215 - xor a - ld [wJumptableIndex], a - call Function17022c - ret -; 17021d - -Function17021d: ; 17021d - ret -; 17021e - -Function17021e: ; 17021e - xor a - ld [wJumptableIndex], a - ld [wcf64], a - ld [wcf65], a - ld [wcf66], a - ret -; 17022c - -Function17022c: ; 17022c -.loop - call Jumpto_BattleTowerBattleFunction - call DelayFrame - ld a, [wJumptableIndex] - cp $1 - jr nz, .loop - ret -; 17023a - -Jumpto_BattleTowerBattleFunction: ; 17023a - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, Jumptable_BattleTowerBattleFunctions -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 170249 - -Jumptable_BattleTowerBattleFunctions: ; 170249 - dw RunBattleTowerBattle - dw SkipBattleTowerBattle -; 17024d - -RunBattleTowerBattle: ; 17024d - ld a, [Options] - push af - ld hl, Options - set 6, [hl] - ld a, [InBattleTowerBattle] - push af - or $1 - ld [InBattleTowerBattle], a - xor a - ld [wLinkMode], a - callba Mobile_HealParty - callba HealParty - call Function1702b7 - call Function170bf7 - predef StartBattle - callba LoadPokemonData - callba HealParty - ld a, [wBattleResult] - ld [ScriptVar], a - and a - jr nz, .lost - ld a, BANK(sNrOfBeatenBattleTowerTrainers) - call GetSRAMBank - ld a, [sNrOfBeatenBattleTowerTrainers] - ld [wNrOfBeatenBattleTowerTrainers], a ; wcf64 - call CloseSRAM - ld hl, StringBuffer3 - ld a, [wNrOfBeatenBattleTowerTrainers] ; wcf64 - add $f7 - ld [hli], a - ld a, $50 - ld [hl], a - -.lost - pop af - ld [InBattleTowerBattle], a - pop af - ld [Options], a - ld a, $1 - ld [wJumptableIndex], a - ret - - -Function1702b7: ; 1702b7 -; Initialise the BattleTower-Trainer and his Pkmn - call CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy - ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643 - ld c, PKMN_NAME_LENGTH - callba Function17d073 - jr nc, .asm_1702db - - ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1] - ld [wd265], a - call GetPokemonName - ld l, e - ld h, d - ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643 - ld bc, PKMN_NAME_LENGTH - call CopyBytes - -.asm_1702db - ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e - ld c, PKMN_NAME_LENGTH - callba Function17d073 - jr nc, .asm_1702fc - ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2] ; [$c64e] - ld [wd265], a - call GetPokemonName - ld l, e - ld h, d - ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e - ld bc, PKMN_NAME_LENGTH - call CopyBytes - -.asm_1702fc - ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9 - ld c, PKMN_NAME_LENGTH - callba Function17d073 - jr nc, .asm_17031d - ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3] ; [$c689] - ld [wd265], a - call GetPokemonName - ld l, e - ld h, d - ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9 - ld bc, PKMN_NAME_LENGTH - call CopyBytes - -.asm_17031d - ld a, $50 - ld [wBT_OTTempCopy + wBT_OTTempCopy_45], a ; $c64d - ld [wBT_OTTempCopy + wBT_OTTempCopy_80], a ; $c688 - ld [wBT_OTTempCopy + wBT_OTTempCopy_BB], a ; $c68a + 57 = $c6c3 - call Function170c98 - ld de, wBT_OTTempCopy - ld c, $a - callba Function17d073 - jr nc, .asm_17033d - ld hl, String_170426 - jr .asm_170340 - -.asm_17033d - ld hl, wBT_OTTempCopy ; 0xc608 - -.asm_170340 - ld de, wd26b - ld bc, $000a - call CopyBytes - ld a, $50 - ld [de], a - ld hl, wBT_OTTempCopy + wBT_OTTempCopy_TrainerClass - ld a, [hli] - ld [OtherTrainerClass], a - ld a, $ea - ld [BGMapBuffer], a - ld a, $d3 - ld [wcd21], a - - ; Copy Pkmn into Memory from the address in hl - ld de, OTPartyMon1Species - ld bc, OTPartyCount - ld a, BATTLETOWER_NROFPKMNS ; Number of Pkmn the BattleTower-Trainer has - ld [bc], a - inc bc -.asm_170367 - push af - ld a, [hl] - ld [bc], a - inc bc - push bc - ld bc, party_struct_length - call CopyBytes - push de - ld a, [BGMapBuffer] - ld e, a - ld a, [wcd21] - ld d, a - ld bc, $000b - call CopyBytes - ld a, e - ld [BGMapBuffer], a - ld a, d - ld [wcd21], a - pop de - pop bc - pop af - dec a - and a - jr nz, .asm_170367 - ld a, $ff - ld [bc], a - ret -; 170394 - -Function170394: ; 170394 - ld hl, $c608 + 11 - ld d, $3 -.asm_170399 - push de - push hl - ld b, h - ld c, l - ld a, [hl] - and a - jr z, .asm_1703b1 - cp $ff - jr z, .asm_1703b1 - cp $fe - jr z, .asm_1703b1 - cp $fd - jr z, .asm_1703b1 - cp $fc - jr nz, .asm_1703b4 - -.asm_1703b1 - ld a, $eb - ld [hl], a - -.asm_1703b4 - ld [CurSpecies], a - call GetBaseData - ld a, $5 - call GetSRAMBank - ld a, [$b2fb] - call CloseSRAM - ld e, a - ld hl, $001f - add hl, bc - ld a, [hl] - cp $2 - ld a, $2 - jr c, .asm_1703d6 - ld a, [hl] - cp e - jr c, .asm_1703d7 - ld a, e - -.asm_1703d6 - ld [hl], a - -.asm_1703d7 - ld [CurPartyLevel], a - ld hl, $0002 - add hl, bc - ld d, $3 - ld a, [hli] - and a - jr z, .asm_1703ea - cp $fc - jr nc, .asm_1703ea - jr .asm_1703f4 - -.asm_1703ea - dec hl - ld a, $1 - ld [hli], a - xor a -rept 2 - ld [hli], a -endr - ld [hl], a - jr .asm_1703ff - -.asm_1703f4 - ld a, [hl] - cp $fc - jr c, .asm_1703fb - ld [hl], $0 - -.asm_1703fb - inc hl - dec d - jr nz, .asm_1703f4 - -.asm_1703ff - ld hl, $0024 - add hl, bc - ld d, h - ld e, l - push hl - push de - ld hl, $000a - add hl, bc - ld b, $1 - predef CalcPkmnStats - pop de - pop hl -rept 2 - dec de -endr - ld a, [hli] - ld [de], a - inc de - ld a, [hl] - ld [de], a - pop hl - ld bc, $003b - add hl, bc - pop de - dec d - jp nz, .asm_170399 - ret -; 170426 - -String_170426: ; 170426 - db "CHRIS@" -; 17042c - -Function17042c: ; 17042c - ld hl, OTPartyMon2ID - ld a, $7 -.asm_170431 - push af - push hl - ld c, $12 -.asm_170435 - ld a, [hli] - ld b, a - ld a, [hli] - and a - jr z, .asm_170451 - cp $f - jr nc, .asm_17045b - push hl - ld hl, Unknown_170470 - dec a - ld e, a - ld d, 0 - add hl, de - ld a, [hl] - pop hl - cp b - jr c, .asm_17045b - jr z, .asm_17045b - jr .asm_170456 - -.asm_170451 - ld a, b - cp $fc - jr nc, .asm_17045b - -.asm_170456 - dec c - jr nz, .asm_170435 - jr .asm_170466 - -.asm_17045b - pop de - push de - ld hl, Unknown_17047e - ld bc, $0024 - call CopyBytes - -.asm_170466 - pop hl - ld de, $00e0 - add hl, de - pop af - dec a - jr nz, .asm_170431 - ret -; 170470 - -Unknown_170470: - db $12, $24, $45, $45, $42, $42, $45, $42, $27, $27, $45, $27, $42, $24 - -Unknown_17047e: - db $03, $04, $05, $08 - db $03, $05, $0e, $06 - db $03, $02, $00, $00 - db $39, $07, $07, $04 - db $00, $05, $04, $07 - db $01, $05, $00, $00 - db $0f, $05, $14, $07 - db $05, $05, $11, $0c - db $0c, $06, $06, $04 - - -CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy: ; 1704a2 -; copy the BattleTower-Trainer data that lies at 'BT_OTrainer' to 'wBT_OTTempCopy' - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a - ld hl, BT_OTrainer ; $d100 - ld de, wBT_OTTempCopy ; $c608 - ld bc, BT_OTrainerEnd - BT_OTrainer ; $e0 = $a + $1 + 3*$3b + $24 - ; = $a + $1 + BATTLETOWER_NROFPKMNS * (party_struct_length + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH - call CopyBytes - pop af - ld [rSVBK], a - ld a, BANK(s1_be45) - call GetSRAMBank - ld a, $2 - ld [s1_be45], a - ld hl, sNrOfBeatenBattleTowerTrainers - inc [hl] - call CloseSRAM -SkipBattleTowerBattle: ; 1704c9 - ret -; 1704ca - - -Function1704ca: ; 1704ca - ld a, [$be46] - cp $7 - jr c, .asm_1704d3 - ld a, $6 - -.asm_1704d3 - ld hl, $afce - ld de, -$e0 -.asm_1704d9 - and a - jr z, .asm_1704e0 - add hl, de - dec a - jr .asm_1704d9 - -.asm_1704e0 - ret -; 1704e1 - -Function1704e1: ; 1704e1 - call SpeechTextBox - call FadeToMenu - call Function17021e - call Function1704f1 - call Function2b3c - ret -; 1704f1 - -Function1704f1: ; 1704f1 - call WhiteBGMap - call ClearSprites - call ClearScreen -.asm_1704fa - call JoyTextDelay - ld a, [wJumptableIndex] - bit 7, a - jr nz, .asm_17050f - call Function170510 - callba Function104061 - jr .asm_1704fa - -.asm_17050f - ret -; 170510 - -Function170510: ; 170510 - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, Jumptable_17051f -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 17051f - -Jumptable_17051f: ; 17051f - dw Function170525 - dw Function170571 - dw Function170577 -; 170525 - -Function170525: ; 170525 - ld a, $5 - call GetSRAMBank - - ld hl, $a89c - ld de, StringBuffer3 - ld bc, $0016 - call CopyBytes - - ld hl, $a8b2 - ld de, $c608 - ld bc, $0096 - call CopyBytes - - call CloseSRAM - hlcoord 1, 1 - ld de, StringBuffer3 - call PlaceString - hlcoord 1, 3 - ld de, String_170676 - call PlaceString - hlcoord 4, 3 - ld de, StringBuffer4 - call PlaceString - hlcoord 8, 3 - ld de, String_17067a - call PlaceString - call Function1705b7 - call Function1705f0 - jr Function1705b2 - - -Function170571: - call SetPalettes - call Function1705b2 - - -Function170577: - ld hl, hJoyPressed - ld a, [hl] - and $1 - jr nz, .asm_1705ac - ld a, [hl] - and $2 - jr nz, .asm_1705ac - ld a, [hl] - and $40 - jr nz, .asm_17058f - ld a, [hl] - and $80 - jr nz, .asm_17059d - ret - -.asm_17058f - ld a, [wcf64] - and a - ret z - sub $f - ld [wcf64], a - call Function1705f0 - ret - -.asm_17059d - ld a, [wcf64] - cp $3c - ret z - add $f - ld [wcf64], a - call Function1705f0 - ret - -.asm_1705ac - ld hl, wJumptableIndex - set 7, [hl] - ret - -Function1705b2: - ld hl, wJumptableIndex - inc [hl] - ret -; 1705b7 - -Function1705b7: ; 1705b7 - hlcoord 0, 4 - ld a, $79 - ld [hli], a - ld c, $12 -.asm_1705bf - ld a, $7a - ld [hli], a - dec c - jr nz, .asm_1705bf - ld a, $7b - ld [hli], a - ld de, $0014 - ld c, $c -.asm_1705cd - ld a, $7c - ld [hl], a - add hl, de - dec c - jr nz, .asm_1705cd - ld a, $7d - ld [hli], a - ld c, $12 -.asm_1705d9 - ld a, $7a - ld [hli], a - dec c - jr nz, .asm_1705d9 - ld a, $7e - ld [hl], a - ld de, $ffec - add hl, de - ld c, $c -.asm_1705e8 - ld a, $7c - ld [hl], a - add hl, de - dec c - jr nz, .asm_1705e8 - ret -; 1705f0 - -Function1705f0: ; 1705f0 - call Function17064b - call Function17065d - ld a, $50 - ld [wcd4e], a - ld hl, $c608 - ld a, [wcf64] - ld c, a - xor a - ld b, a - add hl, bc - push hl - pop bc - hlcoord 1, 6 - ld a, $6 -.asm_17060c - push af - push hl - ld a, $3 -.asm_170610 - push af - ld de, wcd49 - ld a, [bc] - and a - jr z, .asm_170625 - ld a, $5 -.asm_17061a - push af - ld a, [bc] - ld [de], a - inc bc - inc de - pop af - dec a - jr nz, .asm_17061a - jr .asm_170631 - -.asm_170625 - ld a, $5 -.asm_170627 - push af - ld a, $e3 - ld [de], a - inc de - inc bc - pop af - dec a - jr nz, .asm_170627 - -.asm_170631 - ld de, wcd49 - push bc - call PlaceString - ld de, $0006 - add hl, de - pop bc - pop af - dec a - jr nz, .asm_170610 - pop hl - ld de, $0028 - add hl, de - pop af - dec a - jr nz, .asm_17060c - ret -; 17064b - -Function17064b: ; 17064b - hlcoord 1, 5 - xor a - ld b, $c -.asm_170651 - ld c, $12 -.asm_170653 - ld [hli], a - dec c - jr nz, .asm_170653 -rept 2 - inc hl -endr - dec b - jr nz, .asm_170651 - ret -; 17065d - -Function17065d: ; 17065d - ld a, [wcf64] - and a - jr z, .asm_170669 - hlcoord 18, 5 - ld a, $61 - ld [hl], a - -.asm_170669 - ld a, [wcf64] - cp $3c - ret z - hlcoord 18, 16 - ld a, $ee - ld [hl], a - ret -; 170676 - -String_170676: ; 170676 - db "ルーム@" -; 17067a - -String_17067a: ; 17067a - db "れきだいりーダーいちらん@" -; 170687 - -BattleTowerAction: ; 170687 - ld a, [ScriptVar] - 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] -; 170696 - - -.jumptable: ; 170696 (5c:4696) - dw Function17075f ; 0x00 - dw Function170788 ; 0x01 - dw Function170778 ; 0x02 - dw Function170799 ; 0x03 - dw Function17079d ; 0x04 - dw Function1707ac ; 0x05 - dw Function1707f4 ; 0x06 - dw Function170868 ; 0x07 - dw Function170881 ; 0x08 - dw Function17089a ; 0x09 - dw Function1708b1 ; 0x0a - dw Function1708b9 ; 0x0b - dw Function1708c8 ; 0x0c - dw Function1708f0 ; 0x0d - dw Function17093c ; 0x0e - dw Function1709aa ; 0x0f - dw Function1709bb ; 0x10 - dw Function170a9c ; 0x11 - dw Function170aa0 ; 0x12 - dw Function170aaf ; 0x13 - dw Function170abe ; 0x14 - dw Function170ad7 ; 0x15 - dw Function170807 ; 0x16 - dw Function17081d ; 0x17 - dw Function170ae8 ; 0x18 - dw Function170b16 ; 0x19 - dw ResetBattleTowerTrainersSRAM ; 0x1a - dw Function1706ee ; 0x1b - dw Function17071b ; 0x1c - dw Function170729 ; 0x1d - dw Function17073e ; 0x1e - dw Function170737 ; 0x1f - - -; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes) -ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a - ld a, BANK(sBTTrainers) - call GetSRAMBank - - ld a, $ff - ld hl, sBTTrainers - ld bc, BATTLETOWER_NROFTRAINERS - call ByteFill - - xor a - ld [sNrOfBeatenBattleTowerTrainers], a - - call CloseSRAM - - ret - -Function1706ee: ; 1706ee (5c:46ee) - ld a, BANK(sbe50) - call GetSRAMBank - - ld a, [sbe50] - call CloseSRAM - ld [ScriptVar], a - ld hl, NumItems - ld a, [hli] - cp $14 - ret c - ld b, $14 - ld a, [ScriptVar] - ld c, a -.asm_170709 - ld a, [hli] - cp c - jr nz, .asm_170711 - ld a, [hl] - cp $5f - ret c -.asm_170711 - inc hl - dec b - jr nz, .asm_170709 - ld a, $12 - ld [ScriptVar], a - ret - -Function17071b: ; 17071b (5c:471b) - ld a, BANK(s1_be45) - call GetSRAMBank - ld a, $3 - ld [s1_be45], a - call CloseSRAM - ret - -Function170729: ; 170729 (5c:4729) - ld a, BANK(s1_be45) - call GetSRAMBank - ld a, $4 - ld [s1_be45], a - call CloseSRAM - ret - -Function170737: ; 170737 (5c:4737) - callba SaveOptions - ret - -Function17073e: ; 17073e (5c:473e) - call Random - ld a, [hRandomAdd] ; $ff00+$e1 - and $7 - cp $6 - jr c, .asm_17074b - sub $6 -.asm_17074b - add $1a - cp $1e - jr z, Function17073e - push af - ld a, BANK(sbe50) - call GetSRAMBank - pop af - ld [sbe50], a - call CloseSRAM - ret - -Function17075f: ; 17075f (5c:475f) - call Function17089a - ld a, [ScriptVar] - and a - ret z - ld a, BANK(sbe4f) - call GetSRAMBank - ld a, [sbe4f] - and $2 - ld [ScriptVar], a - call CloseSRAM - ret - -Function170778: ; 170778 (5c:4778) - ld hl, s1_be45 - ld a, BANK(s1_be45) - call GetSRAMBank - ld a, [hl] - ld [ScriptVar], a - call CloseSRAM - ret - -Function170788: ; 170788 (5c:4788) - ld a, BANK(sbe4f) - call GetSRAMBank - ld a, [sbe4f] - or $2 - ld [sbe4f], a - call CloseSRAM - ret - -Function170799: ; 170799 (5c:4799) - ld c, $1 - jr asm_17079f - -Function17079d: ; 17079d (5c:479d) - ld c, $0 -asm_17079f: ; 17079f (5c:479f) - ld a, BANK(s1_be45) - call GetSRAMBank - ld a, c - ld [s1_be45], a - call CloseSRAM - ret - -Function1707ac: ; 1707ac (5c:47ac) - ld a, $5 - call GetSRAMBank - ld a, [$aa8c] - ld b, a - ld a, [$be46] - ld [ScriptVar], a - call CloseSRAM - and a - ret z - ld a, b - cp $2 - jr nc, .asm_1707ef - push bc - call UpdateTime - pop bc - ld a, $5 - call GetSRAMBank - ld a, [$aa8b] - call CloseSRAM - ld c, a - ld a, [CurDay] - sub c - jr c, .asm_1707e5 - cp $8 - jr nc, .asm_1707ef - ld a, b - and a - jr nz, .asm_1707ef - ret -.asm_1707e5 - ld hl, CurDay - ld a, $8c - sub c - add [hl] - cp $8 - ret c -.asm_1707ef - ld a, $8 - ld [ScriptVar], a - -Function1707f4: ; 1707f4 (5c:47f4) - ld a, $5 - call GetSRAMBank - xor a - ld [$be46], a - ld [$aa8b], a - ld [$aa8c], a - call CloseSRAM - ret - -Function170807: ; 170807 (5c:4807) - call UpdateTime - ld a, $5 - call GetSRAMBank - ld a, [CurDay] - ld [$b2f9], a - xor a - ld [$b2fa], a - call CloseSRAM - ret - -Function17081d: ; 17081d (5c:481d) - xor a - ld [ScriptVar], a - ld a, $5 - call GetSRAMBank - ld a, [$b2f9] - ld c, a - ld a, [$b2fa] - ld b, a - call CloseSRAM - cp $2 - jr nc, .asm_170853 - push bc - call UpdateTime - pop bc - ld a, [CurDay] - sub c - jr c, .asm_170849 - cp $b - jr nc, .asm_170853 - ld a, b - and a - jr nz, .asm_170853 - ret -.asm_170849 - ld hl, CurDay - ld a, $8c - sub c - add [hl] - cp $b - ret c -.asm_170853 - ld a, $1 - ld [ScriptVar], a - ld a, $5 - call GetSRAMBank - xor a - ld [$b2f9], a - ld [$b2fa], a - call CloseSRAM - ret - -Function170868: ; 170868 (5c:4868) - ld a, BANK(sbe47) - call GetSRAMBank - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, $3 - ld [rSVBK], a ; $ff00+$70 - ld a, [wd000 + $800] - ld [sbe47], a - pop af - ld [rSVBK], a ; $ff00+$70 - call CloseSRAM - ret - -Function170881: ; 170881 (5c:4881) - ld a, BANK(sbe47) - call GetSRAMBank - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, $3 - ld [rSVBK], a ; $ff00+$70 - ld a, [sbe47] - ld [wd000 + $800], a - pop af - ld [rSVBK], a ; $ff00+$70 - call CloseSRAM - ret - -Function17089a: ; 17089a - ld a, [wcfcd] - and a - jr z, .asm_1708ad - callba Function14bcb - jr z, .asm_1708ab - xor a - jr .asm_1708ad - -.asm_1708ab - ld a, $1 - -.asm_1708ad - ld [ScriptVar], a - ret -; 1708b1 - - -Function1708b1: ; 1708b1 (5c:48b1) - xor a - ld [MusicFade], a - call MaxVolume - ret - -Function1708b9: ; 1708b9 (5c:48b9) something to do with GS Ball - ld a, BANK(s1_be3c) - call GetSRAMBank - ld a, [s1_be3c] - ld [ScriptVar], a - call CloseSRAM - ret - -Function1708c8: ; 1708c8 (5c:48c8) - call UpdateTime - ld a, $5 - call GetSRAMBank - ld a, [CurDay] - ld [$aa8b], a - xor a - ld [$aa8c], a - ld a, [$aa5d] - cp $2 - jr nc, .asm_1708ec - ld a, [CurDay] - ld [$aa48], a - ld a, $1 - ld [$aa47], a -.asm_1708ec - call CloseSRAM - ret - -Function1708f0: ; 1708f0 (5c:48f0) - xor a - ld [ScriptVar], a - call UpdateTime - ld a, $5 - call GetSRAMBank - ld a, [$aa48] - ld c, a - ld a, [$aa47] - call CloseSRAM - and a - ret z - ld hl, CurDay - ld a, c - cp [hl] - jr nz, Function170923 - ld a, $5 - call GetSRAMBank - ld a, [$aa5d] - call CloseSRAM - cp $5 - ret c - ld a, $1 - ld [ScriptVar], a - ret - - -Function170923: ; 170923 - ld a, $5 - call GetSRAMBank - xor a - ld [$aa48], a - ld [$aa47], a - ld hl, $aa5d - ld bc, $0011 - call ByteFill - call CloseSRAM - ret -; 17093c - - -Function17093c: ; 17093c (5c:493c) - xor a - ld [ScriptVar], a - ld a, EGG_TICKET - ld [CurItem], a - ld hl, NumItems - call CheckItem - ret nc - ld a, [PartyCount] - ld b, 0 - ld c, a - ld hl, PartySpecies -.loop - ld a, [hli] - cp EGG - jr nz, .not_egg - push hl - ld hl, PartyMonOT ; wddff (aliases: PartyMonOT) - ld de, $6 - ld a, b - and a - jr z, .skip -.loop2 - add hl, de - dec a - jr nz, .loop2 -.skip - ld de, String_1709a4 - ld a, $6 -.asm_17096e - push af - ld a, [de] - inc de - cp [hl] - inc hl - jr nz, .asm_17099d - pop af - dec a - jr nz, .asm_17096e -rept 4 - dec hl -endr - ld a, $50 -rept 2 - ld [hli], a -endr - pop hl - ld a, EGG_TICKET - ld [CurItem], a - ld a, $1 - ld [wItemQuantityChangeBuffer], a - ld a, $ff - ld [wd107], a - ld hl, NumItems - call TossItem - ld a, $1 - ld [ScriptVar], a - ret - -.asm_17099d - pop af - pop hl -.not_egg - inc b - dec c - jr nz, .loop - ret -; 1709a4 (5c:49a4) - -String_1709a4: ; 1709a4 - db "なぞナゾ@@" - -Function1709aa: ; 1709aa (5c:49aa) - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, BANK(w3_d090) - ld [rSVBK], a ; $ff00+$70 - ld a, [w3_d090] - ld [ScriptVar], a - pop af - ld [rSVBK], a ; $ff00+$70 - ret - -Function1709bb: ; 1709bb (5c:49bb) - xor a - ld [ScriptVar], a - ld a, $5 - call GetSRAMBank - ld a, [$a800] - call CloseSRAM - cp 6 - jr nc, .invalid - ld e, a - ld d, 0 - ld hl, Jumptable_1709e7 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] - -.invalid - ld a, $5 - call GetSRAMBank - xor a - ld [$a800], a - call CloseSRAM - ret -; 1709e7 (5c:49e7) - -Jumptable_1709e7: ; 1709e7 - dw Function170a00 - dw Function170a00 - dw Function1709f3 - dw Function1709f3 - dw Function170a01 - dw Function170a33 -; 1709f3 - -Function1709f3: ; 1709f3 - ld a, $5 - call GetSRAMBank - ld a, $1 - ld [$a800], a - call CloseSRAM - -Function170a00: ; 170a00 - ret -; 170a01 - -Function170a01: ; 170a01 - ld a, $5 - call GetSRAMBank - ld hl, $b023 - ld de, $c608 - ld bc, $0069 - call CopyBytes - ld a, [$a825] - ld [wcd30], a - ld a, [$a826] - ld [wcd31], a - call CloseSRAM - callba Function11b6b4 - callba Function17d0f3 - ld a, $1 - ld [ScriptVar], a - ret -; 170a33 - -Function170a33: ; 170a33 - ld a, $0 - call GetSRAMBank - ld hl, wRTC - ld de, $c608 - ld bc, $0004 - call CopyBytes - call CloseSRAM - ld a, $5 - call GetSRAMBank - ld hl, $b08c - ld de, $c608 - ld c, $4 -.asm_170a54 - ld a, [de] - inc de - cp [hl] - jr nz, .asm_170a78 - inc hl - dec c - jr nz, .asm_170a54 - call CloseSRAM - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a - call GetMapTrigger - ld a, d - or e - jr z, .asm_170a72 - ld a, [de] - and a - ret nz - -.asm_170a72 - ld a, $1 - ld [ScriptVar], a - ret - -.asm_170a78 - call CloseSRAM - ld a, $5 - call GetSRAMBank - xor a - ld [$a800], a - call CloseSRAM - ld [ScriptVar], a - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a - call GetMapTrigger - ld a, d - or e - jr z, .asm_170a9b - xor a - ld [de], a - -.asm_170a9b - ret -; 170a9c - -Function170a9c: ; 170a9c (5c:4a9c) - ld c, $0 - jr asm_170aa2 - -Function170aa0: ; 170aa0 (5c:4aa0) - ld c, $1 -asm_170aa2: ; 170aa2 (5c:4aa2) - ld a, $5 - call GetSRAMBank - ld a, c - ld [$aa8d], a - call CloseSRAM - ret - -Function170aaf: ; 170aaf (5c:4aaf) - ld a, $5 - call GetSRAMBank - ld a, [$aa8d] - ld [ScriptVar], a - call CloseSRAM - ret - -Function170abe: ; 170abe (5c:4abe) - call Function17089a - ld a, [ScriptVar] - and a - ret z - ld a, BANK(sbe4f) - call GetSRAMBank - ld a, [sbe4f] - and $1 - ld [ScriptVar], a - call CloseSRAM - ret - -Function170ad7: ; 170ad7 (5c:4ad7) - ld a, BANK(sbe4f) - call GetSRAMBank - ld a, [sbe4f] - or $1 - ld [sbe4f], a - call CloseSRAM - ret - -Function170ae8: ; 170ae8 (5c:4ae8) - ld a, $5 - call GetSRAMBank - ld a, [$b2fb] - call CloseSRAM - ld c, $a - call SimpleDivide - ld a, b - ld [wcd4f], a - xor a - ld [ScriptVar], a - callba Function119d93 - ret nc - ld a, $5 - call GetSRAMBank - ld a, [$b2fb] - call CloseSRAM - ld [ScriptVar], a - ret - -Function170b16: ; 170b16 (5c:4b16) - ld a, $5 - call GetSRAMBank - ld a, [$b2fb] - call CloseSRAM - ld c, 10 - call SimpleDivide - ld a, b - ld [wcd4f], a - xor a - ld [ScriptVar], a - callba Function119dd1 - ret nc - ld a, $5 - call GetSRAMBank - ld a, [$b2fb] - call CloseSRAM - ld [ScriptVar], a - ret - -Function_LoadOpponentTrainerAndPokemonsWithOTSprite: ; 0x170b44 - callba Function_LoadOpponentTrainerAndPokemons - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a - ld hl, wd10a - ld a, [hl] - dec a - ld c, a - ld b, $0 - pop af - ld [rSVBK], a - ld hl, Unknown_170b90 - add hl, bc - ld a, [hl] - ld [wcd49], a - -; Load sprite of the opponent trainer -; because s/he is chosen randomly and appears out of nowhere - ld a, [ScriptVar] - dec a - sla a - ld e, a - sla a - sla a - sla a - ld c, a - ld b, $0 - ld d, $0 - ld hl, MapObjects - add hl, bc - inc hl - ld a, [wcd49] - ld [hl], a - ld hl, UsedSprites - add hl, de - ld [hli], a - ld [hUsedSpriteIndex], a - ld a, [hl] - ld [hUsedSpriteTile], a - callba Function143c8 - ret -; 170b90 - -Unknown_170b90: - db $12, $13, $14, $15, $18, $17 - db $16, $19, $04, $05, $11, $01 - db $1c, $1b, $21, $1e, $1a, $1d - db $1f, $3c, $20, $27, $27, $27 - db $28, $0a, $23, $24, $2a, $2b - db $35, $40, $2a, $29, $22, $25 - db $3a, $2b, $24, $49, $2b, $07 - db $2c, $2d, $4a, $0d, $4b, $3a - db $2b, $41, $35, $27, $28, $27 - db $36, $3e, $30, $2c, $2d, $3d - db $26, $2e, $06, $07, $43, $36 - -Function170bd2: ; 170bd2 - ret -; 170bd3 - -SpecialCheckForBattleTowerRules: ; 170bd3 - callba CheckForBattleTowerRules - jr c, .asm_170bde - xor a - jr .asm_170be0 - -.asm_170bde - ld a, $1 - -.asm_170be0 - ld [ScriptVar], a - ret -; 170be4 diff --git a/misc/mobile_45.asm b/misc/mobile_45.asm index 76775c9b2..373834193 100644 --- a/misc/mobile_45.asm +++ b/misc/mobile_45.asm @@ -8469,8888 +8469,3 @@ Function117cdd: ; 0x117cdd ret -SECTION "bank46", ROMX, BANK[$46] - -Function118000: ; 118000 - ld a, $1 - ld [wcd38], a - jr asm_11800b - -Function118007: ; 118007 - xor a - ld [wcd38], a - -asm_11800b - call Function1183cb - ld a, $18 - ld [wcd33], a - ld a, $19 - ld [wcd34], a - ld a, $4 - ld [wc3f0], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a -.asm_118024 - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $1b - jr c, .asm_118037 - ld a, [wcd34] - ld [wcf66], a - -.asm_118037 - call Function1184a5 - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_118024 - pop af - ld [rSVBK], a - call Function118452 - call Function222a -Function11805e: ; 11805e (46:405e) - ret -; 11805f - -Function11805f: ; 11805f - ld a, $1 - ld [wcd38], a - call Function1183cb - ld a, $18 - ld [wcd33], a - ld a, $19 - ld [wcd34], a - ld a, $4 - ld [wc3f0], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a -.asm_11807d - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $1b - jr c, .asm_118090 - ld a, [wcd34] - ld [wcf66], a - -.asm_118090 - call Function11857c - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_11807d - pop af - ld [rSVBK], a - call Function118452 - call Function222a - ret -; 1180b8 - -Function1180b8: ; 1180b8 - call Function1183cb - ld a, $22 - ld [wcd33], a - ld a, $23 - ld [wcd34], a - ld a, $4 - ld [wc3f0], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a -.asm_1180d1 - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $28 - jr c, .asm_1180e4 - ld a, [wcd34] - ld [wcf66], a - -.asm_1180e4 - ld a, [wcf66] - cp $10 - jr c, .asm_1180f2 - cp $16 - jr nc, .asm_1180f2 - call Function11884c - -.asm_1180f2 - call Function1184ec - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_1180d1 - pop af - ld [rSVBK], a - call Function118452 - call Function222a - ret -; 11811a - -Function11811a: ; 11811a - ld a, 1 - ld [wcd38], a - jr Function118125 - -Function118121: ; 118121 - xor a - ld [wcd38], a - -Function118125: ; 118125 - call Function1183cb - ld a, $3 - ld [wcd33], a - ld a, $d - ld [wcd34], a - ld a, $4 - ld [wc3f0], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a -.asm_11813e - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $f - jr c, .asm_118151 - ld a, [wcd34] - ld [wcf66], a - -.asm_118151 - call Function11854d - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_11813e - xor a - ld [Unkn1Pals], a - pop af - ld [rSVBK], a - call Function118452 - call Function118180 - call Function222a - ret -; 118180 - -Function118180: ; 118180 - ld a, [ScriptVar] - and a - ret nz - ld a, [wcd38] - and a - ret z - ld a, $5 - call GetSRAMBank - ld hl, wcd69 - ld de, $a89c - ld bc, $0016 - call CopyBytes - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a - ld de, $d202 - ld c, $96 - callba Function17d0b3 - jr c, .asm_1181d0 - ld de, $d202 - ld bc, $0196 - callba Function17d1e1 - jr c, .asm_1181d0 - ld hl, $d202 - ld de, $a8b2 - ld bc, $0096 - call CopyBytes -.asm_1181c9 - pop af - ld [rSVBK], a - call CloseSRAM - ret - -.asm_1181d0 - ld a, $d3 - ld [wc300], a - ld [ScriptVar], a - jr .asm_1181c9 -; 1181da - -Function1181da: ; 1181da - call Function1183cb - ld a, $2 - ld [wcd38], a - ld a, $21 - ld [wcd33], a - ld a, $22 - ld [wcd34], a - ld a, $4 - ld [wc3f0], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a -.asm_1181f8 - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $28 - jr c, .asm_11820b - ld a, [wcd34] - ld [wcf66], a - -.asm_11820b - call Function1185c3 - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_1181f8 - pop af - ld [rSVBK], a - call Function118452 - call Function222a - ret -; 118233 - -Function118233: ; 118233 - call Function1183cb - ld a, $1b - ld [wcd33], a - ld a, $1c - ld [wcd34], a - ld a, $6 - ld [wc3f0], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a -.asm_11824c - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $1e - jr c, .asm_11825f - ld a, [wcd34] - ld [wcf66], a - -.asm_11825f - call Function118624 - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_11824c - pop af - ld [rSVBK], a - call Function118452 - ret -; 118284 - -Function118284: ; 118284 - call Function1183cb - ld a, $19 - ld [wcd33], a - ld a, $1e - ld [wcd34], a - ld a, $5 - ld [wc3f0], a - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, $3 - ld [rSVBK], a ; $ff00+$70 -.asm_11829d - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $20 - jr c, .asm_1182b0 - ld a, [wcd34] - ld [wcf66], a -.asm_1182b0 - call Function1186f5 - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_11829d - pop af - ld [rSVBK], a ; $ff00+$70 - call Function118452 - ret -; 1182d5 (46:42d5) - - -Function1182d5: ; 1182d5 - call Function1183cb - ld a, $18 - ld [wcd33], a - ld a, $19 - ld [wcd34], a - ld a, $4 - ld [wc3f0], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a -.asm_1182ee - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $1b - jr c, .asm_118301 - ld a, [wcd34] - ld [wcf66], a - -.asm_118301 - call Function118746 - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_1182ee - pop af - ld [rSVBK], a - call Function118452 - call Function222a - ret -; 118329 - -Function118329: ; 118329 - call Function1183cb - ld a, $15 - ld [wcd33], a - ld a, $16 - ld [wcd34], a - ld a, $6 - ld [wc3f0], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a -.asm_118342 - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $18 - jr c, .asm_118355 - ld a, [wcd34] - ld [wcf66], a - -.asm_118355 - call Function118671 - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_118342 - pop af - ld [rSVBK], a - call Function118452 - ret -; 11837a - -Function11837a: ; 11837a - call Function1183cb - ld a, $16 - ld [wcd33], a - ld a, $17 - ld [wcd34], a - ld a, $6 - ld [wc3f0], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a -.asm_118393 - call JoyTextDelay - call Function118473 - ld a, [wcf66] - cp $19 - jr c, .asm_1183a6 - ld a, [wcd34] - ld [wcf66], a - -.asm_1183a6 - call Function1186b2 - call Function11a8fa - callba Function115dd3 - callba Function11619d - call DelayFrame - ld a, [wcf66] - ld hl, wcd33 - cp [hl] - jr nz, .asm_118393 - pop af - ld [rSVBK], a - call Function118452 - ret -; 1183cb - -Function1183cb: ; 1183cb - di - ld a, [rIE] - ld [wcd32], a - call DoubleSpeed - xor a - ld [rIF], a - ld [wc300], a - ld [wc301], a - ld [wc302], a - ld [wcd80], a - ld [wcd65], a - ld [wcd66], a - ld [wcd67], a - ld [wcd68], a - ld [wPartyMonMenuIconAnims + 6], a - ld [wcd89], a - ld [wcd8a], a - ld [wcd8b], a - ld [wc3ec], a - ld [wc3ed], a - ld [wc3ee], a - ld [wc3ef], a - ld hl, VramState - ld a, [hl] - ld [wcd7f], a - set 1, [hl] - ld a, $f - ld [rIE], a - ld a, $1 - ld [$ffc9], a - ld [hMobile], a - ei - callba Function106462 - callba Function106464 - callba Function115d99 - callba Function11615a - ld a, $5 - call GetSRAMBank - xor a - ld [$bfff], a - call CloseSRAM - ret -; 118440 - -Function118440: ; 118440 - push af - ld a, $5 - call GetSRAMBank - ld a, [$bfff] - inc a - ld [$bfff], a - call CloseSRAM - pop af - ret -; 118452 - -Function118452: ; 118452 - di - xor a - ld [$ffc9], a - ld [hMobile], a - ld [hVBlank], a - call NormalSpeed - xor a - ld [rIF], a - ld a, [wcd32] - ld [rIE], a - ei - ld a, [wcd7f] - ld [VramState], a - ld a, [wc300] - ld [ScriptVar], a - ret -; 118473 - -Function118473: ; 118473 - ld a, [wcd65] - and a - ret z - ld a, [wcd66] - inc a - ld [wcd66], a - cp $3c - ret nz - xor a - ld [wcd66], a - ld a, [wcd67] - inc a - ld [wcd67], a - cp $3c - ret nz - ld a, [wcd68] - inc a - ld [wcd68], a - cp $63 - jr z, .asm_1184a0 - xor a - ld [wcd67], a - ret - -.asm_1184a0 - xor a - ld [wcd65], a - ret -; 1184a5 - -Function1184a5: ; 1184a5 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_1184b4 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 1184b4 - -Jumptable_1184b4: ; 1184b4 - dw Function11886e - dw Function118880 - dw Function11878d - dw Function1188b0 - dw Function11878d - dw Function1188b8 - dw Function11878d - dw Function1188c0 - dw Function11878d - dw Function1188c8 - dw Function11878d - dw Function118903 - dw Function118a8f - dw Function11878d - dw Function118d80 - dw Function118d9b - dw Function11878d - dw Function118ded - dw Function118e6d - dw Function11878d - dw Function11984e - dw Function118e76 - dw Function118e7e - dw Function11878d - dw Function11805e - dw Function118e76 - dw Function118e87 - dw Function118e76 -; 1184ec - -Function1184ec: ; 1184ec - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_1184fb -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 1184fb - -Jumptable_1184fb: ; 1184fb - dw Function11886e - dw Function118880 - dw Function11878d - dw Function1188b0 - dw Function11878d - dw Function1188b8 - dw Function11878d - dw Function1188c0 - dw Function11878d - dw Function1188c8 - dw Function11878d - dw Function118903 - dw Function119954 - dw Function11878d - dw Function119973 - dw Function11878d - dw Function119987 - dw Function11878d - dw Function1199b4 - dw Function1199ca - dw Function11878d - dw Function1199e2 - dw Function119b0d - dw Function11878d - dw Function119b6b - dw Function119b3b - dw Function11878d - dw Function119b52 - dw Function11878d - dw Function118e6d - dw Function11878d - dw Function118e76 - dw Function118e7e - dw Function11878d - dw Function11805e - dw Function118e76 - dw Function118e87 - dw Function119b45 - dw Function11878d - dw Function119ac9 - dw Function118e76 -; 11854d - -Function11854d: ; 11854d - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_11855c -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 11855c - -Jumptable_11855c: ; 11855c - dw Function118922 - dw Function118936 - dw Function118982 - dw Function11805e - dw Function119ca2 - dw Function119cab - dw Function119cb8 - dw Function119cc3 - dw Function119cdf - dw Function119cec - dw Function119c97 - dw Function119cab - dw Function119cb8 - dw Function118e76 - dw Function118e87 - dw Function118e76 -; 11857c - -Function11857c: ; 11857c - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_11858b -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 11858b - -Jumptable_11858b: ; 11858b - dw Function11886e - dw Function118880 - dw Function11878d - dw Function1188b0 - dw Function11878d - dw Function1188b8 - dw Function11878d - dw Function1188c0 - dw Function11878d - dw Function1188c8 - dw Function11878d - dw Function118903 - dw Function118a7a - dw Function11878d - dw Function11891c - dw Function1198ee - dw Function1198f7 - dw Function11878d - dw Function119937 - dw Function118e6d - dw Function11878d - dw Function118e76 - dw Function118e7e - dw Function11878d - dw Function11805e - dw Function118e76 - dw Function118e87 - dw Function118e76 -; 1185c3 - -Function1185c3: ; 1185c3 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_1185d2 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 1185d2 - -Jumptable_1185d2: ; 1185d2 - dw Function11886e - dw Function118880 - dw Function11878d - dw Function1188b0 - dw Function11878d - dw Function1188b8 - dw Function11878d - dw Function1188c0 - dw Function11878d - dw Function1188c8 - dw Function11878d - dw Function118903 - dw Function118aa4 - dw Function11878d - dw Function118e92 - dw Function11878d - dw Function118eb0 - dw Function118ec6 - dw Function118f0d - dw Function118f14 - dw Function118f5e - dw Function11878d - dw Function118fc0 - dw Function11878d - dw Function119054 - dw Function1190d0 - dw Function11878d - dw Function1190ec - dw Function118e6d - dw Function11878d - dw Function118e76 - dw Function118e7e - dw Function11878d - dw Function11805e - dw Function118e76 - dw Function118e87 - dw Function119cc3 - dw Function119cdf - dw Function119cec - dw Function11914e - dw Function118e76 -; 118624 - -Function118624: ; 118624 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_118633 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 118633 - -Jumptable_118633: ; 118633 - dw Function118866 - dw Function118880 - dw Function11878d - dw Function1188b0 - dw Function11878d - dw Function1188b8 - dw Function11878d - dw Function1188c0 - dw Function11878d - dw Function1188c8 - dw Function11878d - dw Function118903 - dw Function118aa4 - dw Function11878d - dw Function118e92 - dw Function11878d - dw Function11915d - dw Function118f68 - dw Function11878d - dw Function119009 - dw Function11878d - dw Function119054 - dw Function118e6d - dw Function11878d - dw Function118e76 - dw Function118e7e - dw Function11878d - dw Function11805e - dw Function118e76 - dw Function118e87 - dw Function118e76 -; 118671 - -Function118671: ; 118671 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_118680 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 118680 - -Jumptable_118680: ; 118680 - dw Function118866 - dw Function118880 - dw Function11878d - dw Function1188b0 - dw Function11878d - dw Function1188b8 - dw Function11878d - dw Function1188c0 - dw Function11878d - dw Function1188c8 - dw Function11878d - dw Function118903 - dw Function119380 - dw Function119388 - dw Function1193a0 - dw Function11878d - dw Function118e6d - dw Function11878d - dw Function118e76 - dw Function118e7e - dw Function11878d - dw Function11805e - dw Function118e76 - dw Function118e87 - dw Function118e76 -; 1186b2 - -Function1186b2: ; 1186b2 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_1186c1 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 1186c1 - -Jumptable_1186c1: ; 1186c1 - dw Function118866 - dw Function118880 - dw Function11878d - dw Function1188b0 - dw Function11878d - dw Function1188b8 - dw Function11878d - dw Function1188c0 - dw Function11878d - dw Function1188c8 - dw Function11878d - dw Function118903 - dw Function119380 - dw Function1193e3 - dw Function1193fb - dw Function11878d - dw Function119413 - dw Function118e6d - dw Function11878d - dw Function118e76 - dw Function118e7e - dw Function11878d - dw Function11805e - dw Function118e76 - dw Function118e87 - dw Function118e76 -; 1186f5 - -Function1186f5: ; 1186f5 (46:46f5) - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_118704 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 118704 (46:4704) - -Jumptable_118704: ; 118704 (46:4704) - dw Function11886a - dw Function118880 - dw Function11878d - dw Function1188b0 - dw Function11878d - dw Function1188b8 - dw Function11878d - dw Function1188c0 - dw Function11878d - dw Function1188c8 - dw Function11878d - dw Function118903 - dw Function118abc - dw Function11878d - dw Function119451 - dw Function1195f8 - dw Function119612 - dw Function119629 - dw Function119648 - dw Function11878d - dw Function118e6d - dw Function11878d - dw Function118e76 - dw Function118e7e - dw Function11878d - dw Function11805e - dw Function11967d - dw Function119685 - dw Function119665 - dw Function11966d - dw Function118e76 - dw Function118e87 - dw Function118e76 -; 118746 (46:4746) - -Function118746: ; 118746 - ld a, [wcf66] - ld e, a - ld d, 0 - ld hl, Jumptable_118755 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 118755 - -Jumptable_118755: ; 118755 - dw Function11886e - dw Function118880 - dw Function11878d - dw Function1188b0 - dw Function11878d - dw Function1188b8 - dw Function11878d - dw Function1188c0 - dw Function11878d - dw Function1188c8 - dw Function11878d - dw Function118903 - dw Function118ad0 - dw Function11878d - dw Function1196f2 - dw Function1197c9 - dw Function1197dc - dw Function11878d - dw Function118e6d - dw Function11878d - dw Function119800 - dw Function118e76 - dw Function118e7e - dw Function11878d - dw Function11805e - dw Function118e76 - dw Function118e87 - dw Function118e76 -; 11878d - -Function11878d: ; 11878d (46:478d) - ld a, [wc821] - bit 1, a - jr nz, .asm_1187af - bit 2, a - jr nz, .asm_1187d1 - bit 0, a - jr nz, .asm_1187aa - ld a, [wcd89] - and $1 - jr z, .asm_1187a7 - ld a, $3 - ld [rSVBK], a ; $ff00+$70 -.asm_1187a7 - jp Function119e2e -.asm_1187aa - call Function118821 - ret c - ret -.asm_1187af - ld a, $0 - call Function3e32 - ld [wc300], a - ld a, l - ld [wc301], a - ld a, h - ld [wc302], a - ld a, $a - call Function3e32 - ld a, [wc3f0] - ld [wPartyMonMenuIconAnims + 5], a - ld a, [wcd34] - ld [wcf66], a - ret -.asm_1187d1 - ld hl, wcd89 - bit 0, [hl] - jr nz, .asm_118803 - set 0, [hl] - ld a, $6 - ld [rSVBK], a ; $ff00+$70 - ld de, Unkn1Pals - ld bc, $1000 - ld a, [hl] - sla a - jr c, .asm_1187f9 - sla a - jr c, .asm_1187fd - sla a - jr c, .asm_1187f5 - ld a, $24 - jr .asm_1187ff -.asm_1187f5 - ld a, $28 - jr .asm_1187ff -.asm_1187f9 - ld a, $2a - jr .asm_1187ff -.asm_1187fd - ld a, $2c -.asm_1187ff - call Function3e32 - ret -.asm_118803 - ld a, $d3 - -Function118805: ; 118805 (46:4805) - ld [wc300], a - xor a - ld [wc301], a - ld [wc302], a - ld a, $a - call Function3e32 - ld a, [wc3f0] - ld [wPartyMonMenuIconAnims + 5], a - ld a, [wcd34] - ld [wcf66], a - ret - -Function118821: ; 118821 (46:4821) - ld a, [wPartyMonMenuIconAnims + 5] - cp $3 - jr c, .asm_11884a - cp $4 - jr z, .asm_11884a - ld a, [hJoyDown] ; $ff00+$a8 - cp $5 - jr nz, .asm_11884a - ld a, $a - call Function3e32 - ld a, $a - ld [wc300], a - ld a, [wc3f0] - ld [wPartyMonMenuIconAnims + 5], a - ld a, [wcd34] - ld [wcf66], a - scf - ret -.asm_11884a - and a - ret -; 11884c (46:484c) - -Function11884c: ; 11884c - ld a, [hJoyDown] - cp $5 - jr nz, .asm_118864 - ld a, $a - call Function3e32 - ld a, $a - ld [wc300], a - ld a, [wcd34] - ld [wcf66], a - scf - ret - -.asm_118864 - and a - ret -; 118866 - -Function118866: - ld a, 2 - jr asm_11886f - -Function11886a: ; 11886a (46:486a) - ld a, 1 - jr asm_11886f -; 11886e (46:486e) - -Function11886e: - xor a - -asm_11886f - ld [BGMapPalBuffer], a - ld a, $0 - ld [wcd3c], a - call Function119e2e - ld a, [wcd33] - ld [wcd45], a - -Function118880: ; 118880 (46:4880) - call Function119ed8 - ret c - xor a - ld [wcf64], a - ld [wc807], a - ld de, wcd81 - ld hl, $46 - ld a, $2 - jp Function119e2b -; 118896 (46:4896) - -Function118896: ; 118896 - ld a, [wc821] - bit 1, a - jr nz, .asm_1188a5 - bit 2, a - jr nz, .asm_1188a5 - bit 0, a - jr z, .asm_1188aa - -.asm_1188a5 - ld a, $34 - jp Function119e2b - -.asm_1188aa - call Function119e2e - jp Function119e2e -; 1188b0 - -Function1188b0: ; 1188b0 (46:48b0) - ld de, wPartyMonMenuIconAnims + 48 + 2 - ld a, $c - jp Function119e2b - -Function1188b8: ; 1188b8 (46:48b8) - ld de, wc3ac - ld a, $e - jp Function119e2b - -Function1188c0: ; 1188c0 (46:48c0) - ld de, wc3cd - ld a, $10 - jp Function119e2b - -Function1188c8: ; 1188c8 (46:48c8) - ld a, $1 - ld [wcd65], a - call Function1188e7 - ld hl, wc708 -.asm_1188d3 - ld a, [de] - inc de - ld [hli], a - and a - jr nz, .asm_1188d3 - call Function119eb4 - call Function119ec2 - ld hl, wc708 - ld a, $6 - jp Function119e2b - -Function1188e7: ; 1188e7 (46:48e7) - ld de, wPartyMonMenuIconAnims + 48 + 2 - ld a, $5 - call GetSRAMBank - ld a, [$aa4a] - call CloseSRAM - and a - ret z - sla a - ld c, a -.asm_1188fa - ld a, [de] - inc de - and a - jr nz, .asm_1188fa - dec c - jr nz, .asm_1188fa - ret - -Function118903: ; 118903 (46:4903) - ld a, [wc3f0] - ld [wPartyMonMenuIconAnims + 5], a - ld c, $1 - callba Function115e18 - ld a, $8 - ld [wcd3c], a - call Function119ed8 - jp Function119e2e - - -Function11891c: ; 11891c - call Function118b42 - jp Function119e2e - - -Function118922: ; 118922 - ld a, [wcd38] - and a - jr nz, .asm_11892d - ld hl, Text_WhatLevelDoYouWantToChallenge - jr .asm_118930 - -.asm_11892d - ld hl, Text_CheckBattleRoomListByMaxLevel - -.asm_118930 - call Function11a9c0 - call Function119e2e - -Function118936: - ld a, [wPartyMonMenuIconAnims + 6] - and a - ret nz - ld hl, MenuDataHeader_119cf7 - call LoadMenuDataHeader - call Function1cbb - call GetMemTileCoord - call Function321c - hlcoord 16, 8, AttrMap - ld a, $40 - or [hl] - ld [hl], a - call Function3200 - ld a, $1 - ld [wcd4f], a - ld a, $1 - ld [rSVBK], a - ld a, [StatusFlags] - bit 6, a - jr nz, .asm_11896b - ld hl, Strings_Ll0ToL40 ; Address to list of strings with the choosable levels - ld a, 5 ; 4 levels to choose from, including 'Cancel'-option - jr .asm_118970 - -.asm_11896b - ld hl, Strings_L10ToL100 ; Address to list of strings with the choosable levels - ld a, 11 ; 10 levels to choose from, including 'Cancel'-option - -.asm_118970 - ld [wcd4a], a - ld a, l - ld [wcd4b], a - ld a, h - ld [wcd4c], a - ld a, $3 - ld [rSVBK], a - call Function119e2e - -Function118982: - hlcoord 13, 8 - ld de, String_119d07 - call PlaceString - hlcoord 13, 10 - ld de, String_119d07 - call PlaceString - ld a, [wcd4b] - ld l, a - ld a, [wcd4c] - ld h, a - ld d, $0 - ld a, [wcd4f] - dec a - rlca - rlca - rlca - ld e, a - add hl, de - ld a, l - ld e, a - ld a, h - ld d, a - ld a, [rSVBK] - push af - ld a, $1 - ld [rSVBK], a - ld bc, StringBuffer3 -.asm_1189b5 - ld a, [hli] - cp $50 - jr z, .asm_1189c4 - cp $7f - jr z, .asm_1189c2 - ld [bc], a - inc bc - jr .asm_1189b5 - -.asm_1189c2 - ld a, $50 - -.asm_1189c4 - ld [bc], a - pop af - ld [rSVBK], a - hlcoord 13, 9 - call PlaceString - ld hl, hJoyPressed - ld a, [hl] - and $2 - jr nz, .asm_118a39 - ld a, [hl] - and $1 - jr nz, .asm_118a01 - ld a, [hl] - and $80 - jr nz, .asm_1189e6 - ld a, [hl] - and $40 - jr nz, .asm_1189f2 -.asm_1189e5 - ret - -.asm_1189e6 - ld hl, wcd4f - dec [hl] - jr nz, .asm_1189e5 - ld a, [wcd4a] - ld [hl], a - jr .asm_1189e5 - -.asm_1189f2 - ld a, [wcd4a] - ld hl, wcd4f - inc [hl] - cp [hl] - jr nc, .asm_1189e5 - ld a, $1 - ld [hl], a - jr .asm_1189e5 - -.asm_118a01 - call PlayClickSFX - ld a, [wcd4f] - ld hl, wcd4a - cp [hl] - jr z, .asm_118a3c - dec a - and $fe - srl a - ld [wcf65], a - ld a, [rSVBK] - push af - ld a, $1 - ld [rSVBK], a - call WriteBackup - pop af - ld [rSVBK], a - ld a, [wcd38] - and a - jr nz, .asm_118a30 - call Function119d93 - ret c - call Function119dd1 - ret c - -.asm_118a30 - ld a, [wcd4f] - ld [wd000 + $800], a - jp Function119e2e - -.asm_118a39 - call PlayClickSFX - -.asm_118a3c - ld a, [rSVBK] - push af - ld a, $1 - ld [rSVBK], a - call WriteBackup - pop af - ld [rSVBK], a - ld a, $7 - ld [wcf66], a - ld a, $0 - ld [wcd46], a - ret - - - -Function118a54: ; 118a54 - ld a, [wcd55] - ld l, a - ld a, [wcd56] - ld h, a - ld de, wc3ec - ld bc, $0004 - jp Function118ae4 -; 118a65 - -Function118a65: ; 118a65 - ld hl, BattleDownloadURL - ld de, wcc60 - ld bc, $80 - call CopyBytes - ld de, Unkn1Pals - ld bc, $1000 - jp Function118b10 -; 118a7a - -Function118a7a: ; 118a7a - ld hl, BattleDownloadURL - ld de, wcc60 - ld bc, $80 - call CopyBytes - ld de, Unkn1Pals - ld bc, $1000 - jp Function118b10 -; 118a8f - -Function118a8f: ; 118a8f - ld hl, ExchangeDownloadURL - ld de, wcc60 - ld bc, $80 - call CopyBytes - ld de, Unkn1Pals - ld bc, $1000 - jp Function118b10 -; 118aa4 - -Function118aa4: ; 118aa4 - ld hl, NewsDownloadURL - ld de, wcc60 - ld bc, $80 - call CopyBytes - ld a, $5 - ld [rSVBK], a - ld de, LYOverrides - ld bc, $e00 - jr Function118b10 -; 118abc - -Function118abc: ; 118abc (46:4abc) - ld hl, MenuDownloadURL - ld de, wcc60 - ld bc, $80 - call CopyBytes - ld de, Unkn1Pals - ld bc, $1000 - jr Function118b10 -; 118ad0 (46:4ad0) - -Function118ad0: - ld hl, IndexDownloadURL - ld de, wcc60 - ld bc, $80 - call CopyBytes - ld de, Unkn1Pals - ld bc, $1000 - jr Function118b10 - -Function118ae4: - push bc - push de - push hl - ld a, $8 - ld [wcd3c], a - call Function119ed8 - pop hl - ld c, $0 - ld de, wcc60 -.asm_118af5 - ld a, [hli] - ld [de], a - inc de - and a - jr z, .asm_118b06 - inc c - ld a, c - cp $a6 - jr c, .asm_118af5 - ld a, $da - jp Function118805 - -.asm_118b06 - call Function118b24 - pop de - pop bc - ld a, $2a - jp Function119e2b -; 118b10 - -Function118b10: - push de - push bc - ld a, $8 - ld [wcd3c], a - call Function119ed8 - call Function118b24 - pop bc - pop de - ld a, $2a - jp Function119e2b - -Function118b24: ; 118b24 (46:4b24) - ld hl, wPartyMonMenuIconAnims + 48 + 2 - ld a, $8 - ld [hli], a - ld a, $c7 - ld [hli], a - ld a, $60 - ld [hli], a - ld a, $cc - ld [hli], a - call Function119eb4 - call Function119ec2 - ld a, $80 - ld [wcd89], a - ld hl, wPartyMonMenuIconAnims + 48 + 2 - ret -; 118b42 (46:4b42) - -Function118b42: ; 118b42 - ld hl, DefaultFlypoint - ld a, l - ld [wcd51], a - ld a, h - ld [wcd52], a - call Function118b8c - ld a, l - ld [wcd55], a - ld [wcd59], a - ld a, h - ld [wcd56], a - ld [wcd5a], a - call Function118b8c - ld a, l - ld [wcd53], a - ld [wcd5d], a - ld a, h - ld [wcd54], a - ld [wcd5e], a - call Function118b8c - ld a, l - ld [wcd57], a - ld [wcd5b], a - ld a, h - ld [wcd58], a - ld [wcd5c], a - call Function118b8c - ld a, l - ld [wcd5f], a - ld a, h - ld [wcd60], a - ret -; 118b8c - -Function118b8c: ; 118b8c -.asm_118b8c - call Function118b9a - ret nc - ld a, [hli] - cp $d - jr nz, .asm_118b8c - dec hl - xor a -rept 2 - ld [hli], a -endr - ret -; 118b9a - -Function118b9a: ; 118b9a - ld a, h - cp $e0 - ret c - ld a, $d3 - call Function118805 - and a - ret -; 118ba5 - - - charmap " ", $20 ; revert to ascii - -ExchangeDownloadURL: ; 0x118ba5 - db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/exchange/index.txt", 0 - -BattleDownloadURL: ; 0x118bf7 - db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/battle/index.txt", 0 - -NewsDownloadURL: ; 0x118c47 - db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/news/index.txt", 0 - -MenuDownloadURL: ; 0x118c95 - db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/POKESTA/menu.cgb", 0 - -IndexDownloadURL: ; 0x118ce5 - db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/tamago/index.txt", 0 - - -Function118d35: ; 118d35 - ld hl, LYOverridesBackup - ld a, [wcd38] - and a - jr nz, .asm_118d6e - ld a, [hli] - cp $94 - jr nz, .asm_118d7b - ld a, [hl] - cp $5 - jr nz, .asm_118d7b - ld a, [wcd4f] - sla a - ld b, a - sla a - sla a - add b - ld b, a - ld a, $5 - call GetSRAMBank - ld a, b - ld [$b2fb], a - call CloseSRAM - callba Function170be4 - callba Function1700c4 - jr .asm_118d78 - -.asm_118d6e - ld a, [hli] - cp $96 - jr nz, .asm_118d7b - ld a, [hl] - cp $0 - jr nz, .asm_118d7b - -.asm_118d78 - jp Function119e2e - -.asm_118d7b - ld a, $d3 - jp Function118805 -; 118d80 - -Function118d80: ; 118d80 - call Function118e06 - ld a, [wcd38] - and a - jr z, .asm_118d8e - call Function119e2e - jr asm_118d9f - -.asm_118d8e - ld a, $9 - ld [wcd3c], a - ld a, $12 - ld [wcd45], a - call Function119e2e - -Function118d9b: - call Function119ed8 - ret c - -asm_118d9f - ld hl, $c608 - call Function119940 - ld a, [wcd38] - and a - jr nz, .asm_118db2 - ld a, $8f - ld [wcd3b], a - jr .asm_118db7 - -.asm_118db2 - ld a, $26 - ld [wcd3b], a - -.asm_118db7 - ld hl, $d800 - ld a, $8 - ld [hli], a - ld a, $c6 - ld [hli], a - ld a, [wcd3b] - ld [hli], a - xor a - ld [hli], a - ld a, $8 - ld [hli], a - ld a, $c7 - ld [hli], a - ld a, [wcd39] - ld [hli], a - ld a, [wcd3a] - ld [hli], a - call Function119eb4 - call Function119ec2 - ld a, $40 - ld [wcd89], a - ld hl, $d800 - ld de, $de00 - ld bc, $0200 - ld a, $2c - jp Function119e2b -; 118ded - -Function118ded: ; 118ded - ld a, [wcd38] - and a - jr z, .asm_118e03 - ld a, [rSVBK] - push af - ld a, $1 - ld [rSVBK], a - callba Function11b93b - pop af - ld [rSVBK], a - -.asm_118e03 - jp Function119e2e -; 118e06 - -Function118e06: ; 118e06 - ld hl, DefaultFlypoint - ld a, [wcd38] - and a - jr z, .asm_118e1d -.asm_118e0f - call Function118b9a - ret nc - ld a, [hli] - cp $d - jr nz, .asm_118e0f - ld a, [hli] - cp $a - jr nz, .asm_118e0f - -.asm_118e1d - ld a, l - ld [wcd39], a - ld a, h - ld [wcd3a], a -.asm_118e25 - call Function118b9a - ret nc - ld a, [hli] - cp $d - jr nz, .asm_118e25 - ld a, [hli] - cp $a - jr nz, .asm_118e25 - dec hl - xor a - ld [hld], a - ld [hl], a - jr asm_118e3e - -Function118e39: ; 118e39 (46:4e39) -.asm_118e39 - ld a, [hli] - and a - jr nz, .asm_118e39 - dec hl -asm_118e3e -.asm_118e3e - ld a, [hld] - cp $2f - jr nz, .asm_118e3e -rept 2 - inc hl -endr - ld de, wcd85 - ld c, $4 -.asm_118e4a - ld a, [hli] - cp $2e - jr z, .asm_118e63 - cp $30 - jr c, .asm_118e67 - cp $3a - jr nc, .asm_118e67 - sub $30 - add $f6 - ld [de], a - inc de - dec c - jr nz, .asm_118e4a - ld de, wcd85 -.asm_118e63 - ld a, $50 - ld [de], a - ret -.asm_118e67 - ld a, $f3 - ld [de], a - inc de - jr .asm_118e63 - -Function118e6d: ; 118e6d (46:4e6d) - xor a - ld [wcd65], a - ld a, $a - jp Function119e2b - -Function118e76: ; 118e76 (46:4e76) - ld a, $c - ld [wcd3c], a - jp Function119e2e - -Function118e7e: ; 118e7e (46:4e7e) - call Function119ed8 - ret c - ld a, $36 - jp Function119e2b - -Function118e87: ; 118e87 (46:4e87) - call Function119ed8 - ret c - ld a, [wcd33] - ld [wcf66], a - ret -; 118e92 (46:4e92) - -Function118e92: ; 118e92 - call Function118440 - call Function1191d3 - ld a, [wcd53] - ld l, a - ld a, [wcd54] - ld h, a - ld de, wcc60 - call Function1191ad - ret c - ld de, $d800 - ld bc, $0800 - jp Function118b10 -; 118eb0 - -Function118eb0: ; 118eb0 - call Function118440 - ld hl, $d802 - ld de, BGMapBuffer - ld bc, $000c - call CopyBytes - call Function1192cc - ret c - jp Function119e2e -; 118ec6 - -Function118ec6: ; 118ec6 - call Function118440 - call SpeechTextBox - ld hl, $d80e - ld de, wPartyMonMenuIconAnims + 12 - ld bc, $0026 - call CopyBytes - xor a - ld [wPartyMonMenuIconAnims + 11], a - ld a, $20 - ld [wPartyMonMenuIconAnims + 7], a - ld a, $c3 - ld [wPartyMonMenuIconAnims + 8], a - hlcoord 1, 14 - ld a, l - ld [wPartyMonMenuIconAnims + 9], a - ld a, h - ld [wPartyMonMenuIconAnims + 10], a - ld a, $2 - ld [wPartyMonMenuIconAnims + 6], a - ld a, $1d - ld [wcd3c], a - ld a, $24 - ld [wcd45], a - ld a, $11 - ld [wcd46], a - ld a, $1c - ld [wcd47], a - jp Function119e2e -; 118f0d - -Function118f0d: ; 118f0d - call Function119ed8 - ret c - call Function118440 - -Function118f14: - call Function118440 - ld a, [wcd51] - ld l, a - ld a, [wcd52] - ld h, a - ld de, wcc60 - call Function1191ad - ret c - ld a, [wcc60] - and a - jr z, .asm_118f32 - ld hl, UnknownText_0x11aa13 - call Function11a9c0 - -.asm_118f32 - ld a, [wcd57] - ld l, a - ld a, [wcd58] - ld h, a - ld de, wcc60 - call Function1191ad - ret c - ld hl, wcc60 - call Function118e39 - ld a, $9 - ld [wcd3c], a - ld a, $24 - ld [wcd45], a - ld a, $13 - ld [wcd46], a - ld a, $1c - ld [wcd47], a - jp Function119e2e -; 118f5e - -Function118f5e: ; 118f5e - call Function119ed8 - ret c - call Function118440 - call DelayFrame - -Function118f68: - call Function119223 - ret c - call Function118440 - ld a, [wcd51] - ld l, a - ld a, [wcd52] - ld h, a - ld de, wcc60 - call Function1191ad - ret c - ld a, [wcc60] - and a - jr z, .asm_118fba - ld hl, wPartyMonMenuIconAnims + 48 + 2 - ld a, $c608 % $100 - ld [hli], a - ld a, $c608 / $100 - ld [hli], a - ld a, [wcd4b] - ld [hli], a - ld a, [wcd4c] - ld [hli], a - ld a, wc708 % $100 - ld [hli], a - ld a, wc708 / $100 - ld [hli], a - ld a, $60 - ld [hli], a - ld a, $cc - ld [hli], a - call Function119eb4 - call Function119ec2 - ld a, $40 - ld [wcd89], a - ld hl, wPartyMonMenuIconAnims + 48 + 2 - ld de, $de00 - ld bc, $0200 - ld a, $2c - jp Function119e2b - -.asm_118fba - call Function119e2e - jp Function119e2e -; 118fc0 - -Function118fc0: ; 118fc0 - call Function118440 - ld a, [wcd55] - ld l, a - ld a, [wcd56] - ld h, a - ld de, wcc60 - call Function1191ad - ret c - ld a, [wcc60] - and a - jr z, .asm_118ffa - ld a, [wcd51] - ld l, a - ld a, [wcd52] - ld h, a - ld de, wcc60 - call Function1191ad - ret c - ld a, [wcc60] - and a - jr z, .asm_118ff2 - ld hl, UnknownText_0x11aa2c - jr .asm_118ff5 - -.asm_118ff2 - ld hl, UnknownText_0x11aa4b - -.asm_118ff5 - call Function11a9c0 - jr Function119009 - -.asm_118ffa - ld hl, UnknownText_0x11aa4b - call Function11a9c0 - call Function119e2e - call Function119e2e - jp Function119e2e - -Function119009: - call Function118440 - call Function119300 - ld a, [wcd55] - ld l, a - ld a, [wcd56] - ld h, a - ld de, wcc60 - call Function1191ad - ret c - ld hl, wPartyMonMenuIconAnims + 48 + 2 - ld a, $8 - ld [hli], a - ld a, $c6 - ld [hli], a - ld a, [wcd4b] - ld [hli], a - ld a, [wcd4c] - ld [hli], a - ld a, $8 - ld [hli], a - ld a, $c7 - ld [hli], a - ld a, $60 - ld [hli], a - ld a, $cc - ld [hli], a - call Function119eb4 - call Function119ec2 - ld a, $40 - ld [wcd89], a - ld hl, wPartyMonMenuIconAnims + 48 + 2 - ld de, Unkn1Pals - ld bc, $1000 - ld a, $2c - jp Function119e2b -; 119054 - -Function119054: ; 119054 - ld a, $6 - call GetSRAMBank - ld hl, DefaultFlypoint - ld a, [wcd4f] - ld e, a - ld a, [wcd50] - ld d, a - ld a, [Unkn1Pals] - ld c, a - ld a, [wd001] - ld b, a - call Function119192 - ret c - ld a, [wcd89] - and $1 - jr z, .asm_11908a - ld a, $6 - ld [rSVBK], a - ld hl, DefaultFlypoint - ld a, [Unkn1Pals] - ld c, a - ld a, [wd001] - ld b, a - call Function119192 - ret c - -.asm_11908a - call CloseSRAM - ld a, $3 - ld [rSVBK], a - ld a, $5 - call GetSRAMBank - ld a, [wcd4f] - ld [$b1b3], a - ld a, [wcd50] - ld [$b1b4], a - ld hl, BGMapBuffer - ld de, $aa7f - ld bc, $000c - call CopyBytes - ld a, [rSVBK] - push af - ld a, $1 - ld [rSVBK], a - ld a, [wd474] - ld [$b2f3], a - ld hl, wd475 - ld de, $b2f4 - ld bc, $0004 - call CopyBytes - pop af - ld [rSVBK], a - call CloseSRAM - jp Function119e2e -; 1190d0 - -Function1190d0: ; 1190d0 - ld a, $3 - ld [rSVBK], a - ld a, [wcd57] - ld l, a - ld a, [wcd58] - ld h, a - ld de, wcc60 - call Function1191ad - ret c - ld de, Unkn1Pals - ld bc, $1000 - jp Function118b10 -; 1190ec - -Function1190ec: ; 1190ec - ld a, $5 - call GetSRAMBank - ld hl, BGMapBuffer - ld de, $aa73 - ld bc, $000c - call CopyBytes - call CloseSRAM - ld a, $5 - call GetSRAMBank - ld a, $1 - ld [$aa72], a - call CloseSRAM - ld a, $6 - call GetSRAMBank - ld a, [Unkn1Pals] - ld c, a - ld a, [wd001] - ld b, a - ld hl, DefaultFlypoint - ld de, $a000 - call Function119192 - ret c - ld a, [wcd89] - and $1 - jr z, .asm_11913e - ld a, $6 - ld [rSVBK], a - ld a, [Unkn1Pals] - ld c, a - ld a, [wd001] - ld b, a - ld hl, DefaultFlypoint - call Function119192 - ret c - -.asm_11913e - ld a, $3 - ld [rSVBK], a - call CloseSRAM - ld hl, UnknownText_0x11aa5a - call Function11a9c0 - jp Function119e2e -; 11914e - -Function11914e: ; 11914e - call Function119ed8 - ret c - ld a, $1c - ld [wcf66], a - ld a, $a - ld [wc300], a - ret -; 11915d - -Function11915d: ; 11915d - ld hl, $d802 - ld de, BGMapBuffer - ld bc, $000c - call CopyBytes - ld a, $5 - call GetSRAMBank - ld hl, BGMapBuffer - ld de, $aa7f - ld c, $c -.asm_119176 - ld a, [de] - inc de - cp [hl] - jr nz, .asm_119184 - inc hl - dec c - jr nz, .asm_119176 - call Function119e2e - jr .asm_11918e - -.asm_119184 - ld a, $16 - ld [wcf66], a - ld a, $b - ld [wc300], a - -.asm_11918e - call CloseSRAM - ret -; 119192 - -Function119192: ; 119192 - inc b - inc c - jr .asm_11919e - -.asm_119196 - ld a, [hli] - ld [de], a - inc de - ld a, $bf - cp d - jr c, .asm_1191a6 - -.asm_11919e - dec c - jr nz, .asm_119196 - dec b - jr nz, .asm_119196 - and a - ret - -.asm_1191a6 - ld a, $d3 - call Function118805 - scf - ret -; 1191ad - -Function1191ad: ; 1191ad - push bc - ld c, $0 - ld a, $5 - ld [rSVBK], a -.asm_1191b4 - ld a, [hli] - ld [de], a - inc de - and a - jr z, .asm_1191cc - inc c - ld a, c - cp $a6 - jr c, .asm_1191b4 - ld a, $da - call Function118805 - ld a, $3 - ld [rSVBK], a - pop bc - scf - ret - -.asm_1191cc - ld a, $3 - ld [rSVBK], a - pop bc - and a - ret -; 1191d3 - -Function1191d3: ; 1191d3 - ld hl, wd102 - ld a, l - ld [wcd53], a - ld a, h - ld [wcd54], a - call Function11920f - ld a, l - ld [wcd51], a - ld a, [wcd4a] - ld a, h - ld [wcd52], a - call Function11920f - ld a, l - ld [wcd55], a - ld a, [wcd4a] - ld a, h - ld [wcd56], a - call Function11920f - ld a, [wcd49] - ld a, l - ld [wcd57], a - ld a, [wcd4a] - ld a, h - ld [wcd58], a - call Function11920f - ret -; 11920f - -Function11920f: ; 11920f -.asm_11920f - call Function118b9a - ret nc - ld a, [hli] - cp $d - jr nz, .asm_11920f - ld a, [hli] - cp $a - jr nz, .asm_11920f - dec hl - xor a - ld [hld], a - ld [hli], a - inc hl - ret -; 119223 - -Function119223: ; 119223 - xor a - ld [wcd4b], a - ld [wcd4c], a - ld a, $5 - call GetSRAMBank - ld hl, wc3cd - ld de, $b092 - ld bc, $001f - call CopyBytes - dec de - xor a - ld [de], a - ld hl, $d810 -.asm_119241 - ld a, [hli] - cp $50 - jr nz, .asm_119241 - ld a, [hli] - ld [wcd4f], a - ld a, [hli] - ld [wcd50], a - ld a, [hli] - ld [$b1b1], a - ld c, a - ld a, [hli] - ld [$b1b2], a - ld b, a - ld de, $b1d3 - call CopyBytes - call CloseSRAM - ld e, l - ld d, h - ld hl, $c608 -.asm_119266 - ld a, [de] - inc de - cp $ff - jr z, .asm_1192c2 - cp $fe - jr z, .asm_1192a5 - call GetSRAMBank - ld a, [de] - inc de - ld c, a - ld a, [de] - inc de - ld b, a - ld a, [de] - inc de - push de - push af - ld a, [wcd4b] - ld e, a - ld a, [wcd4c] - ld d, a - pop af -.asm_119286 - push af - ld a, [bc] - inc bc - ld [hli], a - inc de - pop af - dec a - jr nz, .asm_119286 - call CloseSRAM - ld a, e - ld [wcd4b], a - ld a, d - ld [wcd4c], a - pop de -.asm_11929b - and a - jr z, .asm_119266 - ld a, $d3 - call Function118805 - scf - ret - -.asm_1192a5 - ld a, [wcd4b] - ld c, a - ld a, [wcd4c] - ld b, a - ld a, [de] - inc de -.asm_1192af - push af - ld a, [de] - inc de - ld [hli], a - inc bc - pop af - dec a - jr nz, .asm_1192af - ld a, c - ld [wcd4b], a - ld a, b - ld [wcd4c], a - jr .asm_11929b - -.asm_1192c2 - ld a, e - ld [wcd4d], a - ld a, d - ld [wcd4e], a - and a - ret -; 1192cc - -Function1192cc: ; 1192cc - ld a, $5 - call GetSRAMBank - ld hl, $aa73 - ld de, $c608 - ld bc, $000c - call CopyBytes - call CloseSRAM - ld hl, $c608 - ld de, BGMapBuffer - ld c, $c -.asm_1192e8 - ld a, [de] - inc de - ld b, a - ld a, [hli] - cp b - jr nz, .asm_1192fe - dec c - jr nz, .asm_1192e8 - ld a, $1f - ld [wcd3c], a - ld a, $27 - ld [wcf66], a - scf - ret - -.asm_1192fe - and a - ret -; 119300 - -Function119300: ; 119300 - xor a - ld [wcd4b], a - ld [wcd4c], a - ld a, [wcd4d] - ld e, a - ld a, [wcd4e] - ld d, a - ld hl, $c608 - ld a, [wcd4b] - ld c, a - ld a, [wcd4c] - ld b, a -.asm_11931a - ld a, [de] - inc de - cp $50 - jr z, .asm_119324 - ld [hli], a - inc bc - jr .asm_11931a - -.asm_119324 - ld a, $3d - ld [hli], a - inc bc - ld a, c - ld [wcd4b], a - ld a, b - ld [wcd4c], a - ld a, [de] - inc de - call GetSRAMBank - ld a, [de] - inc de - ld c, a - ld a, [de] - inc de - ld b, a - ld a, [de] - inc de - push de - push af - ld a, [wcd4b] - ld e, a - ld a, [wcd4c] - ld d, a - pop af -.asm_119348 - push af - ld a, [bc] - and $f0 - swap a - call Function1197bf - ld [hli], a - inc de - ld a, [bc] - inc bc - and $f - call Function1197bf - ld [hli], a - inc de - pop af - dec a - jr nz, .asm_119348 - call CloseSRAM - ld a, e - ld [wcd4b], a - ld a, d - ld [wcd4c], a - pop de - ld a, [de] - cp $50 - jr z, .asm_11937f - ld a, [wcd4b] - ld c, a - ld a, [wcd4c] - ld b, a - ld a, $26 - ld [hli], a - inc bc - jr .asm_11931a - -.asm_11937f - ret -; 119380 - -Function119380: ; 119380 - ld a, $80 - ld [wcd49], a - jp Function119e2e -; 119388 - -Function119388: ; 119388 - ld hl, wcd49 - dec [hl] - ret nz - ld hl, wcc60 - call Function118e39 - ld a, $9 - ld [wcd3c], a - ld a, $10 - ld [wcd45], a - call Function119e2e - -Function1193a0: - call Function119ed8 - ret c - call DelayFrame - ld a, $8 - ld [wcd3c], a - call Function119ed8 - ld hl, wPartyMonMenuIconAnims + 48 + 2 - ld a, wd000 % $100 - ld [hli], a - ld a, wd000 / $100 - ld [hli], a - ld a, [wcd3b] - ld [hli], a - xor a - ld [hli], a - ld a, wc708 % $100 - ld [hli], a - ld a, wc708 / $100 - ld [hli], a - ld a, $60 - ld [hli], a - ld a, $cc - ld [hli], a - call Function119eb4 - call Function119ec2 - ld a, $40 - ld [wcd89], a - ld hl, wPartyMonMenuIconAnims + 48 + 2 - ld de, $de00 - ld bc, $0200 - ld a, $2c - jp Function119e2b -; 1193e3 - -Function1193e3: ; 1193e3 - ld hl, wcd49 - dec [hl] - ret nz - ld hl, wcc60 - call Function118e39 - ld a, $9 - ld [wcd3c], a - ld a, $11 - ld [wcd45], a - call Function119e2e - -Function1193fb: - call Function119ed8 - ret c - call DelayFrame - ld a, $8 - ld [wcd3c], a - call Function119ed8 - ld de, Unkn1Pals - ld bc, $1000 - jp Function118b10 -; 119413 - -Function119413: ; 119413 - ld a, $6 - call GetSRAMBank - ld a, [Unkn1Pals] - ld c, a - ld a, [wd001] - ld b, a -rept 2 - dec bc -endr - ld hl, wd002 - ld a, [hli] - ld e, a - ld a, [hli] - ld d, a - call Function119192 - ret c - ld a, [wcd89] - and $1 - jr z, .asm_119447 - ld a, $6 - ld [rSVBK], a - ld a, [wd000] - ld c, a - ld a, [wd001] - ld b, a - ld hl, wd002 - call Function119192 - ret c - -.asm_119447 - ld a, $3 - ld [rSVBK], a - call CloseSRAM - jp Function119e2e -; 119451 - -Function119451: ; 119451 (46:5451) - ld a, [wcd89] - and $1 - jr z, .asm_11945d - ld a, $d3 - jp Function118805 -.asm_11945d - xor a - ld [wcd50], a - call Function119694 - ld a, b - ld [wcd49], a - call Function1196cd - ld a, [DefaultFlypoint] - ld hl, wd003 - -Function119471: ; 119471 (46:5471) - push af - ld a, [hli] - ld [$c608], a - ld a, [hli] - ld [$c608 + 3], a - ld a, [hli] - ld [$c608 + 1], a - ld a, [hli] - ld [$c608 + 2], a - ld a, [hli] - ld [$c608 + 4], a - ld a, [hli] - ld [$c608 + 5], a ; $c608 + 5 - push hl - ld a, [$c608] - cp $ff - jr z, .asm_1194a7 - ld a, [$c608 + 2] - cp $ff - jr z, .asm_1194a7 - ld a, [$c608 + 1] - cp $ff - jr nz, .asm_1194a7 - call Function119584 - jr c, .asm_11950c - jr .asm_1194f0 -.asm_1194a7 - ld hl, $c608 - ld de, $c608 + 3 - ld c, $3 -.asm_1194af - ld a, [de] - inc de - cp [hl] - inc hl - jr c, .asm_1194f3 - jr z, .asm_1194b9 - jr nc, .asm_1194bc -.asm_1194b9 - dec c - jr nz, .asm_1194af -.asm_1194bc - ld c, $3 - ld hl, wcd49 - ld de, $c608 -.asm_1194c4 - ld a, [de] - inc de - cp $ff - jr z, .asm_1194d1 - cp [hl] - jr z, .asm_1194d1 - jr c, .asm_1194d5 - jr nc, .asm_1194f0 -.asm_1194d1 - inc hl - dec c - jr nz, .asm_1194c4 -.asm_1194d5 - ld c, $3 - ld hl, wcd49 - ld de, $c608 + 3 -.asm_1194dd - ld a, [de] - inc de - cp $ff - jr z, .asm_1194ea - cp [hl] - jr c, .asm_1194f0 - jr z, .asm_1194ea - jr nc, .asm_11950c -.asm_1194ea - inc hl - dec c - jr nz, .asm_1194dd - jr .asm_11950c -.asm_1194f0 - pop hl - jr .asm_119557 -.asm_1194f3 - ld c, $3 - ld hl, wcd49 - ld de, $c608 -.asm_1194fb - ld a, [de] - inc de - cp $ff - jr z, .asm_119508 - cp [hl] - jr c, .asm_11950c - jr z, .asm_119508 - jr nc, .asm_1194d5 -.asm_119508 - inc hl - dec c - jr nz, .asm_1194fb -.asm_11950c - pop hl - ld a, $1 - ld [wcd50], a - ld a, l - ld [$c608], a - ld a, h - ld [$c608 + 1], a - ld de, wcd69 - ld c, $10 - ld b, $0 -.asm_119521 - ld a, [de] - inc de - cp [hl] - inc hl - jr nz, .asm_119528 - inc b -.asm_119528 - dec c - jr nz, .asm_119521 - ld a, $10 - cp b - jr z, .asm_119536 -rept 4 - inc hl -endr - jr .asm_11957a -.asm_119536 - ld a, [hli] - cp $50 - jr nz, .asm_119552 - ld a, [hli] - cp $33 - jr nz, .asm_119553 - ld a, [hli] - ld c, a - ld a, [hli] - ld b, a - ld a, [wcd83] - cp c - jr nz, .asm_119576 - ld a, [wcd84] - cp b - jr nz, .asm_119576 - jr .asm_11955b -.asm_119552 - inc hl -.asm_119553 -rept 2 - inc hl -endr - jr .asm_11955b -.asm_119557 - ld de, $14 - add hl, de -.asm_11955b - ld a, [hli] - ld e, a - ld a, [hli] - ld d, a - add hl, de - pop af - dec a - jp nz, Function119471 - ld a, [wcd50] - and a - jr z, .asm_119571 - ld a, $1a - ld [wcf66], a - ret -.asm_119571 - ld a, $d8 - jp Function118805 -.asm_119576 - ld a, $10 - jr .asm_11957c -.asm_11957a - ld a, $f -.asm_11957c - ld [wcf66], a - pop af - call Function1195c4 - ret - -Function119584: ; 119584 (46:5584) - ld a, [$c608] - ld b, a - ld a, [$c608 + 3] - ld c, a - cp b - jr c, .asm_11959c - ld a, [wcd49] - cp b - jr c, .asm_1195c2 -.asm_119595 - cp c - jr c, .asm_1195a2 - jr z, .asm_1195a2 - jr .asm_1195c2 -.asm_11959c - ld a, [wcd49] - cp b - jr c, .asm_119595 -.asm_1195a2 - ld a, [$c608 + 2] - ld b, a - ld a, [$c608 + 5] ; $c608 + 5 - ld c, a - cp b - jr c, .asm_1195ba - ld a, [wcd4b] - cp b - jr c, .asm_1195c2 -.asm_1195b3 - cp c - jr c, .asm_1195c0 - jr z, .asm_1195c0 - jr .asm_1195c2 -.asm_1195ba - ld a, [wcd4b] - cp b - jr c, .asm_1195b3 -.asm_1195c0 - scf - ret -.asm_1195c2 - and a - ret - -Function1195c4: ; 1195c4 (46:55c4) - ld a, [hli] - ld c, a - ld a, [hli] - ld b, a - ld de, $a5 - ld a, b - cp d - jr c, .asm_1195d9 - jr z, .asm_1195d3 - jr nc, .asm_1195f3 -.asm_1195d3 - ld a, c - cp e - jr z, .asm_1195d9 - jr nc, .asm_1195f3 -.asm_1195d9 - ld de, wcc60 - call CopyBytes - xor a - ld [de], a - ld a, [$c608] - ld l, a - ld a, [$c608 + 1] - ld h, a - ld de, wcd69 - ld bc, $10 - call CopyBytes - ret -.asm_1195f3 - ld a, $d8 - jp Function118805 - -Function1195f8: ; 1195f8 (46:55f8) - ld a, $11 - ld [wcd3c], a - ld a, $1c - ld [wcd45], a - ld a, $f - ld [wcd46], a - ld a, $14 - ld [wcd47], a - call Function119e2e - jp Function119e2e - -Function119612: ; 119612 (46:5612) - ld a, $14 - ld [wcd3c], a - ld a, $1c - ld [wcd45], a - ld a, $10 - ld [wcd46], a - ld a, $14 - ld [wcd47], a - jp Function119e2e - -Function119629: ; 119629 (46:5629) - call Function119ed8 - ret c - ld a, $60 - ld l, a - ld a, $cc - ld h, a - call Function118e39 - ld a, $9 - ld [wcd3c], a - ld a, $1c - ld [wcd45], a - ld a, $14 - ld [wcd47], a - call Function119e2e - -Function119648: ; 119648 (46:5648) - call Function119ed8 - ret c - call DelayFrame - ld a, $8 - ld [wcd3c], a - call Function119ed8 - call Function118b24 - ld de, Unkn1Pals - ld bc, $1000 - ld a, $2a - jp Function119e2b - -Function119665: ; 119665 (46:5665) - ld a, $1a - ld [wcd3c], a - call Function119e2e - -Function11966d: ; 11966d (46:566d) - call Function119ed8 - ret c - ld a, [wcd47] - ld [wcf66], a - ld a, $a - ld [wc300], a - ret - -Function11967d: ; 11967d (46:567d) - ld a, $18 - ld [wcd3c], a - call Function119e2e - -Function119685: ; 119685 (46:5685) - call Function119ed8 - ret c - ld a, $14 - ld [wcf66], a - ld a, $a - ld [wc300], a - ret - -Function119694: ; 119694 (46:5694) - ld b, 0 - ld hl, Unknown_1196b8 -.asm_119699 - ld de, wc708 - ld a, [de] - inc de - cp [hl] - inc hl - jr nz, .asm_1196af - ld a, [de] - inc de - cp [hl] - inc hl - jr nz, .asm_1196b0 - ld a, [de] - inc de - cp [hl] - inc hl - jr nz, .asm_1196b1 - ret -.asm_1196af - inc hl -.asm_1196b0 - inc hl -.asm_1196b1 - inc b - ld a, b - cp $7 - jr nz, .asm_119699 - ret -; 1196b8 (46:56b8) - -Unknown_1196b8: ; 1196b8 - db "Mon" - db "Tue" - db "Wed" - db "Thu" - db "Fri" - db "Sat" - db "Sun" -; 1196cd - -SECTION "bank46_2", ROMX, BANK[$46] -; A hack to use ascii above. - -Function1196cd: ; 1196cd (46:56cd) - ld de, wc719 - call Function1196de - ld [wcd4a], a - inc de - call Function1196de - ld [wcd4b], a - ret - -Function1196de: ; 1196de (46:56de) - ld a, [de] - inc de - sub $30 - sla a - ld b, a - sla a - sla a - add b - ld c, a - add hl, bc - ld a, [de] - inc de - sub $30 - add c - ret -; 1196f2 (46:56f2) - -Function1196f2: ; 1196f2 - ld hl, DefaultFlypoint -.asm_1196f5 - call Function118b9a - ret nc - ld a, [hli] - cp $d - jr nz, .asm_1196f5 - ld a, [hl] - cp $a - jr nz, .asm_1196f5 - xor a - ld [hld], a - ld [hli], a - ld a, l - ld [wcd5b], a - ld a, h - ld [wcd5c], a - inc hl - ld e, l - ld d, h - ld a, [de] - inc de - cp $d - jr nz, .asm_119722 - ld a, [de] - inc de - cp $a - jr nz, .asm_119722 - ld a, $b - jp Function118805 - -.asm_119722 - call Random - ld c, $0 - ld b, c -.asm_119728 - call Function119798 - ld a, d - cp $ff - jr nz, .asm_119735 - ld a, e - cp $ff - jr z, .asm_11974c - -.asm_119735 - ld a, [hRandomSub] - cp d - jr c, .asm_11974c - jr z, .asm_11973e - jr .asm_119745 - -.asm_11973e - ld a, [hRandomAdd] - cp e - jr c, .asm_11974c - jr z, .asm_11974c - -.asm_119745 - inc bc - ld a, c - or b - jr z, .asm_119770 - jr .asm_119728 - -.asm_11974c - ld a, [wcd5b] - ld l, a - ld a, [wcd5c] - ld h, a -.asm_119754 - ld a, [hld] - cp $58 - jr nz, .asm_119754 - ld d, $0 -.asm_11975b - inc d - ld a, [hld] - cp $58 - jr z, .asm_11975b -rept 2 - inc hl -endr - ld a, d - dec a - jr z, .asm_11978e - dec a - jr z, .asm_119785 - dec a - jr z, .asm_11977e - dec a - jr z, .asm_119775 - -.asm_119770 - ld a, $d3 - jp Function118805 - -.asm_119775 - ld a, b - and $f0 - swap a - call Function1197bf - ld [hli], a - -.asm_11977e - ld a, b - and $f - call Function1197bf - ld [hli], a - -.asm_119785 - ld a, c - and $f0 - swap a - call Function1197bf - ld [hli], a - -.asm_11978e - ld a, c - and $f - call Function1197bf - ld [hli], a - jp Function119e2e -; 119798 - -Function119798: ; 119798 - ld d, $0 - ld e, d - call Function1197b4 - swap a - or d - ld d, a - call Function1197b4 - or d - ld d, a - call Function1197b4 - swap a - or e - ld e, a - call Function1197b4 - or e - ld e, a - ret -; 1197b4 - -Function1197b4: ; 1197b4 - ld a, [hli] - cp $61 - jr nc, .asm_1197bc - sub $30 - ret - -.asm_1197bc - sub $57 - ret -; 1197bf - -Function1197bf: ; 1197bf - cp $a - jr nc, .asm_1197c6 - add $30 - ret - -.asm_1197c6 - add $57 - ret -; 1197c9 - -Function1197c9: ; 1197c9 - ld hl, DefaultFlypoint - call Function118e39 - ld a, $9 - ld [wcd3c], a - ld a, $12 - ld [wcd45], a - call Function119e2e - -Function1197dc: - call Function119ed8 - ret c - call DelayFrame - ld hl, DefaultFlypoint - ld de, wcc60 - ld bc, $0080 - call CopyBytes - dec de - xor a - ld [de], a - call Function118b24 - ld de, Unkn1Pals - ld bc, $1000 - ld a, $2a - jp Function119e2b -; 119800 - -Function119800: ; 119800 - ld a, $fd - ld [$c6d0], a - ld [wc702], a - ld a, [wcd81] - ld [wc74e], a - ld a, [wJumptableIndex] - push af - ld a, [wcf64] - push af - ld a, [wcf65] - push af - ld a, [wcf66] - push af - ld a, $1 - ld [rSVBK], a - call FadeToMenu - callba Function10803d - call Function11a9ce - call RestartMapMusic - ld a, $3 - ld [rSVBK], a - pop af - ld [wcf66], a - pop af - ld [wcf65], a - pop af - ld [wcf64], a - pop af - ld [wJumptableIndex], a - callba Function115dc3 - jp Function119e2e -; 11984e - -Function11984e: ; 11984e - ld a, [wcd80] - and a - jr nz, .asm_1198a0 - ld a, [wcd38] - and a - jr nz, .asm_1198a8 - callba Function170000 - ld a, [wJumptableIndex] - push af - ld a, [wcf64] - push af - ld a, [wcf65] - push af - ld a, [wcf66] - push af - ld a, $1 - ld [rSVBK], a - call FadeToMenu - callba Function108000 - call Function11a9ce - call RestartMapMusic - ld a, $3 - ld [rSVBK], a - pop af - ld [wcf66], a - pop af - ld [wcf65], a - pop af - ld [wcf64], a - pop af - ld [wJumptableIndex], a - callba Function115dc3 - jp Function119e2e - -.asm_1198a0 - ld a, $a - ld [wc300], a - jp Function119e2e - -.asm_1198a8 - callba Function17005a - ld a, [wJumptableIndex] - push af - ld a, [wcf64] - push af - ld a, [wcf65] - push af - ld a, [wcf66] - push af - ld a, $1 - ld [rSVBK], a - call FadeToMenu - callba Function108012 - call Function11a9ce - call RestartMapMusic - ld a, $3 - ld [rSVBK], a - pop af - ld [wcf66], a - pop af - ld [wcf65], a - pop af - ld [wcf64], a - pop af - ld [wJumptableIndex], a - callba Function115dc3 - jp Function119e2e -; 1198ee - -Function1198ee: ; 1198ee - ld hl, UnknownText_0x11aab2 - call Function11a9c0 - call Function119e2e - -Function1198f7: - ld a, [wPartyMonMenuIconAnims + 6] - and a - ret nz - ld hl, $c608 + 2 - call Function119940 - ld hl, $d800 - ld a, $c608 % $100 - ld [hli], a - ld a, $c608 / $100 - ld [hli], a - ld a, $f6 - ld [hli], a - xor a - ld [hli], a - ld a, wc708 % $100 - ld [hli], a - ld a, wc708 / $100 - ld [hli], a - ld a, [wcd51] - ld [hli], a - ld a, [wcd52] - ld [hli], a - call Function119eb4 - call Function119ec2 - ld a, $40 - ld [wcd89], a - ld hl, $d800 - ld de, $de00 - ld bc, $0200 - ld a, $2c - jp Function119e2b -; 119937 - -Function119937: ; 119937 - callba Function1707f4 - jp Function119e2e -; 119940 - -Function119940: ; 119940 - ld de, wc3cd - ld c, $1e -.asm_119945 - ld a, [de] - inc de - ld [hli], a - dec c - jr z, .asm_119953 - and a - jr nz, .asm_119945 - xor a -.asm_11994f - ld [hli], a - dec c - jr nz, .asm_11994f - -.asm_119953 - ret -; 119954 - -Function119954: ; 119954 - ld a, $1c - ld [wcd3c], a - call Function119ed8 - ld hl, $c608 - ld de, wc3cd -.asm_119962 - ld a, [de] - inc de - ld [hli], a - and a - jr nz, .asm_119962 - call Function119ec2 - ld hl, $c608 - ld a, $1e - jp Function119e2b -; 119973 - -Function119973: ; 119973 - ld a, $1 - ld [wcf64], a - xor a - ld [wcf65], a - ld [StringBuffer2 + 10], a - ld de, Unkn1Pals - ld a, $20 - jp Function119e2b -; 119987 - -Function119987: ; 119987 - ld hl, wd001 - ld a, [Unkn1Pals] - or [hl] - jr z, .asm_1199a0 - ld a, [wcf64] - ld l, a - ld a, [wcf65] - ld h, a - ld de, BGPals - ld a, $22 - jp Function119e2b - -.asm_1199a0 - ld a, [StringBuffer2 + 10] - and a - jr z, .asm_1199ae - ld a, $16 - ld [wcf66], a - jp Function119b0d - -.asm_1199ae - ld a, $1b - ld [wcf66], a - ret -; 1199b4 - -Function1199b4: ; 1199b4 - ld a, [wd000 + 130] - and a - jr nz, .asm_1199c7 - ld a, [wd000 + 129] - cp $7 - jr nc, .asm_1199c7 - call Function119e2e - jp Function1199ca - -.asm_1199c7 - jp Function119ac9 -; 1199ca - -Function1199ca: ; 1199ca - ld a, $20 - ld [wcd89], a - ld a, [wcf64] - ld l, a - ld a, [wcf65] - ld h, a - ld de, LYOverrides - ld bc, $0700 - ld a, $28 - jp Function119e2b -; 1199e2 - -Function1199e2: ; 1199e2 - ld c, $c - ld de, Unknown_119e33 - call Function119e4f - jp c, Function119ac9 - ld a, c - cp $1 - jp nz, Function119ac9 - ld hl, $d880 - ld bc, Unknown_119af1 -.asm_1199f9 - ld a, [bc] - and a - jr z, .asm_119a05 - cp [hl] - jp nz, Function119ac9 - inc bc - inc hl - jr .asm_1199f9 - -.asm_119a05 - ld c, $17 - ld de, Unknown_119e40 - call Function119e4f - jp c, .asm_119aa7 - ld a, c - cp $1 - jp nz, .asm_119aa7 - ld a, [wd000 + $880] - cp $31 - jp nz, .asm_119aa7 - ld a, [wd000 + $881] - cp $20 - jp nz, .asm_119aa7 - ld a, [wd000 + $88a] - cp $20 - jp nz, .asm_119aa7 - ld a, [wd000 + $894] - cp $20 - jp nz, .asm_119aa7 - xor a - ld [wd000 + $8a0], a - ld [wd000 + $8a1], a - ld [wd000 + $8a2], a - ld [wd000 + $8a3], a - ld hl, $d8a0 - ld bc, $d889 - call Function119e98 - call Function119e98 - ld hl, $d8a0 - ld a, [wcd2d] - cp [hl] - jr nz, Function119ac9 - inc hl - ld a, [wcd2c] - cp [hl] - jr nz, Function119ac9 - inc hl - ld a, [wcd2b] - cp [hl] - jr nz, Function119ac9 - inc hl - ld a, [wcd2a] - cp [hl] - jr nz, Function119ac9 - xor a - ld [wd000 + $8a0], a - ld [wd000 + $8a1], a - ld [wd000 + $8a2], a - ld [wd000 + $8a3], a - ld hl, $d8a0 - ld bc, $d88e - call Function119e98 - ld bc, $d893 - call Function119e98 - ld hl, $d8a0 - ld a, [wcd2f] - cp [hl] - jr nz, .asm_119aa7 - inc hl - ld a, [wcd2e] - cp [hl] - jr nz, .asm_119aa7 - inc hl - ld a, [wcd31] - cp [hl] - jr nz, .asm_119aa7 - inc hl - ld a, [wcd30] - cp [hl] - jr z, .asm_119aaf - -.asm_119aa7 - ld a, $25 - ld [wcf66], a - jp Function119b45 - -.asm_119aaf - ld a, [StringBuffer2 + 10] - and a - jr nz, .asm_119aa7 - ld a, [wd000 + $895] - sub $30 - ld [StringBuffer2 + 10], a - ld a, [wcf64] - ld [StringBuffer2 + 11], a - ld a, [wcf65] - ld [StringBuffer2 + 12], a - -Function119ac9: - ld a, [Unkn1Pals] - ld l, a - ld a, [wd001] - ld h, a - dec hl - ld a, l - ld [Unkn1Pals], a - ld a, h - ld [wd001], a - ld a, [wcf64] - ld l, a - ld a, [wcf65] - ld h, a - inc hl - ld a, l - ld [wcf64], a - ld a, h - ld [wcf65], a - ld a, $10 - ld [wcf66], a - ret -; 119af1 - -Unknown_119af1: - INCBIN "data/mobile/x-game-code.txt" - INCBIN "data/mobile/x-game-result.txt" -; 119b0d - -Function119b0d: ; 119b0d - ld a, $8 - ld [wcd3c], a - call Function119ed8 - ld a, [StringBuffer2 + 10] - cp $1 - jr z, .asm_119b23 - ld a, $19 - ld [wcf66], a - jr Function119b3b - -.asm_119b23 - ld a, $10 - ld [wcd89], a - ld a, [StringBuffer2 + 11] - ld l, a - ld a, [StringBuffer2 + 12] - ld h, a - ld de, LYOverrides - ld bc, $0700 - ld a, $24 - jp Function119e2b - -Function119b3b: - ld a, [StringBuffer2 + 11] - ld l, a - ld a, [StringBuffer2 + 12] - ld h, a - jr asm_119b4d - -Function119b45: - ld a, [wcf64] - ld l, a - ld a, [wcf65] - ld h, a - -asm_119b4d - ld a, $26 - jp Function119e2b -; 119b52 - -Function119b52: ; 119b52 - ld a, [StringBuffer2 + 10] - cp $1 - jr nz, .asm_119b66 - ld a, $5 - call GetSRAMBank - ld a, $4 - ld [$a800], a - call CloseSRAM - -.asm_119b66 - ld a, $1c - jp Function119e2b -; 119b6b - -Function119b6b: ; 119b6b - ld a, [StringBuffer2 + 10] - cp $1 - jr z, .asm_119b75 - jp Function119e2e - -.asm_119b75 - ld a, [LYOverrides] - ld b, a - ld a, [wd101] - or b - jr z, .asm_119be3 - ld hl, $d800 - ld de, wd102 -.asm_119b85 - ld a, [de] - inc de - cp $d - jr nz, .asm_119b85 - inc de - ld a, [de] - cp $d - jr nz, .asm_119b85 -rept 2 - inc de -endr -.asm_119b93 - ld a, [de] - inc de - cp $d - jr z, .asm_119bfa - call Function119c3e - ret c - ld [hli], a - ld a, [de] - inc de - call Function119c3e - ret c - ld [hli], a - ld a, [de] - inc de - call Function119c3e - ret c - ld [hli], a - ld a, [de] - inc de - call Function119c3e - ret c - ld [hl], a - push de - ld d, [hl] - dec hl - ld c, [hl] - dec hl - ld b, [hl] - dec hl - ld a, [hl] - sla b - sla b - sla b - rla - sla b - rla - ld [hli], a - ld [hl], b - inc hl - rrc c - rrc c - ld [hl], c - dec hl - ld a, $f - and c - or [hl] - ld [hli], a - ld a, [hli] - and $c0 - or [hl] - dec hl - ld [hld], a - dec hl - pop de -rept 3 - inc hl -endr - ld a, h - cp $e0 - jr c, .asm_119b93 - -.asm_119be3 - ld a, $19 - ld [wcf66], a - ld a, $5 - call GetSRAMBank - ld a, $1 - ld [$a800], a - call CloseSRAM - xor a - ld [StringBuffer2 + 10], a - ret - -.asm_119bfa - inc de - ld a, [de] - cp $d - jr nz, .asm_119b93 - ld a, l - cp (wd000 + $800 + $69) % $100 - jr nz, .asm_119be3 - ld a, h - cp (wd000 + $800 + $69) / $100 - jr nz, .asm_119be3 - ld a, $5 - call GetSRAMBank - ld a, [wcf64] - ld [$b090], a - ld a, [wcf65] - ld [$b091], a - ld hl, $d800 - ld de, $b023 - ld bc, $0069 - call CopyBytes - ld a, $3 - ld [$a800], a - call CloseSRAM - ld hl, $d800 - ld de, $c608 - ld bc, $0069 - call CopyBytes - jp Function119e2e -; 119c3e - -Function119c3e: ; 119c3e - cp $2b - jr c, .asm_119c68 - jr z, .asm_119c80 - cp $2f - jr c, .asm_119c68 - jr z, .asm_119c84 - cp $30 - jr c, .asm_119c68 - cp $3a - jr c, .asm_119c88 - cp $3d - jr c, .asm_119c68 - jr z, .asm_119c8c - cp $41 - jr c, .asm_119c68 - cp $5b - jr c, .asm_119c8f - cp $61 - jr c, .asm_119c68 - cp $7b - jr c, .asm_119c93 - -.asm_119c68 - ld a, $19 - ld [wcf66], a - ld a, $5 - call GetSRAMBank - ld a, $1 - ld [$a800], a - call CloseSRAM - xor a - ld [StringBuffer2 + 10], a - scf - ret - -.asm_119c80 - ld a, $3e - and a - ret - -.asm_119c84 - ld a, $3f - and a - ret - -.asm_119c88 - add $4 - and a - ret - -.asm_119c8c - xor a - and a - ret - -.asm_119c8f - sub $41 - and a - ret - -.asm_119c93 - sub $47 - and a - ret -; 119c97 - -Function119c97: ; 119c97 - ld hl, UnknownText_0x11ab0f - call Function11a9c0 - call Function119e2e - jr Function119cab - -Function119ca2: - ld hl, UnknownText_0x11aaf0 - call Function11a9c0 - call Function119e2e - -Function119cab: - ld a, [wPartyMonMenuIconAnims + 6] - and a - ret nz - ld a, $80 - ld [wcd50], a - call Function119e2e - -Function119cb8: - ld hl, wcd50 - dec [hl] - ret nz - ld a, $0 - ld [wcf66], a - ret -; 119cc3 - -Function119cc3: ; 119cc3 - ld a, [wcd38] - and a - jr z, .asm_119cd1 - dec a - jr z, .asm_119cd6 - ld hl, UnknownText_0x11aa6a - jr .asm_119cd9 - -.asm_119cd1 - ld hl, UnknownText_0x11ab4a - jr .asm_119cd9 - -.asm_119cd6 - ld hl, UnknownText_0x11ab6e - -.asm_119cd9 - call Function11a9c0 - call Function119e2e - -Function119cdf: - ld a, [wPartyMonMenuIconAnims + 6] - and a - ret nz - ld a, $f - ld [wcd3c], a - call Function119e2e - -Function119cec: - call Function119ed8 - ret c - ld a, [wcd46] - ld [wcf66], a - ret -; 119cf7 - -MenuDataHeader_119cf7: ; 119cf7 - db $40 ; flags - db 7, 12 ; start coords - db 11, 19 ; end coords - dw NULL - db 0 ; default option -; 119cff - -MenuData_119cff: ; 119cff - db $40 ; flags - db 7, 15 ; start coords - db 11, 19 ; end coords - dw NULL - db 0 ; default option -; 119d07 - -String_119d07: - db " ▼@" - -Strings_L10ToL100: ; 119d0c - db " L:10 @@" - db " L:20 @@" - db " L:30 @@" - db " L:40 @@" - db " L:50 @@" - db " L:60 @@" - db " L:70 @@" - db " L:80 @@" - db " L:90 @@" - db " L:100@@" - db "CANCEL@@" - -Strings_Ll0ToL40: ; 119d64 - db " L:10 @@" - db " L:20 @@" - db " L:30 @@" - db " L:40 @@" - db "CANCEL@@" - -String_119d8c: - db "CANCEL@" -; 119d93 - -Function119d93: ; 119d93 (46:5d93) - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, $1 - ld [rSVBK], a ; $ff00+$70 - ld a, [wcd4f] - ld c, 10 - call SimpleMultiply - ld hl, wcd50 - ld [hl], a - ld bc, PartyMon2 - PartyMon1 - ld de, PartyMon1Level - ld a, [PartyCount] -.asm_119daf - push af - ld a, [de] - push hl - push de - pop hl - add hl, bc - push hl - pop de - pop hl - cp [hl] - jr z, .asm_119dbd - jr nc, .asm_119dc6 -.asm_119dbd - pop af - dec a - jr nz, .asm_119daf - pop af - ld [rSVBK], a ; $ff00+$70 - and a - ret -.asm_119dc6 - pop af - ld a, $4 - ld [wcf66], a - pop af - ld [rSVBK], a ; $ff00+$70 - scf - ret - -Function119dd1: ; 119dd1 (46:5dd1) - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, [wcd4f] - cp 70 / 10 - jr nc, .asm_119e08 - ld a, $1 - ld [rSVBK], a ; $ff00+$70 - ld hl, PartyMon1Level - ld bc, PartyMon2 - PartyMon1 - ld de, PartySpecies - ld a, [PartyCount] -.asm_119deb - push af - ld a, [de] - cp MEWTWO - jr z, .asm_119dfd - cp MEW - jr z, .asm_119dfd - cp LUGIA - jr c, .asm_119e02 - cp NUM_POKEMON + 1 - jr nc, .asm_119e02 -.asm_119dfd - ld a, [hl] - cp 70 - jr c, .asm_119e0d -.asm_119e02 - add hl, bc - inc de - pop af - dec a - jr nz, .asm_119deb -.asm_119e08 - pop af - ld [rSVBK], a ; $ff00+$70 - and a - ret -.asm_119e0d - pop af - ld a, [de] - ld [wd265], a - call GetPokemonName - ld hl, StringBuffer1 - ld de, wcd49 - ld bc, PKMN_NAME_LENGTH - call CopyBytes - ld a, $a - ld [wcf66], a - pop af - ld [rSVBK], a ; $ff00+$70 - scf - ret -; 119e2b (46:5e2b) - -Function119e2b: ; 119e2b (46:5e2b) - call Function3e32 - -Function119e2e: ; 119e2e (46:5e2e) - ld hl, wcf66 - inc [hl] - ret -; 119e33 (46:5e33) - -Unknown_119e33: ; 119e33 - INCBIN "data/mobile/x-game-code-prefix.txt" -Unknown_119e40: - INCBIN "data/mobile/x-game-result-prefix.txt" -; 119e4f - -Function119e4f: ; 119e4f - push bc - ld hl, LYOverrides - ld a, [hli] - ld c, a - ld a, [hli] - ld b, a -.asm_119e57 - ld a, [de] - cp [hl] - jr z, .asm_119e64 -.asm_119e5b - inc hl - dec bc - ld a, b - or c - jr nz, .asm_119e57 -.asm_119e61 - pop bc - scf - ret - -.asm_119e64 - push de -.asm_119e65 - ld a, [de] - inc de - cp "\n" - jr z, .asm_119e7a - cp [hl] - jr nz, .asm_119e77 - inc hl - dec bc - ld a, b - or c - jr nz, .asm_119e65 - pop de - jr .asm_119e61 - -.asm_119e77 - pop de - jr .asm_119e5b - -.asm_119e7a - pop de - pop bc - inc hl - ld de, $d880 -.asm_119e80 - ld a, [hli] - ld [de], a - inc de - cp $d - jr z, .asm_119e8c - dec c - jr nz, .asm_119e80 - scf - ret - -.asm_119e8c - and a - ret -; 119e8e - -Function119e8e: ; 119e8e - cp $60 - jr c, .asm_119e95 - sub $57 - ret - -.asm_119e95 - sub $30 - ret -; 119e98 - -Function119e98: ; 119e98 - ld a, $2 -.asm_119e9a - push af - ld a, [bc] - dec bc - call Function119e8e - or [hl] - ld [hl], a - ld a, [bc] - dec bc - call Function119e8e - rlca - rlca - rlca - rlca - or [hl] - ld [hl], a - inc hl - pop af - dec a - and a - jr nz, .asm_119e9a - ret -; 119eb4 - -Function119eb4: ; 119eb4 (46:5eb4) - xor a - ld [wc3cc], a - ld de, wc3ac -.asm_119ebb - ld a, [de] - inc de - ld [hli], a - and a - jr nz, .asm_119ebb - ret - -Function119ec2: ; 119ec2 (46:5ec2) - ld a, $5 - call GetSRAMBank - xor a - ld [$aa5c], a - ld de, $aa4c -.asm_119ece - ld a, [de] - inc de - ld [hli], a - and a - jr nz, .asm_119ece - call CloseSRAM - ret - -Function119ed8: ; 119ed8 (46:5ed8) - ld a, [rSVBK] ; $ff00+$70 - ld [wcd8c], a - ld a, $1 - ld [rSVBK], a ; $ff00+$70 - call Function119eee - ld a, [wcd8c] - ld [rSVBK], a ; $ff00+$70 - ld a, $1 - ld [hBGMapMode], a ; $ff00+$d4 - ret - -Function119eee: ; 119eee (46:5eee) - ld a, [wcd3c] - ld e, a - ld d, 0 - ld hl, Jumptable_119efd -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 119efd (46:5efd) - -Jumptable_119efd: ; 119efd - dw Function119f3f - dw Function119f45 - dw Function119f56 - dw Function119f76 - dw Function119f98 - dw Function11a113 - dw Function11a129 - dw Function11a131 - dw Function11a13d - dw Function11a14b - dw Function11a16d - dw Function11a192 - dw Function11a2e6 - dw Function11a302 - dw Function11a33a - dw Function11a207 - dw Function11a235 - dw Function11a357 - dw Function11a36b - dw Function11a38d - dw Function11a3c5 - dw Function11a3d9 - dw Function11a3f9 - dw Function11a41b - dw Function11a452 - dw Function11a47a - dw Function11a488 - dw Function11a49e - dw Function11a4db - dw Function11a4e8 - dw Function11a4fe - dw Function11a466 - dw Function11a47a -; 119f3f - -Function119f3f: ; 119f3f - call Function11a5b9 - jp Function11a5b0 -; 119f45 - -Function119f45: ; 119f45 - hlcoord 4, 2 - ld de, String_11a661 - call PlaceString - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 119f56 - -Function119f56: ; 119f56 - ld a, [wcd44] - and a - jr z, .asm_119f62 - dec a - ld [wcd44], a - scf - ret - -.asm_119f62 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a6aa - call PlaceString - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 119f76 - -Function119f76: ; 119f76 - ld a, [wcd44] - and a - jr z, .asm_119f82 - dec a - ld [wcd44], a - scf - ret - -.asm_119f82 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a679 - call PlaceString - call Function11a5f5 - xor a - ld [wcd44], a - jp Function11a5b0 -; 119f98 - -Function119f98: ; 119f98 - call Function11a536 - ret c - call PlayClickSFX - ld a, [wcd44] - and a - jr nz, .asm_119fef - call ExitMenu - call Function11a63c - xor a - ld [ScriptVar], a - call Function11a00e - ld a, [ScriptVar] - and a - jr z, .asm_119fd4 - call ExitMenu - callba Function104061 - callba Function115dc3 - ld a, [wcd33] - ld [wcf66], a - ld a, $a - ld [wc300], a - scf - ret - -.asm_119fd4 - hlcoord 4, 2 - ld de, String_11a692 - call PlaceString - ld a, $1 - ld [wc30d], a - ld a, $1 - ld [wPartyMonMenuIconAnims], a - callba Function104061 - and a - ret - -.asm_119fef - call ExitMenu - call ExitMenu - callba Function104061 - ld a, [wcd45] - ld [wcf66], a - callba Function115dc3 - ld a, $a - ld [wc300], a - scf - ret -; 11a00e - -Function11a00e: ; 11a00e - ld a, $5 - call GetSRAMBank - ld a, [$aa4b] - and a - jr z, .asm_11a02a - ld a, [$aa4c] - call CloseSRAM - and a - ret nz - ld a, $5 - call GetSRAMBank - xor a - ld [$aa4b], a - -.asm_11a02a - call CloseSRAM - ld a, [BGMapPalBuffer] - and a - jr z, .asm_11a039 - dec a - jr z, .asm_11a081 - jp Function11a0ca - -.asm_11a039 - ld a, $3 - ld [rSVBK], a - ld hl, $c608 - ld de, $d800 - ld bc, $00f6 - call CopyBytes - ld a, $1 - ld [rSVBK], a - call FadeToMenu - callba Function11765d - call Function11a9ce - ld a, $3 - ld [rSVBK], a - ld hl, $d800 - ld de, $c608 - ld bc, $00f6 - call CopyBytes - ld a, $1 - ld [rSVBK], a - callba Function115d99 - ld c, $0 - callba Function115e18 - ld a, $1 - ld [wc305], a - ret - -.asm_11a081 - xor a - ld [wMenuBorderLeftCoord], a - ld [wMenuBorderTopCoord], a - ld a, $13 - ld [wMenuBorderRightCoord], a - ld a, $5 - ld [wMenuBorderBottomCoord], a - call BackUpTiles - callba Function11765d - callba Function117ab4 - callba Function106462 - callba Function106464 - call ExitMenu - callba Function104061 - callba Function115d99 - ld c, $0 - callba Function115e18 - ld a, $1 - ld [wc305], a - ret -; 11a0ca - -Function11a0ca: ; 11a0ca - xor a - ld [wMenuBorderLeftCoord], a - ld [wMenuBorderTopCoord], a - ld a, $13 - ld [wMenuBorderRightCoord], a - ld a, $11 - ld [wMenuBorderBottomCoord], a - call BackUpTiles - callba Function11765d - callba Function17d3f6 - callba Function106462 - callba Function106464 - call ExitMenu - callba Function104061 - callba Function115d99 - ld c, $0 - callba Function115e18 - ld a, $1 - ld [wc305], a - ret -; 11a113 - -Function11a113: ; 11a113 - call Function11a63c - ld c, $1 - callba Function115e18 - hlcoord 4, 2 - ld de, String_11a6c8 - call PlaceString - and a - ret -; 11a129 - -Function11a129: ; 11a129 - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 11a131 - -Function11a131: ; 11a131 - ld hl, wcd44 - dec [hl] - ret nz - ld a, [wcd3c] - inc a - ld [wcd3c], a - -Function11a13d: - call Function11a63c - hlcoord 4, 2 - ld de, String_11a6d2 - call PlaceString - and a - ret -; 11a14b - -Function11a14b: ; 11a14b - ld hl, wcd85 - ld a, [hl] - cp $f3 - jr nz, .asm_11a155 - and a - ret - -.asm_11a155 - call Function11a1d6 - ret c - call Function11a63c - hlcoord 4, 2 - ld de, String_11a6f1 - call PlaceString - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 11a16d - -Function11a16d: ; 11a16d - ld a, [wcd44] - and a - jr z, .asm_11a179 - dec a - ld [wcd44], a - scf - ret - -.asm_11a179 - call Function11a63c - call Function11a1e6 - hlcoord 4, 2 - ld de, wPartyMonMenuIconAnims + 48 + 2 - call PlaceString - call Function11a5f5 - xor a - ld [wcd44], a - jp Function11a5b0 -; 11a192 - -Function11a192: ; 11a192 - call Function11a536 - ret c - call PlayClickSFX - ld a, [wcd44] - and a - jr nz, .asm_11a1b6 - call ExitMenu - callba Function104061 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a6d2 - call PlaceString - and a - ret - -.asm_11a1b6 - call ExitMenu - callba Function104061 - ld a, [wcd45] - ld [wcf66], a - ld [wcd80], a - call Function11a63c - hlcoord 4, 2 - ld de, String_11a6d2 - call PlaceString - scf - ret -; 11a1d6 - -Function11a1d6: ; 11a1d6 - ld a, [wcd85] - cp $50 - jr nz, .asm_11a1e4 - ld a, $d3 - call Function118805 - scf - ret - -.asm_11a1e4 - and a - ret -; 11a1e6 - -Function11a1e6: ; 11a1e6 - ld hl, String_11a706 - ld de, wPartyMonMenuIconAnims + 48 + 2 - call Function11a1ff - ld hl, wcd85 - call Function11a1ff - ld hl, String_11a70b - call Function11a1ff - ld a, $50 - ld [de], a - ret -; 11a1ff - -Function11a1ff: ; 11a1ff -.asm_11a1ff - ld a, [hli] - cp $50 - ret z - ld [de], a - inc de - jr .asm_11a1ff -; 11a207 - -Function11a207: ; 11a207 - ld hl, MenuDataHeader_11a2de - call LoadMenuDataHeader - call Function1cbb - call GetMemTileCoord - call Function321c - hlcoord 16, 8 - ld de, String_11a2cf - call PlaceString - hlcoord 16, 10 - ld de, String_11a2d3 - call PlaceString - hlcoord 15, 8 - ld a, $ed - ld [hl], a - xor a - ld [wcd44], a - jp Function11a5b0 -; 11a235 - -Function11a235: ; 11a235 - ld hl, hJoyPressed - ld a, [hl] - and A_BUTTON - jr nz, .asm_11a28f - ld a, [hl] - and B_BUTTON - jr nz, .asm_11a2c1 - ld a, [hl] - and D_UP - jr nz, .asm_11a251 - ld a, [hl] - and D_DOWN - jr nz, .asm_11a270 -.asm_11a24c - call Function11a9f0 - scf - ret - -.asm_11a251 - xor a - ld [wcd8a], a - ld [wcd8b], a - ld a, [wcd44] - and a - jr z, .asm_11a24c - xor a - ld [wcd44], a - hlcoord 15, 8 - ld a, $ed - ld [hl], a - hlcoord 15, 10 - ld a, $7f - ld [hl], a - jr .asm_11a24c - -.asm_11a270 - xor a - ld [wcd8a], a - ld [wcd8b], a - ld a, [wcd44] - and a - jr nz, .asm_11a24c - inc a - ld [wcd44], a - hlcoord 15, 8 - ld a, $7f - ld [hl], a - hlcoord 15, 10 - ld a, $ed - ld [hl], a - jr .asm_11a24c - -.asm_11a28f - xor a - ld [wcd8a], a - ld [wcd8b], a - call PlayClickSFX - ld a, [wcd44] - and a - jr nz, .asm_11a2c4 - call ExitMenu - callba Function104061 - ld a, [wcd46] - cp $0 - jr z, .asm_11a2b4 - ld a, [wcd47] - jr .asm_11a2b7 - -.asm_11a2b4 - ld a, [wcd33] - -.asm_11a2b7 - ld [wcf66], a - ld a, $a - ld [wc300], a - scf - ret - -.asm_11a2c1 - call PlayClickSFX - -.asm_11a2c4 - call ExitMenu - callba Function104061 - and a - ret -; 11a2cf - -String_11a2cf: ; 11a2cf - db "YES@" -; 11a2d3 - -String_11a2d3: ; 11a2d3 - db "NO@" -; 11a2d6 - -MenuDataHeader_11a2d6: ; 11a2d6 - db $40 ; flags - db 6, 14 ; start coords - db 10, 19 ; end coords - dw NULL - db 0 ; default option -; 11a2de - -MenuDataHeader_11a2de: ; 11a2de - db $40 ; flags - db 7, 14 ; start coords - db 11, 19 ; end coords - dw NULL - db 0 ; default option -; 11a2e6 - -Function11a2e6: ; 11a2e6 - call Function11a63c - ld c, $2 - callba Function115e18 - hlcoord 4, 2 - ld de, String_11a71e - call PlaceString - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 11a302 - -Function11a302: ; 11a302 - ld a, [wcd44] - and a - jr z, .asm_11a30e - dec a - ld [wcd44], a - scf - ret - -.asm_11a30e - call Function11a63c - hlcoord 4, 2 - ld de, String_11a72a - call PlaceString - hlcoord 9, 4 - ld de, wcd68 - lb bc, PRINTNUM_LEADINGZEROS | 1, 2 - call PrintNum - hlcoord 14, 4 - ld de, wcd67 - lb bc, PRINTNUM_LEADINGZEROS | 1, 2 - call PrintNum - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 11a33a - -Function11a33a: ; 11a33a - ld a, [wcd44] - and a - jr z, .asm_11a346 - dec a - ld [wcd44], a - scf - ret - -.asm_11a346 - call ExitMenu - callba Function104061 - callba Function115dc3 - and a - ret -; 11a357 - -Function11a357: ; 11a357 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a743 - call PlaceString - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 11a36b - -Function11a36b: ; 11a36b - ld a, [wcd44] - and a - jr z, .asm_11a377 - dec a - ld [wcd44], a - scf - ret - -.asm_11a377 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a755 - call PlaceString - call Function11a5f5 - xor a - ld [wcd44], a - jp Function11a5b0 -; 11a38d - -Function11a38d: ; 11a38d - call Function11a536 - ret c - call PlayClickSFX - ld a, [wcd44] - and a - jr nz, .asm_11a3b1 - call ExitMenu - callba Function104061 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a6d2 - call PlaceString - and a - ret - -.asm_11a3b1 - call ExitMenu - callba Function104061 - ld a, [wcd45] - ld [wcf66], a - ld [wcd80], a - scf - ret -; 11a3c5 - -Function11a3c5: ; 11a3c5 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a762 - call PlaceString - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 11a3d9 - -Function11a3d9: ; 11a3d9 - ld a, [wcd44] - and a - jr z, .asm_11a3e5 - dec a - ld [wcd44], a - scf - ret - -.asm_11a3e5 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a779 - call PlaceString - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 11a3f9 - -Function11a3f9: ; 11a3f9 - ld a, [wcd44] - and a - jr z, .asm_11a405 - dec a - ld [wcd44], a - scf - ret - -.asm_11a405 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a755 - call PlaceString - call Function11a5f5 - xor a - ld [wcd44], a - jp Function11a5b0 -; 11a41b - -Function11a41b: ; 11a41b - call Function11a536 - ret c - call PlayClickSFX - ld a, [wcd44] - and a - jr nz, .asm_11a43f - call ExitMenu - callba Function104061 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a6d2 - call PlaceString - and a - ret - -.asm_11a43f - call ExitMenu - callba Function104061 - ld a, $1c - ld [wcf66], a - ld [wcd80], a - scf - ret -; 11a452 - -Function11a452: ; 11a452 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a791 - call PlaceString - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 11a466 - -Function11a466: ; 11a466 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a7c1 - call PlaceString - ld a, $80 - ld [wcd44], a - jp Function11a5b0 -; 11a47a - -Function11a47a: ; 11a47a - ld a, [wcd44] - and a - jr z, .asm_11a486 - dec a - ld [wcd44], a - scf - ret - -.asm_11a486 - and a - ret -; 11a488 - -Function11a488: ; 11a488 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a7ac - call PlaceString - call Function11a5f5 - xor a - ld [wcd44], a - jp Function11a5b0 -; 11a49e - -Function11a49e: ; 11a49e - call Function11a536 - ret c - call PlayClickSFX - ld a, [wcd44] - and a - jr nz, .asm_11a4c7 - call ExitMenu - callba Function104061 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a6d2 - call PlaceString - ld a, $14 - ld [wcf66], a - and a - ret - -.asm_11a4c7 - call ExitMenu - callba Function104061 - ld a, [wcd46] - ld [wcf66], a - ld [wcd80], a - scf - ret -; 11a4db - -Function11a4db: ; 11a4db - call Function11a63c - ld de, String_11a6db - hlcoord 4, 2 - call PlaceString - ret -; 11a4e8 - -Function11a4e8: ; 11a4e8 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a7d7 - call PlaceString - call Function11a5f5 - xor a - ld [wcd44], a - jp Function11a5b0 -; 11a4fe - -Function11a4fe: ; 11a4fe - call Function11a536 - ret c - call PlayClickSFX - ld a, [wcd44] - and a - jr nz, .asm_11a522 - call ExitMenu - callba Function104061 - call Function11a63c - hlcoord 4, 2 - ld de, String_11a6d2 - call PlaceString - and a - ret - -.asm_11a522 - call ExitMenu - callba Function104061 - ld a, [wcd45] - ld [wcf66], a - ld [wcd80], a - scf - ret -; 11a536 - -Function11a536: ; 11a536 - ld hl, hJoyPressed - ld a, [hl] - and $1 - jr nz, .asm_11a5a7 - ld a, [hl] - and $2 - jr nz, .asm_11a5a2 - ld a, [hl] - and $40 - jr nz, .asm_11a564 - ld a, [hl] - and $80 - jr nz, .asm_11a583 -.asm_11a54d - ld a, [wcd3c] - cp $4 - jr z, .asm_11a562 - call Function11a9f0 - jr nz, .asm_11a562 - call ExitMenu - callba Function104061 - -.asm_11a562 - scf - ret - -.asm_11a564 - xor a - ld [wcd8a], a - ld [wcd8b], a - ld a, [wcd44] - and a - jr z, .asm_11a54d - xor a - ld [wcd44], a - hlcoord 15, 7 - ld a, $ed - ld [hl], a - hlcoord 15, 9 - ld a, $7f - ld [hl], a - jr .asm_11a54d - -.asm_11a583 - xor a - ld [wcd8a], a - ld [wcd8b], a - ld a, [wcd44] - and a - jr nz, .asm_11a54d - inc a - ld [wcd44], a - hlcoord 15, 7 - ld a, $7f - ld [hl], a - hlcoord 15, 9 - ld a, $ed - ld [hl], a - jr .asm_11a54d - -.asm_11a5a2 - ld a, $1 - ld [wcd44], a - -.asm_11a5a7 - xor a - ld [wcd8a], a - ld [wcd8b], a - and a - ret -; 11a5b0 - -Function11a5b0: ; 11a5b0 - ld a, [wcd3c] - inc a - ld [wcd3c], a - scf - ret -; 11a5b9 - -Function11a5b9: ; 11a5b9 - xor a - ld [wMenuBorderLeftCoord], a - ld [wMenuBorderTopCoord], a - ld a, $13 - ld [wMenuBorderRightCoord], a - ld a, $5 - ld [wMenuBorderBottomCoord], a - call BackUpTiles - hlcoord 0, 0, AttrMap - ld b, $6 - ld c, $14 - hlcoord 0, 0 - ld b, $4 - ld c, $12 - call Function3eea - callba Function104061 - call UpdateSprites - ld c, $0 - callba Function115e18 - ld a, $1 - ld [wc305], a - ret -; 11a5f5 - -Function11a5f5: ; 11a5f5 - ld a, $e - ld [wMenuBorderLeftCoord], a - ld a, $13 - ld [wMenuBorderRightCoord], a - ld a, $6 - ld [wMenuBorderTopCoord], a - ld a, $a - ld [wMenuBorderBottomCoord], a - call BackUpTiles - hlcoord 14, 6, AttrMap - ld b, $5 - ld c, $6 - hlcoord 14, 6 - ld b, $3 - ld c, $4 - call Function3eea - hlcoord 16, 7 - ld de, String_11a2cf - call PlaceString - hlcoord 16, 9 - ld de, String_11a2d3 - call PlaceString - hlcoord 15, 7 - ld a, $ed - ld [hl], a - callba Function104061 - ret -; 11a63c - -Function11a63c: ; 11a63c - hlcoord 4, 1 - ld de, String_11a7f4 - call PlaceString - hlcoord 4, 2 - ld de, String_11a7f4 - call PlaceString - hlcoord 4, 3 - ld de, String_11a7f4 - call PlaceString - hlcoord 4, 4 - ld de, String_11a7f4 - call PlaceString - ret -; 11a661 - -String_11a661: ; 11a661 - db "これから モバイルセンターに" - next "でんわ", $1f, "かけます@" -; 11a679 - -String_11a679: ; 11a679 - db "モバイルアダプタ", $25, "じゅんびは" - next "できて いますか?@" -; 11a692 - -String_11a692: ; 11a692 - db "でんわ", $1f, "かけています" - next "しばらく おまちください@" -; 11a6aa - -String_11a6aa: ; 11a6aa - db "でんわをかけると つうわりょう" - next "せつぞくりょう", $4a, "かかります@" -; 11a6c8 - -String_11a6c8: ; 11a6c8 - db "せつぞく しました@" -; 11a6d2 - -String_11a6d2: ; 11a6d2 - db "つうしん ちゅう@" -; 11a6db - -String_11a6db: ; 11a6db - db "つうしん ちゅう" - next "セレクト エーでちゅうし@" -; 11a6f1 - -String_11a6f1: ; 11a6f1 - db "この サービスには" - next "つうわりょう", $25, "ほかに@" -; 11a706 - -String_11a706: ; 11a706 - db "おかね", $4a, "@" -; 11a70b - -String_11a70b: ; 11a70b - db "えん" - next "かかります よろしい ですか?@" -; 11a71e - -String_11a71e: ; 11a71e - db "つうしん しゅうりょう@" -; 11a72a - -String_11a72a: ; 11a72a - db "つないだ じかん" - next " やく ふん びょう@" -; 11a743 - -String_11a743: ; 11a743 - db "もっていない データが" - next "あります!@" -; 11a755 - -String_11a755: ; 11a755 - db "データ", $1f, "よみこみますか?@" -; 11a762 - -String_11a762: ; 11a762 - db "おなじ データ", $1f, "よみこんだ" - next "こと", $4a, "ありますが@" -; 11a779 - -String_11a779: ; 11a779 - db "そのデータ", $24, "なくなっているか" - next "こわれて います@" -; 11a791 - -String_11a791: ; 11a791 - db "もっている データと" - next "おなじデータしか ありません!@" -; 11a7ac - -String_11a7ac: ; 11a7ac - db "データ", $25, "よみこみを" - next "ちゅうし しますか?@" -; 11a7c1 - -String_11a7c1: ; 11a7c1 - db "あたらしい ニュースは" - next "ありません でした@" -; 11a7d7 - -String_11a7d7: ; 11a7d7 - db "あたらしいニュース", $4a, "あります" - next "ニュース", $1f, "よみこみますか?@" -; 11a7f4 - -String_11a7f4: ; 11a7f4 - db " @" -; 11a804 - -MenuDataHeader_11a804: ; 11a804 - db $40 ; flags - db 0, 0 ; start coords - db 5, 19 ; end coords - dw NULL - db 0 ; default option -; 11a80c - -Function11a80c: ; 11a80c - ld de, hDivisor - ld bc, hDividend - ld hl, Unknown_11a89a - call Function11a88c - ld bc, hQuotient - ld hl, Unknown_11a8ba - call Function11a88c - ld bc, $ffb5 - ld hl, Unknown_11a8da - call Function11a88c - xor a - ld b, a - ld a, [hDivisor] - and $f - ld e, a - ld a, [$ffb9] - and $f - call Function11a884 - ld e, a - ld a, [$ffbb] - and $f - call Function11a884 - ld [wcd62], a - ld e, b - xor a - ld b, a - ld a, [hDivisor] - and $f0 - swap a - call Function11a884 - ld e, a - ld a, [$ffb9] - and $f0 - swap a - call Function11a884 - ld e, a - ld a, [$ffbb] - and $f0 - swap a - call Function11a884 - ld [wcd63], a - ld e, b - xor a - ld b, a - ld a, [hMathBuffer] - and $f - call Function11a884 - ld e, a - ld a, [$ffba] - and $f - call Function11a884 - ld e, a - ld a, [$ffbc] - and $f - call Function11a884 - ld [wcd64], a - ret -; 11a884 - -Function11a884: ; 11a884 - add e - cp $a - ret c - sub $a - inc b - ret -; 11a88c - -Function11a88c: ; 11a88c - ld a, [bc] - sla a - ld c, a - xor a - ld b, a - add hl, bc - ld a, [hli] - ld [de], a - inc de - ld a, [hl] - ld [de], a - inc de - ret -; 11a89a - -Unknown_11a89a: ; 11a89a -x = 0 -rept 16 - bcd x % 100, x / 100 -x = x + 1 -endr - -Unknown_11a8ba: ; 11a8ba -x = 0 -rept 16 - bcd x % 100, x / 100 -x = x + 16 -endr - -Unknown_11a8da: ; 11a8da -x = 0 -rept 16 - bcd x % 100, x / 100 -x = x + 256 -endr -; 11a8fa - -Function11a8fa: ; 11a8fa - ld a, [wPartyMonMenuIconAnims + 6] - ld e, a - ld d, 0 - ld hl, Jumptable_11a909 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 11a909 - -Jumptable_11a909: ; 11a909 - dw Function11a970 - dw Function11a90f - dw Function11a971 -; 11a90f - -Function11a90f: ; 11a90f - ld a, $1 - ld [rSVBK], a - call SpeechTextBox - ld a, $50 - ld hl, wPartyMonMenuIconAnims + 12 - ld bc, $008c - call ByteFill - ld a, [wPartyMonMenuIconAnims + 7] - ld l, a - ld a, [wPartyMonMenuIconAnims + 8] - ld h, a - ld de, wPartyMonMenuIconAnims + 12 -.asm_11a92c - ld a, [hli] - cp $57 - jr z, .asm_11a94f - cp $0 - jr z, .asm_11a92c - cp $50 - jr z, .asm_11a92c - cp $1 - jr z, .asm_11a941 - ld [de], a - inc de - jr .asm_11a92c - -.asm_11a941 - ld a, [hli] - ld c, a - ld a, [hli] - ld b, a -.asm_11a945 - ld a, [bc] - inc bc - cp $50 - jr z, .asm_11a92c - ld [de], a - inc de - jr .asm_11a945 - -.asm_11a94f - xor a - ld [wPartyMonMenuIconAnims + 11], a - ld a, $20 - ld [wPartyMonMenuIconAnims + 7], a - ld a, $c3 - ld [wPartyMonMenuIconAnims + 8], a - hlcoord 1, 14 - ld a, l - ld [wPartyMonMenuIconAnims + 9], a - ld a, h - ld [wPartyMonMenuIconAnims + 10], a - ld hl, wPartyMonMenuIconAnims + 6 - inc [hl] - ld a, $3 - ld [rSVBK], a - -Function11a970: - ret -; 11a971 - -Function11a971: ; 11a971 - ld hl, wPartyMonMenuIconAnims + 11 - ld a, [hJoyDown] - and a - jr nz, .asm_11a97f - ld a, [hl] - and a - jr z, .asm_11a97f - dec [hl] - ret - -.asm_11a97f - ld a, [Options] - and $7 - ld [hl], a - ld hl, wcd8d - ld a, [wPartyMonMenuIconAnims + 7] - ld e, a - ld a, [wPartyMonMenuIconAnims + 8] - ld d, a - ld a, [de] - inc de - ld [hli], a - ld a, e - ld [wPartyMonMenuIconAnims + 7], a - ld a, d - ld [wPartyMonMenuIconAnims + 8], a - ld a, $50 - ld [hl], a - ld a, [wPartyMonMenuIconAnims + 9] - ld l, a - ld a, [wPartyMonMenuIconAnims + 10] - ld h, a - ld de, wcd8d - call PlaceString - ld a, c - ld [wPartyMonMenuIconAnims + 9], a - ld a, b - ld [wPartyMonMenuIconAnims + 10], a - ld a, [wcd8d] - cp $50 - jr nz, .asm_11a9bf - xor a - ld [wPartyMonMenuIconAnims + 6], a - -.asm_11a9bf - ret -; 11a9c0 - -Function11a9c0: ; 11a9c0 - ld a, l - ld [wPartyMonMenuIconAnims + 7], a - ld a, h - ld [wPartyMonMenuIconAnims + 8], a - ld a, $1 - ld [wPartyMonMenuIconAnims + 6], a - ret -; 11a9ce - -Function11a9ce: ; 11a9ce - call WhiteBGMap - call Function2bae - call Call_ExitMenu - callba Function106462 - callba Function106464 - call Functiond90 - callba Function2b5c - call UpdateSprites - ret -; 11a9f0 - -Function11a9f0: ; 11a9f0 - ld a, $1 - and a - ret -; 11a9f4 - -Function11a9f4: ; 11a9f4 - ld a, [wcd8a] - ld l, a - ld a, [wcd8b] - ld h, a - inc hl - ld a, l - ld [wcd8a], a - ld a, h - ld [wcd8b], a - ld de, $d5d0 - add hl, de - bit 7, h - ret nz - ld a, $d6 - call Function118805 - and a - ret -; 11aa13 - -UnknownText_0x11aa13: ; 0x11aa13 - text "SAVE FILE will be" - line "sent." - done -; 0x11aa2c - -UnknownText_0x11aa2c: ; 0x11aa2c - text "Sent SAVE FILE." - line "Reading NEWS…" - done -; 0x11aa4b - -UnknownText_0x11aa4b: ; 0x11aa4b - text "Reading NEWS…" - done -; 0x11aa5a - -UnknownText_0x11aa5a: ; 0x11aa5a - text "Received NEWS!" - done -; 0x11aa6a - -UnknownText_0x11aa6a: ; 0x11aa6a - text "Quit reading NEWS?" - done -; 0x11aa7e - -UnknownText_0x11aa7e: ; 0x11aa7e - text "Canceled sending" - line "SAVE FILE." - done -; 0x11aa9b - -UnknownText_0x11aa9b: ; 0x11aa9b - text "ODD EGG" - line "was received!" - done -; 0x11aab2 - -UnknownText_0x11aab2: ; 0x11aab2 - text "Registering your" - line "record…" - done -; 0x11aacc - -UnknownText_0x11aacc: ; 0x11aacc - text "One visit per day" - line "per BATTLE ROOM!" - done -; 0x11aaf0 - -UnknownText_0x11aaf0: ; 0x11aaf0 - text "A party #MON" - line "tops this level." - done -; 0x11ab0f - -UnknownText_0x11ab0f: ; 0x11ab0f - text_from_ram wcd49 - text " may go" - line "only to BATTLE" - - para "ROOMS that are" - line "Lv.70 or higher." - done -; 0x11ab4a - -UnknownText_0x11ab4a: ; 0x11ab4a - text "Cancel your BATTLE" - line "ROOM challenge?" - done -; 0x11ab6e - -UnknownText_0x11ab6e: ; 0x11ab6e - text "Exit GYM LEADER" - line "HONOR ROLL?" - done -; 0x11ab8b - -UnknownText_0x11ab8b: ; 0x11ab8b - text "Linking with the" - line "CENTER…" - done -; 0x11aba5 - -Text_WhatLevelDoYouWantToChallenge: ; 0x11aba5 - text "What level do you" - line "want to challenge?" - done -; 0x11abcb - -Text_CheckBattleRoomListByMaxLevel: ; 0x11abcb - text "Check BATTLE ROOM" - line "list by max level?" - done -; 0x11abf1 - -UnknownText_0x11abf1: ; 0x11abf1 - text "Enter which" - line "BATTLE ROOM?" - done -; 0x11ac0b - -UnknownText_0x11ac0b: ; 0x11ac0b - text "Which BATTLE ROOM?" - done -; 0x11ac1f - -UnknownText_0x11ac1f: ; 0x11ac1f - text_from_ram StringBuffer3 - text "'s ROOM" - line "@" - text_from_ram StringBuffer4 - text "?" - cont "Please wait…" - done -; 0x11ac3e - -Function11ac3e: ; 11ac3e - call SpeechTextBox - call FadeToMenu - callab InefficientlyClear121BytesAtwc300 - call Function11ac51 - call Function2b3c - ret -; 11ac51 - -Function11ac51: ; 11ac51 - xor a - ld [hBGMapMode], a - ld hl, Options - ld a, [hl] - push af - set 4, [hl] - ld a, [VramState] - push af - xor a - ld [VramState], a - ld a, [hInMenu] - push af - ld a, $1 - ld [hInMenu], a - xor a - ld [$ffde], a - ld [wcd49], a - ld [wcd4a], a - ld [wcd4c], a - ld [wcd4d], a - ld [wcd4e], a - call Function11ad1b - call DelayFrame -.asm_11ac82 - call JoyTextDelay - ld a, [wJumptableIndex] - bit 7, a - jr nz, .asm_11aca8 - call Function11b314 - call Function11acb7 - call Function11ad6e - ld a, $78 - ld [wc3b5], a - callba Function8cf7a - callba Function104061 - jr .asm_11ac82 - -.asm_11aca8 - call ClearSprites - pop af - ld [hInMenu], a - pop af - ld [VramState], a - pop af - ld [Options], a - ret -; 11acb7 - -Function11acb7: ; 11acb7 - ld hl, Unknown_11ba44 - ld a, [wcd49] - ld c, a - ld b, $0 - sla c - rl b - sla c - rl b - sla c - rl b - add hl, bc - decoord 6, 6 - ld a, [hli] - ld [de], a - decoord 0, 7 - ld bc, $0007 - call CopyBytes - ld a, [wcd49] - inc a - ld [wcd49], a - ld a, [hl] - cp $ff - jr nz, .asm_11aceb - xor a - ld [wcd49], a - -.asm_11aceb - ld hl, Unknown_11bb7d - ld a, [wcd4a] - ld c, a - ld b, $0 - sla c - rl b - sla c - rl b - sla c - rl b - add hl, bc - decoord 3, 9 - ld bc, $0007 - call CopyBytes - ld a, [wcd4a] - inc a - ld [wcd4a], a - inc hl - ld a, [hl] - cp $ff - ret nz - xor a - ld [wcd4a], a - ret -; 11ad1b - -Function11ad1b: ; 11ad1b - call WhiteBGMap - call ClearSprites - call ClearTileMap - callba Function17c000 - ld a, [wcfa9] - ld [wcd82], a - dec a - ld [hObjectStructIndexBuffer], a - ld a, $10 - ld [wc3b7], a - ld hl, Function8e83f - ld a, BANK(Function8e83f) - ld e, $4 - rst FarCall - ld hl, Function8e83f - ld a, BANK(Function8e83f) - ld e, $5 - rst FarCall - ld hl, $c6d0 - ld bc, $0115 - xor a - call ByteFill - xor a - ld [wJumptableIndex], a - ld [wcf64], a - ld [wcf65], a - ld [wcf66], a - ld [wcd30], a - ld a, $2 - ld [wc7d4], a - callba Function40bdc - ret -; 11ad6e - -Function11ad6e: ; 11ad6e - ld a, [wJumptableIndex] - ld hl, Jumptable_11ad78 - call Function11b239 - jp [hl] -; 11ad78 - -Jumptable_11ad78: ; 11ad78 - dw Function11b082 - dw Function11b0ff - dw Function11ad95 - dw Function11adc4 - dw Function11ae4e - dw Function11ae98 - dw Function11ad8f - dw Function11af04 - dw Function11af4e -; 11ad8a - -Function11ad8a: ; 11ad8a - ld hl, wJumptableIndex - inc [hl] - ret -; 11ad8f - -Function11ad8f: ; 11ad8f - ld hl, wJumptableIndex - set 7, [hl] - ret -; 11ad95 - -Function11ad95: ; 11ad95 - ld hl, MenuDataHeader_11ae38 - call LoadMenuDataHeader - call Function1cbb - hlcoord 12, 12 - ld de, String_11ae40 - call PlaceString - hlcoord 10, 10, AttrMap - ld bc, $0808 - call Function11afd6 - callba Function104061 - call Function11ad8a - ld a, $1 - ld [wcfa9], a - ld hl, Unknown_11afcc - call Function11afb7 - -Function11adc4: - ld hl, hJoyPressed - ld a, [hl] - and a - ret z - ld a, [hl] - and $40 - jr nz, .asm_11ade6 - ld a, [hl] - and $80 - jr nz, .asm_11aded - ld a, [hl] - and $1 - jr nz, .asm_11ae06 - ld a, [hl] - and $2 - ret z - call PlayClickSFX - xor a - ld [wJumptableIndex], a - jr .asm_11ae2e - -.asm_11ade6 - ld a, [wcfa9] - dec a - ret z - jr .asm_11adf4 - -.asm_11aded - ld a, [wcfa9] - inc a - cp $4 - ret z - -.asm_11adf4 - push af - ld hl, Unknown_11afcc - call Function11afbb - pop af - ld [wcfa9], a - ld hl, Unknown_11afcc - call Function11afb7 - ret - -.asm_11ae06 - call PlayClickSFX - ld a, [wcfa9] - dec a - ld hl, wcd30 - ld [hl], a - and a - jr z, .asm_11ae28 - hlcoord 2, 14 - ld a, [wcfa9] - cp $2 - jr z, .asm_11ae23 - call Function11b272 - jr .asm_11ae2b - -.asm_11ae23 - call Function11b267 - jr .asm_11ae2b - -.asm_11ae28 - ld a, $3 - ld [hl], a - -.asm_11ae2b - call Function11ad8a - -.asm_11ae2e - call ExitMenu - callba Function104061 - ret -; 11ae38 - -MenuDataHeader_11ae38: ; 11ae38 - db $40 ; flags - db 10, 10 ; start coords - db 17, 17 ; end coords - dw NULL - db 0 ; default option -; 11ae40 - -String_11ae40: ; 11ae40 - db "どちらでも" - next "♂ォス" - next "♀メス" - db "@" -; 11ae4e - -Function11ae4e: ; 11ae4e - ld hl, MenuDataHeader_11afe8 - call LoadMenuDataHeader - call Function1cbb - hlcoord 10, 14 - ld de, String_11aff0 - call PlaceString - ld hl, MenuDataHeader_11b013 - call LoadMenuDataHeader - call Function1cbb - hlcoord 16, 8 - ld de, String_11b01b - call PlaceString - hlcoord 14, 7, AttrMap - lb bc, 5, 6 - call Function11afd6 - hlcoord 9, 12, AttrMap - lb bc, 6, 11 - call Function11afd6 - callba Function104061 - call Function11ad8a - ld a, $1 - ld [wcfa9], a - ld hl, Unknown_11afd2 - call Function11afb7 - -Function11ae98: - ld hl, hJoyPressed - ld a, [hl] - and a - ret z - ld a, [hl] - and D_UP - jr nz, .asm_11aec1 - ld a, [hl] - and D_DOWN - jr nz, .asm_11aec8 - ld a, [hl] - and A_BUTTON - jr nz, .asm_11aee1 - ld a, [hl] - and B_BUTTON - ret z - call PlayClickSFX -.asm_11aeb4 - hlcoord 2, 14 - ld a, $7f - ld [hl], a - ld a, $1 - ld [wJumptableIndex], a - jr .asm_11aef7 - -.asm_11aec1 - ld a, [wcfa9] - dec a - ret z - jr .asm_11aecf - -.asm_11aec8 - ld a, [wcfa9] - inc a - cp $3 - ret z - -.asm_11aecf - push af - ld hl, Unknown_11afd2 - call Function11afbb - pop af - ld [wcfa9], a - ld hl, Unknown_11afd2 - call Function11afb7 - ret - -.asm_11aee1 - call PlayClickSFX - ld a, [wcfa9] - cp $2 - jr z, .asm_11aeb4 - ld a, [wcd4b] - ld [ScriptVar], a - call Function11b022 - call Function11ad8a - -.asm_11aef7 - call ExitMenu - call ExitMenu - callba Function104061 - ret -; 11af04 - -Function11af04: ; 11af04 - ld hl, MenuDataHeader_11afe8 - call LoadMenuDataHeader - call Function1cbb - hlcoord 10, 14 - ld de, String_11b003 - call PlaceString - ld hl, MenuDataHeader_11b013 - call LoadMenuDataHeader - call Function1cbb - hlcoord 16, 8 - ld de, String_11b01b - call PlaceString - hlcoord 14, 7, AttrMap - lb bc, 5, 6 - call Function11afd6 - hlcoord 9, 12, AttrMap - lb bc, 6, 11 - call Function11afd6 - callba Function104061 - call Function11ad8a - ld a, $2 - ld [wcfa9], a - ld hl, Unknown_11afd2 - call Function11afb7 - -Function11af4e: - ld hl, hJoyPressed - ld a, [hl] - and a - ret z - ld a, [hl] - and D_UP - jr nz, .asm_11af77 - ld a, [hl] - and D_DOWN - jr nz, .asm_11af7e - ld a, [hl] - and A_BUTTON - jr nz, .asm_11af97 - ld a, [hl] - and B_BUTTON - ret z - call PlayClickSFX -.asm_11af6a - hlcoord 2, 14 - ld a, $7f - ld [hl], a - ld a, $1 - ld [wJumptableIndex], a - jr .asm_11afaa - -.asm_11af77 - ld a, [wcfa9] - dec a - ret z - jr .asm_11af85 - -.asm_11af7e - ld a, [wcfa9] - inc a - cp $3 - ret z - -.asm_11af85 - push af - ld hl, Unknown_11afd2 - call Function11afbb - pop af - ld [wcfa9], a - ld hl, Unknown_11afd2 - call Function11afb7 - ret - -.asm_11af97 - call PlayClickSFX - ld a, [wcfa9] - cp $2 - jr z, .asm_11af6a - ld a, $6 - ld [wJumptableIndex], a - xor a - ld [ScriptVar], a - -.asm_11afaa - call ExitMenu - call ExitMenu - callba Function104061 - ret -; 11afb7 - -Function11afb7: ; 11afb7 - ld e, $ed - jr asm_11afbd - -Function11afbb: - ld e, $7f - -asm_11afbd: - ld a, [wcfa9] - dec a - ld c, a - ld b, 0 -rept 2 - add hl, bc -endr - ld a, e - ld e, [hl] - inc hl - ld d, [hl] - ld [de], a - ret -; 11afcc - -Unknown_11afcc: - dwcoord 11, 12 - dwcoord 11, 14 - dwcoord 11, 16 - -Unknown_11afd2: - dwcoord 15, 8 - dwcoord 15, 10 -; 11afd6 - -Function11afd6: ; 11afd6 - ld de, $0014 - ld a, $3 -.asm_11afdb - push bc - push hl -.asm_11afdd - ld [hli], a - dec c - jr nz, .asm_11afdd - pop hl - add hl, de - pop bc - dec b - jr nz, .asm_11afdb - ret -; 11afe8 - -MenuDataHeader_11afe8: ; 11afe8 - db $40 ; flags - db 12, 9 ; start coords - db 17, 19 ; end coords - dw NULL - db 0 ; default option -; 11aff0 - -String_11aff0: ; 11aff0 - db "この じょうけんで" - next "よろしいですか?@" -; 11b003 - -String_11b003: ; 11b003 - db "こうかんを" - next "ちゅうししますか?@" -; 11b013 - -MenuDataHeader_11b013: ; 11b013 - db $40 ; flags - db 7, 14 ; start coords - db 11, 19 ; end coords - dw NULL - db 1 ; default option -; 11b01b - -String_11b01b: - db "はい" - next "いいえ@" -; 11b022 - -Function11b022: ; 11b022 - ld a, [wcd2e] - and a - jr z, .asm_11b02e - ld hl, StringBuffer3 - call Function11b03d - -.asm_11b02e - ld a, [wcd30] - and a - ret z - cp $3 - ret z - ld hl, StringBuffer4 - call Function11b03d - ret -; 11b03d - -Function11b03d: ; 11b03d - push hl - push af - ld c, $1 -.asm_11b041 - ld a, [hli] - cp $ef - jr z, .asm_11b051 - cp $f5 - jr z, .asm_11b051 - cp $50 - jr z, .asm_11b055 - inc c - jr .asm_11b041 - -.asm_11b051 - dec hl - ld a, $50 - ld [hli], a - -.asm_11b055 - dec hl - push hl - ld e, $4 - ld d, $0 - add hl, de - ld e, l - ld d, h - pop hl -.asm_11b05f - ld a, [hld] - ld [de], a - dec de - dec c - jr nz, .asm_11b05f - pop af - pop de - cp $1 - jr nz, .asm_11b070 - ld hl, String_11b07a - jr .asm_11b073 - -.asm_11b070 - ld hl, String_11b07e - -.asm_11b073 - ld bc, 4 - call CopyBytes - ret -; 11b07a - -String_11b07a: db "ォスの " -String_11b07e: db "メスの " - -Function11b082: ; 11b082 - call Function11b242 - ld a, $7 - ld [wc7d3], a - call Function11b099 - call Function11b295 - call Function11b275 - call SetPalettes - jp Function11ad8a -; 11b099 - -Function11b099: ; 11b099 - ld c, $6 - hlcoord 11, 1 - ld a, [wc7d3] - add a - ld b, a - xor a - call Function11b236 - ld a, [wc7d0] - ld e, a - ld d, $0 - ld hl, $c6d0 - add hl, de - ld e, l - ld d, h - hlcoord 11, 2 - ld a, [wc7d3] -.asm_11b0b9 - push af - ld a, [de] - ld [wd265], a - push de - push hl - call Function11b0cf - pop hl - ld de, $0028 - add hl, de - pop de - inc de - pop af - dec a - jr nz, .asm_11b0b9 - ret -; 11b0cf - -Function11b0cf: ; 11b0cf - and a - ret z - call Function11b0ec - ret c - call Function11b0e1 - push hl - call GetPokemonName - pop hl - call PlaceString - ret -; 11b0e1 - -Function11b0e1: ; 11b0e1 - call Function11b21e - jr nz, .asm_11b0e8 - inc hl - ret - -.asm_11b0e8 - ld a, $1 - ld [hli], a - ret -; 11b0ec - -Function11b0ec: ; 11b0ec - call Function11b22a - ret nz - inc hl - ld de, String_11b0f9 - call PlaceString - scf - ret -; 11b0f9 - -String_11b0f9: ; 11b0f9 - db "ーーーーー@" -; 11b0ff - -Function11b0ff: ; 11b0ff - ld hl, hJoyPressed - ld a, [hl] - and $2 - jr nz, .asm_11b141 - ld a, [hl] - and $1 - jr nz, .asm_11b131 - call Function11b175 - jr nc, .asm_11b125 - ld a, [wcd4c] - inc a - and $3 - ld [wcd4c], a - xor a - ld [hBGMapMode], a - call Function11b099 - ld a, $1 - ld [hBGMapMode], a - ret - -.asm_11b125 - ld a, [wcd4c] - and a - ret z - inc a - and $3 - ld [wcd4c], a - ret - -.asm_11b131 - call Function11b20b - call Function11b22a - jr z, .asm_11b13d - ld a, $1 - jr .asm_11b148 - -.asm_11b13d - ld a, $2 - jr .asm_11b148 - -.asm_11b141 - ld hl, wJumptableIndex - ld a, $7 - ld [hl], a - ret - -.asm_11b148 - call PlayClickSFX - ld [wcd4b], a - and a - jr z, .asm_11b16c - ld a, [wcf65] - cp $0 - jr z, .asm_11b163 - cp $fe - jr z, .asm_11b167 - cp $ff - jr z, .asm_11b16b - jp Function11ad8a - -.asm_11b163 - ld a, $1 - jr .asm_11b16c - -.asm_11b167 - ld a, $2 - jr .asm_11b16c - -.asm_11b16b - xor a - -.asm_11b16c - ld [wcd30], a - ld a, $4 - ld [wJumptableIndex], a - ret -; 11b175 - -Function11b175: ; 11b175 - ld a, [wc7d3] - ld d, a - ld a, [wc7d2] - ld e, a - ld hl, hJoyLast - ld a, [hl] - and $40 - jr nz, .asm_11b19a - ld a, [hl] - and $80 - jr nz, .asm_11b1ae - ld a, d - cp e - jr nc, .asm_11b1ed - ld a, [hl] - and $20 - jr nz, .asm_11b1c6 - ld a, [hl] - and $10 - jr nz, .asm_11b1d8 - jr .asm_11b1ed - -.asm_11b19a - ld hl, wc7d1 - ld a, [hl] - and a - jr z, .asm_11b1a4 - dec [hl] - jr .asm_11b1ef - -.asm_11b1a4 - ld hl, wc7d0 - ld a, [hl] - and a - jr z, .asm_11b1ed - dec [hl] - jr .asm_11b1ef - -.asm_11b1ae - ld hl, wc7d1 - ld a, [hl] - inc a - cp e - jr nc, .asm_11b1ed - cp d - jr nc, .asm_11b1bc - inc [hl] - jr .asm_11b1ef - -.asm_11b1bc - ld hl, wc7d0 - add [hl] - cp e - jr nc, .asm_11b1ed - inc [hl] - jr .asm_11b1ef - -.asm_11b1c6 - ld hl, wc7d0 - ld a, [hl] - and a - jr z, .asm_11b1ed - cp d - jr nc, .asm_11b1d4 - xor a - ld [hl], a - jr .asm_11b1ef - -.asm_11b1d4 - sub d - ld [hl], a - jr .asm_11b1ef - -.asm_11b1d8 - ld hl, wc7d0 - ld a, d - add a - add [hl] - jr c, .asm_11b1e3 - cp e - jr c, .asm_11b1e8 - -.asm_11b1e3 - ld a, e - sub d - ld [hl], a - jr .asm_11b1ef - -.asm_11b1e8 - ld a, [hl] - add d - ld [hl], a - jr .asm_11b1ef - -.asm_11b1ed - and a - ret - -.asm_11b1ef - call Function11b295 - call Function11b275 - scf - ret -; 11b1f7 - -Function11b1f7: ; 11b1f7 - hlcoord 0, 0 - ld a, $32 - ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - call ByteFill - ret -; 11b203 - -Function11b203: ; 11b203 -.asm_11b203 - ld a, [de] - cp $ff - ret z - inc de - ld [hli], a - jr .asm_11b203 -; 11b20b - -Function11b20b: ; 11b20b - ld a, [wc7d1] - ld hl, wc7d0 - add [hl] - ld e, a - ld d, $0 - ld hl, $c6d0 - add hl, de - ld a, [hl] - ld [wd265], a - ret -; 11b21e - -Function11b21e: ; 11b21e - push de - push hl - ld a, [wd265] - dec a - call CheckCaughtMon - pop hl - pop de - ret -; 11b22a - -Function11b22a: ; 11b22a - push de - push hl - ld a, [wd265] - dec a - call CheckSeenMon - pop hl - pop de - ret -; 11b236 - -Function11b236: ; 11b236 - jp FillBoxWithByte -; 11b239 - -Function11b239: ; 11b239 - ld e, a - ld d, 0 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - ret -; 11b242 - -Function11b242: ; 11b242 - hlcoord 3, 4 - ld de, StringBuffer3 - call PlaceString - xor a - ld [MonType], a - callba GetGender - hlcoord 1, 4 - ld a, [CurPartySpecies] - ld bc, wcd2f - ld [bc], a - dec bc - jr c, asm_11b26a - jr z, asm_11b26f - ld a, $1 - ld [bc], a - -Function11b267: - ld [hl], $ef - ret - -asm_11b26a - xor a - ld [bc], a - ld [hl], $7f - ret - -asm_11b26f - ld a, $2 - ld [bc], a - -Function11b272: - ld [hl], $f5 - ret -; 11b275 - -Function11b275: ; 11b275 - call Function11b279 - ret -; 11b279 - -Function11b279: ; 11b279 - ld a, [wd265] - ld [CurSpecies], a - call Function11b22a - jr z, .asm_11b28f - call GetBaseData - ld a, [BaseGender] - ld [wcf65], a - jr .asm_11b294 - -.asm_11b28f - ld a, $ff - ld [wcf65], a - -.asm_11b294 - ret -; 11b295 - -Function11b295: ; 11b295 - hlcoord 4, 13 - ld de, String_11b308 - call PlaceString - hlcoord 4, 14 - ld de, String_11b308 - call PlaceString - call Function11b20b - call Function11b22a - jr z, .asm_11b2d1 - ld a, [$c608] - ld c, a - ld a, [$c608 + 1] - ld b, a - ld hl, $0007 - add hl, bc - xor a - ld [hl], a - ld hl, $0003 - add hl, bc - ld e, [hl] - callba Function8e9bc - hlcoord 4, 14 - push hl - call GetPokemonName - jr .asm_11b2e7 - -.asm_11b2d1 - ld a, [$c608] - ld c, a - ld a, [$c608 + 1] - ld b, a - ld hl, $0007 - add hl, bc - ld a, $50 - ld [hl], a - hlcoord 4, 13 - push hl - ld de, String_11b30e - -.asm_11b2e7 - ld a, $6 - ld bc, StringBuffer4 -.asm_11b2ec - push af - ld a, [de] - ld [bc], a - inc de - inc bc - pop af - dec a - and a - jr nz, .asm_11b2ec - pop hl - ld de, StringBuffer4 - call PlaceString - ret -; 11b2fe - -String_11b2fe: ; 11b2fe - db "あげる#@" -; 11b303 - -String_11b303: ; 11b303 - db "ほしい#@" -; 11b308 - -String_11b308: ; 11b308 - db " @" -; 11b30e - -String_11b30e: ; 11b30e - db "みはっけん@" -; 11b314 - -Function11b314: ; 11b314 - call Function11b31b - call Function11b3d9 - ret -; 11b31b - -Function11b31b: ; 11b31b - ld hl, Unknown_11b350 - ld a, [wJumptableIndex] - cp $2 - jr c, .asm_11b349 - ld a, [wc7d1] - cp $4 - jr nc, .asm_11b344 - cp $3 - jr c, .asm_11b349 - ld a, [wJumptableIndex] - cp $2 - jr z, .asm_11b349 - cp $3 - jr z, .asm_11b349 - cp $6 - jr z, .asm_11b349 - - ld bc, Unknown_11b37b - jr .asm_11b34c - -.asm_11b344 - ld bc, Unknown_11b389 - jr .asm_11b34c - -.asm_11b349 - ld bc, Unknown_11b36d - -.asm_11b34c - call Function11b397 - ret -; 11b350 - -Unknown_11b350: - db $1a, $5e, $1a, $66, $1a, $6e, $1a, $76, $1a, $7e, $1a, $86, $1a, $8e - db $22, $5e, $22, $66, $22, $6e, $22, $76, $22, $7e, $22, $86, $22, $8e - db $ff - -Unknown_11b36d: - db $30, $31, $31, $31, $31, $31, $32, $40, $41, $41, $41, $41, $41, $42 -Unknown_11b37b: - db $30, $31, $31, $39, $39, $39, $39, $40, $41, $41, $39, $39, $39, $39 -Unknown_11b389: - db $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39 - -Function11b397: ; 11b397 - ld de, Sprites -.asm_11b39a - ld a, [hl] - cp $ff - ret z - ld a, [wc7d1] - and $7 - swap a - add [hl] - inc hl - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - ld a, [bc] - inc bc - ld [de], a - inc de - ld a, $5 - ld [de], a - inc de - jr .asm_11b39a -; 11b3b6 - -Function11b3b6: ; 11b3b6 -.asm_11b3b6 - ld a, [hl] - cp $ff - ret z - ld a, [wcd4d] - and $7 - swap a - add [hl] - inc hl - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - push hl - ld l, c - ld h, b - ld a, [wcd4e] - add [hl] - inc bc - ld [de], a - inc de - pop hl - ld a, $5 - ld [de], a - inc de - jr .asm_11b3b6 -; 11b3d9 - -Function11b3d9: ; 11b3d9 - ld de, Sprites + $70 - push de - ld a, [wc7d2] - dec a - ld e, a - ld a, [wc7d1] - ld hl, wc7d0 - add [hl] - cp e - jr z, .asm_11b40d - ld hl, 0 - ld bc, $0070 - call AddNTimes - ld e, l - ld d, h - ld b, $0 - ld a, d - or e - jr z, .asm_11b40f - ld a, [wc7d2] - ld c, a -.asm_11b401 - ld a, e - sub c - ld e, a - ld a, d - sbc $0 - ld d, a - jr c, .asm_11b40f - inc b - jr .asm_11b401 - -.asm_11b40d - ld b, $70 - -.asm_11b40f - ld a, $15 - add b - pop hl - ld [hli], a - cp $41 - jr c, .asm_11b42b - ld a, [wJumptableIndex] - cp $4 - jr z, .asm_11b43b - cp $5 - jr z, .asm_11b43b - cp $7 - jr z, .asm_11b43b - cp $8 - jr z, .asm_11b43b - -.asm_11b42b - ld a, $9b - ld [hli], a - ld a, [wcd4c] - add $3c - ld [hli], a - ld a, [wcd4c] - add $1 - ld [hl], a - ret - -.asm_11b43b - ld a, $9b - ld [hli], a - ld a, $39 - ld [hli], a - xor a - ld [hl], a - ret -; 11b444 - -Function11b444: ; 11b444 - call Function11b44b - call Function11b45c - ret -; 11b44b - -Function11b44b: ; 11b44b - xor a - ld [wJumptableIndex], a - ld [wcf64], a - ld [wcf65], a - ld [wcf66], a - call UpdateTime - ret -; 11b45c - -Function11b45c: ; 11b45c -.asm_11b45c - call Function11b46a - call DelayFrame - ld a, [wJumptableIndex] - cp $4 - jr nz, .asm_11b45c - ret -; 11b46a - -Function11b46a: ; 11b46a - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, Jumptable_11b479 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 11b479 - -Jumptable_11b479: ; 11b479 - dw Function11b483 - dw Function11b570 - dw Function11b5c0 - dw Function11b5e0 - dw Function11b5e7 -; 11b483 - -Function11b483: ; 11b483 - call Function11b538 - ld hl, PlayerName - ld a, $5 -.asm_11b48b - push af - ld a, [hli] - ld [bc], a - inc bc - pop af - dec a - and a - jr nz, .asm_11b48b - ld de, $0030 - ld hl, PartyMon1Species - ld a, [wcd82] - dec a - push af -.asm_11b49f - and a - jr z, .asm_11b4a6 - add hl, de - dec a - jr .asm_11b49f - -.asm_11b4a6 - push bc - ld a, $30 -.asm_11b4a9 - push af - ld a, [hli] - ld [bc], a - inc bc - pop af - dec a - and a - jr nz, .asm_11b4a9 - pop de - push bc - ld a, [de] - ld [CurSpecies], a - call GetBaseData - ld hl, $001f - add hl, de - ld a, [hl] - ld [CurPartyLevel], a - ld hl, $0024 - add hl, de - push hl - ld hl, $000a - add hl, de - pop de - push de - ld b, $1 - predef CalcPkmnStats - pop de - ld h, d - ld l, e -rept 2 - dec hl -endr - ld a, [de] - ld [hli], a - inc de - ld a, [de] - ld [hl], a - pop bc - ld de, $000b - ld hl, PartyMonOT - pop af - push af -.asm_11b4e8 - and a - jr z, .asm_11b4ef - add hl, de - dec a - jr .asm_11b4e8 - -.asm_11b4ef - ld a, $a -.asm_11b4f1 - push af - ld a, [hli] - ld [bc], a - inc bc - pop af - dec a - and a - jr nz, .asm_11b4f1 - ld de, $000b - ld hl, PartyMonNicknames - pop af - push af -.asm_11b502 - and a - jr z, .asm_11b509 - add hl, de - dec a - jr .asm_11b502 - -.asm_11b509 - ld a, $a -.asm_11b50b - push af - ld a, [hli] - ld [bc], a - inc bc - pop af - dec a - and a - jr nz, .asm_11b50b - ld de, $002f - ld hl, $a600 - pop af -.asm_11b51b - and a - jr z, .asm_11b522 - add hl, de - dec a - jr .asm_11b51b - -.asm_11b522 - ld a, $0 - call GetSRAMBank - ld a, $2f -.asm_11b529 - push af - ld a, [hli] - ld [bc], a - inc bc - pop af - dec a - and a - jr nz, .asm_11b529 - call CloseSRAM - jp Function11ad8a -; 11b538 - -Function11b538: ; 11b538 - ld bc, BattleMonNick + 5 - ld a, [PlayerID] - ld [wcd2a], a - ld [bc], a - inc bc - ld a, [PlayerID + 1] - ld [wcd2b], a - ld [bc], a - inc bc - ld a, [wSecretID] - ld [wcd2c], a - ld [bc], a - inc bc - ld a, [wSecretID + 1] - ld [wcd2d], a - ld [bc], a - inc bc - ld a, [wcd2e] - ld [bc], a - inc bc - ld a, [wcd2f] - ld [bc], a - inc bc - ld a, [wcd30] - ld [bc], a - inc bc - ld a, [wd265] - ld [bc], a - inc bc - ret -; 11b570 - -Function11b570: ; 11b570 - call Function118007 - ld a, [ScriptVar] - and a - jr nz, .asm_11b57f - call Function11b585 - jp Function11ad8a - -.asm_11b57f - ld a, $4 - ld [wJumptableIndex], a - ret -; 11b585 - -Function11b585: ; 11b585 - ld a, $3 - ld [rSVBK], a - ld hl, $d800 - ld de, $c608 - ld bc, $008f - call CopyBytes - ld a, $1 - ld [rSVBK], a - ld a, $5 - call GetSRAMBank - ld de, $a800 - ld a, $1 - ld [de], a - inc de - ld hl, $c608 - ld bc, $008f - call CopyBytes - push de - pop hl - ld a, [hRTCMinutes] - ld [hli], a - ld a, [hRTCHours] - ld [hli], a - ld a, [hRTCDayLo] - ld [hli], a - ld a, [hRTCDayHi] - ld [hl], a - call CloseSRAM - ret -; 11b5c0 - -Function11b5c0: ; 11b5c0 - ld a, [wcd82] - dec a - ld [CurPartyMon], a - xor a - ld [wd10b], a - callba Functione039 - callba Function170807 - callba Function14a58 - jp Function11ad8a -; 11b5e0 - -Function11b5e0: ; 11b5e0 - xor a - ld [ScriptVar], a - jp Function11ad8a -; 11b5e7 - -Function11b5e7: ; 11b5e7 - ret -; 11b5e8 - -Function11b5e8: ; 11b5e8 - ld a, $0 - call GetSRAMBank - ld hl, wRTC - ld de, $c608 - ld bc, $0004 - call CopyBytes - call CloseSRAM - ld a, $5 - call GetSRAMBank - ld hl, $c608 - ld de, $b08c - ld bc, $0004 - call CopyBytes - ld a, $2 - ld [$a800], a - ld a, [$a81f] - ld [wcd2a], a - ld a, [$a820] - ld [wcd2b], a - ld a, [$a821] - ld [wcd2c], a - ld a, [$a822] - ld [wcd2d], a - ld a, [$a823] - ld [wcd2e], a - ld a, [$a824] - ld [wcd2f], a - ld a, [$a825] - ld [wcd30], a - ld a, [$a826] - ld [wcd31], a - call CloseSRAM - call Function11b44b - call Function11b64c - ret -; 11b64c - -Function11b64c: ; 11b64c -.asm_11b64c - call Function11b65a - call DelayFrame - ld a, [wJumptableIndex] - cp $1 - jr nz, .asm_11b64c - ret -; 11b65a - -Function11b65a: ; 11b65a - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, Jumptable_11b669 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 11b669 - -Jumptable_11b669: ; 11b669 - dw Function11b66d - dw Function11b6b3 -; 11b66d - -Function11b66d: ; 11b66d - call Function1180b8 - ld a, [ScriptVar] - and a - jr nz, .asm_11b6b0 - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a - ld a, [StringBuffer2 + 10] - ld b, a - pop af - ld [rSVBK], a - ld a, b - and a - jr z, .asm_11b691 - cp $1 - jr nz, .asm_11b6b0 - call Function11b6b4 - jr .asm_11b6b0 - -.asm_11b691 - callba Function17081d - ld a, [ScriptVar] - and a - jr z, .asm_11b6b0 - xor a - ld [ScriptVar], a - ld a, [rSVBK] - push af - ld a, $3 - ld [rSVBK], a - ld a, $2 - ld [StringBuffer2 + 10], a - pop af - ld [rSVBK], a - -.asm_11b6b0 - jp Function11ad8a -; 11b6b3 - -Function11b6b3: ; 11b6b3 - ret -; 11b6b4 - -Function11b6b4: ; 11b6b4 - ld a, $5 - call GetSRAMBank - ld a, [wcd30] - ld [wc708], a - ld a, [wcd31] - ld [wc709], a - ld a, $8 - ld [BGMapBuffer], a - ld a, $c7 - ld [wcd21], a - ld a, $d - ld [CreditsTimer], a - ld a, $c6 - ld [wcd23], a - ld a, $3d - ld [wcd24], a - ld a, $c6 - ld [wcd25], a - ld a, $42 - ld [wcd26], a - ld a, $c6 - ld [wcd27], a - ld a, $47 - ld [wcd28], a - ld a, $c6 - ld [wcd29], a - ld a, $46 - ld [$c628], a - ld de, $c63d - ld c, $5 - callba Function17d073 - jr nc, .asm_11b70f - callba Function17d187 - -.asm_11b70f - ld de, $c63d - ld bc, $0105 - callba Function17d1e1 - jr nc, .asm_11b723 - callba Function17d187 - -.asm_11b723 - ld de, $c642 - ld c, $5 - callba Function17d073 - jr nc, .asm_11b736 - callba Function17d199 - -.asm_11b736 - ld de, $c642 - ld bc, $0105 - callba Function17d1e1 - jr nc, .asm_11b74a - callba Function17d199 - -.asm_11b74a - ld de, $c647 - ld c, $21 - callba Function17d073 - jr nc, .asm_11b75d - callba Function17d1ab - -.asm_11b75d - ld de, $c647 - ld bc, $0221 - callba Function17d1e1 - jr c, .asm_11b770 - ld a, b - cp $2 - jr nz, .asm_11b776 - -.asm_11b770 - callba Function17d1ab - -.asm_11b776 - ld de, $c668 - ld c, $5 - callba Function17d073 - jr nc, .asm_11b789 - callba Function17d1c9 - -.asm_11b789 - ld de, $c668 - ld bc, $0105 - callba Function17d1e1 - jr nc, .asm_11b79d - callba Function17d1c9 - -.asm_11b79d - ld a, [$c608 + 6] - cp $ff - jr nz, .asm_11b7a8 - xor a - ld [$c608 + 6], a - -.asm_11b7a8 - ld a, [wcd31] - ld [$c608 + 5], a - ld [CurSpecies], a - call GetBaseData - - ld hl, $c62c - ld a, [hl] - cp MIN_LEVEL - ld a, MIN_LEVEL - jr c, .asm_11b7c5 - ld a, [hl] - cp MAX_LEVEL - jr c, .asm_11b7c6 - ld a, MAX_LEVEL -.asm_11b7c5 - ld [hl], a -.asm_11b7c6 - ld [CurPartyLevel], a - - ld hl, $c616 + 1 - ld de, $c62c + 5 - ld b, $1 - predef CalcPkmnStats - ld de, $c62c + 5 - ld hl, $c62c + 3 - ld a, [de] - ld [hli], a - inc de - ld a, [de] - ld [hl], a - call Function11b98f - ret -; 11b7e5 - -Function11b7e5: ; 11b7e5 - ld a, [$c608 + 5] - ld [wc702], a - ld [CurPartySpecies], a - ld a, [wcd81] - ld [wc74e], a - ld hl, $c63d - ld de, wc724 - ld bc, $0005 - call CopyBytes - ld a, $50 - ld [de], a - ld a, [$c608 + 11] - ld [wc731], a - ld a, [$c608 + 12] - ld [wc732], a - ld hl, $c608 + 26 - ld a, [hli] - ld [wc72f], a - ld a, [hl] - ld [wc730], a - ld bc, $c608 + 5 - callba GetCaughtGender - ld a, c - ld [wc733], a - call SpeechTextBox - call FadeToMenu - callba Function108016 - callba Function17d1f1 - ld a, $1 - ld [wd1e9], a - ld a, $2 - ld [wLinkMode], a - callba Function421d8 - xor a - ld [wLinkMode], a - callba Function14a58 - ld a, $5 - call GetSRAMBank - ld a, $5 - ld [$a800], a - call CloseSRAM - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a - call GetMapTrigger - ld a, d - or e - jr z, .asm_11b872 - ld a, $1 - ld [de], a - -.asm_11b872 - call Function2b3c - call RestartMapMusic - ret -; 11b879 - -Function11b879: ; 11b879 - callba Function17089a - ld a, [ScriptVar] - and a - ret z - ld a, $5 - call GetSRAMBank - ld a, [$a800] - ld [ScriptVar], a - ld a, [$a890] - ld [wcd49], a - ld a, [$a891] - ld [wcd4a], a - ld a, [$a892] - ld [wcd4b], a - ld a, [$a893] - ld [wcd4c], a - call CloseSRAM - ld a, [ScriptVar] - and a - ret z - ld hl, wcd4c - ld a, [hRTCDayHi] - cp [hl] - ret nz - dec hl - ld a, [hRTCDayLo] - cp [hl] - ret nz - ld hl, wcd4a - ld a, [hRTCHours] - cp [hl] - jr nc, .asm_11b8d8 - ld a, $18 - sub [hl] - ld hl, hRTCHours - add [hl] - ld [wcd4c], a - ld a, [hRTCMinutes] - ld [wcd4b], a - xor a - ld [wcd4a], a - jr .asm_11b8e2 - -.asm_11b8d8 - ld a, [hRTCMinutes] - ld [wcd4b], a - ld a, [hRTCHours] - ld [wcd4c], a - -.asm_11b8e2 - xor a - ld l, a - ld h, a - ld b, a - ld d, a - ld a, [wcd4b] - ld e, a - ld a, [wcd4c] - ld c, $3c - call AddNTimes - add hl, de - push hl - xor a - ld l, a - ld h, a - ld b, a - ld d, a - ld a, [wcd49] - ld e, a - ld a, [wcd4a] - ld c, $3c - call AddNTimes - add hl, de - ld a, l - cpl - add $1 - ld e, a - ld a, h - cpl - adc $0 - ld d, a - pop hl - add hl, de - ld de, $ff88 - add hl, de - bit 7, h - ret z - ld a, $2 - ld [ScriptVar], a - ret -; 11b920 - -Function11b920: ; 11b920 - call Function11b44b - ld a, $5 - call GetSRAMBank - ld hl, $a81f - ld de, BattleMonNick + 5 - ld bc, $0008 - call CopyBytes - call CloseSRAM - call Function118000 - ret -; 11b93b - -Function11b93b: ; 11b93b - ld a, $5 - call GetSRAMBank - xor a - ld [$a800], a - ld hl, $a823 - ld de, wEnemyMoveStruct - ld bc, $008f - call CopyBytes - call CloseSRAM - ld a, wEnemyMoveStruct % $100 - ld [wcd20], a - ld a, wEnemyMoveStruct / $100 - ld [wcd21], a - ld a, $c611 % $100 - ld [wcd22], a - ld a, $c611 / $100 - ld [wcd23], a - ld a, $c641 % $100 - ld [wcd24], a - ld a, $c641 / $100 - ld [wcd25], a - ld a, $c646 % $100 - ld [wcd26], a - ld a, $c646 / $100 - ld [wcd27], a - ld a, $c64b % $100 - ld [wcd28], a - ld a, $c64b / $100 - ld [wcd29], a - call Function11b98f - callba Function14a58 - ret -; 11b98f - -Function11b98f: ; 11b98f - ld hl, PartyCount - ld a, [hl] - ld e, a - inc [hl] - ld a, [wcd20] - ld l, a - ld a, [wcd21] - ld h, a - inc hl - ld bc, PartySpecies - ld d, e -.loop1 - inc bc - dec d - jr nz, .loop1 - ld a, e - ld [CurPartyMon], a - ld a, [hl] - ld [bc], a - inc bc - ld a, $ff - ld [bc], a - ld hl, PartyMon1Species - ld bc, PartyMon2 - PartyMon1 - ld a, e - ld [wcd2a], a -.loop2 - add hl, bc - dec a - and a - jr nz, .loop2 - ld e, l - ld d, h - ld a, [CreditsTimer] - ld l, a - ld a, [wcd23] - ld h, a - ld bc, PartyMon2 - PartyMon1 - call CopyBytes - ld hl, PartyMonOT - ld bc, NAME_LENGTH - ld a, [wcd2a] -.loop3 - add hl, bc - dec a - and a - jr nz, .loop3 - ld e, l - ld d, h - ld a, [wcd24] - ld l, a - ld a, [wcd25] - ld h, a - ld bc, PKMN_NAME_LENGTH - 1 - call CopyBytes - ld a, "@" - ld [de], a - ld hl, PartyMonNicknames - ld bc, PKMN_NAME_LENGTH - ld a, [wcd2a] -.loop4 - add hl, bc - dec a - and a - jr nz, .loop4 - ld e, l - ld d, h - ld a, [wcd26] - ld l, a - ld a, [wcd27] - ld h, a - ld bc, PKMN_NAME_LENGTH - 1 - call CopyBytes - ld a, "@" - ld [de], a - ld hl, s0_a600 - ld bc, party_struct_length - 1 - ld a, [wcd2a] -.loop5 - add hl, bc - dec a - and a - jr nz, .loop5 - ld a, $0 - call GetSRAMBank - ld e, l - ld d, h - ld a, [wcd28] - ld l, a - ld a, [wcd29] - ld h, a - ld bc, party_struct_length - 1 - call CopyBytes - call CloseSRAM - ret -; 11ba38 - -Function11ba38: ; 11ba38 - callba CheckCurPartyMonFainted - ret c - xor a - ld [ScriptVar], a - ret -; 11ba44 - -Unknown_11ba44: - db $47, $30, $0a, $0a, $0a, $0a, $0a, $56 - db $46, $2f, $0a, $0a, $0a, $0a, $0a, $55 - db $45, $3d, $0a, $0a, $0a, $0a, $0a, $54 - db $44, $30, $0a, $0a, $0a, $0a, $0a, $53 - db $43, $2f, $0a, $0a, $0a, $0a, $0a, $52 - db $4a, $3d, $0a, $0a, $0a, $0a, $0a, $51 - db $4a, $30, $0a, $0a, $0a, $0a, $0a, $50 - db $4a, $2f, $0a, $0a, $0a, $0a, $0a, $4f - db $4a, $3d, $0a, $0a, $0a, $0a, $0a, $4e - db $4a, $30, $0a, $0a, $0a, $0a, $4d, $42 - db $4a, $2f, $0a, $0a, $0a, $0a, $6b, $58 - db $4a, $3d, $0a, $0a, $0a, $0a, $6a, $58 - db $4a, $30, $0a, $0a, $0a, $0a, $69, $58 - db $4a, $2f, $0a, $0a, $0a, $0a, $68, $58 - db $4a, $3d, $0a, $0a, $0a, $66, $67, $58 - db $4a, $30, $0a, $0a, $0a, $65, $0a, $58 - db $4a, $2f, $0a, $0a, $0a, $64, $0a, $58 - db $4a, $3d, $0a, $0a, $0a, $63, $0a, $58 - db $4a, $30, $0a, $0a, $61, $62, $0a, $58 - db $4a, $2f, $0a, $0a, $5f, $60, $0a, $58 - db $4a, $3d, $0a, $61, $62, $0a, $0a, $58 - db $4a, $30, $0a, $63, $0a, $0a, $0a, $58 - db $4a, $2f, $69, $0a, $0a, $0a, $0a, $58 - db $4a, $3d, $81, $0a, $0a, $0a, $0a, $58 - db $4a, $30, $80, $0a, $0a, $0a, $0a, $58 - db $4a, $2f, $7f, $0a, $0a, $0a, $0a, $58 - db $4a, $3d, $0a, $0a, $0a, $0a, $0a, $58 - db $4a, $30, $0a, $0a, $0a, $0a, $0a, $58 - db $4a, $2f, $68, $87, $88, $89, $0a, $58 - db $4a, $3d, $6e, $6f, $70, $75, $76, $58 - db $4a, $30, $75, $76, $5c, $5d, $5e, $58 - db $4a, $2f, $71, $72, $73, $74, $6d, $58 - db $4a, $3d, $75, $76, $77, $8a, $8b, $58 - db $4a, $30, $66, $67, $65, $0a, $6a, $58 - db $4a, $2f, $83, $84, $0a, $83, $84, $58 - db $4a, $3d, $0a, $85, $82, $84, $0a, $58 - db $4a, $30, $41, $80, $40, $0a, $0a, $58 - db $4a, $2f, $83, $0a, $0a, $0a, $0a, $58 - db $4a, $3d, $40, $0a, $0a, $0a, $0a, $58 - db $ff - -Unknown_11bb7d: - db $0a, $0a, $0a, $0a, $0a, $0a, $16, $00 - db $78, $0a, $0a, $0a, $0a, $0a, $8c, $00 - db $79, $0a, $0a, $0a, $0a, $0a, $8d, $00 - db $7a, $0a, $0a, $0a, $0a, $0a, $8e, $00 - db $7b, $0a, $0a, $0a, $0a, $0a, $8c, $00 - db $7c, $0a, $0a, $0a, $0a, $0a, $8d, $00 - db $7d, $0a, $0a, $0a, $0a, $0a, $8e, $00 - db $2e, $7e, $0a, $0a, $0a, $0a, $8c, $00 - db $2e, $80, $0a, $0a, $0a, $0a, $8d, $00 - db $2e, $81, $0a, $0a, $0a, $0a, $8e, $00 - db $2e, $82, $0a, $0a, $0a, $0a, $8c, $00 - db $2e, $69, $0a, $0a, $0a, $0a, $8d, $00 - db $2e, $6a, $0a, $0a, $0a, $0a, $8e, $00 - db $2e, $6b, $0a, $0a, $0a, $0a, $8c, $00 - db $2e, $0a, $68, $0a, $0a, $0a, $8d, $00 - db $2e, $0a, $69, $0a, $0a, $0a, $8e, $00 - db $2e, $0a, $0a, $6a, $0a, $0a, $8c, $00 - db $2e, $0a, $0a, $6b, $0a, $0a, $8d, $00 - db $2e, $0a, $0a, $0a, $80, $0a, $8e, $00 - db $2e, $0a, $0a, $0a, $82, $0a, $8c, $00 - db $2e, $0a, $0a, $0a, $6c, $0a, $8d, $00 - db $2e, $0a, $0a, $0a, $0a, $83, $8e, $00 - db $2e, $0a, $6b, $0a, $0a, $0a, $8c, $00 - db $2e, $0a, $0a, $69, $0a, $0a, $8d, $00 - db $2e, $0a, $0a, $6a, $0a, $0a, $8e, $00 - db $2e, $0a, $0a, $0a, $68, $0a, $8c, $00 - db $2e, $0a, $0a, $0a, $63, $0a, $8d, $00 - db $2e, $0a, $0a, $61, $62, $0a, $8e, $00 - db $2e, $0a, $0a, $0a, $5f, $60, $8c, $00 - db $2e, $0a, $0a, $0a, $63, $0a, $8d, $00 - db $2e, $0a, $0a, $0a, $0a, $69, $8c, $00 - db $2e, $0a, $0a, $0a, $0a, $6b, $8d, $00 - db $2e, $0a, $0a, $0a, $0a, $83, $8e, $00 - db $2e, $0a, $0a, $0a, $0a, $86, $8c, $00 - db $2e, $0a, $85, $0a, $0a, $0a, $8d, $00 - db $2e, $0a, $0a, $84, $0a, $0a, $8e, $00 - db $ff - - -SECTION "bank47", ROMX, BANK[$47] - -INCLUDE "misc/battle_tower_47.asm" - -Function170be4: ; 170be4 - ld a, $5 - call GetSRAMBank - xor a - ld hl, $a894 - ld bc, $0008 - call ByteFill - call CloseSRAM - ret -; 170bf7 - -Function170bf7: ; 170bf7 - ld a, $5 - call GetSRAMBank - ld hl, $a89a - xor a - ld [hli], a - ld [hl], a - call CloseSRAM - ret -; 170c06 - -Function170c06: ; 170c06 - ld a, $5 - call GetSRAMBank - ld hl, $a894 - ld a, [wBattleResult] - and a - jr nz, .asm_170c15 - inc [hl] - -.asm_170c15 -rept 2 - inc hl -endr - ld a, [$a89b] - add [hl] - ld [hld], a - ld a, [$a89a] - adc [hl] - ld [hli], a - jr nc, .asm_170c27 - ld a, $ff - ld [hld], a - ld [hli], a - -.asm_170c27 - inc hl - push hl - ld de, 0 - xor a - ld [wd265], a -.asm_170c30 - ld hl, PartyMon1HP - ld a, [wd265] - call GetPartyLocation - ld a, [hli] - ld b, a - ld c, [hl] -rept 2 - inc hl -endr - ld a, [hld] - sub c - ld c, a - ld a, [hl] - sbc b - ld b, a - push de - pop hl - add hl, bc - push hl - pop de - jr c, .asm_170c58 - ld a, [wd265] - inc a - ld [wd265], a - cp $3 - jr c, .asm_170c30 - jr .asm_170c5b - -.asm_170c58 - ld de, -1 - -.asm_170c5b - pop hl - inc hl - ld a, e - add [hl] - ld [hld], a - ld a, d - adc [hl] - ld [hli], a - jr nc, .asm_170c69 - ld a, $ff - ld [hld], a - ld [hli], a - -.asm_170c69 - inc hl - push hl - ld b, $0 - ld c, $0 -.asm_170c6f - ld hl, PartyMon1HP - ld a, b - push bc - call GetPartyLocation - pop bc - ld a, [hli] - or [hl] - jr nz, .asm_170c7d - inc c - -.asm_170c7d - inc b - ld a, b - cp $3 - jr c, .asm_170c6f - pop hl - ld a, [hl] - add c - ld [hl], a - call CloseSRAM - ret -; 170c8b - -Function170c8b: ; 170c8b - ld hl, LastPlayerCounterMove - ld b, $5 -.asm_170c90 - ld a, [hl] - xor $ff - ld [hli], a - dec b - jr nz, .asm_170c90 - ret -; 170c98 - -Function170c98: ; 170c98 - ld c, $3 - ld hl, $c608 + 13 -.asm_170c9d - push hl - ld a, [hl] - cp $fc - jr c, .asm_170ca6 - ld a, $1 - ld [hl], a - -.asm_170ca6 - inc hl - ld b, $3 -.asm_170ca9 - ld a, [hl] - and a - jr z, .asm_170cb1 - cp $fc - jr c, .asm_170cb9 - -.asm_170cb1 - xor a - ld [hl], a - inc hl - dec b - jr nz, .asm_170cb1 - jr .asm_170cbd - -.asm_170cb9 - inc hl - dec b - jr nz, .asm_170ca9 - -.asm_170cbd - pop hl - ld de, $003b - add hl, de - dec c - jr nz, .asm_170c9d - ret -; 170cc6 - -Function170cc6: ; 170cc6 - ld a, [rSVBK] - push af - ld a, $6 - ld [rSVBK], a - ld hl, LZ_170d16 - ld de, wd000 - call Decompress - ld a, $1 - ld [rVBK], a - ld de, wd000 - ld hl, VTiles0 - lb bc, $6, $c1 - call Get2bpp - xor a - ld [rVBK], a - ld hl, LZ_1715a4 - ld de, wd000 - call Decompress - ld de, Unkn1Pals - ld hl, VTiles0 - lb bc, $6, $53 - call Get2bpp - pop af - ld [rSVBK], a - ret -; 170d02 - -Function170d02: ; 170d02 - ld a, $1 - ld [rVBK], a - ld de, GFX_171848 - ld hl, VTiles1 tile $41 - lb bc, BANK(GFX_171848), $18 - call Get2bpp - xor a - ld [rVBK], a - ret -; 170d16 - -LZ_170d16: -INCBIN "gfx/unknown/170d16.2bpp.lz" - -LZ_1715a4: -INCBIN "gfx/unknown/1715a4.2bpp.lz" - -GFX_171848: -INCBIN "gfx/unknown/171848.2bpp" - -Function1719c8: ; 1719c8 (5c:59c8) - ld a, [hInMenu] - push af - ld a, $1 - ld [hInMenu], a - call Function1719d6 - pop af - ld [hInMenu], a - ret - -Function1719d6: ; 1719d6 (5c:59d6) - callba Function1183cb - call Function1719ed - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, $5 - ld [rSVBK], a ; $ff00+$70 - call Function171a11 - pop af - ld [rSVBK], a ; $ff00+$70 - ret - -Function1719ed: ; 1719ed (5c:59ed) - xor a - ld [wcd49], a - ld [wcd4a], a - dec a - ld [wcd4b], a - call WhiteBGMap - call ClearSprites - callba Function171d2b - callba Function104061 - callba Function8cf53 - ret - -Function171a11: ; 171a11 (5c:5a11) - call JoyTextDelay - ld a, [wcd49] - bit 7, a - jr nz, .asm_171a2c - call Function171a36 - callba Function8cf69 - callba Function104061 - jr Function171a11 -.asm_171a2c - callba Function8cf53 - call ClearSprites - ret - -Function171a36: ; 171a36 (5c:5a36) - ld a, [wcd49] - ld e, a - ld d, 0 - ld hl, Jumptable_171a45 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] - -Jumptable_171a45: ; 171a45 (5c:5a45) - dw Function171a95 - dw Function171ac9 - dw Function171a5d - dw Function171ad7 - dw Function171a5d - dw Function171aec - dw Function171b4b - dw Function171b85 - dw Function171bcc - dw Function171c2c - dw Function171c39 - dw Function171c41 - - -Function171a5d: ; 171a5d (5c:5a5d) - ld a, [wc821] - bit 1, a - jr nz, .asm_171a6a - bit 0, a - ret nz - jp Function171c66 -.asm_171a6a - ld a, $0 - call Function3e32 - ld [wc300], a - ld a, l - ld [wc301], a - ld a, h - ld [wc302], a - ld a, $a - call Function3e32 - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, $1 - ld [rSVBK], a ; $ff00+$70 - callba Function118452 - pop af - ld [rSVBK], a ; $ff00+$70 - ld a, $a - ld [wcd49], a - ret - -Function171a95: ; 171a95 (5c:5a95) - callba Function171ccd - hlcoord 2, 8 - ld de, String_171aa7 - call PlaceString - jp Function171c66 -; 171aa7 (5c:5aa7) - -String_171aa7: ; 171aa7 - db "モバイルアダプタに" - next "せつぞく しています" - next "しばらく おまちください" - db "@" -; 171ac9 - -Function171ac9: ; 171ac9 (5c:5ac9) - ld de, wcd81 - ld hl, $5c - ld a, $2 - call Function3e32 - jp Function171c66 - -Function171ad7: ; 171ad7 (5c:5ad7) - xor a - ld hl, $c608 - ld bc, $66 - call ByteFill - ld de, $c608 - ld a, $c - call Function3e32 - jp Function171c66 - -Function171aec: ; 171aec (5c:5aec) - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, $1 - ld [rSVBK], a ; $ff00+$70 - callba Function118452 - pop af - ld [rSVBK], a ; $ff00+$70 - hlcoord 2, 6 - ld a, $8 -.asm_171b01 - push af - push hl - xor a - ld bc, $10 - call ByteFill - pop hl - ld de, $14 - add hl, de - pop af - dec a - jr nz, .asm_171b01 - hlcoord 2, 7 - ld a, $3 - ld de, $c608 -.asm_171b1b - push af - push hl - ld a, [de] - and a - jr z, .asm_171b34 - ld a, [wcd4b] - inc a - ld [wcd4b], a - push hl - call Function171b42 - pop hl - ld bc, $ffec - add hl, bc - call Function171b42 -.asm_171b34 - pop hl - ld bc, $14 -rept 3 - add hl, bc -endr - pop af - dec a - jr nz, .asm_171b1b - jp Function171c66 - -Function171b42: ; 171b42 (5c:5b42) - ld a, [de] - inc de - and a - ret z - sub $20 - ld [hli], a - jr Function171b42 - -Function171b4b: ; 171b4b (5c:5b4b) - lb de, $40, $10 - ld a, $1d - call Function3b2a - ld hl, $c - add hl, bc - ld a, $8 - ld [hl], a - lb de, $40, $98 - ld a, $1d - call Function3b2a - ld hl, $c - add hl, bc - ld a, $9 - ld [hl], a - lb de, $8a, $70 - ld a, $1d - call Function3b2a - ld hl, $c - add hl, bc - ld a, $a - ld [hl], a - ld a, $4 - ld [wcd23], a - ld a, $8 - ld [wcd24], a - jp Function171c66 - -Function171b85: ; 171b85 (5c:5b85) - ld hl, hJoyPressed ; $ffa7 - ld a, [hl] - and $2 - jp nz, Function171b9f - ld a, [hl] - and $1 - jp nz, Function171bbd - ld a, [hl] - and $40 - jr nz, asm_171ba5 - ld a, [hl] - and $80 - jr nz, asm_171baf - ret - -Function171b9f: ; 171b9f (5c:5b9f) - ld a, $80 - ld [wcd49], a - ret -asm_171ba5: ; 171ba5 (5c:5ba5) - ld a, [wcd4a] - and a - ret z - dec a - ld [wcd4a], a - ret -asm_171baf: ; 171baf (5c:5baf) - ld a, [wcd4b] - ld c, a - ld a, [wcd4a] - cp c - ret z - inc a - ld [wcd4a], a - ret - -Function171bbd: ; 171bbd (5c:5bbd) - call PlayClickSFX - ld a, $8 - ld [wcd23], a - xor a - ld [wcd24], a - jp Function171c66 - -Function171bcc: ; 171bcc (5c:5bcc) - ld hl, hJoyPressed ; $ffa7 - ld a, [hl] - and $2 - jp nz, Function171bdc - ld a, [hl] - and $1 - jp nz, Function171beb - ret - -Function171bdc: ; 171bdc (5c:5bdc) - ld a, $4 - ld [wcd23], a - ld a, $8 - ld [wcd24], a - ld hl, wcd49 - dec [hl] - ret - -Function171beb: ; 171beb (5c:5beb) - ld a, $5 - call GetSRAMBank - ld a, [wcd4a] - ld [$aa4a], a - call CloseSRAM - ld hl, MenuDataHeader_171c6b - call LoadMenuDataHeader - call Function1cbb - call GetMemTileCoord - callba Function104061 - hlcoord 1, 14 - ld de, String_171c73 - call PlaceString - ld a, [wcd4a] - cp $2 - jr z, .asm_171c1f - ld a, $8 - jr .asm_171c21 -.asm_171c1f - ld a, $c -.asm_171c21 - ld [wcd24], a - ld a, $1e - ld [wcd4c], a - call Function171c66 - -Function171c2c: ; 171c2c (5c:5c2c) - ld hl, wcd4c - dec [hl] - ret nz - call ExitMenu - call WhiteBGMap - jr asm_171c60 - -Function171c39: ; 171c39 (5c:5c39) - ld a, $28 - ld [wcd4c], a - call Function171c66 - -Function171c41: ; 171c41 (5c:5c41) - ld hl, wcd4c - dec [hl] - ret nz - call WhiteBGMap - callba Function106462 - callba Function106464 - ld a, $2 - ld [wc303], a - callba Function17f555 -asm_171c60: ; 171c60 (5c:5c60) - ld a, $80 - ld [wcd49], a - ret - -Function171c66: ; 171c66 (5c:5c66) - ld hl, wcd49 - inc [hl] - ret -; 171c6b (5c:5c6b) - -MenuDataHeader_171c6b: ; 171c6b - db $40 ; flags - db 12, 0 ; start coords - db 17, 19 ; end coords - dw NULL - db 0 ; default option -; 171c73 - -String_171c73: ; 171c73 - db "モバイルセンターを けってい" - next "しました@" -; 171c87 - -Function171c87: ; 171c87 (5c:5c87) - call DisableLCD - ld hl, GFX_171db1 - ld de, VTiles2 tile $00 - ld bc, $6e0 - call CopyBytes - ld hl, LZ_172abd - ld de, VTiles0 tile $00 - call Decompress - call EnableLCD - ld hl, Tilemap_172491 - decoord 0, 0 - ld bc, $168 - call CopyBytes - ld hl, Attrmap_1727ed - decoord 0, 0, AttrMap - ld bc, $168 - call CopyBytes - hlcoord 3, 2 - ld de, String_172e31 - call PlaceString - hlcoord 3, 16 - ld de, String_172e3f - call PlaceString - ret - -Function171ccd: ; 171ccd (5c:5ccd) - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, $5 - ld [rSVBK], a ; $ff00+$70 - ld hl, Palette_171d71 - ld de, Unkn1Pals - ld bc, $40 - call CopyBytes - ld hl, MovementAnimation - ld a, $ff - ld [hli], a - ld a, $7f - ld [hl], a - call SetPalettes - pop af - ld [rSVBK], a ; $ff00+$70 - ret - -Function171cf0: ; 171cf0 (5c:5cf0) - xor a - hlcoord 4, 15 -rept 2 - ld [hli], a -endr - ld a, [wcd4b] - xor $1 - ld [wcd4b], a - and a - jr nz, .asm_171d16 - ld hl, Tilemap_17251d - decoord 0, 7 - ld bc, $8c - call CopyBytes - hlcoord 3, 16 - ld de, String_172e3f - jp PlaceString -.asm_171d16 - ld hl, Tilemap_1725f9 - decoord 0, 7 - ld bc, $8c - call CopyBytes - hlcoord 3, 16 - ld de, String_172e4e - jp PlaceString - -Function171d2b: ; 171d2b (5c:5d2b) - call DisableLCD - ld hl, GFX_171db1 - ld de, VTiles2 tile $00 - ld bc, $6e0 - call CopyBytes - ld hl, LZ_172abd - ld de, VTiles0 tile $00 - call Decompress - call EnableLCD - ld hl, Tilemap_172685 - decoord 0, 0 - ld bc, $168 - call CopyBytes - ld hl, Attrmap_172955 - decoord 0, 0, AttrMap - ld bc, $168 - call CopyBytes - hlcoord 2, 2 - ld de, String_172e5d - call PlaceString - hlcoord 14, 16 - ld de, String_172e58 - call PlaceString - ret -; 171d71 (5c:5d71) - -Palette_171d71: - RGB 0, 0, 0 - RGB 3, 0, 0 - RGB 5, 0, 0 - RGB 31, 31, 29 - RGB 0, 2, 10 - RGB 2, 10, 21 - RGB 0, 0, 0 - RGB 10, 26, 31 - RGB 0, 0, 0 - RGB 0, 7, 8 - RGB 31, 8, 0 - RGB 1, 17, 15 - RGB 31, 16, 0 - RGB 31, 22, 0 - RGB 31, 27, 0 - RGB 31, 31, 0 - RGB 31, 18, 6 - RGB 0, 3, 0 - RGB 0, 9, 0 - RGB 0, 12, 0 - RGB 0, 16, 0 - RGB 0, 22, 0 - RGB 0, 25, 0 - RGB 0, 27, 0 - RGB 5, 5, 16 - RGB 8, 19, 28 - RGB 0, 0, 0 - RGB 31, 31, 31 - RGB 31, 31, 29 - RGB 21, 21, 20 - RGB 11, 11, 10 - RGB 0, 0, 0 -GFX_171db1: -INCBIN "gfx/unknown/171db1.2bpp" -Tilemap_172491: -INCBIN "gfx/unknown/172491.tilemap" -Tilemap_17251d: -INCBIN "gfx/unknown/17251d.tilemap" -Tilemap_1725f9: -INCBIN "gfx/unknown/1725f9.tilemap" -Tilemap_172685: -INCBIN "gfx/unknown/172685.tilemap" -Attrmap_1727ed: -INCBIN "gfx/unknown/1727ed.attrmap" -Attrmap_172955: -INCBIN "gfx/unknown/172955.attrmap" -LZ_172abd: -INCBIN "gfx/pokedex/slowpoke.2bpp.lz" - -String_172e31: ; 172e31 - db "パスワード", $1f, "いれてください@" -String_172e3f: ; 172e3f - db "きりかえ やめる けってい@" -String_172e4e: ; 172e4e - db "きりかえ やめる " -String_172e58: - db "けってい@" -String_172e5d: ; 172e5d - db "せつぞくする モバイルセンターを" - next "えらんで ください@" -; 172e78 - - -Function172e78: ; 172e78 (5c:6e78) - ld a, $7f - hlcoord 0, 0 - ld bc, $168 - call ByteFill - ld a, $7 - hlcoord 0, 0, AttrMap - ld bc, $168 - call ByteFill - call DisableLCD - ld hl, GFX_172f1f - ld de, VTiles2 tile $00 - ld bc, $610 - call CopyBytes - call EnableLCD - ld hl, Tilemap_1733af - decoord 0, 0 - ld bc, $168 - call CopyBytes - ld hl, Attrmap_173517 - decoord 0, 0, AttrMap - ld bc, $168 - call CopyBytes - ret -; 172eb9 (5c:6eb9) - -Function172eb9: - ld a, [rSVBK] ; $ff00+$70 - push af - ld a, $5 - ld [rSVBK], a ; $ff00+$70 - ld hl, Palette_172edf - ld de, Unkn1Pals - ld bc, $40 - call CopyBytes - ld hl, Palette_172edf - ld de, BGPals - ld bc, $40 - call CopyBytes - call SetPalettes - pop af - ld [rSVBK], a ; $ff00+$70 - ret -; 172edf (5c:6edf) - -Palette_172edf: - RGB 5, 12, 17 - RGB 31, 31, 31 - RGB 18, 25, 28 - RGB 10, 17, 21 - RGB 6, 13, 18 - RGB 31, 31, 31 - RGB 20, 26, 28 - RGB 12, 19, 23 - RGB 3, 10, 16 - RGB 31, 31, 31 - RGB 6, 13, 18 - RGB 20, 26, 28 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 5, 5, 16 - RGB 8, 19, 28 - RGB 0, 0, 0 - RGB 31, 31, 31 - RGB 31, 31, 31 - RGB 0, 0, 0 - RGB 0, 0, 0 - RGB 0, 0, 0 - -GFX_172f1f: -INCBIN "gfx/unknown/172f1f.2bpp" - -Tilemap_1733af: -IF DEF(CORRUPT_TILES) -INCBIN "gfx/unknown/1733af_corrupt.tilemap" -ELSE -INCBIN "gfx/unknown/1733af.tilemap" -ENDC - -Attrmap_173517: -INCBIN "gfx/unknown/173517.attrmap" diff --git a/misc/mobile_46.asm b/misc/mobile_46.asm new file mode 100755 index 000000000..c7efdac3c --- /dev/null +++ b/misc/mobile_46.asm @@ -0,0 +1,8033 @@ +SECTION "bank46", ROMX, BANK[$46] + +Function118000: ; 118000 + ld a, $1 + ld [wcd38], a + jr asm_11800b + +Function118007: ; 118007 + xor a + ld [wcd38], a + +asm_11800b + call Function1183cb + ld a, $18 + ld [wcd33], a + ld a, $19 + ld [wcd34], a + ld a, $4 + ld [wc3f0], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a +.asm_118024 + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $1b + jr c, .asm_118037 + ld a, [wcd34] + ld [wcf66], a + +.asm_118037 + call Function1184a5 + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_118024 + pop af + ld [rSVBK], a + call Function118452 + call Function222a +Function11805e: ; 11805e (46:405e) + ret +; 11805f + +Function11805f: ; 11805f + ld a, $1 + ld [wcd38], a + call Function1183cb + ld a, $18 + ld [wcd33], a + ld a, $19 + ld [wcd34], a + ld a, $4 + ld [wc3f0], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a +.asm_11807d + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $1b + jr c, .asm_118090 + ld a, [wcd34] + ld [wcf66], a + +.asm_118090 + call Function11857c + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_11807d + pop af + ld [rSVBK], a + call Function118452 + call Function222a + ret +; 1180b8 + +Function1180b8: ; 1180b8 + call Function1183cb + ld a, $22 + ld [wcd33], a + ld a, $23 + ld [wcd34], a + ld a, $4 + ld [wc3f0], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a +.asm_1180d1 + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $28 + jr c, .asm_1180e4 + ld a, [wcd34] + ld [wcf66], a + +.asm_1180e4 + ld a, [wcf66] + cp $10 + jr c, .asm_1180f2 + cp $16 + jr nc, .asm_1180f2 + call Function11884c + +.asm_1180f2 + call Function1184ec + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_1180d1 + pop af + ld [rSVBK], a + call Function118452 + call Function222a + ret +; 11811a + +Function11811a: ; 11811a + ld a, 1 + ld [wcd38], a + jr Function118125 + +Function118121: ; 118121 + xor a + ld [wcd38], a + +Function118125: ; 118125 + call Function1183cb + ld a, $3 + ld [wcd33], a + ld a, $d + ld [wcd34], a + ld a, $4 + ld [wc3f0], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a +.asm_11813e + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $f + jr c, .asm_118151 + ld a, [wcd34] + ld [wcf66], a + +.asm_118151 + call Function11854d + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_11813e + xor a + ld [Unkn1Pals], a + pop af + ld [rSVBK], a + call Function118452 + call Function118180 + call Function222a + ret +; 118180 + +Function118180: ; 118180 + ld a, [ScriptVar] + and a + ret nz + ld a, [wcd38] + and a + ret z + ld a, $5 + call GetSRAMBank + ld hl, wcd69 + ld de, $a89c + ld bc, $0016 + call CopyBytes + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + ld de, $d202 + ld c, $96 + callba Function17d0b3 + jr c, .asm_1181d0 + ld de, $d202 + ld bc, $0196 + callba Function17d1e1 + jr c, .asm_1181d0 + ld hl, $d202 + ld de, $a8b2 + ld bc, $0096 + call CopyBytes +.asm_1181c9 + pop af + ld [rSVBK], a + call CloseSRAM + ret + +.asm_1181d0 + ld a, $d3 + ld [wc300], a + ld [ScriptVar], a + jr .asm_1181c9 +; 1181da + +Function1181da: ; 1181da + call Function1183cb + ld a, $2 + ld [wcd38], a + ld a, $21 + ld [wcd33], a + ld a, $22 + ld [wcd34], a + ld a, $4 + ld [wc3f0], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a +.asm_1181f8 + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $28 + jr c, .asm_11820b + ld a, [wcd34] + ld [wcf66], a + +.asm_11820b + call Function1185c3 + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_1181f8 + pop af + ld [rSVBK], a + call Function118452 + call Function222a + ret +; 118233 + +Function118233: ; 118233 + call Function1183cb + ld a, $1b + ld [wcd33], a + ld a, $1c + ld [wcd34], a + ld a, $6 + ld [wc3f0], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a +.asm_11824c + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $1e + jr c, .asm_11825f + ld a, [wcd34] + ld [wcf66], a + +.asm_11825f + call Function118624 + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_11824c + pop af + ld [rSVBK], a + call Function118452 + ret +; 118284 + +Function118284: ; 118284 + call Function1183cb + ld a, $19 + ld [wcd33], a + ld a, $1e + ld [wcd34], a + ld a, $5 + ld [wc3f0], a + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, $3 + ld [rSVBK], a ; $ff00+$70 +.asm_11829d + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $20 + jr c, .asm_1182b0 + ld a, [wcd34] + ld [wcf66], a +.asm_1182b0 + call Function1186f5 + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_11829d + pop af + ld [rSVBK], a ; $ff00+$70 + call Function118452 + ret +; 1182d5 (46:42d5) + + +Function1182d5: ; 1182d5 + call Function1183cb + ld a, $18 + ld [wcd33], a + ld a, $19 + ld [wcd34], a + ld a, $4 + ld [wc3f0], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a +.asm_1182ee + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $1b + jr c, .asm_118301 + ld a, [wcd34] + ld [wcf66], a + +.asm_118301 + call Function118746 + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_1182ee + pop af + ld [rSVBK], a + call Function118452 + call Function222a + ret +; 118329 + +Function118329: ; 118329 + call Function1183cb + ld a, $15 + ld [wcd33], a + ld a, $16 + ld [wcd34], a + ld a, $6 + ld [wc3f0], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a +.asm_118342 + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $18 + jr c, .asm_118355 + ld a, [wcd34] + ld [wcf66], a + +.asm_118355 + call Function118671 + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_118342 + pop af + ld [rSVBK], a + call Function118452 + ret +; 11837a + +Function11837a: ; 11837a + call Function1183cb + ld a, $16 + ld [wcd33], a + ld a, $17 + ld [wcd34], a + ld a, $6 + ld [wc3f0], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a +.asm_118393 + call JoyTextDelay + call Function118473 + ld a, [wcf66] + cp $19 + jr c, .asm_1183a6 + ld a, [wcd34] + ld [wcf66], a + +.asm_1183a6 + call Function1186b2 + call Function11a8fa + callba Function115dd3 + callba Function11619d + call DelayFrame + ld a, [wcf66] + ld hl, wcd33 + cp [hl] + jr nz, .asm_118393 + pop af + ld [rSVBK], a + call Function118452 + ret +; 1183cb + +Function1183cb: ; 1183cb + di + ld a, [rIE] + ld [wcd32], a + call DoubleSpeed + xor a + ld [rIF], a + ld [wc300], a + ld [wc301], a + ld [wc302], a + ld [wcd80], a + ld [wcd65], a + ld [wcd66], a + ld [wcd67], a + ld [wcd68], a + ld [wPartyMonMenuIconAnims + 6], a + ld [wcd89], a + ld [wcd8a], a + ld [wcd8b], a + ld [wc3ec], a + ld [wc3ed], a + ld [wc3ee], a + ld [wc3ef], a + ld hl, VramState + ld a, [hl] + ld [wcd7f], a + set 1, [hl] + ld a, $f + ld [rIE], a + ld a, $1 + ld [$ffc9], a + ld [hMobile], a + ei + callba Function106462 + callba Function106464 + callba Function115d99 + callba Function11615a + ld a, $5 + call GetSRAMBank + xor a + ld [$bfff], a + call CloseSRAM + ret +; 118440 + +Function118440: ; 118440 + push af + ld a, $5 + call GetSRAMBank + ld a, [$bfff] + inc a + ld [$bfff], a + call CloseSRAM + pop af + ret +; 118452 + +Function118452: ; 118452 + di + xor a + ld [$ffc9], a + ld [hMobile], a + ld [hVBlank], a + call NormalSpeed + xor a + ld [rIF], a + ld a, [wcd32] + ld [rIE], a + ei + ld a, [wcd7f] + ld [VramState], a + ld a, [wc300] + ld [ScriptVar], a + ret +; 118473 + +Function118473: ; 118473 + ld a, [wcd65] + and a + ret z + ld a, [wcd66] + inc a + ld [wcd66], a + cp $3c + ret nz + xor a + ld [wcd66], a + ld a, [wcd67] + inc a + ld [wcd67], a + cp $3c + ret nz + ld a, [wcd68] + inc a + ld [wcd68], a + cp $63 + jr z, .asm_1184a0 + xor a + ld [wcd67], a + ret + +.asm_1184a0 + xor a + ld [wcd65], a + ret +; 1184a5 + +Function1184a5: ; 1184a5 + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_1184b4 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 1184b4 + +Jumptable_1184b4: ; 1184b4 + dw Function11886e + dw Function118880 + dw Function11878d + dw Function1188b0 + dw Function11878d + dw Function1188b8 + dw Function11878d + dw Function1188c0 + dw Function11878d + dw Function1188c8 + dw Function11878d + dw Function118903 + dw Function118a8f + dw Function11878d + dw Function118d80 + dw Function118d9b + dw Function11878d + dw Function118ded + dw Function118e6d + dw Function11878d + dw Function11984e + dw Function118e76 + dw Function118e7e + dw Function11878d + dw Function11805e + dw Function118e76 + dw Function118e87 + dw Function118e76 +; 1184ec + +Function1184ec: ; 1184ec + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_1184fb +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 1184fb + +Jumptable_1184fb: ; 1184fb + dw Function11886e + dw Function118880 + dw Function11878d + dw Function1188b0 + dw Function11878d + dw Function1188b8 + dw Function11878d + dw Function1188c0 + dw Function11878d + dw Function1188c8 + dw Function11878d + dw Function118903 + dw Function119954 + dw Function11878d + dw Function119973 + dw Function11878d + dw Function119987 + dw Function11878d + dw Function1199b4 + dw Function1199ca + dw Function11878d + dw Function1199e2 + dw Function119b0d + dw Function11878d + dw Function119b6b + dw Function119b3b + dw Function11878d + dw Function119b52 + dw Function11878d + dw Function118e6d + dw Function11878d + dw Function118e76 + dw Function118e7e + dw Function11878d + dw Function11805e + dw Function118e76 + dw Function118e87 + dw Function119b45 + dw Function11878d + dw Function119ac9 + dw Function118e76 +; 11854d + +Function11854d: ; 11854d + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_11855c +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 11855c + +Jumptable_11855c: ; 11855c + dw Function118922 + dw Function118936 + dw Function118982 + dw Function11805e + dw Function119ca2 + dw Function119cab + dw Function119cb8 + dw Function119cc3 + dw Function119cdf + dw Function119cec + dw Function119c97 + dw Function119cab + dw Function119cb8 + dw Function118e76 + dw Function118e87 + dw Function118e76 +; 11857c + +Function11857c: ; 11857c + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_11858b +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 11858b + +Jumptable_11858b: ; 11858b + dw Function11886e + dw Function118880 + dw Function11878d + dw Function1188b0 + dw Function11878d + dw Function1188b8 + dw Function11878d + dw Function1188c0 + dw Function11878d + dw Function1188c8 + dw Function11878d + dw Function118903 + dw Function118a7a + dw Function11878d + dw Function11891c + dw Function1198ee + dw Function1198f7 + dw Function11878d + dw Function119937 + dw Function118e6d + dw Function11878d + dw Function118e76 + dw Function118e7e + dw Function11878d + dw Function11805e + dw Function118e76 + dw Function118e87 + dw Function118e76 +; 1185c3 + +Function1185c3: ; 1185c3 + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_1185d2 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 1185d2 + +Jumptable_1185d2: ; 1185d2 + dw Function11886e + dw Function118880 + dw Function11878d + dw Function1188b0 + dw Function11878d + dw Function1188b8 + dw Function11878d + dw Function1188c0 + dw Function11878d + dw Function1188c8 + dw Function11878d + dw Function118903 + dw Function118aa4 + dw Function11878d + dw Function118e92 + dw Function11878d + dw Function118eb0 + dw Function118ec6 + dw Function118f0d + dw Function118f14 + dw Function118f5e + dw Function11878d + dw Function118fc0 + dw Function11878d + dw Function119054 + dw Function1190d0 + dw Function11878d + dw Function1190ec + dw Function118e6d + dw Function11878d + dw Function118e76 + dw Function118e7e + dw Function11878d + dw Function11805e + dw Function118e76 + dw Function118e87 + dw Function119cc3 + dw Function119cdf + dw Function119cec + dw Function11914e + dw Function118e76 +; 118624 + +Function118624: ; 118624 + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_118633 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 118633 + +Jumptable_118633: ; 118633 + dw Function118866 + dw Function118880 + dw Function11878d + dw Function1188b0 + dw Function11878d + dw Function1188b8 + dw Function11878d + dw Function1188c0 + dw Function11878d + dw Function1188c8 + dw Function11878d + dw Function118903 + dw Function118aa4 + dw Function11878d + dw Function118e92 + dw Function11878d + dw Function11915d + dw Function118f68 + dw Function11878d + dw Function119009 + dw Function11878d + dw Function119054 + dw Function118e6d + dw Function11878d + dw Function118e76 + dw Function118e7e + dw Function11878d + dw Function11805e + dw Function118e76 + dw Function118e87 + dw Function118e76 +; 118671 + +Function118671: ; 118671 + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_118680 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 118680 + +Jumptable_118680: ; 118680 + dw Function118866 + dw Function118880 + dw Function11878d + dw Function1188b0 + dw Function11878d + dw Function1188b8 + dw Function11878d + dw Function1188c0 + dw Function11878d + dw Function1188c8 + dw Function11878d + dw Function118903 + dw Function119380 + dw Function119388 + dw Function1193a0 + dw Function11878d + dw Function118e6d + dw Function11878d + dw Function118e76 + dw Function118e7e + dw Function11878d + dw Function11805e + dw Function118e76 + dw Function118e87 + dw Function118e76 +; 1186b2 + +Function1186b2: ; 1186b2 + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_1186c1 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 1186c1 + +Jumptable_1186c1: ; 1186c1 + dw Function118866 + dw Function118880 + dw Function11878d + dw Function1188b0 + dw Function11878d + dw Function1188b8 + dw Function11878d + dw Function1188c0 + dw Function11878d + dw Function1188c8 + dw Function11878d + dw Function118903 + dw Function119380 + dw Function1193e3 + dw Function1193fb + dw Function11878d + dw Function119413 + dw Function118e6d + dw Function11878d + dw Function118e76 + dw Function118e7e + dw Function11878d + dw Function11805e + dw Function118e76 + dw Function118e87 + dw Function118e76 +; 1186f5 + +Function1186f5: ; 1186f5 (46:46f5) + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_118704 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 118704 (46:4704) + +Jumptable_118704: ; 118704 (46:4704) + dw Function11886a + dw Function118880 + dw Function11878d + dw Function1188b0 + dw Function11878d + dw Function1188b8 + dw Function11878d + dw Function1188c0 + dw Function11878d + dw Function1188c8 + dw Function11878d + dw Function118903 + dw Function118abc + dw Function11878d + dw Function119451 + dw Function1195f8 + dw Function119612 + dw Function119629 + dw Function119648 + dw Function11878d + dw Function118e6d + dw Function11878d + dw Function118e76 + dw Function118e7e + dw Function11878d + dw Function11805e + dw Function11967d + dw Function119685 + dw Function119665 + dw Function11966d + dw Function118e76 + dw Function118e87 + dw Function118e76 +; 118746 (46:4746) + +Function118746: ; 118746 + ld a, [wcf66] + ld e, a + ld d, 0 + ld hl, Jumptable_118755 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 118755 + +Jumptable_118755: ; 118755 + dw Function11886e + dw Function118880 + dw Function11878d + dw Function1188b0 + dw Function11878d + dw Function1188b8 + dw Function11878d + dw Function1188c0 + dw Function11878d + dw Function1188c8 + dw Function11878d + dw Function118903 + dw Function118ad0 + dw Function11878d + dw Function1196f2 + dw Function1197c9 + dw Function1197dc + dw Function11878d + dw Function118e6d + dw Function11878d + dw Function119800 + dw Function118e76 + dw Function118e7e + dw Function11878d + dw Function11805e + dw Function118e76 + dw Function118e87 + dw Function118e76 +; 11878d + +Function11878d: ; 11878d (46:478d) + ld a, [wc821] + bit 1, a + jr nz, .asm_1187af + bit 2, a + jr nz, .asm_1187d1 + bit 0, a + jr nz, .asm_1187aa + ld a, [wcd89] + and $1 + jr z, .asm_1187a7 + ld a, $3 + ld [rSVBK], a ; $ff00+$70 +.asm_1187a7 + jp Function119e2e +.asm_1187aa + call Function118821 + ret c + ret +.asm_1187af + ld a, $0 + call Function3e32 + ld [wc300], a + ld a, l + ld [wc301], a + ld a, h + ld [wc302], a + ld a, $a + call Function3e32 + ld a, [wc3f0] + ld [wPartyMonMenuIconAnims + 5], a + ld a, [wcd34] + ld [wcf66], a + ret +.asm_1187d1 + ld hl, wcd89 + bit 0, [hl] + jr nz, .asm_118803 + set 0, [hl] + ld a, $6 + ld [rSVBK], a ; $ff00+$70 + ld de, Unkn1Pals + ld bc, $1000 + ld a, [hl] + sla a + jr c, .asm_1187f9 + sla a + jr c, .asm_1187fd + sla a + jr c, .asm_1187f5 + ld a, $24 + jr .asm_1187ff +.asm_1187f5 + ld a, $28 + jr .asm_1187ff +.asm_1187f9 + ld a, $2a + jr .asm_1187ff +.asm_1187fd + ld a, $2c +.asm_1187ff + call Function3e32 + ret +.asm_118803 + ld a, $d3 + +Function118805: ; 118805 (46:4805) + ld [wc300], a + xor a + ld [wc301], a + ld [wc302], a + ld a, $a + call Function3e32 + ld a, [wc3f0] + ld [wPartyMonMenuIconAnims + 5], a + ld a, [wcd34] + ld [wcf66], a + ret + +Function118821: ; 118821 (46:4821) + ld a, [wPartyMonMenuIconAnims + 5] + cp $3 + jr c, .asm_11884a + cp $4 + jr z, .asm_11884a + ld a, [hJoyDown] ; $ff00+$a8 + cp $5 + jr nz, .asm_11884a + ld a, $a + call Function3e32 + ld a, $a + ld [wc300], a + ld a, [wc3f0] + ld [wPartyMonMenuIconAnims + 5], a + ld a, [wcd34] + ld [wcf66], a + scf + ret +.asm_11884a + and a + ret +; 11884c (46:484c) + +Function11884c: ; 11884c + ld a, [hJoyDown] + cp $5 + jr nz, .asm_118864 + ld a, $a + call Function3e32 + ld a, $a + ld [wc300], a + ld a, [wcd34] + ld [wcf66], a + scf + ret + +.asm_118864 + and a + ret +; 118866 + +Function118866: + ld a, 2 + jr asm_11886f + +Function11886a: ; 11886a (46:486a) + ld a, 1 + jr asm_11886f +; 11886e (46:486e) + +Function11886e: + xor a + +asm_11886f + ld [BGMapPalBuffer], a + ld a, $0 + ld [wcd3c], a + call Function119e2e + ld a, [wcd33] + ld [wcd45], a + +Function118880: ; 118880 (46:4880) + call Function119ed8 + ret c + xor a + ld [wcf64], a + ld [wc807], a + ld de, wcd81 + ld hl, $46 + ld a, $2 + jp Function119e2b +; 118896 (46:4896) + +Function118896: ; 118896 + ld a, [wc821] + bit 1, a + jr nz, .asm_1188a5 + bit 2, a + jr nz, .asm_1188a5 + bit 0, a + jr z, .asm_1188aa + +.asm_1188a5 + ld a, $34 + jp Function119e2b + +.asm_1188aa + call Function119e2e + jp Function119e2e +; 1188b0 + +Function1188b0: ; 1188b0 (46:48b0) + ld de, wPartyMonMenuIconAnims + 48 + 2 + ld a, $c + jp Function119e2b + +Function1188b8: ; 1188b8 (46:48b8) + ld de, wc3ac + ld a, $e + jp Function119e2b + +Function1188c0: ; 1188c0 (46:48c0) + ld de, wc3cd + ld a, $10 + jp Function119e2b + +Function1188c8: ; 1188c8 (46:48c8) + ld a, $1 + ld [wcd65], a + call Function1188e7 + ld hl, wc708 +.asm_1188d3 + ld a, [de] + inc de + ld [hli], a + and a + jr nz, .asm_1188d3 + call Function119eb4 + call Function119ec2 + ld hl, wc708 + ld a, $6 + jp Function119e2b + +Function1188e7: ; 1188e7 (46:48e7) + ld de, wPartyMonMenuIconAnims + 48 + 2 + ld a, $5 + call GetSRAMBank + ld a, [$aa4a] + call CloseSRAM + and a + ret z + sla a + ld c, a +.asm_1188fa + ld a, [de] + inc de + and a + jr nz, .asm_1188fa + dec c + jr nz, .asm_1188fa + ret + +Function118903: ; 118903 (46:4903) + ld a, [wc3f0] + ld [wPartyMonMenuIconAnims + 5], a + ld c, $1 + callba Function115e18 + ld a, $8 + ld [wcd3c], a + call Function119ed8 + jp Function119e2e + + +Function11891c: ; 11891c + call Function118b42 + jp Function119e2e + + +Function118922: ; 118922 + ld a, [wcd38] + and a + jr nz, .asm_11892d + ld hl, Text_WhatLevelDoYouWantToChallenge + jr .asm_118930 + +.asm_11892d + ld hl, Text_CheckBattleRoomListByMaxLevel + +.asm_118930 + call Function11a9c0 + call Function119e2e + +Function118936: + ld a, [wPartyMonMenuIconAnims + 6] + and a + ret nz + ld hl, MenuDataHeader_119cf7 + call LoadMenuDataHeader + call Function1cbb + call GetMemTileCoord + call Function321c + hlcoord 16, 8, AttrMap + ld a, $40 + or [hl] + ld [hl], a + call Function3200 + ld a, $1 + ld [wcd4f], a + ld a, $1 + ld [rSVBK], a + ld a, [StatusFlags] + bit 6, a + jr nz, .asm_11896b + ld hl, Strings_Ll0ToL40 ; Address to list of strings with the choosable levels + ld a, 5 ; 4 levels to choose from, including 'Cancel'-option + jr .asm_118970 + +.asm_11896b + ld hl, Strings_L10ToL100 ; Address to list of strings with the choosable levels + ld a, 11 ; 10 levels to choose from, including 'Cancel'-option + +.asm_118970 + ld [wcd4a], a + ld a, l + ld [wcd4b], a + ld a, h + ld [wcd4c], a + ld a, $3 + ld [rSVBK], a + call Function119e2e + +Function118982: + hlcoord 13, 8 + ld de, String_119d07 + call PlaceString + hlcoord 13, 10 + ld de, String_119d07 + call PlaceString + ld a, [wcd4b] + ld l, a + ld a, [wcd4c] + ld h, a + ld d, $0 + ld a, [wcd4f] + dec a + rlca + rlca + rlca + ld e, a + add hl, de + ld a, l + ld e, a + ld a, h + ld d, a + ld a, [rSVBK] + push af + ld a, $1 + ld [rSVBK], a + ld bc, StringBuffer3 +.asm_1189b5 + ld a, [hli] + cp $50 + jr z, .asm_1189c4 + cp $7f + jr z, .asm_1189c2 + ld [bc], a + inc bc + jr .asm_1189b5 + +.asm_1189c2 + ld a, $50 + +.asm_1189c4 + ld [bc], a + pop af + ld [rSVBK], a + hlcoord 13, 9 + call PlaceString + ld hl, hJoyPressed + ld a, [hl] + and $2 + jr nz, .asm_118a39 + ld a, [hl] + and $1 + jr nz, .asm_118a01 + ld a, [hl] + and $80 + jr nz, .asm_1189e6 + ld a, [hl] + and $40 + jr nz, .asm_1189f2 +.asm_1189e5 + ret + +.asm_1189e6 + ld hl, wcd4f + dec [hl] + jr nz, .asm_1189e5 + ld a, [wcd4a] + ld [hl], a + jr .asm_1189e5 + +.asm_1189f2 + ld a, [wcd4a] + ld hl, wcd4f + inc [hl] + cp [hl] + jr nc, .asm_1189e5 + ld a, $1 + ld [hl], a + jr .asm_1189e5 + +.asm_118a01 + call PlayClickSFX + ld a, [wcd4f] + ld hl, wcd4a + cp [hl] + jr z, .asm_118a3c + dec a + and $fe + srl a + ld [wcf65], a + ld a, [rSVBK] + push af + ld a, $1 + ld [rSVBK], a + call WriteBackup + pop af + ld [rSVBK], a + ld a, [wcd38] + and a + jr nz, .asm_118a30 + call Function119d93 + ret c + call Function119dd1 + ret c + +.asm_118a30 + ld a, [wcd4f] + ld [wd000 + $800], a + jp Function119e2e + +.asm_118a39 + call PlayClickSFX + +.asm_118a3c + ld a, [rSVBK] + push af + ld a, $1 + ld [rSVBK], a + call WriteBackup + pop af + ld [rSVBK], a + ld a, $7 + ld [wcf66], a + ld a, $0 + ld [wcd46], a + ret + + + +Function118a54: ; 118a54 + ld a, [wcd55] + ld l, a + ld a, [wcd56] + ld h, a + ld de, wc3ec + ld bc, $0004 + jp Function118ae4 +; 118a65 + +Function118a65: ; 118a65 + ld hl, BattleDownloadURL + ld de, wcc60 + ld bc, $80 + call CopyBytes + ld de, Unkn1Pals + ld bc, $1000 + jp Function118b10 +; 118a7a + +Function118a7a: ; 118a7a + ld hl, BattleDownloadURL + ld de, wcc60 + ld bc, $80 + call CopyBytes + ld de, Unkn1Pals + ld bc, $1000 + jp Function118b10 +; 118a8f + +Function118a8f: ; 118a8f + ld hl, ExchangeDownloadURL + ld de, wcc60 + ld bc, $80 + call CopyBytes + ld de, Unkn1Pals + ld bc, $1000 + jp Function118b10 +; 118aa4 + +Function118aa4: ; 118aa4 + ld hl, NewsDownloadURL + ld de, wcc60 + ld bc, $80 + call CopyBytes + ld a, $5 + ld [rSVBK], a + ld de, LYOverrides + ld bc, $e00 + jr Function118b10 +; 118abc + +Function118abc: ; 118abc (46:4abc) + ld hl, MenuDownloadURL + ld de, wcc60 + ld bc, $80 + call CopyBytes + ld de, Unkn1Pals + ld bc, $1000 + jr Function118b10 +; 118ad0 (46:4ad0) + +Function118ad0: + ld hl, IndexDownloadURL + ld de, wcc60 + ld bc, $80 + call CopyBytes + ld de, Unkn1Pals + ld bc, $1000 + jr Function118b10 + +Function118ae4: + push bc + push de + push hl + ld a, $8 + ld [wcd3c], a + call Function119ed8 + pop hl + ld c, $0 + ld de, wcc60 +.asm_118af5 + ld a, [hli] + ld [de], a + inc de + and a + jr z, .asm_118b06 + inc c + ld a, c + cp $a6 + jr c, .asm_118af5 + ld a, $da + jp Function118805 + +.asm_118b06 + call Function118b24 + pop de + pop bc + ld a, $2a + jp Function119e2b +; 118b10 + +Function118b10: + push de + push bc + ld a, $8 + ld [wcd3c], a + call Function119ed8 + call Function118b24 + pop bc + pop de + ld a, $2a + jp Function119e2b + +Function118b24: ; 118b24 (46:4b24) + ld hl, wPartyMonMenuIconAnims + 48 + 2 + ld a, $8 + ld [hli], a + ld a, $c7 + ld [hli], a + ld a, $60 + ld [hli], a + ld a, $cc + ld [hli], a + call Function119eb4 + call Function119ec2 + ld a, $80 + ld [wcd89], a + ld hl, wPartyMonMenuIconAnims + 48 + 2 + ret +; 118b42 (46:4b42) + +Function118b42: ; 118b42 + ld hl, DefaultFlypoint + ld a, l + ld [wcd51], a + ld a, h + ld [wcd52], a + call Function118b8c + ld a, l + ld [wcd55], a + ld [wcd59], a + ld a, h + ld [wcd56], a + ld [wcd5a], a + call Function118b8c + ld a, l + ld [wcd53], a + ld [wcd5d], a + ld a, h + ld [wcd54], a + ld [wcd5e], a + call Function118b8c + ld a, l + ld [wcd57], a + ld [wcd5b], a + ld a, h + ld [wcd58], a + ld [wcd5c], a + call Function118b8c + ld a, l + ld [wcd5f], a + ld a, h + ld [wcd60], a + ret +; 118b8c + +Function118b8c: ; 118b8c +.asm_118b8c + call Function118b9a + ret nc + ld a, [hli] + cp $d + jr nz, .asm_118b8c + dec hl + xor a +rept 2 + ld [hli], a +endr + ret +; 118b9a + +Function118b9a: ; 118b9a + ld a, h + cp $e0 + ret c + ld a, $d3 + call Function118805 + and a + ret +; 118ba5 + + + charmap " ", $20 ; revert to ascii + +ExchangeDownloadURL: ; 0x118ba5 + db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/exchange/index.txt", 0 + +BattleDownloadURL: ; 0x118bf7 + db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/battle/index.txt", 0 + +NewsDownloadURL: ; 0x118c47 + db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/news/index.txt", 0 + +MenuDownloadURL: ; 0x118c95 + db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/POKESTA/menu.cgb", 0 + +IndexDownloadURL: ; 0x118ce5 + db "http://gameboy.datacenter.ne.jp/cgb/download?name=/01/CGB-BXTJ/tamago/index.txt", 0 + + +Function118d35: ; 118d35 + ld hl, LYOverridesBackup + ld a, [wcd38] + and a + jr nz, .asm_118d6e + ld a, [hli] + cp $94 + jr nz, .asm_118d7b + ld a, [hl] + cp $5 + jr nz, .asm_118d7b + ld a, [wcd4f] + sla a + ld b, a + sla a + sla a + add b + ld b, a + ld a, $5 + call GetSRAMBank + ld a, b + ld [$b2fb], a + call CloseSRAM + callba Function170be4 + callba Function1700c4 + jr .asm_118d78 + +.asm_118d6e + ld a, [hli] + cp $96 + jr nz, .asm_118d7b + ld a, [hl] + cp $0 + jr nz, .asm_118d7b + +.asm_118d78 + jp Function119e2e + +.asm_118d7b + ld a, $d3 + jp Function118805 +; 118d80 + +Function118d80: ; 118d80 + call Function118e06 + ld a, [wcd38] + and a + jr z, .asm_118d8e + call Function119e2e + jr asm_118d9f + +.asm_118d8e + ld a, $9 + ld [wcd3c], a + ld a, $12 + ld [wcd45], a + call Function119e2e + +Function118d9b: + call Function119ed8 + ret c + +asm_118d9f + ld hl, $c608 + call Function119940 + ld a, [wcd38] + and a + jr nz, .asm_118db2 + ld a, $8f + ld [wcd3b], a + jr .asm_118db7 + +.asm_118db2 + ld a, $26 + ld [wcd3b], a + +.asm_118db7 + ld hl, $d800 + ld a, $8 + ld [hli], a + ld a, $c6 + ld [hli], a + ld a, [wcd3b] + ld [hli], a + xor a + ld [hli], a + ld a, $8 + ld [hli], a + ld a, $c7 + ld [hli], a + ld a, [wcd39] + ld [hli], a + ld a, [wcd3a] + ld [hli], a + call Function119eb4 + call Function119ec2 + ld a, $40 + ld [wcd89], a + ld hl, $d800 + ld de, $de00 + ld bc, $0200 + ld a, $2c + jp Function119e2b +; 118ded + +Function118ded: ; 118ded + ld a, [wcd38] + and a + jr z, .asm_118e03 + ld a, [rSVBK] + push af + ld a, $1 + ld [rSVBK], a + callba Function11b93b + pop af + ld [rSVBK], a + +.asm_118e03 + jp Function119e2e +; 118e06 + +Function118e06: ; 118e06 + ld hl, DefaultFlypoint + ld a, [wcd38] + and a + jr z, .asm_118e1d +.asm_118e0f + call Function118b9a + ret nc + ld a, [hli] + cp $d + jr nz, .asm_118e0f + ld a, [hli] + cp $a + jr nz, .asm_118e0f + +.asm_118e1d + ld a, l + ld [wcd39], a + ld a, h + ld [wcd3a], a +.asm_118e25 + call Function118b9a + ret nc + ld a, [hli] + cp $d + jr nz, .asm_118e25 + ld a, [hli] + cp $a + jr nz, .asm_118e25 + dec hl + xor a + ld [hld], a + ld [hl], a + jr asm_118e3e + +Function118e39: ; 118e39 (46:4e39) +.asm_118e39 + ld a, [hli] + and a + jr nz, .asm_118e39 + dec hl +asm_118e3e +.asm_118e3e + ld a, [hld] + cp $2f + jr nz, .asm_118e3e +rept 2 + inc hl +endr + ld de, wcd85 + ld c, $4 +.asm_118e4a + ld a, [hli] + cp $2e + jr z, .asm_118e63 + cp $30 + jr c, .asm_118e67 + cp $3a + jr nc, .asm_118e67 + sub $30 + add $f6 + ld [de], a + inc de + dec c + jr nz, .asm_118e4a + ld de, wcd85 +.asm_118e63 + ld a, $50 + ld [de], a + ret +.asm_118e67 + ld a, $f3 + ld [de], a + inc de + jr .asm_118e63 + +Function118e6d: ; 118e6d (46:4e6d) + xor a + ld [wcd65], a + ld a, $a + jp Function119e2b + +Function118e76: ; 118e76 (46:4e76) + ld a, $c + ld [wcd3c], a + jp Function119e2e + +Function118e7e: ; 118e7e (46:4e7e) + call Function119ed8 + ret c + ld a, $36 + jp Function119e2b + +Function118e87: ; 118e87 (46:4e87) + call Function119ed8 + ret c + ld a, [wcd33] + ld [wcf66], a + ret +; 118e92 (46:4e92) + +Function118e92: ; 118e92 + call Function118440 + call Function1191d3 + ld a, [wcd53] + ld l, a + ld a, [wcd54] + ld h, a + ld de, wcc60 + call Function1191ad + ret c + ld de, $d800 + ld bc, $0800 + jp Function118b10 +; 118eb0 + +Function118eb0: ; 118eb0 + call Function118440 + ld hl, $d802 + ld de, BGMapBuffer + ld bc, $000c + call CopyBytes + call Function1192cc + ret c + jp Function119e2e +; 118ec6 + +Function118ec6: ; 118ec6 + call Function118440 + call SpeechTextBox + ld hl, $d80e + ld de, wPartyMonMenuIconAnims + 12 + ld bc, $0026 + call CopyBytes + xor a + ld [wPartyMonMenuIconAnims + 11], a + ld a, $20 + ld [wPartyMonMenuIconAnims + 7], a + ld a, $c3 + ld [wPartyMonMenuIconAnims + 8], a + hlcoord 1, 14 + ld a, l + ld [wPartyMonMenuIconAnims + 9], a + ld a, h + ld [wPartyMonMenuIconAnims + 10], a + ld a, $2 + ld [wPartyMonMenuIconAnims + 6], a + ld a, $1d + ld [wcd3c], a + ld a, $24 + ld [wcd45], a + ld a, $11 + ld [wcd46], a + ld a, $1c + ld [wcd47], a + jp Function119e2e +; 118f0d + +Function118f0d: ; 118f0d + call Function119ed8 + ret c + call Function118440 + +Function118f14: + call Function118440 + ld a, [wcd51] + ld l, a + ld a, [wcd52] + ld h, a + ld de, wcc60 + call Function1191ad + ret c + ld a, [wcc60] + and a + jr z, .asm_118f32 + ld hl, UnknownText_0x11aa13 + call Function11a9c0 + +.asm_118f32 + ld a, [wcd57] + ld l, a + ld a, [wcd58] + ld h, a + ld de, wcc60 + call Function1191ad + ret c + ld hl, wcc60 + call Function118e39 + ld a, $9 + ld [wcd3c], a + ld a, $24 + ld [wcd45], a + ld a, $13 + ld [wcd46], a + ld a, $1c + ld [wcd47], a + jp Function119e2e +; 118f5e + +Function118f5e: ; 118f5e + call Function119ed8 + ret c + call Function118440 + call DelayFrame + +Function118f68: + call Function119223 + ret c + call Function118440 + ld a, [wcd51] + ld l, a + ld a, [wcd52] + ld h, a + ld de, wcc60 + call Function1191ad + ret c + ld a, [wcc60] + and a + jr z, .asm_118fba + ld hl, wPartyMonMenuIconAnims + 48 + 2 + ld a, $c608 % $100 + ld [hli], a + ld a, $c608 / $100 + ld [hli], a + ld a, [wcd4b] + ld [hli], a + ld a, [wcd4c] + ld [hli], a + ld a, wc708 % $100 + ld [hli], a + ld a, wc708 / $100 + ld [hli], a + ld a, $60 + ld [hli], a + ld a, $cc + ld [hli], a + call Function119eb4 + call Function119ec2 + ld a, $40 + ld [wcd89], a + ld hl, wPartyMonMenuIconAnims + 48 + 2 + ld de, $de00 + ld bc, $0200 + ld a, $2c + jp Function119e2b + +.asm_118fba + call Function119e2e + jp Function119e2e +; 118fc0 + +Function118fc0: ; 118fc0 + call Function118440 + ld a, [wcd55] + ld l, a + ld a, [wcd56] + ld h, a + ld de, wcc60 + call Function1191ad + ret c + ld a, [wcc60] + and a + jr z, .asm_118ffa + ld a, [wcd51] + ld l, a + ld a, [wcd52] + ld h, a + ld de, wcc60 + call Function1191ad + ret c + ld a, [wcc60] + and a + jr z, .asm_118ff2 + ld hl, UnknownText_0x11aa2c + jr .asm_118ff5 + +.asm_118ff2 + ld hl, UnknownText_0x11aa4b + +.asm_118ff5 + call Function11a9c0 + jr Function119009 + +.asm_118ffa + ld hl, UnknownText_0x11aa4b + call Function11a9c0 + call Function119e2e + call Function119e2e + jp Function119e2e + +Function119009: + call Function118440 + call Function119300 + ld a, [wcd55] + ld l, a + ld a, [wcd56] + ld h, a + ld de, wcc60 + call Function1191ad + ret c + ld hl, wPartyMonMenuIconAnims + 48 + 2 + ld a, $8 + ld [hli], a + ld a, $c6 + ld [hli], a + ld a, [wcd4b] + ld [hli], a + ld a, [wcd4c] + ld [hli], a + ld a, $8 + ld [hli], a + ld a, $c7 + ld [hli], a + ld a, $60 + ld [hli], a + ld a, $cc + ld [hli], a + call Function119eb4 + call Function119ec2 + ld a, $40 + ld [wcd89], a + ld hl, wPartyMonMenuIconAnims + 48 + 2 + ld de, Unkn1Pals + ld bc, $1000 + ld a, $2c + jp Function119e2b +; 119054 + +Function119054: ; 119054 + ld a, $6 + call GetSRAMBank + ld hl, DefaultFlypoint + ld a, [wcd4f] + ld e, a + ld a, [wcd50] + ld d, a + ld a, [Unkn1Pals] + ld c, a + ld a, [wd001] + ld b, a + call Function119192 + ret c + ld a, [wcd89] + and $1 + jr z, .asm_11908a + ld a, $6 + ld [rSVBK], a + ld hl, DefaultFlypoint + ld a, [Unkn1Pals] + ld c, a + ld a, [wd001] + ld b, a + call Function119192 + ret c + +.asm_11908a + call CloseSRAM + ld a, $3 + ld [rSVBK], a + ld a, $5 + call GetSRAMBank + ld a, [wcd4f] + ld [$b1b3], a + ld a, [wcd50] + ld [$b1b4], a + ld hl, BGMapBuffer + ld de, $aa7f + ld bc, $000c + call CopyBytes + ld a, [rSVBK] + push af + ld a, $1 + ld [rSVBK], a + ld a, [wd474] + ld [$b2f3], a + ld hl, wd475 + ld de, $b2f4 + ld bc, $0004 + call CopyBytes + pop af + ld [rSVBK], a + call CloseSRAM + jp Function119e2e +; 1190d0 + +Function1190d0: ; 1190d0 + ld a, $3 + ld [rSVBK], a + ld a, [wcd57] + ld l, a + ld a, [wcd58] + ld h, a + ld de, wcc60 + call Function1191ad + ret c + ld de, Unkn1Pals + ld bc, $1000 + jp Function118b10 +; 1190ec + +Function1190ec: ; 1190ec + ld a, $5 + call GetSRAMBank + ld hl, BGMapBuffer + ld de, $aa73 + ld bc, $000c + call CopyBytes + call CloseSRAM + ld a, $5 + call GetSRAMBank + ld a, $1 + ld [$aa72], a + call CloseSRAM + ld a, $6 + call GetSRAMBank + ld a, [Unkn1Pals] + ld c, a + ld a, [wd001] + ld b, a + ld hl, DefaultFlypoint + ld de, $a000 + call Function119192 + ret c + ld a, [wcd89] + and $1 + jr z, .asm_11913e + ld a, $6 + ld [rSVBK], a + ld a, [Unkn1Pals] + ld c, a + ld a, [wd001] + ld b, a + ld hl, DefaultFlypoint + call Function119192 + ret c + +.asm_11913e + ld a, $3 + ld [rSVBK], a + call CloseSRAM + ld hl, UnknownText_0x11aa5a + call Function11a9c0 + jp Function119e2e +; 11914e + +Function11914e: ; 11914e + call Function119ed8 + ret c + ld a, $1c + ld [wcf66], a + ld a, $a + ld [wc300], a + ret +; 11915d + +Function11915d: ; 11915d + ld hl, $d802 + ld de, BGMapBuffer + ld bc, $000c + call CopyBytes + ld a, $5 + call GetSRAMBank + ld hl, BGMapBuffer + ld de, $aa7f + ld c, $c +.asm_119176 + ld a, [de] + inc de + cp [hl] + jr nz, .asm_119184 + inc hl + dec c + jr nz, .asm_119176 + call Function119e2e + jr .asm_11918e + +.asm_119184 + ld a, $16 + ld [wcf66], a + ld a, $b + ld [wc300], a + +.asm_11918e + call CloseSRAM + ret +; 119192 + +Function119192: ; 119192 + inc b + inc c + jr .asm_11919e + +.asm_119196 + ld a, [hli] + ld [de], a + inc de + ld a, $bf + cp d + jr c, .asm_1191a6 + +.asm_11919e + dec c + jr nz, .asm_119196 + dec b + jr nz, .asm_119196 + and a + ret + +.asm_1191a6 + ld a, $d3 + call Function118805 + scf + ret +; 1191ad + +Function1191ad: ; 1191ad + push bc + ld c, $0 + ld a, $5 + ld [rSVBK], a +.asm_1191b4 + ld a, [hli] + ld [de], a + inc de + and a + jr z, .asm_1191cc + inc c + ld a, c + cp $a6 + jr c, .asm_1191b4 + ld a, $da + call Function118805 + ld a, $3 + ld [rSVBK], a + pop bc + scf + ret + +.asm_1191cc + ld a, $3 + ld [rSVBK], a + pop bc + and a + ret +; 1191d3 + +Function1191d3: ; 1191d3 + ld hl, wd102 + ld a, l + ld [wcd53], a + ld a, h + ld [wcd54], a + call Function11920f + ld a, l + ld [wcd51], a + ld a, [wcd4a] + ld a, h + ld [wcd52], a + call Function11920f + ld a, l + ld [wcd55], a + ld a, [wcd4a] + ld a, h + ld [wcd56], a + call Function11920f + ld a, [wcd49] + ld a, l + ld [wcd57], a + ld a, [wcd4a] + ld a, h + ld [wcd58], a + call Function11920f + ret +; 11920f + +Function11920f: ; 11920f +.asm_11920f + call Function118b9a + ret nc + ld a, [hli] + cp $d + jr nz, .asm_11920f + ld a, [hli] + cp $a + jr nz, .asm_11920f + dec hl + xor a + ld [hld], a + ld [hli], a + inc hl + ret +; 119223 + +Function119223: ; 119223 + xor a + ld [wcd4b], a + ld [wcd4c], a + ld a, $5 + call GetSRAMBank + ld hl, wc3cd + ld de, $b092 + ld bc, $001f + call CopyBytes + dec de + xor a + ld [de], a + ld hl, $d810 +.asm_119241 + ld a, [hli] + cp $50 + jr nz, .asm_119241 + ld a, [hli] + ld [wcd4f], a + ld a, [hli] + ld [wcd50], a + ld a, [hli] + ld [$b1b1], a + ld c, a + ld a, [hli] + ld [$b1b2], a + ld b, a + ld de, $b1d3 + call CopyBytes + call CloseSRAM + ld e, l + ld d, h + ld hl, $c608 +.asm_119266 + ld a, [de] + inc de + cp $ff + jr z, .asm_1192c2 + cp $fe + jr z, .asm_1192a5 + call GetSRAMBank + ld a, [de] + inc de + ld c, a + ld a, [de] + inc de + ld b, a + ld a, [de] + inc de + push de + push af + ld a, [wcd4b] + ld e, a + ld a, [wcd4c] + ld d, a + pop af +.asm_119286 + push af + ld a, [bc] + inc bc + ld [hli], a + inc de + pop af + dec a + jr nz, .asm_119286 + call CloseSRAM + ld a, e + ld [wcd4b], a + ld a, d + ld [wcd4c], a + pop de +.asm_11929b + and a + jr z, .asm_119266 + ld a, $d3 + call Function118805 + scf + ret + +.asm_1192a5 + ld a, [wcd4b] + ld c, a + ld a, [wcd4c] + ld b, a + ld a, [de] + inc de +.asm_1192af + push af + ld a, [de] + inc de + ld [hli], a + inc bc + pop af + dec a + jr nz, .asm_1192af + ld a, c + ld [wcd4b], a + ld a, b + ld [wcd4c], a + jr .asm_11929b + +.asm_1192c2 + ld a, e + ld [wcd4d], a + ld a, d + ld [wcd4e], a + and a + ret +; 1192cc + +Function1192cc: ; 1192cc + ld a, $5 + call GetSRAMBank + ld hl, $aa73 + ld de, $c608 + ld bc, $000c + call CopyBytes + call CloseSRAM + ld hl, $c608 + ld de, BGMapBuffer + ld c, $c +.asm_1192e8 + ld a, [de] + inc de + ld b, a + ld a, [hli] + cp b + jr nz, .asm_1192fe + dec c + jr nz, .asm_1192e8 + ld a, $1f + ld [wcd3c], a + ld a, $27 + ld [wcf66], a + scf + ret + +.asm_1192fe + and a + ret +; 119300 + +Function119300: ; 119300 + xor a + ld [wcd4b], a + ld [wcd4c], a + ld a, [wcd4d] + ld e, a + ld a, [wcd4e] + ld d, a + ld hl, $c608 + ld a, [wcd4b] + ld c, a + ld a, [wcd4c] + ld b, a +.asm_11931a + ld a, [de] + inc de + cp $50 + jr z, .asm_119324 + ld [hli], a + inc bc + jr .asm_11931a + +.asm_119324 + ld a, $3d + ld [hli], a + inc bc + ld a, c + ld [wcd4b], a + ld a, b + ld [wcd4c], a + ld a, [de] + inc de + call GetSRAMBank + ld a, [de] + inc de + ld c, a + ld a, [de] + inc de + ld b, a + ld a, [de] + inc de + push de + push af + ld a, [wcd4b] + ld e, a + ld a, [wcd4c] + ld d, a + pop af +.asm_119348 + push af + ld a, [bc] + and $f0 + swap a + call Function1197bf + ld [hli], a + inc de + ld a, [bc] + inc bc + and $f + call Function1197bf + ld [hli], a + inc de + pop af + dec a + jr nz, .asm_119348 + call CloseSRAM + ld a, e + ld [wcd4b], a + ld a, d + ld [wcd4c], a + pop de + ld a, [de] + cp $50 + jr z, .asm_11937f + ld a, [wcd4b] + ld c, a + ld a, [wcd4c] + ld b, a + ld a, $26 + ld [hli], a + inc bc + jr .asm_11931a + +.asm_11937f + ret +; 119380 + +Function119380: ; 119380 + ld a, $80 + ld [wcd49], a + jp Function119e2e +; 119388 + +Function119388: ; 119388 + ld hl, wcd49 + dec [hl] + ret nz + ld hl, wcc60 + call Function118e39 + ld a, $9 + ld [wcd3c], a + ld a, $10 + ld [wcd45], a + call Function119e2e + +Function1193a0: + call Function119ed8 + ret c + call DelayFrame + ld a, $8 + ld [wcd3c], a + call Function119ed8 + ld hl, wPartyMonMenuIconAnims + 48 + 2 + ld a, wd000 % $100 + ld [hli], a + ld a, wd000 / $100 + ld [hli], a + ld a, [wcd3b] + ld [hli], a + xor a + ld [hli], a + ld a, wc708 % $100 + ld [hli], a + ld a, wc708 / $100 + ld [hli], a + ld a, $60 + ld [hli], a + ld a, $cc + ld [hli], a + call Function119eb4 + call Function119ec2 + ld a, $40 + ld [wcd89], a + ld hl, wPartyMonMenuIconAnims + 48 + 2 + ld de, $de00 + ld bc, $0200 + ld a, $2c + jp Function119e2b +; 1193e3 + +Function1193e3: ; 1193e3 + ld hl, wcd49 + dec [hl] + ret nz + ld hl, wcc60 + call Function118e39 + ld a, $9 + ld [wcd3c], a + ld a, $11 + ld [wcd45], a + call Function119e2e + +Function1193fb: + call Function119ed8 + ret c + call DelayFrame + ld a, $8 + ld [wcd3c], a + call Function119ed8 + ld de, Unkn1Pals + ld bc, $1000 + jp Function118b10 +; 119413 + +Function119413: ; 119413 + ld a, $6 + call GetSRAMBank + ld a, [Unkn1Pals] + ld c, a + ld a, [wd001] + ld b, a +rept 2 + dec bc +endr + ld hl, wd002 + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + call Function119192 + ret c + ld a, [wcd89] + and $1 + jr z, .asm_119447 + ld a, $6 + ld [rSVBK], a + ld a, [wd000] + ld c, a + ld a, [wd001] + ld b, a + ld hl, wd002 + call Function119192 + ret c + +.asm_119447 + ld a, $3 + ld [rSVBK], a + call CloseSRAM + jp Function119e2e +; 119451 + +Function119451: ; 119451 (46:5451) + ld a, [wcd89] + and $1 + jr z, .asm_11945d + ld a, $d3 + jp Function118805 +.asm_11945d + xor a + ld [wcd50], a + call Function119694 + ld a, b + ld [wcd49], a + call Function1196cd + ld a, [DefaultFlypoint] + ld hl, wd003 + +Function119471: ; 119471 (46:5471) + push af + ld a, [hli] + ld [$c608], a + ld a, [hli] + ld [$c608 + 3], a + ld a, [hli] + ld [$c608 + 1], a + ld a, [hli] + ld [$c608 + 2], a + ld a, [hli] + ld [$c608 + 4], a + ld a, [hli] + ld [$c608 + 5], a ; $c608 + 5 + push hl + ld a, [$c608] + cp $ff + jr z, .asm_1194a7 + ld a, [$c608 + 2] + cp $ff + jr z, .asm_1194a7 + ld a, [$c608 + 1] + cp $ff + jr nz, .asm_1194a7 + call Function119584 + jr c, .asm_11950c + jr .asm_1194f0 +.asm_1194a7 + ld hl, $c608 + ld de, $c608 + 3 + ld c, $3 +.asm_1194af + ld a, [de] + inc de + cp [hl] + inc hl + jr c, .asm_1194f3 + jr z, .asm_1194b9 + jr nc, .asm_1194bc +.asm_1194b9 + dec c + jr nz, .asm_1194af +.asm_1194bc + ld c, $3 + ld hl, wcd49 + ld de, $c608 +.asm_1194c4 + ld a, [de] + inc de + cp $ff + jr z, .asm_1194d1 + cp [hl] + jr z, .asm_1194d1 + jr c, .asm_1194d5 + jr nc, .asm_1194f0 +.asm_1194d1 + inc hl + dec c + jr nz, .asm_1194c4 +.asm_1194d5 + ld c, $3 + ld hl, wcd49 + ld de, $c608 + 3 +.asm_1194dd + ld a, [de] + inc de + cp $ff + jr z, .asm_1194ea + cp [hl] + jr c, .asm_1194f0 + jr z, .asm_1194ea + jr nc, .asm_11950c +.asm_1194ea + inc hl + dec c + jr nz, .asm_1194dd + jr .asm_11950c +.asm_1194f0 + pop hl + jr .asm_119557 +.asm_1194f3 + ld c, $3 + ld hl, wcd49 + ld de, $c608 +.asm_1194fb + ld a, [de] + inc de + cp $ff + jr z, .asm_119508 + cp [hl] + jr c, .asm_11950c + jr z, .asm_119508 + jr nc, .asm_1194d5 +.asm_119508 + inc hl + dec c + jr nz, .asm_1194fb +.asm_11950c + pop hl + ld a, $1 + ld [wcd50], a + ld a, l + ld [$c608], a + ld a, h + ld [$c608 + 1], a + ld de, wcd69 + ld c, $10 + ld b, $0 +.asm_119521 + ld a, [de] + inc de + cp [hl] + inc hl + jr nz, .asm_119528 + inc b +.asm_119528 + dec c + jr nz, .asm_119521 + ld a, $10 + cp b + jr z, .asm_119536 +rept 4 + inc hl +endr + jr .asm_11957a +.asm_119536 + ld a, [hli] + cp $50 + jr nz, .asm_119552 + ld a, [hli] + cp $33 + jr nz, .asm_119553 + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a + ld a, [wcd83] + cp c + jr nz, .asm_119576 + ld a, [wcd84] + cp b + jr nz, .asm_119576 + jr .asm_11955b +.asm_119552 + inc hl +.asm_119553 +rept 2 + inc hl +endr + jr .asm_11955b +.asm_119557 + ld de, $14 + add hl, de +.asm_11955b + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + add hl, de + pop af + dec a + jp nz, Function119471 + ld a, [wcd50] + and a + jr z, .asm_119571 + ld a, $1a + ld [wcf66], a + ret +.asm_119571 + ld a, $d8 + jp Function118805 +.asm_119576 + ld a, $10 + jr .asm_11957c +.asm_11957a + ld a, $f +.asm_11957c + ld [wcf66], a + pop af + call Function1195c4 + ret + +Function119584: ; 119584 (46:5584) + ld a, [$c608] + ld b, a + ld a, [$c608 + 3] + ld c, a + cp b + jr c, .asm_11959c + ld a, [wcd49] + cp b + jr c, .asm_1195c2 +.asm_119595 + cp c + jr c, .asm_1195a2 + jr z, .asm_1195a2 + jr .asm_1195c2 +.asm_11959c + ld a, [wcd49] + cp b + jr c, .asm_119595 +.asm_1195a2 + ld a, [$c608 + 2] + ld b, a + ld a, [$c608 + 5] ; $c608 + 5 + ld c, a + cp b + jr c, .asm_1195ba + ld a, [wcd4b] + cp b + jr c, .asm_1195c2 +.asm_1195b3 + cp c + jr c, .asm_1195c0 + jr z, .asm_1195c0 + jr .asm_1195c2 +.asm_1195ba + ld a, [wcd4b] + cp b + jr c, .asm_1195b3 +.asm_1195c0 + scf + ret +.asm_1195c2 + and a + ret + +Function1195c4: ; 1195c4 (46:55c4) + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a + ld de, $a5 + ld a, b + cp d + jr c, .asm_1195d9 + jr z, .asm_1195d3 + jr nc, .asm_1195f3 +.asm_1195d3 + ld a, c + cp e + jr z, .asm_1195d9 + jr nc, .asm_1195f3 +.asm_1195d9 + ld de, wcc60 + call CopyBytes + xor a + ld [de], a + ld a, [$c608] + ld l, a + ld a, [$c608 + 1] + ld h, a + ld de, wcd69 + ld bc, $10 + call CopyBytes + ret +.asm_1195f3 + ld a, $d8 + jp Function118805 + +Function1195f8: ; 1195f8 (46:55f8) + ld a, $11 + ld [wcd3c], a + ld a, $1c + ld [wcd45], a + ld a, $f + ld [wcd46], a + ld a, $14 + ld [wcd47], a + call Function119e2e + jp Function119e2e + +Function119612: ; 119612 (46:5612) + ld a, $14 + ld [wcd3c], a + ld a, $1c + ld [wcd45], a + ld a, $10 + ld [wcd46], a + ld a, $14 + ld [wcd47], a + jp Function119e2e + +Function119629: ; 119629 (46:5629) + call Function119ed8 + ret c + ld a, $60 + ld l, a + ld a, $cc + ld h, a + call Function118e39 + ld a, $9 + ld [wcd3c], a + ld a, $1c + ld [wcd45], a + ld a, $14 + ld [wcd47], a + call Function119e2e + +Function119648: ; 119648 (46:5648) + call Function119ed8 + ret c + call DelayFrame + ld a, $8 + ld [wcd3c], a + call Function119ed8 + call Function118b24 + ld de, Unkn1Pals + ld bc, $1000 + ld a, $2a + jp Function119e2b + +Function119665: ; 119665 (46:5665) + ld a, $1a + ld [wcd3c], a + call Function119e2e + +Function11966d: ; 11966d (46:566d) + call Function119ed8 + ret c + ld a, [wcd47] + ld [wcf66], a + ld a, $a + ld [wc300], a + ret + +Function11967d: ; 11967d (46:567d) + ld a, $18 + ld [wcd3c], a + call Function119e2e + +Function119685: ; 119685 (46:5685) + call Function119ed8 + ret c + ld a, $14 + ld [wcf66], a + ld a, $a + ld [wc300], a + ret + +Function119694: ; 119694 (46:5694) + ld b, 0 + ld hl, Unknown_1196b8 +.asm_119699 + ld de, wc708 + ld a, [de] + inc de + cp [hl] + inc hl + jr nz, .asm_1196af + ld a, [de] + inc de + cp [hl] + inc hl + jr nz, .asm_1196b0 + ld a, [de] + inc de + cp [hl] + inc hl + jr nz, .asm_1196b1 + ret +.asm_1196af + inc hl +.asm_1196b0 + inc hl +.asm_1196b1 + inc b + ld a, b + cp $7 + jr nz, .asm_119699 + ret +; 1196b8 (46:56b8) + +Unknown_1196b8: ; 1196b8 + db "Mon" + db "Tue" + db "Wed" + db "Thu" + db "Fri" + db "Sat" + db "Sun" +; 1196cd + +SECTION "bank46_2", ROMX, BANK[$46] +; A hack to use ascii above. + +Function1196cd: ; 1196cd (46:56cd) + ld de, wc719 + call Function1196de + ld [wcd4a], a + inc de + call Function1196de + ld [wcd4b], a + ret + +Function1196de: ; 1196de (46:56de) + ld a, [de] + inc de + sub $30 + sla a + ld b, a + sla a + sla a + add b + ld c, a + add hl, bc + ld a, [de] + inc de + sub $30 + add c + ret +; 1196f2 (46:56f2) + +Function1196f2: ; 1196f2 + ld hl, DefaultFlypoint +.asm_1196f5 + call Function118b9a + ret nc + ld a, [hli] + cp $d + jr nz, .asm_1196f5 + ld a, [hl] + cp $a + jr nz, .asm_1196f5 + xor a + ld [hld], a + ld [hli], a + ld a, l + ld [wcd5b], a + ld a, h + ld [wcd5c], a + inc hl + ld e, l + ld d, h + ld a, [de] + inc de + cp $d + jr nz, .asm_119722 + ld a, [de] + inc de + cp $a + jr nz, .asm_119722 + ld a, $b + jp Function118805 + +.asm_119722 + call Random + ld c, $0 + ld b, c +.asm_119728 + call Function119798 + ld a, d + cp $ff + jr nz, .asm_119735 + ld a, e + cp $ff + jr z, .asm_11974c + +.asm_119735 + ld a, [hRandomSub] + cp d + jr c, .asm_11974c + jr z, .asm_11973e + jr .asm_119745 + +.asm_11973e + ld a, [hRandomAdd] + cp e + jr c, .asm_11974c + jr z, .asm_11974c + +.asm_119745 + inc bc + ld a, c + or b + jr z, .asm_119770 + jr .asm_119728 + +.asm_11974c + ld a, [wcd5b] + ld l, a + ld a, [wcd5c] + ld h, a +.asm_119754 + ld a, [hld] + cp $58 + jr nz, .asm_119754 + ld d, $0 +.asm_11975b + inc d + ld a, [hld] + cp $58 + jr z, .asm_11975b +rept 2 + inc hl +endr + ld a, d + dec a + jr z, .asm_11978e + dec a + jr z, .asm_119785 + dec a + jr z, .asm_11977e + dec a + jr z, .asm_119775 + +.asm_119770 + ld a, $d3 + jp Function118805 + +.asm_119775 + ld a, b + and $f0 + swap a + call Function1197bf + ld [hli], a + +.asm_11977e + ld a, b + and $f + call Function1197bf + ld [hli], a + +.asm_119785 + ld a, c + and $f0 + swap a + call Function1197bf + ld [hli], a + +.asm_11978e + ld a, c + and $f + call Function1197bf + ld [hli], a + jp Function119e2e +; 119798 + +Function119798: ; 119798 + ld d, $0 + ld e, d + call Function1197b4 + swap a + or d + ld d, a + call Function1197b4 + or d + ld d, a + call Function1197b4 + swap a + or e + ld e, a + call Function1197b4 + or e + ld e, a + ret +; 1197b4 + +Function1197b4: ; 1197b4 + ld a, [hli] + cp $61 + jr nc, .asm_1197bc + sub $30 + ret + +.asm_1197bc + sub $57 + ret +; 1197bf + +Function1197bf: ; 1197bf + cp $a + jr nc, .asm_1197c6 + add $30 + ret + +.asm_1197c6 + add $57 + ret +; 1197c9 + +Function1197c9: ; 1197c9 + ld hl, DefaultFlypoint + call Function118e39 + ld a, $9 + ld [wcd3c], a + ld a, $12 + ld [wcd45], a + call Function119e2e + +Function1197dc: + call Function119ed8 + ret c + call DelayFrame + ld hl, DefaultFlypoint + ld de, wcc60 + ld bc, $0080 + call CopyBytes + dec de + xor a + ld [de], a + call Function118b24 + ld de, Unkn1Pals + ld bc, $1000 + ld a, $2a + jp Function119e2b +; 119800 + +Function119800: ; 119800 + ld a, $fd + ld [$c6d0], a + ld [wc702], a + ld a, [wcd81] + ld [wc74e], a + ld a, [wJumptableIndex] + push af + ld a, [wcf64] + push af + ld a, [wcf65] + push af + ld a, [wcf66] + push af + ld a, $1 + ld [rSVBK], a + call FadeToMenu + callba Function10803d + call Function11a9ce + call RestartMapMusic + ld a, $3 + ld [rSVBK], a + pop af + ld [wcf66], a + pop af + ld [wcf65], a + pop af + ld [wcf64], a + pop af + ld [wJumptableIndex], a + callba Function115dc3 + jp Function119e2e +; 11984e + +Function11984e: ; 11984e + ld a, [wcd80] + and a + jr nz, .asm_1198a0 + ld a, [wcd38] + and a + jr nz, .asm_1198a8 + callba Function170000 + ld a, [wJumptableIndex] + push af + ld a, [wcf64] + push af + ld a, [wcf65] + push af + ld a, [wcf66] + push af + ld a, $1 + ld [rSVBK], a + call FadeToMenu + callba Function108000 + call Function11a9ce + call RestartMapMusic + ld a, $3 + ld [rSVBK], a + pop af + ld [wcf66], a + pop af + ld [wcf65], a + pop af + ld [wcf64], a + pop af + ld [wJumptableIndex], a + callba Function115dc3 + jp Function119e2e + +.asm_1198a0 + ld a, $a + ld [wc300], a + jp Function119e2e + +.asm_1198a8 + callba Function17005a + ld a, [wJumptableIndex] + push af + ld a, [wcf64] + push af + ld a, [wcf65] + push af + ld a, [wcf66] + push af + ld a, $1 + ld [rSVBK], a + call FadeToMenu + callba Function108012 + call Function11a9ce + call RestartMapMusic + ld a, $3 + ld [rSVBK], a + pop af + ld [wcf66], a + pop af + ld [wcf65], a + pop af + ld [wcf64], a + pop af + ld [wJumptableIndex], a + callba Function115dc3 + jp Function119e2e +; 1198ee + +Function1198ee: ; 1198ee + ld hl, UnknownText_0x11aab2 + call Function11a9c0 + call Function119e2e + +Function1198f7: + ld a, [wPartyMonMenuIconAnims + 6] + and a + ret nz + ld hl, $c608 + 2 + call Function119940 + ld hl, $d800 + ld a, $c608 % $100 + ld [hli], a + ld a, $c608 / $100 + ld [hli], a + ld a, $f6 + ld [hli], a + xor a + ld [hli], a + ld a, wc708 % $100 + ld [hli], a + ld a, wc708 / $100 + ld [hli], a + ld a, [wcd51] + ld [hli], a + ld a, [wcd52] + ld [hli], a + call Function119eb4 + call Function119ec2 + ld a, $40 + ld [wcd89], a + ld hl, $d800 + ld de, $de00 + ld bc, $0200 + ld a, $2c + jp Function119e2b +; 119937 + +Function119937: ; 119937 + callba Function1707f4 + jp Function119e2e +; 119940 + +Function119940: ; 119940 + ld de, wc3cd + ld c, $1e +.asm_119945 + ld a, [de] + inc de + ld [hli], a + dec c + jr z, .asm_119953 + and a + jr nz, .asm_119945 + xor a +.asm_11994f + ld [hli], a + dec c + jr nz, .asm_11994f + +.asm_119953 + ret +; 119954 + +Function119954: ; 119954 + ld a, $1c + ld [wcd3c], a + call Function119ed8 + ld hl, $c608 + ld de, wc3cd +.asm_119962 + ld a, [de] + inc de + ld [hli], a + and a + jr nz, .asm_119962 + call Function119ec2 + ld hl, $c608 + ld a, $1e + jp Function119e2b +; 119973 + +Function119973: ; 119973 + ld a, $1 + ld [wcf64], a + xor a + ld [wcf65], a + ld [StringBuffer2 + 10], a + ld de, Unkn1Pals + ld a, $20 + jp Function119e2b +; 119987 + +Function119987: ; 119987 + ld hl, wd001 + ld a, [Unkn1Pals] + or [hl] + jr z, .asm_1199a0 + ld a, [wcf64] + ld l, a + ld a, [wcf65] + ld h, a + ld de, BGPals + ld a, $22 + jp Function119e2b + +.asm_1199a0 + ld a, [StringBuffer2 + 10] + and a + jr z, .asm_1199ae + ld a, $16 + ld [wcf66], a + jp Function119b0d + +.asm_1199ae + ld a, $1b + ld [wcf66], a + ret +; 1199b4 + +Function1199b4: ; 1199b4 + ld a, [wd000 + 130] + and a + jr nz, .asm_1199c7 + ld a, [wd000 + 129] + cp $7 + jr nc, .asm_1199c7 + call Function119e2e + jp Function1199ca + +.asm_1199c7 + jp Function119ac9 +; 1199ca + +Function1199ca: ; 1199ca + ld a, $20 + ld [wcd89], a + ld a, [wcf64] + ld l, a + ld a, [wcf65] + ld h, a + ld de, LYOverrides + ld bc, $0700 + ld a, $28 + jp Function119e2b +; 1199e2 + +Function1199e2: ; 1199e2 + ld c, $c + ld de, Unknown_119e33 + call Function119e4f + jp c, Function119ac9 + ld a, c + cp $1 + jp nz, Function119ac9 + ld hl, $d880 + ld bc, Unknown_119af1 +.asm_1199f9 + ld a, [bc] + and a + jr z, .asm_119a05 + cp [hl] + jp nz, Function119ac9 + inc bc + inc hl + jr .asm_1199f9 + +.asm_119a05 + ld c, $17 + ld de, Unknown_119e40 + call Function119e4f + jp c, .asm_119aa7 + ld a, c + cp $1 + jp nz, .asm_119aa7 + ld a, [wd000 + $880] + cp $31 + jp nz, .asm_119aa7 + ld a, [wd000 + $881] + cp $20 + jp nz, .asm_119aa7 + ld a, [wd000 + $88a] + cp $20 + jp nz, .asm_119aa7 + ld a, [wd000 + $894] + cp $20 + jp nz, .asm_119aa7 + xor a + ld [wd000 + $8a0], a + ld [wd000 + $8a1], a + ld [wd000 + $8a2], a + ld [wd000 + $8a3], a + ld hl, $d8a0 + ld bc, $d889 + call Function119e98 + call Function119e98 + ld hl, $d8a0 + ld a, [wcd2d] + cp [hl] + jr nz, Function119ac9 + inc hl + ld a, [wcd2c] + cp [hl] + jr nz, Function119ac9 + inc hl + ld a, [wcd2b] + cp [hl] + jr nz, Function119ac9 + inc hl + ld a, [wcd2a] + cp [hl] + jr nz, Function119ac9 + xor a + ld [wd000 + $8a0], a + ld [wd000 + $8a1], a + ld [wd000 + $8a2], a + ld [wd000 + $8a3], a + ld hl, $d8a0 + ld bc, $d88e + call Function119e98 + ld bc, $d893 + call Function119e98 + ld hl, $d8a0 + ld a, [wcd2f] + cp [hl] + jr nz, .asm_119aa7 + inc hl + ld a, [wcd2e] + cp [hl] + jr nz, .asm_119aa7 + inc hl + ld a, [wcd31] + cp [hl] + jr nz, .asm_119aa7 + inc hl + ld a, [wcd30] + cp [hl] + jr z, .asm_119aaf + +.asm_119aa7 + ld a, $25 + ld [wcf66], a + jp Function119b45 + +.asm_119aaf + ld a, [StringBuffer2 + 10] + and a + jr nz, .asm_119aa7 + ld a, [wd000 + $895] + sub $30 + ld [StringBuffer2 + 10], a + ld a, [wcf64] + ld [StringBuffer2 + 11], a + ld a, [wcf65] + ld [StringBuffer2 + 12], a + +Function119ac9: + ld a, [Unkn1Pals] + ld l, a + ld a, [wd001] + ld h, a + dec hl + ld a, l + ld [Unkn1Pals], a + ld a, h + ld [wd001], a + ld a, [wcf64] + ld l, a + ld a, [wcf65] + ld h, a + inc hl + ld a, l + ld [wcf64], a + ld a, h + ld [wcf65], a + ld a, $10 + ld [wcf66], a + ret +; 119af1 + +Unknown_119af1: + INCBIN "data/mobile/x-game-code.txt" + INCBIN "data/mobile/x-game-result.txt" +; 119b0d + +Function119b0d: ; 119b0d + ld a, $8 + ld [wcd3c], a + call Function119ed8 + ld a, [StringBuffer2 + 10] + cp $1 + jr z, .asm_119b23 + ld a, $19 + ld [wcf66], a + jr Function119b3b + +.asm_119b23 + ld a, $10 + ld [wcd89], a + ld a, [StringBuffer2 + 11] + ld l, a + ld a, [StringBuffer2 + 12] + ld h, a + ld de, LYOverrides + ld bc, $0700 + ld a, $24 + jp Function119e2b + +Function119b3b: + ld a, [StringBuffer2 + 11] + ld l, a + ld a, [StringBuffer2 + 12] + ld h, a + jr asm_119b4d + +Function119b45: + ld a, [wcf64] + ld l, a + ld a, [wcf65] + ld h, a + +asm_119b4d + ld a, $26 + jp Function119e2b +; 119b52 + +Function119b52: ; 119b52 + ld a, [StringBuffer2 + 10] + cp $1 + jr nz, .asm_119b66 + ld a, $5 + call GetSRAMBank + ld a, $4 + ld [$a800], a + call CloseSRAM + +.asm_119b66 + ld a, $1c + jp Function119e2b +; 119b6b + +Function119b6b: ; 119b6b + ld a, [StringBuffer2 + 10] + cp $1 + jr z, .asm_119b75 + jp Function119e2e + +.asm_119b75 + ld a, [LYOverrides] + ld b, a + ld a, [wd101] + or b + jr z, .asm_119be3 + ld hl, $d800 + ld de, wd102 +.asm_119b85 + ld a, [de] + inc de + cp $d + jr nz, .asm_119b85 + inc de + ld a, [de] + cp $d + jr nz, .asm_119b85 +rept 2 + inc de +endr +.asm_119b93 + ld a, [de] + inc de + cp $d + jr z, .asm_119bfa + call Function119c3e + ret c + ld [hli], a + ld a, [de] + inc de + call Function119c3e + ret c + ld [hli], a + ld a, [de] + inc de + call Function119c3e + ret c + ld [hli], a + ld a, [de] + inc de + call Function119c3e + ret c + ld [hl], a + push de + ld d, [hl] + dec hl + ld c, [hl] + dec hl + ld b, [hl] + dec hl + ld a, [hl] + sla b + sla b + sla b + rla + sla b + rla + ld [hli], a + ld [hl], b + inc hl + rrc c + rrc c + ld [hl], c + dec hl + ld a, $f + and c + or [hl] + ld [hli], a + ld a, [hli] + and $c0 + or [hl] + dec hl + ld [hld], a + dec hl + pop de +rept 3 + inc hl +endr + ld a, h + cp $e0 + jr c, .asm_119b93 + +.asm_119be3 + ld a, $19 + ld [wcf66], a + ld a, $5 + call GetSRAMBank + ld a, $1 + ld [$a800], a + call CloseSRAM + xor a + ld [StringBuffer2 + 10], a + ret + +.asm_119bfa + inc de + ld a, [de] + cp $d + jr nz, .asm_119b93 + ld a, l + cp (wd000 + $800 + $69) % $100 + jr nz, .asm_119be3 + ld a, h + cp (wd000 + $800 + $69) / $100 + jr nz, .asm_119be3 + ld a, $5 + call GetSRAMBank + ld a, [wcf64] + ld [$b090], a + ld a, [wcf65] + ld [$b091], a + ld hl, $d800 + ld de, $b023 + ld bc, $0069 + call CopyBytes + ld a, $3 + ld [$a800], a + call CloseSRAM + ld hl, $d800 + ld de, $c608 + ld bc, $0069 + call CopyBytes + jp Function119e2e +; 119c3e + +Function119c3e: ; 119c3e + cp $2b + jr c, .asm_119c68 + jr z, .asm_119c80 + cp $2f + jr c, .asm_119c68 + jr z, .asm_119c84 + cp $30 + jr c, .asm_119c68 + cp $3a + jr c, .asm_119c88 + cp $3d + jr c, .asm_119c68 + jr z, .asm_119c8c + cp $41 + jr c, .asm_119c68 + cp $5b + jr c, .asm_119c8f + cp $61 + jr c, .asm_119c68 + cp $7b + jr c, .asm_119c93 + +.asm_119c68 + ld a, $19 + ld [wcf66], a + ld a, $5 + call GetSRAMBank + ld a, $1 + ld [$a800], a + call CloseSRAM + xor a + ld [StringBuffer2 + 10], a + scf + ret + +.asm_119c80 + ld a, $3e + and a + ret + +.asm_119c84 + ld a, $3f + and a + ret + +.asm_119c88 + add $4 + and a + ret + +.asm_119c8c + xor a + and a + ret + +.asm_119c8f + sub $41 + and a + ret + +.asm_119c93 + sub $47 + and a + ret +; 119c97 + +Function119c97: ; 119c97 + ld hl, UnknownText_0x11ab0f + call Function11a9c0 + call Function119e2e + jr Function119cab + +Function119ca2: + ld hl, UnknownText_0x11aaf0 + call Function11a9c0 + call Function119e2e + +Function119cab: + ld a, [wPartyMonMenuIconAnims + 6] + and a + ret nz + ld a, $80 + ld [wcd50], a + call Function119e2e + +Function119cb8: + ld hl, wcd50 + dec [hl] + ret nz + ld a, $0 + ld [wcf66], a + ret +; 119cc3 + +Function119cc3: ; 119cc3 + ld a, [wcd38] + and a + jr z, .asm_119cd1 + dec a + jr z, .asm_119cd6 + ld hl, UnknownText_0x11aa6a + jr .asm_119cd9 + +.asm_119cd1 + ld hl, UnknownText_0x11ab4a + jr .asm_119cd9 + +.asm_119cd6 + ld hl, UnknownText_0x11ab6e + +.asm_119cd9 + call Function11a9c0 + call Function119e2e + +Function119cdf: + ld a, [wPartyMonMenuIconAnims + 6] + and a + ret nz + ld a, $f + ld [wcd3c], a + call Function119e2e + +Function119cec: + call Function119ed8 + ret c + ld a, [wcd46] + ld [wcf66], a + ret +; 119cf7 + +MenuDataHeader_119cf7: ; 119cf7 + db $40 ; flags + db 7, 12 ; start coords + db 11, 19 ; end coords + dw NULL + db 0 ; default option +; 119cff + +MenuData_119cff: ; 119cff + db $40 ; flags + db 7, 15 ; start coords + db 11, 19 ; end coords + dw NULL + db 0 ; default option +; 119d07 + +String_119d07: + db " ▼@" + +Strings_L10ToL100: ; 119d0c + db " L:10 @@" + db " L:20 @@" + db " L:30 @@" + db " L:40 @@" + db " L:50 @@" + db " L:60 @@" + db " L:70 @@" + db " L:80 @@" + db " L:90 @@" + db " L:100@@" + db "CANCEL@@" + +Strings_Ll0ToL40: ; 119d64 + db " L:10 @@" + db " L:20 @@" + db " L:30 @@" + db " L:40 @@" + db "CANCEL@@" + +String_119d8c: + db "CANCEL@" +; 119d93 + +Function119d93: ; 119d93 (46:5d93) + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, $1 + ld [rSVBK], a ; $ff00+$70 + ld a, [wcd4f] + ld c, 10 + call SimpleMultiply + ld hl, wcd50 + ld [hl], a + ld bc, PartyMon2 - PartyMon1 + ld de, PartyMon1Level + ld a, [PartyCount] +.asm_119daf + push af + ld a, [de] + push hl + push de + pop hl + add hl, bc + push hl + pop de + pop hl + cp [hl] + jr z, .asm_119dbd + jr nc, .asm_119dc6 +.asm_119dbd + pop af + dec a + jr nz, .asm_119daf + pop af + ld [rSVBK], a ; $ff00+$70 + and a + ret +.asm_119dc6 + pop af + ld a, $4 + ld [wcf66], a + pop af + ld [rSVBK], a ; $ff00+$70 + scf + ret + +Function119dd1: ; 119dd1 (46:5dd1) + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, [wcd4f] + cp 70 / 10 + jr nc, .asm_119e08 + ld a, $1 + ld [rSVBK], a ; $ff00+$70 + ld hl, PartyMon1Level + ld bc, PartyMon2 - PartyMon1 + ld de, PartySpecies + ld a, [PartyCount] +.asm_119deb + push af + ld a, [de] + cp MEWTWO + jr z, .asm_119dfd + cp MEW + jr z, .asm_119dfd + cp LUGIA + jr c, .asm_119e02 + cp NUM_POKEMON + 1 + jr nc, .asm_119e02 +.asm_119dfd + ld a, [hl] + cp 70 + jr c, .asm_119e0d +.asm_119e02 + add hl, bc + inc de + pop af + dec a + jr nz, .asm_119deb +.asm_119e08 + pop af + ld [rSVBK], a ; $ff00+$70 + and a + ret +.asm_119e0d + pop af + ld a, [de] + ld [wd265], a + call GetPokemonName + ld hl, StringBuffer1 + ld de, wcd49 + ld bc, PKMN_NAME_LENGTH + call CopyBytes + ld a, $a + ld [wcf66], a + pop af + ld [rSVBK], a ; $ff00+$70 + scf + ret +; 119e2b (46:5e2b) + +Function119e2b: ; 119e2b (46:5e2b) + call Function3e32 + +Function119e2e: ; 119e2e (46:5e2e) + ld hl, wcf66 + inc [hl] + ret +; 119e33 (46:5e33) + +Unknown_119e33: ; 119e33 + INCBIN "data/mobile/x-game-code-prefix.txt" +Unknown_119e40: + INCBIN "data/mobile/x-game-result-prefix.txt" +; 119e4f + +Function119e4f: ; 119e4f + push bc + ld hl, LYOverrides + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a +.asm_119e57 + ld a, [de] + cp [hl] + jr z, .asm_119e64 +.asm_119e5b + inc hl + dec bc + ld a, b + or c + jr nz, .asm_119e57 +.asm_119e61 + pop bc + scf + ret + +.asm_119e64 + push de +.asm_119e65 + ld a, [de] + inc de + cp "\n" + jr z, .asm_119e7a + cp [hl] + jr nz, .asm_119e77 + inc hl + dec bc + ld a, b + or c + jr nz, .asm_119e65 + pop de + jr .asm_119e61 + +.asm_119e77 + pop de + jr .asm_119e5b + +.asm_119e7a + pop de + pop bc + inc hl + ld de, $d880 +.asm_119e80 + ld a, [hli] + ld [de], a + inc de + cp $d + jr z, .asm_119e8c + dec c + jr nz, .asm_119e80 + scf + ret + +.asm_119e8c + and a + ret +; 119e8e + +Function119e8e: ; 119e8e + cp $60 + jr c, .asm_119e95 + sub $57 + ret + +.asm_119e95 + sub $30 + ret +; 119e98 + +Function119e98: ; 119e98 + ld a, $2 +.asm_119e9a + push af + ld a, [bc] + dec bc + call Function119e8e + or [hl] + ld [hl], a + ld a, [bc] + dec bc + call Function119e8e + rlca + rlca + rlca + rlca + or [hl] + ld [hl], a + inc hl + pop af + dec a + and a + jr nz, .asm_119e9a + ret +; 119eb4 + +Function119eb4: ; 119eb4 (46:5eb4) + xor a + ld [wc3cc], a + ld de, wc3ac +.asm_119ebb + ld a, [de] + inc de + ld [hli], a + and a + jr nz, .asm_119ebb + ret + +Function119ec2: ; 119ec2 (46:5ec2) + ld a, $5 + call GetSRAMBank + xor a + ld [$aa5c], a + ld de, $aa4c +.asm_119ece + ld a, [de] + inc de + ld [hli], a + and a + jr nz, .asm_119ece + call CloseSRAM + ret + +Function119ed8: ; 119ed8 (46:5ed8) + ld a, [rSVBK] ; $ff00+$70 + ld [wcd8c], a + ld a, $1 + ld [rSVBK], a ; $ff00+$70 + call Function119eee + ld a, [wcd8c] + ld [rSVBK], a ; $ff00+$70 + ld a, $1 + ld [hBGMapMode], a ; $ff00+$d4 + ret + +Function119eee: ; 119eee (46:5eee) + ld a, [wcd3c] + ld e, a + ld d, 0 + ld hl, Jumptable_119efd +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 119efd (46:5efd) + +Jumptable_119efd: ; 119efd + dw Function119f3f + dw Function119f45 + dw Function119f56 + dw Function119f76 + dw Function119f98 + dw Function11a113 + dw Function11a129 + dw Function11a131 + dw Function11a13d + dw Function11a14b + dw Function11a16d + dw Function11a192 + dw Function11a2e6 + dw Function11a302 + dw Function11a33a + dw Function11a207 + dw Function11a235 + dw Function11a357 + dw Function11a36b + dw Function11a38d + dw Function11a3c5 + dw Function11a3d9 + dw Function11a3f9 + dw Function11a41b + dw Function11a452 + dw Function11a47a + dw Function11a488 + dw Function11a49e + dw Function11a4db + dw Function11a4e8 + dw Function11a4fe + dw Function11a466 + dw Function11a47a +; 119f3f + +Function119f3f: ; 119f3f + call Function11a5b9 + jp Function11a5b0 +; 119f45 + +Function119f45: ; 119f45 + hlcoord 4, 2 + ld de, String_11a661 + call PlaceString + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 119f56 + +Function119f56: ; 119f56 + ld a, [wcd44] + and a + jr z, .asm_119f62 + dec a + ld [wcd44], a + scf + ret + +.asm_119f62 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a6aa + call PlaceString + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 119f76 + +Function119f76: ; 119f76 + ld a, [wcd44] + and a + jr z, .asm_119f82 + dec a + ld [wcd44], a + scf + ret + +.asm_119f82 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a679 + call PlaceString + call Function11a5f5 + xor a + ld [wcd44], a + jp Function11a5b0 +; 119f98 + +Function119f98: ; 119f98 + call Function11a536 + ret c + call PlayClickSFX + ld a, [wcd44] + and a + jr nz, .asm_119fef + call ExitMenu + call Function11a63c + xor a + ld [ScriptVar], a + call Function11a00e + ld a, [ScriptVar] + and a + jr z, .asm_119fd4 + call ExitMenu + callba Function104061 + callba Function115dc3 + ld a, [wcd33] + ld [wcf66], a + ld a, $a + ld [wc300], a + scf + ret + +.asm_119fd4 + hlcoord 4, 2 + ld de, String_11a692 + call PlaceString + ld a, $1 + ld [wc30d], a + ld a, $1 + ld [wPartyMonMenuIconAnims], a + callba Function104061 + and a + ret + +.asm_119fef + call ExitMenu + call ExitMenu + callba Function104061 + ld a, [wcd45] + ld [wcf66], a + callba Function115dc3 + ld a, $a + ld [wc300], a + scf + ret +; 11a00e + +Function11a00e: ; 11a00e + ld a, $5 + call GetSRAMBank + ld a, [$aa4b] + and a + jr z, .asm_11a02a + ld a, [$aa4c] + call CloseSRAM + and a + ret nz + ld a, $5 + call GetSRAMBank + xor a + ld [$aa4b], a + +.asm_11a02a + call CloseSRAM + ld a, [BGMapPalBuffer] + and a + jr z, .asm_11a039 + dec a + jr z, .asm_11a081 + jp Function11a0ca + +.asm_11a039 + ld a, $3 + ld [rSVBK], a + ld hl, $c608 + ld de, $d800 + ld bc, $00f6 + call CopyBytes + ld a, $1 + ld [rSVBK], a + call FadeToMenu + callba Function11765d + call Function11a9ce + ld a, $3 + ld [rSVBK], a + ld hl, $d800 + ld de, $c608 + ld bc, $00f6 + call CopyBytes + ld a, $1 + ld [rSVBK], a + callba Function115d99 + ld c, $0 + callba Function115e18 + ld a, $1 + ld [wc305], a + ret + +.asm_11a081 + xor a + ld [wMenuBorderLeftCoord], a + ld [wMenuBorderTopCoord], a + ld a, $13 + ld [wMenuBorderRightCoord], a + ld a, $5 + ld [wMenuBorderBottomCoord], a + call BackUpTiles + callba Function11765d + callba Function117ab4 + callba Function106462 + callba Function106464 + call ExitMenu + callba Function104061 + callba Function115d99 + ld c, $0 + callba Function115e18 + ld a, $1 + ld [wc305], a + ret +; 11a0ca + +Function11a0ca: ; 11a0ca + xor a + ld [wMenuBorderLeftCoord], a + ld [wMenuBorderTopCoord], a + ld a, $13 + ld [wMenuBorderRightCoord], a + ld a, $11 + ld [wMenuBorderBottomCoord], a + call BackUpTiles + callba Function11765d + callba Function17d3f6 + callba Function106462 + callba Function106464 + call ExitMenu + callba Function104061 + callba Function115d99 + ld c, $0 + callba Function115e18 + ld a, $1 + ld [wc305], a + ret +; 11a113 + +Function11a113: ; 11a113 + call Function11a63c + ld c, $1 + callba Function115e18 + hlcoord 4, 2 + ld de, String_11a6c8 + call PlaceString + and a + ret +; 11a129 + +Function11a129: ; 11a129 + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 11a131 + +Function11a131: ; 11a131 + ld hl, wcd44 + dec [hl] + ret nz + ld a, [wcd3c] + inc a + ld [wcd3c], a + +Function11a13d: + call Function11a63c + hlcoord 4, 2 + ld de, String_11a6d2 + call PlaceString + and a + ret +; 11a14b + +Function11a14b: ; 11a14b + ld hl, wcd85 + ld a, [hl] + cp $f3 + jr nz, .asm_11a155 + and a + ret + +.asm_11a155 + call Function11a1d6 + ret c + call Function11a63c + hlcoord 4, 2 + ld de, String_11a6f1 + call PlaceString + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 11a16d + +Function11a16d: ; 11a16d + ld a, [wcd44] + and a + jr z, .asm_11a179 + dec a + ld [wcd44], a + scf + ret + +.asm_11a179 + call Function11a63c + call Function11a1e6 + hlcoord 4, 2 + ld de, wPartyMonMenuIconAnims + 48 + 2 + call PlaceString + call Function11a5f5 + xor a + ld [wcd44], a + jp Function11a5b0 +; 11a192 + +Function11a192: ; 11a192 + call Function11a536 + ret c + call PlayClickSFX + ld a, [wcd44] + and a + jr nz, .asm_11a1b6 + call ExitMenu + callba Function104061 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a6d2 + call PlaceString + and a + ret + +.asm_11a1b6 + call ExitMenu + callba Function104061 + ld a, [wcd45] + ld [wcf66], a + ld [wcd80], a + call Function11a63c + hlcoord 4, 2 + ld de, String_11a6d2 + call PlaceString + scf + ret +; 11a1d6 + +Function11a1d6: ; 11a1d6 + ld a, [wcd85] + cp $50 + jr nz, .asm_11a1e4 + ld a, $d3 + call Function118805 + scf + ret + +.asm_11a1e4 + and a + ret +; 11a1e6 + +Function11a1e6: ; 11a1e6 + ld hl, String_11a706 + ld de, wPartyMonMenuIconAnims + 48 + 2 + call Function11a1ff + ld hl, wcd85 + call Function11a1ff + ld hl, String_11a70b + call Function11a1ff + ld a, $50 + ld [de], a + ret +; 11a1ff + +Function11a1ff: ; 11a1ff +.asm_11a1ff + ld a, [hli] + cp $50 + ret z + ld [de], a + inc de + jr .asm_11a1ff +; 11a207 + +Function11a207: ; 11a207 + ld hl, MenuDataHeader_11a2de + call LoadMenuDataHeader + call Function1cbb + call GetMemTileCoord + call Function321c + hlcoord 16, 8 + ld de, String_11a2cf + call PlaceString + hlcoord 16, 10 + ld de, String_11a2d3 + call PlaceString + hlcoord 15, 8 + ld a, $ed + ld [hl], a + xor a + ld [wcd44], a + jp Function11a5b0 +; 11a235 + +Function11a235: ; 11a235 + ld hl, hJoyPressed + ld a, [hl] + and A_BUTTON + jr nz, .asm_11a28f + ld a, [hl] + and B_BUTTON + jr nz, .asm_11a2c1 + ld a, [hl] + and D_UP + jr nz, .asm_11a251 + ld a, [hl] + and D_DOWN + jr nz, .asm_11a270 +.asm_11a24c + call Function11a9f0 + scf + ret + +.asm_11a251 + xor a + ld [wcd8a], a + ld [wcd8b], a + ld a, [wcd44] + and a + jr z, .asm_11a24c + xor a + ld [wcd44], a + hlcoord 15, 8 + ld a, $ed + ld [hl], a + hlcoord 15, 10 + ld a, $7f + ld [hl], a + jr .asm_11a24c + +.asm_11a270 + xor a + ld [wcd8a], a + ld [wcd8b], a + ld a, [wcd44] + and a + jr nz, .asm_11a24c + inc a + ld [wcd44], a + hlcoord 15, 8 + ld a, $7f + ld [hl], a + hlcoord 15, 10 + ld a, $ed + ld [hl], a + jr .asm_11a24c + +.asm_11a28f + xor a + ld [wcd8a], a + ld [wcd8b], a + call PlayClickSFX + ld a, [wcd44] + and a + jr nz, .asm_11a2c4 + call ExitMenu + callba Function104061 + ld a, [wcd46] + cp $0 + jr z, .asm_11a2b4 + ld a, [wcd47] + jr .asm_11a2b7 + +.asm_11a2b4 + ld a, [wcd33] + +.asm_11a2b7 + ld [wcf66], a + ld a, $a + ld [wc300], a + scf + ret + +.asm_11a2c1 + call PlayClickSFX + +.asm_11a2c4 + call ExitMenu + callba Function104061 + and a + ret +; 11a2cf + +String_11a2cf: ; 11a2cf + db "YES@" +; 11a2d3 + +String_11a2d3: ; 11a2d3 + db "NO@" +; 11a2d6 + +MenuDataHeader_11a2d6: ; 11a2d6 + db $40 ; flags + db 6, 14 ; start coords + db 10, 19 ; end coords + dw NULL + db 0 ; default option +; 11a2de + +MenuDataHeader_11a2de: ; 11a2de + db $40 ; flags + db 7, 14 ; start coords + db 11, 19 ; end coords + dw NULL + db 0 ; default option +; 11a2e6 + +Function11a2e6: ; 11a2e6 + call Function11a63c + ld c, $2 + callba Function115e18 + hlcoord 4, 2 + ld de, String_11a71e + call PlaceString + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 11a302 + +Function11a302: ; 11a302 + ld a, [wcd44] + and a + jr z, .asm_11a30e + dec a + ld [wcd44], a + scf + ret + +.asm_11a30e + call Function11a63c + hlcoord 4, 2 + ld de, String_11a72a + call PlaceString + hlcoord 9, 4 + ld de, wcd68 + lb bc, PRINTNUM_LEADINGZEROS | 1, 2 + call PrintNum + hlcoord 14, 4 + ld de, wcd67 + lb bc, PRINTNUM_LEADINGZEROS | 1, 2 + call PrintNum + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 11a33a + +Function11a33a: ; 11a33a + ld a, [wcd44] + and a + jr z, .asm_11a346 + dec a + ld [wcd44], a + scf + ret + +.asm_11a346 + call ExitMenu + callba Function104061 + callba Function115dc3 + and a + ret +; 11a357 + +Function11a357: ; 11a357 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a743 + call PlaceString + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 11a36b + +Function11a36b: ; 11a36b + ld a, [wcd44] + and a + jr z, .asm_11a377 + dec a + ld [wcd44], a + scf + ret + +.asm_11a377 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a755 + call PlaceString + call Function11a5f5 + xor a + ld [wcd44], a + jp Function11a5b0 +; 11a38d + +Function11a38d: ; 11a38d + call Function11a536 + ret c + call PlayClickSFX + ld a, [wcd44] + and a + jr nz, .asm_11a3b1 + call ExitMenu + callba Function104061 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a6d2 + call PlaceString + and a + ret + +.asm_11a3b1 + call ExitMenu + callba Function104061 + ld a, [wcd45] + ld [wcf66], a + ld [wcd80], a + scf + ret +; 11a3c5 + +Function11a3c5: ; 11a3c5 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a762 + call PlaceString + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 11a3d9 + +Function11a3d9: ; 11a3d9 + ld a, [wcd44] + and a + jr z, .asm_11a3e5 + dec a + ld [wcd44], a + scf + ret + +.asm_11a3e5 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a779 + call PlaceString + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 11a3f9 + +Function11a3f9: ; 11a3f9 + ld a, [wcd44] + and a + jr z, .asm_11a405 + dec a + ld [wcd44], a + scf + ret + +.asm_11a405 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a755 + call PlaceString + call Function11a5f5 + xor a + ld [wcd44], a + jp Function11a5b0 +; 11a41b + +Function11a41b: ; 11a41b + call Function11a536 + ret c + call PlayClickSFX + ld a, [wcd44] + and a + jr nz, .asm_11a43f + call ExitMenu + callba Function104061 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a6d2 + call PlaceString + and a + ret + +.asm_11a43f + call ExitMenu + callba Function104061 + ld a, $1c + ld [wcf66], a + ld [wcd80], a + scf + ret +; 11a452 + +Function11a452: ; 11a452 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a791 + call PlaceString + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 11a466 + +Function11a466: ; 11a466 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a7c1 + call PlaceString + ld a, $80 + ld [wcd44], a + jp Function11a5b0 +; 11a47a + +Function11a47a: ; 11a47a + ld a, [wcd44] + and a + jr z, .asm_11a486 + dec a + ld [wcd44], a + scf + ret + +.asm_11a486 + and a + ret +; 11a488 + +Function11a488: ; 11a488 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a7ac + call PlaceString + call Function11a5f5 + xor a + ld [wcd44], a + jp Function11a5b0 +; 11a49e + +Function11a49e: ; 11a49e + call Function11a536 + ret c + call PlayClickSFX + ld a, [wcd44] + and a + jr nz, .asm_11a4c7 + call ExitMenu + callba Function104061 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a6d2 + call PlaceString + ld a, $14 + ld [wcf66], a + and a + ret + +.asm_11a4c7 + call ExitMenu + callba Function104061 + ld a, [wcd46] + ld [wcf66], a + ld [wcd80], a + scf + ret +; 11a4db + +Function11a4db: ; 11a4db + call Function11a63c + ld de, String_11a6db + hlcoord 4, 2 + call PlaceString + ret +; 11a4e8 + +Function11a4e8: ; 11a4e8 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a7d7 + call PlaceString + call Function11a5f5 + xor a + ld [wcd44], a + jp Function11a5b0 +; 11a4fe + +Function11a4fe: ; 11a4fe + call Function11a536 + ret c + call PlayClickSFX + ld a, [wcd44] + and a + jr nz, .asm_11a522 + call ExitMenu + callba Function104061 + call Function11a63c + hlcoord 4, 2 + ld de, String_11a6d2 + call PlaceString + and a + ret + +.asm_11a522 + call ExitMenu + callba Function104061 + ld a, [wcd45] + ld [wcf66], a + ld [wcd80], a + scf + ret +; 11a536 + +Function11a536: ; 11a536 + ld hl, hJoyPressed + ld a, [hl] + and $1 + jr nz, .asm_11a5a7 + ld a, [hl] + and $2 + jr nz, .asm_11a5a2 + ld a, [hl] + and $40 + jr nz, .asm_11a564 + ld a, [hl] + and $80 + jr nz, .asm_11a583 +.asm_11a54d + ld a, [wcd3c] + cp $4 + jr z, .asm_11a562 + call Function11a9f0 + jr nz, .asm_11a562 + call ExitMenu + callba Function104061 + +.asm_11a562 + scf + ret + +.asm_11a564 + xor a + ld [wcd8a], a + ld [wcd8b], a + ld a, [wcd44] + and a + jr z, .asm_11a54d + xor a + ld [wcd44], a + hlcoord 15, 7 + ld a, $ed + ld [hl], a + hlcoord 15, 9 + ld a, $7f + ld [hl], a + jr .asm_11a54d + +.asm_11a583 + xor a + ld [wcd8a], a + ld [wcd8b], a + ld a, [wcd44] + and a + jr nz, .asm_11a54d + inc a + ld [wcd44], a + hlcoord 15, 7 + ld a, $7f + ld [hl], a + hlcoord 15, 9 + ld a, $ed + ld [hl], a + jr .asm_11a54d + +.asm_11a5a2 + ld a, $1 + ld [wcd44], a + +.asm_11a5a7 + xor a + ld [wcd8a], a + ld [wcd8b], a + and a + ret +; 11a5b0 + +Function11a5b0: ; 11a5b0 + ld a, [wcd3c] + inc a + ld [wcd3c], a + scf + ret +; 11a5b9 + +Function11a5b9: ; 11a5b9 + xor a + ld [wMenuBorderLeftCoord], a + ld [wMenuBorderTopCoord], a + ld a, $13 + ld [wMenuBorderRightCoord], a + ld a, $5 + ld [wMenuBorderBottomCoord], a + call BackUpTiles + hlcoord 0, 0, AttrMap + ld b, $6 + ld c, $14 + hlcoord 0, 0 + ld b, $4 + ld c, $12 + call Function3eea + callba Function104061 + call UpdateSprites + ld c, $0 + callba Function115e18 + ld a, $1 + ld [wc305], a + ret +; 11a5f5 + +Function11a5f5: ; 11a5f5 + ld a, $e + ld [wMenuBorderLeftCoord], a + ld a, $13 + ld [wMenuBorderRightCoord], a + ld a, $6 + ld [wMenuBorderTopCoord], a + ld a, $a + ld [wMenuBorderBottomCoord], a + call BackUpTiles + hlcoord 14, 6, AttrMap + ld b, $5 + ld c, $6 + hlcoord 14, 6 + ld b, $3 + ld c, $4 + call Function3eea + hlcoord 16, 7 + ld de, String_11a2cf + call PlaceString + hlcoord 16, 9 + ld de, String_11a2d3 + call PlaceString + hlcoord 15, 7 + ld a, $ed + ld [hl], a + callba Function104061 + ret +; 11a63c + +Function11a63c: ; 11a63c + hlcoord 4, 1 + ld de, String_11a7f4 + call PlaceString + hlcoord 4, 2 + ld de, String_11a7f4 + call PlaceString + hlcoord 4, 3 + ld de, String_11a7f4 + call PlaceString + hlcoord 4, 4 + ld de, String_11a7f4 + call PlaceString + ret +; 11a661 + +String_11a661: ; 11a661 + db "これから モバイルセンターに" + next "でんわ", $1f, "かけます@" +; 11a679 + +String_11a679: ; 11a679 + db "モバイルアダプタ", $25, "じゅんびは" + next "できて いますか?@" +; 11a692 + +String_11a692: ; 11a692 + db "でんわ", $1f, "かけています" + next "しばらく おまちください@" +; 11a6aa + +String_11a6aa: ; 11a6aa + db "でんわをかけると つうわりょう" + next "せつぞくりょう", $4a, "かかります@" +; 11a6c8 + +String_11a6c8: ; 11a6c8 + db "せつぞく しました@" +; 11a6d2 + +String_11a6d2: ; 11a6d2 + db "つうしん ちゅう@" +; 11a6db + +String_11a6db: ; 11a6db + db "つうしん ちゅう" + next "セレクト エーでちゅうし@" +; 11a6f1 + +String_11a6f1: ; 11a6f1 + db "この サービスには" + next "つうわりょう", $25, "ほかに@" +; 11a706 + +String_11a706: ; 11a706 + db "おかね", $4a, "@" +; 11a70b + +String_11a70b: ; 11a70b + db "えん" + next "かかります よろしい ですか?@" +; 11a71e + +String_11a71e: ; 11a71e + db "つうしん しゅうりょう@" +; 11a72a + +String_11a72a: ; 11a72a + db "つないだ じかん" + next " やく ふん びょう@" +; 11a743 + +String_11a743: ; 11a743 + db "もっていない データが" + next "あります!@" +; 11a755 + +String_11a755: ; 11a755 + db "データ", $1f, "よみこみますか?@" +; 11a762 + +String_11a762: ; 11a762 + db "おなじ データ", $1f, "よみこんだ" + next "こと", $4a, "ありますが@" +; 11a779 + +String_11a779: ; 11a779 + db "そのデータ", $24, "なくなっているか" + next "こわれて います@" +; 11a791 + +String_11a791: ; 11a791 + db "もっている データと" + next "おなじデータしか ありません!@" +; 11a7ac + +String_11a7ac: ; 11a7ac + db "データ", $25, "よみこみを" + next "ちゅうし しますか?@" +; 11a7c1 + +String_11a7c1: ; 11a7c1 + db "あたらしい ニュースは" + next "ありません でした@" +; 11a7d7 + +String_11a7d7: ; 11a7d7 + db "あたらしいニュース", $4a, "あります" + next "ニュース", $1f, "よみこみますか?@" +; 11a7f4 + +String_11a7f4: ; 11a7f4 + db " @" +; 11a804 + +MenuDataHeader_11a804: ; 11a804 + db $40 ; flags + db 0, 0 ; start coords + db 5, 19 ; end coords + dw NULL + db 0 ; default option +; 11a80c + +Function11a80c: ; 11a80c + ld de, hDivisor + ld bc, hDividend + ld hl, Unknown_11a89a + call Function11a88c + ld bc, hQuotient + ld hl, Unknown_11a8ba + call Function11a88c + ld bc, $ffb5 + ld hl, Unknown_11a8da + call Function11a88c + xor a + ld b, a + ld a, [hDivisor] + and $f + ld e, a + ld a, [$ffb9] + and $f + call Function11a884 + ld e, a + ld a, [$ffbb] + and $f + call Function11a884 + ld [wcd62], a + ld e, b + xor a + ld b, a + ld a, [hDivisor] + and $f0 + swap a + call Function11a884 + ld e, a + ld a, [$ffb9] + and $f0 + swap a + call Function11a884 + ld e, a + ld a, [$ffbb] + and $f0 + swap a + call Function11a884 + ld [wcd63], a + ld e, b + xor a + ld b, a + ld a, [hMathBuffer] + and $f + call Function11a884 + ld e, a + ld a, [$ffba] + and $f + call Function11a884 + ld e, a + ld a, [$ffbc] + and $f + call Function11a884 + ld [wcd64], a + ret +; 11a884 + +Function11a884: ; 11a884 + add e + cp $a + ret c + sub $a + inc b + ret +; 11a88c + +Function11a88c: ; 11a88c + ld a, [bc] + sla a + ld c, a + xor a + ld b, a + add hl, bc + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a + inc de + ret +; 11a89a + +Unknown_11a89a: ; 11a89a +x = 0 +rept 16 + bcd x % 100, x / 100 +x = x + 1 +endr + +Unknown_11a8ba: ; 11a8ba +x = 0 +rept 16 + bcd x % 100, x / 100 +x = x + 16 +endr + +Unknown_11a8da: ; 11a8da +x = 0 +rept 16 + bcd x % 100, x / 100 +x = x + 256 +endr +; 11a8fa + +Function11a8fa: ; 11a8fa + ld a, [wPartyMonMenuIconAnims + 6] + ld e, a + ld d, 0 + ld hl, Jumptable_11a909 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 11a909 + +Jumptable_11a909: ; 11a909 + dw Function11a970 + dw Function11a90f + dw Function11a971 +; 11a90f + +Function11a90f: ; 11a90f + ld a, $1 + ld [rSVBK], a + call SpeechTextBox + ld a, $50 + ld hl, wPartyMonMenuIconAnims + 12 + ld bc, $008c + call ByteFill + ld a, [wPartyMonMenuIconAnims + 7] + ld l, a + ld a, [wPartyMonMenuIconAnims + 8] + ld h, a + ld de, wPartyMonMenuIconAnims + 12 +.asm_11a92c + ld a, [hli] + cp $57 + jr z, .asm_11a94f + cp $0 + jr z, .asm_11a92c + cp $50 + jr z, .asm_11a92c + cp $1 + jr z, .asm_11a941 + ld [de], a + inc de + jr .asm_11a92c + +.asm_11a941 + ld a, [hli] + ld c, a + ld a, [hli] + ld b, a +.asm_11a945 + ld a, [bc] + inc bc + cp $50 + jr z, .asm_11a92c + ld [de], a + inc de + jr .asm_11a945 + +.asm_11a94f + xor a + ld [wPartyMonMenuIconAnims + 11], a + ld a, $20 + ld [wPartyMonMenuIconAnims + 7], a + ld a, $c3 + ld [wPartyMonMenuIconAnims + 8], a + hlcoord 1, 14 + ld a, l + ld [wPartyMonMenuIconAnims + 9], a + ld a, h + ld [wPartyMonMenuIconAnims + 10], a + ld hl, wPartyMonMenuIconAnims + 6 + inc [hl] + ld a, $3 + ld [rSVBK], a + +Function11a970: + ret +; 11a971 + +Function11a971: ; 11a971 + ld hl, wPartyMonMenuIconAnims + 11 + ld a, [hJoyDown] + and a + jr nz, .asm_11a97f + ld a, [hl] + and a + jr z, .asm_11a97f + dec [hl] + ret + +.asm_11a97f + ld a, [Options] + and $7 + ld [hl], a + ld hl, wcd8d + ld a, [wPartyMonMenuIconAnims + 7] + ld e, a + ld a, [wPartyMonMenuIconAnims + 8] + ld d, a + ld a, [de] + inc de + ld [hli], a + ld a, e + ld [wPartyMonMenuIconAnims + 7], a + ld a, d + ld [wPartyMonMenuIconAnims + 8], a + ld a, $50 + ld [hl], a + ld a, [wPartyMonMenuIconAnims + 9] + ld l, a + ld a, [wPartyMonMenuIconAnims + 10] + ld h, a + ld de, wcd8d + call PlaceString + ld a, c + ld [wPartyMonMenuIconAnims + 9], a + ld a, b + ld [wPartyMonMenuIconAnims + 10], a + ld a, [wcd8d] + cp $50 + jr nz, .asm_11a9bf + xor a + ld [wPartyMonMenuIconAnims + 6], a + +.asm_11a9bf + ret +; 11a9c0 + +Function11a9c0: ; 11a9c0 + ld a, l + ld [wPartyMonMenuIconAnims + 7], a + ld a, h + ld [wPartyMonMenuIconAnims + 8], a + ld a, $1 + ld [wPartyMonMenuIconAnims + 6], a + ret +; 11a9ce + +Function11a9ce: ; 11a9ce + call WhiteBGMap + call Function2bae + call Call_ExitMenu + callba Function106462 + callba Function106464 + call Functiond90 + callba Function2b5c + call UpdateSprites + ret +; 11a9f0 + +Function11a9f0: ; 11a9f0 + ld a, $1 + and a + ret +; 11a9f4 + +Function11a9f4: ; 11a9f4 + ld a, [wcd8a] + ld l, a + ld a, [wcd8b] + ld h, a + inc hl + ld a, l + ld [wcd8a], a + ld a, h + ld [wcd8b], a + ld de, $d5d0 + add hl, de + bit 7, h + ret nz + ld a, $d6 + call Function118805 + and a + ret +; 11aa13 + +UnknownText_0x11aa13: ; 0x11aa13 + text "SAVE FILE will be" + line "sent." + done +; 0x11aa2c + +UnknownText_0x11aa2c: ; 0x11aa2c + text "Sent SAVE FILE." + line "Reading NEWS…" + done +; 0x11aa4b + +UnknownText_0x11aa4b: ; 0x11aa4b + text "Reading NEWS…" + done +; 0x11aa5a + +UnknownText_0x11aa5a: ; 0x11aa5a + text "Received NEWS!" + done +; 0x11aa6a + +UnknownText_0x11aa6a: ; 0x11aa6a + text "Quit reading NEWS?" + done +; 0x11aa7e + +UnknownText_0x11aa7e: ; 0x11aa7e + text "Canceled sending" + line "SAVE FILE." + done +; 0x11aa9b + +UnknownText_0x11aa9b: ; 0x11aa9b + text "ODD EGG" + line "was received!" + done +; 0x11aab2 + +UnknownText_0x11aab2: ; 0x11aab2 + text "Registering your" + line "record…" + done +; 0x11aacc + +UnknownText_0x11aacc: ; 0x11aacc + text "One visit per day" + line "per BATTLE ROOM!" + done +; 0x11aaf0 + +UnknownText_0x11aaf0: ; 0x11aaf0 + text "A party #MON" + line "tops this level." + done +; 0x11ab0f + +UnknownText_0x11ab0f: ; 0x11ab0f + text_from_ram wcd49 + text " may go" + line "only to BATTLE" + + para "ROOMS that are" + line "Lv.70 or higher." + done +; 0x11ab4a + +UnknownText_0x11ab4a: ; 0x11ab4a + text "Cancel your BATTLE" + line "ROOM challenge?" + done +; 0x11ab6e + +UnknownText_0x11ab6e: ; 0x11ab6e + text "Exit GYM LEADER" + line "HONOR ROLL?" + done +; 0x11ab8b + +UnknownText_0x11ab8b: ; 0x11ab8b + text "Linking with the" + line "CENTER…" + done +; 0x11aba5 + +Text_WhatLevelDoYouWantToChallenge: ; 0x11aba5 + text "What level do you" + line "want to challenge?" + done +; 0x11abcb + +Text_CheckBattleRoomListByMaxLevel: ; 0x11abcb + text "Check BATTLE ROOM" + line "list by max level?" + done +; 0x11abf1 + +UnknownText_0x11abf1: ; 0x11abf1 + text "Enter which" + line "BATTLE ROOM?" + done +; 0x11ac0b + +UnknownText_0x11ac0b: ; 0x11ac0b + text "Which BATTLE ROOM?" + done +; 0x11ac1f + +UnknownText_0x11ac1f: ; 0x11ac1f + text_from_ram StringBuffer3 + text "'s ROOM" + line "@" + text_from_ram StringBuffer4 + text "?" + cont "Please wait…" + done +; 0x11ac3e + +Function11ac3e: ; 11ac3e + call SpeechTextBox + call FadeToMenu + callab InefficientlyClear121BytesAtwc300 + call Function11ac51 + call Function2b3c + ret +; 11ac51 + +Function11ac51: ; 11ac51 + xor a + ld [hBGMapMode], a + ld hl, Options + ld a, [hl] + push af + set 4, [hl] + ld a, [VramState] + push af + xor a + ld [VramState], a + ld a, [hInMenu] + push af + ld a, $1 + ld [hInMenu], a + xor a + ld [$ffde], a + ld [wcd49], a + ld [wcd4a], a + ld [wcd4c], a + ld [wcd4d], a + ld [wcd4e], a + call Function11ad1b + call DelayFrame +.asm_11ac82 + call JoyTextDelay + ld a, [wJumptableIndex] + bit 7, a + jr nz, .asm_11aca8 + call Function11b314 + call Function11acb7 + call Function11ad6e + ld a, $78 + ld [wc3b5], a + callba Function8cf7a + callba Function104061 + jr .asm_11ac82 + +.asm_11aca8 + call ClearSprites + pop af + ld [hInMenu], a + pop af + ld [VramState], a + pop af + ld [Options], a + ret +; 11acb7 + +Function11acb7: ; 11acb7 + ld hl, Unknown_11ba44 + ld a, [wcd49] + ld c, a + ld b, $0 + sla c + rl b + sla c + rl b + sla c + rl b + add hl, bc + decoord 6, 6 + ld a, [hli] + ld [de], a + decoord 0, 7 + ld bc, $0007 + call CopyBytes + ld a, [wcd49] + inc a + ld [wcd49], a + ld a, [hl] + cp $ff + jr nz, .asm_11aceb + xor a + ld [wcd49], a + +.asm_11aceb + ld hl, Unknown_11bb7d + ld a, [wcd4a] + ld c, a + ld b, $0 + sla c + rl b + sla c + rl b + sla c + rl b + add hl, bc + decoord 3, 9 + ld bc, $0007 + call CopyBytes + ld a, [wcd4a] + inc a + ld [wcd4a], a + inc hl + ld a, [hl] + cp $ff + ret nz + xor a + ld [wcd4a], a + ret +; 11ad1b + +Function11ad1b: ; 11ad1b + call WhiteBGMap + call ClearSprites + call ClearTileMap + callba Function17c000 + ld a, [wcfa9] + ld [wcd82], a + dec a + ld [hObjectStructIndexBuffer], a + ld a, $10 + ld [wc3b7], a + ld hl, Function8e83f + ld a, BANK(Function8e83f) + ld e, $4 + rst FarCall + ld hl, Function8e83f + ld a, BANK(Function8e83f) + ld e, $5 + rst FarCall + ld hl, $c6d0 + ld bc, $0115 + xor a + call ByteFill + xor a + ld [wJumptableIndex], a + ld [wcf64], a + ld [wcf65], a + ld [wcf66], a + ld [wcd30], a + ld a, $2 + ld [wc7d4], a + callba Function40bdc + ret +; 11ad6e + +Function11ad6e: ; 11ad6e + ld a, [wJumptableIndex] + ld hl, Jumptable_11ad78 + call Function11b239 + jp [hl] +; 11ad78 + +Jumptable_11ad78: ; 11ad78 + dw Function11b082 + dw Function11b0ff + dw Function11ad95 + dw Function11adc4 + dw Function11ae4e + dw Function11ae98 + dw Function11ad8f + dw Function11af04 + dw Function11af4e +; 11ad8a + +Function11ad8a: ; 11ad8a + ld hl, wJumptableIndex + inc [hl] + ret +; 11ad8f + +Function11ad8f: ; 11ad8f + ld hl, wJumptableIndex + set 7, [hl] + ret +; 11ad95 + +Function11ad95: ; 11ad95 + ld hl, MenuDataHeader_11ae38 + call LoadMenuDataHeader + call Function1cbb + hlcoord 12, 12 + ld de, String_11ae40 + call PlaceString + hlcoord 10, 10, AttrMap + ld bc, $0808 + call Function11afd6 + callba Function104061 + call Function11ad8a + ld a, $1 + ld [wcfa9], a + ld hl, Unknown_11afcc + call Function11afb7 + +Function11adc4: + ld hl, hJoyPressed + ld a, [hl] + and a + ret z + ld a, [hl] + and $40 + jr nz, .asm_11ade6 + ld a, [hl] + and $80 + jr nz, .asm_11aded + ld a, [hl] + and $1 + jr nz, .asm_11ae06 + ld a, [hl] + and $2 + ret z + call PlayClickSFX + xor a + ld [wJumptableIndex], a + jr .asm_11ae2e + +.asm_11ade6 + ld a, [wcfa9] + dec a + ret z + jr .asm_11adf4 + +.asm_11aded + ld a, [wcfa9] + inc a + cp $4 + ret z + +.asm_11adf4 + push af + ld hl, Unknown_11afcc + call Function11afbb + pop af + ld [wcfa9], a + ld hl, Unknown_11afcc + call Function11afb7 + ret + +.asm_11ae06 + call PlayClickSFX + ld a, [wcfa9] + dec a + ld hl, wcd30 + ld [hl], a + and a + jr z, .asm_11ae28 + hlcoord 2, 14 + ld a, [wcfa9] + cp $2 + jr z, .asm_11ae23 + call Function11b272 + jr .asm_11ae2b + +.asm_11ae23 + call Function11b267 + jr .asm_11ae2b + +.asm_11ae28 + ld a, $3 + ld [hl], a + +.asm_11ae2b + call Function11ad8a + +.asm_11ae2e + call ExitMenu + callba Function104061 + ret +; 11ae38 + +MenuDataHeader_11ae38: ; 11ae38 + db $40 ; flags + db 10, 10 ; start coords + db 17, 17 ; end coords + dw NULL + db 0 ; default option +; 11ae40 + +String_11ae40: ; 11ae40 + db "どちらでも" + next "♂ォス" + next "♀メス" + db "@" +; 11ae4e + +Function11ae4e: ; 11ae4e + ld hl, MenuDataHeader_11afe8 + call LoadMenuDataHeader + call Function1cbb + hlcoord 10, 14 + ld de, String_11aff0 + call PlaceString + ld hl, MenuDataHeader_11b013 + call LoadMenuDataHeader + call Function1cbb + hlcoord 16, 8 + ld de, String_11b01b + call PlaceString + hlcoord 14, 7, AttrMap + lb bc, 5, 6 + call Function11afd6 + hlcoord 9, 12, AttrMap + lb bc, 6, 11 + call Function11afd6 + callba Function104061 + call Function11ad8a + ld a, $1 + ld [wcfa9], a + ld hl, Unknown_11afd2 + call Function11afb7 + +Function11ae98: + ld hl, hJoyPressed + ld a, [hl] + and a + ret z + ld a, [hl] + and D_UP + jr nz, .asm_11aec1 + ld a, [hl] + and D_DOWN + jr nz, .asm_11aec8 + ld a, [hl] + and A_BUTTON + jr nz, .asm_11aee1 + ld a, [hl] + and B_BUTTON + ret z + call PlayClickSFX +.asm_11aeb4 + hlcoord 2, 14 + ld a, $7f + ld [hl], a + ld a, $1 + ld [wJumptableIndex], a + jr .asm_11aef7 + +.asm_11aec1 + ld a, [wcfa9] + dec a + ret z + jr .asm_11aecf + +.asm_11aec8 + ld a, [wcfa9] + inc a + cp $3 + ret z + +.asm_11aecf + push af + ld hl, Unknown_11afd2 + call Function11afbb + pop af + ld [wcfa9], a + ld hl, Unknown_11afd2 + call Function11afb7 + ret + +.asm_11aee1 + call PlayClickSFX + ld a, [wcfa9] + cp $2 + jr z, .asm_11aeb4 + ld a, [wcd4b] + ld [ScriptVar], a + call Function11b022 + call Function11ad8a + +.asm_11aef7 + call ExitMenu + call ExitMenu + callba Function104061 + ret +; 11af04 + +Function11af04: ; 11af04 + ld hl, MenuDataHeader_11afe8 + call LoadMenuDataHeader + call Function1cbb + hlcoord 10, 14 + ld de, String_11b003 + call PlaceString + ld hl, MenuDataHeader_11b013 + call LoadMenuDataHeader + call Function1cbb + hlcoord 16, 8 + ld de, String_11b01b + call PlaceString + hlcoord 14, 7, AttrMap + lb bc, 5, 6 + call Function11afd6 + hlcoord 9, 12, AttrMap + lb bc, 6, 11 + call Function11afd6 + callba Function104061 + call Function11ad8a + ld a, $2 + ld [wcfa9], a + ld hl, Unknown_11afd2 + call Function11afb7 + +Function11af4e: + ld hl, hJoyPressed + ld a, [hl] + and a + ret z + ld a, [hl] + and D_UP + jr nz, .asm_11af77 + ld a, [hl] + and D_DOWN + jr nz, .asm_11af7e + ld a, [hl] + and A_BUTTON + jr nz, .asm_11af97 + ld a, [hl] + and B_BUTTON + ret z + call PlayClickSFX +.asm_11af6a + hlcoord 2, 14 + ld a, $7f + ld [hl], a + ld a, $1 + ld [wJumptableIndex], a + jr .asm_11afaa + +.asm_11af77 + ld a, [wcfa9] + dec a + ret z + jr .asm_11af85 + +.asm_11af7e + ld a, [wcfa9] + inc a + cp $3 + ret z + +.asm_11af85 + push af + ld hl, Unknown_11afd2 + call Function11afbb + pop af + ld [wcfa9], a + ld hl, Unknown_11afd2 + call Function11afb7 + ret + +.asm_11af97 + call PlayClickSFX + ld a, [wcfa9] + cp $2 + jr z, .asm_11af6a + ld a, $6 + ld [wJumptableIndex], a + xor a + ld [ScriptVar], a + +.asm_11afaa + call ExitMenu + call ExitMenu + callba Function104061 + ret +; 11afb7 + +Function11afb7: ; 11afb7 + ld e, $ed + jr asm_11afbd + +Function11afbb: + ld e, $7f + +asm_11afbd: + ld a, [wcfa9] + dec a + ld c, a + ld b, 0 +rept 2 + add hl, bc +endr + ld a, e + ld e, [hl] + inc hl + ld d, [hl] + ld [de], a + ret +; 11afcc + +Unknown_11afcc: + dwcoord 11, 12 + dwcoord 11, 14 + dwcoord 11, 16 + +Unknown_11afd2: + dwcoord 15, 8 + dwcoord 15, 10 +; 11afd6 + +Function11afd6: ; 11afd6 + ld de, $0014 + ld a, $3 +.asm_11afdb + push bc + push hl +.asm_11afdd + ld [hli], a + dec c + jr nz, .asm_11afdd + pop hl + add hl, de + pop bc + dec b + jr nz, .asm_11afdb + ret +; 11afe8 + +MenuDataHeader_11afe8: ; 11afe8 + db $40 ; flags + db 12, 9 ; start coords + db 17, 19 ; end coords + dw NULL + db 0 ; default option +; 11aff0 + +String_11aff0: ; 11aff0 + db "この じょうけんで" + next "よろしいですか?@" +; 11b003 + +String_11b003: ; 11b003 + db "こうかんを" + next "ちゅうししますか?@" +; 11b013 + +MenuDataHeader_11b013: ; 11b013 + db $40 ; flags + db 7, 14 ; start coords + db 11, 19 ; end coords + dw NULL + db 1 ; default option +; 11b01b + +String_11b01b: + db "はい" + next "いいえ@" +; 11b022 + +Function11b022: ; 11b022 + ld a, [wcd2e] + and a + jr z, .asm_11b02e + ld hl, StringBuffer3 + call Function11b03d + +.asm_11b02e + ld a, [wcd30] + and a + ret z + cp $3 + ret z + ld hl, StringBuffer4 + call Function11b03d + ret +; 11b03d + +Function11b03d: ; 11b03d + push hl + push af + ld c, $1 +.asm_11b041 + ld a, [hli] + cp $ef + jr z, .asm_11b051 + cp $f5 + jr z, .asm_11b051 + cp $50 + jr z, .asm_11b055 + inc c + jr .asm_11b041 + +.asm_11b051 + dec hl + ld a, $50 + ld [hli], a + +.asm_11b055 + dec hl + push hl + ld e, $4 + ld d, $0 + add hl, de + ld e, l + ld d, h + pop hl +.asm_11b05f + ld a, [hld] + ld [de], a + dec de + dec c + jr nz, .asm_11b05f + pop af + pop de + cp $1 + jr nz, .asm_11b070 + ld hl, String_11b07a + jr .asm_11b073 + +.asm_11b070 + ld hl, String_11b07e + +.asm_11b073 + ld bc, 4 + call CopyBytes + ret +; 11b07a + +String_11b07a: db "ォスの " +String_11b07e: db "メスの " + +Function11b082: ; 11b082 + call Function11b242 + ld a, $7 + ld [wc7d3], a + call Function11b099 + call Function11b295 + call Function11b275 + call SetPalettes + jp Function11ad8a +; 11b099 + +Function11b099: ; 11b099 + ld c, $6 + hlcoord 11, 1 + ld a, [wc7d3] + add a + ld b, a + xor a + call Function11b236 + ld a, [wc7d0] + ld e, a + ld d, $0 + ld hl, $c6d0 + add hl, de + ld e, l + ld d, h + hlcoord 11, 2 + ld a, [wc7d3] +.asm_11b0b9 + push af + ld a, [de] + ld [wd265], a + push de + push hl + call Function11b0cf + pop hl + ld de, $0028 + add hl, de + pop de + inc de + pop af + dec a + jr nz, .asm_11b0b9 + ret +; 11b0cf + +Function11b0cf: ; 11b0cf + and a + ret z + call Function11b0ec + ret c + call Function11b0e1 + push hl + call GetPokemonName + pop hl + call PlaceString + ret +; 11b0e1 + +Function11b0e1: ; 11b0e1 + call Function11b21e + jr nz, .asm_11b0e8 + inc hl + ret + +.asm_11b0e8 + ld a, $1 + ld [hli], a + ret +; 11b0ec + +Function11b0ec: ; 11b0ec + call Function11b22a + ret nz + inc hl + ld de, String_11b0f9 + call PlaceString + scf + ret +; 11b0f9 + +String_11b0f9: ; 11b0f9 + db "ーーーーー@" +; 11b0ff + +Function11b0ff: ; 11b0ff + ld hl, hJoyPressed + ld a, [hl] + and $2 + jr nz, .asm_11b141 + ld a, [hl] + and $1 + jr nz, .asm_11b131 + call Function11b175 + jr nc, .asm_11b125 + ld a, [wcd4c] + inc a + and $3 + ld [wcd4c], a + xor a + ld [hBGMapMode], a + call Function11b099 + ld a, $1 + ld [hBGMapMode], a + ret + +.asm_11b125 + ld a, [wcd4c] + and a + ret z + inc a + and $3 + ld [wcd4c], a + ret + +.asm_11b131 + call Function11b20b + call Function11b22a + jr z, .asm_11b13d + ld a, $1 + jr .asm_11b148 + +.asm_11b13d + ld a, $2 + jr .asm_11b148 + +.asm_11b141 + ld hl, wJumptableIndex + ld a, $7 + ld [hl], a + ret + +.asm_11b148 + call PlayClickSFX + ld [wcd4b], a + and a + jr z, .asm_11b16c + ld a, [wcf65] + cp $0 + jr z, .asm_11b163 + cp $fe + jr z, .asm_11b167 + cp $ff + jr z, .asm_11b16b + jp Function11ad8a + +.asm_11b163 + ld a, $1 + jr .asm_11b16c + +.asm_11b167 + ld a, $2 + jr .asm_11b16c + +.asm_11b16b + xor a + +.asm_11b16c + ld [wcd30], a + ld a, $4 + ld [wJumptableIndex], a + ret +; 11b175 + +Function11b175: ; 11b175 + ld a, [wc7d3] + ld d, a + ld a, [wc7d2] + ld e, a + ld hl, hJoyLast + ld a, [hl] + and $40 + jr nz, .asm_11b19a + ld a, [hl] + and $80 + jr nz, .asm_11b1ae + ld a, d + cp e + jr nc, .asm_11b1ed + ld a, [hl] + and $20 + jr nz, .asm_11b1c6 + ld a, [hl] + and $10 + jr nz, .asm_11b1d8 + jr .asm_11b1ed + +.asm_11b19a + ld hl, wc7d1 + ld a, [hl] + and a + jr z, .asm_11b1a4 + dec [hl] + jr .asm_11b1ef + +.asm_11b1a4 + ld hl, wc7d0 + ld a, [hl] + and a + jr z, .asm_11b1ed + dec [hl] + jr .asm_11b1ef + +.asm_11b1ae + ld hl, wc7d1 + ld a, [hl] + inc a + cp e + jr nc, .asm_11b1ed + cp d + jr nc, .asm_11b1bc + inc [hl] + jr .asm_11b1ef + +.asm_11b1bc + ld hl, wc7d0 + add [hl] + cp e + jr nc, .asm_11b1ed + inc [hl] + jr .asm_11b1ef + +.asm_11b1c6 + ld hl, wc7d0 + ld a, [hl] + and a + jr z, .asm_11b1ed + cp d + jr nc, .asm_11b1d4 + xor a + ld [hl], a + jr .asm_11b1ef + +.asm_11b1d4 + sub d + ld [hl], a + jr .asm_11b1ef + +.asm_11b1d8 + ld hl, wc7d0 + ld a, d + add a + add [hl] + jr c, .asm_11b1e3 + cp e + jr c, .asm_11b1e8 + +.asm_11b1e3 + ld a, e + sub d + ld [hl], a + jr .asm_11b1ef + +.asm_11b1e8 + ld a, [hl] + add d + ld [hl], a + jr .asm_11b1ef + +.asm_11b1ed + and a + ret + +.asm_11b1ef + call Function11b295 + call Function11b275 + scf + ret +; 11b1f7 + +Function11b1f7: ; 11b1f7 + hlcoord 0, 0 + ld a, $32 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + call ByteFill + ret +; 11b203 + +Function11b203: ; 11b203 +.asm_11b203 + ld a, [de] + cp $ff + ret z + inc de + ld [hli], a + jr .asm_11b203 +; 11b20b + +Function11b20b: ; 11b20b + ld a, [wc7d1] + ld hl, wc7d0 + add [hl] + ld e, a + ld d, $0 + ld hl, $c6d0 + add hl, de + ld a, [hl] + ld [wd265], a + ret +; 11b21e + +Function11b21e: ; 11b21e + push de + push hl + ld a, [wd265] + dec a + call CheckCaughtMon + pop hl + pop de + ret +; 11b22a + +Function11b22a: ; 11b22a + push de + push hl + ld a, [wd265] + dec a + call CheckSeenMon + pop hl + pop de + ret +; 11b236 + +Function11b236: ; 11b236 + jp FillBoxWithByte +; 11b239 + +Function11b239: ; 11b239 + ld e, a + ld d, 0 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + ret +; 11b242 + +Function11b242: ; 11b242 + hlcoord 3, 4 + ld de, StringBuffer3 + call PlaceString + xor a + ld [MonType], a + callba GetGender + hlcoord 1, 4 + ld a, [CurPartySpecies] + ld bc, wcd2f + ld [bc], a + dec bc + jr c, asm_11b26a + jr z, asm_11b26f + ld a, $1 + ld [bc], a + +Function11b267: + ld [hl], $ef + ret + +asm_11b26a + xor a + ld [bc], a + ld [hl], $7f + ret + +asm_11b26f + ld a, $2 + ld [bc], a + +Function11b272: + ld [hl], $f5 + ret +; 11b275 + +Function11b275: ; 11b275 + call Function11b279 + ret +; 11b279 + +Function11b279: ; 11b279 + ld a, [wd265] + ld [CurSpecies], a + call Function11b22a + jr z, .asm_11b28f + call GetBaseData + ld a, [BaseGender] + ld [wcf65], a + jr .asm_11b294 + +.asm_11b28f + ld a, $ff + ld [wcf65], a + +.asm_11b294 + ret +; 11b295 + +Function11b295: ; 11b295 + hlcoord 4, 13 + ld de, String_11b308 + call PlaceString + hlcoord 4, 14 + ld de, String_11b308 + call PlaceString + call Function11b20b + call Function11b22a + jr z, .asm_11b2d1 + ld a, [$c608] + ld c, a + ld a, [$c608 + 1] + ld b, a + ld hl, $0007 + add hl, bc + xor a + ld [hl], a + ld hl, $0003 + add hl, bc + ld e, [hl] + callba Function8e9bc + hlcoord 4, 14 + push hl + call GetPokemonName + jr .asm_11b2e7 + +.asm_11b2d1 + ld a, [$c608] + ld c, a + ld a, [$c608 + 1] + ld b, a + ld hl, $0007 + add hl, bc + ld a, $50 + ld [hl], a + hlcoord 4, 13 + push hl + ld de, String_11b30e + +.asm_11b2e7 + ld a, $6 + ld bc, StringBuffer4 +.asm_11b2ec + push af + ld a, [de] + ld [bc], a + inc de + inc bc + pop af + dec a + and a + jr nz, .asm_11b2ec + pop hl + ld de, StringBuffer4 + call PlaceString + ret +; 11b2fe + +String_11b2fe: ; 11b2fe + db "あげる#@" +; 11b303 + +String_11b303: ; 11b303 + db "ほしい#@" +; 11b308 + +String_11b308: ; 11b308 + db " @" +; 11b30e + +String_11b30e: ; 11b30e + db "みはっけん@" +; 11b314 + +Function11b314: ; 11b314 + call Function11b31b + call Function11b3d9 + ret +; 11b31b + +Function11b31b: ; 11b31b + ld hl, Unknown_11b350 + ld a, [wJumptableIndex] + cp $2 + jr c, .asm_11b349 + ld a, [wc7d1] + cp $4 + jr nc, .asm_11b344 + cp $3 + jr c, .asm_11b349 + ld a, [wJumptableIndex] + cp $2 + jr z, .asm_11b349 + cp $3 + jr z, .asm_11b349 + cp $6 + jr z, .asm_11b349 + + ld bc, Unknown_11b37b + jr .asm_11b34c + +.asm_11b344 + ld bc, Unknown_11b389 + jr .asm_11b34c + +.asm_11b349 + ld bc, Unknown_11b36d + +.asm_11b34c + call Function11b397 + ret +; 11b350 + +Unknown_11b350: + db $1a, $5e, $1a, $66, $1a, $6e, $1a, $76, $1a, $7e, $1a, $86, $1a, $8e + db $22, $5e, $22, $66, $22, $6e, $22, $76, $22, $7e, $22, $86, $22, $8e + db $ff + +Unknown_11b36d: + db $30, $31, $31, $31, $31, $31, $32, $40, $41, $41, $41, $41, $41, $42 +Unknown_11b37b: + db $30, $31, $31, $39, $39, $39, $39, $40, $41, $41, $39, $39, $39, $39 +Unknown_11b389: + db $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39 + +Function11b397: ; 11b397 + ld de, Sprites +.asm_11b39a + ld a, [hl] + cp $ff + ret z + ld a, [wc7d1] + and $7 + swap a + add [hl] + inc hl + ld [de], a + inc de + ld a, [hli] + ld [de], a + inc de + ld a, [bc] + inc bc + ld [de], a + inc de + ld a, $5 + ld [de], a + inc de + jr .asm_11b39a +; 11b3b6 + +Function11b3b6: ; 11b3b6 +.asm_11b3b6 + ld a, [hl] + cp $ff + ret z + ld a, [wcd4d] + and $7 + swap a + add [hl] + inc hl + ld [de], a + inc de + ld a, [hli] + ld [de], a + inc de + push hl + ld l, c + ld h, b + ld a, [wcd4e] + add [hl] + inc bc + ld [de], a + inc de + pop hl + ld a, $5 + ld [de], a + inc de + jr .asm_11b3b6 +; 11b3d9 + +Function11b3d9: ; 11b3d9 + ld de, Sprites + $70 + push de + ld a, [wc7d2] + dec a + ld e, a + ld a, [wc7d1] + ld hl, wc7d0 + add [hl] + cp e + jr z, .asm_11b40d + ld hl, 0 + ld bc, $0070 + call AddNTimes + ld e, l + ld d, h + ld b, $0 + ld a, d + or e + jr z, .asm_11b40f + ld a, [wc7d2] + ld c, a +.asm_11b401 + ld a, e + sub c + ld e, a + ld a, d + sbc $0 + ld d, a + jr c, .asm_11b40f + inc b + jr .asm_11b401 + +.asm_11b40d + ld b, $70 + +.asm_11b40f + ld a, $15 + add b + pop hl + ld [hli], a + cp $41 + jr c, .asm_11b42b + ld a, [wJumptableIndex] + cp $4 + jr z, .asm_11b43b + cp $5 + jr z, .asm_11b43b + cp $7 + jr z, .asm_11b43b + cp $8 + jr z, .asm_11b43b + +.asm_11b42b + ld a, $9b + ld [hli], a + ld a, [wcd4c] + add $3c + ld [hli], a + ld a, [wcd4c] + add $1 + ld [hl], a + ret + +.asm_11b43b + ld a, $9b + ld [hli], a + ld a, $39 + ld [hli], a + xor a + ld [hl], a + ret +; 11b444 + +Function11b444: ; 11b444 + call Function11b44b + call Function11b45c + ret +; 11b44b + +Function11b44b: ; 11b44b + xor a + ld [wJumptableIndex], a + ld [wcf64], a + ld [wcf65], a + ld [wcf66], a + call UpdateTime + ret +; 11b45c + +Function11b45c: ; 11b45c +.asm_11b45c + call Function11b46a + call DelayFrame + ld a, [wJumptableIndex] + cp $4 + jr nz, .asm_11b45c + ret +; 11b46a + +Function11b46a: ; 11b46a + ld a, [wJumptableIndex] + ld e, a + ld d, 0 + ld hl, Jumptable_11b479 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 11b479 + +Jumptable_11b479: ; 11b479 + dw Function11b483 + dw Function11b570 + dw Function11b5c0 + dw Function11b5e0 + dw Function11b5e7 +; 11b483 + +Function11b483: ; 11b483 + call Function11b538 + ld hl, PlayerName + ld a, $5 +.asm_11b48b + push af + ld a, [hli] + ld [bc], a + inc bc + pop af + dec a + and a + jr nz, .asm_11b48b + ld de, $0030 + ld hl, PartyMon1Species + ld a, [wcd82] + dec a + push af +.asm_11b49f + and a + jr z, .asm_11b4a6 + add hl, de + dec a + jr .asm_11b49f + +.asm_11b4a6 + push bc + ld a, $30 +.asm_11b4a9 + push af + ld a, [hli] + ld [bc], a + inc bc + pop af + dec a + and a + jr nz, .asm_11b4a9 + pop de + push bc + ld a, [de] + ld [CurSpecies], a + call GetBaseData + ld hl, $001f + add hl, de + ld a, [hl] + ld [CurPartyLevel], a + ld hl, $0024 + add hl, de + push hl + ld hl, $000a + add hl, de + pop de + push de + ld b, $1 + predef CalcPkmnStats + pop de + ld h, d + ld l, e +rept 2 + dec hl +endr + ld a, [de] + ld [hli], a + inc de + ld a, [de] + ld [hl], a + pop bc + ld de, $000b + ld hl, PartyMonOT + pop af + push af +.asm_11b4e8 + and a + jr z, .asm_11b4ef + add hl, de + dec a + jr .asm_11b4e8 + +.asm_11b4ef + ld a, $a +.asm_11b4f1 + push af + ld a, [hli] + ld [bc], a + inc bc + pop af + dec a + and a + jr nz, .asm_11b4f1 + ld de, $000b + ld hl, PartyMonNicknames + pop af + push af +.asm_11b502 + and a + jr z, .asm_11b509 + add hl, de + dec a + jr .asm_11b502 + +.asm_11b509 + ld a, $a +.asm_11b50b + push af + ld a, [hli] + ld [bc], a + inc bc + pop af + dec a + and a + jr nz, .asm_11b50b + ld de, $002f + ld hl, $a600 + pop af +.asm_11b51b + and a + jr z, .asm_11b522 + add hl, de + dec a + jr .asm_11b51b + +.asm_11b522 + ld a, $0 + call GetSRAMBank + ld a, $2f +.asm_11b529 + push af + ld a, [hli] + ld [bc], a + inc bc + pop af + dec a + and a + jr nz, .asm_11b529 + call CloseSRAM + jp Function11ad8a +; 11b538 + +Function11b538: ; 11b538 + ld bc, BattleMonNick + 5 + ld a, [PlayerID] + ld [wcd2a], a + ld [bc], a + inc bc + ld a, [PlayerID + 1] + ld [wcd2b], a + ld [bc], a + inc bc + ld a, [wSecretID] + ld [wcd2c], a + ld [bc], a + inc bc + ld a, [wSecretID + 1] + ld [wcd2d], a + ld [bc], a + inc bc + ld a, [wcd2e] + ld [bc], a + inc bc + ld a, [wcd2f] + ld [bc], a + inc bc + ld a, [wcd30] + ld [bc], a + inc bc + ld a, [wd265] + ld [bc], a + inc bc + ret +; 11b570 + +Function11b570: ; 11b570 + call Function118007 + ld a, [ScriptVar] + and a + jr nz, .asm_11b57f + call Function11b585 + jp Function11ad8a + +.asm_11b57f + ld a, $4 + ld [wJumptableIndex], a + ret +; 11b585 + +Function11b585: ; 11b585 + ld a, $3 + ld [rSVBK], a + ld hl, $d800 + ld de, $c608 + ld bc, $008f + call CopyBytes + ld a, $1 + ld [rSVBK], a + ld a, $5 + call GetSRAMBank + ld de, $a800 + ld a, $1 + ld [de], a + inc de + ld hl, $c608 + ld bc, $008f + call CopyBytes + push de + pop hl + ld a, [hRTCMinutes] + ld [hli], a + ld a, [hRTCHours] + ld [hli], a + ld a, [hRTCDayLo] + ld [hli], a + ld a, [hRTCDayHi] + ld [hl], a + call CloseSRAM + ret +; 11b5c0 + +Function11b5c0: ; 11b5c0 + ld a, [wcd82] + dec a + ld [CurPartyMon], a + xor a + ld [wd10b], a + callba Functione039 + callba Function170807 + callba Function14a58 + jp Function11ad8a +; 11b5e0 + +Function11b5e0: ; 11b5e0 + xor a + ld [ScriptVar], a + jp Function11ad8a +; 11b5e7 + +Function11b5e7: ; 11b5e7 + ret +; 11b5e8 + +Function11b5e8: ; 11b5e8 + ld a, $0 + call GetSRAMBank + ld hl, wRTC + ld de, $c608 + ld bc, $0004 + call CopyBytes + call CloseSRAM + ld a, $5 + call GetSRAMBank + ld hl, $c608 + ld de, $b08c + ld bc, $0004 + call CopyBytes + ld a, $2 + ld [$a800], a + ld a, [$a81f] + ld [wcd2a], a + ld a, [$a820] + ld [wcd2b], a + ld a, [$a821] + ld [wcd2c], a + ld a, [$a822] + ld [wcd2d], a + ld a, [$a823] + ld [wcd2e], a + ld a, [$a824] + ld [wcd2f], a + ld a, [$a825] + ld [wcd30], a + ld a, [$a826] + ld [wcd31], a + call CloseSRAM + call Function11b44b + call Function11b64c + ret +; 11b64c + +Function11b64c: ; 11b64c +.asm_11b64c + call Function11b65a + call DelayFrame + ld a, [wJumptableIndex] + cp $1 + jr nz, .asm_11b64c + ret +; 11b65a + +Function11b65a: ; 11b65a + ld a, [wJumptableIndex] + ld e, a + ld d, 0 + ld hl, Jumptable_11b669 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 11b669 + +Jumptable_11b669: ; 11b669 + dw Function11b66d + dw Function11b6b3 +; 11b66d + +Function11b66d: ; 11b66d + call Function1180b8 + ld a, [ScriptVar] + and a + jr nz, .asm_11b6b0 + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + ld a, [StringBuffer2 + 10] + ld b, a + pop af + ld [rSVBK], a + ld a, b + and a + jr z, .asm_11b691 + cp $1 + jr nz, .asm_11b6b0 + call Function11b6b4 + jr .asm_11b6b0 + +.asm_11b691 + callba Function17081d + ld a, [ScriptVar] + and a + jr z, .asm_11b6b0 + xor a + ld [ScriptVar], a + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + ld a, $2 + ld [StringBuffer2 + 10], a + pop af + ld [rSVBK], a + +.asm_11b6b0 + jp Function11ad8a +; 11b6b3 + +Function11b6b3: ; 11b6b3 + ret +; 11b6b4 + +Function11b6b4: ; 11b6b4 + ld a, $5 + call GetSRAMBank + ld a, [wcd30] + ld [wc708], a + ld a, [wcd31] + ld [wc709], a + ld a, $8 + ld [BGMapBuffer], a + ld a, $c7 + ld [wcd21], a + ld a, $d + ld [CreditsTimer], a + ld a, $c6 + ld [wcd23], a + ld a, $3d + ld [wcd24], a + ld a, $c6 + ld [wcd25], a + ld a, $42 + ld [wcd26], a + ld a, $c6 + ld [wcd27], a + ld a, $47 + ld [wcd28], a + ld a, $c6 + ld [wcd29], a + ld a, $46 + ld [$c628], a + ld de, $c63d + ld c, $5 + callba Function17d073 + jr nc, .asm_11b70f + callba Function17d187 + +.asm_11b70f + ld de, $c63d + ld bc, $0105 + callba Function17d1e1 + jr nc, .asm_11b723 + callba Function17d187 + +.asm_11b723 + ld de, $c642 + ld c, $5 + callba Function17d073 + jr nc, .asm_11b736 + callba Function17d199 + +.asm_11b736 + ld de, $c642 + ld bc, $0105 + callba Function17d1e1 + jr nc, .asm_11b74a + callba Function17d199 + +.asm_11b74a + ld de, $c647 + ld c, $21 + callba Function17d073 + jr nc, .asm_11b75d + callba Function17d1ab + +.asm_11b75d + ld de, $c647 + ld bc, $0221 + callba Function17d1e1 + jr c, .asm_11b770 + ld a, b + cp $2 + jr nz, .asm_11b776 + +.asm_11b770 + callba Function17d1ab + +.asm_11b776 + ld de, $c668 + ld c, $5 + callba Function17d073 + jr nc, .asm_11b789 + callba Function17d1c9 + +.asm_11b789 + ld de, $c668 + ld bc, $0105 + callba Function17d1e1 + jr nc, .asm_11b79d + callba Function17d1c9 + +.asm_11b79d + ld a, [$c608 + 6] + cp $ff + jr nz, .asm_11b7a8 + xor a + ld [$c608 + 6], a + +.asm_11b7a8 + ld a, [wcd31] + ld [$c608 + 5], a + ld [CurSpecies], a + call GetBaseData + + ld hl, $c62c + ld a, [hl] + cp MIN_LEVEL + ld a, MIN_LEVEL + jr c, .asm_11b7c5 + ld a, [hl] + cp MAX_LEVEL + jr c, .asm_11b7c6 + ld a, MAX_LEVEL +.asm_11b7c5 + ld [hl], a +.asm_11b7c6 + ld [CurPartyLevel], a + + ld hl, $c616 + 1 + ld de, $c62c + 5 + ld b, $1 + predef CalcPkmnStats + ld de, $c62c + 5 + ld hl, $c62c + 3 + ld a, [de] + ld [hli], a + inc de + ld a, [de] + ld [hl], a + call Function11b98f + ret +; 11b7e5 + +Function11b7e5: ; 11b7e5 + ld a, [$c608 + 5] + ld [wc702], a + ld [CurPartySpecies], a + ld a, [wcd81] + ld [wc74e], a + ld hl, $c63d + ld de, wc724 + ld bc, $0005 + call CopyBytes + ld a, $50 + ld [de], a + ld a, [$c608 + 11] + ld [wc731], a + ld a, [$c608 + 12] + ld [wc732], a + ld hl, $c608 + 26 + ld a, [hli] + ld [wc72f], a + ld a, [hl] + ld [wc730], a + ld bc, $c608 + 5 + callba GetCaughtGender + ld a, c + ld [wc733], a + call SpeechTextBox + call FadeToMenu + callba Function108016 + callba Function17d1f1 + ld a, $1 + ld [wd1e9], a + ld a, $2 + ld [wLinkMode], a + callba Function421d8 + xor a + ld [wLinkMode], a + callba Function14a58 + ld a, $5 + call GetSRAMBank + ld a, $5 + ld [$a800], a + call CloseSRAM + ld a, [MapGroup] + ld b, a + ld a, [MapNumber] + ld c, a + call GetMapTrigger + ld a, d + or e + jr z, .asm_11b872 + ld a, $1 + ld [de], a + +.asm_11b872 + call Function2b3c + call RestartMapMusic + ret +; 11b879 + +Function11b879: ; 11b879 + callba Function17089a + ld a, [ScriptVar] + and a + ret z + ld a, $5 + call GetSRAMBank + ld a, [$a800] + ld [ScriptVar], a + ld a, [$a890] + ld [wcd49], a + ld a, [$a891] + ld [wcd4a], a + ld a, [$a892] + ld [wcd4b], a + ld a, [$a893] + ld [wcd4c], a + call CloseSRAM + ld a, [ScriptVar] + and a + ret z + ld hl, wcd4c + ld a, [hRTCDayHi] + cp [hl] + ret nz + dec hl + ld a, [hRTCDayLo] + cp [hl] + ret nz + ld hl, wcd4a + ld a, [hRTCHours] + cp [hl] + jr nc, .asm_11b8d8 + ld a, $18 + sub [hl] + ld hl, hRTCHours + add [hl] + ld [wcd4c], a + ld a, [hRTCMinutes] + ld [wcd4b], a + xor a + ld [wcd4a], a + jr .asm_11b8e2 + +.asm_11b8d8 + ld a, [hRTCMinutes] + ld [wcd4b], a + ld a, [hRTCHours] + ld [wcd4c], a + +.asm_11b8e2 + xor a + ld l, a + ld h, a + ld b, a + ld d, a + ld a, [wcd4b] + ld e, a + ld a, [wcd4c] + ld c, $3c + call AddNTimes + add hl, de + push hl + xor a + ld l, a + ld h, a + ld b, a + ld d, a + ld a, [wcd49] + ld e, a + ld a, [wcd4a] + ld c, $3c + call AddNTimes + add hl, de + ld a, l + cpl + add $1 + ld e, a + ld a, h + cpl + adc $0 + ld d, a + pop hl + add hl, de + ld de, $ff88 + add hl, de + bit 7, h + ret z + ld a, $2 + ld [ScriptVar], a + ret +; 11b920 + +Function11b920: ; 11b920 + call Function11b44b + ld a, $5 + call GetSRAMBank + ld hl, $a81f + ld de, BattleMonNick + 5 + ld bc, $0008 + call CopyBytes + call CloseSRAM + call Function118000 + ret +; 11b93b + +Function11b93b: ; 11b93b + ld a, $5 + call GetSRAMBank + xor a + ld [$a800], a + ld hl, $a823 + ld de, wEnemyMoveStruct + ld bc, $008f + call CopyBytes + call CloseSRAM + ld a, wEnemyMoveStruct % $100 + ld [wcd20], a + ld a, wEnemyMoveStruct / $100 + ld [wcd21], a + ld a, $c611 % $100 + ld [wcd22], a + ld a, $c611 / $100 + ld [wcd23], a + ld a, $c641 % $100 + ld [wcd24], a + ld a, $c641 / $100 + ld [wcd25], a + ld a, $c646 % $100 + ld [wcd26], a + ld a, $c646 / $100 + ld [wcd27], a + ld a, $c64b % $100 + ld [wcd28], a + ld a, $c64b / $100 + ld [wcd29], a + call Function11b98f + callba Function14a58 + ret +; 11b98f + +Function11b98f: ; 11b98f + ld hl, PartyCount + ld a, [hl] + ld e, a + inc [hl] + ld a, [wcd20] + ld l, a + ld a, [wcd21] + ld h, a + inc hl + ld bc, PartySpecies + ld d, e +.loop1 + inc bc + dec d + jr nz, .loop1 + ld a, e + ld [CurPartyMon], a + ld a, [hl] + ld [bc], a + inc bc + ld a, $ff + ld [bc], a + ld hl, PartyMon1Species + ld bc, PartyMon2 - PartyMon1 + ld a, e + ld [wcd2a], a +.loop2 + add hl, bc + dec a + and a + jr nz, .loop2 + ld e, l + ld d, h + ld a, [CreditsTimer] + ld l, a + ld a, [wcd23] + ld h, a + ld bc, PartyMon2 - PartyMon1 + call CopyBytes + ld hl, PartyMonOT + ld bc, NAME_LENGTH + ld a, [wcd2a] +.loop3 + add hl, bc + dec a + and a + jr nz, .loop3 + ld e, l + ld d, h + ld a, [wcd24] + ld l, a + ld a, [wcd25] + ld h, a + ld bc, PKMN_NAME_LENGTH - 1 + call CopyBytes + ld a, "@" + ld [de], a + ld hl, PartyMonNicknames + ld bc, PKMN_NAME_LENGTH + ld a, [wcd2a] +.loop4 + add hl, bc + dec a + and a + jr nz, .loop4 + ld e, l + ld d, h + ld a, [wcd26] + ld l, a + ld a, [wcd27] + ld h, a + ld bc, PKMN_NAME_LENGTH - 1 + call CopyBytes + ld a, "@" + ld [de], a + ld hl, s0_a600 + ld bc, party_struct_length - 1 + ld a, [wcd2a] +.loop5 + add hl, bc + dec a + and a + jr nz, .loop5 + ld a, $0 + call GetSRAMBank + ld e, l + ld d, h + ld a, [wcd28] + ld l, a + ld a, [wcd29] + ld h, a + ld bc, party_struct_length - 1 + call CopyBytes + call CloseSRAM + ret +; 11ba38 + +Function11ba38: ; 11ba38 + callba CheckCurPartyMonFainted + ret c + xor a + ld [ScriptVar], a + ret +; 11ba44 + +Unknown_11ba44: + db $47, $30, $0a, $0a, $0a, $0a, $0a, $56 + db $46, $2f, $0a, $0a, $0a, $0a, $0a, $55 + db $45, $3d, $0a, $0a, $0a, $0a, $0a, $54 + db $44, $30, $0a, $0a, $0a, $0a, $0a, $53 + db $43, $2f, $0a, $0a, $0a, $0a, $0a, $52 + db $4a, $3d, $0a, $0a, $0a, $0a, $0a, $51 + db $4a, $30, $0a, $0a, $0a, $0a, $0a, $50 + db $4a, $2f, $0a, $0a, $0a, $0a, $0a, $4f + db $4a, $3d, $0a, $0a, $0a, $0a, $0a, $4e + db $4a, $30, $0a, $0a, $0a, $0a, $4d, $42 + db $4a, $2f, $0a, $0a, $0a, $0a, $6b, $58 + db $4a, $3d, $0a, $0a, $0a, $0a, $6a, $58 + db $4a, $30, $0a, $0a, $0a, $0a, $69, $58 + db $4a, $2f, $0a, $0a, $0a, $0a, $68, $58 + db $4a, $3d, $0a, $0a, $0a, $66, $67, $58 + db $4a, $30, $0a, $0a, $0a, $65, $0a, $58 + db $4a, $2f, $0a, $0a, $0a, $64, $0a, $58 + db $4a, $3d, $0a, $0a, $0a, $63, $0a, $58 + db $4a, $30, $0a, $0a, $61, $62, $0a, $58 + db $4a, $2f, $0a, $0a, $5f, $60, $0a, $58 + db $4a, $3d, $0a, $61, $62, $0a, $0a, $58 + db $4a, $30, $0a, $63, $0a, $0a, $0a, $58 + db $4a, $2f, $69, $0a, $0a, $0a, $0a, $58 + db $4a, $3d, $81, $0a, $0a, $0a, $0a, $58 + db $4a, $30, $80, $0a, $0a, $0a, $0a, $58 + db $4a, $2f, $7f, $0a, $0a, $0a, $0a, $58 + db $4a, $3d, $0a, $0a, $0a, $0a, $0a, $58 + db $4a, $30, $0a, $0a, $0a, $0a, $0a, $58 + db $4a, $2f, $68, $87, $88, $89, $0a, $58 + db $4a, $3d, $6e, $6f, $70, $75, $76, $58 + db $4a, $30, $75, $76, $5c, $5d, $5e, $58 + db $4a, $2f, $71, $72, $73, $74, $6d, $58 + db $4a, $3d, $75, $76, $77, $8a, $8b, $58 + db $4a, $30, $66, $67, $65, $0a, $6a, $58 + db $4a, $2f, $83, $84, $0a, $83, $84, $58 + db $4a, $3d, $0a, $85, $82, $84, $0a, $58 + db $4a, $30, $41, $80, $40, $0a, $0a, $58 + db $4a, $2f, $83, $0a, $0a, $0a, $0a, $58 + db $4a, $3d, $40, $0a, $0a, $0a, $0a, $58 + db $ff + +Unknown_11bb7d: + db $0a, $0a, $0a, $0a, $0a, $0a, $16, $00 + db $78, $0a, $0a, $0a, $0a, $0a, $8c, $00 + db $79, $0a, $0a, $0a, $0a, $0a, $8d, $00 + db $7a, $0a, $0a, $0a, $0a, $0a, $8e, $00 + db $7b, $0a, $0a, $0a, $0a, $0a, $8c, $00 + db $7c, $0a, $0a, $0a, $0a, $0a, $8d, $00 + db $7d, $0a, $0a, $0a, $0a, $0a, $8e, $00 + db $2e, $7e, $0a, $0a, $0a, $0a, $8c, $00 + db $2e, $80, $0a, $0a, $0a, $0a, $8d, $00 + db $2e, $81, $0a, $0a, $0a, $0a, $8e, $00 + db $2e, $82, $0a, $0a, $0a, $0a, $8c, $00 + db $2e, $69, $0a, $0a, $0a, $0a, $8d, $00 + db $2e, $6a, $0a, $0a, $0a, $0a, $8e, $00 + db $2e, $6b, $0a, $0a, $0a, $0a, $8c, $00 + db $2e, $0a, $68, $0a, $0a, $0a, $8d, $00 + db $2e, $0a, $69, $0a, $0a, $0a, $8e, $00 + db $2e, $0a, $0a, $6a, $0a, $0a, $8c, $00 + db $2e, $0a, $0a, $6b, $0a, $0a, $8d, $00 + db $2e, $0a, $0a, $0a, $80, $0a, $8e, $00 + db $2e, $0a, $0a, $0a, $82, $0a, $8c, $00 + db $2e, $0a, $0a, $0a, $6c, $0a, $8d, $00 + db $2e, $0a, $0a, $0a, $0a, $83, $8e, $00 + db $2e, $0a, $6b, $0a, $0a, $0a, $8c, $00 + db $2e, $0a, $0a, $69, $0a, $0a, $8d, $00 + db $2e, $0a, $0a, $6a, $0a, $0a, $8e, $00 + db $2e, $0a, $0a, $0a, $68, $0a, $8c, $00 + db $2e, $0a, $0a, $0a, $63, $0a, $8d, $00 + db $2e, $0a, $0a, $61, $62, $0a, $8e, $00 + db $2e, $0a, $0a, $0a, $5f, $60, $8c, $00 + db $2e, $0a, $0a, $0a, $63, $0a, $8d, $00 + db $2e, $0a, $0a, $0a, $0a, $69, $8c, $00 + db $2e, $0a, $0a, $0a, $0a, $6b, $8d, $00 + db $2e, $0a, $0a, $0a, $0a, $83, $8e, $00 + db $2e, $0a, $0a, $0a, $0a, $86, $8c, $00 + db $2e, $0a, $85, $0a, $0a, $0a, $8d, $00 + db $2e, $0a, $0a, $84, $0a, $0a, $8e, $00 + db $ff + + diff --git a/misc/mobile_5b.asm b/misc/mobile_5b.asm new file mode 100755 index 000000000..43cf8f987 --- /dev/null +++ b/misc/mobile_5b.asm @@ -0,0 +1,1236 @@ +Function16c000: ; 16c000 + ld a, [hCGB] + and a + ret z + ld a, [$ffea] + and a + ret z + ld a, [wcfbe] + push af + set 7, a + ld [wcfbe], a + call Function16c108 + callba Function100063 + callba Function100082 + call Function16c031 + callba Function1000a4 + xor a + ld [$ffea], a + pop af + ld [wcfbe], a + ret +; 16c031 + +Function16c031: ; 16c031 + xor a + ld [wJumptableIndex], a + ld [wcf64], a + ld [DefaultFlypoint], a + ld [wd003], a +.asm_16c03e + call DelayFrame + callba Function10635c + ld a, [DefaultFlypoint] + ld hl, Jumptable_16c05c + rst JumpTable + call Function16cb2e + call Function16cbae + ld a, [DefaultFlypoint] + cp $ff + jr nz, .asm_16c03e + ret +; 16c05c + +Jumptable_16c05c: ; 16c05c + dw Function16c074 + dw Function16c0ba + dw Function16c089 + dw Function16c09e + dw Function16c0a8 + dw Function16c0dc + dw Function16c0ec + dw Function16c0ba + dw Function16c0ca + dw Function16c0dc + dw Function16c0ec + dw Function16c081 +; 16c074 + +Function16c074: ; 16c074 + ld a, [wcf64] + and a + ret z + ld [DefaultFlypoint], a + xor a + ld [wd003], a + ret +; 16c081 + +Function16c081: ; 16c081 + push af + ld a, $ff + ld [DefaultFlypoint], a + pop af + ret +; 16c089 + +Function16c089: ; 16c089 + ld a, $1 + ld [Buffer2], a + ld [wd1f1], a + xor a + ld [hWY], a + call Function16c0fa + ld a, [DefaultFlypoint] + ld [wcf64], a + ret +; 16c09e + +Function16c09e: ; 16c09e + ld a, [wcf64] + cp $4 + ret nz + call Function16c0fa + ret +; 16c0a8 + +Function16c0a8: ; 16c0a8 + xor a + ld [Buffer2], a + ld [wd1f1], a + call ClearSprites + ld a, $90 + ld [hWY], a + call Function16c0fa + ret +; 16c0ba + +Function16c0ba: ; 16c0ba + call Function16c943 + push af + ld a, [wd003] + inc a + ld [wd003], a + pop af + call c, Function16c0fa + ret +; 16c0ca + +Function16c0ca: ; 16c0ca + ld a, [wd003] + cp $28 + push af + ld a, [wd003] + inc a + ld [wd003], a + pop af + call z, Function16c0fa + ret +; 16c0dc + +Function16c0dc: ; 16c0dc + call Function16ca11 + push af + ld a, [wd003] + inc a + ld [wd003], a + pop af + call c, Function16c0fa + ret +; 16c0ec + +Function16c0ec: ; 16c0ec + call WhiteBGMap + call ClearScreen + push af + ld a, $ff + ld [DefaultFlypoint], a + pop af + ret +; 16c0fa + +Function16c0fa: ; 16c0fa + push af + ld a, [DefaultFlypoint] + inc a + ld [DefaultFlypoint], a + xor a + ld [wd003], a + pop af + ret +; 16c108 + +Function16c108: ; 16c108 + call DisableLCD + ld hl, VTiles2 + ld de, GFX_16c173 + lb bc, BANK(GFX_16c173), $68 + call Get2bpp + call Function16c130 + call Function16c145 + call Function16c15c + ld hl, VBGMap0 + call Function16cc73 + call Function16cc02 + xor a + ld [hBGMapMode], a + call EnableLCD + ret +; 16c130 + +Function16c130: ; 16c130 + ld de, Unkn1Pals + ld hl, Unknown_16c903 + ld bc, 8 + ld a, $5 + call FarCopyWRAM + callba Function96a4 + ret +; 16c145 + +Function16c145: ; 16c145 + hlcoord 0, 0 + ld bc, 20 + xor a + call ByteFill + ld hl, Tilemap_16c633 + decoord 0, 1 + ld bc, $0154 + call CopyBytes + ret +; 16c15c + +Function16c15c: ; 16c15c + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH + xor a + call ByteFill + ld hl, Tilemap_16c79b + decoord 0, 1, AttrMap + ld bc, 17 * SCREEN_WIDTH + call CopyBytes + ret +; 16c173 + +GFX_16c173: +INCBIN "gfx/unknown/16c173.2bpp" + +Tilemap_16c633: +INCBIN "gfx/unknown/16c633.tilemap" + +Tilemap_16c79b: +INCBIN "gfx/unknown/16c79b.tilemap" + +Unknown_16c903: + RGB 31, 31, 31 + RGB 04, 10, 20 + RGB 16, 19, 25 + RGB 25, 27, 29 + + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + +; 16c943 + +Function16c943: ; 16c943 + ld a, [wd003] + and a + jr nz, .asm_16c95e + ld a, [rSVBK] + push af + ld a, $5 + ld [rSVBK], a + ld a, $ff + ld bc, $0008 + ld hl, Unkn1Pals + call ByteFill + pop af + ld [rSVBK], a + +.asm_16c95e + ld a, [rSVBK] + push af + ld a, $5 + ld [rSVBK], a + ld e, $0 + ld a, $0 +.asm_16c969 + ld hl, Unknown_16c903 + call Function16cab6 + call Function16cabb + ld d, a + ld hl, Unkn1Pals + call Function16cab6 + call Function16cabb + cp d + jr z, .asm_16c991 + ld b, $1 +.asm_16c981 + dec a + cp d + jr z, .asm_16c988 + dec b + jr nz, .asm_16c981 + +.asm_16c988 + ld hl, Unkn1Pals + call Function16cab6 + call Function16cadc + +.asm_16c991 + ld hl, Unknown_16c903 + call Function16cab6 + call Function16cad8 + ld d, a + ld hl, Unkn1Pals + call Function16cab6 + call Function16cad8 + cp d + jr z, .asm_16c9b9 + ld b, $1 +.asm_16c9a9 + dec a + cp d + jr z, .asm_16c9b0 + dec b + jr nz, .asm_16c9a9 + +.asm_16c9b0 + ld hl, Unkn1Pals + call Function16cab6 + call Function16cb08 + +.asm_16c9b9 + ld hl, Unknown_16c903 + call Function16cab6 + call Function16cac4 + ld d, a + ld hl, Unkn1Pals + call Function16cab6 + call Function16cac4 + cp d + jr z, .asm_16c9e1 + ld b, $1 +.asm_16c9d1 + dec a + cp d + jr z, .asm_16c9d8 + dec b + jr nz, .asm_16c9d1 + +.asm_16c9d8 + ld hl, Unkn1Pals + call Function16cab6 + call Function16cae8 + +.asm_16c9e1 +rept 2 + inc e +endr + ld a, e + cp $8 + jr nz, .asm_16c969 + callba Function96a4 + call SetPalettes + ld a, [rSVBK] + push af + ld a, $1 + ld [rSVBK], a + ld a, [wd003] + cp $1f + jr z, .asm_16ca09 + pop af + ld [rSVBK], a + ld e, $0 + pop af + ld [rSVBK], a + and a + ret + +.asm_16ca09 + pop af + ld [rSVBK], a + pop af + ld [rSVBK], a + scf + ret +; 16ca11 + +Function16ca11: ; 16ca11 + ld a, [wd003] + and a + jr nz, .asm_16ca1d + callba Function96a4 + +.asm_16ca1d + ld a, [rSVBK] + push af + ld a, $5 + ld [rSVBK], a + ld e, $0 + ld a, $0 +.asm_16ca28 + ld hl, Unkn1Pals + call Function16cab6 + call Function16cabb + cp $1f + jr z, .asm_16ca48 + ld b, $1 +.asm_16ca37 + inc a + cp $1f + jr z, .asm_16ca3f + dec b + jr nz, .asm_16ca37 + +.asm_16ca3f + ld hl, Unkn1Pals + call Function16cab6 + call Function16cadc + +.asm_16ca48 + ld hl, Unkn1Pals + call Function16cab6 + call Function16cad8 + cp $1f + jr z, .asm_16ca68 + ld b, $1 +.asm_16ca57 + inc a + cp $1f + jr z, .asm_16ca5f + dec b + jr nz, .asm_16ca57 + +.asm_16ca5f + ld hl, Unkn1Pals + call Function16cab6 + call Function16cb08 + +.asm_16ca68 + ld hl, Unkn1Pals + call Function16cab6 + call Function16cac4 + cp $1f + jr z, .asm_16ca88 + ld b, $1 +.asm_16ca77 + inc a + cp $1f + jr z, .asm_16ca7f + dec b + jr nz, .asm_16ca77 + +.asm_16ca7f + ld hl, Unkn1Pals + call Function16cab6 + call Function16cae8 + +.asm_16ca88 +rept 2 + inc e +endr + ld a, e + cp $8 + jr nz, .asm_16ca28 + callba Function96a4 + call SetPalettes + ld a, [rSVBK] + push af + ld a, $1 + ld [rSVBK], a + ld a, [wd003] + cp $1f + jr z, .asm_16caae + pop af + ld [rSVBK], a + pop af + ld [rSVBK], a + and a + ret + +.asm_16caae + pop af + ld [rSVBK], a + pop af + ld [rSVBK], a + scf + ret +; 16cab6 + +Function16cab6: ; 16cab6 + ld b, $0 + ld c, e + add hl, bc + ret +; 16cabb + +Function16cabb: ; 16cabb + inc hl + ld a, [hl] + srl a + srl a + and $1f + ret +; 16cac4 + +Function16cac4: ; 16cac4 + inc hl + ld a, [hld] + and $3 + ld b, a + ld a, [hl] + sla a + rl b + sla a + rl b + sla a + rl b + ld a, b + ret +; 16cad8 + +Function16cad8: ; 16cad8 + ld a, [hl] + and $1f + ret +; 16cadc + +Function16cadc: ; 16cadc + sla a + sla a + ld b, a + inc hl + ld a, [hl] + and $83 + or b + ld [hl], a + ret +; 16cae8 + +Function16cae8: ; 16cae8 + ld c, a + srl a + srl a + srl a + ld b, a + inc hl + ld a, [hl] + and $fc + or b + ld [hld], a + ld a, c + sla a + sla a + sla a + sla a + sla a + ld b, a + ld a, [hl] + and $1f + or b + ld [hl], a + ret +; 16cb08 + +Function16cb08: ; 16cb08 + ld b, a + ld a, [hl] + and $e0 + or b + ld [hl], a + ret +; 16cb0f + +Function16cb0f: ; 16cb0f + xor a + ld [Buffer1], a + ld [Buffer2], a + xor a + ld [wd1ec], a + ld a, $70 + ld [wd1ee], a + ld a, $4 + ld [wd1ed], a + ld a, $a0 + ld [wd1ef], a + xor a + ld [wd1f0], a + ret +; 16cb2e + +Function16cb2e: ; 16cb2e + ld a, [Buffer2] + and a + ret z + call Function16cb40 + ld hl, Unknown_16cb86 + ld de, Sprites + call Function16cb5d + ret +; 16cb40 + +Function16cb40: ; 16cb40 + ld hl, wd1ec + inc [hl] + ld a, [hl] + cp $18 + ret c + xor a + ld [hl], a + ld a, [wd1ef] + cp $a0 + jr nz, .asm_16cb57 + ld a, $a7 + ld [wd1ef], a + ret + +.asm_16cb57 + ld a, $a0 + ld [wd1ef], a + ret +; 16cb5d + +Function16cb5d: ; 16cb5d + ld a, [hli] + and a + ret z +.asm_16cb60 + push af + ld a, [wd1ee] + add [hl] + add $10 + ld [de], a + inc hl + inc de + ld a, [wd1ed] + add [hl] + add $8 + ld [de], a + inc hl + inc de + ld a, [wd1ef] + add [hl] + ld [de], a + inc hl + inc de + ld a, [wd1f0] + or [hl] + ld [de], a + inc hl + inc de + pop af + dec a + jr nz, .asm_16cb60 + ret +; 16cb86 + +Unknown_16cb86: + db 7 + db 0, 0, 0, 1 + db 8, 0, 1, 1 + db 8, 8, 2, 0 + db 8, 16, 3, 0 + db 16, 0, 4, 1 + db 16, 8, 5, 0 + db 16, 16, 6, 0 +; 16cba3 + +Function16cba3: ; 16cba3 + xor a + ld [wd1f1], a + ld [wd1f2], a + ld [wd1f3], a + ret +; 16cbae + +Function16cbae: ; 16cbae + ld a, [wd1f1] + and a + ret z + call Function16cbba + call Function16cbd1 + ret +; 16cbba + +Function16cbba: ; 16cbba + ld hl, wd1f2 + inc [hl] + ld a, [hl] + cp $c + ret c + xor a + ld [hl], a + ld a, [wd1f3] + inc a + cp $4 + jr c, .asm_16cbcd + xor a + +.asm_16cbcd + ld [wd1f3], a + ret +; 16cbd1 + +Function16cbd1: ; 16cbd1 + ld a, [wd1f3] + ld c, a + ld b, 0 + ld hl, Unknown_16cbfb + add hl, bc + ld a, [hl] + ld bc, $0002 + ld hl, Unknown_16cfa3 + call AddNTimes + ld de, wd00c + ld bc, $0002 + ld a, $5 + call FarCopyWRAM + callba Function96a4 + ld a, $1 + ld [hCGBPalUpdate], a + ret +; 16cbfb + +Unknown_16cbfb: + db 0, 1, 2, 1, 0, 1, 2 +; 16cc02 + +Function16cc02: ; 16cc02 + call Function16cc18 + call Function16cc49 + call Function16cc62 + call Function16cc25 + call Function16cc6e + call Function16cb0f + call Function16cba3 + ret +; 16cc18 + +Function16cc18: ; 16cc18 + ld hl, VTiles1 + ld de, GFX_16cca3 + lb bc, BANK(GFX_16cca3), $2e + call Get2bpp + ret +; 16cc25 + +Function16cc25: ; 16cc25 + ld hl, Unknown_16cfa9 + ld de, wd008 + call Function16cc41 + ld hl, Unknown_16cfb1 + ld de, Unkn2Pals + call Function16cc41 + ld hl, Unknown_16cfb9 + ld de, wd048 + call Function16cc41 + ret +; 16cc41 + +Function16cc41: ; 16cc41 + ld bc, $0008 + ld a, $5 + jp FarCopyWRAM +; 16cc49 + +Function16cc49: ; 16cc49 + hlcoord 4, 15 + ld a, $80 + call Function16cc5a + hlcoord 4, 16 + ld a, $90 + call Function16cc5a + ret +; 16cc5a + +Function16cc5a: ; 16cc5a + ld c, $10 +.asm_16cc5c + ld [hli], a + inc a + dec c + jr nz, .asm_16cc5c + ret +; 16cc62 + +Function16cc62: ; 16cc62 + hlcoord 0, 15, AttrMap + ld bc, $0028 + ld a, $1 + call ByteFill + ret +; 16cc6e + +Function16cc6e: ; 16cc6e + ld hl, VBGMap1 + jr Function16cc73 + +Function16cc73: + ld a, [rVBK] + push af + ld a, $0 + ld [rVBK], a + push hl + decoord 0, 0 + call Function16cc90 + pop hl + ld a, $1 + ld [rVBK], a + decoord 0, 0, AttrMap + call Function16cc90 + pop af + ld [rVBK], a + ret +; 16cc90 + +Function16cc90: ; 16cc90 + ld bc, $1214 +.asm_16cc93 + push bc +.asm_16cc94 + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .asm_16cc94 + ld bc, $000c + add hl, bc + pop bc + dec b + jr nz, .asm_16cc93 + ret +; 16cca3 + +GFX_16cca3: +INCBIN "gfx/unknown/16cca3.2bpp" + +Unknown_16cfa3: + RGB 31, 31, 31 + RGB 25, 27, 29 + RGB 16, 19, 25 + +Unknown_16cfa9: + RGB 31, 31, 31 + RGB 25, 27, 29 + RGB 31, 31, 31 + RGB 07, 07, 07 + + +Unknown_16cfb1: + RGB 31, 31, 31 + RGB 13, 09, 18 + RGB 26, 21, 16 + RGB 07, 07, 07 + + +Unknown_16cfb9: + RGB 31, 31, 31 + RGB 18, 05, 02 + RGB 27, 11, 12 + RGB 07, 07, 07 + +; 16cfc1 + +GFX_16cfc1: +INCBIN "gfx/unknown/16cfc1.2bpp" + +Function16d421: ; 16d421 + ld de, GFX_16cfc1 + ld hl, VTiles2 + lb bc, BANK(GFX_16cfc1), $46 + call Get2bpp + ret +; 16d42e + +Function16d42e: ; 16d42e + ld hl, Tilemap_16d465 + decoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + call CopyBytes + ret +; 16d43b + +Function16d43b: ; 16d43b + call LoadMenuDataHeader_0x1d75 + call WhiteBGMap + call ClearTileMap + call ClearSprites + callba Function16d421 + callba Function16d42e + ld b, $8 + call GetSGBLayout + call SetPalettes + call WaitBGMap + call JoyWaitAorB + call Call_ExitMenu + ret +; 16d465 + +Tilemap_16d465: +INCBIN "gfx/unknown/16d465.tilemap" + +Tilemap_16d5cd: +INCBIN "gfx/unknown/16d5cd.tilemap" + +Tilemap_16d5f5: +INCBIN "gfx/unknown/16d5f5.tilemap" + +Function16d61d: ; 16d61d + ld h, d + ld l, e + push bc + push hl + call Function16d640 + pop hl + pop bc + ld de, AttrMap - TileMap + add hl, de +rept 2 + inc b +endr +rept 2 + inc c +endr + ld a, $7 +.asm_16d630 + push bc + push hl +.asm_16d632 + ld [hli], a + dec c + jr nz, .asm_16d632 + pop hl + ld de, $0014 + add hl, de + pop bc + dec b + jr nz, .asm_16d630 + ret +; 16d640 + +Function16d640: ; 16d640 + push hl + ld a, $30 + ld [hli], a + inc a + call Function16d66d + inc a + ld [hl], a + pop hl + ld de, $0014 + add hl, de +.asm_16d64f + push hl + ld a, $33 + ld [hli], a + ld a, $7f + call Function16d66d + ld [hl], $34 + pop hl + ld de, $0014 + add hl, de + dec b + jr nz, .asm_16d64f + ld a, $35 + ld [hli], a + ld a, $36 + call Function16d66d + ld [hl], $37 + ret +; 16d66d + +Function16d66d: ; 16d66d + ld d, c +.asm_16d66e + ld [hli], a + dec d + jr nz, .asm_16d66e + ret +; 16d673 + +Function16d673: ; 16d673 + call Function16d696 + call Function16d6ae + callba Function49856 + callba Functionfb60d + hlcoord 10, 17 + ld de, String_16d68f + call PlaceString + ret +; 16d68f + +String_16d68f: ; 16d68f + db "CANCEL@" +; 16d696 + +Function16d696: ; 16d696 + call Function16d421 + ret +; 16d69a + + +Function16d69a: ; 16d69a + ld de, GFX_16cfc1 + $300 + ld hl, VTiles2 tile $76 + lb bc, BANK(GFX_16cfc1), 8 + call Get2bpp + ret +; 16d6a7 + +Function16d6a7: ; 16d6a7 + callba Function49811 + ret +; 16d6ae + +Function16d6ae: ; 16d6ae + call Function16d42e + ld hl, Tilemap_16d5cd + decoord 0, 0 + ld bc, $0028 + call CopyBytes + ld hl, Tilemap_16d5f5 + decoord 0, 16 + ld bc, $0028 + call CopyBytes + ret +; 16d6ca + +Function16d6ca: ; 16d6ca + call Function16d61d + ret +; 16d6ce + +Function16d6ce: ; 16d6ce + call LoadMenuDataHeader_0x1d75 + call Function16d6e1 + callba Function87d + call Call_ExitMenu + call Function3200 + ret +; 16d6e1 + +Function16d6e1: ; 16d6e1 + hlcoord 4, 10 + ld b, $1 + ld c, $a + predef Function28eef + hlcoord 5, 11 + ld de, String_16d701 + call PlaceString + call WaitBGMap + call Function3200 + ld c, $32 + jp DelayFrames +; 16d701 + +String_16d701: ; 16d701 + db "WAITING..!@" +; 16d70c + +Function16d70c: ; 16d70c + call Function16d725 + call Function16d713 + ret +; 16d713 + +Function16d713: ; 16d713 + push bc + push af + ld a, [hJoyLast] + and $f0 + ld b, a + ld a, [hJoyPressed] + and $f + or b + ld b, a + pop af + ld a, b + pop bc + ld d, a + ret +; 16d725 + +Function16d725: ; 16d725 + ld hl, wcfa6 + res 7, [hl] + ld a, [hBGMapMode] + push af + call Function16d734 + pop af + ld [hBGMapMode], a + ret +; 16d734 + +Function16d734: ; 16d734 +.asm_16d734 + call Function16d77a + call Function16d759 + call Function16d76a + jr nc, .asm_16d758 + callba Function24270 + jr c, .asm_16d758 + ld a, [wcfa5] + bit 7, a + jr nz, .asm_16d758 + call Function16d713 + ld b, a + ld a, [wcfa8] + and b + jr z, .asm_16d734 + +.asm_16d758 + ret +; 16d759 + +Function16d759: ; 16d759 + ld a, [hOAMUpdate] + push af + ld a, $1 + ld [hOAMUpdate], a + call WaitBGMap + pop af + ld [hOAMUpdate], a + xor a + ld [hBGMapMode], a + ret +; 16d76a + +Function16d76a: ; 16d76a +.asm_16d76a + call RTC + call Function16d7e7 + ret c + ld a, [wcfa5] + bit 7, a + jr z, .asm_16d76a + and a + ret +; 16d77a + +Function16d77a: ; 16d77a + ld hl, wcfac + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [hl] + cp $1f + jr nz, .asm_16d792 + ld a, [wcfab] + ld [hl], a + push hl + push bc + ld bc, $000b + add hl, bc + ld [hl], a + pop bc + pop hl + +.asm_16d792 + ld a, [wcfa1] + ld b, a + ld a, [wcfa2] + ld c, a + call GetTileCoord + ld a, [wcfa7] + swap a + and $f + ld c, a + ld a, [wcfa9] + ld b, a + xor a + dec b + jr z, .asm_16d7b1 +.asm_16d7ad + add c + dec b + jr nz, .asm_16d7ad + +.asm_16d7b1 + ld c, $14 + call AddNTimes + ld a, [wcfa7] + and $f + ld c, a + ld a, [wcfaa] + ld b, a + xor a + dec b + jr z, .asm_16d7c8 +.asm_16d7c4 + add c + dec b + jr nz, .asm_16d7c4 + +.asm_16d7c8 + ld c, a + add hl, bc + ld a, [hl] + cp $1f + jr z, .asm_16d7de + ld [wcfab], a + ld [hl], $1f + push hl + push bc + ld bc, $000b + add hl, bc + ld [hl], $1f + pop bc + pop hl + +.asm_16d7de + ld a, l + ld [wcfac], a + ld a, h + ld [wcfad], a + ret +; 16d7e7 + +Function16d7e7: ; 16d7e7 + ld a, [wcfa5] + bit 6, a + jr z, .asm_16d7f4 + callba Function8cf62 + +.asm_16d7f4 + call JoyTextDelay + call Function16d713 + and a + ret z + scf + ret +; 16d7fe + + diff --git a/misc/mobile_5c.asm b/misc/mobile_5c.asm new file mode 100755 index 000000000..50c064c9c --- /dev/null +++ b/misc/mobile_5c.asm @@ -0,0 +1,2592 @@ +Function170000: ; 170000 + ld a, [$c62b] + ld [$c6d0], a + ld hl, $c62e + ld de, $c6e7 + ld bc, $0005 + call CopyBytes + ld a, $50 + ld [de], a + ld hl, $c663 + ld de, $c6f2 + ld bc, $0005 + call CopyBytes + ld a, $50 + ld [de], a + ld hl, $c648 + ld a, [hli] + ld [$c6fd], a + ld a, [hl] + ld [$c6fe], a + ld hl, $c639 + ld a, [hli] + ld [$c6ff], a + ld a, [hl] + ld [wc700], a + ld bc, $c633 + callba GetCaughtGender + ld a, c + ld [wc701], a + ld a, [wcd81] + ld [wc74e], a + ld hl, $c608 + ld de, $d800 + ld bc, $008f + call CopyBytes + ret +; 17005a + +Function17005a: ; 17005a + ld a, $5 + call GetSRAMBank + ld a, [$a824] + ld [wc702], a + ld hl, $a827 + ld de, wc719 + ld bc, $0005 + call CopyBytes + ld a, $50 + ld [de], a + ld hl, $a85c + ld de, wc724 + ld bc, $0005 + call CopyBytes + ld a, $50 + ld [de], a + ld hl, $a841 + ld a, [hli] + ld [wc72f], a + ld a, [hl] + ld [wc730], a + ld hl, $a832 + ld a, [hli] + ld [wc731], a + ld a, [hl] + ld [wc732], a + ld bc, $a82c + callba GetCaughtGender + ld a, c + ld [wc733], a + ld a, [wcd81] + ld [wc74e], a + call CloseSRAM + ret +; 1700b0 + +Function1700b0: ; 1700b0 + call Function17021e + callba Function118121 + ret +; 1700ba + +Function1700ba: ; 1700ba + call Function17021e + callba Function11811a + ret +; 1700c4 + +Function1700c4: ; 1700c4 + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + call Function17042c + ld a, $5 + call GetSRAMBank + ld a, $1 + ld [$be45], a + xor a + ld [$be46], a + ld hl, $dffc + ld de, $aa41 + ld bc, $0004 + call CopyBytes + ld hl, $d202 + ld de, $aa8e + ld bc, $0594 + call CopyBytes + ld hl, $aa5d + ld a, [hl] + inc [hl] + inc hl + sla a + sla a + ld e, a + ld d, $0 + add hl, de + ld e, l + ld d, h + ld hl, $dffc + ld bc, $0004 + call CopyBytes + call CloseSRAM + pop af + ld [rSVBK], a + ret +; 170114 + +Function170114: ; 170114 + call Function17021e + call Function170121 + callba Function11805f + ret +; 170121 + +Function170121: ; 170121 + ld a, $5 + call GetSRAMBank + ld hl, $a948 + ld de, $c608 + ld bc, $00f6 + call CopyBytes + call CloseSRAM + call Function170c8b + ret +; 170139 + +Function170139: ; 170139 + ld a, $5 + call GetSRAMBank + ld de, $aa41 + ld h, $0 + ld l, h + ld bc, $03e8 + call Function17020c + ld bc, $0064 + call Function17020c + ld bc, $000a + call Function17020c + ld a, [de] + ld c, a + ld b, $0 + add hl, bc + call CloseSRAM + ld a, h + ld [$c608], a + ld a, l + ld [$c608 + 1], a + ld hl, $c628 + ld a, [PlayerID] + ld [hli], a + ld a, [PlayerID + 1] + ld [hli], a + ld a, [wSecretID] + ld [hli], a + ld a, [wSecretID + 1] + ld [hli], a + ld e, l + ld d, h + ld hl, PlayerName + ld bc, $0005 + call CopyBytes + ld bc, PlayerID + ld de, PlayerGender + callba Function4e929 + ld de, $c62c + 5 + ld a, c + ld [de], a + inc de + ld a, $df + ld [wcd49], a + ld a, $dc + ld [wcd4a], a + ld a, $41 + ld [wcd4b], a + ld a, $de + ld [wcd4c], a + ld a, $3 +.asm_1701ac + push af + ld a, [wcd49] + ld l, a + ld a, [wcd4a] + ld h, a + ld bc, $0030 + call CopyBytes + ld a, l + ld [wcd49], a + ld a, h + ld [wcd4a], a + ld a, [wcd4b] + ld l, a + ld a, [wcd4c] + ld h, a + ld bc, $0006 + call CopyBytes + ld a, l + ld [wcd4b], a + ld a, h + ld [wcd4c], a + pop af + dec a + jr nz, .asm_1701ac + ld a, $4 + call GetSRAMBank + ld hl, $a013 + ld bc, $0024 + call CopyBytes + call CloseSRAM + ld a, $5 + call GetSRAMBank + ld hl, $a894 + ld bc, $0006 + call CopyBytes + ld hl, $c608 + ld de, $a948 + ld bc, $00f6 + call CopyBytes + call CloseSRAM + ret +; 17020c + +Function17020c: ; 17020c + ld a, [de] + inc de + and a + ret z +.asm_170210 + add hl, bc + dec a + jr nz, .asm_170210 + ret +; 170215 + +BattleTowerBattle: ; 170215 + xor a + ld [wJumptableIndex], a + call Function17022c + ret +; 17021d + +Function17021d: ; 17021d + ret +; 17021e + +Function17021e: ; 17021e + xor a + ld [wJumptableIndex], a + ld [wcf64], a + ld [wcf65], a + ld [wcf66], a + ret +; 17022c + +Function17022c: ; 17022c +.loop + call Jumpto_BattleTowerBattleFunction + call DelayFrame + ld a, [wJumptableIndex] + cp $1 + jr nz, .loop + ret +; 17023a + +Jumpto_BattleTowerBattleFunction: ; 17023a + ld a, [wJumptableIndex] + ld e, a + ld d, 0 + ld hl, Jumptable_BattleTowerBattleFunctions +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 170249 + +Jumptable_BattleTowerBattleFunctions: ; 170249 + dw RunBattleTowerBattle + dw SkipBattleTowerBattle +; 17024d + +RunBattleTowerBattle: ; 17024d + ld a, [Options] + push af + ld hl, Options + set 6, [hl] + ld a, [InBattleTowerBattle] + push af + or $1 + ld [InBattleTowerBattle], a + xor a + ld [wLinkMode], a + callba Mobile_HealParty + callba HealParty + call Function1702b7 + call Function170bf7 + predef StartBattle + callba LoadPokemonData + callba HealParty + ld a, [wBattleResult] + ld [ScriptVar], a + and a + jr nz, .lost + ld a, BANK(sNrOfBeatenBattleTowerTrainers) + call GetSRAMBank + ld a, [sNrOfBeatenBattleTowerTrainers] + ld [wNrOfBeatenBattleTowerTrainers], a ; wcf64 + call CloseSRAM + ld hl, StringBuffer3 + ld a, [wNrOfBeatenBattleTowerTrainers] ; wcf64 + add $f7 + ld [hli], a + ld a, $50 + ld [hl], a + +.lost + pop af + ld [InBattleTowerBattle], a + pop af + ld [Options], a + ld a, $1 + ld [wJumptableIndex], a + ret + + +Function1702b7: ; 1702b7 +; Initialise the BattleTower-Trainer and his Pkmn + call CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy + ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643 + ld c, PKMN_NAME_LENGTH + callba Function17d073 + jr nc, .asm_1702db + + ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1] + ld [wd265], a + call GetPokemonName + ld l, e + ld h, d + ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn1Name ; $c643 + ld bc, PKMN_NAME_LENGTH + call CopyBytes + +.asm_1702db + ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e + ld c, PKMN_NAME_LENGTH + callba Function17d073 + jr nc, .asm_1702fc + ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2] ; [$c64e] + ld [wd265], a + call GetPokemonName + ld l, e + ld h, d + ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn2Name ; $c67e + ld bc, PKMN_NAME_LENGTH + call CopyBytes + +.asm_1702fc + ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9 + ld c, PKMN_NAME_LENGTH + callba Function17d073 + jr nc, .asm_17031d + ld a, [wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3] ; [$c689] + ld [wd265], a + call GetPokemonName + ld l, e + ld h, d + ld de, wBT_OTTempCopy + wBT_OTTempCopy_Pkmn3Name ; $c686 + 51 = $c6b9 + ld bc, PKMN_NAME_LENGTH + call CopyBytes + +.asm_17031d + ld a, $50 + ld [wBT_OTTempCopy + wBT_OTTempCopy_45], a ; $c64d + ld [wBT_OTTempCopy + wBT_OTTempCopy_80], a ; $c688 + ld [wBT_OTTempCopy + wBT_OTTempCopy_BB], a ; $c68a + 57 = $c6c3 + call Function170c98 + ld de, wBT_OTTempCopy + ld c, $a + callba Function17d073 + jr nc, .asm_17033d + ld hl, String_170426 + jr .asm_170340 + +.asm_17033d + ld hl, wBT_OTTempCopy ; 0xc608 + +.asm_170340 + ld de, wd26b + ld bc, $000a + call CopyBytes + ld a, $50 + ld [de], a + ld hl, wBT_OTTempCopy + wBT_OTTempCopy_TrainerClass + ld a, [hli] + ld [OtherTrainerClass], a + ld a, $ea + ld [BGMapBuffer], a + ld a, $d3 + ld [wcd21], a + + ; Copy Pkmn into Memory from the address in hl + ld de, OTPartyMon1Species + ld bc, OTPartyCount + ld a, BATTLETOWER_NROFPKMNS ; Number of Pkmn the BattleTower-Trainer has + ld [bc], a + inc bc +.asm_170367 + push af + ld a, [hl] + ld [bc], a + inc bc + push bc + ld bc, party_struct_length + call CopyBytes + push de + ld a, [BGMapBuffer] + ld e, a + ld a, [wcd21] + ld d, a + ld bc, $000b + call CopyBytes + ld a, e + ld [BGMapBuffer], a + ld a, d + ld [wcd21], a + pop de + pop bc + pop af + dec a + and a + jr nz, .asm_170367 + ld a, $ff + ld [bc], a + ret +; 170394 + +Function170394: ; 170394 + ld hl, $c608 + 11 + ld d, $3 +.asm_170399 + push de + push hl + ld b, h + ld c, l + ld a, [hl] + and a + jr z, .asm_1703b1 + cp $ff + jr z, .asm_1703b1 + cp $fe + jr z, .asm_1703b1 + cp $fd + jr z, .asm_1703b1 + cp $fc + jr nz, .asm_1703b4 + +.asm_1703b1 + ld a, $eb + ld [hl], a + +.asm_1703b4 + ld [CurSpecies], a + call GetBaseData + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] + call CloseSRAM + ld e, a + ld hl, $001f + add hl, bc + ld a, [hl] + cp $2 + ld a, $2 + jr c, .asm_1703d6 + ld a, [hl] + cp e + jr c, .asm_1703d7 + ld a, e + +.asm_1703d6 + ld [hl], a + +.asm_1703d7 + ld [CurPartyLevel], a + ld hl, $0002 + add hl, bc + ld d, $3 + ld a, [hli] + and a + jr z, .asm_1703ea + cp $fc + jr nc, .asm_1703ea + jr .asm_1703f4 + +.asm_1703ea + dec hl + ld a, $1 + ld [hli], a + xor a +rept 2 + ld [hli], a +endr + ld [hl], a + jr .asm_1703ff + +.asm_1703f4 + ld a, [hl] + cp $fc + jr c, .asm_1703fb + ld [hl], $0 + +.asm_1703fb + inc hl + dec d + jr nz, .asm_1703f4 + +.asm_1703ff + ld hl, $0024 + add hl, bc + ld d, h + ld e, l + push hl + push de + ld hl, $000a + add hl, bc + ld b, $1 + predef CalcPkmnStats + pop de + pop hl +rept 2 + dec de +endr + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a + pop hl + ld bc, $003b + add hl, bc + pop de + dec d + jp nz, .asm_170399 + ret +; 170426 + +String_170426: ; 170426 + db "CHRIS@" +; 17042c + +Function17042c: ; 17042c + ld hl, OTPartyMon2ID + ld a, $7 +.asm_170431 + push af + push hl + ld c, $12 +.asm_170435 + ld a, [hli] + ld b, a + ld a, [hli] + and a + jr z, .asm_170451 + cp $f + jr nc, .asm_17045b + push hl + ld hl, Unknown_170470 + dec a + ld e, a + ld d, 0 + add hl, de + ld a, [hl] + pop hl + cp b + jr c, .asm_17045b + jr z, .asm_17045b + jr .asm_170456 + +.asm_170451 + ld a, b + cp $fc + jr nc, .asm_17045b + +.asm_170456 + dec c + jr nz, .asm_170435 + jr .asm_170466 + +.asm_17045b + pop de + push de + ld hl, Unknown_17047e + ld bc, $0024 + call CopyBytes + +.asm_170466 + pop hl + ld de, $00e0 + add hl, de + pop af + dec a + jr nz, .asm_170431 + ret +; 170470 + +Unknown_170470: + db $12, $24, $45, $45, $42, $42, $45, $42, $27, $27, $45, $27, $42, $24 + +Unknown_17047e: + db $03, $04, $05, $08 + db $03, $05, $0e, $06 + db $03, $02, $00, $00 + db $39, $07, $07, $04 + db $00, $05, $04, $07 + db $01, $05, $00, $00 + db $0f, $05, $14, $07 + db $05, $05, $11, $0c + db $0c, $06, $06, $04 + + +CopyBTTrainer_FromBT_OTrainer_TowBT_OTTempCopy: ; 1704a2 +; copy the BattleTower-Trainer data that lies at 'BT_OTrainer' to 'wBT_OTTempCopy' + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + ld hl, BT_OTrainer ; $d100 + ld de, wBT_OTTempCopy ; $c608 + ld bc, BT_OTrainerEnd - BT_OTrainer ; $e0 = $a + $1 + 3*$3b + $24 + ; = $a + $1 + BATTLETOWER_NROFPKMNS * (party_struct_length + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH + call CopyBytes + pop af + ld [rSVBK], a + ld a, BANK(s1_be45) + call GetSRAMBank + ld a, $2 + ld [s1_be45], a + ld hl, sNrOfBeatenBattleTowerTrainers + inc [hl] + call CloseSRAM +SkipBattleTowerBattle: ; 1704c9 + ret +; 1704ca + + +Function1704ca: ; 1704ca + ld a, [$be46] + cp $7 + jr c, .asm_1704d3 + ld a, $6 + +.asm_1704d3 + ld hl, $afce + ld de, -$e0 +.asm_1704d9 + and a + jr z, .asm_1704e0 + add hl, de + dec a + jr .asm_1704d9 + +.asm_1704e0 + ret +; 1704e1 + +Function1704e1: ; 1704e1 + call SpeechTextBox + call FadeToMenu + call Function17021e + call Function1704f1 + call Function2b3c + ret +; 1704f1 + +Function1704f1: ; 1704f1 + call WhiteBGMap + call ClearSprites + call ClearScreen +.asm_1704fa + call JoyTextDelay + ld a, [wJumptableIndex] + bit 7, a + jr nz, .asm_17050f + call Function170510 + callba Function104061 + jr .asm_1704fa + +.asm_17050f + ret +; 170510 + +Function170510: ; 170510 + ld a, [wJumptableIndex] + ld e, a + ld d, 0 + ld hl, Jumptable_17051f +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 17051f + +Jumptable_17051f: ; 17051f + dw Function170525 + dw Function170571 + dw Function170577 +; 170525 + +Function170525: ; 170525 + ld a, $5 + call GetSRAMBank + + ld hl, $a89c + ld de, StringBuffer3 + ld bc, $0016 + call CopyBytes + + ld hl, $a8b2 + ld de, $c608 + ld bc, $0096 + call CopyBytes + + call CloseSRAM + hlcoord 1, 1 + ld de, StringBuffer3 + call PlaceString + hlcoord 1, 3 + ld de, String_170676 + call PlaceString + hlcoord 4, 3 + ld de, StringBuffer4 + call PlaceString + hlcoord 8, 3 + ld de, String_17067a + call PlaceString + call Function1705b7 + call Function1705f0 + jr Function1705b2 + + +Function170571: + call SetPalettes + call Function1705b2 + + +Function170577: + ld hl, hJoyPressed + ld a, [hl] + and $1 + jr nz, .asm_1705ac + ld a, [hl] + and $2 + jr nz, .asm_1705ac + ld a, [hl] + and $40 + jr nz, .asm_17058f + ld a, [hl] + and $80 + jr nz, .asm_17059d + ret + +.asm_17058f + ld a, [wcf64] + and a + ret z + sub $f + ld [wcf64], a + call Function1705f0 + ret + +.asm_17059d + ld a, [wcf64] + cp $3c + ret z + add $f + ld [wcf64], a + call Function1705f0 + ret + +.asm_1705ac + ld hl, wJumptableIndex + set 7, [hl] + ret + +Function1705b2: + ld hl, wJumptableIndex + inc [hl] + ret +; 1705b7 + +Function1705b7: ; 1705b7 + hlcoord 0, 4 + ld a, $79 + ld [hli], a + ld c, $12 +.asm_1705bf + ld a, $7a + ld [hli], a + dec c + jr nz, .asm_1705bf + ld a, $7b + ld [hli], a + ld de, $0014 + ld c, $c +.asm_1705cd + ld a, $7c + ld [hl], a + add hl, de + dec c + jr nz, .asm_1705cd + ld a, $7d + ld [hli], a + ld c, $12 +.asm_1705d9 + ld a, $7a + ld [hli], a + dec c + jr nz, .asm_1705d9 + ld a, $7e + ld [hl], a + ld de, $ffec + add hl, de + ld c, $c +.asm_1705e8 + ld a, $7c + ld [hl], a + add hl, de + dec c + jr nz, .asm_1705e8 + ret +; 1705f0 + +Function1705f0: ; 1705f0 + call Function17064b + call Function17065d + ld a, $50 + ld [wcd4e], a + ld hl, $c608 + ld a, [wcf64] + ld c, a + xor a + ld b, a + add hl, bc + push hl + pop bc + hlcoord 1, 6 + ld a, $6 +.asm_17060c + push af + push hl + ld a, $3 +.asm_170610 + push af + ld de, wcd49 + ld a, [bc] + and a + jr z, .asm_170625 + ld a, $5 +.asm_17061a + push af + ld a, [bc] + ld [de], a + inc bc + inc de + pop af + dec a + jr nz, .asm_17061a + jr .asm_170631 + +.asm_170625 + ld a, $5 +.asm_170627 + push af + ld a, $e3 + ld [de], a + inc de + inc bc + pop af + dec a + jr nz, .asm_170627 + +.asm_170631 + ld de, wcd49 + push bc + call PlaceString + ld de, $0006 + add hl, de + pop bc + pop af + dec a + jr nz, .asm_170610 + pop hl + ld de, $0028 + add hl, de + pop af + dec a + jr nz, .asm_17060c + ret +; 17064b + +Function17064b: ; 17064b + hlcoord 1, 5 + xor a + ld b, $c +.asm_170651 + ld c, $12 +.asm_170653 + ld [hli], a + dec c + jr nz, .asm_170653 +rept 2 + inc hl +endr + dec b + jr nz, .asm_170651 + ret +; 17065d + +Function17065d: ; 17065d + ld a, [wcf64] + and a + jr z, .asm_170669 + hlcoord 18, 5 + ld a, $61 + ld [hl], a + +.asm_170669 + ld a, [wcf64] + cp $3c + ret z + hlcoord 18, 16 + ld a, $ee + ld [hl], a + ret +; 170676 + +String_170676: ; 170676 + db "ルーム@" +; 17067a + +String_17067a: ; 17067a + db "れきだいりーダーいちらん@" +; 170687 + +BattleTowerAction: ; 170687 + ld a, [ScriptVar] + 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] +; 170696 + + +.jumptable: ; 170696 (5c:4696) + dw Function17075f ; 0x00 + dw Function170788 ; 0x01 + dw Function170778 ; 0x02 + dw Function170799 ; 0x03 + dw Function17079d ; 0x04 + dw Function1707ac ; 0x05 + dw Function1707f4 ; 0x06 + dw Function170868 ; 0x07 + dw Function170881 ; 0x08 + dw Function17089a ; 0x09 + dw Function1708b1 ; 0x0a + dw Function1708b9 ; 0x0b + dw Function1708c8 ; 0x0c + dw Function1708f0 ; 0x0d + dw Function17093c ; 0x0e + dw Function1709aa ; 0x0f + dw Function1709bb ; 0x10 + dw Function170a9c ; 0x11 + dw Function170aa0 ; 0x12 + dw Function170aaf ; 0x13 + dw Function170abe ; 0x14 + dw Function170ad7 ; 0x15 + dw Function170807 ; 0x16 + dw Function17081d ; 0x17 + dw Function170ae8 ; 0x18 + dw Function170b16 ; 0x19 + dw ResetBattleTowerTrainersSRAM ; 0x1a + dw Function1706ee ; 0x1b + dw Function17071b ; 0x1c + dw Function170729 ; 0x1d + dw Function17073e ; 0x1e + dw Function170737 ; 0x1f + + +; Reset the save memory for BattleTower-Trainers (Counter and all 7 TrainerBytes) +ResetBattleTowerTrainersSRAM: ; 1706d6 (5c:46d6) BattleTowerAction $1a + ld a, BANK(sBTTrainers) + call GetSRAMBank + + ld a, $ff + ld hl, sBTTrainers + ld bc, BATTLETOWER_NROFTRAINERS + call ByteFill + + xor a + ld [sNrOfBeatenBattleTowerTrainers], a + + call CloseSRAM + + ret + +Function1706ee: ; 1706ee (5c:46ee) + ld a, BANK(sbe50) + call GetSRAMBank + + ld a, [sbe50] + call CloseSRAM + ld [ScriptVar], a + ld hl, NumItems + ld a, [hli] + cp $14 + ret c + ld b, $14 + ld a, [ScriptVar] + ld c, a +.asm_170709 + ld a, [hli] + cp c + jr nz, .asm_170711 + ld a, [hl] + cp $5f + ret c +.asm_170711 + inc hl + dec b + jr nz, .asm_170709 + ld a, $12 + ld [ScriptVar], a + ret + +Function17071b: ; 17071b (5c:471b) + ld a, BANK(s1_be45) + call GetSRAMBank + ld a, $3 + ld [s1_be45], a + call CloseSRAM + ret + +Function170729: ; 170729 (5c:4729) + ld a, BANK(s1_be45) + call GetSRAMBank + ld a, $4 + ld [s1_be45], a + call CloseSRAM + ret + +Function170737: ; 170737 (5c:4737) + callba SaveOptions + ret + +Function17073e: ; 17073e (5c:473e) + call Random + ld a, [hRandomAdd] ; $ff00+$e1 + and $7 + cp $6 + jr c, .asm_17074b + sub $6 +.asm_17074b + add $1a + cp $1e + jr z, Function17073e + push af + ld a, BANK(sbe50) + call GetSRAMBank + pop af + ld [sbe50], a + call CloseSRAM + ret + +Function17075f: ; 17075f (5c:475f) + call Function17089a + ld a, [ScriptVar] + and a + ret z + ld a, BANK(sbe4f) + call GetSRAMBank + ld a, [sbe4f] + and $2 + ld [ScriptVar], a + call CloseSRAM + ret + +Function170778: ; 170778 (5c:4778) + ld hl, s1_be45 + ld a, BANK(s1_be45) + call GetSRAMBank + ld a, [hl] + ld [ScriptVar], a + call CloseSRAM + ret + +Function170788: ; 170788 (5c:4788) + ld a, BANK(sbe4f) + call GetSRAMBank + ld a, [sbe4f] + or $2 + ld [sbe4f], a + call CloseSRAM + ret + +Function170799: ; 170799 (5c:4799) + ld c, $1 + jr asm_17079f + +Function17079d: ; 17079d (5c:479d) + ld c, $0 +asm_17079f: ; 17079f (5c:479f) + ld a, BANK(s1_be45) + call GetSRAMBank + ld a, c + ld [s1_be45], a + call CloseSRAM + ret + +Function1707ac: ; 1707ac (5c:47ac) + ld a, $5 + call GetSRAMBank + ld a, [$aa8c] + ld b, a + ld a, [$be46] + ld [ScriptVar], a + call CloseSRAM + and a + ret z + ld a, b + cp $2 + jr nc, .asm_1707ef + push bc + call UpdateTime + pop bc + ld a, $5 + call GetSRAMBank + ld a, [$aa8b] + call CloseSRAM + ld c, a + ld a, [CurDay] + sub c + jr c, .asm_1707e5 + cp $8 + jr nc, .asm_1707ef + ld a, b + and a + jr nz, .asm_1707ef + ret +.asm_1707e5 + ld hl, CurDay + ld a, $8c + sub c + add [hl] + cp $8 + ret c +.asm_1707ef + ld a, $8 + ld [ScriptVar], a + +Function1707f4: ; 1707f4 (5c:47f4) + ld a, $5 + call GetSRAMBank + xor a + ld [$be46], a + ld [$aa8b], a + ld [$aa8c], a + call CloseSRAM + ret + +Function170807: ; 170807 (5c:4807) + call UpdateTime + ld a, $5 + call GetSRAMBank + ld a, [CurDay] + ld [$b2f9], a + xor a + ld [$b2fa], a + call CloseSRAM + ret + +Function17081d: ; 17081d (5c:481d) + xor a + ld [ScriptVar], a + ld a, $5 + call GetSRAMBank + ld a, [$b2f9] + ld c, a + ld a, [$b2fa] + ld b, a + call CloseSRAM + cp $2 + jr nc, .asm_170853 + push bc + call UpdateTime + pop bc + ld a, [CurDay] + sub c + jr c, .asm_170849 + cp $b + jr nc, .asm_170853 + ld a, b + and a + jr nz, .asm_170853 + ret +.asm_170849 + ld hl, CurDay + ld a, $8c + sub c + add [hl] + cp $b + ret c +.asm_170853 + ld a, $1 + ld [ScriptVar], a + ld a, $5 + call GetSRAMBank + xor a + ld [$b2f9], a + ld [$b2fa], a + call CloseSRAM + ret + +Function170868: ; 170868 (5c:4868) + ld a, BANK(sbe47) + call GetSRAMBank + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, $3 + ld [rSVBK], a ; $ff00+$70 + ld a, [wd000 + $800] + ld [sbe47], a + pop af + ld [rSVBK], a ; $ff00+$70 + call CloseSRAM + ret + +Function170881: ; 170881 (5c:4881) + ld a, BANK(sbe47) + call GetSRAMBank + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, $3 + ld [rSVBK], a ; $ff00+$70 + ld a, [sbe47] + ld [wd000 + $800], a + pop af + ld [rSVBK], a ; $ff00+$70 + call CloseSRAM + ret + +Function17089a: ; 17089a + ld a, [wcfcd] + and a + jr z, .asm_1708ad + callba Function14bcb + jr z, .asm_1708ab + xor a + jr .asm_1708ad + +.asm_1708ab + ld a, $1 + +.asm_1708ad + ld [ScriptVar], a + ret +; 1708b1 + + +Function1708b1: ; 1708b1 (5c:48b1) + xor a + ld [MusicFade], a + call MaxVolume + ret + +Function1708b9: ; 1708b9 (5c:48b9) something to do with GS Ball + ld a, BANK(s1_be3c) + call GetSRAMBank + ld a, [s1_be3c] + ld [ScriptVar], a + call CloseSRAM + ret + +Function1708c8: ; 1708c8 (5c:48c8) + call UpdateTime + ld a, $5 + call GetSRAMBank + ld a, [CurDay] + ld [$aa8b], a + xor a + ld [$aa8c], a + ld a, [$aa5d] + cp $2 + jr nc, .asm_1708ec + ld a, [CurDay] + ld [$aa48], a + ld a, $1 + ld [$aa47], a +.asm_1708ec + call CloseSRAM + ret + +Function1708f0: ; 1708f0 (5c:48f0) + xor a + ld [ScriptVar], a + call UpdateTime + ld a, $5 + call GetSRAMBank + ld a, [$aa48] + ld c, a + ld a, [$aa47] + call CloseSRAM + and a + ret z + ld hl, CurDay + ld a, c + cp [hl] + jr nz, Function170923 + ld a, $5 + call GetSRAMBank + ld a, [$aa5d] + call CloseSRAM + cp $5 + ret c + ld a, $1 + ld [ScriptVar], a + ret + + +Function170923: ; 170923 + ld a, $5 + call GetSRAMBank + xor a + ld [$aa48], a + ld [$aa47], a + ld hl, $aa5d + ld bc, $0011 + call ByteFill + call CloseSRAM + ret +; 17093c + + +Function17093c: ; 17093c (5c:493c) + xor a + ld [ScriptVar], a + ld a, EGG_TICKET + ld [CurItem], a + ld hl, NumItems + call CheckItem + ret nc + ld a, [PartyCount] + ld b, 0 + ld c, a + ld hl, PartySpecies +.loop + ld a, [hli] + cp EGG + jr nz, .not_egg + push hl + ld hl, PartyMonOT ; wddff (aliases: PartyMonOT) + ld de, $6 + ld a, b + and a + jr z, .skip +.loop2 + add hl, de + dec a + jr nz, .loop2 +.skip + ld de, String_1709a4 + ld a, $6 +.asm_17096e + push af + ld a, [de] + inc de + cp [hl] + inc hl + jr nz, .asm_17099d + pop af + dec a + jr nz, .asm_17096e +rept 4 + dec hl +endr + ld a, $50 +rept 2 + ld [hli], a +endr + pop hl + ld a, EGG_TICKET + ld [CurItem], a + ld a, $1 + ld [wItemQuantityChangeBuffer], a + ld a, $ff + ld [wd107], a + ld hl, NumItems + call TossItem + ld a, $1 + ld [ScriptVar], a + ret + +.asm_17099d + pop af + pop hl +.not_egg + inc b + dec c + jr nz, .loop + ret +; 1709a4 (5c:49a4) + +String_1709a4: ; 1709a4 + db "なぞナゾ@@" + +Function1709aa: ; 1709aa (5c:49aa) + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, BANK(w3_d090) + ld [rSVBK], a ; $ff00+$70 + ld a, [w3_d090] + ld [ScriptVar], a + pop af + ld [rSVBK], a ; $ff00+$70 + ret + +Function1709bb: ; 1709bb (5c:49bb) + xor a + ld [ScriptVar], a + ld a, $5 + call GetSRAMBank + ld a, [$a800] + call CloseSRAM + cp 6 + jr nc, .invalid + ld e, a + ld d, 0 + ld hl, Jumptable_1709e7 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +.invalid + ld a, $5 + call GetSRAMBank + xor a + ld [$a800], a + call CloseSRAM + ret +; 1709e7 (5c:49e7) + +Jumptable_1709e7: ; 1709e7 + dw Function170a00 + dw Function170a00 + dw Function1709f3 + dw Function1709f3 + dw Function170a01 + dw Function170a33 +; 1709f3 + +Function1709f3: ; 1709f3 + ld a, $5 + call GetSRAMBank + ld a, $1 + ld [$a800], a + call CloseSRAM + +Function170a00: ; 170a00 + ret +; 170a01 + +Function170a01: ; 170a01 + ld a, $5 + call GetSRAMBank + ld hl, $b023 + ld de, $c608 + ld bc, $0069 + call CopyBytes + ld a, [$a825] + ld [wcd30], a + ld a, [$a826] + ld [wcd31], a + call CloseSRAM + callba Function11b6b4 + callba Function17d0f3 + ld a, $1 + ld [ScriptVar], a + ret +; 170a33 + +Function170a33: ; 170a33 + ld a, $0 + call GetSRAMBank + ld hl, wRTC + ld de, $c608 + ld bc, $0004 + call CopyBytes + call CloseSRAM + ld a, $5 + call GetSRAMBank + ld hl, $b08c + ld de, $c608 + ld c, $4 +.asm_170a54 + ld a, [de] + inc de + cp [hl] + jr nz, .asm_170a78 + inc hl + dec c + jr nz, .asm_170a54 + call CloseSRAM + ld a, [MapGroup] + ld b, a + ld a, [MapNumber] + ld c, a + call GetMapTrigger + ld a, d + or e + jr z, .asm_170a72 + ld a, [de] + and a + ret nz + +.asm_170a72 + ld a, $1 + ld [ScriptVar], a + ret + +.asm_170a78 + call CloseSRAM + ld a, $5 + call GetSRAMBank + xor a + ld [$a800], a + call CloseSRAM + ld [ScriptVar], a + ld a, [MapGroup] + ld b, a + ld a, [MapNumber] + ld c, a + call GetMapTrigger + ld a, d + or e + jr z, .asm_170a9b + xor a + ld [de], a + +.asm_170a9b + ret +; 170a9c + +Function170a9c: ; 170a9c (5c:4a9c) + ld c, $0 + jr asm_170aa2 + +Function170aa0: ; 170aa0 (5c:4aa0) + ld c, $1 +asm_170aa2: ; 170aa2 (5c:4aa2) + ld a, $5 + call GetSRAMBank + ld a, c + ld [$aa8d], a + call CloseSRAM + ret + +Function170aaf: ; 170aaf (5c:4aaf) + ld a, $5 + call GetSRAMBank + ld a, [$aa8d] + ld [ScriptVar], a + call CloseSRAM + ret + +Function170abe: ; 170abe (5c:4abe) + call Function17089a + ld a, [ScriptVar] + and a + ret z + ld a, BANK(sbe4f) + call GetSRAMBank + ld a, [sbe4f] + and $1 + ld [ScriptVar], a + call CloseSRAM + ret + +Function170ad7: ; 170ad7 (5c:4ad7) + ld a, BANK(sbe4f) + call GetSRAMBank + ld a, [sbe4f] + or $1 + ld [sbe4f], a + call CloseSRAM + ret + +Function170ae8: ; 170ae8 (5c:4ae8) + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] + call CloseSRAM + ld c, $a + call SimpleDivide + ld a, b + ld [wcd4f], a + xor a + ld [ScriptVar], a + callba Function119d93 + ret nc + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] + call CloseSRAM + ld [ScriptVar], a + ret + +Function170b16: ; 170b16 (5c:4b16) + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] + call CloseSRAM + ld c, 10 + call SimpleDivide + ld a, b + ld [wcd4f], a + xor a + ld [ScriptVar], a + callba Function119dd1 + ret nc + ld a, $5 + call GetSRAMBank + ld a, [$b2fb] + call CloseSRAM + ld [ScriptVar], a + ret + +Function_LoadOpponentTrainerAndPokemonsWithOTSprite: ; 0x170b44 + callba Function_LoadOpponentTrainerAndPokemons + ld a, [rSVBK] + push af + ld a, $3 + ld [rSVBK], a + ld hl, wd10a + ld a, [hl] + dec a + ld c, a + ld b, $0 + pop af + ld [rSVBK], a + ld hl, Unknown_170b90 + add hl, bc + ld a, [hl] + ld [wcd49], a + +; Load sprite of the opponent trainer +; because s/he is chosen randomly and appears out of nowhere + ld a, [ScriptVar] + dec a + sla a + ld e, a + sla a + sla a + sla a + ld c, a + ld b, $0 + ld d, $0 + ld hl, MapObjects + add hl, bc + inc hl + ld a, [wcd49] + ld [hl], a + ld hl, UsedSprites + add hl, de + ld [hli], a + ld [hUsedSpriteIndex], a + ld a, [hl] + ld [hUsedSpriteTile], a + callba Function143c8 + ret +; 170b90 + +Unknown_170b90: + db $12, $13, $14, $15, $18, $17 + db $16, $19, $04, $05, $11, $01 + db $1c, $1b, $21, $1e, $1a, $1d + db $1f, $3c, $20, $27, $27, $27 + db $28, $0a, $23, $24, $2a, $2b + db $35, $40, $2a, $29, $22, $25 + db $3a, $2b, $24, $49, $2b, $07 + db $2c, $2d, $4a, $0d, $4b, $3a + db $2b, $41, $35, $27, $28, $27 + db $36, $3e, $30, $2c, $2d, $3d + db $26, $2e, $06, $07, $43, $36 + +Function170bd2: ; 170bd2 + ret +; 170bd3 + +SpecialCheckForBattleTowerRules: ; 170bd3 + callba CheckForBattleTowerRules + jr c, .asm_170bde + xor a + jr .asm_170be0 + +.asm_170bde + ld a, $1 + +.asm_170be0 + ld [ScriptVar], a + ret +; 170be4 +Function170be4: ; 170be4 + ld a, $5 + call GetSRAMBank + xor a + ld hl, $a894 + ld bc, $0008 + call ByteFill + call CloseSRAM + ret +; 170bf7 + +Function170bf7: ; 170bf7 + ld a, $5 + call GetSRAMBank + ld hl, $a89a + xor a + ld [hli], a + ld [hl], a + call CloseSRAM + ret +; 170c06 + +Function170c06: ; 170c06 + ld a, $5 + call GetSRAMBank + ld hl, $a894 + ld a, [wBattleResult] + and a + jr nz, .asm_170c15 + inc [hl] + +.asm_170c15 +rept 2 + inc hl +endr + ld a, [$a89b] + add [hl] + ld [hld], a + ld a, [$a89a] + adc [hl] + ld [hli], a + jr nc, .asm_170c27 + ld a, $ff + ld [hld], a + ld [hli], a + +.asm_170c27 + inc hl + push hl + ld de, 0 + xor a + ld [wd265], a +.asm_170c30 + ld hl, PartyMon1HP + ld a, [wd265] + call GetPartyLocation + ld a, [hli] + ld b, a + ld c, [hl] +rept 2 + inc hl +endr + ld a, [hld] + sub c + ld c, a + ld a, [hl] + sbc b + ld b, a + push de + pop hl + add hl, bc + push hl + pop de + jr c, .asm_170c58 + ld a, [wd265] + inc a + ld [wd265], a + cp $3 + jr c, .asm_170c30 + jr .asm_170c5b + +.asm_170c58 + ld de, -1 + +.asm_170c5b + pop hl + inc hl + ld a, e + add [hl] + ld [hld], a + ld a, d + adc [hl] + ld [hli], a + jr nc, .asm_170c69 + ld a, $ff + ld [hld], a + ld [hli], a + +.asm_170c69 + inc hl + push hl + ld b, $0 + ld c, $0 +.asm_170c6f + ld hl, PartyMon1HP + ld a, b + push bc + call GetPartyLocation + pop bc + ld a, [hli] + or [hl] + jr nz, .asm_170c7d + inc c + +.asm_170c7d + inc b + ld a, b + cp $3 + jr c, .asm_170c6f + pop hl + ld a, [hl] + add c + ld [hl], a + call CloseSRAM + ret +; 170c8b + +Function170c8b: ; 170c8b + ld hl, LastPlayerCounterMove + ld b, $5 +.asm_170c90 + ld a, [hl] + xor $ff + ld [hli], a + dec b + jr nz, .asm_170c90 + ret +; 170c98 + +Function170c98: ; 170c98 + ld c, $3 + ld hl, $c608 + 13 +.asm_170c9d + push hl + ld a, [hl] + cp $fc + jr c, .asm_170ca6 + ld a, $1 + ld [hl], a + +.asm_170ca6 + inc hl + ld b, $3 +.asm_170ca9 + ld a, [hl] + and a + jr z, .asm_170cb1 + cp $fc + jr c, .asm_170cb9 + +.asm_170cb1 + xor a + ld [hl], a + inc hl + dec b + jr nz, .asm_170cb1 + jr .asm_170cbd + +.asm_170cb9 + inc hl + dec b + jr nz, .asm_170ca9 + +.asm_170cbd + pop hl + ld de, $003b + add hl, de + dec c + jr nz, .asm_170c9d + ret +; 170cc6 + +Function170cc6: ; 170cc6 + ld a, [rSVBK] + push af + ld a, $6 + ld [rSVBK], a + ld hl, LZ_170d16 + ld de, wd000 + call Decompress + ld a, $1 + ld [rVBK], a + ld de, wd000 + ld hl, VTiles0 + lb bc, $6, $c1 + call Get2bpp + xor a + ld [rVBK], a + ld hl, LZ_1715a4 + ld de, wd000 + call Decompress + ld de, Unkn1Pals + ld hl, VTiles0 + lb bc, $6, $53 + call Get2bpp + pop af + ld [rSVBK], a + ret +; 170d02 + +Function170d02: ; 170d02 + ld a, $1 + ld [rVBK], a + ld de, GFX_171848 + ld hl, VTiles1 tile $41 + lb bc, BANK(GFX_171848), $18 + call Get2bpp + xor a + ld [rVBK], a + ret +; 170d16 + +LZ_170d16: +INCBIN "gfx/unknown/170d16.2bpp.lz" + +LZ_1715a4: +INCBIN "gfx/unknown/1715a4.2bpp.lz" + +GFX_171848: +INCBIN "gfx/unknown/171848.2bpp" + +Function1719c8: ; 1719c8 (5c:59c8) + ld a, [hInMenu] + push af + ld a, $1 + ld [hInMenu], a + call Function1719d6 + pop af + ld [hInMenu], a + ret + +Function1719d6: ; 1719d6 (5c:59d6) + callba Function1183cb + call Function1719ed + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, $5 + ld [rSVBK], a ; $ff00+$70 + call Function171a11 + pop af + ld [rSVBK], a ; $ff00+$70 + ret + +Function1719ed: ; 1719ed (5c:59ed) + xor a + ld [wcd49], a + ld [wcd4a], a + dec a + ld [wcd4b], a + call WhiteBGMap + call ClearSprites + callba Function171d2b + callba Function104061 + callba Function8cf53 + ret + +Function171a11: ; 171a11 (5c:5a11) + call JoyTextDelay + ld a, [wcd49] + bit 7, a + jr nz, .asm_171a2c + call Function171a36 + callba Function8cf69 + callba Function104061 + jr Function171a11 +.asm_171a2c + callba Function8cf53 + call ClearSprites + ret + +Function171a36: ; 171a36 (5c:5a36) + ld a, [wcd49] + ld e, a + ld d, 0 + ld hl, Jumptable_171a45 +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] + +Jumptable_171a45: ; 171a45 (5c:5a45) + dw Function171a95 + dw Function171ac9 + dw Function171a5d + dw Function171ad7 + dw Function171a5d + dw Function171aec + dw Function171b4b + dw Function171b85 + dw Function171bcc + dw Function171c2c + dw Function171c39 + dw Function171c41 + + +Function171a5d: ; 171a5d (5c:5a5d) + ld a, [wc821] + bit 1, a + jr nz, .asm_171a6a + bit 0, a + ret nz + jp Function171c66 +.asm_171a6a + ld a, $0 + call Function3e32 + ld [wc300], a + ld a, l + ld [wc301], a + ld a, h + ld [wc302], a + ld a, $a + call Function3e32 + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, $1 + ld [rSVBK], a ; $ff00+$70 + callba Function118452 + pop af + ld [rSVBK], a ; $ff00+$70 + ld a, $a + ld [wcd49], a + ret + +Function171a95: ; 171a95 (5c:5a95) + callba Function171ccd + hlcoord 2, 8 + ld de, String_171aa7 + call PlaceString + jp Function171c66 +; 171aa7 (5c:5aa7) + +String_171aa7: ; 171aa7 + db "モバイルアダプタに" + next "せつぞく しています" + next "しばらく おまちください" + db "@" +; 171ac9 + +Function171ac9: ; 171ac9 (5c:5ac9) + ld de, wcd81 + ld hl, $5c + ld a, $2 + call Function3e32 + jp Function171c66 + +Function171ad7: ; 171ad7 (5c:5ad7) + xor a + ld hl, $c608 + ld bc, $66 + call ByteFill + ld de, $c608 + ld a, $c + call Function3e32 + jp Function171c66 + +Function171aec: ; 171aec (5c:5aec) + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, $1 + ld [rSVBK], a ; $ff00+$70 + callba Function118452 + pop af + ld [rSVBK], a ; $ff00+$70 + hlcoord 2, 6 + ld a, $8 +.asm_171b01 + push af + push hl + xor a + ld bc, $10 + call ByteFill + pop hl + ld de, $14 + add hl, de + pop af + dec a + jr nz, .asm_171b01 + hlcoord 2, 7 + ld a, $3 + ld de, $c608 +.asm_171b1b + push af + push hl + ld a, [de] + and a + jr z, .asm_171b34 + ld a, [wcd4b] + inc a + ld [wcd4b], a + push hl + call Function171b42 + pop hl + ld bc, $ffec + add hl, bc + call Function171b42 +.asm_171b34 + pop hl + ld bc, $14 +rept 3 + add hl, bc +endr + pop af + dec a + jr nz, .asm_171b1b + jp Function171c66 + +Function171b42: ; 171b42 (5c:5b42) + ld a, [de] + inc de + and a + ret z + sub $20 + ld [hli], a + jr Function171b42 + +Function171b4b: ; 171b4b (5c:5b4b) + lb de, $40, $10 + ld a, $1d + call Function3b2a + ld hl, $c + add hl, bc + ld a, $8 + ld [hl], a + lb de, $40, $98 + ld a, $1d + call Function3b2a + ld hl, $c + add hl, bc + ld a, $9 + ld [hl], a + lb de, $8a, $70 + ld a, $1d + call Function3b2a + ld hl, $c + add hl, bc + ld a, $a + ld [hl], a + ld a, $4 + ld [wcd23], a + ld a, $8 + ld [wcd24], a + jp Function171c66 + +Function171b85: ; 171b85 (5c:5b85) + ld hl, hJoyPressed ; $ffa7 + ld a, [hl] + and $2 + jp nz, Function171b9f + ld a, [hl] + and $1 + jp nz, Function171bbd + ld a, [hl] + and $40 + jr nz, asm_171ba5 + ld a, [hl] + and $80 + jr nz, asm_171baf + ret + +Function171b9f: ; 171b9f (5c:5b9f) + ld a, $80 + ld [wcd49], a + ret +asm_171ba5: ; 171ba5 (5c:5ba5) + ld a, [wcd4a] + and a + ret z + dec a + ld [wcd4a], a + ret +asm_171baf: ; 171baf (5c:5baf) + ld a, [wcd4b] + ld c, a + ld a, [wcd4a] + cp c + ret z + inc a + ld [wcd4a], a + ret + +Function171bbd: ; 171bbd (5c:5bbd) + call PlayClickSFX + ld a, $8 + ld [wcd23], a + xor a + ld [wcd24], a + jp Function171c66 + +Function171bcc: ; 171bcc (5c:5bcc) + ld hl, hJoyPressed ; $ffa7 + ld a, [hl] + and $2 + jp nz, Function171bdc + ld a, [hl] + and $1 + jp nz, Function171beb + ret + +Function171bdc: ; 171bdc (5c:5bdc) + ld a, $4 + ld [wcd23], a + ld a, $8 + ld [wcd24], a + ld hl, wcd49 + dec [hl] + ret + +Function171beb: ; 171beb (5c:5beb) + ld a, $5 + call GetSRAMBank + ld a, [wcd4a] + ld [$aa4a], a + call CloseSRAM + ld hl, MenuDataHeader_171c6b + call LoadMenuDataHeader + call Function1cbb + call GetMemTileCoord + callba Function104061 + hlcoord 1, 14 + ld de, String_171c73 + call PlaceString + ld a, [wcd4a] + cp $2 + jr z, .asm_171c1f + ld a, $8 + jr .asm_171c21 +.asm_171c1f + ld a, $c +.asm_171c21 + ld [wcd24], a + ld a, $1e + ld [wcd4c], a + call Function171c66 + +Function171c2c: ; 171c2c (5c:5c2c) + ld hl, wcd4c + dec [hl] + ret nz + call ExitMenu + call WhiteBGMap + jr asm_171c60 + +Function171c39: ; 171c39 (5c:5c39) + ld a, $28 + ld [wcd4c], a + call Function171c66 + +Function171c41: ; 171c41 (5c:5c41) + ld hl, wcd4c + dec [hl] + ret nz + call WhiteBGMap + callba Function106462 + callba Function106464 + ld a, $2 + ld [wc303], a + callba Function17f555 +asm_171c60: ; 171c60 (5c:5c60) + ld a, $80 + ld [wcd49], a + ret + +Function171c66: ; 171c66 (5c:5c66) + ld hl, wcd49 + inc [hl] + ret +; 171c6b (5c:5c6b) + +MenuDataHeader_171c6b: ; 171c6b + db $40 ; flags + db 12, 0 ; start coords + db 17, 19 ; end coords + dw NULL + db 0 ; default option +; 171c73 + +String_171c73: ; 171c73 + db "モバイルセンターを けってい" + next "しました@" +; 171c87 + +Function171c87: ; 171c87 (5c:5c87) + call DisableLCD + ld hl, GFX_171db1 + ld de, VTiles2 tile $00 + ld bc, $6e0 + call CopyBytes + ld hl, LZ_172abd + ld de, VTiles0 tile $00 + call Decompress + call EnableLCD + ld hl, Tilemap_172491 + decoord 0, 0 + ld bc, $168 + call CopyBytes + ld hl, Attrmap_1727ed + decoord 0, 0, AttrMap + ld bc, $168 + call CopyBytes + hlcoord 3, 2 + ld de, String_172e31 + call PlaceString + hlcoord 3, 16 + ld de, String_172e3f + call PlaceString + ret + +Function171ccd: ; 171ccd (5c:5ccd) + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, $5 + ld [rSVBK], a ; $ff00+$70 + ld hl, Palette_171d71 + ld de, Unkn1Pals + ld bc, $40 + call CopyBytes + ld hl, MovementAnimation + ld a, $ff + ld [hli], a + ld a, $7f + ld [hl], a + call SetPalettes + pop af + ld [rSVBK], a ; $ff00+$70 + ret + +Function171cf0: ; 171cf0 (5c:5cf0) + xor a + hlcoord 4, 15 +rept 2 + ld [hli], a +endr + ld a, [wcd4b] + xor $1 + ld [wcd4b], a + and a + jr nz, .asm_171d16 + ld hl, Tilemap_17251d + decoord 0, 7 + ld bc, $8c + call CopyBytes + hlcoord 3, 16 + ld de, String_172e3f + jp PlaceString +.asm_171d16 + ld hl, Tilemap_1725f9 + decoord 0, 7 + ld bc, $8c + call CopyBytes + hlcoord 3, 16 + ld de, String_172e4e + jp PlaceString + +Function171d2b: ; 171d2b (5c:5d2b) + call DisableLCD + ld hl, GFX_171db1 + ld de, VTiles2 tile $00 + ld bc, $6e0 + call CopyBytes + ld hl, LZ_172abd + ld de, VTiles0 tile $00 + call Decompress + call EnableLCD + ld hl, Tilemap_172685 + decoord 0, 0 + ld bc, $168 + call CopyBytes + ld hl, Attrmap_172955 + decoord 0, 0, AttrMap + ld bc, $168 + call CopyBytes + hlcoord 2, 2 + ld de, String_172e5d + call PlaceString + hlcoord 14, 16 + ld de, String_172e58 + call PlaceString + ret +; 171d71 (5c:5d71) + +Palette_171d71: + RGB 0, 0, 0 + RGB 3, 0, 0 + RGB 5, 0, 0 + RGB 31, 31, 29 + RGB 0, 2, 10 + RGB 2, 10, 21 + RGB 0, 0, 0 + RGB 10, 26, 31 + RGB 0, 0, 0 + RGB 0, 7, 8 + RGB 31, 8, 0 + RGB 1, 17, 15 + RGB 31, 16, 0 + RGB 31, 22, 0 + RGB 31, 27, 0 + RGB 31, 31, 0 + RGB 31, 18, 6 + RGB 0, 3, 0 + RGB 0, 9, 0 + RGB 0, 12, 0 + RGB 0, 16, 0 + RGB 0, 22, 0 + RGB 0, 25, 0 + RGB 0, 27, 0 + RGB 5, 5, 16 + RGB 8, 19, 28 + RGB 0, 0, 0 + RGB 31, 31, 31 + RGB 31, 31, 29 + RGB 21, 21, 20 + RGB 11, 11, 10 + RGB 0, 0, 0 +GFX_171db1: +INCBIN "gfx/unknown/171db1.2bpp" +Tilemap_172491: +INCBIN "gfx/unknown/172491.tilemap" +Tilemap_17251d: +INCBIN "gfx/unknown/17251d.tilemap" +Tilemap_1725f9: +INCBIN "gfx/unknown/1725f9.tilemap" +Tilemap_172685: +INCBIN "gfx/unknown/172685.tilemap" +Attrmap_1727ed: +INCBIN "gfx/unknown/1727ed.attrmap" +Attrmap_172955: +INCBIN "gfx/unknown/172955.attrmap" +LZ_172abd: +INCBIN "gfx/pokedex/slowpoke.2bpp.lz" + +String_172e31: ; 172e31 + db "パスワード", $1f, "いれてください@" +String_172e3f: ; 172e3f + db "きりかえ やめる けってい@" +String_172e4e: ; 172e4e + db "きりかえ やめる " +String_172e58: + db "けってい@" +String_172e5d: ; 172e5d + db "せつぞくする モバイルセンターを" + next "えらんで ください@" +; 172e78 + + +Function172e78: ; 172e78 (5c:6e78) + ld a, $7f + hlcoord 0, 0 + ld bc, $168 + call ByteFill + ld a, $7 + hlcoord 0, 0, AttrMap + ld bc, $168 + call ByteFill + call DisableLCD + ld hl, GFX_172f1f + ld de, VTiles2 tile $00 + ld bc, $610 + call CopyBytes + call EnableLCD + ld hl, Tilemap_1733af + decoord 0, 0 + ld bc, $168 + call CopyBytes + ld hl, Attrmap_173517 + decoord 0, 0, AttrMap + ld bc, $168 + call CopyBytes + ret +; 172eb9 (5c:6eb9) + +Function172eb9: + ld a, [rSVBK] ; $ff00+$70 + push af + ld a, $5 + ld [rSVBK], a ; $ff00+$70 + ld hl, Palette_172edf + ld de, Unkn1Pals + ld bc, $40 + call CopyBytes + ld hl, Palette_172edf + ld de, BGPals + ld bc, $40 + call CopyBytes + call SetPalettes + pop af + ld [rSVBK], a ; $ff00+$70 + ret +; 172edf (5c:6edf) + +Palette_172edf: + RGB 5, 12, 17 + RGB 31, 31, 31 + RGB 18, 25, 28 + RGB 10, 17, 21 + RGB 6, 13, 18 + RGB 31, 31, 31 + RGB 20, 26, 28 + RGB 12, 19, 23 + RGB 3, 10, 16 + RGB 31, 31, 31 + RGB 6, 13, 18 + RGB 20, 26, 28 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 5, 5, 16 + RGB 8, 19, 28 + RGB 0, 0, 0 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 0, 0, 0 + RGB 0, 0, 0 + RGB 0, 0, 0 + +GFX_172f1f: +INCBIN "gfx/unknown/172f1f.2bpp" + +Tilemap_1733af: +IF DEF(CORRUPT_TILES) +INCBIN "gfx/unknown/1733af_corrupt.tilemap" +ELSE +INCBIN "gfx/unknown/1733af.tilemap" +ENDC + +Attrmap_173517: +INCBIN "gfx/unknown/173517.attrmap"