void CHapticsMovementPage::SaveVars()
{
	BaseClass::SaveVars();
	// now check our checkboxes
	if(m_pReverseYaw->IsSelected())
	{
		// if we are selected keep the number selected as positive for us is reversed.
	}else{
		// negate our yaw based convars
		ConVar *pos = cvar->FindVar("hap_yawsensitivity_posctrl");
		ConVar *vel = cvar->FindVar("hap_yawsensitivity_velctrl");
		pos->SetValue(pos->GetFloat()*-1.0f);
		vel->SetValue(vel->GetFloat()*-1.0f);
	}
	if(m_pReversePitch->IsSelected())
	{
		// if we are selected keep the number selected as positive for us is reversed.
	}else{
		// negate our pitch based convars
		ConVar *pos = cvar->FindVar("hap_pitchsensitivity_posctrl");
		ConVar *vel = cvar->FindVar("hap_pitchsensitivity_velctrl");
		pos->SetValue(pos->GetFloat()*-1.0f);
		vel->SetValue(vel->GetFloat()*-1.0f);
	}
}
void ClientModeTFBase::Init()
{
	BaseClass::Init();
	C_BaseTFCombatWeapon::CreateCrosshairPanels();

	// FIXME: For playtests, turn off detail props. They're causing perf problems
	r_DrawDetailProps.SetValue("0");

	// Turn lighting into a mode where we use better computation for the ambient
	// cube on static props, and a cheap one for dynamic entities.
 	r_radiosity.SetValue("3");

	if ( !m_pMinimap )
	{
		m_pMinimap = ( CMinimapPanel * )GET_HUDELEMENT( CMinimapPanel );
	}

	// Load up the object control panel scheme
	g_hVGuiObjectScheme = vgui::scheme()->LoadSchemeFromFile( "resource/ObjectControlPanelScheme.res", "TFBase" );
	if (!g_hVGuiObjectScheme)
	{
		Warning( "Couldn't load control panel scheme!\n" );
	}

	// Load the objects.txt file.
	LoadObjectInfos( filesystem );
}
Beispiel #3
0
//
// Just to ignore the "wad" field.
//
bool CWorld::KeyValue( const char *szKeyName, const char *szValue )
{
	if ( FStrEq(szKeyName, "skyname") )
	{
		// Sent over net now.
		ConVar *skyname = ( ConVar * )cvar->FindVar( "sv_skyname" );
		if ( skyname )
		{
			skyname->SetValue( szValue );
		}
	}
	else if ( FStrEq(szKeyName, "sounds") )
	{
		gpGlobals->cdAudioTrack = atoi(szValue);
	}
	else if ( FStrEq(szKeyName, "WaveHeight") )
	{
		// Sent over net now.
		m_flWaveHeight = atof(szValue) * (1.0/8.0);

		ConVar *wateramp = ( ConVar * )cvar->FindVar( "sv_wateramp" );
		if ( wateramp )
		{
			wateramp->SetValue( m_flWaveHeight );
		}
	}
	else if ( FStrEq(szKeyName, "newunit") )
	{
		// Single player only.  Clear save directory if set
		if ( atoi(szValue) )
		{
			extern void Game_SetOneWayTransition();
			Game_SetOneWayTransition();
		}
	}
	else if ( FStrEq(szKeyName, "world_mins") )
	{
		Vector vec;
		sscanf(	szValue, "%f %f %f", &vec.x, &vec.y, &vec.z );
		m_WorldMins = vec;
	}
	else if ( FStrEq(szKeyName, "world_maxs") )
	{
		Vector vec;
		sscanf(	szValue, "%f %f %f", &vec.x, &vec.y, &vec.z ); 
		m_WorldMaxs = vec;
	}
	else
		return BaseClass::KeyValue( szKeyName, szValue );

	return true;
}
Beispiel #4
0
void r_newflashlightCallback_f( ConVar *var, char const *pOldString )
{
	if( engine->GetDXSupportLevel() < 70 )
	{
		r_newflashlight.SetValue( 0 );
	}	
}
Beispiel #5
0
/*
==============================
AdjustYaw

==============================
*/
void CInput::AdjustYaw( float speed, QAngle& viewangles )
{
	if ( !(in_strafe.state & 1) )
	{
		viewangles[YAW] -= speed*cl_yawspeed.GetFloat() * KeyState (&in_right);
		viewangles[YAW] += speed*cl_yawspeed.GetFloat() * KeyState (&in_left);
	}

	// thirdperson platformer mode
	// use movement keys to aim the player relative to the thirdperson camera
	if ( CAM_IsThirdPerson() && thirdperson_platformer.GetInt() )
	{
		float side = KeyState(&in_moveleft) - KeyState(&in_moveright);
		float forward = KeyState(&in_forward) - KeyState(&in_back);

		if ( side || forward )
		{
			viewangles[YAW] = RAD2DEG(atan2(side, forward)) + g_ThirdPersonManager.GetCameraOffsetAngles()[ YAW ];
		}
		if ( side || forward || KeyState (&in_right) || KeyState (&in_left) )
		{
			cam_idealyaw.SetValue( g_ThirdPersonManager.GetCameraOffsetAngles()[ YAW ] - viewangles[ YAW ] );
		}
	}
}
void GenerateUniquePlayerId(CSteamAPIContext *pSteamAPIContext)
{
	CSHA1 sha1;

	// Add the steam name
	char szSteamId[256] = "\0";
	CSteamID steamid = pSteamAPIContext->SteamUser()->GetSteamID();
	V_sprintf_safe(szSteamId, "%u%u%u%u", steamid.GetEUniverse(), steamid.GetEAccountType(), steamid.GetAccountID(), steamid.GetUnAccountInstance());
	sha1.Update((unsigned char *)szSteamId, strlen(szSteamId));
	
	// Add some random numbers
	char randomNumbers[256] = "\0";
	Q_snprintf(randomNumbers, sizeof(randomNumbers), "%i%i%i%i%i%i",
		RandomInt(0, 1000), RandomInt(0, 1000), RandomInt(0, 1000), RandomInt(0, 1000), RandomInt(0, 1000), RandomInt(0, 1000));
	sha1.Update((unsigned char *)randomNumbers, strlen(randomNumbers));

	// Generate the hash
	sha1.Final();

	// Compile SHA1 Report
	char szReport[1024] = "\0";
	sha1.ReportHash(szReport);

	// Remove the spaces and make it lowercase
	char playerId[1024] = "\0";
	Q_StrSubst(szReport, " ", "", playerId, sizeof(playerId));
	Q_strlower(playerId);

	DevMsg("Generated unique player ID: %s\n", playerId);
	ae_uniqueplayerid.SetValue(playerId);
}
Beispiel #7
0
void CMapzoneEdit::Reset()
{
    mom_zone_edit.SetValue(0);

    m_nBuildStage = BUILDSTAGE_NONE;
    m_bEditing = false;
}
void r_newflashlightCallback_f( IConVar *pConVar, const char *pOldString, float flOldValue )
{
	if( engine->GetDXSupportLevel() < 70 )
	{
		r_newflashlight.SetValue( 0 );
	}	
}
//-----------------------------------------------------------------------------
// Purpose: Per level init
//-----------------------------------------------------------------------------
void CHLClient::LevelInitPreEntity( char const* pMapName )
{
	// HACK: Bogus, but the logic is too complicated in the engine
	if (g_bLevelInitialized)
		return;
	g_bLevelInitialized = true;

	// FIXME: Sucky, figure out logic for this crap
	partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, false );

	vieweffects->LevelInit();
	
	// Tell mode manager that map is changing
	modemanager->LevelInit( pMapName );

	C_BaseTempEntity::ClearDynamicTempEnts();
	clienteffects->Flush();
	view->LevelInit();

	IGameSystem::LevelInitPreEntityAllSystems(pMapName);

	ResetWindspeed();

	// don't do prediction if single player!
	cl_predict.SetValue( engine->GetMaxClients() > 1 ? 1 : 0 );

	gHUD.LevelInit();

	partition->SuppressLists( PARTITION_ALL_CLIENT_EDICTS, true );
}
void StimMusicSelectDialog::OnFileSelected(const char *fullpath)
{
	if ( fullpath )
	{
		asw_stim_music.SetValue( fullpath );
	}
}
Beispiel #11
0
static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params)
{
	Handle_t hndl = static_cast<Handle_t>(params[1]);
	HandleError err;
	ConVar *pConVar;

	if ((err=g_ConVarManager.ReadConVarHandle(hndl, &pConVar))
		!= HandleError_None)
	{
		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
	}

	char *value;
	pContext->LocalToString(params[2], &value);

	pConVar->SetValue(value);

#if SOURCE_ENGINE < SE_ORANGEBOX
	/* Should we replicate it? */
	if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
	{
		ReplicateConVar(pConVar);
	}

	/* Should we notify clients? */
	if (params[4] && IsFlagSet(pConVar, FCVAR_NOTIFY))
	{
		NotifyConVar(pConVar);
	}
#endif

	return 1;
}
	void CEnvDetailController::OnDataChanged( DataUpdateType_t updateType )
	{
		BaseClass::OnDataChanged( updateType );

		if( m_fOldFadeStartDist != m_flFadeStartDist )
		{
			cl_detailfade.SetValue( m_flFadeStartDist );
			m_fOldFadeStartDist = m_flFadeStartDist;
		}

		if( m_fOldFadeStartDist != m_flFadeEndDist )
		{
			cl_detaildist.SetValue( m_flFadeEndDist );
			m_fOldFadeEndDist = m_flFadeEndDist;
		}
	}
	virtual void OnCommand( const char *command )
	{
		if ( !Q_strnicmp( command, "register", 8 ) )
		{
			if ( steamapicontext && steamapicontext->SteamFriends() )
			{
				steamapicontext->SteamFriends()->ActivateGameOverlayToWebPage( "http://www.youtube.com/create_account?next=/" );
			}
		}		
		else if ( !Q_strnicmp( command, "confirm", 7 ) )
		{
			TextEntry *pTextEntryUserName = dynamic_cast< TextEntry * >( FindChildByName( "UserNameTextEntry" ) );
			TextEntry *pTextEntryPassword = dynamic_cast< TextEntry * >( FindChildByName( "PasswordTextEntry" ) );
			if ( pTextEntryUserName && pTextEntryPassword )
			{
				char szUserName[256];
				pTextEntryUserName->GetText( szUserName, sizeof( szUserName ) );
				char szPassword[256];
				pTextEntryPassword->GetText( szPassword, sizeof( szPassword ) );
				youtube_username.SetValue( szUserName );
				Login( szUserName, szPassword );
			}

			return;
		}
		BaseClass::OnCommand( command );
	}
