Further split bank 4

This commit is contained in:
PikalaxALT 2015-11-11 16:11:08 -05:00
parent b522b0f165
commit 91068077f0
41 changed files with 5044 additions and 5035 deletions

View File

@ -2889,7 +2889,7 @@ AskUseNextPokemon: ; 3d1f8
ForcePlayerMonChoice: ; 3d227
call EmptyBattleTextBox
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call Function3d2f7
call ForcePickPartyMonInBattle
ld a, [wLinkMode]
@ -2996,7 +2996,7 @@ IsMobileBattle: ; 3d2f1
Function3d2f7: ; 3d2f7
call WhiteBGMap
Function3d2fa: ; 3d2fa
Function3d2fa: ; switch to fullscreen menu?
callba Function5004f
callba Function50405
callba Function8e85
@ -3415,7 +3415,7 @@ ResetEnemyBattleVars: ; 3d557
ld a, $8
call Function3d490
call EmptyBattleTextBox
jp LoadPartyMenuDataHeader
jp LoadStandardMenuDataHeader
; 3d57a
ResetBattleParticipants: ; 3d57a
@ -5233,7 +5233,7 @@ BattleMenu_Pack: ; 3e1c7
and a
jp nz, ItemsCantBeUsed
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
@ -5328,10 +5328,10 @@ Function3e234: ; 3e234
; 3e28d
BattleMenu_PKMN: ; 3e28d
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
Function3e290:
call ExitMenu
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call WhiteBGMap
Function3e299:
call Function3d2fa
@ -5467,7 +5467,7 @@ PlayerSwitch: ; 3e3ad
ld a, [wLinkMode]
and a
jr z, .not_linked
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call Function3e8e4
call WriteBackup

View File

@ -8953,7 +8953,7 @@ BattleCommand_BatonPass: ; 379c9
call DelayFrames
; Transition into switchmon menu
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
callba Function3d2f7
callba ForcePickSwitchMonInBattle
@ -9027,7 +9027,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67
ld a, 1
ld [wd0ec], a
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld hl, Function3e8e4
call CallBattleCore
call WriteBackup
@ -9043,7 +9043,7 @@ BatonPass_LinkEnemySwitch: ; 37a82
and a
ret z
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld hl, Function3e8e4
call CallBattleCore

View File

@ -45,7 +45,7 @@ const_value SET -1
const PLAYEREVENT_4
const PLAYEREVENT_WARP
const PLAYEREVENT_FALL
const PLAYEREVENT_7
const PLAYEREVENT_WHITEOUT
const PLAYEREVENT_HATCH
const PLAYEREVENT_9
NUM_PLAYER_EVENTS EQU const_value

View File

@ -190,7 +190,7 @@ DoEggStep:: ; 16f3e
OverworldHatchEgg:: ; 16f5e
call ResetWindow
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call Function16f70
call Function2b4d
call RestartMapMusic
@ -324,7 +324,7 @@ Function16f7a: ; 16f7a (5:6f7a)
ld [MonType], a
push de
ld b, $0
callba Function116c1
callba NamingScreen
pop hl
ld de, StringBuffer1
call InitName

View File

@ -38,7 +38,7 @@ RestartClock: ; 20021 (8:4021)
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call ClearTileMap
ld hl, .Text_SetWithControlPad
call PrintText

View File

@ -1078,7 +1078,7 @@ PlayerEventScriptPointers: ; 96c0c
dba UnknownScript_0x96c4d ; 4
dba WarpToNewMapScript ; 5
dba FallIntoMapScript ; 6
dba UnknownScript_0x124c8 ; 7
dba Script_OverworldWhiteout ; 7
dba HatchEggScript ; 8
dba UnknownScript_0x96c4f ; 9
dba Invalid_0x96c2d ; 10

View File

@ -161,7 +161,7 @@ Function4e703: ; 4e703
Function4e708: ; 4e708
call GetBaseData
hlcoord 7, 2
jp Function3786
jp PrepMonFrontpic
; 4e711
Function4e711: ; 4e711

266
engine/healmachineanim.asm Executable file
View File

