查看: 2942|回复: 4

[已经过期] 使用了截图脚本后,如何用脚本读档?

[复制链接]

素材区好人

梦石
5
星屑
12712
在线时间
4359 小时
注册时间
2011-7-21
回帖
2270

超评测参与极短28参与极短27参与极短26参与极短25参与极短24参与极短23参与极短22参与极短21参与

发表于 2017-2-16 00:58:26 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 无忧谷主幻 于 2017-2-16 01:01 编辑

如果输入
  1. Scene_Load2 = Scene_Load.clone
  2. Scene_Load2::Scene_Title = Scene_Map
  3. $scene = Scene_Load2.new
复制代码

很明显取消后不会回到原本的地图中,而是直接回到了标题界面
至于
复制Scene_Load,然后在下面找到$scene = Scene_Title.new给改成$scene = Scene_Map.new的方法,如果在加入截图脚本就会变成这样
存档界面和读档界面就会变成这样
2.jpg
1.jpg
姑且还是放一下脚本?
截图脚本 英顺的马甲
  1. #-----------------------------------------------------------------------------#
  2. # 脚本设定                                                                    #
  3. #-----------------------------------------------------------------------------#
  4. # 说明:                                                                      #
  5. # ①主要采用了Snap To Bitmap这脚本省去了DLL。                                 #
  6. # ②采用了禁术,各位不用到处改脚本了,不过冲突率也大增==                      #
  7. # ③脚本当中采用的脚本归原作者所有。                                          #
  8. # ④设置区域的变量请自行更改。                                                #
  9. #-----------------------------------------------------------------------------#
  10. SaveSettings = Struct.new(:max_save_file,:save_file_dir,:slot_name_format,
  11. :save_help,:load_help,:override_question,:snap_no_found,:no_save_file).new
  12. #-----------------------------------------------------------------------------#
  13. # 设置区域
  14. #-----------------------------------------------------------------------------#
  15. # 最大的存档量
  16. SaveSettings.max_save_file = 20
  17. # 存档所在文件夹
  18. SaveSettings.save_file_dir = "Save/"
  19. # 存档槽的名称的格式,具体请参考sprintf
  20. SaveSettings.slot_name_format = "%03d号存档"
  21. # 存档界面所显示的字符串
  22. SaveSettings.save_help = "要保存哪号存档呢?"
  23. # 读档界面所显示的字符串
  24. SaveSettings.load_help = "要读取哪号存档呢?"
  25. # 需要覆盖存档时所发问的问题
  26. SaveSettings.override_question = "存档已在,是否覆盖?新档替代,莫能重来。"
  27. # 找不到截图时的信息
  28. SaveSettings.snap_no_found = "哎哟,截图找不到啦!你都干了啥啊?"
  29. # 存档槽没有存档时显示的信息
  30. SaveSettings.no_save_file = "这里还没存档喔"

  31. #-----------------------------------------------------------------------------#
  32. # 创建存档文件夹                                                              #
  33. #-----------------------------------------------------------------------------#
  34. Dir.mkdir(SaveSettings.save_file_dir) unless FileTest.directory?(SaveSettings.save_file_dir)

  35. #-----------------------------------------------------------------------------#
  36. # 游戏核心处理类                                                              #
  37. #-----------------------------------------------------------------------------#
  38. class Game_System
  39.   #---------------------------------------------------------------------------#
  40.   # 实例变量                                                                  #
  41.   #---------------------------------------------------------------------------#
  42.   attr_accessor:snap_bitmap
  43. end

  44. #-----------------------------------------------------------------------------#
  45. # 拦截读档与存档界面的打开与地图进入菜单前截图                                #
  46. #-----------------------------------------------------------------------------#
  47. trace_var :$scene do
  48.   if $scene.is_a?(Scene_Save)
  49.     $scene = Scene_Save_Load.new
  50.   elsif $scene.is_a?(Scene_Load)
  51.     $scene = Scene_Save_Load.new(1)
  52.   end
  53.   if $scene.is_a?(Scene_Menu) && $_prev_scene == "Scene_Map" || $game_temp != nil && $game_temp.save_calling
  54.     $game_system.snap_bitmap = Graphics.snap_to_bitmap
  55.   end
  56.   $_prev_scene = $scene.class.name
  57. end

  58. #-----------------------------------------------------------------------------#
  59. # 强改Scene_Title(禁术)                                                       #
  60. #-----------------------------------------------------------------------------#
  61. Scene_Title.class_eval do
  62.   instance_methods(false).each do |meth|
  63.     remove_method(meth)
  64.   end
  65.   def __found_save_file
  66.     for i in 1..SaveSettings.max_save_file
  67.       return true if File.exist?(SaveSettings.save_file_dir + "Save#{i}.rxdata")
  68.     end
  69.     return false
  70.   end
  71. end
  72. for i in 0...$RGSS_SCRIPTS.size
  73.   next if ("Section%03d" % i) == __FILE__
  74.   ary = $RGSS_SCRIPTS[i]
  75.   if ary[3][/class\s+Scene_Title/]
  76.     script = ary[3].clone.gsub(/(if|unless)\s+@continue_enabled/){"#{$1} __found_save_file"}
  77.     eval script, TOPLEVEL_BINDING, ("Section%03d" % i)
  78.   end
  79. end

  80. #-----------------------------------------------------------------------------#
  81. # 存档界面用窗口                                                              #
  82. #-----------------------------------------------------------------------------#
  83. class Window_Save < Window_Base
  84.   #---------------------------------------------------------------------------#
  85.   # 初始化                                                                    #
  86.   #---------------------------------------------------------------------------#
  87.   def initialize
  88.     super(160,64,480,416)
  89.     self.contents = Bitmap.new(width-32,height-32)
  90.     @_index = -1
  91.     refresh(0)
  92.   end
  93.   #---------------------------------------------------------------------------#
  94.   # 刷新                                                                      #
  95.   #---------------------------------------------------------------------------#
  96.   def refresh(index)
  97.     if index != @_index
  98.       # 清除原有资料
  99.       self.contents.clear
  100.       @sprite.dispose if @sprite != nil
  101.       @sprite = nil
  102.       # 开始读取资料
  103.       @file_index = index
  104.       @filename = SaveSettings.save_file_dir + "Save#{@file_index + 1}.rxdata"
  105.       @time_stamp = Time.at(0)
  106.       @file_exist = FileTest.exist?(@filename)
  107.       if @file_exist
  108.         file = File.open(@filename, "r")
  109.         @time_stamp         = file.mtime
  110.         @characters         = Marshal.load(file)
  111.         @frame_count        = Marshal.load(file)
  112.         @game_system        = Marshal.load(file)
  113.         @game_switches      = Marshal.load(file)
  114.         @game_variables     = Marshal.load(file)
  115.         @game_self_switches = Marshal.load(file)
  116.         @game_screen        = Marshal.load(file)
  117.         @game_actors        = Marshal.load(file)
  118.         @game_party         = Marshal.load(file)
  119.         @game_troop         = Marshal.load(file)
  120.         @game_map           = Marshal.load(file)
  121.         [url=home.php?mod=space&uid=14736]@game_player[/url]        = Marshal.load(file)
  122.         @bitmap             = @game_system.snap_bitmap
  123.         @total_sec = @frame_count / Graphics.frame_rate
  124.         file.close
  125.         # 描绘截图的框与影子
  126.         self.contents.fill_rect(34,11,400,300,Color.new(0,0,0))
  127.         self.contents.fill_rect(23,0,402,302,system_color)
  128.         self.contents.fill_rect(24,1,400,300,Color.new(0,0,0,0))
  129.         # 如截图不为空的话
  130.         if @bitmap != nil
  131.           # 描绘截图
  132.           @sprite = Sprite.new
  133.           @sprite.bitmap = @bitmap
  134.           @sprite.x = 160+16+24
  135.           @sprite.y = 64+16+1
  136.           @sprite.zoom_x = @sprite.zoom_y = 0.625
  137.           @sprite.z = 99999
  138.         else
  139.           self.contents.draw_text(0,96,448,32,SaveSettings.snap_no_found,1)
  140.         end
  141.         # 描绘角色
  142.         for i in [url=mailto:0...@characters.size]0...@characters.size[/url]
  143.           x = i*56 + 24
  144.           bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  145.           self.contents.blt(x,328,bitmap,Rect.new(0,0,bitmap.width/4,bitmap.height/4))
  146.         end
  147.         # 描绘游戏时间
  148.         hour = @total_sec / 60 / 60
  149.         min = @total_sec / 60 % 60
  150.         sec = @total_sec % 60
  151.         time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  152.         self.contents.font.color = normal_color
  153.         self.contents.draw_text(0,320,448,32,time_string,2)
  154.         # 描绘时间标记
  155.         self.contents.font.color = normal_color
  156.         time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  157.         self.contents.draw_text(0,352,448,32,time_string, 2)
  158.       else
  159.         self.contents.draw_text(0,320,448,32,SaveSettings.no_save_file,1)
  160.       end
  161.       @_index = index
  162.     end
  163.   end
  164.   #---------------------------------------------------------------------------#
  165.   # 释放                                                                      #
  166.   #---------------------------------------------------------------------------#
  167.   def dispose
  168.     super
  169.     @sprite.dispose if @sprite != nil
  170.     @sprite = nil
  171.   end
  172. end

  173. #-----------------------------------------------------------------------------#
  174. # 存档界面                                                                    #
  175. #-----------------------------------------------------------------------------#
  176. class Scene_Save_Load
  177.   #---------------------------------------------------------------------------#
  178.   # 初始化                                                                    #
  179.   #---------------------------------------------------------------------------#
  180.   def initialize(type=0)
  181.     @type = type == 0 ? "save" : "load"
  182.     case @type
  183.     when "save"
  184.       [url=home.php?mod=space&uid=79957]@WORD[/url] = SaveSettings.save_help
  185.     when "load"
  186.       @word = SaveSettings.load_help
  187.       $game_temp = Game_Temp.new
  188.     end
  189.   end
  190.   #---------------------------------------------------------------------------#
  191.   # 主执行                                                                    #
  192.   #---------------------------------------------------------------------------#
  193.   def main
  194.     # 生成帮助窗口
  195.     @help_window = Window_Help.new
  196.     @help_window.set_text(@word)
  197.     # 选项窗口
  198.     choose = []
  199.     for i in 1..SaveSettings.max_save_file
  200.       choose.push(SaveSettings.slot_name_format % i)
  201.     end
  202.     @command_window = Window_Command.new(160,choose)
  203.     @command_window.height = 416
  204.     @command_window.y = 64
  205.     @command_window.active = true
  206.     # 存档资料窗口
  207.     @save_window = Window_Save.new
  208.     # 确认窗口
  209.     @confirm_window = Window_Base.new(80,176,480,128)
  210.     @confirm_window.contents = Bitmap.new(448,96)
  211.     @confirm_window.contents.draw_text(0,0,448,32,SaveSettings.override_question,1)
  212.     @confirm_window.contents.draw_text(0,64,216,32,"确定",1)
  213.     @confirm_window.contents.draw_text(232,64,216,32,"取消",1)
  214.     @confirm_window.cursor_rect.set(232,64,216,32)
  215.     @confirm_window.z = 999999
  216.     @confirm_window.visible = false
  217.     @confirm_ok = false
  218.     # 执行过渡
  219.     Graphics.transition
  220.     # 主循环
  221.     loop do
  222.       # 刷新游戏画面
  223.       Graphics.update
  224.       # 刷新输入信息
  225.       Input.update
  226.       # 刷新画面
  227.       update
  228.       # 如果画面切换的话的就中断循环
  229.       if $scene != self
  230.         break
  231.       end
  232.     end
  233.     # 准备过渡
  234.     Graphics.freeze
  235.     # 释放窗口
  236.     @help_window.dispose
  237.     @save_window.dispose
  238.     @command_window.dispose
  239.     @confirm_window.dispose
  240.   end
  241.   #---------------------------------------------------------------------------#
  242.   # 刷新                                                                      #
  243.   #---------------------------------------------------------------------------#
  244.   def update
  245.     # 选择存档窗口激活
  246.     unless @confirm_window.visible
  247.       update_command
  248.     else
  249.       update_confirm
  250.     end
  251.   end
  252.   #---------------------------------------------------------------------------#
  253.   # 选择存档窗口刷新                                                          #
  254.   #---------------------------------------------------------------------------#
  255.   def update_command
  256.     @command_window.update
  257.     @save_window.refresh(@command_window.index)
  258.     # 按下取消键
  259.     if Input.trigger?(Input::B)
  260.       case @type
  261.       when "save"
  262.         # 演奏取消 SE
  263.         $game_system.se_play($data_system.cancel_se)
  264.         # 如果被事件调用
  265.         if $game_temp.save_calling
  266.           # 清除存档调用标志
  267.           $game_temp.save_calling = false
  268.           # 切换到地图画面
  269.           $scene = Scene_Map.new
  270.           return
  271.         end
  272.         # 切换到菜单画面
  273.         $scene = Scene_Menu.new(4)
  274.       when "load"
  275.         # 演奏取消 SE
  276.         $game_system.se_play($data_system.cancel_se)
  277.         # 切换到标题画面
  278.         $scene = Scene_Title.new
  279.       end
  280.     end
  281.     # 按下确定键
  282.     if Input.trigger?(Input::C)
  283.       # 计算存档编号
  284.       filename = SaveSettings.save_file_dir + "Save#{@command_window.index+1}.rxdata"
  285.       case @type
  286.       when "save"
  287.         if File.exist?(filename)
  288.           @confirm_window.visible = true
  289.           @confirm_window.cursor_rect.set(232,64,216,32)
  290.           @confirm_ok = false
  291.         else
  292.           process_save
  293.         end
  294.       when "load"
  295.         # 文件不存在的情况下
  296.         unless FileTest.exist?(filename)
  297.           # 演奏冻结 SE
  298.           $game_system.se_play($data_system.buzzer_se)
  299.           return
  300.         end
  301.         # 演奏读档 SE
  302.         $game_system.se_play($data_system.load_se)
  303.         # 写入存档数据
  304.         file = File.open(filename, "rb")
  305.         read_save_data(file)
  306.         file.close
  307.         # 还原 BGM、BGS
  308.         $game_system.bgm_play($game_system.playing_bgm)
  309.         $game_system.bgs_play($game_system.playing_bgs)
  310.         # 执行读档之后的后续处理
  311.         $game_system.on_after_load
  312.         # 刷新地图 (执行并行事件)
  313.         $game_map.update
  314.         # 切换到地图画面
  315.         $scene = Scene_Map.new
  316.       end
  317.     end
  318.   end
  319.   #---------------------------------------------------------------------------#
  320.   # 确认窗口刷新                                                              #
  321.   #---------------------------------------------------------------------------#
  322.   def update_confirm
  323.     @confirm_window.update
  324.     if Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP)
  325.       $game_system.se_play($data_system.cursor_se)
  326.       @confirm_ok = true
  327.     elsif Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN)
  328.       $game_system.se_play($data_system.cursor_se)
  329.       @confirm_ok = false
  330.     elsif Input.trigger?(Input::C)
  331.       $game_system.se_play($data_system.decision_se)
  332.       process_save if @confirm_ok
  333.       @confirm_window.visible = false
  334.     elsif Input.trigger?(Input::B)
  335.       $game_system.se_play($data_system.cancel_se)
  336.       @confirm_window.visible = false
  337.     end
  338.     @confirm_window.cursor_rect.set(232,64,216,32)
  339.     @confirm_window.cursor_rect.set(0,64,216,32) if @confirm_ok
  340.   end
  341.   #---------------------------------------------------------------------------#
  342.   # 执行存档                                                                  #
  343.   #---------------------------------------------------------------------------#
  344.   def process_save
  345.     # 计算存档编号
  346.     filename = SaveSettings.save_file_dir + "Save#{@command_window.index+1}.rxdata"
  347.     # 演奏存档 SE
  348.     $game_system.se_play($data_system.save_se)
  349.     # 写入存档数据
  350.     file = File.open(filename, "wb")
  351.     write_save_data(file)
  352.     file.close
  353.     # 如果被事件调用
  354.     if $game_temp.save_calling
  355.       # 清除存档调用标志
  356.       $game_temp.save_calling = false
  357.       # 切换到地图画面
  358.       $scene = Scene_Map.new
  359.       return
  360.     end
  361.     # 切换到菜单画面
  362.     $scene = Scene_Menu.new(4)
  363.   end
  364.   #---------------------------------------------------------------------------#
  365.   # 存档                                                                      #
  366.   #---------------------------------------------------------------------------#
  367.   def write_save_data(file)
  368.     # 生成描绘存档文件用的角色图形
  369.     characters = []
  370.     for i in 0...$game_party.actors.size
  371.       actor = $game_party.actors[i]
  372.       characters.push([actor.character_name, actor.character_hue])
  373.     end
  374.     # 写入描绘存档文件用的角色数据
  375.     Marshal.dump(characters, file)
  376.     # 写入测量游戏时间用画面计数
  377.     Marshal.dump(Graphics.frame_count, file)
  378.     # 增加 1 次存档次数
  379.     $game_system.save_count += 1
  380.     # 保存魔法编号
  381.     # (将编辑器保存的值以随机值替换)
  382.     $game_system.magic_number = $data_system.magic_number
  383.     # 写入各种游戏对像
  384.     Marshal.dump($game_system, file)
  385.     Marshal.dump($game_switches, file)
  386.     Marshal.dump($game_variables, file)
  387.     Marshal.dump($game_self_switches, file)
  388.     Marshal.dump($game_screen, file)
  389.     Marshal.dump($game_actors, file)
  390.     Marshal.dump($game_party, file)
  391.     Marshal.dump($game_troop, file)
  392.     Marshal.dump($game_map, file)
  393.     Marshal.dump($game_player, file)
  394.   end
  395.   #---------------------------------------------------------------------------#
  396.   # 读档                                                                      #
  397.   #---------------------------------------------------------------------------#
  398.   def read_save_data(file)
  399.     # 读取描绘存档文件用的角色数据
  400.     characters = Marshal.load(file)
  401.     # 读取测量游戏时间用画面计数
  402.     Graphics.frame_count = Marshal.load(file)
  403.     # 读取各种游戏对像
  404.     $game_system        = Marshal.load(file)
  405.     $game_switches      = Marshal.load(file)
  406.     $game_variables     = Marshal.load(file)
  407.     $game_self_switches = Marshal.load(file)
  408.     $game_screen        = Marshal.load(file)
  409.     $game_actors        = Marshal.load(file)
  410.     $game_party         = Marshal.load(file)
  411.     $game_troop         = Marshal.load(file)
  412.     $game_map           = Marshal.load(file)
  413.     $game_player        = Marshal.load(file)
  414.     # 魔法编号与保存时有差异的情况下
  415.     # (加入编辑器的编辑过的数据)
  416.     if $game_system.magic_number != $data_system.magic_number
  417.       # 重新装载地图
  418.       $game_map.setup($game_map.map_id)
  419.       $game_player.center($game_player.x, $game_player.y)
  420.     end
  421.     # 刷新同伴成员
  422.     $game_party.refresh
  423.   end
  424. end

  425. #-----------------------------------------------------------------------------#
  426. # Graphics.snap_to_bitmap(优化版)                                           #
  427. # 作者:神思                                                                  #
  428. # 优化:釣到一隻猴子@_@  (  AAM@_@  )                                         #
  429. # 出处:[url=www.66rpg.com]www.66rpg.com[/url]
  430. #-----------------------------------------------------------------------------#
  431. #-----------------------------------------------------------------------------#
  432. # Graphics                                                                    #
  433. #-----------------------------------------------------------------------------#
  434. class << Graphics
  435.   CreateDC = Win32API.new("gdi32", "CreateDC", "pppl", "l")
  436.   CreateCompatibleBitmap = Win32API.new("gdi32", "CreateCompatibleBitmap", "lll", "l")
  437.   CreateCompatibleDC = Win32API.new("gdi32", "CreateCompatibleDC", "l", "l")
  438.   SelectObject = Win32API.new("gdi32", "SelectObject", "ll", "l")
  439.   BitBlt = Win32API.new("gdi32", "BitBlt", "lllllllll", "l")
  440.   GetBitmapBits = Win32API.new("gdi32", "GetBitmapBits", "llp", "l")
  441.   ScreenToClient = Win32API.new("user32", "ScreenToClient", "ip", "i")
  442.   SRCCOPY = 0xCC0020
  443.   RtlMoveMemory = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  444.   HWnd = Win32API.new("user32", "GetActiveWindow", nil, 'l').call
  445.   DwCount = (640 * 480 * 4) * 2
  446.   @@lpBits = "\000" * DwCount
  447.   #---------------------------------------------------------------------------#
  448.   # snap_to_bitmap                                                            #
  449.   #---------------------------------------------------------------------------#
  450.   def snap_to_bitmap
  451.     width, height = 640,480
  452.     hb = Bitmap.new(width, height)
  453.     rgbs = self.bitmap_data
  454.     len = width * 4
  455.     for y in 0...height
  456.       break if 2*y >= height - 1
  457.       nth1 = y * len
  458.       nth2 = (height - 1 - y) * len
  459.       tStr = rgbs[nth1,len]
  460.       rgbs[nth1, len] = rgbs[nth2, len]
  461.       rgbs[nth2, len] = tStr
  462.     end
  463.     RtlMoveMemory.call(hb.address, rgbs, 640 * 480 * 4)
  464.     return hb
  465.   end
  466.   #---------------------------------------------------------------------------#
  467.   # bitmap_data                                                          #
  468.   #---------------------------------------------------------------------------#
  469.   def bitmap_data
  470.     hScrDC = CreateDC.call("DISPLAY", "", "", 0)
  471.     hMemDC = CreateCompatibleDC.call(hScrDC)
  472.     hBitmap = CreateCompatibleBitmap.call(hScrDC, 640, 480)
  473.     hOldBitmap = SelectObject.call(hMemDC, hBitmap)
  474.     BitBlt.call(hMemDC, xsrc, ysrc, 640*2, 480*2, hScrDC, 0, 0, SRCCOPY)
  475.     hBitmap = SelectObject.call(hMemDC, hOldBitmap)
  476.     GetBitmapBits.call(hBitmap, DwCount, @@lpBits)
  477.     return @@lpBits
  478.   end
  479.   #---------------------------------------------------------------------------#
  480.   # 用户窗口的位置                                                            #
  481.   #---------------------------------------------------------------------------#
  482.   def xsrc
  483.     return self.point[0]
  484.   end
  485.   #---------------------------------------------------------------------------#
  486.   # 用户窗口的位置                                                            #
  487.   #---------------------------------------------------------------------------#
  488.   def ysrc
  489.     return self.point[1]
  490.   end
  491.   #---------------------------------------------------------------------------#
  492.   # 那个点                                                                    #
  493.   #---------------------------------------------------------------------------#
  494.   def point
  495.     point = [0,0].pack("LL")
  496.     ScreenToClient.call(HWnd, point)
  497.     return point.unpack("LL")
  498.   end
  499. end

  500. #-----------------------------------------------------------------------------#
  501. # Font                                                                        #
  502. #-----------------------------------------------------------------------------#
  503. class Font
  504.   #---------------------------------------------------------------------------#
  505.   # marshal_dump                                                              #
  506.   #---------------------------------------------------------------------------#
  507.   def marshal_dump
  508.   end
  509.   #---------------------------------------------------------------------------#
  510.   # marshal_load                                                              #
  511.   #---------------------------------------------------------------------------#
  512.   def marshal_load(obj)
  513.   end
  514. end

  515. #-----------------------------------------------------------------------------#
  516. # Bitmap                                                                      #
  517. #-----------------------------------------------------------------------------#
  518. class Bitmap
  519.   RtlMoveMemory = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  520.   # 传送到内存的API函数
  521.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  522.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  523.   #---------------------------------------------------------------------------#
  524.   # _dump                                                                     #
  525.   #---------------------------------------------------------------------------#
  526.   def _dump(limit)
  527.     data = "rgba" * width * height
  528.     RtlMoveMemory_pi.call(data, address, data.length)
  529.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # 压缩
  530.   end
  531.   #---------------------------------------------------------------------------#
  532.   # _load                                                                     #
  533.   #---------------------------------------------------------------------------#
  534.   def self._load(str)
  535.     w, h, zdata = str.unpack("LLa*")
  536.     b = self.new(w, h)
  537.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  538.     return b
  539.   end
  540.   #---------------------------------------------------------------------------#
  541.   # address                                                                   #
  542.   #---------------------------------------------------------------------------#
  543.   def address
  544.     # [[[bitmap.object_id * 2 + 16] + 8] + 16] == 数据的开头
  545.     buffer, ad = "xxxx", object_id * 2 + 16
  546.     RtlMoveMemory.call(buffer, ad, 4)
  547.     ad = buffer.unpack("L")[0] + 8
  548.     RtlMoveMemory.call(buffer, ad, 4)
  549.     ad = buffer.unpack("L")[0] + 16
  550.     RtlMoveMemory.call(buffer, ad, 4)
  551.     return buffer.unpack("L")[0]
  552.   end
  553. end
