1514 Commits

Author SHA1 Message Date
Vladislav Belov 0650721b19 Replaces round to closest power of two by std ones 2026-09-21 00:47:13 +02:00
Vladislav Belov 0b90eea56b Replaces is_pow2 by std::has_single_bit 2026-09-21 00:47:11 +02:00
Vladislav Belov 58e2c59466 Adds Load with unique_ptr to VFS
Also replaces some usages of Load with shared_ptr by unique_ptr.
2026-09-10 16:39:29 +02:00
Vladislav Belov 39c0dc69e4 Uses std::filesystem to get a file_size 2026-09-10 13:58:28 +02:00
phosit 7bcee2ea0e Remove XERO_ITER_EL 2026-09-08 10:32:51 +02:00
phosit f8ea2c0d49 Remove XERO_ITER_ATTR 2026-09-08 10:32:51 +02:00
trompetin17 c69ded6f30 Fix font fallback for regional locale variants
Add short locale (e.g. "zh") as intermediate fallback between the full
locale (e.g. "zh_HK") and the global default fonts.

Previously, regional variants without explicit font config entries would
skip directly to global Latin fonts, causing CJK characters to display
as "xxxxx".

Reported at:
https://wildfiregames.com/forum/topic/141392-0ad-alpah-28-only-show-some-english-words-correctly-most-words-are-xxxxx
2026-09-07 15:24:25 -05:00
Vladislav Belov 551071c5a4 Replaces shared_ptr by span for LoadFile and Store 2026-09-05 12:33:46 +02:00
Fabio Pedretti e4e50d7711 MapReader: Reject maps with out-of-range terrain tile texture index
m_Tex1Index is unvalidated (raw .pmp bytes / RMS script) and was used
to index m_TerrainTextures with no bounds check.
2026-08-29 16:19:08 +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
joeybadz 2add365a4f Add camera view config options
Adds a variety of settings for the camera: scroll speed, zoom speed, smoothness, etc.

Fixes #4638
2026-08-19 04:19:45 +02:00
phosit ae936e8177 Remove CStr::FromUInt
There is `std::to_string` which does the same. For most uses it's better
to use `fmt::format`.
2026-08-06 18:03:05 +02:00
phosit 06e199b12a Remove CStr::FromInt
There is `std::to_string` which does the same. For most uses it's better
to use `fmt::format`.
2026-08-06 18:03:05 +02:00
Vladislav Belov c4e7364802 Removes unused BuildColor4ub from ModelRenderer
We don't need to calculate shading on CPU since we always use shaders.

Refs: a9c27b412b
2026-08-06 11:32:02 +02:00
Ralph Sennhauser 0340cc9abd Make NUSpline public members protected
Add a getter for MaxDistance and make members protected and inline
initialization.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-29 18:44:03 +02:00
Ralph Sennhauser aeeda05433 Prefix NUSpline member variables
To follow coding convention rename the vector Node to m_Nodes,
MaxDistance to m_MaxDistance and NodeCount to m_NodeCount.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-07-29 18:44:03 +02:00
Vladislav Belov f781181899 Adds sRGB support for proper lighting
Currently we're incorrectly using sRGB colors as raw inputs for lighting
instead of conversion to linear space. For proper PBR we need linear
values.
2026-07-29 01:29:09 +02:00
Vladislav Belov 5778ef6cac Removes std::shared_ptr usages from particles 2026-07-13 01:01:03 +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
Vladislav Belov 43dd988ee7 Removes render methods from GameView 2026-07-13 00:40:34 +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
Vladislav Belov 46af67b5bd Removes RenderPath
We can render the game only with shaders so we don't need to support
fixed function pipeline as a separate render path. We only need to know
when to warn a user.

Fixes #6244
2026-07-07 23:12:45 +02:00
Vladislav Belov 8491b7f084 Removes Unattach from emitter
We don't really need that proxy. As the main idea is to move the
ownership from a model to the particle manager.
2026-07-06 01:05:09 +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
Vladislav Belov 74f11d2fd2 Adds const to particle emitter type
Emitter type must not be changed during any emitter update.
2026-06-28 14:30:44 +02:00
Vladislav Belov 7790c0972b Removes legacy timers
Modern profiling tools provide more details and more precise
measurements for more platforms. For simpler cases we have our in-game
profiler.
2026-06-28 13:34:01 +02:00
Vladislav Belov fa0e593669 Replaces virtual by override for particle emitters 2026-06-28 12:01:39 +02:00
Vladislav Belov 1709149740 Adds instancing to particles
We use instancing to provide dynamic data for particle only once and not
for each vertex.
2026-06-22 23:18:29 +02:00
Vladislav Belov 50d82810bc Moves UV coordinates to a separate vertex buffer
UV coordinates are constant so we don't need to upload them each frame.
Ideally we shouldn't have UV coordinates at all as we could use
gl_VertexID but it's not available on all supported GLSL versions.
2026-06-22 23:18:27 +02:00
Vladislav Belov 1380a93077 Packs particle size and angle to axes
We need to have per-vertex data to be constant to use instancing.
Now we have only UV coordinates.
2026-06-22 23:18:26 +02:00
Vladislav Belov db9f60b540 Renders only alive and visiable particles
We don't need to update and render dead or invisible particles. The
code still uploads the whole chunk but I'll improve that later.
2026-06-21 18:40:52 +02:00
Vladislav Belov 54b529ddac Fixes crash for too many particles
The maximum number of particles was unbound. It's bound by the
number of maximum vertices per vertex buffer.
2026-06-20 21:45:55 +02:00
vyordan ec8b420abc Move Script* classes to Script namespace
- Rename ScriptEngine, ScriptContext, ScriptInterface, ScriptRequest to
  Script::Engine, Script::Context, Script::Interface, Script::Request
