trunk/src/mame/video/spbactn.c
| r30597 | r30598 | |
| 129 | 129 | |
| 130 | 130 | |
| 131 | 131 | |
| 132 | |
| 132 | 133 | //int frame = (screen.frame_number()) & 1; |
| 133 | 134 | // note this game has no tx layer, comments relate to other drivers |
| 134 | 135 | |
| 136 | // mixer shifts |
| 137 | int sprpri_shift; |
| 138 | int sprbln_shift; |
| 139 | int sprcol_shift; |
| 140 | |
| 141 | // when the blend bit is specified in the attribute the source blend palette for that sprite / fg pixel comes from these offsets instead |
| 142 | int sprblend_source = 0x1000 + 0x000; |
| 143 | int fgblend_source = 0x1000 + 0x100; |
| 144 | // the second blend component depends on the pixel we are blending with, the following palettes get used instead of the regular ones |
| 145 | int bgblend_comp = 0x0000 + 0x300; |
| 146 | // int fgblend_comp = 0x0000 + 0x200; |
| 147 | // int txblend_comp = 0x0000 + 0x100; // not used by this game |
| 148 | int spblend_comp = 0x0000 + 0x000; |
| 149 | |
| 150 | // otherwise the regular palettes are |
| 151 | int bgregular_comp = 0x0800 + 0x300; |
| 152 | int fgregular_comp = 0x0800 + 0x200; |
| 153 | // int txregular_comp = 0x0800 + 0x100; // not used by this game |
| 154 | int spregular_comp = 0x0800 + 0x000; |
| 155 | |
| 156 | if (!alt_sprites) // regular spba |
| 157 | { |
| 158 | sprpri_shift = 8; |
| 159 | sprbln_shift = 10; |
| 160 | sprcol_shift = 4; |
| 161 | } |
| 162 | else // proto spba |
| 163 | { |
| 164 | sprpri_shift = 12; |
| 165 | sprbln_shift = 14; |
| 166 | sprcol_shift = 8; |
| 167 | } |
| 168 | |
| 135 | 169 | int y, x; |
| 136 | 170 | const pen_t *paldata = m_palette->pens(); |
| 137 | 171 | |
| r30597 | r30598 | |
| 146 | 180 | { |
| 147 | 181 | UINT16 sprpixel = (sd2[x]); |
| 148 | 182 | |
| 149 | | UINT16 sprpri = (sprpixel & 0x0300) >> 8; |
| 150 | | UINT16 sprbln = (sprpixel & 0x0400) >> 8; |
| 151 | | sprpixel &= 0xff; |
| 183 | UINT16 sprpri = (sprpixel >> sprpri_shift) & 0x3; |
| 184 | UINT16 sprbln = (sprpixel >> sprbln_shift) & 0x1; |
| 185 | UINT16 sprcol = (sprpixel >> sprcol_shift) & 0xf; |
| 152 | 186 | |
| 187 | |
| 188 | sprpixel = (sprpixel & 0xf) | (sprcol << 4); |
| 189 | |
| 190 | //sprpixel &= 0xff; |
| 191 | |
| 153 | 192 | UINT16 fgpixel = (fg[x]); |
| 154 | 193 | UINT16 fgbln = (fgpixel & 0x0100) >> 8; |
| 155 | 194 | fgpixel &= 0xff; |
| r30597 | r30598 | |
| 173 | 212 | else |
| 174 | 213 | { |
| 175 | 214 | // solid FG |
| 176 | | dd[x] = paldata[fgpixel + 0x800 + 0x200]; |
| 215 | dd[x] = paldata[fgpixel + fgregular_comp]; |
| 177 | 216 | } |
| 178 | 217 | } |
| 179 | 218 | else if (bgpixel & 0x0f) |
| 180 | 219 | { |
| 181 | 220 | // solid BG |
| 182 | | dd[x] = paldata[bgpixel + 0x800 + 0x300]; |
| 221 | dd[x] = paldata[bgpixel + bgregular_comp]; |
| 183 | 222 | } |
| 184 | 223 | else |
| 185 | 224 | { |
| r30597 | r30598 | |
| 190 | 229 | else |
| 191 | 230 | { |
| 192 | 231 | // solid sprite |
| 193 | | dd[x] = paldata[sprpixel + 0x800 + 0x000]; |
| 232 | dd[x] = paldata[sprpixel + spregular_comp]; |
| 194 | 233 | } |
| 195 | 234 | |
| 196 | 235 | } |
| r30597 | r30598 | |
| 208 | 247 | // needs if bgpixel & 0xf check? |
| 209 | 248 | |
| 210 | 249 | // fg is used and blended with sprite, sprite is used and blended with bg? -- used on 'trail' of ball when ball is under the transparent area |
| 211 | | dd[x] = paldata[bgpixel + 0x0000 + 0x300] + paldata[sprpixel + 0x1000 + 0x000]; // WRONG?? |
| 250 | dd[x] = paldata[bgpixel + bgblend_comp] + paldata[sprpixel + sprblend_source]; // WRONG?? |
| 212 | 251 | } |
| 213 | 252 | else |
| 214 | 253 | { |
| 215 | 254 | // fg is used and blended with opaque sprite |
| 216 | | dd[x] = paldata[fgpixel + 0x1000 + 0x100] + paldata[sprpixel + 0x000 + 0x000]; |
| 255 | dd[x] = paldata[fgpixel + fgblend_source] + paldata[sprpixel + spblend_comp]; |
| 217 | 256 | } |
| 218 | 257 | } |
| 219 | 258 | else |
| 220 | 259 | { |
| 221 | 260 | // fg is used and opaque |
| 222 | | dd[x] = paldata[fgpixel + 0x800 + 0x200]; |
| 261 | dd[x] = paldata[fgpixel + fgregular_comp]; |
| 223 | 262 | } |
| 224 | 263 | |
| 225 | 264 | } |
| r30597 | r30598 | |
| 230 | 269 | // needs if bgpixel & 0xf check? |
| 231 | 270 | |
| 232 | 271 | //fg isn't used, sprite is used and blended with bg? -- used on trail of ball / flippers |
| 233 | | dd[x] = paldata[bgpixel + 0x0000 + 0x300];/* +paldata[sprpixel + 0x1000 + 0x000];*/ // WRONG?? |
| 272 | dd[x] = paldata[bgpixel + bgblend_comp];/* +paldata[sprpixel + sprblend_source];*/ // WRONG?? |
| 234 | 273 | } |
| 235 | 274 | else |
| 236 | 275 | { |
| 237 | 276 | // fg isn't used, sprite is used and is opaque |
| 238 | | dd[x] = paldata[sprpixel + 0x800 + 0x000]; |
| 277 | dd[x] = paldata[sprpixel + spregular_comp]; |
| 239 | 278 | } |
| 240 | 279 | } |
| 241 | 280 | |
| r30597 | r30598 | |
| 252 | 291 | } |
| 253 | 292 | else |
| 254 | 293 | { |
| 255 | | dd[x] = paldata[sprpixel + 0x800 + 0x000]; |
| 294 | dd[x] = paldata[sprpixel + spregular_comp]; |
| 256 | 295 | //dd[x] = rand(); |
| 257 | 296 | } |
| 258 | 297 | break; |
| r30597 | r30598 | |
| 266 | 305 | } |
| 267 | 306 | else |
| 268 | 307 | { |
| 269 | | dd[x] = paldata[sprpixel + 0x800 + 0x000]; |
| 308 | dd[x] = paldata[sprpixel + spregular_comp]; |
| 270 | 309 | } |
| 271 | 310 | |
| 272 | 311 | break; |
| r30597 | r30598 | |
| 280 | 319 | if (fgbln) |
| 281 | 320 | { |
| 282 | 321 | // needs if bgpixel & 0xf check? |
| 283 | | dd[x] = paldata[fgpixel + 0x1000 + 0x100] + paldata[bgpixel + 0x0000+0x300]; |
| 322 | dd[x] = paldata[fgpixel + fgblend_source] + paldata[bgpixel + 0x0000+0x300]; |
| 284 | 323 | |
| 285 | 324 | } |
| 286 | 325 | else |
trunk/src/mame/video/tecmo_spr.c
| r30597 | r30598 | |
| 19 | 19 | tecmo_spr_device::tecmo_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 20 | 20 | : device_t(mconfig, TECMO_SPRITE, "Teccmo 16-bit Sprite", tag, owner, clock, "tecmo_spr", __FILE__), |
| 21 | 21 | device_video_interface(mconfig, *this), |
| 22 | | m_gfxregion(0), |
| 23 | | m_altformat(0) |
| 22 | m_gfxregion(0) |
| 24 | 23 | { |
| 25 | 24 | } |
| 26 | 25 | |
| r30597 | r30598 | |
| 40 | 39 | dev.m_gfxregion = gfxregion; |
| 41 | 40 | } |
| 42 | 41 | |
| 43 | | void tecmo_spr_device::set_alt_format(device_t &device) |
| 44 | | { |
| 45 | | tecmo_spr_device &dev = downcast<tecmo_spr_device &>(device); |
| 46 | | dev.m_altformat = 1; |
| 47 | | } |
| 48 | 42 | |
| 49 | | |
| 50 | 43 | static const UINT8 layout[8][8] = |
| 51 | 44 | { |
| 52 | 45 | { 0, 1, 4, 5,16,17,20,21}, |
| r30597 | r30598 | |
| 110 | 103 | int xposition_word = 4; |
| 111 | 104 | int enable_word = attributes_word; |
| 112 | 105 | |
| 113 | | if (m_altformat) // spbactn proto, this isn't right..(it's probably just passing the priority / colour bits into the mixer swapped around, so can be handled externally once we output a single bitmap) |
| 114 | | { |
| 115 | | colour_word = 0; |
| 116 | | attributes_word = 2; |
| 117 | | } |
| 118 | | |
| 119 | 106 | int xmask; |
| 120 | 107 | |
| 121 | 108 | if (screenwidth == 512) |
| r30597 | r30598 | |
| 206 | 193 | else // render to a single bitmap, with all priority / colour data mixed in for later processing (assumings sprites can't blend sprites we should probably be doing this) |
| 207 | 194 | { |
| 208 | 195 | |
| 209 | | // this contains the blend bit and the priority bits |
| 210 | | color |= (source[attributes_word] & 0x00f0); |
| 196 | // this contains the blend bit and the priority bits, the spbactn proto uses 0x0300 for priority, spbactn uses 0x0030, others use 0x00c0 |
| 197 | color |= (source[attributes_word] & 0x03f0); |
| 211 | 198 | bitmap = &bitmap_prihack; |
| 212 | 199 | } |
| 213 | 200 | |
trunk/src/mame/video/tecmo_spr.h
| r30597 | r30598 | |
| 8 | 8 | public: |
| 9 | 9 | tecmo_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 10 | 10 | static void set_gfx_region(device_t &device, int gfxregion); |
| 11 | | static void set_alt_format(device_t &device); |
| 12 | 11 | |
| 13 | 12 | void galspnbl_draw_sprites( screen_device &screen, gfxdecode_device *gfxdecode, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, UINT16* spriteram, int spriteram_bytes ); |
| 14 | 13 | int gaiden_draw_sprites( screen_device &screen, gfxdecode_device *gfxdecode, bitmap_ind16 &bitmap_bg, bitmap_ind16 &bitmap_fg, bitmap_ind16 &bitmap_sp, const rectangle &cliprect, UINT16* spriteram, int sprite_sizey, int spr_offset_y, int flipscreen, int pri_hack, bitmap_ind16 &bitmap_prihack ); |
| r30597 | r30598 | |
| 19 | 18 | virtual void device_reset(); |
| 20 | 19 | |
| 21 | 20 | UINT8 m_gfxregion; |
| 22 | | int m_altformat; // the super pinball action proto has some differences |
| 23 | 21 | |
| 24 | 22 | private: |
| 25 | 23 | }; |
| r30597 | r30598 | |
| 30 | 28 | #define MCFG_TECMO_SPRITE_GFX_REGION(_region) \ |
| 31 | 29 | tecmo_spr_device::set_gfx_region(*device, _region); |
| 32 | 30 | |
| 33 | | #define MCFG_TECMO_SPRITE_ALT_FORMAT \ |
| 34 | | tecmo_spr_device::set_alt_format(*device); |