aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2008-12-28 18:00:19 +0000
committerSven Hesse2008-12-28 18:00:19 +0000
commit017561a2e1da047b94e224e27062219fe7db11bb (patch)
treeddc1ed00b39ad4b1c80409de2dd706e970b83fa3 /engines/gob
parentacdd0354b22d8aca7959743575052118e2c486a2 (diff)
downloadscummvm-rg350-017561a2e1da047b94e224e27062219fe7db11bb.tar.gz
scummvm-rg350-017561a2e1da047b94e224e27062219fe7db11bb.tar.bz2
scummvm-rg350-017561a2e1da047b94e224e27062219fe7db11bb.zip
Fixing the save/load list box's width
svn-id: r35591
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/inter.cpp19
-rw-r--r--engines/gob/inter.h2
-rw-r--r--engines/gob/inter_v5.cpp8
-rw-r--r--engines/gob/saveload.h1
-rw-r--r--engines/gob/saveload_v6.cpp19
5 files changed, 30 insertions, 19 deletions
diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp
index 85eb69e7cf..869ab958c7 100644
--- a/engines/gob/inter.cpp
+++ b/engines/gob/inter.cpp
@@ -184,6 +184,25 @@ void Inter::storeKey(int16 key) {
_vm->_util->clearKeyBuf();
}
+void Inter::writeVar(uint32 offset, uint16 type, uint32 value) {
+ switch (type) {
+ case 16:
+ case 18:
+ WRITE_VARO_UINT8(offset, value);
+ break;
+
+ case 17:
+ case 24:
+ case 27:
+ WRITE_VARO_UINT16(offset, value);
+ break;
+
+ default:
+ WRITE_VAR_OFFSET(offset, value);
+ break;
+ }
+}
+
void Inter::funcBlock(int16 retFlag) {
OpFuncParams params;
byte cmd;
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index 5d82700457..9b63a7dd1e 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -59,6 +59,8 @@ public:
void storeMouse();
void storeKey(int16 key);
+ void writeVar(uint32 offset, uint16 type, uint32 value);
+
void funcBlock(int16 retFlag);
void callSub(int16 retFlag);
diff --git a/engines/gob/inter_v5.cpp b/engines/gob/inter_v5.cpp
index dbdeb6f533..8d56e0d265 100644
--- a/engines/gob/inter_v5.cpp
+++ b/engines/gob/inter_v5.cpp
@@ -782,19 +782,20 @@ void Inter_v5::o5_initScreen() {
bool Inter_v5::o5_istrlen(OpFuncParams &params) {
int16 strVar1, strVar2;
int16 len;
+ uint16 type;
if (*_vm->_global->_inter_execPtr == 0x80) {
_vm->_global->_inter_execPtr++;
strVar1 = _vm->_parse->parseVarIndex();
- strVar2 = _vm->_parse->parseVarIndex();
+ strVar2 = _vm->_parse->parseVarIndex(0, &type);
len = _vm->_draw->stringLength(GET_VARO_STR(strVar1), READ_VARO_UINT16(strVar2));
} else {
strVar1 = _vm->_parse->parseVarIndex();
- strVar2 = _vm->_parse->parseVarIndex();
+ strVar2 = _vm->_parse->parseVarIndex(0, &type);
if (_vm->_global->_language == 10) {
// Extra handling for Japanese strings
@@ -807,7 +808,8 @@ bool Inter_v5::o5_istrlen(OpFuncParams &params) {
len = strlen(GET_VARO_STR(strVar1));
}
- WRITE_VAR_OFFSET(strVar2, len);
+ writeVar(strVar2, type, (int32) len);
+
return false;
}
diff --git a/engines/gob/saveload.h b/engines/gob/saveload.h
index dbfa80b67a..c00351e555 100644
--- a/engines/gob/saveload.h
+++ b/engines/gob/saveload.h
@@ -438,7 +438,6 @@ protected:
StagedSave *_save;
byte _indexBuffer[2900];
- bool _hasIndex;
virtual int getSaveType(const char *fileName);
diff --git a/engines/gob/saveload_v6.cpp b/engines/gob/saveload_v6.cpp
index 694b96f1ec..7396642e33 100644
--- a/engines/gob/saveload_v6.cpp
+++ b/engines/gob/saveload_v6.cpp
@@ -50,7 +50,6 @@ SaveLoad_v6::SaveLoad_v6(GobEngine *vm, const char *targetName) :
sprintf(_saveFiles[0].destName, "%s.s00", targetName);
_varSize = 0;
- _hasIndex = false;
}
SaveLoad_v6::~SaveLoad_v6() {
@@ -145,8 +144,7 @@ int SaveLoad_v6::getSlotRemainder(int32 offset) const {
}
int32 SaveLoad_v6::getSizeGame(SaveFile &saveFile) {
- if (!_hasIndex)
- return -1;
+ refreshIndex();
Common::SaveFileManager *saveMan = g_system->getSavefileManager();
Common::InSaveFile *in;
@@ -178,11 +176,6 @@ bool SaveLoad_v6::loadGame(SaveFile &saveFile,
return false;
}
- if (!_hasIndex) {
- warning("No index written yet");
- return false;
- }
-
refreshIndex();
byte *sizes = new byte[size];
@@ -234,7 +227,6 @@ bool SaveLoad_v6::saveGame(SaveFile &saveFile,
}
_vm->_inter->_variables->copyTo(dataVar, _indexBuffer + offset, 0, size);
- _hasIndex = true;
} else {
int slot = getSlot(offset);
@@ -248,11 +240,6 @@ bool SaveLoad_v6::saveGame(SaveFile &saveFile,
return false;
}
- if (!_hasIndex) {
- warning("No index written yet");
- return false;
- }
-
SaveLoad::setCurrentSlot(saveFile.destName, slot);
byte sizes[40];
@@ -295,7 +282,9 @@ void SaveLoad_v6::refreshIndex() {
memset(names, 0, 40);
}
- WRITE_LE_UINT32(_indexBuffer + 160, max + 1);
+ memset(_indexBuffer + 40, 0xFF, 40); // Joker
+ _indexBuffer[159] = 0x03; // # of joker unused
+ WRITE_LE_UINT32(_indexBuffer + 160, max + 1); // # of saves
}
} // End of namespace Gob