mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-25 10:25:08 +00:00
Compare commits
3 Commits
b412ad7b39
...
bbd5ba09ea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbd5ba09ea | ||
|
|
90c0e51e88 | ||
|
|
85d5f6206c |
@@ -2,28 +2,28 @@
|
|||||||
#
|
#
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
class TilemapRenderer
|
class TilemapRenderer
|
||||||
attr_reader :tilesets
|
attr_reader :tilesets
|
||||||
attr_reader :autotiles
|
attr_reader :autotiles
|
||||||
attr_accessor :tone
|
attr_accessor :tone
|
||||||
attr_accessor :color
|
attr_accessor :color
|
||||||
attr_reader :viewport
|
attr_reader :viewport
|
||||||
attr_accessor :ox # Does nothing
|
attr_accessor :ox # Does nothing
|
||||||
attr_accessor :oy # Does nothing
|
attr_accessor :oy # Does nothing
|
||||||
attr_accessor :visible # Does nothing
|
attr_accessor :visible # Does nothing
|
||||||
|
|
||||||
DISPLAY_TILE_WIDTH = Game_Map::TILE_WIDTH rescue 32
|
DISPLAY_TILE_WIDTH = Game_Map::TILE_WIDTH rescue 32
|
||||||
DISPLAY_TILE_HEIGHT = Game_Map::TILE_HEIGHT rescue 32
|
DISPLAY_TILE_HEIGHT = Game_Map::TILE_HEIGHT rescue 32
|
||||||
SOURCE_TILE_WIDTH = 32
|
SOURCE_TILE_WIDTH = 32
|
||||||
SOURCE_TILE_HEIGHT = 32
|
SOURCE_TILE_HEIGHT = 32
|
||||||
ZOOM_X = DISPLAY_TILE_WIDTH / SOURCE_TILE_WIDTH
|
ZOOM_X = DISPLAY_TILE_WIDTH / SOURCE_TILE_WIDTH
|
||||||
ZOOM_Y = DISPLAY_TILE_HEIGHT / SOURCE_TILE_HEIGHT
|
ZOOM_Y = DISPLAY_TILE_HEIGHT / SOURCE_TILE_HEIGHT
|
||||||
TILESET_TILES_PER_ROW = 8
|
TILESET_TILES_PER_ROW = 8
|
||||||
AUTOTILES_COUNT = 8 # Counting the blank tile as an autotile
|
AUTOTILES_COUNT = 8 # Counting the blank tile as an autotile
|
||||||
TILES_PER_AUTOTILE = 48
|
TILES_PER_AUTOTILE = 48
|
||||||
TILESET_START_ID = AUTOTILES_COUNT * TILES_PER_AUTOTILE
|
TILESET_START_ID = AUTOTILES_COUNT * TILES_PER_AUTOTILE
|
||||||
# If an autotile's filename ends with "[x]", its frame duration will be x/20
|
# If an autotile's filename ends with "[x]", its frame duration will be x/20
|
||||||
# seconds instead.
|
# seconds instead.
|
||||||
AUTOTILE_FRAME_DURATION = 5 # In 1/20ths of a second
|
AUTOTILE_FRAME_DURATION = 5 # In 1/20ths of a second
|
||||||
|
|
||||||
# Filenames of extra autotiles for each tileset. Each tileset's entry is an
|
# Filenames of extra autotiles for each tileset. Each tileset's entry is an
|
||||||
# array containing two other arrays (you can leave either of those empty, but
|
# array containing two other arrays (you can leave either of those empty, but
|
||||||
@@ -38,10 +38,10 @@ class TilemapRenderer
|
|||||||
# Extra autotiles are only useful if the tiles are animated, because otherwise
|
# Extra autotiles are only useful if the tiles are animated, because otherwise
|
||||||
# you just have some tiles which belong in the tileset instead.
|
# you just have some tiles which belong in the tileset instead.
|
||||||
EXTRA_AUTOTILES = {
|
EXTRA_AUTOTILES = {
|
||||||
# Examples:
|
# Examples:
|
||||||
# 1 => [["Sand shore"], ["Flowers2"]],
|
# 1 => [["Sand shore"], ["Flowers2"]],
|
||||||
# 2 => [[], ["Flowers2", "Waterfall", "Waterfall crest", "Waterfall bottom"]],
|
# 2 => [[], ["Flowers2", "Waterfall", "Waterfall crest", "Waterfall bottom"]],
|
||||||
# 6 => [["Water rock", "Sea deep"], []]
|
# 6 => [["Water rock", "Sea deep"], []]
|
||||||
}
|
}
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
@@ -52,11 +52,11 @@ class TilemapRenderer
|
|||||||
attr_accessor :bitmaps
|
attr_accessor :bitmaps
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@bitmaps = {}
|
@bitmaps = {}
|
||||||
@bitmap_wraps = {} # Whether each tileset is a mega texture and has multiple columns
|
@bitmap_wraps = {} # Whether each tileset is a mega texture and has multiple columns
|
||||||
@load_counts = {}
|
@load_counts = {}
|
||||||
@bridge = 0
|
@bridge = 0
|
||||||
@changed = true
|
@changed = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](filename)
|
def [](filename)
|
||||||
@@ -124,10 +124,10 @@ class TilemapRenderer
|
|||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@frame_counts = {} # Number of frames in each autotile
|
@frame_counts = {} # Number of frames in each autotile
|
||||||
@frame_durations = {} # How long each frame lasts per autotile
|
@frame_durations = {} # How long each frame lasts per autotile
|
||||||
@current_frames = {} # Which frame each autotile is currently showing
|
@current_frames = {} # Which frame each autotile is currently showing
|
||||||
@timer_start = System.uptime
|
@timer_start = System.uptime
|
||||||
end
|
end
|
||||||
|
|
||||||
def []=(filename, value)
|
def []=(filename, value)
|
||||||
@@ -137,25 +137,49 @@ class TilemapRenderer
|
|||||||
set_current_frame(filename)
|
set_current_frame(filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
EXPANDED_AUTOTILES_FOLDER = "Graphics/Autotiles/ExpandedAutotiles/"
|
||||||
|
|
||||||
def add(filename)
|
def add(filename)
|
||||||
return if nil_or_empty?(filename)
|
return if nil_or_empty?(filename)
|
||||||
if @bitmaps[filename]
|
if @bitmaps[filename]
|
||||||
@load_counts[filename] += 1
|
@load_counts[filename] += 1
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
orig_bitmap = pbGetAutotile(filename)
|
|
||||||
@bitmap_wraps[filename] = false
|
# Try to load expanded autotile from cache first
|
||||||
duration = AUTOTILE_FRAME_DURATION
|
cached_path = File.join("Graphics", "Autotiles/ExpandedAutotiles", "#{filename}.png")
|
||||||
if filename[/\[\s*(\d+?)\s*\]\s*$/]
|
if FileTest.exist?(cached_path)
|
||||||
duration = $~[1].to_i
|
echoln "Loading cached expanded autotile for #{filename}"
|
||||||
|
bitmap = RPG::Cache.load_bitmap(EXPANDED_AUTOTILES_FOLDER, filename)
|
||||||
|
|
||||||
|
duration = AUTOTILE_FRAME_DURATION
|
||||||
|
if filename[/\[\s*(\d+?)\s*\]\s*$/]
|
||||||
|
duration = $~[1].to_i
|
||||||
|
end
|
||||||
|
@frame_durations[filename] = duration.to_f / 20
|
||||||
|
|
||||||
|
else
|
||||||
|
orig_bitmap = pbGetAutotile(filename)
|
||||||
|
@bitmap_wraps[filename] = false
|
||||||
|
duration = AUTOTILE_FRAME_DURATION
|
||||||
|
if filename[/\[\s*(\d+?)\s*\]\s*$/]
|
||||||
|
duration = $~[1].to_i
|
||||||
|
end
|
||||||
|
@frame_durations[filename] = duration.to_f / 20
|
||||||
|
expanded_bitmap = AutotileExpander.expand(orig_bitmap)
|
||||||
|
|
||||||
|
# Save expanded bitmap to cache for next time
|
||||||
|
Dir.mkdir(EXPANDED_AUTOTILES_FOLDER) unless Dir.exist?(EXPANDED_AUTOTILES_FOLDER)
|
||||||
|
expanded_bitmap.save_to_png(cached_path)
|
||||||
|
|
||||||
|
bitmap = expanded_bitmap
|
||||||
|
orig_bitmap.dispose if orig_bitmap != expanded_bitmap
|
||||||
end
|
end
|
||||||
@frame_durations[filename] = duration.to_f / 20
|
|
||||||
bitmap = AutotileExpander.expand(orig_bitmap)
|
|
||||||
self[filename] = bitmap
|
self[filename] = bitmap
|
||||||
if bitmap.height > SOURCE_TILE_HEIGHT && bitmap.height < TILES_PER_AUTOTILE * SOURCE_TILE_HEIGHT
|
if bitmap.height > SOURCE_TILE_HEIGHT && bitmap.height < TILES_PER_AUTOTILE * SOURCE_TILE_HEIGHT
|
||||||
@bitmap_wraps[filename] = true
|
@bitmap_wraps[filename] = true
|
||||||
end
|
end
|
||||||
orig_bitmap.dispose if orig_bitmap != bitmap
|
|
||||||
@load_counts[filename] = 1
|
@load_counts[filename] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -243,57 +267,57 @@ class TilemapRenderer
|
|||||||
attr_accessor :need_refresh
|
attr_accessor :need_refresh
|
||||||
|
|
||||||
def set_bitmap(filename, tile_id, autotile, animated, priority, bitmap)
|
def set_bitmap(filename, tile_id, autotile, animated, priority, bitmap)
|
||||||
self.bitmap = bitmap
|
self.bitmap = bitmap
|
||||||
self.src_rect = Rect.new(0, 0, SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT)
|
self.src_rect = Rect.new(0, 0, SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT)
|
||||||
self.zoom_x = ZOOM_X
|
self.zoom_x = ZOOM_X
|
||||||
self.zoom_y = ZOOM_Y
|
self.zoom_y = ZOOM_Y
|
||||||
@filename = filename
|
@filename = filename
|
||||||
@tile_id = tile_id
|
@tile_id = tile_id
|
||||||
@is_autotile = autotile
|
@is_autotile = autotile
|
||||||
@animated = animated
|
@animated = animated
|
||||||
@priority = priority
|
@priority = priority
|
||||||
@shows_reflection = false
|
@shows_reflection = false
|
||||||
@bridge = false
|
@bridge = false
|
||||||
self.visible = !bitmap.nil?
|
self.visible = !bitmap.nil?
|
||||||
@need_refresh = true
|
@need_refresh = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
def initialize(viewport)
|
def initialize(viewport)
|
||||||
@tilesets = TilesetBitmaps.new
|
@tilesets = TilesetBitmaps.new
|
||||||
@autotiles = AutotileBitmaps.new
|
@autotiles = AutotileBitmaps.new
|
||||||
@tiles_horizontal_count = (Graphics.width.to_f / DISPLAY_TILE_WIDTH).ceil + 1
|
@tiles_horizontal_count = (Graphics.width.to_f / DISPLAY_TILE_WIDTH).ceil + 1
|
||||||
@tiles_vertical_count = (Graphics.height.to_f / DISPLAY_TILE_HEIGHT).ceil + 1
|
@tiles_vertical_count = (Graphics.height.to_f / DISPLAY_TILE_HEIGHT).ceil + 1
|
||||||
@tone = Tone.new(0, 0, 0, 0)
|
@tone = Tone.new(0, 0, 0, 0)
|
||||||
@old_tone = Tone.new(0, 0, 0, 0)
|
@old_tone = Tone.new(0, 0, 0, 0)
|
||||||
@color = Color.new(0, 0, 0, 0)
|
@color = Color.new(0, 0, 0, 0)
|
||||||
@old_color = Color.new(0, 0, 0, 0)
|
@old_color = Color.new(0, 0, 0, 0)
|
||||||
@self_viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
@self_viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@viewport = (viewport) ? viewport : @self_viewport
|
@viewport = (viewport) ? viewport : @self_viewport
|
||||||
@old_viewport_ox = 0
|
@old_viewport_ox = 0
|
||||||
@old_viewport_oy = 0
|
@old_viewport_oy = 0
|
||||||
# NOTE: The extra tiles horizontally/vertically hang off the left and top
|
# NOTE: The extra tiles horizontally/vertically hang off the left and top
|
||||||
# edges of the screen, because the pixel_offset values are positive
|
# edges of the screen, because the pixel_offset values are positive
|
||||||
# and are added to the tile sprite coordinates.
|
# and are added to the tile sprite coordinates.
|
||||||
@tiles = []
|
@tiles = []
|
||||||
@tiles_horizontal_count.times do |i|
|
@tiles_horizontal_count.times do |i|
|
||||||
@tiles[i] = []
|
@tiles[i] = []
|
||||||
@tiles_vertical_count.times do |j|
|
@tiles_vertical_count.times do |j|
|
||||||
@tiles[i][j] = Array.new(3) { TileSprite.new(@viewport) }
|
@tiles[i][j] = Array.new(3) { TileSprite.new(@viewport) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@current_map_id = 0
|
@current_map_id = 0
|
||||||
@tile_offset_x = 0
|
@tile_offset_x = 0
|
||||||
@tile_offset_y = 0
|
@tile_offset_y = 0
|
||||||
@pixel_offset_x = 0
|
@pixel_offset_x = 0
|
||||||
@pixel_offset_y = 0
|
@pixel_offset_y = 0
|
||||||
@ox = 0
|
@ox = 0
|
||||||
@oy = 0
|
@oy = 0
|
||||||
@visible = true
|
@visible = true
|
||||||
@need_refresh = true
|
@need_refresh = true
|
||||||
@disposed = false
|
@disposed = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def dispose
|
def dispose
|
||||||
@@ -361,7 +385,7 @@ class TilemapRenderer
|
|||||||
if tile_id < TILES_PER_AUTOTILE
|
if tile_id < TILES_PER_AUTOTILE
|
||||||
tile.set_bitmap("", tile_id, false, false, 0, nil)
|
tile.set_bitmap("", tile_id, false, false, 0, nil)
|
||||||
tile.shows_reflection = false
|
tile.shows_reflection = false
|
||||||
tile.bridge = false
|
tile.bridge = false
|
||||||
else
|
else
|
||||||
terrain_tag = map.terrain_tags[tile_id] || 0
|
terrain_tag = map.terrain_tags[tile_id] || 0
|
||||||
terrain_tag_data = GameData::TerrainTag.try_get(terrain_tag)
|
terrain_tag_data = GameData::TerrainTag.try_get(terrain_tag)
|
||||||
@@ -378,11 +402,12 @@ class TilemapRenderer
|
|||||||
end
|
end
|
||||||
if tile_id < true_tileset_start_id
|
if tile_id < true_tileset_start_id
|
||||||
filename = ""
|
filename = ""
|
||||||
if tile_id < TILESET_START_ID # Real autotiles
|
if tile_id < TILESET_START_ID # Real autotiles
|
||||||
filename = map.autotile_names[(tile_id / TILES_PER_AUTOTILE) - 1]
|
filename = map.autotile_names[(tile_id / TILES_PER_AUTOTILE) - 1]
|
||||||
elsif tile_id < single_autotile_start_id # Large extra autotiles
|
elsif tile_id < single_autotile_start_id # Large extra autotiles
|
||||||
filename = extra_autotile_arrays[0][(tile_id - TILESET_START_ID) / TILES_PER_AUTOTILE]
|
filename = extra_autotile_arrays[0][(tile_id - TILESET_START_ID) / TILES_PER_AUTOTILE]
|
||||||
else # Single extra autotiles
|
else
|
||||||
|
# Single extra autotiles
|
||||||
filename = extra_autotile_arrays[1][tile_id - single_autotile_start_id]
|
filename = extra_autotile_arrays[1][tile_id - single_autotile_start_id]
|
||||||
end
|
end
|
||||||
tile.set_bitmap(filename, tile_id, true, @autotiles.animated?(filename),
|
tile.set_bitmap(filename, tile_id, true, @autotiles.animated?(filename),
|
||||||
@@ -392,7 +417,7 @@ class TilemapRenderer
|
|||||||
tile.set_bitmap(filename, tile_id, false, false, priority, @tilesets[filename])
|
tile.set_bitmap(filename, tile_id, false, false, priority, @tilesets[filename])
|
||||||
end
|
end
|
||||||
tile.shows_reflection = terrain_tag_data&.shows_reflections
|
tile.shows_reflection = terrain_tag_data&.shows_reflections
|
||||||
tile.bridge = terrain_tag_data&.bridge
|
tile.bridge = terrain_tag_data&.bridge
|
||||||
end
|
end
|
||||||
refresh_tile_src_rect(tile, tile_id)
|
refresh_tile_src_rect(tile, tile_id)
|
||||||
end
|
end
|
||||||
@@ -447,7 +472,7 @@ class TilemapRenderer
|
|||||||
@tile_offset_x -= offsets[0]
|
@tile_offset_x -= offsets[0]
|
||||||
@tile_offset_y -= offsets[1]
|
@tile_offset_y -= offsets[1]
|
||||||
else
|
else
|
||||||
ret = true # Need a full refresh
|
ret = true # Need a full refresh
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ret = true
|
ret = true
|
||||||
@@ -556,7 +581,7 @@ class TilemapRenderer
|
|||||||
@screen_moved_vertically = false
|
@screen_moved_vertically = false
|
||||||
if $PokemonGlobal.bridge != @bridge
|
if $PokemonGlobal.bridge != @bridge
|
||||||
@bridge = $PokemonGlobal.bridge
|
@bridge = $PokemonGlobal.bridge
|
||||||
@screen_moved_vertically = true # To update bridge tiles' z values
|
@screen_moved_vertically = true # To update bridge tiles' z values
|
||||||
end
|
end
|
||||||
do_full_refresh = true if check_if_screen_moved
|
do_full_refresh = true if check_if_screen_moved
|
||||||
# Update all tile sprites
|
# Update all tile sprites
|
||||||
@@ -609,7 +634,7 @@ class TilemapRenderer
|
|||||||
coord.each do |tile|
|
coord.each do |tile|
|
||||||
tile.set_bitmap("", 0, false, false, 0, nil)
|
tile.set_bitmap("", 0, false, false, 0, nil)
|
||||||
tile.shows_reflection = false
|
tile.shows_reflection = false
|
||||||
tile.bridge = false
|
tile.bridge = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
1291
Data/Scripts/997_AddOns/MarinUtilities.rb
Normal file
1291
Data/Scripts/997_AddOns/MarinUtilities.rb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,98 @@
|
|||||||
|
class TilemapRenderer
|
||||||
|
alias original_tilemapRenderer_initialize initialize
|
||||||
|
def initialize(viewport)
|
||||||
|
original_tilemapRenderer_initialize(viewport)
|
||||||
|
@custom_autotile_ids = {} # key: tile_id, value: filename
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# Examples:
|
||||||
|
# 1 => [["Sand shore"], ["Flowers2"]],
|
||||||
|
# 2 => [[], ["Flowers2", "Waterfall", "Waterfall crest", "Waterfall bottom"]],
|
||||||
|
# 6 => [["Water rock", "Sea deep"], []]
|
||||||
|
EXTRA_AUTOTILES = {
|
||||||
|
1 => { #route-field
|
||||||
|
996 => "flowers_orange[10]",
|
||||||
|
991 => "flowers_pink[10]",
|
||||||
|
999 => "flowers_yellow[10]",
|
||||||
|
1007 => "flowers_blue[10]",
|
||||||
|
1015 => "flowers_purple[10]",
|
||||||
|
1023 => "flowers_red[10]",
|
||||||
|
1031 => "flowers_grey[10]",
|
||||||
|
1039 => "flowers_white[10]",
|
||||||
|
},
|
||||||
|
2 => { #small-town
|
||||||
|
996 => "flowers_orange[10]",
|
||||||
|
991 => "flowers_pink[10]",
|
||||||
|
999 => "flowers_yellow[10]",
|
||||||
|
1007 => "flowers_blue[10]",
|
||||||
|
1015 => "flowers_purple[10]",
|
||||||
|
1023 => "flowers_red[10]",
|
||||||
|
1031 => "flowers_grey[10]",
|
||||||
|
1039 => "flowers_white[10]",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def add_extra_autotiles(tileset_id)
|
||||||
|
overrides = EXTRA_AUTOTILES[tileset_id]
|
||||||
|
return unless overrides
|
||||||
|
overrides.each do |tile_id, filename|
|
||||||
|
@autotiles.add(filename)
|
||||||
|
@custom_autotile_ids[tile_id] = filename
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove_extra_autotiles(tileset_id)
|
||||||
|
return if !EXTRA_AUTOTILES[tileset_id]
|
||||||
|
EXTRA_AUTOTILES[tileset_id].each do |arr|
|
||||||
|
arr.each { |filename| remove_autotile(filename) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def refresh_tile_bitmap(tile, map, tile_id)
|
||||||
|
tile.tile_id = tile_id
|
||||||
|
if tile_id < TILES_PER_AUTOTILE
|
||||||
|
tile.set_bitmap("", tile_id, false, false, 0, nil)
|
||||||
|
tile.shows_reflection = false
|
||||||
|
tile.bridge = false
|
||||||
|
else
|
||||||
|
terrain_tag = map.terrain_tags[tile_id] || 0
|
||||||
|
terrain_tag_data = GameData::TerrainTag.try_get(terrain_tag)
|
||||||
|
priority = map.priorities[tile_id] || 0
|
||||||
|
single_autotile_start_id = TILESET_START_ID
|
||||||
|
true_tileset_start_id = TILESET_START_ID
|
||||||
|
|
||||||
|
filename = nil
|
||||||
|
extra_autotile_hash = EXTRA_AUTOTILES[map.tileset_id]
|
||||||
|
|
||||||
|
if extra_autotile_hash && extra_autotile_hash[tile_id]
|
||||||
|
# Custom tile_id override
|
||||||
|
filename = extra_autotile_hash[tile_id]
|
||||||
|
tile.set_bitmap(filename, tile_id, true, @autotiles.animated?(filename),
|
||||||
|
priority, @autotiles[filename])
|
||||||
|
elsif tile_id < true_tileset_start_id
|
||||||
|
# Default behavior
|
||||||
|
if tile_id < TILESET_START_ID # Real autotiles
|
||||||
|
filename = map.autotile_names[(tile_id / TILES_PER_AUTOTILE) - 1]
|
||||||
|
elsif tile_id < single_autotile_start_id # Large extra autotiles
|
||||||
|
filename = extra_autotile_arrays[0][(tile_id - TILESET_START_ID) / TILES_PER_AUTOTILE]
|
||||||
|
else
|
||||||
|
# Single extra autotiles
|
||||||
|
filename = extra_autotile_arrays[1][tile_id - single_autotile_start_id]
|
||||||
|
end
|
||||||
|
tile.set_bitmap(filename, tile_id, true, @autotiles.animated?(filename),
|
||||||
|
priority, @autotiles[filename])
|
||||||
|
else
|
||||||
|
filename = map.tileset_name
|
||||||
|
tile.set_bitmap(filename, tile_id, false, false, priority, @tilesets[filename])
|
||||||
|
end
|
||||||
|
|
||||||
|
tile.shows_reflection = terrain_tag_data&.shows_reflections
|
||||||
|
tile.bridge = terrain_tag_data&.bridge
|
||||||
|
end
|
||||||
|
refresh_tile_src_rect(tile, tile_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
|
||||||
|
#TODO
|
||||||
|
|
||||||
|
# attr_accessor :quicksurf
|
||||||
|
# attr_accessor :level_caps
|
||||||
|
# attr_accessor :battle_type
|
||||||
|
# attr_accessor :download_sprites
|
||||||
|
# attr_accessor :speedup
|
||||||
|
# attr_accessor :speedup_speed
|
||||||
|
# attr_accessor :max_nb_sprites_download
|
||||||
|
# attr_accessor :on_mobile
|
||||||
|
# attr_accessor :type_icons
|
||||||
|
# attr_accessor :use_generated_dex_entries
|
||||||
|
# attr_accessor :use_custom_eggs
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# #===============================================================================#
|
||||||
|
# # Options menu handlers
|
||||||
|
# #===============================================================================#
|
||||||
|
# MenuHandlers.add(:options_menu, :only_speedup_battles, {
|
||||||
|
# "name" => _INTL("Speed Up Settings"),
|
||||||
|
# "order" => 25,
|
||||||
|
# "type" => EnumOption,
|
||||||
|
# "parameters" => [_INTL("Always"), _INTL("Only Battles")],
|
||||||
|
# "description" => _INTL("Choose which aspect is sped up."),
|
||||||
|
# "get_proc" => proc { next $PokemonSystem.only_speedup_battles },
|
||||||
|
# "set_proc" => proc { |value, scene|
|
||||||
|
# $GameSpeed = 0 if value != $PokemonSystem.only_speedup_battles
|
||||||
|
# $PokemonSystem.only_speedup_battles = value
|
||||||
|
# $CanToggle = value == 0
|
||||||
|
# }
|
||||||
|
# })
|
||||||
|
#
|
||||||
|
# MenuHandlers.add(:options_menu, :speedup_type, {
|
||||||
|
# "name" => _INTL("Speed-up type"),
|
||||||
|
# "order" => 25,
|
||||||
|
# "type" => EnumOption,
|
||||||
|
# "parameters" => [_INTL("Hold"), _INTL("Toggle")],
|
||||||
|
# "description" => _INTL("Pick how you want speed-up to be enabled."),
|
||||||
|
# "get_proc" => proc { next $PokemonSystem.speedup_type },
|
||||||
|
# "set_proc" => proc { |value, scene|
|
||||||
|
# $PokemonSystem.speedup_type = value
|
||||||
|
# }
|
||||||
|
# })
|
||||||
|
#
|
||||||
|
# MenuHandlers.add(:options_menu, :speedup_speed, {
|
||||||
|
# "name" => _INTL("Speed-up speed"),
|
||||||
|
# "order" => 27,
|
||||||
|
# "type" => SliderOption,
|
||||||
|
# "parameters" => [0, 10, 0.5], # [minimum_value, maximum_value, interval]
|
||||||
|
# "description" => _INTL("Sets by how much to speed up the game."),
|
||||||
|
# "get_proc" => proc { next $PokemonSystem.speedup_speed },
|
||||||
|
# "set_proc" => proc { |value, scene|
|
||||||
|
# next if $PokemonSystem.speedup_speed == value
|
||||||
|
# $PokemonSystem.speedup_speed = value
|
||||||
|
# }
|
||||||
|
# })# frozen_string_literal: true
|
||||||
|
#
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class PokemonSystem
|
||||||
|
attr_accessor :quicksurf
|
||||||
|
attr_accessor :level_caps
|
||||||
|
attr_accessor :battle_type
|
||||||
|
attr_accessor :download_sprites
|
||||||
|
attr_accessor :speedup
|
||||||
|
attr_accessor :speedup_speed
|
||||||
|
attr_accessor :max_nb_sprites_download
|
||||||
|
attr_accessor :on_mobile
|
||||||
|
attr_accessor :type_icons
|
||||||
|
attr_accessor :use_generated_dex_entries
|
||||||
|
attr_accessor :use_custom_eggs
|
||||||
|
|
||||||
|
unless method_defined?(:initialize_with_new_options)
|
||||||
|
alias_method :initialize_with_new_options, :initialize
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
initialize_with_new_options
|
||||||
|
@quicksurf = 0
|
||||||
|
@battle_type = 0
|
||||||
|
@download_sprites = 0
|
||||||
|
@max_nb_sprites_download = 5
|
||||||
|
@on_mobile = false
|
||||||
|
@type_icons = true
|
||||||
|
@use_generated_dex_entries = true
|
||||||
|
@use_custom_eggs = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -21,20 +21,6 @@ $GameSpeed = 0
|
|||||||
$CanToggle = true
|
$CanToggle = true
|
||||||
$RefreshEventsForTurbo = false
|
$RefreshEventsForTurbo = false
|
||||||
#===============================================================================#
|
#===============================================================================#
|
||||||
# Set $CanToggle depending on the saved setting
|
|
||||||
#===============================================================================#
|
|
||||||
module Game
|
|
||||||
class << self
|
|
||||||
alias_method :original_load, :load unless method_defined?(:original_load)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.load(save_data)
|
|
||||||
original_load(save_data)
|
|
||||||
# echoln "UNSCALED #{System.unscaled_uptime} * #{SPEEDUP_STAGES[$GameSpeed]} - #{$GameSpeed}"
|
|
||||||
$CanToggle = true #$PokemonSystem.only_speedup_battles == 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
#===============================================================================#
|
|
||||||
# Handle incrementing speed stages if $CanToggle allows it
|
# Handle incrementing speed stages if $CanToggle allows it
|
||||||
#===============================================================================#
|
#===============================================================================#
|
||||||
module Input
|
module Input
|
||||||
@@ -238,7 +224,6 @@ end
|
|||||||
# PokemonSystem Accessors
|
# PokemonSystem Accessors
|
||||||
#===============================================================================#
|
#===============================================================================#
|
||||||
class PokemonSystem
|
class PokemonSystem
|
||||||
alias_method :original_initialize, :initialize unless method_defined?(:original_initialize)
|
|
||||||
attr_accessor :only_speedup_battles
|
attr_accessor :only_speedup_battles
|
||||||
attr_accessor :battle_speed
|
attr_accessor :battle_speed
|
||||||
|
|
||||||
@@ -246,8 +231,9 @@ class PokemonSystem
|
|||||||
attr_accessor :speedup_speed
|
attr_accessor :speedup_speed
|
||||||
attr_accessor :speedup_enabled
|
attr_accessor :speedup_enabled
|
||||||
|
|
||||||
|
alias_method :original_initialize_forSpeedup, :initialize unless method_defined?(:original_initialize_forSpeedup)
|
||||||
def initialize
|
def initialize
|
||||||
original_initialize
|
original_initialize_forSpeedup
|
||||||
@only_speedup_battles = 0 # Speed up setting (0=always, 1=battle_only)
|
@only_speedup_battles = 0 # Speed up setting (0=always, 1=battle_only)
|
||||||
@battle_speed = 0 # Depends on the SPEEDUP_STAGES array size
|
@battle_speed = 0 # Depends on the SPEEDUP_STAGES array size
|
||||||
@speedup_type = SPEED_UP_TYPE_HOLD
|
@speedup_type = SPEED_UP_TYPE_HOLD
|
||||||
|
|||||||
@@ -13,11 +13,8 @@ module Game
|
|||||||
end
|
end
|
||||||
|
|
||||||
def onLoadSaveFile
|
def onLoadSaveFile
|
||||||
# Essentials 21 renamed the global variable $Trainer
|
initializeGlobalVariables
|
||||||
# It's still used everywhere in events, global events so this makes things simpler
|
copyOldGlobalVariables()
|
||||||
$Trainer = $player
|
|
||||||
$PokemonBag = $bag
|
|
||||||
|
|
||||||
migrateOldSavesToCharacterCustomization()
|
migrateOldSavesToCharacterCustomization()
|
||||||
clear_all_images()
|
clear_all_images()
|
||||||
loadDateSpecificChanges()
|
loadDateSpecificChanges()
|
||||||
@@ -26,6 +23,19 @@ module Game
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def initializeGlobalVariables()
|
||||||
|
$CanToggle = true #$PokemonSystem.only_speedup_battles == 0
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# Essentials 21 renamed the global variable $Trainer
|
||||||
|
# It's still used everywhere in events, global events
|
||||||
|
# so this is a little hack to prevent all the old stuff
|
||||||
|
# from breaking
|
||||||
|
def copyOldGlobalVariables()
|
||||||
|
$Trainer = $player
|
||||||
|
$PokemonBag = $bag
|
||||||
|
end
|
||||||
|
|
||||||
def loadDateSpecificChanges()
|
def loadDateSpecificChanges()
|
||||||
current_date = Time.new
|
current_date = Time.new
|
||||||
|
|||||||
187
Data/Scripts/998_InfiniteFusion/System/UtilityMethods.rb
Normal file
187
Data/Scripts/998_InfiniteFusion/System/UtilityMethods.rb
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
|
||||||
|
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 !customSpriteExistsSpecies(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_pokes_with_non_custom_final_evos(includeOnlyNextEvos=true)
|
||||||
|
outfile = "nonCustomFinals.csv"
|
||||||
|
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]
|
||||||
|
isFinalEvo = GameData::Species.get(evoSpecies).get_evolutions.empty?
|
||||||
|
if !customSpriteExistsSpecies(evoSpecies) && !alreadyWritten.include?(evoSpecies) && isFinalEvo
|
||||||
|
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 !customSpriteExistsSpecies(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
|
||||||
Binary file not shown.
Reference in New Issue
Block a user