本文整理汇总了C++中palette_device::transpen_mask方法的典型用法代码示例。如果您正苦于以下问题:C++ palette_device::transpen_mask方法的具体用法?C++ palette_device::transpen_mask怎么用?C++ palette_device::transpen_mask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类palette_device
的用法示例。
在下文中一共展示了palette_device::transpen_mask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void k007121_device::sprites_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, palette_device &palette,
const uint8_t *source, int base_color, int global_x_offset, int bank_base, bitmap_ind8 &priority_bitmap, uint32_t pri_mask, bool is_flakatck )
{
// gfx_element *gfx = gfxs[chip];
int flipscreen = m_flipscreen;
int i, num, inc, offs[5];
if (is_flakatck)
{
num = 0x40;
inc = -0x20;
source += 0x3f * 0x20;
offs[0] = 0x0e;
offs[1] = 0x0f;
offs[2] = 0x06;
offs[3] = 0x04;
offs[4] = 0x08;
}
else /* all others */
{
/* TODO: sprite limit is supposed to be per-line! (check MT #00185) */
num = 0x40;
//num = (k007121->ctrlram[0x03] & 0x40) ? 0x80 : 0x40; /* WRONG!!! (needed by combatsc) */
inc = 5;
offs[0] = 0x00;
offs[1] = 0x01;
offs[2] = 0x02;
offs[3] = 0x03;
offs[4] = 0x04;
/* when using priority buffer, draw front to back */
if (pri_mask != -1)
{
source += (num - 1)*inc;
inc = -inc;
}
}
for (i = 0; i < num; i++)
{
int number = source[offs[0]]; /* sprite number */
int sprite_bank = source[offs[1]] & 0x0f; /* sprite bank */
int sx = source[offs[3]]; /* vertical position */
int sy = source[offs[2]]; /* horizontal position */
int attr = source[offs[4]]; /* attributes */
int xflip = source[offs[4]] & 0x10; /* flip x */
int yflip = source[offs[4]] & 0x20; /* flip y */
int color = base_color + ((source[offs[1]] & 0xf0) >> 4);
int width, height;
int transparent_mask;
static const int x_offset[4] = {0x0,0x1,0x4,0x5};
static const int y_offset[4] = {0x0,0x2,0x8,0xa};
int x,y, ex, ey, flipx, flipy, destx, desty;
if (attr & 0x01) sx -= 256;
if (sy >= 240) sy -= 256;
number += ((sprite_bank & 0x3) << 8) + ((attr & 0xc0) << 4);
number = number << 2;
number += (sprite_bank >> 2) & 3;
/* Flak Attack doesn't use a lookup PROM, it maps the color code directly */
/* to a palette entry */
if (is_flakatck)
transparent_mask = 1 << 0;
else
transparent_mask = palette.transpen_mask(*gfx, color, 0);
if (!is_flakatck || source[0x00]) /* Flak Attack needs this */
{
number += bank_base;
switch (attr & 0xe)
{
case 0x06: width = height = 1; break;
case 0x04: width = 1; height = 2; number &= (~2); break;
case 0x02: width = 2; height = 1; number &= (~1); break;
case 0x00: width = height = 2; number &= (~3); break;
case 0x08: width = height = 4; number &= (~3); break;
default: width = 1; height = 1;
// logerror("Unknown sprite size %02x\n", attr & 0xe);
// popmessage("Unknown sprite size %02x\n", attr & 0xe);
}
for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
{
ex = xflip ? (width - 1 - x) : x;
ey = yflip ? (height - 1 - y) : y;
if (flipscreen)
{
flipx = !xflip;
flipy = !yflip;
destx = 248 - (sx + x * 8);
desty = 248 - (sy + y * 8);
}
else
{
//.........这里部分代码省略.........