查看: 4116|回复: 10

[已经解决] RGSS301如何实现分辨率解放?

[复制链接]
梦石
0
星屑
501
在线时间
65 小时
注册时间
2018-4-15
回帖
20
发表于 2018-4-30 00:23:44 | 显示全部楼层 |阅读模式

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

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

×
我用的VA是steam正版,然而网络上和论坛上只有RGSS300.dll的破解版。用夏娜的纯脚本扩大会严重降低FPS,求问RGSS301.DLL应该怎么改?
梦石
0
星屑
7427
在线时间
948 小时
注册时间
2017-9-27
回帖
566
发表于 2018-5-3 22:54:13 | 显示全部楼层
我从TheoAllen的TSBS范例工程里找到一个脚本,实测可以提高游戏分辨率,帧率下降也不太明显。至于是不是跟你用的一些脚本兼容,那就有待于你自己测试了。
  1. #=============================================================================
  2. # Σ Fullscreen
  3. #-----------------------------------------------------------------------------
  4. # @author  : Gabriel "Gab!" Teles
  5. # @date    : 2014-09-27
  6. # @version : 0.91
  7. #-----------------------------------------------------------------------------
  8. # TODO:
  9. #   - Transições por imagens
  10. #-----------------------------------------------------------------------------
  11. # Créditos:
  12. #   Scripter Desconhecido no Pastebin ([url]http://pastebin.com/sM2MNJZj[/url])
  13. #   Esrever : Map viewport/scroll fix
  14. #-----------------------------------------------------------------------------
  15. # Permite utilizar fullscreen real (sem redimensionamento de tela), e alterar
  16. # o limite da função Graphics.resize_screen para a resolução máxima do monitor
  17. # ou um valor próximo.
  18. #=============================================================================

  19. # Módulo Graphics
  20. class << Graphics
  21.   # API
  22.   User32   = DL.dlopen('user32')
  23.   Kernel32 = DL.dlopen('kernel32')
  24.   GetActiveWindow  = DL::CFunc.new(  User32['GetActiveWindow' ], DL::TYPE_LONG)
  25.   GetSystemMetrics = DL::CFunc.new(  User32['GetSystemMetrics'], DL::TYPE_LONG)
  26.   GetWindowRect    = DL::CFunc.new(  User32['GetWindowRect'   ], DL::TYPE_LONG)
  27.   SetWindowLong    = DL::CFunc.new(  User32['SetWindowLong'   ], DL::TYPE_LONG)
  28.   SetWindowPos     = DL::CFunc.new(  User32['SetWindowPos'    ], DL::TYPE_LONG)
  29.   GetModuleHandle  = DL::CFunc.new(Kernel32['GetModuleHandle' ], DL::TYPE_LONG)  
  30.   
  31.   # DLL sendo utilizada
  32.   _DLLName = DL::CPtr.malloc(140)
  33.   s = DL::CFunc.new(Kernel32['GetPrivateProfileString'], DL::TYPE_LONG).call([
  34.     DL::CPtr["Game"].to_i,
  35.     DL::CPtr["Library"].to_i,
  36.     0,
  37.     _DLLName.to_i,
  38.     140,
  39.     DL::CPtr["./Game.ini"].to_i
  40.   ])
  41.   
  42.   @@DLLName = File.basename(_DLLName.to_s(s))
  43.   
  44.   # Verifica se é uma RGSS3xx.dll
  45.   if @@DLLName.match(/^RGSS3(\d{2})\.dll$/)
  46.     @@DLLVersion = $1.to_i
  47.    
  48.     # Verifica se a versão é 0 ou 1.
  49.     if @@DLLVersion.between?(0, 1)
  50.       # Flag de fullscreen
  51.       @@inFullscreen = false
  52.       
  53.       # Instância da DLL. *Necessariamente* a RGSS300.dll ou RGSS301.dll, visto
  54.       # que o trabalho com memória a seguir é específico.
  55.       
  56.       @@DLLHandle   = GetModuleHandle.call([DL::CPtr[@@DLLName].to_i])
  57.       
  58.       # Instância da janela de jogo
  59.       @@hWnd       = GetActiveWindow.call([])
  60.       
  61.       # Tamanho da tela
  62.       @@screenSize = [
  63.         GetSystemMetrics.call([0]),
  64.         GetSystemMetrics.call([1])
  65.       ]
  66.       
  67.       # Calcula o próximo tamanho divisível por 32 para fazer a limitação
  68.       width, height = @@screenSize
  69.       width  += (32 - (width  % 32)) unless (width  % 32).zero?
  70.       height += (32 - (height % 32)) unless (height % 32).zero?
  71.       puts "Limitando para: #{width}x#{height}" if $TEST
  72.       
  73.       #-----------------------------------------------------------------------
  74.       # Bruxaria de scripter desconhecido. Remove a limitação de tamanho para
  75.       # o método Graphics.resize_screen (640x480)
  76.       #
  77.       # Base retirada de: [url]http://pastebin.com/sM2MNJZj[/url]
  78.       #
  79.       # Adaptações para a RGSS300.dll e início do mapeamento dos endereços
  80.       # utilizados por Gab!
  81.       #-----------------------------------------------------------------------
  82.       
  83.       # Número para string
  84.       wh = ->(w, h, off = 0){
  85.         [w + off, h + off].pack('l2').scan(/..../)
  86.       }
  87.       
  88.       # Altera um valor na memória relativa à DLL
  89.       mod = ->(adr, val){
  90.         adr += @@OFF if @@DLLVersion.zero?
  91.         DL::CPtr.new(@@DLLHandle + adr)[0, val.size] = val
  92.       }
  93.       
  94.       # Valores úteis
  95.       wt,  ht  = width.divmod(32), height.divmod(32)
  96.       w,   h   = wh.(width, height)
  97.       ww,  hh  = wh.(width, height, 32)
  98.       www, hhh = wh.(wt.first, ht.first, 1)
  99.       zero     = [0].pack('l')
  100.          
  101.       # Faz as alterações na memória
  102.       
  103.       # Graphics
  104.       @@OFF = 0
  105.       mod.(0x195F, "\x90"*5) # ???
  106.       mod.(0x19A4,   h     ) # ???
  107.       mod.(0x19A9,   w     ) # ???
  108.       mod.(0x1A56,   h     ) # ???
  109.       mod.(0x1A5B,   w     ) # ???
  110.       mod.(0x20F6,   w     ) # Max width  (?)
  111.       mod.(0x20FF,   w     ) # Max width  (?)
  112.       mod.(0x2106,   h     ) # Max height (?)
  113.       mod.(0x210F,   h     ) # Max height (?)
  114.       
  115.       # Plane (?) Class
  116.       @@OFF   = -0xC0
  117.       Graphics::PlaneSpeedUp = false
  118.         # Setando para false não é necessário reescrever classe Plane. No
  119.         # entanto, o mapa fica MUITO lento.
  120.       mod.(0x1C5E3,  Graphics::PlaneSpeedUp ? zero : h) # Max height
  121.       mod.(0x1C5E8,  Graphics::PlaneSpeedUp ? zero : w) # Max width
  122.       
  123.       # ???
  124.       @@OFF = 0x20
  125.       mod.(0x1F477,  h     ) # ???
  126.       mod.(0x1F47C,  w     ) # ???
  127.       
  128.       # Tilemap Class
  129.       @@OFF = 0x1E0
  130.       mod.(0x211FF,  hh    ) # Tilemap render height
  131.       mod.(0x21204,  ww    ) # Tilemap render width
  132.       mod.(0x21D7D,  hhh[0]) # Tilemap max tiles on screen height
  133.       mod.(0x21E01,  www[0]) # Tilemap max tiles on screen width
  134.       
  135.       # ???
  136.       @@OFF = 0x140
  137.       mod.(0x10DEA8, h     ) # ???
  138.       mod.(0x10DEAD, w     ) # ???     
  139.       mod.(0x10DEDF, h     ) # ???
  140.       mod.(0x10DEE3, w     ) # ???
  141.       mod.(0x10DF14, h     ) # ???
  142.       mod.(0x10DF18, w     ) # ???
  143.       mod.(0x10DF48, h     ) # ???
  144.       mod.(0x10DF4C, w     ) # ???
  145.       mod.(0x10E6A7, w     ) # ???
  146.       mod.(0x10E6C3, h     ) # ???
  147.       mod.(0x10EEA9, w     ) # ???
  148.       mod.(0x10EEB9, h     ) # ???
  149.       
  150.       #-------------------------------------------------------------------------
  151.       # Fim da bruxaria
  152.       #-------------------------------------------------------------------------
  153.       
  154.       # Sprite de transição de tela
  155.       @@TransitionSprite = Sprite.new
  156.       @@TransitionSprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  157.       @@TransitionSprite.bitmap.fill_rect(@@TransitionSprite.bitmap.rect, Color.new(0, 0, 0))
  158.       @@TransitionSprite.opacity = 255
  159.       @@TransitionSprite.z = 0x7FFFFFFF
  160.       
  161.       # Bitmap da tela no momento do Graphics.freeze
  162.       @@FrozenBitmap = Bitmap.new(Graphics.width, Graphics.height)
  163.       @@FrozenBitmap.fill_rect(@@FrozenBitmap.rect, Color.new(0, 0, 0))
  164.       
  165.       # Realiza a transição de tela
  166.       # Nota: Não é possível realizar transição de tela com imagens
  167.       alias oldFullscreenResTransition transition
  168.       def transition(time, image='', vague=40)
  169.         @@TransitionSprite.bitmap.dispose
  170.         @@TransitionSprite.dispose
  171.         @@TransitionSprite = Sprite.new
  172.         @@TransitionSprite.bitmap = @@FrozenBitmap
  173.         @@TransitionSprite.opacity = 255
  174.         @@TransitionSprite.z = 0x7FFFFFFF
  175.       
  176.         oldFullscreenResTransition(0)
  177.         
  178.         dec = (255.0 / time)
  179.         time.times {
  180.           @@TransitionSprite.opacity -= dec
  181.           Graphics.update
  182.         }
  183.       end
  184.       
  185.       # Fadein
  186.       def fadein(time)
  187.         @@FrozenBitmap = Bitmap.new(Graphics.width, Graphics.height)
  188.         @@FrozenBitmap.fill_rect(@@FrozenBitmap.rect, Color.new(0, 0, 0))
  189.         
  190.         transition(time)
  191.       end
  192.       
  193.       # Fadeout
  194.       def fadeout(time)
  195.         inc = (255.0 / time)
  196.         time.times {
  197.           @@TransitionSprite.opacity += inc
  198.           Graphics.update
  199.         }
  200.       end
  201.       
  202.       # Armazena a imagem da tela
  203.       alias oldFullscreenResFreeze freeze
  204.       def freeze(*a, &b)
  205.         oldFullscreenResFreeze(*a, &b)
  206.         @@FrozenBitmap = Graphics.snap_to_bitmap
  207.       end
  208.       
  209.       # Realiza o redimensionamento de tela
  210.       alias gabFullscreenOldResizeScreen resize_screen
  211.       def resize_screen(*a, &b)
  212.         # Redimensiona normalmente
  213.         gabFullscreenOldResizeScreen(*a, &b)
  214.         # Redimensiona o sprite de transição
  215.         @@TransitionSprite.bitmap.dispose
  216.         @@TransitionSprite.bitmap = Bitmap.new(*Graphics.size)
  217.         @@TransitionSprite.bitmap.fill_rect(@@TransitionSprite.bitmap.rect, Color.new(0, 0, 0))
  218.         
  219.         if Graphics::PlaneSpeedUp
  220.           # Manda o sinal de atualização para todas as instâncias da classe Plane
  221.           ObjectSpace.each_object(Plane){|plane|
  222.             plane.send(:recreateBitmap)
  223.           }
  224.         end
  225.       end
  226.       
  227.       # Altera para fullscreen
  228.       def fullscreen
  229.         # Retorna se já estiver em fullscreen
  230.         return if @@inFullscreen
  231.         # Tamanho antes do fullscreen
  232.         rect = DL::CPtr.malloc(16)
  233.         rect[0, 16] = 0.chr * 16
  234.         GetWindowRect.call([@@hWnd, rect])
  235.         @@windowSize = rect[0, 16].unpack("l*")
  236.         @@windowSize[2] -= @@windowSize[0]
  237.         @@windowSize[3] -= @@windowSize[1]
  238.         @@windowResolution = Graphics.size
  239.         # Muda o tamanho da tela
  240.         Graphics.resize_screen(*@@screenSize)
  241.         # Remover bordas da janela
  242.         SetWindowLong.call([@@hWnd, -16, 0x14000000])
  243.         # Coloca a janela acima de todas as outras
  244.         SetWindowPos.call([@@hWnd, -1, 0, 0, *@@screenSize, 0])
  245.         # Modifica a flag de fullscreen
  246.         @@inFullscreen = true
  247.         # Espera alguns frames para terminar o processamento
  248.         Graphics.wait(5)
  249.       end
  250.       
  251.       # Altera para modo janela
  252.       def windowed
  253.         # Retorna se não estiver em fullscreen
  254.         return unless @@inFullscreen
  255.         # Muda o tamanho da tela
  256.         Graphics.resize_screen(*@@windowResolution)
  257.         # Recoloca bordas da janela
  258.         SetWindowLong.call([@@hWnd, -16, 0x14CA0000])
  259.         # Coloca a janela na posição x,y,z comum e ajusta seu tamanho
  260.         SetWindowPos.call([@@hWnd, 0, *@@windowSize, 0])
  261.         # Modifica a flag de fullscreen
  262.         @@inFullscreen = false
  263.         # Espera alguns frames para terminar o processamento
  264.         Graphics.wait(5)
  265.       end
  266.       
  267.       # Tamanho da tela
  268.       def size
  269.         [self.width, self.height]
  270.       end
  271.       
  272.       # Verifica se a janela está no modo fullscreen
  273.       def fullscreen?
  274.         return @@inFullscreen
  275.       end
  276.       
  277.       # Verifica se a janela está no modo janela
  278.       def windowed?
  279.         return !@@inFullscreen
  280.       end
  281.       
  282.       # Alterna entre os modos fullscreen e janela
  283.       def toggleFullscreen
  284.         @@inFullscreen ? self.windowed : self.fullscreen
  285.       end
  286.     end
  287.   end
  288. end

  289. if Graphics::PlaneSpeedUp
  290.   # Remove a classe Plane Anterior
  291.   Object.send(:remove_const, :Plane)
  292.   # Redefinição da classe Plane
  293.   class Plane
  294.     attr_reader :viewport
  295.     attr_reader :bitmap
  296.     attr_reader :ox
  297.     attr_reader :oy
  298.     attr_reader :opacity
  299.     attr_reader :blend_type
  300.     attr_reader :color
  301.     attr_reader :tone
  302.     attr_reader :visible
  303.     attr_reader :zoom_x
  304.     attr_reader :zoom_y
  305.     attr_reader :z
  306.    
  307.     # Inicialização do objeto
  308.     def initialize(viewport = nil)
  309.       # É necessário verificar se um viewport foi enviado. Desse modo, ao mudar a
  310.       # resolução da tela, deve-se mudar também a rect do viewport para que o
  311.       # Plane que ocupava a tela toda continue
  312.       @defaultViewport = !viewport.is_a?(Viewport)
  313.       @viewport = @defaultViewport ? Viewport.new(0, 0, *Graphics.size) : viewport
  314.       
  315.       @sprite        = Sprite.new(@viewport)
  316.       @bitmap        = nil
  317.       @ox            = @sprite.ox         # 0
  318.       @oy            = @sprite.oy         # 0
  319.       @opacity       = @sprite.opacity    # 255
  320.       @blend_type    = @sprite.blend_type # 0
  321.       @color         = @sprite.color      # Color.new(0, 0, 0, 0)
  322.       @tone          = @sprite.tone       # Tone.new(0, 0, 0, 0)
  323.       @visible       = @sprite.visible    # true
  324.       @z             = @sprite.z          # 0
  325.       @zoom_x        = @sprite.zoom_x     # 1.0
  326.       @zoom_y        = @sprite.zoom_y     # 1.0
  327.     end
  328.    
  329.     def bitmap=(bitmap)
  330.       return unless bitmap.is_a?(Bitmap)
  331.       @bitmap = bitmap
  332.       self.recreateBitmap(true)
  333.     end
  334.    
  335.     def ox=(value)
  336.       @ox = value
  337.       return if @bitmap.nil?
  338.       @sprite.ox = (value % @bitmap.width)
  339.     end
  340.    
  341.     def oy=(value)
  342.       @oy = value
  343.       return if @bitmap.nil?
  344.       @sprite.oy = (value % @bitmap.height)
  345.     end
  346.    
  347.     def opacity=(value)
  348.       @sprite.opacity = value
  349.       @opacity = @sprite.opacity
  350.     end
  351.    
  352.     def blend_type=(value)
  353.       @sprite.blend_type = value
  354.       @blend_type = @sprite.blend_type
  355.     end
  356.    
  357.     def color=(value)
  358.       @sprite.color = value
  359.       @color = @sprite.color
  360.     end
  361.    
  362.     def tone=(value)
  363.       @sprite.tone = value
  364.       @tone = @sprite.tone
  365.     end
  366.    
  367.     def viewport=(value)
  368.       @defaultViewport &= (value == @sprite.viewport)
  369.       @sprite.viewport = value
  370.       @viewport = @sprite.viewport
  371.     end
  372.    
  373.     def visible=(value)
  374.       @sprite.visible = value
  375.       @visible = sprite.visible
  376.     end
  377.    
  378.     def z=(value)
  379.       @sprite.z = value
  380.       @z = @sprite.z
  381.     end
  382.    
  383.     def zoom_x=(value)
  384.       @sprite.zoom_x = value
  385.       @zoom_x = @sprite.zoom_x
  386.       self.recreateBitmap
  387.     end
  388.    
  389.     def zoom_y=(value)
  390.       @sprite.zoom_y = value
  391.       @zoom_y = @sprite.zoom_y
  392.       self.recreateBitmap
  393.     end
  394.    
  395.     def disposed?
  396.       return @sprite.disposed?
  397.     end
  398.    
  399.     def dispose
  400.       @sprite.dispose
  401.     end
  402.    
  403.     protected
  404.    
  405.     def recreateBitmap(forceRefresh = false)
  406.       cw, ch      = Graphics.width * (2.0/@zoom_x), Graphics.height * (2.0/@zoom_y)
  407.       needRefresh = true
  408.       
  409.       if @defaultViewport
  410.         @viewport.rect.width, @viewport.rect.height = *Graphics.size
  411.       end
  412.       
  413.       if @sprite.bitmap.nil? or @sprite.bitmap.disposed?
  414.         newBitmap = Bitmap.new(cw, ch)
  415.       else
  416.         if (cw == @sprite.bitmap.width) and (ch == @sprite.bitmap.height) and (!forceRefresh)
  417.           return
  418.         end
  419.         
  420.         newBitmap = Bitmap.new(cw, ch)
  421.         if (cw < @sprite.bitmap.width) and (ch < @sprite.bitmap.height)
  422.           newBitmap.blt(0, 0, @sprite.bitmap, @sprite.bitmap.rect)
  423.           @sprite.bitmap.dispose
  424.           needRefresh = false
  425.         end
  426.       end
  427.       
  428.       @sprite.bitmap = newBitmap
  429.       self.refreshBitmap if needRefresh or forceRefresh
  430.     end
  431.    
  432.     def refreshBitmap
  433.       # Limpa o bitmap
  434.       b = @sprite.bitmap
  435.       b.clear
  436.       
  437.       return if @bitmap.nil?
  438.       
  439.       # Quantia de espaços para blt
  440.       tx = (b.width  / @bitmap.width.to_f )
  441.       ty = (b.height / @bitmap.height.to_f)
  442.       
  443.       b.blt(0, 0, @bitmap, @bitmap.rect)
  444.       
  445.       return if tx + ty == 2
  446.       
  447.       # Preenche 1 linha
  448.       basePow = @bitmap.width
  449.       baseRct = Rect.new(0, 0, @bitmap.width, @bitmap.height)
  450.       
  451.       Math.log2(tx).floor.times{
  452.         b.blt(basePow, 0, b, baseRct)
  453.         baseRct.width += basePow
  454.         basePow *= 2
  455.       }
  456.       
  457.       # Último bitmap da linha
  458.       baseRct.width = (b.width - baseRct.width)
  459.       b.blt(basePow, 0, b, baseRct)
  460.       
  461.       # Preenche o restante das linhas
  462.       basePow = @bitmap.height
  463.       baseRct = Rect.new(0, 0, b.width, @bitmap.height)
  464.       
  465.       Math.log2(ty).floor.times{
  466.         b.blt(0, basePow, b, baseRct)
  467.         baseRct.height += basePow
  468.         basePow *= 2
  469.       }
  470.       
  471.       # Última linha
  472.       baseRct.height = b.height - baseRct.height
  473.       b.blt(basePow, 0, b, baseRct)
  474.     end
  475.   end
  476. end

  477. class Game_Map
  478.   # Número de tiles horizontais na tela
  479.   def screen_tile_x
  480.     (Graphics.width / 32.0).ceil
  481.   end
  482.   
  483.   # Número de tiles verticais na tela
  484.   def screen_tile_y
  485.     (Graphics.height / 32.0).ceil
  486.   end
  487. end

  488. # Contador de FPS para o modo Fullscreen
  489. if $TEST
  490.   class << Graphics
  491.     @@FPSSprite = Sprite.new
  492.     @@FPSSprite.bitmap = Bitmap.new(100, 25)
  493.     @@FPSSprite.x = 10
  494.     @@FPSSprite.y = 10
  495.     @@FPSSprite.z = 0x7FFFFFFF
  496.     @@FPSTime  = Time.new.to_f
  497.     @@FPSCount = 0
  498.    
  499.     alias oldFullscreenFPSupdate update
  500.     def update(*a, &b)
  501.       oldFullscreenFPSupdate(*a, &b)
  502.       
  503.       @@FPSCount += 1
  504.       time = Time.new.to_f
  505.       
  506.       if (time - @@FPSTime >= 1)
  507.         if (@@FPSSprite.visible)
  508.           @@FPSSprite.bitmap.clear
  509.           @@FPSSprite.bitmap.fill_rect(@@FPSSprite.bitmap.rect, Color.new(0, 0, 0, 127))
  510.           @@FPSSprite.bitmap.draw_text(@@FPSSprite.bitmap.rect, "#{@@FPSCount} FPS", 1)
  511.         end
  512.         
  513.         @@FPSTime = time
  514.         @@FPSCount = 0
  515.       end
  516.       
  517.       @@FPSSprite.visible ^= true if Input.trigger?(:F5)
  518.     end
  519.   end
  520. end

  521. #==============================================================================
  522. # ▼ Viewports/Map Fix for Modified RGSS300.dll File
  523. #   Origin of Code: Yanfly Engine Ace - Ace Core Engine v1.06
  524. # -- Last Updated: 2011.12.26
  525. # -- Level: Easy, Normal
  526. # -- Requires: n/a
  527. #==============================================================================

  528. #==============================================================================
  529. # ■ Game_Map
  530. #==============================================================================

  531. class Game_Map

  532.   #--------------------------------------------------------------------------
  533.   # overwrite method: scroll_down
  534.   #--------------------------------------------------------------------------
  535.   def scroll_down(distance)
  536.     if loop_vertical?
  537.       @display_y += distance
  538.       @display_y %= @map.height * 256
  539.       @parallax_y += distance
  540.     else
  541.       last_y = @display_y
  542.       dh = Graphics.height > height * 32 ? height : screen_tile_y
  543.       @display_y = [@display_y + distance, height - dh].min
  544.       @parallax_y += @display_y - last_y
  545.     end
  546.   end

  547.   #--------------------------------------------------------------------------
  548.   # overwrite method: scroll_right
  549.   #--------------------------------------------------------------------------
  550.   def scroll_right(distance)
  551.     if loop_horizontal?
  552.       @display_x += distance
  553.       @display_x %= @map.width * 256
  554.       @parallax_x += distance
  555.     else
  556.       last_x = @display_x
  557.       dw = Graphics.width > width * 32 ? width : screen_tile_x
  558.       @display_x = [@display_x + distance, width - dw].min
  559.       @parallax_x += @display_x - last_x
  560.     end
  561.   end

  562. end # Game_Map

  563. #==============================================================================
  564. # ■ Spriteset_Map
  565. #==============================================================================

  566. class Spriteset_Map

  567.   #--------------------------------------------------------------------------
  568.   # overwrite method: create_viewports
  569.   #--------------------------------------------------------------------------
  570.   def create_viewports
  571.     if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  572.       dx = (Graphics.width - $game_map.width * 32) / 2
  573.     else
  574.       dx = 0
  575.     end
  576.     dw = [Graphics.width, $game_map.width * 32].min
  577.     dw = Graphics.width if $game_map.loop_horizontal?
  578.     if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  579.       dy = (Graphics.height - $game_map.height * 32) / 2
  580.     else
  581.       dy = 0
  582.     end
  583.     dh = [Graphics.height, $game_map.height * 32].min
  584.     dh = Graphics.height if $game_map.loop_vertical?
  585.     @viewport1 = Viewport.new(dx, dy, dw, dh)
  586.     @viewport2 = Viewport.new(dx, dy, dw, dh)
  587.     @viewport3 = Viewport.new(dx, dy, dw, dh)
  588.     @viewport2.z = 50
  589.     @viewport3.z = 100
  590.   end

  591.   #--------------------------------------------------------------------------
  592.   # new method: update_viewport_sizes
  593.   #--------------------------------------------------------------------------
  594.   def update_viewport_sizes
  595.     if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  596.       dx = (Graphics.width - $game_map.width * 32) / 2
  597.     else
  598.       dx = 0
  599.     end
  600.     dw = [Graphics.width, $game_map.width * 32].min
  601.     dw = Graphics.width if $game_map.loop_horizontal?
  602.     if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  603.       dy = (Graphics.height - $game_map.height * 32) / 2
  604.     else
  605.       dy = 0
  606.     end
  607.     dh = [Graphics.height, $game_map.height * 32].min
  608.     dh = Graphics.height if $game_map.loop_vertical?
  609.     rect = Rect.new(dx, dy, dw, dh)
  610.     for viewport in [@viewport1, @viewport2, @viewport3]
  611.       viewport.rect = rect
  612.     end
  613.   end

  614. end # Spriteset_Map

  615. #==============================================================================
  616. # ■ Scene_Map
  617. #==============================================================================

  618. class Scene_Map < Scene_Base

  619.   #--------------------------------------------------------------------------
  620.   # alias method: post_transfer
  621.   #--------------------------------------------------------------------------
  622.   alias scene_map_post_transfer_ace post_transfer
  623.   def post_transfer
  624.     @spriteset.update_viewport_sizes
  625.     scene_map_post_transfer_ace
  626.   end

  627. end # Scene_Map

  628. #==============================================================================
  629. # ■ Game_Event
  630. #==============================================================================

  631. class Game_Event < Game_Character

  632.   #--------------------------------------------------------------------------
  633.   # overwrite method: near_the_screen?
  634.   #--------------------------------------------------------------------------
  635.   def near_the_screen?(dx = nil, dy = nil)
  636.     dx = [Graphics.width, $game_map.width * 256].min/32 - 5 if dx.nil?
  637.     dy = [Graphics.height, $game_map.height * 256].min/32 - 5 if dy.nil?
  638.     ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32
  639.     ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32
  640.     ax >= -dx && ax <= dx && ay >= -dy && ay <= dy
  641.   end

  642. end # Game_Event

  643. # Chama o método que realiza a mudança de tamanho
  644. #Graphics.fullscreen
  645. Graphics.resize_screen(1024, 600)

  646. __END__
  647. # TESTES
  648. # Graphics.windowed
  649. x = Bitmap.new(50, 50)
  650. x.gradient_fill_rect(0,  0, 50, 25, Color.new(255, 0, 0), Color.new(0, 255, 0))
  651. x.gradient_fill_rect(0, 25, 50, 25, Color.new(0, 255, 0), Color.new(0, 0, 255))
  652. y = Plane.new
  653. y.bitmap = x
  654. Graphics.fullscreen
  655. #Graphics.windowed
  656. loop do
  657.   Graphics.update
  658.   y.ox += 1
  659.   y.oy += 1
  660. end
