예제 #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_EndFrame			()
{
	if (IsDemoPlay() && m_bDemoPlayByFrame)
		m_dwCurDemoFrame+=dFrame;		
	else
		m_dwCurDemoFrame++;	

	dFrame = g_dwDemoDeltaFrame;
};
예제 #3
0
파일: Level.cpp 프로젝트: OLR-xray/OLR-3.0
bool CLevel::IsClient ()
{
//	return (!Server);
	if (IsDemoPlay())
	{
		return IsClientDemo();
	};	
	if (!Server) return true;
	return (Server->client_Count() == 0);
}
예제 #4
0
파일: Level.cpp 프로젝트: OLR-xray/OLR-3.0
	/*
	for (xr_vector<CObject*>::iterator O=Level().Objects.objects.begin(); O!=Level().Objects.objects.end(); ++O) 
	{
		if( (*O)->CLS_ID == CLSID_OBJECT_ACTOR){
			CActor* pActor = smart_cast<CActor*>(*O);
			if (!pActor || pActor->Remote()) continue;
				pActor->UpdatePosStack(Time0, Time1);
		}
	};
	*/
};

void				CLevel::SetNumCrSteps		( u32 NumSteps )
{
	m_bNeed_CrPr = true;
	if (m_dwNumSteps > NumSteps) return;
	m_dwNumSteps = NumSteps;
	if (m_dwNumSteps > 1000000)
	{
		VERIFY(0);
	}
};


ALife::_TIME_ID CLevel::GetGameTime()
{
	return			(game->GetGameTime());
//	return			(Server->game->GetGameTime());
}

ALife::_TIME_ID CLevel::GetEnvironmentGameTime()
{
	return			(game->GetEnvironmentGameTime());
//	return			(Server->game->GetGameTime());
}

u8 CLevel::GetDayTime() 
{ 
	u32 dummy32;
	u32 hours;
	GetGameDateTime(dummy32, dummy32, dummy32, hours, dummy32, dummy32, dummy32);
	VERIFY	(hours<256);
	return	u8(hours); 
}

float CLevel::GetGameDayTimeSec()
{
	return	(float(s64(GetGameTime() % (24*60*60*1000)))/1000.f);
}

u32 CLevel::GetGameDayTimeMS()
{
	return	(u32(s64(GetGameTime() % (24*60*60*1000))));
}

float CLevel::GetEnvironmentGameDayTimeSec()
{
	return	(float(s64(GetEnvironmentGameTime() % (24*60*60*1000)))/1000.f);
}

void CLevel::GetGameDateTime	(u32& year, u32& month, u32& day, u32& hours, u32& mins, u32& secs, u32& milisecs)
{
	split_time(GetGameTime(), year, month, day, hours, mins, secs, milisecs);
}


float CLevel::GetGameTimeFactor()
{
	return			(game->GetGameTimeFactor());
//	return			(Server->game->GetGameTimeFactor());
}

void CLevel::SetGameTimeFactor(const float fTimeFactor)
{
	game->SetGameTimeFactor(fTimeFactor);
//	Server->game->SetGameTimeFactor(fTimeFactor);
}

