Fruit tree constants, more mail engine

This commit is contained in:
PikalaxALT 2015-11-18 10:42:42 -05:00
parent bc1870e3f4
commit 6d47be8d8c
32 changed files with 653 additions and 608 deletions

View File

@ -665,3 +665,36 @@ EMOTE_OBJECT EQU 7
const PERSONTYPE_4
const PERSONTYPE_5
const PERSONTYPE_6
; fruit trees
const_value SET 1
const FRUITTREE_ROUTE_29
const FRUITTREE_ROUTE_30_1
const FRUITTREE_ROUTE_38
const FRUITTREE_ROUTE_46_1
const FRUITTREE_ROUTE_30_2
const FRUITTREE_ROUTE_33
const FRUITTREE_ROUTE_31
const FRUITTREE_ROUTE_43
const FRUITTREE_VIOLET_CITY
const FRUITTREE_ROUTE_46_2
const FRUITTREE_ROUTE_35
const FRUITTREE_ROUTE_45
const FRUITTREE_ROUTE_36
const FRUITTREE_ROUTE_26
const FRUITTREE_ROUTE_39
const FRUITTREE_ROUTE_44
const FRUITTREE_ROUTE_37_1
const FRUITTREE_ROUTE_37_2
const FRUITTREE_ROUTE_37_3
const FRUITTREE_AZALEA_TOWN
const FRUITTREE_ROUTE_42_1
const FRUITTREE_ROUTE_42_2
const FRUITTREE_ROUTE_42_3
const FRUITTREE_ROUTE_11
const FRUITTREE_ROUTE_2
const FRUITTREE_ROUTE_1
const FRUITTREE_ROUTE_8
const FRUITTREE_PEWTER_CITY_1
const FRUITTREE_PEWTER_CITY_2
const FRUITTREE_FUCHSIA_CITY

View File

@ -35,6 +35,7 @@ NUM_BOXES EQU 14
; mail
MAIL_STRUCT_LENGTH EQU $2f
MAILBOX_CAPACITY EQU 10
MAIL_MSG_LENGTH EQU $20
; hall of fame
HOF_MON_LENGTH = 1 + 2 + 2 + 1 + (PKMN_NAME_LENGTH +- 1) ; species, id, dvs, level, nick

View File

