浏览代码

Implement 'negative Y' scrolling

- TMNT now working as expected
master
Nathaniel Walizer 10 个月前
父节点
当前提交
d787867cf2
共有 3 个文件被更改,包括 4 次插入3 次删除
  1. +1
    -1
      Makefile
  2. +2
    -2
      src/ppu.c
  3. +1
    -0
      src/sdl_render.c

+ 1
- 1
Makefile 查看文件

@@ -30,7 +30,7 @@ PFLAGS += -g
#PFLAGS += -DDEBUG_APU
#PFLAGS += -DDEBUG_INPUT
#PFLAGS += -DE6502_DEBUG
PFLAGS += -DE6502_ILLEGAL
#PFLAGS += -DE6502_ILLEGAL
CFLAGS += $(PFLAGS) -Wall -Werror -Wshadow -Wunused -I../ -Isrc/
CFLAGS += -Iinc/$(PLATFORM)/SDL2
LDFLAGS += $(PFLAGS)


+ 2
- 2
src/ppu.c 查看文件

@@ -277,8 +277,8 @@ nes_ppu_Result nes_ppu_run(nes_ppu* ppu, int cycles) {
if ( ppu->scanline > nes_ppu_prerender &&
ppu->scanline < nes_ppu_render) {
ppu->scroll_y++;
if (ppu->scroll_y >= nes_ppu_render_h) {
ppu->scroll_y -= nes_ppu_render_h;
if (ppu->scroll_y == nes_ppu_render_h) {
ppu->scroll_y = 0;
ppu->control ^= 0b10;
}
}


+ 1
- 0
src/sdl_render.c 查看文件

@@ -362,6 +362,7 @@ static void render_bg_scanline(const nes_ppu* ppu,/* int scanline,*/
int page = (ppu->control & ppu_Control_Nametable_Mask);
int x = ppu->scroll_x;
int y = ppu->scroll_y;
if (y >= nes_ppu_render_h) y -= nes_ppu_render_h;
int w = (nes_ppu_render_w - x);
if (!(ppu->mask & ppu_Mask_Left_Back)) {
// Handle column 0 flag - need to fill with transparency


正在加载...
取消
保存