Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22379/src

Modified Files:
	data.c death.c defaults.c defwin.c local.c map.c mswindow.c 
	newwin.c option.c 
Log Message:
New planet bitmaps!  Using Defcom's art.  Changeable via planets menu.
New netrekrc option, "planetBitmapGalaxy: (0-3)", same options as planetBitmap, but now you have
the choice to change map display planets too!  And have map and local planets use different
bitmap sets
Fixed bug where map window border wasn't being redrawn on death
Shortpackets is now off by default.  In the current state of internet connectivity, most people
 don't need the reduced packets, which don't send complete information and break certain features
 such as which direction other players are moving, robot shields, observer geno messages,
 shield/cloak status for warp 0 players, etc.
Fix to problem with bottom and right borders in certain windows (like map) getting overwritten - thanks Stas!
Client now recognizes planets that are flagged as "core", waiting on server patch to
actually get this information and do something with it

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mswindow.c	13 May 2006 03:37:36 -0000	1.19
+++ mswindow.c	14 May 2006 02:14:54 -0000	1.20
@@ -485,7 +485,27 @@
     free (eplasmatorp);
     free (mplasmatorp);
 
-
+    for (i = 0; i < NUMTEAMS; i++)
+    {
+    	free (planet_earth[i]);
+    	free (planet_klingus[i]);
+    	free (planet_orion[i]);
+    	free (planet_romulus[i]);
+    	free (planet_agri1[i]);
+    	free (planet_agri2[i]);
+    	free (planet_rock1[i]);
+    	free (planet_rock2[i]);
+    }
+    free (planet_bitmaps[0]);
+    free (planet_bitmaps[1]);
+    free (planet_bitmaps[2]);
+    free (planet_bitmaps[3]);
+    free (planet_bitmaps[4]);
+    free (planet_bitmaps[5]);
+    free (planet_bitmaps[6]);
+    free (planet_bitmaps[7]);
+    free (planet_unknown);
+    
     for (i = 0; i < PLANET_VIEWS; i++)
         free (bplanets[i]);
     for (i = 0; i < MPLANET_VIEWS; i++)
@@ -1491,9 +1511,6 @@
         SelectPalette (hdc, NetrekPalette, FALSE);
         RealizePalette (hdc);
     }
-    // FillRect doesn't do the edges (right and bottom) -SAC 
-    r.right++;
-    r.bottom++;
     FillRect (hdc, &r, colortable[W_Black].brush);
     ReleaseDC (win->hwnd, hdc);
 }
