Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Sun Feb 19, 2017 11:56 am

All times are UTC




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sun Aug 02, 2009 3:35 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
This patch adds a new screenshot option - the smallmap screenshot.

It can be found in the menu where the normal and giant screenshot are also located, or invoked through the console with the command "screenshot smallmap [optional filename]".

This will produce a screenshot that looks like this:
Image

The latest version of the patch can be found here: [todo] (r18747)


-----
original post:

I'm currently trying to make a patch that introduces a new screenshot type that just creates a screenshot of the smallmap.
However, the graphics stuff is for me a pretty confusing mess right now. Documentation is scarce and I can only guess what some functions exactly do / parameters are exactly for.

Did someone already make such a patch previously that I'm not aware of?
Or, is there someone experienced with the graphics internals of OpenTTD that can and wants to help me out?

Currently, I have a compiling (but not working) WIP patch that's supposed to
* on "giant screenshot" click, call the new function for the smallmap screenshot (just for testing)
* create a new SmallMapWindow
* call its "DrawSmallMap" function that is supposed to draw the map onto the buffer that is written to file later

Unfortunately something seems to be way off, I'm getting an error in Memset, and I don't really know what went wrong where :( So if anyone wants to jump in and enlighten me, I'd be grateful :)
The patch (against 0.7.2):
EDIT: removed unfinished version. See below for working version of this patch


A bit of background info, I'm trying to do this so I can run another AI tournament without spending so much time on fitting together multiple pieces of the smallmap to one map...

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage


Last edited by Roujin on Thu Jan 07, 2010 4:29 am, edited 4 times in total.

Top
   
PostPosted: Sun Aug 02, 2009 5:18 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
This patch does something similar, but the output does not look like an OpenTTD smallmap at all. I hope it helps, this feature is very interesting.

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
PostPosted: Sun Aug 02, 2009 5:34 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
Thanks for the link, maybe I can make use of some parts of it. However for now I've solved the memset issue. Appearently it was caused by the program using one too many global variables for my taste, and me forgetting to set it to something appropriate beforehand.
For now I did manage to make a screenshot of a part of the smallmap, let's see if I can resolve the remaining issues soon :)
As soon as it's usable, I'm going to make it available for all to use...

However I regard this patch more as a "hack" than a proper patch - first of all there are some GUI questions I don't know how to address. e.g. the user should be able to select what kind of smallmap mode he wants to have a screenshot of. Right now I'm gonna hardcode it to the one I want.
Also where to put the new screenshot option? Where the current ones are? Or as a button in the smallmap window? Both? Neither? I dunno...

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage


Top
   
PostPosted: Sun Aug 02, 2009 9:23 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Thu Sep 11, 2008 7:32 am
Posts: 1034
Location: Spain
In my opinion the best option is to put the new screenshot buttons directly in the smallmap window; that way you can use the current state of the smallmap to create the screenshot accordingly. These new buttons can't be too close to other buttons, though... if a user clicks accidentally in the giant smallmap screenshot button, he will waste a lot of time.

_________________
Spanish translation of OpenTTD
Extended heightmaps

Have fun, don't quarrel too much and add as many advanced settings as you can.


Top
   
PostPosted: Sun Aug 02, 2009 10:13 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
Hm, again I am too late reading your comment. :( I've been hacking over the last hours without internet access and only now checked back here and read your post.
For now I've added it to the dropdown where the other screenshot options already are, and added a keyboard shortcut similar to the others: Ctrl+M. I've also added a flag 'smallmap' to the existing console command 'screenshot'.

Here's the patch (against 0.7.2). A good point about it is that it doesn't change anything about the game state or the save format, so it should be completely multiplayer / save compatible with vanilla 0.7.2.

EDIT: I've made a v2 with a small bug fixed. As nobody has downloaded v1 yet I'll just put it here instead.
Attachment:
File comment: smallmap screenshot v2 for 0.7.2
map_screen_0.7.2_v2.diff [8.78 KiB]
Downloaded 97 times


known "issues":
* Using it opens a smallmap window or brings it to front if already opened.

Changelog:
v2:
Fix: Smallmap was not positioned correctly on non-quadratic map.

---
Have fun anyone who can use it. :)
Here's an example screenshot (of a 128x128 map with some AIs)
Attachment:
smallmap_screenshot.png
smallmap_screenshot.png [ 4.22 KiB | Viewed 3014 times ]


Another example screenshot that's trivial to make with my patch, but not so trivial without: a smallmap of a 2048x2048 map ;)
Attachment:
File comment: who can tell which color corresponds to which AI? ;)
smallmap_screenshot_2.png [255.4 KiB]
Downloaded 78 times

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage


Top
   
PostPosted: Thu Jan 07, 2010 4:34 am 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
I updated the patch on request to current trunk (r18747).

Have fun.


Attachments:
File comment: smallmap screenshot for r18747
map_screen_r18747.diff [8.13 KiB]
Downloaded 79 times

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Top
   
PostPosted: Mon Jan 18, 2010 5:59 pm 
Offline
Tycoon
Tycoon

Joined: Thu Apr 02, 2009 10:43 pm
Posts: 3008
Location: Massachusetts, USA
Here is an update:


Attachments:
map_screen_r18862.diff [8.13 KiB]
Downloaded 73 times
map_screen_0.7.5.diff [8.78 KiB]
Downloaded 76 times
Top
   
PostPosted: Tue Aug 04, 2015 1:08 am 
Online
Tycoon
Tycoon
User avatar

Joined: Mon Aug 08, 2005 1:46 pm
Posts: 1610
Location: Ipswich
This is a slight bump, however I've adapted the patch from the previous post to trunk (r27358), and made a few adjustments.
Changes include:
  • This uses an extra button in the smallmap window, instead of a console command
  • This uses the current zoom level and display mode of the smallmap window

The branch is here
An SVN diff is attached


Attachments:
smallmap-screenshot-r27358.patch [8.89 KiB]
Downloaded 17 times

_________________
Ex TTDPatch Coder, Grumpy Greymuzzle
Avatar by MoonsongWolf.
Patch Pack, Github
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.