diff options
Diffstat (limited to 'main.asm')
-rw-r--r-- | main.asm | 7265 |
1 files changed, 680 insertions, 6585 deletions
@@ -14,22 +14,22 @@ Start: SECTION "start",ROM0[$150] -INCLUDE "engine/init.asm" -INCLUDE "engine/vblank.asm" -INCLUDE "engine/delay.asm" -INCLUDE "engine/rtc.asm" -INCLUDE "engine/fade.asm" -INCLUDE "engine/lcd.asm" -INCLUDE "engine/time.asm" -INCLUDE "engine/serial.asm" -INCLUDE "engine/joypad.asm" -INCLUDE "engine/decompress.asm" -INCLUDE "engine/palettes.asm" -INCLUDE "engine/copy.asm" -INCLUDE "engine/text.asm" -INCLUDE "engine/video.asm" -INCLUDE "engine/map_objects.asm" -INCLUDE "engine/sine.asm" +INCLUDE "home/init.asm" +INCLUDE "home/vblank.asm" +INCLUDE "home/delay.asm" +INCLUDE "home/rtc.asm" +INCLUDE "home/fade.asm" +INCLUDE "home/lcd.asm" +INCLUDE "home/time.asm" +INCLUDE "home/serial.asm" +INCLUDE "home/joypad.asm" +INCLUDE "home/decompress.asm" +INCLUDE "home/palettes.asm" +INCLUDE "home/copy.asm" +INCLUDE "home/text.asm" +INCLUDE "home/video.asm" +INCLUDE "home/map_objects.asm" +INCLUDE "home/sine.asm" Function1b1e: ; 1b1e ld [$d003], a @@ -473,2419 +473,15 @@ Function1d19: ; 1d19 ; 1d35 -INCLUDE "engine/menu.asm" +INCLUDE "home/menu.asm" +INCLUDE "home/handshake.asm" +INCLUDE "home/game_time.asm" +INCLUDE "home/map.asm" -AskSerial: ; 2063 -; send out a handshake while serial int is off - ld a, [$c2d4] - bit 0, a - ret z - - ld a, [$c2d5] - and a - ret nz - -; once every 6 frames - ld hl, $ca8a - inc [hl] - ld a, [hl] - cp 6 - ret c - - xor a - ld [hl], a - - ld a, $c - ld [$c2d5], a - -; handshake - ld a, $88 - ld [rSB], a - -; switch to internal clock - ld a, %00000001 - ld [rSC], a - -; start transfer - ld a, %10000001 - ld [rSC], a - - ret -; 208a - - -INCLUDE "engine/game_time.asm" - - -Function210f: ; 210f - ld hl, $c7e8 - ld bc, $0018 - ld a, $0 - call ByteFill - ret -; 211b - -Function211b: ; 211b - push hl - ld hl, $dbf7 - ld a, [hli] - ld h, [hl] - ld l, a - or h - ld a, [hl] - jr nz, .asm_2128 - ld a, $ff - -.asm_2128 - pop hl - ret -; 212a - -Function212a: ; 212a - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a - xor a - ld [$dbf7], a - ld [$dbf8], a - call Function2147 - ret c - ld a, e - ld [$dbf7], a - ld a, d - ld [$dbf8], a - xor a - ret -; 2147 - -Function2147: ; 2147 - push bc - ld a, [hROMBank] - push af - ld a, $13 - rst Bankswitch - - ld hl, $501e -.asm_2151 - push hl - ld a, [hli] - cp $ff - jr z, .asm_2167 - cp b - jr nz, .asm_2160 - ld a, [hli] - cp c - jr nz, .asm_2160 - jr .asm_216a - -.asm_2160 - pop hl - ld de, $0004 - add hl, de - jr .asm_2151 - -.asm_2167 - scf - jr .asm_216d - -.asm_216a - ld e, [hl] - inc hl - ld d, [hl] - -.asm_216d - pop hl - pop bc - ld a, b - rst Bankswitch - - pop bc - ret -; 2173 - -Function2173: ; 2173 - call Function217a - call Functiondb1 - ret -; 217a - -Function217a: ; 217a - ld a, [hROMBank] - push af - ld a, [TilesetBlocksBank] - rst Bankswitch - - call Function2198 - ld a, $60 - ld hl, TileMap - ld bc, $0168 - call ByteFill - ld a, $13 - rst Bankswitch - - call $515b - pop af - rst Bankswitch - - ret -; 2198 - -Function2198: ; 2198 - ld a, [$d194] - ld e, a - ld a, [$d195] - ld d, a - ld hl, EnemyMoveAnimation - ld b, $5 - -.asm_21a5 - push de - push hl - ld c, $6 - -.asm_21a9 - push de - push hl - ld a, [de] - and a - jr nz, .asm_21b2 - ld a, [$d19d] - -.asm_21b2 - ld e, l - ld d, h - add a - ld l, a - ld h, $0 - add hl, hl - add hl, hl - add hl, hl - ld a, [TilesetBlocksAddress] - add l - ld l, a - ld a, [TilesetBlocksAddress + 1] - adc h - ld h, a - -rept 3 - ld a, [hli] - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - - ld a, e - add 20 - ld e, a - jr nc, .next\@ - inc d -.next\@ -endr - - ld a, [hli] - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - - pop hl - ld de, $0004 - add hl, de - pop de - inc de - dec c - jp nz, .asm_21a9 - pop hl - ld de, $0060 - add hl, de - pop de - ld a, [$d19f] - add $6 - add e - ld e, a - jr nc, .asm_2225 - inc d - -.asm_2225 - dec b - jp nz, .asm_21a5 - ret -; 222a - -Function222a: ; 222a - ld a, $fa - ld [$ff9f], a - callba Function15363 - xor a - ld [$ff9f], a - ret -; 2238 - -Function2238: ; 2238 - call Function2252 - ret nc - push bc - callba Function149af - pop bc - ret nc - call Function22a7 - scf - ret -; 224a - - - -Function224a: ; 224a - call Function2252 - ret nc - call Function22a7 - ret -; 2252 - -Function2252: ; 2252 - callba Function1499a - ret nc - - ld a, [hROMBank] - push af - - call Function2c52 - call Function2266 - - pop de - ld a, d - rst Bankswitch - ret -; 2266 - -Function2266: ; 2266 - ld a, [MapY] - sub $4 - ld e, a - ld a, [MapX] - sub $4 - ld d, a - ld a, [$dbfb] - and a - ret z - ld c, a - ld hl, $dbfc - ld a, [hli] - ld h, [hl] - ld l, a -.asm_227e - push hl - ld a, [hli] - cp e - jr nz, .asm_2289 - ld a, [hli] - cp d - jr nz, .asm_2289 - jr .asm_2296 - -.asm_2289 - pop hl - ld a, $5 - add l - ld l, a - jr nc, .asm_2291 - inc h - -.asm_2291 - dec c - jr nz, .asm_227e - xor a - ret - -.asm_2296 - pop hl - call Function22a3 - ret nc - ld a, [$dbfb] - inc a - sub c - ld c, a - scf - ret -; 22a3 - -Function22a3: ; 22a3 - inc hl - inc hl - scf - ret -; 22a7 - -Function22a7: ; 22a7 - ld a, [hROMBank] - push af - - call Function2c52 - call Function22b4 - - pop af - rst Bankswitch - scf - ret -; 22b4 - -Function22b4: ; 22b4 - push bc - ld hl, $dbfc - ld a, [hli] - ld h, [hl] - ld l, a - ld a, c - dec a - ld bc, $0005 - call AddNTimes - ld bc, $0002 - add hl, bc - ld a, [hli] - cp $ff - jr nz, .asm_22d0 - ld hl, $dcac - ld a, [hli] - -.asm_22d0 - pop bc - ld [$d146], a - ld a, [hli] - ld [$d147], a - ld a, [hli] - ld [$d148], a - ld a, c - ld [$d149], a - ld a, [MapGroup] - ld [$d14a], a - ld a, [MapNumber] - ld [$d14b], a - scf - ret -; 22ee - - - -CheckOutdoorMap: ; 22ee - cp ROUTE - ret z - cp TOWN - ret -; 22f4 - -CheckIndoorMap: ; 22f4 - cp INDOOR - ret z - cp CAVE - ret z - cp DUNGEON - ret z - cp GATE - ret -; 2300 - -Function2300: ; 2300 - cp INDOOR - ret z - cp GATE - ret z - cp $5 - ret -; 2309 - - -Function2309: ; 2309 - call Function2326 - call Function2c52 - call Function234f - xor a - call Function2336 - ret -; 2317 - -Function2317: ; 2317 - call Function2326 - call Function2c52 - call Function234f - ld a, $1 - call Function2336 - ret -; 2326 - -Function2326: ; 2326 - call Function2c3d - call Function2c1c - call GetSecondaryMapHeaderPointer - call Function235c - call Function2368 - ret -; 2336 - -Function2336: ; 2336 - push af - ld hl, $d1a6 - ld a, [hli] - ld h, [hl] - ld l, a - inc hl - inc hl - call Function23da - call Function23f1 - call Function2408 - pop af - and a - ret nz - call Function241f - ret -; 234f - -Function234f: ; 234f - ld hl, $d1a4 - ld a, [hli] - ld h, [hl] - ld l, a - call Function23ac - call Function23c3 - ret -; 235c - -Function235c: ; 235c - ld de, $d19d - ld c, $c -.asm_2361 - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .asm_2361 - ret -; 2368 - -Function2368: ; 2368 - ld a, $ff - ld [NorthConnectedMapGroup], a - ld [SouthConnectedMapGroup], a - ld [WestConnectedMapGroup], a - ld [EastConnectedMapGroup], a - - ld a, [$d1a8] - ld b, a - - bit 3, b - jr z, .asm_2384 - ld de, NorthMapConnection - call GetMapConnection - -.asm_2384 - bit 2, b - jr z, .asm_238e - ld de, SouthMapConnection - call GetMapConnection - -.asm_238e - bit 1, b - jr z, .asm_2398 - ld de, WestMapConnection - call GetMapConnection - -.asm_2398 - bit 0, b - jr z, .asm_23a2 - ld de, EastMapConnection - call GetMapConnection - -.asm_23a2 - ret -; 23a3 - - -GetMapConnection: ; 23a3 -; Load map connection struct at hl into de. - ld c, SouthMapConnection - NorthMapConnection -.loop - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .loop - ret -; 23ac - - -Function23ac: ; 23ac - ld a, [hli] - ld c, a - ld [$dc07], a - ld a, l - ld [$dc08], a - ld a, h - ld [$dc09], a - ld a, c - and a - ret z - ld bc, $0004 - call AddNTimes - ret -; 23c3 - -Function23c3: ; 23c3 - ld a, [hli] - ld c, a - ld [$dc0a], a - ld a, l - ld [$dc0b], a - ld a, h - ld [$dc0c], a - ld a, c - and a - ret z - ld bc, $0003 - call AddNTimes - ret -; 23da - -Function23da: ; 23da - ld a, [hli] - ld c, a - ld [$dbfb], a - ld a, l - ld [$dbfc], a - ld a, h - ld [$dbfd], a - ld a, c - and a - ret z - ld bc, $0005 - call AddNTimes - ret -; 23f1 - -Function23f1: ; 23f1 - ld a, [hli] - ld c, a - ld [$dbfe], a - ld a, l - ld [$dbff], a - ld a, h - ld [$dc00], a - ld a, c - and a - ret z - ld bc, $0008 - call AddNTimes - ret -; 2408 - -Function2408: ; 2408 - ld a, [hli] - ld c, a - ld [$dc01], a - ld a, l - ld [$dc02], a - ld a, h - ld [$dc03], a - ld a, c - and a - ret z - ld bc, $0005 - call AddNTimes - ret -; 241f - -Function241f: ; 241f - push hl - call Function2471 - pop de - ld hl, $d72e - ld a, [de] - inc de - ld [$dc04], a - ld a, e - ld [$dc05], a - ld a, d - ld [$dc06], a - ld a, [$dc04] - call Function2457 - ld a, [$dc04] - ld c, a - ld a, $10 - sub c - jr z, .asm_2454 - ld bc, $0001 - add hl, bc - ld bc, $0010 -.asm_244a - ld [hl], $0 - inc hl - ld [hl], $ff - dec hl - add hl, bc - dec a - jr nz, .asm_244a - -.asm_2454 - ld h, d - ld l, e - ret -; 2457 - -Function2457: ; 2457 - and a - ret z - ld c, a -.asm_245a - push bc - push hl - ld a, $ff - ld [hli], a - ld b, $d -.asm_2461 - ld a, [de] - inc de - ld [hli], a - dec b - jr nz, .asm_2461 - pop hl - ld bc, $0010 - add hl, bc - pop bc - dec c - jr nz, .asm_245a - ret -; 2471 - -Function2471: ; 2471 - ld hl, $d4fe - ld bc, $01e0 - xor a - call ByteFill - ld hl, $d4fe - ld de, $0028 - ld c, $c - xor a -.asm_2484 - ld [hl], a - add hl, de - dec c - jr nz, .asm_2484 - ret -; 248a - -Function248a: ; 248a - call GetMapEventBank - rst Bankswitch - - ld hl, $d1a6 - ld a, [hli] - ld h, [hl] - ld l, a - inc hl - inc hl - inc hl - ld a, [WarpNumber] - dec a - ld c, a - ld b, $0 - ld a, $5 - call AddNTimes - ld a, [hli] - ld [YCoord], a - ld a, [hli] - ld [XCoord], a - ld a, [hli] - cp $ff - jr nz, .asm_24b3 - call Function24ba - -.asm_24b3 - ld a, $41 - ld hl, $486d - rst FarCall - ret -; 24ba - -Function24ba: ; 24ba - ld a, [$d149] - ld [$dcac], a - ld a, [$d14a] - ld [BackupMapGroup], a - ld a, [$d14b] - ld [BackupMapNumber], a - ret -; 24cd - -Function24cd: ; 24cd - ld hl, OverworldMap - ld bc, $0514 - ld a, $0 - call ByteFill - call Function24e4 - call FillMapConnections - ld a, $1 - call Function263b - ret -; 24e4 - - - -Function24e4: ; 24e4 - ld a, [hROMBank] - push af - ld hl, OverworldMap - ld a, [$d19f] - ld [hConnectedMapWidth], a - add $6 - ld [hConnectionStripLength], a - ld c, a - ld b, $0 - add hl, bc - add hl, bc - add hl, bc - ld c, $3 - add hl, bc - ld a, [$d1a0] - rst Bankswitch - - ld a, [$d1a1] - ld e, a - ld a, [$d1a2] - ld d, a - ld a, [$d19e] - ld b, a -.asm_250c - push hl - ld a, [hConnectedMapWidth] - ld c, a -.asm_2510 - ld a, [de] - inc de - ld [hli], a - dec c - jr nz, .asm_2510 - pop hl - ld a, [hConnectionStripLength] - add l - ld l, a - jr nc, .asm_251e - inc h - -.asm_251e - dec b - jr nz, .asm_250c - pop af - rst Bankswitch - - ret -; 2524 - - - -FillMapConnections: ; 2524 - -; North - ld a, [NorthConnectedMapGroup] - cp $ff - jr z, .South - ld b, a - ld a, [NorthConnectedMapNumber] - ld c, a - call GetAnyMapBlockdataBank - - ld a, [NorthConnectionStripPointer] - ld l, a - ld a, [NorthConnectionStripPointer + 1] - ld h, a - ld a, [NorthConnectionStripLocation] - ld e, a - ld a, [NorthConnectionStripLocation + 1] - ld d, a - ld a, [NorthConnectionStripLength] - ld [hConnectionStripLength], a - ld a, [NorthConnectedMapWidth] - ld [hConnectedMapWidth], a - call FillNorthConnectionStrip - -.South - ld a, [SouthConnectedMapGroup] - cp $ff - jr z, .West - ld b, a - ld a, [SouthConnectedMapNumber] - ld c, a - call GetAnyMapBlockdataBank - - ld a, [SouthConnectionStripPointer] - ld l, a - ld a, [SouthConnectionStripPointer + 1] - ld h, a - ld a, [SouthConnectionStripLocation] - ld e, a - ld a, [SouthConnectionStripLocation + 1] - ld d, a - ld a, [SouthConnectionStripLength] - ld [hConnectionStripLength], a - ld a, [SouthConnectedMapWidth] - ld [hConnectedMapWidth], a - call FillSouthConnectionStrip - -.West - ld a, [WestConnectedMapGroup] - cp $ff - jr z, .East - ld b, a - ld a, [WestConnectedMapNumber] - ld c, a - call GetAnyMapBlockdataBank - - ld a, [WestConnectionStripPointer] - ld l, a - ld a, [WestConnectionStripPointer + 1] - ld h, a - ld a, [WestConnectionStripLocation] - ld e, a - ld a, [WestConnectionStripLocation + 1] - ld d, a - ld a, [WestConnectionStripLength] - ld b, a - ld a, [WestConnectedMapWidth] - ld [hConnectionStripLength], a - call FillWestConnectionStrip - -.East - ld a, [EastConnectedMapGroup] - cp $ff - jr z, .Done - ld b, a - ld a, [EastConnectedMapNumber] - ld c, a - call GetAnyMapBlockdataBank - - ld a, [EastConnectionStripPointer] - ld l, a - ld a, [EastConnectionStripPointer + 1] - ld h, a - ld a, [EastConnectionStripLocation] - ld e, a - ld a, [EastConnectionStripLocation + 1] - ld d, a - ld a, [EastConnectionStripLength] - ld b, a - ld a, [EastConnectedMapWidth] - ld [hConnectionStripLength], a - call FillEastConnectionStrip - -.Done - ret -; 25d3 - - -FillNorthConnectionStrip: -FillSouthConnectionStrip: ; 25d3 - - ld c, 3 -.y - push de - - push hl - ld a, [hConnectionStripLength] - ld b, a -.x - ld a, [hli] - ld [de], a - inc de - dec b - jr nz, .x - pop hl - - ld a, [hConnectedMapWidth] - ld e, a - ld d, 0 - add hl, de - pop de - - ld a, [$d19f] - add 6 - add e - ld e, a - jr nc, .asm_25f2 - inc d -.asm_25f2 - dec c - jr nz, .y - ret -; 25f6 - - -FillWestConnectionStrip: -FillEastConnectionStrip: ; 25f6 - -.asm_25f6 - ld a, [$d19f] - add 6 - ld [hConnectedMapWidth], a - - push de - - push hl - ld a, [hli] - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - ld a, [hli] - ld [de], a - inc de - pop hl - - ld a, [hConnectionStripLength] - ld e, a - ld d, 0 - add hl, de - pop de - - ld a, [hConnectedMapWidth] - add e - ld e, a - jr nc, .asm_2617 - inc d -.asm_2617 - dec b - jr nz, .asm_25f6 - ret -; 261b - -Function261b: ; 261b - ld [$d432], a - ret -; 261f - - -CallScript: ; 261f -; Call a script at a:hl. - - ld [ScriptBank], a - ld a, l - ld [ScriptPos], a - ld a, h - ld [ScriptPos + 1], a - - ld a, $ff - ld [ScriptRunning], a - - scf - ret -; 2631 - -Function2631: ; 2631 - ld a, [ScriptRunning] - and a - ret nz - call GetMapEventBank - jr CallScript -; 263b - -Function263b: ; 263b - ld b, a - ld a, [hROMBank] - push af - call Function2c52 - call Function2653 - jr nc, .done - - call GetMapEventBank - ld b, a - ld d, h - ld e, l - call Function2674 - -.done - pop af - rst Bankswitch - ret -; 2653 - -Function2653: ; 2653 - ld a, [$dc0a] - ld c, a - and a - ret z - ld hl, $dc0b - ld a, [hli] - ld h, [hl] - ld l, a - or h - ret z - ld de, $0003 -.asm_2664 - ld a, [hl] - cp b - jr z, .asm_266e - add hl, de - dec c - jr nz, .asm_2664 - xor a - ret - -.asm_266e - inc hl - ld a, [hli] - ld h, [hl] - ld l, a - scf - ret -; 2674 - -Function2674: ; 2674 - callba Unknown_0x974f3 - ld a, [ScriptMode] - push af - ld hl, ScriptFlags - ld a, [hl] - push af - set 1, [hl] - callba Function96c56 - callba ScriptEvents - pop af - ld [ScriptFlags], a - pop af - ld [ScriptMode], a - ret -; 269a - -Function269a: ; 269a - ld a, [hROMBank] - push af - ld a, b - rst Bankswitch - - push hl - call SpeechTextBox - call Function2e31 - ld a, 1 - ld [hOAMUpdate], a - call Function321c - pop hl - call PrintTextBoxText - xor a - ld [hOAMUpdate], a - pop af - rst Bankswitch - - ret -; 26b7 - -Function26b7: ; 26b7 -; Call a:de. - - ld [hBuffer], a - ld a, [hROMBank] - push af - ld a, [hBuffer] - rst Bankswitch - - call .de - - pop af - rst Bankswitch - ret - -.de - push de - ret -; 26c7 - -Function26c7: ; 26c7 - ld a, [hROMBank] - push af - ld a, b - rst Bankswitch - - ld a, c - call Function19e9 - - pop hl - ld a, h - rst Bankswitch - ret -; 26d4 - - -GetScriptByte: ; 0x26d4 -; Return byte at ScriptBank:ScriptPos in a. - - push hl - push bc - ld a, [hROMBank] - push af - ld a, [ScriptBank] - rst Bankswitch - - ld hl, ScriptPos - ld c, [hl] - inc hl - ld b, [hl] - - ld a, [bc] - - inc bc - ld [hl], b - dec hl - ld [hl], c - - ld b, a - pop af - rst Bankswitch - ld a, b - pop bc - pop hl - ret -; 0x26ef - - -ObjectEvent: ; 0x26ef - jumptextfaceplayer ObjectEventText -; 0x26f2 - -ObjectEventText: - TX_FAR _ObjectEventText - db "@" -; 0x26f7 - - -BGEvent: ; 26f7 - jumptext BGEventText -; 26fa - -BGEventText: ; 26fa - text_jump UnknownText_0x1c46fc, BANK(UnknownText_0x1c46fc) - db "@" -; 26ff - - -CoordinatesEvent: ; 26ff - jumptext CoordinatesEventText -; 2702 - -CoordinatesEventText: ; 2702 - text_jump UnknownText_0x1c4706, BANK(UnknownText_0x1c4706) - db "@" -; 2707 - - -Function2707: ; 2707 - ld a, [hConnectionStripLength] - ld e, a - ld d, $0 - ld hl, $d81e - add hl, de - ld a, [hl] - ret -; 2712 - -Function2712: ; 2712 - ld a, [hConnectionStripLength] - ld e, a - ld d, $0 - ld hl, $d81e - add hl, de - ld [hl], $ff - ret -; 271e - -Function271e: ; 271e - ld a, [hConnectionStripLength] - ld e, a - ld d, $0 - ld hl, $d81e - add hl, de - ld [hl], $0 - ret -; 272a - - -Function272a: ; 272a - ld hl, TileMap - ld de, BGMapBuffer - call Function27b7 - ld c, $28 - call Functiondbd - ld a, [$d152] - ld e, a - ld a, [$d153] - ld d, a - call Function27d3 - ld a, $1 - ld [hBGMapUpdate], a - ret -; 2748 - -Function2748: ; 2748 - ld hl, $c5e0 - ld de, BGMapBuffer - call Function27b7 - ld c, $28 - call Functiondbd - ld a, [$d152] - ld l, a - ld a, [$d153] - ld h, a - ld bc, $0200 - add hl, bc - ld a, h - and $3 - or $98 - ld e, l - ld d, a - call Function27d3 - ld a, $1 - ld [hBGMapUpdate], a - ret -; 2771 - -Function2771: ; 2771 - ld hl, TileMap - ld de, BGMapBuffer - call Function27c0 - ld c, $24 - call Functiondbd - ld a, [$d152] - ld e, a - ld a, [$d153] - ld d, a - call Function27f8 - ld a, $1 - ld [hBGMapUpdate], a - ret -; 278f - -Function278f: ; 278f - ld hl, $c4b2 - ld de, BGMapBuffer - call Function27c0 - ld c, $24 - call Functiondbd - ld a, [$d152] - ld e, a - and $e0 - ld b, a - ld a, e - add $12 - and $1f - or b - ld e, a - ld a, [$d153] - ld d, a - call Function27f8 - ld a, $1 - ld [hBGMapUpdate], a - ret -; 27b7 - -Function27b7: ; 27b7 - ld c, $28 -.asm_27b9 - ld a, [hli] - ld [de], a - inc de - dec c - jr nz, .asm_27b9 - ret -; 27c0 - -Function27c0: ; 27c0 - ld c, $12 -.asm_27c2 - ld a, [hli] - ld [de], a - inc de - ld a, [hl] - ld [de], a - inc de - ld a, $13 - add l - ld l, a - jr nc, .asm_27cf - inc h - -.asm_27cf - dec c - jr nz, .asm_27c2 - ret -; 27d3 - -Function27d3: ; 27d3 - ld hl, BGMapBufferPtrs - push de - call .asm_27df - pop de - ld a, $20 - add e - ld e, a - -.asm_27df - ld c, $a -.asm_27e1 - ld a, e - ld [hli], a - ld a, d - ld [hli], a - ld a, e - inc a - inc a - and $1f - ld b, a - ld a, e - and $e0 - or b - ld e, a - dec c - jr nz, .asm_27e1 - ld a, $14 - ld [$ffdc], a - ret -; 27f8 - -Function27f8: ; 27f8 - ld hl, BGMapBufferPtrs - ld c, $12 -.asm_27fd - ld a, e - ld [hli], a - ld a, d - ld [hli], a - ld a, $20 - add e - ld e, a - jr nc, .asm_280e - inc d - ld a, d - and $3 - or $98 - ld d, a - -.asm_280e - dec c - jr nz, .asm_27fd - ld a, $12 - ld [$ffdc], a - ret -; 2816 - -Function2816: ; 2816 - ld hl, BGMapBuffer - ld bc, $0078 - xor a - call ByteFill - ret -; 2821 - -Function2821: ; 2821 - ld hl, TilesetAddress - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [TilesetBank] - ld e, a - ld a, [rSVBK] - push af - ld a, $6 - ld [rSVBK], a - ld a, e - ld de, $d000 - call FarDecompress - ld hl, $d000 - ld de, VTiles2 - ld bc, $0600 - call CopyBytes - ld a, [rVBK] - push af - ld a, $1 - ld [rVBK], a - ld hl, $d600 - ld de, VTiles2 - ld bc, $0600 - call CopyBytes - pop af - ld [rVBK], a - pop af - ld [rSVBK], a - ld a, [$d199] - cp $1 - jr z, .asm_286f - cp $2 - jr z, .asm_286f - cp $4 - jr z, .asm_286f - jr .asm_2875 - -.asm_286f - ld a, $7 - ld hl, $4000 - rst FarCall - -.asm_2875 - xor a - ld [hTileAnimFrame], a - ret -; 2879 - -Function2879: ; 2879 - ld hl, $d194 - ld a, [hli] - ld h, [hl] - ld l, a - ld de, $dcb9 - ld c, $5 - ld b, $6 -.asm_2886 - push bc - push hl -.asm_2888 - ld a, [hli] - ld [de], a - inc de - dec b - jr nz, .asm_2888 - pop hl - ld a, [$d19f] - add $6 - ld c, a - ld b, $0 - add hl, bc - pop bc - dec c - jr nz, .asm_2886 - ret -; 289d - -Function289d: ; 289d - ld hl, $d194 - ld a, [hli] - ld h, [hl] - ld l, a - ld de, $dcb9 - ld a, [$d19f] - add $6 - ld [hConnectionStripLength], a - ld a, [$d151] - and a - jr z, .asm_28cb - cp $1 - jr z, .asm_28c0 - cp $2 - jr z, .asm_28d4 - cp $3 - jr z, .asm_28da - ret - -.asm_28c0 - ld de, $dcbf - ld a, [hConnectionStripLength] - ld c, a - ld b, $0 - add hl, bc - jr .asm_28ce - -.asm_28cb - ld de, $dcb9 - -.asm_28ce - ld b, $6 - ld c, $4 - jr .asm_28f7 - -.asm_28d4 - ld de, $dcba - inc hl - jr .asm_28dd - -.asm_28da - ld de, $dcb9 - -.asm_28dd - ld b, $5 - ld c, $5 - jr .asm_28f7 - - ld hl, $d194 - ld a, [hli] - ld h, [hl] - ld l, a - ld a, [$d19f] - add $6 - ld [hConnectionStripLength], a - ld de, $dcb9 - ld b, $6 - ld c, $5 - -.asm_28f7 - push bc - push hl - push de -.asm_28fa - ld a, [de] - inc de - ld [hli], a - dec b - jr nz, .asm_28fa - pop de - ld a, e - add $6 - ld e, a - jr nc, .asm_2908 - inc d - -.asm_2908 - pop hl - ld a, [hConnectionStripLength] - ld c, a - ld b, $0 - add hl, bc - pop bc - dec c - jr nz, .asm_28f7 - ret -; 2914 - -Function2914: ; 2914 - xor a - ld [TilePermissions], a - call Function296c - call Function294d - ld a, [MapX] - ld d, a - ld a, [MapY] - ld e, a - call Function2a3c - ld [StandingTile], a - call Function29ff - ret nz - ld a, [StandingTile] - and 7 - ld hl, .data_2945 - add l - ld l, a - ld a, 0 - adc h - ld h, a - ld a, [hl] - ld hl, TilePermissions - or [hl] - ld [hl], a - ret -; 2945 - -.data_2945 ; 2945 - db 1, 2, 4, 8, 9, 10, 5, 6 -; 294d - -Function294d: ; 294d - ld a, [MapX] - ld d, a - ld a, [MapY] - ld e, a - push de - inc e - call Function2a3c - ld [TileDown], a - call Function298b - pop de - dec e - call Function2a3c - ld [TileUp], a - call Function29a8 - ret -; 296c - -Function296c: ; 296c - ld a, [MapX] - ld d, a - ld a, [MapY] - ld e, a - push de - dec d - call Function2a3c - ld [TileLeft], a - call Function29e2 - pop de - inc d - call Function2a3c - ld [TileRight], a - call Function29c5 - ret -; 298b - -Function298b: ; 298b - call Function29ff - ret nz - ld a, [TileDown] - and $7 - cp $2 - jr z, .asm_299f - cp $6 - jr z, .asm_299f - cp $7 - ret nz - -.asm_299f - ld a, [TilePermissions] - or $8 - ld [TilePermissions], a - ret -; 29a8 - -Function29a8: ; 29a8 - call Function29ff - ret nz - ld a, [TileUp] - and $7 - cp $3 - jr z, .asm_29bc - cp $4 - jr z, .asm_29bc - cp $5 - ret nz - -.asm_29bc - ld a, [TilePermissions] - or $4 - ld [TilePermissions], a - ret -; 29c5 - -Function29c5: ; 29c5 - call Function29ff - ret nz - ld a, [TileRight] - and $7 - cp $1 - jr z, .asm_29d9 - cp $5 - jr z, .asm_29d9 - cp $7 - ret nz - -.asm_29d9 - ld a, [TilePermissions] - or $1 - ld [TilePermissions], a - ret -; 29e2 - -Function29e2: ; 29e2 - call Function29ff - ret nz - ld a, [TileLeft] - and $7 - cp $0 - jr z, .asm_29f6 - cp $4 - jr z, .asm_29f6 - cp $6 - ret nz - -.asm_29f6 - ld a, [TilePermissions] - or $2 - ld [TilePermissions], a - ret -; 29ff - -Function29ff: ; 29ff - and $f0 - cp $b0 - ret z - cp $c0 - ret -; 2a07 - - -GetFacingTileCoord: ; 2a07 -; Return map coordinates in (d, e) and tile id in a -; of the tile the player is facing. - - ld a, [PlayerDirection] - and %1100 - srl a - srl a - ld l, a - ld h, 0 - add hl, hl - add hl, hl - ld de, .Directions - add hl, de - - ld d, [hl] - inc hl - ld e, [hl] - inc hl - - ld a, [hli] - ld h, [hl] - ld l, a - - ld a, [MapX] - add d - ld d, a - ld a, [MapY] - add e - ld e, a - ld a, [hl] - ret - -.Directions - ; x, y - db 0, 1 - dw TileDown - db 0, -1 - dw TileUp - db -1, 0 - dw TileLeft - db 1, 0 - dw TileRight -; 2a3c - - -Function2a3c: ; 2a3c - call Function2a66 - ld a, [hl] - and a - jr z, .asm_2a63 - ld l, a - ld h, $0 - add hl, hl - add hl, hl - ld a, [TilesetCollisionAddress] - ld c, a - ld a, [$d1e1] - ld b, a - add hl, bc - rr d - jr nc, .asm_2a56 - inc hl - -.asm_2a56 - rr e - jr nc, .asm_2a5c - inc hl - inc hl - -.asm_2a5c - ld a, [TilesetCollisionBank] - call GetFarByte - ret - -.asm_2a63 - ld a, $ff - ret -; 2a66 - -Function2a66: ; 2a66 - ld a, [$d19f] - add $6 - ld c, a - ld b, $0 - ld hl, $c801 - add hl, bc - ld a, e - srl a - jr z, .asm_2a84 - and a -.asm_2a78 - srl a - jr nc, .asm_2a7d - add hl, bc - -.asm_2a7d - sla c - rl b - and a - jr nz, .asm_2a78 - -.asm_2a84 - ld c, d - srl c - ld b, $0 - add hl, bc - ret -; 2a8b - - -CheckFacingSign: ; 2a8b - call GetFacingTileCoord - ld b, a - ld a, d - sub 4 - ld d, a - ld a, e - sub 4 - ld e, a - ld a, [$dc01] - and a - ret z - ld c, a - ld a, [hROMBank] - push af - call Function2c52 - call Function2aaa - pop hl - ld a, h - rst Bankswitch - ret -; 2aaa - -Function2aaa: ; 2aaa - ld hl, $dc02 - ld a, [hli] - ld h, [hl] - ld l, a -.asm_2ab0 - push hl - ld a, [hli] - cp e - jr nz, .asm_2abb - ld a, [hli] - cp d - jr nz, .asm_2abb - jr .asm_2ac8 - -.asm_2abb - pop hl - ld a, 5 - add l - ld l, a - jr nc, .asm_2ac3 - inc h - -.asm_2ac3 - dec c - jr nz, .asm_2ab0 - xor a - ret - -.asm_2ac8 - pop hl - ld de, EngineBuffer1 - ld bc, 5 - call CopyBytes - scf - ret -; 2ad4 - -Function2ad4: ; 2ad4 - ld a, [$dbfe] - and a - ret z - ld c, a - ld a, [hROMBank] - push af - call Function2c52 - call Function2ae7 - pop hl - ld a, h - rst Bankswitch - ret -; 2ae7 - -Function2ae7: ; 2ae7 - ld hl, $dbff - ld a, [hli] - ld h, [hl] - ld l, a - call Function211b - ld b, a - ld a, [MapX] - sub $4 - ld d, a - ld a, [MapY] - sub $4 - ld e, a -.asm_2afd - push hl - ld a, [hli] - cp b - jr z, .asm_2b06 - cp $ff - jr nz, .asm_2b10 - -.asm_2b06 - ld a, [hli] - cp e - jr nz, .asm_2b10 - ld a, [hli] - cp d - jr nz, .asm_2b10 - jr .asm_2b1d - -.asm_2b10 - pop hl - ld a, $8 - add l - ld l, a - jr nc, .asm_2b18 - inc h - -.asm_2b18 - dec c - jr nz, .asm_2afd - xor a - ret - -.asm_2b1d - pop hl - ld de, EngineBuffer1 - ld bc, $0008 - call CopyBytes - scf - ret -; 2b29 - - -FadeToMenu: ; 2b29 - xor a - ld [hBGMapMode], a - call Function1d6e - ld a, $23 - ld hl, $4084 - rst FarCall - call ClearSprites - call Function2ed3 - ret -; 2b3c - - -Function2b3c: ; 2b3c - call WhiteBGMap - call Function2bae - call Function1ad2 - call Function1d7d - call Functiond90 - jr Function2b5c -; 2b4d - -Function2b4d: ; 2b4d - call WhiteBGMap - call Function1d7d - call Function2bae - call Function1ad2 - call Functiond90 -; 2b5c - -Function2b5c: ; 2b5c - ld b, $9 - call GetSGBLayout - ld a, $12 - ld hl, $5409 - rst FarCall - call Function3200 - ld a, $23 - ld hl, $4079 - rst FarCall - call Function2ee4 - ret -; 2b74 - - -Function2b74: ; 0x2b74 - push af - ld a, $1 - ld [$c2ce], a - call WhiteBGMap - call ClearSprites - call Function2bae - ld hl, $c590 ; tile 0, 12 - ld bc, $0412 - call TextBox - ld hl, VramState - set 0, [hl] - call Function1ad2 - call Function3200 - ld b, $9 - call GetSGBLayout - callba Function49409 - call UpdateTimePals - call DelayFrame - ld a, $1 - ld [$ffde], a - pop af - ret -; 0x2bae - -Function2bae: ; 2bae - call DisableLCD - call ClearSprites - ld a, $5 - ld hl, $4168 - rst FarCall - call Functione51 - call Functione5f - ld a, [hROMBank] - push af - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a - call Function2c24 - ld a, $23 - ld hl, $4001 - rst FarCall - call Function2173 - call Function2821 - ld a, $9 - call Function3cb4 - pop af - rst Bankswitch - - call EnableLCD - ret -; 2be5 - - -GetMapHeaderPointer: ; 2be5 - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a -; 2bed - -GetAnyMapHeaderPointer: ; 0x2bed -; Prior to calling this function, you must have switched banks so that -; MapGroupPointers is visible. - -; inputs: -; b = map group, c = map number -; XXX de = ??? - -; outputs: -; hl points to the map header - push bc ; save map number for later - - ; get pointer to map group - dec b - ld c, b - ld b, $0 - ld hl, MapGroupPointers - add hl, bc - add hl, bc - - ld a, [hli] - ld h, [hl] - ld l, a - pop bc ; restore map number - - ; find the cth map header - dec c - ld b, $0 - ld a, OlivineGym_MapHeader - OlivinePokeCenter1F_MapHeader - call AddNTimes - ret -; 0x2c04 - -GetMapHeaderMember: ; 0x2c04 -; Extract data from the current map's header. - -; inputs: -; de = offset of desired data within the mapheader - -; outputs: -; bc = data from the current map's header -; (e.g., de = $0003 would return a pointer to the secondary map header) - - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a - ; fallthrough - -GetAnyMapHeaderMember: ; 0x2c0c - ; bankswitch - ld a, [hROMBank] - push af - ld a, BANK(MapGroupPointers) - rst Bankswitch - - call GetAnyMapHeaderPointer - add hl, de - ld c, [hl] - inc hl - ld b, [hl] - - ; bankswitch back - pop af - rst Bankswitch - ret -; 0x2c1c - - -Function2c1c: ; 2c1c - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a -; 2c24 - -Function2c24: ; 2c24 - call Function2c31 - rst Bankswitch - ret -; 2c29 - - -Function2c29: ; 2c29 - ld a, [MapGroup] - ld b, a - ld a, [MapNumber] - ld c, a -; 2c31 - -Function2c31: ; 2c31 - push hl - push de - ld de, $0000 - call GetAnyMapHeaderMember - ld a, c - pop de - pop hl - ret -; 2c3d - -Function2c3d: ; 2c3d - ld a, [hROMBank] - push af - ld a, $25 - rst Bankswitch - call GetMapHeaderPointer - ld de, $d198 - ld bc, $0005 - call CopyBytes - pop af - rst Bankswitch - ret -; 2c52 - -Function2c52: ; 2c52 - ld a, [MapEventBank] - rst Bankswitch - ret -; 2c57 - - -GetMapEventBank: ; 2c57 - ld a, [MapEventBank] - ret -; 2c5b - -GetAnyMapBlockdataBank: ; 2c5b -; Return the blockdata bank for group b map c. - push hl - push de - push bc - - push bc - ld de, 3 ; second map header pointer - call GetAnyMapHeaderMember - ld l, c - ld h, b - pop bc - - push hl - ld de, 0 ; second map header bank - call GetAnyMapHeaderMember - pop hl - - ld de, 3 ; blockdata bank - add hl, de - ld a, c - call GetFarByte - rst Bankswitch - - pop bc - pop de - pop hl - ret -; 2c7d - -GetSecondaryMapHeaderPointer: ; 0x2c7d -; returns the current map's secondary map header pointer in hl. - push bc - push de - ld de, $0003 ; secondary map header pointer (offset within header) - call GetMapHeaderMember - ld l, c - ld h, b - pop de - pop bc - ret -; 2c8a - -GetMapPermission: ; 2c8a - push hl - push de - push bc - ld de, 2 - call GetMapHeaderMember - ld a, c - pop bc - pop de - pop hl - ret -; 2c98 - -Function2c98: ; 2c98 - ret -; 2c99 - -Function2c99: ; 2c99 - push hl - push de - push bc - ld de, $0002 - call GetAnyMapHeaderMember - ld a, c - pop bc - pop de - pop hl - ret -; 2ca7 - -Function2ca7: ; 2ca7 - ld de, $0001 - call GetAnyMapHeaderMember - ld a, c - ret -; 2caf - -GetWorldMapLocation: ; 0x2caf -; given a map group/id in bc, return its location on the Pokégear map. - push hl - push de - push bc - ld de, 5 - call GetAnyMapHeaderMember - ld a, c - pop bc - pop de - pop hl - ret -; 0x2cbd - -Function2cbd: ; 2cbd - push hl - push bc - ld de, $0006 - call GetMapHeaderMember - ld a, c - cp $64 - jr z, .asm_2cee - bit 7, c - jr nz, .asm_2cda - ld a, $22 - ld hl, $7342 - rst FarCall - ld e, c - ld d, $0 -.asm_2cd7 - pop bc - pop hl - ret - -.asm_2cda - ld a, [StatusFlags2] - bit 0, a - jr z, .asm_2ce6 - ld de, $0056 - jr .asm_2cd7 - -.asm_2ce6 - ld a, c - and $7f - ld e, a - ld d, $0 - jr .asm_2cd7 - -.asm_2cee - ld a, [StatusFlags2] - bit 7, a - jr z, .asm_2cfa - ld de, $0048 - jr .asm_2cd7 - -.asm_2cfa - ld de, $0026 - jr .asm_2cd7 -; 2cff - -Function2cff: ; 2cff - call Function2d0d - and $f - ret -; 2d05 - -Function2d05: ; 2d05 - call Function2d0d - and $f0 - swap a - ret -; 2d0d - -Function2d0d: ; 2d0d - push hl - push bc - ld de, $0007 - call GetMapHeaderMember - ld a, c - pop bc - pop hl - ret -; 2d19 - -Function2d19: ; 2d19 - push de - push hl - push bc - ld de, $0008 - call GetMapHeaderMember - ld a, c - pop bc - pop hl - pop de - ret -; 2d27 - -Function2d27: ; 2d27 - push hl - push bc - ld hl, $5596 - ld bc, $000f - ld a, [$d199] - call AddNTimes - ld de, TilesetBank - ld bc, $000f - ld a, $13 - call FarCopyBytes - pop bc - pop hl - ret -; 2d43 - Function2d43: ; 2d43 +; Inexplicably empty. +; Seen in PredefPointers. nop nop nop @@ -2906,62 +502,8 @@ Function2d43: ; 2d43 ; 2d54 -INCLUDE "engine/farcall.asm" - - -Predef: ; 2d83 -; Call predefined function a. -; Preserves bc, de, hl and f. - - ld [PredefID], a - ld a, [hROMBank] - push af - - ld a, BANK(GetPredefPointer) - rst Bankswitch - call GetPredefPointer ; stores hl in PredefTemp - -; Switch to the new function's bank - rst Bankswitch - -; Instead of directly calling stuff, -; push it to the stack in reverse. - - ld hl, .Return - push hl - -; Call the Predef function - ld a, [PredefAddress] - ld h, a - ld a, [PredefAddress + 1] - ld l, a - push hl - -; Get hl back - ld a, [PredefTemp] - ld h, a - ld a, [PredefTemp + 1] - ld l, a - ret - -.Return -; Clean up after the Predef call - - ld a, h - ld [PredefTemp], a - ld a, l - ld [PredefTemp+1], a - - pop hl - ld a, h - rst Bankswitch - - ld a, [PredefTemp] - ld h, a - ld a, [PredefTemp + 1] - ld l, a - ret -; 2dba +INCLUDE "home/farcall.asm" +INCLUDE "home/predef.asm" ResetWindow: ; 2dba @@ -3071,125 +613,16 @@ Function2e4e: ; 2e4e ret ; 2e50 -Function2e50: ; 2e50 - xor a - ld hl, EventFlags - ld [hli], a - ret -; 2e56 - -Function2e56: ; 2e56 - xor a - ld hl, BikeFlags - ld [hli], a - ld [hl], a - ret -; 2e5d - -Function2e5d: ; 2e5d - ld a, [$d19a] - cp $2 - jr z, .asm_2e69 - cp $1 - jr z, .asm_2e69 - ret - -.asm_2e69 - ld hl, StatusFlags - res 2, [hl] - ret -; 2e6f - - -EventFlagAction: ; 0x2e6f - ld hl, EventFlags - call FlagAction - ret - -FlagAction: ; 0x2e76 -; Perform a function on a bit in memory. - -; inputs: -; b: function -; 0 clear bit -; 1 set bit -; 2 check bit -; de: bit number -; hl: index within bit table - - ; get index within the byte - ld a, e - and $7 - - ; shift de right by three bits (get the index within memory) - srl d - rr e - srl d - rr e - srl d - rr e - add hl, de - - ; implement a decoder - ld c, $1 - rrca - jr nc, .one - rlc c -.one - rrca - jr nc, .two - rlc c - rlc c -.two - rrca - jr nc, .three - swap c -.three - - ; check b's value: 0, 1, 2 - ld a, b - cp 1 - jr c, .clearbit ; 0 - jr z, .setbit ; 1 - - ; check bit - ld a, [hl] - and c - ld c, a - ret - -.setbit - ; set bit - ld a, [hl] - or c - ld [hl], a - ret - -.clearbit - ; clear bit - ld a, c - cpl - and [hl] - ld [hl], a - ret -; 0x2ead +INCLUDE "home/flag.asm" -Function2ead: ; 2ead - ld de, ENGINE_POKEDEX - ld b, CHECK_FLAG - callba EngineFlagAction - ld a, c - and a - ret -; 2ebb Function2ebb: ; 2ebb ld a, [$c2cc] bit 1, a ret z ld a, [hJoyDown] - bit 1, a + bit A_BUTTON, a ret ; 2ec6 @@ -3205,7 +638,6 @@ Function2ec8: ; 2ec8 ret ; 2ecb - Function2ecb: ; 2ecb push hl ld hl, $c2cc @@ -3239,71 +671,40 @@ Function2ee4: ; 2ee4 ; 2ef6 -InitString: ; 2ef6 -; Init a string of length c. - push hl - jr _InitString -; 2ef9 +INCLUDE "home/string.asm" -InitName: ; 2ef9 -; Intended for names, so this function is limited to ten characters. - push hl - ld c, 10 -; 2efc -_InitString: ; 2efc -; if the string pointed to by hl is empty (defined as "zero or more spaces -; followed by a null"), then initialize it to the string pointed to by de. - push bc -.loop - ld a, [hli] - cp "@" - jr z, .blank - cp " " - jr nz, .notblank - dec c - jr nz, .loop -.blank - pop bc - ld l, e - ld h, d - pop de - ld b, $0 - inc c - call CopyBytes - ret -.notblank - pop bc - pop hl - ret -; 2f17 +IsInJohto: ; 2f17 +; Return 0 if the player is in Johto, and 1 in Kanto. -Function2f17: ; 2f17 ld a, [MapGroup] ld b, a ld a, [MapNumber] ld c, a call GetWorldMapLocation - cp $5f - jr z, .asm_2f39 - cp $0 - jr nz, .asm_2f35 + + cp $5f ; SS Aqua + jr z, .Johto + + cp $0 ; Poke Center 2F + jr nz, .CheckRegion + ld a, [BackupMapGroup] ld b, a ld a, [BackupMapNumber] ld c, a call GetWorldMapLocation -.asm_2f35 - cp $2f - jr nc, .asm_2f3b +.CheckRegion + cp $2f ; Pallet Town + jr nc, .Kanto -.asm_2f39 +.Johto xor a ret -.asm_2f3b - ld a, $1 +.Kanto + ld a, 1 ret ; 2f3e @@ -3312,193 +713,10 @@ Function2f3e: ; 2f3e ret ; 2f3f -DoItemEffect: ; 2f3f - callba _DoItemEffect - ret -; 2f46 -CheckTossableItem: ; 2f46 - push hl - push de - push bc - callba _CheckTossableItem - pop bc - pop de - pop hl - ret -; 2f53 - -Function2f53: ; 2f53 - push hl - push de - push bc - ld a, [hROMBank] - push af - ld a, $3 - rst Bankswitch - - call $520d - pop bc - ld a, b - rst Bankswitch - - pop bc - pop de - pop hl - ret -; 2f66 - -Function2f66: ; 2f66 - push bc - ld a, [hROMBank] - push af - ld a, $3 - rst Bankswitch - - push hl - push de - call $51d5 - pop de - pop hl - pop bc - ld a, b - rst Bankswitch - - pop bc - ret -; 2f79 - -PickUpItem: ; 2f79 - push hl - push de - push bc - ld a, [hROMBank] - push af - ld a, BANK(_PickUpItem) - rst Bankswitch - - call _PickUpItem - - pop bc - ld a, b - rst Bankswitch - pop bc - pop de - pop hl - ret -; 2f8c - - -Random: ; 2f8c -; A simple hardware-based random number generator (RNG). - -; Two random numbers are generated by adding and subtracting -; the divider to the respective values every time it's called. - -; The divider is a register that increments at a rate of 16384Hz. -; For comparison, the Game Boy operates at a clock speed of 4.2MHz. - -; Additionally, an equivalent function is executed in VBlank. - -; This leaves a with the value in hRandomSub. - - push bc - - ld a, [rDIV] - ld b, a - ld a, [hRandomAdd] - adc b - ld [hRandomAdd], a - - ld a, [rDIV] - ld b, a - ld a, [hRandomSub] - sbc b - ld [hRandomSub], a - - pop bc - ret -; 2f9f - -BattleRandom: ; 2f9f -; _BattleRandom lives in another bank. - -; It handles all RNG calls in the battle engine, allowing -; link battles to remain in sync using a shared PRNG. - - ld a, [hROMBank] - push af - ld a, BANK(_BattleRandom) - rst Bankswitch - - call _BattleRandom - - ld [$cfb6], a - pop af - rst Bankswitch - ld a, [$cfb6] - ret -; 2fb1 - - -Function2fb1: ; 2fb1 - push bc - ld c, a - xor a - sub c -.asm_2fb5 - sub c - jr nc, .asm_2fb5 - add c - ld b, a - push bc -.asm_2fbb - call Random - ld a, [hRandomAdd] - ld c, a - add b - jr c, .asm_2fbb - ld a, c - pop bc - call SimpleDivide - pop bc - ret -; 2fcb - -GetSRAMBank: ; 2fcb -; load sram bank a -; if invalid bank, sram is disabled - cp NUM_SRAM_BANKS - jr c, OpenSRAM - jr CloseSRAM -; 2fd1 - -OpenSRAM: ; 2fd1 -; switch to sram bank a - push af -; latch clock data - ld a, 1 - ld [MBC3LatchClock], a -; enable sram/clock write - ld a, SRAM_ENABLE - ld [MBC3SRamEnable], a -; select sram bank - pop af - ld [MBC3SRamBank], a - ret -; 2fe1 - -CloseSRAM: ; 2fe1 -; preserve a - push af - ld a, SRAM_DISABLE -; reset clock latch for next time - ld [MBC3LatchClock], a -; disable sram/clock write - ld [MBC3SRamEnable], a - pop af - ret -; 2fec +INCLUDE "home/item.asm" +INCLUDE "home/random.asm" +INCLUDE "home/sram.asm" ; Register aliases @@ -3513,29 +731,7 @@ _de_: ; 2fed ; 2fef -Function2fef: ; 2fef - ld hl, rKEY1 - bit 7, [hl] - jr z, Function2ffd - ret -; 2ff7 - -Function2ff7: ; 2ff7 - ld hl, rKEY1 - bit 7, [hl] - ret z -; 2ffd - -Function2ffd: ; 2ffd - set 0, [hl] - xor a - ld [rIF], a - ld [rIE], a - ld a, $30 - ld [rJOYP], a - stop ; rgbasm adds a nop after this instruction by default - ret -; 300b +INCLUDE "home/double_speed.asm" ClearSprites: ; 300b @@ -3563,139 +759,9 @@ HideSprites: ; 3016 ret ; 3026 -CopyBytes: ; 0x3026 -; copy bc bytes from hl to de - inc b ; we bail the moment b hits 0, so include the last run - inc c ; same thing; include last byte - jr .HandleLoop -.CopyByte - ld a, [hli] - ld [de], a - inc de -.HandleLoop - dec c - jr nz, .CopyByte - dec b - jr nz, .CopyByte - ret - -SwapBytes: ; 0x3034 -; swap bc bytes between hl and de -.Loop - ; stash [hl] away on the stack - ld a, [hl] - push af - - ; copy a byte from [de] to [hl] - ld a, [de] - ld [hli], a - - ; retrieve the previous value of [hl]; put it in [de] - pop af - ld [de], a - - ; handle loop stuff - inc de - dec bc - ld a, b - or c - jr nz, .Loop - ret - -ByteFill: ; 0x3041 -; fill bc bytes with the value of a, starting at hl - inc b ; we bail the moment b hits 0, so include the last run - inc c ; same thing; include last byte - jr .HandleLoop -.PutByte - ld [hli], a -.HandleLoop - dec c - jr nz, .PutByte - dec b - jr nz, .PutByte - ret - -GetFarByte: ; 0x304d -; retrieve a single byte from a:hl, and return it in a. - ; bankswitch to new bank - ld [hBuffer], a - ld a, [hROMBank] - push af - ld a, [hBuffer] - rst Bankswitch - - ; get byte from new bank - ld a, [hl] - ld [hBuffer], a - - ; bankswitch to previous bank - pop af - rst Bankswitch - - ; return retrieved value in a - ld a, [hBuffer] - ret - -GetFarHalfword: ; 0x305d -; retrieve a halfword from a:hl, and return it in hl. - ; bankswitch to new bank - ld [hBuffer], a - ld a, [hROMBank] - push af - ld a, [hBuffer] - rst Bankswitch - - ; get halfword from new bank, put it in hl - ld a, [hli] - ld h, [hl] - ld l, a - - ; bankswitch to previous bank and return - pop af - rst Bankswitch - ret -; 0x306b - -Function306b: ; 306b - ld [hBuffer], a - ld a, [rSVBK] - push af - ld a, [hBuffer] - ld [rSVBK], a - call CopyBytes - pop af - ld [rSVBK], a - ret -; 307b -Function307b: ; 307b - ld [hBuffer], a - ld a, [rSVBK] - push af - ld a, [hBuffer] - ld [rSVBK], a - ld a, [hl] - ld [hBuffer], a - pop af - ld [rSVBK], a - ld a, [hBuffer] - ret -; 308d +INCLUDE "home/copy2.asm" -Function308d: ; 308d - ld [hBuffer], a - ld a, [rSVBK] - push af - ld a, [hBuffer] - ld [rSVBK], a - ld a, [hli] - ld h, [hl] - ld l, a - pop af - ld [rSVBK], a - ret -; 309d Function309d: ; 309d ld a, [rSVBK] @@ -3795,81 +861,7 @@ AddNTimes: ; 0x30fe ; 0x3105 -SimpleMultiply: ; 3105 -; Return a * c. - and a - ret z - - push bc - ld b, a - xor a -.loop - add c - dec b - jr nz, .loop - pop bc - ret -; 3110 - - -SimpleDivide: ; 3110 -; Divide a by c. Return quotient b and remainder a. - ld b, 0 -.loop - inc b - sub c - jr nc, .loop - dec b - add c - ret -; 3119 - - -Multiply: ; 3119 -; Multiply hMultiplicand (3 bytes) by hMultiplier. Result in hProduct. -; All values are big endian. - push hl - push bc - - callab _Multiply - - pop bc - pop hl - ret -; 3124 - - -Divide: ; 3124 -; Divide hDividend length b (max 4 bytes) by hDivisor. Result in hQuotient. -; All values are big endian. - push hl - push de - push bc - ld a, [hROMBank] - push af - ld a, BANK(_Divide) - rst Bankswitch - - call _Divide - - pop af - rst Bankswitch - pop bc - pop de - pop hl - ret -; 3136 - - -SubtractSigned: ; 3136 -; Return a - b, sign in carry. - sub b - ret nc - cpl - add 1 - scf - ret -; 313d +INCLUDE "home/math.asm" PrintLetterDelay: ; 313d @@ -3958,6 +950,7 @@ PrintLetterDelay: ; 313d ret ; 318c + CopyDataUntil: ; 318c ; Copies [hl, bc) to [de, bc - hl). ; In other words, the source data is from hl up to but not including bc, @@ -3974,12 +967,15 @@ CopyDataUntil: ; 318c ret ; 0x3198 + PrintNum: ; 3198 ld a, [hROMBank] push af ld a, BANK(_PrintNum) rst Bankswitch + call _PrintNum + pop af rst Bankswitch ret @@ -3989,18 +985,18 @@ PrintNum: ; 3198 Function31a4: ; 31a4 ld a, [hROMBank] push af - ld a, $41 + ld a, BANK(Function1061ef) rst Bankswitch - call $61ef + call Function1061ef + pop af rst Bankswitch - ret ; 31b0 -Function31b0: ; 31b0 +FarPrintText: ; 31b0 ld [hBuffer], a ld a, [hROMBank] push af @@ -4008,13 +1004,14 @@ Function31b0: ; 31b0 rst Bankswitch call PrintText + pop af rst Bankswitch - ret ; 31be -Function31be: ; 31be + +CallPointerAt: ; 31be ld a, [hROMBank] push af ld a, [hli] @@ -4032,10 +1029,13 @@ Function31be: ; 31be ret ; 31cd + Function31cd: ; 31cd +; Push pointer hl in the current bank to $d0e8. ld a, [hROMBank] Function31cf: ; 31cf +; Push pointer a:hl to $d0e8. ld [$d0e8], a ld a, l ld [$d0e9], a @@ -4099,15 +1099,15 @@ Function3200: ; 0x3200 ld a, [hCGB] and a jr z, .asm_320e - ld a, $2 + ld a, 2 ld [hBGMapMode], a - ld c, $4 + ld c, 4 call DelayFrames .asm_320e - ld a, $1 + ld a, 1 ld [hBGMapMode], a - ld c, $4 + ld c, 4 call DelayFrames ret ; 0x3218 @@ -4124,9 +1124,11 @@ Function321c: ; 321c ld a, [hCGB] and a jr z, .asm_322e + ld a, [$c2ce] cp 0 jr z, .asm_322e + ld a, 1 ld [hBGMapMode], a jr Function323d @@ -4275,26 +1277,28 @@ ClearPalettes: ; 3317 ret .cgb -; Save WRAM bank ld a, [rSVBK] push af -; WRAM bank 5 + ld a, 5 ld [rSVBK], a + ; Fill BGPals and OBPals with $ffff (white) ld hl, BGPals - ld bc, $0080 + ld bc, $80 ld a, $ff call ByteFill -; Restore WRAM bank + pop af ld [rSVBK], a + ; Request palette update ld a, 1 ld [hCGBPalUpdate], a ret ; 333e + ClearSGB: ; 333e ld b, $ff GetSGBLayout: ; 3340 @@ -4368,9 +1372,9 @@ CountSetBits: ; 0x335f GetWeekday: ; 3376 ld a, [CurDay] -.loop +.mod sub 7 - jr nc, .loop + jr nc, .mod add 7 ret ; 3380 @@ -4379,39 +1383,38 @@ GetWeekday: ; 3376 SetSeenAndCaughtMon: ; 3380 push af ld c, a - ld hl, PokedexSeen - ld b, 1 - call GetWramFlag + ld hl, PokedexCaught + ld b, SET_FLAG + call PokedexFlagAction pop af ; fallthrough ; 338b -SetCaughtMon: ; 338b +SetSeenMon: ; 338b ld c, a - ld hl, PokedexCaught - ld b, 1 - jr GetWramFlag + ld hl, PokedexSeen + ld b, SET_FLAG + jr PokedexFlagAction ; 3393 -CheckSeenMon: ; 3393 +CheckCaughtMon: ; 3393 ld c, a - ld hl, PokedexSeen - ld b, 2 - jr GetWramFlag + ld hl, PokedexCaught + ld b, CHECK_FLAG + jr PokedexFlagAction ; 339b -CheckCaughtMon: ; 339b +CheckSeenMon: ; 339b ld c, a - ld hl, PokedexCaught - ld b, 2 + ld hl, PokedexSeen + ld b, CHECK_FLAG ; fallthrough ; 33a1 -GetWramFlag: ; 33a1 +PokedexFlagAction: ; 33a1 ld d, 0 ld a, PREDEF_FLAG call Predef - ld a, c and a ret @@ -5185,7 +2188,7 @@ Function3718: ; 3718 ld h, [hl] ld l, a call GetMapEventBank - call Function31b0 + call FarPrintText call WaitBGMap call Functiona80 ret @@ -11608,7 +8611,7 @@ Function5f6b: ; 5f6b bit 0, a ret z push hl - ld hl, PokedexSeen + ld hl, PokedexCaught ld b, $20 call CountSetBits pop hl @@ -14985,7 +11988,7 @@ PredefPointers: ; 856b dwb Function6508, BANK(Function6508) dwb Function747a, BANK(Function747a) dwb Functionc658, BANK(Functionc658) - dwb Function4d7c1, BANK(Function4d7c1) + dwb FlagPredef, BANK(FlagPredef) dwb Functionc699, BANK(Functionc699) dwb FillPP, BANK(FillPP) dwb Functiond88c, BANK(Functiond88c) @@ -14999,7 +12002,7 @@ PredefPointers: ; 856b dwb CanLearnTMHMMove, BANK(CanLearnTMHMMove) dwb GetTMHMMove, BANK(GetTMHMMove) dwb Function28eef, BANK(Function28eef) - dwb $4b3e, $0b ; PrintMoveDescription, BANK(PrintMoveDescription) + dwb PrintMoveDesc, BANK(PrintMoveDesc) dwb Function3df48, BANK(Function3df48) ; UpdatePlayerHUD dwb FillBox, BANK(FillBox) dwb Function3d873, BANK(Function3d873) @@ -15060,39 +12063,7 @@ PredefPointers: ; 856b ; 864c -Function864c: ; 864c -; LoadSGBLayout - call Function8d55 - jp nz, Function8d59 - ld a, b - cp $ff - jr nz, .asm_865a - ld a, [SGBPredef] - -.asm_865a - cp $fc - jp z, Function8ade - ld l, a - ld h, 0 - add hl, hl - ld de, $466f - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - ld de, Function8a60 - push de - jp [hl] -; 866f - -INCBIN "baserom.gbc", $866f, $8a60 - $866f - -Function8a60: ; 8a60 - push de - call Function9809 - pop hl - jp Function9809 -; 8a68 +INCLUDE "predef/sgb.asm" CheckShininess: ; 8a68 @@ -15137,7 +12108,7 @@ CheckShininess: ; 8a68 CheckContestMon: ; 8a88 ; Check a mon's DVs at hl in the bug catching contest. -; Return shiny if its DVs are good enough to place in the contest. +; Return carry if its DVs are good enough to place in the contest. ; Attack ld a, [hl] @@ -15233,18 +12204,18 @@ Function8ade: ; 8ade ; 8b07 Function8b07: ; 8b07 - call Function8d55 + call CheckCGB ret z ld hl, $4b2f ld de, $d000 ld bc, $0008 ld a, $5 - call Function306b + call FarCopyWRAM ld hl, $4b37 ld de, MartPointer ld bc, $0008 ld a, $5 - call Function306b + call FarCopyWRAM call Function96a4 ld a, $1 ld [hCGBPalUpdate], a @@ -15279,7 +12250,7 @@ Function8c43: ; 8c43 add hl, bc ld bc, $0004 ld a, $5 - call Function306b + call FarCopyWRAM ld a, $1 ld [hCGBPalUpdate], a ret @@ -15314,7 +12285,7 @@ Function8cb4: ; 8cb4 add hl, hl ld de, $4d05 add hl, de - call Function8d55 + call CheckCGB jr nz, .asm_8cf0 push hl ld hl, $5ce6 @@ -15342,7 +12313,7 @@ Function8cb4: ; 8cb4 ld de, $d000 ld bc, $0008 ld a, $5 - call Function306b + call FarCopyWRAM call Function96a4 call Function9699 call Function96b3 @@ -15352,231 +12323,10 @@ Function8cb4: ; 8cb4 INCBIN "baserom.gbc", $8d05, $8d55 - $8d05 -Function8d55: ; 8d55 - ld a, [hCGB] - and a - ret -; 8d59 - -Function8d59: ; 8d59 - ld a, b - cp $ff - jr nz, .asm_8d61 - ld a, [SGBPredef] - -.asm_8d61 - cp $fc - jp z, Function96f3 - call Function9673 - ld l, a - ld h, $0 - add hl, hl - ld de, $4d7a - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - ld de, Function8d79 - push de - jp [hl] -; 8d79 - -Function8d79: ; 8d79 - ret -; 8d7a - -INCBIN "baserom.gbc", $8d7a, $8db8 - $8d7a - -Function8db8: ; 8db8 - ld hl, $5c67 - ld de, $d000 - ld c, $4 - call $5615 - ld hl, $5c67 - ld de, $d020 - ld c, $4 - call $5615 - ld hl, $5c67 - ld de, MartPointer - ld c, $2 - call $5615 - jr .asm_8e23 - - ld de, $d000 - call Function9729 - push hl - call Function9643 - call Function973a - push hl - call Function9643 - ld a, [EnemyHPPal] - ld l, a - ld h, $0 - add hl, hl - add hl, hl - ld bc, $68be - add hl, bc - call Function9643 - ld a, [PlayerHPPal] - ld l, a - ld h, $0 - add hl, hl - add hl, hl - ld bc, $68be - add hl, bc - call Function9643 - ld hl, $68ca - call Function9643 - ld de, MartPointer - pop hl - call Function9643 - pop hl - call Function9643 - ld a, $1 - ld [SGBPredef], a - call Function96a4 - -.asm_8e23 - call Function8e85 - ld hl, AttrMap - ld bc, $0168 - ld a, $2 - call ByteFill - ld hl, $ce29 - ld bc, $080a - ld a, $0 - call Function9663 - ld hl, $cde3 - ld bc, $070a - ld a, $1 - call Function9663 - ld hl, AttrMap - ld bc, $040a - ld a, $2 - call Function9663 - ld hl, $ce6f - ld bc, $050a - ld a, $3 - call Function9663 - ld hl, $cebf - ld bc, $0109 - ld a, $4 - call Function9663 - ld hl, $cec9 - ld bc, $0078 - ld a, $7 - call ByteFill - ld hl, $579c - ld de, $d050 - ld bc, $0030 - ld a, $5 - call Function306b - call Function96b3 - ret -; 8e85 - - -Function8e85: ; 8e85 - ld a, $40 - ld hl, $4dc0 - rst FarCall - ld hl, $7311 - jr nc, .asm_8e93 - ld hl, $7309 - -.asm_8e93 - ld de, $d038 - ld bc, $0008 - ld a, $5 - call Function306b - ret -; 8e9f - -Function8e9f: ; 8e9f - callba Function100dc0 - ld hl, $7311 - jr nc, .asm_8ead - ld hl, $7309 - -.asm_8ead - ld de, $d000 - ld bc, $0008 - ld a, $5 - call Function306b - ret -; 8eb9 - -Function8eb9: ; 8eb9 - ld a, [PlayerGender] - bit 0, a - jr z, .asm_8ec5 - ld hl, $7759 - jr .asm_8ec8 - -.asm_8ec5 - ld hl, $7729 - -.asm_8ec8 - ld de, $d000 - ld bc, $0030 - ld a, $5 - call Function306b - call Function96a4 - ld a, $1 - ld [hCGBPalUpdate], a - ret -; 8edb +INCLUDE "predef/cgb.asm" -Function8edb: ; 8edb - ld de, $d000 - ld a, [$cda1] - ld l, a - ld h, $0 - add hl, hl - add hl, hl - ld bc, $68be - add hl, bc - call Function9643 - ld a, [CurPartySpecies] - ld bc, TempMonDVs - call Function974b - call Function9643 - ld hl, $68ca - call Function9643 - ld hl, $4f52 - ld de, $d018 - ld bc, $0018 - ld a, $5 - call Function306b - call Function9699 - ld hl, AttrMap - ld bc, $0814 - ld a, $1 - call Function9663 - ld hl, $cf23 - ld bc, $000a - ld a, $2 - call ByteFill - ld hl, $ce4a - ld bc, $0202 - ld a, $3 - call Function9663 - ld hl, $ce4c - ld bc, $0202 - ld a, $4 - call Function9663 - ld hl, $ce4e - ld bc, $0202 - ld a, $5 - call Function9663 - call Function96b3 - call Function96a4 - ld a, $1 - ld [hCGBPalUpdate], a - ret -; 8f52 -INCBIN "baserom.gbc", $8f52, $9610 - $8f52 +INCBIN "baserom.gbc", $95e0, $9610 - $95e0 Function9610: ; 9610 @@ -15716,7 +12466,7 @@ Function96a4: ; 96a4 ld de, $d080 ld bc, $0080 ld a, $5 - call Function306b + call FarCopyWRAM ret ; 96b3 @@ -15798,7 +12548,7 @@ Function971a: ; 971a ld de, MartPointer ld bc, $0010 ld a, $5 - call Function306b + call FarCopyWRAM ret ; 9729 @@ -15845,6 +12595,8 @@ Function9764: ; 9764 and a jp nz, Function97f9 ld a, [TrainerClass] + +Function976b: ; 976b ld l, a ld h, $0 add hl, hl @@ -15854,7 +12606,12 @@ Function9764: ; 9764 ret ; 9775 -INCBIN "baserom.gbc", $9775, $97ee - $9775 +Function9775: ; 9775 + call Function97ee + ret +; 9779 + +INCBIN "baserom.gbc", $9779, $97ee - $9779 Function97ee: ; 97ee ld l, a @@ -15936,7 +12693,7 @@ Function981a: ; 981a ; 9853 Function9853: ; 9853 - call Function8d55 + call CheckCGB ret nz di ld a, [$cfbe] @@ -15969,7 +12726,7 @@ Function9853: ; 9853 Function9890: ; 9890 - call Function8d55 + call CheckCGB ret z ld a, $1 ld [rVBK], a @@ -16272,7 +13029,106 @@ INCBIN "baserom.gbc", $b0ae, $b0d2 - $b0ae TrainerPalettes: INCLUDE "gfx/trainers/palette_pointers.asm" -INCBIN "baserom.gbc", $b1de, $b319 - $b1de +Functionb1de: ; b1de + callba Function494ac + jr c, .asm_b230 + ld a, [$d19a] + and $7 + ld e, a + ld d, $0 + ld hl, $7279 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [TimeOfDayPal] + and $3 + add a + add a + add a + ld e, a + ld d, $0 + add hl, de + ld e, l + ld d, h + ld a, [rSVBK] + push af + ld a, $5 + ld [rSVBK], a + ld hl, Unkn1Pals + ld b, $8 +.asm_b210 + ld a, [de] + push de + push hl + ld l, a + ld h, $0 + add hl, hl + add hl, hl + add hl, hl + ld de, MornPal + add hl, de + ld e, l + ld d, h + pop hl + ld c, $8 +.asm_b222 + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .asm_b222 + pop de + inc de + dec b + jr nz, .asm_b210 + pop af + ld [rSVBK], a + +.asm_b230 + ld a, [TimeOfDayPal] + and $3 + ld bc, $0040 + ld hl, $7469 + call AddNTimes + ld de, Unkn2Pals + ld bc, $0040 + ld a, $5 + call FarCopyWRAM + ld a, [$d19a] + cp $1 + jr z, .asm_b253 + cp $2 + ret nz + +.asm_b253 + ld a, [MapGroup] + ld l, a + ld h, $0 + add hl, hl + add hl, hl + add hl, hl + ld de, $7569 + add hl, de + ld a, [TimeOfDayPal] + and $3 + cp $2 + jr c, .asm_b26d + inc hl + inc hl + inc hl + inc hl + +.asm_b26d + ld de, $d032 + ld bc, $0004 + ld a, $5 + call FarCopyWRAM + ret +; b279 + +INCBIN "baserom.gbc", $b279, $b319 - $b279 MornPal: ; 0xb319 INCBIN "tilesets/morn.pal" @@ -16386,7 +13242,7 @@ SpecialsPointers: ; c029 dbw BANK(Function1ad2), Function1ad2 dbw BANK(Functione4a), Functione4a dbw BANK(Functionc230), Functionc230 - dbw BANK(Functionc252), Functionc252 + dbw BANK(SpecialSeenMon), SpecialSeenMon dbw BANK(WaitSFX),WaitSFX dbw BANK(Function3cdf), Function3cdf dbw BANK(Function3d47), Function3d47 @@ -16415,7 +13271,7 @@ SpecialsPointers: ; c029 dbw BANK(Functionc422), Functionc422 dbw BANK(Function4d9d3), Function4d9d3 dbw BANK(Function88018), Function88018 - dbw BANK(Functionc2b9), Functionc2b9 + dbw BANK(SpecialNameRater), SpecialNameRater dbw BANK(Functionc2da), Functionc2da dbw BANK(Function718d), Function718d dbw BANK(Function71ac), Function71ac @@ -16496,10 +13352,10 @@ SpecialsPointers: ; c029 dbw BANK(Function4a927), Function4a927 dbw BANK(Function90a54), Function90a54 dbw BANK(Function90a88), Function90a88 - dbw BANK(Functionc224), Functionc224 + dbw BANK(SpecialNone), SpecialNone ; c224 -Functionc224: ; c224 +SpecialNone: ; c224 ret ; c225 @@ -16513,7 +13369,7 @@ Functionc225: ; c225 Functionc230: ; c230 ld a, [ScriptVar] dec a - call CheckSeenMon + call CheckCaughtMon ret nz ld a, [ScriptVar] dec a @@ -16526,10 +13382,10 @@ Functionc230: ; c230 ret ; c252 -Functionc252: ; c252 +SpecialSeenMon: ; c252 ld a, [ScriptVar] dec a - call SetCaughtMon + call SetSeenMon ret ; c25a @@ -16586,8 +13442,8 @@ SpecialNameRival: ; 0xc29d DefaultRivalName: ; 0xc2b2 db "SILVER@" -Functionc2b9: ; c2b9 - callba Functionfb6ed +SpecialNameRater: ; c2b9 + callba NameRater ret ; c2c0 @@ -16643,7 +13499,7 @@ Functionc309: ; c309 ld a, $1 ld [$d10c], a ld hl, NumItems - call Function2f66 + call ReceiveItem jr nc, .asm_c33d xor a ld [$abe2], a @@ -16743,7 +13599,7 @@ Functionc3ae: ; c3ae ld a, $36 ld [CurItem], a ld hl, NumItems - call PickUpItem + call CheckItem jr nc, .asm_c3c9 and a ret @@ -18776,7 +15632,7 @@ UnknownText_0xd1d0: ; 0xd1d0 ; 0xd1d5 -Functiond1d5: ; d1d5 +_ReceiveItem: ; d1d5 call Functiond27b jp nz, Functiond29c push hl @@ -18823,7 +15679,7 @@ Functiond201: ; d201 ; d20d -Functiond20d: ; d20d +_TossItem: ; d20d call Functiond27b jr nz, .asm_d241 push hl @@ -18871,7 +15727,7 @@ Functiond20d: ; d20d jp Functiond2ff ; d244 -_PickUpItem: ; d244 +_CheckItem: ; d244 call Functiond27b jr nz, .asm_d278 push hl @@ -18929,7 +15785,7 @@ Functiond27b: ; d27b ; d283 Functiond283: ; d283 - ld c, $14 + ld c, 20 ld a, e cp TMsHMsEnd % $100 jr nz, .asm_d28e @@ -18938,7 +15794,7 @@ Functiond283: ; d283 ret z .asm_d28e - ld c, $32 + ld c, 50 ld a, e cp BallsEnd % $100 jr nz, .asm_d299 @@ -20014,7 +16870,7 @@ Functiond88c: ; d88c ld [$d265], a dec a push de - call CheckSeenMon + call CheckCaughtMon ld a, [$d265] dec a call SetSeenAndCaughtMon @@ -20920,10 +17776,10 @@ Functiondf8c: ; df8c ld a, [CurPartySpecies] dec a push af - call CheckSeenMon + call CheckCaughtMon pop af push bc - call CheckCaughtMon + call CheckSeenMon push bc call Functiond88c pop bc @@ -20934,7 +17790,7 @@ Functiondf8c: ; df8c dec a ld c, a ld d, $0 - ld hl, PokedexSeen + ld hl, PokedexCaught ld b, $0 ld a, $3 call Predef @@ -20948,7 +17804,7 @@ Functiondf8c: ; df8c dec a ld c, a ld d, $0 - ld hl, PokedexCaught + ld hl, PokedexSeen ld b, $0 ld a, $3 call Predef @@ -21974,7 +18830,7 @@ Functionf795: ; f795 ld hl, NumItems ld a, $1 ld [$d10c], a - jp Function2f53 + jp TossItem ; f7a0 Functionf7a0: ; f7a0 @@ -23606,7 +20462,7 @@ Function12434: ; 12434 ld de, CurMart ld bc, $0008 ld a, $5 - call Function306b + call FarCopyWRAM ld a, $1 ld [hCGBPalUpdate], a ret @@ -23902,9 +20758,9 @@ StartMenu: ; 125cd call .PrintMenuAccount call Function1f1a ld a, [$cf73] - cp BUTTON_B + cp B_BUTTON jr z, .b - cp BUTTON_A + cp A_BUTTON jr z, .a jr .loop .a @@ -24801,7 +21657,7 @@ Function12cdf: ; 12cdf ld a, $1 ld [$d10c], a ld hl, NumItems - jp Function2f66 + jp ReceiveItem ; 12cea INCBIN "baserom.gbc", $12cea, $12cf5 - $12cea @@ -29539,14 +26395,14 @@ Function157e9: ; 0x157e9 ld a, [$d107] ld [Buffer2], a ld hl, NumItems - call Function2f66 + call ReceiveItem jr nc, .PackFull ld a, [Buffer1] ld [$d10c], a ld a, [Buffer2] ld [$d107], a ld hl, PCItems - call Function2f53 + call TossItem ld a, $3b call Predef ld hl, .WithdrewText @@ -29720,14 +26576,14 @@ Function1590a: ; 0x1590a ld a, [$d107] ld [Buffer2], a ld hl, PCItems - call Function2f66 + call ReceiveItem jr nc, .asm_15965 ld a, [Buffer1] ld [$d10c], a ld a, [Buffer2] ld [$d107], a ld hl, NumItems - call Function2f53 + call TossItem ld a, $3b call Predef ld hl, .DepositText @@ -30295,7 +27151,7 @@ Function15cef: ; 15cef call Function1600b jr c, .asm_15d79 ld hl, NumItems - call Function2f66 + call ReceiveItem jr nc, .asm_15d6f ld a, [$d107] ld e, a @@ -30513,7 +27369,7 @@ Function15efd: ; 15efd call Function15fd7 ld a, [$d107] ld hl, NumItems - call Function2f53 + call TossItem ld a, $3b call Predef ld hl, $c5b9 @@ -31482,11 +28338,11 @@ Function16be4: ; 16be4 call Functiona57 ld a, [hJoyPressed] - and BUTTON_B + and B_BUTTON jr nz, .asm_16c95 ld a, [hJoyPressed] - and BUTTON_A + and A_BUTTON jr nz, .asm_16c82 call Function16ca0 @@ -33464,7 +30320,7 @@ Function247f0: ; 247f0 ld d, h ld e, l ld hl, $cf98 - jp Function31be + jp CallPointerAt ; 2486e Function2486e: ; 2486e @@ -33472,7 +30328,7 @@ Function2486e: ; 2486e ld d, h ld e, l ld hl, $cf98 - call Function31be + call CallPointerAt pop hl ld a, [$cf93] and a @@ -33483,7 +30339,7 @@ Function2486e: ; 2486e ld d, h ld e, l ld hl, $cf9b - call Function31be + call CallPointerAt .asm_2488a ret @@ -33536,7 +30392,7 @@ Function248b8: ; 248b8 dec a call Function248d5 ld hl, $cf9e - call Function31be + call CallPointerAt ret ; 248d5 @@ -33802,7 +30658,7 @@ Function24c64: ; 24c64 push hl ld [CurItem], a ld hl, NumItems - call PickUpItem + call CheckItem pop hl jr nc, .asm_24c89 ld a, [hl] @@ -34573,13 +31429,13 @@ Function26601: ; 0x26601 Rate: ; 0x26616 ; calculate Seen/Owned - ld hl, PokedexCaught - ld b, EndPokedexCaught - PokedexCaught - call CountSetBits - ld [DefaultFlypoint], a ld hl, PokedexSeen ld b, EndPokedexSeen - PokedexSeen call CountSetBits + ld [DefaultFlypoint], a + ld hl, PokedexCaught + ld b, EndPokedexCaught - PokedexCaught + call CountSetBits ld [$d003], a ; print appropriate rating @@ -38565,7 +35421,7 @@ Function2a200: ; 2a200 jr .asm_2a27a .asm_2a235 - call Function2f17 + call IsInJohto and a ret z ld h, d @@ -38978,7 +35834,7 @@ Function2a4ab: ; 2a4ab push bc dec c ld a, c - call CheckCaughtMon + call CheckSeenMon pop bc jr nz, .asm_2a514 ld de, StringBuffer1 @@ -39470,7 +36326,7 @@ Function2c0c5: ; 2c0c5 ret nz ld a, [TempEnemyMonSpecies] dec a - call CheckSeenMon + call CheckCaughtMon ret z ld hl, $c4b5 ld [hl], $5d @@ -39844,7 +36700,7 @@ Function2c7fb: ; 2c7fb INCBIN "baserom.gbc", $2c867, $2cb3e - $2c867 -PrintMoveDescription: ; 2cb3e +PrintMoveDesc: ; 2cb3e push hl ld hl, MoveDescriptions ld a, [CurSpecies] @@ -47690,7 +44546,7 @@ LoadEnemyMon: ; 3e8eb dec a ld c, a ld b, 1 ; set - ld hl, PokedexCaught + ld hl, PokedexSeen ld a, PREDEF_FLAG call Predef @@ -50982,7 +47838,7 @@ Function40bd0: ; 40bd0 push hl ld a, [$d265] dec a - call CheckCaughtMon + call CheckSeenMon pop hl pop de ret @@ -51896,171 +48752,7 @@ INCLUDE "stats/evos_attacks.asm" SECTION "bank11",ROMX,BANK[$11] -FruitTreeScript: ; 44000 - 3callasm BANK(GetCurTreeFruit), GetCurTreeFruit - loadfont - copybytetovar CurFruit - itemtotext $0, $0 - 2writetext FruitBearingTreeText - keeptextopen - 3callasm BANK(TryResetFruitTrees), TryResetFruitTrees - 3callasm BANK(CheckFruitTree), CheckFruitTree - iffalse .fruit - 2writetext NothingHereText - closetext - 2jump .end - -.fruit - 2writetext HeyItsFruitText - copybytetovar CurFruit - giveitem $ff, 1 - iffalse .packisfull - keeptextopen - 2writetext ObtainedFruitText - 3callasm BANK(PickedFruitTree), PickedFruitTree - specialsound - itemnotify - 2jump .end - -.packisfull - keeptextopen - 2writetext FruitPackIsFullText - closetext - -.end - loadmovesprites - end -; 44041 - -GetCurTreeFruit: ; 44041 - ld a, [CurFruitTree] - dec a - call GetFruitTreeItem - ld [CurFruit], a - ret -; 4404c - -TryResetFruitTrees: ; 4404c - ld hl, $dc1e - bit 4, [hl] - ret nz - jp ResetFruitTrees -; 44055 - -CheckFruitTree: ; 44055 - ld b, 2 - call GetFruitTreeFlag - ld a, c - ld [ScriptVar], a - ret -; 4405f - -PickedFruitTree: ; 4405f - ld a, $41 - ld hl, $609b - rst FarCall ; empty function - - ld b, 1 - jp GetFruitTreeFlag -; 4406a - -ResetFruitTrees: ; 4406a - xor a - ld hl, FruitTreeFlags - ld [hli], a - ld [hli], a - ld [hli], a - ld [hl], a - ld hl, $dc1e - set 4, [hl] - ret -; 44078 - -GetFruitTreeFlag: ; 44078 - push hl - push de - ld a, [CurFruitTree] - dec a - ld e, a - ld d, 0 - ld hl, FruitTreeFlags - call FlagAction - pop de - pop hl - ret -; 4408a - -GetFruitTreeItem: ; 4408a - push hl - push de - ld e, a - ld d, 0 - ld hl, FruitTreeItems - add hl, de - ld a, [hl] - pop de - pop hl - ret -; 44097 - -FruitTreeItems: ; 44097 - db BERRY - db BERRY - db BERRY - db BERRY - db PSNCUREBERRY - db PSNCUREBERRY - db BITTER_BERRY - db BITTER_BERRY - db PRZCUREBERRY - db PRZCUREBERRY - db MYSTERYBERRY - db MYSTERYBERRY - db ICE_BERRY - db ICE_BERRY - db MINT_BERRY - db BURNT_BERRY - db RED_APRICORN - db BLU_APRICORN - db BLK_APRICORN - db WHT_APRICORN - db PNK_APRICORN - db GRN_APRICORN - db YLW_APRICORN - db BERRY - db PSNCUREBERRY - db BITTER_BERRY - db PRZCUREBERRY - db ICE_BERRY - db MINT_BERRY - db BURNT_BERRY -; 440b5 - -FruitBearingTreeText: ; 440b5 - text_jump _FruitBearingTreeText, BANK(_FruitBearingTreeText) - db "@" -; 440ba - -HeyItsFruitText: ; 440ba - text_jump _HeyItsFruitText, BANK(_HeyItsFruitText) - db "@" -; 440bf - -ObtainedFruitText: ; 440bf - text_jump _ObtainedFruitText, BANK(_ObtainedFruitText) - db "@" -; 440c4 - -FruitPackIsFullText: ; 440c4 - text_jump _FruitPackIsFullText, BANK(_FruitPackIsFullText) - db "@" -; 440c9 - -NothingHereText: ; 440c9 - text_jump _NothingHereText, BANK(_NothingHereText) - db "@" -; 440ce - +INCLUDE "engine/fruit_trees.asm" AIChooseMove: ; 440ce @@ -52358,7 +49050,7 @@ Function4424d: ; 4424d call PrintNum ld a, [$d265] dec a - call CheckSeenMon + call CheckCaughtMon pop hl pop bc ret z @@ -52835,7 +49527,7 @@ Function4484a: ; 0x4484a ld a, $1 ld [$d10c], a ld hl, NumItems - call Function2f66 + call ReceiveItem jr c, .asm_4489e ld hl, .PackFullText jp Function1d67 @@ -53127,7 +49819,7 @@ Function492b9: ; 492b9 pop de ld a, $b ld hl, $48ce - call Function31b0 + call FarPrintText jr .asm_49300 .asm_492e5 @@ -53182,11 +49874,147 @@ Function49409: ; 49409 ld de, $d038 ld bc, $0008 ld a, $5 - call Function306b + call FarCopyWRAM ret ; 49418 -INCBIN "baserom.gbc", $49418, $49797 - $49418 +INCBIN "baserom.gbc", $49418, $494ac - $49418 + +Function494ac: ; 494ac + ld a, [$d199] + cp $15 + jr z, .asm_494c9 + cp $16 + jr z, .asm_494ce + cp $1d + jr z, .asm_494d3 + cp $5 + jr z, .asm_494e1 + cp $1b + jr z, .asm_494e6 + cp $d + jr z, .asm_494eb + jr .asm_494f0 + +.asm_494c9 + call Function494f2 + scf + ret + +.asm_494ce + call Function49541 + scf + ret + +.asm_494d3 + ld a, [$d19a] + and $7 + cp $3 + jr z, .asm_494f0 + call Function49590 + scf + ret + +.asm_494e1 + call Function495df + scf + ret + +.asm_494e6 + call Function4962e + scf + ret + +.asm_494eb + call Function496c5 + scf + ret + +.asm_494f0 + and a + ret +; 494f2 + +Function494f2: ; 494f2 + ld a, $5 + ld de, Unkn1Pals + ld hl, $5501 + ld bc, $0040 + call FarCopyWRAM + ret +; 49501 + +INCBIN "baserom.gbc", $49501, $49541 - $49501 + +Function49541: ; 49541 + ld a, $5 + ld de, Unkn1Pals + ld hl, $5550 + ld bc, $0040 + call FarCopyWRAM + ret +; 49550 + +INCBIN "baserom.gbc", $49550, $49590 - $49550 + +Function49590: ; 49590 + ld a, $5 + ld de, Unkn1Pals + ld hl, $559f + ld bc, $0040 + call FarCopyWRAM + ret +; 4959f + +INCBIN "baserom.gbc", $4959f, $495df - $4959f + +Function495df: ; 495df + ld a, $5 + ld de, Unkn1Pals + ld hl, $55ee + ld bc, $0040 + call FarCopyWRAM + ret +; 495ee + +INCBIN "baserom.gbc", $495ee, $4962e - $495ee + +Function4962e: ; 4962e + ld a, $5 + ld de, Unkn1Pals + ld hl, $563d + ld bc, $0040 + call FarCopyWRAM + ret +; 4963d + +INCBIN "baserom.gbc", $4963d, $496c5 - $4963d + +Function496c5: ; 496c5 + ld a, $5 + ld de, Unkn1Pals + ld hl, $567d + ld bc, $0040 + call FarCopyWRAM + ld a, $5 + ld de, $d020 + ld hl, $56fe + ld bc, $0008 + call FarCopyWRAM + ld a, $5 + ld de, $d018 + ld hl, $56ad + ld bc, $0008 + call FarCopyWRAM + ld a, $5 + ld de, $d030 + ld hl, $56bd + ld bc, $0008 + call FarCopyWRAM + ret +; 496fe + +INCBIN "baserom.gbc", $496fe, $49797 - $496fe Function49797: ; 49797 ld hl, AttrMap @@ -53245,7 +50073,7 @@ Function49811: ; 49811 ld de, $d010 ld bc, $0030 ld a, $5 - call Function306b + call FarCopyWRAM callba Function96a4 ret ; 49826 @@ -54249,12 +51077,12 @@ Function4a927: ; 4a927 ld a, [ScriptVar] ld [CurItem], a ld hl, PCItems - call PickUpItem + call CheckItem jr c, .asm_4a948 ld a, [ScriptVar] ld [CurItem], a ld hl, NumItems - call PickUpItem + call CheckItem jr c, .asm_4a948 xor a ld [ScriptVar], a @@ -55796,57 +52624,73 @@ INCBIN "baserom.gbc", $4d580, $4d596 - $4d580 Tilesets: INCLUDE "tilesets/tileset_headers.asm" -Function4d7c1: ; 4d7c1 + +FlagPredef: ; 4d7c1 +; Perform action b on flag c in flag array hl. +; If checking a flag, check flag array d:hl unless d is 0. + +; For longer flag arrays, see FlagAction. + push hl push bc + +; Divide by 8 to get the byte we want. push bc srl c srl c srl c - ld b, $0 + ld b, 0 add hl, bc pop bc + +; Which bit we want from the byte ld a, c - and $7 + and 7 ld c, a - ld a, $1 - jr z, .asm_4d7da -.asm_4d7d6 + +; Shift left until we can mask the bit + ld a, 1 + jr z, .shifted +.shift add a dec c - jr nz, .asm_4d7d6 - -.asm_4d7da + jr nz, .shift +.shifted ld c, a + +; What are we doing to this flag? dec b - jr z, .asm_4d7e7 + jr z, .set ; 1 dec b - jr z, .asm_4d7ec + jr z, .check ; 2 + +.reset ld a, c cpl and [hl] ld [hl], a - jr .asm_4d7f9 + jr .done -.asm_4d7e7 +.set ld a, [hl] or c ld [hl], a - jr .asm_4d7f9 + jr .done -.asm_4d7ec +.check ld a, d - cp $0 - jr nz, .asm_4d7f5 + cp 0 + jr nz, .farcheck + ld a, [hl] and c - jr .asm_4d7f9 + jr .done -.asm_4d7f5 +.farcheck call GetFarByte and c -.asm_4d7f9 +.done pop bc pop hl ld c, a @@ -57294,7 +54138,7 @@ Function4ea0a: ; 4ea0a ld de, $cd53 ld bc, $000c ld a, $5 - call Function306b + call FarCopyWRAM ld a, [rSVBK] push af ld a, $1 @@ -57316,7 +54160,7 @@ Function4ea0a: ; 4ea0a Function4ea44: ; 4ea44 ld a, $0 ld hl, InLinkBattle - call Function307b + call GetFarWRAMByte cp $4 jr z, .asm_4ea59 ld a, [Options] @@ -57343,7 +54187,7 @@ Function4ea44: ; 4ea44 .asm_4ea72 ld a, $5 ld hl, $dc00 - call Function307b + call GetFarWRAMByte bit 0, a jr z, .asm_4ea80 and a @@ -59140,163 +55984,124 @@ Function508d5: ; 508d5 ; 5090d -PrintMonTypes: ; 5090d - push hl - call GetBaseData - pop hl - push hl - ld a, [BaseType1] - call .asm_50928 - ld a, [BaseType1] - ld b, a - ld a, [BaseType2] - cp b - pop hl - jr z, .asm_5092b - ld bc, 20 - add hl, bc +INCLUDE "text/types.asm" -.asm_50928 - ld b, a - jr PrintType -.asm_5092b - ld a, " " - ld bc, 20 - 3 +Function50a28: ; 50a28 + ld hl, Strings50a42 + ld a, [TrainerClass] + dec a + ld c, a + ld b, 0 add hl, bc - ld [hl], a - inc bc add hl, bc - ld bc, 5 - jp ByteFill -; 5093a - -PrintMoveType: ; 5093a -; Print the type of move b at hl. - - push hl - ld a, b - dec a - ld bc, Move2 - Move1 - ld hl, Moves - call AddNTimes - ld de, StringBuffer1 - ld a, BANK(Moves) - call FarCopyBytes - ld a, [StringBuffer1 + PlayerMoveType - PlayerMoveStruct] - pop hl - - ld b, a -; 50953 - -PrintType: ; 50953 -; Print type b at hl. - ld a, b - - push hl - add a - ld hl, TypeNames - ld e, a - ld d, 0 - add hl, de - ld a, [hli] - ld e, a - ld d, [hl] - pop hl - - jp PlaceString -; 50964 - - -GetTypeName: ; 50964 -; Copy the name of type $d265 to StringBuffer1. - ld a, [$d265] - ld hl, TypeNames - ld e, a - ld d, 0 - add hl, de - add hl, de ld a, [hli] ld h, [hl] ld l, a ld de, StringBuffer1 - ld bc, $000d - jp CopyBytes -; 5097b - - -TypeNames: ; 5097b - dw Normal - dw Fighting - dw Flying - dw Poison - dw Ground - dw Rock - dw Bird - dw Bug - dw Ghost - dw Steel - dw Normal - dw Normal - dw Normal - dw Normal - dw Normal - dw Normal - dw Normal - dw Normal - dw Normal - dw UnknownType - dw Fire - dw Water - dw Grass - dw Electric - dw Psychic - dw Ice - dw Dragon - dw Dark - -Normal: - db "NORMAL@" -Fighting: - db "FIGHTING@" -Flying: - db "FLYING@" -Poison: - db "POISON@" -UnknownType: - db "???@" -Fire: - db "FIRE@" -Water: - db "WATER@" -Grass: - db "GRASS@" -Electric: - db "ELECTRIC@" -Psychic: - db "PSYCHIC@" -Ice: - db "ICE@" -Ground: - db "GROUND@" -Rock: - db "ROCK@" -Bird: - db "BIRD@" -Bug: - db "BUG@" -Ghost: - db "GHOST@" -Steel: - db "STEEL@" -Dragon: - db "DRAGON@" -Dark: - db "DARK@" -; 50a28 - - -INCBIN "baserom.gbc", $50a28, $50b0a - $50a28 +.copy + ld a, [hli] + ld [de], a + inc de + cp "@" + jr nz, .copy + ret +; 50a42 + +Strings50a42: ; 50a42 +; Untranslated trainer class names from Red. + + dw .Youngster + dw .BugCatcher + dw .Lass + dw OTName + dw .JrTrainerM + dw .JrTrainerF + dw .Pokemaniac + dw .SuperNerd + dw OTName + dw OTName + dw .Burglar + dw .Engineer + dw .Jack + dw OTName + dw .Swimmer + dw OTName + dw OTName + dw .Beauty + dw OTName + dw .Rocker + dw .Juggler + dw OTName + dw OTName + dw .Blackbelt + dw OTName + dw .ProfOak + dw .Chief + dw .Scientist + dw OTName + dw .Rocket + dw .CooltrainerM + dw .CooltrainerF + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + dw OTName + +.Youngster + db "たんパン@" +.BugCatcher + db "むしとり@" +.Lass + db "ミニスカ@" +.JrTrainerM + db "ボーイ@" +.JrTrainerF + db "ガール@" +.Pokemaniac + db "マニア@" +.SuperNerd + db "りかけい@" +.Burglar + db "どろぼう@" +.Engineer + db "ォヤジ@" +.Jack + db "ジャック@" +.Swimmer + db "かいパン@" +.Beauty + db "おねえさん@" +.Rocker + db "グループ@" +.Juggler + db "ジャグラー@" +.Blackbelt + db "からて@" +.ProfOak + db "ォーキド@" +.Chief + db "チーフ@" +.Scientist + db "けんきゅういん@" +.Rocket + db "だんいん@" +.CooltrainerM + db "エりート♂@" +.CooltrainerF + db "エりート♀@" +; 50b0a DrawPlayerHP: ; 50b0a @@ -60147,7 +56952,7 @@ Function51103: ; 51103 push hl ld a, $1 ld hl, BasePicSize - call Function307b + call GetFarWRAMByte pop hl and $f ld de, $d990 @@ -61361,7 +58166,7 @@ CheckForcedMovementInput: ; 802cb ld hl, .data_802e8 add hl, de ld a, [CurInput] - and BUTTON_A | BUTTON_B | SELECT | START + and A_BUTTON | B_BUTTON | SELECT | START or [hl] ld [CurInput], a ret @@ -63329,7 +60134,7 @@ Function88211: ; 88211 ld hl, NumItems ld a, b ld [$d10c], a - call Function2f53 + call TossItem pop bc ld a, c sub b @@ -65169,7 +61974,7 @@ Function8adef: ; 8adef ld a, WATER_STONE ld [CurItem], a ld hl, NumItems - call PickUpItem + call CheckItem jr c, .asm_8ae24 ld a, [PartyCount] @@ -65489,7 +62294,7 @@ Function8afd4: ; 8afd4 ld a, $1 ld [$d10c], a ld hl, NumItems - call Function2f66 + call ReceiveItem pop hl jr nc, .asm_8b04c ld a, [hl] @@ -70802,7 +67607,7 @@ OWPlayerInput: ; 96974 CheckAPressOW: ; 96999 ld a, [hJoyPressed] - and BUTTON_A + and A_BUTTON ret z call TryObjectEvent ret c @@ -72429,40 +69234,46 @@ Functionb81e2: ; b81e2 INCBIN "baserom.gbc", $b81ea, $b8219 - $b81ea Functionb8219: ; b8219 -; deals strictly with rockmon encounter +; get a RockMon encounter + xor a ld [$d22e], a ld [CurPartyLevel], a - ld hl, WildRockMonMapTable + + ld hl, RockMonMaps call GetTreeMonEncounterTable jr nc, .quit - call LoadWildTreeMonData + + call LoadTreeMonData jr nc, .quit - ld a, $0a + + ld a, 10 call Function2fb1 - cp a, $04 + cp 4 jr nc, .quit - call $441f + + call Functionb841f jr nc, .quit + ret + .quit xor a ret ; b823e -db $05 ; ???? + db $05 ; ???? GetTreeMonEncounterTable: ; b823f -; reads a map-sensitive encounter table -; compares current map with maps in the table -; if there is a match, encounter table # is loaded into a +; Return carry and table id in a +; if MapGroup and MapNumber are in table hl ld a, [MapNumber] ld e, a ld a, [MapGroup] ld d, a .loop ld a, [hli] - cp a, $ff + cp $ff jr z, .quit cp d jr nz, .skip2 @@ -72486,55 +69297,60 @@ GetTreeMonEncounterTable: ; b823f INCBIN "baserom.gbc", $B825E, $b82c5 - $b825e -WildRockMonMapTable: ; b82c5 - db GROUP_CIANWOOD_CITY, MAP_CIANWOOD_CITY, $07 - db GROUP_ROUTE_40, MAP_ROUTE_40, $07 - db GROUP_DARK_CAVE_VIOLET_ENTRANCE, MAP_DARK_CAVE_VIOLET_ENTRANCE, $07 - db GROUP_SLOWPOKE_WELL_B1F, MAP_SLOWPOKE_WELL_B1F, $07 +RockMonMaps: ; b82c5 + db GROUP_CIANWOOD_CITY, MAP_CIANWOOD_CITY, 7 + db GROUP_ROUTE_40, MAP_ROUTE_40, 7 + db GROUP_DARK_CAVE_VIOLET_ENTRANCE, MAP_DARK_CAVE_VIOLET_ENTRANCE, 7 + db GROUP_SLOWPOKE_WELL_B1F, MAP_SLOWPOKE_WELL_B1F, 7 db $ff ; end ; b82d2 -LoadWildTreeMonData: ; b82d2 -; input: a = table number -; returns wildtreemontable pointer in hl -; sets carry if successful - cp a, $08 ; which table? - jr nc, .quit ; only 8 tables +LoadTreeMonData: ; b82d2 +; Return TreeMon pointer a in hl +; Return carry on success + +; only 7 tables + cp 8 + jr nc, .quit + and a - jr z, .quit ; 0 is invalid + jr z, .quit + ld e, a - ld d, $00 - ld hl, WildTreeMonPointerTable + ld d, 0 + ld hl, TreeMonPointers add hl, de add hl, de - ld a, [hli] ; store pointer in hl + + ld a, [hli] ld h, [hl] ld l, a + scf ret + .quit xor a ret ; b82e8 -WildTreeMonPointerTable: ; b82e8 +TreeMonPointers: ; b82e8 ; seems to point to "normal" tree encounter data -; as such only odd-numbered tables are used -; rockmon is 13th - dw WildTreeMonTable1 ; filler - dw WildTreeMonTable1 ; 1 - dw WildTreeMonTable3 ; 2 - dw WildTreeMonTable5 ; 3 - dw WildTreeMonTable7 ; 4 - dw WildTreeMonTable9 ; 5 - dw WildTreeMonTable11 ; 6 - dw WildRockMonTable ; 7 - dw WildTreeMonTable1 ; 8 +; so only odd-numbered tables are used + dw TreeMons1 ; filler + dw TreeMons1 ; 1 + dw TreeMons3 ; 2 + dw TreeMons5 ; 3 + dw TreeMons7 ; 4 + dw TreeMons9 ; 5 + dw TreeMons11 ; 6 + dw RockMons ; 7 + dw TreeMons1 ; filler ; b82fa ; structure: % species level -WildTreeMonTable1: ; b82fa +TreeMons1: ; b82fa db 50, SPEAROW, 10 db 15, SPEAROW, 10 db 15, SPEAROW, 10 @@ -72544,7 +69360,7 @@ WildTreeMonTable1: ; b82fa db $ff ; end ; b830d -WildTreeMonTable2 ; b830d +TreeMons2 ; b830d ; unused db 50, SPEAROW, 10 db 15, HERACROSS, 10 @@ -72555,7 +69371,7 @@ WildTreeMonTable2 ; b830d db $ff ; end ; b8320 -WildTreeMonTable3: ; b8320 +TreeMons3: ; b8320 db 50, SPEAROW, 10 db 15, EKANS, 10 db 15, SPEAROW, 10 @@ -72565,7 +69381,7 @@ WildTreeMonTable3: ; b8320 db $ff ; end ; b8333 -WildTreeMonTable4: ; b8333 +TreeMons4: ; b8333 ; unused db 50, SPEAROW, 10 db 15, HERACROSS, 10 @@ -72576,7 +69392,7 @@ WildTreeMonTable4: ; b8333 db $ff ; end ; b8346 -WildTreeMonTable5: ; b8346 +TreeMons5: ; b8346 db 50, HOOTHOOT, 10 db 15, SPINARAK, 10 db 15, LEDYBA, 10 @@ -72586,7 +69402,7 @@ WildTreeMonTable5: ; b8346 db $ff ; end ; b8359 -WildTreeMonTable6: ; b8359 +TreeMons6: ; b8359 ; unused db 50, HOOTHOOT, 10 db 15, PINECO, 10 @@ -72597,7 +69413,7 @@ WildTreeMonTable6: ; b8359 db $ff ; end ; b836c -WildTreeMonTable7: ; b836c +TreeMons7: ; b836c db 50, HOOTHOOT, 10 db 15, EKANS, 10 db 15, HOOTHOOT, 10 @@ -72607,7 +69423,7 @@ WildTreeMonTable7: ; b836c db $ff ; end ; b837f -WildTreeMonTable8: ; b837f +TreeMons8: ; b837f ; unused db 50, HOOTHOOT, 10 db 15, PINECO, 10 @@ -72618,7 +69434,7 @@ WildTreeMonTable8: ; b837f db $ff ; end ; b8392 -WildTreeMonTable9: ; b8392 +TreeMons9: ; b8392 db 50, HOOTHOOT, 10 db 15, VENONAT, 10 db 15, HOOTHOOT, 10 @@ -72628,7 +69444,7 @@ WildTreeMonTable9: ; b8392 db $ff ; end ; b83a5 -WildTreeMonTable10: ; b83a5 +TreeMons10: ; b83a5 ; unused db 50, HOOTHOOT, 10 db 15, PINECO, 10 @@ -72639,7 +69455,7 @@ WildTreeMonTable10: ; b83a5 db $ff ; end ; b83b8 -WildTreeMonTable11: ; b83b8 +TreeMons11: ; b83b8 db 50, HOOTHOOT, 10 db 15, PINECO, 10 db 15, PINECO, 10 @@ -72649,7 +69465,7 @@ WildTreeMonTable11: ; b83b8 db $ff ; end ; b83cb -WildTreeMonTable12; b83cb +TreeMons12; b83cb ; unused db 50, HOOTHOOT, 10 db 15, CATERPIE, 10 @@ -72660,13 +69476,46 @@ WildTreeMonTable12; b83cb db $ff ; end ; b83de -WildRockMonTable: ; b83de +RockMons: ; b83de db 90, KRABBY, 15 db 10, SHUCKLE, 15 db $ff ; end ; b83e5 -INCBIN "baserom.gbc", $b83e5, $b8f8f - $b83e5 +INCBIN "baserom.gbc", $b83e5, $b841f - $b83e5 + +Functionb841f: ; b841f +; Read a TreeMons table. + + ld a, 100 + call Function2fb1 +.asm_b8424 + sub [hl] + jr c, .asm_b842c + inc hl + inc hl + inc hl + jr .asm_b8424 + +.asm_b842c + ld a, [hli] + cp $ff + jr z, .asm_b843b + ld a, [hli] + ld [$d22e], a + ld a, [hl] + ld [CurPartyLevel], a + scf + ret + +.asm_b843b + xor a + ld [$d22e], a + ld [CurPartyLevel], a + ret +; b8443 + +INCBIN "baserom.gbc", $b8443, $b8f8f - $b8443 Functionb8f8f: ; b8f8f ld a, c @@ -72850,2593 +69699,7 @@ ItemIsMail: ; b9e76 SECTION "bank2F",ROMX,BANK[$2F] -StdScripts: ; bc000 - dbw BANK(PokeCenterNurseScript), PokeCenterNurseScript - dbw BANK(UnknownScript_0xbc162), UnknownScript_0xbc162 - dbw BANK(UnknownScript_0xbc166), UnknownScript_0xbc166 - dbw BANK(UnknownScript_0xbc16a), UnknownScript_0xbc16a - dbw BANK(UnknownScript_0xbc16e), UnknownScript_0xbc16e - dbw BANK(UnknownScript_0xbc172), UnknownScript_0xbc172 - dbw BANK(UnknownScript_0xbc176), UnknownScript_0xbc176 - dbw BANK(UnknownScript_0xbc17a), UnknownScript_0xbc17a - dbw BANK(UnknownScript_0xbc185), UnknownScript_0xbc185 - dbw BANK(UnknownScript_0xbc189), UnknownScript_0xbc189 - dbw BANK(UnknownScript_0xbc191), UnknownScript_0xbc191 - dbw BANK(UnknownScript_0xbc195), UnknownScript_0xbc195 - dbw BANK(UnknownScript_0xbc19d), UnknownScript_0xbc19d - dbw BANK(UnknownScript_0xbc1a5), UnknownScript_0xbc1a5 - dbw BANK(UnknownScript_0xbc1b8), UnknownScript_0xbc1b8 - dbw BANK(UnknownScript_0xbc1bc), UnknownScript_0xbc1bc - dbw BANK(UnknownScript_0xbc1c0), UnknownScript_0xbc1c0 - dbw BANK(UnknownScript_0xbc1c4), UnknownScript_0xbc1c4 - dbw BANK(UnknownScript_0xbc23e), UnknownScript_0xbc23e - dbw BANK(UnknownScript_0xbc242), UnknownScript_0xbc242 - dbw BANK(UnknownScript_0xbc1af), UnknownScript_0xbc1af - dbw BANK(UnknownScript_0xbc1c8), UnknownScript_0xbc1c8 - dbw BANK(UnknownScript_0xbc25c), UnknownScript_0xbc25c - dbw BANK(UnknownScript_0xbc274), UnknownScript_0xbc274 - dbw BANK(UnknownScript_0xbc3db), UnknownScript_0xbc3db - dbw BANK(UnknownScript_0xbc574), UnknownScript_0xbc574 - dbw BANK(UnknownScript_0xbc62d), UnknownScript_0xbc62d - dbw BANK(UnknownScript_0xbc6e6), UnknownScript_0xbc6e6 - dbw BANK(UnknownScript_0xbc6f0), UnknownScript_0xbc6f0 - dbw BANK(UnknownScript_0xbc7ce), UnknownScript_0xbc7ce - dbw BANK(UnknownScript_0xbc8ac), UnknownScript_0xbc8ac - dbw BANK(UnknownScript_0xbc98a), UnknownScript_0xbc98a - dbw BANK(UnknownScript_0xbca47), UnknownScript_0xbca47 - dbw BANK(UnknownScript_0xbca8f), UnknownScript_0xbca8f - dbw BANK(UnknownScript_0xbcb0a), UnknownScript_0xbcb0a - dbw BANK(UnknownScript_0xbcb35), UnknownScript_0xbcb35 - dbw BANK(UnknownScript_0xbcb7f), UnknownScript_0xbcb7f - dbw BANK(UnknownScript_0xbcbc9), UnknownScript_0xbcbc9 - dbw BANK(UnknownScript_0xbcbd3), UnknownScript_0xbcbd3 - dbw BANK(UnknownScript_0xbcc2d), UnknownScript_0xbcc2d - dbw BANK(UnknownScript_0xbcc87), UnknownScript_0xbcc87 - dbw BANK(UnknownScript_0xbcce1), UnknownScript_0xbcce1 - dbw BANK(UnknownScript_0xbcd30), UnknownScript_0xbcd30 - dbw BANK(UnknownScript_0xbcd5a), UnknownScript_0xbcd5a - dbw BANK(UnknownScript_0xbcd93), UnknownScript_0xbcd93 - dbw BANK(UnknownScript_0xbcda0), UnknownScript_0xbcda0 - dbw BANK(UnknownScript_0xbcdaa), UnknownScript_0xbcdaa - dbw BANK(UnknownScript_0xbcdb9), UnknownScript_0xbcdb9 - dbw BANK(UnknownScript_0xbcdc3), UnknownScript_0xbcdc3 - dbw BANK(UnknownScript_0xbc1a9), UnknownScript_0xbc1a9 - dbw BANK(UnknownScript_0xbcdcd), UnknownScript_0xbcdcd - dbw BANK(UnknownScript_0xbce7f), UnknownScript_0xbce7f -; bc09c - -PokeCenterNurseScript: ; bc09c -; Talking to a nurse in a Pokemon Center - - loadfont -; The nurse has different text for: -; Morn - checktime $1 - iftrue .morn -; Day - checktime $2 - iftrue .day -; Nite - checktime $4 - iftrue .nite -; If somehow it's not a time of day at all, we skip the introduction - 2jump .heal - -.morn -; Different text if we're in the com center - checkbit1 $032a - iftrue .morn_comcenter -; Good morning! Welcome to ... - 3writetext BANK(UnknownText_0x1b0000), UnknownText_0x1b0000 - keeptextopen - 2jump .heal -.morn_comcenter -; Good morning! This is the ... - 3writetext BANK(UnknownText_0x1b008a), UnknownText_0x1b008a - keeptextopen - 2jump .heal - -.day -; Different text if we're in the com center - checkbit1 $032a - iftrue .day_comcenter -; Hello! Welcome to ... - 3writetext BANK(UnknownText_0x1b002b), UnknownText_0x1b002b - keeptextopen - 2jump .heal -.day_comcenter -; Hello! This is the ... - 3writetext BANK(UnknownText_0x1b00d6), UnknownText_0x1b00d6 - keeptextopen - 2jump .heal - -.nite -; Different text if we're in the com center - checkbit1 $032a - iftrue .nite_comcenter -; Good evening! You're out late. ... - 3writetext BANK(UnknownText_0x1b004f), UnknownText_0x1b004f - keeptextopen - 2jump .heal -.nite_comcenter -; Good to see you working so late. ... - 3writetext BANK(UnknownText_0x1b011b), UnknownText_0x1b011b - keeptextopen - 2jump .heal - -.heal -; If we come back, don't welcome us to the com center again - clearbit1 $032a -; Ask if you want to heal - 3writetext BANK(UnknownText_0x1b017a), UnknownText_0x1b017a - yesorno - iffalse .end -; Go ahead and heal - 3writetext BANK(UnknownText_0x1b01bd), UnknownText_0x1b01bd - pause 20 - special $009d -; Turn to the machine - spriteface $fe, $2 - pause 10 - special $001b - playmusic $0000 - writebyte $0 - special $003e - pause 30 - special $003d - spriteface $fe, $0 - pause 10 -; Has Elm already phoned you about Pokerus? - checkphonecall - iftrue .done -; Has Pokerus already been found in the Pokecenter? - checkbit2 $000d - iftrue .done -; Check for Pokerus - special $004e ; SPECIAL_CHECKPOKERUS - iftrue .pokerus -.done -; Thank you for waiting. ... - 3writetext BANK(UnknownText_0x1b01d7), UnknownText_0x1b01d7 - pause 20 -.end -; We hope to see you again. - 3writetext BANK(UnknownText_0x1b020b), UnknownText_0x1b020b -; Curtsy - spriteface $fe, $1 - pause 10 - spriteface $fe, $0 - pause 10 -; And we're out - closetext - loadmovesprites - end - -.pokerus -; Different text for com center (excludes 'in a Pokemon Center') -; Since flag $32a is cleared when healing, -; this text is never actually seen - checkbit1 $032a - iftrue .pokerus_comcenter -; Your Pokemon appear to be infected ... - 3writetext BANK(UnknownText_0x1b0241), UnknownText_0x1b0241 - closetext - loadmovesprites - 2jump .endpokerus -.pokerus_comcenter -; Your Pokemon appear to be infected ... - 3writetext BANK(UnknownText_0x1b02d6), UnknownText_0x1b02d6 - closetext - loadmovesprites -.endpokerus -; Don't tell us about Pokerus again - setbit2 $000d -; Trigger Elm's Pokerus phone call - specialphonecall $0001 - end -; bc162 - -UnknownScript_0xbc162: ; 0xbc162 - 3jumptext $6c, $435a -; 0xbc166 - -UnknownScript_0xbc166: ; 0xbc166 - 3jumptext $6c, $4378 -; 0xbc16a - -UnknownScript_0xbc16a: ; 0xbc16a - 3jumptext $6c, $43a3 -; 0xbc16e - -UnknownScript_0xbc16e: ; 0xbc16e - 3jumptext $6c, $43d9 -; 0xbc172 - -UnknownScript_0xbc172: ; 0xbc172 - 3jumptext $6c, $4448 -; 0xbc176 - -UnknownScript_0xbc176: ; 0xbc176 - 3jumptext $6c, $4472 -; 0xbc17a - -UnknownScript_0xbc17a: ; 0xbc17a - loadfont - 3writetext $6c, $448d - closetext - special $0026 - loadmovesprites - end -; 0xbc185 - -UnknownScript_0xbc185: ; 0xbc185 - 3jumptext $6c, $44a0 -; 0xbc189 - -UnknownScript_0xbc189: ; 0xbc189 - loadfont - 3writetext $6c, $44be - closetext - loadmovesprites - end -; 0xbc191 - -UnknownScript_0xbc191: ; 0xbc191 - 3jumptext $6c, $44c9 -; 0xbc195 - -UnknownScript_0xbc195: ; 0xbc195 - loadfont - writebyte $0 - special $0028 - loadmovesprites - end -; 0xbc19d - -UnknownScript_0xbc19d: ; 0xbc19d - loadfont - writebyte $4 - special $0028 - loadmovesprites - end -; 0xbc1a5 - -UnknownScript_0xbc1a5: ; 0xbc1a5 - 3jumptext $6c, $4526 -; 0xbc1a9 - -UnknownScript_0xbc1a9: ; 0xbc1a9 - loadfont - special $001c - loadmovesprites - end -; 0xbc1af - -UnknownScript_0xbc1af: ; 0xbc1af - playsound $0008 - pause 15 - playsound $0027 - end -; 0xbc1b8 - -UnknownScript_0xbc1b8: ; 0xbc1b8 - 3jump BANK(UnknownScript_0xcd4b), UnknownScript_0xcd4b -; 0xbc1bc - -UnknownScript_0xbc1bc: ; 0xbc1bc - 3jump BANK(UnknownScript_0xcf5d), UnknownScript_0xcf5d -; 0xbc1c0 - -UnknownScript_0xbc1c0: ; 0xbc1c0 - 3jumptext $6c, $457f -; 0xbc1c4 - -UnknownScript_0xbc1c4: ; 0xbc1c4 - 3jumptext $6c, $459c -; 0xbc1c8 - -UnknownScript_0xbc1c8: ; 0xbc1c8 - checkcode $b - if_equal $1, UnknownScript_0xbc1e7 - if_equal $2, UnknownScript_0xbc1ec - if_equal $3, UnknownScript_0xbc1f1 - if_equal $4, UnknownScript_0xbc1f6 - if_equal $5, UnknownScript_0xbc1fb - if_equal $6, UnknownScript_0xbc200 - stringtotext UnknownRawText_0xbc205, $0 - end -; 0xbc1e7 - -UnknownScript_0xbc1e7: ; 0xbc1e7 - stringtotext UnknownRawText_0xbc20c, $0 - end -; 0xbc1ec - -UnknownScript_0xbc1ec: ; 0xbc1ec - stringtotext UnknownRawText_0xbc213, $0 - end -; 0xbc1f1 - -UnknownScript_0xbc1f1: ; 0xbc1f1 - stringtotext UnknownRawText_0xbc21b, $0 - end -; 0xbc1f6 - -UnknownScript_0xbc1f6: ; 0xbc1f6 - stringtotext UnknownRawText_0xbc225, $0 - end -; 0xbc1fb - -UnknownScript_0xbc1fb: ; 0xbc1fb - stringtotext UnknownRawText_0xbc22e, $0 - end -; 0xbc200 - -UnknownScript_0xbc200: ; 0xbc200 - stringtotext UnknownRawText_0xbc235, $0 - end -; 0xbc205 - -UnknownRawText_0xbc205: ; bc205 - db "SUNDAY@" -; bc20c - -UnknownRawText_0xbc20c: ; bc20c - db "MONDAY@" -; bc213 - -UnknownRawText_0xbc213: ; bc213 - db "TUESDAY@" -; bc21b - -UnknownRawText_0xbc21b: ; bc21b - db "WEDNESDAY@" -; bc225 - -UnknownRawText_0xbc225: ; bc225 - db "THURSDAY@" -; bc22e - -UnknownRawText_0xbc22e: ; bc22e - db "FRIDAY@" -; bc235 - -UnknownRawText_0xbc235: ; bc235 - db "SATURDAY@" -; bc23e - -UnknownScript_0xbc23e: ; 0xbc23e - clearbit1 $06cd - end -; 0xbc242 - -UnknownScript_0xbc242: ; 0xbc242 - setbit2 $0013 - setbit1 $06cf - setbit1 $06d1 - clearbit1 $06ce - clearbit1 $0025 - setbit1 $0756 - specialphonecall $0004 - domaptrigger GROUP_MAHOGANY_TOWN, MAP_MAHOGANY_TOWN, $1 - end -; 0xbc25c - -UnknownScript_0xbc25c: ; 0xbc25c - special $0034 - 2call UnknownScript_0xbc380 - setbit1 $0747 - clearbit1 $0748 - setbit1 $02d2 - warp GROUP_ROUTE_36_NATIONAL_PARK_GATE, MAP_ROUTE_36_NATIONAL_PARK_GATE, $0, $4 - applymovement $0, MovementData_0xbcea1 - -UnknownScript_0xbc274: ; bc274 - clearbit2 $0011 - clearbit1 $02d2 - clearbit1 $0313 - clearbit1 $0314 - clearbit1 $0315 - clearbit1 $0316 - loadfont - 3writetext $6c, $45bf - closetext - special $0014 - RAM2MEM $0 - if_equal $1, UnknownScript_0xbc31e - if_equal $2, UnknownScript_0xbc332 - if_equal $3, UnknownScript_0xbc343 - 3writetext $6c, $4681 - keeptextopen - waitbutton - verbosegiveitem BERRY, 1 - iffalse UnknownScript_0xbc375 - 3writetext $6c, $46b7 - keeptextopen - 2jump $42b6 -; 0xbc2b1 - -UnknownScript_0xbc2b1: ; 0xbc2b1 - 3writetext $6c, $465b - keeptextopen - checkbit1 $0308 - iffalse $42c4 - 3writetext $6c, $46d9 - closetext - special $0017 - special $0015 - if_equal $0, $42d4 - if_equal $2, $42d4 - 3writetext $6c, $470d - closetext - loadmovesprites - dotrigger $0 - domaptrigger GROUP_ROUTE_35_NATIONAL_PARK_GATE, MAP_ROUTE_35_NATIONAL_PARK_GATE, $0 - setbit1 $0716 - setbit1 $0717 - setbit1 $0718 - setbit1 $0719 - setbit1 $071a - setbit1 $071b - setbit1 $071c - setbit1 $071d - setbit1 $071e - setbit1 $071f - setbit1 $0720 - setbit1 $0721 - setbit1 $0722 - setbit1 $0723 - setbit1 $0724 - setbit1 $0725 - setbit1 $0726 - setbit1 $0727 - setbit1 $0728 - setbit1 $0729 - setbit2 $0051 - special $003c - end -; 0xbc31e - -UnknownScript_0xbc31e: ; 0xbc31e - setbit1 $0000 - itemtotext SUN_STONE, $1 - 3writetext $6c, $4621 - closetext - verbosegiveitem SUN_STONE, 1 - iffalse UnknownScript_0xbc354 - 2jump UnknownScript_0xbc2b1 -; 0xbc332 - -UnknownScript_0xbc332: ; 0xbc332 - itemtotext EVERSTONE, $1 - 3writetext $6c, $4621 - closetext - verbosegiveitem EVERSTONE, 1 - iffalse UnknownScript_0xbc35f - 2jump UnknownScript_0xbc2b1 -; 0xbc343 - -UnknownScript_0xbc343: ; 0xbc343 - itemtotext GOLD_BERRY, $1 - 3writetext $6c, $4621 - closetext - verbosegiveitem GOLD_BERRY, 1 - iffalse UnknownScript_0xbc36a - 2jump UnknownScript_0xbc2b1 -; 0xbc354 - -UnknownScript_0xbc354: ; 0xbc354 - 3writetext $6c, $48cc - keeptextopen - setbit1 $0313 - 2jump UnknownScript_0xbc2b1 -; 0xbc35f - -UnknownScript_0xbc35f: ; 0xbc35f - 3writetext $6c, $48cc - keeptextopen - setbit1 $0314 - 2jump UnknownScript_0xbc2b1 -; 0xbc36a - -UnknownScript_0xbc36a: ; 0xbc36a - 3writetext $6c, $48cc - keeptextopen - setbit1 $0315 - 2jump UnknownScript_0xbc2b1 -; 0xbc375 - -UnknownScript_0xbc375: ; 0xbc375 - 3writetext $6c, $48cc - keeptextopen - setbit1 $0316 - 2jump $42a9 -; 0xbc380 - -UnknownScript_0xbc380: ; 0xbc380 - checkbit1 $0716 - iftrue $4389 - clearbit1 $0720 - checkbit1 $0717 - iftrue $4392 - clearbit1 $0721 - checkbit1 $0718 - iftrue $439b - clearbit1 $0722 - checkbit1 $0719 - iftrue $43a4 - clearbit1 $0723 - checkbit1 $071a - iftrue $43ad - clearbit1 $0724 - checkbit1 $071b - iftrue $43b6 - clearbit1 $0725 - checkbit1 $071c - iftrue $43bf - clearbit1 $0726 - checkbit1 $071d - iftrue $43c8 - clearbit1 $0727 - checkbit1 $071e - iftrue $43d1 - clearbit1 $0728 - checkbit1 $071f - iftrue $43da - clearbit1 $0729 - end -; 0xbc3db - -UnknownScript_0xbc3db: ; 0xbc3db - setbit1 $06cb - setbit1 $06ce - setbit1 $06cd - setbit1 $06d0 - setbit1 $06f3 - setbit1 $06e9 - setbit1 $06f4 - setbit1 $06d5 - setbit1 $06de - setbit1 $06dd - setbit1 $06df - setbit1 $06c0 - setbit1 $06e4 - setbit1 $0025 - setbit1 $06be - setbit1 $06bf - setbit1 $06c1 - setbit1 $06f9 - setbit1 $06fd - setbit1 $06ff - setbit1 $0700 - setbit1 $0702 - setbit1 $0703 - setbit1 $0704 - setbit1 $070d - setbit1 $070e - setbit1 $070f - setbit1 $0710 - setbit1 $0715 - setbit1 $0716 - setbit1 $0717 - setbit1 $0718 - setbit1 $0719 - setbit1 $071a - setbit1 $071b - setbit1 $071c - setbit1 $071d - setbit1 $071e - setbit1 $071f - setbit1 $0720 - setbit1 $0721 - setbit1 $0722 - setbit1 $0723 - setbit1 $0724 - setbit1 $0725 - setbit1 $0726 - setbit1 $0727 - setbit1 $0728 - setbit1 $0729 - setbit1 $072c - setbit1 $072f - setbit1 $072d - setbit1 $0735 - setbit1 $0736 - setbit1 $073c - setbit1 $073d - setbit1 $0741 - setbit1 $0742 - setbit1 $0743 - setbit1 $0744 - setbit1 $02a4 - setbit1 $02af - setbit1 $0749 - setbit1 $06d3 - setbit1 $074d - setbit1 $0712 - setbit1 $0713 - setbit1 $0711 - setbit1 $06d4 - setbit1 $0304 - setbit1 $0307 - setbit1 $06d8 - setbit1 $06c3 - setbit1 $06c2 - setbit1 $06c6 - setbit1 $075f - setbit1 $0731 - setbit1 $074a - setbit1 $0762 - setbit1 $0738 - setbit1 $073a - setbit1 $073b - setbit1 $0733 - setbit1 $073f - setbit1 $078d - setbit1 $0766 - setbit1 $0768 - setbit1 $0769 - setbit1 $076a - setbit1 $078e - setbit1 $078f - setbit1 $0790 - setbit1 $0791 - setbit1 $0793 - setbit1 $07a4 - setbit1 $07a4 - setbit1 $07a5 - setbit1 $06ec - setbit1 $06ed - setbit1 $06f0 - setbit1 $07a9 - setbit1 $07aa - setbit1 $06c8 - setbit1 $07ac - setbit1 $07ad - setbit1 $07b5 - setbit1 $07b6 - setbit1 $07c5 - setbit1 $07b7 - setbit1 $07b0 - setbit1 $07af - setbit1 $07ae - setbit1 $07cf - setbit2 $000e - setbit2 $0017 - variablesprite $4, $52 - variablesprite $5, $4 - variablesprite $6, $35 - variablesprite $7, $a - variablesprite $8, $a - variablesprite $9, $a - variablesprite $a, $a - variablesprite $b, $28 - variablesprite $c, $28 - setbit1 $00fb - setbit1 $076d - setbit1 $076c - setbit1 $076e - setbit1 $076f - setbit1 $0773 - setbit1 $0776 - setbit1 $0777 - setbit1 $0779 - setbit1 $0772 - setbit1 $077b - setbit1 $0036 - return -; 0xbc574 - -UnknownScript_0xbc574: ; 0xbc574 - special $005d - checkcode $17 - if_equal $5, $45c9 - if_equal $7, UnknownScript_0xbc5ce - if_equal $b, UnknownScript_0xbc5d3 - if_equal $d, UnknownScript_0xbc5d8 - if_equal $f, UnknownScript_0xbc5dd - if_equal $10, UnknownScript_0xbc5e2 - if_equal $11, UnknownScript_0xbc5e7 - if_equal $13, UnknownScript_0xbc5ec - if_equal $14, UnknownScript_0xbc5f1 - if_equal $16, UnknownScript_0xbc5f6 - if_equal $17, UnknownScript_0xbc5fb - if_equal $18, UnknownScript_0xbc600 - if_equal $1b, UnknownScript_0xbc605 - if_equal $1c, UnknownScript_0xbc60a - if_equal $1d, UnknownScript_0xbc60f - if_equal $1e, UnknownScript_0xbc614 - if_equal $20, UnknownScript_0xbc619 - if_equal $21, UnknownScript_0xbc61e - if_equal $22, UnknownScript_0xbc623 - if_equal $23, UnknownScript_0xbc628 - 3writetext $6c, $49fe - end -; 0xbc5ce - -UnknownScript_0xbc5ce: ; 0xbc5ce - 3writetext $6c, $4d9f - end -; 0xbc5d3 - -UnknownScript_0xbc5d3: ; 0xbc5d3 - 3writetext $6c, $502e - end -; 0xbc5d8 - -UnknownScript_0xbc5d8: ; 0xbc5d8 - 3writetext $6c, $542d - end -; 0xbc5dd - -UnknownScript_0xbc5dd: ; 0xbc5dd - 3writetext $6c, $5800 - end -; 0xbc5e2 - -UnknownScript_0xbc5e2: ; 0xbc5e2 - 3writetext $6c, $5a71 - end -; 0xbc5e7 - -UnknownScript_0xbc5e7: ; 0xbc5e7 - 3writetext $6c, $5cd5 - end -; 0xbc5ec - -UnknownScript_0xbc5ec: ; 0xbc5ec - 3writetext $29, $4000 - end -; 0xbc5f1 - -UnknownScript_0xbc5f1: ; 0xbc5f1 - 3writetext $29, $41c0 - end -; 0xbc5f6 - -UnknownScript_0xbc5f6: ; 0xbc5f6 - 3writetext $29, $4642 - end -; 0xbc5fb - -UnknownScript_0xbc5fb: ; 0xbc5fb - 3writetext $29, $4829 - end -; 0xbc600 - -UnknownScript_0xbc600: ; 0xbc600 - 3writetext $29, $4a31 - end -; 0xbc605 - -UnknownScript_0xbc605: ; 0xbc605 - 3writetext $29, $4ed4 - end -; 0xbc60a - -UnknownScript_0xbc60a: ; 0xbc60a - 3writetext $29, $50d5 - end -; 0xbc60f - -UnknownScript_0xbc60f: ; 0xbc60f - 3writetext $29, $52e2 - end -; 0xbc614 - -UnknownScript_0xbc614: ; 0xbc614 - 3writetext $29, $5545 - end -; 0xbc619 - -UnknownScript_0xbc619: ; 0xbc619 - 3writetext $29, $5937 - end -; 0xbc61e - -UnknownScript_0xbc61e: ; 0xbc61e - 3writetext $29, $5bc4 - end -; 0xbc623 - -UnknownScript_0xbc623: ; 0xbc623 - 3writetext $29, $5dc6 - end -; 0xbc628 - -UnknownScript_0xbc628: ; 0xbc628 - 3writetext $29, $600c - end -; 0xbc62d - -UnknownScript_0xbc62d: ; 0xbc62d - special $005d - checkcode $17 - if_equal $5, $4682 - if_equal $7, UnknownScript_0xbc687 - if_equal $b, UnknownScript_0xbc68c - if_equal $d, UnknownScript_0xbc691 - if_equal $f, UnknownScript_0xbc696 - if_equal $10, UnknownScript_0xbc69b - if_equal $11, UnknownScript_0xbc6a0 - if_equal $13, UnknownScript_0xbc6a5 - if_equal $14, UnknownScript_0xbc6aa - if_equal $16, UnknownScript_0xbc6af - if_equal $17, UnknownScript_0xbc6b4 - if_equal $18, UnknownScript_0xbc6b9 - if_equal $1b, UnknownScript_0xbc6be - if_equal $1c, UnknownScript_0xbc6c3 - if_equal $1d, UnknownScript_0xbc6c8 - if_equal $1e, UnknownScript_0xbc6cd - if_equal $20, UnknownScript_0xbc6d2 - if_equal $21, UnknownScript_0xbc6d7 - if_equal $22, UnknownScript_0xbc6dc - if_equal $23, UnknownScript_0xbc6e1 - 3writetext $6c, $4a82 - end -; 0xbc687 - -UnknownScript_0xbc687: ; 0xbc687 - 3writetext $6c, $4e2c - end -; 0xbc68c - -UnknownScript_0xbc68c: ; 0xbc68c - 3writetext $6c, $50d3 - end -; 0xbc691 - -UnknownScript_0xbc691: ; 0xbc691 - 3writetext $6c, $54e4 - end -; 0xbc696 - -UnknownScript_0xbc696: ; 0xbc696 - 3writetext $6c, $587b - end -; 0xbc69b - -UnknownScript_0xbc69b: ; 0xbc69b - 3writetext $6c, $5b1d - end -; 0xbc6a0 - -UnknownScript_0xbc6a0: ; 0xbc6a0 - 3writetext $6c, $5d85 - end -; 0xbc6a5 - -UnknownScript_0xbc6a5: ; 0xbc6a5 - 3writetext $29, $40a9 - end -; 0xbc6aa - -UnknownScript_0xbc6aa: ; 0xbc6aa - 3writetext $29, $426a - end -; 0xbc6af - -UnknownScript_0xbc6af: ; 0xbc6af - 3writetext $29, $470b - end -; 0xbc6b4 - -UnknownScript_0xbc6b4: ; 0xbc6b4 - 3writetext $29, $48fc - end -; 0xbc6b9 - -UnknownScript_0xbc6b9: ; 0xbc6b9 - 3writetext $29, $4b03 - end -; 0xbc6be - -UnknownScript_0xbc6be: ; 0xbc6be - 3writetext $29, $4fc8 - end -; 0xbc6c3 - -UnknownScript_0xbc6c3: ; 0xbc6c3 - 3writetext $29, $5175 - end -; 0xbc6c8 - -UnknownScript_0xbc6c8: ; 0xbc6c8 - 3writetext $29, $5383 - end -; 0xbc6cd - -UnknownScript_0xbc6cd: ; 0xbc6cd - 3writetext $29, $5621 - end -; 0xbc6d2 - -UnknownScript_0xbc6d2: ; 0xbc6d2 - 3writetext $29, $59bc - end -; 0xbc6d7 - -UnknownScript_0xbc6d7: ; 0xbc6d7 - 3writetext $29, $5c4b - end -; 0xbc6dc - -UnknownScript_0xbc6dc: ; 0xbc6dc - 3writetext $29, $5e63 - end -; 0xbc6e1 - -UnknownScript_0xbc6e1: ; 0xbc6e1 - 3writetext $29, $6076 - end -; 0xbc6e6 - -UnknownScript_0xbc6e6: ; 0xbc6e6 - 3writetext $6c, $49c4 - playsound $0093 - waitbutton - keeptextopen - end -; 0xbc6f0 - -UnknownScript_0xbc6f0: ; 0xbc6f0 - checkcode $17 - if_equal $5, $4742 - if_equal $7, UnknownScript_0xbc749 - if_equal $b, UnknownScript_0xbc750 - if_equal $d, UnknownScript_0xbc757 - if_equal $f, UnknownScript_0xbc75e - if_equal $10, UnknownScript_0xbc765 - if_equal $11, UnknownScript_0xbc76c - if_equal $13, UnknownScript_0xbc773 - if_equal $14, UnknownScript_0xbc77a - if_equal $16, UnknownScript_0xbc781 - if_equal $17, UnknownScript_0xbc788 - if_equal $18, UnknownScript_0xbc78f - if_equal $1b, UnknownScript_0xbc796 - if_equal $1c, UnknownScript_0xbc79d - if_equal $1d, UnknownScript_0xbc7a4 - if_equal $1e, UnknownScript_0xbc7ab - if_equal $20, UnknownScript_0xbc7b2 - if_equal $21, UnknownScript_0xbc7b9 - if_equal $22, UnknownScript_0xbc7c0 - if_equal $23, UnknownScript_0xbc7c7 - 3writetext $6c, $4adb - closetext - loadmovesprites - end -; 0xbc749 - -UnknownScript_0xbc749: ; 0xbc749 - 3writetext $6c, $4e89 - closetext - loadmovesprites - end -; 0xbc750 - -UnknownScript_0xbc750: ; 0xbc750 - 3writetext $6c, $5136 - closetext - loadmovesprites - end -; 0xbc757 - -UnknownScript_0xbc757: ; 0xbc757 - 3writetext $6c, $5553 - closetext - loadmovesprites - end -; 0xbc75e - -UnknownScript_0xbc75e: ; 0xbc75e - 3writetext $6c, $58d7 - closetext - loadmovesprites - end -; 0xbc765 - -UnknownScript_0xbc765: ; 0xbc765 - 3writetext $6c, $5b8e - closetext - loadmovesprites - end -; 0xbc76c - -UnknownScript_0xbc76c: ; 0xbc76c - 3writetext $6c, $5db9 - closetext - loadmovesprites - end -; 0xbc773 - -UnknownScript_0xbc773: ; 0xbc773 - 3writetext $29, $40f8 - closetext - loadmovesprites - end -; 0xbc77a - -UnknownScript_0xbc77a: ; 0xbc77a - 3writetext $29, $42ab - closetext - loadmovesprites - end -; 0xbc781 - -UnknownScript_0xbc781: ; 0xbc781 - 3writetext $29, $4730 - closetext - loadmovesprites - end -; 0xbc788 - -UnknownScript_0xbc788: ; 0xbc788 - 3writetext $29, $494d - closetext - loadmovesprites - end -; 0xbc78f - -UnknownScript_0xbc78f: ; 0xbc78f - 3writetext $29, $4b47 - closetext - loadmovesprites - end -; 0xbc796 - -UnknownScript_0xbc796: ; 0xbc796 - 3writetext $29, $502e - closetext - loadmovesprites - end -; 0xbc79d - -UnknownScript_0xbc79d: ; 0xbc79d - 3writetext $29, $51ac - closetext - loadmovesprites - end -; 0xbc7a4 - -UnknownScript_0xbc7a4: ; 0xbc7a4 - 3writetext $29, $53de - closetext - loadmovesprites - end -; 0xbc7ab - -UnknownScript_0xbc7ab: ; 0xbc7ab - 3writetext $29, $5666 - closetext - loadmovesprites - end -; 0xbc7b2 - -UnknownScript_0xbc7b2: ; 0xbc7b2 - 3writetext $29, $5a28 - closetext - loadmovesprites - end -; 0xbc7b9 - -UnknownScript_0xbc7b9: ; 0xbc7b9 - 3writetext $29, $5c8e - closetext - loadmovesprites - end -; 0xbc7c0 - -UnknownScript_0xbc7c0: ; 0xbc7c0 - 3writetext $29, $5ea8 - closetext - loadmovesprites - end -; 0xbc7c7 - -UnknownScript_0xbc7c7: ; 0xbc7c7 - 3writetext $29, $60b5 - closetext - loadmovesprites - end -; 0xbc7ce - -UnknownScript_0xbc7ce: ; 0xbc7ce - checkcode $17 - if_equal $5, $4820 - if_equal $7, UnknownScript_0xbc827 - if_equal $b, UnknownScript_0xbc82e - if_equal $d, UnknownScript_0xbc835 - if_equal $f, UnknownScript_0xbc83c - if_equal $10, UnknownScript_0xbc843 - if_equal $11, UnknownScript_0xbc84a - if_equal $13, UnknownScript_0xbc851 - if_equal $14, UnknownScript_0xbc858 - if_equal $16, UnknownScript_0xbc85f - if_equal $17, UnknownScript_0xbc866 - if_equal $18, UnknownScript_0xbc86d - if_equal $1b, UnknownScript_0xbc874 - if_equal $1c, UnknownScript_0xbc87b - if_equal $1d, UnknownScript_0xbc882 - if_equal $1e, UnknownScript_0xbc889 - if_equal $20, UnknownScript_0xbc890 - if_equal $21, UnknownScript_0xbc897 - if_equal $22, UnknownScript_0xbc89e - if_equal $23, UnknownScript_0xbc8a5 - 3writetext $6c, $4afd - closetext - loadmovesprites - end -; 0xbc827 - -UnknownScript_0xbc827: ; 0xbc827 - 3writetext $6c, $4ea2 - closetext - loadmovesprites - end -; 0xbc82e - -UnknownScript_0xbc82e: ; 0xbc82e - 3writetext $6c, $517b - closetext - loadmovesprites - end -; 0xbc835 - -UnknownScript_0xbc835: ; 0xbc835 - 3writetext $6c, $5584 - closetext - loadmovesprites - end -; 0xbc83c - -UnknownScript_0xbc83c: ; 0xbc83c - 3writetext $6c, $5908 - closetext - loadmovesprites - end -; 0xbc843 - -UnknownScript_0xbc843: ; 0xbc843 - 3writetext $6c, $5bd2 - closetext - loadmovesprites - end -; 0xbc84a - -UnknownScript_0xbc84a: ; 0xbc84a - 3writetext $6c, $5df4 - closetext - loadmovesprites - end -; 0xbc851 - -UnknownScript_0xbc851: ; 0xbc851 - 3writetext $29, $4126 - closetext - loadmovesprites - end -; 0xbc858 - -UnknownScript_0xbc858: ; 0xbc858 - 3writetext $29, $42f2 - closetext - loadmovesprites - end -; 0xbc85f - -UnknownScript_0xbc85f: ; 0xbc85f - 3writetext $29, $4794 - closetext - loadmovesprites - end -; 0xbc866 - -UnknownScript_0xbc866: ; 0xbc866 - 3writetext $29, $498a - closetext - loadmovesprites - end -; 0xbc86d - -UnknownScript_0xbc86d: ; 0xbc86d - 3writetext $29, $4b87 - closetext - loadmovesprites - end -; 0xbc874 - -UnknownScript_0xbc874: ; 0xbc874 - 3writetext $29, $505f - closetext - loadmovesprites - end -; 0xbc87b - -UnknownScript_0xbc87b: ; 0xbc87b - 3writetext $29, $51ee - closetext - loadmovesprites - end -; 0xbc882 - -UnknownScript_0xbc882: ; 0xbc882 - 3writetext $29, $5412 - closetext - loadmovesprites - end -; 0xbc889 - -UnknownScript_0xbc889: ; 0xbc889 - 3writetext $29, $56b6 - closetext - loadmovesprites - end -; 0xbc890 - -UnknownScript_0xbc890: ; 0xbc890 - 3writetext $29, $5a5a - closetext - loadmovesprites - end -; 0xbc897 - -UnknownScript_0xbc897: ; 0xbc897 - 3writetext $29, $5cc5 - closetext - loadmovesprites - end -; 0xbc89e - -UnknownScript_0xbc89e: ; 0xbc89e - 3writetext $29, $5ed6 - closetext - loadmovesprites - end -; 0xbc8a5 - -UnknownScript_0xbc8a5: ; 0xbc8a5 - 3writetext $29, $60e2 - closetext - loadmovesprites - end -; 0xbc8ac - -UnknownScript_0xbc8ac: ; 0xbc8ac - checkcode $17 - if_equal $5, $48fe - if_equal $7, UnknownScript_0xbc905 - if_equal $b, UnknownScript_0xbc90c - if_equal $d, UnknownScript_0xbc913 - if_equal $f, UnknownScript_0xbc91a - if_equal $10, UnknownScript_0xbc921 - if_equal $11, UnknownScript_0xbc928 - if_equal $13, UnknownScript_0xbc92f - if_equal $14, UnknownScript_0xbc936 - if_equal $16, UnknownScript_0xbc93d - if_equal $17, UnknownScript_0xbc944 - if_equal $18, UnknownScript_0xbc94b - if_equal $1b, UnknownScript_0xbc952 - if_equal $1c, UnknownScript_0xbc959 - if_equal $1d, UnknownScript_0xbc960 - if_equal $1e, UnknownScript_0xbc967 - if_equal $20, UnknownScript_0xbc96e - if_equal $21, UnknownScript_0xbc975 - if_equal $22, UnknownScript_0xbc97c - if_equal $23, UnknownScript_0xbc983 - 3writetext $6c, $4b42 - closetext - loadmovesprites - end -; 0xbc905 - -UnknownScript_0xbc905: ; 0xbc905 - 3writetext $6c, $4ebc - closetext - loadmovesprites - end -; 0xbc90c - -UnknownScript_0xbc90c: ; 0xbc90c - 3writetext $6c, $51c4 - closetext - loadmovesprites - end -; 0xbc913 - -UnknownScript_0xbc913: ; 0xbc913 - 3writetext $6c, $55b6 - closetext - loadmovesprites - end -; 0xbc91a - -UnknownScript_0xbc91a: ; 0xbc91a - 3writetext $6c, $5936 - closetext - loadmovesprites - end -; 0xbc921 - -UnknownScript_0xbc921: ; 0xbc921 - 3writetext $6c, $5c06 - closetext - loadmovesprites - end -; 0xbc928 - -UnknownScript_0xbc928: ; 0xbc928 - 3writetext $6c, $5e50 - closetext - loadmovesprites - end -; 0xbc92f - -UnknownScript_0xbc92f: ; 0xbc92f - 3writetext $29, $4158 - closetext - loadmovesprites - end -; 0xbc936 - -UnknownScript_0xbc936: ; 0xbc936 - 3writetext $29, $434a - closetext - loadmovesprites - end -; 0xbc93d - -UnknownScript_0xbc93d: ; 0xbc93d - 3writetext $29, $47eb - closetext - loadmovesprites - end -; 0xbc944 - -UnknownScript_0xbc944: ; 0xbc944 - 3writetext $29, $49bd - closetext - loadmovesprites - end -; 0xbc94b - -UnknownScript_0xbc94b: ; 0xbc94b - 3writetext $29, $4bcd - closetext - loadmovesprites - end -; 0xbc952 - -UnknownScript_0xbc952: ; 0xbc952 - 3writetext $29, $508c - closetext - loadmovesprites - end -; 0xbc959 - -UnknownScript_0xbc959: ; 0xbc959 - 3writetext $29, $5216 - closetext - loadmovesprites - end -; 0xbc960 - -UnknownScript_0xbc960: ; 0xbc960 - 3writetext $29, $5446 - closetext - loadmovesprites - end -; 0xbc967 - -UnknownScript_0xbc967: ; 0xbc967 - 3writetext $29, $56e2 - closetext - loadmovesprites - end -; 0xbc96e - -UnknownScript_0xbc96e: ; 0xbc96e - 3writetext $29, $5aa6 - closetext - loadmovesprites - end -; 0xbc975 - -UnknownScript_0xbc975: ; 0xbc975 - 3writetext $29, $5cfa - closetext - loadmovesprites - end -; 0xbc97c - -UnknownScript_0xbc97c: ; 0xbc97c - 3writetext $29, $5f06 - closetext - loadmovesprites - end -; 0xbc983 - -UnknownScript_0xbc983: ; 0xbc983 - 3writetext $29, $6144 - closetext - loadmovesprites - end -; 0xbc98a - -UnknownScript_0xbc98a: ; 0xbc98a - checkcode $17 - if_equal $5, $49d0 - if_equal $7, UnknownScript_0xbc9d7 - if_equal $b, UnknownScript_0xbc9de - if_equal $d, UnknownScript_0xbc9e5 - if_equal $f, UnknownScript_0xbc9ec - if_equal $10, UnknownScript_0xbc9f3 - if_equal $11, UnknownScript_0xbc9fa - if_equal $13, UnknownScript_0xbca01 - if_equal $14, UnknownScript_0xbca08 - if_equal $17, UnknownScript_0xbca0f - if_equal $18, UnknownScript_0xbca16 - if_equal $1b, UnknownScript_0xbca1d - if_equal $1d, UnknownScript_0xbca24 - if_equal $1e, UnknownScript_0xbca2b - if_equal $20, UnknownScript_0xbca32 - if_equal $21, UnknownScript_0xbca39 - if_equal $23, UnknownScript_0xbca40 - 3writetext $6c, $4b75 - closetext - loadmovesprites - end -; 0xbc9d7 - -UnknownScript_0xbc9d7: ; 0xbc9d7 - 3writetext $6c, $4edc - closetext - loadmovesprites - end -; 0xbc9de - -UnknownScript_0xbc9de: ; 0xbc9de - 3writetext $6c, $51fe - closetext - loadmovesprites - end -; 0xbc9e5 - -UnknownScript_0xbc9e5: ; 0xbc9e5 - 3writetext $6c, $55d5 - closetext - loadmovesprites - end -; 0xbc9ec - -UnknownScript_0xbc9ec: ; 0xbc9ec - 3writetext $6c, $5954 - closetext - loadmovesprites - end -; 0xbc9f3 - -UnknownScript_0xbc9f3: ; 0xbc9f3 - 3writetext $6c, $5c32 - closetext - loadmovesprites - end -; 0xbc9fa - -UnknownScript_0xbc9fa: ; 0xbc9fa - 3writetext $6c, $5e98 - closetext - loadmovesprites - end -; 0xbca01 - -UnknownScript_0xbca01: ; 0xbca01 - 3writetext $29, $418d - closetext - loadmovesprites - end -; 0xbca08 - -UnknownScript_0xbca08: ; 0xbca08 - 3writetext $29, $4382 - closetext - loadmovesprites - end -; 0xbca0f - -UnknownScript_0xbca0f: ; 0xbca0f - 3writetext $29, $49fc - closetext - loadmovesprites - end -; 0xbca16 - -UnknownScript_0xbca16: ; 0xbca16 - 3writetext $29, $4bec - closetext - loadmovesprites - end -; 0xbca1d - -UnknownScript_0xbca1d: ; 0xbca1d - 3writetext $29, $50b1 - closetext - loadmovesprites - end -; 0xbca24 - -UnknownScript_0xbca24: ; 0xbca24 - 3writetext $29, $548c - closetext - loadmovesprites - end -; 0xbca2b - -UnknownScript_0xbca2b: ; 0xbca2b - 3writetext $29, $571e - closetext - loadmovesprites - end -; 0xbca32 - -UnknownScript_0xbca32: ; 0xbca32 - 3writetext $29, $5ada - closetext - loadmovesprites - end -; 0xbca39 - -UnknownScript_0xbca39: ; 0xbca39 - 3writetext $29, $5d1d - closetext - loadmovesprites - end -; 0xbca40 - -UnknownScript_0xbca40: ; 0xbca40 - 3writetext $29, $6175 - closetext - loadmovesprites - end -; 0xbca47 - -UnknownScript_0xbca47: ; 0xbca47 - checkcode $17 - if_equal $d, $4a65 - if_equal $10, UnknownScript_0xbca6b - if_equal $18, UnknownScript_0xbca71 - if_equal $1c, UnknownScript_0xbca77 - if_equal $1d, UnknownScript_0xbca7d - if_equal $21, UnknownScript_0xbca83 - if_equal $22, UnknownScript_0xbca89 - 3writetext $6c, $5607 - keeptextopen - end -; 0xbca6b - -UnknownScript_0xbca6b: ; 0xbca6b - 3writetext $6c, $5c57 - keeptextopen - end -; 0xbca71 - -UnknownScript_0xbca71: ; 0xbca71 - 3writetext $29, $4c24 - keeptextopen - end -; 0xbca77 - -UnknownScript_0xbca77: ; 0xbca77 - 3writetext $29, $523a - keeptextopen - end -; 0xbca7d - -UnknownScript_0xbca7d: ; 0xbca7d - 3writetext $29, $54e3 - keeptextopen - end -; 0xbca83 - -UnknownScript_0xbca83: ; 0xbca83 - 3writetext $29, $5d4d - keeptextopen - end -; 0xbca89 - -UnknownScript_0xbca89: ; 0xbca89 - 3writetext $29, $5f37 - keeptextopen - end -; 0xbca8f - -UnknownScript_0xbca8f: ; 0xbca8f - checkcode $17 - if_equal $7, $4abd - if_equal $d, UnknownScript_0xbcac4 - if_equal $f, UnknownScript_0xbcacb - if_equal $10, UnknownScript_0xbcad2 - if_equal $18, UnknownScript_0xbcad9 - if_equal $1c, UnknownScript_0xbcae0 - if_equal $1d, UnknownScript_0xbcae7 - if_equal $20, UnknownScript_0xbcaee - if_equal $21, UnknownScript_0xbcaf5 - if_equal $22, UnknownScript_0xbcafc - if_equal $23, UnknownScript_0xbcb03 - 3writetext $6c, $4eff - closetext - loadmovesprites - end -; 0xbcac4 - -UnknownScript_0xbcac4: ; 0xbcac4 - 3writetext $6c, $564d - closetext - loadmovesprites - end -; 0xbcacb - -UnknownScript_0xbcacb: ; 0xbcacb - 3writetext $6c, $5978 - closetext - loadmovesprites - end -; 0xbcad2 - -UnknownScript_0xbcad2: ; 0xbcad2 - 3writetext $6c, $5c91 - closetext - loadmovesprites - end -; 0xbcad9 - -UnknownScript_0xbcad9: ; 0xbcad9 - 3writetext $29, $4c47 - closetext - loadmovesprites - end -; 0xbcae0 - -UnknownScript_0xbcae0: ; 0xbcae0 - 3writetext $29, $52a0 - closetext - loadmovesprites - end -; 0xbcae7 - -UnknownScript_0xbcae7: ; 0xbcae7 - 3writetext $29, $5513 - closetext - loadmovesprites - end -; 0xbcaee - -UnknownScript_0xbcaee: ; 0xbcaee - 3writetext $29, $5aff - closetext - loadmovesprites - end -; 0xbcaf5 - -UnknownScript_0xbcaf5: ; 0xbcaf5 - 3writetext $29, $5d9a - closetext - loadmovesprites - end -; 0xbcafc - -UnknownScript_0xbcafc: ; 0xbcafc - 3writetext $29, $5faa - closetext - loadmovesprites - end -; 0xbcb03 - -UnknownScript_0xbcb03: ; 0xbcb03 - 3writetext $29, $61c9 - closetext - loadmovesprites - end -; 0xbcb0a - -UnknownScript_0xbcb0a: ; 0xbcb0a - loadfont - checkcode $17 - if_equal $7, $4b1d - if_equal $f, UnknownScript_0xbcb23 - if_equal $20, UnknownScript_0xbcb29 - if_equal $23, UnknownScript_0xbcb2f - 3writetext $6c, $4f2f - keeptextopen - end -; 0xbcb23 - -UnknownScript_0xbcb23: ; 0xbcb23 - 3writetext $6c, $59be - keeptextopen - end -; 0xbcb29 - -UnknownScript_0xbcb29: ; 0xbcb29 - 3writetext $29, $5b3f - keeptextopen - end -; 0xbcb2f - -UnknownScript_0xbcb2f: ; 0xbcb2f - 3writetext $29, $6200 - keeptextopen - end -; 0xbcb35 - -UnknownScript_0xbcb35: ; 0xbcb35 - checkcode $17 - if_equal $6, $4b57 - if_equal $c, UnknownScript_0xbcb5c - if_equal $e, UnknownScript_0xbcb61 - if_equal $12, UnknownScript_0xbcb66 - if_equal $15, UnknownScript_0xbcb6b - if_equal $1a, UnknownScript_0xbcb70 - if_equal $1f, UnknownScript_0xbcb75 - if_equal $24, UnknownScript_0xbcb7a - 3writetext $6c, $4bb6 - end -; 0xbcb5c - -UnknownScript_0xbcb5c: ; 0xbcb5c - 3writetext $6c, $5239 - end -; 0xbcb61 - -UnknownScript_0xbcb61: ; 0xbcb61 - 3writetext $6c, $5690 - end -; 0xbcb66 - -UnknownScript_0xbcb66: ; 0xbcb66 - 3writetext $6c, $5ebe - end -; 0xbcb6b - -UnknownScript_0xbcb6b: ; 0xbcb6b - 3writetext $29, $4405 - end -; 0xbcb70 - -UnknownScript_0xbcb70: ; 0xbcb70 - 3writetext $29, $4c8c - end -; 0xbcb75 - -UnknownScript_0xbcb75: ; 0xbcb75 - 3writetext $29, $574a - end -; 0xbcb7a - -UnknownScript_0xbcb7a: ; 0xbcb7a - 3writetext $29, $6295 - end -; 0xbcb7f - -UnknownScript_0xbcb7f: ; 0xbcb7f - checkcode $17 - if_equal $6, $4ba1 - if_equal $c, UnknownScript_0xbcba6 - if_equal $e, UnknownScript_0xbcbab - if_equal $12, UnknownScript_0xbcbb0 - if_equal $15, UnknownScript_0xbcbb5 - if_equal $1a, UnknownScript_0xbcbba - if_equal $1f, UnknownScript_0xbcbbf - if_equal $24, UnknownScript_0xbcbc4 - 3writetext $6c, $4c37 - end -; 0xbcba6 - -UnknownScript_0xbcba6: ; 0xbcba6 - 3writetext $6c, $5314 - end -; 0xbcbab - -UnknownScript_0xbcbab: ; 0xbcbab - 3writetext $6c, $5710 - end -; 0xbcbb0 - -UnknownScript_0xbcbb0: ; 0xbcbb0 - 3writetext $6c, $5f4e - end -; 0xbcbb5 - -UnknownScript_0xbcbb5: ; 0xbcbb5 - 3writetext $29, $44db - end -; 0xbcbba - -UnknownScript_0xbcbba: ; 0xbcbba - 3writetext $29, $4d36 - end -; 0xbcbbf - -UnknownScript_0xbcbbf: ; 0xbcbbf - 3writetext $29, $57e3 - end -; 0xbcbc4 - -UnknownScript_0xbcbc4: ; 0xbcbc4 - 3writetext $29, $6316 - end -; 0xbcbc9 - -UnknownScript_0xbcbc9: ; 0xbcbc9 - 3writetext $6c, $49e1 - playsound $0093 - waitbutton - keeptextopen - end -; 0xbcbd3 - -UnknownScript_0xbcbd3: ; 0xbcbd3 - checkcode $17 - if_equal $6, $4bf5 - if_equal $c, UnknownScript_0xbcbfc - if_equal $e, UnknownScript_0xbcc03 - if_equal $12, UnknownScript_0xbcc0a - if_equal $15, UnknownScript_0xbcc11 - if_equal $1a, UnknownScript_0xbcc18 - if_equal $1f, UnknownScript_0xbcc1f - if_equal $24, UnknownScript_0xbcc26 - 3writetext $6c, $4c9b - closetext - loadmovesprites - end -; 0xbcbfc - -UnknownScript_0xbcbfc: ; 0xbcbfc - 3writetext $6c, $5392 - closetext - loadmovesprites - end -; 0xbcc03 - -UnknownScript_0xbcc03: ; 0xbcc03 - 3writetext $6c, $5755 - closetext - loadmovesprites - end -; 0xbcc0a - -UnknownScript_0xbcc0a: ; 0xbcc0a - 3writetext $6c, $5faa - closetext - loadmovesprites - end -; 0xbcc11 - -UnknownScript_0xbcc11: ; 0xbcc11 - 3writetext $29, $451d - closetext - loadmovesprites - end -; 0xbcc18 - -UnknownScript_0xbcc18: ; 0xbcc18 - 3writetext $29, $4d72 - closetext - loadmovesprites - end -; 0xbcc1f - -UnknownScript_0xbcc1f: ; 0xbcc1f - 3writetext $29, $5820 - closetext - loadmovesprites - end -; 0xbcc26 - -UnknownScript_0xbcc26: ; 0xbcc26 - 3writetext $29, $6359 - closetext - loadmovesprites - end -; 0xbcc2d - -UnknownScript_0xbcc2d: ; 0xbcc2d - checkcode $17 - if_equal $6, $4c4f - if_equal $c, UnknownScript_0xbcc56 - if_equal $e, UnknownScript_0xbcc5d - if_equal $12, UnknownScript_0xbcc64 - if_equal $15, UnknownScript_0xbcc6b - if_equal $1a, UnknownScript_0xbcc72 - if_equal $1f, UnknownScript_0xbcc79 - if_equal $24, UnknownScript_0xbcc80 - 3writetext $6c, $4ce0 - closetext - loadmovesprites - end -; 0xbcc56 - -UnknownScript_0xbcc56: ; 0xbcc56 - 3writetext $6c, $53af - closetext - loadmovesprites - end -; 0xbcc5d - -UnknownScript_0xbcc5d: ; 0xbcc5d - 3writetext $6c, $578a - closetext - loadmovesprites - end -; 0xbcc64 - -UnknownScript_0xbcc64: ; 0xbcc64 - 3writetext $6c, $5fdd - closetext - loadmovesprites - end -; 0xbcc6b - -UnknownScript_0xbcc6b: ; 0xbcc6b - 3writetext $29, $4542 - closetext - loadmovesprites - end -; 0xbcc72 - -UnknownScript_0xbcc72: ; 0xbcc72 - 3writetext $29, $4dcd - closetext - loadmovesprites - end -; 0xbcc79 - -UnknownScript_0xbcc79: ; 0xbcc79 - 3writetext $29, $5842 - closetext - loadmovesprites - end -; 0xbcc80 - -UnknownScript_0xbcc80: ; 0xbcc80 - 3writetext $29, $638c - closetext - loadmovesprites - end -; 0xbcc87 - -UnknownScript_0xbcc87: ; 0xbcc87 - checkcode $17 - if_equal $6, $4ca9 - if_equal $c, UnknownScript_0xbccb0 - if_equal $e, UnknownScript_0xbccb7 - if_equal $12, UnknownScript_0xbccbe - if_equal $15, UnknownScript_0xbccc5 - if_equal $1a, UnknownScript_0xbcccc - if_equal $1f, UnknownScript_0xbccd3 - if_equal $24, UnknownScript_0xbccda - 3writetext $6c, $4d0b - closetext - loadmovesprites - end -; 0xbccb0 - -UnknownScript_0xbccb0: ; 0xbccb0 - 3writetext $6c, $53e4 - closetext - loadmovesprites - end -; 0xbccb7 - -UnknownScript_0xbccb7: ; 0xbccb7 - 3writetext $6c, $57ba - closetext - loadmovesprites - end -; 0xbccbe - -UnknownScript_0xbccbe: ; 0xbccbe - 3writetext $6c, $5ffa - closetext - loadmovesprites - end -; 0xbccc5 - -UnknownScript_0xbccc5: ; 0xbccc5 - 3writetext $29, $4573 - closetext - loadmovesprites - end -; 0xbcccc - -UnknownScript_0xbcccc: ; 0xbcccc - 3writetext $29, $4e01 - closetext - loadmovesprites - end -; 0xbccd3 - -UnknownScript_0xbccd3: ; 0xbccd3 - 3writetext $29, $5881 - closetext - loadmovesprites - end -; 0xbccda - -UnknownScript_0xbccda: ; 0xbccda - 3writetext $29, $63cc - closetext - loadmovesprites - end -; 0xbcce1 - -UnknownScript_0xbcce1: ; 0xbcce1 - checkcode $17 - if_equal $c, $4cff - if_equal $e, UnknownScript_0xbcd06 - if_equal $12, UnknownScript_0xbcd0d - if_equal $15, UnknownScript_0xbcd14 - if_equal $1a, UnknownScript_0xbcd1b - if_equal $1f, UnknownScript_0xbcd22 - if_equal $24, UnknownScript_0xbcd29 - 3writetext $6c, $5409 - closetext - loadmovesprites - end -; 0xbcd06 - -UnknownScript_0xbcd06: ; 0xbcd06 - 3writetext $6c, $57de - closetext - loadmovesprites - end -; 0xbcd0d - -UnknownScript_0xbcd0d: ; 0xbcd0d - 3writetext $6c, $601f - closetext - loadmovesprites - end -; 0xbcd14 - -UnknownScript_0xbcd14: ; 0xbcd14 - 3writetext $29, $4595 - closetext - loadmovesprites - end -; 0xbcd1b - -UnknownScript_0xbcd1b: ; 0xbcd1b - 3writetext $29, $4e21 - closetext - loadmovesprites - end -; 0xbcd22 - -UnknownScript_0xbcd22: ; 0xbcd22 - 3writetext $29, $58a3 - closetext - loadmovesprites - end -; 0xbcd29 - -UnknownScript_0xbcd29: ; 0xbcd29 - 3writetext $29, $63f1 - closetext - loadmovesprites - end -; 0xbcd30 - -UnknownScript_0xbcd30: ; 0xbcd30 - checkcode $17 - if_equal $6, $4d42 - if_equal $15, UnknownScript_0xbcd48 - if_equal $1a, UnknownScript_0xbcd4e - if_equal $1f, UnknownScript_0xbcd54 - 3writetext $6c, $4d2c - keeptextopen - end -; 0xbcd48 - -UnknownScript_0xbcd48: ; 0xbcd48 - 3writetext $29, $45c9 - keeptextopen - end -; 0xbcd4e - -UnknownScript_0xbcd4e: ; 0xbcd4e - 3writetext $29, $4e4c - keeptextopen - end -; 0xbcd54 - -UnknownScript_0xbcd54: ; 0xbcd54 - 3writetext $29, $58d5 - keeptextopen - end -; 0xbcd5a - -UnknownScript_0xbcd5a: ; 0xbcd5a - checkcode $17 - if_equal $6, $4d70 - if_equal $15, UnknownScript_0xbcd77 - if_equal $1a, UnknownScript_0xbcd7e - if_equal $1f, UnknownScript_0xbcd85 - if_equal $24, UnknownScript_0xbcd8c - 3writetext $6c, $4d69 - closetext - loadmovesprites - end -; 0xbcd77 - -UnknownScript_0xbcd77: ; 0xbcd77 - 3writetext $29, $4603 - closetext - loadmovesprites - end -; 0xbcd7e - -UnknownScript_0xbcd7e: ; 0xbcd7e - 3writetext $29, $4e8f - closetext - loadmovesprites - end -; 0xbcd85 - -UnknownScript_0xbcd85: ; 0xbcd85 - 3writetext $29, $5914 - closetext - loadmovesprites - end -; 0xbcd8c - -UnknownScript_0xbcd8c: ; 0xbcd8c - 3writetext $29, $6411 - closetext - loadmovesprites - end -; 0xbcd93 - -UnknownScript_0xbcd93: ; 0xbcd93 - checkcode $17 - if_equal $24, $4d99 - loadfont - 3writetext $29, $6454 - keeptextopen - end -; 0xbcda0 - -UnknownScript_0xbcda0: ; 0xbcda0 - mapnametotext $0 - loadfont - 3writetext $6c, $474e - closetext - loadmovesprites - end -; 0xbcdaa - -UnknownScript_0xbcdaa: ; 0xbcdaa - mapnametotext $0 - loadfont - 3writetext $6c, $474e - keeptextopen - 3writetext $6c, $475c - closetext - loadmovesprites - end -; 0xbcdb9 - -UnknownScript_0xbcdb9: ; 0xbcdb9 - waitbutton - 3writetext $6c, $4648 - playsound $0001 - waitbutton - end -; 0xbcdc3 - -UnknownScript_0xbcdc3: ; 0xbcdc3 - waitbutton - 3writetext $6c, $4648 - playsound $0096 - waitbutton - end -; 0xbcdcd - -UnknownScript_0xbcdcd: ; 0xbcdcd - faceplayer - loadfont - 3writetext $6c, $477f - keeptextopen - checkitem COIN_CASE - iftrue UnknownScript_0xbcde0 - 3writetext $6c, $479c - closetext - loadmovesprites - end -; 0xbcde0 - -UnknownScript_0xbcde0: ; 0xbcde0 - 3writetext $6c, $47e3 - special $0050 - loadmenudata $4e54 - interpretmenu2 - writebackup - if_equal $1, UnknownScript_0xbcdf7 - if_equal $2, UnknownScript_0xbce1b - 2jump UnknownScript_0xbce4d -; 0xbcdf7 - -UnknownScript_0xbcdf7: ; 0xbcdf7 - checkcoins 9949 - if_equal $0, UnknownScript_0xbce46 - checkmoney $0, 1000 - if_equal $2, UnknownScript_0xbce3f - givecoins 50 - takemoney $0, 1000 - waitbutton - playsound $0022 - 3writetext $6c, $4830 - closetext - 2jump $4de4 -; 0xbce1b - -UnknownScript_0xbce1b: ; 0xbce1b - checkcoins 9499 - if_equal $0, UnknownScript_0xbce46 - checkmoney $0, 10000 - if_equal $2, UnknownScript_0xbce3f - givecoins 500 - takemoney $0, 10000 - waitbutton - playsound $0022 - 3writetext $6c, $484f - closetext - 2jump $4de4 -; 0xbce3f - -UnknownScript_0xbce3f: ; 0xbce3f - 3writetext $6c, $486f - closetext - loadmovesprites - end -; 0xbce46 - -UnknownScript_0xbce46: ; 0xbce46 - 3writetext $6c, $488c - closetext - loadmovesprites - end -; 0xbce4d - -UnknownScript_0xbce4d: ; 0xbce4d - 3writetext $6c, $48ad - closetext - loadmovesprites - end -; 0xbce54 - -INCBIN "baserom.gbc", $bce54, $bce7f - $bce54 - -UnknownScript_0xbce7f: ; 0xbce7f - faceplayer - loadfont - special $0059 - if_greater_than $32, UnknownScript_0xbce9a - if_greater_than $96, UnknownScript_0xbce93 - 3writetext $6c, $492a - closetext - loadmovesprites - end -; 0xbce93 - -UnknownScript_0xbce93: ; 0xbce93 - 3writetext $6c, $4954 - closetext - loadmovesprites - end -; 0xbce9a - -UnknownScript_0xbce9a: ; 0xbce9a - 3writetext $6c, $4989 - closetext - loadmovesprites - end -; 0xbcea1 - -MovementData_0xbcea1: ; bcea1 - step_right - step_down - turn_head_up - step_end -; bcea5 - -UnusedPhoneScript: ; 0xbcea5 - 3writetext BANK(UnusedPhoneText), UnusedPhoneText - end - -MomPhoneScript: ; 0xbceaa - checkbit1 $0040 - iftrue .bcec5 - checkbit1 $0041 ; if dude talked to you, then you left home without talking to mom - iftrue MomPhoneLectureScript - checkbit1 $001f - iftrue MomPhoneNoGymQuestScript - checkbit1 $001a - iftrue MomPhoneNoPokedexScript - 2jump MomPhoneNoPokemonScript - -.bcec5 ; 0xbcec5 - checkbit1 $0007 - iftrue MomPhoneHangUpScript - 3writetext BANK(MomPhoneGreetingText), MomPhoneGreetingText - keeptextopen - mapnametotext $0 - checkcode $f - if_equal $1, UnknownScript_0xbcee7 - if_equal $2, $4f27 - 2jump UnknownScript_0xbcf2f - -UnknownScript_0xbcedf: ; 0xbcedf - 3writetext $6d, $4021 - keeptextopen - 2jump UnknownScript_0xbcf37 - -UnknownScript_0xbcee7: ; 0xbcee7 - checkcode $c - if_equal GROUP_NEW_BARK_TOWN, .newbark - if_equal GROUP_CHERRYGROVE_CITY, .cherrygrove - if_equal GROUP_VIOLET_CITY, .violet - if_equal GROUP_AZALEA_TOWN, .azalea - if_equal GROUP_GOLDENROD_CITY, .goldenrod - 3writetext BANK(MomPhoneGenericAreaText), MomPhoneGenericAreaText - keeptextopen - 2jump UnknownScript_0xbcf37 - -.newbark ; 0xbcf05 - 3writetext BANK(MomPhoneNewBarkText), MomPhoneNewBarkText - keeptextopen - 2jump UnknownScript_0xbcf37 - -.cherrygrove ; 0xbcf0d - 3writetext BANK(MomPhoneCherrygroveText), MomPhoneCherrygroveText - keeptextopen - 2jump UnknownScript_0xbcf37 - -.violet ; 0xbcf15 - displaylocation $7 ; sprout tower - 3call $3, UnknownScript_0xbcedf -.azalea ; 0xbcf1b - displaylocation $d ; slowpoke well - 3call $3, UnknownScript_0xbcedf -.goldenrod ; 0xbcf21 - displaylocation $11 ; radio tower - 3call $3, UnknownScript_0xbcedf - 3writetext $6d, $411c - keeptextopen - 2jump UnknownScript_0xbcf37 - -UnknownScript_0xbcf2f: ; 0xbcf2f - 3writetext $6d, $4150 - keeptextopen - 2jump UnknownScript_0xbcf37 - -UnknownScript_0xbcf37: ; 0xbcf37 - checkbit2 $0008 - iffalse UnknownScript_0xbcf49 - checkmoney $1, 0 - if_equal $0, UnknownScript_0xbcf55 - 2jump UnknownScript_0xbcf63 - -UnknownScript_0xbcf49: ; 0xbcf49 - checkmoney $1, 0 - if_equal $0, UnknownScript_0xbcf79 - 2jump UnknownScript_0xbcf6e - -UnknownScript_0xbcf55: ; 0xbcf55 - readmoney $1, $0 - 3writetext $6d, $41a7 - yesorno - iftrue MomPhoneSaveMoneyScript - 2jump MomPhoneWontSaveMoneyScript - -UnknownScript_0xbcf63: ; 0xbcf63 - 3writetext $6d, $41ea - yesorno - iftrue MomPhoneSaveMoneyScript - 2jump MomPhoneWontSaveMoneyScript - -UnknownScript_0xbcf6e: ; 0xbcf6e - 3writetext $6d, $420d - yesorno - iftrue MomPhoneSaveMoneyScript - 2jump MomPhoneWontSaveMoneyScript - -UnknownScript_0xbcf79: ; 0xbcf79 - readmoney $1, $0 - 3writetext $6d, $4249 - yesorno - iftrue MomPhoneSaveMoneyScript - 2jump MomPhoneWontSaveMoneyScript - -MomPhoneSaveMoneyScript: ; 0xbcf87 - setbit2 $0008 - 3writetext $6d, $4289 - keeptextopen - 2jump MomPhoneHangUpScript - -MomPhoneWontSaveMoneyScript: ; 0xbcf92 - clearbit2 $0008 - 3writetext BANK(MomPhoneWontSaveMoneyText), MomPhoneWontSaveMoneyText - keeptextopen - 2jump MomPhoneHangUpScript - -MomPhoneHangUpScript: ; 0xbcf9d - 3writetext BANK(MomPhoneHangUpText), MomPhoneHangUpText - end - -MomPhoneNoPokemonScript: ; 0xbcfa2 - 3writetext BANK(MomPhoneNoPokemonText), MomPhoneNoPokemonText - end - -MomPhoneNoPokedexScript: ; 0xbcfa7 - 3writetext BANK(MomPhoneNoPokedexText), MomPhoneNoPokedexText - end - -MomPhoneNoGymQuestScript: ; 0xbcfac - 3writetext BANK(MomPhoneNoGymQuestText), MomPhoneNoGymQuestText - end - -MomPhoneLectureScript: ; 0xbcfb1 - setbit1 $0040 - setbit2 $0009 - specialphonecall $0000 - 3writetext BANK(MomPhoneLectureText), MomPhoneLectureText - yesorno - iftrue MomPhoneSaveMoneyScript - 2jump MomPhoneWontSaveMoneyScript - -BillPhoneScript1: ; 0xbcfc5 - checktime $2 - iftrue .daygreet - checktime $4 - iftrue .nitegreet - 3writetext BANK(BillPhoneMornGreetingText), BillPhoneMornGreetingText - keeptextopen - 2jump .main - -.daygreet ; 0xbcfd7 - 3writetext BANK(BillPhoneDayGreetingText), BillPhoneDayGreetingText - keeptextopen - 2jump .main - -.nitegreet ; 0xbcfdf - 3writetext BANK(BillPhoneNiteGreetingText), BillPhoneNiteGreetingText - keeptextopen - 2jump .main - -.main ; 0xbcfe7 - 3writetext BANK(BillPhoneGeneriText), BillPhoneGeneriText - keeptextopen - checkcode $10 - RAM2MEM $0 - if_equal $0, .full - if_greater_than $6, .nearlyfull - 3writetext BANK(BillPhoneNotFullText), BillPhoneNotFullText - end - -.nearlyfull ; 0xbcffd - 3writetext BANK(BillPhoneNearlyFullText), BillPhoneNearlyFullText - end - -.full ; 0xbd002 - 3writetext BANK(BillPhoneFullText), BillPhoneFullText - end - -BillPhoneScript2: ; 0xbd007 - 3writetext BANK(BillPhoneNewlyFullText), BillPhoneNewlyFullText - closetext - end - -ElmPhoneScript1: ; 0xbd00d - checkcode $14 - if_equal $1, .pokerus - checkbit1 $0055 - iftrue .discovery - checkbit1 $002d - iffalse .next - checkbit1 $0054 - iftrue .egghatched -.next - checkbit1 $002d - iftrue .eggunhatched - checkbit1 $0701 - iftrue .assistant - checkbit1 $001f - iftrue .checkingegg - checkbit1 $0043 - iftrue .stolen - checkbit1 $001e - iftrue .sawmrpokemon - 3writetext BANK(ElmPhoneStartText), ElmPhoneStartText - end - -.sawmrpokemon ; 0xbd048 - 3writetext BANK(ElmPhoneSawMrPokemonText), ElmPhoneSawMrPokemonText - end - -.stolen ; 0xbd04d - 3writetext BANK(ElmPhonePokemonStolenText), ElmPhonePokemonStolenText - end - -.checkingegg ; 0xbd052 - 3writetext BANK(ElmPhoneCheckingEggText), ElmPhoneCheckingEggText - end - -.assistant ; 0xbd057 - 3writetext BANK(ElmPhoneAssistantText), ElmPhoneAssistantText - end - -.eggunhatched ; 0xbd05c - 3writetext BANK(ElmPhoneEggUnhatchedText), ElmPhoneEggUnhatchedText - end - -.egghatched ; 0xbd061 - 3writetext BANK(ElmPhoneEggHatchedText), ElmPhoneEggHatchedText - setbit1 $0077 - end - -.discovery ; 0xbd069 - random $2 - if_equal $0, .nextdiscovery - 3writetext BANK(ElmPhoneDiscovery1Text), ElmPhoneDiscovery1Text - end - -.nextdiscovery ; 0xbd074 - 3writetext BANK(ElmPhoneDiscovery2Text), ElmPhoneDiscovery2Text - end - -.pokerus ; 0xbd079 - 3writetext BANK(ElmPhonePokerusText), ElmPhonePokerusText - specialphonecall $0000 - end - -ElmPhoneScript2: ; 0xbd081 - checkcode $14 - if_equal $2, .disaster - if_equal $3, .assistant - if_equal $4, .rocket - if_equal $5, .gift - if_equal $8, .gift - 3writetext BANK(ElmPhonePokerusText), ElmPhonePokerusText - specialphonecall $0000 - end - -.disaster ; 0xbd09f - 3writetext BANK(ElmPhoneDisasterText), ElmPhoneDisasterText - specialphonecall $0000 - setbit1 $0043 - end - -.assistant ; 0xbd0aa - 3writetext BANK(ElmPhoneEggAssistantText), ElmPhoneEggAssistantText - specialphonecall $0000 - clearbit1 $0700 - setbit1 $0701 - end - -.rocket ; 0xbd0b8 - 3writetext BANK(ElmPhoneRocketText), ElmPhoneRocketText - specialphonecall $0000 - end - -.gift ; 0xbd0c0 - 3writetext BANK(ElmPhoneGiftText), ElmPhoneGiftText - specialphonecall $0000 - end - -.unused ; 0xbd0c8 - 3writetext BANK(ElmPhoneUnusedText), ElmPhoneUnusedText - specialphonecall $0000 - end +INCLUDE "engine/std_scripts.asm" INCBIN "baserom.gbc", $bd0d0, $be699-$bd0d0 @@ -76663,11 +70926,11 @@ Functiond01d6: ; d01d6 ld [$d16e], a ld a, $1 ld hl, CurPartySpecies - call Function307b + call GetFarWRAMByte ld [$d16b], a ld a, $1 ld hl, UnownLetter - call Function307b + call GetFarWRAMByte ld [$d16c], a call Functiond065c ld [$d16d], a @@ -78644,7 +72907,7 @@ Functione4512: ; e4512 Options_Cancel: ; e4520 ld a, [hJoyPressed] - and BUTTON_A + and A_BUTTON jr nz, .asm_e4528 and a ret @@ -79617,177 +73880,9 @@ Functionfb634: ; fb634 INCBIN "baserom.gbc", $fb656, $fb6ed - $fb656 -Functionfb6ed: ; fb6ed - ld hl, $780f - call PrintText - call Function1dcf - jp c, .asm_fb77e - ld hl, $7814 - call PrintText - callba Function50000 - jr c, .asm_fb77e - ld a, [CurPartySpecies] - cp $fd - jr z, .asm_fb783 - call GetCurNick - call Functionfb78a - jr c, .asm_fb779 - ld hl, $7819 - call PrintText - call Function1dcf - jr c, .asm_fb77e - ld hl, $781e - call PrintText - xor a - ld [MonType], a - ld a, [CurPartySpecies] - ld [$d265], a - ld [CurSpecies], a - call GetBaseData - ld b, $0 - ld de, StringBuffer2 - callba Function116b7 - call Functionfb7be - ld hl, $7837 - jr c, .asm_fb76c - call Functionfb7d3 - ld hl, $7837 - jr c, .asm_fb76c - ld hl, PartyMon1Nickname - ld bc, $000b - ld a, [CurPartyMon] - call AddNTimes - ld e, l - ld d, h - ld hl, StringBuffer2 - ld bc, $000b - call CopyBytes - ld hl, $7823 - -.asm_fb76c - push hl - call GetCurNick - ld hl, $783c - call PrintText - pop hl - jr .asm_fb786 - -.asm_fb779 - ld hl, $782d - jr .asm_fb786 - -.asm_fb77e - ld hl, $7828 - jr .asm_fb786 - -.asm_fb783 - ld hl, $7832 - -.asm_fb786 - call PrintText - ret -; fb78a - -Functionfb78a: ; fb78a - ld hl, PartyMon1OT - ld bc, $000b - ld a, [CurPartyMon] - call AddNTimes - ld de, PlayerName - ld c, $b - call .asm_fb7b1 - jr c, .asm_fb7bc - ld hl, PartyMon1ID - ld bc, $0030 - ld a, [CurPartyMon] - call AddNTimes - ld de, PlayerID - ld c, $2 -.asm_fb7b1 - ld a, [de] - cp [hl] - jr nz, .asm_fb7bc - inc hl - inc de - dec c - jr nz, .asm_fb7b1 - and a - ret - -.asm_fb7bc - scf - ret -; fb7be - -Functionfb7be: ; fb7be - ld hl, StringBuffer2 - ld c, $a -.asm_fb7c3 - ld a, [hli] - cp $50 - jr z, .asm_fb7cf - cp $7f - jr nz, .asm_fb7d1 - dec c - jr nz, .asm_fb7c3 - -.asm_fb7cf - scf - ret - -.asm_fb7d1 - and a - ret -; fb7d3 - -Functionfb7d3: ; fb7d3 - ld hl, PartyMon1Nickname - ld bc, $000b - ld a, [CurPartyMon] - call AddNTimes - push hl - call Functionfb802 - ld b, c - ld hl, StringBuffer2 - call Functionfb802 - pop hl - ld a, c - cp b - jr nz, .asm_fb7fe - ld de, StringBuffer2 -.asm_fb7f2 - ld a, [de] - cp $50 - jr z, .asm_fb800 - cp [hl] - jr nz, .asm_fb7fe - inc hl - inc de - jr .asm_fb7f2 - -.asm_fb7fe - and a - ret - -.asm_fb800 - scf - ret -; fb802 -Functionfb802: ; fb802 - ld c, $0 -.asm_fb804 - ld a, [hli] - cp $50 - ret z - inc c - ld a, c - cp $a - jr nz, .asm_fb804 - ret -; fb80f +INCLUDE "event/name_rater.asm" -INCBIN "baserom.gbc", $fb80f, $fb841 - $fb80f Functionfb841: ; fb841 ld a, [ScriptVar] @@ -81805,7 +75900,7 @@ Functionfd0c3: ; fd0c3 ld a, $1 ld [$d10c], a ld hl, PCItems - call Function2f66 + call ReceiveItem ret ; fd0eb @@ -81926,7 +76021,7 @@ Function1000a4: ; 1000a4 ld [$ffe9], a xor a ld [$ff9e], a - call Function2ff7 + call NormalSpeed xor a ld [rIF], a ld a, [BGMapBuffer] @@ -82368,7 +76463,7 @@ Function10039c: ; 10039c ld de, $d000 ld bc, $0054 ld a, $3 - call Function306b + call FarCopyWRAM ret ; 1003ab @@ -82380,7 +76475,7 @@ Function1003ba: ; 1003ba ld de, $d080 ld bc, $0054 ld a, $3 - call Function306b + call FarCopyWRAM ret ; 1003c9 @@ -82389,7 +76484,7 @@ Function1003c9: ; 1003c9 ld de, $ccb4 ld bc, $0054 ld a, $3 - call Function306b + call FarCopyWRAM ret ; 1003d8 @@ -83033,7 +77128,7 @@ Function100989: ; 100989 Function1009a5: ; 1009a5 ld bc, $0168 ld a, $3 - call Function306b + call FarCopyWRAM ret ; 1009ae @@ -84086,7 +78181,7 @@ Function10218d: ; 10218d ld de, EnemyMoveAnimation ld bc, $0026 ld a, $5 - call Function306b + call FarCopyWRAM ld de, EnemyMoveEffect ret ; 10219f @@ -87378,7 +81473,7 @@ Function1183cb: ; 1183cb di ld a, [rIE] ld [$cd32], a - call Function2fef + call DoubleSpeed xor a ld [rIF], a ld [$c300], a @@ -87427,7 +81522,7 @@ Function118452: ; 118452 ld [$ffc9], a ld [$ffe9], a ld [$ff9e], a - call Function2ff7 + call NormalSpeed xor a ld [rIF], a ld a, [$cd32] @@ -89008,7 +83103,7 @@ Function11d493: ; 11d493 ld hl, rSVBK ld e, $1 ld [hl], e - call CheckCaughtMon + call CheckSeenMon ld hl, rSVBK ld e, $5 ld [hl], e @@ -92985,7 +87080,7 @@ Function1de299: ; 1de299 DudeAutoInput_A: ; 1de29f db NO_INPUT, $50 - db BUTTON_A, $00 + db A_BUTTON, $00 db NO_INPUT, $ff ; end ; 1de2a5 @@ -92993,7 +87088,7 @@ DudeAutoInput_RightA: ; 1de2a5 db NO_INPUT, $08 db D_RIGHT, $00 db NO_INPUT, $08 - db BUTTON_A, $00 + db A_BUTTON, $00 db NO_INPUT, $ff ; end ; 1de2af @@ -93007,7 +87102,7 @@ DudeAutoInput_DownA: ; 1de2af db NO_INPUT, $fe db NO_INPUT, $fe db NO_INPUT, $fe - db BUTTON_A, $00 + db A_BUTTON, $00 db NO_INPUT, $ff ; end ; 1de2c5 |