Commit Graph

24362 Commits

Author SHA1 Message Date
Paul Chote
6f5d035e79 Introduce IMouseBounds and split/rework mouse rectangles.
The render bounds for an actor now include the area covered
by bibs, shadows, and any other widgets. In many cases this
area is much larger than we really want to consider for
tooltips and mouse selection.

An optional Margin is added to Selectable to support cases
like infantry, where we want the mouse area of the actor
to be larger than the drawn selection box.
2017-12-11 19:45:07 +01:00
Paul Chote
8fcc80b05a Use IRender.ScreenBounds in ScreenMap.
Traits are now required to trigger a ScreenMap update whenever they
believe that their ScreenBounds have changed.
2017-12-11 19:45:07 +01:00
Paul Chote
fa65fef4d1 Add IRenderModifier.ModifyScreenBounds to support WithShadow. 2017-12-11 19:45:07 +01:00
Paul Chote
86bfe28ade Add ScreenBounds method to IRender interface.
This method is expected to return Rectangles that cover
the region where Renderables returned by Render may exist.
2017-12-11 19:45:07 +01:00
Paul Chote
46f6263061 Update ScreenMap state in a single pass at the end of the tick. 2017-12-11 19:45:07 +01:00
Paul Chote
373aaee004 Use World.(AddTo|RemoveFrom)Maps in Immobile/Building. 2017-12-11 19:45:07 +01:00
Paul Chote
9e18ec7314 Simplify ScreenMap bounds checking. 2017-12-11 19:45:07 +01:00
Paul Chote
cdc426d162 Add IActorPreview.ScreenBounds. 2017-12-11 19:45:07 +01:00
Paul Chote
29255c8e01 Add IModel.AggregateBounds and ModelAnimation.ScreenBounds.
The bounds define the smallest Rectangle that covers all
rotations of all frames within a model sequence.
2017-12-11 19:45:07 +01:00
Paul Chote
506b677527 Add ModelAnimation.IsVisible property. 2017-12-11 19:45:07 +01:00
Paul Chote
041431d966 Add ISpriteSequence.Bounds and Animation(WithOffset).ScreenBounds.
The bounds define the smallest Rectangle that covers all frames within a sequence.
2017-12-11 19:45:07 +01:00
reaperrr
85c5259361 Fix AI crashing when trying to make parachuted harvester search map for resources while mid-air 2017-12-11 01:55:18 +01:00
reaperrr
b5ffe17d60 Make AI skip harvester orders if map has no resources 2017-12-11 01:55:18 +01:00
reaperrr
9ad0d78cdd Make the AI only consider harvesters 'idle' if last resource search failed
Otherwise the AI would consider the harvester 'idle' in too many situations.
This way, the AI now only uses its own resource search algorithm if the next resource patch is too far away for the FindResources activity to find it.
2017-12-11 01:55:18 +01:00
reaperrr
4d553900cf Move up harv.IsEmpty check in HackyAI
This is a fairly cheap check, so we should perform it before the activity checks
2017-12-11 01:55:18 +01:00
RoosterDragon
70ffa99203 Fix some uses of Exts.IsTraitEnabled. 2017-12-11 01:46:41 +01:00
RoosterDragon
9241c0f8b7 Provide only one overload of IsTraitEnabled. 2017-12-11 01:46:41 +01:00
RoosterDragon
c75a866f0d Lazily allocate sheet builder in ModelRenderer.
Avoid allocating the sheet builder each frame until it is needed. For mods that do not need to render models, this avoids allocating a large buffer and backing sheet as it will never render to the sheet. For mods that do render models, but don't need any this frame, this avoids allocating a new SheetBuilder that will not be used.
2017-12-11 01:44:21 +01:00
RoosterDragon
ec84b61316 Reduce memory required in MovementClassDomainIndex
The number of distinct domains on a map is often dozens, or at most hundreds. We can use a ushort to represent this easily, and reduce the size of the backing storage required to track domain indicies over the whole map.
2017-12-11 01:41:07 +01:00
RoosterDragon
2dd1bd2d39 Initialize map inverse cell projections with capacity 1.
This prevents the capacity being set to 4 when the first item is added. For flat maps, the inverse projection will only ever be of size 1, thus this is sufficient capacity. For isometric maps, 1 is often sufficient, we only need more near height changes where the discontinuity means multiple cells may project back. We can pay for some reallocations to expand the size in these cases.

