# ▼▲▼ XRXS_BP 8. ãƒãƒˆãƒ«ãƒãƒƒã‚¯ãƒ»Full-View+å¯å‹•ã‚«ãƒ¡ãƒ© ver.2 ▼▲▼
# by 桜雅 在土
#==============================================================================
# â–¡ カスタマイズãƒã‚¤ãƒ³ãƒˆ
#==============================================================================
module XRXS_BP8
#
# カメラ移動スピード基準値 (基本的ã«å°ã•ã„ã»ã†ãŒé€Ÿã„)
#
SPEED = 8
#
# グラフィックスアレイå¼ã‚µã‚¤ã‚ºè¨å®š
#
GA = Rect.new(-192, -144, 1024, 768) # XGA サイズ
#GA = Rect.new( 0, - 0, 640, 480) # VGA サイズ
end
#------------------------------------------------------------------------------
#
#
#
# â–½ å¯å‹•ã‚«ãƒ¡ãƒ© システム▽
#
#
#
#==============================================================================
# â–¡ XCam
#------------------------------------------------------------------------------
# å¯å‹•ã‚«ãƒ¡ãƒ©ã‚’扱ã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚
#==============================================================================
class XCam
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :x
attr_reader :y
attr_reader :z
attr_accessor :x_destination
attr_accessor :y_destination
attr_accessor :z_destination
attr_accessor :watch_battler
attr_accessor :wait_count
#--------------------------------------------------------------------------
# â—‹ オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
# カメラåˆæœŸä½ç½®æ±ºå®š
@x = 320
@y = 240
@z = 295
# カメラ:センタリング
self.centering
# åˆæœŸåŒ–
@wait_count = 0
end
#--------------------------------------------------------------------------
# ○ フレーム更新
#--------------------------------------------------------------------------
def update
@moved = false
# カメラä½ç½®ã®æ›´æ–°
if @wait_count > 0
# ウェイトカウントを減らã™
@wait_count -= 1
else
# スピードã®å–å¾—
speed = XRXS_BP8::SPEED
#
# カメラ: Z 座標 (優先)
#
z_dest = @z_destination
if @z != z_dest
if @z < z_dest
distance = [(z_dest - @z)/speed, 1].max
else
distance = [(z_dest - @z)/speed, -1].min
end
@z = [[@z + distance, 74].max, 296].min
@moved = true
end
#
# カメラ: X 座標
#
x_dest = @watch_battler == nil ? @x_destination : @watch_battler.x
if @x != x_dest
if (@x - x_dest).abs < speed
distance = x_dest - @x
elsif @x < x_dest
distance = [(x_dest - @x)/speed, 8].max
else
distance = [(x_dest - @x)/speed, -8].min
end
maximum = 192 * (296 - @z) / 111 + 320
minimum = 640 - maximum
@x = [[@x + distance, minimum].max, maximum].min
@moved = true
end
#
# カメラ: Y 座標
#
y_dest = @watch_battler == nil ? @y_destination : 88 + @watch_battler.y/2
if @y != y_dest
if (@y - y_dest).abs < speed
distance = y_dest - @y
elsif @y < y_dest
distance = [(y_dest - @y)/speed, 4].max
else
distance = [(y_dest - @y)/speed, -4].min
end
maximum = 164 * (296 - @z) / 111 + 240
minimum = 480 - maximum
@y = [[@y + distance, minimum].max, maximum].min
@moved = true
end
end
end
#--------------------------------------------------------------------------
# â—‹ å‹•ã„ãŸã‹ã©ã†ã‹ï¼Ÿ
#--------------------------------------------------------------------------
def moved?
return @moved
end
#--------------------------------------------------------------------------
# ○ センタリング
#--------------------------------------------------------------------------
def centering
@watch_battler = nil
@x_destination = 320
@y_destination = 240
@z_destination = 185
end
#--------------------------------------------------------------------------
# ○ 注目
#--------------------------------------------------------------------------
def watch(battler)
@watch_battler = battler
@z_destination = 176
end
#--------------------------------------------------------------------------
# ○ ズームアウト
#--------------------------------------------------------------------------
def zoomout
@z_destination = 222
end
#--------------------------------------------------------------------------
# â—‹ 指定 X ä½ç½®ã‚’注目
#--------------------------------------------------------------------------
def watch_at(x)
@watch_battler = nil
@x_destination = x
@y_destination = 240
@z_destination = 185
end
end
#==============================================================================
# â– Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ○ 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :x # ãƒãƒˆãƒ«ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã€€æ¨ªã€€ä½ç½®(+ãŒå³ã€€)
attr_reader :y # ãƒãƒˆãƒ«ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ 高㕠ä½ç½®(+ãŒä¸‹ã€€)
attr_reader :z # ãƒãƒˆãƒ«ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰å¥¥è¡Œãä½ç½®(+ãŒæ‰‹å‰)
attr_accessor :zoom # ç¾åœ¨ã®ã‚ºãƒ¼ãƒ å€çŽ‡
#--------------------------------------------------------------------------
# â—‹ ãƒãƒˆãƒ«ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ä¸Šã«å±…ã‚‹ã‹ï¼Ÿ
#--------------------------------------------------------------------------
def in_battlefield?
return false
end
end
#==============================================================================
# â– Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# â—‹ ãƒãƒˆãƒ«ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ä¸Šã«å±…ã‚‹ã‹ï¼Ÿ [オーãƒãƒ¼ãƒ©ã‚¤ãƒ‰]
#--------------------------------------------------------------------------
def in_battlefield?
return true
end
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
alias xrxs_bp8_initialize initialize
def initialize(troop_id, member_index)
@x = $data_troops[troop_id].members[member_index].x
@y = $data_troops[troop_id].members[member_index].y
@z = 0
@zoom = 1.00
# 呼ã³æˆ»ã™
xrxs_bp8_initialize(troop_id, member_index)
end
#--------------------------------------------------------------------------
# â— ãƒãƒˆãƒ«ç”»é¢ X 座標ã®å–å¾—
#--------------------------------------------------------------------------
alias xrxs_bp8_screen_x screen_x
def screen_x
return xrxs_bp8_screen_x if $xcam == nil
return 320 + (xrxs_bp8_screen_x - $xcam.x) * self.zoom
end
#--------------------------------------------------------------------------
# â— ãƒãƒˆãƒ«ç”»é¢ Y 座標ã®å–å¾—
#--------------------------------------------------------------------------
alias xrxs_bp8_screen_y screen_y
def screen_y
return xrxs_bp8_screen_y if $xcam == nil
return 240 + (xrxs_bp8_screen_y - $xcam.y) * self.zoom
end
end
#==============================================================================
# â– Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# â—‹ フレーム更新 (å¯å‹•ã‚«ãƒ¡ãƒ©)
#--------------------------------------------------------------------------
def update_xcam
# カメラä½ç½®ãŒå‹•ã„ãŸå ´åˆ
if $xcam.moved?
# カメラä½ç½®ã‹ã‚‰ã‚ºãƒ¼ãƒ 率を計算
zoom = 1.00 * 185 / $xcam.z
# 背景ã®è¨å®šæ›´æ–°
@battleback_sprite.zoom_x = zoom
@battleback_sprite.zoom_y = zoom
@battleback_sprite.x = -($xcam.x - 320) * zoom - 512 * (zoom - 1)
@battleback_sprite.y = -($xcam.y - 240) * zoom - 384 * (zoom - 1)
end
end
end
#==============================================================================
# --- ãƒãƒˆãƒ©ãƒ¼ã‚¹ãƒ—ライトå¯å‹•ã‚«ãƒ¡ãƒ©ã‚ºãƒ¼ãƒ 対応 モジュール ---
#==============================================================================
module XRXS_Cam_Deal
def update
# 呼ã³æˆ»ã™
super
# ãƒãƒˆãƒ©ãƒ¼ãŒ nil ã®å ´åˆã¯çµ‚了
return if @battler == nil
# ãƒãƒˆãƒ«ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã«ã„ãªã„å ´åˆã‚‚終了
return unless @battler.in_battlefield?
# カメラãŒå˜åœ¨ã—ãªã„å ´åˆã‚‚終了
return if $xcam == nil
# 例外補æ£
@battler.z = 0 if @battler.z == nil
# ズーム率
zoom = 1.00 * (185 - @battler.z) / ($xcam.z - @battler.z)
self.zoom_x = zoom
self.zoom_y = zoom
@battler.zoom = zoom
# ズーム率ã®å¤‰æ›´ã«ä¼´ã„スプライトã®åº§æ¨™ã‚’å†è¨å®š
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
end
class Sprite_Battler < RPG::Sprite
include XRXS_Cam_Deal
end
#==============================================================================
# --- ダメージフォãƒãƒ¼ モジュール ---
#==============================================================================
module XRXS_DamageFollow
def update
# 呼ã³æˆ»ã™
super
# カメラãŒå˜åœ¨ã—ãªã„å ´åˆ
return if $xcam == nil
# ãƒãƒˆãƒ©ãƒ¼ãŒ nil ã¾ãŸã¯ãƒãƒˆãƒ«ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã«ã„ãªã„å ´åˆ
return if @battler == nil or not @battler.in_battlefield?
# ç›´å‰ã‚«ãƒ¡ãƒ©ä½ç½®ã‹ã‚‰ã€ç§»å‹•é‡ã‚’算出
x_moved = @last_cam_x == nil ? 0 : $xcam.x - @last_cam_x
y_moved = @last_cam_y == nil ? 0 : $xcam.y - @last_cam_y
# ダメージスプライトé…列ã®ä½œæˆ
damage_sprites = [@_damage_sprite]
damage_sprites += @damage_sprites if @damage_sprites != nil
# カメラをフォãƒãƒ¼
for sprite in damage_sprites
next if sprite == nil
next if sprite.disposed?
sprite.x -= x_moved
sprite.y -= y_moved
end
# ç›´å‰ã‚«ãƒ¡ãƒ©ä½ç½®ã®ä¿æŒ
@last_cam_x = $xcam.x
@last_cam_y = $xcam.y
end
end
class Sprite_Battler < RPG::Sprite
include XRXS_DamageFollow
end
#==============================================================================
# â– Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ◠メイン処ç†
#--------------------------------------------------------------------------
alias xrxs_bp8_main main
def main
# å¯å‹•ã‚«ãƒ¡ãƒ©ã®ç”Ÿæˆ
$xcam = XCam.new
# 戻ã™
xrxs_bp8_main
# å¯å‹•ã‚«ãƒ¡ãƒ©ã®è§£æ”¾
$xcam = nil
end
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
alias xrxs_bp8_update update
def update
# å¯å‹•ã‚«ãƒ¡ãƒ©ã®ãƒ•ãƒ¬ãƒ¼ãƒ æ›´æ–°
$xcam.update
# 呼ã³æˆ»ã™
xrxs_bp8_update
end
end
#------------------------------------------------------------------------------
# â–½ å¯å‹•ã‚«ãƒ¡ãƒ©ã®å‹•ãè¨å®š
#==============================================================================
# â– Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ◠パーティコマンドフェーズ開始
#--------------------------------------------------------------------------
alias xrxs_bp8_start_phase2 start_phase2
def start_phase2
# カメラ:センタリング
$xcam.centering
# 呼ã³æˆ»ã™
xrxs_bp8_start_phase2
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (アクターコマンドフェーズ : エãƒãƒŸãƒ¼é¸æŠž)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
def update_phase3_enemy_select
# ç¾åœ¨é¸æŠžä¸ã®ã‚¨ãƒãƒŸãƒ¼ã‚’å–å¾—
enemy = $game_troop.enemies[@enemy_arrow.index]
# カメラ:注目
$xcam.watch_at(enemy.x)
# 戻ã™
xrxs_bp8_update_phase3_enemy_select
end
#--------------------------------------------------------------------------
# ◠エãƒãƒŸãƒ¼é¸æŠžçµ‚了
#--------------------------------------------------------------------------
alias xrxs_bp8_end_enemy_select end_enemy_select
def end_enemy_select
# カメラ:センタリング
$xcam.centering
# 呼ã³æˆ»ã™
xrxs_bp8_end_enemy_select
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase4_step2 update_phase4_step2
def update_phase4_step2
# 戻ã™
xrxs_bp8_update_phase4_step2
# ステップ 3 ã«ç§»è¡Œã™ã‚‹äºˆå®šã®å ´åˆ
if @phase4_step == 3
# アクティブãªãƒãƒˆãƒ©ãƒ¼ãŒãƒãƒˆãƒ«ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã«å±…ã‚‹å ´åˆ
if @active_battler.in_battlefield?
# カメラ:注目
$xcam.watch(@active_battler)
end
end
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (メインフェーズ ステップ 3 : 行動å´ã‚¢ãƒ‹ãƒ¡ãƒ¼ã‚·ãƒ§ãƒ³)
#--------------------------------------------------------------------------
alias xrxs_bp8_update_phase4_step3 update_phase4_step3
def update_phase4_step3
# 戻ã™
xrxs_bp8_update_phase4_step3
# カメラターゲットã¨ãªã‚Šã†ã‚‹ã‚¿ãƒ¼ã‚²ãƒƒãƒˆã® X å¹³å‡å€¤ã‚’計算
x_average = 0
number = 0
cam_target = nil
for target in @target_battlers
if target.in_battlefield?
x_average += target.x
number += 1
cam_target = target
end
end
# カメラターゲットãŒè¦‹ã¤ã‹ã£ãŸå ´åˆ
if number > 0
# ã‚‚ã—対象アニメãŒã€Œä½ç½®ï¼šç”»é¢ã€ã®å ´åˆ
animation = $data_animations[@animation2_id]
if animation != nil and animation.position == 3
# カメラ:センタリング
$xcam.centering
# カメラ:ズームアウト
$xcam.zoomout
elsif number == 1
# カメラ:注目
$xcam.watch(cam_target)
else
# カメラ:指定 X ä½ç½®ã‚’注目
$xcam.watch_at(x_average / number)
end
end
end
#--------------------------------------------------------------------------
# ◠アフターãƒãƒˆãƒ«ãƒ•ã‚§ãƒ¼ã‚ºé–‹å§‹
#--------------------------------------------------------------------------
alias xrxs_bp8_start_phase5 start_phase5
def start_phase5
# カメラ:センタリング
$xcam.centering
# 呼ã³æˆ»ã™
xrxs_bp8_start_phase5
end
end
#------------------------------------------------------------------------------
#
#
#
# ▽ Full-View システム▽
#
#
#
#==============================================================================
# â– Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
alias xrxs_bp8_initialize initialize
def initialize
# 呼ã³æˆ»ã™
xrxs_bp8_initialize
# グラフィックスアレイをå–å¾—
ga = XRXS_BP8::GA
# ビューãƒãƒ¼ãƒˆ 0 を作æˆ
@viewport0 = Viewport.new(ga.x, ga.y, ga.width, ga.height)
@viewport0.z = 0
# ビューãƒãƒ¼ãƒˆ 1 ã®è¨å®šã‚’変更
@viewport1.z += 1
@viewport1.rect.height = 480
# ãƒãƒˆãƒ«ãƒãƒƒã‚¯ã‚¹ãƒ—ライトをå†ä½œæˆ (ビューãƒãƒ¼ãƒˆ 0 を使用)
@battleback_sprite.dispose
@battleback_sprite = Sprite.new(@viewport0)
@battleback_name = ""
# ãƒãƒˆãƒ«ãƒãƒƒã‚¯ã®ãƒ•ãƒ¬ãƒ¼ãƒ æ›´æ–°
update_battleback
end
#--------------------------------------------------------------------------
# ◠解放
#--------------------------------------------------------------------------
alias xrxs_bp8_dispose dispose
def dispose
# 呼ã³æˆ»ã™
xrxs_bp8_dispose
# ビューãƒãƒ¼ãƒˆã‚’解放
@viewport0.dispose
end
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
alias xrxs_bp8_update update
def update
# フレーム更新 (ãƒãƒˆãƒ«ãƒãƒƒã‚¯)
update_battleback
# フレーム更新 (å¯å‹•ã‚«ãƒ¡ãƒ©)
update_xcam if defined? update_xcam
# 呼ã³æˆ»ã™
xrxs_bp8_update
end
#--------------------------------------------------------------------------
# â—‹ フレーム更新 (ãƒãƒˆãƒ«ãƒãƒƒã‚¯)
#--------------------------------------------------------------------------
def update_battleback
# ãƒãƒˆãƒ«ãƒãƒƒã‚¯ã®ãƒ•ã‚¡ã‚¤ãƒ«åãŒç¾åœ¨ã®ã‚‚ã®ã¨é•ã†å ´åˆ
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
# グラフィックスアレイをå–å¾—
ga = XRXS_BP8::GA
# ãƒãƒˆãƒ«ãƒãƒƒã‚¯ã®å–å¾—ã¨æ‹¡å¤§
bg = RPG::Cache.battleback(@battleback_name)
xga = Bitmap.new(ga.width, ga.height)
xga.stretch_blt(xga.rect, bg, bg.rect)
# XGAã‚’ãƒãƒˆãƒ«ãƒãƒƒã‚¯ã«è¨å®š
@battleback_sprite.bitmap = xga
end
end
end
#==============================================================================
# â—‡ RPG::Sprite「戦闘ä¸ã®"ç”»é¢"アニメã®ä½ç½®ä¿®æ£ã€ [å†å®šç¾©]
#==============================================================================
module RPG
class Sprite < ::Sprite
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites[i]
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
sprite.y = 160 # ã“ã®ä¸€è¡Œã ã‘変更
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x - self.ox + self.src_rect.width / 2
sprite.y = self.y - self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
sprite.z = 2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end