Added 1.5x screen size option, fixed 2**32 being 0, tidied up some code

This commit is contained in:
Maruno17
2020-11-22 17:32:10 +00:00
parent f362b7f847
commit 4af57f6501
11 changed files with 36 additions and 35 deletions

View File

@@ -21,15 +21,17 @@ def pbSetResizeFactor(factor)
Graphics.resize_screen(SCREEN_WIDTH, SCREEN_HEIGHT) Graphics.resize_screen(SCREEN_WIDTH, SCREEN_HEIGHT)
$ResizeInitialized = true $ResizeInitialized = true
end end
if factor < 0 || factor == 3 if factor < 0 || factor == 4
Graphics.fullscreen = true if !Graphics.fullscreen Graphics.fullscreen = true if !Graphics.fullscreen
else else
Graphics.fullscreen = false if Graphics.fullscreen Graphics.fullscreen = false if Graphics.fullscreen
Graphics.scale = factor Graphics.scale = (factor + 1) * 0.5
Graphics.center Graphics.center
end end
end end
=begin
# Unused
def pbRefreshResizeFactor def pbRefreshResizeFactor
ObjectSpace.each_object(Sprite) { |o| ObjectSpace.each_object(Sprite) { |o|
next if o.disposed? next if o.disposed?
@@ -119,6 +121,7 @@ def pbConfigureWindowedScreen(value)
pbSetResizeFactor2(value,true) pbSetResizeFactor2(value,true)
Win32API.restoreScreen Win32API.restoreScreen
end end
=end
def setScreenBorderName(border) def setScreenBorderName(border)
if !$HaveResizeBorder if !$HaveResizeBorder
@@ -187,6 +190,8 @@ module Graphics
@@haveresizescreen = true @@haveresizescreen = true
@@deletefailed = false @@deletefailed = false
=begin
# TODO: Can this be removed?
def self.snap_to_bitmap(resize=true) def self.snap_to_bitmap(resize=true)
tempPath = ENV["TEMP"]+"\\tempscreen.bmp" tempPath = ENV["TEMP"]+"\\tempscreen.bmp"
if safeExists?(tempPath) && @@deletefailed if safeExists?(tempPath) && @@deletefailed
@@ -243,10 +248,11 @@ module Graphics
end end
return bm return bm
end end
=end
end end
=begin
class Sprite class Sprite
unless @SpriteResizerMethodsAliased unless @SpriteResizerMethodsAliased
alias _initialize_SpriteResizer initialize alias _initialize_SpriteResizer initialize
@@ -570,7 +576,7 @@ class Plane
@resizedZoomY=val @resizedZoomY=val
end end
end end
=end

View File

@@ -117,4 +117,13 @@ module GameData
return false return false
end end
end end
def self.load_all
Ability.load
Item.load
Move.load
BerryPlant.load
Metadata.load
MapMetadata.load
end
end end

View File

@@ -415,7 +415,7 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM) if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
2.times do # 3 times as likely 2.times do # 3 times as likely
break if genwildpoke.shiny? break if genwildpoke.shiny?
genwildpoke.personalID = rand(65536)|(rand(65536)<<16) genwildpoke.personalID = rand(2**16) | rand(2**16) << 16
end end
end end
# Give Pokérus # Give Pokérus

View File

@@ -351,7 +351,7 @@ def pbDayCareGenerateEgg
if shinyretries>0 if shinyretries>0
shinyretries.times do shinyretries.times do
break if egg.shiny? break if egg.shiny?
egg.personalID = rand(65536)|(rand(65536)<<16) egg.personalID = rand(2**16) | rand(2**16) << 16
end end
end end
# Inheriting ability from the mother # Inheriting ability from the mother

View File

@@ -1047,7 +1047,7 @@ class Pokemon
end end
@species = realSpecies @species = realSpecies
@name = PBSpecies.getName(@species) @name = PBSpecies.getName(@species)
@personalID = rand(2**32) @personalID = rand(2**16) | rand(2**16) << 16
@hp = 1 @hp = 1
@totalhp = 1 @totalhp = 1
@iv = [] @iv = []

View File

@@ -355,7 +355,6 @@ class PokemonLoadScreen
$PokemonBag = Marshal.load(f) $PokemonBag = Marshal.load(f)
$PokemonStorage = Marshal.load(f) $PokemonStorage = Marshal.load(f)
$SaveVersion = Marshal.load(f) unless f.eof? $SaveVersion = Marshal.load(f) unless f.eof?
pbRefreshResizeFactor # To fix Game_Screen pictures
magicNumberMatches = false magicNumberMatches = false
if $data_system.respond_to?("magic_number") if $data_system.respond_to?("magic_number")
magicNumberMatches = ($game_system.magic_number==$data_system.magic_number) magicNumberMatches = ($game_system.magic_number==$data_system.magic_number)
@@ -427,7 +426,6 @@ class PokemonLoadScreen
$PokemonStorage = PokemonStorage.new $PokemonStorage = PokemonStorage.new
$PokemonEncounters = PokemonEncounters.new $PokemonEncounters = PokemonEncounters.new
$PokemonTemp.begunNewGame = true $PokemonTemp.begunNewGame = true
pbRefreshResizeFactor # To fix Game_Screen pictures
$data_system = pbLoadRxData("Data/System") $data_system = pbLoadRxData("Data/System")
$MapFactory = PokemonMapFactory.new($data_system.start_map_id) # calls setMapChanged $MapFactory = PokemonMapFactory.new($data_system.start_map_id) # calls setMapChanged
$game_player.moveto($data_system.start_x, $data_system.start_y) $game_player.moveto($data_system.start_x, $data_system.start_y)

View File

@@ -20,7 +20,7 @@ class PokemonSystem
@frame = 0 # Default window frame (see also $TextFrames) @frame = 0 # Default window frame (see also $TextFrames)
@textskin = 0 # Speech frame @textskin = 0 # Speech frame
@font = 0 # Font (see also $VersionStyles) @font = 0 # Font (see also $VersionStyles)
@screensize = (SCREEN_ZOOM.floor).to_i # 0=half size, 1=full size, 2=double size @screensize = (SCREEN_ZOOM * 2).floor - 1 # 0=half size, 1=full size, 2=full-and-a-half size, 3=double size
@border = 0 # Screen border (0=off, 1=on) @border = 0 # Screen border (0=off, 1=on)
@language = 0 # Language (see also LANGUAGES in script PokemonSystem) @language = 0 # Language (see also LANGUAGES in script PokemonSystem)
@runstyle = 0 # Run key functionality (0=hold to run, 1=toggle auto-run) @runstyle = 0 # Run key functionality (0=hold to run, 1=toggle auto-run)
@@ -508,8 +508,8 @@ class PokemonOption_Scene
proc { $PokemonSystem.textinput }, proc { $PokemonSystem.textinput },
proc { |value| $PokemonSystem.textinput = value } proc { |value| $PokemonSystem.textinput = value }
), ),
EnumOption.new(_INTL("Screen Size"),[_INTL("S"),_INTL("M"),_INTL("L"),_INTL("Full")], EnumOption.new(_INTL("Screen Size"),[_INTL("S"),_INTL("M"),_INTL("L"),_INTL("XL"),_INTL("Full")],
proc { [$PokemonSystem.screensize,3].min }, proc { [$PokemonSystem.screensize,4].min },
proc { |value| proc { |value|
oldvalue = $PokemonSystem.screensize oldvalue = $PokemonSystem.screensize
$PokemonSystem.screensize = value $PokemonSystem.screensize = value

View File

@@ -380,11 +380,7 @@ def pbReceiveMysteryGift(id)
end end
gift=$Trainer.mysterygift[index] gift=$Trainer.mysterygift[index]
if gift[1]==0 # Pokémon if gift[1]==0 # Pokémon
pID=rand(256) gift[2].personalID = rand(2**16) | rand(2**16) << 16
pID|=rand(256)<<8
pID|=rand(256)<<16
pID|=rand(256)<<24
gift[2].personalID=pID
gift[2].calcStats gift[2].calcStats
time=pbGetTimeNow time=pbGetTimeNow
gift[2].timeReceived=time.getgm.to_i gift[2].timeReceived=time.getgm.to_i

View File

@@ -158,11 +158,10 @@ class PBPokemon
def createPokemon(level,iv,trainer) def createPokemon(level,iv,trainer)
pokemon=Pokemon.new(@species,level,trainer,false) pokemon=Pokemon.new(@species,level,trainer,false)
pokemon.setItem(@item) pokemon.setItem(@item)
pokemon.personalID=rand(65536) pokemon.personalID = rand(2**16) | rand(2**16) << 16
pokemon.personalID|=rand(65536)<<8 pokemon.personalID -= pokemon.personalID % 25
pokemon.personalID-=pokemon.personalID%25 pokemon.personalID += nature
pokemon.personalID+=nature pokemon.personalID &= 0xFFFFFFFF
pokemon.personalID&=0xFFFFFFFF
pokemon.happiness=0 pokemon.happiness=0
pokemon.moves[0]=PBMove.new(self.convertMove(@move1)) pokemon.moves[0]=PBMove.new(self.convertMove(@move1))
pokemon.moves[1]=PBMove.new(self.convertMove(@move2)) pokemon.moves[1]=PBMove.new(self.convertMove(@move2))

View File

@@ -73,12 +73,6 @@ def pbSetUpSystem
begin begin
consts = pbSafeLoad("Data/Constants.rxdata") consts = pbSafeLoad("Data/Constants.rxdata")
consts = [] if !consts consts = [] if !consts
GameData::Ability.load
GameData::Item.load
GameData::Move.load
GameData::BerryPlant.load
GameData::Metadata.load
GameData::MapMetadata.load
rescue rescue
consts = [] consts = []
end end
@@ -86,6 +80,7 @@ def pbSetUpSystem
next if !script next if !script
eval(Zlib::Inflate.inflate(script[2]),nil,script[1]) eval(Zlib::Inflate.inflate(script[2]),nil,script[1])
end end
GameData.load_all
if LANGUAGES.length>=2 if LANGUAGES.length>=2
pokemonSystem.language = pbChooseLanguage if !havedata pokemonSystem.language = pbChooseLanguage if !havedata
pbLoadMessages("Data/"+LANGUAGES[pokemonSystem.language][1]) pbLoadMessages("Data/"+LANGUAGES[pokemonSystem.language][1])
@@ -96,11 +91,12 @@ def pbScreenCapture
t = pbGetTimeNow t = pbGetTimeNow
filestart = t.strftime("[%Y-%m-%d] %H_%M_%S") filestart = t.strftime("[%Y-%m-%d] %H_%M_%S")
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.bmp",filestart))
if capturefile && safeExists?("rubyscreen.dll") # if capturefile && safeExists?("rubyscreen.dll")
Graphics.screenshot(capturefile) Graphics.screenshot(capturefile)
# Graphics.snap_to_bitmap.saveToPng(capturefile)
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
def pbDebugF7 def pbDebugF7

View File

@@ -299,10 +299,7 @@ module PokemonDebugMixin
end end
end end
when 2 # Randomise pID when 2 # Randomise pID
pkmn.personalID = rand(256) pkmn.personalID = rand(2**16) | rand(2**16) << 16
pkmn.personalID |= rand(256)<<8
pkmn.personalID |= rand(256)<<16
pkmn.personalID |= rand(256)<<24
pkmn.calcStats pkmn.calcStats
pbRefreshSingle(pkmnid) pbRefreshSingle(pkmnid)
end end