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

Modified Files:
	beeplite.c local.c mswindow.c redraw.c sound.c 
Log Message:
Fixed beeplite TTS with detcircle and doublebuffering, at the same time rewriting the text messaging code to display and clear text in a more intelligent fashion
Fixed beeplite sounds with newSound

Index: redraw.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/redraw.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- redraw.c	18 May 2006 07:15:35 -0000	1.7
+++ redraw.c	3 Jun 2006 07:03:42 -0000	1.8
@@ -104,31 +104,6 @@
         W_ClearArea (warnw, 5, 5, W_Textwidth * warncount, W_Textheight);
         warncount = 0;
     }
-    
-#ifdef BEEPLITE
-    if (tts_timer)
-    {
-        tts_timer--;
-        if (!tts_timer)
-	{
-	    /* timed out */
-	    W_EraseTTSText(w, last_tts_xpos, tts_ypos, last_tts_width);
-	    last_tts_width = 0;
-	}
-        else if (tts_timer == tts_time - 1 && last_tts_width)
-	{
-	    /* first draw -- erase previous */
-	    W_EraseTTSText(w, last_tts_xpos, tts_ypos, last_tts_width);
-	    /* draw new */
-	    W_WriteTTSText(w, WINSIDE, tts_ypos, lastIn, tts_len);
-	}
-        else
-	{
-	    /* regular draw */
-	    W_WriteTTSText(w, WINSIDE, tts_ypos, lastIn, tts_len);
-	}
-    }
-#endif
 
     local ();                   /* redraw local window */
 

Index: beeplite.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/beeplite.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- beeplite.c	28 May 2006 23:05:12 -0000	1.9
+++ beeplite.c	3 Jun 2006 07:03:42 -0000	1.10
@@ -204,49 +204,89 @@
 		}
 	        break;
 
-/* The sound files don't even exist in standard client, and
-   are not loaded into SDL library currently - can change at
-   a later time. */
+/* SDL sounds sent to default (MESSAGE_WAV) for sounds not in client yet */
 #ifdef SOUND
-            if (!newSound)
-            {
 	    case '1':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-		  Play_Sound(MESSAGE1_SOUND);
+	        {
+	          if (newSound)
+	            Play_Sound(MESSAGE1_WAV);
+	          else
+		    Play_Sound(MESSAGE1_SOUND);
+		}
 	        break;
 	    case '2':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-		  Play_Sound(MESSAGE2_SOUND);
+	        {
+	          if (newSound)
+	            Play_Sound(MESSAGE2_WAV);
+	          else
+		    Play_Sound(MESSAGE2_SOUND);
+		}
 	        break;
 	    case '3':
   	        if (F_beeplite_flags & LITE_SOUNDS)
-	  	  Play_Sound(MESSAGE3_SOUND);
+  	        {
+	          if (newSound)
+	            Play_Sound(MESSAGE_WAV);
+	          else
+		    Play_Sound(MESSAGE3_SOUND);
+		}
 	        break;
 	    case '4':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-		  Play_Sound(MESSAGE4_SOUND);
+	        {
+	          if (newSound)
+	            Play_Sound(MESSAGE_WAV);
+	          else
+		    Play_Sound(MESSAGE4_SOUND);
+		}
 	        break;
 	    case '5':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-		  Play_Sound(MESSAGE5_SOUND);
+	        {
+	          if (newSound)
+	            Play_Sound(MESSAGE_WAV);
+	          else
+		    Play_Sound(MESSAGE5_SOUND);
+		}
 	        break;
 	    case '6':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-		  Play_Sound(MESSAGE6_SOUND);
+	        {
+	          if (newSound)
+	            Play_Sound(MESSAGE_WAV);
+	          else
+		    Play_Sound(MESSAGE6_SOUND);
+		}
 	        break;
 	    case '7':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-		  Play_Sound(MESSAGE7_SOUND);
+	        {
+	          if (newSound)
+	            Play_Sound(MESSAGE_WAV);
+	          else
+		    Play_Sound(MESSAGE7_SOUND);
+		}
 	        break;
 	    case '8':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-		  Play_Sound(MESSAGE8_SOUND);
+	        {
+	          if (newSound)
+	            Play_Sound(MESSAGE_WAV);
+	          else
+		    Play_Sound(MESSAGE8_SOUND);
+		}
 	        break;
 	    case '9':
 	        if (F_beeplite_flags & LITE_SOUNDS)
-		  Play_Sound(MESSAGE9_SOUND);
+	        {
+	          if (newSound)
+	            Play_Sound(MESSAGE_WAV);
+	          else
+		    Play_Sound(MESSAGE9_SOUND);
+		}
 	        break;
-            }
 #endif
 
 	      /* Text between:  /|    |   will be displayed with TTS */

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- local.c	2 Jun 2006 21:06:55 -0000	1.37
+++ local.c	3 Jun 2006 07:03:42 -0000	1.38
@@ -1120,7 +1120,29 @@
                     clearcount++;
                 }
             }
