struct shape shipshape;
float shipx = XSIZE/2, shipy = YSIZE/2; // X position, 0..XSIZE
float shipdx = SCREENDXMIN, shipdy = 0.0; // Change in X position per tick.
struct shape shipshape;
float shipx = XSIZE/2, shipy = YSIZE/2; // X position, 0..XSIZE
float shipdx = SCREENDXMIN, shipdy = 0.0; // Change in X position per tick.
// all movement is based on t_frame.
float t_frame; // length of this frame (in ticks = 1/20th second)
// all movement is based on t_frame.
float t_frame; // length of this frame (in ticks = 1/20th second)
int ms_frame; // length of this frame (milliseconds)
int ms_end; // end of this frame (milliseconds)
float bangx, bangy, bangdx, bangdy;
int nships,score;
int ms_frame; // length of this frame (milliseconds)
int ms_end; // end of this frame (milliseconds)
float bangx, bangy, bangdx, bangdy;
int nships,score;
dest.x = shipx;
dest.y = shipy;
SDL_BlitSurface(surf_ship,NULL,surf_screen,&dest);
dest.x = shipx;
dest.y = shipy;
SDL_BlitSurface(surf_ship,NULL,surf_screen,&dest);
- if(state == GAMEPLAY || state == DEAD_PAUSE || state == GAME_OVER)
- for(i = 0; i<nships-1; i++) {
- dest.x = (i + 1)*(surf_life->w + 10);
- dest.y = 20;
- SDL_BlitSurface(surf_life, NULL, surf_screen, &dest);
+ if(state == GAMEPLAY || state == DEAD_PAUSE || state == GAME_OVER) {
+ for(i = 0; i<nships-1; i++) {
+ dest.x = (i + 1)*(surf_life->w + 10);
+ dest.y = 20;
+ SDL_BlitSurface(surf_life, NULL, surf_screen, &dest);
+ }
if(ms_frame>200 || ms_frame<0) {
// We won't run at all below 5 frames per second.
// This also happens if we were paused, grr.
if(ms_frame>200 || ms_frame<0) {
// We won't run at all below 5 frames per second.
// This also happens if we were paused, grr.
screendy += tmp * t_frame/12;
tmp = (shipx-XSCROLLTO)/25 + (shipdx-screendx);
screendx += tmp * t_frame/12;
screendy += tmp * t_frame/12;
tmp = (shipx-XSCROLLTO)/25 + (shipdx-screendx);
screendx += tmp * t_frame/12;
if(back_dist + (screendx - SCREENDXMIN)*TO_TICKS(2) < 0) {
screendx = SCREENDXMIN - (back_dist/TO_TICKS(2));
}
if(back_dist + (screendx - SCREENDXMIN)*TO_TICKS(2) < 0) {
screendx = SCREENDXMIN - (back_dist/TO_TICKS(2));
}
back_dist += (screendx - SCREENDXMIN)*t_frame;
if(opt_max_lead >= 0) back_dist = min(back_dist, opt_max_lead);
back_dist += (screendx - SCREENDXMIN)*t_frame;
if(opt_max_lead >= 0) back_dist = min(back_dist, opt_max_lead);
- if(!gameover) {
-
- if(!paused) {
- if(keystate[SDLK_LEFT] | keystate[SDLK_h]) { shipdx -= 1.5*t_frame; jets |= 1<<0;}
- if(keystate[SDLK_DOWN] | keystate[SDLK_t]) { shipdy += 1.5*t_frame; jets |= 1<<1;}
- if(keystate[SDLK_RIGHT] | keystate[SDLK_n]) { shipdx += 1.5*t_frame; jets |= 1<<2;}
- if(keystate[SDLK_UP] | keystate[SDLK_c]) { shipdy -= 1.5*t_frame; jets |= 1<<3;}
- if(keystate[SDLK_3]) { SDL_SaveBMP(surf_screen, "snapshot.bmp"); }
- }
+ if(!paused) {
+ if(keystate[SDLK_LEFT] | keystate[SDLK_h]) { shipdx -= 1.5*t_frame; jets |= 1<<0;}
+ if(keystate[SDLK_DOWN] | keystate[SDLK_t]) { shipdy += 1.5*t_frame; jets |= 1<<1;}
+ if(keystate[SDLK_RIGHT] | keystate[SDLK_n]) { shipdx += 1.5*t_frame; jets |= 1<<2;}
+ if(keystate[SDLK_UP] | keystate[SDLK_c]) { shipdy -= 1.5*t_frame; jets |= 1<<3;}
+ if(keystate[SDLK_3]) { SDL_SaveBMP(surf_screen, "snapshot.bmp"); }
+ }