Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Sign in to follow this  
Zambaku

RMXP - Anyway to make randomized dungeons?

Question

I've been struggling with getting Tonbi's dungeon generator to work. Sadly I don't read japanese so it's quite impossible for me to get it to work. And the translations I've found is suffering from hard grammar errors and are utterly impossible to understand.

 

So therefore I ask: Is there is another way to create random dungeons?

 

 

Link to Tonbi's script:

http://translate.google.com/translate?hl=e...l%3Den%26sa%3DG

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

When you copy a script from another langauge, just leave it untranslated. If you translate it, it screws up the RGSS. Not allowing it to work for you. Just copy the script in it's original langauge and plug it in. It should work.

 

Hope it works for you,

§ Raxus §

Share this post


Link to post
Share on other sites
  • 0

This is the Untranslated script.

 

[spoiler=Script]

#	 ƒ‰ƒ“ƒ_ƒ€ƒ}ƒbƒv쬃XƒNƒŠƒvƒg@v0.80   by tonbi
#	 
#
#	 ƒ‰ƒ“ƒ_ƒ€‚ȃ}ƒbƒv‚ðŽ©“®ì¬‚·‚éƒXƒNƒŠƒvƒg‚Å‚·
#	 Scene_Debug‚æ‚艺AMain‚æ‚èã‚ÉAV‹KƒZƒbƒVƒ‡ƒ“‚ðì‚èA“\\\\‚è•t‚¯‚Ä‚­‚¾‚³‚¢B
#
#	 ƒ}ƒbƒvˆ—Œy—ʉ»ƒXƒNƒŠƒvƒg(ŠÈˆÕ”Å)‚Æ“¯“™‚Ì‹@”\\\\‚ð“à•ï‚µ‚Ä‚¢‚Ü‚·‚Ì‚ÅA
#	 Œy—ʉ»ƒXƒNƒŠƒvƒg‚Í“ü‚ê‚È‚¢‚Å‚­‚¾‚³‚¢B
#
#	 œŽg‚¢•û   
#
#	 ‚Ü‚¸ƒ}ƒbƒv–¼‚ðuXXXXX,ƒ‰ƒ“ƒ_ƒ€,YYY,ZZZv‚Æ‚µ‚Ä‚­‚¾‚³‚¢B
#	 XXXXX‚ÍD‚«‚È–¼‘O‚ð“ü‚ê‚Ä‚­‚¾‚³‚¢B
#	 YYY‚É‚ÍA¶¬‚̃pƒ^[ƒ“”Ô†‚ð“ü‚ê‚Ü‚·BƒTƒ“ƒvƒ‹‚ðŽQÆ‚É‚µ‚Ä‚­‚¾‚³‚¢B
#	 ZZZ‚É‚ÍAáŠQ•¨‚Ì‘½‚³‚ð“ü‚ê‚Ä‚­‚¾‚³‚¢B‚±‚ê‚àƒTƒ“ƒvƒ‹‚ðŽQl‚É‚µ‚Ä‚­‚¾‚³‚¢B
#
#	 ŽŸ‚ÉAƒ}ƒbƒvƒ^ƒCƒ‹‚ð‚±‚Ìƒ}ƒbƒv‚Ɉê’è‚Ì–@‘¥‚Å•À‚ׂ܂·
#	 ‚±‚ê‚à‘‚¯‚Ü‚¹‚ñ‚̂ŃTƒ“ƒvƒ‹‚ðŽQl‚É‚µ‚Ä‚­‚¾‚³‚¢B
#	 “Á‚ɃŒƒCƒ„[‚É’ˆÓ‚µ‚Ä‚­‚¾‚³‚¢BƒŒƒCƒ„[‚àƒTƒ“ƒvƒ‹’Ê‚è‚ÉB•âŠ®‚³‚ê‚Ü‚·B
#
#	 ÅŒã‚ɃCƒxƒ“ƒg‚ðݒ肵‚Ü‚·
#
#	 ƒCƒxƒ“ƒg‚Ì–¼‘O‚ðuXXXXX,’†Œp“_v
#	 ‚Æ‚·‚é‚ÆA‚»‚̈ʒu‚Í•K‚¸’n–Ê‚É‚È‚è‚Ü‚·B
#	 ‚±‚Ì’†Œp“_‚ðAƒCƒxƒ“ƒgID‚̇‚ÉŒq‚¢‚Å‚¢‚Á‚ă}ƒbƒv‚ðì‚è‚Ü‚·B
#	 (’¼ü‚ÅŒ‹‚ñ‚Å‚¢‚é‚킯‚Å‚Í‚à‚¿‚ë‚ñ‚ ‚è‚Ü‚¹‚ñ)
#	 ‚È‚é‚ׂ­Aƒ}ƒbƒv‚Ì—¼•£‚É’†Œp“_‚ðì‚Á‚Ä‚­‚¾‚³‚¢B
#	 ‚Ü‚½A•£‚Í­‚µ‹ó‚¯‚Ä‚­‚¾‚³‚¢B(5ƒ^ƒCƒ‹’ö“x)•Ç‚ª–³‚­‚È‚è‚Ü‚·B
#	 ‚½‚¾‚µA‚±‚Ì’†Œp“_‚ª–³‚­‚Ä‚àAˆê‰žƒ}ƒbƒv‚Í쬂³‚ê‚Ü‚·B
#	 ‚Ü‚½A’†Œp“_‚ð‘‚₵‚·‚¬‚é‚ÆA•Ç‚ªŒ¸‚è‚Ü‚·B
#	 ”ŒÂ‚Å\\\\•ª‚È‚Ì‚Å‹C‚ð‚‚¯‚Ä‚­‚¾‚³‚¢B
#	 ƒIƒXƒXƒ‚Í‚R‚‚łRŠpŒ`‚ÌŒ`‚ÉÝ’è‚Å‚·
#
#	 ’†Œp“_ˆÈŠO‚̃Cƒxƒ“ƒg‚ÅA“Á‚ÉŽw’è‚Ì–³‚¢‚à‚̂̓‰ƒ“ƒ_ƒ€‚È’n–ʂɈړ®‚³‚ê‚Ü‚·B
#
#	 ƒCƒxƒ“ƒg‚Ì–¼‘O‚ðuXXXXX,ŒÅ’èv
#	 ‚Æ‚·‚é‚ÆA‚»‚̃Cƒxƒ“ƒg‚Í‚»‚̈ʒu‚Ì‹ß‚­‚Ì’n–ʂɈړ®‚³‚ê‚Ü‚·B
#	 ƒCƒxƒ“ƒg‚Ì‚Pƒy[ƒW–ڂ̉‚ß‚ð’Žß‚É‚µ‚ÄAuŸ’Žß : ŒÅ’èv‚Æ‚µ‚Ä‚à‰Â‚Å‚·B
#
#	 ƒCƒxƒ“ƒg‚Ì–¼‘O‚ðuXXXXX,Š®‘SŒÅ’èv
#	 ‚Æ‚·‚é‚ÆA‚»‚̃Cƒxƒ“ƒg‚Í‚»‚̈ʒu‚Ì‚Ü‚Ü‚É‚È‚è‚Ü‚·B
#	 Ž©“®ŠJŽn‚̃Cƒxƒ“ƒg‚â•À—ñˆ—‚̃Cƒxƒ“ƒg‚ÅA•£‚É’u‚¢‚Ä‚¨‚«‚½‚¢•¨‚ÉB
#	 ƒCƒxƒ“ƒg‚Ì‚Pƒy[ƒW–ڂ̉‚ß‚ð’Žß‚É‚µ‚ÄAuŸ’Žß : Š®‘SŒÅ’èv‚Æ‚µ‚Ä‚à‰Â‚Å‚·B
#
#	 ƒCƒxƒ“ƒg‚Ì‚Pƒy[ƒW–ڂ̉‚ß‚ð’Žß‚É‚µ‚ÄAuŸ’Žß : •ÇÝ’uv
#	 ‚Æ‚·‚é‚ÆA‚»‚̃Cƒxƒ“ƒg‚̓‰ƒ“ƒ_ƒ€‚ȕǂ̈ʒu‚Ɉړ®‚³‚ê‚Ü‚·B
#	 ”à‚â¼–¾‚Ȃǂ̃Cƒxƒ“ƒg—p‚Å‚·Bu•ÇÝ’u,1v‚ƃRƒ“ƒ}‚É‘±‚¢‚Ä”Žš‚ðŽw’è‚·‚é‚ÆA
#	 ‚»‚Ì•ª‚̉¡•‚ª[’ljÁ]‚ÅŠm•Û‚³‚ê‚Ü‚·B(‰¡•‚Pƒ^ƒCƒ‹‚È‚ç0‚ðA‚Rƒ^ƒCƒ‹‚È‚ç1‚ðB)
#	 ‚±‚ê‚É‚æ‚Á‚Ä‘å‚«‚¢ƒCƒxƒ“ƒg‚àŽg‚¤‚±‚Æ‚ª‚Å‚«‚Ü‚·
#
#	 ƒCƒxƒ“ƒg‚Ì‚Pƒy[ƒW–ڂ̉‚ß‚ð’Žß‚É‚µ‚ÄAuŸ’Žß : •ÇÝ’uŒÅ’èv
#	 ‚Æ‚·‚é‚ÆAã‹Lu•ÇÝ’uv‚ÆuŒÅ’èv‚ª“K‰ž‚³‚ê‚Ü‚·B
#	 ‚‚܂èAŒ³‚̈ʒu‚Ì‹ß‚­‚̕ǂɈړ®‚³‚ê‚Ü‚·B
#	 ‚Ü‚½u•ÇÝ’uŒÅ’è,1v‚ÆA’ljÁ•‚àŽw’è‚Å‚«‚Ü‚·B
#
#	 ‚Ü‚½AŽg—p‚·‚éÛ‚ÍA«‚Ì•”•ª‚ð•K—p‚ɉž‚¶‚Ä‘‚«Š·‚¦‚Ä‚­‚¾‚³‚¢B

#========================================================================
#========================================================================
#šƒXƒNƒŠƒvƒgƒVƒFƒ‹ƒt‚Ì•ŸŽR‚³‚ñ‚̃p[ƒeƒB—ñŽÔˆÚ“®‚Æ‚ ‚킹‚ÄŽg‚¤ê‡‚ÍA
#@‚±‚̃XƒNƒŠƒvƒg‚ð—ñŽÔˆÚ“®‚æ‚è‚à‰º‚É‚µ‚ÄA
#@«‚ðA USE_TRAIN_ACTOR = true ‚Æ‚µ‚Ä‚­‚¾‚³‚¢B(Žg‚í‚È‚¢‚Æ‚«‚Í = false)

 USE_TRAIN_ACTOR = false

