diff --git a/CAdvmapInterface.cpp b/CAdvmapInterface.cpp index fdd64a2f2..60da42cab 100644 --- a/CAdvmapInterface.cpp +++ b/CAdvmapInterface.cpp @@ -1206,13 +1206,13 @@ void CAdvMapInt::update() ++animValHitCount; //for animations if(animValHitCount == 8) { + CGI->mh->updateWater(); animValHitCount = 0; ++anim; updateScreen = true; - } ++heroAnim; - if((animValHitCount % 4) && !LOCPLINT->showingDialog->get()) + if((animValHitCount % (4/LOCPLINT->mapScrollingSpeed)) == 0 && !LOCPLINT->showingDialog->get()) { if(scrollingLeft) { @@ -1252,8 +1252,7 @@ void CAdvMapInt::update() } } if(updateScreen) - { - CGI->mh->updateWater(); + { terrain.show(); for(int i=0;i<4;i++) blitAt(gems[i]->ourImages[LOCPLINT->playerID].bitmap,ADVOPT.gemX[i],ADVOPT.gemY[i]); diff --git a/CPlayerInterface.cpp b/CPlayerInterface.cpp index 149555c15..051c3b949 100644 --- a/CPlayerInterface.cpp +++ b/CPlayerInterface.cpp @@ -1001,6 +1001,7 @@ CPlayerInterface::CPlayerInterface(int Player, int serial) pim = new boost::recursive_mutex; showingDialog = new CondSh(false); heroMoveSpeed = 2; + mapScrollingSpeed = 2; //initializing framerate keeper mainFPSmng = new FPSmanager; SDL_initFramerate(mainFPSmng); @@ -1529,16 +1530,6 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details) adventureInt->updateScreen = true; LOCPLINT->adventureInt->update(); //updating screen CSDL_Ext::update(screen); - //CGI->screenh->updateScreen(); - - ++LOCPLINT->adventureInt->animValHitCount; //for animations - if(LOCPLINT->adventureInt->animValHitCount == 8) - { - LOCPLINT->adventureInt->animValHitCount = 0; - ++LOCPLINT->adventureInt->anim; - LOCPLINT->adventureInt->updateScreen = true; - } - ++LOCPLINT->adventureInt->heroAnim; SDL_Delay(5); SDL_framerateDelay(mainFPSmng); //for animation purposes @@ -3825,6 +3816,13 @@ CSystemOptionsWindow::CSystemOptionsWindow(const SDL_Rect &pos, CPlayerInterface heroMoveSpeed->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[352].first),CGI->generaltexth->zelp[352].second, "sysopb4.def", 331, 134, 8); heroMoveSpeed->select(owner->heroMoveSpeed, 1); heroMoveSpeed->onChange = boost::bind(&CPlayerInterface::setHeroMoveSpeed, owner, _1); + + mapScrollSpeed = new CHighlightableButtonsGroup(0); + mapScrollSpeed->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[357].first),CGI->generaltexth->zelp[357].second, "sysopb9.def", 187, 267, 1); + mapScrollSpeed->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[358].first),CGI->generaltexth->zelp[358].second, "sysob10.def", 251, 267, 2); + mapScrollSpeed->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[359].first),CGI->generaltexth->zelp[359].second, "sysob11.def", 315, 267, 4); + mapScrollSpeed->select(owner->mapScrollingSpeed, 1); + mapScrollSpeed->onChange = boost::bind(&CPlayerInterface::setMapScrollingSpeed, owner, _1); } CSystemOptionsWindow::~CSystemOptionsWindow() @@ -3834,6 +3832,7 @@ CSystemOptionsWindow::~CSystemOptionsWindow() delete quitGame; delete backToMap; delete heroMoveSpeed; + delete mapScrollSpeed; } void CSystemOptionsWindow::bquitf() @@ -3864,6 +3863,7 @@ void CSystemOptionsWindow::activate() quitGame->activate(); backToMap->activate(); heroMoveSpeed->activate(); + mapScrollSpeed->activate(); } void CSystemOptionsWindow::deactivate() @@ -3871,6 +3871,7 @@ void CSystemOptionsWindow::deactivate() quitGame->deactivate(); backToMap->deactivate(); heroMoveSpeed->deactivate(); + mapScrollSpeed->deactivate(); } void CSystemOptionsWindow::show(SDL_Surface *to) @@ -3884,6 +3885,7 @@ void CSystemOptionsWindow::show(SDL_Surface *to) quitGame->show(to); backToMap->show(to); heroMoveSpeed->show(to); + mapScrollSpeed->show(to); } CTavernWindow::CTavernWindow(const CGHeroInstance *H1, const CGHeroInstance *H2, const std::string &gossip) diff --git a/CPlayerInterface.h b/CPlayerInterface.h index 9baf0f1e0..651a2c06a 100644 --- a/CPlayerInterface.h +++ b/CPlayerInterface.h @@ -336,7 +336,9 @@ public: boost::recursive_mutex *pim; bool makingTurn; int heroMoveSpeed; - void setHeroMoveSpeed(int newSpeed) {heroMoveSpeed = newSpeed;}; //set for the member above + void setHeroMoveSpeed(int newSpeed) {heroMoveSpeed = newSpeed;} //set for the member above + int mapScrollingSpeed; + void setMapScrollingSpeed(int newSpeed) {mapScrollingSpeed = newSpeed;} //set the member above SDL_Event * current; CMainInterface *curint; CAdvMapInt * adventureInt; @@ -664,6 +666,7 @@ private: SDL_Surface * background; //background of window AdventureMapButton * quitGame, * backToMap; CHighlightableButtonsGroup * heroMoveSpeed; + CHighlightableButtonsGroup * mapScrollSpeed; public: CSystemOptionsWindow(const SDL_Rect & pos, CPlayerInterface * owner); //c-tor ~CSystemOptionsWindow(); //d-tor diff --git a/mapHandler.cpp b/mapHandler.cpp index 3f5595a48..1d053e45b 100644 --- a/mapHandler.cpp +++ b/mapHandler.cpp @@ -746,7 +746,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level, //borders printed return su; } -SDL_Surface * CMapHandler::getVisBitmap(int x, int y, std::vector< std::vector< std::vector > > & visibilityMap, int lvl) +SDL_Surface * CMapHandler::getVisBitmap(int x, int y, const std::vector< std::vector< std::vector > > & visibilityMap, int lvl) { int size = visibilityMap.size()-1; //is tile visible. arrangement: (like num keyboard) bool d7 = (x>0 && y>0) ? visibilityMap[x-1][y-1][lvl] : 0, //789 diff --git a/mapHandler.h b/mapHandler.h index 82bbc96a7..d36cd56d2 100644 --- a/mapHandler.h +++ b/mapHandler.h @@ -86,7 +86,7 @@ public: std::vector > > hideBitmap; //specifies number of graphic that should be used to fully hide a tile void loadDefs(); - SDL_Surface * getVisBitmap(int x, int y, std::vector< std::vector< std::vector > > & visibilityMap, int lvl); + SDL_Surface * getVisBitmap(int x, int y, const std::vector< std::vector< std::vector > > & visibilityMap, int lvl); int getCost(int3 & a, int3 & b, const CGHeroInstance * hero); std::vector< std::string > getObjDescriptions(int3 pos); //returns desriptions of objects blocking given position