Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Shanghai Simple Script - Final Fantasy 13 Main Menu
- # Last Date Updated: 2010.06.02
- # Level: Normal
- #
- # This makes your main menu ordered like Final Fantasy 13's.
- #
- # Converted by mikb89 to work for VX Ace.
- # UNOFFICIAL porting, all credits go to Shangai.
- #===============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["FinalFantasy13Menu"] = true
- module SSS
- # This is the image file for the menu background. Place this inside of the
- # Graphics\System folder.
- MENU_BACK_IMAGE = "MenuBack"
- # This is the image file used for the back of each of the menu items. This
- # image must be 160x24 pixels and placed inside of the Graphics\System folder.
- MENU_BACK_ITEM_IMAGE = "MenuBackItem"
- # This sets the menu help window's text color.
- MENU_HELP_TEXT_COLOR = Color.new(0, 0, 0)
- # This is the text format used to write out the current map.
- MENU_LOCATION = "Location: %s"
- # This hash sets the image files for your actors. These images must be placed
- # inside of the Graphics\System folder and they have to be 104x288 pixels.
- MENU_ACTOR_IMAGES ={
- 1 => "Charas",
- 2 => "Charas",
- 3 => "Charas",
- 4 => "Charas",
- } # Remove this and perish.
- # This hash sets what colors belong to which class when drawn.
- MENU_CLASS_COLORS ={
- 1 => 2,
- 2 => 6,
- 3 => 4,
- 4 => 5,
- } # Remove this and perish.
- # This sets the help window descripts for the menu commands.
- MENU_HELP_WINDOW ={
- "Oggetti" => "View and manage your party's items.",
- "Status" => "View a party member's status.",
- "Abilità" => "Manage a party member's skills.",
- "Equip." => "Manage a party member's equipment.",
- "Salva" => "Save your current progress.",
- "Esci" => "End the current game.",
- "System" => "Adjust the game's options.",
- } # Remove this and perish.
- # Let you choose how much member are visible in the main menu
- MAX_MENU_MEMBERS = 4
- end
- #===============================================================================
- # Override Main Menu Melody Settings
- #===============================================================================
- module YEM; module MENU
- USE_ICONS = false
- MENU_RIGHT_SIDE = false
- ON_SCREEN_MENU = false
- USE_MULTI_VARIABLE_WINDOW = false
- end; end
- #==============================================================================
- # ** Window_Base
- #==============================================================================
- class Window_Base < Window
- WLH = 24
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias initialize_sss_ff13_menu_window_base initialize unless $@
- def initialize(x, y, width, height)
- initialize_sss_ff13_menu_window_base(x, y, width, height)
- self.opacity = 0 if SceneManager.scene_is?(Scene_Menu)
- end
- end
- #==============================================================================
- # ** Window_MenuHelp
- #==============================================================================
- class Window_MenuHelp < Window_Help
- #--------------------------------------------------------------------------
- # * Set Text
- #--------------------------------------------------------------------------
- def set_text(text, align = 0)
- if text != @text or align != @align
- self.contents.clear
- self.contents.font.shadow = false
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
- @text = text
- @align = align
- end
- end
- end
- #==============================================================================
- # ** Window_MainMenuParty
- #==============================================================================
- class Window_MainMenuParty < Window_Selectable
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :pending_index # Pending position (for formation)
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y)
- super(x-24, y, Graphics.width-x+32, Graphics.height-y)
- @pending_index = -1
- self.active = false
- refresh
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return [SSS::MAX_MENU_MEMBERS, $game_party.members.size].max
- end
- #--------------------------------------------------------------------------
- # * Get Spacing for Items Arranged Side by Side
- #--------------------------------------------------------------------------
- def spacing
- return 0
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- return $game_party.members.size
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- create_contents
- for i in 0...item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- actor = $game_party.members[index]
- unless actor.nil?
- draw_item_background(index)
- draw_actor_image(actor, rect)
- draw_actor_name(actor, rect)
- draw_actor_icons(actor, rect.x, WLH*5/2, 96)
- draw_actor_class(actor, rect)
- draw_actor_level(actor, rect)
- draw_actor_hp(actor, rect)
- draw_actor_mp(actor, rect)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Background for Item
- #--------------------------------------------------------------------------
- def draw_item_background(index)
- if index == @pending_index
- contents.fill_rect(item_rect(index), pending_color)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Actor Image
- #--------------------------------------------------------------------------
- def draw_actor_image(actor, rect)
- filename = SSS::MENU_ACTOR_IMAGES[actor.id]
- return if filename.nil?
- bitmap = Cache.system(filename)
- image_rect = Rect.new(2, 2, rect.width-4, 284)
- self.contents.blt(rect.x+2, rect.y+2, bitmap, image_rect)
- end
- #--------------------------------------------------------------------------
- # * Draw Actor Name
- #--------------------------------------------------------------------------
- def draw_actor_name(actor, rect)
- name = actor.name
- self.contents.font.size = Font.default_size
- self.contents.font.color = normal_color
- self.contents.draw_text(rect.x+4, WLH*3/2, rect.width-8, WLH, name)
- end
- #--------------------------------------------------------------------------
- # * Draw Actor Class
- #--------------------------------------------------------------------------
- def draw_actor_class(actor, rect)
- name = actor.class.name
- self.contents.font.size = Font.default_size - 4
- color_id = SSS::MENU_CLASS_COLORS[actor.class.id].to_i
- self.contents.font.color = text_color(color_id)
- self.contents.draw_text(rect.x+4, WLH*0, rect.width-8, WLH, name, 2)
- end
- #--------------------------------------------------------------------------
- # * Draw Actor Level
- #--------------------------------------------------------------------------
- def draw_actor_level(actor, rect)
- self.contents.font.size = Font.default_size - 4
- self.contents.font.color = power_up_color
- yy = 288 - WLH*7/2 - 8
- self.contents.draw_text(rect.x+4, yy, rect.width-8, WLH, Vocab.level_a, 0)
- yy += WLH/2
- self.contents.font.color = normal_color
- self.contents.font.size += 2
- self.contents.draw_text(rect.x+4, yy, rect.width-8, WLH, actor.level, 2)
- end
- #--------------------------------------------------------------------------
- # * Draw Actor HP
- #--------------------------------------------------------------------------
- def draw_actor_hp(actor, rect)
- self.contents.font.size = Font.default_size - 4
- self.contents.font.color = hp_gauge_color2
- yy = 288 - WLH*5/2 - 4
- self.contents.draw_text(rect.x+4, yy, rect.width-8, WLH, Vocab.hp, 0)
- yy += WLH/2
- self.contents.font.color = normal_color
- self.contents.font.size += 2
- self.contents.draw_text(rect.x+4, yy, rect.width-8, WLH, actor.hp, 2)
- end
- #--------------------------------------------------------------------------
- # * Draw Actor MP
- #--------------------------------------------------------------------------
- def draw_actor_mp(actor, rect)
- self.contents.font.size = Font.default_size - 4
- self.contents.font.color = mp_gauge_color2
- yy = 288 - WLH*3/2
- self.contents.draw_text(rect.x+4, yy, rect.width-8, WLH, Vocab.mp, 0)
- yy += WLH/2
- self.contents.font.color = normal_color
- self.contents.font.size += 2
- self.contents.draw_text(rect.x+4, yy, rect.width-8, WLH, actor.mp, 2)
- end
- #--------------------------------------------------------------------------
- # * Item Rect
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = (contents.width + spacing) / col_max - spacing
- rect.height = 288
- rect.x = index % col_max * (rect.width + spacing)
- rect.y = index / col_max * WLH
- return rect
- end
- #--------------------------------------------------------------------------
- # * Processing When OK Button Is Pressed
- #--------------------------------------------------------------------------
- def process_ok
- super
- $game_party.menu_actor = $game_party.members[index]
- end
- #--------------------------------------------------------------------------
- # * Restore Previous Selection Position
- #--------------------------------------------------------------------------
- def select_last
- select($game_party.menu_actor.index || 0)
- end
- #--------------------------------------------------------------------------
- # * Set Pending Position (for Formation)
- #--------------------------------------------------------------------------
- def pending_index=(index)
- last_pending_index = @pending_index
- @pending_index = index
- redraw_item(@pending_index)
- redraw_item(last_pending_index)
- end
- end
- #==============================================================================
- # ** Window_MenuTimer
- #==============================================================================
- class Window_MenuTimer < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, Graphics.height - 60, 120, 56)
- self.contents.font.size = Font.default_size - 4
- self.contents.font.shadow = false
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- format = "%03d:%02d:%02d"
- @game_time = Graphics.frame_count / Graphics.frame_rate
- hours = @game_time / 3600
- minutes = @game_time / 60 % 60
- seconds = @game_time % 60
- text = sprintf(format, hours, minutes, seconds)
- self.contents.draw_text(0, 0, contents.width-4, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # * Update
- #--------------------------------------------------------------------------
- def update
- super
- refresh if @game_time != (Graphics.frame_count / Graphics.frame_rate)
- end
- end
- #==============================================================================
- # ** Window_MenuGold
- #==============================================================================
- class Window_MenuGold < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(100, Graphics.height - 60, 120, 56)
- self.contents.font.size = Font.default_size - 4
- self.contents.font.shadow = false
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- text = sprintf("%d%s", $game_party.gold, Vocab::currency_unit)
- self.contents.draw_text(0, 0, contents.width-4, WLH, text, 0)
- end
- end
- #==============================================================================
- # ** Window_MenuLocation
- #==============================================================================
- class Window_MenuLocation < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(Graphics.width/2-16, Graphics.height - 60, Graphics.width/2+16, 56)
- self.contents.font.size = Font.default_size - 4
- self.contents.font.shadow = false
- self.contents.font.color = SSS::MENU_HELP_TEXT_COLOR
- refresh
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- text = sprintf(SSS::MENU_LOCATION, $game_map.display_name)
- self.contents.draw_text(4, 0, contents.width, WLH, text, 0)
- end
- end
- #==============================================================================
- # ** Scene_Menu
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # * Start processing
- #--------------------------------------------------------------------------
- alias start_sss_ff13_menu start unless $@
- def start
- start_sss_ff13_menu
- create_background
- start_ff13_menu_style
- create_menu_back_items
- @command_window.z += 100000
- end
- #--------------------------------------------------------------------------
- # * Create Background for Menu Screen
- #--------------------------------------------------------------------------
- def create_background
- #~ @background_sprite = Sprite.new
- #~ @background_sprite.bitmap = Cache.system(SSS::MENU_BACK_IMAGE)
- #~ update_menu_backgroundsuper
- super
- @background_sprite.color.set(0, 0, 0, 0)
- b = Cache.system(SSS::MENU_BACK_IMAGE)
- @background_sprite.bitmap.blt(0,0,b,b.rect,128)
- end
- #--------------------------------------------------------------------------
- # * Create Menu Back Items
- #--------------------------------------------------------------------------
- def create_menu_back_items
- @menubackitem_sprite = Sprite.new(@viewport)
- @menubackitem_sprite.z -= 100000
- width = 160
- height = @command_window.height-32
- @menubackitem_sprite.bitmap = Bitmap.new(width, height)
- bitmap = Cache.system(SSS::MENU_BACK_ITEM_IMAGE)
- rect = Rect.new(0, 0, 160, 24)
- y = 0
- loop do
- break if y >= height
- @menubackitem_sprite.bitmap.blt(0, y, bitmap, rect)
- y += 24
- end
- @menubackitem_sprite.y = @command_window.y+16
- end
- #--------------------------------------------------------------------------
- # * Start Final Fantasy 13 Menu Style
- #--------------------------------------------------------------------------
- def start_ff13_menu_style
- @gold_window.dispose
- @gold_window = Window_MenuGold.new
- @menu_timer_window = Window_MenuTimer.new
- @location_window = Window_MenuLocation.new
- @help_window = Window_MenuHelp.new
- @help_window.x += 48
- @help_window.width -= 48
- @help_window.create_contents
- @help_window.contents.font.size = Font.default_size - 4
- @command_window.y = @help_window.height - 9
- @status_window.dispose
- x = @command_window.width
- y = @help_window.height-9
- @status_window = Window_MainMenuParty.new(x, y)
- @command_window.x -= 4
- @help_window.y += 12
- update_help
- end
- #--------------------------------------------------------------------------
- # * Update Help Window
- #--------------------------------------------------------------------------
- def update_help
- return if @help_window_index == @command_window.index
- @help_window_index = @command_window.index
- text = SSS::MENU_HELP_WINDOW[@command_window.command_name(@help_window_index)].to_s
- @help_window.set_text(text)
- end
- # Little addition to update help
- def update
- super
- update_help
- end
- end
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement