From 707cd143d84d0944fea5dd83a03f2b2b8c7994c5 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Tue, 3 Jan 2023 15:05:54 +0000 Subject: [PATCH] Fixed sliding on ice having the camera lag behind --- .../003_Game processing/002_Scene_Map.rb | 2 +- .../004_Game classes/001_Game_Screen.rb | 1 - Data/Scripts/004_Game classes/004_Game_Map.rb | 2 +- .../004_Game classes/009_Game_Player.rb | 16 ++++++---- .../012_Game_FollowerFactory.rb | 2 +- .../001_Hardcoded data/011_TerrainTag.rb | 3 +- Data/Scripts/012_Overworld/001_Overworld.rb | 32 +++++-------------- Data/Scripts/013_Items/001_Item_Utilities.rb | 3 +- 8 files changed, 24 insertions(+), 37 deletions(-) diff --git a/Data/Scripts/003_Game processing/002_Scene_Map.rb b/Data/Scripts/003_Game processing/002_Scene_Map.rb index 7309669fb..ad261d02e 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? + if !pbMapInterpreterRunning? && !$PokemonGlobal.ice_sliding if Input.trigger?(Input::USE) $game_temp.interact_calling = true elsif Input.trigger?(Input::ACTION) diff --git a/Data/Scripts/004_Game classes/001_Game_Screen.rb b/Data/Scripts/004_Game classes/001_Game_Screen.rb index 62d7c69b3..e93cc76ce 100644 --- a/Data/Scripts/004_Game classes/001_Game_Screen.rb +++ b/Data/Scripts/004_Game classes/001_Game_Screen.rb @@ -4,7 +4,6 @@ # This class handles screen maintenance data, such as change in color tone, # flashing, etc. Refer to "$game_screen" for the instance of this class. #=============================================================================== - class Game_Screen #----------------------------------------------------------------------------- # * Public Instance Variables diff --git a/Data/Scripts/004_Game classes/004_Game_Map.rb b/Data/Scripts/004_Game classes/004_Game_Map.rb index 983fc952e..dc99b8bf8 100644 --- a/Data/Scripts/004_Game classes/004_Game_Map.rb +++ b/Data/Scripts/004_Game classes/004_Game_Map.rb @@ -234,7 +234,7 @@ class Game_Map # Make water tiles passable if player is surfing return true if $PokemonGlobal.surfing && terrain.can_surf && !terrain.waterfall # Prevent cycling in really tall grass/on ice - return false if $PokemonGlobal.bicycle && terrain.must_walk + return false if $PokemonGlobal.bicycle && (terrain.must_walk || terrain.must_walk_or_run) # Depend on passability of bridge tile if on bridge if terrain.bridge && $PokemonGlobal.bridge > 0 return (passage & bit == 0 && passage & 0x0f != 0x0f) diff --git a/Data/Scripts/004_Game classes/009_Game_Player.rb b/Data/Scripts/004_Game classes/009_Game_Player.rb index 7ed090440..c38be6037 100644 --- a/Data/Scripts/004_Game classes/009_Game_Player.rb +++ b/Data/Scripts/004_Game classes/009_Game_Player.rb @@ -135,7 +135,7 @@ class Game_Player < Game_Character else $stats.distance_walked += 1 end - $stats.distance_slid_on_ice += 1 if $PokemonGlobal.sliding + $stats.distance_slid_on_ice += 1 if $PokemonGlobal.ice_sliding increase_steps end elsif !check_event_trigger_touch(dir) @@ -423,12 +423,12 @@ class Game_Player < Game_Character def update last_real_x = @real_x last_real_y = @real_y + @last_terrain_tag = pbTerrainTag super update_stop if $game_temp.in_menu && @stopped_last_frame update_screen_position(last_real_x, last_real_y) # Update dependent events - if (!@moved_last_frame || @stopped_last_frame || - (@stopped_this_frame && $PokemonGlobal.sliding)) && (moving? || jumping?) + if (!@moved_last_frame || @stopped_last_frame) && (moving? || jumping?) $game_temp.followers.move_followers end $game_temp.followers.update @@ -445,8 +445,10 @@ class Game_Player < Game_Character def update_command_new dir = Input.dir4 - unless pbMapInterpreterRunning? || $game_temp.message_window_showing || - $game_temp.in_mini_update || $game_temp.in_menu + if $PokemonGlobal.ice_sliding + move_forward + elsif !pbMapInterpreterRunning? && !$game_temp.message_window_showing && + !$game_temp.in_mini_update && !$game_temp.in_menu # Move player in the direction the directional button is being pressed if @moved_last_frame || (dir > 0 && dir == @lastdir && Graphics.frame_count - @lastdirframe > Graphics.frame_rate / 20) @@ -472,7 +474,7 @@ class Game_Player < Game_Character def update_move if !@moved_last_frame || @stopped_last_frame # Started a new step - if pbTerrainTag.ice + if $PokemonGlobal.ice_sliding || @last_terrain_tag.ice set_movement_type(:ice_sliding) else faster = can_run? @@ -543,7 +545,7 @@ class Game_Player < Game_Character end def update_event_triggering - return if moving? + return if moving? || $PokemonGlobal.ice_sliding # 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/004_Game classes/012_Game_FollowerFactory.rb b/Data/Scripts/004_Game classes/012_Game_FollowerFactory.rb index 1619f3db5..5d76476d7 100644 --- a/Data/Scripts/004_Game classes/012_Game_FollowerFactory.rb +++ b/Data/Scripts/004_Game classes/012_Game_FollowerFactory.rb @@ -254,7 +254,7 @@ class Game_FollowerFactory end event.move_speed = leader.move_speed event.transparent = !follower.visible? - if $PokemonGlobal.sliding + if $PokemonGlobal.ice_sliding event.straighten event.walk_anime = false else diff --git a/Data/Scripts/010_Data/001_Hardcoded data/011_TerrainTag.rb b/Data/Scripts/010_Data/001_Hardcoded data/011_TerrainTag.rb index 4c188fa98..16a3c4c9f 100644 --- a/Data/Scripts/010_Data/001_Hardcoded data/011_TerrainTag.rb +++ b/Data/Scripts/010_Data/001_Hardcoded data/011_TerrainTag.rb @@ -57,6 +57,7 @@ module GameData @bridge = hash[:bridge] || false @shows_reflections = hash[:shows_reflections] || false @must_walk = hash[:must_walk] || false + @must_walk_or_run = hash[:must_walk_or_run] || false @ignore_passability = hash[:ignore_passability] || false end @@ -163,7 +164,7 @@ GameData::TerrainTag.register({ :id_number => 12, :battle_environment => :Ice, :ice => true, - :must_walk => true + :must_walk_or_run => true }) GameData::TerrainTag.register({ diff --git a/Data/Scripts/012_Overworld/001_Overworld.rb b/Data/Scripts/012_Overworld/001_Overworld.rb index 0fab28480..06caf520e 100644 --- a/Data/Scripts/012_Overworld/001_Overworld.rb +++ b/Data/Scripts/012_Overworld/001_Overworld.rb @@ -166,7 +166,7 @@ EventHandlers.add(:on_step_taken, :auto_move_player, currentTag = $game_player.pbTerrainTag if currentTag.waterfall_crest pbDescendWaterfall - elsif currentTag.ice && !$PokemonGlobal.sliding + elsif currentTag.ice || $PokemonGlobal.ice_sliding pbSlideOnIce end } @@ -573,30 +573,14 @@ def pbLedge(_xOffset, _yOffset) end def pbSlideOnIce - return if !$game_player.pbTerrainTag.ice - $game_temp.followers.update - $PokemonGlobal.sliding = true - direction = $game_player.direction - oldwalkanime = $game_player.walk_anime - $game_player.straighten - $game_player.walk_anime = false - first_loop = true - loop do - break if !$game_player.can_move_in_direction?(direction) - break if !$game_player.pbTerrainTag.ice - $game_player.move_forward - $game_temp.followers.move_followers if first_loop - while $game_player.moving? - pbUpdateSceneMap - Graphics.update - Input.update - end - first_loop = false + if $game_player.pbTerrainTag.ice && $game_player.can_move_in_direction?($game_player.direction) + $PokemonGlobal.ice_sliding = true + $game_player.straighten + $game_player.walk_anime = false + return end - $game_player.center($game_player.x, $game_player.y) - $game_player.straighten - $game_player.walk_anime = oldwalkanime - $PokemonGlobal.sliding = false + $PokemonGlobal.ice_sliding = false + $game_player.walk_anime = true end def pbTurnTowardEvent(event, otherEvent) diff --git a/Data/Scripts/013_Items/001_Item_Utilities.rb b/Data/Scripts/013_Items/001_Item_Utilities.rb index 7e0b9ad1f..359f17c3c 100644 --- a/Data/Scripts/013_Items/001_Item_Utilities.rb +++ b/Data/Scripts/013_Items/001_Item_Utilities.rb @@ -522,7 +522,8 @@ end #=============================================================================== def pbBikeCheck if $PokemonGlobal.surfing || $PokemonGlobal.diving || - (!$PokemonGlobal.bicycle && $game_player.pbTerrainTag.must_walk) + (!$PokemonGlobal.bicycle && + ($game_player.pbTerrainTag.must_walk || $game_player.pbTerrainTag.must_walk_or_run)) pbMessage(_INTL("Can't use that here.")) return false end