#========================================================================
#========================================================================
#šƒNƒŠƒbƒsƒ“ƒO‚Ì‹——£Žw’è(ˆÓ–¡‚í‚©‚ñ‚È‚©‚Á‚½‚炱‚Ì‚Ü‚Ü‚ÅB)
class Game_Character

 DRAWRANGEX = 1920	 # ƒ}ƒbƒvƒLƒƒƒ‰‚̃Xƒvƒ‰ƒCƒg‚ðXV‚·‚é‹——£
 DRAWRANGEY = 1664	 # ‚©‚È‚è‘å‚«‚¢ƒLƒƒƒ‰ƒ`ƒbƒv‚ðŽg‚¤ê‡‚Í‘‚₵‚Ä‚­‚¾‚³‚¢B
					# X:14 Y:12ƒ^ƒCƒ‹‘OŒã„§ ƒ^ƒCƒ‹”‚É128Š|‚¯‚½”’l‚ðŽw’èB
					# ‚¿‚È‚Ý‚ÉオX(‰¡)‰º‚ªY(c)‚Å‚·B
end

#========================================================================
#========================================================================
#š•Û‘¶‚·‚é‚©”Û‚©B(ŽÀۂɃ‰ƒ“ƒ_ƒ€‹@”\\\\‚ÍŽg‚í‚È‚¢‚¯‚ÇAì‚éŽèŠÔ‚ÍÈ‚«‚½‚¢•û‚ÉB)
#  ‚±‚ê‚Å•Û‘¶‚³‚ꂽƒ}ƒbƒv‚ðA‘¼‚̃}ƒbƒv‚ɃRƒs[‚·‚ê‚ÎA§ì‚ÌŽèŠÔ‚ªÈ‚¯‚Ü‚·B
class Game_Map

 AUTO_MAP_SAVE = true	# ƒ}ƒbƒv‚ðID:999‚É•Û‘¶‚·‚é‚©‚Ç‚¤‚©B
					  # true ‚È‚ç•Û‘¶@false ‚È‚ç•Û‘¶‚µ‚È‚¢

					  # Š®¬‚µ‚½ƒQ[ƒ€‚ðŒöŠJ‚·‚éÛ‚Ífalse‚É‚µ‚Ä‚­‚¾‚³‚¢B

end


#-------------------------------------------------------------------
# œGame_TempƒNƒ‰ƒX
#--------------------------------------------------------------------

class Game_Temp
 alias initialize_tonbi1 initialize
 def initialize
initialize_tonbi1

$onscreen = []						# ƒXƒvƒ‰ƒCƒg‰æ–Ê“àƒtƒ‰ƒO
 end
end


 #--------------------------------------------------------------------------
 # œ Game_CharacterƒNƒ‰ƒX
 #--------------------------------------------------------------------------

class Game_Character
 #--------------------------------------------------------------------------
 # œ ƒtƒŒ[ƒ€XV
 #--------------------------------------------------------------------------
 alias update_tonbi1 update
 def update

#‰æ–Êã‚ł̈ʒu
sx = @real_x - $game_map.display_x - 1280
sy = @real_y - $game_map.display_y - 960
# â‘Î’l‚ð‹‚ß‚é
abs_sx = sx > 0 ? sx : -sx
abs_sy = sy > 0 ? sy-3 : -sy

# c‚©‰¡‚ª DRAWRANGE ƒ^ƒCƒ‹ˆÈã—£‚ê‚Ä‚¢‚éê‡
if abs_sx > DRAWRANGEX or abs_sy > DRAWRANGEY
  # ƒXƒvƒ‰ƒCƒg”ñXV‚É‚·‚é
  $onscreen[@id]=false
else
  # ƒXƒvƒ‰ƒCƒgXV‚ ‚è‚É‚·‚é
  $onscreen[@id]=true
end

update_tonbi1
 end
end

class Spriteset_Map
 #--------------------------------------------------------------------------
 # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
 #--------------------------------------------------------------------------
 attr_accessor :character_sprites
 def initialize

$onscreen = []
# ƒrƒ…[ƒ|[ƒg‚ðì¬
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
# ƒ^ƒCƒ‹ƒ}ƒbƒv‚ðì¬
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
  autotile_name = $game_map.autotile_names[i]
  @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
# ƒpƒmƒ‰ƒ}ƒvƒŒ[ƒ“‚ðì¬
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
# ƒtƒHƒOƒvƒŒ[ƒ“‚ðì¬
@fog = Plane.new(@viewport1)
@fog.z = 3000

#########################################################š•ÏX
# ƒLƒƒƒ‰ƒNƒ^[ƒXƒvƒ‰ƒCƒg‚ðì¬
# ƒp[ƒeƒB‚ƃCƒxƒ“ƒg‚𕪂¯‚½B
@character_sprites = []
@party_sprites = []
for i in $game_map.events.keys.sort
  sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
  @character_sprites[i]=sprite
  $onscreen[i] = true
end
@party_sprites.push(Sprite_Character.new(@viewport1, $game_player))
#########################################################

# “VŒó‚ðì¬
@weather = RPG::Weather.new(@viewport1)
# ƒsƒNƒ`ƒƒ‚ðì¬
@picture_sprites = []
for i in 1..50
  @picture_sprites.push(Sprite_Picture.new(@viewport2,
	$game_screen.pictures[i]))
end
# ƒ^ƒCƒ}[ƒXƒvƒ‰ƒCƒg‚ðì¬
@timer_sprite = Sprite_Timer.new
# ƒtƒŒ[ƒ€XV
update
 end
 #--------------------------------------------------------------------------
 # œ ‰ð•ú
 #--------------------------------------------------------------------------
 def dispose
# ƒ^ƒCƒ‹ƒ}ƒbƒv‚ð‰ð•ú
@tilemap.tileset.dispose
for i in 0..6
  @tilemap.autotiles[i].dispose
end
@tilemap.dispose
# ƒpƒmƒ‰ƒ}ƒvƒŒ[ƒ“‚ð‰ð•ú
@panorama.dispose
# ƒtƒHƒOƒvƒŒ[ƒ“‚ð‰ð•ú
@fog.dispose
############################################################š•ÏX
# ƒLƒƒƒ‰ƒNƒ^[ƒXƒvƒ‰ƒCƒg‚ð‰ð•ú
# nil ‚È‚çŠJ•ú‚µ‚È‚¢
for i in @character_sprites
  if i != nil
	i.dispose
  end
end
for i in @party_sprites
  if i != nil
	i.dispose
  end
end
############################################################
# “VŒó‚ð‰ð•ú
@weather.dispose
# ƒsƒNƒ`ƒƒ‚ð‰ð•ú
for sprite in @picture_sprites
  sprite.dispose
end
# ƒ^ƒCƒ}[ƒXƒvƒ‰ƒCƒg‚ð‰ð•ú
@timer_sprite.dispose
# ƒrƒ…[ƒ|[ƒg‚ð‰ð•ú
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
 end
 #--------------------------------------------------------------------------
 # œ ƒtƒŒ[ƒ€XV
 #--------------------------------------------------------------------------
 def update
# ƒpƒmƒ‰ƒ}‚ªŒ»Ý‚Ì‚à‚̂ƈقȂéê‡
if @panorama_name != $game_map.panorama_name or
   @panorama_hue != $game_map.panorama_hue
  @panorama_name = $game_map.panorama_name
  @panorama_hue = $game_map.panorama_hue
  if @panorama.bitmap != nil
	@panorama.bitmap.dispose
	@panorama.bitmap = nil
  end
  if @panorama_name != \\\"\\\"
	@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
  end
  Graphics.frame_reset
end
# ƒtƒHƒO‚ªŒ»Ý‚Ì‚à‚̂ƈقȂéê‡
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
  @fog_name = $game_map.fog_name
  @fog_hue = $game_map.fog_hue
  if @fog.bitmap != nil
	@fog.bitmap.dispose
	@fog.bitmap = nil
  end
  if @fog_name != \\\"\\\"
	@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
  end
  Graphics.frame_reset
end
# ƒ^ƒCƒ‹ƒ}ƒbƒv‚ðXV
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
# ƒpƒmƒ‰ƒ}ƒvƒŒ[ƒ“‚ðXV
@panorama.ox = $game_map.display_x / 8
@panorama.oy = $game_map.display_y / 8
# ƒtƒHƒOƒvƒŒ[ƒ“‚ðXV
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone

#####################################################š•ÏX
# ƒLƒƒƒ‰ƒNƒ^[ƒXƒvƒ‰ƒCƒg‚ðXV
# ‰æ–ÊŠO‚̃Xƒvƒ‰ƒCƒg‚ÍXV‚µ‚È‚¢
for i in $game_map.events.keys
  if $onscreen[i]
	@character_sprites[i].update
  end
end
# ƒvƒŒƒCƒ„[ƒLƒƒƒ‰XV
for i in @party_sprites
  i.update
end

#####################################################

# “VŒóƒOƒ‰ƒtƒBƒbƒN‚ðXV
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
# ƒsƒNƒ`ƒƒ‚ðXV
for sprite in @picture_sprites
  sprite.update
end
# ƒ^ƒCƒ}[ƒXƒvƒ‰ƒCƒg‚ðXV
@timer_sprite.update
# ‰æ–Ê‚ÌF’²‚ƃVƒFƒCƒNˆÊ’u‚ðÝ’è
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# ‰æ–ʂ̃tƒ‰ƒbƒVƒ…F‚ðÝ’è
@viewport3.color = $game_screen.flash_color
# ƒrƒ…[ƒ|[ƒg‚ðXV
@viewport1.update
@viewport3.update
 end
end

if USE_TRAIN_ACTOR == true
 module Train_Actor
module Spriteset_Map_Module
  def setup_actor_character_sprites(characters)
	if !setup_actor_character_sprites?
	  for character in characters.reverse
		@party_sprites.unshift(
		  Sprite_Character.new(@viewport1, character)
		)
	  end
	  @setup_actor_character_sprites_flag = true
	end
  end
end
 end
end


#==============================================================================
# ¡ Game_Map
#==============================================================================
class Game_Map
 #--------------------------------------------------------------------------
 # œ ƒZƒbƒgƒAƒbƒv
 #	 map_id : ƒ}ƒbƒv ID
 #--------------------------------------------------------------------------
 def setup(map_id)
