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

Modified Files:
	data.c defaults.c dmessage.c feature.c local.c makefile map.c 
	mswindow.c newwin.c option.c redraw.c 
Log Message:
First attempt at reimport of beeplite into NetrekXP.  Unresolved issue: improper text clearing on TTS beeplite messages.  Still to add: saving of beeplite settings in save_options.

Index: redraw.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/redraw.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- redraw.c	12 Apr 2006 04:20:04 -0000	1.2
+++ redraw.c	18 Apr 2006 13:41:48 -0000	1.3
@@ -98,6 +98,36 @@
         W_ClearArea (warnw, 5, 5, W_Textwidth * warncount, W_Textheight);
         warncount = 0;
     }
+    
+#ifdef BEEPLITE
+    if (tts_timer)
+    {
+        static int last_width;
+
+        tts_timer--;
+        if (!tts_timer)
+	{
+	    /* timed out */
+	    W_EraseTTSText(w, WINSIDE, tts_pos, last_width);
+	    last_width = 0;
+	}
+        else if (tts_timer == tts_time - 1 && last_width)
+	{
+	    /* first draw -- erase previous */
+	    W_EraseTTSText(w, WINSIDE, tts_pos, last_width);
+	    /* draw new */
+	    W_WriteTTSText(w, WINSIDE, tts_pos, tts_width, lastIn,
+			 tts_len);
+	    last_width = tts_width;
+	}
+        else
+	{
+	    /* regular draw */
+	    W_WriteTTSText(w, WINSIDE, tts_pos, tts_width, lastIn, tts_len);
+	    last_width = tts_width;
+	}
+    }
+#endif
 
     local ();                   /* redraw local window */
 

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mswindow.c	15 Apr 2006 01:04:34 -0000	1.4
+++ mswindow.c	18 Apr 2006 13:41:48 -0000	1.5
@@ -4579,6 +4579,49 @@
     ReleaseDC (bitmap->hwnd, hdc);
 }
 
+#ifdef BEEPLITE
+void W_EraseTTSText(W_Window window, int max_width, int y, int width)
+{
+    register int x = (max_width - width) / 2;
+
+    if (x < 0)
+        x = 4;
+    y -= W_Textheight;
+
+    W_ClearArea(window, x, y, width, W_Textheight);
+}
+
+void W_WriteTTSText(W_Window window, int max_width, int y, int width, char *str, int len)
+{
+    register int x = (max_width - width) / 2;
+    HDC hdc;
+    FNHEADER_VOID;
+
+    if (x < 0)
+        x = 4;
+
+    y -= W_Textheight;
+
+    hdc = GetDC(win->hwnd);
+    
+    if (NetrekPalette)
+    {
+        SelectPalette(hdc, NetrekPalette, FALSE);
+        RealizePalette(hdc);
+    }
+  
+    SetTextColor(hdc, colortable[GREY].rgb);
+    SetBkMode(hdc, TRANSPARENT);
+    TextOut(hdc, x, y, str, len);
+    ReleaseDC(win->hwnd, hdc);
+}
+
+int W_TTSTextWidth(char *s, int len)
+{
+    return len*W_Textwidth;
+}
+#endif
+
 void
 W_SetWindowName (W_Window window,
                  char *name)

Index: dmessage.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/dmessage.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- dmessage.c	12 Apr 2006 04:20:03 -0000	1.2
+++ dmessage.c	18 Apr 2006 13:41:48 -0000	1.3
@@ -157,6 +157,10 @@
         HandleGenDistr (message, from, to, &dist);
         len = makedistress (&dist, message, distmacro[dist.distype].macro);
 
+#ifdef BEEPLITE
+        if (useLite)
+	    rcdlite(&dist);
+#endif
         if (len <= 0)
             return;
         flags ^= MDISTR;

Index: newwin.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- newwin.c	17 Apr 2006 09:44:08 -0000	1.6
+++ newwin.c	18 Apr 2006 13:41:48 -0000	1.7
@@ -25,6 +25,7 @@
 #include "data.h"
 #include "playerlist.h"
 #include "bitmaps.h"
+#include "litebitmaps.h"
 #include "parsemeta.h"
 #include "packets.h"
 #include "spopt.h"
@@ -766,6 +767,29 @@
     	loadbitmapsT();
     	loadbitmapsM();
     }
