Mercurial > repos > blastem
comparison vdp.c @ 1358:3716b90d3470
Fix regression in Mode 4 sprite rendering
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 11 May 2017 20:33:31 -0700 |
parents | 5ee19c72fa95 |
children | 1679ea04c449 |
comparison
equal
deleted
inserted
replaced
1357:5ee19c72fa95 | 1358:3716b90d3470 |
---|---|
584 uint8_t height = ((context->sat_cache[address+2] & 0x3) + 1) * height_mult; | 584 uint8_t height = ((context->sat_cache[address+2] & 0x3) + 1) * height_mult; |
585 //printf("Sprite %d | y: %d, height: %d\n", context->sprite_index, y, height); | 585 //printf("Sprite %d | y: %d, height: %d\n", context->sprite_index, y, height); |
586 if (y <= line && line < (y + height)) { | 586 if (y <= line && line < (y + height)) { |
587 //printf("Sprite %d at y: %d with height %d is on line %d\n", context->sprite_index, y, height, line); | 587 //printf("Sprite %d at y: %d with height %d is on line %d\n", context->sprite_index, y, height, line); |
588 context->sprite_info_list[context->slot_counter].size = context->sat_cache[address+2]; | 588 context->sprite_info_list[context->slot_counter].size = context->sat_cache[address+2]; |
589 context->sprite_info_list[context->slot_counter].index = context->sprite_index; | 589 context->sprite_info_list[context->slot_counter++].index = context->sprite_index; |
590 context->sprite_info_list[context->slot_counter++].y = y-ymin; | |
591 } | 590 } |
592 context->sprite_index = context->sat_cache[address+3] & 0x7F; | 591 context->sprite_index = context->sat_cache[address+3] & 0x7F; |
593 if (context->sprite_index && ((uint8_t)context->slot_counter) < context->max_sprites_line) | 592 if (context->sprite_index && ((uint8_t)context->slot_counter) < context->max_sprites_line) |
594 { | 593 { |
595 //TODO: Implement squirelly behavior documented by Kabuto | 594 //TODO: Implement squirelly behavior documented by Kabuto |
602 height = ((context->sat_cache[address+2] & 0x3) + 1) * height_mult; | 601 height = ((context->sat_cache[address+2] & 0x3) + 1) * height_mult; |
603 //printf("Sprite %d | y: %d, height: %d\n", context->sprite_index, y, height); | 602 //printf("Sprite %d | y: %d, height: %d\n", context->sprite_index, y, height); |
604 if (y <= line && line < (y + height)) { | 603 if (y <= line && line < (y + height)) { |
605 //printf("Sprite %d at y: %d with height %d is on line %d\n", context->sprite_index, y, height, line); | 604 //printf("Sprite %d at y: %d with height %d is on line %d\n", context->sprite_index, y, height, line); |
606 context->sprite_info_list[context->slot_counter].size = context->sat_cache[address+2]; | 605 context->sprite_info_list[context->slot_counter].size = context->sat_cache[address+2]; |
607 context->sprite_info_list[context->slot_counter].index = context->sprite_index; | 606 context->sprite_info_list[context->slot_counter++].index = context->sprite_index; |
608 context->sprite_info_list[context->slot_counter++].y = y-ymin; | |
609 } | 607 } |
610 context->sprite_index = context->sat_cache[address+3] & 0x7F; | 608 context->sprite_index = context->sat_cache[address+3] & 0x7F; |
611 } | 609 } |
612 } | 610 } |
613 //TODO: Seems like the overflow flag should be set here if we run out of sprite info slots without hitting the end of the list | 611 //TODO: Seems like the overflow flag should be set here if we run out of sprite info slots without hitting the end of the list |
633 context->flags |= FLAG_DOT_OFLOW; | 631 context->flags |= FLAG_DOT_OFLOW; |
634 return; | 632 return; |
635 } | 633 } |
636 context->sprite_info_list[--(context->slot_counter)].size = size; | 634 context->sprite_info_list[--(context->slot_counter)].size = size; |
637 context->sprite_info_list[context->slot_counter].index = context->sprite_index; | 635 context->sprite_info_list[context->slot_counter].index = context->sprite_index; |
636 context->sprite_info_list[context->slot_counter].y = y; | |
638 } | 637 } |
639 context->sprite_index++; | 638 context->sprite_index++; |
640 } | 639 } |
641 | 640 |
642 if (context->sprite_index < MAX_SPRITES_FRAME_H32) { | 641 if (context->sprite_index < MAX_SPRITES_FRAME_H32) { |
651 context->flags |= FLAG_DOT_OFLOW; | 650 context->flags |= FLAG_DOT_OFLOW; |
652 return; | 651 return; |
653 } | 652 } |
654 context->sprite_info_list[--(context->slot_counter)].size = size; | 653 context->sprite_info_list[--(context->slot_counter)].size = size; |
655 context->sprite_info_list[context->slot_counter].index = context->sprite_index; | 654 context->sprite_info_list[context->slot_counter].index = context->sprite_index; |
655 context->sprite_info_list[context->slot_counter].y = y; | |
656 } | 656 } |
657 context->sprite_index++; | 657 context->sprite_index++; |
658 } | 658 } |
659 } | 659 } |
660 | 660 |