Fixed sliding on ice having the camera lag behind

This commit is contained in:
Maruno17
2023-01-03 15:05:54 +00:00
parent 9dd774a767
commit 707cd143d8
8 changed files with 24 additions and 37 deletions

View File

@@ -188,7 +188,7 @@ class Scene_Map
end end
end end
return if $game_temp.message_window_showing return if $game_temp.message_window_showing
if !pbMapInterpreterRunning? if !pbMapInterpreterRunning? && !$PokemonGlobal.ice_sliding
if Input.trigger?(Input::USE) if Input.trigger?(Input::USE)
$game_temp.interact_calling = true $game_temp.interact_calling = true
elsif Input.trigger?(Input::ACTION) elsif Input.trigger?(Input::ACTION)

View File

@@ -4,7 +4,6 @@
# This class handles screen maintenance data, such as change in color tone, # This class handles screen maintenance data, such as change in color tone,
# flashing, etc. Refer to "$game_screen" for the instance of this class. # flashing, etc. Refer to "$game_screen" for the instance of this class.
#=============================================================================== #===============================================================================
class Game_Screen class Game_Screen
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# * Public Instance Variables # * Public Instance Variables

View File

@@ -234,7 +234,7 @@ class Game_Map
# Make water tiles passable if player is surfing # Make water tiles passable if player is surfing
return true if $PokemonGlobal.surfing && terrain.can_surf && !terrain.waterfall return true if $PokemonGlobal.surfing && terrain.can_surf && !terrain.waterfall
# Prevent cycling in really tall grass/on ice # 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 # Depend on passability of bridge tile if on bridge
if terrain.bridge && $PokemonGlobal.bridge > 0 if terrain.bridge && $PokemonGlobal.bridge > 0
return (passage & bit == 0 && passage & 0x0f != 0x0f) return (passage & bit == 0 && passage & 0x0f != 0x0f)

View File

@@ -135,7 +135,7 @@ class Game_Player < Game_Character
else else
$stats.distance_walked += 1 $stats.distance_walked += 1
end end
$stats.distance_slid_on_ice += 1 if $PokemonGlobal.sliding $stats.distance_slid_on_ice += 1 if $PokemonGlobal.ice_sliding
increase_steps increase_steps
end end
elsif !check_event_trigger_touch(dir) elsif !check_event_trigger_touch(dir)
@@ -423,12 +423,12 @@ class Game_Player < Game_Character
def update def update
last_real_x = @real_x last_real_x = @real_x
last_real_y = @real_y last_real_y = @real_y
@last_terrain_tag = pbTerrainTag
super super
update_stop if $game_temp.in_menu && @stopped_last_frame update_stop if $game_temp.in_menu && @stopped_last_frame
update_screen_position(last_real_x, last_real_y) update_screen_position(last_real_x, last_real_y)
# Update dependent events # Update dependent events
if (!@moved_last_frame || @stopped_last_frame || if (!@moved_last_frame || @stopped_last_frame) && (moving? || jumping?)
(@stopped_this_frame && $PokemonGlobal.sliding)) && (moving? || jumping?)
$game_temp.followers.move_followers $game_temp.followers.move_followers
end end
$game_temp.followers.update $game_temp.followers.update
@@ -445,8 +445,10 @@ class Game_Player < Game_Character
def update_command_new def update_command_new
dir = Input.dir4 dir = Input.dir4
unless pbMapInterpreterRunning? || $game_temp.message_window_showing || if $PokemonGlobal.ice_sliding
$game_temp.in_mini_update || $game_temp.in_menu 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 # Move player in the direction the directional button is being pressed
if @moved_last_frame || if @moved_last_frame ||
(dir > 0 && dir == @lastdir && Graphics.frame_count - @lastdirframe > Graphics.frame_rate / 20) (dir > 0 && dir == @lastdir && Graphics.frame_count - @lastdirframe > Graphics.frame_rate / 20)
@@ -472,7 +474,7 @@ class Game_Player < Game_Character
def update_move def update_move
if !@moved_last_frame || @stopped_last_frame # Started a new step 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) set_movement_type(:ice_sliding)
else else
faster = can_run? faster = can_run?
@@ -543,7 +545,7 @@ class Game_Player < Game_Character
end end
def update_event_triggering def update_event_triggering
return if moving? return if moving? || $PokemonGlobal.ice_sliding
# Try triggering events upon walking into them/in front of them # Try triggering events upon walking into them/in front of them
if @moved_this_frame if @moved_this_frame
$game_temp.followers.turn_followers $game_temp.followers.turn_followers

View File

@@ -254,7 +254,7 @@ class Game_FollowerFactory
end end
event.move_speed = leader.move_speed event.move_speed = leader.move_speed
event.transparent = !follower.visible? event.transparent = !follower.visible?
if $PokemonGlobal.sliding if $PokemonGlobal.ice_sliding
event.straighten event.straighten
event.walk_anime = false event.walk_anime = false
else else

View File

@@ -57,6 +57,7 @@ module GameData
@bridge = hash[:bridge] || false @bridge = hash[:bridge] || false
@shows_reflections = hash[:shows_reflections] || false @shows_reflections = hash[:shows_reflections] || false
@must_walk = hash[:must_walk] || false @must_walk = hash[:must_walk] || false
@must_walk_or_run = hash[:must_walk_or_run] || false
@ignore_passability = hash[:ignore_passability] || false @ignore_passability = hash[:ignore_passability] || false
end end
@@ -163,7 +164,7 @@ GameData::TerrainTag.register({
:id_number => 12, :id_number => 12,
:battle_environment => :Ice, :battle_environment => :Ice,
:ice => true, :ice => true,
:must_walk => true :must_walk_or_run => true
}) })
GameData::TerrainTag.register({ GameData::TerrainTag.register({

View File

@@ -166,7 +166,7 @@ EventHandlers.add(:on_step_taken, :auto_move_player,
currentTag = $game_player.pbTerrainTag currentTag = $game_player.pbTerrainTag
if currentTag.waterfall_crest if currentTag.waterfall_crest
pbDescendWaterfall pbDescendWaterfall
elsif currentTag.ice && !$PokemonGlobal.sliding elsif currentTag.ice || $PokemonGlobal.ice_sliding
pbSlideOnIce pbSlideOnIce
end end
} }
@@ -573,30 +573,14 @@ def pbLedge(_xOffset, _yOffset)
end end
def pbSlideOnIce def pbSlideOnIce
return if !$game_player.pbTerrainTag.ice if $game_player.pbTerrainTag.ice && $game_player.can_move_in_direction?($game_player.direction)
$game_temp.followers.update $PokemonGlobal.ice_sliding = true
$PokemonGlobal.sliding = true $game_player.straighten
direction = $game_player.direction $game_player.walk_anime = false
oldwalkanime = $game_player.walk_anime return
$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
end end
$game_player.center($game_player.x, $game_player.y) $PokemonGlobal.ice_sliding = false
$game_player.straighten $game_player.walk_anime = true
$game_player.walk_anime = oldwalkanime
$PokemonGlobal.sliding = false
end end
def pbTurnTowardEvent(event, otherEvent) def pbTurnTowardEvent(event, otherEvent)

View File

@@ -522,7 +522,8 @@ end
#=============================================================================== #===============================================================================
def pbBikeCheck def pbBikeCheck
if $PokemonGlobal.surfing || $PokemonGlobal.diving || 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.")) pbMessage(_INTL("Can't use that here."))
return false return false
end end