Fixed rendering of some tiles for certain sizes of tilesets, more rubocopping

This commit is contained in:
Maruno17
2023-04-12 21:14:26 +01:00
parent 956a511ec5
commit a714086a39
42 changed files with 392 additions and 374 deletions

View File

@@ -15,6 +15,11 @@ Layout/ExtraSpacing:
AllowForAlignment: true
AllowBeforeTrailingComments: true
# Looks better than having hash elements shifted way to the right just to line
# up with the hash's opening bracket.
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# In a hash with multiple values (one per line), prefer the => to be lined up
# and text to otherwise be left-aligned.
Layout/HashAlignment:
@@ -207,3 +212,8 @@ Style/SymbolProc:
# it from the true/false results.
Style/TernaryParentheses:
EnforcedStyle: require_parentheses
# This prefers "x += 1 while x < 10" and "x += 1 until x == 10". This hides
# loops, which is not good.
Style/WhileUntilModifier:
Enabled: false

View File

@@ -1,8 +1,6 @@
#############################
#
#===============================================================================
# HTTP utility functions
#
#############################
#===============================================================================
def pbPostData(url, postdata, filename = nil, depth = 0)
if url[/^http:\/\/([^\/]+)(.*)$/]
host = $1

View File

@@ -571,15 +571,17 @@ class Translation
def setMapMessagesAsHash(map_id, array)
load_default_messages
@default_game_messages[MessageTypes::EVENT_TEXTS] ||= []
@default_game_messages[MessageTypes::EVENT_TEXTS][map_id] = priv_add_to_hash(MessageTypes::EVENT_TEXTS,
array, nil, map_id)
@default_game_messages[MessageTypes::EVENT_TEXTS][map_id] = priv_add_to_hash(
MessageTypes::EVENT_TEXTS, array, nil, map_id
)
end
def addMapMessagesAsHash(map_id, array)
load_default_messages
@default_game_messages[MessageTypes::EVENT_TEXTS] ||= []
@default_game_messages[MessageTypes::EVENT_TEXTS][map_id] = priv_add_to_hash(MessageTypes::EVENT_TEXTS,
array, @default_game_messages[MessageTypes::EVENT_TEXTS][map_id], map_id)
@default_game_messages[MessageTypes::EVENT_TEXTS][map_id] = priv_add_to_hash(
MessageTypes::EVENT_TEXTS, array, @default_game_messages[MessageTypes::EVENT_TEXTS][map_id], map_id
)
end
def get(type, id)

View File

@@ -1,10 +1,10 @@
#==============================================================================
#===============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
#===============================================================================
class Game_System
attr_reader :map_interpreter # map event interpreter
attr_reader :battle_interpreter # battle event interpreter
@@ -39,7 +39,7 @@ class Game_System
@bgs_position = 0
end
################################################################################
#-----------------------------------------------------------------------------
def bgm_play(bgm)
old_pos = @bgm_position
@@ -140,7 +140,7 @@ class Game_System
end
end
################################################################################
#-----------------------------------------------------------------------------
def me_play(me)
me = RPG::AudioFile.new(me) if me.is_a?(String)
@@ -157,7 +157,7 @@ class Game_System
Graphics.frame_reset
end
################################################################################
#-----------------------------------------------------------------------------
def bgs_play(bgs)
@playing_bgs = (bgs.nil?) ? nil : bgs.clone
@@ -224,7 +224,7 @@ class Game_System
return (@playing_bgs) ? @playing_bgs.clone : nil
end
################################################################################
#-----------------------------------------------------------------------------
def se_play(se)
se = RPG::AudioFile.new(se) if se.is_a?(String)
@@ -240,7 +240,7 @@ class Game_System
Audio.se_stop
end
################################################################################
#-----------------------------------------------------------------------------
def battle_bgm
return (@battle_bgm) ? @battle_bgm : $data_system.battle_bgm
@@ -254,7 +254,7 @@ class Game_System
attr_writer :battle_end_me
################################################################################
#-----------------------------------------------------------------------------
def windowskin_name
if @windowskin_name.nil?

View File

