This commit is contained in:
@@ -64,6 +64,7 @@ globals = {
|
|||||||
"index_menu",
|
"index_menu",
|
||||||
"Map",
|
"Map",
|
||||||
"map",
|
"map",
|
||||||
|
"time",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ function Context.initial_data()
|
|||||||
current_situation = nil,
|
current_situation = nil,
|
||||||
},
|
},
|
||||||
day_count = 1,
|
day_count = 1,
|
||||||
|
delta_time = 0,
|
||||||
|
last_frame_time = 0,
|
||||||
glitch = {
|
glitch = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
state = "active",
|
state = "active",
|
||||||
|
|||||||
@@ -68,12 +68,12 @@ end
|
|||||||
|
|
||||||
local state = STATE_TEXT
|
local state = STATE_TEXT
|
||||||
local text_y = Config.screen.height
|
local text_y = Config.screen.height
|
||||||
local text_speed = 0.2
|
local text_speed = 12 -- pixels per second
|
||||||
local day_timer = 0
|
local day_timer = 0
|
||||||
local day_display_frames = 120
|
local day_display_seconds = 2
|
||||||
local text_done = false
|
local text_done = false
|
||||||
local text_done_timer = 0
|
local text_done_timer = 0
|
||||||
local TEXT_DONE_HOLD_FRAMES = 120
|
local TEXT_DONE_HOLD_SECONDS = 2
|
||||||
local selected_choice = 1
|
local selected_choice = 1
|
||||||
local text = ASC_01_TEXT
|
local text = ASC_01_TEXT
|
||||||
local day_text_override = nil
|
local day_text_override = nil
|
||||||
@@ -118,7 +118,7 @@ local function go_to_day_state()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
state = STATE_DAY
|
state = STATE_DAY
|
||||||
day_timer = day_display_frames
|
day_timer = day_display_seconds
|
||||||
end
|
end
|
||||||
|
|
||||||
local function wake_up()
|
local function wake_up()
|
||||||
@@ -146,7 +146,7 @@ end
|
|||||||
local function stay_in_bed()
|
local function stay_in_bed()
|
||||||
Day.increase()
|
Day.increase()
|
||||||
state = STATE_DAY
|
state = STATE_DAY
|
||||||
day_timer = day_display_frames
|
day_timer = day_display_seconds
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Starts the mysterious man screen.
|
--- Starts the mysterious man screen.
|
||||||
@@ -171,7 +171,7 @@ function MysteriousManScreen.start(options)
|
|||||||
if options.skip_text then
|
if options.skip_text then
|
||||||
show_mysterious_screen = false
|
show_mysterious_screen = false
|
||||||
state = STATE_DAY
|
state = STATE_DAY
|
||||||
day_timer = day_display_frames
|
day_timer = day_display_seconds
|
||||||
else
|
else
|
||||||
show_mysterious_screen = true
|
show_mysterious_screen = true
|
||||||
state = STATE_TEXT
|
state = STATE_TEXT
|
||||||
@@ -194,25 +194,29 @@ Screen.register({
|
|||||||
update = function()
|
update = function()
|
||||||
if state == STATE_TEXT then
|
if state == STATE_TEXT then
|
||||||
if not text_done then
|
if not text_done then
|
||||||
text_y = text_y - text_speed
|
text_y = text_y - (text_speed * Context.delta_time)
|
||||||
|
|
||||||
local lines = 1
|
local lines = 1
|
||||||
for _ in string.gmatch(text, "\n") do
|
for _ in string.gmatch(text, "\n") do
|
||||||
lines = lines + 1
|
lines = lines + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if text_y < -lines * 8 then
|
if text_y < -lines * 8 or Input.select() then
|
||||||
text_done = true
|
text_done = true
|
||||||
text_done_timer = TEXT_DONE_HOLD_FRAMES
|
text_done_timer = TEXT_DONE_HOLD_SECONDS
|
||||||
|
-- If skipped by user, go to day state immediately
|
||||||
|
if Input.select() then
|
||||||
|
go_to_day_state()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
text_done_timer = text_done_timer - 1
|
text_done_timer = text_done_timer - Context.delta_time
|
||||||
if text_done_timer <= 0 then
|
if text_done_timer <= 0 or Input.select() then
|
||||||
go_to_day_state()
|
go_to_day_state()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif state == STATE_DAY then
|
elseif state == STATE_DAY then
|
||||||
day_timer = day_timer - 1
|
day_timer = day_timer - Context.delta_time
|
||||||
|
|
||||||
if day_timer <= 0 or Input.select() then
|
if day_timer <= 0 or Input.select() then
|
||||||
if trigger_flash_on_wake or Ascension.get_level() < 1 then
|
if trigger_flash_on_wake or Ascension.get_level() < 1 then
|
||||||
|
|||||||
@@ -17,6 +17,15 @@ end
|
|||||||
--- @within Main
|
--- @within Main
|
||||||
function TIC()
|
function TIC()
|
||||||
init_game()
|
init_game()
|
||||||
|
|
||||||
|
local now = time()
|
||||||
|
if Context.last_frame_time == 0 then
|
||||||
|
Context.delta_time = 0
|
||||||
|
else
|
||||||
|
Context.delta_time = (now - Context.last_frame_time) / 1000
|
||||||
|
end
|
||||||
|
Context.last_frame_time = now
|
||||||
|
|
||||||
cls(Config.colors.black)
|
cls(Config.colors.black)
|
||||||
local handler = Window.get_current_handler() -- Get handler from Window manager
|
local handler = Window.get_current_handler() -- Get handler from Window manager
|
||||||
if handler then
|
if handler then
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- @section BriefIntroWindow
|
--- @section BriefIntroWindow
|
||||||
BriefIntroWindow.y = Config.screen.height
|
BriefIntroWindow.y = Config.screen.height
|
||||||
BriefIntroWindow.speed = 0.5
|
BriefIntroWindow.speed = 30 -- pixels per second
|
||||||
BriefIntroWindow.text = [[
|
BriefIntroWindow.text = [[
|
||||||
Norman Reds’ everyday life
|
Norman Reds’ everyday life
|
||||||
seems ordinary: work,
|
seems ordinary: work,
|
||||||
@@ -24,7 +24,7 @@ end
|
|||||||
--- Updates the brief intro window logic.
|
--- Updates the brief intro window logic.
|
||||||
--- @within BriefIntroWindow
|
--- @within BriefIntroWindow
|
||||||
function BriefIntroWindow.update()
|
function BriefIntroWindow.update()
|
||||||
BriefIntroWindow.y = BriefIntroWindow.y - BriefIntroWindow.speed
|
BriefIntroWindow.y = BriefIntroWindow.y - (BriefIntroWindow.speed * Context.delta_time)
|
||||||
|
|
||||||
local lines = 1
|
local lines = 1
|
||||||
for _ in string.gmatch(BriefIntroWindow.text, "\n") do
|
for _ in string.gmatch(BriefIntroWindow.text, "\n") do
|
||||||
|
|||||||
Reference in New Issue
Block a user