mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
Made auto saving/loading fully functional
With this, autoloading upon launching the game should be fully working. Also added some randomness to the pitch of step_sfx to make them sound a bit less repetitive, and made it so the game can only save if the current scene is a Scene_Map (because auto_saving at the titlescreen breaks things pretty badly).
This commit is contained in:
parent
154681d853
commit
4ebcd19352
5 changed files with 29 additions and 8 deletions
|
|
@ -281,7 +281,8 @@ class Game_Player < Game_Character
|
|||
if FOOTSTEP_AMT.include? name
|
||||
name += '%02d' % [rand(FOOTSTEP_AMT[name]) + 1]
|
||||
end
|
||||
Audio.se_play("Audio/SE/#{name}.wav", (80 * volume).to_i)
|
||||
pitch = 85 + rand(30)
|
||||
Audio.se_play("Audio/SE/#{name}.wav", (80 * volume).to_i, pitch.to_i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#==============================================================================
|
||||
|
||||
class Interpreter
|
||||
attr_accessor :index
|
||||
@@chill_pill = false
|
||||
#--------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#==============================================================================
|
||||
|
||||
at_exit do
|
||||
save unless $game_system.map_interpreter.running?
|
||||
save unless ($game_system.map_interpreter.running? || !$scene.is_a?(Scene_Map))
|
||||
end
|
||||
|
||||
begin
|
||||
|
|
@ -19,6 +19,9 @@ begin
|
|||
|
||||
# Prepare for transition
|
||||
Graphics.freeze
|
||||
$debug = false
|
||||
$demo = false
|
||||
$GDC = false
|
||||
# Make scene object (title screen)
|
||||
$scene = Scene_Title.new
|
||||
# Call main method as long as $scene is effective
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ def load
|
|||
$game_followers = Marshal.load(file)
|
||||
$game_oneshot = Marshal.load(file)
|
||||
$game_fasttravel = Marshal.load(file)
|
||||
$game_temp.footstep_sfx = Marshal.load(file)
|
||||
$game_temp.footstep_sfx = Marshal.load(file)
|
||||
# If magic number is different from when saving
|
||||
# (if editing was added with editor)
|
||||
if $game_system.magic_number != $data_system.magic_number
|
||||
|
|
@ -61,10 +61,26 @@ end
|
|||
def real_load
|
||||
load
|
||||
# Restore BGM and BGS
|
||||
$game_system.bgm_play($game_system.playing_bgm)
|
||||
$game_system.bgs_play($game_system.playing_bgs)
|
||||
# switch 181 means its time for a dream, so no BGM
|
||||
|
||||
if !$game_switches[181]
|
||||
$game_system.bgm_play($game_system.playing_bgm)
|
||||
$game_system.bgs_play($game_system.playing_bgs)
|
||||
end
|
||||
# Update map (run parallel process event)
|
||||
$game_map.update
|
||||
# Switch to map screen
|
||||
$scene = Scene_Map.new
|
||||
$game_temp.common_event_id = 42
|
||||
end
|
||||
|
||||
def save_exists
|
||||
return FileTest.exist?(SAVE_FILE_NAME)
|
||||
end
|
||||
|
||||
def quit_game_bed
|
||||
$game_system.map_interpreter.index += 1
|
||||
save
|
||||
Oneshot.allow_exit true
|
||||
exit
|
||||
end
|
||||
|
|
@ -29,11 +29,11 @@ class Scene_Title
|
|||
Language.initialize_database
|
||||
# Load save game/initialize data
|
||||
$game_temp = Game_Temp.new
|
||||
new_game unless load
|
||||
new_game #unless load
|
||||
# Make system object
|
||||
$game_system = Game_System.new
|
||||
# Skip title screen if debug mode (or demo, but not GDC)
|
||||
if $debug || ($demo && !$GDC)
|
||||
if $debug || ($demo && !$GDC) || save_exists
|
||||
$game_map.update
|
||||
$game_map.autoplay
|
||||
$scene = Scene_Map.new
|
||||
|
|
@ -115,7 +115,7 @@ class Scene_Title
|
|||
end
|
||||
end
|
||||
if update_cursor
|
||||
Audio.se_play('Audio/SE/title_cursor.wav')
|
||||
Audio.se_play('Audio/SE/title_cursor.wav', 40)
|
||||
@cursor.y = MENU_Y + (24 - @cursor.bitmap.height) / 2 + 24 * @cursor_pos
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue