当前位置: 首页>>代码示例>>C++>>正文


C++ NET_Packet::r_u8方法代码示例

本文整理汇总了C++中NET_Packet::r_u8方法的典型用法代码示例。如果您正苦于以下问题:C++ NET_Packet::r_u8方法的具体用法?C++ NET_Packet::r_u8怎么用?C++ NET_Packet::r_u8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NET_Packet的用法示例。


在下文中一共展示了NET_Packet::r_u8方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: net_Import

void CCustomMonster::net_Import(NET_Packet& P)
{
	R_ASSERT				(Remote());
	net_update				N;

	u8 flags;

	float health;
	P.r_float				(health);
	SetfHealth				(health);

	P.r_u32					(N.dwTimeStamp);
	P.r_u8					(flags);
	P.r_vec3				(N.p_pos);
	P.r_float /*r_angle8*/				(N.o_model);
	P.r_float /*r_angle8*/				(N.o_torso.yaw);
	P.r_float /*r_angle8*/				(N.o_torso.pitch);
	P.r_float /*r_angle8*/				(N.o_torso.roll	);

	id_Team					= P.r_u8();
	id_Squad				= P.r_u8();
	id_Group				= P.r_u8();

	if (NET.empty() || (NET.back().dwTimeStamp<N.dwTimeStamp))	{
		NET.push_back			(N);
		NET_WasInterpolating	= TRUE;
	}

	setVisible				(TRUE);
	setEnabled				(TRUE);
}
开发者ID:BubbaXXX,项目名称:xray-16,代码行数:31,代码来源:CustomMonster.cpp

示例2:

void	game_PlayerState::net_Import(NET_Packet& P)
{
	BOOL	bFullUpdate = !!P.r_u8();

	if (bFullUpdate)
		P.r_stringZ		(name);


	P.r_u8			(	team			);
	
	P.r_s16			(	m_iRivalKills	);
	P.r_s16			(	m_iSelfKills	);
	P.r_s16			(	m_iTeamKills	);
	P.r_s16			(	m_iDeaths		);

	P.r_s32			(	money_for_round	);
	P.r_float_q8	(	experience_D, -1.0f, 2.0f);
	P.r_u8			(	rank		);
	P.r_u8			(	af_count	);
	P.r_u16			(	flags__	);
	P.r_u16			(	ping	);

	P.r_u16			(	GameID	);
	P.r_s8			(	skin	);
	P.r_u8			(	m_bCurrentVoteAgreed	);

	DeathTime = P.r_u32();
};
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:28,代码来源:game_base.cpp

示例3: CLevel__cl_Process_CustomEventServer

void CLevel__cl_Process_CustomEventServer(NET_Packet& pack)
{
	if (HookHandle->IsServer()) {
		unsigned char type = 0;
		pack.r_u8(type);
		if (type == e_so_engine_packet) {
			unsigned char e;
			pack.r_u8(e);
			switch (e) {
				case e_add_money: {
					LogHandle->Write("CLevel__cl_Process_CustomEventServer add money event");
					ClientID cl_id;
					pack.r_clientID(cl_id);

					HookHandle->Add_money_mp(cl_id);

					}break;
				default:
					LogHandle->Write("CLevel__cl_Process_CustomEventServer unknown event %d",e);
					break;
			}
		} else if (type == e_so_script_packet) {
			char data[2048];
			pack.r_stringZ(data);
			LogHandle->Write("Recieved data at server side '%s'",data);
			HookHandle->messanges_sv.push_back(data);
		} else {
			LogHandle->Write("ERROR: CLevel__cl_Process_CustomEventServer unknown type");
		}
	}
}
开发者ID:rusphantom,项目名称:soprojectEx,代码行数:31,代码来源:events.cpp

示例4:

void CPhantom::net_Import	(NET_Packet& P)
{
	// import
	R_ASSERT			(Remote());

	u8					flags;

	float health;
	P.r_float			(health);
	SetfHealth			(health);

	float fDummy;
	u32 dwDummy;
	P.r_float			(fDummy);
	P.r_u32				(dwDummy);
	P.r_u32				(dwDummy);

	P.r_u32				(dwDummy);
	P.r_u8				(flags);

	float				yaw, pitch, bank = 0, roll = 0;

	P.r_float /*r_angle8*/			(yaw);
	P.r_float /*r_angle8*/			(yaw);
	P.r_float /*r_angle8*/			(pitch);
	P.r_float /*r_angle8*/			(roll);

	id_Team				= P.r_u8();
	id_Squad			= P.r_u8();
	id_Group			= P.r_u8();

	XFORM().setHPB		(yaw,pitch,bank);
}
开发者ID:2asoft,项目名称:xray,代码行数:33,代码来源:phantom.cpp

