aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-11-19 20:30:26 +0000
committerPaweł Kołodziejski2004-11-19 20:30:26 +0000
commitdc7a20ccc3a48a2070418cfc430b2f389480c681 (patch)
treec42939490ac35e89bd7b706869502ff2e592cd77
parent20e9cf6f20dde6aed31b83698940786a783c2125 (diff)
downloadscummvm-rg350-dc7a20ccc3a48a2070418cfc430b2f389480c681.tar.gz
scummvm-rg350-dc7a20ccc3a48a2070418cfc430b2f389480c681.tar.bz2
scummvm-rg350-dc7a20ccc3a48a2070418cfc430b2f389480c681.zip
ops, commited before older version
svn-id: r15836
-rw-r--r--gui/walkthrough.cpp22
-rw-r--r--gui/walkthrough.h6
2 files changed, 21 insertions, 7 deletions
diff --git a/gui/walkthrough.cpp b/gui/walkthrough.cpp
index 706f729f9e..82c3e4bdfc 100644
--- a/gui/walkthrough.cpp
+++ b/gui/walkthrough.cpp
@@ -38,7 +38,8 @@ extern const Graphics::NewFont g_consolefont;
WalkthroughDialog::WalkthroughDialog(float widthPercent, float heightPercent)
: Dialog(0, 0, 1, 1),
- _initialized(false), _widthPercent(widthPercent), _heightPercent(heightPercent) {
+ _initialized(false), _widthPercent(widthPercent), _heightPercent(heightPercent) {
+ _gameName[0] = 0;
}
WalkthroughDialog::~WalkthroughDialog() {
@@ -57,11 +58,11 @@ static int getNextWordLength(byte *src, int maxLength) {
return l;
}
-bool WalkthroughDialog::loadWalkthroughText(const char *gameName) {
+bool WalkthroughDialog::loadWalkthroughText() {
char filename[MAX_PATH];
File file;
- sprintf(filename, "%s.wkt", gameName);
+ sprintf(filename, "%s.wkt", _gameName);
file.open(filename);
if (!file.isOpen())
return false;
@@ -70,6 +71,8 @@ bool WalkthroughDialog::loadWalkthroughText(const char *gameName) {
file.read(buffer, bufferSize);
file.close();
+ _linesArray.clear();
+
int currentLinePos = 0;
byte *currentBuffer = buffer;
byte *lineBuffer = (byte *)malloc(_lineWidth + 1);
@@ -117,7 +120,14 @@ bool WalkthroughDialog::loadWalkthroughText(const char *gameName) {
return true;
}
-void WalkthroughDialog::create(const char *gameName) {
+void WalkthroughDialog::setGameName(const char *gameName) {
+ strcpy(_gameName, gameName);
+}
+
+void WalkthroughDialog::create() {
+ if (_initialized)
+ destroy();
+
// Setup basic layout/dialog size
reflowLayout();
@@ -128,7 +138,9 @@ void WalkthroughDialog::create(const char *gameName) {
_currentPos = 0;
_scrollLine = _linesPerPage - 1;
- loadWalkthroughText(gameName);
+ _linesArray.clear();
+
+ loadWalkthroughText();
_initialized = true;
}
diff --git a/gui/walkthrough.h b/gui/walkthrough.h
index 2162156ba6..380f350529 100644
--- a/gui/walkthrough.h
+++ b/gui/walkthrough.h
@@ -51,17 +51,19 @@ private:
EntryList _linesArray;
ScrollBarWidget *_scrollBar;
+ char _gameName[30];
float _widthPercent, _heightPercent;
+ bool loadWalkthroughText();
void reflowLayout();
- bool loadWalkthroughText(const char *gameName);
public:
WalkthroughDialog(float widthPercent, float heightPercent);
~WalkthroughDialog();
- void create(const char *gameName);
+ void setGameName(const char *gameName);
+ void create();
void destroy();
void open();
void drawDialog();