mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Here's the mail it never fails
This commit is contained in:
parent
e88c88ff20
commit
27ef600ace
@ -32,6 +32,10 @@ HP_RED EQU 2
|
||||
MONS_PER_BOX EQU 20
|
||||
NUM_BOXES EQU 14
|
||||
|
||||
; mail
|
||||
MAIL_STRUCT_LENGTH EQU $2f
|
||||
MAILBOX_CAPACITY EQU 10
|
||||
|
||||
; hall of fame
|
||||
HOF_MON_LENGTH = 1 + 2 + 2 + 1 + (PKMN_NAME_LENGTH +- 1) ; species, id, dvs, level, nick
|
||||
HOF_LENGTH = 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; win count, party, terminator
|
||||
|
@ -291,7 +291,6 @@ MON_SAT EQUS "(PartyMon1SpclAtk - PartyMon1)"
|
||||
MON_SDF EQUS "(PartyMon1SpclDef - PartyMon1)"
|
||||
BOXMON_STRUCT_LENGTH EQUS "(PartyMon1End - PartyMon1)"
|
||||
PARTYMON_STRUCT_LENGTH EQUS "(PartyMon1StatsEnd - PartyMon1)"
|
||||
SCRATCHMON_STRUCT_LENGTH EQUS "(PartyMon1StatsEnd - PartyMon1Item)"
|
||||
|
||||
const_value SET 1
|
||||
const MONMENU_CUT ; 1
|
||||
|
@ -192,7 +192,7 @@ OverworldHatchEgg:: ; 16f5e
|
||||
call ResetWindow
|
||||
call LoadStandardMenuDataHeader
|
||||
call Function16f70
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
call RestartMapMusic
|
||||
jp LoadMoveSprites
|
||||
; 16f70
|
||||
|
@ -834,9 +834,9 @@ Function28595: ; 28595
|
||||
ld de, wc9f4
|
||||
ld a, $20
|
||||
call Function28682
|
||||
ld a, BANK(sPartyScratch1)
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
ld hl, sPartyScratch1
|
||||
ld hl, sPartyMail
|
||||
ld b, PARTY_LENGTH
|
||||
.loop2
|
||||
push bc
|
||||
@ -847,7 +847,7 @@ Function28595: ; 28595
|
||||
pop bc
|
||||
dec b
|
||||
jr nz, .loop2
|
||||
ld hl, sPartyScratch1
|
||||
ld hl, sPartyMail
|
||||
ld b, PARTY_LENGTH
|
||||
.loop3
|
||||
push bc
|
||||
@ -859,7 +859,7 @@ Function28595: ; 28595
|
||||
dec b
|
||||
jr nz, .loop3
|
||||
ld b, PARTY_LENGTH
|
||||
ld de, sPartyScratch1
|
||||
ld de, sPartyMail
|
||||
ld hl, wc9f9
|
||||
.loop4
|
||||
push bc
|
||||
@ -883,7 +883,7 @@ Function28595: ; 28595
|
||||
|
||||
.next
|
||||
pop de
|
||||
ld hl, SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, MAIL_STRUCT_LENGTH
|
||||
add hl, de
|
||||
ld d, h
|
||||
ld e, l
|
||||
@ -1744,15 +1744,15 @@ Function28b87: ; 28b87
|
||||
jp Function28ea3
|
||||
|
||||
.asm_28c7b
|
||||
ld hl, sPartyScratch1
|
||||
ld hl, sPartyMail
|
||||
ld a, [wd002]
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld a, BANK(sPartyScratch1)
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
add hl, bc
|
||||
ld a, [wd002]
|
||||
ld c, a
|
||||
@ -1762,24 +1762,24 @@ Function28b87: ; 28b87
|
||||
cp $6
|
||||
jr z, .asm_28ca6
|
||||
push bc
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
pop bc
|
||||
jr .asm_28c96
|
||||
|
||||
.asm_28ca6
|
||||
ld hl, sPartyScratch1
|
||||
ld hl, sPartyMail
|
||||
ld a, [PartyCount]
|
||||
dec a
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
push hl
|
||||
ld hl, wc9f4
|
||||
ld a, [wd003]
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
pop de
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
call CloseSRAM
|
||||
ld hl, PlayerName
|
||||
|
190
engine/mail.asm
Executable file
190
engine/mail.asm
Executable file
@ -0,0 +1,190 @@
|
||||
SendMailToPC: ; 4456e
|
||||
ld a, MON_ITEM
|
||||
call GetPartyParamLocation
|
||||
ld d, [hl]
|
||||
callba ItemIsMail
|
||||
jr nc, .full
|
||||
call GetMailboxCount
|
||||
cp MAILBOX_CAPACITY
|
||||
jr nc, .full
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
ld hl, sMailbox
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld a, [CurPartyMon]
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
ld hl, sPartyMail
|
||||
call AddNTimes
|
||||
push hl
|
||||
ld a, BANK(sMailboxCount)
|
||||
call GetSRAMBank
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
pop hl
|
||||
xor a
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call ByteFill
|
||||
ld a, MON_ITEM
|
||||
call GetPartyParamLocation
|
||||
ld [hl], $0
|
||||
ld hl, sMailboxCount
|
||||
inc [hl]
|
||||
call CloseSRAM
|
||||
xor a
|
||||
ret
|
||||
|
||||
.full
|
||||
scf
|
||||
ret
|
||||
; 445c0
|
||||
|
||||
Function445c0: ; 445c0 (11:45c0)
|
||||
ld a, BANK(sMailboxCount)
|
||||
call GetSRAMBank
|
||||
ld a, b
|
||||
push bc
|
||||
ld hl, sMailbox
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
push hl
|
||||
add hl, bc
|
||||
pop de
|
||||
pop bc
|
||||
.loop
|
||||
ld a, b
|
||||
cp $9
|
||||
jr z, .done
|
||||
push bc
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
pop bc
|
||||
inc b
|
||||
jr .loop
|
||||
.done
|
||||
ld h, d
|
||||
ld l, e
|
||||
xor a
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call ByteFill
|
||||
ld hl, sMailboxCount
|
||||
dec [hl]
|
||||
jp CloseSRAM
|
||||
; 445f4 (11:45f4)
|
||||
|
||||
ReadMailMessage: ; 445f4
|
||||
ld a, b
|
||||
ld hl, sMailbox
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
callba ReadAnyMail
|
||||
ret
|
||||
|
||||
Function44607: ; 44607
|
||||
ld a, BANK(sMailboxCount)
|
||||
call GetSRAMBank
|
||||
push bc
|
||||
ld a, b
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
ld hl, sMailbox
|
||||
call AddNTimes
|
||||
push hl
|
||||
ld a, [CurPartyMon]
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
ld hl, sPartyMail
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
push hl
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
pop hl
|
||||
ld de, PARTYMON_STRUCT_LENGTH - MON_MOVES
|
||||
add hl, de
|
||||
ld d, [hl]
|
||||
ld a, [CurPartyMon]
|
||||
ld hl, PartyMon1Item
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld [hl], d
|
||||
call CloseSRAM
|
||||
pop bc
|
||||
jp Function445c0
|
||||
; 44648 (11:4648)
|
||||
|
||||
GetMailboxCount: ; 44648
|
||||
ld a, BANK(sMailboxCount)
|
||||
call GetSRAMBank
|
||||
ld a, [sMailboxCount]
|
||||
ld c, a
|
||||
jp CloseSRAM
|
||||
; 44654
|
||||
|
||||
Function44654:: ; 44654
|
||||
push bc
|
||||
push de
|
||||
callba SelectMonFromParty
|
||||
ld a, $2
|
||||
jr c, .asm_446c6
|
||||
ld a, [CurPartyMon]
|
||||
ld hl, PartyMon1Item
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, [hl]
|
||||
callba ItemIsMail
|
||||
ld a, $3
|
||||
jr nc, .asm_446c6
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
ld a, [CurPartyMon]
|
||||
ld hl, sPartyMail
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
pop bc
|
||||
|
||||
ld a, $20
|
||||
ld [wd265], a
|
||||
.asm_44691
|
||||
ld a, [de]
|
||||
ld c, a
|
||||
ld a, b
|
||||
call GetFarByte
|
||||
cp "@"
|
||||
jr z, .asm_446ab
|
||||
cp c
|
||||
ld a, $0
|
||||
jr nz, .asm_446c1
|
||||
inc hl
|
||||
inc de
|
||||
ld a, [wd265]
|
||||
dec a
|
||||
ld [wd265], a
|
||||
jr nz, .asm_44691
|
||||
|
||||
.asm_446ab
|
||||
callba CheckCurPartyMonFainted
|
||||
ld a, $4
|
||||
jr c, .asm_446c1
|
||||
xor a
|
||||
ld [wPokemonWithdrawDepositParameter], a
|
||||
callba Functione039
|
||||
ld a, $1
|
||||
|
||||
.asm_446c1
|
||||
call CloseSRAM
|
||||
jr .asm_446c8
|
||||
|
||||
.asm_446c6
|
||||
pop de
|
||||
pop bc
|
||||
|
||||
.asm_446c8
|
||||
ld [ScriptVar], a
|
||||
ret
|
||||
; 446cc
|
@ -377,7 +377,7 @@ BuyMenu: ; 15c62
|
||||
.loop
|
||||
call BuyMenuLoop ; menu loop
|
||||
jr nc, .loop
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
ret
|
||||
; 15c7d
|
||||
|
||||
|
@ -140,7 +140,7 @@ HallOfFamePC: ; 1569a
|
||||
call PC_PlayChoosePCSound
|
||||
call FadeToMenu
|
||||
callba _HallOfFamePC
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
and a
|
||||
ret
|
||||
; 156ab
|
||||
@ -323,7 +323,7 @@ KrisWithdrawItemMenu: ; 0x157d1
|
||||
jr .asm_157da
|
||||
|
||||
.asm_157e4
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
xor a
|
||||
ret
|
||||
; 0x157e9
|
||||
@ -403,7 +403,7 @@ KrisTossItemMenu: ; 0x1585f
|
||||
jr .asm_15868
|
||||
|
||||
.asm_15878
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
xor a
|
||||
ret
|
||||
; 0x1587d
|
||||
@ -442,7 +442,7 @@ KrisDepositItemMenu: ; 0x1588b
|
||||
jr .asm_1589c
|
||||
|
||||
.asm_158b3
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
|
||||
.asm_158b6
|
||||
xor a
|
||||
@ -450,7 +450,7 @@ KrisDepositItemMenu: ; 0x1588b
|
||||
; 0x158b8
|
||||
|
||||
Function158b8: ; 0x158b8
|
||||
callba Function129d5
|
||||
callba HasNoItems
|
||||
ret nc
|
||||
ld hl, UnknownText_0x158c7
|
||||
call MenuTextBoxBackup
|
||||
|
@ -1,4 +1,4 @@
|
||||
Function14a1a: ; 14a1a
|
||||
SaveMenu: ; 14a1a
|
||||
call LoadStandardMenuDataHeader
|
||||
callba Function5e9a
|
||||
call SpeechTextBox
|
||||
@ -30,7 +30,7 @@ Function14a58: ; 14a58
|
||||
call Function14e13
|
||||
call SaveBackupPokemonData
|
||||
call SaveBackupChecksum
|
||||
callba BackupScratchmons
|
||||
callba BackupPartyMonMail
|
||||
callba Function1406a
|
||||
call ClearWRAMStateAfterSave
|
||||
ret
|
||||
@ -106,7 +106,7 @@ Function14ad5: ; 14ad5
|
||||
call SaveBackupPlayerData
|
||||
call SaveBackupPokemonData
|
||||
call SaveBackupChecksum
|
||||
callba BackupScratchmons
|
||||
callba BackupPartyMonMail
|
||||
callba BackupMobileEventIndex
|
||||
callba Function1406a
|
||||
call LoadBox
|
||||
@ -284,7 +284,7 @@ SaveGameData_: ; 14c10
|
||||
call SaveBackupPokemonData
|
||||
call SaveBackupChecksum
|
||||
call UpdateStackTop
|
||||
callba BackupScratchmons
|
||||
callba BackupPartyMonMail
|
||||
callba BackupMobileEventIndex
|
||||
callba Function1406a
|
||||
ld a, BANK(s1_be45)
|
||||
@ -630,7 +630,7 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
|
||||
call LoadPlayerData
|
||||
call LoadPokemonData
|
||||
call LoadBox
|
||||
callba RestoreScratchmons
|
||||
callba RestorePartyMonMail
|
||||
callba RestoreMobileEventIndex
|
||||
callba Function1050ea
|
||||
call ValidateBackupSave
|
||||
@ -647,7 +647,7 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
|
||||
call LoadBackupPlayerData
|
||||
call LoadBackupPokemonData
|
||||
call LoadBox
|
||||
callba RestoreScratchmons
|
||||
callba RestorePartyMonMail
|
||||
callba RestoreMobileEventIndex
|
||||
callba Function1050ea
|
||||
call ValidateSave
|
||||
|
@ -158,7 +158,7 @@ UseRegisteredItem: ; 133c3
|
||||
call ResetWindow
|
||||
call FadeToMenu
|
||||
call DoItemEffect
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
call LoadMoveSprites
|
||||
and a
|
||||
ret
|
||||
|
@ -216,7 +216,7 @@ Special_GameCornerPrizeMonCheckDex: ; c230
|
||||
ld a, [ScriptVar]
|
||||
ld [wd265], a
|
||||
callba Functionfb877
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
ret
|
||||
; c252
|
||||
|
||||
@ -288,21 +288,21 @@ SpecialNameRater: ; c2b9
|
||||
Special_TownMap: ; c2c0
|
||||
call FadeToMenu
|
||||
callba _TownMap
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
ret
|
||||
; c2cd
|
||||
|
||||
Special_UnownPrinter: ; c2cd
|
||||
call FadeToMenu
|
||||
callba UnownPrinter
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
ret
|
||||
; c2da
|
||||
|
||||
Special_DisplayLinkRecord: ; c2da
|
||||
call FadeToMenu
|
||||
callba DisplayLinkRecord
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
ret
|
||||
; c2e7
|
||||
|
||||
@ -383,7 +383,7 @@ Special_UnownPuzzle: ; c360
|
||||
callba Functione1190
|
||||
ld a, [wd0ec]
|
||||
ld [ScriptVar], a
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
ret
|
||||
; c373
|
||||
|
||||
@ -425,7 +425,7 @@ Special_StartGameCornerGame: ; c39a
|
||||
ld l, a
|
||||
pop af
|
||||
rst FarCall
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
ret
|
||||
; c3ae
|
||||
|
||||
@ -629,14 +629,14 @@ Special_FadeOutMusic: ; c48f
|
||||
Diploma: ; c49f
|
||||
call FadeToMenu
|
||||
callba _Diploma
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
ret
|
||||
; c4ac
|
||||
|
||||
PrintDiploma: ; c4ac
|
||||
call FadeToMenu
|
||||
callba _PrintDiploma
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
ret
|
||||
; c4b9
|
||||
|
||||
|
@ -422,7 +422,7 @@ StartMenu_Quit: ; 128f0
|
||||
; Retire from the bug catching contest.
|
||||
|
||||
ld hl, .EndTheContestText
|
||||
call Function12cf5
|
||||
call StartMenuYesNo
|
||||
jr c, .DontEndContest
|
||||
ld a, BANK(BugCatchingContestReturnToGateScript)
|
||||
ld hl, BugCatchingContestReturnToGateScript
|
||||
@ -444,7 +444,7 @@ StartMenu_Save: ; 1290b
|
||||
; Save the game.
|
||||
|
||||
call BufferScreen
|
||||
callba Function14a1a
|
||||
callba SaveMenu
|
||||
jr nc, .asm_12919
|
||||
ld a, 0
|
||||
ret
|
||||
@ -468,8 +468,8 @@ StartMenu_Status: ; 12928
|
||||
; Player status.
|
||||
|
||||
call FadeToMenu
|
||||
callba Function25105
|
||||
call Function2b3c
|
||||
callba TrainerCard
|
||||
call ReturnToCallingMenu
|
||||
ld a, 0
|
||||
ret
|
||||
; 12937
|
||||
@ -483,7 +483,7 @@ StartMenu_Pokedex: ; 12937
|
||||
|
||||
call FadeToMenu
|
||||
callba Pokedex
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
|
||||
.asm_12949
|
||||
ld a, 0
|
||||
@ -495,7 +495,7 @@ StartMenu_Pokegear: ; 1294c
|
||||
|
||||
call FadeToMenu
|
||||
callba PokeGear
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
ld a, 0
|
||||
ret
|
||||
; 1295b
|
||||
@ -507,12 +507,13 @@ StartMenu_Pack: ; 1295b
|
||||
callba Pack
|
||||
ld a, [wcf66]
|
||||
and a
|
||||
jr nz, .asm_12970
|
||||
call Function2b3c
|
||||
jr nz, .used_item
|
||||
call ReturnToCallingMenu
|
||||
ld a, 0
|
||||
ret
|
||||
.asm_12970
|
||||
call Function2b4d
|
||||
|
||||
.used_item
|
||||
call ExitAllMenus
|
||||
ld a, 4
|
||||
ret
|
||||
; 12976
|
||||
@ -556,19 +557,19 @@ StartMenu_Pokemon: ; 12976
|
||||
jr z, .quit
|
||||
|
||||
.return
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
ld a, 0
|
||||
ret
|
||||
|
||||
.quit
|
||||
ld a, b
|
||||
push af
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
pop af
|
||||
ret
|
||||
; 129d5
|
||||
|
||||
Function129d5: ; 129d5
|
||||
HasNoItems: ; 129d5
|
||||
ld a, [NumItems]
|
||||
and a
|
||||
ret nz
|
||||
@ -580,15 +581,15 @@ Function129d5: ; 129d5
|
||||
ret nz
|
||||
ld hl, TMsHMs
|
||||
ld b, NUM_TMS + NUM_HMS
|
||||
.asm_129e9
|
||||
.loop
|
||||
ld a, [hli]
|
||||
and a
|
||||
jr nz, .asm_129f2
|
||||
jr nz, .done
|
||||
dec b
|
||||
jr nz, .asm_129e9
|
||||
jr nz, .loop
|
||||
scf
|
||||
ret
|
||||
.asm_129f2
|
||||
.done
|
||||
and a
|
||||
ret
|
||||
|
||||
@ -882,7 +883,7 @@ Function12bd9: ; 12bd9
|
||||
jr .asm_12c08
|
||||
|
||||
.asm_12bf4
|
||||
call Function12cea
|
||||
call GiveItemToPokemon
|
||||
ld hl, MadeHoldText
|
||||
call MenuTextBoxBackup
|
||||
call GivePartyItem
|
||||
@ -897,17 +898,17 @@ Function12bd9: ; 12bd9
|
||||
ld [wd265], a
|
||||
call GetItemName
|
||||
ld hl, SwitchAlreadyHoldingText
|
||||
call Function12cf5
|
||||
call StartMenuYesNo
|
||||
jr c, .asm_12c4b
|
||||
|
||||
call Function12cea
|
||||
call GiveItemToPokemon
|
||||
ld a, [wd265]
|
||||
push af
|
||||
ld a, [CurItem]
|
||||
ld [wd265], a
|
||||
pop af
|
||||
ld [CurItem], a
|
||||
call Function12cdf
|
||||
call ReceiveItemFromPokemon
|
||||
jr nc, .asm_12c3c
|
||||
|
||||
ld hl, TookAndMadeHoldText
|
||||
@ -920,7 +921,7 @@ Function12bd9: ; 12bd9
|
||||
.asm_12c3c
|
||||
ld a, [wd265]
|
||||
ld [CurItem], a
|
||||
call Function12cdf
|
||||
call ReceiveItemFromPokemon
|
||||
ld hl, ItemStorageIsFullText
|
||||
call MenuTextBoxBackup
|
||||
|
||||
@ -953,7 +954,7 @@ TakePartyItem: ; 12c60
|
||||
jr z, .asm_12c8c
|
||||
|
||||
ld [CurItem], a
|
||||
call Function12cdf
|
||||
call ReceiveItemFromPokemon
|
||||
jr nc, .asm_12c94
|
||||
|
||||
callba ItemIsMail
|
||||
@ -1045,7 +1046,7 @@ GetPartyItemLocation: ; 12cd7
|
||||
; 12cdf
|
||||
|
||||
|
||||
Function12cdf: ; 12cdf
|
||||
ReceiveItemFromPokemon: ; 12cdf
|
||||
ld a, $1
|
||||
ld [wItemQuantityChangeBuffer], a
|
||||
ld hl, NumItems
|
||||
@ -1053,13 +1054,13 @@ Function12cdf: ; 12cdf
|
||||
; 12cea
|
||||
|
||||
|
||||
Function12cea: ; 12cea (4:6cea)
|
||||
GiveItemToPokemon: ; 12cea (4:6cea)
|
||||
ld a, $1
|
||||
ld [wItemQuantityChangeBuffer], a
|
||||
ld hl, NumItems
|
||||
jp TossItem
|
||||
|
||||
Function12cf5: ; 12cf5
|
||||
StartMenuYesNo: ; 12cf5
|
||||
call MenuTextBox
|
||||
call YesNoBox
|
||||
jp ExitMenu
|
||||
@ -1071,7 +1072,7 @@ Function12cfe: ; 12cfe (4:6cfe)
|
||||
callba Function11e75
|
||||
ld hl, PlayerName
|
||||
ld de, wd023
|
||||
ld bc, $a
|
||||
ld bc, NAME_LENGTH - 1
|
||||
call CopyBytes
|
||||
ld hl, PlayerID
|
||||
ld bc, $2
|
||||
@ -1082,14 +1083,14 @@ Function12cfe: ; 12cfe (4:6cfe)
|
||||
ld a, [CurItem]
|
||||
ld [de], a
|
||||
ld a, [CurPartyMon]
|
||||
ld hl, sPartyScratch1
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sPartyMail
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld hl, wd002
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld a, BANK(sPartyScratch1)
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
call CopyBytes
|
||||
call CloseSRAM
|
||||
@ -1127,11 +1128,11 @@ MonMailAction: ; 12d45
|
||||
|
||||
.take
|
||||
ld hl, .sendmailtopctext
|
||||
call Function12cf5
|
||||
call StartMenuYesNo
|
||||
jr c, .RemoveMailToBag
|
||||
ld a, [CurPartyMon]
|
||||
ld b, a
|
||||
callba Function4456e
|
||||
callba SendMailToPC
|
||||
jr c, .MailboxFull
|
||||
ld hl, .sentmailtopctext
|
||||
call MenuTextBoxBackup
|
||||
@ -1144,12 +1145,12 @@ MonMailAction: ; 12d45
|
||||
|
||||
.RemoveMailToBag
|
||||
ld hl, .mailwilllosemessagetext
|
||||
call Function12cf5
|
||||
call StartMenuYesNo
|
||||
jr c, .done
|
||||
call GetPartyItemLocation
|
||||
ld a, [hl]
|
||||
ld [CurItem], a
|
||||
call Function12cdf
|
||||
call ReceiveItemFromPokemon
|
||||
jr nc, .BagIsFull
|
||||
call GetPartyItemLocation
|
||||
ld [hl], $0
|
||||
|
@ -1,4 +1,4 @@
|
||||
Function25105: ; 25105
|
||||
TrainerCard: ; 25105
|
||||
ld a, [VramState]
|
||||
push af
|
||||
xor a
|
||||
@ -211,16 +211,18 @@ Function25279: ; 25279 (9:5279)
|
||||
ld hl, hJoyLast
|
||||
ld a, [hl]
|
||||
and D_LEFT
|
||||
jr nz, .asm_2528d
|
||||
jr nz, .left
|
||||
ld a, [hl]
|
||||
and D_RIGHT
|
||||
jr nz, .asm_25293
|
||||
jr nz, .right
|
||||
ret
|
||||
.asm_2528d
|
||||
|
||||
.left
|
||||
ld a, $2
|
||||
ld [wJumptableIndex], a
|
||||
ret
|
||||
.asm_25293
|
||||
|
||||
.right
|
||||
ld a, $0
|
||||
ld [wJumptableIndex], a
|
||||
ret
|
||||
@ -466,24 +468,26 @@ Function25438: ; 25438 (9:5438)
|
||||
jr Function25448
|
||||
|
||||
Function25448: ; 25448 (9:5448)
|
||||
; copy flag array pointer
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
ld a, [hli]
|
||||
; get flag array
|
||||
ld d, a
|
||||
ld a, [de]
|
||||
ld c, a
|
||||
ld de, Sprites
|
||||
ld b, 8
|
||||
.asm_25453
|
||||
.loop
|
||||
srl c
|
||||
push bc
|
||||
jr nc, .asm_25472
|
||||
jr nc, .skip_badge
|
||||
push hl
|
||||
ld a, [hli]
|
||||
ld a, [hli] ; y
|
||||
ld b, a
|
||||
ld a, [hli]
|
||||
ld a, [hli] ; x
|
||||
ld c, a
|
||||
ld a, [hli]
|
||||
ld a, [hli] ; pal
|
||||
ld [wcf66], a
|
||||
ld a, [wcf64]
|
||||
add l
|
||||
@ -495,60 +499,64 @@ Function25448: ; 25448 (9:5448)
|
||||
ld [wcf65], a
|
||||
call Function2547b
|
||||
pop hl
|
||||
.asm_25472
|
||||
ld bc, $b
|
||||
.skip_badge
|
||||
ld bc, $b ; 3 + 2 * 4
|
||||
add hl, bc
|
||||
pop bc
|
||||
dec b
|
||||
jr nz, .asm_25453
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
Function2547b: ; 2547b (9:547b)
|
||||
ld a, [wcf65]
|
||||
and $80
|
||||
jr nz, .asm_25487
|
||||
ld hl, Unknown_254a7
|
||||
jr .asm_2548a
|
||||
.asm_25487
|
||||
ld hl, Unknown_254b8
|
||||
.asm_2548a
|
||||
jr nz, .xflip
|
||||
ld hl, .facing1
|
||||
jr .loop
|
||||
.xflip
|
||||
ld hl, .facing2
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
ret z
|
||||
add b
|
||||
ld [de], a
|
||||
inc de
|
||||
|
||||
ld a, [hli]
|
||||
add c
|
||||
ld [de], a
|
||||
inc de
|
||||
|
||||
ld a, [wcf65]
|
||||
and $7f
|
||||
add [hl]
|
||||
ld [de], a
|
||||
inc hl
|
||||
inc de
|
||||
|
||||
ld a, [wcf66]
|
||||
add [hl]
|
||||
ld [de], a
|
||||
inc hl
|
||||
inc de
|
||||
jr .asm_2548a
|
||||
jr .loop
|
||||
; 254a7 (9:54a7)
|
||||
|
||||
Unknown_254a7: ; 254a7
|
||||
db $00, $00, $00, $00
|
||||
db $00, $08, $01, $00
|
||||
db $08, $00, $02, $00
|
||||
db $08, $08, $03, $00
|
||||
db $ff
|
||||
.facing1: ; 254a7
|
||||
; y, x, tile, OAM attributes
|
||||
db 0, 0, 0, 0
|
||||
db 0, 8, 1, 0
|
||||
db 8, 0, 2, 0
|
||||
db 8, 8, 3, 0
|
||||
db -1
|
||||
|
||||
Unknown_254b8: ; 254b8
|
||||
db $00, $00, $01, $20
|
||||
db $00, $08, $00, $20
|
||||
db $08, $00, $03, $20
|
||||
db $08, $08, $02, $20
|
||||
db $ff
|
||||
.facing2: ; 254b8
|
||||
db 0, 0, 1, X_FLIP
|
||||
db 0, 8, 0, X_FLIP
|
||||
db 8, 0, 3, X_FLIP
|
||||
db 8, 8, 2, X_FLIP
|
||||
db -1
|
||||
|
||||
Unknown_254c9: ; 254c9
|
||||
; Template OAM data for each badge on the trainer card.
|
||||
@ -560,43 +568,43 @@ Unknown_254c9: ; 254c9
|
||||
dw JohtoBadges
|
||||
|
||||
; Zephyrbadge
|
||||
db $68, $18, $00
|
||||
db $68, $18, 0
|
||||
db $00, $20, $24, $20 | $80
|
||||
db $00, $20, $24, $20 | $80
|
||||
|
||||
; Hivebadge
|
||||
db $68, $38, $00
|
||||
db $68, $38, 0
|
||||
db $04, $20, $24, $20 | $80
|
||||
db $04, $20, $24, $20 | $80
|
||||
|
||||
; Plainbadge
|
||||
db $68, $58, $00
|
||||
db $68, $58, 0
|
||||
db $08, $20, $24, $20 | $80
|
||||
db $08, $20, $24, $20 | $80
|
||||
|
||||
; Fogbadge
|
||||
db $68, $78, $00
|
||||
db $68, $78, 0
|
||||
db $0c, $20, $24, $20 | $80
|
||||
db $0c, $20, $24, $20 | $80
|
||||
|
||||
; Mineralbadge
|
||||
db $80, $38, $00
|
||||
db $80, $38, 0
|
||||
db $10, $20, $24, $20 | $80
|
||||
db $10, $20, $24, $20 | $80
|
||||
|
||||
; Stormbadge
|
||||
db $80, $18, $00
|
||||
db $80, $18, 0
|
||||
db $14, $20, $24, $20 | $80
|
||||
db $14, $20, $24, $20 | $80
|
||||
|
||||
; Glacierbadge
|
||||
db $80, $58, $00
|
||||
db $80, $58, 0
|
||||
db $18, $20, $24, $20 | $80
|
||||
db $18, $20, $24, $20 | $80
|
||||
|
||||
; Risingbadge
|
||||
; X-flips on alternate cycles.
|
||||
db $80, $78, $00
|
||||
db $80, $78, 0
|
||||
db $1c, $20, $24, $20 | $80
|
||||
db $1c | $80, $20, $24, $20 | $80
|
||||
; 25523
|
||||
|
@ -2014,7 +2014,7 @@ FadeToMenu:: ; 2b29
|
||||
; 2b3c
|
||||
|
||||
|
||||
Function2b3c:: ; 2b3c
|
||||
ReturnToCallingMenu:: ; 2b3c
|
||||
call ClearBGPalettes
|
||||
call Function2bae
|
||||
call UpdateSprites
|
||||
@ -2023,7 +2023,7 @@ Function2b3c:: ; 2b3c
|
||||
jr Function2b5c
|
||||
; 2b4d
|
||||
|
||||
Function2b4d:: ; 2b4d
|
||||
ExitAllMenus:: ; 2b4d
|
||||
call ClearBGPalettes
|
||||
call Call_ExitMenu
|
||||
call Function2bae
|
||||
|
333
main.asm
333
main.asm
@ -285,7 +285,7 @@ ENDC
|
||||
|
||||
callba InitDecorations
|
||||
|
||||
callba DeleteScratchmons
|
||||
callba DeletePartyMonMail
|
||||
|
||||
callba DeleteMobileEventIndex
|
||||
|
||||
@ -9297,14 +9297,14 @@ Functione039: ; e039
|
||||
ld a, [wLinkMode]
|
||||
and a
|
||||
ret nz
|
||||
ld a, BANK(sPartyScratch1)
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
ld hl, PartyCount
|
||||
ld a, [CurPartyMon]
|
||||
cp [hl]
|
||||
jr z, .asm_e131
|
||||
ld hl, sPartyScratch1
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sPartyMail
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
push hl
|
||||
add hl, bc
|
||||
@ -9314,11 +9314,11 @@ Functione039: ; e039
|
||||
.asm_e11a
|
||||
push bc
|
||||
push hl
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
pop hl
|
||||
push hl
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
add hl, bc
|
||||
pop de
|
||||
pop bc
|
||||
@ -9789,7 +9789,7 @@ InitNickname: ; e3de
|
||||
ld de, StringBuffer1
|
||||
call InitName
|
||||
ld a, $4 ; XXX could this be in bank 4 in pokered?
|
||||
ld hl, Function2b4d
|
||||
ld hl, ExitAllMenus
|
||||
rst FarCall
|
||||
ret
|
||||
; e3fd
|
||||
@ -9841,7 +9841,7 @@ UnknownText_0xe43a: ; 0xe43a
|
||||
; 0xe43f
|
||||
|
||||
Functione43f: ; e43f (3:643f)
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
ret
|
||||
|
||||
Functione443: ; e443 (3:6443)
|
||||
@ -10414,7 +10414,7 @@ INCLUDE "engine/tmhm.asm"
|
||||
|
||||
INCLUDE "engine/namingscreen.asm"
|
||||
|
||||
Function11e75: ; 11e75 (4:5e75)
|
||||
Function11e75: ; 11e75 (mail?)
|
||||
ld hl, wc6d0
|
||||
ld [hl], e
|
||||
inc hl
|
||||
@ -17957,197 +17957,7 @@ endr
|
||||
PokedexDataPointerTable: ; 0x44378
|
||||
INCLUDE "data/pokedex/entry_pointers.asm"
|
||||
|
||||
|
||||
Function4456e: ; 4456e
|
||||
ld a, MON_ITEM
|
||||
call GetPartyParamLocation
|
||||
ld d, [hl]
|
||||
callba ItemIsMail
|
||||
jr nc, .asm_445be
|
||||
call Function44648
|
||||
cp $a
|
||||
jr nc, .asm_445be
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, s0_a835
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld a, [CurPartyMon]
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sPartyScratch1
|
||||
call AddNTimes
|
||||
push hl
|
||||
ld a, BANK(s0_a834)
|
||||
call GetSRAMBank
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
pop hl
|
||||
xor a
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
call ByteFill
|
||||
ld a, MON_ITEM
|
||||
call GetPartyParamLocation
|
||||
ld [hl], $0
|
||||
ld hl, s0_a834
|
||||
inc [hl]
|
||||
call CloseSRAM
|
||||
xor a
|
||||
ret
|
||||
|
||||
.asm_445be
|
||||
scf
|
||||
ret
|
||||
; 445c0
|
||||
|
||||
Function445c0: ; 445c0 (11:45c0)
|
||||
ld a, BANK(s0_a834)
|
||||
call GetSRAMBank
|
||||
ld a, b
|
||||
push bc
|
||||
ld hl, s0_a835
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
push hl
|
||||
add hl, bc
|
||||
pop de
|
||||
pop bc
|
||||
.loop
|
||||
ld a, b
|
||||
cp $9
|
||||
jr z, .done
|
||||
push bc
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
pop bc
|
||||
inc b
|
||||
jr .loop
|
||||
.done
|
||||
ld h, d
|
||||
ld l, e
|
||||
xor a
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
call ByteFill
|
||||
ld hl, s0_a834
|
||||
dec [hl]
|
||||
jp CloseSRAM
|
||||
; 445f4 (11:45f4)
|
||||
|
||||
ReadMailMessage: ; 445f4
|
||||
ld a, b
|
||||
ld hl, s0_a835
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
callba ReadAnyMail
|
||||
ret
|
||||
|
||||
Function44607: ; 44607
|
||||
ld a, BANK(s0_a834)
|
||||
call GetSRAMBank
|
||||
push bc
|
||||
ld a, b
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, s0_a835
|
||||
call AddNTimes
|
||||
push hl
|
||||
ld a, [CurPartyMon]
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sPartyScratch1
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
push hl
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
pop hl
|
||||
ld de, PARTYMON_STRUCT_LENGTH - MON_MOVES
|
||||
add hl, de
|
||||
ld d, [hl]
|
||||
ld a, [CurPartyMon]
|
||||
ld hl, PartyMon1Item
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld [hl], d
|
||||
call CloseSRAM
|
||||
pop bc
|
||||
jp Function445c0
|
||||
; 44648 (11:4648)
|
||||
|
||||
Function44648: ; 44648
|
||||
ld a, BANK(s0_a834)
|
||||
call GetSRAMBank
|
||||
ld a, [s0_a834]
|
||||
ld c, a
|
||||
jp CloseSRAM
|
||||
; 44654
|
||||
|
||||
Function44654:: ; 44654
|
||||
push bc
|
||||
push de
|
||||
callba SelectMonFromParty
|
||||
ld a, $2
|
||||
jr c, .asm_446c6
|
||||
ld a, [CurPartyMon]
|
||||
ld hl, PartyMon1Item
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, [hl]
|
||||
callba ItemIsMail
|
||||
ld a, $3
|
||||
jr nc, .asm_446c6
|
||||
ld a, BANK(sPartyScratch1)
|
||||
call GetSRAMBank
|
||||
ld a, [CurPartyMon]
|
||||
ld hl, sPartyScratch1
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
pop hl
|
||||
pop bc
|
||||
|
||||
ld a, $20
|
||||
ld [wd265], a
|
||||
.asm_44691
|
||||
ld a, [de]
|
||||
ld c, a
|
||||
ld a, b
|
||||
call GetFarByte
|
||||
cp "@"
|
||||
jr z, .asm_446ab
|
||||
cp c
|
||||
ld a, $0
|
||||
jr nz, .asm_446c1
|
||||
inc hl
|
||||
inc de
|
||||
ld a, [wd265]
|
||||
dec a
|
||||
ld [wd265], a
|
||||
jr nz, .asm_44691
|
||||
|
||||
.asm_446ab
|
||||
callba CheckCurPartyMonFainted
|
||||
ld a, $4
|
||||
jr c, .asm_446c1
|
||||
xor a
|
||||
ld [wPokemonWithdrawDepositParameter], a
|
||||
callba Functione039
|
||||
ld a, $1
|
||||
|
||||
.asm_446c1
|
||||
call CloseSRAM
|
||||
jr .asm_446c8
|
||||
|
||||
.asm_446c6
|
||||
pop de
|
||||
pop bc
|
||||
|
||||
.asm_446c8
|
||||
ld [ScriptVar], a
|
||||
ret
|
||||
; 446cc
|
||||
INCLUDE "engine/mail.asm"
|
||||
|
||||
GivePokeItem:: ; 446cc
|
||||
ld a, [PartyCount]
|
||||
@ -18162,14 +17972,14 @@ GivePokeItem:: ; 446cc
|
||||
pop af
|
||||
push bc
|
||||
push af
|
||||
ld hl, sPartyScratch1
|
||||
ld hl, sPartyMail
|
||||
ld bc, $2f
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld hl, wd002
|
||||
ld bc, $21
|
||||
ld a, BANK(sPartyScratch1)
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
call CopyBytes
|
||||
pop af
|
||||
@ -18199,43 +18009,43 @@ GivePokeItem:: ; 446cc
|
||||
; 44725
|
||||
|
||||
|
||||
BackupScratchmons: ; 44725
|
||||
ld a, BANK(sPartyScratch1)
|
||||
BackupPartyMonMail: ; 44725
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
ld hl, sPartyScratch1
|
||||
ld de, sPartyScratch2
|
||||
ld bc, 6 * SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sPartyMail
|
||||
ld de, sPartyMailBackup
|
||||
ld bc, 6 * MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
ld hl, s0_a834
|
||||
ld de, s0_aa0b
|
||||
ld bc, 1 + 10 * SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sMailboxCount
|
||||
ld de, sMailboxCountBackup
|
||||
ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
jp CloseSRAM
|
||||
; 44745
|
||||
|
||||
RestoreScratchmons: ; 44745 (11:4745)
|
||||
ld a, BANK(sPartyScratch1)
|
||||
RestorePartyMonMail: ; 44745 (11:4745)
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
ld hl, sPartyScratch2
|
||||
ld de, sPartyScratch1
|
||||
ld bc, 6 * SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sPartyMailBackup
|
||||
ld de, sPartyMail
|
||||
ld bc, 6 * MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
ld hl, s0_aa0b
|
||||
ld de, s0_a834
|
||||
ld bc, 1 + 10 * SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sMailboxCountBackup
|
||||
ld de, sMailboxCount
|
||||
ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
jp CloseSRAM
|
||||
|
||||
DeleteScratchmons: ; 44765 (11:4765)
|
||||
ld a, BANK(sPartyScratch1)
|
||||
DeletePartyMonMail: ; 44765 (11:4765)
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
xor a
|
||||
ld hl, sPartyScratch1
|
||||
ld bc, 6 * SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sPartyMail
|
||||
ld bc, 6 * MAIL_STRUCT_LENGTH
|
||||
call ByteFill
|
||||
xor a
|
||||
ld hl, s0_a834
|
||||
ld bc, 1 + 10 * SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sMailboxCount
|
||||
ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
|
||||
call ByteFill
|
||||
jp CloseSRAM
|
||||
; 44781 (11:4781)
|
||||
@ -18284,9 +18094,9 @@ _KrisMailBoxMenu: ; 0x447a0
|
||||
InitMail: ; 0x447b9
|
||||
; initialize wd0f2 and beyond with incrementing values, one per mail
|
||||
; set z if no mail
|
||||
ld a, BANK(s0_a834)
|
||||
ld a, BANK(sMailboxCount)
|
||||
call GetSRAMBank
|
||||
ld a, [s0_a834]
|
||||
ld a, [sMailboxCount]
|
||||
call CloseSRAM
|
||||
ld hl, wd0f2
|
||||
ld [hli], a
|
||||
@ -18312,10 +18122,10 @@ InitMail: ; 0x447b9
|
||||
|
||||
Function447da: ; 0x447da
|
||||
dec a
|
||||
ld hl, s0_a835 + MON_HP - 1
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sMailbox + MON_HP - 1
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld a, BANK(s0_a834)
|
||||
ld a, BANK(sMailboxCount)
|
||||
call GetSRAMBank
|
||||
ld de, StringBuffer2
|
||||
push de
|
||||
@ -18396,7 +18206,7 @@ Function4484a: ; 0x4484a
|
||||
dec a
|
||||
ld b, a
|
||||
call ReadMailMessage
|
||||
jp Function2b3c
|
||||
jp ReturnToCallingMenu
|
||||
; 0x44877
|
||||
|
||||
.PutInPack ; 0x44877
|
||||
@ -18439,10 +18249,10 @@ Function4484a: ; 0x4484a
|
||||
|
||||
.Function448bb: ; 0x448bb
|
||||
push af
|
||||
ld a, BANK(s0_a834)
|
||||
ld a, BANK(sMailboxCount)
|
||||
call GetSRAMBank
|
||||
pop af
|
||||
ld hl, s0_a835 + $2e
|
||||
ld hl, sMailbox + $2e
|
||||
ld bc, $2f
|
||||
call AddNTimes
|
||||
ld a, [hl]
|
||||
@ -18455,7 +18265,7 @@ Function4484a: ; 0x4484a
|
||||
xor a
|
||||
ld [PartyMenuActionText], a
|
||||
call ClearBGPalettes
|
||||
.asm_448dc
|
||||
.try_again
|
||||
callba Function5004f
|
||||
callba Function50405
|
||||
callba Function503e0
|
||||
@ -18465,25 +18275,25 @@ Function4484a: ; 0x4484a
|
||||
call SetPalettes
|
||||
call DelayFrame
|
||||
callba PartyMenuSelect
|
||||
jr c, .asm_44939
|
||||
jr c, .exit
|
||||
ld a, [CurPartySpecies]
|
||||
cp EGG
|
||||
jr z, .asm_44923
|
||||
jr z, .egg
|
||||
ld a, MON_ITEM
|
||||
call GetPartyParamLocation
|
||||
ld a, [hl]
|
||||
and a
|
||||
jr z, .asm_4492b
|
||||
jr z, .attach_mail
|
||||
ld hl, .HoldingMailText
|
||||
call PrintText
|
||||
jr .asm_448dc
|
||||
jr .try_again
|
||||
|
||||
.asm_44923
|
||||
.egg
|
||||
ld hl, .EggText
|
||||
call PrintText
|
||||
jr .asm_448dc
|
||||
jr .try_again
|
||||
|
||||
.asm_4492b
|
||||
.attach_mail
|
||||
ld a, [MenuSelection]
|
||||
dec a
|
||||
ld b, a
|
||||
@ -18491,8 +18301,8 @@ Function4484a: ; 0x4484a
|
||||
ld hl, .MailMovedText
|
||||
call PrintText
|
||||
|
||||
.asm_44939
|
||||
jp Function2b3c
|
||||
.exit
|
||||
jp ReturnToCallingMenu
|
||||
; 0x4493c
|
||||
|
||||
.HoldingMailText ; 0x4493c
|
||||
@ -18720,7 +18530,7 @@ Special_MoveTutor: ; 4925b
|
||||
ld [ScriptVar], a
|
||||
|
||||
.asm_492a1
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
ret
|
||||
; 492a5
|
||||
|
||||
@ -19924,7 +19734,7 @@ Function4a94e: ; 4a94e
|
||||
jr c, .asm_4a974
|
||||
|
||||
.asm_4a990
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
ld hl, wd002
|
||||
ld a, -1
|
||||
ld bc, 3
|
||||
@ -19937,7 +19747,7 @@ Function4a94e: ; 4a94e
|
||||
jr c, .asm_4a9b0
|
||||
call Function4a9d7
|
||||
jr c, .asm_4a974
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
and a
|
||||
|
||||
.asm_4a9af
|
||||
@ -24838,27 +24648,27 @@ _SwitchPartyMons:
|
||||
pop de
|
||||
ld hl, wd002
|
||||
call .CopyName
|
||||
ld hl, sPartyScratch1
|
||||
ld hl, sPartyMail
|
||||
ld a, [Buffer2] ; wd1eb (aliases: MovementType)
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
push hl
|
||||
ld de, wd002
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld a, BANK(sPartyScratch1)
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
call CopyBytes
|
||||
ld hl, sPartyScratch1
|
||||
ld hl, sPartyMail
|
||||
ld a, [Buffer3]
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
pop de
|
||||
push hl
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
pop de
|
||||
ld hl, wd002
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call CopyBytes
|
||||
call CloseSRAM
|
||||
pop bc
|
||||
@ -31402,8 +31212,8 @@ INCLUDE "engine/radio.asm"
|
||||
|
||||
ReadPartyMonMail: ; b9229
|
||||
ld a, [CurPartyMon]
|
||||
ld hl, sPartyScratch1
|
||||
ld bc, SCRATCHMON_STRUCT_LENGTH
|
||||
ld hl, sPartyMail
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
@ -31416,7 +31226,7 @@ ReadAnyMail: ; b9237
|
||||
call LoadFontsExtra
|
||||
pop de
|
||||
push de
|
||||
ld a, BANK(sPartyScratch1)
|
||||
ld a, BANK(sPartyMail)
|
||||
call GetSRAMBank
|
||||
callba Function1de5c8
|
||||
call CloseSRAM
|
||||
@ -41337,24 +41147,25 @@ INCBIN "gfx/misc/pokegear.2bpp.lz"
|
||||
; 1de5c8
|
||||
|
||||
Function1de5c8: ; 1de5c8
|
||||
; reads mail message at de
|
||||
ld c, $0
|
||||
ld hl, $29
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
cp $84
|
||||
cp "E"
|
||||
ret nz
|
||||
ld a, [hli]
|
||||
inc c
|
||||
cp $85
|
||||
cp "F"
|
||||
ret z
|
||||
inc c
|
||||
cp $86
|
||||
cp "G"
|
||||
ret z
|
||||
inc c
|
||||
cp $88
|
||||
cp "I"
|
||||
ret z
|
||||
inc c
|
||||
cp $92
|
||||
cp "S"
|
||||
ret z
|
||||
ld c, $0
|
||||
ret
|
||||
|
@ -2523,7 +2523,7 @@ Unknown_100fc0: ; 100fc0
|
||||
db -1
|
||||
|
||||
Unknown_100feb: ; 100feb
|
||||
dbwww $00, sPartyScratch1, SCRATCHMON_STRUCT_LENGTH * PARTY_LENGTH, NULL
|
||||
dbwww $00, sPartyMail, MAIL_STRUCT_LENGTH * PARTY_LENGTH, NULL
|
||||
db -1
|
||||
|
||||
Unknown_100ff3: ; 100ff3
|
||||
|
@ -5842,7 +5842,7 @@ Function11ac3e: ; 11ac3e
|
||||
call FadeToMenu
|
||||
callab InefficientlyClear121BytesAtwc300
|
||||
call Function11ac51
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
ret
|
||||
; 11ac51
|
||||
|
||||
@ -7697,7 +7697,7 @@ Function11b7e5: ; 11b7e5
|
||||
ld [de], a
|
||||
|
||||
.asm_11b872
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
call RestartMapMusic
|
||||
ret
|
||||
; 11b879
|
||||
@ -7919,7 +7919,7 @@ Function11b98f: ; 11b98f
|
||||
call CopyBytes
|
||||
ld a, "@"
|
||||
ld [de], a
|
||||
ld hl, sPartyScratch1
|
||||
ld hl, sPartyMail
|
||||
ld bc, PARTYMON_STRUCT_LENGTH - 1
|
||||
ld a, [wcd2a]
|
||||
.loop5
|
||||
|
@ -278,7 +278,7 @@ Function1704e1: ; 1704e1
|
||||
call FadeToMenu
|
||||
call Function17021e
|
||||
call Function1704f1
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
ret
|
||||
; 1704f1
|
||||
|
||||
|
@ -324,7 +324,7 @@ Function17d0f3: ; 17d0f3
|
||||
ld [de], a
|
||||
|
||||
.asm_17d180
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
call RestartMapMusic
|
||||
ret
|
||||
; 17d187
|
||||
@ -562,7 +562,7 @@ Function17d2ce: ; 17d2ce
|
||||
ld [MusicFadeIDHi], a
|
||||
call PlayMusic
|
||||
call ReturnToMapFromSubmenu
|
||||
call Function2b3c
|
||||
call ReturnToCallingMenu
|
||||
ret
|
||||
; 17d314
|
||||
|
||||
@ -4674,7 +4674,7 @@ Function17f53d: ; 17f53d
|
||||
call Function17f555
|
||||
pop af
|
||||
ld [rSVBK], a
|
||||
call Function2b4d
|
||||
call ExitAllMenus
|
||||
ret
|
||||
; 17f555
|
||||
|
||||
|
54
sram.asm
54
sram.asm
@ -9,12 +9,54 @@ sScratch::
|
||||
|
||||
SECTION "SRAM Bank 0", SRAM [$a600], BANK [0]
|
||||
|
||||
sPartyScratch1:: ds 6 * SCRATCHMON_STRUCT_LENGTH
|
||||
sPartyScratch2:: ds 6 * SCRATCHMON_STRUCT_LENGTH
|
||||
s0_a834:: ds 1
|
||||
s0_a835:: ds 10 * SCRATCHMON_STRUCT_LENGTH
|
||||
s0_aa0b:: ds 1
|
||||
s0_aa0c:: ds 10 * SCRATCHMON_STRUCT_LENGTH
|
||||
mailmsg: MACRO
|
||||
\1Message:: ds $20
|
||||
\1Author:: ds NAME_LENGTH
|
||||
ds 3
|
||||
\1MailType:: ds 1
|
||||
endm
|
||||
|
||||
sPartyMail::
|
||||
sPartyMon1Mail:: mailmsg sPartyMon1Mail
|
||||
sPartyMon2Mail:: mailmsg sPartyMon2Mail
|
||||
sPartyMon3Mail:: mailmsg sPartyMon3Mail
|
||||
sPartyMon4Mail:: mailmsg sPartyMon4Mail
|
||||
sPartyMon5Mail:: mailmsg sPartyMon5Mail
|
||||
sPartyMon6Mail:: mailmsg sPartyMon6Mail
|
||||
|
||||
sPartyMailBackup::
|
||||
sPartyMon1MailBackup:: mailmsg sPartyMon1MailBackup
|
||||
sPartyMon2MailBackup:: mailmsg sPartyMon2MailBackup
|
||||
sPartyMon3MailBackup:: mailmsg sPartyMon3MailBackup
|
||||
sPartyMon4MailBackup:: mailmsg sPartyMon4MailBackup
|
||||
sPartyMon5MailBackup:: mailmsg sPartyMon5MailBackup
|
||||
sPartyMon6MailBackup:: mailmsg sPartyMon6MailBackup
|
||||
|
||||
sMailboxCount:: ds 1
|
||||
sMailbox::
|
||||
sMailbox1:: mailmsg sMailbox1
|
||||
sMailbox2:: mailmsg sMailbox2
|
||||
sMailbox3:: mailmsg sMailbox3
|
||||
sMailbox4:: mailmsg sMailbox4
|
||||
sMailbox5:: mailmsg sMailbox5
|
||||
sMailbox6:: mailmsg sMailbox6
|
||||
sMailbox7:: mailmsg sMailbox7
|
||||
sMailbox8:: mailmsg sMailbox8
|
||||
sMailbox9:: mailmsg sMailbox9
|
||||
sMailbox10:: mailmsg sMailbox10
|
||||
|
||||
sMailboxCountBackup:: ds 1
|
||||
sMailboxBackup::
|
||||
sMailbox1Backup:: mailmsg sMailbox1Backup
|
||||
sMailbox2Backup:: mailmsg sMailbox2Backup
|
||||
sMailbox3Backup:: mailmsg sMailbox3Backup
|
||||
sMailbox4Backup:: mailmsg sMailbox4Backup
|
||||
sMailbox5Backup:: mailmsg sMailbox5Backup
|
||||
sMailbox6Backup:: mailmsg sMailbox6Backup
|
||||
sMailbox7Backup:: mailmsg sMailbox7Backup
|
||||
sMailbox8Backup:: mailmsg sMailbox8Backup
|
||||
sMailbox9Backup:: mailmsg sMailbox9Backup
|
||||
sMailbox10Backup:: mailmsg sMailbox10Backup
|
||||
|
||||
sMysteryGiftItem:: ds 1
|
||||
s0_abe3:: ds 1
|
||||
|
Loading…
Reference in New Issue
Block a user