Como em um mesmo projeto colocar o SAS e o ARC Engine?

1 Respostas   501 Visualizações

0 Membros e 1 Visitante estão vendo este tópico.

Destructor537

  • *
  • Posts: 52
  • Ouros: 10
  • :3 kawai :3
Tópico criado em: 23/10/2014 às 13:04

Eu estava aqui tentando mexer em um projeto que envolve o SAS e o ARC Engine porem da uma incompatibilidade que no SAS não mostra o ícone da arma.Alguém poderia me ajudar?
Aqui estão os scripts:
Arc engine:
[code]#-------------------------------------------------------------------------------
# * Arc Engine - Platform
#-------------------------------------------------------------------------------
# * By Khas Arcthunder
# * Version: 1.1
# * Released on: 18/10/2013
#
# * Blog: http://arcthunder.blogspot.com
# * Twitter: http://twitter.com/arcthunder
# * Youtube: http://youtube.com/user/darkkhas
#
#-------------------------------------------------------------------------------
# Terms of Use | Termos de Uso
#-------------------------------------------------------------------------------
# * ENGLISH
# Read updated terms of use at http:/arcthunder.blogspot.com
#
# * PORTUGUES
# Leia os termos atualizados em http://arcthunder.blogspot.com
#
#-------------------------------------------------------------------------------
# * Configuration | Configuração
#-------------------------------------------------------------------------------
module Arc_Sound
 
  # Jump SE volume
  # Volume do som de pulo
  Jump_Volume = 80
 
  # Groundpound SE volume
  # Volume do som de groundpound
  Groundpound_Volume = 80
 
  # List of jump sounds, by actor. Use:
  # actor_id => ["sound 1", "sound 2", ...],
 
  # Lista de sons de pulo, por ator. Use:
  # id_do_ator => ["som 1", "som 2", ...],
  Jump = {
  1 => ["Jump1"],
 
  }
 
  # List of groundpound sounds, by actor. Use:
  # actor_id => ["sound 1", "sound 2", ...],
 
  # Lista de sons de groundpound, por ator. Use:
  # id_do_ator => ["som 1", "som 2", ...],
  Groundpound = {
  1 => ["Damage2"],
 
  }
 
  # Don't touch here | Não mexa aqui
  def self.jump
    ary = Jump[$game_party.members[0].id]
    RPG::SE.new(ary[rand(ary.size)],Jump_Volume).play
  end
 
  # Don't touch here | Não mexa aqui
  def self.groundpound
    ary = Groundpound[$game_party.members[0].id]
    RPG::SE.new(ary[rand(ary.size)],Groundpound_Volume).play
  end
end



module Arc_Core
 
  # Gravity constant
  # Constante de gravidade
  Gravity = 0.6
 
  # Insignificant constant
  # Constante insignificante
  Insignificant = 0.9
 
  # Air resistance coefficient
  # Coeficiente de resistência do ar
  Air_Resistance = 4.0
 
  # Body resistance coefficient
  # Coeficiente de resistência do corpo
  Body_Resistance = 35.0
 
  # Body resistance coefficient (running)
  # Coeficiente de resistência do corpo (correndo)
  Running_Resistance = 20.0
 
  # Body resistance coefficient (stopping)
  # Coeficiente de resistência do corpo (parando)
  Stop_Resistance = 90.0
 
  # Jump impulse
  # Impulso do Pulo
  Jump_Impulse = -700.0
 
  # Jump impulse bonus
  # Bonus do impulso do pulo
  Jump_RBonus = -20.0
 
  # Key force
  # Força das teclas
  Key_Force = 50.0
 
  # Surface Tolerance (pixels)
  # Tolerância de superfície (pixels)
  Surface_T = 4
 
  # Wall kick impact center
  # Centro de impacto de chute
  WKick_OY  = 4
 
  # Wall kick Tolerance (pixels)
  # Tolerância de Wall kick (pixels)
  WKick_T = 6
 
  # Wall kick impulse - X axis
  # Impulso do Wall kick - eixo X
  WKick_XImpulse = 800.0
 
  # Wall kick impulse - Y axis
  # Impulso do Wall kick - eixo Y
  WKick_YImpulse = -600.0
 
  # Wall kick deny radius - X
  # Negar Wall kick - raio X
  WKick_XRadius = 8
 
  # Wall kick deny radius - Y
  # Negar Wall kick - raio Y
  WKick_YRadius = 64
 
  # Meter (pixels)
  # Metro (pixels)
  Meter_Size = 20
 
  # Center constant - X
  # Contante de centro - X
  Map_CX = (Graphics.width / 32) / 2.0
 
  # Center constant - Y
  # Contante de centro - Y
  Map_CY = (Graphics.height / 32 + 1) / 2.0
 
  # Screen center constant - X
  # Contante de centro de tela - X
  Screen_CX = 272
 
  # Screen center constant - Y
  # Contante de centro de tela - Y
  Screen_CY = 208
 
  # Screen Tiles - X
  # Tiles na tela - X
  Screen_TX = Graphics.width / 32
 
  # Screen Tiles - Y
  # Tiles na tela - Y
  Screen_TY = Graphics.height / 32
 
  # Camera focus - X
  # Foco da camera - X
  Max_SX = 3
 
  # Camera focus - Y
  # Foco da camera - Y
  Max_SY = 3
 
  # Screen constant X
  # Constante de tela X
  On_ScreenX = 384
 
  # Screen constant Y
  # Constante de tela Y
  On_ScreenY = 336
 
  # Maximum AI approach
  # Aproximação de IA máxima
  AI_Approach = 16
 
  # Trigger distance - X
  # Distancia ativa - X
  Trigger_X = 16
 
  # Trigger distance - Y
  # Distancia ativa - Y
  Trigger_Y = 2
 
  # Stair constant
  # Constante de escada
  Stair_OY = 10
 
  # Stair speed
  # Velocidade de escada
  Stair_Speed = 2
 
  # Death switch
  # Switch da morte
  Death_Zone_Switch = 1
 
  # Death zone height
  # Altura da zona de morte
  Death_Zone_Height = 64
 
 
  # Default character height
  # Altura padrão
  Default_Height = 30
 
  # Default character width
  # Largura padrão
  Default_Width = 16
 
  # Default character weight
  # Massa padrão
  Default_Weight = 70
 
  # Axis plus
  # Adicional de eixo
  X_Axis = 16
  Y_Axis = 31
 
  # Collision Height
  # Altura de colisão
  Height_CL = 32
 
  # Zoom Window
  # Janela de zoom
  Enable_Zoom = true
 
  # Disable physics editor?
  # Desabilitar editor físico?
  Disable_Editor = false

