14 struct dust_mote motes[N_DUST_MOTES];
20 for(i=0; i<N_DUST_MOTES; i++) {
21 motes[i].x = frnd()*(XSIZE-5);
22 motes[i].y = frnd()*(YSIZE-5);
23 motes[i].z = MAX_DUST_DEPTH*sqrt(frnd());
24 b = (MAX_DUST_DEPTH - motes[i].z) * 255.0 / MAX_DUST_DEPTH;
25 motes[i].color = SDL_MapRGB(surf_screen->format, b, b, b);
33 float xscroll = screendx * t_frame;
34 float yscroll = screendy * t_frame;
35 for(i=0; i<N_DUST_MOTES; i++) {
36 motes[i].x -= xscroll / (1.3 + motes[i].z);
37 motes[i].y -= yscroll / (1.3 + motes[i].z);
38 if(motes[i].y >= XSIZE) motes[i].x -= XSIZE;
39 else if(motes[i].x < 0) motes[i].x += XSIZE;
40 if(motes[i].y > YSIZE) motes[i].y -= YSIZE;
41 else if(motes[i].y < 0) motes[i].y += YSIZE;
46 draw_dust(SDL_Surface *s)
49 uint16_t *pixels = s->pixels;
50 for(i=0; i<N_DUST_MOTES; i++) {
51 pixels[s->pitch/2*(int)motes[i].y + (int)motes[i].x] = motes[i].color;