Ejemplo n.º 1
0
static bool DoSync(Common::Serializer &s, int numInterp) {
	int	sg = 0;

	if (TinselV2) {
		if (s.isSaving())
			g_restoreCD = GetCurrentCD();
		s.syncAsSint16LE(g_restoreCD);
	}

	if (TinselV2 && s.isLoading())
		HoldItem(INV_NOICON);

	syncSavedData(s, *g_srsd, numInterp);
	syncGlobInfo(s);		// Glitter globals
	syncInvInfo(s);			// Inventory data

	// Held object
	if (s.isSaving())
		sg = WhichItemHeld();
	s.syncAsSint32LE(sg);
	if (s.isLoading()) {
		if (sg != -1 && !GetIsInvObject(sg))
			// Not a valid inventory object, so return false
			return false;

		if (TinselV2)
			g_thingHeld = sg;
		else
			HoldItem(sg);
	}

	syncTimerInfo(s);		// Timer data
	if (!TinselV2)
		syncPolyInfo(s);		// Dead polygon data
	syncSCdata(s);			// Hook Scene and delayed scene

	s.syncAsSint32LE(*g_SaveSceneSsCount);

	if (*g_SaveSceneSsCount != 0) {
		SAVED_DATA *sdPtr = g_SaveSceneSsData;
		for (int i = 0; i < *g_SaveSceneSsCount; ++i, ++sdPtr)
			syncSavedData(s, *sdPtr, numInterp);

		// Flag that there is a saved scene to return to. Note that in this context 'saved scene'
		// is a stored scene to return to from another scene, such as from the Summoning Book close-up
		// in Discworld 1 to whatever scene Rincewind was in prior to that
		g_ASceneIsSaved = true;
	}

	if (!TinselV2)
		syncAllActorsAlive(s);

	return true;
}
Ejemplo n.º 2
0
static void DoSync(Common::Serializer &s) {
	int	sg = 0;

	if (TinselV2) {
		if (s.isSaving())
			restoreCD = GetCurrentCD();
		s.syncAsSint16LE(restoreCD);
	}

	if (TinselV2 && s.isLoading())
		HoldItem(INV_NOICON);

	syncSavedData(s, *srsd);
	syncGlobInfo(s);		// Glitter globals
	syncInvInfo(s);			// Inventory data

	// Held object
	if (s.isSaving())
		sg = WhichItemHeld();
	s.syncAsSint32LE(sg);
	if (s.isLoading()) {
		if (TinselV2)
			thingHeld = sg;
		else
			HoldItem(sg);
	}

	syncTimerInfo(s);		// Timer data
	if (!TinselV2)
		syncPolyInfo(s);		// Dead polygon data
	syncSCdata(s);			// Hook Scene and delayed scene

	s.syncAsSint32LE(*SaveSceneSsCount);

	if (*SaveSceneSsCount != 0) {
		SAVED_DATA *sdPtr = SaveSceneSsData;
		for (int i = 0; i < *SaveSceneSsCount; ++i, ++sdPtr)
			syncSavedData(s, *sdPtr);
	}

	if (!TinselV2)
		syncAllActorsAlive(s);
}