mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
various fixes
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
module Settings
|
||||
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
|
||||
GAME_VERSION = '5.0.0'
|
||||
GAME_VERSION_NUMBER = "5.0.35.2"
|
||||
GAME_VERSION_NUMBER = "5.0.35.3"
|
||||
|
||||
POKERADAR_LIGHT_ANIMATION_RED_ID = 17
|
||||
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
|
||||
|
||||
@@ -432,7 +432,7 @@ module PluginManager
|
||||
#-----------------------------------------------------------------------------
|
||||
def self.pluginErrorMsg(name, script)
|
||||
# begin message formatting
|
||||
message = "[Pokémon Essentials version #{Essentials::VERSION}]\r\n"
|
||||
message = "[Infinite Fusion version #{Settings::GAME_VERSION_NUMBER}]\r\n"
|
||||
message += "#{Essentials::ERROR_TEXT}\r\n" # For third party scripts to add to
|
||||
message += "Error in Plugin [#{name}]:\r\n"
|
||||
message += "#{$!.class} occurred.\r\n"
|
||||
|
||||
@@ -642,12 +642,12 @@ Events.onEndBattle += proc { |_sender,e|
|
||||
end
|
||||
}
|
||||
|
||||
def pbEvolutionCheck(currentLevels)
|
||||
def pbEvolutionCheck(currentLevels,scene=nil)
|
||||
for i in 0...currentLevels.length
|
||||
pkmn = $Trainer.party[i]
|
||||
next if !pkmn || (pkmn.hp==0 && !Settings::CHECK_EVOLUTION_FOR_FAINTED_POKEMON)
|
||||
next if currentLevels[i] && pkmn.level==currentLevels[i]
|
||||
newSpecies = pkmn.check_evolution_on_level_up
|
||||
newSpecies = pkmn.check_evolution_on_level_up()
|
||||
next if !newSpecies
|
||||
evo = PokemonEvolutionScene.new
|
||||
evo.pbStartScreen(pkmn,newSpecies)
|
||||
|
||||
@@ -173,7 +173,7 @@ def pbChangeLevel(pkmn, newlevel, scene)
|
||||
pbLearnMove(pkmn, i[1], true) { scene.pbUpdate }
|
||||
end
|
||||
# Check for evolution
|
||||
newspecies = pkmn.check_evolution_on_level_up
|
||||
newspecies = pkmn.check_evolution_on_level_up(scene)
|
||||
if newspecies
|
||||
pbFadeOutInWithMusic {
|
||||
evo = PokemonEvolutionScene.new
|
||||
|
||||
@@ -222,12 +222,12 @@ class Pokemon
|
||||
end
|
||||
|
||||
def form=(value)
|
||||
oldForm = @form
|
||||
@form = value
|
||||
@ability = nil
|
||||
MultipleForms.call("onSetForm", self, value, oldForm)
|
||||
calc_stats
|
||||
$Trainer.pokedex.register(self)
|
||||
# oldForm = @form
|
||||
# @form = value
|
||||
# @ability = nil
|
||||
# MultipleForms.call("onSetForm", self, value, oldForm)
|
||||
# calc_stats
|
||||
# $Trainer.pokedex.register(self)
|
||||
end
|
||||
|
||||
# The same as def form=, but yields to a given block in the middle so that a
|
||||
|
||||
@@ -491,6 +491,7 @@ class PokemonEvolutionScene
|
||||
|
||||
def pbStartScreen(pokemon,newspecies,reversing=false)
|
||||
@pokemon = pokemon
|
||||
|
||||
@newspecies = newspecies
|
||||
@sprites = {}
|
||||
@bgviewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
|
||||
@@ -77,7 +77,7 @@ off Pokémon Red and Blue, as well as
|
||||
Pokémon Gold and Silver.
|
||||
Both games are made by Game Freak.
|
||||
|
||||
ALl of the custom fused Pokémon sprites
|
||||
All of the custom fused Pokémon sprites
|
||||
were madeby various members of the sp
|
||||
Pokémon Infinite Fusion Discord
|
||||
|
||||
|
||||
@@ -246,6 +246,7 @@ class PokemonPokedexInfo_Scene
|
||||
#if @dexlist[@index][4] > 0
|
||||
indexNumber = @dexlist[@index][4]
|
||||
indexNumber -= 1 if @dexlist[@index][5]
|
||||
indexNumber = GameData::Species.get(@species).id_number
|
||||
indexText = sprintf("%03d", indexNumber)
|
||||
# end
|
||||
textpos = [
|
||||
@@ -586,7 +587,7 @@ class PokemonPokedexInfoScreen
|
||||
else
|
||||
region = $PokemonGlobal.pokedexDex # National Dex -1, regional Dexes 0, 1, etc.
|
||||
end
|
||||
dexnum = pbGetRegionalNumber(region,species)
|
||||
dexnum = GameData::Species.get(species).id_number#pbGetRegionalNumber(region,species)
|
||||
dexnumshift = Settings::DEXES_WITH_OFFSETS.include?(region)
|
||||
dexlist = [[species,GameData::Species.get(species).name,0,0,dexnum,dexnumshift]]
|
||||
@scene.pbStartScene(dexlist,0,region)
|
||||
|
||||
@@ -422,12 +422,12 @@ class PokemonSummary_Scene
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
# if dexnum <= 0
|
||||
# textpos.push(["???", 435, 74, 2, dexNumBase, dexNumShadow])
|
||||
# else
|
||||
# dexnum -= 1 if dexnumshift
|
||||
# textpos.push([sprintf("%03d", dexnum), 435, 74, 2, dexNumBase, dexNumShadow])
|
||||
# end
|
||||
if dexnum <= 0
|
||||
textpos.push(["???", 435, 74, 2, dexNumBase, dexNumShadow])
|
||||
else
|
||||
dexnum -= 1 if dexnumshift
|
||||
textpos.push([sprintf("%03d", dexnum), 435, 74, 2, dexNumBase, dexNumShadow])
|
||||
end
|
||||
# Write Original Trainer's name and ID number
|
||||
if @pokemon.owner.name.empty?
|
||||
textpos.push([_INTL("RENTAL"), 435, 170, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
|
||||
|
||||
@@ -37,7 +37,7 @@ class StorageSystemPC
|
||||
command = 0
|
||||
loop do
|
||||
command = pbShowCommandsWithHelp(nil,
|
||||
[_INTL("Organize Boxes"),
|
||||
[_INTL("Organize / Fuse"),
|
||||
_INTL("Withdraw Pokémon"),
|
||||
_INTL("Deposit Pokémon"),
|
||||
_INTL("See ya!")],
|
||||
|
||||
@@ -806,6 +806,9 @@ PokemonDebugMenuCommands.register("speciesform", {
|
||||
species = pbChooseSpeciesList(pkmn.species)
|
||||
if species && species != pkmn.species
|
||||
pkmn.species = species
|
||||
if pkmn.shiny?
|
||||
pkmn.debug_shiny=true
|
||||
end
|
||||
pkmn.calc_stats
|
||||
$Trainer.pokedex.register(pkmn) if !settingUpBattle
|
||||
screen.pbRefreshSingle(pkmnid)
|
||||
|
||||
@@ -1055,7 +1055,6 @@ module Compiler
|
||||
slots.compact!
|
||||
slots.sort! { |a, b| (a[0] == b[0]) ? a[1].to_s <=> b[1].to_s : b[0] <=> a[0] }
|
||||
end
|
||||
p encounter_hash
|
||||
GameData::Encounter.register(encounter_hash)
|
||||
end
|
||||
# Save all data
|
||||
|
||||
@@ -20,7 +20,7 @@ HELD_ITEMS = [:AIRBALLOON, :BRIGHTPOWDER, :EVIOLITE, :FLOATSTONE, :DESTINYKNOT,
|
||||
:PETAYABERRY, :APICOTBERRY, :LANSATBERRY, :STARFBERRY, :ENIGMABERRY, :MICLEBERRY, :CUSTAPBERRY,
|
||||
:JABOCABERRY, :ROWAPBERRY, :FAIRYGEM]
|
||||
|
||||
INVALID_ITEMS = [:COVERFOSSIL, :PLUMEFOSSIL, :ACCURACYUP, :DAMAGEUP, :ANCIENTSTONE, :ODDKEYSTONE_FULL, :TM00]
|
||||
INVALID_ITEMS = [:COVERFOSSIL, :PLUMEFOSSIL, :ACCURACYUP, :DAMAGEUP, :ANCIENTSTONE, :ODDKEYSTONE_FULL, :TM00,:DEVOLUTIONSPRAY]
|
||||
RANDOM_ITEM_EXCEPTIONS = [:DNASPLICERS]
|
||||
|
||||
def getRandomGivenTM(item)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,139 @@
|
||||
|
||||
def pbGetTerrainTag()
|
||||
return $game_player.pbTerrainTag().id
|
||||
end
|
||||
|
||||
|
||||
def getLevelAtWhichSpeciesEvolved(species)
|
||||
levelAtWhichCurrentSpeciesEvolved=1
|
||||
evosArray = species.get_family_evolutions
|
||||
for entry in evosArray
|
||||
if entry[0] == species.id && entry[1] == :Level
|
||||
if entry[2] && entry[2] < levelAtWhichCurrentSpeciesEvolved
|
||||
levelAtWhichCurrentSpeciesEvolved = entry[2]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def getNextEvolutions(species, evolutions)
|
||||
if !evolutions
|
||||
evolutions = species.get_evolutions
|
||||
end
|
||||
|
||||
nextEvolutions = []
|
||||
currentLowestEvolution = nil
|
||||
for evolution in evolutions
|
||||
if evolution[1]== :Level
|
||||
evoLevel = evolution[2]
|
||||
currentLowestLevel = currentLowestEvolution ? currentLowestEvolution[2] : Settings::MAXIMUM_LEVEL
|
||||
if evoLevel < currentLowestLevel
|
||||
currentLowestEvolution = evolution
|
||||
end
|
||||
else
|
||||
nextEvolutions << evolution
|
||||
end
|
||||
end
|
||||
if currentLowestEvolution != nil
|
||||
nextEvolutions << currentLowestEvolution
|
||||
end
|
||||
return nextEvolutions
|
||||
end
|
||||
|
||||
def extract_custom_sprites_that_evolve_into_non_customs(includeOnlyNextEvos=true)
|
||||
outfile = "nonCustomEvos.txt"
|
||||
customSpecies = getCustomSpeciesList()
|
||||
|
||||
alreadyWritten = []
|
||||
|
||||
File.open(outfile,"wb") { |f|
|
||||
for dexNum in customSpecies
|
||||
species = GameData::Species.get(dexNum)
|
||||
dex_body = getBodyID(species)
|
||||
dex_head = getHeadID(species,dex_body)
|
||||
|
||||
evolutions = species.get_evolutions
|
||||
nextEvolutions=evolutions
|
||||
if includeOnlyNextEvos
|
||||
nextEvolutions = getNextEvolutions(species,evolutions)
|
||||
end
|
||||
|
||||
next if nextEvolutions.empty?
|
||||
for evolution in nextEvolutions
|
||||
evoSpecies = evolution[0]
|
||||
if !customSpriteExists(evoSpecies) && !alreadyWritten.include?(evoSpecies)
|
||||
body = getBodyID(evoSpecies)
|
||||
head = getHeadID(evoSpecies,body)
|
||||
f.write((evoSpecies.to_s) +";")
|
||||
f.write((head.to_s) +";")
|
||||
f.write(".;")
|
||||
f.write((body.to_s) +";")
|
||||
f.write("evolves from ;")
|
||||
f.write(species.id.to_s) + ";"
|
||||
f.write((dex_head.to_s) +";")
|
||||
f.write(".;")
|
||||
f.write((dex_body.to_s) +";")
|
||||
f.write("\n")
|
||||
|
||||
|
||||
alreadyWritten << evoSpecies
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def extract_incomplete_evolution_lines
|
||||
outfile = "incompleteLines.txt"
|
||||
pokeList = []
|
||||
for i in NB_POKEMON+1..PBSpecies.maxValue
|
||||
pokeList << i
|
||||
end
|
||||
|
||||
to_skip=[]
|
||||
|
||||
File.open(outfile,"wb") { |f|
|
||||
for i in pokeList
|
||||
next if to_skip.include?(i)
|
||||
|
||||
species = GameData::Species.get(i)
|
||||
evolutions = []
|
||||
for evoArray in species.get_family_evolutions
|
||||
evolutions << evoArray[1]
|
||||
end
|
||||
|
||||
|
||||
non_customs = []
|
||||
nbCustoms=0
|
||||
for stage in evolutions
|
||||
if !customSpriteExists(stage)
|
||||
non_customs << stage
|
||||
else
|
||||
nbCustoms+=1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#write non customs
|
||||
if !non_customs.empty? && nbCustoms > 0
|
||||
for missing_sprite in non_customs
|
||||
f.write((missing_sprite.to_s) +";")
|
||||
end
|
||||
f.write((missing_sprite.to_s) +"\n")
|
||||
end
|
||||
|
||||
#remove evos from list
|
||||
for evo in evolutions
|
||||
species = GameData::Species.get(evo)
|
||||
to_skip << species.id_number
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
}
|
||||
end
|
||||
@@ -25,10 +25,36 @@ module GameData
|
||||
MINIMUM_OFFSET=40
|
||||
ADDITIONAL_OFFSET_WHEN_TOO_CLOSE=40
|
||||
MINIMUM_DEX_DIF=20
|
||||
|
||||
def self.calculateShinyHueOffset(dex_number, isBodyShiny = false, isHeadShiny = false)
|
||||
if dex_number <= NB_POKEMON
|
||||
if SHINY_COLOR_OFFSETS[dex_number]
|
||||
return SHINY_COLOR_OFFSETS[dex_number]
|
||||
end
|
||||
body_number = dex_number
|
||||
head_number=dex_number
|
||||
|
||||
else
|
||||
body_number = getBodyID(dex_number)
|
||||
head_number=getHeadID(dex_number,body_number)
|
||||
end
|
||||
if isBodyShiny && isHeadShiny && SHINY_COLOR_OFFSETS[body_number] && SHINY_COLOR_OFFSETS[head_number]
|
||||
offset = SHINY_COLOR_OFFSETS[body_number] + SHINY_COLOR_OFFSETS[head_number]
|
||||
elsif isHeadShiny && SHINY_COLOR_OFFSETS[head_number]
|
||||
offset = SHINY_COLOR_OFFSETS[head_number]
|
||||
elsif isBodyShiny && SHINY_COLOR_OFFSETS[body_number]
|
||||
offset = SHINY_COLOR_OFFSETS[body_number]
|
||||
else
|
||||
offset = calculateShinyHueOffsetDefaultMethod(body_number,head_number,dex_number,isBodyShiny,isHeadShiny)
|
||||
end
|
||||
return offset
|
||||
end
|
||||
|
||||
|
||||
def self.calculateShinyHueOffsetDefaultMethod(body_number,head_number,dex_number, isBodyShiny = false, isHeadShiny = false)
|
||||
dex_offset = dex_number
|
||||
body_number = getBodyID(dex_number)
|
||||
head_number=getHeadID(dex_number,body_number)
|
||||
#body_number = getBodyID(dex_number)
|
||||
#head_number=getHeadID(dex_number,body_number)
|
||||
dex_diff = (body_number-head_number).abs
|
||||
if isBodyShiny && isHeadShiny
|
||||
dex_offset = dex_number
|
||||
|
||||
189
Data/Scripts/050_AddOns/MapExporter.rb
Normal file
189
Data/Scripts/050_AddOns/MapExporter.rb
Normal file
@@ -0,0 +1,189 @@
|
||||
# #==============================================================================#
|
||||
# # Map Exporter #
|
||||
# # by Marin #
|
||||
# #==============================================================================#
|
||||
# # Manually export a map using `pbExportMap(id)`, or go into the Debug menu and #
|
||||
# # choose the `Export a Map` option that is now in there. #
|
||||
# # #
|
||||
# # `pbExportMap(id, options)`, where `options` is an array that can contain: #
|
||||
# # - :events -> This will alsoEXPORTED_FILENAME = "export/"
|
||||
# #
|
||||
# # def exportAllMaps
|
||||
# # options = [:events]
|
||||
# # for id in 1..768
|
||||
# # pbExportMap(id, options)
|
||||
# # end
|
||||
# # end export all events present on the map #
|
||||
# # - :player -> This will also export the player if they're on that map #
|
||||
# # `id` can be nil, which case it will use the current map the player is on. #
|
||||
# #==============================================================================#
|
||||
# # Please give credit when using this. #
|
||||
# #==============================================================================#
|
||||
#
|
||||
# # This is where the map will be exported to once it has been created.
|
||||
# # If this file already exists, it is overwritten.
|
||||
# ExportedMapFilename = "export/"
|
||||
#
|
||||
# def exportAllMaps
|
||||
# options = [:events]
|
||||
# for id in 1..768
|
||||
# begin
|
||||
# pbExportMap(id,options)
|
||||
# rescue
|
||||
# echo "error in " +(id.to_s) +"\n"
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
#
|
||||
# def pbExportMap(id = nil, options = [])
|
||||
# MarinMapExporter.new(id, options)
|
||||
# end
|
||||
#
|
||||
# def pbExportAMap
|
||||
# vp = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
# vp.z = 99999
|
||||
# s = Sprite.new(vp)
|
||||
# s.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||
# s.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0,0,0))
|
||||
# mapid = pbListScreen(_INTL("Export Map"),MapLister.new(pbDefaultMap))
|
||||
# if mapid > 0
|
||||
# player = $game_map.map_id == mapid
|
||||
# if player
|
||||
# cmds = ["Export", "[ ] Events", "[ ] Player", "Cancel"]
|
||||
# else
|
||||
# cmds = ["Export", "[ ] Events", "Cancel"]
|
||||
# end
|
||||
# cmd = 0
|
||||
# loop do
|
||||
# cmd = pbShowCommands(nil,cmds,-1,cmd)
|
||||
# if cmd == 0
|
||||
# Graphics.update
|
||||
# options = []
|
||||
# options << :events if cmds[1].split("")[1] == "X"
|
||||
# options << :player if player && cmds[2].split("")[1] == "X"
|
||||
# msgwindow = Window_AdvancedTextPokemon.newWithSize(
|
||||
# _INTL("Saving... Please be patient."),
|
||||
# 0, Graphics.height - 96, Graphics.width, 96, vp
|
||||
# )
|
||||
# msgwindow.setSkin(MessageConfig.pbGetSpeechFrame)
|
||||
# Graphics.update
|
||||
# pbExportMap(mapid, options)
|
||||
# msgwindow.setText(_INTL("Successfully exported the map."))
|
||||
# 60.times { Graphics.update; Input.update }
|
||||
# pbDisposeMessageWindow(msgwindow)
|
||||
# break
|
||||
# elsif cmd == 1
|
||||
# if cmds[1].split("")[1] == " "
|
||||
# cmds[1] = "[X] Events"
|
||||
# else
|
||||
# cmds[1] = "[ ] Events"
|
||||
# end
|
||||
# elsif cmd == 2 && player
|
||||
# if cmds[2].split("")[1] == " "
|
||||
# cmds[2] = "[X] Player"
|
||||
# else
|
||||
# cmds[2] = "[ ] Player"
|
||||
# end
|
||||
# elsif cmd == 3 || cmd == 2 && !player || cmd == -1
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# s.bitmap.dispose
|
||||
# s.dispose
|
||||
# vp.dispose
|
||||
# end
|
||||
#
|
||||
# DebugMenuCommands.register("exportmap", {
|
||||
# "parent" => "fieldmenu",
|
||||
# "name" => _INTL("Export a Map"),
|
||||
# "description" => _INTL("Choose a map to export it to a PNG."),
|
||||
# "effect" => proc { |sprites, viewport|
|
||||
# pbExportAMap
|
||||
# }
|
||||
# })
|
||||
#
|
||||
# class MarinMapExporter
|
||||
# def initialize(id = nil, options = [])
|
||||
# mapinfos = load_data("Data/MapInfos.rxdata")
|
||||
# filename = id.to_s + "_" + mapinfos[id].name
|
||||
#
|
||||
#
|
||||
#
|
||||
# @id = id || $game_map.map_id
|
||||
# @options = options
|
||||
# @data = load_data("Data/Map#{@id.to_digits}.rxdata")
|
||||
# @tiles = @data.data
|
||||
# @result = Bitmap.new(32 * @tiles.xsize, 32 * @tiles.ysize)
|
||||
# @tilesetdata = load_data("Data/Tilesets.rxdata")
|
||||
# tilesetname = @tilesetdata[@data.tileset_id].tileset_name
|
||||
# @tileset = Bitmap.new("Graphics/Tilesets/#{tilesetname}")
|
||||
# @autotiles = @tilesetdata[@data.tileset_id].autotile_names
|
||||
# .filter { |e| e && e.size > 0 }
|
||||
# .map { |e| Bitmap.new("Graphics/Autotiles/#{e}") }
|
||||
# for z in 0..2
|
||||
# for y in 0...@tiles.ysize
|
||||
# for x in 0...@tiles.xsize
|
||||
# id = @tiles[x, y, z]
|
||||
# next if id == 0
|
||||
# if id < 384 # Autotile
|
||||
# build_autotile(@result, x * 32, y * 32, id)
|
||||
# else # Normal tile
|
||||
# @result.blt(x * 32, y * 32, @tileset,
|
||||
# Rect.new(32 * ((id - 384) % 8),32 * ((id - 384) / 8).floor,32,32))
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# if @options.include?(:events)
|
||||
# keys = @data.events.keys.sort { |a, b| @data.events[a].y <=> @data.events[b].y }
|
||||
# keys.each do |id|
|
||||
# event = @data.events[id]
|
||||
# page = pbGetActiveEventPage(event, @id)
|
||||
# if page && page.graphic && page.graphic.character_name && page.graphic.character_name.size > 0
|
||||
# bmp = Bitmap.new("Graphics/Characters/#{page.graphic.character_name}")
|
||||
# if bmp
|
||||
# bmp = bmp.clone
|
||||
# bmp.hue_change(page.graphic.character_hue) unless page.graphic.character_hue == 0
|
||||
# ex = bmp.width / 4 * page.graphic.pattern
|
||||
# ey = bmp.height / 4 * (page.graphic.direction / 2 - 1)
|
||||
# @result.blt(event.x * 32 + 16 - bmp.width / 8, (event.y + 1) * 32 - bmp.height / 4, bmp,
|
||||
# Rect.new(ex, ey, bmp.width / 4, bmp.height / 4))
|
||||
# end
|
||||
# bmp = nil
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# if @options.include?(:player) && $game_map.map_id == @id && $game_player.character_name &&
|
||||
# $game_player.character_name.size > 0
|
||||
# bmp = Bitmap.new("Graphics/Characters/#{$game_player.character_name}")
|
||||
# dir = $game_player.direction
|
||||
# @result.blt($game_player.x * 32 + 16 - bmp.width / 8, ($game_player.y + 1) * 32 - bmp.height / 4,
|
||||
# bmp, Rect.new(0, bmp.height / 4 * (dir / 2 - 1), bmp.width / 4, bmp.height / 4))
|
||||
# end
|
||||
# @result.save_to_png(ExportedMapFilename + filename + ".png")
|
||||
# echo (id.to_s) +"\n"
|
||||
# Input.update
|
||||
# end
|
||||
#
|
||||
# def build_autotile(bitmap, x, y, id)
|
||||
# autotile = @autotiles[id / 48 - 1]
|
||||
# return unless autotile
|
||||
# if autotile.height == 32
|
||||
# bitmap.blt(x,y,autotile,Rect.new(0,0,32,32))
|
||||
# else
|
||||
# id %= 48
|
||||
# tiles = CustomTilemap::Autotiles[id >> 3][id & 7]
|
||||
# src = Rect.new(0,0,0,0)
|
||||
# halfTileWidth = halfTileHeight = halfTileSrcWidth = halfTileSrcHeight = 32 >> 1
|
||||
# for i in 0...4
|
||||
# tile_position = tiles[i] - 1
|
||||
# src.set((tile_position % 6) * halfTileSrcWidth,
|
||||
# (tile_position / 6) * halfTileSrcHeight, halfTileSrcWidth, halfTileSrcHeight)
|
||||
# bitmap.blt(i % 2 * halfTileWidth + x, i / 2 * halfTileHeight + y,
|
||||
# autotile, src)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
422
Data/Scripts/050_AddOns/ShinyColorOffsets.rb
Normal file
422
Data/Scripts/050_AddOns/ShinyColorOffsets.rb
Normal file
@@ -0,0 +1,422 @@
|
||||
SHINY_COLOR_OFFSETS = {
|
||||
1 => -30,
|
||||
2 => -85,
|
||||
3 => -50,
|
||||
4 => 40,
|
||||
5 => 60,
|
||||
6 => 130,
|
||||
7 => 25,
|
||||
8 => 15,
|
||||
9 => 50,
|
||||
10 => -50,
|
||||
11 => -80,
|
||||
12 => 95,
|
||||
#13 => -1,
|
||||
#14 => -1,
|
||||
#15 => -1,
|
||||
#16 => -1,
|
||||
#17 => -1,
|
||||
#18 => -1,
|
||||
#19 => -1,
|
||||
#20 => -1,
|
||||
#21 => -1,
|
||||
#22 => -1,
|
||||
#23 => -1,
|
||||
#24 => -1,
|
||||
#25 => -1,
|
||||
#26 => -1,
|
||||
#27 => -1,
|
||||
#28 => -1,
|
||||
#29 => -1,
|
||||
#30 => -1,
|
||||
#31 => -1,
|
||||
#32 => -1,
|
||||
#33 => -1,
|
||||
#34 => -1,
|
||||
#35 => -1,
|
||||
#36 => -1,
|
||||
#37 => -1,
|
||||
#38 => -1,
|
||||
#39 => -1,
|
||||
#40 => -1,
|
||||
#41 => -1,
|
||||
#42 => -1,
|
||||
#43 => -1,
|
||||
#44 => -1,
|
||||
#45 => -1,
|
||||
#46 => -1,
|
||||
#47 => -1,
|
||||
#48 => -1,
|
||||
#49 => -1,
|
||||
#50 => -1,
|
||||
#51 => -1,
|
||||
#52 => -1,
|
||||
#53 => -1,
|
||||
#54 => -1,
|
||||
#55 => -1,
|
||||
#56 => -1,
|
||||
#57 => -1,
|
||||
#58 => -1,
|
||||
#59 => -1,
|
||||
#60 => -1,
|
||||
#61 => -1,
|
||||
#62 => -1,
|
||||
#63 => -1,
|
||||
#64 => -1,
|
||||
#65 => -1,
|
||||
#66 => -1,
|
||||
#67 => -1,
|
||||
#68 => -1,
|
||||
#69 => -1,
|
||||
#70 => -1,
|
||||
#71 => -1,
|
||||
#72 => -1,
|
||||
#73 => -1,
|
||||
#74 => -1,
|
||||
#75 => -1,
|
||||
#76 => -1,
|
||||
#77 => -1,
|
||||
#78 => -1,
|
||||
#79 => -1,
|
||||
#80 => -1,
|
||||
#81 => -1,
|
||||
#82 => -1,
|
||||
#83 => -1,
|
||||
#84 => -1,
|
||||
#85 => -1,
|
||||
#86 => -1,
|
||||
#87 => -1,
|
||||
#88 => -1,
|
||||
#89 => -1,
|
||||
#90 => -1,
|
||||
#91 => -1,
|
||||
#92 => -1,
|
||||
#93 => -1,
|
||||
#94 => -1,
|
||||
#95 => -1,
|
||||
#96 => -1,
|
||||
#97 => -1,
|
||||
#98 => -1,
|
||||
#99 => -1,
|
||||
#100 => -1,
|
||||
#101 => -1,
|
||||
#102 => -1,
|
||||
#103 => -1,
|
||||
#104 => -1,
|
||||
#105 => -1,
|
||||
#106 => -1,
|
||||
#107 => -1,
|
||||
#108 => -1,
|
||||
#109 => -1,
|
||||
#110 => -1,
|
||||
#111 => -1,
|
||||
#112 => -1,
|
||||
#113 => -1,
|
||||
#114 => -1,
|
||||
#115 => -1,
|
||||
#116 => -1,
|
||||
#117 => -1,
|
||||
#118 => -1,
|
||||
#119 => -1,
|
||||
#120 => -1,
|
||||
#121 => -1,
|
||||
#122 => -1,
|
||||
#123 => -1,
|
||||
#124 => -1,
|
||||
#125 => -1,
|
||||
#126 => -1,
|
||||
#127 => -1,
|
||||
#128 => -1,
|
||||
129 => 36,
|
||||
130 => 150,
|
||||
#131 => -1,
|
||||
#132 => -1,
|
||||
#133 => -1,
|
||||
#134 => -1,
|
||||
#135 => -1,
|
||||
#136 => -1,
|
||||
#137 => -1,
|
||||
#138 => -1,
|
||||
#139 => -1,
|
||||
#140 => -1,
|
||||
#141 => -1,
|
||||
#142 => -1,
|
||||
#143 => -1,
|
||||
#144 => -1,
|
||||
#145 => -1,
|
||||
#146 => -1,
|
||||
#147 => -1,
|
||||
#148 => -1,
|
||||
#149 => -1,
|
||||
#150 => -1,
|
||||
#151 => -1,
|
||||
#152 => -1,
|
||||
#153 => -1,
|
||||
#154 => -1,
|
||||
#155 => -1,
|
||||
#156 => -1,
|
||||
#157 => -1,
|
||||
#158 => -1,
|
||||
#159 => -1,
|
||||
#160 => -1,
|
||||
#161 => -1,
|
||||
#162 => -1,
|
||||
#163 => -1,
|
||||
#164 => -1,
|
||||
#165 => -1,
|
||||
#166 => -1,
|
||||
#167 => -1,
|
||||
#168 => -1,
|
||||
#169 => -1,
|
||||
#170 => -1,
|
||||
#171 => -1,
|
||||
#172 => -1,
|
||||
#173 => -1,
|
||||
#174 => -1,
|
||||
#175 => -1,
|
||||
#176 => -1,
|
||||
#177 => -1,
|
||||
#178 => -1,
|
||||
#179 => -1,
|
||||
#180 => -1,
|
||||
#181 => -1,
|
||||
#182 => -1,
|
||||
#183 => -1,
|
||||
#184 => -1,
|
||||
#185 => -1,
|
||||
#186 => -1,
|
||||
#187 => -1,
|
||||
#188 => -1,
|
||||
#189 => -1,
|
||||
#190 => -1,
|
||||
#191 => -1,
|
||||
#192 => -1,
|
||||
#193 => -1,
|
||||
#194 => -1,
|
||||
#195 => -1,
|
||||
#196 => -1,
|
||||
#197 => -1,
|
||||
#198 => -1,
|
||||
#199 => -1,
|
||||
#200 => -1,
|
||||
#201 => -1,
|
||||
#202 => -1,
|
||||
#203 => -1,
|
||||
#204 => -1,
|
||||
#205 => -1,
|
||||
#206 => -1,
|
||||
#207 => -1,
|
||||
#208 => -1,
|
||||
#209 => -1,
|
||||
#210 => -1,
|
||||
#211 => -1,
|
||||
#212 => -1,
|
||||
#213 => -1,
|
||||
#214 => -1,
|
||||
#215 => -1,
|
||||
#216 => -1,
|
||||
#217 => -1,
|
||||
#218 => -1,
|
||||
#219 => -1,
|
||||
#220 => -1,
|
||||
#221 => -1,
|
||||
#222 => -1,
|
||||
#223 => -1,
|
||||
#224 => -1,
|
||||
#225 => -1,
|
||||
#226 => -1,
|
||||
#227 => -1,
|
||||
#228 => -1,
|
||||
#229 => -1,
|
||||
#230 => -1,
|
||||
#231 => -1,
|
||||
#232 => -1,
|
||||
#233 => -1,
|
||||
#234 => -1,
|
||||
#235 => -1,
|
||||
#236 => -1,
|
||||
#237 => -1,
|
||||
#238 => -1,
|
||||
#239 => -1,
|
||||
#240 => -1,
|
||||
#241 => -1,
|
||||
#242 => -1,
|
||||
#243 => -1,
|
||||
#244 => -1,
|
||||
#245 => -1,
|
||||
#246 => -1,
|
||||
#247 => -1,
|
||||
#248 => -1,
|
||||
#249 => -1,
|
||||
#250 => -1,
|
||||
#251 => -1,
|
||||
#252 => -1,
|
||||
#253 => -1,
|
||||
#254 => -1,
|
||||
#255 => -1,
|
||||
#256 => -1,
|
||||
#257 => -1,
|
||||
#258 => -1,
|
||||
#259 => -1,
|
||||
#260 => -1,
|
||||
#261 => -1,
|
||||
#262 => -1,
|
||||
#263 => -1,
|
||||
#264 => -1,
|
||||
#265 => -1,
|
||||
#266 => -1,
|
||||
#267 => -1,
|
||||
#268 => -1,
|
||||
#269 => -1,
|
||||
#270 => -1,
|
||||
#271 => -1,
|
||||
#272 => -1,
|
||||
#273 => -1,
|
||||
#274 => -1,
|
||||
#275 => -1,
|
||||
#276 => -1,
|
||||
#277 => -1,
|
||||
#278 => -1,
|
||||
#279 => -1,
|
||||
#280 => -1,
|
||||
#281 => -1,
|
||||
#282 => -1,
|
||||
#283 => -1,
|
||||
#284 => -1,
|
||||
#285 => -1,
|
||||
#286 => -1,
|
||||
#287 => -1,
|
||||
#288 => -1,
|
||||
#289 => -1,
|
||||
#290 => -1,
|
||||
#291 => -1,
|
||||
#292 => -1,
|
||||
#293 => -1,
|
||||
#294 => -1,
|
||||
#295 => -1,
|
||||
#296 => -1,
|
||||
#297 => -1,
|
||||
#298 => -1,
|
||||
#299 => -1,
|
||||
#300 => -1,
|
||||
#301 => -1,
|
||||
#302 => -1,
|
||||
#303 => -1,
|
||||
#304 => -1,
|
||||
#305 => -1,
|
||||
#306 => -1,
|
||||
#307 => -1,
|
||||
#308 => -1,
|
||||
#309 => -1,
|
||||
#310 => -1,
|
||||
#311 => -1,
|
||||
#312 => -1,
|
||||
#313 => -1,
|
||||
#314 => -1,
|
||||
#315 => -1,
|
||||
#316 => -1,
|
||||
#317 => -1,
|
||||
#318 => -1,
|
||||
#319 => -1,
|
||||
#320 => -1,
|
||||
#321 => -1,
|
||||
#322 => -1,
|
||||
#323 => -1,
|
||||
#324 => -1,
|
||||
#325 => -1,
|
||||
#326 => -1,
|
||||
#327 => -1,
|
||||
#328 => -1,
|
||||
#329 => -1,
|
||||
#330 => -1,
|
||||
#331 => -1,
|
||||
#332 => -1,
|
||||
#333 => -1,
|
||||
#334 => -1,
|
||||
#335 => -1,
|
||||
#336 => -1,
|
||||
#337 => -1,
|
||||
#338 => -1,
|
||||
#339 => -1,
|
||||
#340 => -1,
|
||||
#341 => -1,
|
||||
342 => 50,
|
||||
#343 => -1,
|
||||
#344 => -1,
|
||||
#345 => -1,
|
||||
#346 => -1,
|
||||
#347 => -1,
|
||||
#348 => -1,
|
||||
#349 => -1,
|
||||
#350 => -1,
|
||||
#351 => -1,
|
||||
#352 => -1,
|
||||
#353 => -1,
|
||||
#354 => -1,
|
||||
#355 => -1,
|
||||
#356 => -1,
|
||||
#357 => -1,
|
||||
#358 => -1,
|
||||
#359 => -1,
|
||||
#360 => -1,
|
||||
#361 => -1,
|
||||
#362 => -1,
|
||||
#363 => -1,
|
||||
#364 => -1,
|
||||
#365 => -1,
|
||||
#366 => -1,
|
||||
#367 => -1,
|
||||
#368 => -1,
|
||||
#369 => -1,
|
||||
#370 => -1,
|
||||
#371 => -1,
|
||||
#372 => -1,
|
||||
#373 => -1,
|
||||
#374 => -1,
|
||||
#375 => -1,
|
||||
#376 => -1,
|
||||
#377 => -1,
|
||||
#378 => -1,
|
||||
#379 => -1,
|
||||
#380 => -1,
|
||||
#381 => -1,
|
||||
#382 => -1,
|
||||
#383 => -1,
|
||||
#384 => -1,
|
||||
#385 => -1,
|
||||
#386 => -1,
|
||||
#387 => -1,
|
||||
#388 => -1,
|
||||
#389 => -1,
|
||||
#390 => -1,
|
||||
#391 => -1,
|
||||
#392 => -1,
|
||||
#393 => -1,
|
||||
#394 => -1,
|
||||
#395 => -1,
|
||||
#396 => -1,
|
||||
#397 => -1,
|
||||
#398 => -1,
|
||||
#399 => -1,
|
||||
#400 => -1,
|
||||
#401 => -1,
|
||||
#402 => -1,
|
||||
#403 => -1,
|
||||
#404 => -1,
|
||||
#405 => -1,
|
||||
#406 => -1,
|
||||
#407 => -1,
|
||||
#408 => -1,
|
||||
#409 => -1,
|
||||
#410 => -1,
|
||||
#411 => -1,
|
||||
#412 => -1,
|
||||
#413 => -1,
|
||||
#414 => -1,
|
||||
#415 => -1,
|
||||
#416 => -1,
|
||||
#417 => -1,
|
||||
#418 => -1,
|
||||
#419 => -1,
|
||||
#420 => -1,
|
||||
}
|
||||
1167
Data/Scripts/050_AddOns/k_scriptsUtils.rb
Normal file
1167
Data/Scripts/050_AddOns/k_scriptsUtils.rb
Normal file
File diff suppressed because it is too large
Load Diff
518
Data/Scripts/050_AddOns/mapExporter2.rb
Normal file
518
Data/Scripts/050_AddOns/mapExporter2.rb
Normal file
@@ -0,0 +1,518 @@
|
||||
|
||||
def exportAllMaps
|
||||
for id in 725..768
|
||||
begin
|
||||
MapExporter.export(id, [:Events])
|
||||
rescue
|
||||
echo "error in " +(id.to_s) +"\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
module MapExporter
|
||||
@@map = nil
|
||||
@@bitmap = nil
|
||||
@@helper = nil
|
||||
|
||||
module_function
|
||||
|
||||
def export(map_id, options)
|
||||
map_name = pbGetMapNameFromId(map_id)
|
||||
begin
|
||||
@@map = $MapFactory.getMapForExport(map_id)
|
||||
rescue
|
||||
error("Map #{map_id} (#{map_name}) could not be loaded.")
|
||||
end
|
||||
@@bitmap = Bitmap.new(@@map.width * Game_Map::TILE_HEIGHT, @@map.height * Game_Map::TILE_WIDTH)
|
||||
@@helper = TileDrawingHelper.fromTileset($data_tilesets[@@map.tileset_id])
|
||||
set_map_options(options)
|
||||
if options.include?(:Panorama)
|
||||
if !nil_or_empty?(@@map.panorama_name)
|
||||
draw_panorama
|
||||
else
|
||||
echoln "Map #{map_id} (#{map_name}) doesn't have a Panorama."
|
||||
end
|
||||
end
|
||||
draw_reflective_tiles
|
||||
draw_all_reflections(options)
|
||||
draw_regular_tiles
|
||||
if !draw_all_events(options)
|
||||
draw_low_priority_tiles
|
||||
end
|
||||
draw_high_priority_tiles
|
||||
draw_all_top_events(options)
|
||||
if options.include?(:Fog)
|
||||
if nil_or_empty?(@@map.fog_name)
|
||||
echoln "Map #{map_id} (#{map_name}) doesn't have a Fog."
|
||||
else
|
||||
draw_fog
|
||||
end
|
||||
end
|
||||
draw_watermark(options)
|
||||
save_map_image
|
||||
end
|
||||
|
||||
def draw_all_events(options)
|
||||
include_player = options.include?(:Player) && $game_map.map_id == @@map.map_id
|
||||
include_dep = options.include?(:DependentEvents) && $game_map.map_id == @@map.map_id
|
||||
include_event = true#options.include?(:Events)
|
||||
return false if !(include_player || include_dep || include_event)
|
||||
for y in 0...@@map.height
|
||||
for x in 0...@@map.width
|
||||
event = nil
|
||||
if include_event
|
||||
event_hash = @@map.events.select {|_,e| e.x == x && e.y == y && !e.always_on_top }
|
||||
event = event_hash.values.first if !event_hash.empty?
|
||||
end
|
||||
event = $game_player if !event && include_player && $game_player.x == x && $game_player.y == y && !$game_player.always_on_top
|
||||
if include_dep
|
||||
$PokemonTemp.dependentEvents.realEvents.each do |e|
|
||||
next if !e || e.x != x || e.y != y
|
||||
event = e
|
||||
break
|
||||
end
|
||||
end
|
||||
if event
|
||||
deep_bush = @@map.bush?(x, y)
|
||||
draw_event_bitmap(event, deep_bush)
|
||||
end
|
||||
for z in 0..2
|
||||
tile_id = @@map.data[x, y, z] || 0
|
||||
priority = @@map.priorities[tile_id]
|
||||
next if priority != 1
|
||||
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
|
||||
next if !tag_data || tag_data.shows_reflections
|
||||
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def draw_all_top_events(options)
|
||||
include_player = options.include?(:Player) && $game_map.map_id == @@map.map_id
|
||||
include_event = options.include?(:Events)
|
||||
return false if !(include_player || include_event)
|
||||
for y in 0...@@map.height
|
||||
for x in 0...@@map.width
|
||||
event = nil
|
||||
if include_event
|
||||
event_hash = @@map.events.select {|_,e| e.x == x && e.y == y && e.always_on_top }
|
||||
event = event_hash.values.first if !event_hash.empty?
|
||||
end
|
||||
event = $game_player if !event && include_player && $game_player.x == x && $game_player.y == y && $game_player.always_on_top
|
||||
if event
|
||||
deep_bush = @@map.bush?(x, y)
|
||||
draw_event_bitmap(event, deep_bush)
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def draw_all_reflections(options)
|
||||
include_player = options.include?(:Player) && $game_map.map_id == @@map.map_id
|
||||
include_dep = options.include?(:DependentEvents) && $game_map.map_id == @@map.map_id
|
||||
include_event = options.include?(:Events)
|
||||
return false if !(include_player || include_dep || include_event)
|
||||
for y in 0...@@map.height
|
||||
for x in 0...@@map.width
|
||||
dep = false
|
||||
event = nil
|
||||
if include_event
|
||||
event_hash = @@map.events.select {|_,e| e.x == x && e.y == y }
|
||||
event = event_hash.values.first if !event_hash.empty?
|
||||
end
|
||||
event = $game_player if !event && include_player && $game_player.x == x && $game_player.y == y
|
||||
if include_dep && !event
|
||||
$PokemonTemp.dependentEvents.realEvents.each do |e|
|
||||
next if !e || e.x != x || e.y != y
|
||||
event = e
|
||||
dep = true
|
||||
break
|
||||
end
|
||||
end
|
||||
draw_event_reflection(event, dep) if event
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def draw_reflective_tiles
|
||||
for y in 0...@@map.height
|
||||
for x in 0...@@map.width
|
||||
for z in 0..2
|
||||
tile_id = @@map.data[x, y, z] || 0
|
||||
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
|
||||
next if !tag_data || !tag_data.shows_reflections
|
||||
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def draw_regular_tiles
|
||||
for y in 0...@@map.height
|
||||
for x in 0...@@map.width
|
||||
for z in 0..2
|
||||
tile_id = @@map.data[x, y, z] || 0
|
||||
priority = @@map.priorities[tile_id]
|
||||
next if priority >= 1
|
||||
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
|
||||
next if !tag_data || tag_data.shows_reflections
|
||||
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def draw_low_priority_tiles
|
||||
for y in 0...@@map.height
|
||||
for x in 0...@@map.width
|
||||
for z in 0..2
|
||||
tile_id = @@map.data[x, y, z] || 0
|
||||
priority = @@map.priorities[tile_id]
|
||||
next unless priority == 1
|
||||
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
|
||||
next if !tag_data || tag_data.shows_reflections
|
||||
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def draw_high_priority_tiles
|
||||
for y in 0...@@map.height
|
||||
for x in 0...@@map.width
|
||||
for z in 0..2
|
||||
tile_id = @@map.data[x, y, z] || 0
|
||||
priority = @@map.priorities[tile_id]
|
||||
next if priority < 2
|
||||
tag_data = GameData::TerrainTag.try_get(@@map.terrain_tags[tile_id])
|
||||
next if !tag_data || tag_data.shows_reflections
|
||||
@@helper.bltTile(@@bitmap, x * Game_Map::TILE_WIDTH, y * Game_Map::TILE_HEIGHT, tile_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def draw_event_bitmap(event, deep_bush)
|
||||
hued = false
|
||||
tile_bmp = false
|
||||
if event.tile_id >= 384
|
||||
bmp = pbGetTileBitmap(@@map.tileset_name, event.tile_id, event.character_hue, event.width, event.height)
|
||||
hued = true
|
||||
tile_bmp = true
|
||||
elsif deep_bush
|
||||
event.calculate_bush_depth
|
||||
temp_bmp = AnimatedBitmap.new("Graphics/Characters/" + "#{event.character_name}", event.character_hue)
|
||||
bushmap = BushBitmap.new(temp_bmp, false, event.bush_depth)
|
||||
bmp = bushmap.bitmap.clone
|
||||
bushmap.dispose
|
||||
temp_bmp.dispose
|
||||
hued = true
|
||||
else
|
||||
bmp = RPG::Cache.load_bitmap("Graphics/Characters/", "#{event.character_name}") rescue Bitmap.new(32,32)
|
||||
end
|
||||
if bmp
|
||||
bmp = bmp.clone
|
||||
bmp.hue_change(event.character_hue) if event.character_hue != 0 && !hued
|
||||
final_x = (event.x * Game_Map::TILE_WIDTH) + ((event.width * Game_Map::TILE_WIDTH)/2) - bmp.width / 8
|
||||
final_y = (event.y + 1) * Game_Map::TILE_HEIGHT - bmp.height / 4 + (event.bob_height)
|
||||
final_y += 16 if event.character_name[/offset/i]
|
||||
draw_event_shadow(event) if defined?(OWShadowSettings)
|
||||
draw_surf_base(event) if event == $game_player
|
||||
if !tile_bmp
|
||||
ex = (bmp.width/4) * event.pattern
|
||||
ey = (bmp.height/4) * (event.direction/2 - 1)
|
||||
rect = Rect.new(ex, ey, bmp.width / 4, bmp.height / 4)
|
||||
else
|
||||
final_x += (bmp.width/8 - ((event.width * Game_Map::TILE_WIDTH)/2))
|
||||
final_y += (bmp.height/4) - (Game_Map::TILE_HEIGHT * event.height)
|
||||
rect = Rect.new(0, 0, bmp.width, bmp.height)
|
||||
end
|
||||
@@bitmap.blt(final_x, final_y, bmp, rect, event.opacity)
|
||||
bmp.dispose
|
||||
end
|
||||
bmp = nil
|
||||
end
|
||||
|
||||
def draw_event_shadow(event)
|
||||
if OWShadowSettings::CASE_SENSITIVE_BLACKLISTS
|
||||
remove = true if OWShadowSettings::SHADOWLESS_CHARACTER_NAME.any?{|e| event.character_name[/#{e}/]}
|
||||
remove = true if event != $game_player && OWShadowSettings::SHADOWLESS_EVENT_NAME.any? {|e| event.name[/#{e}/]}
|
||||
else
|
||||
remove = true if OWShadowSettings::SHADOWLESS_CHARACTER_NAME.any?{|e| event.character_name[/#{e}/i]}
|
||||
remove = true if event != $game_player && OWShadowSettings::SHADOWLESS_EVENT_NAME.any? {|e| event.name[/#{e}/i]}
|
||||
end
|
||||
terrain = @@map.terrain_tag(event.x, event.y)
|
||||
remove = true if OWShadowSettings::SHADOWLESS_TERRAIN_NAME.any? {|e| terrain == e} if terrain
|
||||
if !(nil_or_empty?(event.character_name) || event.transparent || remove)
|
||||
if event == $game_player
|
||||
shadow_name = OWShadowSettings::PLAYER_SHADOW_FILENAME
|
||||
else
|
||||
shadow_name = $~[1] if event.name[/shdw\((.*?)\)/]
|
||||
end
|
||||
shadow_name = OWShadowSettings::DEFAULT_SHADOW_FILENAME if nil_or_empty?(shadow_name)
|
||||
shadow_bmp = RPG::Cache.load_bitmap("Graphics/Characters/Shadows/", "#{shadow_name}")
|
||||
shadow_x = (event.x * Game_Map::TILE_WIDTH) + ((event.width * Game_Map::TILE_WIDTH)/2) - shadow_bmp.width/2
|
||||
shadow_y = (event.y + 1) * Game_Map::TILE_HEIGHT - shadow_bmp.height + 2
|
||||
@@bitmap.blt(shadow_x, shadow_y, shadow_bmp, Rect.new(0, 0, shadow_bmp.width, shadow_bmp.height), event.opacity)
|
||||
shadow_bmp.dispose
|
||||
end
|
||||
end
|
||||
|
||||
def draw_event_reflection(event, forced = true)
|
||||
tile_bmp = false
|
||||
if event.tile_id >= 384
|
||||
bmp = pbGetTileBitmap(@@map.tileset_name, event.tile_id, event.character_hue, event.width, event.height)
|
||||
tile_bmp = true
|
||||
else
|
||||
bmp = RPG::Cache.load_bitmap("Graphics/Characters/", "#{event.character_name}") rescue Bitmap.new(32,32)
|
||||
end
|
||||
if bmp
|
||||
bmp = bmp.clone
|
||||
bmp.hue_change(event.character_hue) if event.character_hue != 0 && !tile_bmp
|
||||
height = nil
|
||||
fixed = false
|
||||
if event == $game_player || forced
|
||||
height = $PokemonGlobal.bridge
|
||||
elsif event.name[/reflection/i]
|
||||
height = 0
|
||||
if event.name[/reflection\((\d+)\)/i]
|
||||
height = $~[1].to_i || 0
|
||||
else
|
||||
height = $PokemonGlobal.bridge
|
||||
end
|
||||
end
|
||||
if height
|
||||
final_x = (event.x * Game_Map::TILE_WIDTH) + ((event.width * Game_Map::TILE_WIDTH)/2) - bmp.width/8
|
||||
final_y = (event.y + 1) * Game_Map::TILE_HEIGHT - 3 - (event.bob_height)
|
||||
final_y -= 32 if event.character_name[/offset/i]
|
||||
if !tile_bmp
|
||||
ex = (bmp.width/4) * event.pattern
|
||||
ey = (bmp.height/4) * (event.direction/2 - 1)
|
||||
rect = Rect.new(ex, ey, bmp.width/4, bmp.height/4)
|
||||
else
|
||||
final_x += (bmp.width/8 - ((event.width * Game_Map::TILE_WIDTH)/2))
|
||||
rect = Rect.new(0, 0, bmp.width, bmp.height)
|
||||
end
|
||||
if height > 0
|
||||
new_bmp = colorize_and_flip_bitmap(bmp, Color.new(48,96,160), 255, rect)
|
||||
opacity = event.opacity
|
||||
else
|
||||
new_bmp = colorize_and_flip_bitmap(bmp, Color.new(224,224,224), 96, rect)
|
||||
opacity = event.opacity*3/4
|
||||
end
|
||||
offset = [1.0, 0.95, 1.0, 1.05][(Graphics.frame_count%40)/10]
|
||||
@@bitmap.stretch_blt(Rect.new(final_x, final_y, (new_bmp.width * offset), new_bmp.height), new_bmp, Rect.new(0, 0, new_bmp.width, new_bmp.height), opacity)
|
||||
new_bmp.dispose
|
||||
end
|
||||
bmp.dispose
|
||||
end
|
||||
bmp = nil
|
||||
end
|
||||
|
||||
def draw_surf_base(event)
|
||||
return if !$PokemonGlobal.surfing && !$PokemonGlobal.diving
|
||||
bmp = nil
|
||||
if $PokemonGlobal.surfing
|
||||
bmp = RPG::Cache.load_bitmap("Graphics/Characters/", "base_surf") rescue Bitmap.new(32,32)
|
||||
elsif $PokemonGlobal.diving
|
||||
bmp = RPG::Cache.load_bitmap("Graphics/Characters/", "base_dive") rescue Bitmap.new(32,32)
|
||||
end
|
||||
return if !bmp
|
||||
sx = event.pattern_surf * bmp.width/4
|
||||
sy = ((event.direction - 2)/2) * bmp.height/4
|
||||
final_x = (event.x * Game_Map::TILE_WIDTH) + ((event.width * Game_Map::TILE_WIDTH)/2) - bmp.width/8
|
||||
final_y = (event.y + 1) * Game_Map::TILE_HEIGHT - bmp.height / 4 + 16 + (event.bob_height)
|
||||
@@bitmap.blt(final_x, final_y, bmp, Rect.new(sx,sy, bmp.width/4, bmp.height/4), event.opacity)
|
||||
end
|
||||
|
||||
def draw_fog
|
||||
fog_bmp = create_tiled_bitmap("Graphics/Fogs/#{@@map.fog_name}", @@map.fog_hue, @@map.fog_zoom/100.0)
|
||||
@@bitmap.blt(0, 0, fog_bmp, Rect.new(0, 0, fog_bmp.width, fog_bmp.height), @@map.fog_opacity)
|
||||
fog_bmp.dispose
|
||||
end
|
||||
|
||||
def draw_panorama
|
||||
pan_bmp = create_tiled_bitmap("Graphics/Panoramas/#{@@map.panorama_name}", @@map.panorama_hue)
|
||||
@@bitmap.blt(0, 0, pan_bmp, Rect.new(0, 0, pan_bmp.width, pan_bmp.height))
|
||||
pan_bmp.dispose
|
||||
end
|
||||
|
||||
def draw_watermark(options)
|
||||
return if !options.include?(:GameName) && !options.include?(:MapName)
|
||||
map_name = nil_or_empty?(@@map.name)? pbGetMapNameFromId(@@map.map_id) : @@map.name
|
||||
game_name = System.game_title
|
||||
base_color = Color.new(248, 248, 248)
|
||||
shadow_color = Color.new(64, 64, 64)
|
||||
new_bmp = Bitmap.new(@@bitmap.width, @@bitmap.height)
|
||||
if options.include?(:GameName)
|
||||
if options.include?(:MapName)
|
||||
pbSetSmallFont(new_bmp)
|
||||
else
|
||||
pbSetSystemFont(new_bmp)
|
||||
end
|
||||
pbDrawTextPositions(new_bmp, [[game_name, new_bmp.width - 8, new_bmp.height - 32, 1, base_color, shadow_color, true]])
|
||||
new_font = (@@bitmap.text_size(map_name).height + 6)
|
||||
else
|
||||
new_font = 0
|
||||
end
|
||||
if options.include?(:MapName)
|
||||
pbSetSystemFont(new_bmp)
|
||||
pbDrawTextPositions(new_bmp, [[map_name, new_bmp.width - 8, new_bmp.height - new_font - 38, 1, base_color, shadow_color, true]])
|
||||
end
|
||||
scale_factor = get_name_scale
|
||||
x = @@bitmap.width - (new_bmp.width * scale_factor) - (8 * (scale_factor - 1))
|
||||
y = @@bitmap.height - (new_bmp.height * scale_factor) - (8 * (scale_factor - 1))
|
||||
rect = Rect.new(x, y, (new_bmp.width * scale_factor), (new_bmp.height * scale_factor))
|
||||
@@bitmap.stretch_blt(rect, new_bmp, Rect.new(0, 0, new_bmp.width, new_bmp.height))
|
||||
new_bmp.dispose
|
||||
end
|
||||
|
||||
def save_map_image
|
||||
Dir.mkdir("Exported Maps/") if !safeExists?("Exported Maps/")
|
||||
filestart = Time.now.strftime("[%Y-%m-%d %H-%M]")
|
||||
map_name = nil_or_empty?(@@map.name)? pbGetMapNameFromId(@@map.map_id) : @@map.name
|
||||
filename = sprintf("%03d - #{map_name} #{filestart}", @@map.map_id)
|
||||
min_exists = 0
|
||||
if safeExists?("Exported Maps/" + filename + ".png")
|
||||
min_exists = 1
|
||||
loop do
|
||||
break if !safeExists?("Exported Maps/" + "#{filename}(#{min_exists})" + ".png")
|
||||
min_exists += 1
|
||||
end
|
||||
end
|
||||
filename = "#{filename}(#{min_exists})" if min_exists > 0
|
||||
@@bitmap.to_file("Exported Maps/" + filename + ".png")
|
||||
@@bitmap.dispose
|
||||
@@bitmap = nil
|
||||
@@map = nil
|
||||
@@helper = nil
|
||||
end
|
||||
|
||||
def create_tiled_bitmap(filename, hue, zoom = 1.0)
|
||||
begin
|
||||
bmp = RPG::Cache.load_bitmap("", filename)
|
||||
rescue
|
||||
error("Could not load image file at #{filename}")
|
||||
end
|
||||
new_bmp = Bitmap.new(@@map.width * Game_Map::TILE_HEIGHT, @@map.height * Game_Map::TILE_WIDTH)
|
||||
i = 0
|
||||
while i <= new_bmp.width
|
||||
j = 0
|
||||
while j <= new_bmp.height
|
||||
new_bmp.stretch_blt(Rect.new(i, j, (bmp.width * zoom), (bmp.height * zoom)), bmp, Rect.new(0, 0, bmp.width, bmp.height))
|
||||
j += (bmp.height * zoom)
|
||||
end
|
||||
i += (bmp.width * zoom)
|
||||
end
|
||||
bmp.dispose
|
||||
new_bmp.hue_change(hue)
|
||||
return new_bmp
|
||||
end
|
||||
|
||||
def get_name_scale
|
||||
scale = @@map.width/3
|
||||
d = [0, -1 , -2, 2, 1, 0, -1, -2, 2, 1][scale%10]
|
||||
scale = (scale + d)/10.0
|
||||
return (scale < 1.0) ? 1.0 : scale
|
||||
end
|
||||
|
||||
def colorize_and_flip_bitmap(bitmap, color, alpha = 255, rect = nil)
|
||||
blankcolor = bitmap.get_pixel(0,0)
|
||||
new_bmp = Bitmap.new(rect.width, rect.height)
|
||||
temp_bmp = Bitmap.new(rect.width, rect.height)
|
||||
temp_bmp.blt(0, 0, bitmap, rect)
|
||||
for x in 0...temp_bmp.width
|
||||
for y2 in 0...temp_bmp.height
|
||||
y = temp_bmp.height - y2
|
||||
newcolor = temp_bmp.get_pixel(x, y2)
|
||||
new_bmp.set_pixel(x, y, newcolor) if newcolor
|
||||
end
|
||||
end
|
||||
temp_bmp.dispose
|
||||
shadowcolor = (color ? color : blankcolor)
|
||||
colorlayer = Bitmap.new(new_bmp.width, new_bmp.height)
|
||||
colorlayer.fill_rect(colorlayer.rect, shadowcolor)
|
||||
new_bmp.blt(0, 0, colorlayer, colorlayer.rect, alpha)
|
||||
shadowcolor = new_bmp.get_pixel(0,0)
|
||||
for x in 0...new_bmp.width
|
||||
for y in 0...new_bmp.height
|
||||
if new_bmp.get_pixel(x,y) == shadowcolor
|
||||
new_bmp.set_pixel(x, y, blankcolor)
|
||||
end
|
||||
end
|
||||
end
|
||||
colorlayer.dispose
|
||||
return new_bmp
|
||||
end
|
||||
|
||||
def set_map_options(options)
|
||||
return if !options.include?(:Panorama) && !options.include?(:Fog)
|
||||
@@map.events.each do |key, event|
|
||||
for page in event.event.pages.reverse
|
||||
c = page.condition
|
||||
next if c.switch1_valid && !event.switchIsOn?(c.switch1_id)
|
||||
next if c.switch2_valid && !event.switchIsOn?(c.switch2_id)
|
||||
next if c.variable_valid && $game_variables[c.variable_id] < c.variable_value
|
||||
if c.self_switch_valid
|
||||
key = [event.map_id, event.id, c.self_switch_ch]
|
||||
next if $game_self_switches[key] != true
|
||||
end
|
||||
page.list.each do |command|
|
||||
if command.code == 204
|
||||
case command.parameters[0]
|
||||
when 0
|
||||
next if !options.include?(:Panorama)
|
||||
@@map.panorama_name = command.parameters[1] if !nil_or_empty?(@@map.panorama_name)
|
||||
@@map.panorama_hue = command.parameters[2] if @@map.panorama_hue <= 0
|
||||
when 1
|
||||
next if !options.include?(:Fog)
|
||||
@@map.fog_name = command.parameters[1] if nil_or_empty?(@@map.fog_name)
|
||||
@@map.fog_hue = command.parameters[2] if @@map.fog_hue <= 0
|
||||
@@map.fog_opacity = command.parameters[3] if @@map.fog_opacity < command.parameters[3]
|
||||
@@map.fog_zoom = command.parameters[5]
|
||||
end
|
||||
elsif command.code == 205
|
||||
next if !options.include?(:Fog)
|
||||
@@map.fog_tone = command.parameters[0]
|
||||
elsif command.code == 206
|
||||
next if !options.include?(:Fog)
|
||||
@@map.fog_opacity = command.parameters[0] if command.parameters[0] != 0
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def error(message)
|
||||
emessage = "Map Exporter EX Error:\n\n" + message
|
||||
print(_INTL(emessage))
|
||||
exit!
|
||||
end
|
||||
end
|
||||
|
||||
class Game_Map
|
||||
def tileset_id; return @map.tileset_id; end
|
||||
end
|
||||
|
||||
class DependentEvents
|
||||
attr_accessor :realEvents
|
||||
end
|
||||
|
||||
class Game_Character
|
||||
attr_reader :event
|
||||
attr_reader :always_on_top
|
||||
end
|
||||
|
||||
class PokemonMapFactory
|
||||
def getMapForExport(id)
|
||||
map = Game_Map.new
|
||||
map.setup(id)
|
||||
return map
|
||||
end
|
||||
end
|
||||
74
Data/Scripts/050_AddOns/mapExporter2_ui.rb
Normal file
74
Data/Scripts/050_AddOns/mapExporter2_ui.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
# DebugMenuCommands.register("exportmap", {
|
||||
# "parent" => "fieldmenu",
|
||||
# "name" => _INTL("Export Map Image"),
|
||||
# "description" => _INTL("Select a map and save its image as a png."),
|
||||
# "effect" => proc {
|
||||
# pbExportMapSelection
|
||||
# }
|
||||
# })
|
||||
#
|
||||
# def pbExportMapSelection
|
||||
# loop do
|
||||
# map_id = pbListScreen(_INTL("Export Map"), MapLister.new(pbDefaultMap))
|
||||
# break if map_id <= 0
|
||||
# commands = ["Events", "Player", "Dependent Events", "Fog", "Panorama", "Map Name", "Game Name"]
|
||||
# if $game_map.map_id != map_id
|
||||
# commands.delete("Player")
|
||||
# commands.delete("Dependent Events")
|
||||
# end
|
||||
# options = pbShowMapExportOptions(commands)
|
||||
# if !options.include?(:Cancel)
|
||||
# ret = MapExporter.export(map_id, options)
|
||||
# mapname = pbGetMapNameFromId(map_id)
|
||||
# pbMessage(_INTL("Sucessfully exported map image of Map {1} ({2}) to the Exported Maps folder in the games's root.", map_id, mapname))
|
||||
# return
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def pbShowMapExportOptions(commands)
|
||||
# sel_commands = []
|
||||
# sym_commands = [:MapName, :GameName]
|
||||
# cmdwindow = Window_CommandPokemonEx.new([])
|
||||
# cmdwindow.z = 99999
|
||||
# cmdwindow.visible = true
|
||||
# cmdwindow.index = 0
|
||||
# need_refresh = true
|
||||
# loop do
|
||||
# if need_refresh
|
||||
# sel_commands = []
|
||||
# commands.each_with_index do |s, i|
|
||||
# cmd_sym = s.gsub(/\s+/, "").to_sym
|
||||
# x = sym_commands.include?(cmd_sym) ? "[x]" : "[ ]"
|
||||
# sel_commands.push(_INTL("{1} {2}",x, s))
|
||||
# end
|
||||
# sel_commands.push("Export Map...")
|
||||
# cmdwindow.commands = sel_commands
|
||||
# cmdwindow.resizeToFit(cmdwindow.commands)
|
||||
# need_refresh = false
|
||||
# end
|
||||
# Graphics.update
|
||||
# Input.update
|
||||
# cmdwindow.update
|
||||
# yield if block_given?
|
||||
# if Input.trigger?(Input::USE)
|
||||
# break if cmdwindow.index == sel_commands.length - 1
|
||||
# cmd_sym = commands[cmdwindow.index].gsub(/\s+/, "").to_sym
|
||||
# if sym_commands.include?(cmd_sym)
|
||||
# sym_commands.delete(cmd_sym)
|
||||
# else
|
||||
# sym_commands.push(cmd_sym)
|
||||
# end
|
||||
# sym_commands.uniq!
|
||||
# need_refresh = true
|
||||
# elsif Input.trigger?(Input::BACK)
|
||||
# sym_commands = [:Cancel]
|
||||
# break
|
||||
# end
|
||||
# pbUpdateSceneMap
|
||||
# end
|
||||
# cmdwindow.dispose
|
||||
# Input.update
|
||||
# return sym_commands
|
||||
# end
|
||||
Reference in New Issue
Block a user