I've made a quick demo, how does this look:
CODE
class Game_Map
alias nr_mapJournal_initialize initialize unless $@
alias nr_mapJournal_setup setup unless $@
attr_reader :visited_maps
@@map_infos = load_data("Data/MapInfos.rxdata")
def initialize(*args)
# Initialize the array of map' visited
@visited_maps = []
# Run the original initialize
nr_mapJournal_initialize(*args)
end
def setup(*args)
# Run the original setup
nr_mapJournal_setup(*args)
# Add this map to the list of maps visited
@visited_maps = ( @visited_maps + [@@map_infos[@map_id].name] ).uniq
end
end
class Window_Preview_Map < Window_Base
def initialize(graphic_name)
# Set an unachievable bitmap
@last_graphic_name = -1
# Tell Window_Base some dummy settings for the x, y, width and height
super(0, 0, 640, 480)
# Set the graphic to the graphic_name
set_graphic(graphic_name.to_s)
end
def set_graphic(graphic_name)
# If the graphic has changed, refresh the bitmap
if graphic_name != @last_graphic_name
@last_graphic_name = graphic_name
refresh
end
end
def refresh
# Dispose and recreate the bitmap (in case the window size has changed)
self.contents.dispose unless self.contents.nil? or self.contents.disposed?
self.contents = Bitmap.new(width - 32, height - 32)
# Load the image
src_bitmap = RPG::Cache.picture(@last_graphic_name)
# Get the aspect ratio
sf_width, sf_height = self.contents.width, self.contents.height
s_width, s_height = src_bitmap.width, src_bitmap.height
if s_width * 1000 / s_height > sf_width * 1000 / sf_height
ratio = sf_width.to_f / s_width.to_f
d_width = sf_width
d_height = (s_height * ratio).to_i
d_x = 0
d_y = (sf_height - d_height) / 2
else
ratio = sf_height.to_f / s_height.to_f
d_height = sf_height
d_width = (s_width * ratio).to_i
d_y = 0
d_x = (s_width - d_width) / 2
end
dest_rect = Rect.new(d_x, d_y, d_width, d_height)
# Copy the graphic onto this window
self.contents.stretch_blt(dest_rect, src_bitmap, src_bitmap.rect)
end
end
class Scene_MapJournal
def initialize
@return_scene = $scene.clone
end
def main
# Run the starting code (create windows, etc)
start
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
terminate
end
def start
# Get the list of maps visited
@map_names = $game_map.visited_maps
# Ensure that there is at least 1 command
@map_names = [''] if @map_names.empty?
# Create the title window
@title_window = Window_Help.new
@title_window.set_text('Map Journal', 1)
# Create the map list
@command_window = Window_Command.new(192, @map_names)
@command_window.y = @title_window.height
@command_window.height = 640 - @title_window.height
# Create the preview
map_name = @map_names[@command_window.index]
@preview_map_window = Window_Preview_Map.new(map_name)
@preview_map_window.x = @command_window.width
@preview_map_window.y = @title_window.height
@preview_map_window.width = 640 - @command_window.width
@preview_map_window.height = 480 - @title_window.height
@preview_map_window.refresh
# Create a variable to know if the image is fullscreen or not
@state = :small_image
end
def update
# Update the windows
@title_window.update
@command_window.update
@preview_map_window.update
# Update the picture being shown
map_name = @map_names[@command_window.index]
@preview_map_window.set_graphic(map_name)
# Update the processing
case @state
when :small_image
small_image_update
when :large_image
large_image_update
end
end
def terminate
@title_window.dispose
@command_window.dispose
@preview_map_window.dispose
end
def small_image_update
# If the decision key is rpessed
if Input.trigger?(Input::C)
# If the picture is a real one
map_name = @map_names[@command_window.index]
if map_name != ''
# Play the decision SE
$game_system.se_play($data_system.decision_se)
# Create the fullscreen image
@sprite = Sprite.new
@sprite.z = 99999
@sprite.bitmap = RPG::Cache.picture(map_name)
@state = :large_image
# If the map name doesn't exist
else
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
end
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
$scene = @return_scene
end
end
def large_image_update
# Update the sprite
@sprite.update
# Make sure that the image is the highlighted option
map_name = @map_names[@command_window.index]
@sprite.bitmap = RPG::Cache.picture(map_name)
# If anything is pressed
if Input.trigger?(Input::C) or Input.trigger?(Input::B)
# Play the decision SE
$game_system.se_play($data_system.decision_se)
# Return from fullscreen mode
@state = :small_image
# Dispose the sprite
@sprite.bitmap.dispose
@sprite.dispose
end
end
end
At the moment it gets the maps that you've been on, and looks for a picture that has the same name as the map.
I can change it over to items/switches easily enough, both take the same amount of effort so let me know which is easier for your eventing ^_^
And how's the layout, does anything need changing?