Commit graph

24898 commits

Author SHA1 Message Date
Itms
994645930c
Move maps XML files out of LFS
Fixes #7519.

Reviewed-By: Dunedan
Reviewed-On: https://gitea.wildfiregames.com/0ad/0ad/pulls/8014
2025-06-11 10:33:57 +02:00
Carl-O
a2830603b4 Capitalize first letter in ancient Egyptian
Reviewed-By: Stan
Reviewed-On: https://gitea.wildfiregames.com/0ad/0ad/pulls/8041
2025-06-10 23:12:59 +02:00
Carl-O
c772b3ad89 Fix gaul Assembly SoundGroups
Make the sound consistent with its Athenian and Spartan counterparts.

Reviewed-By: Stan
Reviewed-On: https://gitea.wildfiregames.com/0ad/0ad/pulls/8040
2025-06-10 23:07:17 +02:00
Vantha
6a7ad264e4 Add pitch-rolling to some bush and grass props
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
2025-06-10 23:01:09 +02:00
Vantha
eb2f59eeaa Allow actors to override the entity's anchor type
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
2025-06-10 23:01:09 +02:00
Ralph Sennhauser
0ce889ca6d
Use stylistic for deprecated eslint rules
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>
2025-06-10 21:23:23 +02:00
Stan
ff03dd45c4
Adjust log path to use XDG_STATE_HOME
Also move logs/ log/ so that it's more in line with /var/log/

Fixes: #7960
Pull Request: #8045
2025-06-07 12:39:03 +02:00
phosit
05869454e5 Disalow importing some files
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`.
2025-06-06 17:36:35 +02:00
phosit
6492bc705a Allow modules to be hotloaded
Reload a module when it's script file got changed or when one of it's
imported modules got reloaded.

This doesn't work for dynamic `import`s.
2025-06-06 17:36:35 +02:00
phosit
4043f954a7 Allow mods to write appendices
Module local values are visible to Appendixes. This mechanism can be
used for mods.
2025-06-06 17:36:35 +02:00
phosit
d76e107dca Support the import.meta property
Through the `import.meta` property the engine can pass some values to
the module. Currently only the `path` of the script file is exposed.
2025-06-06 17:36:35 +02:00
phosit
a40caaffc4 Support dynamic import
The static `import` should be prefered over the dynamic but it might be
usefull when loading an object from a json file.
2025-06-06 17:36:35 +02:00
phosit
252df0a1db Return the namespace of a module
To make it easy for the engine to access the exported values the
namespace is returned from the future.
2025-06-06 17:36:35 +02:00
phosit
d26d9b9b2b Rethrow exceptions from the top level of a module 2025-06-06 17:36:35 +02:00
phosit
ce01bdddf6 Allow to check whether modules finished evaluating 2025-06-06 17:36:35 +02:00
phosit
32ef4fd0fa Normalize module-path
Modules indipendant of the path, should only be evaluated once.
2025-06-06 17:36:35 +02:00
phosit
c6d42ebbd5 Support JavaScript modules
- 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`).
2025-06-06 17:36:35 +02:00
Ralph Sennhauser
475053ea7c
Fix copyright linter invocation
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>
2025-06-04 21:12:25 +02:00
trompetin17
c3d3943047
Fix incorrect shadow behavior in VisualActors
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.
2025-06-03 19:30:10 -05:00
Ralph Sennhauser
8ec21aac53
Group documentation pages
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>
2025-06-03 20:44:39 +02:00
trompetin17
4dc686564e
Fix FreeType font loading from zipped mods
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.
2025-06-03 11:20:56 -05:00
elexis
67eaa8f1a9
Fix change perspective in replays
Fixes change perspective features of multiplayer replays following cheat
protection in 023527e56e.

Fixes: #8020
2025-06-03 13:52:26 +02:00
trompetin17
81dfd51eb3
Fix hard crash when terrain is missing from map
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.
2025-06-02 00:29:03 -05:00
Ralph Sennhauser
9dfc638b80
Add Win64 pipeline support
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>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser
623e7f7a47
Disable warning LNK4098
Even with lots of effort [1] to isolate the offending library there is
little to be had, as such disable the warning.

[1] https://gitea.wildfiregames.com/0ad/0ad/pulls/7798#issuecomment-119332

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser
241b9f0952
Add missing Win64 dbghelp dlls
Bump svn libs version to get dbghelp.dll and dbgcore.dll.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser
a8e0e50ae5
Use Bit instead of BIT
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>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser
06e2f0bcc3
Fix cast to void for Win64
Make what could be considered a legendary hack less brittle.

    C4312: 'reinterpret_cast': conversion from 'long' to 'void *' of greater size

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser
e1e1e42939
Update fmt and libxml2 for Wind64
Bump svn rev for libs to get fmt and libxml2 fixes.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser
b527e6b870
Fix check for availability of wxWidgets for Win64
In premake we check for wxWidgets on Windows to see if we can build
Atlas, this check wasn't adopted when adding support for Win64.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser
fb56668dd9
Fix size mismatch in shift operation for Win64
Msvc complains about C4334 - 32bit/64bit shift.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser
58b70719be
Disable conversion warnings on Win64
Those warnings aren't enabled for gcc and clang currently either, so
just disable them for msvc as well.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser
904dffdaba
Disable warnings for Mongoose on Win64
Mongoose is on the way out, and it's not like the same issue isn't
present for other 64bit platforms, we just don't have those warnings
enable there.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser
ef7f1d336c Move errorlist.pl from build to tools
The target file is checked in into vcs so this tool isn't used during
build and as such better lives in source/tools.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:42:44 +02:00
Ralph Sennhauser
4463e9480a
Remove leftovers of arclint
All linting was ported to pre-commit or gitea workflows, the only thing
left is an adapter to output to Phabricator which is no longer in use.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 13:25:24 +02:00
Ralph Sennhauser
895cb63c4a Add --build-archive to spidermonkey build.sh
This option allows to build the spidermonky archive hosted by WFG from
the upstream firefox tarball.

