Browse Source

a bit of refactoring (removed variable ekran as we have screen which is the same as ekran)

mateuszb 17 years ago
parent
commit
62952e3163
10 changed files with 76 additions and 77 deletions
  1. 10 10
      CAdvmapInterface.cpp
  2. 9 9
      CCastleInterface.cpp
  3. 1 1
      CHeroWindow.cpp
  4. 1 2
      CMT.cpp
  5. 3 3
      CMessage.cpp
  6. 38 38
      CPlayerInterface.cpp
  7. BIN
      CPreGame.cpp
  8. 12 12
      SDL_Extensions.h
  9. 1 1
      hch/CSemiDefHandler.cpp
  10. 1 1
      mapHandler.cpp

+ 10 - 10
CAdvmapInterface.cpp

@@ -123,7 +123,7 @@ void CMinimap::draw()
 		by = (((float)LOCPLINT->adventureInt->position.y)/(((float)CGI->mh->sizes.y)))*pos.h;
 		by = (((float)LOCPLINT->adventureInt->position.y)/(((float)CGI->mh->sizes.y)))*pos.h;
 	blitAt(radar,bx,by,temps);
 	blitAt(radar,bx,by,temps);
 	blitAt(temps,pos.x,pos.y);
 	blitAt(temps,pos.x,pos.y);
-	//SDL_UpdateRect(ekran,pos.x,pos.y,pos.w,pos.h);
+	//SDL_UpdateRect(screen,pos.x,pos.y,pos.w,pos.h);
 }
 }
 void CMinimap::redraw(int level)// (level==-1) => redraw all levels
 void CMinimap::redraw(int level)// (level==-1) => redraw all levels
 {
 {
@@ -134,7 +134,7 @@ void CMinimap::redraw(int level)// (level==-1) => redraw all levels
 		if ((level>=0) && (i!=level))
 		if ((level>=0) && (i!=level))
 			continue;
 			continue;
 		if (map.size()<i+1)
 		if (map.size()<i+1)
-			pom = CSDL_Ext::newSurface(pos.w,pos.h,ekran);
+			pom = CSDL_Ext::newSurface(pos.w,pos.h,screen);
 		else pom = map[i];
 		else pom = map[i];
 		for (int x=0;x<pos.w;x++)
 		for (int x=0;x<pos.w;x++)
 		{
 		{
@@ -519,25 +519,25 @@ void CTerrainRect::showPath()
 				hvy = (y+arrows->ourImages[pn].bitmap->h)-(pos.y+pos.h);
 				hvy = (y+arrows->ourImages[pn].bitmap->h)-(pos.y+pos.h);
 			if (hvx<0 && hvy<0)
 			if (hvx<0 && hvy<0)
 			{
 			{
-				CSDL_Ext::blit8bppAlphaTo24bpp(arrows->ourImages[pn].bitmap, NULL, ekran, &genRect(32, 32, x, y));
+				CSDL_Ext::blit8bppAlphaTo24bpp(arrows->ourImages[pn].bitmap, NULL, screen, &genRect(32, 32, x, y));
 			}
 			}
 			else if(hvx<0)
 			else if(hvx<0)
 			{
 			{
 				CSDL_Ext::blit8bppAlphaTo24bpp
 				CSDL_Ext::blit8bppAlphaTo24bpp
 					(arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w,0,0),
 					(arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w,0,0),
-					ekran,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w,x,y));
+					screen,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w,x,y));
 			}
 			}
 			else if (hvy<0)
 			else if (hvy<0)
 			{
 			{
 				CSDL_Ext::blit8bppAlphaTo24bpp
 				CSDL_Ext::blit8bppAlphaTo24bpp
 					(arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h,arrows->ourImages[pn].bitmap->w-hvx,0,0),
 					(arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h,arrows->ourImages[pn].bitmap->w-hvx,0,0),
-					ekran,&genRect(arrows->ourImages[pn].bitmap->h,arrows->ourImages[pn].bitmap->w-hvx,x,y));
+					screen,&genRect(arrows->ourImages[pn].bitmap->h,arrows->ourImages[pn].bitmap->w-hvx,x,y));
 			}
 			}
 			else
 			else
 			{
 			{
 				CSDL_Ext::blit8bppAlphaTo24bpp
 				CSDL_Ext::blit8bppAlphaTo24bpp
 					(arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx,0,0),
 					(arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx,0,0),
-					ekran,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx,x,y));
+					screen,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx,x,y));
 			}
 			}
 
 
 		}
 		}
@@ -549,9 +549,9 @@ void CTerrainRect::show()
 		(LOCPLINT->adventureInt->position.x,LOCPLINT->adventureInt->position.y,
 		(LOCPLINT->adventureInt->position.x,LOCPLINT->adventureInt->position.y,
 		tilesw,tilesh,LOCPLINT->adventureInt->position.z,LOCPLINT->adventureInt->anim,
 		tilesw,tilesh,LOCPLINT->adventureInt->position.z,LOCPLINT->adventureInt->anim,
 		LOCPLINT->cb->getVisibilityMap(), true, LOCPLINT->adventureInt->heroAnim,
 		LOCPLINT->cb->getVisibilityMap(), true, LOCPLINT->adventureInt->heroAnim,
-		ekran,&genRect(547,594,7,6)
+		screen,&genRect(547,594,7,6)
 		);
 		);
