Merge remote-tracking branch 'upstream/DoorDevUnstable' into OverworldShuffle

This commit is contained in:
codemann8
2021-02-08 12:02:11 -06:00
358 changed files with 868 additions and 459 deletions

View File

@@ -153,9 +153,10 @@ class World(object):
self._door_cache[(door.name, door.player)] = door
def remove_door(self, door, player):
if (door, player) in self._door_cache.keys():
del self._door_cache[(door, player)]
self.doors.remove(door)
if (door.name, player) in self._door_cache.keys():
del self._door_cache[(door.name, player)]
if door in self.doors:
self.doors.remove(door)
def get_regions(self, player=None):
return self.regions if player is None else self._region_cache[player].values()
@@ -1070,7 +1071,7 @@ hook_dir_map = {
def hook_from_door(door):
if door.type == DoorType.SpiralStairs:
return Hook.Stairs
if door.type in [DoorType.Normal, DoorType.Open, DoorType.StraightStairs]:
if door.type in [DoorType.Normal, DoorType.Open, DoorType.StraightStairs, DoorType.Ladder]:
return hook_dir_map[door.direction]
return None
@@ -1188,7 +1189,8 @@ class Door(object):
# rom properties
self.roomIndex = -1
# 0,1,2 + Direction (N:0, W:3, S:6, E:9) for normal
# 0,1,2 for normal
# 0-7 for ladder
# 0-4 for spiral offset thing
self.doorIndex = -1
self.layer = -1 # 0 for normal floor, 1 for the inset layer
@@ -1219,6 +1221,7 @@ class Door(object):
# self.connected = False # combine with Dest?
self.dest = None
self.blocked = False # Indicates if the door is normally blocked off as an exit. (Sanc door or always closed)
self.blocked_orig = False
self.stonewall = False # Indicate that the door cannot be enter until exited (Desert Torches, PoD Eye Statue)
self.smallKey = False # There's a small key door on this side
self.bigKey = False # There's a big key door on this side
@@ -1230,7 +1233,7 @@ class Door(object):
self.dead = False
self.entrance = entrance
if entrance is not None:
if entrance is not None and not entrance.door:
entrance.door = self
def getAddress(self):
@@ -1238,6 +1241,8 @@ class Door(object):
return 0x13A000 + normal_offset_table[self.roomIndex] * 24 + (self.doorIndex + self.direction.value * 3) * 2
elif self.type == DoorType.SpiralStairs:
return 0x13B000 + (spiral_offset_table[self.roomIndex] + self.doorIndex) * 4
elif self.type == DoorType.Ladder:
return 0x13C700 + self.doorIndex * 2
elif self.type == DoorType.Open:
base_address = {
Direction.North: 0x13C500,
@@ -1254,6 +1259,12 @@ class Door(object):
if src.type == DoorType.StraightStairs:
bitmask += 0x40
return [self.roomIndex, bitmask + self.doorIndex]
if self.type == DoorType.Ladder:
bitmask = 4 * (self.layer ^ 1 if src.toggle else self.layer)
bitmask += 0x08 * self.doorIndex
if src.type == DoorType.StraightStairs:
bitmask += 0x40
return [self.roomIndex, bitmask + 0x03]
if self.type == DoorType.SpiralStairs:
bitmask = int(self.layer) << 2
bitmask += 0x10 * int(self.zeroHzCam)
@@ -1316,7 +1327,7 @@ class Door(object):
return self
def no_exit(self):
self.blocked = True
self.blocked = self.blocked_orig = True
return self
def no_entrance(self):