[Scummvm-git-logs] scummvm master -> e12a25cb756aa344a07e88e1af85f34598bb0193
Strangerke
Strangerke at scummvm.org
Sun Feb 26 21:08:15 CET 2017
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e12a25cb75 CRYO: Improve syncTapePointers
Commit: e12a25cb756aa344a07e88e1af85f34598bb0193
https://github.com/scummvm/scummvm/commit/e12a25cb756aa344a07e88e1af85f34598bb0193
Author: Strangerke (strangerke at scummvm.org)
Date: 2017-02-26T20:54:35+01:00
Commit Message:
CRYO: Improve syncTapePointers
Changed paths:
engines/cryo/eden.cpp
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index 9991243..410a510 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -6774,20 +6774,42 @@ void EdenGame::syncCitadelRoomPointers(Common::Serializer s) {
}
void EdenGame::syncTapePointers(Common::Serializer s) {
- int persoIdx, dialogIdx;
+ int persoIdx;
for (int i = 0; i < 16; i++) {
+ int index, subIndex;
if (s.isSaving()) {
+ index = NULLPTR;
+ char *closerPtr = nullptr;
+ for (int j = (getElem((char *)_gameDialogs, 0) - (char *)_gameDialogs) / sizeof(char *) - 1; j >= 0; j--) {
+ char *tmpPtr = getElem((char *)_gameDialogs, j);
+ if ((tmpPtr <= (char *)_tapes[i]._dialog) && (tmpPtr > closerPtr)) {
+ index = j;
+ closerPtr = tmpPtr;
+ }
+ }
+
+ subIndex = NULLPTR;
+ if (index != NULLPTR)
+ subIndex = ((char *)_tapes[i]._dialog - closerPtr);
+
IDXOUT(_tapes[i]._perso, _persons, perso_t, persoIdx);
- IDXOUT(_tapes[i]._dialog, _gameDialogs, Dialog, dialogIdx);
}
s.syncAsUint32LE(persoIdx);
- s.syncAsUint32LE(dialogIdx);
+ s.syncAsUint32LE(index);
+ s.syncAsUint32LE(subIndex);
if (s.isLoading()) {
_tapes[i]._perso = (persoIdx == NULLPTR) ? nullptr : &_persons[persoIdx];
- _tapes[i]._dialog = (dialogIdx == NULLPTR) ? nullptr : (Dialog *)getElem(_gameDialogs, dialogIdx);
+ char *tmpPtr = nullptr;
+
+ if (index != NULLPTR) {
+ tmpPtr = getElem((char *)_gameDialogs, index);
+ if (subIndex != NULLPTR)
+ tmpPtr += subIndex;
+ }
+ _tapes[i]._dialog = (Dialog *)tmpPtr;
}
}
}
More information about the Scummvm-git-logs
mailing list