mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	| @@ -117,6 +117,7 @@ void AdventureMapButton::deactivate() | ||||
| 	if (!active) return; | ||||
| 	active=false; | ||||
| 	ClickableL::deactivate(); | ||||
| 	ClickableR::deactivate(); | ||||
| 	Hoverable::deactivate(); | ||||
| 	KeyInterested::deactivate(); | ||||
| } | ||||
| @@ -572,6 +573,35 @@ CMinimap::CMinimap(bool draw) | ||||
| 	pos.x=630; | ||||
| 	pos.y=26; | ||||
| 	pos.h=pos.w=144; | ||||
|  | ||||
| 	int rx = (((float)19)/(CGI->mh->sizes.x))*((float)pos.w), | ||||
| 		ry = (((float)18)/(CGI->mh->sizes.y))*((float)pos.h); | ||||
|  | ||||
| 	radar = newSurface(rx,ry); | ||||
| 	temps = newSurface(144,144); | ||||
| 	SDL_FillRect(radar,NULL,0x00FFFF); | ||||
| 	SDL_SaveBMP(radar,"radar1.bmp"); | ||||
| 	for (int i=0; i<radar->w; i++) | ||||
| 	{ | ||||
| 		if (i%3) | ||||
| 		{ | ||||
| 			SDL_PutPixel(radar,i,0,255,75,125); | ||||
| 			SDL_PutPixel(radar,i,radar->h-1,255,75,125); | ||||
| 		} | ||||
| 	} | ||||
| 	for (int i=0; i<radar->h; i++) | ||||
| 	{ | ||||
| 		if ((i%4) || (i==0)) | ||||
| 		{ | ||||
| 			SDL_PutPixel(radar,0,i,255,75,125); | ||||
| 			SDL_PutPixel(radar,radar->w-1,i,255,75,125); | ||||
| 		} | ||||
| 	} | ||||
| 	SDL_SaveBMP(radar,"radar2.bmp"); | ||||
| 	SDL_SetColorKey(radar,SDL_SRCCOLORKEY,SDL_MapRGB(radar->format,0,255,255)); | ||||
| 	SDL_SaveBMP(radar,"radar3.bmp"); | ||||
| 	 | ||||
|  | ||||
| 	//radar = CGI->spriteh->giveDef("RADAR.DEF"); | ||||
| 	std::ifstream is("config/minimap.txt",std::ifstream::in); | ||||
| 	for (int i=0;i<TERRAIN_TYPES;i++) | ||||
| @@ -604,7 +634,7 @@ CMinimap::CMinimap(bool draw) | ||||
| void CMinimap::draw() | ||||
| { | ||||
| 	//draw terrain | ||||
| 	blitAtWR(map[LOCPLINT->adventureInt->position.z],pos.x,pos.y); | ||||
| 	blitAt(map[LOCPLINT->adventureInt->position.z],0,0,temps); | ||||
|  | ||||
| 	//draw heroes | ||||
| 	std::vector <const CHeroInstance *> * hh = LOCPLINT->cb->getHeroesInfo(false); | ||||
| @@ -619,7 +649,7 @@ void CMinimap::draw() | ||||
| 		{ | ||||
| 			for (int jj=0; jj<ho; jj++) | ||||
| 			{ | ||||
| 				SDL_PutPixel(ekran,maplgp.x+pos.x+ii,maplgp.y+pos.y+jj,CGI->playerColors[(*hh)[i]->owner].r,CGI->playerColors[(*hh)[i]->owner].g,CGI->playerColors[(*hh)[i]->owner].b); | ||||
| 				SDL_PutPixel(temps,maplgp.x+ii,maplgp.y+jj,CGI->playerColors[(*hh)[i]->owner].r,CGI->playerColors[(*hh)[i]->owner].g,CGI->playerColors[(*hh)[i]->owner].b); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| @@ -642,13 +672,18 @@ void CMinimap::draw() | ||||
| 					for (int jj=0; jj<ho; jj++) | ||||
| 					{ | ||||
| 						if ((i+ii<pos.w-1) && (j+jj<pos.h-1)) | ||||
| 							SDL_PutPixel(ekran,i+pos.x+ii,j+pos.y+jj,0,0,0); | ||||
| 							SDL_PutPixel(temps,i+ii,j+jj,0,0,0); | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	 | ||||
| 	//draw radar | ||||
| 	int bx = (((float)LOCPLINT->adventureInt->position.x)/(((float)CGI->mh->sizes.x)))*pos.w,  | ||||
| 		by = (((float)LOCPLINT->adventureInt->position.y)/(((float)CGI->mh->sizes.y)))*pos.h; | ||||
| 	blitAt(radar,bx,by,temps); | ||||
| 	blitAt(temps,pos.x,pos.y); | ||||
| } | ||||
| void CMinimap::redraw(int level)// (level==-1) => redraw all levels | ||||
| { | ||||
| @@ -1312,6 +1347,7 @@ void CAdvMapInt::centerOn(int3 on) | ||||
| 	LOCPLINT->adventureInt->position.y=on.y; | ||||
| 	LOCPLINT->adventureInt->position.z=on.z; | ||||
| 	LOCPLINT->adventureInt->updateScreen=true; | ||||
| 	updateMinimap=true; | ||||
| } | ||||
| CAdvMapInt::CurrentSelection::CurrentSelection() | ||||
| { | ||||
|   | ||||
| @@ -124,7 +124,8 @@ class CMinimap | ||||
| 	: public ClickableL, public ClickableR, public Hoverable, public MotionInterested, public virtual CIntObject | ||||
| { | ||||
| public: | ||||
| 	CDefHandler * radar; //radar.def; TODO: radars for maps with custom dimensions | ||||
| 	SDL_Surface * radar; //radar.def; TODO: radars for maps with custom dimensions | ||||
| 	SDL_Surface * temps; | ||||
| 	std::map<int,SDL_Color> colors; | ||||
| 	std::map<int,SDL_Color> colorsBlocked; | ||||
| 	std::vector<SDL_Surface *> map; //one bitmap for each level | ||||
| @@ -205,7 +206,7 @@ public: | ||||
| 	bool scrollingRight ; | ||||
| 	bool scrollingUp ; | ||||
| 	bool scrollingDown ; | ||||
| 	bool updateScreen ; | ||||
| 	bool updateScreen, updateMinimap ; | ||||
| 	unsigned char anim, animValHitCount; //animation frame | ||||
|  | ||||
| 	CMinimap minimap; | ||||
|   | ||||
| @@ -193,18 +193,23 @@ int CCallback::getDate(int mode) | ||||
| 	{ | ||||
| 	case 0: | ||||
| 		return gs->day; | ||||
| 		break; | ||||
| 	case 1: | ||||
| 		temp = (gs->day)%7; | ||||
| 		if (temp) | ||||
| 			return temp; | ||||
| 		else return 7; | ||||
| 		break; | ||||
| 	case 2: | ||||
| 		temp = ((gs->day-1)/7)+1; | ||||
| 		if (temp%4) | ||||
| 			return temp; | ||||
| 		else return 4; | ||||
| 		if (!(temp%4)) | ||||
| 			return 4; | ||||
| 		else  | ||||
| 			return (temp%4); | ||||
| 		break; | ||||
| 	case 3: | ||||
| 		return ((gs->day-1)/28)+1; | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
| bool CCallback::verifyPath(CPath * path, bool blockSea) | ||||
|   | ||||
| @@ -217,6 +217,7 @@ void CPlayerInterface::yourTurn() | ||||
| 			{ | ||||
| 				LOCPLINT->adventureInt->position.x--; | ||||
| 				LOCPLINT->adventureInt->updateScreen = true; | ||||
| 				adventureInt->updateMinimap=true; | ||||
| 			} | ||||
| 		} | ||||
| 		if(LOCPLINT->adventureInt->scrollingRight) | ||||
| @@ -225,6 +226,7 @@ void CPlayerInterface::yourTurn() | ||||
| 			{ | ||||
| 				LOCPLINT->adventureInt->position.x++; | ||||
| 				LOCPLINT->adventureInt->updateScreen = true; | ||||
| 				adventureInt->updateMinimap=true; | ||||
| 			} | ||||
| 		} | ||||
| 		if(LOCPLINT->adventureInt->scrollingUp) | ||||
| @@ -233,6 +235,7 @@ void CPlayerInterface::yourTurn() | ||||
| 			{ | ||||
| 				LOCPLINT->adventureInt->position.y--; | ||||
| 				LOCPLINT->adventureInt->updateScreen = true; | ||||
| 				adventureInt->updateMinimap=true; | ||||
| 			} | ||||
| 		} | ||||
| 		if(LOCPLINT->adventureInt->scrollingDown) | ||||
| @@ -241,12 +244,18 @@ void CPlayerInterface::yourTurn() | ||||
| 			{ | ||||
| 				LOCPLINT->adventureInt->position.y++; | ||||
| 				LOCPLINT->adventureInt->updateScreen = true; | ||||
| 				adventureInt->updateMinimap=true; | ||||
| 			} | ||||
| 		} | ||||
| 		if(LOCPLINT->adventureInt->updateScreen) | ||||
| 		{ | ||||
| 			adventureInt->update(); | ||||
| 			LOCPLINT->adventureInt->updateScreen=false; | ||||
| 			adventureInt->updateScreen=false; | ||||
| 		} | ||||
| 		if (LOCPLINT->adventureInt->updateMinimap) | ||||
| 		{ | ||||
| 			adventureInt->minimap.draw(); | ||||
| 			adventureInt->updateMinimap=false; | ||||
| 		} | ||||
| 		for(int i=0;i<objsToBlit.size();i++) | ||||
| 			blitAt(objsToBlit[i]->bitmap,objsToBlit[i]->pos.x,objsToBlit[i]->pos.y); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user