设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4380|回复: 7
打印 上一主题 下一主题

[转载] 现有RPGXP专案改用RGSS2运行库的方法

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1010
在线时间
226 小时
注册时间
2010-4-16
帖子
87
跳转到指定楼层
1
发表于 2011-7-7 17:18:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 as853484572 于 2011-7-7 17:45 编辑

现有RPGXP专案改用RGSS2运行库的方法
2008年08月26日 20:10
引用通告[英文]:
http://rmxp.org/forums/index.php?topic=34903.0
本教程只适合RPGXP1.02a英文版,如果你用的是别的版本的话,下文有专门的说明
本文作者Dargor,我只是翻译而已,适当地插入了一些本人的主观语句。
------------------------------------------------------------------------------------------
首先,你需要手头拥有RPG MAKER VX才行。
RGSS2是RGSS第一代的增强版本,用于RPG MAKER VX。
[快去汉化新世纪下载RPGVX汉化版吧(注意版本是1.02.0824)。]

你希望用RPGXP做出的游戏能达到完美流畅的60fps且不卡机不提示脚本备份么?
你希望直接随心所欲在640*480范围内自定义显示分辨率而不用龙蛇混杂的API么?
你希望在RPGXP中用上RPGVX全新的Graphics模块的功能么?
你希望在RPGXP中实现图像模糊、波形等特效而不用专门用长篇脚本拖慢CPU么?
你还可望在RPGXP上实现别的RGSS2特有的功能么?

本教程专门为你量身定做,
你只需把现有的游戏专案按照下面的几个步骤处理即可。

第一步 - RTP
若你用到了默认的RTP素材,请将这些素材全部拷贝到你的游戏专案目录中。

第二步 - Game.exe可执行文件 和 RGSS2运行库
一)把你的默认的Game.exe换成RPGVX所用的Game.exe
二)把RGSS2运行库RGSS202E.dll拷贝到你的游戏专案文件夹下并重命名为RGSS102E.dll
[RPGXP的娱乐通版和莫尼卡1.02版、1.02日文零售版的用户请重命名为RGSS102J.dll]
[RPGXP的莫尼卡1.03版、1.03日文零售版的用户请重命名为RGSS103J.dll]

第三步 - 脚本
由于RGSS运行库被替换成了RGSS2运行库,所以一切RPGXP的内建类/方法需要重新建立/定义。
一)打开 RPG MAKER XP
二)打开帮助文档 (F1)
三)打开 Script Editor (脚本编辑器)(F11),在所有脚本页之前新建一个脚本页
四)从 RGSS Reference Manual (RGSS脚本参考)复制所有RPG模块的脚本定义至脚本编辑器的方才新建的脚本页中。(确保该脚本页被放在所有默认脚本页的前面)

要紧的废话一句:
英文、日文、日译帮助文档中关于RPG::MoveCommand的脚本定义有误[原RGSS1运行库中的实际定义没有这个错误]。
被写成了这样:
  1. module RPG
  2. class MoveCommand(code = 0, parameters = [])
  3.     def initialize
  4.       @code = code
  5.       @parameters = parameters
  6.     end
  7.     attr_accessor :code
  8.     attr_accessor :parameters
  9. end
  10. end
复制代码
实际上是这样[注意initialize字段]:
  1. module RPG
  2. class MoveCommand
  3.     def initialize(code = 0, parameters = [])
  4.       @code = code
  5.       @parameters = parameters
  6.     end
  7.     attr_accessor :code
  8.     attr_accessor :parameters
  9. end
  10. end
复制代码
看来Enterbrain在RPGXP的马虎方面丝毫不逊色于RPGVX,纯引用某人的话:真该打PP。

