fixed for last SGDK
#include "gfx.h"
#define TABLE_LEN 220
-#define MAX_DONUT 65
+#define MAX_DONUT 32
#define MAX_DONUT_ANIM 8
static void fastStarFieldFX();
@@ -76,22 +76,22 @@ static void fastStarFieldFX()
s = 0;
for(i = 0; i < MAX_DONUT; i++)
{
- Sprite* spr;
-
// create sprite
- spr = SPR_addSprite(&donut, 0, 0, TILE_ATTR_FULL(PAL2, TRUE, FALSE, FALSE, 0));
+ Sprite* spr = SPR_addSprite(&donut, 0, 0, TILE_ATTR_FULL(PAL2, TRUE, FALSE, FALSE, 0));
/* Disable auto tile upload */
SPR_setAutoTileUpload(spr, FALSE);
/* default position */
SPR_setPosition(spr, (cosFix16(s + (i << 5)) << 1) + 160 - 16, sinFix16(s + (i << 5)) + 112 - 16);
/* Set depth */
- if ((i & 7) == 7)
- SPR_setDepth(spr, -1);
- else
- SPR_setDepth(spr, spr->y);
- /* Manually set VRAM index */
- SPR_setVRAMTileIndex(spr, animVramIndexes[((s >> 4) + i) & 0x7]);
+ if ((i & 7) == 7) SPR_setDepth(spr, -1);
+ else SPR_setDepth(spr, spr->y);
+
+ /* Manually set frame / VRAM index */
+ const u16 frame = ((s >> 4) + i) & 0x7;
+
+ SPR_setFrame(spr, frame);
+ SPR_setVRAMTileIndex(spr, animVramIndexes[frame]);
sprites[i] = spr;
}
@@ -119,18 +119,20 @@ static void fastStarFieldFX()
for(i = 0; i < MAX_DONUT; i++)
{
Sprite *spr = sprites[i];
+ const u16 frame = ((s >> 4) + i) & 0x7;
SPR_setPosition(spr, (cosFix16(s + (i << 5)) << 1) + 160 - 16, sinFix16(s + (i << 5)) + 112 - 16);
if (spr->depth != -1) SPR_setDepth(spr, spr->y);
- SPR_setVRAMTileIndex(spr, animVramIndexes[((s >> 4) + i) & 0x7]);
+ SPR_setFrame(spr, frame);
+ SPR_setVRAMTileIndex(spr, animVramIndexes[frame]);
}
s += 4;
SPR_update();
- SYS_disableInts();
- VDP_showFPS(FALSE);
- SYS_enableInts();
+// SYS_disableInts();
+// VDP_showFPS(FALSE);
+// SYS_enableInts();
VDP_waitVSync();
