Previous 15994 Revisions Next

r5441 Saturday 15th August, 2009 at 22:15:46 UTC by Angelo Salese
[SNES]: Added clip colors to black window function
[src/mame/video]snes.c

src/mame/video/snes.c
r5440r5441
139139 * Routine for additive/subtractive blending
140140 * between the main and sub screens.
141141 *****************************************/
142INLINE void snes_draw_blend(UINT16 offset, UINT16 *colour, UINT8 mode, UINT8 clip )
142INLINE void snes_draw_blend(UINT16 offset, UINT16 *colour, UINT8 mode, UINT8 clip, UINT8 black_pen_clip )
143143{
144   if( (black_pen_clip == SNES_CLIP_ALL2) ||
145      (black_pen_clip == SNES_CLIP_IN && snes_ppu.clipmasks[5][offset]) ||
146      (black_pen_clip == SNES_CLIP_OUT && !snes_ppu.clipmasks[5][offset]))
147      *colour = 0; //clip to black before color math
148
144149   if (clip == SNES_CLIP_ALL2) // blending mode 3 == always OFF
145150      return;
146151
r5440r5441
285290               c = snes_cgram[pal + colour];
286291
287292            if (screen == MAINSCREEN)   /* Only blend main screens */
288               snes_draw_blend(ii/snes_htmult, &c, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4);
293               snes_draw_blend(ii/snes_htmult, &c, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4, (snes_ram[CGWSEL] & 0xc0) >> 6);
289294            if (snes_ppu.layer[layer].mosaic_enabled) // handle horizontal mosaic
290295            {
291296               int x_mos;
r5440r5441
385390         {
386391            c = snes_cgram[pal + colour];
387392            if (blend && screen == MAINSCREEN)   /* Only blend main screens */
388               snes_draw_blend(ii/snes_htmult, &c, snes_ppu.layer[4].blend, (snes_ram[CGWSEL] & 0x30) >> 4);
393               snes_draw_blend(ii/snes_htmult, &c, snes_ppu.layer[4].blend, (snes_ram[CGWSEL] & 0x30) >> 4, (snes_ram[CGWSEL] & 0xc0) >> 6);
389394
390395            scanlines[screen].buffer[ii] = c;
391396            scanlines[screen].zbuf[ii] = priority;
r5440r5441
715720            clr = snes_cgram[colour];
716721         /* Only blend main screens */
717722         if (screen == MAINSCREEN)
718            snes_draw_blend(xpos, &clr, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4);      /* FIXME: Need to support clip mode */
723            snes_draw_blend(xpos, &clr, snes_ppu.layer[layer].blend, (snes_ram[CGWSEL] & 0x30) >> 4, (snes_ram[CGWSEL] & 0xc0) >> 6); /* FIXME: Need to support clip mode */
719724
720725         scanlines[screen].buffer[xpos] = clr;
721726         scanlines[screen].zbuf[xpos] = priority;
r5440r5441
11861191      {
11871192         for(ii = 0; ii < SNES_SCR_WIDTH * snes_htmult; ii++)
11881193         {
1189            snes_draw_blend(ii/snes_htmult, &scanlines[MAINSCREEN].buffer[ii], (snes_ram[CGADSUB] & 0x80) ? SNES_BLEND_SUB : SNES_BLEND_ADD, (snes_ram[CGWSEL] & 0x30) >> 4);
1194            snes_draw_blend(ii/snes_htmult, &scanlines[MAINSCREEN].buffer[ii], (snes_ram[CGADSUB] & 0x80) ? SNES_BLEND_SUB : SNES_BLEND_ADD, (snes_ram[CGWSEL] & 0x30) >> 4, (snes_ram[CGWSEL] & 0xc0) >> 6);
11901195         }
11911196      }
11921197

Previous 15994 Revisions Next


© 1998-2018 The MESS Team