+}
+
+/* -------------------------------------------------------------------------------------------------
+* PROPELLER STUFF
+* -------------------------------------------------------------------------------------------------
+*/
+
+#define PROPELLER_CIRCLE_RADIUS 18
+#define PROPELLER_CIRCLE_RADIUS_SQ (PROPELLER_CIRCLE_RADIUS * PROPELLER_CIRCLE_RADIUS)
+
+static struct {
+ int circleX[3];
+ int circleY[3];
+} propellerState;
+
+static void updatePropeller(float t) {
+ int i, j;
+ int cx, cy, count = 0;
+ char *dst;
+ float x = 0.0f;
+ float y = 18.0f;
+ float nx, ny;
+ float cost, sint;
+ static float sin120 = 0.86602540378f;
+ static float cos120 = -0.5f;
+
+ /* Rotate */
+ sint = sin(t);
+ cost = cos(t);
+ nx = x * cost - y * sint;
+ ny = y * cost + x * sint;
+ x = nx;
+ y = ny;
+ propellerState.circleX[0] = (int)(x + 0.5f) + 16;
+ propellerState.circleY[0] = (int)(y + 0.5f) + 16;
+
+ /* Rotate by 120 degrees, for the second circle */
+ nx = x * cos120 - y * sin120;
+ ny = y * cos120 + x * sin120;
+ x = nx;
+ y = ny;
+ propellerState.circleX[1] = (int)(x + 0.5f) + 16;
+ propellerState.circleY[1] = (int)(y + 0.5f) + 16;
+
+ /* 3rd circle */
+ nx = x * cos120 - y * sin120;
+ ny = y * cos120 + x * sin120;
+ x = nx;
+ y = ny;
+ propellerState.circleX[2] = (int)(x + 0.5f) + 16;
+ propellerState.circleY[2] = (int)(y + 0.5f) + 16;
+
+ /* Write effect to the mini fx buffer*/
+ dst = miniFXBuffer;
+ for (j = 0; j < 32; j++) {
+ for (i = 0; i < 32; i++) {
+ count = 0;
+
+ /* First circle */
+ cx = propellerState.circleX[0] - i;
+ cy = propellerState.circleY[0] - j;
+ if (cx*cx + cy*cy < PROPELLER_CIRCLE_RADIUS_SQ) count++;
+
+ /* 2nd circle */
+ cx = propellerState.circleX[1] - i;
+ cy = propellerState.circleY[1] - j;
+ if (cx*cx + cy*cy < PROPELLER_CIRCLE_RADIUS_SQ) count++;
+
+ /* 3rd circle */
+ cx = propellerState.circleX[2] - i;
+ cy = propellerState.circleY[2] - j;
+ if (cx*cx + cy*cy < PROPELLER_CIRCLE_RADIUS_SQ) count++;
+
+ *dst++ = count >= 2;
+ }
+ }
+
+ /* Then, encode to rle */
+ rlePropeller = rleEncode(rlePropeller, miniFXBuffer, 32, 32);
+
+ /* Distribute the produced streaks so that they don't produce garbage when interpolated */
+ rleDistributeStreaks(rlePropeller);
+}