-	//SDL_BlitSurface(teren,&genRect(pos.h,pos.w,0,0),ekran,&genRect(547,594,7,6));
+	//SDL_BlitSurface(teren,&genRect(pos.h,pos.w,0,0),screen,&genRect(547,594,7,6));
 	//SDL_FreeSurface(teren);
 	//SDL_FreeSurface(teren);
 	if (currentPath && LOCPLINT->adventureInt->position.z==currentPath->startPos().z) //drawing path
 	if (currentPath && LOCPLINT->adventureInt->position.z==currentPath->startPos().z) //drawing path
 	{
 	{
@@ -619,7 +619,7 @@ void CResDataBar::draw()
 	itoa(LOCPLINT->cb->getDate(1),buf,10); temp+=std::string(buf);
 	itoa(LOCPLINT->cb->getDate(1),buf,10); temp+=std::string(buf);
 	printAt(processStr(datetext,temp),txtpos[7].first,txtpos[7].second,GEOR13,zwykly);
 	printAt(processStr(datetext,temp),txtpos[7].first,txtpos[7].second,GEOR13,zwykly);
 	temp.clear();
 	temp.clear();
-	//updateRect(&pos,ekran);
+	//updateRect(&pos,screen);
 	delete[] buf;
 	delete[] buf;
 }
 }
 CInfoBar::CInfoBar()
 CInfoBar::CInfoBar()
@@ -971,7 +971,7 @@ void CAdvMapInt::show()
 
 
 	infoBar.draw();
 	infoBar.draw();
 
 
-	CSDL_Ext::update(ekran);
+	CSDL_Ext::update(screen);
 }
 }
 void CAdvMapInt::hide()
 void CAdvMapInt::hide()
 {
 {

+ 9 - 9
CCastleInterface.cpp

@@ -114,8 +114,8 @@ void CBuildingRect::clickRight (tribool down)
 			CGI->buildh->buildings[str->townID][str->ID]->description, 
 			CGI->buildh->buildings[str->townID][str->ID]->description, 
 			LOCPLINT->castleInt->bicons->ourImages[str->ID].bitmap, 
 			LOCPLINT->castleInt->bicons->ourImages[str->ID].bitmap, 
 			CGI->buildh->buildings[str->townID][str->ID]->name);
 			CGI->buildh->buildings[str->townID][str->ID]->name);
-		vinya->pos.x = ekran->w/2 - vinya->bitmap->w/2;
-		vinya->pos.y = ekran->h/2 - vinya->bitmap->h/2;
+		vinya->pos.x = screen->w/2 - vinya->bitmap->w/2;
+		vinya->pos.y = screen->h/2 - vinya->bitmap->h/2;
 		vinya->activate();
 		vinya->activate();
 	}
 	}
 }
 }
@@ -349,7 +349,7 @@ void CCastleInterface::enterHall()
 void CCastleInterface::showAll(SDL_Surface * to)
 void CCastleInterface::showAll(SDL_Surface * to)
 {	
 {	
 	if (!to)
 	if (!to)
-		to=ekran;
+		to=screen;
 	blitAt(cityBg,0,0,to);
 	blitAt(cityBg,0,0,to);
 	blitAt(townInt,0,374,to);
 	blitAt(townInt,0,374,to);
 	LOCPLINT->adventureInt->resdatabar.draw();
 	LOCPLINT->adventureInt->resdatabar.draw();
@@ -435,7 +435,7 @@ void CCastleInterface::show(SDL_Surface * to)
 	if(!showing)
 	if(!showing)
 		return;
 		return;
 	if (!to)
 	if (!to)
-		to=ekran;
+		to=screen;
 	count++;
 	count++;
 	if(count==4)
 	if(count==4)
 	{
 	{
@@ -590,7 +590,7 @@ void CHallInterface::CResDataBar::show(SDL_Surface * to)
 			+ ": %s",temp)
 			+ ": %s",temp)
 		,pos.x+545+(pos.w-545)/2,pos.y+pos.h/2,GEOR13,zwykly);
 		,pos.x+545+(pos.w-545)/2,pos.y+pos.h/2,GEOR13,zwykly);
 	temp.clear();
 	temp.clear();
-	//updateRect(&pos,ekran);
+	//updateRect(&pos,screen);
 	delete[] buf;
 	delete[] buf;
 }
 }
 CHallInterface::CResDataBar::CResDataBar()
 CHallInterface::CResDataBar::CResDataBar()
@@ -872,7 +872,7 @@ void CHallInterface::CBuildWindow::show(SDL_Surface * to)
 {
 {
 	SDL_Rect pom = genRect(bitmap->h-1,bitmap->w-1,pos.x,pos.y);
 	SDL_Rect pom = genRect(bitmap->h-1,bitmap->w-1,pos.x,pos.y);
 	SDL_Rect poms = pom; poms.x=0;poms.y=0;
 	SDL_Rect poms = pom; poms.x=0;poms.y=0;
-	SDL_BlitSurface(bitmap,&poms,to?to:ekran,&pom);
+	SDL_BlitSurface(bitmap,&poms,to?to:screen,&pom);
 	if(!mode)
 	if(!mode)
 	{
 	{
 		buy->show();
 		buy->show();
@@ -942,11 +942,11 @@ CHallInterface::CBuildWindow::CBuildWindow(int Tid, int Bid, int State, bool Mod
 :tid(Tid),bid(Bid),mode(Mode), state(State)
 :tid(Tid),bid(Bid),mode(Mode), state(State)
 {
 {
 	SDL_Surface *hhlp = CGI->bitmaph->loadBitmap("TPUBUILD.bmp");
 	SDL_Surface *hhlp = CGI->bitmaph->loadBitmap("TPUBUILD.bmp");
-	bitmap = SDL_ConvertSurface(hhlp,ekran->format,0); //na 8bitowej mapie by sie psulo
+	bitmap = SDL_ConvertSurface(hhlp,screen->format,0); //na 8bitowej mapie by sie psulo
 	SDL_SetColorKey(hhlp,SDL_SRCCOLORKEY,SDL_MapRGB(hhlp->format,0,255,255));
 	SDL_SetColorKey(hhlp,SDL_SRCCOLORKEY,SDL_MapRGB(hhlp->format,0,255,255));
 	SDL_FreeSurface(hhlp);
 	SDL_FreeSurface(hhlp);
-	pos.x = ekran->w/2 - bitmap->w/2;
-	pos.y = ekran->h/2 - bitmap->h/2;
+	pos.x = screen->w/2 - bitmap->w/2;
+	pos.y = screen->h/2 - bitmap->h/2;
 	CSDL_Ext::blueToPlayersAdv(bitmap,LOCPLINT->playerID);
 	CSDL_Ext::blueToPlayersAdv(bitmap,LOCPLINT->playerID);
 	blitAt(LOCPLINT->castleInt->bicons->ourImages[bid].bitmap,125,50,bitmap);
 	blitAt(LOCPLINT->castleInt->bicons->ourImages[bid].bitmap,125,50,bitmap);
 	std::vector<std::string> pom; pom.push_back(CGI->buildh->buildings[tid][bid]->name);
 	std::vector<std::string> pom; pom.push_back(CGI->buildh->buildings[tid][bid]->name);

+ 1 - 1
CHeroWindow.cpp

@@ -155,7 +155,7 @@ CHeroWindow::~CHeroWindow()
 void CHeroWindow::show(SDL_Surface *to)
 void CHeroWindow::show(SDL_Surface *to)
 {
 {
 	if(!to)
 	if(!to)
-		to=ekran;
+		to=screen;
 	if(curBack)
 	if(curBack)
 		blitAt(curBack,pos.x,pos.y,to);
 		blitAt(curBack,pos.x,pos.y,to);
 	quitButton->show();
 	quitButton->show();

+ 1 - 2
CMT.cpp

@@ -66,7 +66,7 @@ const char * NAME = "VCMI 0.58";
 
 
 SDL_Color playerColorPalette[256]; //palette to make interface colors good
 SDL_Color playerColorPalette[256]; //palette to make interface colors good
 
 
-SDL_Surface * ekran, * screen, * screen2;
+SDL_Surface * screen, * screen2;
 extern SDL_Surface * CSDL_Ext::std32bppSurface;
 extern SDL_Surface * CSDL_Ext::std32bppSurface;
 TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM, *GEOR16;
 TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM, *GEOR16;
 void handleCPPObjS(std::map<int,CCPPObjectScript*> * mapa, CCPPObjectScript * script)
 void handleCPPObjS(std::map<int,CCPPObjectScript*> * mapa, CCPPObjectScript * script)
@@ -369,7 +369,6 @@ int _tmain(int argc, _TCHAR* argv[])
 
 
 		//screen2 = SDL_SetVideoMode(800,600,24,SDL_SWSURFACE|SDL_DOUBLEBUF/*|SDL_FULLSCREEN*/);
 		//screen2 = SDL_SetVideoMode(800,600,24,SDL_SWSURFACE|SDL_DOUBLEBUF/*|SDL_FULLSCREEN*/);
 		//screen = SDL_ConvertSurface(screen2, screen2->format, SDL_SWSURFACE);
 		//screen = SDL_ConvertSurface(screen2, screen2->format, SDL_SWSURFACE);
-		ekran = screen;
 
 
 		SDL_WM_SetCaption(NAME,""); //set window title
 		SDL_WM_SetCaption(NAME,""); //set window title
 		CGameInfo * cgi = new CGameInfo; //contains all global informations about game (texts, lodHandlers, map handler itp.)
 		CGameInfo * cgi = new CGameInfo; //contains all global informations about game (texts, lodHandlers, map handler itp.)

+ 3 - 3
CMessage.cpp

@@ -19,10 +19,10 @@
 SDL_Color tytulowy, tlo, zwykly ;
 SDL_Color tytulowy, tlo, zwykly ;
 SDL_Rect genRect(int hh, int ww, int xx, int yy);
 SDL_Rect genRect(int hh, int ww, int xx, int yy);
 
 
-extern SDL_Surface * ekran;
+extern SDL_Surface * screen;
 extern TTF_Font * TNRB16, *TNR, *GEOR13;
 extern TTF_Font * TNRB16, *TNR, *GEOR13;
 SDL_Color genRGB(int r, int g, int b, int a=0);
 SDL_Color genRGB(int r, int g, int b, int a=0);
-//void printAt(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2);
+//void printAt(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=screen, unsigned char quality = 2);
 bool isItIn(const SDL_Rect * rect, int x, int y);
 bool isItIn(const SDL_Rect * rect, int x, int y);
 
 
 using namespace NMessage;
 using namespace NMessage;
@@ -91,7 +91,7 @@ void CMessage::dispose()
 SDL_Surface * CMessage::drawBox1(int w, int h, int playerColor)
 SDL_Surface * CMessage::drawBox1(int w, int h, int playerColor)
 {
 {
 	//prepare surface
 	//prepare surface
-	SDL_Surface * ret = SDL_CreateRGBSurface(ekran->flags, w, h, ekran->format->BitsPerPixel, ekran->format->Rmask, ekran->format->Gmask, ekran->format->Bmask, ekran->format->Amask);
+	SDL_Surface * ret = SDL_CreateRGBSurface(screen->flags, w, h, screen->format->BitsPerPixel, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
 	for (int i=0; i<h; i+=background->h)//background
 	for (int i=0; i<h; i+=background->h)//background
 	{
 	{
 		for (int j=0; j<w; j+=background->w-1)
 		for (int j=0; j<w; j+=background->w-1)

+ 38 - 38
CPlayerInterface.cpp

@@ -198,17 +198,17 @@ void CGarrisonSlot::show()
 		if(owner->highlighted==this)
 		if(owner->highlighted==this)
 			blitAt(CGI->creh->bigImgs[-1],pos);
 			blitAt(CGI->creh->bigImgs[-1],pos);
 		if(owner->update)
 		if(owner->update)
-			updateRect(&pos,ekran);
+			updateRect(&pos,screen);
 		delete [] buf;
 		delete [] buf;
 	}
 	}
 	else
 	else
 	{
 	{
 		SDL_Rect jakis1 = genRect(pos.h,pos.w,owner->offx+ID*(pos.w+owner->interx),owner->offy+upg*(pos.h+owner->intery)), jakis2 = pos;
 		SDL_Rect jakis1 = genRect(pos.h,pos.w,owner->offx+ID*(pos.w+owner->interx),owner->offy+upg*(pos.h+owner->intery)), jakis2 = pos;
-		SDL_BlitSurface(owner->sur,&jakis1,ekran,&jakis2);
+		SDL_BlitSurface(owner->sur,&jakis1,screen,&jakis2);
 		if(owner->splitting)
 		if(owner->splitting)
 			blitAt(CGI->creh->bigImgs[-1],pos);
 			blitAt(CGI->creh->bigImgs[-1],pos);
 		if(owner->update)
 		if(owner->update)
-			SDL_UpdateRect(ekran,pos.x,pos.y,pos.w,pos.h);
+			SDL_UpdateRect(screen,pos.x,pos.y,pos.w,pos.h);
 	}
 	}
 }
 }
 CGarrisonInt::~CGarrisonInt()
 CGarrisonInt::~CGarrisonInt()
@@ -479,7 +479,7 @@ void CInfoPopup::close()
 }
 }
 void CInfoPopup::show(SDL_Surface * to)
 void CInfoPopup::show(SDL_Surface * to)
 {
 {
-	blitAt(bitmap,pos.x,pos.y,(to)?(to):(ekran));
+	blitAt(bitmap,pos.x,pos.y,(to)?(to):(screen));
 }
 }
 
 
 SComponent::SComponent(Etype Type, int Subtype, int Val)
 SComponent::SComponent(Etype Type, int Subtype, int Val)
@@ -555,7 +555,7 @@ CSelectableComponent::CSelectableComponent(Etype Type, int Sub, int Val, CSelWin
 :SComponent(Type,Sub,Val),owner(Owner)
 :SComponent(Type,Sub,Val),owner(Owner)
 {
 {
 	SDL_Surface * symb = SComponent::getImg();
 	SDL_Surface * symb = SComponent::getImg();
-	myBitmap = CSDL_Ext::newSurface(symb->w+2,symb->h+2,ekran);
+	myBitmap = CSDL_Ext::newSurface(symb->w+2,symb->h+2,screen);
 	SDL_SetColorKey(myBitmap,SDL_SRCCOLORKEY,SDL_MapRGB(myBitmap->format,0,255,255));	
 	SDL_SetColorKey(myBitmap,SDL_SRCCOLORKEY,SDL_MapRGB(myBitmap->format,0,255,255));	
 	blitAt(symb,1,1,myBitmap);
 	blitAt(symb,1,1,myBitmap);
 	if (Border) //use custom border
 	if (Border) //use custom border
@@ -566,7 +566,7 @@ CSelectableComponent::CSelectableComponent(Etype Type, int Sub, int Val, CSelWin
 	else //we need to draw border
 	else //we need to draw border
 	{
 	{
 		customB = false;
 		customB = false;
-		border = CSDL_Ext::newSurface(symb->w+2,symb->h+2,ekran);
+		border = CSDL_Ext::newSurface(symb->w+2,symb->h+2,screen);
 		SDL_FillRect(border,NULL,0x00FFFF);
 		SDL_FillRect(border,NULL,0x00FFFF);
 		for (int i=0;i<border->w;i++)
 		for (int i=0;i<border->w;i++)
 		{
 		{
@@ -624,7 +624,7 @@ void CSelectableComponent::select(bool on)
 void CSimpleWindow::show(SDL_Surface * to)
 void CSimpleWindow::show(SDL_Surface * to)
 {
 {
 	if(!to)
 	if(!to)
-		to=ekran;
+		to=screen;
 	blitAt(bitmap,pos.x,pos.y,to);
 	blitAt(bitmap,pos.x,pos.y,to);
 }
 }
 CSimpleWindow::~CSimpleWindow()
 CSimpleWindow::~CSimpleWindow()
@@ -753,7 +753,7 @@ CButtonBase::~CButtonBase()
 void CButtonBase::show(SDL_Surface * to)
 void CButtonBase::show(SDL_Surface * to)
 {
 {
 	if(!to)
 	if(!to)
-		to=ekran;
+		to=screen;
 	if (abs)
 	if (abs)
 	{
 	{
 		blitAt(imgs[curimg]
 		blitAt(imgs[curimg]
@@ -1024,8 +1024,8 @@ void CPlayerInterface::yourTurn()
 		}
 		}
 		for(int i=0;i<objsToBlit.size();i++)
 		for(int i=0;i<objsToBlit.size();i++)
 			objsToBlit[i]->show();
 			objsToBlit[i]->show();
-		//SDL_Flip(ekran);
-		CSDL_Ext::update(ekran);
+		//SDL_Flip(screen);
+		CSDL_Ext::update(screen);
 		SDL_Delay(5); //give time for other apps
 		SDL_Delay(5); //give time for other apps
 		SDL_framerateDelay(mainFPSmng);
 		SDL_framerateDelay(mainFPSmng);
 	}
 	}
@@ -1433,7 +1433,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
 			subRect(hp.x, hp.y, hp.z, genRect(32, 32, 65+i, 32), ho->id);
 			subRect(hp.x, hp.y, hp.z, genRect(32, 32, 65+i, 32), ho->id);
 		}
 		}
 		LOCPLINT->adventureInt->update(); //updating screen
 		LOCPLINT->adventureInt->update(); //updating screen
-		CSDL_Ext::update(ekran);
+		CSDL_Ext::update(screen);
 		CGI->screenh->updateScreen();
 		CGI->screenh->updateScreen();
 
 
 		++LOCPLINT->adventureInt->animValHitCount; //for animations
 		++LOCPLINT->adventureInt->animValHitCount; //for animations
@@ -1670,7 +1670,7 @@ void CPlayerInterface::handleMouseMotion(SDL_Event *sEvent)
 	{
 	{
 		LOCPLINT->adventureInt->scrollingLeft = false;
 		LOCPLINT->adventureInt->scrollingLeft = false;
 	}
 	}
-	if(sEvent->motion.x>ekran->w-15)
+	if(sEvent->motion.x>screen->w-15)
 	{
 	{
 		LOCPLINT->adventureInt->scrollingRight = true;
 		LOCPLINT->adventureInt->scrollingRight = true;
 	}
 	}
@@ -1686,7 +1686,7 @@ void CPlayerInterface::handleMouseMotion(SDL_Event *sEvent)
 	{
 	{
 		LOCPLINT->adventureInt->scrollingUp = false;
 		LOCPLINT->adventureInt->scrollingUp = false;
 	}
 	}
-	if(sEvent->motion.y>ekran->h-15)
+	if(sEvent->motion.y>screen->h-15)
 	{
 	{
 		LOCPLINT->adventureInt->scrollingDown = true;
 		LOCPLINT->adventureInt->scrollingDown = true;
 	}
 	}
@@ -2002,8 +2002,8 @@ BattleAction CPlayerInterface::activeStack(int stackID) //called when it's turn
 		if(showCount%2==0)
 		if(showCount%2==0)
 			for(int i=0;i<objsToBlit.size();i++)
 			for(int i=0;i<objsToBlit.size();i++)
 				objsToBlit[i]->show();
 				objsToBlit[i]->show();
-		//SDL_Flip(ekran);
-		CSDL_Ext::update(ekran);
+		//SDL_Flip(screen);
+		CSDL_Ext::update(screen);
 		
 		
 		/*timeHandler th;
 		/*timeHandler th;
 		th.getDif();
 		th.getDif();
@@ -2109,19 +2109,19 @@ void CStatusBar::clear()
 {
 {
 	current="";
 	current="";
 	SDL_Rect pom = genRect(pos.h,pos.w,pos.x,pos.y);
 	SDL_Rect pom = genRect(pos.h,pos.w,pos.x,pos.y);
-	SDL_BlitSurface(bg,&genRect(pos.h,pos.w,0,0),ekran,&pom);
+	SDL_BlitSurface(bg,&genRect(pos.h,pos.w,0,0),screen,&pom);
 }
 }
 void CStatusBar::print(std::string text)
 void CStatusBar::print(std::string text)
 {
 {
 	current=text;
 	current=text;
 	SDL_Rect pom = genRect(pos.h,pos.w,pos.x,pos.y);
 	SDL_Rect pom = genRect(pos.h,pos.w,pos.x,pos.y);
-	SDL_BlitSurface(bg,&genRect(pos.h,pos.w,0,0),ekran,&pom);
+	SDL_BlitSurface(bg,&genRect(pos.h,pos.w,0,0),screen,&pom);
 	printAtMiddle(current,middlex,middley,GEOR13,zwykly);
 	printAtMiddle(current,middlex,middley,GEOR13,zwykly);
 }
 }
 void CStatusBar::show()
 void CStatusBar::show()
 {
 {
 	SDL_Rect pom = genRect(pos.h,pos.w,pos.x,pos.y);
 	SDL_Rect pom = genRect(pos.h,pos.w,pos.x,pos.y);
-	SDL_BlitSurface(bg,&genRect(pos.h,pos.w,0,0),ekran,&pom);
+	SDL_BlitSurface(bg,&genRect(pos.h,pos.w,0,0),screen,&pom);
 	printAtMiddle(current,middlex,middley,GEOR13,zwykly);
 	printAtMiddle(current,middlex,middley,GEOR13,zwykly);
 }
 }
 std::string CStatusBar::getCurrent()
 std::string CStatusBar::getCurrent()
@@ -2179,7 +2179,7 @@ CHeroList::CHeroList(int Size)
 
 
 void CHeroList::init()
 void CHeroList::init()
 {
 {
-	bg = CSDL_Ext::newSurface(68,193,ekran);
+	bg = CSDL_Ext::newSurface(68,193,screen);
 	SDL_BlitSurface(LOCPLINT->adventureInt->bg,&genRect(193,68,607,196),bg,&genRect(193,68,0,0));
 	SDL_BlitSurface(LOCPLINT->adventureInt->bg,&genRect(193,68,607,196),bg,&genRect(193,68,0,0));
 }
 }
 void CHeroList::genList()
 void CHeroList::genList()
@@ -2469,26 +2469,26 @@ void CRecrutationWindow::deactivate()
 void CRecrutationWindow::show(SDL_Surface * to)
 void CRecrutationWindow::show(SDL_Surface * to)
 {
 {
 	static char c=0;
 	static char c=0;
-	blitAt(bitmap,pos.x,pos.y,to?to:ekran);
+	blitAt(bitmap,pos.x,pos.y,to?to:screen);
 	buy->show();
 	buy->show();
 	max->show();
 	max->show();
 	cancel->show();
 	cancel->show();
 	slider->show();
 	slider->show();
 	char pom[15];
 	char pom[15];
 	itoa(creatures[which].amount,pom,10); //available
 	itoa(creatures[which].amount,pom,10); //available
-	printAtMiddle(pom,pos.x+205,pos.y+252,GEOR13,zwykly,ekran);
+	printAtMiddle(pom,pos.x+205,pos.y+252,GEOR13,zwykly,screen);
 	itoa(slider->value,pom,10); //recruit
 	itoa(slider->value,pom,10); //recruit
-	printAtMiddle(pom,pos.x+279,pos.y+252,GEOR13,zwykly,ekran);
-	printAtMiddle(CGI->generaltexth->allTexts[16] + " " + CGI->creh->creatures[creatures[which].ID].namePl,pos.x+243,pos.y+32,GEOR16,tytulowy,ekran); //eg "Recruit Dragon flies"
+	printAtMiddle(pom,pos.x+279,pos.y+252,GEOR13,zwykly,screen);
+	printAtMiddle(CGI->generaltexth->allTexts[16] + " " + CGI->creh->creatures[creatures[which].ID].namePl,pos.x+243,pos.y+32,GEOR16,tytulowy,screen); //eg "Recruit Dragon flies"
 	int curx = pos.x+115-creatures[which].res.size()*16;
 	int curx = pos.x+115-creatures[which].res.size()*16;
 	for(int i=0;i<creatures[which].res.size();i++)
 	for(int i=0;i<creatures[which].res.size();i++)
 	{
 	{
-		blitAt(CGI->townh->resources->ourImages[creatures[which].res[i].first].bitmap,curx,pos.y+243,ekran);
-		blitAt(CGI->townh->resources->ourImages[creatures[which].res[i].first].bitmap,curx+258,pos.y+243,ekran);
+		blitAt(CGI->townh->resources->ourImages[creatures[which].res[i].first].bitmap,curx,pos.y+243,screen);
+		blitAt(CGI->townh->resources->ourImages[creatures[which].res[i].first].bitmap,curx+258,pos.y+243,screen);
 		itoa(creatures[which].res[i].second,pom,10);
 		itoa(creatures[which].res[i].second,pom,10);
-		printAtMiddle(pom,curx+12,pos.y+286,GEOR13,zwykly,ekran);
+		printAtMiddle(pom,curx+12,pos.y+286,GEOR13,zwykly,screen);
 		itoa(creatures[which].res[i].second * slider->value,pom,10);
 		itoa(creatures[which].res[i].second * slider->value,pom,10);
-		printAtMiddle(pom,curx+12+258,pos.y+286,GEOR13,zwykly,ekran);
+		printAtMiddle(pom,curx+12+258,pos.y+286,GEOR13,zwykly,screen);
 		curx+=32;
 		curx+=32;
 	}
 	}
 
 
@@ -2496,7 +2496,7 @@ void CRecrutationWindow::show(SDL_Surface * to)
 	for(int i=0;i<creatures.size();i++)
 	for(int i=0;i<creatures.size();i++)
 	{
 	{
 		blitAt(CGI->creh->backgrounds[CGI->creh->creatures[creatures[i].ID].faction],curx-50,pos.y+130-65);
 		blitAt(CGI->creh->backgrounds[CGI->creh->creatures[creatures[i].ID].faction],curx-50,pos.y+130-65);
-		creatures[i].anim->nextFrameMiddle(ekran,curx+20,pos.y+110,true,!(c%2),false);
+		creatures[i].anim->nextFrameMiddle(screen,curx+20,pos.y+110,true,!(c%2),false);
 		curx += 120;
 		curx += 120;
 	}
 	}
 	c++;
 	c++;
@@ -2517,11 +2517,11 @@ CRecrutationWindow::CRecrutationWindow(std::vector<std::pair<int,int> > &Creatur
 	}
 	}
 	SDL_Surface *hhlp = CGI->bitmaph->loadBitmap("TPRCRT.bmp");
 	SDL_Surface *hhlp = CGI->bitmaph->loadBitmap("TPRCRT.bmp");
 	blueToPlayersAdv(hhlp,LOCPLINT->playerID);
 	blueToPlayersAdv(hhlp,LOCPLINT->playerID);
-	bitmap = SDL_ConvertSurface(hhlp,ekran->format,0); //na 8bitowej mapie by sie psulo
+	bitmap = SDL_ConvertSurface(hhlp,screen->format,0); //na 8bitowej mapie by sie psulo
 	SDL_SetColorKey(bitmap,SDL_SRCCOLORKEY,SDL_MapRGB(bitmap->format,0,255,255));
 	SDL_SetColorKey(bitmap,SDL_SRCCOLORKEY,SDL_MapRGB(bitmap->format,0,255,255));
 	SDL_FreeSurface(hhlp);
 	SDL_FreeSurface(hhlp);
-	pos.x = ekran->w/2 - bitmap->w/2;
-	pos.y = ekran->h/2 - bitmap->h/2;
+	pos.x = screen->w/2 - bitmap->w/2;
+	pos.y = screen->h/2 - bitmap->h/2;
 	pos.w = bitmap->w;
 	pos.w = bitmap->w;
 	pos.h = bitmap->h;
 	pos.h = bitmap->h;
 	slider = new CSlider<CRecrutationWindow>(pos.x+176,pos.y+279,135,this,&CRecrutationWindow::sliderMoved,1,creatures[0].amount,0,true);
 	slider = new CSlider<CRecrutationWindow>(pos.x+176,pos.y+279,135,this,&CRecrutationWindow::sliderMoved,1,creatures[0].amount,0,true);
@@ -2572,8 +2572,8 @@ CSplitWindow::CSplitWindow(int cid, int max, CGarrisonInt *Owner)
 	slider = NULL;
 	slider = NULL;
 	gar = Owner;
 	gar = Owner;
 	bitmap = CGI->bitmaph->loadBitmap("GPUCRDIV.bmp");
 	bitmap = CGI->bitmaph->loadBitmap("GPUCRDIV.bmp");
-	pos.x = ekran->w/2 - bitmap->w/2;
-	pos.y = ekran->h/2 - bitmap->h/2;
+	pos.x = screen->w/2 - bitmap->w/2;
+	pos.y = screen->h/2 - bitmap->h/2;
 	pos.w = bitmap->w;
 	pos.w = bitmap->w;
 	pos.h = bitmap->h;
 	pos.h = bitmap->h;
 	ok = new AdventureMapButton<CSplitWindow>("","",&CSplitWindow::split,pos.x+20,pos.y+263,"IOK6432.DEF",this);
 	ok = new AdventureMapButton<CSplitWindow>("","",&CSplitWindow::split,pos.x+20,pos.y+263,"IOK6432.DEF",this);
@@ -2631,21 +2631,21 @@ void CSplitWindow::sliderMoved(int to)
 void CSplitWindow::show(SDL_Surface * to)
 void CSplitWindow::show(SDL_Surface * to)
 {
 {
 	char pom[15];
 	char pom[15];
-	blitAt(bitmap,pos.x,pos.y,ekran);
+	blitAt(bitmap,pos.x,pos.y,screen);
 	ok->show();
 	ok->show();
 	cancel->show();
 	cancel->show();
 	slider->show();
 	slider->show();
 	itoa(a1,pom,10);
 	itoa(a1,pom,10);
-	printAtMiddle(pom,pos.x+70,pos.y+237,GEOR16,zwykly,ekran);
+	printAtMiddle(pom,pos.x+70,pos.y+237,GEOR16,zwykly,screen);
 	itoa(a2,pom,10);
 	itoa(a2,pom,10);
-	printAtMiddle(pom,pos.x+233,pos.y+237,GEOR16,zwykly,ekran);
+	printAtMiddle(pom,pos.x+233,pos.y+237,GEOR16,zwykly,screen);
 
 
 
 
 	blitAt(CGI->creh->backgrounds[CGI->creh->creatures[c].faction],pos.x+20,pos.y+54);
 	blitAt(CGI->creh->backgrounds[CGI->creh->creatures[c].faction],pos.x+20,pos.y+54);
-	anim->nextFrameMiddle(ekran,pos.x+20+70,pos.y+54+55,true,false,false);
+	anim->nextFrameMiddle(screen,pos.x+20+70,pos.y+54+55,true,false,false);
 
 
 	blitAt(CGI->creh->backgrounds[CGI->creh->creatures[c].faction],pos.x+177,pos.y+54);
 	blitAt(CGI->creh->backgrounds[CGI->creh->creatures[c].faction],pos.x+177,pos.y+54);
-	anim->nextFrameMiddle(ekran,pos.x+177+70,pos.y+54+55,true,false,false);
+	anim->nextFrameMiddle(screen,pos.x+177+70,pos.y+54+55,true,false,false);
 }
 }
 void CSplitWindow::keyPressed (SDL_KeyboardEvent & key)
 void CSplitWindow::keyPressed (SDL_KeyboardEvent & key)
 {
 {

BIN
CPreGame.cpp


+ 12 - 12
SDL_Extensions.h

@@ -4,14 +4,14 @@
 #include "SDL_ttf.h"
 #include "SDL_ttf.h"
 
 
 
 
-extern SDL_Surface * ekran;
+extern SDL_Surface * screen;
 extern SDL_Color tytulowy, tlo, zwykly ;
 extern SDL_Color tytulowy, tlo, zwykly ;
 extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;
 extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX, *GEORM;
-void blitAtWR(SDL_Surface * src, int x, int y, SDL_Surface * dst=ekran);
-void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst=ekran);
-void blitAtWR(SDL_Surface * src, SDL_Rect pos, SDL_Surface * dst=ekran);
-void blitAt(SDL_Surface * src, SDL_Rect pos, SDL_Surface * dst=ekran);
-void updateRect (SDL_Rect * rect, SDL_Surface * scr = ekran);
+void blitAtWR(SDL_Surface * src, int x, int y, SDL_Surface * dst=screen);
+void blitAt(SDL_Surface * src, int x, int y, SDL_Surface * dst=screen);
+void blitAtWR(SDL_Surface * src, SDL_Rect pos, SDL_Surface * dst=screen);
+void blitAt(SDL_Surface * src, SDL_Rect pos, SDL_Surface * dst=screen);
+void updateRect (SDL_Rect * rect, SDL_Surface * scr = screen);
 bool isItIn(const SDL_Rect * rect, int x, int y);
 bool isItIn(const SDL_Rect * rect, int x, int y);
 template <typename T> int getIndexOf(const std::vector<T> & v, const T & val)
 template <typename T> int getIndexOf(const std::vector<T> & v, const T & val)
 {
 {
@@ -38,11 +38,11 @@ namespace CSDL_Ext
 	int blit8bppAlphaTo24bpp(SDL_Surface * src, SDL_Rect * srcRect, SDL_Surface * dst, SDL_Rect * dstRect); //blits 8 bpp surface with alpha channel to 24 bpp surface
 	int blit8bppAlphaTo24bpp(SDL_Surface * src, SDL_Rect * srcRect, SDL_Surface * dst, SDL_Rect * dstRect); //blits 8 bpp surface with alpha channel to 24 bpp surface
 	//void fullAlphaTransform(SDL_Surface *& src); //performs first and second alpha transform
 	//void fullAlphaTransform(SDL_Surface *& src); //performs first and second alpha transform
 	Uint32 colorToUint32(const SDL_Color * color); //little endian only
 	Uint32 colorToUint32(const SDL_Color * color); //little endian only
-	void printTo(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2);// quality: 0 - lowest, 1 - medium, 2 - highest; prints at right bottom corner of specific area. position of corner indicated by (x, y)
-	void printAtMiddle(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest
-	void printAtMiddleWB(std::string text, int x, int y, TTF_Font * font, int charpr, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran);
-	void printAt(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest
-	void update(SDL_Surface * what = ekran); //updates whole surface (default - main screen)
+	void printTo(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=screen, unsigned char quality = 2);// quality: 0 - lowest, 1 - medium, 2 - highest; prints at right bottom corner of specific area. position of corner indicated by (x, y)
+	void printAtMiddle(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=screen, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest
+	void printAtMiddleWB(std::string text, int x, int y, TTF_Font * font, int charpr, SDL_Color kolor=tytulowy, SDL_Surface * dst=screen);
+	void printAt(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=screen, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest
+	void update(SDL_Surface * what = screen); //updates whole surface (default - main screen)
 	void blueToPlayers(SDL_Surface * sur, int player); //simple color substitution
 	void blueToPlayers(SDL_Surface * sur, int player); //simple color substitution
 	void blueToPlayersAdv(SDL_Surface * sur, int player, int mode=0, void* additionalInfo=NULL); //substitute blue color by another one, makes it nicer keeping nuances
 	void blueToPlayersAdv(SDL_Surface * sur, int player, int mode=0, void* additionalInfo=NULL); //substitute blue color by another one, makes it nicer keeping nuances
 																							//mode 1 is calibrated for hero infobox
 																							//mode 1 is calibrated for hero infobox
@@ -50,7 +50,7 @@ namespace CSDL_Ext
 	void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, int3 color);
 	void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, int3 color);
 	void setPlayerColor(SDL_Surface * sur, unsigned char player); //sets correct color of flags; -1 for neutral
 	void setPlayerColor(SDL_Surface * sur, unsigned char player); //sets correct color of flags; -1 for neutral
 	std::string processStr(std::string str, std::vector<std::string> & tor); //replaces %s in string
 	std::string processStr(std::string str, std::vector<std::string> & tor); //replaces %s in string
-	SDL_Surface * newSurface(int w, int h, SDL_Surface * mod=ekran); //creates new surface, with flags/format same as in surface given
+	SDL_Surface * newSurface(int w, int h, SDL_Surface * mod=screen); //creates new surface, with flags/format same as in surface given
 	SDL_Surface * copySurface(SDL_Surface * mod); //returns copy of given surface
 	SDL_Surface * copySurface(SDL_Surface * mod); //returns copy of given surface
 };
 };
 
 

+ 1 - 1
hch/CSemiDefHandler.cpp

@@ -1,7 +1,7 @@
 #include "../stdafx.h"
 #include "../stdafx.h"
 #include "CSemiDefHandler.h"
 #include "CSemiDefHandler.h"
 #include <fstream>
 #include <fstream>
-extern SDL_Surface * ekran;
+extern SDL_Surface * screen;
 std::string CSemiDefHandler::nameFromType (EterrainType typ)
 std::string CSemiDefHandler::nameFromType (EterrainType typ)
 {
 {
 	switch(typ)
 	switch(typ)

+ 1 - 1
mapHandler.cpp

@@ -15,7 +15,7 @@
 #include "hch\CTownHandler.h"
 #include "hch\CTownHandler.h"
 #include <iomanip>
 #include <iomanip>
 #include <sstream>
 #include <sstream>
-extern SDL_Surface * ekran;
+extern SDL_Surface * screen;
 
 
 class OCM_HLP
 class OCM_HLP
 {
 {