# ▽▽▽ XRXSv1. オートリサイザー/ワイド ▽▽▽ # # publish 2010/ 3/ 2 # update - /27 # # # 画面サイズ設定 Graphics.resize_screen(640, 416) # # #============================================================================== # 設定 #============================================================================== class Game_System attr_accessor :wide_screen end #============================================================================== # ウィンドウサイズ自動調整 #============================================================================== module XRXSV1_WindowResizeIntruding def initialize(x, y, width, height) original_width = width x_minus = 0 width_over = (x + width > 544 ? x + width - 544 : 0) if x < 0 x_minus = x x = 0 end x = x + ((Graphics.width - 544) * x / 544) y = y + ((Graphics.height - 416) * y / 416) if not self.is_a?(Window_Command) or self.is_a?(Window_TargetEnemy) width -= width_over width += x_minus width = width + ((Graphics.width - 544) * width / 544.0).ceil width -= x_minus width += width_over height = height + ((Graphics.height - 416) * height / 416.0).ceil end x += x_minus if $game_system.wide_screen m = [(Graphics.width - width) / 4, width / 4].min unless self.is_a?(Window_Command) m = (width - original_width) if (width - m) < original_width end width -= m n = [x / 4, m] .min x += n end super(x, y, width, height) end end class Window_Selectable < Window_Base include XRXSV1_WindowResizeIntruding end class Window_SaveFile < Window_Base include XRXSV1_WindowResizeIntruding end class Window_Help < Window_Base include XRXSV1_WindowResizeIntruding end class Window_SkillStatus < Window_Base include XRXSV1_WindowResizeIntruding end class Window_Status < Window_Base include XRXSV1_WindowResizeIntruding end class Window_NumberInput < Window_Base include XRXSV1_WindowResizeIntruding end class Window_EquipStatus < Window_Base include XRXSV1_WindowResizeIntruding end class Window_ShopStatus < Window_Base include XRXSV1_WindowResizeIntruding end class Window_Gold < Window_Base include XRXSV1_WindowResizeIntruding end #============================================================================== # ワイド補正 [再定義]含む #============================================================================== module XRXSV1_SpriteinWide def initialize(viewport) super(viewport) self.zoom_x = 0.75 if $game_system.wide_screen end end class Sprite_Battler < Sprite_Base include XRXSV1_SpriteinWide end class Sprite_BattleFloor < Sprite_Base #※ include XRXSV1_SpriteinWide end class Game_Picture alias xrxsv1_zoom_x zoom_x def zoom_x return xrxsv1_zoom_x * ($game_system.wide_screen ? 3 : 4) / 4 end end class Window_Base < Window def draw_actor_name(actor, x, y) width = [self.contents.text_size(actor.name).width+2, 108].min width = width * ($game_system.wide_screen ? 3 : 4) / 4 self.contents.font.color = hp_color(actor) self.contents.draw_text(x, y, width, WLH, actor.name) end def draw_actor_class(actor, x, y) width = [self.contents.text_size(actor.class.name).width+2, 108].min width = width * ($game_system.wide_screen ? 3 : 4) / 4 self.contents.font.color = normal_color self.contents.draw_text(x, y, width, WLH, actor.class.name) end def draw_actor_level(actor, x, y) width = 32 * ($game_system.wide_screen ? 3 : 4) / 4 self.contents.font.color = system_color self.contents.draw_text(x, y, width, WLH, Vocab::level_a) self.contents.font.color = normal_color self.contents.draw_text(x + width, y, width * 3 / 4, WLH, actor.level, 2) end def draw_item_name(item, x, y, enabled = true) if item != nil width = [self.contents.text_size(item.name).width+2, 172].min width = width * ($game_system.wide_screen ? 3 : 4) / 4 draw_icon(item.icon_index, x, y, enabled) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, width, WLH, item.name) end end end class Window_Command < Window_Selectable def draw_item(index, enabled = true) rect = item_rect(index) rect.x += 4 rect.width -= 8 self.contents.clear_rect(rect) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 rect.width = self.contents.text_size(@commands[index]).width rect.width = rect.width * ($game_system.wide_screen ? 3 : 4) / 4 self.contents.draw_text(rect, @commands[index]) end end #============================================================================== # [再定義] #============================================================================== class Game_Map def scroll_down(distance) if loop_vertical? @display_y += distance @display_y %= @map.height * 256 @parallax_y += distance else last_y = @display_y @display_y = [@display_y + distance, (height * 32 - Graphics.height) * 8].min @parallax_y += @display_y - last_y end end def scroll_right(distance) if loop_horizontal? @display_x += distance @display_x %= @map.width * 256 @parallax_x += distance else last_x = @display_x @display_x = [@display_x + distance, (width * 32 - Graphics.width) * 8].min @parallax_x += @display_x - last_x end end end class Game_Player < Game_Character CENTER_X = (Graphics.width / 2 - 16) * 8 # 画面中央の X 座標 * 8 CENTER_Y = (Graphics.height / 2 - 16) * 8 # 画面中央の Y 座標 * 8 def center(x, y) display_x = x * 256 - CENTER_X # 座標を計算 unless $game_map.loop_horizontal? # 横にループしない? max_x = ($game_map.width * 32 - Graphics.width) * 8 # 最大値を計算 display_x = [0, [display_x, max_x].min].max # 座標を修正 end display_y = y * 256 - CENTER_Y # 座標を計算 unless $game_map.loop_vertical? # 縦にループしない? max_y = ($game_map.height * 32 - Graphics.height) * 8 # 最大値を計算 display_y = [0, [display_y, max_y].min].max # 座標を修正 end $game_map.set_display_pos(display_x, display_y) # 表示位置変更 end end class Spriteset_Map def create_viewports @viewport1 = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport2 = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport3 = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport2.z = 50 @viewport3.z = 100 end end class Spriteset_Battle def create_viewports @viewport1 = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport2 = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport3 = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport2.z = 50 @viewport3.z = 100 end def create_battleback source = $game_temp.background_bitmap bitmap = Bitmap.new(640, 480) bitmap.stretch_blt(bitmap.rect, source, source.rect) #bitmap.radial_blur(90, 12) @battleback_sprite = Sprite.new(@viewport1) @battleback_sprite.bitmap = bitmap @battleback_sprite.ox = 320 @battleback_sprite.oy = 240 @battleback_sprite.x = Graphics.width / 2 @battleback_sprite.y = Graphics.height / 2 #(352 * Graphics.height / 416) / 2 #@battleback_sprite.wave_amp = 8 #@battleback_sprite.wave_length = 240 #@battleback_sprite.wave_speed = 120 end def create_battlefloor @battlefloor_sprite = Sprite_BattleFloor.new(@viewport1) # ※ @battlefloor_sprite.bitmap = Cache.system("BattleFloor") @battlefloor_sprite.x = Graphics.width / 2 @battlefloor_sprite.y = (192 * Graphics.height / 416) @battlefloor_sprite.z = 1 @battlefloor_sprite.ox = @battlefloor_sprite.bitmap.width / 2 @battlefloor_sprite.opacity = 128 @battlefloor_sprite.zoom_x = @battlefloor_sprite.zoom_x * Graphics.width / 544 end end class Scene_Battle < Scene_Base def create_info_viewport x = 128 * Graphics.width / 544 y = 288 * Graphics.height / 416 w = Graphics.width h = 128 * Graphics.height / 416 @info_viewport = Viewport.new(0, y, w, h) @info_viewport.z = 100 @status_window = Window_BattleStatus.new @party_command_window = Window_PartyCommand.new @actor_command_window = Window_ActorCommand.new @status_window.viewport = @info_viewport @party_command_window.viewport = @info_viewport @actor_command_window.viewport = @info_viewport @status_window.x = x @actor_command_window.x = Graphics.width @info_viewport.visible = false end def update_info_viewport x = 128 * Graphics.width / 544 @party_command_window.update @actor_command_window.update @status_window.update if @party_command_window.active and @info_viewport.ox > 0 @info_viewport.ox = [@info_viewport.ox - 16, 0].max elsif @actor_command_window.active and @info_viewport.ox < x @info_viewport.ox = [@info_viewport.ox + 16, x].min end end end #============================================================================== # [エイリアス] 追記部分 #============================================================================== class Game_Troop < Game_Unit alias xrxsv1_setup setup def setup(troop_id) xrxsv1_setup(troop_id) for enemy in @enemies enemy.screen_x = (enemy.screen_x * Graphics.width / 544) enemy.screen_y = (enemy.screen_y * Graphics.height / 416) end end end class Scene_Item < Scene_Base alias xrxsv1_hide_target_window hide_target_window def hide_target_window xrxsv1_hide_target_window @viewport.rect.set(0, 0, Graphics.width, Graphics.height) end alias xrxsv1_show_target_window show_target_window def show_target_window(right) xrxsv1_show_target_window(right) w = @viewport.rect.width - 544 + Graphics.width @viewport.rect.set(@viewport.rect.x, 0, w, Graphics.height) @target_window.x = right ? w : 0 end end class Scene_Skill < Scene_Base alias xrxsv1_hide_target_window hide_target_window def hide_target_window xrxsv1_hide_target_window @viewport.rect.set(0, 0, Graphics.width, Graphics.height) end alias xrxsv1_show_target_window show_target_window def show_target_window(right) xrxsv1_show_target_window(right) w = @viewport.rect.width - 544 + Graphics.width @viewport.rect.set(@viewport.rect.x, 0, w, Graphics.height) @target_window.x = right ? w : 0 end end class Scene_Title < Scene_Base alias xrxsv1_create_title_graphic create_title_graphic def create_title_graphic xrxsv1_create_title_graphic bitmap = Bitmap.new(Graphics.width, Graphics.height) bitmap.stretch_blt(bitmap.rect, @sprite.bitmap, @sprite.bitmap.rect) @sprite.bitmap = bitmap end alias xrxsv1_create_command_window create_command_window def create_command_window xrxsv1_create_command_window @command_window.x = (Graphics.width - @command_window.width) / 2 @command_window.y = (Graphics.height - @command_window.height) - 32 end end class Scene_End < Scene_Base alias xrxsv1_create_command_window create_command_window def create_command_window xrxsv1_create_command_window @command_window.x = (Graphics.width - @command_window.width) / 2 @command_window.y = (Graphics.height - @command_window.height) / 2 end end class Scene_Equip < Scene_Base alias xrxsv1_create_item_windows create_item_windows def create_item_windows xrxsv1_create_item_windows for i in 0...EQUIP_TYPE_MAX y = @item_windows[i].y y = y + ((Graphics.height - 416) * y / 416) @item_windows[i].y = y height = @item_windows[i].height height = height + ((Graphics.height - 416) * height / 416) @item_windows[i].height = height end end end #============================================================================== # --- ゲームオーバー画像引き伸ばし機能 --- #============================================================================== class Scene_Gameover < Scene_Base alias xrxsv1_create_gameover_graphic create_gameover_graphic def create_gameover_graphic xrxsv1_create_gameover_graphic @sprite.zoom_x = 1.0 * Graphics.width / @sprite.bitmap.width @sprite.zoom_y = 1.0 * Graphics.height / @sprite.bitmap.height end end