toaplan_scu.cpp : Reduce unnecessary lines, Fix code styles (#4780)

* toaplan_scu.cpp : Reduce unnecessary lines, Fix code styles

* toaplan_scu.cpp : Minor spacing fix

* toaplan_scu.cpp : More spacing fix
This commit is contained in:
cam900 2019-03-20 23:36:57 +09:00 committed by R. Belmont
parent dbb071d328
commit 7a0ce844f7
2 changed files with 29 additions and 33 deletions

View File

@ -29,7 +29,7 @@ GFXDECODE_MEMBER( toaplan_scu_device::gfxinfo )
GFXDECODE_END GFXDECODE_END
toaplan_scu_device::toaplan_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) toaplan_scu_device::toaplan_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, TOAPLAN_SCU, tag, owner, clock) : device_t(mconfig, TOAPLAN_SCU, tag, owner, clock)
, device_gfx_interface(mconfig, *this, gfxinfo) , device_gfx_interface(mconfig, *this, gfxinfo)
{ {
@ -52,38 +52,35 @@ void toaplan_scu_device::alloc_sprite_bitmap(screen_device &screen)
Sprite Handlers Sprite Handlers
***************************************************************************/ ***************************************************************************/
void toaplan_scu_device::draw_sprites_to_tempbitmap(const rectangle &cliprect, uint16_t* spriteram, uint32_t bytes ) void toaplan_scu_device::draw_sprites_to_tempbitmap(const rectangle &cliprect, u16* spriteram, u32 bytes)
{ {
int offs; m_temp_spritebitmap.fill(0, cliprect);
m_temp_spritebitmap.fill(0,cliprect);
for (offs = 0;offs < bytes/2;offs += 4) for (int offs = 0; offs < bytes / 2; offs += 4)
{ {
int attribute,sx,sy,flipx,flipy; const u16 attribute = spriteram[offs + 1];
int sprite, color; const int priority = (attribute & 0x0c00) >> 10;
attribute = spriteram[offs + 1];
int priority = (attribute & 0x0c00)>>10;
// are 0 priority really skipped, or can they still mask? // are 0 priority really skipped, or can they still mask?
if (!priority) continue; if (!priority) continue;
sy = spriteram[offs + 3] >> 7; const int sy = spriteram[offs + 3] >> 7;
if (sy != 0x0100) { /* sx = 0x01a0 or 0x0040*/ if (sy != 0x0100) /* sx = 0x01a0 or 0x0040*/
sprite = spriteram[offs] & 0x7ff; {
color = attribute & 0x3f; const u32 sprite = spriteram[offs] & 0x7ff;
u32 color = attribute & 0x3f;
color |= priority << 6; // encode colour color |= priority << 6; // encode colour
sx = spriteram[offs + 2] >> 7; int sx = spriteram[offs + 2] >> 7;
flipx = attribute & 0x100; const int flipx = attribute & 0x100;
if (flipx) sx -= m_xoffs_flipped; if (flipx) sx -= m_xoffs_flipped;
flipy = attribute & 0x200; const int flipy = attribute & 0x200;
gfx(0)->transpen_raw(m_temp_spritebitmap,cliprect, gfx(0)->transpen_raw(m_temp_spritebitmap, cliprect,
sprite, sprite,
color << 4 /* << 4 because using _raw */ , color << 4 /* << 4 because using _raw */ ,
flipx,flipy, flipx, flipy,
sx-m_xoffs,sy-16,0); sx - m_xoffs, sy - 16, 0);
} }
} }
@ -96,23 +93,22 @@ void toaplan_scu_device::draw_sprites_to_tempbitmap(const rectangle &cliprect, u
void toaplan_scu_device::copy_sprites_from_tempbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority) void toaplan_scu_device::copy_sprites_from_tempbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority)
{ {
int y, x; const int colourbase = gfx(0)->colorbase();
int colourbase = gfx(0)->colorbase();
for (y=cliprect.min_y;y<=cliprect.max_y;y++) for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{ {
uint16_t* srcline = &m_temp_spritebitmap.pix16(y); u16* srcline = &m_temp_spritebitmap.pix16(y);
uint16_t* dstline = &bitmap.pix16(y); u16* dstline = &bitmap.pix16(y);
for (x=cliprect.min_x;x<=cliprect.max_x;x++) for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{ {
uint16_t pix = srcline[x]; const u16 pix = srcline[x];
if ( (pix>>(4+6)) == priority ) if ((pix >> (4 + 6)) == priority)
{ {
if (pix&0xf) if (pix & 0xf)
{ {
dstline[x] = (pix & 0x3ff)+colourbase; dstline[x] = (pix & 0x3ff) + colourbase;
} }
} }
} }

View File

@ -10,7 +10,7 @@
class toaplan_scu_device : public device_t, public device_gfx_interface class toaplan_scu_device : public device_t, public device_gfx_interface
{ {
public: public:
toaplan_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); toaplan_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// configuration // configuration
void set_xoffsets(int xoffs, int xoffs_flipped) void set_xoffsets(int xoffs, int xoffs_flipped)
@ -19,7 +19,7 @@ public:
m_xoffs_flipped = xoffs_flipped; m_xoffs_flipped = xoffs_flipped;
} }
void draw_sprites_to_tempbitmap(const rectangle &cliprect, uint16_t* spriteram, uint32_t bytes ); void draw_sprites_to_tempbitmap(const rectangle &cliprect, u16* spriteram, u32 bytes);
void copy_sprites_from_tempbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority); void copy_sprites_from_tempbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
void alloc_sprite_bitmap(screen_device &screen); void alloc_sprite_bitmap(screen_device &screen);