Added main menu dialog files. Gob is now using the new _quit flag

svn-id: r32771
This commit is contained in:
Christopher Page 2008-06-24 23:19:23 +00:00
parent f878820bbe
commit c14804e22f
18 changed files with 279 additions and 31 deletions

View file

@ -181,12 +181,9 @@ int getKeyData() {
void CineEngine::mainLoop(int bootScriptIdx) {
bool playerAction;
//uint16 quitFlag;
byte di;
uint16 mouseButton;
//quitFlag = 0;
if (_preLoad == false) {
resetBgIncrustList();

View file

@ -110,7 +110,6 @@ static const int16 canUseOnItemTable[] = { 1, 0, 0, 1, 1, 0, 0 };
CommandeType objectListCommand[20];
int16 objListTab[20];
//uint16 exitEngine;
uint16 zoneData[NUM_MAX_ZONE];

View file

@ -117,8 +117,6 @@ void mainLoopSub6(void);
void checkForPendingDataLoad(void);
//extern uint16 exitEngine;
void hideMouse(void);
void removeExtention(char *dest, const char *source);

184
engines/dialogs.cpp Normal file
View file

@ -0,0 +1,184 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*/
#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
#include "common/events.h"
#include "graphics/scaler.h"
#include "gui/about.h"
#include "gui/eval.h"
#include "gui/newgui.h"
#include "gui/ListWidget.h"
#include "engines/dialogs.h"
#include "engines/engine.h"
#ifdef SMALL_SCREEN_DEVICE
#include "gui/KeysDialog.h"
#endif
using GUI::CommandSender;
using GUI::StaticTextWidget;
using GUI::kButtonWidth;
using GUI::kButtonHeight;
using GUI::kBigButtonWidth;
using GUI::kBigButtonHeight;
using GUI::kCloseCmd;
using GUI::kTextAlignCenter;
using GUI::kTextAlignLeft;
using GUI::WIDGET_ENABLED;
typedef GUI::OptionsDialog GUI_OptionsDialog;
typedef GUI::Dialog GUI_Dialog;
GlobalDialog::GlobalDialog(String name)
: GUI::Dialog(name) {
_drawingHints |= GUI::THEME_HINT_SPECIAL_COLOR;}
enum {
kSaveCmd = 'SAVE',
kLoadCmd = 'LOAD',
kPlayCmd = 'PLAY',
kOptionsCmd = 'OPTN',
kHelpCmd = 'HELP',
kAboutCmd = 'ABOU',
kQuitCmd = 'QUIT',
kRTLCmd = 'RTL',
kChooseCmd = 'CHOS'
};
MainMenuDialog::MainMenuDialog(Engine *engine)
: GlobalDialog("globalmain"), _engine(engine) {
new GUI::ButtonWidget(this, "globalmain_resume", "Resume", kPlayCmd, 'P');
// new GUI::ButtonWidget(this, "scummmain_load", "Load", kLoadCmd, 'L');
// new GUI::ButtonWidget(this, "scummmain_save", "Save", kSaveCmd, 'S');
new GUI::ButtonWidget(this, "globalmain_options", "Options", kOptionsCmd, 'O');
new GUI::ButtonWidget(this, "globalmain_about", "About", kAboutCmd, 'A');
new GUI::ButtonWidget(this, "globalmain_rtl", "Return to Launcher", kRTLCmd, 'R');
new GUI::ButtonWidget(this, "globalmain_quit", "Quit", kQuitCmd, 'Q');
_aboutDialog = new GUI::AboutDialog();
_optionsDialog = new ConfigDialog();
}
MainMenuDialog::~MainMenuDialog() {
delete _aboutDialog;
delete _optionsDialog;
}
void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kPlayCmd:
close();
break;
case kOptionsCmd:
_optionsDialog->runModal();
break;
case kAboutCmd:
_aboutDialog->runModal();
break;
case kRTLCmd:
_engine->_quit = true;
_engine->_rtl = true;
close();
break;
case kQuitCmd:
_engine->_quit = true;
close();
break;
default:
GlobalDialog::handleCommand(sender, cmd, data);
}
}
enum {
kOKCmd = 'ok '
};
enum {
kKeysCmd = 'KEYS'
};
ConfigDialog::ConfigDialog()
: GUI::OptionsDialog("", "scummconfig") {
//
// Sound controllers
//
addVolumeControls(this, "scummconfig_");
//
// Some misc options
//
// SCUMM has a talkspeed range of 0-9
addSubtitleControls(this, "scummconfig_", 9);
//
// Add the buttons
//
new GUI::ButtonWidget(this, "scummconfig_ok", "OK", GUI::OptionsDialog::kOKCmd, 'O');
new GUI::ButtonWidget(this, "scummconfig_cancel", "Cancel", kCloseCmd, 'C');
#ifdef SMALL_SCREEN_DEVICE
new GUI::ButtonWidget(this, "scummconfig_keys", "Keys", kKeysCmd, 'K');
//
// Create the sub dialog(s)
//
_keysDialog = new GUI::KeysDialog();
#endif
}
ConfigDialog::~ConfigDialog() {
#ifdef SMALL_SCREEN_DEVICE
delete _keysDialog;
#endif
}
void ConfigDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kKeysCmd:
#ifdef SMALL_SCREEN_DEVICE
_keysDialog->runModal();
#endif
break;
default:
GUI_OptionsDialog::handleCommand (sender, cmd, data);
}
}

