From a81aa34411124e75f136a5f6de50e6089d32894e Mon Sep 17 00:00:00 2001 From: ZakatTeamI2P Date: Sun, 3 May 2026 20:21:29 +0400 Subject: [PATCH] Big fixes! --- binding-mri/filesystem-binding.cpp | 4 --- scripts/Game_Oneshot.rb | 2 +- scripts/Game_Picture.rb | 2 +- scripts/Interpreter_1.rb | 2 +- scripts/Interpreter_2.rb | 2 +- scripts/Puzzle_Safe.rb | 4 +-- scripts/SaveLoad.rb | 20 ++++++------ scripts/Scene_Map.rb | 2 +- scripts/Scene_Title.rb | 18 +++++------ scripts/Script.rb | 40 +++++++++++------------ scripts/Sprite_Character.rb | 2 +- scripts/Spriteset_Map.rb | 2 +- scripts/Window_Item.rb | 2 +- src/al-util.h | 14 +++----- src/font.cpp | 52 ++++++++++-------------------- 15 files changed, 70 insertions(+), 98 deletions(-) diff --git a/binding-mri/filesystem-binding.cpp b/binding-mri/filesystem-binding.cpp index 177de1d..194cf3e 100644 --- a/binding-mri/filesystem-binding.cpp +++ b/binding-mri/filesystem-binding.cpp @@ -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 { diff --git a/scripts/Game_Oneshot.rb b/scripts/Game_Oneshot.rb index b2a5478..feb1564 100644 --- a/scripts/Game_Oneshot.rb +++ b/scripts/Game_Oneshot.rb @@ -46,7 +46,7 @@ module Wallpaper locWallpaperFullPath = "Wallpaper/" + locWallpaper + ".png" end - if File.exists?(locWallpaperFullPath) + if File.exist?(locWallpaperFullPath) name = locWallpaper end diff --git a/scripts/Game_Picture.rb b/scripts/Game_Picture.rb index a8acc80..2bdb8e4 100644 --- a/scripts/Game_Picture.rb +++ b/scripts/Game_Picture.rb @@ -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 diff --git a/scripts/Interpreter_1.rb b/scripts/Interpreter_1.rb index 7ab73f6..2c886de 100644 --- a/scripts/Interpreter_1.rb +++ b/scripts/Interpreter_1.rb @@ -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 diff --git a/scripts/Interpreter_2.rb b/scripts/Interpreter_2.rb index f5498aa..c065fd9 100644 --- a/scripts/Interpreter_2.rb +++ b/scripts/Interpreter_2.rb @@ -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 diff --git a/scripts/Puzzle_Safe.rb b/scripts/Puzzle_Safe.rb index 64149dd..7fea1a1 100644 --- a/scripts/Puzzle_Safe.rb +++ b/scripts/Puzzle_Safe.rb @@ -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 diff --git a/scripts/SaveLoad.rb b/scripts/SaveLoad.rb index f578a1e..d2b0caa 100644 --- a/scripts/SaveLoad.rb +++ b/scripts/SaveLoad.rb @@ -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 diff --git a/scripts/Scene_Map.rb b/scripts/Scene_Map.rb index 6083390..bd6cdba 100644 --- a/scripts/Scene_Map.rb +++ b/scripts/Scene_Map.rb @@ -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) diff --git a/scripts/Scene_Title.rb b/scripts/Scene_Title.rb index 55ef0c0..f99ba23 100644 --- a/scripts/Scene_Title.rb +++ b/scripts/Scene_Title.rb @@ -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")) diff --git a/scripts/Script.rb b/scripts/Script.rb index ea13e50..c02cb1c 100644 --- a/scripts/Script.rb +++ b/scripts/Script.rb @@ -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 diff --git a/scripts/Sprite_Character.rb b/scripts/Sprite_Character.rb index d200981..df1e729 100644 --- a/scripts/Sprite_Character.rb +++ b/scripts/Sprite_Character.rb @@ -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 diff --git a/scripts/Spriteset_Map.rb b/scripts/Spriteset_Map.rb index 45bd05a..dc9080e 100644 --- a/scripts/Spriteset_Map.rb +++ b/scripts/Spriteset_Map.rb @@ -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) diff --git a/scripts/Window_Item.rb b/scripts/Window_Item.rb index 981dafd..02682c7 100644 --- a/scripts/Window_Item.rb +++ b/scripts/Window_Item.rb @@ -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) diff --git a/src/al-util.h b/src/al-util.h index 9587324..b360f1e 100644 --- a/src/al-util.h +++ b/src/al-util.h @@ -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; diff --git a/src/font.cpp b/src/font.cpp index a2d4552..73ae4d1 100644 --- a/src/font.cpp +++ b/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 &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 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 *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 &names) -{ +void Font::setName(const std::vector &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 &names, pickExistingFontName(names, FontPrivate::defaultName, sfs); } -const std::vector &Font::getInitialDefaultNames() -{ +const std::vector &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 &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);