mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Fixed being able to jump over a ledge the wrong way if it's on the edge of a connected map
This commit is contained in:
@@ -139,9 +139,9 @@ class Game_Map
|
||||
return x >= -10 && x <= width + 10 && y >= -10 && y <= height + 10
|
||||
end
|
||||
|
||||
def passable?(x, y, d, self_event = nil)
|
||||
def passable?(x, y, dir, self_event = nil)
|
||||
return false if !valid?(x, y)
|
||||
bit = (1 << ((d / 2) - 1)) & 0x0f
|
||||
bit = (1 << ((dir / 2) - 1)) & 0x0f
|
||||
events.each_value do |event|
|
||||
next if event.tile_id <= 0
|
||||
next if event == self_event
|
||||
@@ -153,11 +153,11 @@ class Game_Map
|
||||
return false if passage & 0x0f == 0x0f
|
||||
return true if @priorities[event.tile_id] == 0
|
||||
end
|
||||
return playerPassable?(x, y, d, self_event) if self_event == $game_player
|
||||
return playerPassable?(x, y, dir, self_event) if self_event == $game_player
|
||||
# All other events
|
||||
newx = x
|
||||
newy = y
|
||||
case d
|
||||
case dir
|
||||
when 1
|
||||
newx -= 1
|
||||
newy += 1
|
||||
@@ -219,8 +219,8 @@ class Game_Map
|
||||
return true
|
||||
end
|
||||
|
||||
def playerPassable?(x, y, d, self_event = nil)
|
||||
bit = (1 << ((d / 2) - 1)) & 0x0f
|
||||
def playerPassable?(x, y, dir, self_event = nil)
|
||||
bit = (1 << ((dir / 2) - 1)) & 0x0f
|
||||
[2, 1, 0].each do |i|
|
||||
tile_id = data[x, y, i]
|
||||
next if tile_id == 0
|
||||
|
||||
@@ -154,14 +154,14 @@ class PokemonMapFactory
|
||||
end
|
||||
|
||||
# Similar to Game_Player#passable?, but supports map connections
|
||||
def isPassableFromEdge?(x, y)
|
||||
def isPassableFromEdge?(x, y, dir = 0)
|
||||
return true if $game_map.valid?(x, y)
|
||||
newmap = getNewMap(x, y, $game_map.map_id)
|
||||
return false if !newmap
|
||||
return isPassable?(newmap[0].map_id, newmap[1], newmap[2])
|
||||
return isPassable?(newmap[0].map_id, newmap[1], newmap[2], dir)
|
||||
end
|
||||
|
||||
def isPassable?(mapID, x, y, thisEvent = nil)
|
||||
def isPassable?(mapID, x, y, dir = 0, thisEvent = nil)
|
||||
thisEvent = $game_player if !thisEvent
|
||||
map = getMapNoAdd(mapID)
|
||||
return false if !map
|
||||
@@ -169,7 +169,7 @@ class PokemonMapFactory
|
||||
return true if thisEvent.through
|
||||
# Check passability of tile
|
||||
return true if $DEBUG && Input.press?(Input::CTRL) && thisEvent.is_a?(Game_Player)
|
||||
return false if !map.passable?(x, y, 0, thisEvent)
|
||||
return false if !map.passable?(x, y, dir, thisEvent)
|
||||
# Check passability of event(s) in that spot
|
||||
map.events.each_value do |event|
|
||||
next if event == thisEvent || !event.at_coordinate?(x, y)
|
||||
|
||||
@@ -234,17 +234,17 @@ class Game_Character
|
||||
#=============================================================================
|
||||
# Passability
|
||||
#=============================================================================
|
||||
def passable?(x, y, d, strict = false)
|
||||
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
|
||||
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
|
||||
def passable?(x, y, dir, strict = false)
|
||||
new_x = x + (dir == 6 ? 1 : dir == 4 ? -1 : 0)
|
||||
new_y = y + (dir == 2 ? 1 : dir == 8 ? -1 : 0)
|
||||
return false unless self.map.valid?(new_x, new_y)
|
||||
return true if @through
|
||||
if strict
|
||||
return false unless self.map.passableStrict?(x, y, d, self)
|
||||
return false unless self.map.passableStrict?(new_x, new_y, 10 - d, self)
|
||||
return false unless self.map.passableStrict?(x, y, dir, self)
|
||||
return false unless self.map.passableStrict?(new_x, new_y, 10 - dir, self)
|
||||
else
|
||||
return false unless self.map.passable?(x, y, d, self)
|
||||
return false unless self.map.passable?(new_x, new_y, 10 - d, self)
|
||||
return false unless self.map.passable?(x, y, dir, self)
|
||||
return false unless self.map.passable?(new_x, new_y, 10 - dir, self)
|
||||
end
|
||||
self.map.events.each_value do |event|
|
||||
next if self == event || !event.at_coordinate?(new_x, new_y) || event.through
|
||||
|
||||
@@ -235,15 +235,15 @@ class Game_Player < Game_Character
|
||||
# y : y-coordinate
|
||||
# d : direction (0, 2, 4, 6, 8)
|
||||
# * 0 = Determines if all directions are impassable (for jumping)
|
||||
def passable?(x, y, d, strict = false)
|
||||
def passable?(x, y, dir, strict = false)
|
||||
# Get new coordinates
|
||||
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
|
||||
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
|
||||
new_x = x + (dir == 6 ? 1 : dir == 4 ? -1 : 0)
|
||||
new_y = y + (dir == 2 ? 1 : dir == 8 ? -1 : 0)
|
||||
# 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 !$map_factory
|
||||
return $map_factory.isPassableFromEdge?(new_x, new_y)
|
||||
return $map_factory.isPassableFromEdge?(new_x, new_y, 10 - dir)
|
||||
end
|
||||
# If debug mode is ON and Ctrl key was pressed
|
||||
return true if $DEBUG && Input.press?(Input::CTRL)
|
||||
|
||||
Reference in New Issue
Block a user