예제 #1
0
void				CLevel::OnMessage				(void* data, u32 size)
{	
	DemoCS.Enter();

	if (IsDemoPlay() ) 
	{
		if (m_bDemoStarted) 
		{
			DemoCS.Leave();
			return;
		}
		
		if (!m_aDemoData.empty() && net_IsSyncronised())
		{
//			NET_Packet *P = &(m_aDemoData.front());
			DemoDataStruct *P = &(m_aDemoData.front());
			u32 CurTime = timeServer_Async();
			timeServer_UserDelta(P->m_dwTimeReceive - CurTime);
			m_bDemoStarted = TRUE;
			Msg("! ------------- Demo Started ------------");
			m_dwCurDemoFrame = P->m_dwFrame;
			DemoCS.Leave();
			return;
		}
	};	

	if (IsDemoSave() && net_IsSyncronised()) 
	{
		Demo_StoreData(data, size, DATA_CLIENT_PACKET);
	}	

	IPureClient::OnMessage(data, size);	

	DemoCS.Leave();
};
예제 #2
0
void						CLevel::Demo_StartFrame			()
{
	if (!IsDemoSave() || !net_IsSyncronised()) return;

	DemoCS.Enter();

	DemoFrameTime CurFrameTime;
	CurFrameTime.dwTimeDelta = Device.dwTimeDelta;
	CurFrameTime.dwTimeGlobal = Device.dwTimeGlobal;
	CurFrameTime.dwTimeServer = Level().timeServer();
	CurFrameTime.dwTimeServer_Delta = Level().timeServer_Delta();
	CurFrameTime.fTimeDelta = Device.fTimeDelta;
	CurFrameTime.fTimeGlobal= Device.fTimeGlobal;

	Demo_StoreData(&CurFrameTime, sizeof(CurFrameTime), DATA_FRAME);

	DemoCS.Leave();
};
예제 #3
0
void CLevel::ClientSend()
{
	if (!GameID() == GAME_SINGLE || OnClient())
	if (GameID() == GAME_SINGLE || OnClient())
	{
		if ( !net_HasBandwidth() ) return;
	};

#ifdef BATTLEYE
	battleye_system.UpdateClient();
#endif // BATTLEYE

	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())
					{
						if (net_IsSyncronised() && IsDemoSave()) 
						{
							DemoCS.Enter();
							Demo_StoreData(P.B.data, P.B.count, DATA_CLIENT_PACKET);
							DemoCS.Leave();
						}						
					}
					else
						Send	(P, net_flags(FALSE));
				}				
			}			
		}		
	};
	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;
	}

}