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

Project1

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

[已经过期] 切换地图的时候变成这样了

[复制链接]

Lv2.观梦者

梦石
0
星屑
936
在线时间
74 小时
注册时间
2018-7-8
帖子
38
跳转到指定楼层
1
发表于 2020-2-28 17:10:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 VIPArcher 于 2022-6-10 16:37 编辑

用了一个放大分辨率的脚本
结果切换地图的时候就这样了

这是那个放大分辨率的脚本,默认把屏幕调到800×600
RUBY 代码复制
  1. #   Esrever : Map viewport/scroll fix
  2. #   Zeus81  : FPS Display
  3. #-----------------------------------------------------------------------------
  4. # Permite utilizar fullscreen real (sem redimensionamento de tela), e alterar
  5. # o limite da função Graphics.resize_screen para a resolução máxima do monitor
  6. # ou um valor próximo.
  7. #=============================================================================
  8.  
  9. # Módulo Graphics
  10. class << Graphics
  11.   # API
  12.   User32   = DL.dlopen('user32')
  13.   Kernel32 = DL.dlopen('kernel32')
  14.   GetActiveWindow  = DL::CFunc.new(  User32['GetActiveWindow' ], DL::TYPE_LONG)
  15.   GetSystemMetrics = DL::CFunc.new(  User32['GetSystemMetrics'], DL::TYPE_LONG)
  16.   GetWindowRect    = DL::CFunc.new(  User32['GetWindowRect'   ], DL::TYPE_LONG)
  17.   SetWindowLong    = DL::CFunc.new(  User32['SetWindowLong'   ], DL::TYPE_LONG)
  18.   SetWindowPos     = DL::CFunc.new(  User32['SetWindowPos'    ], DL::TYPE_LONG)
  19.   GetModuleHandle  = DL::CFunc.new(Kernel32['GetModuleHandle' ], DL::TYPE_LONG)  
  20.  
  21.   # DLL sendo utilizada
  22.   _DLLName = DL::CPtr.malloc(140)
  23.   s = DL::CFunc.new(Kernel32['GetPrivateProfileString'], DL::TYPE_LONG).call([
  24.     DL::CPtr["Game"].to_i,
  25.     DL::CPtr["Library"].to_i,
  26.     0,
  27.     _DLLName.to_i,
  28.     140,
  29.     DL::CPtr["./Game.ini"].to_i
  30.   ])
  31.  
  32.   @@DLLName = File.basename(_DLLName.to_s(s))
  33.  
  34.   # Verifica se é uma RGSS3xx.dll
  35.   if @@DLLName.match(/^RGSS3(\d{2})\.dll$/)
  36.     @@DLLVersion = $1.to_i
  37.  
  38.     # Verifica se a versão é 0 ou 1.
  39.     if @@DLLVersion.between?(0, 1)
  40.       # Flag de fullscreen
  41.       @@inFullscreen = false
  42.  
  43.       # Instância da DLL. *Necessariamente* a RGSS300.dll ou RGSS301.dll, visto
  44.       # que o trabalho com memória a seguir é específico.
  45.  
  46.       @@DLLHandle   = GetModuleHandle.call([DL::CPtr[@@DLLName].to_i])
  47.  
  48.       # Instância da janela de jogo
  49.       @@hWnd       = GetActiveWindow.call([])
  50.  
  51.       # Tamanho da tela
  52.       @@screenSize = [
  53.         GetSystemMetrics.call([0]),
  54.         GetSystemMetrics.call([1])
  55.       ]
  56.  
  57.       # Calcula o próximo tamanho divisível por 32 para fazer a limitação
  58.       width, height = @@screenSize
  59.       width  += (32 - (width  % 32)) unless (width  % 32).zero?
  60.       height += (32 - (height % 32)) unless (height % 32).zero?
  61.       puts "Limitando para: #{width}x#{height}" if $TEST
  62.  
  63.       #-----------------------------------------------------------------------
  64.       # Bruxaria de scripter desconhecido. Remove a limitação de tamanho para
  65.       # o método Graphics.resize_screen (640x480)
  66.       #
  67.       # Base retirada de: [url]http://pastebin.com/sM2MNJZj[/url]
  68.       #
  69.       # Adaptações para a RGSS300.dll e início do mapeamento dos endereços
  70.       # utilizados por Gab!
  71.       #-----------------------------------------------------------------------
  72.  
  73.       # Número para string
  74.       wh = ->(w, h, off = 0){
  75.         [w + off, h + off].pack('l2').scan(/..../)
  76.       }
  77.  
  78.       # Altera um valor na memória relativa à DLL
  79.       mod = ->(adr, val){
  80.         adr += @@OFF if @@DLLVersion.zero?
  81.         DL::CPtr.new(@@DLLHandle + adr)[0, val.size] = val
  82.       }
  83.  
  84.       # Valores úteis
  85.       wt,  ht  = width.divmod(32), height.divmod(32)
  86.       w,   h   = wh.(width, height)
  87.       ww,  hh  = wh.(width, height, 32)
  88.       www, hhh = wh.(wt.first, ht.first, 1)
  89.       zero     = [0].pack('l')
  90.  
  91.       # Faz as alterações na memória
  92.  
  93.       # Graphics
  94.       @@OFF = 0
  95.       mod.(0x195F, "\x90"*5) # ???
  96.       mod.(0x19A4,   h     ) # ???
  97.       mod.(0x19A9,   w     ) # ???
  98.       mod.(0x1A56,   h     ) # ???
  99.       mod.(0x1A5B,   w     ) # ???
  100.       mod.(0x20F6,   w     ) # Max width  (?)
  101.       mod.(0x20FF,   w     ) # Max width  (?)
  102.       mod.(0x2106,   h     ) # Max height (?)
  103.       mod.(0x210F,   h     ) # Max height (?)
  104.  
  105.       # Plane (?) Class
  106.       @@OFF   = -0xC0
  107.       Graphics::PlaneSpeedUp = true
  108.         # Setando para false não é necessário reescrever classe Plane. No
  109.         # entanto, o mapa fica MUITO lento.
  110.       mod.(0x1C5E3,  Graphics::PlaneSpeedUp ? zero : h) # Max height
  111.       mod.(0x1C5E8,  Graphics::PlaneSpeedUp ? zero : w) # Max width
  112.  
  113.       # ???
  114.       @@OFF = 0x20
  115.       mod.(0x1F477,  h     ) # ???
  116.       mod.(0x1F47C,  w     ) # ???
  117.  
  118.       # Tilemap Class
  119.       @@OFF = 0x1E0
  120.       mod.(0x211FF,  hh    ) # Tilemap render height
  121.       mod.(0x21204,  ww    ) # Tilemap render width
  122.       mod.(0x21D7D,  hhh[0]) # Tilemap max tiles on screen height
  123.       mod.(0x21E01,  www[0]) # Tilemap max tiles on screen width
  124.  
  125.       # ???
  126.       @@OFF = 0x140
  127.       mod.(0x10DEA8, h     ) # ???
  128.       mod.(0x10DEAD, w     ) # ???   
  129.       mod.(0x10DEDF, h     ) # ???
  130.       mod.(0x10DEE3, w     ) # ???
  131.       mod.(0x10DF14, h     ) # ???
  132.       mod.(0x10DF18, w     ) # ???
  133.       mod.(0x10DF48, h     ) # ???
  134.       mod.(0x10DF4C, w     ) # ???
  135.       mod.(0x10E6A7, w     ) # ???
  136.       mod.(0x10E6C3, h     ) # ???
  137.       mod.(0x10EEA9, w     ) # ???
  138.       mod.(0x10EEB9, h     ) # ???
  139.  
  140.       #-------------------------------------------------------------------------
  141.       # Fim da bruxaria
  142.       #-------------------------------------------------------------------------
  143.  
  144.       # Sprite de transição de tela
  145.       @@TransitionSprite = Sprite.new
  146.       @@TransitionSprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  147.       @@TransitionSprite.bitmap.fill_rect(@@TransitionSprite.bitmap.rect, Color.new(0, 0, 0))
  148.       @@TransitionSprite.opacity = 0
  149.       @@TransitionSprite.z = 0x7FFFFFFF
  150.  
  151.       # Bitmap da tela no momento do Graphics.freeze
  152.       @@FrozenBitmap = Bitmap.new(Graphics.width, Graphics.height)
  153.       @@FrozenBitmap.fill_rect(@@FrozenBitmap.rect, Color.new(0, 0, 0))
  154.  
  155.       # Realiza a transição de tela
  156.       # Nota: Não é possível realizar transição de tela com imagens
  157.       alias oldFullscreenResTransition transition
  158.       def transition(time, image='', vague=40)
  159.         @@TransitionSprite.bitmap.dispose
  160.         @@TransitionSprite.dispose
  161.         @@TransitionSprite = Sprite.new
  162.         @@TransitionSprite.bitmap = @@FrozenBitmap
  163.         @@TransitionSprite.opacity = 255
  164.         @@TransitionSprite.z = 0x7FFFFFFF
  165.  
  166.         oldFullscreenResTransition(0)
  167.  
  168.         dec = (255.0 / time)
  169.         time.times {
  170.           @@TransitionSprite.opacity -= dec
  171.           Graphics.update
  172.         }
  173.       end
  174.  
  175.       # Fadein
  176.       def fadein(time)
  177.         @@FrozenBitmap = Bitmap.new(Graphics.width, Graphics.height)
  178.         @@FrozenBitmap.fill_rect(@@FrozenBitmap.rect, Color.new(0, 0, 0))
  179.  
  180.         transition(time)
  181.       end
  182.  
  183.       # Fadeout
  184.       def fadeout(time)
  185.         inc = (255.0 / time)
  186.         time.times {
  187.           @@TransitionSprite.opacity += inc
  188.           Graphics.update
  189.         }
  190.       end
  191.  
  192.       # Armazena a imagem da tela
  193.       alias oldFullscreenResFreeze freeze
  194.       def freeze(*a, &b)
  195.         oldFullscreenResFreeze(*a, &b)
  196.         @@FrozenBitmap = Graphics.snap_to_bitmap
  197.       end
  198.  
  199.       # Realiza o redimensionamento de tela
  200.       alias gabFullscreenOldResizeScreen resize_screen
  201.       def resize_screen(*a, &b)
  202.         # Redimensiona normalmente
  203.         gabFullscreenOldResizeScreen(*a, &b)
  204.         # Redimensiona o sprite de transição
  205.         @@TransitionSprite.bitmap.dispose
  206.         @@TransitionSprite.bitmap = Bitmap.new(*Graphics.size)
  207.         @@TransitionSprite.bitmap.fill_rect(@@TransitionSprite.bitmap.rect, Color.new(0, 0, 0))
  208.  
  209.         if Graphics::PlaneSpeedUp
  210.           # Manda o sinal de atualização para todas as instâncias da classe Plane
  211.           ObjectSpace.each_object(Plane){|plane|
  212.             plane.send(:recreateBitmap)
  213.           }
  214.         end
  215.       end
  216.  
  217.       # Altera para fullscreen
  218.       def fullscreen
  219.         # Retorna se já estiver em fullscreen
  220.         return if @@inFullscreen
  221.         # Tamanho antes do fullscreen
  222.         rect = DL::CPtr.malloc(16)
  223.         rect[0, 16] = 0.chr * 16
  224.         GetWindowRect.call([@@hWnd, rect])
  225.         @@windowSize = rect[0, 16].unpack("l*")
  226.         @@windowSize[2] -= @@windowSize[0]
  227.         @@windowSize[3] -= @@windowSize[1]
  228.         @@windowResolution = Graphics.size
  229.         # Muda o tamanho da tela
  230.         Graphics.resize_screen(*@@screenSize)
  231.         # Remover bordas da janela
  232.         SetWindowLong.call([@@hWnd, -16, 0x14000000])
  233.         # Coloca a janela acima de todas as outras
  234.         SetWindowPos.call([@@hWnd, -1, 0, 0, *@@screenSize, 0])
  235.         # Modifica a flag de fullscreen
  236.         @@inFullscreen = true
  237.         # Espera alguns frames para terminar o processamento
  238.         Graphics.wait(5)
  239.       end
  240.  
  241.       # Altera para modo janela
  242.       def windowed
  243.         # Retorna se não estiver em fullscreen
  244.         return unless @@inFullscreen
  245.         # Muda o tamanho da tela
  246.         Graphics.resize_screen(*@@windowResolution)
  247.         # Recoloca bordas da janela
  248.         SetWindowLong.call([@@hWnd, -16, 0x14CA0000])
  249.         # Coloca a janela na posição x,y,z comum e ajusta seu tamanho
  250.         SetWindowPos.call([@@hWnd, 0, *@@windowSize, 0])
  251.         # Modifica a flag de fullscreen
  252.         @@inFullscreen = false
  253.         # Espera alguns frames para terminar o processamento
  254.         Graphics.wait(5)
  255.       end
  256.  
  257.       # Tamanho da tela
  258.       def size
  259.         [self.width, self.height]
  260.       end
  261.  
  262.       # Verifica se a janela está no modo fullscreen
  263.       def fullscreen?
  264.         return @@inFullscreen
  265.       end
  266.  
  267.       # Verifica se a janela está no modo janela
  268.       def windowed?
  269.         return !@@inFullscreen
  270.       end
  271.  
  272.       # Alterna entre os modos fullscreen e janela
  273.       def toggleFullscreen
  274.         @@inFullscreen ? self.windowed : self.fullscreen
  275.       end
  276.     end
  277.   end
  278. end
  279.  
  280. if Graphics::PlaneSpeedUp
  281.   # Remove a classe Plane Anterior
  282.   Object.send(:remove_const, :Plane)
  283.   # Redefinição da classe Plane
  284.   class Plane
  285.     attr_reader :viewport
  286.     attr_reader :bitmap
  287.     attr_reader :ox
  288.     attr_reader :oy
  289.     attr_reader :opacity
  290.     attr_reader :blend_type
  291.     attr_reader :color
  292.     attr_reader :tone
  293.     attr_reader :visible
  294.     attr_reader :zoom_x
  295.     attr_reader :zoom_y
  296.     attr_reader :z
  297.  
  298.     # Inicialização do objeto
  299.     def initialize(viewport = nil)
  300.       # É necessário verificar se um viewport foi enviado. Desse modo, ao mudar a
  301.       # resolução da tela, deve-se mudar também a rect do viewport para que o
  302.       # Plane que ocupava a tela toda continue
  303.       @defaultViewport = !viewport.is_a?(Viewport)
  304.       @viewport = @defaultViewport ? Viewport.new(0, 0, *Graphics.size) : viewport
  305.  
  306.       @sprite        = Sprite.new(@viewport)
  307.       @bitmap        = nil
  308.       @ox            = @sprite.ox         # 0
  309.       @oy            = @sprite.oy         # 0
  310.       @opacity       = @sprite.opacity    # 255
  311.       @blend_type    = @sprite.blend_type # 0
  312.       @color         = @sprite.color      # Color.new(0, 0, 0, 0)
  313.       @tone          = @sprite.tone       # Tone.new(0, 0, 0, 0)
  314.       @visible       = @sprite.visible    # true
  315.       @z             = @sprite.z          # 0
  316.       @zoom_x        = @sprite.zoom_x     # 1.0
  317.       @zoom_y        = @sprite.zoom_y     # 1.0
  318.     end
  319.  
  320.     def bitmap=(bitmap)
  321.       return unless bitmap.is_a?(Bitmap)
  322.       @bitmap = bitmap
  323.       self.recreateBitmap(true)
  324.     end
  325.  
  326.     def ox=(value)
  327.       @ox = value
  328.       return unless @bitmap
  329.       @sprite.ox = (value % @bitmap.width)
  330.     end
  331.  
  332.     def oy=(value)
  333.       @oy = value
  334.       return unless @bitmap
  335.       @sprite.oy = (value % @bitmap.height)
  336.     end
  337.  
  338.     def opacity=(value)
  339.       @sprite.opacity = value
  340.       @opacity = @sprite.opacity
  341.     end
  342.  
  343.     def blend_type=(value)
  344.       @sprite.blend_type = value
  345.       @blend_type = @sprite.blend_type
  346.     end
  347.  
  348.     def color=(value)
  349.       @sprite.color = value
  350.       @color = @sprite.color
  351.     end
  352.  
  353.     def tone=(value)
  354.       @sprite.tone = value
  355.       @tone = @sprite.tone
  356.     end
  357.  
  358.     def viewport=(value)
  359.       @defaultViewport &= (value == @sprite.viewport)
  360.       @sprite.viewport = value
  361.       @viewport = @sprite.viewport
  362.     end
  363.  
  364.     def visible=(value)
  365.       @sprite.visible = value
  366.       @visible = sprite.visible
  367.     end
  368.  
  369.     def z=(value)
  370.       @sprite.z = value
  371.       @z = @sprite.z
  372.     end
  373.  
  374.     def zoom_x=(value)
  375.       @sprite.zoom_x = value
  376.       @zoom_x = @sprite.zoom_x
  377.       self.recreateBitmap
  378.     end
  379.  
  380.     def zoom_y=(value)
  381.       @sprite.zoom_y = value
  382.       @zoom_y = @sprite.zoom_y
  383.       self.recreateBitmap
  384.     end
  385.  
  386.     def disposed?
  387.       return @sprite.disposed?
  388.     end
  389.  
  390.     def dispose
  391.       @sprite.dispose
  392.     end
  393.  
  394.     protected
  395.  
  396.     def recreateBitmap(forceRefresh = false)
  397.       cw, ch      = Graphics.width * (2.0/@zoom_x), Graphics.height * (2.0/@zoom_y)
  398.       needRefresh = true
  399.  
  400.       if @defaultViewport
  401.         @viewport.rect.width, @viewport.rect.height = *Graphics.size
  402.       end
  403.  
  404.       if @sprite.bitmap.nil? or @sprite.bitmap.disposed?
  405.         newBitmap = Bitmap.new(cw, ch)
  406.       else
  407.         if (cw == @sprite.bitmap.width) and (ch == @sprite.bitmap.height) and (!forceRefresh)
  408.           return
  409.         end
  410.  
  411.         newBitmap = Bitmap.new(cw, ch)
  412.         if (cw < @sprite.bitmap.width) and (ch < @sprite.bitmap.height)
  413.           newBitmap.blt(0, 0, @sprite.bitmap, @sprite.bitmap.rect)
  414.           @sprite.bitmap.dispose
  415.           needRefresh = false
  416.         end
  417.       end
  418.  
  419.       @sprite.bitmap = newBitmap
  420.       self.refreshBitmap if needRefresh or forceRefresh
  421.     end
  422.  
  423.     def refreshBitmap
  424.       # Limpa o bitmap
  425.       b = @sprite.bitmap
  426.       b.clear
  427.  
  428.       return if @bitmap.nil?
  429.  
  430.       # Quantia de espaços para blt
  431.       tx = (b.width  / @bitmap.width.to_f )
  432.       ty = (b.height / @bitmap.height.to_f)
  433.  
  434.       b.blt(0, 0, @bitmap, @bitmap.rect)
  435.  
  436.       return if tx + ty == 2
  437.  
  438.       # Preenche 1 linha
  439.       basePow = @bitmap.width
  440.       baseRct = Rect.new(0, 0, @bitmap.width, @bitmap.height)
  441.  
  442.       Math.log2(tx).floor.times{
  443.         b.blt(basePow, 0, b, baseRct)
  444.         baseRct.width += basePow
  445.         basePow *= 2
  446.       }
  447.  
  448.       # Último bitmap da linha
  449.       baseRct.width = (b.width - baseRct.width)
  450.       b.blt(basePow, 0, b, baseRct)
  451.  
  452.       # Preenche o restante das linhas
  453.       basePow = @bitmap.height
  454.       baseRct = Rect.new(0, 0, b.width, @bitmap.height)
  455.  
  456.       Math.log2(ty).floor.times{
  457.         b.blt(0, basePow, b, baseRct)
  458.         baseRct.height += basePow
  459.         basePow *= 2
  460.       }
  461.  
  462.       # Última linha
  463.       baseRct.height = b.height - baseRct.height
  464.       b.blt(basePow, 0, b, baseRct)
  465.     end
  466.   end
  467. end
  468.  
  469. class Game_Map
  470.   # Número de tiles horizontais na tela
  471.   def screen_tile_x
  472.     (Graphics.width / 32.0).ceil
  473.   end
  474.  
  475.   # Número de tiles verticais na tela
  476.   def screen_tile_y
  477.     (Graphics.height / 32.0).ceil
  478.   end
  479. end
  480.  
  481. # Contador de FPS para o modo Fullscreen
  482. if $TEST
  483.   # FPS Display // Zeus81
  484.   # [url]http://forums.rpgmakerweb.com/index.php?/topic/3738-fps-display-isnt-very-accurate/#entry40350[/url]
  485.   module Graphics
  486.     @fps, @fps_tmp = 0, []
  487.  
  488.     class << self
  489.       attr_reader :fps
  490.  
  491.       alias fps_update update unless method_defined?(:fps_update)
  492.       def update
  493.         t = Time.now
  494.         fps_update
  495.         @fps_tmp[frame_count % frame_rate] = Time.now != t
  496.         @fps = 0
  497.         frame_rate.times {|i| @fps += 1 if @fps_tmp[i]}
  498.         fps_sprite.src_rect.y = @fps * 16
  499.       end
  500.  
  501.       def fps_sprite
  502.         if !@fps_sprite or @fps_sprite.disposed?
  503.           @fps_sprite = Sprite.new
  504.           @fps_sprite.z = 0x7FFFFFFF
  505.           @fps_sprite.bitmap = Bitmap.new(24, 16*120)
  506.           @fps_sprite.bitmap.font.name = "Arial"
  507.           @fps_sprite.bitmap.font.size = 16
  508.           @fps_sprite.bitmap.font.color.set(255, 255, 255)
  509.           @fps_sprite.bitmap.fill_rect(@fps_sprite.bitmap.rect, Color.new(0, 0, 0, 127))
  510.           120.times {|i|
  511.             @fps_sprite.bitmap.draw_text(0, i*16, 24, 16, "% 3d"%i, 1)
  512.           }
  513.           @fps_sprite.src_rect.height = 16
  514.         end
  515.         return @fps_sprite
  516.       end      
  517.     end
  518.   end
  519. end
  520.  
  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. #==============================================================================
  530. # ■ Game_Map
  531. #==============================================================================
  532.  
  533. class Game_Map
  534.  
  535.   #--------------------------------------------------------------------------
  536.   # overwrite method: scroll_down
  537.   #--------------------------------------------------------------------------
  538.   def scroll_down(distance)
  539.     if loop_vertical?
  540.       @display_y += distance
  541.       @display_y %= @map.height * 256
  542.       @parallax_y += distance
  543.     else
  544.       last_y = @display_y
  545.       dh = Graphics.height > height * 32 ? height : screen_tile_y
  546.       @display_y = [@display_y + distance, height - dh].min
  547.       @parallax_y += @display_y - last_y
  548.     end
  549.   end
  550.  
  551.   #--------------------------------------------------------------------------
  552.   # overwrite method: scroll_right
  553.   #--------------------------------------------------------------------------
  554.   def scroll_right(distance)
  555.     if loop_horizontal?
  556.       @display_x += distance
  557.       @display_x %= @map.width * 256
  558.       @parallax_x += distance
  559.     else
  560.       last_x = @display_x
  561.       dw = Graphics.width > width * 32 ? width : screen_tile_x
  562.       @display_x = [@display_x + distance, width - dw].min
  563.       @parallax_x += @display_x - last_x
  564.     end
  565.   end
  566.  
  567. end # Game_Map
  568.  
  569. #==============================================================================
  570. # ■ Spriteset_Map
  571. #==============================================================================
  572.  
  573. class Spriteset_Map
  574.  
  575.   #--------------------------------------------------------------------------
  576.   # overwrite method: create_viewports
  577.   #--------------------------------------------------------------------------
  578.   def create_viewports
  579.     if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  580.       dx = (Graphics.width - $game_map.width * 32) / 2
  581.     else
  582.       dx = 0
  583.     end
  584.     dw = [Graphics.width, $game_map.width * 32].min
  585.     dw = Graphics.width if $game_map.loop_horizontal?
  586.     if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  587.       dy = (Graphics.height - $game_map.height * 32) / 2
  588.     else
  589.       dy = 0
  590.     end
  591.     dh = [Graphics.height, $game_map.height * 32].min
  592.     dh = Graphics.height if $game_map.loop_vertical?
  593.     @viewport1 = Viewport.new(dx, dy, dw, dh)
  594.     @viewport2 = Viewport.new(dx, dy, dw, dh)
  595.     @viewport3 = Viewport.new(dx, dy, dw, dh)
  596.     @viewport2.z = 50
  597.     @viewport3.z = 100
  598.   end
  599.  
  600.   #--------------------------------------------------------------------------
  601.   # new method: update_viewport_sizes
  602.   #--------------------------------------------------------------------------
  603.   def update_viewport_sizes
  604.     if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  605.       dx = (Graphics.width - $game_map.width * 32) / 2
  606.     else
  607.       dx = 0
  608.     end
  609.     dw = [Graphics.width, $game_map.width * 32].min
  610.     dw = Graphics.width if $game_map.loop_horizontal?
  611.     if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  612.       dy = (Graphics.height - $game_map.height * 32) / 2
  613.     else
  614.       dy = 0
  615.     end
  616.     dh = [Graphics.height, $game_map.height * 32].min
  617.     dh = Graphics.height if $game_map.loop_vertical?
  618.     rect = Rect.new(dx, dy, dw, dh)
  619.     for viewport in [@viewport1, @viewport2, @viewport3]
  620.       viewport.rect = rect
  621.     end
  622.   end
  623.  
  624. end # Spriteset_Map
  625.  
  626. #==============================================================================
  627. # ■ Scene_Map
  628. #==============================================================================
  629.  
  630. class Scene_Map < Scene_Base
  631.  
  632.   #--------------------------------------------------------------------------
  633.   # alias method: post_transfer
  634.   #--------------------------------------------------------------------------
  635.   alias scene_map_post_transfer_ace post_transfer
  636.   def post_transfer
  637.     @spriteset.update_viewport_sizes
  638.     scene_map_post_transfer_ace
  639.   end
  640.  
  641. end # Scene_Map
  642.  
  643. #==============================================================================
  644. # ■ Game_Event
  645. #==============================================================================
  646.  
  647. class Game_Event < Game_Character
  648.  
  649.   #--------------------------------------------------------------------------
  650.   # overwrite method: near_the_screen?
  651.   #--------------------------------------------------------------------------
  652.   def near_the_screen?(dx = nil, dy = nil)
  653.     dx = [Graphics.width, $game_map.width * 256].min/32 - 5 if dx.nil?
  654.     dy = [Graphics.height, $game_map.height * 256].min/32 - 5 if dy.nil?
  655.     ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32
  656.     ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32
  657.     ax >= -dx && ax <= dx && ay >= -dy && ay <= dy
  658.   end
  659.  
  660. end # Game_Event
  661.  
  662. # Chama o método que realiza a mudança de tamanho
  663. # Graphics.fullscreen
  664. Graphics.resize_screen(800, 600)
  665.  
  666. __END__
  667. # TESTES
  668. # Graphics.windowed
  669. x = Bitmap.new(50, 50)
  670. x.gradient_fill_rect(0,  0, 50, 25, Color.new(255, 0, 0), Color.new(0, 255, 0))
  671. x.gradient_fill_rect(0, 25, 50, 25, Color.new(0, 255, 0), Color.new(0, 0, 255))
  672. y = Plane.new
  673. y.bitmap = x
  674. y.zoom_x = 3
  675. y.zoom_y = 3
  676. #Graphics.fullscreen
  677. #Graphics.windowed
  678. loop do
  679.   Graphics.update
  680.   y.ox += 1
  681.   y.oy += 1
  682. end

Lv2.观梦者

梦石
0
星屑
936
在线时间
74 小时
注册时间
2018-7-8
帖子
38
2
 楼主| 发表于 2020-2-29 18:50:36 | 只看该作者
我日图呢
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 22:12

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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