Ticket #3301: cinematic_camera_fix.patch
File cinematic_camera_fix.patch, 4.8 KB (added by , 8 years ago) |
---|
-
source/graphics/CinemaManager.cpp
36 36 #include "ps/CStr.h" 37 37 #include "ps/Game.h" 38 38 #include "ps/Hotkey.h" 39 #include "ps/GameSetup/GameSetup.h" 39 40 #include "simulation2/components/ICmpOverlayRenderer.h" 40 41 #include "simulation2/components/ICmpRangeManager.h" 41 42 #include "simulation2/components/ICmpSelectable.h" … … 98 99 if (m_CinematicSimulationData.m_Enabled == enabled) 99 100 return; 100 101 102 RenderCursor(!enabled); 103 101 104 // TODO: Enabling/Disabling does not work if the session GUI page is not the top page. 102 105 // This can happen in various situations, for example when the player wins/looses the game 103 106 // while the cinematic is running (a message box is the top page in this case). … … 151 154 { 152 155 m_CinematicSimulationData.m_Paused = g_Game->m_Paused; 153 156 157 RenderCursor(g_Game->m_Paused); 158 154 159 // sn - session gui object 155 160 IGUIObject *sn = g_GUI->FindObjectByName("sn"); 156 161 -
source/graphics/CinemaPath.h
126 126 127 127 fixed GetTimescale() const { return m_Timescale; } 128 128 129 TNSpline* getTargetSpline() { return &m_TargetSpline; }129 const TNSpline& getTargetSpline() const { return m_TargetSpline; } 130 130 131 131 private: 132 132 -
source/graphics/MapWriter.cpp
410 410 { 411 411 fixed timescale = it->second.GetTimescale(); 412 412 const std::vector<SplineData>& nodes = it->second.GetAllNodes(); 413 const std::vector<SplineData>& target_nodes = it->second.getTargetSpline().GetAllNodes(); 413 414 const CCinemaData* data = it->second.GetData(); 414 415 415 416 XML_Element("Path"); … … 419 420 XML_Attribute("mode", data->m_Mode); 420 421 XML_Attribute("style", data->m_Style); 421 422 422 // TODO: write target nodes423 for (size_t j = 0; j < nodes.size(); ++j)423 fixed last_target = fixed::Zero(); 424 for (size_t i = 0, j = 0; i < nodes.size(); ++i) 424 425 { 425 426 XML_Element("Node"); 426 if (j > 0) 427 XML_Attribute("deltatime", nodes[j - 1].Distance); 427 fixed distance; 428 if (i > 0) 429 distance = nodes[i - 1].Distance; 428 430 else 429 XML_Attribute("deltatime", 0.0f); 430 431 distance = fixed::Zero(); 432 last_target += distance; 433 434 XML_Attribute("deltatime", distance); 435 431 436 { 432 437 XML_Element("Position"); 433 XML_Attribute("x", nodes[ j].Position.X);434 XML_Attribute("y", nodes[ j].Position.Y);435 XML_Attribute("z", nodes[ j].Position.Z);438 XML_Attribute("x", nodes[i].Position.X); 439 XML_Attribute("y", nodes[i].Position.Y); 440 XML_Attribute("z", nodes[i].Position.Z); 436 441 } 437 442 438 443 { 439 444 XML_Element("Rotation"); 440 XML_Attribute("x", nodes[ j].Rotation.X);441 XML_Attribute("y", nodes[ j].Rotation.Y);442 XML_Attribute("z", nodes[ j].Rotation.Z);445 XML_Attribute("x", nodes[i].Rotation.X); 446 XML_Attribute("y", nodes[i].Rotation.Y); 447 XML_Attribute("z", nodes[i].Rotation.Z); 443 448 } 449 450 if (j >= target_nodes.size()) 451 continue; 452 453 fixed target_distance; 454 if (j > 0) 455 target_distance = target_nodes[j - 1].Distance; 456 else 457 target_distance = fixed::Zero(); 458 459 if (target_distance > last_target) 460 continue; 461 462 { 463 XML_Element("Target"); 464 XML_Attribute("x", target_nodes[j].Position.X); 465 XML_Attribute("y", target_nodes[j].Position.Y); 466 XML_Attribute("z", target_nodes[j].Position.Z); 467 } 468 469 last_target = fixed::Zero(); 470 ++j; 444 471 } 445 472 } 446 473 } -
source/ps/GameSetup/GameSetup.cpp
1116 1116 1117 1117 void RenderCursor(bool RenderingState) 1118 1118 { 1119 SDL_ShowCursor(RenderingState); 1119 1120 g_DoRenderCursor = RenderingState; 1120 1121 } 1121 1122 -
source/simulation2/components/CCmpCinemaManager.cpp
96 96 if (!data->m_LookAtTarget) 97 97 continue; 98 98 99 const std::vector<SplineData>& targetNodes = path.getTargetSpline() ->GetAllNodes();99 const std::vector<SplineData>& targetNodes = path.getTargetSpline().GetAllNodes(); 100 100 serialize.NumberU32("NumberOfTargetNodes", targetNodes.size(), 1, MAX_SPLINE_NODES); 101 101 for (size_t i = 0; i < targetNodes.size(); ++i) 102 102 {