MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SwitchCameraTo

Method SwitchCameraTo

engine/Poseidon/World/WorldSetup.cpp:1101–1138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1099}
1100
1101void World::SwitchCameraTo(Object* vehicle, CameraType camType)
1102{
1103 bool change = (vehicle != _cameraOn);
1104 float changeDist2 = 1e10;
1105 if (vehicle && _cameraOn)
1106 {
1107 changeDist2 = vehicle->Position().Distance2(_cameraOn->Position());
1108 }
1109 if (vehicle != _cameraOn || _camTypeMain != camType)
1110 {
1111 Object* oldCameraOn = _cameraOn;
1112 _cameraOn = vehicle;
1113 _camType = _camTypeMain = camType;
1114 InitCameraPars();
1115 SetActiveChannels();
1116 if (change)
1117 {
1118 EntityAI* ai = dyn_cast<EntityAI>(vehicle);
1119 if (_ui && ai)
1120 {
1121 Person* player = PlayerOn();
1122 if (player == ai || oldCameraOn == player)
1123 {
1124 InputSubsystem::Instance().ResetLookAroundToggle();
1125 }
1126 ai->ResetFF();
1127 _ui->ResetVehicle(ai);
1128 }
1129 }
1130 LOG_DEBUG(World, "Camera switched to {}", (const char*)vehicle->GetDebugName());
1131 }
1132 _nearImportanceDistributionTime = Glob.time - 60;
1133 _farImportanceDistributionTime = Glob.time - 60;
1134 if (vehicle && change && changeDist2 > Square(400))
1135 {
1136 _scene.GetLandscape()->FillCache(*vehicle);
1137 }
1138}
1139
1140static void KeepNZone(float& value, float cursor, float pos, float size, float fov)
1141{

Callers 15

GroupRespawnDoneFunction · 0.80
ProcessSeagullRespawnFunction · 0.80
SimulateMethod · 0.80
GetInDriverMethod · 0.80
TransferMsgMethod · 0.80
DestroyObjectMethod · 0.80
GunnerGetInFunction · 0.80
ProcessGetIn2Method · 0.80
DoGetOutMethod · 0.80
FireMissileMethod · 0.80
BeginArcadeMethod · 0.80
BeginPreviewUnitMethod · 0.80

Calls 9

ResetLookAroundToggleMethod · 0.80
ResetVehicleMethod · 0.80
FillCacheMethod · 0.80
GetLandscapeMethod · 0.80
SquareFunction · 0.50
Distance2Method · 0.45
PositionMethod · 0.45
ResetFFMethod · 0.45
GetDebugNameMethod · 0.45

Tested by

no test coverage detected