All pastes #401022 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-19 01:42 UTC
rendered paste body
#===================================================
# ¡ Ring Menu - Show Player Location - Release #1 (Enhanced By Dubealex)
#===================================================
# For more infos and update, visit:
# asylum.dubealex.com 
#
# Original Ring Menu by: ˜aŠó (From XRXS)
# Original Edit and Fix by: Maki
# Show Player Location Version by: Dubealex
#
# You can customize this script at line #35 - Have fun !!
# If you want to show more stuff, its easy to do, you can try to ask in the forum.
#
# alex@dubealex.com
#===================================================


#===================================================
# ¥ CLASS Scene_Menu Begins
#===================================================

class Scene_Menu
#--------------------------------------------------------------------------
# A?? ?I?u?W?F?N?gA?ñ?AoñAâ
#     menu_index : ?R?}?g?h?A??JA?[?\??A?ñ?Ao?A?fu
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
   @menu_index = menu_index
   $location_text=[]
   $window_size=[]
   $ring_menu_text=[]
   $chara_select=[]
   @window_opacity=[]
   @chara_select=[]
   @window_position=[]
   
    #--------------------------------------------------------------------------------------------------
    # ¡ Ring Menu Customization Section: (By Dubealex)
    #--------------------------------------------------------------------------------------------------
    # Those variables defines how the script will act.
    # Simply change the value by those you want.
    # Remember that changing the font size has its limitation due to text space allocation.
    #
    # ¥ TEXT SETTINGS FOR SHOW PLAYER LOCATION WINDOW:
    $location_text[0]="Times New Roman"      # Font Type
    $location_text[1]=17                # Font Size
    $location_text[2]=0                  # Location Title Color
    $location_text[4]=0                  # Map Name Color
    $location_text[3]="Location:"     # Customize the "Location" Title Text
    
    # ¥ SHOW LOCATION WINDOW SETTINS:
    @show_location_window=true                       #Set to false to not use it !
    @window_opacity[0]=255                             # Border Opacity
    @window_opacity[1]=130                             # Background Opacity
    $window_location_skin="wskin_x"            # Window Skin
    @window_position[0]=20                             # X Axis Position
    @window_position[1]=20                             # Y Axis Position
    $window_size[0]=160                                  # Lengh
    $window_size[1]=96                                    # Heigh
    
    # ¥  TEXT SETTINGS FOR INSIDE THE RING MENU:
    $ring_menu_text[0]="Times New Roman"      # Font Type
    $ring_menu_text[7]=4                  # Font Color
    $ring_menu_text[8]=22                # Font Size
    $ring_menu_text[1]="Items"         # Items Menu Text
    $ring_menu_text[2]="Magic"          # Skills Menu Text
    $ring_menu_text[3]="Equip"         # Equip Menu Text
    $ring_menu_text[4]="Stats"          # Stats Menu Text
    $ring_menu_text[5]="Save"          # Save Menu Text
    $ring_menu_text[6]="Quit"           # Quit Menu Text
    
    # ¥  CHARACTER SELECTION WINDOW SETTINGS :
    @chara_select[0]=400               # X Axis Position
    @chara_select[1]=0                  # Y Axis Position
    $chara_select[0]="Times New Roman"       # Font Type
    $chara_select[1]=0                   # Font Color
    $chara_select[5]=17                  # Font Size
    $chara_select[2]=255               # Window Border Opacity
    $chara_select[3]=130               # Window Background Opacity
    $chara_select[4]="wskin_x"  # Window Skin to use
   #---------------------------------------------------------------------------
   # Eiji Edit Starts
   while ($game_screen.tone.gray != 150)
     $game_screen.tone.gray += 1
   end
 end
 # Eiji Edit ends