@@ -3838,48 +3855,74 @@
 void
 W_WriteScaleBitmap (int x,
                     int y,
-                    float SCALEX,
-                    float SCALEY,
+                    int destwidth,
+                    int destheight,
+                    int srcwidth,
+                    int srcheight,
                     unsigned char p_dir,
                     W_Icon icon,
-                    W_Color color)
+                    W_Color color,
+                    W_Window window)
 {
     register struct Icon *bitmap = (struct Icon *) icon;
-    register int borderx, bordery, width, height;
+    register int border;
     register int srcx, srcy;
     HDC hdc;
     HBITMAP newbmp;
     XFORM xForm;
+    int newwidth, newheight;
     double radians;
-    float cosine, sine, Point1x, Point1y, Point2x, Point2y, Point3x, Point3y;
-    float xscale, yscale;
-    float eDx, eDy;
+    float cosine, sine, xscale, yscale, eDx, eDy;
+    FNHEADER_VOID;
 
-    //Fast (I hope) rectangle intersection, don't overwrite our borders
+    // First copy bitmap into new bitmap, and scale it.  This makes life
+    // easier for doing border intersection
     srcx = bitmap->x;
     srcy = bitmap->y;
-    borderx = bitmap->ClipRectAddr->left;
-    x += borderx;
-    bordery = bitmap->ClipRectAddr->top;
-    y += bordery;
-
-    width = bitmap->width;
-    height = bitmap->height;
     
-    hdc = GetDC (bitmap->hwnd);
-    newbmp = CreateCompatibleBitmap ( hdc, width, height );
+    hdc = GetDC (win->hwnd);
+    newbmp = CreateCompatibleBitmap ( hdc, destwidth, destheight );
+    
+    SelectObject (GlobalMemDC, bitmap->bm);
+    SelectObject (GlobalMemDC2, newbmp);
+    
+    // Copy selected section of main bitmap into newbmp before rotation
+    SetStretchBltMode(GlobalMemDC2, COLORONCOLOR);
+    StretchBlt(GlobalMemDC2, 0, 0, destwidth, destheight, GlobalMemDC,
+               srcx, srcy, srcwidth, srcheight, SRCPAINT);
+    
+    //Fast (I hope) rectangle intersection, don't overwrite our borders
+    border = win->ClipRect.top;
+    
+    // Reset srcx and srcy as our new source bitmap starts at 0,0
+    srcx = 0;
+    srcy = 0;
+    x += border;
+    y += border;
+ 
+    if (x < border)
+    {
+        newwidth = destwidth - (border - x);
+        srcx += border - x;
+        x = border;
+    }
+    else if ((newwidth = win->ClipRect.right - x) > destwidth)
+        newwidth = destwidth;
+    if (y < border)
+    {
+        newheight = destheight - (border - y);
+        srcy += (border - y);
+        y = border;
+    }
+    else if ((newheight = win->ClipRect.bottom - y) > destheight)
+        newheight = destheight;
 
     if (NetrekPalette)
     {
         SelectPalette (hdc, NetrekPalette, FALSE);
         RealizePalette (hdc);
     }
-    SelectObject (GlobalMemDC, bitmap->bm);
-    SelectObject (GlobalMemDC2, newbmp);
-    
-    // Copy selected section of main bitmap into newbmp before rotation
-    BitBlt (GlobalMemDC2, 0, 0, width, height, GlobalMemDC, srcx, srcy, SRCPAINT);
-    
+
     //Set the color of the bitmap
     //(oddly enough, 1-bit = bk color, 0-bit = text (fg) color)
     SetBkColor (hdc, colortable[color].rgb);
@@ -3887,40 +3930,39 @@
     
     //Convert p_dir to radians 
     radians=(2*3.14159*p_dir*360/255)/360;
-    //Setworldtransform screws up at angle = 0, slight hack to fix
-    if (radians == 0.0)
-        radians = 0.0000001;
+
     cosine=(float)cos(radians);
     sine=(float)sin(radians);
     
     // Scale used to find bitmap center
-    xscale = (float)(width/SCALEX/2);
-    yscale = (float)(height/SCALEY/2);
-    
-    // Compute dimensions of the resulting bitmap
-    // First get the coordinates of the 3 corners other than origin
-    Point1x=(height*sine);
-    Point1y=(height*cosine);
-    Point2x=(width*cosine+height*sine);
-    Point2y=(height*cosine-width*sine);
-    Point3x=(width*cosine);
-    Point3y=-(width*sine);
+    xscale = (float)(newwidth/2);
+    yscale = (float)(newheight/2);
 
     eDx = x + xscale - cosine*(xscale) + sine*(yscale);
     eDy = y + yscale - cosine*(yscale) - sine*(xscale);
     SetGraphicsMode(hdc,GM_ADVANCED);
 
-    xForm.eM11=cosine/SCALEX;
-    xForm.eM12=sine/SCALEX;
-    xForm.eM21=-sine/SCALEY;
-    xForm.eM22=cosine/SCALEY;
+    xForm.eM11=cosine;
+    xForm.eM12=sine;
+    xForm.eM21=-sine;
+    xForm.eM22=cosine;
     xForm.eDx = eDx;
     xForm.eDy = eDy;
 
     SetWorldTransform(hdc,&xForm);
-    BitBlt(hdc, 0, 0, width, height, GlobalMemDC2, 0, 0, SRCPAINT);
-          
-    ReleaseDC (bitmap->hwnd, hdc);
+    BitBlt(hdc, 0, 0, newwidth, newheight, GlobalMemDC2, srcx, srcy, SRCPAINT);
+   
+    // Reset xForm
+    xForm.eM11 = (FLOAT) 1.0; 
+    xForm.eM12 = (FLOAT) 0.0; 
+    xForm.eM21 = (FLOAT) 0.0; 
+    xForm.eM22 = (FLOAT) 1.0; 
+    xForm.eDx  = (FLOAT) 0.0; 
+    xForm.eDy  = (FLOAT) 0.0; 
+
+    SetWorldTransform(hdc,&xForm); 
+    
+    ReleaseDC (win->hwnd, hdc);
     DeleteObject (newbmp);
 
 /*  Alternative method using PlgBlt, left in for reference purposes
@@ -4918,6 +4960,100 @@
     ReleaseDC (bitmap->hwnd, hdc);
 }
 
+void
+W_OverlayScaleBitmap (int x,
+                      int y,
+                      int destwidth,
+                      int destheight,
+                      int srcwidth,
+                      int srcheight,
+                      W_Icon icon,
+                      W_Color color,
+                      W_Window window)
+{
+    register struct Icon *bitmap = (struct Icon *) icon;
+    register int border;
+    register int srcx, srcy;
+    HDC hdc;
+    HBITMAP newbmp;
+    XFORM xForm;
+    int newwidth, newheight;
+    FNHEADER_VOID;
+
+    // First copy bitmap into new bitmap, and scale it.  This makes life
+    // easier for doing border intersection
+    srcx = bitmap->x;
+    srcy = bitmap->y;
+    
+    hdc = GetDC (win->hwnd);
+    newbmp = CreateCompatibleBitmap ( hdc, destwidth, destheight );
+    
+    SelectObject (GlobalMemDC, bitmap->bm);
+    SelectObject (GlobalMemDC2, newbmp);
+    
+    // Copy selected section of main bitmap into newbmp before rotation
+    SetStretchBltMode(GlobalMemDC2, COLORONCOLOR);
+    StretchBlt(GlobalMemDC2, 0, 0, destwidth, destheight, GlobalMemDC,
+               srcx, srcy, srcwidth, srcheight, SRCPAINT);
+  
+    // Copy selected section of main bitmap into newbmp before rotation
+    SetStretchBltMode(GlobalMemDC2, COLORONCOLOR);
+    StretchBlt(GlobalMemDC2, 0, 0, destwidth, destheight, GlobalMemDC,
+               srcx, srcy, srcwidth, srcheight, SRCPAINT);
+    
+    //Fast (I hope) rectangle intersection, don't overwrite our borders
+    border = win->ClipRect.top;
+    
+    // Reset srcx and srcy as our new source bitmap starts at 0,0
+    srcx = 0;
+    srcy = 0;
+    x += border;
+    y += border;
+ 
+    if (x < border)
+    {
+        newwidth = destwidth - (border - x);
+        srcx += border - x;
+        x = border;
+    }
+    else if ((newwidth = win->ClipRect.right - x) > destwidth)
+        newwidth = destwidth;
+    if (y < border)
+    {
+        newheight = destheight - (border - y);
+        srcy += (border - y);
+        y = border;
+    }
+    else if ((newheight = win->ClipRect.bottom - y) > destheight)
+        newheight = destheight;
+
+    if (NetrekPalette)
+    {
+        SelectPalette (hdc, NetrekPalette, FALSE);
+        RealizePalette (hdc);
+    }
+
+    //Set the color of the bitmap
+    //(oddly enough, 1-bit = bk color, 0-bit = text (fg) color)
+    SetBkColor (hdc, colortable[color].rgb);
+    SetTextColor (hdc, colortable[BLACK].rgb);
+
+    SetGraphicsMode(hdc,GM_ADVANCED);
+
+    xForm.eM11 = (FLOAT) 1.0; 
+    xForm.eM12 = (FLOAT) 0.0; 
+    xForm.eM21 = (FLOAT) 0.0; 
+    xForm.eM22 = (FLOAT) 1.0; 
+    xForm.eDx = (float)x;
+    xForm.eDy = (float)y;
+
+    SetWorldTransform(hdc,&xForm);
+    BitBlt(hdc, 0, 0, newwidth, newheight, GlobalMemDC2, 0, 0, SRCPAINT);
+    
+    ReleaseDC (win->hwnd, hdc);
+    DeleteObject (newbmp);
+}
+
 #ifdef BEEPLITE
 void W_EraseTTSText(W_Window window, int last_tts_xpos, int tts_ypos, int last_tts_width)
 {
@@ -5366,9 +5502,6 @@
         SelectPalette (sdb->mem_dc, NetrekPalette, FALSE);
         RealizePalette (sdb->mem_dc);
     }
-    // FillRect doesn't do the edges (right and bottom) -SAC 
-    r.right++;
-    r.bottom++;
     FillRect (sdb->mem_dc, &r, colortable[W_Black].brush);
 }
 
@@ -5845,87 +5978,127 @@
 
 
 void
-W_WriteScaleBitmapDB (SDBUFFER * sdb, int x, int y, float SCALEX, float SCALEY,
-                    unsigned char p_dir, W_Icon icon, W_Color color)
+W_WriteScaleBitmapDB (SDBUFFER * sdb, int x, int y, int destwidth, int destheight,
+                      int srcwidth, int srcheight, unsigned char p_dir, W_Icon icon,
+                      W_Color color, W_Window window)
 {
     register struct Icon *bitmap = (struct Icon *) icon;
-    register int borderx, bordery, width, height;
+    register int border;
     register int srcx, srcy;
     HBITMAP newbmp;
     XFORM xForm;
+    int newwidth, newheight;
     double radians;
-    float cosine, sine, Point1x, Point1y, Point2x, Point2y, Point3x, Point3y;
-    float xscale, yscale;
-    float eDx, eDy;
-    
-    //Fast (I hope) rectangle intersection, don't overwrite our borders
+    float Point1x, Point1y, Point2x, Point2y, Point3x, Point3y;
+    float minx, maxx, miny, maxy;
+    float cosine, sine, xscale, yscale, eDx, eDy;
+    FNHEADER_VOID;
+
+    // First copy bitmap into new bitmap, and scale it.  This makes life
+    // easier for doing border intersection
     srcx = bitmap->x;
     srcy = bitmap->y;
-    borderx = bitmap->ClipRectAddr->left;
-    x += borderx;
-    bordery = bitmap->ClipRectAddr->top;
-    y += bordery;
-
-    width = bitmap->width;
-    height = bitmap->height;
-
-    newbmp = CreateCompatibleBitmap ( sdb->mem_dc, width, height );
-
-    if (NetrekPalette)
-    {
-
-        SelectPalette (sdb->mem_dc, NetrekPalette, FALSE);
-        RealizePalette (sdb->mem_dc);
-    }
+    
+    newbmp = CreateCompatibleBitmap ( sdb->mem_dc, destwidth, destheight );
+    
     SelectObject (GlobalMemDC, bitmap->bm);
     SelectObject (GlobalMemDC2, newbmp);
     
     // Copy selected section of main bitmap into newbmp before rotation
-    BitBlt (GlobalMemDC2, 0, 0, width, height, GlobalMemDC, srcx, srcy, SRCPAINT);
-    
-    //Set the color of the bitmap
-    //(oddly enough, 1-bit = bk color, 0-bit = text (fg) color)
-    SetBkColor (sdb->mem_dc, colortable[color].rgb);
-    SetTextColor (sdb->mem_dc, colortable[BLACK].rgb);
+    SetStretchBltMode(GlobalMemDC2, COLORONCOLOR);
+    StretchBlt(GlobalMemDC2, 0, 0, destwidth, destheight, GlobalMemDC,
+               srcx, srcy, srcwidth, srcheight, SRCPAINT);
     
+    //Fast (I hope) rectangle intersection, don't overwrite our borders
+    border = win->ClipRect.top;
+        
     //Convert p_dir to radians 
     radians=(2*3.14159*p_dir*360/255)/360;
-    //Setworldtransform screws up at angle = 0, slight hack to fix
-    if (radians == 0.0)
-        radians = 0.0000001;
+
+    // Calculate angle of rotation
     cosine=(float)cos(radians);
     sine=(float)sin(radians);
     
-    // Scale used to find bitmap center
-    xscale = (float)(width/SCALEX/2);
-    yscale = (float)(height/SCALEY/2);
-    
+    // Reset srcx and srcy as our new source bitmap starts at 0,0
+    srcx = 0;
+    srcy = 0;
+    x += border;
+    y += border;
+ 
     // Compute dimensions of the resulting bitmap
     // First get the coordinates of the 3 corners other than origin
-    Point1x=(height*sine);
-    Point1y=(height*cosine);
-    Point2x=(width*cosine+height*sine);
-    Point2y=(height*cosine-width*sine);
-    Point3x=(width*cosine);
-    Point3y=-(width*sine);
+    Point1x=(destheight*sine);
+    Point1y=(destheight*cosine);
+    Point2x=(destwidth*cosine+destheight*sine);
+    Point2y=(destheight*cosine-destwidth*sine);
+    Point3x=(destwidth*cosine);
+    Point3y=-(destwidth*sine);
+    
+    minx=min(0,min(Point1x,min(Point2x,Point3x))); 
+    miny=min(0,min(Point1y,min(Point2y,Point3y))); 
+    maxx=max(0,max(Point1x,max(Point2x,Point3x))); 
+    maxy=max(0,max(Point1y,max(Point2y,Point3y)));
+    
+    // Set the new destination height and width - needs work
+   // destwidth =(int)ceil(maxx-minx); 
+   // destheight =(int)ceil(maxy-miny);
+    
+    if (x < border)
+    {
+        newwidth = destwidth - (border - x);
+        srcx += border - x;
+        x = border;
+    }
+    else if ((newwidth = win->ClipRect.right - x) > destwidth)
+        newwidth = destwidth;
+    if (y < border)
+    {
+        newheight = destheight - (border - y);
+        srcy += (border - y);
+        y = border;
+    }
+    else if ((newheight = win->ClipRect.bottom - y) > destheight)
+        newheight = destheight;
 
+    if (NetrekPalette)
+    {
+        SelectPalette (sdb->mem_dc, NetrekPalette, FALSE);
+        RealizePalette (sdb->mem_dc);
+    }
+
+    //Set the color of the bitmap
+    //(oddly enough, 1-bit = bk color, 0-bit = text (fg) color)
+    SetBkColor (sdb->mem_dc, colortable[color].rgb);
+    SetTextColor (sdb->mem_dc, colortable[BLACK].rgb);
+    
+    // Find bitmap center
+    xscale = (float)(newwidth/2);
+    yscale = (float)(newheight/2);
+    
     eDx = x + xscale - cosine*(xscale) + sine*(yscale);
     eDy = y + yscale - cosine*(yscale) - sine*(xscale);
+    SetGraphicsMode(sdb->mem_dc,GM_ADVANCED);
 
-  //  SetGraphicsMode(sdb->mem_dc,GM_ADVANCED);
-    
-    xForm.eM11=cosine/SCALEX;
-    xForm.eM12=sine/SCALEX;
-    xForm.eM21=-sine/SCALEY;
-    xForm.eM22=cosine/SCALEY;
+    xForm.eM11=cosine;
+    xForm.eM12=sine;
+    xForm.eM21=-sine;
+    xForm.eM22=cosine;
     xForm.eDx = eDx;
     xForm.eDy = eDy;
+
+    SetWorldTransform(sdb->mem_dc,&xForm);
+    BitBlt(sdb->mem_dc, 0, 0, newwidth, newheight, GlobalMemDC2, srcx, srcy, SRCPAINT);
+   
+    // Reset xForm
+    xForm.eM11 = (FLOAT) 1.0; 
+    xForm.eM12 = (FLOAT) 0.0; 
+    xForm.eM21 = (FLOAT) 0.0; 
+    xForm.eM22 = (FLOAT) 1.0; 
+    xForm.eDx  = (FLOAT) 0.0; 
+    xForm.eDy  = (FLOAT) 0.0; 
+
+    SetWorldTransform(sdb->mem_dc,&xForm); 
     
-    SetStretchBltMode(sdb->mem_dc, COLORONCOLOR);
-   // SetWorldTransform(sdb->mem_dc,&xForm);
-   // BitBlt(hdc, 0, 0, width, height, GlobalMemDC2, 0, 0, SRCPAINT);
-   // BitBlt(sdb->mem_dc, 0, 0, width, height, GlobalMemDC2, 0, 0, SRCPAINT);
-    StretchBlt(sdb->mem_dc, x, y, (int)(width/SCALEX), (int)(height/SCALEY), GlobalMemDC2, 0, 0, width, height, SRCPAINT);
     DeleteObject (newbmp);
 }
 
@@ -6037,6 +6210,100 @@
     BitBlt (sdb->mem_dc, x, y,          //Copy the bitmap
             width, height, GlobalMemDC, srcx, srcy, SRCPAINT);  // <-- using OR mode
 }
+
+void
+W_OverlayScaleBitmapDB (SDBUFFER * sdb, int x, int y, int destwidth, int destheight,
+                        int srcwidth, int srcheight, W_Icon icon, W_Color color, W_Window window)
+{
+    register struct Icon *bitmap = (struct Icon *) icon;
+    register int border;
+    register int srcx, srcy;
+    HBITMAP newbmp;
+    XFORM xForm;
+    int newwidth, newheight;
+    FNHEADER_VOID;
+
+    // First copy bitmap into new bitmap, and scale it.  This makes life
+    // easier for doing border intersection
+    srcx = bitmap->x;
+    srcy = bitmap->y;
+    
+    newbmp = CreateCompatibleBitmap ( sdb->mem_dc, destwidth, destheight );
+    
+    SelectObject (GlobalMemDC, bitmap->bm);
+    SelectObject (GlobalMemDC2, newbmp);
+    
+    // Copy selected section of main bitmap into newbmp before rotation
+    SetStretchBltMode(GlobalMemDC2, COLORONCOLOR);
+    StretchBlt(GlobalMemDC2, 0, 0, destwidth, destheight, GlobalMemDC,
+               srcx, srcy, srcwidth, srcheight, SRCPAINT);
+  
+    // Copy selected section of main bitmap into newbmp before rotation
+    SetStretchBltMode(GlobalMemDC2, COLORONCOLOR);
+    StretchBlt(GlobalMemDC2, 0, 0, destwidth, destheight, GlobalMemDC,
+               srcx, srcy, srcwidth, srcheight, SRCPAINT);
+    
+    //Fast (I hope) rectangle intersection, don't overwrite our borders
+    border = win->ClipRect.top;
+    
+    // Reset srcx and srcy as our new source bitmap starts at 0,0
+    srcx = 0;
+    srcy = 0;
+    x += border;
+    y += border;
+ 
+    if (x < border)
+    {
+        newwidth = destwidth - (border - x);
+        srcx += border - x;
+        x = border;
+    }
+    else if ((newwidth = win->ClipRect.right - x) > destwidth)
+        newwidth = destwidth;
+    if (y < border)
+    {
+        newheight = destheight - (border - y);
+        srcy += (border - y);
+        y = border;
+    }
+    else if ((newheight = win->ClipRect.bottom - y) > destheight)
+        newheight = destheight;
+
+    if (NetrekPalette)
+    {
+        SelectPalette (sdb->mem_dc, NetrekPalette, FALSE);
+        RealizePalette (sdb->mem_dc);
+    }
+
+    //Set the color of the bitmap
+    //(oddly enough, 1-bit = bk color, 0-bit = text (fg) color)
+    SetBkColor (sdb->mem_dc, colortable[color].rgb);
+    SetTextColor (sdb->mem_dc, colortable[BLACK].rgb);
+
+    SetGraphicsMode(sdb->mem_dc,GM_ADVANCED);
+
+    xForm.eM11 = (FLOAT) 1.0; 
+    xForm.eM12 = (FLOAT) 0.0; 
+    xForm.eM21 = (FLOAT) 0.0; 
+    xForm.eM22 = (FLOAT) 1.0; 
+    xForm.eDx = (float)x;
+    xForm.eDy = (float)y;
+
+    SetWorldTransform(sdb->mem_dc,&xForm);
+    BitBlt(sdb->mem_dc, 0, 0, newwidth, newheight, GlobalMemDC2, 0, 0, SRCPAINT);
+   
+    // Reset xForm
+    xForm.eM11 = (FLOAT) 1.0; 
+    xForm.eM12 = (FLOAT) 0.0; 
+    xForm.eM21 = (FLOAT) 0.0; 
+    xForm.eM22 = (FLOAT) 1.0; 
+    xForm.eDx  = (FLOAT) 0.0; 
+    xForm.eDy  = (FLOAT) 0.0; 
+
+    SetWorldTransform(sdb->mem_dc,&xForm); 
+    
+    DeleteObject (newbmp);
+}
 #endif /* DOUBLE_BUFFERING */
 
 // Make a WIN_SCROLL type window.

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- newwin.c	7 May 2006 16:59:27 -0000	1.20
+++ newwin.c	14 May 2006 02:14:54 -0000	1.21
@@ -56,6 +56,7 @@
 void loadbitmapsG (void);
 void loadbitmapsHR (void);
 void loadweaponsC (void);
+void loadplanetsC (void);
 
 /******************************************************************************/
 /***   loadbitmaps(), loadbitmaps1(), loadbitmapsT(), loadbitmapsG(),
@@ -567,6 +568,83 @@
 }
 
 /******************************************************************************/
+/***  loadplanetsC() - colorized planets
+/******************************************************************************/
+void loadplanetsC()
+{    
+    int j;
+
+    /* Load the eight 5x1 planet bitmaps */
+    planet_bitmaps[0] =
+        W_StoreBitmap3 ("bitmaps/planlibm/color/earth.bmp",
+                        BMP_CPLANET_WIDTH * NUMTEAMS, BMP_CPLANET_HEIGHT, BMP_EARTH, w,
+                        LR_DEFAULTCOLOR);
+    planet_bitmaps[1] =
+        W_StoreBitmap3 ("bitmaps/planlibm/color/klingus.bmp",
+                        BMP_CPLANET_WIDTH * NUMTEAMS, BMP_CPLANET_HEIGHT, BMP_KLINGUS, w,
+                        LR_DEFAULTCOLOR);
+    planet_bitmaps[2] =
+        W_StoreBitmap3 ("bitmaps/planlibm/color/orion.bmp",
+                        BMP_CPLANET_WIDTH * NUMTEAMS, BMP_CPLANET_HEIGHT, BMP_ORION, w,
+                        LR_DEFAULTCOLOR);
+    planet_bitmaps[3] =
+        W_StoreBitmap3 ("bitmaps/planlibm/color/romulus.bmp",
+                        BMP_CPLANET_WIDTH * NUMTEAMS, BMP_CPLANET_HEIGHT, BMP_ROMULUS, w,
+                        LR_DEFAULTCOLOR);
+    planet_bitmaps[4] =
+        W_StoreBitmap3 ("bitmaps/planlibm/color/agri1.bmp",
+                        BMP_CPLANET_WIDTH * NUMTEAMS, BMP_CPLANET_HEIGHT, BMP_AGRI1, w,
+                        LR_DEFAULTCOLOR);
+    planet_bitmaps[5] =
+        W_StoreBitmap3 ("bitmaps/planlibm/color/agri2.bmp",
+                        BMP_CPLANET_WIDTH * NUMTEAMS, BMP_CPLANET_HEIGHT, BMP_AGRI2, w,
+                        LR_DEFAULTCOLOR);
+    planet_bitmaps[6] =
+        W_StoreBitmap3 ("bitmaps/planlibm/color/rock1.bmp",
+                        BMP_CPLANET_WIDTH * NUMTEAMS, BMP_CPLANET_HEIGHT, BMP_ROCK1, w,
+                        LR_DEFAULTCOLOR);
+    planet_bitmaps[7] =
+        W_StoreBitmap3 ("bitmaps/planlibm/color/rock2.bmp",
+                        BMP_CPLANET_WIDTH * NUMTEAMS, BMP_CPLANET_HEIGHT, BMP_ROCK2, w,
+                        LR_DEFAULTCOLOR);  
+                                          
+    /* Make pointers to the bitmaps */
+    for (j = 0; j < NUMTEAMS; j++)
+    {
+    	planet_earth[j] =
+    	    W_PointBitmap2 (planet_bitmaps[0], j, 0, BMP_CPLANET_WIDTH,
+                            BMP_CPLANET_HEIGHT);
+    	planet_klingus[j]=
+    	    W_PointBitmap2 (planet_bitmaps[1], j, 0, BMP_CPLANET_WIDTH,
+                            BMP_CPLANET_HEIGHT);
+    	planet_orion[j]=
+    	    W_PointBitmap2 (planet_bitmaps[2], j, 0, BMP_CPLANET_WIDTH,
+                            BMP_CPLANET_HEIGHT);
+    	planet_romulus[j]=
+    	    W_PointBitmap2 (planet_bitmaps[3], j, 0, BMP_CPLANET_WIDTH,
+                            BMP_CPLANET_HEIGHT);
+    	planet_agri1[j]=
+    	    W_PointBitmap2 (planet_bitmaps[4], j, 0, BMP_CPLANET_WIDTH,
+                            BMP_CPLANET_HEIGHT);
+    	planet_agri2[j]=
+    	    W_PointBitmap2 (planet_bitmaps[5], j, 0, BMP_CPLANET_WIDTH,
+                            BMP_CPLANET_HEIGHT);
+    	planet_rock1[j]=
+    	    W_PointBitmap2 (planet_bitmaps[6], j, 0, BMP_CPLANET_WIDTH,
+                            BMP_CPLANET_HEIGHT);
+    	planet_rock2[j]=
+    	    W_PointBitmap2 (planet_bitmaps[7], j, 0, BMP_CPLANET_WIDTH,
+                            BMP_CPLANET_HEIGHT);
+    }
+                        
+    /* Load the unknown planet bitmap */
+    planet_unknown =
+        W_StoreBitmap3 ("bitmaps/planlibm/color/unknown.bmp",
+                        BMP_CPLANET_WIDTH, BMP_CPLANET_HEIGHT, BMP_PLANET_UNKNOWN, w,
+                        LR_DEFAULTCOLOR);
+}
+
+/******************************************************************************/
 /***  handleMessageWindowKeyDown()
 /******************************************************************************/
 static void
@@ -907,19 +985,30 @@
     char *MPlanlib;
 
     planetBitmap = intDefault ("planetBitmap", planetBitmap);
-
-    switch (planetBitmap)
+    planetBitmapGalaxy = intDefault ("planetBitmapGalaxy", planetBitmapGalaxy);
+    loadplanetsC();  // Always load new color planet bitmaps..for now
+    
+    switch (planetBitmap) // Case 3 = new color, but we never use Planlib
     {
     case 1:
         Planlib = "bitmaps/planlibm/planM.bmp";
-        MPlanlib = "bitmaps/planlibm/mplanM.bmp";
         break;
     case 2:
         Planlib = "bitmaps/planlibm/planR.bmp";
-        MPlanlib = "bitmaps/planlibm/mplanR.bmp";
         break;
     default:
         Planlib = "bitmaps/planlibm/plan.bmp";
+        break;
+    }
+    switch (planetBitmapGalaxy) // Case 3 = new color, but we never use MPlanlib
+    {
+    case 1:
+        MPlanlib = "bitmaps/planlibm/mplanM.bmp";
+        break;
+    case 2:
+        MPlanlib = "bitmaps/planlibm/mplanR.bmp";
+        break;
+    default:
         MPlanlib = "bitmaps/planlibm/mplan.bmp";
         break;
     }

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- local.c	12 May 2006 20:51:31 -0000	1.21
+++ local.c	14 May 2006 02:14:54 -0000	1.22
@@ -259,8 +259,8 @@
             dyy = (int) (Sin[mydir] * streaklength);
             for (i = 0, s = star_sector; i < 16; i++, s++)
             {
-                dx = (s->s_x + xbase) - (me->p_x - (me->p_x % 40));
-                dy = (s->s_y + ybase) - (me->p_y - (me->p_y % 40));
+                dx = (s->s_x + xbase) - (me->p_x - (me->p_x % SCALE));
+                dy = (s->s_y + ybase) - (me->p_y - (me->p_y % SCALE));
                 if (ABS(dx) > (view) || ABS(dy) > (view))
                     continue;
 
@@ -283,8 +283,8 @@
     }
     for (i = 0, s = star_sector; i < 16; i++, s++)
     {
-        dx = (s->s_x + xbase) - (me->p_x - (me->p_x % 40));
-        dy = (s->s_y + ybase) - (me->p_y - (me->p_y % 40));
+        dx = (s->s_x + xbase) - (me->p_x - (me->p_x % SCALE));
+        dy = (s->s_y + ybase) - (me->p_y - (me->p_y % SCALE));
         if (ABS(dx) > (view) || ABS(dy) > (view))
             continue;
 
@@ -354,17 +354,45 @@
 
         dx = dx / SCALE + WINSIDE / 2;
         dy = dy / SCALE + WINSIDE / 2;
-
+        
+        if (planetBitmap == 3)
+        {
 #ifndef DOUBLE_BUFFERING
-        W_WriteBitmap (dx - (BMP_PLANET_WIDTH / 2),
-                       dy - (BMP_PLANET_HEIGHT / 2), getPlanetBitmap (l),
-                       planetColor (l));
+            W_WriteScaleBitmap (dx - (BMP_PLANET_WIDTH / 2),
+                                dy - (BMP_PLANET_HEIGHT / 2),
+                                BMP_PLANET_WIDTH,
+                                BMP_PLANET_HEIGHT,
+                                BMP_CPLANET_WIDTH,
+			        BMP_CPLANET_HEIGHT,
+			        0,
+                                planetBitmapC (l),
+                                planetColor (l),
+                                w);
 #else
-        W_WriteBitmapDB (localSDB, dx - (BMP_PLANET_WIDTH / 2),
-                         dy - (BMP_PLANET_HEIGHT / 2), getPlanetBitmap (l),
-                         planetColor (l));
+            W_WriteScaleBitmapDB (localSDB, dx - (BMP_PLANET_WIDTH / 2),
+                                  dy - (BMP_PLANET_HEIGHT / 2),
+                                  BMP_PLANET_WIDTH,
+                                  BMP_PLANET_HEIGHT,
+                                  BMP_CPLANET_WIDTH,
+		    	          BMP_CPLANET_HEIGHT,
+			          0,
+                                  planetBitmapC (l),
+                                  planetColor (l),
+                                  w);
 #endif
-
+        }
+        else
+        {
+#ifndef DOUBLE_BUFFERING
+            W_WriteBitmap (dx - (BMP_PLANET_WIDTH / 2),
+                           dy - (BMP_PLANET_HEIGHT / 2), getPlanetBitmap (l),
+                           planetColor (l));
+#else
+            W_WriteBitmapDB (localSDB, dx - (BMP_PLANET_WIDTH / 2),
+                             dy - (BMP_PLANET_HEIGHT / 2), getPlanetBitmap (l),
+                             planetColor (l));
+#endif
+        }
         if (showIND && ((l->pl_info & me->p_team)
 #ifdef RECORDGAME
                         || playback
@@ -836,19 +864,25 @@
 #ifndef DOUBLE_BUFFERING
                 W_WriteScaleBitmap (dx - (j->p_ship.s_width / 2),
                                     dy - (j->p_ship.s_height / 2),
-                                    (float)(BMP_SHIP_WIDTH_HR/j->p_ship.s_width),
-                                    (float)(BMP_SHIP_HEIGHT_HR/j->p_ship.s_height),
+                                    j->p_ship.s_width,
+                                    j->p_ship.s_height,
+                                    BMP_SHIP_WIDTH_HR,
+                                    BMP_SHIP_HEIGHT_HR,
                                     j->p_dir,
                                     ship_bitsHR[j->p_ship.s_type],
-                                    playerColor (j));
+                                    playerColor (j),
+                                    w);
 #else
                 W_WriteScaleBitmapDB (localSDB, dx - (j->p_ship.s_width / 2),
                                       dy - (j->p_ship.s_height / 2),
-                                      (float)(BMP_SHIP_WIDTH_HR/j->p_ship.s_width),
-                                      (float)(BMP_SHIP_HEIGHT_HR/j->p_ship.s_height),
+                                      j->p_ship.s_width,
+                                      j->p_ship.s_height,
+                                      BMP_SHIP_WIDTH_HR,
+                                      BMP_SHIP_HEIGHT_HR,
                                       j->p_dir,
                                       ship_bitsHR[j->p_ship.s_type],
-                                      playerColor (j));
+                                      playerColor (j),
+                                      w);
 #endif
             }
 
@@ -1744,9 +1778,6 @@
                         case FED:
                             torpTeam = 1;
                             break;
-                        case IND:
-                            torpTeam = 2;
-                            break;
                         case KLI:
                             torpTeam = 3;
                             break;
@@ -1756,8 +1787,8 @@
                         case ROM:
                             torpTeam = 5;
                             break;
-                        default:
-                            torpTeam = 0;
+                        default: // IND
+                            torpTeam = 2;
                         }
                     }
 #ifndef DOUBLE_BUFFERING
