mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Makes it possible to download sprites at runtime
This commit is contained in:
@@ -25,7 +25,7 @@ module Settings
|
||||
CUSTOM_BATTLERS_FOLDER_INDEXED = "Graphics/CustomBattlers/indexed"
|
||||
BATTLERS_FOLDER = "Graphics/Battlers/"
|
||||
DOWNLOADED_SPRITES_FOLDER = "Graphics/temp/"
|
||||
|
||||
DEFAULT_SPRITE_PATH = "Graphics/Battlers/Special/000.png"
|
||||
FRONTSPRITE_POSITION_OFFSET = 20
|
||||
FRONTSPRITE_SCALE = 0.6666666666
|
||||
BACKRPSPRITE_SCALE = 1
|
||||
|
||||
@@ -408,7 +408,7 @@ end
|
||||
#end
|
||||
|
||||
|
||||
def getCustomSpeciesList()
|
||||
def getCustomSpeciesList(allowOnline=true)
|
||||
speciesList = []
|
||||
|
||||
for num in 1..NB_POKEMON
|
||||
@@ -429,6 +429,16 @@ def getCustomSpeciesList()
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if speciesList.length <= 200 && allowOnline
|
||||
#try to get list from github
|
||||
print "let's try it online bruh"
|
||||
online_list = list_online_custom_sprites
|
||||
return online_list if online_list !=nil
|
||||
end
|
||||
|
||||
|
||||
return speciesList
|
||||
end
|
||||
# def getCustomSpeciesList()
|
||||
|
||||
@@ -110,7 +110,8 @@ class DoublePreviewScreen
|
||||
bitmap = AnimatedBitmap.new(picturePath)
|
||||
bitmap.scale_bitmap(Settings::FRONTSPRITE_SCALE)
|
||||
|
||||
hasCustom = picturePath.include?("CustomBattlers")
|
||||
#hasCustom = picturePath.include?("CustomBattlers")
|
||||
hasCustom = customSpriteExistsBase(body_pokemon,head_pokemon)
|
||||
|
||||
previewwindow = PictureWindow.new(bitmap)
|
||||
previewwindow.x = x
|
||||
@@ -131,13 +132,7 @@ class DoublePreviewScreen
|
||||
|
||||
|
||||
def getPicturePath(head_pokemon, body_pokemon)
|
||||
pathCustom = _INTL("Graphics/CustomBattlers/indexed/{1}/{1}.{2}.png", head_pokemon, body_pokemon)
|
||||
if (pbResolveBitmap(pathCustom))
|
||||
picturePath = pathCustom
|
||||
else
|
||||
picturePath = _INTL("Graphics/Battlers/{1}/{1}.{2}.png",head_pokemon , body_pokemon)
|
||||
end
|
||||
return picturePath
|
||||
return get_fusion_sprite_path(head_pokemon,body_pokemon)
|
||||
end
|
||||
|
||||
def drawFusionInformation(fusedDexNum, level, x = 0)
|
||||
|
||||
@@ -132,7 +132,7 @@ end
|
||||
|
||||
def getRandomCustomFusionForIntro(returnRandomPokemonIfNoneFound = true, customPokeList = [], maxPoke = -1, recursionLimit = 3)
|
||||
if customPokeList.length == 0
|
||||
customPokeList = getCustomSpeciesList()
|
||||
customPokeList = getCustomSpeciesList(false )
|
||||
end
|
||||
randPoke = []
|
||||
if customPokeList.length >= 5000
|
||||
@@ -401,9 +401,18 @@ def customSpriteExists(species)
|
||||
head = getBasePokemonID(species, false)
|
||||
body = getBasePokemonID(species, true)
|
||||
pathCustom = getCustomSpritePath(body,head)
|
||||
return pbResolveBitmap(pathCustom) != nil
|
||||
|
||||
return true if pbResolveBitmap(pathCustom) != nil
|
||||
return download_custom_sprite(head, body) != nil
|
||||
end
|
||||
|
||||
def customSpriteExistsBase(head,body)
|
||||
pathCustom = getCustomSpritePath(body,head)
|
||||
return true if pbResolveBitmap(pathCustom) != nil
|
||||
return download_custom_sprite(head, body) != nil
|
||||
end
|
||||
|
||||
|
||||
def getArceusPlateType(heldItem)
|
||||
return :NORMAL if heldItem == nil
|
||||
case heldItem
|
||||
|
||||
@@ -70,6 +70,7 @@ class Scene_Intro
|
||||
pbBGMStop(1.0)
|
||||
# disposes current title screen
|
||||
disposeTitle
|
||||
clearTempFolder
|
||||
# initializes load screen
|
||||
sscene = PokemonLoad_Scene.new
|
||||
sscreen = PokemonLoadScreen.new(sscene)
|
||||
@@ -129,19 +130,18 @@ class GenOneStyle
|
||||
Kernel.pbDisplayText("Version " + Settings::GAME_VERSION_NUMBER, 254, 308, 99999)
|
||||
|
||||
@maxPoke = 140 #1st gen, pas de legend la premiere fois, graduellement plus de poke
|
||||
@customPokeList = getCustomSpeciesList()
|
||||
@customPokeList = getCustomSpeciesList(false)
|
||||
#Get random Pokemon (1st gen orandPokenly, pas de legend la prmeiere fois)
|
||||
|
||||
randPoke = getRandomCustomFusionForIntro(true, @customPokeList, @maxPoke)
|
||||
randpoke1 = randPoke[0] #rand(@maxPoke)+1
|
||||
randpoke2 = randPoke[1] #rand(@maxPoke)+1
|
||||
|
||||
randpoke1s = randpoke1.to_s
|
||||
randpoke2s = randpoke2.to_s
|
||||
|
||||
path_s1 = "Graphics/Battlers/" + randpoke1s + "/" + randpoke1s + ".png"
|
||||
path_s2 = "Graphics/Battlers/" + randpoke2s + "/" + randpoke2s + ".png"
|
||||
path_f = getFusedPath(randpoke1, randpoke2)
|
||||
path_s1 = get_unfused_sprite_path(randpoke1)
|
||||
path_s2 = get_unfused_sprite_path(randpoke2)
|
||||
path_f = get_fusion_sprite_path(randpoke1, randpoke2)
|
||||
|
||||
@prevPoke1 = randpoke1
|
||||
@prevPoke2 = randpoke2
|
||||
@@ -219,7 +219,7 @@ class GenOneStyle
|
||||
@sprites["poke"].tone = Tone.new(0, 0, 0, 255)
|
||||
@sprites["poke"].opacity = 0
|
||||
@sprites["poke2"] = Sprite.new(@viewport)
|
||||
@sprites["poke2"].bitmap = pbBitmap("Graphics/Battlers/21364")
|
||||
# @sprites["poke2"].bitmap = pbBitmap("Graphics/Battlers/21364")
|
||||
@sprites["poke2"].tone = Tone.new(255, 255, 255, 255)
|
||||
@sprites["poke2"].src_rect.set(0, Graphics.height, Graphics.width, 48)
|
||||
@sprites["poke2"].y = Graphics.height
|
||||
@@ -372,11 +372,8 @@ class GenOneStyle
|
||||
randpoke1 = randPoke[0] #rand(@maxPoke)+1
|
||||
randpoke2 = randPoke[1] #rand(@maxPoke)+1
|
||||
|
||||
randpoke1s = randpoke1.to_s
|
||||
randpoke2s = randpoke2.to_s
|
||||
|
||||
path_s1 = "Graphics/Battlers/" + randpoke1s + "/" + randpoke1s + ".png"
|
||||
path_s2 = "Graphics/Battlers/" + randpoke2s + "/" + randpoke2s + ".png"
|
||||
path_s1 = get_unfused_sprite_path(randpoke1)
|
||||
path_s2 = get_unfused_sprite_path(randpoke2)
|
||||
path_f = getFusedPath(randpoke1, randpoke2)
|
||||
|
||||
path_fMod = getFusedPath(@prevPoke1, @prevPoke2)
|
||||
@@ -408,11 +405,11 @@ class GenOneStyle
|
||||
|
||||
#new version
|
||||
def getFusedPath(randpoke1, randpoke2)
|
||||
path = rand(2) == 0 ? GetSpritePathForced(randpoke1, randpoke2, true) : GetSpritePathForced(randpoke2, randpoke1, true)
|
||||
path = rand(2) == 0 ? get_fusion_sprite_path(randpoke1, randpoke2) : get_fusion_sprite_path(randpoke2, randpoke1)
|
||||
if Input.press?(Input::RIGHT)
|
||||
path = GetSpritePathForced(randpoke1, randpoke2, true)
|
||||
path = get_fusion_sprite_path(randpoke2, randpoke1)
|
||||
elsif Input.press?(Input::LEFT)
|
||||
path = GetSpritePathForced(randpoke2, randpoke1, true)
|
||||
path = get_fusion_sprite_path(randpoke1, randpoke2)
|
||||
end
|
||||
return path
|
||||
end
|
||||
|
||||
@@ -44,7 +44,7 @@ def handleReplaceExistingSprites()
|
||||
end
|
||||
|
||||
def pbCallTitle
|
||||
return Scene_DebugIntro.new if $DEBUG
|
||||
#return Scene_DebugIntro.new if $DEBUG
|
||||
return Scene_Intro.new
|
||||
end
|
||||
|
||||
@@ -144,7 +144,11 @@ def mainFunctionDebug
|
||||
Graphics.update
|
||||
Graphics.freeze
|
||||
clearTempFolder()
|
||||
sortCustomBattlers()
|
||||
begin
|
||||
sortCustomBattlers()
|
||||
rescue
|
||||
echo "failed to sort custom battlers"
|
||||
end
|
||||
$scene = pbCallTitle
|
||||
$scene.main until $scene.nil?
|
||||
Graphics.transition(20)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user