- // Don't create fresh engine dots when
- // the game is not being played and a demo is not beng shown
- if(state != GAMEPLAY) return;
-
- for(i = 0; i<newdots; i++) {
- if(dotptr->active == 0) {
- theta = rnd()*M_PI*2;
- theta2 = rnd()*M_PI*2;
-
- dx = cos(theta) * fabs(cos(theta2));
- dy = sin(theta) * fabs(cos(theta2));
- adx = fabs(dx);
- ady = fabs(dy);
-
-
- dotptr->active = 1;
- dotptr->x = shipx + surf_ship->w/2 + (rnd()-0.5)*3;
- dotptr->y = shipy + surf_ship->h/2 + (rnd()-0.5)*3;
-
- switch(m) {
- case 0:
- dotptr->x -= 14;
- dotptr->dx = -20*adx + shipdx;
- dotptr->dy = 2*dy + shipdy;
- dotptr->life = 60 * adx;
- break;
- case 1:
- dotptr->dx = 2*dx + shipdx;
- dotptr->dy = -20*ady + shipdy;
- dotptr->life = 60 * ady;
- break;
- case 2:
- dotptr->x += 14;
- dotptr->dx = 20*adx + shipdx;
- dotptr->dy = 2*dy + shipdy;
- dotptr->life = 60 * adx;
- break;
- case 3:
- dotptr->dx = 2*dx + shipdx;
- dotptr->dy = 20*ady + shipdy;
- dotptr->life = 60 * ady;
- break;
- }
- dotptr++;
- if(dotptr-edot >= MAXENGINEDOTS) {
- dotptr = edot;
- }
+ for(i = 0; i<MAXENGINEDOTS; i++) {
+ if(!edot[i].active) continue;
+ edot[i].x += edot[i].dx*t_frame - xscroll;
+ edot[i].y += edot[i].dy*t_frame - yscroll;
+ edot[i].life -= t_frame*3;
+ if(edot[i].life < 0
+ || edot[i].x<0 || edot[i].x >= XSIZE
+ || edot[i].y<0 || edot[i].y >= YSIZE) {
+ edot[i].active = 0;
+ continue;