- Remove 'Script' prefix from filenames:
  ScriptContext.* → Context.*
  ScriptInterface.* → Interface.*
  ScriptRequest.* → Request.*
  ScriptEngine.* → Engine.*
  ScriptConversions.* → Conversions.*
  ScriptExceptions.* → Exceptions.*
  ScriptForward.* → ForwardDeclarations.*
  ScriptStats.* → Stats.*
- Update all includes, forward declarations, and friend classes
- Use namespace Script { ... } in .cpp definitions to avoid repetitive
  Script:: prefix (keeping global callbacks outside)
- Rename internal implementation structs:
  ScriptInterface_impl → Interface_impl
  ScriptFunction → Function
- Update copyright year to 2026 in all touched files
- Suppress pre-existing cppcheck warnings (uninitvar, nullPointer, unknown
  macro) by adding them to suppressions-list.txt (these are not caused
  by this refactor)

Fixes #7516
2026-06-20 17:43:00 +02:00
phosit 364d50e184 Move the gameView input handler to CGameView
`game_view_handler` isn't global anymore. That makes the interface
simpler and might make the compilation and the runtime faster.
2026-06-19 20:53:52 +02:00
phosit 3af4287f6d Change the return type of event-handler
The return value is more strongly typed.
2026-06-19 20:53:52 +02:00
Ralph Sennhauser 0c0552a428 Replace M_PI with C++ numbers
C++20 added π (pi) to the standard, replace the C macro globally.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-04 20:29:48 +02:00
Ralph Sennhauser a0bb103390 Unwrap SDL_Event
Since C++11 a C typedef'ed union can be forward declared, so the wrapper
is no longer needed.

While at it switch signatures to refs and convert C style casts.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-05-20 19:44:52 +02:00
Vladislav Belov aced56c336 Adds material passes to choose different shaders
All shaders were selected by context (set of defines) which increases
the number of needed permutations. For example: we don't need to know
about shadows when rendering silhouettes.
2026-05-10 23:57:16 +02:00
phosit 7758c98e7c Remove IXmppClient.h
This is now possible after 0a455fbe2d.
2026-04-14 19:38:05 +02:00
Vladislav Belov cb1fe07540 Removes GetDeviceCommandContext call from CFont
We need remove all occurences of GetDeviceCommandContext to be able to
add multithreading support in the future.
2026-04-10 23:53:23 +02:00
Vantha 01476b9836 Only render the minimap texture if it'll be displayed
This patch implements a way for minimap-type GUI objects to request the rendering
of the minimap texture each frame. If it wasn't requested the minimap
texture isn't rendered at all and the objects only request it while they are
being displayed. This saves unnecessary work and fixes a bug where the
minimap briefly showed the revealed map after a cinema path ended
playing, since it isn't updated every frame (only 2x per second).
2026-03-03 11:25:52 +01:00
Vantha 67c96094f0 Disable smooth LOS during cinema paths
The whole map is revealed when starting to play a cinema path and
then hidden again when it finished (if necessary).
This patch fixes the ugly fade in at the start and fade out after
the end previously caused by this.
2026-03-03 11:25:52 +01:00
Vantha 004fdfdb58 Initialise m_DrawPaths inside the class
Default values like this are better set inside the class already rather
than in the constructor.
2026-03-03 11:25:52 +01:00
Vantha d882ab74a1 Revamp CinemaManager component
Clean up the the implementation, improve the naming, and
add some more documentation as well as more in-depth tests.
2026-03-03 11:25:52 +01:00
Vladislav Belov aae957ec7b Adds fixed orientation to particles
New features:

* Relative position
* Relative and absolute fixed axis
* Local space
* Axis along velocity vector
2026-02-20 22:46:49 +01:00
Vladislav Belov 0432b86de7 Removes ARB (legacy OpenGL) backend
ARB is a legacy backend which uses old assembly shaders. It makes
writing shaders more complex. According to the stats
https://feedback.wildfiregames.com we small amount of players with
ARB.

Fixes #8533
2026-02-20 22:07:38 +01:00
phosit e79f8ea327 Without entities, don't require a simulation
Since 067a7abc72 a simulation is required when loading a non generated
map.
This breaks the serializationtest as it doesn't pass the simulation to
the secondary map-reader.
2026-02-17 20:37:21 +01:00
Vladislav Belov 2e0c34d479 Adds sort mode to particles 2026-02-09 21:29:42 +01:00
Vladislav Belov cce01f4d6c Fixes compilation after #8621
Fixes #8685
2026-01-25 16:29:16 +01:00