本文整理汇总了C++中NET_Packet::w_float方法的典型用法代码示例。如果您正苦于以下问题:C++ NET_Packet::w_float方法的具体用法?C++ NET_Packet::w_float怎么用?C++ NET_Packet::w_float使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NET_Packet
的用法示例。
在下文中一共展示了NET_Packet::w_float方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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()));
}
示例2: save
void CActorCondition::save(NET_Packet &output_packet)
{
inherited::save (output_packet);
save_data (m_fAlcohol, output_packet);
save_data (m_condition_flags, output_packet);
save_data (m_fSatiety, output_packet);
save_data (m_curr_medicine_influence.fHealth, output_packet);
save_data (m_curr_medicine_influence.fPower, output_packet);
save_data (m_curr_medicine_influence.fSatiety, output_packet);
save_data (m_curr_medicine_influence.fRadiation, output_packet);
save_data (m_curr_medicine_influence.fWoundsHeal, output_packet);
save_data (m_curr_medicine_influence.fMaxPowerUp, output_packet);
save_data (m_curr_medicine_influence.fAlcohol, output_packet);
save_data (m_curr_medicine_influence.fTimeTotal, output_packet);
save_data (m_curr_medicine_influence.fTimeCurrent, output_packet);
output_packet.w_u8((u8)m_booster_influences.size());
BOOSTER_MAP::iterator b = m_booster_influences.begin(), e = m_booster_influences.end();
for(; b!=e; b++)
{
output_packet.w_u8((u8)b->second.m_type);
output_packet.w_float(b->second.fBoostValue);
output_packet.w_float(b->second.fBoostTime);
}
}
示例3: save
void SHeliBodyState::save(NET_Packet &output_packet)
{
output_packet.w_s16((s16)type);
output_packet.w_u8(b_looking_at_point ? 1 : 0);
output_packet.w_float(currBodyHPB.x);
output_packet.w_float(currBodyHPB.y);
output_packet.w_float(currBodyHPB.z);
}
示例4: STATE_Write
void CSE_SmartCover::STATE_Write(NET_Packet &tNetPacket)
{
inherited1::STATE_Write (tNetPacket);
cform_write (tNetPacket);
tNetPacket.w_stringZ (m_description);
tNetPacket.w_float (m_hold_position_time);
tNetPacket.w_float (m_enter_min_enemy_distance);
tNetPacket.w_float (m_exit_min_enemy_distance);
tNetPacket.w_u8 ((u8)m_is_combat_cover);
tNetPacket.w_u8 ((u8)m_can_fire);
}
示例5:
void game_sv_GameState::net_Export_GameTime (NET_Packet& P)
{
//#pragma todo("It should be done via single message, why always pass this data?")
//#if 0
//Syncronize GameTime
P.w_u64(GetGameTime());
P.w_float(GetGameTimeFactor());
//Syncronize EnvironmentGameTime
P.w_u64(GetEnvironmentGameTime());
P.w_float(GetEnvironmentGameTimeFactor());
//#endif
};
示例6: position_Export
void CInventoryItem::position_Export(NET_Packet& P,SPHNetState &State)
{
P.w_u8 ( State.enabled );
P.w_vec3 ( State.angular_vel);
P.w_vec3 ( State.linear_vel);
P.w_vec3 ( State.force );
P.w_vec3 ( State.torque );
P.w_float ( State.quaternion.x );
P.w_float ( State.quaternion.y );
P.w_float ( State.quaternion.z );
P.w_float ( State.quaternion.w );
}
示例7: SaveNetState
void CCar::SaveNetState(NET_Packet& P)
{
CPHSkeleton::SaveNetState (P);
P.w_vec3(Position());
Fvector Angle;
XFORM().getXYZ(Angle);
P.w_vec3(Angle);
{
xr_map<u16,SDoor>::iterator i,e;
i=m_doors.begin();
e=m_doors.end();
P.w_u16(u16(m_doors.size()));
for(;i!=e;++i)
i->second.SaveNetState(P);
}
{
xr_map<u16,SWheel>::iterator i,e;
i=m_wheels_map.begin();
e=m_wheels_map.end();
P.w_u16(u16(m_wheels_map.size()));
for(;i!=e;++i)
i->second.SaveNetState(P);
}
P.w_float(GetfHealth());
}
示例8: object
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);
};
示例9: base
void CSE_ALifeInventoryItem::STATE_Write (NET_Packet &tNetPacket)
{
if (auto item = smart_cast<CInventoryItem*>(Level().Objects.net_Find(base()->ID) ) )
m_fCondition = item->GetCondition();
tNetPacket.w_float (m_fCondition);
State.position = base()->o_Position;
}
示例10:
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);
}
}
示例11: net_Export
void CAI_Rat::net_Export(NET_Packet& P)
{
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 (N.o_model);
P.w_float (N.o_torso.yaw);
P.w_float (N.o_torso.pitch);
P.w_float (N.o_torso.roll);
P.w_u8 (u8(g_Team()));
P.w_u8 (u8(g_Squad()));
P.w_u8 (u8(g_Group()));
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 (&m_fGoingSpeed, sizeof(m_fGoingSpeed));
// P.w (&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.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));
}
CEatableItem::net_Export(P);
}
示例12: save
void CInventoryItem::save(NET_Packet &packet)
{
packet.w_u16 (m_ItemCurrPlace.value);
packet.w_float (m_fCondition);
//-- save_data (m_upgrades, packet);
if (object().H_Parent()) {
packet.w_u8 (0);
return;
}
u8 _num_items = (u8)object().PHGetSyncItemsNumber();
packet.w_u8 (_num_items);
object().PHSaveState (packet);
}
示例13: save
void CInventoryItem::save(NET_Packet &packet)
{
packet.w_u8 ((u8)m_eItemPlace);
packet.w_float (m_fCondition);
#pragma message("alpet: здесь можно сохранять все слоты, но это будет несовместимо по формату сейвов")
packet.w_u8 ((u8)GetSlot());
if (object().H_Parent()) {
packet.w_u8 (0);
return;
}
u8 _num_items = (u8)object().PHGetSyncItemsNumber();
packet.w_u8 (_num_items);
object().PHSaveState (packet);
}
示例14: save
void CHelicopter::save(NET_Packet &output_packet)
{
m_movement.save (output_packet);
m_body.save (output_packet);
m_enemy.save (output_packet);
output_packet.w_vec3(XFORM().c);
output_packet.w_float(m_barrel_dir_tolerance);
save_data (m_use_rocket_on_attack, output_packet);
save_data (m_use_mgun_on_attack, output_packet);
save_data (m_min_rocket_dist, output_packet);
save_data (m_max_rocket_dist, output_packet);
save_data (m_min_mgun_dist, output_packet);
save_data (m_max_mgun_dist, output_packet);
save_data (m_time_between_rocket_attack, output_packet);
save_data (m_syncronize_rocket, output_packet);
}
示例15:
void CSE_ALifeInventoryItem::UPDATE_Write (NET_Packet &tNetPacket)
{
if (!m_u8NumItems) {
tNetPacket.w_u8 (0);
return;
}
mask_num_items num_items;
num_items.mask = 0;
num_items.num_items = m_u8NumItems;
R_ASSERT2 (
num_items.num_items < (u8(1) << 5),
make_string("%d",num_items.num_items)
);
if (State.enabled) num_items.mask |= inventory_item_state_enabled;
if (fis_zero(State.angular_vel.square_magnitude())) num_items.mask |= inventory_item_angular_null;
if (fis_zero(State.linear_vel.square_magnitude())) num_items.mask |= inventory_item_linear_null;
//if (anim_use) num_items.mask |= animated;
tNetPacket.w_u8 (num_items.common);
/*if(check(num_items.mask,animated))
{
tNetPacket.w_float (m_blend_timeCurrent);
}*/
{
tNetPacket.w_vec3 (State.force);
tNetPacket.w_vec3 (State.torque);
tNetPacket.w_vec3 (State.position);
tNetPacket.w_float (State.quaternion.x);
tNetPacket.w_float (State.quaternion.y);
tNetPacket.w_float (State.quaternion.z);
tNetPacket.w_float (State.quaternion.w);
if (!check(num_items.mask,inventory_item_angular_null)) {
tNetPacket.w_float (State.angular_vel.x);
tNetPacket.w_float (State.angular_vel.y);
tNetPacket.w_float (State.angular_vel.z);
}
if (!check(num_items.mask,inventory_item_linear_null)) {
tNetPacket.w_float (State.linear_vel.x);
tNetPacket.w_float (State.linear_vel.y);
tNetPacket.w_float (State.linear_vel.z);
}
}
tNetPacket.w_u8(1); // not freezed - doesn't mean anything...
};