diff options
Diffstat (limited to 'main.asm')
-rw-r--r-- | main.asm | 478 |
1 files changed, 256 insertions, 222 deletions
@@ -132,7 +132,7 @@ NewGame: ; 5b6b ld [wc2cc], a call ResetWRAM call Function5b44 - call Function5b8f + call AreYouABoyOrAreYouAGirl call OakSpeech call InitializeWorld ld a, 1 @@ -146,10 +146,10 @@ NewGame: ; 5b6b jp FinishContinueFunction ; 5b8f -Function5b8f: ; 5b8f - callba Function10632f +AreYouABoyOrAreYouAGirl: ; 5b8f + callba Function10632f ; some mobile stuff jr c, .ok - callba Function48dcb + callba AreYouABoyOrAreYouAGirl_Menu ret .ok @@ -415,7 +415,7 @@ Continue: ; 5d65 callba TryLoadSaveFile jr c, .FailToLoad callba Function150b9 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function5e85 ld a, $1 ld [hBGMapMode], a @@ -1579,7 +1579,7 @@ Function64db: ; 64db ; 6508 LearnMove: ; 6508 - call Function309d + call LoadTileMapToTempTileMap ld a, [CurPartyMon] ld hl, PartyMonNicknames call GetNick @@ -1741,7 +1741,7 @@ ForgetMove: ; 65d3 ld [wcfa7], a call Function1bc9 push af - call Function30b4 + call Call_LoadTempTileMapToTileMap pop af pop hl bit 1, a @@ -3183,7 +3183,7 @@ Function8000: ; 8000 ld a, $7 call ByteFill call Function3200 - call Function32f9 + call SetPalettes ret ; 8029 @@ -5192,7 +5192,7 @@ FlyFunction: ; ca3b .outdoors xor a ld [$ffde], a - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearSprites callba _FlyMap ld a, e @@ -7926,6 +7926,7 @@ Functiond839: ; d839 TryAddMonToParty: ; d88c +; Check if to copy wild Pkmn or generate new Pkmn ; Whose is it? ld de, PartyCount ld a, [MonType] @@ -8193,12 +8194,15 @@ endr ld [de], a inc de ld hl, EnemyMonStatus + ; Copy EnemyMonStatus ld a, [hli] ld [de], a inc de + ; Copy EnemyMonUnused ld a, [hli] ld [de], a inc de + ; Copy EnemyMonHP ld a, [hli] ld [de], a inc de @@ -8211,17 +8215,18 @@ endr dec a jr nz, .generatestats ld hl, EnemyMonMaxHP - ld bc, 12 + ld bc, 2*6 ; MaxHP + 5 Stats call CopyBytes pop hl jr .next3 .generatestats pop hl - ld bc, $000a + ld bc, 2*5 ; 5 Stats add hl, bc - ld b, $0 - call Functione167 + ld b, $0 ; if b = 1, then the Stats of the Pkmn are calculated + ; only the current HP aren't set to MaxHP after this + call CalcPkmnStats .next3 ld a, [MonType] @@ -8243,6 +8248,7 @@ endr ret ; da6d + FillPP: ; da6d push bc ld b, NUM_MOVES @@ -8280,6 +8286,7 @@ Functionda96: ; da96 cp PARTY_LENGTH scf ret z + inc a ld [hl], a ld c, a @@ -8353,30 +8360,37 @@ Functionda96: ; da96 and a ret -; db3f -Functiondb3f: ; db3f + +SentGetPkmnIntoFromBox: ; db3f +; Sents/Gets Pkmn into/from Box depending on Parameter +; wd10b == 0: get Pkmn into Party +; wd10b == 1: sent Pkmn into Box + ld a, BANK(sBoxCount) call GetSRAMBank ld a, [wd10b] and a - jr z, .asm_db60 + jr z, .check_IfPartyIsFull cp $2 - jr z, .asm_db60 + jr z, .check_IfPartyIsFull cp $3 ld hl, wBreedMon1Species jr z, .asm_db9b + + ; we want to sent a Pkmn into the Box + ; so check if there's enough space ld hl, sBoxCount ld a, [hl] cp MONS_PER_BOX jr nz, .asm_db69 - jp Functiondcb1 + jp CloseSRAM_And_SetCFlag -.asm_db60 +.check_IfPartyIsFull ld hl, PartyCount ld a, [hl] cp PARTY_LENGTH - jp z, Functiondcb1 + jp z, CloseSRAM_And_SetCFlag .asm_db69 inc a @@ -8404,7 +8418,7 @@ Functiondb3f: ; db3f ld a, [sBoxCount] .asm_db97 - dec a + dec a ; PartyCount - 1 call AddNTimes .asm_db9b @@ -8507,7 +8521,7 @@ Functiondb3f: ; db3f srl a add $2 ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon callab Function50e1b ld a, d ld [CurPartyLevel], a @@ -8525,7 +8539,7 @@ Functiondb3f: ; db3f add hl, bc push bc ld b, $1 - call Functione167 + call CalcPkmnStats pop bc ld a, [wd10b] and a @@ -8570,7 +8584,7 @@ endr ret ; dcb1 -Functiondcb1: ; dcb1 +CloseSRAM_And_SetCFlag: ; dcb1 call CloseSRAM scf ret @@ -8578,7 +8592,6 @@ Functiondcb1: ; dcb1 Functiondcb6: ; dcb6 - ld a, b ld hl, sBoxMons ld bc, sBoxMon1End - sBoxMon1 @@ -8742,7 +8755,7 @@ Functiondd64: ; dd64 add hl, bc push bc ld b, $1 - call Functione167 + call CalcPkmnStats ld hl, PartyMon1Moves ld a, [PartyCount] dec a @@ -8886,8 +8899,9 @@ SentPkmnIntoBox: ; de6e ld [de], a inc de + ; Set all 5 Experience Values to 0 xor a - ld b, $a + ld b, 2*5 .asm_dee5 ld [de], a inc de @@ -8930,10 +8944,12 @@ SentPkmnIntoBox: ; de6e ld de, TempMonMoves ld bc, NUM_MOVES call CopyBytes + ld hl, sBoxMon1PP ld de, TempMonPP ld bc, NUM_MOVES call CopyBytes + ld b, 0 call Functiondcb6 @@ -8942,6 +8958,7 @@ SentPkmnIntoBox: ; de6e ret ; df42 + Functiondf42: ; df42 call CloseSRAM and a @@ -9056,7 +9073,7 @@ GiveEgg:: ; df8c dec a ld hl, PartyMonNicknames call SkipNames - ld de, Stringe035 + ld de, String_Egg call CopyName2 ld a, [PartyCount] dec a @@ -9083,12 +9100,11 @@ GiveEgg:: ; df8c ret ; e035 -Stringe035: ; e035 +String_Egg: ; e035 db "EGG@" ; e039 Functione039: ; e039 - ld hl, PartyCount ld a, [wd10b] @@ -9256,7 +9272,7 @@ Functione134: ; e134 ld a, PartyMon1Exp + 2 - PartyMon1 call GetPartyParamLocation ld b, $1 - call Functione167 + call CalcPkmnStats pop de ld a, PartyMon1HP - PartyMon1 call GetPartyParamLocation @@ -9268,7 +9284,12 @@ Functione134: ; e134 ret ; e167 -Functione167: ; e167 +CalcPkmnStats: ; e167 +; Calculates all 6 Stats of a Pkmn +; b = 0 or 1 +; 'c' counts from 1-6 and points with 'BaseStats' to the base value +; results in $ffb5 and $ffb6 are saved in [de] + ld c, $0 .asm_e169 inc c @@ -9286,14 +9307,16 @@ Functione167: ; e167 ; e17b Functione17b: ; e17b +; 'c' is 1-6 and points to the BaseStat + push hl push de push bc ld a, b ld d, a push hl - ld hl, BaseHP - dec hl + ld hl, BaseStats + dec hl ; has to be decreased, because 'c' begins with 1 ld b, $0 add hl, bc ld a, [hl] @@ -9663,6 +9686,7 @@ Functione3d4: ; e3d4 ret ; e3d9 + TextJump_WasSentToBillsPC: ; 0xe3d9 ; was sent to BILL's PC. text_jump Text_WasSentToBillsPC @@ -9671,7 +9695,7 @@ TextJump_WasSentToBillsPC: ; 0xe3d9 Functione3de: ; e3de push de - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function2ed3 pop de push de @@ -9712,7 +9736,7 @@ UnknownText_0xe417: ; 0xe417 Functione41c: ; e41c (3:641c) xor a ld [hBGMapMode], a ; $ff00+$d4 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearPCItemScreen ld hl, Options ld a, [hl] @@ -9742,7 +9766,7 @@ Functione443: ; e443 (3:6443) ld a, $1 .asm_e44b ld [wcf88], a - call Function32f9 + call SetPalettes xor a ld [wcf76], a ld [hBGMapMode], a ; $ff00+$d4 @@ -9808,7 +9832,7 @@ Functione4cb: ; e4cb ; e4cd Functione4cd: ; e4cd - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function44781 jr nc, .asm_e4e0 ld hl, UnknownText_0xe4f9 @@ -9835,7 +9859,7 @@ UnknownText_0xe4f9: ; 0xe4f9 ; 0xe4fe Functione4fe: ; e4fe (3:64fe) - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Functione2391 call Function222a call ClearPCItemScreen @@ -9911,7 +9935,7 @@ Functione538: ; e538 Functione559: ; e559 (3:6559) - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Functione2583 call Function222a call ClearPCItemScreen @@ -9962,7 +9986,7 @@ ClearPCItemScreen: ; e58b ld bc, $0412 call TextBox call Function3200 - call Function32f9 ; load regular palettes? + call SetPalettes ; load regular palettes? ret ; 0xe5bb @@ -10470,7 +10494,7 @@ Function116f8: ; 116f8 call Function1171d call WaitBGMap call WaitTop - call Function32f9 + call SetPalettes call Function11be0 ret ; 1171d @@ -12245,7 +12269,7 @@ Function124fa: ; 124fa Function1250a: ; 1250a ld b, $0 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; 12513 @@ -12556,7 +12580,7 @@ endr .Clear ; 126b7 call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Function2bae call .DrawMenuAccount_ call MenuFunc_1e7f @@ -12955,7 +12979,7 @@ StartMenu_Pokemon: ; 12976 callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 ; load regular palettes? + call SetPalettes ; load regular palettes? call DelayFrame callba PartyMenuSelect jr c, .return ; if cancelled or pressed B @@ -13177,7 +13201,7 @@ SwitchPartyMons: ; 12aec call AddNTimes ld [hl], "▷" call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect @@ -13226,7 +13250,7 @@ GiveTakePartyMonItem: ; 12b60 cp 1 jr nz, .asm_12ba0 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearPalettes call Function12ba9 call ClearPalettes @@ -13626,7 +13650,7 @@ UnknownText_0x12dfb: ; 0x12dfb OpenPartyStats: ; 12e00 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearSprites ; PartyMon xor a @@ -13634,7 +13658,7 @@ OpenPartyStats: ; 12e00 call LowVolume predef StatsScreenInit call MaxVolume - call Function1d7d + call Call_ExitMenu ld a, 0 ret ; 12e1b @@ -13805,19 +13829,19 @@ Function12f05: ; 12f05 ld a, PartyMon1MaxHP - PartyMon1 call GetPartyParamLocation ld a, [hli] - ld [hProduct], a + ld [hDividend + 0], a ld a, [hl] - ld [hMultiplicand], a + ld [hDividend + 1], a ld a, $5 - ld [hMultiplier], a + ld [hDivisor], a ld b, $2 call Divide ld a, PartyMon1HP + 1 - PartyMon1 call GetPartyParamLocation - ld a, [$ffb6] + ld a, [hQuotient + 2] sub [hl] dec hl - ld a, [$ffb5] + ld a, [hQuotient + 1] sbc [hl] ret ; 12f26 @@ -14188,7 +14212,7 @@ Function13172: ; 13172 hlcoord 5, 1 call PlaceString push bc - callba Function5084a + callba CopyPkmnToTempMon pop hl call PrintLevel ld hl, PlayerHPPal @@ -14205,7 +14229,7 @@ Function131ef: ; 131ef ld [hBGMapMode], a ld [wd0e3], a ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon ld hl, TempMonMoves ld de, wd25e ld bc, NUM_MOVES @@ -14217,7 +14241,7 @@ Function131ef: ; 131ef hlcoord 10, 4 predef Function50c50 call WaitBGMap - call Function32f9 + call SetPalettes ld a, [wd0eb] inc a ld [wcfa3], a @@ -14686,7 +14710,7 @@ Function134c0: ; 134c0 ; 134dd Function134dd: ; 134dd - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, Elevator_WhichFloorText call PrintText call Elevator_GetCurrentFloorText @@ -15743,7 +15767,7 @@ Function13a47: ; 13a47 ld hl, PartyMon1Exp + 2 - PartyMon1 add hl, bc ld b, $1 - predef Functione167 + predef CalcPkmnStats pop hl ld bc, PartyMon2 - PartyMon1 add hl, bc @@ -18066,7 +18090,7 @@ UnknownText_0x157cc: ; 0x157cc ; 0x157d1 KrisWithdrawItemMenu: ; 0x157d1 - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba ClearPCItemScreen .asm_157da call Function15985 @@ -18145,7 +18169,7 @@ Function157e9: ; 0x157e9 KrisTossItemMenu: ; 0x1585f - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba ClearPCItemScreen .asm_15868 call Function15985 @@ -18182,7 +18206,7 @@ KrisDepositItemMenu: ; 0x1588b call Function158b8 jr c, .asm_158b6 call Function2ed3 - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function106a5 .asm_1589c callba Function106be @@ -18486,7 +18510,7 @@ MartDialog: ; 15a61 HerbShop: ; 15a6e call ReadMart - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15e4a call Function15fcd call Function15c62 @@ -18500,7 +18524,7 @@ BargainShop: ; 15a84 ld de, BargainShopData call LoadMartPointer call Function15c25 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15e6d call Function15fcd call Function15c62 @@ -18519,7 +18543,7 @@ BargainShop: ; 15a84 Pharmacist: ; 15aae call ReadMart - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15e90 call Function15fcd call Function15c62 @@ -18540,7 +18564,7 @@ RooftopSale: ; 15ac4 .ok call LoadMartPointer call Function15c25 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15f83 call Function15fcd call Function15c62 @@ -18625,7 +18649,7 @@ Function15b47: ; 15b47 ; 15b62 Function15b62: ; 15b62 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15f83 call PrintText ld a, $1 @@ -18678,7 +18702,7 @@ Function15ba3: ; 15ba3 ; 15baf Function15baf: ; 15baf - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15fb9 call PrintText ld a, $1 @@ -20196,7 +20220,7 @@ Function169ac: ; 169ac pop hl push bc ld b, $0 - predef Functione167 + predef CalcPkmnStats pop bc ld hl, PartyMon1HP - PartyMon1 add hl, bc @@ -20486,7 +20510,7 @@ Function16be4: ; 16be4 ld b, $1c call GetSGBLayout - call Function32f9 + call SetPalettes .asm_16c6b call Functiona57 @@ -20913,7 +20937,7 @@ Function16f3e:: ; 16f3e OverworldHatchEgg:: ; 16f5e call ResetWindow - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function16f70 call Function2b4d call RestartMapMusic @@ -21000,7 +21024,7 @@ Function16f7a: ; 16f7a (5:6f7a) ld bc, PartyMon1Exp + 2 - PartyMon1 add hl, bc ld b, $0 - predef Functione167 + predef CalcPkmnStats pop bc ld hl, PartyMon1MaxHP - PartyMon1 add hl, bc @@ -21394,7 +21418,7 @@ Function17254: ; 17254 (5:7254) predef FillBox pop af call Function17363 - call Function32f9 + call SetPalettes jp WaitBGMap Function1727f: ; 1727f (5:727f) @@ -21755,7 +21779,7 @@ Function20021: ; 20021 (8:4021) ld a, [hl] push af set 4, [hl] - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearTileMap ld hl, UnknownText_0x2004c call PrintText @@ -24803,7 +24827,7 @@ Function2513b: ; 2513b (9:513b) call WaitBGMap ld b, $15 call GetSGBLayout - call Function32f9 + call SetPalettes call WaitBGMap ld hl, wcf63 xor a @@ -25986,7 +26010,7 @@ Function2695b: ; 2695b ld d, 0 add hl, de ld [hl], -1 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, MenuDataHeader_0x269c5 call CopyMenuDataHeader xor a @@ -27083,9 +27107,9 @@ Function2715c: ; 2715c callba Function3ed9f call ClearSGB call WriteBackup - call Function1d6e + call LoadMenuDataHeader_0x1d75 call WaitBGMap - jp Function32f9 + jp SetPalettes ; 27192 Function27192: ; 27192 @@ -28545,7 +28569,7 @@ Function2891c: ; 2891c ; 28926 Function28926: ; 28926 - call Function309d + call LoadTileMapToTempTileMap ld a, [wcfa9] push af hlcoord 0, 15 @@ -28586,7 +28610,7 @@ Function28926: ; 28926 .asm_28983 pop af ld [wcfa9], a - call Function30b4 + call Call_LoadTempTileMapToTileMap jp Function2888b .asm_2898d @@ -28624,7 +28648,7 @@ Function28926: ; 28926 ld [wd263], a callab Function50db9 callba Function4d319 - call Function30b4 + call Call_LoadTempTileMapToTileMap hlcoord 6, 1 ld bc, $0601 ld a, $7f @@ -28864,7 +28888,7 @@ Function28b87: ; 28b87 ld hl, UnknownText_0x28eb8 bccoord 1, 14 call PlaceWholeStringInBoxAtOnce - call Function1d6e + call LoadMenuDataHeader_0x1d75 hlcoord 10, 7 ld b, $3 ld c, $7 @@ -28893,7 +28917,7 @@ Function28b87: ; 28b87 callba Function4d354 call Function1bd3 push af - call Function1d7d + call Call_ExitMenu call Function3200 pop af bit 1, a @@ -29206,7 +29230,7 @@ Function28ef8: ; 28ef8 Function28eff: ; 28eff callba Function16d6a7 - call Function32f9 + call SetPalettes ret ; 28f09 @@ -31696,7 +31720,7 @@ endr CheckRepelEffect:: ; 2a1df ; If there is no active Repel, there's no need to be here. - ld a, [wdca1] + ld a, [RepelStepsLeft] and a jr z, .encounter ; Get the first Pokemon in your party that isn't fainted. @@ -32465,13 +32489,13 @@ Function2b9a6: ; 2b9a6 jr z, .asm_2b9d7 dec hl xor a - ld [hProduct], a + ld [hDividend + 0], a ld a, [hli] - ld [hMultiplicand], a + ld [hDividend + 1], a ld a, [hli] - ld [$ffb5], a + ld [hDividend + 2], a xor a - ld [$ffb6], a + ld [hDividend + 3], a ld a, [hli] ld b, a ld a, [hld] @@ -32479,13 +32503,13 @@ Function2b9a6: ; 2b9a6 rr a srl b rr a - ld [hMultiplier], a + ld [hDivisor], a ld b, $4 call Divide - ld a, [$ffb6] + ld a, [hQuotient + 2] add e ld e, a - ld a, [$ffb5] + ld a, [hQuotient + 1] adc d ld d, a dec hl @@ -32822,7 +32846,7 @@ Function2c1b2: ; 2c1b2 callba Function2c10d ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, $e4 ld [rOBP0], a ret @@ -33423,7 +33447,7 @@ Function2c80a: ; 2c80a callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect push af @@ -34987,7 +35011,7 @@ endr push hl xor a ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon pop hl .asm_42230 @@ -35197,7 +35221,7 @@ endr ld hl, TempMonExp + 2 ld de, TempMonMaxHP ld b, $1 - predef Functione167 + predef CalcPkmnStats ld a, [CurPartyMon] ld hl, PartyMons @@ -35631,7 +35655,7 @@ AIChooseMove: ; 440ce ret nz ; No use picking a move if there's no choice. - callba Function3e8d1 + callba CheckSubstatus_RechargeChargedRampageBideRollout ret nz @@ -36441,7 +36465,7 @@ Function44781: ; 44781 _KrisMailBoxMenu: ; 0x447a0 call InitMail jr z, .nomail - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function44806 jp WriteBackup @@ -36635,7 +36659,7 @@ Function4484a: ; 0x4484a callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect jr c, .asm_44939 @@ -36854,7 +36878,7 @@ Function4802f: ; 4802f (12:402f) call PlaceString call Function48187 call Function3200 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -38540,11 +38564,11 @@ Function48d4a: ; 48d4a (12:4d4a) Function48d94: ; 48d94 (12:4d94) xor a ld [hDividend + 0], a - ld [hQuotient], a ; $ff00+$b4 (aliases: hMultiplicand) + ld [hDividend + 1], a ; $ff00+$b4 (aliases: hMultiplicand) ld a, [hli] ld [hDividend + 0], a ld a, [hl] - ld [hQuotient], a ; $ff00+$b4 (aliases: hMultiplicand) + ld [hDividend + 1], a ; $ff00+$b4 (aliases: hMultiplicand) ld a, 100 ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier) ld b, 2 @@ -38569,15 +38593,15 @@ Function48d94: ; 48d94 (12:4d94) ld [hl], a ret -Function48dcb: ; 48dcb (12:4dcb) +AreYouABoyOrAreYouAGirl_Menu: ; 48dcb (12:4dcb) call Function48e14 call Function48e47 call Function48e64 call Function3200 - call Function32f9 - ld hl, UnknownText_0x48e0f + call SetPalettes + ld hl, TextJump_AreYouABoyOrAreYouAGirl call PrintText - ld hl, MenuDataHeader_0x48dfc + ld hl, MenuDataHeader_BoyGirl call LoadMenuDataHeader call Function3200 call InterpretMenu2 @@ -38590,24 +38614,24 @@ Function48dcb: ; 48dcb (12:4dcb) ret ; 48dfc (12:4dfc) -MenuDataHeader_0x48dfc: ; 0x48dfc +MenuDataHeader_BoyGirl: ; 0x48dfc db $40 ; flags db 04, 06 ; start coords db 09, 12 ; end coords - dw MenuData2_0x48e04 + dw MenuData2_BoyGirl db 1 ; default option ; 0x48e04 -MenuData2_0x48e04: ; 0x48e04 +MenuData2_BoyGirl: ; 0x48e04 db $a1 ; flags db 2 ; items db "Boy@" db "Girl@" ; 0x48e0f -UnknownText_0x48e0f: ; 0x48e0f +TextJump_AreYouABoyOrAreYouAGirl: ; 0x48e0f ; Are you a boy? Or are you a girl? - text_jump UnknownText_0x1c0ca3 + text_jump Text_AreYouABoyOrAreYouAGirl db "@" ; 0x48e14 @@ -39788,7 +39812,7 @@ MainMenu: ; 49cdc call Function49ed0 ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ld hl, GameTimerPause res 0, [hl] call Function49da4 @@ -40169,7 +40193,7 @@ Function49f16: ; 49f16 hlcoord 1, 14 call PlaceString call Function3200 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -40314,9 +40338,9 @@ Function4a098: ; 4a098 (12:6098) call Function1ff8 call Function1bee call WaitBGMap - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function89de0 - call Function1d7d + call Call_ExitMenu call Function49351 call Function4a485 pop bc @@ -40425,7 +40449,7 @@ Function4a149: ; 4a149 (12:6149) hlcoord 1, 14 call PlaceString callba Function104148 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -40533,7 +40557,7 @@ Function4a28a: ; 4a28a (12:628a) call Function4a6d8 call Function1bee call WaitBGMap - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld a, $5 call GetSRAMBank ld a, [$aa4b] @@ -40563,7 +40587,7 @@ Function4a28a: ; 4a28a (12:628a) .asm_4a2df callba Function11765d call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Functione5f scf ret @@ -40597,7 +40621,7 @@ Function4a28a: ; 4a28a (12:628a) .asm_4a338 call ExitMenu .asm_4a33b - call Function1d7d + call Call_ExitMenu callba Function104148 xor a ret @@ -40674,7 +40698,7 @@ Function4a39a: ; 4a39a call Function4a485 call Function4a492 call Function4a3aa - call Function32f9 + call SetPalettes ret ; 4a3a7 @@ -40854,7 +40878,7 @@ Function4a4c4: ; 4a4c4 (12:64c4) hlcoord 1, 16 call PlaceString call Function3200 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -41498,7 +41522,7 @@ Function4a94e: ; 4a94e ld [wd019], a ld b, $14 call GetSGBLayout - call Function32f9 + call SetPalettes call Function4aa22 jr c, .asm_4a985 jr z, .asm_4a9a1 @@ -41629,7 +41653,7 @@ Function4aa34: ; 4aa34 callba PrintPartyMenuText call Function4aab6 call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame call Function4ab1a jr z, .asm_4aa66 @@ -44267,7 +44291,7 @@ Function4ddf2: ; 4ddf2 (13:5df2) call CopyBytes jr .asm_4de2a .asm_4de10 - callba Function5084a + callba CopyPkmnToTempMon ld a, [CurPartySpecies] cp EGG jr z, .asm_4de2a @@ -44521,7 +44545,7 @@ Function4dfb6: ; 4dfb6 (13:5fb6) ld hl, wcf64 bit 4, [hl] jr nz, .asm_4dfd6 - call Function32f9 + call SetPalettes ret .asm_4dfd6 call Function4e226 @@ -44834,14 +44858,14 @@ Function4e226: ; 4e226 (13:6226) jr .asm_4e246 .asm_4e238 call Function4e271 - call Function32f9 + call SetPalettes ret .asm_4e23f call Function4e253 - call Function32f9 + call SetPalettes ret .asm_4e246 - call Function32f9 + call SetPalettes call Function4e253 ld a, [CurPartySpecies] call PlayCry2 @@ -45025,7 +45049,7 @@ EggStatsScreen: ; 4e33a call PlaceString ld hl, wcf64 set 5, [hl] - call Function32f9 ; pals + call SetPalettes ; pals call DelayFrame hlcoord 0, 0 call Function3786 @@ -45668,7 +45692,7 @@ Function4e881: ; 4e881 ld hl, UnknownText_0x4e8bd call PrintText call Function3200 - call Function32f9 + call SetPalettes ret ; 4e8bd @@ -45708,7 +45732,7 @@ Function4e8c2: ; 4e8c2 ld [hSCX], a call EnableLCD call Function3200 - call Function32f9 + call SetPalettes ret ; 4e906 @@ -46026,7 +46050,7 @@ SelectMonFromParty: ; 50000 call WhiteBGMap call Function5003f call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame call PartyMenuSelect call Function2b74 @@ -46043,7 +46067,7 @@ Function5001d: ; 5001d call WaitBGMap ld b, $a call GetSGBLayout - call Function32f9 + call SetPalettes call DelayFrame call PartyMenuSelect call Function2b74 @@ -47099,7 +47123,7 @@ Function5067b: ; 5067b ld a, [PartyCount] cp [hl] jr nz, .asm_50682 - predef Function3d873 + predef CheckPlayerPartyForFitPkmn ld a, d ld [ScriptVar], a ret @@ -47397,10 +47421,13 @@ UnknownText_0x50845: ; 0x50845 db "@" ; 0x5084a -Function5084a: ; 5084a +CopyPkmnToTempMon: ; 5084a +; gets the BaseData of a Pkmn +; and copys the PkmnStructure to TempMon + ld a, [CurPartyMon] ld e, a - call Function508d5 + call GetPkmnSpecies ld a, [CurPartySpecies] ld [CurSpecies], a call GetBaseData @@ -47421,7 +47448,7 @@ Function5084a: ; 5084a .copywholestruct ld a, [CurPartyMon] call AddNTimes - ld de, TempMonSpecies + ld de, TempMon ld bc, PartyMon2 - PartyMon1 call CopyBytes @@ -47453,7 +47480,7 @@ Function50893: ; 50893 add hl, bc push bc ld b, $1 - predef Functione167 + predef CalcPkmnStats pop bc ld hl, TempMonHP - TempMon add hl, bc @@ -47485,7 +47512,10 @@ Function50893: ; 50893 ret ; 508d5 -Function508d5: ; 508d5 +GetPkmnSpecies: ; 508d5 +; [MonType] has the type of the Pkmn +; e = Nr. of Pkmn (i.e. [CurPartyMon]) + ld a, [MonType] and a ; PARTYMON jr z, .partymon @@ -47988,7 +48018,7 @@ Function50cdb: ; 50cdb call GetNick pop hl call PlaceString - call Function5084a + call CopyPkmnToTempMon pop hl ld a, [CurPartySpecies] cp EGG @@ -48209,15 +48239,15 @@ Function50e1b: ; 50e1b call Function50e47 push hl ld hl, TempMonExp + 2 - ld a, [$ffb6] + ld a, [hMultiplicand + 2] ld c, a ld a, [hld] sub c - ld a, [$ffb5] + ld a, [hMultiplicand + 1] ld c, a ld a, [hld] sbc c - ld a, [hMultiplicand] + ld a, [hMultiplicand + 0] ld c, a ld a, [hl] sbc c @@ -48254,15 +48284,15 @@ endr ld a, [hli] and $f - ld [hMultiplier], a + ld [hDivisor], a ld b, $4 call Divide - ld a, [hMultiplicand + 0] + ld a, [hQuotient + 0] push af - ld a, [hMultiplicand + 1] + ld a, [hQuotient + 1] push af - ld a, [hMultiplicand + 2] + ld a, [hQuotient + 2] push af call Function50eed @@ -48463,12 +48493,12 @@ Function50f62: ; 50f62 (14:4f62) ld bc, $30 call CopyBytes ld a, [Buffer2] ; wd1eb (aliases: MovementType) - ld hl, PartyMonOT ; wddff (aliases: PartyMonOT) + ld hl, PartyMonOT call SkipNames push hl call Function51036 ld a, [wd1ec] - ld hl, PartyMonOT ; wddff (aliases: PartyMonOT) + ld hl, PartyMonOT call SkipNames pop de push hl @@ -52643,11 +52673,11 @@ Function84560: ; 84560 ld [hl], $4 xor a ld [hBGMapMode], a - call Function309d + call LoadTileMapToTempTileMap callba Function16dac ld a, $0 call Function84419 - call Function30b4 + call Call_LoadTempTileMapToTileMap call Function84742 ld a, $9 ld [wcf65], a @@ -52675,7 +52705,7 @@ Function84560: ; 84560 pop af ld [hVBlank], a call Function84411 - call Function30b4 + call Call_LoadTempTileMapToTileMap xor a ld [rIF], a pop af @@ -52808,13 +52838,13 @@ Function84688: ; 84688 call Function84411 ld c, $c call DelayFrames - call Function309d + call LoadTileMapToTempTileMap xor a ld [hBGMapMode], a callba Function1dd7ae ld a, $3 call Function84419 - call Function30b4 + call Call_LoadTempTileMapToTileMap call Function84742 ld a, $9 ld [wcf65], a @@ -53585,7 +53615,7 @@ endr ld [hBGMapMode], a ld b, $1a call GetSGBLayout - call Function32f9 + call SetPalettes call Function86635 xor a ld [wc2c6], a @@ -53723,7 +53753,7 @@ Function86692: ; 86692 call WaitBGMap ld b, $1a call GetSGBLayout - call Function32f9 + call SetPalettes decoord 6, 5 ld c, $6 predef Functiond066e @@ -53884,7 +53914,7 @@ Function86810: ; 86810 ld [CurPartySpecies], a ld b, $1a call GetSGBLayout - call Function32f9 + call SetPalettes call Function86635 xor a ld [wc2c6], a @@ -53975,7 +54005,7 @@ UnknownText_0x88013: ; 0x88013 ; 0x88018 Function88018: ; 88018 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld c, $1 xor a ld [wd0e4], a @@ -54004,7 +54034,7 @@ Function88018: ; 88018 call Function88161 .asm_88051 - call Function1d7d + call Call_ExitMenu ret ; 88055 @@ -55302,7 +55332,7 @@ Function894ca: ; 894ca (22:54ca) call Function895c7 call Function8949c call Function8a60d - call Function32f9 + call SetPalettes pop bc ret @@ -55954,7 +55984,7 @@ Function89844: ; 89844 call Function897af push bc call Function3200 - call Function32f9 + call SetPalettes pop bc ret ; 89856 @@ -56463,9 +56493,9 @@ Function89b28: ; 89b28 (22:5b28) call Function891de call WhiteBGMap call Function893e2 - call Function1d7d + call Call_ExitMenu call Function891ab - call Function32f9 + call SetPalettes ret Function89b3b: ; 89b3b (22:5b3b) @@ -56814,7 +56844,7 @@ Function89d0d: ; 89d0d (22:5d0d) call CopyBytes pop af ld [rSVBK], a ; $ff00+$70 - call Function32f9 + call SetPalettes callba Function845db call Function89240 ld c, $18 @@ -57020,7 +57050,7 @@ Function89e6f: ; 89e6f (22:5e6f) hlcoord 10, 4, AttrMap call Function8a5a3 call Function891ab - call Function32f9 + call SetPalettes jp Function89e36 Function89e9a: ; 89e9a (22:5e9a) @@ -57057,7 +57087,7 @@ Function89eb9: ; 89eb9 (22:5eb9) hlcoord 10, 4, AttrMap call Function8a5a3 call Function891ab - call Function32f9 + call SetPalettes jp Function89e36 Function89ee1: ; 89ee1 (22:5ee1) @@ -57238,7 +57268,7 @@ Function89fce: ; 89fce (22:5fce) hlcoord 10, 4, AttrMap call Function8a5a3 call Function89448 - call Function32f9 + call SetPalettes call Function891ab jp Function89e36 @@ -57574,7 +57604,7 @@ UnknownText_0x8a23c: ; 0x8a23c ; 0x8a241 Function8a241: ; 8a241 (22:6241) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function891fe call Function8a262 jr nc, .asm_8a254 @@ -57585,7 +57615,7 @@ Function8a241: ; 8a241 (22:6241) .asm_8a254 call Function891de call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Function891de and a ret @@ -57612,7 +57642,7 @@ Function8a262: ; 8a262 (22:6262) call Function8b36c call Function8b493 call Function891ab - call Function32f9 + call SetPalettes call Function8b5e7 ret @@ -57710,7 +57740,7 @@ Function8a31c: ; 8a31c (22:631c) call Function8a4d3 call Function8a4fc call Function891ab - call Function32f9 + call SetPalettes call Function8a383 jr c, .asm_8a370 jr z, .asm_8a34e @@ -58102,7 +58132,7 @@ Palette_8a624: ; 8a624 ; 8a62c Function8a62c: ; 8a62c (22:662c) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function891fe xor a call Function8b94a @@ -58532,7 +58562,7 @@ Function8a999: ; 8a999 (22:6999) jr c, .asm_8a9bb push bc push de - call Function1d6e + call LoadMenuDataHeader_0x1d75 pop de dec e ld a, e @@ -58788,7 +58818,7 @@ Function8ab77: ; 8ab77 (22:6b77) Function8ab93: ; 8ab93 (22:6b93) call WhiteBGMap - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function105688 call ClearSprites call Function891fe @@ -60649,7 +60679,7 @@ Function8b677: ; 8b677 call Function8b6ed call EnableLCD call Function891ab - call Function32f9 + call SetPalettes ret ; 8b690 @@ -68100,7 +68130,7 @@ Special_SetDayOfWeek: ; 90913 hlcoord 0, 12 ld bc, $0412 call TextBox - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x90a3f call PrintText hlcoord 9, 3 @@ -68196,7 +68226,7 @@ Function909de: ; 909de ld a, [wd002] ld e, a ld d, 0 - ld hl, Unknown_909f2 + ld hl, WeekdaysStrings rept 2 add hl, de endr @@ -68208,7 +68238,7 @@ endr ret ; 909f2 -Unknown_909f2: ; 909f2 +WeekdaysStrings: ; 909f2 dw Sunday dw Monday dw Tuesday @@ -68268,13 +68298,13 @@ UnknownText_0x90a6c: ; 90a6c ld c, a decoord 1, 14 callba Function1dd6bb - ld hl, UnknownText_0x90a83 + ld hl, TextJump_DSTIsThatOK ret ; 90a83 (24:4a83) -UnknownText_0x90a83: ; 0x90a83 +TextJump_DSTIsThatOK: ; 0x90a83 ; DST, is that OK? - text_jump UnknownText_0x1c5fde + text_jump Text_DSTIsThatOK db "@" ; 0x90a88 @@ -68526,7 +68556,7 @@ Function90bea: ; 90bea (24:4bea) call Function90da8 ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, [hCGB] and a ret z @@ -69910,7 +69940,7 @@ Function9191c: ; 9191c ld [wd005], a ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, [hCGB] and a jr z, .asm_9198b @@ -70164,7 +70194,7 @@ _FlyMap: ; 91af3 call Function91c8f ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes .loop call Functiona57 ld hl, hJoyPressed @@ -70586,7 +70616,7 @@ Function91d11: ; 91d11 call TownMapBGUpdate ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes xor a ld [hBGMapMode], a xor a @@ -71096,7 +71126,7 @@ Function92311: ; 92311 ld [wd004], a ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes .loop call Functiona57 ld hl, hJoyPressed @@ -74242,7 +74272,7 @@ Functionb9237: ; b9237 ld a, [wd1ec] ld e, a callba Function8cb4 - call Function32f9 + call SetPalettes xor a ld [hJoyPressed], a call Functionb929a @@ -75450,7 +75480,7 @@ DisplayCaughtContestMonStats: ; cc000 call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; cc0a7 @@ -79020,7 +79050,7 @@ BillsPCDepositFuncDeposit: ; e24a9 (38:64a9) ret BillsPCDepositFuncStats: ; e24c8 (38:64c8) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Functione2f7e call ExitMenu call PCMonInfo @@ -79039,7 +79069,7 @@ BillsPCDepositFuncRelease: ; e24e0 (38:64e0) push af ld de, PCString_ReleasePKMN call Functione2a6e - call Function1d6e + call LoadMenuDataHeader_0x1d75 lb bc, 14, 11 call PlaceYesNoBox ld a, [wcfa9] @@ -79285,7 +79315,7 @@ endr ret .stats: ; e26c0 (38:66c0) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Functione2f7e call ExitMenu call PCMonInfo @@ -79302,7 +79332,7 @@ endr jr c, .FailedRelease ld de, PCString_ReleasePKMN call Functione2a6e - call Function1d6e + call LoadMenuDataHeader_0x1d75 lb bc, 14, 11 call PlaceYesNoBox ld a, [wcfa9] @@ -79545,7 +79575,7 @@ Functione2887: ; e2887 ; e28a5 Functione28a5: ; e28a5 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Functione2f7e call ExitMenu call PCMonInfo @@ -80661,7 +80691,7 @@ Functione2fd6: ; e2fd6 (38:6fd6) call Functione3357 ld hl, PartyMonNicknames call Functione3363 - ld hl, PartyMonOT ; wddff (aliases: PartyMonOT) + ld hl, PartyMonOT call Functione3376 ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species) ld bc, $30 @@ -80708,8 +80738,8 @@ Functione307c: ; e307c (38:707c) call GetNick ld a, $1 ld [wd10b], a - predef Functiondb3f - jr c, .asm_e30e4 + predef SentGetPkmnIntoFromBox + jr c, .asm_boxisfull xor a ld [wd10b], a callba Functione039 @@ -80738,7 +80768,8 @@ Functione307c: ; e307c (38:707c) call DelayFrames and a ret -.asm_e30e4 + +.asm_boxisfull ld de, PCString_BoxFull call Functione2a6e ld de, SFX_WRONG @@ -80762,7 +80793,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) call CloseSRAM xor a ld [wd10b], a - predef Functiondb3f + predef SentGetPkmnIntoFromBox jr c, .PartyFull ld a, $1 ld [wd10b], a @@ -80792,6 +80823,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) call DelayFrames and a ret + .PartyFull ld de, PCString_PartyFull call Functione2a6e @@ -80803,6 +80835,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) scf ret + Functione3180: ; e3180 (38:7180) hlcoord 0, 0 ld bc, $f08 @@ -81180,7 +81213,7 @@ PCString_NoReleasingEGGS: db "No releasing EGGS!@" ; e35aa Functione35aa: ; e35aa (38:75aa) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Functione35e2 .asm_e35b0 xor a @@ -81540,7 +81573,7 @@ _OptionsMenu: ; e41d0 call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes .asm_e4217 call Functiona57 ld a, [hJoyPressed] @@ -82107,7 +82140,7 @@ Functione4579: ; e4579 call WaitBGMap ld b, $19 call GetSGBLayout - call Function32f9 + call SetPalettes ld c, 10 call DelayFrames callab Copyright @@ -85224,7 +85257,7 @@ Functionfb8c8: ; fb8c8 ld [TempMonDVs + 1], a ld b, $1c call GetSGBLayout - call Function32f9 + call SetPalettes ret ; fb8f1 @@ -87601,7 +87634,7 @@ DoMysteryGift: ; 1048ba (41:48ba) call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes pop de hlcoord 2, 8 ld a, d @@ -88902,7 +88935,7 @@ Function105153: ; 105153 (41:5153) call WaitBGMap ld b, $1d call GetSGBLayout - call Function32f9 + call SetPalettes ret Function10522e: ; 10522e (41:522e) @@ -89080,7 +89113,7 @@ Function105777: ; 105777 (41:5777) call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ret Function10578c: ; 10578c (41:578c) @@ -89205,7 +89238,7 @@ Function1057d7: ; 1057d7 (41:57d7) call WaitBGMap ld b, $2 callba Function4930f - jp Function32f9 + jp SetPalettes Function1058c6: ; 1058c6 (41:58c6) ld b, $6 @@ -90340,10 +90373,11 @@ endr ld [$ffbb], a ret -Function1062f7 +Function1062f7: ld a, [$ffbc] bit 7, a ret z + ld [hl], $f6 ret ; 1062ff @@ -90978,7 +91012,7 @@ Function1dc381: ; 1dc381 xor a ld [MonType], a - callba Function5084a + callba CopyPkmnToTempMon hlcoord 0, 7 ld b, $9 ld c, $12 @@ -91049,7 +91083,7 @@ Function1dc381: ; 1dc381 call WaitBGMap ld b, $3 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; 1dc47b @@ -91062,7 +91096,7 @@ Function1dc47b: ; 1dc47b call Functione58 xor a ld [MonType], a - callba Function5084a + callba CopyPkmnToTempMon hlcoord 0, 0 ld b, 15 ld c, 18 @@ -91101,7 +91135,7 @@ Function1dc47b: ; 1dc47b call WaitBGMap ld b, $3 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; 1dc507 @@ -91243,18 +91277,18 @@ Function1dd6bb: ; 1dd6bb (77:56bb) lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum pop bc - ld de, String_1dd6fc + ld de, String_AM pop af jr c, .asm_1dd6f7 - ld de, String_1dd6ff + ld de, String_PM .asm_1dd6f7 inc hl call PlaceString ret ; 1dd6fc (77:56fc) -String_1dd6fc: db "AM@" -String_1dd6ff: db "PM@" +String_AM: db "AM@" ; 1dd6fc +String_PM: db "PM@" ; 1dd6ff ; 1dd702 @@ -91432,22 +91466,22 @@ Function1de27f: ; 1de27f -Function1de28a:: ; 1de28a +Start_DudeAutoInput_A:: ; 1de28a ld hl, DudeAutoInput_A - jr Function1de299 + jr CallStartAutoInput ; 1de28f -Function1de28f: ; 1de28f +Start_DudeAutoInput_RightA: ; 1de28f ld hl, DudeAutoInput_RightA - jr Function1de299 + jr CallStartAutoInput ; 1de294 -Function1de294: ; 1de294 +Start_DudeAutoInput_DownA: ; 1de294 ld hl, DudeAutoInput_DownA - jr Function1de299 + jr CallStartAutoInput ; 1de299 -Function1de299: ; 1de299 +CallStartAutoInput: ; 1de299 ld a, BANK(DudeAutoInputs) call StartAutoInput ret |