Previous 199869 Revisions Next

r21580 Tuesday 5th March, 2013 at 02:39:14 UTC by David Haywood
blending
[src/mame/drivers]gunpey.c

trunk/src/mame/drivers/gunpey.c
r21579r21580
307307
308308      UINT8 sourcewidth  = (m_wram[count+6] & 0xff);
309309      UINT8 sourceheight = (m_wram[count+7] >> 8);
310
311      //UINT32 col = 0xffffff;
312   //      UINT32 val = (m_wram[count+1] << 16) | ((m_wram[count+2]));
313310      int xsource = ((m_wram[count+2] & 0x003f) << 5) | ((m_wram[count+1] & 0xf800) >> 11);
314311      int ysource = ((m_wram[count+3] & 0x001f) << 6) | ((m_wram[count+2] & 0xfc00) >> 10);
315      //printf("%08x  %04x %04x\n", val, m_wram[count+1],m_wram[count+2] );
316   //   UINT16 xsource = (m_wram[count+2] & 0x00ff << 4) | (m_wram[count+1] & 0xf000 >> 12);
317      //xsource<<=1;
318312
319   //   xsource<<=1;
320   //   ysource <<=2;
313      int alpha =  m_wram[count+1] & 0x1f;
321314
322//      UINT8 testhack = m_vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+0)&0x7ff))];
323//      UINT8 testhack2 = m_vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+1)&0x7ff))];
324315
325      //if (m_wram[count+1] & 0x0010)
326      //   color =  machine.rand()&0xf;
327
328
329
330
331316      UINT16 unused;
332317      if (debug) printf("sprite %04x %04x %04x %04x %04x %04x %04x %04x\n", m_wram[count+0], m_wram[count+1], m_wram[count+2], m_wram[count+3], m_wram[count+4], m_wram[count+5], m_wram[count+6], m_wram[count+7]);
333318
r21579r21580
345330         //printf("zoomed widths %02x %02x heights %02x %02x\n", sourcewidth, zoomwidth, sourceheight, zoomheight);
346331      }
347332
348
349
350//      if ((testhack2 & 0x0f) == 0x08)
351//         return m_wram[count+0] & 0x80;
352
353      //if (debug) printf("testhack1 %02x %02x\n", testhack, testhack2);
354
355333      if(bpp_sel == 0x00)  // 4bpp
356334      {
357335         for(int yi=0;yi<sourceheight;yi++)
r21579r21580
388366                  }
389367
390368                  if(cliprect.contains(x+(xi*2), y+yi))
391                     bitmap.pix16(y+yi, x+(xi*2)) = color_data & 0x7fff;
369                  {
370                     if (alpha==0x00) // a value of 0x00 is solid
371                     {   
372                        bitmap.pix16(y+yi, x+(xi*2)) = color_data & 0x7fff;
373                     }
374                     else
375                     {
376                        UINT16 basecolor = bitmap.pix16(y+yi, x+(xi*2));
377                        int base_r = ((basecolor >> 10)&0x1f)*alpha;
378                        int base_g = ((basecolor >> 5)&0x1f)*alpha;
379                        int base_b = ((basecolor >> 0)&0x1f)*alpha;
380                        int r = ((color_data & 0x7c00) >> 10)*(0x1f-alpha);
381                        int g = ((color_data & 0x03e0) >> 5)*(0x1f-alpha);
382                        int b = ((color_data & 0x001f) >> 0)*(0x1f-alpha);
383                        r = (base_r+r)/0x1f;
384                        g = (base_g+g)/0x1f;
385                        b = (base_b+b)/0x1f;
386                        color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0);
387                        bitmap.pix16(y+yi, x+(xi*2)) = color_data & 0x7fff;
388                     }
389                  }
392390               }
393391
394392               pix = (data & 0xf0)>>4;
r21579r21580
415413                     color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0);
416414                  }
417415
418                  if(cliprect.contains(x+1+(xi*2), y+yi))
419                     bitmap.pix16(y+yi, x+1+(xi*2)) = color_data & 0x7fff;
416                  if(cliprect.contains(x+1+(xi*2),y+yi))
417                  {
418                     if (alpha==0x00) // a value of 0x00 is solid
419                     {   
420                        bitmap.pix16(y+yi, x+1+(xi*2)) = color_data & 0x7fff;
421                     }
422                     else
423                     {
424                        UINT16 basecolor = bitmap.pix16(y+yi, x+1+(xi*2));
425                        int base_r = ((basecolor >> 10)&0x1f)*alpha;
426                        int base_g = ((basecolor >> 5)&0x1f)*alpha;
427                        int base_b = ((basecolor >> 0)&0x1f)*alpha;
428                        int r = ((color_data & 0x7c00) >> 10)*(0x1f-alpha);
429                        int g = ((color_data & 0x03e0) >> 5)*(0x1f-alpha);
430                        int b = ((color_data & 0x001f) >> 0)*(0x1f-alpha);
431                        r = (base_r+r)/0x1f;
432                        g = (base_g+g)/0x1f;
433                        b = (base_b+b)/0x1f;
434                        color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0);
435                        bitmap.pix16(y+yi, x+1+(xi*2)) = color_data & 0x7fff;
436                     }
437
438                  }
439                     
420440               }
421441            }
422442         }
r21579r21580
476496                     color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0);
477497                  }
478498
479                  if(cliprect.contains(x+xi, y+yi))
480                     bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff;
499
500
501                  if(cliprect.contains(x+xi,y+yi))
502                  {
503                     if (alpha==0x00) // a value of 0x00 is solid
504                     {   
505                        bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff;
506                     }
507                     else
508                     {
509                        UINT16 basecolor = bitmap.pix16(y+yi, x+xi);
510                        int base_r = ((basecolor >> 10)&0x1f)*alpha;
511                        int base_g = ((basecolor >> 5)&0x1f)*alpha;
512                        int base_b = ((basecolor >> 0)&0x1f)*alpha;
513                        int r = ((color_data & 0x7c00) >> 10)*(0x1f-alpha);
514                        int g = ((color_data & 0x03e0) >> 5)*(0x1f-alpha);
515                        int b = ((color_data & 0x001f) >> 0)*(0x1f-alpha);
516                        r = (base_r+r)/0x1f;
517                        g = (base_g+g)/0x1f;
518                        b = (base_b+b)/0x1f;
519                        color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0);
520                        bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff;
521                     }
522
523                  }
524                     
481525               }
482526            }
483527         }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team