UINT32 warriorb_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, device_t *tc0100scn) { UINT8 layer[3], nodraw; tc0100scn_tilemap_update(tc0100scn); layer[0] = tc0100scn_bottomlayer(tc0100scn); layer[1] = layer[0] ^ 1; layer[2] = 2; /* Clear priority bitmap */ screen.machine().priority_bitmap.fill(0, cliprect); /* chip 0 does tilemaps on the left, chip 1 does the ones on the right */ // draw bottom layer nodraw = tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 0); /* left */ /* Ensure screen blanked even when bottom layers not drawn due to disable bit */ if (nodraw) bitmap.fill(get_black_pen(machine()), cliprect); // draw middle layer tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[1], 0, 1); /* Sprites can be under/over the layer below text layer */ draw_sprites(bitmap, cliprect, xoffs, 8); // draw sprites // draw top(text) layer tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[2], 0, 0); return 0; }
static UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, device_t *tc0100scn) { UINT8 layer[3], nodraw; tc0100scn_tilemap_update(tc0100scn); layer[0] = tc0100scn_bottomlayer(tc0100scn); layer[1] = layer[0] ^ 1; layer[2] = 2; /* chip 0 does tilemaps on the left, chip 1 center, chip 2 the right */ // draw bottom layer nodraw = tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 0); /* left */ /* Ensure screen blanked even when bottom layers not drawn due to disable bit */ if (nodraw) bitmap.fill(get_black_pen(screen.machine()), cliprect); /* Sprites can be under/over the layer below text layer */ draw_sprites(screen.machine(), bitmap, cliprect, 1, xoffs, 8); // draw sprites with priority 1 which are under the mid layer // draw middle layer tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[1], 0, 0); draw_sprites(screen.machine(),bitmap,cliprect,0,xoffs,8); // draw sprites with priority 0 which are over the mid layer // draw top(text) layer tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, layer[2], 0, 0); return 0; }
UINT32 undrfire_state::screen_update_cbombers(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { device_t *tc0100scn = machine().device("tc0100scn"); device_t *tc0480scp = machine().device("tc0480scp"); address_space &space = machine().driver_data()->generic_space(); UINT8 layer[5]; UINT8 pivlayer[3]; UINT16 priority; #ifdef MAME_DEBUG if (machine().input().code_pressed_once (KEYCODE_X)) { m_dislayer[5] ^= 1; popmessage("piv text: %01x",m_dislayer[5]); } if (machine().input().code_pressed_once (KEYCODE_C)) { m_dislayer[0] ^= 1; popmessage("bg0: %01x",m_dislayer[0]); } if (machine().input().code_pressed_once (KEYCODE_V)) { m_dislayer[1] ^= 1; popmessage("bg1: %01x",m_dislayer[1]); } if (machine().input().code_pressed_once (KEYCODE_B)) { m_dislayer[2] ^= 1; popmessage("bg2: %01x",m_dislayer[2]); } if (machine().input().code_pressed_once (KEYCODE_N)) { m_dislayer[3] ^= 1; popmessage("bg3: %01x",m_dislayer[3]); } if (machine().input().code_pressed_once (KEYCODE_M)) { m_dislayer[4] ^= 1; popmessage("sprites: %01x",m_dislayer[4]); } #endif tc0100scn_tilemap_update(tc0100scn); tc0480scp_tilemap_update(tc0480scp); priority = tc0480scp_get_bg_priority(tc0480scp); layer[0] = (priority & 0xf000) >> 12; /* tells us which bg layer is bottom */ layer[1] = (priority & 0x0f00) >> 8; layer[2] = (priority & 0x00f0) >> 4; layer[3] = (priority & 0x000f) >> 0; /* tells us which is top */ layer[4] = 4; /* text layer always over bg layers */ pivlayer[0] = tc0100scn_bottomlayer(tc0100scn); pivlayer[1] = pivlayer[0] ^ 1; pivlayer[2] = 2; machine().priority_bitmap.fill(0, cliprect); bitmap.fill(0, cliprect); /* wrong color? */ /* The "PIV" chip seems to be a renamed TC0100SCN. It has a bottom layer usually full of bright garish colors that vaguely mimic the structure of the layers on top. Seems pointless - it's always hidden by other layers. Does it serve some blending pupose ? */ tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[0], TILEMAP_DRAW_OPAQUE, 0); tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[1], 0, 0); #ifdef MAME_DEBUG if (m_dislayer[layer[0]]==0) #endif tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[0], 0, 1); #ifdef MAME_DEBUG if (m_dislayer[layer[1]]==0) #endif tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[1], 0, 2); #ifdef MAME_DEBUG if (m_dislayer[layer[2]]==0) #endif tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 4); #ifdef MAME_DEBUG if (m_dislayer[layer[3]]==0) #endif tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 8); #ifdef MAME_DEBUG if (m_dislayer[4]==0) #endif /* Sprites have variable priority (we kludge this on road levels) */ { if ((tc0480scp_pri_reg_r(tc0480scp, space, 0) & 0x3) == 3) /* on road levels kludge sprites up 1 priority */ { static const int primasks[4] = {0xfff0, 0xff00, 0x0, 0x0}; draw_sprites_cbombers(machine(), bitmap, cliprect, primasks, 80, -208); } else { static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0}; draw_sprites_cbombers(machine(), bitmap, cliprect, primasks, 80, -208); } } #ifdef MAME_DEBUG if (m_dislayer[5]==0) #endif tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0); /* piv text layer */ tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); /* TC0480SCP text layer */ /* Enable this to see rotation (?) control words */ #if 0 { char buf[80]; int i; for (i = 0; i < 8; i += 1) { sprintf (buf, "%02x: %04x", i, m_rotate_ctrl[i]); ui_draw_text (buf, 0, i*8); } } #endif return 0; }