Skip to content

Commit

Permalink
changes that mean that world may be finished, qol pending tho
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLX5 committed Jun 30, 2024
1 parent d529a58 commit fb625fb
Show file tree
Hide file tree
Showing 13 changed files with 311 additions and 249 deletions.
33 changes: 22 additions & 11 deletions worlds/mmx2/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
MMX2_SHORYUKEN = WRAM_START + 0x01FB1
MMX2_CAN_MOVE = WRAM_START + 0x01F25
MMX2_ON_RIDE_ARMOR = WRAM_START + 0x00A54
MMX2_ZERO_PARTS = WRAM_START + 0x01FD6

MMX2_ENABLE_HEART_TANK = MMX2_RAM + 0x00009
MMX2_ENABLE_HP_REFILL = MMX2_RAM + 0x0000D
Expand All @@ -58,6 +59,7 @@
MMX2_COMPLETED_REMATCHES = MMX2_RAM + 0x00000
MMX2_ENERGY_LINK_PACKET = MMX2_RAM + 0x00006
MMX2_COLLECTED_SHORYUKEN = MMX2_RAM + 0x00042
MMX2_COLLECTED_SIGMA_ACCESS = MMX2_RAM + 0x00046

MMX2_PICKUPSANITY_ACTIVE = ROM_START + 0x17FFE7
MMX2_REQUIRED_REMATCHES = ROM_START + 0x17FFE3
Expand Down Expand Up @@ -507,6 +509,7 @@ async def game_watcher(self, ctx):
self.game_state = False
self.current_level_value = 42
self.item_queue = []
ctx.locations_checked = set()
return

validation = await snes_read(ctx, MMX2_VALIDATION_CHECK, 0x2)
Expand Down Expand Up @@ -548,18 +551,17 @@ async def game_watcher(self, ctx):
from worlds import AutoWorldRegister

defeated_bosses_data = await snes_read(ctx, MMX2_DEFEATED_BOSSES, 0x20)
completed_rematches = await snes_read(ctx, MMX2_COMPLETED_REMATCHES, 0x1)
completed_rematches = completed_rematches[0]
required_rematches = await snes_read(ctx, MMX2_REQUIRED_REMATCHES, 0x1)
required_rematches = required_rematches[0]
defeated_bosses = list(defeated_bosses_data)
cleared_levels_data = await snes_read(ctx, MMX2_LEVEL_CLEARED, 0x20)
cleared_levels = list(cleared_levels_data)
collected_heart_tanks_data = await snes_read(ctx, MMX2_COLLECTED_HEART_TANKS, 0x01)
collected_upgrades_data = await snes_read(ctx, MMX2_COLLECTED_UPGRADES, 0x01)
collected_shoryuken_data = await snes_read(ctx, MMX2_COLLECTED_UPGRADES, 0x01)
collected_pickups_data = await snes_read(ctx, MMX2_COLLECTED_PICKUPS, 0x4A)
collected_shoryuken_data = await snes_read(ctx, MMX2_COLLECTED_SHORYUKEN, 0x01)
collected_pickups_data = await snes_read(ctx, MMX2_COLLECTED_PICKUPS, 0x4E)
collected_pickups = list(collected_pickups_data)
collected_sigma_access = await snes_read(ctx, MMX2_COLLECTED_SIGMA_ACCESS, 0x01)
pickupsanity_enabled = await snes_read(ctx, MMX2_PICKUPSANITY_ACTIVE, 0x1)
new_checks = []
for loc_name, data in location_id_to_level_id.items():
Expand Down Expand Up @@ -595,6 +597,9 @@ async def game_watcher(self, ctx):
# Shoryuken
if collected_shoryuken_data[0] != 0x00:
new_checks.append(loc_id)
elif internal_id == 0x006:
if collected_sigma_access[0] != 0x00:
new_checks.append(loc_id)
elif internal_id == 0x007:
# Intro
if game_state[0] == 0x02 and \
Expand All @@ -608,10 +613,6 @@ async def game_watcher(self, ctx):
if collected_pickups_data[data_bit] != 0:
new_checks.append(loc_id)

snes_buffered_write(ctx, MMX2_COMPLETED_REMATCHES, bytearray([completed_rematches]))
snes_buffered_write(ctx, MMX2_DEFEATED_BOSSES, bytes(defeated_bosses))
await snes_flush_writes(ctx)

