Commit Graph
241 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 010dda42cf Remove PCX->CEL conversion
It is no longer used as we render all assets directly as PCX.
2022-07-01 16:21:44 +01:00
Gleb Mazovetskiy 0c7e36e81a DiabloUI: Clean up portrait loading
1. Load portraits as PCX (~30% smaller).
2. Simplify the portrait override logic.
2022-07-01 16:15:40 +01:00
Gleb Mazovetskiy 3178dd5158 Replace most uses of sprintf with fmt (#4837) 2022-07-01 17:02:56 +02:00
Vladimir Olteanu 5a5111f1d8 Refactor CrawlTable (#4833) 2022-07-01 06:19:33 +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
obligaron 0d2a23254e Use binaryformat for demofile (#4799) 2022-06-25 22:19:37 +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
ephphatha c68fcf3cb1 Apply MethodCase config to Rectangle::Contains
Also included Circle and VirtualButton classes due to the shared use.
2022-06-24 00:39:55 +02:00
ephphatha de05ce6562 Use theme room attributes directly instead of recalculating 2022-06-22 16:35:39 +02:00
Gleb Mazovetskiy 8e9c9e0238 Reduced the size of OwnedCelSprite* by 8 bytes
`OwnedCelSpriteWithFrameHeight`: 40 -> 32
2022-06-20 01:11:22 +02:00
Andrew James 13a3424ff0 Add helpers for creating/using Rectangles in UI contexts (#4734)
* Add MakeRectangle helper to convert from SDL_Rect

* Add Rectangle::inset method for shrinking a rectangle

Turns out some of the other use cases I though this could apply to were actually doing something based on a fixed region

* Simplify initialisation of settings menu rects
2022-06-19 15:18:48 +02:00
Gleb Mazovetskiy de10b96bfb Fix PCX LoadFrameOffsets 2022-06-19 12:32:00 +02:00
Anders Jenbo 860bd1cebf Operate directly on SOL data 2022-06-18 21:27:05 +02:00
Andrew James 0add7a8af6 Define sizes using Size type in control.cpp/stash.cpp (#4737)
* Use appropriate types for size constants in control.cpp

* Declare constexpr value for iterating over the cells in a stash grid

* Use appropriate type for UIRectangle dimensions
2022-06-18 15:25:52 +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
ephphatha 8d0afac194 Don't preserve an unreachable vanilla bug 2022-06-14 16:21:00 +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
Andrew James 4bd1e06336 Point mega <-> world conversion helpers 2022-06-13 00:27:57 +02:00
Anders Jenbo 98a10d262e Unify PlaceMiniSet 2022-06-13 00:16:00 +02:00
ephphatha 606cc162a1 Use helpers when calculating missile velocity
eventually maybe we can move to fixed point approximations instead of using hypot and casts to double/float? probably way slower than using the FPU on modern systems though :D
2022-06-05 06:13:26 +02:00
obligaron 1608219b39 Timedemo: Create reference save game and allow comparing of reference save game with actual timedemo save game 2022-06-04 21:15:47 +02:00
ephphatha 01ee2ecefc Pretty print Size values in test failure messages 2022-06-02 15:29:18 +02:00
ephphatha d5622d5080 Add point constructor to allow comparison in test macros 2022-06-02 15:29:18 +02:00
qndel f84c35d2dc fix typos 2022-06-01 17:12:22 +02:00
Andrew James 1047e408bd Simplify logic of UpdateMissilePos using helpers from 4620 (#4621) 2022-05-31 06:58:47 +02:00
Anders Jenbo 0508311959 Cleanup block_lvid checks 2022-05-29 22:32:14 +02:00
Dmitry Marakasov 04d0950c9e Fix UB in random generator
abs(INT_MIN) is undefined behavior, so process this case without
calling abs()
2022-05-18 04:40:54 +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 c2917b1dc8 DiabloUi: Load animated PCX sprites as CEL
Reduces memory usage in menu (and thus the overall allocator pressure)
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
obligaron b62cacd1d6 Demomode: Init ControlMode to KeyboardAndMouse 2022-04-23 05:32:01 +02:00
ephphatha 6a04d441c1 Expand hot area of stash cell to include bottom-right border
This matches the behaviour of inventory cell hit logic. Previously it was possible to click exactly on a border and be unable to put an item in the stash.
2022-04-14 18:02:56 +02: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
Vladimir Olteanu 25d412d1ac Remove duplicate code in DoLighting 2022-04-14 01:21:18 +02:00
Gleb Mazovetskiy 12de70550b Fix an OOB in CEL/CL2 outline rendering
This OOB happened when rendering a sprite so that it is exactly
off-screen (touching the border but not visible) on top/bottom
while also being only partly off-screen on the left or right.
2022-04-12 01:52:53 +02:00
Gleb Mazovetskiy 4808d5c3ab Reduce debug log output of OpenAsset 2022-04-11 23:35:03 +02:00
obligaron c6c929a90c Remove MpqDir and use PrefPath instead. 2022-04-10 17:06:45 +02:00
ephphatha 93068de918 Address type conversion warnings in WordWrapString 2022-04-03 14:56:01 +02:00
Gleb Mazovetskiy 2f22d94e0d Remove OwnedCelSprite::Unowned method
Conversion is already provided by the `CelSprite(const OwnedCelSprite &)` constructor.
2022-03-23 10:09:18 +01:00
Gleb Mazovetskiy e2dbbb3d95 CelSprite: Unify width storage
Reduces the size of a CelSprite by taking advantage of the fact that
16-bit pointers are aligned, so the last bit is always 0.
2022-03-23 09:57:33 +01:00
Gleb Mazovetskiy f4bce38875 Use uint16_t for sprite widths 2022-03-06 04:49:13 +01:00
Gleb Mazovetskiy 7fede6c4cb Clean up owned/unowned CelSprite ambiguity
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.
2022-03-06 04:49:13 +01:00
qndel 9ba64ad08b TRN rewrite + bugfix (#4056)
* working new TRN system
* apply TRNs to all unique missiles
2022-02-20 14:28:51 +01:00