@@ -1,9 +1,9 @@
#==============================================================================
#===============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
#===============================================================================
class Game_Map
attr_accessor :map_id
attr_accessor :tileset_name # tileset file name

View File

@@ -1,13 +1,13 @@
#=======================================================================
# This module is a little fix that works around PC hardware limitations.
# Since Essentials isn't working with software rendering anymore, it now
# has to deal with the limits of the GPU. For the most part this is no
# big deal, but people do have some really big tilesets.
#===============================================================================
# This module is a little fix that works around PC hardware limitations. Since
# Essentials isn't working with software rendering anymore, it now has to deal
# with the limits of the GPU. For the most part this is no big deal, but people
# do have some really big tilesets.
#
# The fix is simple enough: If your tileset is too big, a new
# bitmap will be constructed with all the excess pixels sent to the
# image's right side. This basically means that you now have a limit
# far higher than you should ever actually need.
# The fix is simple enough: If your tileset is too big, a new bitmap will be
# constructed with all the excess pixels sent to the image's right side. This
# basically means that you now have a limit far higher than you should ever
# actually need.
#
# Hardware limit -> max tileset length:
# 1024px -> 4096px
@@ -15,9 +15,9 @@
# 4096px -> 65536px (enough to load pretty much any tileset)
# 8192px -> 262144px
# 16384px -> 1048576px (what most people have at this point)
#
# ~Roza/Zoroark
#=======================================================================
#===============================================================================
class TilemapRenderer
module TilesetWrapper
TILESET_WIDTH = SOURCE_TILE_WIDTH * TILESET_TILES_PER_ROW
@@ -37,6 +37,7 @@ class TilemapRenderer
end
bmp = Bitmap.new(TILESET_WIDTH * columns, MAX_TEX_SIZE)
remainder = height % MAX_TEX_SIZE
remainder = MAX_TEX_SIZE if remainder == 0
columns.times do |col|
srcrect = Rect.new(0, col * MAX_TEX_SIZE, width, (col + 1 == columns) ? remainder : MAX_TEX_SIZE)
bmp.blt(col * TILESET_WIDTH, 0, originalbmp, srcrect)

View File

@@ -18,13 +18,13 @@ def shadowc3tag(base, shadow)
base_text = base.to_rgb32
else
base_text = sprintf("%02X%02X%02X", base[0], base[1], base[2])
base_text += sprintf("02X", base[3]) if base[3]
base_text += sprintf("%02X", base[3]) if base[3]
end
if shadow.is_a?(Color)
shadow_text = shadow.to_rgb32
else
shadow_text = sprintf("%02X%02X%02X", shadow[0], shadow[1], shadow[2])
shadow_text += sprintf("02X", shadow[3]) if shadow[3]
shadow_text += sprintf("%02X", shadow[3]) if shadow[3]
end
return sprintf("<c3=%s,%s>", base_text, shadow_text)
end
@@ -428,7 +428,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
graphicHeight = nil
graphicRect = nil
controls.length.times do |i|
if controls[i] && controls[i][2] == position
next if !controls[i] || controls[i][2] != position
control = controls[i][0]
param = controls[i][1]
endtag = controls[i][3]
@@ -547,7 +547,6 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
end
controls[i] = nil
end
end
bitmap.font.bold = (boldcount > 0)
bitmap.font.italic = (italiccount > 0)
if graphic

View File

@@ -551,7 +551,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
elsif signWaitCount == 0 && letterbyletter
pbPlayDecisionSE
end
########## Position message window ##############
# Position message window
pbRepositionMessageWindow(msgwindow, linecount)
if facewindow
pbPositionNearMsgWindow(facewindow, msgwindow, :left)
@@ -559,7 +559,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
facewindow.z = msgwindow.z
end
atTop = (msgwindow.y == 0)
########## Show text #############################
# Show text
msgwindow.text = text
Graphics.frame_reset if Graphics.frame_rate > 40
loop do

View File

@@ -1,4 +1,3 @@
#####################################
# Needed because RGSS doesn't call at_exit procs on exit
# Exit is not called when game is reset (using F12)
$AtExitProcs = [] if !$AtExitProcs

View File

@@ -38,7 +38,7 @@ def pbResolveAudioFile(str, volume = nil, pitch = nil)
return str
end
################################################################################
#===============================================================================
# Plays a BGM file.
# param -- Either a string showing the filename
@@ -88,7 +88,7 @@ def pbBGMStop(timeInSeconds = 0.0)
(timeInSeconds > 0.0) ? Audio.bgm_fade((timeInSeconds * 1000).floor) : Audio.bgm_stop
end
################################################################################
#===============================================================================
# Plays an ME file.
# param -- Either a string showing the filename
@@ -138,7 +138,7 @@ def pbMEStop(timeInSeconds = 0.0)
(timeInSeconds > 0.0) ? Audio.me_fade((timeInSeconds * 1000).floor) : Audio.me_stop
end
################################################################################
#===============================================================================
# Plays a BGS file.
# param -- Either a string showing the filename
@@ -188,7 +188,7 @@ def pbBGSStop(timeInSeconds = 0.0)
(timeInSeconds > 0.0) ? Audio.bgs_fade((timeInSeconds * 1000).floor) : Audio.bgs_stop
end
################################################################################
#===============================================================================
# Plays an SE file.
# param -- Either a string showing the filename
@@ -232,7 +232,7 @@ def pbSEStop(_timeInSeconds = 0.0)
end
end
################################################################################
#===============================================================================
# Plays a sound effect that plays when the player moves the cursor.
def pbPlayCursorSE

View File

@@ -418,7 +418,7 @@ module GameData
ret = nil if ret == :None
when "Evolutions"
if ret
ret = ret.select { |evo| !evo[3] } # Remove prevolutions
ret = ret.reject { |evo| evo[3] } # Remove prevolutions
ret.each do |evo|
param_type = GameData::Evolution.get(evo[1]).parameter
if !param_type.nil?

View File

@@ -213,16 +213,14 @@ class Battle::Scene::PokemonDataBox < Sprite
nameWidth = self.bitmap.text_size(@battler.name).width
nameOffset = 0
nameOffset = nameWidth - 116 if nameWidth > 116
pbDrawTextPositions(self.bitmap,
[[@battler.name, @spriteBaseX + 8 - nameOffset, 12, :left, NAME_BASE_COLOR, NAME_SHADOW_COLOR]]
pbDrawTextPositions(self.bitmap, [[@battler.name, @spriteBaseX + 8 - nameOffset, 12, :left,
NAME_BASE_COLOR, NAME_SHADOW_COLOR]]
)
end
def draw_level
# "Lv" graphic
pbDrawImagePositions(self.bitmap,
[["Graphics/UI/Battle/overlay_lv", @spriteBaseX + 140, 16]]
)
pbDrawImagePositions(self.bitmap, [["Graphics/UI/Battle/overlay_lv", @spriteBaseX + 140, 16]])
# Level number
pbDrawNumber(@battler.level, self.bitmap, @spriteBaseX + 162, 16)
end

View File

@@ -1,9 +1,9 @@
################################################################################
#===============================================================================
# This section was created solely for you to put various bits of code that
# modify various wild Pokémon and trainers immediately prior to battling them.
# Be sure that any code you use here ONLY applies to the Pokémon/trainers you
# want it to apply to!
################################################################################
#===============================================================================
# Make all wild Pokémon shiny while a certain Switch is ON (see Settings).
EventHandlers.add(:on_wild_pokemon_created, :make_shiny_switch,

View File

@@ -506,8 +506,9 @@ ItemHandlers::UseOnPokemon.add(:FULLHEAL, proc { |item, qty, pkmn, scene|
})
ItemHandlers::UseOnPokemon.copy(:FULLHEAL,
:LAVACOOKIE, :OLDGATEAU, :CASTELIACONE, :LUMIOSEGALETTE, :SHALOURSABLE,
:BIGMALASADA, :PEWTERCRUNCHIES, :LUMBERRY)
:LAVACOOKIE, :OLDGATEAU, :CASTELIACONE,
:LUMIOSEGALETTE, :SHALOURSABLE, :BIGMALASADA,
:PEWTERCRUNCHIES, :LUMBERRY)
ItemHandlers::UseOnPokemon.copy(:FULLHEAL, :RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS
ItemHandlers::UseOnPokemon.add(:FULLRESTORE, proc { |item, qty, pkmn, scene|
@@ -1075,8 +1076,7 @@ ItemHandlers::UseOnPokemon.add(:ABILITYPATCH, proc { |item, qty, pkmn, scene|
pkmn.ability_index = 2
pkmn.ability = nil
scene.pbRefresh
scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!",
pkmn.name, new_ability_name))
scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!", pkmn.name, new_ability_name))
next true
end
next false
@@ -1209,8 +1209,7 @@ ItemHandlers::UseOnPokemon.add(:ROTOMCATALOG, proc { |item, qty, pkmn, scene|
_INTL("Lawn mower"),
_INTL("Cancel")
]
new_form = scene.pbShowCommands(_INTL("Which appliance would you like to order?"),
choices, pkmn.form)
new_form = scene.pbShowCommands(_INTL("Which appliance would you like to order?"), choices, pkmn.form)
if new_form == pkmn.form
scene.pbDisplay(_INTL("It won't have any effect."))
next false

View File

@@ -72,9 +72,10 @@ ItemHandlers::CanUseInBattle.add(:POTION, proc { |item, pokemon, battler, move,
})
ItemHandlers::CanUseInBattle.copy(:POTION,
:SUPERPOTION, :HYPERPOTION, :MAXPOTION, :BERRYJUICE, :SWEETHEART, :FRESHWATER,
:SODAPOP, :LEMONADE, :MOOMOOMILK, :ORANBERRY, :SITRUSBERRY, :ENERGYPOWDER,
:ENERGYROOT)
:SUPERPOTION, :HYPERPOTION, :MAXPOTION,
:BERRYJUICE, :SWEETHEART, :FRESHWATER, :SODAPOP,
:LEMONADE, :MOOMOOMILK, :ORANBERRY, :SITRUSBERRY,
:ENERGYPOWDER, :ENERGYROOT)
ItemHandlers::CanUseInBattle.copy(:POTION, :RAGECANDYBAR) if !Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS
ItemHandlers::CanUseInBattle.add(:AWAKENING, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
@@ -126,8 +127,9 @@ ItemHandlers::CanUseInBattle.add(:FULLHEAL, proc { |item, pokemon, battler, move
})
ItemHandlers::CanUseInBattle.copy(:FULLHEAL,
:LAVACOOKIE, :OLDGATEAU, :CASTELIACONE, :LUMIOSEGALETTE, :SHALOURSABLE,
:BIGMALASADA, :PEWTERCRUNCHIES, :LUMBERRY, :HEALPOWDER)
:LAVACOOKIE, :OLDGATEAU, :CASTELIACONE,
:LUMIOSEGALETTE, :SHALOURSABLE, :BIGMALASADA,
:PEWTERCRUNCHIES, :LUMBERRY, :HEALPOWDER)
ItemHandlers::CanUseInBattle.copy(:FULLHEAL, :RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS
ItemHandlers::CanUseInBattle.add(:FULLRESTORE, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
@@ -220,14 +222,16 @@ ItemHandlers::CanUseInBattle.add(:XDEFENSE, proc { |item, pokemon, battler, move
})
ItemHandlers::CanUseInBattle.copy(:XDEFENSE,
:XDEFENSE2, :XDEFENSE3, :XDEFENSE6, :XDEFEND, :XDEFEND2, :XDEFEND3, :XDEFEND6)
:XDEFENSE2, :XDEFENSE3, :XDEFENSE6,
:XDEFEND, :XDEFEND2, :XDEFEND3, :XDEFEND6)
ItemHandlers::CanUseInBattle.add(:XSPATK, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
next pbBattleItemCanRaiseStat?(:SPECIAL_ATTACK, battler, scene, showMessages)
})
ItemHandlers::CanUseInBattle.copy(:XSPATK,
:XSPATK2, :XSPATK3, :XSPATK6, :XSPECIAL, :XSPECIAL2, :XSPECIAL3, :XSPECIAL6)
:XSPATK2, :XSPATK3, :XSPATK6,
:XSPECIAL, :XSPECIAL2, :XSPECIAL3, :XSPECIAL6)
ItemHandlers::CanUseInBattle.add(:XSPDEF, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages|
next pbBattleItemCanRaiseStat?(:SPECIAL_DEFENSE, battler, scene, showMessages)
@@ -429,8 +433,9 @@ ItemHandlers::BattleUseOnPokemon.add(:FULLHEAL, proc { |item, pokemon, battler,
})
ItemHandlers::BattleUseOnPokemon.copy(:FULLHEAL,
:LAVACOOKIE, :OLDGATEAU, :CASTELIACONE, :LUMIOSEGALETTE, :SHALOURSABLE,
:BIGMALASADA, :PEWTERCRUNCHIES, :LUMBERRY)
:LAVACOOKIE, :OLDGATEAU, :CASTELIACONE,
:LUMIOSEGALETTE, :SHALOURSABLE, :BIGMALASADA,
:PEWTERCRUNCHIES, :LUMBERRY)
ItemHandlers::BattleUseOnPokemon.copy(:FULLHEAL, :RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS
ItemHandlers::BattleUseOnPokemon.add(:FULLRESTORE, proc { |item, pokemon, battler, choices, scene|

View File

@@ -45,7 +45,7 @@ class Scene_Credits
# This next piece of code is the credits.
# Start Editing
CREDIT = <<_END_
CREDIT = <<~_END_
Your credits go here.
@@ -60,9 +60,9 @@ Your credits go here.
{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE}
"Pokémon Essentials" was created by:
Flameguru
Poccil (Peter O.)
Maruno
Inspired by work by Flameguru
With contributions from:
AvatarMonkeyKirby<s>Marin
@@ -150,29 +150,31 @@ _END_
lines_per_bitmap.times do |j|
line = credit_lines[(i * lines_per_bitmap) + j]
next if !line
line += " " if line.end_with?("<s>")
line = line.split("<s>")
xpos = 0
align = 1 # Centre align
linewidth = Graphics.width
line.length.times do |k|
text = line[k].strip
if line.length > 1
xpos = (k == 0) ? 0 : 20 + (Graphics.width / 2)
align = (k == 0) ? 2 : 0 # Right align : left align
linewidth = (Graphics.width / 2) - 20
end
credit_bitmap.font.color = TEXT_SHADOW_COLOR
credit_bitmap.draw_text(xpos, (j * 32) + 12, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, (j * 32) + 12, linewidth, 32, text, align)
credit_bitmap.font.color = TEXT_OUTLINE_COLOR
credit_bitmap.draw_text(xpos + 2, (j * 32) + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, (j * 32) + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, (j * 32) + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, (j * 32) + 4, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, (j * 32) + 4, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, (j * 32) + 6, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, (j * 32) + 6, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, (j * 32) + 6, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, (j * 32) + 2, linewidth, 32, text, align)
credit_bitmap.draw_text(xpos, (j * 32) + 2, linewidth, 32, text, align)
credit_bitmap.draw_text(xpos - 2, (j * 32) + 2, linewidth, 32, text, align)
credit_bitmap.draw_text(xpos + 2, (j * 32) + 4, linewidth, 32, text, align)
credit_bitmap.draw_text(xpos - 2, (j * 32) + 4, linewidth, 32, text, align)
credit_bitmap.draw_text(xpos + 2, (j * 32) + 6, linewidth, 32, text, align)
credit_bitmap.draw_text(xpos, (j * 32) + 6, linewidth, 32, text, align)
credit_bitmap.draw_text(xpos - 2, (j * 32) + 6, linewidth, 32, text, align)
credit_bitmap.font.color = TEXT_BASE_COLOR
credit_bitmap.draw_text(xpos, (j * 32) + 4, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, (j * 32) + 4, linewidth, 32, text, align)
end
end
credit_sprite = Sprite.new(text_viewport)

View File

@@ -546,7 +546,7 @@ class PokemonSummary_Scene
showNature = !@pokemon.shadowPokemon? || @pokemon.heartStage <= 3
if showNature
nature_name = red_text_tag + @pokemon.nature.name + black_text_tag
memo += _INTL("{1} nature.", @pokemon.nature.name) + "\n"
memo += _INTL("{1} nature.", nature_name) + "\n"
end
# Write date received
if @pokemon.timeReceived

View File

@@ -1,7 +1,7 @@
################################################################################
#===============================================================================
# "Lottery" mini-game
# By Maruno
################################################################################
#===============================================================================
def pbSetLotteryNumber(variable = 1)
t = pbGetTimeNow
hash = t.day + (t.month << 5) + (t.year << 9)

View File

@@ -238,9 +238,6 @@ class StandardRules < PokemonRuleSet
end
end
###########################################
# Generation IV Cups
###########################################
#===============================================================================
#
#===============================================================================

View File

@@ -48,14 +48,16 @@ class LevelAdjustment
adj1 = nil
adj2 = nil
ret = [getOldExp(team1, team2), getOldExp(team2, team1)]
if @adjustment == BOTH_TEAMS || @adjustment == MY_TEAM
case @adjustment
when BOTH_TEAMS
adj1 = getAdjustment(team1, team2)
elsif @adjustment == BOTH_TEAMS_DIFFERENT
adj1 = getMyAdjustment(team1, team2)
end
if @adjustment == BOTH_TEAMS || @adjustment == ENEMY_TEAM
adj2 = getAdjustment(team2, team1)
elsif @adjustment == BOTH_TEAMS_DIFFERENT
when MY_TEAM
adj1 = getAdjustment(team1, team2)
when ENEMY_TEAM
adj2 = getAdjustment(team2, team1)
when BOTH_TEAMS_DIFFERENT
adj1 = getMyAdjustment(team1, team2)
adj2 = getTheirAdjustment(team2, team1)
end
if adj1

View File

@@ -1,9 +1,9 @@
module BattleAnimationEditor
module_function
#===============================================================================
#=============================================================================
# Controls
#===============================================================================
#=============================================================================
class Window_Menu < Window_CommandPokemon
def initialize(commands, x, y)
tempbitmap = Bitmap.new(32, 32)
@@ -41,9 +41,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
# Clipboard
#===============================================================================
#=============================================================================
module Clipboard
@data = nil
@typekey = ""
@@ -63,9 +63,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
def pbTrackPopupMenu(commands)
mousepos = Mouse.getMousePos
return -1 if !mousepos
@@ -94,9 +94,9 @@ module BattleAnimationEditor
return -1
end
#===============================================================================
#=============================================================================
# Sprite sheet scrolling bar
#===============================================================================
#=============================================================================
class AnimationWindow < Sprite
attr_reader :animbitmap
attr_reader :start
@@ -232,9 +232,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class CanvasAnimationWindow < AnimationWindow
def animbitmap
return @canvas.animbitmap
@@ -246,9 +246,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
# Cel sprite
#===============================================================================
#=============================================================================
class InvalidatableSprite < Sprite
def initialize(viewport = nil)
super(viewport)
@@ -283,9 +283,9 @@ module BattleAnimationEditor
def refresh; end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class SpriteFrame < InvalidatableSprite
attr_reader :id
attr_reader :locked
@@ -352,9 +352,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
# Canvas
#===============================================================================
#=============================================================================
class AnimationCanvas < Sprite
attr_reader :viewport
attr_reader :sprites
@@ -930,9 +930,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
# Window classes
#===============================================================================
#=============================================================================
class BitmapDisplayWindow < SpriteWindow_Base
attr_reader :bitmapname
attr_reader :hue
@@ -982,9 +982,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class AnimationNameWindow
def initialize(canvas, x, y, width, height, viewport = nil)
@canvas = canvas

View File

@@ -1,9 +1,7 @@
module BattleAnimationEditor
module_function
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
module ShadowText
def shadowtext(bitmap, x, y, w, h, t, disabled = false, align = 0)
width = bitmap.text_size(t).width
@@ -19,9 +17,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class UIControl
include ShadowText
attr_accessor :bitmap
@@ -95,9 +93,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class Label < UIControl
def text=(value)
self.label = value
@@ -112,9 +110,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class Button < UIControl
attr_accessor :label
@@ -169,9 +167,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class Checkbox < Button
attr_reader :checked
@@ -230,9 +228,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class TextField < UIControl
attr_accessor :label
attr_reader :text
@@ -366,9 +364,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class Slider < UIControl
attr_reader :minvalue
attr_reader :maxvalue
@@ -480,9 +478,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class OptionalSlider < Slider
def initialize(label, minvalue, maxvalue, curvalue)
@slider = Slider.new(label, minvalue, maxvalue, curvalue)
@@ -551,7 +549,7 @@ module BattleAnimationEditor
@checkbox.refresh
end
#-----------------------------------------------------------------------------
#---------------------------------------------------------------------------
private
@@ -573,9 +571,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class ArrayCountSlider < Slider
def maxvalue
return @array.length - 1
@@ -587,9 +585,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class FrameCountSlider < Slider
def maxvalue
return @canvas.animation.length
@@ -601,9 +599,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class FrameCountButton < Button
def label
return _INTL("Total Frames: {1}", @canvas.animation.length)
@@ -615,9 +613,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class TextSlider < UIControl
attr_reader :minvalue
attr_reader :maxvalue
@@ -735,9 +733,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class OptionalTextSlider < TextSlider
def initialize(label, options, curval)
@slider = TextSlider.new(label, options, curval)
@@ -806,7 +804,7 @@ module BattleAnimationEditor
@checkbox.refresh
end
#-----------------------------------------------------------------------------
#---------------------------------------------------------------------------
private
@@ -828,9 +826,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class ControlWindow < SpriteWindow_Base
attr_reader :controls

View File

@@ -1,9 +1,9 @@
module BattleAnimationEditor
module_function
#===============================================================================
#=============================================================================
# Paths and interpolation
#===============================================================================
#=============================================================================
class ControlPointSprite < Sprite
attr_accessor :dragging
@@ -51,9 +51,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class PointSprite < Sprite
def initialize(x, y, viewport = nil)
super(viewport)
@@ -69,9 +69,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class PointPath
include Enumerable
@@ -179,9 +179,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
def catmullRom(p1, p2, p3, p4, t)
# p1=prevPoint, p2=startPoint, p3=endPoint, p4=nextPoint, t is from 0 through 1
t2 = t * t

View File

@@ -1,9 +1,9 @@
module BattleAnimationEditor
module_function
################################################################################
#=============================================================================
# Importing and exporting
################################################################################
#=============================================================================
def pbRgssChdir(dir)
RTP.eachPathFor(dir) { |path| Dir.chdir(path) { yield } }
end
@@ -83,9 +83,9 @@ module BattleAnimationEditor
return
end
################################################################################
#=============================================================================
# Format conversion
################################################################################
#=============================================================================
def pbConvertAnimToNewFormat(textdata)
needconverting = false
textdata.length.times do |i|

View File

@@ -1,9 +1,9 @@
module BattleAnimationEditor
module_function
#===============================================================================
#=============================================================================
# Mini battle scene
#===============================================================================
#=============================================================================
class MiniBattler
attr_accessor :index
attr_accessor :pokemon
@@ -11,9 +11,9 @@ module BattleAnimationEditor
def initialize(index); self.index = index; end
end
#===============================================================================
#=============================================================================
#
#===============================================================================
#=============================================================================
class MiniBattle
attr_accessor :battlers
@@ -23,9 +23,9 @@ module BattleAnimationEditor
end
end
#===============================================================================
#=============================================================================
# Pop-up menus for buttons in bottom menu
#===============================================================================
#=============================================================================
def pbSelectAnim(canvas, animwin)
animfiles = []
pbRgssChdir(File.join("Graphics", "Animations")) { animfiles.concat(Dir.glob("*.png")) }
@@ -182,9 +182,9 @@ module BattleAnimationEditor
cmdwin.dispose
end
#===============================================================================
#=============================================================================
# Pop-up menus for individual cels
#===============================================================================
#=============================================================================
def pbChooseNum(cel)
ret = cel
sliderwin2 = ControlWindow.new(0, 0, 320, 32 * 5)
@@ -370,9 +370,9 @@ module BattleAnimationEditor
return
end
#===============================================================================
#=============================================================================
# Pop-up menus for buttons in right hand menu
#===============================================================================
#=============================================================================
def pbTimingList(canvas)
commands = []
cmdNewSound = -1

View File

@@ -260,7 +260,7 @@ module Compiler
(0...values.length).each do |i|
value = values[i]
next if !value || value.empty?
quote_count = value.count('"') #scan(/(?:^|\G|[^\\])(\\)*"/).length
quote_count = value.count('"')
if !quote_count.zero?
# Quote marks found in value
(i...(values.length - 1)).each do |j|

View File

@@ -606,15 +606,19 @@ module Compiler
push_choice(firstpage.list, 0, "Yes", 3)
if common_event > 0
if battleid > 0
push_script(firstpage.list, sprintf("Phone.add(get_self,\n %s, %d, %d, %d\n)", brieftrcombo, battles.length, battleid, common_event), 3)
push_script(firstpage.list, sprintf("Phone.add(get_self,\n %s, %d, %d, %d\n)",
brieftrcombo, battles.length, battleid, common_event), 3)
else
push_script(firstpage.list, sprintf("Phone.add(get_self,\n %s, %d, nil, %d\n)", brieftrcombo, battles.length, common_event), 3)
push_script(firstpage.list, sprintf("Phone.add(get_self,\n %s, %d, nil, %d\n)",
brieftrcombo, battles.length, common_event), 3)
end
else
if battleid > 0
push_script(firstpage.list, sprintf("Phone.add(get_self,\n %s, %d, %d\n)", brieftrcombo, battles.length, battleid), 3)
push_script(firstpage.list, sprintf("Phone.add(get_self,\n %s, %d, %d\n)",
brieftrcombo, battles.length, battleid), 3)
else
push_script(firstpage.list, sprintf("Phone.add(get_self,\n %s, %d\n)", brieftrcombo, battles.length), 3)
push_script(firstpage.list, sprintf("Phone.add(get_self,\n %s, %d\n)",
brieftrcombo, battles.length), 3)
end
end
push_choice(firstpage.list, 1, "No", 3)
@@ -694,15 +698,19 @@ module Compiler
push_choice(lastpage.list, 0, "Yes", 2)
if common_event > 0
if battleid > 0
push_script(lastpage.list, sprintf("Phone.add(get_self,\n %s, %d, %d, %d\n)", brieftrcombo, battles.length, battleid, common_event), 2)
push_script(lastpage.list, sprintf("Phone.add(get_self,\n %s, %d, %d, %d\n)",
brieftrcombo, battles.length, battleid, common_event), 2)
else
push_script(lastpage.list, sprintf("Phone.add(get_self,\n %s, %d, nil, %d\n)", brieftrcombo, battles.length, common_event), 2)
push_script(lastpage.list, sprintf("Phone.add(get_self,\n %s, %d, nil, %d\n)",
brieftrcombo, battles.length, common_event), 2)
end
else
if battleid > 0
push_script(lastpage.list, sprintf("Phone.add(get_self,\n %s, %d, %d\n)", brieftrcombo, battles.length, battleid), 2)
push_script(lastpage.list, sprintf("Phone.add(get_self,\n %s, %d, %d\n)",
brieftrcombo, battles.length, battleid), 2)
else
push_script(lastpage.list, sprintf("Phone.add(get_self,\n %s, %d\n)", brieftrcombo, battles.length), 2)
push_script(lastpage.list, sprintf("Phone.add(get_self,\n %s, %d\n)",
brieftrcombo, battles.length), 2)
end
end
push_choice(lastpage.list, 1, "No", 2)