Exemple #1
0
void xrServer::Perform_transfer(NET_Packet &PR, NET_Packet &PT,	CSE_Abstract* what, CSE_Abstract* from, CSE_Abstract* to)
{
	// Sanity check
	R_ASSERT	(what && from && to);
	R_ASSERT	(from != to);
	R_ASSERT	(what->ID_Parent == from->ID);
	u32			time		= Device.dwTimeGlobal;

	// 1. Perform migration if need it
	if (from->owner != to->owner)	PerformMigration(what,from->owner,to->owner);
	//Log						("B");

	// 2. Detach "FROM"
	xr_vector<u16>& C			= from->children;
	xr_vector<u16>::iterator c	= std::find	(C.begin(),C.end(),what->ID);
	R_ASSERT				(C.end()!=c);
	C.erase					(c);
	PR.w_begin				(M_EVENT);
	PR.w_u32				(time);
	PR.w_u16				(GE_OWNERSHIP_REJECT);
	PR.w_u16				(from->ID);
	PR.w_u16				(what->ID);

	// 3. Attach "TO"
	what->ID_Parent			= to->ID;
	to->children.push_back	(what->ID);
	PT.w_begin				(M_EVENT);
	PT.w_u32				(time+1);
	PT.w_u16				(GE_OWNERSHIP_TAKE);
	PT.w_u16				(to->ID);
	PT.w_u16				(what->ID);

}
Exemple #2
0
// Core events
void CAI_Crow::net_Export	(NET_Packet& P)					// export to server
{
	// export 
	R_ASSERT			(Local());

	u8					flags = 0;
	P.w_float			(GetfHealth());

	P.w_float			(0);
	P.w_u32				(0);
	P.w_u32				(0);

	P.w_u32				(Level().timeServer());
	P.w_u8				(flags);
	
	float				yaw, pitch, bank;
	XFORM().getHPB		(yaw,pitch,bank);
	P.w_float /*w_angle8*/			(yaw);
	P.w_float /*w_angle8*/			(yaw);
	P.w_float /*w_angle8*/			(pitch);
	P.w_float /*w_angle8*/			(0);
	P.w_u8				(u8(g_Team()));
	P.w_u8				(u8(g_Squad()));
	P.w_u8				(u8(g_Group()));
}
Exemple #3
0
void CPhantom::net_Export	(NET_Packet& P)					// export to server
{
	// export 
	R_ASSERT			(Local());

	u8					flags = 0;
	P.w_float			(GetfHealth());

	P.w_float			(0);
	P.w_u32				(0);
	P.w_u32				(0);

	P.w_u32				(Device.dwTimeGlobal);
	P.w_u8				(flags);

	float				yaw, pitch, bank;
	XFORM().getHPB		(yaw,pitch,bank);
	P.w_float /*w_angle8*/			(yaw);
	P.w_float /*w_angle8*/			(yaw);
	P.w_float /*w_angle8*/			(pitch);
	P.w_float /*w_angle8*/			(0);
	P.w_u8				(u8(g_Team()));
	P.w_u8				(u8(g_Squad()));
	P.w_u8				(u8(g_Group()));
}
void			CLevel::ClearAllObjects				()
{
	u32 CLObjNum = Level().Objects.o_count();

	bool ParentFound = true;
	
	while (ParentFound)
	{	
		ParentFound = false;
		for (u32 i=0; i<CLObjNum; i++)
		{
			CObject* pObj = Level().Objects.o_get_by_iterator(i);
			if (!pObj->H_Parent()) continue;
			//-----------------------------------------------------------
			NET_Packet			GEN;
			GEN.w_begin			(M_EVENT);
			//---------------------------------------------		
			GEN.w_u32			(Level().timeServer());
			GEN.w_u16			(GE_OWNERSHIP_REJECT);
			GEN.w_u16			(pObj->H_Parent()->ID());
			GEN.w_u16			(u16(pObj->ID()));
			game_events->insert	(GEN);
			if (g_bDebugEvents)	ProcessGameEvents();
			//-------------------------------------------------------------
			ParentFound = true;
			//-------------------------------------------------------------
#ifdef DEBUG
			Msg ("Rejection of %s[%d] from %s[%d]", *(pObj->cNameSect()), pObj->ID(), *(pObj->H_Parent()->cNameSect()), pObj->H_Parent()->ID());
#endif
		};
		ProcessGameEvents();
	};

	CLObjNum = Level().Objects.o_count();

	for (u32 i=0; i<CLObjNum; i++)
	{
		CObject* pObj = Level().Objects.o_get_by_iterator(i);
		R_ASSERT(pObj->H_Parent()==NULL);
		//-----------------------------------------------------------
		NET_Packet			GEN;
		GEN.w_begin			(M_EVENT);
		//---------------------------------------------		
		GEN.w_u32			(Level().timeServer());
		GEN.w_u16			(GE_DESTROY);
		GEN.w_u16			(u16(pObj->ID()));
		game_events->insert	(GEN);
		if (g_bDebugEvents)	ProcessGameEvents();
		//-------------------------------------------------------------
		ParentFound = true;
		//-------------------------------------------------------------
#ifdef DEBUG
		Msg ("Destruction of %s[%d]", *(pObj->cNameSect()), pObj->ID());
#endif
	};
	ProcessGameEvents();
};
void game_sv_TeamDeathmatch::OnPlayerChangeTeam(ClientID id_who, s16 team)
{
    game_PlayerState*	ps_who	=	get_id	(id_who);
    if (!ps_who) return;
    if (!team)
    {
        if (!ps_who->team)
            team = AutoTeam();
        else if (TeamSizeEqual())
        {
            team = ps_who->team;
        }
        else
        {
            team = AutoTeam();
        }
    };
    //-----------------------------------------------------
    NET_Packet Px;
    GenerateGameMessage(Px);
    Px.w_u32(GAME_EVENT_PLAYER_GAME_MENU_RESPOND);
    Px.w_u8(PLAYER_CHANGE_TEAM);
    Px.w_s16(team);
    m_server->SendTo(id_who,Px,net_flags(TRUE,TRUE));
    //-----------------------------------------------------
    if (ps_who->team == team) return;
    //-----------------------------------------------------
    KillPlayer(id_who, ps_who->GameID);
    //-----------------------------------------------------
    ps_who->setFlag(GAME_PLAYER_FLAG_SPECTATOR);
    //-----------------------------------------------------
    s16 OldTeam = ps_who->team;
    ps_who->team = u8(team & 0x00ff);
    TeamStruct* pTS = GetTeamData(team);
    if (pTS)
    {
        if ((ps_who->money_for_round < pTS->m_iM_Start) || (OldTeam == 0))
            Money_SetStart(id_who);
    }

/////////////////////////////////////////////////////////
    //Send Switch team message
    NET_Packet			P;
//	P.w_begin			(M_GAMEMESSAGE);
    GenerateGameMessage (P);
    P.w_u32				(PLAYER_CHANGE_TEAM);
    P.w_u16				(ps_who->GameID);
    P.w_u16				(ps_who->team);
    P.w_u16				(team);
    u_EventSend(P);
/////////////////////////////////////////////////////////



    SetPlayersDefItems(ps_who);

}
Exemple #6
0
void			CLevel::SendPingMessage				()
{
	u32 CurTime = timeServer_Async();
	if (CurTime < (m_dwCL_PingLastSendTime + m_dwCL_PingDeltaSend)) return;
	u32 m_dwCL_PingLastSendTime = CurTime;
	NET_Packet P;
	P.w_begin		(M_CL_PING_CHALLENGE);
	P.w_u32			(m_dwCL_PingLastSendTime);
	P.w_u32			(m_dwCL_PingLastSendTime);
	P.w_u32			(m_dwRealPing);
	Send	(P, net_flags(FALSE));
};
void game_sv_GameState::net_Export_State						(NET_Packet& P, ClientID to)
{
	// Generic
	P.w_clientID	(to);
	P.w_s32			(m_type);
	P.w_u16			(m_phase);
	P.w_s32			(m_round);
	P.w_u32			(m_start_time);
	P.w_u8			(u8(g_sv_base_iVotingEnabled&0xff));
	P.w_u8			(u8(net_sv_control_hit));
	P.w_u8			(u8(g_bCollectStatisticData));

	// Players
//	u32	p_count			= get_players_count() - ((g_dedicated_server)? 1 : 0);

	xrClientData*		tmp_client = static_cast<xrClientData*>(
		m_server->GetClientByID(to));
	game_PlayerState*	tmp_ps = tmp_client->ps;
	
	player_exporter		tmp_functor(to, tmp_ps, &P);
	fastdelegate::FastDelegate1<IClient*, void> pcounter;
	pcounter.bind(&tmp_functor, &player_exporter::count_players);
	fastdelegate::FastDelegate1<IClient*, void> exporter;
	exporter.bind(&tmp_functor, &player_exporter::export_players);
	
	m_server->ForEachClientDo(pcounter);
	P.w_u16(tmp_functor.counter);
	m_server->ForEachClientDo(exporter);

	net_Export_GameTime(P);
}
Exemple #8
0
void game_cl_GameState::u_EventGen(NET_Packet& P, u16 type, u16 dest)
{
	P.w_begin	(M_EVENT);
	P.w_u32		(Level().timeServer());
	P.w_u16		(type);
	P.w_u16		(dest);
}
void game_sv_GameState::u_EventGen(NET_Packet& P, u16 type, u16 dest)
{
	P.w_begin	(M_EVENT);
	P.w_u32		(Level().timeServer());//Device.TimerAsync());
	P.w_u16		(type);
	P.w_u16		(dest);
}
Exemple #10
0
void CGameObject::u_EventGen(NET_Packet& P, u32 type, u32 dest)
{
	P.w_begin	(M_EVENT);
	P.w_u32		(Level().timeServer());
	P.w_u16		(u16(type&0xffff));
	P.w_u16		(u16(dest&0xffff));
}
Exemple #11
0
void CEntity::KillEntity(u16 whoID)
{
	if (whoID != ID()) {
#ifdef DEBUG
		if (m_killer_id != ALife::_OBJECT_ID(-1)) {
			Msg			("! Entity [%s][%s] already has killer with id %d, but new killer id arrived - %d",*cNameSect(),*cName(),m_killer_id,whoID);

			CObject		*old_killer = Level().Objects.net_Find(m_killer_id);
			Msg			("! Old killer is %s",old_killer ? *old_killer->cName() : "unknown");

			CObject		*new_killer = Level().Objects.net_Find(whoID);
			Msg			("! New killer is %s",new_killer ? *new_killer->cName() : "unknown");

			VERIFY		(m_killer_id == ALife::_OBJECT_ID(-1));
		}
#endif
	}
	else {
		if (m_killer_id != ALife::_OBJECT_ID(-1))
			return;
	}

	m_killer_id			= whoID;

	set_death_time		();

	if (!getDestroy()){
		NET_Packet		P;
		u_EventGen		(P,GE_DIE,ID());
		P.w_u16			(u16(whoID));
		P.w_u32			(0);
		if (OnServer())
			u_EventSend	(P, net_flags(TRUE, TRUE, FALSE, TRUE));
	}
};
Exemple #12
0
void game_cl_GameState::sv_GameEventGen(NET_Packet& P)
{
	P.w_begin	(M_EVENT);
	P.w_u32		(Level().timeServer());
	P.w_u16		( u16(GE_GAME_EVENT&0xffff) );
	P.w_u16		(0);//dest==0
}
Exemple #13
0
void	CUIInventoryWnd::SendEvent_ActivateSlot	(PIItem	pItem)
{
	NET_Packet						P;
	pItem->object().u_EventGen		(P, GEG_PLAYER_ACTIVATE_SLOT, pItem->object().H_Parent()->ID());
	P.w_u32							(pItem->GetSlot());
	pItem->object().u_EventSend		(P);
}
Exemple #14
0
void CInventoryItem::net_Export			(NET_Packet& P) 
{	
	P.w_float			(m_fCondition);
	P.w_u32				(Level().timeServer());	
	///////////////////////////////////////
	CPHSynchronize* pSyncObj				= NULL;
	SPHNetState	State;
	pSyncObj = object().PHGetSyncItem		(0);
	if (pSyncObj && !object().H_Parent()) 
		pSyncObj->get_State(State);
	else 	
		State.position.set(object().Position());
	///////////////////////////////////////	
	u16 NumItems = object().PHGetSyncItemsNumber();
	if (object().H_Parent())
		NumItems = CSE_ALifeInventoryItem::FLAG_NO_POSITION;
	else
		if (IsGameTypeSingle())
						NumItems = 0;

	P.w_u16					( NumItems		);
	if (NumItems != CSE_ALifeInventoryItem::FLAG_NO_POSITION)
		P.w_vec3			( State.position);

	if (!NumItems || (NumItems == CSE_ALifeInventoryItem::FLAG_NO_POSITION))
		return;
	position_Export(P,State);
};
void CLevel::ClientSend()
{
	if ((GameID() != eGameIDSingle) || OnClient()) // fixed by Shoker
	{
		if ( !net_HasBandwidth() ) return;
	};
    
	NET_Packet				P;
	u32						start	= 0;
	//----------- for E3 -----------------------------
//	if () 
	{
//		if (!(Game().local_player) || Game().local_player->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD)) return;
		if (CurrentControlEntity()) 
		{
			CObject* pObj = CurrentControlEntity();
			if (!pObj->getDestroy() && pObj->net_Relevant())
			{				
				P.w_begin		(M_CL_UPDATE);
				

				P.w_u16			(u16(pObj->ID())	);
				P.w_u32			(0);	//reserved place for client's ping

				pObj->net_Export			(P);

				if (P.B.count>9)				
				{
					if (!OnServer())
						Send	(P, net_flags(FALSE));
				}				
			}			
		}		
	};
	if (m_file_transfer)
	{
		m_file_transfer->update_transfer();
		m_file_transfer->stop_obsolete_receivers();
	}
	if (OnClient()) 
	{
		Flush_Send_Buffer();
		return;
	}
	//-------------------------------------------------
	while (1)
	{
		P.w_begin						(M_UPDATE);
		start	= Objects.net_Export	(&P, start, max_objects_size);

		if (P.B.count>2)
		{
			Device.Statistic->TEST3.Begin();
				Send	(P, net_flags(FALSE));
			Device.Statistic->TEST3.End();
		}else
			break;
	}
}
void BattlEyeServer::SendPacket( int player, void* packet, int len )
{
	NET_Packet P;
	P.w_begin( M_BATTLEYE );
	P.w_u32( len );
	P.w( packet, len );
	Level().Server->SendTo( (u32)player, P, net_flags() );
}
Exemple #17
0
void SHeliEnemy::save(NET_Packet &output_packet)
{
	output_packet.w_s16		((s16)type);
	output_packet.w_vec3	(destEnemyPos);
	output_packet.w_u32		(destEnemyID);

	output_packet.w_float	(fire_trail_length_des);
	output_packet.w_u8		(bUseFireTrail ? 1 : 0);
}
Exemple #18
0
void SHit::Write_Packet			(NET_Packet	&Packet)
{
	Packet.w_begin	(M_EVENT);
	Packet.w_u32		(Time);
	Packet.w_u16		(u16(PACKET_TYPE&0xffff));
	Packet.w_u16		(u16(DestID&0xffff));

	Write_Packet_Cont (Packet);	
};
Exemple #19
0
void CHitMemoryManager::save	(NET_Packet &packet) const
{
	if (!m_object->g_Alive())
		return;

	packet.w_u8					((u8)objects().size());

	HITS::const_iterator		I = objects().begin();
	HITS::const_iterator		E = objects().end();
	for ( ; I != E; ++I) {
		VERIFY					((*I).m_object);
		packet.w_u16			((*I).m_object->ID());
		// object params
		packet.w_u32			((*I).m_object_params.m_level_vertex_id);
		packet.w_vec3			((*I).m_object_params.m_position);
#ifdef USE_ORIENTATION
		packet.w_float			((*I).m_object_params.m_orientation.yaw);
		packet.w_float			((*I).m_object_params.m_orientation.pitch);
		packet.w_float			((*I).m_object_params.m_orientation.roll);
#endif // USE_ORIENTATION
		// self params
		packet.w_u32			((*I).m_self_params.m_level_vertex_id);
		packet.w_vec3			((*I).m_self_params.m_position);
#ifdef USE_ORIENTATION
		packet.w_float			((*I).m_self_params.m_orientation.yaw);
		packet.w_float			((*I).m_self_params.m_orientation.pitch);
		packet.w_float			((*I).m_self_params.m_orientation.roll);
#endif // USE_ORIENTATION
#ifdef USE_LEVEL_TIME
		packet.w_u32			((Device.dwTimeGlobal >= (*I).m_level_time) ? (Device.dwTimeGlobal - (*I).m_level_time) : 0);
#endif // USE_LAST_LEVEL_TIME
#ifdef USE_LEVEL_TIME
		packet.w_u32			((Device.dwTimeGlobal >= (*I).m_level_time) ? (Device.dwTimeGlobal - (*I).m_last_level_time) : 0);
#endif // USE_LAST_LEVEL_TIME
#ifdef USE_FIRST_LEVEL_TIME
		packet.w_u32			((Device.dwTimeGlobal >= (*I).m_level_time) ? (Device.dwTimeGlobal - (*I).m_first_level_time) : 0);
#endif // USE_FIRST_LEVEL_TIME
		packet.w_vec3			((*I).m_direction);
		packet.w_u16			((*I).m_bone_index);
		packet.w_float			((*I).m_amount);
	}
}
Exemple #20
0
void CControllerPsyHit::death_glide_start()
{
	if (!check_conditions_final()) {
		m_man->deactivate	(this);
		return;
	}
	
	HUD().SetRenderable(false);

	// Start effector
	CEffectorCam* ce = Actor()->Cameras().GetCamEffector(eCEControllerPsyHit);
	VERIFY(!ce);
	
	Fvector src_pos		= Actor()->cam_Active()->vPosition;
	Fvector target_pos	= m_object->Position();
	target_pos.y		+= 1.2f;
	
	Fvector				dir;
	dir.sub				(target_pos,src_pos);
	
	float dist			= dir.magnitude();
	dir.normalize		();

	target_pos.mad		(src_pos,dir,dist-4.8f);
	
	Actor()->Cameras().AddCamEffector(new CControllerPsyHitCamEffector(eCEControllerPsyHit, src_pos,target_pos, m_man->animation().motion_time(m_stage[1], m_object->Visual())));
	smart_cast<CController *>(m_object)->draw_fire_particles();

	dir.sub(src_pos,target_pos);
	dir.normalize();
	float h,p;
	dir.getHP(h,p);
	dir.setHP(h,p+PI_DIV_3);
	Actor()->character_physics_support()->movement()->ApplyImpulse(dir,Actor()->GetMass() * 530.f);

	set_sound_state					(eStart);

	NET_Packet			P;
	Actor()->u_EventGen	(P, GEG_PLAYER_WEAPON_HIDE_STATE, Actor()->ID());
	P.w_u32				(INV_STATE_BLOCK_ALL);
	P.w_u8				(u8(true));
	Actor()->u_EventSend(P);
	
	m_blocked			= true;

	//////////////////////////////////////////////////////////////////////////
	// set direction
	SControlDirectionData			*ctrl_dir = (SControlDirectionData*)m_man->data(this, ControlCom::eControlDir); 
	VERIFY							(ctrl_dir);
	ctrl_dir->heading.target_speed	= 3.f;
	ctrl_dir->heading.target_angle	= m_man->direction().angle_to_target(Actor()->Position());

	//////////////////////////////////////////////////////////////////////////
}
Exemple #21
0
void CInventory::SendActionEvent(u16 cmd, u32 flags) 
{
	CActor *pActor = smart_cast<CActor*>(m_pOwner);
	if (!pActor) return;

	NET_Packet		P;
	pActor->u_EventGen		(P,GE_INV_ACTION, pActor->ID());
	P.w_u16					(cmd);
	P.w_u32					(flags);
	P.w_s32					(pActor->GetZoomRndSeed());
	P.w_s32					(pActor->GetShotRndSeed());
	pActor->u_EventSend		(P, net_flags(TRUE, TRUE, FALSE, TRUE));
};
Exemple #22
0
void  CInventory::ActivateNextItemInActiveSlot()
{
	if(m_iActiveSlot==NO_ACTIVE_SLOT)	return;
	
	PIItem current_item		= m_slots[m_iActiveSlot].m_pIItem;
	PIItem new_item			= NULL;

	bool b = (current_item==NULL);
	
	TIItemContainer::const_iterator it		= m_all.begin();
	TIItemContainer::const_iterator it_e	= m_all.end();

	for(; it!=it_e; ++it) 
	{
		PIItem _pIItem		= *it;
		if(_pIItem==current_item)
		{
			b = true;
			continue;
		}
		if(_pIItem->GetSlot()==m_iActiveSlot)
			new_item = _pIItem;

		if(b && new_item)
			break;
	}

	if(new_item==NULL)
		return; //only 1 item for this slot

	bool res = Ruck						(current_item);
	R_ASSERT							(res);
	NET_Packet							P;
	current_item->object().u_EventGen	(P, GEG_PLAYER_ITEM2RUCK, current_item->object().H_Parent()->ID());
	P.w_u16								(current_item->object().ID());
	current_item->object().u_EventSend	(P);

	res = Slot							(new_item);
	R_ASSERT							(res);
	new_item->object().u_EventGen		(P, GEG_PLAYER_ITEM2SLOT, new_item->object().H_Parent()->ID());
	P.w_u16								(new_item->object().ID());
	new_item->object().u_EventSend		(P);
	
	//activate
	new_item->object().u_EventGen		(P, GEG_PLAYER_ACTIVATE_SLOT, new_item->object().H_Parent()->ID());
	P.w_u32								(new_item->GetSlot());
	new_item->object().u_EventSend		(P);


	Msg("CHANGE");
}
Exemple #23
0
void WeaponUsageStatistic::Update()
{
	if (!CollectData())							return;
	if (Level().timeServer() < (m_dwLastUpdateTime + m_dwUpdateTimeDelta))
	{
		//---------------------------------------------
		m_dwLastUpdateTime = Level().timeServer();
		//---------------------------------------------
		NET_Packet P;
		P.w_begin	(M_STATISTIC_UPDATE);
		P.w_u32		(Level().timeServer());
		Level().Send(P);
	}
};
void CControllerPsyHit::deactivate()
{
	m_man->release_pure				(this);
	m_man->unsubscribe				(this, ControlCom::eventAnimationEnd);

	if (m_blocked) {
		NET_Packet			P;

		Actor()->u_EventGen	(P, GEG_PLAYER_WEAPON_HIDE_STATE, Actor()->ID());
		P.w_u32				(INV_STATE_BLOCK_ALL);
		P.w_u8				(u8(false));
		Actor()->u_EventSend(P);
	}

	set_sound_state					(eNone);
}
Exemple #25
0
void CInventoryOwner::set_money		(u32 amount, bool bSendEvent)
{

	if(InfinitiveMoney())
		m_money					= _max(m_money, amount);
	else
		m_money					= amount;

	if(bSendEvent)
	{
		CGameObject				*object = smart_cast<CGameObject*>(this);
		NET_Packet				packet;
		object->u_EventGen		(packet,GE_MONEY,object->ID());
		packet.w_u32			(m_money);
		object->u_EventSend		(packet);
	}
}
Exemple #26
0
void xrServer::Perform_reject(CSE_Abstract* what, CSE_Abstract* from, int delta)
{
	R_ASSERT				(what && from);
	R_ASSERT				(what->ID_Parent == from->ID);

	NET_Packet				P;
	u32						time = Device.dwTimeGlobal - delta;

	P.w_begin				(M_EVENT);
	P.w_u32					(time);
	P.w_u16					(GE_OWNERSHIP_REJECT);
	P.w_u16					(from->ID);
	P.w_u16					(what->ID);
	P.w_u8					(1);

	Process_event_reject	(P,BroadcastCID,time,from->ID,what->ID);
}
void xrServer::Perform_destroy	(CSE_Abstract* object, u32 mode)
{
	R_ASSERT				(object);
	R_ASSERT				(object->ID_Parent == 0xffff);

#ifdef DEBUG
#	ifdef SLOW_VERIFY_ENTITIES
		verify_entities			();
#	endif
#endif

	while (!object->children.empty()) {
		CSE_Abstract		*child = game->get_entity_from_eid(object->children.back());
		R_ASSERT2			(child, make_string("child registered but not found [%d]",object->children.back()));
//		Msg					("SLS-CLEAR : REJECT  [%s][%s] FROM [%s][%s]",child->name(),child->name_replace(),object->name(),object->name_replace());
		Perform_reject		(child,object,2*NET_Latency);
#ifdef DEBUG
#	ifdef SLOW_VERIFY_ENTITIES
		verify_entities			();
#	endif
#endif
		Perform_destroy		(child,mode);
	}

//	Msg						("SLS-CLEAR : DESTROY [%s][%s]",object->name(),object->name_replace());
	u16						object_id = object->ID;
	entity_Destroy			(object);

#ifdef DEBUG
#	ifdef SLOW_VERIFY_ENTITIES
		verify_entities		();
#	endif
#endif

	NET_Packet				P;
	P.w_begin				(M_EVENT);
	P.w_u32					(Device.dwTimeGlobal - 2*NET_Latency);
	P.w_u16					(GE_DESTROY);
	P.w_u16					(object_id);
	ClientID				clientID;
	clientID.setBroadcast	();
	SendBroadcast			(clientID,P,mode);
}
Exemple #28
0
void CAI_Stalker::net_Export		(NET_Packet& P)
{
	R_ASSERT						(Local());

	// export last known packet
	R_ASSERT						(!NET.empty());
	net_update& N					= NET.back();
//	P.w_float						(inventory().TotalWeight());
//	P.w_u32							(m_dwMoney);

	P.w_float						(GetfHealth());

	P.w_u32							(N.dwTimeStamp);
	P.w_u8							(0);
	P.w_vec3						(N.p_pos);
	P.w_float /*w_angle8*/						(N.o_model);
	P.w_float /*w_angle8*/						(N.o_torso.yaw);
	P.w_float /*w_angle8*/						(N.o_torso.pitch);
	P.w_float /*w_angle8*/						(N.o_torso.roll);
	P.w_u8							(u8(g_Team()));
	P.w_u8							(u8(g_Squad()));
	P.w_u8							(u8(g_Group()));
	

	float					f1 = 0;
	GameGraph::_GRAPH_ID		l_game_vertex_id = ai_location().game_vertex_id();
	P.w						(&l_game_vertex_id,			sizeof(l_game_vertex_id));
	P.w						(&l_game_vertex_id,			sizeof(l_game_vertex_id));
//	P.w						(&f1,						sizeof(f1));
//	P.w						(&f1,						sizeof(f1));
	if (ai().game_graph().valid_vertex_id(l_game_vertex_id)) {
		f1					= Position().distance_to	(ai().game_graph().vertex(l_game_vertex_id)->level_point());
		P.w					(&f1,						sizeof(f1));
		f1					= Position().distance_to	(ai().game_graph().vertex(l_game_vertex_id)->level_point());
		P.w					(&f1,						sizeof(f1));
	}
	else {
		P.w					(&f1,						sizeof(f1));
		P.w					(&f1,						sizeof(f1));
	}

	P.w_stringZ						(m_sStartDialog);
}
Exemple #29
0
void CCustomMonster::net_Export(NET_Packet& P)					// export to server
{
	R_ASSERT				(Local());

	// export last known packet
	R_ASSERT				(!NET.empty());
	net_update& N			= NET.back();
	P.w_float				(GetfHealth());
	P.w_u32					(N.dwTimeStamp);
	P.w_u8					(0);
	P.w_vec3				(N.p_pos);
	P.w_float /*w_angle8*/				(N.o_model);
	P.w_float /*w_angle8*/				(N.o_torso.yaw);
	P.w_float /*w_angle8*/				(N.o_torso.pitch);
	P.w_float /*w_angle8*/				(N.o_torso.roll);
	P.w_u8					(u8(g_Team()));
	P.w_u8					(u8(g_Squad()));
	P.w_u8					(u8(g_Group()));
}
Exemple #30
0
void SHit::Write_Packet_Cont		(NET_Packet	&Packet)
{
	Packet.w_u16		(whoID);
	Packet.w_u16		(weaponID);
	Packet.w_dir		(dir);
	Packet.w_float		(power);
	Packet.w_u16		(boneID);
	Packet.w_vec3		(p_in_bone_space);
	Packet.w_float		(impulse);
	Packet.w_u16		(aim_bullet!=0);
	Packet.w_u16		(u16(hit_type&0xffff));	
	if (hit_type == ALife::eHitTypeFireWound)
	{
		Packet.w_float	(ap);
	}
	if (PACKET_TYPE == GE_HIT_STATISTIC)
	{
		Packet.w_u32(BulletID);
		Packet.w_u32(SenderID);
	}
}