Commit Graph
293 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
Anders Jenbo 99181fd709 Move more files to the engine folder 2022-06-24 11:08:15 +02:00
Gleb Mazovetskiy de3c9874c7 Migrate large bool arrays to std::bitset
E.g. `dRendered` size is reduced by 10 KiB
2022-06-21 01:59:13 +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
Andrew James 60b835214b Address warnings in Utf8 functions (#4748)
* Use explicit typecasts to force signed char comparisons

Avoids warnings about tautological comparisons (either the >= 0 comparison for ARM/PowerPC or the <= 127 comparison for x86*)

* Remove unused function
2022-06-19 13:32: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
Gleb Mazovetskiy b7404af9c7 Fix build with NONET and no exceptions
Fixes the build with `-fno-rtti` and `-fno-exceptions`.

Building with these flags reduces the binary size by more than 200 KiB.
2022-06-18 14:05:10 +02:00
ephphatha e246ac78db Simplify character test in UiValidPlayerName 2022-06-18 14:02:48 +02:00
ephphatha 34b7d85263 Add IsLeadUtf8CodeUnit to complement trail byte detection 2022-06-18 14:02:48 +02:00
ephphatha 3c173df83b Update comment on IsTrailUtf8CodeUnit
Also use char literals instead of int literals.
2022-06-18 14:02:48 +02:00
Gleb Mazovetskiy 563ee3af7c Optimize FormatInteger 2022-06-18 13:57:22 +02:00
Vladimir Olteanu 2cc9d70fa6 Use decimal separators for gold and XP (#4722) 2022-06-18 09:13:59 +02:00
Gleb Mazovetskiy f22d1d0149 Remove uses of deprecated codecvt
codecvt is deprecated in C++17 and we don't really need all of its heavy
machinery for simply converting to UTF-8.
2022-06-16 13:54:29 +01:00
Gleb Mazovetskiy 9d2948c782 Loading screen: Free the background early
Frees the background after blitting it once in the loading screen.
This gives the game more RAM for the actual loading.
2022-06-15 12:22:28 +02:00
Gleb Mazovetskiy ede7eab7e8 Fix -wnarrowing from SDL_Rect construction 2022-06-15 11:12:42 +01: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
staphen 421a7772b4 Fix error that produces broken character at end of UTF8 string 2022-06-09 11:10:34 +02:00
staphen 695851666e Fix crash when switching to English 2022-06-05 00:59:57 +02:00
Gleb Mazovetskiy 99d490180c Settings: Add Resampler
Makes the resampler algorithm configurable from the settings menu.
2022-05-31 05:21:42 +01:00
obligaron d86c4e5d84 Introduce GetUIRectangle() to distinguish between UI and main panel 2022-05-29 20:20:44 +02:00
obligaron 5337bf1f6a Initialize Viewport in CalculatePanelAreas 2022-05-29 20:20:44 +02:00
Gleb Mazovetskiy 85f0802f01 printInConsole: Add string_view support
Also print `\r\n` instead of `\n` on Windows.
2022-05-11 10:57:01 +01:00
ephphatha 7f15aa730d Move definition of ghMainWnd to utils/display.cpp
This variable is controlled/set by the code in that file, this also lets other files have more specific/relevant includes instead of the monolith that is diablo.h
2022-05-08 12:09:12 +02:00
Gleb Mazovetskiy 978bae1a15 Add a helper for loading PCX as CEL from path 2022-04-25 05:31:26 +01:00
Gleb Mazovetskiy 7b98735878 Revert "An option to RLE-compress masked art"
This reverts commit c884f1a354.

Superceded by `DEVILUTIONX_CONVERT_FONTS_TO_CEL`, which offers the same
RAM reduction but without slowdown.
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 5eeaa76a75 Move PCX code to utils/pcx.cpp 2022-04-25 05:31:26 +01:00
widelec-BB 9fdebdce7a Fix loading tranlations on big endian platforms 2022-04-24 16:19:49 +02:00
DakkJaniels dad46e1905 Item special effect enum (#4129) 2022-04-19 15:44:46 +02:00
ephphatha adba5c4441 Add hint to avoid bugprone-use-after-move warnings
Makes clang (and GCC) consider item.Clear() a reinitialisation of a moved variable - see https://clang.llvm.org/extra/clang-tidy/checks/bugprone-use-after-move.html#reinitialization
2022-04-19 09:54:19 +01:00
Gleb Mazovetskiy 4cdbd358dd Audio: Use SDL resampler where available 2022-04-16 04:20:47 +02:00
Gleb Mazovetskiy 127615c33f Fix conversion of C-string literal to char* 2022-04-14 05:11:37 +02:00
Gleb Mazovetskiy 7f695c2835 Use SoundSample for music
Unifies audio handling between sound effects and music.
2022-04-14 03:11:37 +02:00
Anders Jenbo 34201c7881 Do not set scaling hint with out a render 2022-04-13 18:54:01 +02:00
Anders Jenbo ce5bd1df74 Show failing line in error messages 2022-04-13 18:54:01 +02:00
Anders Jenbo 122ec0ac9d Fix crash when switching to English 2022-04-13 04:52:49 +02:00
Gleb Mazovetskiy 1d4a7fa3a2 Fix SoundSample::DuplicateFrom mp3
Fixes #4392
2022-04-11 10:59:41 +01:00
staphen 84475f29ae [Windows] Recreate the whole window if the renderer would otherwise freeze 2022-04-10 20:57:43 +02:00
obligaron c6c929a90c Remove MpqDir and use PrefPath instead. 2022-04-10 17:06:45 +02:00
Gleb Mazovetskiy 5645456537 Support MP3 playback 2022-04-09 14:15:55 +02:00
Gleb Mazovetskiy 8138121e39 Fix endianness handling in language.cpp 2022-04-05 08:56:31 +01:00
ephphatha 93068de918 Address type conversion warnings in WordWrapString 2022-04-03 14:56:01 +02:00
Bubio 57d5fd0e62 Fix #4251 macOS mouse grab issue (#4298) 2022-04-02 12:32:32 +01:00
ephphatha bdf075355c Address c4244 warning in PointerOrValue
This triggers a bunch of warnings in MSVC because the conversion is potentially truncating, despite never being an issue in practice...
2022-03-30 12:27:28 +01:00
Gleb Mazovetskiy a5a8aae368 Fix underflow in BilinearScale32
Fixes funky hardware cursor colors during fade transitions.

Refs #4206
2022-03-30 11:55:10 +01:00
Bubio 036171d7ca Fixed issue #4217
DPI Scale is now included in the calculation.
2022-03-27 17:46:16 +02:00
Gleb Mazovetskiy e627fc8f10 Fix alpha blending in BilinearScale32
Fixes #4206
2022-03-26 19:09:04 +00:00
Gleb Mazovetskiy c884f1a354 An option to RLE-compress masked art
Saves about 200 KiB RAM in dungeon at a large performance cost.
Almost never a good idea, except for severely RAM-constrained devices (e.g. RG99).
2022-03-23 15:38:38 +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