Page 1 of 1

[Patch] Enhanced minimap

Posted: 17 Jun 2009 15:25
by adf88
I merged and upgraded two patches:
- "Toggle terrain on minimap" by 3D_Grabber
- "Smallmap zoom/Minimap zoom" by NukeBuster

and that's how arose "Enhanced minimap" patch.
enhanced_minimap.png
enhanced_minimap.png (21.06 KiB) Viewed 8598 times
Features:
- zooming in and out
- show land height on every type of view

Changes to original "Toggle terrain on minimap":
- disabled industries are not shown
- contour view is enabled (by "unclicking" current view)
- height legend
Changes to original "Smallmap zoom/Minimap zoom":
- mouse scroll support
- enlarged vehicles are not just a dots
- every industry on "Industry" view is visible as at least two pixels (industries do not disappear when zooming out)
- zoom in/out buttons become disabled when reached maximum zoom level

Re: [Patch] Enhenced minimap

Posted: 17 Jun 2009 19:03
by Terkhen
Even if for my personal use I prefer both patches in a single file (trying to apply both patches without having to resolve rejects by hand has been one of the biggest problem I had with my latest patchpacks), probably they should be kept as separate files because they do different things. I love the new features, specially being able to scroll with the mouse. Also, you have a typo in the title: the correct name should be "Enhanced minimap".

Re: [Patch] Enhenced minimap

Posted: 18 Jun 2009 04:26
by Eddi
Terkhen wrote:they should be kept as separate files
one would typically handle that with a hg/git repository, patch queues, etc.

that way, one can update each patch individually, but easily generate a full patch(pack).

Re: [Patch] Enhanced minimap

Posted: 18 Jun 2009 08:50
by HackaLittleBit
I just compiled this and it looks very nice. :bow:

Question though.
Would it not be possible to simply flip between normal game play and small map when changing amplification?
Yah Yah that would be perfect. :)
HackaLittleBit

Re: [Patch] Enhanced minimap

Posted: 18 Jun 2009 13:06
by adf88
But what exactly you mean ? Please, give more precise description.

Re: [Patch] Enhanced minimap

Posted: 18 Jun 2009 14:35
by HackaLittleBit
Would it not be possible to simply flip between normal game play and small map when changing amplification?
Well the moment you loose usefull data. that is about the most zoomed in of the main screen. Automaticaly the zooming in (eg map getting smaller) would continue in full screen mode "small map" and then continue smaller and smaller (I use my mouse scroll button).

I hope you understand but simply zooming in and out continuous.
EDIT: And switching modes automatically

Regards

Re: [Patch] Enhanced minimap

Posted: 19 Jun 2009 12:54
by Thief^
Now I have to unmerge smallmap zoom from my patchpack, so I can merge this in...

Thanks for this patch!

Re: [Patch] Enhanced minimap

Posted: 20 Jun 2009 07:52
by adf88
Thief^ wrote:Now I have to unmerge smallmap zoom from my patchpack, so I can merge this in...
Unless other patch modified smallmap_gui.cpp this shouldn't be hard. Just revert this file to original and apply Enhanced Minimap. After that you'll need only revert changes made by "smallmap zoom" in other files. If you used this version you need only revert changes made to "ZoomLevel" enum in zoom_type.h.
I decided not to modify it. These modifications didn't fit there, and wasn't necessary. Instead of declaring new negative values I used original enum with negation operator in my code.

Re: [Patch] Enhanced minimap

Posted: 20 Jun 2009 17:03
by adf88
I found a bug, and fixed it. By mistake I changed two lines of "viewport" code. Scrolling zoomed out viewport was slower instead of faster - it was scrolling very slowly. Patches in the first post of this topic are fixed now. For those who applied a patch before this fix, I give only-bug-fix patches:

Re: [Patch] Enhanced minimap

Posted: 21 Jun 2009 10:12
by ic111
Hello,

I have just seen your patch.

I am currently trying to make the minimap support more heightlevels, i.e. if you click somewhere in the minimap the real map should scroll north according to the height at the point I clicked in minimap. With the current implementation of the minimap, if you click on the peak of some height mountain, you land somewhere on its ridge :-(

However, I have not yet found the link between minimap and the tiles - how can I determine which tile I clicked? Can you give me some hint?

Thanks.

Re: [Patch] Enhanced minimap

Posted: 21 Jun 2009 11:57
by adf88
Hi.
I knew that Enhanced Minimap would collide with "more height levels". I even planned to write special implementation for this patch :) . I can do it if you want.

