We want to be able to use unpacked MPQs on low-end platforms
(PS2/rg99/etc).
This is tricky on case-sensitive filesystems. Avoids case issues by
lowercasing all paths in the code (then we'll just need lowercased
listfiles).
The format is almost identical to CL2, except it uses the frame header
to store frame width and height instead of 5 32-line offsets.
This means we always have access to frame dimensions, so we can use it
as an on-disk format for our graphics as well.
Additionally, we may be able to optimize the rendering even more
in the future now that we have guaranteed knowledge of frame dimensions.
Convert CEL files to CL2 at load time. CL2 format is more efficient and is about as fast to render.
CEL vs CL2 sizes, on dLvl 5: https://gist.github.com/glebm/9bbdd76962abcd4fd2405ecd3379af97
Memory:
* Peak memory (while loading): -300 KiB
* Memory in-game (dLvl5): -700 KiB
* RG99 binary size: -15 KiB (1333096 -> 1317192)
Performance on rg99:
* On average, -1 FPS in town.
* Same FPS in dungeon (20 FPS on dLvl 1).
Previously this was falling back to FunctionCase, leading to inconsistent casing of class methods throughout the codebase. Applied to Item as an example.
This cleans up a bit of code and solves a few edge cases where an item
could be lost, the game be unresponsive, or miss fire an event during
lag cause of the cursor not reflecting the currently held item.
Introduces a `ControlDevice` global which is distinct from `ControlMode`
in that it is set to `Gamepad` even when simulating a mouse.
This allows us to avoid a number of edge cases related to mode changes.
Fixes#4242
Makes `CelSprite` unowned and adds a new `OwnedCelSprite` class for
owned sprites.
This clarifies ownership and makes the code cleaner in a number of
places.
Additionally, because the `CelSprite` class is now tiny (1 less
pointer), we can pass it by-value instead of by-reference, removing a
pointer indirection in the rendering functions.
The gamepad cursor (inventory, spells etc) no longer relies on warping a
real mouse cursor. This should make things work better on platforms that
do not support this, like Wayland.
1. Adds a `libdevilution_so` target when tests are enabled.
2. Each test file is now a separate binary target linked against `libdevilutionx_so` (can now run tests in parallel).
3. Tests are now defined in a separate `test/CMakeLists.txt` file.
4. Building the tests is now controlled by the standard `BUILD_TESTING` option (defined by CTest).
5. Tests are now built by default.
6. On CI, test errors are now reported.
Also:
* `.clang-format`: Enable SortIncludes in tests
* `path_test.cpp`: Fix -Wsign-compare