| 赞 | 3  | 
 
| VIP | 333 | 
 
| 好人卡 | 2 | 
 
| 积分 | 1 | 
 
| 经验 | 1450446 | 
 
| 最后登录 | 2019-5-29 | 
 
| 在线时间 | 615 小时 | 
 
 
 
 
 
Lv1.梦旅人 66RPG站长 
	- 梦石
 - 0 
 
        - 星屑
 - 54 
 
        - 在线时间
 - 615 小时
 
        - 注册时间
 - 2005-10-10
 
        - 帖子
 - 5734
 
 
    
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
VX的动画数据库还是很华丽的,一流华丽,这里提供一个转给XP用户使用的方法。这个算法简单说就是,由于VX使用两张图来制作动画素材,而XP只能用一张,所以我在运算的时候直接把两张图合成为一张图了。此外编号也重调过。如果本来VX两张图的色相有较大诧异可能会转换结果不完美,不过好在默认数据库没有这种情况,就暂时不考虑了。 
 
注,XP转VX的在这里:http://rpg.blue/viewthread.php?tid=72045 
 
我想其他数据库应该没有互转的必要了。应该说,其他的数据库表VX都远胜XP,只要eval(.memo)就可以了。所以我也不转了,有需要时候再说了。 
 
使用方法: 
 
1、在VX完整版中执行脚本段落1,这个过程很慢,大约10多分钟,并且这个过程中必须让窗口焦点保持在运行窗口上,建议吃饭前执行(生成图片速度很慢)。 
 
2、在XP新建一个工程,把刚才生成的vx_ani.6R考到game.exe所在位置,把所有素材图考到Graphics/Animations,再去VX的RTP安装目录把所有声效考过来。 
 
3、在XP工程中执行脚本段落2,瞬间完成。关闭XP工程,重新打开,则所有VX动画可以使用了。 
 
脚本段落1、 
- # 将bitmap对象输出成bmp文件 By MOMOMO
 
 - # 翻译:bbschat 来自:www.66rpg.com
 
 - # 将Bitmap对象
 
 - # 转换成位图文件(24bit)输出。
 
 - #
 
 - # Bmp_File.make_bmp_file(bitmap, name[, path])
 
 - # bitmap:Bitmap对象
 
 - # name:保存文件名
 
 - # path:保存路径
 
 - #
 
 - # 或者,对Bitmap对象直接使用
 
 - # bitmap_obj.make_bmp_file(name[, path])
 
 - # 也可以达成同样的机能。
 
  
 
