#==============================================================================
# ** EJ Big Map
#------------------------------------------------------------------------------
# EJ
# Version 1
# 2005 April 9
#==============================================================================
#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
SDK.log('EJ Big Map', 'EJ', 1, '2005-04-09')
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.state('EJ Big Map') == true
class Game_Temp
attr_accessor :map_changed
attr_accessor :player_transferring2
end
class Game_Map
alias ej_bmap_g_map_setup_load setup_load
alias ej_bmap_g_map_setup_events setup_events
#------------------------------------------------------------------------
attr_accessor :big_map
attr_accessor :a_width
attr_accessor :a_height
attr_accessor :a_tl
attr_accessor :a_tc
attr_accessor :a_tr
attr_accessor :a_cl
attr_accessor :a_cr
attr_accessor :a_bl
attr_accessor :a_bc
attr_accessor :a_br
#------------------------------------------------------------------------
BIG_MAP_ID = 1
#------------------------------------------------------------------------
def setup_load
# load the map
ej_bmap_g_map_setup_load
@a_width = @map.width
@a_height = @map.height
# get the area settings
b_name = name.split
if b_name[0] != 'BM'
@big_map = false
return
end
if @big_map != true
$game_temp.map_changed = true
end
@big_map = true
@a_tl = b_name[1].to_i
@a_tc = b_name[2].to_i
@a_tr = b_name[3].to_i
@a_cl = b_name[4].to_i
@a_cr = b_name[5].to_i
@a_bl = b_name[6].to_i
@a_bc = b_name[7].to_i
@a_br = b_name[8].to_i
# load the empty map
@map = load_data(sprintf('Data/Map%03d.rxdata', BIG_MAP_ID))
#top left map
map_b = load_data(sprintf('Data/Map%03d.rxdata', @a_tl))
for z in 0..2
for y in 0..@a_height - 1
for x in 0..@a_width - 1
@map.data[x, y, z] = map_b.data[x, y, z]
end
end
end
#top map
map_b = load_data(sprintf('Data/Map%03d.rxdata', @a_tc))
for z in 0..2
for y in 0..@a_height - 1
for x in 0..@a_width - 1
@map.data[x + @a_width, y, z] = map_b.data[x, y, z]
end
end
end
#top right map
map_b = load_data(sprintf('Data/Map%03d.rxdata', @a_tr))
for z in 0..2
for y in 0..@a_height - 1
for x in 0..@a_width - 1
@map.data[x + (@a_width * 2), y, z] = map_b.data[x, y, z]
end
end
end
#center left map
map_b = load_data(sprintf('Data/Map%03d.rxdata', @a_cl))
for z in 0..2
for y in 0..@a_height - 1
for x in 0..@a_width - 1
@map.data[x, y + @a_height, z] = map_b.data[x, y, z]
end
end
end
#center map
map_b = load_data(sprintf('Data/Map%03d.rxdata', @map_id))
for z in 0..2
for y in 0..@a_height - 1
for x in 0..@a_width - 1
@map.data[x + @a_width, y + @a_height, z] = map_b.data[x, y, z]
end
end
end
#events
@map.events = map_b.events
@map.encounter_list = map_b.encounter_list
@map.encounter_step = map_b.encounter_step
#center right map
map_b = load_data(sprintf('Data/Map%03d.rxdata', @a_cr))
for z in 0..2
for y in 0..@a_height - 1
for x in 0..@a_width - 1
@map.data[x + (@a_width * 2), y + @a_height, z] = map_b.data[x, y, z]
end
end
end
#bottom left map
map_b = load_data(sprintf('Data/Map%03d.rxdata', @a_bl))
for z in 0..2
for y in 0..@a_height - 1
for x in 0..@a_width - 1
@map.data[x, y + (@a_height * 2), z] = map_b.data[x, y, z]
end
end
end
#bottom map
map_b = load_data(sprintf('Data/Map%03d.rxdata', @a_bc))
for z in 0..2
for y in 0..@a_height - 1
for x in 0..@a_width - 1
@map.data[x + @a_width, y+ (@a_height * 2), z] = map_b.data[x, y, z]
end
end
end
#bottom right map
map_b = load_data(sprintf('Data/Map%03d.rxdata', @a_br))
for z in 0..2
for y in 0..@a_height - 1
for x in 0..@a_width - 1
@map.data[x + (@a_width * 2), y +(@a_height * 2), z] = map_b.data[x, y, z]
end
end
end
end
#----------------------------------------------------------------------
def setup_events
ej_bmap_g_map_setup_events
for event in @events.values
event.moveto(event.x + @a_width, event.y + @a_height)
end
end
#----------------------------------------------------------------------
def name
return $map_infos[@map_id]
end
end
class Game_Player < Game_Character
alias ej_bmap_g_player_update update
alias ej_bmap_g_player_moveto moveto
#------------------------------------------------------------------------
def update
if $game_map.big_map == true
unless moving?
if @x == $game_map.a_width and @direction == 4
#left
unless $game_temp.player_transferring and
$game_temp.message_window_showing and
$game_temp.transition_processing
$game_temp.player_transferring = true
$game_temp.player_transferring2 = true
$game_temp.player_new_map_id = $game_map.a_cl
$game_temp.player_new_x = @x + $game_map.a_width
$game_temp.player_new_y = @y
$game_temp.transition_processing = false
end
elsif @y == $game_map.a_height and @direction == 8
#up
unless $game_temp.player_transferring and
$game_temp.message_window_showing and
$game_temp.transition_processing
$game_temp.player_transferring = true
$game_temp.player_transferring2 = true
$game_temp.player_new_map_id = $game_map.a_tc
$game_temp.player_new_x = @x
$game_temp.player_new_y = @y + $game_map.a_height
$game_temp.transition_processing = false
end
elsif @x == ($game_map.a_width*2)-1 and @direction == 6
#right
unless $game_temp.player_transferring and
$game_temp.message_window_showing and
$game_temp.transition_processing
$game_temp.player_transferring = true
$game_temp.player_transferring2 = true
$game_temp.player_new_map_id = $game_map.a_cr
$game_temp.player_new_x = @x - $game_map.a_width
$game_temp.player_new_y = @y
$game_temp.transition_processing = false
end
elsif @y == ($game_map.a_height*2)-1 and @direction == 2
#down
unless $game_temp.player_transferring and
$game_temp.message_window_showing and
$game_temp.transition_processing
$game_temp.player_transferring = true
$game_temp.player_transferring2 = true
$game_temp.player_new_map_id = $game_map.a_bc
$game_temp.player_new_x = @x
$game_temp.player_new_y = @y - $game_map.a_height
$game_temp.transition_processing = false
end
end
end
end
ej_bmap_g_player_update
end
#----------------------------------------------------------------------
def moveto(x,y)
if $game_temp.map_changed == true
ej_bmap_g_player_moveto(x + $game_map.a_width, y + $game_map.a_height)
$game_temp.map_changed = false
else
ej_bmap_g_player_moveto(x, y)
end
end
end
class Scene_Map
alias ej_bmap_s_map_transfer_player transfer_player
#------------------------------------------------------------------------
def transfer_player
if $game_temp.player_transferring2
$game_temp.player_transferring = false
$game_temp.player_transferring2 = false
$game_map.setup($game_temp.player_new_map_id)
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
#$game_map.update
@spriteset.dispose
@spriteset = Spriteset_Map.new
$game_map.autoplay
else
ej_bmap_s_map_transfer_player
end
end
end
class Scene_Title
alias ej_bmap_s_title_main main
#------------------------------------------------------------------------
def main
$map_infos = load_data('Data/MapInfos.rxdata')
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
ej_bmap_s_title_main
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end # End SDK Check