@ -0,0 +1,266 @@
HealMachineAnim: ; 12324
; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon.
ld a, [PartyCount]
and a
ret z
; The location of the healing machine relative to the player is stored in ScriptVar.
; 0: Up and left (Pokemon Center)
; 1: Left (Elm's Lab)
; 2: Up (Hall of Fame)
ld a, [ScriptVar]
ld [Buffer1], a
ld a, [rOBP1]
ld [Buffer2], a
call .DoJumptableFunctions
ld a, [Buffer2]
call Functiond24
ret
; 1233e
.DoJumptableFunctions: ; 1233e
xor a
ld [wd1ec], a
.jumpable_loop
ld a, [Buffer1]
ld e, a
ld d, 0
ld hl, .Pointers
rept 2
add hl, de
endr
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wd1ec]
ld e, a
inc a
ld [wd1ec], a
add hl, de
ld a, [hl]
cp 5
jr z, .finish
ld hl, .Jumptable
rst JumpTable
jr .jumpable_loop
.finish
ret
; 12365
.Pointers: ; 12365
dw .Pokecenter
dw .ElmLab
dw .HallOfFame
; 1236b
.Pokecenter: ; 1236b
db 0, 1, 3, 5
.ElmLab: ; 1236f
db 0, 1, 3, 5
.HallOfFame: ; 12373
db 0, 2, 4, 5
; 12377
.Jumptable: ; 12377
dw .LoadGFX
dw .PC_LoadBallsOntoMachine
dw .HOF_LoadBallsOntoMachine
dw .PlayHealMusic
dw .HOF_PlaySFX
dw .dummy_5 ; never encountered
; 12383
.LoadGFX: ; 12383
call .LoadPalettes
ld de, .HealMachineGFX
ld hl, VTiles0 tile $7c
lb bc, BANK(.HealMachineGFX), $2
call Request2bpp
ret
; 12393
.PC_LoadBallsOntoMachine: ; 12393
ld hl, Sprites + $80
ld de, .PC_ElmsLab_TileMap
call .PlaceHealingMachineTile
call .PlaceHealingMachineTile
jr .LoadBallsOntoMachine
.HOF_LoadBallsOntoMachine: ; 123a1
ld hl, Sprites + $80
ld de, .HOF_TileMap
.LoadBallsOntoMachine: ; 123a7
ld a, [PartyCount]
ld b, a
.party_loop
call .PlaceHealingMachineTile
push de
ld de, SFX_SECOND_PART_OF_ITEMFINDER
call PlaySFX
pop de
ld c, 30
call DelayFrames
dec b
jr nz, .party_loop
ret
; 123bf
.PlayHealMusic: ; 123bf
ld de, MUSIC_HEAL
call PlayMusic
jp .FlashPalettes8Times
; 123c8
.HOF_PlaySFX: ; 123c8
ld de, SFX_GAME_FREAK_LOGO_GS
call PlaySFX
call .FlashPalettes8Times
call WaitSFX
ld de, SFX_BOOT_PC
call PlaySFX
ret
; 123db
.dummy_5: ; 123db
ret
; 123dc
.PC_ElmsLab_TileMap: ; 123dc
db $20, $22, $7c, $16
db $20, $26, $7c, $16
db $26, $20, $7d, $16
db $26, $28, $7d, $36
db $2b, $20, $7d, $16
db $2b, $28, $7d, $36
db $30, $20, $7d, $16
db $30, $28, $7d, $36
; 123fc
.HealMachineGFX: ; 123fc
INCBIN "gfx/unknown/0123fc.2bpp"
; 1241c
.HOF_TileMap: ; 1241c
db $3c, $51, $7d, $16
db $3c, $56, $7d, $16
db $3b, $4d, $7d, $16
db $3b, $5a, $7d, $16
db $39, $49, $7d, $16
db $39, $5d, $7d, $16
; 12434
.LoadPalettes: ; 12434
call IsCGB
jr nz, .cgb
ld a, %11100000
ld [rOBP1], a
ret
.cgb
ld hl, .palettes
ld de, OBPals + 8 * 6
ld bc, 8
ld a, $5
call FarCopyWRAM
ld a, $1
ld [hCGBPalUpdate], a
ret
; 12451
.palettes: ; 12451
RGB 31, 31, 31
RGB 31, 19, 10
RGB 31, 07, 01
RGB 00, 00, 00
; 12459
.FlashPalettes8Times: ; 12459
ld c, $8
.palette_loop
push bc
call .FlashPalettes
ld c, 10
call DelayFrames
pop bc
dec c
jr nz, .palette_loop
ret
; 12469
.FlashPalettes: ; 12469
call IsCGB
jr nz, .go
ld a, [rOBP1]
xor %00101000
ld [rOBP1], a
ret
.go
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, OBPals + 8 * 6
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
push de
ld c, $3
.palette_loop_2
ld a, [hli]
ld e, a
ld a, [hld]
ld d, a
dec hl
ld a, d
ld [hld], a
ld a, e
ld [hli], a
rept 3
inc hl
endr
dec c
jr nz, .palette_loop_2
pop de
dec hl
ld a, d
ld [hld], a
ld a, e
ld [hl], a
pop af
ld [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ret
; 124a3
.PlaceHealingMachineTile: ; 124a3
push bc
ld a, [Buffer1]
lb bc, $10, $20
cp $1 ; ElmsLab
jr z, .okay
lb bc, $00, $00
.okay
ld a, [de]
add c
inc de
ld [hli], a
ld a, [de]
add b
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
pop bc
ret
; 124c1

View File

@ -1676,7 +1676,7 @@ Function28b87: ; 28b87
ld hl, UnknownText_0x28eb8
bccoord 1, 14
call PlaceWholeStringInBoxAtOnce
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
hlcoord 10, 7
ld b, $3
ld c, $7

View File

@ -36,7 +36,7 @@ MartDialog: ; 15a61
HerbShop: ; 15a6e
call FarReadMart
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld hl, Text_HerbShop_Intro
call MartTextBox
call BuyMenu
@ -50,7 +50,7 @@ BargainShop: ; 15a84
ld de, BargainShopData
call LoadMartPointer
call ReadMart
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld hl, Text_BargainShop_Intro
call MartTextBox
call BuyMenu
@ -69,7 +69,7 @@ BargainShop: ; 15a84
Pharmacist: ; 15aae
call FarReadMart
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld hl, UnknownText_0x15e90
call MartTextBox
call BuyMenu
@ -90,7 +90,7 @@ RooftopSale: ; 15ac4
.ok
call LoadMartPointer
call ReadMart
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld hl, Text_Mart_HowMayIHelpYou
call MartTextBox
call BuyMenu
@ -175,7 +175,7 @@ StandardMart: ; 15b47
; 15b62
.HowMayIHelpYou: ; 15b62
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld hl, Text_Mart_HowMayIHelpYou
call PrintText
ld a, $1 ; top menu
@ -183,7 +183,7 @@ StandardMart: ; 15b47
; 15b6e
.TopMenu: ; 15b6e
ld hl, MenuDataHeader_0x15f88
ld hl, MenuDataHeader_BuySell
call CopyMenuDataHeader
call InterpretMenu2
jr c, .quit
@ -228,7 +228,7 @@ StandardMart: ; 15b47
; 15baf
.AnythingElse: ; 15baf
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld hl, Text_Mart_AnythingElse
call PrintText
ld a, $1 ; top menu
@ -472,7 +472,7 @@ endr
BuyMenuLoop: ; 15cef
callba Function24ae8
call UpdateSprites
ld hl, MenuDataHeader_0x15e18
ld hl, MenuDataHeader_Buy
call CopyMenuDataHeader
ld a, [wd045]
ld [wMenuCursorBuffer], a
@ -643,19 +643,19 @@ Text_Mart_CostsThisMuch: ; 0x15e13
db "@"
; 0x15e18
MenuDataHeader_0x15e18: ; 0x15e18
MenuDataHeader_Buy: ; 0x15e18
db $40 ; flags
db 03, 01 ; start coords
db 11, 19 ; end coords
dw MenuData2_0x15e20
dw .menudata2
db 1 ; default option
; 0x15e20
MenuData2_0x15e20: ; 0x15e20
db $30 ; flags
.menudata2: ; 0x15e20
db $30 ; pointers
db 4, 8 ; rows, columns
db 1 ; horizontal spacing
dbw 0, OBPals + 8 * 6
dbw 0, CurMart
dba PlaceMenuItemName
dba .PrintBCDPrices
dba Function244c3
@ -929,16 +929,16 @@ Text_Mart_HowMayIHelpYou: ; 0x15f83
db "@"
; 0x15f88
MenuDataHeader_0x15f88: ; 0x15f88
MenuDataHeader_BuySell: ; 0x15f88
db $40 ; flags
db 00, 00 ; start coords
db 08, 07 ; end coords
dw MenuData2_0x15f90
dw .menudata2
db 1 ; default option
; 0x15f90
MenuData2_0x15f90: ; 0x15f90
db $80 ; flags
.menudata2: ; 0x15f90
db $80 ; strings
db 3 ; items
db "BUY@"
db "SELL@"

959
engine/namingscreen.asm Executable file
View File

@ -0,0 +1,959 @@
_NamingScreen: ; 0x116b7
call DisableSpriteUpdates
call NamingScreen
call Function2b74
ret
; 0x116c1
NamingScreen: ; 116c1
ld hl, wc6d0
ld [hl], e
inc hl
ld [hl], d
ld hl, wc6d4
ld [hl], b
ld hl, Options
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
ld a, [hMapAnims]
push af
xor a
ld [hMapAnims], a
ld a, [hInMenu]
push af
ld a, $1
ld [hInMenu], a
call Function116f8
call DelayFrame
.asm_116e5
call Function11915
jr nc, .asm_116e5
pop af
ld [hInMenu], a
pop af
ld [hMapAnims], a
pop af
ld [Options], a
call ClearJoypad
ret
; 116f8
Function116f8: ; 116f8
call WhiteBGMap
ld b, $8
call GetSGBLayout
call DisableLCD
call Function11c51
call Function118a8
ld a, $e3
ld [rLCDC], a
call Function1171d
call WaitBGMap
call WaitTop
call SetPalettes
call Function11be0
ret
; 1171d
Function1171d: ; 1171d
ld a, [wc6d4]
and 7
ld e, a
ld d, 0
ld hl, Jumptable_1172e
rept 2
add hl, de
endr
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 1172e
Jumptable_1172e: ; 1172e (4:572e)
dw Function1173e
dw Function1178d
dw Function117ae
dw Function117d1
dw Function117f5
dw Function1182c
dw Function1173e
dw Function1173e
Function1173e: ; 1173e (4:573e)
ld a, [CurPartySpecies]
ld [wd265], a
ld hl, Function8e83f
ld a, BANK(Function8e83f)
ld e, $1
rst FarCall ; ; indirect jump to Function8e83f (8e83f (23:683f))
ld a, [CurPartySpecies]
ld [wd265], a
call GetPokemonName
hlcoord 5, 2
call PlaceString
ld l, c
ld h, b
ld de, Strings_11780
call PlaceString
inc de
hlcoord 5, 4
call PlaceString
callba GetGender
jr c, .asm_1177c
ld a, $ef
jr nz, .asm_11778
ld a, $f5
.asm_11778
hlcoord 1, 2
ld [hl], a
.asm_1177c
call Function1187b
ret
; 11780 (4:5780)
Strings_11780: ; 11780
db "'S@"
db "NICKNAME?@"
; 1178d
Function1178d: ; 1178d (4:578d)
callba GetPlayerIcon
call Function11847
hlcoord 5, 2
ld de, String_117a3
call PlaceString
call Function11882
ret
; 117a3 (4:57a3)
String_117a3: ; 117a3
db "YOUR NAME?@"
; 117ae
Function117ae: ; 117ae (4:57ae)
ld de, SilverSpriteGFX
ld b, BANK(SilverSpriteGFX)
call Function11847
hlcoord 5, 2
ld de, String_117c3
call PlaceString
call Function11882
ret
; 117c3 (4:57c3)
String_117c3: ; 117c3
db "RIVAL'S NAME?@"
; 117d1
Function117d1: ; 117d1 (4:57d1)
ld de, MomSpriteGFX
ld b, BANK(MomSpriteGFX)
call Function11847
hlcoord 5, 2
ld de, String_117e6
call PlaceString
call Function11882
ret
; 117e6 (4:57e6)
String_117e6: ; 117e6
db "MOTHER'S NAME?@"
; 117f5
Function117f5: ; 117f5 (4:57f5)
ld de, PokeBallSpriteGFX
ld hl, VTiles0 tile $00
lb bc, BANK(PokeBallSpriteGFX), $4
call Request2bpp
xor a
ld hl, wc300
ld [hli], a
ld [hl], a
ld de, $2420
ld a, $a
call Function3b2a
ld hl, $1
add hl, bc
ld [hl], $0
hlcoord 5, 2
ld de, String_11822
call PlaceString
call Function11889
ret
; 11822 (4:5822)
String_11822: ; 11822
db "BOX NAME?@"
; 1182c
Function1182c: ; 1182c (4:582c)
hlcoord 3, 2
ld de, String_11839
call PlaceString
call Function11882
ret
; 11839 (4:5839)
String_11839: ; 11839
db "おともだち の なまえは?@"
; 11847
Function11847: ; 11847 (4:5847)
push de
ld hl, VTiles0 tile $00
ld c, $4
push bc
call Request2bpp
pop bc
ld hl, $c0
add hl, de
ld e, l
ld d, h
ld hl, VTiles0 tile $04
call Request2bpp
xor a
ld hl, wc300
ld [hli], a
ld [hl], a
pop de
ld b, $a
ld a, d
cp $7a
jr nz, .asm_11873
ld a, e
cp $40
jr nz, .asm_11873
ld b, $1e
.asm_11873
ld a, b
ld de, $2420
call Function3b2a
ret
Function1187b: ; 1187b (4:587b)
ld a, $a
hlcoord 5, 6
jr Function11890
Function11882: ; 11882 (4:5882)
ld a, $7
hlcoord 5, 6
jr Function11890
Function11889: ; 11889 (4:5889)
ld a, $8
hlcoord 5, 4
jr Function11890
Function11890: ; 11890 (4:5890)
ld [wc6d3], a
ld a, l
ld [wc6d8], a
ld a, h
ld [wc6d9], a
ret
Function1189c: ; 1189c
push bc
push af
ld a, [wc6d4]
sub $3
ld b, a
pop af
dec b
pop bc
ret
; 118a8
Function118a8: ; 118a8
call WaitTop
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $60
call ByteFill
hlcoord 1, 1
lb bc, 6, 18
call Function1189c
jr nz, .asm_118c4
lb bc, 4, 18
.asm_118c4
call ClearBox
ld de, NameInputUpper
Function118ca: ; 118ca
call Function1189c
jr nz, .asm_118d5
ld hl, BoxNameInputLower - NameInputLower
add hl, de
ld d, h
ld e, l
.asm_118d5
push de
hlcoord 1, 8
lb bc, 7, 18
call Function1189c
jr nz, .asm_118e7
hlcoord 1, 6
lb bc, 9, 18
.asm_118e7
call ClearBox
hlcoord 1, 16
lb bc, 1, 18
call ClearBox
pop de
hlcoord 2, 8
ld b, $5
call Function1189c
jr nz, .asm_11903
hlcoord 2, 6
ld b, $6
.asm_11903
ld c, $11
.asm_11905
ld a, [de]
ld [hli], a
inc de
dec c
jr nz, .asm_11905
push de
ld de, $17
add hl, de
pop de
dec b
jr nz, .asm_11903
ret
; 11915
Function11915: ; 11915
call JoyTextDelay
ld a, [wJumptableIndex]
bit 7, a
jr nz, .asm_11930
call Function11968
callba Function8cf62
call Function11940
call DelayFrame
and a
ret
.asm_11930
callab Function8cf53
call ClearSprites
xor a
ld [hSCX], a
ld [hSCY], a
scf
ret
; 11940
Function11940: ; 11940
xor a
ld [hBGMapMode], a
hlcoord 1, 5
call Function1189c
jr nz, .asm_1194e
hlcoord 1, 3
.asm_1194e
lb bc, 1, 18
call ClearBox
ld hl, wc6d0
ld e, [hl]
inc hl
ld d, [hl]
ld hl, wc6d8
ld a, [hli]
ld h, [hl]
ld l, a
call PlaceString
ld a, $1
ld [hBGMapMode], a
ret
; 11968
Function11968: ; 11968
ld a, [wJumptableIndex]
ld e, a
ld d, $0
ld hl, Jumptable_11977
rept 2
add hl, de
endr
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 11977
Jumptable_11977: ; 11977 (4:5977)
dw Function1197b
dw Function119a1
Function1197b: ; 1197b (4:597b)
lb de, $50, $18
call Function1189c
jr nz, .asm_11985
ld d, $40
.asm_11985
ld a, $2
call Function3b2a
ld a, c
ld [wc6d5], a
ld a, b
ld [wc6d6], a
ld hl, $1
add hl, bc
ld a, [hl]
ld hl, $e
add hl, bc
ld [hl], a
ld hl, wJumptableIndex
inc [hl]
ret
Function119a1: ; 119a1 (4:59a1)
ld hl, hJoyPressed ; $ffa7
ld a, [hl]
and A_BUTTON
jr nz, .a
ld a, [hl]
and B_BUTTON
jr nz, .b
ld a, [hl]
and START
jr nz, .start
ld a, [hl]
and SELECT
jr nz, .select
ret
.a
call Function11a0b
cp $1
jr z, .select
cp $2
jr z, .b
cp $3
jr z, .asm_119eb
call Function11c11
call Function11b14
ret nc
.start
ld hl, wc6d5
ld c, [hl]
inc hl
ld b, [hl]
ld hl, $c
add hl, bc
ld [hl], $8
ld hl, $d
add hl, bc
ld [hl], $4
call Function1189c
ret nz
inc [hl]
ret
.b
call Function11bbc
ret
.asm_119eb
call Function11bf7
ld hl, wJumptableIndex
set 7, [hl]
ret
.select
ld hl, wcf64
ld a, [hl]
xor 1
ld [hl], a
jr z, .asm_11a04
ld de, NameInputLower
call Function118ca
ret
.asm_11a04
ld de, NameInputUpper
call Function118ca
ret
Function11a0b: ; 11a0b (4:5a0b)
ld hl, wc6d5
ld c, [hl]
inc hl
ld b, [hl]
Function11a11: ; 11a11 (4:5a11)
ld hl, $d
add hl, bc
ld a, [hl]
push bc
ld b, $4
call Function1189c
jr nz, .asm_11a1f
inc b
.asm_11a1f
cp b
pop bc
jr nz, .asm_11a39
ld hl, $c
add hl, bc
ld a, [hl]
cp $3
jr c, .asm_11a33
cp $6
jr c, .asm_11a36
ld a, $3
ret
.asm_11a33
ld a, $1
ret
.asm_11a36
ld a, $2
ret
.asm_11a39
xor a
ret
Function11a3b: ; 11a3b (4:5a3b)
call Function11a8b
ld hl, $d
add hl, bc
ld a, [hl]
ld e, a
swap e
ld hl, $7
add hl, bc
ld [hl], e
ld d, $4
call Function1189c
jr nz, .asm_11a53
inc d
.asm_11a53
cp d
ld de, Unknown_11a79
ld a, $0
jr nz, .asm_11a60
ld de, Unknown_11a82
ld a, $1
.asm_11a60
ld hl, $e
add hl, bc
add [hl]
ld hl, $1
add hl, bc
ld [hl], a
ld hl, $c
add hl, bc
ld l, [hl]
ld h, $0
add hl, de
ld a, [hl]
ld hl, $6
add hl, bc
ld [hl], a
ret
; 11a79 (4:5a79)
Unknown_11a79: ; 11a79
db $00, $10, $20, $30, $40, $50, $60, $70, $80
Unknown_11a82: ; 11a82
db $00, $00, $00, $30, $30, $30, $60, $60, $60
; 11a8b
Function11a8b: ; 11a8b (4:5a8b)
ld hl, hJoyLast
ld a, [hl]
and D_UP
jr nz, .up
ld a, [hl]
and D_DOWN
jr nz, .down
ld a, [hl]
and D_LEFT
jr nz, .left
ld a, [hl]
and D_RIGHT
jr nz, .right
ret
.right
call Function11a11
and a
jr nz, .asm_11ab7
ld hl, $c
add hl, bc
ld a, [hl]
cp $8
jr nc, .asm_11ab4
inc [hl]
ret
.asm_11ab4
ld [hl], $0
ret
.asm_11ab7
cp $3
jr nz, .asm_11abc
xor a
.asm_11abc
ld e, a
add a
add e
ld hl, $c
add hl, bc
ld [hl], a
ret
.left
call Function11a11
and a
jr nz, .asm_11ad8
ld hl, $c
add hl, bc
ld a, [hl]
and a
jr z, .asm_11ad5
dec [hl]
ret
.asm_11ad5
ld [hl], $8
ret
.asm_11ad8
cp $1
jr nz, .asm_11ade
ld a, $4
.asm_11ade
rept 2
dec a
endr
ld e, a
add a
add e
ld hl, $c
add hl, bc
ld [hl], a
ret
.down
ld hl, $d
add hl, bc
ld a, [hl]
call Function1189c
jr nz, .asm_11af9
cp $5
jr nc, .asm_11aff
inc [hl]
ret
.asm_11af9
cp $4
jr nc, .asm_11aff
inc [hl]
ret
.asm_11aff
ld [hl], $0
ret
.up
ld hl, $d
add hl, bc
ld a, [hl]
and a
jr z, .asm_11b0c
dec [hl]
ret
.asm_11b0c
ld [hl], $4
call Function1189c
ret nz
inc [hl]
ret
Function11b14: ; 11b14 (4:5b14)
ld a, [wc6d7]
Function11b17: ; 11b17 (4:5b17)
ld a, [wc6d3]
ld c, a
ld a, [wc6d2]
cp c
ret nc
ld a, [wc6d7]
Function11b23: ; 11b23
call Function11bd0
ld [hl], a
Function11b27: ; 11b27
ld hl, wc6d2
inc [hl]
call Function11bd0
ld a, [hl]
cp $50
jr z, .asm_11b37
ld [hl], $f2
and a
ret
.asm_11b37
scf
ret
; 11b39 (4:5b39)
Function11b39: ; 11b39
ld a, [wc6d2]
and a
ret z
push hl
ld hl, wc6d2
dec [hl]
call Function11bd0
ld c, [hl]
pop hl
.asm_11b48
ld a, [hli]
cp $ff
jr z, Function11b27
cp c
jr z, .asm_11b53
inc hl
jr .asm_11b48
.asm_11b53
ld a, [hl]
jr Function11b23
; 11b56
Dakutens: ; Dummied out
db "かが", "きぎ", "くぐ", "けげ", "こご"
db "さざ", "しじ", "すず", "せぜ", "そぞ"
db "ただ", "ちぢ", "つづ", "てで", "とど"
db "はば", "ひび", "ふぶ", "へべ", "ほぼ"
db "カガ", "キギ", "クグ", "ケゲ", "コゴ"
db "サザ", "シジ", "スズ", "セゼ", "ソゾ"
db "タダ", "チヂ", "ツヅ", "テデ", "トド"
db "ハバ", "ヒビ", "フブ", "へべ", "ホボ"
db $ff
Handakutens: ; Dummied out
db "はぱ", "ひぴ", "ふぷ", "へぺ", "ほぽ"
db "ハパ", "ヒピ", "フプ", "へぺ", "ホポ"
db $ff
; 11bbc
Function11bbc: ; 11bbc (4:5bbc)
ld hl, wc6d2
ld a, [hl]
and a
ret z
dec [hl]
call Function11bd0
ld [hl], $f2
inc hl
ld a, [hl]
cp $f2
ret nz
ld [hl], $eb
ret
Function11bd0: ; 11bd0 (4:5bd0)
push af
ld hl, wc6d0
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wc6d2]
ld e, a
ld d, 0
add hl, de
pop af
ret
; 11be0
Function11be0: ; 11be0
; load $f2, ($eb * [wc6d3]), $50 into the dw address at wc6d0
ld hl, wc6d0
ld a, [hli]
ld h, [hl]
ld l, a
ld [hl], "·"
inc hl
ld a, [wc6d3]
dec a
ld c, a
ld a, "→"
.loop
ld [hli], a
dec c
jr nz, .loop
ld [hl], "@"
ret
; 11bf7
Function11bf7: ; 11bf7 (4:5bf7)
ld hl, wc6d0
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wc6d3]
ld c, a
.asm_11c01
ld a, [hl]
cp $eb
jr z, .asm_11c0a
cp $f2
jr nz, .asm_11c0c
.asm_11c0a
ld [hl], $50
.asm_11c0c
inc hl
dec c
jr nz, .asm_11c01
ret
Function11c11: ; 11c11 (4:5c11)
ld hl, wc6d5
ld c, [hl]
inc hl
ld b, [hl]
ld hl, $6
add hl, bc
ld a, [hl]
ld hl, $4
add hl, bc
add [hl]
sub $8
srl a
srl a
srl a
ld e, a
ld hl, $7
add hl, bc
ld a, [hl]
ld hl, $5
add hl, bc
add [hl]
sub $10
srl a
srl a
srl a
ld d, a
hlcoord 0, 0
ld bc, $14
.asm_11c43
ld a, d
and a
jr z, .asm_11c4b
add hl, bc
dec d
jr .asm_11c43
.asm_11c4b
add hl, de
ld a, [hl]
ld [wc6d7], a
ret
Function11c51: ; 11c51
call ClearSprites
callab Function8cf53
call LoadStandardFont
call LoadFontsExtra
ld de, GFX_11e65
ld hl, VTiles1 tile $6b
lb bc, BANK(GFX_11e65), 1
call Get1bpp
ld de, GFX_11e6d
ld hl, VTiles1 tile $72
lb bc, BANK(GFX_11e6d), 1
call Get1bpp
ld de, VTiles2 tile $60
ld hl, GFX_11cb7
ld bc, $10
ld a, BANK(GFX_11cb7)
call FarCopyBytes
ld de, VTiles0 tile $7e
ld hl, GFX_11cc7
ld bc, $20
ld a, BANK(GFX_11cc7)
call FarCopyBytes
ld a, $5
ld hl, wc312
ld [hli], a
ld [hl], $7e
xor a
ld [hSCY], a
ld [wc3bf], a
ld [hSCX], a
ld [wc3c0], a
ld [wJumptableIndex], a
ld [wcf64], a
ld [hBGMapMode], a
ld [wc6d2], a
ld a, $7
ld [hWX], a
ret
; 11cb7
GFX_11cb7: ; 11cb7
INCBIN "gfx/unknown/011cb7.2bpp"
; 11cc7
GFX_11cc7: ; 11cc7
INCBIN "gfx/unknown/011cc7.2bpp"
; 11ce7
NameInputLower:
db "a b c d e f g h i"
db "j k l m n o p q r"
db "s t u v w x y z "
db "× ( ) : ; [ ] <PK> <MN>"
db "UPPER DEL END "
BoxNameInputLower:
db "a b c d e f g h i"
db "j k l m n o p q r"
db "s t u v w x y z "
db "é 'd 'l 'm 'r 's 't 'v 0"
db "1 2 3 4 5 6 7 8 9"
db "UPPER DEL END "
NameInputUpper: ; Unreferenced?
db "A B C D E F G H I"
db "J K L M N O P Q R"
db "S T U V W X Y Z "
db "- ? ! / . , "
db "lower DEL END "
BoxNameInputUpper:
db "A B C D E F G H I"
db "J K L M N O P Q R"
db "S T U V W X Y Z "
db "× ( ) : ; [ ] <PK> <MN>"
db "- ? ! ♂ ♀ / . , &"
db "lower DEL END "
; 11e5d
GFX_11e5d: ; ????
INCBIN "gfx/unknown/011e5d.2bpp"
; 11e6d
GFX_11e65:
INCBIN "gfx/unknown/011e65.2bpp"
; 11e6d
GFX_11e6d: ; 11e6d
INCBIN "gfx/unknown/011e6d.2bpp"
; 11e75

