mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-07-22 07:37:00 +00:00
Update 6.8
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
class PokemonGlobalMetadata
|
||||
attr_accessor :common_map_entrance_id
|
||||
attr_accessor :common_map_entrance_position
|
||||
end
|
||||
|
||||
COMMON_MAPS_KANTO = {
|
||||
:POKEMART => {
|
||||
id: 357,
|
||||
position: [12, 12]
|
||||
}
|
||||
}
|
||||
|
||||
COMMON_MAPS_HOENN =
|
||||
{
|
||||
:POKEMART => {
|
||||
id: 24,
|
||||
position: [9, 10]
|
||||
},
|
||||
:POKEMON_CENTER => {
|
||||
id: 25,
|
||||
position: [10, 10]
|
||||
},
|
||||
:POKEMON_CENTER_BIRTHDAY => {
|
||||
id: 27,
|
||||
position: [10, 10]
|
||||
},
|
||||
:CLOTHING_STORE => {
|
||||
id: 94,
|
||||
position: [11, 11]
|
||||
},
|
||||
:CONTEST_HALL => {
|
||||
id: 110,
|
||||
position: [11, 37]
|
||||
}
|
||||
}
|
||||
|
||||
def enter_common_building(building_id, city)
|
||||
$PokemonGlobal.common_map_entrance_id = $game_map.map_id
|
||||
$PokemonGlobal.common_map_entrance_position = [$game_player.x, $game_player.y]
|
||||
|
||||
maps_list = Settings::HOENN ? COMMON_MAPS_HOENN : COMMON_MAPS_KANTO
|
||||
new_map_data = maps_list[building_id]
|
||||
return unless new_map_data
|
||||
pbSet(VAR_CURRENT_CITY, city)
|
||||
new_map = new_map_data[:id]
|
||||
new_position = new_map_data[:position]
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = new_map
|
||||
$game_temp.player_new_x = new_position[0]
|
||||
$game_temp.player_new_y = new_position[1]
|
||||
$game_temp.player_new_direction = $game_player.direction
|
||||
|
||||
$scene.transfer_player(true)
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
}
|
||||
end
|
||||
|
||||
def exit_common_building()
|
||||
return unless $PokemonGlobal.common_map_entrance_id && $PokemonGlobal.common_map_entrance_position
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_new_map_id = $PokemonGlobal.common_map_entrance_id
|
||||
$game_temp.player_new_x = $PokemonGlobal.common_map_entrance_position[0]
|
||||
$game_temp.player_new_y = $PokemonGlobal.common_map_entrance_position[1]
|
||||
$game_temp.player_new_direction = DIRECTION_DOWN
|
||||
$scene.transfer_player(true)
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
}
|
||||
$PokemonGlobal.common_map_entrance_id = nil
|
||||
$PokemonGlobal.common_map_entrance_position = nil
|
||||
reset_pokemart_variables
|
||||
end
|
||||
|
||||
def enter_pokemon_center(city_symbol)
|
||||
pbSetPokemonCenter
|
||||
pbSet(VAR_CURRENT_CITY, city_symbol)
|
||||
pokemon_center_type = isPlayerBirthDay? ? :POKEMON_CENTER_BIRTHDAY : :POKEMON_CENTER
|
||||
enter_common_building(pokemon_center_type, city_symbol)
|
||||
end
|
||||
|
||||
def exit_pokemon_center()
|
||||
pbSEPlay(SE_EXIT)
|
||||
$PokemonGlobal.common_map_entrance_id = nil
|
||||
$PokemonGlobal.common_map_entrance_position = nil
|
||||
reset_pokemart_variables
|
||||
pbFadeOutIn {
|
||||
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId >= 0
|
||||
pbCancelVehicles
|
||||
$game_temp.player_new_map_id = $PokemonGlobal.pokecenterMapId
|
||||
$game_temp.player_new_x = $PokemonGlobal.pokecenterX
|
||||
$game_temp.player_new_y = $PokemonGlobal.pokecenterY
|
||||
$game_temp.player_new_direction = DIRECTION_DOWN
|
||||
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
$game_map.refresh
|
||||
else
|
||||
# Home
|
||||
$game_temp.player_new_map_id = 9
|
||||
$game_temp.player_new_x = 16
|
||||
$game_temp.player_new_y = 23
|
||||
$scene.transfer_player if $scene.is_a?(Scene_Map)
|
||||
$game_map.refresh
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
@@ -45,6 +45,19 @@ module FootprintVariables
|
||||
# Delay velocity
|
||||
FOOT_DELAY = 1.1
|
||||
|
||||
CURVE_FRAMES = {
|
||||
[DIRECTION_RIGHT, DIRECTION_DOWN] => 4,
|
||||
[DIRECTION_UP, DIRECTION_LEFT] => 4,
|
||||
|
||||
[DIRECTION_RIGHT, DIRECTION_UP] => 5,
|
||||
[DIRECTION_DOWN, DIRECTION_LEFT] => 5,
|
||||
|
||||
[DIRECTION_UP, DIRECTION_RIGHT] => 6,
|
||||
[DIRECTION_LEFT, DIRECTION_DOWN] => 6,
|
||||
|
||||
[DIRECTION_DOWN, DIRECTION_RIGHT] => 7,
|
||||
[DIRECTION_LEFT, DIRECTION_UP] => 7,
|
||||
}
|
||||
def self.get_new_id
|
||||
newId = 1
|
||||
while !$game_map.events[newId].nil? do
|
||||
@@ -55,6 +68,7 @@ module FootprintVariables
|
||||
end
|
||||
|
||||
def self.show(event, position)
|
||||
return if $PokemonGlobal.boat
|
||||
if event != $game_player
|
||||
return if event.character_name == "" || event.character_name == "nil" || event.name.include?("/nofoot/")
|
||||
return if pbEventCommentInput(event, 0, "NoFoot")
|
||||
@@ -66,13 +80,34 @@ module FootprintVariables
|
||||
character_sprites = $scene.spriteset.character_sprites
|
||||
viewport = $scene.spriteset.viewport1
|
||||
footsprites = $scene.spriteset.footsprites
|
||||
|
||||
on_bike = (event == $game_player) && $PokemonGlobal.bicycle
|
||||
last_fp = footsprites.last
|
||||
if last_fp
|
||||
last_fp = nil if last_fp&.opacity <= 10
|
||||
end
|
||||
|
||||
nid = self.get_new_id
|
||||
rpgEvent = RPG::Event.new(position[0], position[1])
|
||||
rpgEvent.id = nid
|
||||
fev = Game_Event.new($game_map.map_id, rpgEvent, $game_map)
|
||||
eventsprite = Sprite_Character.new(viewport, fev)
|
||||
character_sprites.push(eventsprite)
|
||||
footsprites.push(Footsprite.new(eventsprite, fev, viewport, $game_map, position[2], nid, character_sprites, (event == $game_player)))
|
||||
|
||||
if on_bike && last_fp && last_fp.direction != position[2]
|
||||
curve_index = CURVE_FRAMES[[last_fp.direction, position[2]]]
|
||||
if curve_index
|
||||
footsprites.push(
|
||||
Footsprite.new(eventsprite, fev, viewport, $game_map, position[2], nid,
|
||||
character_sprites, true, curve_index)
|
||||
)
|
||||
end
|
||||
else
|
||||
footsprites.push(
|
||||
Footsprite.new(eventsprite, fev, viewport, $game_map, position[2], nid,
|
||||
character_sprites, (event == $game_player))
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -170,24 +205,30 @@ class Game_Character
|
||||
|
||||
def triggerLeaveTile
|
||||
leave_tile_footprints
|
||||
$scene.spriteset.putFootprint(self, get_last_pos) if foot_prints?
|
||||
$scene&.spriteset&.putFootprint(self, get_last_pos) if foot_prints?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Footsprite
|
||||
def initialize(sprite, event, viewport, map, direction, nid, chardata, player)
|
||||
attr_reader :direction
|
||||
attr_reader :opacity
|
||||
def initialize(sprite, event, viewport, map, direction, nid, chardata, player, curve_frame = nil)
|
||||
@rsprite = sprite
|
||||
# Sprite
|
||||
@sprite = Sprite.new(viewport)
|
||||
file = player && $PokemonGlobal.bicycle ? "footsetbike.png" : "footset.png"
|
||||
@sprite.bitmap = RPG::Cache.load_bitmap("Graphics/Pictures/", file)
|
||||
# Set position
|
||||
@realwidth = @sprite.bitmap.width / 4
|
||||
frame_count = (player && $PokemonGlobal.bicycle) ? 8 : 4
|
||||
@realwidth = @sprite.bitmap.width / frame_count
|
||||
@sprite.src_rect.width = @realwidth
|
||||
@opacity = FootprintVariables::FOOT_OPACITY
|
||||
setFootset(direction)
|
||||
# Values
|
||||
@direction = direction
|
||||
if curve_frame
|
||||
@sprite.src_rect.x = @realwidth * curve_frame # no longer + 4
|
||||
@sprite.opacity = @opacity
|
||||
else
|
||||
setFootset(@direction)
|
||||
end
|
||||
@map = map
|
||||
@event = event
|
||||
@disposed = false
|
||||
@@ -200,10 +241,10 @@ class Footsprite
|
||||
def setFootset(direction)
|
||||
@sprite.src_rect.x =
|
||||
case direction
|
||||
when 2 then 0 # Move down
|
||||
when 4 then @realwidth * 3 # Move left
|
||||
when 6 then @realwidth * 2 # Move right
|
||||
when 8 then @realwidth # Move up
|
||||
when DIRECTION_UP then 0
|
||||
when DIRECTION_DOWN then @realwidth
|
||||
when DIRECTION_LEFT then @realwidth * 2
|
||||
when DIRECTION_RIGHT then @realwidth * 3
|
||||
end
|
||||
@sprite.opacity = @opacity
|
||||
end
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
# Please give credit when using this. #
|
||||
#==============================================================================#
|
||||
|
||||
|
||||
SHADOW_IMG_FOLDER = "Graphics/Characters/"
|
||||
SHADOW_IMG_NAME = "shadow"
|
||||
|
||||
@@ -60,24 +59,20 @@ def pbShouldGetShadow?(event)
|
||||
return true if event.is_a?(Game_Player) # The player will always have a shadow
|
||||
page = pbGetActiveEventPage(event)
|
||||
return false unless page
|
||||
comments = page.list.select { |e| e.code == 108 || e.code == 408 }.map do |e|
|
||||
e.parameters.join
|
||||
end
|
||||
return false unless event.visible?
|
||||
return false if page.graphic.character_name == ""
|
||||
Always_Give_Shadow_If_Event_Name_Has.each do |e|
|
||||
name = event.name.clone
|
||||
unless Case_Sensitive
|
||||
e.downcase!
|
||||
name.downcase!
|
||||
end
|
||||
return true if name.include?(e) || comments.any? { |c| c.include?(e) }
|
||||
e.downcase
|
||||
name.downcase
|
||||
return true if name.include?(e)
|
||||
end
|
||||
No_Shadow_If_Event_Name_Has.each do |e|
|
||||
name = event.name.clone
|
||||
unless Case_Sensitive
|
||||
e.downcase!
|
||||
name.downcase!
|
||||
end
|
||||
return false if name.include?(e) || comments.any? { |c| c.include?(e) }
|
||||
e.downcase
|
||||
name.downcase
|
||||
|
||||
return false if name.include?(e)
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -140,7 +135,7 @@ class DependentEventSprites
|
||||
@sprites.clear
|
||||
$PokemonTemp.dependentEvents.eachEvent do |event, data|
|
||||
if data[2] == @map.map_id # Check current map
|
||||
spr = Sprite_Character.new(@viewport,event,true)
|
||||
spr = Sprite_Character.new(@viewport, event, true)
|
||||
@sprites.push(spr)
|
||||
end
|
||||
end
|
||||
@@ -149,12 +144,13 @@ end
|
||||
|
||||
unless defined?(pbGetActiveEventPage)
|
||||
def pbGetActiveEventPage(event, mapid = nil)
|
||||
return nil unless event
|
||||
mapid ||= event.map.map_id if event.respond_to?(:map)
|
||||
pages = (event.is_a?(RPG::Event) ? event.pages : event.instance_eval { @event.pages })
|
||||
for i in 0...pages.size
|
||||
c = pages[pages.size - 1 - i].condition
|
||||
ss = !(c.self_switch_valid && !$game_self_switches[[mapid,
|
||||
event.id,c.self_switch_ch]])
|
||||
event.id, c.self_switch_ch]])
|
||||
sw1 = !(c.switch1_valid && !$game_switches[c.switch1_id])
|
||||
sw2 = !(c.switch2_valid && !$game_switches[c.switch2_id])
|
||||
var = true
|
||||
@@ -180,19 +176,13 @@ class Sprite_Character
|
||||
attr_accessor :shadow
|
||||
|
||||
alias ow_shadow_init initialize
|
||||
|
||||
def initialize(viewport, character = nil, is_follower = false)
|
||||
@viewport = viewport
|
||||
@is_follower = is_follower
|
||||
ow_shadow_init(@viewport, character)
|
||||
|
||||
|
||||
|
||||
|
||||
return unless pbShouldGetShadow?(character)
|
||||
return if @is_follower && defined?(Toggle_Following_Switch) &&
|
||||
!$game_switches[Toggle_Following_Switch]
|
||||
return if @is_follower && defined?(Following_Activated_Switch) &&
|
||||
!$game_switches[Following_Activated_Switch]
|
||||
@character = character
|
||||
if @character.is_a?(Game_Event)
|
||||
page = pbGetActiveEventPage(@character)
|
||||
@@ -205,7 +195,7 @@ class Sprite_Character
|
||||
@shadow.dispose if @shadow
|
||||
@shadow = nil
|
||||
@shadow = Sprite.new(@viewport)
|
||||
@shadow.bitmap = RPG::Cache.load_bitmap(SHADOW_IMG_FOLDER,SHADOW_IMG_NAME)
|
||||
@shadow.bitmap = RPG::Cache.load_bitmap(SHADOW_IMG_FOLDER, SHADOW_IMG_NAME)
|
||||
# Center the shadow by halving the origin points
|
||||
@shadow.ox = @shadow.bitmap.width / 2.0
|
||||
@shadow.oy = @shadow.bitmap.height / 2.0
|
||||
@@ -241,6 +231,9 @@ class Sprite_Character
|
||||
# end
|
||||
@shadow.x = x
|
||||
@shadow.y = y - 6
|
||||
|
||||
@shadow.y += @character.shadow_offset if @character.shadow_offset
|
||||
|
||||
@shadow.z = self.z - 1
|
||||
|
||||
if @shadow
|
||||
@@ -252,12 +245,14 @@ class Sprite_Character
|
||||
end
|
||||
|
||||
alias ow_shadow_visible visible=
|
||||
|
||||
def visible=(value)
|
||||
ow_shadow_visible(value)
|
||||
@shadow.visible = value if @shadow
|
||||
end
|
||||
|
||||
alias ow_shadow_dispose dispose
|
||||
|
||||
def dispose
|
||||
ow_shadow_dispose
|
||||
@shadow.dispose if @shadow
|
||||
@@ -265,38 +260,40 @@ class Sprite_Character
|
||||
end
|
||||
|
||||
alias ow_shadow_update update
|
||||
|
||||
def update
|
||||
ow_shadow_update
|
||||
position_shadow
|
||||
|
||||
if @character.is_a?(Game_Event)
|
||||
page = pbGetActiveEventPage(@character)
|
||||
if @old_page != page
|
||||
@shadow.dispose if @shadow
|
||||
@shadow = nil
|
||||
if page && page.graphic && page.graphic.character_name != "" &&
|
||||
pbShouldGetShadow?(@character)
|
||||
unless @is_follower && defined?(Toggle_Following_Switch) &&
|
||||
!$game_switches[Toggle_Following_Switch]
|
||||
unless @is_follower && defined?(Following_Activated_Switch) &&
|
||||
!$game_switches[Following_Activated_Switch]
|
||||
make_shadow
|
||||
end
|
||||
end
|
||||
return unless @character
|
||||
page_index = nil
|
||||
if @character.is_a?(Game_Event) # && should_update?
|
||||
page_index = @character.page
|
||||
if @old_page_index != page_index
|
||||
if pbShouldGetShadow?(@character)
|
||||
make_shadow
|
||||
else
|
||||
dispose_shadow
|
||||
end
|
||||
end
|
||||
end
|
||||
@old_page_index = page_index
|
||||
update_shadow_for_bushdepth
|
||||
end
|
||||
|
||||
@old_page = (@character.is_a?(Game_Event) ? pbGetActiveEventPage(@character) : nil)
|
||||
|
||||
bushdepth = @character.bush_depth
|
||||
if @shadow
|
||||
@shadow.opacity = self.opacity
|
||||
@shadow.visible = (bushdepth == 0)
|
||||
def update_shadow_for_bushdepth
|
||||
bushdepth = @character&.bush_depth
|
||||
if @shadow && bushdepth
|
||||
@shadow&.opacity = self.opacity
|
||||
@shadow&.visible = (bushdepth == 0)
|
||||
if !self.visible || (@is_follower || @character == $game_player) &&
|
||||
($PokemonGlobal.surfing || $PokemonGlobal.diving)
|
||||
@shadow.visible = false
|
||||
($PokemonGlobal.surfing || $PokemonGlobal.diving || $PokemonGlobal.boat || $PokemonGlobal.acroBike)
|
||||
@shadow&.visible = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def dispose_shadow
|
||||
@shadow.dispose if @shadow && !@shadow.disposed?
|
||||
@shadow = nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
PUDDLE_ANIMATION_ID = 22
|
||||
PUDDLE_ANIMATION_ID = 31
|
||||
Events.onStepTakenFieldMovement += proc { |_sender, e|
|
||||
event = e[0] # Get the event affected by field movement
|
||||
event = e[0]
|
||||
if $scene.is_a?(Scene_Map)
|
||||
event.each_occupied_tile do |x, y|
|
||||
mapTerrainTag = $MapFactory.getTerrainTag(event.map.map_id, x, y, false)
|
||||
if $PokemonGlobal.surfing
|
||||
if isWaterTerrain?(mapTerrainTag) #&& $PokemonGlobal.stepcount % 2 ==0
|
||||
if isWaterTerrain?(mapTerrainTag) && !event.always_on_top
|
||||
$scene.spriteset.addUserAnimation(PUDDLE_ANIMATION_ID, event.x, event.y, true, 0)
|
||||
break
|
||||
end
|
||||
elsif $PokemonGlobal.boat
|
||||
$scene.spriteset.addUserAnimation(PUDDLE_ANIMATION_ID, event.x, event.y-2, true, 0)
|
||||
break
|
||||
else
|
||||
if mapTerrainTag == 16 #puddle
|
||||
pbSEPlay("puddle", 100) if event == $game_player && !$PokemonGlobal.surfing #only play sound effect in puddle
|
||||
if mapTerrainTag == 16
|
||||
pbSEPlay("puddle", 100) if event == $game_player && !$PokemonGlobal.surfing
|
||||
$scene.spriteset.addUserAnimation(PUDDLE_ANIMATION_ID, event.x, event.y, true, 0)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -19,5 +24,5 @@ Events.onStepTakenFieldMovement += proc { |_sender, e|
|
||||
}
|
||||
|
||||
def isWaterTerrain?(tag)
|
||||
return [5, 6, 17, 7, 9, 16].include?(tag)
|
||||
return [5, 6, 7, 9, 16, 27].include?(tag)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user