[Scummvm-cvs-logs] CVS: scummvm/gui walkthrough.cpp,1.1,1.2 walkthrough.h,1.1,1.2
Pawel Kolodziejski
aquadran at users.sourceforge.net
Fri Nov 19 12:31:04 CET 2004
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27501
Modified Files:
walkthrough.cpp walkthrough.h
Log Message:
ops, commited before older version
Index: walkthrough.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/walkthrough.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- walkthrough.cpp 19 Nov 2004 19:50:00 -0000 1.1
+++ walkthrough.cpp 19 Nov 2004 20:30:26 -0000 1.2
@@ -38,7 +38,8 @@
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 @@
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 @@
file.read(buffer, bufferSize);
file.close();
+ _linesArray.clear();
+
int currentLinePos = 0;
byte *currentBuffer = buffer;
byte *lineBuffer = (byte *)malloc(_lineWidth + 1);
@@ -117,7 +120,14 @@
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 @@
_currentPos = 0;
_scrollLine = _linesPerPage - 1;
- loadWalkthroughText(gameName);
+ _linesArray.clear();
+
+ loadWalkthroughText();
_initialized = true;
}
Index: walkthrough.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/walkthrough.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- walkthrough.h 19 Nov 2004 19:50:00 -0000 1.1
+++ walkthrough.h 19 Nov 2004 20:30:26 -0000 1.2
@@ -51,17 +51,19 @@
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();
More information about the Scummvm-git-logs
mailing list