1
0
forked from 0ad/0ad
Commit Graph

6914 Commits

Author SHA1 Message Date
f42d97c6f3 Fix some animals "roaming" state not working correctly (units seem stuck in place)
Due to an issue in 4a15cc3b9f, animals incorrectly tried going towards
the roaming point instead of away from it.

With that fixed, MovementUpdate still did not trigger as the min and max
range were the same.
Use -1 as max range (= infinite) instead since we want to move
arbitrarily away.

Having an infinite max range was broken in c219ee54b2, this
re-implements that.

Further, other calls with equal min and max range have been changed
likewise.

This does not entirely fix whales, which run in other problems because
of their large roaming range.

Differential Revision: https://code.wildfiregames.com/D1980
This was SVN commit r22413.
2019-06-30 18:53:25 +00:00
6cde90104a Update precompiled win32 libogg to 1.3.3 and libvorbis to 1.3.6, building them with VS2015, refs #5379.
Use the default naming for both libraries (libvorbis instead of vorbis),
and use our default suffix for debug versions of the libs.

This was SVN commit r22406.
2019-06-27 22:36:04 +00:00
8babfe2330 Refactors camera projections - makes projection functions of camera more clear.
Reviewed By: elexis
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D2012
This was SVN commit r22404.
2019-06-26 22:54:05 +00:00
ec4d84c72f Removes unused and obsolete LightingModel.
It was introduced in d295dacb9b as a way to control behavior of shaders.
Its usage in shaders was completely removed in 05008d190e (before that
in b7888aea52).

Reviewed By: elexis
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D2011
This was SVN commit r22403.
2019-06-26 22:30:23 +00:00
3b77a0fba1 Update the minimap, range overlay renderer, and status bars when a player's color is changed in Atlas.
These were missing from 343ec21e75.

Patch By: temple
Differential Revision: https://code.wildfiregames.com/D1261
This was SVN commit r22402.
2019-06-26 19:16:57 +00:00
844462b0c0 #5445
This was SVN commit r22397.
2019-06-25 05:05:06 +00:00
61db02790c Fix cppformat failures on MacOS tests.
cppformat tests failed on MacOS - the global locale was not set and
defaulted to something unexcpeted.
It is now fixed to US notation.

Patch By: Krinkle
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1978
This was SVN commit r22378.
2019-06-16 15:25:17 +00:00
d1fb66d2a7 Cleanups BoundingBoxAxisAligned and fixes coding styles a bit.
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1951
This was SVN commit r22372.
2019-06-12 20:23:14 +00:00
3e53d05298 Fixes includes and forward declarations in CPatchRData.
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1952
This was SVN commit r22371.
2019-06-12 20:03:22 +00:00
98f609df1d UnitMotion - Change "Possibly At Destination" logic.
UnitMotion will now send hints that a move may be completed if:
- it is a formation member and the formation member has stopped moving.
- it isn't and it is in range from its target.

Differential Revision: https://code.wildfiregames.com/D1899
This was SVN commit r22366.
2019-06-11 19:52:40 +00:00
8ac104b07a Fix 'gliding' behaviour at the end of movement by moving the PossiblyAtDestination check earlier.
Units in 0 A.D. exhibited a "gliding" behaviour at the end of a
movement, e.g. they switched to the Idle animation and still moved a
little bit.

The reason for this behaviour is that entities check if they reached
their destination after moving. Other components (unitAI mostly) will
then possibly change animations and such, resulting in a movement over
the turn while the entity is possibly now in another animation state
than "move".
Instead, what should be done is checking if the entity has arrived
before moving, so if UnitAI calls StopMoving, then entity won't move at
all on the same turn, and the gliding effect vanishes.

The STATE_STOPPING state is made un-necessary by this change, since this
off-by-one mistake was the reason for its existence. It can be removed
(see downstream).

Differential Revision: https://code.wildfiregames.com/D1898
This was SVN commit r22365.
2019-06-11 18:51:55 +00:00
f04bdd84ae UnitMotion - Split Move() into several functions
Move() is generally 4 parts:
- Moving
- Updating our state
- Handling obstructed moves
- Checking if we are at destination.

These can all be put in their own functions, clarifying logic and making
it harder to make mistakes.

Differential Revision: https://code.wildfiregames.com/D1897
This was SVN commit r22364.
2019-06-11 17:25:59 +00:00
ad4594e55d UnitMotion - move TryGoingStraight before the core of the 'Move' logic
In preparation for D1897, this logic isn't related to the "movement"
part of Move(), and can be called earlier.