#--------------------------------------------------------------------------
# A?? ?A??C?gA???A?
#--------------------------------------------------------------------------
def main  
   # ?X?v?ñ?C?g?Z?b?g?A‹A?AÊA?AÊ
   @spriteset = Spriteset_Map.new
   # ?R?}?g?h?E?B?g?h?E?A‹A?AÊA?AÊ
   px = $game_player.screen_x - 15
   py = $game_player.screen_y - 24
   @command_window = Window_RingMenu.new(px,py)
   @command_window.index = @menu_index
   # ?pA?[?e?BA?lA?h?Aa 0 A?l?A?A?AaA?ö
   if $game_party.actors.size == 0
     # ?A?C?e??A?A?X?L??A?Ae?hAƒÊA?A?X?eA?[?^?X?A‹?A3?ACñAâ
     @command_window.disable_item(0)
     @command_window.disable_item(1)
     @command_window.disable_item(2)
     @command_window.disable_item(3)
   end
   @command_window.z = 100
   # ?ZA?[?u?A??~?A?A?AaA?ö
   if $game_system.save_disabled
     # ?ZA?[?u?A‹?A3?AC?Añ?AE?Ac
     @command_window.disable_item(4)
   end
   # ?X?eA?[?^?X?E?B?g?h?E?A‹A?AÊA?AÊ
   @status_window = Window_RingMenuStatus.new
   @status_window.x = @chara_select[0]
   @status_window.y = @chara_select[1]
   @status_window.z = 200
   @status_window.opacity=$chara_select[2]
   @status_window.back_opacity=$chara_select[3]
   @status_window.visible = false
   # ?g?ñ?g?W?V?ö?g?A?A?s
   Graphics.transition
   # ?A??C?g??A?[?v
   loop do
     # ?QA?[??ñA|?A??A‹A?XA?V
     Graphics.update
     # gA??A?A?AR?A}?A‹A?XA?V
     Input.update
     # ?t??A?[??A?XA?V
     update
     # ñA|?A??AaA?A??ANeA??A*?A??A??A˜??A?[?v?A‹fõff
     if $scene != self
       break
     end
   end
   # ?g?ñ?g?W?V?ö?gA??hAƒÊ
   Graphics.freeze
   # ?X?v?ñ?C?g?Z?b?g?A‹ñA‹?Ao
   @spriteset.dispose
   @command_window.dispose
   @status_window.dispose
   # Eiji Saturation Edit Starts
   while ($game_screen.tone.gray != 0)
     $game_screen.tone.gray -= 1
   end
   # Edit ends
end
#--------------------------------------------------------------------------
# A?? ?t??A?[??A?XA?V
#--------------------------------------------------------------------------
def update
   @command_window.update
   @status_window.update
   # ?R?}?g?h?E?B?g?h?E?Aa?A?N?e?B?u?A?A?AaA?ö: update_command ?A‹?A??Ah
   if @command_window.active
     update_command
     return
   end
   # ?X?eA?[?^?X?E?B?g?h?E?Aa?A?N?e?B?u?A?A?AaA?ö: update_status ?A‹?A??Ah
   if @status_window.active
     update_status
     return
   end
