Ticket #8238: helpDialog.4.diff

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

Added DISABLE_HELP 2003-06-03

  • 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/dialogs.cpp

    RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
    retrieving revision 1.50
    diff -u -r1.50 dialogs.cpp
     
    2727#include "player_v2.h"
    2828#include "verbs.h"
    2929
     30#ifndef DISABLE_HELP
     31#include "help.h"
     32#endif
     33
    3034#include "gui/newgui.h"
    3135#include "gui/ListWidget.h"
    3236#include "common/config-file.h"
     
    7983        "Map",                                                                                          //24
    8084        "Choose an action to map",                                                      //25
    8185        "Press the key to associate",                                           //26
    82         "Please select an action"                                                       //27
     86        "Please select an action",                                                      //27
     87        "Help"                                                                          //28
    8388};
    8489
    8590#ifdef __PALM_OS__
     
    220225        kLoadCmd = 'LOAD',
    221226        kPlayCmd = 'PLAY',
    222227        kOptionsCmd = 'OPTN',
     228        kHelpCmd = 'HELP',
    223229        kQuitCmd = 'QUIT'
    224230};
    225231
     
    235241        _loadButton = addPushButton(x, 40, queryResString(5), kLoadCmd, 'L');
    236242        addButton(x, 60, queryResString(6), kPlayCmd, 'P');     // Play
    237243        addButton(x, 80, queryCustomString(17), kOptionsCmd, 'O');      // Options
     244#ifndef DISABLE_HELP
     245        addButton(x, 100, queryCustomString(28), kHelpCmd, 'H');        // Help
     246        addButton(x, 120, queryResString(8), kQuitCmd, 'Q');    // Quit
     247
     248        _helpDialog = new HelpDialog(gui, scumm);
     249#else
    238250        addButton(x, 100, queryResString(8), kQuitCmd, 'Q');    // Quit
     251#endif
    239252
    240253        // The save game list
    241254        _savegameList = new ListWidget(this, 8, 20, x - 14, 134);
    242255}
    243256
     257SaveLoadDialog::~SaveLoadDialog() {
     258#ifndef DISABLE_HELP
     259        delete _helpDialog;
     260#endif
     261}
     262
    244263void SaveLoadDialog::open() {
    245264        switchToLoadMode();
    246265
     
    297316        case kOptionsCmd:
    298317                _scumm->optionsDialog();
    299318                break;
     319        case kHelpCmd:
     320                _helpDialog->runModal();
     321                break;
    300322        case kQuitCmd:
    301323#ifdef __PALM_OS__
    302324                close();
     
    558580        new StaticTextWidget(this, 10, 64, 240, 16, "Except", kTextAlignCenter);
    559581        new StaticTextWidget(this, 10, 78, 240, 16, "Simon the Sorcerer (c) Adventuresoft", kTextAlignCenter);
    560582}
     583
     584#ifndef DISABLE_HELP
     585
     586#pragma mark -
     587
     588enum {
     589        kNextCmd = 'NEXT',
     590        kPrevCmd = 'PREV'
     591};
     592
     593HelpDialog::HelpDialog(NewGui *gui, Scumm *scumm)
     594        : ScummDialog(gui, scumm, 15, 10, 290, 184) {
     595
     596        _page = 1;
     597        _gameId = scumm->_gameId;
     598        _numPages = ScummHelp::numPages(_gameId);
     599
     600        _prevButton = addPushButton(10, 160, "Previous", kPrevCmd, 'P');
     601        _nextButton = addPushButton(90, 160, "Next", kNextCmd, 'N');
     602        addButton(210, 160, "Close", kCloseCmd, 'C');
     603        _prevButton->clearFlags(WIDGET_ENABLED);
     604
     605        _title = new StaticTextWidget(this, 10, 5, 270, 16, "", kTextAlignCenter);
     606        for (int i = 0; i < HELP_NUM_LINES; i++) {
     607                _key[i] = new StaticTextWidget(this, 10, 20 + (10 * i), 80, 16, "", kTextAlignLeft);
     608                _dsc[i] = new StaticTextWidget(this, 90, 20 + (10 * i), 190, 16, "", kTextAlignLeft);
     609        }
     610
     611        displayKeyBindings();
     612}
     613
     614void HelpDialog::displayKeyBindings() {
     615        String titleStr, *keyStr, *dscStr;
     616
     617        ScummHelp::updateStrings(_gameId, _page, titleStr, keyStr, dscStr);
     618
     619        _title->setLabel(titleStr);
     620        for (int i = 0; i < HELP_NUM_LINES; i++) {
     621                _key[i]->setLabel(keyStr[i]);
     622                _dsc[i]->setLabel(dscStr[i]);
     623        }
     624
     625        delete [] keyStr;
     626        delete [] dscStr;
     627}
     628
     629void HelpDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
     630        switch (cmd) {
     631        case kNextCmd:
     632                _page++;
     633                if (_page >= _numPages) {
     634                        _nextButton->clearFlags(WIDGET_ENABLED);
     635                }
     636                if (_page >= 2) {
     637                        _prevButton->setFlags(WIDGET_ENABLED);
     638                }
     639                displayKeyBindings();
     640                draw();
     641                break;
     642        case kPrevCmd:
     643                _page--;
     644                if (_page <= _numPages) {
     645                        _nextButton->setFlags(WIDGET_ENABLED);
     646                }
     647                if (_page <= 1) {
     648                        _prevButton->clearFlags(WIDGET_ENABLED);
     649                }
     650                displayKeyBindings();
     651                draw();
     652                break;
     653        default:
     654                ScummDialog::handleCommand(sender, cmd, data);
     655        }
     656}
     657
     658#endif
    561659
    562660#pragma mark -
    563661
  • scumm/dialogs.h

    RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.h,v
    retrieving revision 1.17
    diff -u -r1.17 dialogs.h
     
    2424#include "common/str.h"
    2525#include "gui/dialog.h"
    2626
     27#ifndef DISABLE_HELP
     28#include "help.h"
     29#endif
     30
    2731class ListWidget;
    2832class Scumm;
    2933
     
    5054class SaveLoadDialog : public ScummDialog {
    5155public:
    5256        SaveLoadDialog(NewGui *gui, Scumm *scumm);
     57        ~SaveLoadDialog();
    5358        virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
    5459        virtual void open();   
    5560        virtual void close();
    5661
    5762protected:
    58         ListWidget      *_savegameList;
     63        ListWidget      *_savegameList;
    5964
    6065        PushButtonWidget *_saveButton;
    6166        PushButtonWidget *_loadButton;
    6267       
     68        Dialog *_helpDialog;
     69
    6370        bool _saveMode;
    6471
    6572        void fillList();
     
    7380public:
    7481        AboutDialog(NewGui *gui, Scumm *scumm);
    7582};
     83
     84#ifndef DISABLE_HELP
     85
     86class HelpDialog : public ScummDialog {
     87public:
     88        HelpDialog(NewGui *gui, Scumm *scumm);
     89        virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
     90
     91protected:
     92        typedef ScummVM::String String;
     93
     94        PushButtonWidget *_nextButton;
     95        PushButtonWidget *_prevButton;
     96
     97        StaticTextWidget *_title;
     98        StaticTextWidget *_key[HELP_NUM_LINES];
     99        StaticTextWidget *_dsc[HELP_NUM_LINES];
     100
     101        int _page;
     102        int _numPages;
     103
     104        byte _gameId;
     105
     106        void displayKeyBindings();
     107};
     108
     109#endif
    76110
    77111class OptionsDialog : public ScummDialog {
    78112protected:
  • 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\
  • 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