#==============================================================================
# Location Names with Pictures or Text by Blizzard
# Version: 2.11b
# Type: Game Playability Improvement
# Date: 14.11.2006
# Date v2.1b: 7.7.2007
# Date v2.11b: 30.7.2007
#
# NOTE: This script WILL corrupt old savegames!
#
# Instructions:
# Connect map IDs with picture names. All pictures MUST be in the the Names
# folder in your picture folder. If you don't have a picture, the map name
# will be written out using the default text engine from RMXP. Please set up
# the font you wish the text to be displayed in this case.
#==============================================================================
LOCATION_FONT = 'Verdana'
LOCATION_SIZE = 32
LOCATION_BOLD = true
LOCATION_ITALIC = false
LOCATION_COLOR = Color.new(255, 255, 255) # Color.new(R, G, B, A)
DISPLAY_TIME = 4 # in seconds
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :map_name_id
attr_accessor :name_timer
alias init_names_later initialize
def initialize
init_names_later
@map_name_id = 0
@name_timer = 0
end
end
#==============================================================================
# Name_Sprite
#==============================================================================
class Name_Sprite < Sprite
attr_accessor :timer
def initialize
super
if $game_system.map_name_id == $game_map.map_id
@timer = $game_system.name_timer
else
@timer = 0
end
if @timer < 16
self.opacity = @timer * 15
elsif @timer > 16 + 20 * DISPLAY_TIME
self.opacity = 255 - (@timer - 16 - 20 * DISPLAY_TIME)* 15
end
$game_system.map_name_id = $game_map.map_id
self.z = 6000
self.bitmap = get_image($game_map.map_id)
self.bitmap == nil ? self.dispose : self.x = 640 - self.bitmap.width
end
def get_image(id)
case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START of Database
#
# Use this template to configure this add-on:
#
# when ID then name = 'FILE_NAME'
#
# ID - map ID where the picture should be displayed
# FILE_NAME - the file name of the picture file in the Pictures/Names folder
#
# If you don't have a picture and want the name displayed anyway, please use:
#
# when ID then name = nil
#
# Instead of an image normal text will be displayed in the chosen font.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
when 1 then name = 'Map1.png'
when 3, 4 then name = nil
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END of Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
else
return nil
end
if name == nil
bitmap = Bitmap.new(1, 1)
bitmap.font.name = LOCATION_FONT
bitmap.font.size = LOCATION_SIZE
w = bitmap.text_size($game_map.name).width + 40
bitmap.dispose
bitmap = Bitmap.new(w, LOCATION_SIZE + 16)
bitmap.font.name = LOCATION_FONT
bitmap.font.size = LOCATION_SIZE
bitmap.font.bold = LOCATION_BOLD
bitmap.font.italic = LOCATION_ITALIC
bitmap.font.color = LOCATION_COLOR
bitmap.draw_text(0, 8, w, LOCATION_SIZE + 8, $game_map.name, 1)
else
bitmap = RPG::Cache.picture("Names\\#{name}")
end
return bitmap
end
def dispose
$game_system.name_timer = @timer
super
end
end
#==============================================================================
# Spriteset_Map
#==============================================================================
class Spriteset_Map
attr_accessor :name
alias init_name_later initialize
def initialize
init_name_later
@name = Name_Sprite.new if $game_system.LOCATION_NAMES
end
alias upd_name_later update
def update
if @name != nil
unless @name.disposed?
@name.timer += 1
@name.opacity += 15 if @name.timer < 16
@name.opacity -= 15 if @name.timer > 16 + 20 * DISPLAY_TIME
if @name.opacity == 0
@name.dispose
@name = nil
end
else
@name = nil
end
end
upd_name_later
end
alias dispose_name_later dispose
def dispose
dispose_name_later
unless @name == nil
$game_system.name_timer = @name.timer
@name.dispose
end
@name = nil
end
end
#==============================================================================
# Scene_Title
#==============================================================================
class Scene_Title
alias main_location_later main
def main
$map_infos = load_data('Data/MapInfos.rxdata')
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
main_location_later
end
end
#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
def name
return $map_infos[@map_id]
end
end