287 lines
No EOL
11 KiB
Ruby
287 lines
No EOL
11 KiB
Ruby
module FAKEREAL
|
||
|
||
NO_MAP = 9 #マップ名ウィンドウ非表示スイッチ
|
||
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Window_MapName
|
||
#------------------------------------------------------------------------------
|
||
# マップ名を表示するウィンドウです。
|
||
#==============================================================================
|
||
|
||
class Window_MapName < Window_Base
|
||
=begin
|
||
#--------------------------------------------------------------------------
|
||
# ● フェードインの更新
|
||
#--------------------------------------------------------------------------
|
||
def update_fadein
|
||
self.contents_opacity += 5
|
||
self.y += 1 if self.y < 0
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● フェードアウトの更新
|
||
#--------------------------------------------------------------------------
|
||
def update_fadeout
|
||
#self.contents_opacity -= 16
|
||
self.y -= 1 if self.y > -40
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● ウィンドウを開く
|
||
#--------------------------------------------------------------------------
|
||
def open
|
||
if $game_system.h_event || $game_switches[FAKEREAL::NO_MAP] || name_same?
|
||
contents.clear
|
||
self.contents_opacity = 0
|
||
@show_count = 0
|
||
self
|
||
else
|
||
refresh
|
||
@show_count = 150
|
||
self.contents_opacity = 0
|
||
self
|
||
end
|
||
end
|
||
=end
|
||
#--------------------------------------------------------------------------
|
||
# ● オブジェクト初期化 ※再定義
|
||
#--------------------------------------------------------------------------
|
||
def initialize
|
||
super(window_x, window_y, window_width, window_height)
|
||
self.opacity = 0
|
||
self.contents_opacity = 0
|
||
@show_count = 0
|
||
refresh
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● ウィンドウ幅の取得 ※再定義
|
||
#--------------------------------------------------------------------------
|
||
def window_width
|
||
return 375
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# 〇 ウィンドウ高さの取得
|
||
#--------------------------------------------------------------------------
|
||
def window_height
|
||
return 75
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 標準パディングサイズの取得
|
||
#--------------------------------------------------------------------------
|
||
def standard_padding
|
||
return 0
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# 〇 ウィンドウのX位置
|
||
#--------------------------------------------------------------------------
|
||
def window_x
|
||
return Graphics.width / 2 - window_width / 2
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# 〇 ウィンドウのY位置
|
||
#--------------------------------------------------------------------------
|
||
def window_y
|
||
return 0 #fitting_height(1) #Graphics.height - fitting_height(1)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● ウィンドウを開く ※エイリアス
|
||
#--------------------------------------------------------------------------
|
||
alias h_event_open open
|
||
def open
|
||
if $game_switches[FAKEREAL::NO_MAP]
|
||
self
|
||
elsif $game_system.h_event || name_same?
|
||
contents.clear
|
||
self.contents_opacity = 0
|
||
@show_count = 0
|
||
self
|
||
else
|
||
h_event_open
|
||
end
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● ウィンドウを閉じる ※エイリアス
|
||
#--------------------------------------------------------------------------
|
||
alias h_event_close close
|
||
def close
|
||
if $game_switches[FAKEREAL::NO_MAP]
|
||
self
|
||
else
|
||
h_event_close
|
||
end
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# 〇 強制表示用リフレッシュ
|
||
#--------------------------------------------------------------------------
|
||
def force_refresh(mn)
|
||
contents.clear
|
||
draw_background(contents.rect)
|
||
draw_text(contents.rect, mn, 1)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 背景の描画
|
||
#--------------------------------------------------------------------------
|
||
def draw_background(rect)
|
||
#temp_rect = rect.clone
|
||
#temp_rect.width /= 2
|
||
#contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
|
||
#temp_rect.x = temp_rect.width
|
||
#contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
|
||
#r_rect = Rect.new(0, 0, rect.width, rect.height)
|
||
#p r_rect
|
||
#r_rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
|
||
bitmap = Cache.system("MapName")
|
||
contents.blt(0, 0, bitmap, rect)
|
||
bitmap.dispose
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ 前のマップと同名か?
|
||
#--------------------------------------------------------------------------
|
||
def name_same?
|
||
$game_temp.before_map == $game_map.display_name
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ 強制表示
|
||
#--------------------------------------------------------------------------
|
||
def force_open(mn)
|
||
if mn.empty?
|
||
refresh
|
||
else
|
||
force_refresh(mn)
|
||
end
|
||
@show_count = 150
|
||
self.contents_opacity = 0
|
||
self
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# □ Window_NowMap
|
||
#------------------------------------------------------------------------------
|
||
# 現在地を表示するウィンドウです。
|
||
#==============================================================================
|
||
|
||
class Window_NowMap < Window_Base
|
||
#--------------------------------------------------------------------------
|
||
# ○ オブジェクト初期化
|
||
#--------------------------------------------------------------------------
|
||
def initialize
|
||
#super(0, 0, window_width, fitting_height(2))
|
||
super(0, 0, window_width, fitting_height(1))
|
||
refresh
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ ウィンドウ幅の取得
|
||
#--------------------------------------------------------------------------
|
||
def window_width
|
||
return Graphics.width - 160# - 160
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ リフレッシュ
|
||
#--------------------------------------------------------------------------
|
||
def refresh
|
||
contents.clear
|
||
draw_nowmap_name($game_map.save_name, 0, 0, contents.width - 8)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ マップ名の描画
|
||
#--------------------------------------------------------------------------
|
||
def draw_nowmap_name(mapname, x, y, width, align = 1)
|
||
nm_width = 60
|
||
change_color(system_color)
|
||
#draw_text(x, y, width, line_height, "現在地", 0)
|
||
draw_text(x, y, nm_width, line_height, "現在地", 0)
|
||
change_color(normal_color)
|
||
#draw_text(4, y + line_height, width, line_height, mapname, align)
|
||
draw_text(4 + nm_width, y, width - nm_width, line_height, mapname, align)
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Scene_Menu
|
||
#------------------------------------------------------------------------------
|
||
# メニュー画面の処理を行うクラスです。
|
||
#==============================================================================
|
||
|
||
class Scene_Menu < Scene_MenuBase
|
||
#--------------------------------------------------------------------------
|
||
# ● 開始処理
|
||
#--------------------------------------------------------------------------
|
||
alias nowmap_start start
|
||
def start
|
||
nowmap_start
|
||
create_nowmap_window
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ 現在地ウィンドウの作成
|
||
#--------------------------------------------------------------------------
|
||
def create_nowmap_window
|
||
@nowmap_window = Window_NowMap.new
|
||
#@nowmap_window.x = 0
|
||
@nowmap_window.x = @gold_window.width
|
||
#@nowmap_window.y = Graphics.height - @gold_window.height - @nowmap_window.height
|
||
@nowmap_window.y = Graphics.height - @nowmap_window.height
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Temp
|
||
#------------------------------------------------------------------------------
|
||
# セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン
|
||
# スタンスは $game_temp で参照されます。
|
||
#==============================================================================
|
||
|
||
class Game_Temp
|
||
#--------------------------------------------------------------------------
|
||
# ● 公開インスタンス変数
|
||
#--------------------------------------------------------------------------
|
||
attr_accessor :before_map # 場所移動時のフェードタイプ
|
||
#--------------------------------------------------------------------------
|
||
# ● オブジェクト初期化
|
||
#--------------------------------------------------------------------------
|
||
alias map_initialize initialize
|
||
def initialize
|
||
map_initialize
|
||
@before_map = ""
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Scene_Map
|
||
#------------------------------------------------------------------------------
|
||
# マップ画面の処理を行うクラスです。
|
||
#==============================================================================
|
||
|
||
class Scene_Map < Scene_Base
|
||
#--------------------------------------------------------------------------
|
||
# ● 場所移動前の処理
|
||
#--------------------------------------------------------------------------
|
||
alias before_map_pre_transfer pre_transfer
|
||
def pre_transfer
|
||
$game_temp.before_map = $game_map.display_name
|
||
before_map_pre_transfer
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# 〇 マップウィンドウの強制表示
|
||
#--------------------------------------------------------------------------
|
||
def map_name_open(mn)
|
||
@map_name_window.force_open(mn)
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Interpreter
|
||
#------------------------------------------------------------------------------
|
||
# イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
|
||
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
|
||
#==============================================================================
|
||
|
||
class Game_Interpreter
|
||
#--------------------------------------------------------------------------
|
||
# 〇 マップウィンドウ表示
|
||
#--------------------------------------------------------------------------
|
||
def map_name(mn = "")
|
||
return if !SceneManager.scene_is?(Scene_Map)
|
||
SceneManager.scene.map_name_open(mn)
|
||
end
|
||
end |