src/mame/video/snes.c
| r5440 | r5441 | |
| 139 | 139 | * Routine for additive/subtractive blending |
| 140 | 140 | * between the main and sub screens. |
| 141 | 141 | *****************************************/ |
| 142 | | INLINE void snes_draw_blend(UINT16 offset, UINT16 *colour, UINT8 mode, UINT8 clip ) |
| 142 | INLINE void snes_draw_blend(UINT16 offset, UINT16 *colour, UINT8 mode, UINT8 clip, UINT8 black_pen_clip ) |
| 143 | 143 | { |
| 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 | |
| 144 | 149 | if (clip == SNES_CLIP_ALL2) // blending mode 3 == always OFF |
| 145 | 150 | return; |
| 146 | 151 | |
| r5440 | r5441 | |
| 285 | 290 | c = snes_cgram[pal + colour]; |
| 286 | 291 | |
| 287 | 292 | 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); |
| 289 | 294 | if (snes_ppu.layer[layer].mosaic_enabled) // handle horizontal mosaic |
| 290 | 295 | { |
| 291 | 296 | int x_mos; |
| r5440 | r5441 | |
| 385 | 390 | { |
| 386 | 391 | c = snes_cgram[pal + colour]; |
| 387 | 392 | 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); |
| 389 | 394 | |
| 390 | 395 | scanlines[screen].buffer[ii] = c; |
| 391 | 396 | scanlines[screen].zbuf[ii] = priority; |
| r5440 | r5441 | |
| 715 | 720 | clr = snes_cgram[colour]; |
| 716 | 721 | /* Only blend main screens */ |
| 717 | 722 | 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 */ |
| 719 | 724 | |
| 720 | 725 | scanlines[screen].buffer[xpos] = clr; |
| 721 | 726 | scanlines[screen].zbuf[xpos] = priority; |
| r5440 | r5441 | |
| 1186 | 1191 | { |
| 1187 | 1192 | for(ii = 0; ii < SNES_SCR_WIDTH * snes_htmult; ii++) |
| 1188 | 1193 | { |
| 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); |
| 1190 | 1195 | } |
| 1191 | 1196 | } |
| 1192 | 1197 | |