1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 02:12:45 +01:00

Grab currentCutscene as const ref

This commit is contained in:
Filip Gawin 2018-11-15 16:03:52 +01:00
parent 056864e1d7
commit 0322b5c6b9
2 changed files with 6 additions and 6 deletions

View File

@ -39,7 +39,7 @@ struct CutsceneTracks {
float duration{0.f}; float duration{0.f};
glm::vec3 getPositionAt(float time) { glm::vec3 getPositionAt(float time) const {
glm::vec3 p = position.rbegin()->second; glm::vec3 p = position.rbegin()->second;
for (auto it = position.begin(); it != position.end(); ++it) { for (auto it = position.begin(); it != position.end(); ++it) {
if (it->first <= time) { if (it->first <= time) {
@ -62,7 +62,7 @@ struct CutsceneTracks {
return p; return p;
} }
glm::vec3 getTargetAt(float time) { glm::vec3 getTargetAt(float time) const {
glm::vec3 p = position.rbegin()->second; glm::vec3 p = position.rbegin()->second;
for (auto it = target.begin(); it != target.end(); ++it) { for (auto it = target.begin(); it != target.end(); ++it) {
if (it->first <= time) { if (it->first <= time) {
@ -85,7 +85,7 @@ struct CutsceneTracks {
return p; return p;
} }
float getZoomAt(float time) { float getZoomAt(float time) const {
float r = zoom.rbegin()->second; float r = zoom.rbegin()->second;
for (auto it = zoom.begin(); it != zoom.end(); ++it) { for (auto it = zoom.begin(); it != zoom.end(); ++it) {
if (it->first <= time) { if (it->first <= time) {
@ -108,7 +108,7 @@ struct CutsceneTracks {
return r; return r;
} }
float getRotationAt(float time) { float getRotationAt(float time) const {
float r = rotation.rbegin()->second; float r = rotation.rbegin()->second;
for (auto it = rotation.begin(); it != rotation.end(); ++it) { for (auto it = rotation.begin(); it != rotation.end(); ++it) {
if (it->first <= time) { if (it->first <= time) {

View File

@ -379,8 +379,8 @@ const ViewCamera& IngameState::getCamera(float alpha) {
auto player = game->getWorld()->getPlayer(); auto player = game->getWorld()->getPlayer();
auto world = getWorld(); auto world = getWorld();
if (state->currentCutscene && state->cutsceneStartTime >= 0.f) { if (const auto& cutscene = state->currentCutscene;
auto& cutscene = state->currentCutscene; cutscene && state->cutsceneStartTime >= 0.f) {
float cutsceneTime = float cutsceneTime =
std::min(world->getGameTime() - state->cutsceneStartTime, std::min(world->getGameTime() - state->cutsceneStartTime,
cutscene->tracks.duration); cutscene->tracks.duration);