View File

@ -1,5 +1,5 @@
Function14a1a: ; 14a1a
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
callba Function5e9a
call SpeechTextBox
call UpdateSprites

View File

@ -1560,8 +1560,8 @@ Script_returnafterbattle: ; 0x97459
and $3f
cp $1
jr nz, .notblackedout ; 0x97466 $8
ld b, BANK(UnknownScript_0x124c1)
ld hl, UnknownScript_0x124c1
ld b, BANK(Script_BattleWhiteout)
ld hl, Script_BattleWhiteout
jp ScriptJump
.notblackedout
@ -2884,9 +2884,9 @@ Script_blackoutmod: ; 0x97a78
; map_id (MapIdParam)
call GetScriptByte
ld [wdcb2], a
ld [wLastSpawnMapGroup], a
call GetScriptByte
ld [wdcb3], a
ld [wLastSpawnMapNumber], a
ret
; 0x97a85

191
engine/selectmenu.asm Executable file
View File

@ -0,0 +1,191 @@
SelectMenu:: ; 13327
call CheckRegisteredItem
jr c, .NotRegistered
jp UseRegisteredItem
.NotRegistered
call LoadFont
ld b, BANK(ItemMayBeRegisteredText)
ld hl, ItemMayBeRegisteredText
call MapTextbox
call CloseText
jp LoadMoveSprites
; 13340
ItemMayBeRegisteredText: ; 13340
text_jump UnknownText_0x1c1cf3
db "@"
; 13345
CheckRegisteredItem: ; 13345
ld a, [WhichRegisteredItem]
and a
jr z, .NoRegisteredItem
and REGISTERED_POCKET
rlca
rlca
ld hl, .Pockets
rst JumpTable
ret
.Pockets
dw .CheckItem
dw .CheckBall
dw .CheckKeyItem
dw .CheckTMHM
.CheckItem
ld hl, NumItems
call .CheckRegisteredNo
jr c, .NoRegisteredItem
inc hl
ld e, a
ld d, 0
rept 2
add hl, de
endr
call .IsSameItem
jr c, .NoRegisteredItem
and a
ret
.CheckKeyItem
ld a, [RegisteredItem]
ld hl, KeyItems
ld de, 1
call IsInArray
jr nc, .NoRegisteredItem
ld a, [RegisteredItem]
ld [CurItem], a
and a
ret
.CheckBall
ld hl, NumBalls
call .CheckRegisteredNo
jr nc, .NoRegisteredItem
inc hl
ld e, a
ld d, 0
rept 2
add hl, de
endr
call .IsSameItem
jr c, .NoRegisteredItem
ret
.CheckTMHM
jr .NoRegisteredItem
.NoRegisteredItem
xor a
ld [WhichRegisteredItem], a
ld [RegisteredItem], a
scf
ret
; 133a6
.CheckRegisteredNo ; 133a6
ld a, [WhichRegisteredItem]
and REGISTERED_NUMBER
dec a
cp [hl]
jr nc, .NotEnoughItems
ld [wd107], a
and a
ret
.NotEnoughItems
scf
ret
; 133b6
.IsSameItem ; 133b6
ld a, [RegisteredItem]
cp [hl]
jr nz, .NotSameItem
ld [CurItem], a
and a
ret
.NotSameItem
scf
ret
; 133c3
UseRegisteredItem: ; 133c3
callba CheckItemMenu
ld a, [wItemAttributeParamBuffer]
ld hl, .SwitchTo
rst JumpTable
ret
.SwitchTo
dw .CantUse
dw .NoFunction
dw .NoFunction
dw .NoFunction
dw .Current
dw .Party
dw .Overworld
; 133df
.NoFunction ; 133df
call LoadFont
call CantUseItem
call LoadMoveSprites
and a
ret
; 133ea
.Current ; 133ea
call LoadFont
call DoItemEffect
call LoadMoveSprites
and a
ret
; 133f5
.Party ; 133f5
call ResetWindow
call FadeToMenu
call DoItemEffect
call Function2b3c
call LoadMoveSprites
and a
ret
; 13406
.Overworld ; 13406
call ResetWindow
ld a, 1
ld [wd0ef], a
call DoItemEffect
xor a
ld [wd0ef], a
ld a, [wd0ec]
cp 1
jr nz, ._cantuse
scf
ld a, HMENURETURN_SCRIPT
ld [hMenuReturn], a
ret
; 13422
.CantUse ; 13422
call ResetWindow
._cantuse
call CantUseItem
call LoadMoveSprites
and a
ret
; 1342d

View File

@ -42,7 +42,7 @@ SpecialsPointers:: ; c029
; Map Events
add_special BugContestJudging
add_special CheckPartyFullAfterContest
add_special CheckFirstMonFainted
add_special ContestDropOffMons
add_special ContestReturnMons
add_special Special_GiveParkBalls
add_special Special_CheckMagikarpLength

1970
engine/startmenu.asm Executable file

File diff suppressed because it is too large Load Diff

113
engine/tmhm.asm Executable file
View File

@ -0,0 +1,113 @@
CanLearnTMHMMove: ; 11639
ld a, [CurPartySpecies]
ld [CurSpecies], a
call GetBaseData
ld hl, BaseTMHM
push hl
ld a, [wd262]
ld b, a
ld c, 0
ld hl, TMHMMoves
.loop
ld a, [hli]
and a
jr z, .end
cp b
jr z, .asm_11659
inc c
jr .loop
.asm_11659
pop hl
ld b, CHECK_FLAG
push de
ld d, 0
predef FlagPredef
pop de
ret
.end
pop hl
ld c, 0
ret
; 1166a
GetTMHMMove: ; 1166a
ld a, [wd265]
dec a
ld hl, TMHMMoves
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [wd265], a
ret
; 1167a
TMHMMoves: ; 1167a
db DYNAMICPUNCH
db HEADBUTT
db CURSE
db ROLLOUT
db ROAR
db TOXIC
db ZAP_CANNON
db ROCK_SMASH
db PSYCH_UP
db HIDDEN_POWER
db SUNNY_DAY
db SWEET_SCENT
db SNORE
db BLIZZARD
db HYPER_BEAM
db ICY_WIND
db PROTECT
db RAIN_DANCE
db GIGA_DRAIN
db ENDURE
db FRUSTRATION
db SOLARBEAM
db IRON_TAIL
db DRAGONBREATH
db THUNDER
db EARTHQUAKE
db RETURN
db DIG
db PSYCHIC_M
db SHADOW_BALL
db MUD_SLAP
db DOUBLE_TEAM
db ICE_PUNCH
db SWAGGER
db SLEEP_TALK
db SLUDGE_BOMB
db SANDSTORM
db FIRE_BLAST
db SWIFT
db DEFENSE_CURL
db THUNDERPUNCH
db DREAM_EATER
db DETECT
db REST
db ATTRACT
db THIEF
db STEEL_WING
db FIRE_PUNCH
db FURY_CUTTER
db NIGHTMARE
db CUT
db FLY
db SURF
db STRENGTH
db FLASH
db WHIRLPOOL
db WATERFALL
; Move tutor
db FLAMETHROWER
db THUNDERBOLT
db ICE_BEAM
db 0 ; end
; 116b7