#-------------------------------------------------------------------------------
# * Configuration end | Fim da configuração
#-------------------------------------------------------------------------------
 
  AWC = Color.new(240,240,240)
  AWT = Color.new(255,255,255)
  AWB = Color.new(0,0,0,150)
  AWLB = Color.new(50,50,50,150)
  AWA = Color.new(150,255,255)
  AWF = Color.new(200,200,200)
  AWE = Color.new(255,0,0)
  AWH = Color.new(150,255,150)
  AWW = Color.new(50,50,255,150)
  COLORS = {
  0b0 => Color.new(0,0,0,0),
  0b1 => Color.new(255,0,0,200),
  0b100 => Color.new(0,255,0,200)}
  AWST = Color.new(255,255,0,150)
  def self.set_font(bitmap)
    bitmap.font.name = "Arial"
    bitmap.font.size = 14
  end
  TILE_RDG = 0x0
  CUSTOM_RDG = 0x1
  Max_Elevation = 1
end

#-------------------------------------------------------------------------------
# * Input Core (by Khas Arcthunder)
#-------------------------------------------------------------------------------

module Input_Core
  State = Win32API.new('user32','GetKeyState','i','i')
  AsyncState = Win32API.new('user32','GetAsyncKeyState','i','i')
  SystemMetrics = Win32API.new('user32','GetSystemMetrics','i','i')
  GetCursorPos = Win32API.new('user32','GetCursorPos','p','v')
  GetWindowRect = Win32API.new('user32','GetWindowRect','lp','v')
  GameWindow = Win32API.new('user32','FindWindowEx','llpp','i').call(0,0,'RGSS Player',0)
  SM_CYCAPTION = SystemMetrics.call(0x4)
  SM_CXBORDER = SystemMetrics.call(0x5)
  SM_CYBORDER = SystemMetrics.call(0x6)
  SM_CXEDGE = SystemMetrics.call(0x2d)
  SM_CYEDGE = SystemMetrics.call(0x2e)
  Swap = SystemMetrics.call(0x17) != 0x0
  XPLUS = SM_CXBORDER + SM_CXEDGE
  YPLUS = SM_CYBORDER + SM_CYEDGE + SM_CYCAPTION
  Codes = {
  :ML => (Swap ? 2 : 1),
  :MR => (Swap ? 1 : 2),
  :MM => 4,
  :Backspace=> 8,
  :Enter => 13,
  :Shift => 16,
  :Ctrl => 17,
  :CapsLock => 20}
  Letters = {
  :A => 65,
   :B => 66,
   :C => 67,
   :D => 68,
   :E => 69,
   :F => 70,
   :G => 71,
   :H => 72,
   :I => 73,
   :J => 74,
   :K => 75,
   :L => 76,
   :M => 77,
   :N => 78,
   :O => 79,
   :P => 80,
   :Q => 81,
   :R => 82,
   :S => 83,
   :T => 84,
   :U => 85,
   :V => 86,
   :W => 87,
   :X => 88,
   :Y => 89,
   :Z => 90,
  :Underscore => 189}
  LettersTable = {
  :A => ["a","A"],
   :B => ["b","B"],
   :C => ["c","C"],
   :D => ["d","D"],
   :E => ["e","E"],
   :F => ["f","F"],
   :G => ["g","G"],
   :H => ["h","H"],
   :I => ["i","I"],
   :J => ["j","J"],
   :K => ["k","K"],
   :L => ["l","L"],
   :M => ["m","M"],
   :N => ["n","N"],
   :O => ["o","O"],
   :P => ["p","P"],
   :Q => ["q","Q"],
   :R => ["r","R"],
   :S => ["s","S"],
   :T => ["t","T"],
   :U => ["u","U"],
   :V => ["v","V"],
   :W => ["w","W"],
   :X => ["x","X"],
   :Y => ["y","Y"],
   :Z => ["z","Z"],
  :Underscore => ["-","_"]}
  Numbers = {0=>[48,96],1=>[49,97],2=>[50,98],3=>[51,99],4=>[52,100],
  5=>[53,101],6=>[54,102],7=>[55,103],8=>[56,104],9=>[57,105]}
  def self.trigger?(id)
    return AsyncState.call(Codes[id]) & 0b1 == 0b1
  end
  def self.toggled?(id)
    return State.call(Codes[id]) & 0b1 == 0b1
  end
  def self.press?(id)
    return State.call(Codes[id]) & 0x80 == 0x80
  end
  def self.check_number(id)
    return true if AsyncState.call(Numbers[id][0]) & 0b1 == 0b1
    return true if AsyncState.call(Numbers[id][1]) & 0b1 == 0b1
    return false
  end
  def self.any_number?
    for id in 0..9
      return id if AsyncState.call(Numbers[id][0]) & 0b1 == 0b1
      return id if AsyncState.call(Numbers[id][1]) & 0b1 == 0b1
    end
    return nil
  end
  def self.any_letter?
    for key in Letters.keys
      return key if AsyncState.call(Letters[key]) & 0b1 == 0b1
    end
    return nil
  end
  def self.letter_number?
    letter = Input_Core.any_letter?
    return letter if letter != nil
    return Input_Core.any_number?
  end
  def self.mpos
    packed_cp = '00000000'
    packed_wp = '0000000000000000'
    GetWindowRect.call(GameWindow,packed_wp)
    GetCursorPos.call(packed_cp)
    wx, wy = packed_wp.unpack('llll')[0..1]
    mx, my = packed_cp.unpack('ll')
    wx += XPLUS; wy += YPLUS
    return [mx-wx,my-wy]
  end
  def self.refresh_state
    for id in 0..9
      AsyncState.call(Numbers[id][0]) & 0b1 == 0b1
      AsyncState.call(Numbers[id][1]) & 0b1 == 0b1
    end
    for item in Letters.values
      AsyncState.call(item) & 0b1 == 0b1
    end
    for code in Codes.values
      AsyncState.call(code) & 0b1 == 0b1
    end
  end
