Exemplo n.º 1
0
bool game_cl_GameState::IR_OnKeyboardRelease	(int dik)
{
	if(local_player && !local_player->IsSkip())
		return OnKeyboardRelease( get_binded_action(dik) );
	else
		return false;
}
Exemplo n.º 2
0
bool CUIDialogWnd::IR_OnKeyboardRelease(int dik)
{
	if(!IR_process()) return false;
	
	//mouse click
	if(dik==MOUSE_1 || dik==MOUSE_2 || dik==MOUSE_3)
	{
		Fvector2 cp = GetUICursor()->GetPos();
		EUIMessages action = (dik==MOUSE_1)?WINDOW_LBUTTON_UP :(dik==MOUSE_2)?WINDOW_RBUTTON_UP:WINDOW_CBUTTON_UP;
		if (OnMouse(cp.x, cp.y, action))
            return true;
	}

	if (OnKeyboard(dik,	WINDOW_KEY_RELEASED))
		return true;

	if( !StopAnyMove() && g_pGameLevel ){
		CObject* O = Level().CurrentEntity();
		if( O ){
			IInputReceiver*		IR	= smart_cast<IInputReceiver*>( smart_cast<CGameObject*>(O) );
			if (!IR)
				return			(false);
			IR->IR_OnKeyboardRelease(get_binded_action(dik));
		}
	}
	return false;
}
Exemplo n.º 3
0
void CUISequencer::IR_OnActivate()
{
	if(!pInput) return;
	int i;
	for (i = 0; i < CInput::COUNT_KB_BUTTONS; i++ )
	{
		if(IR_GetKeyState(i))
		{
			EGameActions action		= get_binded_action(i);
			switch (action){
			case kFWD			:
			case kBACK			:
			case kL_STRAFE		:
			case kR_STRAFE		:
			case kLEFT			:
			case kRIGHT			:
			case kUP			:
			case kDOWN			:
			case kCROUCH		:
			case kACCEL			:
			case kL_LOOKOUT		:
			case kR_LOOKOUT		:	
			case kWPN_FIRE		:
				{
					IR_OnKeyboardPress	(i);
				}break;
			};
		};
	}
}
Exemplo n.º 4
0
void CLevel::IR_OnKeyboardRelease(int key)
{
	if (!bReady || g_bDisableAllInput	)								return;
	if ( CurrentGameUI() && CurrentGameUI()->IR_UIOnKeyboardRelease(key)) return;
	if (game && game->OnKeyboardRelease(get_binded_action(key)) )		return;
	if (Device.Paused() 
#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_OnKeyboardRelease			(get_binded_action(key));
	}
}
Exemplo n.º 5
0
void CLevel::IR_OnKeyboardRelease(int key)
{
	bool b_ui_exist = (pHUD && pHUD->GetUI());

	if (!bReady || g_bDisableAllInput	) return;
	
	if (g_actor) Actor()->callback(GameObject::eOnKeyRelease)(key, get_binded_action(key));//+
	if ( b_ui_exist && pHUD->GetUI()->IR_OnKeyboardRelease(key)) return;
	if (Device.Paused()		) return;
	if (game && Game().OnKeyboardRelease(get_binded_action(key)) ) return;

	if( b_ui_exist && HUD().GetUI()->MainInputReceiver() )return;
	if (CURRENT_ENTITY())		{
		IInputReceiver*		IR	= smart_cast<IInputReceiver*>	(smart_cast<CGameObject*>(CURRENT_ENTITY()));
		if (IR)				IR->IR_OnKeyboardRelease			(get_binded_action(key));
	}
}
Exemplo n.º 6
0
void CLevel::IR_OnKeyboardHold(int key)
{
	if(g_bDisableAllInput) return;
	if (g_actor) Actor()->callback(GameObject::eOnKeyHold)(key, get_binded_action(key));//+

#ifdef DEBUG
	// Lain: added
	if ( key == DIK_UP )
	{
		static uint time = Device.dwTimeGlobal;
		if ( Device.dwTimeGlobal - time > 20 )
		{
			if ( CBaseMonster* pBM = smart_cast<CBaseMonster*>(CurrentEntity()) )
			{
				DBG().debug_info_up();
				time = Device.dwTimeGlobal;
			}
		}
	}
	else if ( key == DIK_DOWN )
	{
		static uint time = Device.dwTimeGlobal;
		if ( Device.dwTimeGlobal - time > 20 )
		{
			if ( CBaseMonster* pBM = smart_cast<CBaseMonster*>(CurrentEntity()) )
			{
				DBG().debug_info_down();
				time = Device.dwTimeGlobal;
			}
		}
	}

#endif // DEBUG

	bool b_ui_exist = (pHUD && pHUD->GetUI());

	if (b_ui_exist && pHUD->GetUI()->IR_OnKeyboardHold(key)) return;
	if ( b_ui_exist && HUD().GetUI()->MainInputReceiver() )return;
	if ( Device.Paused() && !Level().IsDemoPlay()) return;
	if (CURRENT_ENTITY())		{
		IInputReceiver*		IR	= smart_cast<IInputReceiver*>	(smart_cast<CGameObject*>(CURRENT_ENTITY()));
		if (IR)				IR->IR_OnKeyboardHold				(get_binded_action(key));
	}
}
Exemplo n.º 7
0
void CLevel::IR_OnKeyboardRelease(int key)
{
	bool b_ui_exist = (pHUD && pHUD->GetUI());

	if (g_bDisableAllInput	) return;

	/************************************************** added by Ray Twitty (aka Shadows) START **************************************************/
	// Колбек на отпускание клавиши
	if(g_actor) Actor()->callback(GameObject::eOnKeyRelease)(key);
	/*************************************************** added by Ray Twitty (aka Shadows) END ***************************************************/

	if ( b_ui_exist && pHUD->GetUI()->IR_OnKeyboardRelease(key)) return;
	if (Device.Paused()		) return;
	if (game && Game().OnKeyboardRelease(get_binded_action(key)) ) return;

	if( b_ui_exist && HUD().GetUI()->MainInputReceiver() )return;
	if (CURRENT_ENTITY())		{
		IInputReceiver*		IR	= smart_cast<IInputReceiver*>	(smart_cast<CGameObject*>(CURRENT_ENTITY()));
		if (IR)				IR->IR_OnKeyboardRelease			(get_binded_action(key));
	}
}
Exemplo n.º 8
0
void CLevel::IR_OnKeyboardHold(int key)
{
    if (g_bDisableAllInput) return;

#ifdef KEY_HOLD_CALLBACK
    /* avo: script callback */
    if (g_actor) g_actor->callback(GameObject::eKeyHold)(key);
    /* avo: end */
#endif // KEY_HOLD_CALLBACK


#ifdef DEBUG
    // Lain: added
    if ( key == DIK_UP )
    {
        static u32 time = Device.dwTimeGlobal;
        if ( Device.dwTimeGlobal - time > 20 )
        {
            if ( CBaseMonster* pBM = smart_cast<CBaseMonster*>(CurrentEntity()) )
            {
                DBG().debug_info_up();
                time = Device.dwTimeGlobal;
            }
        }
    }
    else if ( key == DIK_DOWN )
    {
        static u32 time = Device.dwTimeGlobal;
        if ( Device.dwTimeGlobal - time > 20 )
        {
            if ( CBaseMonster* pBM = smart_cast<CBaseMonster*>(CurrentEntity()) )
            {
                DBG().debug_info_down();
                time = Device.dwTimeGlobal;
            }
        }
    }

#endif // DEBUG

    if (CurrentGameUI() && CurrentGameUI()->IR_UIOnKeyboardHold(key)) return;
    if (Device.Paused() && !Level().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_OnKeyboardHold(get_binded_action(key));
    }
}
Exemplo n.º 9
0
bool CUITalkWnd::IR_OnKeyboardPress(int dik)
{
//.	StopSnd						();
	EGameActions cmd = get_binded_action(dik);
	if(cmd==kUSE)
	{
		if (m_pOthersInvOwner&&m_pOthersInvOwner->NeedOsoznanieMode())
		{
			return true;
		}
		GetHolder()->StartStopMenu(this, true);
		return true;
	}
	return inherited::IR_OnKeyboardPress(dik);
}
Exemplo n.º 10
0
void CLevel::IR_OnKeyboardRelease(int key)
{
    if (!bReady || g_bDisableAllInput)								return;

#ifdef KEY_RELEASE_CALLBACK 
    /* avo: script callback */
    if (g_actor) g_actor->callback(GameObject::eKeyRelease)(key);
    /* avo: end */
#endif // KEY_RELEASE_CALLBACK

    if (CurrentGameUI() && CurrentGameUI()->IR_UIOnKeyboardRelease(key)) return;
    if (game && game->OnKeyboardRelease(get_binded_action(key)))		return;
    if (Device.Paused()
#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_OnKeyboardRelease(get_binded_action(key));
    }
}
Exemplo n.º 11
0
bool CUIDialogWnd::IR_OnKeyboardHold(int dik)
{
	if(!IR_process()) return false;
	if (OnKeyboardHold(dik)) 
		return true;

	if( !StopAnyMove() && g_pGameLevel ){
		CObject* O = Level().CurrentEntity();
		if( O ){
			IInputReceiver*		IR	= smart_cast<IInputReceiver*>( smart_cast<CGameObject*>(O) );
			if (!IR)
				return			(false);
			IR->IR_OnKeyboardHold(get_binded_action(dik));
		}
	}
	return false;
}
Exemplo n.º 12
0
bool CUITalkWnd::IR_OnKeyboardPress(int dik)
{
//.	StopSnd						();
	EGameActions cmd = get_binded_action(dik);
	if ( cmd==kUSE || cmd==kQUIT)
	{
		if(!b_disable_break)
			GetHolder()->StartStopMenu(this, true);
		return true;
	}
	if ( cmd == kSPRINT_TOGGLE )
	{
		if (m_pOthersInvOwner&&m_pOthersInvOwner->NeedOsoznanieMode())
		{
			return true;
		}
		UITalkDialogWnd->SetTradeMode();
		return true;
	}
	return inherited::IR_OnKeyboardPress(dik);
}
Exemplo n.º 13
0
bool CUIGameCTA::IR_UIOnKeyboardPress(int dik)
{
    if (inherited::IR_UIOnKeyboardPress(dik))
        return true;

    switch (dik) {
    case DIK_CAPSLOCK :
    {
        if (m_game)
        {
            if (m_game->Get_ShowPlayerNamesEnabled())
                m_game->Set_ShowPlayerNames( !m_game->Get_ShowPlayerNames() );
            else
                m_game->Set_ShowPlayerNames(true);
            return true;
        };
    }
    break;
    }

    EGameActions cmd  = get_binded_action(dik);
    switch ( cmd )
    {
    case kINVENTORY:
    case kBUY:
    case kSKIN:
    case kTEAM:

    case kSPEECH_MENU_0:
    case kSPEECH_MENU_1:
    {
        return Game().OnKeyboardPress( cmd );
    }
    break;
    }

    return false;
}
Exemplo n.º 14
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
}
Exemplo n.º 15
0
void CLevel::IR_OnKeyboardPress	(int key)
{
	bool b_ui_exist = (pHUD && pHUD->GetUI());

	if (!g_bDisableAllInput)
	{
		if (auto ui = HUD().GetUI())
		{
			if (ui->UIMainIngameWnd)
			{
				ui->UIMainIngameWnd->HudAdjustMode(key); // Real Wolf. 07.09.2014.
			}
		}

		/************************************************** added by Ray Twitty (aka Shadows) START **************************************************/
		// Колбек на нажатие клавиши
		if (g_actor) Actor()->callback(GameObject::eOnKeyPress)(key);
		/*************************************************** added by Ray Twitty (aka Shadows) END ***************************************************/
	}

	EGameActions _curr = get_binded_action(key);
	switch ( _curr ) 
	{

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

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

	case kQUIT:	{
		if(b_ui_exist && HUD().GetUI()->MainInputReceiver() ){
				if(HUD().GetUI()->MainInputReceiver()->IR_OnKeyboardPress(key))	return;//special case for mp and main_menu
				HUD().GetUI()->StartStopMenu( HUD().GetUI()->MainInputReceiver(), true);
		}else
			Console->Execute			("main_menu");
		return;
		}break;

	case kPAUSE:
		if(!g_block_pause)
		{
			if ( IsGameTypeSingle() )
			{
				Device.Pause(!Device.Paused(), TRUE, TRUE, "li_pause_key");
			}
		}
		return;
		break;
	
	};

	if(	g_bDisableAllInput )	return;
	if ( !b_ui_exist )			return;

	if ( b_ui_exist && pHUD->GetUI()->IR_OnKeyboardPress(key)) return;

	if( Device.Paused() )		return;

	if ( game && Game().IR_OnKeyboardPress(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_NUMPAD5: 
		{
			if (GameID() != GAME_SINGLE) 
			{
				Msg("For this game type Demo Record is disabled.");
///				return;
			};
			Console->Hide	();
			Console->Execute("demo_record 1");
		}
		break;
#endif // MASTER_GOLD
#ifdef DEBUG
	case DIK_RETURN:
			bDebug	= !bDebug;
		return;

	case DIK_BACK:
		if (GameID() == GAME_SINGLE)
			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;
	}
	case MOUSE_1: {
		if (GameID() != GAME_SINGLE)
			break;
		if (pInput->iGetAsyncKeyState(DIK_LALT)) {
			if (CurrentEntity()->CLS_ID == CLSID_OBJECT_ACTOR)
				try_change_current_entity	();
			else
				restore_actor				();
			return;
		}
		break;
	}
	/**/


	case DIK_DIVIDE:
		if( OnServer() ){
//			float NewTimeFactor				= pSettings->r_float("alife","time_factor");
			
			if (GameID() == GAME_SINGLE)
				Server->game->SetGameTimeFactor(g_fTimeFactor);
			else
			{
				Server->game->SetEnvironmentGameTimeFactor(g_fTimeFactor);
				Server->game->SetGameTimeFactor(g_fTimeFactor);
			};
		}
		break;	
	case DIK_MULTIPLY:
		if( OnServer() ){
			float NewTimeFactor				= 1000.f;
			if (GameID() == GAME_SINGLE)
				Server->game->SetGameTimeFactor(NewTimeFactor);
			else
			{
				Server->game->SetEnvironmentGameTimeFactor(NewTimeFactor);
//				Server->game->SetGameTimeFactor(NewTimeFactor);
			};
		}
		break;
#endif
#ifdef DEBUG
	case DIK_F9:{
//		if (!ai().get_alife())
//			break;
//		const_cast<CALifeSimulatorHeader&>(ai().alife().header()).set_state(ALife::eZoneStateSurge);
		if (GameID() != GAME_SINGLE)
		{
			extern INT g_sv_SendUpdate;
			g_sv_SendUpdate = 1;
		};
		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
#ifndef MASTER_GOLD
	}
#endif // MASTER_GOLD

	if (bindConsoleCmds.execute(key))
		return;

	if( b_ui_exist && HUD().GetUI()->MainInputReceiver() )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
}
Exemplo n.º 16
0
bool CUISequenceItem::AllowKey(int dik)
{
	xr_vector<int>::iterator it = std::find(m_disabled_actions.begin(),m_disabled_actions.end(),get_binded_action(dik));
	if(it==m_disabled_actions.end())
		return true;
	else
		return false;
}
Exemplo n.º 17
0
bool CUIGameSP::IR_OnKeyboardPress(int dik) 
{
	if(inherited::IR_OnKeyboardPress(dik)) return true;

	if( Device.Paused()		) return false;

	CActor *pActor = smart_cast<CActor*>(Level().CurrentEntity());
	if(!pActor)								return false;
	if( pActor && !pActor->g_Alive() )		return false;

	switch ( get_binded_action(dik) )
	{
	case kINVENTORY:
		if( !MainInputReceiver() || MainInputReceiver()==InventoryMenu){
			m_game->StartStopMenu(InventoryMenu,true);
			return true;
		}break;

	case kACTIVE_JOBS:
#if defined(UI_LOCK_PDA_WITHOUT_PDA_IN_SLOT)
		if (pActor->inventory().m_slots[PDA_SLOT].m_pIItem)
#endif
		if( !MainInputReceiver() || MainInputReceiver()==PdaMenu){
			PdaMenu->SetActiveSubdialog(eptQuests);
			m_game->StartStopMenu(PdaMenu,true);
			return true;
		}break;

	case kMAP:
#if defined(UI_LOCK_PDA_WITHOUT_PDA_IN_SLOT)
		if (pActor->inventory().m_slots[PDA_SLOT].m_pIItem)
#endif
		if( !MainInputReceiver() || MainInputReceiver()==PdaMenu){
			PdaMenu->SetActiveSubdialog(eptMap);
			m_game->StartStopMenu(PdaMenu,true);
			return true;
		}break;

	case kCONTACTS:
#if defined(UI_LOCK_PDA_WITHOUT_PDA_IN_SLOT)
		if (pActor->inventory().m_slots[PDA_SLOT].m_pIItem)
#endif
		if( !MainInputReceiver() || MainInputReceiver()==PdaMenu){
			PdaMenu->SetActiveSubdialog(eptContacts);
			m_game->StartStopMenu(PdaMenu,true);
			return true;
		}break;

	case kSCORES:
		{
			SDrawStaticStruct* ss	= AddCustomStatic("main_task", true);
			SGameTaskObjective* o	= pActor->GameTaskManager().ActiveObjective();
			if(!o)
				ss->m_static->SetTextST	("st_no_active_task");
			else
				ss->m_static->SetTextST	(*(o->description));

		}break;
	}
	return false;
}