+    
+#ifdef BEEPLITE
+    for (i = 0; i < emph_player_seq_frames; i++)
+    {
+        emph_player_seq[emph_player_seq_frames - (i + 1)] =
+	    W_StoreBitmap(emph_player_seq_width, emph_player_seq_height,
+	  		emph_player_seq_bits[i], mapw);
+    }
+
+    for (i = 0; i < emph_player_seql_frames; i++)
+    {
+        emph_player_seql[emph_player_seql_frames - (i + 1)] =
+	    W_StoreBitmap(emph_player_seql_width, emph_player_seql_height,
+			emph_player_seql_bits[i], w);
+    }
+
+    for (i = 0; i < emph_planet_seq_frames; i++)
+    {
+        emph_planet_seq[emph_planet_seq_frames - (i + 1)] =
+	    W_StoreBitmap(emph_planet_seq_width, emph_planet_seq_height,
+			emph_planet_seq_bits[i], mapw);
+    }
+#endif
 
 /* Experimental weapons */
 #ifdef COLORIZEWEAPON

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- local.c	15 Apr 2006 01:04:34 -0000	1.4
+++ local.c	18 Apr 2006 13:41:48 -0000	1.5
@@ -537,11 +537,19 @@
         }
         if (j->p_status == PALIVE)
         {
-            clearzone[0][clearcount] = dx - (shield_width / 2);
-            clearzone[1][clearcount] = dy - (shield_height / 2);
-            clearzone[2][clearcount] = shield_width;
-            clearzone[3][clearcount] = shield_height;
-            clearcount++;
+#if defined (BEEPLITE)
+	    clearzone[0][clearcount] = dx - (shield_width / 2 + 6);
+	    clearzone[1][clearcount] = dy - (shield_height / 2 + 6);
+	    clearzone[2][clearcount] = shield_width + 12;
+	    clearzone[3][clearcount] = shield_height + 12;
+	    clearcount++;
+#else
+	    clearzone[0][clearcount] = dx - (shield_width / 2);
+	    clearzone[1][clearcount] = dy - (shield_height / 2);
+	    clearzone[2][clearcount] = shield_width;
+	    clearzone[3][clearcount] = shield_height;
+	    clearcount++;
+#endif
 
 	/* Logic of color scheme is as follows:
 	   1) Mono bitmaps (colorClient 0) and new bitmaps (colorClient 1)
@@ -679,6 +687,19 @@
 
           shieldlabel:
 
+#ifdef BEEPLITE
+	    if ((useLite && emph_player_seq_n[j->p_no] > 0)
+	      && (liteflag & LITE_PLAYERS_LOCAL))
+	    {
+	        int     seq_n = emph_player_seq_n[j->p_no] % emph_player_seql_frames;
+
+	        W_WriteBitmap (dx - (emph_player_seql_width / 2),
+			       dy - (emph_player_seql_height / 2),
+			       emph_player_seql[seq_n],
+			       W_White);
+	    }
+#endif
+
 #ifdef SOUND
             if (j->p_no == me->p_no)
             {

Index: makefile
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- makefile	14 Apr 2006 12:24:00 -0000	1.3
+++ makefile	18 Apr 2006 13:41:48 -0000	1.4
@@ -88,7 +88,7 @@
 DEBUGDEFS = -DDEBUG
 !endif
 
-ROBJ            = check.obj colors.obj data.obj death.obj defaults.obj dmessage.obj\
+ROBJ            = beeplite.obj check.obj colors.obj data.obj death.obj defaults.obj dmessage.obj\
                   enter.obj findslot.obj getname.obj getship.obj helpwin.obj hintwin.obj inform.obj\
                   interface.obj newwin.obj option.obj planetlist.obj macrowin.obj\
                   map.obj playerlist.obj ranklist.obj reserved.obj sintab.obj\
@@ -99,7 +99,7 @@
                   docwin.obj feature.obj\
                   string_util.obj local.obj cowmain.obj playback.obj
 
-RSRC            = check.c colors.c data.c death.c defaults.c dmessage.c\
+RSRC            = beeplite.c check.c colors.c data.c death.c defaults.c dmessage.c\
                   enter.c findslot.c getname.c getship.c helpwin.c hintwin.c inform.c\
                   input.c interface.c newwin.c option.c planetlist.c\
                   macrowin.c map.c playerlist.c ranklist.c redraw.c\

Index: option.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/option.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- option.c	15 Apr 2006 11:55:13 -0000	1.4
+++ option.c	18 Apr 2006 13:41:48 -0000	1.5
@@ -349,6 +349,9 @@
     {1, "", &newDashboard, 0, 0, 0, dashboardoptions, NULL},
     {1, "", &timerType, 0, 0, 0, timermess, NULL},
     {1, "keep info %d upds (0=don't remove)", &keepInfo, 0, 0, 0, 0, &keepInfo_range},
+#ifdef BEEPLITE
+    {1, "use RCD highlighting", &useLite, 0, 0, 0, NULL, NULL},
+#endif
     {1, "omit team letter on map", &omitTeamLetter, 0, 0, 0, NULL, NULL},
     {1, "draw view box on map", &viewBox, 0, 0, 0, NULL, NULL},
     {1, "draw stars on local", &showStars, 0, 0, 0, NULL, NULL},

Index: data.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/data.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- data.c	15 Apr 2006 01:04:34 -0000	1.3
+++ data.c	18 Apr 2006 13:41:48 -0000	1.4
@@ -458,6 +458,46 @@
 
 int sizedist = sizeof (dist_defaults);
 
+#ifdef BEEPLITE
+char   *distlite[NUM_DIST] =
+{
+  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+  NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+  NULL, NULL, NULL, NULL, NULL, NULL, NULL
+};
+
+int     defLite = 0;
+int     useLite = 0;
+
+int     emph_planet_seq_n[MAXPLANETS] =
+{0,};
+int     emph_player_seq_n[MAXPLAYER] =
+{0,};
+W_Icon  emph_planet_seq[10];
+W_Icon  emph_player_seq[10];
+W_Icon  emph_player_seql[10];
+int     beep_lite_cycle_time_player = 10;
+int     beep_lite_cycle_time_planet = 10;
+int     liteflag = 0;
+char    F_beeplite_flags = LITE_PLAYERS_MAP |
+LITE_PLAYERS_LOCAL |
+LITE_SELF |
+LITE_PLANETS |
+LITE_SOUNDS |
+LITE_TTS;
+
+int     tts_len = 0;
+int     tts_max_len = 40;
+int     tts_width = 0;
+int     tts_timer = 0;
+int     tts_time = 25;
+int     tts_pos = WINSIDE / 2 - 16;		 /* as found in redraw.c *
+
+						  * 
+						  * * originally */
+char    lastIn[100];
+
+#endif /* BEEPLITE */
 
 #ifdef RCM                      /* Receiver configurable
                                  * Server messages */

Index: feature.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/feature.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- feature.c	21 Jan 2003 21:28:29 -0000	1.1.1.1
+++ feature.c	18 Apr 2006 13:41:48 -0000	1.2
@@ -81,6 +81,10 @@
     {"DEAD_WARP", &F_dead_warp, 'S', 1, 0, 0},
 #endif
 
+#ifdef BEEPLITE
+    {"BEEPLITE", &_dummy, 'C', 1, &F_beeplite_flags, 0},
+#endif
+
 #ifdef RECORDGAME
     {"MANY_SELF", &F_many_self, 'S', 0, 0, 0},
 #endif
@@ -166,6 +170,81 @@
         reportFeatures ();
     if ((strcmpi (packet->name, "RC_DISTRESS") == 0) && gen_distress)
         distmacro = dist_prefered;
+
+#ifdef BEEPLITE
+    if ((strcmpi(packet->name, "BEEPLITE") == 0))
+    {
+        switch (value)
+	{
+	case -1:				 /* Unknown, we can use all * 
+						  * 
+						  * * of the features! */
+
+#ifdef STABLE
+	    /* Stable release is absolutely non borgish */
+	    F_beeplite_flags =
+	        LITE_SOUNDS |
+	        LITE_TTS;
+#else
+	    F_beeplite_flags = LITE_PLAYERS_MAP |
+	        LITE_PLAYERS_LOCAL |
+	        LITE_SELF |
+	        LITE_PLANETS |
+	        LITE_SOUNDS |
+	        LITE_COLOR |
+	        LITE_TTS;
+#endif
+
+	    break;
+	case 1:
+	    if (F_beeplite_flags == 0)
+	    {					 /* Server says we can have * 
+						  * 
+						  * * beeplite, but no * *
+						  * options??? must be * *
+						  * configured wrong. */
+	        F_beeplite_flags = LITE_PLAYERS_MAP |
+		    LITE_PLAYERS_LOCAL |
+		    LITE_SELF |
+		    LITE_PLANETS |
+		    LITE_SOUNDS |
+		    LITE_COLOR |
+		    LITE_TTS;
+	    }
+	    strcpy(buf, "  disabled:");
+	    if (!(F_beeplite_flags & LITE_PLAYERS_MAP))
+	        strcat(buf, " LITE_PLAYERS_MAP");
+	    if (!(F_beeplite_flags & LITE_PLAYERS_LOCAL))
+	        strcat(buf, " LITE_PLAYERS_LOCAL");
+	    if (!(F_beeplite_flags & LITE_SELF))
+	        strcat(buf, " LITE_SELF");
+	    if (!(F_beeplite_flags & LITE_PLANETS))
+	        strcat(buf, " LITE_PLANETS");
+	    if (!(F_beeplite_flags & LITE_SOUNDS))
+	        strcat(buf, " LITE_SOUNDS\n");
+	    if (!(F_beeplite_flags & LITE_COLOR))
+	        strcat(buf, " LITE_COLOR");
+	    if (!(F_beeplite_flags & LITE_TTS))
+	        strcat(buf, " LITE_TTS");
+
+	    if (strcmp(buf, "  disabled:"))
+	    {
+
+#ifdef TOOLS
+	        W_WriteText(toolsWin, 0, 0, textColor, buf, strlen(buf), W_RegularFont);
+#else
+	        printf("%s\n", buf);
+#endif
+	    }
+	    break;
+	case 0:
+	    F_beeplite_flags = 0;
+	    break;
+	default:
+	    break;
+	}
+    }
+#endif /* BEEPLITE */
 }
 
 /******************************************************************************/