# ƒ}ƒbƒv ID ‚ð @map_id ‚É‹L‰¯
@map_id = map_id
# ƒ}ƒbƒv‚ðƒtƒ@ƒCƒ‹‚©‚çƒ[ƒh‚µA@map ‚ÉÝ’è
@map = load_data(sprintf(\\\"Data/Map%03d.rxdata\\\", @map_id))
# ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”‚Ƀ^ƒCƒ‹ƒZƒbƒg‚Ìî•ñ‚ðÝ’è
tileset = $data_tilesets[@map.tileset_id]
@tileset_name = tileset.tileset_name
@autotile_names = tileset.autotile_names
@panorama_name = tileset.panorama_name
@panorama_hue = tileset.panorama_hue
@fog_name = tileset.fog_name
@fog_hue = tileset.fog_hue
@fog_opacity = tileset.fog_opacity
@fog_blend_type = tileset.fog_blend_type
@fog_zoom = tileset.fog_zoom
@fog_sx = tileset.fog_sx
@fog_sy = tileset.fog_sy
@battleback_name = tileset.battleback_name
@passages = tileset.passages
@priorities = tileset.priorities
@terrain_tags = tileset.terrain_tags
# •\\\\Ž¦À•W‚ð‰Šú‰»
@display_x = 0
@display_y = 0

check_special_map #š

# ƒŠƒtƒŒƒbƒVƒ…—v‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
@need_refresh = false
# ƒ}ƒbƒvƒCƒxƒ“ƒg‚̃f[ƒ^‚ðÝ’è
@events = {}
for i in @map.events.keys
  @events[i] = Game_Event.new(@map_id, @map.events[i])
end
# ƒRƒ‚ƒ“ƒCƒxƒ“ƒg‚̃f[ƒ^‚ðÝ’è
@common_events = {}
for i in 1...$data_common_events.size
  @common_events[i] = Game_CommonEvent.new(i)
end
# ƒtƒHƒO‚ÌŠeî•ñ‚ð‰Šú‰»
@fog_ox = 0
@fog_oy = 0
@fog_tone = Tone.new(0, 0, 0, 0)
@fog_tone_target = Tone.new(0, 0, 0, 0)
@fog_tone_duration = 0
@fog_opacity_duration = 0
@fog_opacity_target = 0
# ƒXƒNƒ[ƒ‹î•ñ‚ð‰Šú‰»
@scroll_direction = 2
@scroll_rest = 0
@scroll_speed = 4
 end
 #--------------------------------------------------------------------------
 # œ ƒ}ƒbƒv‚ð“Ç‚Ýž‚ñ‚¾’¼Œã‚̈—
 #--------------------------------------------------------------------------
 def check_special_map
# ƒ}ƒbƒv‚Ì–¼‘O‚̃f[ƒ^‚ðŽæ“¾
mapinfo  = load_data(\\\"Data/MapInfos.rxdata\\\")

# ƒ}ƒbƒv‚̃Tƒuƒl[ƒ€‚ª\\\"ƒ‰ƒ“ƒ_ƒ€\\\"‚È‚ç
if mapinfo[@map_id].subname == \\\"ƒ‰ƒ“ƒ_ƒ€\\\"
  if mapinfo[@map_id].subname(3)==\\\"\\\" or mapinfo[@map_id].subname(3) == nil
	p3 = 0
  else
	p3 = mapinfo[@map_id].subname(3).to_i
  end
  if mapinfo[@map_id].subname(4)==\\\"false\\\"
	p4 = false
  end

  make_random_map(2,mapinfo[@map_id].subname(2).to_i,p3,p4)
end
 end

 #--------------------------------------------------------------------------
 # œ ƒ‰ƒ“ƒ_ƒ€ƒ}ƒbƒv‚ð쬂·‚é
 #	 wall = •Ç‚Ì‚‚³@>>@Œ»Žž“_‚Å‚Í–³Œø
 #	 type = •Ç»ìƒ^ƒCƒv@>>@‚O‚µ‚©ì‚Á‚Ä‚Ü‚¹‚ñ(Š¾@Žw’è•û–@‚à–¢’è
 #	 thoughplayer = ƒvƒŒƒCƒ„[‚à’†Œp“_‚ÉŠÜ‚ß‚é‚©H
 #	 connect = ’†Œp“_‚ÌŒ‹‚Ñ•û >> true=˜A‘± false=‚QŒÂ‚¸‚“Ɨ§
 #
 #	 ¦‚·‚ׂĂ̈ø”È—ª‰» @‰º‚Ì—p‚É”ò‚΂·‚±‚Æ‚à‰Â”\\\\
 #	 ex. make_random_map(2,0,,true)
 #--------------------------------------------------------------------------
 def make_random_map(wall = 2, type = 0, objcnt = 0, connect = true)

# ƒpƒ‰ƒ[ƒ^ˆÙí‚Ì‘Îô
wall = 0 if wall == nil
type = 0 if type == nil
objcnt = 0 if objcnt == nil
unless objcnt.is_a?(Numeric)
  objcnt = 0
end
if objcnt < 0
  objcnt = 0
end
connect = true if connect != false

# ‚‚³ƒf[ƒ^”z—ñ
@heightdata = Table.new(@map.width,@map.height)
# ’nŒ`ƒf[ƒ^”z—ñ
@maskdata = Table.new(@map.width,@map.height)
# ƒCƒxƒ“ƒg“™”z’uƒf[ƒ^”z—ñ
@oneventdata = Table.new(@map.width,@map.height)
# ƒ}ƒXƒNÝ’èƒf[ƒ^”z—ñ
@masksetting = []
# »ì•û–@ƒf[ƒ^
@makedata = []

# ‰‰ŽZ•û–@‰Šú‰»
@targettype=0
@chgtype=0

time = -1
# Šeƒf[ƒ^‰Šú‰»
for i in 0...@map.width
  for j in 0...@map.height
	time += 1
	if time%2000 == 0
	  Graphics.update
	end
	@heightdata[i,j] = 0
	@maskdata[i,j] = 0
  end
end
for i in 0...100
  @masksetting[i] = true
end

# ’†Œp“_î•ñŽæ“¾
needposx = []
needposy = []
# ƒCƒxƒ“ƒgu’†Œp“_v‚ð’ljÁ
for i in @map.events.keys.sort
  time += 1
  if time%200 == 0
	Graphics.update
  end
  if event_settype(i) == 1
	if connect == true
	  needposx.push(@map.events[i].x)
	  needposy.push(@map.events[i].y)
	  needposx.push(@map.events[i].x)
	  needposy.push(@map.events[i].y)
	else
	  needposx.push(@map.events[i].x)
	  needposy.push(@map.events[i].y)
	end
  end
end
if connect == true
  needposx.shift
  needposy.shift
end
loop do
  if needposx.size <= 2
	needposx.push(rand(@map.width))
	needposy.push(rand(@map.height))
  else
	break
  end
end

# ‚±‚±‚Å»ì•û–@ƒf[ƒ^‚ðƒZƒbƒg‚·‚é
case type
when 0
  # ƒ^ƒCƒv0 >> ‚Q‘wŽ©‘Rƒ^ƒCƒv
  @makedata.push([0,1,0])
  @makedata.push([5,1])
  for i in 0...(needposx.size/2)
	@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
	@makedata.push([3,0,-15,4,0])
	@makedata.push([1,1,1,1,1])
	@makedata.push([6,0,needposx[i*2],needposy[i*2]])
	@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
  end

  @makedata.push([4,0,1,1,1])
  @makedata.push([4,0,1,1,1])
  @makedata.push([4,1,1,1,1])

  @makedata.push([0,0,0])
  @makedata.push([2,0,2])
  @makedata.push([5,0])
  @makedata.push([2,1,2])
  @makedata.push([5,1])
when 1
  # ƒ^ƒCƒv1 >> ‚Q‘wlHƒ^ƒCƒv
  @makedata.push([0,1,0])
  @makedata.push([5,1])
  for i in 0...(needposx.size/2)
	@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
	@makedata.push([3,0,-6,4,1,10])
	@makedata.push([1,1,1,1,1])
	@makedata.push([6,0,needposx[i*2],needposy[i*2]])
	@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
  end

  @makedata.push([4,0,2,3,1])
  @makedata.push([4,1,2,2,1])
  @makedata.push([4,0,1,1,1])

  @makedata.push([0,0,0])
  @makedata.push([2,0,2])
  @makedata.push([5,0])
  @makedata.push([2,1,2])
  @makedata.push([5,1])
when 2
  # ƒ^ƒCƒv2 >> ‚Q‘wŽ©‘R“ʃ^ƒCƒv
  @makedata.push([0,1,0])
  @makedata.push([5,1])
  for i in 0...(needposx.size/2)
	@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
	@makedata.push([3,0,-15,4,0])
	@makedata.push([1,1,1,1,1])
	@makedata.push([6,0,needposx[i*2],needposy[i*2]])
	@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
  end

  @makedata.push([4,0,2,2,1])
  @makedata.push([4,1,1,1,1])

  @makedata.push([0,0,0])
  @makedata.push([2,0,2])
  @makedata.push([5,0])
  @makedata.push([2,1,2])
  @makedata.push([5,-1])
when 3
  # ƒ^ƒCƒv2 >> ‚Q‘wlH“ʃ^ƒCƒv
  @makedata.push([0,1,0])
  @makedata.push([5,1])
  for i in 0...(needposx.size/2)
	@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
	@makedata.push([3,0,-15,4,1,10])
	@makedata.push([1,1,1,1,1])
	@makedata.push([6,0,needposx[i*2],needposy[i*2]])
	@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
  end

  @makedata.push([4,0,2,2,1])
  @makedata.push([4,1,1,1,1])

  @makedata.push([0,0,0])
  @makedata.push([2,0,2])
  @makedata.push([5,0])
  @makedata.push([2,1,2])
  @makedata.push([5,-1])
when 4
  # ƒ^ƒCƒv4 >> ‚Q‘wŽ©‘Rƒ^ƒCƒv ‚»‚Ì‚P
  # ’nŒ`[0:ŒŠ 1:’n–Ê 2:•Ç]

  # Šî–{Ý’è
  @makedata.push([0,1,0])
  @makedata.push([5,0])
  # •Ç‚ð’u‚­
  @makedata.push([1,0,0,-1,0])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,-1,0,-1,-1])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,-1,-1,0,-1])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,0,-1,0,0])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([4,2,2,2,1])
  # ŒŠ‚ðƒ‰ƒ“ƒ_ƒ€‚Å’u‚­
  for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
	@makedata.push([1,3,3,8,8])
	@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
  end
  # ŽüˆÍ‚É•Çì¬
  @makedata.push([7,2])
  @makedata.push([4,2,1,1,1])
  # “¹ì¬
  for i in 0...(needposx.size/2)
	@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
	@makedata.push([3,1,-8,4,0,5])
	@makedata.push([1,1,1,1,1])
	@makedata.push([6,1,needposx[i*2],needposy[i*2]])
	@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
  end
  # Šg’£ˆ—
  @makedata.push([4,1,1,1,1])
  @makedata.push([4,1,0,1,1])
  @makedata.push([2,0,0])
  @makedata.push([4,1,1,0,1])
  @makedata.push([2,-1,1])
  @makedata.push([4,2,1,1,1])
  # ‚‚³Ý’è
  @makedata.push([0,0,0])
  @makedata.push([2,0,2])
  @makedata.push([5,-1])
  @makedata.push([2,1,2])
  @makedata.push([5,0])
  @makedata.push([2,2,2])
  @makedata.push([5,1])

