Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: allow custom width/height of screenshot via console #8804

Merged
merged 3 commits into from Mar 4, 2021

Conversation

TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Mar 4, 2021

Used #8598 for inspiration and this PR is meant as alternative to that PR.

Fixes #8798
Yes, I sneaked that in this PR, I am sorry .. I could make a new PR out of it if you like.

Motivation / Problem

For the titlegame competition I was looking for a good way to make screenshots of different resolutions in a single run in an automated way. #8598 allows this, but I noticed we could do better. It started out as renaming res_x to width, adding docstrings, and more of these things, but I soon figured out the console parsing code was just a bit too stiff for me. For example, you could only set the size of the screenshot for normal zoom, not for big zoom, without there really being a reason not to allow that.

So I rewrote how screenshot command is parsed, and made it into a token-system. You can now mix and match different modes. Also, rewrote most of the implementation to be a bit more robust and future-proof, in my opinion of course.

Description

Reworked how the screenshot command works while keeping it backwards
compatible. It can now more freely understand arguments, and has
the ability to make SC_DEFAULTZOOM screenshots.

BONUS you can now also make heightmap screenshots!

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@TrueBrain TrueBrain changed the title Feature: allow setting the width/height of the screenshot via console Feature: allow custom width/height of screenshot via console Mar 4, 2021
Reworked how the screenshot command works while keeping it backwards
compatible. It can now more freely understand arguments, and has
the ability to make SC_DEFAULTZOOM screenshots.
IConsolePrintF(CC_ERROR, "'select all' is no longer supported since 1.11");
IConsoleError("'select all' is no longer supported since 1.11");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit should probably go in its own separate PR (that mentions that it fixes #8798).

@nielsmh
Copy link
Contributor

nielsmh commented Mar 4, 2021

What does the "viewport" mode of the screenshot command do on a dedicated server?

@TrueBrain
Copy link
Member Author

TrueBrain commented Mar 4, 2021

What does the "viewport" mode of the screenshot command do on a dedicated server?

Surprisingly uneventful.

If you try it without manually selecting a blitter, you just get an error.
But if you do! Well .. still nothing exciting happens. It just makes a screenshot like it is a normal game:

screenshot

So yeah ... not really exciting, sorry :P

What is more exciting, is what happens if you make a lot of screenshots .. you get a gif like this:

test

Dedicated servers don't run certain graphical routines :P

@glx22
Copy link
Contributor

glx22 commented Mar 4, 2021

Haha, that's why you apply some patches for the title game contest

Copy link
Contributor

@glx22 glx22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screenshot command looks cleaner that way.

@TrueBrain TrueBrain merged commit 06a3c0c into OpenTTD:master Mar 4, 2021
@TrueBrain TrueBrain deleted the screenshot-resolution branch March 4, 2021 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No "ERROR: " prefix in error message for "content select all"
4 participants