기타

게이지

by 백호 posted Feb 21, 2009
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄
#==============================================================================
# 걾 Game_Actor
#------------------------------------------------------------------------------
# ?귺긏??귩댌궎긏깋긚궳궥갃궞궻긏깋긚궼 Game_Actors 긏깋긚 ($game_actors)
# 궻볙븫궳럊뾭궠귢갂Game_Party 긏깋긚 ($game_party) 궔귞귖랷뤖궠귢귏궥갃
#==============================================================================

class Game_Actor < Game_Battler
  def now_exp
    return @exp - @exp_list[@level]
  end
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
end

#==============================================================================
# 걾 Window_Base
#------------------------------------------------------------------------------
# ?긒??뭷궻궥귊궲궻긂귻깛긤긂궻긚?긬?긏깋긚궳궥갃
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # 걶 HP 긒?긙궻?됪
  #--------------------------------------------------------------------------
  # 긆깏긙긥깑궻HP?됪귩 draw_actor_hp_original 궴뼹멟빾뛛
  alias :draw_actor_hp_original :draw_actor_hp
  def draw_actor_hp(actor, x, y, width = 144)
    # 빾릶rate궸 뙸띪궻HP/MHP귩묆볺
    if actor.maxhp != 0
      rate = actor.hp.to_f / actor.maxhp
    else
      rate = 0
    end
    # plus_x:X띆뷭궻댧뭫뺚맫 rate_x:X띆뷭궻댧뭫뺚맫(%) plus_y:Y띆뷭궻댧뭫뺚맫
    # plus_width:븴궻뺚맫 rate_width:븴궻뺚맫(%) height:뢢븴
    # align1:?됪?귽긵1 0:뜺땗귕 1:뭷돍뫓궑 2:덭땗귕
    # align2:?됪?귽긵2 0:뤵땗귕 1:뭷돍뫓궑 2:돷땗귕
    # align3:긒?긙?귽긵 0:뜺땗귕 1:덭땗귕
    plus_x = 0
    rate_x = 0
    plus_y = 25
    plus_width = 0
    rate_width = 100
    height = 10 # 게이지의 두께
    align1 = 1
    align2 = 2
    align3 = 0
    # 긐깋긢?긘깈깛먠믦 grade1:뗴긒?긙 grade2:렳긒?긙
    # (0:돘궸긐깋긢?긘깈깛 1:뢢궸긐깋긢?긘깈깛 2:롈귕궸긐깋긢?긘깈깛(똽뢣)걂
    grade1 = 1
    grade2 = 0
    # 륡먠믦갃color1:둖쁤갅color2:뭷쁤
    # color3:뗴긒?긙??긏긇깋?갅color4:뗴긒?긙깋귽긣긇깋?
    # color5:렳긒?긙??긏긇깋?갅color6:렳긒?긙깋귽긣긇깋?
    color1 = Color.new(0, 0, 0, 192)
    color2 = Color.new(255, 255, 192, 192)
    color3 = Color.new(0, 0, 0, 192)
    color4 = Color.new(64, 0, 0, 192)
    color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
    color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
    # 빾릶sp궸?됪궥귡긒?긙궻븴귩묆볺
    if actor.maxhp != 0
      hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
    else
      hp = 0
    end
    # 긒?긙궻?됪
    gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
                width, plus_width + width * rate_width / 100,
                height, hp, align1, align2, align3,
                color1, color2, color3, color4, color5, color6, grade1, grade2)
    # 긆깏긙긥깑궻HP?됪룉뿚귩뚁귂뢯궢
    draw_actor_hp_original(actor, x, y, width)
  end
  #--------------------------------------------------------------------------
  # 걶 SP 긒?긙궻?됪
  #--------------------------------------------------------------------------
  # 긆깏긙긥깑궻SP?됪귩 draw_actor_sp_original 궴뼹멟빾뛛
  alias :draw_actor_sp_original :draw_actor_sp
  def draw_actor_sp(actor, x, y, width = 144)
    # 빾릶rate궸 뙸띪궻SP/MSP귩묆볺
    if actor.maxsp != 0
      rate = actor.sp.to_f / actor.maxsp
    else
      rate = 1
    end
    # plus_x:X띆뷭궻댧뭫뺚맫 rate_x:X띆뷭궻댧뭫뺚맫(%) plus_y:Y띆뷭궻댧뭫뺚맫
    # plus_width:븴궻뺚맫 rate_width:븴궻뺚맫(%) height:뢢븴
    # align1:?됪?귽긵1 0:뜺땗귕 1:뭷돍뫓궑 2:덭땗귕
    # align2:?됪?귽긵2 0:뤵땗귕 1:뭷돍뫓궑 2:돷땗귕
    # align3:긒?긙?귽긵 0:뜺땗귕 1:덭땗귕
    plus_x = 0
    rate_x = 0
    plus_y = 25
    plus_width = 0
    rate_width = 100
    height = 10 # 게이지의 두께
    align1 = 1
    align2 = 2
    align3 = 0
    # 긐깋긢?긘깈깛먠믦 grade1:뗴긒?긙 grade2:렳긒?긙
    # (0:돘궸긐깋긢?긘깈깛 1:뢢궸긐깋긢?긘깈깛 2:롈귕궸긐깋긢?긘깈깛(똽뢣)걂
    grade1 = 1
    grade2 = 0
    # 륡먠믦갃color1:둖쁤갅color2:뭷쁤
    # color3:뗴긒?긙??긏긇깋?갅color4:뗴긒?긙깋귽긣긇깋?
    # color5:렳긒?긙??긏긇깋?갅color6:렳긒?긙깋귽긣긇깋?
    color1 = Color.new(0, 0, 0, 192)
    color2 = Color.new(255, 255, 192, 192)
    color3 = Color.new(0, 0, 0, 192)
    color4 = Color.new(0, 64, 0, 192)
    color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
    color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
    # 빾릶sp궸?됪궥귡긒?긙궻븴귩묆볺
    if actor.maxsp != 0
      sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
    else
      sp = (width + plus_width) * rate_width / 100
    end
    # 긒?긙궻?됪
    gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
                width, plus_width + width * rate_width / 100,
                height, sp, align1, align2, align3,
                color1, color2, color3, color4, color5, color6, grade1, grade2)
    # 긆깏긙긥깑궻SP?됪룉뿚귩뚁귂뢯궢
    draw_actor_sp_original(actor, x, y, width)
  end
  #--------------------------------------------------------------------------
  # 걶 EXP 긒?긙궻?됪
  #--------------------------------------------------------------------------
  # 긆깏긙긥깑궻SP?됪귩 draw_actor_sp_original 궴뼹멟빾뛛
  alias :draw_actor_exp_original :draw_actor_exp
  def draw_actor_exp(actor, x, y, width = 204)
    # 빾릶rate궸 뙸띪궻SP/MSP귩묆볺
    if actor.next_exp != 0
      rate = actor.now_exp.to_f / actor.next_exp
    else
      rate = 1
    end
    # plus_x:X띆뷭궻댧뭫뺚맫 rate_x:X띆뷭궻댧뭫뺚맫(%) plus_y:Y띆뷭궻댧뭫뺚맫
    # plus_width:븴궻뺚맫 rate_width:븴궻뺚맫(%) height:뢢븴
    # align1:?됪?귽긵1 0:뜺땗귕 1:뭷돍뫓궑 2:덭땗귕
    # align2:?됪?귽긵2 0:뤵땗귕 1:뭷돍뫓궑 2:돷땗귕
    # align3:긒?긙?귽긵 0:뜺땗귕 1:덭땗귕
    plus_x = 0
    rate_x = 0
    plus_y = 25
    plus_width = 0
    rate_width = 100
    height = 10 # 게이지의 두께
    align1 = 1
    align2 = 2
    align3 = 0
    # 긐깋긢?긘깈깛먠믦 grade1:뗴긒?긙 grade2:렳긒?긙
    # (0:돘궸긐깋긢?긘깈깛 1:뢢궸긐깋긢?긘깈깛 2:롈귕궸긐깋긢?긘깈깛(똽뢣)걂
    grade1 = 1
    grade2 = 0
    # 륡먠믦갃color1:둖쁤갅color2:뭷쁤
    # color3:뗴긒?긙??긏긇깋?갅color4:뗴긒?긙깋귽긣긇깋?
    # color5:렳긒?긙??긏긇깋?갅color6:렳긒?긙깋귽긣긇깋?
    color1 = Color.new(0, 0, 0, 192)
    color2 = Color.new(255, 255, 192, 192)
    color3 = Color.new(0, 0, 0, 192)
    color4 = Color.new(64, 0, 0, 192)
    color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
    color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
    # 빾릶sp궸?됪궥귡긒?긙궻븴귩묆볺
    if actor.next_exp != 0
      exp = (width + plus_width) * actor.now_exp * rate_width /
                                                          100 / actor.next_exp
    else
      exp = (width + plus_width) * rate_width / 100
    end
    # 긒?긙궻?됪
    gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
                width, plus_width + width * rate_width / 100,
                height, exp, align1, align2, align3,
                color1, color2, color3, color4, color5, color6, grade1, grade2)
    # 긆깏긙긥깑궻SP?됪룉뿚귩뚁귂뢯궢
    draw_actor_exp_original(actor, x, y)
  end
  #--------------------------------------------------------------------------
  # 걶 긒?긙궻?됪
  #--------------------------------------------------------------------------
  def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
                color1, color2, color3, color4, color5, color6, grade1, grade2)
    case align1
    when 1
      x += (rect_width - width) / 2
    when 2
      x += rect_width - width
    end
    case align2
    when 1
      y -= height / 2
    when 2
      y -= height
    end
    # 쁤?됪
    self.contents.fill_rect(x, y, width, height, color1)
    self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
    if align3 == 0
      if grade1 == 2
        grade1 = 3
      end
      if grade2 == 2
        grade2 = 3
      end
    end
    if (align3 == 1 and grade1 == 0) or grade1 > 0
      color = color3
      color3 = color4
      color4 = color
    end
    if (align3 == 1 and grade2 == 0) or grade2 > 0
      color = color5
      color5 = color6
      color6 = color
    end
    # 뗴긒?긙궻?됪 뢢궸긐깋긢?긘깈깛?렑
    self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
                                  color3, color4, grade1)
    if align3 == 1
      x += width - gauge
    end
    # HP긒?긙궻?됪
    self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
                                  color5, color6, grade2)
  end