@@ -1809,9 +1840,6 @@
                         case FED:
                             torpTeam = 1;
                             break;
-                        case IND:
-                            torpTeam = 2;
-                            break;
                         case KLI:
                             torpTeam = 3;
                             break;
@@ -1821,8 +1849,8 @@
                         case ROM:
                             torpTeam = 5;
                             break;
-                        default:
-                            torpTeam = 0;
+                        default: // IND
+                            torpTeam = 2;
                         }
                     }
                     
@@ -2036,9 +2064,6 @@
                     case FED:
                         ptorpTeam = 1;
                         break;
-                    case IND:
-                        ptorpTeam = 2;
-                        break;
                     case KLI:
                         ptorpTeam = 3;
                         break;
@@ -2048,8 +2073,8 @@
                     case ROM:
                         ptorpTeam = 5;
                         break;
-                    default:
-                        ptorpTeam = 0;
+                    default:  // IND
+                        ptorpTeam = 2;
                     }
                 }
 #ifndef DOUBLE_BUFFERING
@@ -2103,9 +2128,6 @@
                     case FED:
                         ptorpTeam = 1;
                         break;
-                    case IND:
-                        ptorpTeam = 2;
-                        break;
                     case KLI:
                         ptorpTeam = 3;
                         break;
@@ -2115,8 +2137,8 @@
                     case ROM:
                         ptorpTeam = 5;
                         break;
