diff --git a/layout.link b/layout.link index eeff7219c..2a001729a 100644 --- a/layout.link +++ b/layout.link @@ -312,6 +312,7 @@ ROMX $7c "Battle Tower Trainer Data" ROMX $7d "Mobile News Data" + "Currency Finder" ROMX $7e "Crystal Events" ROMX $7f diff --git a/main.asm b/main.asm index d1cb6bd4b..b33a87b57 100644 --- a/main.asm +++ b/main.asm @@ -678,6 +678,11 @@ INCLUDE "mobile/news/news.asm" INCLUDE "mobile/error.asm" +SECTION "Currency Finder", ROMX + +INCLUDE "mobile/currency_finder.asm" + + SECTION "Crystal Events", ROMX ;INCLUDE "engine/events/battle_tower/load_trainer.asm" diff --git a/mobile/currency_finder.asm b/mobile/currency_finder.asm new file mode 100644 index 000000000..8e33dbf59 --- /dev/null +++ b/mobile/currency_finder.asm @@ -0,0 +1,224 @@ +; Input: DE = the memory address were the string should be written. Also, wd474 should be set to the prefecture of the user. +; Output: it edits the bytes pointed by DE. +WriteCurrencyName:: + call DetermineCurrencyName + call CopyCurrencyString + ret + +; Input: none. wd474 should be set to the prefecture of the user. +; Output: HL = the address of the string to use for the currency. +DetermineCurrencyName: +if DEF(_CRYSTAL_EU) + ; EU region. + ld a, [wd474] ; Loads the Prefectures index (starts at 0) selected by the player. The Prefectures list is stored into mobile_12.asm + dec a ; Beware: it the value is 0, dec will underflow and default to the default value + + ld hl, String_Currency_Lek + cp 1 ; "EU-AL@" ; Albania + ret z + + ld hl, String_Currency_Fening + cp 3 ; "EU-BA@" ; Bosnia and Herzegovina + ret z + + ld hl, String_Currency_Stotinki + cp 5 ; "EU-BG@" ; Bulgaria + ret z + + ld hl, String_Currency_Copecks + cp 6 ; "EU-BY@" ; Belarus + ret z + cp 7 ; "EU-CH@" ; Switzerland + ret z + cp 22 ; "EU-LI@" ; Liechtenstein + ret z + + ld hl, String_Currency_Crowns + cp 8 ; "EU-CZ@" ; Czech Republic + ret z + + ld hl, String_Currency_Ore + cp 10 ; "EU-DK@" ; Denmark + ret z + cp 29 ; "EU-NO@" ; Norway + ret z + + ld hl, String_Currency_Krooni + cp 11 ; "EU-EE@" ; Estonia + ret z + + ld hl, String_Currency_Pence + cp 15 ; "EU-GB@" ; United Kingdom + ret z + cp 19 ; "EU-IE@" ; Ireland + ret z + + ld hl, String_Currency_Lp + cp 17 ; "EU-HR@" ; Croatia + ret z + + ld hl, String_Currency_Filler + cp 18 ; "EU-HU@" ; Hungary + ret z + + ld hl, String_Currency_Centai + cp 23 ; "EU-LT@" ; Lithuania + ret z + + ld hl, String_Currency_Santimi + cp 25 ; "EU-LV@" ; Lavia + ret z + + ld hl, String_Currency_Lei + cp 26 ; "EU-MD@" ; Moldova + ret z + + ld hl, String_Currency_Liri + cp 27 ; "EU-MT@" ; Malta + ret z + + ld hl, String_Currency_Groszy + cp 30 ; "EU-PL@" ; Poland + ret z + + ld hl, String_Currency_Bani + cp 32 ; "EU-RO@" ; Romania + ret z + + ld hl, String_Currency_Dinari + cp 33 ; "EU-RS@" ; Serbia + ret z + + ld hl, String_Currency_Rubles + cp 34 ; "EU-RU@" ; Russia + ret z + + ld hl, String_Currency_Kronor + cp 35 ; "EU-SE@" ; Sweden + ret z + + ld hl, String_Currency_Tolars + cp 36 ; "EU-SI@" ; Slovenia + ret z + + ld hl, String_Currency_Haliers + cp 37 ; "EU-SK@" ; Slovakia + ret z + + ld hl, String_Currency_Kopikyk + cp 39 ; "EU-UA@" ; Ukraine + ret z + + ld hl, String_Currency_Cents ; Default case. Anything that uses Cents doesn't need to be added into this check list. +else + ; AU and US regions. Cents in all cases. + ld hl, String_Currency_Cents +endc + ret + +; Input: HL = the address to copy from. +; Output: DE = the address to copy into. +; Stops the copy when the EOL char is found ($50 or '@'). +CopyCurrencyString: ; I know this is ugly, I copied and pasted this function from mobile_46.asm +.loop + ld a, [hli] + cp $50 + ret z + ld [de], a + inc de + jr .loop + + + +String_Currency_Cents: ; Note that this is unoptimized, as the string "Is this OK?@" is repeted. + db " Cents";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Lek: ; Note that this is unoptimized, as the string "Is this OK?@" is repeted. + db " Lek";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Fening: + db " Fening";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Stotinki: + db " St.";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Copecks: + db " Copecks";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Crowns: + db " Crowns";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Ore: + db " Öre";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Krooni: + db " Krooni";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Pence: + db " Pence";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Lp: + db " Lp";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Filler: + db " Fillér";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Centai: + db " Centai";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Santimi: + db " Santimi";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Lei: + db " Lei";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Liri: + db " Liri";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Groszy: + db " Groszy";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Bani: + db " Bani";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Dinari: + db " Dinari";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Rubles: + db " Rubles";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Kronor: + db " Kronor";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Tolars: + db " Tolars";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Haliers: + db " Haliers";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + +String_Currency_Kopikyk: + db " Kopikyk";"えん" + next "Is this OK?@";"かかります よろしい ですか?@" + \ No newline at end of file diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index 8f05608ce..62adb7364 100644 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -5101,8 +5101,7 @@ Function11a1e6: call Function11a1ff ld hl, wcd85 call Function11a1ff - ld hl, String_11a70b - call Function11a1ff + farcall WriteCurrencyName ; Copies the currency string at the end of the current string pointed by address stored into DE. ld a, $50 ld [de], a ret @@ -5708,10 +5707,6 @@ String_11a6f1: String_11a706: db "Cost:@";"おかね@" -String_11a70b: - db " Yen";"えん" ; This currency will need to be changed - next "Is this OK?@";"かかります よろしい ですか?@" - String_11a71e: db "Communication";"つうしん しゅうりょう@" ; ??? next "ended.@"