mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 02:10:28 +00:00
ULTIMA8: Show last save page when opening save and load gump
This commit is contained in:
parent
1349b0267e
commit
cec5900287
@ -35,8 +35,7 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(PagedGump)
|
||||
PagedGump::PagedGump(int left, int right, int top, int shape):
|
||||
ModalGump(0, 0, 5, 5), _leftOff(left), _rightOff(right), _topOff(top),
|
||||
_gumpShape(shape), _nextButton(nullptr), _prevButton(nullptr),
|
||||
_buttonsEnabled(true) {
|
||||
_current = _gumps.end();
|
||||
_current(0), _buttonsEnabled(true) {
|
||||
}
|
||||
|
||||
PagedGump::~PagedGump(void) {
|
||||
@ -88,8 +87,9 @@ void PagedGump::onMouseDouble(int button, int32 mx, int32 my) {
|
||||
}
|
||||
|
||||
bool PagedGump::OnKeyDown(int key, int mod) {
|
||||
if (_current != _gumps.end())
|
||||
if ((*_current)->OnKeyDown(key, mod)) return true;
|
||||
if (_current < _gumps.size())
|
||||
if (_gumps[_current]->OnKeyDown(key, mod))
|
||||
return true;
|
||||
|
||||
switch (key) {
|
||||
case Common::KEYCODE_ESCAPE:
|
||||
@ -110,25 +110,25 @@ void PagedGump::ChildNotify(Gump *child, uint32 message) {
|
||||
|
||||
if (message == ButtonWidget::BUTTON_UP) {
|
||||
if (cid == _nextButton->getObjId()) {
|
||||
if (_current + 1 != _gumps.end()) {
|
||||
(*_current)->HideGump();
|
||||
if (_current + 1 < _gumps.size()) {
|
||||
_gumps[_current]->HideGump();
|
||||
++_current;
|
||||
(*_current)->UnhideGump();
|
||||
(*_current)->MakeFocus();
|
||||
_gumps[_current]->UnhideGump();
|
||||
_gumps[_current]->MakeFocus();
|
||||
|
||||
if (_current + 1 == _gumps.end())
|
||||
if (_current + 1 == _gumps.size())
|
||||
_nextButton->HideGump();
|
||||
|
||||
_prevButton->UnhideGump();
|
||||
}
|
||||
} else if (cid == _prevButton->getObjId()) {
|
||||
if (_current != _gumps.begin()) {
|
||||
(*_current)->HideGump();
|
||||
if (_current > 0) {
|
||||
_gumps[_current]->HideGump();
|
||||
--_current;
|
||||
(*_current)->UnhideGump();
|
||||
(*_current)->MakeFocus();
|
||||
_gumps[_current]->UnhideGump();
|
||||
_gumps[_current]->MakeFocus();
|
||||
|
||||
if (_current == _gumps.begin())
|
||||
if (_current == 0)
|
||||
_prevButton->HideGump();
|
||||
|
||||
_nextButton->UnhideGump();
|
||||
@ -143,17 +143,37 @@ void PagedGump::addPage(Gump *g) {
|
||||
g->HideGump();
|
||||
_gumps.push_back(g);
|
||||
|
||||
_current = _gumps.begin();
|
||||
(*_current)->UnhideGump();
|
||||
if (_focusChild != *_current)
|
||||
(*_current)->MakeFocus();
|
||||
_current = 0;
|
||||
_gumps[_current]->UnhideGump();
|
||||
if (_focusChild != _gumps[_current])
|
||||
_gumps[_current]->MakeFocus();
|
||||
|
||||
if (_current + 1 == _gumps.end())
|
||||
if (_current + 1 == _gumps.size())
|
||||
_nextButton->HideGump();
|
||||
else
|
||||
_nextButton->UnhideGump();
|
||||
}
|
||||
|
||||
void PagedGump::showPage(uint index) {
|
||||
if (index >= _gumps.size())
|
||||
return;
|
||||
|
||||
_gumps[_current]->HideGump();
|
||||
_current = index;
|
||||
_gumps[_current]->UnhideGump();
|
||||
_gumps[_current]->MakeFocus();
|
||||
|
||||
if (_current + 1 == _gumps.size())
|
||||
_nextButton->HideGump();
|
||||
else
|
||||
_nextButton->UnhideGump();
|
||||
|
||||
if (_current == 0)
|
||||
_prevButton->HideGump();
|
||||
else
|
||||
_prevButton->UnhideGump();
|
||||
}
|
||||
|
||||
bool PagedGump::loadData(Common::ReadStream *rs) {
|
||||
warning("Trying to load ModalGump");
|
||||
return false;
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
|
||||
//! add a page. Note: g already has to be a child gump.
|
||||
void addPage(Gump *g);
|
||||
void showPage(uint index);
|
||||
|
||||
void enableButtons(bool enabled) {
|
||||
_buttonsEnabled = enabled;
|
||||
@ -61,10 +62,10 @@ public:
|
||||
|
||||
protected:
|
||||
int _leftOff, _rightOff, _topOff, _gumpShape;
|
||||
Std::vector<Gump *> _gumps;
|
||||
Common::Array<Gump *> _gumps;
|
||||
Gump *_nextButton;
|
||||
Gump *_prevButton;
|
||||
Std::vector<Gump *>::iterator _current;
|
||||
uint _current;
|
||||
bool _buttonsEnabled;
|
||||
};
|
||||
|
||||
|
@ -329,6 +329,10 @@ Gump *U8SaveGump::showLoadSaveGump(Gump *parent, bool save) {
|
||||
gump->addPage(s);
|
||||
}
|
||||
|
||||
int lastSave = ConfMan.hasKey("lastSave") ? ConfMan.getInt("lastSave") : -1;
|
||||
if (lastSave > 0) {
|
||||
gump->showPage((lastSave - 1) / 6);
|
||||
}
|
||||
|
||||
gump->setRelativePosition(CENTER);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user