@@ -17,6 +17,7 @@ constexpr double PI = 3.14159265358979323846;
1717constexpr float MINIMAP_ZOOM_MIN = 0 .05f ;
1818constexpr float MINIMAP_ZOOM_MAX = 1 .0f ;
1919constexpr float MINIMAP_ZOOM_SCROLL_STEP = 0 .05f ;
20+ constexpr float MINIMAP_ZOOM_INTERPOLATION_SPEED = 12 .0f ;
2021constexpr float MINIMAP_DRAG_HANDLE_HEIGHT = 12 .0f ;
2122
2223float ClampMinimapZoom (float zoom) {
@@ -57,10 +58,22 @@ MapDot getMapDot(const StratEntity *object) {
5758
5859 // Crystals
5960 if (strncmp (object->name , " crystal" , 7 ) == 0 )
60- return MapDot{ImVec4 (0 .25f , 0 .75f , 1 .0f , 1 .0f ), MapDotShape::Diamond, 5 .0f , false };
61-
62- if (strncmp (object->name , " bonus crystal" , 13 ) == 0 )
63- return MapDot{ImVec4 (0 .45f , 0 .95f , 1 .0f , 1 .0f ), MapDotShape::Diamond, 8 .0f , true };
61+ return MapDot{ImVec4 (0 .5f , 0 .75f , 1 .0f , 1 .0f ), MapDotShape::Diamond, 5 .0f , false };
62+
63+ if (strncmp (object->name , " bonus crystal" , 13 ) == 0 ) {
64+ switch (object->localVars [0 ] >> 12 ) {
65+ case 0 : // Red Crystal
66+ return MapDot{ImVec4 (1 .0f , 0 .25f , 0 .25f , 1 .0f ), MapDotShape::Diamond, 8 .0f , true };
67+ case 1 : // Green Crystal
68+ return MapDot{ImVec4 (0 .25f , 1 .0f , 0 .25f , 1 .0f ), MapDotShape::Diamond, 8 .0f , true };
69+ case 2 : // Purple Crystal
70+ return MapDot{ImVec4 (1 .0f , 0 .25f , 1 .0f , 1 .0f ), MapDotShape::Diamond, 8 .0f , true };
71+ case 3 : // Blue Crystal
72+ return MapDot{ImVec4 (0 .25f , 0 .25f , 1 .0f , 1 .0f ), MapDotShape::Diamond, 8 .0f , true };
73+ case 4 : // Yellow Crystal
74+ return MapDot{ImVec4 (1 .0f , 1 .0f , 0 .25f , 1 .0f ), MapDotShape::Diamond, 8 .0f , true };
75+ }
76+ }
6477
6578 if (strncmp (object->name , " Smash Box" , 9 ) == 0 )
6679 return MapDot{ImVec4 (0 .95f , 0 .5f , 0 .25f , 1 .0f ), MapDotShape::Square, 8 .0f , false };
@@ -118,6 +131,7 @@ namespace Overlay::Minimap {
118131
119132bool showMinimap;
120133float minimapZoom;
134+ float minimapRenderZoom;
121135bool minimapAutoRotate;
122136
123137enum class MinimapStyle {
@@ -129,6 +143,7 @@ MinimapStyle minimapStyle;
129143void Setup () {
130144 showMinimap = api->SetupIniBool (L" GUI" , L" ShowMinimap" , false );
131145 minimapZoom = ClampMinimapZoom (api->SetupIniFloat (L" GUI" , L" MinimapZoom" , MINIMAP_ZOOM_MAX ));
146+ minimapRenderZoom = minimapZoom;
132147 minimapAutoRotate = api->SetupIniBool (L" GUI" , L" MinimapAutoRotate" , true );
133148 minimapStyle = static_cast <MinimapStyle>(api->SetupIniInt (L" GUI" , L" MinimapStyle" , static_cast <int >(MinimapStyle::Circle)));
134149}
@@ -184,7 +199,16 @@ void RenderMinimap() {
184199 cameraDistanceMultiplier = cameraDistance / baselineCameraDistance;
185200 }
186201
187- const float zoom = (std::max)(minimapZoom / cameraDistanceMultiplier, MINIMAP_ZOOM_MIN );
202+ const float safeCameraDistanceMultiplier = (std::max)(cameraDistanceMultiplier, 0 .001f );
203+ const float targetZoom = (std::max)(minimapZoom / safeCameraDistanceMultiplier, MINIMAP_ZOOM_MIN );
204+ const float deltaTime = (std::max)(ImGui::GetIO ().DeltaTime , 0 .0f );
205+ const float interpolationAlpha = 1 .0f - std::exp (-MINIMAP_ZOOM_INTERPOLATION_SPEED * deltaTime);
206+ minimapRenderZoom += (targetZoom - minimapRenderZoom) * interpolationAlpha;
207+
208+ minimapRenderZoom = (std::min)(minimapRenderZoom, MINIMAP_ZOOM_MAX );
209+ minimapRenderZoom = (std::max)(minimapRenderZoom, MINIMAP_ZOOM_MIN );
210+
211+ const float zoom = minimapRenderZoom;
188212 const float scale = mapRadius * zoom / worldRadius;
189213 const float crocRotationRadians = hasCroc ? (float )GameRotationToRadians (crocObject->newRotPos .rotation .y >> 12 ) : 0 .0f ;
190214 const float cameraYawRadians = (cameraRot != nullptr ) ? (float )GameRotationToRadians (cameraRot->y ) : -crocRotationRadians;
0 commit comments