Example #1
0
void Items::save(SaveFileWriteStream &f) {
	int size = (int)_items.size();

	f.writeInt(size);
	int i;
	for (i = 0; i != size; ++i) {
		_items[i]->save(f);
	}

	// Always write out 100 items
	for (; i != 100; ++i) {
		f.padBytes(0x174); // bbox + rect + 18 float fields
	}
}
Example #2
0
void Spinner::save(SaveFileWriteStream &f) {
	assert(!_isOpen);

	for (int i = 0; i != kSpinnerDestinations; ++i) {
		f.writeBool(_isDestinationSelectable[i]);
	}
}
Example #3
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 #4
0
void Overlays::save(SaveFileWriteStream &f) {
	for (int i = 0; i < kOverlayVideos; ++i) {
		// 37 bytes per overlay
		Video &ov = _videos[i];

		f.writeBool(ov.loaded);
		f.writeInt(0); // vqaPlayer pointer
		f.writeStringSz(ov.name, 13);
		f.writeSint32LE(ov.hash);
		if (ov.enqueuedLoopId != -1) {
		// When there is an enqueued video, save that loop Id instead
			f.writeInt(ov.enqueuedLoopId);
		} else {
			f.writeInt(ov.loopId);
		}
		f.writeBool(ov.loopForever);
		f.writeInt(ov.frame);
	}
}
Example #5
0
void Overlays::save(SaveFileWriteStream &f) {
	for (int i = 0; i < kOverlayVideos; ++i) {
		// 37 bytes per overlay
		Video &ov = _videos[i];

		f.writeBool(ov.loaded);
		f.writeInt(0); // vqaPlayer pointer
		f.writeStringSz(ov.name, 13);
		f.writeSint32LE(ov.hash);
		f.writeInt(ov.field0);
		f.writeInt(ov.field1);
		f.writeInt(ov.field2);
	}
}
Example #6
0
void CrimesDatabase::save(SaveFileWriteStream &f) {
	for (int i = 0; i < _crimeCount; ++i) {
		uint8 c = _crimes[i];
		f.writeByte(c);
	}
}
Example #7
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 #8
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();
}
Example #9
0
void GameFlags::save(SaveFileWriteStream &f) {
	for (int i = 0; i != _flagCount / 32 + 1; ++i) {
		f.writeUint32LE(_flags[i]);
	}
}