Commit Graph
450 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 38e37e0d53 Fix warnings/errors with -funsigned-char 2022-12-05 07:52:13 +01:00
Gleb Mazovetskiy 680ab5ec40 Overhaul backbuffer state handling
When rendering directly to the output buffer, we need to maintain the
state of what has been drawn and what needs redrawing per-buffer.

We previously tried to do it implicitly by checking `SDL_DOUBLEBUF` and
other flags. The previous implementation was broken in several
ways, resulting in rendering issues on devices that support 8-bit output
directly.

Changes this mechanism to explicitly maintain buffer state per output
buffer. The new mechanism doesn't require knowledge of the number of
buffers, and thus also works correctly with triple-buffering.

Fixes #5447
2022-11-01 02:43:24 +00:00
qndel 841e743002 fix adria's 'you have nothing to recharge' alignment 2022-08-04 12:40:07 +02:00
Gleb Mazovetskiy 961866e1c4 CLX: A new graphics format
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.
2022-08-03 02:38:55 +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
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +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
staphen cab75ded6b Check both SPL_NULL and SPL_INVALID to determine spell validity 2022-07-09 04:04:22 +02:00
Mikołaj Piróg dda0b96ea5 Remove #defines in player.h and add constexpr where applicable (#4896)
* Change defines to constexpr int in player.h

* Add const or constexpr to player.h/cpp where applicable

* Update tests with changed names of player constatns

* remove unecessary variable
2022-07-05 17:25:23 +02: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
Anders Jenbo d82f2ebc9e Pass players by reference instead of an index 2022-06-28 00:30:00 +02:00
Gleb Mazovetskiy 8ba3387f54 Reduces stext stack use (16K -> 4K)
1. Reduces the sizes of variables in `STextStruct`.
2. `char[128]` -> `std::string`
2022-06-24 15:11:52 +03: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 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
Vladimir Olteanu 2cc9d70fa6 Use decimal separators for gold and XP (#4722) 2022-06-18 09:13:59 +02:00
Gleb Mazovetskiy 2386fd12a9 Fix a few warnings 2022-06-15 13:01:20 +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 779ccaca17 Overhaul translation fetching
1. Do not modify the map after loading. Instead, return string views
   (guaranteed to be null-terminated) from look up functions and return
   the key directly if not found.
2. Use an `unorded_map` instead of `map` where available (C++20).
   Saves a bit of RAM (~50 KiB) and improves lookup performance.
2022-06-14 12:46:36 +01:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
obligaron d86c4e5d84 Introduce GetUIRectangle() to distinguish between UI and main panel 2022-05-29 20:20:44 +02:00
Andrew James df8643ccf5 Use the count of store items instead of repairOk flag (#4576)
Cursed items (with an item value of 0) will not be added to the list of items by AddStoreHoldRepair. This results in a situation where a player can try repair a null/invalid item because StartSmithRepair doesn't realise that no items are available to be repaired.
2022-05-15 09:02:56 +02:00
DakkJaniels fc1d699bb2 Restore randomization of stores for multiplayer games 2022-04-27 05:24:59 +02:00
ephphatha 64a2c41b2c Set clang-tidy config for MethodCase option
Previously this was falling back to FunctionCase, leading to inconsistent casing of class methods throughout the codebase. Applied to Item as an example.
2022-04-20 13:50:57 +02:00
ephphatha 7e7798fd2b Add function to mark an item as empty 2022-04-18 19:25:55 +02:00
Anders Jenbo 4f0ddf5c17 Remove use of HoldItem from stores.cpp 2022-04-18 09:50:23 +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
staphen af9ab6d9e2 Restore durability to items in stores 2022-04-13 04:23:33 +02:00
Gleb Mazovetskiy 3488b2225c Split up store title from "Your gold" 2022-04-11 22:44:32 +01:00
staphen 95329fa72b Remove calls to NewCursor() from store functions 2022-03-31 05:03:13 +02:00
obligaron 84f19e6b29 Wirt: Ensure _iStatFlag is updated before getTextColorWithStatCheck is called (#4258) 2022-03-29 19:48:17 +02:00
Anders Jenbo 8a3cfb5acf Enable buying with gold from stash (#4218) 2022-03-23 07:22:50 +01:00
Anders Jenbo 1ba817ca53 Unify gold handling (withdraw any amount from stash) 2022-03-22 21:38:51 +01:00
obligaron 3e9ca60460 Update _iStatFlag for stash items 2022-03-20 23:42:55 +01:00
Anders Jenbo 1409e604f5 Reduce string conversions 2022-03-20 11:04:15 +01:00
Anders Jenbo 718c46e7fe Remove use of tempstr 2022-03-19 06:03:19 +01:00
Anders Jenbo a48f89007d Implement stash 2022-03-18 06:01:53 +01:00
Anders Jenbo 770727b5a0 Correct Leave Pepin menu posision 2022-03-16 21:06:14 +01:00
Gleb Mazovetskiy bd5647fb06 Fix premium items reroll on level change
Bug introduced a few commits ago in 1519e995cf

Fixes #4036
2022-02-06 18:45:07 +01:00
Gleb Mazovetskiy 1519e995cf Move store graphics out of stores.cpp
These graphics are used in various places outside of `stores.cpp`.
2022-01-30 14:56:04 +01:00
Anders Jenbo 6d346c7e18 Use std::string in PrintItemPower 2021-12-13 01:02:07 +01:00
Anders Jenbo af08a99691 Perform item requirement check when entering vendors 2021-12-13 00:56:38 +01:00
obligaron ff5de056fa Add all (boolean) Game Settings to Settingsmenu (#3616) 2021-11-26 23:43:46 +01:00
Gleb Mazovetskiy dbdae7b389 Fix the divider line position in the help menu
Fixes #3552
2021-11-20 14:45:31 +00:00
Gleb Mazovetskiy e29c1d05a2 Improve Help screen layout + fix CJ 2021-11-20 02:31:21 +00:00
Gleb Mazovetskiy 4f64b87330 Fix talk/store text overlap for Chinese and Japanese
We ensure that selectable lines are placed at the same vertical
coordinates but space out unselectable text lines at the cost
of reduced heigh of empty space between the store items.

We also have to move the back button in scrollable lists to the
lower right.

This can definitely be improved further but at least it solves
the problem for now.

Refs #3162
2021-11-20 02:31:21 +00:00
Anders Jenbo b21e92baae Mark store owner names for translation 2021-10-31 23:18:38 +01:00
obligaron 98ecd0ecc5 Introduce CloseGoldDrop 2021-10-27 00:06:30 +02:00
qndel eba6d827bf fix typos (#3238) 2021-10-24 18:03:29 +02:00