#----------------------------------------------------------------------------
# ミニマップ - KGC_MiniMap 貪藻矢射妥←カスタム By 貪藻矢射妥←
# 微妙に使いづらいです・・・多分(をひ)
#----------------------------------------------------------------------------
# 原作: ◆ ミニマップ - KGC_MiniMap ◆
# ◇ Last update : 2007/08/19 ◇
# 原作者: TOMY様
# HP: Kamesoft
# アドレス: http://ytomy.sakura.ne.jp/
#
# 改造内容:
# ・イベントの名前ではなく、コマンド:注釈 を使用する方式への変更
# ・アナライズ装備による隠しの描画/秘匿
#
#============================================================================
# 変更点
# 2011:07:01
# ・特殊イベントを追加
# ・マップ移動イベントの色もオブジェクトの色に移動
#
# 2012:08:11
# ・色を配列からハッシュへ変更
#
# 2024:05:01
# ・固定文字列対応
#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================
module DIA_MM
# アナライズフラグ
#ANA_FLG = 100
# アナライズアクセサリID
#ANA_ACC = 352
# 壁イベント用ワード
WALL = "壁"
# 移動イベント用ワード
MOVE = "移動"
# ボスイベント用ワード
BOSS = "ボス"
# 隠しアイテム用ワード
H_TR = "隠しアイテム"
# 通常アイテム用ワード
TRSR = "宝"
# 隠し通路用ワード
H_MV = "隠し通路"
# 特殊イベント用ワード
EVET = "イベント"
# ミニマップを表示させないマップリスト
NOMAP_LIST = [
"オープニング", "ワールドマップ", "歴史の墓場",
]
#--------------------------------------------------------------------------
# ● イベントパラメーター判別処理
#
# イベントが注釈か前のイベントの続きである場合に、そのイベントのパラメーター
# に指定文字が含まれているかを判定する。
#
# event : イベント
# param : パラメーター
#--------------------------------------------------------------------------
def eve_prm_include(event, param)
# キャラクターがイベントの場合
if event.is_a?(Game_Event)
# 有効なイベントの場合
if event.list != nil
for i in 0...event.list.size
# イベントの内容が注釈の場合
if event.list[i].code == 108 || (event.list[i].code == 408 && (
(i - 1 >= 0 && event.list[i - 1].code == 108) ||
(i - 2 >= 0 && event.list[i - 2].code == 108) ||
(i - 3 >= 0 && event.list[i - 3].code == 108) ||
(i - 4 >= 0 && event.list[i - 4].code == 108) ||
(i - 5 >= 0 && event.list[i - 5].code == 108)))
# 注釈の内容が param だった場合
if event.list[i].parameters.include?(param)
return true
end
end
end
end
end
return false
end
end
module KGC
module MiniMap
include DIA_MM
# ◆ミニマップ表示位置・サイズ (X, Y, 幅, 高さ)
MAP_RECT = Rect.new(10, 10, 100, 75)
# ◆ミニマップの Z 座標
# 大きくしすぎると、色々なものに被ります。
MAP_Z = 0
# ◆1マスのサイズ
# 3 以上を推奨。1 だと見えません(´・ω・`)
GRID_SIZE = 4
# ◆ミニマップ前景色(通行可)
FOREGROUND_COLOR = Color.new(224, 255, 255, 160)
# ◆ミニマップ背景色(通行不可)
BACKGROUND_COLOR = Color.new( 0, 0, 128, 160)
# ◆現在位置の色
POSITION_COLOR = Color.new(220, 20, 60, 192)
# ◆オブジェクトの色
OBJECT_COLOR = {
MOVE => Color.new( 50, 205, 50, 160), # ◆マップ移動イベントの色
BOSS => Color.new(255, 165, 0, 160), # ◆ボスイベントの色
TRSR => Color.new( 0, 255, 255, 160), # ◆眼に見える宝箱の色
H_MV => Color.new(221, 160, 221, 160), # ◆アナライズ:隠し通路の色
H_TR => Color.new(255, 215, 0, 160), # ◆アナライズ:タンスなどのアイテムの色
EVET => Color.new(255, 105, 182, 160), # ◆特殊イベントの色
} # ← Don't delete this line!
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["MiniMap"] = true
module KGC::MiniMap
#--------------------------------------------------------------------------
# ● ミニマップ全体をリフレッシュ
#--------------------------------------------------------------------------
def self.refresh
if $scene.is_a?(Scene_Map)
$scene.spriteset.minimap.refresh
end
end
#--------------------------------------------------------------------------
# ● ミニマップのオブジェクトを更新
#--------------------------------------------------------------------------
def self.update_object
if $scene.is_a?(Scene_Map)
$scene.spriteset.minimap.update_object_list
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ RPG::MapInfo
#==============================================================================
class RPG::MapInfo
include DIA_MM
#--------------------------------------------------------------------------
# ● マップ名
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# ● オリジナル名
#--------------------------------------------------------------------------
def original_name
return @name
end
#--------------------------------------------------------------------------
# ● ミニマップ表示
#--------------------------------------------------------------------------
def show_minimap?
for map_name in NOMAP_LIST
if @name =~ map_name
@name = "NOMAP"
end
end
return !(@name =~ "NOMAP")
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :show_minimap # ミニマップ表示
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_MiniMap initialize
def initialize
initialize_KGC_MiniMap
@show_minimap = true
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● セットアップ
# map_id : マップ ID
#--------------------------------------------------------------------------
alias setup_KGC_MiniMap setup
def setup(map_id)
setup_KGC_MiniMap(map_id)
@map_info = load_data(FIX_PATH::PATH_DATA_MAPI)[map_id]
end
#--------------------------------------------------------------------------
# ● ミニマップ表示
#--------------------------------------------------------------------------
def show_minimap?
return @map_info.show_minimap?
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● イベント名
#--------------------------------------------------------------------------
def name
return @event.name
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_MiniMap
#------------------------------------------------------------------------------
# ミニマップを扱うクラスです。
#==============================================================================
class Game_MiniMap
include BM
include DIA_MM
include KGC::MiniMap
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(tilemap)
map_rect = MAP_RECT
grid_size = [GRID_SIZE, 1].max
@x = 0
@y = 0
@size = [map_rect.width / grid_size, map_rect.height / grid_size]
@tilemap = tilemap
# マップ用スプライト作成
@map_sprite = Sprite.new
@map_sprite.x = map_rect.x
@map_sprite.y = map_rect.y
@map_sprite.z = MAP_Z
bitmap_width = $game_map.width * grid_size + map_rect.width
bitmap_height = $game_map.height * grid_size + map_rect.height
@map_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
@map_sprite.src_rect = map_rect
# オブジェクト用スプライト作成
@object_sprite = Sprite.new
@object_sprite.x = map_rect.x
@object_sprite.y = map_rect.y
@object_sprite.z = MAP_Z# + 1
@object_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
@object_sprite.src_rect = map_rect
# 現在位置スプライト作成
@position_sprite = RPG::Sprite.new
@position_sprite.x = map_rect.x + @size[0] / 2 * grid_size
@position_sprite.y = map_rect.y + @size[1] / 2 * grid_size
@position_sprite.z = MAP_Z# + 2
bitmap = Bitmap.new(grid_size, grid_size)
bitmap.fill_rect(bitmap.rect, POSITION_COLOR)
@position_sprite.bitmap = bitmap
@position_sprite.blink_on
refresh
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
@map_sprite.bitmap.dispose
@map_sprite.dispose
@object_sprite.bitmap.dispose
@object_sprite.dispose
@position_sprite.bitmap.dispose
@position_sprite.dispose
end
#--------------------------------------------------------------------------
# ● 可視状態取得
#--------------------------------------------------------------------------
def visible
return @map_sprite.visible
end
#--------------------------------------------------------------------------
# ● 可視状態設定
#--------------------------------------------------------------------------
def visible=(value)
@map_sprite.visible = value
@object_sprite.visible = value
@position_sprite.visible = value
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
draw_map
update_object_list
draw_object
update_position
end
#--------------------------------------------------------------------------
# ● マップ描画
#--------------------------------------------------------------------------
def draw_map
bitmap = @map_sprite.bitmap
bitmap.fill_rect(bitmap.rect, BACKGROUND_COLOR)
map_rect = MAP_RECT
grid_size = [GRID_SIZE, 1].max
$game_map.width.times { |i| # X座標
$game_map.height.times { |j| # Y座標
if !$game_map.passable?(i, j, 0)
next
end
rect = Rect.new(map_rect.width / 2 + grid_size * i,
map_rect.height / 2 + grid_size * j,
grid_size, grid_size)
# 通行可能判定
if grid_size >= 3
if !$game_map.passable?(i, j, 2)
rect.height -= 1
end
if !$game_map.passable?(i, j, 4)
rect.x += 1
rect.width -= 1
end
if !$game_map.passable?(i, j, 6)
rect.width -= 1
end
if !$game_map.passable?(i, j, 8)
rect.y += 1
rect.height -= 1
end
end
# 色設定
color = FOREGROUND_COLOR
$game_map.events.values.each { |e|
if e.x == i && e.y == j then
# 移動の場合
if eve_prm_include(e, MOVE)
color = OBJECT_COLOR[MOVE]
break
# 隠し宝、隠し通路の場合
elsif eve_prm_include(e, H_TR) ||
eve_prm_include(e, H_MV)
if color == FOREGROUND_COLOR
color = NILCOLOR
end
break
# 壁の場合
elsif eve_prm_include(e, WALL)
if color == FOREGROUND_COLOR
color = BACKGROUND_COLOR
end
break
end
end
}
bitmap.fill_rect(rect, color)
}
}
end
#--------------------------------------------------------------------------
# ● オブジェクト一覧更新
#--------------------------------------------------------------------------
def update_object_list
@object_list = []
$game_map.events.values.each { |e|
# ボスの場合
if eve_prm_include(e, BOSS)
if @object_list[1] == nil
@object_list[1] = []
end
@object_list[1] << e
# 隠し通路の場合
elsif eve_prm_include(e, H_MV)
if @object_list[2] == nil
@object_list[2] = []
end
@object_list[2] << e
# 宝の場合
elsif eve_prm_include(e, TRSR)
if @object_list[3] == nil
@object_list[3] = []
end
@object_list[3] << e
# 隠しアイテムの場合
elsif eve_prm_include(e, H_TR)
if @object_list[4] == nil
@object_list[4] = []
end
@object_list[4] << e
# イベントの場合
elsif eve_prm_include(e, EVET)
if @object_list[5] == nil
@object_list[5] = []
end
@object_list[5] << e
end
}
end
#--------------------------------------------------------------------------
# ● オブジェクト描画
#--------------------------------------------------------------------------
def draw_object
# 下準備
bitmap = @object_sprite.bitmap
bitmap.clear
map_rect = MAP_RECT
grid_size = [GRID_SIZE, 1].max
rect = Rect.new(0, 0, grid_size, grid_size)
mw = map_rect.width / 2
mh = map_rect.height / 2
# オブジェクト描画
@object_list.each_with_index { |list, i|
case i
#when 0 # 移動イベント
#color = OBJECT_COLOR[MOVE]
when 1 # ボスイベント
color = OBJECT_COLOR[BOSS]
when 2 # 隠し通路
if !$game_switches[ANA_FLG]
color = BACKGROUND_COLOR
elsif $game_switches[ANA_FLG]
color = OBJECT_COLOR[H_MV]
end
when 3 # 宝箱イベント
color = OBJECT_COLOR[TRSR]
when 4 # 目に見えない宝
if !$game_switches[ANA_FLG]
color = BACKGROUND_COLOR
elsif $game_switches[ANA_FLG]
color = OBJECT_COLOR[H_TR]
end
when 5 # 特殊イベント
color = OBJECT_COLOR[EVET]
end
if list.nil? || color.nil?
next
end
list.each { |obj|
# 歩行グラフィック無しなら表示しない
if (obj.character_name != "" || obj.tile_id != 0)
rect.x = mw + obj.real_x * grid_size / 128
rect.y = mh + obj.real_y * grid_size / 128
bitmap.fill_rect(rect, color)
end
}
}
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
draw_object
update_position
if @map_sprite.visible
@map_sprite.update
@object_sprite.update
@position_sprite.update
end
end
#--------------------------------------------------------------------------
# ● 位置更新
#--------------------------------------------------------------------------
def update_position
map_rect = MAP_RECT
grid_size = [GRID_SIZE, 1].max
sx = $game_player.real_x * grid_size / 128
sy = $game_player.real_y * grid_size / 128
@map_sprite.src_rect.x = sx
@map_sprite.src_rect.y = sy
@object_sprite.src_rect.x = sx
@object_sprite.src_rect.y = sy
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
attr_reader :minimap
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_MiniMap initialize
def initialize
initialize_KGC_MiniMap
if $game_map.show_minimap?
@minimap = Game_MiniMap.new(@tilemap)
if $game_system.show_minimap == nil
$game_system.show_minimap = true
end
@minimap.visible = $game_system.show_minimap
end
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias dispose_KGC_MiniMap dispose
def dispose
dispose_KGC_MiniMap
if @minimap != nil
@minimap.dispose
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_KGC_MiniMap update
def update
update_KGC_MiniMap
if @minimap != nil
if $game_system.show_minimap
@minimap.visible = true
@minimap.update
else
@minimap.visible = false
end
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
attr_reader :spriteset
end
|