Skip to content

wc3: Support RoC 1.00 CD data, retail campaign selector, and UI sounds - #576

Merged
corepunch merged 1 commit into
mainfrom
wc3-roc-cd-campaign-ui
Oct 4, 2026
Merged

corepunch merged 1 commit into
mainfrom
wc3-roc-cd-campaign-ui

Conversation

@corepunch

@corepunch corepunch commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

A player pointing OpenWarcraft3 at a Reign of Chaos CD folder (Manjaro) saw a black campaign screen. The 1.00 War3.mpq ships an older UI\CampaignStrings.txt with no Background key, so no backdrop model was ever loaded. Fixing that exposed several layout and sound gaps against retail, which this PR also closes.

Legacy 1.00 campaign data

  • Parse the pre-1.01 CampaignStrings.txt layout: TitleN mission headers, name-only InCinematic/OpCinematic/EdCinematic (movies <Key>In/Op/Ed, headers from [Label]), and a <Key>Backdrop skin fallback.
  • Console warnings (in-game and stderr) whenever a campaign falls back, a backdrop fails to load, or a movie is skipped in a build without FFmpeg.

Campaign / mission selector (ROC and TFT)

  • Patched clients build both columns at runtime from CampaignStrings. Rows are arrow buttons (maps, campaigns) or camera buttons (movies), with a gold header and a grey name.
    • Slots: fixed 0.0315625 slots, ten to a box (TFT CampaignListBox scrollbar height).
    • Spacing: a blank slot after every campaign and after an Introduction.
    • Overflow: a column that fits is centred in the box; a longer one scrolls with the mouse wheel, via a new uiScreen_t.scroll hook.
  • The constants were fitted to retail 1.2x screenshots; both the two-campaign screen and the Prologue mission screen match within about a pixel.
  • The static 1.00 FDF rows (TutorialFrame…, Mission0Frame…) are always hidden. They previously overlapped the generated list.
  • Show the MainMenuLogo sprite anchored top-right, as the main menu and Warsmash do.
  • Back from the mission column restores the selector's backdrop and replays its Birth camera move.

Interface sounds

  • The sound module registers UISounds.slk rows as named kits when there is no SoundEntries.dbc, decoded with a slkField_t schema like the game module's SLKs. The menu plays GlueScreenClick on glue clicks through the imported PlaySoundByName.
  • Kits pick a file variant per play (DBC freq weights or uniform) and load it through the path-keyed sfx_t table.
  • Glue panel SND events (Left/RightGlueScreenPopDown/Up) now fire.
    • Why they were silent: UI sprites all shared entity 0's event state, so every panel reset it before a key could fire.
    • Fix: sprites render with a new RDF_UI_SPRITE flag, get per-instance event state, and play non-positionally (a NULL origin passed to PlaySoundAt).
  • Sound-name hashing now folds case to match the case-insensitive lookup. An unknown name is reported once.

Testing

  • openwarcraft3-tests: 46376/46376 in both ROC and TFT (rebased on main, after exe version reporting #575).
  • test-menu: 1220/1220, and 1227/1227 compiled with -DBZ_FFMPEG. Includes new selector-row, scrolling and legacy-data tests.
  • test-sound: 1698/1698, with a new UISounds kit and variant test.
  • test-renderer-model 6030/6030, test-mdx-ui 97/97, test-mpq-compression 46/46.
  • Checked by screenshot against a folder with only the 2002 CD War3.mpq, plus a TFT install.

Reviewer notes

  • Not verified visually here: cinematic rows (no FFmpeg locally), and a real more-than-ten-entry list scrolling in the game. Both are covered by unit tests.
  • With 1.00 data there is no DefaultOpen, so wc3_campaign_visibility unlocked shows nothing until progress exists. The default all shows every campaign.
  • Movie lookup on disk is still case-sensitive on Linux; a CD copy with movies/ would report "Movie not found". Not addressed here.

🤖 Generated with Claude Code

A RoC CD install ships only the 1.00 War3.mpq, whose CampaignStrings.txt
predates the Background/CampaignList schema, so the campaign screen loaded
no backdrop and stayed black. Parse that legacy layout (TitleN headers,
name-only cinematics with [Label] headers, <Key>Backdrop skin fallback)
and warn in the console whenever a fallback or a blank backdrop happens.

Rebuild the campaign and mission selectors the way patched clients do:
runtime rows of arrow/camera buttons in fixed 0.0315625 slots, a blank
after each campaign and after an Introduction, centred in a ten-slot box
and wheel-scrolled when longer. The static 1.00 FDF rows stay hidden.
Show the MainMenuLogo, and restore the selector backdrop on Back.

Add interface sounds through the imported PlaySoundByName path: register
UISounds.slk rows as named kits when no SoundEntries.dbc exists, play
GlueScreenClick on glue clicks, pick kit file variants per play, and fire
glue panel SND events by giving UI sprites per-instance event state and
non-positional playback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@corepunch
corepunch force-pushed the wc3-roc-cd-campaign-ui branch from 1ddd8c4 to 9d917e4 Compare October 4, 2026 09:12
@corepunch
corepunch merged commit c46f048 into main Oct 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant