smallmap_gui.c
changeset 2062 00f7d339fdcb
parent 2049 ad0d49c916d4
child 2159 3b634157c3b2
equal deleted inserted replaced
2061:f67a12c65223 2062:00f7d339fdcb
   188 	_legend_industries_desert,
   188 	_legend_industries_desert,
   189 	_legend_industries_candy,
   189 	_legend_industries_candy,
   190 };
   190 };
   191 
   191 
   192 #if defined(TTD_ALIGNMENT_4)
   192 #if defined(TTD_ALIGNMENT_4)
   193 	static inline void WRITE_PIXELS(void *dst, uint32 val)
   193 	static inline void WRITE_PIXELS(Pixel* d, uint32 val)
   194 	{
   194 	{
   195 		byte *d = (byte*)dst;
       
   196 #	if defined(TTD_BIG_ENDIAN)
   195 #	if defined(TTD_BIG_ENDIAN)
   197 		d[0] = (byte)(val >> 24);
   196 		d[0] = (byte)(val >> 24);
   198 		d[1] = (byte)(val >> 16);
   197 		d[1] = (byte)(val >> 16);
   199 		d[2] = (byte)(val >> 8);
   198 		d[2] = (byte)(val >> 8);
   200 		d[3] = (byte)(val >> 0);
   199 		d[3] = (byte)(val >> 0);
   205 		d[3] = (byte)(val >> 24);
   204 		d[3] = (byte)(val >> 24);
   206 #	endif
   205 #	endif
   207 	}
   206 	}
   208 
   207 
   209 /* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */
   208 /* need to use OR, otherwise we will overwrite the wrong pixels at the edges :( */
   210 	static inline void WRITE_PIXELS_OR(void *dst, uint32 val)
   209 	static inline void WRITE_PIXELS_OR(Pixel* d, uint32 val)
   211 	{
   210 	{
   212 		byte *d = (byte*)dst;
       
   213 #	if defined(TTD_BIG_ENDIAN)
   211 #	if defined(TTD_BIG_ENDIAN)
   214 		d[0] |= (byte)(val >> 24);
   212 		d[0] |= (byte)(val >> 24);
   215 		d[1] |= (byte)(val >> 16);
   213 		d[1] |= (byte)(val >> 16);
   216 		d[2] |= (byte)(val >> 8);
   214 		d[2] |= (byte)(val >> 8);
   217 		d[3] |= (byte)(val >> 0);
   215 		d[3] |= (byte)(val >> 0);
   322  * @param reps Number of lines to draw
   320  * @param reps Number of lines to draw
   323  * @param mask ?
   321  * @param mask ?
   324  * @param proc Pointer to the colour function
   322  * @param proc Pointer to the colour function
   325  * @see GetSmallMapPixels(TileIndex)
   323  * @see GetSmallMapPixels(TileIndex)
   326  */
   324  */
   327 static void DrawSmallMapStuff(byte *dst, uint xc, uint yc, int pitch, int reps, uint32 mask, GetSmallMapPixels *proc)
   325 static void DrawSmallMapStuff(Pixel *dst, uint xc, uint yc, int pitch, int reps, uint32 mask, GetSmallMapPixels *proc)
   328 {
   326 {
   329 	byte *dst_ptr_end = _screen.dst_ptr + _screen.width * _screen.height - _screen.width;
   327 	Pixel *dst_ptr_end = _screen.dst_ptr + _screen.width * _screen.height - _screen.width;
   330 
   328 
   331 	do {
   329 	do {
   332 		// check if the tile (xc,yc) is within the map range
   330 		// check if the tile (xc,yc) is within the map range
   333 		if (xc < MapMaxX() && yc < MapMaxY()) {
   331 		if (xc < MapMaxX() && yc < MapMaxY()) {
   334 			// check if the dst pointer points to a pixel inside the screen buffer
   332 			// check if the dst pointer points to a pixel inside the screen buffer
   587  */
   585  */
   588 static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_towns)
   586 static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_towns)
   589 {
   587 {
   590 	DrawPixelInfo *old_dpi;
   588 	DrawPixelInfo *old_dpi;
   591 	int dx,dy, x, y, x2, y2;
   589 	int dx,dy, x, y, x2, y2;
   592 	byte *ptr;
   590 	Pixel *ptr;
   593 	int tile_x;
   591 	int tile_x;
   594 	int tile_y;
   592 	int tile_y;
   595 	ViewPort *vp;
   593 	ViewPort *vp;
   596 
   594 
   597 	old_dpi = _cur_dpi;
   595 	old_dpi = _cur_dpi;