mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-03-16 21:31:03 +00:00
Killed off RGSS, deleted font installer code
This commit is contained in:
@@ -5,19 +5,14 @@ def mkxp?
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pbSetWindowText(string)
|
def pbSetWindowText(string)
|
||||||
if mkxp?
|
|
||||||
System.set_window_title(string || System.game_title)
|
System.set_window_title(string || System.game_title)
|
||||||
else
|
|
||||||
Win32API.SetWindowText(string || "RGSS Player")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Bitmap
|
class Bitmap
|
||||||
if mkxp?
|
|
||||||
alias mkxp_draw_text draw_text
|
alias mkxp_draw_text draw_text
|
||||||
|
|
||||||
def draw_text(x, y, width, height, text, align = 0)
|
def draw_text(x, y, width, height, text, align = 0)
|
||||||
height = text_size(text).height
|
height = text_size(text).height
|
||||||
mkxp_draw_text(x, y, width, height, text, align)
|
mkxp_draw_text(x, y, width, height, text, align)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ if true # Disables using Alt+Enter to go fullscreen
|
|||||||
regHotKey.call(0, 1, 1, 0x0D)
|
regHotKey.call(0, 1, 1, 0x0D)
|
||||||
end
|
end
|
||||||
|
|
||||||
if mkxp?
|
def pbSetResizeFactor(factor)
|
||||||
# This kinda puts most of SpriteResizer out of business
|
|
||||||
def pbSetResizeFactor(factor)
|
|
||||||
if !$ResizeInitialized
|
if !$ResizeInitialized
|
||||||
Graphics.resize_screen(SCREEN_WIDTH, SCREEN_HEIGHT)
|
Graphics.resize_screen(SCREEN_WIDTH, SCREEN_HEIGHT)
|
||||||
$ResizeInitialized = true
|
$ResizeInitialized = true
|
||||||
@@ -30,35 +28,6 @@ if mkxp?
|
|||||||
Graphics.scale = factor
|
Graphics.scale = factor
|
||||||
Graphics.center
|
Graphics.center
|
||||||
end
|
end
|
||||||
end
|
|
||||||
else
|
|
||||||
def pbSetResizeFactor(factor=1,norecalc=false)
|
|
||||||
factor = [0.5,1.0,2.0,-1][factor] if !norecalc
|
|
||||||
(factor<0) ? pbConfigureFullScreen : pbConfigureWindowedScreen(factor)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbSetResizeFactor2(factor,force=false)
|
|
||||||
if $ResizeFactor!=factor || force
|
|
||||||
$ResizeFactor = factor
|
|
||||||
$ResizeFactorMul = (factor*100).to_i
|
|
||||||
pbRefreshResizeFactor if $ResizeFactorSet
|
|
||||||
end
|
|
||||||
$ResizeFactorSet = true
|
|
||||||
$ResizeBorder.refresh if $HaveResizeBorder
|
|
||||||
begin
|
|
||||||
if Graphics.haveresizescreen
|
|
||||||
Graphics.oldresizescreen(
|
|
||||||
(Graphics.width+$ResizeOffsetX*2)*factor,
|
|
||||||
(Graphics.height+$ResizeOffsetY*2)*factor
|
|
||||||
)
|
|
||||||
end
|
|
||||||
Win32API.SetWindowPos(
|
|
||||||
(Graphics.width+$ResizeOffsetX*2)*factor,
|
|
||||||
(Graphics.height+$ResizeOffsetY*2)*factor
|
|
||||||
)
|
|
||||||
rescue
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pbRefreshResizeFactor
|
def pbRefreshResizeFactor
|
||||||
@@ -86,6 +55,31 @@ def pbRefreshResizeFactor
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Unused
|
||||||
|
def pbSetResizeFactor2(factor,force=false)
|
||||||
|
if $ResizeFactor!=factor || force
|
||||||
|
$ResizeFactor = factor
|
||||||
|
$ResizeFactorMul = (factor*100).to_i
|
||||||
|
pbRefreshResizeFactor if $ResizeFactorSet
|
||||||
|
end
|
||||||
|
$ResizeFactorSet = true
|
||||||
|
$ResizeBorder.refresh if $HaveResizeBorder
|
||||||
|
begin
|
||||||
|
if Graphics.haveresizescreen
|
||||||
|
Graphics.oldresizescreen(
|
||||||
|
(Graphics.width+$ResizeOffsetX*2)*factor,
|
||||||
|
(Graphics.height+$ResizeOffsetY*2)*factor
|
||||||
|
)
|
||||||
|
end
|
||||||
|
Win32API.SetWindowPos(
|
||||||
|
(Graphics.width+$ResizeOffsetX*2)*factor,
|
||||||
|
(Graphics.height+$ResizeOffsetY*2)*factor
|
||||||
|
)
|
||||||
|
rescue
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Unused
|
||||||
def pbConfigureFullScreen
|
def pbConfigureFullScreen
|
||||||
params = Win32API.fillScreen
|
params = Win32API.fillScreen
|
||||||
fullgamew = gamew = SCREEN_WIDTH
|
fullgamew = gamew = SCREEN_WIDTH
|
||||||
@@ -117,6 +111,7 @@ def pbConfigureFullScreen
|
|||||||
pbSetResizeFactor2(factor,true)
|
pbSetResizeFactor2(factor,true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Unused
|
||||||
def pbConfigureWindowedScreen(value)
|
def pbConfigureWindowedScreen(value)
|
||||||
border = $PokemonSystem ? $PokemonSystem.border : 0
|
border = $PokemonSystem ? $PokemonSystem.border : 0
|
||||||
$ResizeOffsetX = [0,BORDER_WIDTH][border]
|
$ResizeOffsetX = [0,BORDER_WIDTH][border]
|
||||||
@@ -189,37 +184,7 @@ module Graphics
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if mkxp?
|
|
||||||
@@haveresizescreen = true
|
@@haveresizescreen = true
|
||||||
else
|
|
||||||
class << self
|
|
||||||
begin
|
|
||||||
x = @@haveresizescreen
|
|
||||||
rescue NameError # If exception is caught, the class
|
|
||||||
if !method_defined?(:oldresizescreen) # variable wasn't defined yet
|
|
||||||
begin
|
|
||||||
alias oldresizescreen resize_screen
|
|
||||||
@@haveresizescreen = true
|
|
||||||
rescue
|
|
||||||
@@haveresizescreen = false
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@@haveresizescreen = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def haveresizescreen
|
|
||||||
@@haveresizescreen
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.resize_screen(w,h)
|
|
||||||
@@width = w
|
|
||||||
@@height = h
|
|
||||||
pbSetResizeFactor($ResizeFactor,true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@@deletefailed = false
|
@@deletefailed = false
|
||||||
|
|
||||||
def self.snap_to_bitmap(resize=true)
|
def self.snap_to_bitmap(resize=true)
|
||||||
|
|||||||
@@ -387,11 +387,11 @@ def pbSetSystemFont(bitmap)
|
|||||||
fontname = MessageConfig.pbGetSystemFontName
|
fontname = MessageConfig.pbGetSystemFontName
|
||||||
bitmap.font.name = fontname
|
bitmap.font.name = fontname
|
||||||
if fontname == "Pokemon FireLeaf" || fontname == "Power Red and Green"
|
if fontname == "Pokemon FireLeaf" || fontname == "Power Red and Green"
|
||||||
bitmap.font.size = mkxp? ? 27 : 29
|
bitmap.font.size = 27
|
||||||
elsif fontname == "Pokemon Emerald Small" || fontname == "Power Green Small"
|
elsif fontname == "Pokemon Emerald Small" || fontname == "Power Green Small"
|
||||||
bitmap.font.size = mkxp? ? 29 : 25
|
bitmap.font.size = 29
|
||||||
else
|
else
|
||||||
bitmap.font.size = mkxp? ? 29 : 31
|
bitmap.font.size = 29
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -404,7 +404,7 @@ end
|
|||||||
# Sets a bitmap's font to the system narrow font.
|
# Sets a bitmap's font to the system narrow font.
|
||||||
def pbSetNarrowFont(bitmap)
|
def pbSetNarrowFont(bitmap)
|
||||||
bitmap.font.name = pbNarrowFontName
|
bitmap.font.name = pbNarrowFontName
|
||||||
bitmap.font.size = mkxp? ? 29 : 31
|
bitmap.font.size = 29
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
|
|||||||
def resizeHeightToFit(text,width=-1) # width is current window width
|
def resizeHeightToFit(text,width=-1) # width is current window width
|
||||||
dims=resizeToFitInternal(text,width)
|
dims=resizeToFitInternal(text,width)
|
||||||
self.width=width<0 ? Graphics.width : width
|
self.width=width<0 ? Graphics.width : width
|
||||||
self.height = dims[1] + self.borderY - (mkxp? ? 4 : 0)
|
self.height = dims[1] + self.borderY - 4
|
||||||
refresh
|
refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1227,7 +1227,7 @@ class Window_CommandPokemon < Window_DrawableCommand
|
|||||||
def drawItem(index,_count,rect)
|
def drawItem(index,_count,rect)
|
||||||
pbSetSystemFont(self.contents) if @starting
|
pbSetSystemFont(self.contents) if @starting
|
||||||
rect=drawCursor(index,rect)
|
rect=drawCursor(index,rect)
|
||||||
pbDrawShadowText(self.contents,rect.x,rect.y + (mkxp? ? 6 : 0),rect.width,rect.height,
|
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,
|
||||||
@commands[index],self.baseColor,self.shadowColor)
|
@commands[index],self.baseColor,self.shadowColor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1331,7 +1331,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
dims=[]
|
dims=[]
|
||||||
getAutoDims(commands,dims,width)
|
getAutoDims(commands,dims,width)
|
||||||
self.width=dims[0]
|
self.width=dims[0]
|
||||||
self.height=dims[1] - (mkxp? ? 6 : 0)
|
self.height=dims[1] - 6
|
||||||
end
|
end
|
||||||
|
|
||||||
def itemCount
|
def itemCount
|
||||||
@@ -1343,7 +1343,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
rect=drawCursor(index,rect)
|
rect=drawCursor(index,rect)
|
||||||
if toUnformattedText(@commands[index]).gsub(/\n/,"")==@commands[index]
|
if toUnformattedText(@commands[index]).gsub(/\n/,"")==@commands[index]
|
||||||
# Use faster alternative for unformatted text without line breaks
|
# Use faster alternative for unformatted text without line breaks
|
||||||
pbDrawShadowText(self.contents,rect.x,rect.y + (mkxp? ? 6 : 0),rect.width,rect.height,
|
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,
|
||||||
@commands[index],self.baseColor,self.shadowColor)
|
@commands[index],self.baseColor,self.shadowColor)
|
||||||
else
|
else
|
||||||
chars=getFormattedText(
|
chars=getFormattedText(
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ end
|
|||||||
|
|
||||||
def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
|
||||||
newlineBreaks=true,explicitBreaksOnly=false)
|
newlineBreaks=true,explicitBreaksOnly=false)
|
||||||
yDst += 4 if mkxp?
|
yDst += 4
|
||||||
x=y=0
|
x=y=0
|
||||||
characters=[]
|
characters=[]
|
||||||
textchunks=[]
|
textchunks=[]
|
||||||
@@ -422,7 +422,7 @@ _drawFormattedChars_ function.
|
|||||||
def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
||||||
newlineBreaks=true,explicitBreaksOnly=false,
|
newlineBreaks=true,explicitBreaksOnly=false,
|
||||||
collapseAlignments=false)
|
collapseAlignments=false)
|
||||||
yDst += 4 if mkxp?
|
yDst += 4
|
||||||
dummybitmap=nil
|
dummybitmap=nil
|
||||||
if !bitmap || bitmap.disposed? # allows function to be called with nil bitmap
|
if !bitmap || bitmap.disposed? # allows function to be called with nil bitmap
|
||||||
dummybitmap=Bitmap.new(1,1)
|
dummybitmap=Bitmap.new(1,1)
|
||||||
@@ -890,7 +890,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
def getLineBrokenChunks(bitmap,value,width,dims,plain=false)
|
def getLineBrokenChunks(bitmap,value,width,dims,plain=false)
|
||||||
x=0
|
x=0
|
||||||
y=mkxp? ? 4: 0
|
y=4
|
||||||
ret=[]
|
ret=[]
|
||||||
if dims
|
if dims
|
||||||
dims[0]=0
|
dims[0]=0
|
||||||
@@ -1109,7 +1109,7 @@ def pbDrawShadowText(bitmap,x,y,width,height,string,baseColor,shadowColor=nil,al
|
|||||||
return if !bitmap || !string
|
return if !bitmap || !string
|
||||||
width=(width<0) ? bitmap.text_size(string).width+1 : width
|
width=(width<0) ? bitmap.text_size(string).width+1 : width
|
||||||
height=(height<0) ? bitmap.text_size(string).height+1 : height
|
height=(height<0) ? bitmap.text_size(string).height+1 : height
|
||||||
y += -2 if mkxp?
|
y += -2
|
||||||
if shadowColor && shadowColor.alpha>0
|
if shadowColor && shadowColor.alpha>0
|
||||||
bitmap.font.color=shadowColor
|
bitmap.font.color=shadowColor
|
||||||
bitmap.draw_text(x+2,y,width,height,string,align)
|
bitmap.draw_text(x+2,y,width,height,string,align)
|
||||||
@@ -1157,7 +1157,7 @@ def pbDrawTextPositions(bitmap,textpos)
|
|||||||
for i in textpos
|
for i in textpos
|
||||||
textsize = bitmap.text_size(i[0])
|
textsize = bitmap.text_size(i[0])
|
||||||
x = i[1]
|
x = i[1]
|
||||||
y = i[2] + (mkxp? ? 6 : 0)
|
y = i[2] + 6
|
||||||
if i[3]==true || i[3]==1 # right align
|
if i[3]==true || i[3]==1 # right align
|
||||||
x -= textsize.width
|
x -= textsize.width
|
||||||
elsif i[3]==2 # centered
|
elsif i[3]==2 # centered
|
||||||
|
|||||||
@@ -49,16 +49,16 @@ class Window_CharacterEntry < Window_DrawableCommand
|
|||||||
def drawItem(index,_count,rect)
|
def drawItem(index,_count,rect)
|
||||||
rect=drawCursor(index,rect)
|
rect=drawCursor(index,rect)
|
||||||
if index==@charset.length # -1
|
if index==@charset.length # -1
|
||||||
pbDrawShadowText(self.contents,rect.x,rect.y + (mkxp? ? 6 : 0),rect.width,rect.height,"[ ]",
|
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,"[ ]",
|
||||||
self.baseColor,self.shadowColor)
|
self.baseColor,self.shadowColor)
|
||||||
elsif index==@charset.length+1 # -2
|
elsif index==@charset.length+1 # -2
|
||||||
pbDrawShadowText(self.contents,rect.x,rect.y + (mkxp? ? 6 : 0),rect.width,rect.height,@othercharset,
|
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,@othercharset,
|
||||||
self.baseColor,self.shadowColor)
|
self.baseColor,self.shadowColor)
|
||||||
elsif index==@charset.length+2 # -3
|
elsif index==@charset.length+2 # -3
|
||||||
pbDrawShadowText(self.contents,rect.x,rect.y + (mkxp? ? 6 : 0),rect.width,rect.height,_INTL("OK"),
|
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,_INTL("OK"),
|
||||||
self.baseColor,self.shadowColor)
|
self.baseColor,self.shadowColor)
|
||||||
else
|
else
|
||||||
pbDrawShadowText(self.contents,rect.x,rect.y + (mkxp? ? 6 : 0),rect.width,rect.height,@charset[index],
|
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,@charset[index],
|
||||||
self.baseColor,self.shadowColor)
|
self.baseColor,self.shadowColor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ class Window_DexesList < Window_CommandPokemon
|
|||||||
def drawItem(index,count,rect)
|
def drawItem(index,count,rect)
|
||||||
super(index,count,rect)
|
super(index,count,rect)
|
||||||
if index>=0 && index<@commands2.length
|
if index>=0 && index<@commands2.length
|
||||||
pbDrawShadowText(self.contents,rect.x+254,rect.y + (mkxp? ? 6 : 0),64,rect.height,
|
pbDrawShadowText(self.contents,rect.x+254,rect.y + 6,64,rect.height,
|
||||||
sprintf("%d",@commands2[index][0]),self.baseColor,self.shadowColor,1)
|
sprintf("%d",@commands2[index][0]),self.baseColor,self.shadowColor,1)
|
||||||
pbDrawShadowText(self.contents,rect.x+350,rect.y + (mkxp? ? 6 : 0),64,rect.height,
|
pbDrawShadowText(self.contents,rect.x+350,rect.y + 6,64,rect.height,
|
||||||
sprintf("%d",@commands2[index][1]),self.baseColor,self.shadowColor,1)
|
sprintf("%d",@commands2[index][1]),self.baseColor,self.shadowColor,1)
|
||||||
allseen = (@commands2[index][0]>=@commands2[index][2])
|
allseen = (@commands2[index][0]>=@commands2[index][2])
|
||||||
allown = (@commands2[index][1]>=@commands2[index][2])
|
allown = (@commands2[index][1]>=@commands2[index][2])
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Window_Pokedex < Window_DrawableCommand
|
|||||||
else
|
else
|
||||||
text = sprintf("%03d ----------",indexNumber)
|
text = sprintf("%03d ----------",indexNumber)
|
||||||
end
|
end
|
||||||
pbDrawShadowText(self.contents,rect.x+36,rect.y+6 + (mkxp? ? 6 : 0),rect.width,rect.height,
|
pbDrawShadowText(self.contents,rect.x+36,rect.y+6 + 6,rect.width,rect.height,
|
||||||
text,self.baseColor,self.shadowColor)
|
text,self.baseColor,self.shadowColor)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class Window_CommandPokemonColor < Window_CommandPokemon
|
|||||||
base = Color.new(0,80,160)
|
base = Color.new(0,80,160)
|
||||||
shadow = Color.new(128,192,240)
|
shadow = Color.new(128,192,240)
|
||||||
end
|
end
|
||||||
pbDrawShadowText(self.contents,rect.x,rect.y + (mkxp? ? 6 : 0),rect.width,rect.height,
|
pbDrawShadowText(self.contents,rect.x,rect.y + 6,rect.width,rect.height,
|
||||||
@commands[index],base,shadow)
|
@commands[index],base,shadow)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -257,7 +257,6 @@ class PokemonLoadScreen
|
|||||||
$game_system = Game_System.new
|
$game_system = Game_System.new
|
||||||
$PokemonSystem = PokemonSystem.new if !$PokemonSystem
|
$PokemonSystem = PokemonSystem.new if !$PokemonSystem
|
||||||
savefile = RTP.getSaveFileName("Game.rxdata")
|
savefile = RTP.getSaveFileName("Game.rxdata")
|
||||||
FontInstaller.install
|
|
||||||
data_system = pbLoadRxData("Data/System")
|
data_system = pbLoadRxData("Data/System")
|
||||||
mapfile = sprintf("Data/Map%03d.rxdata",data_system.start_map_id)
|
mapfile = sprintf("Data/Map%03d.rxdata",data_system.start_map_id)
|
||||||
if data_system.start_map_id==0 || !pbRgssExists?(mapfile)
|
if data_system.start_map_id==0 || !pbRgssExists?(mapfile)
|
||||||
@@ -480,146 +479,3 @@ class PokemonLoadScreen
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Font installer
|
|
||||||
################################################################################
|
|
||||||
module FontInstaller
|
|
||||||
# filenames of fonts to be installed
|
|
||||||
Filenames = [
|
|
||||||
'pkmnem.ttf',
|
|
||||||
'pkmnemn.ttf',
|
|
||||||
'pkmnems.ttf',
|
|
||||||
'pkmnrs.ttf',
|
|
||||||
'pkmndp.ttf',
|
|
||||||
'pkmnfl.ttf'
|
|
||||||
]
|
|
||||||
# names (not filenames) of fonts to be installed
|
|
||||||
Names = [
|
|
||||||
'Power Green',
|
|
||||||
'Power Green Narrow',
|
|
||||||
'Power Green Small',
|
|
||||||
'Power Red and Blue',
|
|
||||||
'Power Clear',
|
|
||||||
'Power Red and Green'
|
|
||||||
]
|
|
||||||
# whether to notify player (via pop-up message) that fonts were installed
|
|
||||||
Notify = true
|
|
||||||
# location of fonts (relative to game folder)
|
|
||||||
Source = 'Fonts/'
|
|
||||||
|
|
||||||
def self.getFontFolder
|
|
||||||
fontfolder = MiniRegistry.get(MiniRegistry::HKEY_CURRENT_USER,
|
|
||||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders","Fonts")
|
|
||||||
return fontfolder+"\\" if fontfolder
|
|
||||||
if ENV['SystemRoot']
|
|
||||||
return ENV['SystemRoot'] + '\\Fonts\\'
|
|
||||||
elsif ENV['windir']
|
|
||||||
return ENV['windir'] + '\\Fonts\\'
|
|
||||||
else
|
|
||||||
return '\\Windows\\Fonts\\'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
AFR = Win32API.new('gdi32', 'AddFontResource', ['P'], 'L')
|
|
||||||
WPS = Win32API.new('kernel32', 'WriteProfileString', ['P'] * 3, 'L')
|
|
||||||
SM = Win32API.new('user32', 'PostMessage', ['L'] * 4, 'L')
|
|
||||||
WM_FONTCHANGE = 0x001D
|
|
||||||
HWND_BROADCAST = 0xffff
|
|
||||||
|
|
||||||
def self.copy_file(src,dest)
|
|
||||||
File.open(src,'rb') { |r|
|
|
||||||
File.open(dest,'wb') { |w|
|
|
||||||
while s = r.read(4096)
|
|
||||||
w.write s
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.pbResolveFont(name)
|
|
||||||
RTP.eachPathFor(Source+name) { |file|
|
|
||||||
return file if safeExists?(file)
|
|
||||||
}
|
|
||||||
return Source+name
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.install
|
|
||||||
success = []
|
|
||||||
# Check if all fonts already exist
|
|
||||||
filesExist = true
|
|
||||||
dest = self.getFontFolder
|
|
||||||
for i in 0...Names.size
|
|
||||||
filesExist = false if !safeExists?(dest + Filenames[i])
|
|
||||||
end
|
|
||||||
return if filesExist
|
|
||||||
# Check if all source fonts exist
|
|
||||||
exist = true
|
|
||||||
for i in 0...Names.size
|
|
||||||
if !RTP.exists?(Source + Filenames[i])
|
|
||||||
exist = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return if !exist # Exit if not all source fonts exist
|
|
||||||
pbMessage(_INTL("One or more fonts used in this game do not exist on the system.\1"))
|
|
||||||
pbMessage(_INTL("The game can be played, but the look of the game's text will not be optimal."))
|
|
||||||
failed = false
|
|
||||||
for i in 0...Filenames.size
|
|
||||||
f = Filenames[i]
|
|
||||||
if safeExists?(dest + f) && !Font.exist?(Names[i])
|
|
||||||
File.delete(dest + f) rescue nil
|
|
||||||
end
|
|
||||||
# check if already installed...
|
|
||||||
if not safeExists?(dest + f)
|
|
||||||
# check to ensure font is in specified location...
|
|
||||||
if RTP.exists?(Source + f)
|
|
||||||
# copy file to fonts folder
|
|
||||||
succeeded = false
|
|
||||||
begin
|
|
||||||
copy_file(pbResolveFont(f), dest + f)
|
|
||||||
# add font resource
|
|
||||||
AFR.call(dest + f)
|
|
||||||
# add entry to win.ini/registry
|
|
||||||
WPS.call('Fonts', Names[i] + ' (TrueType)', f)
|
|
||||||
succeeded = safeExists?(dest + f)
|
|
||||||
rescue SystemCallError
|
|
||||||
# failed
|
|
||||||
succeeded = false
|
|
||||||
end
|
|
||||||
if succeeded
|
|
||||||
success.push(Names[i])
|
|
||||||
else
|
|
||||||
failed = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
success.push(Names[i]) # assume success
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if success.length>0 # one or more fonts successfully installed
|
|
||||||
SM.call(HWND_BROADCAST,WM_FONTCHANGE,0,0)
|
|
||||||
if Notify
|
|
||||||
fonts = ''
|
|
||||||
success.each do |f|
|
|
||||||
fonts << f << ', '
|
|
||||||
end
|
|
||||||
if failed
|
|
||||||
pbMessage(_INTL("Some of the fonts were successfully installed.\1"))
|
|
||||||
pbMessage(_INTL("To install the other fonts, copy the files in this game's Fonts folder to the Fonts folder in Control Panel.\1"))
|
|
||||||
else
|
|
||||||
pbMessage(_INTL("The fonts were successfully installed.\1"))
|
|
||||||
end
|
|
||||||
if pbConfirmMessage(_INTL("Would you like to restart the game and apply the changes?"))
|
|
||||||
a = Thread.new { system('Game') }
|
|
||||||
exit
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
# No fonts were installed.
|
|
||||||
pbMessage(_INTL("To install the necessary fonts, copy the files in this game's Fonts folder to the Fonts folder in Control Panel."))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ class Window_PokemonOption < Window_DrawableCommand
|
|||||||
rect = drawCursor(index,rect)
|
rect = drawCursor(index,rect)
|
||||||
optionname = (index==@options.length) ? _INTL("Cancel") : @options[index].name
|
optionname = (index==@options.length) ? _INTL("Cancel") : @options[index].name
|
||||||
optionwidth = rect.width*9/20
|
optionwidth = rect.width*9/20
|
||||||
text_y = rect.y + (mkxp? ? 6 : 0)
|
text_y = rect.y + 6
|
||||||
pbDrawShadowText(self.contents,rect.x,text_y,optionwidth,rect.height,optionname,
|
pbDrawShadowText(self.contents,rect.x,text_y,optionwidth,rect.height,optionname,
|
||||||
@nameBaseColor,@nameShadowColor)
|
@nameBaseColor,@nameShadowColor)
|
||||||
return if index==@options.length
|
return if index==@options.length
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ class PokemonBoxSprite < SpriteWrapper
|
|||||||
pbSetSystemFont(@contents)
|
pbSetSystemFont(@contents)
|
||||||
widthval = @contents.text_size(boxname).width
|
widthval = @contents.text_size(boxname).width
|
||||||
xval = 162-(widthval/2)
|
xval = 162-(widthval/2)
|
||||||
pbDrawShadowText(@contents,xval,8 + (mkxp? ? 6 : 0),widthval,32,
|
pbDrawShadowText(@contents,xval,8 + 6,widthval,32,
|
||||||
boxname,Color.new(248,248,248),Color.new(40,48,48))
|
boxname,Color.new(248,248,248),Color.new(40,48,48))
|
||||||
@refreshBox = false
|
@refreshBox = false
|
||||||
end
|
end
|
||||||
@@ -537,7 +537,7 @@ class PokemonBoxPartySprite < SpriteWrapper
|
|||||||
def refresh
|
def refresh
|
||||||
@contents.blt(0,0,@boxbitmap.bitmap,Rect.new(0,0,172,352))
|
@contents.blt(0,0,@boxbitmap.bitmap,Rect.new(0,0,172,352))
|
||||||
pbDrawTextPositions(self.bitmap,[
|
pbDrawTextPositions(self.bitmap,[
|
||||||
[_INTL("Back"),86,242 - (mkxp? ? 2 : 0),2,Color.new(248,248,248),Color.new(80,80,80),1]
|
[_INTL("Back"),86,240,2,Color.new(248,248,248),Color.new(80,80,80),1]
|
||||||
])
|
])
|
||||||
|
|
||||||
xvalues = [18,90,18,90,18,90]
|
xvalues = [18,90,18,90,18,90]
|
||||||
@@ -1385,8 +1385,8 @@ class PokemonStorageScene
|
|||||||
buttonbase = Color.new(248,248,248)
|
buttonbase = Color.new(248,248,248)
|
||||||
buttonshadow = Color.new(80,80,80)
|
buttonshadow = Color.new(80,80,80)
|
||||||
pbDrawTextPositions(overlay,[
|
pbDrawTextPositions(overlay,[
|
||||||
[_INTL("Party: {1}",(@storage.party.length rescue 0)),270,328 - (mkxp? ? 2 : 0),2,buttonbase,buttonshadow,1],
|
[_INTL("Party: {1}",(@storage.party.length rescue 0)),270,326,2,buttonbase,buttonshadow,1],
|
||||||
[_INTL("Exit"),446,328 - (mkxp? ? 2 : 0),2,buttonbase,buttonshadow,1],
|
[_INTL("Exit"),446,326,2,buttonbase,buttonshadow,1],
|
||||||
])
|
])
|
||||||
pokemon = nil
|
pokemon = nil
|
||||||
if @screen.pbHeldPokemon
|
if @screen.pbHeldPokemon
|
||||||
|
|||||||
@@ -98,11 +98,7 @@ def pbScreenCapture
|
|||||||
filestart = sprintf("%s.%03d",filestart,(t.to_f-t.to_i)*1000) # milliseconds
|
filestart = sprintf("%s.%03d",filestart,(t.to_f-t.to_i)*1000) # milliseconds
|
||||||
capturefile = RTP.getSaveFileName(sprintf("%s.png",filestart))
|
capturefile = RTP.getSaveFileName(sprintf("%s.png",filestart))
|
||||||
if capturefile && safeExists?("rubyscreen.dll")
|
if capturefile && safeExists?("rubyscreen.dll")
|
||||||
if mkxp?
|
|
||||||
Graphics.screenshot(capturefile)
|
Graphics.screenshot(capturefile)
|
||||||
else
|
|
||||||
Graphics.snap_to_bitmap(false).saveToPng(capturefile)
|
|
||||||
end
|
|
||||||
pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full")
|
pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class SpriteWindow_DebugVariables < Window_DrawableCommand
|
|||||||
idWidth = totalWidth*15/100
|
idWidth = totalWidth*15/100
|
||||||
nameWidth = totalWidth*65/100
|
nameWidth = totalWidth*65/100
|
||||||
statusWidth = totalWidth*20/100
|
statusWidth = totalWidth*20/100
|
||||||
text_y = rect.y + (mkxp? ? 6 : 0)
|
text_y = rect.y + 6
|
||||||
self.shadowtext(rect.x,text_y,idWidth,rect.height,id_text)
|
self.shadowtext(rect.x,text_y,idWidth,rect.height,id_text)
|
||||||
self.shadowtext(rect.x+idWidth,text_y,nameWidth,rect.height,name,0,(codeswitch) ? 1 : 0)
|
self.shadowtext(rect.x+idWidth,text_y,nameWidth,rect.height,name,0,(codeswitch) ? 1 : 0)
|
||||||
self.shadowtext(rect.x+idWidth+nameWidth,text_y,statusWidth,rect.height,status,1,colors)
|
self.shadowtext(rect.x+idWidth+nameWidth,text_y,statusWidth,rect.height,status,1,colors)
|
||||||
@@ -427,7 +427,7 @@ class SpriteWindow_DebugRoamers < Window_DrawableCommand
|
|||||||
else
|
else
|
||||||
status = "[NOT ROAMING][Switch #{pkmn[2]} is off]"
|
status = "[NOT ROAMING][Switch #{pkmn[2]} is off]"
|
||||||
end
|
end
|
||||||
text_y = rect.y + (mkxp? ? 6 : 0)
|
text_y = rect.y + 6
|
||||||
self.shadowtext(name,rect.x,text_y,nameWidth,rect.height)
|
self.shadowtext(name,rect.x,text_y,nameWidth,rect.height)
|
||||||
self.shadowtext(status,rect.x+nameWidth,text_y,statusWidth,rect.height,1,statuscolor)
|
self.shadowtext(status,rect.x+nameWidth,text_y,statusWidth,rect.height,1,statuscolor)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -668,7 +668,7 @@ module Compiler
|
|||||||
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?
|
pbSetWindowText(nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def main
|
def main
|
||||||
@@ -730,28 +730,6 @@ module Compiler
|
|||||||
pbSaveAllData
|
pbSaveAllData
|
||||||
mustCompile = true
|
mustCompile = true
|
||||||
end
|
end
|
||||||
# Check data files and PBS files, and recompile if any PBS file was edited
|
|
||||||
# more recently than the data files were last created
|
|
||||||
if !mkxp?
|
|
||||||
for i in 0...dataFiles.length
|
|
||||||
begin
|
|
||||||
File.open("Data/#{dataFiles[i]}") { |file|
|
|
||||||
latestDataTime = [latestDataTime,file.mtime.to_i].max
|
|
||||||
}
|
|
||||||
rescue SystemCallError
|
|
||||||
mustCompile = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for i in 0...textFiles.length
|
|
||||||
begin
|
|
||||||
File.open("PBS/#{textFiles[i]}") { |file|
|
|
||||||
latestTextTime = [latestTextTime,file.mtime.to_i].max
|
|
||||||
}
|
|
||||||
rescue SystemCallError
|
|
||||||
end
|
|
||||||
end
|
|
||||||
mustCompile |= (latestTextTime>=latestDataTime)
|
|
||||||
end
|
|
||||||
# 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)
|
||||||
|
|||||||
BIN
mkxp-z.exe
BIN
mkxp-z.exe
Binary file not shown.
Reference in New Issue
Block a user