1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

* choosing adventure map scroll speed

This commit is contained in:
mateuszb 2008-11-30 14:08:07 +00:00
parent c6bcd61aba
commit 00899402cc
5 changed files with 21 additions and 17 deletions

View File

@ -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)
{
@ -1253,7 +1253,6 @@ 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]);

View File

@ -1001,6 +1001,7 @@ CPlayerInterface::CPlayerInterface(int Player, int serial)
pim = new boost::recursive_mutex;
showingDialog = new CondSh<bool>(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)

View File

@ -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

View File

@ -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<unsigned char> > > & visibilityMap, int lvl)
SDL_Surface * CMapHandler::getVisBitmap(int x, int y, const std::vector< std::vector< std::vector<unsigned char> > > & 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

View File

@ -86,7 +86,7 @@ public:
std::vector<std::vector<std::vector<unsigned char> > > 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<unsigned char> > > & visibilityMap, int lvl);
SDL_Surface * getVisBitmap(int x, int y, const std::vector< std::vector< std::vector<unsigned char> > > & 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