Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv14632/src Modified Files: dashboard.c dashboard3.c data.c mswindow.c newwin.c war.c Log Message: Fixed up clock hand display using mask. Rewrote dashboard special info function to be smarter and only redraw when something changes. Some more bitmap changes to make ships more distinct. Index: mswindow.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- mswindow.c 16 May 2006 05:10:13 -0000 1.21 +++ mswindow.c 19 May 2006 18:08:07 -0000 1.22 @@ -452,6 +452,7 @@ // Free other bitmaps free (clockpic); free (clockhandpic); + free (clockhandmask); for (j = 0; j < NUM_CTORP_TYPES; j++) { @@ -5065,7 +5066,7 @@ SetWorldTransform(hdc,&xForm); - BitBlt(hdc, 0, 0, newwidth, newheight, GlobalMemDC2, srcx, srcy, SRCPAINT); + BitBlt(hdc, 0, 0, newwidth, newheight, GlobalMemDC2, srcx, srcy, SRCAND); // Reset xForm xForm.eM11 = (FLOAT) 1.0; Index: dashboard.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- dashboard.c 18 May 2006 07:15:35 -0000 1.4 +++ dashboard.c 19 May 2006 18:08:07 -0000 1.5 @@ -275,82 +275,124 @@ /******************************************************************************/ /*** db_special() - for showing prioritized timer info in dashboard ***/ /******************************************************************************/ -static void -db_special (void) +void +db_special (int fr, int x, int y) { - char buf[16]; + char buf[8]; + char buf2[4]; + char tmp[8]; struct player *plr; - int repairtime; - + int msgtype; + static char oldmsg[8]; + static int oldmsgtype; + W_Color color; + int left, right, pos; + if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) plr = players + me->p_playerl; else plr = me; - /* Start with low priority messages, clear as necessary for higher - priority ones */ + /* Check if any delays expired */ + if (delay && time (0) > delay) + delay = 0; + if (rdelay && time (0) > rdelay) + rdelay = 0; + if (tdelay && time (0) > tdelay) + tdelay = 0; + + /* Start with highest priority message, then go down in descending order + of importance */ - /* Default impulse text */ - W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 38, 3, W_Yellow, "Impulse", 7, W_BoldFont); - - /* Transwarp text */ - if (me->p_flags & PFTWARP) + /* Declare War text */ + if (delay) { - W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 38, 3, W_White, "Twarp", 5, W_BoldFont); + sprintf (buf, "War "); + sprintf(buf2, "%d", delay - time (0)); + strcat (buf, buf2); + msgtype = 0; + color = W_Red; } - /* Tournament extension text */ - if (tdelay) + /* Refit text */ + else if (rdelay) { - if (time (0) > tdelay) - tdelay = 0; - else - { - W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 38, 3, W_Grey, "Tmod", 4, W_BoldFont); - sprintf(buf, "%d", tdelay - time (0)); - W_WriteText (tstatw, 68, 3, textColor, buf, strlen (buf), W_RegularFont); - } + sprintf (buf, "Refit "); + sprintf(buf2, "%d", rdelay - time (0)); + strcat (buf, buf2); + msgtype = 1; + color = W_Green; } - /* Repair text */ - if ((me->p_flags & PFREPAIR) && plr->p_speed == 0) + else if ((me->p_flags & PFREPAIR) && plr->p_speed == 0) { - repairtime = repair_time(); - W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 38, 3, W_Cyan, "Fix", 3, W_BoldFont); - sprintf(buf, "%d", repairtime); - W_WriteText (tstatw, 62, 3, textColor, buf, strlen (buf), W_RegularFont); + sprintf (buf, "Fix "); + sprintf(buf2, "%d", repair_time()); + strcat (buf, buf2); + msgtype = 2; + color = W_Cyan; } - - /* Refit text */ - if (rdelay) + /* Tournament extension text */ + else if (tdelay) { - if (time (0) > rdelay) - rdelay = 0; - else - { - W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 38, 3, W_Green, "Refit", 5, W_BoldFont); - sprintf(buf, "%d", rdelay - time (0)); - W_WriteText (tstatw, 74, 3, textColor, buf, strlen (buf), W_RegularFont); - } + sprintf (buf, "Tmod "); + sprintf(buf2, "%d", tdelay - time (0)); + strcat (buf, buf2); + msgtype = 3; + color = W_Grey; + } + /* Transwarp text */ + else if (me->p_flags & PFTWARP) + { + sprintf (buf, "Twarp"); + msgtype = 4; + color = W_White; } - - /* Declare War text */ - if (delay) + /* Default impulse text */ + else { - if (time (0) > delay) - delay = 0; - else + sprintf (buf, "Impulse"); + msgtype = 5; + color = W_Yellow; + } + + if (fr || msgtype != oldmsgtype) + { + W_ClearArea (tstatw, x, y, W_Textwidth * 8, W_Textheight); + W_WriteText (tstatw, x, y, color, buf, strlen (buf), W_BoldFont); + } + else + { + /* + Run through the string to find any differences. Print any + continuous differences with one W_WriteText call. + */ + left = 0; + right = -1; + pos = 0; + strcpy (tmp, buf); + while (pos < 7) { - W_ClearArea (tstatw, 38, 3, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 38, 3, W_Red, "War", 3, W_BoldFont); - sprintf(buf, "%d", delay - time (0)); - W_WriteText (tstatw, 62, 3, textColor, buf, strlen (buf), W_RegularFont); + if (tmp[pos] == oldmsg[pos]) + { + if (left <= right) + W_WriteText(tstatw, x + left * W_Textwidth, y, color, + tmp + left, right - left + 1, W_BoldFont); + left = pos + 1; + right = pos; + } + else + right++; + pos++; } + if (left <= right) + W_WriteText(tstatw, x + left * W_Textwidth, y, color, + tmp + left, right - left + 1, W_BoldFont); } + + oldmsgtype = msgtype; + strcpy(oldmsg, buf); + + return; } @@ -486,7 +528,7 @@ W_ClearWindow (tstatw); db_flags (fr); - db_special (); + db_special (fr, 38, 3); /* TIMER */ db_timer (fr, 2, 3 + 2 * (W_Textheight + SPACING)); @@ -646,7 +688,7 @@ W_ClearWindow (tstatw); db_flags (fr); - db_special (); + db_special (fr, 38, 3); db_timer (fr, 2, 3 + 2 * (W_Textheight + SPACING)); Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- newwin.c 16 May 2006 05:10:13 -0000 1.22 +++ newwin.c 19 May 2006 18:08:07 -0000 1.23 @@ -1203,7 +1203,10 @@ 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); + BMP_CHAND_HEIGHT, BMP_CLOCKHAND, qwin, LR_DEFAULTCOLOR); + clockhandmask = + W_StoreBitmap3 ("bitmaps/misclib/color/clockhandmask.bmp", BMP_CHAND_WIDTH, + BMP_CHAND_HEIGHT, BMP_CLOCKHAND, qwin, LR_MONOCHROME); } else { @@ -1981,11 +1984,15 @@ 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); + angle, clockhandmask, foreColor, qwin); + angle = (int)(255-time*255/max); + W_WriteScaleBitmap (CLOCK_BDR, CLOCK_BDR, BMP_CHAND_WIDTH, BMP_CHAND_HEIGHT, + BMP_CHAND_WIDTH, BMP_CHAND_HEIGHT, + (unsigned char)(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); + W_MaskText (qwin, tx, ty, W_Black, buf, strlen (buf), W_RegularFont); cp = "Quit NetrekXP"; } Index: data.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- data.c 18 May 2006 07:15:35 -0000 1.20 +++ data.c 19 May 2006 18:08:07 -0000 1.21 @@ -237,7 +237,7 @@ extern double Sin[], Cos[]; -W_Icon stipple, clockpic, clockhandpic, genopic, icon; +W_Icon stipple, clockpic, clockhandpic, clockhandmask, genopic, icon; W_Color borderColor, backColor, textColor, myColor, warningColor, shipCol[5], rColor, yColor, gColor, unColor, foreColor; Index: war.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/war.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- war.c 21 Jan 2003 21:28:34 -0000 1.1.1.1 +++ war.c 19 May 2006 18:08:07 -0000 1.2 @@ -130,6 +130,9 @@ W_UnmapWindow (war); return; break; + default: + return; + break; } if (me->p_swar & enemyteam) Index: dashboard3.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard3.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- dashboard3.c 18 May 2006 07:15:35 -0000 1.5 +++ dashboard3.c 19 May 2006 18:08:07 -0000 1.6 @@ -241,88 +241,6 @@ /******************************************************************************/ -/*** db_special() - for showing prioritized timer info in dashboard ***/ -/******************************************************************************/ -static void -db_special (void) -{ - char buf[16]; - struct player *plr; - int repairtime; - - if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) - plr = players + me->p_playerl; - else - plr = me; - - /* Start with low priority messages, clear as necessary for higher - priority ones */ - - /* Default impulse text */ - W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 160, 32, W_Yellow, "Impulse", 7, W_BoldFont); - - /* Transwarp text */ - if (me->p_flags & PFTWARP) - { - W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 160, 32, W_White, "Twarp", 5, W_BoldFont); - } - /* Tournament extension text */ - if (tdelay) - { - if (time (0) > tdelay) - tdelay = 0; - else - { - W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 160, 32, W_Grey, "Tmod", 4, W_BoldFont); - sprintf(buf, "%d", tdelay - time (0)); - W_WriteText (tstatw, 190, 32, textColor, buf, strlen (buf), W_RegularFont); - } - } - - /* Repair text */ - if ((me->p_flags & PFREPAIR) && plr->p_speed == 0) - { - repairtime = repair_time(); - W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 160, 32, W_Cyan, "Fix", 3, W_BoldFont); - sprintf(buf, "%d", repairtime); - W_WriteText (tstatw, 184, 32, textColor, buf, strlen (buf), W_RegularFont); - } - - /* Refit text */ - if (rdelay) - { - if (time (0) > rdelay) - rdelay = 0; - else - { - W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 160, 32, W_Green, "Refit", 5, W_BoldFont); - sprintf(buf, "%d", rdelay - time (0)); - W_WriteText (tstatw, 196, 32, textColor, buf, strlen (buf), W_RegularFont); - } - } - - /* Declare War text */ - if (delay) - { - if (time (0) > delay) - delay = 0; - else - { - W_ClearArea (tstatw, 160, 32, W_Textwidth * 8, W_Textheight); - W_WriteText (tstatw, 160, 32, W_Red, "War", 3, W_BoldFont); - sprintf(buf, "%d", delay - time (0)); - W_WriteText (tstatw, 184, 32, textColor, buf, strlen (buf), W_RegularFont); - } - } -} - - -/******************************************************************************/ /*** db_flags() ***/ /******************************************************************************/ static void @@ -446,7 +364,7 @@ W_ClearWindow (tstatw); db_flags (fr); - db_special (); + db_special (fr, 160, 32); /* TIMER */ db_timer (fr, WINSIDE - 12 * W_Textwidth, 32);