+ else if (! strcmp (ymode_str, "change")) {
+ if ((current_time - start_time) > change_time) {
+ start_time = current_time;
+ ymode = 1 + (int)(3.0 * random() / (RAND_MAX + 1.0));
+ printf("Changing ymode to %d\n", ymode);
+ }
+ }
+ if (++current_color >= NCOLORS)
+ current_color = 0;
+ for (wcount = 0; wcount < info->whirlies; wcount++) {
+ int lcount; /* lcount is a counter for every line -- take note of the offsets changing */
+ int internal_time = current_time;
+ int color_offset = (current_color + (info->color_modifier * wcount)) % NCOLORS;
+ if (current_time == 0)
+ internal_time = 0;
+ else
+ /* I want the distance between whirlies to increase more each whirly */
+ internal_time = current_time + (10 * wcount) + (wcount * wcount);
+ switch (xmode) {
+ /* All these functions expect an int time, the struct info, a pointer to an array of positions,
+ and the index that the the function will fill of the array */
+ case spin_mode:
+ spin(internal_time, info, pos, 0);
+ break;
+ case funky_mode:
+ funky(internal_time, info, pos, 0);
+ break;
+ case circle_mode:
+ circle(internal_time, info, pos, 0);
+ break;
+ case linear_mode:
+ linear(internal_time, info, pos, 0);
+ break;
+ case fun_mode:
+ fun(internal_time, info, pos, 0);
+ break;
+ case test_mode:
+ test(internal_time, info, pos, 0);
+ break;
+ case innie_mode:
+ innie(internal_time, info, pos, 0, modifier);
+ break;
+ case lissajous_mode:
+ lissajous(internal_time, info, pos, 0);
+ break;
+ default:
+ spin(internal_time, info, pos, 0);
+ break;
+ } /* End of the switch for the x position*/
+ switch (ymode) {
+ case spin_mode:
+ spin(internal_time, info, pos, 1);
+ break;
+ case funky_mode:
+ funky(internal_time, info, pos, 1);
+ break;
+ case circle_mode:
+ circle(internal_time, info, pos, 1);
+ break;
+ case linear_mode:
+ linear(internal_time, info, pos, 1);
+ break;
+ case fun_mode:
+ fun(internal_time, info, pos, 1);
+ break;
+ case test_mode:
+ test(internal_time, info, pos, 1);
+ break;
+ case innie_mode:
+ innie(internal_time, info, pos, 1, modifier);
+ break;
+ case lissajous_mode:
+ lissajous(internal_time, info, pos, 1);
+ break;
+ default:
+ spin(internal_time, info, pos, 1);
+ break;
+ } /* End of the switch for the y position*/
+ for (lcount = 0; lcount < info->nlines; lcount++) {
+ double arg = (double)((internal_time * info->offset_period) / 90.0);
+ double line_offset = 20.0 * (double)lcount * sin(arg);
+ int size;
+ size = (int)(15.0 + 5.0 * sin((double)internal_time / 180.0));
+/* First delete the old circle... */
+ if (! info->trail) {
+ XSetForeground(display, bgc, BlackPixel(display, screen));
+ XFillArc(display, window, bgc, last_x[wcount][lcount], last_y[wcount][lcount], last_size[wcount][lcount], last_size[wcount][lcount], START_ARC, END_ARC);
+ }
+ /* Now, lets draw in the new circle */
+ { /* Starting new scope for local x_pos and y_pos */
+ int xpos, ypos;
+ if (wrap) {
+ xpos = preen((int)(info->xoffset*line_offset)+pos[0], info->half_width * 2);
+ ypos = preen((int)(info->yoffset*line_offset)+pos[1], info->half_height * 2);
+ }
+ else {
+ xpos = (int)(info->xoffset*line_offset)+pos[0];
+ ypos = (int)(info->yoffset*line_offset)+pos[1];
+ }
+ if (start_time == current_time) {
+ /* smoothen should move from one mode to another prettily... */
+/*
+ smoothen(xpos, last_x[wcount][lcount], ypos, last_y[wcount][lcount], size, color_offset, colors, display, window, bgc, screen, info);
+ */
+ }
+ last_x[wcount][lcount] = xpos;
+ last_y[wcount][lcount] = ypos;
+ last_size[wcount][lcount] = size;
+ XSetForeground(display, bgc, colors[color_offset].pixel);
+ XFillArc(display, window, bgc, xpos, ypos, size, size, START_ARC, END_ARC);
+ } /* End of my temporary scope for xpos and ypos */
+ } /* End of the for each line in nlines */
+ } /* End of the for each whirly in whirlies */
+ XSync(display, False);
+ if (current_time == FULL_CYCLE)
+ current_time = 1;
+ else
+ current_time = current_time + info->speed;
+ screenhack_handle_events(display);
+ if (!info->writable)
+ usleep(10000);
+ } /* End the while loop! */
+ free(info);