mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
6.4 update (minus sprites)
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
class HallOfFame_Scene
|
||||
# When true, all pokémon will be in one line
|
||||
# When false, all pokémon will be in two lines
|
||||
SINGLEROW = false
|
||||
@singlerow = true
|
||||
# Make the pokémon movement ON in hall entry
|
||||
ANIMATION = true
|
||||
# Speed in pokémon movement in hall entry. Don't use less than 2!
|
||||
@@ -34,7 +34,7 @@ class HallOfFame_Scene
|
||||
# Allow eggs to be show and saved in hall
|
||||
ALLOWEGGS = true
|
||||
# Remove the hallbars when the trainer sprite appears
|
||||
REMOVEBARS = true
|
||||
REMOVEBARS = false
|
||||
# The final fade speed on entry
|
||||
FINALFADESPEED = 16
|
||||
# Sprites opacity value when them aren't selected
|
||||
@@ -48,7 +48,8 @@ class HallOfFame_Scene
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
# Comment the below line to doesn't use a background
|
||||
addBackgroundPlane(@sprites, "bg", "hallfamebg", @viewport)
|
||||
bgFile = @singlerow ? "hallfamebg" : "hallfamebg_multiline"
|
||||
addBackgroundPlane(@sprites, "bg", bgFile, @viewport)
|
||||
@sprites["hallbars"] = IconSprite.new(@viewport)
|
||||
@sprites["hallbars"].setBitmap("Graphics/Pictures/hallfamebars")
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@@ -61,6 +62,7 @@ class HallOfFame_Scene
|
||||
end
|
||||
|
||||
def pbStartSceneEntry
|
||||
@singlerow = true
|
||||
pbStartScene
|
||||
@useMusic = (ENTRYMUSIC && ENTRYMUSIC != "")
|
||||
pbBGMPlay(ENTRYMUSIC) if @useMusic
|
||||
@@ -72,9 +74,12 @@ class HallOfFame_Scene
|
||||
end
|
||||
|
||||
def pbStartScenePC
|
||||
@singlerow = false
|
||||
pbStartScene
|
||||
@hallIndex = $PokemonGlobal.hallOfFame.size - 1
|
||||
@hallEntry = $PokemonGlobal.hallOfFame[-1]
|
||||
|
||||
echoln $PokemonGlobal.hallOfFame[-1]
|
||||
@hallEntry = $PokemonGlobal.hallOfFame[-1][:TEAM]
|
||||
createBattlers(false)
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
pbUpdatePC
|
||||
@@ -126,32 +131,61 @@ class HallOfFame_Scene
|
||||
# Clones every pokémon object
|
||||
@hallEntry.push($Trainer.party[i].clone) if !$Trainer.party[i].egg? || ALLOWEGGS
|
||||
end
|
||||
entryData = {}
|
||||
entryData[:TEAM] = @hallEntry
|
||||
entryData[:DIFFICULTY] = getDifficulty
|
||||
entryData[:MODE] = getCurrentGameMode()
|
||||
entryData[:DATE] = getCurrentDate()
|
||||
|
||||
#Save trainer data (unused for now)
|
||||
entryData[:TRAINER_HAT] = $Trainer.hat
|
||||
entryData[:TRAINER_HAT_COLOR] = $Trainer.hat_color
|
||||
entryData[:TRAINER_HAIR] = $Trainer.hair
|
||||
entryData[:TRAINER_HAIR_COLOR] = $Trainer.hair_color
|
||||
entryData[:TRAINER_CLOTHES] = $Trainer.clothes
|
||||
entryData[:TRAINER_CLOTHES_COLOR] = $Trainer.clothes_color
|
||||
entryData[:TRAINER_SKIN] = $Trainer.skin_tone
|
||||
|
||||
# Update the global variables
|
||||
$PokemonGlobal.hallOfFame.push(@hallEntry)
|
||||
$PokemonGlobal.hallOfFame.push(entryData)
|
||||
$PokemonGlobal.hallOfFameLastNumber += 1
|
||||
$PokemonGlobal.hallOfFame.delete_at(0) if HALLLIMIT > -1 &&
|
||||
$PokemonGlobal.hallOfFame.size > HALLLIMIT
|
||||
$PokemonGlobal.hallOfFame.size > HALLLIMIT
|
||||
end
|
||||
|
||||
# Return the x/y point position in screen for battler index number
|
||||
# Don't use odd numbers!
|
||||
def xpointformula(battlernumber)
|
||||
ret = 0
|
||||
if !SINGLEROW
|
||||
if !@singlerow
|
||||
ret = 92 + 160 * xpositionformula(battlernumber) #32
|
||||
else
|
||||
ret = (60 * (battlernumber / 2) + 48) * (xpositionformula(battlernumber) - 1)
|
||||
ret += Graphics.width / 2 - 56
|
||||
start_position = -16 #-56
|
||||
spacing = 70 # spacing between mons
|
||||
ret = (spacing * (battlernumber / 2) + 48) * (xpositionformula(battlernumber) - 1)
|
||||
|
||||
gap_size = 40 #gap for the trainer sprite in the middle
|
||||
if battlernumber % 2 == 0 #left side
|
||||
ret -= gap_size / 2
|
||||
else
|
||||
ret += gap_size / 2
|
||||
end
|
||||
ret += Graphics.width / 2 + start_position
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def ypointformula(battlernumber)
|
||||
ret = 0
|
||||
if !SINGLEROW
|
||||
if !@singlerow
|
||||
ret = 92 + 128 * ypositionformula(battlernumber) / 2
|
||||
else
|
||||
ret = 96 - 8 * (battlernumber / 2)
|
||||
y_position_base = 125
|
||||
height_increase = 20
|
||||
# Calculate the decrement based on the battlernumber:
|
||||
# Each pair (1-2, 3-4, etc.) will decrease y by 20
|
||||
y_decrement = 40 - height_increase * (battlernumber / 2)
|
||||
ret = y_position_base + y_decrement
|
||||
end
|
||||
return ret
|
||||
end
|
||||
@@ -159,7 +193,7 @@ class HallOfFame_Scene
|
||||
# Returns 0, 1 or 2 as the x/y column value
|
||||
def xpositionformula(battlernumber)
|
||||
ret = 0
|
||||
if !SINGLEROW
|
||||
if !@singlerow
|
||||
ret = (battlernumber / 3 % 2 == 0) ? (19 - battlernumber) % 3 : (19 + battlernumber) % 3
|
||||
else
|
||||
ret = battlernumber % 2 * 2
|
||||
@@ -169,7 +203,7 @@ class HallOfFame_Scene
|
||||
|
||||
def ypositionformula(battlernumber)
|
||||
ret = 0
|
||||
if !SINGLEROW
|
||||
if !@singlerow
|
||||
ret = (battlernumber / 3) % 2 * 2
|
||||
else
|
||||
ret = 1
|
||||
@@ -221,7 +255,7 @@ class HallOfFame_Scene
|
||||
@sprites["pokemon#{i}"].x += (128 - @sprites["pokemon#{i}"].bitmap.width) / 2
|
||||
@sprites["pokemon#{i}"].y += (128 - @sprites["pokemon#{i}"].bitmap.height) / 2
|
||||
end
|
||||
@sprites["pokemon#{i}"].z = 7 - i if SINGLEROW
|
||||
@sprites["pokemon#{i}"].z = 7 - i if @singlerow
|
||||
next if !hide
|
||||
# Animation distance calculation
|
||||
horizontal = 1 - xpositionformula(i)
|
||||
@@ -246,13 +280,14 @@ class HallOfFame_Scene
|
||||
def createTrainerBattler
|
||||
@sprites["trainer"] = IconSprite.new(@viewport)
|
||||
@sprites["trainer"].setBitmapDirectly(generate_front_trainer_sprite_bitmap())
|
||||
if !SINGLEROW
|
||||
if !@singlerow
|
||||
@sprites["trainer"].x = Graphics.width - 96
|
||||
@sprites["trainer"].y = 160
|
||||
else
|
||||
@sprites["trainer"].x = Graphics.width / 2
|
||||
@sprites["trainer"].x = Graphics.width / 2 # - 96
|
||||
@sprites["trainer"].y = 178
|
||||
end
|
||||
@sprites["trainer"].opacity = 255
|
||||
@sprites["trainer"].z = 9
|
||||
@sprites["trainer"].ox = @sprites["trainer"].bitmap.width / 2
|
||||
@sprites["trainer"].oy = @sprites["trainer"].bitmap.height / 2
|
||||
@@ -262,18 +297,18 @@ class HallOfFame_Scene
|
||||
end
|
||||
@xmovement[@battlerIndex] = 0
|
||||
@ymovement[@battlerIndex] = 0
|
||||
if (ANIMATION && !SINGLEROW) # Trainer Animation
|
||||
startpoint = Graphics.width / 2
|
||||
# 2 is the trainer speed
|
||||
@xmovement[@battlerIndex] = (startpoint - @sprites["trainer"].x) / 2
|
||||
@sprites["trainer"].x = startpoint
|
||||
else
|
||||
ENTRYWAITTIME.times do
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
end
|
||||
#if (ANIMATION)#) && !@singlerow) # Trainer Animation
|
||||
startpoint = (Graphics.width / 2) - 200
|
||||
# 2 is the trainer speed
|
||||
@xmovement[@battlerIndex] = (startpoint - @sprites["trainer"].x) / 2
|
||||
@sprites["trainer"].x = startpoint
|
||||
# else
|
||||
# ENTRYWAITTIME.times do
|
||||
# Graphics.update
|
||||
# Input.update
|
||||
# pbUpdate
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
#Get difficulty for displaying in-game
|
||||
@@ -339,17 +374,35 @@ class HallOfFame_Scene
|
||||
pbDrawTextPositions(overlay, [[_INTL("Welcome to the Hall of Fame!"),
|
||||
Graphics.width / 2, Graphics.height - 80, 2, BASECOLOR, SHADOWCOLOR]])
|
||||
|
||||
writeCurrentDate(overlay, 120, Graphics.height - 50)
|
||||
writeDate(overlay, 120, Graphics.height - 50)
|
||||
writeGameMode(overlay, (Graphics.width / 2) + 100, Graphics.height - 50)
|
||||
end
|
||||
|
||||
def writeCurrentDate(overlay, x, y)
|
||||
currentTime = Time.new
|
||||
timeString = currentTime.year.to_s + "-" + ("%02d" % currentTime.month) + "-" + ("%02d" % currentTime.day)
|
||||
def writeWelcomePC
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
pbDrawTextPositions(overlay, [[_INTL("Entered the Hall of Fame!"),
|
||||
Graphics.width / 2, Graphics.height - 80, 2, BASECOLOR, SHADOWCOLOR]])
|
||||
|
||||
date = $PokemonGlobal.hallOfFame[@hallIndex][:DATE]
|
||||
mode = $PokemonGlobal.hallOfFame[@hallIndex][:MODE]
|
||||
difficulty = $PokemonGlobal.hallOfFame[@hallIndex][:DIFFICULTY]
|
||||
|
||||
writeDate(overlay, 120, Graphics.height - 50,date) if date
|
||||
writeGameMode(overlay, (Graphics.width / 2) + 100, Graphics.height - 50, mode, difficulty) if mode && difficulty
|
||||
end
|
||||
|
||||
def writeDate(overlay, x, y, timeString = nil)
|
||||
timeString = getCurrentDate() if !timeString
|
||||
pbDrawTextPositions(overlay, [[_INTL("{1}", timeString), x, y, 2, BASECOLOR, SHADOWCOLOR]])
|
||||
end
|
||||
|
||||
def writeGameMode(overlay, x, y)
|
||||
def getCurrentDate()
|
||||
currentTime = Time.new
|
||||
return currentTime.year.to_s + "-" + ("%02d" % currentTime.month) + "-" + ("%02d" % currentTime.day)
|
||||
end
|
||||
|
||||
def getCurrentGameMode()
|
||||
gameMode = "Classic mode"
|
||||
if $game_switches[SWITCH_MODERN_MODE]
|
||||
gameMode = "Remix mode"
|
||||
@@ -372,8 +425,13 @@ class HallOfFame_Scene
|
||||
if $game_switches[ENABLED_DEBUG_MODE_AT_LEAST_ONCE] || $DEBUG
|
||||
gameMode = "Debug mode"
|
||||
end
|
||||
return gameMode
|
||||
end
|
||||
|
||||
pbDrawTextPositions(overlay, [[_INTL("{1} ({2})", gameMode, getDifficulty), x, y, 2, BASECOLOR, SHADOWCOLOR]])
|
||||
def writeGameMode(overlay, x, y, gameMode = nil, difficulty = nil)
|
||||
gameMode = getCurrentGameMode() if !gameMode
|
||||
difficulty = getDifficulty() if !difficulty
|
||||
pbDrawTextPositions(overlay, [[_INTL("{1} ({2})", gameMode, difficulty), x, y, 2, BASECOLOR, SHADOWCOLOR]])
|
||||
end
|
||||
|
||||
def pbAnimationLoop
|
||||
@@ -437,18 +495,20 @@ class HallOfFame_Scene
|
||||
# Show the welcome message and preparates the trainer
|
||||
setPokemonSpritesOpacity(-1)
|
||||
writeWelcome
|
||||
createTrainerBattler
|
||||
(ENTRYWAITTIME * 2 * Graphics.frame_rate / 20).times do
|
||||
moveSprite(-1)
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
|
||||
while !(waitForInput)
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
end
|
||||
setPokemonSpritesOpacity(-1, OPACITY) if !SINGLEROW
|
||||
createTrainerBattler
|
||||
setPokemonSpritesOpacity(-1, OPACITY) # if !@singlerow
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -477,16 +537,23 @@ class HallOfFame_Scene
|
||||
|
||||
def pbUpdatePC
|
||||
# Change the team
|
||||
if @battlerIndex >= @hallEntry.size
|
||||
if @battlerIndex >= @hallEntry.size + 1
|
||||
@hallIndex -= 1
|
||||
return false if @hallIndex == -1
|
||||
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex]
|
||||
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex][:TEAM]
|
||||
@battlerIndex = 0
|
||||
createBattlers(false)
|
||||
elsif @battlerIndex == @hallEntry.size
|
||||
for n in 0...@hallEntry.size
|
||||
@sprites["pokemon#{n}"].opacity = 255
|
||||
end
|
||||
echoln @hallEntry
|
||||
writeWelcomePC
|
||||
return true
|
||||
elsif @battlerIndex < 0
|
||||
@hallIndex += 1
|
||||
return false if @hallIndex >= $PokemonGlobal.hallOfFame.size
|
||||
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex]
|
||||
@hallEntry = $PokemonGlobal.hallOfFame[@hallIndex][:TEAM]
|
||||
@battlerIndex = @hallEntry.size - 1
|
||||
createBattlers(false)
|
||||
end
|
||||
@@ -552,9 +619,37 @@ class PokemonGlobalMetadata
|
||||
# Number necessary if hallOfFame array reach in its size limit
|
||||
attr_writer :hallOfFameLastNumber
|
||||
|
||||
#
|
||||
# [{:TEAM:[], :DATE:string, :MODE:string, :DIFFICULTY:string}]
|
||||
#
|
||||
def hallOfFame
|
||||
@hallOfFame = [] if !@hallOfFame
|
||||
if @hallOfFame.size > 0 && @hallOfFame[0].is_a?(Array)
|
||||
echoln "converting hall of fame"
|
||||
convertedHallOfFame = []
|
||||
@hallOfFame.each do |team|
|
||||
hallOfFame = {}
|
||||
hallOfFame[:TEAM] = team
|
||||
hallOfFame[:DATE] = nil
|
||||
hallOfFame[:MODE] = nil
|
||||
hallOfFame[:DIFFICULTY] = nil
|
||||
|
||||
hallOfFame[:TRAINER_HAT] = nil
|
||||
hallOfFame[:TRAINER_HAT_COLOR] = nil
|
||||
hallOfFame[:TRAINER_HAIR] = nil
|
||||
hallOfFame[:TRAINER_HAIR_COLOR] = nil
|
||||
hallOfFame[:TRAINER_CLOTHES] = nil
|
||||
hallOfFame[:TRAINER_CLOTHES_COLOR] = nil
|
||||
hallOfFame[:TRAINER_SKIN] = nil
|
||||
|
||||
convertedHallOfFame << hallOfFame
|
||||
end
|
||||
@hallOfFame = convertedHallOfFame
|
||||
echoln @hallOfFame
|
||||
end
|
||||
return @hallOfFame
|
||||
# @hallOfFame = [] if !@hallOfFame
|
||||
# return @hallOfFame
|
||||
end
|
||||
|
||||
def hallOfFameLastNumber
|
||||
|
||||
Reference in New Issue
Block a user