void CLevel::SetGameTimeFactor(ALife::_TIME_ID GameTime, const float fTimeFactor)
{
	game->SetGameTimeFactor(GameTime, fTimeFactor);
//	Server->game->SetGameTimeFactor(fTimeFactor);
}
void CLevel::SetEnvironmentGameTimeFactor(ALife::_TIME_ID GameTime, const float fTimeFactor)
{
	game->SetEnvironmentGameTimeFactor(GameTime, fTimeFactor);
//	Server->game->SetGameTimeFactor(fTimeFactor);
}/*
void CLevel::SetGameTime(ALife::_TIME_ID GameTime)
{
	game->SetGameTime(GameTime);
//	Server->game->SetGameTime(GameTime);
}
*/
bool CLevel::IsServer ()
{
//	return (!!Server);
	if (IsDemoPlay())
	{
		return IsServerDemo();
	};	
	if (!Server) return false;
	return (Server->client_Count() != 0);

}
예제 #5
0
void CLevel::IR_OnMouseMove( int dx, int dy )
{
	if(g_bDisableAllInput)							return;
	if (g_actor) Actor()->callback(GameObject::eOnMouseMove)(dx, dy);//+
	
	if (pHUD->GetUI()->IR_OnMouseMove(dx,dy))		return;
	if (Device.Paused() && !IsDemoPlay() )	return;
	if (CURRENT_ENTITY())		{
		IInputReceiver*		IR	= smart_cast<IInputReceiver*>	(smart_cast<CGameObject*>(CURRENT_ENTITY()));
		if (IR)				IR->IR_OnMouseMove					(dx,dy);
	}
}
예제 #6
0
void CLevel::IR_OnMouseMove( int dx, int dy )
{
	if(g_bDisableAllInput)							return;
	if (CurrentGameUI()->IR_UIOnMouseMove(dx,dy))		return;
	if (Device.Paused() && !IsDemoPlay() 
#ifdef DEBUG
		&& !psActorFlags.test(AF_NO_CLIP) 
#endif //DEBUG
		)	return;
	if (CURRENT_ENTITY())		
	{
		IInputReceiver*		IR	= smart_cast<IInputReceiver*>	(smart_cast<CGameObject*>(CURRENT_ENTITY()));
		if (IR)				IR->IR_OnMouseMove					(dx,dy);
	}
}
예제 #7
0
void CLevel::net_Stop		()
{
	Msg							("- Disconnect");

	if(HUD().GetUI())
		HUD().GetUI()->UIGame()->HideShownDialogs();

	bReady						= false;
	m_bGameConfigStarted		= FALSE;

	if (m_file_transfer)
	{
		xr_delete(m_file_transfer);
	}


	if (IsDemoPlay() && m_current_spectator)	//destroying demo spectator ...
	{
		m_current_spectator->setDestroy	(TRUE);
		SetControlEntity(NULL); //m_current_spectator == CurrentControlEntity()
		m_current_spectator = NULL;
		
	}
	remove_objects				();
	
	//WARNING ! remove_objects() uses this flag, so position of this line must e here ..
	game_configured				= FALSE;
	
	IGame_Level::net_Stop		();
	IPureClient::Disconnect		();

	if (Server) {
		Server->Disconnect		();
		xr_delete				(Server);
	}

	if (!g_dedicated_server)
		ai().script_engine().collect_all_garbage	();

#ifdef DEBUG
	show_animation_stats		();
#endif // DEBUG
}
예제 #8
0
void CLevel::Send		(NET_Packet& P, u32 dwFlags, u32 dwTimeout)
{
	if (IsDemoPlay() && m_bDemoStarted) return;
	// optimize the case when server located in our memory
	if(psNET_direct_connect){
		ClientID	_clid;
		_clid.set	(1);
		Server->OnMessage	(P,	_clid );
	}else
	if (Server && game_configured && OnServer() )
	{
		Server->OnMessage	(P,Game().local_svdpnid	);
	}else											
		IPureClient::Send	(P,dwFlags,dwTimeout	);

	if (g_pGameLevel && Level().game && GameID() != GAME_SINGLE && !g_SV_Disable_Auth_Check)		{
		// anti-cheat
		phTimefactor		= 1.f					;
		psDeviceFlags.set	(rsConstantFPS,FALSE)	;	
	}
}
예제 #9
0
void CLevel::IR_OnMouseMove(int dx, int dy)
{
    if (g_bDisableAllInput)							return;

#ifdef MOUSE_MOVE_CALLBACK
/* avo: script callback */
    if (g_actor) g_actor->callback(GameObject::eMouseMove)(dx, dy);
    /* avo: end */
#endif // MOUSE_MOVE_CALLBACK

    if (CurrentGameUI()->IR_UIOnMouseMove(dx, dy))		return;
    if (Device.Paused() && !IsDemoPlay()
#ifdef DEBUG
        && !psActorFlags.test(AF_NO_CLIP)
#endif //DEBUG
        )	return;
    if (CURRENT_ENTITY())
    {
        IInputReceiver*		IR = smart_cast<IInputReceiver*>	(smart_cast<CGameObject*>(CURRENT_ENTITY()));
        if (IR)				IR->IR_OnMouseMove(dx, dy);
    }
}
예제 #10
0
CLevel::~CLevel()
{
	xr_delete					(g_player_hud);
	delete_data					(hud_zones_list);
	hud_zones_list				= NULL;

	Msg							("- Destroying level");

	Engine.Event.Handler_Detach	(eEntitySpawn,	this);

	Engine.Event.Handler_Detach	(eEnvironment,	this);
	Engine.Event.Handler_Detach	(eChangeTrack,	this);
	Engine.Event.Handler_Detach	(eDemoPlay,		this);
	Engine.Event.Handler_Detach	(eChangeRP,		this);

	if (ph_world)
	{
		ph_world->Destroy		();
		xr_delete				(ph_world);
	}

	// destroy PSs
	for (POIt p_it=m_StaticParticles.begin(); m_StaticParticles.end()!=p_it; ++p_it)
		CParticlesObject::Destroy(*p_it);
	m_StaticParticles.clear		();

	// Unload sounds
	// unload prefetched sounds
	sound_registry.clear		();

	// unload static sounds
	for (u32 i=0; i<static_Sounds.size(); ++i){
		static_Sounds[i]->destroy();
		xr_delete				(static_Sounds[i]);
	}
	static_Sounds.clear			();

	xr_delete					(m_level_sound_manager);

	xr_delete					(m_space_restriction_manager);

	xr_delete					(m_seniority_hierarchy_holder);
	
	xr_delete					(m_client_spawn_manager);

	xr_delete					(m_autosave_manager);
	
#ifdef DEBUG
	xr_delete					(m_debug_renderer);
#endif

	if (!g_dedicated_server)
		ai().script_engine().remove_script_process(ScriptEngine::eScriptProcessorLevel);

	xr_delete					(game);
	xr_delete					(game_events);
#ifdef   SPAWN_ANTIFREEZE
	xr_delete(spawn_events);
#endif

	//by Dandy
	//destroy fog of war
//	xr_delete					(m_pFogOfWar);
	//destroy bullet manager
	xr_delete					(m_pBulletManager);
	//-----------------------------------------------------------
	xr_delete					(pStatGraphR);
	xr_delete					(pStatGraphS);

	//-----------------------------------------------------------
	xr_delete					(m_ph_commander);
	xr_delete					(m_ph_commander_scripts);
	//-----------------------------------------------------------
	pObjects4CrPr.clear();
	pActors4CrPr.clear();

	ai().unload					();
	//-----------------------------------------------------------	
#ifdef DEBUG	
	xr_delete					(m_level_debug);
#endif
	//-----------------------------------------------------------
	xr_delete					(m_map_manager);
	delete_data					(m_game_task_manager);
//	xr_delete					(m_pFogOfWarMngr);
	
	// here we clean default trade params
	// because they should be new for each saved/loaded game
	// and I didn't find better place to put this code in
	CTradeParameters::clean		();

	if(g_tutorial && g_tutorial->m_pStoredInputReceiver==this)
		g_tutorial->m_pStoredInputReceiver = NULL;

	if(g_tutorial2 && g_tutorial2->m_pStoredInputReceiver==this)
		g_tutorial2->m_pStoredInputReceiver = NULL;

	if (IsDemoPlay())
	{
		StopPlayDemo();
	}
	xr_delete(m_msg_filter);
	if (IsDemoSave())
	{
		StopSaveDemo();
	}
}
예제 #11
0
void CLevel::IR_OnKeyboardPress	(int key)
{
	if(Device.dwPrecacheFrame)
		return;

#ifdef INGAME_EDITOR
	if (Device.editor() && (pInput->iGetAsyncKeyState(DIK_LALT) || pInput->iGetAsyncKeyState(DIK_RALT)))
		return;
#endif // #ifdef INGAME_EDITOR

	bool b_ui_exist = (!!CurrentGameUI());

	EGameActions _curr = get_binded_action(key);

	if(_curr==kPAUSE)
	{
		#ifdef INGAME_EDITOR
			if (Device.editor())	return;
		#endif // INGAME_EDITOR

		if (!g_block_pause && (IsGameTypeSingle() || IsDemoPlay()))
		{
#ifdef DEBUG
			if(psActorFlags.test(AF_NO_CLIP))
				Device.Pause(!Device.Paused(), TRUE, TRUE, "li_pause_key_no_clip");
			else
#endif //DEBUG
				Device.Pause(!Device.Paused(), TRUE, TRUE, "li_pause_key");
		}
		return;
	}

	if(	g_bDisableAllInput )	return;

	switch ( _curr ) 
	{
	case kSCREENSHOT:
		Render->Screenshot();
		return;
		break;

	case kCONSOLE:
		Console->Show				();
		return;
		break;

	case kQUIT: 
		{
			if(b_ui_exist && CurrentGameUI()->TopInputReceiver() )
			{
					if(CurrentGameUI()->IR_UIOnKeyboardPress(key))	return;//special case for mp and main_menu
					CurrentGameUI()->TopInputReceiver()->HideDialog();
			}else
			{
				Console->Execute("main_menu");
			}return;
		}break;
	};

	if ( !bReady || !b_ui_exist )			return;

	if ( b_ui_exist && CurrentGameUI()->IR_UIOnKeyboardPress(key)) return;

	if ( Device.Paused() && !IsDemoPlay() 
#ifdef DEBUG
		&& !psActorFlags.test(AF_NO_CLIP) 
#endif //DEBUG
		)	return;

	if ( game && game->OnKeyboardPress(get_binded_action(key)) )	return;

	if(_curr == kQUICK_SAVE && IsGameTypeSingle())
	{
		Console->Execute			("save");
		return;
	}
	if(_curr == kQUICK_LOAD && IsGameTypeSingle())
	{
#ifdef DEBUG
		FS.get_path					("$game_config$")->m_Flags.set(FS_Path::flNeedRescan, TRUE);
		FS.get_path					("$game_scripts$")->m_Flags.set(FS_Path::flNeedRescan, TRUE);
		FS.rescan_pathes			();
#endif // DEBUG
		string_path					saved_game,command;
		strconcat					(sizeof(saved_game),saved_game,Core.UserName," - ","quicksave");
		if (!CSavedGameWrapper::valid_saved_game(saved_game))
			return;

		strconcat					(sizeof(command),command,"load ",saved_game);
		Console->Execute			(command);
		return;
	}

#ifndef MASTER_GOLD
	switch (key) {
	case DIK_F7: {
		if (GameID() != eGameIDSingle) return;
		FS.get_path					("$game_config$")->m_Flags.set(FS_Path::flNeedRescan, TRUE);
		FS.get_path					("$game_scripts$")->m_Flags.set(FS_Path::flNeedRescan, TRUE);
		FS.rescan_pathes			();
		NET_Packet					net_packet;
		net_packet.w_begin			(M_RELOAD_GAME);
		Send						(net_packet,net_flags(TRUE));
		return;
	}
	case DIK_DIVIDE: {
		if (!Server)
			break;

		SetGameTimeFactor			(g_fTimeFactor);

#ifdef DEBUG
		if(!m_bEnvPaused)
			SetEnvironmentGameTimeFactor(GetEnvironmentGameTime(), g_fTimeFactor);
#else //DEBUG
		SetEnvironmentGameTimeFactor(GetEnvironmentGameTime(), g_fTimeFactor);
#endif //DEBUG
		
		break;	
	}
	case DIK_MULTIPLY: {
		if (!Server)
			break;

		SetGameTimeFactor			(1000.f);
#ifdef DEBUG
		if(!m_bEnvPaused)
			SetEnvironmentGameTimeFactor(GetEnvironmentGameTime(), 1000.f);
#else //DEBUG
		SetEnvironmentGameTimeFactor(GetEnvironmentGameTime(), 1000.f);
#endif //DEBUG
		
		break;
	}
#ifdef DEBUG
	case DIK_SUBTRACT:{
		if (!Server)
			break;
		if(m_bEnvPaused)
			SetEnvironmentGameTimeFactor(GetEnvironmentGameTime(), g_fTimeFactor);
		else
			SetEnvironmentGameTimeFactor(GetEnvironmentGameTime(), 0.00001f);

		m_bEnvPaused = !m_bEnvPaused;
		break;
	}
#endif //DEBUG
	case DIK_NUMPAD5: 
		{
			if (GameID()!=eGameIDSingle) 
			{
				Msg("For this game type Demo Record is disabled.");
///				return;
			};
			if(!pInput->iGetAsyncKeyState(DIK_LSHIFT))
			{
				Console->Hide	();
				Console->Execute("demo_record 1");
			}
		}
		break;

#ifdef DEBUG

	// Lain: added TEMP!!!
	case DIK_UP:
	{
		g_separate_factor /= 0.9f;
		break;
	}
	case DIK_DOWN:
	{
		g_separate_factor *= 0.9f;
		if ( g_separate_factor < 0.1f )
		{
			g_separate_factor = 0.1f;
		}
		break;
	}
	case DIK_LEFT:
	{
		g_separate_radius *= 0.9f;
		if ( g_separate_radius < 0 )
		{
			g_separate_radius = 0;
		}
		break;
	}
	case DIK_RIGHT:
	{
		g_separate_radius /= 0.9f;
		break;
	}

	case DIK_RETURN: {
		bDebug	= !bDebug;
		return;
	}
	case DIK_BACK:
		if (GameID() == eGameIDSingle)
			DRender->NextSceneMode();
			//HW.Caps.SceneMode			= (HW.Caps.SceneMode+1)%3;
		return;

	case DIK_F4: {
		if (pInput->iGetAsyncKeyState(DIK_LALT))
			break;

		if (pInput->iGetAsyncKeyState(DIK_RALT))
			break;

		bool bOk = false;
		u32 i=0, j, n=Objects.o_count();
		if (pCurrentEntity)
			for ( ; i<n; ++i)
				if (Objects.o_get_by_iterator(i) == pCurrentEntity)
					break;
		if (i < n) {
			j = i;
			bOk = false;
			for (++i; i <n; ++i) {
				CEntityAlive* tpEntityAlive = smart_cast<CEntityAlive*>(Objects.o_get_by_iterator(i));
				if (tpEntityAlive) {
					bOk = true;
					break;
				}
			}
			if (!bOk)
				for (i = 0; i <j; ++i) {
					CEntityAlive* tpEntityAlive = smart_cast<CEntityAlive*>(Objects.o_get_by_iterator(i));
					if (tpEntityAlive) {
						bOk = true;
						break;
					}
				}
			if (bOk) {
				CObject *tpObject = CurrentEntity();
				CObject *__I = Objects.o_get_by_iterator(i);
				CObject **I = &__I;
				
				SetEntity(*I);
				if (tpObject != *I)
				{
					CActor* pActor = smart_cast<CActor*> (tpObject);
					if (pActor)
						pActor->inventory().Items_SetCurrentEntityHud(false);
				}
				if (tpObject)
				{
					Engine.Sheduler.Unregister	(tpObject);
					Engine.Sheduler.Register	(tpObject, TRUE);
				};
				Engine.Sheduler.Unregister	(*I);
				Engine.Sheduler.Register	(*I, TRUE);

				CActor* pActor = smart_cast<CActor*> (*I);
				if (pActor)
				{
					pActor->inventory().Items_SetCurrentEntityHud(true);

					CHudItem* pHudItem = smart_cast<CHudItem*>(pActor->inventory().ActiveItem());
					if (pHudItem) 
					{
						pHudItem->OnStateSwitch(pHudItem->GetState());
					}
				}
			}
		}
		return;
	}
	// Lain: added
	case DIK_F5: 
	{
		if ( CBaseMonster* pBM = smart_cast<CBaseMonster*>(CurrentEntity()))
		{
			DBG().log_debug_info();			
		}
		break;
	}

	case MOUSE_1: {
		if (GameID() != eGameIDSingle)
			break;

		if (pInput->iGetAsyncKeyState(DIK_LALT)) {
			if (smart_cast<CActor*>(CurrentEntity()))
				try_change_current_entity	();
			else
				restore_actor				();
			return;
		}
		break;
	}
	/**/
#endif
#ifdef DEBUG
	case DIK_F9:{
//		if (!ai().get_alife())
//			break;
//		const_cast<CALifeSimulatorHeader&>(ai().alife().header()).set_state(ALife::eZoneStateSurge);
		break;
	}
		return;
//	case DIK_F10:{
//		ai().level_graph().set_dest_point();
//		ai().level_graph().build_detail_path();
//		if (!Objects.FindObjectByName("m_stalker_e0000") || !Objects.FindObjectByName("localhost/dima"))
//			return;
//		if (!m_bSynchronization) {
//			m_bSynchronization	= true;
//			ai().level_graph().set_start_point();
//			m_bSynchronization	= false;
//		}
//		luabind::functor<void>	functor;
//		ai().script_engine().functor("alife_test.set_switch_online",functor);
//		functor(0,false);
//	}
//		return;
//	case DIK_F11:
//		ai().level_graph().build_detail_path();
//		if (!Objects.FindObjectByName("m_stalker_e0000") || !Objects.FindObjectByName("localhost/dima"))
//			return;
//		if (!m_bSynchronization) {
//			m_bSynchronization	= true;
//			ai().level_graph().set_dest_point();
//			ai().level_graph().select_cover_point();
//			m_bSynchronization	= false;
//		}
//		return;
#endif // DEBUG
	}
#endif // MASTER_GOLD

	if (bindConsoleCmds.execute(key))
		return;

	if (CURRENT_ENTITY())		
	{
		IInputReceiver*		IR	= smart_cast<IInputReceiver*>	(smart_cast<CGameObject*>(CURRENT_ENTITY()));
		if (IR)				IR->IR_OnKeyboardPress(get_binded_action(key));
	}


	#ifdef _DEBUG
		CObject *obj = Level().Objects.FindObjectByName("monster");
		if (obj) {
			CBaseMonster *monster = smart_cast<CBaseMonster *>(obj);
			if (monster) 
				monster->debug_on_key(key);
		}
	#endif
}
예제 #12
0
void						CLevel::Demo_Update				()
{
	if (!IsDemoPlay() || m_aDemoData.empty() || !m_bDemoStarted) return;
	if (float(m_lDemoOfs)/lFileSize>0.95f)
	{
		g_dwDemoDeltaFrame = 1;
		dFrame = 1;
	}
	static u32 Pos = 0;

	if (m_bDemoPlayByFrame)
		Demo_Load_toFrame(m_sDemoFileName.c_str(), m_dwCurDemoFrame+dFrame, m_lDemoOfs);

	if (Pos >= m_aDemoData.size()) return;	

	if (!m_bDemoPlayByFrame)
	{
		for (Pos; Pos < m_aDemoData.size(); Pos++)
		{
			u32 CurTime = timeServer_Async();
			DemoDataStruct* P = &(m_aDemoData[Pos]);
			{
				switch (P->m_dwDataType)
				{
				case DATA_SERVER_PACKET:
					break;
				case DATA_CLIENT_PACKET:
					{
						if (P->m_dwTimeReceive <= CurTime) 
						{
							Msg("tReceive [%d] - CurTime [%d]",P->m_dwTimeReceive, CurTime);
							IPureClient::OnMessage(P->Packet.B.data, P->Packet.B.count);
						}
						else 
						{			
							break;
						};
					}break;
				case DATA_FRAME:
					if (P->m_dwTimeReceive <= CurTime) 
					{
						Msg("tsReceive [%d] - CurTime [%d]",P->m_dwTimeReceive, CurTime);
						Server->OnMessage(P->Packet, ClientID());
					}
					else 
					{			
						break;
					};
					break;
				}				
			}		
		};
	}
	else
	{
		while (!m_aDemoData.empty())
		{
			DemoDataStruct* P;
			P = &(m_aDemoData.front());
			if (P->m_dwFrame > m_dwCurDemoFrame) 
			{
				break;
			};
			switch (P->m_dwDataType)
			{
			case DATA_FRAME:
				{
					Device.dwTimeDelta		= P->FrameTime.dwTimeDelta;
					Device.dwTimeGlobal		= P->FrameTime.dwTimeGlobal;
					//					CurFrameTime.dwTimeServer		= Level().timeServer();
					//					CurFrameTime.dwTimeServer_Delta = Level().timeServer_Delta();
					Device.fTimeDelta		= P->FrameTime.fTimeDelta;
					Device.fTimeGlobal		= P->FrameTime.fTimeGlobal;

				}break;
			case DATA_CLIENT_PACKET:
				{
					u16			m_type;					
					P->Packet.r_begin	(m_type);
					IPureClient::OnMessage(P->Packet.B.data, P->Packet.B.count);
				}break;
			case DATA_SERVER_PACKET:
				{
					u16			m_type;					
					P->Packet.r_begin	(m_type);
					Server->OnMessage(P->Packet, ClientID());
				}break;
			}
			m_aDemoData.pop_front();
		};
	};	
	//-------------------------------
	if (HUD().GetUI())
	{
		CUIGameDM* game_dm_ui = smart_cast<CUIGameDM*>( HUD().GetUI()->UIGame());
		if (game_dm_ui)
		{
			if (Pos < m_aDemoData.size())
			{
				string1024 tmp;
				if (m_bDemoPlayByFrame)
				{
//					sprintf(tmp, "Demo Playing. %d perc.", u32(float(m_dwCurDemoFrame)/m_dwLastDemoFrame*100.0f));
					if (float(m_lDemoOfs)/lFileSize > 0.9)
					{
						int x=0;
						x=x;
					}
					sprintf(tmp, "Demo Playing. %d perc.", u32(float(m_lDemoOfs)/lFileSize*100.0f));
				}
				else
				{
					sprintf(tmp, "Demo Playing. %d perc.", u32(float(Pos)/m_aDemoData.size()*100.0f));
				}
				game_dm_ui->SetDemoPlayCaption(tmp);
			}
			else
				game_dm_ui->SetDemoPlayCaption("");
			
		}
	}
	//---------------------------------

//	m_dwCurDemoFrame++;

	if (Pos >= m_aDemoData.size() || m_lDemoOfs>lFileSize)
	{
		Msg("! ------------- Demo Ended ------------");
	};	
};