ImVec2 Draw::WorldToMinimap(Vector EntityPos) {
auto MinimapSize = vmt.MinimapRenderer->GetMinimapSize();
auto MinimapBounds = vmt.MinimapRenderer->GetMinimapBounds();
// Actual Minimap is 94% from MinimapSize above (bc of borders i guess)
auto ActualMinimapSize = static_cast<float>(MinimapSize.x * 0.94);
auto MinimapPosMin = Vector2D(0, static_cast<float>(GameData.ScreenSize.y - ActualMinimapSize));
if (GameData.IsHUDFlipped) {
float offset = GameData.ScreenSize.x - ActualMinimapSize;
MinimapPosMin.x = MinimapPosMin.x + offset;
}
ImVec2 Scaler;
Scaler.x = MinimapBounds.x / ActualMinimapSize * 2;
Scaler.y = MinimapBounds.y / ActualMinimapSize * 2;
ImVec2 PosOnMinimap;
PosOnMinimap.x = (MinimapPosMin.x + (MinimapBounds.x / Scaler.x) + -(EntityPos.x / Scaler.x));
PosOnMinimap.y = (MinimapPosMin.y + (MinimapBounds.y / Scaler.y) + -(EntityPos.y / Scaler.y));
return PosOnMinimap;
}
//
class CDOTAPanoramaMinimapRenderer {
public:
char pad_0000[16]; //0x0000
float MinimapBoundsX; //0x0010
float MinimapBoundsY; //0x0014
char pad_0018[148]; //0x0018
int32_t MinimapSizeX; //0x00AC
int32_t MinimapSizeY; //0x00B0
Vector GetMinimapBounds() {
float BoundsX = this->MinimapBoundsX;
float BoundsY = this->MinimapBoundsY;
return Vector(BoundsX, BoundsY, 0);
}
Vec2 GetMinimapSize() {
int SizeX = this->MinimapSizeX;
int SizeY = this->MinimapSizeY;
return Vec2(SizeX, SizeY);
}
};