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

Modified Files:
	beeplite.c local.c map.c sound.c 
Log Message:
 2 new sounds for enter/exiting transwarp, and observer support for hearing these as well
Fixed beeplite observer bug
Fixed up viewbox so map refreshes properly when toggled

Index: beeplite.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/beeplite.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- beeplite.c	26 Apr 2006 02:04:24 -0000	1.6
+++ beeplite.c	26 Apr 2006 23:18:14 -0000	1.7
@@ -68,7 +68,7 @@
 
 void liteplayer(struct player *j)
 {
-    if (!j || (j->p_flags & PFCLOAK))
+    if (!j || (j->p_flags & PFCLOAK) || (j->p_flags & PFOBSERV))
       return;
 
     redrawPlayer[j->p_no] = 1;

Index: local.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- local.c	26 Apr 2006 15:54:04 -0000	1.10
+++ local.c	26 Apr 2006 23:18:14 -0000	1.11
@@ -56,6 +56,8 @@
 static int new_other_plasma_dist = 0;
 static int other_plasma_angle = 0;
 static int old_pt_fuse = 0;
+static int warpchange = 0;
+static unsigned int twarpflag = 0; 
 #endif
 
 /* Background Stars Definitions */
@@ -467,6 +469,50 @@
         if ((j->p_status != PALIVE) && (j->p_status != PEXPLODE))
             continue;
 
+/* Twarp sounds put up here so observers can hear them */            
+#ifdef SOUND
+
+       /* Have to use me->p_flags because server doesn't send us twarp flag info
+        on other players.  Current Vanilla does not let observer change players
+        if the player they are observing is transwarping. */
+	if (twarpflag != (me->p_flags & PFTWARP))
+	{
+	    /* change in warp state */
+	    warpchange = 1;
+            twarpflag = (me->p_flags & PFTWARP);
+        }
+        
+        if (myPlayer(j) || isObsLockPlayer(j))
+        {     
+                if (warpchange && (j->p_flags & PFTWARP))
+	        {   
+                    
+	    	    if (newSound) // Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3)
+		    {
+		        Mix_HaltGroup(3);
+	                Play_Sound(ENTER_WARP_WAV);
+	            }
+	            else
+	                Play_Sound(ENTER_WARP_SOUND);
+	                
+	            warpchange = 0;
+	
+	        }
+	        if (warpchange && !(j->p_flags & PFTWARP))
+	        { 
+	     	    if (newSound) // Kill any channels with ENTER_WARP_WAV or EXIT_WARP_WAV (group 3)
+		    {
+		        Mix_HaltGroup(3);
+	                Play_Sound(EXIT_WARP_WAV);
+	            }
+	            else
+	                Play_Sound(EXIT_WARP_SOUND);
+	                
+	            warpchange = 0;
+	        }
+        }
+#endif
+
         if (j->p_flags & PFOBSERV)
         {
             /* observer and NOT locked onto a player (ie. locked onto planet or
@@ -2097,12 +2143,8 @@
             W_ChangeBorder (baseWin, gColor);
 
 #if defined(SOUND)
-            if (newSound)
-            {   // Kill any channels with WARNING_WAV on them (group 2)
-                // or RED_ALERT_WAV (group 3)
+            if (newSound) // Kill any channels with WARNING_WAV or RED_ALERT_WAV (group 2)
 		Mix_HaltGroup(2);
-		Mix_HaltGroup(3);
-	    }
             else
             {
                 Abort_Sound(WARNING_SOUND);
@@ -2124,9 +2166,9 @@
 
 #if defined(SOUND)
 
-            if (newSound) // Kill any channels with RED_ALERT_WAV on them (group 3)
+            if (newSound) // Kill any channels with RED_ALERT_WAV (group 2)
             {
-            	Mix_HaltGroup(3);
+            	Mix_HaltGroup(2);
                 Play_Sound(WARNING_WAV);
             }
             else

Index: map.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/map.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- map.c	21 Apr 2006 12:00:07 -0000	1.4
+++ map.c	26 Apr 2006 23:18:14 -0000	1.5
@@ -549,6 +549,7 @@
 
     static int viewx = 0, viewy = 0;
     static char clearviewbox = 0;
+    static char viewboxcleared = 0;
     int viewdist = (WINSIDE / 2 * SCALE) / (GWIDTH / WINSIDE);
     int view = WINSIDE * SCALE / 2;
     int mvx, mvy;
@@ -577,6 +578,7 @@
         //W_ClearWindowDB (mapSDB);
         clearlock = 0;
         clearviewbox = 0;
+        viewboxcleared = 0;
 
         for (i = 0; i < MAXPLAYER; i++)
         {
@@ -603,41 +605,29 @@
 
         if (clearviewbox)
         {
-            if (viewBox)
-            {
-                if (viewx != dx || viewy != dy)
-                {
-                    /* clear old dots - placed here for less flicker */
-                    if (viewx + viewdist < WINSIDE && viewy + viewdist < WINSIDE)
-                        W_MakePoint (mapw, viewx + viewdist, viewy + viewdist, backColor);
-                        /*W_MakeLine (mapw, viewx + viewdist, viewy + viewdist,
-                                    viewx - viewdist, viewy + viewdist, backColor);*/
-                        //W_MakePointDB (mapSDB, viewx + viewdist, viewy + viewdist, backColor);
-                    if (viewx + viewdist < WINSIDE && viewy - viewdist > 0)
-                        W_MakePoint (mapw, viewx + viewdist, viewy - viewdist, backColor);
-                        /*W_MakeLine (mapw, viewx + viewdist, viewy - viewdist,
-                                    viewx + viewdist, viewy + viewdist, backColor);*/
-                        //W_MakePointDB (mapSDB, viewx + viewdist, viewy - viewdist, backColor);
-                    if (viewx - viewdist > 0 && viewy + viewdist < WINSIDE)
-                        W_MakePoint (mapw, viewx - viewdist, viewy + viewdist, backColor);
-                        /*W_MakeLine (mapw, viewx - viewdist, viewy + viewdist,
-                                    viewx - viewdist, viewy - viewdist, backColor);*/
-                        //W_MakePointDB (mapSDB, viewx - viewdist, viewy + viewdist, backColor);
-                    if (viewx - viewdist > 0 && viewy - viewdist > 0)
-                        W_MakePoint (mapw, viewx - viewdist, viewy - viewdist, backColor);
-                        /*W_MakeLine (mapw, viewx - viewdist, viewy - viewdist,
-                                    viewx + viewdist, viewy - viewdist, backColor);*/
-                        //W_MakePointDB (mapSDB, viewx - viewdist, viewy - viewdist, backColor);
+            clearviewbox = 0;
+            /* clear old dots - placed here for less flicker */
+            if (viewx + viewdist < WINSIDE && viewy + viewdist < WINSIDE)
+                  W_MakePoint (mapw, viewx + viewdist, viewy + viewdist, backColor);
+                   
+            if (viewx + viewdist < WINSIDE && viewy - viewdist > 0)
+                  W_MakePoint (mapw, viewx + viewdist, viewy - viewdist, backColor);
 
-                    /* redraw any planets they overwrote */
-                    mvx = viewx * (GWIDTH / WINSIDE); /* correct from view scale */
-                    mvy = viewy * (GWIDTH / WINSIDE);
-                    checkRedraw(mvx + view, mvy + view);
-                    checkRedraw(mvx + view, mvy - view);
-                    checkRedraw(mvx - view, mvy + view);
-                    checkRedraw(mvx - view, mvy - view);
-                }
-            }
+            if (viewx - viewdist > 0 && viewy + viewdist < WINSIDE)
+                  W_MakePoint (mapw, viewx - viewdist, viewy + viewdist, backColor);
+
+            if (viewx - viewdist > 0 && viewy - viewdist > 0)
+                  W_MakePoint (mapw, viewx - viewdist, viewy - viewdist, backColor);
+
+
+            /* redraw any planets they overwrote */
+            mvx = viewx * (GWIDTH / WINSIDE); /* correct from view scale */
+            mvy = viewy * (GWIDTH / WINSIDE);
+            checkRedraw(mvx + view, mvy + view);
+            checkRedraw(mvx + view, mvy - view);
+            checkRedraw(mvx - view, mvy + view);
+            checkRedraw(mvx - view, mvy - view);
+            viewboxcleared = 1;
         }
 
         /* Erase the ships */