First this serves as documentation as to how the taball is created and
by integrating it into the regular build process allows to easely bump
spidermonky version for local testing.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-31 17:10:10 +02:00
Stan
167020c05c
Fix broken build restrictions
In f3ac9e9669 the fail condition was broken causing it to allow building on restricted areas.

Add a test to ensure correct behavior for this case.

Reported by: @wowgetoffyourcellphone
Pull Request: #8021
2025-05-31 10:58:14 +02:00
Stan
d3017b6f9c
Fix error spam in Atlas
Atlas has no notion of player removal. Each entity would trigger an error in Player.js

Reported by: @trompetin17
Reviewed by: @trompetin17
Pull Request: #8006
2025-05-30 19:23:32 +02:00
Ralph Sennhauser
02e15da51b
Add eslint pre-commit hook
This replaces the old arclint eslint setup 1:1 rule wise, only porting
the configuration to a format recent eslint can read.

Further remove the arclint setup as it is no longer of use.

Thanks to Stan for reviewing all needed fixes to Javascript code to
allow for adding this without compromises.

Fixes: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-30 17:30:25 +02:00
Ralph Sennhauser
666ffb0f18
Fix new and profiler eslint warnings
This fixes 'no-trailing-spaces', 'semi', 'prefer-const' that made it in
since and 'no-shadow', 'no-multi-assign', 'no-invalid-this' as well as
'no-undef-init' in profiler.

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-30 15:25:54 +02:00
phosit
d98a205feb Don't pass report explicitly in ReportDraw
The function declaration binds `report` implicitly.

Ref: #7812
2025-05-30 14:16:32 +02:00
phosit
e0ed2ae0c8 Replace var in inner scopes from ReportDraw
Variables declared with `var` are also accible after accessing the
scope. This lead to shadowing because variables with the same name are
declared in a later scope.

Ref: #7812
2025-05-30 14:16:31 +02:00
phosit
07ed959422 Remove IIFE in ReportDraw
Since variables declared with `var` don't respect all scopes, when used
in a loop it doesn't create a new variable each iteration. The
initializer value is always assigned to the same variable. That makes
problems when the variable is used in a callback. To work around that
the variable is copied in to a IIFE.
When not using `var` the iife isn't required.

Ref: #7812
2025-05-30 14:16:18 +02:00
phosit
61de7ccbfc Don't use this in do_zoom callbacks
Ref: #7812
2025-05-30 13:22:06 +02:00
phosit
0e9d2a8d5e Remove outInterface from ReportDraw
Only return the one function which is actually used.

Ref: #7812
2025-05-30 13:21:59 +02:00
phosit
83f2a34a50 Make canvas local in ReportDraw
Ref: #7812
2025-05-30 13:21:41 +02:00
trompetin17
d323797d98
Add glyph debug box rendering for font system
This commit introduces optional debugging visuals for font glyph
rendering. When enabled, each glyph is drawn with a surrounding debug
box to aid in visual inspection of glyph layout, spacing, and atlas
behavior.

Usage examples (via console):

// Enable debug box rendering
Engine.ConfigDB_CreateValue("user","fonts.debugBox", true);

// Set debug box color (R G B)
Engine.ConfigDB_CreateValue("user","fonts.debugBoxColor", "35 0 35");

This feature is intended for developers working on font layout or atlas
generation logic, and has no effect on normal gameplay or UI rendering
when disabled.
2025-05-29 06:23:20 -05:00
Ralph Sennhauser
8b1c6c76b6
Make Profiler2Report a class and make eslint happy
This removes all global code and fixes eslint warnings 'no-shadow' and
'no-undef-init'. Leave other possible improvement style wise for an
other time.

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-29 11:03:13 +02:00
Stan
b36782388b
Allow removing player entities when starting a match. 2025-05-28 23:05:36 +02:00
Ralph Sennhauser
e4e80a2504
Use trigger hook to init map Flood
Eslint doesn't like the global return and fails to parse the trigger
script file. Rewrite the script to avoid this and any globals while at
it. Also use OnInitGame as the execution with an IIFE in global scope
wouldn't guarantee when it will be executed or whether the timer
component is already registered.

Further don't concat the warning string as the extraction script for
translation expects a literal.

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-28 20:21:24 +02:00