mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 22:28:10 +00:00
FULLPIPE: Fix saving object to savegames
This commit is contained in:
parent
1e9351efaf
commit
783d968e20
@ -78,11 +78,11 @@ void GameLoader::readSavegame(const char *fname) {
|
||||
for (uint i = 0; i < header.encSize; i++)
|
||||
data[i] -= i & 0x7f;
|
||||
|
||||
//Common::hexdump(data, 48);
|
||||
|
||||
MfcArchive *archive = new MfcArchive(new Common::MemoryReadStream(data, header.encSize));
|
||||
|
||||
GameVar var;
|
||||
|
||||
var.load(*archive);
|
||||
GameVar *var = (GameVar *)archive->readClass();
|
||||
|
||||
GameVar *v = _gameVar->getSubVarByName("OBJSTATES");
|
||||
|
||||
@ -96,7 +96,7 @@ void GameLoader::readSavegame(const char *fname) {
|
||||
}
|
||||
}
|
||||
|
||||
addVar(&var, v);
|
||||
addVar(var, v);
|
||||
|
||||
getGameLoaderInventory()->loadPartial(*archive);
|
||||
|
||||
@ -313,6 +313,8 @@ GameVar::GameVar() {
|
||||
_varType = 0;
|
||||
_value.floatValue = 0;
|
||||
_varName = 0;
|
||||
|
||||
_objtype = kObjTypeGameVar;
|
||||
}
|
||||
|
||||
GameVar::~GameVar() {
|
||||
|
@ -97,6 +97,8 @@ void GameLoader::writeSavegame(Scene *sc, const char *fname) {
|
||||
for (uint i = 0; i < header.encSize; i++)
|
||||
stream.getData()[i] += i & 0x7f;
|
||||
|
||||
//Common::hexdump(stream.getData(), 48);
|
||||
|
||||
if (_savegameCallback)
|
||||
_savegameCallback(archive, true);
|
||||
|
||||
|
@ -109,7 +109,7 @@ char *MfcArchive::readPascalString(bool twoByte) {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void MfcArchive::writePascalString(char *str, bool twoByte) {
|
||||
void MfcArchive::writePascalString(const char *str, bool twoByte) {
|
||||
int len = strlen(str);
|
||||
|
||||
if (twoByte)
|
||||
@ -475,6 +475,14 @@ void MfcArchive::writeObject(CObject *obj) {
|
||||
writeUint16LE(0xffff); // New class
|
||||
_objectHash[obj] = _lastIndex++;
|
||||
|
||||
switch (obj->_objtype) {
|
||||
case kObjTypeGameVar:
|
||||
writePascalString(lookupObjectId(kGameVar));
|
||||
break;
|
||||
default:
|
||||
error("Unhandled save for object type: %d", obj->_objtype);
|
||||
}
|
||||
|
||||
obj->save(*this);
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
MfcArchive(Common::WriteStream *file);
|
||||
|
||||
char *readPascalString(bool twoByte = false);
|
||||
void writePascalString(char *str, bool twoByte = false);
|
||||
void writePascalString(const char *str, bool twoByte = false);
|
||||
int readCount();
|
||||
double readDouble();
|
||||
CObject *parseClass(bool *isCopyReturned);
|
||||
@ -103,7 +103,8 @@ enum ObjType {
|
||||
kObjTypeMctlCompound,
|
||||
kObjTypeObjstateCommand,
|
||||
kObjTypePictureObject,
|
||||
kObjTypeStaticANIObject
|
||||
kObjTypeStaticANIObject,
|
||||
kObjTypeGameVar
|
||||
};
|
||||
|
||||
class CObject {
|
||||
|
Loading…
Reference in New Issue
Block a user