- module Bmp_File
 
 - module_function
 
 - # 生成BMP文件
 
 - def make_bmp_file(bitmap, name, path="")
 
 -   file_header = make_bmp_file_header(bitmap)
 
 -   info_header = make_bmp_info_header(bitmap)
 
 -   bitmap_data = make_bitmap_data(bitmap)
 
 -   make_dir(path) if path != ""
 
 -   file = File.open(path + name + ".bmp", "wb")
 
 -   file.write(file_header)
 
 -   file.write(info_header)
 
 -   file.write(bitmap_data)
 
 -   file.close
 
 - end
 
 - # 生成保存路径
 
 - def make_dir(path)
 
 -   dir = path.split("/")
 
 -   for i in 0...dir.size
 
 -     unless dir == "."
 
 -       add_dir = dir[0..i].join("/")
 
 -       begin
 
 -         Dir.mkdir(add_dir)
 
 -       rescue
 
 -       end
 
 -     end
 
 -   end
 
 - end
 
 - # 从Bitmap对象中生成文件头
 
 - def make_bmp_file_header(bitmap)
 
 -   bf_type = ["BM"].pack("a2")
 
 -   bf_size = [get_bf_size(bitmap)].pack("L")
 
 -   bf_Reserved1 = [0].pack("S")
 
 -   bf_Reserved2 = [0].pack("S")
 
 -   bf_OffBits = [54].pack("L")
 
 -   
 
 -   file_header = bf_type + bf_size + bf_Reserved1 + bf_Reserved2 + bf_OffBits
 
 -   return file_header
 
 - end
 
 - # 从Bitmap对象中生成情报头
 
 - def make_bmp_info_header(bitmap)
 
 -   bi_size = [40].pack("L")
 
 -   bi_width = [get_bi_width(bitmap)].pack("L")
 
 -   bi_height = [get_bi_height(bitmap)].pack("L")
 
 -   bi_planes = [1].pack("S")
 
 -   bi_bitcount = [24].pack("S")
 
 -   bi_copmression = [0].pack("L")
 
 -   bi_sizeimage = [0].pack("L")
 
 -   bi_x_pixpermeter = [0].pack("L")
 
 -   bi_y_pixpermeter = [0].pack("L")
 
 -   bi_clrused = [0].pack("L")
 
 -   bi_cirimportant = [0].pack("L")
 
 -   
 
 -   info_header = bi_size + bi_width + bi_height + bi_planes + bi_bitcount + 
 
 -                 bi_copmression + bi_sizeimage + bi_x_pixpermeter + 
 
 -                 bi_y_pixpermeter + bi_clrused + bi_cirimportant
 
 -   
 
 -   return info_header
 
 - end
 
 - # 从Bitmap对象中生成图像数据
 
 - def make_bitmap_data(bitmap)
 
 -   w = bitmap.width
 
 -   h = bitmap.height
 
 -   w = (w / 4 + 1) * 4 if w % 4 != 0
 
 -   data = []
 
 -   for y in 0...h
 
 -     for x in 0...w
 
 -       color = bitmap.get_pixel(x, (h - 1) - y)
 
 -       data.push(color.blue)
 
 -       data.push(color.green)
 
 -       data.push(color.red)
 
 -     end
 
 -   end
 
 -   return data.pack("C*")
 
 - end
 
 - def get_bf_size(bitmap)
 
 -   w = bitmap.width
 
 -   w = (w / 4 + 1) * 4 if w % 4 != 0
 
 -   h = bitmap.height
 
 -   return w * h * 3
 
 - end
 
 - def get_bi_width(bitmap)
 
 -   return bitmap.width
 
 - end
 
 - def get_bi_height(bitmap)
 
 -   return bitmap.height
 
 - end
 
 - end
 
 - class Bitmap
 
 - def make_bmp_file(name, path="")
 
 -   Bmp_File.make_bmp_file(self, name, path)
 
 - end
 
 - end
 
 - #==============================================================================
 
 - #               本脚本出自www.66rpg.com,转载请注明。
 
 - #==============================================================================
 
 - =begin
 
 - ==============================================================================
 
 -                         Bitmap to PNG By 轮回者
 
 - ==============================================================================
 
  
-  对Bitmap对象直接使用
 
 -  
 
 -  bitmap_obj.make_png(name[, path])
 
 -  
 
 -  name:保存文件名
 
 -  path:保存路径
 
  
-  感谢66、夏娜、金圭子的提醒和帮助!
 
 -    
 
 - ==============================================================================
 
 - =end
 
  
