#============================================================================== # ■ XPの規格のホコグラをVXでも使用する by 貪藻矢射妥← #------------------------------------------------------------------------------ # XPの規格のホコグラをVXでも使用できるようにします。 # # XPのホコグラのファイル名に『!XP』をつけてインポートしてください。 # # ※なお、アクターの歩行グラフィックの部分は表示がおかしくなりますが、それは # 仕様です。 # # また、一瞬だけホコグラの姿勢がオカしくなりますが、それも仕様です。 # (と、いうか、修正出来ない・・・というか、限界・・・) # #============================================================================== # 更新っぽいもの # 2012:03:18 # ・VX規格のキャラチップ表示の際、インデックスが固定されているバグを修正 # ・XP規格のパターン3が表示出来なかったバグを修正 module CHAR_ON_XP XP_WORD="XP" end #============================================================================== # ■ Game_Character #------------------------------------------------------------------------------ # キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event # クラスのスーパークラスとして使用されます。 #============================================================================== class Game_Character #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :change_pattern # 真・パターン attr_accessor :original_pattern # 元のパターン #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_xp initialize def initialize initialize_xp @change_pattern = 0 end #-------------------------------------------------------------------------- # ● 姿勢の矯正 #-------------------------------------------------------------------------- def straighten @original_pattern = @change_pattern @pattern = @change_pattern if @walk_anime or @step_anime @anime_count = 0 end end #============================================================================== # ■ Sprite_Character #------------------------------------------------------------------------------ # キャラクター表示用のスプライトです。Game_Character クラスのインスタンスを # 監視し、スプライトの状態を自動的に変化させます。 #============================================================================== class Sprite_Character < Sprite_Base include CHAR_ON_XP #-------------------------------------------------------------------------- # ● 転送元ビットマップの更新 #-------------------------------------------------------------------------- def update_bitmap if @tile_id != @character.tile_id or @character_name != @character.character_name or @character_index != @character.character_index @tile_id = @character.tile_id @character_name = @character.character_name @character_index = @character.character_index if @tile_id > 0 sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32; sy = @tile_id % 256 / 8 % 16 * 32; self.bitmap = tileset_bitmap(@tile_id) self.src_rect.set(sx, sy, 32, 32) self.ox = 16 self.oy = 32 else self.bitmap = Cache.character(@character_name) sign = @character_name[/^[\!\$]./] if sign != nil and sign.include?('$') @cw = bitmap.width / 3 @ch = bitmap.height / 4 elsif sign != nil and @character_name.include?(XP_WORD) @cw = bitmap.width / 4 @ch = bitmap.height / 4 else @cw = bitmap.width / 12 @ch = bitmap.height / 8 end self.ox = @cw / 2 self.oy = @ch end end end #-------------------------------------------------------------------------- # ● 転送元矩形の更新 #-------------------------------------------------------------------------- def update_src_rect if @tile_id == 0 index = @character.character_index sign = @character_name[/^[\!\$]./] if sign && @character_name.include?(XP_WORD) @character.change_pattern = 0 else @character.change_pattern = 1 end # ツクールVXの仕様上 pattern が 2 を超えることはない pattern = @character.pattern < 3 ? @character.pattern : @character.change_pattern if sign != nil and @character_name.include?(XP_WORD) # XP規格の pattern = 3 はVXでは index = 1, pattern = 0 となる pattern = 3 if index == 1 && pattern == 0 sx = pattern * @cw else sx = (index % 4 * 3 + pattern) * @cw end @character.original_pattern = @character.pattern sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch self.src_rect.set(sx, sy, @cw, @ch) end end end |