|
27 | 27 | SMW_BONUS_BLOCK_DATA = WRAM_START + 0x1A000
|
28 | 28 | SMW_BLOCKSANITY_DATA = WRAM_START + 0x1A400
|
29 | 29 | SMW_BLOCKSANITY_FLAGS = WRAM_START + 0x1A010
|
| 30 | +SMW_LEVEL_CLEAR_FLAGS = WRAM_START + 0x1A200 |
30 | 31 | SMW_SPECIAL_WORLD_CLEAR = WRAM_START + 0x1FFF
|
31 | 32 |
|
32 | 33 |
|
|
60 | 61 |
|
61 | 62 | SMW_RECV_PROGRESS_ADDR = WRAM_START + 0x1A00E
|
62 | 63 |
|
63 |
| -SMW_BLOCKSANITY_BLOCK_COUNT = 658 |
| 64 | +SMW_BLOCKSANITY_BLOCK_COUNT = 582 |
64 | 65 |
|
65 | 66 | SMW_GOAL_LEVELS = [0x28, 0x31, 0x32]
|
66 | 67 | SMW_INVALID_MARIO_STATES = [0x05, 0x06, 0x0A, 0x0C, 0x0D]
|
@@ -255,7 +256,6 @@ async def handle_trap_queue(self, ctx):
|
255 | 256 |
|
256 | 257 | async def game_watcher(self, ctx):
|
257 | 258 | from SNIClient import snes_buffered_write, snes_flush_writes, snes_read
|
258 |
| - |
259 | 259 |
|
260 | 260 | boss_state = await snes_read(ctx, SMW_BOSS_STATE_ADDR, 0x1)
|
261 | 261 | game_state = await snes_read(ctx, SMW_GAME_STATE_ADDR, 0x1)
|
@@ -328,8 +328,9 @@ async def game_watcher(self, ctx):
|
328 | 328 | blocksanity_data = bytearray(await snes_read(ctx, SMW_BLOCKSANITY_DATA, SMW_BLOCKSANITY_BLOCK_COUNT))
|
329 | 329 | blocksanity_flags = bytearray(await snes_read(ctx, SMW_BLOCKSANITY_FLAGS, 0xC))
|
330 | 330 | blocksanity_active = await snes_read(ctx, SMW_BLOCKSANITY_ACTIVE_ADDR, 0x1)
|
| 331 | + level_clear_flags = bytearray(await snes_read(ctx, SMW_LEVEL_CLEAR_FLAGS, 0x60)) |
331 | 332 | from worlds.smw.Rom import item_rom_data, ability_rom_data, trap_rom_data, icon_rom_data
|
332 |
| - from worlds.smw.Levels import location_id_to_level_id, level_info_dict |
| 333 | + from worlds.smw.Levels import location_id_to_level_id, level_info_dict, level_blocks_data |
333 | 334 | from worlds import AutoWorldRegister
|
334 | 335 | for loc_name, level_data in location_id_to_level_id.items():
|
335 | 336 | loc_id = AutoWorldRegister.world_types[ctx.game].location_name_to_id[loc_name]
|
@@ -537,6 +538,7 @@ async def game_watcher(self, ctx):
|
537 | 538 | new_hidden_1up = False
|
538 | 539 | new_bonus_block = False
|
539 | 540 | new_blocksanity = False
|
| 541 | + new_blocksanity_flags = False |
540 | 542 | i = 0
|
541 | 543 | for loc_id in ctx.checked_locations:
|
542 | 544 | if loc_id not in ctx.locations_checked:
|
@@ -595,13 +597,31 @@ async def game_watcher(self, ctx):
|
595 | 597 |
|
596 | 598 | new_bonus_block = True
|
597 | 599 | elif level_data[1] >= 100:
|
| 600 | + # Blocksanity flag Check |
598 | 601 | block_index = level_data[1] - 100
|
599 | 602 | blocksanity_data[block_index] = 1
|
600 | 603 | new_blocksanity = True
|
| 604 | + |
| 605 | + # All blocksanity blocks flag |
| 606 | + new_blocksanity_flags = True |
| 607 | + for block_id in level_blocks_data[level_data[0]]: |
| 608 | + if blocksanity_data[block_id] != 1: |
| 609 | + new_blocksanity_flags = False |
| 610 | + continue |
| 611 | + if new_blocksanity_flags is True: |
| 612 | + progress_byte = (level_data[0] // 8) |
| 613 | + progress_bit = 7 - (level_data[0] % 8) |
| 614 | + data = blocksanity_flags[progress_byte] |
| 615 | + new_data = data | (1 << progress_bit) |
| 616 | + blocksanity_flags[progress_byte] = new_data |
601 | 617 | else:
|
602 | 618 | if level_data[0] in SMW_UNCOLLECTABLE_LEVELS:
|
603 | 619 | continue
|
604 | 620 |
|
| 621 | + # Handle map indicators |
| 622 | + flag = 1 if level_data[1] == 0 else 2 |
| 623 | + level_clear_flags[level_data[0]] |= flag |
| 624 | + |
605 | 625 | event_id = event_data[level_data[0]]
|
606 | 626 | event_id_value = event_id + level_data[1]
|
607 | 627 |
|
@@ -650,7 +670,10 @@ async def game_watcher(self, ctx):
|
650 | 670 | snes_buffered_write(ctx, SMW_BONUS_BLOCK_DATA, bytes(bonus_block_data))
|
651 | 671 | if new_blocksanity:
|
652 | 672 | snes_buffered_write(ctx, SMW_BLOCKSANITY_DATA, bytes(blocksanity_data))
|
| 673 | + if new_blocksanity_flags: |
| 674 | + snes_buffered_write(ctx, SMW_BLOCKSANITY_FLAGS, bytes(blocksanity_flags)) |
653 | 675 | if new_events > 0:
|
| 676 | + snes_buffered_write(ctx, SMW_LEVEL_CLEAR_FLAGS, bytes(level_clear_flags)) |
654 | 677 | snes_buffered_write(ctx, SMW_PROGRESS_DATA, bytes(progress_data))
|
655 | 678 | snes_buffered_write(ctx, SMW_PATH_DATA, bytes(path_data))
|
656 | 679 | old_events = await snes_read(ctx, SMW_NUM_EVENTS_ADDR, 0x1)
|
|
0 commit comments