Commit Graph

257 Commits

Author SHA1 Message Date
Matthias Mailänder
07815143f1 Fix CA1825 warnings on empty array initialisation. 2021-12-06 13:19:28 +01:00
RoosterDragon
2ed4cb8aff Ensure Clear(T) also have a safety check to ensure no listener is attached.
Move related methods next to each other.
Change Clear(T) to use Array.Fill.
2021-10-23 15:43:47 +02:00
RoosterDragon
6f3b4ecae9 Speed up Map.Contains checks for non-flat maps.
We observe that most cells within a map lie within a region where no matter their height, their projection would still remain in map bounds. We can utilise this to perform a fast check for such cells and skipping the expensive checks on their actual height. We only need to check the actual height of a cell if this could cause the projection to go out of bounds.
2021-10-02 21:43:11 +01:00
Paul Chote
3551eb3128 Fix map preview bounds calculation. 2021-08-21 14:16:02 +02:00
Paul Chote
7f94d67d39 Replace Map.CustomTerrain radar colors with IRadarTerrainLayer.
* TSVeinsRenderer now shows border cells on the radar
* BuildableTerrainLayer now uses the radar colors defined on the individual tiles
* CliffBackImpassabilityLayer no longer overrides the underlying terrain color.
2021-08-21 14:16:02 +02:00
Paul Chote
68710e48a6 Add terrain orientation support for Mobile. 2021-08-21 13:45:41 +02:00
Paul Chote
1ecb3bf99a Don't add empty Translations nodes to maps. 2021-07-31 13:14:46 +02:00
Vapre
2e6f444285 Map.Contains check grid type once. 2021-07-24 15:34:56 +02:00
abc013
2742985520 Prevent saving and starting a map when max player count is exceeded. 2021-07-03 08:25:16 -05:00
Andre Mohren
6810469634 Updated copyright years. 2021-06-29 18:33:21 -05:00
teinarss
10676be377 Replace F extension with string interpolation 2021-05-08 22:20:59 +02:00
Matthias Mailänder
1f01d0b6b1 Add a Fluent based translation system. 2021-04-24 16:49:17 +02:00
Matthias Mailänder
5a0bcc01a6 Add a lint check for trait placement on hardcoded actor names. 2021-04-11 20:20:00 +02:00
teinarss
6b74093c04 Add readonly to structs 2021-03-14 15:17:57 +01:00
teinarss
4a1e4f3e16 Use expression body syntax 2021-03-07 13:00:52 +00:00
teinarss
ed295ae315 Change throw exceptions to use nameof in parameter 2021-02-28 18:43:51 +01:00
Paul Chote
be2ca77acf Add ITerrainInfoNotifyMapCreated interface. 2021-01-11 21:57:55 +01:00
Paul Chote
87790069e9 Add ITerrainInfo interface. 2021-01-11 21:57:55 +01:00
Paul Chote
6fed31717c Fix map editor inverting preview color channels. 2021-01-02 11:43:55 +01:00
Paul Chote
62fa3b7c9c Rename SpriteFrameType enums. 2020-12-25 18:51:25 +01:00
Paul Chote
ce09b402d0 Fix definition and use of non-indexed sprite color channels.
Our SpriteFrameType names refer to the byte channel order rather than
the bit order, meaning that SpriteFrameType.BGRA corresponds to the
standard Color.ToArgb() etc byte order when the (little-endian) integer
is read as 4 individual bytes.

The previous code did not account for the fact that non-indexed Png
uses big-endian storage for its RGBA colours, and that SheetBuilder
had the color channels incorrectly swapped to match and cancel this out.

