Difference for main/multibot.c from version 1.1 to 1.2


version 1.1 version 1.2
Line 81
 
Line 81
 fix robot_last_message_time[MAX_ROBOTS_CONTROLLED];  fix robot_last_message_time[MAX_ROBOTS_CONTROLLED];
 int robot_send_pending[MAX_ROBOTS_CONTROLLED];  int robot_send_pending[MAX_ROBOTS_CONTROLLED];
 int robot_fired[MAX_ROBOTS_CONTROLLED];  int robot_fired[MAX_ROBOTS_CONTROLLED];
 byte robot_fire_buf[MAX_ROBOTS_CONTROLLED][18+3];  sbyte robot_fire_buf[MAX_ROBOTS_CONTROLLED][18+3];
   
 #define MULTI_ROBOT_PRIORITY(objnum, pnum) (((objnum % 4) + pnum) % N_players)  #define MULTI_ROBOT_PRIORITY(objnum, pnum) (((objnum % 4) + pnum) % N_players)
   
Line 349
 
Line 349
   
  multibuf[0] = (char)MULTI_ROBOT_CLAIM;   multibuf[0] = (char)MULTI_ROBOT_CLAIM;
  multibuf[1] = Player_num;   multibuf[1] = Player_num;
  *(short *)(multibuf+2) = (short)objnum_local_to_remote(objnum, (byte *)&multibuf[4]);   *(short *)(multibuf+2) = (short)objnum_local_to_remote(objnum, (sbyte *)&multibuf[4]);
   
  multi_send_data(multibuf, 5, 1);   multi_send_data(multibuf, 5, 1);
 }  }
Line 373
 
Line 373
   
  multibuf[0] = (char)MULTI_ROBOT_RELEASE;   multibuf[0] = (char)MULTI_ROBOT_RELEASE;
  multibuf[1] = Player_num;   multibuf[1] = Player_num;
  *(short *)(multibuf+2) = (short)objnum_local_to_remote(objnum, (byte *)&multibuf[4]);   *(short *)(multibuf+2) = (short)objnum_local_to_remote(objnum, (sbyte *)&multibuf[4]);
   
  multi_send_data(multibuf, 5, 1);   multi_send_data(multibuf, 5, 1);
 }  }
Line 425
 
Line 425
   
  multibuf[loc] = MULTI_ROBOT_POSITION;  loc += 1;   multibuf[loc] = MULTI_ROBOT_POSITION;  loc += 1;
  multibuf[loc] = Player_num; loc += 1;   multibuf[loc] = Player_num; loc += 1;
  *(short *)(multibuf+loc) = (short)objnum_local_to_remote(objnum, (byte *)&multibuf[loc+2]);   *(short *)(multibuf+loc) = (short)objnum_local_to_remote(objnum, (sbyte *)&multibuf[loc+2]);
  loc += 3;   loc += 3;
  create_shortpos((shortpos *)(multibuf+loc), Objects+objnum);   create_shortpos((shortpos *)(multibuf+loc), Objects+objnum);
  loc += sizeof(shortpos);   loc += sizeof(shortpos);
Line 475
 
Line 475
   
  multibuf[loc] = MULTI_ROBOT_FIRE; loc += 1;   multibuf[loc] = MULTI_ROBOT_FIRE; loc += 1;
  multibuf[loc] = Player_num; loc += 1;   multibuf[loc] = Player_num; loc += 1;
  *(short *)(multibuf+loc) = (short)objnum_local_to_remote(objnum, (byte *)&multibuf[loc+2]);   *(short *)(multibuf+loc) = (short)objnum_local_to_remote(objnum, (sbyte *)&multibuf[loc+2]);
  loc += 3;   loc += 3;
  multibuf[loc] = gun_num; loc += 1;   multibuf[loc] = gun_num; loc += 1;
  *(vms_vector *)(multibuf+loc) = *fire; loc += sizeof(vms_vector); // 12   *(vms_vector *)(multibuf+loc) = *fire; loc += sizeof(vms_vector); // 12
Line 505
 
Line 505
   
  multibuf[loc] = MULTI_ROBOT_EXPLODE; loc += 1;   multibuf[loc] = MULTI_ROBOT_EXPLODE; loc += 1;
  multibuf[loc] = Player_num; loc += 1;   multibuf[loc] = Player_num; loc += 1;
  *(short *)(multibuf+loc) = (short)objnum_local_to_remote(killer, (byte *)&multibuf[loc+2]);   *(short *)(multibuf+loc) = (short)objnum_local_to_remote(killer, (sbyte *)&multibuf[loc+2]);
  loc += 3;   loc += 3;
  *(short *)(multibuf+loc) = (short)objnum_local_to_remote(objnum, (byte *)&multibuf[loc+2]);   *(short *)(multibuf+loc) = (short)objnum_local_to_remote(objnum, (sbyte *)&multibuf[loc+2]);
  loc += 3;   loc += 3;
  multi_send_data(multibuf, loc, 1);   multi_send_data(multibuf, loc, 1);
   
Line 523
 
Line 523
   
  multibuf[loc] = MULTI_CREATE_ROBOT; loc += 1;   multibuf[loc] = MULTI_CREATE_ROBOT; loc += 1;
  multibuf[loc] = Player_num; loc += 1;   multibuf[loc] = Player_num; loc += 1;
  multibuf[loc] = (byte)station; loc += 1;   multibuf[loc] = (sbyte)station; loc += 1;
  *(short *)(multibuf+loc) = (short)objnum; loc += 2;   *(short *)(multibuf+loc) = (short)objnum; loc += 2;
  multibuf[loc] = type; loc += 1;   multibuf[loc] = type; loc += 1;
   