136
event/bug_contest_2.asm Executable file
View File

@ -0,0 +1,136 @@
Special_SelectRandomBugContestContestants: ; 139a8
; Select five random people to participate in the current contest.
; First we have to make sure that any old data is cleared away.
ld c, 10 ; Number of people to choose from.
ld hl, BugCatchingContestantEventFlagTable
.loop1
push bc
push hl
ld e, [hl]
inc hl
ld d, [hl]
ld b, RESET_FLAG
call EventFlagAction
pop hl
rept 2
inc hl
endr
pop bc
dec c
jr nz, .loop1
; Now that that's out of the way, we can get on to the good stuff.
ld c, 5
.loop2
push bc
.next
; Choose a flag at uniform random to be set.
call Random
cp $fa ; 250
jr nc, .next
ld c, $19 ; 25
call SimpleDivide
ld e, b
ld d, 0
ld hl, BugCatchingContestantEventFlagTable
rept 2
add hl, de
endr
ld e, [hl]
inc hl
ld d, [hl]
push de
; If we've already set it, it doesn't count.
ld b, CHECK_FLAG
call EventFlagAction
pop de
ld a, c
and a
jr nz, .next
; Set the flag. This will cause that sprite to not be visible in the contest.
ld b, SET_FLAG
call EventFlagAction
pop bc
; Check if we're done. If so, return. Otherwise, choose the next victim.
dec c
jr nz, .loop2
ret
; 139ed
Special_CheckBugContestContestantFlag: ; 139ed
; Checks the flag of the Bug Catching Contestant whose index is loaded in a.
; Bug: If a >= 10 when this is called, it will read beyond the table.
ld hl, BugCatchingContestantEventFlagTable
ld e, a
ld d, 0
rept 2
add hl, de
endr
ld e, [hl]
inc hl
ld d, [hl]
ld b, CHECK_FLAG
call EventFlagAction
ret
; 139fe
BugCatchingContestantEventFlagTable: ; 139fe
dw EVENT_BUG_CATCHING_CONTESTANT_1A
dw EVENT_BUG_CATCHING_CONTESTANT_2A
dw EVENT_BUG_CATCHING_CONTESTANT_3A
dw EVENT_BUG_CATCHING_CONTESTANT_4A
dw EVENT_BUG_CATCHING_CONTESTANT_5A
dw EVENT_BUG_CATCHING_CONTESTANT_6A
dw EVENT_BUG_CATCHING_CONTESTANT_7A
dw EVENT_BUG_CATCHING_CONTESTANT_8A
dw EVENT_BUG_CATCHING_CONTESTANT_9A
dw EVENT_BUG_CATCHING_CONTESTANT_10A
; 13a12
ContestDropOffMons: ; 13a12
ld hl, PartyMon1HP
ld a, [hli]
or [hl]
jr z, .fainted
; Mask the rest of your party by setting the count to 1...
ld hl, PartyCount
ld a, 1
ld [hli], a
inc hl
; ... backing up the second mon index somewhere...
ld a, [hl]
ld [wBugContestSecondPartySpecies], a
; ... and replacing it with the terminator byte
ld [hl], $ff
xor a
ld [ScriptVar], a
ret
.fainted
ld a, $1
ld [ScriptVar], a
ret
; 13a31
ContestReturnMons: ; 13a31
; Restore the species of the second mon.
ld hl, PartySpecies + 1
ld a, [wBugContestSecondPartySpecies]
ld [hl], a
; Restore the party count, which must be recomputed.
ld b, $1
.loop
ld a, [hli]
cp $ff
jr z, .done
inc b
jr .loop
.done
ld a, b
ld [PartyCount], a
ret
; 13a47

480
event/bug_contest_judging.asm Executable file
View File