end

#-------------------------------------------------------------------------------
# * Sprite
#-------------------------------------------------------------------------------

class Sprite
  def ssx(tx,time)
    @ax = self.x
    @dx = (tx.to_f - @ax)/2
    @phase_x = Math::PI
    @speed_x = @phase_x/time
    @sliding_x = true
  end
  def ssy(ty,time)
    @ay = self.y
    @dy = (ty.to_f - @ay)/2
    @phase_y = Math::PI
    @speed_y = @phase_y/time
    @sliding_y = true
  end
  def update_slide
    unless @phase_x.nil?
      @phase_x -= @speed_x
      if @phase_x > 0
        self.x = @ax + @dx*(Math.cos(@phase_x)+1)
      else
        self.x = @ax + @dx*2
        @phase_x = nil
        @sliding_x = false
      end
    end
    unless @phase_y.nil?
      @phase_y -= @speed_y
      if @phase_y > 0
        self.y = @ay + @dy*(Math.cos(@phase_y)+1)
      else
        self.y = @ay + @dy*2
        @phase_y = nil
        @sliding_y = false
      end
    end
  end
  def sliding?
    @sliding_x || @sliding_y
  end
end

#-------------------------------------------------------------------------------
# * Cache
#-------------------------------------------------------------------------------

class << Cache
  def custom_map(filename)
    load_bitmap("Graphics/Custom Maps/", filename)
  end
end

#-------------------------------------------------------------------------------
# * Arc MapCore
#-------------------------------------------------------------------------------

