Fixed big map mode, fixed viewports when loading a game
This commit is contained in:
parent
5f5b2504a4
commit
8153e6ef8d
3 changed files with 48 additions and 40 deletions
src
|
@ -342,35 +342,36 @@ global void UpdateDisplay(void)
|
|||
DrawMapArea();
|
||||
DrawMessages();
|
||||
|
||||
for (i = 0; i < TheUI.NumFillers; ++i) {
|
||||
VideoDrawSubClip(TheUI.Filler[i].Graphic, 0, 0,
|
||||
TheUI.Filler[i].Graphic->Width,
|
||||
TheUI.Filler[i].Graphic->Height,
|
||||
TheUI.FillerX[i], TheUI.FillerY[i]);
|
||||
}
|
||||
DrawMenuButtonArea();
|
||||
if (!BigMapMode) {
|
||||
for (i = 0; i < TheUI.NumFillers; ++i) {
|
||||
VideoDrawSubClip(TheUI.Filler[i].Graphic, 0, 0,
|
||||
TheUI.Filler[i].Graphic->Width,
|
||||
TheUI.Filler[i].Graphic->Height,
|
||||
TheUI.FillerX[i], TheUI.FillerY[i]);
|
||||
}
|
||||
DrawMenuButtonArea();
|
||||
|
||||
if (TheUI.MinimapPanel.Graphic) {
|
||||
VideoDrawSubClip(TheUI.MinimapPanel.Graphic, 0, 0,
|
||||
TheUI.MinimapPanel.Graphic->Width,
|
||||
TheUI.MinimapPanel.Graphic->Height,
|
||||
TheUI.MinimapPanelX, TheUI.MinimapPanelY);
|
||||
} else {
|
||||
VideoDrawRectangle(TheUI.CompletedBarColor,
|
||||
TheUI.MinimapPosX - 1, TheUI.MinimapPosY - 1,
|
||||
TheUI.MinimapW + 2, TheUI.MinimapH + 2);
|
||||
if (TheUI.MinimapPanel.Graphic) {
|
||||
VideoDrawSubClip(TheUI.MinimapPanel.Graphic, 0, 0,
|
||||
TheUI.MinimapPanel.Graphic->Width,
|
||||
TheUI.MinimapPanel.Graphic->Height,
|
||||
TheUI.MinimapPanelX, TheUI.MinimapPanelY);
|
||||
} else {
|
||||
VideoDrawRectangle(TheUI.CompletedBarColor,
|
||||
TheUI.MinimapPosX - 1, TheUI.MinimapPosY - 1,
|
||||
TheUI.MinimapW + 2, TheUI.MinimapH + 2);
|
||||
}
|
||||
|
||||
DrawMinimap(TheUI.SelectedViewport->MapX, TheUI.SelectedViewport->MapY);
|
||||
DrawMinimapCursor(TheUI.SelectedViewport->MapX,
|
||||
TheUI.SelectedViewport->MapY);
|
||||
|
||||
DrawInfoPanel();
|
||||
DrawButtonPanel();
|
||||
DrawResources();
|
||||
DrawStatusLine();
|
||||
}
|
||||
|
||||
// FIXME: redraw only 1* per second!
|
||||
// HELPME: Viewpoint rectangle must be drawn faster (if implemented) ?
|
||||
DrawMinimap(TheUI.SelectedViewport->MapX, TheUI.SelectedViewport->MapY);
|
||||
DrawMinimapCursor(TheUI.SelectedViewport->MapX,
|
||||
TheUI.SelectedViewport->MapY);
|
||||
|
||||
DrawInfoPanel();
|
||||
DrawButtonPanel();
|
||||
DrawResources();
|
||||
DrawStatusLine();
|
||||
DrawCosts();
|
||||
DrawTimer();
|
||||
}
|
||||
|
|
|
@ -464,7 +464,6 @@ local void UiToggleBigMap(void)
|
|||
EnableRedraw = RedrawMap | RedrawCursor | RedrawMessage | RedrawMenu |
|
||||
RedrawTimer | RedrawAll;
|
||||
SetStatusLine("Big map enabled");
|
||||
VideoClearScreen();
|
||||
} else {
|
||||
TheUI.MapArea.X = mapx;
|
||||
TheUI.MapArea.Y = mapy;
|
||||
|
@ -475,7 +474,6 @@ local void UiToggleBigMap(void)
|
|||
|
||||
EnableRedraw = RedrawEverything;
|
||||
SetStatusLine("Returning to old map");
|
||||
VideoClearScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -518,19 +518,28 @@ local void FinishViewportModeConfiguration(Viewport new_vps[], int num_vps)
|
|||
{
|
||||
int i;
|
||||
|
||||
// Compute location of the viewport using oldviewport
|
||||
for (i = 0; i < num_vps; ++i) {
|
||||
const Viewport* vp;
|
||||
if (TheUI.NumViewports < num_vps) {
|
||||
// Compute location of the viewport using oldviewport
|
||||
for (i = 0; i < num_vps; ++i) {
|
||||
const Viewport* vp;
|
||||
|
||||
new_vps[i].MapX = 0;
|
||||
new_vps[i].MapY = 0;
|
||||
vp = GetViewport(new_vps[i].X, new_vps[i].Y);
|
||||
if (vp) {
|
||||
new_vps[i].OffsetX = new_vps[i].X - vp->X + vp->MapX * TileSizeX + vp->OffsetX;
|
||||
new_vps[i].OffsetY = new_vps[i].Y - vp->Y + vp->MapY * TileSizeY + vp->OffsetY;
|
||||
} else {
|
||||
new_vps[i].OffsetX = 0;
|
||||
new_vps[i].OffsetY = 0;
|
||||
new_vps[i].MapX = 0;
|
||||
new_vps[i].MapY = 0;
|
||||
vp = GetViewport(new_vps[i].X, new_vps[i].Y);
|
||||
if (vp) {
|
||||
new_vps[i].OffsetX = new_vps[i].X - vp->X + vp->MapX * TileSizeX + vp->OffsetX;
|
||||
new_vps[i].OffsetY = new_vps[i].Y - vp->Y + vp->MapY * TileSizeY + vp->OffsetY;
|
||||
} else {
|
||||
new_vps[i].OffsetX = 0;
|
||||
new_vps[i].OffsetY = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < num_vps; ++i) {
|
||||
new_vps[i].MapX = TheUI.Viewports[i].MapX;
|
||||
new_vps[i].MapY = TheUI.Viewports[i].MapY;
|
||||
new_vps[i].OffsetX = TheUI.Viewports[i].OffsetX;
|
||||
new_vps[i].OffsetY = TheUI.Viewports[i].OffsetY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue