double fusion preview screen

This commit is contained in:
infinitefusion
2022-11-05 19:53:14 -04:00
parent 5bcb63f57a
commit e59254af3c
9 changed files with 252 additions and 59 deletions

View File

@@ -1,29 +1,122 @@
class DoublePreviewScreen
def initialize(poke1,poke2, usingSuperSplicers=false)
@typewindows=[]
@picture1=nil
@picture2=nil
SELECT_ARROW_X_LEFT= 100
SELECT_ARROW_X_RIGHT= 350
SELECT_ARROW_X_CANCEL= 230
SELECT_ARROW_Y_SELECT= 0
SELECT_ARROW_Y_CANCEL= 210
ARROW_GRAPHICS_PATH = "Graphics/Pictures/selHand"
CANCEL_BUTTON_PATH = "Graphics/Pictures/previewScreen_Cancel"
BACKGROUND_PATH = "Graphics/Pictures/shadeFull_"
CANCEL_BUTTON_X= 140
CANCEL_BUTTON_Y= 260
def initialize(species_left, species_right)
@species_left = species_left
@species_right = species_right
@typewindows = []
@picture1 = nil
@picture2 = nil
@draw_types = nil
@draw_level = nil
@selected = 0
@last_post=0
@sprites = {}
initializeBackground
initializeSelectArrow
initializeCancelButton
end
def draw_window(dexNumber ,level, x, y)
body_pokemon = getBodyID(dexNumber)
head_pokemon = getHeadID(dexNumber,body_pokemon)
def getBackgroundPicture
return BACKGROUND_PATH
end
picturePath = getPicturePath(body_pokemon,head_pokemon)
def getSelection
selected = startSelection
@sprites["cancel"].visible=false
#@sprites["arrow"].visible=false
#todo: il y a un fuck en quelque part.... en attendant ca marche inversé ici
return @species_left if selected == 0
return @species_right if selected == 1
return -1
end
def startSelection
loop do
Graphics.update
Input.update
updateSelection
if Input.trigger?(Input::USE)
return @selected
end
if Input.trigger?(Input::BACK)
return -1
end
end
end
def updateSelection
currentSelected = @selected
updateSelectionIndex
if @selected != currentSelected
updateSelectionGraphics
end
end
def updateSelectionIndex
if Input.trigger?(Input::LEFT)
@selected = 0
elsif Input.trigger?(Input::RIGHT)
@selected = 1
end
if @selected == -1
if Input.trigger?(Input::UP)
@selected = @last_post
end
else
if Input.trigger?(Input::DOWN)
@last_post = @selected
@selected = -1
end
end
end
def updateSelectionGraphics
if @selected == 0
@sprites["arrow"].x = SELECT_ARROW_X_LEFT
@sprites["arrow"].y = SELECT_ARROW_Y_SELECT
elsif @selected == 1
@sprites["arrow"].x = SELECT_ARROW_X_RIGHT
@sprites["arrow"].y = SELECT_ARROW_Y_SELECT
else
@sprites["arrow"].x = SELECT_ARROW_X_CANCEL
@sprites["arrow"].y = SELECT_ARROW_Y_CANCEL
end
pbUpdateSpriteHash(@sprites)
end
def draw_window(dexNumber, level, x, y)
body_pokemon = getBodyID(dexNumber)
head_pokemon = getHeadID(dexNumber, body_pokemon)
picturePath = getPicturePath(head_pokemon, body_pokemon)
bitmap = AnimatedBitmap.new(picturePath)
bitmap.scale_bitmap(Settings::FRONTSPRITE_SCALE)
hasCustom = picturePath.include?("CustomBattlers")
previewwindow = PictureWindow.new(bitmap)
previewwindow.x = x
previewwindow.y = y
previewwindow.z = 1000000
previewwindow.z = 100000
drawFusionInformation(dexNumber,level, x)
drawFusionInformation(dexNumber, level, x)
if !$Trainer.seen?(dexNumber)
if hasCustom
@@ -35,20 +128,47 @@ class DoublePreviewScreen
return previewwindow
end
def getPicturePath(body_pokemon, head_pokemon)
pathCustom = _INTL("Graphics/CustomBattlers/{1}.{2}.png", body_pokemon, head_pokemon)
def getPicturePath(head_pokemon, body_pokemon)
pathCustom = _INTL("Graphics/CustomBattlers/{1}.{2}.png", head_pokemon, body_pokemon)
if (pbResolveBitmap(pathCustom))
picturePath = pathCustom
else
picturePath = _INTL("Graphics/Battlers/{1}/{1}.{2}.png", body_pokemon, head_pokemon)
picturePath = _INTL("Graphics/Battlers/{1}/{1}.{2}.png",head_pokemon , body_pokemon)
end
return picturePath
end
def drawFusionInformation(fusedDexNum, level, x=0)
def drawFusionInformation(fusedDexNum, level, x = 0)
viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@typewindows << drawPokemonType(fusedDexNum,viewport, x+40,220) if @draw_types
drawFusionPreviewText(viewport, "Lv. " + level.to_s, x+60, 40,) if @draw_level
@typewindows << drawPokemonType(fusedDexNum, viewport, x + 40, 220) if @draw_types
drawFusionPreviewText(viewport, "Lv. " + level.to_s, x + 60, 40,) if @draw_level
end
def initializeSelectArrow
@sprites["arrow"] = IconSprite.new(0, 0, @viewport)
@sprites["arrow"].setBitmap(ARROW_GRAPHICS_PATH)
@sprites["arrow"].x = SELECT_ARROW_X_LEFT
@sprites["arrow"].y = SELECT_ARROW_Y_SELECT
@sprites["arrow"].z = 100001
end
def initializeCancelButton()
@sprites["cancel"] = IconSprite.new(0, 0, @viewport)
@sprites["cancel"].setBitmap(CANCEL_BUTTON_PATH)
@sprites["cancel"].x = CANCEL_BUTTON_X
@sprites["cancel"].y = CANCEL_BUTTON_Y
@sprites["cancel"].z = 100000
end
def initializeBackground()
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@sprites["background"].setBitmap(getBackgroundPicture)
@sprites["background"].x = 0
@sprites["background"].y = 0
@sprites["background"].z = 99999
end
def drawFusionPreviewText(viewport, text, x, y)
@@ -65,6 +185,8 @@ class DoublePreviewScreen
for typeWindow in @typewindows
typeWindow.dispose
end
pbDisposeSpriteHash(@sprites)
end
def drawPokemonType(pokemon_id, viewport, x_pos = 192, y_pos = 264)
@@ -87,5 +209,4 @@ class DoublePreviewScreen
return viewport
end
end

View File

@@ -650,7 +650,7 @@ class PokemonFusionScene
# Opens the fusion screen
def pbFusionScreen(cancancel = false, superSplicer = false)
def pbFusionScreen(cancancel = false, superSplicer = false, firstOptionSelected=false)
metaplayer1 = SpriteMetafilePlayer.new(@metafile1, @sprites["rsprite1"])
metaplayer2 = SpriteMetafilePlayer.new(@metafile2, @sprites["rsprite2"])
metaplayer3 = SpriteMetafilePlayer.new(@metafile3, @sprites["rsprite3"])
@@ -739,7 +739,7 @@ class PokemonFusionScene
#@pokemon1.ability = pbChooseAbility(@pokemon1, hiddenAbility1, hiddenAbility2)
pbChooseAbility(@pokemon1, hiddenAbility1, hiddenAbility2)
setFusionMoves(@pokemon1, @pokemon2) if !noMoves
setFusionMoves(@pokemon1, @pokemon2, firstOptionSelected) if !noMoves
# if superSplicer
# @pokemon1.nature = pbChooseNature(@pokemon1.nature, @pokemon2.nature)
@@ -792,7 +792,7 @@ def setAbilityAndNature(abilitiesList, naturesList)
end
def setFusionMoves(fusedPoke, poke2)
def setFusionMoves(fusedPoke, poke2,selected2ndOption=false)
#NEW METHOD (not ready)
# clearUIForMoves
@@ -805,12 +805,25 @@ def setFusionMoves(fusedPoke, poke2)
#
# fusedPoke.moves=moves
bodySpecies = getBodyID(fusedPoke)
headSpecies = getHeadID(fusedPoke,bodySpecies)
bodySpeciesName = GameData::Species.get(bodySpecies).real_name
choice = Kernel.pbMessage("What to do with the moveset?", [_INTL("Learn moves"), _INTL("Keep {1}'s moveset", bodySpeciesName), _INTL("Keep {1}'s moveset", poke2.name)], 0)
headSpeciesName = GameData::Species.get(headSpecies).real_name
choice = Kernel.pbMessage("What to do with the moveset?", [_INTL("Learn moves"), _INTL("Keep {1}'s moveset", bodySpeciesName), _INTL("Keep {1}'s moveset", headSpeciesName)], 0)
if choice == 1
if selected2ndOption
fusedPoke.moves = poke2.moves
else
return
end
return
elsif choice == 2
fusedPoke.moves = poke2.moves
if selected2ndOption
return
else
fusedPoke.moves = poke2.moves
end
return
else
#Learn moves