@ -39,7 +39,8 @@ SendMailToPC: ; 4456e
ret
; 445c0
Function445c0: ; 445c0 (11:45c0)
DeleteMailFromPC: ; 445c0 (11:45c0)
; Shift all mail messages in the mailbox
ld a, BANK(sMailboxCount)
call GetSRAMBank
ld a, b
@ -53,7 +54,7 @@ Function445c0: ; 445c0 (11:45c0)
pop bc
.loop
ld a, b
cp $9
cp MAILBOX_CAPACITY - 1
jr z, .done
push bc
ld bc, MAIL_STRUCT_LENGTH
@ -82,7 +83,7 @@ ReadMailMessage: ; 445f4
callba ReadAnyMail
ret
Function44607: ; 44607
MoveMailFromPCToParty: ; 44607
ld a, BANK(sMailboxCount)
call GetSRAMBank
push bc
@ -112,7 +113,7 @@ Function44607: ; 44607
ld [hl], d
call CloseSRAM
pop bc
jp Function445c0
jp DeleteMailFromPC
; 44648 (11:4648)
GetMailboxCount: ; 44648
@ -123,12 +124,13 @@ GetMailboxCount: ; 44648
jp CloseSRAM
; 44654
Function44654:: ; 44654
CheckPokeItem:: ; 44654
push bc
push de
callba SelectMonFromParty
ld a, $2
jr c, .asm_446c6
jr c, .pop_return
ld a, [CurPartyMon]
ld hl, PartyMon1Item
ld bc, PARTYMON_STRUCT_LENGTH
@ -136,7 +138,8 @@ Function44654:: ; 44654
ld d, [hl]
callba ItemIsMail
ld a, $3
jr nc, .asm_446c6
jr nc, .pop_return
ld a, BANK(sPartyMail)
call GetSRAMBank
ld a, [CurPartyMon]
@ -148,43 +151,437 @@ Function44654:: ; 44654
pop hl
pop bc
ld a, $20
; Compare the mail message, byte for byte, with the expected message.
ld a, MAIL_MSG_LENGTH
ld [wd265], a
.asm_44691
.loop
ld a, [de]
ld c, a
ld a, b
call GetFarByte
cp "@"
jr z, .asm_446ab
jr z, .done
cp c
ld a, $0
jr nz, .asm_446c1
jr nz, .close_sram_return
inc hl
inc de
ld a, [wd265]
dec a
ld [wd265], a
jr nz, .asm_44691
jr nz, .loop
.asm_446ab
.done
callba CheckCurPartyMonFainted
ld a, $4
jr c, .asm_446c1
jr c, .close_sram_return
xor a
ld [wPokemonWithdrawDepositParameter], a
callba Functione039
ld a, $1
.asm_446c1
.close_sram_return
call CloseSRAM
jr .asm_446c8
jr .return
.asm_446c6
.pop_return
pop de
pop bc
.asm_446c8
.return
ld [ScriptVar], a
ret
; 446cc
GivePokeItem:: ; 446cc
ld a, [PartyCount]
dec a
push af
push bc
ld hl, PartyMon1Item
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
ld [hl], b
pop af
push bc
push af
ld hl, sPartyMail
ld bc, $2f
call AddNTimes
ld d, h
ld e, l
ld hl, wd002
ld bc, $21
ld a, BANK(sPartyMail)
call GetSRAMBank
call CopyBytes
pop af
push af
ld hl, PartyMonOT
ld bc, NAME_LENGTH
call AddNTimes
ld bc, $a
call CopyBytes
pop af
ld hl, PartyMon1ID
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
ld a, [CurPartySpecies]
ld [de], a
inc de
pop bc
ld a, b
ld [de], a
jp CloseSRAM
; 44725
BackupPartyMonMail: ; 44725
ld a, BANK(sPartyMail)
call GetSRAMBank
ld hl, sPartyMail
ld de, sPartyMailBackup
ld bc, 6 * MAIL_STRUCT_LENGTH
call CopyBytes
ld hl, sMailboxCount
ld de, sMailboxCountBackup
ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
call CopyBytes
jp CloseSRAM
; 44745
RestorePartyMonMail: ; 44745 (11:4745)
ld a, BANK(sPartyMail)
call GetSRAMBank
ld hl, sPartyMailBackup
ld de, sPartyMail
ld bc, 6 * MAIL_STRUCT_LENGTH
call CopyBytes
ld hl, sMailboxCountBackup
ld de, sMailboxCount
ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
call CopyBytes
jp CloseSRAM
DeletePartyMonMail: ; 44765 (11:4765)
ld a, BANK(sPartyMail)
call GetSRAMBank
xor a
ld hl, sPartyMail
ld bc, 6 * MAIL_STRUCT_LENGTH
call ByteFill
xor a
ld hl, sMailboxCount
ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
call ByteFill
jp CloseSRAM
; 44781 (11:4781)
Function44781: ; 44781
ld a, [PartyCount]
and a
jr z, .asm_4479e
ld e, a
ld hl, PartyMon1Item
.asm_4478b
ld d, [hl]
push hl
push de
callba ItemIsMail
pop de
pop hl
ret c
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
dec e
jr nz, .asm_4478b
.asm_4479e
and a
ret
; 447a0
_KrisMailBoxMenu: ; 0x447a0
call InitMail
jr z, .nomail
call LoadStandardMenuDataHeader
call MailboxPC
jp WriteBackup
.nomail
ld hl, .EmptyMailboxText
jp MenuTextBoxBackup
; 0x447b4
.EmptyMailboxText ; 0x447b4
text_jump _EmptyMailboxText
db "@"
InitMail: ; 0x447b9
; initialize wd0f2 and beyond with incrementing values, one per mail
; set z if no mail
ld a, BANK(sMailboxCount)
call GetSRAMBank
ld a, [sMailboxCount]
call CloseSRAM
ld hl, wd0f2
ld [hli], a
and a
jr z, .done ; if no mail, we're done
; load values in memory with incrementing values starting at wd0f2
ld b, a
ld a, $1
.loop
ld [hli], a
inc a
dec b
jr nz, .loop
.done
ld [hl], $ff ; terminate
ld a, [wd0f2]
and a
ret
; 0x447da
Function447da: ; 0x447da
dec a
ld hl, sMailbox1Author
ld bc, MAIL_STRUCT_LENGTH
call AddNTimes
ld a, BANK(sMailboxCount)
call GetSRAMBank
ld de, StringBuffer2
push de
ld bc, NAME_LENGTH - 1
call CopyBytes
ld a, "@"
ld [de], a
call CloseSRAM
pop de
ret
; 0x447fb
Function447fb: ; 0x447fb
push de
ld a, [MenuSelection]
call Function447da
pop hl
jp PlaceString
; 0x44806
MailboxPC: ; 0x44806
xor a
ld [OBPals + 8 * 6], a
ld a, $1
ld [wd0f1], a
.loop
call InitMail
ld hl, MenuData4494c
call CopyMenuDataHeader
xor a
ld [hBGMapMode], a
call InitScrollingMenu
call UpdateSprites
ld a, [wd0f1]
ld [wMenuCursorBuffer], a
ld a, [OBPals + 8 * 6]
ld [wd0e4], a
call HandleScrollingMenu
ld a, [wd0e4]
ld [OBPals + 8 * 6], a
ld a, [MenuSelection2]
ld [wd0f1], a
ld a, [wcf73]
cp $2
jr z, .exit
call Function4484a
jr .loop
.exit
xor a
ret
; 0x4484a
Function4484a: ; 0x4484a
ld hl, MenuData44964
call LoadMenuDataHeader
call InterpretMenu2
call ExitMenu
jr c, .exit
ld a, [MenuSelection2]
dec a
ld hl, .JumpTable
rst JumpTable
.exit
ret
; 0x44861
.JumpTable
dw .ReadMail
dw .PutInPack
dw .AttachMail
dw .Cancel
.ReadMail ; 0x44869
call FadeToMenu
ld a, [MenuSelection]
dec a
ld b, a
call ReadMailMessage
jp ReturnToCallingMenu
; 0x44877
.PutInPack ; 0x44877
ld hl, .MessageLostText
call MenuTextBox
call YesNoBox
call ExitMenu
ret c
ld a, [MenuSelection]
dec a
call .GetMailType
ld a, $1
ld [wItemQuantityChangeBuffer], a
ld hl, NumItems
call ReceiveItem
jr c, .put_in_bag
ld hl, .PackFullText
jp MenuTextBoxBackup
.put_in_bag
ld a, [MenuSelection]
dec a
ld b, a
call DeleteMailFromPC
ld hl, .PutAwayText
jp MenuTextBoxBackup
; 0x448ac
.PutAwayText ; 0x448ac
text_jump ClearedMailPutAwayText
db "@"
.PackFullText ; 0x448b1
text_jump MailPackFullText
db "@"
.MessageLostText ; 0x448b6
text_jump MailMessageLostText
db "@"
.GetMailType: ; 0x448bb
push af
ld a, BANK(sMailboxCount)
call GetSRAMBank
pop af
ld hl, sMailbox1MailType
ld bc, MAIL_STRUCT_LENGTH
call AddNTimes
ld a, [hl]
ld [CurItem], a
jp CloseSRAM
; 0x448d2
.AttachMail ; 0x448d2
call FadeToMenu
xor a
ld [PartyMenuActionText], a
call ClearBGPalettes
.try_again
callba Function5004f
callba Function50405
callba Function503e0
callba WritePartyMenuTilemap
callba PrintPartyMenuText
call WaitBGMap
call SetPalettes
call DelayFrame
callba PartyMenuSelect
jr c, .exit2
ld a, [CurPartySpecies]
cp EGG
jr z, .egg
ld a, MON_ITEM
call GetPartyParamLocation
ld a, [hl]
and a
jr z, .attach_mail
ld hl, .HoldingMailText
call PrintText
jr .try_again
.egg
ld hl, .EggText
call PrintText
jr .try_again
.attach_mail
ld a, [MenuSelection]
dec a
ld b, a
call MoveMailFromPCToParty
ld hl, .MailMovedText
call PrintText
.exit2
jp ReturnToCallingMenu
; 0x4493c
.HoldingMailText ; 0x4493c
text_jump MailAlreadyHoldingItemText
db "@"
.EggText ; 0x44941
text_jump MailEggText
db "@"
.MailMovedText ; 0x44946
text_jump MailMovedFromBoxText
db "@"
.Cancel
ret
MenuData4494c: ; 0x4494c
db %01000000 ; flags
db 1, 8 ; start coords
db $a, $12 ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2
db %00010000 ; flags
db 4, 0 ; rows/columns?
db 1 ; horizontal spacing?
dbw 0,wd0f2 ; text pointer
dba Function447fb
dbw 0,0
dbw 0,0
MenuData44964: ; 0x44964
db %01000000 ; flags
db 0, 0 ; start coords
db 9, $d ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2
db %10000000 ; flags
db 4 ; items
db "READ MAIL@"
db "PUT IN PACK@"
db "ATTACH MAIL@"
db "CANCEL@"

