Started by Nightfox, October 13, 2008, 05:17:23 am
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.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=# Location Names with Pictures or Text by Blizzard# Version: 2.21b# Type: Game Playability Improvement# Date: 14.11.2006# Date v2.1b: 7.7.2007# Date v2.11b: 30.7.2007# Date v2.12b: 25.10.2007# Date v2.13b: 5.11.2007# Date v2.2b: 17.2.2008# Date v2.21b: 17.2.2008#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=# # 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 = 'Arial'LOCATION_SIZE = 32LOCATION_BOLD = trueLOCATION_ITALIC = falseLOCATION_COLOR = Color.new(255, 255, 255, 255) # Color.new(R, G, B, A)LOCATION_DISPLAY_TIME = 2 # in seconds#==============================================================================# module BlizzCFG#==============================================================================module BlizzCFG def self.get_locimage case $game_map.map_id#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# START Location 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 = nil when 2 then name = 'MAP002_pic'#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::# END Location Database#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: else return nil end # if text should be used if name == nil # create bitmap bitmap = Bitmap.new(320, LOCATION_SIZE + 16) # set up font style 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 # draw map name bitmap.draw_text(0, 8, bitmap.width-16, LOCATION_SIZE+8, $map_names[$game_map.map_id], 2) else # cache image file bitmap = RPG::Cache.picture("Names/#{name}") end return bitmap end end #==============================================================================# Game_System#==============================================================================class Game_System # setting all accessible variables attr_accessor :map_name_id attr_accessor :name_timer #---------------------------------------------------------------------------- # initialize # Added helping variables for convenience. #---------------------------------------------------------------------------- alias init_names_later initialize def initialize init_names_later @map_name_id = @name_timer = 0 end end#==============================================================================# Name_Sprite#==============================================================================class Name_Sprite < Sprite # setting all accessible variables attr_accessor :timer #---------------------------------------------------------------------------- # initialize #---------------------------------------------------------------------------- def initialize(viewport = nil) super # set timer depending on if same map as when the last time if $game_system.map_name_id == $game_map.map_id @timer = $game_system.name_timer else @timer = 0 end # if appearing if @timer < 16 self.opacity = @timer * 15 # if disappearing elsif @timer > 16 + 40 * LOCATION_DISPLAY_TIME self.opacity = 255 - (@timer - 16 - 40 * LOCATION_DISPLAY_TIME)* 15 end # store this map as old map $game_system.map_name_id = $game_map.map_id self.z = 6000 # get text image or image self.bitmap = BlizzCFG.get_locimage # set x coordinate or delete depending on whether bitmap exists self.bitmap == nil ? self.dispose : self.x = 640 - self.bitmap.width end #---------------------------------------------------------------------------- # dispose # Added storing of timer value before removing. #---------------------------------------------------------------------------- def dispose $game_system.name_timer = @timer super end end#==============================================================================# Spriteset_Map#==============================================================================class Spriteset_Map attr_accessor :name #---------------------------------------------------------------------------- # initialize # Added the name sprite. #---------------------------------------------------------------------------- alias init_name_later initialize def initialize init_name_later @name = Name_Sprite.new(@viewport1) end #---------------------------------------------------------------------------- # update # Added name sprite appearing/disappearing animation control. #---------------------------------------------------------------------------- alias upd_name_later update def update # if sprite exists if @name != nil # if sprite not disposed unless @name.disposed? @name.timer += 1 # if appearing if @name.timer < 16 @name.opacity += 15 # if disappearing elsif @name.timer > 16 + 40 * LOCATION_DISPLAY_TIME @name.opacity -= 15 end # if gone if @name.opacity == 0 # remove completely @name.dispose @name = nil end else # set to nil @name = nil end end upd_name_later end #---------------------------------------------------------------------------- # dispose # Added name sprite removal. #---------------------------------------------------------------------------- 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 #---------------------------------------------------------------------------- # main # Added setup of names hash. #---------------------------------------------------------------------------- alias main_location_later main def main $map_names = load_data('Data/MapInfos.rxdata') $map_names.each_key {|key| $map_names[key] = $map_names[key].name} main_location_later end end