trunk/src/mame/video/galspnbl.c
| r30616 | r30617 | |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | VIDEO_START_MEMBER(galspnbl_state,galspnbl) |
| 32 | { |
| 33 | /* allocate bitmaps */ |
| 34 | m_screen->register_screen_bitmap(m_sprite_bitmap); |
| 35 | } |
| 31 | 36 | |
| 37 | void galspnbl_state::mix_sprite_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri) |
| 38 | { |
| 39 | for (int y = cliprect.min_y; y <= cliprect.max_y; y++) |
| 40 | { |
| 41 | UINT16 *dd = &bitmap.pix16(y); |
| 42 | UINT16 *sd2 = &m_sprite_bitmap.pix16(y); |
| 43 | |
| 44 | for (int x = cliprect.min_x; x <= cliprect.max_x; x++) |
| 45 | { |
| 46 | UINT16 sprpixel = (sd2[x]); |
| 47 | //UINT16 sprpri = (sprpixel >> 8) & 3; |
| 48 | UINT16 sprpri = (sprpixel >> 9) & 1; // only upper priority bit matters on the bootleg hw? |
| 49 | |
| 50 | sprpixel &= 0xff; |
| 51 | |
| 52 | if (sprpixel & 0xf) |
| 53 | { |
| 54 | if (sprpri == pri) |
| 55 | dd[x] = sprpixel; |
| 56 | } |
| 57 | |
| 58 | // UINT16 sprbln = (sprpixel >> 10) & 1; // we handle 'blending' from the original as a simple on/off flicker in the bootleg sprite function, I don't think the bootleg hw can blend |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 32 | 63 | UINT32 galspnbl_state::screen_update_galspnbl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 33 | 64 | { |
| 34 | 65 | int offs; |
| 66 | m_sprite_bitmap.fill(0, cliprect); |
| 67 | m_sprgen->gaiden_draw_sprites(screen, m_gfxdecode, cliprect, m_spriteram, 0, 0, flip_screen(), m_sprite_bitmap); |
| 35 | 68 | |
| 69 | |
| 36 | 70 | draw_background(bitmap, cliprect); |
| 37 | 71 | |
| 38 | | m_sprgen->galspnbl_draw_sprites(screen, m_gfxdecode, bitmap, cliprect, 0, m_spriteram, m_spriteram.bytes()); |
| 72 | mix_sprite_layer(screen, bitmap, cliprect, 0); |
| 39 | 73 | |
| 40 | 74 | for (offs = 0; offs < 0x1000 / 2; offs++) |
| 41 | 75 | { |
| r30616 | r30617 | |
| 47 | 81 | sx = offs % 64; |
| 48 | 82 | sy = offs / 64; |
| 49 | 83 | |
| 50 | | /* What is this? A priority/half transparency marker? */ |
| 84 | /* What is this? A priority/half transparency marker? */ // leftover blend flags from original spbactn game |
| 51 | 85 | if (!(attr & 0x0008)) |
| 52 | 86 | { |
| 53 | 87 | m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, |
| r30616 | r30617 | |
| 59 | 93 | } |
| 60 | 94 | } |
| 61 | 95 | |
| 62 | | m_sprgen->galspnbl_draw_sprites(screen, m_gfxdecode, bitmap, cliprect, 1, m_spriteram, m_spriteram.bytes()); |
| 96 | mix_sprite_layer(screen, bitmap, cliprect, 1); |
| 97 | |
| 98 | |
| 63 | 99 | return 0; |
| 64 | 100 | } |
trunk/src/mame/video/tecmo_spr.c
| r30616 | r30617 | |
| 1 | 1 | /* Various Tecmo Sprite implementations |
| 2 | | - for unifying and converting to a device |
| 3 | 2 | |
| 4 | 3 | - check wc90.c, tecmo.c, tbowl.c others? - they seem more significantly different but are they close to each other |
| 5 | 4 | (but at the same time use the same 'layout' table as this implementation) |
| r30616 | r30617 | |
| 19 | 18 | tecmo_spr_device::tecmo_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 20 | 19 | : device_t(mconfig, TECMO_SPRITE, "Teccmo 16-bit Sprite", tag, owner, clock, "tecmo_spr", __FILE__), |
| 21 | 20 | device_video_interface(mconfig, *this), |
| 22 | | m_gfxregion(0) |
| 21 | m_gfxregion(0), |
| 22 | m_bootleg(0) |
| 23 | 23 | { |
| 24 | 24 | } |
| 25 | 25 | |
| r30616 | r30617 | |
| 39 | 39 | dev.m_gfxregion = gfxregion; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | void tecmo_spr_device::set_bootleg(device_t &device, int bootleg) |
| 43 | { |
| 44 | tecmo_spr_device &dev = downcast<tecmo_spr_device &>(device); |
| 45 | dev.m_bootleg = bootleg; |
| 46 | } |
| 42 | 47 | |
| 48 | |
| 43 | 49 | static const UINT8 layout[8][8] = |
| 44 | 50 | { |
| 45 | | { 0, 1, 4, 5,16,17,20,21}, |
| 46 | | { 2, 3, 6, 7,18,19,22,23}, |
| 47 | | { 8, 9,12,13,24,25,28,29}, |
| 48 | | {10,11,14,15,26,27,30,31}, |
| 49 | | {32,33,36,37,48,49,52,53}, |
| 50 | | {34,35,38,39,50,51,54,55}, |
| 51 | | {40,41,44,45,56,57,60,61}, |
| 52 | | {42,43,46,47,58,59,62,63} |
| 51 | { 0, 1, 4, 5, 16, 17, 20, 21 }, |
| 52 | { 2, 3, 6, 7, 18, 19, 22, 23 }, |
| 53 | { 8, 9, 12, 13, 24, 25, 28, 29 }, |
| 54 | { 10, 11, 14, 15, 26, 27, 30, 31 }, |
| 55 | { 32, 33, 36, 37, 48, 49, 52, 53 }, |
| 56 | { 34, 35, 38, 39, 50, 51, 54, 55 }, |
| 57 | { 40, 41, 44, 45, 56, 57, 60, 61 }, |
| 58 | { 42, 43, 46, 47, 58, 59, 62, 63 } |
| 53 | 59 | }; |
| 54 | 60 | |
| 55 | 61 | |
| r30616 | r30617 | |
| 74 | 80 | |
| 75 | 81 | #define NUM_SPRITES 256 |
| 76 | 82 | |
| 77 | | void tecmo_spr_device::gaiden_draw_sprites( screen_device &screen, gfxdecode_device *gfxdecode, const rectangle &cliprect, UINT16* spriteram, int sprite_sizey, int spr_offset_y, int flip_screen, bitmap_ind16 &sprite_bitmap ) |
| 83 | void tecmo_spr_device::gaiden_draw_sprites(screen_device &screen, gfxdecode_device *gfxdecode, const rectangle &cliprect, UINT16* spriteram, int sprite_sizey, int spr_offset_y, int flip_screen, bitmap_ind16 &sprite_bitmap) |
| 78 | 84 | { |
| 79 | 85 | gfx_element *gfx = gfxdecode->gfx(m_gfxregion); |
| 80 | 86 | UINT16 *source; |
| r30616 | r30617 | |
| 93 | 99 | int colour_word = 2; |
| 94 | 100 | int yposition_word = 3; |
| 95 | 101 | int xposition_word = 4; |
| 96 | | int enable_word = attributes_word; |
| 97 | 102 | |
| 98 | 103 | int xmask; |
| 99 | 104 | |
| r30616 | r30617 | |
| 106 | 111 | while (count--) |
| 107 | 112 | { |
| 108 | 113 | UINT32 attributes = source[attributes_word]; |
| 109 | | int col,row; |
| 114 | int col, row; |
| 110 | 115 | |
| 111 | | if (source[enable_word] & 0x04) |
| 116 | int enabled = source[attributes_word] & 0x04; |
| 117 | |
| 118 | if (enabled) |
| 119 | { |
| 120 | if (m_bootleg == 1) |
| 121 | { |
| 122 | // I don't think the galspinbl / hotpinbl bootlegs have blending, instead they use this bit to flicker sprites on/off each frame, so handle it here (we can't handle it in the mixing) |
| 123 | // alternatively these sprites could just be disabled like the tiles marked with the 'mix' bit appear to be (they're only used for ball / flipper trails afaik) |
| 124 | if (source[attributes_word] & 0x0040) |
| 125 | { |
| 126 | int frame = screen.frame_number() & 1; |
| 127 | if (frame==1) |
| 128 | enabled = 0; |
| 129 | } |
| 130 | |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | if (enabled) |
| 112 | 135 | { |
| 113 | 136 | UINT32 flipx = (attributes & 1); |
| 114 | 137 | UINT32 flipy = (attributes & 2); |
| r30616 | r30617 | |
| 184 | 207 | } |
| 185 | 208 | } |
| 186 | 209 | |
| 187 | | // comad bootleg of spbactn |
| 188 | | |
| 189 | | /* sprite format (galspnbl): |
| 190 | | * |
| 191 | | * word bit usage |
| 192 | | * --------+-fedcba9876543210-+---------------- |
| 193 | | * 0 | ---------------x | flip x |
| 194 | | * | --------------x- | flip y |
| 195 | | * | -------------x-- | enable |
| 196 | | * | ----------xx---- | priority? |
| 197 | | * | ---------x------ | flicker? |
| 198 | | * 1 | xxxxxxxxxxxxxxxx | code |
| 199 | | * 2 | --------xxxx---- | color |
| 200 | | * | --------------xx | size: 8x8, 16x16, 32x32, 64x64 |
| 201 | | * 3 | xxxxxxxxxxxxxxxx | y position |
| 202 | | * 4 | xxxxxxxxxxxxxxxx | x position |
| 203 | | * 5,6,7| | unused |
| 204 | | */ |
| 205 | | |
| 206 | | void tecmo_spr_device::galspnbl_draw_sprites( screen_device &screen, gfxdecode_device *gfxdecode, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, UINT16* spriteram, int spriteram_bytes ) |
| 207 | | { |
| 208 | | int offs; |
| 209 | | |
| 210 | | |
| 211 | | for (offs = (spriteram_bytes - 16) / 2; offs >= 0; offs -= 8) |
| 212 | | { |
| 213 | | int sx, sy, code, color, size, attr, flipx, flipy; |
| 214 | | int col, row; |
| 215 | | |
| 216 | | attr = spriteram[offs]; |
| 217 | | if ((attr & 0x0004) && ((attr & 0x0040) == 0 || (screen.frame_number() & 1)) |
| 218 | | // && ((attr & 0x0030) >> 4) == priority) |
| 219 | | && ((attr & 0x0020) >> 5) == priority) |
| 220 | | { |
| 221 | | code = spriteram[offs + 1]; |
| 222 | | color = spriteram[offs + 2]; |
| 223 | | size = 1 << (color & 0x0003); // 1,2,4,8 |
| 224 | | color = (color & 0x00f0) >> 4; |
| 225 | | // sx = spriteram[offs + 4] + screenscroll; |
| 226 | | sx = spriteram[offs + 4]; |
| 227 | | sy = spriteram[offs + 3]; |
| 228 | | flipx = attr & 0x0001; |
| 229 | | flipy = attr & 0x0002; |
| 230 | | |
| 231 | | for (row = 0; row < size; row++) |
| 232 | | { |
| 233 | | for (col = 0; col < size; col++) |
| 234 | | { |
| 235 | | int x = sx + 8 * (flipx ? (size - 1 - col) : col); |
| 236 | | int y = sy + 8 * (flipy ? (size - 1 - row) : row); |
| 237 | | gfxdecode->gfx(m_gfxregion)->transpen(bitmap,cliprect, |
| 238 | | code + layout[row][col], |
| 239 | | color, |
| 240 | | flipx,flipy, |
| 241 | | x,y,0); |
| 242 | | |
| 243 | | } |
| 244 | | } |
| 245 | | } |
| 246 | | } |
| 247 | | } |