mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-22 23:06:18 +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 "meow.h"
|
||||||
#include "sharedstate.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);
|
is_privacy_crashdump_enabled = RTEST(v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE sunshine_set_wallpaper_mode(VALUE, VALUE v) {
|
static VALUE sunshineSetWallpaperMode(VALUE, VALUE v) {
|
||||||
std::string s(StringValueCStr(v));
|
std::string s(StringValueCStr(v));
|
||||||
shState->config().wallpaperMode = s;
|
shState->config().wallpaperMode = s;
|
||||||
return v;
|
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));
|
return SDL_SetHint(StringValueCStr(h), StringValueCStr(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,9 +48,8 @@ static VALUE int_times(VALUE self) {
|
||||||
|
|
||||||
if (n <= 0) return self;
|
if (n <= 0) return self;
|
||||||
|
|
||||||
for (long i = 0; i < n; ++i) {
|
for (long i = 0; i < n; ++i)
|
||||||
rb_yield(LONG2NUM(i));
|
rb_yield(LONG2NUM(i));
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
@ -68,19 +67,16 @@ void SunshineBindingInit(){
|
||||||
#else
|
#else
|
||||||
rb_const_set(module, rb_intern("DEVBUILD"), Qfalse);
|
rb_const_set(module, rb_intern("DEVBUILD"), Qfalse);
|
||||||
#endif
|
#endif
|
||||||
rb_define_singleton_method(module, "crashprivacy=", RUBY_METHOD_FUNC(sunshine_set_crash_privacy), 1);
|
rb_define_singleton_method(module, "crash_privacy=", RUBY_METHOD_FUNC(sunshineSetCrashPrivacy), 1);
|
||||||
rb_define_singleton_method(module, "wallpapermode=", RUBY_METHOD_FUNC(sunshine_set_wallpaper_mode), 1);
|
rb_define_singleton_method(module, "wallpaper_mode=", RUBY_METHOD_FUNC(sunshineSetWallpaperMode), 1);
|
||||||
rb_define_singleton_method(module, "setSDLHint", RUBY_METHOD_FUNC(sunshine_set_hint), 2);
|
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_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")))
|
||||||
rb_define_method(rb_cInteger, "times", RUBY_METHOD_FUNC(int_times), 0);
|
rb_define_method(rb_cInteger, "times", RUBY_METHOD_FUNC(int_times), 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,60 +3,60 @@ module Settings
|
||||||
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,
|
||||||
:use_fight_crime_track => false,
|
:fight_crime_track => false,
|
||||||
:use_old_self_contained_universe_reprise => false,
|
:old_reprise_song => false,
|
||||||
|
|
||||||
# Video
|
# Video
|
||||||
:fullscreen => false,
|
:fullscreen => false,
|
||||||
:resolution => 0,
|
:resolution => 0,
|
||||||
:colorblind => false,
|
:colorblind => false,
|
||||||
:frameskip => true,
|
:frameskip => true,
|
||||||
:twm_shader => true,
|
:twm_shader => true,
|
||||||
:light => true,
|
:light => true,
|
||||||
:scaling_mode => 0,
|
:scaling_mode => 0,
|
||||||
:vsync => 0,
|
:vsync => 0,
|
||||||
:max_particle_count_firefly => 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,
|
||||||
:enforce_april_fools => false,
|
:enforce_april_fools => false,
|
||||||
:true_memory_mode => false,
|
:true_memory_mode => false,
|
||||||
:oneshot_mode => false,
|
:oneshot_mode => false,
|
||||||
:twm_shader_footprint => true,
|
:twm_shader_footprint => true,
|
||||||
:disable_pizzles_for_fuckin_gayland_users_gayland_devs_fix_your_bullshit_already => false,
|
: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,
|
||||||
:SDL_HINT_INVALID_PARAM_CHECKS => false,
|
:invalid_param_checks => false,
|
||||||
|
|
||||||
#controls
|
#controls
|
||||||
: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,
|
||||||
:debug_text => false,
|
:debug_text => false,
|
||||||
:debug_picture_names => false,
|
:debug_picture_names => false,
|
||||||
:debug_lightmap => false,
|
:debug_lightmap => false,
|
||||||
:SDL_HINT_SHUTDOWN_DBUS_ON_QUIT => false,
|
:shutdown_dbus_on_quit => false,
|
||||||
:profiler => false,
|
:profiler => false,
|
||||||
}
|
}
|
||||||
reset_controls!
|
reset_controls!
|
||||||
end
|
end
|
||||||
|
|
@ -182,13 +182,13 @@ class Window_Settings
|
||||||
{
|
{
|
||||||
:type => :bool,
|
:type => :bool,
|
||||||
:name => "ITS TIME FOR FIGHT CRIME",
|
:name => "ITS TIME FOR FIGHT CRIME",
|
||||||
:parameter => :use_fight_crime_track
|
:parameter => :fight_crime_track
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:type => :bool,
|
:type => :bool,
|
||||||
:name => "Use Old Self Contained Universe(Reprise) version",
|
:name => "Use Old Self Contained Universe(Reprise) version",
|
||||||
:icon => [1, 1],
|
:icon => [1, 1],
|
||||||
:parameter => :use_old_self_contained_universe_reprise
|
:parameter => :old_reprise_song
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"Video" => [
|
"Video" => [
|
||||||
|
|
@ -237,7 +237,7 @@ class Window_Settings
|
||||||
{
|
{
|
||||||
:type => :slider,
|
:type => :slider,
|
||||||
:name => "Density of glen fireflies",
|
:name => "Density of glen fireflies",
|
||||||
:parameter => :max_particle_count_firefly,
|
:parameter => :max_firefly_count,
|
||||||
:icon => [1, 1],
|
:icon => [1, 1],
|
||||||
:min => 0,
|
:min => 0,
|
||||||
:max => 30
|
:max => 30
|
||||||
|
|
@ -318,7 +318,7 @@ class Window_Settings
|
||||||
{
|
{
|
||||||
:type => :bool,
|
:type => :bool,
|
||||||
:name => "Disable System API Dependent Puzzles(For wayland users)",
|
: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,
|
:type => :enum,
|
||||||
|
|
@ -541,7 +541,7 @@ class Window_Settings
|
||||||
:type => :bool,
|
:type => :bool,
|
||||||
:name => "SDL_HINT_INVALID_PARAM_CHECKS",
|
:name => "SDL_HINT_INVALID_PARAM_CHECKS",
|
||||||
:icon => [1, 0],
|
:icon => [1, 0],
|
||||||
:parameter => :SDL_HINT_INVALID_PARAM_CHECKS
|
:parameter => :invalid_param_checks
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"Debug" => [
|
"Debug" => [
|
||||||
|
|
@ -584,7 +584,7 @@ class Window_Settings
|
||||||
{
|
{
|
||||||
:type => :bool,
|
:type => :bool,
|
||||||
:name => "SDL_HINT_SHUTDOWN_DBUS_ON_QUIT",
|
:name => "SDL_HINT_SHUTDOWN_DBUS_ON_QUIT",
|
||||||
:parameter => :SDL_HINT_SHUTDOWN_DBUS_ON_QUIT,
|
:parameter => :shutdown_dbus_on_quit,
|
||||||
:icon => [1, 0],
|
:icon => [1, 0],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ module Settings
|
||||||
|
|
||||||
# name must be same as the parameter identifier
|
# name must be same as the parameter identifier
|
||||||
|
|
||||||
def crashlog_privacy(value)
|
def crashlog_privacy(value)
|
||||||
Sunshine.crashprivacy=value
|
Sunshine.crash_privacy = value
|
||||||
end
|
end
|
||||||
def master_volume(value)
|
def master_volume(value)
|
||||||
Audio.master_volume = value / 100.0
|
Audio.master_volume = value / 100.0
|
||||||
end
|
end
|
||||||
|
|
@ -36,13 +36,9 @@ module Settings
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def scaling_mode(value)
|
def scaling_mode(value)
|
||||||
if value == 0
|
Graphics.smooth = value != 0
|
||||||
Graphics.smooth = false
|
end
|
||||||
else
|
|
||||||
Graphics.smooth = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def colorblind(value)
|
def colorblind(value)
|
||||||
$game_switches[252] = value
|
$game_switches[252] = value
|
||||||
|
|
@ -71,40 +67,26 @@ module Settings
|
||||||
Graphics.frameskip = value
|
Graphics.frameskip = value
|
||||||
end
|
end
|
||||||
|
|
||||||
def SDL_HINT_INVALID_PARAM_CHECKS(value)
|
def invalid_param_checks(value)
|
||||||
Sunshine.setSDLHint("SDL_HINT_INVALID_PARAM_CHECKS", value ? "1" : "2")
|
Sunshine.set_sdl_hint("SDL_HINT_INVALID_PARAM_CHECKS", value ? "1" : "2")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
VSYNC_MODES = [1, -1, 0]
|
||||||
def vsync(value)
|
def vsync(value)
|
||||||
if value == 0
|
Graphics.setVsync(VSYNC_MODES[value])
|
||||||
Graphics.setVsync(1)
|
|
||||||
elsif value == 1
|
|
||||||
Graphics.setVsync(-1)
|
|
||||||
else
|
|
||||||
Graphics.setVsync(0)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def SDL_HINT_SHUTDOWN_DBUS_ON_QUIT(value)
|
def shutdown_dbus_on_quit(value)
|
||||||
if value
|
Sunshine.set_sdl_hint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", value ? "1" : "0")
|
||||||
Sunshine.setSDLHint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", "1")
|
|
||||||
else
|
|
||||||
Sunshine.setSDLHint("SDL_HINT_SHUTDOWN_DBUS_ON_QUIT", "0")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def profiler(value)
|
def profiler(value)
|
||||||
Profiler.set(value)
|
Profiler.set(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
WALLPAPER_MODES = ["normal", "fallback", "disbled"]
|
||||||
def wallpaper_mode(value)
|
def wallpaper_mode(value)
|
||||||
if value == 0
|
Sunshine.wallpaper_mode = WALLPAPER_MODES[value]
|
||||||
Sunshine.wallpapermode="normal"
|
|
||||||
elsif value == 1
|
|
||||||
Sunshine.wallpapermode="fallback"
|
|
||||||
else
|
|
||||||
Sunshine.wallpapermode="disabled"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ class Spriteset_Map
|
||||||
case @particles_type
|
case @particles_type
|
||||||
when :fireflies
|
when :fireflies
|
||||||
klass = Particle_Firefly
|
klass = Particle_Firefly
|
||||||
count = Settings[:max_particle_count_firefly]
|
count = Settings[:max_firefly_count]
|
||||||
layer = :front
|
layer = :front
|
||||||
when :shrimp
|
when :shrimp
|
||||||
klass = Particle_Shrimp
|
klass = Particle_Shrimp
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue