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

Modified Files:
	cowmain.c data.c death.c defaults.c getship.c input.c local.c 
	map.c mswindow.c newwin.c option.c 
Log Message:
Added "showArmy: (on)/off" to show army count of planet you are orbiting.  Can be changed
 in game via planets menu
Added "detCircle: on/(off)" to show det circle on tactical.  Can be changed in game via
ship menu
Pushing transwarp key will automatically lock you onto your team's base, and send the practice
robot request that starts transwarp, if your team has a base, and if you aren't locked onto
any player already.  For games with multiple bases on the same team (i.e. chaos), you will
have to lock onto the base of your choice, otherwise it will send you to the first base on
your team's player list.
First attempt at fixing color cycling of colorful phasers.
Fix to rank message.

Index: death.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/death.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- death.c	21 May 2006 18:53:03 -0000	1.8
+++ death.c	22 May 2006 08:27:53 -0000	1.9
@@ -84,14 +84,10 @@
 
     if (promoted)
     {
-        /* Use deathmessage as a buffer because it will be updated in
-           a moment anyway */
-
-        sprintf (deathmessage, "Congratulations, You have scummed up to %s",
+        sprintf (rankmessage, "Congratulations, You have scummed up to %s",
                  ranks[mystats->st_rank].name);
-        W_WriteText (w, 50, 100, W_Yellow, deathmessage,
-                     strlen (deathmessage), W_BoldFont);
-        promoted = 0;
+        W_WriteText (w, 50, 80, W_Yellow, rankmessage,
+                     strlen (rankmessage), W_BoldFont);
     }
 
 
@@ -193,7 +189,7 @@
         break;
     }
 
-    W_WriteText (w, 50, 80, W_Cyan, deathmessage, strlen (deathmessage),
+    W_WriteText (w, 50, 60, W_Cyan, deathmessage, strlen (deathmessage),
                  deathFont);
 
 
@@ -237,6 +233,7 @@
     if (deathFont != W_BoldFont)        /* Initialise deathFont */
         deathFont = W_RegularFont;
 
-    W_WriteText (w, 50, 80, W_Cyan, deathmessage, strlen (deathmessage),
-                 deathFont);
+    if (promoted)
+        W_WriteText (w, 50, 80, W_Yellow, rankmessage, strlen (rankmessage), W_BoldFont);
+    W_WriteText (w, 50, 60, W_Cyan, deathmessage, strlen (deathmessage), deathFont);
 }

Index: getship.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/getship.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- getship.c	18 May 2006 07:15:35 -0000	1.2
+++ getship.c	22 May 2006 08:27:53 -0000	1.3
@@ -113,7 +113,7 @@
     shipvals[ATT].s_width = 20; /* att: */
     shipvals[ATT].s_height = 20;        /* att: */
     shipvals[ATT].s_type = ATT; /* att: */
-    shipvals[ATT].s_phaserfuse = 1; /* att: */
+    shipvals[ATT].s_phaserfuse = 2; /* att: */
     shipvals[ATT].s_repair = 30000; /* att: */
 
     shipvals[SGALAXY].s_phaserdamage = 100;     /* galaxy: */

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- mswindow.c	21 May 2006 18:53:03 -0000	1.25
+++ mswindow.c	22 May 2006 08:27:53 -0000	1.26
@@ -196,7 +196,7 @@
        win = (Window *)window;\
        if (bitmap->hwnd != win->hwnd)\
        {\
-           LineToConsole("DBICON - mismatch windows\n");\
+           LineToConsole("DBICONHEADER - bitmap and window mismatch\n");\
            hdc = GetDC (win->hwnd);\
            usebitmaphwnd = 0;\
        }\
@@ -3294,6 +3294,31 @@
         ReleaseDC (win->hwnd, hdc);
 }
 