end
#--------------------------------------------------------------------------
# A?? ?t??A?[??A?XA?V (?R?}?g?h?E?B?g?h?E?Aa?A?N?e?B?u?A?A?AaA?ö)
#--------------------------------------------------------------------------
def update_command
   # B ?{?^?g?Aañ??A3?Aa?A?A?AaA?ö
   if Input.trigger?(Input::B)
     # ?L???g?Z?? SE ?A‹ññet
     $game_system.se_play($data_system.cancel_se)
     # ?}?b?vñA|?A??AñA?A??ANeA??A|
     $scene = Scene_Map.new
     return
   end
   # C ?{?^?g?Aañ??A3?Aa?A?A?AaA?ö
   if Input.trigger?(Input::C)
     # ?pA?[?e?BA?lA?h?Aa 0 A?l?AcA?A?ZA?[?uA?A?QA?[??A?I?A1?A??O?A??R?}?g?h?A?A?AaA?ö
     if $game_party.actors.size == 0 and @command_window.index < 4
       # ?u?UA?[ SE ?A‹ññet
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # ?R?}?g?h?E?B?g?h?E?A??JA?[?\???A?fu?Ac?Aa?A2
     case @command_window.index
     when 0  # ?A?C?e??
       # ??fAN  SE ?A‹ññet
       $game_system.se_play($data_system.decision_se)
       # ?A?C?e??ñA|?A??AñA?A??ANeA??A|
       $scene = Scene_Item.new
     when 1  # ?X?L??
       # ??fAN SE ?A‹ññet
       $game_system.se_play($data_system.decision_se)
       # ?X?eA?[?^?X?E?B?g?h?E?A‹?A?N?e?B?u?Añ?AE?Ac
       @command_window.active = false
       @status_window.active = true
       @status_window.visible = true
       @status_window.index = 0
     when 2  # e?hAƒÊ
       # ??fAN SE ?A‹ññet
       $game_system.se_play($data_system.decision_se)
       # ?X?eA?[?^?X?E?B?g?h?E?A‹?A?N?e?B?u?Añ?AE?Ac
       @command_window.active = false
       @status_window.active = true
       @status_window.visible = true
       @status_window.index = 0
     when 3  # ?X?eA?[?^?X
       # ??fAN SE ?A‹ññet
       $game_system.se_play($data_system.decision_se)
       # ?X?eA?[?^?X?E?B?g?h?E?A‹?A?N?e?B?u?Añ?AE?Ac
       @command_window.active = false
       @status_window.active = true
       @status_window.visible = true
       @status_window.index = 0
     when 4  # ?ZA?[?u
       # ?ZA?[?u?A??~?A?A?AaA?ö
       if $game_system.save_disabled
         # ?u?UA?[ SE ?A‹ññet
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       # ??fAN SE ?A‹ññet
       $game_system.se_play($data_system.decision_se)
       # ?ZA?[?uñA|?A??AñA?A??ANeA??A|
       $scene = Scene_Save.new
     when 5  # ?QA?[??A?I?A1
       # ??fAN SE ?A‹ññet
       $game_system.se_play($data_system.decision_se)
       # ?QA?[??A?I?A1ñA|?A??AñA?A??ANeA??A|
       $scene = Scene_End.new
     end
     return
   end
   # ?A?j?A?A?[?V?ö?gfõ?A??A˜?JA?[?\???A?A???A??A‹A?s?A*?A??A‘
   return if @command_window.animation?
   # A?AaorA?Ac ?{?^?g?Aañ??A3?Aa?A?A?AaA?ö
   if Input.press?(Input::UP) or  Input.press?(Input::LEFT)
     $game_system.se_play($data_system.cursor_se)
     @command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
     return
   end
   # A?AáorA?AN ?{?^?g?Aañ??A3?Aa?A?A?AaA?ö
   if Input.press?(Input::DOWN) or  Input.press?(Input::RIGHT)
     $game_system.se_play($data_system.cursor_se)
     @command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
     return
   end
end
#--------------------------------------------------------------------------
# A?? ?t??A?[??A?XA?V (?X?eA?[?^?X?E?B?g?h?E?Aa?A?N?e?B?u?A?A?AaA?ö)
#--------------------------------------------------------------------------
def update_status
   # B ?{?^?g?Aañ??A3?Aa?A?A?AaA?ö
   if Input.trigger?(Input::B)
     # ?L???g?Z?? SE ?A‹ññet
     $game_system.se_play($data_system.cancel_se)
     # ?R?}?g?h?E?B?g?h?E?A‹?A?N?e?B?u?Añ?AE?Ac
     @command_window.active = true
     @status_window.active = false
     @status_window.visible = false
     @status_window.index = -1
     return
   end
   # C ?{?^?g?Aañ??A3?Aa?A?A?AaA?ö
   if Input.trigger?(Input::C)
     # ?R?}?g?h?E?B?g?h?E?A??JA?[?\???A?fu?Ac?Aa?A2
     case @command_window.index
     when 1  # ?X?L??
       # ?A}?A??A?N?^A?[?A?A?sgARA?A˜?A??Aa 2 ?A?A?A’?A?A?AaA?ö
       if $game_party.actors[@status_window.index].restriction >= 2
         # ?u?UA?[ SE ?A‹ññet
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       # ??fAN SE ?A‹ññet
       $game_system.se_play($data_system.decision_se)
       # ?X?L??ñA|?A??AñA?A??ANeA??A|
       $scene = Scene_Skill.new(@status_window.index)
     when 2  # e?hAƒÊ
       # ??fAN SE ?A‹ññet
       $game_system.se_play($data_system.decision_se)
       # e?hAƒÊñA|?A??AñA?A??ANeA??A|
       $scene = Scene_Equip.new(@status_window.index)
     when 3  # ?X?eA?[?^?X
       # ??fAN SE ?A‹ññet
       $game_system.se_play($data_system.decision_se)
       # ?X?eA?[?^?XñA|?A??AñA?A??ANeA??A|
       $scene = Scene_Status.new(@status_window.index)
     end
     return
   end
end
end