复制代码

评分

参与人数 1星屑 +1 收起 理由
哆啦溯 + 1 行走图没显示完

查看全部评分

梦石
0
星屑
14810
在线时间
22090 小时
注册时间
2010-10-24
回帖
302
发表于 2017-2-16 02:35:39 | 显示全部楼层
看完脚本见识到了非常神奇的姿势……
可以试试“$scene = Scene_Save_Load.new”吧,虽然感觉也不对...
噫
回复

使用道具 举报

梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2017-2-16 09:16:07 | 显示全部楼层
按下取消键会回到标题是这里设置的
  1.     # 按下取消键
  2.     if Input.trigger?(Input::B)
  3.       case @type
  4.       when "save"
  5.         # 演奏取消 SE
  6.         $game_system.se_play($data_system.cancel_se)
  7.         # 如果被事件调用
  8.         if $game_temp.save_calling
  9.           # 清除存档调用标志
  10.           $game_temp.save_calling = false
  11.           # 切换到地图画面
  12.           $scene = Scene_Map.new
  13.           return
  14.         end
  15.         # 切换到菜单画面
  16.         $scene = Scene_Menu.new(4)
  17.       when "load"
  18.         # 演奏取消 SE
  19.         $game_system.se_play($data_system.cancel_se)
  20.         # 切换到标题画面
  21.         $scene = Scene_Title.new
  22.       end
  23.     end
