Merge pull request #12 from taedixon/localization

Fix mutating strings
This commit is contained in:
GIRakaCHEEZER 2017-08-05 23:27:39 -07:00 committed by GitHub
commit dc060a4b1d
6 changed files with 158 additions and 116 deletions

View file

@ -9,14 +9,26 @@ class Doc_Message
def initialize def initialize
@viewport = Viewport.new(0, 0, 640, 480) @viewport = Viewport.new(0, 0, 640, 480)
@sprite_bg = Sprite.new(@viewport) @sprite_bg = Sprite.new(@viewport)
if $game_switches[124] == true @sprite_scroll_up = Sprite.new(@viewport)
@sprite_bg.bitmap = RPG::Cache.picture('lined_paper_red') @sprite_scroll_down = Sprite.new(@viewport)
else 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) @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.zoom_x = @sprite_bg.zoom_y = 2
@sprite_bg.x = 120 @sprite_bg.x = 120
@sprite_bg.y = 24 @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_bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 128))
@sprite_text = Sprite.new(@viewport) @sprite_text = Sprite.new(@viewport)
@contents = Bitmap.new(200, 216) @contents = Bitmap.new(200, 216)
@ -33,6 +45,11 @@ class Doc_Message
@sprite_bg.opacity = 0 @sprite_bg.opacity = 0
@sprite_text.opacity = 0 @sprite_text.opacity = 0
@sprite_scroll_down.opacity = 0
@sprite_scroll_up.opacity = 0
@y_offset = 0
@scroll_limit = 0
# Animation flags # Animation flags
@fade_in = false @fade_in = false
@ -59,6 +76,7 @@ class Doc_Message
$game_temp.message_proc = nil $game_temp.message_proc = nil
end end
$game_temp.message_doc_text = nil $game_temp.message_doc_text = nil
@y_offset = 0
end end
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# * Refresh: Load new message text and pre-process it # * Refresh: Load new message text and pre-process it
@ -68,11 +86,11 @@ class Doc_Message
text = '' text = ''
y = -1 y = -1
if $game_switches[124] == true if $game_switches[124] == true
@sprite_bg.bitmap = RPG::Cache.picture('lined_paper_red') @sprite_bg.bitmap = RPG::Cache.picture('lined_paper_red')
else else
@sprite_bg.bitmap = RPG::Cache.picture('lined_paper_blue') #Bitmap.new(640, 480) @sprite_bg.bitmap = RPG::Cache.picture('lined_paper_blue') #Bitmap.new(640, 480)
end end
# Pre-process text # Pre-process text
text_raw = $game_temp.message_doc_text.to_str text_raw = $game_temp.message_doc_text.to_str
@ -92,7 +110,8 @@ class Doc_Message
text_raw.gsub!("\\\\", "\\") text_raw.gsub!("\\\\", "\\")
# Now split text into lines by measuring text metrics # Now split text into lines by measuring text metrics
x = y = 0 x = 0
y = 1
maxwidth = @contents.width - HORIZ_MARGIN * 2 maxwidth = @contents.width - HORIZ_MARGIN * 2
spacesize = @contents.text_size(' ') spacesize = @contents.text_size(' ')
for i in text_raw.split(/ /) for i in text_raw.split(/ /)
@ -126,6 +145,11 @@ class Doc_Message
end end
end end
@scroll_limit = 11 - y
if @scroll_limit > 0
@scroll_limit = 0
end
# Prepare renderer # Prepare renderer
@contents.clear @contents.clear
@contents.font.color = Color.new(100, 92, 255, 255) @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) @contents.font.color = Color.new(255, 92, 100, 255)
end end
x = 0 x = 0
y = 0 y = 1
# Get 1 text character in c (loop until unable to get text) # Get 1 text character in c (loop until unable to get text)
while ((c = text.slice!(/./m)) != nil) while ((c = text.slice!(/./m)) != nil)
@ -155,7 +179,7 @@ class Doc_Message
next next
end end
# Draw text # 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 # Add x to drawn text width
x += @contents.text_size(c).width x += @contents.text_size(c).width
end end
@ -176,7 +200,6 @@ class Doc_Message
@viewport.visible = false @viewport.visible = false
$game_temp.message_window_showing = false $game_temp.message_window_showing = false
end end
return
end end
# Handle fade-in effect # Handle fade-in effect
@ -189,6 +212,23 @@ class Doc_Message
@fade_in = false @fade_in = false
$game_temp.message_window_showing = true $game_temp.message_window_showing = true
end 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 return
end end
@ -197,6 +237,14 @@ class Doc_Message
terminate_message terminate_message
@fade_out = true @fade_out = true
end 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 end
# Message is over and should be hidden or advanced to next # Message is over and should be hidden or advanced to next

