}
void
-move_dust(void)
+move_dust(float ticks)
{
int i;
- float xscroll = screendx * t_frame;
- float yscroll = screendy * t_frame;
+ float xscroll = screendx * ticks;
+ float yscroll = screendy * ticks;
for(i=0; i<N_DUST_MOTES; i++) {
motes[i].x -= xscroll / (1.3 + motes[i].z);
motes[i].y -= yscroll / (1.3 + motes[i].z);
#define MAX_DUST_DEPTH 2
void init_dust(void);
-void move_dust(void);
+void move_dust(float ticks);
void draw_dust(SDL_Surface *);
#endif // VOR_DUST_H
extern float screendx, screendy;
-// All movement is based on t_frame.
-// All speeds are pixels/tick, with 20 ticks per second.
-extern float t_frame; // length of this frame (in ticks = 1/20th second)
-
extern int score;
extern int g_easy;
extern float fadetimer, faderate;
}
}
- move_dust();
+ move_dust(t_frame);
SDL_LockSurface(s);
draw_dust(s);
}
}
- new_rocks();
+ new_rocks(t_frame);
// SCROLLING
tmp = (ship.y+ship.dy*t_frame-YSCROLLTO)/25 + (ship.dy-screendy);
bangx += (bangdx - screendx)*t_frame;
bangy += (bangdy - screendy)*t_frame;
- move_sprites();
+ move_sprites(t_frame);
// BOUNCE off left or right edge of screen
}
void
-new_rocks(void)
+new_rocks(float ticks)
{
int i, type;
struct rock *r;
float rmax[4];
if(nrocks < final_rocks) {
- nrocks_timer += t_frame;
+ nrocks_timer += ticks;
if(nrocks_timer >= nrocks_inc_ticks) {
nrocks_timer -= nrocks_inc_ticks;
nrocks++;
rock_sides(ti, rmin, rmax);
// increment timers
- for(i=0; i<4; i++) rtimers[i] += ti[i]*t_frame;
+ for(i=0; i<4; i++) rtimers[i] += ti[i]*ticks;
// generate rocks
for(i=0; i<4; i++) {
void load_rocks(void);
void reset_rocks(void);
-void new_rocks(void);
+void new_rocks(float ticks);
void draw_rocks(void);
void blast_rocks(float x, float y, float radius);
}
void
-move_sprite(Sprite *s)
+move_sprite(Sprite *s, float ticks)
{
if(s->flags & MOVE) {
- s->x += (s->dx - screendx)*t_frame;
- s->y += (s->dy - screendy)*t_frame;
+ s->x += (s->dx - screendx)*ticks;
+ s->y += (s->dy - screendy)*ticks;
}
}
}
void
-move_sprites(void)
+move_sprites(float ticks)
{
int sq;
Sprite **head;
head=&sprites[set][sq];
while(*head) {
Sprite *s = remove_sprite(head);
- move_sprite(s); sort_sprite(s);
+ move_sprite(s, ticks); sort_sprite(s);
}
}
set = 1-set; // switch to other set of sprites.
void init_sprites(void);
void reset_sprites(void);
void add_sprite(Sprite *s);
-void move_sprite(Sprite *s);
-void move_sprites(void);
+void move_sprite(Sprite *s, float ticks);
+void move_sprites(float ticks);
Sprite *collides(Sprite *s);
Sprite * pixel_collides(float x, float y);