1
0
forked from 0ad/0ad
Commit Graph

8136 Commits

Author SHA1 Message Date
e62dac7ad4 Removes unused macro from CStr, reduces macro dependency.
Tested By: Freagarach, Stan
Differential Revision: https://code.wildfiregames.com/D4245
This was SVN commit r25891.
2021-09-03 21:06:22 +00:00
3b417062bb Reduces the number of possible allocations for models with multiple UV sets during loading.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D4247
This was SVN commit r25890.
2021-09-03 20:11:52 +00:00
eaddc92816 Removes unused g_GameRestarted forgotten in 7ce4552f5e.
This was SVN commit r25885.
2021-09-01 19:48:09 +00:00
55f9d78e7e Moves tex tests to the related folder, was forgotten to move in 63086f4e26.
This was SVN commit r25884.
2021-09-01 19:27:34 +00:00
dd90dbf8b5 Allow to enable Cartography at the start of a match.
Adds a checkbox to the game setup to allow players to have Cartography
autoresearched from the start of the match.
Refs.
https://wildfiregames.com/forum/topic/27265-theres-any-mod-so-you-can-see-what-your-allies-see-from-the-start.

Patch by: @Jammyjamjamman
Differential revision: https://code.wildfiregames.com/D4191
Reviewed by: @Angen
Comments by: @andy5995, @Langbart
This was SVN commit r25869.
2021-08-28 06:15:36 +00:00
Angen
81ad9f746b Do not require restart when chaning Background pause option
Background pause does require a game restart to take effect.
Adding function to update it on runtime since only place where it is
used is in main.cpp.

Differential revision: D4181
Fixes: #6236
Tested by: @Langbart
This was SVN commit r25866.
2021-08-27 18:54:20 +00:00
Angen
9ff8b0758c [scripts]Update translation checks to check pluralised strings
Currently script checks only singular translations
Add branch to check plural strings as well

Differential revision: D4199
Refs: #4250
Comments by: @Stan
This was SVN commit r25865.
2021-08-27 18:48:41 +00:00
4a9bac2811 Bump version to alpha 26.
Last alpha 25 commit was [[SVN:25860]]

Accepted by: @Freagarach, @asterix
Comments by: @wraitii
Differential Revision: https://code.wildfiregames.com/D4215
This was SVN commit r25861.
2021-08-27 16:32:34 +00:00
26bfd92dbd Fix nopch build. broken in 52baaa4bbd.
This was SVN commit r25855.
2021-08-22 13:20:41 +00:00
Angen
52baaa4bbd Fix updating existing mods
Replace wrename, that fails when mod exists already with RenameFile by
@Stan
Check if mod was actually installed when downloading it
error if mod cannot be coppied into modTemp

Differential revision: D4222
This was SVN commit r25854.
2021-08-22 11:35:34 +00:00
Angen
83bb6f3ed5 Fix downloanded mods not showing in list until restart
since 498f0d420b
While at it, remove not used variable after 6400a4a0c5
also fix non visual replay broken in 6400a4a0c5

Differential revision: D4220
Tested by: @Stan, @Langbart
Fixes: #6288

This was SVN commit r25853.
2021-08-22 09:54:16 +00:00
Angen
6400a4a0c5 Update Available mods when installing them
Differential revision: D4211
Since 498f0d420b available mods where cached and not updated when new
where installed.
Fixing above.

This was SVN commit r25850.
2021-08-17 17:32:10 +00:00
0ba9cbef74 Fix units changing appearance when switching animation.
Bug introduced in 76acc4e146.
The previous CUnit code had logic to select random aesthetic variants
once initially. The new code removed that, as I completely missed its
purpose, assuming that the random selection, being based on a seed,
would pick the same variants every time. This is incorrect because
entity selections can change the RNG calls, thus the variants, and thus
entity appearance can change when the animation changes (typically, a
horse will change color when walking and running).

The solution is to re-introduce the choice of actor selections on CUnit
creation. This makes sure that units don't change their purely-aesthetic
selections when e.g. animations change.

Reported by: Wowgetoffyourcellphone
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D4205
This was SVN commit r25844.
2021-07-31 17:55:10 +00:00
12aa35eb3b Fix loading grayscale heightmaps for RM maps.
d2948937a0 introduced code to read Heightmap images into RM terrain
data. However, the original diff contained a bug where it read
Out-of-bounds array data for grayscale images. This bug was hidden by
another issue until D1816 / cbc04ba83b, which changed the code and made
the OOB read actually relevant. The effect was twofold:
- The height chosen was not the max of the 3 color channels, but the max
of the 3 neighboring pixel (thus slightly lowering the quality of
generated maps)
- The height for the bottom-right coordinates were random memory values,
thus garbage.

This random height ended up resulting in non-deterministic map
generation, which was reported on Ngorongoro.

The cause of this silent failure is that the transformation to BGRA is
not applied for grayscale images, as the alpha transformation is
processed first and exits. This is not per-se buggy, so it is not
changed here.
The fixed behaviour is specialized for the common grayscale case, and
retains the max-of-3-color-channel intended behaviour otherwise.

Fixes #6261.

Reported by: Feldfeld
Differential Revision: https://code.wildfiregames.com/D4203
This was SVN commit r25843.
2021-07-31 17:52:05 +00:00
Angen
ae744f13f3 Prevent formation members to run when they should not
Reported on forum:
https://wildfiregames.com/forum/topic/41264-alpha-25-pre-releaserelease-candidate-build-testing/page/13/
Introduced in: 40cbde1925
Differential revision: D4201
Tested by: @Freagarach, @marder
This was SVN commit r25841.
2021-07-27 18:20:26 +00:00
cba3528c48 Update translation credits.
- Restore original language names, and keep an English fallback in case
the font is missing for some languages.
Fixes: #6023
Fixes: #6255

This was SVN commit r25839.
2021-07-26 16:40:16 +00:00
72a20be1df Fix rare crash on Linux when opening dropdowns.
Patch by: @wraitii
Accepted by: @Angen
Fixes #5598
Fixes #6225

Differential Revision: https://code.wildfiregames.com/D4183
This was SVN commit r25830.
2021-07-20 20:59:45 +00:00
dddaa67abd Fix unicode build for Atlas on OpenSuse.
Based on a patch by: @MatSharrow
Reviewed by: @wraitii
Differential Revision: https://code.wildfiregames.com/D4178
This was SVN commit r25815.
2021-06-29 12:41:31 +00:00
a541f3a317 Fix hotloading making models disappear.
The actors were always hotloaded because of a bad logic change in
76acc4e146.

Fixes #6228

Differential Revision: https://code.wildfiregames.com/D4175
This was SVN commit r25805.
2021-06-17 07:52:50 +00:00
17c54d5a69 Fix options occasionally thinking they've been modified when they haven't.
std::array leave the values in an undefined state which can very well be
'true'.

Tested By: Freagarach
Fixes #6205

Differential Revision: https://code.wildfiregames.com/D4170
This was SVN commit r25802.
2021-06-16 15:54:55 +00:00
6b493aa52c Fixes big screenshots, implements CCamera::GetViewQuad properly for custom projections.
Differential Revision: https://code.wildfiregames.com/D4165
This was SVN commit r25794.
2021-06-13 17:42:37 +00:00
f189172db6 UnitMotion hack to fix units being stuck near corners.
I think there is a small mismatch between CheckMovement & the vertex
pathfinder when computing passability because one is ray-based and the
other just uses edges. However, it's out of my reach to fix it for now.
This can lead to units being stuck near building edges occasionally.
This introduces an un-intrusive recovery strategy (aka a hack) in
HandleObstructedMove that should get the units unstuck.

Should fix #6114 (to a sufficient extent anyways)

Differential Revision: https://code.wildfiregames.com/D4162
This was SVN commit r25786.
2021-06-13 08:43:32 +00:00
b3458d408a Add a setting for the minimap flare lifetime.
Tested by: marder, Langbart
Differential Revision: https://code.wildfiregames.com/D4135
This was SVN commit r25775.
2021-06-11 20:47:09 +00:00
79e772152b Fix game not closing when compiled with --without-nvtt.
Fixes: #6107

Differential Revision: https://code.wildfiregames.com/D4138
This was SVN commit r25766.
2021-06-10 15:42:38 +00:00
4de9c4c164 Fixes for some random maps.
- Hellas_biome isn't a RM but as a JSON script it does load, and then
silently fails on mapgen. Explicitly fail.
- Fix player.js when a valid position cannot exist.
- Fix unknown.js when landscape isn't set in the settings.

Reported by: vladislavbelov
Refs #6180

Differential Revision: https://code.wildfiregames.com/D4147
This was SVN commit r25765.
2021-06-10 13:16:10 +00:00
270378414e Uncompress cached DDS in mouse event mask.
Reported by: langbart
Differential Revision: https://code.wildfiregames.com/D4142
This was SVN commit r25759.
2021-06-09 13:50:57 +00:00
990d61a74a Draws all characters for a very long text of the same style.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4120
This was SVN commit r25749.
2021-06-08 18:17:10 +00:00
870e689e5f Unit pushing: fix pairs of unit being allowed to overlap.
Following 40cbde1925, the minimum pushing force is 0.2. This also
happens to be the maximum pushing force any pair of units can exert on
each other, so they can freely overlap instead of being pushed.

This tweaks settings slightly to fix that problem.

Reported by: marder
Differential Revision: https://code.wildfiregames.com/D4129
This was SVN commit r25748.
2021-06-08 16:38:06 +00:00
83703992c9 Fix speed glitch
Introduced in 40cbde1925
MoveToFormationOffset may be called after the formation controller is
reset, leading to issues. It seems best to trust only
SetMemberOfFormation.

This causes the speed glitch experienced by wow & Valihrant.

Differential Revision: https://code.wildfiregames.com/D4128
This was SVN commit r25747.
2021-06-08 16:03:31 +00:00
b7ff371d00 Prevent OOM crash in Reference Tree on error
The structTree, in case of errors, could have enough items to draw to
trigger an OOM failure in the Arena allocator.

This fixes that by hiding elements by default and some c++ memory
optimisation (mostly, this should make all platforms take the same
memory footprint for VisibleObject).

Discussed with vladislavbelov and s0600204

Differential Revision: https://code.wildfiregames.com/D4114
This was SVN commit r25746.
2021-06-08 14:57:59 +00:00
1d518f5d6f Fix MouseEventMask for bundles.
The .png get converted to .dds and they failed to load. Use a custom
CacheLoader since that's lightweight enough and avoids having to hack
into the texture manager.

Thanks Stan for testing

Differential Revision: https://code.wildfiregames.com/D4119
This was SVN commit r25738.
2021-06-07 19:27:54 +00:00
65ae6543c3 Increase maximum size of mac bundle DMG
The game is slightly over 3G now.
This doesn't affect the actual DMG size, just the maximum size we can
write into it.

Differential Revision: https://code.wildfiregames.com/D4118
This was SVN commit r25737.
2021-06-07 18:56:32 +00:00
f5f493681d Fix atlas crash with RM capture the relic.
As no default values got set, some game settings became NaN, which
triggered exceptions.
This sets sane default.

This also includes better debugging logic in case of exception, so it's
easier to know what happens.

Fixes #6200

Reported by: langbart
Differential Revision: https://code.wildfiregames.com/D4113
This was SVN commit r25736.
2021-06-07 18:48:16 +00:00
67539a8837 Fixes an old bug with missed handle appeared in 63c1347ef7.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D4115
This was SVN commit r25735.
2021-06-07 18:45:28 +00:00
7787176802 Ship the fontbuilder folder to distribute font licenses
Fixes #6198

Differential Revision: https://code.wildfiregames.com/D4090
This was SVN commit r25722.
2021-06-07 06:43:54 +00:00
8597cd2c2e Removes FFP shader program. Fixes #5791
This was SVN commit r25717.
2021-06-06 19:49:43 +00:00
e0b492a83a Removes old gui_* materials, replaced by a single canvas2d material.
This was SVN commit r25714.
2021-06-06 18:25:04 +00:00
7d039f2627 Replaces gui material by solid material in water waves rendering.
This was SVN commit r25713.
2021-06-06 18:13:20 +00:00
fa03eb3485 Switches ShadowMap debug rendering to canvas2d material.
This was SVN commit r25712.
2021-06-06 18:05:10 +00:00
30e135693e Implements configurable cascade shadows.
Tested By: Langbart, Stan, wraitii
Differential Revision: https://code.wildfiregames.com/D3972
This was SVN commit r25711.
2021-06-06 16:44:54 +00:00
ca6fcb28ab Don't store the camera pointer in the minimap
Reviewed by: vladislavbelov
Fix #5973

