Skip to content

Commit 13c74ca

Browse files
committed
Baseline for Bowser Rooms shuffling
1 parent 61c1d2f commit 13c74ca

File tree

3 files changed

+119
-15
lines changed

3 files changed

+119
-15
lines changed

worlds/smw/Levels.py

+43-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,48 @@
11

22
from .Names import LocationName
33

4+
5+
class BowserRoom():
6+
name: str
7+
exitAddress: int
8+
roomID: int
9+
10+
def __init__(self, name: str, exitAddress: int, roomID: int):
11+
self.name = name
12+
self.exitAddress = exitAddress
13+
self.roomID = roomID
14+
15+
full_bowser_rooms = [
16+
BowserRoom("Hallway 1 - Door 1", 0x3A680, 0x0D),
17+
BowserRoom("Hallway 1 - Door 2", 0x3A684, 0x0D),
18+
BowserRoom("Hallway 1 - Door 3", 0x3A688, 0x0D),
19+
BowserRoom("Hallway 1 - Door 4", 0x3A68C, 0x0D),
20+
BowserRoom("Hallway 2 - Door 1", 0x3A8CB, 0xD0),
21+
BowserRoom("Hallway 2 - Door 2", 0x3A8CF, 0xD0),
22+
BowserRoom("Hallway 2 - Door 3", 0x3A8D3, 0xD0),
23+
BowserRoom("Hallway 2 - Door 4", 0x3A8D7, 0xD0),
24+
25+
BowserRoom("Room 1", 0x3A705, 0xD4),
26+
BowserRoom("Room 2", 0x3A763, 0xD3),
27+
BowserRoom("Room 3", 0x3A800, 0xD2),
28+
BowserRoom("Room 4", 0x3A83D, 0xD1),
29+
BowserRoom("Room 5", 0x3A932, 0xCF),
30+
BowserRoom("Room 6", 0x3A9E1, 0xCE),
31+
BowserRoom("Room 7", 0x3AA75, 0xCD),
32+
BowserRoom("Room 8", 0x3AAC7, 0xCC),
33+
]
34+
35+
standard_bowser_rooms = [
36+
BowserRoom("Room 1", 0x3A705, 0xD4),
37+
BowserRoom("Room 2", 0x3A763, 0xD3),
38+
BowserRoom("Room 3", 0x3A800, 0xD2),
39+
BowserRoom("Room 4", 0x3A83D, 0xD1),
40+
BowserRoom("Room 5", 0x3A932, 0xCF),
41+
BowserRoom("Room 6", 0x3A9E1, 0xCE),
42+
BowserRoom("Room 7", 0x3AA75, 0xCD),
43+
BowserRoom("Room 8", 0x3AAC7, 0xCC),
44+
]
45+
446
class SMWPath():
547
thisEndDirection: int
648
otherLevelID: int
@@ -30,7 +72,7 @@ def __init__(self, levelName: str, levelIDAddress: int, eventIDValue: int, exit1
3072
#self.progressByte = progressByte # Inferred from EventIDValue: (ID / 8) + $1F02
3173
#self.progressBit = progressBit # Inferred from EventIDValue: 1 << (7 - (ID % 8))
3274
self.exit1Path = exit1Path
33-
self.exit2Path = exit2Path
75+
self.exit2Path = exit2Path
3476

3577

3678
level_info_dict = {

worlds/smw/Options.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class BowserCastleDoors(Choice):
5858
Vanilla: Front and Back Doors behave as vanilla
5959
Fast: Both doors behave as the Back Door
6060
Slow: Both doors behave as the Front Door
61-
"Front Door" requires beating all 8 Rooms
61+
"Front Door" rooms depend on the `bowser_castle_rooms` option
6262
"Back Door" only requires going through the dark hallway to Bowser
6363
"""
6464
display_name = "Bowser Castle Doors"
@@ -68,6 +68,24 @@ class BowserCastleDoors(Choice):
6868
default = 0
6969

7070

71+
class BowserCastleRooms(Choice):
72+
"""
73+
How the rooms of Bowser's Castle Front Door behave
74+
Vanilla: You can choose which rooms to enter, as in vanilla
75+
Random Two Room: Two random rooms are chosen
76+
Random Five Room: Five random rooms are chosen
77+
Gauntlet: All eight rooms must be cleared
78+
Labyrinth: Which room leads to Bowser?
79+
"""
80+
display_name = "Bowser Castle Rooms"
81+
option_vanilla = 0
82+
option_random_two_room = 1
83+
option_random_five_room = 2
84+
option_gauntlet = 3
85+
option_labyrinth = 4
86+
default = 1
87+
88+
7189
class LevelShuffle(Toggle):
7290
"""
7391
Whether levels are shuffled
@@ -220,6 +238,7 @@ class StartingLifeCount(Range):
220238
"percentage_of_yoshi_eggs": PercentageOfYoshiEggs,
221239
"dragon_coin_checks": DragonCoinChecks,
222240
"bowser_castle_doors": BowserCastleDoors,
241+
"bowser_castle_rooms": BowserCastleRooms,
223242
"level_shuffle": LevelShuffle,
224243
"swap_donut_gh_exits": SwapDonutGhostHouseExits,
225244
#"display_sent_item_popups": DisplaySentItemPopups,

worlds/smw/Rom.py

+56-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Utils
22
from worlds.Files import APDeltaPatch
33
from .Aesthetics import generate_shuffled_header_data
4-
from .Levels import level_info_dict
4+
from .Levels import level_info_dict, full_bowser_rooms, standard_bowser_rooms
55
from .Names.TextBox import generate_goal_text, title_text_mapping, generate_text_box
66

77
USHASH = 'cdd3c8c37322978ca8669b34bc89c804'
@@ -728,6 +728,60 @@ def handle_swap_donut_gh_exits(rom):
728728
rom.write_bytes(0x26371, bytes([0x32]))
729729

730730

731+
def handle_bowser_rooms(rom, world, player):
732+
if world.bowser_castle_rooms[player] == "random_two_room":
733+
chosen_rooms = world.random.sample(standard_bowser_rooms, 2)
734+
735+
rom.write_byte(0x3A680, chosen_rooms[0].roomID)
736+
rom.write_byte(0x3A684, chosen_rooms[0].roomID)
737+
rom.write_byte(0x3A688, chosen_rooms[0].roomID)
738+
rom.write_byte(0x3A68C, chosen_rooms[0].roomID)
739+
740+
for i in range(1, len(chosen_rooms)):
741+
rom.write_byte(chosen_rooms[i-1].exitAddress, chosen_rooms[i].roomID)
742+
743+
rom.write_byte(chosen_rooms[len(chosen_rooms)-1].exitAddress, 0xBD)
744+
745+
elif world.bowser_castle_rooms[player] == "random_five_room":
746+
chosen_rooms = world.random.sample(standard_bowser_rooms)
747+
748+
rom.write_byte(0x3A680, chosen_rooms[0].roomID)
749+
rom.write_byte(0x3A684, chosen_rooms[0].roomID)
750+
rom.write_byte(0x3A688, chosen_rooms[0].roomID)
751+
rom.write_byte(0x3A68C, chosen_rooms[0].roomID)
752+
753+
for i in range(1, len(chosen_rooms)):
754+
rom.write_byte(chosen_rooms[i-1].exitAddress, chosen_rooms[i].roomID)
755+
756+
rom.write_byte(chosen_rooms[len(chosen_rooms)-1].exitAddress, 0xBD)
757+
758+
elif world.bowser_castle_rooms[player] == "gauntlet":
759+
chosen_rooms = standard_bowser_rooms.copy()
760+
world.random.shuffle(chosen_rooms)
761+
762+
rom.write_byte(0x3A680, chosen_rooms[0].roomID)
763+
rom.write_byte(0x3A684, chosen_rooms[0].roomID)
764+
rom.write_byte(0x3A688, chosen_rooms[0].roomID)
765+
rom.write_byte(0x3A68C, chosen_rooms[0].roomID)
766+
767+
for i in range(1, len(chosen_rooms)):
768+
rom.write_byte(chosen_rooms[i-1].exitAddress, chosen_rooms[i].roomID)
769+
770+
rom.write_byte(chosen_rooms[len(chosen_rooms)-1].exitAddress, 0xBD)
771+
elif world.bowser_castle_rooms[player] == "labyrinth":
772+
bowser_rooms_copy = full_bowser_rooms.copy()
773+
774+
entrance_point = bowser_rooms_copy.pop(0)
775+
776+
world.random.shuffle(bowser_rooms_copy)
777+
778+
rom.write_byte(entrance_point.exitAddress, bowser_rooms_copy[0].roomID)
779+
for i in range(0, len(bowser_rooms_copy) - 1):
780+
rom.write_byte(bowser_rooms_copy[i].exitAddress, bowser_rooms_copy[i+1].roomID)
781+
782+
rom.write_byte(chosen_rooms[len(chosen_rooms)-1].exitAddress, 0xBD)
783+
784+
731785
def patch_rom(world, rom, player, active_level_dict):
732786
local_random = world.slot_seeds[player]
733787

@@ -739,18 +793,7 @@ def patch_rom(world, rom, player, active_level_dict):
739793
intro_text = generate_text_box("Bowser has stolen all of Mario's abilities. Can you help Mario travel across Dinosaur land to get them back and save the Princess from him?")
740794
rom.write_bytes(0x2A5D9, intro_text)
741795

742-
# Force all 8 Bowser's Castle Rooms
743-
rom.write_byte(0x3A680, 0xD4)
744-
rom.write_byte(0x3A684, 0xD4)
745-
rom.write_byte(0x3A688, 0xD4)
746-
rom.write_byte(0x3A68C, 0xD4)
747-
rom.write_byte(0x3A705, 0xD3)
748-
rom.write_byte(0x3A763, 0xD2)
749-
rom.write_byte(0x3A800, 0xD1)
750-
rom.write_byte(0x3A83D, 0xCF)
751-
rom.write_byte(0x3A932, 0xCE)
752-
rom.write_byte(0x3A9E1, 0xCD)
753-
rom.write_byte(0x3AA75, 0xCC)
796+
handle_bowser_rooms(rom, world, player)
754797

755798
# Prevent Title Screen Deaths
756799
rom.write_byte(0x1C6A, 0x80)

0 commit comments

Comments
 (0)