Skip to content

Commit 985d27c

Browse files
authored
Merge pull request #2949 from UmedMuzl/dev-copy1
Helm Barriers/Ice Trap Model Selector
2 parents 8fecaa8 + 9626e3d commit 985d27c

File tree

15 files changed

+803
-664
lines changed

15 files changed

+803
-664
lines changed

base-hack/Build/build_dynamic_bitfields.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"fungi_yellow_tunnel",
1818
"shipwreck_gate",
1919
"llama_switches",
20+
"helm_star_gates",
21+
"helm_punch_gates",
2022
],
2123
"FasterChecks": [
2224
"piano",

base-hack/include/dynamic_structs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ typedef struct RemovedBarriers {
2323
unsigned char fungi_yellow_tunnel : 1; // 0x10
2424
unsigned char shipwreck_gate : 1; // 0x8
2525
unsigned char llama_switches : 1; // 0x4
26+
unsigned char helm_star_gates : 1; // 0x2
27+
unsigned char helm_punch_gates : 1; // 0x1
2628
} RemovedBarriers;
2729

2830
typedef enum ENUM_RemovedBarriers {
@@ -40,6 +42,8 @@ typedef enum ENUM_RemovedBarriers {
4042
/* 11 */ REMOVEDBARRIERS_ENUM_FUNGIYELLOWTUNNEL,
4143
/* 12 */ REMOVEDBARRIERS_ENUM_SHIPWRECKGATE,
4244
/* 13 */ REMOVEDBARRIERS_ENUM_LLAMASWITCHES,
45+
/* 14 */ REMOVEDBARRIERS_ENUM_HELMSTARGATES,
46+
/* 15 */ REMOVEDBARRIERS_ENUM_HELMPUNCHGATES,
4347
} ENUM_RemovedBarriers;
4448

4549
typedef struct FasterChecks {

base-hack/src/fixes/helm.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,18 @@ void initHelmSetup(void) {
8989
int setting = Rando.fast_start_helm;
9090
if (setting > 0) {
9191
setPermFlag(FLAG_STORY_HELM); // Helm Story
92+
if (setting == 2) {
93+
setPermFlag(FLAG_MODIFIER_HELMBOM);
94+
}
95+
}
96+
// Check barrier flags for gates
97+
if (Rando.removed_barriers.helm_star_gates) {
9298
setFlag(FLAG_HELM_ROMANDOORS_OPEN,1,FLAGTYPE_TEMPORARY); // Roman Numeral Doors
99+
}
100+
if (Rando.removed_barriers.helm_punch_gates) {
93101
for (int j = 0; j < 4; j++) {
94102
setFlag(FLAG_HELM_GATE_0 + j,1,FLAGTYPE_TEMPORARY); // Gates knocked down
95103
}
96-
if (setting == 2) {
97-
setPermFlag(FLAG_MODIFIER_HELMBOM);
98-
}
99104
}
100105
}
101106

morpher.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,24 @@ <h5 class="modal-title"></h5>
700700
console.log(`Inverting krool_key_count: ${old_value} -> ${setting_data.krool_key_count} (keys pregiven)`);
701701
}
702702
}
703+
if (sel_version_num < numericVersion("5.7.53")) {
704+
// Migrate helm barriers based on helm_setting
705+
if (setting_data.helm_setting === "skip_start" || setting_data.helm_setting === "skip_all") {
706+
console.log('Helm setting is skip_start/skip_all - enabling helm barriers');
707+
if (!setting_data.remove_barriers_selected.includes("helm_star_gates")) {
708+
setting_data.remove_barriers_selected.push("helm_star_gates");
709+
}
710+
if (!setting_data.remove_barriers_selected.includes("helm_punch_gates")) {
711+
setting_data.remove_barriers_selected.push("helm_punch_gates");
712+
}
713+
} else if (setting_data.helm_setting === "default") {
714+
console.log('Helm setting is default - disabling helm barriers');
715+
setting_data.remove_barriers_selected = setting_data.remove_barriers_selected.filter(b => b !== "helm_star_gates" && b !== "helm_punch_gates");
716+
}
717+
// Set ice trap model to complex
718+
console.log('Setting ice_trap_model to complex');
719+
setting_data.ice_trap_model = "complex";
720+
}
703721
// Update to include all unhandled options to unsorted
704722
const all_valid_items = Object.keys(output_json.ItemRandoListSelected);
705723
let mentioned_items = [];

randomizer/Enums/Settings.jsonc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,17 @@
493493
"unlimited": 5
494494
},
495495

