Fixed screen positioning bug when jumping over ledges near the top or left of a map

This commit is contained in:
Maruno17
2023-01-26 18:33:21 +00:00
parent b0b6e675c3
commit a0af8e6eb5
4 changed files with 78 additions and 112 deletions

View File

@@ -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