Differential Revision: https://code.wildfiregames.com/D1896
This was SVN commit r22363.
2019-06-10 19:35:02 +00:00
36341b5d6c UnitMotion - Handle obstruction moving flag similarly to m_CurSpeed
The obstruction manager keeps a flag of moving units. This should be
updated in the same location as the entity's current speed, since they
have similar properties.

Differential Revision: https://code.wildfiregames.com/D1895
This was SVN commit r22362.
2019-06-10 19:33:24 +00:00
1adf9560b8 Unit Motion - update our current speed even when we have not moved.
VisualActor refers to unit motion's `m_CurSpeed` to know what animation
to display in the special walk mode. However that variable was
inconsistently updated. By making sure we reach that codepath in one
place, we remove opportunities for issues.

This should fix most existing instances of moonwalking, another upstream
diff will fix the rest.

Differential Revision: https://code.wildfiregames.com/D1894
This was SVN commit r22361.
2019-06-10 18:27:27 +00:00
017cb504ee Drop an indentation level in UnitMotion.
This will simplify later changes.

Differential Revision: https://code.wildfiregames.com/D1893
This was SVN commit r22360.
2019-06-10 17:15:27 +00:00
70e22e2923 Unit Motion - Face point when calling StopMoving()
FacePointAfterMoving intends for the unit to face the destination once a
move is done. Since 4fda917f46, stopping is the responsibility of UnitAI
(through a call to StopMoving()). Thus we should move that code in that
function, as this ensures we don't forget to do it and removes
duplications.

Differential Revision: https://code.wildfiregames.com/D1889
This was SVN commit r22355.
2019-06-09 17:06:24 +00:00
f2db913a7d Unit Motion - remove the m_Moving variable
The variable is not necessary since having a target is equivalent,
removing it thus reduces redundant state.

Differential Revision: https://code.wildfiregames.com/D1888
This was SVN commit r22354.
2019-06-09 17:04:18 +00:00
4a15cc3b9f Unit Motion - wrap target state into a struct
These variables together held the state for the target of UnitMotion, as
set by the MoveTo[X] family of functions.
Wrapping them in a struct reduces the chances that one will accidentally
forget to reset part of the state and makes it explicit in-code that
these are grouped together.

Calling StopMoving() resets this target, which wasn't before and left
the component in an incoherent state.

Differential Revision: https://code.wildfiregames.com/D1887
This was SVN commit r22352.
2019-06-09 11:18:06 +00:00
4fda917f46 Prevent UnitMotion from stopping on its own, and rename "MoveCompleted" to "MovementUpdate"
UnitAI is now solely in charge of moving and stopping, making UnitMotion
behaviour easier to predict, which will ultimately help with unitAI
development. It might temporarily make units more resilient than before
however.

UnitMotion also tells UnitAI that it's arrived with "MoveCompleted"
messages, but these actually could be wrong - unitAI could decide that
we didn't want to stop after all - so change the name for something less
misleading.

Differential Revision: https://code.wildfiregames.com/D1886
This was SVN commit r22351.
2019-06-09 11:16:40 +00:00
27b686215a Remove "MoveStarted" messages
"MoveStarted" messages were sent by UnitMotion when the unit started
moving (sort of) or failed to do so. This was used by formations and
guarding but was not really necessary as this can be done in "enter" or
in a timer.

Differential Revision: https://code.wildfiregames.com/D1885
This was SVN commit r22350.
2019-06-08 12:53:28 +00:00
c219ee54b2 Move "IsInRange" family of functions to the Obstruction Manager and make the commutative.
These functions were placed in UnitMotion, which had nothing to do with
range checks and made them available only to moving entities for no
particular reason.

This patch also adds support for square-square range checks and
shape-shape distance checks.

Modified from a patch by bb on top of work from wraitii.

Differential Revision: https://code.wildfiregames.com/D981
This was SVN commit r22345.
2019-06-06 19:37:23 +00:00
ba736916fc Clean up ThreadUtil, use standard C++11 constructs instead of custom ones.
ThreadUtil shipped a scope lock and a mutex implementation, which can be
removed since we now have these in the standard library.
This lets us clean up this header which get included everywhere (through
profiler includes).

Tested By: Angen and Stan
Differential Revision: https://code.wildfiregames.com/D1915
This was SVN commit r22344.
2019-06-06 19:30:48 +00:00
70ccc3e5cb Adds Camera test for ortho projection.
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1948
This was SVN commit r22340.
2019-06-05 19:55:37 +00:00
dd67d0769e Resolve issues with 0c20afdfda - unitAI order cleanup and unitMotion MoveTo change
0c20afdfda had two issues:
- some of the unitAI code did not return true when switching states in
the "enter" phase
- missed a return false in unitMotion.cpp

