示例#1
1
void HyperspaceCloud::Load(Serializer::Reader &rd, Space *space)
{
	Body::Load(rd, space);
	m_vel = rd.Vector3d();
	m_birthdate = rd.Double();
	m_due = rd.Double();
	m_isArrival = rd.Bool();
	if (rd.Bool()) {
		m_ship = static_cast<Ship*>(Body::Unserialize(rd, space));
	}
}
示例#2
0
void Player::Load(Serializer::Reader &rd, Space *space)
{
	Pi::player = this;
	Ship::Load(rd, space);
	MarketAgent::Load(rd);
	m_killCount = rd.Int32();
	m_knownKillCount = rd.Int32();
}
示例#3
0
void ShipFlavour::Load(Serializer::Reader &rd)
{
	id = rd.String();
	price = rd.Int32();
	regid = rd.String();
	LoadLmrMaterial(rd, &primaryColor);
	LoadLmrMaterial(rd, &secondaryColor);
}
示例#4
0
void Missile::Load(Serializer::Reader &rd)
{
	Ship::Load(rd);
	m_ownerIndex = rd.Int32();
	m_targetIndex = rd.Int32();
	m_distToTarget = rd.Double();
	m_power = rd.Int32();
}
示例#5
0
void Projectile::Load(Serializer::Reader &rd, Space *space)
{
	Body::Load(rd, space);
	m_baseVel = rd.Vector3d();
	m_dirVel = rd.Vector3d();
	m_age = rd.Float();
	m_type = rd.Int32();
	m_parentIndex = rd.Int32();
}
示例#6
0
文件: Player.cpp 项目: Snaar/pioneer
void Player::Load(Serializer::Reader &rd)
{
	Pi::player = this;
	Ship::Load(rd);
	m_flightControlState = static_cast<FlightControlState>(rd.Int32());
	m_setSpeed = rd.Double();
	m_killCount = rd.Int32();
	m_knownKillCount = rd.Int32();
}
示例#7
0
void ModelBody::Load(Serializer::Reader &rd, Space *space)
{
	Body::Load(rd, space);
	m_isStatic = rd.Bool();
	m_colliding = rd.Bool();
	SetModel(rd.String().c_str());
	m_model->Load(rd);
	m_shields->Load(rd);
}
示例#8
0
文件: Polit.cpp 项目: jbuck/pioneer
void Unserialize(Serializer::Reader &rd)
{
	Init();
	PersistSystemData<Sint64>::Unserialize(rd, &s_criminalRecord);
	PersistSystemData<Sint64>::Unserialize(rd, &s_outstandingFine);
	for (int i=0; i<BLOC_MAX; i++) {
		s_playerPerBlocCrimeRecord[i].record = rd.Int64();
		s_playerPerBlocCrimeRecord[i].fine = rd.Int64();
	}
}
ScannerWidget::ScannerWidget(Graphics::Renderer *r, Serializer::Reader &rd) :
	m_renderer(r)
{
	m_mode = ScannerMode(rd.Int32());
	m_currentRange = rd.Float();
	m_manualRange = rd.Float();
	m_targetRange = rd.Float();

	InitObject();
}
示例#10
0
void NavLights::Load(Serializer::Reader &rd)
{
	m_time    = rd.Float();
	m_enabled = rd.Bool();

	RefCountedPtr<Graphics::Material> mat;
	for (LightIterator it = m_lights.begin(); it != m_lights.end(); ++it) {
		Uint8 c = rd.Byte();
		it->billboard->SetMaterial(get_material(c));
	}
}
示例#11
0
void ModelSkin::Load(Serializer::Reader &rd)
{
    for (unsigned int i = 0; i < 3; i++) {
        m_colors[i].r = rd.Byte();
        m_colors[i].g = rd.Byte();
        m_colors[i].b = rd.Byte();
    }
    for (unsigned int i = 0; i < MAX_DECAL_MATERIALS; i++)
        m_decals[i] = rd.String();
    m_label = rd.String();
}
示例#12
0
void Model::Load(Serializer::Reader &rd)
{
	LoadVisitor lv(&rd);
	m_root->Accept(lv);

	for (AnimationContainer::const_iterator i = m_animations.begin(); i != m_animations.end(); ++i)
		(*i)->SetProgress(rd.Double());
	UpdateAnimations();

	SetPattern(rd.Int32());
}
示例#13
0
文件: Polit.cpp 项目: tnicoll/pioneer
void Unserialize(Serializer::Reader &rd)
{
	Init();
	PersistSystemData<Sint64>::Unserialize(rd, &s_criminalRecord);
	PersistSystemData<Sint64>::Unserialize(rd, &s_outstandingFine);
	const Uint32 numFactions = rd.Int32();
	assert(s_playerPerBlocCrimeRecord.size() == numFactions);
	for (Uint32 i=0; i < numFactions; i++) {
		s_playerPerBlocCrimeRecord[i].record = rd.Int64();
		s_playerPerBlocCrimeRecord[i].fine = rd.Int64();
	}
}
示例#14
0
文件: Pi.cpp 项目: Snaar/pioneer
void Pi::Unserialize(Serializer::Reader &rd)
{
	Serializer::Reader section;
	
	SetTimeAccel(0);
	requestedTimeAccelIdx = 0;
	Space::Clear();
	if (Pi::player) {
		Pi::player->MarkDead();
		Space::bodies.remove(Pi::player);
		delete Pi::player;
		Pi::player = 0;
	}

	section = rd.RdSection("PiMisc");
	gameTime = section.Double();
	selectedSystem = StarSystem::Unserialize(section);
	currentSystem = StarSystem::Unserialize(section);

	section = rd.RdSection("Space");
	Space::Unserialize(section);
	
	section = rd.RdSection("Polit");
	Polit::Unserialize(section);

	section = rd.RdSection("SectorView");
	sectorView->Load(section);

	section = rd.RdSection("WorldView");
	worldView->Load(section);

	section = rd.RdSection("LuaModules");
	PiLuaModules::Unserialize(section);
}
示例#15
0
void CollMesh::Load(Serializer::Reader &rd)
{
	m_aabb.max = rd.Vector3d();
	m_aabb.min = rd.Vector3d();
	m_aabb.radius = rd.Double();

	m_geomTree = new GeomTree(rd);

	const Uint32 numDynGeomTrees = rd.Int32();
	m_dynGeomTrees.reserve(numDynGeomTrees);
	for (Uint32 it = 0; it < numDynGeomTrees; ++it) {
		m_dynGeomTrees.push_back(new GeomTree(rd));
	}

	m_totalTris = rd.Int32();
}
示例#16
0
ShipCpanel::ShipCpanel(Serializer::Reader &rd, Graphics::Renderer *r): Gui::Fixed(float(Gui::Screen::GetWidth()), 80)
{
	m_scanner = new ScannerWidget(r, rd);

	InitObject();

	m_camButton->SetActiveState(rd.Int32());
}
示例#17
0
/*
 * Should have initialised with EquipSet(ShipType::Type) first
 */