class Arc_MapCore
  include Arc_Core
  attr_reader :height
  attr_accessor :id
  attr_accessor :name
  attr_accessor :mode
  attr_accessor :background
  attr_accessor :main
  attr_accessor :top
  attr_accessor :table
  attr_accessor :water
  attr_accessor :ice
  attr_accessor :stairs
  attr_accessor :surface
  def initialize(i,n,m)
    @name = n
    @mode = m
    @id = i
    @background = ""
    @main = ""
    @top = ""
    @width = 0
    @height = 0
    @bsprite = nil
    @msprite = nil
    @tsprite = nil
    @tbitmap = nil
  end
  def load_sprites(viewport,bz,mz,tz)
    if @background != ""
      @bsprite = Sprite.new(viewport)
      @bsprite.bitmap = Cache.custom_map(@background)
      @bsprite.z = bz
    end
    if @main != ""
      @msprite = Sprite.new(viewport)
      @msprite.bitmap = Cache.custom_map(@main)
      @msprite.z = mz
    end
    if @top != ""
      @tsprite = Sprite.new(viewport)
      @tsprite.bitmap = Cache.custom_map(@top)
      @tsprite.z = tz
    end
  end
  def load_sprites_fe(viewport,bz,mz)
    if @background != ""
      @bsprite = Sprite.new(viewport)
      @bsprite.bitmap = Cache.custom_map(@background)
      @bsprite.z = bz
    end
    if @main != ""
      @msprite = Sprite.new(viewport)
      @msprite.bitmap = Cache.custom_map(@main)
      @msprite.z = mz
    end
  end
  def unload_sprites
    if @bsprite != nil
      @bsprite.dispose
      @bsprite = nil
    end
    if @msprite != nil
      @msprite.dispose
      @msprite = nil
    end
    if @tsprite != nil
      @tsprite.dispose
      @tsprite = nil
    end
  end
  def try_loadbackground
    return true if @background == ""
    test = Cache.custom_map(@background) rescue (return false)
    test.dispose
    test = nil
    return true
  end
  def try_loadmain
    return true if @main == ""
    test = Cache.custom_map(@main) rescue (return false)
    test.dispose
    test = nil
    return true
  end
  def try_loadtop
    return true if @top == ""
    test = Cache.custom_map(@top) rescue (return false)
    test.dispose
    test = nil
    return true
  end
  def compress
    loading = Arc_LWindow.new(0,240)
    loading.change_text("Compressing...")
    loading.enter
    fr = {}
    cl = []
    wr = []
    wl = []
    sr = {}
    psr = []
    pwater = []
    pice = []
    content = []
    rate = (@table.xsize+@table.ysize).to_f/100.0
    for x in 0...@table.xsize
      loading.progress(x/rate)
      fr
  • = []

      for y in 0...@table.ysize
        next if @table[x,y] == 0b0
        if @table[x,y] == 0b100
          if @table[x,y-1] == 0
            psr << [x,y]
          end
          next
        else
          if @table[x,y-1] == 0
            fr
  • << y

          end
          if @table[x,y+1] == 0
            cl << [x,y]
          end
        end
      end
    end
    for y in 0...@table.ysize
      loading.progress((@table.xsize+y)/rate)
      for x in 0...@table.xsize
        next if @table[x,y] != 0b1
        if @table[x-1,y] != 0b1
          wl << [x,y]
        end
        if @table[x+1,y] != 0b1
          wr << [x,y]
        end
      end
    end
    si = 9
    unless fr[0].empty?
      for y in fr[0]
        sr[si] = {}
        sr[si][0] = y
        @table[0,y] = si
        si += 1
      end
    end
    loading.change_text("Optimizing...")
    loading.clear_progress
    rate = fr.size.to_f/100.0
    for x in 1...fr.size
      loading.progress(x/rate)
      next if fr
  • .empty?

      for y in fr

        for i in (-Max_Elevation)..Max_Elevation
          if @table[x-1,y+i] > 6
            @table[x,y] = @table[x-1,y+i]
            sr[@table[x,y]]
  • = y

          end
        end
        next if @table[x,y] > 6
        @table[x,y] = si
        sr[si] = {}
        sr[si]
  • = y

        si += 1
      end
    end
    loading.progress(100)
    loading.change_text("Saving...",AWA)
    10.times do; Graphics.update; end
    content << "{"
    sr.keys.each { |key| content << "#{key.to_s}=>#{sr[key].to_s},"}
    content << "}\n"
    content << cl.to_s
    content << "\n"
    content << wr.to_s
    content << "\n"
    content << wl.to_s
    content << "\n"
    @water.each { |rect| pwater << [rect.x-1,rect.y-1,rect.x+rect.width,rect.y+rect.height]}
    content << pwater.to_s
    content << "\n"
    @ice.each { |rect| pice << [rect.x-1,rect.y-1,rect.x+rect.width,rect.y+rect.height]}
    content << pice.to_s
    content << "\n"
    content << @stairs.to_s
    content << "\n"
    content << psr.to_s
    content << "\n"
    File.open("Data/Arc#{@id}.rgss3a", 'w') {|file| file.write("") }
    content.each { |c| File.open("Data/Arc#{@id}.rgss3a", 'a') {|file| file.write(c) }}
    loading.leave
    loading = nil
  end
  def unload
    @surface = nil
    @table = nil
    @water = nil
    @ice = nil
    @stairs = nil
    unless @tbitmap == nil
      @tbitmapdispose
      @tbitmap = nil
    end
  end
  def load
    time = Time.now
    cl = 0; wr = 0; wl = 0; psr = 0
    cline = 1
    File.open("Data/Arc#{@id}.rgss3a",'r') do |file|
      file.each_line do |line|
        case cline
        when 1
          @surface = eval(line)
        when 2
          cl = eval(line)
        when 3
          wr = eval(line)
        when 4
          wl = eval(line)
        when 5
          @water = eval(line)
        when 6
          @ice = eval(line)
        when 7
          @stairs = eval(line)
        when 8
          psr = eval(line)
        end
        cline += 1
      end
    end
    @table = Table.new(@width,@height+Death_Zone_Height)
    wr.each {|c| @table[c[0],c[1]] = 8}
    wl.each {|c| @table[c[0],c[1]] = 8}
    cl.each {|c| @table[c[0],c[1]] = 8}
    psr.each {|c| @table[c[0],c[1]] = 7}
    @surface.keys.each{|key| @surface[key].keys.each {|c| @table[c,@surface[key][c]] = key}}
    for c in @stairs
      for addx in 0...16
        for addy in 0...16
          @table[c[0]+addx,c[1]+addy] = 1
        end
      end
    end
    print "Map #{@id} loaded in #{Time.now - time} secs\n"
  end
  def scan(map,tileset)
    @water = []
    @ice = []
    @stairs = []
    @mode == 0x1 && @msprite != nil ? scan_pixels : scan_tiles(map,tileset)
  end
  def scan_pixels
    @width = @msprite.width
    @height = @msprite.height
    loading = Arc_LWindow.new(0,240)
    loading.enter
    rate = @msprite.width.to_f/100.0
    @table = Table.new(@msprite.width,@msprite.height) #Collision Table
    @tbitmap = Bitmap.new(@table.xsize,@table.ysize)
    for x in 0...@table.xsize
      loading.progress(x/rate)
      for y in 0...@table.ysize
        next if @msprite.bitmap.get_pixel(x,y).alpha == 0
        @table[x,y] = 0b1
        @tbitmap.set_pixel(x,y,COLORS[0b1])
      end
    end
    loading.leave
    loading = nil
  end
  def scan_tiles(map,tileset)
    @width = map.width*32
    @height = map.height*32
    loading = Arc_LWindow.new(0,240)
    loading.enter
    rate = map.width.to_f/100.0
    @table = Table.new(map.width*32,map.height*32)
    @tbitmap = Bitmap.new(@table.xsize,@table.ysize)
    for x in 0...map.width
      loading.progress(x/rate)
      for y in 0...map.height
        if !check_passage(x,y,map,tileset)
          @tbitmap.fill_rect(x*32,y*32,32,32,COLORS[0b1])
          for ax in 0..31
            for ay in 0..31
              @table[x*32+ax,y*32+ay] = 0b1
            end
          end
        end
      end
    end
    loading.leave
    loading = nil
  end
  def check_passage(x,y,map,tileset)
    ([2,1,0].collect {|z| map.data[x,y,z] || 0 }).each do |tile_id|
      flag = tileset.flags[tile_id]
      next if flag & 0x10 != 0x0
      return true  if flag & 0xf == 0x0
      return false if flag & 0xf == 0xf
    end
    return false
  end
  def get_table_bitmap
    return @tbitmap
  end
  def scroll_x(ax)
    @bsprite.x += ax if @bsprite != nil
    @msprite.x += ax if @msprite != nil
    @tsprite.x += ax if @tsprite != nil
  end
  def scroll_y(ay)
    @bsprite.y += ay if @bsprite != nil
    @msprite.y += ay if @msprite != nil
    @tsprite.y += ay if @tsprite != nil
  end
end

#-------------------------------------------------------------------------------
# * Arc WString
#-------------------------------------------------------------------------------

class Arc_WString
  def initialize(x,y,w,h,text,align,color)
    @x = x
    @y = y
    @w = w
    @h = h
    @text = text
    @align = align
    @color = color
  end
  def draw_at(bitmap)
    bitmap.font.color = @color
    bitmap.draw_text(@x,@y,@w,@h,@text,@align)
  end
end

#-------------------------------------------------------------------------------
# * Arc WItem
#-------------------------------------------------------------------------------

class Arc_WItem
  attr_accessor :active
  def initialize(x,y,w,h,text,align,active)
    @x = x
    @y = y
    @w = w
    @h = h
    @text = text
    @align = align
    @active = active
  end
  def draw_at(bitmap)
    bitmap.font.color = (@active ? Arc_Core::AWA : Arc_Core::AWF)
    bitmap.draw_text(@x,@y,@w,@h,@text,@align)
  end
end

#-------------------------------------------------------------------------------
# * Arc Whr
#-------------------------------------------------------------------------------