View file

@ -11,7 +11,11 @@ class Interpreter
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def command_101 def command_101
# If other text has been set to message_text # 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 # End
return false return false
end end

View file

@ -42,17 +42,3 @@ class Tone
self.red == 0 && self.green == 0 && self.blue == 0 && self.gray == 0 self.red == 0 && self.green == 0 && self.blue == 0 && self.gray == 0
end end
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

View file

@ -140,7 +140,7 @@ module Script
end end
return false return false
end end
def self.countdown_extend_over def self.countdown_extend_over
equinox = Time.new(2017, 03, 27) equinox = Time.new(2017, 03, 27)
diff = equinox - Time.now diff = equinox - Time.now
@ -149,7 +149,7 @@ module Script
end end
return false return false
end end
def self.cdown_update(equinox) def self.cdown_update(equinox)
diff = equinox - Time.now diff = equinox - Time.now
if(diff < 0) if(diff < 0)
@ -217,7 +217,7 @@ module Script
def self.countdown_update def self.countdown_update
return cdown_update(Time.new(2017, 03, 27)) return cdown_update(Time.new(2017, 03, 27))
end end
def self.countdown_extend_update def self.countdown_extend_update
return cdown_update(Time.new(2017, 03, 27)) return cdown_update(Time.new(2017, 03, 27))
end end
@ -254,7 +254,7 @@ module Script
end end
end end
end end
def self.niko_reflection_enc_update def self.niko_reflection_enc_update
for event in $game_map.events.values for event in $game_map.events.values
if event.name == "niko reflection" if event.name == "niko reflection"
@ -268,7 +268,7 @@ module Script
if event.real_y > 19*128 if event.real_y > 19*128
event.real_y = 19*128 event.real_y = 19*128
end end
if event.x > 14 if event.x > 14
event.x = 14 event.x = 14
elsif event.x < 6 elsif event.x < 6
@ -279,7 +279,7 @@ module Script
elsif event.real_x < (6*128) + 32 elsif event.real_x < (6*128) + 32
event.real_x = (6*128) + 32 event.real_x = (6*128) + 32
end end
event.direction = $game_player.direction event.direction = $game_player.direction
event.pattern = $game_player.pattern event.pattern = $game_player.pattern
case event.direction case event.direction
@ -292,8 +292,8 @@ module Script
end end
end end
end end
def self.niko_reflection_peng_update def self.niko_reflection_peng_update
for event in $game_map.events.values for event in $game_map.events.values
if event.name == "niko reflection" if event.name == "niko reflection"
@ -307,7 +307,7 @@ module Script
if event.real_y > 19*128 if event.real_y > 19*128
event.real_y = 19*128 event.real_y = 19*128
end end
if event.x > 14 if event.x > 14
event.x = 14 event.x = 14
elsif event.x < 6 elsif event.x < 6
@ -318,7 +318,7 @@ module Script
elsif event.real_x < (6*128) + 32 elsif event.real_x < (6*128) + 32
event.real_x = (6*128) + 32 event.real_x = (6*128) + 32
end end
return return
end end
end end
@ -373,11 +373,11 @@ module Script
end end
def self.copy_journal 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") 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") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot")
begin begin
File.open("_______.exe", "rb") do |input| 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) while buff = input.read(4096)
output.write(buff) output.write(buff)
end end
@ -388,7 +388,7 @@ module Script
end end
if File.exists?("README.txt") if File.exists?("README.txt")
File.open("README.txt", "rb") do |input| 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) while buff = input.read(4096)
output.write(buff) output.write(buff)
end end
@ -396,43 +396,43 @@ module Script
end end
end end
end end
def self.create_boxes 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") 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") 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/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/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/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/Oneshot/BigPortal") unless File.exists?(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal")
end end
def self.delete_if_exists(f_name) def self.delete_if_exists(f_name)
File.delete(f_name) unless !File.exists?(f_name) File.delete(f_name) unless !File.exists?(f_name)
end end
def self.clear_boxes def self.clear_boxes
for i in 1..3 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 case i
when 1 when 1
delete_if_exists(portal_path + "\\blue_npc_prototype.png") delete_if_exists(portal_path + "/blue_npc_prototype.png")
delete_if_exists(portal_path + "\\proto1.png") delete_if_exists(portal_path + "/proto1.png")
delete_if_exists(portal_path + "\\keyB.txt") delete_if_exists(portal_path + "/keyB.txt")
when 2 when 2
delete_if_exists(portal_path + "\\green_npc_cedric.png") delete_if_exists(portal_path + "/green_npc_cedric.png")
delete_if_exists(portal_path + "\\cedric.png") delete_if_exists(portal_path + "/cedric.png")
delete_if_exists(portal_path + "\\keyG.txt") delete_if_exists(portal_path + "/keyG.txt")
when 3 when 3
delete_if_exists(portal_path + "\\red_rue.png") delete_if_exists(portal_path + "/red_rue.png")
delete_if_exists(portal_path + "\\rue.png") delete_if_exists(portal_path + "/rue.png")
delete_if_exists(portal_path + "\\keyR.txt") delete_if_exists(portal_path + "/keyR.txt")
end end
end end
delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyB.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/keyG.txt")
delete_if_exists(Oneshot::DOCS_PATH + "\\My Games\\Oneshot\\BigPortal\\keyR.txt") delete_if_exists(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigPortal/keyR.txt")
end end
def self.copy_file(src, dst) def self.copy_file(src, dst)
begin begin
File.open(src, "rb") do |input| File.open(src, "rb") do |input|
@ -446,89 +446,89 @@ module Script
#this probably means the file already exists and is open, so no need to create it again #this probably means the file already exists and is open, so no need to create it again
end end
end end
def self.write_key(dst, str) def self.write_key(dst, str)
File.open(dst, 'w') do |file| File.open(dst, 'w') do |file|
file.puts(str) file.puts(str)
end end
end end
def self.put_key_in_box(numb) 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 case numb
when 1 when 1
copy_file("Graphics\\Characters\\blue_npc_prototype.png", portal_path + "\\blue_npc_prototype.png") copy_file("Graphics/Characters/blue_npc_prototype.png", portal_path + "/blue_npc_prototype.png")
copy_file("Graphics\\Faces\\proto1.png", portal_path + "\\proto1.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", PROTO_TEXT)
when 2 when 2
copy_file("Graphics\\Characters\\green_npc_cedric.png", portal_path + "\\green_npc_cedric.png") copy_file("Graphics/Characters/green_npc_cedric.png", portal_path + "/green_npc_cedric.png")
copy_file("Graphics\\Faces\\cedric.png", portal_path + "\\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", CEDRIC_TEXT)
when 3 when 3
copy_file("Graphics\\Characters\\red_rue.png", portal_path + "\\red_rue.png") copy_file("Graphics/Characters/red_rue.png", portal_path + "/red_rue.png")
copy_file("Graphics\\Faces\\rue.png", portal_path + "\\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", RUE_TEXT)
end end
end end
def self.password1 def self.password1
locale = $persistent.langcode locale = $persistent.langcode
if !Language::LANGUAGES.include? locale if !Language::LANGUAGES.include? locale
locale = 'en' locale = 'en'
end end
source_dir = "Graphics\\Fogs\\_\\scenario1\\" + locale.downcase source_dir = "Graphics/Fogs/_/scenario1/" + locale.downcase
copy_file(source_dir + "\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") copy_file(source_dir + "/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png")
copy_file(source_dir + "\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") copy_file(source_dir + "/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png")
copy_file(source_dir + "\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") copy_file(source_dir + "/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png")
copy_file(source_dir + "\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") copy_file(source_dir + "/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png")
end end
def self.password2 def self.password2
locale = $persistent.langcode locale = $persistent.langcode
if !Language::LANGUAGES.include? locale if !Language::LANGUAGES.include? locale
locale = 'en' locale = 'en'
end end
source_dir = "Graphics\\Fogs\\_\\scenario2\\" + locale.downcase source_dir = "Graphics/Fogs/_/scenario2/" + locale.downcase
copy_file(source_dir + "\\pw1.png", Oneshot::DOCS_PATH + "\\ONESHOT_password1.png") copy_file(source_dir + "/pw1.png", Oneshot::DOCS_PATH + "/ONESHOT_password1.png")
copy_file(source_dir + "\\pw2.png", Oneshot::DOCS_PATH + "\\ONESHOT_password2.png") copy_file(source_dir + "/pw2.png", Oneshot::DOCS_PATH + "/ONESHOT_password2.png")
copy_file(source_dir + "\\pw3.png", Oneshot::DOCS_PATH + "\\ONESHOT_password3.png") copy_file(source_dir + "/pw3.png", Oneshot::DOCS_PATH + "/ONESHOT_password3.png")
copy_file(source_dir + "\\pw4.png", Oneshot::DOCS_PATH + "\\ONESHOT_password4.png") copy_file(source_dir + "/pw4.png", Oneshot::DOCS_PATH + "/ONESHOT_password4.png")
end end
=begin =begin
def self.take_key_out_of_box(numb) 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") 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") File.delete(Oneshot::DOCS_PATH + "/My Games/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png")
end end
if File.exists?(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") File.delete(Oneshot::DOCS_PATH + "/My Games/Oneshot/BigBox/key" + numb.to_s + ".png")
end end
end end
=end =end
def self.is_key_in_box(numb) 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 case numb
when 1 when 1
return File.exists?(portal_path + "\\keyB.txt") return File.exists?(portal_path + "/keyB.txt")
when 2 when 2
return File.exists?(portal_path + "\\keyG.txt") return File.exists?(portal_path + "/keyG.txt")
when 3 when 3
return File.exists?(portal_path + "\\keyR.txt") return File.exists?(portal_path + "/keyR.txt")
end end
return false return false
end end
def self.is_key_in_bigbox(numb) 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 case numb
when 1 when 1
return File.exists?(portal_path + "\\keyB.txt") return File.exists?(portal_path + "/keyB.txt")
when 2 when 2
return File.exists?(portal_path + "\\keyG.txt") return File.exists?(portal_path + "/keyG.txt")
when 3 when 3
return File.exists?(portal_path + "\\keyR.txt") return File.exists?(portal_path + "/keyR.txt")
end end
return false return false
end end
@ -569,10 +569,10 @@ def check_exit(min, max, x: -1, y: -1)
end end
def loadQASave(fname) def loadQASave(fname)
filename = "testing_saves/" + fname + ".rxdata" filename = "testing_saves/" + fname + ".rxdata"
# If file doesn't exist # If file doesn't exist
unless FileTest.exist?(filename) unless FileTest.exist?(filename)
filename = "testing_saves_postgame/" + fname + ".rxdata" filename = "testing_saves_postgame/" + fname + ".rxdata"
unless FileTest.exist?(filename) unless FileTest.exist?(filename)
# Play buzzer SE # Play buzzer SE
$game_system.se_play($data_system.buzzer_se) $game_system.se_play($data_system.buzzer_se)
@ -581,7 +581,7 @@ def loadQASave(fname)
end end
# Play load SE # Play load SE
$game_system.se_play($data_system.load_se) $game_system.se_play($data_system.load_se)
# Read save data # Read save data
file = File.open(filename, "rb") file = File.open(filename, "rb")
# Read character data for drawing save file # Read character data for drawing save file

View file

@ -7,9 +7,14 @@ class Sprite_MapText < Sprite
@real_x = x * 4 * 32 @real_x = x * 4 * 32
@real_y = y * 4 * 32 @real_y = y * 4 * 32
self.zoom_x = 2
self.zoom_y = 2
self.bitmap = Bitmap.new(200, 24) 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 #calculate text width
spacewidth = self.bitmap.text_size(' ').width spacewidth = self.bitmap.text_size(' ').width

View file

@ -13,7 +13,7 @@ class Language
'en', 'fr', 'pt_BR', 'es' 'en', 'fr', 'pt_BR', 'es'
] ]
LANG_J = [ LANG_J = [
'ja' 'ja'
] ]
LANG_CK = [ LANG_CK = [
'ko', 'zh_CN' 'ko', 'zh_CN'
@ -34,13 +34,13 @@ class Language
@data = Marshal.load(file) @data = Marshal.load(file)
if LANG_CK.include? name if LANG_CK.include? name
Font.default_name = FONT_CK Font.default_name = FONT_CK
elsif LANG_J.include? name elsif LANG_J.include? name
Font.default_name = FONT_J Font.default_name = FONT_J
else else
Font.default_name = FONT_WESTERN Font.default_name = FONT_WESTERN
end end
Journal.setLang(name) Journal.setLang(name)
dbg_print(Font.default_name) dbg_print(Font.default_name)
end end
end end
end end
@ -51,14 +51,13 @@ class Language
# Translate some text # Translate some text
def tr(string) def tr(string)
#dbg_print(caller_locations(1, 1).first.tap{|loc| puts "#{loc.path}:#{loc.lineno}"}) #dbg_print(caller_locations(1, 1).first.tap{|loc| puts "#{loc.path}:#{loc.lineno}"})
dbg_print(string)
if @data if @data
rv = @data[Zlib::crc32(string)] || string rv = @data[Zlib::crc32(string)] || string
else else
rv = string rv = string
end end
dbg_print(rv) dbg_print(string + " -> " + rv)
return rv return String.new(rv)
end end
# Turn all database items into translatable strings # Turn all database items into translatable strings