예제 #1
0
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);
}
void game_cl_CaptureTheArtefact::OnBuyMenu_Ok()
{
#ifdef DEBUG
	Msg("* CTA: Buy menu OK...");
#endif // #ifdef DEBUG
	typedef CUIGameCTA::BuyMenuItemsCollection TBuyCol;

	VERIFY2(m_game_ui, "game ui not initialized");
	CUIGameCTA::BuyMenuItemsCollection toBuyItemsCollection;
	s32 moneyDif = 0;
	m_game_ui->GetPurchaseItems(toBuyItemsCollection, moneyDif);
	R_ASSERT(local_player);
	if (local_player->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD))
	{
		if (InWarmUp())
		{
			buy_amount =  0;
		} else 
		{
			buy_amount = moneyDif;
		}
		UpdateMoneyIndicator();
	}
	
	
	CGameObject* pPlayer = smart_cast<CGameObject*>(Level().CurrentEntity());
	VERIFY(pPlayer);
	
	NET_Packet P;
	pPlayer->u_EventGen(P, GE_GAME_EVENT, pPlayer->ID());
	P.w_u16(GAME_EVENT_PLAYER_BUY_FINISHED);
	if (InWarmUp())
	{
		P.w_s32(0);
	} else
	{
		P.w_s32(moneyDif);
	}
	P.w_u16(static_cast<u16>(toBuyItemsCollection.size()));

	TBuyCol::const_iterator bie = toBuyItemsCollection.end();
	
	for (TBuyCol::const_iterator toBuyIter = toBuyItemsCollection.begin();
		toBuyIter != bie; ++toBuyIter)
	{
		P.w_u8(toBuyIter->first);
		P.w_u8(toBuyIter->second);
	}

	pPlayer->u_EventSend(P);
	
	if (local_player->testFlag(GAME_PLAYER_FLAG_VERY_VERY_DEAD))
	{
		u_EventGen(P, GE_GAME_EVENT, local_player->GameID);
		P.w_u16(GAME_EVENT_PLAYER_BUYMENU_CLOSE);
		u_EventSend(P);
	}
	set_buy_menu_not_ready();
}
예제 #3
0
void CInventory::SendActionEvent(s32 cmd, u32 flags)
{
    CActor *pActor = smart_cast<CActor*>(m_pOwner);
    if (!pActor) return;

    NET_Packet		P;
    pActor->u_EventGen		(P,GE_INV_ACTION, pActor->ID());
    P.w_s32					(cmd);
    P.w_u32					(flags);
    P.w_s32					(pActor->GetZoomRndSeed());
    P.w_s32					(pActor->GetShotRndSeed());
    pActor->u_EventSend		(P);
};
예제 #4
0
void	game_PlayerState::net_Export(NET_Packet& P, BOOL Full)
{
	P.w_u8			(Full ? 1 : 0);
	if (Full)
		P.w_stringZ		(	name	);

	P.w_u8			(	team			);
	P.w_s16			(	m_iRivalKills	);
	P.w_s16			(	m_iSelfKills	);
	P.w_s16			(	m_iTeamKills	);
	P.w_s16			(	m_iDeaths		);
	P.w_s32			(	money_for_round	);
	P.w_float_q8	(	experience_D, -1.0f, 2.0f);
	P.w_u8			(	rank		);
	P.w_u8			(	af_count	);
	P.w_u16			(	flags__	);
	P.w_u16			(	ping	);

	P.w_u16			(	GameID	);
	P.w_s8			(	skin	);
	P.w_u8			(	m_bCurrentVoteAgreed	);

	P.w_u32			(Device.dwTimeGlobal - DeathTime);
};
예제 #5
0
void CEatableItem::net_Export(NET_Packet& P)
{
	inherited::net_Export(P);
	P.w_s32(m_iPortionsNum);
}
예제 #6
0
파일: phantom.cpp 프로젝트: 2asoft/xray
//---------------------------------------------------------------------
// Core events
void CPhantom::save(NET_Packet &output_packet)
{
	output_packet.w_s32	(s32(m_CurState));
}
void CSE_ALifeItemEatable::UPDATE_Write(NET_Packet	&tNetPacket)
{
	inherited::UPDATE_Write(tNetPacket);	
	// if (m_wVersion > 118)
		tNetPacket.w_s32(m_portions_num);
}