void GERadarPos_Callback( IConVar *var, const char *pOldString, float flOldValue )
{
	static bool denyReentrant = false;
	if ( denyReentrant )
		return;

	denyReentrant = true;

	// Bound our value to 5
	ConVar *cVar = static_cast<ConVar*>(var);
	if ( cVar->GetInt() > 5 )
		cVar->SetValue( 5 );

	denyReentrant = false;

	// cVar <= 0 implies use HudLayout.res
	CGERadar *radar = GET_HUDELEMENT( CGERadar );
	if ( !radar || cVar->GetInt() <= 0 )
		return;

	KeyValues *kv = new KeyValues("settings");
	int pos = cVar->GetInt() - 1;
	kv->SetString( "xpos", GERadarPos[pos].x );
	kv->SetString( "ypos", GERadarPos[pos].y );

	radar->ApplySettings( kv );

	kv->deleteThis();
}
void CContactPanel::OnCommand(const char* pcCommand)
{
	if(!Q_stricmp(pcCommand, "CloseContactDialog"))
	{
		in_contactpanel.SetValue(false);
		contactpanel->Activate();
	}
}
Beispiel #16
0
 void Deactivate( void )
 {
     if (vampireComputer)
     {
         cl_computer_window.SetValue(0);
         vampireComputer->Deactivate();
     }
 }