复制代码

点评

这并没有提高分辨率……能同时显示在游戏画面的像素点数量并没有改变  发表于 2018-5-4 07:04
回复

使用道具 举报

梦石
0
星屑
7427
在线时间
948 小时
注册时间
2017-9-27
回帖
566
发表于 2018-5-4 13:16:19 | 显示全部楼层
可见像素不变?那谁能告诉我,下面这两张图的可见像素是一样的吗?
PicPick_20180504_131433_001.png PicPick_20180504_131525_001.png
回复 0 1

使用道具 举报

梦石
0
星屑
501
在线时间
65 小时
注册时间
2018-4-15
回帖
20
 楼主| 发表于 2018-5-4 15:37:57 | 显示全部楼层
梦想家大魔王 发表于 2018-5-4 13:16
可见像素不变?那谁能告诉我,下面这两张图的可见像素是一样的吗?

我用了这个脚本之后FPS降到8= =

点评

那是你太贪心了,窗口弄得太大了吧。  发表于 2018-5-4 16:27
回复

使用道具 举报

梦石
0
星屑
501
在线时间
65 小时
注册时间
2018-4-15
回帖
20
 楼主| 发表于 2018-5-6 21:54:11 | 显示全部楼层
我用RMMV好了
回复

使用道具 举报

梦石
0
星屑
4628
在线时间
1208 小时
注册时间
2016-4-7
回帖
944

开拓者

发表于 2018-5-6 23:58:29 | 显示全部楼层

点评

现在去找别的脚本,有一种49年入国军的感觉  发表于 2018-5-7 00:38
附庸的附庸不是我的附庸,女儿的女儿还是我的女儿。CK2沉迷ing
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部