mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Fixed compiler always triggering
This commit is contained in:
20
Data/Scripts/001_Technical/001_MKXP_Compatibility.rb
Normal file
20
Data/Scripts/001_Technical/001_MKXP_Compatibility.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
$MKXP = !!defined?(System)
|
||||||
|
|
||||||
|
def mkxp?
|
||||||
|
return $MKXP
|
||||||
|
end
|
||||||
|
|
||||||
|
CHARACTER_OFFSETS = {
|
||||||
|
"p" => [0, 2],
|
||||||
|
"g" => [0, 2],
|
||||||
|
"y" => [0, 2],
|
||||||
|
"q" => [0, 2]
|
||||||
|
}
|
||||||
|
|
||||||
|
def pbSetWindowText(string)
|
||||||
|
if mkxp?
|
||||||
|
System.set_window_title(string || System.game_title)
|
||||||
|
else
|
||||||
|
Win32API.SetWindowText(string || "RGSS Player")
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,19 +1,3 @@
|
|||||||
#===============================================================================
|
|
||||||
# mkxp setup
|
|
||||||
#===============================================================================
|
|
||||||
$MKXP = !!defined?(System)
|
|
||||||
|
|
||||||
def mkxp?
|
|
||||||
return $MKXP
|
|
||||||
end
|
|
||||||
|
|
||||||
CHARACTER_OFFSETS = {
|
|
||||||
"p" => [0, 2],
|
|
||||||
"g" => [0, 2],
|
|
||||||
"y" => [0, 2],
|
|
||||||
"q" => [0, 2]
|
|
||||||
}
|
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# class Class
|
# class Class
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
@@ -197,7 +197,7 @@ def pbEachFileSectionEx(f)
|
|||||||
end
|
end
|
||||||
lineno += 1
|
lineno += 1
|
||||||
Graphics.update if lineno%500==0
|
Graphics.update if lineno%500==0
|
||||||
Win32API.SetWindowText(_INTL("Processing line {1}",lineno)) if lineno%50==0
|
pbSetWindowText(_INTL("Processing line {1}",lineno)) if lineno%50==0
|
||||||
}
|
}
|
||||||
yield lastsection,sectionname if havesection
|
yield lastsection,sectionname if havesection
|
||||||
end
|
end
|
||||||
@@ -1167,18 +1167,19 @@ def pbCompileAllData(mustCompile)
|
|||||||
yield(_INTL("Compiling shadow move data"))
|
yield(_INTL("Compiling shadow move data"))
|
||||||
pbCompileShadowMoves
|
pbCompileShadowMoves
|
||||||
yield(_INTL("Compiling messages"))
|
yield(_INTL("Compiling messages"))
|
||||||
|
pbCompileAnimations
|
||||||
|
pbCompileTrainerEvents(mustCompile)
|
||||||
|
pbSetTextMessages
|
||||||
|
MessageTypes.saveMessages
|
||||||
else
|
else
|
||||||
if (!$INEDITOR || LANGUAGES.length<2) && safeExists?("Data/messages.dat")
|
if (!$INEDITOR || LANGUAGES.length<2) && safeExists?("Data/messages.dat")
|
||||||
MessageTypes.loadMessageFile("Data/messages.dat")
|
MessageTypes.loadMessageFile("Data/messages.dat")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
pbCompileAnimations
|
|
||||||
pbCompileTrainerEvents(mustCompile)
|
|
||||||
pbSetTextMessages
|
|
||||||
MessageTypes.saveMessages
|
|
||||||
if !$INEDITOR && LANGUAGES.length>=2
|
if !$INEDITOR && LANGUAGES.length>=2
|
||||||
pbLoadMessages("Data/"+LANGUAGES[$PokemonSystem.language][1])
|
pbLoadMessages("Data/"+LANGUAGES[$PokemonSystem.language][1])
|
||||||
end
|
end
|
||||||
|
pbSetWindowText(nil) if mkxp?
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbCompiler
|
def pbCompiler
|
||||||
@@ -1242,24 +1243,26 @@ def pbCompiler
|
|||||||
end
|
end
|
||||||
# Check data files and PBS files, and recompile if any PBS file was edited
|
# Check data files and PBS files, and recompile if any PBS file was edited
|
||||||
# more recently than the data files were last created
|
# more recently than the data files were last created
|
||||||
for i in 0...dataFiles.length
|
if !mkxp?
|
||||||
begin
|
for i in 0...dataFiles.length
|
||||||
File.open("Data/#{dataFiles[i]}") { |file|
|
begin
|
||||||
latestDataTime = [latestDataTime,file.mtime.to_i].max
|
File.open("Data/#{dataFiles[i]}") { |file|
|
||||||
}
|
latestDataTime = [latestDataTime,file.mtime.to_i].max
|
||||||
rescue SystemCallError
|
}
|
||||||
mustCompile = true
|
rescue SystemCallError
|
||||||
|
mustCompile = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
for i in 0...textFiles.length
|
||||||
for i in 0...textFiles.length
|
begin
|
||||||
begin
|
File.open("PBS/#{textFiles[i]}") { |file|
|
||||||
File.open("PBS/#{textFiles[i]}") { |file|
|
latestTextTime = [latestTextTime,file.mtime.to_i].max
|
||||||
latestTextTime = [latestTextTime,file.mtime.to_i].max
|
}
|
||||||
}
|
rescue SystemCallError
|
||||||
rescue SystemCallError
|
end
|
||||||
end
|
end
|
||||||
|
mustCompile |= (latestTextTime>=latestDataTime)
|
||||||
end
|
end
|
||||||
mustCompile |= (latestTextTime>=latestDataTime)
|
|
||||||
# Should recompile if holding Ctrl
|
# Should recompile if holding Ctrl
|
||||||
Input.update
|
Input.update
|
||||||
mustCompile = true if Input.press?(Input::CTRL)
|
mustCompile = true if Input.press?(Input::CTRL)
|
||||||
@@ -1273,7 +1276,7 @@ def pbCompiler
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Recompile all data
|
# Recompile all data
|
||||||
pbCompileAllData(mustCompile) { |msg| Win32API.SetWindowText(msg) }
|
pbCompileAllData(mustCompile) { |msg| pbSetWindowText(msg) }
|
||||||
rescue Exception
|
rescue Exception
|
||||||
e = $!
|
e = $!
|
||||||
raise e if "#{e.class}"=="Reset" || e.is_a?(Reset) || e.is_a?(SystemExit)
|
raise e if "#{e.class}"=="Reset" || e.is_a?(Reset) || e.is_a?(SystemExit)
|
||||||
|
|||||||
@@ -1416,7 +1416,7 @@ def pbCompileTrainerEvents(_mustcompile)
|
|||||||
changed = false
|
changed = false
|
||||||
map = mapData.getMap(id)
|
map = mapData.getMap(id)
|
||||||
next if !map || !mapData.mapinfos[id]
|
next if !map || !mapData.mapinfos[id]
|
||||||
Win32API.SetWindowText(_INTL("Processing map {1} ({2})",id,mapData.mapinfos[id].name))
|
pbSetWindowText(_INTL("Processing map {1} ({2})",id,mapData.mapinfos[id].name))
|
||||||
for key in map.events.keys
|
for key in map.events.keys
|
||||||
if Time.now.to_i-t>=5
|
if Time.now.to_i-t>=5
|
||||||
Graphics.update
|
Graphics.update
|
||||||
@@ -1448,7 +1448,7 @@ def pbCompileTrainerEvents(_mustcompile)
|
|||||||
changed = false
|
changed = false
|
||||||
Graphics.update
|
Graphics.update
|
||||||
commonEvents = pbLoadRxData("Data/CommonEvents")
|
commonEvents = pbLoadRxData("Data/CommonEvents")
|
||||||
Win32API.SetWindowText(_INTL("Processing common events"))
|
pbSetWindowText(_INTL("Processing common events"))
|
||||||
for key in 0...commonEvents.length
|
for key in 0...commonEvents.length
|
||||||
newevent = pbFixEventUse(commonEvents[key],0,mapData)
|
newevent = pbFixEventUse(commonEvents[key],0,mapData)
|
||||||
if newevent
|
if newevent
|
||||||
|
|||||||
Reference in New Issue
Block a user