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) {
43 if(bnstate & PAD_UP) {
45 } else if(bnstate & PAD_DOWN) {
48 if(bnstate & PAD_LEFT) {
50 } else if(bnstate & PAD_RIGHT) {
53 if(bndiff & bnstate & PAD_A) {
55 } else if(bndiff & bnstate & PAD_B) {
62 static void particle(int x, int y, int pixsz)
64 int tile, offs = 4, invoffs, szlevel;
65 static int offstab[] = {
66 4, 4, 4, 4, 4, 4, 4, 4,
67 4, 8, 8, 8, 8, 8, 8, 8,
69 8, 14, 14, 15, 15, 15, 16, 16,
70 16, 14, 14, 15, 15, 15, 16, 16,
79 tile = VDP_ADDR2TILE(SPRITE_BASE);
80 } else if(pixsz <= 16) {
81 szlevel = (pixsz - 1) >> 1;
82 tile = VDP_ADDR2TILE(SPRITE_BASE) + szlevel;
83 } else if(pixsz <= 24) {
85 tile = VDP_ADDR2TILE(SPRITE_BASE) + 8;
86 } else if(pixsz <= 32) {
88 tile = VDP_ADDR2TILE(SPRITE_BASE) + 12;
91 tile = VDP_ADDR2TILE(SPRITE_BASE) + 12;
98 offs = offstab[pixsz];
105 spr_add(x - offs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG), SPR_SIZE(1, 1));
112 spr_add(x - offs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG), SPR_SIZE(1, 1));
113 spr_add(x, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HFLIP), SPR_SIZE(1, 1));
114 spr_add(x - offs, y, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_VFLIP), SPR_SIZE(1, 1));
115 spr_add(x, y, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HVFLIP), SPR_SIZE(1, 1));
118 case 8: /* 17x17 - 24x24 */
119 default: /* 25x25 - 32x32 */
121 spr_add(x - offs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG), SPR_SIZE(2, 2));
122 spr_add(x - invoffs, y - offs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HFLIP), SPR_SIZE(2, 2));
123 spr_add(x - offs, y - invoffs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_VFLIP), SPR_SIZE(2, 2));
124 spr_add(x - invoffs, y - invoffs, VDP_TILENAME(tile, 1, VDP_TILE_FG | VDP_TILE_HVFLIP), SPR_SIZE(2, 2));