Example #1
0
void Item::save(SaveFileWriteStream &f) {
	f.writeInt(_setId);
	f.writeInt(_itemId);
	f.writeBoundingBox(_boundingBox, false);
	f.writeRect(_screenRectangle);
	f.writeInt(_animationId);
	f.writeVector3(_position);
	f.writeInt(_facing);
	f.writeFloat(_angle);
	f.writeInt(_width);
	f.writeInt(_height);
	f.writeInt(_screenX);
	f.writeInt(_screenY);
	f.writeFloat(_depth);
	f.writeBool(_isTarget);
	f.writeBool(_isSpinning);
	f.writeInt(_facingChange);
	f.writeFloat(0.0f); // _viewAngle
	f.writeBool(_isVisible);
	f.writeBool(_isPoliceMazeEnemy);
}
Example #2
0
void Obstacles::save(SaveFileWriteStream &f) {
	f.writeBool(_backup);
	f.writeInt(_count);
	for (int i = 0; i < _count; ++i) {
		Polygon &p = _polygonsBackup[i];
		f.writeBool(p.isPresent);
		f.writeInt(p.verticeCount);
		f.writeFloat(p.rect.x0);
		f.writeFloat(p.rect.y0);
		f.writeFloat(p.rect.x1);
		f.writeFloat(p.rect.y1);
		for (int j = 0; j < kPolygonVertexCount; ++j) {
			f.writeVector2(p.vertices[j]);
		}
		for (int j = 0; j < kPolygonVertexCount; ++j) {
			f.writeInt(p.vertexType[j]);
		}
	}
	for (int i = 0; i < kVertexCount; ++i) {
		f.writeVector2(_vertices[i]);
	}
	f.writeInt(_verticeCount);
}
Example #3
0
bool BladeRunnerEngine::saveGame(const Common::String &filename, byte *thumbnail) {
	warning("BladeRunnerEngine::saveGame not finished");

	if (!playerHasControl() || _sceneScript->isInsideScript() || _aiScripts->isInsideScript()) {
		return false;
	}

	Common::OutSaveFile *commonSaveFile = getSaveFileManager()->openForSaving(filename, false);
	if (commonSaveFile->err()) {
		return false;
	}

	SaveFileWriteStream s;

	s.padBytes(9600); // TODO: thumbnail
	s.writeFloat(-1.0f);
	_settings->save(s);
	_scene->save(s);
	_scene->_exits->save(s);
	_scene->_regions->save(s);
	_scene->_set->save(s);
	for (uint i = 0; i != _gameInfo->getGlobalVarCount(); ++i) {
		s.writeInt(_gameVars[i]);
	}
	_music->save(s);
	// _audioPlayer->save(s) // zero func
	// _audioSpeech->save(s) // zero func
	_combat->save(s);
	_gameFlags->save(s);
	_items->save(s);
	_sceneObjects->save(s);
	_ambientSounds->save(s);
	_overlays->save(s);
	_spinner->save(s);
	_scores->save(s);
	_dialogueMenu->save(s);
	_obstacles->save(s);
	_actorDialogueQueue->save(s);
	_waypoints->save(s);

	for (uint i = 0; i != _gameInfo->getActorCount(); ++i) {
		_actors[i]->save(s);

		int animationState, animationFrame, animationStateNext, nextAnimation;
		_aiScripts->queryAnimationState(i, &animationState, &animationFrame, &animationStateNext, &nextAnimation);
		s.writeInt(animationState);
		s.writeInt(animationFrame);
		s.writeInt(animationStateNext);
		s.writeInt(nextAnimation);
	}
	_actors[kActorVoiceOver]->save(s);

	_policeMaze->save(s);
	_crimesDatabase->save(s);

	s.finalize();
	assert(0 && "ok");

	commonSaveFile->writeUint32LE(s.size() + 4);
	commonSaveFile->write(s.getData(), s.size());

	return !commonSaveFile->err();
}