Changeset View
Changeset View
Standalone View
Standalone View
0ad/source/graphics/MapReader.cpp
Show First 20 Lines • Show All 315 Lines • ▼ Show 20 Lines | if (pGameView && cmpPlayerManager) | ||||
pGameView->ResetCameraTarget(pGameView->GetCamera()->GetFocus()); | pGameView->ResetCameraTarget(pGameView->GetCamera()->GetFocus()); | ||||
// TODO: Starting rotation? | // TODO: Starting rotation? | ||||
CmpPtr<ICmpPlayer> cmpPlayer(*pSimContext, cmpPlayerManager->GetPlayerByID(m_PlayerID)); | CmpPtr<ICmpPlayer> cmpPlayer(*pSimContext, cmpPlayerManager->GetPlayerByID(m_PlayerID)); | ||||
if (cmpPlayer && cmpPlayer->HasStartingCamera()) | if (cmpPlayer && cmpPlayer->HasStartingCamera()) | ||||
{ | { | ||||
// Use player starting camera | // Use player starting camera | ||||
CFixedVector3D pos = cmpPlayer->GetStartingCameraPos(); | CFixedVector3D pos = cmpPlayer->GetStartingCameraPos(); | ||||
pGameView->ResetCameraTarget(CVector3D(pos.X.ToFloat(), pos.Y.ToFloat(), pos.Z.ToFloat())); | pGameView->ResetCameraTarget(CVector3D(pos.getX().ToFloat(), pos.getY().ToFloat(), pos.getZ().ToFloat())); | ||||
} | } | ||||
else if (m_StartingCameraTarget != INVALID_ENTITY) | else if (m_StartingCameraTarget != INVALID_ENTITY) | ||||
{ | { | ||||
// Point camera at entity | // Point camera at entity | ||||
CmpPtr<ICmpPosition> cmpPosition(*pSimContext, m_StartingCameraTarget); | CmpPtr<ICmpPosition> cmpPosition(*pSimContext, m_StartingCameraTarget); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
{ | { | ||||
CFixedVector3D pos = cmpPosition->GetPosition(); | CFixedVector3D pos = cmpPosition->GetPosition(); | ||||
pGameView->ResetCameraTarget(CVector3D(pos.X.ToFloat(), pos.Y.ToFloat(), pos.Z.ToFloat())); | pGameView->ResetCameraTarget(CVector3D(pos.getX().ToFloat(), pos.getY().ToFloat(), pos.getZ().ToFloat())); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
▲ Show 20 Lines • Show All 706 Lines • ▼ Show 20 Lines | while (entity_idx < entities.size()) | ||||
{ // Don't add entities with invalid player IDs | { // Don't add entities with invalid player IDs | ||||
LOGERROR("Failed to load entity template '%s'", utf8_from_wstring(TemplateName)); | LOGERROR("Failed to load entity template '%s'", utf8_from_wstring(TemplateName)); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
CmpPtr<ICmpPosition> cmpPosition(sim, ent); | CmpPtr<ICmpPosition> cmpPosition(sim, ent); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
{ | { | ||||
cmpPosition->JumpTo(Position.X, Position.Z); | cmpPosition->JumpTo(Position.getX(), Position.getZ()); | ||||
cmpPosition->SetYRotation(Orientation.Y); | cmpPosition->SetYRotation(Orientation.getY()); | ||||
// TODO: other parts of the position | // TODO: other parts of the position | ||||
} | } | ||||
CmpPtr<ICmpOwnership> cmpOwnership(sim, ent); | CmpPtr<ICmpOwnership> cmpOwnership(sim, ent); | ||||
if (cmpOwnership) | if (cmpOwnership) | ||||
cmpOwnership->SetOwner(PlayerID); | cmpOwnership->SetOwner(PlayerID); | ||||
if (!Garrison.empty()) | if (!Garrison.empty()) | ||||
▲ Show 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | while (entity_idx < num_entities) | ||||
{ // Don't add entities with invalid player IDs | { // Don't add entities with invalid player IDs | ||||
LOGERROR("Failed to load entity template '%s'", utf8_from_wstring(currEnt.templateName)); | LOGERROR("Failed to load entity template '%s'", utf8_from_wstring(currEnt.templateName)); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
CmpPtr<ICmpPosition> cmpPosition(sim, ent); | CmpPtr<ICmpPosition> cmpPosition(sim, ent); | ||||
if (cmpPosition) | if (cmpPosition) | ||||
{ | { | ||||
cmpPosition->JumpTo(currEnt.position.X * (int)TERRAIN_TILE_SIZE, currEnt.position.Z * (int)TERRAIN_TILE_SIZE); | cmpPosition->JumpTo(currEnt.position.getX() * (int)TERRAIN_TILE_SIZE, currEnt.position.getZ() * (int)TERRAIN_TILE_SIZE); | ||||
cmpPosition->SetYRotation(currEnt.rotation.Y); | cmpPosition->SetYRotation(currEnt.rotation.getY()); | ||||
// TODO: other parts of the position | // TODO: other parts of the position | ||||
} | } | ||||
CmpPtr<ICmpOwnership> cmpOwnership(sim, ent); | CmpPtr<ICmpOwnership> cmpOwnership(sim, ent); | ||||
if (cmpOwnership) | if (cmpOwnership) | ||||
cmpOwnership->SetOwner(currEnt.playerID); | cmpOwnership->SetOwner(currEnt.playerID); | ||||
// Detect and fix collisions between foundation-blocking entities. | // Detect and fix collisions between foundation-blocking entities. | ||||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator