Foreign language font handling in mail

This commit is contained in:
PikalaxALT 2015-11-22 12:01:58 -05:00
parent 23c70110d0
commit 24b7b2c1cf
9 changed files with 139 additions and 92 deletions

View File

@ -275,7 +275,7 @@ DoBikeStep:: ; 97db3
; if we've already gotten the call, we don't have to ; if we've already gotten the call, we don't have to
; be here. ; be here.
ld hl, StatusFlags2 ld hl, StatusFlags2
bit 4, [hl] bit 4, [hl] ; bike shop call
jr z, .NoCall jr z, .NoCall
; If we're not on the bike, we don't have to be here. ; If we're not on the bike, we don't have to be here.
@ -326,7 +326,7 @@ DoBikeStep:: ; 97db3
xor a xor a
ld [wSpecialPhoneCallID + 1], a ld [wSpecialPhoneCallID + 1], a
ld hl, StatusFlags2 ld hl, StatusFlags2
res 4, [hl] res 4, [hl] ; bike shop call
scf scf
ret ret

View File

@ -363,23 +363,23 @@ Function28177: ; 28177
.asm_282cc .asm_282cc
push bc push bc
push de push de
callba Function1de5c8 callba IsMailEuropean
ld a, c ld a, c
or a or a
jr z, .asm_282ee jr z, .next
sub $3 sub $3
jr nc, .asm_282e4 jr nc, .skip
callba Function1df203 callba DeutenEnglischenPost
jr .asm_282ee jr .next
.asm_282e4 .skip
cp $2 cp $2
jr nc, .asm_282ee jr nc, .next
callba Function1df220 callba HandleSpanishItalianMail
.asm_282ee .next
pop de pop de
ld hl, $2f ld hl, MAIL_STRUCT_LENGTH
add hl, de add hl, de
ld d, h ld d, h
ld e, l ld e, l
@ -802,62 +802,77 @@ Function284f6: ; 284f6
; 28595 ; 28595
Function28595: ; 28595 Function28595: ; 28595
ld de, OverworldMap ld de, wc800
ld a, $fd ld a, EGG
ld b, $6 ld b, PARTY_LENGTH
.loop1 .loop1
ld [de], a ld [de], a
inc de inc de
dec b dec b
jr nz, .loop1 jr nz, .loop1
; de = $c806
ld hl, PlayerName ld hl, PlayerName
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyBytes call CopyBytes
; de = $c811
ld hl, PartyCount ld hl, PartyCount
ld bc, 8 ld bc, 1 + PARTY_LENGTH + 1
call CopyBytes call CopyBytes
; de = $c819
ld hl, PlayerID ld hl, PlayerID
ld bc, 2 ld bc, 2
call CopyBytes call CopyBytes
; de = $c81b
ld hl, PartyMon1Species ld hl, PartyMon1Species
ld bc, $120 ld bc, PARTY_LENGTH * PARTYMON_STRUCT_LENGTH
call CopyBytes call CopyBytes
; de = $c93b
ld hl, PartyMonOT ld hl, PartyMonOT
ld bc, $42 ld bc, PARTY_LENGTH * NAME_LENGTH
call CopyBytes call CopyBytes
; de = $c97d
ld hl, PartyMonNicknames ld hl, PartyMonNicknames
ld bc, $42 ld bc, PARTY_LENGTH * PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
; de = $c9bf
; Okay, we did all that. Now, are we in the trade center?
ld a, [wLinkMode] ld a, [wLinkMode]
cp LINK_TRADECENTER cp LINK_TRADECENTER
ret nz ret nz
; Fill 32 bytes at wc9f4 with $05
ld de, wc9f4 ld de, wc9f4
ld a, $20 ld a, $20
call Function28682 call Function28682
; Copy all the mail messages to $ca14
ld a, BANK(sPartyMail) ld a, BANK(sPartyMail)
call GetSRAMBank call GetSRAMBank
ld hl, sPartyMail ld hl, sPartyMail
ld b, PARTY_LENGTH ld b, PARTY_LENGTH
.loop2 .loop2
push bc push bc
ld bc, $21 ld bc, MAIL_MSG_LENGTH + 1
call CopyBytes call CopyBytes
ld bc, $e ld bc, MAIL_STRUCT_LENGTH - MAIL_MSG_LENGTH - 1
add hl, bc add hl, bc
pop bc pop bc
dec b dec b
jr nz, .loop2 jr nz, .loop2
; Copy the mail metadata to $cada
ld hl, sPartyMail ld hl, sPartyMail
ld b, PARTY_LENGTH ld b, PARTY_LENGTH
.loop3 .loop3
push bc push bc
ld bc, $21 ld bc, MAIL_MSG_LENGTH + 1
add hl, bc add hl, bc
ld bc, $e ld bc, MAIL_STRUCT_LENGTH - MAIL_MSG_LENGTH - 1
call CopyBytes call CopyBytes
pop bc pop bc
dec b dec b
jr nz, .loop3 jr nz, .loop3
ld b, PARTY_LENGTH ld b, PARTY_LENGTH
ld de, sPartyMail ld de, sPartyMail
ld hl, wc9f9 ld hl, wc9f9
@ -866,20 +881,20 @@ Function28595: ; 28595
push hl push hl
push de push de
push hl push hl
callba Function1de5c8 callba IsMailEuropean
pop de pop de
ld a, c ld a, c
or a or a
jr z, .next jr z, .next
sub $3 sub $3
jr nc, .skip jr nc, .italian_spanish
callba Function1df1e6 callba HandleFrenchGermanMail
jr .next jr .next
.skip .italian_spanish
cp $2 cp $2
jr nc, .next jr nc, .next
callba Function1df220 callba HandleSpanishItalianMail
.next .next
pop de pop de