五)在脚本编辑器中按Ctrl+Shift+F,搜索“$DEBUG”,全部替换为“$TEST”,严格区分大小写。
六)重定义TILEMAP。
由于帮助文档里关于TILEMAP没有任何代码说明,所以这里借用一下外国网站上的重定义的优化的TILEMAP脚本。
[注意,这里用的是Poccil写的脚本,不要用SephirothSpawn写的脚本,因为RGSS2无法操控大于2048*2048像素的Bitmap对象,这里用SephirothSpawn写的脚本会出现规格大于64*64的地图无法正常加载的问题,而用Poccil的脚本则恰好解决了这个问题]
把下面的脚本插入于之前重定义的RPG对象所在的脚本页之后、Game_Temp脚本页之前。
[原文说的是插入于main脚本之前(中间不间隔任何脚本页),当然按照我说的方法也可以]

  1. class CustomTilemapAutotiles
  2. attr_accessor :changed
  3. def initialize
  4.    @changed=true
  5.    @tiles=[nil,nil,nil,nil,nil,nil,nil]
  6. end
  7. def []=(i,value)
  8.    @tiles[i]=value
  9.    @changed=true
  10. end
  11. def [](i)
  12.    return @tiles[i]
  13. end
  14. end

  15. class Tilemap
  16. Animated_Autotiles_Frames = 15
  17. Autotiles = [
  18.     [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34],
  19.       [27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ],
  20.     [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34],
  21.       [27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ],
  22.     [ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12],
  23.       [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
  24.     [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
  25.       [39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ],
  26.     [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
  27.       [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
  28.     [ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
  29.       [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ]
  30. ]
  31. FlashOpacity=[100,90,80,70,80,90]
  32. attr_reader :tileset
  33. attr_reader :autotiles
  34. attr_reader :map_data
  35. attr_accessor :flash_data
  36. attr_accessor :priorities
  37. attr_reader :visible
  38. attr_accessor :ox
  39. attr_accessor :oy
  40. attr_reader :viewport
  41. def initialize(viewport)
  42.     @tileset    = nil # Refers to Map Tileset Name
  43.     @autotiles = CustomTilemapAutotiles.new
  44.     @map_data   = nil # Refers to 3D Array Of Tile Settings
  45.     @flash_data = nil # Refers to 3D Array of Tile Flashdata
  46.     @priorities = nil # Refers to Tileset Priorities
  47.     @visible    = true # Refers to Tileset Visibleness
  48.     @ox         = 0    # Bitmap Offsets
  49.     @oy         = 0    # bitmap Offsets
  50.     @plane       = false
  51.     @selfviewport=Viewport.new(0,0,640,480)
  52.     @viewport=viewport ? viewport : @selfviewport
  53.     @tiles=[]
  54.     @autotileInfo=[]
  55.     @regularTileInfo=[]
  56.     @oldOx=0
  57.     @oldOy=0
  58.     @layer0=Sprite.new(viewport)
  59.     @layer0.visible=true
  60.     @nowshown=false
  61.     @layer0.bitmap=Bitmap.new(@viewport.rect.width*2,@viewport.rect.height*2)
  62.     @flash=nil
  63.     @layer0.ox=0
  64.     @layer0.oy=0
  65.     @oxLayer0=0
  66.     @oyLayer0=0
  67.     @oxFlash=0
  68.     @oyFlash=0
  69.     @layer0.z=0
  70.     @priotiles=[]
  71.     @prioautotiles=[]
  72.     @autosprites=[]
  73.     @framecount=[]
  74.     @tilesetChanged=true
  75.     @flashChanged=false
  76.     @firsttime=true
  77.     @disposed=false
  78.     @usedsprites=false
  79.     @layer0clip=true
  80.     @firsttimeflash=true
  81.     @fullyrefreshed=false
  82.     @fullyrefreshedautos=false
  83. end
  84. def disposed?
  85.    return @disposed
  86. end
  87. def flash_data=(value)
  88.    @flash_data=value
  89.    @flashChanged=true   
  90. end
  91. def update
  92.     if @autotiles.changed
  93.       refresh_autotiles
  94.       repaintAutotiles
  95.     end
  96.     if @flashChanged
  97.       refresh_flash
  98.     end
  99.     if @tilesetChanged
  100.       refresh_tileset
  101.     end
  102.     if @flash
  103.      @flash.opacity=FlashOpacity[(Graphics.frame_count/2) % 6]
  104.     end
  105.     if !(@oldOx==@ox && @oldOy==@oy &&
  106.            !@tilesetChanged &&
  107.            [email protected])
  108.       refresh
  109.     end
  110.     if (Graphics.frame_count % Animated_Autotiles_Frames == 0) || @nowshown
  111.       repaintAutotiles
  112.       refresh(true)
  113.     end
  114.     @nowshown=false
  115.     @autotiles.changed=false
  116.     @tilesetChanged=false
  117. end
  118. def priorities=(value)
  119. @priorities=value
  120. @tilesetChanged=true
  121. end
  122. def tileset=(value)
  123. @tileset=value
  124. @tilesetChanged=true
  125. end
  126. def shown?
  127.    return false if !@visible
  128.    ysize=@map_data.ysize
  129.    xsize=@map_data.xsize
  130.    xStart=(@ox/32)-1
  131.    xEnd=((@[email protected])/32)+1
  132.    yStart=(@oy/32)-1
  133.    yEnd=((@[email protected])/32)+1
  134.    xStart=0 if xStart<0
  135.    xStart=xsize-1 if xStart>=xsize
  136.    xEnd=0 if xEnd<0
  137.    xEnd=xsize-1 if xEnd>=xsize
  138.    yStart=0 if yStart<0
  139.    yStart=ysize-1 if yStart>=ysize
  140.    yEnd=0 if yEnd<0
  141.    yEnd=ysize-1 if yEnd>=ysize
  142.    return (xStart<xEnd && yStart<yEnd)
  143. end
  144. def dispose
  145. return if disposed?
  146. @help.dispose if @help
  147. @help=nil
  148. i=0;[email protected];while i<len
  149. if @autotileInfo[i]
  150.      @autotileInfo[i].dispose
  151.      @autotileInfo[i]=nil
  152. end
  153. i+=1
  154. end
  155. i=0;[email protected];while i<len
  156. if @regularTileInfo[i]
  157.      @regularTileInfo[i].dispose
  158.      @regularTileInfo[i]=nil
  159. end
  160. i+=1
  161. end
  162. i=0;[email protected];while i<len
  163. @tiles[i].dispose
  164. @tiles[i]=nil
  165. i+=2
  166. end
  167. i=0;[email protected];while i<len
  168. @autosprites[i].dispose
  169. @autosprites[i]=nil
  170. i+=2
  171. end
  172. if @layer0
  173. @layer0.bitmap.dispose if [email protected]?
  174. @layer0.bitmap=nil if [email protected]?
  175. @layer0.dispose
  176. @layer0=nil
  177. end
  178. if @flash
  179. @flash.bitmap.dispose if [email protected]?
  180. @flash.bitmap=nil if [email protected]?
  181. @flash.dispose
  182. @flash=nil
  183. end
  184. for i in 0...7
  185. self.autotiles[i]=nil
  186. end
  187. @tiles.clear
  188. @autosprites.clear
  189. @autotileInfo.clear
  190. @regularTileInfo.clear
  191. @tilemap=nil
  192. @tileset=nil
  193. @priorities=nil
  194. @selfviewport.dispose
  195. @selfviewport=nil
  196. @disposed=true
  197. end

  198. def bltAutotile(bitmap,x,y,id,frame)
  199. return if frame<0
  200. autotile=@autotiles[id/48-1]
  201. return if !autotile
  202. if autotile.height==32
  203.     anim=frame*32
  204.     src_rect=Rect.new(anim,0,32,32)
  205.     bitmap.blt(x,y,autotile,src_rect)
  206. else
  207.     anim=frame*96
  208.     id%=48
  209.     tiles = Autotiles[id>>3][id&7]
  210.     src=Rect.new(0,0,0,0)
  211.     for i in 0...4
  212.       tile_position = tiles[i] - 1
  213.       src.set(tile_position % 6 * 16 + anim,
  214.        tile_position / 6 * 16, 16, 16)
  215.       bitmap.blt(i%2*16+x,i/2*16+y, autotile, src)
  216.     end
  217. end
  218. end

  219. def autotileNumFrames(id)
  220. autotile=@autotiles[id/48-1]
  221. return 0 if !autotile || autotile.disposed?
  222. frames=1
  223. if autotile.height==32
  224.    frames=autotile.width/32
  225. else
  226.    frames=autotile.width/96
  227. end
  228. return frames
  229. end

  230. def autotileFrame(id)
  231. autotile=@autotiles[id/48-1]
  232. return -1 if !autotile || autotile.disposed?
  233. frames=1
  234. if autotile.height==32
  235.    frames=autotile.width/32
  236. else
  237.    frames=autotile.width/96
  238. end
  239. return (Graphics.frame_count/Animated_Autotiles_Frames)%frames
  240. end

  241. def repaintAutotiles
  242. for i in [email protected]
  243. next if !@autotileInfo[i]
  244. frame=autotileFrame(i)
  245. bltAutotile(@autotileInfo[i],0,0,i,frame)
  246. end
  247. end

  248. def getAutotile(sprite,id)
  249. anim=autotileFrame(id)
  250. return if anim<0
  251. bitmap=@autotileInfo[id]
  252. if !bitmap
  253.     bitmap=Bitmap.new(32,32)
  254.     bltAutotile(bitmap,0,0,id,anim)
  255.     @autotileInfo[id]=bitmap
  256. end
  257. sprite.bitmap=bitmap if !sprite.equal?(bitmap) || sprite.bitmap!=bitmap
  258. end

  259. def getRegularTile(sprite,id)
  260. if false
  261. sprite.bitmap=@tileset if !sprite.equal?(@tileset) || sprite.bitmap!=@tileset
  262. sprite.src_rect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  263. else
  264. bitmap=@regularTileInfo[id]
  265. if !bitmap
  266.    bitmap=Bitmap.new(32,32)
  267.    rect=Rect.new((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  268.    bitmap.blt(0,0,@tileset,rect)
  269.    @regularTileInfo[id]=bitmap
  270. end
  271. sprite.bitmap=bitmap if !sprite.equal?(bitmap) || sprite.bitmap!=bitmap
  272. end
  273. end

  274. def addTile(tiles,count,xpos,ypos,id)
  275.    if id>=384
  276.      if count>=tiles.length
  277.       sprite=Sprite.new(@viewport)
  278.       tiles.push(sprite,0)
  279.      else
  280.       sprite=tiles[count]
  281.       tiles[count+1]=0
  282.      end
  283.      sprite.visible=@visible
  284.      sprite.x=xpos
  285.      sprite.y=ypos
  286.      getRegularTile(sprite,id)
  287.      spriteZ=(@priorities[id]==0||!@priorities[id]) ? 0 : ypos+@priorities[id]*32+32
  288.      sprite.z=spriteZ
  289.      count+=2
  290.    else
  291.      if count>=tiles.length
  292.       sprite=Sprite.new(@viewport)
  293.       tiles.push(sprite,1)
  294.      else
  295.       sprite=tiles[count]
  296.       tiles[count+1]=1
  297.      end
  298.      sprite.visible=@visible
  299.      sprite.x=xpos
  300.      sprite.y=ypos
  301.      getAutotile(sprite,id)
  302.      spriteZ=(@priorities[id]==0||!@priorities[id]) ? 0 : ypos+@priorities[id]*32+32
  303.      sprite.z=spriteZ
  304.      count+=2
  305.    end
  306.    return count
  307. end

  308. def refresh_tileset
  309. i=0;[email protected];while i<len
  310. if @regularTileInfo[i]
  311.      @regularTileInfo[i].dispose
  312.      @regularTileInfo[i]=nil
  313. end
  314. i+=1
  315. end
  316. @regularTileInfo.clear
  317. @priotiles.clear
  318. ysize=@map_data.ysize
  319. xsize=@map_data.xsize
  320. zsize=@map_data.zsize
  321. if xsize>100 || ysize>100
  322. @fullyrefreshed=false
  323. else
  324. for z in 0...zsize
  325.    for y in 0...ysize
  326.     for x in 0...xsize
  327.      id = @map_data[x, y, z]
  328.      next if id==0 || !@priorities[id]
  329.      next if @priorities[id]==0
  330.      @priotiles.push([x,y,z,id])
  331.     end
  332.    end
  333. end
  334. @fullyrefreshed=true
  335. end
  336. end

  337. def refresh_flash
  338. if @flash_data && !@flash
  339. @flash=Sprite.new(viewport)
  340. @flash.visible=true
  341. @flash.z=1
  342. @flash.blend_type=1
  343. @flash.bitmap=Bitmap.new(@viewport.rect.width*2,@viewport.rect.height*2)
  344. @firsttimeflash=true
  345. elsif !@flash_data && @flash
  346. @flash.bitmap.dispose if @flash.bitmap
  347. @flash.dispose
  348. @flash=nil
  349. @firsttimeflash=false
  350. end
  351. end

  352. def refresh_autotiles
  353. i=0;[email protected];while i<len
  354. if @autotileInfo[i]
  355.      @autotileInfo[i].dispose
  356.      @autotileInfo[i]=nil
  357. end
  358. i+=1
  359. end
  360. i=0;[email protected];while i<len
  361. if @autosprites[i]
  362.      @autosprites[i].dispose
  363.      @autosprites[i]=nil
  364. end
  365. i+=2
  366. end
  367. @autosprites.clear
  368. @autotileInfo.clear
  369. @prioautotiles.clear
  370. hasanimated=false
  371. for i in 0...7
  372. numframes=autotileNumFrames(48*(i+1))
  373. hasanimated=true if numframes>=2
  374. @framecount[i]=numframes
  375. end
  376. if hasanimated
  377. ysize=@map_data.ysize
  378. xsize=@map_data.xsize
  379. zsize=@map_data.zsize
  380. if xsize>100 || ysize>100
  381.     @fullyrefreshedautos=false
  382. else
  383.     for y in 0...ysize
  384.      for x in 0...xsize
  385.       haveautotile=false
  386.       for z in 0...zsize
  387.        id = @map_data[x, y, z]
  388.        next if id==0 || id>=384 || @priorities[id]!=0 || !@priorities[id]
  389.        next if @framecount[id/48-1]<2
  390.        haveautotile=true
  391.        break
  392.       end
  393.       @prioautotiles.push([x,y]) if haveautotile
  394.      end
  395.     end
  396.     @fullyrefreshedautos=true
  397. end
  398. else
  399. @fullyrefreshedautos=true
  400. end
  401. end

  402. def map_data=(value)
  403. @map_data=value
  404. @tilesetChanged=true
  405. end

  406. def refreshFlashSprite
  407. return if !@flash || @flash_data.nil?
  408. ptX=@ox-@oxFlash
  409. ptY=@oy-@oyFlash
  410. if !@firsttimeflash && !@usedsprites &&
  411.     ptX>=0 && [email protected]<[email protected] &&
  412.     ptY>=0 && [email protected]<[email protected]
  413. @flash.ox=0
  414. @flash.oy=0
  415. @flash.src_rect.set(ptX.round,ptY.round,
  416.      @viewport.rect.width,@viewport.rect.height)
  417. return
  418. end
  419. [email protected]
  420. [email protected]
  421. [email protected]
  422. ysize=@map_data.ysize
  423. xsize=@map_data.xsize
  424. zsize=@map_data.zsize
  425. @firsttimeflash=false
  426. @oxFlash=@ox-(width>>2)
  427. @oyFlash=@oy-(height>>2)
  428. @flash.ox=0
  429. @flash.oy=0
  430. @flash.src_rect.set(width>>2,height>>2,
  431.      @viewport.rect.width,@viewport.rect.height)
  432. @flash.bitmap.clear
  433. @[email protected]
  434. @[email protected]
  435. xStart=(@oxFlash>>5)
  436. xStart=0 if xStart<0
  437. yStart=(@oyFlash>>5)
  438. yStart=0 if yStart<0
  439. xEnd=xStart+(width>>5)+1
  440. yEnd=yStart+(height>>5)+1
  441. xEnd=xsize if xEnd>=xsize
  442. yEnd=ysize if yEnd>=ysize
  443. if xStart<xEnd && yStart<yEnd
  444. yrange=yStart...yEnd
  445. xrange=xStart...xEnd
  446. tmpcolor=Color.new(0,0,0,0)
  447. for y in yrange
  448.    ypos=(y<<5)-@oyFlash
  449.    for x in xrange
  450.      xpos=(x<<5)-@oxFlash
  451.      id = @flash_data[x, y, 0]
  452.      r=(id>>8)&15
  453.      g=(id>>4)&15
  454.      b=(id)&15
  455.      tmpcolor.set(r*16,g*16,b*16)
  456.      bitmap.fill_rect(xpos,ypos,32,32,tmpcolor)
  457.    end
  458. end
  459. end
  460. end


  461. def refreshLayer0(autotiles=false)
  462. ptX=@ox-@oxLayer0
  463. ptY=@oy-@oyLayer0
  464. if !autotiles && !@firsttime && !@usedsprites &&
  465.     ptX>=0 && [email protected]<[email protected] &&
  466.     ptY>=0 && [email protected]<[email protected]
  467. if @layer0clip
  468.    @layer0.ox=0
  469.    @layer0.oy=0
  470.    @layer0.src_rect.set(ptX.round,ptY.round,
  471.      @viewport.rect.width,@viewport.rect.height)
  472. else
  473.    @layer0.ox=ptX.round
  474.    @layer0.oy=ptY.round
  475.    @layer0.src_rect.set(0,0,@layer0.bitmap.width,@layer0.bitmap.height)
  476. end
  477. return true
  478. end
  479. [email protected]
  480. [email protected]
  481. [email protected]
  482. ysize=@map_data.ysize
  483. xsize=@map_data.xsize
  484. zsize=@map_data.zsize
  485. if autotiles
  486. return true if @fullyrefreshedautos && @prioautotiles.length==0
  487. return true if !shown?
  488. xStart=(@oxLayer0>>5)
  489. xStart=0 if xStart<0
  490. yStart=(@oyLayer0>>5)
  491. yStart=0 if yStart<0
  492. xEnd=xStart+(width>>5)+1
  493. yEnd=yStart+(height>>5)+1
  494. xEnd=xsize if xEnd>xsize
  495. yEnd=ysize if yEnd>ysize
  496. return true if xStart>=xEnd || yStart>=yEnd
  497. trans=Color.new(0,0,0,0)
  498. temprect=Rect.new(0,0,0,0)
  499. tilerect=Rect.new(0,0,32,32)
  500. range=0...zsize
  501. overallcount=0
  502. count=0
  503. if !@fullyrefreshedautos
  504.    for y in yStart..yEnd
  505.     for x in xStart..xEnd
  506.      haveautotile=false
  507.      for z in range
  508.       id = @map_data[x, y, z]
  509.       next if id<48 || id>=384 || @priorities[id]!=0 || !@priorities[id]
  510.       next if @framecount[id/48-1]<2
  511.       haveautotile=true
  512.       break
  513.      end
  514.      next if !haveautotile
  515.      overallcount+=1
  516.      xpos=(x<<5)-@oxLayer0
  517.      ypos=(y<<5)-@oyLayer0
  518.      bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000
  519.      for z in range
  520.       id = @map_data[x,y,z]
  521.       next if id<48 || @priorities[id]!=0 || !@priorities[id]
  522.       if overallcount>2000
  523.        count=addTile(@autosprites,count,xpos,ypos,id)
  524.        next
  525.       elsif id>=384
  526.        temprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  527.        bitmap.blt(xpos,ypos,@tileset,temprect)
  528.       else
  529.        tilebitmap=@autotileInfo[id]
  530.        if !tilebitmap
  531.         anim=autotileFrame(id)
  532.         next if anim<0
  533.         tilebitmap=Bitmap.new(32,32)
  534.         bltAutotile(tilebitmap,0,0,id,anim)
  535.         @autotileInfo[id]=tilebitmap
  536.        end
  537.        bitmap.blt(xpos,ypos,tilebitmap,tilerect)
  538.       end
  539.      end
  540.     end
  541.    end
  542. else
  543.    for tile in @prioautotiles
  544.     x=tile[0]
  545.     y=tile[1]
  546.     next if x<xStart||x>xEnd
  547.     next if y<yStart||y>yEnd
  548.     overallcount+=1
  549.     xpos=(x<<5)-@oxLayer0
  550.     ypos=(y<<5)-@oyLayer0
  551.     bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000
  552.     for z in range
  553.      id = @map_data[x,y,z]
  554.      next if id<48 || @priorities[id]!=0 || !@priorities[id]
  555.      if overallcount>2000
  556.       count=addTile(@autosprites,count,xpos,ypos,id)
  557.       next
  558.      elsif id>=384
  559.       temprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  560.       bitmap.blt(xpos,ypos,@tileset,temprect)
  561.      else
  562.       tilebitmap=@autotileInfo[id]
  563.       if !tilebitmap
  564.         anim=autotileFrame(id)
  565.         next if anim<0
  566.         tilebitmap=Bitmap.new(32,32)
  567.         bltAutotile(tilebitmap,0,0,id,anim)
  568.         @autotileInfo[id]=tilebitmap
  569.       end
  570.       bitmap.blt(xpos,ypos,tilebitmap,tilerect)
  571.      end
  572.     end
  573.    end
  574. end
  575. Graphics.frame_reset if overallcount>2000
  576. @usedsprites=false
  577. return true
  578. end
  579. return false if @usedsprites
  580. @firsttime=false
  581. @oxLayer0=@ox-(width>>2)
  582. @oyLayer0=@oy-(height>>2)
  583. if @layer0clip
  584. @layer0.ox=0
  585. @layer0.oy=0
  586. @layer0.src_rect.set(width>>2,height>>2,
  587.      @viewport.rect.width,@viewport.rect.height)
  588. else
  589. @layer0.ox=(width>>2)
  590. @layer0.oy=(height>>2)
  591. end
  592. @layer0.bitmap.clear
  593. @[email protected]
  594. @[email protected]
  595. xStart=(@oxLayer0>>5)
  596. xStart=0 if xStart<0
  597. yStart=(@oyLayer0>>5)
  598. yStart=0 if yStart<0
  599. xEnd=xStart+(width>>5)+1
  600. yEnd=yStart+(height>>5)+1
  601. xEnd=xsize if xEnd>=xsize
  602. yEnd=ysize if yEnd>=ysize
  603. if xStart<xEnd && yStart<yEnd
  604. tmprect=Rect.new(0,0,0,0)
  605. yrange=yStart...yEnd
  606. xrange=xStart...xEnd
  607. for z in 0...zsize
  608.    for y in yrange
  609.     ypos=(y<<5)-@oyLayer0
  610.     for x in xrange
  611.      xpos=(x<<5)-@oxLayer0
  612.      id = @map_data[x, y, z]
  613.      next if id==0 || @priorities[id]!=0 || !@priorities[id]
  614.      if id>=384
  615.        tmprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  616.        bitmap.blt(xpos,ypos,@tileset,tmprect)
  617.      else
  618.        frame=autotileFrame(id)
  619.        bltAutotile(bitmap,xpos,ypos,id,frame)
  620.      end
  621.     end
  622.    end
  623. end
  624. Graphics.frame_reset
  625. end
  626. return true
  627. end
  628. def getResizeFactor
  629. return $ResizeFactor ? $ResizeFactor : 1.0
  630. end
  631. def ox=(val)
  632.    val=(val*getResizeFactor).to_i
  633.    val=(val/getResizeFactor).to_i
  634.    wasshown=self.shown?
  635.    @ox=val.floor
  636.    @nowshown=(!wasshown && self.shown?)
  637. end
  638. def oy=(val)
  639.    val=(val*getResizeFactor).to_i
  640.    val=(val/getResizeFactor).to_i
  641.    wasshown=self.shown?
  642.    @oy=val.floor
  643.    @nowshown=(!wasshown && self.shown?)
  644. end
  645. def visible=(val)
  646.    wasshown=@visible
  647.    @visible=val
  648.    @nowshown=(!wasshown && val)
  649. end
  650. def refresh(autotiles=false)
  651. @oldOx=@ox
  652. @oldOy=@oy
  653. usesprites=false
  654. if @layer0
  655. @layer0.visible=@visible
  656. usesprites=!refreshLayer0(autotiles)
  657. if autotiles && !usesprites
  658.    return
  659. end
  660. else
  661. usesprites=true
  662. end
  663. refreshFlashSprite
  664. [email protected]
  665. [email protected]
  666. [email protected]+vpx
  667. [email protected]+vpy
  668. xsize=@map_data.xsize
  669. ysize=@map_data.ysize
  670. minX=(@ox/32)-1
  671. maxX=((@[email protected])/32)+1
  672. minY=(@oy/32)-1
  673. maxY=((@[email protected])/32)+1
  674. minX=0 if minX<0
  675. minX=xsize-1 if minX>=xsize
  676. maxX=0 if maxX<0
  677. maxX=xsize-1 if maxX>=xsize
  678. minY=0 if minY<0
  679. minY=ysize-1 if minY>=ysize
  680. maxY=0 if maxY<0
  681. maxY=ysize-1 if maxY>=ysize
  682. count=0
  683. if minX<maxX && minY<maxY
  684. @usedsprites=usesprites || @usedsprites
  685. if @layer0
  686.    @layer0.visible=false if usesprites
  687. end
  688. if @fullyrefreshed
  689.    for prio in @priotiles
  690.     next if prio[0]<minX||prio[0]>maxX
  691.     next if prio[1]<minY||prio[1]>maxY
  692.     id=prio[3]
  693.     xpos=(prio[0]<<5)-@ox
  694.     ypos=(prio[1]<<5)-@oy
  695.     count=addTile(@tiles,count,xpos,ypos,id)
  696.    end
  697. else
  698.    for z in 0...@map_data.zsize
  699.     for y in minY..maxY
  700.      for x in minX..maxX
  701.       id = @map_data[x, y, z]
  702.       next if id==0 || !@priorities[id]
  703.       next if @priorities[id]==0
  704.       xpos=(x<<5)-@ox
  705.       ypos=(y<<5)-@oy
  706.       count=addTile(@tiles,count,xpos,ypos,id)
  707.      end
  708.     end
  709.    end
  710. end
  711. end
  712. if count<@tiles.length
  713. bigchange=(count<=(@tiles.length*2/3)) && (@tiles.length*2/3)>25
  714. j=count;[email protected];while j<len
  715.    sprite=@tiles[j]
  716.    @tiles[j+1]=-1
  717.    if bigchange
  718.     sprite.dispose
  719.     @tiles[j]=nil
  720.     @tiles[j+1]=nil
  721.    elsif !@tiles[j].disposed?
  722.     sprite.visible=false if sprite.visible
  723.    end
  724.    j+=2
  725. end
  726. @tiles.compact! if bigchange
  727. end
  728. end

  729. end

  730. 七)打开Arrow_Base脚本页,把全部内容替换成这个脚本:
  731. #==============================================================================
  732. # ■ Arrow_Base
  733. #==============================================================================
  734. class Arrow_Base < Sprite
  735. attr_reader   :index
  736. attr_reader   :help_window
  737. def initialize(viewport)
  738.     super(viewport)
  739.     self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
  740.     self.ox = 16
  741.     self.oy = 64
  742.     self.z = 2500
  743.     @blink_count = 0
  744.     @index = 0
  745.     @help_window = nil
  746.     update
  747. end
  748. def index=(index)
  749.     @index = index
  750.     update
  751. end
  752. def help_window=(help_window)
  753.     @help_window = help_window
  754.     if @help_window != nil
  755.       update_help
  756.     end
  757. end
  758. def update
  759.     @blink_count = (@blink_count + 1) % 8
  760.     if @blink_count < 4
  761.       self.src_rect.set(0, 128, 32, 32) #RPGEX
  762.     else
  763.       self.src_rect.set(32, 128, 32, 32) #RPGEX
  764.     end
  765.     if @help_window != nil
  766.       update_help
  767.     end
  768. end
  769. end
复制代码
八)在Game_Player脚本页与Sprite_Character脚本页之间插入新脚本页,输入下面的脚本:
[或者你把Game_Player脚本自己参照这个脚本DIY即可,不过本人不推荐不精通脚本的人使用该方法]

  1. #==============================================================================
  2. # ** Game_Player
  3. #------------------------------------------------------------------------------
  4. # This class handles the player. Its functions include event starting
  5. # determinants and map scrolling. Refer to "$game_player" for the one
  6. # instance of this class.
  7. #==============================================================================

  8. class Game_Player < Game_Character
  9. alias dargor_vx_player_update update
  10. #--------------------------------------------------------------------------
  11. # * Frame Update
  12. #--------------------------------------------------------------------------
  13. def update
  14.     if Input.press?(Input::CTRL) and $TEST
  15.       @through = true
  16.     else
  17.       @through = false
  18.     end
  19.     dargor_vx_player_update
  20. end
  21. end
复制代码
九)在main脚本页的所有内容之前插入这两句:
  1. Graphics.resize_screen(640, 480) # 设置分辨率
  2. Font.default_shadow = false      # 禁用全局文字阴影效果(这个自己随便,插入不插入无所谓)
复制代码
如果原main脚本没有定义默认字体的话再在上面所说的位置之后插入这句:
[简体中文用户]
  1. Font.default_name = ["SimHei", "黑体", "DFKai-SB", "標楷體"]
复制代码
[繁体中文用户]
  1. Font.default_name = ["DFKai-SB", "標楷體", "SimHei", "黑体"]
复制代码
第四步 - 善后处理
经过上文所述的处理后,原有的RPGXP格式的Windowskin不能用了,直接在RPGVX格式的Windowskin基础上改做成下面这个格式即可:

如何加密?这个简单,直接用RPGXP加密即可,然后再把游戏安装包解开后把game.rgssad改名为game.rgss2a。
[RGSS2运行库向下兼容旧版加密格式]






额,听起来不错
不过还是不懂啊那位大大看懂了可以发个范例啊!


Lv1.梦旅人

梦石
0
星屑
50
在线时间
311 小时
注册时间
2011-3-4
帖子
238
2
发表于 2011-7-7 19:18:32 | 只看该作者
= =我以为下面会有详细的教程 ,谁知道是楼主的“还是不懂啊”
我也看不懂,取别人的优点补自己缺点的办法一定要学

点评

希望有人能看懂吧!  发表于 2011-7-7 19:27
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1955
在线时间
1065 小时
注册时间
2006-1-10
帖子
798
3
发表于 2011-7-7 20:29:12 | 只看该作者
本帖最后由 非常白菜 于 2011-7-8 07:19 编辑

Project2.zip (945.08 KB, 下载次数: 130)
好吧,咱传一个范例上来,其实人家说的已经十分傻瓜了。。。
没有附加RTP素材,自行补充吧
还有替换一下Windowskin和DEBUG

PS:60FPS真不习惯啊,有点开变速齿轮的感觉。。。
PS2:在屏幕大小那里添加一行限制帧数的代码,高速下XP游戏运行很奇怪。。。
Graphics.frame_rate = 40

点评

其实可以不用限制fps(把里面的40都改成60就可以了)  发表于 2011-7-25 12:20
回复 支持 反对

使用道具 举报

乌有君
4
乌有君  发表于 2011-7-8 02:17:19
本帖最后由 匿名 于 2011-7-8 02:23 编辑

偶记得当时出来的时候我去英文原作者那里帮他改了个TILEMAP的BUG来着,不知道这里用的TILEMAP有米有更新。(当然,后来我彻底重写了那个悲剧的TILEMAP,效率改善了不少 囧。外带玩了个更变态的:允许用户自行选择用神马运行库。←加了点简单的RGSS1和2的互相可移植性方面的兼容神马的)

实际上你们还能发现这个TILEMAP的另外一个BUG……毕竟VX是BITMAP太大会死星人。

此外,这篇中文的作者偶记得是孙大神来着 囧(现在转载流行不写原作者了么←即使只是翻译作者- -)
并且他本人在这里是发过的- -

点评

其实可以~\(≧▽≦)/~,不过只有牛扒童鞋才那么无聊~\(≧▽≦)/~  发表于 2011-7-9 00:40
点评不能匿名啊喵~~  发表于 2011-7-8 23:59
脚本还是偏向XP的  发表于 2011-7-8 16:59
我在想用完这货之后插脚本应该插XP的还是VX的- -!  发表于 2011-7-8 16:43
...刚开始还可以,后来走路卡了  发表于 2011-7-8 10:20
回复 支持 反对

使用道具 举报

Lv1.梦旅人

死人

梦石
0
星屑
60
在线时间
1055 小时
注册时间
2011-2-10
帖子
2029

贵宾

5
发表于 2011-7-8 11:10:33 | 只看该作者
匿名者 发表于 2011-7-8 02:17
偶记得当时出来的时候我去英文原作者那里帮他改了个TILEMAP的BUG来着,不知道这里用的TILEMAP有 ...

求这个特殊版本~~
东八区失地工作组
剧本、UI设计、php程序、网页美工、项目策划
Losses Don
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
235
在线时间
5 小时
注册时间
2013-7-8
帖子
2
6
发表于 2013-7-10 16:19:04 | 只看该作者
下了再研究,谢谢提供,只要有提供学习的免费资源我的顶。
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-8 01:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表