View File

@ -2341,7 +2341,7 @@ Script_checkpokeitem: ; 977b7
ld d, a
ld a, [ScriptBank]
ld b, a
callba Function44654
callba CheckPokeItem
ret
; 977ca

427
main.asm
View File

@ -11329,39 +11329,39 @@ Function140ed:: ; 140ed
ld a, [StringBuffer2 + 3]
sub [hl]
dec hl
jr nc, .asm_14102
jr nc, .okay_secs
add 60
.asm_14102
.okay_secs
ld [de], a
dec de
ld a, [StringBuffer2 + 2]
sbc [hl]
dec hl
jr nc, .asm_1410d
jr nc, .okay_mins
add 60
.asm_1410d
.okay_mins
ld [de], a
dec de
ld a, [StringBuffer2 + 1]
sbc [hl]
dec hl
jr nc, .asm_14118
jr nc, .okay_hrs
add 24
.asm_14118
.okay_hrs
ld [de], a
dec de
ld a, [StringBuffer2]
sbc [hl]
dec hl
jr nc, .asm_14128
jr nc, .okay_days
add 140
ld c, 7
call SimpleDivide
.asm_14128
.okay_days
ld [de], a
ret
; 1412a
@ -11371,16 +11371,16 @@ INCLUDE "engine/overworld.asm"
Function1499a:: ; 1499a
ld a, [PlayerNextTile]
cp $60
jr z, .asm_149ad
jr z, .warp
cp $68
jr z, .asm_149ad
jr z, .warp
and $f0
cp $70
jr z, .asm_149ad
jr z, .warp
and a
ret
.asm_149ad
.warp
scf
ret
; 149af
@ -11388,17 +11388,17 @@ Function1499a:: ; 1499a
Function149af:: ; 149af
ld a, [PlayerNextTile]
cp $70
jr z, .asm_149c4
jr z, .not_warp
cp $76
jr z, .asm_149c4
jr z, .not_warp
cp $78
jr z, .asm_149c4
jr z, .not_warp
cp $7e
jr z, .asm_149c4
jr z, .not_warp
scf
ret
.asm_149c4
.not_warp
xor a
ret
; 149c6
@ -17959,399 +17959,6 @@ INCLUDE "data/pokedex/entry_pointers.asm"
INCLUDE "engine/mail.asm"
GivePokeItem:: ; 446cc
ld a, [PartyCount]
dec a
push af
push bc
ld hl, PartyMon1Item
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
ld [hl], b
pop af
push bc
push af
ld hl, sPartyMail
ld bc, $2f
call AddNTimes
ld d, h
ld e, l
ld hl, wd002
ld bc, $21
ld a, BANK(sPartyMail)
call GetSRAMBank
call CopyBytes
pop af
push af
ld hl, PartyMonOT
ld bc, NAME_LENGTH
call AddNTimes
ld bc, $a
call CopyBytes
pop af
ld hl, PartyMon1ID
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [hli]
ld [de], a
inc de
ld a, [hl]
ld [de], a
inc de
ld a, [CurPartySpecies]
ld [de], a
inc de
pop bc
ld a, b
ld [de], a
jp CloseSRAM
; 44725
BackupPartyMonMail: ; 44725
ld a, BANK(sPartyMail)
call GetSRAMBank
ld hl, sPartyMail
ld de, sPartyMailBackup
ld bc, 6 * MAIL_STRUCT_LENGTH
call CopyBytes
ld hl, sMailboxCount
ld de, sMailboxCountBackup
ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
call CopyBytes
jp CloseSRAM
; 44745
RestorePartyMonMail: ; 44745 (11:4745)
ld a, BANK(sPartyMail)
call GetSRAMBank
ld hl, sPartyMailBackup
ld de, sPartyMail
ld bc, 6 * MAIL_STRUCT_LENGTH
call CopyBytes
ld hl, sMailboxCountBackup
ld de, sMailboxCount
ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
call CopyBytes
jp CloseSRAM
DeletePartyMonMail: ; 44765 (11:4765)
ld a, BANK(sPartyMail)
call GetSRAMBank
xor a
ld hl, sPartyMail
ld bc, 6 * MAIL_STRUCT_LENGTH
call ByteFill
xor a
ld hl, sMailboxCount
ld bc, 1 + 10 * MAIL_STRUCT_LENGTH
call ByteFill
jp CloseSRAM
; 44781 (11:4781)
Function44781: ; 44781
ld a, [PartyCount]
and a
jr z, .asm_4479e
ld e, a
ld hl, PartyMon1Item
.asm_4478b
ld d, [hl]
push hl
push de
callba ItemIsMail
pop de
pop hl
ret c
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
dec e
jr nz, .asm_4478b
.asm_4479e
and a
ret
; 447a0
_KrisMailBoxMenu: ; 0x447a0
call InitMail
jr z, .nomail
call LoadStandardMenuDataHeader
call Function44806
jp WriteBackup
.nomail
ld hl, .EmptyMailboxText
jp MenuTextBoxBackup
; 0x447b4
.EmptyMailboxText ; 0x447b4
text_jump _EmptyMailboxText
db "@"
InitMail: ; 0x447b9
; initialize wd0f2 and beyond with incrementing values, one per mail
; set z if no mail
ld a, BANK(sMailboxCount)
call GetSRAMBank
ld a, [sMailboxCount]
call CloseSRAM
ld hl, wd0f2
ld [hli], a
and a
jr z, .done ; if no mail, we're done
; load values in memory with incrementing values starting at wd0f2
ld b, a
ld a, $1
.loop
ld [hli], a
inc a
dec b
jr nz, .loop
.done
ld [hl], $ff ; terminate
ld a, [wd0f2]
and a
ret
; 0x447da
Function447da: ; 0x447da
dec a
ld hl, sMailbox + MON_HP - 1
ld bc, MAIL_STRUCT_LENGTH
call AddNTimes
ld a, BANK(sMailboxCount)
call GetSRAMBank
ld de, StringBuffer2
push de
ld bc, NAME_LENGTH - 1
call CopyBytes
ld a, "@"
ld [de], a
call CloseSRAM
pop de
ret
; 0x447fb
Function447fb: ; 0x447fb
push de
ld a, [MenuSelection]
call Function447da
pop hl
jp PlaceString
; 0x44806
Function44806: ; 0x44806
xor a
ld [OBPals + 8 * 6], a
ld a, $1
ld [wd0f1], a
.asm_4480f
call InitMail
ld hl, MenuData4494c
call CopyMenuDataHeader
xor a
ld [hBGMapMode], a
call InitScrollingMenu
call UpdateSprites
ld a, [wd0f1]
ld [wMenuCursorBuffer], a
ld a, [OBPals + 8 * 6]
ld [wd0e4], a
call HandleScrollingMenu
ld a, [wd0e4]
ld [OBPals + 8 * 6], a
ld a, [MenuSelection2]
ld [wd0f1], a
ld a, [wcf73]
cp $2
jr z, .asm_44848
call Function4484a
jr .asm_4480f
.asm_44848
xor a
ret
; 0x4484a
Function4484a: ; 0x4484a
ld hl, MenuData44964
call LoadMenuDataHeader
call InterpretMenu2
call ExitMenu
jr c, .asm_44860
ld a, [MenuSelection2]
dec a
ld hl, .JumpTable
rst JumpTable
.asm_44860
ret
; 0x44861
.JumpTable
dw .ReadMail
dw .PutInPack
dw .AttachMail
dw .Cancel
.ReadMail ; 0x44869
call FadeToMenu
ld a, [MenuSelection]
dec a
ld b, a
call ReadMailMessage
jp ReturnToCallingMenu
; 0x44877
.PutInPack ; 0x44877
ld hl, .MessageLostText
call MenuTextBox
call YesNoBox
call ExitMenu
ret c
ld a, [MenuSelection]
dec a
call .Function448bb
ld a, $1
ld [wItemQuantityChangeBuffer], a
ld hl, NumItems
call ReceiveItem
jr c, .asm_4489e
ld hl, .PackFullText
jp MenuTextBoxBackup
.asm_4489e
ld a, [MenuSelection]
dec a
ld b, a
call Function445c0
ld hl, .PutAwayText
jp MenuTextBoxBackup
; 0x448ac
.PutAwayText ; 0x448ac
text_jump ClearedMailPutAwayText
db "@"
.PackFullText ; 0x448b1
text_jump MailPackFullText
db "@"
.MessageLostText ; 0x448b6
text_jump MailMessageLostText
db "@"
.Function448bb: ; 0x448bb
push af
ld a, BANK(sMailboxCount)
call GetSRAMBank
pop af
ld hl, sMailbox + $2e
ld bc, $2f
call AddNTimes
ld a, [hl]
ld [CurItem], a
jp CloseSRAM
; 0x448d2
.AttachMail ; 0x448d2
call FadeToMenu
xor a
ld [PartyMenuActionText], a
call ClearBGPalettes
.try_again
callba Function5004f
callba Function50405
callba Function503e0
callba WritePartyMenuTilemap
callba PrintPartyMenuText
call WaitBGMap
call SetPalettes
call DelayFrame
callba PartyMenuSelect
jr c, .exit
ld a, [CurPartySpecies]
cp EGG
jr z, .egg
ld a, MON_ITEM
call GetPartyParamLocation
ld a, [hl]
and a
jr z, .attach_mail
ld hl, .HoldingMailText
call PrintText
jr .try_again
.egg
ld hl, .EggText
call PrintText
jr .try_again
.attach_mail
ld a, [MenuSelection]
dec a
ld b, a
call Function44607
ld hl, .MailMovedText
call PrintText
.exit
jp ReturnToCallingMenu
; 0x4493c
.HoldingMailText ; 0x4493c
text_jump MailAlreadyHoldingItemText
db "@"
.EggText ; 0x44941
text_jump MailEggText
db "@"
.MailMovedText ; 0x44946
text_jump MailMovedFromBoxText
db "@"
.Cancel
ret
MenuData4494c: ; 0x4494c
db %01000000 ; flags
db 1, 8 ; start coords
db $a, $12 ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2
db %00010000 ; flags
db 4, 0 ; rows/columns?
db 1 ; horizontal spacing?
dbw 0,wd0f2 ; text pointer
dba Function447fb
dbw 0,0
dbw 0,0
MenuData44964: ; 0x44964
db %01000000 ; flags
db 0, 0 ; start coords
db 9, $d ; end coords
dw .MenuData2
db 1 ; default option
.MenuData2
db %10000000 ; flags
db 4 ; items
db "READ MAIL@"
db "PUT IN PACK@"
db "ATTACH MAIL@"
db "CANCEL@"
SECTION "bank12", ROMX, BANK[$12]
Function48000: ; 48000

