Commit Graph

58 Commits

Author SHA1 Message Date
Paul Chote
992ba1a9a2 Remove HasEmbeddedPalette from sequences. 2023-03-10 20:11:33 +02:00
Gustas
8d0fe52dd8 Remove unnecessary parentheses 2023-02-27 08:36:47 +02:00
abcdefg30
5bf7fe852c Remove the copyright year numbers 2023-01-11 11:58:54 +02:00
abcdefg30
6a31b1f9f3 Update the copyright header year 2022-05-28 00:35:10 -05:00
Eduardo Cáceres
7eb64ea6fc Use read-only autoimplemented property when possible 2022-05-18 11:42:36 -05:00
penev92
0d24ccc47a Fixed unnecessary zero-length array allocations
Changed all currently present zero-length array allocations in the codebase to use `Array.Empty` instead.
2022-01-20 22:10:28 +01:00
RoosterDragon
727084c5fc Run spell check over solution 2021-12-05 19:23:43 +01: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
teinarss
8b0a3ea680 Remove our own impl of ReadOnlyList and update usages 2021-04-03 11:33:31 +02:00
teinarss
e12ff2c59d Remove our own ReadOnlyDictionary and update usages 2021-04-03 11:33:31 +02:00
Andre Mohren
3f510b6d93 Make ISpriteLoader aware of the source file name. 2021-03-27 17:36:59 +01:00
teinarss
4a1e4f3e16 Use expression body syntax 2021-03-07 13:00:52 +00:00
Paul Chote
f51603e440 Add ShpRemastered sprite loader. 2021-01-16 23:16:34 +01:00
Paul Chote
f341c9a8a6 Add TGA and DDS sprite loaders. 2021-01-16 23:16:34 +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
teinarss
27f1a7ab27 Use out var syntax 2020-08-19 18:11:07 +01:00
atlimit8
f1e8f9c9d0 Fixed PNG frame count calculation
This fixes the order of operations and rounding issue, making it columns * rows.
2020-05-02 23:14:31 +02:00
Matthias Mailänder
c131728aa4 Give more context when crashing during .png sheet loading. 2020-05-02 13:26:06 -05:00
Paul Chote
522861e484 Support 32 bit png sprites. 2020-01-17 16:49:58 +01:00
Paul Chote
1111ce4754 Add support for 32 bit BGRA sprites. 2020-01-17 16:49:58 +01:00
abcdefg30
23b3c237b7 Update the year numbers in all license headers to 2020 2020-01-05 17:00:34 +00:00
reaperrr
4751b1a176 Move ShpTDLoader, LZO and XORDelta formats to Mods.Cnc
They're pretty much RA/TD-specific formats.
2019-12-08 19:43:51 +00:00
reaperrr
a74235bdbc Move ShpD2 and TmpRA/TD loaders to Mods.Cnc
Reducing the count of proprietary formats in Mods.Common.

Note: Moving ShpD2 to Mods.Cnc is intentional. RA/TD
use it for their original mouse shp files, and any D2(k) mod
will normally need Mods.Cnc anyway, while we can avoid
adding a Mods.D2k dependency to RA/TD this way.
2019-12-01 16:23:54 +01:00
Paul Chote
78a70be0d4 Fix and enable SA1133, SA1134 style rules. 2019-05-24 10:47:57 +02:00
Paul Chote
353db73381 Fix a collection of minor style violations.
This enables several new StyleCopAnalyzer rules to
be enabled immediately during migration.
2019-05-09 20:40:08 +02:00
Paul Chote
ab4a7e3558 Replace System.Drawing primitives with our own. 2019-03-04 18:26:42 +00:00
abcdefg30
cadbd0d9ab Change the year number in all cs headers from 2018 to 2019 2019-01-26 23:15:21 +01:00
Paul Chote
49b04221b2 Add palette checks for png sprites. 2019-01-08 21:20:06 +00:00
Andre Mohren
89051d40e8 Remove utf8 BOM. 2018-11-17 17:23:22 +00:00
Paul Chote
2ad8179672 Add PngSheetMetadata sprite metadata. 2018-10-28 20:55:40 +00:00
Paul Chote
eb61c45e14 Add EmbeddedSpritePalette sprite metadata. 2018-10-28 20:55:40 +00:00
Paul Chote
dee6d03626 Allow sprites to store custom metadata. 2018-10-28 20:55:40 +00:00
Andre Mohren
693b5a54af PNG spritesheet support, along with PaletteFromPng.
Cursor palette loader can now be specified via yaml.
2018-09-29 21:12:40 +02:00
Paul Chote
567ab47765 Revert ShpTD empty space trimming.
This reverts the following commits:
 * 1faae73c08f6971286b1f9929dd8aa03b52e198c
 * a7d39fc76d446efea8b4eb092c2b303ffc49189d
2018-08-04 19:56:24 +02:00
Paul Chote
d6682faeee Keep a 1px border around trimmed ShpTD data. 2018-07-23 17:02:50 +01:00
Paul Chote
8c0f4fde81 Fix newlines in C# files. 2018-07-01 11:08:32 +02:00
Paul Chote
dbf6937062 Trim empty space around edges of Shp(TD) frames.
This significantly cuts down the amount of texture
space allocated in VRAM.
2018-05-20 14:12:11 +02:00
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +01:00
Matthias Mailänder
5b16bb952f Count all zero images as valid. 2017-10-07 10:09:35 +02:00
Matthias Mailänder
a8288a38f8 Allow sprites with empty frames to pass the ShpTS checks. 2017-10-07 10:09:35 +02:00
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Paul Chote
e71225496b Clarify GPL version. 2016-02-21 16:30:48 +00:00
Paul Chote
b396965fd9 Update licence header year. 2016-02-21 16:27:31 +00:00
Paul Chote
9f4b7097b2 Move WW compression formats into Mods.Common. 2016-01-07 21:07:43 +00:00
Paul Chote
33f3e5ad47 Rename WW-created compression formats. 2016-01-07 21:07:42 +00:00
RoosterDragon
bfe1804bf6 Fix some spellings. 2015-11-27 16:19:59 +00:00
Jacob Dufault
d9b39d15d4 Remove some unused using statements 2015-05-25 02:00:45 -07:00
RoosterDragon
82bea961ba Checked LINQ queries and collections for inefficiencies.
- Made Array.IndexOf available via extension method.
- Made ToHashSet extension method.
- Change collections queried often via Contains into sets.
- Avoid Count() extension if Count or Length property exist.
- Made Count() > 0 checks and variations calls to Any() instead.
- Don't call ToList/ToArray if there is no benefit to materializing the sequence.
- If the sequence does benefit from materialization, follow this general pattern:
  - Collection queried often via Contains use ToHashSet to speed up lookups.
  - Short lived variables use ToList. This is because ToArray requires an extra copy to output the final size.
  - Collections persisted into fields or for a long time use ToArray to minimize memory overhead.
2015-01-29 19:20:11 +00:00