From c1fb09fcb53ca5682a2cc1cce38dbdbcfd38e5c7 Mon Sep 17 00:00:00 2001 From: tdixon Date: Tue, 1 Aug 2017 23:29:42 -0300 Subject: [PATCH 01/14] Use POSIX path separators --- scripts/Script.rb | 150 +++++++++++++++++++++++----------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/scripts/Script.rb b/scripts/Script.rb index 8288cb4..e60ec21 100644 --- a/scripts/Script.rb +++ b/scripts/Script.rb @@ -140,7 +140,7 @@ module Script end return false end - + def self.countdown_extend_over equinox = Time.new(2017, 03, 27) diff = equinox - Time.now @@ -149,7 +149,7 @@ module Script end return false end - + def self.cdown_update(equinox) diff = equinox - Time.now if(diff < 0) @@ -217,7 +217,7 @@ module Script def self.countdown_update return cdown_update(Time.new(2017, 03, 27)) end - + def self.countdown_extend_update return cdown_update(Time.new(2017, 03, 27)) end @@ -254,7 +254,7 @@ module Script end end end - + def self.niko_reflection_enc_update for event in $game_map.events.values if event.name == "niko reflection" @@ -268,7 +268,7 @@ module Script if event.real_y > 19*128 event.real_y = 19*128 end - + if event.x > 14 event.x = 14 elsif event.x < 6 @@ -279,7 +279,7 @@ module Script elsif event.real_x < (6*128) + 32 event.real_x = (6*128) + 32 end - + event.direction = $game_player.direction event.pattern = $game_player.pattern case event.direction @@ -292,8 +292,8 @@ module Script end end end - - + + def self.niko_reflection_peng_update for event in $game_map.events.values if event.name == "niko reflection" @@ -307,7 +307,7 @@ module Script if event.real_y > 19*128 event.real_y = 19*128 end - + if event.x > 14 event.x = 14 elsif event.x < 6 @@ -318,7 +318,7 @@ module Script elsif event.real_x < (6*128) + 32 event.real_x = (6*128) + 32 end - + return end end @@ -373,11 +373,11 @@ module Script end def self.copy_journal - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games") unless File.exists?(Oneshot::DOCS_PATH + "/My Games") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot") begin File.open("_______.exe", "rb") do |input| - File.open(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\_______.exe","wb") do |output| + File.open(Oneshot::DOCS_PATH + "/My Games/Oneshot/_______.exe","wb") do |output| while buff = input.read(4096) output.write(buff) end @@ -388,7 +388,7 @@ module Script end if File.exists?("README.txt") File.open("README.txt", "rb") do |input| - File.open(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\README.txt","wb") do |output| + File.open(Oneshot::DOCS_PATH + "/My Games/Oneshot/README.txt","wb") do |output| while buff = input.read(4096) output.write(buff) end @@ -396,43 +396,43 @@ module Script end end end - + def self.create_boxes - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal1") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal2") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal3") - Dir.mkdir(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal") unless File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games") unless File.exists?(Oneshot::DOCS_PATH + "/My Games") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal1") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal1") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal2") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal2") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal3") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal3") + Dir.mkdir(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal") end - + def self.delete_if_exists(f_name) File.delete(f_name) unless !File.exists?(f_name) end - + def self.clear_boxes for i in 1..3 - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + i.to_s + portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal" + i.to_s case i when 1 - delete_if_exists(portal_path + "\\blue_npc_prototype.png") - delete_if_exists(portal_path + "\\proto1.png") - delete_if_exists(portal_path + "\\keyB.txt") + delete_if_exists(portal_path + "/blue_npc_prototype.png") + delete_if_exists(portal_path + "/proto1.png") + delete_if_exists(portal_path + "/keyB.txt") when 2 - delete_if_exists(portal_path + "\\green_npc_cedric.png") - delete_if_exists(portal_path + "\\cedric.png") - delete_if_exists(portal_path + "\\keyG.txt") + delete_if_exists(portal_path + "/green_npc_cedric.png") + delete_if_exists(portal_path + "/cedric.png") + delete_if_exists(portal_path + "/keyG.txt") when 3 - delete_if_exists(portal_path + "\\red_rue.png") - delete_if_exists(portal_path + "\\rue.png") - delete_if_exists(portal_path + "\\keyR.txt") + delete_if_exists(portal_path + "/red_rue.png") + delete_if_exists(portal_path + "/rue.png") + delete_if_exists(portal_path + "/keyR.txt") end end - delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyB.txt") - delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyG.txt") - delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyR.txt") + delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyB.txt") + delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyG.txt") + delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyR.txt") end - + def self.copy_file(src, dst) begin File.open(src, "rb") do |input| @@ -446,79 +446,79 @@ module Script #this probably means the file already exists and is open, so no need to create it again end end - + def self.write_key(dst, str) File.open(dst, 'w') do |file| file.puts(str) end end - + def self.put_key_in_box(numb) - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s + portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal" + numb.to_s case numb when 1 - copy_file("Graphics\\Characters\\blue_npc_prototype.png", portal_path + "\\blue_npc_prototype.png") - copy_file("Graphics\\Faces\\proto1.png", portal_path + "\\proto1.png") - write_key(portal_path + "\\keyB.txt", PROTO_TEXT) + copy_file("Graphics/Characters/blue_npc_prototype.png", portal_path + "/blue_npc_prototype.png") + copy_file("Graphics/Faces/proto1.png", portal_path + "/proto1.png") + write_key(portal_path + "/keyB.txt", PROTO_TEXT) when 2 - copy_file("Graphics\\Characters\\green_npc_cedric.png", portal_path + "\\green_npc_cedric.png") - copy_file("Graphics\\Faces\\cedric.png", portal_path + "\\cedric.png") - write_key(portal_path + "\\keyG.txt", CEDRIC_TEXT) + copy_file("Graphics/Characters/green_npc_cedric.png", portal_path + "/green_npc_cedric.png") + copy_file("Graphics/Faces/cedric.png", portal_path + "/cedric.png") + write_key(portal_path + "/keyG.txt", CEDRIC_TEXT) when 3 - copy_file("Graphics\\Characters\\red_rue.png", portal_path + "\\red_rue.png") - copy_file("Graphics\\Faces\\rue.png", portal_path + "\\rue.png") - write_key(portal_path + "\\keyR.txt", RUE_TEXT) + copy_file("Graphics/Characters/red_rue.png", portal_path + "/red_rue.png") + copy_file("Graphics/Faces/rue.png", portal_path + "/rue.png") + write_key(portal_path + "/keyR.txt", RUE_TEXT) end - + end - + def self.password1 - copy_file("Graphics\\Fogs\\_\\scenario1\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") - copy_file("Graphics\\Fogs\\_\\scenario1\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") - copy_file("Graphics\\Fogs\\_\\scenario1\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") - copy_file("Graphics\\Fogs\\_\\scenario1\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") + copy_file("Graphics/Fogs/_/scenario1/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png") + copy_file("Graphics/Fogs/_/scenario1/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png") + copy_file("Graphics/Fogs/_/scenario1/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png") + copy_file("Graphics/Fogs/_/scenario1/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png") end - + def self.password2 - copy_file("Graphics\\Fogs\\_\\scenario2\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") - copy_file("Graphics\\Fogs\\_\\scenario2\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") - copy_file("Graphics\\Fogs\\_\\scenario2\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") - copy_file("Graphics\\Fogs\\_\\scenario2\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") + copy_file("Graphics/Fogs/_/scenario2/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png") + copy_file("Graphics/Fogs/_/scenario2/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png") + copy_file("Graphics/Fogs/_/scenario2/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png") + copy_file("Graphics/Fogs/_/scenario2/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png") end - + =begin def self.take_key_out_of_box(numb) - if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png") - File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Box" + numb.to_s + "\\key" + numb.to_s + ".png") + if File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png") + File.delete(Oneshot::DOCS_PATH + "/My Games/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png") end - if File.exists?(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png") - File.delete(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigBox\\key" + numb.to_s + ".png") + if File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigBox/key" + numb.to_s + ".png") + File.delete(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigBox/key" + numb.to_s + ".png") end end =end - + def self.is_key_in_box(numb) - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\Portal" + numb.to_s + portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/Portal" + numb.to_s case numb when 1 - return File.exists?(portal_path + "\\keyB.txt") + return File.exists?(portal_path + "/keyB.txt") when 2 - return File.exists?(portal_path + "\\keyG.txt") + return File.exists?(portal_path + "/keyG.txt") when 3 - return File.exists?(portal_path + "\\keyR.txt") + return File.exists?(portal_path + "/keyR.txt") end return false end - + def self.is_key_in_bigbox(numb) - portal_path = Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal" + portal_path = Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal" case numb when 1 - return File.exists?(portal_path + "\\keyB.txt") + return File.exists?(portal_path + "/keyB.txt") when 2 - return File.exists?(portal_path + "\\keyG.txt") + return File.exists?(portal_path + "/keyG.txt") when 3 - return File.exists?(portal_path + "\\keyR.txt") + return File.exists?(portal_path + "/keyR.txt") end return false end From 947f69d68c2728fd36fef2457079011f7192f6da Mon Sep 17 00:00:00 2001 From: tdixon Date: Tue, 1 Aug 2017 23:30:28 -0300 Subject: [PATCH 02/14] Use new jp font also return copies of translated strings --- scripts/i18n_Language.rb | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/i18n_Language.rb b/scripts/i18n_Language.rb index 657a1ed..881341c 100644 --- a/scripts/i18n_Language.rb +++ b/scripts/i18n_Language.rb @@ -7,14 +7,18 @@ class Language FONT_WESTERN = 'Terminus (TTF)' - FONT_CJK = 'WenQuanYi Micro Hei' + FONT_CK = 'WenQuanYi Micro Hei' + FONT_J = 'HigashiOme Gothic regular' LANG_WESTERN = [ 'en', 'fr', 'pt_BR', 'es' ] - LANG_CJK = [ - 'ja', 'ko', 'zh_CN' + LANG_J = [ + 'ja' ] - LANGUAGES = LANG_WESTERN + LANG_CJK + LANG_CK = [ + 'ko', 'zh_CN' + ] + LANGUAGES = LANG_WESTERN + LANG_CK + LANG_J class << self def set(lc) @@ -28,12 +32,15 @@ class Language if FileTest.exist?(path) File.open(path, "rb") do |file| @data = Marshal.load(file) - if LANG_CJK.include? name - Font.default_name = FONT_CJK + if LANG_CK.include? name + Font.default_name = FONT_CK + elsif LANG_J.include? name + Font.default_name = FONT_J else Font.default_name = FONT_WESTERN end Journal.setLang(name) + dbg_print(Font.default_name) end end end @@ -44,14 +51,13 @@ class Language # Translate some text def tr(string) #dbg_print(caller_locations(1, 1).first.tap{|loc| puts "#{loc.path}:#{loc.lineno}"}) - dbg_print(string) if @data rv = @data[Zlib::crc32(string)] || string else rv = string end - dbg_print(rv) - return rv + dbg_print(string + " -> " + rv) + return String.new(rv) end # Turn all database items into translatable strings From d5aa64d29b00c6292c751566f40191f589789d1d Mon Sep 17 00:00:00 2001 From: tdixon Date: Sat, 5 Aug 2017 23:12:45 -0300 Subject: [PATCH 03/14] Allow scrolling document messages --- scripts/Doc_Message.rb | 72 +++++++++++++++++++++++++++++++++------- scripts/Interpreter 3.rb | 6 +++- 2 files changed, 65 insertions(+), 13 deletions(-) diff --git a/scripts/Doc_Message.rb b/scripts/Doc_Message.rb index 26fd329..3f2b363 100644 --- a/scripts/Doc_Message.rb +++ b/scripts/Doc_Message.rb @@ -9,14 +9,26 @@ class Doc_Message def initialize @viewport = Viewport.new(0, 0, 640, 480) @sprite_bg = Sprite.new(@viewport) - if $game_switches[124] == true - @sprite_bg.bitmap = RPG::Cache.picture('lined_paper_red') - else + @sprite_scroll_up = Sprite.new(@viewport) + @sprite_scroll_down = Sprite.new(@viewport) + if $game_switches[124] == true + @sprite_bg.bitmap = RPG::Cache.picture('lined_paper_red') + @sprite_scroll_up.bitmap = RPG::Cache.picture('scroll_up_red') + @sprite_scroll_down.bitmap = RPG::Cache.picture('scroll_down_red') + else @sprite_bg.bitmap = RPG::Cache.picture('lined_paper_blue') #Bitmap.new(640, 480) - end + @sprite_scroll_up.bitmap = RPG::Cache.picture('scroll_up_blue') + @sprite_scroll_down.bitmap = RPG::Cache.picture('scroll_down_blue') + end @sprite_bg.zoom_x = @sprite_bg.zoom_y = 2 @sprite_bg.x = 120 @sprite_bg.y = 24 + @sprite_scroll_up.zoom_x = @sprite_scroll_up.zoom_y = 2 + @sprite_scroll_up.x = 524 + @sprite_scroll_up.y = 24 + @sprite_scroll_down.zoom_x = @sprite_scroll_down.zoom_y = 2 + @sprite_scroll_down.x = 524 + @sprite_scroll_down.y = 424 #@sprite_bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 128)) @sprite_text = Sprite.new(@viewport) @contents = Bitmap.new(200, 216) @@ -33,6 +45,11 @@ class Doc_Message @sprite_bg.opacity = 0 @sprite_text.opacity = 0 + @sprite_scroll_down.opacity = 0 + @sprite_scroll_up.opacity = 0 + + @y_offset = 0 + @scroll_limit = 0 # Animation flags @fade_in = false @@ -59,6 +76,7 @@ class Doc_Message $game_temp.message_proc = nil end $game_temp.message_doc_text = nil + @y_offset = 0 end #-------------------------------------------------------------------------- # * Refresh: Load new message text and pre-process it @@ -68,11 +86,11 @@ class Doc_Message text = '' y = -1 - if $game_switches[124] == true - @sprite_bg.bitmap = RPG::Cache.picture('lined_paper_red') - else + if $game_switches[124] == true + @sprite_bg.bitmap = RPG::Cache.picture('lined_paper_red') + else @sprite_bg.bitmap = RPG::Cache.picture('lined_paper_blue') #Bitmap.new(640, 480) - end + end # Pre-process text text_raw = $game_temp.message_doc_text.to_str @@ -92,7 +110,8 @@ class Doc_Message text_raw.gsub!("\\\\", "\\") # Now split text into lines by measuring text metrics - x = y = 0 + x = 0 + y = 1 maxwidth = @contents.width - HORIZ_MARGIN * 2 spacesize = @contents.text_size(' ') for i in text_raw.split(/ /) @@ -126,6 +145,11 @@ class Doc_Message end end + @scroll_limit = 11 - y + if @scroll_limit > 0 + @scroll_limit = 0 + end + # Prepare renderer @contents.clear @contents.font.color = Color.new(100, 92, 255, 255) @@ -133,7 +157,7 @@ class Doc_Message @contents.font.color = Color.new(255, 92, 100, 255) end x = 0 - y = 0 + y = 1 # Get 1 text character in c (loop until unable to get text) while ((c = text.slice!(/./m)) != nil) @@ -155,7 +179,7 @@ class Doc_Message next end # Draw text - @contents.draw_text(HORIZ_MARGIN + x, VERT_MARGIN + (y + 1) * 18 - spacesize.height, 40, 18, c) + @contents.draw_text(HORIZ_MARGIN + x, VERT_MARGIN + (y + @y_offset) * 18 - spacesize.height, 40, 18, c) # Add x to drawn text width x += @contents.text_size(c).width end @@ -176,7 +200,6 @@ class Doc_Message @viewport.visible = false $game_temp.message_window_showing = false end - return end # Handle fade-in effect @@ -189,6 +212,23 @@ class Doc_Message @fade_in = false $game_temp.message_window_showing = true end + end + + # set the scroll indicators to the opacity of the bg, + # or 0 if they cannot scroll further + if @y_offset < 0 + @sprite_scroll_up.opacity = @sprite_bg.opacity + else + @sprite_scroll_up.opacity = 0 + end + if @y_offset > @scroll_limit + @sprite_scroll_down.opacity = @sprite_bg.opacity + else + @sprite_scroll_down.opacity = 0 + end + + # don't perform control actions while fading msg box + if @fade_in || @fade_out return end @@ -197,6 +237,14 @@ class Doc_Message terminate_message @fade_out = true end + if Input.trigger?(Input::UP) && @y_offset < 0 + @y_offset += 1 + refresh() + end + if Input.trigger?(Input::DOWN) && @y_offset > @scroll_limit + @y_offset -= 1 + refresh() + end end # Message is over and should be hidden or advanced to next diff --git a/scripts/Interpreter 3.rb b/scripts/Interpreter 3.rb index 616d100..b255c64 100644 --- a/scripts/Interpreter 3.rb +++ b/scripts/Interpreter 3.rb @@ -11,7 +11,11 @@ class Interpreter #-------------------------------------------------------------------------- def command_101 # If other text has been set to message_text - if $game_temp.message_text != nil || $game_temp.message_ed_text != nil || $game_temp.message_doc_text != nil || $game_temp.message_desktop_text != nil || $game_temp.message_credits_text != nil + if $game_temp.message_text != nil || + $game_temp.message_ed_text != nil || + $game_temp.message_doc_text != nil || + $game_temp.message_desktop_text != nil || + $game_temp.message_credits_text != nil # End return false end From 50b59cf97c11cdc023ca0ed6a11d605ae918a89d Mon Sep 17 00:00:00 2001 From: tdixon Date: Sat, 5 Aug 2017 23:13:36 -0300 Subject: [PATCH 04/14] Fix recursive loop on debug reset --- scripts/RPG.rb | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/scripts/RPG.rb b/scripts/RPG.rb index 0a3bee3..1a18a88 100644 --- a/scripts/RPG.rb +++ b/scripts/RPG.rb @@ -42,17 +42,3 @@ class Tone self.red == 0 && self.green == 0 && self.blue == 0 && self.gray == 0 end end - -module Graphics - class << self - alias_method :update_native, :update - def update - #if $game_map.map_id == 97 - # Oneshot.allow_exit false - #elsif $game_system.map_interpreter - # Oneshot.allow_exit ($scene == nil) - #end - update_native - end - end -end From 442c16f93a3d998c8682b2015b007f0d3a4c62c8 Mon Sep 17 00:00:00 2001 From: tdixon Date: Sat, 5 Aug 2017 23:14:00 -0300 Subject: [PATCH 05/14] Make maptext sprites smaller in non-western langs --- scripts/Sprite_MapText.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/Sprite_MapText.rb b/scripts/Sprite_MapText.rb index e60c550..ad3b713 100644 --- a/scripts/Sprite_MapText.rb +++ b/scripts/Sprite_MapText.rb @@ -7,9 +7,14 @@ class Sprite_MapText < Sprite @real_x = x * 4 * 32 @real_y = y * 4 * 32 - self.zoom_x = 2 - self.zoom_y = 2 self.bitmap = Bitmap.new(200, 24) + if (Language::FONT_WESTERN == Font.default_name) + self.zoom_x = 2 + self.zoom_y = 2 + else + self.zoom_x = 1.5 + self.zoom_y = 1.5 + end #calculate text width spacewidth = self.bitmap.text_size(' ').width From 10e7e9b01f16dd95d8b39ed39f8e2c0bc772d29f Mon Sep 17 00:00:00 2001 From: tdixon Date: Wed, 23 Aug 2017 23:29:39 -0300 Subject: [PATCH 06/14] Allow journal to read lang from savefile --- journal/journal.pro | 2 +- journal/w32/journal.c | 55 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/journal/journal.pro b/journal/journal.pro index 44867c6..99224e6 100644 --- a/journal/journal.pro +++ b/journal/journal.pro @@ -62,7 +62,7 @@ win32 { w32/niko.c \ w32/journal.c - LIBS += -lgdi32 -lshlwapi + LIBS += -lgdi32 -lshell32 -luuid -lole32 RC_FILE = w32/resources.rc } diff --git a/journal/w32/journal.c b/journal/w32/journal.c index 52a09da..68b7736 100644 --- a/journal/w32/journal.c +++ b/journal/w32/journal.c @@ -1,5 +1,8 @@ +#define WINVER 0x0600 +#define _WIN32_WINNT 0x0600 #include -#include +#include +#include #include #define DEFAULT_WIDTH 800 @@ -67,7 +70,6 @@ LRESULT CALLBACK journal_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } // IPC thread -#include DWORD WINAPI ipc_thread(LPVOID lpParam) { (void)lpParam; @@ -110,20 +112,53 @@ DWORD WINAPI ipc_thread(LPVOID lpParam) return 0; } +// check if the file "My Documents/My Games/Oneshot/save_progress.oneshot" exist +// if not, load the "default" image background +// if it does exist, try to read the last 8.. or so.. bytes from the file. +// this (should) contain a string like [XX_XX] or [XX] indicating the user's +// language code. This will be apended with an underscore to "save" +// to give the localized image file IFF the lang str exists +void init_check_save(WCHAR* save_path) { + FILE* savefile = _wfopen(save_path, L"rb"); + char imgfile[16] = {0}; + char langbuf[9] = {0}; + char* openbrace = 0; + char* closebrace = 0; + if (savefile) { + strcpy(imgfile, "save"); + fseek(savefile, -8, SEEK_END); + fread(langbuf, 1, 8, savefile); + fclose(savefile); + + openbrace = strchr(langbuf, '['); + closebrace = strchr(langbuf, ']'); + if (openbrace && closebrace && openbrace < closebrace) { + //we very probably have a language code here. + //so, lets do some hacky string manipulation to + //name our image file + imgfile[4] = '_'; + strncpy(imgfile+5, openbrace+1, closebrace-(openbrace+1)); + } + + loadImage(imgfile); + } else { + loadImage("default"); + } +} + int do_journal() { - // Create - HINSTANCE module = GetModuleHandleW(NULL); + // Create + HINSTANCE module = GetModuleHandleW(NULL); // Default image WCHAR save_path[MAX_PATH]; - SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, 0, save_path); + PWSTR folder_path = NULL; + SHGetKnownFolderPath((REFKNOWNFOLDERID)&FOLDERID_Documents, 0, NULL, &folder_path); + wcscpy(save_path, folder_path); wcscat(save_path, L"\\My Games\\Oneshot\\save_progress.oneshot"); - if (PathFileExistsW(save_path)) { - loadImage("save"); - } else { - loadImage("default"); - } + CoTaskMemFree(folder_path); + init_check_save(save_path); // Initial image char message[IN_BUFFER_SIZE]; From 6c5246889719c301cbe986396e682c99827fe00e Mon Sep 17 00:00:00 2001 From: mshirt Date: Wed, 30 Aug 2017 23:53:45 -0700 Subject: [PATCH 07/14] Adding in other input options for Japanese players --- scripts/i18n_English.rb | 72 +++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/scripts/i18n_English.rb b/scripts/i18n_English.rb index 6f339a0..8b769bd 100644 --- a/scripts/i18n_English.rb +++ b/scripts/i18n_English.rb @@ -3,25 +3,57 @@ Font.default_name = Language::FONT_WESTERN class Language def self.create_input - input = Window_NameInput.new - input.set_mode_buttons [[tr('Upper'), tr('Lower')]] - input.character_tables = { - [0] => [ # Case: Upper - "A","B","C","D","E","F","G","H","I","J", - "K","L","M","N","O","P","Q","R","S","T", - "U","V","W","X","Y","Z"," ",".",",","-", - "0","1","2","3","4","5","6","7","8","9", - "!","?",'"',"'","/","&","[","]","(",")", - ], - [1] => [ # Case: Lower - "a","b","c","d","e","f","g","h","i","j", - "k","l","m","n","o","p","q","r","s","t", - "u","v","w","x","y","z"," ",".",",","-", - "0","1","2","3","4","5","6","7","8","9", - "!","?",'"',"'","/","&","[","]","(",")", - ], - } - input.table_height = 5 - input.init + if Font.default_name == FONT_J + input = Window_NameInput.new + input.ok_text = '決定' + input.set_mode_buttons [['かな', 'カナ', '英字']] + input.character_tables = { + [0] => [ # Hiragana + "ー","っ","ぁ","ぱ","ば","だ","ざ","が","わ","ら","や","ま","は","な","た","さ","か","あ", + "~","ゃ","ぃ","ぴ","び","ぢ","じ","ぎ"," ","り"," ","み","ひ","に","ち","し","き","い", + "・","ゅ","ぅ","ぷ","ぶ","づ","ず","ぐ","を","る","ゆ","む","ふ","ぬ","つ","す","く","う", + "=","ょ","ぇ","ぺ","べ","で","ぜ","げ"," ","れ"," ","め","へ","ね","て","せ","け","え", + "☆","ゎ","ぉ","ぽ","ぼ","ど","ぞ","ご","ん","ろ","よ","も","ほ","の","と","そ","こ","お", + ], + [1] => [ # Katakana + "ー","ッ","ァ","パ","バ","ダ","ザ","ガ","ワ","ラ","ヤ","マ","ハ","ナ","タ","サ","カ","ア", + "~","ャ","ィ","ピ","ビ","ヂ","ジ","ギ"," ","リ"," ","ミ","ヒ","ニ","チ","シ","キ","イ", + "・","ュ","ゥ","プ","ブ","ヅ","ズ","グ","ヲ","ル","ユ","ム","フ","ヌ","ツ","ス","ク","ウ", + "=","ョ","ェ","ペ","ベ","デ","ゼ","ゲ"," ","レ"," ","メ","ヘ","ネ","テ","セ","ケ","エ", + "☆","ヮ","ォ","ポ","ボ","ド","ゾ","ゴ","ン","ロ","ヨ","モ","ホ","ノ","ト","ソ","コ","オ", + ], + [2] => [ # Latin + "A","B","C","D","E","F","G","H","I","a","b","c","d","e","f","g","h","i", + "J","K","L","M","N","O","P","Q","R","j","k","l","m","n","o","p","q","r", + "S","T","U","V","W","X","Y","Z"," ","s","t","u","v","w","x","y","z"," ", + "0","1","2","3","4","+","-","=","&","!","?","'",'"',".",",",":",";","$", + "5","6","7","8","9","*","/","#","|","[","]","(",")","<",">","{","}","@", + ], + } + input.index = 17 # Start on あ + input.table_height = 5 + input.init + else + input = Window_NameInput.new + input.set_mode_buttons [[tr('Upper'), tr('Lower')]] + input.character_tables = { + [0] => [ # Case: Upper + "A","B","C","D","E","F","G","H","I","J", + "K","L","M","N","O","P","Q","R","S","T", + "U","V","W","X","Y","Z"," ",".",",","-", + "0","1","2","3","4","5","6","7","8","9", + "!","?",'"',"'","/","&","[","]","(",")", + ], + [1] => [ # Case: Lower + "a","b","c","d","e","f","g","h","i","j", + "k","l","m","n","o","p","q","r","s","t", + "u","v","w","x","y","z"," ",".",",","-", + "0","1","2","3","4","5","6","7","8","9", + "!","?",'"',"'","/","&","[","]","(",")", + ], + } + input.table_height = 5 + input.init + end end end From 0faee3d8f19d78d971073d2ef074d9cec9f8b1b4 Mon Sep 17 00:00:00 2001 From: mshirt Date: Wed, 30 Aug 2017 23:54:11 -0700 Subject: [PATCH 08/14] Fixing issue where some facepics would not be entity on post solstice replays --- scripts/RPG.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/RPG.rb b/scripts/RPG.rb index 1a18a88..33a6724 100644 --- a/scripts/RPG.rb +++ b/scripts/RPG.rb @@ -3,12 +3,16 @@ module RPG module Cache def self.character(filename, hue) + filename = filename.downcase if $game_switches[160] && filename.start_with?("niko") filename.gsub!(/niko/, "en") end self.load_bitmap("Graphics/Characters/", filename, hue) end def self.face(filename) + #lowercasing facepic name to be more case insensitive + #to catch the few instances where we use "Niko" instead of "niko" + filename = filename.downcase if $game_switches[160] && filename.start_with?("niko") filename.gsub!(/niko/, "en") end From 3ec401e18d11aa746637389cd9399a1a173e7715 Mon Sep 17 00:00:00 2001 From: mshirt Date: Wed, 30 Aug 2017 23:54:41 -0700 Subject: [PATCH 09/14] Fix to let journal.exe know which language page to display --- scripts/SaveLoad.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/SaveLoad.rb b/scripts/SaveLoad.rb index 8204e2b..c423928 100644 --- a/scripts/SaveLoad.rb +++ b/scripts/SaveLoad.rb @@ -32,6 +32,7 @@ def fake_save Marshal.dump($game_oneshot, file) Marshal.dump($game_fasttravel, file) Marshal.dump($game_temp.footstep_sfx , file) + file.puts('HeyNoxidHeresTheLanguage[' + $persistent.langcode + ']') end write_perma_flags(PERMA_FLAGS_NAME) end From 785ee492ccceebbf94c765fe5cac49b1bba68682 Mon Sep 17 00:00:00 2001 From: mshirt Date: Wed, 30 Aug 2017 23:57:01 -0700 Subject: [PATCH 10/14] Safeguard against the "plight_timer is nil" bug it's not a bug that ever happens in real/normal gameplay but testers run into it in debug runs sometimes and i'm not sure why --- scripts/Script.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/Script.rb b/scripts/Script.rb index 6f6565f..9ac70bf 100644 --- a/scripts/Script.rb +++ b/scripts/Script.rb @@ -737,6 +737,9 @@ def plight_start_timer end def plight_update_timer + if $game_oneshot.plight_timer == nil + plight_start_timer + end Script.tmp_v1 = ((Time.now - $game_oneshot.plight_timer) / 60).to_i end From 177de147260ad20a056d80fa7c452aba962da3d8 Mon Sep 17 00:00:00 2001 From: mshirt Date: Wed, 30 Aug 2017 23:57:37 -0700 Subject: [PATCH 11/14] An attempt to fix the issues caused by asian languages not having spaces --- scripts/Window_Message.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/Window_Message.rb b/scripts/Window_Message.rb index d5e84d9..5a4af1b 100644 --- a/scripts/Window_Message.rb +++ b/scripts/Window_Message.rb @@ -101,7 +101,12 @@ class Window_Message < Window_Selectable text.gsub!(/\\v\[([0-9]+)\]/) do $game_variables[$1.to_i] end - text.gsub!("\\p", $game_oneshot.player_name) + #add a space to the beginning of the player name to better deal with longer names in asian languages + if (Language::FONT_WESTERN == Font.default_name) + text.gsub!("\\p", $game_oneshot.player_name) + else + text.gsub!("\\p", " " + $game_oneshot.player_name) + end text.gsub!("\\n", "\n") # Handle text-rendering escape sequences text.gsub!(/\\c\[([0-9]+)\]/, "\0[\\1]") From 8b086c9985711e157e8c5b4085531016a890ff62 Mon Sep 17 00:00:00 2001 From: mshirt Date: Mon, 4 Sep 2017 19:56:39 -0700 Subject: [PATCH 12/14] Setting default char input for jap for the japanese release the default character input for names and passwords is now romaji --- scripts/i18n_English.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/i18n_English.rb b/scripts/i18n_English.rb index 8b769bd..27f3aa6 100644 --- a/scripts/i18n_English.rb +++ b/scripts/i18n_English.rb @@ -6,29 +6,29 @@ class Language if Font.default_name == FONT_J input = Window_NameInput.new input.ok_text = '決定' - input.set_mode_buttons [['かな', 'カナ', '英字']] + input.set_mode_buttons [['英字', 'かな', 'カナ']] input.character_tables = { - [0] => [ # Hiragana + [0] => [ # Latin + "A","B","C","D","E","F","G","H","I","a","b","c","d","e","f","g","h","i", + "J","K","L","M","N","O","P","Q","R","j","k","l","m","n","o","p","q","r", + "S","T","U","V","W","X","Y","Z"," ","s","t","u","v","w","x","y","z"," ", + "0","1","2","3","4","+","-","=","&","!","?","'",'"',".",",",":",";","$", + "5","6","7","8","9","*","/","#","|","[","]","(",")","<",">","{","}","@", + ], + [1] => [ # Hiragana "ー","っ","ぁ","ぱ","ば","だ","ざ","が","わ","ら","や","ま","は","な","た","さ","か","あ", "~","ゃ","ぃ","ぴ","び","ぢ","じ","ぎ"," ","り"," ","み","ひ","に","ち","し","き","い", "・","ゅ","ぅ","ぷ","ぶ","づ","ず","ぐ","を","る","ゆ","む","ふ","ぬ","つ","す","く","う", "=","ょ","ぇ","ぺ","べ","で","ぜ","げ"," ","れ"," ","め","へ","ね","て","せ","け","え", "☆","ゎ","ぉ","ぽ","ぼ","ど","ぞ","ご","ん","ろ","よ","も","ほ","の","と","そ","こ","お", ], - [1] => [ # Katakana + [2] => [ # Katakana "ー","ッ","ァ","パ","バ","ダ","ザ","ガ","ワ","ラ","ヤ","マ","ハ","ナ","タ","サ","カ","ア", "~","ャ","ィ","ピ","ビ","ヂ","ジ","ギ"," ","リ"," ","ミ","ヒ","ニ","チ","シ","キ","イ", "・","ュ","ゥ","プ","ブ","ヅ","ズ","グ","ヲ","ル","ユ","ム","フ","ヌ","ツ","ス","ク","ウ", "=","ョ","ェ","ペ","ベ","デ","ゼ","ゲ"," ","レ"," ","メ","ヘ","ネ","テ","セ","ケ","エ", "☆","ヮ","ォ","ポ","ボ","ド","ゾ","ゴ","ン","ロ","ヨ","モ","ホ","ノ","ト","ソ","コ","オ", ], - [2] => [ # Latin - "A","B","C","D","E","F","G","H","I","a","b","c","d","e","f","g","h","i", - "J","K","L","M","N","O","P","Q","R","j","k","l","m","n","o","p","q","r", - "S","T","U","V","W","X","Y","Z"," ","s","t","u","v","w","x","y","z"," ", - "0","1","2","3","4","+","-","=","&","!","?","'",'"',".",",",":",";","$", - "5","6","7","8","9","*","/","#","|","[","]","(",")","<",">","{","}","@", - ], } input.index = 17 # Start on あ input.table_height = 5 From f737790f2d83edb78b76f5990f833a3ee98afb87 Mon Sep 17 00:00:00 2001 From: mshirt Date: Mon, 4 Sep 2017 23:40:14 -0700 Subject: [PATCH 13/14] Now you can open the settings menu on the title --- scripts/Scene_Title.rb | 60 +++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/scripts/Scene_Title.rb b/scripts/Scene_Title.rb index 7243c58..51179e2 100644 --- a/scripts/Scene_Title.rb +++ b/scripts/Scene_Title.rb @@ -41,6 +41,8 @@ class Scene_Title end load_perma_flags Window_Settings.load_settings + + @window_settings_title = Window_Settings.new # Make title graphic @sprite = Sprite.new @sprite.bitmap = RPG::Cache.title($data_system.title_name) @@ -51,12 +53,14 @@ class Scene_Title @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")) if !$GDC - @menu.bitmap.draw_text(MENU_X, MENU_Y + 28, 150, 24, tr("Exit")) + @menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit")) end if $game_switches[160] && $game_switches[152] - @menu.bitmap.draw_text(MENU_X, MENU_Y + 56, 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 @cursor = Sprite.new @cursor.zoom_x = @cursor.zoom_y = 2 @@ -82,6 +86,7 @@ class Scene_Title Input.update # Frame update update + @window_settings_title.update # Abort loop if screen is changed if $scene != self break @@ -96,6 +101,7 @@ class Scene_Title @menu.dispose @cursor.bitmap.dispose @cursor.dispose + @window_settings_title.dispose Audio.bgm_fade(60) Graphics.transition(60) # Run automatic change for BGM and BGS set with map @@ -105,8 +111,17 @@ class Scene_Title # * Frame Update #-------------------------------------------------------------------------- def update - # Handle cursor movement + @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")) if !$GDC + @menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit")) + end + if $game_switches[160] && $game_switches[152] + @menu.bitmap.draw_text(MENU_X, MENU_Y + 75, 150, 24, tr("...")) + end + # Handle cursor movement + if !@window_settings_title.visible update_cursor = false if Input.trigger?(Input::UP) if @cursor_pos > 0 @@ -116,12 +131,12 @@ class Scene_Title elsif Input.trigger?(Input::DOWN) if $game_switches[160] && $game_switches[152] - if @cursor_pos < 2 + if @cursor_pos < 3 @cursor_pos += 1 update_cursor = true end else - if @cursor_pos < 1 + if @cursor_pos < 2 @cursor_pos += 1 update_cursor = true end @@ -138,23 +153,27 @@ class Scene_Title end if update_cursor Audio.se_play('Audio/SE/title_cursor.wav', 40) - @cursor.y = MENU_Y + (24 - @cursor.bitmap.height) / 2 + 24 * @cursor_pos + @cursor.y = MENU_Y + (24 - @cursor.bitmap.height) / 2 + 25 * @cursor_pos end end - # Handle confirmation - if Input.trigger?(Input::ACTION) - case @cursor_pos - when 0 # Continue - $game_switches[157] = false - command_continue - when 1 # Shutdown - command_shutdown - when 2 # memory - $game_switches[157] = true - command_continue + if !@window_settings_title.visible + # Handle confirmation + if Input.trigger?(Input::ACTION) + case @cursor_pos + when 0 # Continue + $game_switches[157] = false + command_continue + when 1 # Settings + command_settings + when 2 # Shutdown + command_shutdown + when 3 # memory + $game_switches[157] = true + command_continue + end end - end + end end #-------------------------------------------------------------------------- # * initialize a new game @@ -209,4 +228,9 @@ class Scene_Title # Shutdown $scene = nil end + + def command_settings + $game_system.se_play($data_system.decision_se) + @window_settings_title.open + end end From 0516ab9fa38822bafc2f98f691e35efc66a74892 Mon Sep 17 00:00:00 2001 From: mshirt Date: Wed, 6 Sep 2017 00:07:03 -0700 Subject: [PATCH 14/14] Translating the key.txt strings now --- scripts/Script.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/Script.rb b/scripts/Script.rb index 9ac70bf..0d76aa6 100644 --- a/scripts/Script.rb +++ b/scripts/Script.rb @@ -459,15 +459,15 @@ module Script when 1 copy_file("Graphics/Characters/blue_npc_prototype.png", portal_path + "/blue_npc_prototype.png") copy_file("Graphics/Faces/proto1.png", portal_path + "/proto1.png") - write_key(portal_path + "/keyB.txt", PROTO_TEXT) + write_key(portal_path + "/keyB.txt", tr(PROTO_TEXT)) when 2 copy_file("Graphics/Characters/green_npc_cedric.png", portal_path + "/green_npc_cedric.png") copy_file("Graphics/Faces/cedric.png", portal_path + "/cedric.png") - write_key(portal_path + "/keyG.txt", CEDRIC_TEXT) + write_key(portal_path + "/keyG.txt", tr(CEDRIC_TEXT)) when 3 copy_file("Graphics/Characters/red_rue.png", portal_path + "/red_rue.png") copy_file("Graphics/Faces/rue.png", portal_path + "/rue.png") - write_key(portal_path + "/keyR.txt", RUE_TEXT) + write_key(portal_path + "/keyR.txt", tr(RUE_TEXT)) end end