View File

@ -198,7 +198,7 @@ AzaleaTownMartSign:
jumpstd martsign
WhiteApricornTree:
fruittree $14
fruittree FRUITTREE_AZALEA_TOWN
MapAzaleaTownSignpostItem8:
dwb EVENT_AZALEA_TOWN_HIDDEN_FULL_HEAL, FULL_HEAL

View File

@ -46,7 +46,7 @@ FuchsiaCityMartSign:
jumpstd martsign
FruitTreeScript_0x194b43:
fruittree $1e
fruittree FRUITTREE_FUCHSIA_CITY
UnknownText_0x194b45:
text "One of the ELITE"

View File

@ -58,10 +58,10 @@ PewterCityMartSign:
jumpstd martsign
FruitTreeScript_0x18c03e:
fruittree $1c
fruittree FRUITTREE_PEWTER_CITY_1
FruitTreeScript_0x18c040:
fruittree $1d
fruittree FRUITTREE_PEWTER_CITY_2
UnknownText_0x18c042:
text "Have you visited"

View File

@ -31,7 +31,7 @@ MapRoute1Signpost0Script:
jumptext UnknownText_0x1ac675
FruitTreeScript_0x1ac581:
fruittree $1a
fruittree FRUITTREE_ROUTE_1
SchoolboyDannySeenText:
text "If trainers meet,"

