Commit Graph
439 Commits
Author SHA1 Message Date
Anders Jenbo 48113d064a Clang-tidy: readability-redundant-declaration 2021-06-27 00:56:08 +02:00
Anders Jenbo 79c9078fa1 ♻️Clean up type sizes 2021-06-24 15:11:09 -07:00
Andrew James 60a47caf1b Refactor Draw* functions to use Rectangle and Point types
Added overload for DrawString taking a Point to avoid creating a rect for callers which only use position. This also documents the way DrawString operates when passed a clipping rectangle with a dimension of 0.
As part of this overload removed the logic for 0 width regions from DrawString. This does change the behaviour of the Rectangle version if called with a rect with width 0, all callers using that behaviour have been updated in this commit.

Using Rectangle/Size allowed simplifying the logic for certain calls where they could use DrawText alignment flags, previously this was manually aligning by calculating dimensions and offsetting the position. This also fixes #2169

Also includes a few instances where a temporary buffer was used to set the text to be drawn with unbounded sprintf calls, replaced those with snprintf as is recommended in modern C applications. Moving to C++ strings would be good in a future refactor.
2021-06-24 01:36:06 +02:00
Anders Jenbo ee7b32d8f6 Player by reference part 3 2021-06-24 00:53:09 +02:00
Gleb Mazovetskiy e40b1963f9 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
Juliano Leal Goncalves 25eaac78c1 ♻️ Leverage 'Size' to represent a 'Rectangle's width/height 2021-06-20 18:27:45 -07:00
Juliano Leal Goncalves e3ea6a9042 ♻️ Leverage 'Point' to represent a 'Rectangle's position 2021-06-20 18:27:45 -07:00
Juliano Leal Goncalves ff147f9280 🚚 Rename 'RECT32' to 'Rectangle' to match naming style of other core structs 2021-06-20 18:27:45 -07:00
Gleb Mazovetskiy 982260d94e Clip control.cpp draw calls
No longer crashes there when running at a resolution smaller than
640x480
2021-06-16 03:12:54 +02:00
Kalebe Alves 118efe8e6d Use Point/SDL_Rect for control functions coordinate system 2021-05-28 19:57:16 +02:00
Gleb Mazovetskiy dd3ea66fa2 ♻️ Split getTextColor(bool) into 2 functions
This is a bit more readable than using a bool argument.
2021-05-28 13:38:36 +02:00
qndel 2f3cf65b27 cleanup getTextColor 2021-05-26 15:58:14 +02:00
Anders Jenbo 8a7ec56d3a Player by reference part 2
This mostly change player to be by reference instead of by index.
But additionally it does stript checks for gold in the belt, move some
value types to the initialization and short circute a few functiongs.
2021-05-24 21:00:32 +02:00
Anders Jenbo 6ce8f13751 Apply clang-tidy to more code and do some related cleanups 2021-05-24 05:27:06 +02:00
Jmgr 0e7ada15fc Apply new format to ngexttext translations 2021-05-21 01:02:45 +02:00
Jmgr bbd39aa513 Replace sprintfs with strcpy for translatable strings 2021-05-21 01:02:45 +02:00
Jmgr 6e85cde978 Update format strings 2021-05-21 01:02:45 +02:00
Jmgr 0c27e756f7 Add fmt::format 2021-05-21 01:02:45 +02:00
Anders Jenbo a03a2c2634 Render chat panel using common text rendering 2021-05-19 14:09:33 +02:00
Anders Jenbo d723ebce1a Render help text using common text rendering 2021-05-19 14:09:33 +02:00
Anders Jenbo a11bc61ea8 ♻️Render spellbook text via DrawString 2021-05-17 03:04:56 +02:00
thebigMuh 7fbcfeb35c Adding text rendering flag to adjust spacing to fit horizontally
Now also works for multiline strings
2021-05-16 00:55:20 +02:00
Anders Jenbo 34744c068f ♻️Consitantly use %i and not %d 2021-05-15 14:17:52 +02:00
arcas 6502a3ca4d Adding resources for translation (#1973) 2021-05-15 14:12:28 +02:00
Anders Jenbo 7667880de4 🐛 Implement letter spacing in new font rendering
Fixes #1950
2021-05-13 21:52:44 +02:00
Anders Jenbo 0c2042fa52 ♻️ Player by reference
Update Source/items.cpp
Update Source/lighting.cpp
Update Source/pack.cpp
asd


ads


as
2021-05-13 01:47:46 +02:00
Anders Jenbo 68e73c0dfe 🐛 Fix infopanel text color 2021-05-12 11:40:31 +02:00
Anders Jenbo 69e7f9527a ♻️Draw character panel text using DrawString 2021-05-10 22:28:21 +02:00
Anders Jenbo e665a0c4b0 ♻️Draw info box text using DrawString 2021-05-10 22:28:21 +02:00
Anders Jenbo 72598865cc ♻️Replace PrintGameStr with DrawString 2021-05-08 18:48:19 +02:00
Anders Jenbo 68923c6c33 ✨ Generic game text render function
This should gradually replace all the direct rendering of game texts
throughout the code. The interface is made to closly mirror that of the
art fonts as that is what will eventually be used for rendering Unicode
fonts both in the menus and ingame.

fixup! ✨ Generic game text render function
2021-05-08 18:48:19 +02:00
Anders Jenbo 6321bf04d5 ♻️Pass player to towner by reference instead of index 2021-05-07 00:29:46 +02:00
Gleb Mazovetskiy 0edfa3de66 🚚 Move CEL rendering to engine/render/cel_render.cpp 2021-05-07 00:16:40 +02:00
Anders Jenbo f579b2f287 Handle cel/cl2 files as byte arrays 2021-05-06 13:17:54 +02:00
Anders Jenbo 92db72719d 🔥 Remove some unused code 2021-05-05 10:16:45 +02:00
Anders Jenbo 4e284ede14 Correct singular "Scroll" in texts. 2021-05-04 13:41:29 +02:00
Jmgr 994c5e7cfe Add a keymapper
Rename the config entry for changing the quick messages texts
Other small improvements and simplifications
Set the quick spell hotkey text to be white with a black shadow
Add QuitGame action, unbound by default
Set the ItemInfo and QuestDebug keys to be unbound by default
2021-05-03 17:51:40 +02:00
Gleb Mazovetskiy ff7fdd2848 🐞 Fix spellbook rendering crash in hellfire
Fixes a bug introduced in #1796
Frame numbers are 1-based and there are 6, not 5 frames there.
2021-05-03 04:29:17 +01:00
Anders Jenbo 3f891a4333 🌐 Correctly handle two more plural translation 2021-05-02 23:33:50 +02:00
Anders Jenbo 654a2b8834 ♻️Clean up automap code
Use Point for x,y pairs. Make helpers for drawing door and squares
2021-05-02 15:27:38 +02:00
Vladimir Olteanu d9a4ff8729 Use std::string_view for towners' names (#1750) 2021-05-02 06:51:32 +02:00
Anders Jenbo d83fa8edb3 🌐 Apply plural translation where applicable 2021-05-02 04:47:49 +02:00
Anders Jenbo 22d7d41615 🌐 Fix remaning plural form of gold related texts 2021-05-02 00:31:02 +02:00
Anders Jenbo 639e94b3d6 🌐 Use plural form translation for handeling gold related texts 2021-05-02 00:21:25 +02:00
Gleb Mazovetskiy 4408ddc127 🧹 Fix some -Wformat warnings 2021-05-01 21:59:34 +02:00
Gleb Mazovetskiy 1b8b62a8c2 ♻️ Store CEL width with the sprite itself
Instead of passing the CEL sprite width when drawing, store the CEL
width at load time in the new `CelSprite` struct.

Implemented for most sprites except towners, missiles, or monsters.
2021-05-01 20:51:55 +02:00
Anders Jenbo 48dbb47d70 🌐 Apply static translations 2021-04-29 01:21:28 +02:00
Anders Jenbo 187d547fb8 🌐 Remove unused string from the translation list 2021-04-28 01:58:00 +02:00
Mathieu Maret 8d8711a966 Apply static menu translations (#1728) 2021-04-27 14:20:31 +02:00
thebigMuh ad8f342db0 Adding constness 2021-04-26 23:30:02 +02:00