Synced FPS to monitor's refresh rate, fixed broken waterfall movement

This commit is contained in:
Maruno17
2023-06-03 22:33:49 +01:00
parent 1901675e33
commit 3470f9769c
6 changed files with 49 additions and 31 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -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
$PokemonGlobal.ascending_waterfall = true
$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
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

View File

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