#============================================================================== # Ãà¼Ò ¸ÊÀÇ Ç¥½Ã(ver 0.999) # by Çdzî clum-sea #============================================================================== #============================================================================== # ij½ºÅÍ ¸¶ÀÌÁîÆ÷ÀÎÆ® #============================================================================== module PLAN_Map_Window WIN_X = 8 # À©µµ¿ìÀÇ X ÁÂÇ¥ WIN_Y = 8 # À©µµ¿ìÀÇ Y ÁÂÇ¥ WIN_WIDTH = 5*32 # À©µµ¿ìÀÇ Æø WIN_HEIGHT = 4*32 # À©µµ¿ìÀÇ ³ôÀÌ ZOOM = 4.0 # ÇÁÀÇ Ãà¼ÒÀ²(32 * 32 ÀÇ Å¸ÀÏÀ» ¸îºÐÀÇ 1À¸·Î ÇÒ±î) WINDOWSKIN = "" # ½ºÅ²(Çϴÿ¡¼­ µðÆúÆ®) ON_OFF_KEY = Input::C # À©µµ¿ìÀÇ ¿Â ¿ÀÇÁ¸¦ ¹Ù²Ù´Â ¹öÆ° SWITCH = 40 # ¸Ê À©µµ¿ì Ç¥½Ã ±ÝÁö¿ëÀÇ ½ºÀ­Ä¡ ¹øÈ£ # (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 = true 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 = true # Ç¥½ÃµÇ¾î ÀÖÁö ¾ÊÀº °æ¿ì, Ç¥½ÃÇÑ´Ù else @map_window.visible = true end end # ±ÝÁöÀÇ °æ¿ì´Â °­Á¦ÀûÀ¸·Î ºñÇ¥½Ã else if @map_window.visible @map_window.visible = true 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 = true # µÇµ¹¸°´Ù 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 # ??C????b?v?????? @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 # ???????v???C??????u???m?? @old_real_x = $game_player.real_x @old_real_y = $game_player.real_y # ??b?v???S????????? @all_map = make_all_map # ????E??????????? self.visible = PLAN_Map_Window::VISIBLE # ??? refresh end #-------------------------------------------------------------------------- # ?? ??b?v???S??????????i?k???????t???j #-------------------------------------------------------------------------- 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 # ?I??g??C???????? if tile_num < 384 # ????C???????????????? 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 # ½ºÅ©·Ñ ½ºÅé ó¸®(¿·) # ij¸¯ÅÍÀÇ À§Ä¡(contents ÀÇ Áß¾Ó) half_width = self.contents.width * 128 / 2 # ij¸¯ÅÍÀÇ À§Ä¡(½ÇÀ§Ä¡)~¸ÊÀÇ ±¸¼®±îÁöÀÇ ³ª¸ÓÁöÆø 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 # ??????b?v????????????? 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 # ½ºÅ©·Ñ ½ºÅé ó¸®(¼¼·Î) # ij¸¯ÅÍÀÇ Á¤µµ Ä¡(contents ÀÇ Áß¾Ó) half_height = self.contents.height * 128 / 2 # ij¸¯ÅÍÀÇ À§Ä¡(½ÇÀ§Ä¡)~¸ÊÀÇ ±¸¼®±îÁöÀÇ ³ª¸ÓÁö ³ôÀÌ 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 # ?E????b?v????????????? 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 # priority üũ ¼û´Â´Ù¸é ¾×ÅͺñÇ¥½Ã 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