| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 2 |
| 经验 | |
| 最后登录 | 2026-5-6 |
| 在线时间 | 1452 小时 |
- 梦石
- 0
- 星屑
- 189
- 在线时间
- 1452 小时
- 注册时间
- 2010-9-23
- 回帖
- 492
|
发表于 2015-8-24 19:57:42
|
显示全部楼层
本帖最后由 黑崎一护 于 2015-8-24 20:07 编辑
借花献佛,VIPArcher大大的脚本,可以在窗口显示地图名称主角的坐标。
点击展开/收起#==============================================================================
# by VIPArcher
#------------------------------------------------------------------------------
#
#==============================================================================
module VIPArcher
SwitchesShow = 1 #控制显示的开关
end
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# 处理系统附属数据的类。保存存档和菜单的禁止状态之类的数据。
# 本类的实例请参考 $game_system 。
#==============================================================================
class Game_System
attr_accessor :variable_show
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias vw_initialize initialize
def initialize
vw_initialize
end
end
#==============================================================================
# ■ Window_Variable
#------------------------------------------------------------------------------
# 显示变量窗口
#==============================================================================
class Window_Variable < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(2))
self.opacity = 0
self.contents_opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
if $game_switches[VIPArcher::SwitchesShow] == true
self.opacity = 255
self.contents_opacity = 255
else
self.opacity = 0
self.contents_opacity = 0
end
refresh if $game_player.moving?
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text(x, y + line_height, width, line_height, "X:#{$game_player.x}")
draw_text(x + width / 2, y + line_height, width, line_height, "Y:#{$game_player.y}")
draw_text(x, y, width, line_height, $game_map.display_name)
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 地图画面
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 生成所有窗口
#--------------------------------------------------------------------------
alias vw_create_all_windows create_all_windows
def create_all_windows
vw_create_all_windows
@variable_window = Window_Variable.new
@variable_window.y = 0
end
end
脚本图示效果如下:

脚本二:
tseyik大大在论坛里贴过的简易地图显示脚本。
脚本效果如下:
1:在右下角小地图

2:正中央小地图

3:在右下角小地图

