mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
IsMailEuropean → ParseMailLanguage (and give it constants)
This commit is contained in:
parent
1674b6ca5a
commit
a6ac67dea2
@ -59,6 +59,14 @@ DEF MAILBOX_CAPACITY EQU 10
|
|||||||
DEF MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct
|
DEF MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct
|
||||||
DEF MAIL_STRUCT_LENGTH_JP EQU $2a ; mailmsg_jp struct
|
DEF MAIL_STRUCT_LENGTH_JP EQU $2a ; mailmsg_jp struct
|
||||||
|
|
||||||
|
; mail languages
|
||||||
|
const_def
|
||||||
|
const MAIL_LANG_ENGLISH
|
||||||
|
const MAIL_LANG_FRENCH
|
||||||
|
const MAIL_LANG_GERMAN
|
||||||
|
const MAIL_LANG_ITALIAN
|
||||||
|
const MAIL_LANG_SPANISH
|
||||||
|
|
||||||
; held item effects
|
; held item effects
|
||||||
const_def
|
const_def
|
||||||
const HELD_NONE
|
const HELD_NONE
|
||||||
|
@ -30,15 +30,16 @@ DEF SERIAL_PATCH_LIST_PART_TERMINATOR EQU $ff
|
|||||||
; used to replace SERIAL_NO_DATA_BYTE
|
; used to replace SERIAL_NO_DATA_BYTE
|
||||||
DEF SERIAL_PATCH_REPLACEMENT_BYTE EQU $ff
|
DEF SERIAL_PATCH_REPLACEMENT_BYTE EQU $ff
|
||||||
|
|
||||||
DEF SERIAL_PREAMBLE_LENGTH EQU 6
|
DEF SERIAL_PREAMBLE_LENGTH EQU 6
|
||||||
DEF SERIAL_RN_PREAMBLE_LENGTH EQU 7
|
DEF SERIAL_RN_PREAMBLE_LENGTH EQU 7
|
||||||
DEF SERIAL_RNS_LENGTH EQU 10
|
DEF SERIAL_RNS_LENGTH EQU 10
|
||||||
|
|
||||||
DEF SERIAL_MAIL_PREAMBLE_BYTE EQU $20
|
DEF SERIAL_MAIL_PREAMBLE_BYTE EQU $20
|
||||||
DEF SERIAL_MAIL_REPLACEMENT_BYTE EQU $21
|
DEF SERIAL_MAIL_PREAMBLE_LENGTH EQU 5
|
||||||
DEF SERIAL_MAIL_PREAMBLE_LENGTH EQU 5
|
; used to replace SERIAL_NO_DATA_BYTE
|
||||||
|
DEF SERIAL_MAIL_REPLACEMENT_BYTE EQU $21
|
||||||
|
|
||||||
; timeout duration after exchanging a byte
|
; timeout duration after exchanging a byte
|
||||||
DEF SERIAL_LINK_BYTE_TIMEOUT EQU $5000
|
DEF SERIAL_LINK_BYTE_TIMEOUT EQU $5000
|
||||||
|
|
||||||
DEF MAX_MYSTERY_GIFT_PARTNERS EQU 5
|
DEF MAX_MYSTERY_GIFT_PARTNERS EQU 5
|
||||||
|
@ -406,7 +406,7 @@ endc
|
|||||||
.fix_mail_loop
|
.fix_mail_loop
|
||||||
push bc
|
push bc
|
||||||
push de
|
push de
|
||||||
farcall IsMailEuropean
|
farcall ParseMailLanguage
|
||||||
ld a, c
|
ld a, c
|
||||||
or a
|
or a
|
||||||
jr z, .next
|
jr z, .next
|
||||||
@ -893,7 +893,7 @@ Link_PrepPartyData_Gen2:
|
|||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
; Fill 5 bytes at wLinkPlayerMailPreamble with $20
|
; Fill 5 bytes at wLinkPlayerMailPreamble with $20
|
||||||
ld de, wLinkPlayerMailPreamble
|
ld de, wLinkPlayerMail
|
||||||
ld a, SERIAL_MAIL_PREAMBLE_BYTE
|
ld a, SERIAL_MAIL_PREAMBLE_BYTE
|
||||||
call Link_CopyMailPreamble
|
call Link_CopyMailPreamble
|
||||||
|
|
||||||
@ -911,6 +911,7 @@ Link_PrepPartyData_Gen2:
|
|||||||
pop bc
|
pop bc
|
||||||
dec b
|
dec b
|
||||||
jr nz, .loop2
|
jr nz, .loop2
|
||||||
|
|
||||||
; Copy the mail data to wLinkPlayerMailMetadata
|
; Copy the mail data to wLinkPlayerMailMetadata
|
||||||
ld hl, sPartyMail
|
ld hl, sPartyMail
|
||||||
ld b, PARTY_LENGTH
|
ld b, PARTY_LENGTH
|
||||||
@ -923,6 +924,8 @@ Link_PrepPartyData_Gen2:
|
|||||||
pop bc
|
pop bc
|
||||||
dec b
|
dec b
|
||||||
jr nz, .loop3
|
jr nz, .loop3
|
||||||
|
|
||||||
|
; Translate the messages if necessary
|
||||||
ld b, PARTY_LENGTH
|
ld b, PARTY_LENGTH
|
||||||
ld de, sPartyMail
|
ld de, sPartyMail
|
||||||
ld hl, wLinkPlayerMailMessages
|
ld hl, wLinkPlayerMailMessages
|
||||||
@ -931,17 +934,17 @@ Link_PrepPartyData_Gen2:
|
|||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
push hl
|
push hl
|
||||||
farcall IsMailEuropean
|
farcall ParseMailLanguage
|
||||||
pop de
|
pop de
|
||||||
ld a, c
|
ld a, c
|
||||||
or a
|
or a ; MAIL_LANG_ENGLISH
|
||||||
jr z, .next
|
jr z, .next
|
||||||
sub $3
|
sub MAIL_LANG_ITALIAN
|
||||||
jr nc, .italian_spanish
|
jr nc, .italian_spanish
|
||||||
farcall ConvertFrenchGermanMailToEnglish
|
farcall ConvertFrenchGermanMailToEnglish
|
||||||
jr .next
|
jr .next
|
||||||
.italian_spanish
|
.italian_spanish
|
||||||
cp $2
|
cp (MAIL_LANG_SPANISH + 1) - MAIL_LANG_ITALIAN
|
||||||
jr nc, .next
|
jr nc, .next
|
||||||
farcall ConvertSpanishItalianMailToEnglish
|
farcall ConvertSpanishItalianMailToEnglish
|
||||||
.next
|
.next
|
||||||
@ -958,6 +961,7 @@ Link_PrepPartyData_Gen2:
|
|||||||
jr nz, .loop4
|
jr nz, .loop4
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
|
|
||||||
|
; The SERIAL_NO_DATA_BYTE value isn't allowed anywhere in message text
|
||||||
ld hl, wLinkPlayerMailMessages
|
ld hl, wLinkPlayerMailMessages
|
||||||
ld bc, (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
ld bc, (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||||
.loop5
|
.loop5
|
||||||
@ -972,6 +976,7 @@ Link_PrepPartyData_Gen2:
|
|||||||
or c
|
or c
|
||||||
jr nz, .loop5
|
jr nz, .loop5
|
||||||
|
|
||||||
|
; Calculate the patch offsets for the mail metadata
|
||||||
ld hl, wLinkPlayerMailMetadata
|
ld hl, wLinkPlayerMailMetadata
|
||||||
ld de, wLinkPlayerMailPatchSet
|
ld de, wLinkPlayerMailPatchSet
|
||||||
ld b, (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
ld b, (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
||||||
|
@ -1,29 +1,24 @@
|
|||||||
IsMailEuropean:
|
ParseMailLanguage:
|
||||||
; return 1 if French
|
ld c, MAIL_LANG_ENGLISH
|
||||||
; return 2 if German
|
|
||||||
; return 3 if Italian
|
|
||||||
; return 4 if Spanish
|
|
||||||
; return 0 if none of the above
|
|
||||||
ld c, $0
|
|
||||||
ld hl, sPartyMon1MailNationality - sPartyMon1Mail
|
ld hl, sPartyMon1MailNationality - sPartyMon1Mail
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
cp "E"
|
cp "E"
|
||||||
ret nz
|
ret nz
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
inc c
|
inc c ; MAIL_LANG_FRENCH
|
||||||
cp "F"
|
cp "F"
|
||||||
ret z
|
ret z
|
||||||
inc c
|
inc c ; MAIL_LANG_GERMAN
|
||||||
cp "G"
|
cp "G"
|
||||||
ret z
|
ret z
|
||||||
inc c
|
inc c ; MAIL_LANG_ITALIAN
|
||||||
cp "I"
|
cp "I"
|
||||||
ret z
|
ret z
|
||||||
inc c
|
inc c ; MAIL_LANG_SPANISH
|
||||||
cp "S"
|
cp "S"
|
||||||
ret z
|
ret z
|
||||||
ld c, $0
|
ld c, MAIL_LANG_ENGLISH
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; The regular font.
|
; The regular font.
|
||||||
|
@ -31,14 +31,14 @@ ReadAnyMail:
|
|||||||
push de
|
push de
|
||||||
ld a, BANK(sPartyMail)
|
ld a, BANK(sPartyMail)
|
||||||
call OpenSRAM
|
call OpenSRAM
|
||||||
farcall IsMailEuropean
|
farcall ParseMailLanguage
|
||||||
call CloseSRAM
|
call CloseSRAM
|
||||||
ld a, c
|
ld a, c
|
||||||
ld de, StandardEnglishFont
|
ld de, StandardEnglishFont
|
||||||
or a
|
or a ; MAIL_LANG_ENGLISH
|
||||||
jr z, .got_font
|
jr z, .got_font
|
||||||
ld de, FrenchGermanFont
|
ld de, FrenchGermanFont
|
||||||
sub $3
|
sub MAIL_LANG_ITALIAN
|
||||||
jr c, .got_font
|
jr c, .got_font
|
||||||
ld de, SpanishItalianFont
|
ld de, SpanishItalianFont
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user