View File

@ -53,7 +53,7 @@ MapRoute11Signpost0Script:
jumptext UnknownText_0x68238
FruitTreeScript_0x68055:
fruittree $18
fruittree FRUITTREE_ROUTE_11
MapRoute11SignpostItem1:
dwb EVENT_ROUTE_11_HIDDEN_REVIVE, REVIVE

View File

@ -57,7 +57,7 @@ ItemFragment_0x1ac304:
db ELIXER, 1
FruitTreeScript_0x1ac306:
fruittree $19
fruittree FRUITTREE_ROUTE_2
MapRoute2SignpostItem2:
dwb EVENT_ROUTE_2_HIDDEN_MAX_ETHER, MAX_ETHER

View File

@ -239,7 +239,7 @@ MapRoute26Signpost0Script:
jumptext UnknownText_0x1a5364
FruitTreeScript_0x1a4ec2:
fruittree $e
fruittree FRUITTREE_ROUTE_26
ItemFragment_0x1a4ec4:
db MAX_ELIXER, 1

View File

@ -204,7 +204,7 @@ MapRoute29Signpost1Script:
jumptext UnknownText_0x1a15b9
FruitTreeScript_0x1a1089:
fruittree $1
fruittree FRUITTREE_ROUTE_29
ItemFragment_0x1a108b:
db POTION, 1

View File

@ -229,10 +229,10 @@ ItemFragment_0x1a17f5:
db ANTIDOTE, 1
FruitTreeScript_0x1a17f7:
fruittree $2
fruittree FRUITTREE_ROUTE_30_1
FruitTreeScript_0x1a17f9:
fruittree $5
fruittree FRUITTREE_ROUTE_30_2
MapRoute30SignpostItem4:
dwb EVENT_ROUTE_30_HIDDEN_POTION, POTION

View File

@ -7,14 +7,14 @@ Route31_MapScriptHeader:
; callbacks
dbw 5, UnknownScript_0x1a543c
dbw 5, .CheckMomCall
UnknownScript_0x1a543c:
.CheckMomCall:
checkevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST
iffalse UnknownScript_0x1a5443
iffalse .DoMomCall
return
UnknownScript_0x1a5443:
.DoMomCall:
specialphonecall SPECIALCALL_WORRIED
return
@ -26,31 +26,31 @@ Bug_catcherWade1Script:
talkaftercancel
loadfont
checkflag ENGINE_WADE
iftrue UnknownScript_0x1a5493
iftrue .WadeRematch
checkflag ENGINE_WADE_HAS_ITEM
iftrue UnknownScript_0x1a5507
iftrue .WadeItem
checkcellnum PHONE_BUG_CATCHER_WADE
iftrue UnknownScript_0x1a5558
iftrue .AcceptedNumberSTD
checkevent EVENT_WADE_ASKED_FOR_PHONE_NUMBER
iftrue UnknownScript_0x1a547c
iftrue .AskAgain
writetext UnknownText_0x1a5671
closetext
setevent EVENT_WADE_ASKED_FOR_PHONE_NUMBER
scall UnknownScript_0x1a554c
jump UnknownScript_0x1a547f
scall .AskPhoneNumberSTD
jump .Continue
UnknownScript_0x1a547c:
scall UnknownScript_0x1a5550
UnknownScript_0x1a547f:
.AskAgain:
scall .AskAgainSTD
.Continue:
askforphonenumber PHONE_BUG_CATCHER_WADE
if_equal $1, UnknownScript_0x1a5560
if_equal $2, UnknownScript_0x1a555c
if_equal $1, .PhoneFullSTD
if_equal $2, .DeclinedNumberSTD
trainertotext BUG_CATCHER, WADE1, $0
scall UnknownScript_0x1a5554
jump UnknownScript_0x1a5558
scall .RegisterNumberSTD
jump .AcceptedNumberSTD
UnknownScript_0x1a5493:
scall UnknownScript_0x1a5564
.WadeRematch:
scall .RematchSTD
winlosstext Bug_catcherWade1BeatenText, 0
copybytetovar wWadeFightCount
if_equal 4, .Fight4
@ -109,8 +109,8 @@ UnknownScript_0x1a5493:
clearflag ENGINE_WADE
end
UnknownScript_0x1a5507:
scall UnknownScript_0x1a5568
.WadeItem:
scall .ItemSTD
checkevent EVENT_WADE_HAS_BERRY
iftrue .Berry
checkevent EVENT_WADE_HAS_PSNCUREBERRY
@ -136,43 +136,43 @@ UnknownScript_0x1a5507:
iffalse .PackFull
.Done
clearflag ENGINE_WADE_HAS_ITEM
jump UnknownScript_0x1a5558
jump .AcceptedNumberSTD
.PackFull
jump UnknownScript_0x1a556c
jump .PackFullSTD
UnknownScript_0x1a554c:
.AskPhoneNumberSTD:
jumpstd asknumber1m
end
UnknownScript_0x1a5550:
.AskAgainSTD:
jumpstd asknumber2m
end
UnknownScript_0x1a5554:
.RegisterNumberSTD:
jumpstd registerednumberm
end
UnknownScript_0x1a5558:
.AcceptedNumberSTD:
jumpstd numberacceptedm
end
UnknownScript_0x1a555c:
.DeclinedNumberSTD:
jumpstd numberdeclinedm
end
UnknownScript_0x1a5560:
.PhoneFullSTD:
jumpstd phonefullm
end
UnknownScript_0x1a5564:
.RematchSTD:
jumpstd rematchm
end
UnknownScript_0x1a5568:
.ItemSTD:
jumpstd giftm
end
UnknownScript_0x1a556c:
.PackFullSTD:
jumpstd packfullm
end
@ -180,64 +180,64 @@ FisherScript_0x1a5570:
faceplayer
loadfont
checkevent EVENT_GOT_TM50_NIGHTMARE
iftrue UnknownScript_0x1a55af
iftrue .DescribeNightmare
checkevent EVENT_GOT_KENYA
iftrue UnknownScript_0x1a5584
iftrue .TryGiveKenya
writetext UnknownText_0x1a56d9
closetext
loadmovesprites
end
UnknownScript_0x1a5584:
.TryGiveKenya:
writetext UnknownText_0x1a5761
keeptextopen
checkpokeitem ReceivedSpearowMailText
if_equal $0, UnknownScript_0x1a55b5
if_equal $2, UnknownScript_0x1a55c1
if_equal $3, UnknownScript_0x1a55bb
if_equal $4, UnknownScript_0x1a55c7
if_equal $0, .WrongMail
if_equal $2, .Refused
if_equal $3, .NoMail
if_equal $4, .LastMon
writetext UnknownText_0x1a5790
keeptextopen
writetext UnknownText_0x1a57ba
keeptextopen
setevent EVENT_GAVE_KENYA
verbosegiveitem TM_NIGHTMARE
iffalse UnknownScript_0x1a55b3
iffalse .NoRoomForItems
setevent EVENT_GOT_TM50_NIGHTMARE
UnknownScript_0x1a55af:
.DescribeNightmare:
writetext UnknownText_0x1a5896
closetext
UnknownScript_0x1a55b3:
.NoRoomForItems:
loadmovesprites
end
UnknownScript_0x1a55b5:
.WrongMail:
writetext UnknownText_0x1a5921
closetext
loadmovesprites
end
UnknownScript_0x1a55bb:
.NoMail:
writetext UnknownText_0x1a5939
closetext
loadmovesprites
end
UnknownScript_0x1a55c1:
.Refused:
writetext UnknownText_0x1a5972
closetext
loadmovesprites
end
UnknownScript_0x1a55c7:
.LastMon:
writetext UnknownText_0x1a5991
closetext
loadmovesprites
end
ReceivedSpearowMailText:
db "DARK CAVE leads", $4E
db "to another road@"
db "DARK CAVE leads"
next "to another road@"
YoungsterScript_0x1a55ed:
jumptextfaceplayer UnknownText_0x1a59d5
@ -252,7 +252,7 @@ CooltrainerMScript_0x1a55f6:
jumptextfaceplayer UnknownText_0x1a55ff
FruitTreeScript_0x1a55f9:
fruittree $7
fruittree FRUITTREE_ROUTE_31
ItemFragment_0x1a55fb:
db POTION, 1

