You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
383 B
23 lines
383 B
#pragma once |
|
|
|
namespace devilution { |
|
|
|
constexpr int HpManaFracBits = 6; |
|
constexpr int HpManaScale = 1 << HpManaFracBits; |
|
|
|
constexpr int HpManaToFrac(int whole) |
|
{ |
|
return whole * HpManaScale; |
|
} |
|
|
|
constexpr int HpManaToWhole(int frac) |
|
{ |
|
return frac / HpManaScale; |
|
} |
|
|
|
constexpr int HpManaFromParts(int whole, int frac) |
|
{ |
|
return HpManaToFrac(whole) + frac; |
|
} |
|
|
|
} // namespace devilution
|
|
|