[Solved] Widescreen script conversion

Started by MetalZelda, March 14, 2015, 07:31:36 am

Previous topic - Next topic

MetalZelda

March 14, 2015, 07:31:36 am Last Edit: March 14, 2015, 04:50:57 pm by MetalZelda
Hi

I wanna ask someone to port a VX script to VX ace, it is a Widescreen script. This was done by XRXS, it works in VX ace only if you delete a lot of lines in the script and so some scenes aren't widescreened properly.
This is the script, if anyone is interested by porting this script, it would be awesome

# ¤¤¤ XRXSv1. ƒI[ƒgƒŠƒTƒCƒU[^ƒƒCƒh ¤¤¤
#
# publish 2010/ 3/ 2
# update     -   /27
#
#
# ‰æ-ʃTƒCƒYÝ'è
 Graphics.resize_screen(640, 416)
#
#
#==============================================================================
# Ý'è
#==============================================================================
class Game_System
 attr_accessor :wide_screen
end
#==============================================================================
# ƒEƒBƒ"ƒhƒEƒTƒCƒYŽ©"®'²®
#==============================================================================
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
#==============================================================================
# ƒƒCƒh•â³ [Ä'è‹`]ŠÜ,Þ
#==============================================================================
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 À•W * 8
 CENTER_Y = (Graphics.height / 2 - 16) * 8     # ‰æ-Ê'†‰›,Ì Y À•W * 8
 def center(x, y)
   display_x = x * 256 - CENTER_X                    # À•W,ðŒvŽZ
   unless $game_map.loop_horizontal?                 # ‰¡,Ƀ‹[ƒv,µ,È,¢H
     max_x = ($game_map.width * 32  - Graphics.width) * 8            # Å'å'l,ðŒvŽZ
     display_x = [0, [display_x, max_x].min].max     # À•W,ðC³
   end
   display_y = y * 256 - CENTER_Y                    # À•W,ðŒvŽZ
   unless $game_map.loop_vertical?                   # c,Ƀ‹[ƒv,µ,È,¢H
     max_y = ($game_map.height * 32 - Graphics.height) * 8           # Å'å'l,ðŒvŽZ
     display_y = [0, [display_y, max_y].min].max     # À•W,ðC³
   end
   $game_map.set_display_pos(display_x, display_y)   # •\Ž¦ˆÊ'u•ÏX
 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
#==============================================================================
# [ƒGƒCƒŠƒAƒX] 'Ç‹L•"•ª
#==============================================================================
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
#==============================================================================
# --- ƒQ[ƒ€ƒI[ƒo[‰æ'œˆø,«L,Î,µ‹@"\ ---
#==============================================================================
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


Cheers

Blizzard

You should just try F0's resolution script if you want a different resolution for your game (regardless whether it's widescreen or not).
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.


KK20

Quote from: Blizzard on March 14, 2015, 01:07:32 pm
You should just try F0's resolution script if you want a different resolution for your game (regardless whether it's widescreen or not).

Quote from: MetalZelda on March 14, 2015, 07:31:36 am
I wanna ask someone to port a VX script to VX ace

Plus, he's more than aware of F0's and my XPA Tilemap script.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

MetalZelda

Quote from: KK20 on March 14, 2015, 04:07:33 pm
Quote from: Blizzard on March 14, 2015, 01:07:32 pm
You should just try F0's resolution script if you want a different resolution for your game (regardless whether it's widescreen or not).

Quote from: MetalZelda on March 14, 2015, 07:31:36 am
I wanna ask someone to port a VX script to VX ace

Plus, he's more than aware of F0's and my XPA Tilemap script.


It's been a while lèl, anyway, thank for the script, solved