class Arc_Whr
  def initialize(y,w)
    @y = y
    @w = w
  end
  def draw_at(bitmap)
    bitmap.fill_rect(3,@y,@w-6,1,Arc_Core::AWC)
  end
end

#-------------------------------------------------------------------------------
# * Arc Window
#-------------------------------------------------------------------------------

class Arc_Window < Sprite
  attr_accessor :input_sensitive
  attr_accessor :is_vertical
  attr_accessor :active_index
  def initialize(x,y,width,height,opacity=0)
    super(nil)
    @input_sensitive = false
    @is_vertical = true
    @active_index = 0
    @contents = []
    @items = []
    self.x = x
    self.y = y
    @w = width
    @h = height
    self.bitmap = Bitmap.new(@w,@h)
    self.opacity = opacity
    Arc_Core.set_font(self.bitmap)
    draw_bg
  end
  def toggle
    @input_sensitive = !@input_sensitive
  end
  def hr(y)
    lh = Arc_Whr.new(y,@w)
    lh.draw_at(self.bitmap)
    @contents << lh
  end
  def draw_bg
    self.bitmap.fill_rect(0,1,@w,@h-2,Arc_Core::AWB)
    self.bitmap.fill_rect(1,0,@w-2,@h,Arc_Core::AWB)
    self.bitmap.fill_rect(2,1,@w-4,1,Arc_Core::AWC)
    self.bitmap.fill_rect(2,@h-2,@w-4,1,Arc_Core::AWC)
    self.bitmap.fill_rect(1,2,1,@h-4,Arc_Core::AWC)
    self.bitmap.fill_rect(@w-2,2,1,@h-4,Arc_Core::AWC)
    self.bitmap.set_pixel(2,2,Arc_Core::AWC)
    self.bitmap.set_pixel(2,@h-3,Arc_Core::AWC)
    self.bitmap.set_pixel(@w-3,2,Arc_Core::AWC)
    self.bitmap.set_pixel(@w-3,@h-3,Arc_Core::AWC)
    @bg = self.bitmap.clone
  end
  def redraw
    self.bitmap.clear
    self.bitmap = @bg.clone
    @contents.each { |ac| ac.draw_at(self.bitmap) }
    @items.each { |ai| ai.draw_at(self.bitmap) }
  end
  def erase_contents
    @contents.clear
    redraw
  end
  def erase_items
    @items.clear
    redraw
  end
  def draw_text(x,y,w,h,text,align=1,color=Arc_Core::AWC)
    w = @w if w == :w
    h = @h if h == :h
    string = Arc_WString.new(x,y,w,h,text,align,color)
    string.draw_at(self.bitmap)
    @contents << string
  end
  def add_item(x,y,w,h,text,align=1,active)
    w = @w if w == :w
    h = @h if h == :h
    item = Arc_WItem.new(x,y,w,h,text,align,active)
    item.draw_at(self.bitmap)
    @items << item
  end
  def update
    update_slide
    if @input_sensitive && @items.size > 0
      if @is_vertical
        if Input.trigger?(:UP)
          next_item(-1)
        elsif Input.trigger?(:DOWN)
          next_item(1)
        end
      else
        if Input.trigger?(:LEFT)
          next_item(-1)
        elsif Input.trigger?(:RIGHT)
          next_item(1)
        end
      end
    end
  end
  def next_item(dir)
    RPG::SE.new("Decision1",70,150).play
    @items.each { |i| i.active = false }
    @active_index += dir
    @active_index %= @items.size
    @items[@active_index].active = true
    redraw
  end
  def dispose
    @bg.dispose
    self.bitmap.dispose
    super
  end
  def draw_32rect(x,y,active)
    self.bitmap.fill_rect(x,y,32,1,active ? Arc_Core::AWA : Arc_Core::AWF)
    self.bitmap.fill_rect(x,y+31,32,1,active ? Arc_Core::AWA : Arc_Core::AWF)
    self.bitmap.fill_rect(x,y+1,1,30,active ? Arc_Core::AWA : Arc_Core::AWF)
    self.bitmap.fill_rect(x+31,y+1,1,30,active ? Arc_Core::AWA : Arc_Core::AWF)
  end
  def draw_icon(x,y,index,active)
    self.bitmap.blt(x,y,Cache.system("Iconset"),Rect.new(index%16*24,index/16*24,24,24),active ? 255 : 160)
  end
  def draw_brush(x,y,id)
    self.bitmap.fill_rect(x,y,32,32,Arc_Core::AWB)
    self.bitmap.blt(x,y,Cache.system("brushes"),Rect.new(id*32,0,32,32))
  end
end

#-------------------------------------------------------------------------------
# * Arc LWindow
#-------------------------------------------------------------------------------

