From 207e5730010d621dc17227b2378c5c68b78e942d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Tue, 1 Mar 2011 09:57:18 +0000 Subject: [PATCH] Fixed #645 by reverting support for screen scrolling [there are still some remains in settings file] Removed some unused code. --- client/CMT.cpp | 4 ---- client/CPlayerInterface.cpp | 4 ---- client/CPreGame.cpp | 2 -- client/GUIBase.cpp | 36 ------------------------------------ client/SDL_Extensions.cpp | 17 ----------------- server/CGameHandler.cpp | 12 ------------ 6 files changed, 75 deletions(-) diff --git a/client/CMT.cpp b/client/CMT.cpp index 405f744f3..3aa717829 100644 --- a/client/CMT.cpp +++ b/client/CMT.cpp @@ -75,8 +75,6 @@ static CClient *client; SDL_Surface *screen = NULL, //main screen surface *screen2 = NULL,//and hlp surface (used to store not-active interfaces layer) *screenBuf = screen; //points to screen (if only advmapint is present) or screen2 (else) - should be used when updating controls which are not regularly redrawed -Point screenLT = Point(0, 0); //position of top left corner of the screen -Point screenLTmax = Point(0, 0); //,maximal values for screenLT coordinates static boost::thread *mainGUIThread; SystemOptions GDefaultOptions; @@ -549,8 +547,6 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen) SDL_ShowCursor(SDL_DISABLE); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); - screenLT = Point(0, 0); - #ifdef _WIN32 SDL_SysWMinfo wm; SDL_VERSION(&wm.version); diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index c6c256d66..5739976ea 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -69,8 +69,6 @@ using namespace CSDL_Ext; void processCommand(const std::string &message, CClient *&client); -extern Point screenLTmax; - extern std::queue events; extern boost::mutex eventsM; @@ -1348,8 +1346,6 @@ void CPlayerInterface::update() CSDL_Ext::update(screen); CCS->curh->draw2(); - screenLTmax = Point(conf.cc.resx - screen->w, conf.cc.resy - screen->h); - pim->unlock(); SDL_framerateDelay(mainFPSmng); diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index 9fa9dd6ac..9b94ba40d 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -65,7 +65,6 @@ using boost::ref; #endif void startGame(StartInfo * options, CConnection *serv = NULL); -extern Point screenLTmax; extern SystemOptions GDefaultOptions; CGPreGame * CGP; @@ -344,7 +343,6 @@ void CGPreGame::update() CCS->curh->draw1(); SDL_Flip(screen); CCS->curh->draw2(); - screenLTmax = Point(800 - screen->w, 600 - screen->h); GH.topInt()->show(screen); GH.updateTime(); GH.handleEvents(); diff --git a/client/GUIBase.cpp b/client/GUIBase.cpp index 103329bb7..145220851 100644 --- a/client/GUIBase.cpp +++ b/client/GUIBase.cpp @@ -21,8 +21,6 @@ extern std::queue events; extern boost::mutex eventsM; -extern Point screenLT; -extern Point screenLTmax; void KeyShortcut::keyPressed(const SDL_KeyboardEvent & key) { @@ -152,16 +150,6 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent) current = sEvent; bool prev; - struct HLP - { - static void adjustMousePos(SDL_Event * ev) - { - //adjust mouse position according to screenLT - ev->motion.x -= screenLT.x; - ev->motion.y -= screenLT.y; - } - }; - if (sEvent->type==SDL_KEYDOWN || sEvent->type==SDL_KEYUP) { SDL_KeyboardEvent key = sEvent->key; @@ -190,13 +178,10 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent) else if(sEvent->type==SDL_MOUSEMOTION) { CCS->curh->cursorMove(sEvent->motion.x, sEvent->motion.y); - HLP::adjustMousePos(sEvent); handleMouseMotion(sEvent); } else if (sEvent->type==SDL_MOUSEBUTTONDOWN) { - HLP::adjustMousePos(sEvent); - if(sEvent->button.button == SDL_BUTTON_LEFT) { @@ -255,8 +240,6 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent) } else if ((sEvent->type==SDL_MOUSEBUTTONUP) && (sEvent->button.button == SDL_BUTTON_LEFT)) { - HLP::adjustMousePos(sEvent); - std::list hlp = lclickable; for(std::list::iterator i=hlp.begin(); i != hlp.end() && current; i++) { @@ -270,28 +253,9 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent) else (*i)->clickLeft(boost::logic::indeterminate, prev); } - - //screen drag-and-drop handling - if (screenLTmax != Point(0,0)) - { - int diffX = sEvent->motion.x - lastClick.x, - diffY = sEvent->motion.y - lastClick.y; - - screenLT.x += diffX; - amin(screenLT.x, 0); - amax(screenLT.x, -screenLTmax.x); - - screenLT.y += diffY; - amin(screenLT.y, 0); - amax(screenLT.y, -screenLTmax.y); - totalRedraw(); - } - } else if ((sEvent->type==SDL_MOUSEBUTTONUP) && (sEvent->button.button == SDL_BUTTON_RIGHT)) { - HLP::adjustMousePos(sEvent); - std::list hlp = rclickable; for(std::list::iterator i=hlp.begin(); i != hlp.end() && current; i++) { diff --git a/client/SDL_Extensions.cpp b/client/SDL_Extensions.cpp index 0b6cacdf9..1b63da547 100644 --- a/client/SDL_Extensions.cpp +++ b/client/SDL_Extensions.cpp @@ -22,8 +22,6 @@ * */ -extern Point screenLT; - template STRONG_INLINE void ColorPutter::PutColorAlpha(Uint8 *&ptr, const SDL_Color & Color) { @@ -407,13 +405,6 @@ void CSDL_Ext::printAt( const std::string & text, int x, int y, EFonts font, SDL if(!text.size()) return; - //adjust x and y - if (dst == screen) - { - x += screenLT.x; - y += screenLT.y; - } - if (graphics->fontsTrueType[font]) { printAt(text,x, y, graphics->fontsTrueType[font], kolor, dst); @@ -1303,9 +1294,6 @@ void CSDL_Ext::blitSurface( SDL_Surface * src, SDL_Rect * srcRect, SDL_Surface * betterDst = Rect(0, 0, dst->w, dst->h); } - betterDst.x += screenLT.x; - betterDst.y += screenLT.y; - SDL_BlitSurface(src, srcRect, dst, &betterDst); } } @@ -1321,11 +1309,6 @@ void CSDL_Ext::fillRect( SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color ) { newRect = Rect(0, 0, dst->w, dst->h); } - if (dst == screen) - { - newRect.x += screenLT.x; - newRect.y += screenLT.y; - } SDL_FillRect(dst, &newRect, color); } diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index fccdea941..2887ea363 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -1427,14 +1427,6 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255* if(t.visitableObjects.size()) objectVisited(t.visitableObjects.back(), h); - -// BOOST_FOREACH(CGObjectInstance *obj, t.visitableObjects) -// { -// if (obj->blockVisit) -// { -// objectVisited(obj, h); -// } -// } tlog5 << "Blocking visit at " << hmpos << std::endl; return true; } @@ -1458,10 +1450,6 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255* { visitObjectOnTile(t, h); } -// BOOST_FOREACH(CGObjectInstance *obj, t.visitableObjects) -// { -// objectVisited(obj, h); -// } tlog5 << "Movement end!\n"; return true;