Refactoring and tidying

This commit is contained in:
Maruno17
2021-01-11 19:30:45 +00:00
parent a5d1359dfe
commit 2586c09c3c
37 changed files with 5288 additions and 5966 deletions

View File

@@ -251,11 +251,6 @@ module Mouse
@ReleaseCapture = Win32API.new('user32','ReleaseCapture','','i')
module_function
def getMouseGlobalPos
pos = [0, 0].pack('ll')
return (@GetCursorPos.call(pos)!=0) ? pos.unpack('ll') : [nil,nil]
end
def screen_to_client(x, y)
return nil unless x and y
screenToClient = Win32API.new('user32','ScreenToClient',%w(l p),'i')
@@ -264,12 +259,9 @@ module Mouse
return nil
end
def setCapture
@SetCapture.call(Win32API.pbFindRgssWindow)
end
def releaseCapture
@ReleaseCapture.call
def getMouseGlobalPos
pos = [0, 0].pack('ll')
return (@GetCursorPos.call(pos)!=0) ? pos.unpack('ll') : [nil,nil]
end
# Returns the position of the mouse relative to the game window.
@@ -283,6 +275,17 @@ module Mouse
return nil
end
# Unused
def setCapture
@SetCapture.call(Win32API.pbFindRgssWindow)
end
# Unused
def releaseCapture
@ReleaseCapture.call
end
# Unused
def del
return if @oldcursor==nil
@SetClassLong.call(Win32API.pbFindRgssWindow,-12,@oldcursor)

View File

@@ -63,16 +63,6 @@ def pbSetUpSystem
pbSetResizeFactor([$PokemonSystem.screensize, 4].min)
end
# Load constants
begin
consts = pbSafeLoad("Data/Constants.rxdata")
consts = [] if !consts
rescue
consts = []
end
for script in consts
next if !script
eval(Zlib::Inflate.inflate(script[2]),nil,script[1])
end
GameData.load_all
if LANGUAGES.length>=2
pokemonSystem.language = pbChooseLanguage if !havedata

View File

@@ -235,6 +235,22 @@ def getID(mod,constant)
return constant
end
def getConstantName(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants
return c if mod.const_get(c.to_sym)==value
end
raise _INTL("Value {1} not defined by a constant in {2}",value,mod.name)
end
def getConstantNameOrValue(mod,value)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
for c in mod.constants
return c if mod.const_get(c.to_sym)==value
end
return value.inspect
end
#===============================================================================