comparison vdp.c @ 1346:f7ca42e020fd

Fix sprite rendering in double resolution interlace mode
author Michael Pavone <pavone@retrodev.com>
date Fri, 05 May 2017 23:45:45 -0700
parents 6372de4da179
children 5ee19c72fa95
comparison
equal deleted inserted replaced
1345:696a029d09e9 1346:f7ca42e020fd
577 context->sprite_index = 0; 577 context->sprite_index = 0;
578 return; 578 return;
579 } 579 }
580 uint16_t address = context->sprite_index * 4; 580 uint16_t address = context->sprite_index * 4;
581 line += ymin; 581 line += ymin;
582 line &= 0x1FF; 582 line &= ymask;
583 uint16_t y = ((context->sat_cache[address] & 0x3) << 8 | context->sat_cache[address+1]) & ymask; 583 uint16_t y = ((context->sat_cache[address] & 0x3) << 8 | context->sat_cache[address+1]) & ymask;
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);
691 uint16_t att_addr = mode5_sat_address(context) + context->sprite_info_list[context->cur_slot].index * 8 + 4; 691 uint16_t att_addr = mode5_sat_address(context) + context->sprite_info_list[context->cur_slot].index * 8 + 4;
692 uint16_t tileinfo = (context->vdpmem[att_addr] << 8) | context->vdpmem[att_addr+1]; 692 uint16_t tileinfo = (context->vdpmem[att_addr] << 8) | context->vdpmem[att_addr+1];
693 uint8_t pal_priority = (tileinfo >> 9) & 0x70; 693 uint8_t pal_priority = (tileinfo >> 9) & 0x70;
694 uint8_t row; 694 uint8_t row;
695 uint16_t cache_addr = context->sprite_info_list[context->cur_slot].index * 4; 695 uint16_t cache_addr = context->sprite_info_list[context->cur_slot].index * 4;
696 line = (line + ymin) & 0x1FF; 696 line = (line + ymin) & ymask;
697 int16_t y = ((context->sat_cache[cache_addr] << 8 | context->sat_cache[cache_addr+1]) & ymask)/* - ymin*/; 697 int16_t y = ((context->sat_cache[cache_addr] << 8 | context->sat_cache[cache_addr+1]) & ymask)/* - ymin*/;
698 if (tileinfo & MAP_BIT_V_FLIP) { 698 if (tileinfo & MAP_BIT_V_FLIP) {
699 row = (y + height - 1) - line; 699 row = (y + height - 1) - line;
700 } else { 700 } else {
701 row = line-y; 701 row = line-y;