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,
98 tile = VDP_ADDR2TILE(SPRITE_BASE);
99 } else if(pixsz <= 16) {
100 szlevel = (pixsz - 1) >> 1;
101 tile = VDP_ADDR2TILE(SPRITE_BASE) + szlevel;
102 } else if(pixsz <= 24) {
104 tile = VDP_ADDR2TILE(SPRITE_BASE) + 8;
105 } else if(pixsz <= 32) {
107 tile = VDP_ADDR2TILE(SPRITE_BASE) + 12;
110 tile = VDP_ADDR2TILE(SPRITE_BASE) + 12;
117 offs = offstab[pixsz];
124 spr_add(x - offs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG), SPR_SIZE(1, 1));
131 spr_add(x - offs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG), SPR_SIZE(1, 1));
132 spr_add(x, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HFLIP), SPR_SIZE(1, 1));
133 spr_add(x - offs, y, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_VFLIP), SPR_SIZE(1, 1));
134 spr_add(x, y, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HVFLIP), SPR_SIZE(1, 1));
137 case 8: /* 17x17 - 24x24 */
138 default: /* 25x25 - 32x32 */
140 spr_add(x - offs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG), SPR_SIZE(2, 2));
141 spr_add(x - invoffs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HFLIP), SPR_SIZE(2, 2));
142 spr_add(x - offs, y - invoffs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_VFLIP), SPR_SIZE(2, 2));
143 spr_add(x - invoffs, y - invoffs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HVFLIP), SPR_SIZE(2, 2));