482 Commits
Author SHA1 Message Date
obligaron 95205294e8 Fix MSVC x86 warnings 2023-12-22 17:03:01 +01:00
obligaron ecb781db03 Fix MSVC warnings in stores.cpp 2023-12-17 19:43:14 +01:00
Anders Jenbo bb2e189327 Convert _sfx_id in to class enum 2023-11-02 14:34:24 +01:00
Gleb Mazovetskiy e5881688f4 text_render: Replace optional args with struct
4 options args are a bit unwieldy, especially when you want
to pass only the first and the last one.

With a struct, there is no need to specify the default values
for the args in between.
2023-10-25 09:19:14 +01:00
KPhoenix db1ab771d6 Bugfix: Indestructible Items at Smith Repair 2023-09-30 23:50:48 +02:00
ephphatha 24a20ce8e2 Extract uses of MyPlayer to prevent future crashes in tests/game init 2023-09-20 05:49:54 +02:00
Eric Robinson e60a4dca3e Close Towner window when clicking outside (#6504) 2023-08-26 01:04:13 +02:00
ephphatha da76e131e4 Add getter/setter for character levels to ensure _pNextExper stays synced 2023-08-24 05:46:44 +02:00
Gleb Mazovetskiy 8c1a847f41 Remove utils/stdcompat/string_view.hpp 2023-08-14 09:59:14 +01:00
Gleb Mazovetskiy e9b5ec77f9 Remove AppendStrView 2023-08-14 01:54:29 +01:00
Gleb Mazovetskiy c19bfe87fa Remove utils/stdcompat/algorithm.hpp 2023-08-14 01:54:29 +01:00
qndel 728b632960 fix typos 2023-08-12 18:10:22 +02:00
qndel 1e6277595d deduplicate NPC sell/buy code 2023-08-12 17:48:33 +02:00
DakkJaniels ad19caf667 Move hp/mana display and item graphics to gameplay options 2023-07-14 03:12:29 +02:00
Andrew James 1b7608ea3b Map from _talker_id to towner pointer when using gossip option (#6136) 2023-05-22 13:25:53 +02:00
Gleb Mazovetskiy 4fa3732526 Add missing <cstdint> includes
Done with the following script:

```ruby
Dir["Source/**/*.{h,c,cc,cpp,hpp}"].each do |path|
  v = File.read(path)
  next if !v.include?("uint32_t") || v.include?("cstdint")

  lines = v.lines
  line_num = if lines[2].start_with?(" *")
    lines.index { |l| l.start_with?(" */") } + 3
  else
    3
  end

  lines.insert(line_num, "#include <cstdint>\n")

  File.write(path, lines.join(""))
end
```

then fixed-up manually
2023-05-10 13:50:12 +01:00
ephphatha b7b9996290 Remove global gossip variables and Towner::seed
Replace this with a direct reference to the chosen gossip topic when towners are init.
2023-05-06 18:01:38 +02:00
obligaron 7985a9211d Change Player::_pSplLvl to uint8_t 2023-04-24 18:19:27 +02:00
obligaron b916c8e428 Introduce Open/Close/ToggleCharPanel 2023-04-14 02:40:17 +02:00
obligaron 590c990c80 Introduce Item::getName 2023-04-13 00:07:00 +02:00
staphen 695949d901 Sync staff charges after recharging 2023-03-05 23:59:21 +01:00
Gleb Mazovetskiy ebcd6b222d Optimize SpellData size: 40 bytes -> 24 2023-02-10 10:51:06 +00:00
KPhoenix 8955700e67 Refactor enums 2023-02-09 13:04:01 +01:00
KPhoenix a1fbf5253f enum talk_id -> enum class TalkID 2023-02-09 13:04:01 +01:00
Gleb Mazovetskiy b61dac853b Add GetSpellData(SpellID) 2023-02-05 12:12:48 +00:00
KPhoenix d813f13700 enum spell_id -> enum class SpellID 2023-02-05 10:24:58 +00:00
Gleb Mazovetskiy 1401e130ce Store items: Render 1x1 items at full size 2023-01-23 03:15:40 +01:00
Gleb Mazovetskiy 67bb0e10fd Store items: Draw unusable items in red
We generate separate downscaled sprites for the red versions
because simply applying TRN after downscaling leads to some
non-red pixels (because of blending during downscaling).
2023-01-23 01:53:14 +00:00
Gleb Mazovetskiy c5369f4b2b Store graphics: Scale sprites only once
Prepare downscaled sprites once instead of doing it on every frame.

Note that we do this lazily in `StartStore` rather than
`SetupTownStores` because we need the palette blending table to be
available when downscaling.
2023-01-22 14:56:25 +00:00
staphen 3e916d4c1f Align item graphics with the center of the store text 2023-01-22 05:26:13 +01:00
staphen d707f07e8f Make item graphics in stores optional 2023-01-22 00:39:20 +01:00
staphen af5dc9ccb6 Add item graphics to store menus 2023-01-22 00:39:20 +01:00
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