aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2012-01-12 01:51:55 -0800
committerFilippos Karapetis2012-01-12 01:51:55 -0800
commit21a7e3d8e61c0bac072b8bd4f491a1cf2ef115ee (patch)
tree7f7725b02d20ac3a84f8bca78ab9a951b0b23cda
parentb2a38897a0e1e629e0bf443297b53bc99cc63ab9 (diff)
parentc456d6d29a6c94d1b051456cb9b242b8eda756f7 (diff)
downloadscummvm-rg350-21a7e3d8e61c0bac072b8bd4f491a1cf2ef115ee.tar.gz
scummvm-rg350-21a7e3d8e61c0bac072b8bd4f491a1cf2ef115ee.tar.bz2
scummvm-rg350-21a7e3d8e61c0bac072b8bd4f491a1cf2ef115ee.zip
Merge pull request #146 from eriktorbjorn/master
DREAMWEB: Extend the original save/load dialogs from 7 to 21 slots.
-rw-r--r--engines/dreamweb/dreamweb.cpp1
-rw-r--r--engines/dreamweb/dreamweb.h6
-rw-r--r--engines/dreamweb/saveload.cpp48
3 files changed, 41 insertions, 14 deletions
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 91aabc89d9..79c5e0d7be 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -195,6 +195,7 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_timedX = 0;
_needToDumpTimed = 0;
_loadingOrSave = 0;
+ _saveLoadPage = 0;
_currentSlot = 0;
_cursorPos = 0;
_colourPos = 0;
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index e261010902..b9623f54fa 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -227,8 +227,8 @@ protected:
Common::Point _lineData[200]; // Output of Bresenham
// from saveload.cpp
- char _saveNames[17*7];
- char _saveNamesOld[17*7];
+ char _saveNames[17*21];
+ char _saveNamesOld[17*21];
// from vgagrafx.cpp
uint8 _workspace[(0x1000 + 2) * 16];
@@ -421,6 +421,7 @@ public:
uint8 _timedX;
uint8 _needToDumpTimed;
uint8 _loadingOrSave;
+ uint8 _saveLoadPage;
uint8 _currentSlot;
uint8 _cursorPos;
uint8 _colourPos;
@@ -692,6 +693,7 @@ public:
void loadSaveBox();
void showNames();
void checkInput();
+ void selectSaveLoadPage();
void selectSlot();
void showSlots();
void showOpBox();
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 386319db34..761ce7696f 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -143,6 +143,7 @@ void DreamWebEngine::doLoad(int savegameId) {
{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamWebEngine::getBackToOps },
{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamWebEngine::actualLoad },
{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamWebEngine::selectSlot },
+ { kOpsx+158,kOpsx+158+(18*3),kOpsy-17,kOpsy-1,&DreamWebEngine::selectSaveLoadPage },
{ 0,320,0,200,&DreamWebEngine::blank },
{ 0xFFFF,0,0,0,0 }
};
@@ -234,6 +235,7 @@ void DreamWebEngine::saveGame() {
{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamWebEngine::getBackToOps },
{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamWebEngine::actualSave },
{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamWebEngine::selectSlot },
+ { kOpsx+158,kOpsx+158+(18*3),kOpsy-17,kOpsy-1,&DreamWebEngine::selectSaveLoadPage },
{ 0,320,0,200,&DreamWebEngine::blank },
{ 0xFFFF,0,0,0,0 }
};
@@ -286,11 +288,11 @@ void DreamWebEngine::saveGame() {
}
void DreamWebEngine::namesToOld() {
- memcpy(_saveNamesOld, _saveNames, 17*7);
+ memcpy(_saveNamesOld, _saveNames, 17*21);
}
void DreamWebEngine::oldToNames() {
- memcpy(_saveNames, _saveNamesOld, 17*7);
+ memcpy(_saveNames, _saveNamesOld, 17*21);
}
void DreamWebEngine::saveLoad() {
@@ -440,7 +442,7 @@ void DreamWebEngine::actualSave() {
if (!(_mouseButton & 1))
return;
- unsigned int slot = _currentSlot;
+ unsigned int slot = _currentSlot + 7 * _saveLoadPage;
const char *desc = &_saveNames[17*slot];
if (desc[1] == 0) // The actual description string starts at desc[1]
@@ -464,13 +466,13 @@ void DreamWebEngine::actualLoad() {
if (_mouseButton == _oldButton || _mouseButton != 1)
return;
- unsigned int slot = _currentSlot;
+ unsigned int slot = _currentSlot + 7 * _saveLoadPage;
const char *desc = &_saveNames[17*slot];
if (desc[1] == 0) // The actual description string starts at desc[1]
return;
- loadPosition(_currentSlot);
+ loadPosition(slot);
_getBack = 1;
}
@@ -582,10 +584,10 @@ void DreamWebEngine::loadPosition(unsigned int slot) {
if (len[0] != 17)
::error("Error loading save: description buffer isn't 17 bytes");
- if (slot < 7) {
+ if (slot < 21) {
inSaveFile->read(&_saveNames[17*slot], len[0]);
} else {
- // The savenames buffer only has room for 7 descriptions
+ // The savenames buffer only has room for 21 descriptions
uint8 namebuf[17];
inSaveFile->read(namebuf, 17);
}
@@ -644,8 +646,10 @@ void DreamWebEngine::loadPosition(unsigned int slot) {
// Count number of save files, and load their descriptions into _saveNames
uint DreamWebEngine::scanForNames() {
- // Initialize the first 7 slots (like the original code expects)
- for (unsigned int slot = 0; slot < 7; ++slot) {
+ // There are 21 save slots, each of which are 17 bytes. The first byte
+ // doesn't seem to be used. The name starts at the second byte. All the
+ // slots are initialized to be empty.
+ for (unsigned int slot = 0; slot < 21; ++slot) {
_saveNames[17 * slot + 0] = 2;
_saveNames[17 * slot + 1] = 0;
for (int i = 2; i < 17; ++i)
@@ -670,7 +674,7 @@ uint DreamWebEngine::scanForNames() {
int slotNum = atoi(file.c_str() + file.size() - 2);
SaveStateDescriptor sd(slotNum, name);
saveList.push_back(sd);
- if (slotNum < 7)
+ if (slotNum < 21)
Common::strlcpy(&_saveNames[17 * slotNum + 1], name, 16); // the first character is unused
}
@@ -709,9 +713,10 @@ void DreamWebEngine::loadSaveBox() {
// show savegame names (original interface), and set kCursorpos
void DreamWebEngine::showNames() {
+ unsigned int offset = 7 * _saveLoadPage;
for (int slot = 0; slot < 7; ++slot) {
// The first character of the savegame name is unused
- Common::String name(&_saveNames[17*slot + 1]);
+ Common::String name(&_saveNames[17 * (slot + offset) + 1]);
if (slot != _currentSlot) {
printDirect((const uint8 *)name.c_str(), kOpsx + 21, kOpsy + 10*slot + 10, 200, false);
@@ -737,8 +742,10 @@ void DreamWebEngine::checkInput() {
readKey();
+ unsigned int slot = _currentSlot + 7 * _saveLoadPage;
+
// The first character of the savegame name is unused
- char *name = &_saveNames[17*_currentSlot + 1];
+ char *name = &_saveNames[17*slot + 1];
if (_currentKey == 0) {
return;
@@ -768,6 +775,21 @@ void DreamWebEngine::checkInput() {
workToScreenM();
}
+void DreamWebEngine::selectSaveLoadPage() {
+ commandOnlyCond(31, 254);
+
+ if (_mouseButton != 1 || _mouseButton == _oldButton)
+ return;
+ uint saveLoadPage = (_mouseX - (kOpsx + 158)) / 18;
+ if (saveLoadPage != _saveLoadPage) {
+ _saveLoadPage = saveLoadPage;
+ // This will also make the first slot the selected one, based
+ // on the mouse Y position. I can't decide if this is a feature
+ // or not.
+ selectSlot();
+ }
+}
+
void DreamWebEngine::selectSlot() {
commandOnlyCond(45, 244);
@@ -798,6 +820,8 @@ void DreamWebEngine::selectSlot() {
}
void DreamWebEngine::showSlots() {
+ showFrame(_icons1, kOpsx + 158, kOpsy - 11, 12, 0);
+ showFrame(_icons1, kOpsx + 158 + 18 * _saveLoadPage, kOpsy - 11, 13 + _saveLoadPage, 0);
showFrame(_tempGraphics, kOpsx + 7, kOpsy + 8, 2, 0);
uint16 y = kOpsy + 11;