diff options
author | Paul Gilbert | 2016-07-22 23:48:56 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-22 23:48:56 -0400 |
commit | 8f43f2a7a563c13200a9d946f4473ca11d05385a (patch) | |
tree | c3e0661e741339b517845a94110e10457927d62e /engines | |
parent | 7821b846591bd5a7da0770082e1ca30317b0e360 (diff) | |
download | scummvm-rg350-8f43f2a7a563c13200a9d946f4473ca11d05385a.tar.gz scummvm-rg350-8f43f2a7a563c13200a9d946f4473ca11d05385a.tar.bz2 scummvm-rg350-8f43f2a7a563c13200a9d946f4473ca11d05385a.zip |
TITANIC: Setting up Continue Save dialog slot names list
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/continue_save_dialog.cpp | 23 | ||||
-rw-r--r-- | engines/titanic/continue_save_dialog.h | 12 |
2 files changed, 35 insertions, 0 deletions
diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp index 1be0cf1e0c..5a881c1ac6 100644 --- a/engines/titanic/continue_save_dialog.cpp +++ b/engines/titanic/continue_save_dialog.cpp @@ -25,6 +25,7 @@ namespace Titanic { +#define SAVEGAME_SLOTS_COUNT 5 #define RESTORE_X 346 #define RESTORE_Y 94 #define START_X 370 @@ -36,6 +37,16 @@ CContinueSaveDialog::CContinueSaveDialog() { _restoreState = _startState = -1; _mouseDown = false; _evilTwinShown = false; + + for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) { + Rect slotRect = getSlotBounds(idx); + _slotNames[idx].setFontNumber(0); + _slotNames[idx].setBounds(slotRect); + _slotNames[idx].resize(3); + _slotNames[idx].setMaxCharsPerLine(22); + _slotNames[idx].setHasBorder(false); + _slotNames[idx].setup(); + } } CContinueSaveDialog::~CContinueSaveDialog() { @@ -43,9 +54,15 @@ CContinueSaveDialog::~CContinueSaveDialog() { } void CContinueSaveDialog::addSavegame(int slot, const CString &name) { + assert(_saves.size() < SAVEGAME_SLOTS_COUNT); + _slotNames[_saves.size()].setText(name); _saves.push_back(SaveEntry(slot, name)); } +Rect CContinueSaveDialog::getSlotBounds(int index) { + return Rect(360, 168 + index * 12, 556, 180 + index * 12); +} + int CContinueSaveDialog::show() { // Load images for the dialog loadImages(); @@ -82,6 +99,7 @@ void CContinueSaveDialog::render() { _restoreState = _startState = -1; renderButtons(); + renderSlots(); } void CContinueSaveDialog::renderButtons() { @@ -138,6 +156,11 @@ void CContinueSaveDialog::renderButtons() { } } +void CContinueSaveDialog::renderSlots() { + for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) + _slotNames[idx].draw(CScreenManager::_screenManagerPtr); +} + void CContinueSaveDialog::mouseMove(const Point &mousePos) { _mousePos = mousePos; renderButtons(); diff --git a/engines/titanic/continue_save_dialog.h b/engines/titanic/continue_save_dialog.h index 697a930b7b..58c7deef00 100644 --- a/engines/titanic/continue_save_dialog.h +++ b/engines/titanic/continue_save_dialog.h @@ -28,6 +28,7 @@ #include "titanic/support/image.h" #include "titanic/support/rect.h" #include "titanic/support/string.h" +#include "titanic/pet_control/pet_text.h" namespace Titanic { @@ -42,6 +43,7 @@ class CContinueSaveDialog : public CEventTarget { }; private: Common::Array<SaveEntry> _saves; + CPetText _slotNames[5]; int _highlightedSlot, _selectedSlot; Point _mousePos; bool _evilTwinShown; @@ -66,6 +68,16 @@ private: * Render the buttons */ void renderButtons(); + + /** + * Render the slots + */ + void renderSlots(); + + /** + * Get the area to draw a slot name in + */ + Rect getSlotBounds(int index); public: CContinueSaveDialog(); virtual ~CContinueSaveDialog(); |