Commit graph

248 commits

Author SHA1 Message Date
Juliano Leal Goncalves
bbf529c65a 🚚 Rename 'PlayerStruct' to 'Player' 2021-08-30 06:44:18 +02:00
Anders Jenbo
4044fadeb5 Clean up some players references 2021-08-30 03:26:17 +02:00
Anders Jenbo
866bc56008 Clean up remaning usages of Missiles[] 2021-08-28 09:16:48 +02:00
BC Ko
536121f038 rename _miVar# to var# 2021-08-27 12:57:34 +02:00
BC Ko
4df798808e
2435 refactor global variable Items part 2 (#2673) 2021-08-26 08:06:48 +02:00
qndel
3d92b6eea5 Rewrite manashield into not using a missile 2021-08-25 19:32:10 +02:00
Anders Jenbo
96b19ca8d5 Set _micaster type to mienemy_type
Rino never made use of the player id, so no reason to abuse _micaster
2021-08-23 10:51:06 +02:00
Anders Jenbo
7f6e171b4b Use BFLAG_MISSILE instead of dMissile 2021-08-22 21:21:33 +02:00
Anders Jenbo
3df8af0e9d Apply missile_id to _mitype 2021-08-21 09:10:53 +02:00
BC Ko
1b91194f0f
refactor Items[ii] (#2655) 2021-08-21 03:30:39 +02:00
qndel
e355d03019 Rename SetDead 2021-08-21 02:11:41 +02:00
Anders Jenbo
5ddcd90ff9 Make NetSendCmdQuest() take a quest structure as input 2021-08-20 12:13:17 +02:00
Anders Jenbo
4891258775 Clean up quest init 2021-08-20 12:13:17 +02:00
ephphatha
8f2e94ae4d Use unsigned types for player experience and related values 2021-08-12 13:38:05 +02:00
Vladimir Olteanu
b76e8c060b Introduce MissileDataFlags 2021-08-12 00:19:09 +02:00
Anders Jenbo
8df8b940c4
Handle some clang-tidy issues 2021-08-07 16:30:14 +02:00
Anders Jenbo
069249f318 🚚 Move local function to anonymous namespace i-p 2021-07-19 05:44:20 +02:00
obligaron
91c8503ea5 Rename leaderflag to leaderRelation and MonsterRelation to LeaderRelation 2021-07-18 21:08:32 +02:00
obligaron
70db8456ba Remove _pwtype and replace it with UsesRangedWeapon 2021-07-17 17:38:28 +02:00
Anders Jenbo
a089692850 💄 Introduce MonsterRelation enum 2021-07-15 19:48:55 +02:00
Anders Jenbo
77b72da276 ♻️Use monster by reference when possible 2021-07-14 20:22:35 -07:00
Anders Jenbo
ef6275caac Clean up private function names 2021-07-12 17:59:22 -07:00
Anders Jenbo
4bf4e42230 Move local symbols to anonymous namespace 2021-07-12 17:59:22 -07:00
ephphatha
cc3572af81 Update BookLever related functions to use Rectangle.
This is mainly to help isolate functionality in the hopes of adding a specialised object class for this type of object as suggested by @julealgon in https://github.com/diasurgical/devilutionX/pull/2344#discussion_r667415019

For example, AddSCambBook performs almost the same logic but uses var6 instead of var8 for the trigger condition/identifier.
2021-07-11 05:09:13 -07:00
Andrew James
af60158274
Object by reference in SyncObjectAnimation functions (#2344) 2021-07-10 14:03:44 +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
467b74dc06 Rename object globals 2021-07-08 02:01:14 -07:00
Anders Jenbo
9ae908f947 Rename missile 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
Andrew James
c7e3bb4ae7
Introduce template form of skip to represent deprecated variables (#2309) 2021-07-05 14:51:44 +02:00
Anders Jenbo
bc59218d0d More clang-tidy/Android Studio cleanups 2021-07-04 19:34:37 +02: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
ee2e7518c4 Clang-tidy: FunctionCase part 2 2021-07-03 12:36:04 -07:00
Andrew James
3508aa6d3d
Align Life/Mana flask drawing routines (#2291)
* Clamp hpPer as a sanity check
* Refactor update mana routines in control.cpp to use PlayerStruct::UpdateManaPercentage
* Remove unnecessary calls to UpdateHP/ManaPercentage
* Unify logic that draws the flasks into a single internal function
* Fix style violations
* Remove unnecessary save/loads of hp/manaPer

The way this variable is used expects a value in this range and it gets clamped again anyway, but this makes the code more similar to the manaPer logic for future refactoring

Identical logic in use, the checks to see if the values are negative can be accomplished using clamp and the same divide by zero guard. I'll combine the two attributes in a near future commit.

control_update_life_mana is called during the game loop before any of the drawing functions so hpPer/manaPer are calculated based on the latest current/max of their respective attributes every frame.

There's no need to do the calculation again in the draw routines. (There's also no need to calculate this every frame but that's going to take a bit to untangle.)
2021-07-03 18:06:24 +02:00
Gleb Mazovetskiy
f84c892807 SaveHelper: Write zeroes on skip
Instead of writing uninitialized memory to the file, which can lead to
issues with older game versions, we now write zeroes.

One alternative would be to have separate `skip` and `blank` functions
but I think we want the save files from the same state to be
byte-identical, so we always write zeroes.

Fixes #2281
2021-07-03 07:26:48 +01:00
Anders Jenbo
b71b0149a3 Clang-tidy: ConstexprVariableCase 2021-07-03 03:09:43 +02:00
Anders Jenbo
d9e0658643 Clang-tidy: basic naming 2021-07-02 22:55:01 +02:00
qndel
dadf418fe0
fix typo (#2266) 2021-06-29 19:15:01 +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
Andrew James
20190ee687
Update random number functions to avoid IB (#2226)
* Update random number functions to avoid IB

Most calls to set seed were using uint32_t already, there were a few variables which were better served by having their type changed from signed to unsigned. The one exception is ItemStruct::_iSeed. This is an identifier that also happens to be used as a seed occasionally so a comment was added documenting this exception.

Includes suggested style changes for Source/towners.h; Source/towners.cpp; Source/msg.h; Source/multi.h
2021-06-27 10:37:09 +02:00
obligaron
3a9cc631c7 Rename DelayLen -> TicksPerFrame
Rename DelayCounter -> TickCounterOfCurrentFrame
2021-06-27 01:26:49 -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
871f168ea0 Clang-tidy: bugprone-reserved-identifier 2021-06-27 02:59:07 +02:00