end

#------------------------------------------------------------------------------
# ?Bitmap긏깋긚궸륷궫궶??귩믁돿궢귏궥갃
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # 걶 뗩?귩긐깋긢?긘깈깛?렑
  #    color1 : 긚??긣긇깋?
  #    color2 : 긄깛긤긇깋?
  #    align  :  0:돘궸긐깋긢?긘깈깛
  #              1:뢢궸긐깋긢?긘깈깛
  #              2:롈귕궸긐깋긢?긘깈깛걁똽뢣궸궰궖뭾댰걂
  #--------------------------------------------------------------------------
  def gradation_rect(x, y, width, height, color1, color2, align = 0)
    if align == 0
      for i in x...x + width
        red  = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
        green = color1.green +
                (color2.green - color1.green) * (i - x) / (width - 1)
        blue  = color1.blue +
                (color2.blue - color1.blue) * (i - x) / (width - 1)
        alpha = color1.alpha +
                (color2.alpha - color1.alpha) * (i - x) / (width - 1)
        color = Color.new(red, green, blue, alpha)
        fill_rect(i, y, 1, height, color)
      end
    elsif align == 1
      for i in y...y + height
        red  = color1.red +
                (color2.red - color1.red) * (i - y) / (height - 1)
        green = color1.green +
                (color2.green - color1.green) * (i - y) / (height - 1)
        blue  = color1.blue +
                (color2.blue - color1.blue) * (i - y) / (height - 1)
        alpha = color1.alpha +
                (color2.alpha - color1.alpha) * (i - y) / (height - 1)
        color = Color.new(red, green, blue, alpha)
        fill_rect(x, i, width, 1, color)
      end
    elsif align == 2
      for i in x...x + width
        for j in y...y + height
          red  = color1.red + (color2.red - color1.red) *
                  ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          green = color1.green + (color2.green - color1.green) *
                  ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          blue  = color1.blue + (color2.blue - color1.blue) *
                  ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          alpha = color1.alpha + (color2.alpha - color1.alpha) *
                  ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          color = Color.new(red, green, blue, alpha)
          set_pixel(i, j, color)
        end
      end
    elsif align == 3
      for i in x...x + width
        for j in y...y + height
          red  = color1.red + (color2.red - color1.red) *
                ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          green = color1.green + (color2.green - color1.green) *
                ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          blue  = color1.blue + (color2.blue - color1.blue) *
                ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          alpha = color1.alpha + (color2.alpha - color1.alpha) *
                ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
          color = Color.new(red, green, blue, alpha)
          set_pixel(i, j, color)
        end
      end
    end
  end
