Fixed screen mispositioning while sliding on ice, fixed broken Marts

This commit is contained in:
Maruno17
2021-03-01 17:12:18 +00:00
parent 57b3fe1b09
commit fa99c2bcd7
8 changed files with 17 additions and 26 deletions

View File

@@ -54,10 +54,10 @@ class Game_Temp
@message_window_showing = false
@player_transferring = false
@transition_processing = false
@mart_prices = []
@mart_prices = {}
end
def clear_mart_prices
@mart_prices = []
@mart_prices = {}
end
end

View File

@@ -329,6 +329,7 @@ class Game_Map
end
def display_x=(value)
return if @display_x == value
@display_x = value
if GameData::MapMetadata.exists?(self.map_id) && GameData::MapMetadata.get(self.map_id).snap_edges
max_x = (self.width - Graphics.width*1.0/TILE_WIDTH) * REAL_RES_X
@@ -338,6 +339,7 @@ class Game_Map
end
def display_y=(value)
return if @display_y == value
@display_y = value
if GameData::MapMetadata.exists?(self.map_id) && GameData::MapMetadata.get(self.map_id).snap_edges
max_y = (self.height - Graphics.height*1.0/TILE_HEIGHT) * REAL_RES_Y

View File

@@ -10,6 +10,9 @@ class Game_Player < Game_Character
attr_accessor :charsetData
attr_accessor :encounter_count
SCREEN_CENTER_X = (Settings::SCREEN_WIDTH / 2 - Game_Map::TILE_WIDTH / 2) * Game_Map::X_SUBPIXELS
SCREEN_CENTER_Y = (Settings::SCREEN_HEIGHT / 2 - Game_Map::TILE_HEIGHT / 2) * Game_Map::Y_SUBPIXELS
def initialize(*arg)
super(*arg)
@lastdir=0
@@ -191,12 +194,8 @@ class Game_Player < Game_Character
# * Set Map Display Position to Center of Screen
#-----------------------------------------------------------------------------
def center(x, y)
center_x = (Graphics.width/2 - Game_Map::TILE_WIDTH/2) * Game_Map::X_SUBPIXELS
center_y = (Graphics.height/2 - Game_Map::TILE_HEIGHT/2) * Game_Map::Y_SUBPIXELS
dispx = x * Game_Map::REAL_RES_X - center_x
dispy = y * Game_Map::REAL_RES_Y - center_y
self.map.display_x = dispx
self.map.display_y = dispy
self.map.display_x = x * Game_Map::REAL_RES_X - SCREEN_CENTER_X
self.map.display_y = y * Game_Map::REAL_RES_Y - SCREEN_CENTER_Y
end
#-----------------------------------------------------------------------------
@@ -372,21 +371,9 @@ class Game_Player < Game_Character
# Center player on-screen
def update_screen_position(last_real_x, last_real_y)
return if !@moved_this_frame
center_x = (Graphics.width/2 - Game_Map::TILE_WIDTH/2) * Game_Map::X_SUBPIXELS
center_y = (Graphics.height/2 - Game_Map::TILE_HEIGHT/2) * Game_Map::Y_SUBPIXELS
if @real_y < last_real_y and @real_y - $game_map.display_y < center_y
$game_map.scroll_up(last_real_y - @real_y)
end
if @real_y > last_real_y and @real_y - $game_map.display_y > center_y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < center_x
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > center_x
$game_map.scroll_right(@real_x - last_real_x)
end
return if self.map.scrolling? || !(@moved_last_frame || @moved_this_frame)
self.map.display_x = @real_x - SCREEN_CENTER_X
self.map.display_y = @real_y - SCREEN_CENTER_Y
end
def update_event_triggering

View File

@@ -196,8 +196,10 @@ class Scene_Map
end
end
unless $game_player.moving?
if $game_temp.menu_calling; call_menu
elsif $game_temp.debug_calling; call_debug
if $game_temp.menu_calling
call_menu
elsif $game_temp.debug_calling
call_debug
elsif $PokemonTemp.keyItemCalling
$PokemonTemp.keyItemCalling = false
$game_player.straighten

View File

@@ -787,9 +787,9 @@ def pbSlideOnIce(event=nil)
break if !PBTerrain.isIce?(pbGetTerrainTag(event))
event.move_forward
while event.moving?
pbUpdateSceneMap
Graphics.update
Input.update
pbUpdateSceneMap
end
end
event.center(event.x,event.y)