View File

@ -137,7 +137,7 @@ MapRoute33Signpost0Script:
jumptext UnknownText_0x1ac279
FruitTreeScript_0x1ac0ea:
fruittree $6
fruittree FRUITTREE_ROUTE_33
HikerAnthony2SeenText:
text "I came through the"

View File

@ -261,7 +261,7 @@ ItemFragment_0x19ca7c:
db TM_ROLLOUT, 1
FruitTreeScript_0x19ca7e:
fruittree $b
fruittree FRUITTREE_ROUTE_35
CamperIvanSeenText:
text "I've been getting"

View File

@ -359,7 +359,7 @@ MapRoute36Signpost0Script:
jumptext UnknownText_0x1949ee
FruitTreeScript_0x194247:
fruittree $d
fruittree FRUITTREE_ROUTE_36
MovementData_0x194249:
db $56 ; movement

View File

@ -99,13 +99,13 @@ MapRoute37Signpost0Script:
jumptext UnknownText_0x1a9197
FruitTreeScript_0x1a8e09:
fruittree $11
fruittree FRUITTREE_ROUTE_37_1
FruitTreeScript_0x1a8e0b:
fruittree $12
fruittree FRUITTREE_ROUTE_37_2
FruitTreeScript_0x1a8e0d:
fruittree $13
fruittree FRUITTREE_ROUTE_37_3
MapRoute37SignpostItem1:
dwb EVENT_ROUTE_37_HIDDEN_ETHER, ETHER

View File

@ -311,7 +311,7 @@ MapRoute38Signpost1Script:
jumptext UnknownText_0x1a2324
FruitTreeScript_0x1a1f33:
fruittree $3
fruittree FRUITTREE_ROUTE_38
Bird_keeperTobySeenText:
text "Fly high into the"

View File

@ -165,7 +165,7 @@ MapRoute39Signpost0Script:
jumptext UnknownText_0x1a6036
FruitTreeScript_0x1a5bf4:
fruittree $f
fruittree FRUITTREE_ROUTE_39
MapRoute39SignpostItem3:
dwb EVENT_ROUTE_39_HIDDEN_NUGGET, NUGGET

View File

@ -194,13 +194,13 @@ ItemFragment_0x1a934b:
db SUPER_POTION, 1
FruitTreeScript_0x1a934d:
fruittree $15
fruittree FRUITTREE_ROUTE_42_1
FruitTreeScript_0x1a934f:
fruittree $16
fruittree FRUITTREE_ROUTE_42_2
FruitTreeScript_0x1a9351:
fruittree $17
fruittree FRUITTREE_ROUTE_42_3
MapRoute42SignpostItem4:
dwb EVENT_ROUTE_42_HIDDEN_MAX_POTION, MAX_POTION

View File

@ -312,7 +312,7 @@ MapRoute43Signpost2Script:
jumptext UnknownText_0x19d6c9
FruitTreeScript_0x19d266:
fruittree $8
fruittree FRUITTREE_ROUTE_43
ItemFragment_0x19d268:
db MAX_ETHER, 1

View File

@ -293,7 +293,7 @@ MapRoute44Signpost1Script:
jumptext UnknownText_0x19dfcc
FruitTreeScript_0x19da40:
fruittree $10
fruittree FRUITTREE_ROUTE_44
ItemFragment_0x19da42:
db MAX_REVIVE, 1

View File

@ -282,7 +282,7 @@ MapRoute45Signpost0Script:
jumptext UnknownText_0x19e8fe
FruitTreeScript_0x19e294:
fruittree $c
fruittree FRUITTREE_ROUTE_45
ItemFragment_0x19e296:
db NUGGET, 1

View File

@ -157,10 +157,10 @@ ItemFragment_0x1a978d:
db X_SPEED, 1
FruitTreeScript_0x1a978f:
fruittree $4
fruittree FRUITTREE_ROUTE_46_1
FruitTreeScript_0x1a9791:
fruittree $a
fruittree FRUITTREE_ROUTE_46_2
HikerBaileySeenText:
text "Awright! I'll show"

View File

@ -67,7 +67,7 @@ MapRoute8Signpost0Script:
jumptext UnknownText_0x6c2b7
FruitTreeScript_0x6c06c:
fruittree $1b
fruittree FRUITTREE_ROUTE_8
BikerDwayneSeenText:
text "We're the KANTO"

View File

@ -87,7 +87,7 @@ ItemFragment_0x1a8423:
db RARE_CANDY, 1
FruitTreeScript_0x1a8425:
fruittree $9
fruittree FRUITTREE_VIOLET_CITY
MapVioletCitySignpostItem6:
dwb EVENT_VIOLET_CITY_HIDDEN_HYPER_POTION, HYPER_POTION

View File

