Mercurial > repos > blastem
comparison vdp.c @ 748:45b62d237b7b
Fixed shadow/highlight mode
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 30 May 2015 15:53:59 -0700 |
parents | 2174f92c5f9b |
children | 483f7e7926a6 |
comparison
equal
deleted
inserted
replaced
747:85c98a222fea | 748:45b62d237b7b |
---|---|
807 plane_b_off = context->buf_b_off - (context->hscroll_b & 0xF); | 807 plane_b_off = context->buf_b_off - (context->hscroll_b & 0xF); |
808 //printf("A | tmp_buf offset: %d\n", 8 - (context->hscroll_a & 0x7)); | 808 //printf("A | tmp_buf offset: %d\n", 8 - (context->hscroll_a & 0x7)); |
809 | 809 |
810 if (context->regs[REG_MODE_4] & BIT_HILIGHT) { | 810 if (context->regs[REG_MODE_4] & BIT_HILIGHT) { |
811 for (int i = 0; i < 16; ++plane_a_off, ++plane_b_off, ++sprite_buf, ++i) { | 811 for (int i = 0; i < 16; ++plane_a_off, ++plane_b_off, ++sprite_buf, ++i) { |
812 uint8_t pixel; | |
813 plane_a = context->tmp_buf_a + (plane_a_off & SCROLL_BUFFER_MASK); | 812 plane_a = context->tmp_buf_a + (plane_a_off & SCROLL_BUFFER_MASK); |
814 plane_b = context->tmp_buf_b + (plane_b_off & SCROLL_BUFFER_MASK); | 813 plane_b = context->tmp_buf_b + (plane_b_off & SCROLL_BUFFER_MASK); |
815 uint32_t * colors = context->colors; | 814 uint8_t pixel = context->regs[REG_BG_COLOR]; |
816 src = 0; | 815 uint32_t *colors = context->colors; |
817 pixel = context->regs[REG_BG_COLOR]; | |
818 src = DBG_SRC_BG; | 816 src = DBG_SRC_BG; |
819 if (*plane_b & 0xF) { | 817 if (*plane_b & 0xF) { |
820 pixel = *plane_b; | 818 pixel = *plane_b; |
821 src = DBG_SRC_B; | 819 src = DBG_SRC_B; |
822 } | 820 } |
821 uint8_t intensity = *plane_b & BUF_BIT_PRIORITY; | |
823 if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { | 822 if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { |
824 pixel = *plane_a; | 823 pixel = *plane_a; |
825 src = DBG_SRC_A; | 824 src = DBG_SRC_A; |
826 } | 825 } |
827 if (*sprite_buf & 0xF) { | 826 intensity |= *plane_a & BUF_BIT_PRIORITY; |
828 uint8_t sprite_color = *sprite_buf & 0x3F; | 827 if (*sprite_buf & 0xF && (*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { |
829 if (sprite_color == 0x3E) { | 828 if ((*sprite_buf & 0x3F) == 0x3E) { |
830 colors += CRAM_SIZE*2; | 829 intensity += BUF_BIT_PRIORITY; |
831 src |= DBG_HILIGHT; | 830 } else if ((*sprite_buf & 0x3F) == 0x3F) { |
832 } else if (sprite_color == 0x3F) { | 831 intensity = 0; |
833 colors += CRAM_SIZE; | 832 } else { |
834 src |= DBG_SHADOW; | |
835 } else if ((*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { | |
836 pixel = *sprite_buf; | 833 pixel = *sprite_buf; |
837 src = DBG_SRC_S; | 834 src = DBG_SRC_S; |
838 if ((pixel & 0xF) == 0xE) { | 835 if ((pixel & 0xF) == 0xE) { |
839 src |= DBG_SHADOW; | 836 intensity = BUF_BIT_PRIORITY; |
840 colors += CRAM_SIZE; | 837 } else { |
838 intensity |= pixel & BUF_BIT_PRIORITY; | |
841 } | 839 } |
842 | |
843 } | 840 } |
844 } else if (!((*plane_a | *plane_b) & BUF_BIT_PRIORITY)) { | 841 } |
842 if (!intensity) { | |
843 src |= DBG_SHADOW; | |
845 colors += CRAM_SIZE; | 844 colors += CRAM_SIZE; |
846 src |= DBG_SHADOW; | 845 } else if (intensity == BUF_BIT_PRIORITY*2) { |
846 src |= DBG_HILIGHT; | |
847 colors += CRAM_SIZE*2; | |
847 } | 848 } |
848 pixel &= 0x3F; | 849 |
849 uint32_t outpixel; | 850 uint32_t outpixel; |
850 if (context->debug) { | 851 if (context->debug) { |
851 outpixel = context->debugcolors[src]; | 852 outpixel = context->debugcolors[src]; |
852 } else { | 853 } else { |
853 outpixel = colors[pixel]; | 854 outpixel = colors[pixel & 0x3F]; |
854 } | 855 } |
855 *(dst++) = outpixel; | 856 *(dst++) = outpixel; |
856 //*dst = (context->cram[pixel & 0x3F] & 0xEEE) | ((pixel & BUF_BIT_PRIORITY) ? FBUF_BIT_PRIORITY : 0) | src; | |
857 } | 857 } |
858 } else { | 858 } else { |
859 for (int i = 0; i < 16; ++plane_a_off, ++plane_b_off, ++sprite_buf, ++i) { | 859 for (int i = 0; i < 16; ++plane_a_off, ++plane_b_off, ++sprite_buf, ++i) { |
860 plane_a = context->tmp_buf_a + (plane_a_off & SCROLL_BUFFER_MASK); | 860 plane_a = context->tmp_buf_a + (plane_a_off & SCROLL_BUFFER_MASK); |
861 plane_b = context->tmp_buf_b + (plane_b_off & SCROLL_BUFFER_MASK); | 861 plane_b = context->tmp_buf_b + (plane_b_off & SCROLL_BUFFER_MASK); |