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