fixed zelda line weirdness
This commit is contained in:
parent
97bf116c89
commit
4da737135d
@ -40,6 +40,7 @@ typedef struct {
|
||||
u8 map_x;
|
||||
u8 tile_y;
|
||||
u8 fifo_x;
|
||||
u8 lo_scroll_x;
|
||||
} pixel_fifo_context;
|
||||
|
||||
typedef struct {
|
||||
|
@ -41,7 +41,7 @@ u32 pixel_fifo_pop() {
|
||||
u32 fetch_sprite_pixels(int bit, u32 color, u8 bg_color) {
|
||||
for (int i = 0; i < ppu_get_context()->fetched_entry_count; i++) {
|
||||
int sp_x = (ppu_get_context()->fetched_entries[i].x - 8) +
|
||||
((lcd_get_context()->scroll_x % 8));
|
||||
((ppu_get_context()->pfc.lo_scroll_x));
|
||||
if(ppu_get_context()->rendering_window) {
|
||||
sp_x = (ppu_get_context()->fetched_entries[i].x - 8);
|
||||
}
|
||||
@ -92,7 +92,7 @@ bool pipeline_fifo_add() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int x = ppu_get_context()->pfc.fetch_x - (8 - lcd_get_context()->scroll_x % 8);
|
||||
int x = ppu_get_context()->pfc.fetch_x - (8 - ppu_get_context()->pfc.lo_scroll_x);
|
||||
|
||||
for (int i=0; i<8; i++) {
|
||||
int bit = 7 - i;
|
||||
@ -121,7 +121,7 @@ void pipeline_load_sprite_tile() {
|
||||
oam_line_entry *le = ppu_get_context()->line_sprites;
|
||||
|
||||
while(le) {
|
||||
int sp_x = (le->entry.x - 8) + (lcd_get_context()->scroll_x % 8);
|
||||
int sp_x = (le->entry.x - 8) + (ppu_get_context()->pfc.lo_scroll_x);
|
||||
|
||||
if ((sp_x >= ppu_get_context()->pfc.fetch_x && sp_x < ppu_get_context()->pfc.fetch_x + 8) ||
|
||||
((sp_x + 8) >= ppu_get_context()->pfc.fetch_x && (sp_x + 8) < ppu_get_context()->pfc.fetch_x + 8)) {
|
||||
@ -292,7 +292,7 @@ void pipeline_push_pixel() {
|
||||
|
||||
ppu_get_context()->pfc.pushed_x++;
|
||||
}else {
|
||||
if(ppu_get_context()->pfc.line_x >= (lcd_get_context()->scroll_x % 8)) {
|
||||
if(ppu_get_context()->pfc.line_x >= (ppu_get_context()->pfc.lo_scroll_x)) {
|
||||
ppu_get_context()->video_buffer[ppu_get_context()->pfc.pushed_x +
|
||||
(lcd_get_context()->ly * XRES)] = interpolate(ppu_get_context()->video_buffer[ppu_get_context()->pfc.pushed_x +
|
||||
(lcd_get_context()->ly * XRES)], pixel_data);
|
||||
|
@ -94,6 +94,7 @@ void ppu_mode_oam() {
|
||||
}
|
||||
|
||||
if(ppu_get_context()->line_ticks == 1) {
|
||||
ppu_get_context()->pfc.lo_scroll_x = lcd_get_context()->scroll_x & 0b111;
|
||||
//read oam on the first tick only...
|
||||
ppu_get_context()->line_sprites = 0;
|
||||
ppu_get_context()->line_sprite_count = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user