void EquipSet::Load(Serializer::Reader &rd)
{
	const int numSlots = rd.Int32();
	assert(numSlots <= Equip::SLOT_MAX);
	for (int i=0; i<numSlots; i++) {
		const int numItems = rd.Int32();
		for (int j=0; j<numItems; j++) {
			if (j < signed(equip[i].size())) {
				equip[i][j] = static_cast<Equip::Type>(rd.Int32());
			} else {
				// equipment slot sizes have changed. just
				// dump the difference
				rd.Int32();
			}
		}
	}
	onChange.emit();
}
示例#18
0
文件: Shields.cpp 项目: lwho/pioneer
void Shields::Load(Serializer::Reader &rd)
{
	m_enabled = rd.Bool();

	const Uint32 NumShields = rd.Int32();
	assert(NumShields == m_shields.size());
	for (Uint32 iRead = 0; iRead < NumShields; iRead++ ) {
		const Uint8 r = rd.Byte();
		const Uint8 g = rd.Byte();
		const Uint8 b = rd.Byte();
		const std::string name = rd.String();
		for (ShieldIterator it = m_shields.begin(); it != m_shields.end(); ++it) {
			if(name==it->m_mesh->GetName()) {
				it->m_colour = Color3ub(r, g, b);
				break;
			}
		}
	}
}
示例#19
0
void Sfx::Unserialize(Serializer::Reader &rd, Frame *f)
{
	int numActive = rd.Int32();
	if (numActive) {
		f->m_sfx = new Sfx[MAX_SFX_PER_FRAME];
		for (int i=0; i<numActive; i++) {
			f->m_sfx[i].Load(rd);
		}
	}
}
示例#20
0
Space::Space(Game *game, Serializer::Reader &rd) : m_game(game), m_frameIndexValid(false), m_bodyIndexValid(false), m_sbodyIndexValid(false)
{
	m_starSystem = StarSystem::Unserialize(rd);
	m_background.Refresh(m_starSystem->m_seed);
	RebuildSBodyIndex();

	Serializer::Reader section = rd.RdSection("Frames");
	m_rootFrame.Reset(Frame::Unserialize(section, this, 0));
	RebuildFrameIndex();

	Uint32 nbodies = rd.Int32();
	for (Uint32 i = 0; i < nbodies; i++)
		m_bodies.push_back(Body::Unserialize(rd, this));
	RebuildBodyIndex();

	for (BodyIterator i = m_bodies.begin(); i != m_bodies.end(); ++i)
		(*i)->PostLoadFixup(this);
	Frame::PostUnserializeFixup(m_rootFrame.Get(), this);
}
示例#21
0
Body *Body::Unserialize(Serializer::Reader &_rd, Space *space)
{
	Serializer::Reader rd = _rd.RdSection("Body");
	Body *b = 0;
	Object::Type type = Object::Type(rd.Int32());
	switch (type) {
		case Object::STAR:
			b = new Star(); break;
		case Object::PLANET:
			b = new Planet();
			break;
		case Object::SPACESTATION:
			b = new SpaceStation(); break;
		case Object::SHIP:
			b = new Ship(); break;
		case Object::PLAYER:
			b = new Player(); break;
		case Object::MISSILE:
			b = new Missile(); break;
		case Object::PROJECTILE:
			b = new Projectile(); break;
		case Object::CARGOBODY:
			b = new CargoBody(); break;
		case Object::HYPERSPACECLOUD:
			b = new HyperspaceCloud(); break;
		default:
			assert(0);
	}
	b->Load(rd, space);
	// must SetFrame() correctly so ModelBodies can add geom to space
	Frame *f = b->m_frame;
	b->m_frame = 0;
	b->SetFrame(f);
	//
	b->SetPosition(rd.Vector3d());
	matrix4x4d m;
	for (int i=0; i<16; i++) m[i] = rd.Double();
	b->SetRotMatrix(m);
	return b;
}
示例#22
0
Body *Body::Unserialize(Serializer::Reader &_rd, Space *space)
{
	Serializer::Reader rd = _rd.RdSection("Body");
	Body *b = 0;
	Object::Type type = Object::Type(rd.Int32());
	switch (type) {
		case Object::STAR:
			b = new Star(); 
            break;
		case Object::PLANET:
			b = new Planet();
			break;
		case Object::SPACESTATION:
			b = new SpaceStation(); 
            break;
		case Object::SHIP:
			b = new Ship(); 
            break;
		case Object::PLAYER:
			b = new Player(); 
            break;
		case Object::MISSILE:
			b = new Missile(); 
            break;
		case Object::PROJECTILE:
			b = new Projectile(); 
            break;
		case Object::CARGOBODY:
			b = new CargoBody(); 
            break;
		case Object::HYPERSPACECLOUD:
			// This should detect and create permanent clouds
            b = space->CreateHyperspaceCloud(); 
            break;
		default:
			assert(0);
	}
	b->Load(rd, space);
	return b;
}
示例#23
0
void DynamicBody::Load(Serializer::Reader &rd)
{
	ModelBody::Load(rd);
	for (int i=0; i<16; i++) m_orient[i] = rd.Double();
	m_oldOrient = m_orient;
	m_force = rd.Vector3d();
	m_torque = rd.Vector3d();
	m_vel = rd.Vector3d();
	m_angVel = rd.Vector3d();
	m_mass = rd.Double();
	m_massRadius = rd.Double();
	m_angInertia = rd.Double();
	m_enabled = rd.Bool();
}
示例#24
0
void PlayerShipController::Load(Serializer::Reader &rd)
{
	m_flightControlState = static_cast<FlightControlState>(rd.Int32());
	m_setSpeed = rd.Double();
	m_lowThrustPower = rd.Float();
	m_rotationDamping = rd.Bool();
	//figure out actual bodies in PostLoadFixup - after Space body index has been built
	m_combatTargetIndex = rd.Int32();
	m_navTargetIndex = rd.Int32();
	m_setSpeedTargetIndex = rd.Int32();
}
示例#25
0
void DynamicBody::Load(Serializer::Reader &rd, Space *space)
{
    ModelBody::Load(rd, space);
    m_force = rd.Vector3d();
    m_torque = rd.Vector3d();
    m_vel = rd.Vector3d();
    m_angVel = rd.Vector3d();
    m_mass = rd.Double();
    m_massRadius = rd.Double();
    m_angInertia = rd.Double();
    m_isMoving = rd.Bool();
}
示例#26
0
// XXX mostly a copy of CreateViews
void Game::LoadViews(Serializer::Reader &rd)
{
	Pi::SetView(0);

	// XXX views expect Pi::game and Pi::player to exist
	Pi::game = this;
	Pi::player = m_player.Get();

	Serializer::Reader section = rd.RdSection("ShipCpanel");
	Pi::cpan = new ShipCpanel(section, Pi::renderer);

	section = rd.RdSection("SectorView");
	Pi::sectorView = new SectorView(section);

	section = rd.RdSection("WorldView");
	Pi::worldView = new WorldView(section);

	Pi::galacticView = new GalacticView();
	Pi::systemView = new SystemView();
	Pi::systemInfoView = new SystemInfoView();
	Pi::spaceStationView = new SpaceStationView();
	Pi::infoView = new UIView("InfoView");
	Pi::deathView = new DeathView();

#if WITH_OBJECTVIEWER
	Pi::objectViewerView = new ObjectViewerView();
	Pi::objectViewerView->SetRenderer(Pi::renderer);
#endif

	Pi::galacticView->SetRenderer(Pi::renderer);
	Pi::infoView->SetRenderer(Pi::renderer);
	Pi::sectorView->SetRenderer(Pi::renderer);
	Pi::systemInfoView->SetRenderer(Pi::renderer);
	Pi::systemView->SetRenderer(Pi::renderer);
	Pi::worldView->SetRenderer(Pi::renderer);
	Pi::deathView->SetRenderer(Pi::renderer);
}
示例#27
0
Space::Space(Game *game, RefCountedPtr<Galaxy> galaxy, Serializer::Reader &rd, double at_time)
	: m_starSystemCache(galaxy->NewStarSystemSlaveCache())
	, m_game(game)
	, m_frameIndexValid(false)
	, m_bodyIndexValid(false)
	, m_sbodyIndexValid(false)
	, m_bodyNearFinder(this)