Beispiel #17
0
// This is called by cdll_client_int to setup view model origins. This has to be done before
// simulation so entities can access attachment points on view models during simulation.
void CViewRender::OnRenderStart()
{
	VPROF_("CViewRender::OnRenderStart", 2, VPROF_BUDGETGROUP_OTHER_UNACCOUNTED, false, 0);

    SetUpViews();

	// Adjust mouse sensitivity based upon the current FOV
	C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
	if ( player )
	{
		default_fov.SetValue( player->m_iDefaultFOV );

		//Update our FOV, including any zooms going on
		int iDefaultFOV = default_fov.GetInt();
		int	localFOV	= player->GetFOV();
		int min_fov		= player->GetMinFOV();

		// Don't let it go too low
		localFOV = MAX( min_fov, localFOV );

		gHUD.m_flFOVSensitivityAdjust = 1.0f;
#ifndef _XBOX
		if ( gHUD.m_flMouseSensitivityFactor )
		{
			gHUD.m_flMouseSensitivity = sensitivity.GetFloat() * gHUD.m_flMouseSensitivityFactor;
		}
		else
#endif
		{
			// No override, don't use huge sensitivity
			if ( localFOV == iDefaultFOV )
			{
#ifndef _XBOX
				// reset to saved sensitivity
				gHUD.m_flMouseSensitivity = 0;
#endif
			}
			else
			{  
				// Set a new sensitivity that is proportional to the change from the FOV default and scaled
				//  by a separate compensating factor
				if ( iDefaultFOV == 0 )
				{
					Assert(0); // would divide by zero, something is broken with iDefatulFOV
					iDefaultFOV = 1;
				}
				gHUD.m_flFOVSensitivityAdjust = 
					((float)localFOV / (float)iDefaultFOV) * // linear fov downscale
					zoom_sensitivity_ratio.GetFloat(); // sensitivity scale factor
#ifndef _XBOX
				gHUD.m_flMouseSensitivity = gHUD.m_flFOVSensitivityAdjust * sensitivity.GetFloat(); // regular sensitivity
#endif
			}
		}
	}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEnvTonemapController::InputSetTonemapRate( inputdata_t &inputdata )
{
	// TODO: There should be a better way to do this.
	ConVar *pConVarTonemapRate = ( ConVar* )cvar->FindVar( "mat_hdr_manual_tonemap_rate" );
	if ( pConVarTonemapRate )
	{
		float flTonemapRate = inputdata.value.Float();
		pConVarTonemapRate->SetValue( flTonemapRate );
	}
}
void Bot_HandleSendCmd( CPluginBot *pBot )
{
	if ( strlen( bot_sendcmd.GetString() ) > 0 )
	{
		//send the cmd from this bot
		helpers->ClientCommand( pBot->m_BotEdict, bot_sendcmd.GetString() );

		bot_sendcmd.SetValue("");
	}
}
//---------------------------------------------------------------------------------
// Purpose: Level has initialised
//---------------------------------------------------------------------------------
void		ManiWarmupTimer::LevelInit(void)
{
	friendly_fire = false;
	if (mani_warmup_timer.GetInt() == 0)
	{
		check_timer = false;
		fire_restart = false;
		mani_warmup_in_progress.SetValue(0);
	}
	else
	{
#if defined(GAME_CSGO)
		//Set the default CSGO warmup timer value
		ConVar *mp_warmuptime = g_pCVar->FindVar("mp_warmuptime");
		if(mp_warmuptime)
		{
			MMsg("Setting warmup timer value\n");
			mani_warmup_timer.SetValue(mp_warmuptime->GetInt());
		}
#endif
		check_timer = true;
		fire_restart = true;
		next_check = -999.0;
		mani_warmup_in_progress.SetValue(1);
	}

	for (int i = 0; i < MANI_MAX_PLAYERS; i++)
	{
		respawn_list[i].needs_respawn = false;
	}

	for (int i = 0; i < 5; i ++)
	{
		item_name[i][0] = '\0';
	}

	SetRandomItem(&mani_warmup_timer_spawn_item_1, 0);
	SetRandomItem(&mani_warmup_timer_spawn_item_2, 1);
	SetRandomItem(&mani_warmup_timer_spawn_item_3, 2);
	SetRandomItem(&mani_warmup_timer_spawn_item_4, 3);
	SetRandomItem(&mani_warmup_timer_spawn_item_5, 4);
}
Beispiel #21
0
bool NextMapManager::SetNextMap(const char *map)
{
	if (!g_HL2.IsMapValid(map))
	{
		return false;
	}

	sm_nextmap.SetValue(map);

	return true;
}
void CC_ResetLessons()
{
	da_instructor_lessons_learned.SetValue("");

	C_SDKPlayer* pPlayer = C_SDKPlayer::GetLocalSDKPlayer();
	if (!pPlayer)
		return;

	pPlayer->Instructor_Initialize();
	pPlayer->Instructor_Reset();
}
//-----------------------------------------------------------------------------
void CSDKMapOverview::SetPlayerPreferredMode( int mode )
{
	// A player has given an explicit overview_mode command
	m_playerPreferredMode = mode;

	switch ( mode )
	{
	case MAP_MODE_OFF:
		overview_preferred_mode.SetValue( MAP_MODE_OFF );
		break;

	case MAP_MODE_INSET:
		overview_preferred_mode.SetValue( MAP_MODE_INSET );
		break;

	case MAP_MODE_FULL:
		overview_preferred_mode.SetValue( MAP_MODE_FULL );
		break;
	}
}
Beispiel #24
0
DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
{
    hacks::shared::backtrack::lastincomingsequencenumber = 0;
    hacks::shared::backtrack::sequences.clear();
    firstcm = true;
    // nav::init = false;
    playerlist::Save();
#if ENABLE_VISUALS
#if ENABLE_GUI
    gui::onLevelLoad();
#endif
    if (skybox_changer)
    {
        typedef bool (*LoadNamedSkys_Fn)(const char *);
        uintptr_t addr                        = gSignatures.GetEngineSignature("55 89 E5 57 31 FF 56 8D B5 ? ? ? ? 53 81 EC 6C 01 00 00");
        static LoadNamedSkys_Fn LoadNamedSkys = LoadNamedSkys_Fn(addr);
        bool succ;
        logging::Info("Going to load the skybox");
        succ = LoadNamedSkys(skynum[(int) skybox_changer]);
        logging::Info("Loaded Skybox: %s", succ ? "true" : "false");
    }
    ConVar *holiday = g_ICvar->FindVar("tf_forced_holiday");

    if (halloween_mode)
        holiday->SetValue(2);
    else if (holiday->m_nValue == 2)
        holiday->SetValue(0);
#endif
    for (int i = 0; i < 32; i++)
        g_Settings.brute.brutenum[i] = 0;
    g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec");
    chat_stack::Reset();
    original::LevelInit(this_, name);
    EC::run(EC::LevelInit);
#if ENABLE_IPC
    if (ipc::peer)
    {
        ipc::peer->memory->peer_user_data[ipc::peer->client_id].ts_connected = time(nullptr);
    }
#endif
}
Beispiel #25
0
void l4dtoolz::OnChangeMaxplayers ( IConVar *var, const char *pOldValue, float flOldValue )
{
	int new_value = ((ConVar*)var)->GetInt();
	int old_value = atoi(pOldValue);
	if (max_players_friend_lobby == NULL || max_players_connect == NULL || max_players_server_browser == NULL || lobby_sux_ptr == NULL) {
		Msg("sv_maxplayers init error\n");
		return;
	}
	if(new_value != old_value) {
		ConVar *sv_visiblemaxplayers = g_pCVar->FindVar("sv_visiblemaxplayers");
		sv_visiblemaxplayers->SetValue(new_value);
		
		if(new_value > 8) {
			sv_removehumanlimit.SetValue(true);
		}
		
		if(new_value >= 0) {
			sv_force_unreserved.SetValue(true);

			max_players_new[4] = friends_lobby_new[3] = server_bplayers_new[3] = new_value;
			if(lobby_match_ptr) {
				lobby_match_new[2] = new_value;
				write_signature(lobby_match_ptr, lobby_match_new);
			} else {
				Msg("sv_maxplayers MS init error\n");
			}
			write_signature(max_players_friend_lobby, friends_lobby_new);
			write_signature(max_players_connect, max_players_new);
			write_signature(lobby_sux_ptr, lobby_sux_new);
			write_signature(max_players_server_browser, server_bplayers_new);
		} else {
			write_signature(max_players_friend_lobby, friends_lobby_org);
			write_signature(max_players_connect, max_players_org);
			write_signature(lobby_sux_ptr, lobby_sux_org);
			write_signature(max_players_server_browser, server_bplayers_org);
		
			if(lobby_match_ptr)
				write_signature(lobby_match_ptr, lobby_match_org);
		}
	}
}
	void CalculateCommentaryState( void )
	{
		// Set the available cvar if we can find commentary data for this level
		char szFullName[512];
		Q_snprintf(szFullName,sizeof(szFullName), "maps/%s_commentary.txt", STRING( gpGlobals->mapname) );
		if ( filesystem->FileExists( szFullName ) )
		{
			commentary_available.SetValue( true );

			// If the user wanted commentary, kick it on
			if ( commentary.GetBool() )
			{
				g_bInCommentaryMode = true;
			}
		}
		else
		{
			g_bInCommentaryMode = false;
			commentary_available.SetValue( false );
		}
	}
const char* ServerOptionsPanel::GetHostName()
{
	if (!m_pHostNameEntry)
		return "";

	static char hostname_buffer[32];
	m_pHostNameEntry->GetText(hostname_buffer, 32);

	asw_last_server_name.SetValue(hostname_buffer);

	return hostname_buffer;
}
void CPerfVisualBenchmark::Stop()
{
#ifndef _XBOX
	cl_mouseenable.SetValue( m_bSaveMouseEnable );
#endif
	m_bIsOn = false;
	Print();
	engine->ClientCmd_Unrestricted("host_timescale 0");					// pause the mofo
//	engine->ClientCmd_Unrestricted("unpause");				// unpause the mofo
//	engine->ClientCmd_Unrestricted("wait");				
	engine->ClientCmd_Unrestricted("toggleconsole");
}
Beispiel #29
0
/*
	Function: void HackThread(void)
	Purpose: The main function for our hack, here is where we have our code
	Arguments:
		-
	Returns:
		-
*/
void HackThread(void)
{
	HMODULE hEngineModule, hClientModule; //module handles
	CreateInterfaceFn pEngineFactory, pClientFactory; //CreateInterface function pointers

	while(!IsGameReady())	//while the game isn't ready
		Sleep(1000);		//wait for a second before checking again

	//Here the game is ready, so we get handles to the dlls
	hEngineModule = GetModuleHandle("engine.dll"); //Get a handle to the engine dll
	hClientModule = GetModuleHandle("client.dll"); //Get a handle to the client dll

	//Get the function pointers to the CreateInterface functions
	pEngineFactory = (CreateInterfaceFn)GetProcAddress(hEngineModule, "CreateInterface"); //Get the address of the CreateInterface function in engine.dll
	pClientFactory = (CreateInterfaceFn)GetProcAddress(hClientModule, "CreateInterface"); //Get the address of the CreateInterface function in client.dll

	//Nullpointer checks
	if(pEngineFactory == NULL || pClientFactory == NULL) //if any of the two function pointers is NULL
	{
		MessageBox(0, "A CreateInterface pointer was NULL, shutting down!", "Failure", MB_OK); //Warn us about it
		exit(0); //and exit the game
	}

	//Get pointers to the existing interfaces in client.dll
	pBaseClient			= (IBaseClientDLL*)pClientFactory(CLIENT_DLL_INTERFACE_VERSION, 0);				//CLIENT_DLL_INTERFACE_VERSION is defined as "VClient013"
	pClientEntityList	= (IClientEntityList*)pClientFactory(VCLIENTENTITYLIST_INTERFACE_VERSION, 0);	//VCLIENTENTITYLIST_INTERFACE_VERSION is defined as "VClientEntityList003"

	//Get pointers to the existing interfaces in engine.dll
	pEngineClient	= (IVEngineClient*)pEngineFactory(VENGINE_CLIENT_INTERFACE_VERSION, 0);	//VENGINE_CLIENT_INTERFACE_VERSION is defined as "VEngineClient012"
	pCvar			= (ICvar*)pEngineFactory(VENGINE_CVAR_INTERFACE_VERSION, 0);			//VENGINE_CVAR_INTERFACE_VERSION is defined as "VEngineCvar003"

	if(pBaseClient == NULL || pClientEntityList == NULL || pEngineClient == NULL || pCvar == NULL) //if any of the pointers is NULL
	{
		MessageBox(0, "One of the interface pointers is NULL, shutting down!", "Failure", MB_OK); //Warn us about it
		exit(0); //and exit the game
	}

	while(1) //We passed all the checks, so we can enter an infinite loop
	{
		if(GetAsyncKeyState(VK_NUMPAD1)&1) //if the first bit for numpad1 is set(initial press & repeats)
		{
			pEngineClient->ClientCmd("monster_attack_bonus_ratio -80"); //enable godmode using ClientCmd
		}
		if(GetAsyncKeyState(VK_NUMPAD3)&1) //if the first bit for numpad3 is set(initial press & repeats)
		{
			//Disable godmode using ConVars
			ConVar *pGodmode = pCvar->FindVar("monster_attack_bonus_ratio"); //get a pointer to the ConVar
			if(pGodmode != NULL) //make sure it isn't a NULL pointer!
				pGodmode->SetValue(pGodmode->GetDefault()); //Set the convar back to the default value
		}
		Sleep(100); //Sleep(pause) the thread for 100 miliseconds
	}
}
Beispiel #30
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : nEntIndex - The m_nEntIndex of the client entity that is creating us.
//			vecPos - The position of the light emitter.
//			vecDir - The direction of the light emission.
//-----------------------------------------------------------------------------
CFlashlightEffect::CFlashlightEffect(int nEntIndex)
{
	m_FlashlightHandle = CLIENTSHADOW_INVALID_HANDLE;
	m_nEntIndex = nEntIndex;

	m_bIsOn = false;
	m_pPointLight = NULL;
	if( engine->GetDXSupportLevel() < 70 )
	{
		r_newflashlight.SetValue( 0 );
	}	
}