Commit Graph

5783 Commits

Author SHA1 Message Date
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
9e18ec7314 Simplify ScreenMap bounds checking. 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
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
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
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
7ebea32be9 Remove hardcoded settings backend. 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
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
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
Paul Chote
9d2935935c Add a debug visualization for screen map rectangles. 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
Pavel Penev
bd67bd24c0 Pull out game loop initialization from OpenRA.Program into OpenRA.Game and exception handling into its own class under OpenRA.Game/Support 2017-12-02 00:05:57 +01:00
Paul Chote
4994716cf7 Ignore empty children when aggregating EventBounds. 2017-11-27 16:09:34 +02:00
dsimmons87
65a2410738 Fixed bug in map Retry Install
If the download failed, the map status would be MapStatus.DownloadError,
which would cause the Install method to return immediately. I've updated
the Install method now to account for MapStatus.DownloadError.
2017-11-27 15:18:33 +02:00
reaperrr
56b6aabbb8 Use new IAutoRenderSize for determining actor render bounds 2017-11-21 01:00:09 +02:00
reaperrr
6711af63eb Move SelectionBarsRenderable to Mods.Common 2017-11-21 01:00:09 +02:00
reaperrr
be290cfabd Split Actor.Bounds into RenderBounds and SelectableBounds
Additionally, internally renamed VisualBounds to SelectionOverlayBounds to avoid confusion with RenderBounds.

This step was necessary to prevent actors with selectable area smaller than their graphics to be removed too early from ScreenMap even though part of the graphics should still be visible.
RA cruisers were a prime example, but to a lesser extent several other actors were affected as well.

This separation also serves as preparation to determine the final RenderBounds from multiple source bounds later, to fix the remaining ScreenMap issues (building 'bibs', aircraft shadows).
2017-11-21 01:00:09 +02:00
RoosterDragon
471d7ae40d Run GC more during loading.
This helps reduce the peak GC size by trimming temporary loading garbage a bit more often, rather than just doing it at the end of loading.
2017-11-19 12:42:25 +00:00
RoosterDragon
a71a5cc71d Reduce the size of the sheets created for fonts.
- A 512x512 sheet is about half full after precaching and some usage, but uses 16x less memory than the default 2048x2048 sheet. This saving occurs twice as we maintain a managed buffer for this sheet.
- Only precache smaller fonts, as the larger fonts are less used and take up more space than is worthwhile.
- Only precache in white, as red is largely unused.
2017-11-19 12:40:04 +00:00
RoosterDragon
713cdaef5d Reduce allocations needed by ReplayConnection.
Packets from each chunk are now saved directly in an array, removing the overhead of a list. Additionally, a list is reused as a buffer for decoding packets into, preventing a new buffer from needing to be allocated for each chunk.
2017-11-19 12:11:38 +00:00
reaperrr
786a0eb07f Refactor PowerManager and RequiresPower to use conditions
Instead of Actor.IsDisabled.
Added INotifyPowerLevelChanged interface to do so as efficiently as possible.
2017-11-13 03:09:05 +02:00
Pavel Penev
8d7eb0bc47 Fix order deserialization when there is no indended order subject 2017-11-13 00:37:44 +01:00
Paul Chote
1376ad674e Remove Player.CanViewActor and .CanTargetActor. 2017-11-03 09:56:00 +01:00
Paul Chote
47634b25f9 Remove IFogVisibilityModifier. 2017-11-03 09:56:00 +01:00
Andrii Yukhymchak
636a9a74a1 Font Crash gracious fallback 2017-11-01 18:50:15 +01:00
Paul Chote
5f9a67ed87 Migrate frozen actors from ExtraData to Target. 2017-10-26 18:48:41 +03:00
Paul Chote
29c423772f Serialize order Target directly instead of TargetActor/TargetCell. 2017-10-26 18:48:41 +03:00
Paul Chote
77a7453347 Improve WidgetUtils.WrapText performance on long lines. 2017-10-26 01:42:16 +02:00
RoosterDragon
3a9abda441 Specify C# 5 as the language version used in all projects.
Attempts to use features from a new version will generate compile errors (on Roslyn and possibly other compilers), preventing accidental adoption of new language features.
2017-10-19 14:18:03 +02:00
Paul Chote
9bdedda43a Make float2 immutable. 2017-10-17 15:46:07 +02:00
Paul Chote
69b4b541d2 Fix mutable use of float2 in SpriteFont. 2017-10-17 15:46:07 +02:00
Paul Chote
d967c564a2 Remove TargetActor and TargetLocation from order issuing. 2017-10-15 19:07:46 +02:00
Paul Chote
4896a90b8d Add plumbing to issue orders against a generic Target. 2017-10-15 19:07:46 +02:00
Paul Chote
75d4062698 Limit chat messages to 2500 characters. 2017-10-14 13:10:27 +02:00
Paul Chote
f96c2710cd Remove directory creation side effect from Platform.SupportDir. 2017-10-08 19:53:10 +02:00
abcdefg30
27345c1f6a Fix map linting crashing for not existing directories 2017-10-08 18:23:25 +01:00
DeadlySurprise
80bf36e1a8 Deprecate Actor.IsDisabled 2017-10-08 00:12:15 +02:00
reaperrr
8533debc44 Require explicit INotifyAddedToWorld and INotifyRemovedFromWorld 2017-10-07 10:17:11 +02:00
reaperrr
8ec3d5ddb8 Require explicit ITickRender 2017-10-07 10:17:11 +02:00
reaperrr
0ce3c113e1 Require explicit ITargetableCells 2017-10-07 10:17:11 +02:00
reaperrr
7ca9679b34 Require explicit ITargetablePositions 2017-10-07 10:17:11 +02:00