verify_game_state = await snes_read(ctx, MMX2_GAMEPLAY_STATE, 1)
if verify_game_state is None:
snes_logger.info(f'Exit Game.')
Expand Down Expand Up @@ -694,7 +695,7 @@ async def game_watcher(self, ctx):
level = boss_access_rom_data[item.item]
boss_access[level[0] * 2] = 0x01
snes_buffered_write(ctx, MMX2_UNLOCKED_LEVELS, boss_access)
if item.item == 0xBD000A:
if item.item == STARTING_ID + 0x000A:
snes_buffered_write(ctx, MMX2_BASE_ACCESS, bytearray([0x00]))
snes_buffered_write(ctx, MMX2_SFX_FLAG, bytearray([0x01]))
snes_buffered_write(ctx, MMX2_SFX_NUMBER, bytearray([0x1D]))
Expand All @@ -711,16 +712,18 @@ async def game_watcher(self, ctx):
# Handle collected locations
game_state = await snes_read(ctx, MMX2_GAME_STATE, 0x1)
if game_state[0] != 0x02:
ctx.locations_checked = set()
return
new_boss_clears = False
new_cleared_level = False
new_heart_tank = False
new_upgrade = False
new_pickup = False
new_shoryuken = False
new_sigma_access = False
cleared_levels_data = await snes_read(ctx, MMX2_LEVEL_CLEARED, 0x20)
cleared_levels = list(cleared_levels_data)
collected_pickups_data = await snes_read(ctx, MMX2_COLLECTED_PICKUPS, 0x4A)
collected_pickups_data = await snes_read(ctx, MMX2_COLLECTED_PICKUPS, 0x4E)
collected_pickups = list(collected_pickups_data)
collected_heart_tanks_data = await snes_read(ctx, MMX2_COLLECTED_HEART_TANKS, 0x01)
collected_heart_tanks_data = collected_heart_tanks_data[0]
Expand All @@ -730,6 +733,8 @@ async def game_watcher(self, ctx):
defeated_bosses = list(defeated_bosses_data)
collected_shoryuken_data = await snes_read(ctx, MMX2_COLLECTED_SHORYUKEN, 0x01)
collected_shoryuken_data = collected_shoryuken_data[0]
collected_sigma_access = await snes_read(ctx, MMX2_COLLECTED_SIGMA_ACCESS, 0x01)
collected_sigma_access = collected_sigma_access[0]
i = 0
for loc_id in ctx.checked_locations:
if loc_id not in ctx.locations_checked:
Expand Down Expand Up @@ -771,7 +776,11 @@ async def game_watcher(self, ctx):
# Shoryuken
collected_shoryuken_data = 0xFF
new_shoryuken = True
elif internal_id >= 0x100:
elif internal_id == 0x006:
# Sigma Access
collected_sigma_access = 0x01
new_sigma_access = True
elif internal_id == 0x20:
# Pickups
collected_pickups[data_bit] = 0x01
new_pickup = True
Expand All @@ -784,6 +793,8 @@ async def game_watcher(self, ctx):
snes_buffered_write(ctx, MMX2_COLLECTED_PICKUPS, bytes(collected_pickups))
if new_shoryuken:
snes_buffered_write(ctx, MMX2_COLLECTED_SHORYUKEN, bytearray([collected_shoryuken_data]))
if new_sigma_access:
snes_buffered_write(ctx, MMX2_COLLECTED_SIGMA_ACCESS, bytearray([collected_sigma_access]))
if new_upgrade:
snes_buffered_write(ctx, MMX2_COLLECTED_UPGRADES, bytearray([collected_upgrades_data]))
if new_heart_tank:
Expand Down
1 change: 1 addition & 0 deletions worlds/mmx2/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class MMX2Item(Item):
ItemName.stage_overdrive_ostrich: ItemData(STARTING_ID + 0x08, True),
ItemName.stage_wire_sponge: ItemData(STARTING_ID + 0x09, True),
ItemName.stage_x_hunter: ItemData(STARTING_ID + 0x0A, True),
ItemName.stage_sigma: ItemData(STARTING_ID + 0x35, True),
}