Differential Revision: https://code.wildfiregames.com/D4100
This was SVN commit r25710.
2021-06-06 16:08:10 +00:00
63c1347ef7 Removes windows enumeration on Windows to retrieve HWND taking it from SDL and wxWidgets.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D4064
This was SVN commit r25709.
2021-06-06 15:31:55 +00:00
40cbde1925 Further Pushing tweaks: more customisable, longer ranges.
This overall decreases the deathball effect from units walking to each
other a bit.
- Fix formations - this cleans up a UnitMotion hack for formations,
making it possible to increase pushing ranges without breaking closely
knit formations like testudo.
- Make MINIMAL_PUSHING and the MOVE_EXTENSION configurable, and add a
STATIC_EXTENSION as well.
- Increase the pushing range significantly, making units sparser.

Differential Revision: https://code.wildfiregames.com/D4098
This was SVN commit r25708.
2021-06-06 15:25:52 +00:00
7fdbe037dd Uses canvas2d material for line drawing instead of gui_solid.
This was SVN commit r25704.
2021-06-06 10:13:57 +00:00
337c4100ce Cleanups ddbf1ea770 which fixes 4ffc005a7f. Sprites can not be inserted twice.
This was SVN commit r25702.
2021-06-06 09:31:36 +00:00
8af0689b5f Fix gamesetup player assignment issue when joining
Switch some logic from C++ to JS in PREGAME for player assignments. Refs
#3049

Fixes #6204

Reported by: Imarok
Tested By: Imarok
Differential Revision: https://code.wildfiregames.com/D4092
This was SVN commit r25699.
2021-06-06 08:02:28 +00:00
ddbf1ea770 Hotfix 4ffc005a7f
A GUI sprite can have e.g. "color:" and "stretched:", but 'sprite' was
moved from after the first call.
Refs #6206

Differential Revision: https://code.wildfiregames.com/D4094
This was SVN commit r25698.
2021-06-06 07:44:20 +00:00
4ffc005a7f Removes raw pointers management from sprites owned by CGUI.
This was SVN commit r25695.
2021-06-06 00:32:49 +00:00
8e150199a8 Removes raw pointers management from CGUISprite.
This was SVN commit r25694.
2021-06-06 00:22:43 +00:00
a2257237b3 Removes raw pointers management from GUIScrollBarOwner.
This was SVN commit r25693.
2021-06-06 00:12:31 +00:00
fdb4040838 Adds HiDPI mode for testing. HiDPI on Windows isn't supported in SDL yet. So we use a custom code.
Differential Revision: https://code.wildfiregames.com/D4076
This was SVN commit r25692.
2021-06-05 19:01:37 +00:00
8e63a0322c Map flares
Add flaring on the map and resize the minimap buttons.
Target marker and button by Stan.
Reviewed/Commented by wraitii, elexis, vladislavbelov
Refs: #3491
Refs: #57

Differential Revision: https://code.wildfiregames.com/D1751
This was SVN commit r25691.
2021-06-05 17:37:18 +00:00
f3efe47ff6 Default-init atomics in TaskManager::Impl
std::atomic<bool> does not value-initialise the boolean.
This caused windows tests to use way too much CPU and fail.

Differential Revision: https://code.wildfiregames.com/D4089
This was SVN commit r25687.
2021-06-05 09:48:41 +00:00
3745940de8 Fix OOS in unit motion
Fixes 592453c62f
wasObstructed and wentStraight are not reset when Move() isn't called,
but PostMove may still be called (if the unit was pushed). This will
OOS.

Differential Revision: https://code.wildfiregames.com/D4088
This was SVN commit r25686.
2021-06-05 09:33:57 +00:00
69901d9ffb Tweaks to TaskManager code
Reported by: Vladislav
Differential Revision: https://code.wildfiregames.com/D4077
This was SVN commit r25667.
2021-06-04 12:55:15 +00:00
82c44e826d Lobbybots: Send IQ result containing the IP address to a client starting a new hosted match and remove the IP from gamelist stanza.
Refs: D3490, D3184

This was SVN commit r25660.
2021-06-04 00:33:43 +00:00
b360b7bd2b Disallow hardware without VBO support to simplify vertex buffer usages.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D4054
This was SVN commit r25659.
2021-06-03 22:06:59 +00:00
0ebc08b13c Thread the pathfinder computations using the task manager.
The pathfinder computations are run asynchronously (and potentially on
the main thread) in-between simulation turns, thus reducing
pathfinder-related lag considerably in common cases.

To make this most efficient, the number of paths computed during a turn
via MaxSameTurnMoves is reduced from 64 to 20.

This has a hard dependency on the obstruction manager (via the vertex
pathfinder) not being modified in-between simulation turn (or to put it
more generally on the simulation state not changing outside of turn
computation), otherwise results will be non-deterministic and go OOS.
This is currently entirely safe (as in, it indeed does not happen that
the simulation state changes in-between turn), but future work towards
improving simulation sandboxing would be good.

Thanks to Kuba386 for maintaining & improving the patch in 2020
Thanks to everyone who tested the various iterations of this patch.

Fixes #4324

Differential Revision: https://code.wildfiregames.com/D14
This was SVN commit r25657.
2021-06-03 16:21:28 +00:00
1b35d36daa Implement a global task manager using a pool of worker threads
Tasks are simple callables (e.g. lambdas), and can be pushed with 2
priority levels. Pushing a task returns a future.
Futures can be waited on, can return results, and can be cancelled
deterministically. Futures can also not be waited on.

This gives 'hardware concurrency - 1' threads to maximize CPU usage in a
work-stealing workflow.

Reviewed by: vladislavbelov
Refs #5874

Differential Revision: https://code.wildfiregames.com/D3848
This was SVN commit r25656.
2021-06-03 14:48:38 +00:00
3662b2d5e2 Fix error in HasSameMods with old matchsettings.
Add some retro-compatibility to avoid issues.

First reported by: gameboy
Differential Revision: https://code.wildfiregames.com/D4066
This was SVN commit r25651.
2021-06-03 10:16:59 +00:00
83608c9205 Removes complex transform from TextRenderer.
This was SVN commit r25648.
2021-06-02 22:16:09 +00:00
455b784f62 Delete test .zip file after running tests
Issue spotted by kalimaps
Reviewed by: wraitii
Code parts by: wraitii
Differential Revision: https://code.wildfiregames.com/D4043
This was SVN commit r25646.
2021-06-02 21:31:18 +00:00
2d455df18d Removes Z value from TextRenderer translate, renames TextRenderer methods to more explicit ones.
This was SVN commit r25645.
2021-06-02 21:21:28 +00:00
48ea6ee7d2 Moddability for pushing: radius in XML, allow deactivating globally/some templates.
Differential Revision: https://code.wildfiregames.com/D4040
This was SVN commit r25635.
2021-06-02 17:36:32 +00:00
07e44a75a1 Allow mods to say they should be ignored in replay/MP compatibility checks
Since it is very non-trivial to determine which mods change checksums
and which don't, this relies on modder goodwill (and on verification on
our end for signed mods).

The declaration is an optional "ignoreInCompatibilityChecks" boolean in
mod.json

Also rework slightly the MP lobby mod display to always show the host
mods in a clear manner.

Differential Revision: https://code.wildfiregames.com/D3968
This was SVN commit r25634.
2021-06-02 06:50:16 +00:00
2c3a49734c Removes ShaderProgram from MiniMap header, removes unnecessary members, removes useless scissoring.
This was SVN commit r25631.
2021-06-01 21:37:14 +00:00
e0fd3b532f Cleanups MiniMapTexture a bit.
This was SVN commit r25630.
2021-06-01 19:50:15 +00:00
c2c9059f67 Fixes removed terrain missed in 7ce4552f5e.
This was SVN commit r25629.
2021-06-01 19:08:22 +00:00
7ce4552f5e Moves partially MiniMap texture rendering into a separate object.
Tested By: Langbart, Stan
Differential Revision: https://code.wildfiregames.com/D4045
This was SVN commit r25628.
2021-06-01 18:55:35 +00:00
01e940217e Adds header safeguards to LOSTexture forgotten in fe21c5e023.
This was SVN commit r25620.
2021-05-31 20:47:03 +00:00
4d11256510 Adds shader technique caching to Canvas2D.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4034
This was SVN commit r25619.
2021-05-31 19:22:14 +00:00
42e67be0ee Fix crash when pushing a page while pushing a page.
Because the page stack is a vector, if during PushPage, a new page is
pushed, the vector may re-allocate. This 'pulls the rug out' from
underneath the code stack that originally pushed, which then crashes.

To fix this, use a deque, since push/pop won't invalidate references.

Reported by: Imarok.
Based on a patch by: Imarok (tests are his)
Differential Revision: https://code.wildfiregames.com/D4037
This was SVN commit r25616.
2021-05-31 13:42:08 +00:00
b1902d8e80 Allow setting texture quality in the config file. Fixes a todo.
Differential Revision: https://code.wildfiregames.com/D3020
This was SVN commit r25615.
2021-05-31 12:52:43 +00:00
0bc7ba50ea Add an option to reduce the diversity of actor variants
Variants can now have limited or no diversity. This can occasionally
speed rendering slightly (5-10% FPS increase was reported on Combat Demo
Huge, which is very variant-heavy).

Reported by: bb
Based on a patch by: bb
Fixes #5831

Differential Revision: https://code.wildfiregames.com/D3035
This was SVN commit r25613.
2021-05-31 11:42:46 +00:00
2cc671fd36 Makes 2D text drawing via Canvas2D.
This was SVN commit r25607.
2021-05-30 19:10:10 +00:00
7f16a5c40c Moves TextRenderer shader to a more relevant place, into the rendering function argument.
This was SVN commit r25606.
2021-05-30 18:28:06 +00:00
7f6ef5db79 Removes gui_solid material usage from CChart.
This was SVN commit r25605.
2021-05-30 18:13:23 +00:00
9933fe4b69 Removes gui_solid material usage from ProfileViewer.
This was SVN commit r25604.
2021-05-30 17:35:26 +00:00
1f192f1593 Removes low level GL code from GUI sprite rendering and switches to Canvas2D.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4031
This was SVN commit r25603.
2021-05-30 13:48:58 +00:00
d08c96be43 Uses Canvas2D for str_gui_add material in GUIRenderer.
This was SVN commit r25598.
2021-05-30 01:01:42 +00:00
bee5a4b3a6 Uses Canvas2D for str_gui_solid_mask material in GUIRenderer.
This was SVN commit r25597.
2021-05-30 00:30:55 +00:00
9e611e11f8 Uses Canvas2D for gui_basic material in GUIRenderer.
This was SVN commit r25596.
2021-05-29 23:41:07 +00:00
a462970707 Restores GL check for tests in TextureManager forgotten in 283f524fcf.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4030
This was SVN commit r25595.
2021-05-29 23:24:36 +00:00
7f0c4ee9ab Removes unnecessary blend state changes from GUIRenderer.
This was SVN commit r25594.
2021-05-29 22:48:52 +00:00
df7cabd653 Implements DrawTexture in Canvas2D.
This was SVN commit r25593.
2021-05-29 22:30:23 +00:00
dacbab8b02 Fixes a mistype introduced in 283f524fcf. A smaller size might cause a write to an allocated memory.
This was SVN commit r25592.
2021-05-29 20:07:15 +00:00
57dde8d082 Provides Canvas2D for sprite rendering.
Differential Revision: https://code.wildfiregames.com/D4029
This was SVN commit r25591.
2021-05-29 19:47:36 +00:00
283f524fcf Implements DrawRect in Canvas2D, removes CConsole background drawing with low level GL calls.
This was SVN commit r25590.
2021-05-29 12:31:14 +00:00
2f3837e0b5 Adds Canvas2D to encapsulate low level GL calls for 2D rendering.
Implements DrawLine for charts.

