I hate ruby

This commit is contained in:
ZakatTeamI2P 2026-05-08 22:13:16 +04:00
parent 12eb014d73
commit ff714cd0ac
8 changed files with 44 additions and 16 deletions

View file

@ -279,6 +279,7 @@ set(BINDING_SOURCE
binding-mri/journal-binding.cpp
binding-mri/chroma-binding.cpp
binding-mri/niko-binding.cpp
binding-mri/time-binding.cpp
)
source_group("Binding Source" FILES ${BINDING_SOURCE} ${BINDING_HEADERS})

View file

@ -65,6 +65,7 @@ void windowBindingInit();
void tilemapBindingInit();
void windowVXBindingInit();
void tilemapVXBindingInit();
void TimeBindingInit();
void inputBindingInit();
void audioBindingInit();
@ -107,6 +108,8 @@ static void mriBindingInit(){
windowBindingInit();
tilemapBindingInit();
TimeBindingInit();
inputBindingInit();
audioBindingInit();
graphicsBindingInit();

View file

@ -20,6 +20,6 @@ void SunshineBindingInit(){
}
if (!rb_respond_to(rb_cString, rb_intern("clone"))) {
rb_define_method(rb_cString, "clone", RUBY_METHOD_FUNC(string_clone), 0);
}
}
printf("[SunshineBindingInit] Done\n");
}

View file

@ -0,0 +1,22 @@
#include <ruby.h>
#include <time.h>
static VALUE get_month(VALUE self) {
time_t now = time(NULL);
struct tm *ltm = localtime(&now);
return INT2NUM(1 + ltm->tm_mon);
}
static VALUE get_day(VALUE self) {
time_t now = time(NULL);
struct tm *ltm = localtime(&now);
return INT2NUM(ltm->tm_mday);
}
void TimeBindingInit() {
printf("[TimeBindingInit] Initializing Time binding\n");
VALUE m = rb_define_module("CTime");
rb_define_module_function(m, "month", get_month, 0);
rb_define_module_function(m, "day", get_day, 0);
printf("[TimeBindingInit] Done\n");
}

View file

@ -291,7 +291,7 @@ class Game_Player < Game_Character
@wheel_squeak = false
end
end
Audio.se_play("Audio/SE/#{name}.wav", (vol * volume).to_i, pitch.to_i)
Audio.se_play("Audio/SE/#{name}.wav", vol * volume, pitch)
end
emit_footsplash(@direction)
end

View file

@ -13,10 +13,8 @@ module RPG
#lowercasing facepic name to be more case insensitive
#to catch the few instances where we use "Niko" instead of "niko"
filename = filename.downcase
#april fools!
t = Time.now
if t.month == 4 && t.day == 1 && filename.start_with?("niko")
if CTime.month == 4 && CTime.day == 1 && filename.start_with?("niko")
filename = "af"
end

View file

@ -7,7 +7,7 @@
class Scene_Title
MENU_X = 640 - 150
MENU_Y = 480 - 100
SDLVer = "#{Sunshine::SDLVersion_major}.#{Sunshine::SDLVersion_minor}.#{Sunshine::SDLVersion_micro}"
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
@ -68,11 +68,14 @@ class Scene_Title
@menu = Sprite.new
@menu.z += 1
@menu.bitmap = Bitmap.new(640, 480)
# @menu.bitmap.draw_text(MENU_X, MENU_Y, 150, 24, tr("Start"))
# @menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings"))
# @menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
@menu.bitmap.draw_text(MENU_X, MENU_Y, 150, 24, tr("Start"))
@menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings"))
@menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
#Debug info like in minecraft Forge :P
@menu.bitmap.draw_text(5, 5, 150, 20, tr("Ruby: #{RUBY_VERSION}"))
@menu.bitmap.draw_text(5, 25, 150, 20, tr("SDL: #{SDLVer}"))
if $game_switches[160] && $game_switches[152]
# @menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("..."))
@menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("..."))
end
Language.register_text_sprite(self.class.name + "_contents", @menu.bitmap)
# Make cursor graphic
@ -131,11 +134,13 @@ class Scene_Title
#--------------------------------------------------------------------------
def update
@menu.bitmap.clear
# @menu.bitmap.draw_text(MENU_X, MENU_Y, 150, 24, tr("Start"))
# @menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings"))
# @menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
@menu.bitmap.draw_text(MENU_X, MENU_Y, 150, 24, tr("Start"))
@menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings"))
@menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
@menu.bitmap.draw_text(5, 5, 150, 20, tr("Ruby: #{RUBY_VERSION}"))
@menu.bitmap.draw_text(5, 25, 150, 20, tr("SDL: #{SDLVer}"))
if $game_switches[160] && $game_switches[152]
# @menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("..."))
@menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("..."))
end
# Handle cursor movement
if !@window_settings_title.visible

View file

@ -394,8 +394,7 @@ class Window_Message < Window_Selectable
else
if @blip >= BLIP_TIME
#april fools
t = Time.now
if $game_temp.message_face != nil && t.month == 4 && t.day == 1 && $game_temp.message_face.start_with?("niko")
if $game_temp.message_face != nil && CTime.month == 4 && CTime.day == 1 && $game_temp.message_face.start_with?("niko")
niko_sounds = [ "cat_2"]
@blipsound = niko_sounds[rand(niko_sounds.length)]
Audio.se_play("Audio/SE/#{@blipsound}.wav", 50, rand(100..125)) unless @text.empty?