diff --git a/Data/Scripts/003_Game processing/002_Scene_Map.rb b/Data/Scripts/003_Game processing/002_Scene_Map.rb index b5c195a08..a0ca2391b 100644 --- a/Data/Scripts/003_Game processing/002_Scene_Map.rb +++ b/Data/Scripts/003_Game processing/002_Scene_Map.rb @@ -188,7 +188,7 @@ class Scene_Map end end return if $game_temp.message_window_showing - if !pbMapInterpreterRunning? && !$PokemonGlobal.ice_sliding + if !pbMapInterpreterRunning? && !$PokemonGlobal.forced_movement? if Input.trigger?(Input::USE) $game_temp.interact_calling = true elsif Input.trigger?(Input::ACTION) diff --git a/Data/Scripts/004_Game classes/008_Game_Player.rb b/Data/Scripts/004_Game classes/008_Game_Player.rb index 00414dac3..6b1b18f6e 100644 --- a/Data/Scripts/004_Game classes/008_Game_Player.rb +++ b/Data/Scripts/004_Game classes/008_Game_Player.rb @@ -77,6 +77,9 @@ class Game_Player < Game_Character self.move_speed = (type == :surfing_jumping) ? 3 : 4 end new_charset = pbGetPlayerCharset(meta.surf_charset) + when :descending_waterfall, :ascending_waterfall + self.move_speed = 2 if !@move_route_forcing + new_charset = pbGetPlayerCharset(meta.surf_charset) when :cycling, :cycling_fast, :cycling_jumping, :cycling_stopped if !@move_route_forcing self.move_speed = (type == :cycling_jumping) ? 3 : 5 @@ -148,6 +151,10 @@ class Game_Player < Game_Character increase_steps end return + elsif pbFacingTerrainTag.waterfall_crest && dir == 2 + $PokemonGlobal.descending_waterfall = true + $game_player.through = true + $stats.waterfalls_descended += 1 end # Jumping out of surfing back onto land return if pbEndSurf(x_offset, y_offset) @@ -421,7 +428,7 @@ class Game_Player < Game_Character def update_command_new dir = Input.dir4 - if $PokemonGlobal.ice_sliding + if $PokemonGlobal.forced_movement? move_forward elsif !pbMapInterpreterRunning? && !$game_temp.message_window_showing && !$game_temp.in_mini_update && !$game_temp.in_menu @@ -452,6 +459,10 @@ class Game_Player < Game_Character if !@moved_last_frame || @stopped_last_frame # Started a new step if $PokemonGlobal.ice_sliding || @last_terrain_tag.ice set_movement_type(:ice_sliding) + elsif $PokemonGlobal.descending_waterfall + set_movement_type(:descending_waterfall) + elsif $PokemonGlobal.ascending_waterfall + set_movement_type(:ascending_waterfall) else faster = can_run? if $PokemonGlobal&.diving @@ -528,7 +539,7 @@ class Game_Player < Game_Character end def update_event_triggering - return if moving? || jumping? || $PokemonGlobal.ice_sliding + return if moving? || jumping? || $PokemonGlobal.forced_movement? # Try triggering events upon walking into them/in front of them if @moved_this_frame $game_temp.followers.turn_followers diff --git a/Data/Scripts/012_Overworld/001_Overworld.rb b/Data/Scripts/012_Overworld/001_Overworld.rb index 73189a318..9f9dcfffe 100644 --- a/Data/Scripts/012_Overworld/001_Overworld.rb +++ b/Data/Scripts/012_Overworld/001_Overworld.rb @@ -159,8 +159,9 @@ EventHandlers.add(:on_step_taken, :auto_move_player, next if !$scene.is_a?(Scene_Map) next if event != $game_player currentTag = $game_player.pbTerrainTag - if currentTag.waterfall_crest - pbDescendWaterfall + if currentTag.waterfall_crest || currentTag.waterfall || + $PokemonGlobal.descending_waterfall || $PokemonGlobal.ascending_waterfall + pbTraverseWaterfall elsif currentTag.ice || $PokemonGlobal.ice_sliding pbSlideOnIce end diff --git a/Data/Scripts/012_Overworld/002_Overworld_Metadata.rb b/Data/Scripts/012_Overworld/002_Overworld_Metadata.rb index f5f846a2a..148211a6c 100644 --- a/Data/Scripts/012_Overworld/002_Overworld_Metadata.rb +++ b/Data/Scripts/012_Overworld/002_Overworld_Metadata.rb @@ -8,6 +8,8 @@ class PokemonGlobalMetadata attr_accessor :surfing attr_accessor :diving attr_accessor :ice_sliding + attr_accessor :descending_waterfall + attr_accessor :ascending_waterfall attr_accessor :fishing # Player data attr_accessor :startTime @@ -59,6 +61,8 @@ class PokemonGlobalMetadata @surfing = false @diving = false @ice_sliding = false + @descending_waterfall = false + @ascending_waterfall = false @fishing = false # Player data @startTime = Time.now @@ -113,6 +117,10 @@ class PokemonGlobalMetadata @encounter_version = value $PokemonEncounters.setup($game_map.map_id) if $PokemonEncounters && $game_map end + + def forced_movement? + return @ice_sliding || @descending_waterfall || @ascending_waterfall + end end #=============================================================================== diff --git a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb index 36d6bffeb..ba004306e 100644 --- a/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb +++ b/Data/Scripts/012_Overworld/004_Overworld_FieldMoves.rb @@ -886,40 +886,38 @@ HiddenMoveHandlers::UseMove.add(:TELEPORT, proc { |move, pokemon| #=============================================================================== # Waterfall #=============================================================================== +# Starts the ascending of a waterfall. def pbAscendWaterfall return if $game_player.direction != 8 # Can't ascend if not facing up terrain = $game_player.pbFacingTerrainTag return if !terrain.waterfall && !terrain.waterfall_crest $stats.waterfall_count += 1 - oldthrough = $game_player.through - oldmovespeed = $game_player.move_speed - $game_player.through = true - $game_player.move_speed = 2 - loop do - $game_player.move_up - terrain = $game_player.pbTerrainTag - break if !terrain.waterfall && !terrain.waterfall_crest - end - $game_player.through = oldthrough - $game_player.move_speed = oldmovespeed + $PokemonGlobal.ascending_waterfall = true + $game_player.through = true end -def pbDescendWaterfall - return if $game_player.direction != 2 # Can't descend if not facing down - terrain = $game_player.pbFacingTerrainTag - return if !terrain.waterfall && !terrain.waterfall_crest - $stats.waterfalls_descended += 1 - oldthrough = $game_player.through - oldmovespeed = $game_player.move_speed - $game_player.through = true - $game_player.move_speed = 2 - loop do - $game_player.move_down +# Triggers after finishing each step while ascending/descending a waterfall. +def pbTraverseWaterfall + if $game_player.direction == 2 # Facing down; descending terrain = $game_player.pbTerrainTag - break if !terrain.waterfall && !terrain.waterfall_crest + if !terrain.waterfall && !terrain.waterfall_crest + $PokemonGlobal.descending_waterfall = false + $game_player.through = false + return + end + $stats.waterfalls_descended += 1 if !$PokemonGlobal.descending_waterfall + $PokemonGlobal.descending_waterfall = true + $game_player.through = true + elsif $PokemonGlobal.ascending_waterfall + terrain = $game_player.pbTerrainTag + if !terrain.waterfall && !terrain.waterfall_crest + $PokemonGlobal.ascending_waterfall = false + $game_player.through = false + return + end + $PokemonGlobal.ascending_waterfall = true + $game_player.through = true end - $game_player.through = oldthrough - $game_player.move_speed = oldmovespeed end def pbWaterfall diff --git a/mkxp.json b/mkxp.json index 8adb2af3a..fa0aa023d 100644 --- a/mkxp.json +++ b/mkxp.json @@ -137,7 +137,7 @@ // This option may be force-disabled at build time. // (default: disabled) // - // "syncToRefreshrate": false, + "syncToRefreshrate": true, // A list of fonts to render without alpha blending.