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

View File

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

View File

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

137
main.asm
View File

@ -175,7 +175,7 @@ LearnMove: ; 6508
ld hl, PartyMonNicknames
call GetNick
ld hl, StringBuffer1
ld de, wd050
ld de, wd050_MonNick
ld bc, PKMN_NAME_LENGTH
call CopyBytes
@ -187,6 +187,10 @@ LearnMove: ; 6508
ld d, h
ld e, l
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
ld a, [hl]
and a
@ -194,7 +198,8 @@ LearnMove: ; 6508
inc hl
dec b
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
call ForgetMove
pop de
@ -217,7 +222,7 @@ LearnMove: ; 6508
.not_disabled
call GetMoveName
ld hl, UnknownText_0x6684
ld hl, UnknownText_0x6684 ; 1, 2 and…
call PrintText
pop de
pop hl
@ -268,18 +273,18 @@ LearnMove: ; 6508
jp .learned
.cancel
ld hl, UnknownText_0x6675
ld hl, UnknownText_0x6675 ; Stop learning <MOVE>?
call PrintText
call YesNoBox
jp c, .loop
ld hl, UnknownText_0x667a
ld hl, UnknownText_0x667a ; <MON> did not learn <MOVE>.
call PrintText
ld b, 0
ret
.learned
ld hl, UnknownText_0x666b
ld hl, UnknownText_0x666b ; <MON> learned <MOVE>!
call PrintText
ld b, 1
ret
@ -311,6 +316,7 @@ ForgetMove: ; 65d3
ld a, SCREEN_WIDTH * 2
ld [Buffer1], a
predef ListMoves
; wMenuData3
ld a, $4
ld [wcfa1], a
ld a, $6
@ -368,32 +374,38 @@ ForgetMove: ; 65d3
; 666b
UnknownText_0x666b: ; 666b
; <MON> learned <MOVE>!
text_jump UnknownText_0x1c5660
db "@"
; 6670
UnknownText_0x6670: ; 6670
; Which move should be forgotten?
text_jump UnknownText_0x1c5678
db "@"
; 6675
UnknownText_0x6675: ; 6675
; Stop learning <MOVE>?
text_jump UnknownText_0x1c5699
db "@"
; 667a
UnknownText_0x667a: ; 667a
; <MON> did not learn <MOVE>.
text_jump UnknownText_0x1c56af
db "@"
; 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
db "@"
; 6684
UnknownText_0x6684: ; 6684
text_jump UnknownText_0x1c5740
text_jump UnknownText_0x1c5740 ; 1, 2 and…
start_asm
push de
ld de, SFX_SWITCH_POKEMON
@ -404,11 +416,13 @@ UnknownText_0x6684: ; 6684
; 6695
UnknownText_0x6695: ; 6695
; Poof! <MON> forgot <MOVE>. And…
text_jump UnknownText_0x1c574e
db "@"
; 669a
UnknownText_0x669a: ; 669a
; HM moves can't be forgotten now.
text_jump UnknownText_0x1c5772
db "@"
; 669f
@ -27142,10 +27156,14 @@ PokegearGFX: ; 1de2e4
INCBIN "gfx/misc/pokegear.2bpp.lz"
; 1de5c8
Function1de5c8: ; 1de5c8
; reads mail message at de
IsMailEuropean: ; 1de5c8
; 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 hl, $29
ld hl, sPartyMon1MailAuthorNationality - sPartyMon1Mail
add hl, de
ld a, [hli]
cp "E"
@ -27168,92 +27186,107 @@ Function1de5c8: ; 1de5c8
; 1de5e6
; The regular font.
GFX_1de5e6: ; 1de5e6
INCBIN "gfx/unknown/1de5e6.2bpp"
StandardEnglishFont: ; 1de5e6
INCBIN "gfx/font/english.1bpp"
; An extended font.
GFX_1de9e6: ; 1de9e6
INCBIN "gfx/unknown/1de9e6.2bpp"
FrenchGermanFont: ; 1de9e6
INCBIN "gfx/font/french_german.1bpp"
; An even more extended font.
GFX_1dede6: ; 1dede6
INCBIN "gfx/unknown/1dede6.2bpp"
SpanishItalianFont: ; 1dede6
INCBIN "gfx/font/spanish_italian.1bpp"
Function1df1e6: ; 1df1e6
ld b, $21
HandleFrenchGermanMail: ; 1df1e6
; called if mail is french or german
; fix 's 't 'v
ld b, sPartyMon1MailAuthor - sPartyMon1Mail
ld h, d
ld l, e
.asm_1df1ea
.loop
ld a, [hl]
cp $dc
jr nz, .asm_1df1f3
ld a, $d4
jr .asm_1df1fd
cp $dc ; 's in french/german font
jr nz, .check_intermediate_chars
ld a, "'s"
jr .replace
.asm_1df1f3
sub $d4
jr c, .asm_1df1fe
cp $3
jr nc, .asm_1df1fe
.check_intermediate_chars
sub "'s"
jr c, .dont_replace
cp "'v" - "'s" + 1
jr nc, .dont_replace
add $cd
.asm_1df1fd
.replace
ld [hl], a
.asm_1df1fe
.dont_replace
inc hl
dec b
jr nz, .asm_1df1ea
jr nz, .loop
ret
; 1df203
Function1df203: ; 1df203
ld b, $21
LireLeCourrierAnglais:
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 l, e
.asm_1df207
.loop
ld a, [hl]
cp $d4
jr nz, .asm_1df210
cp "'s"
jr nz, .check_intermediate_chars
ld a, $dc
jr .asm_1df21a
jr .replace
.asm_1df210
.check_intermediate_chars
sub $cd
jr c, .asm_1df21b
cp $3
jr nc, .asm_1df21b
add $d4
jr c, .dont_replace
cp "'v" - "'s" + 1
jr nc, .dont_replace
add "'s"
.asm_1df21a
.replace
ld [hl], a
.asm_1df21b
.dont_replace
inc hl
dec b
jr nz, .asm_1df207
jr nz, .loop
ret
; 1df220
Function1df220: ; 1df220
ld b, $21
HandleSpanishItalianMail: ; 1df220
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 l, e
.asm_1df224
.loop
ld a, [hl]
and $f0
cp $d0
jr nz, .asm_1df233
jr nz, .dont_replace
ld a, [hl]
add $8
and $f
or $d0
ld [hl], a
.asm_1df233
.dont_replace
inc hl
dec b
jr nz, .asm_1df224
jr nz, .loop
ret
; 1df238
@ -27342,5 +27375,3 @@ INCBIN "misc/stadium2_2.bin"
ELSE
INCBIN "misc/stadium2_1.bin"
ENDC

View File

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

View File

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