camera start position shows main building in center.
This commit is contained in:
parent
9a25ca1ba3
commit
9aff9842a4
|
@ -1334,39 +1334,13 @@ void Game::init(bool initForPreviewOnly) {
|
|||
}
|
||||
|
||||
if(this->loadGameNode == NULL) {
|
||||
gameCamera.init(map->getW(), map->getH());
|
||||
|
||||
// camera default height calculation
|
||||
if(map->getCameraHeight()>0 && gameCamera.getCalculatedDefault()<map->getCameraHeight()){
|
||||
gameCamera.setCalculatedDefault(map->getCameraHeight());
|
||||
}
|
||||
else if(gameCamera.getCalculatedDefault()<map->getMaxMapHeight()+13.0f){
|
||||
gameCamera.setCalculatedDefault(map->getMaxMapHeight()+13.0f);
|
||||
}
|
||||
|
||||
if(world.getThisFaction() != NULL) {
|
||||
const Vec2i &v= map->getStartLocation(world.getThisFaction()->getStartLocationIndex());
|
||||
gameCamera.setPos(Vec2f(v.x, v.y));
|
||||
}
|
||||
initCamera(map);
|
||||
}
|
||||
else {
|
||||
gui.loadGame(loadGameNode,&world);
|
||||
|
||||
if(inJoinGameLoading == true) {
|
||||
gameCamera.init(map->getW(), map->getH());
|
||||
|
||||
// camera default height calculation
|
||||
if(map->getCameraHeight()>0 && gameCamera.getCalculatedDefault()<map->getCameraHeight()){
|
||||
gameCamera.setCalculatedDefault(map->getCameraHeight());
|
||||
}
|
||||
else if(gameCamera.getCalculatedDefault()<map->getMaxMapHeight()+13.0f){
|
||||
gameCamera.setCalculatedDefault(map->getMaxMapHeight()+13.0f);
|
||||
}
|
||||
|
||||
if(world.getThisFaction() != NULL) {
|
||||
const Vec2i &v= map->getStartLocation(world.getThisFaction()->getStartLocationIndex());
|
||||
gameCamera.setPos(Vec2f(v.x, v.y));
|
||||
}
|
||||
initCamera(map);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1634,6 +1608,23 @@ void Game::init(bool initForPreviewOnly) {
|
|||
}
|
||||
}
|
||||
|
||||
void Game::initCamera(Map *map){
|
||||
gameCamera.init(map->getW(), map->getH());
|
||||
|
||||
// camera default height calculation
|
||||
if(map->getCameraHeight()>0 && gameCamera.getCalculatedDefault()<map->getCameraHeight()){
|
||||
gameCamera.setCalculatedDefault(map->getCameraHeight());
|
||||
}
|
||||
else if(gameCamera.getCalculatedDefault()<map->getMaxMapHeight()+13.0f){
|
||||
gameCamera.setCalculatedDefault(map->getMaxMapHeight()+13.0f);
|
||||
}
|
||||
|
||||
if(world.getThisFaction() != NULL) {
|
||||
const Vec2i &v= map->getStartLocation(world.getThisFaction()->getStartLocationIndex());
|
||||
gameCamera.setPos(Vec2f(v.x, v.y+gameCamera.getCalculatedDefault()/2));
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== update ====================
|
||||
|
||||
void Game::reInitGUI() {
|
||||
|
|
|
@ -408,6 +408,7 @@ private:
|
|||
void checkWinnerStandardHeadlessOrObserver();
|
||||
void checkWinnerStandardPlayer();
|
||||
std::map<int, int> getTeamsAlive();
|
||||
void initCamera(Map *map);
|
||||
|
||||
virtual bool clientLagHandler(int slotIndex,bool networkPauseGameForLaggedClients);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue