[Scummvm-cvs-logs] CVS: scummvm/scumm help.cpp,NONE,1.1 help.h,NONE,1.1 dialogs.cpp,1.54,1.55 dialogs.h,1.17,1.18 module.mk,1.18,1.19
Max Horn
fingolfin at users.sourceforge.net
Sat Jun 14 14:19:02 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv30521
Modified Files:
dialogs.cpp dialogs.h module.mk
Added Files:
help.cpp help.h
Log Message:
Patch #745843: Help Dialog; in addition, I moved the 'About' dialog button from the options dialog to the main save/load dialog and enlarged & rearranged that dialog
--- NEW FILE: help.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2002-2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include "stdafx.h"
#include "help.h"
#include "scumm.h"
#include "common/str.h"
int ScummHelp::numPages(byte gameId) {
switch (gameId) {
case GID_MANIAC:
case GID_ZAK:
case GID_ZAK256:
return 4;
break;
case GID_INDY3:
case GID_INDY3_256:
return 6;
break;
case GID_LOOM:
case GID_LOOM256:
case GID_MONKEY_EGA:
case GID_MONKEY_VGA:
case GID_MONKEY:
case GID_MONKEY2:
case GID_INDY4:
case GID_TENTACLE:
case GID_SAMNMAX:
case GID_DIG:
case GID_FT:
case GID_CMI:
return 3;
break;
/* TODO - I don't know the controls for these games
case GID_PUTTDEMO:
*/
default:
return 2;
}
}
#define ADD_BIND(k,d) key[i] = k; dsc[i] = d; i++;
#define ADD_TEXT(d) ADD_BIND("",d)
#define ADD_LINE ADD_BIND("","")
void ScummHelp::updateStrings(byte gameId, int page, String &title,
String *&key, String *&dsc) {
key = new String[HELP_NUM_LINES];
dsc = new String[HELP_NUM_LINES];
int i = 0;
switch (page) {
case 1:
title = "Common keyboard commands:";
ADD_BIND("F5", "Save / Load dialog");
ADD_BIND(".", "Skip line of text");
ADD_BIND("Esc", "Skip cutscene");
ADD_BIND("Space", "Pause game");
ADD_BIND("Ctrl 0-9", "Load game state 1-10");
ADD_BIND("Alt 0-9", "Save game state 1-10");
ADD_BIND("Alt x, Ctrl q", "Quit");
ADD_BIND("Alt Enter", "Toggle fullscreen");
ADD_BIND("[, ]", "Music volume up / down");
ADD_BIND("-, +", "Text speed slower / faster");
ADD_BIND("Enter", "Simulate left mouse button");
ADD_BIND("Tab", "Simulate right mouse button");
ADD_BIND("Arrow Keys", "Simulate mouse movement");
break;
case 2:
title = "Special keyboard commands:";
ADD_BIND("~, #", "Show / Hide console");
ADD_BIND("Ctrl d", "Start the debugger");
ADD_BIND("Ctrl s", "Show memory consumption");
ADD_BIND("Ctrl f", "Run in fast mode *");
ADD_BIND("Ctrl g", "Run in really fast mode *");
ADD_BIND("Ctrl Alt 0-9", "Set graphics filter");
ADD_LINE;
ADD_LINE;
ADD_LINE;
ADD_LINE;
ADD_TEXT("* Note that using ctrl-f and");
ADD_TEXT("ctrl-g are not recommended");
ADD_TEXT("since they may cause crashes");
ADD_TEXT("or incorrect game behaviour.");
break;
case 3:
if (gameId == GID_LOOM || gameId == GID_LOOM256)
title = "Spinning drafts on the keyboard:";
else
title = "Main game controls:";
switch (gameId) {
case GID_ZAK:
case GID_ZAK256:
case GID_MANIAC:
ADD_BIND("q", "Push");
ADD_BIND("a", "Pull");
ADD_BIND("z", "Give");
ADD_BIND("w", "Open");
ADD_BIND("s", "Close");
ADD_BIND("x", "Read");
ADD_BIND("e", "Walk to");
ADD_BIND("d", "Pick up");
ADD_BIND("c", "What is");
if (gameId == GID_ZAK || gameId == GID_ZAK256) {
ADD_BIND("r", "Put on");
ADD_BIND("f", "Take off");
} else {
ADD_BIND("r", "New kid");
ADD_BIND("f", "Unlock");
}
ADD_BIND("v", "Use");
ADD_BIND("t", "Turn on");
ADD_BIND("g", "Turn off");
break;
case GID_INDY3:
case GID_INDY3_256:
ADD_BIND("q", "Push");
ADD_BIND("a", "Pull");
ADD_BIND("z", "Give");
ADD_BIND("w", "Open");
ADD_BIND("s", "Close");
ADD_BIND("x", "Look");
ADD_BIND("e", "Walk to");
ADD_BIND("d", "Pick up");
ADD_BIND("c", "What is");
ADD_BIND("r", "Use");
ADD_BIND("f", "Turn on");
ADD_BIND("v", "Turn off");
ADD_BIND("t", "Talk");
ADD_BIND("g", "Travel");
break;
case GID_LOOM:
case GID_LOOM256:
ADD_BIND("q, c", "play C minor on distaff");
ADD_BIND("w, d", "play D on distaff");
ADD_BIND("e, e", "play E on distaff");
ADD_BIND("r, f", "play F on distaff");
ADD_BIND("t, g", "play G on distaff");
ADD_BIND("y, a", "play A on distaff");
ADD_BIND("u, b", "play B on distaff");
ADD_BIND("i, C", "play C major on distaff");
break;
case GID_MONKEY_EGA:
case GID_MONKEY_VGA:
ADD_BIND("o", "Open");
ADD_BIND("c", "Close");
ADD_BIND("s", "puSh");
ADD_BIND("y", "pull (Yank)");
ADD_BIND("w", "Walk to");
ADD_BIND("p", "Pick up");
ADD_BIND("t", "Talk to");
ADD_BIND("g", "Give");
ADD_BIND("u", "Use");
ADD_BIND("l", "Look at");
ADD_BIND("n", "turn oN");
ADD_BIND("f", "turn oFf");
break;
case GID_MONKEY:
case GID_MONKEY2:
case GID_INDY4:
case GID_TENTACLE:
ADD_BIND("g", "Give");
ADD_BIND("o", "Open");
ADD_BIND("c", "Close");
ADD_BIND("p", "Pick up");
ADD_BIND("l", "Look at");
ADD_BIND("t", "Talk to");
ADD_BIND("u", "Use");
ADD_BIND("s", "puSh");
ADD_BIND("y", "pull (Yank)");
break;
case GID_SAMNMAX:
ADD_BIND("w", "Walk");
ADD_BIND("t", "Talk");
ADD_BIND("u", "Use");
ADD_BIND("i", "Inventory");
ADD_BIND("o", "Object");
ADD_BIND("p", "Pick up");
ADD_BIND("l", "Look");
ADD_BIND("b", "Black and White / Color");
break;
case GID_FT:
ADD_BIND("e", "Eyes");
ADD_BIND("t", "Tongue");
ADD_BIND("i", "Inventory");
ADD_BIND("p", "Punch");
ADD_BIND("k", "Kick");
break;
case GID_DIG:
ADD_BIND("e", "Examine");
ADD_BIND("t", "Regular cursor");
ADD_BIND("i", "Inventory");
ADD_BIND("c", "Comm");
break;
case GID_CMI:
ADD_BIND("F1", "Save / Load / Options");
ADD_BIND("e", "Examine");
ADD_BIND("t", "Talk to");
ADD_BIND("i", "Inventory");
ADD_BIND("u", "Use");
break;
}
break;
case 4:
switch (gameId) {
case GID_MANIAC:
case GID_ZAK:
case GID_ZAK256:
title = "Main game controls:";
if (gameId == GID_ZAK || gameId == GID_ZAK256) {
ADD_BIND("b", "Switch");
} else {
ADD_BIND("b", "Fix");
}
ADD_LINE;
ADD_TEXT("Inventory Controls (not implemented):");
ADD_BIND("u", "Scroll list up");
ADD_BIND("j", "Scroll list down");
ADD_BIND("i", "Upper left item");
ADD_BIND("k", "Lower left item");
ADD_BIND("o", "Upper right item");
ADD_BIND("l", "Lower right item");
break;
case GID_INDY3:
case GID_INDY3_256:
title = "Main game controls:";
ADD_BIND("b", "To Henry / To Indy");
ADD_LINE;
ADD_TEXT("Inventory Controls:");
ADD_BIND("y", "Upper left item");
ADD_BIND("h", "Middle left item");
ADD_BIND("n", "Lower left item");
ADD_BIND("u", "Upper right item");
ADD_BIND("j", "Middle right item");
ADD_BIND("m", "Lower right item");
ADD_BIND("o", "Scroll list up");
ADD_BIND("l", "Scroll list down");
break;
}
break;
case 5:
switch (gameId) {
case GID_INDY3:
case GID_INDY3_256:
title = "Fighting controls (numpad):";
ADD_BIND("7", "Step back");
ADD_BIND("4", "Step back");
ADD_BIND("1", "Step back");
ADD_BIND("8", "Block high");
ADD_BIND("5", "Block middle");
ADD_BIND("2", "Block low");
ADD_BIND("9", "Punch high");
ADD_BIND("6", "Punch middle");
ADD_BIND("3", "Punch low");
ADD_LINE;
ADD_TEXT("These are for Indy on left.");
ADD_TEXT("When Indy is on the right,");
ADD_TEXT("7, 4, and 1 are switched with");
ADD_TEXT("9, 6, and 3, respectively.");
break;
}
break;
case 6:
switch (gameId) {
case GID_INDY3:
case GID_INDY3_256:
title = "Biplane controls (numpad):";
ADD_BIND("7", "Fly to upper left");
ADD_BIND("4", "Fly to left");
ADD_BIND("1", "Fly to lower left");
ADD_BIND("8", "Fly upwards");
ADD_BIND("5", "Fly straight");
ADD_BIND("2", "Fly down");
ADD_BIND("9", "Fly to upper right");
ADD_BIND("6", "Fly to right");
ADD_BIND("3", "Fly to lower right");
break;
}
break;
}
while (i < HELP_NUM_LINES) {
ADD_LINE;
}
}
#undef ADD_BIND
#undef ADD_TEXT
#undef ADD_LINE
--- NEW FILE: help.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2002-2003 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef SCUMM_HELP_H
#define SCUMM_HELP_H
#include "common/str.h"
#define HELP_NUM_LINES 14
class ScummHelp {
protected:
typedef ScummVM::String String;
public:
static int numPages(byte gameId);
static void updateStrings(byte gameId, int page, String &title,
String *&key, String *&dsc);
};
#endif
Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- dialogs.cpp 8 Jun 2003 12:11:14 -0000 1.54
+++ dialogs.cpp 14 Jun 2003 21:18:14 -0000 1.55
@@ -27,6 +27,10 @@
#include "player_v2.h"
#include "verbs.h"
+#ifndef DISABLE_HELP
+#include "help.h"
+#endif
+
#include "gui/newgui.h"
#include "gui/ListWidget.h"
#include "common/config-file.h"
@@ -79,7 +83,8 @@
"Map", //24
"Choose an action to map", //25
"Press the key to associate", //26
- "Please select an action" //27
+ "Please select an action", //27
+ "Help" //28
};
#ifdef __PALM_OS__
@@ -220,25 +225,51 @@
kLoadCmd = 'LOAD',
kPlayCmd = 'PLAY',
kOptionsCmd = 'OPTN',
+ kHelpCmd = 'HELP',
+ kAboutCmd = 'ABOU',
kQuitCmd = 'QUIT'
};
SaveLoadDialog::SaveLoadDialog(NewGui *gui, Scumm *scumm)
- : ScummDialog(gui, scumm, 30, 18, 260, 162) {
+ : ScummDialog(gui, scumm, 20, 8, 280, 184) {
const int x = _w - kButtonWidth - 8;
+ int y = 20;
// The headline
addResText(0, 7, 260, 16, 1);
// The five buttons on the side
- _saveButton = addPushButton(x, 20, queryResString(4), kSaveCmd, 'S');
- _loadButton = addPushButton(x, 40, queryResString(5), kLoadCmd, 'L');
- addButton(x, 60, queryResString(6), kPlayCmd, 'P'); // Play
- addButton(x, 80, queryCustomString(17), kOptionsCmd, 'O'); // Options
- addButton(x, 100, queryResString(8), kQuitCmd, 'Q'); // Quit
+ _saveButton = addPushButton(x, y, queryResString(4), kSaveCmd, 'S'); y += 20;
+ _loadButton = addPushButton(x, y, queryResString(5), kLoadCmd, 'L'); y += 20;
+ y += 5;
+
+ addButton(x, y, "About", kAboutCmd, 'A'); y += 20; // About
+#ifndef DISABLE_HELP
+ addButton(x, y, queryCustomString(28), kHelpCmd, 'H'); y += 20; // Help
+#endif
+ addButton(x, y, queryCustomString(17), kOptionsCmd, 'O'); y += 20; // Options
+ y += 5;
+
+ addButton(x, y, queryResString(6), kPlayCmd, 'P'); y += 20; // Play
+ addButton(x, y, queryResString(8), kQuitCmd, 'Q'); y += 20; // Quit
+
+ //
+ // Create the sub dialog(s)
+ //
+ _aboutDialog = new AboutDialog(gui, scumm);
+#ifndef DISABLE_HELP
+ _helpDialog = new HelpDialog(gui, scumm);
+#endif
// The save game list
- _savegameList = new ListWidget(this, 8, 20, x - 14, 134);
+ _savegameList = new ListWidget(this, 8, 20, x - 14, 156);
+}
+
+SaveLoadDialog::~SaveLoadDialog() {
+ delete _aboutDialog;
+#ifndef DISABLE_HELP
+ delete _helpDialog;
+#endif
}
void SaveLoadDialog::open() {
@@ -297,6 +328,14 @@
case kOptionsCmd:
_scumm->optionsDialog();
break;
+ case kAboutCmd:
+ _aboutDialog->runModal();
+ break;
+#ifndef DISABLE_HELP
+ case kHelpCmd:
+ _helpDialog->runModal();
+ break;
+#endif
case kQuitCmd:
_scumm->_quit = true;
close();
@@ -383,8 +422,7 @@
};
enum {
- kKeysCmd = 'KEYS',
- kAboutCmd = 'ABOU'
+ kKeysCmd = 'KEYS'
};
#ifndef _WIN32_WCE
@@ -401,14 +439,10 @@
addButton(_w-kButtonWidth-8, _h-24 - kButtonHeight - 4, "OK", kOKCmd, 'O');
addButton(_w-2*kButtonWidth-12, _h-24 - kButtonHeight - 4, "Cancel", kCancelCmd, 'C');
- addButton(8, _h-24 - kButtonHeight - 4, "About", kAboutCmd, 'A');
-
addButton(kButtonWidth+12, _h-24, "Keys", kKeysCmd, 'K');
#else
addButton(_w-kButtonWidth-8, _h-24, "OK", kOKCmd, 'O');
addButton(_w-2*kButtonWidth-12, _h-24, "Cancel", kCancelCmd, 'C');
-
- addButton(8, _h-24, "About", kAboutCmd, 'A');
#endif
//
@@ -441,16 +475,14 @@
amigaPalCheckbox = new CheckboxWidget(this, 15, 80, 200, 16, "Amiga palette conversion", 0, 'P');
//
- // Finally create the sub dialogs
+ // Create the sub dialog(s)
//
- _aboutDialog = new AboutDialog(gui, scumm);
#ifdef _WIN32_WCE
_keysDialog = new KeysDialog(gui, scumm);
#endif
}
OptionsDialog::~OptionsDialog() {
- delete _aboutDialog;
#ifdef _WIN32_WCE
delete _keysDialog;
#endif
@@ -484,9 +516,6 @@
_keysDialog->runModal();
#endif
break;
- case kAboutCmd:
- _aboutDialog->runModal();
- break;
case kMasterVolumeChanged:
_soundVolumeMaster = _masterVolumeSlider->getValue();
_masterVolumeLabel->setValue(_soundVolumeMaster);
@@ -557,6 +586,82 @@
new StaticTextWidget(this, 10, 64, 240, 16, "Except", kTextAlignCenter);
new StaticTextWidget(this, 10, 78, 240, 16, "Simon the Sorcerer (c) Adventuresoft", kTextAlignCenter);
}
+
+#ifndef DISABLE_HELP
+
+#pragma mark -
+
+enum {
+ kNextCmd = 'NEXT',
+ kPrevCmd = 'PREV'
+};
+
+HelpDialog::HelpDialog(NewGui *gui, Scumm *scumm)
+ : ScummDialog(gui, scumm, 15, 10, 290, 184) {
+
+ _page = 1;
+ _gameId = scumm->_gameId;
+ _numPages = ScummHelp::numPages(_gameId);
+
+ _prevButton = addPushButton(10, 160, "Previous", kPrevCmd, 'P');
+ _nextButton = addPushButton(90, 160, "Next", kNextCmd, 'N');
+ addButton(210, 160, "Close", kCloseCmd, 'C');
+ _prevButton->clearFlags(WIDGET_ENABLED);
+
+ _title = new StaticTextWidget(this, 10, 5, 270, 16, "", kTextAlignCenter);
+ for (int i = 0; i < HELP_NUM_LINES; i++) {
+ _key[i] = new StaticTextWidget(this, 10, 20 + (10 * i), 80, 16, "", kTextAlignLeft);
+ _dsc[i] = new StaticTextWidget(this, 90, 20 + (10 * i), 190, 16, "", kTextAlignLeft);
+ }
+
+ displayKeyBindings();
+}
+
+void HelpDialog::displayKeyBindings() {
+ String titleStr, *keyStr, *dscStr;
+
+ ScummHelp::updateStrings(_gameId, _page, titleStr, keyStr, dscStr);
+
+ _title->setLabel(titleStr);
+ for (int i = 0; i < HELP_NUM_LINES; i++) {
+ _key[i]->setLabel(keyStr[i]);
+ _dsc[i]->setLabel(dscStr[i]);
+ }
+
+ delete [] keyStr;
+ delete [] dscStr;
+}
+
+void HelpDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ switch (cmd) {
+ case kNextCmd:
+ _page++;
+ if (_page >= _numPages) {
+ _nextButton->clearFlags(WIDGET_ENABLED);
+ }
+ if (_page >= 2) {
+ _prevButton->setFlags(WIDGET_ENABLED);
+ }
+ displayKeyBindings();
+ draw();
+ break;
+ case kPrevCmd:
+ _page--;
+ if (_page <= _numPages) {
+ _nextButton->setFlags(WIDGET_ENABLED);
+ }
+ if (_page <= 1) {
+ _prevButton->clearFlags(WIDGET_ENABLED);
+ }
+ displayKeyBindings();
+ draw();
+ break;
+ default:
+ ScummDialog::handleCommand(sender, cmd, data);
+ }
+}
+
+#endif
#pragma mark -
Index: dialogs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- dialogs.h 25 Mar 2003 15:32:36 -0000 1.17
+++ dialogs.h 14 Jun 2003 21:18:14 -0000 1.18
@@ -24,6 +24,10 @@
#include "common/str.h"
#include "gui/dialog.h"
+#ifndef DISABLE_HELP
+#include "help.h"
+#endif
+
class ListWidget;
class Scumm;
@@ -50,16 +54,22 @@
class SaveLoadDialog : public ScummDialog {
public:
SaveLoadDialog(NewGui *gui, Scumm *scumm);
+ ~SaveLoadDialog();
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
virtual void open();
virtual void close();
protected:
- ListWidget *_savegameList;
+ ListWidget *_savegameList;
PushButtonWidget *_saveButton;
PushButtonWidget *_loadButton;
+ Dialog *_aboutDialog;
+#ifndef DISABLE_HELP
+ Dialog *_helpDialog;
+#endif
+
bool _saveMode;
void fillList();
@@ -74,9 +84,35 @@
AboutDialog(NewGui *gui, Scumm *scumm);
};
+#ifndef DISABLE_HELP
+
+class HelpDialog : public ScummDialog {
+public:
+ HelpDialog(NewGui *gui, Scumm *scumm);
+ virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
+
+protected:
+ typedef ScummVM::String String;
+
+ PushButtonWidget *_nextButton;
+ PushButtonWidget *_prevButton;
+
+ StaticTextWidget *_title;
+ StaticTextWidget *_key[HELP_NUM_LINES];
+ StaticTextWidget *_dsc[HELP_NUM_LINES];
+
+ int _page;
+ int _numPages;
+
+ byte _gameId;
+
+ void displayKeyBindings();
+};
+
+#endif
+
class OptionsDialog : public ScummDialog {
protected:
- Dialog *_aboutDialog;
#ifdef _WIN32_WCE
Dialog *_keysDialog;
#endif
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- module.mk 30 May 2003 19:00:31 -0000 1.18
+++ module.mk 14 Jun 2003 21:18:14 -0000 1.19
@@ -17,6 +17,7 @@
scumm/imuse_digi.o \
scumm/imuse_player.o \
scumm/instrument.o \
+ scumm/help.o \
scumm/nut_renderer.o \
scumm/object.o \
scumm/player_v2.o\
More information about the Scummvm-git-logs
mailing list