when 5
  # ƒ^ƒCƒv5 >> ‚Q‘wlHƒ^ƒCƒv ‚»‚Ì‚P
  # ’nŒ`[0:ŒŠ 1:’n–Ê 2:•Ç]

  # Šî–{Ý’è
  @makedata.push([0,1,0])
  @makedata.push([5,0])
  # •Ç‚ð’u‚­
  @makedata.push([1,0,0,-1,0])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,-1,0,-1,-1])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,-1,-1,0,-1])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,0,-1,0,0])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([4,2,2,2,1])
  # ŒŠ‚ðƒ‰ƒ“ƒ_ƒ€‚Å’u‚­
  for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
	@makedata.push([1,3,3,8,8])
	@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
  end
  # ŽüˆÍ‚É•Çì¬
  @makedata.push([7,2])
  @makedata.push([4,2,1,1,1])
  # “¹ì¬
  for i in 0...(needposx.size/2)
	@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
	@makedata.push([3,1,-8,4,1,5])
	@makedata.push([1,1,1,1,1])
	@makedata.push([6,1,needposx[i*2],needposy[i*2]])
	@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
  end
  # Šg’£ˆ—
  @makedata.push([4,1,1,1,1])
  @makedata.push([4,1,0,1,1])
  @makedata.push([2,0,0])
  @makedata.push([4,1,1,0,1])
  @makedata.push([2,-1,1])
  @makedata.push([4,2,1,1,1])
  # ‚‚³Ý’è
  @makedata.push([0,0,0])
  @makedata.push([2,0,2])
  @makedata.push([5,-1])
  @makedata.push([2,1,2])
  @makedata.push([5,0])
  @makedata.push([2,2,2])
  @makedata.push([5,1])



when 6
  # ƒ^ƒCƒv6 >> ‚Q‘wŽ©‘Rƒ^ƒCƒv@‚»‚Ì‚Q
  # ’nŒ`[0:ŒŠ 1:’n–Ê 2:•Ç]

  # Šî–{Ý’è
  @makedata.push([0,1,0])
  @makedata.push([5,0])
  # •Ç‚ð’u‚­
  @makedata.push([1,0,0,-1,0])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,-1,0,-1,-1])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,-1,-1,0,-1])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,0,-1,0,0])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([4,2,2,2,1])
  # ŒŠ‚ðƒ‰ƒ“ƒ_ƒ€‚Å’u‚­
  for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
	@makedata.push([1,1,1,3,3])
	@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
  end
  # ŒŠŠg‘å
  @makedata.push([4,0,2,2,0])
  @makedata.push([4,0,1,2,1])
  # ŽüˆÍ‚É•Çì¬
  @makedata.push([7,2])
  @makedata.push([4,2,1,1,1])
  # “¹ì¬
  for i in 0...(needposx.size/2)
	@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
	@makedata.push([3,1,-15,4,0,5])
	@makedata.push([1,1,1,1,1])
	@makedata.push([6,1,needposx[i*2],needposy[i*2]])
	@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
  end
  # Šg’£ˆ—
  @makedata.push([4,1,1,1,1])
  @makedata.push([4,1,0,1,1])
  @makedata.push([2,0,0])
  @makedata.push([4,1,1,0,1])
  @makedata.push([2,-1,1])
  @makedata.push([4,2,1,1,1])
  # ‚‚³Ý’è
  @makedata.push([0,0,0])
  @makedata.push([2,0,2])
  @makedata.push([5,-1])
  @makedata.push([2,1,2])
  @makedata.push([5,0])
  @makedata.push([2,2,2])
  @makedata.push([5,1])

when 7
  # ƒ^ƒCƒv7 >> ‚Q‘wlHƒ^ƒCƒv@‚»‚Ì‚Q
  # ’nŒ`[0:ŒŠ 1:’n–Ê 2:•Ç]

  # Šî–{Ý’è
  @makedata.push([0,1,0])
  @makedata.push([5,0])
  # •Ç‚ð’u‚­
  @makedata.push([1,0,0,-1,0])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,-1,0,-1,-1])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,-1,-1,0,-1])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([1,0,-1,0,0])
  @makedata.push([3,2,-6,1,0])
  @makedata.push([4,2,2,2,1])
  # ŒŠ‚ðƒ‰ƒ“ƒ_ƒ€‚Å’u‚­
  for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
	@makedata.push([1,1,1,3,3])
	@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
  end
  # ŒŠŠg‘å
  @makedata.push([4,0,2,2,0])
  @makedata.push([4,0,1,2,1])
  # ŽüˆÍ‚É•Çì¬
  @makedata.push([7,2])
  @makedata.push([4,2,1,1,1])
  # “¹ì¬
  for i in 0...(needposx.size/2)
	@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
	@makedata.push([3,1,-15,4,1,5])
	@makedata.push([1,1,1,1,1])
	@makedata.push([6,1,needposx[i*2],needposy[i*2]])
	@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
  end
  # Šg’£ˆ—
  @makedata.push([4,1,1,1,1])
  @makedata.push([4,1,0,1,1])
  @makedata.push([2,0,0])
  @makedata.push([4,1,1,0,1])
  @makedata.push([2,-1,1])
  @makedata.push([4,2,1,1,1])
  # ‚‚³Ý’è
  @makedata.push([0,0,0])
  @makedata.push([2,0,2])
  @makedata.push([5,-1])
  @makedata.push([2,1,2])
  @makedata.push([5,0])
  @makedata.push([2,2,2])
  @makedata.push([5,1])
end


# ŽÀÛ‚Éì‚é
for make_stat in @makedata
  time += 1
  if time%2 == 0
	Graphics.update
  end
  case make_stat[0]
  when 0	# ‘ÎÛ•ÏX   (p1[0=‚‚³ 1=’nŒ`], p2[0=‘ã“ü 1=‰ÁŽZ])
	rndmap_chtarget(make_stat[1],make_stat[2])
  when 1	# ˆø”Ý’è   (minx, miny, maxz, maxy)
	rndmap_setstat(make_stat[1],make_stat[2],make_stat[3],make_stat[4])
  when 2	# ƒ}ƒXƒN•ÏX (p1[-1:‘S•”], p2[ 0=false 1=true 2=onlytrue])
	rndmap_chmask(make_stat[1],make_stat[2])
  when 3	# “¹ì¬	 (’l,’†Œp“_”,•£Šm•Û,ƒ^ƒCƒv)
	rndmap_mkroad(make_stat[1],make_stat[2],make_stat[3],make_stat[4],make_stat[5])
  when 4	# Šg’£	   (‘ÎÛ,c•,‰¡•,ƒ^ƒCƒv)
	rndmap_plus(make_stat[1],make_stat[2],make_stat[3],make_stat[4])
  when 5	# ‘S•ÏX	 (’l)
	rndmap_allchg(make_stat[1])
  when 6	# Žw’è“_	 (’l,ˆÊ’uX,ˆÊ’uY)
	rndmap_putpos(make_stat[1],make_stat[2],make_stat[3])
  when 7	# ŽüˆÍ	   (’l)
	rndmap_edge(make_stat[1])
  end
end

# Žg—pƒ}ƒbƒvƒ^ƒCƒ‹Žæ“¾
@tilesetting = Table.new(3,40,3)
for i in [0,1,2]
  for k in 0...40
	for j in [0,1,2]
	  @tilesetting[j,k,i] = @map.data[j,k,i]
	end
  end
end

# •â³‚·‚é
time = 0
for k in 0...@map.height
  for j in 0...@map.width
	time += 1
	# ŽžŠÔ‚©‚©‚é‚Ì‚ÅA’èŠú“I‚ɉæ–ÊXV
	if time%500 == 0
	  Graphics.update
	end
	# •Ç‚̉º‚̃^ƒCƒ‹‚ªŒŠ‚È‚ç’n–Ê‚É•ÏX
	if @heightdata[j,k] == 1
	  if @heightdata[j,k+1]==-1
		@heightdata[j,k+1] = 0
		if @heightdata[j,k+2]==-1 and
		  @heightdata[j,k+3] == 0
		  @heightdata[j,k+2] = 0
		end
	  end
	end

  end
end



# ’n–Êì¬@‚»‚̈ë >> ‚Æ‚è‚ ‚¦‚¸•~‚«‹l‚ß‚é
time = 0
for k in 0...@map.height
  for j in 0...@map.width
	time += 1
	# ŽžŠÔ‚©‚©‚é‚Ì‚ÅA’èŠú“I‚ɉæ–ÊXV
	if time%500 == 0
	  Graphics.update
	end
	if @heightdata[j,k] == 0
	  if @heightdata[j,k+1] == -1 or
		@heightdata[j,k-1] == -1 or
		@heightdata[j+1,k] == -1 or
		@heightdata[j-1,k] == -1
		set_mapdata2(j,k,0,8)
	  else
		set_mapdata2(j,k,0,0)
	  end
	elsif @heightdata[j,k] == 1
	  if @heightdata[j,k+1] == -1 or
		@heightdata[j,k-1] == -1 or
		@heightdata[j+1,k] == -1 or
		@heightdata[j-1,k] == -1
		set_mapdata2(j,k,0,8)
	  elsif @heightdata[j,k+1] == 0 or
		@heightdata[j,k-1] == 0 or
		@heightdata[j+1,k] == 0 or
		@heightdata[j-1,k] == 0
		set_mapdata2(j,k,0,0)
	  else
		set_mapdata2(j,k,1,4)
	  end
	else
	  set_mapdata2(j,k,0,8)
	end
  end
