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

Highscore table screw-up in double-size interface #7702

Closed
Wuzzy2 opened this issue Aug 18, 2019 · 1 comment
Closed

Highscore table screw-up in double-size interface #7702

Wuzzy2 opened this issue Aug 18, 2019 · 1 comment
Assignees
Milestone

Comments

@Wuzzy2
Copy link
Contributor

Wuzzy2 commented Aug 18, 2019

Version of OpenTTD

1.8.0 (Sorry! :-( But in my defence, I did reseach to see if this bug was reported before. Apparently, it wasn't. Nor did I find anything in the changelogs. So here you go. It's possible the bug was fixed by pure luck in 1.9.2 already, but I doubt that.)

Expected result

The texts in the highscore table does not overlap.

Actual result

They do overlap when using double-size interface. The texts are completely mis-placed.

Screenshot:
billede

Steps to reproduce

  1. Start OpenTTD
  2. Somehow have a few entries in the highscore table
  3. Go into game settings
  4. Select interface size = double size
  5. Go into the highscore table

Other notes

The highscore table is fine in normal size interface.

A similar issue (no screenshot) seems to have happened with the “tycoon of the century” screen. The written text seemed to be mis-placed. So I recommend to check this screen as well while fixing this bug.

I did not test quadruple size interface, but I am assuming the issue is even worse here.

@nielsmh
Copy link
Contributor

nielsmh commented Aug 19, 2019

There's several hardcoded coordinates in the highscore GUI code, that's definitely the cause.

/* We need to get performance from last year because the image is shown
* at the start of the new year when these things have already been copied */
if (this->background_img == SPR_TYCOON_IMG2_BEGIN) { // Tycoon of the century \o/
SetDParam(0, c->index);
SetDParam(1, c->index);
SetDParam(2, EndGameGetPerformanceTitleFromValue(c->old_economy[0].performance_history));
DrawStringMultiLine(pt.x + 15, pt.x + 640 - 25, pt.y + 90, pt.y + 160, STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS, TC_FROMSTRING, SA_CENTER);
} else {
SetDParam(0, c->index);
SetDParam(1, EndGameGetPerformanceTitleFromValue(c->old_economy[0].performance_history));
DrawStringMultiLine(pt.x + 36, pt.x + 640, pt.y + 140, pt.y + 206, STR_HIGHSCORE_COMPANY_ACHIEVES_STATUS, TC_FROMSTRING, SA_CENTER);
}

DrawStringMultiLine(pt.x + 70, pt.x + 570, pt.y, pt.y + 140, !_networking ? STR_HIGHSCORE_TOP_COMPANIES_WHO_REACHED : STR_HIGHSCORE_TOP_COMPANIES_NETWORK_GAME, TC_FROMSTRING, SA_CENTER);
/* Draw Highscore peepz */
for (uint8 i = 0; i < lengthof(_highscore_table[0]); i++) {
SetDParam(0, i + 1);
DrawString(pt.x + 40, pt.x + 600, pt.y + 140 + (i * 55), STR_HIGHSCORE_POSITION);
if (hs[i].company[0] != '\0') {
TextColour colour = (this->rank == i) ? TC_RED : TC_BLACK; // draw new highscore in red
SetDParamStr(0, hs[i].company);
DrawString(pt.x + 71, pt.x + 569, pt.y + 140 + (i * 55), STR_JUST_BIG_RAW_STRING, colour);
SetDParam(0, hs[i].title);
SetDParam(1, hs[i].score);
DrawString(pt.x + 71, pt.x + 569, pt.y + 140 + FONT_HEIGHT_LARGE + (i * 55), STR_HIGHSCORE_STATS, colour);
}
}

@nielsmh nielsmh added this to the 1.10.0 milestone Sep 1, 2019
@nielsmh nielsmh self-assigned this Sep 1, 2019
nielsmh added a commit to nielsmh/OpenTTD that referenced this issue Sep 1, 2019
@nielsmh nielsmh closed this as completed in d649011 Sep 2, 2019
nielsmh added a commit to nielsmh/OpenTTD that referenced this issue Sep 6, 2019
LordAro pushed a commit that referenced this issue Sep 7, 2019
douiwby pushed a commit to douiwby/OpenTTD that referenced this issue Apr 16, 2020
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

No branches or pull requests

2 participants