Commit Graph

19544 Commits

Author SHA1 Message Date
5568bd4c16 UnitMotion - Explicit handling of movement errors (such as target death) in Combat.Approaching
In A23, units that are approaching an enemy (Combat.Approaching) will
carry on moving to their last waypoint if the target dies, and then go
idle.
As of 69d3e76fd2, this no longer happens and units stop in their tracks,
staying in attacking forever.

This lets Combat.Approaching explicitly handle the error, deciding what
is best to do:
- go to the next order (for hunting and queued orders)
- find new targets nearby (in case the attack wasn't a forced order)
- walk to the target's last known position and find units to attack
there (in case it was). This is A23 behaviour.

Differential Revision: https://code.wildfiregames.com/D1992
This was SVN commit r22425.
2019-07-02 06:49:27 +00:00
ff9d162c8c Make sure states are exited if the movement update fails.
Differential Revision: https://code.wildfiregames.com/D1998
This was SVN commit r22423.
2019-07-01 19:51:21 +00:00
44aef27b78 Adapt unitMotion to edge-edge distance checks.
D981/c219ee54b2 changed IsInXChecks to use edge-to-edge distance instead
of centre-to-edge, which broke UnitMotion's min-range movement, which
assumed distance to the center.

Since units are represented as squares, the diagonal point may be closer
to the target than the "real" clearance by a factor √2, so the delta
between minimum range and maximum range should be at least `(√2 - 1) *
clearance` to be safe in all situations (this is generally not a problem
for regular units which have a clearance of 0.8, but could be one for
catapults or elephants).

Differential Revision: https://code.wildfiregames.com/D1969
This was SVN commit r22422.
2019-07-01 19:50:06 +00:00
d2c88acf44 Fix 3e43ddd869: s/target/this.gatheringTarget
Differential Revision: https://code.wildfiregames.com/D2032
This was SVN commit r22421.
2019-07-01 19:02:00 +00:00
bb
bdb742488a Cleanup UnitAI's FaceTowardsTarget function and allow units without a unitMotion in that.
Patch By: Freagarach
Differential Revision: https://code.wildfiregames.com/D2014
This was SVN commit r22420.
2019-07-01 12:32:57 +00:00
bb
3a77eb25d3 Fix ESLint semicolon-related warnings
Patch By: Krinkle
Differential Revision: https://code.wildfiregames.com/D2004
This was SVN commit r22419.
2019-07-01 11:09:19 +00:00
b20f357764 Don't use the opposite edge in UnitAI range checks.
For now, we use the nearest-edge to nearest-edge distance for min-range
checks (following much discussion on D981).
This was missed when committing it in c219ee54b2.

UnitMotion was already correctly not using opposite edge checks.

Differential Revision: https://code.wildfiregames.com/D2031
This was SVN commit r22416.
2019-06-30 19:05:04 +00:00
69d3e76fd2 Unit Motion - Stop when targets have an invalid position.
Previously, unitMotion had no code that checked particularly if the
target was still in the world.
When the target moved out of the world, unitMotion would follow the path
to its last known position, then send a "MoveSucceeded" message once
there.

Following 98f609df1d, this message was no longer sent. Thus unit would
follow their path to its last waypoint and stay there, unable to carry
on or finish the order. UnitMotion now explcitly sends a "MoveFailed"
message.

This still changes behaviour from A23, requiring further revisions to
UnitAI (see D1992 for one such case).

Minohaka tested an earlier version of this change (which incorporated
D1992) and accepted it.

Differential Revision: https://code.wildfiregames.com/D1979
This was SVN commit r22415.
2019-06-30 19:00:27 +00:00
3e43ddd869 Fix 0b41e8ee61, make units again properly hunt animals that died in FoW.
The reason was that the unit immediately tried gathering nearby instead
of going to the unit's last known position.

Related to D1997.

Differential Revision: https://code.wildfiregames.com/D1996
This was SVN commit r22414.
2019-06-30 18:55:26 +00:00
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
a7573ae911 Fix IsInjured overwrite in 56ed4c1dc8
Reported By: wowgetoffyourcellphone
Differential Revision: https://code.wildfiregames.com/D2027
This was SVN commit r22412.
2019-06-29 19:42:58 +00:00
56ed4c1dc8 Fix IsInjured call on miraged entities.
ea208f19a3 introduced an "IsInjured" function, used in the GUIInterface.
Mirages must mock this function and this was missed in the original
diff.

Tested By: wowgetoffyourcellphone
Differential Revision: https://code.wildfiregames.com/D2018
This was SVN commit r22411.
2019-06-29 17:17:07 +00:00
bb
445a5d8855 Clean up technologie data files:
- put modification each on an own line
 - space/tab correct
 - space correct objects
 - remove trailling 0's

Partially requested by: Stan
Patch By: Nescio
Differential Revision: https://code.wildfiregames.com/D1953
This was SVN commit r22408.
2019-06-28 15:58:21 +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
da13a6c734 Fix missing slash in common-api of entity. The mistype was introduced in c1e86161b5.
It wasn't found because it's not used at all. It was added in
07ea313ad6, and its usage was removed in 998dc21676.

Patch By: Angen
Differential Revision: https://code.wildfiregames.com/D1994
This was SVN commit r22401.
2019-06-26 18:04:33 +00:00
352ce9b41c Add the new keyword for BigTiger's maps.
Fixes 4ac8ea7989

This was SVN commit r22400.
2019-06-25 21:08:29 +00:00
fe2bb77e0f Skybox calculation - fix regression of 9376609ee8 introduced in 01a8138780
Audited By: vladislavbelov
Reviewed By: vladislavbelov
Differential Revision: https://code.wildfiregames.com/D1985
This was SVN commit r22399.
2019-06-25 19:23:57 +00:00
47256dca84 Add Krinkle to 0 A.D.'s programming credits
Reviewed By: Krinkle
Differential Revision: https://code.wildfiregames.com/D1990
This was SVN commit r22398.
2019-06-25 19:22:46 +00:00
844462b0c0 #5445
This was SVN commit r22397.
2019-06-25 05:05:06 +00:00
3573c87fc8 Makes rendering helpers (culling camera, frustums) be available through the developer overlay.
It helps to test/debug patches like D1847.

Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1972
This was SVN commit r22395.
2019-06-23 20:17:44 +00:00
98f6866814 Remove two duplicate textures and models. They were incorrectly added in 4981cdedad in the flow of new objects.
Noticed by: @elexis
This was SVN commit r22394.
2019-06-22 20:50:47 +00:00
abc0beb07d Teak, dragon bamboo, scaled down some baked normal and ao maps larger than the base map, minor edits to areca palm
This was SVN commit r22392.
2019-06-19 08:16:38 +00:00
1c4de428cb may have forgotten an actor file, also areca palms
This was SVN commit r22391.
2019-06-18 17:57:13 +00:00
b77336b491 bananas and strangler figs
This was SVN commit r22390.
2019-06-18 16:04:28 +00:00
6d0a91a886 Fix a little glitch on the Athenian storehouse.
Reported by: @vladislavbelov.
This was SVN commit r22389.
2019-06-18 12:14:54 +00:00
44d699b432 Remove three unused capes.
This was SVN commit r22388.
2019-06-18 09:34:15 +00:00
afca278486 Improve starting position camera for Oceanside (2)
Patch by: BigTiger
This was SVN commit r22387.
2019-06-17 22:34:41 +00:00
4ac8ea7989 3 New temperate maps by BigTiger.
This was SVN commit r22386.
2019-06-17 18:24:09 +00:00
0df4d130cf New particle actors by BigTiger.
This was SVN commit r22385.
2019-06-17 18:23:41 +00:00
1d841a71fe New terrain textures by BigTiger for the temperate biome.
This was SVN commit r22384.
2019-06-17 18:23:16 +00:00
4981cdedad New bushes, trees (Oaks, firs, Birch) by Big Tiger, as well as new cliffs, and decals.
This was SVN commit r22383.
2019-06-17 18:22:07 +00:00
4967d176b9 Define variables before mentioning them in scripted component tests, and add a linter rule for this.
Patch By: Krinkle
Differential Revision: https://code.wildfiregames.com/D1986
This was SVN commit r22380.
2019-06-16 20:48:28 +00:00
f4babd9b34 Wrap damage types in a Damage element in XML templates to prepare for genericizing them.
Patch By: Freagarach
Reviewed By: Wraitii
Differential Revision: https://code.wildfiregames.com/D1950
This was SVN commit r22379.
2019-06-16 17:08:27 +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
9e8a43401e fixed anomaly in doum palm
This was SVN commit r22377.
2019-06-15 19:43:22 +00:00
7a25c9e88e Holly oaks, fixing some weird normals on the atlas cedar, and a few edits to the quarry stone and texture maps I don't remember doing, but I can trust past me to have made good decisions, right?
This was SVN commit r22376.
2019-06-15 19:00:12 +00:00
190f8d3566 Calculate entity limit counts correctly when SpawnUnits fails in ProductionQueue.
When adding a batch of unit, these in-training units get added to the
production queue and to the entity limit count.
These in-training units need to be removed from the entity limit counts
when spawning them, or we would be double-counting them. This was done
when creating the cached entities, but this was too early: entities
might fail to spawn, for example when there is no room around the
foundation.

Change that so the entity limit count is now decremented right before
giving spawned entities the correct owner (which triggers EntityLimits
OnGlobalOwnershipChanged, which adds the spawned entities to the entity
limit count).

Additionally, add Init to TrainingRestrictions so that the test setup
doesn't complain. Other components have an empty Init instead of
checking for Init in the test setup (and 61/67 have an Init function) so
it seems more standard this way.


Reported By: elexis
Reviewed By: wraitii
Patch By: Angen
Tests By: wraitii
Differential Revision: https://code.wildfiregames.com/D1879
This was SVN commit r22375.
2019-06-15 17:27:24 +00:00
5992943f43 Fix resource-returning order sometimes not working correctly (introduced by 0c20afdfda)
Differential Revision: https://code.wildfiregames.com/D1975
This was SVN commit r22374.
2019-06-15 15:07:27 +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
2bcf4f678b Refactors Developer Overlay using an object instead of global functions.
Reviewed By: wraitii
Commented By: elexis
Differential Revision: https://code.wildfiregames.com/D1928
This was SVN commit r22370.
2019-06-12 19:21:44 +00:00
63e1c9ff1a Fix typo in 0b41e8ee61.
This was SVN commit r22368.
2019-06-11 20:09:40 +00:00
0b41e8ee61 Fix leftovers from 0c20afdfda - improve repairing, chasing and fleeing behaviour.
0c20afdfda made states more caller-independent but did not change some
callsites to be compatible with that. This fixes those.

This does not fix chasing entirely however since unitMotion does not
always recognize that the target moved enough that the entity will never
be in range.
This will be fixed upstream.

Differential Revision: https://code.wildfiregames.com/D1968
This was SVN commit r22367.
2019-06-11 20:06:25 +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