end
# ’n–Êì¬@‚»‚Ì“ó >> ŒŠ‚Ƃ̃Gƒbƒaì¬
time = 0
for k in 0...@map.height
  for j in 0...@map.width
	time += 1
	# ŽžŠÔ‚©‚©‚é‚Ì‚ÅA’èŠú“I‚ɉæ–ÊXV
	if time%500 == 0
	  Graphics.update
	end
	if @heightdata[j,k] == 0
	  if @heightdata[j,k+1] == -1
		# ‰º‚ªŒŠ------------------
		if @heightdata[j-1,k] == -1
		  # ¶‚àŒŠ
		  for i in [0,1,2]
			set_mapdata(j,k+i,0,13+i,1)
		  end
		elsif @heightdata[j+1,k] == -1
		  # ‰E‚àŒŠ
		  for i in [0,1,2]
			set_mapdata(j,k+i,2,13+i,1)
		  end
		else
		  # —¼˜e‚à’n–Ê
		  for i in [0,1,2]
			set_mapdata(j,k+i,1,13+i,1)
		  end
		end
	  elsif @heightdata[j,k-1] == -1
		# オŒŠ------------------
		if @heightdata[j-1,k] == -1 or
		(@heightdata[j-1,k] == 1 and
		@heightdata[j-1,k-1] == -1)
		  # ¶‚àŒŠ
		  set_mapdata(j,k,0,11,2)
		elsif @heightdata[j+1,k] == -1 or
		(@heightdata[j+1,k] == 1 and
		@heightdata[j+1,k-1] == -1)
		  # ‰E‚àŒŠ
		  set_mapdata(j,k,2,11,2)
		else
		  # —¼˜e‚à’n–Ê
		  set_mapdata(j,k,1,11,2)
		end
	  elsif @heightdata[j-1,k] == -1 or
		(@heightdata[j-1,k] == 1 and
		@heightdata[j-1,k-1] == -1)
		# ¶‚ªŒŠ------------------
		set_mapdata(j,k,0,12,1)
	  elsif @heightdata[j+1,k] == -1 or
		(@heightdata[j+1,k] == 1 and
		@heightdata[j+1,k-1] == -1)
		# ‰E‚ªŒŠ------------------
		set_mapdata(j,k,2,12,1)
	  elsif @heightdata[j-1,k-1] == -1
		# ¶ã‚ªŒŠ------------------
		set_mapdata(j,k,0,9,1)
	  elsif @heightdata[j-1,k+1] == -1
		# ¶‰º‚ªŒŠ------------------
		set_mapdata(j,k,0,10,1)
	  elsif @heightdata[j+1,k-1] == -1
		# ‰EオŒŠ------------------
		set_mapdata(j,k,1,9,1)
	  elsif @heightdata[j+1,k+1] == -1
		# ‰E‰º‚ªŒŠ------------------
		set_mapdata(j,k,1,10,1)
	  end
	end
	if @heightdata[j,k] == 1 and
	  @heightdata[j,k-1] != -1

	  if @heightdata[j,k+1] == -1
		# ‰º‚ªŒŠ------------------
		if @heightdata[j-1,k] == -1
		  # ¶‚àŒŠ
		  for i in [0,1,2]
		#	set_mapdata(j,k+i,0,13+i,1)
		  end
		elsif @heightdata[j+1,k] == -1
		  # ‰E‚àŒŠ
		  for i in [0,1,2]
		#	set_mapdata(j,k+i,2,13+i,1)
		  end
		else
		  # —¼˜e‚à’n–Ê
		  for i in [0,1,2]
		#	set_mapdata(j,k+i,1,13+i,1)
		  end
		end
	  elsif @heightdata[j,k-1] == -1
		# オŒŠ------------------
		if @heightdata[j-1,k] == -1
		  # ¶‚àŒŠ
		  set_mapdata(j,k,0,11,2)
		elsif @heightdata[j+1,k] == -1
		  # ‰E‚àŒŠ
		  set_mapdata(j,k,2,11,2)
		else
		  # —¼˜e‚à’n–Ê
		  set_mapdata(j,k,1,11,2)
		end
	  elsif @heightdata[j-1,k] == -1
		# ¶‚ªŒŠ------------------
		set_mapdata(j,k,0,12,1)
	  elsif @heightdata[j+1,k] == -1
		# ‰E‚ªŒŠ------------------
		set_mapdata(j,k,2,12,1)
	  elsif @heightdata[j-1,k-1] == -1
		# ¶ã‚ªŒŠ------------------
		set_mapdata(j,k,0,9,1)
	  elsif @heightdata[j-1,k+1] == -1
		# ¶‰º‚ªŒŠ------------------
		set_mapdata(j,k,0,10,1)
	  elsif @heightdata[j+1,k-1] == -1
		# ‰EオŒŠ------------------
		set_mapdata(j,k,1,9,1)
	  elsif @heightdata[j+1,k+1] == -1
		# ‰E‰º‚ªŒŠ------------------
		set_mapdata(j,k,1,10,1)
	  end
	end
  end
end
# ’n–Êì¬@‚»‚ÌŽQ >> •Ç‚Ƃ̃Gƒbƒaì¬
time = 0
for k in 0...@map.height
  for j in 0...@map.width
	time += 1
	# ŽžŠÔ‚©‚©‚é‚Ì‚ÅA’èŠú“I‚ɉæ–ÊXV
	if time%500 == 0
	  Graphics.update
	end
	if @heightdata[j,k] == 1
	  if @heightdata[j,k+1] == 0 or
		@heightdata[j,k+1] == -1
		# ‰º‚ªŒŠ------------------
		if @heightdata[j-1,k] == 0 or
		  @heightdata[j-1,k] == -1
		  # ¶‚àŒŠ
		  set_mapdata(j,k+0,0,5+0,5)
		  set_mapdata(j,k+1,0,5+1,5)
		  set_mapdata(j,k+2,0,5+2,4)
		  if @heightdata[j,k+3] != 0 and
			@heightdata[j,k+2] != 1 and
			(@heightdata[j,k+2] != 0 or @heightdata[j-1,k+2] != 0)
			set_mapdata(j,k+2,0,16,5)
			for i in [0,1]
			  set_mapdata(j,k+3+i,0,14+i,1)
			  if @heightdata[j,k+3+i] != -1
				break
			  end
			end
		  end
		elsif @heightdata[j+1,k] == 0 or
		  @heightdata[j+1,k] == -1
		  # ‰E‚àŒŠ
		  set_mapdata(j,k+0,2,5+0,5)
		  set_mapdata(j,k+1,2,5+1,5)
		  set_mapdata(j,k+2,2,5+2,4)
		  if @heightdata[j,k+3] != 0 and
			@heightdata[j,k+2] != 1 and
			(@heightdata[j,k+2] != 0 or @heightdata[j+1,k+2] != 0)
			set_mapdata(j,k+2,2,16,5)
			for i in [0,1]
			  set_mapdata(j,k+3+i,2,14+i,1)
			  if @heightdata[j,k+3+i] != -1
				break
			  end
			end
		  end
		else
		  # —¼˜e‚à’n–Ê
		  set_mapdata(j,k+0,1,5+0,5)
		  set_mapdata(j,k+1,1,5+1,5)
		  set_mapdata(j,k+2,1,5+2,4)
		  if @heightdata[j,k+3] != 0 and
			 @heightdata[j,k+2] != 1
			set_mapdata(j,k+2,1,16,5)
			for i in [0,1]
			  set_mapdata(j,k+3+i,1,14+i,1)
			  if @heightdata[j,k+3+i] != -1
				break
			  end
			end
		  end
		end
	  elsif @heightdata[j,k-1] == 0 or
		  @heightdata[j,k-1] == -1
		# オŒŠ------------------
		if @heightdata[j-1,k] == 0 or
		  @heightdata[j-1,k] == -1
		  # ¶‚àŒŠ
		  set_mapdata(j,k,0,3,4)
		elsif @heightdata[j+1,k] == 0 or
		  @heightdata[j+1,k] == -1
		  # ‰E‚àŒŠ
		  set_mapdata(j,k,2,3,4)
		else
		  # —¼˜e‚à’n–Ê
		  set_mapdata(j,k,1,3,4)
		end
	  elsif @heightdata[j-1,k] == 0 or
		  @heightdata[j-1,k] == -1
		# ¶‚ªŒŠ------------------
		set_mapdata(j,k,0,4,4)
	  elsif @heightdata[j+1,k] == 0 or
		  @heightdata[j+1,k] == -1
		# ‰E‚ªŒŠ------------------
		set_mapdata(j,k,2,4,4)
	  elsif @heightdata[j-1,k-1] == 0 or
		  @heightdata[j-1,k-1] == -1
		# ¶ã‚ªŒŠ------------------
		set_mapdata(j,k,0,1,4)
	  elsif @heightdata[j-1,k+1] == 0 or
		  @heightdata[j-1,k+1] == -1
		# ¶‰º‚ªŒŠ------------------
		set_mapdata(j,k,0,2,4)
	  elsif @heightdata[j+1,k-1] == 0 or
		  @heightdata[j+1,k-1] == -1
		# ‰EオŒŠ------------------
		set_mapdata(j,k,1,1,4)
	  elsif @heightdata[j+1,k+1] == 0 or
		  @heightdata[j+1,k+1] == -1
		# ‰E‰º‚ªŒŠ------------------
		set_mapdata(j,k,1,2,4)
	  end
	end
  end
end

# ƒvƒŒƒCƒ„[‚̈ʒu‚ð’²ß
playerpos_reset($game_temp.player_new_x,$game_temp.player_new_y)
@oneventdata[$game_temp.player_new_x,$game_temp.player_new_y] = 1

time = 0
for i in @map.events.keys.sort
  time += 1
  if time%100 == 0
	Graphics.update
  end
  # ƒCƒxƒ“ƒgÝ’uƒ^ƒCƒv>>Š®‘SŒÅ’è(Å—Dæ)
  case event_settype(i)
  when 3
	@oneventdata[@map.events[i].x,@map.events[i].y] = 1
  end