end

#==============================================================================
# 걾 Sprite긾긙깄?깑
#------------------------------------------------------------------------------
# ?귺긦긽?긘깈깛궻듖뿚귩뛱궎긾긙깄?깑궳궥갃
#==============================================================================

module RPG
  class Sprite < ::Sprite
    def damage(value, critical)
      dispose_damage
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
        bitmap.font.color.set(176, 255, 144)
      else
        bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
      if critical
        bitmap.font.size = 20
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
      end
      @_damage_sprite = ::Sprite.new
      @_damage_sprite.bitmap = bitmap
      @_damage_sprite.ox = 80 + self.viewport.ox
      @_damage_sprite.oy = 20 + self.viewport.oy
      @_damage_sprite.x = self.x + self.viewport.rect.x
      @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
      @_damage_sprite.z = 3000
      @_damage_duration = 40
    end
    def animation(animation, hit)
      dispose_animation
      @_animation = animation
      return if @_animation == nil
      @_animation_hit = hit
      @_animation_duration = @_animation.frame_max
      animation_name = @_animation.animation_name
      animation_hue = @_animation.animation_hue
      bitmap = RPG::Cache.animation(animation_name, animation_hue)
      if @@_reference_count.include?(bitmap)
        @@_reference_count[bitmap] += 1
      else
        @@_reference_count[bitmap] = 1
      end
      @_animation_sprites = []
      if @_animation.position != 3 or not @@_animations.include?(animation)
        for i in 0..15
          sprite = ::Sprite.new
          sprite.bitmap = bitmap
          sprite.visible = false
          @_animation_sprites.push(sprite)
        end
        unless @@_animations.include?(animation)
          @@_animations.push(animation)
        end
      end
      update_animation
    end
    def loop_animation(animation)
      return if animation == @_loop_animation
      dispose_loop_animation
      @_loop_animation = animation
      return if @_loop_animation == nil
      @_loop_animation_index = 0
      animation_name = @_loop_animation.animation_name
      animation_hue = @_loop_animation.animation_hue
      bitmap = RPG::Cache.animation(animation_name, animation_hue)
      if @@_reference_count.include?(bitmap)
        @@_reference_count[bitmap] += 1
      else
        @@_reference_count[bitmap] = 1
      end
      @_loop_animation_sprites = []
      for i in 0..15
        sprite = ::Sprite.new
        sprite.bitmap = bitmap
        sprite.visible = false
        @_loop_animation_sprites.push(sprite)
      end
      update_loop_animation
    end
    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 = self.viewport.rect.height - 160
          else
            sprite.x = 320
            sprite.y = 240
          end
        else
          sprite.x = self.x + self.viewport.rect.x -
                      self.ox + self.src_rect.width / 2
          sprite.y = self.y + self.viewport.rect.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