class Arc_LWindow < Sprite
  def initialize(x,y,opacity=0)
    super(nil)
    self.x = x
    self.y = y
    self.z = 1000
    @w = 211
    @h = 56
    @last = 0
    self.ox = 106
    self.oy = 28
    self.bitmap = Bitmap.new(@w,@h)
    self.opacity = opacity
    Arc_Core.set_font(self.bitmap)
    draw_bg
    draw_text(0,4,@w,16," Arc Engine ",1,Arc_Core::AWC)
    draw_text(0,26,@w,16," Loading... ",1,Arc_Core::AWC)
    hr(22)
    loading_bg
  end
  def hr(y)
    Arc_Whr.new(y,@w).draw_at(self.bitmap)
  end
  def change_text(new_text,color=Arc_Core::AWC)
    self.bitmap.fill_rect(4,26,@w-8,16,Arc_Core::AWB)
    draw_text(0,26,@w,16," #{new_text} ",1,color)
  end
  def draw_bg
    self.bitmap.fill_rect(0,1,@w,@h-2,Arc_Core::AWB)
    self.bitmap.fill_rect(1,0,@w-2,@h,Arc_Core::AWB)
    self.bitmap.fill_rect(2,1,@w-4,1,Arc_Core::AWC)
    self.bitmap.fill_rect(2,@h-2,@w-4,1,Arc_Core::AWC)
    self.bitmap.fill_rect(1,2,1,@h-4,Arc_Core::AWC)
    self.bitmap.fill_rect(@w-2,2,1,@h-4,Arc_Core::AWC)
    self.bitmap.set_pixel(2,2,Arc_Core::AWC)
    self.bitmap.set_pixel(2,@h-3,Arc_Core::AWC)
    self.bitmap.set_pixel(@w-3,2,Arc_Core::AWC)
    self.bitmap.set_pixel(@w-3,@h-3,Arc_Core::AWC)
  end
  def draw_text(x,y,w,h,text,align=1,color=Arc_Core::AWC)
    w = @w if w == :w
    h = @h if h == :h
    Arc_WString.new(x,y,w,h,text,align,color).draw_at(self.bitmap)
  end
  def loading_bg
    self.bitmap.fill_rect(5,44,201,1,Arc_Core::AWF)
    self.bitmap.fill_rect(5,49,201,1,Arc_Core::AWF)
    self.bitmap.fill_rect(5,45,1,4,Arc_Core::AWF)
    self.bitmap.fill_rect(205,45,1,4,Arc_Core::AWF)
  end
  def progress(rate)
    return if @last == rate.to_i
    @last = rate.to_i
    for i in 1..@last
      self.bitmap.fill_rect(4+i*2,45,1,4,Arc_Core::AWA)
    end
    Graphics.update
  end
  def clear_progress
    self.bitmap.fill_rect(6,45,199,4,Arc_Core::AWB)
  end
  def dispose
    self.bitmap.dispose
    super
  end
  def enter
    ssx(320,20)
    21.times do
      update_slide
      self.opacity += 13
      Graphics.update
    end
  end
  def leave
    progress(100)
    ssx(640,20)
    21.times do
      update_slide
      self.opacity -= 13
      Graphics.update
    end
    dispose
  end
end

#-------------------------------------------------------------------------------
# * Arc Button
#-------------------------------------------------------------------------------

class Arc_Button < Sprite
  attr_reader :label
  attr_reader :status
  attr_accessor :active
  def initialize(x,y,w,h,label,align,active)
    super(nil)
    self.x = x
    self.y = y
    self.bitmap = Bitmap.new(w,h)
    Arc_Core.set_font(self.bitmap)
    @w = w
    @h = h
    @label = label
    @align = align
    @active = active
    @status = false
  end
  def refresh(mx,my)
    return false unless @active
    @status = (mx >= self.x && mx < (self.x+@w)) && (my >= self.y && my < (self.y+@h))
    redraw
  end
  def redraw
    self.bitmap.clear
    self.bitmap.font.color = (@status ? Arc_Core::AWA : Arc_Core::AWF)
    self.bitmap.draw_text(0,0,@w,@h," #{@label} ",@align)
  end
  def dispose
    self.bitmap.dispose
    super
  end
end

#-------------------------------------------------------------------------------
# * Arc ZR
#-------------------------------------------------------------------------------

class Arc_ZR < Sprite
  attr_reader :rt
  def initialize(viewport)
    super(viewport)
    self.bitmap = Bitmap.new(34,34)
    self.bitmap.fill_rect(0,0,34,1,Color.new(255,255,255))
    self.bitmap.fill_rect(0,33,34,1,Color.new(255,255,255))
    self.bitmap.fill_rect(0,1,1,32,Color.new(255,255,255))
    self.bitmap.fill_rect(33,1,1,32,Color.new(255,255,255))
    self.z = 200
    set_pos(0,0)
  end
  def set_pos(rx,ry)
    self.x = rx - 1
    self.y = ry - 1
    self.x = -1 if self.x < -1
    self.x = 475 if self.x > 475
    self.y = -1 if self.y < -1
    self.y = 339 if self.y > 339
  end
  def dispose
    self.bitmap.dispose
    super
  end
end

#-------------------------------------------------------------------------------
# * Arc Interface
#-------------------------------------------------------------------------------

class Arc_Interface
  include Arc_Core
  def load
    unless try_load
      $map_data = {}
      save
      cmap_dir = Dir::pwd + "/Graphics/Custom Maps"
      unless FileTest::directory?(cmap_dir)
        Dir::mkdir(cmap_dir)
      end
    end
  end
  private
  def save
    File.open("Data/ArcData.rgss3a",'wb') {|file| Marshal.dump($map_data,file)}
  end
  def try_load
    File.open("Data/ArcData.rgss3a",'rb') {|data| $map_data = Marshal.load(data)} rescue (return false)
    return true
  end
  public
  def call_menu
    create_background
    main_menu
    dispose_background
  end
  def main_menu(fi=0)
    open_menu(fi)
    menu_loop
  end
  def menu_loop
    @action = nil
    loop do
      Graphics.update
      Input.update
      @menu_window.update
      @help_window.update
      if @index != @menu_window.active_index
        @index = @menu_window.active_index
        @help_window.erase_contents
        @help_window.draw_text(0,4,:w,16," Descrição ",1,AWT)
        @help_window.hr(22)
        case @index
        when 0
          @help_window.draw_text(4,26,248,16," Executa seu jogo.",0,AWC)
        when 1
          @help_window.draw_text(4,26,248,16," Executa o editor de física",0,AWC)
        when 2
          @help_window.draw_text(4,26,248,16," Arc Engine - Platform v1.0",0,AWT)
          @help_window.draw_text(4,44,248,16," Criada por Khas Arcthunder",0,AWC)
          @help_window.draw_text(4,80,248,16," Visite o blog Arcthunder!",0,AWC)
          @help_window.draw_text(4,98,248,16," http://arcthunder.com",0,AWA)
          @help_window.draw_text(4,116,248,16," http://rgssx.com",0,AWA)
        when 3
          @help_window.draw_text(4,26,248,16," Sair para o RPG Maker.",0,AWC)
        end
      end
      if Input.trigger?(:C)
        case @menu_window.active_index
        when 0
          RPG::SE.new("Decision2",80,100).play
          close_menu
          @action = :launch
          break
        when 1
          RPG::SE.new("Decision2",80,100).play
          close_menu
          @action = :editor
          break
        when 2
          RPG::SE.new("Decision2",80,100).play
          confirm_browser
        when 3
          RPG::SE.new("Decision2",80,100).play
          close_menu
          dispose_background
          exit
        end
      end
    end
    start_physics_editor if @action == :editor
  end
  def open_menu(force_index=0)
    mw = 128; mh = 208; hw = 256; hh = 208
    @menu_window = Arc_Window.new(544,208-mh/2,mw,mh)
    @help_window = Arc_Window.new(-hw,208-hh/2,hw,hh)
    @menu_window.ssx(272-(mw+hw+4)/2,30)
    @help_window.ssx(276-(mw+hw+4)/2+mw,30)
    @menu_window.draw_text(0,4,:w,16," Arc Engine ",1,AWT)
    @help_window.draw_text(0,4,:w,16," Descrição ",1,AWT)
    @menu_window.hr(22)
    @help_window.hr(22)
    @menu_window.add_item(4,26,96,16,"- Jogo",0,force_index == 0)
    @menu_window.add_item(4,44,96,16,"- Editor de Física",0,force_index == 1)
    @menu_window.add_item(4,62,96,16,"- Sobre",0,force_index == 2)
    @menu_window.add_item(4,80,96,16,"- Sair",0,force_index == 3)
    @menu_window.input_sensitive = true
    @menu_window.z = 100
    @help_window.z = 100
    @menu_window.active_index = force_index
    @index = 10
    20.times do
      Graphics.update
      @menu_window.update
      @help_window.update
      @menu_window.opacity += 10
      @help_window.opacity += 10
    end
  end
  def close_menu
    @menu_window.ssx(544,30)
    @help_window.ssx(-256,30)
    20.times do
      Graphics.update
      @menu_window.update
      @help_window.update
      @menu_window.opacity -= 10
      @help_window.opacity -= 10
    end
    @menu_window.dispose
    @help_window.dispose
    @menu_window = nil
    @help_window = nil
  end
  def confirm_browser
    close_menu
    @confirm_window = Arc_Window.new(144,416,256,96)
    @confirm_window.draw_text(0,4,:w,16," Arc Engine ",1,AWT)
    @confirm_window.hr(22)
    @confirm_window.draw_text(4,26,248,16," Pressione ENTER para abrir ou",0,AWC)
    @confirm_window.draw_text(4,44,248,16," X para voltar.",0,AWC)
    @confirm_window.draw_text(4,62,248,16," http://arcthunder.com",0,AWA)
    @confirm_window.ssy(160,20)
    @confirm_window.z = 20
    20.times do
      Graphics.update
      @confirm_window.opacity += 13
      @confirm_window.update
    end
    loop do
      Graphics.update
      Input.update
      @confirm_window.update
      if Input.trigger?(:C)
        RPG::SE.new("Decision2",80,100).play
        system("start http://arcthunder.com")
      elsif Input.trigger?(:B)
        RPG::SE.new("Decision2",80,100).play
        break
      end
    end
    @confirm_window.ssy(416,20)
    20.times do
      Graphics.update
      @confirm_window.opacity -= 13
      @confirm_window.update
    end   
    @confirm_window.dispose
    @confirm_window = nil
    open_menu(2)
  end
  def create_background
    @background = Sprite.new
    @background.bitmap = Bitmap.new(544,416)
    @background.bitmap.fill_rect(0,0,544,416,Color.new(255,255,255))
    @super_background = Sprite.new
    @super_background.bitmap = Bitmap.new(544,416)
    for i in 0...96
      @super_background.bitmap.fill_rect(0,i,544,1,Color.new(0,0,0,96-i))
      @super_background.bitmap.fill_rect(0,415-i,544,1,Color.new(0,0,0,96-i))
    end
    @logo = Sprite.new
    @logo.bitmap = Cache.system("arc")
    @logo.z = 90
    @background.opacity = 0
    @super_background.opacity = 0
    @logo.opacity = 0
    30.times do
      @background.opacity += 9
      @super_background.opacity += 9
      @logo.opacity += 9
      Graphics.update
    end
  end
  def dispose_background
    30.times do
      @background.opacity -= 9
      @super_background.opacity -= 9
      @logo.opacity -= 9
      Graphics.update
    end
    @background.bitmap.dispose
    @background.dispose
    @background = nil
    @super_background.bitmap.dispose
    @super_background.dispose
    @super_background = nil
    @logo.bitmap.dispose
    @logo.dispose
    @logo = nil
  end
  def create_editorbg
    @background = Sprite.new
    @background.bitmap = Bitmap.new(640,480)
    @background.bitmap.fill_rect(0,0,640,480,Color.new(255,255,255))
    @super_background = Sprite.new
    @super_background.bitmap = Bitmap.new(640,480)
    for i in 0...96
      @super_background.bitmap.fill_rect(0,i,640,1,Color.new(0,0,0,96-i))
      @super_background.bitmap.fill_rect(0,479-i,640,1,Color.new(0,0,0,96-i))
    end
    @logo = Sprite.new
    @logo.bitmap = Cache.system("arc")
    @logo.x = 320
    @logo.z = 90
    @logo.ox = 272
    @background.opacity = 0
    @super_background.opacity = 0
    @logo.opacity = 0
    30.times do
      @background.opacity += 9
      @super_background.opacity += 9
      @logo.opacity += 9
      Graphics.update
    end
  end
  def start_physics_editor
    change_resolution
    show_nmw
  end
  def change_resolution
    dispose_background
    Graphics.resize_screen(640,480)
    load_brushes
    create_editorbg
  end
  def restore_resolution
    dispose_background
    Graphics.resize_screen(544,416)
    create_background
  end
  def show_nmw
    @new_window = Arc_Window.new(192,416,256,64)
    @new_window.draw_text(0,4,:w,16," Editor de Física ",1,AWT)
    @new_window.hr(22)
    @new_window.draw_text(4,26,124,16," Selecione o Mapa:",2,AWC)
    @new_window.draw_text(128,26,124,16," Digite o ID ",0,AWA)
    @new_window.ssy(160,20)
    @new_window.z = 20
    20.times do
      Graphics.update
      @new_window.opacity += 13
      @new_window.update
    end
    @map_id = ""
    @action = nil
    @confirm = Arc_Button.new(256,204,64,16," Ok ",1,true)
    @cancel = Arc_Button.new(320,204,64,16," Cancelar ",1,true)
    @confirm.z = 30
    @cancel.z = 30
    Input_Core.refresh_state
    loop do
      Graphics.update
      mpos = Input_Core.mpos
      num = Input_Core.any_number?
      @confirm.refresh(mpos[0],mpos[1])
      @cancel.refresh(mpos[0],mpos[1])
      if num != nil
        @map_id += num.to_s unless @map_id.size > 3
        @new_window.erase_contents
        @new_window.draw_text(0,4,:w,16," Editor de Física ",1,AWT)
        @new_window.hr(22)
        @new_window.draw_text(4,26,124,16," Selecione o Mapa:",2,AWC)
        @new_window.draw_text(128,26,124,16," #{@map_id} ",0,AWA)
      elsif Input_Core.trigger?(:Backspace)
        @map_id[@map_id.size-1] = "" unless @map_id.size < 1
        @new_window.erase_contents
        @new_window.draw_text(0,4,:w,16," Editor de Física ",1,AWT)
        @new_window.hr(22)
        @new_window.draw_text(4,26,124,16," Selecione o Mapa:",2,AWC)
        @new_window.draw_text(128,26,124,16," #{@map_id} ",0,AWA)
      elsif Input_Core.trigger?(:ML)
        if @confirm.status
          if load_map(@map_id.to_i)
            RPG::SE.new("Decision2",80,100).play
            @action = :confirm
            break
          else
            RPG::SE.new("Buzzer1",80,100).play
            @new_window.erase_contents
            @new_window.draw_text(0,4,:w,16," Editor de Física ",1,AWT)
            @new_window.hr(22)
            @new_window.draw_text(4,26,124,16," Selecione o Mapa:",2,AWC)
            @new_window.draw_text(128,26,124,16," Mapa inválido! ",0,AWE)
            @map_id = ""
          end
        elsif @cancel.status
          RPG::SE.new("Decision2",80,100).play
          @action = :cancel
          break
        end
      end
    end
    @confirm.dispose
    @cancel.dispose
    @confirm = nil
    @cancel = nil
    @new_window.ssy(416,20)
    20.times do
      Graphics.update
      @new_window.opacity -= 13
      @new_window.update
    end   
    @new_window.dispose
    @new_window = nil
    if @action == :cancel
      restore_resolution
      @brush_data.clear
      main_menu(1)
    elsif @action == :confirm
      @map_id.to_i
      @mapcore = Arc_MapCore.new(@map_id.to_i,@map.display_name,TILE_RDG)
      create_editor_windows
      @mapcore.scan(@map,@tileset)
      @collision = Sprite.new(@map_viewport)
      @collision.bitmap = @mapcore.get_table_bitmap
      @collision.z = 150
      @areas = Sprite.new(@map_viewport)
      @areas.bitmap = @collision.bitmap.clone
      @areas.bitmap.clear
      @areas.visible = false
      @areas.z = 150
      editor_loop
    end
  end
  def load_map(id)
    @map = load_data(sprintf("Data/Map%03d.rvdata2",id.to_i)) rescue (return false)
    return true
  end
  def select_map_options
    @options_window = Arc_Window.new(192,416,256,156)
    @options_window.draw_text(0,4,:w,16," Map Options ",1,AWT)
    @options_window.hr(22)
    @options_window.draw_text(4,26,248,16," Map ID: #{@mapcore.id}",0,AWC)
    @options_window.draw_text(4,44,248,16," Display Name: #{@mapcore.name == "" ? "No Name" : @mapcore.name}",0,AWC)
    @options_window.draw_text(4,62,248,16," Scan mode: #{@mapcore.mode == 0x0 ? "Default" : "Custom"}",0,AWC)
    @options_window.draw_text(4,80,248,16," Custom Background:",0,AWC)
    @options_window.draw_text(4,98,248,16," Custom Main:",0,AWC)
    @options_window.draw_text(4,116,248,16," Custom Top:",0,AWC)
    @rect = [124,[80,98,116],128,16,316,[222,240,258]]
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][0],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][0],@rect[2],@rect[3]," disabled",2,AWC)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][1],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][1],@rect[2],@rect[3]," disabled",2,AWC)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][2],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][2],@rect[2],@rect[3]," disabled",2,AWC)
    @options_window.ssy(142,20)
    @options_window.z = 20
    20.times do
      Graphics.update
      @options_window.opacity += 13
      @options_window.update
    end
    @help_window = Arc_Window.new(0,0,168,112)
    @help_window.z = 40
    @confirm = Arc_Button.new(256,276,64,16," Scan ",1,true)
    @cancel = Arc_Button.new(320,276,64,16," Cancel ",1,true)
    @confirm.z = 30
    @cancel.z = 30
    @active_input = nil
    Input_Core.refresh_state
    loop do
      Graphics.update
      mpos = Input_Core.mpos
      letter = Input_Core.letter_number?
      @help_window.x = mpos[0]+18
      @help_window.y = mpos[1]+6
      @confirm.refresh(mpos[0],mpos[1])
      @cancel.refresh(mpos[0],mpos[1])
      if mpos[0] > 191 && mpos[0] < 444 && mpos[1] > 203 && mpos[1] < 220
        unless @help_window.active_index == 0
          @help_window.active_index = 0
          @help_window.opacity = 255
          @help_window.erase_contents
          @help_window.draw_text(4,4,160,16," Click to change scan mode.",0,AWH)
          @help_window.draw_text(4,22,160,16," If set to DEFAULT, your map",0,AWH)
          @help_window.draw_text(4,40,160,16," will be scanned by tiles.",0,AWH)
          @help_window.draw_text(4,58,160,16," If set to CUSTOM, your map's",0,AWH)
          @h

"Minha flecha transpassará todos os meus inimigos"

SimonMuran

Resposta 1: 23/10/2014 às 14:12

Mano, usa o spoiler e o botão de código, ta imenso isso ai.