- Timestamp:
- 06/16/11 23:21:33 (14 years ago)
- Location:
- ps/trunk
- Files:
-
- 7 edited
-
binaries/data/mods/public/simulation/components/Player.js (modified) (1 diff)
-
binaries/data/mods/public/simulation/helpers/Player.js (modified) (1 diff)
-
source/graphics/MapReader.cpp (modified) (1 diff)
-
source/simulation2/components/ICmpPlayer.cpp (modified) (1 diff)
-
source/simulation2/components/ICmpPlayer.h (modified) (1 diff)
-
source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp (modified) (2 diffs)
-
source/tools/atlas/GameInterface/Handlers/CameraCtrlHandlers.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/simulation/components/Player.js
r9617 r9623 227 227 }; 228 228 229 Player.prototype.GetStartingCamera = function() 230 { 231 return this.startCam; 232 } 233 234 Player.prototype.SetStartingCamera = function(pos) 235 { 236 this.startCam = pos; 229 Player.prototype.GetStartingCameraPos = function() 230 { 231 return this.startCam.position; 232 } 233 234 Player.prototype.GetStartingCameraRot = function() 235 { 236 return this.startCam.rotation; 237 } 238 239 Player.prototype.SetStartingCamera = function(pos, rot) 240 { 241 this.startCam = {"position": pos, "rotation": rot}; 237 242 } 238 243 -
ps/trunk/binaries/data/mods/public/simulation/helpers/Player.js
r9617 r9623 130 130 } 131 131 132 if (getSetting(pData, pDefs, "StartingCamera") !== undefined) 133 { 134 player.SetStartingCamera(getSetting(pData, pDefs, "StartingCamera")); 132 var startCam = getSetting(pData, pDefs, "StartingCamera"); 133 if (startCam !== undefined) 134 { 135 player.SetStartingCamera(startCam.Position, startCam.Rotation); 135 136 } 136 137 } -
ps/trunk/source/graphics/MapReader.cpp
r9617 r9623 289 289 // Default to global camera (with constraints) 290 290 pGameView->ResetCameraTarget(pGameView->GetCamera()->GetFocus()); 291 291 292 // TODO: Starting rotation? 292 293 CmpPtr<ICmpPlayer> cmpPlayer(*pSimulation2, cmpPlayerManager->GetPlayerByID(m_PlayerID)); 293 294 if (!cmpPlayer.null() && cmpPlayer->HasStartingCamera()) 294 295 { 295 296 // Use player starting camera 296 CFixedVector3D pos = cmpPlayer->GetStartingCamera ();297 CFixedVector3D pos = cmpPlayer->GetStartingCameraPos(); 297 298 pGameView->ResetCameraTarget(CVector3D(pos.X.ToFloat(), pos.Y.ToFloat(), pos.Z.ToFloat())); 298 299 } -
ps/trunk/source/simulation2/components/ICmpPlayer.cpp
r9617 r9623 54 54 } 55 55 56 virtual CFixedVector3D GetStartingCamera ()56 virtual CFixedVector3D GetStartingCameraPos() 57 57 { 58 return m_Script.Call<CFixedVector3D>("GetStartingCamera"); 58 return m_Script.Call<CFixedVector3D>("GetStartingCameraPos"); 59 } 60 61 virtual CFixedVector3D GetStartingCameraRot() 62 { 63 return m_Script.Call<CFixedVector3D>("GetStartingCameraRot"); 59 64 } 60 65 -
ps/trunk/source/simulation2/components/ICmpPlayer.h
r9617 r9623 37 37 38 38 virtual CColor GetColour() = 0; 39 virtual CFixedVector3D GetStartingCamera() = 0; 39 virtual CFixedVector3D GetStartingCameraPos() = 0; 40 virtual CFixedVector3D GetStartingCameraRot() = 0; 40 41 41 42 virtual bool HasStartingCamera() = 0; -
ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp
r9620 r9623 624 624 if (player["StartingCamera"].defined()) 625 625 { 626 AtObj cam = *player["StartingCamera"];627 626 sCameraInfo info; 628 info.pX = wxAtof(*cam["x"]); 629 info.pY = wxAtof(*cam["y"]); 630 info.pZ = wxAtof(*cam["z"]); 627 AtObj camPos = *player["StartingCamera"]["Position"]; 628 info.pX = wxAtof(*camPos["x"]); 629 info.pY = wxAtof(*camPos["y"]); 630 info.pZ = wxAtof(*camPos["z"]); 631 AtObj camRot = *player["StartingCamera"]["Rotation"]; 632 info.rX = wxAtof(*camRot["x"]); 633 info.rY = wxAtof(*camRot["y"]); 634 info.rZ = wxAtof(*camRot["z"]); 631 635 632 636 controls.page->SetCamera(info, true); … … 719 723 { 720 724 sCameraInfo cam = controls.page->GetCamera(); 721 camObj.setDouble("x", cam.pX); 722 camObj.setDouble("y", cam.pY); 723 camObj.setDouble("z", cam.pZ); 725 AtObj camPos; 726 camPos.setDouble("x", cam.pX); 727 camPos.setDouble("y", cam.pY); 728 camPos.setDouble("z", cam.pZ); 729 camObj.set("Position", camPos); 730 731 AtObj camRot; 732 camRot.setDouble("x", cam.rX); 733 camRot.setDouble("y", cam.rY); 734 camRot.setDouble("z", cam.rZ); 735 camObj.set("Rotation", camRot); 724 736 } 725 737 player.set("StartingCamera", camObj); -
ps/trunk/source/tools/atlas/GameInterface/Handlers/CameraCtrlHandlers.cpp
r9617 r9623 22 22 #include "../View.h" 23 23 24 #include "maths/MathUtil.h" 24 25 #include "maths/Vector3D.h" 25 26 #include "maths/Quaternion.h" … … 223 224 { 224 225 CVector3D focus = g_Game->GetView()->GetCamera()->GetFocus(); 225 226 226 sCameraInfo info; 227 227 … … 230 230 info.pZ = focus.Z; 231 231 232 // TODO: Rotation 232 CQuaternion quatRot = g_Game->GetView()->GetCamera()->m_Orientation.GetRotation(); 233 quatRot.Normalize(); 234 CVector3D rotation = quatRot.ToEulerAngles(); 235 236 info.rX = RADTODEG(rotation.X); 237 info.rY = RADTODEG(rotation.Y); 238 info.rZ = RADTODEG(rotation.Z); 233 239 234 240 msg->info = info; … … 246 252 247 253 view->ResetCameraTarget(CVector3D(cam.pX, cam.pY, cam.pZ)); 248 } 249 250 } 254 255 // TODO: Rotation 256 } 257 258 }
Note:
See TracChangeset
for help on using the changeset viewer.
