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

Modified Files:
	data.c defaults.c defwin.c local.c makecyg option.c 
Log Message:
Cygwin makefile changes: fixed up a bunch of problems to get build to work, still not
perfect as libdir not resolving correctly.  Also removed CYGWIN define from code and
placed it as a compiler runtime define.  Progress of Cygwin build is that client runs, but
select() is broken.  Most likely related to struct fd_set definition.
Added observer support for shrink phasers, color phaser, warn and vary shields, and
removed observer support for detcircle.
Fixed detcircle so turning it off really does turn it off (oops).
Fixed color phaser with regards to FPS changes, so it works at all framerates.
Added observer support for showArmy for locking onto planets.
Split varyShields into 2 netrekrc options, varyShields and varyShieldsColor, to be
able to vary either/neither/both shield graphic and shield color with damage.
Changed defaults for FPS client/server values back to 10 from 50.  Let the user
have it in netrekrc if they want to request a higher rate, and don't assume servers
are running at 50 FPS.  Require that feature packet to be sent to increase the
update rate.

Index: makecyg
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/makecyg,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- makecyg	23 Feb 2007 13:43:57 -0000	1.1
+++ makecyg	24 Feb 2007 10:19:55 -0000	1.2
@@ -7,18 +7,18 @@
 
 # Cygwin
 cc     = gcc
-rc     = gcc
+rc     = windres
 link   = gcc
 compileandlink = gcc
 
 # Compiler and linker flags
 ifndef DEBUG
-cflags = -O2 -v -DWIN32 -DBorland -mwindows
+cflags = -O2 -g -v -DWIN32 -DCYGWIN -mwindows
 ccompileonly = -c
 ldebug =  -v 
 DEBUGDEFS = -DDEBUG
 else
-cflags = -O2 -DWIN32 -DBorland -mwindows
+cflags = -O2 -g -DWIN32 -DCYGWIN -mwindows
 ccompileonly = -c
 ldebug = -w-dup
 endif
@@ -29,16 +29,14 @@
 LIBS = /cygdrive/c/netrekxp/win32/lib/VCC/SDL.LIB \
        /cygdrive/c/netrekxp/win32/lib/VCC/SDL_mixer.LIB \
        /cygdrive/c/netrekxp/win32/lib/VCC/SDLmain.LIB \
-#      "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/LibCW32mt.LIB" \
-#      "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/IMPORT32.LIB" \
-       "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/User32.lib" \
-       "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/Gdi32.lib" \
-       "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/Wsock32.lib" \
-       "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/Kernel32.lib" \
-       "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/Shell32.lib" \
-       "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/Winmm.lib" \
-       "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/Mpr.lib" \
-       "/cygdrive/c/Program Files/Microsoft Platform SDK/Lib/Msimg32.lib" \
+       /cygdrive/c/netrekxp/win32/lib/VCC/User32.lib \
+       /cygdrive/c/netrekxp/win32/lib/VCC/Gdi32.lib \
+       /cygdrive/c/netrekxp/win32/lib/VCC/Wsock32.lib \
+       /cygdrive/c/netrekxp/win32/lib/VCC/Kernel32.lib \
+       /cygdrive/c/netrekxp/win32/lib/VCC/Shell32.lib \
+       /cygdrive/c/netrekxp/win32/lib/VCC/Winmm.lib \
+       /cygdrive/c/netrekxp/win32/lib/VCC/Mpr.lib \
+       /cygdrive/c/netrekxp/win32/lib/VCC/Msimg32.lib \
        $(GMPLIB)
 
 INCS = -I/cygdrive/c/netrekxp/include -I/cygdrive/c/netrekxp/win32 -I/cygdrive/c/netrekxp/win32/h -I/cygdrive/c/netrekxp/win32/SDL/
@@ -70,7 +68,7 @@
 MAINSRC         = main.c
 
 ifndef RSA
-GMPLIB = ..\Win32\lib\BCC\libgmpbcc.lib
+GMPLIB = ..\Win32\lib\libgmp.lib
 RSADEFS = -DRSA
 RSASRC = rsa_box.c rsa_box_0.c rsa_box_1.c rsa_box_2.c\
                   rsa_box_3.c rsa_box_4.c
@@ -93,10 +91,10 @@
 .c.o:
 	$(cc) $(cflags) $(ccompileonly) $(cdebug) $(DEFS) $(RSADEFS) $(DEBUGDEFS) $(INCS) $<
 
-#RESOURCES = bccnetrek.res
+RESOURCES = vccnetrek.o
 
-#$(RESOURCES): bccnetrek.rc
-#	$(rc) bccnetrek.rc
+$(RESOURCES): vccnetrek.rc
+	$(rc) -o vccnetrek.o vccnetrek.rc
 
 netrek.exe:  $(OBJS) $(RESOURCES) main.ico
 		$(link) $(ldebug) $(LIBOPTS) $(OBJS) $(LIBS) $(RESOURCES)

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- local.c	23 Feb 2007 13:43:56 -0000	1.56
+++ local.c	24 Feb 2007 10:19:55 -0000	1.57
@@ -533,9 +533,12 @@
             clearzone[3][clearcount] = W_Textheight;
             clearcount++;
         }
