mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-18 19:54:21 +02:00
Merge pull request #1450 from thibautbus/fix/translate-clock-and-day-of-week
This commit is contained in:
@@ -60,10 +60,11 @@ InitClock.TEXT = TEXT
|
||||
-- same three and has always had them right.
|
||||
local MORN_HOUR, DAY_HOUR, NITE_HOUR = 4, 10, 18
|
||||
|
||||
-- data/text/day_of_week.asm order, which is wCurDay's own: SUNDAY is 0.
|
||||
local DAYS = {
|
||||
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY",
|
||||
}
|
||||
-- Clock.DAY_NAMES / Clock.weekdayName is the single translated home for this
|
||||
-- table: MainMenu's clock box and the Pokegear's clock card read the same
|
||||
-- weekday off the same save and must never disagree about what it is
|
||||
-- called.
|
||||
local DAYS = Clock.DAY_NAMES
|
||||
InitClock.DAYS = DAYS
|
||||
|
||||
function InitClock:wantsFillScale() return true end
|
||||
@@ -88,12 +89,15 @@ function InitClock.hourString(hour)
|
||||
local h = math.floor(hour or 0) % 24
|
||||
local display = h % 12
|
||||
if display == 0 then display = 12 end
|
||||
local word = require("src.world.gen2.Palettes").clockDaytime(h)
|
||||
-- Clock.daytimeLabel, not Palettes.clockDaytime: the printed word,
|
||||
-- translated -- this string reaches the player as-is, unlike the internal
|
||||
-- MORN/DAY/NITE key other palette code compares against.
|
||||
local word = Clock.daytimeLabel(h)
|
||||
return ("%s %d"):format(word, display)
|
||||
end
|
||||
|
||||
function InitClock.oclockString(hour)
|
||||
return InitClock.hourString(hour) .. " o'clock"
|
||||
return Strings("%s o'clock", InitClock.hourString(hour))
|
||||
end
|
||||
|
||||
function InitClock.timeString(hour, minute)
|
||||
@@ -187,7 +191,7 @@ function InitClock:question()
|
||||
return Strings(TEXT.whoaMinutes, self.minute)
|
||||
end
|
||||
if self.phase == "confirm-day" then
|
||||
return Strings(TEXT.confirmDay, DAYS[self.day + 1] or "?")
|
||||
return Strings(TEXT.confirmDay, Clock.weekdayName(self.day + 1) or "?")
|
||||
end
|
||||
if self.phase == "response" then
|
||||
return Strings(TEXT[InitClock.responseKey(self.hour)],
|
||||
@@ -196,11 +200,15 @@ function InitClock:question()
|
||||
return ""
|
||||
end
|
||||
|
||||
-- data/text/common_1.asm's "@MIN." suffix (DisplayMinutesWithMinString),
|
||||
-- separate from TEXT.whoaMinutes' own "%d min.?" confirmation line above.
|
||||
local MINUTES = Strings.source("%d min.")
|
||||
|
||||
-- The value the picker box shows, or nil while a page is up with no picker.
|
||||
function InitClock:display()
|
||||
if self.phase == "hour" then return InitClock.oclockString(self.hour) end
|
||||
if self.phase == "minute" then return ("%d min."):format(self.minute) end
|
||||
if self.phase == "day" then return DAYS[self.day + 1] or "?" end
|
||||
if self.phase == "minute" then return Strings(MINUTES, self.minute) end
|
||||
if self.phase == "day" then return Clock.weekdayName(self.day + 1) or "?" end
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
@@ -29,10 +29,11 @@ local MainMenu = {}
|
||||
MainMenu.__index = MainMenu
|
||||
MainMenu.isOpaque = true
|
||||
|
||||
-- MainMenu_PrintCurrentTimeAndDay's PrintDayOfWeek strings.
|
||||
local DAYS = {
|
||||
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY",
|
||||
}
|
||||
-- MainMenu_PrintCurrentTimeAndDay's PrintDayOfWeek strings. Clock.DAY_NAMES
|
||||
-- / Clock.weekdayName is the single translated home for this table (see
|
||||
-- InitClock.lua's DAYS), so this screen's clock box cannot drift from the
|
||||
-- Pokegear's own.
|
||||
local DAYS = Clock.DAY_NAMES
|
||||
|
||||
-- MUSIC_MAIN_MENU; resolved by name so a cache without it just stays quiet.
|
||||
local MENU_MUSIC = "Music_MainMenu"
|
||||
@@ -164,7 +165,7 @@ function MainMenu:drawClockBox()
|
||||
-- Textbox at (0,12) with 4 interior rows and 13 interior columns.
|
||||
Chrome.textbox(0, 12, 13, 4)
|
||||
local hour, minute, weekday = self:clockParts()
|
||||
Chrome.print(DAYS[weekday] or "DAY", 1, 14)
|
||||
Chrome.print(Clock.weekdayName(weekday) or "DAY", 1, 14)
|
||||
-- PrintHour prints 1-12 with no leading zero, then ':' then two zero-padded
|
||||
-- minutes; the AM/PM half is drawn by PrintHour itself.
|
||||
local display = hour % 12
|
||||
|
||||
@@ -56,10 +56,6 @@ local CARDS = {
|
||||
-- card over. One row, so `#self.cards` stays 1 and nothing pages.
|
||||
local FLY_MAP_CARD = { id = "map", label = "FLY" }
|
||||
|
||||
local DAYS = {
|
||||
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY",
|
||||
}
|
||||
|
||||
-- ---------------------------------------------------------------- the radio
|
||||
--
|
||||
-- engine/pokegear/radio.asm is not a text table: it is a jumptable of code.
|
||||
@@ -1878,7 +1874,7 @@ function Pokegear:drawClock()
|
||||
-- Pokegear_UpdateClock: ClearBox(3,5) 5x14, the day at (6,6) and
|
||||
-- PrintHoursMins at (6,8) -- two digits, ':', two more, then AM/PM at
|
||||
-- column 12.
|
||||
self:text(DAYS[weekday] or "", 6, 6)
|
||||
self:text(Clock.weekdayName(weekday) or "", 6, 6)
|
||||
local display = hour % 12
|
||||
if display == 0 then display = 12 end
|
||||
self:text(Chrome.number(display, 2), 6, 8)
|
||||
@@ -2203,13 +2199,13 @@ function Pokegear:drawPlain()
|
||||
if id == "clock" then
|
||||
local hour, minute, weekday = self:clockParts()
|
||||
Chrome.box(1, 5, 18, 7)
|
||||
Chrome.print(DAYS[weekday] or "DAY", 3, 7)
|
||||
Chrome.print(Clock.weekdayName(weekday) or "DAY", 3, 7)
|
||||
local display = hour % 12
|
||||
if display == 0 then display = 12 end
|
||||
Chrome.print(("%s:%s %s"):format(
|
||||
Chrome.number(display, 2), Chrome.number(minute, 2, true),
|
||||
hour < 12 and "AM" or "PM"), 5, 9)
|
||||
Chrome.print(Palettes.clockDaytime(hour), 5, 11)
|
||||
Chrome.print(Clock.daytimeLabel(hour), 5, 11)
|
||||
elseif id == "radio" then
|
||||
-- Without the gear sheet there is no dial art, so the frequencies go down
|
||||
-- the screen as a list. A frequency whose test failed still gets a row:
|
||||
|
||||
Reference in New Issue
Block a user