Skip to content

Commit a281520

Browse files
committed
add level select nametable
1 parent 2d9f455 commit a281520

File tree

10 files changed

+101
-47
lines changed

10 files changed

+101
-47
lines changed

sauce/graphics/menus/level select.nss

Lines changed: 29 additions & 29 deletions
Large diffs are not rendered by default.

sauce/graphics/test header.h

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
const unsigned char test header[171]={
2-
0x02,0x01,0x02,0x3f,0x00,0x02,0x67,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,
3-
0x89,0x82,0x83,0x82,0x8b,0x8c,0x8c,0x00,0x02,0x0f,0x90,0x91,0x92,0x93,0x94,0x95,
4-
0x96,0x97,0x98,0x99,0x92,0x93,0x9a,0x9b,0x9c,0x9d,0x00,0x02,0x0f,0xa0,0x00,0xa2,
5-
0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xa2,0xa3,0xaa,0xab,0xac,0xac,0x00,0x02,0xcf,
6-
0xc4,0xc5,0xc6,0xc7,0x00,0x00,0xc0,0xc1,0xc2,0xc3,0x00,0x00,0xc4,0xc5,0xc6,0xc7,
7-
0x00,0x02,0x0f,0xd4,0xd5,0xd6,0xd7,0x00,0x00,0xd0,0xd1,0xd2,0xd3,0x00,0x00,0xc8,
8-
0xc9,0xca,0xd7,0x00,0x02,0x0f,0xe4,0xe5,0xe6,0xe7,0x00,0x00,0xe0,0xe1,0xe2,0xe3,
9-
0x00,0x00,0xd8,0xd9,0xda,0xe7,0x00,0x02,0x0f,0xf4,0xf5,0xf6,0xf7,0x00,0x00,0xf0,
10-
0xf1,0xf2,0xf3,0x00,0x00,0xf4,0xf5,0xf6,0xf7,0x00,0x02,0xfe,0x00,0x02,0x48,0x01,
11-
0x02,0x3f,0x00,0x02,0x09,0x55,0x02,0x03,0x00,0x02,0x0b,0x50,0x40,0x10,0x50,0x00,
12-
0x02,0x03,0x05,0x04,0x01,0x05,0x00,0x02,0x19,0x02,0x00
1+
const unsigned char test header[345]={
2+
0x04,0x01,0x04,0x3f,0x00,0x04,0x05,0x1a,0x1b,0x0e,0x07,0x04,0x03,0x0f,0x0e,0x07,
3+
0x07,0x0f,0x0e,0x07,0x04,0x03,0x0f,0x1a,0x1b,0x00,0x04,0x0d,0x1e,0x17,0x04,0x03,
4+
0x1f,0x14,0x02,0x02,0x15,0x1e,0x17,0x04,0x03,0x1f,0x00,0x04,0x15,0x12,0x11,0x11,
5+
0x13,0x00,0x04,0x73,0x9c,0x06,0x04,0x11,0x9e,0x00,0x04,0x0b,0x06,0x04,0x13,0x00,
6+
0x04,0x0b,0x06,0x04,0x04,0x42,0x52,0x55,0x48,0x06,0x04,0x0a,0x00,0x04,0x0b,0x06,
7+
0x04,0x04,0x4d,0x4f,0x4d,0x45,0x4e,0x54,0x06,0x04,0x08,0x00,0x04,0x0b,0x06,0x04,
8+
0x13,0x00,0x04,0x0b,0x9d,0x06,0x04,0x11,0x9f,0x00,0x04,0x07,0xbc,0x00,0x04,0x19,
9+
0xbe,0x00,0x04,0x03,0xbd,0x00,0x04,0x06,0x4e,0x4f,0x52,0x4d,0x41,0x4c,0x00,0x00,
10+
0x4d,0x4f,0x44,0x45,0x00,0x04,0x06,0xbf,0x00,0x04,0x07,0x08,0x06,0x04,0x11,0x09,
11+
0x00,0x04,0x2e,0x50,0x52,0x41,0x43,0x54,0x49,0x43,0x45,0x00,0x00,0x4d,0x4f,0x44,
12+
0x45,0x00,0x04,0x0e,0x08,0x06,0x04,0x11,0x09,0x00,0x04,0x65,0x10,0x00,0x04,0x1d,
13+
0x10,0x0e,0x0f,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,
14+
0xc7,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0x0e,
15+
0x0f,0x1e,0x1f,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,
16+
0xd7,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0x1e,
17+
0x1f,0x03,0x03,0x0e,0x0f,0x00,0x00,0xe6,0xe7,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,
18+
0xe7,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe0,0xe1,0x00,0x00,0x0e,0x0f,0x03,
19+
0x03,0x02,0x02,0x1e,0x1f,0x10,0x00,0xce,0xcf,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,
20+
0xcf,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xc8,0xc9,0x00,0x10,0x1e,0x1f,0x02,
21+
0x02,0x01,0x04,0x3f,0xff,0xff,0x5f,0xdf,0x7f,0x5f,0xff,0x04,0x09,0xaa,0xae,0xaa,
22+
0x04,0x03,0xab,0xaa,0xaa,0x5e,0x5a,0x04,0x04,0xa5,0xf5,0x04,0x0f,0x71,0x30,0x00,
23+
0x04,0x03,0xc0,0xd4,0x0f,0x04,0x07,0x04,0x00
1324
};

src/chr/dnt/Menu_Difficulties.bin

29 Bytes
Binary file not shown.

src/chr/dnt/Menu_Global.bin

-23 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

src/gamestates/state_menu.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,36 @@ void state_menu() {
5151
}
5252
}
5353

