Ejemplo n.º 1
0
static void syncWithSerializer(Common::Serializer &s, Track &t) {
	s.syncAsSByte(t.pan, VER(31));
	s.syncAsSint32LE(t.vol, VER(31));
	s.syncAsSint32LE(t.volFadeDest, VER(31));
	s.syncAsSint32LE(t.volFadeStep, VER(31));
	s.syncAsSint32LE(t.volFadeDelay, VER(31));
	s.syncAsByte(t.volFadeUsed, VER(31));
	s.syncAsSint32LE(t.soundId, VER(31));
	s.syncArray(t.soundName, 15, Common::Serializer::SByte, VER(31));
	s.syncAsByte(t.used, VER(31));
	s.syncAsByte(t.toBeRemoved, VER(31));
	s.syncAsByte(t.souStreamUsed, VER(31));
	s.skip(1, VER(31), VER(76)); // mixerStreamRunning
	s.syncAsSint32LE(t.soundPriority, VER(31));
	s.syncAsSint32LE(t.regionOffset, VER(31));
	s.skip(4, VER(31), VER(31)); // trackOffset
	s.syncAsSint32LE(t.dataOffset, VER(31));
	s.syncAsSint32LE(t.curRegion, VER(31));
	s.syncAsSint32LE(t.curHookId, VER(31));
	s.syncAsSint32LE(t.volGroupId, VER(31));
	s.syncAsSint32LE(t.soundType, VER(31));
	s.syncAsSint32LE(t.feedSize, VER(31));
	s.syncAsSint32LE(t.dataMod12Bit, VER(31));
	s.syncAsSint32LE(t.mixerFlags, VER(31));
	s.skip(4, VER(31), VER(42)); // mixerVol
	s.skip(4, VER(31), VER(42)); // mixerPan
	s.syncAsByte(t.sndDataExtComp, VER(45));
}
Ejemplo n.º 2
0
void MADSAction::synchronize(Common::Serializer &s) {
	_action.synchronize(s);
	_activeAction.synchronize(s);
	s.syncAsSint16LE(_articleNumber);
	s.syncAsByte(_lookFlag);
	s.syncAsByte(_textChanged);
	s.syncAsSint16LE(_selectedRow);
	s.syncAsSint16LE(_selectedAction);
	s.syncAsSint16LE(_statusTextIndex);
	s.syncAsSint16LE(_hotspotId);
	_savedFields.synchronize(s);

	// TODO: When saving in Rex Village Hut, _senetence size() doesn't match
	// string length. Find out why not
	_sentence = Common::String(_sentence.c_str());
	s.syncString(_sentence);

	s.syncAsSint16LE(_verbType);
	s.syncAsSint16LE(_prepType);
	s.syncAsSint16LE(_commandSource);
	s.syncAsSint16LE(_mainObjectSource);
	s.syncAsSint16LE(_secondObject);
	s.syncAsSint16LE(_secondObjectSource);
	s.syncAsSint16LE(_recentCommandSource);
	s.syncAsSint16LE(_recentCommand);
	s.syncAsSint16LE(_interAwaiting);
	s.syncAsSint16LE(_pickedWord);
	s.syncAsByte(_pointEstablished);
	s.syncAsByte(_inProgress);
}
Ejemplo n.º 3
0
void syncAllActorsAlive(Common::Serializer &s) {
	for (int i = 0; i < MAX_SAVED_ALIVES; i++) {
		s.syncAsByte(actorInfo[i].bAlive);
		s.syncAsByte(actorInfo[i].tagged);
		s.syncAsByte(actorInfo[i].tType);
		s.syncAsUint32LE(actorInfo[i].hTag);
	}
}
Ejemplo n.º 4
0
static void syncTime(Common::Serializer &s, TimeDate &t) {
	s.syncAsUint16LE(t.tm_year);
	s.syncAsByte(t.tm_mon);
	s.syncAsByte(t.tm_mday);
	s.syncAsByte(t.tm_hour);
	s.syncAsByte(t.tm_min);
	s.syncAsByte(t.tm_sec);
}
Ejemplo n.º 5
0
void Scene::synchronize(Common::Serializer &s) {
	_action.synchronize(s);
	_rails.synchronize(s);
	_userInterface.synchronize(s);
	s.syncAsByte(_reloadSceneFlag);
	s.syncAsByte(_roomChanged);
	s.syncAsUint16LE(_nextSceneId);
	s.syncAsUint16LE(_priorSceneId);
	_dynamicHotspots.synchronize(s);
}
Ejemplo n.º 6
0
static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
	s.syncAsUint32LE(hdr.id);
	s.syncAsUint32LE(hdr.size);
	s.syncAsUint32LE(hdr.ver);

	s.syncBytes((byte *)hdr.desc, SG_DESC_LEN);
	hdr.desc[SG_DESC_LEN - 1] = 0;

	syncTime(s, hdr.dateTime);

	int tmp = hdr.size - s.bytesSynced();

	// NOTE: We can't use SAVEGAME_ID here when attempting to remove a saved game from the launcher,
	// as there is no TinselEngine initialized then. This means that we can't check if this is a DW1
	// or DW2 savegame in this case, but it doesn't really matter, as the saved game is about to be
	// deleted anyway. Refer to bug #3387551.
	bool correctID = _vm ? (hdr.id == SAVEGAME_ID) : (hdr.id == DW1_SAVEGAME_ID || hdr.id == DW2_SAVEGAME_ID);

	// Perform sanity check
	if (tmp < 0 || !correctID || hdr.ver > CURRENT_VER || hdr.size > 1024)
		return false;

	if (tmp > 0) {
		// If there's header space left, handling syncing the Scn flag and game language
		s.syncAsByte(hdr.scnFlag);
		s.syncAsByte(hdr.language);
		tmp -= 2;

		if (_vm && s.isLoading()) {
			// If the engine is loaded, ensure the Scn/Gra usage is correct, and it's the correct language
			if ((hdr.scnFlag != ((_vm->getFeatures() & GF_SCNFILES) != 0)) ||
					(hdr.language != _vm->_config->_language))
				return false;
		}
	}

	// Handle the number of interpreter contexts that will be saved in the savegame
	if (tmp >= 2) {
		tmp -= 2;
		hdr.numInterpreters = NUM_INTERPRET;
		s.syncAsUint16LE(hdr.numInterpreters);
	} else {
		hdr.numInterpreters = (TinselV2 ? 70 : 64) - 20;
	}

	// Skip over any extra bytes
	s.skip(tmp);
	return true;
}
Ejemplo n.º 7
0
static void syncSongs(Common::Serializer &s) {
	int size = 0;

	if (songLoaded) {
		// TODO: implement
		s.syncAsByte(size);
		if (s.isLoading()) {
			saveVar1 = size;
			if (saveVar1)
				s.syncBytes(saveVar2, saveVar1);
		}
	} else {
		s.syncAsByte(size);
	}
}
Ejemplo n.º 8
0
static void syncSavedMover(Common::Serializer &s, SAVED_MOVER &sm) {
	int i, j;

	s.syncAsUint32LE(sm.bActive);
	s.syncAsSint32LE(sm.actorID);
	s.syncAsSint32LE(sm.objX);
	s.syncAsSint32LE(sm.objY);
	s.syncAsUint32LE(sm.hLastfilm);

	// Sync walk reels
	for (i = 0; i < TOTAL_SCALES; ++i)
		for (j = 0; j < 4; ++j)
			s.syncAsUint32LE(sm.walkReels[i][j]);

	// Sync stand reels
	for (i = 0; i < TOTAL_SCALES; ++i)
		for (j = 0; j < 4; ++j)
			s.syncAsUint32LE(sm.standReels[i][j]);

	// Sync talk reels
	for (i = 0; i < TOTAL_SCALES; ++i)
		for (j = 0; j < 4; ++j)
			s.syncAsUint32LE(sm.talkReels[i][j]);


	if (TinselV2) {
		s.syncAsByte(sm.bHidden);

		s.syncAsSint32LE(sm.brightness);
		s.syncAsSint32LE(sm.startColor);
		s.syncAsSint32LE(sm.paletteLength);
	}
}
Ejemplo n.º 9
0
void ActionSavedFields::synchronize(Common::Serializer &s) {
	s.syncAsByte(_commandError);
	s.syncAsSint16LE(_commandSource);
	s.syncAsSint16LE(_command);
	s.syncAsSint16LE(_mainObject);
	s.syncAsSint16LE(_secondObject);
	s.syncAsSint16LE(_mainObjectSource);
	s.syncAsSint16LE(_secondObjectSource);
	s.syncAsSint16LE(_articleNumber);
	s.syncAsSint16LE(_lookFlag);
}
Ejemplo n.º 10
0
static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd, int numInterp) {
	s.syncAsUint32LE(sd.SavedSceneHandle);
	s.syncAsUint32LE(sd.SavedBgroundHandle);
	for (int i = 0; i < MAX_MOVERS; ++i)
		syncSavedMover(s, sd.SavedMoverInfo[i]);
	for (int i = 0; i < MAX_SAVED_ACTORS; ++i)
		syncSavedActor(s, sd.SavedActorInfo[i]);

	s.syncAsSint32LE(sd.NumSavedActors);
	s.syncAsSint32LE(sd.SavedLoffset);
	s.syncAsSint32LE(sd.SavedToffset);
	for (int i = 0; i < numInterp; ++i)
		sd.SavedICInfo[i].syncWithSerializer(s);
	for (int i = 0; i < MAX_POLY; ++i)
		s.syncAsUint32LE(sd.SavedDeadPolys[i]);
	s.syncAsUint32LE(sd.SavedControl);
	s.syncAsUint32LE(sd.SavedMidi);
	s.syncAsUint32LE(sd.SavedLoop);
	s.syncAsUint32LE(sd.SavedNoBlocking);

	// SavedNoScrollData
	for (int i = 0; i < MAX_VNOSCROLL; ++i)
		syncNoScrollB(s, sd.SavedNoScrollData.NoVScroll[i]);
	for (int i = 0; i < MAX_HNOSCROLL; ++i)
		syncNoScrollB(s, sd.SavedNoScrollData.NoHScroll[i]);
	s.syncAsUint32LE(sd.SavedNoScrollData.NumNoV);
	s.syncAsUint32LE(sd.SavedNoScrollData.NumNoH);

	// Tinsel 2 fields
	if (TinselV2) {
		// SavedNoScrollData
		s.syncAsUint32LE(sd.SavedNoScrollData.xTrigger);
		s.syncAsUint32LE(sd.SavedNoScrollData.xDistance);
		s.syncAsUint32LE(sd.SavedNoScrollData.xSpeed);
		s.syncAsUint32LE(sd.SavedNoScrollData.yTriggerTop);
		s.syncAsUint32LE(sd.SavedNoScrollData.yTriggerBottom);
		s.syncAsUint32LE(sd.SavedNoScrollData.yDistance);
		s.syncAsUint32LE(sd.SavedNoScrollData.ySpeed);

		for (int i = 0; i < NUM_ZPOSITIONS; ++i)
			syncZPosition(s, sd.zPositions[i]);
		s.syncBytes(sd.savedActorZ, MAX_SAVED_ACTOR_Z);
		for (int i = 0; i < MAX_POLY; ++i)
			syncPolyVolatile(s, sd.SavedPolygonStuff[i]);
		for (int i = 0; i < 3; ++i)
			s.syncAsUint32LE(sd.SavedTune[i]);
		s.syncAsByte(sd.bTinselDim);
		s.syncAsSint32LE(sd.SavedScrollFocus);
		for (int i = 0; i < SV_TOPVALID; ++i)
			s.syncAsSint32LE(sd.SavedSystemVars[i]);
		for (int i = 0; i < MAX_SOUNDREELS; ++i)
			syncSoundReel(s, sd.SavedSoundReels[i]);
	}
}
Ejemplo n.º 11
0
static void syncPreloadData(Common::Serializer &s) {
	uint8 dummyByte = 0;
	uint32 dummyLong = 0;

	for (int i = 0; i < 64; i++) {
		preloadStruct &pe = preloadData[i];

		s.syncBytes((byte *)pe.name, 15);
		s.syncAsByte(dummyByte);
		s.syncAsUint32LE(pe.size);
		s.syncAsUint32LE(pe.sourceSize);
		s.syncAsUint32LE(dummyLong);
		s.syncAsUint16LE(pe.nofree);
		s.syncAsUint16LE(pe.protect);
		s.syncAsUint16LE(pe.ovl);
	}
}
Ejemplo n.º 12
0
void CGEEngine::syncHeader(Common::Serializer &s) {
	debugC(1, kCGEDebugEngine, "CGEEngine::syncHeader(s)");

	int i = kDemo;

	s.syncAsUint16LE(_now);
	s.syncAsUint16LE(_oldLev);
	s.syncAsUint16LE(i);        // unused Demo string id
	for (i = 0; i < 5; i++)
		s.syncAsUint16LE(_game);
	s.syncAsSint16LE(i);		// unused VGA::Mono variable
	s.syncAsUint16LE(_music);
	s.syncBytes(_volume, 2);
	for (i = 0; i < 4; i++)
		s.syncAsUint16LE(_flag[i]);

	if (s.isLoading()) {
		// Reset scene values
		initSceneValues();
	}

	for (i = 0; i < kSceneMax; i++) {
		s.syncAsSint16LE(_heroXY[i].x);
		s.syncAsUint16LE(_heroXY[i].y);
	}
	for (i = 0; i < 1 + kSceneMax; i++) {
		s.syncAsByte(_barriers[i]._horz);
		s.syncAsByte(_barriers[i]._vert);
	}
	for (i = 0; i < kPocketNX; i++)
		s.syncAsUint16LE(_pocref[i]);

	if (s.isSaving()) {
		// Write checksum
		int checksum = kSavegameCheckSum;
		s.syncAsUint16LE(checksum);
	} else {
		// Read checksum and validate it
		uint16 checksum = 0;
		s.syncAsUint16LE(checksum);
		if (checksum != kSavegameCheckSum)
			error("%s", _text->getText(kBadSVG));
	}
}
Ejemplo n.º 13
0
static void syncOverlays1(Common::Serializer &s) {
	uint8 dummyByte = 0;
	uint32 dummyLong = 0;

	for (int i = 0; i < numOfLoadedOverlay; i++) {
		overlayStruct &oe = overlayTable[i];

		s.syncBytes((byte *)oe.overlayName, 13);
		s.syncAsByte(dummyByte);
		s.syncAsUint32LE(dummyLong);
		s.syncAsUint16LE(oe.alreadyLoaded);
		s.syncAsUint16LE(oe.state);
		s.syncAsUint32LE(dummyLong);
		s.syncAsUint32LE(dummyLong);
		s.syncAsUint32LE(dummyLong);
		s.syncAsUint32LE(dummyLong);
		s.syncAsUint16LE(oe.executeScripts);
	}
}
Ejemplo n.º 14
0
void SavesManager::syncBitFlags(Common::Serializer &s, bool *startP, bool *endP) {
	byte data = 0;

	int bitCounter = 0;
	for (bool *p = startP; p <= endP; ++p, bitCounter = (bitCounter + 1) % 8) {
		if (p == endP || bitCounter == 0) {
			if (p != endP || s.isSaving())
				s.syncAsByte(data);
			if (p == endP)
				break;

			if (s.isSaving())
				data = 0;
		}

		if (s.isLoading())
			*p = (data >> bitCounter) != 0;
		else if (*p)
			data |= 1 << bitCounter;
	}
Ejemplo n.º 15
0
static void syncFilesDatabase(Common::Serializer &s) {
	uint8 dummyVal = 0;
	uint32 tmp;

	for (int i = 0; i < NUM_FILE_ENTRIES; i++) {
		dataFileEntry &fe = filesDatabase[i];

		s.syncAsUint16LE(fe.widthInColumn);
		s.syncAsUint16LE(fe.width);
		s.syncAsUint16LE(fe.resType);
		s.syncAsUint16LE(fe.height);

		// Remember whether this file database was open or not.
		// Upon loading, loadSavegameData uses this information
		// in order to re-open the file databases accordingly.
		tmp = (fe.subData.ptr) ? 1 : 0;
		s.syncAsUint32LE(tmp);
		if (s.isLoading()) {
			fe.subData.ptr = tmp ? (uint8 *)1 : 0;
		}

		s.syncAsSint16LE(fe.subData.index);
		s.syncBytes((byte *)fe.subData.name, 13);
		s.syncAsByte(dummyVal);

		s.syncAsSint16LE(fe.subData.transparency);

		// Treat fe.subData.ptrMask the same as fe.subData.ptr.
		tmp = (fe.subData.ptrMask) ? 1 : 0;
		s.syncAsUint32LE(tmp);
		if (s.isLoading()) {
			fe.subData.ptrMask = tmp ? (uint8 *)1 : 0;
		}

		s.syncAsUint16LE(fe.subData.resourceType);
		s.syncAsSint16LE(fe.subData.compression);
	}
}
Ejemplo n.º 16
0
static void syncSavedMover(Common::Serializer &s, SAVED_MOVER &sm) {
	SCNHANDLE *pList[3] = { (SCNHANDLE *)&sm.walkReels,
		(SCNHANDLE *)&sm.standReels, (SCNHANDLE *)&sm.talkReels };

	s.syncAsUint32LE(sm.bActive);
	s.syncAsSint32LE(sm.actorID);
	s.syncAsSint32LE(sm.objX);
	s.syncAsSint32LE(sm.objY);
	s.syncAsUint32LE(sm.hLastfilm);

	for (int pIndex = 0; pIndex < 3; ++pIndex) {
		SCNHANDLE *p = pList[pIndex];
		for (int i = 0; i < TOTAL_SCALES * 4; ++i)
			s.syncAsUint32LE(*p++);
	}

	if (TinselV2) {
		s.syncAsByte(sm.bHidden);

		s.syncAsSint32LE(sm.brightness);
		s.syncAsSint32LE(sm.startColor);
		s.syncAsSint32LE(sm.paletteLength);
	}
}
Ejemplo n.º 17
0
static void syncFilesDatabase(Common::Serializer &s) {
	uint8 dummyVal = 0;
	uint32 tmp;

	for (int i = 0; i < NUM_FILE_ENTRIES; i++) {
		dataFileEntry &fe = filesDatabase[i];

		s.syncAsUint16LE(fe.widthInColumn);
		s.syncAsUint16LE(fe.width);
		s.syncAsUint16LE(fe.resType);
		s.syncAsUint16LE(fe.height);

		// TODO: Have a look at the saving/loading of this pointer
		tmp = (fe.subData.ptr) ? 1 : 0;
		s.syncAsUint32LE(tmp);
		if (s.isLoading()) {
			fe.subData.ptr = (uint8 *)tmp;
		}

		s.syncAsSint16LE(fe.subData.index);
		s.syncBytes((byte *)fe.subData.name, 13);
		s.syncAsByte(dummyVal);

		s.syncAsSint16LE(fe.subData.transparency);

		// TODO: Have a look at the saving/loading of this pointer
		tmp = (fe.subData.ptrMask) ? 1 : 0;
		s.syncAsUint32LE(tmp);
		if (s.isLoading()) {
			fe.subData.ptrMask = (uint8 *)tmp;
		}

		s.syncAsUint16LE(fe.subData.resourceType);
		s.syncAsSint16LE(fe.subData.compression);
	}
}
Ejemplo n.º 18
0
void IMuseDigital::saveLoadEarly(Common::Serializer &s) {
	Common::StackLock lock(_mutex, "IMuseDigital::saveLoadEarly()");

	s.skip(4, VER(31), VER(42)); // _volVoice
	s.skip(4, VER(31), VER(42)); // _volSfx
	s.skip(4, VER(31), VER(42)); // _volMusic
	s.syncAsSint32LE(_curMusicState, VER(31));
	s.syncAsSint32LE(_curMusicSeq, VER(31));
	s.syncAsSint32LE(_curMusicCue, VER(31));
	s.syncAsSint32LE(_nextSeqToPlay, VER(31));
	s.syncAsByte(_radioChatterSFX, VER(76));
	s.syncArray(_attributes, 188, Common::Serializer::Sint32LE, VER(31));

	for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
		Track *track = _track[l];
		if (s.isLoading()) {
			memset(track, 0, sizeof(Track));
		}
		syncWithSerializer(s, *track);
		if (s.isLoading()) {
			_track[l]->trackId = l;
			if (!track->used)
				continue;
			if ((track->toBeRemoved) || (track->souStreamUsed) || (track->curRegion == -1)) {
				track->used = false;
				continue;
			}

			// TODO: The code below has a lot in common with that in IMuseDigital::startSound.
			// Try to refactor them to reduce the code duplication.

			track->soundDesc = _sound->openSound(track->soundId, track->soundName, track->soundType, track->volGroupId, -1);
			if (!track->soundDesc)
				track->soundDesc = _sound->openSound(track->soundId, track->soundName, track->soundType, track->volGroupId, 1);
			if (!track->soundDesc)
				track->soundDesc = _sound->openSound(track->soundId, track->soundName, track->soundType, track->volGroupId, 2);

			if (!track->soundDesc) {
				warning("IMuseDigital::saveOrLoad: Can't open sound so will not be resumed");
				track->used = false;
				continue;
			}

			track->sndDataExtComp = _sound->isSndDataExtComp(track->soundDesc);
			track->dataOffset = _sound->getRegionOffset(track->soundDesc, track->curRegion);
			int bits = _sound->getBits(track->soundDesc);
			int channels = _sound->getChannels(track->soundDesc);
			int freq = _sound->getFreq(track->soundDesc);
			track->feedSize = freq * channels;
			track->mixerFlags = 0;
			if (channels == 2)
				track->mixerFlags = kFlagStereo;

			if ((bits == 12) || (bits == 16)) {
				track->mixerFlags |= kFlag16Bits;
				track->feedSize *= 2;
			} else if (bits == 8) {
				track->mixerFlags |= kFlagUnsigned;
			} else
				error("IMuseDigital::saveOrLoad(): Can't handle %d bit samples", bits);

			track->stream = Audio::makeQueuingAudioStream(freq, (track->mixerFlags & kFlagStereo) != 0);

			_mixer->playStream(track->getType(), &track->mixChanHandle, track->stream, -1, track->getVol(), track->getPan());
			_mixer->pauseHandle(track->mixChanHandle, true);
		}
	}
}
Ejemplo n.º 19
0
void Nim::synchronize(Common::Serializer &sz) {
	if (sz.isLoading() && sz.getVersion() < 2)
		return;

	sz.syncAsByte(_playedNim);
}
Ejemplo n.º 20
0
void AvalancheEngine::synchronize(Common::Serializer &sz) {
	_animation->synchronize(sz);
	_parser->synchronize(sz);
	_nim->synchronize(sz);
	_sequence->synchronize(sz);
	_background->synchronize(sz);

	sz.syncAsByte(_carryNum);
	for (int i = 0; i < kObjectNum; i++)
		sz.syncAsByte(_objects[i]);
	sz.syncAsSint16LE(_score);
	sz.syncAsSint32LE(_money);
	sz.syncAsByte(_room);
	if (sz.isSaving())
		_saveNum++;
	sz.syncAsByte(_saveNum);
	sz.syncBytes(_roomCount, 100);
	sz.syncAsByte(_wonNim);
	sz.syncAsByte(_wineState);
	sz.syncAsByte(_cwytalotGone);
	sz.syncAsByte(_passwordNum);
	sz.syncAsByte(_aylesIsAwake);
	sz.syncAsByte(_drawbridgeOpen);
	sz.syncAsByte(_avariciusTalk);
	sz.syncAsByte(_rottenOnion);
	sz.syncAsByte(_onionInVinegar);
	sz.syncAsByte(_givenToSpludwick);
	sz.syncAsByte(_brummieStairs);
	sz.syncAsByte(_cardiffQuestionNum);
	sz.syncAsByte(_passedCwytalotInHerts);
	sz.syncAsByte(_avvyIsAwake);
	sz.syncAsByte(_avvyInBed);
	sz.syncAsByte(_userMovesAvvy);
	sz.syncAsByte(_npcFacing);
	sz.syncAsByte(_givenBadgeToIby);
	sz.syncAsByte(_friarWillTieYouUp);
	sz.syncAsByte(_tiedUp);
	sz.syncAsByte(_boxContent);
	sz.syncAsByte(_talkedToCrapulus);
	sz.syncAsByte(_jacquesState);
	sz.syncAsByte(_bellsAreRinging);
	sz.syncAsByte(_standingOnDais);
	sz.syncAsByte(_takenPen);
	sz.syncAsByte(_arrowInTheDoor);

	if (sz.isSaving()) {
		uint16 like2drinkSize = _favoriteDrink.size();
		sz.syncAsUint16LE(like2drinkSize);
		for (uint16 i = 0; i < like2drinkSize; i++) {
			char actChr = _favoriteDrink[i];
			sz.syncAsByte(actChr);
		}

		uint16 favoriteSongSize = _favoriteSong.size();
		sz.syncAsUint16LE(favoriteSongSize);
		for (uint16 i = 0; i < favoriteSongSize; i++) {
			char actChr = _favoriteSong[i];
			sz.syncAsByte(actChr);
		}

		uint16 worst_place_on_earthSize = _worstPlaceOnEarth.size();
		sz.syncAsUint16LE(worst_place_on_earthSize);
		for (uint16 i = 0; i < worst_place_on_earthSize; i++) {
			char actChr = _worstPlaceOnEarth[i];
			sz.syncAsByte(actChr);
		}

		uint16 spare_eveningSize = _spareEvening.size();
		sz.syncAsUint16LE(spare_eveningSize);
		for (uint16 i = 0; i < spare_eveningSize; i++) {
			char actChr = _spareEvening[i];
			sz.syncAsByte(actChr);
		}
	} else {
		if (!_favoriteDrink.empty())
			_favoriteDrink.clear();
		uint16 like2drinkSize = 0;
		char actChr = ' ';
		sz.syncAsUint16LE(like2drinkSize);
		for (uint16 i = 0; i < like2drinkSize; i++) {
			sz.syncAsByte(actChr);
			_favoriteDrink += actChr;
		}

		if (!_favoriteSong.empty())
			_favoriteSong.clear();
		uint16 favoriteSongSize = 0;
		sz.syncAsUint16LE(favoriteSongSize);
		for (uint16 i = 0; i < favoriteSongSize; i++) {
			sz.syncAsByte(actChr);
			_favoriteSong += actChr;
		}

		if (!_worstPlaceOnEarth.empty())
			_worstPlaceOnEarth.clear();
		uint16 worst_place_on_earthSize = 0;
		sz.syncAsUint16LE(worst_place_on_earthSize);
		for (uint16 i = 0; i < worst_place_on_earthSize; i++) {
			sz.syncAsByte(actChr);
			_worstPlaceOnEarth += actChr;
		}

		if (!_spareEvening.empty())
			_spareEvening.clear();
		uint16 spare_eveningSize = 0;
		sz.syncAsUint16LE(spare_eveningSize);
		for (uint16 i = 0; i < spare_eveningSize; i++) {
			sz.syncAsByte(actChr);
			_spareEvening += actChr;
		}
	}

	sz.syncAsSint32LE(_totalTime);
	sz.syncAsByte(_jumpStatus);
	sz.syncAsByte(_mushroomGrowing);
	sz.syncAsByte(_spludwickAtHome);
	sz.syncAsByte(_lastRoom);
	sz.syncAsByte(_lastRoomNotMap);
	sz.syncAsByte(_crapulusWillTell);
	sz.syncAsByte(_enterCatacombsFromLustiesRoom);
	sz.syncAsByte(_teetotal);
	sz.syncAsByte(_malagauche);
	sz.syncAsByte(_drinking);
	sz.syncAsByte(_enteredLustiesRoomAsMonk);
	sz.syncAsByte(_catacombX);
	sz.syncAsByte(_catacombY);
	sz.syncAsByte(_avvysInTheCupboard);
	sz.syncAsByte(_geidaFollows);
	sz.syncAsByte(_givenPotionToGeida);
	sz.syncAsByte(_lustieIsAsleep);
	sz.syncAsByte(_beenTiedUp);
	sz.syncAsByte(_sittingInPub);
	sz.syncAsByte(_spurgeTalkCount);
	sz.syncAsByte(_metAvaroid);
	sz.syncAsByte(_takenMushroom);
	sz.syncAsByte(_givenPenToAyles);
	sz.syncAsByte(_askedDogfoodAboutNim);

	for (int i = 0; i < 7; i++) {
		sz.syncAsSint32LE(_timer->_times[i]._timeLeft);
		sz.syncAsByte(_timer->_times[i]._action);
		sz.syncAsByte(_timer->_times[i]._reason);
	}

}
Ejemplo n.º 21
0
static void syncPolyVolatile(Common::Serializer &s, POLY_VOLATILE &p) {
	s.syncAsByte(p.bDead);
	s.syncAsSint16LE(p.xoff);
	s.syncAsSint16LE(p.yoff);
}
Ejemplo n.º 22
0
void EntityData::EntityCallData::saveLoadWithSerializer(Common::Serializer &s) {
	for (uint i = 0; i < ARRAYSIZE(callbacks); i++)
		s.syncAsByte(callbacks[i]);

	s.syncAsByte(currentCall);
	s.syncAsUint16LE(entityPosition);
	s.syncAsUint16LE(location);
	s.syncAsUint16LE(car);
	s.syncAsByte(field_497);
	s.syncAsByte(entity);
	s.syncAsByte(inventoryItem);
	s.syncAsByte(direction);
	s.syncAsUint16LE(field_49B);
	s.syncAsUint16LE(currentFrame);
	s.syncAsUint16LE(currentFrame2);
	s.syncAsUint16LE(field_4A1);
	s.syncAsUint16LE(field_4A3);
	s.syncAsByte(clothes);
	s.syncAsByte(position);
	s.syncAsByte(car2);
	s.syncAsByte(doProcessEntity);
	s.syncAsByte(field_4A9);
	s.syncAsByte(field_4AA);
	s.syncAsByte(directionSwitch);

	// Sync strings
#define SYNC_STRING(varName, count) { \
	char seqName[13]; \
	memset(&seqName, 0, count); \
	if (s.isSaving()) strcpy((char *)&seqName, varName.c_str()); \
	s.syncBytes((byte *)&seqName, count); \
	if (s.isLoading()) varName = seqName; \
}

	SYNC_STRING(sequenceName, 13);
	SYNC_STRING(sequenceName2, 13);
	SYNC_STRING(sequenceNamePrefix, 7);
	SYNC_STRING(sequenceNameCopy, 13);