- module Zlib
 
 -   class Png_File < GzipWriter
 
 -     #--------------------------------------------------------------------------
 
 -     # ● 主处理
 
 -     #-------------------------------------------------------------------------- 
 
 -     def make_png(bitmap_Fx,mode)
 
 -       @mode = mode
 
 -       @bitmap_Fx = bitmap_Fx
 
 -       self.write(make_header)
 
 -       self.write(make_ihdr)
 
 -       self.write(make_idat)
 
 -       self.write(make_iend)
 
 -     end
 
 -     #--------------------------------------------------------------------------
 
 -     # ● PNG文件头数据块
 
 -     #--------------------------------------------------------------------------
 
 -     def make_header
 
 -       return [0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a].pack("C*")
 
 -     end
 
 -     #--------------------------------------------------------------------------
 
 -     # ● PNG文件情报头数据块(IHDR)
 
 -     #-------------------------------------------------------------------------- 
 
 -     def make_ihdr
 
 -       ih_size = [13].pack("N")
 
 -       ih_sign = "IHDR"
 
 -       ih_width = [@bitmap_Fx.width].pack("N")
 
 -       ih_height = [@bitmap_Fx.height].pack("N")
 
 -       ih_bit_depth = [8].pack("C")
 
 -       ih_color_type = [6].pack("C")
 
 -       ih_compression_method = [0].pack("C")
 
 -       ih_filter_method = [0].pack("C")
 
 -       ih_interlace_method = [0].pack("C")
 
 -       string = ih_sign + ih_width + ih_height + ih_bit_depth + ih_color_type +
 
 -                ih_compression_method + ih_filter_method + ih_interlace_method
 
 -       ih_crc = [Zlib.crc32(string)].pack("N")
 
 -       return ih_size + string + ih_crc
 
 -     end
 
 -     #--------------------------------------------------------------------------
 
 -     # ● 生成图像数据(IDAT)
 
 -     #-------------------------------------------------------------------------- 
 
 -     def make_idat
 
 -       header = "\x49\x44\x41\x54"
 
 -       case @mode # 请54~
 
 -       when 1
 
 -         data = make_bitmap_data#1
 
 -       else
 
 -         data = make_bitmap_data
 
 -       end
 
 -       data = Zlib::Deflate.deflate(data, 8)
 
 -       crc = [Zlib.crc32(header + data)].pack("N")
 
 -       size = [data.length].pack("N")
 
 -       return size + header + data + crc
 
 -     end
 
 -     #--------------------------------------------------------------------------
 
 -     # ● 从Bitmap对象中生成图像数据 mode 1(请54~)
 
 -     #-------------------------------------------------------------------------- 
 
 -     def make_bitmap_data1
 
 -       w = @bitmap_Fx.width
 
 -       h = @bitmap_Fx.height
 
 -       data = []
 
 -       for y in 0...h
 
 -         data.push(0)
 
 -         for x in 0...w
 
 -           color = @bitmap_Fx.get_pixel(x, y)
 
 -           red = color.red
 
 -           green = color.green
 
 -           blue = color.blue
 
 -           alpha = color.alpha
 
 -           data.push(red)
 
 -           data.push(green)
 
 -           data.push(blue)
 
 -           data.push(alpha)
 
 -         end
 
 -       end
 
 -       return data.pack("C*")
 
 -     end
 
 -     #--------------------------------------------------------------------------
 
 -     # ● 从Bitmap对象中生成图像数据 mode 0
 
 -     #-------------------------------------------------------------------------- 
 
 -     def make_bitmap_data
 
 -       gz = Zlib::GzipWriter.open('hoge.gz')
 
 -       t_Fx = 0
 
 -       w = @bitmap_Fx.width
 
 -       h = @bitmap_Fx.height
 
 -       data = []
 
 -       for y in 0...h
 
 -         data.push(0)
 
 -         for x in 0...w
 
 -           t_Fx += 1
 
 -           if t_Fx % 10000 == 0
 
 -             Graphics.update
 
 -           end
 
 -           if t_Fx % 100000 == 0
 
 -             s = data.pack("C*")
 
 -             gz.write(s)
 
 -             data.clear
 
 -             #GC.start
 
 -           end
 
 -           color = @bitmap_Fx.get_pixel(x, y)
 
 -           red = color.red
 
 -           green = color.green
 
 -           blue = color.blue
 
 -           alpha = color.alpha
 
 -           data.push(red)
 
 -           data.push(green)
 
 -           data.push(blue)
 
 -           data.push(alpha)
 
 -         end
 
 -       end
 
 -       s = data.pack("C*")
 
 -       gz.write(s)
 
 -       gz.close    
 
 -       data.clear
 
 -       gz = Zlib::GzipReader.open('hoge.gz')
 
 -       data = gz.read
 
 -       gz.close
 
 -       File.delete('hoge.gz') 
 
 -       return data
 
 -     end
 
 -     #--------------------------------------------------------------------------
 
 -     # ● PNG文件尾数据块(IEND)
 
 -     #-------------------------------------------------------------------------- 
 
 -     def make_iend
 
 -       ie_size = [0].pack("N")
 
 -       ie_sign = "IEND"
 
 -       ie_crc = [Zlib.crc32(ie_sign)].pack("N")
 
 -       return ie_size + ie_sign + ie_crc
 
 -     end
 
 -   end
 
 - end
 
 - #==============================================================================
 
 - # ■ Bitmap
 
 - #------------------------------------------------------------------------------
 
 - #  关联到Bitmap。
 
 - #==============================================================================
 
 - class Bitmap
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 关联
 
 -   #-------------------------------------------------------------------------- 
 
 -   def make_png(name="like", path="",mode=0)
 
 -     make_dir(path) if path != ""
 
 -     Zlib::Png_File.open("temp.gz") {|gz|
 
 -       gz.make_png(self,mode)
 
 -     }
 
 -     Zlib::GzipReader.open("temp.gz") {|gz|
 
 -       $read = gz.read
 
 -     }
 
 -     f = File.open(path + name + ".png","wb")
 
 -     f.write($read)
 
 -     f.close
 
 -     File.delete('temp.gz') 
 
 -     end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 生成保存路径
 
 -   #-------------------------------------------------------------------------- 
 
 -   def make_dir(path)
 
 -     dir = path.split("/")
 
 -     for i in 0...dir.size
 
 -       unless dir == "."
 
 -         add_dir = dir[0..i].join("/")
 
 -         begin
 
 -           Dir.mkdir(add_dir)
 
 -         rescue
 
 -         end
 
 -       end
 
 -     end
 
 -   end
 
 - end
 
 - #==============================================================================
 
 - #               本脚本出自www.66rpg.com,转载请注明。
 
 - #==============================================================================
 
 - module RPG
 
 -   class Animation2
 
 -     def initialize
 
 -       @id = 0
 
 -       @name = ""
 
 -       @animation1_name = ""
 
 -       @animation1_hue = 0
 
 -       @animation2_name = ""
 
 -       @animation2_hue = 0
 
 -       @position = 1
 
 -       @frame_max = 1
 
 -       @frames = [RPG::Animation::Frame.new]
 
 -       @timings = []
 
 -     end
 
 -     attr_accessor :id
 
 -     attr_accessor :name
 
 -     attr_accessor :animation_name
 
 -     attr_accessor :animation_hue
 
 -     attr_accessor :position
 
 -     attr_accessor :frame_max
 
 -     attr_accessor :frames
 
 -     attr_accessor :timings                 
 
 -   end
 
 - end
 
  
