本文整理汇总了C++中NET_Packet::w_u32方法的典型用法代码示例。如果您正苦于以下问题:C++ NET_Packet::w_u32方法的具体用法?C++ NET_Packet::w_u32怎么用?C++ NET_Packet::w_u32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NET_Packet
的用法示例。
在下文中一共展示了NET_Packet::w_u32方法的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: Level
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();
};
示例3: OnPlayerChangeTeam
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);
}
示例4:
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));
};
示例5:
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);
}
示例6: u_EventGen
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);
}
示例7: u_EventGen
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));
}
示例8: KillEntity
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));
}
};
示例9: 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);
};
示例10: ClientSend
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;
}
}
示例11: SendPacket
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() );
}
示例12: save
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);
}
示例13:
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);
};
示例14: objects
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);
}
}
示例15: death_glide_start
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());
//////////////////////////////////////////////////////////////////////////
}