-        
-        if (showArmy && (me->p_flags & PFORBIT)
-        && (F_sp_generic_32 ? me->pl_orbit : get_closest_planet(me->p_x, me->p_y)) == l->pl_no)
+
+        /* Allow army display if player/observer is orbitting a planet, or alternatively
+           if observer is locked onto a planet */
+        if (showArmy &&
+           ( (me->p_flags & PFORBIT) && (F_sp_generic_32 ? me->pl_orbit : get_closest_planet(me->p_x, me->p_y)) == l->pl_no)
+          || ((me->p_flags & PFPLLOCK) && (me->p_flags & PFOBSERV) && (me->p_planet == l->pl_no)) )
         {
             char armbuf[4];
             int armbuflen;
@@ -1085,14 +1088,19 @@
 #ifdef VSHIELD_BITMAPS
                 int shieldnum;
 
-                if (j == me && varyShields)
+                if ((myPlayer(j) || isObsLockPlayer(j)) && varyShields)
                 {
-                    int value;
-
                     shieldnum =
                         SHIELD_FRAMES * me->p_shield / me->p_ship.s_maxshield;
                     if (shieldnum >= SHIELD_FRAMES)
                         shieldnum = SHIELD_FRAMES - 1;
+                }
+                else
+                    shieldnum = 2;
+
+                if ((myPlayer(j) || isObsLockPlayer(j)) && varyShieldsColor)
+                {
+                    int value;
                     value = (100 * me->p_shield) / me->p_ship.s_maxshield;
                     if (value <= 33)
                         color = rColor;
@@ -1102,13 +1110,10 @@
                        color = gColor;
                 }
                 else
-                {
                     color = playerColor (j);
-                    shieldnum = 2;
-                }
 #endif
 
-                if (warnShields && j == me)
+                if (warnShields && (myPlayer(j) || isObsLockPlayer(j)))
                 {
                     switch (me->p_flags & (PFGREEN | PFYELLOW | PFRED))
                     {
@@ -1193,9 +1198,9 @@
                 }
             }
             /* Det circle */
-            if (showdetCircle)
+            if (detCircle && showdetCircle)
             {
-            	if (myPlayer(j) || isObsLockPlayer(j))
+            	if (myPlayer(j))
             	{
                     W_WriteCircle(w, WINSIDE/2, WINSIDE/2, DETDIST/SCALE, 0, W_Red);         
                     clearzone[0][clearcount] = WINSIDE/2 - (DETDIST/SCALE);
@@ -1517,7 +1522,7 @@
 
                 if (shrinkPhaserOnMiss || php->ph_status != PHMISS)
                 {
-                    if (j == me)
+                    if (myPlayer(j) || isObsLockPlayer(j))
                     {
                         if (phaserShrinkStyle == 1)
                         {
@@ -1553,7 +1558,7 @@
                 if (friendlyPlayer (j))
                 {
 #ifdef JUBILEE_PHASERS
-                    if (j == me && php->ph_status == PHHIT && colorfulPhasers)
+                    if ((myPlayer(j) || isObsLockPlayer(j)) && php->ph_status == PHHIT && colorfulPhasers)
                     {
                         int col;
 
@@ -1579,7 +1584,7 @@
                             col = shipCol[remap[j->p_team]];
                             break;
                         }
-                        ph_col += (100/j->p_ship.s_phaserfuse/updatesPerSec);
+                        ph_col += (10/j->p_ship.s_phaserfuse);
                         scaled_ph_col = ph_col * 10 / server_ups;
                         if (phaserShrinkStyle == 1)
                         {
@@ -1595,7 +1600,7 @@
                     {
                         if (php->ph_status != PHMISS)
                         {
-                            if (phaserShrinkStyle == 1 && j == me)
+                            if (phaserShrinkStyle == 1 && (myPlayer(j) || isObsLockPlayer(j)))
                             {
                                 get_shrink_phaser_coords(&new_dx, &new_dy,
                                                         px, py, tx, ty, 

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- defaults.c	23 Feb 2007 13:43:56 -0000	1.43
+++ defaults.c	24 Feb 2007 10:19:54 -0000	1.44
@@ -588,7 +588,7 @@
     },
     {"showArmy", &showArmy, RC_BOOL,
         {
-            "Show army count of planet you are orbiting",
+            "Show army count of planet you are orbiting (or locked on as observer)",
             NULL
         }
     },
@@ -814,7 +814,13 @@
 #ifdef VSHIELD_BITMAPS
     {"varyShields", &varyShields, RC_BOOL,
         {
-            "Change shields color on ship damage",
+            "Change shields graphic on shield damage",
+            NULL
+        }
+    },
+    {"varyShieldsColor", &varyShieldsColor, RC_BOOL,
+        {
+            "Change shields color on shield damage",
             NULL
         }
     },
@@ -833,7 +839,7 @@
     },
     {"warnShields", &warnShields, RC_BOOL,
         {
-            "Change shields color on enemy approach",
+            "Change shields color on enemy approach, overrides varyShieldsColor",
             NULL
         }
     },
@@ -1599,6 +1605,7 @@
 
 #ifdef VSHIELD_BITMAPS
     varyShields = booleanDefault ("varyShields", varyShields);
+    varyShieldsColor = booleanDefault ("varyShieldsColor", varyShieldsColor);
 #endif
 
     warnShields = booleanDefault ("warnShields", warnShields);

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- data.c	23 Feb 2007 13:43:56 -0000	1.52
+++ data.c	24 Feb 2007 10:19:54 -0000	1.53
@@ -228,9 +228,9 @@
 
 #endif
 
-int updatesPerSec = 50;	/* client requested updates per second */
-int server_ups = 50;	/* server responded updates per second */
-int server_fps = 50;	/* server configured frames per second */
+int updatesPerSec = 10;	/* client requested updates per second */
+int server_ups = 10;	/* server responded updates per second */
+int server_fps = 10;	/* server configured frames per second */
 
 #ifdef META
 /* Metaservers list - comma delimited  */
@@ -286,6 +286,7 @@
 W_Icon base_vshield;
 W_Icon shield[SHIELD_FRAMES], cloakicon;
 int varyShields = 1;
+int varyShieldsColor = 1;
 
 #else
 W_Icon shield, cloakicon;

Index: defwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defwin.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- defwin.c	14 May 2006 02:14:54 -0000	1.5
+++ defwin.c	24 Feb 2007 10:19:55 -0000	1.6
@@ -18,6 +18,23 @@
  * the use of it.)
  * 
  * $Log$
+ * Revision 1.6  2007/02/24 10:19:55  modemhero
+ * Cygwin makefile changes: fixed up a bunch of problems to get build to work, still not
+ * perfect as libdir not resolving correctly.  Also removed CYGWIN define from code and
+ * placed it as a compiler runtime define.  Progress of Cygwin build is that client runs, but
+ * select() is broken.  Most likely related to struct fd_set definition.
+ * Added observer support for shrink phasers, color phaser, warn and vary shields, and
+ * removed observer support for detcircle.
+ * Fixed detcircle so turning it off really does turn it off (oops).
+ * Fixed color phaser with regards to FPS changes, so it works at all framerates.
+ * Added observer support for showArmy for locking onto planets.
+ * Split varyShields into 2 netrekrc options, varyShields and varyShieldsColor, to be
+ * able to vary either/neither/both shield graphic and shield color with damage.
+ * Changed defaults for FPS client/server values back to 10 from 50.  Let the user
+ * have it in netrekrc if they want to request a higher rate, and don't assume servers
+ * are running at 50 FPS.  Require that feature packet to be sent to increase the
+ * update rate.
+ *
  * Revision 1.5  2006/05/14 02:14:54  modemhero
  * New planet bitmaps!  Using Defcom's art.  Changeable via planets menu.
  * New netrekrc option, "planetBitmapGalaxy: (0-3)", same options as planetBitmap, but now you have
@@ -105,6 +122,8 @@
     values[10];
 }
 
+/* This structure is for XTREKRC_HELP, which is OFF by default.
+   Netrekrc options are now processed by save_options in defaults.c */
 def_messages[] =
 {
     {
@@ -398,7 +417,7 @@
 #endif
 #ifdef VSHIELD_BITMAPS
     {
-        "varyShields", BOOL_DEF, "Vary shields base on damage",
+        "varyShields", BOOL_DEF, "Vary shields based on damage",
             &varyShields,
         {
             {0, NULL, ""},

Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- option.c	23 Feb 2007 13:43:56 -0000	1.27
+++ option.c	24 Feb 2007 10:19:55 -0000	1.28
@@ -187,7 +187,7 @@
                                  * (optional) */
     char **op_array;            /* array of strings to
                                  * switch between */
-    struct int_range *op_range; /* struct definint an
+    struct int_range *op_range; /* struct defining an
                                  * integer range option */
 };
 
@@ -248,7 +248,8 @@
     {1, "", &colorClient, 0, 0, 0, bitmaptypemess, &bitmap_range},
     {1, "use color weapon bitmaps", &colorWeapons, 0, 0, 0, NULL, NULL},
 #ifdef VSHIELD_BITMAPS
-    {1, "vary shields bitmap", &varyShields, 0, 0, 0, NULL, NULL},
+    {1, "vary shields bitmap w/ dam", &varyShields, 0, 0, 0, NULL, NULL},
+    {1, "vary shields color w/ dam", &varyShieldsColor, 0, 0, 0, NULL, NULL},
 #endif
     {1, "use warning shields", &warnShields, 0, 0, 0, NULL, NULL},
     {1, "use warning hull", &vary_hull, 0, 0, 0, NULL, NULL},