end
for i in @map.events.keys.sort
  time += 1
  if time%100 == 0
	Graphics.update
  end
  # ƒCƒxƒ“ƒgÝ’uƒ^ƒCƒv>>’†Œp“_
  case event_settype(i)
  when 1
	set_defeventpos(i,@map.events[i].x,@map.events[i].y)
	@oneventdata[@map.events[i].x,@map.events[i].y] = 1
  end
end
# ƒCƒxƒ“ƒg‚̈ʒu‚ð’²ß
for i in @map.events.keys.sort
  time += 1
  if time%100 == 0
	Graphics.update
  end
  j = event_settype(i)
  case j
  when 0  # ƒ‰ƒ“ƒ_ƒ€
	set_defeventpos(i,rand(@map.width-4)+2,rand(@map.width-4)+2)
	@oneventdata[@map.events[i].x,@map.events[i].y] = 1
  when 2  # ΁Տ
	set_defeventpos(i,@map.events[i].x,@map.events[i].y)
	@oneventdata[@map.events[i].x,@map.events[i].y] = 1
  when 100..199  # •ÇÝ’u
	set_defeventpos_wall(i,rand(@map.width-4)+2,rand(@map.width-4)+2,j-100)
	@oneventdata[@map.events[i].x,@map.events[i].y] = 1
	@oneventdata[@map.events[i].x,@map.events[i].y-1] = 1
	for k in 1..(j-100)
	  @oneventdata[@map.events[i].x+k,@map.events[i].y] = 1
	  @oneventdata[@map.events[i].x+k,@map.events[i].y-1] = 1
	  @oneventdata[@map.events[i].x-k,@map.events[i].y] = 1
	  @oneventdata[@map.events[i].x-k,@map.events[i].y-1] = 1
	end
  when 200..299  # •ÇÝ’uŒÅ’è
	set_defeventpos_wall(i,@map.events[i].x,@map.events[i].y,j-200)
	@oneventdata[@map.events[i].x,@map.events[i].y] = 1
	@oneventdata[@map.events[i].x,@map.events[i].y-1] = 1
	for k in 1..(j-200)
	  @oneventdata[@map.events[i].x+k,@map.events[i].y] = 1
	  @oneventdata[@map.events[i].x+k,@map.events[i].y-1] = 1
	  @oneventdata[@map.events[i].x-k,@map.events[i].y] = 1
	  @oneventdata[@map.events[i].x-k,@map.events[i].y-1] = 1
	end
  end
end

# áŠQ•¨‚ð’u‚­
for i in 0...(rand(objcnt)+objcnt/2)
  time += 1
  if time%500 == 0
	Graphics.update
  end
  j = rand(@map.width)
  k = rand(@map.width)
  case rand(10)
  when 0..4
	if standable_newtile?(1,0)
	  if standable?(j,k)
		set_mapdata(j,k,1,0,6)
	  end
	else
	  if standable2?(j,k)
		set_mapdata(j,k,1,0,6)
	  end
	end
  when 5..7
	if standable_newtile?(2,0)
	  if standable?(j,k)
		set_mapdata(j,k,2,0,6)
	  end
	else
	  if standable2?(j,k)
		set_mapdata(j,k,2,0,6)
	  end
	end
  when 8..9
	if standable2?(j,k)
	  if @map.data[j,k-1,2]==0 and
		(@map.data[j,k,1]==0 or @map.data[j,k,2]==0)
		set_mapdata(j,k,2,2,4)	# 4>6?
		set_mapdata(j,k-1,2,1,4)  # 4>2?
	  end
	end
  end
end


# •Ï”‚Ì“à—eŠJ•ú(‚±‚ê‚Å‚³‚ê‚é‚Ì‚©‚ÈH)
@heightdata.resize(0,0)
@maskdata.resize(0,0)
@oneventdata.resize(0,0)
@masksetting.clear
@makedata.clear
@tilesetting.resize(0,0,0)

