code clean 2

This commit is contained in:
CatWindow 2026-08-19 20:01:06 +03:00
parent 62532c4509
commit dcd7c362a5
2 changed files with 115 additions and 102 deletions

View file

@ -2,14 +2,14 @@ module Settings
class << self
def reset!
@data = {
# Audio
# ------------ Audio ------------
:master_volume => 100,
:bgm_volume => 100,
:sfx_volume => 100,
:fight_crime_track => false,
:old_reprise_song => false,
# Video
# ------------ Video ------------
:fullscreen => false,
:resolution => 0,
:colorblind => false,
@ -20,13 +20,13 @@ module Settings
:vsync => 0,
:max_firefly_count => 30,
# UI
# ------------- UI --------------
:in_game_timer => false,
:language => 0,
:fasttravel_ui => 0,
:mainmenu_background => 0,
# Gameplay
# ---------- Gameplay -----------
:movement => 0,
:skip_text => false,
: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
:wallpaper_mode => 0,
# Advanced
# ---------- Advanced -----------
:crashlog_privacy => false,
:streamer_privacy => false,
:invalid_param_checks => false,
#controls
# ---------- Сontrols -----------
:gamepad_type => -1,
:gamepad_face_style => 0,
:gamepad_led => true,
:gamepad_deadzone => 5,
# Debug
# ------------ Debug ------------
:debug => false,
:debug_character => false,
:debug_text_scene_title => true,
@ -63,69 +63,69 @@ module Settings
def reset_controls!
@data.merge!({
:controls_walk_down => [
KeyBind.key(Input::key_from_name("Down")),
KeyBind.caxis(Input::c_axis_from_name("LeftY"), KeyBind::Positive),
KeyBind.cbutton(Input::c_button_from_name("DpDown"))
],
:controls_walk_left => [
KeyBind.key(Input::key_from_name("Left")),
KeyBind.caxis(Input::c_axis_from_name("LeftX"), KeyBind::Negative),
KeyBind.cbutton(Input::c_button_from_name("DpLeft"))
],
:controls_walk_right => [
KeyBind.key(Input::key_from_name("Right")),
KeyBind.caxis(Input::c_axis_from_name("LeftX"), KeyBind::Positive),
KeyBind.cbutton(Input::c_button_from_name("DpRight"))
],
:controls_walk_up => [
KeyBind.key(Input::key_from_name("Up")),
KeyBind.caxis(Input::c_axis_from_name("LeftY"), KeyBind::Negative),
KeyBind.cbutton(Input::c_button_from_name("DpUp"))
],
:controls_run => [
KeyBind.key(Input::key_from_name("Left Shift")),
KeyBind.caxis(Input::c_axis_from_name("righttrigger"), KeyBind::Positive),
KeyBind.cbutton(Input::c_button_from_name("x"))
],
:controls_walk_down => [
KeyBind.key(Input::key_from_name("Down")),
KeyBind.caxis(Input::c_axis_from_name("LeftY"), KeyBind::Positive),
KeyBind.cbutton(Input::c_button_from_name("DpDown"))
],
:controls_walk_left => [
KeyBind.key(Input::key_from_name("Left")),
KeyBind.caxis(Input::c_axis_from_name("LeftX"), KeyBind::Negative),
KeyBind.cbutton(Input::c_button_from_name("DpLeft"))
],
:controls_walk_right => [
KeyBind.key(Input::key_from_name("Right")),
KeyBind.caxis(Input::c_axis_from_name("LeftX"), KeyBind::Positive),
KeyBind.cbutton(Input::c_button_from_name("DpRight"))
],
:controls_walk_up => [
KeyBind.key(Input::key_from_name("Up")),
KeyBind.caxis(Input::c_axis_from_name("LeftY"), KeyBind::Negative),
KeyBind.cbutton(Input::c_button_from_name("DpUp"))
],
:controls_run => [
KeyBind.key(Input::key_from_name("Left Shift")),
KeyBind.caxis(Input::c_axis_from_name("righttrigger"), KeyBind::Positive),
KeyBind.cbutton(Input::c_button_from_name("x"))
],
# -----------------------------------------------------------------------------------------------------------
:controls_action => [
KeyBind.key(Input::key_from_name("Z")),
KeyBind.key(Input::key_from_name("Space")),
KeyBind.cbutton(Input::c_button_from_name("a")),
],
:controls_deactivate => [
KeyBind.key(Input::key_from_name("Left Shift")),
KeyBind.cbutton(Input::c_button_from_name("back")),
KeyBind.caxis(Input::c_axis_from_name("lefttrigger"), KeyBind::Positive),
],
:controls_cancel => [
KeyBind.key(Input::key_from_name("X")),
KeyBind.key(Input::key_from_name("Escape")),
KeyBind.cbutton(Input::c_button_from_name("b")),
],
:controls_menu => [
KeyBind.key(Input::key_from_name("A")),
KeyBind.key(Input::key_from_name("Return")),
KeyBind.cbutton(Input::c_button_from_name("start")),
],
:controls_items => [
KeyBind.key(Input::key_from_name("S")),
KeyBind.cbutton(Input::c_button_from_name("y")),
],
:controls_nav_left => [
KeyBind.key(Input::key_from_name("Q")),
KeyBind.cbutton(Input::c_button_from_name("leftshoulder")),
],
:controls_nav_right => [
KeyBind.key(Input::key_from_name("W")),
KeyBind.cbutton(Input::c_button_from_name("rightshoulder")),
],
:controls_action => [
KeyBind.key(Input::key_from_name("Z")),
KeyBind.key(Input::key_from_name("Space")),
KeyBind.cbutton(Input::c_button_from_name("a")),
],
:controls_deactivate => [
KeyBind.key(Input::key_from_name("Left Shift")),
KeyBind.cbutton(Input::c_button_from_name("back")),
KeyBind.caxis(Input::c_axis_from_name("lefttrigger"), KeyBind::Positive),
],
:controls_cancel => [
KeyBind.key(Input::key_from_name("X")),
KeyBind.key(Input::key_from_name("Escape")),
KeyBind.cbutton(Input::c_button_from_name("b")),
],
:controls_menu => [
KeyBind.key(Input::key_from_name("A")),
KeyBind.key(Input::key_from_name("Return")),
KeyBind.cbutton(Input::c_button_from_name("start")),
],
:controls_items => [
KeyBind.key(Input::key_from_name("S")),
KeyBind.cbutton(Input::c_button_from_name("y")),
],
:controls_nav_left => [
KeyBind.key(Input::key_from_name("Q")),
KeyBind.cbutton(Input::c_button_from_name("leftshoulder")),
],
:controls_nav_right => [
KeyBind.key(Input::key_from_name("W")),
KeyBind.cbutton(Input::c_button_from_name("rightshoulder")),
],
# -----------------------------------------------------------------------------------------------------------
:controls_debug => [
KeyBind.key(Input::key_from_name("Left Ctrl")),
KeyBind.cbutton(Input::c_button_from_name("rightstick")),
],
:controls_debug => [
KeyBind.key(Input::key_from_name("Left Ctrl")),
KeyBind.cbutton(Input::c_button_from_name("rightstick")),
],
})
end
end

View file

@ -7,23 +7,25 @@ module Settings
# if you do not take the value from settings directly.
# name must be same as the parameter identifier
def crashlog_privacy(value)
Sunshine.crash_privacy = value
end
# ---------------------------------------------- Audio --------------------------------------------
def master_volume(value)
Audio.master_volume = value / 100.0
end
def bgm_volume(value)
Audio.bgm_volume = value
end
def sfx_volume(value)
Audio.sfx_volume = value
end
# ---------------------------------------------- Video --------------------------------------------
def fullscreen(value)
Graphics.fullscreen = $console = value
end
def resolution(value)
if (!Graphics::RESOLUTION_OVERRIDDEN)
res_data = Graphics::RESOLUTIONS&.[](value) || {:width => 480, :height => 640}
@ -35,47 +37,61 @@ module Settings
Graphics.resize_screen(new_width, new_height)
end
end
def scaling_mode(value)
Graphics.smooth = value != 0
end
def colorblind(value)
$game_switches[252] = value
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)
Graphics.frameskip = value
end
def invalid_param_checks(value)
Sunshine.set_sdl_hint("SDL_HINT_INVALID_PARAM_CHECKS", value ? "1" : "2")
def scaling_mode(value)
Graphics.smooth = value != 0
end
VSYNC_MODES = [1, -1, 0]
def vsync(value)
Graphics.setVsync(VSYNC_MODES[value])
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)
Sunshine.set_sdl_hint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", value ? "1" : "0")
end
@ -84,10 +100,7 @@ module Settings
Profiler.set(value)
end
WALLPAPER_MODES = ["normal", "fallback", "disbled"]
def wallpaper_mode(value)
Sunshine.wallpaper_mode = WALLPAPER_MODES[value]
end
# --------------------------------------------- End :3 ---------------------------------------------
end
end
end