Add campaign editor script runtime and debug overlays

This commit is contained in:
Richard Zink committed 2026-11-05 12:22:59 +01:00
1 parent cd35ca8e3d
commit b06c48172b
13 files changed
+2211 -66

No files matched your search

+22 -1
View File
@@ -150,7 +150,12 @@ pub struct Settings {
pub ui_factor: u8, // interface size: 0 = automatic, 1..4 = fixed integer factor
pub render_scale: u8, // 3D world resolution divisor: 1 = full, 2..16 = pixel look
pub touch_ui: u8, // touch interface: 0 = automatic (after the first touch), 1 = on, 2 = off
pub debug_fps: bool, // show FPS and rendering backend
pub debug_fps: bool, // show FPS and rendering backend
pub debug_frame_time: bool, // show the frame-time line and graph
pub debug_ping: bool, // show network ping
pub debug_trigger_zones: bool, // draw mission trigger zones
pub debug_command_markers: bool, // draw extra command markers (guard/attack/gather stay fixed)
pub debug_path_lines: bool, // draw creature path lines
// game
pub game_speed: f32, // 1 or 2
pub hints: bool,
@@ -181,6 +186,11 @@ impl Default for Settings {
render_scale: 1,
touch_ui: 0,
debug_fps: false,
debug_frame_time: false,
debug_ping: false,
debug_trigger_zones: false,
debug_command_markers: false,
debug_path_lines: false,
game_speed: 1.0,
hints: true,
difficulty: 1,
@@ -236,10 +246,21 @@ mod tests {
fn debug_fps_round_trips() {
let mut s = Settings::default();
assert!(!s.debug_fps);
assert!(!s.debug_frame_time);
assert!(!s.debug_ping);
assert!(!s.debug_trigger_zones);
assert!(!s.debug_command_markers);
assert!(!s.debug_path_lines);
s.debug_fps = true;
s.debug_trigger_zones = true;
s.debug_command_markers = true;
let l = Settings::from_json(&s.to_json()).expect("settings serialize back");
assert!(l.debug_fps);
assert!(l.debug_trigger_zones);
assert!(l.debug_command_markers);
let old = Settings::from_json(r#"{"language":"en","map_w":64,"map_h":64}"#).expect("old settings remain readable");
assert!(!old.debug_fps);
assert!(!old.debug_trigger_zones);
assert!(!old.debug_command_markers);
}
}