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

Project1

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

[有事请教] 请教下现在扩大分辨率最简洁的方法

[复制链接]

Lv4.逐梦者

梦石
0
星屑
9128
在线时间
463 小时
注册时间
2015-5-8
帖子
865
跳转到指定楼层
1
发表于 2023-4-24 01:15:11 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 taeckle 于 2023-4-24 04:41 编辑

大家好,

这RPG Maker XP 默认的游戏窗口分别率 640 X 480 真是太小了啊, 请问下现在提升分辨率最简单的方法都有哪些呢?

Lv5.捕梦者 (版主)

梦石
1
星屑
23963
在线时间
3338 小时
注册时间
2011-7-8
帖子
3925

开拓者

2
发表于 2023-4-24 12:35:59 | 只看该作者
本帖最后由 guoxiaomi 于 2023-4-24 15:01 编辑

xp没有考虑过分辨率扩展的问题,所以做起来没有简单的方法。

建议你按照以下步骤做:
1. 使用分辨率扩展脚本或第三方runtime,将窗口大小扩展到其他分辨率
2. 修改内置的window和viewport的位置和大小,使其适配分辨率
3. 修改RGSS中其他硬编码的640,480等整数,通常在地图和天气相关

很可惜,原版的Viewport的大小被限制在640x480,想显示更大范围的地图必须用至少4个tilemap来拼接,最终可能有性能问题。使用第三方runtime倒是没有这个限制,也不会有性能问题,但是可能有别的兼容性问题。

分辨率扩展脚本:https://rpg.blue/thread-362553-1-1.html

点评

好的,我先去试试看,多谢大神指点!  发表于 2023-4-24 17:02
熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
3
发表于 2023-4-24 16:23:56 | 只看该作者
本帖最后由 金芒芒 于 2023-4-24 16:43 编辑

