diff options
Diffstat (limited to 'src/mame/video/fcombat.c')
-rw-r--r-- | src/mame/video/fcombat.c | 90 |
1 files changed, 35 insertions, 55 deletions
diff --git a/src/mame/video/fcombat.c b/src/mame/video/fcombat.c index edb8320ee37..b609b2d44e5 100644 --- a/src/mame/video/fcombat.c +++ b/src/mame/video/fcombat.c @@ -5,39 +5,20 @@ ***************************************************************************/ #include "driver.h" +#include "fcombat.h" -int fcombat_sh; -int fcombat_sv; - - -#define BACKGROUND_X_START 32 -#define BACKGROUND_X_START_FLIP 72 - -#define VISIBLE_X_MIN (12*8) -#define VISIBLE_X_MAX (52*8) -#define VISIBLE_Y_MIN (2*8) -#define VISIBLE_Y_MAX (30*8) - - -static tilemap *bgmap; static TILE_GET_INFO( get_bg_tile_info ) { - int tileno,palno;//32*16 x 32 + int tileno, palno; //32*16 x 32 - //palno=(tile_index-(tile_index/32*16)*32*16)/32; + //palno = (tile_index - (tile_index / 32 * 16) * 32 * 16) / 32; tileno = memory_region(machine, "user1")[tile_index]; - palno=0x18;//memory_region(machine, "user2")[tile_index]>>3; - SET_TILE_INFO(2,tileno,palno,0); + palno = 0x18; //memory_region(machine, "user2")[tile_index] >> 3; + SET_TILE_INFO(2, tileno, palno, 0); } -UINT8 fcombat_cocktail_flip; - -static UINT8 char_palette, sprite_palette; -static UINT8 char_bank; - - /*************************************************************************** @@ -119,7 +100,8 @@ PALETTE_INIT( fcombat ) VIDEO_START( fcombat ) { - bgmap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_rows, 16, 16,32*8*2,32); + fcombat_state *state = (fcombat_state *)machine->driver_data; + state->bgmap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 32 * 8 * 2, 32); } @@ -132,19 +114,21 @@ VIDEO_START( fcombat ) WRITE8_HANDLER( fcombat_videoreg_w ) { + fcombat_state *state = (fcombat_state *)space->machine->driver_data; + /* bit 0 = flip screen and joystick input multiplexor */ - fcombat_cocktail_flip = data & 1; + state->cocktail_flip = data & 1; /* bits 1-2 char lookup table bank */ - char_palette = (data & 0x06) >> 1; + state->char_palette = (data & 0x06) >> 1; /* bits 3 char bank */ - char_bank = (data & 0x08) >> 3; + state->char_bank = (data & 0x08) >> 3; /* bits 4-5 unused */ /* bits 6-7 sprite lookup table bank */ - sprite_palette = 0;//(data & 0xc0) >> 6; + state->sprite_palette = 0;//(data & 0xc0) >> 6; //popmessage("%08x",data); } @@ -152,23 +136,24 @@ WRITE8_HANDLER( fcombat_videoreg_w ) VIDEO_UPDATE( fcombat ) { + fcombat_state *state = (fcombat_state *)screen->machine->driver_data; int sx, sy, offs, i; /* draw background */ - tilemap_set_scrolly( bgmap,0, fcombat_sh); - tilemap_set_scrollx( bgmap,0, fcombat_sv-24); + tilemap_set_scrolly(state->bgmap, 0, state->fcombat_sh); + tilemap_set_scrollx(state->bgmap, 0, state->fcombat_sv - 24); -tilemap_mark_all_tiles_dirty(bgmap); - tilemap_draw(bitmap,cliprect,bgmap,0,0); + tilemap_mark_all_tiles_dirty(state->bgmap); + tilemap_draw(bitmap, cliprect, state->bgmap, 0, 0); //draw_background(bitmap, cliprect); /* draw sprites */ for (i = 0; i < spriteram_size; i += 4) { - int flags = spriteram[i + 0]; - int y = spriteram[i + 1] ^ 255; - int code = spriteram[i + 2]+((flags&0x20)<<3); - int x = spriteram[i + 3] * 2 + 72; + int flags = state->spriteram[i + 0]; + int y = state->spriteram[i + 1] ^ 255; + int code = state->spriteram[i + 2] + ((flags & 0x20) << 3); + int x = state->spriteram[i + 3] * 2 + 72; int xflip = flags & 0x80; int yflip = flags & 0x40; @@ -176,13 +161,13 @@ tilemap_mark_all_tiles_dirty(bgmap); int wide = flags & 0x08; int code2 = code; - int color = ((flags >> 1) & 0x03) | ((code >> 5) & 0x04) | (code & 0x08) | (sprite_palette * 16); - const gfx_element *gfx = screen->machine->gfx[1]; + int color = ((flags >> 1) & 0x03) | ((code >> 5) & 0x04) | (code & 0x08) | (state->sprite_palette * 16); + const gfx_element *gfx = screen->machine->gfx[1]; - if (fcombat_cocktail_flip) + if (state->cocktail_flip) { - x = 64*8 - gfx->width - x; - y = 32*8 - gfx->height - y; + x = 64 * 8 - gfx->width - x; + y = 32 * 8 - gfx->height - y; if (wide) y -= gfx->height; xflip = !xflip; yflip = !yflip; @@ -200,17 +185,12 @@ tilemap_mark_all_tiles_dirty(bgmap); if(flags&0x10) { - - - - drawgfx_transpen(bitmap, cliprect, gfx, code2+16, color, xflip, yflip, x, y + gfx->height, 0); - drawgfx_transpen(bitmap, cliprect, gfx, code2+16*2, color, xflip, yflip, x, y + 2*gfx->height, 0); - drawgfx_transpen(bitmap, cliprect, gfx, code2+16*3, color, xflip, yflip, x, y + 3*gfx->height, 0); + drawgfx_transpen(bitmap, cliprect, gfx, code2 + 16, color, xflip, yflip, x, y + gfx->height, 0); + drawgfx_transpen(bitmap, cliprect, gfx, code2 + 16 * 2, color, xflip, yflip, x, y + 2 * gfx->height, 0); + drawgfx_transpen(bitmap, cliprect, gfx, code2 + 16 * 3, color, xflip, yflip, x, y + 3 * gfx->height, 0); } - - drawgfx_transpen(bitmap, cliprect, gfx, code, color, xflip, yflip, x, y, 0); if (doubled) i += 4; @@ -220,14 +200,14 @@ tilemap_mark_all_tiles_dirty(bgmap); for (sy = VISIBLE_Y_MIN/8; sy < VISIBLE_Y_MAX/8; sy++) for (sx = VISIBLE_X_MIN/8; sx < VISIBLE_X_MAX/8; sx++) { - int x = fcombat_cocktail_flip ? (63*8 - 8*sx) : 8*sx; - int y = fcombat_cocktail_flip ? (31*8 - 8*sy) : 8*sy; + int x = state->cocktail_flip ? (63 * 8 - 8 * sx) : 8 * sx; + int y = state->cocktail_flip ? (31 * 8 - 8 * sy) : 8 * sy; offs = sx + sy * 64; drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[0], - videoram[offs] + 256 * char_bank, - ((videoram[offs] & 0xf0) >> 4) + char_palette * 16, - fcombat_cocktail_flip, fcombat_cocktail_flip, x, y, 0); + state->videoram[offs] + 256 * state->char_bank, + ((state->videoram[offs] & 0xf0) >> 4) + state->char_palette * 16, + state->cocktail_flip, state->cocktail_flip, x, y, 0); } return 0; } |