diff options
| author | 2010-04-15 19:05:07 +0000 | |
|---|---|---|
| committer | 2010-04-15 19:05:07 +0000 | |
| commit | c8fa2f793ba249b8652135cb8df464854e04e62c (patch) | |
| tree | 55a989f5dffa4012437860ed32f4283634b3e6af /src | |
| parent | e7ecc4c3d587df07b397ec58df1847f7392dda39 (diff) | |
Haze: fixed MT 3813
Diffstat (limited to 'src')
| -rw-r--r-- | src/mame/drivers/gaiden.c | 9 | ||||
| -rw-r--r-- | src/mame/video/gaiden.c | 100 |
2 files changed, 80 insertions, 29 deletions
diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c index e155b0a9b23..3625a95ef61 100644 --- a/src/mame/drivers/gaiden.c +++ b/src/mame/drivers/gaiden.c @@ -386,7 +386,6 @@ static ADDRESS_MAP_START( gaiden_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x074000, 0x075fff) AM_READWRITE(gaiden_videoram3_r, gaiden_videoram3_w) AM_BASE_MEMBER(gaiden_state, videoram3) AM_RANGE(0x076000, 0x077fff) AM_RAM AM_BASE_SIZE_MEMBER(gaiden_state, spriteram, spriteram_size) AM_RANGE(0x078000, 0x079fff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram) - AM_RANGE(0x078800, 0x079fff) AM_READNOP /* extra portion of palette RAM, not really used */ AM_RANGE(0x07a000, 0x07a001) AM_READ_PORT("SYSTEM") AM_RANGE(0x07a002, 0x07a003) AM_READ_PORT("P1_P2") AM_RANGE(0x07a004, 0x07a005) AM_READ_PORT("DSW") @@ -765,8 +764,8 @@ static const gfx_layout spritelayout = static GFXDECODE_START( gaiden ) GFXDECODE_ENTRY( "gfx1", 0, tilelayout, 0x100, 16 ) /* tiles 8x8 */ GFXDECODE_ENTRY( "gfx2", 0, tile2layout, 0x300, 16 ) /* tiles 16x16 */ - GFXDECODE_ENTRY( "gfx3", 0, tile2layout, 0x200, 16 ) /* tiles 16x16 */ - GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 0x000, 16 ) /* sprites 8x8 */ + GFXDECODE_ENTRY( "gfx3", 0, tile2layout, 0x200, 16+128 ) /* tiles 16x16 */ + GFXDECODE_ENTRY( "gfx4", 0, spritelayout, 0x000, 16+128 ) /* sprites 8x8 */ GFXDECODE_END static GFXDECODE_START( raiga ) @@ -872,7 +871,7 @@ static MACHINE_DRIVER_START( shadoww ) MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_REFRESH_RATE(59.17) /* verified on pcb */ MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) @@ -1056,7 +1055,7 @@ static MACHINE_DRIVER_START( mastninj ) MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_REFRESH_RATE(59.17) /* verified on pcb */ MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) MDRV_SCREEN_SIZE(32*8, 32*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) diff --git a/src/mame/video/gaiden.c b/src/mame/video/gaiden.c index acc31094721..03465c3278a 100644 --- a/src/mame/video/gaiden.c +++ b/src/mame/video/gaiden.c @@ -75,30 +75,47 @@ static TILE_GET_INFO( get_tx_tile_info ) VIDEO_START( gaiden ) { gaiden_state *state = (gaiden_state *)machine->driver_data; + int width = video_screen_get_width(machine->primary_screen); + int height = video_screen_get_height(machine->primary_screen); /* set up tile layers */ + state->tile_bitmap_bg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + state->tile_bitmap_fg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + state->background = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 64, 32); - state->foreground = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 16, 16, 64, 32); + state->foreground = tilemap_create(machine, get_fg_tile_info_raiga, tilemap_scan_rows, 16, 16, 64, 32); state->text_layer = tilemap_create(machine, get_tx_tile_info, tilemap_scan_rows, 8, 8, 32, 32); tilemap_set_transparent_pen(state->background, 0); tilemap_set_transparent_pen(state->foreground, 0); tilemap_set_transparent_pen(state->text_layer, 0); + + /* set up sprites */ + state->sprite_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); } VIDEO_START( mastninj ) { + gaiden_state *state = (gaiden_state *)machine->driver_data; + int width = video_screen_get_width(machine->primary_screen); + int height = video_screen_get_height(machine->primary_screen); /* set up tile layers */ + state->tile_bitmap_bg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + state->tile_bitmap_fg = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + state->background = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 64, 32); - state->foreground = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 16, 16, 64, 32); + state->foreground = tilemap_create(machine, get_fg_tile_info_raiga, tilemap_scan_rows, 16, 16, 64, 32); state->text_layer = tilemap_create(machine, get_tx_tile_info, tilemap_scan_rows, 8, 8, 32, 32); // tilemap_set_transparent_pen(state->background, 15); tilemap_set_transparent_pen(state->foreground, 15); tilemap_set_transparent_pen(state->text_layer, 15); + /* set up sprites */ + state->sprite_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); + tilemap_set_scrolldx(state->background, -248, 248); tilemap_set_scrolldx(state->foreground, -252, 252); } @@ -302,7 +319,7 @@ static void blendbitmaps(running_machine *machine, #define NUM_SPRITES 256 -static void gaiden_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) +static void gaiden_draw_sprites( running_machine *machine, bitmap_t *bitmap_bg, bitmap_t *bitmap_fg, bitmap_t *bitmap_sp, const rectangle *cliprect ) { static const UINT8 layout[8][8] = { @@ -344,9 +361,6 @@ static void gaiden_draw_sprites( running_machine *machine, bitmap_t *bitmap, con int ypos = source[3] & 0x01ff; int xpos = source[4] & 0x01ff; - if ((attributes & 0x20) && (video_screen_get_frame_number(machine->primary_screen) & 1)) - goto skip_sprite; - color = (color >> 4) & 0x0f; /* wraparound */ @@ -379,23 +393,49 @@ static void gaiden_draw_sprites( running_machine *machine, bitmap_t *bitmap, con case 0x3: priority_mask = 0xf0 | 0xcc | 0xaa; break; /* obscured by bg and fg */ } - for (row = 0; row < sizey; row++) + + /* blending */ + if (attributes & 0x20) { - for (col = 0; col < sizex; col++) + color |= 0x80; + + for (row = 0; row < sizey; row++) { - int sx = xpos + 8 * (flipx ? (sizex - 1 - col) : col); - int sy = ypos + 8 * (flipy ? (sizey - 1 - row) : row); - - pdrawgfx_transpen_raw(bitmap, cliprect, gfx, - number + layout[row][col], - gfx->color_base + color * gfx->color_granularity, - flipx, flipy, - sx, sy, - machine->priority_bitmap, priority_mask, 0); + for (col = 0; col < sizex; col++) + { + int sx = xpos + 8 * (flipx ? (sizex - 1 - col) : col); + int sy = ypos + 8 * (flipy ? (sizey - 1 - row) : row); + + pdrawgfx_transpen_raw(bitmap_sp, cliprect, gfx, + number + layout[row][col], + gfx->color_base + color * gfx->color_granularity, + flipx, flipy, + sx, sy, + machine->priority_bitmap, priority_mask, 0); + } + } + } + else + { + bitmap_t *bitmap = (priority >= 2) ? bitmap_bg : bitmap_fg; + + for (row = 0; row < sizey; row++) + { + for (col = 0; col < sizex; col++) + { + int sx = xpos + 8 * (flipx ? (sizex - 1 - col) : col); + int sy = ypos + 8 * (flipy ? (sizey - 1 - row) : row); + + pdrawgfx_transpen_raw(bitmap, cliprect, gfx, + number + layout[row][col], + gfx->color_base + color * gfx->color_granularity, + flipx, flipy, + sx, sy, + machine->priority_bitmap, priority_mask, 0); + } } } } -skip_sprite: source -= 8; } } @@ -585,15 +625,27 @@ static void drgnbowl_draw_sprites(running_machine *machine, bitmap_t *bitmap, co VIDEO_UPDATE( gaiden ) { gaiden_state *state = (gaiden_state *)screen->machine->driver_data; - bitmap_fill(screen->machine->priority_bitmap, cliprect, 0); - bitmap_fill(bitmap, cliprect, 0x200); + bitmap_fill(screen->machine->priority_bitmap, cliprect, 0); - tilemap_draw(bitmap, cliprect, state->background, 0, 1); - tilemap_draw(bitmap, cliprect, state->foreground, 0, 2); - tilemap_draw(bitmap, cliprect, state->text_layer, 0, 4); + bitmap_fill(state->tile_bitmap_bg, cliprect, 0x200); + bitmap_fill(state->tile_bitmap_fg, cliprect, 0); + bitmap_fill(state->sprite_bitmap, cliprect, 0); + + /* draw tilemaps into a 16-bit bitmap */ + tilemap_draw(state->tile_bitmap_bg, cliprect, state->background, 0, 1); + tilemap_draw(state->tile_bitmap_fg, cliprect, state->foreground, 0, 2); + /* draw the blended tiles at a lower priority + so sprites covered by them will still be drawn */ + tilemap_draw(state->tile_bitmap_fg, cliprect, state->foreground, 1, 0); + tilemap_draw(state->tile_bitmap_fg, cliprect, state->text_layer, 0, 4); - gaiden_draw_sprites(screen->machine, bitmap, cliprect); + /* draw sprites into a 16-bit bitmap */ + gaiden_draw_sprites(screen->machine, state->tile_bitmap_bg, state->tile_bitmap_fg, state->sprite_bitmap, cliprect); + + /* mix & blend the tilemaps and sprites into a 32-bit bitmap */ + blendbitmaps(screen->machine, bitmap, state->tile_bitmap_bg, state->tile_bitmap_fg, state->sprite_bitmap, 0, 0, cliprect); return 0; + } VIDEO_UPDATE( raiga ) |
