From 3bf9df6b2785fa6d951086978a3e66f49427166a Mon Sep 17 00:00:00 2001 From: FluorescentCIAAfricanAmerican <0934gj3049fk@protonmail.com> Date: Wed, 22 Apr 2020 12:56:21 -0400 Subject: 1 --- game/client/c_test_proxytoggle.cpp | 80 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 game/client/c_test_proxytoggle.cpp (limited to 'game/client/c_test_proxytoggle.cpp') diff --git a/game/client/c_test_proxytoggle.cpp b/game/client/c_test_proxytoggle.cpp new file mode 100644 index 0000000..45405e1 --- /dev/null +++ b/game/client/c_test_proxytoggle.cpp @@ -0,0 +1,80 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "c_baseentity.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +class C_Test_ProxyToggle_Networkable; +static C_Test_ProxyToggle_Networkable *g_pTestObj = 0; + + +// ---------------------------------------------------------------------------------------- // +// C_Test_ProxyToggle_Networkable +// ---------------------------------------------------------------------------------------- // + +class C_Test_ProxyToggle_Networkable : public C_BaseEntity +{ +public: + DECLARE_CLASS( C_Test_ProxyToggle_Networkable, C_BaseEntity ); + DECLARE_CLIENTCLASS(); + + C_Test_ProxyToggle_Networkable() + { + g_pTestObj = this; + } + + ~C_Test_ProxyToggle_Networkable() + { + g_pTestObj = 0; + } + + int m_WithProxy; +}; + + +// ---------------------------------------------------------------------------------------- // +// Datatables. +// ---------------------------------------------------------------------------------------- // + +BEGIN_RECV_TABLE_NOBASE( C_Test_ProxyToggle_Networkable, DT_ProxyToggle_ProxiedData ) + RecvPropInt( RECVINFO( m_WithProxy ) ) +END_RECV_TABLE() + +IMPLEMENT_CLIENTCLASS_DT( C_Test_ProxyToggle_Networkable, DT_ProxyToggle, CTest_ProxyToggle_Networkable ) + RecvPropDataTable( "blah", 0, 0, &REFERENCE_RECV_TABLE( DT_ProxyToggle_ProxiedData ) ) +END_RECV_TABLE() + + + +// ---------------------------------------------------------------------------------------- // +// Console commands. +// ---------------------------------------------------------------------------------------- // + +// The engine uses this to get the current value. +CON_COMMAND_F( Test_ProxyToggle_EnsureValue, "Test_ProxyToggle_EnsureValue", FCVAR_CHEAT ) +{ + if ( args.ArgC() < 2 ) + { + Error( "Test_ProxyToggle_EnsureValue: requires value parameter." ); + } + else if ( !g_pTestObj ) + { + Error( "Test_ProxyToggle_EnsureValue: object doesn't exist on the client." ); + } + + int wantedValue = atoi( args[ 1 ] ); + if ( g_pTestObj->m_WithProxy != wantedValue ) + { + Error( "Test_ProxyToggle_EnsureValue: value (%d) doesn't match wanted value (%d).", g_pTestObj->m_WithProxy, wantedValue ); + } +} + + + + -- cgit v1.2.3