rebf-gaiden/Scripts/_.47.rb
2025-04-26 17:06:34 -05:00

327 lines
13 KiB
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ★ ExMap_AutoPlane for RGSS3 Ver1.03
#------------------------------------------------------------------------------
#  霧や雲など、特定のマップ画面で自動的に表示されるプレーン (フォグ) を設定
# できるようにするスクリプト素材です。
#
# 本素材はRPGツクールVX サンプルゲームである
# 『レクト―ルと黒獅子の紋章』おまけスクリプトを改変した物である為
# RPGツクールVX Aceだけでなく、RPGツクールVXの正規ユーザーである事が求められます。
#------------------------------------------------------------------------------
# Ver1.01 透過度設定の不具合を解消。
# Ver1.02 XP環境で落ちる恐れがある箇所を修正。
# Ver1.03 イベントコマンドのスクリプトでフォグ変更が可能になりました。
#
# 以下の物を、イベントコマンドのスクリプトで実行して下さい。
#
# fog = [0]#配列作成
# fog[1] = "fog" #ファイル名設定
# fog[2] = 1 #スクロール(x)
# fog[3] = 1 #スクロール(y)
# fog[4] = 50 #Z座標
# fog[5] = 200 #透明度設定
# fog[6] = 0 #合成方法
# $game_map.re_setup_fog(fog)
#
#==============================================================================
# マップ設定。
# マップ ID、グラフィック名、横スクロール、縦スクロール、Z 座標、
# 不透明度0 255、合成方法 (0:通常 1:加算 2:減算)の順に
# 格納した配列を必要なだけ並べます。
# 例) マップ 5 で、グラフィック「fog.png」を、半透明でピクチャの下に通常表示。
#   左に 5 下に 2 ずつスクロール => [5, "fog", 5, -2, 50, 128, 0]
EXMAP_ATPLN_MAPS = [
[0, "", 0, 0, 50, 0, 0],
[3, "pipo-fog002a", 0, 50, 50, 255, 0],
[9, "pipo-fog002a", 2, -2, 50, 175, 0],
[10, "pipo-fog004a", 1, -1, 50, 150, 0],
[39, "pipo-fog004b", 2, -2, 50, 175, 0],
[40, "pipo-fog004b", 2, -2, 50, 175, 0],
[50, "pipo-fog004d", 2, -2, 50, 75, 0],
[51, "pipo-fog004d", 2, -2, 50, 75, 0],
[52, "pipo-fog004d", 2, -2, 50, 75, 0],
[53, "pipo-fog004d", 2, -2, 50, 75, 0],
[56, "pipo-fog004d", 2, -2, 50, 75, 0],
[64, "pipo-fog004b", 2, -2, 50, 125, 0],
[67, "pipo-fog004c", 5, -5, 50, 140, 0],
[68, "pipo-fog004c", 5, -5, 50, 150, 0],
[69, "pipo-fog004c", 5, -5, 50, 120, 0],
[70, "pipo-fog004c", 5, -5, 50, 160, 0],
[71, "pipo-fog004c", 5, -5, 50, 120, 0],
[72, "pipo-fog004b", 2, -2, 50, 125, 0],
[77, "pipo-fog004b", 2, -2, 50, 125, 0],
[83, "pipo-fog004b", 2, -2, 50, 175, 0],
[84, "pipo-fog004b", 2, -2, 50, 175, 0],
[188, "pipo-fog004b", 2, -2, 50, 175, 0],
[90, "pipo-fog020", 0, 0, 50, 150, 1],
[91, "pipo-fog004b", 2, -2, 50, 150, 0],
[92, "pipo-fog004d", 2, -2, 50, 75, 0],
[93, "pipo-fog004b", 2, -2, 50, 150, 0],
[94, "pipo-fog004c", 20, -20, 50, 200, 0],
[95, "pipo-fog004b", 2, -2, 50, 150, 0],
[97, "pipo-fog004a", 2, -2, 50, 100, 0],
[99, "pipo-fog004a", 5, -5, 50, 100, 0],
[100, "pipo-fog004a", 5, -5, 50, 100, 0],
[101, "pipo-fog004a", 5, -5, 50, 75, 0],
[102, "pipo-fog004c", 20, -20, 50, 120, 0],
[109, "pipo-fog004d", 2, -2, 50, 75, 0],
[111, "pipo-fog004d", 2, -2, 50, 50, 0],
[114, "pipo-fog004c", 5, -5, 50, 50, 0],
[115, "pipo-fog004c", 5, -5, 50, 50, 0],
[118, "pipo-fog004c", 5, -5, 50, 150, 0],
[127, "pipo-fog004d", 2, -2, 50, 100, 0],
[132, "pipo-fog004d", 2, -2, 50, 50, 0],
[148, "pipo-fog004c", 20, -20, 50, 200, 0],
[149, "pipo-fog004b", 2, -2, 50, 150, 0],
[150, "pipo-fog020", 0, 0, 50, 150, 1],
[156, "pipo-fog004b", 2, -2, 50, 100, 0],
[157, "pipo-fog004b", 4, -4, 50, 150, 0],
[158, "pipo-fog004b", 6, -6, 50, 200, 0],
[165, "pipo-fog004d", 2, -2, 50, 50, 0],
[171, "pipo-fog004b", 2, -2, 50, 150, 0],
[172, "pipo-fog004b", 2, -2, 50, 100, 0],
[173, "pipo-fog004a", 2, -2, 50, 100, 0],
[178, "pipo-fog004d", 2, -2, 50, 100, 0],
[180, "yumeue", 2, -2, 50, 100, 0],
[181, "yumeue", 2, -2, 50, 100, 0],
[182, "yumeue", 2, -2, 50, 100, 0],
[183, "yumeue", 2, -2, 50, 100, 0],
[184, "pipo-fog004d", 2, -2, 50, 75, 0],
[195, "pipo-fog004d", 2, -2, 50, 75, 0],
[199, "pipo-fog004e", 2, -2, 50, 200, 0],
[202, "pipo-fog004b", 2, -2, 50, 175, 0],
[203, "pipo-fog004b", 2, -2, 50, 100, 0],
[206, "pipo-fog004d", 2, -2, 50, 200, 0],
[208, "pipo-fog004c", 5, -5, 50, 120, 0],
[209, "pipo-fog004c", 5, -5, 50, 120, 0],
[210, "pipo-fog004b", 2, -2, 50, 175, 0],
[211, "pipo-fog004d", 2, -2, 50, 75, 0],
[213, "pipo-fog004b", 2, -2, 50, 175, 0],
[214, "pipo-fog004b", 2, -2, 50, 170, 0],
[215, "pipo-fog004b", 2, -2, 50, 150, 0],
[216, "pipo-fog004e", 5, -5, 50, 200, 0],
[217, "pipo-fog004b", 4, -4, 50, 150, 0],
[218, "pipo-fog004d", 2, -2, 50, 75, 0],
[219, "pipo-fog004d", 2, -2, 50, 200, 0],
[220, "pipo-fog004a", 5, -5, 50, 200, 0],
[221, "pipo-fog004a", 5, -5, 50, 100, 0],
[223, "pipo-fog004b", 4, -4, 50, 150, 0],
[226, "pipo-fog004b", 2, -2, 50, 175, 0],
[228, "pipo-fog002a", 2, -2, 50, 175, 0],
]
# グラフィックフォルダ。
# フォグプレーン用の画像ファイルがあるフォルダ (Graphic/xxx/) を指定します。
# 0:System 1:Parallaxes 2:Pictures 3:Animations
EXMAP_ATPLN_FOLDER = 1
#------------------------------------------------------------------------------
class Game_Map
alias _exmapln_setup setup
alias _exmapln_update update
alias _exmapln_set_display_pos set_display_pos
alias _exmapln_scroll_down scroll_down
alias _exmapln_scroll_left scroll_left
alias _exmapln_scroll_right scroll_right
alias _exmapln_scroll_up scroll_up
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数 (追加定義)
#--------------------------------------------------------------------------
attr_reader :fog # フォグデータ
#--------------------------------------------------------------------------
# ○ セットアップ (追加定義)
# map_id : マップ ID
#--------------------------------------------------------------------------
def setup(map_id)
_exmapln_setup(map_id)
setup_fog
end
#--------------------------------------------------------------------------
# ☆ フォグのセットアップ
#--------------------------------------------------------------------------
def setup_fog
@fog = [0, "", 0, 0, 50, 0, 0]
@fog_sx = 0
@fog_sy = 0
@fog_x = 0
@fog_y = 0
for data in EXMAP_ATPLN_MAPS
if @map_id == data[0]
@fog = data
@fog_sx = data[2]
@fog_sy = data[3]
break
end
end
end
#--------------------------------------------------------------------------
# ☆ フォグのセットアップ
#--------------------------------------------------------------------------
def re_setup_fog(fog_data)
@fog = fog_data
@fog_sx = fog_data[2]
@fog_sy = fog_data[3]
end
#--------------------------------------------------------------------------
# ○ フレーム更新 (追加定義)
#--------------------------------------------------------------------------
def update(main = false)
_exmapln_update(main)
update_fog
end
#--------------------------------------------------------------------------
# ○ 表示位置の設定 (追加定義)
# x : 新しい表示 X 座標 (*256)
# y : 新しい表示 Y 座標 (*256)
#--------------------------------------------------------------------------
def set_display_pos(x, y)
_exmapln_set_display_pos(x, y)
@fog_x = x
@fog_y = y
end
#--------------------------------------------------------------------------
# ☆ フォグ表示 X 座標の計算
# bitmap : フォグビットマップ
#--------------------------------------------------------------------------
def calc_fog_x(bitmap)
return bitmap == nil ? 0 : @fog_x / 8
end
#--------------------------------------------------------------------------
# ☆ フォグ表示 Y 座標の計算
# bitmap : フォグビットマップ
#--------------------------------------------------------------------------
def calc_fog_y(bitmap)
return bitmap == nil ? 0 : @fog_y / 8
end
#--------------------------------------------------------------------------
# ○ 下にスクロール (追加定義)
# distance : スクロールする距離
#--------------------------------------------------------------------------
def scroll_down(distance)
last_y = @display_y
_exmapln_scroll_down(distance)
if loop_vertical?
@fog_y += distance
else
@fog_y += @display_y - last_y
end
end
#--------------------------------------------------------------------------
# ○ 左にスクロール (追加定義)
# distance : スクロールする距離
#--------------------------------------------------------------------------
def scroll_left(distance)
last_x = @display_x
_exmapln_scroll_left(distance)
if loop_horizontal?
@fog_x -= distance
else
@fog_x += @display_x - last_x
end
end
#--------------------------------------------------------------------------
# ○ 右にスクロール (追加定義)
# distance : スクロールする距離
#--------------------------------------------------------------------------
def scroll_right(distance)
last_x = @display_x
_exmapln_scroll_right(distance)
if loop_horizontal?
@fog_x += distance
else
@fog_x += @display_x - last_x
end
end
#--------------------------------------------------------------------------
# ○ 上にスクロール (追加定義)
# distance : スクロールする距離
#--------------------------------------------------------------------------
def scroll_up(distance)
last_y = @display_y
_exmapln_scroll_up(distance)
if @fog != nil
if loop_vertical?
@fog_y -= distance
else
@fog_y += @display_y - last_y
end
end
end
#--------------------------------------------------------------------------
# ☆ フォグの更新
#--------------------------------------------------------------------------
def update_fog
@fog_x += @fog_sx * 2
@fog_y += @fog_sy * 2
end
end
class Spriteset_Map
alias _exmapln_initialize initialize
alias _exmapln_dispose dispose
alias _exmapln_update update
#--------------------------------------------------------------------------
# ○ オブジェクト初期化 (追加定義)
#--------------------------------------------------------------------------
def initialize
create_fog
_exmapln_initialize
end
#--------------------------------------------------------------------------
# ☆ フォグの作成
#--------------------------------------------------------------------------
def create_fog
@fog = Plane.new
if $game_map.fog != nil
@fog.z = $game_map.fog[4]
@fog.opacity = $game_map.fog[5]
@fog.blend_type = $game_map.fog[6]
end
end
#--------------------------------------------------------------------------
# ○ 解放 (追加定義)
#--------------------------------------------------------------------------
def dispose
@fog.dispose
_exmapln_dispose
end
#--------------------------------------------------------------------------
# ○ フレーム更新 (追加定義)
#--------------------------------------------------------------------------
def update
_exmapln_update
update_fog
end
#--------------------------------------------------------------------------
# ☆ フォグの更新
#--------------------------------------------------------------------------
def update_fog
if @fog_name != $game_map.fog[1]
@fog_name = $game_map.fog[1]
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
case EXMAP_ATPLN_FOLDER
when 0
@fog.bitmap = Cache.system(@fog_name)
when 1
@fog.bitmap = Cache.parallax(@fog_name)
when 2
@fog.bitmap = Cache.picture(@fog_name)
when 3
@fog.bitmap = Cache.animation(@fog_name, 0)
end
end
Graphics.frame_reset
end
@fog.ox = $game_map.calc_fog_x(@fog.bitmap)
@fog.oy = $game_map.calc_fog_y(@fog.bitmap)
@fog.z = $game_map.fog[4]
@fog.opacity = $game_map.fog[5]
@fog.blend_type = $game_map.fog[6]
end
end