* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#undef DEBUG
+#ifdef DEBUG
+#include "debug.h"
+#endif
#include "config.h"
#include "file.h"
*surf_ship, // Spaceship element
*surf_life, // Indicator of number of ships remaining
*surf_rock[NROCKS], // THE ROCKS
- *surf_deadrock[NROCKS], // THE DEAD ROCKS
*surf_font_big; // The big font
SFont_Font *g_font;
// Load all our lovely rocks
for(i = 0; i<NROCKS; i++) {
- char a[100];
+ char a[MAX_PATH_LEN];
- sprintf(a,add_path("sprites/rock%d.png"),i);
+ snprintf(a,MAX_PATH_LEN,add_path("sprites/rock%d.png"),i);
NULLERROR(temp = IMG_Load(a));
NULLERROR(surf_rock[i] = SDL_DisplayFormat(temp));
-
- sprintf(a,add_path("sprites/deadrock%d.png"),i);
- NULLERROR(temp = IMG_Load(a));
- NULLERROR(surf_deadrock[i] = SDL_DisplayFormat(temp));
}
// Remove the mouse cursor
case HIGH_SCORE_DISPLAY:
// Display de list o high scores mon.
display_scores(surf_screen, 150,50);
+ break;
case GAMEPLAY:
case DEAD_PAUSE:
; // no action necessary
}
} else {
if(state == DEAD_PAUSE) {
- float blast_radius = BLAST_RADIUS * state_timeout / 20.0;
+ float blast_radius;
+ int fixonly;
+
+ if(state_timeout < DEAD_PAUSE_LENGTH - 20.0) {
+ blast_radius = BLAST_RADIUS * 1.3;
+ fixonly = 1;
+ } else {
+ blast_radius = BLAST_RADIUS * (DEAD_PAUSE_LENGTH - state_timeout) / 20.0;
+ fixonly = 0;
+ }
+
if(shipx < 60) shipx = 60;
for(i = 0; i<MAXROCKS; i++ ) {
float dx, dy, n;
if(rock[i].x <= 0) continue;
+
+ // This makes it so your explosion from dying magically doesn't leave
+ // any rocks that aren't moving much on the x axis. After the first
+ // 20 tics, only rocks that are barely moving will be pushed.
+ if(fixonly && (!rock[i].dead || rock[i].dx < -4 || rock[i].dx > 3)) {
+ continue;
+ }
+
dx = rock[i].x - shipx;
dy = rock[i].y - shipy;
+
n = sqrt(dx*dx + dy*dy);
if(n < blast_radius) {
n *= 20;
}
else {
state = DEAD_PAUSE;
- state_timeout = 20.0;
+ state_timeout = DEAD_PAUSE_LENGTH;
shipdx = 0;
shipdy = 0;
}
if(keystate[SDLK_p] | keystate[SDLK_s]) {
if(!pausedown) {
paused = !paused;
- if(paused) {
- SDL_Rect src,dest;
- src.w = surf_b_variations->w;
- src.h = surf_b_variations->h;
- dest.w = src.w;
- dest.h = src.h;
- dest.x = (XSIZE-src.w)/2;
- dest.y = (YSIZE-src.h)/2;
- SDL_BlitSurface(surf_b_variations,&src,surf_screen,&dest);
- // Update the surface
- SDL_Flip(surf_screen);
- }
pausedown = 1;
}
} else {