diff options
author | Matthew Hoops | 2012-03-20 14:18:57 -0400 |
---|---|---|
committer | Matthew Hoops | 2012-03-20 14:49:16 -0400 |
commit | 71756bdf4eae5ba9cc3f329b85e894f04640aaef (patch) | |
tree | 40d464262da107ab5eed82f198685209161ebac1 /engines/tsage/blue_force/blueforce_dialogs.cpp | |
parent | 03eba05b09e5c9e5a351f8111185934b92a3fed3 (diff) | |
parent | 3c3576a224b92c703b4e8ea20008ac8a069980dd (diff) | |
download | scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.tar.gz scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.tar.bz2 scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.zip |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/tsage/blue_force/blueforce_dialogs.cpp')
-rw-r--r-- | engines/tsage/blue_force/blueforce_dialogs.cpp | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp index b9b3ad6c22..a76d5839a9 100644 --- a/engines/tsage/blue_force/blueforce_dialogs.cpp +++ b/engines/tsage/blue_force/blueforce_dialogs.cpp @@ -163,9 +163,12 @@ void RightClickDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } + // Deactivate the graphics manager used for the dialog + _gfxManager.deactivate(); + // Execute the specified action CursorType cursorNum = CURSOR_NONE; switch (_selectedAction) { @@ -193,8 +196,6 @@ void RightClickDialog::execute() { if (cursorNum != CURSOR_NONE) BF_GLOBALS._events.setCursor(cursorNum); - - _gfxManager.deactivate(); } /*--------------------------------------------------------------------------*/ @@ -243,7 +244,7 @@ void AmmoBeltDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } _gfxManager.deactivate(); @@ -343,7 +344,7 @@ void AmmoBeltDialog::draw() { // Draw the first clip if necessary if (clip1) { - GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Bullets); + GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Bullets + 1); _clip1Rect.resize(clipSurface, _clip1Rect.left, _clip1Rect.top, 100); g_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip1Rect.left, bounds.top + _clip1Rect.top); @@ -351,7 +352,7 @@ void AmmoBeltDialog::draw() { // Draw the second clip if necessary if (clip2) { - GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Bullets); + GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Bullets + 1); _clip2Rect.resize(clipSurface, _clip2Rect.left, _clip2Rect.top, 100); g_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip2Rect.left, bounds.top + _clip2Rect.top); @@ -435,29 +436,45 @@ void OptionsDialog::show() { OptionsDialog *dlg = new OptionsDialog(); dlg->draw(); + // Show the dialog GfxButton *btn = dlg->execute(); - if (btn == &dlg->_btnQuit) { + // Get which button was pressed + int btnIndex = -1; + if (btn == &dlg->_btnRestore) + btnIndex = 0; + else if (btn == &dlg->_btnSave) + btnIndex = 1; + else if (btn == &dlg->_btnRestart) + btnIndex = 2; + else if (btn == &dlg->_btnQuit) + btnIndex = 3; + else if (btn == &dlg->_btnSound) + btnIndex = 4; + + // Close the dialog + dlg->remove(); + delete dlg; + + // Execute the given selection + if (btnIndex == 0) { + // Restore button + g_globals->_game->restoreGame(); + } else if (btnIndex == 1) { + // Save button + g_globals->_game->saveGame(); + } else if (btnIndex == 2) { + // Restart game + g_globals->_game->restartGame(); + } else if (btnIndex == 3) { // Quit game if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) { g_vm->quitGame(); } - } else if (btn == &dlg->_btnRestart) { - // Restart game - g_globals->_game->restartGame(); - } else if (btn == &dlg->_btnSound) { + } else if (btnIndex == 4) { // Sound dialog SoundDialog::execute(); - } else if (btn == &dlg->_btnSave) { - // Save button - g_globals->_game->saveGame(); - } else if (btn == &dlg->_btnRestore) { - // Restore button - g_globals->_game->restoreGame(); } - - dlg->remove(); - delete dlg; } OptionsDialog::OptionsDialog() { |