本人不懂脚本瞎调的所以用了很多时间把带五角星的脚本复制过去就行了,地图和窗口背景最好是不要超过1200*700的20%不然就会出现左右摇晃的黑边
如果是超大地图最好用事件接近主角地图传送 把地图分割掉
链接: https://pan.baidu.com/s/1_pwrecjaoTC0TxzGBoTW8Q?pwd=wqmu 提取码: wqmu 复制这段内容后打开百度网盘手机App,操作更方便哦 无黑边本人花了一个月修改修改原创板
1200*700
下面是第一个脚本再改全适应板脚本
  1. #==============================================================================
  2. # ■ 真·RMXP分辨率拓展 By 紫英晓狼工作室
  3. #------------------------------------------------------------------------------
  4. #  用于更改游戏分辨率,紫英晓狼工作室修改
  5. #   脚本主要来源于癫狂侠客的DKRM,自己稍作修改
  6. #   全局搜索“修改”可以看到修改的地方
  7. #   所有的窗口类没有改动,使用前请注意
  8. #   使用需复制带★的脚本,以及START.dll $game_temp.reserve_common_event(公共事件ID)
  9. #==============================================================================

  10. module GAME_WINDOW
  11.   INT_WIDTH = 1200              # 窗口宽度
  12.   INT_HEIGHT = 700             # 窗口高度
  13. end
  14.   ini=".\\Game.ini"
  15.   val = "\0"*256
  16.   gps = Win32API.new('kernel32', 'GetPrivateProfileString','pppplp', 'l')
  17.   gps.call("Game", "Title", "", val, 256, ini)
  18.   val.delete!("\0")
  19.   title = val
  20.   fw = Win32API.new('user32', 'FindWindow', 'pp', 'i')
  21.   hWnd = fw.call("RGSS Player", title)
  22.   swp = Win32API.new('user32', 'SetWindowPos', 'lliiiii', 'i')
  23.   pointwds = [0,0,0,0].pack('llll')
  24.   pointcet = [0, 0].pack('ll')
  25.   wdsrect = Win32API.new('user32.dll', 'GetWindowRect', 'lp', 'l')
  26.   client_screen = Win32API.new("user32", "ClientToScreen", 'ip', 'i')
  27.   wdsrect.call(hWnd,pointwds)
  28.   client_screen.call(hWnd, pointcet)
  29.   wds = pointwds.unpack('llll')
  30.   cet = pointcet.unpack('ll')
  31.   addw =  wds[2] - wds[0] - 640  
  32.   addh =  wds[3] - wds[1] - 480  
  33.   x = wds[0] - (GAME_WINDOW::INT_WIDTH - 640) / 2
  34.   y = wds[1] - (GAME_WINDOW::INT_HEIGHT - 480) / 2
  35.   swp.call(hWnd, 0, x, y, GAME_WINDOW::INT_WIDTH + addw, GAME_WINDOW::INT_HEIGHT+addh,0x20)
  36. #============================================================================
  37. # ■ Plane
  38. #============================================================================

  39. class Plane
  40.   #--------------------------------------------------------------------------
  41.   # ● 初始化定义
  42.   #--------------------------------------------------------------------------
  43.   def initialize(v = Viewport.new(0, 0, 640, 480))
  44.     @x           = 0
  45.     @y           = 0
  46.     @z           = 0
  47.     @ox          = 0
  48.     @oy          = 0
  49.     @ox2         = 0
  50.     @oy2         = 0
  51.     @rect        = v.rect
  52.     @zoom_x      = 1.0
  53.     @zoom_y      = 1.0
  54.     @bitmap      = nil
  55.     @contents    = Sprite.new
  56.     @n_w         = 1
  57.     @n_h         = 1
  58.     @visible     = true
  59.     @tone        = Tone.new(0, 0, 0, 0)
  60.     @color       = Color.new(255,255,255,0)
  61.     @blend_type  = 0
  62.     @opacity     = 255
  63.     @dispose     = false
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 刷新
  67.   #--------------------------------------------------------------------------
  68.   def update
  69.     @contents.x = @x
  70.     @contents.y = @y
  71.     @contents.ox = @ox2
  72.     @contents.oy = @oy2
  73.     @contents.opacity = @opacity
  74.     @contents.visible = @visible
  75.     @contents.tone = @tone
  76.     @contents.blend_type = @blend_type
  77.     @contents.z = @z
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 装载图形(bitmap)
  81.   #--------------------------------------------------------------------------
  82.   def bitmap=(bitmap)
  83.     if @disposed
  84.       raise(RGSSError,"disposed window")
  85.     else
  86.       @bitmap = bitmap
  87.       count_wh
  88.       update
  89.     end
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ● 图形
  93.   #--------------------------------------------------------------------------
  94.   def bitmap
  95.     return if @bitmap != nil
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● X 坐标(x)
  99.   #--------------------------------------------------------------------------
  100.   def x=(x)
  101.     if @disposed
  102.       raise(RGSSError,"disposed window")
  103.     else
  104.       @x = x
  105.       update
  106.     end
  107.   end
  108.   def x
  109.     return @x
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ● Y 坐标(y)
  113.   #--------------------------------------------------------------------------
  114.   def y=(y)
  115.     if @disposed
  116.       raise(RGSSError,"disposed window")
  117.     else
  118.       @y = y
  119.       update
  120.     end
  121.   end
  122.   def y
  123.     return @y
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● Z 坐标(z)
  127.   #--------------------------------------------------------------------------
  128.   def z=(z)
  129.     if @disposed
  130.       raise(RGSSError,"disposed window")
  131.     else
  132.       @z = z
  133.       update
  134.     end
  135.   end
  136.   def z
  137.     return @z
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● X 漂移量(ox)
  141.   #--------------------------------------------------------------------------
  142.   def ox=(ox)
  143.     if @disposed
  144.       raise(RGSSError,"disposed window")
  145.     else
  146.       if @bitmap != nil
  147.         @ox = ox
  148.         @ox2 = ox % (@bitmap.width * @zoom_x).to_i
  149.         update
  150.       end
  151.     end
  152.   end
  153.   def ox
  154.     return @ox
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● Y 漂移量(oy)
  158.   #--------------------------------------------------------------------------
  159.   def oy=(oy)
  160.     if @disposed
  161.       raise(RGSSError,"disposed window")
  162.     else
  163.       if @bitmap != nil
  164.         @oy = oy
  165.         @oy2 = oy % (@bitmap.height * @zoom_y).to_i
  166.         update
  167.       end
  168.     end
  169.   end
  170.   def oy
  171.     return @oy
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● X 方向缩放(zoom_x)
  175.   #--------------------------------------------------------------------------
  176.   def zoom_x=(zx)
  177.     if @disposed
  178.       raise(RGSSError,"disposed window")
  179.     else
  180.       if @zoom_x != zx
  181.         @zoom_x = zx
  182.         count_wh
  183.       end
  184.       update
  185.     end
  186.   end
  187.   def zoom_x
  188.     return @zoom_x
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● Y 方向缩放(zoom_y)
  192.   #--------------------------------------------------------------------------
  193.   def zoom_y=(zy)
  194.     if @disposed
  195.       raise(RGSSError,"disposed window")
  196.     else
  197.       if @zoom_y != zy
  198.         @zoom_y = zy
  199.         count_wh
  200.       end
  201.       update
  202.     end
  203.   end
  204.   def zoom_y
  205.     return @zoom_y
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● 不透明度(opacity)
  209.   #--------------------------------------------------------------------------
  210.   def opacity=(op)
  211.     if @disposed
  212.       raise(RGSSError,"disposed window")
  213.     else
  214.       @opacity = op
  215.       update
  216.     end
  217.   end
  218.   def opacity
  219.     return @opacity
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # ● 颜色叠加(color)
  223.   #--------------------------------------------------------------------------
  224.   def color=(c)
  225.     if @disposed
  226.       raise(RGSSError,"disposed window")
  227.     else
  228.       @color = c
  229.       update
  230.     end
  231.   end
  232.   def color
  233.     return @color
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● 色调(tone)
  237.   #--------------------------------------------------------------------------
  238.   def tone=(tone)
  239.     if @disposed
  240.       raise(RGSSError,"disposed window")
  241.     else
  242.       @tone = tone
  243.       update
  244.     end
  245.   end
  246.   def tone
  247.     return @tone
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 是否可见(visible)
  251.   #--------------------------------------------------------------------------
  252.   def visible=(v)
  253.     if @disposed
  254.       raise(RGSSError,"disposed window")
  255.     else
  256.       @visible = v
  257.       update
  258.     end
  259.   end
  260.   def visible
  261.     return @visible
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● 叠加模式(blend_type)
  265.   #--------------------------------------------------------------------------
  266.   def blend_type=(bt)
  267.     if @disposed
  268.       raise(RGSSError,"disposed window")
  269.     else
  270.       @blend_type = bt
  271.       update
  272.     end
  273.   end
  274.   def blend_type
  275.     return @blend_type
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 释放内存(dispose)
  279.   #--------------------------------------------------------------------------
  280.   def dispose
  281.     return if @dispose
  282.     @dispose = true
  283.     @contents.bitmap.dispose if @contents.bitmap != nil
  284.     @contents.bitmap = nil
  285.     @contents.dispose if @contents != nil
  286.     @contents = nil
  287.     @bitmap.dispose if @bitmap != nil
  288.     @bitmap = nil
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ● 检测释放(dispose?)
  292.   #--------------------------------------------------------------------------
  293.   def dispose?
  294.     @dispose
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 计算Plane的长宽与精灵排布(count_wh)
  298.   #--------------------------------------------------------------------------
  299.   def count_wh
  300.     if @bitmap != nil
  301.       @n_w = @rect.width / (@bitmap.width * @zoom_x).to_i + 3
  302.       @n_h = @rect.height / (@bitmap.height * @zoom_y).to_i + 3
  303.       h = @n_h * (@bitmap.height * @zoom_y).to_i
  304.       w = @n_w * (@bitmap.width * @zoom_x).to_i
  305.       if @contents.bitmap == nil
  306.         @contents.bitmap = Bitmap.new(w, h)
  307.       end
  308.       @contents.bitmap.clear
  309.       for x in 0..@n_w
  310.         for y in 0..@n_h
  311.           rect = Rect.new(0,0,@bitmap.width,@bitmap.height)
  312.           dest_rect = Rect.new(x * @bitmap.width * @zoom_x,\
  313.           y * @bitmap.height * @zoom_y,@bitmap.width * @zoom_x,\
  314.           @bitmap.height * @zoom_y)
  315.           @contents.bitmap.stretch_blt(dest_rect, @bitmap, rect)
  316.         end
  317.       end
  318.     end
  319.   end
  320. end
  321. #===================================================
  322. # ■ Tilemap
  323. #===================================================

  324. class CustomTilemapAutotiles
  325.   attr_accessor :changed
  326.   def initialize
  327.     @changed=true
  328.     @tiles=[nil,nil,nil,nil,nil,nil,nil]
  329.   end
  330.   def []=(i,value)
  331.     @tiles[i]=value
  332.     @changed=true
  333.   end
  334.   def [](i)
  335.     return @tiles[i]
  336.   end
  337. end

  338. class Tilemap
  339.   Animated_Autotiles_Frames = 15
  340.   Autotiles = [
  341.     [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34],
  342.       [27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ],
  343.     [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34],
  344.       [27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ],
  345.     [ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12],
  346.       [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ],
  347.     [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36],
  348.       [39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ],
  349.     [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12],
  350.       [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ],
  351.     [ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44],
  352.       [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ]
  353.      ]
  354.   FlashOpacity=[100,90,80,70,80,90]
  355.   attr_reader :tileset
  356.   attr_reader :autotiles
  357.   attr_reader :map_data
  358.   attr_accessor :flash_data
  359.   attr_accessor :priorities
  360.   attr_reader :visible
  361.   attr_accessor :ox
  362.   attr_accessor :oy
  363.   attr_reader :viewport
  364.   def initialize(viewport=Viewport.new(0,0,640,480))
  365.     @tileset  = nil # Refers to Map Tileset Name
  366.     @autotiles = CustomTilemapAutotiles.new
  367.     @map_data  = nil # Refers to 3D Array Of Tile Settings
  368.     @flash_data = nil # Refers to 3D Array of Tile Flashdata
  369.     @priorities = nil # Refers to Tileset Priorities
  370.     @visible  = true # Refers to Tileset Visibleness
  371.     @ox      = 0  # Bitmap Offsets
  372.     @oy      = 0  # bitmap Offsets
  373.     @plane    = false
  374.     @viewport=viewport
  375.     @tiles=[]
  376.     @autotileInfo=[]
  377.     @regularTileInfo=[]
  378.     @oldOx=0
  379.     @oldOy=0
  380.     @layer0=Sprite.new(viewport)
  381.     @layer0.visible=true
  382.     @nowshown=false
  383.     @layer0.bitmap=Bitmap.new(@viewport.rect.width*2,@viewport.rect.height*2)
  384.     @flash=nil
  385.     @layer0.ox=0
  386.     @layer0.oy=0
  387.     @oxLayer0=0
  388.     @oyLayer0=0
  389.     @oxFlash=0
  390.     @oyFlash=0
  391.     @layer0.z=0
  392.     @priotiles=[]
  393.     @prioautotiles=[]
  394.     @autosprites=[]
  395.     @framecount=[]
  396.     @tilesetChanged=true
  397.     @flashChanged=false
  398.     @firsttime=true
  399.     @disposed=false
  400.     @usedsprites=false
  401.     @layer0clip=true
  402.     @firsttimeflash=true
  403.     @fullyrefreshed=false
  404.     @fullyrefreshedautos=false
  405.   end
  406.   def disposed?
  407.     return @disposed
  408.   end
  409.   def flash_data=(value)
  410.     @flash_data=value
  411.     @flashChanged=true  
  412.   end
  413.   def update
  414.     if @autotiles.changed
  415.       refresh_autotiles
  416.       repaintAutotiles
  417.     end
  418.     if @flashChanged
  419.       refresh_flash
  420.     end
  421.     if @tilesetChanged
  422.       refresh_tileset
  423.     end
  424.     if @flash
  425.       @flash.opacity=FlashOpacity[(Graphics.frame_count/2) % 6]
  426.     end
  427.     if !(@oldOx==@ox&&@oldOy==@oy&&
  428.           !@tilesetChanged&&
  429.           [email protected])
  430.       refresh
  431.     end
  432.     if (Graphics.frame_count % Animated_Autotiles_Frames == 0) || @nowshown
  433.       repaintAutotiles
  434.       refresh(true)
  435.     end
  436.     @nowshown=false
  437.     @autotiles.changed=false
  438.     @tilesetChanged=false
  439.   end
  440.   def priorities=(value)
  441.     @priorities=value
  442.     @tilesetChanged=true
  443.   end
  444.   def tileset=(value)
  445.     @tileset=value
  446.     @tilesetChanged=true
  447.   end
  448. def shown?
  449.   return false if !@visible
  450.   ysize=@map_data.ysize
  451.   xsize=@map_data.xsize
  452.   xStart=(@ox/32)-1
  453.   xEnd=((@[email protected])/32)+1
  454.   yStart=(@oy/32)-1
  455.   yEnd=((@[email protected])/32)+1
  456.   xStart=0 if xStart<0
  457.   xStart=xsize-1 if xStart>=xsize
  458.   xEnd=0 if xEnd<0
  459.   xEnd=xsize-1 if xEnd>=xsize
  460.   yStart=0 if yStart<0
  461.   yStart=ysize-1 if yStart>=ysize
  462.   yEnd=0 if yEnd<0
  463.   yEnd=ysize-1 if yEnd>=ysize
  464.   return (xStart<xEnd&&yStart<yEnd)
  465. end
  466. def dispose
  467. return if disposed?
  468. @help.dispose if @help
  469. @help=nil
  470. i=0;[email protected];while i<len
  471. if @autotileInfo[i]
  472.     @autotileInfo[i].dispose
  473.     @autotileInfo[i]=nil
  474. end
  475. i+=1
  476. end
  477. i=0;[email protected];while i<len
  478. if @regularTileInfo[i]
  479.     @regularTileInfo[i].dispose
  480.     @regularTileInfo[i]=nil
  481. end
  482. i+=1
  483. end
  484. i=0;[email protected];while i<len
  485. @tiles[i].dispose
  486. @tiles[i]=nil
  487. i+=2
  488. end
  489. i=0;[email protected];while i<len
  490. @autosprites[i].dispose
  491. @autosprites[i]=nil
  492. i+=2
  493. end
  494. if @layer0
  495. @layer0.bitmap.dispose if [email protected]?
  496. @layer0.bitmap=nil if [email protected]?
  497. @layer0.dispose
  498. @layer0=nil
  499. end
  500. if @flash
  501. @flash.bitmap.dispose if [email protected]?
  502. @flash.bitmap=nil if [email protected]?
  503. @flash.dispose
  504. @flash=nil
  505. end
  506. for i in 0...7
  507. self.autotiles[i]=nil
  508. end
  509. @tiles.clear
  510. @autosprites.clear
  511. @autotileInfo.clear
  512. @regularTileInfo.clear
  513. @tilemap=nil
  514. @tileset=nil
  515. @priorities=nil
  516. @disposed=true
  517. end
  518. def bltAutotile(bitmap,x,y,id,frame)
  519. return if frame<0
  520. autotile=@autotiles[id/48-1]
  521. return if !autotile
  522. if autotile.height==32
  523.   anim=frame*32
  524.   src_rect=Rect.new(anim,0,32,32)
  525.   bitmap.blt(x,y,autotile,src_rect)
  526. else
  527.   anim=frame*96
  528.   id%=48
  529.   tiles = Autotiles[id>>3][id&7]
  530.   src=Rect.new(0,0,0,0)
  531.   for i in 0...4
  532.     tile_position = tiles[i] - 1
  533.     src.set(tile_position % 6 * 16 + anim,
  534.     tile_position / 6 * 16, 16, 16)
  535.     bitmap.blt(i%2*16+x,i/2*16+y, autotile, src)
  536.   end
  537. end
  538. end
  539. def autotileNumFrames(id)
  540. autotile=@autotiles[id/48-1]
  541. return 0 if !autotile || autotile.disposed?
  542. frames=1
  543. if autotile.height==32
  544.   frames=autotile.width/32
  545. else
  546.   frames=autotile.width/96
  547. end
  548. return frames
  549. end
  550. def autotileFrame(id)
  551. autotile=@autotiles[id/48-1]
  552. return -1 if !autotile || autotile.disposed?
  553. frames=1
  554. if autotile.height==32
  555.   frames=autotile.width/32
  556. else
  557.   frames=autotile.width/96
  558. end
  559. return (Graphics.frame_count/Animated_Autotiles_Frames)%frames
  560. end
  561. def repaintAutotiles
  562. for i in [email protected]
  563. next if !@autotileInfo[i]
  564. frame=autotileFrame(i)
  565. bltAutotile(@autotileInfo[i],0,0,i,frame)
  566. end
  567. end
  568. def getAutotile(sprite,id)
  569. anim=autotileFrame(id)
  570. return if anim<0
  571. bitmap=@autotileInfo[id]
  572. if !bitmap
  573.   bitmap=Bitmap.new(32,32)
  574.   bltAutotile(bitmap,0,0,id,anim)
  575.   @autotileInfo[id]=bitmap
  576. end
  577. sprite.bitmap=bitmap if !sprite.equal?(bitmap) || sprite.bitmap!=bitmap
  578. end
  579. def getRegularTile(sprite,id)
  580. if false
  581. sprite.bitmap=@tileset if !sprite.equal?(@tileset) || sprite.bitmap!=@tileset
  582. sprite.src_rect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  583. else
  584. bitmap=@regularTileInfo[id]
  585. if !bitmap
  586.   bitmap=Bitmap.new(32,32)
  587.   rect=Rect.new((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  588.   bitmap.blt(0,0,@tileset,rect)
  589.   @regularTileInfo[id]=bitmap
  590. end
  591. sprite.bitmap=bitmap if !sprite.equal?(bitmap) || sprite.bitmap!=bitmap
  592. end
  593. end
  594. def addTile(tiles,count,xpos,ypos,id)
  595.   if id>=384
  596.     if count>=tiles.length
  597.     sprite=Sprite.new(@viewport)
  598.     tiles.push(sprite,0)
  599.     else
  600.     sprite=tiles[count]
  601.     tiles[count+1]=0
  602.     end
  603.     sprite.visible=@visible
  604.     sprite.x=xpos
  605.     sprite.y=ypos
  606.     getRegularTile(sprite,id)
  607.     spriteZ=(@priorities[id]==0||!@priorities[id]) ? 0 : ypos+@priorities[id]*32+32
  608.     sprite.z=spriteZ
  609.     count+=2
  610.   else
  611.     if count>=tiles.length
  612.     sprite=Sprite.new(@viewport)
  613.     tiles.push(sprite,1)
  614.     else
  615.     sprite=tiles[count]
  616.     tiles[count+1]=1
  617.     end
  618.     sprite.visible=@visible
  619.     sprite.x=xpos
  620.     sprite.y=ypos
  621.     getAutotile(sprite,id)
  622.     spriteZ=(@priorities[id]==0||!@priorities[id]) ? 0 : ypos+@priorities[id]*32+32
  623.     sprite.z=spriteZ
  624.     count+=2
  625.   end
  626.   return count
  627. end
  628. def refresh_tileset
  629. i=0;[email protected];while i<len
  630. if @regularTileInfo[i]
  631.     @regularTileInfo[i].dispose
  632.     @regularTileInfo[i]=nil
  633. end
  634. i+=1
  635. end
  636. @regularTileInfo.clear
  637. @priotiles.clear
  638. ysize=@map_data.ysize
  639. xsize=@map_data.xsize
  640. zsize=@map_data.zsize
  641. if xsize>100 || ysize>100
  642. @fullyrefreshed=false
  643. else
  644. for z in 0...zsize
  645.   for y in 0...ysize
  646.   for x in 0...xsize
  647.     id = @map_data[x, y, z]
  648.     next if id==0 || !@priorities[id]
  649.     next if @priorities[id]==0
  650.     @priotiles.push([x,y,z,id])
  651.   end
  652.   end
  653. end
  654. @fullyrefreshed=true
  655. end
  656. end
  657. def refresh_flash
  658. if @flash_data&&!@flash
  659. @flash=Sprite.new(viewport)
  660. @flash.visible=true
  661. @flash.z=1
  662. @flash.blend_type=1
  663. @flash.bitmap=Bitmap.new(@viewport.rect.width*2,@viewport.rect.height*2)
  664. @firsttimeflash=true
  665. elsif !@flash_data&&@flash
  666. @flash.bitmap.dispose if @flash.bitmap
  667. @flash.dispose
  668. @flash=nil
  669. @firsttimeflash=false
  670. end
  671. end
  672. def refresh_autotiles
  673. i=0;[email protected];while i<len
  674. if @autotileInfo[i]
  675.     @autotileInfo[i].dispose
  676.     @autotileInfo[i]=nil
  677. end
  678. i+=1
  679. end
  680. i=0;[email protected];while i<len
  681. if @autosprites[i]
  682.     @autosprites[i].dispose
  683.     @autosprites[i]=nil
  684. end
  685. i+=2
  686. end
  687. @autosprites.clear
  688. @autotileInfo.clear
  689. @prioautotiles.clear
  690. hasanimated=false
  691. for i in 0...7
  692. numframes=autotileNumFrames(48*(i+1))
  693. hasanimated=true if numframes>=2
  694. @framecount[i]=numframes
  695. end
  696. if hasanimated
  697. ysize=@map_data.ysize
  698. xsize=@map_data.xsize
  699. zsize=@map_data.zsize
  700. if xsize>100 || ysize>100
  701.   @fullyrefreshedautos=false
  702. else
  703.   for y in 0...ysize
  704.     for x in 0...xsize
  705.     haveautotile=false
  706.     for z in 0...zsize
  707.     id = @map_data[x, y, z]
  708.     next if id==0 || id>=384 || @priorities[id]!=0 || !@priorities[id]
  709.     next if @framecount[id/48-1]<2
  710.     haveautotile=true
  711.     break
  712.     end
  713.     @prioautotiles.push([x,y]) if haveautotile
  714.     end
  715.   end
  716.   @fullyrefreshedautos=true
  717. end
  718. else
  719. @fullyrefreshedautos=true
  720. end
  721. end
  722. def map_data=(value)
  723. @map_data=value
  724. @tilesetChanged=true
  725. end
  726. def refreshFlashSprite
  727. return if !@flash || @flash_data.nil?
  728. ptX=@ox-@oxFlash
  729. ptY=@oy-@oyFlash
  730. if !@firsttimeflash&&!@usedsprites&&
  731.   ptX>=0&&[email protected]<[email protected]&&
  732.   ptY>=0&&[email protected]<[email protected]
  733. @flash.ox=0
  734. @flash.oy=0
  735. @flash.src_rect.set(ptX.round,ptY.round,
  736.     @viewport.rect.width,@viewport.rect.height)
  737. return
  738. end
  739. [email protected]
  740. [email protected]
  741. [email protected]
  742. ysize=@map_data.ysize
  743. xsize=@map_data.xsize
  744. zsize=@map_data.zsize
  745. @firsttimeflash=false
  746. @oxFlash=@ox-(width>>2)
  747. @oyFlash=@oy-(height>>2)
  748. @flash.ox=0
  749. @flash.oy=0
  750. @flash.src_rect.set(width>>2,
  751. height>>2,
  752.     @viewport.rect.width,@viewport.rect.height)
  753. @flash.bitmap.clear
  754. @[email protected]
  755. @[email protected]
  756. xStart=(@oxFlash>>5)
  757. xStart=0 if xStart<0
  758. yStart=(@oyFlash>>5)
  759. yStart=0 if yStart<0
  760. xEnd=xStart+(width>>5)+1
  761. yEnd=yStart+(height>>5)+1
  762. xEnd=xsize if xEnd>=xsize
  763. yEnd=ysize if yEnd>=ysize
  764. if xStart<xEnd&&yStart<yEnd
  765. yrange=yStart...yEnd
  766. xrange=xStart...xEnd
  767. tmpcolor=Color.new(0,0,0,0)
  768. for y in yrange
  769.   ypos=(y<<5)-@oyFlash
  770.   for x in xrange
  771.     xpos=(x<<5)-@oxFlash
  772. #    id = @flash_data[x, y, 0] #错误的#论证(2对3)
  773. #    r=(id>>8)&15
  774. #    g=(id>>4)&15
  775. #    b=(id)&15
  776. #    tmpcolor.set(r*16,g*16,b*16)
  777.     bitmap.fill_rect(xpos,ypos,32,32,tmpcolor)
  778.   end
  779. end
  780. end
  781. end
  782. def refreshLayer0(autotiles=false)
  783. ptX=@ox-@oxLayer0
  784. ptY=@oy-@oyLayer0
  785. if !autotiles&&!@firsttime&&!@usedsprites&&
  786.   ptX>=0&&[email protected]<[email protected]&&
  787.   ptY>=0&&[email protected]<[email protected]
  788. if @layer0clip
  789.   @layer0.ox=0
  790.   @layer0.oy=0
  791.   @layer0.src_rect.set(ptX.round,ptY.round,
  792.     @viewport.rect.width,@viewport.rect.height)
  793. else
  794.   @layer0.ox=ptX.round
  795.   @layer0.oy=ptY.round
  796.   @layer0.src_rect.set(0,0,@layer0.bitmap.width,@layer0.bitmap.height)
  797. end
  798. return true
  799. end
  800. [email protected]
  801. [email protected]
  802. [email protected]
  803. ysize=@map_data.ysize
  804. xsize=@map_data.xsize
  805. zsize=@map_data.zsize
  806. if autotiles
  807. return true if @fullyrefreshedautos&&@prioautotiles.length==0
  808. return true if !shown?
  809. xStart=(@oxLayer0>>5)
  810. xStart=0 if xStart<0
  811. yStart=(@oyLayer0>>5)
  812. yStart=0 if yStart<0
  813. xEnd=xStart+(width>>5)+1
  814. yEnd=yStart+(height>>5)+1
  815. xEnd=xsize if xEnd>xsize
  816. yEnd=ysize if yEnd>ysize
  817. return true if xStart>=xEnd || yStart>=yEnd
  818. trans=Color.new(0,0,0,0)
  819. temprect=Rect.new(0,0,0,0)
  820. tilerect=Rect.new(0,0,32,32)
  821. range=0...zsize
  822. overallcount=0
  823. count=0
  824. if !@fullyrefreshedautos
  825.   for y in yStart..yEnd
  826.   for x in xStart..xEnd
  827.     haveautotile=false
  828.     for z in range
  829.     id = @map_data[x, y, z]
  830.     next if id<48 || id>=384 || @priorities[id]!=0 || !@priorities[id]
  831.     next if @framecount[id/48-1]<2
  832.     haveautotile=true
  833.     break
  834.     end
  835.     next if !haveautotile
  836.     overallcount+=1
  837.     xpos=(x<<5)-@oxLayer0
  838.     ypos=(y<<5)-@oyLayer0
  839.     bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000
  840.     for z in range
  841.     id = @map_data[x,y,z]
  842.     next if id<48 || @priorities[id]!=0 || !@priorities[id]
  843.     if overallcount>2000
  844.     count=addTile(@autosprites,count,xpos,ypos,id)
  845.     next
  846.     elsif id>=384
  847.     temprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  848.     bitmap.blt(xpos,ypos,@tileset,temprect)
  849.     else
  850.     tilebitmap=@autotileInfo[id]
  851.     if !tilebitmap
  852.       anim=autotileFrame(id)
  853.       next if anim<0
  854.       tilebitmap=Bitmap.new(32,32)
  855.       bltAutotile(tilebitmap,0,0,id,anim)
  856.       @autotileInfo[id]=tilebitmap
  857.     end
  858.     bitmap.blt(xpos,ypos,tilebitmap,tilerect)
  859.     end
  860.     end
  861.   end
  862.   end
  863. else
  864.   for tile in @prioautotiles
  865.   x=tile[0]
  866.   y=tile[1]
  867.   next if x<xStart||x>xEnd
  868.   next if y<yStart||y>yEnd
  869.   overallcount+=1
  870.   xpos=(x<<5)-@oxLayer0
  871.   ypos=(y<<5)-@oyLayer0
  872.   bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000
  873.   for z in range
  874.     id = @map_data[x,y,z]
  875.     next if id<48 || @priorities[id]!=0 || !@priorities[id]
  876.     if overallcount>2000
  877.     count=addTile(@autosprites,count,xpos,ypos,id)
  878.     next
  879.     elsif id>=384
  880.     temprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  881.     bitmap.blt(xpos,ypos,@tileset,temprect)
  882.     else
  883.     tilebitmap=@autotileInfo[id]
  884.     if !tilebitmap
  885.       anim=autotileFrame(id)
  886.       next if anim<0
  887.       tilebitmap=Bitmap.new(32,32)
  888.       bltAutotile(tilebitmap,0,0,id,anim)
  889.       @autotileInfo[id]=tilebitmap
  890.     end
  891.     bitmap.blt(xpos,ypos,tilebitmap,tilerect)
  892.     end
  893.   end
  894.   end
  895. end
  896. Graphics.frame_reset if overallcount>2000
  897. @usedsprites=false
  898. return true
  899. end
  900. return false if @usedsprites
  901. @firsttime=false
  902. @oxLayer0=@ox-(width>>2)
  903. @oyLayer0=@oy-(height>>2)
  904. if @layer0clip
  905. @layer0.ox=0
  906. @layer0.oy=0
  907. @layer0.src_rect.set(width>>2,height>>2,
  908.     @viewport.rect.width,@viewport.rect.height)
  909. else
  910. @layer0.ox=(width>>2)
  911. @layer0.oy=(height>>2)
  912. end
  913. @layer0.bitmap.clear
  914. @[email protected]
  915. @[email protected]
  916. xStart=(@oxLayer0>>5)
  917. xStart=0 if xStart<0
  918. yStart=(@oyLayer0>>5)
  919. yStart=0 if yStart<0
  920. xEnd=xStart+(width>>5)+1
  921. yEnd=yStart+(height>>5)+1
  922. xEnd=xsize if xEnd>=xsize
  923. yEnd=ysize if yEnd>=ysize
  924. if xStart<xEnd&&yStart<yEnd
  925. tmprect=Rect.new(0,0,0,0)
  926. yrange=yStart...yEnd
  927. xrange=xStart...xEnd
  928. for z in 0...zsize
  929.   for y in yrange
  930.   ypos=(y<<5)-@oyLayer0
  931.   for x in xrange
  932.     xpos=(x<<5)-@oxLayer0
  933.     id = @map_data[x, y, z]
  934.     next if id==0 || @priorities[id]!=0 || !@priorities[id]
  935.     if id>=384
  936.     tmprect.set((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32)
  937.     bitmap.blt(xpos,ypos,@tileset,tmprect)
  938.     else
  939.     frame=autotileFrame(id)
  940.     bltAutotile(bitmap,xpos,ypos,id,frame)
  941.     end
  942.   end
  943.   end
  944. end
  945. Graphics.frame_reset
  946. end
  947. return true
  948. end
  949. def getResizeFactor
  950. return $ResizeFactor ? $ResizeFactor : 1.0
  951. end
  952. def ox=(val)
  953.   val=(val*getResizeFactor).to_i
  954.   val=(val/getResizeFactor).to_i
  955.   wasshown=self.shown?
  956.   @ox=val.floor
  957.   @nowshown=(!wasshown&&self.shown?)
  958. end
  959. def oy=(val)
  960.   val=(val*getResizeFactor).to_i
  961.   val=(val/getResizeFactor).to_i
  962.   wasshown=self.shown?
  963.   @oy=val.floor
  964.   @nowshown=(!wasshown&&self.shown?)
  965. end
  966. def visible=(val)
  967.   wasshown=@visible
  968.   @visible=val
  969.   @nowshown=(!wasshown&&val)
  970. end
  971. def refresh(autotiles=false)
  972. @oldOx=@ox
  973. @oldOy=@oy
  974. usesprites=false
  975. if @layer0
  976. @layer0.visible=@visible
  977. usesprites=!refreshLayer0(autotiles)
  978. if autotiles&&!usesprites
  979.   return
  980. end
  981. else
  982. usesprites=true
  983. end
  984. refreshFlashSprite
  985. [email protected]
  986. [email protected]
  987. [email protected]+vpx
  988. [email protected]+vpy
  989. xsize=@map_data.xsize
  990. ysize=@map_data.ysize
  991. minX=(@ox/32)-1
  992. maxX=((@[email protected])/32)+1
  993. minY=(@oy/32)-1
  994. maxY=((@[email protected])/32)+1
  995. minX=0 if minX<0
  996. minX=xsize-1 if minX>=xsize
  997. maxX=0 if maxX<0
  998. maxX=xsize-1 if maxX>=xsize
  999. minY=0 if minY<0
  1000. minY=ysize-1 if minY>=ysize
  1001. maxY=0 if maxY<0
  1002. maxY=ysize-1 if maxY>=ysize
  1003. count=0
  1004. if minX<maxX&&minY<maxY
  1005. @usedsprites=usesprites || @usedsprites
  1006. if @layer0
  1007.   @layer0.visible=false if usesprites
  1008. end
  1009. if @fullyrefreshed
  1010.   for prio in @priotiles
  1011.   next if prio[0]<minX||prio[0]>maxX
  1012.   next if prio[1]<minY||prio[1]>maxY
  1013.   id=prio[3]
  1014.   xpos=(prio[0]<<5)-@ox
  1015.   ypos=(prio[1]<<5)-@oy
  1016.   count=addTile(@tiles,count,xpos,ypos,id)
  1017.   end
  1018. else
  1019.   for z in 0...@map_data.zsize
  1020.   for y in minY..maxY
  1021.     for x in minX..maxX
  1022.     id = @map_data[x, y, z]
  1023.     next if id==0 || !@priorities[id]
  1024.     next if @priorities[id]==0
  1025.     xpos=(x<<5)-@ox
  1026.     ypos=(y<<5)-@oy
  1027.     count=addTile(@tiles,count,xpos,ypos,id)
  1028.     end
  1029.   end
  1030.   end
  1031. end
  1032. end
  1033. if count<@tiles.length
  1034. bigchange=(count<=(@tiles.length*2/3))&&(@tiles.length*2/3)>25
  1035. j=count;[email protected];while j<len
  1036.   sprite=@tiles[j]
  1037.   @tiles[j+1]=-1
  1038.   if bigchange
  1039.   sprite.dispose
  1040.   @tiles[j]=nil
  1041.   @tiles[j+1]=nil
  1042.   elsif !@tiles[j].disposed?
  1043.   sprite.visible=false if sprite.visible
  1044.   end
  1045.   j+=2
  1046. end
  1047. @tiles.compact! if bigchange
  1048. end
  1049. end
  1050. end
复制代码

点评

麻烦把脚本折一下  发表于 2023-4-26 22:27
多谢大神分享!  发表于 2023-4-24 20:18
你才是大神  发表于 2023-4-24 19:32
多谢大神分享!  发表于 2023-4-24 16:57
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9128
在线时间
463 小时
注册时间
2015-5-8
帖子
865
4
 楼主| 发表于 2023-4-24 22:08:55 | 只看该作者
金芒芒 发表于 2023-4-24 16:23
本人不懂脚本瞎调的所以用了很多时间把带五角星的脚本复制过去就行了,地图和窗口背景最好是不要超过1200*7 ...

对了,大神你发的这段1000多行的脚本怎么用啊?
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
5
发表于 2023-4-25 08:10:13 | 只看该作者
本帖最后由 金芒芒 于 2023-4-25 08:44 编辑
taeckle 发表于 2023-4-24 22:08
对了,大神你发的这段1000多行的脚本怎么用啊?


★Game_Resolution 替换掉这个脚本里的内容,这个脚本适应群战,arpg ,战棋,一切在地图上的战斗

脚本1.png (108.3 KB, 下载次数: 2)

脚本1.png
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
39674
在线时间
7485 小时
注册时间
2009-7-6
帖子
13483

开拓者贵宾

6
发表于 2023-4-25 09:24:34 | 只看该作者
真正的拉大分辨率现在已经有明确方案了,但已经失去实现意义,XP用的渲染技术过于古老,拉大分辨率会导致游戏运行效率会极速下滑
(我发过一份不加大分辨率但放大游戏窗口的脚本 : https://rpg.blue/thread-476464-1-1.html  如果你只是想让窗口看起来大一点,可以用这个)
总之个人非常不推荐在XP这个版本上再花功夫扩展分辨率
RGDirect - DirectX驱动的RGSS,点我了解.
RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
7
发表于 2023-4-25 10:15:37 | 只看该作者
本帖最后由 金芒芒 于 2023-4-25 10:36 编辑
fux2 发表于 2023-4-25 09:24
真正的拉大分辨率现在已经有明确方案了,但已经失去实现意义,XP用的渲染技术过于古老,拉大分辨率会导致游 ...


真正的大神你好我的也是窗口扩张加大,不影响画质还是32*32,如果拉伸过大色彩画质太失真了,看起来画面粗糙

点评

不过现在的电脑显示器和手机显示器多是以宽屏为主,最终还是窗口扩展更适应时代,放大最终还是会被淘汰  发表于 2023-4-26 21:45
其实放大整数倍好好,我的工程就是横竖*2,相当于一格的像素变成了4格。像dungrees和蔚蓝这样的像素游戏都是这样处理的  发表于 2023-4-26 11:20
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33188
在线时间
10490 小时
注册时间
2009-3-15
帖子
4756
8
发表于 2023-4-26 21:25:00 | 只看该作者
本帖最后由 soulsaga 于 2023-4-26 21:32 编辑

https://www.bilibili.com/video/BV1SG41177ys

RGU放大的效果
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
9
发表于 2023-4-26 21:42:05 | 只看该作者
soulsaga 发表于 2023-4-26 21:25
https://www.bilibili.com/video/BV1SG41177ys

RGU放大的效果

效果不错,不过现在手机和电脑多是宽屏的所以扩展窗口更具适应游戏发展方向潜能更大

点评

扩展窗口不是指放大窗口而是增加可显示的范围?  发表于 2023-4-29 23:19
RGU也可以扩展就是了  发表于 2023-4-26 23:24
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3841
在线时间
1966 小时
注册时间
2013-1-3
帖子
9536
10
发表于 2023-4-29 22:28:10 | 只看该作者
最简洁的方法是放大画面
至于修改分辨率 RMXP别想了……
你说我们自己做的游戏都不用自己写的脚本改分辨率……
《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 07:09

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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