赞 | 22 |
VIP | 5 |
好人卡 | 14 |
积分 | 30 |
经验 | 30850 |
最后登录 | 2024-11-22 |
在线时间 | 1053 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3044
- 在线时间
- 1053 小时
- 注册时间
- 2011-8-16
- 帖子
- 242
|
请尝试使用此脚本:- #==============================================================================
- # ** Drago - Core Engine
- # Version : 1.39
- # Contact : littledrago.blogspot.com / forum.chaos-project.com
- #==============================================================================
- # =============================================================================
- # NOTE:
- # -----------------------------------------------------------------------------
- # This is a devtool for me to make me easier for scripting
- # If you want to use this, put above all custom script & below Scene_Debug
- #
- # Note that I'm changing a bit RGSS language in this script, so probably some
- # syntax in this script won't work if you use them somewhere else
- #
- # =============================================================================
- module LiTTleDRAgo
- #-------------------------------------------------------------------------
- # * Constant
- #-------------------------------------------------------------------------
- VX = defined?(Window_ActorCommand)
- VXA = defined?(Window_BattleActor)
- RGSS1 = defined?(Hangup)
- RGSS2 = RUBY_VERSION == '1.8.1' && !RGSS1
- RGSS3 = RUBY_VERSION == '1.9.2'
- APPPATHDRAGO = "#{ENV['APPDATA']}/Drago/"
- end
-
- #==============================================================================
- # ** CoreDLL
- #------------------------------------------------------------------------------
- #
- #==============================================================================
- module CoreDLL
- #-------------------------------------------------------------------------
- # * Constant
- #-------------------------------------------------------------------------
- Rtlmemory_pi = Win32API.new('kernel32','RtlMoveMemory','pii','i')
- Rtlmemory_ip = Win32API.new('kernel32','RtlMoveMemory','ipi','i')
- #-------------------------------------------------------------------------
- # * Get the game window handle (specific to game)
- #-------------------------------------------------------------------------
- unless method_defined?(:hwnd)
- def hwnd
- @window_find ||= Win32API.new('user32', 'FindWindowEx', %w(l l p p), 'i')
- @game_window ||= @window_find.call(0,0,"RGSS Player",0)
- return @game_window
- end
- end
- #-------------------------------------------------------------------------
- # * Get the Game Window's width and height
- #-------------------------------------------------------------------------
- unless method_defined?(:client_size)
- def client_size
- @window_c_rect ||= Win32API.new('user32', 'GetClientRect', %w(l p), 'i')
- @window_c_rect.call(self.hwnd, (rect = [0, 0, 0, 0].pack('l4')))
- right, bottom = rect.unpack('l4')[2..3]
- return right, bottom
- end
- end
- #--------------------------------------------------------------------------
- # * snap_to_bitmap
- #--------------------------------------------------------------------------
- unless method_defined?(:snap_to_bitmap)
- def snap_to_bitmap
- @getdc ||= Win32API.new('user32','GetDC','i','i')
- @ccdc ||= Win32API.new('gdi32','CreateCompatibleDC','i','i')
- @ccbitmap ||= Win32API.new('gdi32','CreateCompatibleBitmap','iii','i')
- @deleteobject ||= Win32API.new('gdi32','DeleteObject','i','i')
- @bitblt ||= Win32API.new('gdi32','BitBlt','iiiiiiiii','i')
- @setdibits ||= Win32API.new('gdi32','SetDIBits','iiiiipi','i')
- @getdibits ||= Win32API.new('gdi32','GetDIBits','iiiiipi','i')
- @selectobject ||= Win32API.new('gdi32','SelectObject','ii','i')
- width, height = Graphics.width, Graphics.height
- bitmap = Bitmap.new(width, height)
- info = [40,width,height,1,32,0,0,0,0,0,0].pack('LllSSLLllLL')
- hDC = @ccdc.call((dc = @getdc.call(hwnd)))
- hBM = @ccbitmap.call(dc, width, height)
- @deleteobject.call(@selectobject.call(hDC, hBM))
- @setdibits.call(hDC, hBM, 0, height, (address = bitmap.address), info, 0)
- @bitblt.call(hDC, 0, 0, width, height, dc, 0, 0, 0xCC0020)
- @getdibits.call(hDC, hBM, 0, height, address, info, 0)
- @deleteobject.call(hBM)
- @deleteobject.call(hDC)
- bitmap
- end
- end
- end
- LiTTleDRAgo.extend(CoreDLL)
-
- #==============================================================================
- # ** Graphics
- #------------------------------------------------------------------------------
- # This module handles all Graphics
- #==============================================================================
- module Graphics
- #----------------------------------------------------------------------------
- # ● class << self
- #----------------------------------------------------------------------------
- class << self
- #--------------------------------------------------------------------------
- # ● Redefined method: width, height, snap_to_bitmap
- #--------------------------------------------------------------------------
- unless method_defined?(:width)
- def width
- LiTTleDRAgo.client_size.at(0)
- end
- end
-
- unless method_defined?(:height)
- def height
- LiTTleDRAgo.client_size.at(1)
- end
- end
-
- unless method_defined?(:snap_to_bitmap)
- def snap_to_bitmap
- LiTTleDRAgo.snap_to_bitmap
- end
- end
- end
- end
- #==============================================================================
- # ■ Bitmap
- #------------------------------------------------------------------------------
- #
- #==============================================================================
- class Bitmap
- #----------------------------------------------------------------------------
- # ● Constant
- #----------------------------------------------------------------------------
- RtlMoveMemory_pi = CoreDLL::Rtlmemory_pi
- RtlMoveMemory_ip = CoreDLL::Rtlmemory_ip
- #----------------------------------------------------------------------------
- # ● New method: address
- #----------------------------------------------------------------------------
- unless method_defined?(:address)
- def address
- @address ||= (
- RtlMoveMemory_pi.call(a="\0"*4, __id__*2+16, 4)
- RtlMoveMemory_pi.call(a, a.unpack('L')[0]+8, 4)
- RtlMoveMemory_pi.call(a, a.unpack('L')[0]+16, 4)
- a.unpack('L')[0]
- )
- end
- end
- end
- #===============================================================================
- # ** END OF Drago - Core Engine
- #===============================================================================
-
- #===============================================================================
- # ** Graphics
- #===============================================================================
-
- module Graphics
-
- class << self
- alias zer0_graphics_transition transition unless $@
- end
-
- def self.transition(duration = 8, *args)
- # Skip this section and instantly transition graphics if duration is 0.
- if duration > 0
- # Take a snapshot of the the screen, overlaying screen with graphic.
- #$resolution.snapshot
- zer0_graphics_transition(0)
- # Create screen instance
- sprite = Sprite.new(Viewport.new(0, 0, 1024, 576))
- sprite.bitmap = Graphics.snap_to_bitmap
- # Use a simple fade if transition is not defined.
- fade = 255 / duration
- duration.times { sprite.opacity -= fade ; update }
- # Dispose sprite and delete snapshot file.
- [sprite, sprite.bitmap].each {|obj| obj.dispose }
- #File.delete('Data/snap')
- end
- zer0_graphics_transition(0)
- end
- end
复制代码 我自己还没有测试过。这个脚本是我从外站找来的,删去了和渐变处理无关的部分。原作者是LiTTleDRAgo和ForeverZer0. |
评分
-
查看全部评分
|