diff --git a/.gitignore b/.gitignore index 8bce663..768c43f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,11 @@ rpgscript.bat rpgscript - mklang.bat oneshot_JA_2_merge.pot oneshot_JA_2_merge-jpn.pot +oneshot_JA_2_ver4.pot +oneshot_JA_2_fixed_ver3.pot +oneshot_JA_2_ver3_checked.pot +oneshot_JA_Mariko1_WIP.pot +*.pot xScripts.rxdata .qmake.stash diff --git a/binding-mri/journal-binding.cpp b/binding-mri/journal-binding.cpp index b922b1f..2eaa573 100644 --- a/binding-mri/journal-binding.cpp +++ b/binding-mri/journal-binding.cpp @@ -31,8 +31,10 @@ static SDL_Thread *thread = NULL; static SDL_mutex *mutex = NULL; +static volatile char lang_buffer[BUFFER_SIZE]; static volatile char message_buffer[BUFFER_SIZE]; static volatile bool active = false; +static volatile int message_len = 0; #ifdef LINUX #define PIPE_PATH "/tmp/oneshot-pipe" @@ -83,10 +85,15 @@ RB_METHOD(journalSet) RB_UNUSED_PARAM; const char *name; rb_get_args(argc, argv, "z", &name RB_ARG_END); -#if defined OS_W32 + // Record message SDL_LockMutex(mutex); - strcpy((char*)message_buffer, name); + message_len = strlen(name); + memcpy((char*)message_buffer, name, message_len); + strcpy((char*)message_buffer + message_len, (char*)lang_buffer); + message_len += strlen((char*)lang_buffer); SDL_UnlockMutex(mutex); + +#if defined _WIN32 HANDLE pipe = CreateFileW(L"\\\\.\\pipe\\oneshot-game-to-journal", GENERIC_WRITE, 0, @@ -110,12 +117,6 @@ RB_METHOD(journalSet) SDL_WaitThread(thread, NULL); thread = NULL; } - // Record message - SDL_LockMutex(mutex); - message_len = strlen(name); - memcpy((char*)message_buffer, name, message_len); - SDL_UnlockMutex(mutex); - // Attempt to send it over the tubes if (out_pipe != -1) { // We have a connection, so send it over @@ -133,6 +134,15 @@ RB_METHOD(journalSet) return Qnil; } +RB_METHOD(journalSetLang) +{ + RB_UNUSED_PARAM; + const char *lang; + rb_get_args(argc, argv, "z", &lang RB_ARG_END); + strcpy((char*)lang_buffer+1, lang); + return Qnil; +} + RB_METHOD(journalActive) { RB_UNUSED_PARAM; @@ -142,7 +152,9 @@ RB_METHOD(journalActive) void journalBindingInit() { mutex = SDL_CreateMutex(); -#ifdef LINUX + memset((char*)lang_buffer, 0, BUFFER_SIZE); + lang_buffer[0] = '_'; +#if defined __linux mkfifo(PIPE_PATH, 0666); atexit(cleanup_pipe); #endif @@ -150,4 +162,5 @@ void journalBindingInit() VALUE module = rb_define_module("Journal"); _rb_define_module_function(module, "set", journalSet); _rb_define_module_function(module, "active?", journalActive); + _rb_define_module_function(module, "setLang", journalSetLang); } diff --git a/journal/w32/journal.c b/journal/w32/journal.c index 14871ea..52a09da 100644 --- a/journal/w32/journal.c +++ b/journal/w32/journal.c @@ -13,13 +13,31 @@ static const WCHAR journal_classname[] = L"journal"; static HBITMAP image_handle = NULL; static HANDLE image_mutex = NULL; +static DWORD err = 0; + static HWND window = NULL; static void loadImage(const char *name) { + char copy_space[IN_BUFFER_SIZE]; + const char* lang_ptr; if (image_handle) { DeleteObject(image_handle); } image_handle = LoadBitmapA(GetModuleHandleW(NULL), name); + // In the event we can't find an image's translated value + // try to find a matching resource without any language code suffix + if (!image_handle) { + lang_ptr = strchr(name, '_'); + if (lang_ptr) { + memset(copy_space, 0, IN_BUFFER_SIZE); + strncpy(copy_space, name, lang_ptr - name); + //terminate the string because I guess strncpy doesn't + image_handle = LoadBitmapA(GetModuleHandleW(NULL), copy_space); + if (!image_handle) { + err = GetLastError(); + } + } + } } // Window procedure @@ -134,7 +152,7 @@ int do_journal() wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = module; - wc.hIcon = LoadIcon(NULL, "MAINICON"); + wc.hIcon = LoadIcon(NULL, L"MAINICON"); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = NULL; wc.lpszMenuName = NULL; diff --git a/journal/w32/resources.rc b/journal/w32/resources.rc index 3146119..9c04a61 100644 --- a/journal/w32/resources.rc +++ b/journal/w32/resources.rc @@ -1,37 +1,223 @@ #include MAINICON ICON "icon.ico" -NIKO1 BITMAP "niko1.bmp" -NIKO2 BITMAP "niko2.bmp" -NIKO3 BITMAP "niko3.bmp" +NIKO1 BITMAP "img/NIKO1.bmp" +NIKO2 BITMAP "img/NIKO2.bmp" +NIKO3 BITMAP "img/NIKO3.bmp" -default BITMAP "default.bmp" -t1 BITMAP "t1.bmp" -t2 BITMAP "t2.bmp" -t3 BITMAP "t3.bmp" -t4 BITMAP "t4.bmp" -t5 BITMAP "t5.bmp" -t6 BITMAP "t6.bmp" -t7 BITMAP "t7.bmp" -t8 BITMAP "t8.bmp" -t9 BITMAP "t9.bmp" -t10 BITMAP "t10.bmp" -t11 BITMAP "t11.bmp" -t12 BITMAP "t12.bmp" -t13 BITMAP "t13.bmp" -t14 BITMAP "t14.bmp" -t15 BITMAP "t15.bmp" -t16 BITMAP "t16.bmp" -c1 BITMAP "c1.bmp" -c2 BITMAP "c2.bmp" -c3 BITMAP "c3.bmp" -c4 BITMAP "c4.bmp" -c5 BITMAP "c5.bmp" -c6 BITMAP "c6.bmp" -c7 BITMAP "c7.bmp" -s1 BITMAP "s1.bmp" -s2 BITMAP "s2.bmp" -s3 BITMAP "s3.bmp" -s4 BITMAP "s4.bmp" -save BITMAP "save.bmp" -final BITMAP "final.bmp" +default BITMAP "img/DEFAULT.bmp" +t1 BITMAP "img/T1.bmp" +t2 BITMAP "img/T2.bmp" +t3 BITMAP "img/T3.bmp" +t4 BITMAP "img/T4.bmp" +t5 BITMAP "img/T5.bmp" +t6 BITMAP "img/T6.bmp" +t7 BITMAP "img/T7.bmp" +t8 BITMAP "img/T8.bmp" +t9 BITMAP "img/T9.bmp" +t10 BITMAP "img/T10.bmp" +t11 BITMAP "img/T11.bmp" +t12 BITMAP "img/T12.bmp" +t13 BITMAP "img/T13.bmp" +t14 BITMAP "img/T14.bmp" +t15 BITMAP "img/T15.bmp" +t16 BITMAP "img/T16.bmp" +c1 BITMAP "img/C1.bmp" +c2 BITMAP "img/C2.bmp" +c3 BITMAP "img/C3.bmp" +c4 BITMAP "img/C4.bmp" +c5 BITMAP "img/C5.bmp" +c6 BITMAP "img/C6.bmp" +c7 BITMAP "img/C7.bmp" +s1 BITMAP "img/S1.bmp" +s2 BITMAP "img/S2.bmp" +s3 BITMAP "img/S3.bmp" +s4 BITMAP "img/S4.bmp" +save BITMAP "img/SAVE.bmp" +final BITMAP "img/FINAL.bmp" + +//french +t1_FR BITMAP "img/fr/T1.bmp" +t2_FR BITMAP "img/fr/T2.bmp" +t3_FR BITMAP "img/fr/T3.bmp" +t4_FR BITMAP "img/fr/T4.bmp" +t5_FR BITMAP "img/fr/T5.bmp" +t6_FR BITMAP "img/fr/T6.bmp" +t7_FR BITMAP "img/fr/T7.bmp" +t8_FR BITMAP "img/fr/T8.bmp" +t9_FR BITMAP "img/fr/T9.bmp" +t10_FR BITMAP "img/fr/T10.bmp" +t11_FR BITMAP "img/fr/T11.bmp" +t12_FR BITMAP "img/fr/T12.bmp" +t13_FR BITMAP "img/fr/T13.bmp" +t14_FR BITMAP "img/fr/T14.bmp" +t15_FR BITMAP "img/fr/T15.bmp" +t16_FR BITMAP "img/fr/T16.bmp" +c1_FR BITMAP "img/fr/C1.bmp" +c2_FR BITMAP "img/fr/C2.bmp" +c3_FR BITMAP "img/fr/C3.bmp" +c4_FR BITMAP "img/fr/C4.bmp" +c5_FR BITMAP "img/fr/C5.bmp" +c6_FR BITMAP "img/fr/C6.bmp" +c7_FR BITMAP "img/fr/C7.bmp" +s1_FR BITMAP "img/fr/S1.bmp" +s2_FR BITMAP "img/fr/S2.bmp" +s3_FR BITMAP "img/fr/S3.bmp" +s4_FR BITMAP "img/fr/S4.bmp" +save_FR BITMAP "img/fr/SAVE.bmp" +final_FR BITMAP "img/fr/FINAL.bmp" + +//spanish +t1_ES BITMAP "img/es/T1.bmp" +t2_ES BITMAP "img/es/T2.bmp" +t3_ES BITMAP "img/es/T3.bmp" +t4_ES BITMAP "img/es/T4.bmp" +t5_ES BITMAP "img/es/T5.bmp" +t6_ES BITMAP "img/es/T6.bmp" +t7_ES BITMAP "img/es/T7.bmp" +t8_ES BITMAP "img/es/T8.bmp" +t9_ES BITMAP "img/es/T9.bmp" +t10_ES BITMAP "img/es/T10.bmp" +t11_ES BITMAP "img/es/T11.bmp" +t12_ES BITMAP "img/es/T12.bmp" +t13_ES BITMAP "img/es/T13.bmp" +t14_ES BITMAP "img/es/T14.bmp" +t15_ES BITMAP "img/es/T15.bmp" +t16_ES BITMAP "img/es/T16.bmp" +c1_ES BITMAP "img/es/C1.bmp" +c2_ES BITMAP "img/es/C2.bmp" +c3_ES BITMAP "img/es/C3.bmp" +c4_ES BITMAP "img/es/C4.bmp" +c5_ES BITMAP "img/es/C5.bmp" +c6_ES BITMAP "img/es/C6.bmp" +c7_ES BITMAP "img/es/C7.bmp" +s1_ES BITMAP "img/es/S1.bmp" +s2_ES BITMAP "img/es/S2.bmp" +s3_ES BITMAP "img/es/S3.bmp" +s4_ES BITMAP "img/es/S4.bmp" +save_ES BITMAP "img/es/SAVE.bmp" +final_ES BITMAP "img/es/FINAL.bmp" + +//japanese +t1_JA BITMAP "img/ja/T1.bmp" +t2_JA BITMAP "img/ja/T2.bmp" +t3_JA BITMAP "img/ja/T3.bmp" +t4_JA BITMAP "img/ja/T4.bmp" +t5_JA BITMAP "img/ja/T5.bmp" +t6_JA BITMAP "img/ja/T6.bmp" +t7_JA BITMAP "img/ja/T7.bmp" +t8_JA BITMAP "img/ja/T8.bmp" +t9_JA BITMAP "img/ja/T9.bmp" +t10_JA BITMAP "img/ja/T10.bmp" +t11_JA BITMAP "img/ja/T11.bmp" +t12_JA BITMAP "img/ja/T12.bmp" +t13_JA BITMAP "img/ja/T13.bmp" +t14_JA BITMAP "img/ja/T14.bmp" +t15_JA BITMAP "img/ja/T15.bmp" +t16_JA BITMAP "img/ja/T16.bmp" +c1_JA BITMAP "img/ja/C1.bmp" +c2_JA BITMAP "img/ja/C2.bmp" +c3_JA BITMAP "img/ja/C3.bmp" +c4_JA BITMAP "img/ja/C4.bmp" +c5_JA BITMAP "img/ja/C5.bmp" +c6_JA BITMAP "img/ja/C6.bmp" +c7_JA BITMAP "img/ja/C7.bmp" +s1_JA BITMAP "img/ja/S1.bmp" +s2_JA BITMAP "img/ja/S2.bmp" +s3_JA BITMAP "img/ja/S3.bmp" +s4_JA BITMAP "img/ja/S4.bmp" +save_JA BITMAP "img/ja/SAVE.bmp" +final_JA BITMAP "img/ja/FINAL.bmp" + +//korean +t1_KO BITMAP "img/ko/T1.bmp" +t2_KO BITMAP "img/ko/T2.bmp" +t3_KO BITMAP "img/ko/T3.bmp" +t4_KO BITMAP "img/ko/T4.bmp" +t5_KO BITMAP "img/ko/T5.bmp" +t6_KO BITMAP "img/ko/T6.bmp" +t7_KO BITMAP "img/ko/T7.bmp" +t8_KO BITMAP "img/ko/T8.bmp" +t9_KO BITMAP "img/ko/T9.bmp" +t10_KO BITMAP "img/ko/T10.bmp" +t11_KO BITMAP "img/ko/T11.bmp" +t12_KO BITMAP "img/ko/T12.bmp" +t13_KO BITMAP "img/ko/T13.bmp" +t14_KO BITMAP "img/ko/T14.bmp" +t15_KO BITMAP "img/ko/T15.bmp" +t16_KO BITMAP "img/ko/T16.bmp" +c1_KO BITMAP "img/ko/C1.bmp" +c2_KO BITMAP "img/ko/C2.bmp" +c3_KO BITMAP "img/ko/C3.bmp" +c4_KO BITMAP "img/ko/C4.bmp" +c5_KO BITMAP "img/ko/C5.bmp" +c6_KO BITMAP "img/ko/C6.bmp" +c7_KO BITMAP "img/ko/C7.bmp" +s1_KO BITMAP "img/ko/S1.bmp" +s2_KO BITMAP "img/ko/S2.bmp" +s3_KO BITMAP "img/ko/S3.bmp" +s4_KO BITMAP "img/ko/S4.bmp" +save_KO BITMAP "img/ko/SAVE.bmp" +final_KO BITMAP "img/ko/FINAL.bmp" + +//portuges +t1_PT_BR BITMAP "img/pt_br/T1.bmp" +t2_PT_BR BITMAP "img/pt_br/T2.bmp" +t3_PT_BR BITMAP "img/pt_br/T3.bmp" +t4_PT_BR BITMAP "img/pt_br/T4.bmp" +t5_PT_BR BITMAP "img/pt_br/T5.bmp" +t6_PT_BR BITMAP "img/pt_br/T6.bmp" +t7_PT_BR BITMAP "img/pt_br/T7.bmp" +t8_PT_BR BITMAP "img/pt_br/T8.bmp" +t9_PT_BR BITMAP "img/pt_br/T9.bmp" +t10_PT_BR BITMAP "img/pt_br/T10.bmp" +t11_PT_BR BITMAP "img/pt_br/T11.bmp" +t12_PT_BR BITMAP "img/pt_br/T12.bmp" +t13_PT_BR BITMAP "img/pt_br/T13.bmp" +t14_PT_BR BITMAP "img/pt_br/T14.bmp" +t15_PT_BR BITMAP "img/pt_br/T15.bmp" +t16_PT_BR BITMAP "img/pt_br/T16.bmp" +c1_PT_BR BITMAP "img/pt_br/C1.bmp" +c2_PT_BR BITMAP "img/pt_br/C2.bmp" +c3_PT_BR BITMAP "img/pt_br/C3.bmp" +c4_PT_BR BITMAP "img/pt_br/C4.bmp" +c5_PT_BR BITMAP "img/pt_br/C5.bmp" +c6_PT_BR BITMAP "img/pt_br/C6.bmp" +c7_PT_BR BITMAP "img/pt_br/C7.bmp" +s1_PT_BR BITMAP "img/pt_br/S1.bmp" +s2_PT_BR BITMAP "img/pt_br/S2.bmp" +s3_PT_BR BITMAP "img/pt_br/S3.bmp" +s4_PT_BR BITMAP "img/pt_br/S4.bmp" +save_PT_BR BITMAP "img/pt_br/SAVE.bmp" +final_PT_BR BITMAP "img/pt_br/FINAL.bmp" + +//chinese +t1_ZH_CN BITMAP "img/zh_cn/T1.bmp" +t2_ZH_CN BITMAP "img/zh_cn/T2.bmp" +t3_ZH_CN BITMAP "img/zh_cn/T3.bmp" +t4_ZH_CN BITMAP "img/zh_cn/T4.bmp" +t5_ZH_CN BITMAP "img/zh_cn/T5.bmp" +t6_ZH_CN BITMAP "img/zh_cn/T6.bmp" +t7_ZH_CN BITMAP "img/zh_cn/T7.bmp" +t8_ZH_CN BITMAP "img/zh_cn/T8.bmp" +t9_ZH_CN BITMAP "img/zh_cn/T9.bmp" +t10_ZH_CN BITMAP "img/zh_cn/T10.bmp" +t11_ZH_CN BITMAP "img/zh_cn/T11.bmp" +t12_ZH_CN BITMAP "img/zh_cn/T12.bmp" +t13_ZH_CN BITMAP "img/zh_cn/T13.bmp" +t14_ZH_CN BITMAP "img/zh_cn/T14.bmp" +t15_ZH_CN BITMAP "img/zh_cn/T15.bmp" +t16_ZH_CN BITMAP "img/zh_cn/T16.bmp" +c1_ZH_CN BITMAP "img/zh_cn/C1.bmp" +c2_ZH_CN BITMAP "img/zh_cn/C2.bmp" +c3_ZH_CN BITMAP "img/zh_cn/C3.bmp" +c4_ZH_CN BITMAP "img/zh_cn/C4.bmp" +c5_ZH_CN BITMAP "img/zh_cn/C5.bmp" +c6_ZH_CN BITMAP "img/zh_cn/C6.bmp" +c7_ZH_CN BITMAP "img/zh_cn/C7.bmp" +s1_ZH_CN BITMAP "img/zh_cn/S1.bmp" +s2_ZH_CN BITMAP "img/zh_cn/S2.bmp" +s3_ZH_CN BITMAP "img/zh_cn/S3.bmp" +s4_ZH_CN BITMAP "img/zh_cn/S4.bmp" +save_ZH_CN BITMAP "img/zh_cn/SAVE.bmp" +final_ZH_CN BITMAP "img/zh_cn/FINAL.bmp" diff --git a/scripts/Game_Oneshot.rb b/scripts/Game_Oneshot.rb index 8966800..d349b65 100644 --- a/scripts/Game_Oneshot.rb +++ b/scripts/Game_Oneshot.rb @@ -12,7 +12,7 @@ class Game_Oneshot if $GDC @player_name = '' else - @player_name = Game_Oneshot.get_user_name + @player_name = Game_Oneshot.get_user_name.force_encoding("utf-8") end @lights = {} @plight_timer = nil diff --git a/scripts/Script.rb b/scripts/Script.rb index 46f53fe..d2cd09b 100644 --- a/scripts/Script.rb +++ b/scripts/Script.rb @@ -558,6 +558,77 @@ def check_exit(min, max, x: -1, y: -1) Script.tmp_s1 = $game_switches[11] ? false : result end +def loadQASave(fname) + filename = "testing_saves/" + fname + ".rxdata" + # If file doesn't exist + unless FileTest.exist?(filename) + filename = "testing_saves_postgame/" + fname + ".rxdata" + unless FileTest.exist?(filename) + # Play buzzer SE + $game_system.se_play($data_system.buzzer_se) + return + end + end + # Play load SE + $game_system.se_play($data_system.load_se) + + # Read save data + file = File.open(filename, "rb") + # Read character data for drawing save file + characters = Marshal.load(file) + # Read frame count for measuring play time + Graphics.frame_count = Marshal.load(file) + # Read each type of game object + $game_system = Marshal.load(file) + $game_switches = Marshal.load(file) + $game_variables = Marshal.load(file) + $game_self_switches = Marshal.load(file) + $game_screen = Marshal.load(file) + $game_actors = Marshal.load(file) + $game_party = Marshal.load(file) + $game_troop = Marshal.load(file) + $game_map = Marshal.load(file) + $game_player = Marshal.load(file) + $game_followers = Marshal.load(file) + $game_oneshot = Marshal.load(file) + $game_fasttravel = Marshal.load(file) + $game_temp.footstep_sfx = Marshal.load(file) + + # If magic number is different from when saving + # (if editing was added with editor) + if $game_system.magic_number != $data_system.magic_number + # Load map + $game_map.setup($game_map.map_id) + $game_player.center($game_player.x, $game_player.y) + end + # Refresh party members + $game_party.refresh + + f_prev = $game_player + for f in $game_followers + f.leader = f_prev + f.moveto($game_player.x, $game_player.y) + f_prev = f + end + file.close + # Restore BGM and BGS + $game_system.bgm_play($game_system.playing_bgm) + $game_system.bgs_play($game_system.playing_bgs) + # Update map (run parallel process event) + $game_map.update + # Switch to map screen + $scene = Scene_Map.new +end + +def kill_perma_flags + for i in 151..175 + $game_switches[i] = false + end + for i in 76..100 + $game_variables[i] = 0 + end +end + def bg(name) $game_map.bg_name = name end diff --git a/scripts/Window_Item.rb b/scripts/Window_Item.rb index a516763..43e8d6f 100644 --- a/scripts/Window_Item.rb +++ b/scripts/Window_Item.rb @@ -80,7 +80,7 @@ class Window_Item < Window_Selectable x = index % 2 * (self.width / COLUMN_MAX) y = index / 2 * 32 off = index == @index ? 2 : 0 - rect = Rect.new(x, y, self.width / COLUMN_MAX - 32, 32) + rect = Rect.new(x + 32, y, self.width / COLUMN_MAX - 64, 32) self.contents.draw_text(rect, item.name, 1) bitmap = RPG::Cache.icon(item.icon_name) diff --git a/scripts/Window_Message.rb b/scripts/Window_Message.rb index 54ec35e..d5e84d9 100644 --- a/scripts/Window_Message.rb +++ b/scripts/Window_Message.rb @@ -233,12 +233,7 @@ class Window_Message < Window_Selectable end if c == "\003" # new facepic - face_name = "" - c2 = @text.slice!(0) - while c2 != " " - face_name += c2 - c2 = @text.slice!(0) - end + face_name = @text.slice!(/^[^\s]+ */).strip() self.contents.fill_rect(self.contents.width - 96, 0, 96, 96, Color.new(0,0,0,0)) $game_temp.message_face = face_name if $game_player.character_name == "niko_gasmask" || $game_player.character_name == "niko_bulb_gasmask" \ diff --git a/scripts/Window_Settings.rb b/scripts/Window_Settings.rb index 0962e1a..b417568 100644 --- a/scripts/Window_Settings.rb +++ b/scripts/Window_Settings.rb @@ -3,9 +3,10 @@ class Window_Settings TITLE_TOP_MARGIN = 32 TITLE_MARGIN = 100 ITEM_SPACING = 28 + VALUE_MARGIN = 270 ACTIVE_MARGIN = MARGIN * 2 + 20 SETTINGS_FILE_NAME = Oneshot::SAVE_PATH + '/settings.conf' - + def save_settings $persistent.save File.open(SETTINGS_FILE_NAME, 'w') do |file| @@ -17,7 +18,7 @@ class Window_Settings file.puts('frameskip=' + Graphics.frameskip.to_s) end end - + def self.load_settings return false if !FileTest.exist?(SETTINGS_FILE_NAME) File.foreach(SETTINGS_FILE_NAME).with_index do |line, line_num| @@ -79,7 +80,7 @@ class Window_Settings Language.register_text_sprite(self.class.name + "_title", @title) @data_sprites = [] @viewport.z = 9998 - + @left_hold_timer = 0 @right_hold_timer = 0 @@ -130,17 +131,17 @@ class Window_Settings # Create menu options @data.each_with_index do |item, i| spr = Sprite.new(@viewport) - spr.bitmap = Bitmap.new(320, ITEM_SPACING) + spr.bitmap = Bitmap.new(400, ITEM_SPACING) spr.x = MARGIN spr.y = TITLE_MARGIN + TITLE_TOP_MARGIN + ITEM_SPACING * i spr.opacity = 0 Language.register_text_sprite(self.class.name + "_option_#{i}", spr) - redraw_setting(spr, i) - + redraw_setting(spr, i) + @data_sprites << spr end end - + def redraw_setting(spr, i) if @visible == false return @@ -150,36 +151,36 @@ class Window_Settings spr.bitmap.draw_text(0, 0, spr.bitmap.width, spr.bitmap.height, @data[i]) case i when 0 - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, Audio.bgm_volume.to_s) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, Audio.bgm_volume.to_s) when 1 - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, Audio.sfx_volume.to_s) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, Audio.sfx_volume.to_s) when 2 #fullscreen if(Graphics.fullscreen == true) - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, tr("ON")) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, tr("ON")) else - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, tr("OFF")) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, tr("OFF")) end when 3 #default movement if($game_switches[251] == true) - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, tr("RUN")) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, tr("RUN")) else - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, tr("WALK")) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, tr("WALK")) end when 4 #colorblind mode if($game_switches[252] == true) - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, tr("ON")) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, tr("ON")) else - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, tr("OFF")) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, tr("OFF")) end when 5 #frameskip if(Graphics.frameskip == true) - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, tr("ON")) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, tr("ON")) else - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, tr("OFF")) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, tr("OFF")) end when 6 # Language l = Language::LANGUAGES[@lang_index] rescue Language::LANGUAGES[0] - spr.bitmap.draw_text(260, 0, spr.bitmap.width, spr.bitmap.height, l) + spr.bitmap.draw_text(VALUE_MARGIN, 0, spr.bitmap.width, spr.bitmap.height, tr(l)) end end @@ -290,7 +291,7 @@ class Window_Settings else @right_hold_timer = 0 end - + case @index when 0 #bgm vol old_vol = Audio.bgm_volume @@ -309,7 +310,7 @@ class Window_Settings redraw_setting_index(0) end end - + when 1 #sfx vol old_vol = Audio.sfx_volume if Input.trigger?(Input::LEFT) || (Input.press?(Input::LEFT) && (@left_hold_timer >= 15)) @@ -327,10 +328,10 @@ class Window_Settings redraw_setting_index(1) end end - + when 2 #fullscreen if Input.trigger?(Input::ACTION) || Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT) - + $game_system.se_play($data_system.decision_se) if Graphics.fullscreen == true Graphics.fullscreen = false @@ -343,10 +344,10 @@ class Window_Settings redraw_setting_index(2) sleep(0.500) end - + when 3 #default movement if Input.trigger?(Input::ACTION) || Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT) - + $game_system.se_play($data_system.decision_se) if $game_switches[251] == true $game_switches[251] = false @@ -355,10 +356,10 @@ class Window_Settings end redraw_setting_index(3) end - + when 4 #colorblind mode if Input.trigger?(Input::ACTION) || Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT) - + $game_system.se_play($data_system.decision_se) if $game_switches[252] == true $game_switches[252] = false @@ -367,10 +368,10 @@ class Window_Settings end redraw_setting_index(4) end - + when 5 #frameskip if Input.trigger?(Input::ACTION) || Input.trigger?(Input::LEFT) || Input.trigger?(Input::RIGHT) - + $game_system.se_play($data_system.decision_se) if Graphics.frameskip == true Graphics.frameskip = false @@ -379,7 +380,7 @@ class Window_Settings end redraw_setting_index(5) end - + when 6 #language if Input.trigger?(Input::ACTION) || Input.trigger?(Input::RIGHT) @lang_index += 1 @@ -389,12 +390,12 @@ class Window_Settings $persistent.lang = Language::LANGUAGES[@lang_index] redraw_all_settings() end - if Input.trigger?(Input::LEFT) + if Input.trigger?(Input::LEFT) @lang_index -= 1 if @lang_index < 0 @lang_index = Language::LANGUAGES.length - 1 end - $persistent.lang = Language::LANGUAGES[@lang_index] + $persistent.lang = Language::LANGUAGES[@lang_index] redraw_all_settings() end end diff --git a/scripts/i18n_English.rb b/scripts/i18n_English.rb index db9382c..6f339a0 100644 --- a/scripts/i18n_English.rb +++ b/scripts/i18n_English.rb @@ -4,7 +4,7 @@ Font.default_name = Language::FONT_WESTERN class Language def self.create_input input = Window_NameInput.new - input.set_mode_buttons [['Upper', 'Lower']] + input.set_mode_buttons [[tr('Upper'), tr('Lower')]] input.character_tables = { [0] => [ # Case: Upper "A","B","C","D","E","F","G","H","I","J", diff --git a/scripts/i18n_Language.rb b/scripts/i18n_Language.rb index 6881250..657a1ed 100644 --- a/scripts/i18n_Language.rb +++ b/scripts/i18n_Language.rb @@ -33,6 +33,7 @@ class Language else Font.default_name = FONT_WESTERN end + Journal.setLang(name) end end end