Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # // Last Modified :06/08/2011
- #==============================================================================#
- $imported = {} if $imported == nil
- $imported["IRS-Core"] = true
- #==============================================================================#
- # IRS
- #==============================================================================#
- module IRS ; end
- unless $imported["ICY_Bitmap_Xtended"]
- raise %Q(
- IRS-Core Error
- ICY - BitmapExtended (ICY_Bitmap_Xtended)
- Was not found, or has not been installed above the IRS-Core script
- Please ensure that the script is installed correctly before proceeding.
- Your game will now close.
- )
- exit()
- end
- #==============================================================================#
- # Vocab
- #==============================================================================#
- module Vocab
- def self.location() ; return "Location" end
- end
- #==============================================================================#
- # Game_System
- #==============================================================================#
- class Game_System
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :last_location_name
- #--------------------------------------------------------------------------#
- # * alias method :initialize
- #--------------------------------------------------------------------------#
- alias :irs000_gsys_initialize :initialize unless $@
- def initialize()
- irs000_gsys_initialize()
- @last_location_name = ""
- end
- end
- #==============================================================================#
- # Game_Map
- #==============================================================================#
- class Game_Map
- #--------------------------------------------------------------------------#
- # * new method :name
- #--------------------------------------------------------------------------#
- def name( map_id=@map_id )
- load_map_infos() if @map_infos.nil?()
- return @map_infos[map_id].name
- end
- #--------------------------------------------------------------------------#
- # * new method :load_map_infos
- #--------------------------------------------------------------------------#
- def load_map_infos()
- @map_infos = load_data( "Data/MapInfos.rvdata" )
- end
- #--------------------------------------------------------------------------#
- # * alias method :initialize
- #--------------------------------------------------------------------------#
- alias :irs000_gmap_setup :setup unless $@
- def setup( map_id )
- irs000_gmap_setup( map_id )
- $game_system.last_location_name = name()
- end
- end
- #==============================================================================#
- # IRS::Sprite_Core
- #==============================================================================#
- class IRS::Sprite_Core < ::Sprite
- #--------------------------------------------------------------------------#
- # * Constants
- #--------------------------------------------------------------------------#
- WLH = 24
- BACKGROUND_COLOR = Color.new( 0, 0, 0 )
- #--------------------------------------------------------------------------#
- # * super method :initialize
- #--------------------------------------------------------------------------#
- def initialize( x, y, width, height, viewport=nil )
- super( viewport )
- self.x = x ; self.y = y
- self.bitmap = Bitmap.new( width, height )
- draw_background()
- refresh()
- end
- #--------------------------------------------------------------------------#
- # * new method :bwidth
- #--------------------------------------------------------------------------#
- def bwidth()
- return self.bitmap.width
- end
- #--------------------------------------------------------------------------#
- # * new method :bheight
- #--------------------------------------------------------------------------#
- def bheight()
- return self.bitmap.height
- end
- #--------------------------------------------------------------------------#
- # * new method :refresh
- #--------------------------------------------------------------------------#
- def refresh()
- end
- #--------------------------------------------------------------------------#
- # * new method :draw_background
- #--------------------------------------------------------------------------#
- def draw_background()
- width, height = self.bitmap.width, self.bitmap.height
- self.bitmap.fill_rect( 0, 0, width, height, BACKGROUND_COLOR )
- end
- #--------------------------------------------------------------------------#
- # * new method :resize
- #--------------------------------------------------------------------------#
- def resize( new_width, new_height )
- old_bitmap = self.bitmap
- self.bitmap = Bitmap.new( new_width, new_height )
- unless old_bitmap.nil?()
- self.bitmap.blt( 0, 0, old_bitmap, self.bitmap.rect )
- old_bitmap.dispose()
- end
- end
- #--------------------------------------------------------------------------#
- # * new method :draw_currency_value
- #--------------------------------------------------------------------------#
- def draw_currency_value( value, x, y, width )
- cx = bitmap.text_size( ::Vocab::gold ).width
- self.bitmap.font.color = normal_color
- self.bitmap.font.size = Font.default_size - 2
- self.bitmap.draw_text( x, y, width-cx-2, WLH, value, 2 )
- self.bitmap.font.size = Font.default_size
- self.bitmap.font.color = system_color
- self.bitmap.draw_text( x, y, width, WLH, ::Vocab::gold, 2 )
- end
- #--------------------------------------------------------------------------#
- # * new method :draw_face
- #--------------------------------------------------------------------------#
- def draw_face( face_name, face_index, x, y, wsize = 96, hsize = 96 )
- bitmap = Cache.face(face_name)
- rect = Rect.new( 0, 0, 0, 0 )
- rect.x = face_index % 4 * 96 + (96 - wsize) / 2
- rect.y = face_index / 4 * 96 + (96 - hsize) / 2
- rect.width = wsize
- rect.height = hsize
- self.bitmap.blt(x, y, bitmap, rect)
- bitmap.dispose
- end
- #--------------------------------------------------------------------------#
- # * new method :draw_actor_face
- #--------------------------------------------------------------------------#
- def draw_actor_face( actor, x, y, wsize = 96, hsize = 96 )
- draw_face( actor.face_name, actor.face_index, x, y, wsize, hsize )
- end
- end
- #==============================================================================#
- # IRS::Sprite_Help
- #==============================================================================#
- class IRS::Sprite_Help < ::IRS::Sprite_Core
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :text
- attr_accessor :align
- #--------------------------------------------------------------------------#
- # * super method :initialize
- #--------------------------------------------------------------------------#
- def initialize( *args )
- @text = -1
- @align = 0
- super( *args )
- end
- #--------------------------------------------------------------------------#
- # * new method :set_obj
- #--------------------------------------------------------------------------#
- def set_obj( text, enabled=true )
- return 0 if @text == text
- self.bitmap.clear()
- rect = Rect.new( 4, 4, self.bitmap.width-16, ::Window_Base::WLH )
- draw_background()
- self.bitmap.draw_text( rect, text, @align )
- @text = text
- end
- #--------------------------------------------------------------------------#
- # * new method :set_text
- #--------------------------------------------------------------------------#
- def set_text( text, enabled=true ) ; set_obj( text, enabled ) end
- end
- #==============================================================================#
- # IRS::Sprite_Gold
- #==============================================================================#
- class IRS::Sprite_Gold < ::IRS::Sprite_Help
- #--------------------------------------------------------------------------#
- # * new method :refresh
- #--------------------------------------------------------------------------#
- def refresh()
- draw_currency_value( $game_party.gold, 4, 0, 120 )
- end
- end
- #==============================================================================#
- # IRS::Sprite_Location
- #==============================================================================#
- class IRS::Sprite_Location < ::IRS::Sprite_Help
- #--------------------------------------------------------------------------#
- # * new method :refresh
- #--------------------------------------------------------------------------#
- def refresh()
- self.bitmap.font.size = Font.default_size - 2
- self.bitmap.font.color = system_color
- rect = Rect.new( 64, 12, self.bitmap.width, WLH )
- self.bitmap.draw_text( rect, $game_map.name )
- self.bitmap.font.size = Font.default_size - 4
- self.bitmap.font.color = normal_color
- rect = Rect.new( 4, 0, self.bitmap.width, WLH )
- self.bitmap.draw_text( rect, Vocab.location )
- end
- end
- #==============================================================================#
- # IRS::Sprite_FaceTab
- #==============================================================================#
- class IRS::Sprite_FaceTab < ::IRS::Sprite_Core
- #--------------------------------------------------------------------------#
- # * super method :initialize
- #--------------------------------------------------------------------------#
- def initialize( actor, *args )
- @actor = actor
- super( *args )
- end
- #--------------------------------------------------------------------------#
- # * new method :refresh
- #--------------------------------------------------------------------------#
- def refresh()
- draw_actor_face( @actor, 2, 2, [self.width-4, 96].min, [self.height, 96].min )
- end
- end
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment