The RPG Maker Resource Kit

RMRK RPG Maker Creation => Resources => Topic started by: tmacery on February 11, 2013, 10:35:01 PM

Title: RMVX icons to RMXP
Post by: tmacery on February 11, 2013, 10:35:01 PM
I was wondering if someone could separate this group of icons into single icons. I hope it isn't too much to ask :( I'll leave an attachment of the file.
Title: Re: RMVX icons to RMXP
Post by: XaXaV on February 16, 2013, 01:23:13 PM
I've created a script which splits the IconSet file you decide into separate icons :)
Use it if you want to split another IconSet files :)
I've already split yours. See the attachments :)

Code: [Select]
#==============================================================================#
# * IconSet Splitter (By XaXaV)                                                #
#------------------------------------------------------------------------------#
XXV_IconSplit_Filename = "IconSet" # The file should be in the game directory.
#==============================================================================#
class Bitmap
 
  def print_out(id)
    name = "XSIcon-#{id}"
    File.open("./XSIcons/#{name}.png", "wb") do |f|
      f.write("\211PNG\r\n\032\n" + png_ihdr + png_idat + "\000\000\000\000IEND" + [Zlib.crc32("IEND")].pack('N'))
    end
    return "#{name}.png"
  end
 
  def png_ihdr
    string = "IHDR" + [self.width].pack("N") + [self.height].pack("N") + "\010\006\000\000\000"
    ih_crc = [Zlib.crc32(string)].pack("N")
    return "\000\000\000\r" + string + [Zlib.crc32(string)].pack("N")
  end
 
  def png_idat
    data = Zlib::Deflate.deflate(make_png_data, 8)
    return [data.length].pack("N") + "\x49\x44\x41\x54" + data + [Zlib.crc32("\x49\x44\x41\x54" + data)].pack("N")
  end
 
  def make_png_data
    data = []
    for y in 0...self.height
      data.push(0)
      for x in 0...self.width
        color = self.get_pixel(x, y)
        data.push(color.red, color.green, color.blue, color.alpha)
      end
    end
    string = data.pack("C*")
    data.clear
    return string
  end
 
end
#------------------------------------------------------------------------------#
Dir.mkdir("./XSIcons") rescue nil
$prog = Sprite.new
$prog.bitmap = Bitmap.new(416, 24)
$prog.x = (Graphics.width - 416)/2
$prog.y = (Graphics.height - 24)/2
$prog.bitmap.clear
$ind = 1

iconset = Bitmap.new("./#{XXV_IconSplit_Filename}")
max = ((iconset.width/24)*(iconset.height/24))
for i in 0...max
  Graphics.update
  $prog.bitmap.clear
  $prog.bitmap.draw_text(0, 0, 416, 24, "#{$ind}/#{max}", 1)
  out = Bitmap.new(24, 24)
  src = Rect.new(i % 16 * 24, i / 16 * 24, 24, 24)
  out.blt(0, 0, iconset, src)
  out.print_out(i)
  out.dispose
  $ind += 1
end
$prog.dispose
#==============================================================================#
Title: Re: RMVX icons to RMXP
Post by: tmacery on February 20, 2013, 09:22:00 PM
OMG you are such a huge help. You're like my bestfriend right now lol. Thanks a bunch!  :tpg:
Title: Re: RMVX icons to RMXP
Post by: tmacery on February 21, 2013, 05:55:37 AM
line 46: $prog.x = (Graphics.width - 416)/2

I'm having a problem with this line. :)
Title: Re: RMVX icons to RMXP
Post by: XaXaV on February 21, 2013, 12:31:25 PM
I'm glad to help :)

That error raises because you are maybe using RMXP... Don't you?
If so, change  Graphics.width  with  640  and  Graphics.height  with  480
That should fix it :)
Title: Re: RMVX icons to RMXP
Post by: tmacery on February 21, 2013, 08:16:45 PM
Thanks so much. You are so help! :)
Title: Re: RMVX icons to RMXP
Post by: XaXaV on February 22, 2013, 10:24:08 PM
:) If you need anything else just tell me ;)