mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
In Game Timer:
-adding an in-game timer that can be visible if the user adds a specific file (igt.ini) to their game's main directory
This commit is contained in:
parent
847c399c82
commit
f7eae9d06e
3 changed files with 35 additions and 2 deletions
|
|
@ -66,6 +66,7 @@ class Game_Temp
|
|||
attr_accessor :prompt_wait # wait for delay caused by prompt
|
||||
attr_accessor :menus_visible
|
||||
attr_accessor :countdown_password
|
||||
attr_accessor :igt_timer_visible
|
||||
#--------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
#--------------------------------------------------------------------------
|
||||
|
|
@ -123,8 +124,9 @@ class Game_Temp
|
|||
@footstep_sfx = nil
|
||||
@filmsprite = nil
|
||||
@prompt_wait = 0
|
||||
@menus_visible = false
|
||||
@countdown_password = ""
|
||||
@menus_visible = false
|
||||
@countdown_password = ""
|
||||
@igt_timer_visible = false
|
||||
end
|
||||
|
||||
def bgm_fadein(game_system)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,14 @@ class Scene_Map
|
|||
# * Main Processing
|
||||
#--------------------------------------------------------------------------
|
||||
def main
|
||||
@in_game_timer = Sprite.new
|
||||
@in_game_timer.x = 8;
|
||||
@in_game_timer.y = 8;
|
||||
@in_game_timer.bitmap = Bitmap.new(140, 30)
|
||||
@in_game_timer.bitmap.fill_rect(0, 0, 140, 30, Color.new(0, 0, 0))
|
||||
@in_game_timer.z = 10001
|
||||
@in_game_timer.visible = $game_temp.igt_timer_visible
|
||||
|
||||
# Make sprite set
|
||||
@spriteset = Spriteset_Map.new
|
||||
# Make message window
|
||||
|
|
@ -82,6 +90,7 @@ class Scene_Map
|
|||
@item_icon.dispose
|
||||
@item_icon_flash.dispose
|
||||
@blackfade.dispose
|
||||
@in_game_timer.dispose
|
||||
# If switching to title screen
|
||||
if $scene.is_a?(Scene_Title)
|
||||
# Fade out screen
|
||||
|
|
@ -93,6 +102,21 @@ class Scene_Map
|
|||
# * Frame Update
|
||||
#--------------------------------------------------------------------------
|
||||
def update
|
||||
if $game_temp.igt_timer_visible && (Graphics.frame_count != nil)
|
||||
total_sec = Graphics.frame_count / Graphics.frame_rate
|
||||
hour = total_sec / 60 / 60
|
||||
min = total_sec / 60 % 60
|
||||
sec = total_sec % 60
|
||||
millisec = ((Graphics.frame_count * 1000) / Graphics.frame_rate) % 1000
|
||||
time_string = sprintf("%02d:%02d:%02d.%03d", hour, min, sec, millisec)
|
||||
|
||||
igt_seconds = (Graphics.frame_count / 60) % 60
|
||||
igt_minutes = (Graphics.frame_count / (60 * 60)) % 60
|
||||
igt_hours = Graphics.frame_count / (60 * 60 * 60)
|
||||
@in_game_timer.bitmap.fill_rect(0, 0, 140, 30, Color.new(0, 0, 0, 128))
|
||||
@in_game_timer.bitmap.draw_text(8, 0, 132, 30, time_string)
|
||||
end
|
||||
|
||||
if Input.quit?
|
||||
# put in dialogue boxes here for player
|
||||
# either telling them they can't quit during a cutscene
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@ class Scene_Title
|
|||
new_game #unless load
|
||||
# Make system object
|
||||
$game_system = Game_System.new
|
||||
|
||||
if File.exists?("igt.ini")
|
||||
$game_temp.igt_timer_visible = true
|
||||
end
|
||||
|
||||
# Skip title screen if debug mode (or demo, but not GDC)
|
||||
if $debug || ($demo && !$GDC) || save_exists
|
||||
$game_map.update
|
||||
|
|
@ -225,6 +230,8 @@ class Scene_Title
|
|||
# * Command: Continue
|
||||
#--------------------------------------------------------------------------
|
||||
def command_continue
|
||||
# Reset frame count for measuring play time
|
||||
Graphics.frame_count = 0
|
||||
# Play decision SE
|
||||
Audio.se_play('Audio/SE/title_decision.wav')
|
||||
# Update map (run parallel process event)
|
||||
|
|
|
|||
Loading…
Reference in a new issue