WAGE: Started post-gameover code implementation

This commit is contained in:
Eugene Sandulenko 2016-02-16 11:13:08 +01:00
parent 9b77e5c890
commit a6120d8b27
6 changed files with 38 additions and 6 deletions

View File

@ -395,4 +395,8 @@ void Gui::disableUndo() {
_menu->enableCommand(kMenuEdit, kMenuActionUndo, false);
}
void Gui::disableAllMenus() {
_menu->disableAllMenus();
}
} // End of namespace Wage

View File

@ -218,14 +218,29 @@ const Graphics::Font *Gui::getTitleFont() {
return getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
}
void Gui::drawDesktop() {
// Draw desktop
Common::Rect r(0, 0, _screen.w - 1, _screen.h - 1);
Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorBlack, _patterns, kPatternCheckers);
g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, _screen.w, _screen.h);
}
void Gui::draw() {
if (_engine->_isGameOver) {
if (_menuDirty) {
drawDesktop();
_menu->render();
}
_menuDirty = false;
return;
}
if (_scene != _engine->_world->_player->_currentScene || _sceneDirty) {
_scene = _engine->_world->_player->_currentScene;
// Draw desktop
Common::Rect r(0, 0, _screen.w - 1, _screen.h - 1);
Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorBlack, _patterns, kPatternCheckers);
g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, _screen.w, _screen.h);
drawDesktop();
_sceneDirty = true;
_consoleDirty = true;

View File

@ -110,9 +110,11 @@ public:
void actionClear();
void actionCut();
void disableUndo();
void disableAllMenus();
private:
void undrawCursor();
void drawDesktop();
void paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType);
void renderConsole(Graphics::Surface *g, Common::Rect &r);
void drawBox(Graphics::Surface *g, int x, int y, int w, int h);
@ -131,7 +133,6 @@ public:
int _cursorX, _cursorY;
bool _cursorState;
Common::Rect _consoleTextArea;
bool _cursorOff;
bool _builtInFonts;
WageEngine *_engine;
@ -140,6 +141,9 @@ public:
bool _cursorDirty;
Common::Rect _cursorRect;
bool _cursorOff;
bool _menuDirty;
private:
Graphics::Surface _console;
@ -148,7 +152,6 @@ private:
bool _sceneDirty;
bool _consoleDirty;
bool _bordersDirty;
bool _menuDirty;
Common::StringArray _out;
Common::StringArray _lines;

View File

@ -560,4 +560,10 @@ void Menu::enableCommand(int menunum, int action, bool state) {
_items[menunum]->subitems[i]->enabled = state;
}
void Menu::disableAllMenus() {
for (uint i = 1; i < _items.size(); i++) // Leave About menu on
for (uint j = 0; j < _items[i]->subitems.size(); j++)
_items[i]->subitems[j]->enabled = false;
}
} // End of namespace Wage

View File

@ -104,6 +104,7 @@ public:
void regenWeaponsMenu();
void processMenuShortCut(byte flags, uint16 ascii);
void enableCommand(int menunum, int action, bool state);
void disableAllMenus();
bool _menuActivated;
Common::Rect _bbox;

View File

@ -215,6 +215,9 @@ void WageEngine::gameOver() {
gameOverDialog.run();
doClose();
_gui->disableAllMenus();
_gui->_menuDirty = true;
}
bool WageEngine::saveDialog() {