Index: map.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- map.c	12 Apr 2006 04:20:03 -0000	1.2
+++ map.c	18 Apr 2006 13:41:48 -0000	1.3
@@ -331,12 +331,38 @@
 
 
         /* Draw the new planet */
+        
+#ifdef BEEPLITE
+        if (useLite && emph_planet_seq_n[l->pl_no] > 0)
+	{
+	    int     seq_n = emph_planet_seq_n[l->pl_no] % emph_planet_seq_frames;
+
+	    W_OverlayBitmap(dx - (emph_planet_seq_width / 2 + 1),
+			    dy - (emph_planet_seq_height / 2),
+			    emph_planet_seq[seq_n],
+			    W_White);
+
+	    W_WriteBitmap(dx - (BMP_MPLANET_WIDTH / 2), dy - (BMP_MPLANET_HEIGHT / 2),
+			    planetmBitmap(l), planetColor(l));
+
+	    emph_planet_seq_n[l->pl_no] -= 1;
+	    l->pl_flags |= PLREDRAW;		 /* Leave redraw on until * * 
+						  * done highlighting */
+	    l->pl_flags |= PLCLEAR;		 /* Leave redraw on until * * 
+						  * done highlighting */
+	}
+        else
+	{
+#endif
         W_OverlayBitmap (dx - (BMP_MPLANET_WIDTH / 2),
                          dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
                          planetColor (l));
         /*W_OverlayBitmapDB (mapSDB, dx - (BMP_MPLANET_WIDTH / 2),
                            dy - (BMP_MPLANET_HEIGHT / 2), planetmBitmap (l),
                            planetColor (l));*/
+#ifdef BEEPLITE
+	}
+#endif
 
         if (l->pl_flags & PLAGRI)
         {
@@ -743,17 +769,43 @@
                                j->p_mapchars, 2, shipFont (j));*/
         }
 
