src/gfx.cpp
changeset 10056 48659f7d4fa5
parent 9989 62e68bd41c90
child 10248 f0297aac2ff2
equal deleted inserted replaced
10055:b3bf982d7879 10056:48659f7d4fa5
   886  * @param sub  If available, draw only specified part of the sprite
   886  * @param sub  If available, draw only specified part of the sprite
   887  */
   887  */
   888 void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub)
   888 void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub)
   889 {
   889 {
   890 	if (HasBit(img, PALETTE_MODIFIER_TRANSPARENT)) {
   890 	if (HasBit(img, PALETTE_MODIFIER_TRANSPARENT)) {
   891 		_color_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH)) + 1;
   891 		_color_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1;
   892 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_TRANSPARENT, sub);
   892 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH), ST_NORMAL), x, y, BM_TRANSPARENT, sub);
   893 	} else if (pal != PAL_NONE) {
   893 	} else if (pal != PAL_NONE) {
   894 		_color_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH)) + 1;
   894 		_color_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1;
   895 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_COLOUR_REMAP, sub);
   895 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH), ST_NORMAL), x, y, BM_COLOUR_REMAP, sub);
   896 	} else {
   896 	} else {
   897 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_NORMAL, sub);
   897 		GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH), ST_NORMAL), x, y, BM_NORMAL, sub);
   898 	}
   898 	}
   899 }
   899 }
   900 
   900 
   901 static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub)
   901 static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub)
   902 {
   902 {
  1474 	CursorVars *cv = &_cursor;
  1474 	CursorVars *cv = &_cursor;
  1475 	const Sprite *p;
  1475 	const Sprite *p;
  1476 
  1476 
  1477 	if (cv->sprite == cursor) return;
  1477 	if (cv->sprite == cursor) return;
  1478 
  1478 
  1479 	p = GetSprite(GB(cursor, 0, SPRITE_WIDTH));
  1479 	p = GetSprite(GB(cursor, 0, SPRITE_WIDTH), ST_NORMAL);
  1480 	cv->sprite = cursor;
  1480 	cv->sprite = cursor;
  1481 	cv->pal    = pal;
  1481 	cv->pal    = pal;
  1482 	cv->size.y = p->height;
  1482 	cv->size.y = p->height;
  1483 	cv->size.x = p->width;
  1483 	cv->size.x = p->width;
  1484 	cv->offs.x = p->x_offs;
  1484 	cv->offs.x = p->x_offs;