static void rock_reset (struct state *st, struct rock *rock) { rock->real_size = MAX_SIZE; rock->r = (SIN_RESOLUTION * 0.7) + (random () % (30 * SIN_RESOLUTION)); rock->theta = random () % SIN_RESOLUTION; rock->depth = MAX_DEPTH * DEPTH_SCALE; rock->color = random() % st->ncolors; rock_compute (st, rock); rock_draw (st, rock, True); }
static void rock_reset( Window win, arock *arocks) { arocks->real_size = MAX_WIDTH; arocks->r = (int)((RESOLUTION * 0.7) + (LRAND() % (30 * RESOLUTION))); arocks->theta = LRAND() % RESOLUTION; arocks->depth = MAX_DEPTH * DEPTH_SCALE; if (!mono && Scr[screen].npixels > 2) arocks->color = Scr[screen].pixels[LRAND() % Scr[screen].npixels]; else arocks->color = WhitePixel(dsp, screen); rock_compute(arocks); rock_draw(win, arocks, True); }
static void rock_tick ( Window win, arock *arocks, int d) { rockstruct *rp = &rocks[screen]; if (arocks->depth > 0) { rock_draw(win, arocks, False); arocks->depth -= rp->speed; if (rp->rotate_p) arocks->theta = (arocks->theta + d) % RESOLUTION; while (arocks->theta < 0) arocks->theta += RESOLUTION; if (arocks->depth < (MIN_DEPTH * DEPTH_SCALE)) arocks->depth = 0; else { rock_compute(arocks); rock_draw(win, arocks, True); } } else if ((LRAND() % 40) == 0) rock_reset(win, arocks); }
static void rock_tick (struct state *st, struct rock *rock, int d) { if (rock->depth > 0) { rock_draw (st, rock, False); rock->depth -= st->speed; if (st->rotate_p) { rock->theta = (rock->theta + d) % SIN_RESOLUTION; } while (rock->theta < 0) rock->theta += SIN_RESOLUTION; if (rock->depth < (MIN_DEPTH * DEPTH_SCALE)) rock->depth = 0; else { rock_compute (st, rock); rock_draw (st, rock, True); } } else if ((random () % 40) == 0) rock_reset (st, rock); }