Refactored some code relating to colours, trivially simplified some calculations

This commit is contained in:
Maruno17
2022-08-13 23:59:24 +01:00
parent aa9b1a9e23
commit b1cde2db42
42 changed files with 294 additions and 250 deletions

View File

@@ -68,7 +68,7 @@ class ButtonEventScene < EventScene
# End scene
$game_temp.background_bitmap = Graphics.snap_to_bitmap
Graphics.freeze
@viewport.color = Color.new(0, 0, 0, 255) # Ensure screen is black
@viewport.color = Color.black # Ensure screen is black
Graphics.transition(8, "fadetoblack")
$game_temp.background_bitmap.dispose
scene.dispose

View File

@@ -45,8 +45,7 @@ class PokemonEggHatch_Scene
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["overlay"].z = 200
@sprites["overlay"].bitmap = Bitmap.new(Graphics.width, Graphics.height)
@sprites["overlay"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height,
Color.new(255, 255, 255))
@sprites["overlay"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.white)
@sprites["overlay"].opacity = 0
# Start up scene
pbFadeInAndShow(@sprites)

View File

@@ -70,7 +70,7 @@ class PokemonTrade_Scene
picturePoke.setOrigin(0, PictureOrigin::BOTTOM)
picturePoke.setVisible(0, true)
# Change Pokémon color
picturePoke.moveColor(2, 5, Color.new(31 * 8, 22 * 8, 30 * 8, 255))
picturePoke.moveColor(2, 5, Color.new(248, 176, 140))
# Recall
delay = picturePoke.totalDuration
picturePoke.setSE(delay, "Battle recall")
@@ -110,7 +110,7 @@ class PokemonTrade_Scene
# Starting position of sprite
picturePoke.setOrigin(0, PictureOrigin::BOTTOM)
picturePoke.setZoom(0, 0)
picturePoke.setColor(0, Color.new(31 * 8, 22 * 8, 30 * 8, 255))
picturePoke.setColor(0, Color.new(248, 176, 240))
picturePoke.setVisible(0, false)
# Dropping ball
y = Graphics.height - 96 - 16 - 16 # end point of Poké Ball
@@ -141,7 +141,7 @@ class PokemonTrade_Scene
picturePoke.moveXY(delay, 8, Graphics.width / 2, @sprites["rsprite2"].y)
# Return Pokémon's color to normal and play cry
delay = picturePoke.totalDuration
picturePoke.moveColor(delay, 5, Color.new(31 * 8, 22 * 8, 30 * 8, 0))
picturePoke.moveColor(delay, 5, Color.new(248, 176, 240, 0))
cry = GameData::Species.cry_filename_from_pokemon(@pokemon2)
picturePoke.setSE(delay, cry) if cry
# Play animation

View File

@@ -161,7 +161,7 @@ class HallOfFame_Scene
def xpositionformula(battlernumber)
ret = 0
if SINGLEROW
ret = battlernumber % 2 * 2
ret = (battlernumber % 2) * 2
else
ret = (battlernumber / 3).even? ? (19 - battlernumber) % 3 : (19 + battlernumber) % 3
end
@@ -173,7 +173,7 @@ class HallOfFame_Scene
if SINGLEROW
ret = 1
else
ret = (battlernumber / 3) % 2 * 2
ret = ((battlernumber / 3) % 2) * 2
end
return ret
end

View File

@@ -201,7 +201,7 @@ _END_
pbBGMFade(2.0)
$game_temp.background_bitmap = Graphics.snap_to_bitmap
Graphics.freeze
viewport.color = Color.new(0, 0, 0, 255) # Ensure screen is black
viewport.color = Color.black # Ensure screen is black
Graphics.transition(8, "fadetoblack")
$game_temp.background_bitmap.dispose
@background_sprite.dispose

View File

@@ -10,7 +10,7 @@ class Window_DexesList < Window_CommandPokemon
super(commands, width)
@selarrow = AnimatedBitmap.new("Graphics/Pictures/selarrow_white")
self.baseColor = Color.new(248, 248, 248)
self.shadowColor = Color.new(0, 0, 0)
self.shadowColor = Color.black
self.windowskin = nil
end

View File

