X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=dust.c;h=ab583953ae0bd928ded3f40b5e153f6c9c626ea7;hp=b336696035da9c1cbd7248114d023487d600e551;hb=c1db302b3620bf4e0314867cddf094402d76d2d6;hpb=badd0f9bfc6dad829073e606c1953572ece1b06b diff --git a/dust.c b/dust.c index b336696..ab58395 100644 --- a/dust.c +++ b/dust.c @@ -4,6 +4,7 @@ #include "config.h" #include "globals.h" #include "dust.h" +#include "float.h" #include "mt.h" struct dust_mote { @@ -32,22 +33,22 @@ move_dust(void) int i; float xscroll = screendx * t_frame; float yscroll = screendy * t_frame; + for(i=0; i= XSIZE) motes[i].x -= XSIZE; - else if(motes[i].x < 0) motes[i].x += XSIZE; - if(motes[i].y >= YSIZE) motes[i].y -= YSIZE; - else if(motes[i].y < 0) motes[i].y += YSIZE; + motes[i].y = fwrap(motes[i].y, YSIZE); } } void -draw_dust(SDL_Surface *s) +draw_dust(void) { int i; - uint16_t *pixels = s->pixels; + uint16_t *pixels = surf_screen->pixels; for(i=0; ipitch/2*(int)motes[i].y + (int)motes[i].x] = motes[i].color; + pixels[surf_screen->pitch/2*(int)motes[i].y + (int)motes[i].x] = motes[i].color; } }