1568 Commits
Author SHA1 Message Date
Vladislav Belov 086f9317e0 Removes wfirmware 2026-10-17 15:53:23 +02:00
phosit 369a7e7e5d Use fmt::format for LOGERROR
The format string can be checked at compile time. It will be easier to
transition to `std::format`.
2026-10-05 20:29:26 +02:00
Stanislas Daniel Claude Dolcini 282cd1eb60 Scan JS for literal audio paths
Audio files referenced directly in GUI/simulation JS strings
(e.g. g_FlareSound, soundfile entries, Ambient tracks) were not
tracked. Add a js_audio_regex scan alongside the existing sprite
scan for both gui/ and simulation/ JS files.
2026-10-03 23:13:47 +02:00
Stanislas Daniel Claude Dolcini 6856ca3349 Fix checkrefs ruff lint/format issues 2026-10-03 23:13:35 +02:00
Stanislas Daniel Claude Dolcini 4bc1938ddc Track many more dynamically-constructed UI texture paths
Several categories of session UI textures were falsely reported as
unused because checkrefs only parsed XML/JSON data files and missed
texture references buried in JavaScript runtime logic.

Entity templates:
- Parse <Identity><Rank> to track session/icons/ranks/{rank}.png
- Parse <Minimap><Icon> to track session/icons/minimap/{icon}.png

Data-driven JSON files:
- Add add_resources(): scan simulation/data/resources/*.json for
  resource 'code' fields -> session/icons/resources/{code}.png
- Add add_status_effects(): scan simulation/data/status_effects/*.json
  for 'icon' fields -> session/icons/status_effects/{icon}.png

Technology files:
- In add_techs(): detect phase_*.json base techs (e.g. phase_city.json)
  and add session/panel_phase_emblems_{phase}.png as a dep

JS scanning (extended):
- Extend the GUI JS literal-path regex to also recognise:
  - 'texture:' sprite modifier prefix
  - full 'art/textures/ui/...' literal paths
  - bare 'session/...' paths used as runtime sprite components
- Also scan simulation/components, simulation/helpers and globalscripts
  JS files (registered as roots) with the same regex so textures
  referenced from simulation code are tracked
- Add _add_unit_action_icon_deps(): parse unit_actions.js for
  'icon': 'X.png' properties -> session/icons/X
- Add _add_status_bar_icon_deps(): parse StatusBars.js AddBar() calls
  for bar type strings -> session/icons/{type}_bg/fg.png
- Add _add_stance_icon_deps(): parse g_Stances in UnitAI.js for
  selectable stance keys -> session/icons/stances/{stance}.png
2026-10-03 22:55:40 +02:00
Stanislas Daniel Claude Dolcini 0a8369c0b8 Scan JS for literal sprite paths, track civ background circles
Two sources of false-positive unused-file warnings:

1. Literal stretched:/cropped: sprite paths in GUI JS files (e.g.
   bell_level0.png, cancel.png, minimap flare textures) were never
   tracked because JS is not parsed for texture deps. Add a regex scan
   of gui/*.js for complete literal sprite paths ending in a known
   texture extension, filtering out dynamic string concatenations
   (+ / ${...}).

2. Per-civ background circle textures (bkg/background_circle_<code>.png)
   are constructed at runtime in MiniMapPanel.js via a template literal
   using the player civ code. Add a dep from each civ JSON to its
   corresponding background circle texture.
2026-10-03 22:55:22 +02:00
Stanislas Daniel Claude Dolcini d8e040f84b Handle <icon> elements in GUI setup XML
Icons defined in setup XML files (e.g. lobby/icons/public.xml) have
sprite attributes that reference UI textures, but the setup parser only
handled <scrollbar>, <tooltip> and <color> tags. This caused textures
like lobby/public.png to be falsely reported as unused by -u.
2026-10-03 22:54:55 +02:00
Stanislas Daniel Claude Dolcini 9419eb55e6 Add JSON registry for C++-hardcoded asset paths
Some engine assets are loaded directly by C++ renderer code with no
corresponding reference in any XML template, actor, or data file that
checkrefs.py can statically trace. Files in mod layers that override
these paths were incorrectly reported as unused.

Introduce source/tools/entity/cpp_hardcoded_assets.json to maintain
the list of such VFS paths alongside their C++ source location and a
description. checkrefs.py reads this JSON via add_cpp_hardcoded_assets()
and marks every matching file in all loaded mod layers as a known-used
root, so mod overrides are no longer flagged.

Initial entries:
  art/textures/terrain/types/water/coastalWave.png
  art/textures/terrain/types/water/foam.png
Both are loaded unconditionally by WaterManager::LoadWaterTextures().

Fixes 2 false-positive unused-file warnings for mod/ water textures.
2026-10-03 22:54:48 +02:00
Stanislas Daniel Claude Dolcini 49aeda6767 Track terrain alphamap PNG files loaded by C++
TerrainTextureManager::LoadAlphaMap() hardcodes 14 PNG filenames and
loads them from art/textures/terrain/alphamaps/<type>/ where <type>
comes from the terrain XML <alphamap> element (defaulting to
"standard"). checkrefs add_terrains() parsed <textures> and
<material> but never read <alphamap> and had no knowledge of the
filenames loaded by C++.

Changes:
- Read <alphamap> from each terrain XML (default "standard") and
  add all 14 hardcoded PNG filenames as deps of the terrain file.
- Always register the "standard" set as roots since C++ loads it
  unconditionally as a fallback, even when no terrain specifies it.

The filenames are kept in sync with the fnames[] array in
source/graphics/TerrainTextureManager.cpp.

Fixes 14 false-positive unused-file warnings for the standard/
alphamap set.
2026-10-03 22:54:42 +02:00
Stanislas Daniel Claude Dolcini d65e51c38b Track LineTexture from Selectable/Overlay/Outline
The entity parser handled LineTexture/LineTextureMask under
Heal/RangeOverlay and MainTexture/MainTextureMask under
Selectable/Overlay/Texture, but had no handling for the
Selectable/Overlay/Outline/{LineTexture,LineTextureMask} path
used by the outline selection ring renderer.

These textures are referenced in e.g. mixins/trading_post.xml and
any other template that sets a custom outline selection style.

Fixes 2 false-positive unused-file warnings:
  art/textures/selection/outline_border_02.png
  art/textures/selection/outline_border_02_mask.png
2026-10-03 22:54:37 +02:00
Stanislas Daniel Claude Dolcini e5c1b68481 Fix <sprites> parser to read <image> child elements
The sprites XML parser iterated sprite.attrib.items() — the attributes
of the <sprite> tag itself — and checked if el == "image". Since
<image texture="..."> elements are children of <sprite>, not its
attributes, this check could never be true. No texture dependency was
ever extracted from any sprites definition file.

Fix by iterating sprite.findall("image") and sprite.findall("effect")
to correctly traverse child elements, and read attributes from those
elements directly.

Fixes 99 false-positive unused-file warnings across global/border/,
global/button/, global/modern/, global/watermark/, loading/,
pregame/, session/, and tipdisplay/ UI texture directories.
2026-10-03 22:54:30 +02:00
Stanislas Daniel Claude Dolcini 806225a5d4 Track default music tracks from music.js and cheats
checkrefs.py only traced music files referenced in civ JSON Music[]
arrays. Two additional sources were missed:

- gui/common/music.js DEFAULT_*_TRACKS prototype arrays define fallback
  playlists used when a civ has no music entries. All .ogg filenames
  found in that file are now added as deps of the music.js root.
- simulation/data/cheats/*.json files can reference audio files via
  Data.DefaultParameter (e.g. retroMe.json -> 0_8Bit_Bonus_Track.ogg).
  These are now tracked as deps of each cheat root.

Fixes 10 false-positive unused-file warnings.
2026-10-03 22:54:15 +02:00
trompetin17 0ed48b3a1f Add viewer entity template and update entity naming in ActorViewer
After #7164, entities in the ActorViewer are loaded through the
preview filter, which disables shadows by design. As a result, the
shadow toggle no longer has any visible effect.

Adds a dedicated viewer.xml template so the ActorViewer no longer
inherits the preview filter's shadow behaviour, keeping preview.xml
untouched for the entities that legitimately need shadows off.

Refs #7164
Reported by: Vladislav
2026-09-24 09:10:47 -05:00
phosit 6a0c8c1a5a Remove u32
It's better to use types from the standard library.
2026-09-21 18:11:31 +02:00
phosit 500606e587 Remove u16
It's better to use types from the standard library.
2026-09-21 18:11:22 +02:00
phosit 00ee825374 Remove u8
It's better to use types from the standard library.
2026-09-21 18:11:14 +02:00
Vladislav Belov 9dec9c1d53 Removes SMBIOS
It was implemented on Windows only. It doesn't really contain a useful
for us information which can not be obtained by diagnostic tools like
dxdiag when needed.
2026-09-21 01:10:35 +02:00
phosit 982ede2a55 Remove CStr::Find(CStr)
It was only a wrapper around `std::string::find`. In some places it's
now better to use `std::string::starts_with`.
2026-08-23 17:46:52 +02:00
Ralph Sennhauser df72c1aad1 Support scroll-rotate in Atlas
Split mouse wheel scroll handling into horizontal and vertical. Keep
vertical scroll for zooming and use horizontal to rotate around the y
axis replicating the behaviour of the main game.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-08-10 09:00:07 +02:00
Stan f90804c78f Add macOS hint for game mode. 2026-08-07 14:09:25 +02:00
Ralph Sennhauser 822092fcb4 Fix set camera tooltip in Atlas player section
Refs: fe192fe58f
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-08-04 17:22:21 +02:00
Ralph Sennhauser 6e79dc2f70 Use dynamic events for Cinema Section
Replace static events with dynamic events and name delete path function
more aptly.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-08-04 17:04:22 +02:00
phosit 7aa756f6a4 Remove line numbers from cppcheck supression list
They have to be changed to ofthen when code gets moved.
2026-08-02 14:03:28 +02:00
Dunedan 865ca4cd55 Update the pre-commit hooks 2026-08-01 16:19:18 +02:00
Ralph Sennhauser 49c887b7ca Don't nest Paths in Common settings
Doesn't make sense to have the Paths StaticBox inside the Common
settings StaticBox so make it a top-level item as well.

While at it dissolve nested constructors to make the creation of the
widgets more readable.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-30 18:43:24 +02:00
Ralph Sennhauser cf7b8aab39 Preserve Cinema Path selection
Commit 81c57e8a28 added support for adding and removing paths.
Reloading path list stores the current selection but it's unused, assume
the idea was to restore it again.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-25 17:18:16 +02:00
Ralph Sennhauser df06b6895e Don't mix static and dynamic events
Commit 309ed5ef28 used dynamic events
which prevents some other menu items from working properly. So don't mix
static and dynamic events for top window.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-25 14:05:38 +02:00
Ralph Sennhauser aae1bbbab2 Use new WX object macro
Added in 2010.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-24 16:51:58 +02:00
Ralph Sennhauser adfe6b0c36 Convert wxString using ToStdWstring
Avoid using c-style cast to convert wxString to std::wstring.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-22 16:49:41 +02:00
Ralph Sennhauser eae57d9aab Fix clang-tidy modernize-avoid-bind check
And enable the check in the config.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-21 17:15:07 +02:00
Ralph Sennhauser 91a4b834a8 Add clang-tidy linting script
Add groups we might be interested in and disable failing checks.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-21 17:15:07 +02:00
Ralph Sennhauser 6244d25f90 Don't generate SDL events on Atlas shutdown
WX may still generate mouse events after calling CVideoMode::Shutdown(),
so don't create SDL events triggering assertions.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-19 08:59:06 +02:00
Ralph Sennhauser 63629195ba Wait for work to be finished before shutting down
Stopping the timers isn't sufficient, also wait for in-flight work to be
finished first.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-19 08:59:06 +02:00
Ralph Sennhauser 2fae39df3b Use new WX event macros
Were added in 2010.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-18 13:32:23 +02:00
Ralph Sennhauser f1181bada0 Don't install SDL default signal handler for Atlas
If we catch the signal we'd have to communicate that we terminated by
signal, which might depend on shell. There is also the issue of various
dialogs blocking regular quit which we don't want, so that would need
extra work as well.

As such just let the SIGINT/SIGTERM do there default action and forgo
cleanup and let the OS handle it.

Fixes: #198
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-18 11:50:31 +02:00
Ralph Sennhauser 309ed5ef28 Add fullscreen support to Atlas
Add a fullscreen toggle to the View menu and with a global hotkey,
reusing the default one from the main game.

Unlike the current implementation this one doesn't need the game canvas
to be focused and also works on GTK.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-18 11:33:17 +02:00
Ralph Sennhauser 3c8b7dfa7a Fix Enter key behaviour on Windows
Commit fe192fe58f made it possible for
events to properly propagate to the top window. As on Windows Enter is
also used for navigation, i.e. used to trigger the dialogs default action,
which in our case seems to be quit.

Tell the wxSpinCtrl to fire wxEVT_TEXT_ENTER instead and handle it.

The wxCommandEvent wxEVT_TEXT_ENTER doesn't carry the value, so need to
use dynamic event binding (which is preferred way anyway).

Also show the numPlayerSpinner as a spinner instead of a text field to
match visuals to actual behaviour.

Fixes: #9026
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-18 11:24:36 +02:00
Ralph Sennhauser 32b9713781 Modernize Brush in Atlas
Use dynamic event bindings allowing to bind all events in all sort of
ways. Addionally no need for subclassing wx widgets.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-18 11:24:36 +02:00
Vladislav Belov d2375de187 Splits PrepareScene and remove intermediates
We don't need to have intermediate functions as they don't add something
useful.
2026-07-13 00:40:36 +02:00
Ralph Sennhauser f4bb99094d Stop timers on closing Atlas
Otherwise we might try to render a view when half the infrastructure is
already taken down, which results in segfaults or asserts.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-12 20:04:20 +02:00
Ralph Sennhauser 16188c7305 Add birds eye view toggle to View menu
On request by @nifa add a checked menu item to View menu to set birds eye view.

When game view is focused, the focus which it hogs almost always, then
'B' doesn't propagate properly so use Ctrl+B instead in line with other
main menu shortcuts.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-12 19:45:30 +02:00
Ralph Sennhauser 89c6bd5de6 Remove unused ActionButton
Unused and doesn't add value on top of regular wxButton, just a slightly
different API.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-10 20:24:35 +02:00
Ralph Sennhauser 99bbc24265 Remove global g_xres and x_yres
Instead query g_VideoMode where needed. As both g_xres and g_yres aren't
global anymore remove static from UpdateRenderer. While at it use more
desicriptive names: GetXRes -> GetWindowWidth, GetYRes ->
GetWindowHeight.

This reduces the amount of variables tracking width and height by one
each.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-08 11:35:46 +02:00
Ralph Sennhauser 3b9ec75e28 Split out View main menu in Atlas
On suggestion by @nifa add a View menu.

Initially move wireframe, smooth framerate and reset camera actions
there.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-08 08:53:02 +02:00
Ralph Sennhauser bc0e043696 Don't allow rotation in atlas bird view
except for rotation around the y axis. This makes the behaviour
consistent with the main game.

Ref: #8931
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-29 20:12:31 +02:00
Vladislav Belov 0538e95793 Makes GameView::GetCamera constant 2026-06-28 17:57:26 +02:00
Vladislav Belov e0d131854d Makes GameView returning reference on camera 2026-06-28 17:57:16 +02:00
Ralph Sennhauser 0bfd703eda Drop XInitThreads workaround
GTK used by wxWidgets on Unix calls it when creating an X11 window as
does SDL. As such this is no longer needed and we avoid a direct
dependency on X11.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-28 09:49:25 +02:00
Vladislav Belov 45cb592f22 Adds ability to enable smooth framerate in Atlas 2026-06-21 11:30:27 +02:00
Ralph Sennhauser f9af0e571a Mark ownership using unique_ptr in Atlas sections
And remove unused destructors.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-21 09:16:11 +02:00