Sanitized and improved several macros through the code

- Sanitized all potentially unsafe macros (related eA:15259)
- Improved some function-like macros to evaluate their argument only
  once and keep it in a temporary variable.  This improves performance
  in the damage calculation related code.

Signed-off-by: Haru <haru@dotalux.com>