-                    default:
-                        ptorpTeam = 0;
+                    default: // IND
+                        ptorpTeam = 2;
                     }
                 }
                 if (pt->pt_owner != me->p_no && ((pt->pt_war & me->p_team) ||

Index: death.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/death.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- death.c	7 May 2006 16:59:27 -0000	1.5
+++ death.c	14 May 2006 02:14:54 -0000	1.6
@@ -37,11 +37,8 @@
 void
 death (void)
 {
-    W_Window oldw;
     W_Event event;
 
-    oldw = w;
-
 #ifdef AUTOKEY
     if (autoKey)
         autoKeyAllOff ();
@@ -53,7 +50,15 @@
     if (oldalert != PFGREEN)
     {
         if (extraAlertBorder)
-            W_ChangeBorder (oldw, gColor);
+        {
+#ifndef DOUBLE_BUFFERING
+            W_ChangeBorder (w, gColor);
+            W_ChangeBorder (mapw, gColor);
+#else
+            W_ChangeBorderDB (localSDB, gColor);
+            W_ChangeBorderDB (mapSDB, gColor);
+#endif
+        }
         W_ChangeBorder (baseWin, gColor);
         oldalert = PFGREEN;
     }
@@ -193,7 +198,6 @@
     W_WriteText (w, 50, 80, W_Cyan, deathmessage, strlen (deathmessage),
                  deathFont);
 
-    w = oldw;
 
     /* This is a good time to expire all the torps and phasors that
        we have missed the TFREE and PFREE packes for. */

Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- option.c	7 May 2006 16:59:27 -0000	1.13
+++ option.c	14 May 2006 02:14:54 -0000	1.14
@@ -144,12 +144,12 @@
 
 static char *plistmessagingmess[] = { "Disable player list messaging",
                                       "Enable player list messaging",
-									  ""
+                                      ""
 };
 
 static char *savebigmess[] = { "Save options without comments",
                                "Save options with comments",
-							   ""
+                               ""
 };
 
 static char *timermess[] = { "Timer shows nothing (off)",
@@ -160,12 +160,19 @@
                             ""
 };
 
-static char *planetbitmapmess[] = { "Show Bronco bitmaps on local",
-                                    "Show Moo bitmaps on local",
-                                    "Show Rabbitear bitmaps on local",
+static char *planetbitmapmess[] = { "Show Bronco bitmaps on local map",
+                                    "Show Moo bitmaps on local map",
+                                    "Show Rabbitear bitmaps on local map",
+                                    "Show New color bitmaps on local map",
                                     ""
 };
 
+static char *planetbitmapgalaxymess[] = { "Show Bronco bitmaps on galactic map",
+                                          "Show Moo bitmaps on galactic map",
+                                          "Show Rabbitear bitmaps on galactic map",
+                                          "Show New color bitmaps on galactic map",
+                                          ""
+};
 /* Only one of op_option, op_targetwin, and op_string should be defined. If
  * op_string is defined, op_size should be too and op_text is used without a
  * "Don't" prefix. if op_range is defined, there should be a %d in op_text
@@ -231,7 +238,9 @@
 
 struct int_range playerlistobserver_range = { 0, 4, 1 };
 
-struct int_range planetbitmaprange = { 0, 2, 1 };
+struct int_range planetbitmaprange = { 0, 3, 1 };
+
+struct int_range planetbitmapgalaxyrange = { 0, 3, 1 };
 
 int saveOpts = 1;    /* Temp flag to use for save options action */
 
@@ -268,6 +277,7 @@
     {0, "Planet Menu", &MenuPage, 0, 0, 0, NULL, &Menus_Range},
     {1, "Page %d (click to change)", &MenuPage, 0, 0, 0, NULL, &Menus_Range},
     {1, "", &planetBitmap, 0, 0, 0, planetbitmapmess, &planetbitmaprange},
+    {1, "", &planetBitmapGalaxy, 0, 0, 0, planetbitmapgalaxymess, &planetbitmapgalaxyrange},
     {1, "show planet names on local", &showPlanetNames, 0, 0, 0, NULL, NULL},
     {1, "show owner on galactic", &showPlanetOwner, 0, 0, 0, NULL, NULL},
     {1, "show IND planets", &showIND, 0, 0, 0, NULL, NULL},
@@ -698,45 +708,70 @@
         /* Let's see if this is our option changed */
         else if (op->op_option == &planetBitmap)
         {
-            char *Planlib;
-            char *MPlanlib;
-
-            for (i = 0; i < PLANET_VIEWS; i++)
-                free (bplanets[i]);
-            for (i = 0; i < MPLANET_VIEWS; i++)
-                free (bmplanets[i]);
-
-            switch (planetBitmap)
+            if (planetBitmap != 3) // Color planet bitmaps stay loaded at all times
             {
-            case 1:
-                Planlib = "bitmaps/planlibm/planM.bmp";
-                MPlanlib = "bitmaps/planlibm/mplanM.bmp";
-                break;
-            case 2:
-                Planlib = "bitmaps/planlibm/planR.bmp";
-                MPlanlib = "bitmaps/planlibm/mplanR.bmp";
-                break;
-            default:
-                Planlib = "bitmaps/planlibm/plan.bmp";
-                MPlanlib = "bitmaps/planlibm/mplan.bmp";
-                break;
+                char *Planlib;
+    
+                for (i = 0; i < PLANET_VIEWS; i++)
+                    free (bplanets[i]);
+
+                switch (planetBitmap)
+                {
+                case 1:
+                    Planlib = "bitmaps/planlibm/planM.bmp";
+                    break;
+                case 2:
+                    Planlib = "bitmaps/planlibm/planR.bmp";
+                    break;
+                default:
+                    Planlib = "bitmaps/planlibm/plan.bmp";
+                    break;
+                }
+                base_planets = W_StoreBitmap3 (Planlib, BMP_PLANET_WIDTH, BMP_PLANET_HEIGHT * 9,
+                                                BMP_PLANET000, w, LR_MONOCHROME);
+  
+                for (i = 0; i < PLANET_VIEWS; i++)
+                {
+                    bplanets[i] = W_PointBitmap2 (base_planets, 0, i, BMP_PLANET_WIDTH,
+                                                    BMP_PLANET_HEIGHT);
+                }
             }
-            base_planets = W_StoreBitmap3 (Planlib, BMP_PLANET_WIDTH, BMP_PLANET_HEIGHT * 9,
-                                            BMP_PLANET000, w, LR_MONOCHROME);
-            base_mplanets = W_StoreBitmap3 (MPlanlib, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT * 9,
-                                            BMP_MPLANET000, mapw, LR_MONOCHROME);
 
-            for (i = 0; i < PLANET_VIEWS; i++)
+            redrawall = 1;
+        }
+        else if (op->op_option == &planetBitmapGalaxy)
+        {
+            if (planetBitmapGalaxy != 3) // Color planet bitmaps stay loaded at all times
             {
-                bplanets[i] = W_PointBitmap2 (base_planets, 0, i, BMP_PLANET_WIDTH,
-                                                BMP_PLANET_HEIGHT);
-                bmplanets[i] = W_PointBitmap2 (base_mplanets, 0, i, BMP_MPLANET_WIDTH,
-                                                BMP_MPLANET_HEIGHT);
+                char *MPlanlib;
+    
+                for (i = 0; i < MPLANET_VIEWS; i++)
+                    free (bmplanets[i]);
+    
+                switch (planetBitmapGalaxy)
+                {
+                case 1:
+                    MPlanlib = "bitmaps/planlibm/mplanM.bmp";
+                    break;
+                case 2:
+                    MPlanlib = "bitmaps/planlibm/mplanR.bmp";
+                    break;
+                default:
+                    MPlanlib = "bitmaps/planlibm/mplan.bmp";
+                    break;
+                }
+                base_mplanets = W_StoreBitmap3 (MPlanlib, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT * 9,
+                                                BMP_MPLANET000, mapw, LR_MONOCHROME);
+    
+                for (i = 0; i < PLANET_VIEWS; i++)
+                {
+                    bmplanets[i] = W_PointBitmap2 (base_mplanets, 0, i, BMP_MPLANET_WIDTH,
+                                                    BMP_MPLANET_HEIGHT);
+                }
             }
 
             redrawall = 1;
         }
-
 #ifdef ROTATERACE
         else if (rotate != old_rotate)
         {

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- data.c	7 May 2006 16:59:27 -0000	1.17
+++ data.c	14 May 2006 02:14:54 -0000	1.18
@@ -57,8 +57,7 @@
                                  * system support */
 int niftyNewMessages = 1;
 unsigned int oldalert = 0;
-int remap[32] = { 0, 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
-                  5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+int remap[16] = { 0, 1, 2, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 };
 int messpend = 0;
 #ifdef XTRA_MESSAGE_UI
 int messageHUD = 0;             /* Show message being typed on the local display           */
@@ -102,6 +101,7 @@
 int msgBeep = 1;                /* ATM - msg beep */
 
 int planetBitmap = 0;
+int planetBitmapGalaxy = 0;
 
 int logging = 0;
 int continueTractor = 1;
@@ -203,8 +203,8 @@
 
 #ifdef SHORT_PACKETS
 int why_dead = 0;
-int tryShort = 1;               /* for .xtrekrc option */
-int tryShort1 = 1;
+int tryShort = 0;               /* for .xtrekrc option */
+int tryShort1 = 0;
 int recv_short = 0;
 int recv_mesg = 1;
 int recv_kmesg = 1;
@@ -306,6 +306,12 @@
     ori_bitmapsHR[NUM_TYPES], ind_bitmapsHR[NUM_TYPES];
 
 // Planets
+W_Icon planet_unknown;
+W_Icon planet_bitmaps[8];
+W_Icon planet_earth[NUMTEAMS], planet_klingus[NUMTEAMS], planet_orion[NUMTEAMS],
+    planet_romulus[NUMTEAMS], planet_agri1[NUMTEAMS], planet_agri2[NUMTEAMS],
+    planet_rock1[NUMTEAMS], planet_rock2[NUMTEAMS];
+    
 W_Icon base_planets;
 W_Icon base_mplanets;
 W_Icon bplanets[PLANET_VIEWS];

Index: defwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defwin.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- defwin.c	7 May 2006 16:59:27 -0000	1.4
+++ defwin.c	14 May 2006 02:14:54 -0000	1.5
@@ -18,6 +18,20 @@
  * the use of it.)
  * 
  * $Log$
+ * Revision 1.5  2006/05/14 02:14:54  modemhero
+ * New planet bitmaps!  Using Defcom's art.  Changeable via planets menu.
+ * New netrekrc option, "planetBitmapGalaxy: (0-3)", same options as planetBitmap, but now you have
+ * the choice to change map display planets too!  And have map and local planets use different
+ * bitmap sets
+ * Fixed bug where map window border wasn't being redrawn on death
+ * Shortpackets is now off by default.  In the current state of internet connectivity, most people
+ *  don't need the reduced packets, which don't send complete information and break certain features
+ *  such as which direction other players are moving, robot shields, observer geno messages,
+ *  shield/cloak status for warp 0 players, etc.
+ * Fix to problem with bottom and right borders in certain windows (like map) getting overwritten - thanks Stas!
+ * Client now recognizes planets that are flagged as "core", waiting on server patch to
+ * actually get this information and do something with it
+ *
  * Revision 1.4  2006/05/07 16:59:27  modemhero
  * Major features in this patch are:
  * Merge of Stas' latest source into client.
@@ -325,7 +339,7 @@
     ,
 #ifdef SHORT_PACKETS
     {
-        "tryShort", BOOL_DEF, "Try short packets at startup", &tryShort1,
+        "tryShort", BOOL_DEF, "Use short packets for communications", &tryShort1,
         {
             {0, NULL, ""},
             {0, NULL, NULL}
@@ -334,7 +348,7 @@
     ,
 #endif
     {
-        "tryUdp", BOOL_DEF, "Try UDP automatically", &tryUdp1,
+        "tryUdp", BOOL_DEF, "Use UDP for communications", &tryUdp1,
         {
             {0, NULL, ""},
             {0, NULL, NULL}

Index: map.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- map.c	12 May 2006 01:58:37 -0000	1.7
+++ map.c	14 May 2006 02:14:54 -0000	1.8
@@ -253,6 +253,83 @@
 }
 
 /******************************************************************************/
+/***  planetmBitmapC()
+/******************************************************************************/
+extern inline W_Icon
+planetBitmapC (register struct planet *p)
+/*
+ *  Choose the color bitmap for a planet.
+ */
+{
+    int i;
+    W_Icon (*planet_bits);
+    
+    if ((p->pl_info & me->p_team)
+#ifdef RECORDGAME
+        || playback
+#endif
+        )
+    {
+    	/* Logic for planet assignment:
+    	   1) Check if it's a homeworld.  If so, find which homeworld it is
+    	   2) Check if it's a core planet
+    	   2a) Check if it's agri
+    	   3) Check if it's agri
+    	   4) Default planet bitmap
+    	   5) Switch statement by owner to determine color
+        */
+    	if (p->pl_flags & PLHOME)
+    	{
+    	    if (!strcmp(p->pl_name, "Earth"))
+    	        planet_bits = planet_earth;
+    	    else if (!strcmp(p->pl_name, "Klingus"))
+    	        planet_bits = planet_klingus;
+    	    else if (!strcmp(p->pl_name, "Romulus"))
+    	        planet_bits = planet_romulus;
+    	    else if (!strcmp(p->pl_name, "Orion"))
+    	        planet_bits = planet_orion;
+    	    else // This should never be called
+    	        planet_bits = planet_rock1;
+    	}
+    	else if (p->pl_flags & PLCORE) // Not functional yet due to server
+    	{
+    	    if (p->pl_flags & PLAGRI)
+    	        planet_bits = planet_agri1;
+    	    else
+    	        planet_bits = planet_rock1;
+    	}
+    	else if (p->pl_flags & PLAGRI)
+            planet_bits = planet_agri2;
+        else
+            planet_bits = planet_rock2;
+
+        switch (p->pl_owner)
+        {
+        case FED:
+            i = 0;
+            break;
+        case KLI:
+            i = 2;
+            break;
+        case ORI:
+            i = 3;
+            break;
+        case ROM:
+            i = 4;
+            break;
+        default: // IND
+            i = 1;
+            break;
+        }
+        return planet_bits[i];
+    }
+    else
+    {
+        return planet_unknown;
+    }
+}
+
+/******************************************************************************/
 /***  agriColor()
 /******************************************************************************/
 W_Color getAgriColor (struct planet *l)
@@ -342,24 +419,61 @@
         if (useLite && emph_planet_seq_n[l->pl_no] > 0)
 	{
 	    int     seq_n = emph_planet_seq_n[l->pl_no] % emph_planet_seq_frames;
+            
+            if (planetBitmapGalaxy == 3)
+            {
+#ifndef DOUBLE_BUFFERING
+	        W_OverlayBitmap(dx - (emph_planet_seq_width / 2 + 1),
+			        dy - (emph_planet_seq_height / 2),
+			        emph_planet_seq[seq_n],
+			        W_White);
 
+	        W_WriteScaleBitmap(dx - (BMP_MPLANET_WIDTH / 2),
+	                           dy - (BMP_MPLANET_HEIGHT / 2),
+	                           BMP_MPLANET_WIDTH,
+                                   BMP_MPLANET_HEIGHT,
+                                   BMP_CPLANET_WIDTH,
+			           BMP_CPLANET_HEIGHT,
+			           0,
+			           planetBitmapC(l), planetColor(l),
+			           mapw);
+#else
+	        W_OverlayBitmapDB(mapSDB, dx - (emph_planet_seq_width / 2 + 1),
+			          dy - (emph_planet_seq_height / 2),
+			          emph_planet_seq[seq_n],
+			          W_White);
+
+	        W_WriteScaleBitmapDB(mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
+	                             dy - (BMP_MPLANET_HEIGHT / 2),
+	                             BMP_MPLANET_WIDTH,
+                                     BMP_MPLANET_HEIGHT,
+                                     BMP_CPLANET_WIDTH,
+			             BMP_CPLANET_HEIGHT,
+			             0,
+			             planetBitmapC(l), planetColor(l),
+			             mapw);
+#endif
+            }
+            else
+            {
 #ifndef DOUBLE_BUFFERING
-	    W_OverlayBitmap(dx - (emph_planet_seq_width / 2 + 1),
-			    dy - (emph_planet_seq_height / 2),
-			    emph_planet_seq[seq_n],
-			    W_White);
+	        W_OverlayBitmap(dx - (emph_planet_seq_width / 2 + 1),
+			        dy - (emph_planet_seq_height / 2),
+			        emph_planet_seq[seq_n],
+			        W_White);
 
-	    W_WriteBitmap(dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2),
-			  planetmBitmap(l), planetColor(l));
+	        W_WriteBitmap(dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2),
+			      planetmBitmap(l), planetColor(l));
 #else
-	    W_OverlayBitmapDB(mapSDB, dx - (emph_planet_seq_width / 2 + 1),
-			      dy - (emph_planet_seq_height / 2),
-			      emph_planet_seq[seq_n],
-			      W_White);
+	        W_OverlayBitmapDB(mapSDB, dx - (emph_planet_seq_width / 2 + 1),
+			          dy - (emph_planet_seq_height / 2),
+			          emph_planet_seq[seq_n],
+	    		          W_White);
 
-	    W_WriteBitmapDB(mapSDB, dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2),
-			    planetmBitmap(l), planetColor(l));
+	        W_WriteBitmapDB(mapSDB, dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2),
+			        planetmBitmap(l), planetColor(l));
 #endif
+            }
 	    emph_planet_seq_n[l->pl_no] -= 1;
 	    l->pl_flags |= PLREDRAW;		 /* Leave redraw on until * * 
 						  * done highlighting */
@@ -368,16 +482,43 @@
 	}
         else
 	{
+#endif            
+        if (planetBitmapGalaxy == 3)
+        {
+#ifndef DOUBLE_BUFFERING
+            W_OverlayScaleBitmap (dx - (BMP_MPLANET_WIDTH / 2),
+                                  dy - (BMP_MPLANET_HEIGHT / 2),
+                                  BMP_MPLANET_WIDTH,
+                                  BMP_MPLANET_HEIGHT,
+                                  BMP_CPLANET_WIDTH,
+			          BMP_CPLANET_HEIGHT,
+                                  planetBitmapC (l),
+                                  planetColor (l),
+                                  mapw);
+#else
+            W_OverlayScaleBitmapDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
+                                    dy - (BMP_MPLANET_HEIGHT / 2),
+                                    BMP_MPLANET_WIDTH,
+                                    BMP_MPLANET_HEIGHT,
+                                    BMP_CPLANET_WIDTH,
+			            BMP_CPLANET_HEIGHT,
+                                    planetBitmapC (l),
+                                    planetColor (l),
+                                    mapw);
 #endif
+        }
+        else
+        {
 #ifndef DOUBLE_BUFFERING
-        W_OverlayBitmap (dx - (BMP_MPLANET_WIDTH / 2),
-                         dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
-                         planetColor (l));
+            W_OverlayBitmap (dx - (BMP_MPLANET_WIDTH / 2),
+                             dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
+                             planetColor (l));
 #else
-        W_OverlayBitmapDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
-                           dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
-                           planetColor (l));
+            W_OverlayBitmapDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
+                               dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
+                               planetColor (l));
 #endif
+        }
 #ifdef BEEPLITE
 	}
 #endif

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- defaults.c	7 May 2006 16:59:27 -0000	1.15
+++ defaults.c	14 May 2006 02:14:54 -0000	1.16
@@ -344,10 +344,21 @@
     },
     {"planetBitmap", &planetBitmap, RC_INT,
         {
-            "Type of planet bitmaps",
+            "Type of planet bitmaps on local map",
             "0 - Bronco (default)",
             "1 - Moo",
             "2 - Rabbitear",
+            "3 - New color",
+            NULL
+        }
+    },
+    {"planetBitmapGalaxy", &planetBitmapGalaxy, RC_INT,
+        {
+            "Type of planet bitmaps on galactic map",
+            "0 - Bronco (default)",
+            "1 - Moo",
+            "2 - Rabbitear",
+            "3 - New color",
             NULL
         }
     },