This fixes the issue noticed by @bb.

Differential Revision: https://code.wildfiregames.com/D1947
This was SVN commit r22339.
2019-06-05 17:27:12 +00:00
37e5097ea9 Fix a m_JumpPointCache assertion failure in debug mode, refs fa726867f1.
Patch By: Stan
Comments By: wraitii
Differential Revision: https://code.wildfiregames.com/D1942
This was SVN commit r22336.
2019-06-04 08:29:47 +00:00
800bf0da24 Improve UTF-8 character handling in Atlas
(Also prevents the compile-time warnings reported in the abandoned
D1432)

Accepted by: Itms
Patch linting by: Stan, Vladislav, wraitii
Also tested by: Imarok
Fixes: #4936
Differential Revision: https://code.wildfiregames.com/D1395
This was SVN commit r22335.
2019-06-03 20:19:53 +00:00
4b65cc0317 Fixes a typo introduced in cb048b4738 in shore calculations, found by Angen and fixes style notes by elexis.
Reviewed By: Angen
Differential Revision: https://code.wildfiregames.com/D1949
This was SVN commit r22334.
2019-06-03 20:19:18 +00:00
f4194df416 Removes unused variable from ModelRenderer introduced in 6bc33fe8bd. Found by Angen.
Patch By: Angen
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1812
This was SVN commit r22333.
2019-06-03 20:06:01 +00:00
ddcdc643ba Further cleanup of MikkTSpace
- Move the * and & to the correct side,
- Add .0 and  0.f to clearly mark the types
- Pass pointers instead of arrays
- Add a newline after forward declaration
- Add spaces between operators
- Use c++ cast

Reviewed by: @vladislavbelov
Differential Revision: https://code.wildfiregames.com/D1934
This was SVN commit r22323.
2019-05-30 23:03:01 +00:00
2cf1f85d7e Fixes tests compilation after ebfec91057. Found by Angen.
Reviewed By: Angen
Differential Revision: https://code.wildfiregames.com/D1937
This was SVN commit r22321.
2019-05-30 17:27:55 +00:00
ebfec91057 Adds Camera test for frustum.
Reviewed By: wraitii
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D1927
This was SVN commit r22319.
2019-05-29 20:12:41 +00:00
39720041f7 Cleanup MikktspaceWrapper.
Reviewed by: @Angen
Differential Revision: https://code.wildfiregames.com/D1872
This was SVN commit r22316.
2019-05-28 22:06:29 +00:00
ca9109be75 Fix a crash on some system when Alt-tabbing during game setup.
Move checks for rendering a frame in Render() to avoid missing calls to
this functions, which can crash on certain systems.

Move the sound manager's idle task out of Render().
Move the buffer swapping in Render() since we do not need to swap
buffers unless we are rendering.

Patch By: Angen
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1495
This was SVN commit r22314.
2019-05-28 13:18:32 +00:00
0c20afdfda Unit Motion: MoveTo family of function no longer returns false if the move is un-necessary, instead unitAI checks explicitly.
This also moves the actual "moving" code to states instead of orders,
making states more self-contained and removing the change of errors when
cleaning up a state.

Differential Revision: https://code.wildfiregames.com/D1865
This was SVN commit r22313.
2019-05-28 11:38:18 +00:00
e2233a4a90 Don't clear pathnames in vfs::GetPathnames so it can be called several times.
Differential Revision: https://code.wildfiregames.com/D1914
This was SVN commit r22312.
2019-05-28 10:18:04 +00:00
12f893b1e3 Remove 'Async' from short/long path requests names
Having Async in the name was not really informative and made it awkward
to reuse for non-async code.

Reviewed By: Kuba386
Differential Revision: https://code.wildfiregames.com/D1854
This was SVN commit r22305.
2019-05-26 13:47:41 +00:00
65fcd66556 Update precompiled headers to improve build times.
Expect a 10-25% build time improvement.

Original Patch By: Angen
Reviewed By: Angen
References #5038

Differential Revision: https://code.wildfiregames.com/D1333
This was SVN commit r22303.
2019-05-26 07:21:12 +00:00
9ea68317ad Use pkg-config where possible instead of hard-coding or library-specific programs
Accepted by: Itms, wraitii
Previously tested by: andy5995
Fixes: #5157
Refs: D1582
Differential Revision: https://code.wildfiregames.com/D1611
This was SVN commit r22302.
2019-05-25 18:00:40 +00:00
220449ea9a JPS - make the JPC cache usable again (98f4ed6cb8 fix)
Reviewed By: Itms
Differential Revision: https://code.wildfiregames.com/D1875
This was SVN commit r22301.
2019-05-25 16:01:44 +00:00
537a141867 Early-exit when destroying invalid entities (INVALID_ENTITY, already destroyed…)
Destroying INVALID_ENTITY is valid and should do nothing.