+void W_WriteCircle (W_Window window,
+                    int x,
+                    int y,
+                    int r,
+                    W_Color color)
+{
+    DBHEADER_VOID;
+
+    x += win->border;
+    y += win->border;
+    
+    if (NetrekPalette)
+    {
+        SelectPalette (hdc, NetrekPalette, FALSE);
+        RealizePalette (hdc);
+    }
+    SelectObject (hdc, colortable[color].pen);
+    SelectObject (hdc, GetStockObject (NULL_BRUSH));
+
+    Ellipse (hdc, x - r, y - r, x + r, y + r);
+
+    if (!sdb || !doubleBuffering || !ingame)
+        ReleaseDC (win->hwnd, hdc);
+}
+
 //Draw a triangle. Yay.
 void
 W_WriteTriangle (W_Window window,

Index: map.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- map.c	21 May 2006 18:53:03 -0000	1.12
+++ map.c	22 May 2006 08:27:53 -0000	1.13
@@ -347,9 +347,9 @@
     {
     	/* Select resources */
         if (p->pl_armies > 4)
-            W_WriteScaleBitmap(dx - 7 * destwidth / 8,
+            W_WriteScaleBitmap(dx - 7 * destwidth / 8 - 1,
                                dy - (destheight / 2),
-                               destwidth/3,
+                               destwidth/3 + 1,
                                destheight,
                                BMP_ARMY_WIDTH,
                                BMP_ARMY_HEIGHT,
@@ -360,16 +360,16 @@
             W_WriteScaleBitmap(dx - (destwidth / 2),
                                dy - (5 * destheight / 6),
                                destwidth,
-                               destheight/3,
+                               destheight/3 + 1,
                                BMP_WRENCH_WIDTH,
                                BMP_WRENCH_HEIGHT,
                                0,
                                mwrench_bitmap, planetColor(p),
                                window);
         if (p->pl_flags & PLFUEL)
-            W_WriteScaleBitmap(dx + 3 * destwidth / 5,
+            W_WriteScaleBitmap(dx + 3 * destwidth / 5 - 1,
                                dy - (destheight / 2),
-                               destwidth/3,
+                               destwidth/3 + 1,
                                destheight,
                                BMP_FUEL_WIDTH,
                                BMP_FUEL_HEIGHT,
@@ -432,7 +432,7 @@
             if (planetBitmapGalaxy == 3)  // Needs adjusting
                 W_ClearArea (mapw, odx - 7 * BMP_MPLANET_WIDTH / 8,
                              ody - (5 * BMP_MPLANET_HEIGHT / 6),
-                             7 * BMP_MPLANET_WIDTH / 4, 4 * BMP_MPLANET_HEIGHT / 3);
+                             7 * BMP_MPLANET_WIDTH / 4 + 1, 4 * BMP_MPLANET_HEIGHT / 3 + 1);
             else
                 W_ClearArea (mapw, odx - (BMP_MPLANET_WIDTH / 2),
                              ody - (BMP_MPLANET_HEIGHT / 2),
@@ -450,7 +450,7 @@
             if (planetBitmapGalaxy == 3)  // Needs adjusting
                 W_ClearArea (mapw, dx - 7 * BMP_MPLANET_WIDTH / 8,
                              dy - (5 * BMP_MPLANET_HEIGHT / 6),
-                             7 * BMP_MPLANET_WIDTH / 4, 4 * BMP_MPLANET_HEIGHT / 3);
+                             7 * BMP_MPLANET_WIDTH / 4 + 1, 4 * BMP_MPLANET_HEIGHT / 3 + 1);
 
             else
                 W_ClearArea (mapw, dx - (BMP_MPLANET_WIDTH / 2 + 4),

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- newwin.c	21 May 2006 18:53:03 -0000	1.26
+++ newwin.c	22 May 2006 08:27:53 -0000	1.27
@@ -1399,6 +1399,7 @@
     {
         while (!W_EventsPending ())
         {
+            HANDLE handles[FD_SETSIZE];
             time_t elapsed;
             fd_set rfds;
             struct timeval tv;
@@ -1414,8 +1415,8 @@
             FD_SET (sock, &rfds);
             if (udpSock >= 0)
                 FD_SET (udpSock, &rfds);
-            select (32, &rfds, 0, 0, &tv);      /* hmm,  32 might be too
-                                                 * small */
+           // WaitForMultipleObjects(32, handles, TRUE, INFINITE);
+            select (32, &rfds, 0, 0, &tv);      /* hmm, 32 might be too small */
 
             if (FD_ISSET (sock, &rfds) ||
                 (udpSock >= 0 && FD_ISSET (udpSock, &rfds)))

Index: input.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/input.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- input.c	21 May 2006 09:56:38 -0000	1.11
+++ input.c	22 May 2006 08:27:53 -0000	1.12
@@ -303,6 +303,32 @@
 };
 
 /******************************************************************************/
+/***  lockBase() - for use with twarp key                                   ***/
+/******************************************************************************/
+static void
+lockBase (void)
+{
+    register int i;
+    register struct player *j;
+    register int targnum = -1;
+
+    for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++)
+    {
+        if (j->p_status != PALIVE)
+            continue;
+        if (j == me)
+            continue;
+        if ((j->p_ship.s_type == STARBASE) && (j->p_team == me->p_team))
+            targnum = i;
+    }
+    if (targnum != -1)
+    {
+        sendPlaylockReq (targnum);
+        me->p_playerl = (short) targnum;
+    }
+}
+
+/******************************************************************************/
 /***  lockPlanetOrBase()                                                    ***/
 /******************************************************************************/
 static void
@@ -2197,6 +2223,8 @@
 void
 Key42 (void)
 {
+    if (!(me->p_flags & PFPLOCK))
+        lockBase ();
     sendPractrReq ();
 }
 

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- local.c	21 May 2006 18:53:03 -0000	1.25
+++ local.c	22 May 2006 08:27:53 -0000	1.26
@@ -30,6 +30,9 @@
 static int clearzone[4][(MAXTORP + 1) * MAXPLAYER +
                         (MAXPLASMA + 1) * MAXPLAYER + MAXPLANETS];
 
+#ifdef JUBILEE_PHASERS
+static int ph_counter = 0;
+#endif
 static int clearlcount = 0;
 #ifdef HOCKEY_LINES
 static int clearline[4][MAXPLAYER + 2 * MAXPLAYER + NUM_HOCKEY_LINES];
@@ -522,6 +525,43 @@
             clearzone[3][clearcount] = W_Textheight;
             clearcount++;
         }
+        
+        if (showArmy && (me->p_flags & PFORBIT)
+        && (me->p_planet = get_closest_planet(me->p_x, me->p_y)) == l->pl_no)
+        {
+            char armbuf[4];
+            int armbuflen;
+            
+            if (l->pl_armies < 10)
+            {
+                armbuf[0] = (char) (l->pl_armies + '0');
+                armbuf[1] = '\0';
+                armbuflen = 2;
+            }
+            else if (l->pl_armies < 100)
+            {
+                armbuf[0] = (char) (l->pl_armies / 10 + '0');
+                armbuf[1] = (char) (l->pl_armies % 10 + '0');
+                armbuf[2] = '\0';
+                armbuflen = 3;
+            }
+            else
+            {
+                armbuf[0] = (char) (l->pl_armies / 100 + '0');
+                armbuf[1] = (char) (l->pl_armies / 10 + '0');
+                armbuf[2] = (char) (l->pl_armies % 10 + '0');
+                armbuf[3] = '\0';
+                armbuflen = 4;
+            }
+            W_MaskText (w, dx - (7 * BMP_PLANET_WIDTH / 8),
+                        dy - (5 * BMP_PLANET_HEIGHT / 6), planetColor (l),
+                        armbuf, armbuflen, planetFont (l));
+            clearzone[0][clearcount] = dx - (7 * BMP_PLANET_WIDTH / 8);
+            clearzone[1][clearcount] = dy - (5 * BMP_PLANET_HEIGHT / 6);
+            clearzone[2][clearcount] = W_Textwidth * armbuflen;
+            clearzone[3][clearcount] = W_Textheight;
+            clearcount++;
+        }
         if (planetBitmap == 3) // Needs adjusting
         {
             clearzone[0][clearcount] = dx - (7 * BMP_PLANET_WIDTH / 8);
@@ -574,6 +614,11 @@
 
 }
 
+void
+DrawDetCircle()
+{
+    W_WriteCircle(w, WINSIDE/2, WINSIDE/2, DETDIST/SCALE, W_Red);
+}  
 
 static void
 DrawShips (void)
@@ -583,7 +628,7 @@
 
     char idbuf[10];
     int buflen = 1;
-    static W_Color ph_col;
+    static int ph_col = 0;
     const int view = SCALE * WINSIDE / 2 + BMP_SHIELD_WIDTH * SCALE / 2;
     int dx, dy, px, py, wx, wy, tx, ty, lx, ly;
     int new_dx, new_dy;
@@ -1356,24 +1401,33 @@
                         switch (ph_col)
                         {
                         case 0:
+                        case 1:
                             col = W_Red;
                             break;
-                        case 1:
+                        case 2:
+                        case 3:
                             col = W_Green;
                             break;
-                        case 2:
+                        case 4:
+                        case 5:
                             col = W_Yellow;
                             break;
-                        case 3:
+                        case 6:
+                        case 7:
                             col = W_Cyan;
                             break;
                         default:
                             col = shipCol[remap[j->p_team]];
+                            break;
+                        }
+                        ph_counter++;
+                        ph_col += (100/j->p_ship.s_phaserfuse/updatesPerSec);
+                        if (ph_counter == (updatesPerSec - 1))
+                        {
+                            ph_counter = 0;
                             ph_col = 0;
                         }
-
-                        ph_col++;
-
+                        LineToConsole("Counter is %d, ph_col is %d\n", ph_counter, ph_col);
                         if (phaserShrinkStyle == 1)
                         {
                             get_shrink_phaser_coords(&new_dx, &new_dy,
@@ -2482,6 +2536,8 @@
         DrawStars();
 
     DrawShips ();
+    if (detCircle)
+        DrawDetCircle();
     DrawTorps ();
     DrawPlasmaTorps ();
 

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- data.c	21 May 2006 18:53:03 -0000	1.24
+++ data.c	22 May 2006 08:27:53 -0000	1.25
@@ -54,6 +54,8 @@
                                  * dashboard, 6/2/93 LAB */
 int old_db = 0;                 /* should be same as
                                  * newDashboard */
+int detCircle = 0;              /* Show det circle on tactical */
+int showArmy = 1;               /* Show army count of planet you are orbiting */
 int fastQuit = 0;
 int gen_distress = 0;           /* generic distress/macro
                                  * system support */
@@ -385,6 +387,7 @@
 LONG packets_received = 0;      /* # all packets received */
 W_Window pStats = NULL;
 
+char rankmessage[80];
 char deathmessage[80];
 char outmessage[MAX_MLENGTH];          /* maximum message length */
 

Index: cowmain.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cowmain.c	21 May 2006 09:56:38 -0000	1.13
+++ cowmain.c	22 May 2006 08:27:53 -0000	1.14
@@ -1082,6 +1082,7 @@
         Play_Sound(ENGINE_SOUND);
     }
 #endif
+    promoted = 0;
     ingame = 1;
     /* Get input until the player quits or dies */
     input ();

Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- option.c	21 May 2006 18:53:03 -0000	1.16
+++ option.c	22 May 2006 08:27:53 -0000	1.17
@@ -29,7 +29,7 @@
 static int old_rotate, old_rotate_deg;
 #endif
 
-static int lastUpdateSpeed = 5;
+static int lastUpdateSpeed = 10;
 static char newkeys[14];
 
 char *localmes[] = { "Show owner on local planets",
@@ -269,6 +269,7 @@
     {1, "shrink their phasers by %d/16", &theirPhaserShrink, 0, 0, 0, NULL, &phaserShrinkRng},
     {1, "shrink phasers on a miss", &shrinkPhaserOnMiss, 0, 0, 0, NULL, NULL},
     {1, "report kills", &reportKills, 0, 0, 0, NULL, NULL},
+    {1, "show det circle", &detCircle, 0, 0, 0, NULL, NULL},
     {1, "done", &notdone, 0, 0, 0, NULL, NULL},
     {-1, NULL, 0, 0, 0, 0, NULL, NULL}
 };
@@ -279,6 +280,7 @@
     {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 army count on orbit", &showArmy, 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},
     {1, "show AGRI in caps on map", &agriCAPS, 0, 0, 0, NULL, NULL},
@@ -899,6 +901,11 @@
             redrawall = 1;
             oldalert = 0; /* Force a border refresh */
         }
+        /* Let's see if this is we need to clear the det circle */
+        else if (op->op_option == &detCircle && detCircle == 0)
+        {
+            W_WriteCircle(w, WINSIDE/2, WINSIDE/2, DETDIST/SCALE, backColor);
+        }
         else if (op->op_option == &partitionPlist)
             RedrawPlayerList ();
         else if (op->op_option == &sortPlayers)

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- defaults.c	21 May 2006 09:56:38 -0000	1.18
+++ defaults.c	22 May 2006 08:27:53 -0000	1.19
@@ -124,6 +124,12 @@
         }
     },
 #endif
+    {"detCircle", &detCircle, RC_BOOL,
+        {
+            "Show det circle around your ship",
+            NULL
+        }
+    },
     {"disableWinkey", &disableWinkey, RC_BOOL,
         {
             "Disable Windows and Context Keys",
@@ -489,6 +495,12 @@
             NULL
         }
     },
+    {"showArmy", &showArmy, RC_BOOL,
+        {
+            "Show army count of planet you are orbiting",
+            NULL
+        }
+    },
     {"showHints", &showHints, RC_BOOL,
         {
             "Show hints window",
@@ -1425,6 +1437,8 @@
     keepInfo = intDefault ("keepInfo", keepInfo);
     showPlanetOwner = booleanDefault ("showPlanetOwner", showPlanetOwner);
     newDashboard = intDefault ("newDashboard", newDashboard);
+    detCircle = booleanDefault ("detCircle", detCircle);
+    showArmy = booleanDefault ("showArmy", showArmy);
     updatesPerSec = intDefault ("updatesPerSec", updatesPerSec);
     redrawDelay = intDefault ("redrawDelay", redrawDelay);
     logging = booleanDefault ("logging", logging);