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

View File

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

View File

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

View File

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

View File

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

View File

@@ -355,7 +355,6 @@ class PokemonLoadScreen
$PokemonBag = Marshal.load(f)
$PokemonStorage = Marshal.load(f)
$SaveVersion = Marshal.load(f) unless f.eof?
pbRefreshResizeFactor # To fix Game_Screen pictures
magicNumberMatches = false
if $data_system.respond_to?("magic_number")
magicNumberMatches = ($game_system.magic_number==$data_system.magic_number)
@@ -427,7 +426,6 @@ class PokemonLoadScreen
$PokemonStorage = PokemonStorage.new
$PokemonEncounters = PokemonEncounters.new
$PokemonTemp.begunNewGame = true
pbRefreshResizeFactor # To fix Game_Screen pictures
$data_system = pbLoadRxData("Data/System")
$MapFactory = PokemonMapFactory.new($data_system.start_map_id) # calls setMapChanged
$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)
@textskin = 0 # Speech frame
@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)
@language = 0 # Language (see also LANGUAGES in script PokemonSystem)
@runstyle = 0 # Run key functionality (0=hold to run, 1=toggle auto-run)
@@ -508,8 +508,8 @@ class PokemonOption_Scene
proc { $PokemonSystem.textinput },
proc { |value| $PokemonSystem.textinput = value }
),
EnumOption.new(_INTL("Screen Size"),[_INTL("S"),_INTL("M"),_INTL("L"),_INTL("Full")],
proc { [$PokemonSystem.screensize,3].min },
EnumOption.new(_INTL("Screen Size"),[_INTL("S"),_INTL("M"),_INTL("L"),_INTL("XL"),_INTL("Full")],
proc { [$PokemonSystem.screensize,4].min },
proc { |value|
oldvalue = $PokemonSystem.screensize
$PokemonSystem.screensize = value

View File

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

View File

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

View File

@@ -73,12 +73,6 @@ def pbSetUpSystem
begin
consts = pbSafeLoad("Data/Constants.rxdata")
consts = [] if !consts
GameData::Ability.load
GameData::Item.load
GameData::Move.load
GameData::BerryPlant.load
GameData::Metadata.load
GameData::MapMetadata.load
rescue
consts = []
end
@@ -86,6 +80,7 @@ def pbSetUpSystem
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
pbLoadMessages("Data/"+LANGUAGES[pokemonSystem.language][1])
@@ -96,11 +91,12 @@ def pbScreenCapture
t = pbGetTimeNow
filestart = t.strftime("[%Y-%m-%d] %H_%M_%S")
filestart = sprintf("%s.%03d",filestart,(t.to_f-t.to_i)*1000) # milliseconds
capturefile = RTP.getSaveFileName(sprintf("%s.png",filestart))
if capturefile && safeExists?("rubyscreen.dll")
capturefile = RTP.getSaveFileName(sprintf("%s.bmp",filestart))
# if capturefile && safeExists?("rubyscreen.dll")
Graphics.screenshot(capturefile)
# Graphics.snap_to_bitmap.saveToPng(capturefile)
pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full")
end
# end
end
def pbDebugF7

View File

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