diff options
Diffstat (limited to 'TemplePushing.c4s')
| -rw-r--r-- | TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c | 67 |
1 files changed, 56 insertions, 11 deletions
diff --git a/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c b/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c index 6bd8790..bd26a3e 100644 --- a/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c +++ b/TemplePushing.c4s/Misc.c4d/SetupMenu.c4d/Script.c @@ -13,6 +13,7 @@ local clonk, setupPlayer; // Selected values local section, mode; +local selectRandomSection, selectRandomMode; local suddendeathEnabled, rotateInJumpEnabled; local ambienceEnabled; local numRelaunches; @@ -48,17 +49,29 @@ private func ShowSectionMenu() for (var i = 0; i < GetLength(Sections); ++i) { clonk->AddMenuItem(GetName(0, Sections[i]), Format("SelectSection(%i)", Sections[i]), Sections[i]); - CheckPreselect(Sections[i] == section, i); + CheckPreselect(!selectRandomSection && Sections[i] == section, i); } - clonk->AddMenuItem("$Random$", Format("SelectSection(%i)", Sections[Random(GetLength(Sections))]), SRND); + clonk->AddMenuItem("$Random$", "SelectRandomSection()", SRND); + CheckPreselect(selectRandomSection, GetLength(Sections)); } private func SelectSection(id selectedSection) { + selectRandomSection = false; section = selectedSection; - ShowMessage(); + SectionSelectionDone(); +} + +private func SelectRandomSection() +{ + selectRandomSection = true; + SectionSelectionDone(); +} +private func SectionSelectionDone() +{ + ShowMessage(); ShowModeMenu(); } @@ -70,18 +83,30 @@ private func ShowModeMenu() for (var m in Modes) { clonk->AddMenuItem(m[1], Format("SelectMode(%d)", m[0]), m[2]); - CheckPreselect(m[0] == mode, menuItemIndex++); + CheckPreselect(!selectRandomMode && m[0] == mode, menuItemIndex++); } - clonk->AddMenuItem("$Random$", Format("SelectMode(%d)", Modes[Random(GetLength(Modes))][0]), SRND); + clonk->AddMenuItem("$Random$", "SelectRandomMode()", SRND); + CheckPreselect(selectRandomMode, menuItemIndex++); clonk->AddMenuItem("$Back$", "ShowSectionMenu()", SBCK); } private func SelectMode(int selectedMode) { + selectRandomMode = false; mode = selectedMode; - ShowMessage(); + ModeSelectionDone(); +} + +private func SelectRandomMode() +{ + selectRandomMode = true; + ModeSelectionDone(); +} +private func ModeSelectionDone() +{ + ShowMessage(); ShowSettingsMenu(); } @@ -169,6 +194,11 @@ private func SelectSetting(int selectedSetting) private func SetupDone() { + // Apply random selection + if (selectRandomSection) section = Sections[Random(GetLength(Sections))]; + if (selectRandomMode) mode = Modes[Random(GetLength(Modes))][0]; + selectRandomSection = selectRandomMode = false; + // Show final setup message and start the game ShowMessage(); GameCall("SetupDone", this, GetMessage()); } @@ -213,15 +243,30 @@ private func ShowMessage() private func GetMessage() { - var msgSection = Format("$Landscape$: {{%i}} %s", section, GetName(0, section)); + var msgSection; + if (selectRandomSection) + { + msgSection = "$Landscape$: {{SRND}} $Random$"; + } + else + { + msgSection = Format("$Landscape$: {{%i}} %s", section, GetName(0, section)); + } var msgMode; - for (var m in Modes) + if (selectRandomMode) + { + msgMode = Format("$Mode$: {{SRND}} $Random$"); + } + else { - if (m[0] == mode) + for (var m in Modes) { - msgMode = Format("$Mode$: {{%i}} %s", m[2], m[1]); - break; + if (m[0] == mode) + { + msgMode = Format("$Mode$: {{%i}} %s", m[2], m[1]); + break; + } } } |