@@ -691,7 +681,7 @@
     /* draw viewBox */
     if (viewBox)
     {
-        if (viewx != dx || viewy != dy)
+        if (viewboxcleared || viewx != dx || viewy != dy)
         {
             /* draw the new points */
             if (dx + viewdist < WINSIDE && dy + viewdist < WINSIDE)

Index: sound.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/sound.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sound.c	26 Apr 2006 15:54:04 -0000	1.6
+++ sound.c	26 Apr 2006 23:18:14 -0000	1.7
@@ -58,6 +58,8 @@
     {"nt_enter_ship", 4, 1},
     {"nt_self_destruct", 6, 1},
     {"nt_plasma_hit", 8, 1},
+    {"nt_enter_warp", 4, 1},
+    {"nt_exit_warp", 4, 1},
     {"nt_message", 4, 1},
     {"nt_message1", 4, 1},
     {"nt_message2", 4, 1},
@@ -95,6 +97,8 @@
   newsounds[CLOAKED_WAV] = Mix_LoadWAV(DATAFILE("nt_cloaked.wav"));
   newsounds[ENGINE_WAV] = Mix_LoadWAV(DATAFILE("nt_engine.wav"));
   newsounds[ENTER_SHIP_WAV] = Mix_LoadWAV(DATAFILE("nt_enter_ship.wav"));
+  newsounds[ENTER_WARP_WAV] = Mix_LoadWAV(DATAFILE("nt_enter_warp.wav"));
+  newsounds[EXIT_WARP_WAV] = Mix_LoadWAV(DATAFILE("nt_exit_warp.wav"));
   newsounds[EXPLOSION_WAV] = Mix_LoadWAV(DATAFILE("nt_explosion.wav"));
   newsounds[EXPLOSION_OTHER_WAV] = Mix_LoadWAV(DATAFILE("nt_explosion_other.wav"));
   newsounds[FIRE_PLASMA_WAV] = Mix_LoadWAV(DATAFILE("nt_fire_plasma.wav"));
@@ -290,8 +294,8 @@
     // at a later time
     // Current designations: 
     // group 1 = cloaked_wav
-    // group 2 = warning_wav
-    // group 3 = red_alert_wav
+    // group 2 = warning_wav and red_alert_wav
+    // group 3 = enter_warp_wav and exit_warp_wav
     // group 4 = shield_down_wav and shield_up_wav
     switch(type)
     {
@@ -300,10 +304,12 @@
                 LineToConsole("Mix_GroupChannel: %s\n", Mix_GetError());
             break;
         case WARNING_WAV:
+        case RED_ALERT_WAV:
             if(!Mix_GroupChannel(channel,2))
                 LineToConsole("Mix_GroupChannel: %s\n", Mix_GetError());
             break;
-        case RED_ALERT_WAV:
+        case ENTER_WARP_WAV:
+        case EXIT_WARP_WAV:
             if(!Mix_GroupChannel(channel,3))
                 LineToConsole("Mix_GroupChannel: %s\n", Mix_GetError());
             break;
@@ -380,6 +386,12 @@
         case ENTER_SHIP_SOUND:
             sprintf (buf, "Enter ship sound is %s", flag);
             break;
+        case ENTER_WARP_SOUND:
+            sprintf (buf, "Enter warp sound is %s", flag);
+            break;
+        case EXIT_WARP_SOUND:
+            sprintf (buf, "Exit warp sound is %s", flag);
+            break;
         case EXPLOSION_SOUND:
             sprintf (buf, "Explosion sound is %s", flag);
             break;