diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index ac9114ee..372d3b85 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -40,6 +40,8 @@ Game *thisGamePtr = NULL; // ===================== PUBLIC ======================== +const float PHOTO_MODE_MAXHEIGHT = 500.0; + Game::Game(Program *program, const GameSettings *gameSettings): ProgramState(program), lastMousePos(0), isFirstRender(true) { @@ -1174,6 +1176,14 @@ void Game::keyDown(char key) { } else if(key == configKeys.getCharKey("TogglePhotoMode")) { photoModeEnabled = !photoModeEnabled; + if( photoModeEnabled == true && + this->gameSettings.isNetworkGame() == false) { + gameCamera.setMaxHeight(PHOTO_MODE_MAXHEIGHT); + } + else if(photoModeEnabled == false) { + gameCamera.setMaxHeight(-1); + } + } //Toggle music else if(key == configKeys.getCharKey("ToggleMusic")) { @@ -1740,7 +1750,7 @@ void Game::checkWinnerStandard(){ // This caused too much LAG for network games if(this->gameSettings.isNetworkGame() == false) { Renderer::getInstance().setPhotoMode(true); - gameCamera.setMaxHeight(500); + gameCamera.setMaxHeight(PHOTO_MODE_MAXHEIGHT); } // END } @@ -1770,7 +1780,7 @@ void Game::checkWinnerStandard(){ // This caused too much LAG for network games if(this->gameSettings.isNetworkGame() == false) { Renderer::getInstance().setPhotoMode(true); - gameCamera.setMaxHeight(500); + gameCamera.setMaxHeight(PHOTO_MODE_MAXHEIGHT); } // END @@ -1814,7 +1824,7 @@ void Game::checkWinnerStandard(){ // This caused too much LAG for network games if(this->gameSettings.isNetworkGame() == false) { Renderer::getInstance().setPhotoMode(true); - gameCamera.setMaxHeight(500); + gameCamera.setMaxHeight(PHOTO_MODE_MAXHEIGHT); } // END } @@ -1844,7 +1854,7 @@ void Game::checkWinnerScripted() { // This caused too much LAG for network games if(this->gameSettings.isNetworkGame() == false) { Renderer::getInstance().setPhotoMode(true); - gameCamera.setMaxHeight(500); + gameCamera.setMaxHeight(PHOTO_MODE_MAXHEIGHT); } // END } diff --git a/source/glest_game/game/game_camera.cpp b/source/glest_game/game/game_camera.cpp index 376305ba..1e722136 100644 --- a/source/glest_game/game/game_camera.cpp +++ b/source/glest_game/game/game_camera.cpp @@ -76,6 +76,15 @@ GameCamera::~GameCamera() { cacheVisibleQuad.clear(); } +void GameCamera::setMaxHeight(float value) { + if(value < 0) { + maxHeight = Config::getInstance().getFloat("CameraMaxDistance","20"); + } + else { + maxHeight = value; + } +} + void GameCamera::init(int limitX, int limitY){ this->limitX= limitX; this->limitY= limitY; diff --git a/source/glest_game/game/game_camera.h b/source/glest_game/game/game_camera.h index d0735034..9f6a31a9 100644 --- a/source/glest_game/game/game_camera.h +++ b/source/glest_game/game/game_camera.h @@ -129,7 +129,7 @@ public: void save(XmlNode *node) const; void setClampBounds(bool value) { clampBounds = value; } - void setMaxHeight(float value) { maxHeight = value; } + void setMaxHeight(float value); void setFov(float value) { fov = value; } void setMinVAng(float value) { minVAng = value; } void setMaxVAng(float value) { maxVAng = value; }