Previous 15994 Revisions Next

r7636 Wednesday 24th March, 2010 at 18:29:59 UTC by Fabio Priuli
[SNES] wip:
- Added proper sprite priorities
- Added pseudo-hires effect
- Added Driver Configuration option to turn on pixel blurring for hires & pseudo hires graphics
[src/mame/video]snes.c

src/mame/video/snes.c
r7635r7636
297297            if (scanlines[SNES_MAINSCREEN].priority[ii] <= priority)
298298            {
299299               UINT8 clr = colour;
300               UINT8 mask = snes_ppu.clipmasks[layer][ii];
300               UINT8 clipmask = snes_ppu.clipmasks[layer][ii];
301301               UINT8 mosaic = snes_ppu.layer[SNES_MAINSCREEN].mosaic_enabled;
302302
303303#ifdef SNES_LAYER_DEBUG
304304               if (debug_options.windows_disabled)
305                  mask = 0xff;
305                  clipmask = 0xff;
306306               if (debug_options.mosaic_disabled)
307307                  mosaic = 0;
308308#endif /* SNES_LAYER_DEBUG */
309309
310310               /* Clip to windows */
311311               if (scanlines[SNES_MAINSCREEN].clip)
312                  clr &= mask;
312                  clr &= clipmask;
313313
314314               /* Only draw if we have a colour (0 == transparent) */
315315               if (clr)
r7635r7636
333333                        scanlines[SNES_MAINSCREEN].buffer[ii + x_mos] = c;
334334                        scanlines[SNES_MAINSCREEN].priority[ii + x_mos] = priority;
335335                        scanlines[SNES_MAINSCREEN].layer[ii + x_mos] = layer;
336                        scanlines[SNES_MAINSCREEN].blend_exception[ii + x_mos] = 0;
336337                     }
337338
338339                     ii += x_mos - 1;
r7635r7636
342343                     scanlines[SNES_MAINSCREEN].buffer[ii] = c;
343344                     scanlines[SNES_MAINSCREEN].priority[ii] = priority;
344345                     scanlines[SNES_MAINSCREEN].layer[ii] = layer;
346                     scanlines[SNES_MAINSCREEN].blend_exception[ii] = 0;
345347                  }
346348               }
347349            }
r7635r7636
352354            if (scanlines[SNES_SUBSCREEN].priority[ii] <= priority)
353355            {
354356               UINT8 clr = colour;
355               UINT8 mask = snes_ppu.clipmasks[layer][ii];
357               UINT8 clipmask = snes_ppu.clipmasks[layer][ii];
356358               UINT8 mosaic = snes_ppu.layer[SNES_SUBSCREEN].mosaic_enabled;
357359
358360#ifdef SNES_LAYER_DEBUG
359361               if (debug_options.windows_disabled)
360                  mask = 0xff;
362                  clipmask = 0xff;
361363               if (debug_options.mosaic_disabled)
362364                  mosaic = 0;
363365#endif /* SNES_LAYER_DEBUG */
364366
365367               /* Clip to windows */
366368               if (scanlines[SNES_SUBSCREEN].clip)
367                  clr &= mask;
369                  clr &= clipmask;
368370
369371               /* Only draw if we have a colour (0 == transparent) */
370372               if (clr)
r7635r7636
388390                        scanlines[SNES_SUBSCREEN].buffer[ii + x_mos] = c;
389391                        scanlines[SNES_SUBSCREEN].priority[ii + x_mos] = priority;
390392                        scanlines[SNES_SUBSCREEN].layer[ii + x_mos] = layer;
393                        scanlines[SNES_SUBSCREEN].blend_exception[ii + x_mos] = 0;
391394                     }
392395
393396                     ii += x_mos - 1;
r7635r7636
397400                     scanlines[SNES_SUBSCREEN].buffer[ii] = c;
398401                     scanlines[SNES_SUBSCREEN].priority[ii] = priority;
399402                     scanlines[SNES_SUBSCREEN].layer[ii] = layer;
403                     scanlines[SNES_SUBSCREEN].blend_exception[ii] = 0;
400404                  }
401405               }
402406            }
r7635r7636
409413            if (scanlines[SNES_MAINSCREEN].priority[ii >> 1] <= priority)
410414            {
411415               UINT8 clr = colour;
412               UINT8 mask = snes_ppu.clipmasks[layer][ii];
416               UINT8 clipmask = snes_ppu.clipmasks[layer][ii];
413417               UINT8 mosaic = snes_ppu.layer[SNES_MAINSCREEN].mosaic_enabled;
414418
415419#ifdef SNES_LAYER_DEBUG
416420               if (debug_options.windows_disabled)
417                  mask = 0xff;
421                  clipmask = 0xff;
418422               if (debug_options.mosaic_disabled)
419423                  mosaic = 0;
420424#endif /* SNES_LAYER_DEBUG */
421425
422426               /* Clip to windows */
423427               if (scanlines[SNES_MAINSCREEN].clip)
424                  clr &= mask;
428                  clr &= clipmask;
425429
426430               /* Only draw if we have a colour (0 == transparent) */
427431               if (clr)
r7635r7636
445449                        scanlines[SNES_MAINSCREEN].buffer[(ii + x_mos) >> 1] = c;
446450                        scanlines[SNES_MAINSCREEN].priority[(ii + x_mos) >> 1] = priority;
447451                        scanlines[SNES_MAINSCREEN].layer[(ii + x_mos) >> 1] = layer;
452                        scanlines[SNES_MAINSCREEN].blend_exception[(ii + x_mos) >> 1] = 0;
448453                     }
449454                     ii += x_mos - 1;
450455                  }
r7635r7636
453458                     scanlines[SNES_MAINSCREEN].buffer[ii >> 1] = c;
454459                     scanlines[SNES_MAINSCREEN].priority[ii >> 1] = priority;
455460                     scanlines[SNES_MAINSCREEN].layer[ii >> 1] = layer;
461                     scanlines[SNES_MAINSCREEN].blend_exception[ii >> 1] = 0;
456462                  }
457463               }
458464            }
r7635r7636
463469            if (scanlines[SNES_SUBSCREEN].priority[ii >> 1] <= priority)
464470            {
465471               UINT8 clr = colour;
466               UINT8 mask = snes_ppu.clipmasks[layer][ii];
472               UINT8 clipmask = snes_ppu.clipmasks[layer][ii];
467473               UINT8 mosaic = snes_ppu.layer[SNES_SUBSCREEN].mosaic_enabled;
468474
469475#ifdef SNES_LAYER_DEBUG
470476               if (debug_options.windows_disabled)
471                  mask = 0xff;
477                  clipmask = 0xff;
472478               if (debug_options.mosaic_disabled)
473479                  mosaic = 0;
474480#endif /* SNES_LAYER_DEBUG */
475481
476482               /* Clip to windows */
477483               if (scanlines[SNES_SUBSCREEN].clip)
478                  clr &= mask;
484                  clr &= clipmask;
479485
480486               /* Only draw if we have a colour (0 == transparent) */
481487               if (clr)
r7635r7636
499505                        scanlines[SNES_SUBSCREEN].buffer[(ii + x_mos) >> 1] = c;
500506                        scanlines[SNES_SUBSCREEN].priority[(ii + x_mos) >> 1] = priority;
501507                        scanlines[SNES_SUBSCREEN].layer[(ii + x_mos) >> 1] = layer;
508                        scanlines[SNES_SUBSCREEN].blend_exception[(ii + x_mos) >> 1] = 0;
502509                     }
503510                     ii += x_mos - 1;
504511                  }
r7635r7636
507514                     scanlines[SNES_SUBSCREEN].buffer[ii >> 1] = c;
508515                     scanlines[SNES_SUBSCREEN].priority[ii >> 1] = priority;
509516                     scanlines[SNES_SUBSCREEN].layer[ii >> 1] = layer;
517                     scanlines[SNES_SUBSCREEN].blend_exception[ii >> 1] = 0;
510518                  }
511519               }
512520            }
r7635r7636
582590
583591      if (pos >= 0 && pos < SNES_SCR_WIDTH && scanlines[SNES_MAINSCREEN].enable)
584592      {
585         if (scanlines[SNES_MAINSCREEN].priority[pos] <= priority)
586593         {
587594            UINT8 clr = colour;
588            UINT8 mask = snes_ppu.clipmasks[SNES_OAM][pos];
595            UINT8 clipmask = snes_ppu.clipmasks[SNES_OAM][pos];
589596
590597#ifdef SNES_LAYER_DEBUG
591598            if (debug_options.windows_disabled)
592               mask = 0xff;
599               clipmask = 0xff;
593600#endif /* SNES_LAYER_DEBUG */
594601
595602            /* Clip to windows */
596603            if (scanlines[SNES_MAINSCREEN].clip)
597               clr &= mask;
604               clr &= clipmask;
598605
599606            /* Only draw if we have a colour (0 == transparent) */
600607            if (clr)
r7635r7636
612619
613620      if (pos >= 0 && pos < SNES_SCR_WIDTH && scanlines[SNES_SUBSCREEN].enable)
614621      {
615         if (scanlines[SNES_SUBSCREEN].priority[pos] <= priority)
616622         {
617623            UINT8 clr = colour;
618            UINT8 mask = snes_ppu.clipmasks[SNES_OAM][pos];
624            UINT8 clipmask = snes_ppu.clipmasks[SNES_OAM][pos];
619625
620626#ifdef SNES_LAYER_DEBUG
621627            if (debug_options.windows_disabled)
622               mask = 0xff;
628               clipmask = 0xff;
623629#endif /* SNES_LAYER_DEBUG */
624630
625631            /* Clip to windows */
626632            if (scanlines[SNES_SUBSCREEN].clip)
627               clr &= mask;
633               clr &= clipmask;
628634
629635            /* Only draw if we have a colour (0 == transparent) */
630636            if (clr)
r7635r7636
707713   if (snes_ppu.layer[layer].mosaic_enabled)
708714      curline -= (curline % (snes_ppu.mosaic_size + 1));
709715
710   if ((snes_ppu.interlace == 2) && !hires)
716   if ((snes_ppu.interlace == 2) && !hires && !snes_ppu.pseudo_hires)
711717      curline /= 2;
712718
713719   /* Find the size of the tiles (8x8 or 16x16) */
r7635r7636
10021008      if (scanlines[SNES_MAINSCREEN].enable)
10031009      {
10041010         UINT8 clr = colour;
1005         UINT8 mask = snes_ppu.clipmasks[layer][xpos];
1011         UINT8 clipmask = snes_ppu.clipmasks[layer][xpos];
10061012
10071013#ifdef SNES_LAYER_DEBUG
10081014         if (debug_options.windows_disabled)
1009            mask = 0xff;
1015            clipmask = 0xff;
10101016#endif /* SNES_LAYER_DEBUG */
10111017
10121018         /* Clip to windows */
10131019         if (scanlines[SNES_MAINSCREEN].clip)
1014            clr &= mask;
1020            clr &= clipmask;
10151021
10161022         /* Draw pixel if appropriate */
10171023         if (scanlines[SNES_MAINSCREEN].priority[xpos] <= priority && clr > 0)
r7635r7636
10341040      if (scanlines[SNES_SUBSCREEN].enable)
10351041      {
10361042         UINT8 clr = colour;
1037         UINT8 mask = snes_ppu.clipmasks[layer][xpos];
1043         UINT8 clipmask = snes_ppu.clipmasks[layer][xpos];
10381044
10391045#ifdef SNES_LAYER_DEBUG
10401046         if (debug_options.windows_disabled)
1041            mask = 0xff;
1047            clipmask = 0xff;
10421048#endif /* SNES_LAYER_DEBUG */
10431049
10441050         /* Clip to windows */
10451051         if (scanlines[SNES_SUBSCREEN].clip)
1046            clr &= mask;
1052            clr &= clipmask;
10471053
10481054         /* Draw pixel if appropriate */
10491055         if (scanlines[SNES_SUBSCREEN].priority[xpos] <= priority && clr > 0)
r7635r7636
13751381      return;
13761382#endif /* SNES_LAYER_DEBUG */
13771383
1384   snes_update_objects(3, 6, 9, 12);
1385   snes_update_line(curline, SNES_BG1, 8, 11, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1386   snes_update_line(curline, SNES_BG2, 7, 10, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1387   snes_update_line(curline, SNES_BG3, 2, 5,  SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
13781388   snes_update_line(curline, SNES_BG4, 1, 4,  SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1379   snes_update_line(curline, SNES_BG3, 2, 5,  SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1380   snes_update_line(curline, SNES_BG2, 7, 10, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1381   snes_update_line(curline, SNES_BG1, 8, 11, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1382   snes_update_objects(3, 6, 9, 12);
13831389}
13841390
13851391static void snes_update_mode_1( UINT16 curline )
r7635r7636
13911397
13921398   if (!snes_ppu.bg3_priority_bit)
13931399   {
1400      snes_update_objects(2, 4, 7, 10);
1401      snes_update_line(curline, SNES_BG1, 6, 9, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1402      snes_update_line(curline, SNES_BG2, 5, 8, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
13941403      snes_update_line(curline, SNES_BG3, 1, 3, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1395      snes_update_line(curline, SNES_BG2, 5, 8, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1396      snes_update_line(curline, SNES_BG1, 6, 9, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1397      snes_update_objects(2, 4, 7, 10);
13981404   }
13991405   else
14001406   {
1407      snes_update_objects(2, 3, 6, 9);
1408      snes_update_line(curline, SNES_BG1, 5, 8,  SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1409      snes_update_line(curline, SNES_BG2, 4, 7,  SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
14011410      snes_update_line(curline, SNES_BG3, 1, 10, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0);
1402      snes_update_line(curline, SNES_BG2, 4, 7,  SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1403      snes_update_line(curline, SNES_BG1, 5, 8,  SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1404      snes_update_objects(2, 3, 6, 9);
14051411   }
14061412}
14071413
r7635r7636
14121418      return;
14131419#endif /* SNES_LAYER_DEBUG */
14141420
1421   snes_update_objects(2, 4, 6, 8);
1422   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_MODE2, 0);
14151423   snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_MODE2, 0);
1416   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_MODE2, 0);
1417   snes_update_objects(2, 4, 6, 8);
14181424}
14191425
14201426static void snes_update_mode_3( UINT16 curline )
r7635r7636
14241430      return;
14251431#endif /* SNES_LAYER_DEBUG */
14261432
1433   snes_update_objects(2, 4, 6, 8);
1434   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_8BPP, 0, SNES_OPT_NONE, snes_ppu.direct_color);
14271435   snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0);
1428   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_8BPP, 0, SNES_OPT_NONE, snes_ppu.direct_color);
1429   snes_update_objects(2, 4, 6, 8);
14301436}
14311437
14321438static void snes_update_mode_4( UINT16 curline )
r7635r7636
14361442      return;
14371443#endif /* SNES_LAYER_DEBUG */
14381444
1445   snes_update_objects(2, 4, 6, 8);
1446   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_8BPP, 0, SNES_OPT_MODE4, snes_ppu.direct_color);
14391447   snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_MODE4, 0);
1440   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_8BPP, 0, SNES_OPT_MODE4, snes_ppu.direct_color);
1441   snes_update_objects(2, 4, 6, 8);
14421448}
14431449
14441450static void snes_update_mode_5( UINT16 curline )
r7635r7636
14481454      return;
14491455#endif /* SNES_LAYER_DEBUG */
14501456
1457   snes_update_objects(2, 4, 6, 8);
1458   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_4BPP, 1, SNES_OPT_NONE, 0);
14511459   snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_2BPP, 1, SNES_OPT_NONE, 0);
1452   snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_4BPP, 1, SNES_OPT_NONE, 0);
1453   snes_update_objects(2, 4, 6, 8);
14541460}
14551461
14561462static void snes_update_mode_6( UINT16 curline )
r7635r7636
14601466      return;
14611467#endif /* SNES_LAYER_DEBUG */
14621468
1469   snes_update_objects(1, 3, 4, 6);
14631470   snes_update_line(curline, SNES_BG1, 2, 5, SNES_COLOR_DEPTH_4BPP, 1, SNES_OPT_MODE6, 0);
1464   snes_update_objects(1, 3, 4, 6);
14651471}
14661472
14671473static void snes_update_mode_7( UINT16 curline )
r7635r7636
14731479
14741480   if (!snes_ppu.mode7.extbg)
14751481   {
1482      snes_update_objects(1, 3, 4, 5);
14761483      snes_update_line_mode7(curline, SNES_BG1, 2, 2);
1477      snes_update_objects(1, 3, 4, 5);
14781484   }
14791485   else
14801486   {
1487      snes_update_objects(2, 4, 6, 7);
1488      snes_update_line_mode7(curline, SNES_BG1, 3, 3);
14811489      snes_update_line_mode7(curline, SNES_BG2, 1, 5);
1482      snes_update_line_mode7(curline, SNES_BG1, 3, 3);
1483      snes_update_objects(2, 4, 6, 7);
14841490   }
14851491}
14861492
r7635r7636
16121618   int fade;
16131619   struct SCANLINE *scanline1, *scanline2;
16141620   UINT16 c;
1621   UINT16 prev_colour = 0;
1622   int average = input_port_read_safe(machine, "OPTIONS", 0) & 0x01;
16151623
16161624   profiler_mark_start(PROFILER_VIDEO);
16171625
r7635r7636
16421650      /* Draw back colour */
16431651      for (ii = 0; ii < SNES_SCR_WIDTH; ii++)
16441652      {
1645         if (snes_ppu.mode == 5 || snes_ppu.mode == 6)
1653         if (snes_ppu.mode == 5 || snes_ppu.mode == 6 || snes_ppu.pseudo_hires)
16461654            scanlines[SNES_SUBSCREEN].buffer[ii] = snes_cgram[0];
16471655         else
16481656            scanlines[SNES_SUBSCREEN].buffer[ii] = snes_cgram[FIXED_COLOUR];
r7635r7636
16851693      for (x = 0; x < SNES_SCR_WIDTH; x++)
16861694      {
16871695         int r, g, b, hires;
1688         hires = (snes_ppu.mode != 5 && snes_ppu.mode != 6) ? 0 : 1;
1689         c = scanline1->buffer[x];
1696         UINT16 tmp_col[2];
1697         hires = (snes_ppu.mode != 5 && snes_ppu.mode != 6 && !snes_ppu.pseudo_hires) ? 0 : 1;
16901698
1691         /* perform color math if the layer wants it (except if it's an object > 192) */
1692         if (!scanline1->blend_exception[x] && snes_ppu.layer[scanline1->layer[x]].color_math)
1693            snes_draw_blend(x, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 0);
1699         /* in hires, the first pixel (of 512) is subscreen pixel, then the first mainscreen pixel follows, and so on... */
1700         if (!hires)
1701         {
1702            c = scanline1->buffer[x];
16941703
1695         r = ((c & 0x1f) * fade) >> 4;
1696         g = (((c & 0x3e0) >> 5) * fade) >> 4;
1697         b = (((c & 0x7c00) >> 10) * fade) >> 4;
1704            /* perform color math if the layer wants it (except if it's an object > 192) */
1705            if (!scanline1->blend_exception[x] && snes_ppu.layer[scanline1->layer[x]].color_math)
1706               snes_draw_blend(x, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 0);
16981707
1699         *BITMAP_ADDR32(bitmap, curline, x * 2 + 1) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1708            r = ((c & 0x1f) * fade) >> 4;
1709            g = (((c & 0x3e0) >> 5) * fade) >> 4;
1710            b = (((c & 0x7c00) >> 10) * fade) >> 4;
17001711
1701         /* in hires, the first pixel (of 512) is subscreen pixel, then the first mainscreen pixel follows, and so on... */
1702         if (!hires)
17031712            *BITMAP_ADDR32(bitmap, curline, x * 2 + 0) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1713            *BITMAP_ADDR32(bitmap, curline, x * 2 + 1) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1714         }
17041715         else
17051716         {
1717            /* prepare the pixel from main screen */
1718            c = scanline1->buffer[x];
1719
1720            /* perform color math if the layer wants it (except if it's an object > 192) */
1721            if (!scanline1->blend_exception[x] && snes_ppu.layer[scanline1->layer[x]].color_math)
1722               snes_draw_blend(x, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 0);
1723
1724            tmp_col[1] = c;
1725
1726            /* prepare the pixel from sub screen */
17061727            c = scanline2->buffer[x];
17071728
17081729            /* in hires, subscreen pixels are blended as well: for each subscreen pixel, color math is applied if
17091730                it had been applied to the previous mainscreen pixel. What happens at subscreen pixel 0 (which has no
17101731                previous mainscreen pixel) is undocumented. Until more info are discovered, we (arbitrarily) apply to it
17111732                the same color math as the *next* mainscreen pixel (i.e. mainscreen pixel 0) */
1712
17131733            if (x == 0 && !scanline1->blend_exception[0] && snes_ppu.layer[scanline1->layer[0]].color_math)
17141734               snes_draw_blend(0, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 1);
17151735            else if (x > 0  && !scanline1->blend_exception[x - 1] && snes_ppu.layer[scanline1->layer[x - 1]].color_math)
17161736               snes_draw_blend(x, &c, snes_ppu.prevent_color_math, snes_ppu.clip_to_black, 1);
17171737
1738            tmp_col[0] = c;
17181739
1740            /* average the first pixel if required, or draw it directly*/
1741            if (average)
1742               c = (prev_colour + tmp_col[0] - ((prev_colour ^ tmp_col[0]) & 0x0421)) >> 1;
1743            else
1744               c = tmp_col[0];
1745
17191746            r = ((c & 0x1f) * fade) >> 4;
17201747            g = (((c & 0x3e0) >> 5) * fade) >> 4;
17211748            b = (((c & 0x7c00) >> 10) * fade) >> 4;
17221749
17231750            *BITMAP_ADDR32(bitmap, curline, x * 2 + 0) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1751            prev_colour = tmp_col[0];
1752
1753
1754            /* average the second pixel if required, or draw it directly*/
1755            if (average)
1756               c = (prev_colour + tmp_col[1] - ((prev_colour ^ tmp_col[1]) & 0x0421)) >> 1;
1757            else
1758               c = tmp_col[1];
1759
1760            r = ((c & 0x1f) * fade) >> 4;
1761            g = (((c & 0x3e0) >> 5) * fade) >> 4;
1762            b = (((c & 0x7c00) >> 10) * fade) >> 4;
1763
1764            *BITMAP_ADDR32(bitmap, curline, x * 2 + 1) = MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b));
1765            prev_colour = tmp_col[1];
17241766         }
17251767      }
17261768   }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team