sm64ex: Refactor Regions (#2546)

Refactors region code to remove references to course index.
There were bugs somewhere, but I dont know where tbh.
This fixes them but leaves logic otherwise intact, and much cleaner to look at as there's one list less to take care of.

Additionally, this fixes stopping the clock from Big Boos Haunt.
This commit is contained in:
Yussur Mustafa Oraji
2023-12-06 18:19:03 +01:00
committed by GitHub
parent 229a263131
commit 530617c9a7
3 changed files with 107 additions and 82 deletions

View File

@@ -5,26 +5,43 @@ from .Locations import SM64Location, location_table, locBoB_table, locWhomp_tabl
locHMC_table, locLLL_table, locSSL_table, locDDD_table, locSL_table, \
locWDW_table, locTTM_table, locTHI_table, locTTC_table, locRR_table, \
locPSS_table, locSA_table, locBitDW_table, locTotWC_table, locCotMC_table, \
locVCutM_table, locBitFS_table, locWMotR_table, locBitS_table, locSS_table
locVCutM_table, locBitFS_table, locWMotR_table, locBitS_table, locSS_table
# List of all courses, including secrets, without BitS as that one is static
sm64courses = ["Bob-omb Battlefield", "Whomp's Fortress", "Jolly Roger Bay", "Cool, Cool Mountain", "Big Boo's Haunt",
"Hazy Maze Cave", "Lethal Lava Land", "Shifting Sand Land", "Dire, Dire Docks", "Snowman's Land",
"Wet-Dry World", "Tall, Tall Mountain", "Tiny-Huge Island", "Tick Tock Clock", "Rainbow Ride",
"The Princess's Secret Slide", "The Secret Aquarium", "Bowser in the Dark World", "Tower of the Wing Cap",
"Cavern of the Metal Cap", "Vanish Cap under the Moat", "Bowser in the Fire Sea", "Wing Mario over the Rainbow"]
# sm64paintings is dict of entrances, format LEVEL | AREA
sm64_level_to_paintings = {
91: "Bob-omb Battlefield",
241: "Whomp's Fortress",
121: "Jolly Roger Bay",
51: "Cool, Cool Mountain",
41: "Big Boo's Haunt",
71: "Hazy Maze Cave",
221: "Lethal Lava Land",
81: "Shifting Sand Land",
231: "Dire, Dire Docks",
101: "Snowman's Land",
111: "Wet-Dry World",
361: "Tall, Tall Mountain",
132: "Tiny-Huge Island (Tiny)",
131: "Tiny-Huge Island (Huge)",
141: "Tick Tock Clock",
151: "Rainbow Ride"
}
sm64_paintings_to_level = { painting: level for (level,painting) in sm64_level_to_paintings.items() }
# sm64secrets is list of secret areas, same format
sm64_level_to_secrets = {
271: "The Princess's Secret Slide",
201: "The Secret Aquarium",
171: "Bowser in the Dark World",
291: "Tower of the Wing Cap",
281: "Cavern of the Metal Cap",
181: "Vanish Cap under the Moat",
191: "Bowser in the Fire Sea",
311: "Wing Mario over the Rainbow"
}
sm64_secrets_to_level = { secret: level for (level,secret) in sm64_level_to_secrets.items() }
# sm64paintings is list of entrances, format LEVEL | AREA. String Reference below
sm64paintings = [91,241,121,51,41,71,221,81,231,101,111,361,132,131,141,151]
sm64paintings_s = ["BOB", "WF", "JRB", "CCM", "BBH", "HMC", "LLL", "SSL", "DDD", "SL", "WDW", "TTM", "THI Tiny", "THI Huge", "TTC", "RR"]
# sm64secrets is list of secret areas
sm64secrets = [271, 201, 171, 291, 281, 181, 191, 311]
sm64secrets_s = ["PSS", "SA", "BitDW", "TOTWC", "COTMC", "VCUTM", "BitFS", "WMOTR"]
sm64entrances = sm64paintings + sm64secrets
sm64entrances_s = sm64paintings_s + sm64secrets_s
sm64_internalloc_to_string = dict(zip(sm64paintings+sm64secrets, sm64entrances_s))
sm64_internalloc_to_regionid = dict(zip(sm64paintings+sm64secrets, list(range(13)) + [12,13,14] + list(range(15,15+len(sm64secrets)))))
sm64_entrances_to_level = { **sm64_paintings_to_level, **sm64_secrets_to_level }
sm64_level_to_entrances = { **sm64_level_to_paintings, **sm64_level_to_secrets }
def create_regions(world: MultiWorld, player: int):
regSS = Region("Menu", player, world, "Castle Area")
@@ -137,11 +154,13 @@ def create_regions(world: MultiWorld, player: int):
regTTM.locations.append(SM64Location(player, "TTM: 100 Coins", location_table["TTM: 100 Coins"], regTTM))
world.regions.append(regTTM)
regTHI = create_region("Tiny-Huge Island", player, world)
create_default_locs(regTHI, locTHI_table, player)
regTHIT = create_region("Tiny-Huge Island (Tiny)", player, world)
create_default_locs(regTHIT, locTHI_table, player)
if (world.EnableCoinStars[player].value):
regTHI.locations.append(SM64Location(player, "THI: 100 Coins", location_table["THI: 100 Coins"], regTHI))
world.regions.append(regTHI)
regTHIT.locations.append(SM64Location(player, "THI: 100 Coins", location_table["THI: 100 Coins"], regTHIT))
world.regions.append(regTHIT)
regTHIH = create_region("Tiny-Huge Island (Huge)", player, world)
world.regions.append(regTHIH)
regFloor3 = create_region("Third Floor", player, world)
world.regions.append(regFloor3)