Merge branch 'DoorDev' into gui-improvements
This commit is contained in:
@@ -779,6 +779,8 @@ def assign_cross_keys(dungeon_builders, world, player):
|
|||||||
# Last Step: Adjust Small Key Dungeon Pool
|
# Last Step: Adjust Small Key Dungeon Pool
|
||||||
if not world.retro[player]:
|
if not world.retro[player]:
|
||||||
for name, builder in dungeon_builders.items():
|
for name, builder in dungeon_builders.items():
|
||||||
|
reassign_key_doors(builder, world, player)
|
||||||
|
log_key_logic(builder.name, world.key_logic[player][builder.name])
|
||||||
actual_chest_keys = max(builder.key_doors_num - builder.key_drop_cnt, 0)
|
actual_chest_keys = max(builder.key_doors_num - builder.key_drop_cnt, 0)
|
||||||
dungeon = world.get_dungeon(name, player)
|
dungeon = world.get_dungeon(name, player)
|
||||||
if actual_chest_keys == 0:
|
if actual_chest_keys == 0:
|
||||||
@@ -893,9 +895,11 @@ def shuffle_key_doors(builder, world, player):
|
|||||||
builder.key_doors_num = num_key_doors
|
builder.key_doors_num = num_key_doors
|
||||||
find_small_key_door_candidates(builder, start_regions, world, player)
|
find_small_key_door_candidates(builder, start_regions, world, player)
|
||||||
find_valid_combination(builder, start_regions, world, player)
|
find_valid_combination(builder, start_regions, world, player)
|
||||||
|
reassign_key_doors(builder, world, player)
|
||||||
|
log_key_logic(builder.name, world.key_logic[player][builder.name])
|
||||||
|
|
||||||
|
|
||||||
def find_current_key_doors(builder, world, player):
|
def find_current_key_doors(builder):
|
||||||
current_doors = []
|
current_doors = []
|
||||||
for region in builder.master_sector.regions:
|
for region in builder.master_sector.regions:
|
||||||
for ext in region.exits:
|
for ext in region.exits:
|
||||||
@@ -982,8 +986,7 @@ def find_valid_combination(builder, start_regions, world, player, drop_keys=True
|
|||||||
if player not in world.key_logic.keys():
|
if player not in world.key_logic.keys():
|
||||||
world.key_logic[player] = {}
|
world.key_logic[player] = {}
|
||||||
analyze_dungeon(key_layout, world, player)
|
analyze_dungeon(key_layout, world, player)
|
||||||
reassign_key_doors(builder, proposal, world, player)
|
builder.key_door_proposal = proposal
|
||||||
log_key_logic(builder.name, key_layout.key_logic)
|
|
||||||
world.key_logic[player][builder.name] = key_layout.key_logic
|
world.key_logic[player][builder.name] = key_layout.key_logic
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -1040,7 +1043,9 @@ def find_key_door_candidates(region, checked, world, player):
|
|||||||
while len(queue) > 0:
|
while len(queue) > 0:
|
||||||
current, last_door, last_region = queue.pop()
|
current, last_door, last_region = queue.pop()
|
||||||
for ext in current.exits:
|
for ext in current.exits:
|
||||||
d = world.check_for_door(ext.name, player)
|
d = ext.door
|
||||||
|
if d and d.controller:
|
||||||
|
d = d.controller
|
||||||
if d is not None and not d.blocked and d.dest is not last_door and d.dest is not last_region and d not in checked_doors:
|
if d is not None and not d.blocked and d.dest is not last_door and d.dest is not last_region and d not in checked_doors:
|
||||||
valid = False
|
valid = False
|
||||||
if 0 <= d.doorListPos < 4 and d.type in [DoorType.Interior, DoorType.Normal, DoorType.SpiralStairs]:
|
if 0 <= d.doorListPos < 4 and d.type in [DoorType.Interior, DoorType.Normal, DoorType.SpiralStairs]:
|
||||||
@@ -1059,6 +1064,8 @@ def find_key_door_candidates(region, checked, world, player):
|
|||||||
okay_normals = [DoorKind.Normal, DoorKind.SmallKey, DoorKind.Bombable,
|
okay_normals = [DoorKind.Normal, DoorKind.SmallKey, DoorKind.Bombable,
|
||||||
DoorKind.Dashable, DoorKind.DungeonChanger]
|
DoorKind.Dashable, DoorKind.DungeonChanger]
|
||||||
valid = kind in okay_normals and kind_b in okay_normals
|
valid = kind in okay_normals and kind_b in okay_normals
|
||||||
|
if valid and 0 <= d2.doorListPos < 4:
|
||||||
|
candidates.append(d2)
|
||||||
else:
|
else:
|
||||||
valid = True
|
valid = True
|
||||||
if valid:
|
if valid:
|
||||||
@@ -1092,10 +1099,11 @@ def ncr(n, r):
|
|||||||
return numerator / denominator
|
return numerator / denominator
|
||||||
|
|
||||||
|
|
||||||
def reassign_key_doors(builder, proposal, world, player):
|
def reassign_key_doors(builder, world, player):
|
||||||
logger = logging.getLogger('')
|
logger = logging.getLogger('')
|
||||||
|
proposal = builder.key_door_proposal
|
||||||
flat_proposal = flatten_pair_list(proposal)
|
flat_proposal = flatten_pair_list(proposal)
|
||||||
queue = deque(find_current_key_doors(builder, world, player))
|
queue = deque(find_current_key_doors(builder))
|
||||||
while len(queue) > 0:
|
while len(queue) > 0:
|
||||||
d = queue.pop()
|
d = queue.pop()
|
||||||
if d.type is DoorType.SpiralStairs and d not in proposal:
|
if d.type is DoorType.SpiralStairs and d not in proposal:
|
||||||
|
|||||||
@@ -447,9 +447,12 @@ def stonewall_valid(stonewall):
|
|||||||
if bad_door.blocked:
|
if bad_door.blocked:
|
||||||
return True # great we're done with this one
|
return True # great we're done with this one
|
||||||
loop_region = stonewall.entrance.parent_region
|
loop_region = stonewall.entrance.parent_region
|
||||||
start_region = bad_door.entrance.parent_region
|
start_regions = [bad_door.entrance.parent_region]
|
||||||
queue = deque([start_region])
|
if bad_door.dependents:
|
||||||
visited = {start_region}
|
for dep in bad_door.dependents:
|
||||||
|
start_regions.append(dep.entrance.parent_region)
|
||||||
|
queue = deque(start_regions)
|
||||||
|
visited = set(start_regions)
|
||||||
while len(queue) > 0:
|
while len(queue) > 0:
|
||||||
region = queue.popleft()
|
region = queue.popleft()
|
||||||
if region == loop_region:
|
if region == loop_region:
|
||||||
@@ -1027,6 +1030,7 @@ class DungeonBuilder(object):
|
|||||||
self.key_doors_num = None
|
self.key_doors_num = None
|
||||||
self.combo_size = None
|
self.combo_size = None
|
||||||
self.flex = 0
|
self.flex = 0
|
||||||
|
self.key_door_proposal = None
|
||||||
|
|
||||||
if name in dungeon_dead_end_allowance.keys():
|
if name in dungeon_dead_end_allowance.keys():
|
||||||
self.allowance = dungeon_dead_end_allowance[name]
|
self.allowance = dungeon_dead_end_allowance[name]
|
||||||
|
|||||||
3
Main.py
3
Main.py
@@ -23,7 +23,7 @@ from Fill import distribute_items_cutoff, distribute_items_staleness, distribute
|
|||||||
from ItemList import generate_itempool, difficulties, fill_prizes
|
from ItemList import generate_itempool, difficulties, fill_prizes
|
||||||
from Utils import output_path, parse_player_names
|
from Utils import output_path, parse_player_names
|
||||||
|
|
||||||
__version__ = '0.0.14pre'
|
__version__ = '0.0.15pre'
|
||||||
|
|
||||||
|
|
||||||
def main(args, seed=None):
|
def main(args, seed=None):
|
||||||
@@ -56,6 +56,7 @@ def main(args, seed=None):
|
|||||||
world.enemy_health = args.enemy_health.copy()
|
world.enemy_health = args.enemy_health.copy()
|
||||||
world.enemy_damage = args.enemy_damage.copy()
|
world.enemy_damage = args.enemy_damage.copy()
|
||||||
world.beemizer = args.beemizer.copy()
|
world.beemizer = args.beemizer.copy()
|
||||||
|
world.dungeon_counters = args.dungeon_counters.copy()
|
||||||
world.experimental = args.experimental.copy()
|
world.experimental = args.experimental.copy()
|
||||||
world.dungeon_counters = args.dungeon_counters.copy()
|
world.dungeon_counters = args.dungeon_counters.copy()
|
||||||
|
|
||||||
|
|||||||
4
Rom.py
4
Rom.py
@@ -22,7 +22,7 @@ from EntranceShuffle import door_addresses, exit_ids
|
|||||||
|
|
||||||
|
|
||||||
JAP10HASH = '03a63945398191337e896e5771f77173'
|
JAP10HASH = '03a63945398191337e896e5771f77173'
|
||||||
RANDOMIZERBASEHASH = '818b2c659a610cb4112804cf612ffd37'
|
RANDOMIZERBASEHASH = '746b52b20a116648b624ebe58af9e54b'
|
||||||
|
|
||||||
|
|
||||||
class JsonRom(object):
|
class JsonRom(object):
|
||||||
@@ -618,6 +618,8 @@ def patch_rom(world, rom, player, team, enemized):
|
|||||||
if builder.pre_open_stonewall.name == 'Desert Wall Slide NW':
|
if builder.pre_open_stonewall.name == 'Desert Wall Slide NW':
|
||||||
dr_flags |= DROptions.Open_Desert_Wall
|
dr_flags |= DROptions.Open_Desert_Wall
|
||||||
rom.write_byte(0x139006, dr_flags.value)
|
rom.write_byte(0x139006, dr_flags.value)
|
||||||
|
if dr_flags & DROptions.Town_Portal and world.mode[player] == 'inverted':
|
||||||
|
rom.write_byte(0x139008, 1)
|
||||||
|
|
||||||
# fix skull woods exit, if not fixed during exit patching
|
# fix skull woods exit, if not fixed during exit patching
|
||||||
if world.fix_skullwoods_exit[player] and world.shuffle[player] == 'vanilla':
|
if world.fix_skullwoods_exit[player] and world.shuffle[player] == 'vanilla':
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ DRMode:
|
|||||||
dw 0
|
dw 0
|
||||||
DRFlags:
|
DRFlags:
|
||||||
dw 0
|
dw 0
|
||||||
|
DRScroll:
|
||||||
|
db 0
|
||||||
|
|
||||||
; Vert 0,6,0 Horz 2,0,8
|
; Vert 0,6,0 Horz 2,0,8
|
||||||
org $279010
|
org $279010
|
||||||
|
|||||||
@@ -72,6 +72,13 @@ jsl GtBossHeartCheckOverride : bcs .not_in_ganons_tower
|
|||||||
nop : stz $0dd0, X : rts
|
nop : stz $0dd0, X : rts
|
||||||
.not_in_ganons_tower
|
.not_in_ganons_tower
|
||||||
|
|
||||||
|
|
||||||
|
org $2081f2
|
||||||
|
jsl MirrorCheckOverride2
|
||||||
|
org $20825c
|
||||||
|
jsl MirrorCheckOverride2
|
||||||
|
|
||||||
|
|
||||||
; These two, if enabled together, have implications for vanilla BK doors in IP/Hera/Mire
|
; These two, if enabled together, have implications for vanilla BK doors in IP/Hera/Mire
|
||||||
; IPBJ is common enough to consider not doing this. Mire is not a concern for vanilla - maybe glitched modes
|
; IPBJ is common enough to consider not doing this. Mire is not a concern for vanilla - maybe glitched modes
|
||||||
; Hera BK door back can be seen with Pot clipping - likely useful for no logic seeds
|
; Hera BK door back can be seen with Pot clipping - likely useful for no logic seeds
|
||||||
|
|||||||
@@ -43,9 +43,13 @@ OnFileLoadOverride:
|
|||||||
+ rtl
|
+ rtl
|
||||||
|
|
||||||
MirrorCheckOverride:
|
MirrorCheckOverride:
|
||||||
lda $8A : and #$40 ; what I wrote over
|
|
||||||
beq +
|
|
||||||
lda DRFlags : and #$02 : beq ++
|
lda DRFlags : and #$02 : beq ++
|
||||||
lda $7ef353 : cmp #$01 : beq +
|
lda $7ef353 : cmp #$01 : beq +
|
||||||
++ lda #$01
|
++ lda $8A : and #$40 ; what I wrote over
|
||||||
|
rtl
|
||||||
|
+ lda DRScroll : rtl
|
||||||
|
|
||||||
|
MirrorCheckOverride2:
|
||||||
|
lda $7ef353 : cmp #$02 : beq +
|
||||||
|
sep #$02 ; clear zero flag, I think
|
||||||
+ rtl
|
+ rtl
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user