Auto-pause when switching to another phase

Entering Live World (W), and starting/stopping hydrology (H or the Start Phase 3
button), now pause the sim first instead of immediately resuming, so you can look
at the world before the new stage runs (press SPACE to start). Leaving Live World
already paused; the continuous forming->drift geological clock is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jonas Reith 2026-06-30 14:07:17 +02:00
parent ee2ef3655b
commit 0638398d44

View File

@ -21,8 +21,8 @@ void Viewer::handleInput() {
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
if (phase3Prompt) { // modal: only the two buttons act if (phase3Prompt) { // modal: only the two buttons act
if (CheckCollisionPointRec(mp, p3StartBtn)) { if (CheckCollisionPointRec(mp, p3StartBtn)) {
phase3 = true; phase3Prompt = false; paused = false; phase3 = true; phase3Prompt = false; paused = true; // switching stage auto-pauses
phase3PromptAt = elapsedMy; setStatus("Hydrology started"); phase3PromptAt = elapsedMy; setStatus("Hydrology started - paused (SPACE to run)");
refreshView(); refreshView();
} else if (CheckCollisionPointRec(mp, p3ContinueBtn)) { } else if (CheckCollisionPointRec(mp, p3ContinueBtn)) {
phase3Prompt = false; paused = false; phase3Prompt = false; paused = false;
@ -176,11 +176,10 @@ void Viewer::handleInput() {
if (IsKeyPressed(KEY_G)) showGrat = !showGrat; if (IsKeyPressed(KEY_G)) showGrat = !showGrat;
if (IsKeyPressed(KEY_J)) showRivers = !showRivers; if (IsKeyPressed(KEY_J)) showRivers = !showRivers;
if (IsKeyPressed(KEY_H) && settled) { // toggle Phase 3 (hydrology) if (IsKeyPressed(KEY_H) && settled) { // toggle Phase 3 (hydrology)
bool wasPrompt = phase3Prompt;
phase3 = !phase3; phase3Prompt = false; phase3 = !phase3; phase3Prompt = false;
if (wasPrompt) paused = false; // taking the choice resumes the sim paused = true; // switching stage auto-pauses (SPACE to run)
if (phase3) { phase3PromptAt = elapsedMy; setStatus("Hydrology ON"); } if (phase3) { phase3PromptAt = elapsedMy; setStatus("Hydrology ON - paused (SPACE to run)"); }
else { phase3PromptAt = elapsedMy + planet.cfg.phase3AfterMy; rivers.clear(); bigRivers.clear(); setStatus("Hydrology OFF"); } else { phase3PromptAt = elapsedMy + planet.cfg.phase3AfterMy; rivers.clear(); bigRivers.clear(); setStatus("Hydrology OFF - paused"); }
refreshView(); refreshView();
} }
if (IsKeyPressed(KEY_L) && settled) { // generate / regenerate biota population if (IsKeyPressed(KEY_L) && settled) { // generate / regenerate biota population
@ -229,11 +228,11 @@ void Viewer::handleInput() {
if (IsKeyPressed(KEY_W) && settled) { // enter / leave Live World (slow real-time clock) if (IsKeyPressed(KEY_W) && settled) { // enter / leave Live World (slow real-time clock)
liveWorld = !liveWorld; liveWorld = !liveWorld;
if (liveWorld) { if (liveWorld) {
phase3Prompt = false; paused = false; wxUndo.clear(); phase3Prompt = false; paused = true; wxUndo.clear(); // enter Live World paused (SPACE to run)
if (planet.volcanoes.empty()) planet.placeVolcanoes(liveTime); // one-time tectonic-context placement if (planet.volcanoes.empty()) planet.placeVolcanoes(liveTime); // one-time tectonic-context placement
if (!planet.geographyBuilt()) planet.generateGeography(); // name the world's geography (the atlas) if (!planet.geographyBuilt()) planet.generateGeography(); // name the world's geography (the atlas)
refreshView(); // fresh base colours; overlay builds in stepSim refreshView(); // fresh base colours; overlay builds in stepSim
setStatus("Live World started"); setStatus("Live World started - paused (SPACE to run)");
} else { } else {
paused = true; followId = 0; wxUndo.clear(); refreshView(); // back to World Creation, paused paused = true; followId = 0; wxUndo.clear(); refreshView(); // back to World Creation, paused
setStatus("Live World stopped"); setStatus("Live World stopped");