version 1.1 | | version 1.2 |
---|
| | |
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) |
| | |
| | |
| | |
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); |
} | | } |
| | |
| | |
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); |
} | | } |
| | |
| | |
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); |
| | |
| | |
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 |
| | |
| | |
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); |
| | |
| | |
| | |
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; |
| | |
| | |
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) |
| | |
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")); |
| | |
| | |
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")); |
| | |
| | |
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)) { |
| | |
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)) |
| | |
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)); |
| | |
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; |