Commit graph

797 commits

Author SHA1 Message Date
matheusgomes28
42e2c174ac
Refactored parameters of "StartItemPower(...)" and code around calls to it. (#2345)
Co-authored-by: Matheus Gomes <mgomes1@jaguarlandrover.com>
2021-07-10 18:04:42 +02:00
Anders Jenbo
903d4bd2e1 Scope all for loops
This caused 7 of the loops to be rewriteen using range by clang-tidy
2021-07-08 08:14:03 -07:00
Anders Jenbo
9ebdb6db69 General clean up 2021-07-08 03:30:25 -07:00
Anders Jenbo
467b74dc06 Rename object globals 2021-07-08 02:01:14 -07:00
Anders Jenbo
9b8bf92575 Rename quest globals 2021-07-08 02:01:14 -07:00
Anders Jenbo
96bf75b502 Rename player globals 2021-07-08 02:01:14 -07:00
Anders Jenbo
c8870dbd1f Rename item globals 2021-07-08 02:01:14 -07:00
Anders Jenbo
07ad083fda Rename monster globals 2021-07-08 02:01:14 -07:00
ephphatha
be23f6864b Reorder int *= float operations that could be expressed using int fractions
This was triggering narrowing conversion warnings in msvc. I assume the compiler can optimise this into a float multiplication if it does turn out faster.
2021-07-05 08:52:05 -07:00
Anders Jenbo
bc59218d0d More clang-tidy/Android Studio cleanups 2021-07-04 19:34:37 +02:00
Gleb Mazovetskiy
55464eec78 Fix -Wmissing-braces
Fixes warnings such as this one:

```
../../../../../../Source/engine/render/text_render.hpp:83:33: warning: suggest braces around initialization of subobject [-Wmissing-braces]
        return DrawString(out, text, { position.x, position.y, out.w() - position.x, 0 }, flags, spacing, lineHeight, drawTextCursor);
                                       ^~~~~~~~~~~~~~~~~~~~~~
```
2021-07-03 19:08:45 -07:00
Anders Jenbo
a7c7fa0030 Fully apply clang-tidy/format to all files 2021-07-03 16:41:43 -07:00
Anders Jenbo
ecea12fc15 Clang-tidy: ParameterCase 2021-07-03 15:46:39 -07:00
Anders Jenbo
ee2e7518c4 Clang-tidy: FunctionCase part 2 2021-07-03 12:36:04 -07:00
Gleb Mazovetskiy
cb0dae8590 🚚 Rename CelOutputBuf to Surface and extract 2021-07-03 05:33:32 -07:00
Anders Jenbo
a350fb0b15 Clang-tidy: FunctionCase part 1 2021-07-03 03:45:33 +02:00
Anders Jenbo
4cd916a085 Clang-tidy: EnumConstantCase 2021-07-03 02:49:14 +02:00
Anders Jenbo
7e737cfa96 Merge remote-tracking branch 'refs/remotes/devilution/master' 2021-07-03 01:44:45 +02:00
Anders Jenbo
e426c38adb Correct AddInitItems 2021-07-02 23:08:43 +02:00
Anders Jenbo
d9e0658643 Clang-tidy: basic naming 2021-07-02 22:55:01 +02:00
Anders Jenbo
b1d237c823
More init clean up (#2262) 2021-06-29 06:37:38 +02:00
Juliano Leal Goncalves
cbb84199c2 ♻️ Replace Point addition with 'Point + Displacement' 2021-06-28 20:37:44 -07:00
ephphatha
357f6f1dc3 Move RNG functions to their own header/source files 2021-06-27 03:09:41 -07:00
obligaron
3ba4bac5e2 Harmonize DelayLen for Player and Monster (was 1-based on monseter (>= DelayLen) and 0-based on player (> DelayLen). Now both are 1-based (>= DelayLen) 2021-06-27 01:26:49 -07:00
Anders Jenbo
8a4d38dd74 Stabalize clang-tidy runs 2021-06-27 03:42:51 +02:00
Anders Jenbo
f167bd4dfb Clang-tidy: llvm-include-order 2021-06-27 01:45:49 +02:00
Anders Jenbo
de4ced7e4f Clang-tidy: readability-qualified-auto 2021-06-27 00:56:08 +02:00
Anders Jenbo
f4f8f22699 Clang-tidy: readability-redundant-control-flow 2021-06-27 00:56:08 +02:00
Anders Jenbo
bf221f4322 Clang-tidy: readability-simplify-boolean-expr 2021-06-26 23:12:22 +02:00
Anders Jenbo
2bdb6caa07
Cleanup majority of remaning implicit bool conversions (#2234) 2021-06-26 21:05:45 +02:00
ephphatha
f4f6a8a51e Refactor PlaySfxLoc to take a Point instead of x/y params
Because of the heavy usage of this function in objects.cpp and the mixed use of aliases and direct references to the active object in Operate*Door functions I've done some refactoring of those areas beyond what is strictly necessary. Hopefully this makes sense and is reasonable to include in this change.
2021-06-26 10:12:28 -07:00
Anders Jenbo
d8fa29c972 Clean up more implicit bool conversion 2021-06-26 10:07:02 -07:00
Anders Jenbo
22b632f04a ♻️Clean up implicit bool conversions 2021-06-26 08:57:59 -07:00
Anders Jenbo
1cc0eb25ca ♻️Use ranges for loops (clang-tidy) 2021-06-25 13:22:08 +02:00
Anders Jenbo
625333dfb1 ♻️Clean up items 2021-06-24 10:45:50 -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
qndel
92d1006134 Use std::move for premiumitems shift 2021-06-23 12:46:03 -07:00
Juliano Leal Goncalves
604b72bb12 Reword potion effect descriptions for consistency 2021-06-22 13:09:05 -07:00
Gleb Mazovetskiy
e40b1963f9 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
Gleb Mazovetskiy
dcf3397139 🚚 engine.h: Extract ActorPosition 2021-06-21 01:36:20 -07:00
Juliano Leal Goncalves
d47fc924f3 ♻️ Use '_item_indexes' instead of 'int' for 'ItemStruct.IDidx' field 2021-06-14 02:07:06 +02:00
obligaron
ab3f3f3ee7 Introduce ItemStruct.SetNewAnimation(bool) to start Animations only at one location 2021-06-08 10:12:09 +02:00
obligaron
6d5291b17d Enable ADL for Items 2021-06-08 10:12:09 +02:00
obligaron
ccc1ccf9c3 Introduce ItemStruct.AnimInfo 2021-06-08 10:12:09 +02:00
Anders Jenbo
27591cc29f Fix spawn save game compatability 2021-06-06 04:51:43 +02:00
Juliano Leal Goncalves
e67683e5be ♻️ Simplify 'GetSuperItemLoc' logic using 'Point'. 2021-05-31 06:05:35 +02:00
Juliano Leal Goncalves
b0584f1925 ♻️ Simplify 'GetSuperItemSpace' logic using 'Point'. 2021-05-31 06:05:35 +02:00
Juliano Leal Goncalves
1cc121e95c ♻️ Simplify 'SpawnRock' logic using 'Point'. 2021-05-31 06:05:35 +02:00
Juliano Leal Goncalves
1bf319bc11 ♻️ Leverage 'Point' struct on 'ItemPlace' 2021-05-31 06:05:35 +02:00