Commit Graph
156 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 1cdd76b617 Remove PCX rendering code
We no longer render PCX
2022-07-20 22:58:15 +01:00
Gleb Mazovetskiy 0cd035ef61 Load PCX as CL2
Similar to #5059, which converted CEL to CL2 at load time,
we now do the same for PCX.

Some size stats: https://gist.github.com/glebm/067bf1ec73f9d14514932cfe237e4e8e

Notably, fonts RAM usage is decreased by ~35%.
2022-07-20 22:58:15 +01:00
ephphatha 9e76cd4ab7 Use object pointer for pcursobj 2022-07-19 13:20:24 +02:00
Gleb Mazovetskiy 43a5d91074 Remove CEL rendering code
We no longer render CEL
2022-07-19 10:59:35 +02:00
Gleb Mazovetskiy 8ca71272b8 Load all CEL as CL2
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).
2022-07-19 10:59:35 +02:00
Gleb Mazovetskiy f9b9a7de9d CL2 render: Point position argument
Bring the CL2 API closer to CEL and PCX.
2022-07-18 09:25:12 +02:00
Gleb Mazovetskiy 6f01fb6b79 Unify CEL/PCX/CL2 render functions
Except for the outline rendering.
2022-07-17 20:28:29 +02:00
Gleb Mazovetskiy a4ac41cece Replace DVL_VK virtual key codes with SDLK 2022-07-17 10:00:06 +01:00
Gleb Mazovetskiy 70364013b0 Fix fmt v9 deprecation warnings
Version 9 of libfmt deprecates printing `enum` without casting it to an
integral type explicitly (consistent with `enum class`).
2022-07-16 12:55:18 +01:00
Mikołaj Piróg c38db60d0b Remove monster name member from monster struct (#4986) 2022-07-14 10:16:19 +02:00
Anders Jenbo ac2bf9aaac Limit what gets called in headless mode 2022-07-13 18:54:36 +02:00
ephphatha 1337ff6ea2 Add check if a monster potentially has leashed minions 2022-07-13 07:13:34 +02:00
Gleb Mazovetskiy 33ac2cca8e ♻️ Make Monster counters size_t 2022-07-12 03:04:53 +01:00
Anders Jenbo 3d08f951d6 Clean up use of miniwin 2022-07-10 21:13:39 +02:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Trihedraf 5ee6e5dd3a Make zoom a setting in the menu (#4931) 2022-07-10 19:59:32 +02:00
Anders Jenbo 6a8fd04067 Use player by references (#4938) 2022-07-10 11:40:04 +02:00
Gleb Mazovetskiy 197e1180b2 Add StrCat and StrAppend
Adds simple string / integer concatenation functions.

Many of the uses of `fmt::format` are simply concatenation
of a few strings and integers.

`StrCat` is an easier-to-read alternative to such uses of `fmt`.
2022-07-10 06:14:58 +02:00
Gleb Mazovetskiy 2f09c20b08 cel_render: Remove unused LineEndFn
This was used for stippled transparency which we no longer support.
2022-07-09 10:23:09 +01:00
Cesar Canassa e538acb248 📝 Fixes Doxygen warnings (#4904) 2022-07-07 12:51:24 +02:00
Mikołaj Piróg 15989609a8 Members' name changes and comments in Monster struct (#4861) 2022-07-06 10:21:22 +02:00
Gleb Mazovetskiy eb8721885d Fix clang warnings
As seen in the Xbox NDK build.
2022-07-04 09:39:41 +01:00
k-bar 26de74f4a2 AnimationInfo class correct style (#4870)
* AnimationInfo class correct case-style for private members

clang-tidy warnings:
readability-identifier-naming    invalid case style for private member

* AnimationInfo class correct case-style for members

clang-tidy warnings:
readability-identifier-naming    invalid case style for member

* AnimationInfo class correct case-style for methods

clang-tidy warnings:
readability-identifier-naming    invalid case style for method

* AnimationInfo class use nodiscard

clang-tidy warnings:
modernize-use-nodiscard    function  should be marked [[nodiscard]]
2022-07-03 16:55:37 +02:00
Gleb Mazovetskiy 6949a6f418 Monster: Remove MType/MData pointers
These pointers are redundant, replaces them with methods.
2022-07-03 13:21:11 +01:00
Gleb Mazovetskiy d152d2c0fb Add OptionalOwnedCelSprite 2022-07-03 12:26:39 +01:00
Gleb Mazovetskiy 21dc7f553d Add OptionalCelSprite: smaller than std::optional
`CelSprite` data pointer can never be `nullptr`.

We implement a smaller `optional` for it by taking advantage of that.
2022-07-03 12:26:39 +01:00
Anders Jenbo b00ae287b8 Minimize propegation of global Players index 2022-07-03 06:10:42 +02:00
ephphatha 0f1ac758d8 use a smaller buffer
fmt::memory_buffer uses 500 bytes by default, go back to a 12 byte char array to avoid all the cruft
2022-07-02 08:51:28 +01:00
ephphatha d6120f05bc Only call fmt::format_to when the FPS value updates
Don't even need to initialise the buffer since the last update time is set when DiabloInit is called, then as long as the loading screen takes more than a second the threshold gets hit to call format_to on the first frame of gameplay.
2022-07-02 08:51:28 +01:00
Gleb Mazovetskiy 72660d9189 Migrate snprintf to fmt (#4845)
* Migrate `app_fatal` from printf to libfmt
* Migrate snprintf to fmt
2022-07-02 02:36:17 +02:00
Gleb Mazovetskiy 3178dd5158 Replace most uses of sprintf with fmt (#4837) 2022-07-01 17:02:56 +02:00
Gleb Mazovetskiy bd66e7d6d8 pcx_render: Fix line skipping for odd widths (#4828)
When line skipping PCX sprites with odd widths, skip the padding pixel
as well.
2022-07-01 01:00:43 +02:00
Mikołaj Piróg 2e7ff45fbf Monster global constants cleanup (#4827)
* Change #defines to constexpr const, add constexpr where applicable, fix typos
2022-07-01 00:43:03 +02:00
Anders Jenbo b3b5d16633 Clean up DrawPlayerIconHelper 2022-06-26 10:11:12 +02:00
Anders Jenbo 72656b3011 Move path and palette to the engine folder 2022-06-24 16:34:20 +02:00
Anders Jenbo 99181fd709 Move more files to the engine folder 2022-06-24 11:08:15 +02:00
Gleb Mazovetskiy 8e9c9e0238 Reduced the size of OwnedCelSprite* by 8 bytes
`OwnedCelSpriteWithFrameHeight`: 40 -> 32
2022-06-20 01:11:22 +02:00
Anders Jenbo 860bd1cebf Operate directly on SOL data 2022-06-18 21:27:05 +02:00
Gleb Mazovetskiy 02d448267a Render fonts as PCX (-420 KiB RAM)
Reduces peak memory consuption in game by ~420 KiB.

This is because the PCX renderer applies the palette on the fly while
rendering, meaning we do not need to duplicate the font for different
palettes.

This approach is also a bit slower than precomposed palettes (still
plenty fast).
2022-06-15 16:59:59 +02:00
Gleb Mazovetskiy 1fc8ecb6f6 Add fmt::runtime annotations for C++20 support
`fmt` requires non-contexpr format string arguments to be wrapped in
`fmt::runtime` in C++20.
2022-06-14 12:46:36 +01:00
Gleb Mazovetskiy c380c7fa61 PCX: Add transparency support 2022-06-13 09:54:01 +01:00
Gleb Mazovetskiy 220d38aa5c Direct PCX rendering 2022-06-13 09:54:01 +01:00
qndel f84c35d2dc fix typos 2022-06-01 17:12:22 +02:00
Anders Jenbo 0508311959 Cleanup block_lvid checks 2022-05-29 22:32:14 +02:00
Gleb Mazovetskiy 961e1b584b Always load fonts as CEL
There appear to be no drawbacks, only advantages.
2022-04-25 05:31:26 +01:00
Gleb Mazovetskiy 978bae1a15 Add a helper for loading PCX as CEL from path 2022-04-25 05:31:26 +01:00
Gleb Mazovetskiy 2b161e5535 An option to convert fonts to CEL in-memory
Reduced RAM usage by 200 KiB with no performance drop, perhaps even an
improvement.
2022-04-25 05:31:26 +01:00
Gleb Mazovetskiy a66ca44695 Zero-based frame indexing
Index frames starting at 0 instead of 1.
2022-04-14 04:39:26 +01:00
Gleb Mazovetskiy ade8aba822 Fix some more warnings 2022-04-14 01:26:29 +02:00