Smallmap screenshot (r18747)
Moderator: OpenTTD Developers
Smallmap screenshot (r18747)
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:
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...
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:
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...
Last edited by Roujin on 07 Jan 2010 04:29, edited 4 times in total.
Re: [Help needed] Trying to make a "smallmap screenshot"
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.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Re: [Help needed] Trying to make a "smallmap screenshot"
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...
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...
Re: Trying to make a "smallmap screenshot"
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.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Re: Trying to make a "smallmap screenshot"
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. 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) Another example screenshot that's trivial to make with my patch, but not so trivial without: a smallmap of a 2048x2048 map
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. 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) Another example screenshot that's trivial to make with my patch, but not so trivial without: a smallmap of a 2048x2048 map
Re: Smallmap screenshot (r18747)
I updated the patch on request to current trunk (r18747).
Have fun.
Have fun.
- Attachments
-
- map_screen_r18747.diff
- smallmap screenshot for r18747
- (8.13 KiB) Downloaded 356 times
Re: Smallmap screenshot (r18747)
Here is an update:
- Attachments
-
- map_screen_r18862.diff
- (8.13 KiB) Downloaded 243 times
-
- map_screen_0.7.5.diff
- (8.78 KiB) Downloaded 250 times
Re: Smallmap screenshot (r18747)
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:
An SVN diff is attached
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
An SVN diff is attached
- Attachments
-
- smallmap-screenshot-r27358.patch
- (8.89 KiB) Downloaded 177 times
Ex TTDPatch Coder
Patch Pack, Github
Patch Pack, Github
Who is online
Users browsing this forum: No registered users and 25 guests