changed the sprites to 16 colors
authorJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 26 May 2021 13:04:13 +0000 (16:04 +0300)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 26 May 2021 13:04:13 +0000 (16:04 +0300)
src/gamescr.c
src/sprite.c

index 416e99c..023114b 100644 (file)
@@ -39,7 +39,7 @@ void gamescr(void)
        vblperf_setcolor(0xff);//192);
 
        /* sprite setup */
-       spr_setup(16, 16, spr_game_pixels, spr_game_cmap);
+       spr_setup(32, 16, spr_game_pixels, spr_game_cmap);
 
        wait_vblank();
        spr_clear();
@@ -214,7 +214,7 @@ static void vblank(void)
        if(bnstate & BN_B) rot += 2;
 
 
-       spr_oam(oam, 0, 512 + 256, x - 64, y - 64, SPR_256COL | SPR_SZ64 | SPR_DBLSZ |
+       spr_oam(oam, 0, 512, x - 64, y - 64, SPR_SZ64 | SPR_DBLSZ |
                        SPR_ROTSCL | SPR_ROTSCL_SEL(0));
 
        mat[0] = COS(rot);
index e4253fb..c77ae90 100644 (file)
@@ -15,22 +15,20 @@ void spr_setup(int xtiles, int ytiles, unsigned char *pixels, unsigned char *cma
                for(j=0; j<8; j++) {
                        *dst++ = src[j * 64];
                        *dst++ = src[j * 64 + 1];
-                       *dst++ = src[j * 64 + 2];
-                       *dst++ = src[j * 64 + 3];
                }
-               src += 4;
+               src += 2;
 
-               if((i & 15) == 15) {
+               if((i & 31) == 31) {
                        src += 7 * 64;  /* skip to the next row of tiles (skip 7 rows of pixels) */
                }
        }
 
        cptr = (uint16_t*)CRAM_OBJ_ADDR;
-       for(i=0; i<256; i++) {
+       for(i=0; i<16; i++) {
                unsigned char r = *cmap++ >> 3;
                unsigned char g = *cmap++ >> 3;
                unsigned char b = *cmap++ >> 3;
-               *cptr++ = r | (g << 5) | (b < 10);
+               *cptr++ = r | ((uint16_t)g << 5) | ((uint16_t)b << 10);
        }
 }