复制代码


#############################################################
这个我没试过,你试一下。在脚本执行$game_player.load_cundang(存档编号)
  1.   class Game_Party
  2.     def load_cundang(index)
  3.         filename = SaveSettings.save_file_dir + "Save#{index+1}.rxdata"
  4.         # 演奏读档 SE
  5.         $game_system.se_play($data_system.load_se)
  6.         # 写入存档数据
  7.         file = File.open(filename, "rb")
  8.         read_save_data(file)
  9.         file.close
  10.         # 还原 BGM、BGS
  11.         $game_system.bgm_play($game_system.playing_bgm)
  12.         $game_system.bgs_play($game_system.playing_bgs)
  13.         # 执行读档之后的后续处理
  14.         $game_system.on_after_load
  15.         # 刷新地图 (执行并行事件)
  16.         $game_map.update
  17.         # 切换到地图画面
  18.         $scene = Scene_Map.new
  19.       end
  20.       
  21.       
  22.     def read_save_data(file)
  23.     # 读取描绘存档文件用的角色数据
  24.     characters = Marshal.load(file)
  25.     # 读取测量游戏时间用画面计数
  26.     Graphics.frame_count = Marshal.load(file)
  27.     # 读取各种游戏对像
  28.     $game_system        = Marshal.load(file)
  29.     $game_switches      = Marshal.load(file)
  30.     $game_variables     = Marshal.load(file)
  31.     $game_self_switches = Marshal.load(file)
  32.     $game_screen        = Marshal.load(file)
  33.     $game_actors        = Marshal.load(file)
  34.     $game_party         = Marshal.load(file)
  35.     $game_troop         = Marshal.load(file)
  36.     $game_map           = Marshal.load(file)
  37.     $game_player        = Marshal.load(file)
  38.     # 魔法编号与保存时有差异的情况下
  39.     # (加入编辑器的编辑过的数据)
  40.     if $game_system.magic_number != $data_system.magic_number
  41.       # 重新装载地图
  42.       $game_map.setup($game_map.map_id)
  43.       $game_player.center($game_player.x, $game_player.y)
  44.     end
  45.     # 刷新同伴成员
  46.     $game_party.refresh
  47.   end
  48. end

  49.       end
复制代码

点评

$scene = Scene_Save_Load.new(1)  发表于 2017-2-16 16:51
那个…我的意思是进入读档界面  发表于 2017-2-16 13:02
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部