[Tux4kids-commits] [SCM] tuxhistory - Educational history game branch, master, updated. a1cbd7802a3c7e04b72a3ec039387e311aa4881b

julio (none) julio at julio-desktop.
Wed May 26 07:28:18 UTC 2010


The following commit has been merged in the master branch:
commit a1cbd7802a3c7e04b72a3ec039387e311aa4881b
Author: julio <julio at julio-desktop.(none)>
Date:   Wed May 26 02:13:23 2010 -0500

    Cleaning 2

diff --git a/data/menus/main_menu.xml b/data/menus/main_menu.xml
index 9170b90..d7c1da6 100644
--- a/data/menus/main_menu.xml
+++ b/data/menus/main_menu.xml
@@ -1,46 +1,7 @@
-<menu title="Main Menu" entries="6">
-    <menu title="Play Alone" sprite="alone" entries="5">
-        <item title="Math Command Training Academy" sprite="lesson" run="RUN_ACADEMY">
-        <item title="Math Command Fleet Missions" sprite="fleet" run="RUN_CAMPAIGN">
-        <menu title="Play Arcade Game" sprite="comet" entries="7">
-            <item title="Space Cadet" sprite="tux_helmet_yellow" run="RUN_ARCADE" param="0">
-            <item title="Scout" sprite="tux_helmet_green" run="RUN_ARCADE" param="1">
-            <item title="Ranger" sprite="tux_helmet_blue" run="RUN_ARCADE" param="2">
-            <item title="Ace" sprite="tux_helmet_red" run="RUN_ARCADE" param="3">
-            <item title="Commando" sprite="tux_helmet_black" run="RUN_ARCADE" param="4">
-            <item title="Hall Of Fame" sprite="trophy" run="RUN_HALL_OF_FAME">
-            <item title="Main Menu" sprite="main" run="RUN_MAIN_MENU">
-        </menu>
-        <item title="Play Custom Game" sprite="tux_config_brown" run="RUN_CUSTOM">
-        <item title="Main Menu" sprite="main" run="RUN_MAIN_MENU">
-    </menu>
-    <menu title="Play With Friends" sprite="friends" entries="3">
-        <menu title="Score Sweep" sprite="nums" entries="6">
-            <item title="Space Cadet" sprite="tux_helmet_yellow" run="RUN_SCORE_SWEEP" param="0">
-            <item title="Scout" sprite="tux_helmet_green" run="RUN_SCORE_SWEEP" param="1">
-            <item title="Ranger" sprite="tux_helmet_blue" run="RUN_SCORE_SWEEP" param="2">
-            <item title="Ace" sprite="tux_helmet_red" run="RUN_SCORE_SWEEP" param="3">
-            <item title="Commando" sprite="tux_helmet_black" run="RUN_SCORE_SWEEP" param="4">
-            <item title="Main Menu" sprite="main" run="RUN_MAIN_MENU">
-        </menu>
-        <menu title="Elimination" sprite="exclamation" entries="6">
-            <item title="Space Cadet" sprite="tux_helmet_yellow" run="RUN_ELIMINATION" param="0">
-            <item title="Scout" sprite="tux_helmet_green" run="RUN_ELIMINATION" param="1">
-            <item title="Ranger" sprite="tux_helmet_blue" run="RUN_ELIMINATION" param="2">
-            <item title="Ace" sprite="tux_helmet_red" run="RUN_ELIMINATION" param="3">
-            <item title="Commando" sprite="tux_helmet_black" run="RUN_ELIMINATION" param="4">
-            <item title="Main Menu" sprite="main" run="RUN_MAIN_MENU">
-        </menu>
-        <item title="Main Menu" sprite="main" run="RUN_MAIN_MENU">
-    </menu>
-    <menu title="Factoroids!" sprite="factoroids" entries="3">
-        <item title="Factors" sprite="factors" run="RUN_FACTORS">
-        <item title="Fractions" sprite="fractions" run="RUN_FRACTIONS">
-        <item title="Main Menu" sprite="main" run="RUN_MAIN_MENU">
-    </menu>
+<menu title="Main Menu" entries="4">
+    <item title="Play Alone" sprite="alone" run="RUN_ARCADE">
     <item title="Help" sprite="help" run="RUN_HELP">
-    <menu title="More Options" sprite="tux_config" entries="4">
-        <item title="Demo" sprite="comet" run="RUN_DEMO">
+    <menu title="More Options" sprite="tux_config" entries="3">
         <item title="Project Info" sprite="help" run="RUN_INFO">
         <item title="Credits" sprite="credits" run="RUN_CREDITS">
         <item title="Main Menu" sprite="main" run="RUN_MAIN_MENU">
diff --git a/src/Makefile.am b/src/Makefile.am
index 5216419..28cf9b9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -43,7 +43,6 @@ tuxhistory_SOURCES = tuxhistory.c \
 	SDL_rotozoom.c	\
 	scandir.c	\
 	pixels.c	\
-	server.c	\
 	throttle.c	
 
 
diff --git a/src/fileops.c b/src/fileops.c
index 343da91..76f05fa 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -655,25 +655,7 @@ int parse_lesson_file_directory(void)
 
   /* prevent memory leak in case we called this already and */
   /* free the list:                                         */
-  if(lesson_list_goldstars)
-  {
-    free(lesson_list_goldstars);
-    lesson_list_goldstars = NULL;
-  }
-
-  lesson_list_goldstars = (int*)malloc(num_lessons*sizeof(int));
-  if (!lesson_list_goldstars)
-  {
-    perror("unable to allocate memory for gold star list");
-    return 0;
-  }
-  for (i = 0; i < num_lessons; i++)
-  {
-    lesson_list_goldstars[i] = 0;
-  }
-
   /* Now read file to see what lessons have been previously completed: */
-  read_goldstars();
 
   return (num_lessons > 0);  /* Success! */
 }
@@ -727,21 +709,6 @@ int write_goldstars(void)
   /* find $HOME and add rest of path to config file: */
   get_user_data_dir_with_subdir(opt_path);
   strcat(opt_path, GOLDSTAR_FILENAME);
-
-  DEBUGMSG(debug_fileops, "In write_goldstars() full path to file is: = %s\n", opt_path);
-
-  fp = fopen(opt_path, "w");
-  if (fp)
-  {
-    write_goldstars_fp(fp);
-    fclose(fp);
-    fp = NULL;
-    return 1;
-  }
-  else {
-    fprintf(stderr, "\nUnable to write goldstars file.\n");
-    return 0;
-  }
 }
 
 
diff --git a/src/highscore.c b/src/highscore.c
index f844544..8ceb984 100644
--- a/src/highscore.c
+++ b/src/highscore.c
@@ -967,6 +967,7 @@ int Standby(const char* heading, const char* sub)
     }
 
     /* Handle server messages: */
+    /* TODO: If this code only is relevant for networking, delete
     while(!check_messages(buf))
     {
       if(strncmp(buf,"GO_TO_GAME", strlen("GO_TO_GAME")) == 0)
@@ -986,7 +987,7 @@ int Standby(const char* heading, const char* sub)
         DEBUGMSG(debug_highscore, "Unrecognized message from server: %s\n", buf);
         continue;
       }
-    }
+    }*/
 
     HandleTitleScreenAnimations();
     Throttle(20, &timer);
@@ -1002,170 +1003,3 @@ int Standby(const char* heading, const char* sub)
 
 
 
