static void draw_sprite_collision( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) { circus_state *state = machine.driver_data<circus_state>(); const gfx_element *sprite_gfx = machine.gfx[1]; const UINT8 *sprite_data = gfx_element_get_data(sprite_gfx, state->m_clown_z); int sx, sy, dx, dy; int pixel, collision = 0; // draw sprite and check collision on a pixel basis for (sy = 0; sy < 16; sy++) { dy = state->m_clown_x + sy-1; if (dy>=0 && dy<bitmap.height()) { for (sx = 0; sx < 16; sx++) { dx = state->m_clown_y + sx; if (dx>=0 && dx<bitmap.width()) { pixel = sprite_data[sy * sprite_gfx->line_modulo + sx]; if (pixel) { collision |= bitmap.pix16(dy, dx); bitmap.pix16(dy, dx) = machine.pens[pixel]; } } } } } if (collision) device_set_input_line(state->m_maincpu, 0, ASSERT_LINE); }
static void gfxset_draw_item(running_machine &machine, const gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate) { static const pen_t default_palette[] = { MAKE_RGB(0,0,0), MAKE_RGB(0,0,255), MAKE_RGB(0,255,0), MAKE_RGB(0,255,255), MAKE_RGB(255,0,0), MAKE_RGB(255,0,255), MAKE_RGB(255,255,0), MAKE_RGB(255,255,255) }; int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width; int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height; const rgb_t *palette = (machine.total_colors() != 0) ? palette_entry_list_raw(machine.palette) : NULL; UINT32 palette_mask = ~0; int x, y; if (palette != NULL) palette += gfx->color_base + color * gfx->color_granularity; else { palette = default_palette; palette_mask = 7; } /* loop over rows in the cell */ for (y = 0; y < height; y++) { UINT32 *dest = &bitmap.pix32(dsty + y, dstx); const UINT8 *src = gfx_element_get_data(gfx, index); /* loop over columns in the cell */ for (x = 0; x < width; x++) { int effx = x, effy = y; const UINT8 *s; /* compute effective x,y values after rotation */ if (!(rotate & ORIENTATION_SWAP_XY)) { if (rotate & ORIENTATION_FLIP_X) effx = gfx->width - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) effy = gfx->height - 1 - effy; } else { int temp; if (rotate & ORIENTATION_FLIP_X) effx = gfx->height - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) effy = gfx->width - 1 - effy; temp = effx; effx = effy; effy = temp; } /* get a pointer to the start of this source row */ s = src + effy * gfx->line_modulo; /* extract the pixel */ *dest++ = 0xff000000 | palette[s[effx] & palette_mask]; } } }
static void seta_drawgfx( bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx, UINT32 code,UINT32 color,int flipx,int flipy,int x0,int y0, int shadow_depth ) { const UINT8 *addr, *source; UINT8 pen; UINT16 *dest; int sx, x1, dx; int sy, y1, dy; addr = gfx_element_get_data(gfx, code % gfx->total_elements); color = gfx->color_granularity * (color % gfx->total_colors); if ( flipx ) { x1 = x0-1; x0 += gfx->width-1; dx = -1; } else { x1 = x0 + gfx->width; dx = 1; } if ( flipy ) { y1 = y0-1; y0 += gfx->height-1; dy = -1; } else { y1 = y0 + gfx->height; dy = 1; } #define SETA_DRAWGFX(SETPIXELCOLOR) \ for ( sy = y0; sy != y1; sy += dy ) \ { \ if ( sy >= cliprect->min_y && sy <= cliprect->max_y ) \ { \ source = addr; \ dest = BITMAP_ADDR16(bitmap, sy, 0); \ \ for ( sx = x0; sx != x1; sx += dx ) \ { \ pen = *source++; \ \ if ( pen && sx >= cliprect->min_x && sx <= cliprect->max_x ) \ SETPIXELCOLOR \ } \ } \ \ addr += gfx->line_modulo; \ } if (shadow_depth) { int pen_shift = 15 - shadow_depth; int pen_mask = (1 << pen_shift) - 1; SETA_DRAWGFX( { dest[sx] = ((dest[sx] & pen_mask) | (pen << pen_shift)) & 0x7fff; } ) } else {
static void gfxset_draw_item(running_machine *machine, const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate) { static const pen_t default_palette[] = { MAKE_RGB(0,0,0), MAKE_RGB(0,0,255), MAKE_RGB(0,255,0), MAKE_RGB(0,255,255), MAKE_RGB(255,0,0), MAKE_RGB(255,0,255), MAKE_RGB(255,255,0), MAKE_RGB(255,255,255) }; int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width; int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height; const rgb_t *palette = (machine->config->total_colors != 0) ? palette_entry_list_raw(machine->palette) : NULL; UINT32 rowpixels = bitmap->rowpixels; UINT32 palette_mask = ~0; int x, y; if (palette != NULL) palette += gfx->color_base + color * gfx->color_granularity; else { palette = default_palette; palette_mask = 7; } /* loop over rows in the cell */ for (y = 0; y < height; y++) { UINT32 *dest = (UINT32 *)bitmap->base + (dsty + y) * rowpixels + dstx; const UINT8 *src = gfx_element_get_data(gfx, index); /* loop over columns in the cell */ for (x = 0; x < width; x++) { int effx = x, effy = y; rgb_t pixel; const UINT8 *s; /* compute effective x,y values after rotation */ if (!(rotate & ORIENTATION_SWAP_XY)) { if (rotate & ORIENTATION_FLIP_X) effx = gfx->width - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) effy = gfx->height - 1 - effy; } else { int temp; if (rotate & ORIENTATION_FLIP_X) effx = gfx->height - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) effy = gfx->width - 1 - effy; temp = effx; effx = effy; effy = temp; } /* get a pointer to the start of this source row */ s = src + effy * gfx->line_modulo; /* extract the pixel */ if (gfx->flags & GFX_ELEMENT_PACKED) pixel = (s[effx/2] >> ((effx & 1) * 4)) & 0xf; else pixel = s[effx]; *dest++ = 0xff000000 | palette[pixel & palette_mask]; } }
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority) { wrally_state *state = machine.driver_data<wrally_state>(); int i, px, py; const gfx_element *gfx = machine.gfx[0]; for (i = 6/2; i < (0x1000 - 6)/2; i += 4) { int sx = state->m_spriteram[i+2] & 0x03ff; int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff; int number = state->m_spriteram[i+3] & 0x3fff; int color = (state->m_spriteram[i+2] & 0x7c00) >> 10; int attr = (state->m_spriteram[i] & 0xfe00) >> 9; int xflip = attr & 0x20; int yflip = attr & 0x40; int color_effect = (color & 0x10) >> 4; int high_priority = number >= 0x3700; color = color & 0x0f; if (high_priority != priority) continue; if (flip_screen_get(machine)) { sy = sy + 248; } if (!color_effect) { drawgfx_transpen(bitmap,cliprect,gfx,number, 0x20 + color,xflip,yflip, sx - 0x0f,sy,0); } else { /* get a pointer to the current sprite's gfx data */ const UINT8 *gfx_src = gfx_element_get_data(gfx, number % gfx->total_elements); for (py = 0; py < gfx->height; py++){ /* get a pointer to the current line in the screen bitmap */ int ypos = ((sy + py) & 0x1ff); UINT16 *srcy = &bitmap.pix16(ypos); int gfx_py = yflip ? (gfx->height - 1 - py) : py; if ((ypos < cliprect.min_y) || (ypos > cliprect.max_y)) continue; for (px = 0; px < gfx->width; px++){ /* get current pixel */ int xpos = (((sx + px) & 0x3ff) - 0x0f) & 0x3ff; UINT16 *pixel = srcy + xpos; int src_color = *pixel; int gfx_px = xflip ? (gfx->width - 1 - px) : px; /* get asociated pen for the current sprite pixel */ int gfx_pen = gfx_src[gfx->line_modulo*gfx_py + gfx_px]; /* pens 8..15 are used to select a palette */ if ((gfx_pen < 8) || (gfx_pen >= 16)) continue; if ((xpos < cliprect.min_x) || (xpos > cliprect.max_x)) continue; /* modify the color of the tile */ *pixel = src_color + (gfx_pen-8)*1024; } } } } }
void jal_blend_drawgfx(bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx, UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy, int transparent_color) { if (jal_blend_table == NULL) { drawgfx_transpen(dest_bmp,clip,gfx,code,color,flipx,flipy,offsx,offsy,transparent_color); return; } /* Start drawing */ if (gfx) { const pen_t *pal = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; const UINT8 *alpha = &jal_blend_table[gfx->color_granularity * (color % gfx->total_colors)]; const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements); int x_index_base, y_index, sx, sy, ex, ey; int xinc, yinc; xinc = flipx ? -1 : 1; yinc = flipy ? -1 : 1; x_index_base = flipx ? gfx->width-1 : 0; y_index = flipy ? gfx->height-1 : 0; /* start coordinates */ sx = offsx; sy = offsy; /* end coordinates */ ex = sx + gfx->width; ey = sy + gfx->height; if (clip) { if (sx < clip->min_x) { /* clip left */ int pixels = clip->min_x-sx; sx += pixels; x_index_base += xinc*pixels; } if (sy < clip->min_y) { /* clip top */ int pixels = clip->min_y-sy; sy += pixels; y_index += yinc*pixels; } /* NS 980211 - fixed incorrect clipping */ if (ex > clip->max_x+1) { /* clip right */ ex = clip->max_x+1; } if (ey > clip->max_y+1) { /* clip bottom */ ey = clip->max_y+1; } } if (ex > sx) { /* skip if inner loop doesn't draw anything */ int x, y; /* 32-bit destination bitmap */ if (dest_bmp->bpp == 32) { /* taken from case 7: TRANSPARENCY_ALPHARANGE */ for (y = sy; y < ey; y++) { const UINT8 *source = source_base + y_index*gfx->line_modulo; UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); int x_index = x_index_base; for (x = sx; x < ex; x++) { int c = source[x_index]; if (c != transparent_color) { if (alpha[c] & 8) { /* Comp with clamp */ dest[x] = jal_blend_func(dest[x], pal[c], alpha[c]); } else { /* Skip the costly alpha step altogether */ dest[x] = pal[c]; } } x_index += xinc; } y_index += yinc; } } /* 16-bit destination bitmap */ else { /* taken from case 7: TRANSPARENCY_ALPHARANGE */ for (y = sy; y < ey; y++) { const UINT8 *source = source_base + y_index*gfx->line_modulo; UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); int x_index = x_index_base; for (x = sx; x < ex; x++) { int c = source[x_index]; if (c != transparent_color) { if (alpha[c] & 8) { /* Comp with clamp */ dest[x] = jal_blend_func(dest[x], pal[c], alpha[c]); } else { /* Skip the costly alpha step altogether */ dest[x] = pal[c]; } } x_index += xinc; } y_index += yinc; } } } } }
static void taito_f2_tc360_spritemixdraw( running_machine *machine, bitmap_t *dest_bmp, const rectangle *clip, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy, int scalex, int scaley ) { taitof2_state *state = machine->driver_data<taitof2_state>(); int pal_base = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); const UINT8 *source_base = gfx_element_get_data(gfx, code % gfx->total_elements); bitmap_t *priority_bitmap = gfx->machine->priority_bitmap; int sprite_screen_height = (scaley * gfx->height + 0x8000) >> 16; int sprite_screen_width = (scalex * gfx->width + 0x8000) >> 16; if (!scalex || !scaley) return; if (sprite_screen_width && sprite_screen_height) { /* compute sprite increment per screen pixel */ int dx = (gfx->width << 16) / sprite_screen_width; int dy = (gfx->height << 16) / sprite_screen_height; int ex = sx + sprite_screen_width; int ey = sy + sprite_screen_height; int x_index_base; int y_index; if (flipx) { x_index_base = (sprite_screen_width - 1) * dx; dx = -dx; } else { x_index_base = 0; } if (flipy) { y_index = (sprite_screen_height - 1) * dy; dy = -dy; } else { y_index = 0; } if (clip) { if (sx < clip->min_x) { /* clip left */ int pixels = clip->min_x - sx; sx += pixels; x_index_base += pixels * dx; } if (sy < clip->min_y) { /* clip top */ int pixels = clip->min_y - sy; sy += pixels; y_index += pixels * dy; } /* NS 980211 - fixed incorrect clipping */ if (ex > clip->max_x + 1) { /* clip right */ int pixels = ex-clip->max_x - 1; ex -= pixels; } if (ey > clip->max_y + 1) { /* clip bottom */ int pixels = ey-clip->max_y - 1; ey -= pixels; } } if (ex > sx) { /* skip if inner loop doesn't draw anything */ int y; for (y = sy; y < ey; y++) { const UINT8 *source = source_base + (y_index >> 16) * gfx->line_modulo; UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0); int x, x_index = x_index_base; for (x = sx; x < ex; x++) { int c = source[x_index >> 16]; if (c && (pri[x] & 0x80) == 0) { UINT8 tilemap_priority = 0, sprite_priority = 0; // Get tilemap priority (0 - 0xf) for this destination pixel if (pri[x] & 0x10) tilemap_priority = state->tilepri[4]; else if (pri[x] & 0x8) tilemap_priority = state->tilepri[3]; else if (pri[x] & 0x4) tilemap_priority = state->tilepri[2]; else if (pri[x] & 0x2) tilemap_priority = state->tilepri[1]; else if (pri[x] & 0x1) tilemap_priority = state->tilepri[0]; // Get sprite priority (0 - 0xf) for this source pixel if ((color & 0xc0) == 0xc0) sprite_priority = state->spritepri[3]; else if ((color & 0xc0) == 0x80) sprite_priority = state->spritepri[2]; else if ((color & 0xc0) == 0x40) sprite_priority = state->spritepri[1]; else if ((color & 0xc0) == 0x00) sprite_priority = state->spritepri[0]; // Blend mode 1 - Sprite under tilemap, use sprite palette with tilemap data if ((state->spriteblendmode & 0xc0) == 0xc0 && sprite_priority == (tilemap_priority - 1)) { dest[x] = ((pal_base + c) & 0xfff0) | (dest[x] & 0xf); } // Blend mode 1 - Sprite over tilemap, use sprite data with tilemap palette else if ((state->spriteblendmode & 0xc0) == 0xc0 && sprite_priority == (tilemap_priority + 1)) { if (dest[x] & 0xf) dest[x] = (dest[x] & 0xfff0) | ((pal_base + c) & 0xf); else dest[x] = pal_base + c; } // Blend mode 2 - Sprite under tilemap, use sprite data with tilemap palette else if ((state->spriteblendmode & 0xc0) == 0x80 && sprite_priority == (tilemap_priority - 1)) { dest[x] = (dest[x] & 0xffef); } // Blend mode 2 - Sprite over tilemap, alternate sprite palette, confirmed in Pulirula level 2 else if ((state->spriteblendmode & 0xc0) == 0x80 && sprite_priority == (tilemap_priority + 1)) { dest[x] = ((pal_base + c) & 0xffef); // Pulirula level 2, Liquid Kids attract mode } // No blending else { if (sprite_priority > tilemap_priority) // Ninja Kids confirms tilemap takes priority in equal value case dest[x] = pal_base + c; } pri[x] |= 0x80; } x_index += dx; } y_index += dy; } }
static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect ) { buggychl_state *state = machine.driver_data<buggychl_state>(); UINT8 *spriteram = state->m_spriteram; int offs; const UINT8 *gfx; g_profiler.start(PROFILER_USER1); gfx = machine.region("gfx2")->base(); for (offs = 0; offs < state->m_spriteram_size; offs += 4) { int sx, sy, flipy, zoom, ch, x, px, y; const UINT8 *lookup; const UINT8 *zoomx_rom, *zoomy_rom; sx = spriteram[offs + 3] - ((spriteram[offs + 2] & 0x80) << 1); sy = 256 - 64 - spriteram[offs] + ((spriteram[offs + 1] & 0x80) << 1); flipy = spriteram[offs + 1] & 0x40; zoom = spriteram[offs + 1] & 0x3f; zoomy_rom = gfx + (zoom << 6); zoomx_rom = gfx + 0x2000 + (zoom << 3); lookup = state->m_sprite_lookup + ((spriteram[offs + 2] & 0x7f) << 6); for (y = 0; y < 64; y++) { int dy = flip_screen_y_get(machine) ? (255 - sy - y) : (sy + y); if ((dy & ~0xff) == 0) { int charline, base_pos; charline = zoomy_rom[y] & 0x07; base_pos = zoomy_rom[y] & 0x38; if (flipy) base_pos ^= 0x38; px = 0; for (ch = 0; ch < 4; ch++) { int pos, code, realflipy; const UINT8 *pendata; pos = base_pos + 2 * ch; code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; code += (realflipy ? (charline ^ 7) : charline); pendata = gfx_element_get_data(machine.gfx[1], code); for (x = 0; x < 16; x++) { int col = pendata[x]; if (col) { int dx = flip_screen_x_get(machine) ? (255 - sx - px) : (sx + px); if ((dx & ~0xff) == 0) *BITMAP_ADDR16(bitmap, dy, dx) = state->m_sprite_color_base + col; } /* the following line is almost certainly wrong */ if (zoomx_rom[7 - (2 * ch + x / 8)] & (1 << (x & 7))) px++; } } } } } g_profiler.stop(); }
static void mlc_drawgfxzoom( bitmap_t *dest_bmp,const rectangle *clip,const gfx_element *gfx, UINT32 code1,UINT32 code2, UINT32 color,int flipx,int flipy,int sx,int sy, int transparent_color,int use8bpp, int scalex, int scaley,int alpha) { rectangle myclip; if (!scalex || !scaley) return; /* scalex and scaley are 16.16 fixed point numbers 1<<15 : shrink to 50% 1<<16 : uniform scale 1<<17 : double to 200% */ /* KW 991012 -- Added code to force clip to bitmap boundary */ if(clip) { myclip.min_x = clip->min_x; myclip.max_x = clip->max_x; myclip.min_y = clip->min_y; myclip.max_y = clip->max_y; if (myclip.min_x < 0) myclip.min_x = 0; if (myclip.max_x >= dest_bmp->width) myclip.max_x = dest_bmp->width-1; if (myclip.min_y < 0) myclip.min_y = 0; if (myclip.max_y >= dest_bmp->height) myclip.max_y = dest_bmp->height-1; clip=&myclip; } { if( gfx ) { const pen_t *pal = &gfx->machine().pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; const UINT8 *code_base1 = gfx_element_get_data(gfx, code1 % gfx->total_elements); const UINT8 *code_base2 = gfx_element_get_data(gfx, code2 % gfx->total_elements); int sprite_screen_height = (scaley*gfx->height+(sy&0xffff))>>16; int sprite_screen_width = (scalex*gfx->width+(sx&0xffff))>>16; sx>>=16; sy>>=16; if (sprite_screen_width && sprite_screen_height) { /* compute sprite increment per screen pixel */ int dx = (gfx->width<<16)/sprite_screen_width; int dy = (gfx->height<<16)/sprite_screen_height; int ex = sx+sprite_screen_width; int ey = sy+sprite_screen_height; int x_index_base; int y_index; if( flipx ) { x_index_base = (sprite_screen_width-1)*dx; dx = -dx; } else { x_index_base = 0; } if( flipy ) { y_index = (sprite_screen_height-1)*dy; dy = -dy; } else { y_index = 0; } if( clip ) { if( sx < clip->min_x) { /* clip left */ int pixels = clip->min_x-sx; sx += pixels; x_index_base += pixels*dx; } if( sy < clip->min_y ) { /* clip top */ int pixels = clip->min_y-sy; sy += pixels; y_index += pixels*dy; } /* NS 980211 - fixed incorrect clipping */ if( ex > clip->max_x+1 ) { /* clip right */ int pixels = ex-clip->max_x-1; ex -= pixels; } if( ey > clip->max_y+1 ) { /* clip bottom */ int pixels = ey-clip->max_y-1; ey -= pixels; } } if( ex>sx ) { /* skip if inner loop doesn't draw anything */ int y; /* case 1: no alpha */ if (alpha == 0xff) { { for( y=sy; y<ey; y++ ) { const UINT8 *source1 = code_base1 + (y_index>>16) * gfx->line_modulo; const UINT8 *source2 = code_base2 + (y_index>>16) * gfx->line_modulo; UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); int x, x_index = x_index_base; for( x=sx; x<ex; x++ ) { int c = source1[x_index>>16]; if (use8bpp) c=(c<<4)|source2[x_index>>16]; if( c != transparent_color ) dest[x] = pal[c]; x_index += dx; } y_index += dy; } } } /* case 6: alpha blended */ else { { for( y=sy; y<ey; y++ ) { const UINT8 *source = code_base1 + (y_index>>16) * gfx->line_modulo; UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); int x, x_index = x_index_base; for( x=sx; x<ex; x++ ) { int c = source[x_index>>16]; if( c != transparent_color ) dest[x] = alpha_blend_r32(dest[x], 0, alpha); //pal[c]); x_index += dx; } y_index += dy; } } } }
static void ripcord_draw_skydiver( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) { circus_state *state = machine->driver_data<circus_state>(); const gfx_element *gfx; const UINT8 *src_lineptr, *src_pixptr; UINT16 *dst_lineptr, *dst_lineend; UINT32 code; int sx, sy; int src_pitch, dst_width, dst_height, dst_pitch, dst_pixoffs, dst_pixend; int collision, eax, edx; gfx = machine->gfx[0]; code = state->clown_z; sx = state->clown_y; sy = state->clown_x - 1; dst_width = 16; dst_height = 16; edx = 1; gfx = machine->gfx[1]; src_lineptr = gfx_element_get_data(gfx, code); src_pitch = gfx->line_modulo; dst_pitch = bitmap->rowpixels; dst_lineptr = BITMAP_ADDR16(bitmap, sy, 0); dst_pixend = (sx + dst_width) & 0xff; dst_lineend = dst_lineptr + dst_pitch * dst_height; // draw sky diver and check collision on a pixel basis collision = 0; do { src_pixptr = src_lineptr; dst_pixoffs = sx; do { eax = *src_pixptr; src_pixptr++; if (eax) { eax = machine->pens[eax]; collision |= dst_lineptr[dst_pixoffs]; dst_lineptr[dst_pixoffs] = eax; } dst_pixoffs += edx; } while((dst_pixoffs &= 0xff) != dst_pixend); src_lineptr += src_pitch; } while((dst_lineptr += dst_pitch) != dst_lineend); // report collision only when the character is not blank and within display area if (collision && code != 0xf && state->clown_x > 0 && state->clown_x < 240 && state->clown_y > -12 && state->clown_y < 240) { cpu_set_input_line(state->maincpu, 0, ASSERT_LINE); // interrupt accuracy is critical in Ripcord cpu_set_input_line(state->maincpu, 0, CLEAR_LINE); } }