Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace msvcrt80 {
- #pragma pack(push)
- #pragma pack(1)
- // This is just a legacy MSVCRT80 optimization on double types that doesn't match modern compilers
- struct double_t { // size = 0x08 bytes
- double _underlyingData;
- static_assert(sizeof(_underlyingData) == 8, "Size mismatch");
- inline operator double(void) const {
- return _underlyingData / *reinterpret_cast<const double *>(std::address_of(static_cast<const std::uint64_t &&>(UINT64_C(0x0000000010000000))));
- }
- };
- #pragma pack(pop)
- } // msvcrt80
- namespace War3D {
- namespace Battle {
- #pragma pack(push)
- #pragma pack(1)
- struct Unit { // size = 0x5F8 bytes
- std::uint8_t __padding000[0x328]; // 0x000
- enum class SpritesBoundsType { LEFT = 0U, BOTTOM, TOP, RIGHT };
- msvcrt80::double_t spritesBounds[4][2]; // 0x328, [l,b,t,r][x,y] -> left/bottom/top/right-most registered position of a non-dead sprite instance
- std::uint8_t __padding368[0x290]; // 0x368
- };
- #pragma pack(pop)
- } // namespace Battle
- } // War3D
- const auto *unit = static_cast<const War3D::Battle::Unit *>(unitAsOpaque); // unitAsOpaque obtained from CXUnit::operator const CUnit *()
- const float min_x = unit->spritesBounds[SpritesBoundsType::LEFT][0].operator double();
- const float min_y = unit->spritesBounds[SpritesBoundsType::BOTTOM][1].operator double();
- const float max_x = unit->spritesBounds[SpritesBoundsType::RIGHT][0].operator double();
- const float max_y = unit->spritesBounds[SpritesBoundsType::TOP][1].operator double();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement