mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-20 05:49:55 +00:00
code clean
This commit is contained in:
parent
9d3b0a146b
commit
62532c4509
4 changed files with 78 additions and 100 deletions
|
|
@ -14,18 +14,18 @@
|
|||
#include "meow.h"
|
||||
#include "sharedstate.h"
|
||||
|
||||
static VALUE sunshine_set_crash_privacy(VALUE, VALUE v) {
|
||||
static VALUE sunshineSetCrashPrivacy(VALUE, VALUE v) {
|
||||
is_privacy_crashdump_enabled = RTEST(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
static VALUE sunshine_set_wallpaper_mode(VALUE, VALUE v) {
|
||||
static VALUE sunshineSetWallpaperMode(VALUE, VALUE v) {
|
||||
std::string s(StringValueCStr(v));
|
||||
shState->config().wallpaperMode = s;
|
||||
return v;
|
||||
}
|
||||
|
||||
static VALUE sunshine_set_hint(VALUE, VALUE h, VALUE v) {
|
||||
static VALUE sunshineSetHint(VALUE, VALUE h, VALUE v) {
|
||||
return SDL_SetHint(StringValueCStr(h), StringValueCStr(v));
|
||||
}
|
||||
|
||||
|
|
@ -48,9 +48,8 @@ static VALUE int_times(VALUE self) {
|
|||
|
||||
if (n <= 0) return self;
|
||||
|
||||
for (long i = 0; i < n; ++i) {
|
||||
for (long i = 0; i < n; ++i)
|
||||
rb_yield(LONG2NUM(i));
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
@ -68,19 +67,16 @@ void SunshineBindingInit(){
|
|||
#else
|
||||
rb_const_set(module, rb_intern("DEVBUILD"), Qfalse);
|
||||
#endif
|
||||
rb_define_singleton_method(module, "crashprivacy=", RUBY_METHOD_FUNC(sunshine_set_crash_privacy), 1);
|
||||
rb_define_singleton_method(module, "wallpapermode=", RUBY_METHOD_FUNC(sunshine_set_wallpaper_mode), 1);
|
||||
rb_define_singleton_method(module, "setSDLHint", RUBY_METHOD_FUNC(sunshine_set_hint), 2);
|
||||
//если методы доступны то просто не перезаписываем их
|
||||
if (!rb_respond_to(rb_cObject, rb_intern("class"))) {
|
||||
rb_define_method(rb_cObject, "class", rb_obj_class, 0);
|
||||
}
|
||||
//сразу для всех обьектов
|
||||
if (!rb_respond_to(rb_cObject, rb_intern("clone"))) {
|
||||
rb_define_method(rb_cObject, "clone", RUBY_METHOD_FUNC(obj_clone), 0);
|
||||
}
|
||||
rb_define_singleton_method(module, "crash_privacy=", RUBY_METHOD_FUNC(sunshineSetCrashPrivacy), 1);
|
||||
rb_define_singleton_method(module, "wallpaper_mode=", RUBY_METHOD_FUNC(sunshineSetWallpaperMode), 1);
|
||||
rb_define_singleton_method(module, "set_sdl_hint", RUBY_METHOD_FUNC(sunshineSetHint), 2);
|
||||
|
||||
if (!rb_respond_to(rb_cObject, rb_intern("class")))
|
||||
rb_define_method(rb_cObject, "class", rb_obj_class, 0);
|
||||
|
||||
if (!rb_respond_to(rb_cObject, rb_intern("clone")))
|
||||
rb_define_method(rb_cObject, "clone", RUBY_METHOD_FUNC(obj_clone), 0);
|
||||
|
||||
if (!rb_respond_to(rb_cInteger, rb_intern("times"))) {
|
||||
if (!rb_respond_to(rb_cInteger, rb_intern("times")))
|
||||
rb_define_method(rb_cInteger, "times", RUBY_METHOD_FUNC(int_times), 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,60 +3,60 @@ module Settings
|
|||
def reset!
|
||||
@data = {
|
||||
# Audio
|
||||
:master_volume => 100,
|
||||
:bgm_volume => 100,
|
||||
:sfx_volume => 100,
|
||||
:use_fight_crime_track => false,
|
||||
:use_old_self_contained_universe_reprise => false,
|
||||
:master_volume => 100,
|
||||
:bgm_volume => 100,
|
||||
:sfx_volume => 100,
|
||||
:fight_crime_track => false,
|
||||
:old_reprise_song => false,
|
||||
|
||||
# Video
|
||||
:fullscreen => false,
|
||||
:resolution => 0,
|
||||
:colorblind => false,
|
||||
:frameskip => true,
|
||||
:twm_shader => true,
|
||||
:light => true,
|
||||
:scaling_mode => 0,
|
||||
:vsync => 0,
|
||||
:max_particle_count_firefly => 30,
|
||||
:fullscreen => false,
|
||||
:resolution => 0,
|
||||
:colorblind => false,
|
||||
:frameskip => true,
|
||||
:twm_shader => true,
|
||||
:light => true,
|
||||
:scaling_mode => 0,
|
||||
:vsync => 0,
|
||||
:max_firefly_count => 30,
|
||||
|
||||
# UI
|
||||
:in_game_timer => false,
|
||||
:language => 0,
|
||||
:fasttravel_ui => 0,
|
||||
:mainmenu_background => 0,
|
||||
:in_game_timer => false,
|
||||
:language => 0,
|
||||
:fasttravel_ui => 0,
|
||||
:mainmenu_background => 0,
|
||||
|
||||
# Gameplay
|
||||
:movement => 0,
|
||||
:skip_text => false,
|
||||
:en_purple_messagebox => true,
|
||||
:enforce_april_fools => false,
|
||||
:true_memory_mode => false,
|
||||
:oneshot_mode => false,
|
||||
:twm_shader_footprint => true,
|
||||
:disable_pizzles_for_fuckin_gayland_users_gayland_devs_fix_your_bullshit_already => false,
|
||||
:wallpaper_mode => 0,
|
||||
:movement => 0,
|
||||
:skip_text => false,
|
||||
:en_purple_messagebox => true,
|
||||
:enforce_april_fools => false,
|
||||
:true_memory_mode => false,
|
||||
:oneshot_mode => false,
|
||||
:twm_shader_footprint => true,
|
||||
:disable_api_puzzles => false, #disable_pizzles_for_fuckin_gayland_users_gayland_devs_fix_your_bullshit_already
|
||||
:wallpaper_mode => 0,
|
||||
|
||||
# Advanced
|
||||
:crashlog_privacy => false,
|
||||
:streamer_privacy => false,
|
||||
:SDL_HINT_INVALID_PARAM_CHECKS => false,
|
||||
:crashlog_privacy => false,
|
||||
:streamer_privacy => false,
|
||||
:invalid_param_checks => false,
|
||||
|
||||
#controls
|
||||
:gamepad_type => -1,
|
||||
:gamepad_face_style => 0,
|
||||
:gamepad_led => true,
|
||||
:gamepad_deadzone => 5,
|
||||
:gamepad_type => -1,
|
||||
:gamepad_face_style => 0,
|
||||
:gamepad_led => true,
|
||||
:gamepad_deadzone => 5,
|
||||
|
||||
# Debug
|
||||
:debug => false,
|
||||
:debug_character => false,
|
||||
:debug_text_scene_title => true,
|
||||
:debug_text => false,
|
||||
:debug_picture_names => false,
|
||||
:debug_lightmap => false,
|
||||
:SDL_HINT_SHUTDOWN_DBUS_ON_QUIT => false,
|
||||
:profiler => false,
|
||||
:debug => false,
|
||||
:debug_character => false,
|
||||
:debug_text_scene_title => true,
|
||||
:debug_text => false,
|
||||
:debug_picture_names => false,
|
||||
:debug_lightmap => false,
|
||||
:shutdown_dbus_on_quit => false,
|
||||
:profiler => false,
|
||||
}
|
||||
reset_controls!
|
||||
end
|
||||
|
|
@ -182,13 +182,13 @@ class Window_Settings
|
|||
{
|
||||
:type => :bool,
|
||||
:name => "ITS TIME FOR FIGHT CRIME",
|
||||
:parameter => :use_fight_crime_track
|
||||
:parameter => :fight_crime_track
|
||||
},
|
||||
{
|
||||
:type => :bool,
|
||||
:name => "Use Old Self Contained Universe(Reprise) version",
|
||||
:icon => [1, 1],
|
||||
:parameter => :use_old_self_contained_universe_reprise
|
||||
:parameter => :old_reprise_song
|
||||
},
|
||||
],
|
||||
"Video" => [
|
||||
|
|
@ -237,7 +237,7 @@ class Window_Settings
|
|||
{
|
||||
:type => :slider,
|
||||
:name => "Density of glen fireflies",
|
||||
:parameter => :max_particle_count_firefly,
|
||||
:parameter => :max_firefly_count,
|
||||
:icon => [1, 1],
|
||||
:min => 0,
|
||||
:max => 30
|
||||
|
|
@ -318,7 +318,7 @@ class Window_Settings
|
|||
{
|
||||
:type => :bool,
|
||||
:name => "Disable System API Dependent Puzzles(For wayland users)",
|
||||
:parameter => :disable_pizzles_for_fuckin_gayland_users_gayland_devs_fix_your_bullshit_already
|
||||
:parameter => :disable_api_puzzles
|
||||
},
|
||||
{
|
||||
:type => :enum,
|
||||
|
|
@ -541,7 +541,7 @@ class Window_Settings
|
|||
:type => :bool,
|
||||
:name => "SDL_HINT_INVALID_PARAM_CHECKS",
|
||||
:icon => [1, 0],
|
||||
:parameter => :SDL_HINT_INVALID_PARAM_CHECKS
|
||||
:parameter => :invalid_param_checks
|
||||
},
|
||||
],
|
||||
"Debug" => [
|
||||
|
|
@ -584,7 +584,7 @@ class Window_Settings
|
|||
{
|
||||
:type => :bool,
|
||||
:name => "SDL_HINT_SHUTDOWN_DBUS_ON_QUIT",
|
||||
:parameter => :SDL_HINT_SHUTDOWN_DBUS_ON_QUIT,
|
||||
:parameter => :shutdown_dbus_on_quit,
|
||||
:icon => [1, 0],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ module Settings
|
|||
|
||||
# name must be same as the parameter identifier
|
||||
|
||||
def crashlog_privacy(value)
|
||||
Sunshine.crashprivacy=value
|
||||
end
|
||||
def crashlog_privacy(value)
|
||||
Sunshine.crash_privacy = value
|
||||
end
|
||||
def master_volume(value)
|
||||
Audio.master_volume = value / 100.0
|
||||
end
|
||||
|
|
@ -36,13 +36,9 @@ module Settings
|
|||
end
|
||||
end
|
||||
|
||||
def scaling_mode(value)
|
||||
if value == 0
|
||||
Graphics.smooth = false
|
||||
else
|
||||
Graphics.smooth = true
|
||||
end
|
||||
end
|
||||
def scaling_mode(value)
|
||||
Graphics.smooth = value != 0
|
||||
end
|
||||
|
||||
def colorblind(value)
|
||||
$game_switches[252] = value
|
||||
|
|
@ -71,40 +67,26 @@ module Settings
|
|||
Graphics.frameskip = value
|
||||
end
|
||||
|
||||
def SDL_HINT_INVALID_PARAM_CHECKS(value)
|
||||
Sunshine.setSDLHint("SDL_HINT_INVALID_PARAM_CHECKS", value ? "1" : "2")
|
||||
def invalid_param_checks(value)
|
||||
Sunshine.set_sdl_hint("SDL_HINT_INVALID_PARAM_CHECKS", value ? "1" : "2")
|
||||
end
|
||||
|
||||
VSYNC_MODES = [1, -1, 0]
|
||||
def vsync(value)
|
||||
if value == 0
|
||||
Graphics.setVsync(1)
|
||||
elsif value == 1
|
||||
Graphics.setVsync(-1)
|
||||
else
|
||||
Graphics.setVsync(0)
|
||||
end
|
||||
Graphics.setVsync(VSYNC_MODES[value])
|
||||
end
|
||||
|
||||
def SDL_HINT_SHUTDOWN_DBUS_ON_QUIT(value)
|
||||
if value
|
||||
Sunshine.setSDLHint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", "1")
|
||||
else
|
||||
Sunshine.setSDLHint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", "0")
|
||||
end
|
||||
def shutdown_dbus_on_quit(value)
|
||||
Sunshine.set_sdl_hint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", value ? "1" : "0")
|
||||
end
|
||||
|
||||
def profiler(value)
|
||||
Profiler.set(value)
|
||||
end
|
||||
|
||||
|
||||
WALLPAPER_MODES = ["normal", "fallback", "disbled"]
|
||||
def wallpaper_mode(value)
|
||||
if value == 0
|
||||
Sunshine.wallpapermode="normal"
|
||||
elsif value == 1
|
||||
Sunshine.wallpapermode="fallback"
|
||||
else
|
||||
Sunshine.wallpapermode="disabled"
|
||||
end
|
||||
Sunshine.wallpaper_mode = WALLPAPER_MODES[value]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ class Spriteset_Map
|
|||
case @particles_type
|
||||
when :fireflies
|
||||
klass = Particle_Firefly
|
||||
count = Settings[:max_particle_count_firefly]
|
||||
count = Settings[:max_firefly_count]
|
||||
layer = :front
|
||||
when :shrimp
|
||||
klass = Particle_Shrimp
|
||||
|
|
|
|||
Loading…
Reference in a new issue