JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
bump version to 0.5.8
[vor.git] / dust.c
diff --git a/dust.c b/dust.c
index b336696..0e4daa2 100644 (file)
--- a/dust.c
+++ b/dust.c
@@ -1,9 +1,10 @@
 #include <SDL.h>
 #include <math.h>
 
-#include "config.h"
+#include "vorconfig.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<N_DUST_MOTES; i++) {
                motes[i].x -= xscroll / (1.3 + motes[i].z);
+               motes[i].x = fwrap(motes[i].x, XSIZE);
+
                motes[i].y -= yscroll / (1.3 + motes[i].z);
-               if(motes[i].x >= 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; i<N_DUST_MOTES; i++) {
-               pixels[s->pitch/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;
        }
 }