그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만그만
또만들어서
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  엑터를 취급하는 클래스입니다. 이 클래스는 Game_Actors 클래스 ($game_actors)
# 의 내부에서 사용되어 Game_Party 클래스 ($game_party)로부터도 참조됩니다.
#==============================================================================

class Game_Actor < Game_Battler
  attr_reader  :exp_list
end
#==============================================================================
# ■ Window_Map_Name
#------------------------------------------------------------------------------
#  マップ名を表示するウィンドウです。
#==============================================================================
class Window_MapGauge < Window_Base
  attr_accessor :actor
  #--------------------------------------------------------------------------
  # ● オブジェクト初期
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 204, 224)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
 
  def set_actor(actor)
    # hp, sp, exp 중 하나라도 변화가 있을 때 업데이트.
    if @actor == nil
      @actor = actor.clone
      self.contents.clear
      draw_actor_class(@actor, 32, 32) #엑터의 클래스를 나타내는 부분, 좌표 x32, y32
      draw_actor_level(@actor, 96, 32) #엑터의 레벨을 나타내는 부분, 좌표 x96, y32
      draw_actor_name(@actor, 4, 0)
      draw_actor_hp(@actor, 0, 64, 172)
      draw_actor_sp(@actor, 0, 96, 172)
      draw_actor_exp(@actor, 0, 128)   
    elsif  actor.hp != @actor.hp or actor.sp != @actor.sp or actor.exp != @actor.exp
      #p "actor.hp", actor.hp,    "@actor.hp", @actor.hp
      @actor = actor.clone
      self.contents.clear
      draw_actor_class(@actor, 32, 32)
      draw_actor_level(@actor, 96, 32)
      draw_actor_name(@actor, 4, 0)
      draw_actor_hp(@actor, 0, 64, 172)
      draw_actor_sp(@actor, 0, 96, 172)
      draw_actor_exp(@actor, 0, 128)   
    end #파라메터가 모두 같을 경우 업데이트 하지 않음으로서 속도를 빠르게 해준다.
  end
