*** client.c	Wed Jan 28 09:55:14 1998
--- client.c_new	Thu Feb 19 23:59:35 1998
***************
*** 1001,1006 ****
--- 1001,1010 ----
  	    other->war_id = -1;
  	    scoresChanged = 1;
  	}
+ 	if (other->snoop_id == id) {
+ 	    other->snoop_id = -1;
+ 	    scoresChanged = 1;
+ 	}
      }
      return 0;
  }
***************
*** 1055,1060 ****
--- 1059,1065 ----
      other->life = 0;
      other->mychar = mychar;
      other->war_id = -1;
+     other->snoop_id = -1;
      other->name_width = 0;
      strncpy(other->name, player_name, sizeof(other->name));
      other->name[sizeof(other->name) - 1] = '\0';
***************
*** 1100,1105 ****
--- 1105,1146 ----
      return 0;
  }
  
+ int Handle_snoop(int snooper_id, int snooped_id)
+ {
+     other_t             *snooper,
+                         *snooped;
+     char                msg[MSG_LEN];
+ 
+     if ((snooper = Other_by_id(snooper_id)) == NULL) {
+         errno = 0;
+         IFNWINDOWS(error("Can't update snoop for non-existing player (%d,%d)",
+ 		snooper_id, snooped_id);)
+         return 0;
+     }
+     if (snooped_id == -1) {
+         /*
+          * Snooped is no longer snooped.
+          */
+         snooper->snoop_id = -1;
+ 	/* flush-it! */
+ 	scoresChanged = 1;
+         return 0;
+     }
+     if ((snooped = Other_by_id(snooped_id)) == NULL) {
+         errno = 0;
+         IFNWINDOWS(error("Can't update snoop against non-existing player
+ 		(%d,%d)", snooper_id, snooped_id);)
+         return 0;
+     }
+     snooper->snoop_id= snooped_id;
+     sprintf(msg, "%s declares snooping on %s.", snooper->name, snooped->name);
+     Add_message(msg);
+     scoresChanged = 1;
+ 
+     return 0;
+ }
+ 
+ 
  int Handle_seek(int programmer_id, int robot_id, int sought_id)
  {
      other_t		*programmer,
***************
*** 1337,1342 ****
--- 1378,1384 ----
  	    tmp.id = -1;
  	    tmp.team = team_order[i] - &team[0];
  	    tmp.war_id = -1;
+ 	    tmp.snoop_id = -1;
  	    tmp.name_width = 0;
  	    tmp.ship = NULL;
  	    sprintf(tmp.name, "Team %d", tmp.team);
*** client.h	Tue Jan 27 12:38:58 1998
--- client.h_new	Thu Feb 19 23:59:35 1998
***************
*** 102,107 ****
--- 102,108 ----
      short	life;
      short	mychar;
      short	war_id;
+     short	snoop_id;
      short	name_width;	/* In pixels */
      short	name_len;	/* In bytes */
      wireobj	*ship;
***************
*** 265,270 ****
--- 266,272 ----
  int Handle_score_object(int score, int x, int y, char *msg);
  int Handle_timing(int id, int check, int round);
  int Handle_war(int robot_id, int killer_id);
+ int Handle_snoop(int snooper_id, int snooped_id);
  int Handle_seek(int programmer_id, int robot_id, int sought_id);
  void Map_dots(void);
  void Map_restore(int startx, int starty, int width, int height);
*** default.c	Wed Jan 28 09:55:14 1998
--- default.c_new	Thu Feb 19 23:59:37 1998
***************
*** 1115,1120 ****
--- 1115,1134 ----
  	"Detonate the mine you have dropped or thrown, which is closest to you.\n"
      },
      {
+         "keySnoop",
+         NULL,
+         "KP_1",
+         KEY_SNOOP,
+         "snoop the locked player, i.e. look through other eyes.\n"
+     },
+     {
+         "keyUnsnoop",
+         NULL,
+         "KP_3",
+         KEY_UNSNOOP,
+         "switch off snooping.\n"
+     },
+     {
  	"keyLockClose",
  	NULL,
  	"Select Up",
*** global.h	Tue Jan 27 12:38:58 1998
--- global.h_new	Thu Feb 19 23:59:39 1998
***************
*** 200,205 ****
--- 200,207 ----
  extern int		maxOffensiveItems;
  extern int		maxDefensiveItems;
  
+ extern bool		allow_snooping;
+ 
  extern bool		pLockServer;
  
  #endif
*** keys.h	Tue Jan 27 12:38:59 1998
--- keys.h_new	Thu Feb 19 23:59:40 1998
***************
*** 86,92 ****
      KEY_LOAD_MODIFIERS_3,					/* 50 */
      KEY_LOAD_MODIFIERS_4,
      KEY_SELECT_ITEM,		/* Was KEY_TOGGLE_OWNED_ITEMS up to 3.2.5 */
!     KEY_UNUSED_53,		/* Was KEY_TOGGLE_MESSAGES up to 3.2.5 */
      KEY_REPAIR,
      KEY_TOGGLE_IMPLOSION,
      KEY_REPROGRAM,
--- 86,93 ----
      KEY_LOAD_MODIFIERS_3,					/* 50 */
      KEY_LOAD_MODIFIERS_4,
      KEY_SELECT_ITEM,		/* Was KEY_TOGGLE_OWNED_ITEMS up to 3.2.5 */
!     KEY_SNOOP,			/* Was KEY_TOGGLE_MESSAGES up to 3.2.5 */
! 				/* Was KEY_UNUSED_53 up to 3.7.1 */
      KEY_REPAIR,
      KEY_TOGGLE_IMPLOSION,
      KEY_REPROGRAM,
***************
*** 95,101 ****
      KEY_LOAD_LOCK_3,
      KEY_LOAD_LOCK_4,						/* 60 */
      KEY_EMERGENCY_SHIELD,
!     KEY_UNUSED_62,		/* Was KEY_POINTER_CONTROL up to 3.2.5 */
      KEY_DETONATE_MINES,
      NUM_KEYS		/* The number of different keys_t */
  #ifndef SERVER
--- 96,103 ----
      KEY_LOAD_LOCK_3,
      KEY_LOAD_LOCK_4,						/* 60 */
      KEY_EMERGENCY_SHIELD,
!     KEY_UNSNOOP,		/* Was KEY_POINTER_CONTROL up to 3.2.5 */
! 				/* Was KEY_UNUSED_62 up to 3.7.1 */
      KEY_DETONATE_MINES,
      NUM_KEYS		/* The number of different keys_t */
  #ifndef SERVER
*** netclient.c	Wed Jan 28 09:55:14 1998
--- netclient.c_new	Thu Feb 19 23:59:40 1998
***************
*** 183,188 ****
--- 183,189 ----
      reliable_tbl[PKT_TIMING]	= Receive_timing;
      reliable_tbl[PKT_LEAVE]	= Receive_leave;
      reliable_tbl[PKT_WAR]	= Receive_war;
+     reliable_tbl[PKT_SNOOP]	= Receive_snoop;
      reliable_tbl[PKT_SEEK]	= Receive_seek;
      reliable_tbl[PKT_BASE]	= Receive_base;
      reliable_tbl[PKT_QUIT]	= Receive_quit;
***************
*** 1825,1830 ****
--- 1826,1848 ----
      }
      return 1;
  }
+ 
+ int Receive_snoop(void)
+ {
+     int                 n;
+     short               snooper_id, snooped_id;
+     u_byte              ch;
+ 
+     if ((n = Packet_scanf(&cbuf, "%c%hd%hd",
+                           &ch, &snooper_id, &snooped_id)) <= 0) {
+         return n;
+     }
+     if ((n = Handle_snoop(snooper_id, snooped_id)) == -1) {
+         return -1;
+     }
+     return 1;
+ }
+ 
  
  int Receive_seek(void)
  {
*** netclient.h	Tue Jan 27 12:38:59 1998
--- netclient.h_new	Thu Feb 19 23:59:41 1998
***************
*** 73,78 ****
--- 73,79 ----
  int Receive_damaged(void);
  int Receive_leave(void);
  int Receive_war(void);
+ int Receive_snoop(void);
  int Receive_seek(void);
  int Receive_player(void);
  int Receive_score(void);
*** object.h	Tue Jan 27 12:38:59 1998
--- object.h_new	Thu Feb 19 23:59:43 1998
***************
*** 367,372 ****
--- 367,374 ----
  
      char	mychar;			/* Special char for player */
      char	prev_mychar;		/* Special char for player */
+     int		snoop;			/* id of snooped player */
+     int		prev_snoop;		/* id of snooped player */
      char	name[MAX_CHARS];	/* Nick-name of player */
      char	realname[MAX_CHARS];	/* Real name of player */
      char	hostname[MAX_CHARS];	/* Hostname of client player uses */
*** packet.h	Tue Jan 27 12:38:59 1998
--- packet.h_new	Thu Feb 19 23:59:44 1998
***************
*** 62,68 ****
  #define PKT_TARGET		23
  #define PKT_KEYBOARD		24
  #define PKT_SEEK		25
! #define PKT_NOT_USED_26		26
  #define PKT_NOT_USED_27		27	/* was PKT_SEND_BUFSIZE */
  #define PKT_PLAYER		28
  #define PKT_SCORE		29
--- 62,68 ----
  #define PKT_TARGET		23
  #define PKT_KEYBOARD		24
  #define PKT_SEEK		25
! #define PKT_SNOOP		26	/* was unused */
  #define PKT_NOT_USED_27		27	/* was PKT_SEND_BUFSIZE */
  #define PKT_PLAYER		28
  #define PKT_SCORE		29
*** paint.c	Tue Jan 27 12:38:59 1998
--- paint.c_new	Thu Feb 19 23:59:44 1998
***************
*** 451,456 ****
--- 451,457 ----
  	sprintf(label, "%s=%s@%s", other->name, other->real, other->host);
      } else {
  	other_t*	war = Other_by_id(other->war_id);
+ 	other_t*	snoop = Other_by_id(other->snoop_id);
  
  	if (BIT(Setup->mode, TIMING)) {
  	    raceStr[0] = ' ';
***************
*** 479,484 ****
--- 480,489 ----
  	    sprintf(label, "%c %s%s%5d%s  %s (%s)",
  		    other->mychar, raceStr, teamStr, other->score, lifeStr,
  		    other->name, war->name);
+ 	} else if (snoop) {
+ 	    sprintf(label, "%c %s%s%5d%s  %s [%s]",
+ 		    other->mychar, raceStr, teamStr, other->score, lifeStr,
+ 		    other->name, snoop->name);
  	} else {
  	    sprintf(label, "%c %s%s%5d%s  %s",
  		    other->mychar, raceStr, teamStr, other->score, lifeStr,
*** player.c	Tue Jan 27 12:38:59 1998
--- player.c_new	Thu Feb 19 23:59:45 1998
***************
*** 318,324 ****
      bool		too_late = false;
      int			i;
  
- 
      pl->vel.x	= pl->vel.y	= 0.0;
      pl->acc.x	= pl->acc.y	= 0.0;
      pl->float_dir = pl->dir	= DIR_UP;
--- 318,323 ----
***************
*** 420,425 ****
--- 419,428 ----
      pl->prev_life	= pl->life;
      pl->ball 		= NULL;
  
+     pl->snoop		= -1;
+     pl->prev_snoop	= pl->snoop;
+ 
+ 
      pl->player_fps	= FPS;
      pl->player_round	= 0;
      pl->player_count	= 0;
***************
*** 1559,1564 ****
--- 1562,1578 ----
  
      if (IS_ROBOT_PTR(pl))
  	NumRobots--;
+ 
+     for (i = NumPlayers ; i >= 0; i--) {
+ 	/*
+ 	 * is any human snooping the leaving one?
+ 	 */
+         if ( IS_HUMAN_IND(i) ){
+                 if ( GetInd[Players[i]->snoop] == ind ){
+                         Players[i]->snoop = -1;
+                 }
+         }
+     }
  
      /*
       * Swap entry no 'ind' with the last one.
*** proto.h	Tue Jan 27 12:38:59 1998
--- proto.h_new	Thu Feb 19 23:59:46 1998
***************
*** 239,244 ****
--- 239,246 ----
  void Frame_update(void);
  void Set_message(const char *message);
  void Set_player_message(player *pl, char *message);
+ void Declare_snoop(int snooper_id, int snooped_id);
+ 
  
  /*
   * Prototypes for update.c