示例5:

void				game_cl_TeamDeathmatch::net_import_state		(NET_Packet& P)
{
	bool teamsEqual = (!teams.empty())?(teams[0].score == teams[1].score) : false;
	inherited::net_import_state	(P);
	m_bFriendlyIndicators = !!P.r_u8();
	m_bFriendlyNames = !!P.r_u8();
	if (!teams.empty())
	{	
		if (teamsEqual)
		{
			if (teams[0].score != teams[1].score)
			{
				if (Level().CurrentViewEntity())
				{
					if (teams[0].score > teams[1].score)
						PlaySndMessage(ID_TEAM1_LEAD);
					else
						PlaySndMessage(ID_TEAM2_LEAD);
				}
			}
		}
		else
		{
			if (teams[0].score == teams[1].score)
				if (Level().CurrentViewEntity())
					PlaySndMessage(ID_TEAMS_EQUAL);
		}
	};
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:29,代码来源:game_cl_teamdeathmatch.cpp

示例6: NetSync

void CPhysicObject::net_Import			(NET_Packet& P) 
{	
	u8							NumItems = 0;
	NumItems					= P.r_u8();
	if (!NumItems)
		return;

	CSE_ALifeObjectPhysic::mask_num_items				num_items;
	num_items.common			= NumItems;
	NumItems					= num_items.num_items;

	/*if (num_items.mask & CSE_ALifeObjectPhysic::animated)
	{
		net_Import_Anim_Params(P);	
	}*/

	net_update_PItem			N;
	N.dwTimeStamp				= Device.dwTimeGlobal;

	net_Import_PH_Params(P,N,num_items);
	////////////////////////////////////////////
	P.r_u8();	// freezed or not..


	if (this->cast_game_object()->Local())
	{
		return;
	}

	net_updatePhData				*p = NetSync();

	//	if (!p->NET_IItem.empty() && (p->NET_IItem.back().dwTimeStamp>=N.dwTimeStamp))
	//		return;

	//if (!p->NET_IItem.empty())
	//m_flags.set							(FInInterpolate, TRUE);

	Level().AddObject_To_Objects4CrPr		(this);
	//this->CrPr_SetActivated				(false);
	//this->CrPr_SetActivationStep			(0);

	p->NET_IItem.push_back					(N);
	
	while (p->NET_IItem.size() > 2)
	{
		p->NET_IItem.pop_front				();
	}
	if (!m_activated)
	{
#ifdef DEBUG
		Msg("Activating object [%d] before interpolation starts", ID());		
#endif // #ifdef DEBUG
		processing_activate();
		m_activated = true;
	}
};
开发者ID:AntonioModer,项目名称:xray-16,代码行数:56,代码来源:PhysicObject.cpp

示例7:

void CSE_ALifeItemWeaponShotGun::UPDATE_Read		(NET_Packet& P)
{
	inherited::UPDATE_Read(P);

	m_AmmoIDs.clear();
	u8 AmmoCount = P.r_u8();
	for (u8 i=0; i<AmmoCount; i++)
	{
		m_AmmoIDs.push_back(P.r_u8());
	}
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:11,代码来源:xrServer_Objects_ALife_Items.cpp

示例8: net_Import

void CWeapon::net_Import(NET_Packet& P)
{
	inherited::net_Import (P);
	
	float _cond;
	P.r_float_q8			(_cond,0.0f,1.0f);
	SetCondition			(_cond);

	u8 flags				= 0;
	P.r_u8					(flags);

	u16 ammo_elapsed = 0;
	P.r_u16					(ammo_elapsed);

	u8						NewAddonState;
	P.r_u8					(NewAddonState);

	m_flagsAddOnState		= NewAddonState;
	UpdateAddonsVisibility	();

	u8 ammoType, wstate;
	P.r_u8					(ammoType);
	P.r_u8					(wstate);

	u8 Zoom;
	P.r_u8					((u8)Zoom);

	if (H_Parent() && H_Parent()->Remote())
	{
		if (Zoom) OnZoomIn();
		else OnZoomOut();
	};
	switch (wstate)
	{	
	case eFire:
	case eFire2:
	case eSwitch:
	case eReload:
		{
		}break;	
	default:
		{
			if (ammoType >= m_ammoTypes.size())
				Msg("!! Weapon [%d], State - [%d]", ID(), wstate);
			else
			{
				m_ammoType = ammoType;
				SetAmmoElapsed((ammo_elapsed));
			}
		}break;
	}
	
	VERIFY((u32)iAmmoElapsed == m_magazine.size());
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:54,代码来源:Weapon.cpp

示例9: UPDATE_Read

void CSE_ALifeItemWeapon::UPDATE_Read(NET_Packet	&tNetPacket)
{
	inherited::UPDATE_Read		(tNetPacket);

	tNetPacket.r_float_q8		(m_fCondition,0.0f,1.0f);
	tNetPacket.r_u8				(wpn_flags);
	tNetPacket.r_u16			(a_elapsed);
	tNetPacket.r_u8				(m_addon_flags.flags);
	tNetPacket.r_u8				(ammo_type);
	tNetPacket.r_u8				(wpn_state);
	tNetPacket.r_u8				(m_bZoom);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:12,代码来源:xrServer_Objects_ALife_Items.cpp

示例10: STATE_Read

void CSE_ALifeItemWeapon::STATE_Read(NET_Packet	&tNetPacket, u16 size)
{
	inherited::STATE_Read		(tNetPacket, size);
	tNetPacket.r_u16			(a_current);
	tNetPacket.r_u16			(a_elapsed);
	tNetPacket.r_u8				(wpn_state);
	
	if (m_wVersion > 40)
		tNetPacket.r_u8			(m_addon_flags.flags);

	if (m_wVersion > 46)
		tNetPacket.r_u8			(ammo_type);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:13,代码来源:xrServer_Objects_ALife_Items.cpp

示例11: net_Import

void CBaseMonster::net_Import(NET_Packet& P)
{
	R_ASSERT				(Remote());
	net_update				N;

	u8 flags;

	float health;
	P.r_float			(health);
	SetfHealth			(health);

	P.r_u32					(N.dwTimeStamp);
	P.r_u8					(flags);
	P.r_vec3				(N.p_pos);
	P.r_float /*r_angle8*/				(N.o_model);
	P.r_float /*r_angle8*/				(N.o_torso.yaw);
	P.r_float /*r_angle8*/				(N.o_torso.pitch);
	P.r_float /*r_angle8*/				(N.o_torso.roll	);
	id_Team					= P.r_u8();
	id_Squad				= P.r_u8();
	id_Group				= P.r_u8();

	GameGraph::_GRAPH_ID		l_game_vertex_id = ai_location().game_vertex_id();
	P.r						(&l_game_vertex_id,			sizeof(l_game_vertex_id));
	P.r						(&l_game_vertex_id,			sizeof(l_game_vertex_id));

	if (NET.empty() || (NET.back().dwTimeStamp<N.dwTimeStamp))	{
		NET.push_back			(N);
		NET_WasInterpolating	= TRUE;
	}

//	P.r						(&m_fGoingSpeed,			sizeof(m_fGoingSpeed));
//	P.r						(&m_fGoingSpeed,			sizeof(m_fGoingSpeed));
	float					f1 = 0;
	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.r					(&f1,						sizeof(f1));
		f1					= Position().distance_to	(ai().game_graph().vertex(l_game_vertex_id)->level_point());
		P.r					(&f1,						sizeof(f1));
	}
	else {
		P.r					(&f1,						sizeof(f1));
		P.r					(&f1,						sizeof(f1));
	}


	setVisible				(TRUE);
	setEnabled				(TRUE);
}
开发者ID:2asoft,项目名称:xray,代码行数:49,代码来源:base_monster_net.cpp

示例12: OnEvent

void CInventoryBox::OnEvent(NET_Packet& P, u16 type)
{
	inherited::OnEvent	(P, type);

	switch (type)
	{
	case GE_OWNERSHIP_TAKE:
		{
			u16 id;
            P.r_u16(id);
			CObject* itm = Level().Objects.net_Find(id);  VERIFY(itm);
			m_items.push_back	(id);
			itm->H_SetParent	(this);
			itm->setVisible		(FALSE);
			itm->setEnabled		(FALSE);
		}break;
	case GE_OWNERSHIP_REJECT:
		{
			u16 id;
            P.r_u16(id);
			CObject* itm = Level().Objects.net_Find(id);  VERIFY(itm);
			xr_vector<u16>::iterator it;
			it = std::find(m_items.begin(),m_items.end(),id); VERIFY(it!=m_items.end());
			m_items.erase		(it);
			itm->H_SetParent	(NULL,!P.r_eof() && P.r_u8());

			if( m_in_use )
			{
				CGameObject* GO		= smart_cast<CGameObject*>(itm);
				Actor()->callback(GameObject::eInvBoxItemTake)( this->lua_game_object(), GO->lua_game_object() );
			}
		}break;
	};
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:34,代码来源:InventoryBox.cpp

示例13:

void game_cl_Deathmatch::net_import_state	(NET_Packet& P)
{
	inherited::net_import_state	(P);

	m_s32FragLimit				= P.r_s32();
	m_s32TimeLimit				= P.r_s32() * 60000;
	m_u32ForceRespawn			= P.r_u32() * 1000;
	m_cl_dwWarmUp_Time			= P.r_u32();
	m_bDamageBlockIndicators	= !!P.r_u8();
	// Teams
	u16							t_count;
	P.r_u16						(t_count);
	teams.clear					();

	for (u16 t_it=0; t_it<t_count; ++t_it)
	{
		game_TeamState	ts;
		P.r				(&ts,sizeof(game_TeamState));
		teams.push_back	(ts);
	};

	switch (Phase())
	{
	case GAME_PHASE_PLAYER_SCORES:
		{
			P.r_stringZ(WinnerName);
			bool NeedSndMessage = (xr_strlen(WinnerName) != 0);
			if (NeedSndMessage && local_player && !xr_strcmp(WinnerName, local_player->getName()))
			{
				PlaySndMessage(ID_YOU_WON);
			}
		}break;
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:34,代码来源:game_cl_deathmatch.cpp

示例14: Level

void CAI_Trader::OnEvent		(NET_Packet& P, u16 type)
{
	inherited::OnEvent			(P,type);
	CInventoryOwner::OnEvent	(P,type);

	u16 id;
	CObject* Obj;

	switch (type) {
		case GE_TRADE_BUY:
		case GE_OWNERSHIP_TAKE:
			P.r_u16		(id);
			Obj = Level().Objects.net_Find	(id);
			if(inventory().CanTakeItem(smart_cast<CInventoryItem*>(Obj))){
				Obj->H_SetParent(this);
				inventory().Take(smart_cast<CGameObject*>(Obj), false, false);
			}else
			{
				NET_Packet				P;
				u_EventGen				(P,GE_OWNERSHIP_REJECT,ID());
				P.w_u16					(u16(Obj->ID()));
				u_EventSend				(P);
			}
			break;
		case GE_TRADE_SELL:
		case GE_OWNERSHIP_REJECT:
			P.r_u16		(id);
			Obj = Level().Objects.net_Find	(id);
			if(inventory().Drop(smart_cast<CGameObject*>(Obj))) 
				Obj->H_SetParent(0,!P.r_eof() && P.r_u8());
			break;
		case GE_TRANSFER_AMMO:
			break;
	}
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:35,代码来源:ai_trader.cpp

示例15:

void CSE_SmartCover::STATE_Read	(NET_Packet	&tNetPacket, u16 size)
{
	inherited1::STATE_Read		(tNetPacket, size);
	cform_read					(tNetPacket);
	tNetPacket.r_stringZ		(m_description);
	m_hold_position_time		= tNetPacket.r_float();
	if (m_wVersion >= 120) {
		m_enter_min_enemy_distance	= tNetPacket.r_float();
		m_exit_min_enemy_distance	= tNetPacket.r_float();
	}

	if (m_wVersion >= 122)
		m_is_combat_cover		= tNetPacket.r_u8();

	if (m_wVersion >= 128)
		m_can_fire				= tNetPacket.r_u8();
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:17,代码来源:xrServer_Objects_Alife_Smartcovers.cpp


注:本文中的NET_Packet::r_u8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。