@@ -428,7 +428,7 @@ class PokemonPokedex_Scene
end
end
textpos = [
[dexname, Graphics.width / 2, 10, 2, Color.new(248, 248, 248), Color.new(0, 0, 0)]
[dexname, Graphics.width / 2, 10, 2, Color.new(248, 248, 248), Color.black]
]
textpos.push([GameData::Species.get(iconspecies).name, 112, 58, 2, base, shadow]) if iconspecies
if @searchResults

View File

@@ -216,7 +216,7 @@ class PokemonPokedexInfo_Scene
end
textpos = [
[_INTL("{1}{2} {3}", indexText, " ", species_data.name),
246, 48, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)]
246, 48, 0, Color.new(248, 248, 248), Color.black]
]
if @show_battled_count
textpos.push([_INTL("Number Battled"), 314, 164, 0, base, shadow])
@@ -243,7 +243,7 @@ class PokemonPokedexInfo_Scene
end
end
# Draw the Pokédex entry text
drawTextEx(overlay, 40, 246, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
drawTextEx(overlay, 40, 246, Graphics.width - 80, 4, # overlay, x, y, width, num lines
species_data.pokedex_entry, base, shadow)
# Draw the footprint
footprintfile = GameData::Species.footprint_filename(@species, @form)

View File

@@ -498,7 +498,7 @@ class PokemonParty_Scene
@sprites["storagetext"].z = 10
@sprites["storagetext"].viewport = @viewport
@sprites["storagetext"].baseColor = Color.new(248, 248, 248)
@sprites["storagetext"].shadowColor = Color.new(0, 0, 0)
@sprites["storagetext"].shadowColor = Color.black
@sprites["storagetext"].windowskin = nil
@sprites["helpwindow"] = Window_UnformattedTextPokemon.new(starthelptext)
@sprites["helpwindow"].viewport = @viewport

View File

@@ -104,7 +104,7 @@ class PokemonRegionMap_Scene
pbMessage(_INTL("The map data cannot be found."))
return false
end
addBackgroundOrColoredPlane(@sprites, "background", "mapbg", Color.new(0, 0, 0), @viewport)
addBackgroundOrColoredPlane(@sprites, "background", "mapbg", Color.black, @viewport)
@sprites["map"] = IconSprite.new(0, 0, @viewport)
@sprites["map"].setBitmap("Graphics/Pictures/#{@map[1]}")
@sprites["map"].x += (Graphics.width - @sprites["map"].bitmap.width) / 2
@@ -250,7 +250,7 @@ class PokemonRegionMap_Scene
text = (@mode == 0) ? _INTL("ACTION: Fly") : _INTL("ACTION: Cancel Fly")
pbDrawTextPositions(
@sprites["help"].bitmap,
[[text, Graphics.width - 16, 4, 1, Color.new(248, 248, 248), Color.new(0, 0, 0)]]
[[text, Graphics.width - 16, 4, 1, Color.new(248, 248, 248), Color.black]]
)
@sprites.each do |key, sprite|
next if !key.include?("point")

View File

@@ -57,7 +57,7 @@ class PokemonPhoneScene
_INTL("Phone"), 2, -18, 128, 64, @viewport
)
@sprites["header"].baseColor = Color.new(248, 248, 248)
@sprites["header"].shadowColor = Color.new(0, 0, 0)
@sprites["header"].shadowColor = Color.black
@sprites["header"].windowskin = nil
@sprites["bottom"] = Window_AdvancedTextPokemon.newWithSize(
"", 162, Graphics.height - 64, Graphics.width - 158, 64, @viewport

View File

@@ -17,7 +17,7 @@ class PokemonJukebox_Scene
_INTL("Jukebox"), 2, -18, 128, 64, @viewport
)
@sprites["header"].baseColor = Color.new(248, 248, 248)
@sprites["header"].shadowColor = Color.new(0, 0, 0)
@sprites["header"].shadowColor = Color.black
@sprites["header"].windowskin = nil
@sprites["commands"] = Window_CommandPokemon.newWithSize(
@commands, 94, 92, 324, 224, @viewport

View File

@@ -124,7 +124,7 @@ class PokemonReadyMenu_Scene
@viewport.z = 99999
@sprites = {}
@sprites["cmdwindow"] = Window_CommandPokemon.new((@index[2] == 0) ? @movecommands : @itemcommands)
@sprites["cmdwindow"].height = 6 * 32
@sprites["cmdwindow"].height = 192
@sprites["cmdwindow"].visible = false
@sprites["cmdwindow"].viewport = @viewport
@commands[0].length.times do |i|

View File

@@ -695,15 +695,15 @@ class PokemonStorageScene
def pbSetArrow(arrow, selection)
case selection
when -1, -4, -5 # Box name, move left, move right
arrow.x = 157 * 2
arrow.y = -12 * 2
when -2 # Party Pokémon
arrow.x = 119 * 2
arrow.y = 139 * 2
when -3 # Close Box
arrow.x = 207 * 2
arrow.y = 139 * 2
when -1, -4, -5 # Box name, move left, move right
arrow.x = 314
arrow.y = -24
when -2 # Party Pokémon
arrow.x = 238
arrow.y = 278
when -3 # Close Box
arrow.x = 414
arrow.y = 278
else
arrow.x = (97 + (24 * (selection % PokemonBox::BOX_WIDTH))) * 2
arrow.y = (8 + (24 * (selection / PokemonBox::BOX_WIDTH))) * 2

View File

@@ -238,7 +238,7 @@ class PokemonMart_Scene
)
pbPrepareWindow(@sprites["itemtextwindow"])
@sprites["itemtextwindow"].baseColor = Color.new(248, 248, 248)
@sprites["itemtextwindow"].shadowColor = Color.new(0, 0, 0)
@sprites["itemtextwindow"].shadowColor = Color.black
@sprites["itemtextwindow"].windowskin = nil
@sprites["helpwindow"] = Window_AdvancedTextPokemon.new("")
pbPrepareWindow(@sprites["helpwindow"])

