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
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Smallmap zoom/Minimap zoom

Post by fonso »

OK, I haven't found out what's wrong there. I just can't get the vehicles to stay where they belong in the smallmap. It has something to do with the additional accuracy I've introduced by changing PixelToTile into PixelToWorld so that it gives potentially non-tile-aligned world coordinates. This is necessary for zoom-in. I'm pushing an isolated update of smallmap-zoom-in now, so that you can see for yourself. I might be able to have another look sometime next week, but I'm fairly busy ATM.
Attachments
smallmap-zoom-in_r19096.diff
smallmap-zoom-in with glitching vehicles
(13.64 KiB) Downloaded 115 times
The guy on the picture is not me, it's Alonso.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4766
Joined: 09 Sep 2007 05:03
Location: home

Re: Smallmap zoom/Minimap zoom

Post by Alberth »

Zoom-in makes it quite a bit more complicated. I cannot say what is wrong with it :(

I am aware of two possible causes of your problems.
  • this->scroll_x and this->scroll_y are not truncated to multiples of TILE_SIZE * this->zoom
  • PixelToTile() does not do perfect pixel positioning.
Trunk does not seem to be affected by not truncating the scroll variables. (In fact I use it to reduce drifting while changing zoom level).
For the second problem I created a new routine, attached to the mesg, along with some test-code that sets tile (56, 19) to the top-left at (x, y) when you press 'center map' (each time for a different x/y value). Make a map with something special at that position that you can recognize.

In the patch I applied to trunk (r19104), this routine is called ComputeScroll(). It uses PixelToTile() rather than copying the computation and does not directly set the parameters, so it is a bit more difficult to understand than this stand-alone test routine.

I hope you find it useful.
Attachments
pixel_perfect_positioning.patch
Put the tile exactly where you want it.
(1.7 KiB) Downloaded 115 times
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Smallmap zoom/Minimap zoom

Post by fonso »

The problem is resolved now.
The guy on the picture is not me, it's Alonso.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4766
Joined: 09 Sep 2007 05:03
Location: home

Re: Smallmap zoom/Minimap zoom

Post by Alberth »

Glad to hear that.
User avatar
fonso
President
President
Posts: 948
Joined: 13 Oct 2007 08:28

Re: Smallmap zoom/Minimap zoom

Post by fonso »

The URLs of my patch space and git repository have changed:

git repository: git://github.com/fonsinchen/openttd-cargodist.git

The zoom-in patch is at http://github.com/fonsinchen/openttd-ca ... om-in.diff
The version the zoom-in patch applies to can be found at http://github.com/fonsinchen/openttd-ca ... ERSION.txt
The guy on the picture is not me, it's Alonso.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 1 guest