mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-24 07:16:00 +00:00
Fixed screen positioning bug when jumping over ledges near the top or left of a map
This commit is contained in:
@@ -544,18 +544,6 @@ end
|
||||
#===============================================================================
|
||||
# Player/event movement in the field
|
||||
#===============================================================================
|
||||
def pbLedge(_xOffset, _yOffset)
|
||||
if $game_player.pbFacingTerrainTag.ledge
|
||||
if pbJumpToward(2, true)
|
||||
$scene.spriteset.addUserAnimation(Settings::DUST_ANIMATION_ID, $game_player.x, $game_player.y, true, 1)
|
||||
$game_player.increase_steps
|
||||
$game_player.check_event_trigger_here([1, 2])
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbSlideOnIce
|
||||
if $game_player.pbTerrainTag.ice && $game_player.can_move_in_direction?($game_player.direction)
|
||||
$PokemonGlobal.ice_sliding = true
|
||||
@@ -605,29 +593,6 @@ def pbMoveTowardPlayer(event)
|
||||
$PokemonMap&.addMovedEvent(event.id)
|
||||
end
|
||||
|
||||
def pbJumpToward(dist = 1, playSound = false, cancelSurf = false)
|
||||
x = $game_player.x
|
||||
y = $game_player.y
|
||||
case $game_player.direction
|
||||
when 2 then $game_player.jump(0, dist) # down
|
||||
when 4 then $game_player.jump(-dist, 0) # left
|
||||
when 6 then $game_player.jump(dist, 0) # right
|
||||
when 8 then $game_player.jump(0, -dist) # up
|
||||
end
|
||||
if $game_player.x != x || $game_player.y != y
|
||||
pbSEPlay("Player jump") if playSound
|
||||
$PokemonEncounters.reset_step_count if cancelSurf
|
||||
$game_temp.ending_surf = true if cancelSurf
|
||||
while $game_player.jumping?
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Bridges, cave escape points, and setting the heal point
|
||||
#===============================================================================
|
||||
|
||||
@@ -745,24 +745,16 @@ def pbStartSurfing
|
||||
$stats.surf_count += 1
|
||||
pbUpdateVehicle
|
||||
$game_temp.surf_base_coords = $map_factory.getFacingCoords($game_player.x, $game_player.y, $game_player.direction)
|
||||
pbJumpToward
|
||||
$game_temp.surf_base_coords = nil
|
||||
$game_player.check_event_trigger_here([1, 2])
|
||||
$game_player.jumpForward
|
||||
end
|
||||
|
||||
def pbEndSurf(_xOffset, _yOffset)
|
||||
return false if !$PokemonGlobal.surfing
|
||||
x = $game_player.x
|
||||
y = $game_player.y
|
||||
if $game_map.terrain_tag(x, y).can_surf && !$game_player.pbFacingTerrainTag.can_surf
|
||||
$game_temp.surf_base_coords = [x, y]
|
||||
if pbJumpToward(1, false, true)
|
||||
$game_map.autoplayAsCue
|
||||
$game_player.increase_steps
|
||||
result = $game_player.check_event_trigger_here([1, 2])
|
||||
pbOnStepTaken(result)
|
||||
end
|
||||
$game_temp.surf_base_coords = nil
|
||||
return false if $game_player.pbFacingTerrainTag.can_surf
|
||||
base_coords = [$game_player.x, $game_player.y]
|
||||
if $game_player.jumpForward
|
||||
$game_temp.surf_base_coords = base_coords
|
||||
$game_temp.ending_surf = true
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@@ -792,6 +784,23 @@ EventHandlers.add(:on_player_interact, :start_surfing,
|
||||
}
|
||||
)
|
||||
|
||||
# Do things after a jump to start/end surfing.
|
||||
EventHandlers.add(:on_step_taken, :surf_jump,
|
||||
proc { |event|
|
||||
next if !$scene.is_a?(Scene_Map) || !event.is_a?(Game_Player)
|
||||
next if !$game_temp.surf_base_coords
|
||||
# Hide the temporary surf base graphic after jumping onto/off it
|
||||
$game_temp.surf_base_coords = nil
|
||||
# Finish up dismounting from surfing
|
||||
if $game_temp.ending_surf
|
||||
pbCancelVehicles
|
||||
$PokemonEncounters.reset_step_count
|
||||
$game_map.autoplayAsCue # Play regular map BGM
|
||||
$game_temp.ending_surf = false
|
||||
end
|
||||
}
|
||||
)
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:SURF, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg)
|
||||
if $PokemonGlobal.surfing
|
||||
|
||||
Reference in New Issue
Block a user