54+
__attribute__((section(".prg_rom_"STR(extra_code_bank)".111")))
55+
const unsigned char pal_levelselect[16]={ 0x11,0x01,0x11,0x30,0x11,0x0f,0x2a,0x39,0x11,0x0f,0x10,0x30,0x11,0x0f,0x21,0x31 };
56+
57+
58+
59+
__attribute__((section(".prg_rom_"STR(extra_code_bank)".111")))
60+
const unsigned char nt_levelselect[345]={
61+
0x04,0x01,0x04,0x3f,0x00,0x04,0x05,0x1a,0x1b,0x0e,0x07,0x04,0x03,0x0f,0x0e,0x07,
62+
0x07,0x0f,0x0e,0x07,0x04,0x03,0x0f,0x1a,0x1b,0x00,0x04,0x0d,0x1e,0x17,0x04,0x03,
63+
0x1f,0x14,0x02,0x02,0x15,0x1e,0x17,0x04,0x03,0x1f,0x00,0x04,0x15,0x12,0x11,0x11,
64+
0x13,0x00,0x04,0x73,0x9c,0x06,0x04,0x11,0x9e,0x00,0x04,0x0b,0x06,0x04,0x13,0x00,
65+
0x04,0x0b,0x06,0x04,0x04,0x42,0x52,0x55,0x48,0x06,0x04,0x0a,0x00,0x04,0x0b,0x06,
66+
0x04,0x04,0x4d,0x4f,0x4d,0x45,0x4e,0x54,0x06,0x04,0x08,0x00,0x04,0x0b,0x06,0x04,
67+
0x13,0x00,0x04,0x0b,0x9d,0x06,0x04,0x11,0x9f,0x00,0x04,0x07,0xbc,0x00,0x04,0x19,
68+
0xbe,0x00,0x04,0x03,0xbd,0x00,0x04,0x06,0x4e,0x4f,0x52,0x4d,0x41,0x4c,0x00,0x00,
69+
0x4d,0x4f,0x44,0x45,0x00,0x04,0x06,0xbf,0x00,0x04,0x07,0x08,0x06,0x04,0x11,0x09,
70+
0x00,0x04,0x2e,0x50,0x52,0x41,0x43,0x54,0x49,0x43,0x45,0x00,0x00,0x4d,0x4f,0x44,
71+
0x45,0x00,0x04,0x0e,0x08,0x06,0x04,0x11,0x09,0x00,0x04,0x65,0x10,0x00,0x04,0x1d,
72+
0x10,0x0e,0x0f,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,
73+
0xc7,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0x0e,
74+
0x0f,0x1e,0x1f,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,
75+
0xd7,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0x1e,
76+
0x1f,0x03,0x03,0x0e,0x0f,0x00,0x00,0xe6,0xe7,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,
77+
0xe7,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe0,0xe1,0x00,0x00,0x0e,0x0f,0x03,
78+
0x03,0x02,0x02,0x1e,0x1f,0x10,0x00,0xce,0xcf,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,
79+
0xcf,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xc8,0xc9,0x00,0x10,0x1e,0x1f,0x02,
80+
0x02,0x01,0x04,0x3f,0xff,0xff,0x5f,0xdf,0x7f,0x5f,0xff,0x04,0x09,0xaa,0xae,0xaa,
81+
0x04,0x03,0xab,0xaa,0xaa,0x5e,0x5a,0x04,0x04,0xa5,0xf5,0x04,0x0f,0x71,0x30,0x00,
82+
0x04,0x03,0xc0,0xd4,0x0f,0x04,0x07,0x04,0x00
83+
};
5484

5585

5686
__attribute__((section(".prg_rom_"STR(extra_code_bank)".119")))
@@ -60,7 +90,21 @@ void state_levelselect(){
6090
vram_adr(0x800);
6191
donut_decompress_vram(chr_menu_difficulties, chr_bank_0);
6292

93+
vram_adr(0x2000);
94+
vram_unrle(nt_levelselect);
95+
96+
pal_bg(pal_levelselect);
97+
98+
ppu_on_all();
99+
pal_fade_to(0,4);
100+
63101
while(1){
64102
ppu_wait_nmi();
103+
104+
if(player1_pressed & PAD_B) {
105+
gamestate = 0x10;
106+
pal_fade_to(4,0);
107+
break;
108+
}
65109
}
66110
}

src/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ int main(void){
106106
banked_call(extra_code_bank, state_menu);
107107
//state_menu();
108108
break;
109-
//case 0x11:
110-
// banked_call(extra_code_bank, state_levelselect);
111-
// //state_menu();
112-
// break;
109+
case 0x11:
110+
banked_call(extra_code_bank, state_levelselect);
111+
//state_menu();
112+
break;
113113
}
114114
}
115115
//APU.sprite.dma;

src/neslibext.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void pal_fade_to(unsigned char from, unsigned char to){
4949
"1: \n " // fade_loop:
5050
"lda #2 \n"
5151
"jsr ppu_wait_nmi \n" //wait 1 frames
52-
"jsr ppu_wait_nmi \n"
5352

5453
"lda __rc12 \n" //from
5554
"cmp __rc11 \n" //to

src/ram.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ __attribute__((section(".aligned.0"),retain)) struct OAM_BUF {
66
} OAM_BUF[64];
77

88

9-
unsigned char gamestate;
9+
unsigned char gamestate=0xff;
1010

1111
unsigned char song = 0;
1212

0 commit comments

Comments
 (0)