<META content="Namo WebEditor v6.0" name=generator> 게임 화면에 축소된 맵을 표시하는 스크립트입니다. 사용법 :스윗치1 차례로 표시·비표시를 바꿀 수 있습니다(스윗치 번호는 변경 가능합니다). 플레이어는 A버튼으로 표시·비표시를 바꿀 수 있습니다(버튼은 변경 가능합니다). #============================================================================== # 걾 뢫룷?긞긵궻?렑(ver 0.999) # by 긯긦깈깛 clum-sea #============================================================================== #============================================================================== # 걽 긇긚??귽긛?귽깛긣 #============================================================================== module PLAN_Map_Window WIN_X = 8 # 긂귻깛긤긂궻 X 띆뷭 WIN_Y = 8 # 긂귻깛긤긂궻 Y 띆뷭 WIN_WIDTH = 8*32 # 긂귻깛긤긂궻븴 WIN_HEIGHT = 6*32 # 긂귻깛긤긂궻뛼궠 ZOOM = 4.0 # ?긞긵궻뢫룷뿦걁32 * 32 궻?귽깑귩돺빁궻덇궸궥귡궔걂 WINDOWSKIN = "" # 긚긌깛(뗴궳긢긲긅깑긣) ON_OFF_KEY = Input::A # 긂귻깛긤긂궻긆깛긆긲귩먛귟뫶궑귡??깛 SWITCH = 1 # ?긞긵긂귻깛긤긂?렑뗕?뾭궻긚귽긞?붥뜂 # (ON궳?렑뗕?, OFF궳?렑됀?) WINDOW_MOVE = true # 긂귻깛긤긂궴긵깒귽깂?궕뢣궶궯궫렄렔벍밒궸댷벍궥귡궔 # (true:궥귡, false:궢궶궋) OVER_X = 632 - WIN_WIDTH # 댷벍뚣궻 X 띆뷭(룊딖댧뭫궴돑븳궢귏궥) OVER_Y = 8 # 댷벍뚣궻 Y 띆뷭(룊딖댧뭫궴돑븳궢귏궥) OPACITY = 126 # ?긞긵궻벁뼻뱗 C_OPACITY = 192 # 긂귻깛긤긂궻벁뼻뱗 VISIBLE = true # 띍룊갂?렑궥귡궔궢궶궋궔(true:궥귡, false:궢궶궋) end #============================================================================== # 걾 Game_Temp #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # 걶 뚺둎귽깛긚?깛긚빾릶 #-------------------------------------------------------------------------- attr_accessor :map_visible # ?긞긵긂귻깛긤긂궻?렑륉뫴 #-------------------------------------------------------------------------- # 걶 긆긳긙긃긏긣룊딖돸 #-------------------------------------------------------------------------- alias plan_map_window_initialize initialize def initialize # 뽣궥 plan_map_window_initialize @map_visible = false end end #============================================================================== # 걾 Scene_Map #============================================================================== class Scene_Map #-------------------------------------------------------------------------- # 걶 긽귽깛룉뿚 #-------------------------------------------------------------------------- alias plan_map_window_main main def main # 긂귻깛긤긂귩띿맟 @map_window = Window_Map.new @map_window.visible = $game_temp.map_visible # 뽣궥 plan_map_window_main # 긽긞긜?긙긂귻깛긤긂귩됶뺳 @map_window.dispose end #-------------------------------------------------------------------------- # 걶 긲깒??뛛륷 #-------------------------------------------------------------------------- alias plan_map_window_update update def update # visible 귩딯돬 $game_temp.map_visible = @map_window.visible # 뽣궥 plan_map_window_update # 뗕?궳궶궚귢궽갂먛귟뫶궑룉뿚 unless $game_switches[PLAN_Map_Window::SWITCH] # 긆깛긆긲먛귟뫶궑??깛궕돓궠귢궫뤾뜃 if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY) # ?렑궠귢궲궋귡뤾뜃갂뷄?렑궸궥귡 if @map_window.visible @map_window.visible = false # ?렑궠귢궲궋궶궋뤾뜃갂?렑궥귡 else @map_window.visible = true end end # 뗕?궻뤾뜃궼떗맕밒궸뷄?렑 else if @map_window.visible @map_window.visible = false end end # ?렑궠귢궲궋귡렄궻귒뛛륷 if @map_window.visible @map_window.update end end #-------------------------------------------------------------------------- # 걶 긵깒귽깂?궻뤾룋댷벍 #-------------------------------------------------------------------------- alias plan_map_window_transfer_player transfer_player def transfer_player # visible 귩딯돬 visible = @map_window.visible @map_window.visible = false # 뽣궥 plan_map_window_transfer_player # ?긞긵긂귻깛긤긂귩됶뺳 @map_window.dispose # ?긞긵긂귻깛긤긂귩띿맟 @map_window = Window_Map.new # ?렑먠믦귩멣?긞긵궻륉뫴궸뽣궥 @map_window.visible = visible end end #============================================================================== # 걾 Window_Map #============================================================================== class Window_Map < Window_Base #-------------------------------------------------------------------------- # 걶 긆긳긙긃긏긣룊딖돸 #-------------------------------------------------------------------------- def initialize x = PLAN_Map_Window::WIN_X y = PLAN_Map_Window::WIN_Y w = PLAN_Map_Window::WIN_WIDTH h = PLAN_Map_Window::WIN_HEIGHT super(x, y, w, h) unless PLAN_Map_Window::WINDOWSKIN.empty? self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN) end self.contents = Bitmap.new(width - 32, height - 32) self.opacity = PLAN_Map_Window::OPACITY self.contents_opacity = PLAN_Map_Window::C_OPACITY @map_data = $game_map.data # ?귽깑?긞긵귩띿맟 @tileset = RPG::Cache.tileset($game_map.tileset_name) @autotiles = [] for i in 0..6 autotile_name = $game_map.autotile_names[i] @autotiles[i] = RPG::Cache.autotile(autotile_name) end # 뙸띪궻긵깒귽깂?댧뭫귩둴뺎 @old_real_x = $game_player.real_x @old_real_y = $game_player.real_y # ?긞긵궻멣뫬?궻띿맟 @all_map = make_all_map # ?렑갋뷄?렑귩먠믦 self.visible = PLAN_Map_Window::VISIBLE # ?됪 refresh end #-------------------------------------------------------------------------- # 걶 ?긞긵궻멣뫬?궻띿맟걁뢫룷빾듂븊궖걂 #-------------------------------------------------------------------------- def make_all_map all_map = Bitmap.new($game_map.width * 32, $game_map.height * 32) for y in 0...$game_map.height for x in 0...$game_map.width for z in 0...3 tile_num = @map_data[x, y, z] next if tile_num == nil # 긆?긣?귽깑궻뤾뜃 if tile_num < 384 # 뗴?귽깑궻뤾뜃궼궴궽궥 if tile_num >= 48 tile_num -= 48 src_rect = Rect.new(32, 2 * 32, 32, 32) all_map.blt(x * 32, y * 32, @autotiles[tile_num / 48], src_rect) end # ?귽깑?긞긵궻뤾뜃 else tile_num -= 384 src_rect = Rect.new(tile_num % 8 * 32, tile_num / 8 * 32, 32, 32) all_map.blt(x * 32, y * 32, @tileset, src_rect) end end end end # 멣뫬?긞긵궔귞뢫룷?긞긵귉 w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32 h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32 ret_bitmap = Bitmap.new(w, h) src_rect = Rect.new(0, 0, all_map.width, all_map.height) dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height) ret_bitmap.stretch_blt(dest_rect, all_map, src_rect) all_map.dispose return ret_bitmap end #-------------------------------------------------------------------------- # 걶 깏긲깒긞긘깄 #-------------------------------------------------------------------------- def refresh self.contents.clear # 뢫룷?긞긵?렑 one_tile_size = 32 / PLAN_Map_Window::ZOOM x = $game_player.real_x - 128 * (self.contents.width / one_tile_size) / 2 y = $game_player.real_y - 128 * (self.contents.height / one_tile_size) / 2 x = x * one_tile_size / 128 y = y * one_tile_size / 128 # 긚긏깓?깑긚긣긞긵룉뿚걁돘걂 # 긌긿깋궻댧뭫걁contents 궻뭷돍걂 half_width = self.contents.width * 128 / 2 # 긌긿깋궻댧뭫걁렳댧뭫걂??긞긵궻?귏궳궻럄귟븴 rest_width = ($game_map.width * 128 - $game_player.real_x) * one_tile_size # 긂귻깛긤긂귝귟?긞긵궻븴궻뺴궕룷궠궋궶귞 rev_x = 0 # ?긞긵궕긂귻깛긤긂귝귟룷궠궋뤾뜃궼뭷돍?렑 if @all_map.width < self.contents.width rev_x = (half_width - $game_player.real_x * one_tile_size) / 128 rev_x -= (self.contents.width - @all_map.width) / 2 x += rev_x # 뜺궕?긞긵궻?귩뮪궑궫귞 elsif half_width > $game_player.real_x * one_tile_size rev_x = (half_width - $game_player.real_x * one_tile_size) / 128 x += rev_x # 덭궕?긞긵궻?귩뮪궑궫귞 elsif half_width > rest_width rev_x = -((half_width - rest_width) / 128) x += rev_x end # 긚긏깓?깑긚긣긞긵룉뿚걁뢢걂 # 긌긿깋궻댧뭫걁contents 궻뭷돍걂 half_height = self.contents.height * 128 / 2 # 긌긿깋궻댧뭫걁렳댧뭫걂??긞긵궻?귏궳궻럄귟뛼궠 rest_height = ($game_map.height * 128 - $game_player.real_y) * one_tile_size # 긂귻깛긤긂귝귟?긞긵궻븴궻뺴궕룷궠궋궶귞 rev_y = 0 # ?긞긵궕긂귻깛긤긂귝귟룷궠궋뤾뜃궼뭷돍?렑 if @all_map.height < self.contents.height rev_y = (half_height - $game_player.real_y * one_tile_size) / 128 rev_y -= (self.contents.height - @all_map.height) / 2 y += rev_y # 뜺궕?긞긵궻?귩뮪궑궫귞 elsif half_height > $game_player.real_y * one_tile_size rev_y = (half_height - $game_player.real_y * one_tile_size) / 128 y += rev_y # 덭궕?긞긵궻?귩뮪궑궫귞 elsif half_height > rest_height rev_y = -((half_height - rest_height) / 128) y += rev_y end src_rect = Rect.new(x, y, self.contents.width, self.contents.height) self.contents.blt(0, 0, @all_map, src_rect) # 긂귻깛긤긂궻댷벍룉뿚 if PLAN_Map_Window::WINDOW_MOVE == true # 긂귻깛긤긂궻붝댪귩롦벦(붝댪긆긳긙긃긏긣) w = self.x..self.x + self.width h = self.y..self.y + self.height # 긵깒귽깂?궕긂귻깛긤긂궻붝댪볙궸볺궯궫뤾뜃 if w === $game_player.screen_x and h === $game_player.screen_y # 댷벍뤾룋뵽믦 # 룊딖댧뭫궶귞궽 if self.x == PLAN_Map_Window::WIN_X and self.y == PLAN_Map_Window::WIN_Y # 댷벍뚣궻띆뷭궸댷벍 self.x = PLAN_Map_Window::OVER_X self.y = PLAN_Map_Window::OVER_Y # 룊딖댧뭫궳궶궋뤾뜃 else # 룊딖댧뭫궸댷벍 self.x = PLAN_Map_Window::WIN_X self.y = PLAN_Map_Window::WIN_Y end end end # 귺긏??궕궋귡뤾뜃궼띍룊궻귺긏??귩?긞긵궸?렑 if $game_party.actors.size > 0 # 긵깋귽긆깏긡귻?긃긞긏덨귢귡궶귞귺긏??뷄?렑 for i in [2, 1, 0] tile = @map_data[$game_player.x, $game_player.y, i] next if tile == 0 return if $game_map.priorities[tile] > 0 end actor = $game_party.actors[0] bitmap = RPG::Cache.character(actor.character_name, actor.character_hue) width = bitmap.width / 4 height = bitmap.height / 4 src_rect = Rect.new(0, 0, width, height) # 귺긏??귩뭷돍귉?렑 w = width / PLAN_Map_Window::ZOOM h = height / PLAN_Map_Window::ZOOM # ?귽깑궻븴궬궚뗵릶궶궻궳뵾?귽깑빁궦귞궥 x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x y = self.contents.height / 2 - h / 2 - rev_y dest_rect = Rect.new(x, y, w, h) self.contents.stretch_blt(dest_rect, bitmap, src_rect) end end #-------------------------------------------------------------------------- # 걶 긲깒??뛛륷 #-------------------------------------------------------------------------- def update super if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y @old_real_x = $game_player.real_x @old_real_y = $game_player.real_y refresh end end #-------------------------------------------------------------------------- # 걶 됶뺳 #-------------------------------------------------------------------------- def dispose super @all_map.dispose end end