Differential Revision: https://code.wildfiregames.com/D4024
This was SVN commit r25588.
2021-05-28 16:35:57 +00:00
6f9a162dfa CList, COList, CDropdown, CText, CInput: Draw borders above the rest and improve scrollbar drawing order
Fixes: #6055
Differential Revision: https://code.wildfiregames.com/D4004
This was SVN commit r25587.
2021-05-28 16:32:04 +00:00
f7ad2daf62 Removes gui_solid material shader usages from scene rendering.
This was SVN commit r25582.
2021-05-27 20:13:47 +00:00
bd8c6b1572 Fix GetLoadedModsWIthVersions following 498f0d420b
Accidentally broke it in 498f0d420b and didn't notice because D3968
fixes it again.

This was SVN commit r25579.
2021-05-27 08:30:27 +00:00
b17e8f3043 Removes global g_xres and g_yres dependency from GUI objects.
Differential Revision: https://code.wildfiregames.com/D4014
This was SVN commit r25577.
2021-05-26 18:52:22 +00:00
8f4b3dfb16 Removes GL1 constants deprecated in GL3+ from HWDetect since they are not useful anymore.
This was SVN commit r25571.
2021-05-25 22:34:57 +00:00
cf454fe533 Removes unused BitBuf added in 5b5726ed4d.
Bit operations can be done via std::bitset. The current implementation
is too specific to have it just for a future. Refs 479f59e386,
5ca66fc757.

This was SVN commit r25569.
2021-05-25 19:42:06 +00:00
db9356944c Removes unused base32 encoding added in 5cc814759f.
For modern standards base64 costs a bit less space and might be
implemented on demand. base32 usage was introduced in e0dfbe719d and
removed in 93cffe9deb.

Refs a34b759720, 317f98a6c0.

This was SVN commit r25568.
2021-05-25 19:18:22 +00:00
38e085a8c0 Removes unused wutil command line arguments parsing added in 5383eff15c.
We already have a single place to access arguments, so we don't need
a platform dependent place for that.

Refs 3f58951808, 8c1bd05ab9.

This was SVN commit r25567.
2021-05-25 18:42:27 +00:00
007d30f4b4 Removes outdated user32.dll preload hack added in 7a889deca3 and became useless in bbcd9b34cc.
Refs 4b33f49da1, b242eafd02, 56bd5b59b4.

Tested By: Angen
Differential Revision: https://code.wildfiregames.com/D4007
This was SVN commit r25566.
2021-05-25 18:29:50 +00:00
424b3cdcab Fix 498f0d420b - re-add special-casing of mod & user mods
These do not have a mod.json, triggering spurious errors.

This was SVN commit r25548.
2021-05-25 07:50:04 +00:00
863ef0f88a Tweak sound distance attenuation & add configurability
Following D3108 / 876f6d5e50, sounds are attenuated by their actual
distance. However, as noted by players on A24, the dropoff is stark and,
when zoomed out, can easily result in not hearing things that are
happening in the middle of the screen.

The new default settings almost double the max-range, change the minimum
range to have greater dynamic range, and reduce the stereo depth
slightly to better match the default camera FOV.

These are stored per sound-grounp, possibly allowing future tweaks on a
per-soundgroup basis, and are configurable.

Tested by: Imarok
Discussed over mail with: Samulis, Porru

Differential Revision: https://code.wildfiregames.com/D3612
This was SVN commit r25547.
2021-05-25 06:19:25 +00:00
498f0d420b Mod data parsing rework
Parses mod.json data not only in temporary JS values, but in a proper
C++ struct.
This will ultimately make it more convenient to pass more than just the
version to JS in D3968, and it enforces the schema a bit more.

Differential Revision: https://code.wildfiregames.com/D3988
This was SVN commit r25546.
2021-05-25 06:12:45 +00:00
b56f0222d9 Prevent hotkeys from firing for disabled buttons
Reported by: Angen
Accepted By: Angen
Refs #6042

Differential Revision: https://code.wildfiregames.com/D4013
This was SVN commit r25545.
2021-05-25 06:10:53 +00:00
8742fac032 Reorders GL error checks during a frame to ask only when needed, combines depth test switches.
This was SVN commit r25543.
2021-05-24 21:03:48 +00:00
3e5638e548 Removes hardcoded 1px width borders from GUI sprites.
Tested By: Imarok
Differential Revision: https://code.wildfiregames.com/D4008
This was SVN commit r25541.
2021-05-24 18:42:51 +00:00
0e234dbb61 Check translations for spam, broken font tags and sprintf errors.
Supersedes D1674 and D3520.

This still generates some false positives (particularly the
singular-plural check), but in general it will suffice to better check
bundled languages.

Refs #4250

Differential Revision: https://code.wildfiregames.com/D3926
This was SVN commit r25538.
2021-05-24 10:25:19 +00:00
768313d7db Adds Vulkan check to HWDetect reports.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D3429
This was SVN commit r25535.
2021-05-23 22:32:29 +00:00
4e8691acde Clip rendered text correctly
General idea acked by: vladislavbelov
Tested by: Langbart
Differential Revision: https://code.wildfiregames.com/D4006
This was SVN commit r25534.
2021-05-23 22:05:17 +00:00
1e18a93302 Removes using shared_ptr to make STL usages consistent.
Differential Revision: https://code.wildfiregames.com/D4005
This was SVN commit r25533.
2021-05-23 22:01:18 +00:00
10cf87f3d1 Adds std namespace to shared_ptr usages in lib/tex.
This was SVN commit r25530.
2021-05-22 19:34:39 +00:00
5656c4117d Adds std namespace to shared_ptr usages in lib.
This was SVN commit r25529.
2021-05-22 19:32:38 +00:00
b927f163d6 Adds std namespace to shared_ptr usages in scriptinterface and simulation.
This was SVN commit r25528.
2021-05-22 19:30:18 +00:00
d9d19543b5 Adds std namespace to shared_ptr usages in network and engine.
This was SVN commit r25527.
2021-05-22 19:28:40 +00:00
babfd913fb Adds std namespace to shared_ptr usages in gui and sound.
This was SVN commit r25526.
2021-05-22 19:23:03 +00:00
b03b560e71 Adds std namespace to shared_ptr usages in graphics.
This was SVN commit r25525.
2021-05-22 19:21:33 +00:00
0728c58a4d Removes unnecessary z-level from GUI sprite rendering.
Tested By: Imarok
Differential Revision: https://code.wildfiregames.com/D4003
This was SVN commit r25524.
2021-05-22 18:06:18 +00:00
faca950e83 Removes unused CONFIG2_CACHE_READ_ONLY config macro forgotten in 2374caac3e.
Refs 149ebb67c0, 9269be9ee3.

This was SVN commit r25522.
2021-05-22 14:04:11 +00:00
53369d593b Removes Dehydra config macro. Introduced in 378bd89c1d.
Dehydra was abandoned in 2010s.

This was SVN commit r25521.
2021-05-22 13:28:55 +00:00
0812ded348 Removes unused CONFIG_OMIT_FP config macro forgotten in 0d23e3f333.
This was SVN commit r25520.
2021-05-22 13:18:15 +00:00
c73f674055 Removes unused DynHashTbl. Last usage was removed in 6c915291cc.
STL or Boost provides containers with DynHashTbl's functionality (and
not worse performance). Refs 9fd08fb044, 5ca66fc757.

This was SVN commit r25519.
2021-05-22 12:59:41 +00:00
b5535c4ba3 Removes OpenMP from external libraries. It's better to avoid its usage with a custom thread management.
This was SVN commit r25518.
2021-05-22 12:24:18 +00:00
c535a282ac Rename ModsLoaded to EnabledMods
Differential Revision: https://code.wildfiregames.com/D3987
This was SVN commit r25516.
2021-05-22 09:50:30 +00:00
d7a4fb7c20 Try to punch a hole through local firewalls, and fallback to localhost.
Fixes (probably rare) regression in 2034136560.

Differential Revision: https://code.wildfiregames.com/D3999
This was SVN commit r25515.
2021-05-22 08:34:00 +00:00
8f8e29c092 Fix incompatible mods start: show both incompatible and enabled mods;
As noted by Angen in a26535d023, refs 3bcf360107
When starting with incompatible mods, the non-incompatible mods were no
longer shown. This fixes that.
I think the code looks cleaner from this new control flow that
explicitly only mounts "mod".

Tested by: Angen
Differential Revision: https://code.wildfiregames.com/D3996
This was SVN commit r25510.
2021-05-22 07:33:49 +00:00
2be76d52b5 Reduces CConsole interface and simplifies the initialization step.
This was SVN commit r25507.
2021-05-21 23:10:43 +00:00
d7ac3c6b89 Removes macOS system version include added in 7e87211d91 and forgotten in 9a2d0f803e.
This was SVN commit r25506.
2021-05-21 21:46:01 +00:00
7ae43c149e Replaces global g_VSync state by VideoMode property.
This was SVN commit r25504.
2021-05-21 21:33:43 +00:00
b2d0bd9a81 Adds a warning in case ShaderManager is trying to load an ARB shader with enabled GLSL.
This was SVN commit r25503.
2021-05-21 20:32:33 +00:00
4215533ea9 Removes inclusionPath forgotten in b469983c58.
This was SVN commit r25502.
2021-05-21 20:15:58 +00:00
78aedfcb93 Removes unused declarations of g_xres and g_yres.
This was SVN commit r25501.
2021-05-21 20:02:03 +00:00
fa44b9ae97 Removes g_ShowPathfindingOverlay forgotten in 72bd886f80.
This was SVN commit r25500.
2021-05-21 19:27:43 +00:00
312225570f Removes g_AutostartMap forgotten in c684c211a2.
This was SVN commit r25499.
2021-05-21 19:21:24 +00:00
7cf579c597 Removes g_TriPathfind forgotten in d3048906cb.
This was SVN commit r25498.
2021-05-21 19:11:12 +00:00
5be764e384 Removes outdated archive trace code forgotten in 63086f4e26.
This was SVN commit r25497.
2021-05-21 19:05:40 +00:00
b6f2dee43b Increase pushing range by 60%
Reduces the 'clumpiness' of units, particularly when ordered to move to
a single point. The minimum pushing force was increased to compensate.

Differential Revision: https://code.wildfiregames.com/D3978
This was SVN commit r25479.
2021-05-21 07:23:47 +00:00
a26535d023 Fix mistake in 3bcf360107 which stopped the incompatible mods page from showing.
I didn't quite understand what was supposed to happen here. This makes
things work as before.
While at it, fix a conversion bug & do some more tweaks.

Differential Revision: https://code.wildfiregames.com/D3990
This was SVN commit r25475.
2021-05-20 17:11:26 +00:00
3bcf360107 Mod and mod-mounting cleanup and improvements.
- Non-visual replays now automatically try to load the replay mods. This
removes the annoyance that -mod=public usually had to be passed.
- MountMods is no longer called in InitVfs but later, making it possible
to load the game in one pass & simplifying things considerably.
- Explicitly ignore duplicates when loading mods
- Interface cleanup: failed mods and incompatible mods were redundant,
only incompatible mods is kept.
- Interface cleanup: `AreModsCompatible`becomes
`CheckForIncompatibleMods`, which becomes a private pure function,
simplifying the control flow somewhat.
- Interface cleanup: `CheckAndEnableMods` is just `EnableMods`, which
explicitly updates loaded & incompatible mods.
- `CacheEnabledModVersions` becomes private and is called on behalf of
the user, removing the need to be careful about updating that (fixes my
concern at 44ec2e324e)

Overall, the logic around mounting & enabled mods should be easier to
understand.

Differential Revision: https://code.wildfiregames.com/D3982
This was SVN commit r25474.
2021-05-20 14:36:42 +00:00
1e297fe212 Fixes PCH after 7bfcd9f78b.
This was SVN commit r25473.
2021-05-20 11:47:56 +00:00
04549a081d Rework Mod into a class.
`Mod` currently modifies 4 global arrays, including some that are
'public'.

The logic flow is easier to understand if this becomes a real class with
const-correctness and public/private methods.

Differential Revision: https://code.wildfiregames.com/D3981
This was SVN commit r25469.
2021-05-20 08:32:11 +00:00
7bfcd9f78b Additional entropy when hashing match passwords.
The purpose of our client-side hashing for lobby game passwords is to
prevent malicious hosts from getting valuable passwords from clients
(e.g. accidentally typing their lobby password instead of the game, or
even their email password, etc).
However, the hashing was deterministic (and rather simple), making it
possible to compute rainbow tables and recover user passwords anyways.