New SpriteFrameType enums are introduced to distinguish between BGRA
(little-endian) and RGBA (big-endian) formats, and also for 24bit data
without alpha. The channel swizzling / alpha creation is now handled
when copying into the texture atlas, removing the need for non-png
ISpriteLoader implementations to allocate an additional temporary array
and reorder the channels during load.
2020-12-25 18:51:25 +01:00
Paul Chote
6e7ad9df25 Remove vestigial translation plumbing.
This was never completed to the level required to
be properly used ingame.
2020-12-25 16:18:28 +01:00
Paul Chote
1a177bc2de Remove unused variables from Map.SavePreview. 2020-12-19 13:07:01 +01:00
Paul Chote
e0b3e631fe Remove obsolete null checks. 2020-12-19 13:07:01 +01:00
Paul Chote
2518a353af Add lint test for invalid map tiles. 2020-12-19 13:07:01 +01:00
Paul Chote
c02846e2cb Replace invalid tiles on map load. 2020-12-19 13:07:01 +01:00
abcdefg30
3674583053 Throw an exception at load when a map has more than 64 players 2020-10-24 10:09:22 +02:00
RoosterDragon
bb116034c7 Avoid or reduce LINQ allocations required in various areas. 2020-10-17 23:48:48 +02:00
Paul Chote
c4b4a8c8a5 Fix incorrect ramp fill in Map.Resize. 2020-08-16 14:17:45 +02:00
teinarss
19b02875c7 Use Tuple syntax 2020-08-15 10:37:10 +01:00
abcdefg30
889e2152a4 Cache ProjectedCellBounds during load time 2020-07-08 18:37:50 +02:00
abcdefg30
173aae1f81 Directly check the map bounds instead of converting to PPos 2020-07-08 18:37:50 +02:00
Paul Chote
b3ee8b447e Reduce duplication between Map and PlayerRadarTerrain. 2020-07-07 22:12:22 +02:00
Paul Chote
5f588561b6 Rewrite TS minimap rendering:
* Rename LeftColor and RightColor to MinColor and MaxColor
  These are mapped from LowRadarColor and HighRadarColor in
  the original inis, and appear to be used to set the bounding
  values for selecting a random colour, NOT for left/right
  pixels (which caused noticeably wrong banding).

* Adjust brightness based on terrain height.
  MinHeightColorBrightness and MaxHeightColorBrightness
  were chosen by trial/error to match the original
  map preview rendering.
2020-07-07 22:12:22 +02:00
Paul Chote
6adf45bcb4 Convert IFacing.Facing and TurnSpeed to WAngle. 2020-06-12 18:35:41 +02:00
Matthias Mailänder
607d9b2d5c Fix index out of bounds exception for off world aircraft. 2020-06-02 19:25:53 +01:00
Paul Chote
626b40f31b Account for ramps in terrain height calculations. 2020-05-28 09:41:55 -05:00
Paul Chote
4614f6febe Cache cell ramps to avoid repeated tileset lookups. 2020-05-28 09:41:55 -05:00
Paul Chote
cc05621c10 Draw editor terrain/resource preview as part of the world. 2020-01-12 18:30:50 +01:00
abcdefg30
23b3c237b7 Update the year numbers in all license headers to 2020 2020-01-05 17:00:34 +00:00
reaperrr
b0a7865cfa Reduce Map.Contains(CPos) cost in legacy mods
If a mod uses rectangular maps and no height levels,
checking if the CPos is within Bounds
should be enough and cheaper than the whole ToMPos
conversion and checks.
2019-08-07 14:02:18 +02:00
Paul Chote
ebf2ce32c0 Make sure braces for multi-line statements are on their own lines. 2019-06-08 19:26:53 +02:00
Paul Chote
5f157c572f Restore newlines between top-level map.yaml blocks. 2019-05-02 13:40:22 +02:00
Mustafa Alperen Seki
9fef2c01ec Add AppearsOnMapPreview
Allows preplaced actors to be rendered on map preview when saving the
map.

Also removes requirements for ResourceLayer in OpenRA.Game and moves it
to OpenRA.Mods.Common.
2019-04-04 19:37:19 +02:00
abcdefg30
0524a59b6b Fix map preview generation for isometric terrain 2019-03-08 21:21:10 +01:00
Paul Chote
ab4a7e3558 Replace System.Drawing primitives with our own. 2019-03-04 18:26:42 +00:00
Paul Chote
5f212a99fe Convert Map.SavePreview to new Png code. 2019-02-24 14:02:19 +01:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
Andre Mohren
b1a44086a0 Removed unused using directives. 2018-11-17 17:23:22 +00:00
Taryn Hill
5899636e10 Fix SubCell indexing in Map.CenterOfSubCell and MapGrid.OffsetOfSubCell 2018-11-02 22:42:51 +00:00