View File

@ -16,20 +16,20 @@ ReadAnyMail: ; b9237
push de push de
ld a, BANK(sPartyMail) ld a, BANK(sPartyMail)
call GetSRAMBank call GetSRAMBank
callba Function1de5c8 callba IsMailEuropean
call CloseSRAM call CloseSRAM
ld a, c ld a, c
ld de, GFX_1de5e6 ld de, StandardEnglishFont
or a or a
jr z, .asm_b9268 jr z, .asm_b9268
ld de, GFX_1de9e6 ld de, FrenchGermanFont
sub $3 sub $3
jr c, .asm_b9268 jr c, .asm_b9268
ld de, GFX_1dede6 ld de, SpanishItalianFont
.asm_b9268 .asm_b9268
ld hl, VTiles1 ld hl, VTiles1
lb bc, BANK(GFX_1de5e6), $80 lb bc, BANK(StandardEnglishFont), $80
call Get1bpp call Get1bpp
pop de pop de
call Functionb92b8 call Functionb92b8

137
main.asm
View File

@ -175,7 +175,7 @@ LearnMove: ; 6508
ld hl, PartyMonNicknames ld hl, PartyMonNicknames
call GetNick call GetNick
ld hl, StringBuffer1 ld hl, StringBuffer1
ld de, wd050 ld de, wd050_MonNick
ld bc, PKMN_NAME_LENGTH ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
@ -187,6 +187,10 @@ LearnMove: ; 6508
ld d, h ld d, h
ld e, l ld e, l
ld b, NUM_MOVES ld b, NUM_MOVES
; Get the first empty move slot. This routine also serves to
; determine whether the Pokemon learning the moves already has
; all four slots occupied, in which case one would need to be
; deleted.
.next .next
ld a, [hl] ld a, [hl]
and a and a
@ -194,7 +198,8 @@ LearnMove: ; 6508
inc hl inc hl
dec b dec b
jr nz, .next jr nz, .next
; If we're here, we enter the routine for forgetting a move
; to make room for the new move we're trying to learn.
push de push de
call ForgetMove call ForgetMove
pop de pop de
@ -217,7 +222,7 @@ LearnMove: ; 6508
.not_disabled .not_disabled
call GetMoveName call GetMoveName
ld hl, UnknownText_0x6684 ld hl, UnknownText_0x6684 ; 1, 2 and…
call PrintText call PrintText
pop de pop de
pop hl pop hl
@ -268,18 +273,18 @@ LearnMove: ; 6508
jp .learned jp .learned
.cancel .cancel
ld hl, UnknownText_0x6675 ld hl, UnknownText_0x6675 ; Stop learning <MOVE>?
call PrintText call PrintText
call YesNoBox call YesNoBox
jp c, .loop jp c, .loop
ld hl, UnknownText_0x667a ld hl, UnknownText_0x667a ; <MON> did not learn <MOVE>.
call PrintText call PrintText
ld b, 0 ld b, 0
ret ret
.learned .learned
ld hl, UnknownText_0x666b ld hl, UnknownText_0x666b ; <MON> learned <MOVE>!
call PrintText call PrintText
ld b, 1 ld b, 1
ret ret
@ -311,6 +316,7 @@ ForgetMove: ; 65d3
ld a, SCREEN_WIDTH * 2 ld a, SCREEN_WIDTH * 2
ld [Buffer1], a ld [Buffer1], a
predef ListMoves predef ListMoves
; wMenuData3
ld a, $4 ld a, $4
ld [wcfa1], a ld [wcfa1], a
ld a, $6 ld a, $6
@ -368,32 +374,38 @@ ForgetMove: ; 65d3
; 666b ; 666b
UnknownText_0x666b: ; 666b UnknownText_0x666b: ; 666b
; <MON> learned <MOVE>!
text_jump UnknownText_0x1c5660 text_jump UnknownText_0x1c5660
db "@" db "@"
; 6670 ; 6670
UnknownText_0x6670: ; 6670 UnknownText_0x6670: ; 6670
; Which move should be forgotten?
text_jump UnknownText_0x1c5678 text_jump UnknownText_0x1c5678
db "@" db "@"
; 6675 ; 6675
UnknownText_0x6675: ; 6675 UnknownText_0x6675: ; 6675
; Stop learning <MOVE>?
text_jump UnknownText_0x1c5699 text_jump UnknownText_0x1c5699
db "@" db "@"
; 667a ; 667a
UnknownText_0x667a: ; 667a UnknownText_0x667a: ; 667a
; <MON> did not learn <MOVE>.
text_jump UnknownText_0x1c56af text_jump UnknownText_0x1c56af
db "@" db "@"
; 667f ; 667f
UnknownText_0x667f: ; 667f UnknownText_0x667f: ; 667f
; <MON> is trying to learn <MOVE>. But <MON> can't learn more than
; four moves. Delete an older move to make room for <MOVE>?
text_jump UnknownText_0x1c56c9 text_jump UnknownText_0x1c56c9
db "@" db "@"
; 6684 ; 6684
UnknownText_0x6684: ; 6684 UnknownText_0x6684: ; 6684
text_jump UnknownText_0x1c5740 text_jump UnknownText_0x1c5740 ; 1, 2 and…
start_asm start_asm
push de push de
ld de, SFX_SWITCH_POKEMON ld de, SFX_SWITCH_POKEMON
@ -404,11 +416,13 @@ UnknownText_0x6684: ; 6684
; 6695 ; 6695
UnknownText_0x6695: ; 6695 UnknownText_0x6695: ; 6695
; Poof! <MON> forgot <MOVE>. And…
text_jump UnknownText_0x1c574e text_jump UnknownText_0x1c574e
db "@" db "@"
; 669a ; 669a
UnknownText_0x669a: ; 669a UnknownText_0x669a: ; 669a
; HM moves can't be forgotten now.
text_jump UnknownText_0x1c5772 text_jump UnknownText_0x1c5772
db "@" db "@"
; 669f ; 669f
@ -27142,10 +27156,14 @@ PokegearGFX: ; 1de2e4
INCBIN "gfx/misc/pokegear.2bpp.lz" INCBIN "gfx/misc/pokegear.2bpp.lz"
; 1de5c8 ; 1de5c8
Function1de5c8: ; 1de5c8 IsMailEuropean: ; 1de5c8
; reads mail message at de ; return 1 if French
; return 2 if German
; return 3 if Italian
; return 4 if Spanish
; return 0 if none of the above
ld c, $0 ld c, $0
ld hl, $29 ld hl, sPartyMon1MailAuthorNationality - sPartyMon1Mail
add hl, de add hl, de
ld a, [hli] ld a, [hli]
cp "E" cp "E"
@ -27168,92 +27186,107 @@ Function1de5c8: ; 1de5c8
; 1de5e6 ; 1de5e6
; The regular font. ; The regular font.
GFX_1de5e6: ; 1de5e6 StandardEnglishFont: ; 1de5e6
INCBIN "gfx/unknown/1de5e6.2bpp" INCBIN "gfx/font/english.1bpp"
; An extended font. ; An extended font.
GFX_1de9e6: ; 1de9e6 FrenchGermanFont: ; 1de9e6
INCBIN "gfx/unknown/1de9e6.2bpp" INCBIN "gfx/font/french_german.1bpp"
; An even more extended font. ; An even more extended font.
GFX_1dede6: ; 1dede6 SpanishItalianFont: ; 1dede6
INCBIN "gfx/unknown/1dede6.2bpp" INCBIN "gfx/font/spanish_italian.1bpp"
Function1df1e6: ; 1df1e6 HandleFrenchGermanMail: ; 1df1e6
ld b, $21 ; called if mail is french or german
; fix 's 't 'v
ld b, sPartyMon1MailAuthor - sPartyMon1Mail
ld h, d ld h, d
ld l, e ld l, e
.asm_1df1ea .loop
ld a, [hl] ld a, [hl]
cp $dc cp $dc ; 's in french/german font
jr nz, .asm_1df1f3 jr nz, .check_intermediate_chars
ld a, $d4 ld a, "'s"
jr .asm_1df1fd jr .replace
.asm_1df1f3 .check_intermediate_chars
sub $d4 sub "'s"
jr c, .asm_1df1fe jr c, .dont_replace
cp $3 cp "'v" - "'s" + 1
jr nc, .asm_1df1fe jr nc, .dont_replace
add $cd add $cd
.asm_1df1fd .replace
ld [hl], a ld [hl], a
.asm_1df1fe .dont_replace
inc hl inc hl
dec b dec b
jr nz, .asm_1df1ea jr nz, .loop
ret ret
; 1df203 ; 1df203
Function1df203: ; 1df203 LireLeCourrierAnglais:
ld b, $21 DeutenEnglischenPost: ; 1df203
; Cette fonction convertit certains des caractères anglais pour
; leur équivalent dans le jeu de caractères français.
; Diese Funktion wandelt bestimmte englische Zeichen, um ihre
; Entsprechung in der Deutschen-Zeichensatz.
ld b, sPartyMon1MailAuthor - sPartyMon1Mail
ld h, d ld h, d
ld l, e ld l, e
.asm_1df207 .loop
ld a, [hl] ld a, [hl]
cp $d4 cp "'s"
jr nz, .asm_1df210 jr nz, .check_intermediate_chars
ld a, $dc ld a, $dc
jr .asm_1df21a jr .replace
.asm_1df210 .check_intermediate_chars
sub $cd sub $cd
jr c, .asm_1df21b jr c, .dont_replace
cp $3 cp "'v" - "'s" + 1
jr nc, .asm_1df21b jr nc, .dont_replace
add $d4 add "'s"
.asm_1df21a .replace
ld [hl], a ld [hl], a
.asm_1df21b .dont_replace
inc hl inc hl
dec b dec b
jr nz, .asm_1df207 jr nz, .loop
ret ret
; 1df220 ; 1df220
Function1df220: ; 1df220 HandleSpanishItalianMail: ; 1df220
ld b, $21 LeerCorreosIngleses:
LeggiPostaInglese:
; This function converts certain characters between
; the English and Spanish/Italian character sets.
; Esta función convierte ciertos caracteres entre
; el juego de caracteres Inglés y Español.
; Questa funzione converte alcuni caratteri tra
; l'inglese e il set di caratteri italiani.
ld b, sPartyMon1MailAuthor - sPartyMon1Mail
ld h, d ld h, d
ld l, e ld l, e
.asm_1df224 .loop
ld a, [hl] ld a, [hl]
and $f0 and $f0
cp $d0 cp $d0
jr nz, .asm_1df233 jr nz, .dont_replace
ld a, [hl] ld a, [hl]
add $8 add $8
and $f and $f
or $d0 or $d0
ld [hl], a ld [hl], a
.asm_1df233 .dont_replace
inc hl inc hl
dec b dec b
jr nz, .asm_1df224 jr nz, .loop
ret ret
; 1df238 ; 1df238
@ -27342,5 +27375,3 @@ INCBIN "misc/stadium2_2.bin"
ELSE ELSE
INCBIN "misc/stadium2_1.bin" INCBIN "misc/stadium2_1.bin"
ENDC ENDC