-int detecting_servers(const char* heading, const char* sub)
-{
-#ifndef HAVE_LIBSDL_NET
-  return 0;
-#else
-  SDL_Rect loc;
-  SDL_Rect TuxRect,
-           stopRect;
-
-  int finished = 0;
-  int tux_frame = 0;
-  Uint32 frame = 0;
-  Uint32 start = 0;
-  Uint32 timer = 0;
-  int servers_found = 0;  
-  sprite* Tux = NULL;
-
-  DEBUGMSG(debug_lan, "\nEnter detecting_servers()\n");
-
-  /* FIXME it takes several seconds to load this sprite on a */
-  /* Dell Mini 9 netbook, probably longer on many school     */
-  /* machines.  Perhaps we should load this ahead of time... */
-  Tux = LoadSprite("tux/bigtux", IMG_ALPHA);
-
-  /* We need to get Unicode vals from SDL keysyms */
-  SDL_EnableUNICODE(SDL_ENABLE);
-
-  /* Draw background: */
-  if (current_bkg())
-    SDL_BlitSurface(current_bkg(), NULL, screen, NULL);
-
-  /* Red "Stop" circle in upper right corner to go back to main menu: */
-  if (images[IMG_STOP])
-  {
-    stopRect.w = images[IMG_STOP]->w;
-    stopRect.h = images[IMG_STOP]->h;
-    stopRect.x = screen->w - images[IMG_STOP]->w;
-    stopRect.y = 0;
-    SDL_BlitSurface(images[IMG_STOP], NULL, screen, &stopRect);
-  }
-
-  if (Tux && Tux->frame[0]) /* make sure sprite has at least one frame */
-  {
-    TuxRect.w = Tux->frame[0]->w;
-    TuxRect.h = Tux->frame[0]->h;
-    TuxRect.x = 0;
-    TuxRect.y = screen->h - Tux->frame[0]->h;
-  }
-
-  /* Draw heading: */
-  {
-    SDL_Surface* s = BlackOutline(_(heading),
-                                  DEFAULT_MENU_FONT_SIZE, &white);
-    if (s)
-    {
-      loc.x = (screen->w/2) - (s->w/2);
-      loc.y = 110;
-      SDL_BlitSurface(s, NULL, screen, &loc);
-      SDL_FreeSurface(s);
-    }
-
-    s = BlackOutline(_(sub),
-                     DEFAULT_MENU_FONT_SIZE, &white);
-    if (s)
-    {
-      loc.x = (screen->w/2) - (s->w/2);
-      loc.y = 140;
-      SDL_BlitSurface(s, NULL, screen, &loc);
-      SDL_FreeSurface(s);
-    }
-  }
-
-  /* and update: */
-  SDL_UpdateRect(screen, 0, 0, 0, 0);
-
-  while (!finished)
-  {
-    start = SDL_GetTicks();
-
-    //Scan local network to find running server:
-    servers_found = LAN_DetectServers();
-    if(servers_found < 1)
-    {
-      printf("No server could be found - returning.\n");
-      /* Turn off SDL Unicode lookup (because has some overhead): */
-      SDL_EnableUNICODE(SDL_DISABLE);
-      FreeSprite(Tux);
-      return 0;
-    }
-    else if(servers_found  == 1)  //One server - connect without player intervention
-    {
-      printf("Single server found - connecting automatically...");
-
-      if(!LAN_AutoSetup(0))  //i.e.first (and only) entry in list
-      {
-        printf("LAN_AutoSetup() failed - returning.\n");
-        /* Turn off SDL Unicode lookup (because has some overhead): */
-        SDL_EnableUNICODE(SDL_DISABLE);
-        FreeSprite(Tux);
-        return 0;
-      }
-      
-      
-      finished = 1;
-      break;  //So we quit scanning as soon as we connect
-      printf("connected\n");
-    } else if (servers_found  > 1)
-    {
-      //TODO display list of servers for player to choose from:
-    }
-
-
-    while (SDL_PollEvent(&event)) 
-    {
-      switch (event.type)
-      {
-        case SDL_QUIT:
-        {
-          cleanup();
-        }
-
-        case SDL_MOUSEBUTTONDOWN:
-        /* "Stop" button - go to main menu: */
-        { 
-          if (inRect(stopRect, event.button.x, event.button.y ))
-          {
-            finished = 1;
-            playsound(SND_TOCK);
-            break;
-          }
-        }
-      }
-    }
-
-    /* --- make tux blink --- */
-    switch (frame % TUX6)
-    {
-      case 0:    tux_frame = 1; break;
-      case TUX1: tux_frame = 2; break;
-      case TUX2: tux_frame = 3; break;
-      case TUX3: tux_frame = 4; break;                        
-      case TUX4: tux_frame = 3; break;
-      case TUX5: tux_frame = 2; break;
-      default: tux_frame = 0;
-    }
-
-    if (Tux && tux_frame)
-    {
-      SDL_BlitSurface(Tux->frame[tux_frame - 1], NULL, screen, &TuxRect);
-      SDL_UpdateRect(screen, TuxRect.x, TuxRect.y, TuxRect.w, TuxRect.h);
-    }
-
-    /* Wait so we keep frame rate constant: */
-    Throttle(20, &timer);
-    frame++;
-  }  // End of while (!finished) loop
-
-
-  /* Turn off SDL Unicode lookup (because has some overhead): */
-  SDL_EnableUNICODE(SDL_DISABLE);
-  FreeSprite(Tux);
-
-  return 1;
-
-#endif
-}
-
diff --git a/src/menu.c b/src/menu.c
index 173586f..cac850f 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1223,6 +1223,7 @@ void RunMainMenu(void)
   DEBUGMSG(debug_menu, "Entering RunMainMenu()\n");
 
    /* lessons menu */
+  /* TODO: If inecesary delete!
   DEBUGMSG(debug_menu, "LoadMenus(): Generating lessons submenu. (%d lessons)\n", num_lessons);
 
   tmp_node = create_empty_node();
@@ -1240,10 +1241,10 @@ void RunMainMenu(void)
   set_font_size();
   prerender_menu(menus[MENU_LESSONS]);
   //prerender_all();
-
+*/
   run_menu(menus[MENU_MAIN], false);
   DEBUGMSG(debug_menu, "Leaving RunMainMenu()\n");
-}
+} 
 
 /* free all loaded menu trees */
 void UnloadMenus(void)
diff --git a/src/setup.c b/src/setup.c
index 341f9f8..321e076 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -729,12 +729,6 @@ void cleanup_memory(void)
     lesson_list_filenames = NULL;
   }
 
-  if (lesson_list_goldstars)
-  {
-    free(lesson_list_goldstars);
-    lesson_list_goldstars = NULL;
-  }
-
   // Close the audio mixer. We have to do this at least as many times
   // as it was opened.
   n_timesopened = Mix_QuerySpec(&frequency,&format,&channels);

-- 
tuxhistory - Educational history game



More information about the Tux4kids-commits mailing list