72
engines/dialogs.h Normal file
View file

@ -0,0 +1,72 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*/
#ifndef GLOBAL_DIALOGS_H
#define GLOBAL_DIALOGS_H
#include "common/str.h"
#include "gui/dialog.h"
#include "gui/options.h"
#include "gui/widget.h"
#include "engines/engine.h"
class GlobalDialog : public GUI::Dialog {
public:
GlobalDialog(Common::String name);
protected:
typedef Common::String String;
};
class MainMenuDialog : public GlobalDialog {
public:
MainMenuDialog(Engine *engine);
~MainMenuDialog();
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
protected:
Engine *_engine;
GUI::Dialog *_aboutDialog;
GUI::Dialog *_optionsDialog;
};
class ConfigDialog : public GUI::OptionsDialog {
protected:
#ifdef SMALL_SCREEN_DEVICE
GUI::Dialog *_keysDialog;
#endif
public:
ConfigDialog();
~ConfigDialog();
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
};
#endif

View file

@ -63,7 +63,7 @@ void Game_v1::playTot(int16 skipPlay) {
strcpy(savedTotName, _curTotFile);
if (skipPlay <= 0) {
while (!_vm->_quitRequested) {
while (!_vm->_quit) {
for (int i = 0; i < 4; i++) {
_vm->_draw->_fontToSprite[i].sprite = -1;
_vm->_draw->_fontToSprite[i].base = -1;
@ -997,7 +997,7 @@ void Game_v1::collisionsBlock(void) {
WRITE_VAR(16, 0);
_activeCollResId = 0;
}
while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->_quitRequested);
while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->_quit);
if (((uint16) _activeCollResId & ~0x8000) == collResId) {
collStackPos = 0;

View file

@ -70,7 +70,7 @@ void Game_v2::playTot(int16 skipPlay) {
strcpy(savedTotName, _curTotFile);
if (skipPlay <= 0) {
while (!_vm->_quitRequested) {
while (!_vm->_quit) {
if (_vm->_inter->_variables)
_vm->_draw->animateCursor(4);
@ -438,7 +438,7 @@ int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId,
timeKey = _vm->_util->getTimeKey();
while (1) {
if (_vm->_inter->_terminate || _vm->_quitRequested) {
if (_vm->_inter->_terminate || _vm->_quit) {
if (handleMouse)
_vm->_draw->blitCursor();
return 0;
@ -1043,7 +1043,7 @@ void Game_v2::collisionsBlock(void) {
WRITE_VAR(16, 0);
_activeCollResId = 0;
}
while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->_quitRequested);
while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->_quit);
if ((_activeCollResId & 0xFFF) == collResId) {
collStackPos = 0;
@ -1465,7 +1465,7 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
key = checkCollisions(handleMouse, -300, collResId, collIndex);
if ((key != 0) || (*collResId != 0) ||
_vm->_inter->_terminate || _vm->_quitRequested)
_vm->_inter->_terminate || _vm->_quit)
break;
if (*pTotTime > 0) {
@ -1479,7 +1479,7 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
}
if ((key == 0) || (*collResId != 0) ||
_vm->_inter->_terminate || _vm->_quitRequested)
_vm->_inter->_terminate || _vm->_quit)
return 0;
switch (key) {

View file

@ -82,7 +82,6 @@ GobEngine::GobEngine(OSystem *syst) : Engine(syst) {
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_copyProtection = ConfMan.getBool("copy_protection");
_quitRequested = false;
Common::addSpecialDebugLevel(kDebugFuncOp, "FuncOpcodes", "Script FuncOpcodes debug level");
Common::addSpecialDebugLevel(kDebugDrawOp, "DrawOpcodes", "Script DrawOpcodes debug level");
@ -112,11 +111,11 @@ GobEngine::~GobEngine() {
int GobEngine::go() {
_init->initGame(0);
return 0;
return _rtl;
}
void GobEngine::shutdown() {
_quitRequested = true;
_quit = true;
}
const char *GobEngine::getLangDesc(int16 language) const {

View file

@ -204,7 +204,6 @@ public:
char *_startTot0;
bool _copyProtection;
bool _noMusic;
bool _quitRequested;
Global *_global;
Util *_util;

View file

@ -249,7 +249,7 @@ void Inter::funcBlock(int16 retFlag) {
if (executeFuncOpcode(cmd2, cmd, params))
return;
if (_vm->_quitRequested)
if (_vm->_quit)
break;
if (_break) {
@ -269,7 +269,7 @@ void Inter::funcBlock(int16 retFlag) {
void Inter::callSub(int16 retFlag) {
byte block;
while (!_vm->_quitRequested && _vm->_global->_inter_execPtr &&
while (!_vm->_quit && _vm->_global->_inter_execPtr &&
(_vm->_global->_inter_execPtr != _vm->_game->_totFileData)) {
block = *_vm->_global->_inter_execPtr;

View file

@ -750,7 +750,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
for (i = 320; i >= 0; i--) {
_vm->_util->setScrollOffset(i, 0);
if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
_vm->_quitRequested) {
_vm->_quit) {
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(_vm->_draw->_frontSurface);
memset((char *) _vm->_draw->_vgaPalette, 0, 768);
@ -760,7 +760,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
break;
}
}
if (!_vm->_quitRequested)
if (!_vm->_quit)
_vm->_util->setScrollOffset(0, 0);
surface = 0;
if (VAR(57) == ((uint32) -1))
@ -799,7 +799,7 @@ void Inter_Bargon::oBargon_intro3(OpGobParams &params) {
_vm->_util->longDelay(_vm->_util->getRandom(200));
}
if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
_vm->_quitRequested) {
_vm->_quit) {
_vm->_sound->blasterStop(10);
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(_vm->_draw->_frontSurface);

View file

@ -1225,7 +1225,7 @@ bool Inter_v1::o1_repeatUntil(OpFuncParams &params) {
funcBlock(1);
_vm->_global->_inter_execPtr = blockPtr + size + 1;
flag = evalBoolResult();
} while (!flag && !_break && !_terminate && !_vm->_quitRequested);
} while (!flag && !_break && !_terminate && !_vm->_quit);
_nestLevel[0]--;
@ -1260,7 +1260,7 @@ bool Inter_v1::o1_whileDo(OpFuncParams &params) {
} else
_vm->_global->_inter_execPtr += size;
if (_break || _terminate || _vm->_quitRequested) {
if (_break || _terminate || _vm->_quit) {
_vm->_global->_inter_execPtr = blockPtr;
_vm->_global->_inter_execPtr += size;
break;

View file

@ -1483,7 +1483,7 @@ void Inter_v2::o2_scroll() {
curX = startX;
curY = startY;
while (!_vm->_quitRequested && ((curX != endX) || (curY != endY))) {
while (!_vm->_quit && ((curX != endX) || (curY != endY))) {
curX = stepX > 0 ? MIN(curX + stepX, (int) endX) :
MAX(curX + stepX, (int) endX);
curY = stepY > 0 ? MIN(curY + stepY, (int) endY) :

View file

@ -197,7 +197,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape,
_frame++;
_vm->_util->waitEndFrame();
} while (!stop && !stopNoClear && !_vm->_quitRequested);
} while (!stop && !stopNoClear && !_vm->_quit);
if (!stopNoClear) {
if (_animDataAllocated) {

View file

@ -131,7 +131,7 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) {
bool stop;
int16 i;
if (_vm->_quitRequested)
if (_vm->_quit)
return;
_fadeValue = (fadeV < 0) ? -fadeV : 2;

View file

@ -369,7 +369,7 @@ void Sound::blasterWaitEndPlay(bool interruptible, bool stopComp) {
if (stopComp)
_blaster->endComposition();
while (_blaster->isPlaying() && !_vm->_quitRequested) {
while (_blaster->isPlaying() && !_vm->_quit) {
if (interruptible && (_vm->_util->checkKey() == 0x11B)) {
WRITE_VAR(57, (uint32) -1);
return;

View file

@ -72,7 +72,7 @@ void Util::longDelay(uint16 msecs) {
_vm->_video->waitRetrace();
processInput();
delay(15);
} while (!_vm->_quitRequested &&
} while (!_vm->_quit &&
((g_system->getMillis() * _vm->_global->_speedFactor) < time));
}
@ -119,7 +119,7 @@ void Util::processInput(bool scroll) {
case Common::EVENT_KEYUP:
break;
case Common::EVENT_QUIT:
_vm->_quitRequested = true;
_vm->_quit = true;
break;
default:
break;

View file

@ -568,7 +568,7 @@ bool VideoPlayer::doPlay(int16 frame, int16 breakKey,
_vm->_util->processInput();
if (_vm->_quitRequested) {
if (_vm->_quit) {
_primaryVideo->getVideo()->disableSound();
return true;
}