Line 542
 
Line 542
  multibuf[loc] = MULTI_BOSS_ACTIONS; loc += 1;   multibuf[loc] = MULTI_BOSS_ACTIONS; loc += 1;
  multibuf[loc] = Player_num; loc += 1; // Which player is controlling the boss   multibuf[loc] = Player_num; loc += 1; // Which player is controlling the boss
  *(short *)(multibuf+loc) = bossobjnum; loc += 2; // We won't network map this objnum since its the boss   *(short *)(multibuf+loc) = bossobjnum; loc += 2; // We won't network map this objnum since its the boss
  multibuf[loc] = (byte)action; loc += 1; // What is the boss doing?   multibuf[loc] = (sbyte)action; loc += 1; // What is the boss doing?
  multibuf[loc] = (byte)secondary; loc += 1; // More info for what he is doing   multibuf[loc] = (sbyte)secondary; loc += 1; // More info for what he is doing
  *(short *)(multibuf+loc) = objnum; loc += 2; // Objnum of object created by gate-in action   *(short *)(multibuf+loc) = objnum; loc += 2; // Objnum of object created by gate-in action
  if (action == 3) {   if (action == 3) {
  *(short *)(multibuf+loc) = Objects[objnum].segnum; loc += 2; // Segment number object created in (for gate only)   *(short *)(multibuf+loc) = Objects[objnum].segnum; loc += 2; // Segment number object created in (for gate only)
Line 612
 
Line 612
  pnum = buf[1];   pnum = buf[1];
   
  remote_botnum = *(short *)(buf+2);   remote_botnum = *(short *)(buf+2);
  botnum = objnum_remote_to_local(remote_botnum, (byte)buf[4]);   botnum = objnum_remote_to_local(remote_botnum, (sbyte)buf[4]);
   
  if ((botnum > Highest_object_index) || (botnum < 0)) {   if ((botnum > Highest_object_index) || (botnum < 0)) {
  mprintf((1, "Ignoring claim message for object I don't have.\n"));   mprintf((1, "Ignoring claim message for object I don't have.\n"));
Line 653
 
Line 653
   
  pnum = buf[1];   pnum = buf[1];
   
  botnum = (objnum_remote_to_local(*(short *)(buf+2), (byte)buf[4]));   botnum = (objnum_remote_to_local(*(short *)(buf+2), (sbyte)buf[4]));
   
  if ((botnum < 0) || (botnum > Highest_object_index)) {   if ((botnum < 0) || (botnum > Highest_object_index)) {
  mprintf((1, "Ignoring release message for object I don't have.\n"));   mprintf((1, "Ignoring release message for object I don't have.\n"));
Line 691
 
Line 691
   
  pnum = buf[loc]; loc += 1;   pnum = buf[loc]; loc += 1;
   
  botnum = objnum_remote_to_local(*(short *)(buf+loc), (byte)buf[loc+2]);   botnum = objnum_remote_to_local(*(short *)(buf+loc), (sbyte)buf[loc+2]);
  loc += 3;   loc += 3;
   
  if ((botnum < 0) || (botnum > Highest_object_index)) {   if ((botnum < 0) || (botnum > Highest_object_index)) {
Line 741
 
Line 741
  robot_info *robptr;   robot_info *robptr;
   
  pnum = buf[loc]; loc += 1;   pnum = buf[loc]; loc += 1;
  botnum = objnum_remote_to_local(*(short *)(buf+loc), (byte)buf[loc+2]);   botnum = objnum_remote_to_local(*(short *)(buf+loc), (sbyte)buf[loc+2]);
  loc += 3;   loc += 3;
  gun_num = (byte)buf[loc]; loc += 1;   gun_num = (sbyte)buf[loc]; loc += 1;
  fire = *(vms_vector *)(buf+loc);    fire = *(vms_vector *)(buf+loc);
   
  if ((botnum < 0) || (botnum > Highest_object_index) || (Objects[botnum].type != OBJ_ROBOT) || (Objects[botnum].flags & OF_EXPLODING))   if ((botnum < 0) || (botnum > Highest_object_index) || (Objects[botnum].type != OBJ_ROBOT) || (Objects[botnum].flags & OF_EXPLODING))
Line 839
 
Line 839
  int rval;   int rval;
   
  pnum = buf[loc]; loc += 1;   pnum = buf[loc]; loc += 1;
  killer = objnum_remote_to_local(*(short *)(buf+loc), (byte)buf[loc+2]);   killer = objnum_remote_to_local(*(short *)(buf+loc), (sbyte)buf[loc+2]);
  loc += 3;   loc += 3;
  botnum = objnum_remote_to_local(*(short *)(buf+loc), (byte)buf[loc+2]);   botnum = objnum_remote_to_local(*(short *)(buf+loc), (sbyte)buf[loc+2]);
  loc += 3;   loc += 3;
   
 // Assert((botnum > -1) && (botnum <= Highest_object_index));  // Assert((botnum > -1) && (botnum <= Highest_object_index));
Line 1142
 
Line 1142
 void multi_robot_request_change(object *robot, int player_num)  void multi_robot_request_change(object *robot, int player_num)
 {  {
  int slot, remote_objnum;   int slot, remote_objnum;
  byte dummy;   sbyte dummy;
   
  if (!(Game_mode & GM_MULTI_ROBOTS))   if (!(Game_mode & GM_MULTI_ROBOTS))
  return;   return;

Legend:
line(s) removed in v.1.1 
line(s) changed
 line(s) added in v.1.2