if AUTO_MAP_SAVE
	# •Û‘¶‹@”\\\\
  save_data(@map,sprintf(\\\"Data/Map%03d.rxdata\\\", 999))
  maplist  = load_data(\\\"Data/MapInfos.rxdata\\\")

  mapinfo = RPG::MapInfo.new
  mapinfo.name = sprintf(\\\"ƒ‰ƒ“ƒ_ƒ€Ž©“®•Û‘¶(%s)\\\", maplist[@map_id].name)
  mapinfo.parent_id = 0
  mapinfo.order = 999
  mapinfo.expanded = true
  mapinfo.scroll_x = 0
  mapinfo.scroll_y = 0

  maplist[999]=mapinfo
  save_data(maplist,\\\"Data/MapInfos.rxdata\\\")
end
 end
 #--------------------------------------------------------------------------
 # œ ƒCƒxƒ“ƒg‚̈ʒuƒ^ƒCƒvŽæ“¾
 #--------------------------------------------------------------------------
 def event_settype(i)
if @map.events[i].subname == \\\"’†Œp“_\\\"
  return 1
end
if @map.events[i].subname == \\\"΁Տ\\\"
  return 2
end
if @map.events[i].subname == \\\"Š®‘SŒÅ’è\\\"
  return 3
end
for j in 0..1000
  if @map.events[i].pages[0].list[j].code != 108
	break
  end
  # ƒRƒƒ“ƒg‚É’†Œp“_‚Æ‚ ‚ê‚Î
  if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == \\\"’†Œp“_\\\"
	return 1
  end
  # ƒRƒƒ“ƒg‚ÉŠ®‘SŒÅ’è‚Æ‚ ‚ê‚Î
  if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == \\\"Š®‘SŒÅ’è\\\"
	return 3
  end
  # ƒRƒƒ“ƒg‚ɌŒè‚Æ‚ ‚ê‚Î
  if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == \\\"΁Տ\\\"
	return 2
  end
  # ƒRƒƒ“ƒg‚É•ÇÝ’u‚Æ‚ ‚ê‚Î
  if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == \\\"•ÇÝ’u\\\"
	if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[1] == nil
	  return 100
	else
	  k = @map.events[i].pages[0].list[j].parameters[0].split(/,/)[1]
	  k = k.to_i
	  return 100+k
	end
  end
  # ƒRƒƒ“ƒg‚É•ÇÝ’uŒÅ’è‚Æ‚ ‚ê‚Î
  if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[0] == \\\"•ÇÝ’uŒÅ’è\\\"
	if @map.events[i].pages[0].list[j].parameters[0].split(/,/)[1] == nil
	  return 200
	else
	  k = @map.events[i].pages[0].list[j].parameters[0].split(/,/)[1]
	  k = k.to_i
	  return 200+k
	end
  end
end
return 0
 end
 #--------------------------------------------------------------------------
 # œ ƒCƒxƒ“ƒg‚ðŽw’èˆÊ’u•t‹ß‚ÉÝ’u
 #--------------------------------------------------------------------------
 def set_defeventpos(id,x,y)
if standable2?(x,y)
  @map.events[id].x=x
  @map.events[id].y=y
  return
end
for i in 1..([@map.width,@map.height].max)
  if standable2?(x,y+i)
	@map.events[id].x=x
	@map.events[id].y=y+i
	return
  end
  for j in 1..i
	if standable2?(x-j,y+i)
	  @map.events[id].x=x-j
	  @map.events[id].y=y+i
	  return
	end
	if standable2?(x+j,y+i)
	  @map.events[id].x=x+j
	  @map.events[id].y=y+i
	  return
	end
	if standable2?(x-j,y-i)
	  @map.events[id].x=x-j
	  @map.events[id].y=y-i
	  return
	end
	if standable2?(x+j,y-i)
	  @map.events[id].x=x+j
	  @map.events[id].y=y-i
	  return
	end
  end
end
 end
 #--------------------------------------------------------------------------
 # œ ƒCƒxƒ“ƒg‚ðŽw’èˆÊ’u•t‹ß‚Ì•Ç‚ÉÝ’u
 #	 p4   •
 #--------------------------------------------------------------------------
 def set_defeventpos_wall(id,x,y,p4)
if standable3?(x,y,p4)
  @map.events[id].x=x
  @map.events[id].y=y
  return
end
for i in 1..([@map.width,@map.height].max)
  if standable3?(x,y+i,p4)
	@map.events[id].x=x
	@map.events[id].y=y+i
	return
  end
  for j in 1..i
	if standable3?(x-j,y+i,p4)
	  @map.events[id].x=x-j
	  @map.events[id].y=y+i
	  return
	end
	if standable3?(x+j,y+i,p4)
	  @map.events[id].x=x+j
	  @map.events[id].y=y+i
	  return
	end
	if standable3?(x-j,y-i,p4)
	  @map.events[id].x=x-j
	  @map.events[id].y=y-i
	  return
	end
	if standable3?(x+j,y-i,p4)
	  @map.events[id].x=x+j
	  @map.events[id].y=y-i
	  return
	end
  end
end
 end
 #--------------------------------------------------------------------------
 # œ ƒvƒŒƒCƒ„[‚ðŽw’èˆÊ’u•t‹ß‚ÉÝ’u
 #--------------------------------------------------------------------------
 def playerpos_reset(x,y)
if standable?(x,y)
  $game_temp.player_new_x=x
  $game_temp.player_new_y=y
  return
end
for i in 1..([@map.width,@map.height].max)
  if standable?(x,y+i)
	$game_temp.player_new_x=x
	$game_temp.player_new_y=y+i
	return
  end
  for j in 0..i
	if standable?(x-j,y+i)
	  $game_temp.player_new_x=x-j
	  $game_temp.player_new_y=y+i
	  return
	end
	if standable?(x+j,y+i)
	  $game_temp.player_new_x=x+j
	  $game_temp.player_new_y=y+i
	  return
	end
	if standable?(x-j,y-i)
	  $game_temp.player_new_x=x-j
	  $game_temp.player_new_y=y-i
	  return
	end
	if standable?(x+j,y-i)
	  $game_temp.player_new_x=x+j
	  $game_temp.player_new_y=y-i
	  return
	end
  end
end
 end
 #--------------------------------------------------------------------------
 # œ Ž©•ª‚Í’Ê‚ê‚é‚©H(áŠQ•¨ƒ^ƒCƒ‹)
 #	 p1,p2 ˆÊ’uX,Y
 #--------------------------------------------------------------------------
 def standable_newtile?(p1,p2)
for i in [2, 1, 0]
  tile_id = @tilesetting[p1, p2, i]
  if tile_id == nil
	return false
  elsif @passages[tile_id] & 0x0f == 0x0f
	return false
  elsif @priorities[tile_id] == 0
	return true
  end
end
return true
 end
 #--------------------------------------------------------------------------
 # œ Žw’èˆÊ’u‚É—§‚Ä‚é‚©H
 #	 p1,p2 ˆÊ’uX,Y
 #--------------------------------------------------------------------------
 def standable?(p1,p2)
if @heightdata[p1,p2] != 0
  return false
end
if @oneventdata[p1,p2] ==1
  return false
end
for i in [2, 1, 0]
  tile_id = @map.data[p1, p2, i]
  if tile_id == nil
	return false
  elsif @passages[tile_id] & 0x0f == 0x0f
	return false
  elsif @priorities[tile_id] == 0
	return true
  end
end
return true
 end
 #--------------------------------------------------------------------------
 # œ Žw’èˆÊ’u‚É’u‚¢‚Ä‚à‘åä•v‚©HiŽüˆÍ‚̃Cƒxƒ“ƒg‚È‚Çl—¶”Åj
 #	 p1,p2 ˆÊ’uX,Y
 #--------------------------------------------------------------------------
 def standable2?(p1,p2)
# ‚»‚̈ʒu”»’è
unless standable?(p1,p2)
  return false
end
# ŽüˆÍ‚̃Cƒxƒ“ƒgƒ`ƒFƒbƒN(s‚«Ž~‚Ü‚è‚É‚È‚ç‚È‚¢‚©H)
# c‚Ö”²‚¯‚ê‚é‚©
if standable?(p1+1,p2-1) == false or
  standable?(p1+1,p2) == false or
  standable?(p1+1,p2+1) == false
  if standable?(p1-1,p2-1) == false or
	standable?(p1-1,p2) == false or
	standable?(p1-1,p2+1) == false
	# ‚à‚Æ‚à‚Æc‚Ö”²‚¯‚ê‚È‚¢Žž‚Í–³Ž‹
	if standable?(p1,p2-1) == true and
	  standable?(p1,p2+1) == true
	  return false
	end
  end
end
# ‰¡‚Ö”²‚¯‚ê‚é‚©
if standable?(p1+1,p2+1) == false or
  standable?(p1,p2+1) == false or
  standable?(p1-1,p2+1) == false
  if standable?(p1+1,p2-1) == false or
	standable?(p1,p2-1) == false or
	standable?(p1-1,p2-1) == false
	# ‚à‚Æ‚à‚Ɖ¡‚Ö”²‚¯‚ê‚È‚¢Žž‚Í–³Ž‹
	if standable?(p1-1,p2) == true and
	  standable?(p1+1,p2) == true
	  return false
	end
  end
end
if standable?(p1,p2-1) == false and
  (standable?(p1-1,p2+1) == false or 
  standable?(p1,p2+1) == false or
  standable?(p1+1,p2+1) == false)
  return false
end
if standable?(p1,p2+1) == false and
  (standable?(p1-1,p2-1) == false or 
  standable?(p1+1,p2-1) == false or
  standable?(p1+1,p2-1) == false)
  return false
end
if standable?(p1-1,p2) == false and
  (standable?(p1+1,p2-1) == false or 
  standable?(p1+1,p2) == false or
  standable?(p1+1,p2+1) == false)
  return false
end
if standable?(p1+1,p2) == false and
  (standable?(p1-1,p2-1) == false or 
  standable?(p1-1,p2) == false or
  standable?(p1-1,p2+1) == false)
  return false
end

return true
 end
 #--------------------------------------------------------------------------
 # œ Žw’èˆÊ’u‚É’u‚¢‚Ä‚à‘åä•v‚©Hi•Ç”Åj
 #	 p1,p2 ˆÊ’uX,Y
 #	 p3	•
 #--------------------------------------------------------------------------
 def standable3?(p1,p2,p3)
# ‰º‚ª‚à‚Æ‚à‚Æ—§‚Ä‚È‚¢‚È‚ç•s‰Â
unless standable?(p1,p2+1)
  return false
end
# ‚»‚̈ʒu”»’è
if @oneventdata[p1,p2] == 1 or
  @oneventdata[p1,p2-1] == 1 or
  @heightdata[p1,p2-2] != 1 or
  @heightdata[p1,p2-1] == 1 or
  @heightdata[p1,p2+1] != 0
  return false
end
for i in 1...p3+1
  if@heightdata[p1+i,p2-2] != 1 or
	@heightdata[p1+i,p2-1] == 1 or
	@heightdata[p1+i,p2+1] != 0
	return false
  end
  if@heightdata[p1-i,p2-2] != 1 or
	@heightdata[p1-i,p2-1] == 1 or
	@heightdata[p1-i,p2+1] != 0
	return false
  end
end
for i in 1...p3+1
  if @oneventdata[p1+i,p2] == 1 or
	@oneventdata[p1+i,p2-1] == 1
	return false
  end
  if @oneventdata[p1-i,p2] == 1 or
	@oneventdata[p1-i,p2-1] == 1
	return false
  end
end
return true
 end
 #--------------------------------------------------------------------------
 # œ ƒ}ƒbƒvƒ^ƒCƒ‹î•ñ•ÏX
 #	 p1,p2 ‘‚«o‚µæˆÊ’uX,Y
 #	 p3,p4 Œ³ŽQƈʒuX,Y
 #	 p5  ‘}“ü•û–@ 0:’Êí 1:‰ºƒŒƒCƒ„ 2:ヌƒCƒ„ 3:‰º‚©‚ç 4:ã‚©‚ç 5:—¼•û
 #--------------------------------------------------------------------------
 def set_mapdata(p1,p2,p3,p4,p5 = 0)
unless self.valid?(p1, p2)
  return
end
if @tilesetting[p3,p4,0] != 0 # ƒŒƒCƒ„[‚O‚Í•’Ê‚É’u‚­
  @map.data[p1,p2,0] = @tilesetting[p3,p4,0]
end
case p5
when 0 # ’Êí
  if @tilesetting[p3,p4,1] != 0
	@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
  end
  if @tilesetting[p3,p4,2] != 0
	@map.data[p1,p2,2] = @tilesetting[p3,p4,2]
  end
when 1 # ‰º‚É’u‚­
  if @tilesetting[p3,p4,1] != 0
	@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
  end
when 2 # ã‚É’u‚­
  if @tilesetting[p3,p4,1] != 0
	@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
  end
when 3 # ‰º‚©‚ç’u‚­
  if @tilesetting[p3,p4,1] != 0
	if @map.data[p1,p2,1] != 0
	  @map.data[p1,p2,2] = @map.data[p1,p2,1]
	end
	@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
  end
when 4 # ã‚©‚ç’u‚­
  if @tilesetting[p3,p4,1] != 0
	if @map.data[p1,p2,2] != 0
	  @map.data[p1,p2,1] = @map.data[p1,p2,2]
	end
	@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
  end
when 5 # —¼•û‚É’u‚­
  if @tilesetting[p3,p4,1] != 0
	@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
  end
  if @tilesetting[p3,p4,1] != 0
	@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
  end
when 6 # ’u‚¯‚é‚È‚ç’u‚­
  if @map.data[p1,p2,1] == 0
	@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
  elsif @map.data[p1,p2,2] == 0
	@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
  end
end
 end
 #--------------------------------------------------------------------------
 # œ ƒ}ƒbƒvƒ^ƒCƒ‹î•ñ•ÏX2 >>”͈͊O”»’è‚È‚Ç–³‚µver
 #	 p1,p2 ‘‚«o‚µæˆÊ’uX,Y
 #	 p3,p4 Œ³ŽQƈʒuX,Y
 #--------------------------------------------------------------------------
 def set_mapdata2(p1,p2,p3,p4)
@map.data[p1,p2,0] = @tilesetting[p3,p4,0]
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
@map.data[p1,p2,2] = @tilesetting[p3,p4,2]
 end
 #--------------------------------------------------------------------------
 # œ Žw’èˆÊ’u‚Ìî•ñ•ÏX
 #	 p1,p2 ˆÊ’uX,Y
 #	 p3	’l
 #--------------------------------------------------------------------------
 def set_height(p1,p2,p3)
return if p1<0
return if p1>=@map.width
return if p2<0
return if p2>=@map.height
@heightdata[p1,p2]=p3
 end
 #--------------------------------------------------------------------------
 # œ Žw’èˆÊ’u‚Ìî•ñ•ÏX
 #	 p1,p2 ˆÊ’uX,Y
 #	 p3	’l
 #--------------------------------------------------------------------------
 def set_grounddata(p1,p2,p3)
return if p1<0
return if p1>=@map.width
return if p2<0
return if p2>=@map.height
if @masksetting[@maskdata[p1,p2]] == true
  if @targettype==0
	if @chgtype==0
	  @heightdata[p1,p2]=p3
	elsif @chgtype==1
	  @heightdata[p1,p2]+=p3
	end
  elsif @targettype==1
	if @chgtype==0
	  @maskdata[p1,p2]=p3
	elsif @chgtype==1
	  @maskdata[p1,p2]+=p3
	end
  end
end
 end

 #--------------------------------------------------------------------------
 # œ ‰‰ŽZ•û–@Žw’è
 #	 p1 ‘ÎÛ@>> =0:‚‚³@=1:’nŒ`  (Œ»ÝA‚‚³0=’n–Ê 1=•Ç
 #	 p2 •û–@@>> =0:‘ã“ü@=1:‰ÁŽZ	  ’nŒ`‚̓}ƒXƒN”»’è‚É‚Ì‚ÝŽg—p
 #--------------------------------------------------------------------------
 def rndmap_chtarget(p1,p2)
@targettype=p1
@chgtype=p2
 end
 #--------------------------------------------------------------------------
 # œ ‚Ù‚©‚̃Rƒ}ƒ“ƒh‚ÅŽg—p‚·‚é’l‚ðƒZƒbƒg
 #	 p1,p2 Ŭ X,Y
 #	 p3,p4 Å‘å X,Y  “¹»ì‚ÌŠJŽn“_AI—¹“_ƒZƒbƒg‚È‚Ç‚ÉŽg—p
 #--------------------------------------------------------------------------
 def rndmap_setstat(p1,p2,p3,p4)
@minx=p1
@miny=p2
@maxx=p3
@maxy=p4
 end
 #--------------------------------------------------------------------------
 # œ ’nŒ`ƒ}ƒXƒN‚ðÝ’è
 #	 p1 = ‘ÎÛ’nŒ`  (-1= ‚·‚ׂÄ)
 #	 p2 = •ÏX’l	(0= ‘‚«Š·‚¦‹ÖŽ~  1= ‘‚«Š·‚¦‹–‰Â  2= ‚»‚Ì’nŒ`‚Ì‚Ý‹–‰Â)
 #--------------------------------------------------------------------------
 def rndmap_chmask(p1,p2)
if p1>=0
  if p2==0
	@masksetting[p1]=false
  elsif p2 == 1
	@masksetting[p1]=true
  elsif p2 == 2
	for i in 0...100
	  @masksetting[i]=false
	end
	@masksetting[p1]=true
  end
end
if p1==-1
  if p2==0
	for i in 0...100
	  @masksetting[i]=false
	end
  else   
	for i in 0...100
	  @masksetting[i]=true
	end
  end
end
 end
 #--------------------------------------------------------------------------
 # œ ‚Q“_‚ðŒq‚®“¹ì¬
 #	 Žn“_AI“_‚Írndmap_setstat‚ÅÝ’è
 #	 p1 = ‘‚«•Ï‚¦‚é’l
 #	 p2 = “r’†“_”(ƒ}ƒCƒiƒX‚È‚çƒ}ƒbƒvƒTƒCƒY40*40‚ðŠî€‚É‘Š‘Εω»)
 #	 p3 = •£‚ÉŠm•Û‚·‚é•
 #	 p4 = “r’†“_‚ÌŒ‹‚Ñ•û (0=’¼ü‚ÅŒ‹‚Ô  1=’¼Špƒ‰ƒCƒ“(?)‚ÅŒ‹‚Ô)
 #	 p5 = –³Ž‹‚·‚é’†Œp“_‚Ì‹——£
 #--------------------------------------------------------------------------
 def rndmap_mkroad(p1,p2,p3,p4,p5 = 5)
p5 = 5 if p5 == nil

localdata = Table.new(@map.width,@map.height)
aposx = []
aposy = []
aflag = []
for i in 0...@map.width
  for j in 0...@map.height
	localdata[i,j] = 0
  end
end

if p2<0
  p2=(p2*-1)*@map.width*@map.height/40/40
end
aposx[0]=@minx
aposy[0]=@miny
aposx[1]=@maxx
aposy[1]=@maxy

if aposx[0]<0
  aposx[0]=@map.width+aposx[0]
end
if (aposx[0]>=1000) and (aposx[0]<=1100)
  aposx[0]=@map.width*(aposx[0]-1000)/100
end

if aposy[0]<0
  aposy[0]=@map.height+aposy[0]
end
if (aposy[0]>=1000) and (aposy[0]<=1100)
  aposy[0]=@map.height*(aposy[0]-1000)/100
end


if aposx[1]<0
  aposx[1]=@map.width+aposx[1]
end
if (aposx[1]>=1000) and (aposx[1]<=1100)
  aposx[1]=@map.width*(aposx[1]-1000)/100
end


if aposy[1]<0
  aposy[1]=@map.height+aposy[1]
end
if (aposy[1]>=1000) and (aposy[1]<=1100)
  aposy[1]=@map.height*(aposy[1]-1000)/100
end

if p4==0 or p4==1 or p4==2
  if p4 == 2
	i4 = rand(2)
  end
  aflag[0] = true
  aflag[1] = false
  for i in 2...(p2+2)
	aposx[i] = rand(@map.width-p3*2) + p3
	aposy[i] = rand(@map.height-p3*2) + p3
	aflag[i] = false
  end
  i3=0
  i1=aposx[i3]
  i2=aposy[i3]

  localdata[i1,i2] = 1

  for i in 0...p2+2

	i7=5000000
	for j in 0...p2+2
	  if aflag[j] == false
		i4 = aposx[j]-i1
		i4=i4*-1 if i4 < 0
		i5 = aposy[j]-i2
		i5=i5*-1 if i5 < 0
		if (i4**2+i5**2) <=(p5**2) and j != 1
		  aflag[j] = true
		elsif i7 > (i4**2+i5**2)
		  i7=(i4**2+i5**2)
		  i6=j
		end
	  end
	end
	#  Žn“_ID:i3   I“_ID:i6
	if p4==0
	  if aposx[i3] > aposx[i6]
		i8 = aposx[i3]
		i9 = aposy[i3]
		i10 = aposx[i6]
		i11 = aposy[i6]
	  else
		i8 = aposx[i6]
		i9 = aposy[i6]
		i10 = aposx[i3]
		i11 = aposy[i3]
	  end
	  if i8!=i10
		for i in 0..(i8-i10)
		  localdata[i+i10,(i9-i11)*i/(i8-i10)+i11] = 1
		end
	  end
	  if aposy[i3] > aposy[i6]
		i8 = aposx[i3]
		i9 = aposy[i3]
		i10 = aposx[i6]
		i11 = aposy[i6]
	  else
		i8 = aposx[i6]
		i9 = aposy[i6]
		i10 = aposx[i3]
		i11 = aposy[i3]
	  end
	  if i9!=i11
		for i in 0..(i9-i11)
		  localdata[(i8-i10)*i/(i9-i11)+i10,i+i11] = 1
		end
	  end
	end
	if p4==1
	  i4 = rand(2)
	  if i4==0
		for i in 0..([aposx[i3]-aposx[i6],aposx[i6]-aposx[i3]].max)
		  localdata[i+[aposx[i3],aposx[i6]].min,aposy[i3]] = 1
		end
		for i in 0..([aposy[i3]-aposy[i6],aposy[i6]-aposy[i3]].max)
		  localdata[aposx[i6],i+[aposy[i3],aposy[i6]].min] = 1
		end
	  else
		for i in 0..([aposx[i3]-aposx[i6],aposx[i6]-aposx[i3]].max)
		  localdata[i+[aposx[i3],aposx[i6]].min,aposy[i6]] = 1
		end
		for i in 0..([aposy[i3]-aposy[i6],aposy[i6]-aposy[i3]].max)
		  localdata[aposx[i3],i+[aposy[i3],aposy[i6]].min] = 1
		end
	  end
	end
	i3=i6
	i1=aposx[i3]
	i2=aposy[i3]
	aflag[i3]=true
	if i3==1
	  break
	end
  end
end
for i in 0...@map.width
  for j in 0...@map.height
	if localdata[i,j] == 1
	  set_grounddata(i,j,p1)
	end
  end
end
 end

 #--------------------------------------------------------------------------
 # œ ‘ÎÛ‚ðŠg’£
 #	 p1	   ‘ÎÛ
 #	 p2,p3	Šg’£‚·‚é•X,Y
 #	 p4	   Šg’£•û–@ (0=\\\\Žš  1=ŽlŠp)
 #--------------------------------------------------------------------------
 def rndmap_plus(p1,p2,p3,p4)
localdata = Table.new(@map.width,@map.height)
for i in 0...@map.width
  for j in 0...@map.height
	if @targettype==0
	  localdata[i,j] = @heightdata[i,j]
	elsif @targettype==1
	  localdata[i,j] = @maskdata[i,j]
	end
  end
end
if p4 == 0
  for i in 0...@map.width
	for j in 0...@map.height
	  if p1==localdata[i,j]
		for k in 1..p2
		  set_grounddata(i+k,j,p1)
		  set_grounddata(i-k,j,p1)
		end
		for k in 1..p3
		  set_grounddata(i,j+k,p1)
		  set_grounddata(i,j-k,p1)
		end
	  end
	end
  end
elsif p4 == 1
  for i in 0...@map.width
	for j in 0...@map.height
	  if p1==localdata[i,j]
		for k in (i-p2)..(i+p2)
		  for l in (j-p3)..(j+p3)
			set_grounddata(k,l,p1)
		  end
		end
	  end
	end
  end
end
 end
 #--------------------------------------------------------------------------
 # œ ‚·‚ׂĂÉÝ’è
 #	 p1	   ’l
 #--------------------------------------------------------------------------
 def rndmap_allchg(p1)
for i in 0...@map.width
  for j in 0...@map.height
	set_grounddata(i,j,p1)
  end
end
 end
 #--------------------------------------------------------------------------
 # œ Žw’è“_
 #	 p1	   ’l
 #	 p2,p3	ˆÊ’uX,Y
 #--------------------------------------------------------------------------
 def rndmap_putpos(p1,p2,p3)
i = rand(@maxx-@minx+1)+@minx
j = rand(@maxy-@miny+1)+@miny
for k in (p2-i)..(p2+i)
  for l in (p3-j)..(p3+j)
	set_grounddata(k,l,p1)
  end
end
 end
 #--------------------------------------------------------------------------
 # œ ŽüˆÍ
 #	 p1	   ’l
 #--------------------------------------------------------------------------
 def rndmap_edge(p1)
for i in 0...@map.width
  set_grounddata(i,0,p1)
  set_grounddata(i,@map.height-1,p1)
end
for i in 0...@map.height
  set_grounddata(0,i,p1)
  set_grounddata(@map.width-1,i,p1)
end
 end
end


#==============================================================================
#   RPG::MapInfo >>ƒTƒuƒl[ƒ€..\\\",\\\"ˆÈ~‚Ì•¶Žš‚Ì‚±‚Æ‚ð subname ‚Ɏ擾
#==============================================================================
module RPG
 class MapInfo
def name
  name = @name.split(/,/)[0]
  return name != nil ? name : \\\'\\\'
end
def name=(str)
  str2 = @name[/^[^,]*(C.*)/, 1]
  @name = str2 != nil ? str + str2 : str
end
def subname(i = 1)
  name = @name.split(/,/)[i]
  return name != nil ? name : \\\"\\\"
end
 end
end

#==============================================================================
#   RPG::Event >>ƒTƒuƒl[ƒ€..\\\",\\\"ˆÈ~‚Ì•¶Žš‚Ì‚±‚Æ‚ð subname ‚Ɏ擾
#==============================================================================
module RPG
 class Event
def name
  name = @name.split(/,/)[0]
  return name != nil ? name : \\\'\\\'
end
def name=(str)
  str2 = @name[/^[^,]*(C.*)/, 1]
  @name = str2 != nil ? str + str2 : str
end
def subname(i = 1)
  name = @name.split(/,/)[i]
  return name != nil ? name : \\\"\\\"
end
 end
end

 

Share this post


Link to post
Share on other sites
  • 0

The language is Japanese, but I do not think that they script author has saved this in Unicode as the Kana and Kanji have been messed up.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...