#===================================================
# £ CLASS Scene_Menu Ends
#===================================================


#===================================================
# ¥ CLASS Window_RingMenu  Begins
#===================================================
class Window_RingMenu < Window_Base
#--------------------------------------------------------------------------
# A?? ?N?ñ?XfANA?h
#--------------------------------------------------------------------------
STARTUP_FRAMES = 20 
MOVING_FRAMES = 5   
RING_R = 64        
ICON_ITEM   = RPG::Cache.icon("MI_item")
ICON_SKILL  = RPG::Cache.icon("MI_magic") 
ICON_EQUIP  = RPG::Cache.icon("MI_equip") 
ICON_STATUS = RPG::Cache.icon("MI_status") 
ICON_SAVE   = RPG::Cache.icon("MI_save") 
ICON_EXIT   = RPG::Cache.icon("MI_exit") 
ICON_DISABLE= RPG::Cache.icon("") 
SE_STARTUP = "056-Right02" 
MODE_START = 1 
MODE_WAIT  = 2 
MODE_MOVER = 3 
MODE_MOVEL = 4 
#--------------------------------------------------------------------------
# A?? ?A?N?Z?T
#--------------------------------------------------------------------------
attr_accessor :index
#--------------------------------------------------------------------------
# A?? ?I?u?W?F?N?gA?ñ?AoñAâ
#--------------------------------------------------------------------------
def initialize( center_x, center_y )
   super(0, 0, 640, 480)
   self.contents = Bitmap.new(width-32, height-32)
   self.contents.font.name = $ring_menu_text[0]
   self.contents.font.color = text_color($ring_menu_text[7]) 
   self.contents.font.size = $ring_menu_text[8]
   self.opacity = 0
   self.back_opacity = 0
   s1 = $ring_menu_text[1]
   s2 = $ring_menu_text[2]
   s3 = $ring_menu_text[3]
   s4 = $ring_menu_text[4]
   s5 = $ring_menu_text[5]
   s6 = $ring_menu_text[6]
   @commands = [ s1, s2, s3, s4, s5, s6 ]
   @item_max = 6
   @index = 0
   @items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ]
   @disabled = [ false, false, false, false, false, false ]
   @cx = center_x - 16
   @cy = center_y - 16
   setup_move_start
   refresh
end
#--------------------------------------------------------------------------
# A?? ?t??A?[??A?XA?V
#--------------------------------------------------------------------------
def update
   super
   refresh
end
#--------------------------------------------------------------------------
# A?? ñA|?A?A?A??`ñA|
#--------------------------------------------------------------------------
def refresh
   self.contents.clear
   # ?A?C?R?g?A‹?`ñA|
   case @mode
   when MODE_START
     refresh_start
   when MODE_WAIT
     refresh_wait
   when MODE_MOVER
     refresh_move(1)
   when MODE_MOVEL
     refresh_move(0)
   end
   # ?A?N?e?B?u?A??R?}?g?h?A??\?A|
   rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
   self.contents.draw_text(rect, @commands[@index],1)
end
#--------------------------------------------------------------------------
# A?? ñA|?A?A?A??`ñA|(A?ñ?AoñAâ??)
#--------------------------------------------------------------------------
def refresh_start
   d1 = 2.0 * Math::PI / @item_max
   d2 = 1.0 * Math::PI / STARTUP_FRAMES
   r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
   for i in 0...@item_max
     j = i - @index
     d = d1 * j + d2 * @steps
     x = @cx + ( r * Math.sin( d ) ).to_i
     y = @cy - ( r * Math.cos( d ) ).to_i
     draw_item(x, y, i)
   end
   @steps -= 1
   if @steps < 1
     @mode = MODE_WAIT
   end
end
#--------------------------------------------------------------------------
# A?? ñA|?A?A?A??`ñA|(eAf?@??)
#--------------------------------------------------------------------------
def refresh_wait
   d = 2.0 * Math::PI / @item_max
   for i in 0...@item_max
     j = i - @index
     x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
     y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
     draw_item(x, y, i)
   end
