mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-21 06:19:56 +00:00
code clean 2
This commit is contained in:
parent
62532c4509
commit
dcd7c362a5
2 changed files with 115 additions and 102 deletions
|
|
@ -2,14 +2,14 @@ module Settings
|
||||||
class << self
|
class << self
|
||||||
def reset!
|
def reset!
|
||||||
@data = {
|
@data = {
|
||||||
# Audio
|
# ------------ Audio ------------
|
||||||
:master_volume => 100,
|
:master_volume => 100,
|
||||||
:bgm_volume => 100,
|
:bgm_volume => 100,
|
||||||
:sfx_volume => 100,
|
:sfx_volume => 100,
|
||||||
:fight_crime_track => false,
|
:fight_crime_track => false,
|
||||||
:old_reprise_song => false,
|
:old_reprise_song => false,
|
||||||
|
|
||||||
# Video
|
# ------------ Video ------------
|
||||||
:fullscreen => false,
|
:fullscreen => false,
|
||||||
:resolution => 0,
|
:resolution => 0,
|
||||||
:colorblind => false,
|
:colorblind => false,
|
||||||
|
|
@ -20,13 +20,13 @@ module Settings
|
||||||
:vsync => 0,
|
:vsync => 0,
|
||||||
:max_firefly_count => 30,
|
:max_firefly_count => 30,
|
||||||
|
|
||||||
# UI
|
# ------------- UI --------------
|
||||||
:in_game_timer => false,
|
:in_game_timer => false,
|
||||||
:language => 0,
|
:language => 0,
|
||||||
:fasttravel_ui => 0,
|
:fasttravel_ui => 0,
|
||||||
:mainmenu_background => 0,
|
:mainmenu_background => 0,
|
||||||
|
|
||||||
# Gameplay
|
# ---------- Gameplay -----------
|
||||||
:movement => 0,
|
:movement => 0,
|
||||||
:skip_text => false,
|
:skip_text => false,
|
||||||
:en_purple_messagebox => true,
|
:en_purple_messagebox => true,
|
||||||
|
|
@ -37,18 +37,18 @@ module Settings
|
||||||
:disable_api_puzzles => false, #disable_pizzles_for_fuckin_gayland_users_gayland_devs_fix_your_bullshit_already
|
:disable_api_puzzles => false, #disable_pizzles_for_fuckin_gayland_users_gayland_devs_fix_your_bullshit_already
|
||||||
:wallpaper_mode => 0,
|
:wallpaper_mode => 0,
|
||||||
|
|
||||||
# Advanced
|
# ---------- Advanced -----------
|
||||||
:crashlog_privacy => false,
|
:crashlog_privacy => false,
|
||||||
:streamer_privacy => false,
|
:streamer_privacy => false,
|
||||||
:invalid_param_checks => false,
|
:invalid_param_checks => false,
|
||||||
|
|
||||||
#controls
|
# ---------- Сontrols -----------
|
||||||
:gamepad_type => -1,
|
:gamepad_type => -1,
|
||||||
:gamepad_face_style => 0,
|
:gamepad_face_style => 0,
|
||||||
:gamepad_led => true,
|
:gamepad_led => true,
|
||||||
:gamepad_deadzone => 5,
|
:gamepad_deadzone => 5,
|
||||||
|
|
||||||
# Debug
|
# ------------ Debug ------------
|
||||||
:debug => false,
|
:debug => false,
|
||||||
:debug_character => false,
|
:debug_character => false,
|
||||||
:debug_text_scene_title => true,
|
:debug_text_scene_title => true,
|
||||||
|
|
@ -63,69 +63,69 @@ module Settings
|
||||||
|
|
||||||
def reset_controls!
|
def reset_controls!
|
||||||
@data.merge!({
|
@data.merge!({
|
||||||
:controls_walk_down => [
|
:controls_walk_down => [
|
||||||
KeyBind.key(Input::key_from_name("Down")),
|
KeyBind.key(Input::key_from_name("Down")),
|
||||||
KeyBind.caxis(Input::c_axis_from_name("LeftY"), KeyBind::Positive),
|
KeyBind.caxis(Input::c_axis_from_name("LeftY"), KeyBind::Positive),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("DpDown"))
|
KeyBind.cbutton(Input::c_button_from_name("DpDown"))
|
||||||
],
|
],
|
||||||
:controls_walk_left => [
|
:controls_walk_left => [
|
||||||
KeyBind.key(Input::key_from_name("Left")),
|
KeyBind.key(Input::key_from_name("Left")),
|
||||||
KeyBind.caxis(Input::c_axis_from_name("LeftX"), KeyBind::Negative),
|
KeyBind.caxis(Input::c_axis_from_name("LeftX"), KeyBind::Negative),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("DpLeft"))
|
KeyBind.cbutton(Input::c_button_from_name("DpLeft"))
|
||||||
],
|
],
|
||||||
:controls_walk_right => [
|
:controls_walk_right => [
|
||||||
KeyBind.key(Input::key_from_name("Right")),
|
KeyBind.key(Input::key_from_name("Right")),
|
||||||
KeyBind.caxis(Input::c_axis_from_name("LeftX"), KeyBind::Positive),
|
KeyBind.caxis(Input::c_axis_from_name("LeftX"), KeyBind::Positive),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("DpRight"))
|
KeyBind.cbutton(Input::c_button_from_name("DpRight"))
|
||||||
],
|
],
|
||||||
:controls_walk_up => [
|
:controls_walk_up => [
|
||||||
KeyBind.key(Input::key_from_name("Up")),
|
KeyBind.key(Input::key_from_name("Up")),
|
||||||
KeyBind.caxis(Input::c_axis_from_name("LeftY"), KeyBind::Negative),
|
KeyBind.caxis(Input::c_axis_from_name("LeftY"), KeyBind::Negative),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("DpUp"))
|
KeyBind.cbutton(Input::c_button_from_name("DpUp"))
|
||||||
],
|
],
|
||||||
:controls_run => [
|
:controls_run => [
|
||||||
KeyBind.key(Input::key_from_name("Left Shift")),
|
KeyBind.key(Input::key_from_name("Left Shift")),
|
||||||
KeyBind.caxis(Input::c_axis_from_name("righttrigger"), KeyBind::Positive),
|
KeyBind.caxis(Input::c_axis_from_name("righttrigger"), KeyBind::Positive),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("x"))
|
KeyBind.cbutton(Input::c_button_from_name("x"))
|
||||||
],
|
],
|
||||||
# -----------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------
|
||||||
:controls_action => [
|
:controls_action => [
|
||||||
KeyBind.key(Input::key_from_name("Z")),
|
KeyBind.key(Input::key_from_name("Z")),
|
||||||
KeyBind.key(Input::key_from_name("Space")),
|
KeyBind.key(Input::key_from_name("Space")),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("a")),
|
KeyBind.cbutton(Input::c_button_from_name("a")),
|
||||||
],
|
],
|
||||||
:controls_deactivate => [
|
:controls_deactivate => [
|
||||||
KeyBind.key(Input::key_from_name("Left Shift")),
|
KeyBind.key(Input::key_from_name("Left Shift")),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("back")),
|
KeyBind.cbutton(Input::c_button_from_name("back")),
|
||||||
KeyBind.caxis(Input::c_axis_from_name("lefttrigger"), KeyBind::Positive),
|
KeyBind.caxis(Input::c_axis_from_name("lefttrigger"), KeyBind::Positive),
|
||||||
],
|
],
|
||||||
:controls_cancel => [
|
:controls_cancel => [
|
||||||
KeyBind.key(Input::key_from_name("X")),
|
KeyBind.key(Input::key_from_name("X")),
|
||||||
KeyBind.key(Input::key_from_name("Escape")),
|
KeyBind.key(Input::key_from_name("Escape")),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("b")),
|
KeyBind.cbutton(Input::c_button_from_name("b")),
|
||||||
],
|
],
|
||||||
:controls_menu => [
|
:controls_menu => [
|
||||||
KeyBind.key(Input::key_from_name("A")),
|
KeyBind.key(Input::key_from_name("A")),
|
||||||
KeyBind.key(Input::key_from_name("Return")),
|
KeyBind.key(Input::key_from_name("Return")),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("start")),
|
KeyBind.cbutton(Input::c_button_from_name("start")),
|
||||||
],
|
],
|
||||||
:controls_items => [
|
:controls_items => [
|
||||||
KeyBind.key(Input::key_from_name("S")),
|
KeyBind.key(Input::key_from_name("S")),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("y")),
|
KeyBind.cbutton(Input::c_button_from_name("y")),
|
||||||
],
|
],
|
||||||
:controls_nav_left => [
|
:controls_nav_left => [
|
||||||
KeyBind.key(Input::key_from_name("Q")),
|
KeyBind.key(Input::key_from_name("Q")),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("leftshoulder")),
|
KeyBind.cbutton(Input::c_button_from_name("leftshoulder")),
|
||||||
],
|
],
|
||||||
:controls_nav_right => [
|
:controls_nav_right => [
|
||||||
KeyBind.key(Input::key_from_name("W")),
|
KeyBind.key(Input::key_from_name("W")),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("rightshoulder")),
|
KeyBind.cbutton(Input::c_button_from_name("rightshoulder")),
|
||||||
],
|
],
|
||||||
# -----------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------
|
||||||
:controls_debug => [
|
:controls_debug => [
|
||||||
KeyBind.key(Input::key_from_name("Left Ctrl")),
|
KeyBind.key(Input::key_from_name("Left Ctrl")),
|
||||||
KeyBind.cbutton(Input::c_button_from_name("rightstick")),
|
KeyBind.cbutton(Input::c_button_from_name("rightstick")),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,23 +7,25 @@ module Settings
|
||||||
# if you do not take the value from settings directly.
|
# if you do not take the value from settings directly.
|
||||||
|
|
||||||
# name must be same as the parameter identifier
|
# name must be same as the parameter identifier
|
||||||
|
|
||||||
def crashlog_privacy(value)
|
# ---------------------------------------------- Audio --------------------------------------------
|
||||||
Sunshine.crash_privacy = value
|
|
||||||
end
|
|
||||||
def master_volume(value)
|
def master_volume(value)
|
||||||
Audio.master_volume = value / 100.0
|
Audio.master_volume = value / 100.0
|
||||||
end
|
end
|
||||||
|
|
||||||
def bgm_volume(value)
|
def bgm_volume(value)
|
||||||
Audio.bgm_volume = value
|
Audio.bgm_volume = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def sfx_volume(value)
|
def sfx_volume(value)
|
||||||
Audio.sfx_volume = value
|
Audio.sfx_volume = value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ---------------------------------------------- Video --------------------------------------------
|
||||||
def fullscreen(value)
|
def fullscreen(value)
|
||||||
Graphics.fullscreen = $console = value
|
Graphics.fullscreen = $console = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def resolution(value)
|
def resolution(value)
|
||||||
if (!Graphics::RESOLUTION_OVERRIDDEN)
|
if (!Graphics::RESOLUTION_OVERRIDDEN)
|
||||||
res_data = Graphics::RESOLUTIONS&.[](value) || {:width => 480, :height => 640}
|
res_data = Graphics::RESOLUTIONS&.[](value) || {:width => 480, :height => 640}
|
||||||
|
|
@ -35,47 +37,61 @@ module Settings
|
||||||
Graphics.resize_screen(new_width, new_height)
|
Graphics.resize_screen(new_width, new_height)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def scaling_mode(value)
|
|
||||||
Graphics.smooth = value != 0
|
|
||||||
end
|
|
||||||
|
|
||||||
def colorblind(value)
|
def colorblind(value)
|
||||||
$game_switches[252] = value
|
$game_switches[252] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
# UI
|
|
||||||
def in_game_timer(value)
|
|
||||||
$game_temp.igt_timer_visible = value
|
|
||||||
if $scene.is_a?(Scene_Map) && $scene&.in_game_timer
|
|
||||||
$scene.in_game_timer.visible = $game_temp.igt_timer_visible
|
|
||||||
end
|
|
||||||
end
|
|
||||||
def language(value)
|
|
||||||
$persistent.lang = Language::LANGUAGES[value]
|
|
||||||
$scene&.redraw
|
|
||||||
end
|
|
||||||
|
|
||||||
def movement(value)
|
|
||||||
$game_switches[251] = value != 0
|
|
||||||
end
|
|
||||||
def skip_text(value)
|
|
||||||
$game_switches[253] = value != 0
|
|
||||||
end
|
|
||||||
|
|
||||||
def frameskip(value)
|
def frameskip(value)
|
||||||
Graphics.frameskip = value
|
Graphics.frameskip = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def invalid_param_checks(value)
|
def scaling_mode(value)
|
||||||
Sunshine.set_sdl_hint("SDL_HINT_INVALID_PARAM_CHECKS", value ? "1" : "2")
|
Graphics.smooth = value != 0
|
||||||
end
|
end
|
||||||
|
|
||||||
VSYNC_MODES = [1, -1, 0]
|
VSYNC_MODES = [1, -1, 0]
|
||||||
def vsync(value)
|
def vsync(value)
|
||||||
Graphics.setVsync(VSYNC_MODES[value])
|
Graphics.setVsync(VSYNC_MODES[value])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ----------------------------------------------- UI -----------------------------------------------
|
||||||
|
def in_game_timer(value)
|
||||||
|
$game_temp.igt_timer_visible = value
|
||||||
|
if $scene.is_a?(Scene_Map) && $scene&.in_game_timer
|
||||||
|
$scene.in_game_timer.visible = $game_temp.igt_timer_visible
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def language(value)
|
||||||
|
$persistent.lang = Language::LANGUAGES[value]
|
||||||
|
$scene&.redraw
|
||||||
|
end
|
||||||
|
|
||||||
|
# -------------------------------------------- Gameplay --------------------------------------------
|
||||||
|
def movement(value)
|
||||||
|
$game_switches[251] = value != 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def skip_text(value)
|
||||||
|
$game_switches[253] = value != 0
|
||||||
|
end
|
||||||
|
|
||||||
|
WALLPAPER_MODES = ["normal", "fallback", "disbled"]
|
||||||
|
def wallpaper_mode(value)
|
||||||
|
Sunshine.wallpaper_mode = WALLPAPER_MODES[value]
|
||||||
|
end
|
||||||
|
|
||||||
|
# -------------------------------------------- Advanced --------------------------------------------
|
||||||
|
def crashlog_privacy(value)
|
||||||
|
Sunshine.crash_privacy = value
|
||||||
|
end
|
||||||
|
|
||||||
|
def invalid_param_checks(value)
|
||||||
|
Sunshine.set_sdl_hint("SDL_HINT_INVALID_PARAM_CHECKS", value ? "1" : "2")
|
||||||
|
end
|
||||||
|
|
||||||
|
# --------------------------------------------- Debug ----------------------------------------------
|
||||||
def shutdown_dbus_on_quit(value)
|
def shutdown_dbus_on_quit(value)
|
||||||
Sunshine.set_sdl_hint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", value ? "1" : "0")
|
Sunshine.set_sdl_hint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", value ? "1" : "0")
|
||||||
end
|
end
|
||||||
|
|
@ -84,10 +100,7 @@ module Settings
|
||||||
Profiler.set(value)
|
Profiler.set(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
WALLPAPER_MODES = ["normal", "fallback", "disbled"]
|
# --------------------------------------------- End :3 ---------------------------------------------
|
||||||
def wallpaper_mode(value)
|
|
||||||
Sunshine.wallpaper_mode = WALLPAPER_MODES[value]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue