mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Resolved many Rubocop warnings
This commit is contained in:
@@ -4,8 +4,9 @@ $scene = nil
|
||||
Font.default_shadow = false if Font.respond_to?(:default_shadow)
|
||||
Graphics.frame_rate = 40
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
=begin
|
||||
class Win32API
|
||||
class << self
|
||||
@@ -14,9 +15,9 @@ class Win32API
|
||||
end
|
||||
|
||||
def new(*args)
|
||||
File.open("winapi.txt","ab") { |f| f.write("new(#{args[0]},#{args[1]})\r\n") }
|
||||
b=debug_new(*args)
|
||||
b.setDllName(args[0],args[1])
|
||||
File.open("winapi.txt", "ab") { |f| f.write("new(#{args[0]},#{args[1]})\r\n") }
|
||||
b = debug_new(*args)
|
||||
b.setDllName(args[0], args[1])
|
||||
return b
|
||||
end
|
||||
end
|
||||
@@ -26,13 +27,13 @@ class Win32API
|
||||
end
|
||||
|
||||
def setDllName(a,b)
|
||||
@w32dll=a
|
||||
@w32name=b
|
||||
@w32dll = a
|
||||
@w32name = b
|
||||
end
|
||||
|
||||
def call(*args)
|
||||
if @w32name!="GetAsyncKeyState"
|
||||
File.open("winapi.txt","ab") { |f|
|
||||
if @w32name != "GetAsyncKeyState"
|
||||
File.open("winapi.txt", "ab") { |f|
|
||||
f.write("call(#{@w32dll},#{@w32name},#{args.inspect})\r\n")
|
||||
}
|
||||
end
|
||||
@@ -47,8 +48,8 @@ class Bitmap
|
||||
end
|
||||
|
||||
def new(*args)
|
||||
if args.length==1
|
||||
File.open("winapib.txt","ab") { |f| f.write("new(#{args[0]})\r\n") }
|
||||
if args.length == 1
|
||||
File.open("winapib.txt", "ab") { |f| f.write("new(#{args[0]})\r\n") }
|
||||
end
|
||||
debug_new(*args)
|
||||
end
|
||||
@@ -58,31 +59,28 @@ end
|
||||
alias debug_load_data load_data
|
||||
|
||||
def load_data(*args)
|
||||
File.open("winapif.txt","ab") { |f| f.write("load(#{args[0]})\r\n") }
|
||||
File.open("winapif.txt", "ab") { |f| f.write("load(#{args[0]})\r\n") }
|
||||
debug_load_data(*args)
|
||||
end
|
||||
=end
|
||||
|
||||
|
||||
|
||||
class Hangup < Exception; end
|
||||
|
||||
|
||||
|
||||
if false
|
||||
p (Tilemap.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
# no changes
|
||||
p (Plane.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
# no changes
|
||||
p (Viewport.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
p (Bitmap.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
# openness(=)
|
||||
p (Window.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
p (Sprite.instance_methods-Kernel.instance_methods-Object.instance_methods).sort
|
||||
p (Tilemap.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
# no changes
|
||||
p (Plane.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
# no changes
|
||||
p (Viewport.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
p (Bitmap.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
# openness(=)
|
||||
p (Window.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
p (Sprite.instance_methods - Kernel.instance_methods - Object.instance_methods).sort
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
module RPG
|
||||
class Animation
|
||||
attr_accessor :id
|
||||
@@ -107,8 +105,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Animation
|
||||
class Frame
|
||||
@@ -123,8 +119,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Animation
|
||||
class Timing
|
||||
@@ -139,7 +133,7 @@ module RPG
|
||||
@frame = 0
|
||||
@se = RPG::AudioFile.new("", 80)
|
||||
@flash_scope = 0
|
||||
@flash_color = Color.new(255,255,255,255)
|
||||
@flash_color = Color.new(255, 255, 255, 255)
|
||||
@flash_duration = 5
|
||||
@condition = 0
|
||||
end
|
||||
@@ -147,8 +141,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class System
|
||||
attr_accessor :magic_number
|
||||
@@ -227,8 +219,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Tileset
|
||||
attr_accessor :id
|
||||
@@ -253,7 +243,7 @@ module RPG
|
||||
@id = 0
|
||||
@name = ""
|
||||
@tileset_name = ""
|
||||
@autotile_names = [""]*7
|
||||
@autotile_names = [""] * 7
|
||||
@panorama_name = ""
|
||||
@panorama_hue = 0
|
||||
@fog_name = ""
|
||||
@@ -272,8 +262,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class CommonEvent
|
||||
attr_accessor :id
|
||||
@@ -292,8 +280,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Map
|
||||
attr_accessor :tileset_id
|
||||
@@ -324,8 +310,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class MapInfo
|
||||
attr_accessor :name
|
||||
@@ -346,8 +330,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Event
|
||||
attr_accessor :id
|
||||
@@ -366,8 +348,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Event
|
||||
class Page
|
||||
@@ -404,8 +384,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Event
|
||||
class Page
|
||||
@@ -436,8 +414,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class Event
|
||||
class Page
|
||||
@@ -464,8 +440,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class EventCommand
|
||||
attr_accessor :code
|
||||
@@ -480,8 +454,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class MoveRoute
|
||||
attr_accessor :repeat
|
||||
@@ -496,8 +468,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class MoveCommand
|
||||
attr_accessor :code
|
||||
@@ -510,8 +480,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class System
|
||||
class Words
|
||||
@@ -562,8 +530,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class System
|
||||
class TestBattler
|
||||
@@ -588,8 +554,6 @@ module RPG
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
module RPG
|
||||
class AudioFile
|
||||
attr_accessor :name
|
||||
|
||||
@@ -8,7 +8,7 @@ class SpriteAnimation
|
||||
|
||||
%w[
|
||||
x y ox oy viewport flash src_rect opacity tone
|
||||
].each_with_index do |s, i|
|
||||
].each_with_index do |s, _i|
|
||||
eval <<-__END__
|
||||
|
||||
def #{s}(*arg)
|
||||
@@ -49,7 +49,7 @@ class SpriteAnimation
|
||||
end
|
||||
@_animation_sprites = []
|
||||
if @_animation.position != 3 or not @@_animations.include?(animation)
|
||||
for i in 0..15
|
||||
16.times do
|
||||
sprite = ::Sprite.new(self.viewport)
|
||||
sprite.bitmap = bitmap
|
||||
sprite.visible = false
|
||||
@@ -82,7 +82,7 @@ class SpriteAnimation
|
||||
@@_reference_count[bitmap] = 1
|
||||
end
|
||||
@_loop_animation_sprites = []
|
||||
for i in 0..15
|
||||
16.times do
|
||||
sprite = ::Sprite.new(self.viewport)
|
||||
sprite.bitmap = bitmap
|
||||
sprite.visible = false
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class Win32API
|
||||
@@RGSSWINDOW = nil
|
||||
@@GetCurrentThreadId = Win32API.new('kernel32','GetCurrentThreadId', '%w()','l')
|
||||
@@GetWindowThreadProcessId = Win32API.new('user32','GetWindowThreadProcessId', '%w(l p)','l')
|
||||
@@FindWindowEx = Win32API.new('user32','FindWindowEx', '%w(l l p p)','l')
|
||||
@@GetCurrentThreadId = Win32API.new('kernel32', 'GetCurrentThreadId', '%w()', 'l')
|
||||
@@GetWindowThreadProcessId = Win32API.new('user32', 'GetWindowThreadProcessId', '%w(l p)', 'l')
|
||||
@@FindWindowEx = Win32API.new('user32', 'FindWindowEx', '%w(l l p p)', 'l')
|
||||
|
||||
def Win32API.SetWindowText(text)
|
||||
hWnd = pbFindRgssWindow
|
||||
@@ -16,7 +16,7 @@ class Win32API
|
||||
processid = [0].pack('l')
|
||||
threadid = @@GetCurrentThreadId.call
|
||||
nextwindow = 0
|
||||
begin
|
||||
loop do
|
||||
nextwindow = @@FindWindowEx.call(0,nextwindow,"RGSS Player",0)
|
||||
if nextwindow!=0
|
||||
wndthreadid = @@GetWindowThreadProcessId.call(nextwindow,processid)
|
||||
@@ -25,9 +25,9 @@ class Win32API
|
||||
return @@RGSSWINDOW
|
||||
end
|
||||
end
|
||||
end until nextwindow==0
|
||||
break if nextwindow==0
|
||||
end
|
||||
raise "Can't find RGSS player window"
|
||||
return 0
|
||||
end
|
||||
|
||||
def Win32API.SetWindowPos(w, h)
|
||||
|
||||
@@ -48,7 +48,6 @@ module Console
|
||||
@apiSetConsoleTitle = Win32API.new("kernel32","SetConsoleTitle","p","s")
|
||||
access = (GENERIC_READ | GENERIC_WRITE)
|
||||
sharemode = (FILE_SHARE_READ | FILE_SHARE_WRITE)
|
||||
returnCode = AllocConsole()
|
||||
@bufferHandle = CreateConsoleScreenBuffer(access,sharemode,CONSOLE_TEXTMODE_BUFFER)
|
||||
f = File.open("Game.ini")
|
||||
lines = f.readlines()
|
||||
@@ -94,7 +93,7 @@ module Console
|
||||
offset=0
|
||||
events=eventsread.unpack("V")
|
||||
echo("got input [eventsread #{events}")
|
||||
for i in 0...events[0]
|
||||
events[0].length.times do
|
||||
keyevent=buffer[offset,20]
|
||||
keyevent=keyevent.unpack("vCvvvvV")
|
||||
if keyevent[0]==1 && keyevent[1]>0
|
||||
@@ -121,7 +120,6 @@ module Console
|
||||
echo(sprintf("failed (%d)\r\n",getlast.call()))
|
||||
break
|
||||
end
|
||||
offset=0
|
||||
events=eventsread.unpack("V")
|
||||
if events[0]>0
|
||||
echo("got input [eventsread #{events}][buffer #{buffer}]\r\n")
|
||||
|
||||
@@ -157,7 +157,7 @@ module Graphics
|
||||
|
||||
def self.wait(frames)
|
||||
return if frames<=0
|
||||
frames.times do |i|
|
||||
frames.times do
|
||||
self.update
|
||||
end
|
||||
end
|
||||
@@ -675,16 +675,16 @@ class Bitmap
|
||||
end
|
||||
|
||||
def swap32(x)
|
||||
return ((x>>24)&0x000000FF)|
|
||||
((x>>8)&0x0000FF00)|
|
||||
((x<<8)&0x00FF0000)|
|
||||
((x<<24)&0xFF000000)
|
||||
return ((x >> 24) & 0x000000FF) |
|
||||
((x >> 8) & 0x0000FF00) |
|
||||
((x << 8) & 0x00FF0000) |
|
||||
((x << 24) & 0xFF000000)
|
||||
end
|
||||
|
||||
def asOpaque
|
||||
data=getData
|
||||
j=3
|
||||
for i in 0...width*height
|
||||
(width*height).times do
|
||||
data[j]=0xFF
|
||||
j+=4
|
||||
end
|
||||
@@ -705,7 +705,6 @@ class Bitmap
|
||||
row=(self.height-1)*bytesPerScan
|
||||
data=self.getData
|
||||
data2=data.clone
|
||||
width=self.width
|
||||
x=""
|
||||
len=bytesPerScan*self.height
|
||||
ttt=Time.now
|
||||
@@ -713,13 +712,14 @@ class Bitmap
|
||||
SwapRgb.call(data2,data2.length)
|
||||
else
|
||||
# the following is considerably slower
|
||||
b=0;c=2;while b!=len
|
||||
b=0; c=2
|
||||
while b!=len
|
||||
data2[b]=data[c]
|
||||
data2[c]=data[b]
|
||||
b+=4;c+=4;
|
||||
b+=4; c+=4;
|
||||
end
|
||||
end
|
||||
#$times.push(Time.now-ttt)
|
||||
# $times.push(Time.now-ttt)
|
||||
filter="\0"
|
||||
while row>=0
|
||||
thisRow=data2[row,bytesPerScan]
|
||||
|
||||
Reference in New Issue
Block a user