+#ifdef BEEPLITE
+        if ((useLite && emph_player_seq_n[i] > 0)
+	  && (liteflag & LITE_PLAYERS_MAP))
+	{
+	    int     seq_n = emph_player_seq_n[i] % emph_player_seq_frames;
 
-        mclearzone[0][i] = dx - W_Textwidth;
-        mclearzone[1][i] = dy - W_Textheight / 2;
-        mclearzone[2][i] = W_Textwidth * 2;
-        mclearzone[3][i] = W_Textheight;
+	    W_WriteBitmap(dx - (emph_player_seq_width / 2 - 1),
+			  dy - (emph_player_seq_height / 2 + 1),
+			  emph_player_seq[seq_n],
+			  W_White);
+	    emph_player_seq_n[i] -= 1;
+	    mclearzone[0][i] = dx - (emph_player_seq_width / 2 - 1);
+	    mclearzone[1][i] = dy - (emph_player_seq_height / 2 + 1);
+	    mclearzone[2][i] = emph_player_seq_width;
+	    mclearzone[3][i] = emph_player_seq_height;
+	    mclearzone[4][i] = j->p_x;
+	    mclearzone[5][i] = j->p_y;
 
-        /* Set these so we can checkRedraw() next time */
-        mclearzone[4][i] = j->p_x;
-        mclearzone[5][i] = j->p_y;
-        redrawPlayer[i] = 0;
+	    /* Leave redraw on until done highlighting */
+	    redrawPlayer[i] = 1;
+	}
+        else
+	{
+#endif
+	    mclearzone[0][i] = dx - W_Textwidth;
+	    mclearzone[1][i] = dy - W_Textheight / 2;
+	    mclearzone[2][i] = W_Textwidth * 2;
+	    mclearzone[3][i] = W_Textheight;
 
+	    /* Set these so we can checkRedraw() next time */
+	    mclearzone[4][i] = j->p_x;
+	    mclearzone[5][i] = j->p_y;
+	    redrawPlayer[i] = 0;
+
+#ifdef BEEPLITE
+	}
+#endif
     }
 
     /* Draw the lock symbol (if needed) */

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- defaults.c	15 Apr 2006 01:04:34 -0000	1.3
+++ defaults.c	18 Apr 2006 13:41:48 -0000	1.4
@@ -82,12 +82,6 @@
             NULL
         }
     },