However, if you want do it by yourself, then do it :) .

You had to break something, Enhanced Minimap works fine alone. This is that piece of code (minimap click handle):
original:

Code: Select all

Point pt = RemapCoords(this->scroll_x, this->scroll_y, 0);
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
w->viewport->follow_vehicle = INVALID_VEHICLE;
w->viewport->dest_scrollpos_x = pt.x + ((_cursor.pos.x - this->left + 2) << 4) - (w->viewport->virtual_width >> 1);
w->viewport->dest_scrollpos_y = pt.y + ((_cursor.pos.y - this->top - 16) << 4) - (w->viewport->virtual_height >> 1); 
patched:

Code: Select all

Point pt = RemapCoords(this->scroll_x, this->scroll_y, 0);
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
w->viewport->follow_vehicle = INVALID_VEHICLE;
w->viewport->dest_scrollpos_x = pt.x + ScaleByZoom(((_cursor.pos.x - this->left + 2) << 4), this->zoom) - (w->viewport->virtual_width >> 1);
w->viewport->dest_scrollpos_y = pt.y + ScaleByZoom(((_cursor.pos.y - this->top - 16) << 4), this->zoom) - (w->viewport->virtual_height >> 1); 
And give me a link to the latest "more height levels" patch. I can't find it, your thread has 20 pages !
It's a good practice to keep latest patch in the first post of thread.

Re: [Patch] Enhanced minimap

Posted: 21 Jun 2009 12:45
by ChillCore
And give me a link to the latest "more height levels" patch. I can't find it, your thread has 20 pages !
It's a good practice to keep latest patch in the first post of thread.
Try the last page.
I have no access to the first post and I do not want to start a seperate branch so I hope we can keep it there for a while to come.
Current version is v15.

Re: [Patch] Enhanced minimap

Posted: 21 Jun 2009 16:00
by 2007Alain2007
Great team work from you two i see keep up the good work

Re: [Patch] Enhanced minimap

Posted: 23 Jun 2009 19:03
by ic111
adf88 wrote:Hi.
And give me a link to the latest "more height levels" patch. I can't find it, your thread has 20 pages !
It's a good practice to keep latest patch in the first post of thread.
I solved the problem I described here. Minimap should work with more heightlevels now.

You can find the patch (1) on the first page of the more heightlevels thread now (with the problem of ChillCore not being able to edit this) and (2) near the end of that thread. You are right, it contains more than 20 pages, but the last version is always near the end, so having a look at the last one or two pages should almost always suffice.

Re: [Patch] Enhanced minimap

Posted: 23 Jun 2009 22:49
by Terkhen
I found a little bug, adf88. When using both the "Show vegetation" and "Show contours" buttons, the height legend is not shown.

Re: [Patch] Enhanced minimap

Posted: 24 Jun 2009 07:26
by adf88
It's not a bug. Every tile has some vegetation, so there is no place for showing height. Grass could be replaced with height color, but what about other land types ? Snow, sand, I would have to make a special height palette for them, or leave them unchanged. So finally I decided to leave all types of land and do not show height on vegetation map.
What do you think about it ? Should it be done in other way ?
I realised now, that I should disable "show height" button when switching to vegetation view.

Re: [Patch] Enhanced minimap

Posted: 24 Jun 2009 07:36
by Terkhen
That sounds very logical: I should have checked "the bug" more before posting it. Your solution is good, disabling the height button when the vegetation is active should be enough.

Re: [Patch] Enhanced minimap

Posted: 24 Jun 2009 08:10
by adf88
Actually you found a bug. You could expect that height should be displayed if the button can be pressed ;)
Patches are fixed now. Added one line to smallmap_gui.cpp:

---------------------------------------------------------------------
  • this->map_type = (SmallMapType)(widget - SM_WIDGET_CONTOUR);
    this->LowerWidget(widget);
}
this->SetWidgetDisabledState(SM_WIDGET_CONTOUR, this->map_type == SMT_VEGETATION);
this->ResizeLegend();

this->SetDirty();
---------------------------------------------------------------------