mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
town map
This commit is contained in:
@@ -105,7 +105,7 @@ module Settings
|
|||||||
POISON_IN_FIELD = (MECHANICS_GENERATION <= 4)
|
POISON_IN_FIELD = (MECHANICS_GENERATION <= 4)
|
||||||
# Whether poisoned Pokémon will faint while walking around in the field
|
# Whether poisoned Pokémon will faint while walking around in the field
|
||||||
# (true), or survive the poisoning with 1 HP (false).
|
# (true), or survive the poisoning with 1 HP (false).
|
||||||
POISON_FAINT_IN_FIELD = (MECHANICS_GENERATION <= 3)
|
POISON_FAINT_IN_FIELD = (MECHANICS_GENERATION >= 3)
|
||||||
# Whether planted berries grow according to Gen 4 mechanics (true) or Gen 3
|
# Whether planted berries grow according to Gen 4 mechanics (true) or Gen 3
|
||||||
# mechanics (false).
|
# mechanics (false).
|
||||||
NEW_BERRY_PLANTS = (MECHANICS_GENERATION >= 4)
|
NEW_BERRY_PLANTS = (MECHANICS_GENERATION >= 4)
|
||||||
@@ -150,13 +150,15 @@ module Settings
|
|||||||
# To require at least 2 badges, put true and 2.
|
# To require at least 2 badges, put true and 2.
|
||||||
BADGE_FOR_CUT = 1
|
BADGE_FOR_CUT = 1
|
||||||
BADGE_FOR_FLASH = 2
|
BADGE_FOR_FLASH = 2
|
||||||
BADGE_FOR_ROCKSMASH = 3
|
BADGE_FOR_ROCKSMASH = 0
|
||||||
BADGE_FOR_SURF = 4
|
BADGE_FOR_SURF = 5
|
||||||
BADGE_FOR_FLY = 5
|
BADGE_FOR_FLY = 3
|
||||||
BADGE_FOR_STRENGTH = 6
|
BADGE_FOR_STRENGTH = 5
|
||||||
BADGE_FOR_DIVE = 7
|
BADGE_FOR_DIVE = 9
|
||||||
BADGE_FOR_WATERFALL = 8
|
BADGE_FOR_WATERFALL = 8
|
||||||
|
BADGE_FOR_TELEPORT = 3
|
||||||
|
BADGE_FOR_BOUNCE = 8
|
||||||
|
BADGE_FOR_ROCKCLIMB = 16
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
# If a move taught by a TM/HM/TR replaces another move, this setting is
|
# If a move taught by a TM/HM/TR replaces another move, this setting is
|
||||||
|
|||||||
@@ -1180,7 +1180,7 @@ class PokemonSummary_Scene
|
|||||||
if !@pokemon.egg?
|
if !@pokemon.egg?
|
||||||
commands[cmdGiveItem = commands.length] = _INTL("Give item")
|
commands[cmdGiveItem = commands.length] = _INTL("Give item")
|
||||||
commands[cmdTakeItem = commands.length] = _INTL("Take item") if @pokemon.hasItem?
|
commands[cmdTakeItem = commands.length] = _INTL("Take item") if @pokemon.hasItem?
|
||||||
commands[cmdPokedex = commands.length] = _INTL("View Pokédex") if $Trainer.has_pokedex
|
#commands[cmdPokedex = commands.length] = _INTL("View Pokédex") if $Trainer.has_pokedex
|
||||||
end
|
end
|
||||||
commands[cmdMark = commands.length] = _INTL("Mark")
|
commands[cmdMark = commands.length] = _INTL("Mark")
|
||||||
commands[commands.length] = _INTL("Cancel")
|
commands[commands.length] = _INTL("Cancel")
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ def pbWarpToMapId
|
|||||||
return [map_id,0,0]
|
return [map_id,0,0]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pbWarpToMapFly
|
||||||
|
pbBetterRegionMap(0,true,true,false,nil,true)
|
||||||
|
end
|
||||||
|
|
||||||
def pbWarpToMap
|
def pbWarpToMap
|
||||||
choice = pbMessage("type", [_INTL("List"),_INTL("Map id"), _INTL("Town map")], 0)
|
choice = pbMessage("type", [_INTL("List"),_INTL("Map id"), _INTL("Town map")], 0)
|
||||||
if choice == 0
|
if choice == 0
|
||||||
@@ -21,8 +25,7 @@ def pbWarpToMap
|
|||||||
elsif choice == 1
|
elsif choice == 1
|
||||||
map = pbWarpToMapId
|
map = pbWarpToMapId
|
||||||
elsif choice == 2
|
elsif choice == 2
|
||||||
Kernel.pbMessage("Not currently supported")
|
map = pbWarpToMapFly
|
||||||
map = pbWarpToMapList
|
|
||||||
end
|
end
|
||||||
return map
|
return map
|
||||||
end
|
end
|
||||||
|
|||||||
1291
Data/Scripts/049_Compatibility/MarinUtilities.rb
Normal file
1291
Data/Scripts/049_Compatibility/MarinUtilities.rb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -27,17 +27,17 @@ def get_egg_group_name(id)
|
|||||||
case id
|
case id
|
||||||
when 0 ;return nil
|
when 0 ;return nil
|
||||||
when 1;return "Monster Pokémon"
|
when 1;return "Monster Pokémon"
|
||||||
when 2;return :"Water Pokémon"
|
when 2;return :"Aquatic Pokémon"
|
||||||
when 3;return :"Bug Pokémon"
|
when 3;return :"Bug Pokémon"
|
||||||
when 4;return :"Bird Pokémon"
|
when 4;return :"Bird Pokémon"
|
||||||
when 5;return :"Land Pokémon"
|
when 5;return :"Land Pokémon"
|
||||||
when 6;return :"Cute Pokémon"
|
when 6;return :"Cute Pokémon"
|
||||||
when 7;return :"Plant Pokémon"
|
when 7;return :"Plant Pokémon"
|
||||||
when 8;return :"Human-like Pokémon"
|
when 8;return :"Human-like Pokémon"
|
||||||
when 9;return :"Water Pokémon"
|
when 9;return :"Aquatic Pokémon"
|
||||||
when 10;return :"Mineral Pokémon"
|
when 10;return :"Mineral Pokémon"
|
||||||
when 11;return :"Blob Pokémon"
|
when 11;return :"Blob Pokémon"
|
||||||
when 12;return :"Water Pokémon"
|
when 12;return :"Fish Pokémon"
|
||||||
when 13;return :"Ditto"
|
when 13;return :"Ditto"
|
||||||
when 14;return :"Dragon Pokémon"
|
when 14;return :"Dragon Pokémon"
|
||||||
when 15;return :"Legendary Pokémon"
|
when 15;return :"Legendary Pokémon"
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
=begin
|
|
||||||
|
|
||||||
|
|
||||||
#==============================================================================#
|
#==============================================================================#
|
||||||
# Better Region Map #
|
# Better Region Map #
|
||||||
# by Marin #
|
# By Marin, with edits by Boonzeet #
|
||||||
#==============================================================================#
|
#==============================================================================#
|
||||||
# This region map is smoother and allows you to use region maps larger than #
|
# This region map is smoother and allows you to use region maps larger than #
|
||||||
# 480x320. #
|
# 480x320. #
|
||||||
@@ -11,34 +8,33 @@
|
|||||||
# This resource also comes with a new townmapgen.html to support for the #
|
# This resource also comes with a new townmapgen.html to support for the #
|
||||||
# larger images. #
|
# larger images. #
|
||||||
#==============================================================================#
|
#==============================================================================#
|
||||||
# This region map does NOT support hidden islands such as Berth or Faraday. #
|
# This region map now supports hidden islands (e.g. Berth or Faraday). #
|
||||||
#==============================================================================#
|
#==============================================================================#
|
||||||
# Please give credit when using this. #
|
# Please give credit when using this. #
|
||||||
#==============================================================================#
|
#==============================================================================#
|
||||||
|
#
|
||||||
|
# PluginManager.register({
|
||||||
|
# :name => "Better Region Map",
|
||||||
|
# :version => "1.2",
|
||||||
|
# :credits => ["Marin", "Boonzeet"],
|
||||||
|
# :dependencies => "Marin's Scripting Utilities",
|
||||||
|
# :link => "https://reliccastle.com/resources/174/"
|
||||||
|
# })
|
||||||
|
|
||||||
def pbBetterRegionMap(region = nil, show_player = true, can_fly = false)
|
def pbBetterRegionMap(region = -1, show_player = true, can_fly = false, wallmap = false, species = nil,fly_anywhere=false)
|
||||||
|
scene = BetterRegionMap.new(region, show_player, can_fly, wallmap, species,fly_anywhere)
|
||||||
if region == nil
|
|
||||||
mapData = pbGetMetadata($game_map.map_id,MetadataMapPosition)
|
|
||||||
if mapData != nil && mapData.length >= 1
|
|
||||||
region = mapData[0]
|
|
||||||
else
|
|
||||||
region = 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
scene = BetterRegionMap.new(region, show_player, can_fly)
|
|
||||||
return scene.flydata
|
return scene.flydata
|
||||||
end
|
end
|
||||||
|
|
||||||
class PokemonGlobalMetadata
|
class PokemonGlobalMetadata
|
||||||
attr_writer :regionMapSel
|
attr_writer :regionMapSel
|
||||||
attr_writer :region
|
attr_writer :region
|
||||||
|
|
||||||
def regionMapSel
|
def regionMapSel
|
||||||
@regionMapSel ||= [0, 0]
|
@regionMapSel ||= [0, 0]
|
||||||
return @regionMapSel
|
return @regionMapSel
|
||||||
end
|
end
|
||||||
|
|
||||||
def region
|
def region
|
||||||
@region ||= 0
|
@region ||= 0
|
||||||
return @region
|
return @region
|
||||||
@@ -47,54 +43,60 @@ end
|
|||||||
|
|
||||||
class BetterRegionMap
|
class BetterRegionMap
|
||||||
CursorAnimateDelay = 12.0
|
CursorAnimateDelay = 12.0
|
||||||
CursorMoveSpeed = 4
|
CursorMoveSpeed = 4.0
|
||||||
TileWidth = 16.0
|
TileWidth = 16.0
|
||||||
TileHeight = 16.0
|
TileHeight = 16.0
|
||||||
MAP_MARGIN = 10
|
|
||||||
|
|
||||||
FlyPointAnimateDelay = 20.0
|
FlyPointAnimateDelay = 20.0
|
||||||
|
|
||||||
attr_reader :flydata
|
|
||||||
|
|
||||||
def initialize(region = nil, show_player = true, can_fly = false)
|
|
||||||
showBlk()
|
|
||||||
@region = 0#region || $PokemonGlobal.region
|
|
||||||
@show_player = show_player
|
|
||||||
@can_fly = can_fly
|
|
||||||
@data = load_data('Data/townmap.dat')[@region]
|
|
||||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
|
||||||
@viewport.z = 99999
|
|
||||||
@mapvp = Viewport.new(16,32,480,320)
|
|
||||||
|
|
||||||
|
attr_reader :flydata
|
||||||
|
|
||||||
|
def initialize(region = -1, show_player = true, can_fly = false, wallmap = false, species = nil,fly_anywhere=false)
|
||||||
|
showBlk
|
||||||
|
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||||
|
playerpos = $game_map ? map_metadata.town_map_position : nil#pbGetMetadata($game_map.map_id, MetadataMapPosition) : nil
|
||||||
|
if playerpos == nil
|
||||||
|
playerpos = [0,0]
|
||||||
|
end
|
||||||
|
@fly_anywhere = fly_anywhere
|
||||||
|
@region = (region < 0) ? playerpos[0] : region
|
||||||
|
@species = species
|
||||||
|
@show_player = (show_player && playerpos[0] == @region)
|
||||||
|
@can_fly = can_fly
|
||||||
|
@data = load_data("Data/town_map.dat")[@region]
|
||||||
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
|
@viewport.z = 99999
|
||||||
|
@mapdata = pbLoadTownMapData
|
||||||
|
@mapvp = Viewport.new(16, 32, 480, 320)
|
||||||
@mapvp.z = 100000
|
@mapvp.z = 100000
|
||||||
@viewport2 = Viewport.new(0,0,Graphics.width,Graphics.height)
|
@mapoverlayvp = Viewport.new(16,32,480,320)
|
||||||
|
@mapoverlayvp.z = 100001
|
||||||
|
@viewport2 = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@viewport2.z = 100001
|
@viewport2.z = 100001
|
||||||
@sprites = SpriteHash.new
|
@sprites = SpriteHash.new
|
||||||
@sprites["bg"] = Sprite.new(@viewport)
|
@sprites["bg"] = Sprite.new(@viewport)
|
||||||
@sprites["bg"].bmp("Graphics/Pictures/mapbg")
|
@sprites["bg"].bmp("Graphics/Pictures/mapbg")
|
||||||
@window = SpriteHash.new
|
@window = SpriteHash.new
|
||||||
|
|
||||||
@window["map"] = Sprite.new(@mapvp)
|
@window["map"] = Sprite.new(@mapvp)
|
||||||
@window["map"].bmp("Graphics/Pictures/#{@data[1]}")
|
@window["map"].bmp("Graphics/Pictures/#{@data[1]}")
|
||||||
|
# for hidden in REGION_MAP_EXTRAS
|
||||||
|
# if hidden[0] == @region && ((wallmap && hidden[5]) || # always show if looking at wall map, irrespective of switch
|
||||||
@sprites["cursor"] = Sprite.new(@viewport2)
|
# (!wallmap && hidden[1] > 0 && $game_switches[hidden[1]]))
|
||||||
@sprites["cursor"].bmp("Graphics/Pictures/mapCursor")
|
# if !@window["map2"]
|
||||||
@sprites["cursor"].src_rect.width = @sprites["cursor"].bmp.height
|
# @window["map2"] = BitmapSprite.new(480,320,@mapoverlayvp)
|
||||||
@sprites["cursor"].x = 16 + TileWidth * $PokemonGlobal.regionMapSel[0]
|
# end
|
||||||
@sprites["cursor"].y = 32 + TileHeight * $PokemonGlobal.regionMapSel[1]
|
# pbDrawImagePositions(@window["map2"].bitmap, [
|
||||||
|
# ["Graphics/Pictures/#{hidden[4]}", hidden[2] * TileWidth, hidden[3] * TileHeight, 0, 0, -1, -1],
|
||||||
@sprites["cursor"].z = 11
|
# ])
|
||||||
@sprites["cursor"].ox = (@sprites["cursor"].bmp.height - TileWidth) / 2.0
|
# end
|
||||||
@sprites["cursor"].oy = @sprites["cursor"].ox
|
# end
|
||||||
|
@window["player"] = Sprite.new(@mapoverlayvp)
|
||||||
|
|
||||||
@window["player"] = Sprite.new(@mapvp)
|
|
||||||
|
|
||||||
if @show_player
|
if @show_player
|
||||||
player = nil
|
player = nil
|
||||||
player = pbGetMetadata($game_map.map_id, MetadataMapPosition) if $game_map
|
player = GameData::MapMetadata.get($game_map.map_id).town_map_position #pbGetMetadata($game_map.map_id, MetadataMapPosition) if $game_map
|
||||||
if player && player[0] == @region
|
if player && player[0] == @region
|
||||||
|
$PokemonGlobal.regionMapSel[0] = player[1]
|
||||||
|
$PokemonGlobal.regionMapSel[1] = player[2]
|
||||||
gender = $Trainer.gender.to_digits(3)
|
gender = $Trainer.gender.to_digits(3)
|
||||||
@window["player"].bmp("Graphics/Pictures/mapPlayer#{gender}")
|
@window["player"].bmp("Graphics/Pictures/mapPlayer#{gender}")
|
||||||
@window["player"].x = TileWidth * player[1] + (TileWidth / 2.0)
|
@window["player"].x = TileWidth * player[1] + (TileWidth / 2.0)
|
||||||
@@ -102,6 +104,89 @@ class BetterRegionMap
|
|||||||
@window["player"].center_origins
|
@window["player"].center_origins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@window["areahighlight"] = BitmapSprite.new(@window["map"].bitmap.width,@window["map"].bitmap.height,@mapoverlayvp)
|
||||||
|
@window["areahighlight"].y = -8
|
||||||
|
# pokedex highlights
|
||||||
|
if @species != nil
|
||||||
|
@window["areahighlight"].bitmap.clear
|
||||||
|
# Fill the array "points" with all squares of the region map in which the
|
||||||
|
# species can be found
|
||||||
|
|
||||||
|
mapwidth = @window["map"].bitmap.width/BetterRegionMap::TileWidth
|
||||||
|
data = calculatePointsAndCenter(mapwidth)
|
||||||
|
|
||||||
|
points = data[0]
|
||||||
|
minxy = data[1]
|
||||||
|
maxxy = data[2]
|
||||||
|
|
||||||
|
# Draw coloured squares on each square of the region map with a nest
|
||||||
|
pointcolor = Color.new(0,248,248)
|
||||||
|
pointcolorhl = Color.new(192,248,248)
|
||||||
|
|
||||||
|
sqwidth = TileWidth.round
|
||||||
|
sqheight = TileHeight.round
|
||||||
|
|
||||||
|
for j in 0...points.length
|
||||||
|
if points[j]
|
||||||
|
x = (j % mapwidth) * sqwidth
|
||||||
|
y = (j / mapwidth) * sqheight
|
||||||
|
@window["areahighlight"].bitmap.fill_rect(x, y, sqwidth, sqheight, pointcolor)
|
||||||
|
if j - mapwidth < 0 || !points[j - mapwidth]
|
||||||
|
@window["areahighlight"].bitmap.fill_rect(x, y - 2, sqwidth, 2, pointcolorhl)
|
||||||
|
end
|
||||||
|
if j + mapwidth >= points.length || !points[j + mapwidth]
|
||||||
|
@window["areahighlight"].bitmap.fill_rect(x, y + sqheight, sqwidth, 2, pointcolorhl)
|
||||||
|
end
|
||||||
|
if j % mapwidth == 0 || !points[j - 1]
|
||||||
|
@window["areahighlight"].bitmap.fill_rect(x - 2, y, 2, sqheight, pointcolorhl)
|
||||||
|
end
|
||||||
|
if (j + 1) % mapwidth == 0 || !points[j + 1]
|
||||||
|
@window["areahighlight"].bitmap.fill_rect(x + sqwidth, y, 2, sqheight, pointcolorhl)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@sprites["cursor"] = Sprite.new(@viewport2)
|
||||||
|
@sprites["cursor"].bmp("Graphics/Pictures/mapCursor")
|
||||||
|
@sprites["cursor"].src_rect.width = @sprites["cursor"].bmp.height
|
||||||
|
|
||||||
|
if !$PokemonGlobal.regionMapSel
|
||||||
|
$PokemonGlobal.regionMapSel = [0,0]
|
||||||
|
end
|
||||||
|
if @species != nil && minxy[0] != nil && maxxy[1] != nil
|
||||||
|
$PokemonGlobal.regionMapSel[0] = ((minxy[0] + maxxy[0]) / 2).round
|
||||||
|
$PokemonGlobal.regionMapSel[1] = ((minxy[1] + maxxy[1]) / 2).round
|
||||||
|
end
|
||||||
|
|
||||||
|
@sprites["cursor"].x = 16 + TileWidth * $PokemonGlobal.regionMapSel[0]
|
||||||
|
@sprites["cursor"].y = 32 + TileHeight * $PokemonGlobal.regionMapSel[1]
|
||||||
|
|
||||||
|
@sprites["cursor"].z = 11
|
||||||
|
|
||||||
|
# Center the window on the cursor
|
||||||
|
windowminx = -1 * (@window["map"].bmp.width - Settings::SCREEN_WIDTH)
|
||||||
|
windowminx = 0 if windowminx > 0
|
||||||
|
windowminy = -1 * (@window["map"].bmp.height - Settings::SCREEN_HEIGHT)
|
||||||
|
windowminy = 0 if windowminy > 0
|
||||||
|
|
||||||
|
if @sprites["cursor"].x > (Settings::SCREEN_WIDTH / 2)
|
||||||
|
@window.x = (Settings::SCREEN_WIDTH / 2 ) - @sprites["cursor"].x
|
||||||
|
if (@window.x < windowminx)
|
||||||
|
@window.x = windowminx
|
||||||
|
end
|
||||||
|
@sprites["cursor"].x += @window.x
|
||||||
|
end
|
||||||
|
if @sprites["cursor"].y > (Settings::SCREEN_HEIGHT / 2)
|
||||||
|
@window.y = (Settings::SCREEN_HEIGHT / 2 ) - @sprites["cursor"].y
|
||||||
|
if @window.y < windowminy
|
||||||
|
@window.y = windowminy
|
||||||
|
end
|
||||||
|
@sprites["cursor"].y += @window.y
|
||||||
|
end
|
||||||
|
|
||||||
|
@sprites["cursor"].ox = (@sprites["cursor"].bmp.height - TileWidth) / 2.0
|
||||||
|
@sprites["cursor"].oy = @sprites["cursor"].ox
|
||||||
@sprites["txt"] = TextSprite.new(@viewport)
|
@sprites["txt"] = TextSprite.new(@viewport)
|
||||||
@sprites["arrowLeft"] = Sprite.new(@viewport2)
|
@sprites["arrowLeft"] = Sprite.new(@viewport2)
|
||||||
@sprites["arrowLeft"].bmp("Graphics/Pictures/mapArrowRight")
|
@sprites["arrowLeft"].bmp("Graphics/Pictures/mapArrowRight")
|
||||||
@@ -121,18 +206,19 @@ class BetterRegionMap
|
|||||||
@sprites["arrowDown"].bmp("Graphics/Pictures/mapArrowDown")
|
@sprites["arrowDown"].bmp("Graphics/Pictures/mapArrowDown")
|
||||||
@sprites["arrowDown"].center_origins
|
@sprites["arrowDown"].center_origins
|
||||||
@sprites["arrowDown"].xyz = Graphics.width / 2, Graphics.height - 24
|
@sprites["arrowDown"].xyz = Graphics.width / 2, Graphics.height - 24
|
||||||
|
|
||||||
update_text
|
update_text
|
||||||
@dirs = []
|
@dirs = []
|
||||||
@mdirs = []
|
@mdirs = []
|
||||||
@i = 0
|
@i = 0
|
||||||
|
|
||||||
if can_fly
|
if can_fly
|
||||||
@spots = {}
|
@spots = {}
|
||||||
n = 0
|
n = 0
|
||||||
for x in 0...(@window["map"].bmp.width / TileWidth)
|
for x in 0...(@window["map"].bmp.width / TileWidth)
|
||||||
for y in 0...(@window["map"].bmp.height / TileHeight)
|
for y in 0...(@window["map"].bmp.height / TileHeight)
|
||||||
healspot = pbGetHealingSpot(x,y)
|
healspot = pbGetHealingSpot(x, y)
|
||||||
if healspot && $PokemonGlobal.visitedMaps[healspot[0]]
|
if can_fly_to_location(healspot)
|
||||||
@window["point#{n}"] = Sprite.new(@mapvp)
|
@window["point#{n}"] = Sprite.new(@mapvp)
|
||||||
@window["point#{n}"].bmp("Graphics/Pictures/mapFly")
|
@window["point#{n}"].bmp("Graphics/Pictures/mapFly")
|
||||||
@window["point#{n}"].src_rect.width = @window["point#{n}"].bmp.height
|
@window["point#{n}"].src_rect.width = @window["point#{n}"].bmp.height
|
||||||
@@ -146,64 +232,34 @@ class BetterRegionMap
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
initWindowPosition(region)
|
|
||||||
|
|
||||||
#if region == nil
|
|
||||||
#end
|
|
||||||
|
|
||||||
hideBlk { update(false) }
|
hideBlk { update(false) }
|
||||||
main
|
main
|
||||||
end
|
end
|
||||||
|
|
||||||
def initWindowPosition(region=0)
|
def can_fly_to_location(healspot)
|
||||||
x, y = 0
|
return true if healspot && @fly_anywhere
|
||||||
if region == 2 #sevii islands
|
return healspot && $PokemonGlobal.visitedMaps[healspot[0]]
|
||||||
x=-250
|
|
||||||
y=-200
|
|
||||||
elsif region == 1 #johto
|
|
||||||
x=0
|
|
||||||
y=0
|
|
||||||
else #kanto
|
|
||||||
x=-250
|
|
||||||
y=0
|
|
||||||
end
|
|
||||||
updateWindowPosition(x,y)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pbGetHealingSpot(x, y)
|
||||||
#@hor_count = position du pointer
|
|
||||||
def updateWindowPosition(x,y)
|
|
||||||
@window.x = x
|
|
||||||
@window.y = y
|
|
||||||
|
|
||||||
# @hor_count = 0#x
|
|
||||||
# @ver_count = 0#y
|
|
||||||
|
|
||||||
@sprites["cursor"].x = 16 + TileWidth * $PokemonGlobal.regionMapSel[0] + @window.x
|
|
||||||
@sprites["cursor"].y = 32 + TileWidth * $PokemonGlobal.regionMapSel[1] + @window.y
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def pbGetHealingSpot(x,y)
|
|
||||||
return nil if !@data[2]
|
return nil if !@data[2]
|
||||||
for loc in @data[2]
|
for loc in @data[2]
|
||||||
if loc[0] == x && loc[1] == y
|
if loc[0] == x && loc[1] == y
|
||||||
if !loc[4] || !loc[5] || !loc[6]
|
if !loc[4] || !loc[5] || !loc[6]
|
||||||
return nil
|
return nil
|
||||||
else
|
else
|
||||||
return [loc[4],loc[5],loc[6]]
|
return [loc[4], loc[5], loc[6]]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def main
|
def main
|
||||||
loop do
|
loop do
|
||||||
update
|
update
|
||||||
if Input.press?(Input::RIGHT) && ![4,6].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
if Input.press?(Input::RIGHT) && ![4, 6].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
||||||
if @sprites["cursor"].x < 480
|
if @sprites["cursor"].x < 480
|
||||||
$PokemonGlobal.regionMapSel[0] += 1
|
$PokemonGlobal.regionMapSel[0] += 1
|
||||||
@sx = @sprites["cursor"].x
|
@sx = @sprites["cursor"].x
|
||||||
@@ -214,7 +270,7 @@ class BetterRegionMap
|
|||||||
@mdirs << 6
|
@mdirs << 6
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Input.press?(Input::LEFT) && ![4,6].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
if Input.press?(Input::LEFT) && ![4, 6].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
||||||
if @sprites["cursor"].x > 16
|
if @sprites["cursor"].x > 16
|
||||||
$PokemonGlobal.regionMapSel[0] -= 1
|
$PokemonGlobal.regionMapSel[0] -= 1
|
||||||
@sx = @sprites["cursor"].x
|
@sx = @sprites["cursor"].x
|
||||||
@@ -225,19 +281,18 @@ class BetterRegionMap
|
|||||||
@mdirs << 4
|
@mdirs << 4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Input.press?(Input::DOWN) && ![2,8].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
if Input.press?(Input::DOWN) && ![2, 8].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
||||||
if @sprites["cursor"].y <= 320
|
if @sprites["cursor"].y <= 320
|
||||||
$PokemonGlobal.regionMapSel[1] += 1
|
$PokemonGlobal.regionMapSel[1] += 1
|
||||||
@sy = @sprites["cursor"].y
|
@sy = @sprites["cursor"].y
|
||||||
@dirs << 2
|
@dirs << 2
|
||||||
|
|
||||||
elsif @window.y > -1 * (@window["map"].bmp.height - 320)
|
elsif @window.y > -1 * (@window["map"].bmp.height - 320)
|
||||||
$PokemonGlobal.regionMapSel[1] += 1
|
$PokemonGlobal.regionMapSel[1] += 1
|
||||||
@my = @window.y
|
@my = @window.y
|
||||||
@mdirs << 2
|
@mdirs << 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if Input.press?(Input::UP) && ![2,8].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
if Input.press?(Input::UP) && ![2, 8].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
||||||
if @sprites["cursor"].y > 32
|
if @sprites["cursor"].y > 32
|
||||||
$PokemonGlobal.regionMapSel[1] -= 1
|
$PokemonGlobal.regionMapSel[1] -= 1
|
||||||
@sy = @sprites["cursor"].y
|
@sy = @sprites["cursor"].y
|
||||||
@@ -259,18 +314,22 @@ class BetterRegionMap
|
|||||||
end
|
end
|
||||||
dispose
|
dispose
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(update_gfx = true)
|
def update(update_gfx = true)
|
||||||
@sprites["arrowLeft"].visible = @window.x < 0 -MAP_MARGIN
|
@sprites["arrowLeft"].visible = @window.x < 0
|
||||||
@sprites["arrowRight"].visible = @window.x > -1 * (@window["map"].bmp.width - 480) +MAP_MARGIN
|
@sprites["arrowRight"].visible = @window.x > -1 * (@window["map"].bmp.width - 480)
|
||||||
@sprites["arrowUp"].visible = @window.y < 0 - MAP_MARGIN
|
@sprites["arrowUp"].visible = @window.y < 0
|
||||||
@sprites["arrowDown"].visible = @window.y > -1 * (@window["map"].bmp.height - 320) +MAP_MARGIN
|
@sprites["arrowDown"].visible = @window.y > -1 * (@window["map"].bmp.height - 320)
|
||||||
|
|
||||||
if update_gfx
|
if update_gfx
|
||||||
Graphics.update
|
Graphics.update
|
||||||
Input.update
|
Input.update
|
||||||
end
|
end
|
||||||
|
|
||||||
|
intensity = (Graphics.frame_count % 40) * 12
|
||||||
|
intensity = 480 - intensity if intensity > 240
|
||||||
|
@window["areahighlight"].opacity = intensity
|
||||||
|
|
||||||
@i += 1
|
@i += 1
|
||||||
if @i % CursorAnimateDelay == 0
|
if @i % CursorAnimateDelay == 0
|
||||||
@sprites["cursor"].src_rect.x += @sprites["cursor"].src_rect.width
|
@sprites["cursor"].src_rect.x += @sprites["cursor"].src_rect.width
|
||||||
@@ -278,12 +337,12 @@ class BetterRegionMap
|
|||||||
end
|
end
|
||||||
if @i % FlyPointAnimateDelay == 0
|
if @i % FlyPointAnimateDelay == 0
|
||||||
@window.keys.each do |e|
|
@window.keys.each do |e|
|
||||||
next unless e.to_s.starts_with?("point")
|
next unless e.to_s.start_with?("point")
|
||||||
@window[e].src_rect.x += @window[e].src_rect.width
|
@window[e].src_rect.x += @window[e].src_rect.width
|
||||||
@window[e].src_rect.x = 0 if @window[e].src_rect.x >= @window[e].bmp.width
|
@window[e].src_rect.x = 0 if @window[e].src_rect.x >= @window[e].bmp.width
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @i % 2 == 0
|
if @i % 2 == 0
|
||||||
case @i % 32
|
case @i % 32
|
||||||
when 0...8
|
when 0...8
|
||||||
@@ -303,7 +362,7 @@ class BetterRegionMap
|
|||||||
@sprites["arrowDown"].y += 1
|
@sprites["arrowDown"].y += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Cursor movement
|
# Cursor movement
|
||||||
if @dirs.include?(6)
|
if @dirs.include?(6)
|
||||||
@hor_count ||= 0
|
@hor_count ||= 0
|
||||||
@@ -349,7 +408,7 @@ class BetterRegionMap
|
|||||||
@sy = nil
|
@sy = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Map movement
|
# Map movement
|
||||||
if @mdirs.include?(6)
|
if @mdirs.include?(6)
|
||||||
@hor_count ||= 0
|
@hor_count ||= 0
|
||||||
@@ -396,24 +455,24 @@ class BetterRegionMap
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_text
|
def update_text
|
||||||
location = @data[2].find do |e|
|
location = @data[2].find do |e|
|
||||||
e[0] == $PokemonGlobal.regionMapSel[0] &&
|
e[0] == $PokemonGlobal.regionMapSel[0] &&
|
||||||
e[1] == $PokemonGlobal.regionMapSel[1]
|
e[1] == $PokemonGlobal.regionMapSel[1]
|
||||||
end
|
end
|
||||||
text = ""
|
text = ""
|
||||||
text = location[2] if location
|
text = location[2] if location
|
||||||
poi = ""
|
poi = ""
|
||||||
poi = location[3] if location && location[3]
|
poi = location[3] if location && location[3]
|
||||||
@sprites["txt"].draw([
|
@sprites["txt"].draw([
|
||||||
[pbGetMessage(MessageTypes::RegionNames,@region), 16, 0, 0,
|
[pbGetMessage(MessageTypes::RegionNames, @region), 16, 0, 0,
|
||||||
Color.new(255,255,255), Color.new(0,0,0)],
|
Color.new(255, 255, 255), Color.new(0, 0, 0)],
|
||||||
[text, 16, 354, 0, Color.new(255,255,255), Color.new(0,0,0)],
|
[text, 16, 354, 0, Color.new(255, 255, 255), Color.new(0, 0, 0)],
|
||||||
[poi, 496, 354, 1, Color.new(255,255,255), Color.new(0,0,0)]
|
[poi, 496, 354, 1, Color.new(255, 255, 255), Color.new(0, 0, 0)],
|
||||||
], true)
|
], true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def dispose
|
def dispose
|
||||||
showBlk { update(false) }
|
showBlk { update(false) }
|
||||||
@sprites.dispose
|
@sprites.dispose
|
||||||
@@ -430,20 +489,24 @@ end
|
|||||||
# Overwrites some old methods to use the new region map #
|
# Overwrites some old methods to use the new region map #
|
||||||
#==============================================================================#
|
#==============================================================================#
|
||||||
|
|
||||||
#ItemHandlers::UseInField.add(:TOWNMAP,proc{|item|
|
ItemHandlers::UseInField.add(:TOWNMAP, proc { |item|
|
||||||
# pbBetterRegionMap
|
pbBetterRegionMap
|
||||||
# next 1
|
next 1
|
||||||
#})
|
})
|
||||||
|
|
||||||
|
def pbShowMap(region = -1, wallmap = true) # pokegear
|
||||||
|
pbBetterRegionMap(region, true, false, wallmap)
|
||||||
|
end
|
||||||
|
|
||||||
class PokemonPartyScreen
|
class PokemonPartyScreen
|
||||||
def pbPokemonScreen
|
def pbPokemonScreen
|
||||||
@scene.pbStartScene(@party,
|
@scene.pbStartScene(@party,
|
||||||
(@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."),nil)
|
(@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."), nil)
|
||||||
loop do
|
loop do
|
||||||
@scene.pbSetHelpText((@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
|
@scene.pbSetHelpText((@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
|
||||||
pkmnid = @scene.pbChoosePokemon(false, -1, 1)
|
pkmnid = @scene.pbChoosePokemon(false, -1, 1)
|
||||||
break if (pkmnid.is_a?(Numeric) && pkmnid < 0) || (pkmnid.is_a?(Array) && pkmnid[1] < 0)
|
break if (pkmnid.is_a?(Numeric) && pkmnid < 0) || (pkmnid.is_a?(Array) && pkmnid[1] < 0)
|
||||||
if pkmnid.is_a?(Array) && pkmnid[0] == 1 # Switch
|
if pkmnid.is_a?(Array) && pkmnid[0] == 1 # Switch
|
||||||
@scene.pbSetHelpText(_INTL("Move to where?"))
|
@scene.pbSetHelpText(_INTL("Move to where?"))
|
||||||
oldpkmnid = pkmnid[1]
|
oldpkmnid = pkmnid[1]
|
||||||
pkmnid = @scene.pbChoosePokemon(true, -1, 2)
|
pkmnid = @scene.pbChoosePokemon(true, -1, 2)
|
||||||
@@ -453,42 +516,42 @@ class PokemonPartyScreen
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
pkmn = @party[pkmnid]
|
pkmn = @party[pkmnid]
|
||||||
commands = []
|
commands = []
|
||||||
cmdSummary = -1
|
cmdSummary = -1
|
||||||
cmdDebug = -1
|
cmdDebug = -1
|
||||||
cmdMoves = [-1,-1,-1,-1]
|
cmdMoves = [-1, -1, -1, -1]
|
||||||
cmdSwitch = -1
|
cmdSwitch = -1
|
||||||
cmdMail = -1
|
cmdMail = -1
|
||||||
cmdItem = -1
|
cmdItem = -1
|
||||||
# Build the commands
|
# Build the commands
|
||||||
commands[cmdSummary = commands.length] = _INTL("Summary")
|
commands[cmdSummary = commands.length] = _INTL("Summary")
|
||||||
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
|
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
|
||||||
for i in 0...pkmn.moves.length
|
for i in 0...pkmn.moves.length
|
||||||
move = pkmn.moves[i]
|
move = pkmn.moves[i]
|
||||||
# Check for hidden moves and add any that were found
|
# Check for hidden moves and add any that were found
|
||||||
if !pkmn.egg? && (isConst?(move.id,PBMoves,:MILKDRINK) ||
|
if !pkmn.egg? && (isConst?(move.id, PBMoves, :MILKDRINK) ||
|
||||||
isConst?(move.id,PBMoves,:SOFTBOILED) ||
|
isConst?(move.id, PBMoves, :SOFTBOILED) ||
|
||||||
HiddenMoveHandlers.hasHandler(move.id))
|
HiddenMoveHandlers.hasHandler(move.id))
|
||||||
commands[cmdMoves[i] = commands.length] = [PBMoves.getName(move.id),1]
|
commands[cmdMoves[i] = commands.length] = [PBMoves.getName(move.id), 1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length>1
|
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length > 1
|
||||||
if !pkmn.egg?
|
if !pkmn.egg?
|
||||||
if pkmn.mail
|
if pkmn.mail
|
||||||
commands[cmdMail = commands.length] = _INTL("Mail")
|
commands[cmdMail = commands.length] = _INTL("Mail")
|
||||||
else
|
else
|
||||||
commands[cmdItem = commands.length] = _INTL("Item")
|
commands[cmdItem = commands.length] = _INTL("Item")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
commands[commands.length] = _INTL("Cancel")
|
commands[commands.length] = _INTL("Cancel")
|
||||||
command = @scene.pbShowCommands(_INTL("Do what with {1}?",pkmn.name),commands)
|
command = @scene.pbShowCommands(_INTL("Do what with {1}?", pkmn.name), commands)
|
||||||
havecommand = false
|
havecommand = false
|
||||||
for i in 0...4
|
for i in 0...4
|
||||||
if cmdMoves[i] >= 0 && command == cmdMoves[i]
|
if cmdMoves[i] >= 0 && command == cmdMoves[i]
|
||||||
havecommand = true
|
havecommand = true
|
||||||
if isConst?(pkmn.moves[i].id,PBMoves,:SOFTBOILED) ||
|
if isConst?(pkmn.moves[i].id, PBMoves, :SOFTBOILED) ||
|
||||||
isConst?(pkmn.moves[i].id,PBMoves,:MILKDRINK)
|
isConst?(pkmn.moves[i].id, PBMoves, :MILKDRINK)
|
||||||
amt = [(pkmn.totalhp/5).floor,1].max
|
amt = [(pkmn.totalhp / 5).floor, 1].max
|
||||||
if pkmn.hp <= amt
|
if pkmn.hp <= amt
|
||||||
pbDisplay(_INTL("Not enough HP..."))
|
pbDisplay(_INTL("Not enough HP..."))
|
||||||
break
|
break
|
||||||
@@ -502,15 +565,15 @@ class PokemonPartyScreen
|
|||||||
newpkmn = @party[pkmnid]
|
newpkmn = @party[pkmnid]
|
||||||
movename = PBMoves.getName(pkmn.moves[i].id)
|
movename = PBMoves.getName(pkmn.moves[i].id)
|
||||||
if pkmnid == oldpkmnid
|
if pkmnid == oldpkmnid
|
||||||
pbDisplay(_INTL("{1} can't use {2} on itself!",pkmn.name,movename))
|
pbDisplay(_INTL("{1} can't use {2} on itself!", pkmn.name, movename))
|
||||||
elsif newpkmn.egg?
|
elsif newpkmn.egg?
|
||||||
pbDisplay(_INTL("{1} can't be used on an Egg!",movename))
|
pbDisplay(_INTL("{1} can't be used on an Egg!", movename))
|
||||||
elsif newpkmn.hp == 0 || newpkmn.hp == newpkmn.totalhp
|
elsif newpkmn.hp == 0 || newpkmn.hp == newpkmn.totalhp
|
||||||
pbDisplay(_INTL("{1} can't be used on that Pokémon.",movename))
|
pbDisplay(_INTL("{1} can't be used on that Pokémon.", movename))
|
||||||
else
|
else
|
||||||
pkmn.hp -= amt
|
pkmn.hp -= amt
|
||||||
hpgain = pbItemRestoreHP(newpkmn,amt)
|
hpgain = pbItemRestoreHP(newpkmn, amt)
|
||||||
@scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.",newpkmn.name,hpgain))
|
@scene.pbDisplay(_INTL("{1}'s HP was restored by {2} points.", newpkmn.name, hpgain))
|
||||||
pbRefresh
|
pbRefresh
|
||||||
end
|
end
|
||||||
break if pkmn.hp <= amt
|
break if pkmn.hp <= amt
|
||||||
@@ -518,22 +581,22 @@ class PokemonPartyScreen
|
|||||||
@scene.pbSelect(oldpkmnid)
|
@scene.pbSelect(oldpkmnid)
|
||||||
pbRefresh
|
pbRefresh
|
||||||
break
|
break
|
||||||
elsif Kernel.pbCanUseHiddenMove?(pkmn,pkmn.moves[i].id)
|
elsif Kernel.pbCanUseHiddenMove?(pkmn, pkmn.moves[i].id)
|
||||||
if Kernel.pbConfirmUseHiddenMove(pkmn,pkmn.moves[i].id)
|
if Kernel.pbConfirmUseHiddenMove(pkmn, pkmn.moves[i].id)
|
||||||
@scene.pbEndScene
|
@scene.pbEndScene
|
||||||
if isConst?(pkmn.moves[i].id,PBMoves,:FLY)
|
if isConst?(pkmn.moves[i].id, PBMoves, :FLY)
|
||||||
###############################################
|
###############################################
|
||||||
ret = pbBetterRegionMap(nil, true, true)
|
ret = pbBetterRegionMap(-1, true, true)
|
||||||
if ret
|
if ret
|
||||||
$PokemonTemp.flydata = ret
|
$PokemonTemp.flydata = ret
|
||||||
return [pkmn,pkmn.moves[i].id]
|
return [pkmn, pkmn.moves[i].id]
|
||||||
end
|
end
|
||||||
@scene.pbStartScene(@party,
|
@scene.pbStartScene(@party,
|
||||||
(@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
|
(@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
|
||||||
break
|
break
|
||||||
###############################################
|
###############################################
|
||||||
end
|
end
|
||||||
return [pkmn,pkmn.moves[i].id]
|
return [pkmn, pkmn.moves[i].id]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
@@ -544,7 +607,7 @@ class PokemonPartyScreen
|
|||||||
if cmdSummary >= 0 && command == cmdSummary
|
if cmdSummary >= 0 && command == cmdSummary
|
||||||
@scene.pbSummary(pkmnid)
|
@scene.pbSummary(pkmnid)
|
||||||
elsif cmdDebug >= 0 && command == cmdDebug
|
elsif cmdDebug >= 0 && command == cmdDebug
|
||||||
pbPokemonDebug(pkmn,pkmnid)
|
pbPokemonDebug(pkmn, pkmnid)
|
||||||
elsif cmdSwitch >= 0 && command == cmdSwitch
|
elsif cmdSwitch >= 0 && command == cmdSwitch
|
||||||
@scene.pbSetHelpText(_INTL("Move to where?"))
|
@scene.pbSetHelpText(_INTL("Move to where?"))
|
||||||
oldpkmnid = pkmnid
|
oldpkmnid = pkmnid
|
||||||
@@ -554,10 +617,10 @@ class PokemonPartyScreen
|
|||||||
end
|
end
|
||||||
elsif cmdMail >= 0 && command == cmdMail
|
elsif cmdMail >= 0 && command == cmdMail
|
||||||
command = @scene.pbShowCommands(_INTL("Do what with the mail?"),
|
command = @scene.pbShowCommands(_INTL("Do what with the mail?"),
|
||||||
[_INTL("Read"),_INTL("Take"),_INTL("Cancel")])
|
[_INTL("Read"), _INTL("Take"), _INTL("Cancel")])
|
||||||
case command
|
case command
|
||||||
when 0 # Read
|
when 0 # Read
|
||||||
pbFadeOutIn(99999){ pbDisplayMail(pkmn.mail,pkmn) }
|
pbFadeOutIn(99999) { pbDisplayMail(pkmn.mail, pkmn) }
|
||||||
when 1 # Take
|
when 1 # Take
|
||||||
if pbTakeItemFromPokemon(pkmn, self)
|
if pbTakeItemFromPokemon(pkmn, self)
|
||||||
pbRefreshSingle(pkmnid)
|
pbRefreshSingle(pkmnid)
|
||||||
@@ -565,38 +628,38 @@ class PokemonPartyScreen
|
|||||||
end
|
end
|
||||||
elsif cmdItem >= 0 && command == cmdItem
|
elsif cmdItem >= 0 && command == cmdItem
|
||||||
itemcommands = []
|
itemcommands = []
|
||||||
cmdUseItem = -1
|
cmdUseItem = -1
|
||||||
cmdGiveItem = -1
|
cmdGiveItem = -1
|
||||||
cmdTakeItem = -1
|
cmdTakeItem = -1
|
||||||
cmdMoveItem = -1
|
cmdMoveItem = -1
|
||||||
# Build the commands
|
# Build the commands
|
||||||
itemcommands[cmdUseItem=itemcommands.length] = _INTL("Use")
|
itemcommands[cmdUseItem = itemcommands.length] = _INTL("Use")
|
||||||
itemcommands[cmdGiveItem=itemcommands.length] = _INTL("Give")
|
itemcommands[cmdGiveItem = itemcommands.length] = _INTL("Give")
|
||||||
itemcommands[cmdTakeItem=itemcommands.length] = _INTL("Take") if pkmn.hasItem?
|
itemcommands[cmdTakeItem = itemcommands.length] = _INTL("Take") if pkmn.hasItem?
|
||||||
itemcommands[cmdMoveItem=itemcommands.length] = _INTL("Move") if pkmn.hasItem? && !pbIsMail?(pkmn.item)
|
itemcommands[cmdMoveItem = itemcommands.length] = _INTL("Move") if pkmn.hasItem? && !pbIsMail?(pkmn.item)
|
||||||
itemcommands[itemcommands.length] = _INTL("Cancel")
|
itemcommands[itemcommands.length] = _INTL("Cancel")
|
||||||
command = @scene.pbShowCommands(_INTL("Do what with an item?"),itemcommands)
|
command = @scene.pbShowCommands(_INTL("Do what with an item?"), itemcommands)
|
||||||
if cmdUseItem >= 0 && command == cmdUseItem # Use
|
if cmdUseItem >= 0 && command == cmdUseItem # Use
|
||||||
item = @scene.pbUseItem($PokemonBag, pkmn)
|
item = @scene.pbUseItem($PokemonBag, pkmn)
|
||||||
if item>0
|
if item > 0
|
||||||
pbUseItemOnPokemon(item,pkmn,self)
|
pbUseItemOnPokemon(item, pkmn, self)
|
||||||
pbRefreshSingle(pkmnid)
|
pbRefreshSingle(pkmnid)
|
||||||
end
|
end
|
||||||
elsif cmdGiveItem >= 0 && command == cmdGiveItem # Give
|
elsif cmdGiveItem >= 0 && command == cmdGiveItem # Give
|
||||||
item = @scene.pbChooseItem($PokemonBag)
|
item = @scene.pbChooseItem($PokemonBag)
|
||||||
if item > 0
|
if item > 0
|
||||||
if pbGiveItemToPokemon(item, pkmn, self, pkmnid)
|
if pbGiveItemToPokemon(item, pkmn, self, pkmnid)
|
||||||
pbRefreshSingle(pkmnid)
|
pbRefreshSingle(pkmnid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif cmdTakeItem >= 0 && command == cmdTakeItem # Take
|
elsif cmdTakeItem >= 0 && command == cmdTakeItem # Take
|
||||||
if pbTakeItemFromPokemon(pkmn, self)
|
if pbTakeItemFromPokemon(pkmn, self)
|
||||||
pbRefreshSingle(pkmnid)
|
pbRefreshSingle(pkmnid)
|
||||||
end
|
end
|
||||||
elsif cmdMoveItem >= 0 && command == cmdMoveItem # Move
|
elsif cmdMoveItem >= 0 && command == cmdMoveItem # Move
|
||||||
item = pkmn.item
|
item = pkmn.item
|
||||||
itemname = PBItems.getName(item)
|
itemname = PBItems.getName(item)
|
||||||
@scene.pbSetHelpText(_INTL("Move {1} to where?",itemname))
|
@scene.pbSetHelpText(_INTL("Move {1} to where?", itemname))
|
||||||
oldpkmnid = pkmnid
|
oldpkmnid = pkmnid
|
||||||
loop do
|
loop do
|
||||||
@scene.pbPreSelect(oldpkmnid)
|
@scene.pbPreSelect(oldpkmnid)
|
||||||
@@ -612,27 +675,27 @@ class PokemonPartyScreen
|
|||||||
pkmn.setItem(0)
|
pkmn.setItem(0)
|
||||||
@scene.pbClearSwitching
|
@scene.pbClearSwitching
|
||||||
pbRefresh
|
pbRefresh
|
||||||
pbDisplay(_INTL("{1} was given the {2} to hold.",newpkmn.name,itemname))
|
pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, itemname))
|
||||||
break
|
break
|
||||||
elsif pbIsMail?(newpkmn.item)
|
elsif pbIsMail?(newpkmn.item)
|
||||||
pbDisplay(_INTL("{1}'s mail must be removed before giving it an item.",newpkmn.name))
|
pbDisplay(_INTL("{1}'s mail must be removed before giving it an item.", newpkmn.name))
|
||||||
else
|
else
|
||||||
newitem = newpkmn.item
|
newitem = newpkmn.item
|
||||||
newitemname = PBItems.getName(newitem)
|
newitemname = PBItems.getName(newitem)
|
||||||
if isConst?(newitem,PBItems,:LEFTOVERS)
|
if isConst?(newitem, PBItems, :LEFTOVERS)
|
||||||
pbDisplay(_INTL("{1} is already holding some {2}.\1",newpkmn.name,newitemname))
|
pbDisplay(_INTL("{1} is already holding some {2}.\1", newpkmn.name, newitemname))
|
||||||
elsif ['a','e','i','o','u'].include?(newitemname[0,1].downcase)
|
elsif ["a", "e", "i", "o", "u"].include?(newitemname[0, 1].downcase)
|
||||||
pbDisplay(_INTL("{1} is already holding an {2}.\1",newpkmn.name,newitemname))
|
pbDisplay(_INTL("{1} is already holding an {2}.\1", newpkmn.name, newitemname))
|
||||||
else
|
else
|
||||||
pbDisplay(_INTL("{1} is already holding a {2}.\1",newpkmn.name,newitemname))
|
pbDisplay(_INTL("{1} is already holding a {2}.\1", newpkmn.name, newitemname))
|
||||||
end
|
end
|
||||||
if pbConfirm(_INTL("Would you like to switch the two items?"))
|
if pbConfirm(_INTL("Would you like to switch the two items?"))
|
||||||
newpkmn.setItem(item)
|
newpkmn.setItem(item)
|
||||||
pkmn.setItem(newitem)
|
pkmn.setItem(newitem)
|
||||||
@scene.pbClearSwitching
|
@scene.pbClearSwitching
|
||||||
pbRefresh
|
pbRefresh
|
||||||
pbDisplay(_INTL("{1} was given the {2} to hold.",newpkmn.name,itemname))
|
pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, itemname))
|
||||||
pbDisplay(_INTL("{1} was given the {2} to hold.",pkmn.name,newitemname))
|
pbDisplay(_INTL("{1} was given the {2} to hold.", pkmn.name, newitemname))
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -642,22 +705,76 @@ class PokemonPartyScreen
|
|||||||
end
|
end
|
||||||
@scene.pbEndScene
|
@scene.pbEndScene
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def calculatePointsAndCenter(mapwidth)
|
||||||
|
# Fill the array "points" with all squares of the region map in which the
|
||||||
|
# species can be found
|
||||||
|
points = []
|
||||||
|
|
||||||
|
encdata = pbLoadEncountersData
|
||||||
|
|
||||||
|
minxy = [nil, nil] # top-leftmost tile
|
||||||
|
maxxy = [nil, nil] # bottom-rightmost tile
|
||||||
|
|
||||||
|
for enc in encdata.keys
|
||||||
|
enctypes = encdata[enc][1]
|
||||||
|
if pbFindEncounter(enctypes, @species)
|
||||||
|
mappos = GameData::MapMetadata.get(enc).town_map_position
|
||||||
|
|
||||||
|
if mappos && mappos[0] == @region
|
||||||
|
showpoint = true
|
||||||
|
for loc in @mapdata[@region][2]
|
||||||
|
showpoint = false if loc[0] == mappos[1] && loc[1] == mappos[2] &&
|
||||||
|
loc[7] && !$game_switches[loc[7]]
|
||||||
|
end
|
||||||
|
if showpoint
|
||||||
|
#mapsize = pbGetMetadata(enc, MetadataMapSize)
|
||||||
|
mapsize = GameData::MapMetadata.get(enc).town_map_size
|
||||||
|
|
||||||
|
if mapsize && mapsize[0] && mapsize[0] > 0
|
||||||
|
sqwidth = mapsize[0]
|
||||||
|
sqheight = (mapsize[1].length * 1.0 / mapsize[0]).ceil
|
||||||
|
for i in 0...sqwidth
|
||||||
|
for j in 0...sqheight
|
||||||
|
if mapsize[1][i + j * sqwidth, 1].to_i > 0
|
||||||
|
# work out the upper-leftmost and lower-rightmost tiles
|
||||||
|
minxy[0] = (minxy[0] == nil || minxy[0] > mappos[1]+i) ? mappos[1]+i : minxy[0]
|
||||||
|
minxy[1] = (minxy[1] == nil || minxy[1] > mappos[2]+j) ? mappos[2]+j : minxy[1]
|
||||||
|
maxxy[0] = (maxxy[0] == nil || maxxy[0] < mappos[1]+i) ? mappos[1]+i : maxxy[0]
|
||||||
|
maxxy[1] = (maxxy[1] == nil || maxxy[1] < mappos[2]+j) ? mappos[2]+j : maxxy[1]
|
||||||
|
points[mappos[1] + i + (mappos[2] + j) * mapwidth] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# work out the upper-leftmost and lower-rightmost tiles
|
||||||
|
minxy[0] = (minxy[0] == nil || minxy[0] > mappos[1]) ? mappos[1] : minxy[0]
|
||||||
|
minxy[1] = minxy[1] == nil || minxy[1] > mappos[2] ? mappos[2] : minxy[1]
|
||||||
|
maxxy[0] = (maxxy[0] == nil || maxxy[0] < mappos[1]) ? mappos[1] : maxxy[0]
|
||||||
|
maxxy[1] = (maxxy[1] == nil || maxxy[1] < mappos[2]) ? mappos[2] : maxxy[1]
|
||||||
|
points[mappos[1] + mappos[2] * mapwidth] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return [points, minxy, maxxy]
|
||||||
|
end
|
||||||
|
|
||||||
class PokemonReadyMenu
|
class PokemonReadyMenu
|
||||||
def pbStartReadyMenu(moves,items)
|
def pbStartReadyMenu(moves, items)
|
||||||
commands = [[], []] # Moves, items
|
commands = [[], []] # Moves, items
|
||||||
for i in moves
|
for i in moves
|
||||||
commands[0].push([i[0], PBMoves.getName(i[0]), true, i[1]])
|
commands[0].push([i[0], PBMoves.getName(i[0]), true, i[1]])
|
||||||
end
|
end
|
||||||
commands[0].sort! { |a,b| a[1] <=> b[1] }
|
commands[0].sort! { |a, b| a[1] <=> b[1] }
|
||||||
for i in items
|
for i in items
|
||||||
commands[1].push([i, PBItems.getName(i), false])
|
commands[1].push([i, PBItems.getName(i), false])
|
||||||
end
|
end
|
||||||
commands[1].sort! { |a,b| a[1] <=> b[1] }
|
commands[1].sort! { |a, b| a[1] <=> b[1] }
|
||||||
|
|
||||||
@scene.pbStartScene(commands)
|
@scene.pbStartScene(commands)
|
||||||
loop do
|
loop do
|
||||||
command = @scene.pbShowCommands
|
command = @scene.pbShowCommands
|
||||||
@@ -667,34 +784,34 @@ class PokemonReadyMenu
|
|||||||
if command[0] == 0 # Use a move
|
if command[0] == 0 # Use a move
|
||||||
move = commands[0][command[1]][0]
|
move = commands[0][command[1]][0]
|
||||||
user = $Trainer.party[commands[0][command[1]][3]]
|
user = $Trainer.party[commands[0][command[1]][3]]
|
||||||
if isConst?(move,PBMoves,:FLY)
|
if isConst?(move, PBMoves, :FLY)
|
||||||
###############################################
|
###############################################
|
||||||
pbHideMenu
|
pbHideMenu
|
||||||
ret = pbBetterRegionMap(nil, true, true)
|
ret = pbBetterRegionMap(-1, true, true)
|
||||||
pbShowMenu unless ret
|
pbShowMenu unless ret
|
||||||
###############################################
|
###############################################
|
||||||
if ret
|
if ret
|
||||||
$PokemonTemp.flydata = ret
|
$PokemonTemp.flydata = ret
|
||||||
$game_temp.in_menu = false
|
$game_temp.in_menu = false
|
||||||
Kernel.pbUseHiddenMove(user,move)
|
Kernel.pbUseHiddenMove(user, move)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
pbHideMenu
|
pbHideMenu
|
||||||
if Kernel.pbConfirmUseHiddenMove(user,move)
|
if Kernel.pbConfirmUseHiddenMove(user, move)
|
||||||
$game_temp.in_menu = false
|
$game_temp.in_menu = false
|
||||||
Kernel.pbUseHiddenMove(user,move)
|
Kernel.pbUseHiddenMove(user, move)
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
pbShowMenu
|
pbShowMenu
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else # Use an item
|
else # Use an item
|
||||||
item = commands[1][command[1]][0]
|
item = commands[1][command[1]][0]
|
||||||
pbHideMenu
|
pbHideMenu
|
||||||
if ItemHandlers.triggerConfirmUseInField(item)
|
if ItemHandlers.triggerConfirmUseInField(item)
|
||||||
break if Kernel.pbUseKeyItemInField(item)
|
break if Kernel.pbUseKeyItemInField(item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
pbShowMenu
|
pbShowMenu
|
||||||
end
|
end
|
||||||
@@ -702,4 +819,164 @@ class PokemonReadyMenu
|
|||||||
@scene.pbEndScene
|
@scene.pbEndScene
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
=end
|
|
||||||
|
class PokemonPokedexInfo_Scene
|
||||||
|
def drawPageArea
|
||||||
|
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_area"))
|
||||||
|
overlay = @sprites["overlay"].bitmap
|
||||||
|
base = Color.new(88,88,80)
|
||||||
|
shadow = Color.new(168,184,184)
|
||||||
|
@sprites["areahighlight"].bitmap.clear
|
||||||
|
|
||||||
|
mapwidth = @sprites["areamap"].bitmap.width/BetterRegionMap::TileWidth
|
||||||
|
data = calculatePointsAndCenter(mapwidth)
|
||||||
|
|
||||||
|
points = data[0]
|
||||||
|
minxy = data[1]
|
||||||
|
maxxy = data[2]
|
||||||
|
|
||||||
|
# Draw coloured squares on each square of the region map with a nest
|
||||||
|
pointcolor = Color.new(0,248,248)
|
||||||
|
pointcolorhl = Color.new(192,248,248)
|
||||||
|
sqwidth = PokemonRegionMap_Scene::SQUAREWIDTH
|
||||||
|
sqheight = PokemonRegionMap_Scene::SQUAREHEIGHT
|
||||||
|
|
||||||
|
|
||||||
|
# Center the window on the center of visible areas
|
||||||
|
if minxy[0] != nil && maxxy[0] != nil
|
||||||
|
center_x = ((minxy[0]+maxxy[0])/2).round * sqwidth
|
||||||
|
center_y = ((minxy[1]+maxxy[1])/2).round * sqheight - 40
|
||||||
|
else
|
||||||
|
center_x = Settings::SCREEN_WIDTH/2
|
||||||
|
center_y = Settings::SCREEN_HEIGHT/2 - 40
|
||||||
|
end
|
||||||
|
|
||||||
|
windowminx = -1 * (@sprites["areamap"].bmp.width - Settings::SCREEN_WIDTH + 16)
|
||||||
|
windowminy = -1 * (@sprites["areamap"].bmp.height - Settings::SCREEN_HEIGHT + 16)
|
||||||
|
|
||||||
|
if center_x > (Settings::SCREEN_WIDTH / 2)
|
||||||
|
@sprites["areamap"].x = (480 / 2 ) - center_x
|
||||||
|
if (@sprites["areamap"].x < windowminx)
|
||||||
|
@sprites["areamap"].x = windowminx
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@sprites["areamap"].x = windowminx
|
||||||
|
end
|
||||||
|
if center_y > (Settings::SCREEN_HEIGHT / 2)
|
||||||
|
@sprites["areamap"].y = (320 / 2 ) - center_y
|
||||||
|
if @sprites["areamap"].y < windowminy
|
||||||
|
@sprites["areamap"].y = windowminy
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@sprites["areamap"].y = windowminy
|
||||||
|
end
|
||||||
|
|
||||||
|
for j in 0...points.length
|
||||||
|
if points[j]
|
||||||
|
x = (j%mapwidth)*sqwidth
|
||||||
|
x += @sprites["areamap"].x
|
||||||
|
y = (j/mapwidth)*sqheight
|
||||||
|
y += @sprites["areamap"].y - 8
|
||||||
|
@sprites["areahighlight"].bitmap.fill_rect(x,y,sqwidth,sqheight,pointcolor)
|
||||||
|
if j-mapwidth<0 || !points[j-mapwidth]
|
||||||
|
@sprites["areahighlight"].bitmap.fill_rect(x,y-2,sqwidth,2,pointcolorhl)
|
||||||
|
end
|
||||||
|
if j+mapwidth>=points.length || !points[j+mapwidth]
|
||||||
|
@sprites["areahighlight"].bitmap.fill_rect(x,y+sqheight,sqwidth,2,pointcolorhl)
|
||||||
|
end
|
||||||
|
if j%mapwidth==0 || !points[j-1]
|
||||||
|
@sprites["areahighlight"].bitmap.fill_rect(x-2,y,2,sqheight,pointcolorhl)
|
||||||
|
end
|
||||||
|
if (j+1)%mapwidth==0 || !points[j+1]
|
||||||
|
@sprites["areahighlight"].bitmap.fill_rect(x+sqwidth,y,2,sqheight,pointcolorhl)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set the text
|
||||||
|
textpos = []
|
||||||
|
if points.length==0
|
||||||
|
pbDrawImagePositions(overlay,[
|
||||||
|
[sprintf("Graphics/Pictures/Pokedex/overlay_areanone"),108,188]
|
||||||
|
])
|
||||||
|
textpos.push([_INTL("Area unknown"),Graphics.width/2,Graphics.height/2,2,base,shadow])
|
||||||
|
end
|
||||||
|
textpos.push([pbGetMessage(MessageTypes::RegionNames,@region),414,44,2,base,shadow])
|
||||||
|
textpos.push([_INTL("{1}'s area",PBSpecies.getName(@species)),
|
||||||
|
Graphics.width/2,352,2,base,shadow])
|
||||||
|
|
||||||
|
textpos.push([_INTL("Full view"),Graphics.width/2,306,2,base,shadow])
|
||||||
|
pbDrawTextPositions(overlay,textpos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class PokemonPokedexInfo_Scene
|
||||||
|
def pbScene
|
||||||
|
pbPlayCrySpecies(@species,@form)
|
||||||
|
loop do
|
||||||
|
Graphics.update
|
||||||
|
Input.update
|
||||||
|
pbUpdate
|
||||||
|
dorefresh = false
|
||||||
|
if Input.trigger?(Input::A)
|
||||||
|
pbSEStop
|
||||||
|
pbPlayCrySpecies(@species,@form) if @page==1
|
||||||
|
elsif Input.trigger?(Input::B)
|
||||||
|
pbPlayCloseMenuSE
|
||||||
|
break
|
||||||
|
elsif Input.trigger?(Input::C)
|
||||||
|
if @page==2 # Area
|
||||||
|
pbBetterRegionMap(@region,false,false,false,@species)
|
||||||
|
elsif @page==3 # Forms
|
||||||
|
if @available.length>1
|
||||||
|
pbPlayDecisionSE
|
||||||
|
pbChooseForm
|
||||||
|
dorefresh = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elsif Input.trigger?(Input::UP)
|
||||||
|
oldindex = @index
|
||||||
|
pbGoToPrevious
|
||||||
|
if @index!=oldindex
|
||||||
|
pbUpdateDummyPokemon
|
||||||
|
@available = pbGetAvailableForms
|
||||||
|
pbSEStop
|
||||||
|
(@page==1) ? pbPlayCrySpecies(@species,@form) : pbPlayCursorSE
|
||||||
|
dorefresh = true
|
||||||
|
end
|
||||||
|
elsif Input.trigger?(Input::DOWN)
|
||||||
|
oldindex = @index
|
||||||
|
pbGoToNext
|
||||||
|
if @index!=oldindex
|
||||||
|
pbUpdateDummyPokemon
|
||||||
|
@available = pbGetAvailableForms
|
||||||
|
pbSEStop
|
||||||
|
(@page==1) ? pbPlayCrySpecies(@species,@form) : pbPlayCursorSE
|
||||||
|
dorefresh = true
|
||||||
|
end
|
||||||
|
elsif Input.trigger?(Input::LEFT)
|
||||||
|
oldpage = @page
|
||||||
|
@page -= 1
|
||||||
|
@page = 1 if @page<1
|
||||||
|
@page = 3 if @page>3
|
||||||
|
if @page!=oldpage
|
||||||
|
pbPlayCursorSE
|
||||||
|
dorefresh = true
|
||||||
|
end
|
||||||
|
elsif Input.trigger?(Input::RIGHT)
|
||||||
|
oldpage = @page
|
||||||
|
@page += 1
|
||||||
|
@page = 1 if @page<1
|
||||||
|
@page = 3 if @page>3
|
||||||
|
if @page!=oldpage
|
||||||
|
pbPlayCursorSE
|
||||||
|
dorefresh = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if dorefresh
|
||||||
|
drawPage(@page)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return @index
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user