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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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