end
#--------------------------------------------------------------------------
# A?? ñA|?A?A?A??`ñA|(ñA}g]??)
#  mode : 0=hA????vñA}?AN 1=???vñA}?AN
#--------------------------------------------------------------------------
def refresh_move( mode )
   d1 = 2.0 * Math::PI / @item_max
   d2 = d1 / MOVING_FRAMES
   d2 *= -1 if mode != 0
   for i in 0...@item_max
     j = i - @index
     d = d1 * j + d2 * @steps
     x = @cx + ( RING_R * Math.sin( d ) ).to_i
     y = @cy - ( RING_R * Math.cos( d ) ).to_i
     draw_item(x, y, i)
   end
   @steps -= 1
   if @steps < 1
     @mode = MODE_WAIT
   end
end
#--------------------------------------------------------------------------
# A?? A???A??A??`ñA|
#     x : 
#     y : 
#     i : A???A?hAhA?õ
#--------------------------------------------------------------------------
def draw_item(x, y, i)
   #p "x=" + x.to_s + " y=" + y.to_s + " i=" + @items[i].to_s
   rect = Rect.new(0, 0, @items[i].width, @items[i].height)
   if @index == i
     self.contents.blt( x, y, @items[i], rect )
     if @disabled[@index]
       self.contents.blt( x, y, ICON_DISABLE, rect )
     end
   else
     self.contents.blt( x, y, @items[i], rect, 128 )
     if @disabled[@index]
       self.contents.blt( x, y, ICON_DISABLE, rect, 128 )
     end
   end
end
#--------------------------------------------------------------------------
# A?? A???A??A‹?A3?AC?Añ?AE?Ac
#     index : A???A?hAhA?õ
#--------------------------------------------------------------------------
def disable_item(index)
   @disabled[index] = true
end
#--------------------------------------------------------------------------
# A?? A?ñ?AoñAâ?A?j?A?A?[?V?ö?g?A?A??hAƒÊ
#--------------------------------------------------------------------------
def setup_move_start
   @mode = MODE_START
   @steps = STARTUP_FRAMES
   if  SE_STARTUP != nil and SE_STARTUP != ""
     Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
   end
end
#--------------------------------------------------------------------------
# A?? ñA}g]?A?j?A?A?[?V?ö?g?A?A??hAƒÊ
#--------------------------------------------------------------------------
def setup_move_move(mode)
   if mode == MODE_MOVER
     @index -= 1
     @index = @items.size - 1 if @index < 0
   elsif mode == MODE_MOVEL
     @index += 1
     @index = 0 if @index >= @items.size
   else
     return
   end
   @mode = mode
   @steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
# A?? ?A?j?A?A?[?V?ö?gfõ?Ac?Aö?A??Ac
#--------------------------------------------------------------------------
def animation?
   return @mode != MODE_WAIT
end
end

#===================================================
# £ CLASS Window_RingMenu Ends
#===================================================
#===================================================
# ¥ CLASS Window_RingMenuStatus Begins
#===================================================

class Window_RingMenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# A?? ?I?u?W?F?N?gA?ñ?AoñAâ
#--------------------------------------------------------------------------
def initialize
   super(204, 64, 232, 352)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.size = $chara_select[5]
   refresh
   self.active = false
   self.index = -1
end
#--------------------------------------------------------------------------
# A?? ???t???b?V?c
#--------------------------------------------------------------------------
def refresh
   self.contents.clear
   self.windowskin = RPG::Cache.windowskin($chara_select[4]) 
   self.contents.font.name = $chara_select[0]
   self.contents.font.color = text_color($chara_select[1]) 
   @item_max = $game_party.actors.size
   for i in 0...$game_party.actors.size
     x = 80
     y = 80 * i
     actor = $game_party.actors[i]
     draw_actor_graphic(actor, x - 40, y + 80)
     draw_actor_name(actor, x, y + 24)
   end
end
#--------------------------------------------------------------------------
# A?? ?JA?[?\???A??Ac?`A?XA?V
#--------------------------------------------------------------------------
def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
   else
     self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
   end
end
end
#===================================================
# £ CLASS Window_RingMenuStatus Ends
#===================================================
#===================================================
# ¥ Class Window_gold Begins
#==============================================================================
# ¡ Window_Gold
#------------------------------------------------------------------------------
# @ƒS[ƒ‹ƒh‚ð•\ަ‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B
#==============================================================================

class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype  # "Gold" window font
    self.contents.font.size = $defaultfontsize
    refresh
  end
  #--------------------------------------------------------------------------
  # œ ƒŠƒtƒŒƒbƒVƒ…
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  end
end