The current code will send MT_Destroy messages when doing this, which is
un-necessary work and feels kind of broken to me.
Early-exit instead.

Reviewed By: Itms
Differential Revision: https://code.wildfiregames.com/D1736
This was SVN commit r22300.
2019-05-25 15:59:43 +00:00
94e0856485 ShouldConsiderOurselvesAtDestination renamed to CloseEnoughFromDestinationToStop and stateful effects moved at the caller.
It improves readability of the code when a function that seems like it
does a simple check actually only does a simple check and the caller is
the one changing state.

Differential Revision: https://code.wildfiregames.com/D1884
This was SVN commit r22299.
2019-05-25 13:23:44 +00:00
01a8138780 Water GLSL shader improvements around reflections and whitespace fixes.
This improves refractions around entities close to the surface, such as
fishes, by handling depth better and by clipping the water plane a
little lower.

This uses the skybox for reflections when refractions are enabled but
reflections are disabled, making it possible to play with reflections
disabled without having super-ugly water (arguably a performance
improvement).

Differential Revision: https://code.wildfiregames.com/D359
This was SVN commit r22297.
2019-05-25 11:08:57 +00:00
dc34d9c5d0 Fix possibly using uninitialized global in 80635665f7 and rename GetDirectoryName
Reviewed by: weberkai
Fixes: #4789
Differential Revision: https://code.wildfiregames.com/D1852
This was SVN commit r22284.
2019-05-14 10:13:02 +00:00
621bb1367a [CChart] Add a percentage format and round displayed integers
Reviewed by: bb
Approved by: Vladislav
Differential Revision: https://code.wildfiregames.com/D1878
This was SVN commit r22282.
2019-05-13 21:23:26 +00:00
795e414663 Hierarchical pathfinder: Speed up edge update
Speed up edge update by being clever, only updating dirty tiles instead
of everything (effectively doing to "TODO be clever" here).

This is a substantial speed improvement when an update is necessary.

Differential Revision: https://code.wildfiregames.com/D1834
This was SVN commit r22279.
2019-05-13 17:02:16 +00:00
32b2c01c7c Decouple long and hierarchical pathfinders to an extent.
Following 809f297707, this decouples the hierarchical pathfinder and the
long pathfinder. The long pathfinder was the class owning the
hierarchical pathfinder, which didn't particularly make sense and
resulted in some interface awkwardness.

At the moment, the long pathfinder still needs to hierarchical
pathfinder to compute paths (to make sure they are reachable).

Differential Revision: https://code.wildfiregames.com/D1867
This was SVN commit r22278.
2019-05-13 16:58:00 +00:00
859d96fba5 UnitMotion - improve variable names and reuse a duplicated function (cleanup def47cb7ae)
This:
 - cleans up a code duplication and clarifies the intent.
 - reorders things around for clarity
 - improves variable names.

Commented By: elexis
Differential Revision: https://code.wildfiregames.com/D1840
This was SVN commit r22277.
2019-05-13 16:47:51 +00:00
809f297707 Move the Vertex Pathfinder to its own helper class
The vertex pathfinder was implemented directly in CCmpPathfinder,
instead of being a separate helper like the hierarchical pathfinder or
the long pathfinder.

This moves it to its own helper VertexPathfinder, which gets us ready
for D14 and pathfinder threading. Some struct definitions need to be
moved around.

Differential Revision: https://code.wildfiregames.com/D1855
This was SVN commit r22253.
2019-05-08 11:53:02 +00:00
b0f41952b8 Fix UnitMotion calculation of time left to avoid units going back and forth between walking and running animations.
Because of the limited precision of our fixed-point numbers, the
timeLeft calculation could sometimes return results above the actual
time left, resulting in units moving a few fixed::epsilons farther than
they should be, which makes them switch to the running animation. This
was rather unstable however, so there was a constant 'flickering'
between walking and running.
If we divide last instead of first in the operation, the errors get
gobbled up by the division and we no longer have this issue.

Reported by: wowgetoffyourcellphone
Differential Revision: https://code.wildfiregames.com/D1856
This was SVN commit r22249.
2019-05-04 15:53:46 +00:00