Exemplo n.º 1
0
// create observer object locally, and additionally, setup some other information
// ( client-side equivalent of multi_obs_create_observer() )
void multi_obs_create_observer_client()
{
	int pobj_num;

	Assert(!(Net_player->flags & NETINFO_FLAG_OBS_PLAYER));

	// make me an observer object
	multi_obs_create_observer(Net_player);

	// set my object to be the observer object	
	Player_obj = &Objects[Net_player->m_player->objnum];

	// create the default player ship object and use that as my default virtual "ship", and make it "invisible"
	pobj_num = parse_create_object(&Player_start_pobject);
	Assert(pobj_num != -1);
	obj_set_flags(&Objects[pobj_num], OF_PLAYER_SHIP);
	Player_ship = &Ships[Objects[pobj_num].instance];

	// make ship hidden from sensors so that this observer cannot target it.  Observers really have two ships
	// one observer, and one "Player_ship".  Observer needs to ignore the Player_ship.
	Player_ship->flags |= SF_HIDDEN_FROM_SENSORS;
	strcpy_s(Player_ship->ship_name, XSTR("Observer Ship", 688));
	Player_ai = &Ai_info[Ships[Objects[pobj_num].instance].ai_index];

	// configure the hud to be in "observer" mode
	hud_config_as_observer(Player_ship, Player_ai);

	// set some flags for myself
	Net_player->flags |= NETINFO_FLAG_OBSERVER;

	// reset the control info structure
	memset(&Player->ci, 0, sizeof(control_info));
}
int multi_respawn_common_stuff(p_object *pobjp)
{
	int objnum, team, slot_index;
	object *objp;
	ship *shipp;
	int idx;

	// create the object
	objnum = parse_create_object(pobjp);
	Assert(objnum != -1);
	objp = &Objects[objnum];

	// get the team and slot
	shipp = &Ships[objp->instance];
	multi_ts_get_team_and_slot(shipp->ship_name, &team, &slot_index);
	Assert( team != -1 );
	Assert( slot_index != -1 );

	// reset object update stuff
	for(idx=0; idx<MAX_PLAYERS; idx++){
		shipp->np_updates[idx].orient_chksum = 0;
		shipp->np_updates[idx].pos_chksum = 0;
		shipp->np_updates[idx].seq = 0;
		shipp->np_updates[idx].status_update_stamp = -1;
		shipp->np_updates[idx].subsys_update_stamp = -1;
		shipp->np_updates[idx].update_stamp = -1;
	}

	// change the ship type and the weapons
	if (team != -1 && slot_index != -1) {
		change_ship_type(objp->instance, Wss_slots_teams[team][slot_index].ship_class);
		wl_bash_ship_weapons(&shipp->weapons,&Wss_slots_teams[team][slot_index]);
	}
	multi_respawn_wing_stuff( shipp );

	if(Netgame.type_flags & NG_TYPE_TEAM){
		multi_team_mark_ship(&Ships[Objects[objnum].instance]);
	}

	pobjp->respawn_count++;

	return objnum;
}