#ifndef NDEBUG
	, m_processingFinalizationQueue(false)
#endif
{
	m_starSystem = StarSystem::Unserialize(galaxy, rd);

	const SystemPath &path = m_starSystem->GetPath();
	Uint32 _init[5] = { path.systemIndex, Uint32(path.sectorX), Uint32(path.sectorY), Uint32(path.sectorZ), UNIVERSE_SEED };
	Random rand(_init, 5);
	m_background.reset(new Background::Container(Pi::renderer, rand));

	RebuildSystemBodyIndex();

	CityOnPlanet::SetCityModelPatterns(m_starSystem->GetPath());

	Serializer::Reader section = rd.RdSection("Frames");
	m_rootFrame.reset(Frame::Unserialize(section, this, 0, at_time));
	RebuildFrameIndex();

	Uint32 nbodies = rd.Int32();
	for (Uint32 i = 0; i < nbodies; i++)
		m_bodies.push_back(Body::Unserialize(rd, this));
	RebuildBodyIndex();

	Frame::PostUnserializeFixup(m_rootFrame.get(), this);
	for (Body* b : m_bodies)
		b->PostLoadFixup(this);

	GenSectorCache(galaxy, &path);
}
示例#28
0
文件: Body.cpp 项目: GAlexx/pioneer
void Body::Load(Serializer::Reader &rd)
{
	m_frame = Serializer::LookupFrame(rd.Int32());
	m_label = rd.String();
	m_onscreen = rd.Bool();
	m_projectedPos = rd.Vector3d();
	m_dead = rd.Bool();
	m_hasDoubleFrame = rd.Bool();
}	
示例#29
0
文件: Player.cpp 项目: fraang/pioneer
void Player::Load(Serializer::Reader &rd, Space *space)
{
	Pi::player = this;
	Ship::Load(rd, space);
	MarketAgent::Load(rd);
	m_flightControlState = static_cast<FlightControlState>(rd.Int32());
	m_setSpeed = rd.Double();
	m_killCount = rd.Int32();
	m_knownKillCount = rd.Int32();
	m_combatTargetIndex = rd.Int32();
	m_navTargetIndex = rd.Int32();
	m_setSpeedTargetIndex = rd.Int32();
}
示例#30
0
void Projectile::Load(Serializer::Reader &rd, Space *space)
{
	Body::Load(rd, space);
	for (int i=0; i<16; i++) m_orient[i] = rd.Double();
	m_baseVel = rd.Vector3d();
	m_dirVel = rd.Vector3d();
	m_age = rd.Float();
	m_type = rd.Int32();
	m_parentIndex = rd.Int32();
}