Commit graph

600 commits

Author SHA1 Message Date
ephphatha
da4ae52886 Move objects_set_door_piece next to DoorSet
these two functions are always called together, can probably be combined or have a wrapper introduced

Move SyncL1Doors to near declarations of other SyncDoors functions
2021-07-10 01:03:24 +02:00
ephphatha
b0023be41e Remove unnecessary temporaries from SyncL3Doors
Simplify checks in SyncL3Doors

The function is only called with objects of type L3LDOOR or L3RDOOR so there's no real need to check again.

Take door by reference in SyncL3Doors

Removes one use of the Objects global.

Door by reference 2, SyncL2Doors

Simplify logic in SyncL2Doors to match L3Doors

Almost the same code, can probably be combined to a single function with appropriate parameters.

Use Point in DoorSet params

Use switch in DoorSet

Instead of a whole bunch of if statements where only one can be true

Replace object index with type in DoorSet

This function doesn't need any other object property. Still references the dPiece global unfortunately.

SyncL1Doors door by reference

Replace code that mutates a copy of door position with Direction

Inline if/else statement for L1LDOOR

Only difference is the value of the second parameter
2021-07-10 01:03:24 +02:00
ephphatha
36ff5578fd Refactor LoadMapObjects/LoadMapObjs to take Point instead of int x/y 2021-07-09 18:00:08 +02:00
ephphatha
3a517048f7 Refactor ObjIndex to take Point instead of int x/y
Also updated declaration of temporary/local variables to match
convention. This includes inlining int oi in LoadMapObjects as this
matches the way SetOBjMapRange is called in other areas.
2021-07-09 17:59:07 +02:00
ephphatha
19ae61811f Refactor AddObject to take Point instead of int x/y 2021-07-09 17:58:34 +02:00
ephphatha
e4b434b2ef Refactor SetupObject to use Point 2021-07-09 17:57:45 +02:00
ephphatha
288d691678 Refactor OperateShrineTown to use Point
Also added documentation about what the function does.
2021-07-09 17:57:01 +02:00
ephphatha
c2cf2f8b59 Refactor OperateShrineSparkling to use Point
Also added documentation about what the function does.
2021-07-09 17:56:27 +02:00
ephphatha
61a2cf9ac8 Refactor OperateShrineOily to use Point
Also added documentation about what the function does.
2021-07-09 17:55:57 +02:00
ephphatha
bc386a4701 Refactor OperateShrineDivine to use Point
Also added documentation about what the function does.
2021-07-09 17:55:20 +02:00
ephphatha
73cf62179c Refactor ObjSetMini to use Point 2021-07-09 18:52:51 +10:00
ephphatha
e668d215f2 Refactor objects_set_door_piece to use a Point param 2021-07-09 18:52:51 +10:00
ephphatha
cbe542c52e Refactor Add*Door functions to use more descriptive parameters 2021-07-09 18:52:50 +10:00
ephphatha
a3d155f552 Remove unnecessary temporaries from Obj_Light
This function can use Point member functions to perform the logic that determines when to show lights.
2021-07-09 18:52:50 +10:00
ephphatha
6f40f0dd88 Refactor ObjSetMicro to take a Point parameter 2021-07-09 18:52:50 +10: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
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
dce78dde62 Rename lighting 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
Vladimir Olteanu
d969672895 Check for negative random values in tear fountain logic 2021-07-05 17:11:54 -07:00
Anders Jenbo
56d3b5d710 clang-tidy/Android Stuidio cleanups 5 2021-07-05 13:14:47 -07:00
Vladimir Olteanu
04751418e0 Refactor tear fountain logic; remove GenerateRnd loop 2021-07-05 12:23:10 -07:00
ephphatha
08ae390643 Add explicit casts for some implicit conversions
Some of these were triggering multiple warnings due to casts applied at times which forced potentially truncating operations.
2021-07-05 08:52:05 -07:00
Anders Jenbo
bc0d1f7ac0 clang-tidy/Android Stuidio cleanups 3 2021-07-04 16:09:32 -07:00
Anders Jenbo
cb564a2d54 Clean up A-D 2021-07-04 05:25:37 -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
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
129342d07a Clang-tidy: GlobalConstantCase 2021-07-02 22:56:56 +02:00
Anders Jenbo
d9e0658643 Clang-tidy: basic naming 2021-07-02 22:55:01 +02:00
Anders Jenbo
d95a99d9a4 Clean up objects var init 2021-07-02 06:30:05 -07:00
qndel
373f1db22e
If cleanup + bugfixes (#2273) 2021-07-01 18:32:25 +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
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
2fa4178aff Refactor Operate*Door functions with meaningful variable names 2021-06-26 10:12:28 -07: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
22b632f04a ♻️Clean up implicit bool conversions 2021-06-26 08:57:59 -07:00
Anders Jenbo
f2e24fee3d 🐛 Fix trap direction 2021-06-25 13:22:08 +02:00
Vladimir Olteanu
95643029e3 Refactor missiles.cpp
Use Point wherever possible
Make some functions static (not exhaustive)
Reduce excessive indentation (not exhaustive)
Declare variables as needed (not exhaustive)
2021-06-21 12:10:37 -07:00
Gleb Mazovetskiy
e40b1963f9 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
qndel
70bf808512 change 1 to bool 2021-06-13 16:50:06 +02:00
ephphatha
0c99ae0206 Add descriptive name and comments for the Na-Krul spell tome check function 2021-06-13 13:54:30 +02:00
qndel
816b244689 HasItem/RemoveInvItem combo refactor 2021-06-13 05:18:08 +02:00