#undef SYNC_STRING

	// Skip pointers to frame & sequences
	s.skip(5 * 4);
}
Ejemplo n.º 23
0
void MystGameState::syncGameState(Common::Serializer &s, bool isME) {
    // Globals first
    s.syncAsUint16LE(_globals.u0);
    s.syncAsUint16LE(_globals.currentAge);
    s.syncAsUint16LE(_globals.heldPage);
    s.syncAsUint16LE(_globals.u1);
    s.syncAsUint16LE(_globals.transitions);
    s.syncAsUint16LE(_globals.zipMode);
    s.syncAsUint16LE(_globals.redPagesInBook);
    s.syncAsUint16LE(_globals.bluePagesInBook);

    // Onto Myst
    if (isME) {
        s.syncAsUint32LE(_myst.cabinMarkerSwitch);
        s.syncAsUint32LE(_myst.clockTowerMarkerSwitch);
        s.syncAsUint32LE(_myst.dockMarkerSwitch);
        s.syncAsUint32LE(_myst.poolMarkerSwitch);
        s.syncAsUint32LE(_myst.gearsMarkerSwitch);
        s.syncAsUint32LE(_myst.generatorMarkerSwitch);
        s.syncAsUint32LE(_myst.observatoryMarkerSwitch);
        s.syncAsUint32LE(_myst.rocketshipMarkerSwitch);
    } else {
        s.syncAsByte(_myst.cabinMarkerSwitch);
        s.syncAsByte(_myst.clockTowerMarkerSwitch);
        s.syncAsByte(_myst.dockMarkerSwitch);
        s.syncAsByte(_myst.poolMarkerSwitch);
        s.syncAsByte(_myst.gearsMarkerSwitch);
        s.syncAsByte(_myst.generatorMarkerSwitch);
        s.syncAsByte(_myst.observatoryMarkerSwitch);
        s.syncAsByte(_myst.rocketshipMarkerSwitch);
    }

    s.syncAsUint16LE(_myst.greenBookOpenedBefore);
    s.syncAsUint16LE(_myst.shipFloating);
    s.syncAsUint16LE(_myst.cabinValvePosition);
    s.syncAsUint16LE(_myst.clockTowerHourPosition);
    s.syncAsUint16LE(_myst.clockTowerMinutePosition);
    s.syncAsUint16LE(_myst.gearsOpen);
    s.syncAsUint16LE(_myst.clockTowerBridgeOpen);
    s.syncAsUint16LE(_myst.generatorBreakers);
    s.syncAsUint16LE(_myst.generatorButtons);
    s.syncAsUint16LE(_myst.generatorVoltage);
    s.syncAsUint16LE(_myst.libraryBookcaseDoor);
    s.syncAsUint16LE(_myst.imagerSelection);
    s.syncAsUint16LE(_myst.imagerActive);
    s.syncAsUint16LE(_myst.imagerWaterErased);
    s.syncAsUint16LE(_myst.imagerMountainErased);
    s.syncAsUint16LE(_myst.imagerAtrusErased);
    s.syncAsUint16LE(_myst.imagerMarkerErased);
    s.syncAsUint16LE(_myst.towerRotationAngle);
    s.syncAsUint16LE(_myst.courtyardImageBoxes);
    s.syncAsUint16LE(_myst.cabinPilotLightLit);
    s.syncAsUint16LE(_myst.observatoryDaySetting);
    s.syncAsUint16LE(_myst.observatoryLights);
    s.syncAsUint16LE(_myst.observatoryMonthSetting);
    s.syncAsUint16LE(_myst.observatoryTimeSetting);
    s.syncAsUint16LE(_myst.observatoryYearSetting);
    s.syncAsUint16LE(_myst.observatoryDayTarget);
    s.syncAsUint16LE(_myst.observatoryMonthTarget);
    s.syncAsUint16LE(_myst.observatoryTimeTarget);
    s.syncAsUint16LE(_myst.observatoryYearTarget);
    s.syncAsUint16LE(_myst.cabinSafeCombination);
    s.syncAsUint16LE(_myst.treePosition);
    s.syncAsUint32LE(_myst.treeLastMoveTime);

    for (int i = 0; i < 5; i++)
        s.syncAsUint16LE(_myst.rocketSliderPosition[i]);

    s.syncAsUint16LE(_myst.observatoryDaySlider);
    s.syncAsUint16LE(_myst.observatoryMonthSlider);
    s.syncAsUint16LE(_myst.observatoryYearSlider);
    s.syncAsUint16LE(_myst.observatoryTimeSlider);

    // Channelwood
    if (isME) {
        s.syncAsUint32LE(_channelwood.waterPumpBridgeState);
        s.syncAsUint32LE(_channelwood.elevatorState);
        s.syncAsUint32LE(_channelwood.stairsLowerDoorState);
        s.syncAsUint32LE(_channelwood.pipeState);
    } else {
        s.syncAsByte(_channelwood.waterPumpBridgeState);
        s.syncAsByte(_channelwood.elevatorState);
        s.syncAsByte(_channelwood.stairsLowerDoorState);
        s.syncAsByte(_channelwood.pipeState);
    }

    s.syncAsUint16LE(_channelwood.waterValveStates);
    s.syncAsUint16LE(_channelwood.holoprojectorSelection);
    s.syncAsUint16LE(_channelwood.stairsUpperDoorState);

    if (isME)
        s.skip(4);
    else
        s.skip(1);

    // Mechanical

    s.syncAsUint16LE(_mechanical.achenarPanelState);
    s.syncAsUint16LE(_mechanical.sirrusPanelState);
    s.syncAsUint16LE(_mechanical.staircaseState);
    s.syncAsUint16LE(_mechanical.elevatorRotation);

    for (int i = 0; i < 4; i++)
        s.syncAsUint16LE(_mechanical.codeShape[i]);

    // Selenitic

    if (isME) {
        s.syncAsUint32LE(_selenitic.emitterEnabledWater);
        s.syncAsUint32LE(_selenitic.emitterEnabledVolcano);
        s.syncAsUint32LE(_selenitic.emitterEnabledClock);
        s.syncAsUint32LE(_selenitic.emitterEnabledCrystal);
        s.syncAsUint32LE(_selenitic.emitterEnabledWind);
        s.syncAsUint32LE(_selenitic.soundReceiverOpened);
        s.syncAsUint32LE(_selenitic.tunnelLightsSwitchedOn);
    } else {
        s.syncAsByte(_selenitic.emitterEnabledWater);
        s.syncAsByte(_selenitic.emitterEnabledVolcano);
        s.syncAsByte(_selenitic.emitterEnabledClock);
        s.syncAsByte(_selenitic.emitterEnabledCrystal);
        s.syncAsByte(_selenitic.emitterEnabledWind);
        s.syncAsByte(_selenitic.soundReceiverOpened);
        s.syncAsByte(_selenitic.tunnelLightsSwitchedOn);
    }

    s.syncAsUint16LE(_selenitic.soundReceiverCurrentSource);

    for (byte i = 0; i < 5; i++)
        s.syncAsUint16LE(_selenitic.soundReceiverPositions[i]);

    for (byte i = 0; i < 5; i++)
        s.syncAsUint16LE(_selenitic.soundLockSliderPositions[i]);

    // Stoneship

    if (isME) {
        s.syncAsUint32LE(_stoneship.lightState);
    } else {
        s.syncAsByte(_stoneship.lightState);
    }

    s.syncAsUint16LE(_stoneship.sideDoorOpened);
    s.syncAsUint16LE(_stoneship.pumpState);
    s.syncAsUint16LE(_stoneship.trapdoorState);
    s.syncAsUint16LE(_stoneship.chestWaterState);
    s.syncAsUint16LE(_stoneship.chestValveState);
    s.syncAsUint16LE(_stoneship.chestOpenState);
    s.syncAsUint16LE(_stoneship.trapdoorKeyState);
    s.syncAsUint32LE(_stoneship.generatorDuration);
    s.syncAsUint16LE(_stoneship.generatorPowerAvailable);
    s.syncAsUint32LE(_stoneship.generatorDepletionTime);

    // D'ni
    s.syncAsUint16LE(_globals.ending);

    // Already visited zip destinations

    for (byte i = 0; i < 41; i++)
        s.syncAsUint16LE(_mystReachableZipDests[i]);

    for (byte i = 0; i < 41; i++)
        s.syncAsUint16LE(_channelwoodReachableZipDests[i]);

    for (byte i = 0; i < 41; i++)
        s.syncAsUint16LE(_mechReachableZipDests[i]);

    for (byte i = 0; i < 41; i++)
        s.syncAsUint16LE(_seleniticReachableZipDests[i]);

    for (byte i = 0; i < 41; i++)
        s.syncAsUint16LE(_stoneshipReachableZipDests[i]);

    if ((isME && s.bytesSynced() != 664) || (!isME && s.bytesSynced() != 601))
        warning("Unexpected File Position 0x%03X At End of Save/Load", s.bytesSynced());
}
Ejemplo n.º 24
0
void Player::synchronize(Common::Serializer &s) {
	s.syncAsByte(_moving);
	s.syncAsSint16LE(_playerPos.x);
	s.syncAsSint16LE(_playerPos.y);
	s.syncAsSint16LE(_targetPos.x);
	s.syncAsSint16LE(_targetPos.y);
	s.syncAsSint16LE(_xDirection);
	s.syncAsSint16LE(_yDirection);
	s.syncAsSint16LE(_posDiff.x);
	s.syncAsSint16LE(_posDiff.y);
	s.syncAsSint16LE(_posChange.x);
	s.syncAsSint16LE(_posChange.y);
	s.syncAsUint16LE(_targetFacing);
	s.syncAsSint16LE(_special);
	s.syncAsByte(_forceRefresh);
	s.syncAsSint16LE(_ticksAmount);
	s.syncAsByte(_walkAnywhere);
	s.syncAsUint16LE(_walkOffScreenSceneId);
	s.syncAsByte(_walkOffScreen);
	s.syncAsByte(_needToWalk);
	s.syncAsByte(_readyToWalk);
	s.syncAsUint16LE(_prepareWalkFacing);
	s.syncAsSint16LE(_prepareWalkPos.x);
	s.syncAsSint16LE(_prepareWalkPos.y);
	s.syncAsByte(_stepEnabled);
	s.syncAsByte(_visible);
	s.syncAsByte(_priorVisible);

	for (int i = 0; i < 8; ++i)
		s.syncAsByte(_spriteSetsPresent[i]);

	s.syncAsByte(_facing);
	s.syncAsByte(_turnToFacing);
	s.syncAsSint16LE(_spritesIdx);
	s.syncAsSint16LE(_frameNumber);
	s.syncAsSint16LE(_currentDepth);
	s.syncAsSint16LE(_currentScale);
	s.syncAsSint16LE(_frameListIndex);
	_stopWalkers.synchronize(s);
	_walkTriggerAction.synchronize(s);
	s.syncAsUint16LE(_walkTriggerDest);

	s.syncAsSint16LE(_upcomingTrigger);
	s.syncAsSint16LE(_trigger);
	s.syncAsSint16LE(_scalingVelocity);
	s.syncAsSint16LE(_pixelAccum);
	s.syncAsSint16LE(_distAccum);
	s.syncAsSint16LE(_deltaDistance);
	s.syncAsSint16LE(_totalDistance);
	s.syncAsSint16LE(_velocity);
	s.syncAsUint16LE(_frameCount);
	s.syncString(_spritesPrefix);
	s.syncAsUint32LE(_priorTimer);
	s.syncAsByte(_loadsFirst);
	s.syncAsByte(_loadedFirst);
	s.syncAsByte(_spritesLoaded);
	s.syncAsByte(_spritesChanged);
	s.syncAsByte(_beenVisible);
	s.syncAsSint16LE(_centerOfGravity);
	s.syncAsByte(_mirror);
}
Ejemplo n.º 25
0
void Sprite::sync(Common::Serializer &s) {
	uint16 unused = 0;

	s.syncAsUint16LE(unused);
	s.syncAsUint16LE(unused);	// _ext
	s.syncAsUint16LE(_ref);
	s.syncAsByte(_scene);

	// bitfield in-memory storage is unpredictable, so to avoid
	// any issues, pack/unpack everything manually
	uint16 flags = 0;
	if (s.isLoading()) {
		s.syncAsUint16LE(flags);
		_flags._hide = flags & 0x0001 ? true : false;
		_flags._near = flags & 0x0002 ? true : false;
		_flags._drag = flags & 0x0004 ? true : false;
		_flags._hold = flags & 0x0008 ? true : false;
		_flags._____ = flags & 0x0010 ? true : false;
		_flags._slav = flags & 0x0020 ? true : false;
		_flags._syst = flags & 0x0040 ? true : false;
		_flags._kill = flags & 0x0080 ? true : false;
		_flags._xlat = flags & 0x0100 ? true : false;
		_flags._port = flags & 0x0200 ? true : false;
		_flags._kept = flags & 0x0400 ? true : false;
		_flags._east = flags & 0x0800 ? true : false;
		_flags._shad = flags & 0x1000 ? true : false;
		_flags._back = flags & 0x2000 ? true : false;
		_flags._bDel = flags & 0x4000 ? true : false;
		_flags._tran = flags & 0x8000 ? true : false;
	} else {
		flags = (flags << 1) | _flags._tran;
		flags = (flags << 1) | _flags._bDel;
		flags = (flags << 1) | _flags._back;
		flags = (flags << 1) | _flags._shad;
		flags = (flags << 1) | _flags._east;
		flags = (flags << 1) | _flags._kept;
		flags = (flags << 1) | _flags._port;
		flags = (flags << 1) | _flags._xlat;
		flags = (flags << 1) | _flags._kill;
		flags = (flags << 1) | _flags._syst;
		flags = (flags << 1) | _flags._slav;
		flags = (flags << 1) | _flags._____;
		flags = (flags << 1) | _flags._hold;
		flags = (flags << 1) | _flags._drag;
		flags = (flags << 1) | _flags._near;
		flags = (flags << 1) | _flags._hide;
		s.syncAsUint16LE(flags);
	}

	s.syncAsUint16LE(_x);
	s.syncAsUint16LE(_y);
	s.syncAsByte(_z);
	s.syncAsUint16LE(_w);
	s.syncAsUint16LE(_h);
	s.syncAsUint16LE(_time);
	s.syncAsByte(_nearPtr);
	s.syncAsByte(_takePtr);
	s.syncAsSint16LE(_seqPtr);
	s.syncAsUint16LE(_shpCnt);
	s.syncBytes((byte *)&_file[0], 9);
	_file[8] = '\0';

	s.syncAsUint16LE(unused);	// _prev
	s.syncAsUint16LE(unused);	// _next
}
Ejemplo n.º 26
0
bool BuriedEngine::syncGlobalFlags(Common::Serializer &s, GlobalFlags &flags) {
    uint32 startBytes = s.bytesSynced();

    s.syncAsByte(flags.cgWallExploded);
    s.syncAsByte(flags.cgHookPresent);
    s.syncAsByte(flags.cgArrowPresent);
    s.syncAsByte(flags.cgHammerPresent);
    s.syncAsByte(flags.cgSmithyStatus);
    s.syncAsByte(flags.cgSmithyGuard);
    s.syncAsByte(flags.cgBaileyOneWayGuard);
    s.syncAsByte(flags.cgBaileyTwoWayGuards);
    s.syncAsByte(flags.cgTapestryFlag);
    s.syncAsByte(flags.cgBurnedLetterPresent);
    s.syncAsByte(flags.cgGoldCoinsPresent);
    s.syncAsByte(flags.cgStorageRoomVisit);
    s.syncAsByte(flags.bcTranslateEnabled);
    s.syncAsByte(flags.bcCloakingEnabled);
    s.syncAsByte(flags.bcLocateEnabled);
    s.syncAsByte(flags.myPickedUpCeramicBowl);
    s.syncAsByte(flags.myTPCodeWheelStatus);
    s.syncAsByte(flags.myTPCodeWheelLeftIndex);
    s.syncAsByte(flags.myTPCodeWheelRightIndex);
    s.syncAsByte(flags.myMCPickedUpSkull);
    s.syncAsByte(flags.myMCDeathGodOfferings);
    s.syncAsByte(flags.myWGPlacedRope);
    s.syncAsByte(flags.myWGRetrievedJadeBlock);
    s.syncAsByte(flags.myWTRetrievedLimestoneBlock);
    s.syncAsByte(flags.myWTCurrentBridgeStatus);
    s.syncAsByte(flags.myAGRetrievedEntrySkull);
    s.syncAsByte(flags.myAGRetrievedSpearSkull);
    s.syncAsByte(flags.myAGRetrievedCopperMedal);
    s.syncAsByte(flags.myAGRetrievedObsidianBlock);
    s.syncAsByte(flags.myAGHeadAStatus);
    s.syncAsByte(flags.myAGHeadBStatus);
    s.syncAsByte(flags.myAGHeadCStatus);
    s.syncAsByte(flags.myAGHeadDStatus);
    s.syncAsByte(flags.myAGHeadAStatusSkullID);
    s.syncAsByte(flags.myAGHeadBStatusSkullID);
    s.syncAsByte(flags.myAGHeadCStatusSkullID);
    s.syncAsByte(flags.myAGHeadDStatusSkullID);
    s.syncAsByte(flags.myAGTimerHeadID);
    SYNC_FLAG_UINT32(myAGTimerStartTime);
    s.syncAsByte(flags.myDGOfferedHeart);
    s.syncAsByte(flags.takenEnvironCart);
    s.syncAsByte(flags.alRDTakenLiveCore);
    s.syncAsByte(flags.alRDTakenDeadCore);
    s.syncAsByte(flags.alNMWrongAlienPrefixCode);
    s.syncAsByte(flags.faKIOvenStatus);
    s.syncAsByte(flags.faKIPostBoxSlotA);
    s.syncAsByte(flags.faKIPostBoxSlotB);
    s.syncAsByte(flags.faKIPostBoxSlotC);
    s.syncAsByte(flags.faERCurrentCartridge);
    s.syncAsByte(flags.faERTakenRemoteControl);
    s.syncAsByte(flags.myMCStingerID);
    s.syncAsByte(flags.myMCStingerChannelID);
    s.syncAsByte(flags.faStingerID);
    s.syncAsByte(flags.faStingerChannelID);
    s.syncBytes(flags.unused0, sizeof(flags.unused0));
    SYNC_FLAG_UINT32(cgMWCatapultData);
    SYNC_FLAG_UINT32(cgMWCatapultOffset);
    s.syncAsByte(flags.cgTSTriedDoor);
    s.syncAsByte(flags.cgMBCrossedMoat);
    s.syncAsByte(flags.cgKSSmithyEntryRead);
    s.syncAsByte(flags.cgKSSmithyEntryTranslated);
    s.syncAsByte(flags.cgBSFoundMold);
    s.syncAsByte(flags.readBurnedLetter);
    s.syncAsByte(flags.evcapNumCaptured);
    s.syncBytes(flags.evcapBaseID, sizeof(flags.evcapBaseID));
    s.syncBytes(flags.unused1, sizeof(flags.unused1));
    s.syncAsByte(flags.faMNEnvironDoor);
    s.syncAsByte(flags.faMNClockClicked);
    s.syncAsByte(flags.faMNBooksClicked);
    s.syncAsByte(flags.faMNTazClicked);
    s.syncAsByte(flags.faMNPongClicked);
    s.syncAsByte(flags.faKIBirdsBobbed);
    s.syncAsByte(flags.faKICoffeeSpilled);
    s.syncAsByte(flags.cgViewedKeepPlans);
    s.syncAsByte(flags.cgFoundChestPanel);
    s.syncAsByte(flags.cgTRFoundSword);
    s.syncAsByte(flags.faHeardAgentFigure);
    s.syncAsByte(flags.jumpBCNoInfoMessageCycle);
    s.syncAsByte(flags.myTPCalendarTopTranslated);
    s.syncAsByte(flags.myTPCalendarListTranslated);
    s.syncAsByte(flags.myTPTextTranslated);
    s.syncAsByte(flags.myMCTransDoor);
    s.syncAsByte(flags.myMCTransAGOffering);
    s.syncAsByte(flags.myMCTransWGOffering);
    s.syncAsByte(flags.myMCTransWTOffering);
    s.syncAsByte(flags.myMCTransDGOffering);
    s.syncAsByte(flags.myMCTransMadeAnOffering);
    s.syncAsByte(flags.myWGTransDoorTop);
    s.syncAsByte(flags.myWGSeenLowerPassage);
    s.syncAsByte(flags.myWGCrossedRopeBridge);
    s.syncAsByte(flags.myMCViewedDeathGodDoor);
    s.syncAsByte(flags.myTPTransBreathOfItzamna);
    SYNC_FLAG_UINT32(myAGHeadAOpenedTime);
    SYNC_FLAG_UINT32(myAGHeadBOpenedTime);
    SYNC_FLAG_UINT32(myAGHeadCOpenedTime);
    SYNC_FLAG_UINT32(myAGHeadDOpenedTime);
    s.syncAsByte(flags.myAGHeadATouched);
    s.syncAsByte(flags.myAGHeadBTouched);
    s.syncAsByte(flags.myAGHeadCTouched);
    s.syncAsByte(flags.myAGHeadDTouched);
    s.syncAsByte(flags.lensFilterActivated);
    s.syncAsByte(flags.dsPTElevatorPresent);
    s.syncAsByte(flags.dsPTElevatorLeverA);
    s.syncAsByte(flags.dsPTElevatorLeverB);
    s.syncAsByte(flags.dsPTDoorLocked);
    s.syncAsByte(flags.dsWSPickedUpWheelAssembly);
    s.syncAsByte(flags.dsWSPickedUpGearAssembly);
    s.syncAsByte(flags.dsWSPickedUpPegs);
    s.syncAsByte(flags.dsWSSiegeCycleStatus);
    s.syncAsByte(flags.dsWSGrabbedSiegeCycle);
    s.syncAsByte(flags.dsPTUseElevatorControls);
    s.syncAsByte(flags.dsPTTransElevatorControls);
    s.syncAsByte(flags.dsGDTakenCoilOfRope);
    s.syncAsByte(flags.dsCTUnlockedDoor);
    s.syncAsByte(flags.dsCTViewedAgent3);
    s.syncAsByte(flags.dsPTViewedAgent3);
    s.syncAsByte(flags.dsCTRetrievedLens);
    s.syncAsByte(flags.dsCTTakenHeart);
    s.syncAsByte(flags.dsCYFiredCannon);
    s.syncAsByte(flags.dsCYBallistaStatus);
    s.syncAsByte(flags.dsCYPlacedSiegeCycle);
    s.syncAsByte(flags.dsCYBallistaXPos);
    s.syncAsByte(flags.dsCYBallistaYPos);
    s.syncAsByte(flags.aiHWStingerID);
    s.syncAsByte(flags.aiHWStingerChannelID);
    s.syncAsByte(flags.aiCRStingerID);
    s.syncAsByte(flags.aiCRStingerChannelID);
    s.syncAsByte(flags.aiDBStingerID);
    s.syncAsByte(flags.aiDBStingerChannelID);
    s.syncAsByte(flags.aiCRGrabbedMetalBar);
    s.syncAsByte(flags.aiICGrabbedWaterCanister);
    s.syncAsByte(flags.aiOxygenTimer);
    s.syncAsByte(flags.aiCRPressurized);
    s.syncAsByte(flags.aiCRPressurizedAttempted);
    s.syncAsByte(flags.aiMRPressurized);
    s.syncAsByte(flags.aiIceMined);
    s.syncAsByte(flags.aiOxygenReserves);
    s.syncAsByte(flags.aiSCHeardInitialSpeech);
    s.syncAsByte(flags.aiSCInitialAudioChannel);
    s.syncAsByte(flags.aiSCDBDoorWarning);
    s.syncAsByte(flags.aiSCMoveCenterWarning);
    s.syncAsByte(flags.aiSCConversationStatus);
    s.syncAsByte(flags.aiHWIceDoorUnlocked);
    s.syncAsByte(flags.aiICWaterInFillHandle);
    s.syncAsByte(flags.aiICTakenWaterCanister);
    s.syncAsByte(flags.aiSWStingerID);
    s.syncAsByte(flags.aiSWStingerChannelID);
    s.syncAsByte(flags.aiMRCorrectFreqSet);
    s.syncAsByte(flags.aiSCHeardNexusDoorComment);
    s.syncAsByte(flags.aiSCHeardNexusDoorCode);
    s.syncAsByte(flags.asInitialGuardsPass);
    s.syncAsByte(flags.asRBPodAStatus);
    s.syncAsByte(flags.asRBPodBStatus);
    s.syncAsByte(flags.asRBPodCStatus);
    s.syncAsByte(flags.asRBPodDStatus);
    s.syncAsByte(flags.asRBPodEStatus);
    s.syncAsByte(flags.asRBPodFStatus);
    s.syncAsByte(flags.asRBPodATakenEnvironCart);
    s.syncAsByte(flags.asRBPodBTakenPuzzleBox);
    s.syncAsByte(flags.asRBPodCTakenCodex);
    s.syncAsByte(flags.asRBPodDTakenSculpture);
    s.syncAsByte(flags.asRBPodETakenSword);
    s.syncAsByte(flags.asTakenEvidenceThisTrip);
    s.syncAsByte(flags.asDangerDoorASealed);
    s.syncAsByte(flags.asDoorBGuardsSeen);
    s.syncAsByte(flags.asAmbassadorEncounter);
    s.syncAsByte(flags.dsCTTriedLockedDoor);
    s.syncAsByte(flags.dsCTCodexTranslateAttempted);
    s.syncAsByte(flags.dsCTCodexFormulaeFound);
    s.syncAsByte(flags.dsCTCodexAtlanticusPage2);
    s.syncAsByte(flags.dsCTTriedElevatorControls);
    s.syncAsByte(flags.aiDBPlayedMomComment);
    s.syncAsByte(flags.aiDBPlayedFirstArthur);
    s.syncAsByte(flags.aiDBPlayedSecondArthur);
    s.syncAsByte(flags.aiDBPlayedThirdArthur);
    s.syncAsByte(flags.aiDBPlayedFourthArthur);
    s.syncAsByte(flags.aiSCPlayedNoStinger);
    s.syncAsByte(flags.faKITakenPostboxItem);
    s.syncAsByte(flags.cgMBVisited);
    s.syncAsByte(flags.cgKCVisited);
    s.syncAsByte(flags.cgTRVisited);
    s.syncAsByte(flags.cgKSReadJournal);
    s.syncAsByte(flags.cgSRClickedOnLockedChest);
    s.syncAsByte(flags.cgSROpenedChest);
    s.syncAsByte(flags.dsVisitedCodexTower);
    s.syncAsByte(flags.dsPTRaisedPlatform);
    s.syncAsByte(flags.dsPTWalkedDownElevator);
    s.syncAsByte(flags.dsPTBeenOnBalcony);
    s.syncAsByte(flags.dsGDClickedOnCodexDoor);
    s.syncAsByte(flags.dsWSSeenCycleSketch);
    s.syncAsByte(flags.dsWSSeenBallistaSketch);
    s.syncAsByte(flags.genHadSiegeCycle);
    s.syncAsByte(flags.genHadDriveAssembly);
    s.syncAsByte(flags.genHadWheelAssembly);
    s.syncAsByte(flags.dsCYNeverConnectedHook);
    s.syncAsByte(flags.dsCYNeverShotBallista);
    s.syncAsByte(flags.dsCYNeverUsedCrank);
    s.syncAsByte(flags.dsCYNeverOpenedBalconyDoor);
    s.syncAsByte(flags.dsCYTranslatedCodex);
    s.syncAsByte(flags.dsCYTriedOpeningDoor);
    s.syncAsByte(flags.dsCYTriedElevator);
    s.syncAsByte(flags.dsCYFoundCodexes);
    s.syncAsByte(flags.myVisitedMainCavern);
    s.syncAsByte(flags.myVisitedArrowGod);
    s.syncAsByte(flags.myVisitedWaterGod);
    s.syncAsByte(flags.myVisitedWealthGod);
    s.syncAsByte(flags.myVisitedDeathGod);
    s.syncAsByte(flags.myVisitedSpecRooms);
    s.syncAsByte(flags.myWTSteppedOnSwings);
    s.syncAsByte(flags.myWTSteppedOnFarLedge);
    s.syncAsByte(flags.myDGOpenedPuzzleBox);
    s.syncAsByte(flags.myAGVisitedAltar);
    s.syncAsByte(flags.dsCTPlayedBallistaFalling);
    s.syncAsByte(flags.cgTSTriedDoorA);
    s.syncAsByte(flags.cgTSTriedDoorB);
    s.syncAsByte(flags.aiHWLastCommentPlayed);
    s.syncAsByte(flags.aiNXPlayedBrainComment);
    s.syncAsByte(flags.asRBLastStingerID);
    s.syncAsByte(flags.asRBStingerID);
    s.syncAsByte(flags.aiICProcessedOxygen);
    s.syncAsByte(flags.dsCYWeebleClicked);
    s.syncAsByte(flags.aiICUsedMiningControls);
    s.syncAsByte(flags.aiSWAttemptedPresMR);
    s.syncAsByte(flags.aiICRefilledOxygen);
    s.syncAsByte(flags.aiMRUsedHarmonicsInterface);
    s.syncAsByte(flags.alRestoreSkipAgent3Initial);
    s.syncBytes(flags.unused2, sizeof(flags.unused2));
    s.syncAsByte(flags.scoreGotTranslateBioChip);
    s.syncAsByte(flags.scoreEnteredSpaceStation);
    s.syncAsByte(flags.scoreDownloadedArthur);
    s.syncAsByte(flags.scoreFoundSculptureDiagram);
    s.syncAsByte(flags.scoreEnteredKeep);
    s.syncAsByte(flags.scoreGotKeyFromSmithy);
    s.syncAsByte(flags.scoreEnteredTreasureRoom);
    s.syncAsByte(flags.scoreFoundSwordDiamond);
    s.syncAsByte(flags.scoreMadeSiegeCycle);
    s.syncAsByte(flags.scoreEnteredCodexTower);
    s.syncAsByte(flags.scoreLoggedCodexEvidence);
    s.syncAsByte(flags.scoreEnteredMainCavern);
    s.syncAsByte(flags.scoreGotWealthGodPiece);
    s.syncAsByte(flags.scoreGotRainGodPiece);
    s.syncAsByte(flags.scoreGotWarGodPiece);
    s.syncAsByte(flags.scoreCompletedDeathGod);
    s.syncAsByte(flags.scoreEliminatedAgent3);
    s.syncAsByte(flags.scoreTransportToKrynn);
    s.syncAsByte(flags.scoreGotKrynnArtifacts);
    s.syncAsByte(flags.scoreDefeatedIcarus);
    s.syncAsByte(flags.scoreResearchINNLouvreReport);
    s.syncAsByte(flags.scoreResearchINNHighBidder);
    s.syncAsByte(flags.scoreResearchINNAppeal);
    s.syncAsByte(flags.scoreResearchINNUpdate);
    s.syncAsByte(flags.scoreResearchINNJumpsuit);
    s.syncAsByte(flags.scoreResearchBCJumpsuit);
    s.syncAsByte(flags.scoreResearchMichelle);
    s.syncAsByte(flags.scoreResearchMichelleBkg);
    s.syncAsByte(flags.scoreResearchLensFilter);
    s.syncAsByte(flags.scoreResearchCastleFootprint);
    s.syncAsByte(flags.scoreResearchDaVinciFootprint);
    s.syncAsByte(flags.scoreResearchMorphSculpture);
    s.syncAsByte(flags.scoreResearchEnvironCart);
    s.syncAsByte(flags.scoreResearchAgent3Note);
    s.syncAsByte(flags.scoreResearchAgent3DaVinci);
    SYNC_FLAG_UINT16(scoreHintsTotal);
    s.syncBytes(flags.unused3, sizeof(flags.unused3));
    s.syncAsByte(flags.genJumpCastleBriefing);
    s.syncAsByte(flags.genJumpMayanBriefing);
    s.syncAsByte(flags.genJumpDaVinciBriefing);
    s.syncAsByte(flags.genJumpStationBriefing);
    s.syncBytes(flags.unused4, sizeof(flags.unused4));
    s.syncAsByte(flags.generalWalkthroughMode);
    s.syncBytes(flags.unused5, sizeof(flags.unused5));
    s.syncBytes(flags.aiData, sizeof(flags.aiData));

    return s.bytesSynced() - startBytes == 1024;
}
Ejemplo n.º 27
0
void Background::synchronize(Common::Serializer &sz) {
	sz.syncAsByte(_nextBell);
}
Ejemplo n.º 28
0
static void syncIncrust(Common::Serializer &s) {
	int numEntries = 0;
	backgroundIncrustStruct *pl, *pl1;
	uint8 dummyByte = 0;
	uint16 dummyWord = 0;
	uint32 dummyLong = 0;

	if (s.isSaving()) {
		// Figure out the number of entries to save
		pl = backgroundIncrustHead.next;
		while (pl) {
			++numEntries;
			pl = pl->next;
		}
	}
	s.syncAsSint16LE(numEntries);

	pl = s.isSaving() ? backgroundIncrustHead.next : &backgroundIncrustHead;
	pl1 = &backgroundIncrustHead;

	for (int i = 0; i < numEntries; ++i) {
		backgroundIncrustStruct *t = s.isSaving() ? pl :
			(backgroundIncrustStruct *)mallocAndZero(sizeof(backgroundIncrustStruct));

		s.syncAsUint32LE(dummyLong);

		s.syncAsSint16LE(t->objectIdx);
		s.syncAsSint16LE(t->type);
		s.syncAsSint16LE(t->overlayIdx);
		s.syncAsSint16LE(t->X);
		s.syncAsSint16LE(t->Y);
		s.syncAsSint16LE(t->frame);
		s.syncAsSint16LE(t->scale);
		s.syncAsSint16LE(t->backgroundIdx);
		s.syncAsSint16LE(t->scriptNumber);
		s.syncAsSint16LE(t->scriptOverlayIdx);
		s.syncAsUint32LE(dummyLong);
		s.syncAsSint16LE(t->saveWidth);
		s.syncAsSint16LE(t->saveHeight);
		s.syncAsSint16LE(t->saveSize);
		s.syncAsSint16LE(t->savedX);
		s.syncAsSint16LE(t->savedY);
		s.syncBytes((byte *)t->name, 13);
		s.syncAsByte(dummyByte);
		s.syncAsSint16LE(t->spriteId);
		s.syncAsUint16LE(dummyWord);

		if (t->saveSize) {
			if (s.isLoading())
				t->ptr = (byte *)MemAlloc(t->saveSize);

			s.syncBytes(t->ptr, t->saveSize);
		}

		if (s.isSaving())
			pl = pl->next;
		else {
			t->next = NULL;
			pl->next = t;
			t->prev = pl1->prev;
			pl1->prev = t;
			pl = t;
		}
	}
}
Ejemplo n.º 29
0
void Sequence::synchronize(Common::Serializer &sz) {
	sz.syncBytes(_seq, kSeqLength);
	sz.syncAsByte(_flipToWhere);
	sz.syncAsByte(_flipToPed);
}