Editor texts (EN/DE), whole-campaign play and briefings for editor missions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 17:15:20 +01:00
1 parent 30dd8441b9
commit 985c34759d
6 files changed
+705 -14

No files matched your search

+33 -1
View File
@@ -28,6 +28,7 @@ pub enum Page {
Campaign, // list of the campaign missions
CampaignEditor, // editable shareable .dccamp campaign file
Briefing { mission: usize, ingame: bool }, // story and goals of a mission
CustomBriefing, // title and briefing of an editor mission
Login, // login to the savegame service (before the title)
Account, // password, logout, users (admin)
Match { from_title: bool }, // multiplayer lobby and match status
@@ -415,6 +416,7 @@ pub struct Menu {
pub coop_mission: usize, // co-op campaign mission selected on the Match page
pub in_match: bool, // a match is being played; the pause menu changes its shape
pub editor_test: bool, // a mission of the editor is being tested: back to the editor
pub custom_briefing: (String, String), // title and text of an editor mission's briefing
pub campaign_doc: CampaignDoc,
pub campaign_selected: usize,
pub campaign_pending: bool,
@@ -451,6 +453,7 @@ impl Menu {
coop_mission: crate::campaign::coop_mission_indexes().first().copied().unwrap_or(0),
in_match: false,
editor_test: false,
custom_briefing: (String::new(), String::new()),
campaign_doc: CampaignDoc::default(),
campaign_selected: 0,
campaign_pending: false,
@@ -489,6 +492,7 @@ impl Menu {
Some(Page::Bestiary { from_title: false, .. }) => Some(Page::Pause),
Some(Page::Briefing { ingame: true, .. }) => Some(Page::Pause),
Some(Page::Briefing { ingame: false, .. }) => Some(Page::Campaign),
Some(Page::CustomBriefing) => None,
Some(Page::Pause) => None,
Some(Page::Title) => Some(Page::Title),
None => Some(Page::Pause),
@@ -865,6 +869,7 @@ impl Menu {
Page::Account => self.draw_account(gfx, cloud),
Page::Match { .. } => self.draw_match(gfx, cloud),
Page::Briefing { mission, ingame } => self.draw_briefing(gfx, mission, ingame),
Page::CustomBriefing => self.draw_custom_briefing(gfx),
Page::Bestiary { tab, sel, level, .. } => self.draw_bestiary(gfx, tab, sel, level),
Page::KeyCapture { action, .. } => {
self.draw_settings(gfx, settings, 5);
@@ -1632,10 +1637,37 @@ impl Menu {
}
// scrolling on pages with lists (mouse wheel)
// the briefing of an editor mission: its text (scrolls) and a button to begin
fn draw_custom_briefing(&mut self, gfx: &Gfx) {
let (sw, sh) = (sw(), sh());
let cols = ((sw / CW()) as i32 - 2).min(64);
let rows = ((sh / CH()) as i32 - 2).min(28);
let x = grid_center(sw, cols as f32 * CW()).max(0.0);
let y = grid_center_y(sh, rows as f32 * CH()).max(0.0);
let (title, story) = self.custom_briefing.clone();
gfx.window_titled(x, y, cols, rows, S(), true, FRAME_HI, Color::new(0.05, 0.03, 0.04, 0.97), &title, FRAME_HI);
let maxc = (cols - 6) as usize;
let mut lines: Vec<String> = Vec::new();
for p in story.split('\n') {
lines.extend(wrap(p, maxc));
if wrap(p, maxc).is_empty() {
lines.push(String::new());
}
}
self.rows_visible = (rows as usize).saturating_sub(7).max(1);
self.scroll = self.scroll.min(lines.len().saturating_sub(self.rows_visible));
for (k, l) in lines.iter().skip(self.scroll).take(self.rows_visible).enumerate() {
gfx.text(l, x + CW() * 3.0, y + CH() * (2.0 + k as f32), S(), TXT);
}
let label = tr("camp.start");
let w = gfx.measure(&label, S()) + CW() * 6.0;
self.column(gfx, x + (cols as f32 * CW() - w) * 0.5, y + (rows - 4) as f32 * CH(), w, &[(Btn::Resume, label)]);
}
pub fn scrollable(&self) -> bool {
matches!(
self.page,
Some(Page::Saves { .. }) | Some(Page::Campaign) | Some(Page::CampaignEditor) | Some(Page::Briefing { .. }) | Some(Page::Settings { tab: 5, .. }) | Some(Page::Match { .. }) | Some(Page::Account)
Some(Page::Saves { .. }) | Some(Page::Campaign) | Some(Page::CampaignEditor) | Some(Page::Briefing { .. }) | Some(Page::CustomBriefing) | Some(Page::Settings { tab: 5, .. }) | Some(Page::Match { .. }) | Some(Page::Account)
)
}