src/viewport.cpp
changeset 10056 48659f7d4fa5
parent 10055 b3bf982d7879
child 10196 889b923bbb96
equal deleted inserted replaced
10055:b3bf982d7879 10056:48659f7d4fa5
   565  * @param sub Only draw a part of the sprite.
   565  * @param sub Only draw a part of the sprite.
   566  */
   566  */
   567 static void AddCombinedSprite(SpriteID image, SpriteID pal, int x, int y, byte z, const SubSprite *sub)
   567 static void AddCombinedSprite(SpriteID image, SpriteID pal, int x, int y, byte z, const SubSprite *sub)
   568 {
   568 {
   569 	Point pt = RemapCoords(x, y, z);
   569 	Point pt = RemapCoords(x, y, z);
   570 	const Sprite* spr = GetSprite(image & SPRITE_MASK);
   570 	const Sprite* spr = GetSprite(image & SPRITE_MASK, ST_NORMAL);
   571 
   571 
   572 	if (pt.x + spr->x_offs >= _vd.dpi.left + _vd.dpi.width ||
   572 	if (pt.x + spr->x_offs >= _vd.dpi.left + _vd.dpi.width ||
   573 			pt.x + spr->x_offs + spr->width <= _vd.dpi.left ||
   573 			pt.x + spr->x_offs + spr->width <= _vd.dpi.left ||
   574 			pt.y + spr->y_offs >= _vd.dpi.top + _vd.dpi.height ||
   574 			pt.y + spr->y_offs >= _vd.dpi.top + _vd.dpi.height ||
   575 			pt.y + spr->y_offs + spr->height <= _vd.dpi.top)
   575 			pt.y + spr->y_offs + spr->height <= _vd.dpi.top)
   630 		left = tmp_left = RemapCoords(x + w          , y + bb_offset_y, z + bb_offset_z).x;
   630 		left = tmp_left = RemapCoords(x + w          , y + bb_offset_y, z + bb_offset_z).x;
   631 		right           = RemapCoords(x + bb_offset_x, y + h          , z + bb_offset_z).x + 1;
   631 		right           = RemapCoords(x + bb_offset_x, y + h          , z + bb_offset_z).x + 1;
   632 		top  = tmp_top  = RemapCoords(x + bb_offset_x, y + bb_offset_y, z + dz         ).y;
   632 		top  = tmp_top  = RemapCoords(x + bb_offset_x, y + bb_offset_y, z + dz         ).y;
   633 		bottom          = RemapCoords(x + w          , y + h          , z + bb_offset_z).y + 1;
   633 		bottom          = RemapCoords(x + w          , y + h          , z + bb_offset_z).y + 1;
   634 	} else {
   634 	} else {
   635 		const Sprite *spr = GetSprite(image & SPRITE_MASK);
   635 		const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL);
   636 		left = tmp_left = (pt.x += spr->x_offs);
   636 		left = tmp_left = (pt.x += spr->x_offs);
   637 		right           = (pt.x +  spr->width );
   637 		right           = (pt.x +  spr->width );
   638 		top  = tmp_top  = (pt.y += spr->y_offs);
   638 		top  = tmp_top  = (pt.y += spr->y_offs);
   639 		bottom          = (pt.y +  spr->height);
   639 		bottom          = (pt.y +  spr->height);
   640 	}
   640 	}