Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
vor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed rock counting code
[vor.git]
/
rocks.c
diff --git
a/rocks.c
b/rocks.c
index
94df499
..
59b4016
100644
(file)
--- a/
rocks.c
+++ b/
rocks.c
@@
-25,6
+25,10
@@
struct shape rock_shapes[NROCKS];
// timers for rock generation.
float rtimers[4];
// timers for rock generation.
float rtimers[4];
+int32_t rcnt, lrcnt;
+int32_t rsum, rsamples;
+float ravg;
+
uint32_t nrocks;
uint32_t nrocks_timer;
uint32_t nrocks_inc_ticks = 2*60*1000/(F_ROCKS-I_ROCKS);
uint32_t nrocks;
uint32_t nrocks_timer;
uint32_t nrocks_inc_ticks = 2*60*1000/(F_ROCKS-I_ROCKS);
@@
-64,6
+68,8
@@
reset_rocks(void)
for(i = 0; i<MAXROCKS; i++) rock[i].active = 0;
nrocks = I_ROCKS;
nrocks_timer = 0;
for(i = 0; i<MAXROCKS; i++) rock[i].active = 0;
nrocks = I_ROCKS;
nrocks_timer = 0;
+ rcnt = 0; lrcnt = -1;
+ rsum = 0; rsamples = 0;
}
enum { LEFT, RIGHT, TOP, BOTTOM };
}
enum { LEFT, RIGHT, TOP, BOTTOM };
@@
-191,19
+197,20
@@
new_rocks(void)
rockptr->x = rnd()*(XSIZE + rockptr->image->w);
rockptr->y = YSIZE;
rockptr->x = rnd()*(XSIZE + rockptr->image->w);
rockptr->y = YSIZE;
- rockptr->dx = RDY*crnd();
+ rockptr->dx = RDX*crnd();
rockptr->dy = -weighted_rnd_range(rmin[i], rmax[i]) + screendy;
break;
case TOP:
rockptr->x = rnd()*(XSIZE + rockptr->image->w);
rockptr->y = -rockptr->image->h;
rockptr->dy = -weighted_rnd_range(rmin[i], rmax[i]) + screendy;
break;
case TOP:
rockptr->x = rnd()*(XSIZE + rockptr->image->w);
rockptr->y = -rockptr->image->h;
- rockptr->dx = RDY*crnd();
+ rockptr->dx = RDX*crnd();
rockptr->dy = weighted_rnd_range(rmin[i], rmax[i]) + screendy;
break;
}
rockptr->active = 1;
rockptr->dy = weighted_rnd_range(rmin[i], rmax[i]) + screendy;
break;
}
rockptr->active = 1;
+ rcnt++;
}
}
}
}
}
}
@@
-224,9
+231,19
@@
move_rocks(void)
if(rock[i].x < -rock[i].image->w || rock[i].x >= XSIZE
|| rock[i].y < -rock[i].image->h || rock[i].y >= YSIZE) {
rock[i].active = 0;
if(rock[i].x < -rock[i].image->w || rock[i].x >= XSIZE
|| rock[i].y < -rock[i].image->h || rock[i].y >= YSIZE) {
rock[i].active = 0;
+ rcnt--;
}
}
}
}
}
}
+ /*
+ if(lrcnt == -1 && rcnt == nrocks) lrcnt = 0;
+ if(rcnt != lrcnt && lrcnt != -1) {
+ lrcnt = rcnt;
+ rsum += rcnt-nrocks; rsamples++;
+ ravg = (float) rsum / rsamples;
+ printf("%.2f%%\n", 100.0 * ravg / nrocks);
+ }
+ */
}
void
}
void