JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added constant MAX_DUST_DEPTHS.
authorJoshua Grams <josh@qualdan.com>
Thu, 28 Apr 2005 23:50:38 +0000 (23:50 +0000)
committerJoshua Grams <josh@qualdan.com>
Thu, 28 Apr 2005 23:50:38 +0000 (23:50 +0000)
put ship back in center of screen at start.
explosion now in same place as ship.

config.h
main.c
rocks.c

index 62ba253..62b9fda 100644 (file)
--- a/config.h
+++ b/config.h
@@ -27,6 +27,7 @@
 #define MAXENGINEDOTS 5000
 #define MAXBANGDOTS 50000
 #define MAXSPACEDOTS 2000
+#define MAXDUSTDEPTH 2
 #define W 100
 #define M 255
 #define BLAST_RADIUS 300 // radius^2 (pixels) which will be cleared of rocks when you die
diff --git a/main.c b/main.c
index 6b575bd..3fbe7a6 100644 (file)
--- a/main.c
+++ b/main.c
@@ -132,8 +132,8 @@ init_space_dots() {
        for(i = 0; i<MAXSPACEDOTS; i++) {
                sdot[i].x = rnd()*(XSIZE-5);
                sdot[i].y = rnd()*(YSIZE-5);
-               sdot[i].z = 4*rnd();
-               b = (4 - sdot[i].z) * 255.0 / 4;
+               sdot[i].z = MAXDUSTDEPTH*sqrt(rnd());
+               b = (MAXDUSTDEPTH - sdot[i].z) * 255.0 / MAXDUSTDEPTH;
                sdot[i].color = SDL_MapRGB(surf_screen->format, b, b, b);
        }
 }
@@ -753,12 +753,13 @@ gameloop() {
                        if(shipx<0 || shipx>XSIZE-surf_ship->w) {
                                // BOUNCE from left and right wall
                                shipx -= shipdx*gamerate;
-                               shipdx *= -0.99;
+                               shipdx *= -99;
                        }
 
                        // BOUNCE Y
                        if(shipy<0 || shipy>YSIZE-surf_ship->h) {
                                // BOUNCE from top and bottom wall
+                               printf("bouncing top/bottom.\n");
                                shipy -= shipdy;
                                shipdy *= -0.99;
                        }
@@ -768,7 +769,7 @@ gameloop() {
                                // Play the explosion sound
                                play_sound(0);
                                make_bang_dots(shipx,shipy,shipdx,shipdy,surf_ship,30);
-                               shipdx = screendx;
+                               shipdx = 0;
                                shipdy = 0;
                                if(--nships <= 0) {
                                        gameover = 1;
@@ -797,9 +798,9 @@ gameloop() {
                                play_tune(1);
 
                                gameover = 0;
-                               shipx = 2*XSIZE/3;
+                               shipx = XSIZE/2;
                                shipy = YSIZE/2;
-                               shipdx = screendx;
+                               shipdx = 0;
                                shipdy = 0;
                        }
 
diff --git a/rocks.c b/rocks.c
index 5653979..5c23b81 100644 (file)
--- a/rocks.c
+++ b/rocks.c
@@ -229,7 +229,7 @@ blast_rocks(float x, float y, float radius, int onlyslow)
                n = sqrt(dx*dx + dy*dy);
                if(n < radius) {
                        n *= 20;
-                       rock[i].dx += 54.0*(dx+30)/n;
+                       rock[i].dx += 54.0*dx/n;
                        rock[i].dy += 54.0*dy/n;
                }
        }