@ -323,99 +323,3 @@ endr
BT_ChrisName: ; 170426
db "CHRIS@"
; 17042c
Function17042c: ; 17042c
ld hl, BT_TrainerTextIndex + $be
ld a, 7
.loop
push af
push hl
ld c, 18
.loop2
ld a, [hli]
ld b, a
ld a, [hli]
and a
jr z, .skip
cp $f
jr nc, .exit_inner_loop
push hl
ld hl, Unknown_170470
dec a
ld e, a
ld d, 0
add hl, de
ld a, [hl]
pop hl
cp b
jr c, .exit_inner_loop
jr z, .exit_inner_loop
jr .asm_170456
.skip
ld a, b
cp $fc
jr nc, .exit_inner_loop
.asm_170456
dec c
jr nz, .loop2
jr .dont_copy
.exit_inner_loop
pop de
push de
ld hl, Unknown_17047e
ld bc, BATTLETOWER_TRAINERDATALENGTH
call CopyBytes
.dont_copy
pop hl
ld de, $00e0
add hl, de
pop af
dec a
jr nz, .loop
ret
; 170470
Unknown_170470:
db $12, $24, $45, $45, $42, $42, $45, $42, $27, $27, $45, $27, $42, $24
Unknown_17047e:
db $03, $04, $05, $08
db $03, $05, $0e, $06
db $03, $02, $00, $00
db $39, $07, $07, $04
db $00, $05, $04, $07
db $01, $05, $00, $00
db $0f, $05, $14, $07
db $05, $05, $11, $0c
db $0c, $06, $06, $04
CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2
; copy the BattleTower-Trainer data that lies at 'BT_OTTrainer' to 'wBT_OTTemp'
ld a, [rSVBK]
push af
ld a, $3 ; BANK(BT_OTTrainer)
ld [rSVBK], a
ld hl, BT_OTTrainer ; $d100
ld de, wBT_OTTemp ; $c608
ld bc, BATTLE_TOWER_STRUCT_LENGTH
call CopyBytes
pop af
ld [rSVBK], a
ld a, BANK(sSaveType)
call GetSRAMBank
ld a, $2
ld [sSaveType], a
ld hl, sNrOfBeatenBattleTowerTrainers
inc [hl]
call CloseSRAM
SkipBattleTowerTrainer: ; 1704c9
ret
; 1704ca

View File

@ -90,6 +90,7 @@ Function1700c4: ; 1700c4
push af
ld a, $3
ld [rSVBK], a
call Function17042c
ld a, $5
call GetSRAMBank
@ -244,15 +245,113 @@ Function17020c: ; 17020c
inc de
and a
ret z
.asm_170210
.loop
add hl, bc
dec a
jr nz, .asm_170210
jr nz, .loop
ret
; 170215
INCLUDE "misc/battle_tower_5c.asm"
Function17042c: ; 17042c
ld hl, w3_d2be
ld a, 7
.loop
push af
push hl
ld c, 18
.loop2
ld a, [hli]
ld b, a
ld a, [hli]
and a
jr z, .empty
cp $f
jr nc, .exit_inner_loop
push hl
ld hl, Unknown_170470
dec a
ld e, a
ld d, 0
add hl, de
ld a, [hl]
pop hl
cp b
jr c, .exit_inner_loop
jr z, .exit_inner_loop
jr .next_iteration
.empty
ld a, b
cp $fc
jr nc, .exit_inner_loop
.next_iteration
dec c
jr nz, .loop2
jr .dont_copy
.exit_inner_loop
pop de
push de
ld hl, Unknown_17047e
ld bc, BATTLETOWER_TRAINERDATALENGTH
call CopyBytes
.dont_copy
pop hl
ld de, $00e0
add hl, de
pop af
dec a
jr nz, .loop
ret
; 170470
Unknown_170470:
db $12, $24, $45, $45, $42, $42, $45, $42, $27, $27, $45, $27, $42, $24
Unknown_17047e:
db $03, $04, $05, $08
db $03, $05, $0e, $06
db $03, $02, $00, $00
db $39, $07, $07, $04
db $00, $05, $04, $07
db $01, $05, $00, $00
db $0f, $05, $14, $07
db $05, $05, $11, $0c
db $0c, $06, $06, $04
CopyBTTrainer_FromBT_OT_TowBT_OTTemp: ; 1704a2
; copy the BattleTower-Trainer data that lies at 'BT_OTTrainer' to 'wBT_OTTemp'
ld a, [rSVBK]
push af
ld a, $3 ; BANK(BT_OTTrainer)
ld [rSVBK], a
ld hl, BT_OTTrainer ; $d100
ld de, wBT_OTTemp ; $c608
ld bc, BATTLE_TOWER_STRUCT_LENGTH
call CopyBytes
pop af
ld [rSVBK], a
ld a, BANK(sSaveType)
call GetSRAMBank
ld a, $2
ld [sSaveType], a
ld hl, sNrOfBeatenBattleTowerTrainers
inc [hl]
call CloseSRAM
SkipBattleTowerTrainer: ; 1704c9
ret
; 1704ca
Function1704ca: ; 1704ca
ld a, [$be46]
cp $7

View File

@ -10,9 +10,10 @@ sScratch::
SECTION "SRAM Bank 0", SRAM [$a600], BANK [0]
mailmsg: MACRO
\1Message:: ds $20
\1Message:: ds MAIL_MSG_LENGTH
\1MessageEnd:: ds 1
\1Author:: ds NAME_LENGTH
ds 3
\1AuthorID:: ds 2
\1MailType:: ds 1
endm
; a600

View File

@ -2881,8 +2881,11 @@ w3_d100:: ; BattleTower OpponentTrainer-Data (length = 0xe0 = $a + $1 + 3*$3b +
BT_OTTrainer:: battle_tower_struct BT_OT
; d1e0
ds $20
; d200
BT_TrainerTextIndex::
ds $600
ds $be
w3_d2be::
ds $542
wBTChoiceOfLvlGroup::
w3_d800:: ds $400