Ticket #8238: helpDialog.2.diff

File helpDialog.2.diff, 9.5 KB (added by SF/itsr0y, 21 years ago)

Revised patch 2003-06-01

  • scumm/dialogs.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
    retrieving revision 1.49
    diff -u -r1.49 dialogs.cpp
     
    2525#include "scumm.h"
    2626#include "imuse.h"
    2727#include "verbs.h"
     28#include "help.h"
    2829
    2930#include "gui/newgui.h"
    3031#include "gui/ListWidget.h"
     
    7879        "Map",                                                                                          //24
    7980        "Choose an action to map",                                                      //25
    8081        "Press the key to associate",                                           //26
    81         "Please select an action"                                                       //27
     82        "Please select an action",                                                      //27
     83        "Help"                                                                          //28
    8284};
    8385
    8486#ifdef __PALM_OS__
     
    219221        kLoadCmd = 'LOAD',
    220222        kPlayCmd = 'PLAY',
    221223        kOptionsCmd = 'OPTN',
    222         kQuitCmd = 'QUIT'
     224        kQuitCmd = 'QUIT',
     225        kHelpCmd = 'HELP',
    223226};
    224227
    225228SaveLoadDialog::SaveLoadDialog(NewGui *gui, Scumm *scumm)
     
    234237        _loadButton = addPushButton(x, 40, queryResString(5), kLoadCmd, 'L');
    235238        addButton(x, 60, queryResString(6), kPlayCmd, 'P');     // Play
    236239        addButton(x, 80, queryCustomString(17), kOptionsCmd, 'O');      // Options
    237         addButton(x, 100, queryResString(8), kQuitCmd, 'Q');    // Quit
     240        addButton(x, 100, queryCustomString(28), kHelpCmd, 'H');        // Help
     241        addButton(x, 120, queryResString(8), kQuitCmd, 'Q');    // Quit
    238242
    239243        // The save game list
    240244        _savegameList = new ListWidget(this, 8, 20, x - 14, 134);
     245
     246        _helpDialog = new HelpDialog(gui, scumm);
     247}
     248
     249SaveLoadDialog::~SaveLoadDialog() {
     250        delete _helpDialog;
    241251}
    242252
    243253void SaveLoadDialog::open() {
     
    296306        case kOptionsCmd:
    297307                _scumm->optionsDialog();
    298308                break;
     309        case kHelpCmd:
     310                _helpDialog->runModal();
     311                break;
    299312        case kQuitCmd:
    300313#ifdef __PALM_OS__
    301314                close();
     
    553566        new StaticTextWidget(this, 10, 50, 240, 16, "All games (c) LucasArts", kTextAlignCenter);
    554567        new StaticTextWidget(this, 10, 64, 240, 16, "Except", kTextAlignCenter);
    555568        new StaticTextWidget(this, 10, 78, 240, 16, "Simon the Sorcerer (c) Adventuresoft", kTextAlignCenter);
     569}
     570
     571#pragma mark -
     572
     573enum {
     574        kNextCmd = 'NEXT',
     575        kPrevCmd = 'PREV'
     576};
     577
     578HelpDialog::HelpDialog(NewGui *gui, Scumm *scumm)
     579        : ScummDialog(gui, scumm, 20, 10, 280, 184) {
     580
     581        _page = 1;
     582        _gameId = scumm->_gameId;
     583        _numPages = ScummHelp::numPages(_gameId);
     584
     585        _prevButton = addPushButton(10, 160, "Previous", kPrevCmd, 'P');
     586        _nextButton = addPushButton(90, 160, "Next", kNextCmd, 'N');
     587        addButton(200, 160, "Close", kCloseCmd, 'C');
     588        _prevButton->clearFlags(WIDGET_ENABLED);
     589
     590        _title = new StaticTextWidget(this, 10, 5, 260, 16, "", kTextAlignCenter);
     591        for (int i = 0; i < HELP_NUM_LINES; i++) {
     592                _key[i] = new StaticTextWidget(this, 10, 20 + (10 * i), 70, 16, "", kTextAlignLeft);
     593                _dsc[i] = new StaticTextWidget(this, 80, 20 + (10 * i), 190, 16, "", kTextAlignLeft);
     594        }
     595
     596        displayKeyBindings();
     597}
     598
     599void HelpDialog::displayKeyBindings() {
     600        String titleStr, *keyStr, *dscStr;
     601
     602        ScummHelp::updateStrings(_gameId, _page, titleStr, keyStr, dscStr);
     603
     604        _title->setLabel(titleStr);
     605        for (int i = 0; i < HELP_NUM_LINES; i++) {
     606                _key[i]->setLabel(keyStr[i]);
     607                _dsc[i]->setLabel(dscStr[i]);
     608        }
     609
     610        delete [] keyStr;
     611        delete [] dscStr;
     612}
     613
     614void HelpDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
     615        switch (cmd) {
     616        case kNextCmd:
     617                _page++;
     618                if (_page >= _numPages) {
     619                        _nextButton->clearFlags(WIDGET_ENABLED);
     620                }
     621                if (_page >= 2) {
     622                        _prevButton->setFlags(WIDGET_ENABLED);
     623                }
     624                displayKeyBindings();
     625                draw();
     626                break;
     627        case kPrevCmd:
     628                _page--;
     629                if (_page <= _numPages) {
     630                        _nextButton->setFlags(WIDGET_ENABLED);
     631                }
     632                if (_page <= 1) {
     633                        _prevButton->clearFlags(WIDGET_ENABLED);
     634                }
     635                displayKeyBindings();
     636                draw();
     637                break;
     638        default:
     639                ScummDialog::handleCommand(sender, cmd, data);
     640        }
    556641}
    557642
    558643#pragma mark -
  • scumm/dialogs.h

    RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.h,v
    retrieving revision 1.17
    diff -u -r1.17 dialogs.h
     
    2323
    2424#include "common/str.h"
    2525#include "gui/dialog.h"
     26#include "help.h"
    2627
    2728class ListWidget;
    2829class Scumm;
     
    3738
    3839        Scumm *_scumm;
    3940
     41        Dialog *_helpDialog;
     42
    4043        void addResText(int x, int y, int w, int h, int resID);
    4144
    4245        // Query a string from the resources
     
    5053class SaveLoadDialog : public ScummDialog {
    5154public:
    5255        SaveLoadDialog(NewGui *gui, Scumm *scumm);
     56        ~SaveLoadDialog();
    5357        virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
    5458        virtual void open();   
    5559        virtual void close();
    5660
    5761protected:
    58         ListWidget      *_savegameList;
     62        ListWidget      *_savegameList;
    5963
    6064        PushButtonWidget *_saveButton;
    6165        PushButtonWidget *_loadButton;
     
    7276class AboutDialog : public ScummDialog {
    7377public:
    7478        AboutDialog(NewGui *gui, Scumm *scumm);
     79};
     80
     81class HelpDialog : public ScummDialog {
     82public:
     83        HelpDialog(NewGui *gui, Scumm *scumm);
     84        virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
     85
     86protected:
     87        typedef ScummVM::String String;
     88
     89        PushButtonWidget *_nextButton;
     90        PushButtonWidget *_prevButton;
     91
     92        StaticTextWidget *_title;
     93        StaticTextWidget *_key[HELP_NUM_LINES];
     94        StaticTextWidget *_dsc[HELP_NUM_LINES];
     95
     96        int _page;
     97        int _numPages;
     98
     99        byte _gameId;
     100
     101        void displayKeyBindings();
    75102};
    76103
    77104class OptionsDialog : public ScummDialog {
  • scumm/module.mk

    RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
    retrieving revision 1.18
    diff -u -r1.18 module.mk
     
    1717        scumm/imuse_digi.o \
    1818        scumm/imuse_player.o \
    1919        scumm/instrument.o \
     20        scumm/help.o \
    2021        scumm/nut_renderer.o \
    2122        scumm/object.o \
    2223        scumm/player_v2.o\
  • gui/newgui.cpp

    RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
    retrieving revision 1.46
    diff -u -r1.46 newgui.cpp
     
    5555// Built-in font
    5656static byte guifont[] = {
    57570,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,0,0,0,0,0,0,0,0,0,0,0,0,4,3,7,8,7,7,8,4,5,5,8,7,4,7,3,8,7,7,7,7,8,7,7,7,7,7,3,4,7,5,7,7,8,7,7,7,7,7,7,7,7,5,7,7,
    58 7,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,8,5,8,8,7,7,7,6,7,7,7,7,7,5,6,7,5,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,3,5,0,8,7,7,7,7,7,7,0,6,7,7,7,5,5,5,7,0,6,8,8,7,7,7,7,7,0,7,7,0,0,
     587,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,8,5,8,8,7,7,7,6,7,7,7,7,7,5,6,7,5,8,7,7,7,7,7,7,7,7,7,8,7,7,7,5,3,5,7,8,7,7,7,7,7,7,0,6,7,7,7,5,5,5,7,0,6,8,8,7,7,7,7,7,0,7,7,0,0,
    59590,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,1,3,6,12,
    606024,62,3,0,128,192,96,48,24,124,192,0,0,3,62,24,12,6,3,1,0,192,124,24,48,96,192,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    61610,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,237,74,72,0,0,0,0,0,128,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,60,66,153,161,161,153,66,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     
    696996,192,0,120,24,24,24,24,24,120,0,0,0,0,0,0,219,219,0,0,0,0,0,0,0,0,255,102,102,102,0,0,0,0,0,0,0,60,6,62,102,62,0,0,96,96,124,102,102,124,0,0,0,60,96,96,96,60,0,0,6,6,62,102,102,62,0,0,0,60,102,126,96,60,0,0,14,24,62,24,24,
    707024,0,0,0,62,102,102,62,6,124,0,96,96,124,102,102,102,0,0,48,0,112,48,48,120,0,0,12,0,12,12,12,12,120,0,96,96,108,120,108,102,0,0,112,48,48,48,48,120,0,0,0,102,127,127,107,99,0,0,0,124,102,102,102,102,0,0,0,60,102,102,102,60,0,0,0,124,102,102,124,96,
    717196,0,0,62,102,102,62,6,6,0,0,124,102,96,96,96,0,0,0,62,96,60,6,124,0,0,24,126,24,24,24,14,0,0,0,102,102,102,102,62,0,0,0,102,102,102,60,24,0,0,0,99,107,127,62,54,0,0,0,102,60,24,60,102,0,0,0,102,102,102,62,12,120,0,0,126,12,24,48,126,0,
    72 24,48,48,96,48,48,24,0,96,96,96,0,96,96,96,0,96,48,48,24,48,48,96,0,0,0,0,0,0,0,0,0,8,12,14,255,255,14,12,8,60,102,96,96,102,60,24,56,102,0,102,102,102,102,62,0,12,24,60,102,126,96,60,0,24,36,60,6,62,102,62,0,102,0,60,6,62,102,62,0,48,
     7224,48,48,96,48,48,24,0,96,96,96,0,96,96,96,0,96,48,48,24,48,48,96,0,0,0,97,153,134,0,0,0,8,12,14,255,255,14,12,8,60,102,96,96,102,60,24,56,102,0,102,102,102,102,62,0,12,24,60,102,126,96,60,0,24,36,60,6,62,102,62,0,102,0,60,6,62,102,62,0,48,
    737324,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,60,96,96,96,60,24,56,24,36,60,102,126,96,60,0,102,0,60,102,126,96,60,0,48,24,60,102,126,96,60,0,0,216,0,112,48,48,120,0,48,72,0,112,48,48,120,0,96,48,0,112,48,48,120,0,102,24,60,102,126,102,102,0,0,0,
    74740,0,0,0,0,0,24,48,124,96,120,96,124,0,0,0,108,26,126,216,110,0,30,40,40,126,72,136,142,0,24,36,60,102,102,102,60,0,102,0,60,102,102,102,60,0,48,24,60,102,102,102,60,0,24,36,0,102,102,102,62,0,48,24,102,102,102,102,62,0,0,0,0,0,0,0,0,0,102,60,102,
    7575102,102,102,60,0,102,0,102,102,102,102,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  • scumm.dsp

    RCS file: /cvsroot/scummvm/scummvm/scumm.dsp,v
    retrieving revision 1.41
    diff -u -r1.41 scumm.dsp
     
    299299# End Source File
    300300# Begin Source File
    301301
     302SOURCE=.\scumm\help.cpp
     303# End Source File
     304# Begin Source File
     305
     306SOURCE=.\scumm\help.h
     307# End Source File
     308# Begin Source File
     309
    302310SOURCE=.\scumm\imuse.cpp
    303311# End Source File
    304312# Begin Source File