Smallmap zoom/Minimap zoom

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Smallmap zoom/Minimap zoom

Post by NukeBuster »

The original was made by Thomasdev. (last know revision r7236 dated 22 November 2006)

Flyspray task.

But, what does it do?
This patch lets you zoom in and out of the minimap.

Please give it a try.

Edit: 20-07-2007 - Updated post with latest patch(-r10643), and added a screenshot.
Attachments
smallmap_zoom_10643_Nukeb.patch
(11.41 KiB) Downloaded 337 times
zoom_statusbar.png
zoom_statusbar.png (33.96 KiB) Viewed 11494 times
Last edited by NukeBuster on 20 Jul 2007 18:55, edited 1 time in total.
NukeBuster

Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !

OpenTTD patch(es): Password at join
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Post by Bilbo »

I tried it, it looks great, but I found some small glitches:

* After zooming competely out and back in I was unable to return to 100% zoom (except by closing and reopening the window). Zooming was snapping between 80 and 160 or some other values. When I pressed the zoom in/out button, the zoom goes 100->50>25->12->10. Then zoom in: 10->20->40->80->160 ...

* The "smooth zoom scrolling" is quite slow. I think it should scroll maybe two or three times as fast. Or maybe it will be good to be able to set up scrolling instantly for those who does not want the "smooth zoom"
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Post by NukeBuster »

i will have a look at the zoom in and out problem.

The smooth zoom came around -r10200 so some internals probably changed around that time... I'll look into that aswell.

Thank you for your testing and comment.
NukeBuster

Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !

OpenTTD patch(es): Password at join
mikeel
Engineer
Engineer
Posts: 69
Joined: 03 Jun 2002 09:55

Post by mikeel »

great work!
only some suggestion:
1 - as bilbo said, the zoom snap must be fixed to 12-25-50-100-200-400-800 an it mustn't be recalulate from the previous one (althought if i zoom out from 25% i will get 12%, if i re-zoom in i'll get 24% and 48% and 96%: that's wrong)
2 - smooth scroll is really useful? (this is only a doubt :D )
3 - when i zoom in and out the minimap is re-centered to the current view, and if i'm looking another zone of the minimap is quite boring
4 - there's a way to implement a screenshot of the minimap? (ok, maybe this is off-topic, but if you want to think about it... :wink: )
User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Post by NukeBuster »

The zoom problem is isolated, i will still have to test it, but i know where to look for that. I'm still looking in to the other problems.
NukeBuster

Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !

OpenTTD patch(es): Password at join
User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Post by NukeBuster »

An update for this patch.

The messed up zooming has been fixed.
I have removed the smooth scroll, as it also interfered with the percentage.
And 6% zoom has been added.

Edit: Oh, and to make a screenshot. Just stretch the viewport so it fits in the screen. Then use the nor

Todo:
Don't center on main screen position when zooming.

Changes:
Fixed: Removed smooth scroll. As it did not really add anything and it messed up the variables when scrolling while still zooming.
Fixed: Zoom in no longer messes up percentage.
Feature: 6% Zoom added, 2048x2048 maps were not entirely visible with 12%
Attachments
smallmap_zoom_10513_Nukeb.patch
(11.42 KiB) Downloaded 214 times
NukeBuster

Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !

OpenTTD patch(es): Password at join
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Post by Bilbo »

NukeBuster wrote:An update for this patch.

The messed up zooming has been fixed.
I have removed the smooth scroll, as it also interfered with the percentage.
And 6% zoom has been added.
Good, I've tried it and there are no glitches now.

But I've thought of one possible improvement - move information about current zoom to the statusbar of the map, like shown in the attached picture. Since if showing town names is on, and the map is cluttered with them, the zoom is not visible as it is likely to be overdwarn by the town names....
Attachments
idea for improvement
idea for improvement
zoom-improvement.png (6.95 KiB) Viewed 11765 times
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Smallmap zoom/Minimap zoom

Post by Bilbo »

I have tried it with my new large maps patch .... well, it works fine, but for 8192x2048 maps there may be use for even smaller zooms :)
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Re: Smallmap zoom/Minimap zoom

Post by NukeBuster »

For that to work the zoom probably needs to be turned inside out...

I've done a little update. The only change in this version is the suggestion of Bilbo a few posts back.

Todo:
Don't center on main screen position when zooming. But rather on mouse position.