@ -0,0 +1,480 @@
_BugContestJudging: ; 1369d
call ContestScore
callba MobileFn_105f79
call Function13819
ld a, [wd00a]
call LoadContestantName
ld a, [wd00b]
ld [wd265], a
call GetPokemonName
ld hl, BugContest_ThirdPlaceText
call PrintText
ld a, [EndFlypoint]
call LoadContestantName
ld a, [MovementBuffer]
ld [wd265], a
call GetPokemonName
ld hl, BugContest_SecondPlaceText
call PrintText
ld a, [wd002]
call LoadContestantName
ld a, [wd003]
ld [wd265], a
call GetPokemonName
ld hl, BugContest_FirstPlaceText
call PrintText
jp Function13807
; 136eb
BugContest_FirstPlaceText: ; 0x136eb
text_jump ContestJudging_FirstPlaceText
start_asm
BugContest_FirstPlace: ; 136f0
ld de, SFX_1ST_PLACE
call PlaySFX
call WaitSFX
ld hl, BugContest_FirstPlaceScoreText
ret
; 136fd
BugContest_FirstPlaceScoreText: ; 0x136fd
; The winning score was @ points!
text_jump ContestJudging_FirstPlaceScoreText
db "@"
; 0x13702
BugContest_SecondPlaceText: ; 0x13702
; Placing second was @ , who caught a @ !@ @
text_jump ContestJudging_SecondPlaceText
start_asm
BugContest_SecondPlace: ; 13707
ld de, SFX_2ND_PLACE
call PlaySFX
call WaitSFX
ld hl, BugContest_SecondPlaceScoreText
ret
; 13714
BugContest_SecondPlaceScoreText: ; 0x13714
; The score was @ points!
text_jump ContestJudging_SecondPlaceScoreText
db "@"
; 0x13719
BugContest_ThirdPlaceText: ; 0x13719
; Placing third was @ , who caught a @ !@ @
text_jump ContestJudging_ThirdPlaceText
start_asm
; 0x1371e
BugContest_ThirdPlace: ; 1371e
ld de, SFX_3RD_PLACE
call PlaySFX
call WaitSFX
ld hl, BugContest_ThirdPlaceScoreText
ret
; 1372b
BugContest_ThirdPlaceScoreText: ; 0x1372b
; The score was @ points!
text_jump ContestJudging_ThirdPlaceScoreText
db "@"
; 0x13730
LoadContestantName: ; 13730
; If a = 0, get your name.
dec a
jr z, .done
; Find the pointer for the trainer class of the Bug Catching Contestant whose ID is in a.
ld c, a
ld b, 0
ld hl, BugContestantPointers
rept 2
add hl, bc
endr
ld a, [hli]
ld h, [hl]
ld l, a
; Copy the Trainer Class to c.
ld a, [hli]
ld c, a
; Save hl and bc for later.
push hl
push bc
; Get the Trainer Class name and copy it into wd016.
callab GetTrainerClassName
ld hl, StringBuffer1
ld de, wd016
ld bc, TRAINER_CLASS_NAME_LENGTH
call CopyBytes
ld hl, wd016
; Delete the trailing terminator and replace it with a space.
.next
ld a, [hli]
cp "@"
jr nz, .next
dec hl
ld [hl], " "
inc hl
ld d, h
ld e, l
; Restore the Trainer Class ID and Trainer ID pointer. Save de for later.
pop bc
pop hl
push de
; Get the name of the trainer with class c and ID b.
ld a, [hl]
ld b, a
callab GetTrainerName
; Append the name to wd016.
ld hl, StringBuffer1
pop de
ld bc, NAME_LENGTH - 1
jp CopyBytes
.done
ld hl, PlayerName
ld de, wd016
ld bc, NAME_LENGTH
jp CopyBytes
; 13783
BugContestantPointers: ; 13783
dw BugContestant_BugCatcherDon ; This reverts back to the player
dw BugContestant_BugCatcherDon
dw BugContestant_BugCatcherEd
dw BugContestant_CooltrainerMNick
dw BugContestant_PokefanMWilliam
dw BugContestant_BugCatcherBenny
dw BugContestant_CamperBarry
dw BugContestant_PicnickerCindy
dw BugContestant_BugCatcherJosh
dw BugContestant_YoungsterSamuel
dw BugContestant_SchoolboyKipp
; 13799
BugContestant_BugCatcherDon:
db BUG_CATCHER, DON
dbw KAKUNA, 300
dbw METAPOD, 285
dbw CATERPIE, 226
BugContestant_BugCatcherEd:
db BUG_CATCHER, ED
dbw BUTTERFREE, 286
dbw BUTTERFREE, 251
dbw CATERPIE, 237
BugContestant_CooltrainerMNick:
db COOLTRAINERM, NICK
dbw SCYTHER, 357
dbw BUTTERFREE, 349
dbw PINSIR, 368
BugContestant_PokefanMWilliam:
db POKEFANM, WILLIAM
dbw PINSIR, 332
dbw BUTTERFREE, 324
dbw VENONAT, 321
BugContestant_BugCatcherBenny:
db BUG_CATCHER, BUG_CATCHER_BENNY
dbw BUTTERFREE, 318
dbw WEEDLE, 295
dbw CATERPIE, 285
BugContestant_CamperBarry:
db CAMPER, BARRY
dbw PINSIR, 366
dbw VENONAT, 329
dbw KAKUNA, 314
BugContestant_PicnickerCindy:
db PICNICKER, CINDY
dbw BUTTERFREE, 341
dbw METAPOD, 301
dbw CATERPIE, 264
BugContestant_BugCatcherJosh:
db BUG_CATCHER, JOSH
dbw SCYTHER, 326
dbw BUTTERFREE, 292
dbw METAPOD, 282
BugContestant_YoungsterSamuel:
db YOUNGSTER, SAMUEL
dbw WEEDLE, 270
dbw PINSIR, 282
dbw CATERPIE, 251
BugContestant_SchoolboyKipp:
db SCHOOLBOY, KIPP
dbw VENONAT, 267
dbw PARAS, 254
dbw KAKUNA, 259
; 13807
Function13807: ; 13807
ld hl, wd00a
ld de, -4
ld b, 3
.loop
ld a, [hl]
cp 1
jr z, .done
add hl, de
dec b
jr nz, .loop
.done
ret
; 13819
Function13819: ; 13819
call Function13833
call Function138b0
ld hl, wd00e
ld a, 1
ld [hli], a
ld a, [wContestMon]
ld [hli], a
ld a, [hProduct]
ld [hli], a
ld a, [hMultiplicand]
ld [hl], a
call Function1383e
ret
; 13833
Function13833: ; 13833
ld hl, wd002
ld b, 12
xor a
.loop
ld [hli], a
dec b
jr nz, .loop
ret
; 1383e
Function1383e: ; 1383e
ld de, wd010
ld hl, wd004
ld c, 2
call StringCmp
jr c, .next
ld hl, EndFlypoint
ld de, wd00a
ld bc, 4
call CopyBytes
ld hl, wd002
ld de, EndFlypoint
ld bc, 4
call CopyBytes
ld hl, wd002
call Function138a0
jr .done
.next
ld de, wd010
ld hl, wd008
ld c, 2
call StringCmp
jr c, .next2
ld hl, EndFlypoint
ld de, wd00a
ld bc, 4
call CopyBytes
ld hl, EndFlypoint
call Function138a0
jr .done
.next2
ld de, wd010
ld hl, wd00c
ld c, 2
call StringCmp
jr c, .done
ld hl, wd00a
call Function138a0
.done
ret
; 138a0
Function138a0: ; 138a0
ld de, wd00e
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hl], a
ret
; 138b0
Function138b0: ; 138b0
ld e, 0
.loop
push de
call Special_CheckBugContestContestantFlag
pop de
jr nz, .done
ld a, e
rept 2
inc a
endr
ld [wd00e], a
dec a
ld c, a
ld b, 0
ld hl, BugContestantPointers
rept 2
add hl, bc
endr
ld a, [hli]
ld h, [hl]
ld l, a
rept 2
inc hl
endr
.loop2
call Random
and 3
cp 3
jr z, .loop2
ld c, a
ld b, 0
rept 3
add hl, bc
endr
ld a, [hli]
ld [wd00f], a
ld a, [hli]
ld h, [hl]
ld l, a
call Random
and 7
ld c, a
ld b, 0
add hl, bc
ld a, h
ld [wd010], a
ld a, l
ld [wd011], a
push de
call Function1383e
pop de
.done
inc e
ld a, e
cp 10
jr nz, .loop
ret
; 13900
ContestScore: ; 13900
; Determine the player's score in the Bug Catching Contest.
xor a
ld [hProduct], a
ld [hMultiplicand], a
ld a, [wContestMonSpecies] ; Species
and a
jr z, .done
; Tally the following:
; Max HP * 4
ld a, [wContestMonMaxHP + 1]
call .AddContestStat
ld a, [wContestMonMaxHP + 1]
call .AddContestStat
ld a, [wContestMonMaxHP + 1]
call .AddContestStat
ld a, [wContestMonMaxHP + 1]
call .AddContestStat
; Stats
ld a, [wContestMonAttack + 1]
call .AddContestStat
ld a, [wContestMonDefense + 1]
call .AddContestStat
ld a, [wContestMonSpeed + 1]
call .AddContestStat
ld a, [wContestMonSpclAtk + 1]
call .AddContestStat
ld a, [wContestMonSpclDef + 1]
call .AddContestStat
; DVs
ld a, [wContestMonDVs + 0]
ld b, a
and 2
rept 2
add a
endr
ld c, a
swap b
ld a, b
and 2
add a
add c
ld d, a
ld a, [wContestMonDVs + 1]
ld b, a
and 2
ld c, a
swap b
ld a, b
and 2
srl a
rept 2
add c
endr
rept 2
add d
endr
call .AddContestStat
; Remaining HP / 8
ld a, [wContestMonHP + 1]
srl a
srl a
srl a
call .AddContestStat
; Whether it's holding an item
ld a, [wContestMonItem]
and a
jr z, .done
ld a, 1
call .AddContestStat
.done
ret
; 1397f
.AddContestStat: ; 1397f
ld hl, hMultiplicand
add [hl]
ld [hl], a
ret nc
dec hl
inc [hl]
ret
; 13988

287
event/elevator.asm Executable file
View File

@ -0,0 +1,287 @@
Elevator:: ; 1342d
call Function1344a
call Function1347d
jr c, .asm_13448
ld [wd041], a
call Function134dd
jr c, .asm_13448
ld hl, wd041
cp [hl]
jr z, .asm_13448
call Function134c0
and a
ret
.asm_13448
scf
ret
; 1344a
Function1344a: ; 1344a
ld a, b
ld [EngineBuffer1], a
ld a, e
ld [wd03f], a
ld a, d
ld [wd040], a
call Function1345a
ret
; 1345a
Function1345a: ; 1345a
ld de, OBPals + 8 * 6
ld bc, 4
ld hl, wd03f
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [EngineBuffer1]
call GetFarByte
inc hl
ld [de], a
inc de
.asm_1346f
ld a, [EngineBuffer1]
call GetFarByte
ld [de], a
inc de
add hl, bc
cp $ff
jr nz, .asm_1346f
ret
; 1347d
Function1347d: ; 1347d
ld hl, wd03f
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [EngineBuffer1]
call GetFarByte
ld c, a
inc hl
ld a, [BackupMapGroup]
ld d, a
ld a, [BackupMapNumber]
ld e, a
ld b, $0
.asm_13495
ld a, [EngineBuffer1]
call GetFarByte
cp $ff
jr z, .asm_134be
rept 2
inc hl
endr
ld a, [EngineBuffer1]
call GetFarByte
inc hl
cp d
jr nz, .asm_134b7
ld a, [EngineBuffer1]
call GetFarByte
inc hl
cp e
jr nz, .asm_134b8
jr .asm_134bb
.asm_134b7
inc hl
.asm_134b8
inc b
jr .asm_13495
.asm_134bb
xor a
ld a, b
ret
.asm_134be
scf
ret
; 134c0
Function134c0: ; 134c0
push af
ld hl, wd03f
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
pop af
ld bc, 4
call AddNTimes
inc hl
ld de, wdcac
ld a, [EngineBuffer1]
ld bc, 3
call FarCopyBytes
ret
; 134dd
Function134dd: ; 134dd
call LoadStandardMenuDataHeader
ld hl, Elevator_WhichFloorText
call PrintText
call Elevator_GetCurrentFloorText
ld hl, Elevator_MenuDataHeader
call CopyMenuDataHeader
call Function352f
call UpdateSprites
xor a
ld [wd0e4], a
call HandleScrollingMenu
call WriteBackup
ld a, [wcf73]
cp $2
jr z, .asm_1350b
xor a
ld a, [wcf77]
ret
.asm_1350b
scf
ret
; 1350d
Elevator_WhichFloorText: ; 0x1350d
; Which floor?
text_jump UnknownText_0x1bd2bc
db "@"
; 0x13512
Elevator_GetCurrentFloorText: ; 13512
ld hl, Options
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
hlcoord 0, 0
ld b, 4
ld c, 8
call TextBox
hlcoord 1, 2
ld de, Elevator_CurrentFloorText
call PlaceString
hlcoord 4, 4
call Elevator_GetCurrentFloorString
pop af
ld [Options], a
ret
; 13537
Elevator_CurrentFloorText: ; 13537
db "Now on:@"
; 1353f
Elevator_GetCurrentFloorString: ; 1353f
push hl
ld a, [wd041]
ld e, a
ld d, 0
ld hl, wd0f1
add hl, de
ld a, [hl]
pop de
call GetFloorString
ret
; 13550
Elevator_MenuDataHeader: ; 0x13550
db $40 ; flags
db 01, 12 ; start coords
db 09, 18 ; end coords
dw Elevator_MenuData2
db 1 ; default option
; 0x13558
Elevator_MenuData2: ; 0x13558
db $10 ; flags
db 4, 0 ; rows, columns
db 1 ; horizontal spacing
dbw 0, OBPals + 8 * 6
dba GetElevatorFlorStrings
dba NULL
dba NULL
; 13568
GetElevatorFlorStrings: ; 13568
ld a, [MenuSelection]
GetFloorString: ; 1356b
push de
call FloorToString
ld d, h
ld e, l
pop hl
jp PlaceString
; 13575
FloorToString: ; 13575
push de
ld e, a
ld d, 0
ld hl, .floors
rept 2
add hl, de
endr
ld a, [hli]
ld h, [hl]
ld l, a
pop de
ret
; 13583
.floors
dw .b4f
dw .b3f
dw .b2f
dw .b1f
dw ._1f
dw ._2f
dw ._3f
dw ._4f
dw ._5f
dw ._6f
dw ._7f
dw ._8f
dw ._9f
dw ._10f
dw ._11f
dw .roof
.b4f
db "B4F@"
.b3f
db "B3F@"
.b2f
db "B2F@"
.b1f
db "B1F@"
._1f
db "1F@"
._2f
db "2F@"
._3f
db "3F@"
._4f
db "4F@"
._5f
db "5F@"
._6f
db "6F@"
._7f
db "7F@"
._8f
db "8F@"
._9f
db "9F@"
._10f
db "10F@"
._11f
db "11F@"
.roof
db "ROOF@"
; 135db

68
event/forced_movement.asm Executable file
View File

@ -0,0 +1,68 @@
Script_ForcedMovement:: ; 0x1253d
checkcode VAR_FACING
if_equal DOWN, .down
if_equal UP, .up
if_equal LEFT, .left
if_equal RIGHT, .right
end
; 0x12550
.up: ; 0x12550
applymovement PLAYER, .MovementData_up
end
; 0x12555
.down: ; 0x12555
applymovement PLAYER, .MovementData_down
end
; 0x1255a
.right: ; 0x1255a
applymovement PLAYER, .MovementData_right
end
; 0x1255f
.left: ; 0x1255f
applymovement PLAYER, .MovementData_left
end
; 0x12564
.MovementData_up: ; 0x12564
step_wait5
big_step_down
turn_in_down
step_wait5
big_step_down
turn_head_down
step_end
; 0x1256b
.MovementData_down: ; 0x1256b
step_wait5
big_step_down
turn_in_up
step_wait5
big_step_down
turn_head_up
step_end
; 0x12572
.MovementData_right: ; 0x12572
step_wait5
big_step_down
turn_in_left
step_wait5
big_step_down
turn_head_left
step_end
; 0x12579
.MovementData_left: ; 0x12579
step_wait5
big_step_down
turn_in_right
step_wait5
big_step_down
turn_head_right
step_end
; 0x12580

54
event/itemball.asm Executable file
View File

@ -0,0 +1,54 @@
FindItemInBallScript:: ; 0x122ce
callasm .TryReceiveItem
iffalse .no_room
disappear LAST_TALKED
loadfont
writetext .text_found
playsound SFX_ITEM
pause 60
itemnotify
loadmovesprites
end
; 0x122e3
.no_room: ; 0x122e3
loadfont
writetext .text_found
closetext
writetext .text_bag_full
closetext
loadmovesprites
end
; 0x122ee
.text_found: ; 0x122ee
; found @ !
text_jump UnknownText_0x1c0a1c
db "@"
; 0x122f3
.text_bag_full: ; 0x122f3
; But can't carry any more items.
text_jump UnknownText_0x1c0a2c
db "@"
; 0x122f8
.TryReceiveItem: ; 122f8
xor a
ld [ScriptVar], a
ld a, [EngineBuffer1]
ld [wd265], a
call GetItemName
ld hl, StringBuffer3
call CopyName2
ld a, [EngineBuffer1]
ld [CurItem], a
ld a, [CurFruit]
ld [wItemQuantityChangeBuffer], a
ld hl, NumItems
call ReceiveItem
ret nc
ld a, $1
ld [ScriptVar], a
ret
; 12324

58
event/itemfinder.asm Executable file
View File

@ -0,0 +1,58 @@
ItemFinder: ; 12580
callba CheckForSignpostItems
jr c, .found_something
ld hl, .Script_FoundNothing
jr .resume
.found_something
ld hl, .Script_FoundSomething
.resume
call QueueScript
ld a, $1
ld [wd0ec], a
ret
; 12599
.ItemfinderSound: ; 12599
ld c, $4
.sfx_loop
push bc
ld de, SFX_SECOND_PART_OF_ITEMFINDER
call WaitPlaySFX
ld de, SFX_TRANSACTION
call WaitPlaySFX
pop bc
dec c
jr nz, .sfx_loop
ret
; 125ad
.Script_FoundSomething: ; 0x125ad
reloadmappart
special UpdateTimePals
callasm .ItemfinderSound
writetext .Text_FoundSomething
loadmovesprites
end
; 0x125ba
.Script_FoundNothing: ; 0x125ba
reloadmappart
special UpdateTimePals
writetext .Text_FoundNothing
loadmovesprites
end
; 0x125c3
.Text_FoundSomething: ; 0x125c3
; Yes! ITEMFINDER indicates there's an item nearby.
text_jump UnknownText_0x1c0a77
db "@"
; 0x125c8
.Text_FoundNothing: ; 0x125c8
; Nope! ITEMFINDER isn't responding.
text_jump UnknownText_0x1c0aa9
db "@"
; 0x125cd

View File

@ -23,7 +23,7 @@ UnknownText_0x88013: ; 0x88013
; 0x88018
Special_SelectApricornForKurt: ; 88018
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld c, $1
xor a
ld [wd0e4], a

View File

@ -103,7 +103,7 @@ endr
.AccessBankOfMom: ; 162a8
ld hl, UnknownText_0x1665d
call PrintText
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld hl, MenuDataHeader_0x166b5
call CopyMenuDataHeader
call InterpretMenu2
@ -148,7 +148,7 @@ endr
ld [hl], a
ld a, $5
ld [wcf64], a
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call Function16517
call Function1656b
call Function16571
@ -216,7 +216,7 @@ endr
ld [hl], a
ld a, $5
ld [wcf64], a
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call Function16512
call Function1656b
call Function16571

View File

@ -19,7 +19,7 @@ MoveDeletion:
jr z, .asm_2c5ca
ld hl, UnknownText_0x2c5ea
call PrintText
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
callba Function12f5b
push af
call Function2b74

84
event/whiteout.asm Executable file
View File

@ -0,0 +1,84 @@
Script_BattleWhiteout:: ; 0x124c1
callasm BattleBGMap
jump Script_Whiteout
; 0x124c8
Script_OverworldWhiteout:: ; 0x124c8
refreshscreen $0
callasm OverworldBGMap
Script_Whiteout: ; 0x124ce
writetext .WhitedOutText
closetext
special FadeBlackBGMap
pause 40
special HealParty
checkflag ENGINE_BUG_CONTEST_TIMER
iftrue .bug_contest
callasm HalveMoney
callasm GetWhiteoutSpawn
farscall Script_AbortBugContest
special WarpToSpawnPoint
newloadmap MAPSETUP_WARP
resetfuncs
.bug_contest
jumpstd bugcontestresultswarp
; 0x124f5
.WhitedOutText: ; 0x124f5
; is out of useable #MON! whited out!
text_jump UnknownText_0x1c0a4e
db "@"
; 0x124fa
OverworldBGMap: ; 124fa
call ClearPalettes
call ClearScreen
call Function3200
call HideSprites
call Function4f0
ret
; 1250a
BattleBGMap: ; 1250a
ld b, $0
call GetSGBLayout
call SetPalettes
ret
; 12513
HalveMoney: ; 12513
; Empty function...
callba MobileFn_1060c7
; Halve the player's money.
ld hl, Money
ld a, [hl]
srl a
ld [hli], a
ld a, [hl]
rra
ld [hli], a
ld a, [hl]
rra
ld [hl], a
ret
; 12527
GetWhiteoutSpawn: ; 12527
ld a, [wLastSpawnMapGroup]
ld d, a
ld a, [wLastSpawnMapNumber]
ld e, a
callba IsSpawnPoint
ld a, c
jr c, .yes
xor a ; SPAWN_HOME
.yes
ld [wd001], a
ret
; 1253d

View File

@ -1711,11 +1711,11 @@ DrawBattleHPBar:: ; 3750
; 3786
Function3786:: ; 3786
PrepMonFrontpic:: ; 3786
ld a, $1
ld [wc2c6], a
Function378b:: ; 378b
_PrepMonFrontpic:: ; 378b
ld a, [CurPartySpecies]
call IsAPokemon
jr c, .not_pokemon

View File

@ -1963,7 +1963,7 @@ CheckStandingOnXYTrigger:: ; 2ae7
FadeToMenu:: ; 2b29
xor a
ld [hBGMapMode], a
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
callba FadeBlackBGMap
call ClearSprites
call DisableSpriteUpdates

View File

@ -52,7 +52,7 @@ MenuTextBoxBackup:: ; 1d67
ret
; 1d6e
LoadPartyMenuDataHeader:: ; 1d6e
LoadStandardMenuDataHeader:: ; 1d6e
ld hl, MenuDataHeader_0x1d75
call LoadMenuDataHeader
ret

View File

@ -603,7 +603,7 @@ endr
xor a ; PARTYMON
ld [MonType], a
ld b, 0
callba Function116c1
callba NamingScreen
call FadeToWhite
@ -656,7 +656,7 @@ endr
ld [MonType], a
ld de, wd050
ld b, $0
callba Function116c1
callba NamingScreen
ld a, BANK(sBoxMonNicknames)
call GetSRAMBank

View File

@ -42,6 +42,8 @@
charmap "<PO>", $70
charmap "<KE>", $71
charmap "◀", $71
charmap "<``>", $72
charmap "<''>", $73
charmap "<ID>", $73
charmap "№", $74
charmap "…", $75

5045
main.asm

File diff suppressed because it is too large Load Diff

View File

@ -96,7 +96,7 @@ OfficerScript_0x6a204:
iffalse Route35NationalParkgate_DeclinedToParticipate
checkcode VAR_PARTYCOUNT
if_greater_than $1, Route35NationalParkgate_LeaveTheRestBehind
special CheckFirstMonFainted
special ContestDropOffMons
clearevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER
Route35NationalParkgate_OkayToProceed:
setflag ENGINE_BUG_CONTEST_TIMER
@ -140,7 +140,7 @@ Route35NationalParkgate_LessThanFullParty: ; 6a27d
writetext UnknownText_0x6a4c6
yesorno
iffalse Route35NationalParkgate_DeclinedToLeaveMonsBehind
special CheckFirstMonFainted
special ContestDropOffMons
iftrue Route35NationalParkgate_FirstMonIsFainted
setevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER
writetext UnknownText_0x6a537

View File

@ -148,7 +148,7 @@ Route36OfficerScriptContest:
iffalse .DecidedNotToJoinContest
checkcode VAR_PARTYCOUNT
if_greater_than $1, .LeaveMonsWithOfficer
special CheckFirstMonFainted
special ContestDropOffMons
clearevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER
.ResumeStartingContest:
setflag ENGINE_BUG_CONTEST_TIMER
@ -183,7 +183,7 @@ Route36OfficerScriptContest:
writetext UnknownText_0x6afb0
yesorno
iffalse .RefusedToLeaveMons
special CheckFirstMonFainted
special ContestDropOffMons
iftrue .FirstMonIsFainted
setevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER
writetext UnknownText_0x6b021

View File

@ -430,7 +430,7 @@ Function17a91e: ; 17a91e (5e:691e)
ret
.asm_17a92c
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call Function17a99e
ld hl, $d088
set 7, [hl]

View File

@ -2927,7 +2927,7 @@ UnknownText_0x8a23c: ; 0x8a23c
; 0x8a241
Function8a241: ; 8a241 (22:6241)
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call Function891fe
call Function8a262
jr nc, .asm_8a254
@ -3455,7 +3455,7 @@ Palette_8a624: ; 8a624
; 8a62c
Function8a62c: ; 8a62c (22:662c)
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call Function891fe
xor a
call Function8b94a
@ -3643,7 +3643,7 @@ Function8a78c: ; 8a78c (22:678c)
call Function891fe
ld de, wd002
ld b, $5
callba Function116c1
callba NamingScreen
call OpenSRAMBank4
call Function8931b
push bc
@ -3885,7 +3885,7 @@ Function8a999: ; 8a999 (22:6999)
jr c, .asm_8a9bb
push bc
push de
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
pop de
dec e
ld a, e
@ -4141,7 +4141,7 @@ Function8ab77: ; 8ab77 (22:6b77)
Function8ab93: ; 8ab93 (22:6b93)
call WhiteBGMap
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
callba Function105688
call ClearSprites
call Function891fe

View File

@ -4519,7 +4519,7 @@ Unknown_101d8d: ; 101d8d
Function101d95: ; 101d95
call Function101ee2
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
ld e, $e
call Function101ee4
ld hl, wcd29
@ -6292,7 +6292,7 @@ Jumptable_1029cb: ; 1029cb
; 1029cf
Function1029cf: ; 1029cf
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
hlcoord 10, 7
ld b, $3
ld c, $8

View File

@ -884,7 +884,7 @@ Function16d42e: ; 16d42e
; 16d43b
Function16d43b: ; 16d43b
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call WhiteBGMap
call ClearTileMap
call ClearSprites
@ -1034,7 +1034,7 @@ Function16d6ca: ; 16d6ca
; 16d6ce
Function16d6ce: ; 16d6ce
call LoadPartyMenuDataHeader
call LoadStandardMenuDataHeader
call Function16d6e1
callba Function87d
call Call_ExitMenu

230
unknown/013a47.asm Executable file
View File

@ -0,0 +1,230 @@
Function13a47: ; unreferenced
ld hl, PartyCount
ld a, [hl]
and a
ret z
cp PARTY_LENGTH + 1
jr c, .asm_13a54
ld a, PARTY_LENGTH
ld [hl], a
.asm_13a54
inc hl
ld b, a
ld c, 0
.asm_13a58
ld a, [hl]
and a
jr z, .asm_13a64
cp $fc
jr z, .asm_13a64
cp $fe
jr c, .asm_13a73
.asm_13a64
ld [hl], SMEARGLE
push hl
push bc
ld a, c
ld hl, PartyMon1Species
call GetPartyLocation
ld [hl], SMEARGLE
pop bc
pop hl
.asm_13a73
inc hl
inc c
dec b
jr nz, .asm_13a58
ld [hl], $ff
ld hl, PartyMon1
ld a, [PartyCount]
ld d, a
ld e, 0
.asm_13a83
push de
push hl
ld b, h
ld c, l
ld a, [hl]
and a
jr z, .asm_13a8f
cp NUM_POKEMON + 1
jr c, .asm_13a9c
.asm_13a8f
ld [hl], SMEARGLE
push de
ld d, 0
ld hl, PartySpecies
add hl, de
pop de
ld a, SMEARGLE
ld [hl], a
.asm_13a9c
ld [CurSpecies], a
call GetBaseData
ld hl, MON_LEVEL
add hl, bc
ld a, [hl]
cp MIN_LEVEL
ld a, MIN_LEVEL
jr c, .asm_13ab4
ld a, [hl]
cp MAX_LEVEL
jr c, .asm_13ab5
ld a, MAX_LEVEL
.asm_13ab4
ld [hl], a
.asm_13ab5
ld [CurPartyLevel], a
ld hl, MON_MAXHP
add hl, bc
ld d, h
ld e, l
ld hl, MON_EXP + 2
add hl, bc
ld b, $1
predef CalcPkmnStats
pop hl
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop de
inc e
dec d
jr nz, .asm_13a83
ld de, PartyMonNicknames
ld a, [PartyCount]
ld b, a
ld c, 0
.asm_13adc
push bc
call Function13b71
push de
callba CheckStringForErrors
pop hl
pop bc
jr nc, .asm_13b0e
push bc
push hl
ld hl, PartySpecies
push bc
ld b, 0
add hl, bc
pop bc
ld a, [hl]
cp EGG
ld hl, .TAMAGO
jr z, .asm_13b06
ld [wd265], a
call GetPokemonName
ld hl, StringBuffer1
.asm_13b06
pop de
ld bc, PKMN_NAME_LENGTH
call CopyBytes
pop bc
.asm_13b0e
inc c
dec b
jr nz, .asm_13adc
ld de, PartyMonOT
ld a, [PartyCount]
ld b, a
ld c, 0
.asm_13b1b
push bc
call Function13b71
push de
callba CheckStringForErrors
pop hl
jr nc, .asm_13b34
ld d, h
ld e, l
ld hl, PlayerName
ld bc, NAME_LENGTH
call CopyBytes
.asm_13b34
pop bc
inc c
dec b
jr nz, .asm_13b1b
ld hl, PartyMon1Moves
ld a, [PartyCount]
ld b, a
.asm_13b40
push hl
ld c, NUM_MOVES
ld a, [hl]
and a
jr z, .asm_13b4b
cp NUM_ATTACKS + 1
jr c, .asm_13b4d
.asm_13b4b
ld [hl], POUND
.asm_13b4d
ld a, [hl]
and a
jr z, .asm_13b55
cp NUM_ATTACKS + 1
jr c, .asm_13b5c
.asm_13b55
xor a
ld [hli], a
dec c
jr nz, .asm_13b55
jr .asm_13b60
.asm_13b5c
inc hl
dec c
jr nz, .asm_13b4d
.asm_13b60
pop hl
push bc
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop bc
dec b
jr nz, .asm_13b40
ret
; 13b6b
.TAMAGO: ; 13b6b
db "タマゴ@@@"
; 13b71
Function13b71: ; 13b71
push de
ld c, 1
ld b, 6
.loop
ld a, [de]
cp "@"
jr z, .done
inc de
inc c
dec b
jr nz, .loop
dec c
dec de
ld a, "@"
ld [de], a
.done
pop de
ret
; 13b87

View File

@ -1507,6 +1507,7 @@ CurInput::
EngineBuffer1:: ; d03e
ds 1
wd03f::
wJumpStdScriptBuffer::
CurFruit:: ; d03f
MartPointerBank::
EngineBuffer2::
@ -2593,7 +2594,9 @@ BackupMapNumber:: ; dcae
ds 3
wLastSpawnMapGroup::
wdcb2:: ds 1
wLastSpawnMapNumber::
wdcb3:: ds 1
WarpNumber:: ; dcb4
@ -2691,7 +2694,8 @@ wEggNick:: ds PKMN_NAME_LENGTH ; df65
wEggOT:: ds NAME_LENGTH ; df70
wEggMon:: box_struct wEggMon ; df7b
wdf9b:: ds 1
wdf9b::
wBugContestSecondPartySpecies:: ds 1
wdf9c::