0:不表示
在事件开头注释[マーカー:n](n是颜色),則可以n色在简易地图中表示该事件
簡易マップ表示 ver. 1.1 BY木星ペンギン=begin
▼ 簡易マップ表示 ver. 1.1
RPGツクールVXAce用スクリプト
制作 : 木星ペンギン
URL : http://woodpenguin.blog.fc2.com/
------------------------------------------------------------------------------
概要
□ 簡易マップを画面に表示させます。
□ 乗り物擬似3D化と併用する場合、こちらのスクリプトを下にしてください。
------------------------------------------------------------------------------
各タイプの説明
□ タイプ 1
・プレイヤーの周辺を表示するタイプ。表示範囲は四角形。
□ タイプ 2
・指定した範囲にマップ全体を表示するタイプ。
□ タイプ 3
・プレイヤーの周辺を表示するタイプ。表示範囲は円形。若干処理重め。
・スクロールタイプに関係なく、ループ表示します。
・<マップ側回転フラグ>はさらに重くなるので注意。
・幅と高さは同じ値にしてください。
・標示範囲よりマップ画像が小さい場合、標示がおかしくなります。
=end
#//////////////////////////////////////////////////////////////////////////////
#
# 設定項目
#
#//////////////////////////////////////////////////////////////////////////////
module WdTk
module SimpMap
#--------------------------------------------------------------------------
# ● 画像を参照するフォルダ名
#--------------------------------------------------------------------------
DirName = "Graphics/System/"
#--------------------------------------------------------------------------
# ● 使用するマップ画像
# マップ ID をキーとして、マップ画像のファイル名を指定してください。
# マップ画像名を "" (空の文字列) にした場合は自動生成されます。
# 設定していないマップでは、簡易マップは標示されません。
#--------------------------------------------------------------------------
Map = {5 => "", 6 => ""}
#--------------------------------------------------------------------------
# ● 使用する変数 ID
# この変数の値で簡易マップの表示タイプを変えることが出来ます。
# 変数の値が 0 で非表示。他は各設定を参照。
#--------------------------------------------------------------------------
VariableID = 1
#--------------------------------------------------------------------------
# ● 基本設定
# 変数に入っている数値をキーとして、各パラメータを設定します。
#--------------------------------------------------------------------------
Data = {}
Data[0] = nil # 非表示
# 変数の値が 1 の場合 (タイプ 1 サンプル)
params = {}
params[:type] = 1 # タイプ
params[:width] = 128 # 幅
params[:height] = 96 # 高さ
params[:x] = Graphics.width - params[:width] - 16 # X 座標
params[:y] = Graphics.height - params[:height] - 16 # Y 座標
params[:opacity] = 200 # 不透明度
params[:zoom] = 1.0 # 拡大率
params[:frame] = "" # フレームの画像ファイル名
Data[1] = params
# 変数の値が 2 の場合 (タイプ 2 サンプル)
params = {}
params[:type] = 2 # タイプ
params[:x] = 16 # X 座標
params[:y] = 16 # Y 座標
params[:width] = Graphics.width - params[:x] * 2 # 幅
params[:height] = Graphics.height - params[:y] * 2 # 高さ
params[:opacity] = 224 # 不透明度
params[:frame] = "" # フレームの画像ファイル名
Data[2] = params
# 変数の値が 3 の場合 (タイプ 3 サンプル)
params = {}
params[:type] = 3 # タイプ
params[:width] = 128 # 幅
params[:height] = 128 # 高さ
params[:x] = Graphics.width - params[:width] / 2 - 16 # X 座標
params[:y] = Graphics.height - params[:height] / 2 - 16 # Y 座標
params[:opacity] = 200 # 不透明度
params[:zoom] = 1.0 # 拡大率
params[:turnmap] = false # マップ回転フラグ(乗り物擬似3D化中のみ)
params[:frame] = "" # フレームの画像ファイル名
Data[3] = params
#--------------------------------------------------------------------------
# ● プレイヤーのマーカー
# 画像ファイルが未設定の場合は自動生成されます。
# 画像の原点は、 X軸は中心位置となります。Y軸は設定できます。
# 回転させる場合、北向きが基本となります。
#--------------------------------------------------------------------------
Player = "" # プレイヤーの画像ファイル名
PlyOrBtm = 0 # プレイヤー画像の Y 軸原点(下からのドット数)
TurnPly = false # プレイヤーの向きにあわせて画像を回転させるかどうか
Vehicle = "" # 乗り物搭乗時の画像ファイル名
VehOrBtm = 2 # 乗り物画像の Y 軸原点(下からのドット数)
TurnVeh = true # 乗り物の向きにあわせて画像を回転させるかどうか
#--------------------------------------------------------------------------
# ● マップ自動生成用の設定
#--------------------------------------------------------------------------
# タイルの色
Land = Color.new(192, 192, 192) # 陸地
Sea = Color.new( 0, 0, 0, 128) # 深海
Ford = Color.new( 64, 64, 64, 192) # 浅瀬・沼
Mtn = Color.new( 96, 96, 96) # 高い山
Hill = Color.new(128, 128, 128) # 低い山
Fst = Color.new(160, 160, 160) # 森
TileSize = 4 # 1 タイルの大きさ
MapBlur = true # ぼかし処理
StartInit = false # ゲーム起動時にマップ生成
#//////////////////////////////////////////////////////////////////////////////
#
# 以降、変更する必要なし
#
#//////////////////////////////////////////////////////////////////////////////
def self.init
return unless StartInit
Map.each {|map_id, name| create_simplemap(map_id) if name.empty? }
end
def self.create_simplemap(map_id)
map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
bitmap = Bitmap.new(map.width * TileSize, map.height * TileSize)
map.width.times do |x|; map.height.times do |y|
index0 = (map.data[x, y, 0] - 2048) / 48
index1 = (map.data[x, y, 1] - 2048) / 48
if index0 < 16
color = (index1 == 1 ? Sea : Ford)
else
case index1
when 20,21,28,36,44; color = Fst
when 22,30,38,46; color = Hill
when 23,31,39,47; color = Mtn
else color = Land
end
end
bitmap.fill_rect(x * TileSize, y * TileSize, TileSize, TileSize, color)
end; end
bitmap.blur if MapBlur
bitmap
end
Data.each_value do |params|
next unless params && params[:type] == 3
params[:cal] = []
(params[:height] / params[:zoom]).ceil.times do |i|
r = params[:width] / 2.0 / params[:zoom]
params[:cal] << Math.sqrt(r ** 2 - (r - i - 0.5) ** 2).ceil
end
end
end
@Cache ||= {}
def self.load_simplemap(map_id)
key = sprintf("SimpleMap/%03d", map_id)
@cache.delete(key) if @cache.include?(key) && @cache[key].disposed?
@cache[key] ||= SimpMap.create_simplemap(map_id)
end
def self.save_simplemap(map_id, bitmap)
key = sprintf("SimpleMap/%03d", map_id)
@cache[key] = bitmap
end
def self.delete_simplemap(map_id)
key = sprintf("SimpleMap/%03d", map_id)
@cache.delete(key)
end
@material ||= []
@material << :SimpMap
def self.include?(sym)
@material.include?(sym)
end
end
#==============================================================================
# ■ DataManager
#==============================================================================
class << DataManager
#--------------------------------------------------------------------------
# ◯ モジュール初期化
#--------------------------------------------------------------------------
alias _wdtk_simpmap_init init
def init
_wdtk_simpmap_init
WdTk::SimpMap.init
end
end
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player
#--------------------------------------------------------------------------
# ● マーカーの色
#--------------------------------------------------------------------------
def mark_index
return 0
end
end
#==============================================================================
# ■ Game_Vehicle
#==============================================================================
class Game_Vehicle
#--------------------------------------------------------------------------
# ● マーカーの色
#--------------------------------------------------------------------------
def mark_index
return 6
end
end
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :mark_index # マーカーの色
#--------------------------------------------------------------------------
# ◯ イベントページの設定をセットアップ
#--------------------------------------------------------------------------
alias _wdtk_simpmap_setup_page_settings setup_page_settings
def setup_page_settings
_wdtk_simpmap_setup_page_settings
clear_simpmap_params
setup_simpmap_params
end
#--------------------------------------------------------------------------
# ● イベント内容から設定をセットアップ
#--------------------------------------------------------------------------
def setup_simpmap_params
@list.each do |cmd|
case cmd.code
when 108,408
case cmd.parameters[0]
when /マーカー\s*[::]\s*(\d+)/
@mark_index = $1.to_i
end
else
return
end
end
end
#--------------------------------------------------------------------------
# ● イベント立体表示の設定をクリア
#--------------------------------------------------------------------------
def clear_simpmap_params
@mark_index = nil
end
end
#==============================================================================
# ■ Spriteset_SimpleMap
#==============================================================================
class Spriteset_SimpleMap
#--------------------------------------------------------------------------
# ● モジュール
#--------------------------------------------------------------------------
include WdTk::SimpMap
#--------------------------------------------------------------------------
# ● 定数
#--------------------------------------------------------------------------
PlayerData = [[ 64,224,224, 64],
[224,255,255,224],
[224,255,255,224],
[ 64,224,224, 64]]
VehicleData = [[ 0,224,224, 0],
[ 0,224,224, 0],
[ 0, 0, 0, 0],
[ 0, 0, 0, 0],
[ 64,224,224, 64],
[224,255,255,224],
[224,255,255,224],
[ 64,224,224, 64]]
MarkerData = [[ 64,224,224, 64],
[224,255,255,224],
[224,255,255,224],
[ 64,224,224, 64]]
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@update_count = 0
@marker_bitmaps = {}
@rect = Rect.new
create_simpmap
create_marker
create_player
create_frame
create_map_bitmap
update
end
#--------------------------------------------------------------------------
# ● 簡易マップの作成
#--------------------------------------------------------------------------
def create_simpmap
@simpmap_sprite = Sprite.new
@simpmap_sprite.z = 150
end
#--------------------------------------------------------------------------
# ● マーカーの作成
#--------------------------------------------------------------------------
def create_marker
@marker_sprite = Sprite.new
@marker_sprite.z = 151
end
#--------------------------------------------------------------------------
# ● プレイヤーの作成
#--------------------------------------------------------------------------
def create_player
@player_sprite = Sprite.new
@player_sprite.z = 152
if Player.empty?
i = $game_player.mark_index
@player_bitmap = make_marker_bitmap(PlayerData, get_color(i))
else
@player_bitmap = Cache.load_bitmap(DirName, Player)
end
if !Vehicle.empty?
@vehicle_bitmap = Cache.load_bitmap(DirName, Vehicle)
elsif TurnVeh
i = $game_player.mark_index
@vehicle_bitmap = make_marker_bitmap(VehicleData, get_color(i))
else
@vehicle_bitmap = @player_bitmap
end
end
#--------------------------------------------------------------------------
# ● フレームの作成
#--------------------------------------------------------------------------
def create_frame
@frame_sprite = Sprite.new
@frame_sprite.z = 152
end
#--------------------------------------------------------------------------
# ● マップ画像の作成
#--------------------------------------------------------------------------
def create_map_bitmap
@loop_bitmap.dispose if @loop_bitmap
if !Map.include?($game_map.map_id)
@loop_bitmap = nil
return
elsif !Map[$game_map.map_id].empty?
map_bitmap = Cache.load_bitmap(DirName, Map[$game_map.map_id])
else
map_bitmap = WdTk.load_simplemap($game_map.map_id)
end
@map_width = map_bitmap.width
@map_height = map_bitmap.height
@loop_bitmap = Bitmap.new(@map_width * 2, @map_height * 2)
@loop_bitmap.blt(0, 0, map_bitmap, map_bitmap.rect)
@loop_bitmap.blt(@map_width, 0, map_bitmap, map_bitmap.rect)
@loop_bitmap.blt(0, @map_height, @loop_bitmap, @loop_bitmap.rect)
end
#--------------------------------------------------------------------------
# ● 色の取得
#--------------------------------------------------------------------------
def get_color(index)
bitmap = Cache.system("Window")
bitmap.get_pixel(64 + (index % 8) * 8, 96 + (index / 8) * 8)
end
#--------------------------------------------------------------------------
# ● マーカー画像の取得
#--------------------------------------------------------------------------
def make_marker_bitmap(alpha_data, color)
bitmap = Bitmap.new(alpha_data[0].size, alpha_data.size)
alpha_data.each_with_index do |data, y|; data.each_with_index do |alpha, x|
color.alpha = alpha
bitmap.set_pixel(x, y, color)
end; end
bitmap
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
@simpmap_sprite.dispose
@loop_bitmap.dispose if @loop_bitmap
@marker_sprite.bitmap.dispose if @marker_sprite.bitmap
@marker_sprite.dispose
@player_sprite.dispose
@frame_sprite.dispose
@player_bitmap.dispose
@vehicle_bitmap.dispose
@marker_bitmaps.each_value {|bitmap| bitmap.dispose }
end
#--------------------------------------------------------------------------
# ● ビューポートの設定
#--------------------------------------------------------------------------
def viewport=(v)
@simpmap_sprite.viewport = v
@marker_sprite.viewport = v
@player_sprite.viewport = v
@frame_sprite.viewport = v
end
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
def setup
@simpmap_sprite.bitmap.dispose if @params && @params[:type] == 3
@marker_sprite.bitmap.dispose if @marker_sprite.bitmap
@params = (@loop_bitmap ? Data[@index] : nil)
case (@params ? @params[:type] : 0)
when 1 # 一部拡大四角表示
@zoom = @params[:zoom]
@rect.width = [@params[:width], @map_width * @zoom].min
@rect.height = [@params[:height], @map_height * @zoom].min
@rect.x = @params[:x] + (@params[:width] - @rect.width) / 2
@rect.y = @params[:y] + (@params[:height] - @rect.height) / 2
setup_square
when 2 # 全体表示
@zoom = [@params[:width].to_f / @map_width,
@params[:height].to_f / @map_height].min
@rect.width = @map_width * @zoom
@rect.height = @map_height * @zoom
@rect.x = @params[:x] + (@params[:width] - @rect.width) / 2
@rect.y = @params[:y] + (@params[:height] - @rect.height) / 2
setup_square
when 3 # 一部拡大円形表示
@zoom = @params[:zoom]
@rect.set(@params[:x], @params[:y], @params[:width], @params[:height])
setup_circle
else # 表示しない
@simpmap_sprite.visible = @marker_sprite.visible =
@player_sprite.visible = @frame_sprite.visible = false
return
end
@update_count = 71
end
#--------------------------------------------------------------------------
# ● 共通のセットアップ
#--------------------------------------------------------------------------
def setup_base
@simpmap_sprite.visible = true
@simpmap_sprite.x = @rect.x
@simpmap_sprite.y = @rect.y
@simpmap_sprite.zoom_x = @simpmap_sprite.zoom_y = @zoom
@marker_sprite.visible = true
@marker_sprite.x = @rect.x
@marker_sprite.y = @rect.y
@player_sprite.visible = true
if @params[:frame] && !@params[:frame].empty?
@frame_sprite.visible = true
@frame_sprite.bitmap = Cache.load_bitmap(DirName, @params[:frame])
else
@frame_sprite.visible = false
end
@simpmap_sprite.opacity = @params[:opacity]
end
#--------------------------------------------------------------------------
# ● 四角タイプのセットアップ
#--------------------------------------------------------------------------
def setup_square
setup_base
@simpmap_sprite.bitmap = @loop_bitmap
@simpmap_sprite.ox = @simpmap_sprite.oy = 0
@simpmap_sprite.angle = 0
w = (@rect.width / @zoom).ceil
h = (@rect.height / @zoom).ceil
@simpmap_sprite.src_rect.set(0, 0, w, h)
w = @map_width * @zoom * 2
h = @map_height * @zoom * 2
@marker_sprite.bitmap = Bitmap.new(w, h)
@marker_sprite.ox = @marker_sprite.oy = 0
@marker_sprite.src_rect.set(@rect)
@frame_sprite.x = @rect.x + (@rect.width - @frame_sprite.width) / 2
@frame_sprite.y = @rect.y + (@rect.height - @frame_sprite.height) / 2
end
#--------------------------------------------------------------------------
# ● 円形タイプのセットアップ
#--------------------------------------------------------------------------
def setup_circle
setup_base
w = (@rect.width / @zoom).ceil
h = (@rect.height / @zoom).ceil
@simpmap_sprite.bitmap = Bitmap.new(w, h)
@simpmap_sprite.ox = w / 2
@simpmap_sprite.oy = h / 2
@simpmap_sprite.zoom_x = @simpmap_sprite.zoom_y = @zoom
@marker_sprite.bitmap = Bitmap.new(@rect.width, @rect.height)
@marker_sprite.ox = @rect.width / 2
@marker_sprite.oy = @rect.height / 2
@marker_sprite.opacity = 255
@player_sprite.x = @rect.x
@player_sprite.y = @rect.y
@frame_sprite.x = @rect.x
@frame_sprite.y = @rect.y
@frame_sprite.ox = @frame_sprite.width / 2
@frame_sprite.oy = @frame_sprite.height / 2
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
if @map_id != $game_map.map_id || @index != $game_variables[VariableID]
create_map_bitmap if @map_id != $game_map.map_id
@map_id = $game_map.map_id
@index = $game_variables[VariableID]
setup
end
if @params
case @params[:type]
when 1; update_all_marker(true)
when 2; update_all_marker(false)
when 3; update_type3
end
end
end
#--------------------------------------------------------------------------
# ● 全マーカーの更新
#--------------------------------------------------------------------------
def update_all_marker(loop = true)
@update_count = (@update_count + 1) % 72
player = vehicle? ? $game_player.vehicle : $game_player
px = (player.real_x + 0.5) * @map_width / $game_map.width
py = (player.real_y + 0.5) * @map_height / $game_map.height
ox = px - (@rect.width / @zoom / 2).ceil
unless loop && $game_map.loop_horizontal?
ox = [[ox, @map_width - @simpmap_sprite.width].min, 0].max
end
ox %= @map_width
oy = py - (@rect.height / @zoom / 2).ceil
unless loop && $game_map.loop_vertical?
oy = [[oy, @map_height - @simpmap_sprite.height].min, 0].max
end
oy %= @map_height
update_player(px - ox, py - oy)
update_simpmap(ox, oy)
update_marker(ox, oy)
end
#--------------------------------------------------------------------------
# ● プレイヤーの更新
#--------------------------------------------------------------------------
def update_player(x, y)
if vehicle?
@player_sprite.bitmap = @vehicle_bitmap
@player_sprite.ox = @vehicle_bitmap.width / 2
@player_sprite.oy = @vehicle_bitmap.height - VehOrBtm
if !TurnVeh
@player_sprite.angle = 0
elsif WdTk.include?(:Veh3D) && $game_player.in_vehicle
@player_sprite.angle = $game_player.vehicle.angle
else
@player_sprite.angle = player_angle
end
else
@player_sprite.bitmap = @player_bitmap
@player_sprite.ox = @player_bitmap.width / 2
@player_sprite.oy = @player_bitmap.height - PlyOrBtm
@player_sprite.angle = (TurnPly ? player_angle : 0)
end
@player_sprite.x = @rect.x + x % @map_width * @zoom
@player_sprite.y = @rect.y + y % @map_height * @zoom
end
#--------------------------------------------------------------------------
# ● 簡易マップの更新
#--------------------------------------------------------------------------
def update_simpmap(x, y)
@simpmap_sprite.src_rect.x = x
@simpmap_sprite.src_rect.y = y
end
#--------------------------------------------------------------------------
# ● マーカーの更新
#--------------------------------------------------------------------------
def update_marker(x, y)
@marker_sprite.opacity = 256 - @update_count * 3
redraw_marker if @update_count == 0
@marker_sprite.src_rect.x = x * @zoom
@marker_sprite.src_rect.y = y * @zoom
end
#--------------------------------------------------------------------------
# ● マーカーの再描写
#--------------------------------------------------------------------------
def redraw_marker
bitmap = @marker_sprite.bitmap
bitmap.clear
x_rate = bitmap.width / 2.0 / $game_map.width
y_rate = bitmap.height / 2.0 / $game_map.height
events = $game_map.events.values
$game_map.vehicles.each {|v| events << v unless v.transparent || v.driving }
events.each do |event|
i = event.mark_index
next unless i
@marker_bitmaps ||= make_marker_bitmap(MarkerData, get_color(i))
marker = @marker_bitmaps
ex = (event.x + 0.5) * x_rate - marker.width / 2
ey = (event.y + 0.5) * y_rate - marker.height / 2
bitmap.blt(ex, ey, marker, marker.rect)
end
bitmap.blt(bitmap.width / 2, 0, bitmap, bitmap.rect)
bitmap.blt(0, bitmap.height / 2, bitmap, bitmap.rect)
end
#--------------------------------------------------------------------------
# ● 乗り物に乗っているかどうか
#--------------------------------------------------------------------------
def vehicle?
if WdTk.include?(:Veh3D)
$game_player.in_vehicle
else
$game_player.vehicle && $game_player.vehicle.movable?
end
end
#--------------------------------------------------------------------------
# ● プレイヤーの向きから角度を取得
#--------------------------------------------------------------------------
def player_angle
case $game_player.direction
when 2; 180
when 4; 90
when 6; 270
when 8; 0
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (タイプ 3)
#--------------------------------------------------------------------------
def update_type3
@update_count = (@update_count + 1) % 72
return if @update_count.odd?
player = vehicle? ? $game_player.vehicle : $game_player
px = (player.real_x + 0.5) * @map_width / $game_map.width
py = (player.real_y + 0.5) * @map_height / $game_map.height
ox = (px - @rect.width / @zoom / 2) % @map_width
oy = (py - @rect.height / @zoom / 2) % @map_width
update_player_t3
update_simpmap_t3(ox, oy)
update_marker_t3(player)
if WdTk.include?(:Veh3D) && $game_player.in_vehicle && @params[:turnmap]
@simpmap_sprite.angle = -player.angle
@frame_sprite.angle = -player.angle
end
end
#--------------------------------------------------------------------------
# ● プレイヤーの更新(タイプ 3 用)
#--------------------------------------------------------------------------
def update_player_t3
if vehicle?
@player_sprite.bitmap = @vehicle_bitmap
@player_sprite.ox = @vehicle_bitmap.width / 2
@player_sprite.oy = @vehicle_bitmap.height - VehOrBtm
if WdTk.include?(:Veh3D) && $game_player.in_vehicle
if @params[:turnmap] || !TurnVeh
@player_sprite.angle = 0
else
@player_sprite.angle = $game_player.vehicle.angle
end
elsif TurnVeh
@player_sprite.angle = player_angle
else
@player_sprite.angle = 0
end
else
@player_sprite.bitmap = @player_bitmap
@player_sprite.ox = @player_bitmap.width / 2
@player_sprite.oy = @player_bitmap.height - PlyOrBtm
@player_sprite.angle = 0
end
end
#--------------------------------------------------------------------------
# ● 簡易マップの更新(タイプ 3 用)
#--------------------------------------------------------------------------
def update_simpmap_t3(x, y)
bitmap = @simpmap_sprite.bitmap
bitmap.clear
rect = Rect.new
@params[:cal].each_with_index do |n, i|
m = (@rect.width / 2 / @zoom).ceil - n
rect.set(x + m, y + i, n * 2, 1)
bitmap.blt(m, i, @loop_bitmap, rect)
end
end
#--------------------------------------------------------------------------
# ● マーカーの更新(タイプ 3 用)
#--------------------------------------------------------------------------
def update_marker_t3(player)
@marker_sprite.opacity = 256 - @update_count * 3
bitmap = @marker_sprite.bitmap
bitmap.clear
x_rate = @map_width / $game_map.width * @zoom
y_rate = @map_height / $game_map.height * @zoom
psx = $game_map.adjust_x(player.real_x)
psy = $game_map.adjust_y(player.real_y)
radius = @rect.width / x_rate / 2
cx = bitmap.width / 2
cy = bitmap.height / 2
if WdTk.include?(:Veh3D) && $game_player.in_vehicle && @params[:turnmap]
radian = -player.angle * Math::PI / 180
else
radian = 0
end
events = $game_map.events.values
$game_map.vehicles.each {|v| events << v unless v.transparent || v.driving }
events.each do |event|
i = event.mark_index
next unless i
dx = $game_map.adjust_x(event.real_x) - psx
dy = $game_map.adjust_y(event.real_y) - psy
ed = Math.hypot(dx, dy)
next if ed > radius || ed == 0
@marker_bitmaps ||= make_marker_bitmap(MarkerData, get_color(i))
marker = @marker_bitmaps
if radian != 0
rr = Math.atan2(dx, dy) + radian
dx = ed * Math.sin(rr)
dy = ed * Math.cos(rr)
end
ex = dx * x_rate - marker.width / 2
ey = dy * y_rate - marker.height / 2
bitmap.blt(cx + ex, cy + ey, marker, marker.rect)
end
end
end
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
alias _wdtk_simpmap_initialize initialize
def initialize
create_simpmap
_wdtk_simpmap_initialize
end
#--------------------------------------------------------------------------
# ○ 解放
#--------------------------------------------------------------------------
alias _wdtk_simpmap_dispose dispose
def dispose
dispose_simpmap
_wdtk_simpmap_dispose
end
#--------------------------------------------------------------------------
# ○ フレーム更新
#--------------------------------------------------------------------------
alias _wdtk_simpmap_update update
def update
_wdtk_simpmap_update
update_simpmap
end
#--------------------------------------------------------------------------
# ● 簡易マップの作成
#--------------------------------------------------------------------------
def create_simpmap
@spriteset_simpmap = Spriteset_SimpleMap.new
@spriteset_simpmap.viewport = @viewport if WdTk.include?(:Veh3D)
end
#--------------------------------------------------------------------------
# ● 簡易マップの解放
#--------------------------------------------------------------------------
def dispose_simpmap
@spriteset_simpmap.dispose
end
#--------------------------------------------------------------------------
# ● 簡易マップの更新
#--------------------------------------------------------------------------
def update_simpmap
@spriteset_simpmap.update
end
end
#==============================================================================
# ■ Spriteset_Vehicle
#==============================================================================
if WdTk.include?(:Veh3D)
class Spriteset_Vehicle
#--------------------------------------------------------------------------
# ● 簡易マップの更新
#--------------------------------------------------------------------------
def update_simpmap
(60 / Graphics.frame_rate).times { super }
end
end
end
|
评分
-
查看全部评分
|