View File

@ -1045,7 +1045,7 @@ UnknownText_0x1c564a: ; 0x1c564a
; 0x1c5660 ; 0x1c5660
UnknownText_0x1c5660: ; 0x1c5660 UnknownText_0x1c5660: ; 0x1c5660
text_from_ram wd050 text_from_ram wd050_MonNick
text " learned" text " learned"
line "@" line "@"
text_from_ram StringBuffer2 text_from_ram StringBuffer2
@ -1074,7 +1074,7 @@ UnknownText_0x1c5699: ; 0x1c5699
; 0x1c56af ; 0x1c56af
UnknownText_0x1c56af: ; 0x1c56af UnknownText_0x1c56af: ; 0x1c56af
text_from_ram wd050 text_from_ram wd050_MonNick
text "" text ""
line "did not learn" line "did not learn"
cont "@" cont "@"
@ -1084,7 +1084,7 @@ UnknownText_0x1c56af: ; 0x1c56af
; 0x1c56c9 ; 0x1c56c9
UnknownText_0x1c56c9: ; 0x1c56c9 UnknownText_0x1c56c9: ; 0x1c56c9
text_from_ram wd050 text_from_ram wd050_MonNick
text " is" text " is"
line "trying to learn" line "trying to learn"
cont "@" cont "@"
@ -1092,7 +1092,7 @@ UnknownText_0x1c56c9: ; 0x1c56c9
text "." text "."
para "But @" para "But @"
text_from_ram wd050 text_from_ram wd050_MonNick
text "" text ""
line "can't learn more" line "can't learn more"
cont "than four moves." cont "than four moves."
@ -1120,7 +1120,7 @@ UnknownText_0x1c574e: ; 0x1c574e
interpret_data interpret_data
text "" text ""
para "@" para "@"
text_from_ram wd050 text_from_ram wd050_MonNick
text " forgot" text " forgot"
line "@" line "@"
text_from_ram StringBuffer1 text_from_ram StringBuffer1

View File

@ -148,7 +148,8 @@ endm
mailmsg: MACRO mailmsg: MACRO
\1Message:: ds MAIL_MSG_LENGTH \1Message:: ds MAIL_MSG_LENGTH
\1MessageEnd:: ds 1 \1MessageEnd:: ds 1
\1Author:: ds NAME_LENGTH +- 1 \1Author:: ds PLAYER_NAME_LENGTH
\1AuthorNationality:: ds 2
\1AuthorID:: ds 2 \1AuthorID:: ds 2
\1Species:: ds 1 \1Species:: ds 1
\1MailType:: ds 1 \1MailType:: ds 1