View File

@@ -69,7 +69,7 @@ class MoveRelearner_Scene
moveData = GameData::Move.get(moveobject)
type_number = GameData::Type.get(moveData.display_type(@pokemon)).icon_position
imagepos.push(["Graphics/Pictures/types", 12, yPos - 4, 0, type_number * 28, 64, 28])
textpos.push([moveData.name, 80, yPos, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
textpos.push([moveData.name, 80, yPos, 0, Color.new(248, 248, 248), Color.black])
textpos.push([_INTL("PP"), 112, yPos + 32, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
if moveData.total_pp > 0
textpos.push([_INTL("{1}/{1}", moveData.total_pp), 230, yPos + 32, 1,
@@ -87,11 +87,11 @@ class MoveRelearner_Scene
basedamage = selMoveData.display_damage(@pokemon)
category = selMoveData.display_category(@pokemon)
accuracy = selMoveData.display_accuracy(@pokemon)
textpos.push([_INTL("CATEGORY"), 272, 120, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
textpos.push([_INTL("POWER"), 272, 152, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
textpos.push([_INTL("CATEGORY"), 272, 120, 0, Color.new(248, 248, 248), Color.black])
textpos.push([_INTL("POWER"), 272, 152, 0, Color.new(248, 248, 248), Color.black])
textpos.push([basedamage <= 1 ? basedamage == 1 ? "???" : "---" : sprintf("%d", basedamage),
468, 152, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
textpos.push([_INTL("ACCURACY"), 272, 184, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
textpos.push([_INTL("ACCURACY"), 272, 184, 0, Color.new(248, 248, 248), Color.black])
textpos.push([accuracy == 0 ? "---" : "#{accuracy}%",
468, 184, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
pbDrawTextPositions(overlay, textpos)

View File

@@ -27,7 +27,7 @@ end
#===============================================================================
def pbDrawGauge(bitmap, rect, color, value, maxValue)
return if !bitmap
bitmap.fill_rect(rect.x, rect.y, rect.width, rect.height, Color.new(0, 0, 0))
bitmap.fill_rect(rect.x, rect.y, rect.width, rect.height, Color.black)
width = (maxValue <= 0) ? 0 : (rect.width - 4) * value / maxValue
if rect.width >= 4 && rect.height >= 4
bitmap.fill_rect(rect.x + 2, rect.y + 2, rect.width - 4, rect.height - 4, Color.new(248, 248, 248))
@@ -713,7 +713,7 @@ class DirectFlowDiagram
def ensurePoint(j)
if !@points[j] || @points[j].disposed?
@points[j] = BitmapSprite.new(8, 8, @viewport)
@points[j].bitmap.fill_rect(0, 0, 8, 8, Color.new(0, 0, 0))
@points[j].bitmap.fill_rect(0, 0, 8, 8, Color.black)
end
@points[j].tone = (@strength == 2) ? Tone.new(232, 232, 248) : Tone.new(16, 16, 232)
@points[j].visible = (@strength != 0)
@@ -787,7 +787,7 @@ class FlowDiagram
def ensurePoint(j)
if !@points[j] || @points[j].disposed?
@points[j] = BitmapSprite.new(8, 8, @viewport)
@points[j].bitmap.fill_rect(0, 0, 8, 8, Color.new(0, 0, 0))
@points[j].bitmap.fill_rect(0, 0, 8, 8, Color.black)
end
@points[j].tone = (@strength == 2) ? Tone.new(232, 232, 248) : Tone.new(16, 16, 232)
@points[j].visible = (@strength != 0)
@@ -854,7 +854,7 @@ class PurifyChamberSetView < Sprite
@heldpkmn = nil
@cursor = -1
@view = BitmapSprite.new(64, 64, viewport)
@view.bitmap.fill_rect(8, 8, 48, 48, Color.new(255, 255, 255))
@view.bitmap.fill_rect(8, 8, 48, 48, Color.white)
@view.bitmap.fill_rect(10, 10, 44, 44, Color.new(255, 255, 255, 128))
@info = BitmapSprite.new(Graphics.width - 112, 48, viewport)
@flows = []

View File

@@ -125,21 +125,21 @@ class PokemonEntryScene
if meta
@sprites["shadow"] = IconSprite.new(0, 0, @viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@sprites["shadow"].x = 33 * 2
@sprites["shadow"].y = 32 * 2
@sprites["shadow"].x = 66
@sprites["shadow"].y = 64
filename = pbGetPlayerCharset(meta.walk_charset, nil, true)
@sprites["subject"] = TrainerWalkingCharSprite.new(filename, @viewport)
charwidth = @sprites["subject"].bitmap.width
charheight = @sprites["subject"].bitmap.height
@sprites["subject"].x = (44 * 2) - (charwidth / 8)
@sprites["subject"].y = (38 * 2) - (charheight / 4)
@sprites["subject"].x = 88 - (charwidth / 8)
@sprites["subject"].y = 76 - (charheight / 4)
end
when 2 # Pokémon
if pokemon
@sprites["shadow"] = IconSprite.new(0, 0, @viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@sprites["shadow"].x = 33 * 2
@sprites["shadow"].y = 32 * 2
@sprites["shadow"].x = 66
@sprites["shadow"].y = 64
@sprites["subject"] = PokemonIconSprite.new(pokemon, @viewport)
@sprites["subject"].setOffset(PictureOrigin::CENTER)
@sprites["subject"].x = 88
@@ -160,21 +160,21 @@ class PokemonEntryScene
when 3 # NPC
@sprites["shadow"] = IconSprite.new(0, 0, @viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@sprites["shadow"].x = 33 * 2
@sprites["shadow"].y = 32 * 2
@sprites["shadow"].x = 66
@sprites["shadow"].y = 64
@sprites["subject"] = TrainerWalkingCharSprite.new(pokemon.to_s, @viewport)
charwidth = @sprites["subject"].bitmap.width
charheight = @sprites["subject"].bitmap.height
@sprites["subject"].x = (44 * 2) - (charwidth / 8)
@sprites["subject"].y = (38 * 2) - (charheight / 4)
@sprites["subject"].x = 88 - (charwidth / 8)
@sprites["subject"].y = 76 - (charheight / 4)
when 4 # Storage box
@sprites["subject"] = TrainerWalkingCharSprite.new(nil, @viewport)
@sprites["subject"].altcharset = "Graphics/Pictures/Naming/icon_storage"
@sprites["subject"].animspeed = 4
charwidth = @sprites["subject"].bitmap.width
charheight = @sprites["subject"].bitmap.height
@sprites["subject"].x = (44 * 2) - (charwidth / 8)
@sprites["subject"].y = (26 * 2) - (charheight / 2)
@sprites["subject"].x = 88 - (charwidth / 8)
@sprites["subject"].y = 52 - (charheight / 2)
end
pbFadeInAndShow(@sprites)
end