Some have their editor configured to remove trailing whitespace and
editing such a file would "fix" it, adding an unrelated change.
Fix whitespace violations excluding third party libs and generated files
like glad or patches.
Enable pre-commit hook trailing-whitespace to enforce it in the future.
Fixes: #8016
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Disabled rules are the same as not listed rules of which there are many,
keep them out of the config.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
They way the project is structured this isn't really usable for now but
might change with move to ESM modules.
See: https://eslint.org/docs/latest/rules/no-unused-vars
Ref: #8068
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
They way the project is structured this isn't really usable for now but
might change with move to ESM modules.
See: https://eslint.org/docs/latest/rules/no-undef
Ref: #8068
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
To improve visual consistency during dynamic font rendering, especially
on lower-end machines or during low FPS moments, we now preload a set of
common Latin letters, digits, and punctuation glyphs immediately after a
font is loaded by the FontManager.
This reduces the likelihood of users seeing empty or missing characters
on the first frame after a font is used, minimizing visual glitches
during simulation.
The preloaded characters include:
- Uppercase and lowercase Latin letters (A–Z, a–z)
- Digits (0–9)
- Common punctuation and symbols (e.g., .,;:!?()[]{}<> etc.)
This change helps smooth the user experience and avoids blank spaces
during the initial rendering of text in performance-constrained
scenarios.
This removes the padding from the start and the end of the frequency
graphs, to remove the inaccurate steps it caused.
It also improves the smoothness of the frequency and frame-to-frame
graphs by painting each graph as a single line, instead of one line per
data point.
Before premake 5.0.0-beta3 if --cc wasn't specified the gnu make default
was used unless overridden via env.
Now premake always chooses a compiler sidestepping gnu make choice. So
use the premake pick unless explicitly overridden via CC in env or via
option to premake.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
The gmake action has a separate idea as to what the default toolset
should be, add that to the patch fixing the default for BSD.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Eslint maintains a list of rules it recommends, split them into own
section for easy identification.
Further sort the rules and don't use magic values for severity.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Because its a function `GenerateMap` is renamed to `generateMap`.
Allows to rewrite the libraries as modules and to remove the costum
`Engine.LoadLibrary` mechanism in the future.
The rule 'no-negated-in-lhs' was deprecated in eslint 3 [1], replace it
according to recommendation with 'no-unsafe-negation' and enable all
extras as our code already conforms.
[1] https://eslint.org/docs/latest/rules/no-negated-in-lhs.html
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This makes 5.0.0-beta5 the minimally supported version as the gmake2
action was renamed to gmake while gmake was renamed to gmakelegacy. So
from now on gmake action is to be used.
Clear out all old version dependent code.
Fixes: #7789
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Also extend it by compairsion operators <= and >=
This will probably also be useful for checking versions of dependencies.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
After FreeType integration in dfb4598186 font height and line spacing
were incorrectly applied. That caused UI elements like capture, health,
and resource stats to appear misaligned or invisible.
Commit c2d529b975 standardized font height usage, removed lineSpace, and
introduced GetCapHeight + Descender for better vertical alignment.
However, affected texts used a font-stroke-12 with a GUI size of 12,
which now renders lower in the container due to stroke and metric
offset. Increasing the size to 14 ensures the text is properly visible
and aligned.
This adjusts for the actual space font-stroke-12 occupies in rendering.
Fixes: #7962
This reverts commit dc156c3f24.
The original commit addressed incorrect UI alignment caused by improper
handling of font height and linespacing after FreeType integration
(introduced in 734386ce9f).
However, commit c2d529b975 corrected the root issue by standardizing
font metrics:
- Proper use of FreeType's height
- Removal of lineSpace
- Introduction of getCapHeight and Descender for accurate vertical
alignment
As a result, the UI offset workaround is now obsolete and must be
reverted to reflect the correct baseline behavior.
This reverts commit 52ee6ad470.
The original commit addressed incorrect UI alignment caused by improper
handling of font height and linespacing after FreeType integration
(introduced in 734386ce9f).
However, commit c2d529b975 corrected the root issue by standardizing
font metrics:
- Proper use of FreeType's height
- Removal of lineSpace
- Introduction of getCapHeight and Descender for accurate vertical
alignment
As a result, the UI offset workaround is now obsolete and must be
reverted to reflect the correct baseline behavior.
Previously, `height` was derived from a manually chosen glyph (typically
"I", Standard Cap Height) using FontBuilder, and `lineSpacing` was used
inconsistently for layout logic as a height.
Now, with the FreeType-based system:
- `height` uses `face->size->metrics.height`, which includes the
recommended line height with internal leading/line gap as defined by
the font designer.
- `lineSpacing` was removed
- `GetCapHeight` uses the standard cap height + ascender to have a
visual virtual alignment
This change standardizes font metric usage:
- Use `height` for vertical layout and line progression.
- Use `GetCapheight` in layout engines like `CGUIText` or `CGUIString`,
This ensures better alignment across fonts and consistent spacing in
multiline text rendering.
Fixes: #7962
Fixes the issue that they noticably stick out horizontally when placed on slopes.
(thanks to the previous commit these values will be adopted by the "special/actor" template when loading it in)
Reviewed-By: Itms
Reviewed-On: https://gitea.wildfiregames.com/0ad/0ad/pulls/7542
Optionally let actor templates define their own anchor types.
These override the default value defined in the template.
Useful for actors without their own entity template.
Reviewed-By: Itms
Reviewed-On: https://gitea.wildfiregames.com/0ad/0ad/pulls/7542
During the eslint 8 cycle the formatting rules were split out [1],
deprecating the corresponding rules in core.
This replaces all rules that where moved to @stylistic/eslint-plugin [2]
and accounts for the difference in the indenting rule behaviour.
To allow the pre-commit import hack to continue to work with the
stylisitc plugin for a recent nodejs version to be used.
[1] https://eslint.org/blog/2023/10/deprecating-formatting-rules/
[2] https://eslint.style/packages/default
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Not all modules should be able to load all other modules. A predicate
function can to be passed to the `ScriptInterface`. That function
returns whether the module is allowed to loat the module. If no
predicate is passed in no modules can be loaded through that
`ScriptInterface`.
- With modules JavaScript code can be split up into multiple files. We
already implemented such a mechanism (`Engine.LoadLibrary`) in
multiple parts of the engine. The advantage of using modules is
that it's standart (JS-devs are familiar with it) and it doesn't
has to be implemented multiple times.
Note that `Engine.LoadLibrary` loads all files in a directory
while the new `import` only loads one file.
- With modules seemingly global variables are local to that
script/module. We already implemented such a mechanism
(`ScriptInterface::LoadScript`).
Requires HEAD to point to --to <commitish> for the files to be in the
state for copyright.py to produce expected results. Which isn't the case
in the gitea workflow.
Also use plumbing commands to on one hand make it more robust and on the
other hand to avoid bad files only in --from <commitish> to leak into
the check.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit primarily corrects an inaccurate comment and resolves a
hidden bug in the VisualActor shadow logic, while preserving the current
behavior.
Previously, the DisableShadows option removed both casting and receiving
shadows. However, the internal logic ignored this setting in some cases,
causing shadows to appear even when explicitly disabled in XML
templates.
This change introduces the ability to control CastShadows and
ReceiveShadows independently via template settings, defaulting both to
true unless explicitly specified.
In addition, previews are updated to receive shadows but not cast them,
improving visual volume effects without affecting lighting behavior.
All documentation pages are made subpages of a page Documentation, this
helps browse documentation not directly tied to source code.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
The FreeType font loader was directly passing filesystem-style paths
(e.g., mod.zip/...) to FT_New_Face, which does not support paths inside
ZIP archives. As a result, FreeType failed to open the font, triggering
a crash when the engine attempted to use an invalid face object.
This patch changes the font loading logic to:
Use the VFS to read the .ttf font file into memory (shared_ptr<u8> and
size).
Load the font using FT_New_Memory_Face with the in-memory buffer,
ensuring compatibility with zipped mods.
Previously, opening a map that referenced a deleted or missing terrain
caused a severe crash with multiple error dialogs, forcing users to kill
the process. This change restores the previous behavior where missing
terrains are gracefully handled: a warning is logged and the terrain is
substituted with a fallback placeholder (ErrorTexture from
TextureManager).
This significantly improves UX for developers and modders working with
outdated or broken maps, aligning behavior with expectations from
earlier versions of the editor.
Extends the current Windows pipeline to also build for AMD64. While at
it use a matrix build.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
The BIT macro is compile time only anyway. Takes care of the warning
"C4334 - <<': result of 32-bit shift implicitly converted to 64 bits".
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>