From fa99c2bcd75899e307bfa904d5c24e2b864452ed Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Mon, 1 Mar 2021 17:12:18 +0000 Subject: [PATCH] Fixed screen mispositioning while sliding on ice, fixed broken Marts --- .../001_Game_Temp.rb | 4 +-- .../{009_Game_Map.rb => 004_Game_Map.rb} | 2 ++ ...oscroll.rb => 004a_Game_Map_Autoscroll.rb} | 0 .../{011_MapFactory.rb => 004b_MapFactory.rb} | 0 .../003_Game classes/007_Game_Player.rb | 29 +++++-------------- ...CommonEvent.rb => 012_Game_CommonEvent.rb} | 0 .../006_Game processing/002_Scene_Map.rb | 6 ++-- .../Scripts/013_Overworld/002_PField_Field.rb | 2 +- 8 files changed, 17 insertions(+), 26 deletions(-) rename Data/Scripts/003_Game classes/{009_Game_Map.rb => 004_Game_Map.rb} (99%) rename Data/Scripts/003_Game classes/{010_Game_Map_Autoscroll.rb => 004a_Game_Map_Autoscroll.rb} (100%) rename Data/Scripts/003_Game classes/{011_MapFactory.rb => 004b_MapFactory.rb} (100%) rename Data/Scripts/003_Game classes/{004_Game_CommonEvent.rb => 012_Game_CommonEvent.rb} (100%) diff --git a/Data/Scripts/002_Switches and Variables/001_Game_Temp.rb b/Data/Scripts/002_Switches and Variables/001_Game_Temp.rb index 2a74211ff..b533d643f 100644 --- a/Data/Scripts/002_Switches and Variables/001_Game_Temp.rb +++ b/Data/Scripts/002_Switches and Variables/001_Game_Temp.rb @@ -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 diff --git a/Data/Scripts/003_Game classes/009_Game_Map.rb b/Data/Scripts/003_Game classes/004_Game_Map.rb similarity index 99% rename from Data/Scripts/003_Game classes/009_Game_Map.rb rename to Data/Scripts/003_Game classes/004_Game_Map.rb index c42dab159..f009de92d 100644 --- a/Data/Scripts/003_Game classes/009_Game_Map.rb +++ b/Data/Scripts/003_Game classes/004_Game_Map.rb @@ -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 diff --git a/Data/Scripts/003_Game classes/010_Game_Map_Autoscroll.rb b/Data/Scripts/003_Game classes/004a_Game_Map_Autoscroll.rb similarity index 100% rename from Data/Scripts/003_Game classes/010_Game_Map_Autoscroll.rb rename to Data/Scripts/003_Game classes/004a_Game_Map_Autoscroll.rb diff --git a/Data/Scripts/003_Game classes/011_MapFactory.rb b/Data/Scripts/003_Game classes/004b_MapFactory.rb similarity index 100% rename from Data/Scripts/003_Game classes/011_MapFactory.rb rename to Data/Scripts/003_Game classes/004b_MapFactory.rb diff --git a/Data/Scripts/003_Game classes/007_Game_Player.rb b/Data/Scripts/003_Game classes/007_Game_Player.rb index 0dab7f2a8..73bffab6d 100644 --- a/Data/Scripts/003_Game classes/007_Game_Player.rb +++ b/Data/Scripts/003_Game classes/007_Game_Player.rb @@ -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 diff --git a/Data/Scripts/003_Game classes/004_Game_CommonEvent.rb b/Data/Scripts/003_Game classes/012_Game_CommonEvent.rb similarity index 100% rename from Data/Scripts/003_Game classes/004_Game_CommonEvent.rb rename to Data/Scripts/003_Game classes/012_Game_CommonEvent.rb diff --git a/Data/Scripts/006_Game processing/002_Scene_Map.rb b/Data/Scripts/006_Game processing/002_Scene_Map.rb index b8d41e205..bc2b0b3b4 100644 --- a/Data/Scripts/006_Game processing/002_Scene_Map.rb +++ b/Data/Scripts/006_Game processing/002_Scene_Map.rb @@ -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 diff --git a/Data/Scripts/013_Overworld/002_PField_Field.rb b/Data/Scripts/013_Overworld/002_PField_Field.rb index f66685433..0504f4488 100644 --- a/Data/Scripts/013_Overworld/002_PField_Field.rb +++ b/Data/Scripts/013_Overworld/002_PField_Field.rb @@ -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)