Sfoglia il codice sorgente

Fixed #645 by reverting support for screen scrolling [there are still some remains in settings file]
Removed some unused code.

Michał W. Urbańczyk 14 anni fa
parent
commit
207e573001

+ 0 - 4
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);

+ 0 - 4
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<SDL_Event*> 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);

+ 0 - 2
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();

+ 0 - 36
client/GUIBase.cpp

@@ -21,8 +21,6 @@
 
 extern std::queue<SDL_Event*> 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<CIntObject*> hlp = lclickable;
 		for(std::list<CIntObject*>::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<CIntObject*> hlp = rclickable;
 		for(std::list<CIntObject*>::iterator i=hlp.begin(); i != hlp.end() && current; i++)
 		{

+ 0 - 17
client/SDL_Extensions.cpp

@@ -22,8 +22,6 @@
  *
  */
 
-extern Point screenLT;
-
 template<int bpp, int incrementPtr>
 STRONG_INLINE void ColorPutter<bpp, incrementPtr>::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);
 }
 

+ 0 - 12
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;