By adding more variation, including some that cannot so easily be
controlled by the host (the client name), this becomes impractical. The
password hashing function used is rather fast, but given the base low
probability of mistypes, this seems fine.

Differential Revision: https://code.wildfiregames.com/D3459
This was SVN commit r25459.
2021-05-18 14:47:36 +00:00
0c23e595fa Include CStrInternStatic where necessary only.
This makes incremental recompilation faster when changing static
interned strings.

Differential Revision: https://code.wildfiregames.com/D3975
This was SVN commit r25457.
2021-05-18 11:09:54 +00:00
895e4e6aa6 StunClient code cleanup: use enet functions, endianness
Instead of using platform-specific sockets, use enet_socket* functions
(which ends up doing the same).
Clean up some confusing APIs, removing the distinction between finding
the public IP for the host/join.

Fix endianness support & use simpler code.

Refs D364 / 61261d14fc (and some subsequent fixing diffs).

Differential Revision: https://code.wildfiregames.com/D3970
This was SVN commit r25453.
2021-05-17 15:14:10 +00:00
f1467d10fd Make pathfinder debug rendering thread-safe.
Also cleans up the jump point cache const-correctness.

Differential Revision: https://code.wildfiregames.com/D3966
This was SVN commit r25452.
2021-05-17 09:38:24 +00:00
8b6d4233eb Disables by default Intel Mesa workaround to save video memory.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/DD3967
This was SVN commit r25449.
2021-05-16 19:08:28 +00:00
2034136560 Implement a workaround for routers without NAT loopback.
This allows joining a lobby game hosted on the same network (behind the
same NAT gateway).
This is relatively primitive to keep things simple: if the server and
the client have the same public IP, it is assumed that they are on the
same network and the client instead requests the local IP.

Differential Revision: https://code.wildfiregames.com/D3944
This was SVN commit r25448.
2021-05-16 15:34:38 +00:00
a19dc1717f Don't include ComponentManager.h in ScriptComponent
ScriptComponent does not use ComponentManager, and its derived classes
(most ICMP*.cpp files) do not either. Therefore, we can skip a lot of
transitive inclusions and speed up recompiling by not including it
there.

Differential Revision: https://code.wildfiregames.com/D3962
This was SVN commit r25447.
2021-05-16 15:12:39 +00:00
e908733220 Speed up GetAvailableMods for archives.
Refs 64bfa089af and 44ec2e324e

When a .zip file is encountered by the VFS population, it reads the info
for all files in the archives. This is quite slow for the public archive
(400-500ms on my computer), which means calling GetEngineInfo()
repeatedly is impossible.

By only opening the external mod.json, we skip most of the work. The
archive can still be opened if needed as fallback.


Differential Revision: https://code.wildfiregames.com/D3216
This was SVN commit r25446.
2021-05-16 13:50:05 +00:00
5ff4fa19c0 Removes unused and outdated includes, replaces some includes by forward declarations.
This was SVN commit r25444.
2021-05-15 17:27:01 +00:00
41a29a590a Fixes broken PCH after wraitii commits (4f972bc623, 0f60bf3a97) and Itms (833c9f108c).
This was SVN commit r25443.
2021-05-15 14:50:24 +00:00
507f44f7f9 Remove all external usage of CmptPrivate. Header cleanup.
This removes usage of CmptPrivate outside of ScriptInterface.
ScriptRequest can now be used to safely recover the scriptInterface from
a JSContext instead of going through ScriptInterface, which allows more
code cleanup.

Follows 34b1920e7b

Differential Revision: https://code.wildfiregames.com/D3963
This was SVN commit r25442.
2021-05-15 13:54:58 +00:00
3ebff376cc Adds view bounds test for an ortho camera and removes commented code after 44f8d2c6f5.
This was SVN commit r25441.
2021-05-15 13:47:48 +00:00
44f8d2c6f5 Fixes a bounding box projection to an incorrect camera causes the red water bug.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D3905
This was SVN commit r25440.
2021-05-15 13:33:36 +00:00
cf5c815879 Fix 4f972bc623
Shouldn't make last-minute changes without recompiling...

This was SVN commit r25435.
2021-05-14 11:12:07 +00:00
4f972bc623 Split off JSON-related function from ScriptInterface, clean up headers.
Follows 34b1920e7b.

JSON functions and ToString are movec to their own headers.
Also clean out a few PersistentRooted usage to use the 2-phase init to
clean up scriptInterface usage.

With these functions split off, we can finally clean out headers and
remove ScriptInterface.h from most of them, in favour of smaller and
more precise headers.


Take the opportunity to clarify some comments regarding Mutability.

Differential Revision: https://code.wildfiregames.com/D3961
This was SVN commit r25434.
2021-05-14 10:18:03 +00:00
f368e1a69e Remove unused m_rng member from ScriptInterface.
The one in ScriptInterface_Impl is actually used.
Introduced in e9e05f4efc and from what I can tell never actually used.

Differential Revision: https://code.wildfiregames.com/D3960
This was SVN commit r25433.
2021-05-14 09:27:12 +00:00
0f60bf3a97 Split off Object-related functions from ScriptInterface
Follows 34b1920e7b.

This splits off the object-related functions, such as
[Set/Get/Has]Property, CreateObject, CreateArray, FreezeObject.

It also puts the definitions in the header itself, which might end up
with faster code here & there, though perhaps slower compilation time
(somewhat doubtful since we already included most things anyways).

Differential Revision: https://code.wildfiregames.com/D3956
This was SVN commit r25430.
2021-05-13 17:23:52 +00:00
61e0aef0b4 Split JS conversions from ScriptInterface.
All ToJSVal/FromJSVal definitions are put in a separate header.
Remove AssignOr[To/From]JSVal duplication.

The functions were already static so this is rather straightforward.

Follows 34b1920e7b and 2bae30c454

Differential Revision: https://code.wildfiregames.com/D3953
This was SVN commit r25428.
2021-05-13 09:43:33 +00:00
d798a2ec0e Fix crash in Atlas.
Fixes 6fbf036ae4

Reported by: Stan
Differential Revision: https://code.wildfiregames.com/D3954
This was SVN commit r25425.
2021-05-12 19:25:09 +00:00
dd19cc3444 Major improvements to the lobby bots XpartaMuPP and EcheLOn.
Reviewers: elexis, Dunedan

Fixes: #5914

Differential Revision: https://code.wildfiregames.com/D2630
This was SVN commit r25424.
2021-05-12 15:40:50 +00:00
4ad78018f9 Fix no-pch build. Potentially fixes bb49fbe793, 0198942a79, 34b1920e7b, 8b08f4ae7a 0dbf417171, 3af1fc64d2, 5fbdbaa3bc, 6fbf036ae4.
Comments by: @vladislavbelov, @wraitii.
Differential Revision: https://code.wildfiregames.com/D3948
This was SVN commit r25423.
2021-05-12 13:48:55 +00:00
6fbf036ae4 Split off StructuredClone from ScriptInterface
Follows 34b1920e7b.

This separates StructuredClone & DeepCopy logic into its own header,
reducing the size of the monolithic ScriptInterface header.

Differential Revision: https://code.wildfiregames.com/D3922
This was SVN commit r25419.
2021-05-10 11:51:32 +00:00
5fbdbaa3bc Fix 3af1fc64d2 - incorrect texture path on Windows.
sizeof(const char*) returns the pointer size and not the string size,
and 'texture:' happend to be 8 characters long, which is the same as a
64-bit pointer but not a 32-bit pointer.

Reported by: Stan
Differential Revision: https://code.wildfiregames.com/D3947
This was SVN commit r25415.
2021-05-09 17:29:50 +00:00
Angen
b4d11bda89 Fix warnings and missing break from f1acd22455
make linter happy
add missing break to loop if correct comparator has been found, reported
by @Langbart

Differential revision: D3945
Tested by: @Langbart
This was SVN commit r25414.
2021-05-09 17:05:02 +00:00
f653541e2c Fix warnings in 3af1fc64d2
Differential Revision: https://code.wildfiregames.com/D3946
This was SVN commit r25412.
2021-05-09 16:24:13 +00:00
Angen
f1acd22455 Do not allow to start pyrogenesis with incompatible mods
Fixing following problems:
Issue number one:
Enable mod with a23 compatibility in a23b.
Save configuration.
Start a24.
Better result:
Mod will be enabled and invisible in mod selection screen producing
various errors.
Worse result:
Game will crash and refuse to start.

Issue number two:
Mods can silently set loaded mods without restarting the engine, so mods
can unlist themselves from compatibility detection.

Solution:
Enable necessary mods instead if running with gui and open mod page.
Open information window on top of mod page to infom why mod page is
showing up.
On mod page show mods which failed in compatibility check and color the
resposnible ones.
Disable start button without enabled mods.
Show non existed mods if they failed in compatibility check.

Else just log to mainlog and close.

