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

julio (none) julio at julio-desktop.
Wed Jul 21 04:36:36 UTC 2010


The following commit has been merged in the master branch:
commit e160569a57681e19b77942abc447f66a966528cd
Author: julio <julio at julio-desktop.(none)>
Date:   Tue Jul 20 23:35:56 2010 -0500

    Advancing in the mousemapper...

diff --git a/configure.ac b/configure.ac
index 3f50a08..6f869cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,8 +138,7 @@ dnl Check for SDL_mixer: -------------------------------------------------------
 PKG_CHECK_MODULES([SDL_MIXER],
     [SDL_mixer],
     ,
-    [
-      [echo "SDL_MIXER not found via pkg_config, checking with AC_CHECK_LIB:"]
+    [ [echo "SDL_MIXER not found via pkg_config, checking with AC_CHECK_LIB:"]
       AC_CHECK_LIB([SDL_mixer],
 	 [Mix_OpenAudio],
          ,
@@ -441,6 +440,7 @@ data/fonts/Makefile
 data/images/Makefile
 data/images/backgrounds/Makefile
 data/images/icons/Makefile
+data/images/others/Makefile
 data/images/penguins/Makefile
 data/images/status/Makefile
 data/images/title/Makefile
diff --git a/data/images/Makefile.am b/data/images/Makefile.am
index 0ed668e..8bb2c99 100644
--- a/data/images/Makefile.am
+++ b/data/images/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS = backgrounds \
   terrain \
   forest \
   icons \
+  others \
   penguins \
   status \
   title \
diff --git a/data/images/others/Makefile.am b/data/images/others/Makefile.am
new file mode 100644
index 0000000..76d2c1e
--- /dev/null
+++ b/data/images/others/Makefile.am
@@ -0,0 +1,7 @@
+## Makefile.am for tuxhistory data/images/others:
+
+## Process with AutoMake:
+
+othersdir = $(pkgdatadir)/images/others
+
+dist_others_DATA = isomapper.png
diff --git a/data/images/others/isomapper.png b/data/images/others/isomapper.png
new file mode 100644
index 0000000..2b7e48b
Binary files /dev/null and b/data/images/others/isomapper.png differ
diff --git a/src/game.c b/src/game.c
index fc4df58..5bec4e3 100644
--- a/src/game.c
+++ b/src/game.c
@@ -87,6 +87,8 @@ static void game_handle_user_events(void);
 static void game_handle_mouse(void);
 static int game_mouse_event(SDL_Event event);
 
+static th_point mouse_map(th_point mouse_p, th_point screen_p);
+
 static int check_exit_conditions(void);
 static int game_over(int);
 static int pause_game(void);
@@ -256,8 +258,6 @@ static void game_draw(void)
     if(obj_node != NULL)
     {
         do{
-            //Debug...
-            //printf("Nodes: (%d, %d)\n", obj_node->obj.x, obj_node->obj.y);
             if( gmaps[0][obj_node->obj.x][obj_node->obj.y].anchor.x > origin.x -
                     objects[obj_node->obj.name_enum]->w/2&&
                 gmaps[0][obj_node->obj.x][obj_node->obj.y].anchor.y > origin.y - 
@@ -270,18 +270,11 @@ static void game_draw(void)
                 dest.y = gmaps[0][obj_node->obj.x][obj_node->obj.y].anchor.y - 
                     origin.y - objects[obj_node->obj.name_enum]->h/2;
                 SDL_BlitSurface(objects[obj_node->obj.name_enum], NULL, screen, &dest);
-                /*printf("x: %d y: %d anchors, x: %d y: %d",
-                        obj_node->obj.x,
-                        obj_node->obj.y,
-                        gmaps[0][obj_node->obj.x][obj_node->obj.y].anchor.x,
-                        gmaps[0][obj_node->obj.x][obj_node->obj.y].anchor.y);*/
-            }
+             }
             obj_node = obj_node->next;
         }while(obj_node != NULL);
     }
    
-
-
     /*Third layer: User Interface*/
     dest.x = (screen->w - images[IMG_STOP]->w - 5);
     dest.y = glyph_offset;
@@ -291,6 +284,8 @@ static void game_draw(void)
 }
 static void game_handle_mouse(void)
 {
+    th_point Pmousemap;
+
     if( Pscreen.x < (map_image->w - screen->h) &&
         Pscreen.x > 0 &&
         Pscreen.y < (map_image->h - screen->h) &&
@@ -330,6 +325,16 @@ static void game_handle_mouse(void)
             Pscreen.y = Pscreen.y + OUT_SCROLL;
         }
     }
+    mouse_map(Pmouse, Pscreen);
+}
+
+static th_point mouse_map(th_point mouse_p, th_point screen_p)
+{
+    th_point Pmousemap;
+    Pmousemap.x = (int)(mouse_p.x + screen_p.x + terrain[TUNDRA_CENTER_1]->w/2)/terrain[TUNDRA_CENTER_1]->w;
+    Pmousemap.y = (int)(mouse_p.y + screen_p.y)/terrain[TUNDRA_CENTER_1]->h;
+    printf("Mouse Maping: %d, %d\n", Pmousemap.x, Pmousemap.y);
+    return Pmousemap;
 }
 
 static int pause_game(void)
diff --git a/src/map.c b/src/map.c
index 3a8083b..6ff9e6b 100644
--- a/src/map.c
+++ b/src/map.c
@@ -549,6 +549,8 @@ static int get_tile_num(int i, int k)
 
 int generate_map(void)
 {
+    SDL_Surface* orig = NULL;
+
     SDL_Rect dest;
     th_point anchor;
     int i, j, k, l;
@@ -656,6 +658,13 @@ int generate_map(void)
            (((oe%2)!=0) && (((k+1)%2)!=0))) 
             k++;
     }
+
+    orig = map_image;
+
+    SDL_SetAlpha(orig, SDL_RLEACCEL, SDL_ALPHA_OPAQUE);
+    map_image = SDL_DisplayFormat(orig); /* optimize the format */
+    SDL_FreeSurface(orig);
+
     return 0;
 }
 

-- 
tuxhistory - Educational history game



More information about the Tux4kids-commits mailing list