Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18138/src
Modified Files:
data.c defaults.c inform.c map.c mswindow.c newwin.c
planetlist.c
Log Message:
Addition of core flag to planet info and planet menu.
New quit window stuff.
More work on planet bitmaps and draw functions.
Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mswindow.c 14 May 2006 02:14:54 -0000 1.20
+++ mswindow.c 16 May 2006 05:10:13 -0000 1.21
@@ -451,7 +451,8 @@
// Free other bitmaps
free (clockpic);
-
+ free (clockhandpic);
+
for (j = 0; j < NUM_CTORP_TYPES; j++)
{
for (i = 0; i < BMP_TORPDET_FRAMES; i++)
@@ -4967,6 +4968,7 @@
int destheight,
int srcwidth,
int srcheight,
+ int angle,
W_Icon icon,
W_Color color,
W_Window window)
@@ -4978,6 +4980,8 @@
HBITMAP newbmp;
XFORM xForm;
int newwidth, newheight;
+ double radians;
+ float cosine, sine, xscale, yscale, eDx, eDy;
FNHEADER_VOID;
// First copy bitmap into new bitmap, and scale it. This makes life
@@ -5038,17 +5042,40 @@
SetBkColor (hdc, colortable[color].rgb);
SetTextColor (hdc, colortable[BLACK].rgb);
+ //Convert angle to radians
+ radians=(2*3.14159*angle/360);
+
+ cosine=(float)cos(radians);
+ sine=(float)sin(radians);
+
+ // Scale used to 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(hdc,GM_ADVANCED);
+ 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, 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)x;
- xForm.eDy = (float)y;
+ xForm.eDx = (FLOAT) 0.0;
+ xForm.eDy = (FLOAT) 0.0;
- SetWorldTransform(hdc,&xForm);
- BitBlt(hdc, 0, 0, newwidth, newheight, GlobalMemDC2, 0, 0, SRCPAINT);
+ SetWorldTransform(hdc,&xForm);
ReleaseDC (win->hwnd, hdc);
DeleteObject (newbmp);
@@ -6213,7 +6240,8 @@
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)
+ int srcwidth, int srcheight, int angle,
+ W_Icon icon, W_Color color, W_Window window)
{
register struct Icon *bitmap = (struct Icon *) icon;
register int border;
@@ -6221,6 +6249,8 @@
HBITMAP newbmp;
XFORM xForm;
int newwidth, newheight;
+ double radians;
+ float cosine, sine, xscale, yscale, eDx, eDy;
FNHEADER_VOID;
// First copy bitmap into new bitmap, and scale it. This makes life
@@ -6280,17 +6310,29 @@
SetBkColor (sdb->mem_dc, colortable[color].rgb);
SetTextColor (sdb->mem_dc, colortable[BLACK].rgb);
+ //Convert angle to radians
+ radians=(2*3.14159*angle/360);
+
+ cosine=(float)cos(radians);
+ sine=(float)sin(radians);
+
+ // Scale used to 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);
- 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;
+ 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, 0, 0, SRCPAINT);
+ BitBlt(sdb->mem_dc, 0, 0, newwidth, newheight, GlobalMemDC2, srcx, srcy, SRCPAINT);
// Reset xForm
xForm.eM11 = (FLOAT) 1.0;
@@ -6301,7 +6343,7 @@
xForm.eDy = (FLOAT) 0.0;
SetWorldTransform(sdb->mem_dc,&xForm);
-
+
DeleteObject (newbmp);
}
#endif /* DOUBLE_BUFFERING */
Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- newwin.c 14 May 2006 02:14:54 -0000 1.21
+++ newwin.c 16 May 2006 05:10:13 -0000 1.22
@@ -704,7 +704,7 @@
W_SetWindowButtonHandler (messagew, handleMessageWindowButton);
W_SetWindowExposeHandler (messagew, DisplayMessage);
- planetw = W_MakeTextWindow ("planet", 10, 10, 53, MAXPLANETS + 3, w, 2);
+ planetw = W_MakeTextWindow ("planet", 10, 10, 57, MAXPLANETS + 3, w, 2);
W_SetWindowExposeHandler (planetw, planetlist);
rankw = W_MakeTextWindow ("rank", 50, 300, 65, NUMRANKS + 9, w, 2);
@@ -1196,11 +1196,23 @@
stipple =
W_StoreBitmap3 ("bitmaps/misclib/stipple.bmp", BMP_STIPPLE_WIDTH,
BMP_STIPPLE_HEIGHT, BMP_STIPPLE, w, LR_MONOCHROME);
- clockpic =
- W_StoreBitmap3 ("bitmaps/misclib/clock.bmp", BMP_CLOCK_WIDTH,
- BMP_CLOCK_HEIGHT, BMP_CLOCK, qwin, LR_MONOCHROME);
+ if (newQuit)
+ {
+ clockpic =
+ W_StoreBitmap3 ("bitmaps/misclib/color/clock.bmp", BMP_CCLOCK_WIDTH,
+ BMP_CCLOCK_HEIGHT, BMP_CLOCK, qwin, LR_DEFAULTCOLOR);
+ clockhandpic =
+ W_StoreBitmap3 ("bitmaps/misclib/color/clockhand.bmp", BMP_CHAND_WIDTH,
+ BMP_CHAND_HEIGHT, BMP_CLOCKHAND, qwin, LR_DEFAULTCOLOR);
+ }
+ else
+ {
+ clockpic =
+ W_StoreBitmap3 ("bitmaps/misclib/clock.bmp", BMP_CLOCK_WIDTH,
+ BMP_CLOCK_HEIGHT, BMP_CLOCK, qwin, LR_MONOCHROME);
+ }
genopic =
- W_StoreBitmap3 ("bitmaps/misclib/genocide.bmp", WINSIDE,
+ W_StoreBitmap3 ("bitmaps/misclib/color/genocide.bmp", WINSIDE,
WINSIDE, BMP_GENO, w, LR_DEFAULTCOLOR);
}
@@ -1503,7 +1515,7 @@
redrawTeam (teamWin[i], i, &lastplayercount[i]);
break;
}
- if (event.Window == qwin)
+ if (event.Window == qwin && !newQuit)
{
redrawQuit ();
}
@@ -1924,9 +1936,6 @@
W_WriteText (qwin, 5, 5, textColor, "Quit NetrekXP", 13, W_RegularFont);
}
-
-#define CLOCK_WID (BOXSIDE * 9 / 10)
-#define CLOCK_HEI (BOXSIDE * 2 / 3)
#define CLOCK_BDR 0
#define CLOCK_X (BOXSIDE / 2 - CLOCK_WID / 2)
#define CLOCK_Y (BOXSIDE / 2 - CLOCK_HEI / 2)
@@ -1939,9 +1948,23 @@
void
showTimeLeft (time_t time, time_t max)
{
+ register struct player *j = me;
char buf[BUFSIZ], *cp;
- int cx, cy, ex, ey, tx, ty;
+ int cx, cy, tx, ty;
+ int ex = 0, ey = 0;
+ int CLOCK_WID, CLOCK_HEI;
+ int angle;
+ if (newQuit)
+ {
+ CLOCK_WID = BOXSIDE;
+ CLOCK_HEI = BOXSIDE;
+ }
+ else
+ {
+ CLOCK_WID = (BOXSIDE * 9 / 10);
+ CLOCK_HEI = (BOXSIDE * 2 / 3);
+ }
if ((max - time) < 10 && time & 1)
{
W_Beep ();
@@ -1950,21 +1973,40 @@
W_ClearArea (qwin, CLOCK_X, CLOCK_Y, CLOCK_WID, CLOCK_HEI);
cx = CLOCK_X + CLOCK_WID / 2;
- cy = CLOCK_Y + (CLOCK_HEI - W_Textheight) / 2;
- ex = cx - BMP_CLOCK_WIDTH / 2;
- ey = cy - BMP_CLOCK_HEIGHT / 2;
- W_WriteBitmap (ex, ey, clockpic, foreColor);
+ if (newQuit)
+ {
+ cy = CLOCK_Y + CLOCK_HEI / 2;
+
+ angle = (int)(-360 * time / max);
+ W_WriteBitmap ( CLOCK_BDR, CLOCK_BDR, clockpic, foreColor);
+ W_OverlayScaleBitmap (CLOCK_BDR, CLOCK_BDR, BMP_CHAND_WIDTH, BMP_CHAND_HEIGHT,
+ BMP_CHAND_WIDTH, BMP_CHAND_HEIGHT,
+ angle, clockhandpic, foreColor, qwin);
+ sprintf (buf, "%d", max - time);
+ tx = cx - W_Textwidth * strlen (buf) / 2;
+ ty = 2*(cy - W_Textheight / 2)/3;
+ W_WriteText (qwin, tx, ty, textColor, buf, strlen (buf), W_RegularFont);
- ex = (int) (cx - BMP_CLOCK_WIDTH * sin (2 * XPI * time / max) / 2);
- ey = (int) (cy - BMP_CLOCK_HEIGHT * cos (2 * XPI * time / max) / 2);
- W_MakeLine (qwin, cx, cy, ex, ey, foreColor);
+ cp = "Quit NetrekXP";
+ }
+ else
+ {
+ cy = CLOCK_Y + (CLOCK_HEI - W_Textheight) / 2;
+ ex = cx - BMP_CLOCK_WIDTH / 2;
+ ey = cy - BMP_CLOCK_HEIGHT / 2;
+ W_WriteBitmap (ex, ey, clockpic, foreColor);
+
+ ex = (int) (cx - BMP_CLOCK_WIDTH * sin (2 * XPI * time / max) / 2);
+ ey = (int) (cy - BMP_CLOCK_HEIGHT * cos (2 * XPI * time / max) / 2);
+ W_MakeLine (qwin, cx, cy, ex, ey, foreColor);
- sprintf (buf, "%d", max - time);
- tx = cx - W_Textwidth * strlen (buf) / 2;
- ty = cy - W_Textheight / 2;
- W_WriteText (qwin, tx, ty, textColor, buf, strlen (buf), W_RegularFont);
+ sprintf (buf, "%d", max - time);
+ tx = cx - W_Textwidth * strlen (buf) / 2;
+ ty = cy - W_Textheight / 2;
+ W_WriteText (qwin, tx, ty, textColor, buf, strlen (buf), W_RegularFont);
- cp = "Auto Quit";
+ cp = "Auto Quit";
+ }
tx = CLOCK_X + cx - W_Textwidth * strlen (cp) / 2;
ty = CLOCK_Y + CLOCK_HEI - W_Textheight;
W_WriteText (qwin, tx, ty, textColor, cp, strlen (cp), W_RegularFont);
Index: inform.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/inform.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- inform.c 12 Apr 2006 04:20:03 -0000 1.2
+++ inform.c 16 May 2006 05:10:13 -0000 1.3
@@ -225,13 +225,13 @@
else
{ /* Planet */
/* Too close to the edge? */
- if (mx + 20 * W_Textwidth + 2 > windowWidth)
- mx = windowWidth - 25 * W_Textwidth - 2;
+ if (mx + 23 * W_Textwidth + 2 > windowWidth)
+ mx = windowWidth - 28 * W_Textwidth - 2;
if (my + 3 * W_Textheight + 2 > windowHeight)
my = windowHeight - 3 * W_Textheight - 2;
infow =
- W_MakeWindow ("info", mx, my, W_Textwidth * 25, W_Textheight * 3,
+ W_MakeWindow ("info", mx, my, W_Textwidth * 28, W_Textheight * 3,
ww, 2, foreColor);
W_MapWindow (infow);
k = &planets[target->o_num];
@@ -249,10 +249,11 @@
(void) sprintf (buf, "Armies %d", k->pl_armies);
W_WriteText (infow, W_Textwidth, W_Textheight * line++,
planetColor (k), buf, strlen (buf), W_RegularFont);
- (void) sprintf (buf, "%s %s %s %c%c%c%c",
+ (void) sprintf (buf, "%s %s %s %s %c%c%c%c",
(k->pl_flags & PLREPAIR ? "REPAIR" : " "),
(k->pl_flags & PLFUEL ? "FUEL" : " "),
(k->pl_flags & PLAGRI ? "AGRI" : " "),
+ (k->pl_flags & PLCORE ? "CORE" : " "),
(k->pl_info & FED ? 'F' : ' '),
(k->pl_info & ROM ? 'R' : ' '),
(k->pl_info & KLI ? 'K' : ' '),
Index: planetlist.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/planetlist.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- planetlist.c 21 Jan 2003 21:28:42 -0000 1.1.1.1
+++ planetlist.c 16 May 2006 05:10:13 -0000 1.2
@@ -43,20 +43,21 @@
register struct planet *j;
/* W_ClearWindow(planetw); */
- (void) sprintf (buf, "Planet Name own armies REPAIR FUEL AGRI info");
+ (void) sprintf (buf, "Planet Name own armies REPAIR FUEL AGRI CORE info");
W_WriteText (planetw, 2, 1, textColor, buf, strlen (buf), W_RegularFont);
k = 2;
for (i = 0, j = &planets[i]; i < MAXPLANETS; i++, j++)
{
if (j->pl_info & me->p_team)
{
- (void) sprintf (buf, "%-16s %3s %3d %6s %4s %4s %c%c%c%c",
+ (void) sprintf (buf, "%-16s %3s %3d %6s %4s %4s %4s %c%c%c%c",
j->pl_name,
teamname[j->pl_owner],
j->pl_armies,
(j->pl_flags & PLREPAIR ? "REPAIR" : " "),
(j->pl_flags & PLFUEL ? "FUEL" : " "),
(j->pl_flags & PLAGRI ? "AGRI" : " "),
+ (j->pl_flags & PLCORE ? "CORE" : " "),
(j->pl_info & FED ? 'F' : ' '),
(j->pl_info & ROM ? 'R' : ' '),
(j->pl_info & KLI ? 'K' : ' '),
Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- defaults.c 14 May 2006 02:14:54 -0000 1.16
+++ defaults.c 16 May 2006 05:10:13 -0000 1.17
@@ -288,6 +288,12 @@
NULL
}
},
+ {"newQuit", &newQuit, RC_BOOL,
+ {
+ "Use new quit window",
+ NULL
+ }
+ },
{"newSound", &newSound, RC_BOOL,
{
"Use new layered, stereo sound",
@@ -1385,6 +1391,7 @@
timerType = T_SHIP;
allowWheelActions = booleanDefault ("allowWheelActions", allowWheelActions);
+ newQuit = booleanDefault ("newQuit", newQuit);
newSound = booleanDefault ("newSound", newSound);
newSoundAngles = booleanDefault ("newSoundAngles", newSoundAngles);
tpDotDist = intDefault ("tpDotDist", tpDotDist);
Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- data.c 14 May 2006 02:14:54 -0000 1.18
+++ data.c 16 May 2006 05:10:13 -0000 1.19
@@ -236,7 +236,7 @@
extern double Sin[], Cos[];
-W_Icon stipple, clockpic, genopic, icon;
+W_Icon stipple, clockpic, clockhandpic, genopic, icon;
W_Color borderColor, backColor, textColor, myColor, warningColor, shipCol[5],
rColor, yColor, gColor, unColor, foreColor;
@@ -747,6 +747,6 @@
WNDPROC lpfnDefRichEditWndProc; /* default window proc */
int richText = 0; /* temporary variable to select rich text message windows */
-
+int newQuit = 1;
int newSound = 1; /* use new SDL sound */
int newSoundAngles = 1; /* use new SDL sound with angular 3d component */
\ No newline at end of file
Index: map.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- map.c 14 May 2006 02:14:54 -0000 1.8
+++ map.c 16 May 2006 05:10:13 -0000 1.9
@@ -482,7 +482,7 @@
}
else
{
-#endif
+#endif // Beeplite end
if (planetBitmapGalaxy == 3)
{
#ifndef DOUBLE_BUFFERING
@@ -492,6 +492,7 @@
BMP_MPLANET_HEIGHT,
BMP_CPLANET_WIDTH,
BMP_CPLANET_HEIGHT,
+ 0,
planetBitmapC (l),
planetColor (l),
mapw);
@@ -502,6 +503,7 @@
BMP_MPLANET_HEIGHT,
BMP_CPLANET_WIDTH,
BMP_CPLANET_HEIGHT,
+ 0,
planetBitmapC (l),
planetColor (l),
mapw);