Another fixes:
Display in enabled mods really enabled mods as current logic confuses
players about which mods they have enabled and is not helpful (ref
#4881)

Note:
this will not solve issue with mods claiming being compatible with
engine version while in fact being incompatible.

Comments by: @vladislavbelov, @Stan, @Imarok
Tested by: @wraitii
Differential revision: D3592
Fixes: #6044 #4881

This was SVN commit r25410.
2021-05-09 13:53:25 +00:00
3af1fc64d2 Allow GUI elements to define custom mouse event mask shapes.
This allows GUI elements to use a texture as their "mouse event mask",
making it possible to have arbitrarily-shaped GUI elements with regards
to mouse interactions.

Used for the minimap idle worker button as a proof-of-concept.

Differential Revision: https://code.wildfiregames.com/D3814
This was SVN commit r25408.
2021-05-09 13:08:07 +00:00
e94faf7827 Don't hardcode the "0ad" resource into lobby XMPP & hosting
XMPP JID has a concept of 'resources', which can be used to
differentiate multiple clients of the same account.

We currently hardcode this 'resource' to '0ad' in two places:
- The 0 A.D. client always uses '0ad'
- The network code expects a host resource to be '0ad' when connecting.

As noted in 0fd8aa2a77#31215, it is less effort to store the JI
D directly. This patch does that. It also makes 0 A.D. use a different
resource each time.
Note that resources ought not contain particular information, as the
XMPP server is free to
 clobber it. I keep '0ad-' here for debug purposes.

This allows:
- multiple 0 A.D. instances to log on the lobby at the same time (not
massively useful, but good for debugging sometimes)
- hosting a game with a custom resource, which will potentially make it
easier to have dedi
cated servers on one account.

Note that hosting multiple games on one account is currently not
supported and will have weird behaviour on the lobbybots side. They
should be upgraded independently of this.

Refs #3556

Differential Revision: https://code.wildfiregames.com/D3500
This was SVN commit r25407.
2021-05-09 12:51:32 +00:00
abb124a36f Fix cpuid call with -fPIC on i386 architectures.
GCC < 5 used to reserve the ebx register for PIC (position-independent
code) metadata. This meant that we needed to save the state of ebx
before calling cpuid (fixed in #2675)
However, the original patch from 03eaf9b461 did not force a particular
register to store this value in. Following the GCC 5 upgrade, GCC
stopped reserving ebx, and that register silently got used instead. The
code became non-sensical, and our ASM __cpuidex started returning random
garbage in edx.

Since we now only support GCC7 and above, the PIC-specific branch is no
longer necessary and is removed.

Fixes #6028. The assertion was a result of random data in ebx.
Refs #2675 / reverts 6334ee3f8b and reverts 03eaf9b461.

Patch by: nwtour
Comments by: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D3575
This was SVN commit r25405.
2021-05-09 12:41:45 +00:00
0dbf417171 Fix 8b08f4ae7a - CGUIColor setting
Reported by: langbart
Fixes #6173

Differential Revision: https://code.wildfiregames.com/D3937
This was SVN commit r25401.
2021-05-07 11:34:20 +00:00
64b475b390 Fix Profiler1 "time per turn".
Actually call Turn() when a turn is processed.

Fixes #6144

Differential Revision: https://code.wildfiregames.com/D3885
This was SVN commit r25394.
2021-05-06 16:49:34 +00:00
8b08f4ae7a Change GUI settings to explicitly be member variables.
Completes work starting in D2313 / a33fd55e81:
- Make C++ mistakes where values can be changed without messages being
sent easier to notice / harder to do.
- Make the IGUISetting interface more flexible, allowing custom settings
implementing their own logic. This is used to clean up hotkey code
introduced in 33af6da5e1.

Side effects:
- FromJSVal_Vector clears the vector being passed in. I have some vague
memory of not doing that in D24 / 2bae30c454 as an optimisation, but it
seems more like a footgun to me.
- Most usage of SetSettingFromString is replaced by direct method calls,
as we can generally cast to the proper GUI object type. Where we can't,
it is kept as a poor's man virtual dispatch.
- It moves a few member variables elsewhere, e.g. TextOwner now gets its
own member variable settings.

Differential Revision: https://code.wildfiregames.com/D3892
This was SVN commit r25392.
2021-05-06 08:22:37 +00:00
4db5467717 Fix mistake in 100159548c
I last-minuted a "X = X * Y" into a "X *= Y" but that turns out to map
to "X = Y * X" with our matrix overloads.

Reported by: langbart
This was SVN commit r25391.
2021-05-06 07:42:49 +00:00
100159548c Fix bounding boxes after f73fa05542
Skinning calculations must happen in bone-space.

Fixes f73fa05542

Reported by: langbart
Fixes #6168

Differential Revision: https://code.wildfiregames.com/D3927
This was SVN commit r25387.
2021-05-05 16:20:33 +00:00
2e08fd38ea GUI cleanup: XML & child handling.
- We only need an XMBFile, not a CXeromyces to parse GUI
objects/scripts/... This makes the interface more consistent with other
usage, notably ParamNode.
- Rename IGUIObject::AddChild to RegisterChild and flesh out the
interface a little.

Differential Revision: https://code.wildfiregames.com/D3908
This was SVN commit r25378.
2021-05-04 15:17:50 +00:00
0198942a79 Fix warning in cdd75deafb
GCC complained, even if the path cannot be taken.

This was SVN commit r25377.
2021-05-04 14:01:18 +00:00
911f49c655 Gamesetup: make sure GameSpeed is a number
The dropdown converted the numbers to string, and the code expected
numbers.

Differential Revision: https://code.wildfiregames.com/D3924
This was SVN commit r25376.
2021-05-04 13:59:30 +00:00
cdd75deafb XMB Improvements, parse JS into XMB, make strings more efficient.
XMB format is bumped to 4, invalidating all cached files. The
differences are:
 - element/attribute names are stored after the elements themselves, and
not before. This allows writing XMB data in one pass instead of two.
 - names themselves becomes offsets (instead of arbitrary integers),
making getting the string from the int name much more efficient.

XMBFile is renamed to XMBData to clarify that it does not, in fact,
refer to a file on disk.

XMBData::GetElementString is also changed to return a const char*, thus
not creating an std::string. A string_view version is added where
convenient.

The XML->XMB and JS->XMB conversion functions and the corresponding
storage are moved to `ps/XMB`, since that format doesn't particularly
relate to XML. CXeromyces becomes lighter and more focused as a result.
The XML->XMB conversion also benefits from the above streamlining.

Note that in a few cases, string_view gets printed to CLogger via
data(), which is generally not legal, but we know that the strings are
null-terminated here. Our libfmt (version 4) doesn't support
string_view, that would be v5.

Differential Revision: https://code.wildfiregames.com/D3909
This was SVN commit r25375.
2021-05-04 13:02:34 +00:00
34b1920e7b Split ScriptRequest in its own header.
We often only need to include ScriptRequest.h and not the full
ScriptInterface.h

Differential Revision: https://code.wildfiregames.com/D3920
This was SVN commit r25366.
2021-05-03 16:07:26 +00:00
0406c4dfde Throw errors instead of warnings on wrong implicit conversions.
This prints out a stack trace, which is quite helpful when debugging.
Also fixes an issue with stack trace not always being reported.

Differential Revision: https://code.wildfiregames.com/D3210
This was SVN commit r25365.
2021-05-03 15:44:06 +00:00
bb49fbe793 Further reduce usage of TERRAIN_TILE_SIZE in non-terrain components
TERRAIN_TILE_SIZE is now only used in relevant places in the simulation.
This also makes it mostly possible to use CFixed in constexpr contexts.

Refs #5566

Differential Revision: https://code.wildfiregames.com/D3078
This was SVN commit r25360.
2021-05-02 17:40:00 +00:00
6d10a35d97 Fix some warnings.
- 25332f9b86 added 'override' to a method in ShaderProgram.cpp. This
adds it to the rest.
- BinarySerializer.cpp had custom JS includes, because putting those in
ScriptExtraHeaders failed. The cause is that gloox leaves "#define
lookup" up. This has been reported upstream, and fixed here.
- VS17 complains about an uninitialised variable, though the usage is
safe.

Differential Revision: https://code.wildfiregames.com/D3916
This was SVN commit r25359.
2021-05-02 15:45:40 +00:00
3801a4dd47 Allow implicit JS boolean -> string conversions.
`false` becomes `"false"`, `true` becomes `"true"`.

Differential Revision: https://code.wildfiregames.com/D3917
This was SVN commit r25358.
2021-05-02 15:43:59 +00:00
e53628ab56 Remove debug code left in d9748173c7
Reported by: Freagarach
This was SVN commit r25357.
2021-05-02 07:08:40 +00:00
2fcab79e15 Moves terrain independent code for viewport bounds calculations to camera.
This was SVN commit r25355.
2021-05-01 16:59:42 +00:00
d46a417748 Replace ScriptInterface::Call* with new ScriptFunction functions
Finishes work started in f3aedf88a6.
This removes the boost-CPP function wrappers entirely, in favour of pure
templated code in FunctionWrapper.h
The Call* functions were already heavily templated, so there is nothing
really new here. I just use tag dispatch to reduce the number of
overloads slightly.

The new functions do not need the script interface, only the script
request.

Differential Revision: https://code.wildfiregames.com/D3912
This was SVN commit r25354.
2021-05-01 14:04:53 +00:00
d9748173c7 Generalize icon-specific tooltips to a tag, streamline code.
We can currently specify a custom tooltip for an icon. This extends that
to a generic tag `[tooltip='something']...[/tooltip]` for any particular
piece of text, and removes the iconTooltip hardcoding by instead using a
virtual `GetTooltipText` call since all IGUIObject descendants have a
tooltip. This is both cleaner & more efficient.
Removes the ability to set a custom tooltip style (that doesn't seem
particularly useful), it'll reuse the style of the CText itself.

Differential Revision: https://code.wildfiregames.com/D3895
This was SVN commit r25353.
2021-05-01 12:38:05 +00:00
9107d6d8c7 Fixes unused CCamera argument in debug rendering in SilhouetteRenderer.
This was SVN commit r25352.
2021-05-01 12:13:48 +00:00
19b01dc710 Migrate DEFINE_INTERFACE_METHOD_* to the ScriptFunction wrappers.
The main benefits are more convenient code in the component interfaces
TU and no limit on the # of arguments that can be passed.

Differential Revision: https://code.wildfiregames.com/D3910
This was SVN commit r25350.
2021-05-01 08:01:30 +00:00
c62ad8fefa Implement FromJSVal<IObject*> safely
By making all GUI proxy objects share the same class, we can easily
confirm if a given JS object is one, and from there convert to the
appropriate types.

Differential Revision: https://code.wildfiregames.com/D3907
This was SVN commit r25347.
2021-04-30 13:20:43 +00:00
835c081ca4 Fix large slowdown in rendering on some configurations.
Usage of GL_VERTEX_ARRAY client state apparently prevented OpenGL from
using hardware acceleration on my computer (Macos 10.14 with an Intel
GPU).
It is unclear how many people would be affected by this issue, but on my
end it makes GLSL performance competitive with ARB again.

Reviewed By: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D3900
This was SVN commit r25343.
2021-04-29 07:38:40 +00:00
59168b015e Revert 2e1545ffc4, fix correctly.
This was SVN commit r25335.
2021-04-28 16:38:45 +00:00
c9a7aabbea Fix enabling / disabling shadows in the actor viewer.
Differential Revision: https://code.wildfiregames.com/D3896
This was SVN commit r25334.
2021-04-28 11:09:16 +00:00
b74d5bf0d8 Removes glColor* calls from scene rendering, colors are set explicitly by uniforms.
This was SVN commit r25330.
2021-04-27 19:35:36 +00:00
5b33d3a76c Removes ShaderProgramPtr argument from DebugRenderer methods.
This was SVN commit r25329.
2021-04-27 19:23:37 +00:00
cd6a554198 Removes GL matrix stack usages from scene rendering.
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D3894
This was SVN commit r25328.
2021-04-27 18:43:49 +00:00
66fbc23f2c De-singletonify CConfigDB, make hooks RAII.
CConfigDB is no longer a singleton, and its members are no longer
static.
This makes it possible to have several instances of it, useful for
testing of if we ever want to have different config profiles.

Also updates hooks to delete themselves on destruction, to fit a more
natural RAII pattern. Long-lived objects must take care to destroy hooks
before ConfigDB is reset.

Differential Revision: https://code.wildfiregames.com/D3866
This was SVN commit r25326.
2021-04-27 07:45:40 +00:00
2698cf8ba2 Fixes missing DrawCameraFrustum argument after 5e12424123.
This was SVN commit r25324.
2021-04-26 21:21:13 +00:00
5e12424123 Removes glBegin from scene rendering, removes GL matrix stack dependency from scene rendering.
This was SVN commit r25323.
2021-04-26 21:11:35 +00:00
8963786a76 Improve error message for broken quality levels in Actor files.
Differential Revision: https://code.wildfiregames.com/D3887
This was SVN commit r25321.
2021-04-26 14:59:32 +00:00
ad87f1e295 More actor file validation, preventing crashes.
It's currently possible to trigger ENSUREs in the code if loading empty
groups, which is easy enough with LOD and shouldn't happen.

Recover gracefully from these errors instead.

Differential Revision: https://code.wildfiregames.com/D3888
This was SVN commit r25320.
2021-04-26 14:57:13 +00:00
2e1545ffc4 Fix unused variable warning in a97f7f3917
This was SVN commit r25318.
2021-04-26 08:47:24 +00:00
2086a66340 Adds circle drawing to DebugRenderer.
This was SVN commit r25315.
2021-04-25 21:55:19 +00:00
e90aaf6348 Adds line drawing to DebugRenderer.
This was SVN commit r25314.
2021-04-25 20:48:44 +00:00
Angen
9977c73eb6 Revert 895182cbcb
This was SVN commit r25313.
2021-04-25 13:42:51 +00:00
Angen
895182cbcb Make player entities more visible on minimap
This patch is increasing contrast of player colours used on minimap in
minimap component instead of changing player colours themselves to not
mess with other cases, when they are used.

Differential revision: D3242
Comments by: @vladislavbelov, @ValihrAnt, @Freagarach
This was SVN commit r25312.
2021-04-25 11:05:41 +00:00
a97f7f3917 Hotloading fix after 76acc4e146
Emplace does not replace existing element, insert_or_assign does.

While at it:
 - Clean up the 'outdated' logic and reuse it for actors
 - When an actor fails to load, return a placeholder. This improves
hotloading of broken actors, and makes Cunit behaviour more predictable.
 - Some minor cleanup

Reported by: Stan
Fixes #6157

Differential Revision: https://code.wildfiregames.com/D3882
This was SVN commit r25308.
2021-04-24 09:39:33 +00:00
f73fa05542 Cache the model-animation bounds more efficiently.
To render models, we need to know the maximum bounds it takes over the
course of an animation. This depends only on the ModelDef and the
AnimationDef (and thus the SkeletonDef).
Currently, we recompute this data for each model, which is inefficient.
Caching it in ModelDef is faster, particularly avoiding lag spikes at
game start on some maps.
The animations are referred by a unique ID to avoid pointer-related
issues. I would have preferred weak_ptr, but that cannot be stably
hashed for now.

While at it, switch to unique_ptr/vectors.

Differential Revision: https://code.wildfiregames.com/D2967
This was SVN commit r25306.
2021-04-23 14:26:59 +00:00
f3bc024e79 Draws scrollbar above list to have a correct order for Z sorting after a6cb77a204.
Reported By: nwtour
Tested By: nwtour
Differential Revision: https://code.wildfiregames.com/D3881
This was SVN commit r25303.
2021-04-23 06:56:01 +00:00
f4905066ab Reduces number of allocations during error message formatting.
Differential Revision: https://code.wildfiregames.com/D3871
This was SVN commit r25300.
2021-04-22 06:53:03 +00:00
fe991aaa62 Moves cinematic overlay to GUI.
Differential Revision: https://code.wildfiregames.com/D3869
This was SVN commit r25289.
2021-04-18 16:23:10 +00:00
5c51ce2e2f Removes old ARB state.matrix usages.
This was SVN commit r25285.
2021-04-17 23:08:55 +00:00
769b0426a7 Removes unused debug render from ShadowMap.
This was SVN commit r25284.
2021-04-17 22:16:01 +00:00
518fb7eafa Set a stack quota for JS scripts to prevent crashes from infinite loops.
Infinite loop will instead trigger JS exceptions, which will make error
reports much nicer.

Differential Revision: https://code.wildfiregames.com/D3851
This was SVN commit r25280.
2021-04-16 16:49:18 +00:00
89032c4d2b Improvements on 76acc4e146
See 76acc4e146. Follows comments by @vladislavbelov.

Differential Revision: https://code.wildfiregames.com/D3852
This was SVN commit r25279.
2021-04-16 16:04:01 +00:00
924c6ce34e Rework 7ee94f23df
Following comments by @vladislavbelov.

Differential Revision: https://code.wildfiregames.com/D3860
This was SVN commit r25278.
2021-04-16 16:01:30 +00:00
4a51012442 Adds line drawing to DebugRenderer.
This was SVN commit r25271.
2021-04-15 22:51:25 +00:00
389a5a4379 Removes low-level GL calls from graphics and geometrics primitives and adds DebugRenderer.
Tested By: Freagarach
Differential Revision: https://code.wildfiregames.com/D3857
This was SVN commit r25269.
2021-04-15 18:07:01 +00:00
7ee94f23df Use type_identity to simplify Clamp usage.
Differential Revision: https://code.wildfiregames.com/D3859
This was SVN commit r25266.
2021-04-15 13:01:24 +00:00
092ccfec77 Removes unused header dependencies from CTimeManager.
This was SVN commit r25262.
2021-04-14 22:14:37 +00:00
715dca0701 Removes unused shadow settings forgotten in 12e2428495, removes direct SkipSubmit access.
This was SVN commit r25261.
2021-04-14 20:25:05 +00:00
43a780504a Delete "Compact RelaxNG" / .rnc files
(Follows 76acc4e146 where I deleted actor.rnc)

This deletes the .rnc validation files, upgrading the .rng files to
being the source of truth.

- The engine uses, via LibXML2, .rng files to validate XML schemas, to
the .rnc files are redundant.
- The RelaxNG "Compact" format is a DSL for the RelaxNG XML format. Its
syntax is unique, unlike .rng files which are XML.
- Some errors are likely - I'm not sure anyone has converted the compact
files in years.
- The tool to generate .rng from .rnc files is trang
(https://github.com/relaxng/jing-trang), which runs on the JVM and is
quite annoying to install compared to "your usual text editor".
- The JS components use the full .rng format in XML, so editing this
format is already familiar to most people that mod the game.

The .rnc files were added in 2c9939ac74 along the .rng files.

Refs #413, #245

Differential Revision: https://code.wildfiregames.com/D3824
This was SVN commit r25258.
2021-04-14 07:39:36 +00:00
0308c2390a Rework the pathfinder path computation setup for threading.
Essentially reverts D1918 / d592bf9cb6.
Instead of copying path requests to workers, setup the result vector,
then setup an index, and compute 'in-place'.
To send messages, the result vectors are read in order. This makes the
order trivially constant no matter how many workers there are, and the
architecture overall makes it much easier to efficiently paralellise.

Tested by: Langbart, Stan
Differential Revision: https://code.wildfiregames.com/D3849
This was SVN commit r25256.
2021-04-14 07:23:47 +00:00
990265d974 Fixes warnings after minimap changes in b7db124cb5.
This was SVN commit r25254.
2021-04-13 23:16:46 +00:00
c8b2c09bc3 Fix --without-pch build. fc60d80af1 was missing an include.
Reported by: @vladislavbelov
This was SVN commit r25253.
2021-04-13 17:28:01 +00:00
e36c8c3763 Destroy components in reverse order of construction.
Components have some initialisation-order dependency. They could also
have destroy-order dependency, and from a RAII-like point of view, it
makes sense to do this.

Differential Revision: https://code.wildfiregames.com/D3843
This was SVN commit r25251.
2021-04-13 13:47:59 +00:00
0a59489824 Use unique_ptr for secondary sim data.
Differential Revision: https://code.wildfiregames.com/D3842
This was SVN commit r25250.
2021-04-13 13:46:45 +00:00
1b844606aa Implement mul_round in checkrefs.
Missed in 19f600cfa2. In use since 2078abdcc4.

This was SVN commit r25247.
2021-04-12 16:33:54 +00:00
b7db124cb5 Crops minimap view bounds to map size.
Differential Revision: https://code.wildfiregames.com/D3837
This was SVN commit r25241.
2021-04-12 12:39:07 +00:00
a6cb77a204 Disables depth test for GUI rendering.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D3835
This was SVN commit r25231.
2021-04-11 19:36:52 +00:00
e7159c01fb Fix 3759fc8a98
3759fc8a98 broke decals and particle emitters, as I misplaced the if
block.

Reported by: langbart
This was SVN commit r25230.
2021-04-11 19:04:56 +00:00
8eb4871c9b Draws GUI elements by Z order.
Tested By: wraitii
Differential Revision: https://code.wildfiregames.com/D3780
This was SVN commit r25229.
2021-04-11 11:27:53 +00:00
35ed55cfd6 ParamNode: switch to utf8, ToXML -> ToXMLString, test tweak, PCH tweak
This changes ParamNode to use UTF8 values internally (XMB files are UTF8
since cb9d0733ef).
This removes the need for a lot of conversions, speeding things up and
allows cleaning up the validator interface & a few other callsites.
ConstructJSVal could be a tad slower because of UTF8->16 conversions
within Spidermonkey; but the difference is unlikely to be noticeable in
practica.

Also:
- Changes `ToXML` to `ToXMLString` for clarity.
- Add a simple "op" test & show a particular behaviour of merge nodes
that I intend to change somewhat in D3830.
- Remove Component.h from simulation2 PCH - brought in too much.

Tested by: langbart
Differential Revision: https://code.wildfiregames.com/D3834
This was SVN commit r25228.
2021-04-11 09:23:10 +00:00
fcc6bbe797 Fix d73a3f59ad - wstring_view on a temporary & wrong utf16->8 conversion.
Two issues:
- The wstring_view was created on a temporary string - the data got
overwritten sometimes.
- there was some weird UTF16->UTF8 conversion going on.


Reported by: langbart
Differential Revision: https://code.wildfiregames.com/D3828
This was SVN commit r25226.
2021-04-09 18:08:37 +00:00
fc60d80af1 Simplify GUI Proxy implementation & customisation.
This finishes 7c04ea0211 and 1b67a079fb.
GUI Proxy objects are now easier to specialize, code duplication is
reduced, code is made safer.
In details:
- the proxy private is always the IGUIObject* pointer
- the private data is accessed through a safer wrapper
- CreateJSObject returns an opaque type to allow easier extension &
prevent errors.
- The implementation of CreateJSObject is moved near the GUI Proxy
template instantiation, and both are wrapped in a convenient macro (this
makes it so that if you use the macro, you can't forget to overload the
method, and vice-versa).
- The common IGUIObject JS interface no longer needs to be repeated.
- All specialisations are again put in the same file, for improved
compile-time & clarity, given there are so few lines now.
- While at it, implement toSource which makes it possible to `uneval`
components (does the same as toString though).


Differential Revision: https://code.wildfiregames.com/D3826
This was SVN commit r25225.
2021-04-09 18:01:47 +00:00
3759fc8a98 Allow empty actor files.
This allows empty actor files -> they map to a dummy object that renders
nothing.
The use case is automatically hiding objects at lower quality levels &
LOD settings.

Differential Revision: https://code.wildfiregames.com/D3819
This was SVN commit r25224.
2021-04-09 15:45:31 +00:00
d73a3f59ad Allow arbitrary compositions in TemplateLoader template names.
- Allows compositing any two templates in TemplateLoader, and not just
filters: 'A|B|C' is now valid for any template A, B and C.
- Allows parents to be composited paths 'A|B|C'. In such a schema, if A
or B themselves specify a parent, the actual composition becomes
A|pA|B|pB|C and so on.

This allows, by leveraging the common schema of our entities, to reduce
duplication.

For convenience, templates in "special/filters/" and "mixins/" can be
included by their direct name. Others have to be completely specified.

See the two provided cases for examples:
- 'hoplite' becomes a mixin that can be used to apply the Phalanx
formation
- 'builder' becomes a mixin that can be give a template the ability to
build the standard structures, and gives the 'Builder' identity class.
This also allows deduplicating that list of tokens.

Update checkrefs & swap std::map for std::unordered_map in
TemplateLoader.

Differential Revision: https://code.wildfiregames.com/D3801
This was SVN commit r25223.
2021-04-09 15:43:50 +00:00
7321509d5f Fix crash in ActorViewer.
Fixes 76acc4e146 (and some 2007-2010 commit).
ObjectManager needs the Simulation to be initialised, thus needs to come
after it in the class.

Tested by: langbart
Differential Revision: https://code.wildfiregames.com/D3827
This was SVN commit r25222.
2021-04-09 15:34:51 +00:00
1af9a4702d Fix MSVC warning.
Introduced in 592453c62f.

Differential Revision: https://code.wildfiregames.com/D3815
This was SVN commit r25219.
2021-04-09 08:13:14 +00:00
76acc4e146 Implement quality levels for actors & corresponding setting.
An actor file, as referenced by the VisualActor, can now define
different actors for different "quality level" setting.
In this initial version, the quality is handled directly by the object
manager.

Actor format impact:
- '<qualitylevels>' may be used as the root node, containing actor nodes
as children.
  - such actor nodes can refer to a file, or to an inline actor, or
simply be inlined.
  - such actor nodes may have a 'quality' attribute, specifying the
maximum quality level of this actor. By default, 255 (the maximum) is
implied.
- The actor format remains valid, but 'groups', 'variants', 'material',
'castshadow' and 'float' can be given a [minquality, maxquality[ range
via XML attributes. Outside of this range, the XML node is ignored
(making it possible to define, in a single actor file, several quality
levels).

Quality is a 0-255 value, with:
- Range 0-99 intended for lower level-of-detail actors (billboards,
etc.)
- Range 100-200 the 'normal' range for models. 100 is "low", 150
"medium", and 200 "high".
- Range 201-255 used for higher quality actors that might be used for
e.g. cinematics.
The range is wide to make it easier to add intermediate levels in the
future and it seemed easier given that an integer value of some kind was
required anyways.

Engine impacts:
- A new CActorDef class is introduced, wrapping an art/actors XML file
and its different quality levels. ObjectBase remains the definition of a
given 'actor', now at a given quality level.
- CActorDef imposes a maximal # of quality level for a particular actor
definition (5 currently).
- CUnit is made to refer to an Actor Definition explicitly, not a
particular ObjectBase.
- As a minor optimisation, variation keys are calculated on
pointer-to-sets-of-selections, instead of raw sets-of-selections, as
this reduces copying.
- some refactoring, including better const-correctness and hotloading
support via std::shared_ptr.

Differential Revision: https://code.wildfiregames.com/D3787
This was SVN commit r25210.
2021-04-08 07:22:24 +00:00
48d6b84c62 Fix initial animation sync.
UpdateAnimationID → PickAnimationID

Reviewed by: @wraitii
Differential Revision: https://code.wildfiregames.com/D3747
This was SVN commit r25205.
2021-04-07 08:35:02 +00:00
80f354a125 Fix nopch / tiny hotkey optimisation
Swap an std::set for an std::vector, the set was useful only in an
earlier iteration of the diff. This fixes nopch.

Differential Revision: https://code.wildfiregames.com/D3790
This was SVN commit r25195.
2021-04-06 12:26:34 +00:00
93d22ef16b Allow to specify subunits on creation.
This basically does two things:
- Allow turrets on moving entities (fixes serialisation in cmpPos).
- Allow an entity to be present on another when the other is created.

That makes it basically a boiled down version of a prior patch, omitting
the part where orders could be passed on.
This does allow e.g. ranged units on chariots that fire while the
chariot moves.

Original diff by: @sanderd17
Redone by: @Stan
Differential revision: D1958
Comments by: @Alexandermb, @Angen, @bb, @Langbart, @Nescio, @Stan,
@wraitii
Refs. #2577 by implementing the entity on platform case.

This was SVN commit r25192.
2021-04-05 05:22:25 +00:00
7032a3c12a Further hotkey work: clear hotkeys when an input box/the console gets focus.
This is necessary following 2d53308e1b, which now handles key-up in
input to prevent hotkeys from firing then.
Hotkeys are a global system, which means opening e.g. the chat window or
the summary does't reset things. If you press "S" to scroll the in-game
camera down, then press 'return' to open the chat, the camera keeps
scrolling down. Following 2d53308e1b, it never released since it never
got the keyup.

To handle this nicely, we need to explicitly clear hotkeys when input
boxes get focus (respectively the console).

Differential Revision: https://code.wildfiregames.com/D3797
This was SVN commit r25186.
2021-04-03 20:12:40 +00:00
52e8a0c5fb Fix chasing after Motion Manager & Pushing.
The motion manager introduced in bae258f9a1 makes 'chasing' (e.g. an
entity targeting another entity, which also applies to fleeing)
behaviour symmetrical: both units see the initial state instead of it
being ID-dependent.
This allows removing hacks introduced in 6a66fb8205 (and refined in
7b88b1a0f9).

Differential Revision: https://code.wildfiregames.com/D3785
This was SVN commit r25185.
2021-04-03 07:00:58 +00:00
592453c62f Add a simple 'pushing' logic to unit motion to improve movement.
This implements a form of crowd movement that I've generally called
'unit pushing' in the last few years.
Essentially, any two units will push each other away when they're too
close. This makes it possible to ignore unit-unit obstructions, and thus
makes movement much smoother in crowds.
This first iteration of this system only allows pushing between idle
units and between moving units (i.e. a moving unit does not affect an
idle one).
This is because the unitMotion logic to detect it is stuck & needs to
use the pathfinders starts breaking: units can fail to move because they
are pushed away from their intended movement, and the current logic
fails to handle this gracefully.
Thankfully, the most value of this patch in terms of player experience
is found in the improvements to group movements and shuttling.

Other impacts:
- As the short pathfinder is called less often, we can increase the
starting search range & reduce the # of max turns, both improving
collision recovery.
- The performance of idle units is slightly worsened, as they must be
checked for idle-idle collisions. If needed a 'sleeping' system, as used
in physics engine, could be implemented.
- In general, however, expect slight performance improvements, as fewer
short paths are computed.
- Gathering efficiency should increase slightly, since shuttling times
are likely reduced slightly.
- As a sanity change to improve some edge cases (units that say they're
moving, i.e. pushable, but don't actually move), the 'going straight'
logic is turned off if a short path has been computed. This requires a
few cascading changes to work correctly.

Technical notes:
- To reduce the cost of the n^2 comparisons that pushing requires, units
are only compared within a small square on a grid which is lazily
reconstructed each turn. The overhead seems rather small, and this is
much simpler than keeping an up-to-date grid.
- The design is intended to be parallelisable if needed someday.
- The pathfinder's CheckMovement ignores moving units in UnitMotion, as
that is now the spec. Idle units are not ignored, which is required for
the 'collision' detection to work correctly (see above).

Refs #3442 (not fixed - idle units are not pushed by moving units).
Fixes #5084 (the overlap can still happen, but units will push each
other away).

Differential Revision: https://code.wildfiregames.com/D1490
This was SVN commit r25182.
2021-04-02 16:30:59 +00:00
8ed1bc2fd1 Don't error in the network delay notifier.
Differential Revision: https://code.wildfiregames.com/D3788
This was SVN commit r25181.
2021-04-02 14:20:37 +00:00
2d53308e1b Fix console not preventing hotkeys from firing / Clean up hotkey-input conflict.
- Fix mistake in 4b46c09222 (similar to one in a4852c4c01) that allowed
hotkeys to fire while typing in the console.
- Prevent Alt+key to fire hotkeys in input boxes & console as that is
often text input.
- Split the hotkey triggering logic in two: a preparatory phase & an
actual firing phase.
This allows the GUI code to check which hotkeys are about to fire and
selectively allow them to go through. This makes it easier to change
hardcoded hotkeys, such as the console toggling one.

Differential Revision: https://code.wildfiregames.com/D3786
This was SVN commit r25180.
2021-04-02 14:18:20 +00:00
0232c0d017 Fix 4b46c09222 - Mouse wheel hotkeys behaving erratically.
Mouse wheel hotkeys behave differently from other hotkeys (mouse
button/keys) in that they are transient: they're always pressed/released
in one go.
As such:
- They shouldn't be added to the stored pressedHotkeys
- They shouldn't be added to active scancodes.

This fixes these issues from 4b46c09222 & also skips un-necessary
processing in those cases.

Reported by: Imarok.
Differential Revision: https://code.wildfiregames.com/D3782
This was SVN commit r25176.
2021-04-01 14:51:22 +00:00
1b5ed5063f Cleanups CGUISprite, removes redundant method.
This was SVN commit r25172.
2021-03-31 19:26:05 +00:00
b55b236379 Remember OOS on a per-client basis.
Change the OOS notification logic to remember the OOS-ness of each
client. Reset it on client leave.
The server will thus continue checking for OOS if the OOS-client leaves.
This is convenient to ignore observer OOS, or wait for an OOS player
without restarting the game.

Also add the turn number to the OOS dump, to fix #3348: particularly
following d4c2cf4430 the turn is likely to not be the same between
different clients.

Agree by: asterix
Differential Revision: https://code.wildfiregames.com/D3753
This was SVN commit r25170.
2021-03-31 15:55:19 +00:00
4b46c09222 Do not trigger "HotkeyPress" events when releasing a key.
Follows d0a42f2f00.
Because only the most specific hotkeys can be active at any time,
releasing a key may require re-activating less specific hotkeys.
There were two issues with this behaviour:
- It was buggy, as it only checked one active key, when any still active
key can trigger hotkeys.
- "HotkeyPress" and "HotkeyDown" events where sent, as if the hotkey was
pressed, which was unexpected for most code/users (it is unusual to have
a "Press" event on key release).

This fixes these issues by "silently" re-triggering the hotkeys in such
a case. It also makes it easier for JS code to use "hotkeyPress" instead
of "hotkeyDown" for non-continuous behaviour.

Accepted By: nani
Fixes #6123
Refs #6064 (fixes the problem, but not the code weirdness)

Differential Revision: https://code.wildfiregames.com/D3766
This was SVN commit r25169.
2021-03-31 15:50:25 +00:00
742b636f70 Moves CRect from ps to maths to related geometric primitives.
This was SVN commit r25165.
2021-03-30 21:14:36 +00:00
649cc49f25 Fix off-by-one error in d8ea401a95.
d8ea401a95 replaced the ExploreTerritories logic, but I did not account
for the territory grid being N cells wide when the LOS is N+1.
Therefore, we could get out of bounds.

Reported by: Vladislavbelov
Differential Revision: https://code.wildfiregames.com/D3765
This was SVN commit r25161.
2021-03-30 07:11:44 +00:00
c56c856ed5 Moves Frustum from graphics to maths to more related geometric primitives like bounding ones.
This was SVN commit r25159.
2021-03-29 17:28:13 +00:00
4f83f1a0e9 Cleanups Frustum and removes access to members.
This was SVN commit r25158.
2021-03-29 17:15:29 +00:00
5ebf2020b0 Netcode: allow observers to lag behind the live game.
Observers no longer lag the game for players. There is still some time
to serialise the game when sending it to a joining observer, and
depending on the chosen 'max lag' the game may stop while observers
sufficiently catch up, but this impact too is reduced.

- Make the NetServerTurnManager ignore players marked as 'observers' for
the purpose of ending a turn, effectively making it possible for
observers to lag without it affecting the players in any way.
- Add a config option (network.observermaxlag) that specifies how many
turns behind the live game observers are allowed to be. Default to 10
turns, or 2 seconds, to keep them 'largely live'.
- The controller is not treated as an observer.
- Implement a simple UI to show this delay & allow the game to speed up
automatically to try and catch up. This can be deactivated via
network.autocatchup.
- Move network options to the renamed 'Network / Lobby' options page.
- Do not debug_warn/crash when receiving commands from the past -
instead warn and carry on, to avoid DOS and "coop play" issues.

Refs #5903, Refs #4210

Differential Revision: https://code.wildfiregames.com/D3737
This was SVN commit r25156.
2021-03-29 07:53:06 +00:00
969112b9c8 Replaces CPos by more a consistent CVector2D, reduces geometry code duplication.
Tested By: Freagarach, Langbart
Differential Revision: https://code.wildfiregames.com/D3759
This was SVN commit r25152.
2021-03-28 21:55:13 +00:00
0e7fafebe1 Refuse to serialize NaN values.
NaN values could not be serialised safely because of the multiple
possible NaN numbers.
Since NaN values are usually the result of bugs or dangerous code, it
seems simpler to refuse to serialise them.

(D3205 was a safe-serialization alternative, should the need arise).

Fixes #1879

Differential Revision: https://code.wildfiregames.com/D3729
This was SVN commit r25151.
2021-03-28 16:48:25 +00:00
f6a2d6da63 Fix degenerate case in UnitMotion resulting in lag.
9d82ae15af introduced logic to extend the search range of the short
pathfinder in some situations. This extension was unbounded, resulting
occasionally in search domains several hundred meters wide, and path
computation that can take several seconds.

Reported by: Vico (on the forums).
Differential Revision: https://code.wildfiregames.com/D3760
This was SVN commit r25150.
2021-03-28 13:12:51 +00:00
b477892440 Fix issues in 87a2c3347f
Fixes 87a2c3347f:
- NoPCH was broken
- two warnings slipped through.

Differential Revision: https://code.wildfiregames.com/D3751
This was SVN commit r25147.
2021-03-28 07:01:34 +00:00
d533084d7c Removes unused code from Size2D and changes eol-style to native.
This was SVN commit r25144.
2021-03-27 21:11:36 +00:00
db84c2a9b2 Moves CSize into a separate file and renames it to CSize2D according to other geometric entities.
This was SVN commit r25143.
2021-03-27 16:08:06 +00:00
fa3e501f8f Makes EAlign more consistent with other enums by CC.
This was SVN commit r25142.
2021-03-27 12:07:38 +00:00
6332760528 Removes implicit default value operator for CGUIColor.
This was SVN commit r25141.
2021-03-27 11:47:49 +00:00
734b672569 Removes unused and limited cell sprite functionality.
Tested By: Freagarach
Differential Revision: https://code.wildfiregames.com/D3749
This was SVN commit r25140.
2021-03-27 11:38:34 +00:00
d050c3377d Fix unit overlapping following bae258f9a1
Following bae258f9a1, all units moved, then all messages were sent. This
could result in units overlapping, which cannot be resolved without unit
pushing. Fixing this makes for a fairer comparison with the pushing
diff, so it seems worthwhile.

Differential Revision: https://code.wildfiregames.com/D3746
This was SVN commit r25126.
2021-03-26 16:49:59 +00:00
eac613b7bf Enforce tight coupling of CCmpUnitMotion/CCmpUnitMotionManager
bae258f9a1 implemented CCmpUnitMotionManager, which handles motion for
CCmpUnitMotion (as distinct from ICmpUnitMotion, the interface).
The tight coupling between these two components was awkward at the
interface level, leaking underlying implementation details.

This diff makes CmpUnitMotionManager explicitly manage CmpUnitMotion,
instead of any implementation of ICmpUnitMotion, and moves files around
as requir
ed.
This:
- Makes it impossible to accidentally try to have the wrong
IID_UnitMotion managed by the UnitMotionManager.
- Allows devirtualising the calls from the manager to UnitMotion itself
(and inlining, as they are compiled in the same TU).
- Cleans up the manager interface - MotionState is now part of
CCmpUnitMotionManager.
- Cleans up ICmpUnitMotion interface - no need to provide a private
interface for the manager.

Differential Revision: https://code.wildfiregames.com/D3732
This was SVN commit r25125.
2021-03-26 16:47:07 +00:00
39c8e7f1a2 Cleanups ShadowMap, fixes possibly wrong depth format name for GLES.
This was SVN commit r25117.
2021-03-25 12:09:56 +00:00
4e728bf68f Uses sky as a water reflection instead of a fixed color.
Differential Revision: https://code.wildfiregames.com/D3734
This was SVN commit r25114.
2021-03-24 16:40:03 +00:00
de02f9870c Make WxWidgets High-DPI aware / Upgrade WXWidgets to 3.1.4 on MacOS
Fixes issues on Big Sur with the development 0 A.D. (bundles were
working correctly because they are Low-DPI).

Thanks to @wik for investigations on High-DPI in WxWidgets.

Differential Revision: https://code.wildfiregames.com/D3326
This was SVN commit r25111.
2021-03-23 15:47:29 +00:00
1867b70d3a Properly unset the civilisation when unchecked in Atlas.
Previously, atlas would save the default value when the 'civilisation'
checkbox was unset.

Patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3725
This was SVN commit r25108.
2021-03-23 13:16:53 +00:00
87a2c3347f Make real directory paths on the VFS predictable (retry)
This is the same commit as 4bb31f084e, reverted in 5d1899785a. Noted
issues were fixed.

Partial revert/fix of 2f19cf86d3 and 2567fee329.

Before this diff, it was possible for a mod containing a cache/ or a
config/ folder to get written to incorrectly.
The issue is VFS can map multiple directories to one 'virtual' path, for
reading mods. However, writing data is problematic: which path to
choose?
The only viable solution is to use a path relative to the highest
priority directory encountered in the VFS path, or write paths could be
'hijacked' by lower-priority mods.

This fixes these issues by:
- Adding a new lookup mode ('Real-path') that explicitly picks the real
path relative to the highest-priority subdirectory in the VFS Path.
- Preventing overwriting a real directory with a lower priority one in
general.
- Revert c0c8132dd4's GetRealPath change, re-introducing the function as
GetOriginalPath.

This also cleans up some duplication that led to empty mod folders in
the user mod path, and cleans up loading the 'user' mod.
It also makes it explicit that a directory must be passed to Mount().

Note that the new 'realpath' lookup can still be somewhat complex with
many mount points at various hierarchy levels, but it is at least
predictable/deterministic without having to be careful about populating
order.

Fixes #2553

Differential Revision: https://code.wildfiregames.com/D3728
This was SVN commit r25107.
2021-03-23 12:46:59 +00:00
5d1899785a Revert 4bb31f084e
4bb31f084e led to an issue in windows-specific code not detected by the
tests. I'll debug later.

This was SVN commit r25105.
2021-03-22 19:52:07 +00:00
4bb31f084e Make real directory paths on the VFS predictable.
Partial revert/fix of 2f19cf86d3 and 2567fee329.

Before this diff, it was possible for a mod containing a cache/ or a
config/ folder to get written to incorrectly.
The issue is VFS can map multiple directories to one 'virtual' path, for
reading mods. However, writing data is problematic: which path to
choose?
The only viable solution is to use a path relative to the highest
priority directory encountered in the VFS path, or write paths could be
'hijacked' by lower-priority mods.

This fixes these issues by:
- Adding a new lookup mode ('Real-path') that explicitly picks the real
path relative to the highest-priority subdirectory in the VFS Path.
- Preventing overwriting a real directory with a lower priority one in
general.
- Revert c0c8132dd4's GetRealPath change, re-introducing the function as
GetOriginalPath.

This also cleans up some duplication that led to empty mod folders in
the user mod path, and cleans up loading the 'user' mod.

Note that the new 'realpath' lookup can still be somewhat complex with
many mount points at various hierarchy levels, but it is at least
predictable/deterministic without having to be careful about populating
order.

Fixes #2553

Differential Revision: https://code.wildfiregames.com/D3217
This was SVN commit r25104.
2021-03-22 18:49:42 +00:00
87fc52b780 MP: don't enforce game init attributes synchronization in PREGAME.
The NetServer stored a complete copy of the game Init Attributes, which
it sent to new clients on updates from the controller. This worked well,
but prevents incremental updates and other unrelated messages from being
sent.

This changes the system so that:
- in PREGAME state, the server does not update its copy of the game init
attributes
- the server forwards game setup messages from the controller to all
clients
- Joining clients get a full copy of the Settings, when joining, from
the controller (this is a js-driven behaviour - other situations might
not need do it).
- Make the StartNetworkGame message take a copy of the final init
attributes, to ensure synchronization (and simplify some logic).

In practice, this:
- makes it possible to send different types of gamesetup messages (this
introduces two: a regular update and the full 'initial-update' for new
clients).
- moves some C++ hardcoding into JS - here in essence the PREGAME server
state is now init-attributes-agnostic.
- does not change much for readiness control - the server already needed
to force a change at game start to set random elements.

Note that the loading page is currently still receiving the 'local' game
attributes, which assumes that all clients are correctly synchronized
(they should be).

Refs #3806, #3049

Differential Revision: https://code.wildfiregames.com/D3714
This was SVN commit r25099.
2021-03-22 10:13:27 +00:00
c4d5729c73 Adds basic tests for BuildCameraRay and uses viewport instead of renderer for width and height.
This was SVN commit r25085.
2021-03-19 17:39:34 +00:00
76c5263607 Rename GameAttributes to InitAttributes
The initial settings for a game, used to create the map in RM & tosetup
the simulation, are named InitAttributes in the C++, but generally
referred to as GameAttributes in the JS GUI. This renames the latter to
the former to avoid confusion, since these settings are immutable once
the map starts, so InitAttributes is more accurate.

Differential Revision: https://code.wildfiregames.com/D3705
This was SVN commit r25083.
2021-03-19 10:02:10 +00:00
961ac314ad Fix issues with motionManager / bae258f9a1
Fixes bae258f9a1.

As reported by Freagarach, garrisoned units trigger error messages.
As reported by Vladislavbelov, noPCH was broken & there were some style
issues.


Differential Revision: https://code.wildfiregames.com/D3707
This was SVN commit r25078.
2021-03-18 16:40:34 +00:00
92f94e25c6 Adds ortho projection type and its test.
This was SVN commit r25073.
2021-03-17 23:03:35 +00:00
e7612e8fed Update UnitMotion comment following d4c2cf4430
MP turns are now identical in length to SP turns.

This was SVN commit r25072.
2021-03-17 18:04:31 +00:00
bae258f9a1 Implement a Motion Manager around UnitMotion.
This new MotionManager handles movement for UnitMotion components (not
UnitMotionFlying).
This is a first step towards unit pushing, by giving a central place for
the relevant units to collide.

One important side-effect is that movement is effectively synchronous -
the positions are not actually updated until all units have moved for a
turn (refs 6a66fb8205).

As a side-effect, it's an optimisation: fewer messages are being sent
overall, which leads to a slight speedup (negligible without a lot of
units though).

This is a first step - ideally, the movement functions called from
UnitMotionManager would actually be moved there.

Differential Revision: https://code.wildfiregames.com/D3509
This was SVN commit r25071.
2021-03-17 17:04:51 +00:00
ae07dcb4ff Removes joystick from camera controller.
Differential Revision: https://code.wildfiregames.com/D3700
This was SVN commit r25070.
2021-03-17 16:28:48 +00:00
bc66700e11 Adds more detailed test for perspective camera projection and its corners in world space.
Cleanups CVector3D a little bit.

This was SVN commit r25066.
2021-03-16 22:42:29 +00:00
56047ac9fa Adds logs to CameraController for speed changes of camera scroll, rotate and zoom.
Patch By: nwtour
Differential Revision: https://code.wildfiregames.com/D3604
This was SVN commit r25045.
2021-03-12 20:57:33 +00:00
4d58b0729e Moves CreateDateTimeInstance from the public L10n header to its implementation.
This was SVN commit r25042.
2021-03-12 09:11:22 +00:00
d6ddc4f3ac Removes tinygettext from the L10n header.
Noticed By: nwtour
This was SVN commit r25041.
2021-03-12 08:51:50 +00:00
7376e43e06 Fix typos in log and warn messages
Patch by: LudovicRousseau
Refs: #6098

Differential Revision: https://code.wildfiregames.com/D3659
Differential Revision: https://code.wildfiregames.com/D3660
This was SVN commit r25033.
2021-03-10 16:50:15 +00:00
839cd0ec12 Update the replay cache to consider modification time.
This makes the cache work consistently if replays are changed
externally.

Patch by: nwtour
Differential Revision: https://code.wildfiregames.com/D3615
This was SVN commit r25026.
2021-03-07 08:55:27 +00:00
3b3a297cca Fix checkrefs following D11 / 1c9efa6fb5
Fixes D11 / 1c9efa6fb5.

The problem is that some GUI pages were simply named "page.xml" which
the regex didn't like.

Accepted By: Nescio
Differential Revision: https://code.wildfiregames.com/D3644
This was SVN commit r25022.
2021-03-06 13:57:11 +00:00
76af18b23a Removes deprecated gl_*Matrix builtins from GLSL shaders.
Tested By: Freagarach, Stan
Differential Revision: https://code.wildfiregames.com/D3635
This was SVN commit r25018.
2021-03-05 22:32:32 +00:00
373b8b6ff1 Fix 4b7b9325ac - idle units are frozen in walk anim.
Fixes 4b7b9325ac

Differential Revision: https://code.wildfiregames.com/D3640
This was SVN commit r25017.
2021-03-05 18:34:06 +00:00
2be7479265 Fix quickloading/quicksaving following d4c2cf4430
Fixes d4c2cf4430.

Differential Revision: https://code.wildfiregames.com/D3636
This was SVN commit r25016.
2021-03-05 13:36:27 +00:00
4b7b9325ac Fix a rare case of unit 'gliding' while moving.
Fixes a1dc9cadd8: if the speed doesn't change, UnitMotion doesn't update
the visual actor. Unfortunately, if another component has in the
meantime reset the animation to 'Idle', the unit will now move while
Idle. This can happen when leaving formation to do something else,
though it'srare.

This fixes that by instead always calling VisualActor, which does its
own checking to avoid redundancy. It's a bit less efficient, but not too
much.
Note that this relies on UnitMotion::UpdateMovementState being called
after any UnitAI code that could reset the animation to IDLE.

Differential Revision: https://code.wildfiregames.com/D3619
This was SVN commit r25011.
2021-03-04 18:32:48 +00:00
765a40ac5c Fix compilation with --without-audio
Compilation --without-audio was broken since D3108 / 876f6d5e50

Patch by: nwtour
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D3631
This was SVN commit r25009.
2021-03-04 17:36:24 +00:00
40399011f7 Fixes revealed missed include after e104b41be2.
This was SVN commit r25008.
2021-03-04 08:55:49 +00:00
8fe9e420ee Fixes removed include after 2e4639e6dc.
This was SVN commit r25005.
2021-03-03 23:07:50 +00:00
2e4639e6dc Removes unused containers included in headers.
This was SVN commit r25004.
2021-03-03 23:01:08 +00:00
c29423c723 Fixes revealed missed includes after e104b41be2.
This was SVN commit r25003.
2021-03-03 22:38:59 +00:00
e104b41be2 Cleanups includes for cassert and streams.
This was SVN commit r25002.
2021-03-03 22:26:49 +00:00
d4c2cf4430 Increase MP Command delay to 4 turns, decrease MP turns to 200ms.
To hide network latency, MP turns send commands not for the next turn
but N turns after that (introduced in c684c211a2).
Further, MP turn length was increased to 500ms compared to 200ms SP
turns (introduced in 6a15b78c98).
Unfortunately, increasing MP turn length has negative consequences:
- makes pathfinding/unit motion much worse & unit behaviour worse in
general.
- makes the game more 'lag-spikey', since computations are done less
often, but thus then can take more time.

This diff essentially reverts 6a15b78c98, instead increasing
COMMAND_DELAY from 2 to 4 in MP. This:
- Reduces the 'inherent command lag' in MP from 1000ms to 800ms
- Increases the lag range at which MP will run smoothtly from 500ms to
600ms
- makes SP and MP turns behave identically again, removing the
hindrances described above.

As a side effect, single-player was not actually using COMMAND_DELAY,
this is now done (can be used to simulate MP command lag).

Refs #3752

Differential Revision: https://code.wildfiregames.com/D3275
This was SVN commit r25001.
2021-03-03 21:02:57 +00:00
1c7f2661ce Add missing file in previous commit.
This was SVN commit r24996.
2021-03-03 15:18:44 +00:00