- module RPG
 
 -   class Animation2
 
 -     class Timing
 
 -       def initialize
 
 -         @frame = 0
 
 -         @se = RPG::SE.new("", 80)
 
 -         @se_name = ""
 
 -         @se_volume = 80
 
 -         @se_pitch = 100
 
 -         @flash_scope = 0
 
 -         @flash_color = Color.new(255,255,255,255)
 
 -         @flash_duration = 5
 
 -       end
 
 -       attr_accessor :frame
 
 -       attr_accessor :se
 
 -       attr_accessor :se_name
 
 -       attr_accessor :se_volume
 
 -       attr_accessor :se_pitch
 
 -       attr_accessor :flash_scope
 
 -       attr_accessor :flash_color
 
 -       attr_accessor :flash_duration
 
 -     end
 
 -   end
 
 - end
 
  
- $data_animations    = load_data("Data/Animations.rvdata")
 
 - $vx_ani = []
 
  
- $sprite = Sprite.new
 
 - $sprite.bitmap = Bitmap.new(500, 400)
 
 - number = 1
 
 - for ani in $data_animations
 
 -   number += 1
 
 -   next if ani==nil 
 
 -   $sprite.bitmap.clear
 
 -   $sprite.bitmap.draw_text(0, 0, 500, 400, number.to_s + " / " + $data_animations.size.to_s, 1)
 
 -   tani = RPG::Animation2.new
 
 -   tani.id = ani.id
 
 -   tani.name = ani.name
 
 -   tani.animation_name = ani.animation1_name+"66RPG"+ani.animation2_name
 
 -   tani.animation_hue = ani.animation1_hue
 
 -   width = 960
 
 -   bmp1 = Cache.animation(ani.animation1_name, ani.animation1_hue)
 
 -   bmp2 = Cache.animation(ani.animation2_name, ani.animation2_hue)
 
 -   height = bmp1.height + bmp2.height
 
 -   bmp = Bitmap.new(width, height)
 
 -   bmp.blt(0, 0, bmp1, bmp1.rect)
 
 -   bmp.blt(0, bmp1.height, bmp2, bmp2.rect)
 
 -   bmp.make_png(ani.animation1_name+"66RPG"+ani.animation2_name)
 
 -   tani.position = ani.position
 
 -   tani.frame_max = ani.frame_max
 
 -   tani.frames = ani.frames
 
 -   for i in 0..15
 
 -     for fram in tani.frames
 
 -       fram.cell_data[i, 0] -= (100 - bmp1.height * 5/ 192) if fram.cell_data[i, 0] != nil and fram.cell_data[i, 0] > 100
 
 -     end
 
 -   end
 
 -   tani.timings = []
 
 -   for timing in ani.timings
 
 -     tm = RPG::Animation2::Timing.new
 
 -     tm.frame = timing.frame
 
 -     tm.se_name = timing.se.name
 
 -     tm.se_volume = timing.se.volume
 
 -     tm.se_pitch = timing.se.pitch
 
 -     tm.flash_scope = timing.flash_scope
 
 -     tm.flash_color = timing.flash_color
 
 -     tm.flash_duration = timing.flash_duration
 
 -     tani.timings.push(tm)
 
 -   end
 
 -   $vx_ani.push(tani)
 
 - end
 
  
