Mercurial > repos > blastem
changeset 1098:4a726e339d6f
Fix implementation of scaled objects. Implement transparency flag
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 05 Nov 2016 17:16:16 -0700 |
parents | faa3a4617f62 |
children | 9c62edafcf74 |
files | jag_video.c |
diffstat | 1 files changed, 23 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/jag_video.c Sat Nov 05 00:23:11 2016 -0700 +++ b/jag_video.c Sat Nov 05 17:16:16 2016 -0700 @@ -433,33 +433,41 @@ } while (proc_cycles) { - if (context->op.type == OBJ_SCALED && context->op.hscale) { - while (context->op.hremainder <= 0 && context->op.im_bits) { - context->op.im_bits -= context->op.bpp; - context->op.hremainder += context->op.hscale; - } - } if (context->op.im_bits) { uint32_t val = context->op.im_data >> (context->op.im_bits - context->op.bpp); val &= (1 << context->op.bpp) - 1; - context->op.im_bits -= context->op.bpp; - if (context->op.bpp < 16) { - val = context->clut[val + context->op.pal_offset]; + if (val || !context->op.transparent) + { + if (context->op.bpp < 16) { + val = context->clut[val + context->op.pal_offset]; + } + if (context->op.bpp == 32) { + context->write_line_buffer[context->op.lb_offset++] = val >> 16; + } + context->write_line_buffer[context->op.lb_offset++] = val; + } else { + context->op.lb_offset += context->op.bpp == 32 ? 2 : 1; } - if (context->op.bpp == 32) { - context->write_line_buffer[context->op.lb_offset++] = val >> 16; - } - context->write_line_buffer[context->op.lb_offset++] = val; if (context->op.type == OBJ_SCALED) { context->op.hremainder -= 0x20; + while (context->op.hremainder <= 0 && context->op.im_bits) { + context->op.im_bits -= context->op.bpp; + context->op.hremainder += context->op.hscale; + } + } else { + context->op.im_bits -= context->op.bpp; } } if (context->op.im_bits && context->op.bpp < 32 && context->op.type == OBJ_BITMAP && context->op.lb_offset < LINEBUFFER_WORDS) { uint32_t val = context->op.im_data >> (context->op.im_bits - context->op.bpp); val &= (1 << context->op.bpp) - 1; + if (val || !context->op.transparent) + { + val = context->clut[val + context->op.pal_offset]; + context->write_line_buffer[context->op.lb_offset] = val; + } + context->op.lb_offset++; context->op.im_bits -= context->op.bpp; - val = context->clut[val + context->op.pal_offset]; - context->write_line_buffer[context->op.lb_offset++] = val; } context->op_cycles++; proc_cycles--;