Commit Graph

69 Commits

Author SHA1 Message Date
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
Arular101
8a60918841 Update copyright notice year to 2018 2018-01-17 00:47:34 +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
Taryn Hill
43317e0f5d Update copyright notice year to 2017 2016-12-31 23:46:13 -06:00
Paul Chote
20e8bc249d Restore support for inline map rules. 2016-03-10 19:27:50 +00:00
Paul Chote
b969d61466 Move advanced map yaml to their own files. 2016-03-08 20:54:54 +00: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
fe75f265f8 Disable now-invalid sequence caching. 2016-02-18 18:12:34 +00:00
Paul Chote
b347fade71 Use IReadOnlyFileSystem in artwork loaders. 2016-02-18 18:12:31 +00:00
Paul Chote
4a12e7bafc Load mod yaml via the virtual filesystem. 2016-02-06 16:30:23 +00:00
Paul Chote
ab921682c4 Rewrite yaml merger. 2016-01-30 15:03:56 +00:00
RoosterDragon
8e89a6a696 Simplify names, remove unused usings, remove redundant casts. 2016-01-17 21:35:36 +00:00
Paul Chote
c7249e6fa6 Move yaml removals to the end of the merge. 2015-11-28 17:20:32 +01:00
Paul Chote
a074bb1d4b Rename MiniYaml MergeLiberal -> MergePartial, MergeStrict -> Merge. 2015-11-28 17:20:21 +01:00
Paul Chote
b8b27f11af Remove stub map constructor. 2015-07-05 14:57:58 +01:00
Paul Chote
b2458fc614 Remove GlobalFilesystem.OpenWithExts. Closes #5272. 2015-03-28 12:38:48 +00:00
Paul Chote
a69145caf0 Add a utility command for checking sequences. 2015-03-22 12:48:51 +00:00
Paul Chote
f91ee3fb45 Fix sequence terminology. 2015-03-09 20:45:49 +00:00
Paul Chote
7292bd20b3 Move Sequence parsing into mod code. 2015-03-09 20:45:22 +00:00
Paul Chote
d3783f0244 Introduce ISpriteSequence interface. 2015-03-09 19:19:00 +00:00
Paul Chote
44159ecdd6 Add support for race-specific actor sequences. 2015-03-02 20:46:24 +00:00
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
RoosterDragon
f0f02dff5c Dispose of graphics resources deterministically.
Textures, FrameBuffers and VertexBuffers allocated by the Sdl2 Renderer were only being released via finalizers. This could lead to OpenGL out of memory errors since resources may not be cleaned up in a timely manner. To avoid this, IDisposable has been implemented and transitively applied to classes that use these resources.

As a side-effect some static state is no longer static, particularly in Renderer, in order to facilitate this change and just for nicer design in general.

Also dispose some bitmaps.
2014-12-22 17:34:01 +00:00
RoosterDragon
c2b7d9ca5b Release sheet buffers in SequenceProvider and MapCache.
The buffers in SequenceProvider can be freed if Preload is called, since we know everything is loaded. A SequenceProvider is created for each TileSet is use so this saves memory for however many tilesets had been used in the game. This will be at least one for the shellmap, and often more.

The MapCache loading thread is kept alive for 5 seconds after it last generated a map (in anticipation of more requests). Once this time expires the thread is allowed to die, as it is unlikely there will be more requests in the short term. At this time it is ideal to force the changes to be committed to the texture so we can release the buffer. As well as marking the buffer for release, we must access the texture to force the changes stored in the buffer to be written to the texture, after which the buffer can be reclaimed.

Additionally, when starting the MapCache loading thread we must ensure the buffer is created from the main thread since it may query the texture object which has thread affinity. After that the buffer may be modified freely on the loading thread until released.
2014-11-29 12:04:51 +00:00
RoosterDragon
d671e1de01 Create a separate FrameCache for caching sprite frames.
We split the caching SpriteLoader into a SpriteCache and FrameCache. SpriteLoader instead becomes a holder for static loading methods.

Only a few classes loaded sprite frames, and they all use it with a transient cache. By moving this method into a new class, we can lose the now redundant frame cache, saving on memory significantly since the frame data array can be reclaimed by the GC. This saves ~58 MiB on frames and ~4 MiB on the caching dictionary in simple tests.
2014-10-14 22:06:11 +01:00
Paul Chote
9cf8328979 Add plumbing for mod-defined sprite loaders. 2014-10-07 09:55:49 +13:00
RoosterDragon
3c9f589b5e Move try-catch during creation of sequences into the function rather than around the lazy initialization.
This fixes an issue with VS breaking on the exception because it thinks it will go unhandled, even though it will be handled.
2014-06-24 17:21:41 +01:00
ScottNZ
dbffce81a6 Remove unused usings 2014-06-15 22:16:40 +12:00
RoosterDragon
2e992a7310 Changed MiniYaml.NodesDict property into a method.
Method is now called ToDictionary.
- Cached a few invocations into locals which should prevent some redundant evaluation.
- Added ToDictionary overloads that take projection functions for the keys and elements, since several callsites were doing a subsequent Linq.ToDictionary call to get this.
2014-06-09 17:06:42 +01:00
Paul Chote
51c5797a42 Avoid a loop closure issue that caused incorrect sequence lookups. 2014-05-24 20:32:42 +12:00
Pavlos Touboulidis
531338a955 Preload sequences and fix #5382 2014-05-22 03:45:28 +03:00
Pavlos Touboulidis
f651cb3677 Final style & rebase fixes 2014-05-17 14:34:52 +03:00
Pavlos Touboulidis
ca44be7b2e Only update the loading screen from the main thread
Fixes the crash experienced by pchote. It's a hack but it's easy
to get rid of and it will have to do for now, until the messy
LoadScreen gets fixed.
2014-05-17 14:33:17 +03:00
Pavlos Touboulidis
a845947e0f Minor style & nit fixes 2014-05-17 14:33:17 +03:00
Pavlos Touboulidis
0e15ce1b88 Replace catch(KeyNotFoundException) with TryGetValue() 2014-05-17 14:33:16 +03:00
Pavlos Touboulidis
44c01bbaa2 Remove TileSetData and separate TileSet from Sequences 2014-05-17 14:33:16 +03:00
Pavlos Touboulidis
63ec6d60e7 Refactoring to remove static Rules & SequenceProvider 2014-05-17 14:32:03 +03:00
Pavlos Touboulidis
693186e1eb Fix caching by making the tileset part of the key 2014-05-17 14:26:54 +03:00
Pavlos Touboulidis
2b3d5f1544 Better caching for Rules and Sequences
Refactored the Rules and SequenceProvider classes to be parts of ModData and
maintain a cache of the instances used in the mod.

The caching reduced the load times a lot, especially after the first load.
Some lazy loading in sequences also helped lower the startup time..

Note: The static classes were left behind to redirect the existing code's
calls.
2014-05-17 14:26:53 +03:00
Paul Chote
8c7f77d2c7 Convert SmudgeLayer to sequences. 2013-12-11 22:53:33 +13:00
Paul Chote
d091789206 Remove sequence warnings for the stable release. Fixes #3142. 2013-05-04 23:20:28 +12:00
Matthias Mailänder
3649342317 be more verbose about missing sequences and files
as requested in #3039
2013-04-20 21:56:29 +02:00
Chris Forbes
55036cd58c fix trailing whitespace everywhere 2011-09-26 08:40:39 +13:00
Chris Forbes
3b2efc7b0b fix #1184 -- useless error message when forgetting to define Render:Image: on a derived actor type 2011-09-24 19:58:34 +12:00
Chris Forbes
e829e4b5aa fix formatting nit in SequenceProvider 2011-09-24 19:57:33 +12:00
Chris Forbes
f6661d5e47 fix sequences being ignored when the only sequences in the mod are provided by a map 2011-09-24 19:57:08 +12:00
Chris Forbes
2063277654 remove dead SaveSequencesForUnit 2011-09-24 19:56:29 +12:00
Chris Forbes
ca81871b7b fix broken merging of yaml overrides in maps; we now have a strict mode and a liberal mode. 2011-04-09 10:55:54 +12:00