-            
+      
+#ifdef BEEPLITE
+            if (tts_timer)
+            {
+            	tts_timer--;
+            	if (!tts_timer)
+            	{
+            	    /* timed out */
+            	    last_tts_width = 0;
+            	}
+            	else
+            	{
+            	    /* draw */
+            	    W_WriteTTSText(w, WINSIDE, tts_ypos, lastIn, tts_len);
+            	    clearzone[0][clearcount] = last_tts_xpos;
+                    clearzone[1][clearcount] = tts_ypos - W_Textheight;
+                    clearzone[2][clearcount] = last_tts_width;
+                    clearzone[3][clearcount] = W_Textheight;
+                    clearcount++;
+                }
+            }
+#endif
+
             if (j->p_flags & PFCLOAK)   /* when cloaked stop here */
                 continue;
 

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- mswindow.c	2 Jun 2006 21:06:55 -0000	1.30
+++ mswindow.c	3 Jun 2006 07:03:42 -0000	1.31
@@ -711,7 +711,7 @@
 #endif
 
     //Register our class
-	wc.cbSize = sizeof(WNDCLASSEX);
+    wc.cbSize = sizeof(WNDCLASSEX);
     wc.style = CS_NOCLOSE | CS_HREDRAW | CS_VREDRAW;    //Don't allow them to close windows 
     wc.lpfnWndProc = NetrekWndProc;
     wc.cbClsExtra = 0;
@@ -5278,26 +5278,17 @@
 }
 
 #ifdef BEEPLITE
-void W_EraseTTSText(W_Window window, int last_tts_xpos, int tts_ypos, int last_tts_width)
-{
-    tts_ypos -= W_Textheight;
 
-    last_tts_xpos -= 3;
-    last_tts_width += 3;
-
-    W_ClearArea(window, last_tts_xpos, tts_ypos, last_tts_width, W_Textheight);
-}
-
-void W_WriteTTSText(W_Window window, int max_width, int tts_ypos, char *str, int len)
+void W_WriteTTSText(W_Window window, int max_width, int y, char *str, int len)
 {
     register int x;
-    HDC hdc;
+    register int border;
     SIZE ext;
-    FNHEADER_VOID;
-
-    tts_ypos -= W_Textheight;
+    DBHEADER_VOID;
 
-    hdc = GetDC(win->hwnd);
+    y -= W_Textheight;
+    border = win->border;
+    
     if (NetrekPalette)
     {
         SelectPalette(hdc, NetrekPalette, FALSE);
@@ -5306,14 +5297,18 @@
   
     SetTextColor(hdc, colortable[GREY].rgb);
     SetBkMode(hdc, TRANSPARENT);
+    SelectObject (hdc, (HFONT) W_HighlightFont);
     GetTextExtentPoint32 (hdc, str, len, &ext);
     x = (max_width - ext.cx)/2; 
-    if (x < 0)
-        x = 4;
-    TextOut(hdc, x, tts_ypos, str, len);
-    ReleaseDC(win->hwnd, hdc);
-    last_tts_xpos = x;
+    x += border;
+    y += border;
+
+    ExtTextOut (hdc, x, y, ETO_CLIPPED | ETO_OPAQUE, NULL, str, len, NULL);
+    last_tts_xpos = x - border;
     last_tts_width = ext.cx;
+
+    if (!sdb || !doubleBuffering || !ingame)
+        ReleaseDC (win->hwnd, hdc);
 }
 #endif
 

Index: sound.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/sound.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- sound.c	29 May 2006 23:59:53 -0000	1.14
+++ sound.c	3 Jun 2006 07:03:42 -0000	1.15
@@ -111,6 +111,8 @@
   newsounds[OTHER_FIRE_TORP_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_torp_other.wav"));
   newsounds[INTRO_WAV] = Mix_LoadWAV(DATAFILE("nt_intro.wav"));
   newsounds[MESSAGE_WAV] = Mix_LoadWAV(DATAFILE("nt_message.wav"));
+  newsounds[MESSAGE1_WAV] = Mix_LoadWAV(DATAFILE("nt_message1.wav"));
+  newsounds[MESSAGE2_WAV] = Mix_LoadWAV(DATAFILE("nt_message2.wav"));
   newsounds[PHASER_WAV] = Mix_LoadWAV(DATAFILE("nt_phaser.wav"));
   newsounds[PHASER_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_phaser_other.wav"));
   newsounds[PLASMA_HIT_WAV] = Mix_LoadWAV(DATAFILE("nt_plasma_hit.wav"));