-    {"dynamicBitmaps", &dynamicBitmaps, RC_BOOL,
-    	{
-    	    "Allow switching of ship bitmaps in game",
-    	    NULL
-    	}
-    },
 #ifdef JUBILEE_PHASERS
     {"colorfulPhasers", &colorfulPhasers, RC_BOOL,
         {
@@ -123,6 +117,12 @@
             NULL
         }
     },
+    {"dynamicBitmaps", &dynamicBitmaps, RC_BOOL,
+    	{
+    	    "Allow switching of ship bitmaps in game",
+    	    NULL
+    	}
+    },
     {"enemyPhasers", &enemyPhasers, RC_INT,
         {
             "Angle between enemy phaser lines",
@@ -624,6 +624,20 @@
             NULL
         }
     },
+#ifdef BEEPLITE
+    {"useLite", &useLite, RC_BOOL,
+        {
+            "Use beeplite",
+            NULL
+        }
+    },
+    {"defLite", &defLite, RC_BOOL,
+        {
+            "Use default beeplite settings",
+            NULL
+        }
+    },
+#endif 
 #ifdef RSA
     {"useRsa", &useRsa, RC_BOOL,
         {
@@ -927,6 +941,29 @@
             }
         }
 
+#ifdef BEEPLITE
+        else if (strncasecmp(file, "lite.", 5) == 0)
+	{
+	    int     offset = 5;
+	    char  **lt;
+
+	    if (file[6] == '.')
+	        offset = 7;
+
+	    notdone = 1;
+
+	    for (lt = &distlite[take], dm = &dist_prefered[take],
+	       dm_def = &dist_defaults[take];
+	       dm->name && notdone; dm++, dm_def++, lt++)
+	    {
+	        if (strcmpi(file + offset, dm->name) == 0)
+		{
+		    *lt = strdup(v);
+		    notdone = 0;
+		}
+	    }
+        }
+#endif /* BEEPLITE */
 
 #ifdef RCM
         else if (strncmpi (file, "msg.", 4) == 0)
@@ -1468,6 +1505,23 @@
     portSwap = booleanDefault ("portSwap", TRUE);
 #endif
 
+#ifdef BEEPLITE
+    defLite = booleanDefault("defLite", defLite);
+    useLite = booleanDefault("useLite", useLite);
+	
+    if (defLite)
+	litedefaults();
+	
+    beep_lite_cycle_time_planet =
+	intDefault("planetCycleTime", beep_lite_cycle_time_planet);
+    beep_lite_cycle_time_player =
+	intDefault("playerCycleTime", beep_lite_cycle_time_player);
+	
+    tts_time = intDefault("tts_time", tts_time);
+    tts_max_len = intDefault("tts_max_len", tts_max_len);
+    tts_pos = intDefault("tts_pos", tts_pos);
+#endif /* BEEPLITE */
+
     shipdefaults[DEFAULTSHIP].keymap = (unsigned char *) stringDefault ("keymap");
     shipdefaults[DEFAULTSHIP].buttonmap = (unsigned char *) stringDefault ("buttonmap");
     shipdefaults[DEFAULTSHIP].ckeymap = (unsigned char *) stringDefault ("ckeymap");