本文整理汇总了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);
}
示例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();
};
示例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");
}
}
}
示例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);
}
示例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);
}
};
}
示例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;
}
};
示例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());
}
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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;
};
}
示例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;
}
}
示例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;
}
}
示例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();
}