diff options
| author | Jan <> | 2016-03-02 23:02:27 +0100 |
|---|---|---|
| committer | Jan <> | 2016-03-02 23:02:27 +0100 |
| commit | d4ddc149674f70bf2f102d3098b16071891ab739 (patch) | |
| tree | 9040529fcd8b4ea8d7da4848f772db4218d04b9f /TemplePushing.c4s | |
| parent | b9f6cc081dab694013258e18b7bf1ebc4980d042 (diff) | |
| download | tempelschubsen-d4ddc149674f70bf2f102d3098b16071891ab739.tar.gz tempelschubsen-d4ddc149674f70bf2f102d3098b16071891ab739.zip | |
Hide result of random section and mode selection until the game starts
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; + } } } |