Changes:
"Zoom: x%" text moved to status bar as suggested by Bilbo.
Attachments
smallmap_zoom_10643_Nukeb.patch
(11.41 KiB) Downloaded 227 times
zoom_statusbar.png
zoom_statusbar.png (33.96 KiB) Viewed 11514 times
NukeBuster

Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !

OpenTTD patch(es): Password at join
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Smallmap zoom/Minimap zoom

Post by Bilbo »

Well, I tried it with 8192x2048 and with 1600x1200 the max zoom was fine, lot of space remained too ...

So i think it's fine, no more zoom levels needed, since smaller zooms would make it too unreadable.

BTW I thought of one more possible improvement, to show the map size along with the zoom, so the text won't read "Zoom: 50%" but for example "Zoom 50%, map 1024x512" ... or something like that.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
TheJosh
Engineer
Engineer
Posts: 75
Joined: 17 Apr 2007 12:19
Contact:

Re: Smallmap zoom/Minimap zoom

Post by TheJosh »

cool patch, good idea!
Want to make a real difference? Australia HOPE International - Bringing hope to African orphans and widows.
mikeel
Engineer
Engineer
Posts: 69
Joined: 03 Jun 2002 09:55

Re: Smallmap zoom/Minimap zoom

Post by mikeel »

is possible to show only the names of the biggest cities in the smallest zoom levels?
becouse if you've a map with a lot of cities the map is unreadable
User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Re: Smallmap zoom/Minimap zoom

Post by NukeBuster »

@mikeel, you can disable the names by depressing the city icon in the minimap window. I'll look into if its possible to show only the biggest citys at < 25%

At the moment I am working with tho original author to get the patch finished.

Please follow Flyspray task 54 if you want to try the latest diffs and follow progress closely.
NukeBuster

Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !

OpenTTD patch(es): Password at join
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Smallmap zoom/Minimap zoom

Post by fonso »

Sorry for grave digging, but I have updated this patch as I need it for cargodist. You can pull it from my git repository at http://fickzoo.com/fonsinchen/openttd.git, branch smallmap-zoom or you can use the attached patch. See the FS task for some details.
Attachments
smallmap_zoom_r16552.diff
patch
(16.33 KiB) Downloaded 193 times
The guy on the picture is not me, it's Alonso.
User avatar
jonty-comp
Tycoon
Tycoon
Posts: 2542
Joined: 22 Oct 2005 16:05
Location: Chesterfield, England
Contact:

Re: Smallmap zoom/Minimap zoom

Post by jonty-comp »

Ooh, this looks very useful! I hope it gets more attention than it did in 2007! :P
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Smallmap zoom/Minimap zoom

Post by CommanderZ »

Yeah, the current minimap sucks, it is only slightly smaller that the maximum zoom out level.
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Smallmap zoom/Minimap zoom

Post by fonso »

new version:
  • vehicles are drawn as full tiles, not only as single pixels
  • scrolling is less shaky
The scrolling is still not pixel by pixel in the lowest zoom level but much finer grained than before. Please tell me if this is enough.
Attachments
smallmap-zoom_r16780.diff
the patch
(19.54 KiB) Downloaded 248 times
The guy on the picture is not me, it's Alonso.
User avatar
fonso
President
President
Posts: 945
Joined: 13 Oct 2007 08:28

Re: Smallmap zoom/Minimap zoom

Post by fonso »

New version:
  • disable the "+" and "-" buttons when reaching max/min zoom levels.
  • enable mouse wheel zooming
  • make zooming a little more smooth
  • document some things
  • remove useless code
By now I have understood most of the obscurity in smallmap and either documented or removed it. The only thing left are some magic offsets in DrawSmallmap which I can't make any sense of. I have, however, marked those places accordingly.
Attachments
smallmap_zoom_r16799.diff
patch
(23.33 KiB) Downloaded 199 times
The guy on the picture is not me, it's Alonso.
User avatar
StopRightThere
Chief Executive
Chief Executive
Posts: 761
Joined: 18 Dec 2005 20:10
Location: United Kingdom

Re: Smallmap zoom/Minimap zoom

Post by StopRightThere »

I wonder what the chances are of this going into trunk?
Bye Bye OpenBVE :(
Official TT-Hot young ginger Doctor Who assistant FanClub
Formerly known as AdditionalData
User avatar
jonty-comp
Tycoon
Tycoon
Posts: 2542
Joined: 22 Oct 2005 16:05
Location: Chesterfield, England
Contact:

Re: Smallmap zoom/Minimap zoom

Post by jonty-comp »

I'll back it for inclusion, if it's suitable! (Not that I have much say in dev affairs)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 45 guests