On flat maps, this reduces the memory required by the backing array 4x.
2017-12-11 01:38:17 +01:00
RoosterDragon
8ef8c60a1a Remove allocations when enumerating sync hashes on an actor.
Exposing Actor.SyncHashes as an array allows allocation free enumeration, we just need to adjust the SyncHash type to run the hash function.
2017-12-10 13:49:52 +00:00
RoosterDragon
5338784e45 Fix bad uses of FirstEnabledTraitOrDefault on TraitInfos.
These are not traits so this method does not work. We can use EnabledByDefault on the ConditionalTraitInfo instead.
2017-12-10 13:39:24 +00:00
RoosterDragon
7a7eed4fb7 Add FirstEnabledTraitOrDefault helper method.
This avoids the allocations caused by LINQ when using traits.FirstOrDefault(Exts.IsTraitEnabled). This is important in FrozenActorLayer.RefreshState which is called very often. We apply the new helper method to all areas using the old pattern. An overload that takes an array allows arrays to be enumerated without causing allocations.
2017-12-10 13:39:24 +00:00
Paul Chote
cb670d83b3 Set PredictedStance when changing stance from Lua. 2017-12-08 01:54:55 +01:00
reaperrr
1a20dd15cb Fix D2k hightech factory sprite offsets
To match original.
2017-12-08 02:41:11 +02:00
reaperrr
2218b1a078 Fix terrain type of d2k tile #401 2017-12-08 02:41:11 +02:00
reaperrr
ce88d50d9c Fix offset and animation speed of D2k refinery smoke overlay 2017-12-08 02:41:11 +02:00
Paul Chote
7ebea32be9 Remove hardcoded settings backend. 2017-12-08 01:29:15 +01:00
Paul Chote
eb3ab682e8 Remove unused hotkeys from each mod. 2017-12-08 01:29:15 +01:00
Paul Chote
b4c5346346 Migrate hotkey linter to HotkeyManager. 2017-12-08 01:29:15 +01:00
Paul Chote
74c390d1d0 Migrate input settings to HotkeyManager. 2017-12-08 01:29:15 +01:00
Paul Chote
2f79173044 Migrate hotkey consumers to HotkeyManager. 2017-12-08 01:29:15 +01:00
Paul Chote
35a3df3736 Duplicate default hotkeys in yaml. 2017-12-08 01:29:15 +01:00
Paul Chote
f98907f42e Add HotkeyManager class. 2017-12-08 01:29:15 +01:00
Paul Chote
811427adc4 Add HotkeyReference.IsActivatedBy method. 2017-12-08 01:29:15 +01:00
Paul Chote
c4237d6a1a Rename NamedHotkey to HotkeyReference. 2017-12-08 01:29:15 +01:00
abcdefg30
6dd42f7ab1 Replace bogus ROF values in missions 2017-12-07 20:44:41 +02:00
RoosterDragon
62ab6ae6f1 OccupiedCells and TargetableCells must return arrays, not just enumerables.
This allows callers to efficiently enumerate these returned collections without the allocation and overhead imposed by the IEnumerable interface. All implementations were already returning arrays, so this only required a signature change.
2017-12-07 20:39:30 +02:00
FrameLimiter
da036c5728 Fixes EditorTilesetFilter for T04 cactus 2017-12-05 21:32:28 +01:00
Smittytron
3d8ab75faf RA Balance changes (December 2017) 2017-12-05 12:38:13 +01:00
Paul Chote
9d2935935c Add a debug visualization for screen map rectangles. 2017-12-04 23:10:23 +01:00
Paul Chote
0f512088d2 Unify ingame-debug.yaml. 2017-12-04 23:10:23 +01:00
Paul Chote
1a1c6368fc Fix ScreenMap handling of flipped sprites. 2017-12-04 03:54:23 +02:00
Arular101
1b94378f71 Disable the new build radius lobby option for minigames 2017-12-02 20:26:23 +01:00
Mustafa Alperen Seki
f4086e4fe0 Update one of the dead worm tiles 2017-12-02 05:18:19 +01:00
Pavel Penev
77ae802b9c Added D2k asset installer d2k-e 2017-12-02 00:08:50 +01:00
Pavel Penev
8f5787a57f Added D2k asset installer d2k-d 2017-12-02 00:08:50 +01:00
Pavel Penev
45a2f5e6c1 Added D2k asset installer d2k-c 2017-12-02 00:08:50 +01:00
Pavel Penev
649971d517 Renamed D2k asset installers to systematize namings 2017-12-02 00:08:50 +01:00
Pavel Penev
450cbeea96 Added an extra bit of installer data to Install.log 2017-12-02 00:08:50 +01:00