smallmap_gui.c
changeset 500 8e52f7797b48
parent 337 cbe0c766c947
child 507 04b5403aaf6b
equal deleted inserted replaced
499:b224c29812bc 500:8e52f7797b48
   219 	_legend_industries_desert,
   219 	_legend_industries_desert,
   220 	_legend_industries_candy,
   220 	_legend_industries_candy,
   221 };
   221 };
   222 
   222 
   223 #if defined(TTD_ALIGNMENT_4)
   223 #if defined(TTD_ALIGNMENT_4)
   224 	static INLINE void WRITE_PIXELS(void *dst, uint32 val)
   224 	static inline void WRITE_PIXELS(void *dst, uint32 val)
   225 	{
   225 	{
   226 		byte *d = (byte*)dst;
   226 		byte *d = (byte*)dst;
   227 #	if defined(TTD_BIG_ENDIAN)
   227 #	if defined(TTD_BIG_ENDIAN)
   228 		d[0] = (byte)(val >> 24);
   228 		d[0] = (byte)(val >> 24);
   229 		d[1] = (byte)(val >> 16);
   229 		d[1] = (byte)(val >> 16);
   236 		d[3] = (byte)(val >> 24);
   236 		d[3] = (byte)(val >> 24);
   237 #	endif
   237 #	endif
   238 	}
   238 	}
   239 
   239 
   240 /* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */
   240 /* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */
   241 	static INLINE void WRITE_PIXELS_OR(void *dst, uint32 val)
   241 	static inline void WRITE_PIXELS_OR(void *dst, uint32 val)
   242 	{
   242 	{
   243 		byte *d = (byte*)dst;
   243 		byte *d = (byte*)dst;
   244 #	if defined(TTD_BIG_ENDIAN)
   244 #	if defined(TTD_BIG_ENDIAN)
   245 		d[0] |= (byte)(val >> 24);
   245 		d[0] |= (byte)(val >> 24);
   246 		d[1] |= (byte)(val >> 16);
   246 		d[1] |= (byte)(val >> 16);
   326 	{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)},
   326 	{MKCOLOR(0x00000000),MKCOLOR(0xFFFFFFFF)},
   327 	{MKCOLOR(0x00B5B500),MKCOLOR(0xFF0000FF)},
   327 	{MKCOLOR(0x00B5B500),MKCOLOR(0xFF0000FF)},
   328 	{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)},
   328 	{MKCOLOR(0x00D7D700),MKCOLOR(0xFF0000FF)},
   329 };
   329 };
   330 
   330 
   331 static uint32 INLINE GetSmallMapCountoursPixels(uint tile)
   331 static inline uint32 GetSmallMapCountoursPixels(uint tile)
   332 {
   332 {
   333 	uint t;
   333 	uint t;
   334 
   334 
   335 	t = GET_TILETYPE(tile);
   335 	t = GET_TILETYPE(tile);
   336 	if (t == MP_TUNNELBRIDGE) {
   336 	if (t == MP_TUNNELBRIDGE) {
   356 		        WRITE_PIXELS_OR( dst, GetSmallMapCountoursPixels(TILE_XY(xc,yc)) & mask );
   356 		        WRITE_PIXELS_OR( dst, GetSmallMapCountoursPixels(TILE_XY(xc,yc)) & mask );
   357 	} while (xc++,yc++,dst+=pitch,--reps != 0);
   357 	} while (xc++,yc++,dst+=pitch,--reps != 0);
   358 }
   358 }
   359 
   359 
   360 
   360 
   361 static uint32 INLINE GetSmallMapVehiclesPixels(uint tile)
   361 static inline uint32 GetSmallMapVehiclesPixels(uint tile)
   362 {
   362 {
   363 	uint t;
   363 	uint t;
   364 
   364 
   365 	t = GET_TILETYPE(tile);
   365 	t = GET_TILETYPE(tile);
   366 	if (t == MP_TUNNELBRIDGE) {
   366 	if (t == MP_TUNNELBRIDGE) {
   409 	 37, 37, 37, 37,184,184,184,184,
   409 	 37, 37, 37, 37,184,184,184,184,
   410 	152,152,152,152,194,194,194, 15,
   410 	152,152,152,152,194,194,194, 15,
   411 	 15, 15, 15, 15, 15, 15, 15,
   411 	 15, 15, 15, 15, 15, 15, 15,
   412 };
   412 };
   413 
   413 
   414 static uint32 INLINE GetSmallMapIndustriesPixels(uint tile)
   414 static inline uint32 GetSmallMapIndustriesPixels(uint tile)
   415 {
   415 {
   416 	int t;
   416 	int t;
   417 
   417 
   418 	t = GET_TILETYPE(tile);
   418 	t = GET_TILETYPE(tile);
   419 	if (t == MP_INDUSTRY) {
   419 	if (t == MP_INDUSTRY) {
   441 		if (xc < TILE_X_MAX && yc < TILE_Y_MAX)
   441 		if (xc < TILE_X_MAX && yc < TILE_Y_MAX)
   442 			WRITE_PIXELS_OR(dst, GetSmallMapIndustriesPixels(TILE_XY(xc,yc)) & mask);
   442 			WRITE_PIXELS_OR(dst, GetSmallMapIndustriesPixels(TILE_XY(xc,yc)) & mask);
   443 	} while (xc++,yc++,dst+=pitch,--reps != 0);
   443 	} while (xc++,yc++,dst+=pitch,--reps != 0);
   444 }
   444 }
   445 
   445 
   446 static uint32 INLINE GetSmallMapRoutesPixels(uint tile)
   446 static inline uint32 GetSmallMapRoutesPixels(uint tile)
   447 {
   447 {
   448 	int t;
   448 	int t;
   449 	uint32 bits;
   449 	uint32 bits;
   450 
   450 
   451 	t = GET_TILETYPE(tile);
   451 	t = GET_TILETYPE(tile);
   497 	MKCOLOR(0xC2C2C2C2),
   497 	MKCOLOR(0xC2C2C2C2),
   498 	MKCOLOR(0x54545454),
   498 	MKCOLOR(0x54545454),
   499 	MKCOLOR(0x54545454),
   499 	MKCOLOR(0x54545454),
   500 };
   500 };
   501 
   501 
   502 static uint32 INLINE GetSmallMapVegetationPixels(uint tile)
   502 static inline uint32 GetSmallMapVegetationPixels(uint tile)
   503 {
   503 {
   504 	int i,t;
   504 	int i,t;
   505 	uint32 bits;
   505 	uint32 bits;
   506 
   506 
   507 	t = GET_TILETYPE(tile);
   507 	t = GET_TILETYPE(tile);
   543 }
   543 }
   544 
   544 
   545 
   545 
   546 static uint32 *_owner_colors;
   546 static uint32 *_owner_colors;
   547 
   547 
   548 static uint32 INLINE GetSmallMapOwnerPixels(uint tile)
   548 static inline uint32 GetSmallMapOwnerPixels(uint tile)
   549 {
   549 {
   550 	int t;
   550 	int t;
   551 
   551 
   552 	t = GET_TILETYPE(tile);
   552 	t = GET_TILETYPE(tile);
   553 	if (t == MP_HOUSE || _map_owner[tile] == OWNER_TOWN) {
   553 	if (t == MP_HOUSE || _map_owner[tile] == OWNER_TOWN) {
   599 
   599 
   600 static const byte _vehicle_type_colors[6] = {
   600 static const byte _vehicle_type_colors[6] = {
   601 	184, 191, 152, 15, 215, 184
   601 	184, 191, 152, 15, 215, 184
   602 };
   602 };
   603 
   603 
   604 static INLINE uint32 dup_byte32(byte b) {
   604 static inline uint32 dup_byte32(byte b) {
   605 	return b + (b << 8) + (b << 16) + (b << 24);
   605 	return b + (b << 8) + (b << 16) + (b << 24);
   606 }
   606 }
   607 
   607 
   608 static void DrawVertMapIndicator(int x, int y, int x2, int y2)
   608 static void DrawVertMapIndicator(int x, int y, int x2, int y2)
   609 {
   609 {