diff options
author | David Corrales | 2007-08-05 19:34:20 +0000 |
---|---|---|
committer | David Corrales | 2007-08-05 19:34:20 +0000 |
commit | 6856535010bd2fa4449bcfde1c88dc06cd46e26f (patch) | |
tree | b81a2234c2beff0312c93e039d6cafda4babeca6 /engines/agi/agi.cpp | |
parent | 1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7 (diff) | |
parent | ec1803f838d5efc7decf75c05a1fb4a9633751e5 (diff) | |
download | scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.gz scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.bz2 scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.zip |
Merged fsnode with trunk: r27971:28460
svn-id: r28462
Diffstat (limited to 'engines/agi/agi.cpp')
-rw-r--r-- | engines/agi/agi.cpp | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 0839b7de99..1c1c53dee7 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -178,7 +178,7 @@ void AgiEngine::processEvents() { case Common::KEYCODE_MINUS: key = '-'; break; - case Common::KEYCODE_9: + case Common::KEYCODE_TAB: key = 0x0009; break; case Common::KEYCODE_F1: @@ -448,6 +448,12 @@ int AgiEngine::agiInit() { loadGame(saveNameBuffer, false); // Do not check game id } +#ifdef __DS__ + // Normally, the engine loads the predictive text dictionary when the predictive dialog + // is shown. On the DS version, the word completion feature needs the dictionary too. + loadDict(); +#endif + return ec; } @@ -535,6 +541,67 @@ static const GameSettings agiSettings[] = { {NULL, NULL, 0, 0, NULL} }; +AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, bool positive) const { + if (_amigaStyle) { + if (positive) { + if (pressed) { // Positive pressed Amiga-style button + if (_olderAgi) { + return AgiTextColor(amigaBlack, amigaOrange); + } else { + return AgiTextColor(amigaBlack, amigaPurple); + } + } else { // Positive unpressed Amiga-style button + return AgiTextColor(amigaWhite, amigaGreen); + } + } else { // _amigaStyle && !positive + if (pressed) { // Negative pressed Amiga-style button + return AgiTextColor(amigaBlack, amigaCyan); + } else { // Negative unpressed Amiga-style button + return AgiTextColor(amigaWhite, amigaRed); + } + } + } else { // PC-style button + if (hasFocus || pressed) { // A pressed or in focus PC-style button + return AgiTextColor(pcWhite, pcBlack); + } else { // An unpressed PC-style button without focus + return AgiTextColor(pcBlack, pcWhite); + } + } +} + +AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, int baseFgColor, int baseBgColor) const { + return getColor(hasFocus, pressed, AgiTextColor(baseFgColor, baseBgColor)); +} + +AgiTextColor AgiButtonStyle::getColor(bool hasFocus, bool pressed, const AgiTextColor &baseColor) const { + if (hasFocus || pressed) + return baseColor.swap(); + else + return baseColor; +} + +int AgiButtonStyle::getTextOffset(bool hasFocus, bool pressed) const { + return (pressed && !_amigaStyle) ? 1 : 0; +} + +bool AgiButtonStyle::getBorder(bool hasFocus, bool pressed) const { + return _amigaStyle && !_authenticAmiga && (hasFocus || pressed); +} + +void AgiButtonStyle::setAmigaStyle(bool amigaStyle, bool olderAgi, bool authenticAmiga) { + _amigaStyle = amigaStyle; + _olderAgi = olderAgi; + _authenticAmiga = authenticAmiga; +} + +void AgiButtonStyle::setPcStyle(bool pcStyle) { + setAmigaStyle(!pcStyle); +} + +AgiButtonStyle::AgiButtonStyle(Common::RenderMode renderMode) { + setAmigaStyle(renderMode == Common::kRenderAmiga); +} + AgiEngine::AgiEngine(OSystem *syst) : Engine(syst) { // Setup mixer @@ -635,6 +702,8 @@ void AgiEngine::initialize() { } } + _buttonStyle = AgiButtonStyle(_renderMode); + _defaultButtonStyle = AgiButtonStyle(); _console = new Console(this); _gfx = new GfxMgr(this); _sound = new SoundMgr(this, _mixer); @@ -676,6 +745,13 @@ void AgiEngine::initialize() { } AgiEngine::~AgiEngine() { + // If the engine hasn't been initialized yet via AgiEngine::initialize(), don't attempt to free any resources, + // as they haven't been allocated. Fixes bug #1742432 - AGI: Engine crashes if no game is detected + if (_game.state == STATE_INIT) { + delete _rnd; // delete _rnd, as it is allocated in the constructor, not in initialize() + return; + } + agiDeinit(); _sound->deinitSound(); delete _sound; |