* 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.)
* 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
Disabled by default because of these known issues:
1. When clicking on inventory item, it briefly appears a bit shifted (in the wrong coordinates).
This issue can happen with software cursor as well, but is a lot more
obvious with the hardware cursor.
2. Cursor is scaled with nearest-neighbour scaling, which may look a bit different from
how the rest of the graphics are scaled.
See also previous attempt: https://github.com/diasurgical/devilutionX/pull/955 by @viciious
Co-authored-by: Victor Luchits <vluchits@gmail.com>
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.