end


#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  # ● メイン?理
  #--------------------------------------------------------------------------
alias thdo_main main
  alias thdo_initialize initialize
  def initialize
    @actor_index = 0
    thdo_initialize
  end
  def main
    # 地名ウィンドウを作成
    @mapgaugewindow = Window_MapGauge.new
    @mapgaugewindow.opacity = 0
    # ?す
    thdo_main
    # 地名ウィンドウを解放
    @mapgaugewindow.dispose
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    # 루프
    @mapgaugewindow.set_actor($game_party.actors[@actor_index])
    loop do
      # 맵, interpreter, 플레이어의 순서에 갱신
      # (이 갱신 순서는, 이벤트를 실행하는 조건이 채워지고 있을 때
      #  플레이어에 일순간 이동할 기회를 주지 않는등의 이유로써 중요)
      $game_map.update
      $game_system.map_interpreter.update
      $game_player.update
      # 시스템 (타이머), 화면을 갱신
      $game_system.update
      $game_screen.update
      # 플레이어의 장소 이동중이 아니면 루프를 중단
      unless $game_temp.player_transferring
        break
      end
      # 장소 이동을 실행
      transfer_player
      # 트란지션 처리중의 경우, 루프를 중단
      if $game_temp.transition_processing
        break
      end
    end
    # 스프라이트 세트를 갱신
    @spriteset.update
    # 메세지 윈도우를 갱신
    @message_window.update
    # 게임 오버의 경우
    if $game_temp.gameover
      # 게임 오버 화면으로 전환하고
      $scene = Scene_Gameover.new
      return
    end
    # 타이틀 화면에 되돌리는 경우
    if $game_temp.to_title
      # 타이틀 화면으로 전환하고
      $scene = Scene_Title.new
      return
    end
    # 트란지션 처리중의 경우
    if $game_temp.transition_processing
      # 트란지션 처리중 플래그를 클리어
      $game_temp.transition_processing = false
      # 트란지션 실행
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # 메세지 윈도우 표시중의 경우
    if $game_temp.message_window_showing
      return
    end
    # 엔카운트카운트가 0 으로, 엔카운트리스트가 하늘이 아닌 경우
    if $game_player.encounter_count == 0 and $game_map.encounter_list != []
      # 이벤트 실행중이나 엔카운트 금지중이 아니면
      unless $game_system.map_interpreter.running?  or
            $game_system.encounter_disabled
        # 배틀 호출 플래그를 세트
        $game_temp.battle_calling = true
        $game_temp.battle_can_escape = true
        $game_temp.battle_can_lose = false
        $game_temp.battle_proc = nil
        # 무리를 결정
        n = rand($game_map.encounter_list.size)
        $game_temp.battle_troop_id = $game_map.encounter_list[n]
      end
    end
       
    #다음 엑터에게
    if Input.trigger? (Input::R)
            unless $game_system.map_interpreter.running?  or
            $game_system.menu_disabled
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      @mapgaugewindow.set_actor($game_party.actors[@actor_index])
      end
    end
    #전의 엑터에게
    if Input.trigger? (Input::L)
            unless $game_system.map_interpreter.running?  or
            $game_system.menu_disabled
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      @mapgaugewindow.set_actor($game_party.actors[@actor_index])
      end
    end
#THDO스크립트 종료
    # B 버튼이 밀렸을 경우
    if Input.trigger? (Input::B)
      # 이벤트 실행중이나 메뉴 금지중이 아니면
      unless $game_system.map_interpreter.running?  or
            $game_system.menu_disabled
        # 메뉴 호출 플래그와 SE 연주 플래그를 세트
        $game_temp.menu_calling = true
        $game_temp.menu_beep = true
      end
    end
    # 디버그 모드가 ON 또한 F9 키가 밀리고 있는 경우
    if $DEBUG and Input.press? (Input::F9)
      # 디버그 호출 플래그를 세트
      $game_temp.debug_calling = true
    end
    # 플레이어의 이동중이 아닌 경우
    unless $game_player.moving?
      # 각종 화면의 호출을 실행
      if $game_temp.battle_calling
        call_battle
      elsif $game_temp.shop_calling
        call_shop
      elsif $game_temp.name_calling
        call_name
      elsif $game_temp.menu_calling
        call_menu
      elsif $game_temp.save_calling
        call_save
      elsif $game_temp.debug_calling
        call_debug
      end
    end
  end
end