496+
/*
497+
IceTrapModel:
498+
The Model type for Ice Traps
499+
- Simple: Only GB Ice Traps will appear
500+
- Complex: Any Ice Trap Model will appear
501+
*/
502+
"IceTrapModel": {
503+
"simple": 0,
504+
"complex": 1
505+
},
506+
496507
/*
497508
ItemRandoListSelected:
498509
- Item categories that may be randomized.
@@ -871,7 +882,9 @@
871882
"caves_igloo_pads": 14,
872883
"caves_ice_walls": 15,
873884
"galleon_treasure_room": 16,
874-
"aztec_tiny_temple_ice": 17
885+
"aztec_tiny_temple_ice": 17,
886+
"helm_star_gates": 18,
887+
"helm_punch_gates": 19
875888
},
876889

877890
/*
@@ -1390,7 +1403,8 @@
13901403
"trap_weight_disabletag": 289,
13911404
"random_starting_region_new": 290,
13921405
"kong_model_mode": 291,
1393-
"win_condition_spawns_ship": 292
1406+
"win_condition_spawns_ship": 292,
1407+
"ice_trap_model": 293
13941408
},
13951409
/*
13961410
SettingsStringDataType:
@@ -1446,6 +1460,7 @@
14461460
"helm_room_bonus_count": { "obj": "HelmBonuses" },
14471461
"helm_setting": { "obj": "HelmSetting" },
14481462
"ice_trap_frequency": { "obj": "IceTrapFrequency" },
1463+
"ice_trap_model": { "obj": "IceTrapModel" },
14491464
"item_rando_list_selected": { "obj": "ItemRandoListSelected" },
14501465
"kasplat_rando_setting": { "obj": "KasplatRandoSetting" },
14511466
"krusha_ui": { "obj": "KrushaUi" },
@@ -2011,6 +2026,7 @@
20112026
"obj": "SettingsStringDataType.bool"
20122027
},
20132028
"SettingsStringEnum.ice_trap_frequency": { "obj": "IceTrapFrequency" },
2029+
"SettingsStringEnum.ice_trap_model": { "obj": "IceTrapModel" },
20142030
"SettingsStringEnum.ice_traps_damage": {
20152031
"obj": "SettingsStringDataType.bool"
20162032
},

randomizer/Lists/Multiselectors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ def __init__(self, name: str, shift: int, tooltip: str = "") -> None:
159159
MultiselectorItem("Caves Igloo Pads", 3, "The pads to gain access to the five igloo rooms in Caves will be spawned."),
160160
MultiselectorItem("Caves Ice Walls", -1, "The various ice walls in Caves will be removed."),
161161
MultiselectorItem("Castle Crypt Doors", -1, "The various doors in the crypt and mausoleum areas of Creepy Castle will be removed."),
162+
MultiselectorItem("Helm Star Gates", 14, "The Roman numeral gates in Hideout Helm will be opened."),
163+
MultiselectorItem("Helm Punch Gates", 15, "The gates requiring Chunky's punch in Hideout Helm will be knocked down."),
162164
]
163165
FasterCheckItems = [
164166
MultiselectorItem("Factory Toy Monster Fight", -1, "The toy monster fight in Factory will remove the initial enemy killing phase."),

randomizer/LogicFiles/HideoutHelm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from randomizer.Enums.MinigameType import MinigameType
99
from randomizer.Enums.Regions import Regions
1010
from randomizer.Enums.HintRegion import HintRegion
11-
from randomizer.Enums.Settings import HelmSetting
11+
from randomizer.Enums.Settings import HelmSetting, RemovedBarriersSelected
1212
from randomizer.Enums.Transitions import Transitions
1313
from randomizer.LogicClasses import (Event, LocationLogic, Region,
1414
TransitionFront)
@@ -27,8 +27,8 @@
2727
LocationLogic(Locations.HelmDiddy1, lambda l: not l.settings.helm_diddy or l.settings.helm_setting == HelmSetting.skip_all),
2828
LocationLogic(Locations.HelmDiddy2, lambda l: not l.settings.helm_diddy or l.settings.helm_setting == HelmSetting.skip_all),
2929
], [
30-
Event(Events.HelmDoorsOpened, lambda l: l.settings.helm_setting != HelmSetting.default),
31-
Event(Events.HelmGatesPunched, lambda l: l.settings.helm_setting != HelmSetting.default),
30+
Event(Events.HelmDoorsOpened, lambda l: l.checkBarrier(RemovedBarriersSelected.helm_star_gates)),
31+
Event(Events.HelmGatesPunched, lambda l: l.checkBarrier(RemovedBarriersSelected.helm_punch_gates) and Events.HelmDoorsOpened in l.Events),
3232
Event(Events.HelmFinished, lambda l: l.settings.helm_setting == HelmSetting.skip_all),
3333
], [
3434
# These transitions route you to where the loading zone entering Helm will take you

randomizer/Settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ def generate_main(self):
421421
self.loading_zone_coupled = None
422422
self.move_rando = MoveRando.off
423423
self.ice_trap_frequency = IceTrapFrequency.mild # Deprecated
424+
self.ice_trap_model = IceTrapModel.simple
424425
self.start_with_slam = False
425426
self.random_patches = None
426427
self.random_crates = None
@@ -1408,7 +1409,10 @@ def resolve_settings(self):
14081409
"rockfall": self.trap_weight_rockfall,
14091410
"disabletag": self.trap_weight_disabletag,
14101411
}
1411-
models_chance = {"gb": 10, "key": 2, "bean": 1, "fairy": 4}
1412+
if self.ice_trap_model == IceTrapModel.simple:
1413+
models_chance = {"gb": 1} # Only GB models
1414+
else: # IceTrapModel.complex
1415+
models_chance = {"gb": 10, "key": 2, "bean": 1, "fairy": 4} # Weighted distribution
14121416
trap_data = {
14131417
"gb": {
14141418
"bubble": Items.IceTrapBubble,

static/patches/shrink-dk64.bps

109 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)