Skip to content

Commit 60b0034

Browse files
committed
Fix exult#650.
The help scrolls' display on SI were broken with 290c278
1 parent cbc08ed commit 60b0034

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

audio/soundtest.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2000-2022 The Exult Team
2+
* Copyright (C) 2000-2025 The Exult Team
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -74,6 +74,7 @@ void SoundTester::test_sound() {
7474
do {
7575
if (redraw) {
7676
Scroll_gump scroll;
77+
scroll.set_from_help(true);
7778
scroll.add_text(" ~");
7879
scroll.paint();
7980
// Update our repeat flag to match the player if it is playing out

gumps/Text_gump.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ void Text_gump::add_text(const char* str) {
4040
newtext = text;
4141
if (newtext[textlen - 1] != '*') {
4242
// Scrolls in SI break page with embedded 0x00
43-
if (GAME_SI && get_shapenum() == game->get_shape("gumps/scroll")) {
43+
if (GAME_SI && get_shapenum() == game->get_shape("gumps/scroll")
44+
&& !from_help) {
4445
newtext += "*";
4546
} else {
4647
newtext += "~";
@@ -119,7 +120,8 @@ int Text_gump::paint_page(const TileRect& box, int start) {
119120
if (endoff > 0) {
120121
// Check for a page‑break marker
121122
if (epage && get_shapenum() == game->get_shape("gumps/scroll")) {
122-
if (GAME_SI && start == 0 && ypos <= 5 * textheight) {
123+
if (GAME_SI && start == 0 && ypos <= 5 * textheight
124+
&& !from_help) {
123125
// ignore page breaks on the first 5 lines of a scroll
124126
str = pageBreakStar + 1;
125127
curend = str - text;

gumps/Text_gump.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (C) 2000-2022 The Exult Team
2+
Copyright (C) 2000-2025 The Exult Team
33
44
This program is free software; you can redistribute it and/or
55
modify it under the terms of the GNU General Public License
@@ -26,21 +26,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2626
*/
2727
class Text_gump : public Gump {
2828
protected:
29-
char* text; // The text.
30-
int textlen; // Length of text.
31-
int curtop; // Offset of top of current page.
32-
int curend; // Offset past end of current page(s).
33-
int font; // The shape in fonts.vga to use
29+
char* text; // The text.
30+
int textlen; // Length of text.
31+
int curtop; // Offset of top of current page.
32+
int curend; // Offset past end of current page(s).
33+
int font; // The shape in fonts.vga to use
34+
bool from_help; // Text is from help system
3435

3536
public:
3637
Text_gump(int shapenum, int fnt = 4)
3738
: Gump(nullptr, shapenum), text(nullptr), textlen(0), curtop(0),
38-
curend(0), font(fnt) {}
39+
curend(0), font(fnt), from_help(false) {}
3940

4041
~Text_gump() override {
4142
delete[] text;
4243
}
4344

45+
void set_from_help(bool val) {
46+
from_help = val;
47+
}
48+
4449
void add_text(const char* str); // Append text.
4550
int paint_page(const TileRect& box, int start);
4651
// Next page of book/scroll.

keyactions.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2001-2024 The Exult Team
2+
* Copyright (C) 2001-2025 The Exult Team
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -143,6 +143,7 @@ void ActionAbout(const int* params) {
143143
Scroll_gump* scroll;
144144
scroll = new Scroll_gump();
145145

146+
scroll->set_from_help(true);
146147
// add_text has strange behaviour
147148
// \n and ~ both act as a newline with slightly different spacing
148149
// it automatically adds a newline if the

keys.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2001-2022 The Exult Team
2+
* Copyright (C) 2001-2025 The Exult Team
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -479,6 +479,7 @@ void KeyBinder::ShowHelp() const {
479479
scroll = new Scroll_gump();
480480

481481
for (const auto& iter : keyhelp) {
482+
scroll->set_from_help(true);
482483
scroll->add_text(iter.c_str());
483484
}
484485

@@ -497,6 +498,7 @@ void KeyBinder::ShowCheatHelp() const {
497498
scroll = new Scroll_gump();
498499

499500
for (const auto& iter : cheathelp) {
501+
scroll->set_from_help(true);
500502
scroll->add_text(iter.c_str());
501503
}
502504

@@ -515,6 +517,7 @@ void KeyBinder::ShowMapeditHelp() const {
515517
scroll = new Scroll_gump();
516518

517519
for (const auto& iter : mapedithelp) {
520+
scroll->set_from_help(true);
518521
scroll->add_text(iter.c_str());
519522
}
520523

@@ -530,6 +533,7 @@ void KeyBinder::ShowMapeditHelp() const {
530533

531534
void KeyBinder::ShowBrowserKeys() const {
532535
auto* scroll = new Scroll_gump();
536+
scroll->set_from_help(true);
533537
scroll->add_text("Esc - Exits the shape browser");
534538
scroll->add_text("down - Increase shape by 1");
535539
scroll->add_text("R - toggle palette rotation");

0 commit comments

Comments
 (0)