예제 #1
0
bool Text::unpersist(InputPersistenceBlock &reader) {
	bool result = true;

	result &= RenderObject::unpersist(reader);

	// Read color and alpha
	reader.read(_modulationColor);

	// Run all methods on loading relevant members.
	// So, the layout is automatically updated and all necessary logic is executed.

	Common::String font;
	reader.readString(font);
	setFont(font);

	Common::String text;
	reader.readString(text);
	setText(text);

	bool autoWrap;
	reader.read(autoWrap);
	setAutoWrap(autoWrap);

	uint32 autoWrapThreshold;
	reader.read(autoWrapThreshold);
	setAutoWrapThreshold(autoWrapThreshold);

	result &= RenderObject::unpersistChildren(reader);

	return reader.isGood() && result;
}
예제 #2
0
bool AnimationTemplate::unpersist(InputPersistenceBlock &reader) {
	bool result = true;

	// Parent wieder herstellen.
	result &= AnimationDescription::unpersist(reader);

	// Frameanzahl lesen.
	uint frameCount;
	reader.read(frameCount);

	// Frames einzeln wieder herstellen.
	for (uint i = 0; i < frameCount; ++i) {
		Frame frame;
		reader.read(frame.hotspotX);
		reader.read(frame.hotspotY);
		reader.read(frame.flipV);
		reader.read(frame.flipH);
		reader.readString(frame.fileName);
		reader.readString(frame.action);

		_frames.push_back(frame);
	}

	// Die Animations-Resource wird für die gesamte Lebensdauer des Objektes gelockt
	Common::String sourceAnimation;
	reader.readString(sourceAnimation);
	_sourceAnimationPtr = requestSourceAnimation(sourceAnimation);

	reader.read(_valid);

	return _sourceAnimationPtr && reader.isGood() && result;
}
예제 #3
0
bool Text::unpersist(InputPersistenceBlock &reader) {
	bool result = true;

	result &= RenderObject::unpersist(reader);

	// Farbe und Alpha einlesen.
	reader.read(_modulationColor);

	// Beim Laden der anderen Member werden die Set-Methoden benutzt statt der tatsächlichen Member.
	// So wird das Layout automatisch aktualisiert und auch alle anderen notwendigen Methoden ausgeführt.

	Common::String font;
	reader.readString(font);
	setFont(font);

	Common::String text;
	reader.readString(text);
	setText(text);

	bool autoWrap;
	reader.read(autoWrap);
	setAutoWrap(autoWrap);

	uint autoWrapThreshold;
	reader.read(autoWrapThreshold);
	setAutoWrapThreshold(autoWrapThreshold);

	result &= RenderObject::unpersistChildren(reader);

	return reader.isGood() && result;
}
예제 #4
0
bool InputEngine::unpersist(InputPersistenceBlock &reader) {
	Common::String callbackFunctionName;

	// Read number of command callbacks and their names.
	// Note: We do this only for compatibility with older engines resp.
	// the original engine.
	uint32 commandCallbackCount;
	reader.read(commandCallbackCount);
	assert(commandCallbackCount == 1);

	reader.readString(callbackFunctionName);
	assert(callbackFunctionName == "LuaCommandCB");

	// Read number of character callbacks and their names.
	// Note: We do this only for compatibility with older engines resp.
	// the original engine.
	uint32 characterCallbackCount;
	reader.read(characterCallbackCount);
	assert(characterCallbackCount == 1);

	reader.readString(callbackFunctionName);
	assert(callbackFunctionName == "LuaCharacterCB");

	return reader.isGood();
}
예제 #5
0
bool StaticBitmap::unpersist(InputPersistenceBlock &reader) {
	bool result = true;

	result &= Bitmap::unpersist(reader);
	Common::String resourceFilename;
	reader.readString(resourceFilename);
	// We may not have saves, and we actually do not need to
	// restore them. So do not even try to load them.
	if (!resourceFilename.hasPrefix("/saves"))
		result &= initBitmapResource(resourceFilename);

	result &= RenderObject::unpersistChildren(reader);

	return reader.isGood() && result;
}
예제 #6
0
bool SoundEngine::unpersist(InputPersistenceBlock &reader) {
	_mixer->stopAll();

	if (reader.getVersion() < 2)
		return true;

	reader.read(_maxHandleId);

	for (uint i = 0; i < SOUND_HANDLES; i++) {
		reader.read(_handles[i].id);

		Common::String fileName;
		int32 sndType;
		float volume;
		float pan;
		bool loop;
		int32 loopStart;
		int32 loopEnd;
		uint32 layer;

		reader.readString(fileName);
		reader.read(sndType);
		reader.read(volume);
		reader.read(pan);
		reader.read(loop);
		reader.read(loopStart);
		reader.read(loopEnd);
		reader.read(layer);

		if (reader.isGood()) {
			if (sndType != -1)
				playSoundEx(fileName, (SOUND_TYPES)sndType, volume, pan, loop, loopStart, loopEnd, layer, i);
		} else
			return false;
	}

	return reader.isGood();
}