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

Modified Files:
	local.c mswindow.c 
Log Message:
Double buffering.
Fix to background stars and short packets.
New IND bitmaps
Addition of some new color planets to plant library,

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mswindow.c	12 May 2006 01:58:38 -0000	1.17
+++ mswindow.c	12 May 2006 20:51:31 -0000	1.18
@@ -1436,7 +1436,7 @@
     r.left = max (x, border);
     r.right = min (x + width, win->ClipRect.right);
     if (r.right < r.left)
-        return;                 //Horizantal extents do not overlap
+        return;                 //Horizontal extents do not overlap
     r.top = max (y, border);
     r.bottom = min (y + height, win->ClipRect.bottom);
     if (r.bottom < r.top)
@@ -1479,7 +1479,7 @@
     r.left = max (x, border);
     r.right = min (x + width, win->ClipRect.right);
     if (r.right < r.left)
-        return;                 //Horizantal extents do not overlap
+        return;                 //Horizontal extents do not overlap
     r.top = max (y, border);
     r.bottom = min (y + height, win->ClipRect.bottom);
     if (r.bottom < r.top)
@@ -1554,7 +1554,7 @@
         r.left = max (x, border);
         r.right = min (x + width, win->ClipRect.right);
         if (r.right < r.left)
-            continue;           //Horizantal extents do not overlap
+            continue;           //Horizontal extents do not overlap
         r.top = max (y, border);
         r.bottom = min (y + height, win->ClipRect.bottom);
         if (r.bottom < r.top)
@@ -3303,7 +3303,7 @@
         r.left = max (x, border);
         r.right = min (x + ext.cx, win->ClipRect.right);
         if (r.right < r.left)
-            return;             //Horizantal extents do not overlap
+            return;             //Horizontal extents do not overlap
         r.top = max (y, border);
         r.bottom = min (y + ext.cy, win->ClipRect.bottom);
         if (r.bottom < r.top)
@@ -5318,7 +5318,7 @@
     r.left = max (x, border);
     r.right = min (x + width, win->ClipRect.right);
     if (r.right < r.left)
-        return;                 //Horizantal extents do not overlap
+        return;                 //Horizontal extents do not overlap
     r.top = max (y, border);
     r.bottom = min (y + height, win->ClipRect.bottom);
     if (r.bottom < r.top)
@@ -5355,7 +5355,7 @@
     r.left = max (x, border);
     r.right = min (x + width, win->ClipRect.right);
     if (r.right < r.left)
-        return;                 //Horizantal extents do not overlap
+        return;                 //Horizontal extents do not overlap
     r.top = max (y, border);
     r.bottom = min (y + height, win->ClipRect.bottom);
     if (r.bottom < r.top)
@@ -5418,7 +5418,7 @@
         r.left = max (x, border);
         r.right = min (x + width, win->ClipRect.right);
         if (r.right < r.left)
-            continue;           //Horizantal extents do not overlap
+            continue;           //Horizontal extents do not overlap
         r.top = max (y, border);
         r.bottom = min (y + height, win->ClipRect.bottom);
         if (r.bottom < r.top)
@@ -5750,7 +5750,7 @@
         r.left = max (x, border);
         r.right = min (x + ext.cx, win->ClipRect.right);
         if (r.right < r.left)
-            return;             //Horizantal extents do not overlap
+            return;             //Horizontal extents do not overlap
         r.top = max (y, border);
         r.bottom = min (y + ext.cy, win->ClipRect.bottom);
         if (r.bottom < r.top)
@@ -5850,14 +5850,13 @@
     register struct Icon *bitmap = (struct Icon *) icon;
     register int borderx, bordery, width, height;
     register int srcx, srcy;
-    HDC hdc;
     HBITMAP newbmp;
     XFORM xForm;
     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
     srcx = bitmap->x;
     srcy = bitmap->y;
@@ -5868,15 +5867,12 @@
 
     width = bitmap->width;
     height = bitmap->height;
-    
-//    hdc = GetDC (bitmap->hwnd);
-//    newbmp = CreateCompatibleBitmap ( hdc, width, height );
+
     newbmp = CreateCompatibleBitmap ( sdb->mem_dc, width, height );
 
     if (NetrekPalette)
     {
-   // 	SelectPalette (hdc, NetrekPalette, FALSE);
-     //   RealizePalette (hdc);
+
         SelectPalette (sdb->mem_dc, NetrekPalette, FALSE);
         RealizePalette (sdb->mem_dc);
     }
@@ -5888,8 +5884,6 @@
     
     //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);
     SetBkColor (sdb->mem_dc, colortable[color].rgb);
     SetTextColor (sdb->mem_dc, colortable[BLACK].rgb);
     
@@ -5916,9 +5910,9 @@
 
     eDx = x + xscale - cosine*(xscale) + sine*(yscale);
     eDy = y + yscale - cosine*(yscale) - sine*(xscale);
-  //  SetGraphicsMode(hdc,GM_ADVANCED);
-  //  SetGraphicsMode(sdb->mem_dc,GM_ADVANCED);
 
+  //  SetGraphicsMode(sdb->mem_dc,GM_ADVANCED);
+    
     xForm.eM11=cosine/SCALEX;
     xForm.eM12=sine/SCALEX;
     xForm.eM21=-sine/SCALEY;
@@ -5926,13 +5920,11 @@
     xForm.eDx = eDx;
     xForm.eDy = eDy;
     
-   // SetWorldTransform(hdc,&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);
-   BitBlt (sdb->mem_dc, x, y, width, height, GlobalMemDC2, 0, 0, SRCPAINT);
- //   StretchBlt(sdb->mem_dc, x, y, (int)(width/SCALEX), (int)(height/SCALEY), GlobalMemDC2, 0, 0, width, height, SRCCOPY);
-//    ReleaseDC (bitmap->hwnd, hdc);
+   // 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);
 }
 

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- local.c	12 May 2006 01:58:37 -0000	1.20
+++ local.c	12 May 2006 20:51:31 -0000	1.21
@@ -65,7 +65,7 @@
 
 static void redrawStarSector(int sectorx, int sectory);
 
-#define scaleLocal(pt)           ((pt) + (WINSIDE/2))
+#define scaleLocal(pt)           ((pt)/SCALE + (WINSIDE/2))
 
 int fullview = WINSIDE * SCALE;
 int view = WINSIDE * SCALE / 2;
@@ -259,8 +259,8 @@
             dyy = (int) (Sin[mydir] * streaklength);
             for (i = 0, s = star_sector; i < 16; i++, s++)
             {
-                dx = (s->s_x + xbase)/SCALE - me->p_x/SCALE;
-                dy = (s->s_y + ybase)/SCALE - me->p_y/SCALE;
+                dx = (s->s_x + xbase) - (me->p_x - (me->p_x % 40));
+                dy = (s->s_y + ybase) - (me->p_y - (me->p_y % 40));
                 if (ABS(dx) > (view) || ABS(dy) > (view))
                     continue;
 
@@ -283,11 +283,8 @@
     }
     for (i = 0, s = star_sector; i < 16; i++, s++)
     {
-    	int px, py;
-    	px = me->p_x % 40;
-    	py = me->p_y % 40;
-        dx = (s->s_x + xbase)/SCALE - me->p_x/SCALE;
-        dy = (s->s_y + ybase)/SCALE - me->p_y/SCALE;
+        dx = (s->s_x + xbase) - (me->p_x - (me->p_x % 40));
+        dy = (s->s_y + ybase) - (me->p_y - (me->p_y % 40));
         if (ABS(dx) > (view) || ABS(dy) > (view))
             continue;