comparison vdp.c @ 1029:4263dc9cf86d

Fix implementation of sprite collision flag. Old implementation did not make sense.
author Michael Pavone <pavone@retrodev.com>
date Wed, 11 May 2016 22:43:18 -0700
parents e34334e6c682
children 679137a0e78e
comparison
equal deleted inserted replaced
1028:56b1748a8473 1029:4263dc9cf86d
183 dir = 1; 183 dir = 1;
184 } 184 }
185 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x); 185 //printf("Draw Slot %d of %d, Rendering sprite cell from %X to x: %d\n", context->cur_slot, context->sprite_draws, d->address, x);
186 context->cur_slot--; 186 context->cur_slot--;
187 for (uint16_t address = d->address; address != ((d->address+4) & 0xFFFF); address++) { 187 for (uint16_t address = d->address; address != ((d->address+4) & 0xFFFF); address++) {
188 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { 188 if (x >= 0 && x < 320) {
189 if (context->linebuf[x] && (context->vdpmem[address] >> 4)) { 189 if (!(context->linebuf[x] & 0xF)) {
190 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority;
191 } else if (context->vdpmem[address] >> 4) {
190 context->flags2 |= FLAG2_SPRITE_COLLIDE; 192 context->flags2 |= FLAG2_SPRITE_COLLIDE;
191 } 193 }
192 context->linebuf[x] = (context->vdpmem[address] >> 4) | d->pal_priority;
193 } 194 }
194 x += dir; 195 x += dir;
195 if (x >= 0 && x < 320 && !(context->linebuf[x] & 0xF)) { 196 if (x >= 0 && x < 320) {
196 if (context->linebuf[x] && (context->vdpmem[address] & 0xF)) { 197 if (!(context->linebuf[x] & 0xF)) {
198 context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority;
199 } else if (context->vdpmem[address] & 0xF) {
197 context->flags2 |= FLAG2_SPRITE_COLLIDE; 200 context->flags2 |= FLAG2_SPRITE_COLLIDE;
198 } 201 }
199 context->linebuf[x] = (context->vdpmem[address] & 0xF) | d->pal_priority;
200 } 202 }
201 x += dir; 203 x += dir;
202 } 204 }
203 } 205 }
204 } 206 }