Permalink
Browse files

fixes #4689: abolish radar rotation rescaling minimaps to a sidelengt…

…h of 128 tiles as well as recentering them (patch 3/3)
  • Loading branch information...
Forgon2100
Forgon2100 committed Dec 14, 2017
1 parent af9a96f commit d3410d0b1bd20ebbe8f1910aded3c5cb68402ece
Showing with 3 additions and 20 deletions.
  1. +3 −20 src/radar.cpp
View
@@ -107,7 +107,6 @@ static PIELIGHT flashColours[] =
static SDWORD radarWidth, radarHeight, radarCenterX, radarCenterY, radarTexWidth, radarTexHeight;
static uint8_t RadarZoom;
static float RadarZoomMultiplier = 1.0f;
static UDWORD radarBufferSize = 0;
static int frameSkip = 0;
@@ -119,19 +118,11 @@ static void setViewingWindow();
static void radarSize(int ZoomLevel)
{
float zoom = (float)ZoomLevel * RadarZoomMultiplier / 16.0;
float zoom = (float)ZoomLevel / 16.0;
radarWidth = radarTexWidth * zoom;
radarHeight = radarTexHeight * zoom;
if (rotateRadar)
{
radarCenterX = pie_GetVideoBufferWidth() - BASE_GAP * 4 - MAX(radarHeight, radarWidth) / 2;
radarCenterY = pie_GetVideoBufferHeight() - BASE_GAP * 4 - MAX(radarWidth, radarHeight) / 2;
}
else
{
radarCenterX = pie_GetVideoBufferWidth() - BASE_GAP * 4 - radarWidth / 2;
radarCenterY = pie_GetVideoBufferHeight() - BASE_GAP * 4 - radarHeight / 2;
}
radarCenterX = pie_GetVideoBufferWidth() - BASE_GAP * 4 - radarWidth / 2;
radarCenterY = pie_GetVideoBufferHeight() - BASE_GAP * 4 - radarHeight / 2;
debug(LOG_WZ, "radar=(%u,%u) tex=(%u,%u) size=(%u,%u)", radarCenterX, radarCenterY, radarTexWidth, radarTexHeight, radarWidth, radarHeight);
}
@@ -165,14 +156,6 @@ bool resizeRadar()
radarBufferSize = radarTexWidth * radarTexHeight * sizeof(UDWORD);
radarBuffer = (uint32_t *)malloc(radarBufferSize);
memset(radarBuffer, 0, radarBufferSize);
if (rotateRadar)
{
RadarZoomMultiplier = (float)std::max(RADWIDTH, RADHEIGHT) / std::max({radarTexWidth, radarTexHeight, 1});
}
else
{
RadarZoomMultiplier = 1.0f;
}
debug(LOG_WZ, "Setting radar zoom to %u", RadarZoom);
radarSize(RadarZoom);
pie_SetRadar(-radarWidth / 2.0 - 1, -radarHeight / 2.0 - 1, radarWidth, radarHeight,

0 comments on commit d3410d0

Please sign in to comment.