- save_data($vx_ani, "vx_ani.6R")
 
 - p "done"
 
  复制代码 
 
脚本段落2: 
- module RPG
 
 -   class Animation2
 
 -     def initialize
 
 -       @id = 0
 
 -       @name = ""
 
 -       @animation1_name = ""
 
 -       @animation1_hue = 0
 
 -       @animation2_name = ""
 
 -       @animation2_hue = 0
 
 -       @position = 1
 
 -       @frame_max = 1
 
 -       @frames = [RPG::Animation::Frame.new]
 
 -       @timings = []
 
 -     end
 
 -     attr_accessor :id
 
 -     attr_accessor :name
 
 -     attr_accessor :animation_name
 
 -     attr_accessor :animation_hue
 
 -     attr_accessor :position
 
 -     attr_accessor :frame_max
 
 -     attr_accessor :frames
 
 -     attr_accessor :timings                 
 
 -   end
 
 - end
 
  
 
- module RPG
 
 -   class SE
 
 -     def initialize(i1, i2)
 
 -       @i1 = i1
 
 -       @i2 = i2
 
 -     end
 
 -   end
 
 - end
 
  
 
- module RPG
 
 -   class Animation2
 
 -     class Timing
 
 -       def initialize
 
 -         @frame = 0
 
 -         @se = RPG::SE.new("", 80)
 
 -         @se_name = ""
 
 -         @se_volume = 80
 
 -         @se_pitch = 100
 
 -         @flash_scope = 0
 
 -         @flash_color = Color.new(255,255,255,255)
 
 -         @flash_duration = 5
 
 -       end
 
 -       attr_accessor :frame
 
 -       attr_accessor :se
 
 -       attr_accessor :se_name
 
 -       attr_accessor :se_volume
 
 -       attr_accessor :se_pitch
 
 -       attr_accessor :flash_scope
 
 -       attr_accessor :flash_color
 
 -       attr_accessor :flash_duration
 
 -     end
 
 -   end
 
 - end
 
  
- $data_animations    = load_data("Data/Animations.rxdata")
 
 - $ani    = load_data("vx_ani.6R")
 
  
- for ani in $ani
 
 -   tani = RPG::Animation.new
 
 -   tani.id = ani.id
 
 -   tani.name = ani.name
 
 -   tani.animation_name = ani.animation_name
 
 -   tani.animation_hue = ani.animation_hue
 
 -   tani.position = ani.position
 
 -   tani.frame_max = ani.frame_max
 
 -   tani.frames = ani.frames
 
 -   tani.timings = []
 
 -   for timing in ani.timings
 
 -     tm = RPG::Animation::Timing.new
 
 -     tm.frame = timing.frame
 
 -     tm.se = RPG::AudioFile.new(timing.se_name, timing.se_volume, timing.se_pitch)
 
 -     tm.flash_scope = timing.flash_scope
 
 -     tm.flash_color = timing.flash_color
 
 -     tm.flash_duration = timing.flash_duration
 
 -     tani.timings.push(tm)
 
 -   end
 
 -   $data_animations.push(tani)
 
 - end
 
  
- save_data($data_animations, "Data/Animations.rxdata")
 
 - p "done"
 
  复制代码 
 
              [本贴由 御灵 于 2008-1-17 23:44:17 进行了编辑] |   
 
 
 
 |