9 static void particle(int x, int y, int sz);
11 #define SPRITE_BASE 0x8000
12 extern uint16_t cellspr_data[], cellspr_data_end[];
13 extern unsigned char cellspr_cmap[], cellspr_cmap_end[];
24 vdp_setcolor(0, i, i, i, i);
25 vdp_setcolor(1, i, cptr[0] >> 4, cptr[1] >> 4, cptr[2] >> 4);
29 /* upload sprite tiles */
31 vdp_setup_addr(VDP_VRAM, SPRITE_BASE);
32 while(src < cellspr_data_end) {
42 vdp_setup_addr(VDP_VRAM, 0xc000); /* nametable A */
43 for(i=0; i<2048; i++) {
46 vdp_setup_addr(VDP_VRAM, 0xe000); /* nametable B */
47 for(i=0; i<2048; i++) {
51 vdp_setup_addr(VDP_VRAM, 0xf000); /* hscroll table is at f000, see vdp.S */
62 if(bnstate & PAD_UP) {
64 } else if(bnstate & PAD_DOWN) {
67 if(bnstate & PAD_LEFT) {
69 } else if(bnstate & PAD_RIGHT) {
72 if(bndiff & bnstate & PAD_A) {
74 } else if(bndiff & bnstate & PAD_B) {
81 static void particle(int x, int y, int pixsz)
83 int tile, offs = 4, invoffs, szlevel;
84 static int offstab[] = {
85 4, 4, 4, 4, 4, 4, 4, 4,
86 4, 8, 8, 8, 8, 8, 8, 8,
88 8, 14, 14, 15, 15, 15, 16, 16,
89 16, 14, 14, 15, 15, 15, 16, 16,
96 tile = VDP_ADDR2TILE(SPRITE_BASE);
97 } else if(pixsz <= 16) {
98 szlevel = (pixsz - 1) >> 1;
99 tile = VDP_ADDR2TILE(SPRITE_BASE) + szlevel;
100 } else if(pixsz <= 24) {
102 tile = VDP_ADDR2TILE(SPRITE_BASE) + 8;
103 } else if(pixsz <= 32) {
105 tile = VDP_ADDR2TILE(SPRITE_BASE) + 12;
108 tile = VDP_ADDR2TILE(SPRITE_BASE) + 12;
112 offs = offstab[pixsz];
119 spr_add(x - offs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG), SPR_SIZE(1, 1));
126 spr_add(x - offs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG), SPR_SIZE(1, 1));
127 spr_add(x, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HFLIP), SPR_SIZE(1, 1));
128 spr_add(x - offs, y, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_VFLIP), SPR_SIZE(1, 1));
129 spr_add(x, y, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HVFLIP), SPR_SIZE(1, 1));
132 case 8: /* 17x17 - 24x24 */
133 default: /* 25x25 - 32x32 */
135 spr_add(x - offs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG), SPR_SIZE(2, 2));
136 spr_add(x - invoffs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HFLIP), SPR_SIZE(2, 2));
137 spr_add(x - offs, y - invoffs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_VFLIP), SPR_SIZE(2, 2));
138 spr_add(x - invoffs, y - invoffs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HVFLIP), SPR_SIZE(2, 2));