weapons = {
Expand Down
9 changes: 7 additions & 2 deletions worlds/mmx2/Levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
LocationName.wheel_gator_energy_1: [0x00, 0x020, 0x05],
LocationName.wheel_gator_hp_3: [0x00, 0x020, 0x06],
LocationName.wheel_gator_hp_4: [0x00, 0x020, 0x07],
LocationName.wheel_gator_hp_5: [0x00, 0x020, 0x4A],
LocationName.wheel_gator_hp_6: [0x00, 0x020, 0x4B],
LocationName.wheel_gator_hp_7: [0x00, 0x020, 0x4C],

LocationName.bubble_crab_boss: [0x08, 0x000, 0x01],
LocationName.bubble_crab_clear: [0x08, 0x001, 0x02],
Expand Down Expand Up @@ -84,9 +87,10 @@
LocationName.crystal_snail_mini_boss_1: [0x02, 0x000, 0x1C],
LocationName.crystal_snail_hp_1: [0x00, 0x020, 0x2A],
LocationName.crystal_snail_energy_1: [0x00, 0x020, 0x2B],
LocationName.crystal_snail_hp_2: [0x00, 0x020, 0x2C],
LocationName.crystal_snail_hp_2: [0x00, 0x020, 0x4D],
LocationName.crystal_snail_hp_3: [0x00, 0x020, 0x2C],
LocationName.crystal_snail_1up_1: [0x00, 0x020, 0x2D],
LocationName.crystal_snail_hp_3: [0x00, 0x020, 0x2E],
LocationName.crystal_snail_hp_4: [0x00, 0x020, 0x2E],
LocationName.crystal_snail_1up_2: [0x00, 0x020, 0x2F],

LocationName.overdrive_ostrich_boss: [0x05, 0x000, 0x06],
Expand Down Expand Up @@ -144,6 +148,7 @@
LocationName.x_hunter_stage_4_crystal_snail: [0x0D, 0x000, 0x13],
LocationName.x_hunter_stage_4_overdrive_ostrich: [0x0D, 0x000, 0x14],
LocationName.x_hunter_stage_4_wire_sponge: [0x0D, 0x000, 0x15],
LocationName.x_hunter_stage_4_clear: [0x0D, 0x006, 0x00],

LocationName.x_hunter_stage_5_zero: [0x0E, 0x000, 0x16],
LocationName.victory: [0x0E, 0x000, 0x17],
Expand Down
9 changes: 7 additions & 2 deletions worlds/mmx2/Locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ def __init__(self, player: int, name: str = '', address: int = None, parent=None
LocationName.magna_centipede_hp_2: STARTING_ID + 0x0069,
LocationName.crystal_snail_hp_1: STARTING_ID + 0x006A,
LocationName.crystal_snail_energy_1: STARTING_ID + 0x006B,
LocationName.crystal_snail_hp_2: STARTING_ID + 0x006C,
LocationName.crystal_snail_hp_2: STARTING_ID + 0x008D,
LocationName.crystal_snail_hp_3: STARTING_ID + 0x006C,
LocationName.crystal_snail_1up_1: STARTING_ID + 0x006D,
LocationName.crystal_snail_hp_3: STARTING_ID + 0x006E,
LocationName.crystal_snail_hp_4: STARTING_ID + 0x006E,
LocationName.crystal_snail_1up_2: STARTING_ID + 0x006F,
LocationName.overdrive_ostrich_hp_1: STARTING_ID + 0x0070,
LocationName.overdrive_ostrich_1up: STARTING_ID + 0x0071,
Expand Down Expand Up @@ -146,6 +147,9 @@ def __init__(self, player: int, name: str = '', address: int = None, parent=None
LocationName.x_hunter_stage_3_hp_8: STARTING_ID + 0x0087,
LocationName.x_hunter_stage_3_1up_3: STARTING_ID + 0x0088,
LocationName.x_hunter_stage_3_1up_4: STARTING_ID + 0x0089,
LocationName.wheel_gator_hp_5: STARTING_ID + 0x008A,
LocationName.wheel_gator_hp_6: STARTING_ID + 0x008B,
LocationName.wheel_gator_hp_7: STARTING_ID + 0x008C,
}

stage_clears = {
Expand All @@ -158,6 +162,7 @@ def __init__(self, player: int, name: str = '', address: int = None, parent=None
LocationName.overdrive_ostrich_clear: STARTING_ID + 0x00C6,
LocationName.wire_sponge_clear: STARTING_ID + 0x00C7,
LocationName.intro_stage_clear: STARTING_ID + 0x00C8,
LocationName.x_hunter_stage_4_clear: STARTING_ID + 0x00C9,
}

all_locations = {
Expand Down
3 changes: 2 additions & 1 deletion worlds/mmx2/Names/ItemName.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
stage_crystal_snail = "Crystal Snail Access Codes"
stage_overdrive_ostrich = "Overdrive Ostrich Access Codes"
stage_wire_sponge = "Wire Sponge Access Codes"
stage_x_hunter = "X-Hunter Access Codes"
stage_x_hunter = "X-Hunter Base Access Codes"
stage_sigma = "Sigma Access Codes"

# Second Armor
helmet = "Helmet Upgrade"
Expand Down
9 changes: 7 additions & 2 deletions worlds/mmx2/Names/LocationName.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
wheel_gator_energy_1 = "Wheel Gator - Weapon Energy Pickup"
wheel_gator_hp_3 = "Wheel Gator - HP Pickup 3"
wheel_gator_hp_4 = "Wheel Gator - HP Pickup 4"
wheel_gator_hp_5 = "Wheel Gator - HP Pickup 5"
wheel_gator_hp_6 = "Wheel Gator - HP Pickup 6"
wheel_gator_hp_7 = "Wheel Gator - HP Pickup 7"

bubble_crab_boss = "Defeated Bubble Crab"
bubble_crab_clear = "Bubble Crab - Clear"
Expand Down Expand Up @@ -80,9 +83,10 @@
crystal_snail_mini_boss_1 = "Defeated Magna Quartz"
crystal_snail_hp_1 = "Crystal Snail - HP Pickup 1"
crystal_snail_energy_1 = "Crystal Snail - Weapon Energy Pickup 1"
crystal_snail_hp_2 = "Crystal Snail - HP Pickup 2"
crystal_snail_hp_2 = "Crystal Snail - HP Pickup 4"
crystal_snail_hp_3 = "Crystal Snail - HP Pickup 2"
crystal_snail_1up_1 = "Crystal Snail - 1-Up Pickup 1"
crystal_snail_hp_3 = "Crystal Snail - HP Pickup 3"
crystal_snail_hp_4 = "Crystal Snail - HP Pickup 3"
crystal_snail_1up_2 = "Crystal Snail - 1-Up Pickup 2"

overdrive_ostrich_boss = "Defeated Overdrive Ostrich"
Expand Down Expand Up @@ -144,6 +148,7 @@
x_hunter_stage_4_hp_2 = "X-Hunter Base 4 - HP Pickup 2"
x_hunter_stage_4_hp_3 = "X-Hunter Base 4 - HP Pickup 3"
x_hunter_stage_4_hp_4 = "X-Hunter Base 4 - HP Pickup 4"
x_hunter_stage_4_clear = "X-Hunter Base 4 - Clear"

x_hunter_stage_5_zero = "Defeated Zero"
victory = "Defeated Sigma"
11 changes: 2 additions & 9 deletions worlds/mmx2/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ class JammedBuster(Toggle):
"""
display_name = "Jammed Buster"

class DisableChargeFreeze(DefaultOnToggle):
"""
Allows X and Zero to move while shooting a level 3 charged shot.
"""
display_name = "Disable Level 3 Charge freeze after shooting"

class LongJumps(Toggle):
"""
Allows X to perform longer jumps when holding down the Dash button.
Expand Down Expand Up @@ -210,8 +204,8 @@ class BaseArmorUpgradeCount(Range):
"""
display_name = "Base Armor Upgrade Count"
range_start = 0
range_end = 8
default = 5
range_end = 4
default = 4

class BaseHeartTankCount(Range):
"""
Expand Down Expand Up @@ -329,7 +323,6 @@ class MMX2Options(PerGameCommonOptions):
jammed_buster: JammedBuster
long_jumps: LongJumps
shoryuken_in_pool: ShoryukenInPool
disable_charge_freeze: DisableChargeFreeze
logic_boss_weakness: LogicBossWeakness
base_boss_rematch_count: BaseBossRematchCount
base_all_levels: BaseBundleUnlock
Expand Down
Loading

0 comments on commit fb625fb

Please sign in to comment.