Big fixes!
This commit is contained in:
parent
160f4ff8b6
commit
a81aa34411
|
|
@ -170,7 +170,6 @@ RB_METHOD(kernelSaveData){
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE stringForceUTF8(VALUE arg){
|
VALUE stringForceUTF8(VALUE arg){
|
||||||
printf("[stringForceUTF8] %s\n", rb_str_to_str(arg));
|
|
||||||
if (RB_TYPE_P(arg, RUBY_T_STRING)) {
|
if (RB_TYPE_P(arg, RUBY_T_STRING)) {
|
||||||
/* If current encoding is ASCII-8BIT (binary), associate UTF-8 so
|
/* If current encoding is ASCII-8BIT (binary), associate UTF-8 so
|
||||||
subsequent Ruby-level handling treats it as UTF-8. This preserves
|
subsequent Ruby-level handling treats it as UTF-8. This preserves
|
||||||
|
|
@ -184,8 +183,6 @@ VALUE stringForceUTF8(VALUE arg){
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE customProc(VALUE arg, VALUE proc){
|
VALUE customProc(VALUE arg, VALUE proc){
|
||||||
rb_p(arg);
|
|
||||||
rb_p(proc);
|
|
||||||
VALUE obj = stringForceUTF8(arg);
|
VALUE obj = stringForceUTF8(arg);
|
||||||
obj = rb_funcall2(proc, rb_intern("call"), 1, &obj);
|
obj = rb_funcall2(proc, rb_intern("call"), 1, &obj);
|
||||||
return obj;
|
return obj;
|
||||||
|
|
@ -197,7 +194,6 @@ RB_METHOD(_marshalLoad){
|
||||||
rb_scan_args(argc, argv, "01", &port, &proc);
|
rb_scan_args(argc, argv, "01", &port, &proc);
|
||||||
rb_p(proc);
|
rb_p(proc);
|
||||||
VALUE utf8Proc;
|
VALUE utf8Proc;
|
||||||
printf("[_marshalLoad] i fuckin hate it\n");
|
|
||||||
if (NIL_P(proc)) {
|
if (NIL_P(proc)) {
|
||||||
utf8Proc = rb_proc_new(RUBY_METHOD_FUNC(stringForceUTF8), Qnil);
|
utf8Proc = rb_proc_new(RUBY_METHOD_FUNC(stringForceUTF8), Qnil);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ module Wallpaper
|
||||||
locWallpaperFullPath = "Wallpaper/" + locWallpaper + ".png"
|
locWallpaperFullPath = "Wallpaper/" + locWallpaper + ".png"
|
||||||
end
|
end
|
||||||
|
|
||||||
if File.exists?(locWallpaperFullPath)
|
if File.exist?(locWallpaperFullPath)
|
||||||
name = locWallpaper
|
name = locWallpaper
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class Game_Picture
|
||||||
# in the appropriate language folder, else
|
# in the appropriate language folder, else
|
||||||
# default to the base graphics folder
|
# default to the base graphics folder
|
||||||
translation_name = "#{$persistent.langcode}/#{name}"
|
translation_name = "#{$persistent.langcode}/#{name}"
|
||||||
if File.exists?("Graphics/Pictures/#{translation_name}.png")
|
if File.exist?("Graphics/Pictures/#{translation_name}.png")
|
||||||
@name = translation_name
|
@name = translation_name
|
||||||
else
|
else
|
||||||
@name = name
|
@name = name
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ class Interpreter
|
||||||
# Initialize loop count
|
# Initialize loop count
|
||||||
@loop_count = 0
|
@loop_count = 0
|
||||||
# Loop
|
# Loop
|
||||||
loop do
|
while true
|
||||||
# Add 1 to loop count
|
# Add 1 to loop count
|
||||||
@loop_count += 1
|
@loop_count += 1
|
||||||
# If 100 event commands ran
|
# If 100 event commands ran
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ class Interpreter
|
||||||
# Get indent
|
# Get indent
|
||||||
indent = @list[@index].indent
|
indent = @list[@index].indent
|
||||||
# Loop
|
# Loop
|
||||||
loop do
|
while true
|
||||||
# If next event command is at the same level as indent
|
# If next event command is at the same level as indent
|
||||||
if @list[@index+1].indent == indent
|
if @list[@index+1].indent == indent
|
||||||
# Continue
|
# Continue
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ def safe_puzzle_write
|
||||||
end
|
end
|
||||||
doc_text = File.read(docTextFilePath)
|
doc_text = File.read(docTextFilePath)
|
||||||
|
|
||||||
Dir.mkdir(Oneshot::DOCS_PATH) unless File.exists?(Oneshot::DOCS_PATH)
|
Dir.mkdir(Oneshot::DOCS_PATH) unless File.exist?(Oneshot::DOCS_PATH)
|
||||||
File.open("#{Oneshot::DOCS_PATH}/DOCUMENT.oneshot.txt", 'w') do |file|
|
File.open("#{Oneshot::DOCS_PATH}/DOCUMENT.oneshot.txt", 'w') do |file|
|
||||||
file.puts(doc_text + $game_variables[20].to_s)
|
file.puts(doc_text + $game_variables[20].to_s)
|
||||||
end
|
end
|
||||||
|
|
@ -23,7 +23,7 @@ def safe_puzzle_postgame_write
|
||||||
end
|
end
|
||||||
doc_text = File.read(docTextFilePath)
|
doc_text = File.read(docTextFilePath)
|
||||||
|
|
||||||
Dir.mkdir(Oneshot::DOCS_PATH) unless File.exists?(Oneshot::DOCS_PATH)
|
Dir.mkdir(Oneshot::DOCS_PATH) unless File.exist?(Oneshot::DOCS_PATH)
|
||||||
File.open("#{Oneshot::DOCS_PATH}/DOCUMENT.oneshot.txt", 'w') do |file|
|
File.open("#{Oneshot::DOCS_PATH}/DOCUMENT.oneshot.txt", 'w') do |file|
|
||||||
file.puts(doc_text + $game_variables[20].to_s)
|
file.puts(doc_text + $game_variables[20].to_s)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ FAKE_SAVE_NAME = Oneshot::GAME_PATH + '/Oneshot/save_progress.oneshot'
|
||||||
|
|
||||||
|
|
||||||
def erase_game
|
def erase_game
|
||||||
File.delete(SAVE_FILE_NAME) unless !File.exists?(SAVE_FILE_NAME)
|
File.delete(SAVE_FILE_NAME) unless !File.exist?(SAVE_FILE_NAME)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fake_save
|
def fake_save
|
||||||
Dir.mkdir(Oneshot::GAME_PATH) unless File.exists?(Oneshot::GAME_PATH)
|
Dir.mkdir(Oneshot::GAME_PATH) unless File.exist?(Oneshot::GAME_PATH)
|
||||||
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot")
|
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exist?(Oneshot::GAME_PATH + "/Oneshot")
|
||||||
File.open(FAKE_SAVE_NAME, 'wb+') do |file|
|
File.open(FAKE_SAVE_NAME, 'wb+') do |file|
|
||||||
# Wrire frame count for measuring play time
|
# Wrire frame count for measuring play time
|
||||||
Marshal.dump(Graphics.frame_count, file)
|
Marshal.dump(Graphics.frame_count, file)
|
||||||
|
|
@ -44,24 +44,24 @@ def save
|
||||||
write_save(SAVE_FILE_NAME)
|
write_save(SAVE_FILE_NAME)
|
||||||
write_perma_flags(PERMA_FLAGS_NAME)
|
write_perma_flags(PERMA_FLAGS_NAME)
|
||||||
|
|
||||||
Dir.mkdir(Oneshot::SAVE_PATH + "/save_backups") unless File.exists?(Oneshot::SAVE_PATH + "/save_backups")
|
Dir.mkdir(Oneshot::SAVE_PATH + "/save_backups") unless File.exist?(Oneshot::SAVE_PATH + "/save_backups")
|
||||||
i = 5
|
i = 5
|
||||||
while i > 0
|
while i > 0
|
||||||
#delete save5.bk if it exists
|
#delete save5.bk if it exists
|
||||||
if File.exists?(Oneshot::SAVE_PATH + "/save_backups/save" + i.to_s + ".bk")
|
if File.exist?(Oneshot::SAVE_PATH + "/save_backups/save" + i.to_s + ".bk")
|
||||||
File.delete(Oneshot::SAVE_PATH + "/save_backups/save" + i.to_s + ".bk")
|
File.delete(Oneshot::SAVE_PATH + "/save_backups/save" + i.to_s + ".bk")
|
||||||
end
|
end
|
||||||
#delete p-settings5.bk if it exists
|
#delete p-settings5.bk if it exists
|
||||||
if File.exists?(Oneshot::SAVE_PATH + "/save_backups/p-settings" + i.to_s + ".bk")
|
if File.exist?(Oneshot::SAVE_PATH + "/save_backups/p-settings" + i.to_s + ".bk")
|
||||||
File.delete(Oneshot::SAVE_PATH + "/save_backups/p-settings" + i.to_s + ".bk")
|
File.delete(Oneshot::SAVE_PATH + "/save_backups/p-settings" + i.to_s + ".bk")
|
||||||
end
|
end
|
||||||
|
|
||||||
#rename save4.bk to save5.bk if save4.bk exists
|
#rename save4.bk to save5.bk if save4.bk exists
|
||||||
if File.exists?(Oneshot::SAVE_PATH + "/save_backups/save" + (i-1).to_s + ".bk")
|
if File.exist?(Oneshot::SAVE_PATH + "/save_backups/save" + (i-1).to_s + ".bk")
|
||||||
File.rename(Oneshot::SAVE_PATH + "/save_backups/save" + (i-1).to_s + ".bk", Oneshot::SAVE_PATH + "/save_backups/save" + i.to_s + ".bk" )
|
File.rename(Oneshot::SAVE_PATH + "/save_backups/save" + (i-1).to_s + ".bk", Oneshot::SAVE_PATH + "/save_backups/save" + i.to_s + ".bk" )
|
||||||
end
|
end
|
||||||
#rename p-settings4.bk to p-settings5.bk if save4.bk exists
|
#rename p-settings4.bk to p-settings5.bk if save4.bk exists
|
||||||
if File.exists?(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i-1).to_s + ".bk")
|
if File.exist?(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i-1).to_s + ".bk")
|
||||||
File.rename(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i-1).to_s + ".bk", Oneshot::SAVE_PATH + "/save_backups/p-settings" + i.to_s + ".bk" )
|
File.rename(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i-1).to_s + ".bk", Oneshot::SAVE_PATH + "/save_backups/p-settings" + i.to_s + ".bk" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -168,7 +168,7 @@ def load_perma_flags
|
||||||
puts "oops: #{e.message}"
|
puts "oops: #{e.message}"
|
||||||
EdText.err("p-settings.dat corrupt. Attempting to load backup.")
|
EdText.err("p-settings.dat corrupt. Attempting to load backup.")
|
||||||
for i in 1..6
|
for i in 1..6
|
||||||
if !File.exists?(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i).to_s + ".bk")
|
if !File.exist?(Oneshot::SAVE_PATH + "/save_backups/p-settings" + (i).to_s + ".bk")
|
||||||
EdText.err("All p-settings backups corrupt! Deleting corrupt p-settings file and shutting down.")
|
EdText.err("All p-settings backups corrupt! Deleting corrupt p-settings file and shutting down.")
|
||||||
File.delete(PERMA_FLAGS_NAME)
|
File.delete(PERMA_FLAGS_NAME)
|
||||||
Oneshot.allow_exit true
|
Oneshot.allow_exit true
|
||||||
|
|
@ -215,7 +215,7 @@ def real_load
|
||||||
puts "oops: #{e.message}"
|
puts "oops: #{e.message}"
|
||||||
EdText.err("save.dat corrupt. Attempting to load backup.")
|
EdText.err("save.dat corrupt. Attempting to load backup.")
|
||||||
for i in 1..6
|
for i in 1..6
|
||||||
if !File.exists?(Oneshot::SAVE_PATH + "/save_backups/save" + (i).to_s + ".bk")
|
if !File.exist?(Oneshot::SAVE_PATH + "/save_backups/save" + (i).to_s + ".bk")
|
||||||
EdText.err("All save backups corrupt! Deleting corrupt save and shutting down.")
|
EdText.err("All save backups corrupt! Deleting corrupt save and shutting down.")
|
||||||
File.delete(SAVE_FILE_NAME)
|
File.delete(SAVE_FILE_NAME)
|
||||||
Oneshot.allow_exit true
|
Oneshot.allow_exit true
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ class Scene_Map
|
||||||
else
|
else
|
||||||
name = $data_items[@item_id].icon_name
|
name = $data_items[@item_id].icon_name
|
||||||
translation_name = "#{$persistent.langcode}/#{name}"
|
translation_name = "#{$persistent.langcode}/#{name}"
|
||||||
if File.exists?("Graphics/Icons/#{translation_name}.png")
|
if File.exist?("Graphics/Icons/#{translation_name}.png")
|
||||||
@item_icon.bitmap = RPG::Cache.icon(translation_name)
|
@item_icon.bitmap = RPG::Cache.icon(translation_name)
|
||||||
else
|
else
|
||||||
@item_icon.bitmap = RPG::Cache.icon(name)
|
@item_icon.bitmap = RPG::Cache.icon(name)
|
||||||
|
|
|
||||||
|
|
@ -68,11 +68,11 @@ class Scene_Title
|
||||||
@menu = Sprite.new
|
@menu = Sprite.new
|
||||||
@menu.z += 1
|
@menu.z += 1
|
||||||
@menu.bitmap = Bitmap.new(640, 480)
|
@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, 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 + 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 + 50, 150, 24, tr("Exit"))
|
||||||
if $game_switches[160] && $game_switches[152]
|
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
|
end
|
||||||
Language.register_text_sprite(self.class.name + "_contents", @menu.bitmap)
|
Language.register_text_sprite(self.class.name + "_contents", @menu.bitmap)
|
||||||
# Make cursor graphic
|
# Make cursor graphic
|
||||||
|
|
@ -131,11 +131,11 @@ class Scene_Title
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
def update
|
def update
|
||||||
@menu.bitmap.clear
|
@menu.bitmap.clear
|
||||||
@menu.bitmap.draw_text(MENU_X, MENU_Y, 150, 24, tr("Start"))
|
# @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 + 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 + 50, 150, 24, tr("Exit"))
|
||||||
if $game_switches[160] && $game_switches[152]
|
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
|
end
|
||||||
# Handle cursor movement
|
# Handle cursor movement
|
||||||
if !@window_settings_title.visible
|
if !@window_settings_title.visible
|
||||||
|
|
@ -177,7 +177,7 @@ class Scene_Title
|
||||||
if !@window_settings_title.visible
|
if !@window_settings_title.visible
|
||||||
# Handle confirmation
|
# Handle confirmation
|
||||||
if Input.trigger?(Input::ACTION)
|
if Input.trigger?(Input::ACTION)
|
||||||
if File.exis?("badend.lock")
|
if File.exist?("badend.lock")
|
||||||
case @cursor_pos
|
case @cursor_pos
|
||||||
when 0 # Continue
|
when 0 # Continue
|
||||||
EdText.info(tr("Savior not found"))
|
EdText.info(tr("Savior not found"))
|
||||||
|
|
|
||||||
|
|
@ -396,8 +396,8 @@ module Script
|
||||||
|
|
||||||
def self.copy_journal
|
def self.copy_journal
|
||||||
# If the required directories don't exist, create them
|
# If the required directories don't exist, create them
|
||||||
Dir.mkdir(Oneshot::GAME_PATH) unless File.exists?(Oneshot::GAME_PATH)
|
Dir.mkdir(Oneshot::GAME_PATH) unless File.exist?(Oneshot::GAME_PATH)
|
||||||
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot")
|
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exist?(Oneshot::GAME_PATH + "/Oneshot")
|
||||||
begin
|
begin
|
||||||
# If we're on a supported Linux DE, make a .desktop file
|
# If we're on a supported Linux DE, make a .desktop file
|
||||||
# so the clover icon can be properly shown
|
# so the clover icon can be properly shown
|
||||||
|
|
@ -427,7 +427,7 @@ module Script
|
||||||
rescue Errno::EEXIST => e
|
rescue Errno::EEXIST => e
|
||||||
# this means that the journal file already exists, so no need to create it again
|
# this means that the journal file already exists, so no need to create it again
|
||||||
end
|
end
|
||||||
if File.exists?("README.txt")
|
if File.exist?("README.txt")
|
||||||
File.open("README.txt", "rb") do |input|
|
File.open("README.txt", "rb") do |input|
|
||||||
File.open(Oneshot::GAME_PATH + "/Oneshot/README.txt","wb") do |output|
|
File.open(Oneshot::GAME_PATH + "/Oneshot/README.txt","wb") do |output|
|
||||||
while buff = input.read(4096)
|
while buff = input.read(4096)
|
||||||
|
|
@ -439,16 +439,16 @@ module Script
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_boxes
|
def self.create_boxes
|
||||||
Dir.mkdir(Oneshot::GAME_PATH) unless File.exists?(Oneshot::GAME_PATH)
|
Dir.mkdir(Oneshot::GAME_PATH) unless File.exist?(Oneshot::GAME_PATH)
|
||||||
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot")
|
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot") unless File.exist?(Oneshot::GAME_PATH + "/Oneshot")
|
||||||
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/Portal1") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot/Portal1")
|
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/Portal1") unless File.exist?(Oneshot::GAME_PATH + "/Oneshot/Portal1")
|
||||||
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/Portal2") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot/Portal2")
|
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/Portal2") unless File.exist?(Oneshot::GAME_PATH + "/Oneshot/Portal2")
|
||||||
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/Portal3") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot/Portal3")
|
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/Portal3") unless File.exist?(Oneshot::GAME_PATH + "/Oneshot/Portal3")
|
||||||
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/BigPortal") unless File.exists?(Oneshot::GAME_PATH + "/Oneshot/BigPortal")
|
Dir.mkdir(Oneshot::GAME_PATH + "/Oneshot/BigPortal") unless File.exist?(Oneshot::GAME_PATH + "/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.exist?(f_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.clear_boxes
|
def self.clear_boxes
|
||||||
|
|
@ -521,7 +521,7 @@ module Script
|
||||||
locale = 'en'
|
locale = 'en'
|
||||||
end
|
end
|
||||||
source_dir = "Graphics/Fogs/_/scenario1/" + locale.downcase
|
source_dir = "Graphics/Fogs/_/scenario1/" + locale.downcase
|
||||||
Dir.mkdir(Oneshot::DOCS_PATH) unless File.exists?(Oneshot::DOCS_PATH)
|
Dir.mkdir(Oneshot::DOCS_PATH) unless File.exist?(Oneshot::DOCS_PATH)
|
||||||
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")
|
||||||
|
|
@ -534,7 +534,7 @@ module Script
|
||||||
locale = 'en'
|
locale = 'en'
|
||||||
end
|
end
|
||||||
source_dir = "Graphics/Fogs/_/scenario2/#{locale.downcase}"
|
source_dir = "Graphics/Fogs/_/scenario2/#{locale.downcase}"
|
||||||
Dir.mkdir(Oneshot::DOCS_PATH) unless File.exists?(Oneshot::DOCS_PATH)
|
Dir.mkdir(Oneshot::DOCS_PATH) unless File.exist?(Oneshot::DOCS_PATH)
|
||||||
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")
|
||||||
|
|
@ -543,10 +543,10 @@ module Script
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
def self.take_key_out_of_box(numb)
|
def self.take_key_out_of_box(numb)
|
||||||
if File.exists?(Oneshot::GAME_PATH + "/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png")
|
if File.exist?(Oneshot::GAME_PATH + "/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png")
|
||||||
File.delete(Oneshot::GAME_PATH + "/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png")
|
File.delete(Oneshot::GAME_PATH + "/Oneshot/Box" + numb.to_s + "/key" + numb.to_s + ".png")
|
||||||
end
|
end
|
||||||
if File.exists?(Oneshot::GAME_PATH + "/Oneshot/BigBox/key" + numb.to_s + ".png")
|
if File.exist?(Oneshot::GAME_PATH + "/Oneshot/BigBox/key" + numb.to_s + ".png")
|
||||||
File.delete(Oneshot::GAME_PATH + "/Oneshot/BigBox/key" + numb.to_s + ".png")
|
File.delete(Oneshot::GAME_PATH + "/Oneshot/BigBox/key" + numb.to_s + ".png")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -556,11 +556,11 @@ module Script
|
||||||
portal_path = Oneshot::GAME_PATH + "/Oneshot/Portal" + numb.to_s
|
portal_path = Oneshot::GAME_PATH + "/Oneshot/Portal" + numb.to_s
|
||||||
case numb
|
case numb
|
||||||
when 1
|
when 1
|
||||||
return File.exists?(portal_path + "/keyB.txt")
|
return File.exist?(portal_path + "/keyB.txt")
|
||||||
when 2
|
when 2
|
||||||
return File.exists?(portal_path + "/keyG.txt")
|
return File.exist?(portal_path + "/keyG.txt")
|
||||||
when 3
|
when 3
|
||||||
return File.exists?(portal_path + "/keyR.txt")
|
return File.exist?(portal_path + "/keyR.txt")
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
@ -569,11 +569,11 @@ module Script
|
||||||
portal_path = Oneshot::GAME_PATH + "/Oneshot/BigPortal"
|
portal_path = Oneshot::GAME_PATH + "/Oneshot/BigPortal"
|
||||||
case numb
|
case numb
|
||||||
when 1
|
when 1
|
||||||
return (File.exists?(portal_path + "/keyB.txt") or File.exists?(portal_path + "/Portal1/keyB.txt"))
|
return (File.exist?(portal_path + "/keyB.txt") or File.exist?(portal_path + "/Portal1/keyB.txt"))
|
||||||
when 2
|
when 2
|
||||||
return (File.exists?(portal_path + "/keyG.txt") or File.exists?(portal_path + "/Portal2/keyG.txt"))
|
return (File.exist?(portal_path + "/keyG.txt") or File.exist?(portal_path + "/Portal2/keyG.txt"))
|
||||||
when 3
|
when 3
|
||||||
return (File.exists?(portal_path + "/keyR.txt") or File.exists?(portal_path + "/Portal3/keyR.txt"))
|
return (File.exist?(portal_path + "/keyR.txt") or File.exist?(portal_path + "/Portal3/keyR.txt"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class Sprite_Character
|
||||||
else
|
else
|
||||||
name = @character.character_name
|
name = @character.character_name
|
||||||
translation_name = "#{$persistent.langcode}/#{name}"
|
translation_name = "#{$persistent.langcode}/#{name}"
|
||||||
if File.exists?("Graphics/Characters/#{translation_name}.png")
|
if File.exist?("Graphics/Characters/#{translation_name}.png")
|
||||||
@sprite.bitmap = RPG::Cache.character(translation_name,
|
@sprite.bitmap = RPG::Cache.character(translation_name,
|
||||||
@character.character_hue)
|
@character.character_hue)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class Spriteset_Map
|
||||||
@tilemap.tileset = nil
|
@tilemap.tileset = nil
|
||||||
else
|
else
|
||||||
translation_name = "#{$persistent.langcode}/#{$game_map.tileset_name}"
|
translation_name = "#{$persistent.langcode}/#{$game_map.tileset_name}"
|
||||||
if File.exists?("Graphics/Tilesets/#{translation_name}.png")
|
if File.exist?("Graphics/Tilesets/#{translation_name}.png")
|
||||||
@tilemap.tileset = RPG::Cache.tileset(translation_name)
|
@tilemap.tileset = RPG::Cache.tileset(translation_name)
|
||||||
else
|
else
|
||||||
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
|
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class Window_Item < Window_Selectable
|
||||||
self.contents.draw_text(rect, item.name, 1)
|
self.contents.draw_text(rect, item.name, 1)
|
||||||
|
|
||||||
translation_name = "#{$persistent.langcode}/#{item.icon_name}"
|
translation_name = "#{$persistent.langcode}/#{item.icon_name}"
|
||||||
if File.exists?("Graphics/Icons/#{translation_name}.png")
|
if File.exist?("Graphics/Icons/#{translation_name}.png")
|
||||||
bitmap = RPG::Cache.icon(translation_name)
|
bitmap = RPG::Cache.icon(translation_name)
|
||||||
else
|
else
|
||||||
bitmap = RPG::Cache.icon(item.icon_name)
|
bitmap = RPG::Cache.icon(item.icon_name)
|
||||||
|
|
|
||||||
|
|
@ -170,19 +170,14 @@ namespace Source
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint8_t formatSampleSize(int sdlFormat){
|
inline uint8_t formatSampleSize(int sdlFormat){
|
||||||
switch (sdlFormat)
|
switch (sdlFormat){
|
||||||
{
|
|
||||||
case SDL_AUDIO_U8 :
|
case SDL_AUDIO_U8 :
|
||||||
case SDL_AUDIO_S8 :
|
case SDL_AUDIO_S8 :
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
//removed from SDL3
|
case SDL_AUDIO_S16LE :
|
||||||
// case AUDIO_U16LSB :
|
case SDL_AUDIO_S16BE :
|
||||||
// case AUDIO_U16MSB :
|
return 2;
|
||||||
// case AUDIO_S16LSB :
|
|
||||||
// case AUDIO_S16MSB :
|
|
||||||
// return 2;
|
|
||||||
|
|
||||||
default :
|
default :
|
||||||
assert(!"Unhandled sample format");
|
assert(!"Unhandled sample format");
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +192,6 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount){
|
||||||
case 1 : return AL_FORMAT_MONO8;
|
case 1 : return AL_FORMAT_MONO8;
|
||||||
case 2 : return AL_FORMAT_STEREO8;
|
case 2 : return AL_FORMAT_STEREO8;
|
||||||
}
|
}
|
||||||
/* falls through */
|
|
||||||
case 2 :
|
case 2 :
|
||||||
switch (channelCount){
|
switch (channelCount){
|
||||||
case 1 : return AL_FORMAT_MONO16;
|
case 1 : return AL_FORMAT_MONO16;
|
||||||
|
|
|
||||||
52
src/font.cpp
52
src/font.cpp
|
|
@ -116,9 +116,7 @@ TTF_Font *SharedFontState::getFont(std::string family,
|
||||||
|
|
||||||
/* Find out if the font asset exists */
|
/* Find out if the font asset exists */
|
||||||
const FontSet &req = p->sets[family];
|
const FontSet &req = p->sets[family];
|
||||||
|
if (req.regular.empty() && req.other.empty()){
|
||||||
if (req.regular.empty() && req.other.empty())
|
|
||||||
{
|
|
||||||
/* Doesn't exist; use built-in font */
|
/* Doesn't exist; use built-in font */
|
||||||
family = "";
|
family = "";
|
||||||
}
|
}
|
||||||
|
|
@ -133,8 +131,7 @@ TTF_Font *SharedFontState::getFont(std::string family,
|
||||||
/* Not in pool; open new handle */
|
/* Not in pool; open new handle */
|
||||||
SDL_IOStream *ops;
|
SDL_IOStream *ops;
|
||||||
|
|
||||||
if (family.empty())
|
if (family.empty()){
|
||||||
{
|
|
||||||
throw Exception(Exception::RGSSError, "font does not exist");
|
throw Exception(Exception::RGSSError, "font does not exist");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -158,8 +155,7 @@ TTF_Font *SharedFontState::getFont(std::string family,
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SharedFontState::fontPresent(std::string family) const
|
bool SharedFontState::fontPresent(std::string family) const{
|
||||||
{
|
|
||||||
/* Check for substitutions */
|
/* Check for substitutions */
|
||||||
if (p->subs.contains(family))
|
if (p->subs.contains(family))
|
||||||
family = p->subs[family];
|
family = p->subs[family];
|
||||||
|
|
@ -190,8 +186,7 @@ void pickExistingFontName(const std::vector<std::string> &names,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct FontPrivate
|
struct FontPrivate{
|
||||||
{
|
|
||||||
std::string name;
|
std::string name;
|
||||||
int size;
|
int size;
|
||||||
bool bold;
|
bool bold;
|
||||||
|
|
@ -250,8 +245,7 @@ struct FontPrivate
|
||||||
sdlFont(other.sdlFont)
|
sdlFont(other.sdlFont)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void operator=(const FontPrivate &o)
|
void operator=(const FontPrivate &o){
|
||||||
{
|
|
||||||
name = o.name;
|
name = o.name;
|
||||||
size = o.size;
|
size = o.size;
|
||||||
bold = o.bold;
|
bold = o.bold;
|
||||||
|
|
@ -279,8 +273,7 @@ Color FontPrivate::defaultOutColorTmp(0, 0, 0, 128);
|
||||||
|
|
||||||
std::vector<std::string> FontPrivate::initialDefaultNames;
|
std::vector<std::string> FontPrivate::initialDefaultNames;
|
||||||
|
|
||||||
bool Font::doesExist(const char *name)
|
bool Font::doesExist(const char *name){
|
||||||
{
|
|
||||||
if (!name)
|
if (!name)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -298,31 +291,26 @@ Font::Font(const std::vector<std::string> *names,
|
||||||
p->name = FontPrivate::defaultName;
|
p->name = FontPrivate::defaultName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::Font(const Font &other)
|
Font::Font(const Font &other){
|
||||||
{
|
|
||||||
p = new FontPrivate(*other.p);
|
p = new FontPrivate(*other.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::~Font()
|
Font::~Font(){
|
||||||
{
|
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Font &Font::operator=(const Font &o)
|
const Font &Font::operator=(const Font &o){
|
||||||
{
|
|
||||||
*p = *o.p;
|
*p = *o.p;
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::setName(const std::vector<std::string> &names)
|
void Font::setName(const std::vector<std::string> &names){
|
||||||
{
|
|
||||||
pickExistingFontName(names, p->name, shState->fontState());
|
pickExistingFontName(names, p->name, shState->fontState());
|
||||||
p->sdlFont = 0;
|
p->sdlFont = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::setSize(int value)
|
void Font::setSize(int value){
|
||||||
{
|
|
||||||
if (p->size == value)
|
if (p->size == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -359,33 +347,28 @@ void Font::setDefaultName(const std::vector<std::string> &names,
|
||||||
pickExistingFontName(names, FontPrivate::defaultName, sfs);
|
pickExistingFontName(names, FontPrivate::defaultName, sfs);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string> &Font::getInitialDefaultNames()
|
const std::vector<std::string> &Font::getInitialDefaultNames(){
|
||||||
{
|
|
||||||
return FontPrivate::initialDefaultNames;
|
return FontPrivate::initialDefaultNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::initDynAttribs()
|
void Font::initDynAttribs(){
|
||||||
{
|
|
||||||
p->color = new Color(p->colorTmp);
|
p->color = new Color(p->colorTmp);
|
||||||
|
|
||||||
if (rgssVer >= 3)
|
if (rgssVer >= 3)
|
||||||
p->outColor = new Color(p->outColorTmp);;
|
p->outColor = new Color(p->outColorTmp);;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::initDefaultDynAttribs()
|
void Font::initDefaultDynAttribs(){
|
||||||
{
|
|
||||||
FontPrivate::defaultColor = new Color(FontPrivate::defaultColorTmp);
|
FontPrivate::defaultColor = new Color(FontPrivate::defaultColorTmp);
|
||||||
|
|
||||||
if (rgssVer >= 3)
|
if (rgssVer >= 3)
|
||||||
FontPrivate::defaultOutColor = new Color(FontPrivate::defaultOutColorTmp);
|
FontPrivate::defaultOutColor = new Color(FontPrivate::defaultOutColorTmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::initDefaults(const SharedFontState &sfs)
|
void Font::initDefaults(const SharedFontState &sfs){
|
||||||
{
|
|
||||||
std::vector<std::string> &names = FontPrivate::initialDefaultNames;
|
std::vector<std::string> &names = FontPrivate::initialDefaultNames;
|
||||||
|
|
||||||
switch (rgssVer)
|
switch (rgssVer){
|
||||||
{
|
|
||||||
case 1 :
|
case 1 :
|
||||||
// FIXME: Japanese version has "MS PGothic" instead
|
// FIXME: Japanese version has "MS PGothic" instead
|
||||||
names.push_back("Arial");
|
names.push_back("Arial");
|
||||||
|
|
@ -408,8 +391,7 @@ void Font::initDefaults(const SharedFontState &sfs)
|
||||||
FontPrivate::defaultShadow = (rgssVer == 2 ? true : false);
|
FontPrivate::defaultShadow = (rgssVer == 2 ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
TTF_Font *Font::getSdlFont()
|
TTF_Font *Font::getSdlFont(){
|
||||||
{
|
|
||||||
if (!p->sdlFont)
|
if (!p->sdlFont)
|
||||||
p->sdlFont = shState->fontState().getFont(p->name.c_str(),
|
p->sdlFont = shState->fontState().getFont(p->name.c_str(),
|
||||||
p->size);
|
p->size);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue