File moon-lander-startup-fix.patch of Package moon-lander

--- moon_lander.c_org	2011-06-13 11:39:44.000000000 +0200
+++ moon_lander.c	2011-06-15 20:40:49.000000000 +0200
@@ -209,7 +209,9 @@ void get_new_background(Game *game) {
       if ( (files[count] = readdir(dir)) ){
       
 	//printf("I see - %d %s\n", count, files[count]->d_name);
-	count++;
+	if ((strchr(files[count]->d_name, '.') - files[count]->d_name) > 0) {
+	  count++;
+	}
       }
       else{
 	done = 1;
@@ -231,15 +233,17 @@ void get_new_background(Game *game) {
 
   
 
-  game->back_no++;
-  
-  if (game->back_no < 2){
-    game->back_no = 2;
-  }
-
-  if (game->back_no >= count){
-    game->back_no = 2;
-  }
+  //game->back_no++;
+  srand( (unsigned) time(NULL) ) ; 
+  game->back_no = 0 + ( rand() % (count));         //a + ( rand() % ( b - a + 1))     a=0, b=count-1
+    
+//  if (game->back_no < 0){
+//    game->back_no = 0;
+//  }
+
+//  if (game->back_no >= count){
+//    game->back_no = 0;
+//  }  
   
 
   if (game->background.image != NULL){
@@ -309,6 +313,13 @@ void load_game(Game *game){
   char filename[200];
   FILE *file;
 
+  game->opt_num_lives = 3;
+  game->opt_lp_bonus = 1;
+  game->opt_lp_warn = 1;
+  game->opt_prog_grav = 1;
+  game->opt_fancy_terrain = 1;
+  game->opt_frame_period = 2;
+
 #ifndef WIN32_BUILD
   struct passwd *pwp;
 
@@ -344,6 +355,7 @@ void load_game(Game *game){
     game->opt_lp_warn = 1;
     game->opt_prog_grav = 1;
     game->opt_fancy_terrain = 1;
+    game->opt_frame_period = 2;
 
     return;
   }
@@ -365,7 +377,10 @@ void options (Game *game) {
   int value[6];
   Uint8 *key_table;
   SDL_Event event;
-
+  
+  get_new_background(game);
+  SDL_Flip(game->screen);
+  
   sprintf(options[0],"%s", "Fancy Terrain");
   sprintf(options[1],"%s", "Progressive Gravity");
   sprintf(options[2],"%s", "Landing Pad Speed Warning");
@@ -481,6 +496,7 @@ void options (Game *game) {
     DT_DrawText("OPTIONS", game->screen, game->big_font, 260, 50);
     DT_DrawText("Arrow Keys Select", game->screen, game->small_font, 260, 75);
     DT_DrawText("ENTER changes value", game->screen, game->small_font, 260, 90);
+    DT_DrawText("ESC back to game", game->screen, game->small_font, 260, 105);
 
     for (count = 0; count < 6; count ++) {
 
@@ -878,7 +894,7 @@ void game_over(Game *game, int first_tim
   int ticks = 0;
   Uint8 *key_table;
   int l_start;
-
+  char display_string[100];
 
   if( game->demo_mode ) {
     first_time = 1;
@@ -889,15 +905,17 @@ void game_over(Game *game, int first_tim
   }
 
   if (first_time == 0){
-  /* if they just lost, show them thier score and stuff and then pause for a sec */
+  /* if they just lost, show them their score and stuff and then pause for a sec */
     draw_sprite(game->screen, game->gameover_screen);
     draw_sprite(game->screen, game->logo);
     DT_DrawText("Game Over", game->screen, game->big_font, 252, 148 ); 
+    sprintf(display_string, "Score: %d", (game->score));
+    DT_DrawText(display_string, game->screen, game->big_font, 240, 190 );
     draw_score(game, 0);
     draw_sprite(game->screen, game->magigames);
 
     SDL_Flip(game->screen);
-    delay(75);
+    delay(125);
   }
 
   /* start between game animation */
@@ -916,15 +934,15 @@ void game_over(Game *game, int first_tim
 
     /* if they just lost, show them thier score and stuff */
 
-    if (first_time == 0){
-      DT_DrawText("Game Over", game->screen, game->big_font, 252, 148 ); 
-    }
+//    if (first_time == 0){
+//      DT_DrawText("Game Over", game->screen, game->big_font, 252, 248 ); 
+//    }
 
     draw_score(game, 0);
     DT_DrawText("Arrow keys control the ship", game->screen, game->big_font, 100, 100 );
     DT_DrawText("Q quit   P pause   ESC options", game->screen, game->big_font, 75, 125 );
     DT_DrawText("A autopilot   F flight director", game->screen, game->big_font, 75, 150 );
-    DT_DrawText("Press ENTER to play", game->screen, game->big_font, 175, 170 );
+    DT_DrawText("Press ENTER to play", game->screen, game->big_font, 175, 175 );
 
     DT_DrawText("Score for each round = landing pad score + remaining fuel.", game->screen, game->small_font, 150, 280 );
     DT_DrawText("Safe Landing requires X velocity < 0.5 and Y velocity < indicated by landing pad color.", game->screen, game->small_font, 55, 300 );
@@ -1092,7 +1110,7 @@ void new_round(Game *game, int died_won)
 
     game->fuel = game->current_level.fuel;
 
-    /* prograssive gravity if on */
+    /* progressive gravity if on */
     if (game->opt_prog_grav){
       game->gravity = 0.05 + (game->difficulty * 0.001 );
     }
@@ -1794,7 +1812,7 @@ void gameloop(Game *game){
 	  sprintf(display_string, "**PAUSED**"); 
 	    
 	  if (game->small_font > -1){
-	    DT_DrawText(display_string, game->screen, game->small_font, 300, 20);
+	    DT_DrawText(display_string, game->screen, game->small_font, 300, 40);
 	  }
 	}
       }
openSUSE Build Service is sponsored by