1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 06:52:34 +02: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};
glm::vec3 getPositionAt(float time) {
glm::vec3 getPositionAt(float time) const {
glm::vec3 p = position.rbegin()->second;
for (auto it = position.begin(); it != position.end(); ++it) {
if (it->first <= time) {
@ -62,7 +62,7 @@ struct CutsceneTracks {
return p;
}
glm::vec3 getTargetAt(float time) {
glm::vec3 getTargetAt(float time) const {
glm::vec3 p = position.rbegin()->second;
for (auto it = target.begin(); it != target.end(); ++it) {
if (it->first <= time) {
@ -85,7 +85,7 @@ struct CutsceneTracks {
return p;
}
float getZoomAt(float time) {
float getZoomAt(float time) const {
float r = zoom.rbegin()->second;
for (auto it = zoom.begin(); it != zoom.end(); ++it) {
if (it->first <= time) {
@ -108,7 +108,7 @@ struct CutsceneTracks {
return r;
}
float getRotationAt(float time) {
float getRotationAt(float time) const {
float r = rotation.rbegin()->second;
for (auto it = rotation.begin(); it != rotation.end(); ++it) {
if (it->first <= time) {

View File

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