Previous 199869 Revisions Next

r30598 Thursday 22nd May, 2014 at 17:57:44 UTC by David Haywood
make blend code more flexible so we can put in the alt config spbactnp uses, cleaned up some code in tecmo_spr as a result, actually has proper colours/priority now, still not sue what the extra cpu on the proto does tho!
[src/mame/drivers]spbactn.c
[src/mame/video]spbactn.c tecmo_spr.c tecmo_spr.h

trunk/src/mame/video/spbactn.c
r30597r30598
129129
130130
131131
132
132133   //int frame = (screen.frame_number()) & 1;
133134   // note this game has no tx layer, comments relate to other drivers
134135
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
135169   int y, x;
136170   const pen_t *paldata = m_palette->pens();
137171
r30597r30598
146180      {
147181         UINT16 sprpixel = (sd2[x]);
148182
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;
152186
187
188         sprpixel = (sprpixel & 0xf) | (sprcol << 4);
189
190         //sprpixel &= 0xff;
191
153192         UINT16 fgpixel = (fg[x]);
154193         UINT16 fgbln = (fgpixel & 0x0100) >> 8;
155194         fgpixel &= 0xff;
r30597r30598
173212                  else
174213                  {
175214                     // solid FG
176                     dd[x] = paldata[fgpixel + 0x800 + 0x200];
215                     dd[x] = paldata[fgpixel + fgregular_comp];
177216                  }
178217               }
179218               else if (bgpixel & 0x0f)
180219               {
181220                  // solid BG
182                  dd[x] = paldata[bgpixel + 0x800 + 0x300];
221                  dd[x] = paldata[bgpixel + bgregular_comp];
183222               }
184223               else
185224               {
r30597r30598
190229                  else
191230                  {
192231                     // solid sprite
193                     dd[x] = paldata[sprpixel + 0x800 + 0x000];
232                     dd[x] = paldata[sprpixel + spregular_comp];
194233                  }
195234
196235               }
r30597r30598
208247                        // needs if bgpixel & 0xf check?
209248
210249                        // 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??
212251                     }
213252                     else
214253                     {
215254                        // 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];
217256                     }
218257                  }
219258                  else
220259                  {
221260                     // fg is used and opaque
222                     dd[x] = paldata[fgpixel + 0x800 + 0x200];
261                     dd[x] = paldata[fgpixel + fgregular_comp];
223262                  }
224263
225264               }
r30597r30598
230269                     // needs if bgpixel & 0xf check?
231270
232271                     //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??
234273                  }
235274                  else
236275                  {
237276                     // fg isn't used, sprite is used and is opaque
238                     dd[x] = paldata[sprpixel + 0x800 + 0x000];
277                     dd[x] = paldata[sprpixel + spregular_comp];
239278                  }
240279               }
241280         
r30597r30598
252291               }
253292               else
254293               {
255                  dd[x] = paldata[sprpixel + 0x800 + 0x000];
294                  dd[x] = paldata[sprpixel + spregular_comp];
256295                  //dd[x] = rand();
257296               }
258297               break;
r30597r30598
266305               }
267306               else
268307               {
269                  dd[x] = paldata[sprpixel + 0x800 + 0x000];
308                  dd[x] = paldata[sprpixel + spregular_comp];
270309               }
271310           
272311               break;
r30597r30598
280319               if (fgbln)
281320               {
282321                  // 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];
284323           
285324               }
286325               else
trunk/src/mame/video/tecmo_spr.c
r30597r30598
1919tecmo_spr_device::tecmo_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2020   : device_t(mconfig, TECMO_SPRITE, "Teccmo 16-bit Sprite", tag, owner, clock, "tecmo_spr", __FILE__),
2121      device_video_interface(mconfig, *this),
22      m_gfxregion(0),
23      m_altformat(0)
22      m_gfxregion(0)
2423{
2524}
2625
r30597r30598
4039   dev.m_gfxregion = gfxregion;
4140}
4241
43void 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}
4842
49
5043static const UINT8 layout[8][8] =
5144{
5245   { 0, 1, 4, 5,16,17,20,21},
r30597r30598
110103   int xposition_word = 4;
111104   int enable_word = attributes_word;
112105
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
119106   int xmask;
120107
121108   if (screenwidth == 512)
r30597r30598
206193         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)
207194         {
208195
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);
211198            bitmap = &bitmap_prihack;
212199         }
213200
trunk/src/mame/video/tecmo_spr.h
r30597r30598
88public:
99   tecmo_spr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
1010   static void set_gfx_region(device_t &device, int gfxregion);
11   static void set_alt_format(device_t &device);
1211
1312   void galspnbl_draw_sprites( screen_device &screen, gfxdecode_device *gfxdecode, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, UINT16* spriteram, int spriteram_bytes );
1413   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 );
r30597r30598
1918   virtual void device_reset();
2019
2120   UINT8 m_gfxregion;
22   int m_altformat; // the super pinball action proto has some differences
2321
2422private:
2523};
r30597r30598
3028#define MCFG_TECMO_SPRITE_GFX_REGION(_region) \
3129   tecmo_spr_device::set_gfx_region(*device, _region);
3230
33#define MCFG_TECMO_SPRITE_ALT_FORMAT \
34   tecmo_spr_device::set_alt_format(*device);
trunk/src/mame/drivers/spbactn.c
r30597r30598
477477
478478   MCFG_DEVICE_ADD("spritegen", TECMO_SPRITE, 0)
479479   MCFG_TECMO_SPRITE_GFX_REGION(2)
480   MCFG_TECMO_SPRITE_ALT_FORMAT
480   //MCFG_TECMO_SPRITE_ALT_FORMAT
481481
482482   /* sound hardware  - different? */
483483   MCFG_SPEAKER_STANDARD_MONO("mono")

Previous 199869 Revisions Next


© 1997-2024 The MAME Team