File diff r7332:5ef3101b123d → r7333:94b25d4d956c
src/viewport.cpp
Show inline comments
 
@@ -469,34 +469,50 @@ static void AddCombinedSprite(SpriteID i
 
	Point pt = RemapCoords(x, y, z);
 
	const Sprite* spr = GetSprite(image & SPRITE_MASK);
 

	
 
	if (pt.x + spr->x_offs >= vd->dpi.left + vd->dpi.width ||
 
			pt.x + spr->x_offs + spr->width <= vd->dpi.left ||
 
			pt.y + spr->y_offs >= vd->dpi.top + vd->dpi.height ||
 
			pt.y + spr->y_offs + spr->height <= vd->dpi.top)
 
		return;
 

	
 
	AddChildSpriteScreen(image, pal, pt.x - vd->parent_list[-1]->left, pt.y - vd->parent_list[-1]->top);
 
}
 

	
 

	
 
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, byte dz, byte z)
 
/** Draw a (transparent) sprite at given coordinates
 
 * @param image the image to combine and draw,
 
 * @param pal the provided palette,
 
 * @param x position x of the sprite,
 
 * @param y position y of the sprite,
 
 * @param w width of the sprite,
 
 * @param h height of the sprite,
 
 * @param dz delta z, difference of elevation between sprite and parent sprite,
 
 * @param z elevation of the sprite,
 
 * @param transparent if true, switch the palette between the provided palette and the transparent palette
 
 */
 
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, byte dz, byte z, bool transparent)
 
{
 
	ViewportDrawer *vd = _cur_vd;
 
	ParentSpriteToDraw *ps;
 
	const Sprite *spr;
 
	Point pt;
 

	
 
	assert((image & SPRITE_MASK) < MAX_SPRITES);
 

	
 
	/* make the sprites transparent with the right palette */
 
	if (transparent) {
 
		SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 
		pal = PALETTE_TO_TRANSPARENT;
 
	}
 

	
 
	if (vd->combine_sprites == 2) {
 
		AddCombinedSprite(image, pal, x, y, z);
 
		return;
 
	}
 

	
 
	vd->last_child = NULL;
 

	
 
	if (vd->spritelist_mem >= vd->eof_spritelist_mem) {
 
		DEBUG(sprite, 0, "Out of sprite memory");
 
		return;
 
	}
 
	ps = (ParentSpriteToDraw*)vd->spritelist_mem;