Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv29983/src Modified Files: dashboard.c data.c local.c map.c mswindow.c newwin.c Log Message: First attempt at some resource display for new planets. Gonna have to rewrite doublebuffering code to make it an rc option, all these duplicate function calls is getting crazy (or quadruple function calls when beeplite and doublebuffering come into play at once). Index: mswindow.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- mswindow.c 19 May 2006 18:08:07 -0000 1.22 +++ mswindow.c 20 May 2006 17:09:39 -0000 1.23 @@ -507,7 +507,11 @@ free (planet_bitmaps[6]); free (planet_bitmaps[7]); free (planet_unknown); - + + free (army_bitmap); + free (wrench_bitmap); + free (fuel_bitmap); + for (i = 0; i < PLANET_VIEWS; i++) free (bplanets[i]); for (i = 0; i < MPLANET_VIEWS; i++) @@ -6263,11 +6267,6 @@ 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); @@ -6333,7 +6332,7 @@ xForm.eDy = eDy; SetWorldTransform(sdb->mem_dc,&xForm); - BitBlt(sdb->mem_dc, 0, 0, newwidth, newheight, GlobalMemDC2, srcx, srcy, SRCPAINT); + BitBlt(sdb->mem_dc, 0, 0, newwidth, newheight, GlobalMemDC2, srcx, srcy, SRCCOPY); // Reset xForm xForm.eM11 = (FLOAT) 1.0; Index: dashboard.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- dashboard.c 20 May 2006 03:55:23 -0000 1.6 +++ dashboard.c 20 May 2006 17:09:39 -0000 1.7 @@ -370,7 +370,7 @@ left = 0; right = -1; pos = 0; - strcpy (tmp, buf); + strncpy (tmp, buf, 7); while (pos < 7) { if (tmp[pos] == oldmsg[pos]) Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- newwin.c 19 May 2006 18:08:07 -0000 1.23 +++ newwin.c 20 May 2006 17:09:39 -0000 1.24 @@ -642,6 +642,20 @@ W_StoreBitmap3 ("bitmaps/planlibm/color/unknown.bmp", BMP_CPLANET_WIDTH, BMP_CPLANET_HEIGHT, BMP_PLANET_UNKNOWN, w, LR_DEFAULTCOLOR); + + /* Load the resource bitmaps */ + army_bitmap = + W_StoreBitmap3 ("bitmaps/planlibm/color/army.bmp", + BMP_ARMY_WIDTH, BMP_ARMY_HEIGHT, BMP_ARMYBMP, w, + LR_DEFAULTCOLOR); + wrench_bitmap = + W_StoreBitmap3 ("bitmaps/planlibm/color/wrench.bmp", + BMP_WRENCH_WIDTH, BMP_WRENCH_HEIGHT, BMP_WRENCHBMP, w, + LR_DEFAULTCOLOR); + fuel_bitmap = + W_StoreBitmap3 ("bitmaps/planlibm/color/fuel.bmp", + BMP_FUEL_WIDTH, BMP_FUEL_HEIGHT, BMP_FUELBMP, w, + LR_DEFAULTCOLOR); } /******************************************************************************/ Index: local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- local.c 14 May 2006 02:14:54 -0000 1.22 +++ local.c 20 May 2006 17:09:39 -0000 1.23 @@ -379,6 +379,8 @@ planetBitmapC (l), planetColor (l), w); + /* Draw planet resources */ + planetResourcesC(localSDB, l, BMP_PLANET_WIDTH, BMP_PLANET_HEIGHT, dx, dy, w); #endif } else @@ -438,10 +440,10 @@ clearcount++; } - clearzone[0][clearcount] = dx - (BMP_PLANET_WIDTH / 2); - clearzone[1][clearcount] = dy - (BMP_PLANET_HEIGHT / 2); - clearzone[2][clearcount] = BMP_PLANET_WIDTH; - clearzone[3][clearcount] = BMP_PLANET_HEIGHT; + clearzone[0][clearcount] = dx - (7 * BMP_PLANET_WIDTH / 8); + clearzone[1][clearcount] = dy - (5 * BMP_PLANET_HEIGHT / 6); + clearzone[2][clearcount] = 7 * BMP_PLANET_WIDTH / 4 + 1; + clearzone[3][clearcount] = 4 * BMP_PLANET_HEIGHT / 3 + 1; clearcount++; } } Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- data.c 19 May 2006 18:08:07 -0000 1.21 +++ data.c 20 May 2006 17:09:39 -0000 1.22 @@ -312,7 +312,9 @@ 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 army_bitmap; +W_Icon wrench_bitmap; +W_Icon fuel_bitmap; W_Icon base_planets; W_Icon base_mplanets; W_Icon bplanets[PLANET_VIEWS]; Index: map.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- map.c 16 May 2006 05:10:13 -0000 1.9 +++ map.c 20 May 2006 17:09:39 -0000 1.10 @@ -253,7 +253,7 @@ } /******************************************************************************/ -/*** planetmBitmapC() +/*** planetBitmapC() /******************************************************************************/ extern inline W_Icon planetBitmapC (register struct planet *p) @@ -330,6 +330,57 @@ } /******************************************************************************/ +/*** planetResourcesC() +/******************************************************************************/ +extern inline void +planetResourcesC (SDBUFFER * sdb, register struct planet *p, int destwidth, int destheight, + int dx, int dy, W_Window window) +/* + * Draw the resources for a colorized planet. + */ +{ + if ((p->pl_info & me->p_team) +#ifdef RECORDGAME + || playback +#endif + ) + { + /* Select resources */ + if (p->pl_armies > 4) + W_OverlayScaleBitmapDB(sdb, dx - 7 * destwidth / 8, + dy - (destheight / 2), + destwidth/3, + destheight, + BMP_ARMY_WIDTH, + BMP_ARMY_HEIGHT, + 0, + army_bitmap, planetColor(p), + window); + if (p->pl_flags & PLREPAIR) + W_OverlayScaleBitmapDB(sdb, dx - (destwidth / 2), + dy - (5 * destheight / 6), + destwidth, + destheight/3, + BMP_WRENCH_WIDTH, + BMP_WRENCH_HEIGHT, + 0, + wrench_bitmap, planetColor(p), + window); + if (p->pl_flags & PLFUEL) + W_OverlayScaleBitmapDB(sdb, dx + 3 * destwidth / 5, + dy - (destheight / 2), + destwidth/3, + destheight, + BMP_FUEL_WIDTH, + BMP_FUEL_HEIGHT, + 0, + fuel_bitmap, planetColor(p), + window); + } + return; +} + +/******************************************************************************/ /*** agriColor() /******************************************************************************/ W_Color getAgriColor (struct planet *l) @@ -401,13 +452,13 @@ /* XFIX */ #ifndef DOUBLE_BUFFERING - W_ClearArea (mapw, dx - (BMP_MPLANET_WIDTH / 2 + 4), + W_ClearArea (mapw, dx - (BMP_MPLANET_WIDTH / 2 + 8), dy - (BMP_MPLANET_HEIGHT / 2 + 4), BMP_MPLANET_WIDTH + 8, BMP_MPLANET_HEIGHT + 8); #else - W_ClearAreaDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2 + 4), - dy - (BMP_MPLANET_HEIGHT / 2 + 4), - BMP_MPLANET_WIDTH + 8, BMP_MPLANET_HEIGHT + 8); + W_ClearAreaDB (mapSDB, dx - 7 * BMP_MPLANET_WIDTH / 8, + dy - (5 * BMP_MPLANET_HEIGHT / 6), + 7 * BMP_MPLANET_WIDTH / 4, 4 * BMP_MPLANET_HEIGHT / 3); #endif l->pl_flags &= ~PLCLEAR; } @@ -437,6 +488,9 @@ 0, planetBitmapC(l), planetColor(l), mapw); + + /* Draw planet resources */ + planetResourcesC(mapSDB, l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw); #else W_OverlayBitmapDB(mapSDB, dx - (emph_planet_seq_width / 2 + 1), dy - (emph_planet_seq_height / 2), @@ -451,7 +505,9 @@ BMP_CPLANET_HEIGHT, 0, planetBitmapC(l), planetColor(l), - mapw); + mapw); + /* Draw planet resources */ + planetResourcesC(mapSDB, l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw); #endif } else @@ -486,7 +542,20 @@ if (planetBitmapGalaxy == 3) { #ifndef DOUBLE_BUFFERING - W_OverlayScaleBitmap (dx - (BMP_MPLANET_WIDTH / 2), + 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); + /* Draw planet resources */ + planetResourcesC(mapSDB, l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw); +#else + W_WriteScaleBitmapDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2), BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, @@ -496,17 +565,8 @@ 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, - 0, - planetBitmapC (l), - planetColor (l), - mapw); + /* Draw planet resources */ + planetResourcesC(mapSDB, l, BMP_MPLANET_WIDTH, BMP_MPLANET_HEIGHT, dx, dy, mapw); #endif } else