#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Legacy World Atlas
# Version: 1.01b
# Type: Atlas Display System
# Date v1.00b: 7.2.2010
# Date v1.01b: 8.2.2010
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
# This script should be 100% compatible with ANY script. If you find a script
# that's incompatible (without making it yourself specially for that purpose)
# and report it to me, I'll give you a cookie (and fix the incompatibility)
#
#
# Features:
#
# - Display a world map that will point to the player's location.
# - Zoom in on the map to see a close up veiw of the region you're in.
# - Easy to set up with any system (as you specify the location of the cursor
# on the world map with a script call).
#
# Instructions:
#
# Create a world map to cover the entire world, then region maps for every
# region you wish to show in game.
#
#
# Version History:
#
# v1.00b:
# -> Initial release
#
# v1.01b:
# -> Fixed a small bug that caused the area name to be incorrect.
# -> Cleaned up the comments just a little bit.
#
#
# Configuration:
#
# PLAYER_ICON - The icon in "Icons/Atlas" that will point to the
# player's position on the map.
#
# WORLD_MAP_NAME - The picture in "Pictures/Atlas/" that will display
# as the global map. (the zoomed out map)
#
# SHOW_LOCATION_NAME - Toggles whether or not the name of player's current
# location will be displayed on the map.
#
# ZOOM_IN_SE - The sound effect that will play when the player
# "zooms" in on the map. (switches from a display of
# the global map to the local map)
#
# ZOOM_OUT_SE - The sound effect that will play when the player
# "zooms" out on the map. (switches from a display of
# the local map to the global map)
#
# EXIT_ATLAS_SE - The sound effect that will play when the player exits
# the atlas scene.
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module LBConf
#///////////////////////////////////////////////////////////////////////////////
# START CONFIGURATION //
#///////////////////////////////////////////////////////////////////////////////
# to not show an icon, just set it to ''
PLAYER_ICON = 'pointer'
WORLD_MAP_NAME = 'world'
SHOW_LOCATION_NAME = true
ZOOM_IN_SE = '003-System02'
ZOOM_OUT_SE = '003-System03'
EXIT_ATLAS_SE = '003-System03'
#############################
# ATLAS_REGION_IMAGES #
##############################################################################
# the syntax for defining a region's name is as follows
#
# when x then return 'Region Name'
#
# x is a number you asign it (it can be anything, but logically you should
# order them sequentially.)
#
# imageName is the name of the picture found in "Pictures/Atlas/" that will
# serve as the map for that particular region.
#
##############################################################################
def self.atlas_region_images(region)
case region
when 0 then return ''
end
# the text to be displayed on an unconfigured area. The default is a blank
# string.
return 'openOcean'
end
#############################
# ATLAS_REGION_NAMES #
##############################################################################
# the syntax for defining a region's name is as follows
#
# when x then return 'Region Name'
#
# x is a number you asign it (it can be anything, but logically you should
# order them sequentially.)
#
# 'Region Name' is the name that will be displayed on the map (provided you
# are using the Location Name feature)
#
##############################################################################
def self.atlas_region_names(region)
case region
when 0 then return ''
end
# the text to be displayed on an unconfigured area. The default is a blank
# string.
return ''
end
#############################
# ATLAS_AREA_NAMES #
##############################################################################
# the syntax for defining am area's name is as follows
#
# when regionID
# case region[1]
# when x then return 'Area Name'
#
# regionID is the number of a region (defined above) which this area belongs
# to.
#
# case region[1] should be left as is
#
# x is a number you asign it (it can be anything, but logically you should
# order them sequentially.)
#
# 'Area Name' is the name that will be displayed on the map (provided you
# are using the Location Name feature)
#
##############################################################################
def self.atlas_area_names(area)
case area
when 0 then return ''
end
# the text to be displayed on an unconfigured area. The default is a blank
# string.
return ''
end
#///////////////////////////////////////////////////////////////////////////////
# END CONFIGURATION //
#///////////////////////////////////////////////////////////////////////////////
end
class Game_System
attr_accessor :region
attr_accessor :area
attr_accessor :globalX
attr_accessor :globalY
attr_accessor :localX
attr_accessor :localY
alias initialize_atlas_vars_LB initialize
def initialize
@region, @area, @globalX, @globalY, @localX, @localY = 0, 0, 0, 0, 0, 0
initialize_atlas_vars_LB
end
end
class Scene_Atlas
def initialize()
@region = $game_system.region
@area = $game_system.area
@globalX = $game_system.globalX
@globalY = $game_system.globalY
@localX = $game_system.localX
@localY = $game_system.localY
@zoomed = false
@atlas = Atlas_Base.new(nil, LBConf::WORLD_MAP_NAME, LBConf::atlas_region_names(@region),
@globalX, @globalY)
end
def main
# enter the scene's loop #
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
# dispose of the windows #
Graphics.freeze
@atlas.dispose
end
def update
@atlas.update
if Input.trigger?(Input::C)
if @zoomed != true
zoom_in
else
zoom_out
end
end
if Input.trigger?(Input::B)
if @zoomed != true
$scene = Scene_Map.new
else
zoom_out
end
end
end
def zoom_in
$game_system.se_play($data_system.decision_se)
@zoomed = true
@atlas.mapImage = LBConf::atlas_region_images(@region)
@atlas.mapName = LBConf::atlas_area_names(@area)
@atlas.cursorX = @localX
@atlas.cursorY = @localY
end
def zoom_out
$game_system.se_play($data_system.cancel_se)
@zoomed = false
@atlas.mapImage = LBConf::WORLD_MAP_NAME
@atlas.mapName = LBConf::atlas_region_names(@region)
@atlas.cursorX = @globalX
@atlas.cursorY = @globalY
end
end
class Atlas_Base < Sprite
attr_accessor :mapImage
attr_accessor :mapName
attr_accessor :cursorX
attr_accessor :cursorY
def initialize(viewport = nil, mapImage = 'world', mapName = '', cursorX = 0, cursorY = 0)
super()
self.x, self.y, self.z, self.opacity = 0, 0, 1, 255
self.bitmap = Bitmap.new(640, 480)
@viewport = viewport
@mapImage = mapImage
@mapName = mapName
@cursorX = cursorX
@cursorY = cursorY
refresh
end
def refresh
self.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.picture('Atlas/' + @mapImage)
self.bitmap.blt(0, 0, bitmap, Rect.new(0, 0, 640, 480))
if LBConf::SHOW_LOCATION_NAME == true
self.bitmap.draw_text(40, 420, 90, 28, 'Location :', 0)
self.bitmap.draw_text(133, 420, 300, 28, @mapName, 0)
end
if LBConf::PLAYER_ICON != ''
bitmap = RPG::Cache.icon('Atlas/' + LBConf::PLAYER_ICON)
self.bitmap.blt(@cursorX, @cursorY, bitmap, Rect.new(0, 0, 24, 24), 255)
end
end
def update
refresh if self.bitmap != RPG::Cache.picture('Atlas/' + @mapImage)
end
end