Renamed some more global variables

This commit is contained in:
Maruno17
2021-10-20 23:13:30 +01:00
parent e49cd8d498
commit 5e51f702b3
17 changed files with 62 additions and 59 deletions

View File

@@ -326,7 +326,7 @@ class Game_Map
max_x = (self.width - Graphics.width*1.0/TILE_WIDTH) * REAL_RES_X
@display_x = [0, [@display_x, max_x].min].max
end
$MapFactory.setMapsInRange if $MapFactory
$map_factory.setMapsInRange if $map_factory
end
def display_y=(value)
@@ -336,7 +336,7 @@ class Game_Map
max_y = (self.height - Graphics.height*1.0/TILE_HEIGHT) * REAL_RES_Y
@display_y = [0, [@display_y, max_y].min].max
end
$MapFactory.setMapsInRange if $MapFactory
$map_factory.setMapsInRange if $map_factory
end
def scroll_up(distance)
@@ -397,11 +397,11 @@ class Game_Map
def update
# refresh maps if necessary
if $MapFactory
for i in $MapFactory.maps
if $map_factory
for i in $map_factory.maps
i.refresh if i.need_refresh
end
$MapFactory.setCurrentMap
$map_factory.setCurrentMap
end
# If scrolling
if @scroll_rest>0

View File

@@ -382,7 +382,7 @@ class PokemonMapFactory
def updateMaps(scene)
updateMapsInternal
$MapFactory.setSceneStarted(scene) if @mapChanged
$map_factory.setSceneStarted(scene) if @mapChanged
end
def updateMapsInternal
@@ -510,7 +510,7 @@ end
#===============================================================================
# Unused
def updateTilesets
maps = $MapFactory.maps
maps = $map_factory.maps
for map in maps
map.updateTileset if map
end

View File

@@ -203,8 +203,8 @@ class Game_Character
deep_bush = regular_bush = false
xbehind = @x + (@direction == 4 ? 1 : @direction == 6 ? -1 : 0)
ybehind = @y + (@direction == 8 ? 1 : @direction == 2 ? -1 : 0)
this_map = (self.map.valid?(@x, @y)) ? [self.map, @x, @y] : $MapFactory.getNewMap(@x, @y)
behind_map = (self.map.valid?(xbehind, ybehind)) ? [self.map, xbehind, ybehind] : $MapFactory&.getNewMap(xbehind, ybehind)
this_map = (self.map.valid?(@x, @y)) ? [self.map, @x, @y] : $map_factory.getNewMap(@x, @y)
behind_map = (self.map.valid?(xbehind, ybehind)) ? [self.map, xbehind, ybehind] : $map_factory&.getNewMap(xbehind, ybehind)
if this_map[0].deepBush?(this_map[1], this_map[2]) &&
(!behind_map || behind_map[0].deepBush?(behind_map[1], behind_map[2]))
@bush_depth = Game_Map::TILE_HEIGHT

View File

@@ -160,7 +160,7 @@ class Game_Player < Game_Character
end
def pbTerrainTag(countBridge = false)
return $MapFactory.getTerrainTag(self.map.map_id, @x, @y, countBridge) if $MapFactory
return $map_factory.getTerrainTag(self.map.map_id, @x, @y, countBridge) if $map_factory
return $game_map.terrain_tag(@x, @y, countBridge)
end
@@ -190,7 +190,7 @@ class Game_Player < Game_Character
def pbFacingTerrainTag(dir = nil)
dir = self.direction if !dir
return $MapFactory.getFacingTerrainTag(dir, self) if $MapFactory
return $map_factory.getFacingTerrainTag(dir, self) if $map_factory
facing = pbFacingTile(dir, self)
return $game_map.terrain_tag(facing[1], facing[2])
end
@@ -209,8 +209,8 @@ class Game_Player < Game_Character
# If coordinates are outside of map
return false if !$game_map.validLax?(new_x, new_y)
if !$game_map.valid?(new_x, new_y)
return false if !$MapFactory
return $MapFactory.isPassableFromEdge?(new_x, new_y)
return false if !$map_factory
return $map_factory.isPassableFromEdge?(new_x, new_y)
end
# If debug mode is ON and Ctrl key was pressed
return true if $DEBUG && Input.press?(Input::CTRL)

View File

@@ -15,7 +15,7 @@ class Game_Follower < Game_Event
rpg_event.pages[0].list = common_event.list
end
# Create self
super(event_data.original_map_id, rpg_event, $MapFactory.getMap(event_data.current_map_id))
super(event_data.original_map_id, rpg_event, $map_factory.getMap(event_data.current_map_id))
# Modify self
self.character_name = event_data.character_name
self.character_hue = event_data.character_hue
@@ -112,15 +112,15 @@ class Game_Follower < Game_Event
end
def follow_leader(leader, instant = false, leaderIsTrueLeader = true)
maps_connected = $MapFactory.areConnected?(leader.map.map_id, self.map.map_id)
maps_connected = $map_factory.areConnected?(leader.map.map_id, self.map.map_id)
target = nil
# Get the target tile that self wants to move to
if maps_connected
behind_direction = 10 - leader.direction
target = $MapFactory.getFacingTile(behind_direction, leader)
if target && $MapFactory.getTerrainTag(target[0], target[1], target[2]).ledge
target = $map_factory.getFacingTile(behind_direction, leader)
if target && $map_factory.getTerrainTag(target[0], target[1], target[2]).ledge
# Get the tile above the ledge (where the leader jumped from)
target = $MapFactory.getFacingTileFromPos(target[0], target[1], target[2], behind_direction)
target = $map_factory.getFacingTileFromPos(target[0], target[1], target[2], behind_direction)
end
target = [leader.map.map_id, leader.x, leader.y] if !target
else
@@ -129,8 +129,8 @@ class Game_Follower < Game_Event
end
# Move self to the target
if self.map.map_id != target[0]
vector = $MapFactory.getRelativePos(target[0], 0, 0, self.map.map_id, @x, @y)
@map = $MapFactory.getMap(target[0])
vector = $map_factory.getRelativePos(target[0], 0, 0, self.map.map_id, @x, @y)
@map = $map_factory.getMap(target[0])
# NOTE: Can't use moveto because vector is outside the boundaries of the
# map, and moveto doesn't allow setting invalid coordinates.
@x = vector[0]

View File

@@ -179,7 +179,7 @@ class Game_FollowerFactory
!$game_player.move_route_forcing && !$game_temp.message_window_showing &&
!pbMapInterpreterRunning?
# Get position of tile facing the player
facing_tile = $MapFactory.getFacingTile
facing_tile = $map_factory.getFacingTile
# Assumes player is 1x1 tile in size
each_follower do |event, follower|
next if !follower.common_event_id
@@ -241,7 +241,7 @@ class FollowerSprites
@sprites.each { |sprite| sprite.dispose }
@sprites.clear
$PokemonTemp.followers.each_follower do |event, follower|
$MapFactory.maps.each do |map|
$map_factory.maps.each do |map|
map.events[follower.event_id].erase if follower.original_map_id == map.map_id
end
@sprites.push(Sprite_Character.new(@viewport, event))