* Change defines to constexpr int in player.h
* Add const or constexpr to player.h/cpp where applicable
* Update tests with changed names of player constatns
* remove unecessary variable
* AnimationInfo class correct case-style for private members
clang-tidy warnings:
readability-identifier-naming invalid case style for private member
* AnimationInfo class correct case-style for members
clang-tidy warnings:
readability-identifier-naming invalid case style for member
* AnimationInfo class correct case-style for methods
clang-tidy warnings:
readability-identifier-naming invalid case style for method
* AnimationInfo class use nodiscard
clang-tidy warnings:
modernize-use-nodiscard function should be marked [[nodiscard]]
* Non-int versions of `Point` and `Displacement`
This will allow us to make some structs, such as `ActorPosition`, much
smaller.
* ActorPosition: Use smaller types
`Monsters`: 56K -> 46K
* player.cpp: Reduce size of `DirectionSettings`
* CrawlTable: Displacement -> DisplacementOf<int8_t>
* CrawlTable: vector<vector> -> array<vector>
Also only allocate one vector during construction instead of two.
A bit less indirection.
* Monster#enemyPosition: Point -> WorldTilePosition
sizeof(Monster): 240 -> 232
* Monster: Further optimize field layout and sizes
sizeof(Monster): 232 -> 208
`Monsters` is down to 40,000 bytes
* DMonsterStr: _mx/_my -> position
MI_FireRing adds missiles MIS_FIREWALL with TARGET_BOTH and src equals
to either player ID, or -1 if Fire Ring is casted as trap. This has
consequences:
1. Because TARGET_BOTH MonsterMHit was called, as it usually called for
Firewalls. During this calls reference to Player gets garbage data (id
-1). This may miscalculate:
- no heal flags
- knockback flags (already fixed in this PR)
- unsquelch position.last
2. drops ear for firewall flame originating from Fire Ring from trap
Fix:
- Separated TARGET_BOTH from IsTrap for monsters to ensure TryHitMonster
will get passed TrapMissile (MonsterTrapHit) is called instead.
- added additional condition for earflag
eventually maybe we can move to fixed point approximations instead of using hypot and casts to double/float? probably way slower than using the FPU on modern systems though :D
The Deadly Hunter bow contains the 3XDAMVDEM affix power which isn't present in missiles.cpp, preventing the affix from doing anything altogether. This fix adds the logic from player.cpp in a consistent way with how damage gets handled in melee combat.
The multiplication by `1 << 21` was unnecessary, with the way the division is performed it doesn't add precision. Missile velocities are 16 bit fixed values so split out the normalisation step in order to make it clearer what the multiplication and use of `v` ends up doing.