本文整理汇总了C++中NET_Packet::r_vec3方法的典型用法代码示例。如果您正苦于以下问题:C++ NET_Packet::r_vec3方法的具体用法?C++ NET_Packet::r_vec3怎么用?C++ NET_Packet::r_vec3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NET_Packet
的用法示例。
在下文中一共展示了NET_Packet::r_vec3方法的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: OnEvent
void CInventoryItem::OnEvent (NET_Packet& P, u16 type)
{
switch (type)
{
case GE_ADDON_ATTACH:
{
u16 ItemID;
P.r_u16 (ItemID);
CInventoryItem* ItemToAttach = smart_cast<CInventoryItem*>(Level().Objects.net_Find(ItemID));
if (!ItemToAttach) break;
Attach(ItemToAttach,true);
}break;
case GE_ADDON_DETACH:
{
string64 i_name;
P.r_stringZ (i_name);
Detach(i_name, true);
}break;
case GE_CHANGE_POS:
{
Fvector p;
P.r_vec3(p);
CPHSynchronize* pSyncObj = NULL;
pSyncObj = object().PHGetSyncItem(0);
if (!pSyncObj) return;
SPHNetState state;
pSyncObj->get_State(state);
state.position = p;
state.previous_position = p;
pSyncObj->set_State(state);
}break;
}
}
示例3: NetSync
void CInventoryItem::net_Import (NET_Packet& P)
{
P.r_float (m_fCondition) ;
net_update_IItem N ;
N.dwTimeStamp=P.r_u32 ( );
u16 NumItems = 0;
NumItems=P.r_u16 ( );
if (CSE_ALifeInventoryItem::FLAG_NO_POSITION != NumItems)
N.State.position=P.r_vec3 ();
if (!NumItems || (CSE_ALifeInventoryItem::FLAG_NO_POSITION == NumItems)) return;
position_Import (P,N) ;
net_updateData *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);
// m_bInterpolate = true;
}
Level().AddObject_To_Objects4CrPr (m_object);
object().CrPr_SetActivated (false);
object().CrPr_SetActivationStep (0);
p->NET_IItem.push_back (N);
while (p->NET_IItem.size() > 2)
{
p->NET_IItem.pop_front ();
};
};
示例4: OnEvent
void CExplosive::OnEvent(NET_Packet& P, u16 type)
{
switch (type) {
case GE_GRENADE_EXPLODE : {
Fvector pos, normal;
u16 parent_id;
P.r_u16(parent_id);
P.r_vec3(pos);
P.r_vec3(normal);
SetInitiator(parent_id);
ExplodeParams(pos,normal);
Explode();
m_fExplodeDuration = m_fExplodeDurationMax;
break;
}
}
}
示例5: net_Import_PH_Params
void CPhysicObject::net_Import_PH_Params(NET_Packet& P, net_update_PItem& N, mask_num_items& num_items)
{
//N.State.force.set (0.f,0.f,0.f);
//N.State.torque.set (0.f,0.f,0.f);
//UI().Font().pFontStat->OutSet(100.0f,100.0f);
P.r_vec3 (N.State.force);
//Msg("Import N.State.force.y:%4.6f",N.State.force.y);
P.r_vec3 (N.State.torque);
P.r_vec3 (N.State.position);
//Msg("Import N.State.position.y:%4.6f",N.State.position.y);
P.r_float(N.State.quaternion.x);
P.r_float(N.State.quaternion.y);
P.r_float(N.State.quaternion.z);
P.r_float(N.State.quaternion.w);
N.State.enabled = num_items.mask & CSE_ALifeObjectPhysic::inventory_item_state_enabled;
//UI().Font().pFontStat->OutNext("Import N.State.enabled:%i",int(N.State.enabled));
if (!(num_items.mask & CSE_ALifeObjectPhysic::inventory_item_angular_null)) {
N.State.angular_vel.x = P.r_float();
N.State.angular_vel.y = P.r_float();
N.State.angular_vel.z = P.r_float();
}
else
N.State.angular_vel.set (0.f,0.f,0.f);
if (!(num_items.mask & CSE_ALifeObjectPhysic::inventory_item_linear_null)) {
N.State.linear_vel.x = P.r_float();
N.State.linear_vel.y = P.r_float();
N.State.linear_vel.z = P.r_float();
}
else
N.State.linear_vel.set (0.f,0.f,0.f);
//Msg("Import N.State.linear_vel.y:%4.6f",N.State.linear_vel.y);
N.State.previous_position = N.State.position;
N.State.previous_quaternion = N.State.quaternion;
}
示例6: 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);
}
示例7: OnEvent
void CInventoryItem::OnEvent (NET_Packet& P, u16 type)
{
switch (type)
{
case GE_ADDON_ATTACH:
{
u32 ItemID;
P.r_u32 (ItemID);
CInventoryItem* ItemToAttach = smart_cast<CInventoryItem*>(Level().Objects.net_Find(ItemID));
if (!ItemToAttach) break;
Attach(ItemToAttach,true);
CActor* pActor = smart_cast<CActor*>(object().H_Parent());
if (pActor && pActor->inventory().ActiveItem() == this)
{
pActor->inventory().SetPrevActiveSlot(pActor->inventory().GetActiveSlot());
pActor->inventory().Activate(NO_ACTIVE_SLOT);
}
}break;
case GE_ADDON_DETACH:
{
string64 i_name;
P.r_stringZ (i_name);
Detach(i_name, true);
CActor* pActor = smart_cast<CActor*>(object().H_Parent());
if (pActor && pActor->inventory().ActiveItem() == this)
{
pActor->inventory().SetPrevActiveSlot(pActor->inventory().GetActiveSlot());
pActor->inventory().Activate(NO_ACTIVE_SLOT);
};
}break;
case GE_CHANGE_POS:
{
Fvector p;
P.r_vec3(p);
CPHSynchronize* pSyncObj = NULL;
pSyncObj = object().PHGetSyncItem(0);
if (!pSyncObj) return;
SPHNetState state;
pSyncObj->get_State(state);
state.position = p;
state.previous_position = p;
pSyncObj->set_State(state);
}break;
}
}
示例8: movement
void CAI_Stalker::net_Import (NET_Packet& P)
{
R_ASSERT (Remote());
net_update N;
u8 flags;
P.r_float ();
set_money ( P.r_u32(), false );
float health;
P.r_float (health);
SetfHealth (health);
// fEntityHealth = 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 graph_vertex_id = movement().game_dest_vertex_id();
P.r (&graph_vertex_id, sizeof(GameGraph::_GRAPH_ID));
graph_vertex_id = ai_location().game_vertex_id();
P.r (&graph_vertex_id, sizeof(GameGraph::_GRAPH_ID));
if (NET.empty() || (NET.back().dwTimeStamp<N.dwTimeStamp)) {
NET.push_back (N);
NET_WasInterpolating = TRUE;
}
P.r_float ();
P.r_float ();
P.r_stringZ (m_sStartDialog);
setVisible (TRUE);
setEnabled (TRUE);
}
示例9: net_Load
void SPHBonesData::net_Load(NET_Packet &P)
{
bones.clear ();
bones_mask =P.r_u64();
root_bone =P.r_u16();
Fvector _mn, _mx;
P.r_vec3 (_mn);
P.r_vec3 (_mx);
set_min_max (_mn, _mx);
u16 bones_number =P.r_u16();//bones number /**/
for(int i=0;i<bones_number;i++)
{
SPHNetState S;
S.net_Load(P,get_min(),get_max());
bones.push_back(S);
}
}
示例10: check
void CSE_ALifeInventoryItem::UPDATE_Read (NET_Packet &tNetPacket)
{
tNetPacket.r_u8 (m_u8NumItems);
if (!m_u8NumItems) {
return;
}
mask_num_items num_items;
num_items.common = m_u8NumItems;
m_u8NumItems = num_items.num_items;
R_ASSERT2 (
m_u8NumItems < (u8(1) << 5),
make_string("%d",m_u8NumItems)
);
tNetPacket.r_vec3 (State.position);
tNetPacket.r_float_q8 (State.quaternion.x,0.f,1.f);
tNetPacket.r_float_q8 (State.quaternion.y,0.f,1.f);
tNetPacket.r_float_q8 (State.quaternion.z,0.f,1.f);
tNetPacket.r_float_q8 (State.quaternion.w,0.f,1.f);
State.enabled = check(num_items.mask,inventory_item_state_enabled);
if (!check(num_items.mask,inventory_item_angular_null)) {
tNetPacket.r_float_q8 (State.angular_vel.x,0.f,10*PI_MUL_2);
tNetPacket.r_float_q8 (State.angular_vel.y,0.f,10*PI_MUL_2);
tNetPacket.r_float_q8 (State.angular_vel.z,0.f,10*PI_MUL_2);
}
else
State.angular_vel.set (0.f,0.f,0.f);
if (!check(num_items.mask,inventory_item_linear_null)) {
tNetPacket.r_float_q8 (State.linear_vel.x,-32.f,32.f);
tNetPacket.r_float_q8 (State.linear_vel.y,-32.f,32.f);
tNetPacket.r_float_q8 (State.linear_vel.z,-32.f,32.f);
}
else
State.linear_vel.set (0.f,0.f,0.f);
};
示例11:
void SHit::Read_Packet_Cont (NET_Packet Packet)
{
Packet.r_u16 (whoID);
Packet.r_u16 (weaponID);
Packet.r_dir (dir);
Packet.r_float (power);
Packet.r_u16 (boneID);
Packet.r_vec3 (p_in_bone_space);
Packet.r_float (impulse);
aim_bullet = Packet.r_u16()!=0;
hit_type = (ALife::EHitType)Packet.r_u16(); //hit type
if (hit_type == ALife::eHitTypeFireWound)
{
Packet.r_float (ap);
}
if (PACKET_TYPE == GE_HIT_STATISTIC)
{
Packet.r_u32(BulletID);
Packet.r_u32(SenderID);
}
}
示例12: net_Import
void CAI_Rat::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_angle8 (N.o_model);
P.r_angle8 (N.o_torso.yaw);
P.r_angle8 (N.o_torso.pitch);
P.r_angle8 (N.o_torso.roll );
id_Team = P.r_u8();
id_Squad = P.r_u8();
id_Group = P.r_u8();
GameGraph::_GRAPH_ID t;
P.r (&t, sizeof(t));
P.r (&t, sizeof(t));
ai_location().game_vertex (t);
if (NET.empty() || (NET.back().dwTimeStamp<N.dwTimeStamp)) {
NET.push_back (N);
NET_WasInterpolating = TRUE;
}
setVisible (TRUE);
setEnabled (TRUE);
CEatableItem::net_Import(P);
}
示例13: NetSync
void CInventoryItem::net_Import (NET_Packet& P)
{
u8 NumItems = 0;
NumItems = P.r_u8();
if (!NumItems)
return;
net_update_IItem N;
N.State.force.set (0.f,0.f,0.f);
N.State.torque.set (0.f,0.f,0.f);
P.r_vec3 (N.State.position);
N.State.quaternion.x = P.r_float_q8(0.f,1.f);
N.State.quaternion.y = P.r_float_q8(0.f,1.f);
N.State.quaternion.z = P.r_float_q8(0.f,1.f);
N.State.quaternion.w = P.r_float_q8(0.f,1.f);
mask_num_items num_items;
num_items.common = NumItems;
NumItems = num_items.num_items;
N.State.enabled = num_items.mask & CSE_ALifeInventoryItem::inventory_item_state_enabled;
if (!(num_items.mask & CSE_ALifeInventoryItem::inventory_item_angular_null)) {
N.State.angular_vel.x = P.r_float_q8(0.f,10.f*PI_MUL_2);
N.State.angular_vel.y = P.r_float_q8(0.f,10.f*PI_MUL_2);
N.State.angular_vel.z = P.r_float_q8(0.f,10.f*PI_MUL_2);
}
else
N.State.angular_vel.set (0.f,0.f,0.f);
if (!(num_items.mask & CSE_ALifeInventoryItem::inventory_item_linear_null)) {
N.State.linear_vel.x = P.r_float_q8(-32.f,32.f);
N.State.linear_vel.y = P.r_float_q8(-32.f,32.f);
N.State.linear_vel.z = P.r_float_q8(-32.f,32.f);
}
else
N.State.linear_vel.set (0.f,0.f,0.f);
////////////////////////////////////////////
N.State.previous_position = N.State.position;
N.State.previous_quaternion = N.State.quaternion;
net_updateData *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 (m_object);
object().CrPr_SetActivated (false);
object().CrPr_SetActivationStep (0);
p->NET_IItem.push_back (N);
while (p->NET_IItem.size() > 2)
{
p->NET_IItem.pop_front ();
};
};
示例14: timeServer
void CLevel::ProcessGameEvents ()
{
// Game events
{
NET_Packet P;
u32 svT = timeServer()-NET_Latency;
/*
if (!game_events->queue.empty())
Msg("- d[%d],ts[%d] -- E[svT=%d],[evT=%d]",Device.dwTimeGlobal,timeServer(),svT,game_events->queue.begin()->timestamp);
*/
#ifdef SPAWN_ANTIFREEZE
while (spawn_events->available(svT))
{
u16 ID, dest, type;
spawn_events->get(ID, dest, type, P);
game_events->insert(P);
}
u32 avail_time = 5;
u32 elps = Device.frame_elapsed();
if (elps < 30) avail_time = 33 - elps;
u32 work_limit = elps + avail_time;
#endif
while (game_events->available(svT))
{
u16 ID,dest,type;
game_events->get (ID,dest,type,P);
#ifdef SPAWN_ANTIFREEZE
// не отправлять события не заспавненным объектам
if (g_bootComplete && M_EVENT == ID && PostponedSpawn(dest))
{
spawn_events->insert(P);
continue;
}
if (g_bootComplete && M_SPAWN == ID && Device.frame_elapsed() > work_limit) // alpet: позволит плавнее выводить объекты в онлайн, без заметных фризов
{
u16 parent_id;
GetSpawnInfo(P, parent_id);
//-------------------------------------------------
if (parent_id < 0xffff) // откладывать спавн только объектов в контейнеры
{
//if (!spawn_events->available(svT))
//Msg("* ProcessGameEvents, spawn event postponed. Events rest = %d", game_events->queue.size());
spawn_events->insert(P);
continue;
}
}
#endif
switch (ID)
{
case M_SPAWN:
{
u16 dummy16;
P.r_begin(dummy16);
cl_Process_Spawn(P);
}break;
case M_EVENT:
{
cl_Process_Event(dest, type, P);
}break;
case M_MOVE_PLAYERS:
{
u8 Count = P.r_u8();
for (u8 i=0; i<Count; i++)
{
u16 ID = P.r_u16();
Fvector NewPos, NewDir;
P.r_vec3(NewPos);
P.r_vec3(NewDir);
CActor* OActor = smart_cast<CActor*>(Objects.net_Find (ID));
if (0 == OActor) break;
OActor->MoveActor(NewPos, NewDir);
};
NET_Packet PRespond;
PRespond.w_begin(M_MOVE_PLAYERS_RESPOND);
Send(PRespond, net_flags(TRUE, TRUE));
}break;
case M_STATISTIC_UPDATE:
{
if (GameID() != eGameIDSingle)
Game().m_WeaponUsageStatistic->OnUpdateRequest(&P);
}break;
case M_FILE_TRANSFER:
{
if (m_file_transfer) //in case of net_Stop
m_file_transfer->on_message(&P);
}break;
case M_GAMEMESSAGE:
{
Game().OnGameMessage(P);
}break;
default:
{
VERIFY(0);
}break;
//.........这里部分代码省略.........
示例15: OnEvent
//.........这里部分代码省略.........
Msg("--- Actor [%d][%s] %s [%d][%s]", ID(), Name(), act, GO->ID(), GO->cNameSect().c_str());
#endif // MP_LOGGING
VERIFY( GO->H_Parent() );
if ( !GO->H_Parent() )
{
Msg("! ERROR: Actor [%d][%s] tries to reject item [%d][%s] that has no parent",
ID(), Name(), GO->ID(), GO->cNameSect().c_str());
break;
}
VERIFY2( GO->H_Parent()->ID() == ID(),
make_string("actor [%d][%s] tries to drop not own object [%d][%s]",
ID(), Name(), GO->ID(), GO->cNameSect().c_str() ).c_str() );
if ( GO->H_Parent()->ID() != ID() )
{
CActor* real_parent = smart_cast<CActor*>(GO->H_Parent());
Msg("! ERROR: Actor [%d][%s] tries to drop not own item [%d][%s], his parent is [%d][%s]",
ID(), Name(), GO->ID(), GO->cNameSect().c_str(), real_parent->ID(), real_parent->Name());
break;
}
if (!Obj->getDestroy() && inventory().DropItem(GO, just_before_destroy, dont_create_shell))
{
//O->H_SetParent(0,just_before_destroy);//moved to DropItem
//feel_touch_deny(O,2000);
Level().m_feel_deny.feel_touch_deny(Obj, 1000);
// [12.11.07] Alexander Maniluk: extended GE_OWNERSHIP_REJECT packet for drop item to selected position
Fvector dropPosition;
if (!P.r_eof())
{
P.r_vec3(dropPosition);
GO->MoveTo(dropPosition);
//Other variant :)
/*NET_Packet MovePacket;
MovePacket.w_begin(M_MOVE_ARTEFACTS);
MovePacket.w_u8(1);
MovePacket.w_u16(id);
MovePacket.w_vec3(dropPosition);
u_EventSend(MovePacket);*/
}
}
if (!just_before_destroy)
SelectBestWeapon(Obj);
}
break;
case GE_INV_ACTION:
{
u16 cmd;
P.r_u16 (cmd);
u32 flags;
P.r_u32 (flags);
s32 ZoomRndSeed = P.r_s32();
s32 ShotRndSeed = P.r_s32();
if (!IsGameTypeSingle() && !g_Alive())
{
// Msg("! WARNING: dead player tries to rize inventory action");
break;
}
if (flags & CMD_START)
{