stratagus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Stratagus-CVS] stratagus/src/map minimap.c


From: Nehal Mistry
Subject: [Stratagus-CVS] stratagus/src/map minimap.c
Date: Thu, 27 Nov 2003 20:21:36 -0500

CVSROOT:        /cvsroot/stratagus
Module name:    stratagus
Branch:         
Changes by:     Nehal Mistry <address@hidden>   03/11/27 20:21:36

Modified files:
        src/map        : minimap.c 

Log message:
        fix minimap for chopped down trees

Patches:
Index: stratagus/src/map/minimap.c
diff -u stratagus/src/map/minimap.c:1.78 stratagus/src/map/minimap.c:1.79
--- stratagus/src/map/minimap.c:1.78    Thu Nov 27 00:43:20 2003
+++ stratagus/src/map/minimap.c Thu Nov 27 20:21:36 2003
@@ -26,7 +26,7 @@
 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 //      02111-1307, USA.
 //
-//     $Id: minimap.c,v 1.78 2003/11/27 05:43:20 nehalmistry Exp $
+//     $Id: minimap.c,v 1.79 2003/11/28 01:21:36 nehalmistry Exp $
 
 //@{
 
@@ -195,7 +195,8 @@
 
            ((Uint8*)MinimapTerrainSurface->pixels)[mx + my * TheUI.MinimapW] =
                ((Uint8*)TheMap.TileGraphic->Surface->pixels)
-                   [xofs + 7 + (mx % scalex) * 8 + (yofs + 6 + (my % scaley) * 
8) * TheMap.TileGraphic->Surface->w];
+                   [xofs + 7 + (mx % scalex) * 8 + (yofs + 6 + (my % scaley) * 
8) 
+                   * TheMap.TileGraphic->Surface->w];
        }
     }
     SDL_UnlockSurface(MinimapTerrainSurface);
@@ -229,6 +230,7 @@
     //
     // Pixel 7,6 7,14, 15,6 15,14 are taken for the minimap picture.
     //
+    SDL_LockSurface(TheMap.TileGraphic->Surface);
     SDL_LockSurface(MinimapTerrainSurface);
 
     ty *= TheMap.Width;
@@ -258,13 +260,15 @@
            yofs = TileSizeY * (tile / tilepitch);
 
            // FIXME: does this work?
-           ((unsigned char*)MinimapTerrainSurface->pixels)[mx + my * 
TheUI.MinimapW] =
-               ((unsigned char*)TheMap.TileGraphic->Surface->pixels)[xofs + 7 
+ 
-               (mx % scalex) * 8 + (yofs + 6 + (my % scaley) * 8) * TileSizeX];
+           ((Uint8*)MinimapTerrainSurface->pixels)[mx + my * TheUI.MinimapW] =
+               ((Uint8*)TheMap.TileGraphic->Surface->pixels)
+                   [xofs + 7 + (mx % scalex) * 8 + (yofs + 6 + (my % scaley) * 
8) 
+                   * TheMap.TileGraphic->Surface->w];
 //         ((unsigned char*)MinimapTerrainGraphic->Frames)[mx + my * 
TheUI.MinimapW] =
 //             TheMap.Tiles[tile][7 + (mx % scalex) * 8 + (6 + (my % scaley) * 
8) * TileSizeX];
        }
     }
+    SDL_UnlockSurface(TheMap.TileGraphic->Surface);
     SDL_UnlockSurface(MinimapTerrainSurface);
 }
 
@@ -305,11 +309,11 @@
                ((Uint8*)MinimapSurface->pixels)[mx + my * TheUI.MinimapW] = 
                    ((Uint8*)MinimapTerrainSurface->pixels)[mx + my * 
TheUI.MinimapW];
            } else if (visiontype > 0) {
-               ((Uint8*)MinimapSurface->pixels)[mx + my * TheUI.MinimapW] = 0; 
// FIXME: black
+               ((Uint8*)MinimapSurface->pixels)[mx + my * TheUI.MinimapW] = 
+                   SDL_MapRGB(MinimapSurface->format, 0, 0, 0);
            }
        }
     }
-
     SDL_UnlockSurface(MinimapTerrainSurface);
 
     //
@@ -405,7 +409,6 @@
                    SDL_MapRGB(MinimapSurface->format, color.r, color.g, 
color.b);
            }
        }
-
     }
     SDL_UnlockSurface(MinimapSurface);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]