-void
-create_engine_dots2(int newdots, int m) {
- int i;
- double theta, theta2, dx, dy, adx, ady;
-
- // 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;
- }
+SDL_Surface *
+load_image(char *filename)
+{
+ SDL_Surface *tmp, *img = NULL;
+ char *s = add_data_path(filename);
+ if(s) {
+ tmp = IMG_Load(s);
+ free(s);
+ if(tmp) {
+ img = SDL_DisplayFormat(tmp);
+ SDL_FreeSurface(tmp);