├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake ├── Findsteam_api.cmake ├── Findtier0.cmake └── Findvstdlib.cmake ├── common ├── MinMax.h └── xbox │ └── xboxstubs.h ├── lib └── public │ ├── README.md │ ├── libsteam_api.dylib │ ├── libsteam_api.so │ ├── libtier0.dylib │ ├── libtier0.so │ ├── libvstdlib.dylib │ ├── libvstdlib.so │ ├── steam_api.lib │ ├── steam_api_min.lib │ ├── tier0.lib │ └── vstdlib.lib ├── public ├── Color.h ├── FileSystem.h ├── IBaseUI.h ├── IClientVGUI.h ├── IEngineVGui.h ├── IGameConsole.h ├── IGameUI.h ├── IGameUIFuncs.h ├── OfflineMode.h ├── bitmap │ ├── Bitmap.h │ ├── CMakeLists.txt │ ├── Float_BM.h │ ├── ImageFormat.h │ ├── PSD.h │ ├── TGALoader.h │ └── TGAWriter.h ├── bitvec.h ├── coordsize.h ├── datamap.h ├── filesystem_helpers.cpp ├── filesystem_helpers.h ├── mathlib │ ├── IceKey.H │ ├── amd3dx.h │ ├── anorms.h │ ├── bumpvects.h │ ├── compressed_3d_unitvec.h │ ├── compressed_light_cube.h │ ├── compressed_vector.h │ ├── dbg.h │ ├── halton.h │ ├── lightdesc.h │ ├── math_pfns.h │ ├── mathlib.h │ ├── matrixmath.h │ ├── noise.h │ ├── polyhedron.h │ ├── quantize.h │ ├── simdvectormatrix.h │ ├── spherical_geometry.h │ ├── ssemath.h │ ├── ssequaternion.h │ ├── vector.h │ ├── vector2d.h │ ├── vector4d.h │ ├── vmatrix.h │ └── vplane.h ├── steam │ ├── isteamapplist.h │ ├── isteamapps.h │ ├── isteamclient.h │ ├── isteamcontroller.h │ ├── isteamfriends.h │ ├── isteamgameserver.h │ ├── isteamgameserverstats.h │ ├── isteamhtmlsurface.h │ ├── isteamhttp.h │ ├── isteammatchmaking.h │ ├── isteammusic.h │ ├── isteammusicremote.h │ ├── isteamnetworking.h │ ├── isteamremotestorage.h │ ├── isteamscreenshots.h │ ├── isteamugc.h │ ├── isteamunifiedmessages.h │ ├── isteamuser.h │ ├── isteamuserstats.h │ ├── isteamutils.h │ ├── matchmakingtypes.h │ ├── steam_api.h │ ├── steam_gameserver.h │ ├── steamclientpublic.h │ ├── steamhttpenums.h │ ├── steamtypes.h │ └── steamuniverse.h ├── tier0 │ ├── CMakeLists.txt │ ├── afxmem_override.cpp │ ├── annotations.h │ ├── basetypes.h │ ├── commonmacros.h │ ├── dbg.h │ ├── dbgflag.h │ ├── eventmasks.h │ ├── eventmodes.h │ ├── fasttimer.h │ ├── ia32detect.h │ ├── icommandline.h │ ├── ioctlcodes.h │ ├── k8performancecounters.h │ ├── l2cache.h │ ├── mem.h │ ├── memalloc.h │ ├── memdbgoff.h │ ├── memdbgon.h │ ├── memoverride-vc7.cpp │ ├── memoverride.cpp │ ├── minidump.h │ ├── p4performancecounters.h │ ├── p5p6performancecounters.h │ ├── platform.h │ ├── pmelib.h │ ├── protected_things.h │ ├── testthread.h │ ├── threadtools.h │ ├── tslist.h │ ├── validator.h │ ├── valobject.h │ ├── valve_off.h │ ├── valve_on.h │ ├── vcr_shared.h │ ├── vcrmode.h │ ├── vprof.h │ ├── wchartypes.h │ └── xbox_codeline_defines.h ├── tier1 │ ├── KeyValues.h │ ├── UtlSortVector.h │ ├── UtlStringMap.h │ ├── bitbuf.h │ ├── byteswap.h │ ├── callqueue.h │ ├── characterset.h │ ├── checksum_crc.h │ ├── checksum_md5.h │ ├── checksum_sha1.h │ ├── datamanager.h │ ├── delegates.h │ ├── diff.h │ ├── fileio.h │ ├── fmtstr.h │ ├── functors.h │ ├── generichash.h │ ├── interface.h │ ├── kvpacker.h │ ├── lzmaDecoder.h │ ├── lzss.h │ ├── mempool.h │ ├── memstack.h │ ├── netadr.h │ ├── passwordhash.h │ ├── processor_detect.h │ ├── rangecheckedvar.h │ ├── refcount.h │ ├── reliabletimer.h │ ├── smartptr.h │ ├── snappy-sinksource.h │ ├── snappy-stubs-public.h │ ├── snappy.h │ ├── sparsematrix.h │ ├── stringpool.h │ ├── strtools.h │ ├── thash.h │ ├── tier1.h │ ├── tokenreader.h │ ├── uniqueid.h │ ├── utlallocation.h │ ├── utlarray.h │ ├── utlbidirectionalset.h │ ├── utlbinaryblock.h │ ├── utlblockmemory.h │ ├── utlbuffer.h │ ├── utlbufferutil.h │ ├── utlcommon.h │ ├── utldelegate.h │ ├── utldelegateimpl.h │ ├── utldict.h │ ├── utlenvelope.h │ ├── utlfixedmemory.h │ ├── utlflags.h │ ├── utlhandletable.h │ ├── utlhash.h │ ├── utlhashdict.h │ ├── utlhashtable.h │ ├── utlintrusivelist.h │ ├── utllinkedlist.h │ ├── utlmap.h │ ├── utlmemory.h │ ├── utlmovingaverage.h │ ├── utlmultilist.h │ ├── utlntree.h │ ├── utlobjectreference.h │ ├── utlpair.h │ ├── utlpriorityqueue.h │ ├── utlqueue.h │ ├── utlrbtree.h │ ├── utlsoacontainer.h │ ├── utlstack.h │ ├── utlstring.h │ ├── utlsymbol.h │ ├── utlsymbollarge.h │ ├── utltshash.h │ └── utlvector.h ├── tier2 │ └── tier2.h ├── vgui │ ├── CMakeLists.txt │ ├── Cursor.h │ ├── Dar.h │ ├── IBorder.h │ ├── IClientPanel.h │ ├── IHTML.h │ ├── IImage.h │ ├── IInput.h │ ├── IInputInternal.h │ ├── ILocalize.h │ ├── IPanel.h │ ├── IScheme.h │ ├── ISurface.h │ ├── ISystem.h │ ├── IVGui.h │ ├── IVguiMatInfo.h │ ├── IVguiMatInfoVar.h │ ├── KeyCode.h │ ├── MouseCode.h │ ├── Point.h │ └── VGUI2.h ├── vgui_controls │ ├── AnalogBar.h │ ├── AnimatingImagePanel.h │ ├── AnimationController.h │ ├── BitmapImagePanel.h │ ├── BuildGroup.h │ ├── BuildModeDialog.h │ ├── Button.h │ ├── CheckButton.h │ ├── CheckButtonList.h │ ├── CircularProgressBar.h │ ├── ComboBox.h │ ├── ControllerMap.h │ ├── Controls.h │ ├── DialogManager.h │ ├── DirectorySelectDialog.h │ ├── Divider.h │ ├── EditablePanel.h │ ├── ExpandButton.h │ ├── FileOpenDialog.h │ ├── FileOpenStateMachine.h │ ├── FocusNavGroup.h │ ├── Frame.h │ ├── GraphPanel.h │ ├── HTML.h │ ├── Image.h │ ├── ImageList.h │ ├── ImagePanel.h │ ├── InputDialog.h │ ├── KeyBindingHelpDialog.h │ ├── KeyBindingMap.h │ ├── KeyBoardEditorDialog.h │ ├── KeyRepeat.h │ ├── Label.h │ ├── ListPanel.h │ ├── ListViewPanel.h │ ├── Menu.h │ ├── MenuBar.h │ ├── MenuButton.h │ ├── MenuItem.h │ ├── MessageBox.h │ ├── MessageDialog.h │ ├── MessageMap.h │ ├── PHandle.h │ ├── Panel.h │ ├── PanelAnimationVar.h │ ├── PanelListPanel.h │ ├── PerforceFileExplorer.h │ ├── PerforceFileList.h │ ├── ProgressBar.h │ ├── ProgressBox.h │ ├── PropertyDialog.h │ ├── PropertyPage.h │ ├── PropertySheet.h │ ├── QueryBox.h │ ├── RadioButton.h │ ├── RichText.h │ ├── RotatingProgressBar.h │ ├── ScalableImagePanel.h │ ├── ScrollBar.h │ ├── ScrollBarSlider.h │ ├── ScrollableEditablePanel.h │ ├── SectionedListPanel.h │ ├── Slider.h │ ├── Splitter.h │ ├── TextEntry.h │ ├── TextImage.h │ ├── ToggleButton.h │ ├── ToolWindow.h │ ├── Tooltip.h │ ├── TreeView.h │ ├── TreeViewListControl.h │ ├── URLLabel.h │ ├── WizardPanel.h │ ├── WizardSubPanel.h │ ├── consoledialog.h │ ├── cvartogglecheckbutton.h │ ├── pch_vgui_controls.h │ ├── perforcefilelistframe.h │ ├── savedocumentquery.h │ ├── subrectimage.h │ └── vgui_controls.cpp ├── vstdlib │ ├── CMakeLists.txt │ ├── ICommandline.h │ ├── IKeyValuesSystem.h │ ├── cvar.h │ ├── pch_vstdlib.h │ ├── random.h │ ├── strtools.h │ └── vstdlib.h ├── winlite.h └── worldsize.h ├── thirdpartylegalnotices.txt ├── tier1 ├── CMakeLists.txt ├── KeyValues.cpp ├── NetAdr.cpp ├── bitbuf.cpp ├── byteswap.cpp ├── characterset.cpp ├── checksum_crc.cpp ├── checksum_md5.cpp ├── checksum_sha1.cpp ├── datamanager.cpp ├── diff.cpp ├── fileio.cpp ├── generichash.cpp ├── interface.cpp ├── kvpacker.cpp ├── mempool.cpp ├── memstack.cpp ├── newbitbuf.cpp ├── pathmatch.cpp ├── pathmatch_casefolding.h ├── processor_detect.cpp ├── processor_detect_linux.cpp ├── qsort_s.cpp ├── rangecheckedvar.cpp ├── reliabletimer.cpp ├── sparsematrix.cpp ├── splitstring.cpp ├── stringpool.cpp ├── strtools.cpp ├── strtools_unicode.cpp ├── tier1.cpp ├── tokenreader.cpp ├── undiff.cpp ├── uniqueid.cpp ├── utlbinaryblock.cpp ├── utlbuffer.cpp ├── utlbufferutil.cpp ├── utlstring.cpp └── utlsymbol.cpp ├── tier2 ├── CMakeLists.txt ├── KeyValuesCompat.cpp ├── KeyValuesCompat.h ├── steam_api.cpp └── tier2.cpp └── vgui2 ├── src ├── vgui_key_translation.cpp └── vgui_key_translation.h └── vgui_controls ├── AnalogBar.cpp ├── AnimatingImagePanel.cpp ├── AnimationController.cpp ├── BitmapImagePanel.cpp ├── BuildFactoryHelper.cpp ├── BuildGroup.cpp ├── BuildModeDialog.cpp ├── Button.cpp ├── CMakeLists.txt ├── CheckButton.cpp ├── CheckButtonList.cpp ├── CircularProgressBar.cpp ├── ComboBox.cpp ├── ControllerMap.cpp ├── DirectorySelectDialog.cpp ├── Divider.cpp ├── EditablePanel.cpp ├── ExpandButton.cpp ├── FileOpenDialog.cpp ├── FileOpenStateMachine.cpp ├── FocusNavGroup.cpp ├── Frame.cpp ├── GraphPanel.cpp ├── HTML.cpp ├── Image.cpp ├── ImageList.cpp ├── ImagePanel.cpp ├── InputDialog.cpp ├── KeyBindingHelpDialog.cpp ├── KeyBoardEditorDialog.cpp ├── KeyRepeat.cpp ├── Label.cpp ├── ListPanel.cpp ├── ListViewPanel.cpp ├── Menu.cpp ├── MenuBar.cpp ├── MenuButton.cpp ├── MenuItem.cpp ├── MessageBox.cpp ├── MessageDialog.cpp ├── Panel.cpp ├── PanelListPanel.cpp ├── PerforceFileExplorer.cpp ├── PerforceFileList.cpp ├── ProgressBar.cpp ├── ProgressBox.cpp ├── PropertyDialog.cpp ├── PropertyPage.cpp ├── PropertySheet.cpp ├── QueryBox.cpp ├── RadioButton.cpp ├── RichText.cpp ├── RotatingProgressBar.cpp ├── ScalableImagePanel.cpp ├── ScrollBar.cpp ├── ScrollBarSlider.cpp ├── ScrollableEditablePanel.cpp ├── SectionedListPanel.cpp ├── Slider.cpp ├── Splitter.cpp ├── TextEntry.cpp ├── TextImage.cpp ├── ToggleButton.cpp ├── ToolWindow.cpp ├── Tooltip.cpp ├── TreeView.cpp ├── TreeViewListControl.cpp ├── URLLabel.cpp ├── WizardPanel.cpp ├── WizardSubPanel.cpp ├── consoledialog.cpp ├── controls.cpp ├── cvartogglecheckbutton.cpp ├── perforcefilelistframe.cpp ├── savedocumentquery.cpp └── subrectimage.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | # macOS garbage 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Source SDK for Half-Life 1 2 | ========================== 3 | 4 | This repository contains parts of Source SDK 2013 ported to be used with 5 | Half-Life 1 (GoldSource) engine. Specifically: 6 | 7 | - *vstdlib* and *tier0* (headers) - platform abstraction layer. 8 | - *tier1* - Valve's template library, KeyValues and DLL interface. 9 | - *tier2* - GoldSrc engine linking library. Exports various engine interfaces. 10 | - *vgui_controls* - VGUI2 elements. 11 | - *steam_api* - Steam API. HL1 since SteamPipe update uses API version identical to Source 2013. 12 | 13 | 14 | You can find engine interfaces in *tier2/tier2.h*: 15 | 16 | - *IFileSystem* - file system. 17 | - *IBaseUI* - exported by the engine to the client. Allows to show and hide GameUI and console from client's code. 18 | - *IGameUIFuncs* - provides some info about the game. 19 | - *IEngineVGui* - provides access to root panels (see hierarchy in VGUI2 docs). 20 | - *IClientVGUI* - exported by the client. Used to initialize and control VGUI2 in the client library. 21 | 22 | Documentation 23 | ------------- 24 | 25 | Documentation can be found on [Valve Developer Community](https://developer.valvesoftware.com/): 26 | 27 | - [tier1](https://developer.valvesoftware.com/wiki/Tier1) 28 | - [VGUI2 basics](https://developer.valvesoftware.com/wiki/VGUI_Documentation) 29 | - [VGUI2 category on VDC](https://developer.valvesoftware.com/wiki/Category:VGUI) 30 | - [KeyValues](https://developer.valvesoftware.com/wiki/KeyValues) 31 | 32 | 33 | Credits 34 | ------- 35 | 36 | - Valve Software (Source SDK) 37 | - SamVanheer (GoldSrc engine reverse engineering). 38 | 39 | Integrating into your mod 40 | ------------------------- 41 | 0. Your mod must use CMake. 42 | 1. Add this repo as a **submodule**. 43 | 2. In your main CMakeLists.txt: 44 | ```cmake 45 | # source_sdk is the directory you cloned this repo to. 46 | add_subdirectory( source_sdk ) 47 | ``` 48 | 3. The CMakeLists.txt of this project sets following variables in the parent scope: 49 | - *SOURCE_SDK_DEFINES* - Add it to client's compile definitions. 50 | - *SOURCE_SDK_INCLUDE_PATHS* - Add it to client's include paths. 51 | - *SOURCE_SDK_LIBS* - Link the client library with these libs. 52 | 4. Implement IClientVGUI. Basic init method should look like this: 53 | ```cpp 54 | #include 55 | #include 56 | #include 57 | #include 58 | 59 | void CClientVGUI::Initialize(CreateInterfaceFn *pFactories, int iNumFactories) 60 | { 61 | ConnectTier1Libraries(pFactories, iNumFactories); 62 | ConnectTier2Libraries(pFactories, iNumFactories); 63 | 64 | if (!vgui2::VGui_InitInterfacesList("CLIENT", pFactories, iNumFactories)) 65 | { 66 | Error("Failed to intialize VGUI2\n"); 67 | Assert(false); 68 | } 69 | } 70 | ``` 71 | You can now use VGUI2 controls but you should probably create a viewport. 72 | Look at *source-sdk-2013/mp/src/game/client/game_controls/baseviewport.h* 73 | and implement something similar. 74 | 5. Have fun! :D 75 | -------------------------------------------------------------------------------- /cmake/Findsteam_api.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Finds Steam API library 3 | # 4 | 5 | set( STEAM_API_WIN_LIB steam_api.lib ) 6 | 7 | if( SOURCE_SDK_MIN_STEAM_API ) 8 | set( STEAM_API_WIN_LIB steam_api_min.lib ) 9 | endif() 10 | 11 | find_library( STEAMAPI_LIB NAMES ${STEAM_API_WIN_LIB} libsteam_api.dylib libsteam_api.so PATHS ${SOURCE_SDK_ROOT}/lib/public NO_DEFAULT_PATH ) 12 | 13 | include( FindPackageHandleStandardArgs ) 14 | find_package_handle_standard_args( steam_api DEFAULT_MSG STEAMAPI_LIB ) 15 | 16 | if( STEAMAPI_LIB ) 17 | add_library( steam_api SHARED IMPORTED GLOBAL ) 18 | 19 | if( MSVC ) 20 | set_property( TARGET steam_api PROPERTY IMPORTED_IMPLIB ${STEAMAPI_LIB} ) 21 | else() 22 | set_property( TARGET steam_api PROPERTY IMPORTED_LOCATION ${STEAMAPI_LIB} ) 23 | endif() 24 | endif() 25 | 26 | unset( STEAMAPI_LIB CACHE ) 27 | -------------------------------------------------------------------------------- /cmake/Findtier0.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Finds tier0 (GoldSource specific) 3 | # 4 | 5 | find_library( TIER0_LIB tier0 PATHS ${tier0_DIR} ${SOURCE_SDK_ROOT}/lib/public NO_DEFAULT_PATH ) 6 | 7 | include( FindPackageHandleStandardArgs ) 8 | find_package_handle_standard_args( tier0 DEFAULT_MSG TIER0_LIB ) 9 | 10 | if( TIER0_LIB ) 11 | add_library( tier0 SHARED IMPORTED GLOBAL ) 12 | 13 | if( MSVC ) 14 | set_property( TARGET tier0 PROPERTY IMPORTED_IMPLIB ${TIER0_LIB} ) 15 | else() 16 | set_property( TARGET tier0 PROPERTY IMPORTED_LOCATION ${TIER0_LIB} ) 17 | endif() 18 | endif() 19 | 20 | unset( TIER0_LIB CACHE ) 21 | -------------------------------------------------------------------------------- /cmake/Findvstdlib.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Finds vstdlib (GoldSource specific) 3 | # 4 | 5 | find_library( VSTDLIB_LIB vstdlib PATHS ${tier0_DIR} ${SOURCE_SDK_ROOT}/lib/public NO_DEFAULT_PATH ) 6 | 7 | include( FindPackageHandleStandardArgs ) 8 | find_package_handle_standard_args( vstdlib DEFAULT_MSG VSTDLIB_LIB ) 9 | 10 | if( VSTDLIB_LIB ) 11 | add_library( vstdlib SHARED IMPORTED GLOBAL ) 12 | 13 | if( MSVC ) 14 | set_property( TARGET vstdlib PROPERTY IMPORTED_IMPLIB ${VSTDLIB_LIB} ) 15 | else() 16 | set_property( TARGET vstdlib PROPERTY IMPORTED_LOCATION ${VSTDLIB_LIB} ) 17 | endif() 18 | endif() 19 | 20 | unset( VSTDLIB_LIB CACHE ) 21 | -------------------------------------------------------------------------------- /common/MinMax.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_MINMAX_H 2 | #define COMMON_MINMAX_H 3 | 4 | #undef min 5 | #undef max 6 | #undef clamp 7 | 8 | #include 9 | 10 | #if defined( min ) || defined( max ) 11 | #error "Don't define min and/or max, use std::min and std::max instead!" 12 | #endif 13 | 14 | using std::min; 15 | using std::max; 16 | 17 | //C++17 will have std::clamp, so make sure it matches the function declaration. - Solokiller 18 | //Note: std::clamp will return const ref, which can produce dangling references. This version returns a copy. 19 | template T clamp( const T& val, const T& min, const T& max ) 20 | { 21 | return ( ( val > max ) ? max : ( ( val < min ) ? min : val ) ); 22 | } 23 | 24 | #endif //COMMON_MINMAX_H 25 | -------------------------------------------------------------------------------- /lib/public/README.md: -------------------------------------------------------------------------------- 1 | This directory contains libraries to be used for linking by CMake. 2 | 3 | *.so files have been patched to fix linking issue: https://github.com/ValveSoftware/halflife/issues/1912 4 | 5 | ```bash 6 | patchelf --set-soname libtier0.so libtier0.so 7 | patchelf --set-soname libvstdlib.so libvstdlib.so 8 | ``` 9 | -------------------------------------------------------------------------------- /lib/public/libsteam_api.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/libsteam_api.dylib -------------------------------------------------------------------------------- /lib/public/libsteam_api.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/libsteam_api.so -------------------------------------------------------------------------------- /lib/public/libtier0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/libtier0.dylib -------------------------------------------------------------------------------- /lib/public/libtier0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/libtier0.so -------------------------------------------------------------------------------- /lib/public/libvstdlib.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/libvstdlib.dylib -------------------------------------------------------------------------------- /lib/public/libvstdlib.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/libvstdlib.so -------------------------------------------------------------------------------- /lib/public/steam_api.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/steam_api.lib -------------------------------------------------------------------------------- /lib/public/steam_api_min.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/steam_api_min.lib -------------------------------------------------------------------------------- /lib/public/tier0.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/tier0.lib -------------------------------------------------------------------------------- /lib/public/vstdlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/lib/public/vstdlib.lib -------------------------------------------------------------------------------- /public/Color.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef COLOR_H 9 | #define COLOR_H 10 | #include 11 | 12 | #ifdef _WIN32 13 | #pragma once 14 | #endif 15 | 16 | // Color relies on int being 4 bytes long 17 | static_assert(sizeof(int) == 4, "int size is not 4"); 18 | 19 | //----------------------------------------------------------------------------- 20 | // Purpose: Basic handler for an rgb set of colors 21 | // This class is fully inline 22 | //----------------------------------------------------------------------------- 23 | class Color 24 | { 25 | public: 26 | // constructors 27 | Color() 28 | { 29 | memset(_color, 0, 4); 30 | } 31 | Color(int _r,int _g,int _b) 32 | { 33 | SetColor(_r, _g, _b, 0); 34 | } 35 | Color(int _r,int _g,int _b,int _a) 36 | { 37 | SetColor(_r, _g, _b, _a); 38 | } 39 | 40 | // set the color 41 | // r - red component (0-255) 42 | // g - green component (0-255) 43 | // b - blue component (0-255) 44 | // a - alpha component, controls transparency (0 - transparent, 255 - opaque); 45 | void SetColor(int _r, int _g, int _b, int _a = 0) 46 | { 47 | _color[0] = (unsigned char)_r; 48 | _color[1] = (unsigned char)_g; 49 | _color[2] = (unsigned char)_b; 50 | _color[3] = (unsigned char)_a; 51 | } 52 | 53 | void GetColor(int &_r, int &_g, int &_b, int &_a) const 54 | { 55 | _r = _color[0]; 56 | _g = _color[1]; 57 | _b = _color[2]; 58 | _a = _color[3]; 59 | } 60 | 61 | void SetRawColor( int color32 ) 62 | { 63 | memcpy(_color, &color32, 4); 64 | } 65 | 66 | int GetRawColor() const 67 | { 68 | int ret; 69 | memcpy(&ret, _color, 4); 70 | return ret; 71 | } 72 | 73 | inline int r() const { return _color[0]; } 74 | inline int g() const { return _color[1]; } 75 | inline int b() const { return _color[2]; } 76 | inline int a() const { return _color[3]; } 77 | 78 | unsigned char &operator[](int index) 79 | { 80 | return _color[index]; 81 | } 82 | 83 | const unsigned char &operator[](int index) const 84 | { 85 | return _color[index]; 86 | } 87 | 88 | bool operator == (const Color &rhs) const 89 | { 90 | return memcmp(_color, rhs._color, 4) == 0; 91 | } 92 | 93 | bool operator != (const Color &rhs) const 94 | { 95 | return memcmp(_color, rhs._color, 4) != 0; 96 | } 97 | 98 | Color &operator=( const Color &rhs ) 99 | { 100 | if (this != &rhs) 101 | memcpy(_color, rhs._color, 4); 102 | return *this; 103 | } 104 | 105 | private: 106 | unsigned char _color[4]; 107 | }; 108 | 109 | 110 | #endif // COLOR_H 111 | -------------------------------------------------------------------------------- /public/IBaseUI.h: -------------------------------------------------------------------------------- 1 | #ifndef ENGINE_IBASEUI_H 2 | #define ENGINE_IBASEUI_H 3 | 4 | #include "interface.h" 5 | 6 | struct cl_enginefunc_t; 7 | 8 | /** 9 | * Interface to the engine's game UI controls. 10 | * Most of these are handled by the engine itself. 11 | */ 12 | class IBaseUI : public IBaseInterface 13 | { 14 | public: 15 | 16 | /** 17 | * Called when this interface is first loaded. Initializes the game UI. 18 | * @param pFactories Array of factories to use. 19 | * @param iNumFactories Number of factories. 20 | */ 21 | virtual void Initialize( CreateInterfaceFn* pFactories, int iNumFactories ) = 0; 22 | 23 | /** 24 | * Sets up the game UI. 25 | */ 26 | virtual void Start( cl_enginefunc_t* pEngfuncs, int iVersion ) = 0; 27 | 28 | /** 29 | * Shuts down the UI. Unloads libraries used by the UI. 30 | */ 31 | virtual void Shutdown() = 0; 32 | 33 | /** 34 | * Called when a key event occurs. 35 | * @param down Whether the key was up or down. 36 | * @param keynum Key number that was pressed or released. 37 | * @param pszCurrentBinding The current binding for the key. 38 | * @return Whether the event was handled. 39 | */ 40 | virtual int Key_Event( int down, int keynum, const char* pszCurrentBinding ) = 0; 41 | 42 | /** 43 | * Calls the engine's surface app handler to handle the given SDL event. 44 | * @param pEvent Event. 45 | * @param pUserData User data associated with the event. Ignored. 46 | */ 47 | virtual void CallEngineSurfaceAppHandler( void* pEvent, void* pUserData ) = 0; 48 | 49 | /** 50 | * Draw the section of the VGUI2 UI that is contained in the given rectangle. 51 | */ 52 | virtual void Paint( int x, int y, int right, int bottom ) = 0; 53 | 54 | /** 55 | * Hides the game UI and activates the client UI. 56 | */ 57 | virtual void HideGameUI() = 0; 58 | 59 | /** 60 | * Activates the game UI and hides the client UI. 61 | */ 62 | virtual void ActivateGameUI() = 0; 63 | 64 | /** 65 | * Hides the game console. 66 | */ 67 | virtual void HideConsole() = 0; 68 | 69 | /** 70 | * Shows the game console. 71 | */ 72 | virtual void ShowConsole() = 0; 73 | }; 74 | 75 | /** 76 | * Interface version for IBaseUI. 77 | */ 78 | #define IBASEUI_NAME "BaseUI001" 79 | 80 | #endif //ENGINE_IBASEUI_H 81 | -------------------------------------------------------------------------------- /public/IClientVGUI.h: -------------------------------------------------------------------------------- 1 | #ifndef ENGINE_ICLIENTVGUI_H 2 | #define ENGINE_ICLIENTVGUI_H 3 | 4 | #include "interface.h" 5 | 6 | #include 7 | 8 | /** 9 | * Client VGUI2 interface. Enables the client library to use VGUI2. 10 | */ 11 | class IClientVGUI : public IBaseInterface 12 | { 13 | public: 14 | 15 | /** 16 | * Called when this interface is first loaded. Initializes the client UI. 17 | * @param pFactories Array of factories to use. 18 | * @param iNumFactories Number of factories. 19 | */ 20 | virtual void Initialize( CreateInterfaceFn* pFactories, int iNumFactories ) = 0; 21 | 22 | /** 23 | * Called after the client UI has been initialized and the parent has been set. 24 | */ 25 | virtual void Start() = 0; 26 | 27 | /** 28 | * Sets the parent panel. The root client panel should set this as its parent. 29 | * @param parent Parent panel. 30 | */ 31 | virtual void SetParent( vgui2::VPANEL parent ) = 0; 32 | 33 | /** 34 | * @return 1 if VGUI1 should be used, 0 if VGUI2 should be used. 35 | */ 36 | virtual int UseVGUI1() = 0; 37 | 38 | /** 39 | * Tells the client to hide the score board panel. 40 | * Called when the game UI is made visible (main menu, etc). 41 | */ 42 | virtual void HideScoreBoard() = 0; 43 | 44 | /** 45 | * Tells the client to hide all menus, dialogs and windows. 46 | * Called when the loading progress bar has been stopped. 47 | */ 48 | virtual void HideAllVGUIMenu() = 0; 49 | 50 | /** 51 | * Tells the client to activate its UI. 52 | * Called when the game UI is hidden. 53 | */ 54 | virtual void ActivateClientUI() = 0; 55 | 56 | /** 57 | * Tells the client to hide its UI. 58 | * Called when the game UI is activated. 59 | */ 60 | virtual void HideClientUI() = 0; 61 | 62 | /** 63 | * Shuts down the client UI. 64 | * Note: only called for CS & CZero, do not use! - Solokiller 65 | */ 66 | virtual void Shutdown() = 0; 67 | }; 68 | 69 | /** 70 | * Client VGUI name. 71 | */ 72 | #define ICLIENTVGUI_NAME "VClientVGUI001" 73 | 74 | #endif //ENGINE_ICLIENTVGUI_H -------------------------------------------------------------------------------- /public/IEngineVGui.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/IEngineVGui.h -------------------------------------------------------------------------------- /public/IGameConsole.h: -------------------------------------------------------------------------------- 1 | #ifndef IGAMECONSOLE_GS_H 2 | #define IGAMECONSOLE_GS_H 3 | 4 | #ifdef _WIN32 5 | #pragma once 6 | #endif 7 | 8 | #include "interface.h" 9 | 10 | class Color; 11 | 12 | class IGameConsole : public IBaseInterface 13 | { 14 | public: 15 | virtual void Activate(void) = 0; 16 | virtual void Initialize(void) = 0; 17 | virtual void Hide(void) = 0; 18 | virtual void Clear(void) = 0; 19 | virtual bool IsConsoleVisible(void) = 0; 20 | virtual void Printf(const char *format, ...) = 0; 21 | virtual void DPrintf(const char *format, ...) = 0; 22 | //virtual void ColorPrintf(Color &clr) = 0; // Doesn't exist on GS 23 | virtual void SetParent(int parent) = 0; 24 | }; 25 | 26 | #define GAMECONSOLE_INTERFACE_VERSION_GS "GameConsole003" 27 | #endif 28 | -------------------------------------------------------------------------------- /public/IGameUI.h: -------------------------------------------------------------------------------- 1 | #ifndef IGAMEUI_GS_H 2 | #define IGAMEUI_GS_H 3 | #include 4 | 5 | struct cl_enginefunc_t; 6 | 7 | class IGameUI : public IBaseInterface 8 | { 9 | public: 10 | virtual void Initialize(CreateInterfaceFn *factories, int count) = 0; 11 | virtual void Start(cl_enginefunc_t *engineFuncs, int interfaceVersion, void *system) = 0; 12 | virtual void Shutdown(void) = 0; 13 | virtual int ActivateGameUI(void) = 0; 14 | virtual int ActivateDemoUI(void) = 0; 15 | virtual int HasExclusiveInput(void) = 0; 16 | virtual void RunFrame(void) = 0; 17 | virtual void ConnectToServer(const char *game, int IP, int port) = 0; 18 | virtual void DisconnectFromServer(void) = 0; 19 | virtual void HideGameUI(void) = 0; 20 | virtual bool IsGameUIActive(void) = 0; 21 | virtual void LoadingStarted(const char *resourceType, const char *resourceName) = 0; 22 | virtual void LoadingFinished(const char *resourceType, const char *resourceName) = 0; 23 | virtual void StartProgressBar(const char *progressType, int progressSteps) = 0; 24 | virtual int ContinueProgressBar(int progressPoint, float progressFraction) = 0; 25 | virtual void StopProgressBar(bool bError, const char *failureReason, const char *extendedReason = NULL) = 0; 26 | virtual int SetProgressBarStatusText(const char *statusText) = 0; 27 | virtual void SetSecondaryProgressBar(float progress) = 0; 28 | virtual void SetSecondaryProgressBarText(const char *statusText) = 0; 29 | virtual void ValidateCDKey(bool, bool) = 0; 30 | virtual void OnDisconnectFromServer(int eSteamLoginFailure, const char *username) = 0; 31 | 32 | // New in HL25 (linux build 9885) 33 | virtual void SetIsRunningOnSteamDeck(bool bIsRunningOnDeck) = 0; 34 | virtual bool IsRunningOnSteamDeck() const = 0; 35 | }; 36 | 37 | #define GAMEUI_INTERFACE_VERSION_GS "GameUI007" 38 | 39 | #endif -------------------------------------------------------------------------------- /public/OfflineMode.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #include 8 | #include 9 | 10 | #define STEAM_OFFLINE_MODE "HKEY_CURRENT_USER\\Software\\Valve\\Steam\\Offline" 11 | #define STEAM_AFS_MODE "HKEY_CURRENT_USER\\Software\\Valve\\Steam\\OfflineAFS" 12 | #define OFFLINE_FILE "Steam\\cached\\offline_" // first part of filename 13 | 14 | inline bool IsSteamInOfflineMode() 15 | { 16 | int offline = 0; 17 | vgui2::system()->GetRegistryInteger( STEAM_OFFLINE_MODE, offline ); 18 | return ( offline == 1 ); 19 | }inline bool IsSteamInAuthenticationFailSafeMode() 20 | { 21 | int offline = 0; 22 | vgui2::system()->GetRegistryInteger( STEAM_AFS_MODE, offline ); 23 | return ( offline == 1 ); 24 | } 25 | 26 | inline bool IsSteamGameServerBrowsingEnabled() 27 | { 28 | return (IsSteamInAuthenticationFailSafeMode() || !IsSteamInOfflineMode()); 29 | } 30 | -------------------------------------------------------------------------------- /public/bitmap/Bitmap.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/bitmap/Bitmap.h -------------------------------------------------------------------------------- /public/bitmap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_sources( 2 | CMakeLists.txt 3 | Bitmap.h 4 | Float_BM.h 5 | ImageFormat.h 6 | PSD.h 7 | TGALoader.h 8 | TGAWriter.h 9 | ) 10 | -------------------------------------------------------------------------------- /public/bitmap/Float_BM.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/bitmap/Float_BM.h -------------------------------------------------------------------------------- /public/bitmap/ImageFormat.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/bitmap/ImageFormat.h -------------------------------------------------------------------------------- /public/bitmap/PSD.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/bitmap/PSD.h -------------------------------------------------------------------------------- /public/bitmap/TGALoader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/bitmap/TGALoader.h -------------------------------------------------------------------------------- /public/bitmap/TGAWriter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/bitmap/TGAWriter.h -------------------------------------------------------------------------------- /public/filesystem_helpers.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //===========================================================================// 7 | 8 | #ifndef FILESYSTEM_HELPERS_H 9 | #define FILESYSTEM_HELPERS_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | struct characterset_t; 16 | 17 | // Don't call this directly. You should (as long as your destination is an array) be 18 | // able to call ParseFile, which is safer as it infers your array size for you. 19 | const char* ParseFileInternal( const char* pFileBytes, OUT_Z_CAP(nMaxTokenLen) char* pTokenOut, bool* pWasQuoted, characterset_t *pCharSet, size_t nMaxTokenLen ); 20 | 21 | // Call until it returns NULL. Each time you call it, it will parse out a token. 22 | 23 | template 24 | const char* ParseFile( const char* pFileBytes, OUT_Z_ARRAY char (&pTokenOut)[count], bool* pWasQuoted, characterset_t *pCharSet = NULL, unsigned int nMaxTokenLen = (unsigned int)-1 ) 25 | { 26 | (void*)nMaxTokenLen; // Avoid unreferenced variable warnings. 27 | return ParseFileInternal( pFileBytes, pTokenOut, pWasQuoted, pCharSet, count ); 28 | } 29 | 30 | template 31 | char* ParseFile( char* pFileBytes, OUT_Z_ARRAY char (&pTokenOut)[count], bool* pWasQuoted ) // (same exact thing as the const version) 32 | { 33 | return const_cast( ParseFileInternal( pFileBytes, pTokenOut, pWasQuoted, NULL, count ) ); 34 | } 35 | 36 | bool FS_GetFileTypeForFullPath(char const *pFullPath, wchar_t *buf, size_t bufSizeInBytes); 37 | 38 | bool FS_IsFileWritable(IFileSystem *pFileSystem, char const *pFileName, const char *pPathID = 0); 39 | 40 | 41 | #endif // FILESYSTEM_HELPERS_H 42 | -------------------------------------------------------------------------------- /public/mathlib/IceKey.H: -------------------------------------------------------------------------------- 1 | // Purpose: Header file for the C++ ICE encryption class. 2 | // Taken from public domain code, as written by Matthew Kwan - July 1996 3 | // http://www.darkside.com.au/ice/ 4 | 5 | #ifndef _IceKey_H 6 | #define _IceKey_H 7 | 8 | /* 9 | The IceKey class is used for encrypting and decrypting 64-bit blocks of data 10 | with the ICE (Information Concealment Engine) encryption algorithm. 11 | 12 | The constructor creates a new IceKey object that can be used to encrypt and decrypt data. 13 | The level of encryption determines the size of the key, and hence its speed. 14 | Level 0 uses the Thin-ICE variant, which is an 8-round cipher taking an 8-byte key. 15 | This is the fastest option, and is generally considered to be at least as secure as DES, 16 | although it is not yet certain whether it is as secure as its key size. 17 | 18 | For levels n greater than zero, a 16n-round cipher is used, taking 8n-byte keys. 19 | Although not as fast as level 0, these are very very secure. 20 | 21 | Before an IceKey can be used to encrypt data, its key schedule must be set with the set() member function. 22 | The length of the key required is determined by the level, as described above. 23 | 24 | The member functions encrypt() and decrypt() encrypt and decrypt respectively data 25 | in blocks of eight chracters, using the specified key. 26 | 27 | Two functions keySize() and blockSize() are provided 28 | which return the key and block size respectively, measured in bytes. 29 | The key size is determined by the level, while the block size is always 8. 30 | 31 | The destructor zeroes out and frees up all memory associated with the key. 32 | */ 33 | 34 | class IceSubkey; 35 | 36 | class IceKey { 37 | public: 38 | IceKey (int n); 39 | ~IceKey (); 40 | 41 | void set (const unsigned char *key); 42 | 43 | void encrypt (const unsigned char *plaintext, 44 | unsigned char *ciphertext) const; 45 | 46 | void decrypt (const unsigned char *ciphertext, 47 | unsigned char *plaintext) const; 48 | 49 | int keySize () const; 50 | 51 | int blockSize () const; 52 | 53 | private: 54 | void scheduleBuild (unsigned short *k, int n, 55 | const int *keyrot); 56 | 57 | int _size; 58 | int _rounds; 59 | IceSubkey *_keysched; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /public/mathlib/anorms.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef ANORMS_H 8 | #define ANORMS_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | 14 | #include "mathlib/vector.h" 15 | 16 | 17 | #define NUMVERTEXNORMALS 162 18 | 19 | // the angle between consecutive g_anorms[] vectors is ~14.55 degrees 20 | #define VERTEXNORMAL_CONE_INNER_ANGLE DEG2RAD(7.275) 21 | 22 | extern Vector g_anorms[NUMVERTEXNORMALS]; 23 | 24 | 25 | #endif // ANORMS_H 26 | -------------------------------------------------------------------------------- /public/mathlib/bumpvects.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $Workfile: $ 6 | // $Date: $ 7 | // $NoKeywords: $ 8 | //=============================================================================// 9 | 10 | #ifndef BUMPVECTS_H 11 | #define BUMPVECTS_H 12 | 13 | #ifdef _WIN32 14 | #pragma once 15 | #endif 16 | 17 | #include "mathlib/mathlib.h" 18 | 19 | #define OO_SQRT_2 0.70710676908493042f 20 | #define OO_SQRT_3 0.57735025882720947f 21 | #define OO_SQRT_6 0.40824821591377258f 22 | // sqrt( 2 / 3 ) 23 | #define OO_SQRT_2_OVER_3 0.81649661064147949f 24 | 25 | #define NUM_BUMP_VECTS 3 26 | 27 | const TableVector g_localBumpBasis[NUM_BUMP_VECTS] = 28 | { 29 | { OO_SQRT_2_OVER_3, 0.0f, OO_SQRT_3 }, 30 | { -OO_SQRT_6, OO_SQRT_2, OO_SQRT_3 }, 31 | { -OO_SQRT_6, -OO_SQRT_2, OO_SQRT_3 } 32 | }; 33 | 34 | void GetBumpNormals( const Vector& sVect, const Vector& tVect, const Vector& flatNormal, 35 | const Vector& phongNormal, Vector bumpNormals[NUM_BUMP_VECTS] ); 36 | 37 | #endif // BUMPVECTS_H 38 | -------------------------------------------------------------------------------- /public/mathlib/compressed_light_cube.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef COMPRESSED_LIGHT_CUBE_H 8 | #define COMPRESSED_LIGHT_CUBE_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | 14 | #include "mathlib/mathlib.h" 15 | 16 | 17 | struct CompressedLightCube 18 | { 19 | DECLARE_BYTESWAP_DATADESC(); 20 | ColorRGBExp32 m_Color[6]; 21 | }; 22 | 23 | 24 | #endif // COMPRESSED_LIGHT_CUBE_H 25 | -------------------------------------------------------------------------------- /public/mathlib/dbg.h: -------------------------------------------------------------------------------- 1 | #ifndef MATHLIB_DBG_H 2 | #define MATHLIB_DBG_H 3 | 4 | // You can redefine MathlibAssert to some other macro. 5 | // Otherwise, if MATHLIB_USE_C_ASSERT defined, it will use assert 6 | // Otherwise, tier0's Assert is used (linking with tier0 is required). 7 | #ifndef MathlibAssert 8 | 9 | #ifdef MATHLIB_USE_C_ASSERT 10 | 11 | // C assert 12 | #include 13 | #define MathlibAssert assert 14 | 15 | #else 16 | 17 | // Tier0 Assert 18 | #include 19 | #define MathlibAssert Assert 20 | 21 | #endif // ifdef MATHLIB_USE_C_ASSERT 22 | 23 | #endif // ifndef MathlibAssert 24 | 25 | #endif // ifndef MATHLIB_DBG_H 26 | -------------------------------------------------------------------------------- /public/mathlib/halton.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // $Id$ 3 | 4 | // halton.h - classes, etc for generating numbers using the Halton pseudo-random sequence. See 5 | // http://halton-sequences.wikiverse.org/. 6 | // 7 | // what this function is useful for is any sort of sampling/integration problem where 8 | // you want to solve it by random sampling. Each call the NextValue() generates 9 | // a random number between 0 and 1, in an unclumped manner, so that the space can be more 10 | // or less evenly sampled with a minimum number of samples. 11 | // 12 | // It is NOT useful for generating random numbers dynamically, since the outputs aren't 13 | // particularly random. 14 | // 15 | // To generate multidimensional sample values (points in a plane, etc), use two 16 | // HaltonSequenceGenerator_t's, with different (primes) bases. 17 | 18 | #ifndef HALTON_H 19 | #define HALTON_H 20 | 21 | #include 22 | #include 23 | 24 | class HaltonSequenceGenerator_t 25 | { 26 | int seed; 27 | int base; 28 | float fbase; //< base as a float 29 | 30 | public: 31 | HaltonSequenceGenerator_t(int base); //< base MUST be prime, >=2 32 | 33 | float GetElement(int element); 34 | 35 | inline float NextValue(void) 36 | { 37 | return GetElement(seed++); 38 | } 39 | 40 | }; 41 | 42 | 43 | class DirectionalSampler_t //< pseudo-random sphere sampling 44 | { 45 | HaltonSequenceGenerator_t zdot; 46 | HaltonSequenceGenerator_t vrot; 47 | public: 48 | DirectionalSampler_t(void) 49 | : zdot(2),vrot(3) 50 | { 51 | } 52 | 53 | Vector NextValue(void) 54 | { 55 | float zvalue=zdot.NextValue(); 56 | zvalue=2*zvalue-1.0; // map from 0..1 to -1..1 57 | float phi=acos(zvalue); 58 | // now, generate a random rotation angle for x/y 59 | float theta=2.0*M_PI*vrot.NextValue(); 60 | float sin_p=sin(phi); 61 | return Vector(cos(theta)*sin_p, 62 | sin(theta)*sin_p, 63 | zvalue); 64 | 65 | } 66 | }; 67 | 68 | 69 | 70 | 71 | #endif // halton_h 72 | -------------------------------------------------------------------------------- /public/mathlib/math_pfns.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=====================================================================================// 6 | 7 | #ifndef _MATH_PFNS_H_ 8 | #define _MATH_PFNS_H_ 9 | 10 | #if defined( _X360 ) 11 | #include 12 | #endif 13 | 14 | #if !defined( _X360 ) 15 | 16 | // These globals are initialized by mathlib and redirected based on available fpu features 17 | extern float (*pfSqrt)(float x); 18 | extern float (*pfRSqrt)(float x); 19 | extern float (*pfRSqrtFast)(float x); 20 | extern void (*pfFastSinCos)(float x, float *s, float *c); 21 | extern float (*pfFastCos)(float x); 22 | 23 | // The following are not declared as macros because they are often used in limiting situations, 24 | // and sometimes the compiler simply refuses to inline them for some reason 25 | #define FastSqrt(x) (*pfSqrt)(x) 26 | #define FastRSqrt(x) (*pfRSqrt)(x) 27 | #define FastRSqrtFast(x) (*pfRSqrtFast)(x) 28 | #define FastSinCos(x,s,c) (*pfFastSinCos)(x,s,c) 29 | #define FastCos(x) (*pfFastCos)(x) 30 | 31 | #if defined(__i386__) || defined(_M_IX86) 32 | // On x86, the inline FPU or SSE sqrt instruction is faster than 33 | // the overhead of setting up a function call and saving/restoring 34 | // the FPU or SSE register state and can be scheduled better, too. 35 | #undef FastSqrt 36 | #define FastSqrt(x) ::sqrtf(x) 37 | #endif 38 | 39 | #endif // !_X360 40 | 41 | #if defined( _X360 ) 42 | 43 | FORCEINLINE float _VMX_Sqrt( float x ) 44 | { 45 | return __fsqrts( x ); 46 | } 47 | 48 | FORCEINLINE float _VMX_RSqrt( float x ) 49 | { 50 | float rroot = __frsqrte( x ); 51 | 52 | // Single iteration NewtonRaphson on reciprocal square root estimate 53 | return (0.5f * rroot) * (3.0f - (x * rroot) * rroot); 54 | } 55 | 56 | FORCEINLINE float _VMX_RSqrtFast( float x ) 57 | { 58 | return __frsqrte( x ); 59 | } 60 | 61 | FORCEINLINE void _VMX_SinCos( float a, float *pS, float *pC ) 62 | { 63 | XMScalarSinCos( pS, pC, a ); 64 | } 65 | 66 | FORCEINLINE float _VMX_Cos( float a ) 67 | { 68 | return XMScalarCos( a ); 69 | } 70 | 71 | // the 360 has fixed hw and calls directly 72 | #define FastSqrt(x) _VMX_Sqrt(x) 73 | #define FastRSqrt(x) _VMX_RSqrt(x) 74 | #define FastRSqrtFast(x) _VMX_RSqrtFast(x) 75 | #define FastSinCos(x,s,c) _VMX_SinCos(x,s,c) 76 | #define FastCos(x) _VMX_Cos(x) 77 | 78 | #endif // _X360 79 | 80 | #endif // _MATH_PFNS_H_ 81 | -------------------------------------------------------------------------------- /public/mathlib/mathlib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/mathlib/mathlib.h -------------------------------------------------------------------------------- /public/mathlib/noise.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=====================================================================================// 6 | 7 | #ifndef NOISE_H 8 | #define NOISE_H 9 | 10 | #include 11 | #include "basetypes.h" 12 | #include "mathlib/vector.h" 13 | #include "tier0/dbg.h" 14 | 15 | 16 | // The following code is the c-ification of Ken Perlin's new noise algorithm 17 | // "JAVA REFERENCE IMPLEMENTATION OF IMPROVED NOISE - COPYRIGHT 2002 KEN PERLIN" 18 | // as available here: http://mrl.nyu.edu/~perlin/noise/ 19 | // it generates a single octave of noise in the -1..1 range 20 | // this should at some point probably replace SparseConvolutionNoise - jd 21 | float ImprovedPerlinNoise( Vector const &pnt ); 22 | 23 | // get the noise value at a point. Output range is 0..1. 24 | float SparseConvolutionNoise( Vector const &pnt ); 25 | 26 | // get the noise value at a point, passing a custom noise shaping function. The noise shaping 27 | // function should map the domain 0..1 to 0..1. 28 | float SparseConvolutionNoise(Vector const &pnt, float (*pNoiseShapeFunction)(float) ); 29 | 30 | // returns a 1/f noise. more octaves take longer 31 | float FractalNoise( Vector const &pnt, int n_octaves ); 32 | 33 | // returns a abs(f)*1/f noise i.e. turbulence 34 | float Turbulence( Vector const &pnt, int n_octaves ); 35 | #endif // NOISE_H 36 | -------------------------------------------------------------------------------- /public/mathlib/polyhedron.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | // 7 | //=============================================================================// 8 | 9 | #ifndef POLYHEDRON_H_ 10 | #define POLYHEDRON_H_ 11 | 12 | #ifdef _WIN32 13 | #pragma once 14 | #endif 15 | 16 | #include "mathlib/mathlib.h" 17 | 18 | 19 | 20 | struct Polyhedron_IndexedLine_t 21 | { 22 | unsigned short iPointIndices[2]; 23 | }; 24 | 25 | struct Polyhedron_IndexedLineReference_t 26 | { 27 | unsigned short iLineIndex; 28 | unsigned char iEndPointIndex; //since two polygons reference any one line, one needs to traverse the line backwards, this flags that behavior 29 | }; 30 | 31 | struct Polyhedron_IndexedPolygon_t 32 | { 33 | unsigned short iFirstIndex; 34 | unsigned short iIndexCount; 35 | Vector polyNormal; 36 | }; 37 | 38 | class CPolyhedron //made into a class because it's going virtual to support distinctions between temp and permanent versions 39 | { 40 | public: 41 | Vector *pVertices; 42 | Polyhedron_IndexedLine_t *pLines; 43 | Polyhedron_IndexedLineReference_t *pIndices; 44 | Polyhedron_IndexedPolygon_t *pPolygons; 45 | 46 | unsigned short iVertexCount; 47 | unsigned short iLineCount; 48 | unsigned short iIndexCount; 49 | unsigned short iPolygonCount; 50 | 51 | virtual ~CPolyhedron( void ) {}; 52 | virtual void Release( void ) = 0; 53 | Vector Center( void ); 54 | }; 55 | 56 | class CPolyhedron_AllocByNew : public CPolyhedron 57 | { 58 | public: 59 | virtual void Release( void ); 60 | static CPolyhedron_AllocByNew *Allocate( unsigned short iVertices, unsigned short iLines, unsigned short iIndices, unsigned short iPolygons ); //creates the polyhedron along with enough memory to hold all it's data in a single allocation 61 | 62 | private: 63 | CPolyhedron_AllocByNew( void ) { }; //CPolyhedron_AllocByNew::Allocate() is the only way to create one of these. 64 | }; 65 | 66 | CPolyhedron *GeneratePolyhedronFromPlanes( const float *pOutwardFacingPlanes, int iPlaneCount, float fOnPlaneEpsilon, bool bUseTemporaryMemory = false ); //be sure to polyhedron->Release() 67 | CPolyhedron *ClipPolyhedron( const CPolyhedron *pExistingPolyhedron, const float *pOutwardFacingPlanes, int iPlaneCount, float fOnPlaneEpsilon, bool bUseTemporaryMemory = false ); //this does NOT modify/delete the existing polyhedron 68 | 69 | CPolyhedron *GetTempPolyhedron( unsigned short iVertices, unsigned short iLines, unsigned short iIndices, unsigned short iPolygons ); //grab the temporary polyhedron. Avoids new/delete for quick work. Can only be in use by one chunk of code at a time 70 | 71 | 72 | #endif //#ifndef POLYHEDRON_H_ 73 | 74 | -------------------------------------------------------------------------------- /public/mathlib/spherical_geometry.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Functions for spherical geometry. 4 | // 5 | // $NoKeywords: $ 6 | // 7 | //=============================================================================// 8 | 9 | #ifndef SPHERICAL_GEOMETRY_H 10 | #define SPHERICAL_GEOMETRY_H 11 | 12 | #ifdef _WIN32 13 | #pragma once 14 | #endif 15 | 16 | #include 17 | #include 18 | #include "mathlib/dbg.h" 19 | 20 | // see http://mathworld.wolfram.com/SphericalTrigonometry.html 21 | 22 | // return the spherical distance, in radians, between 2 points on the unit sphere. 23 | FORCEINLINE float UnitSphereLineSegmentLength( Vector const &a, Vector const &b ) 24 | { 25 | // check unit length 26 | MathlibAssert( fabs( VectorLength( a ) - 1.0 ) < 1.0e-3 ); 27 | MathlibAssert( fabs( VectorLength( b ) - 1.0 ) < 1.0e-3 ); 28 | return acos( DotProduct( a, b ) ); 29 | } 30 | 31 | 32 | // given 3 points on the unit sphere, return the spherical area (in radians) of the triangle they form. 33 | // valid for "small" triangles. 34 | FORCEINLINE float UnitSphereTriangleArea( Vector const &a, Vector const &b , Vector const &c ) 35 | { 36 | float flLengthA = UnitSphereLineSegmentLength( b, c ); 37 | float flLengthB = UnitSphereLineSegmentLength( c, a ); 38 | float flLengthC = UnitSphereLineSegmentLength( a, b ); 39 | 40 | if ( ( flLengthA == 0. ) || ( flLengthB == 0. ) || ( flLengthC == 0. ) ) 41 | return 0.; // zero area triangle 42 | 43 | // now, find the 3 incribed angles for the triangle 44 | float flHalfSumLens = 0.5 * ( flLengthA + flLengthB + flLengthC ); 45 | float flSinSums = sin( flHalfSumLens ); 46 | float flSinSMinusA= sin( flHalfSumLens - flLengthA ); 47 | float flSinSMinusB= sin( flHalfSumLens - flLengthB ); 48 | float flSinSMinusC= sin( flHalfSumLens - flLengthC ); 49 | 50 | float flTanAOver2 = sqrt ( ( flSinSMinusB * flSinSMinusC ) / ( flSinSums * flSinSMinusA ) ); 51 | float flTanBOver2 = sqrt ( ( flSinSMinusA * flSinSMinusC ) / ( flSinSums * flSinSMinusB ) ); 52 | float flTanCOver2 = sqrt ( ( flSinSMinusA * flSinSMinusB ) / ( flSinSums * flSinSMinusC ) ); 53 | 54 | // Girards formula : area = sum of angles - pi. 55 | return 2.0 * ( atan( flTanAOver2 ) + atan( flTanBOver2 ) + atan( flTanCOver2 ) ) - M_PI; 56 | } 57 | 58 | // spherical harmonics-related functions. Best explanation at http://www.research.scea.com/gdc2003/spherical-harmonic-lighting.pdf 59 | 60 | // Evaluate associated legendre polynomial P( l, m ) at flX, using recurrence relation 61 | float AssociatedLegendrePolynomial( int nL, int nM, float flX ); 62 | 63 | // Evaluate order N spherical harmonic with spherical coordinates 64 | // nL = band, 0..N 65 | // nM = -nL .. nL 66 | // theta = 0..M_PI 67 | // phi = 0.. 2 * M_PHI 68 | float SphericalHarmonic( int nL, int nM, float flTheta, float flPhi ); 69 | 70 | // evaluate spherical harmonic with normalized vector direction 71 | float SphericalHarmonic( int nL, int nM, Vector const &vecDirection ); 72 | 73 | 74 | #endif // SPHERICAL_GEOMETRY_H 75 | -------------------------------------------------------------------------------- /public/steam/isteamapplist.h: -------------------------------------------------------------------------------- 1 | //====== Copyright © 1996-2008, Valve Corporation, All rights reserved. ======= 2 | // 3 | // Purpose: interface to app data in Steam 4 | // 5 | //============================================================================= 6 | 7 | #ifndef ISTEAMAPPLIST_H 8 | #define ISTEAMAPPLIST_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include "isteamclient.h" 14 | #include "steamtypes.h" 15 | 16 | //----------------------------------------------------------------------------- 17 | // Purpose: This is a restricted interface that can only be used by previously approved apps, 18 | // contact your Steam Account Manager if you believe you need access to this API. 19 | // This interface lets you detect installed apps for the local Steam client, useful for debugging tools 20 | // to offer lists of apps to debug via Steam. 21 | //----------------------------------------------------------------------------- 22 | class ISteamAppList 23 | { 24 | public: 25 | virtual uint32 GetNumInstalledApps() = 0; 26 | virtual uint32 GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) = 0; 27 | 28 | virtual int GetAppName( AppId_t nAppID, char *pchName, int cchNameMax ) = 0; // returns -1 if no name was found 29 | virtual int GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax ) = 0; // returns -1 if no dir was found 30 | 31 | virtual int GetAppBuildId( AppId_t nAppID ) = 0; // return the buildid of this app, may change at any time based on backend updates to the game 32 | }; 33 | 34 | #define STEAMAPPLIST_INTERFACE_VERSION "STEAMAPPLIST_INTERFACE_VERSION001" 35 | 36 | // callbacks 37 | #if defined( VALVE_CALLBACK_PACK_SMALL ) 38 | #pragma pack( push, 4 ) 39 | #elif defined( VALVE_CALLBACK_PACK_LARGE ) 40 | #pragma pack( push, 8 ) 41 | #else 42 | #error isteamclient.h must be included 43 | #endif 44 | 45 | 46 | //--------------------------------------------------------------------------------- 47 | // Purpose: Sent when a new app is installed 48 | //--------------------------------------------------------------------------------- 49 | DEFINE_CALLBACK( SteamAppInstalled_t, k_iSteamAppListCallbacks + 1 ); 50 | CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs 51 | END_DEFINE_CALLBACK_1() 52 | 53 | 54 | //--------------------------------------------------------------------------------- 55 | // Purpose: Sent when an app is uninstalled 56 | //--------------------------------------------------------------------------------- 57 | DEFINE_CALLBACK( SteamAppUninstalled_t, k_iSteamAppListCallbacks + 2 ); 58 | CALLBACK_MEMBER( 0, AppId_t, m_nAppID ) // ID of the app that installs 59 | END_DEFINE_CALLBACK_1() 60 | 61 | 62 | #pragma pack( pop ) 63 | #endif // ISTEAMAPPLIST_H 64 | -------------------------------------------------------------------------------- /public/steam/isteammusic.h: -------------------------------------------------------------------------------- 1 | //============ Copyright (c) Valve Corporation, All rights reserved. ============ 2 | 3 | #ifndef ISTEAMMUSIC_H 4 | #define ISTEAMMUSIC_H 5 | #ifdef _WIN32 6 | #pragma once 7 | #endif 8 | 9 | #include "isteamclient.h" 10 | 11 | //----------------------------------------------------------------------------- 12 | // Purpose: 13 | //----------------------------------------------------------------------------- 14 | enum AudioPlayback_Status 15 | { 16 | AudioPlayback_Undefined = 0, 17 | AudioPlayback_Playing = 1, 18 | AudioPlayback_Paused = 2, 19 | AudioPlayback_Idle = 3 20 | }; 21 | 22 | 23 | //----------------------------------------------------------------------------- 24 | // Purpose: Functions to control music playback in the steam client 25 | //----------------------------------------------------------------------------- 26 | class ISteamMusic 27 | { 28 | public: 29 | virtual bool BIsEnabled() = 0; 30 | virtual bool BIsPlaying() = 0; 31 | 32 | virtual AudioPlayback_Status GetPlaybackStatus() = 0; 33 | 34 | virtual void Play() = 0; 35 | virtual void Pause() = 0; 36 | virtual void PlayPrevious() = 0; 37 | virtual void PlayNext() = 0; 38 | 39 | // volume is between 0.0 and 1.0 40 | virtual void SetVolume( float flVolume ) = 0; 41 | virtual float GetVolume() = 0; 42 | 43 | }; 44 | 45 | #define STEAMMUSIC_INTERFACE_VERSION "STEAMMUSIC_INTERFACE_VERSION001" 46 | 47 | // callbacks 48 | #if defined( VALVE_CALLBACK_PACK_SMALL ) 49 | #pragma pack( push, 4 ) 50 | #elif defined( VALVE_CALLBACK_PACK_LARGE ) 51 | #pragma pack( push, 8 ) 52 | #else 53 | #error isteamclient.h must be included 54 | #endif 55 | 56 | 57 | DEFINE_CALLBACK( PlaybackStatusHasChanged_t, k_iSteamMusicCallbacks + 1 ) 58 | END_DEFINE_CALLBACK_0() 59 | 60 | DEFINE_CALLBACK( VolumeHasChanged_t, k_iSteamMusicCallbacks + 2 ) 61 | CALLBACK_MEMBER( 0, float, m_flNewVolume ) 62 | END_DEFINE_CALLBACK_1() 63 | 64 | #pragma pack( pop ) 65 | 66 | 67 | #endif // #define ISTEAMMUSIC_H 68 | -------------------------------------------------------------------------------- /public/steam/isteamunifiedmessages.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Interface to unified messages client 4 | // 5 | // You should not need to use this interface except if your product is using a language other than C++. 6 | // Contact your Steam Tech contact for more details. 7 | // 8 | //============================================================================= 9 | 10 | #ifndef ISTEAMUNIFIEDMESSAGES_H 11 | #define ISTEAMUNIFIEDMESSAGES_H 12 | #ifdef _WIN32 13 | #pragma once 14 | #endif 15 | 16 | typedef uint64 ClientUnifiedMessageHandle; 17 | 18 | class ISteamUnifiedMessages 19 | { 20 | public: 21 | static const ClientUnifiedMessageHandle k_InvalidUnifiedMessageHandle = 0; 22 | 23 | // Sends a service method (in binary serialized form) using the Steam Client. 24 | // Returns a unified message handle (k_InvalidUnifiedMessageHandle if could not send the message). 25 | virtual ClientUnifiedMessageHandle SendMethod( const char *pchServiceMethod, const void *pRequestBuffer, uint32 unRequestBufferSize, uint64 unContext ) = 0; 26 | 27 | // Gets the size of the response and the EResult. Returns false if the response is not ready yet. 28 | virtual bool GetMethodResponseInfo( ClientUnifiedMessageHandle hHandle, uint32 *punResponseSize, EResult *peResult ) = 0; 29 | 30 | // Gets a response in binary serialized form (and optionally release the corresponding allocated memory). 31 | virtual bool GetMethodResponseData( ClientUnifiedMessageHandle hHandle, void *pResponseBuffer, uint32 unResponseBufferSize, bool bAutoRelease ) = 0; 32 | 33 | // Releases the message and its corresponding allocated memory. 34 | virtual bool ReleaseMethod( ClientUnifiedMessageHandle hHandle ) = 0; 35 | 36 | // Sends a service notification (in binary serialized form) using the Steam Client. 37 | // Returns true if the notification was sent successfully. 38 | virtual bool SendNotification( const char *pchServiceNotification, const void *pNotificationBuffer, uint32 unNotificationBufferSize ) = 0; 39 | }; 40 | 41 | #define STEAMUNIFIEDMESSAGES_INTERFACE_VERSION "STEAMUNIFIEDMESSAGES_INTERFACE_VERSION001" 42 | 43 | // callbacks 44 | #if defined( VALVE_CALLBACK_PACK_SMALL ) 45 | #pragma pack( push, 4 ) 46 | #elif defined( VALVE_CALLBACK_PACK_LARGE ) 47 | #pragma pack( push, 8 ) 48 | #else 49 | #error isteamclient.h must be included 50 | #endif 51 | 52 | struct SteamUnifiedMessagesSendMethodResult_t 53 | { 54 | enum { k_iCallback = k_iClientUnifiedMessagesCallbacks + 1 }; 55 | ClientUnifiedMessageHandle m_hHandle; // The handle returned by SendMethod(). 56 | uint64 m_unContext; // Context provided when calling SendMethod(). 57 | EResult m_eResult; // The result of the method call. 58 | uint32 m_unResponseSize; // The size of the response. 59 | }; 60 | 61 | #pragma pack( pop ) 62 | 63 | #endif // ISTEAMUNIFIEDMESSAGES_H 64 | -------------------------------------------------------------------------------- /public/steam/steam_gameserver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/steam/steam_gameserver.h -------------------------------------------------------------------------------- /public/steam/steamhttpenums.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/steam/steamhttpenums.h -------------------------------------------------------------------------------- /public/steam/steamtypes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/steam/steamtypes.h -------------------------------------------------------------------------------- /public/steam/steamuniverse.h: -------------------------------------------------------------------------------- 1 | //========= Copyright � 1996-2008, Valve LLC, All rights reserved. ============ 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | 7 | #ifndef STEAMUNIVERSE_H 8 | #define STEAMUNIVERSE_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | 14 | // Steam universes. Each universe is a self-contained Steam instance. 15 | enum EUniverse 16 | { 17 | k_EUniverseInvalid = 0, 18 | k_EUniversePublic = 1, 19 | k_EUniverseBeta = 2, 20 | k_EUniverseInternal = 3, 21 | k_EUniverseDev = 4, 22 | // k_EUniverseRC = 5, // no such universe anymore 23 | k_EUniverseMax 24 | }; 25 | 26 | 27 | #endif // STEAMUNIVERSE_H 28 | -------------------------------------------------------------------------------- /public/tier0/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_sources( 2 | CMakeLists.txt 3 | #afxmem_override.cpp 4 | basetypes.h 5 | commonmacros.h 6 | dbg.h 7 | dbgflag.h 8 | eventmasks.h 9 | eventmodes.h 10 | fasttimer.h 11 | ia32detect.h 12 | icommandline.h 13 | ioctlcodes.h 14 | k8performancecounters.h 15 | l2cache.h 16 | mem.h 17 | memalloc.h 18 | memdbgoff.h 19 | memdbgon.h 20 | #memoverride-vc7.cpp 21 | memoverride.cpp 22 | minidump.h 23 | p4performancecounters.h 24 | p5p6performancecounters.h 25 | platform.h 26 | pmelib.h 27 | protected_things.h 28 | testthread.h 29 | threadtools.h 30 | tslist.h 31 | validator.h 32 | valobject.h 33 | valve_off.h 34 | valve_on.h 35 | vcrmode.h 36 | vcr_shared.h 37 | vprof.h 38 | wchartypes.h 39 | xbox_codeline_defines.h 40 | ) 41 | -------------------------------------------------------------------------------- /public/tier0/afxmem_override.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/afxmem_override.cpp -------------------------------------------------------------------------------- /public/tier0/basetypes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/basetypes.h -------------------------------------------------------------------------------- /public/tier0/commonmacros.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/commonmacros.h -------------------------------------------------------------------------------- /public/tier0/dbg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/dbg.h -------------------------------------------------------------------------------- /public/tier0/dbgflag.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/dbgflag.h -------------------------------------------------------------------------------- /public/tier0/eventmasks.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/eventmasks.h -------------------------------------------------------------------------------- /public/tier0/eventmodes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/eventmodes.h -------------------------------------------------------------------------------- /public/tier0/fasttimer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/fasttimer.h -------------------------------------------------------------------------------- /public/tier0/ia32detect.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/ia32detect.h -------------------------------------------------------------------------------- /public/tier0/icommandline.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/icommandline.h -------------------------------------------------------------------------------- /public/tier0/ioctlcodes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/ioctlcodes.h -------------------------------------------------------------------------------- /public/tier0/k8performancecounters.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/k8performancecounters.h -------------------------------------------------------------------------------- /public/tier0/l2cache.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/l2cache.h -------------------------------------------------------------------------------- /public/tier0/mem.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/mem.h -------------------------------------------------------------------------------- /public/tier0/memdbgoff.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/memdbgoff.h -------------------------------------------------------------------------------- /public/tier0/memdbgon.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/memdbgon.h -------------------------------------------------------------------------------- /public/tier0/memoverride-vc7.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/memoverride-vc7.cpp -------------------------------------------------------------------------------- /public/tier0/memoverride.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/memoverride.cpp -------------------------------------------------------------------------------- /public/tier0/minidump.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/minidump.h -------------------------------------------------------------------------------- /public/tier0/p4performancecounters.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/p4performancecounters.h -------------------------------------------------------------------------------- /public/tier0/p5p6performancecounters.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/p5p6performancecounters.h -------------------------------------------------------------------------------- /public/tier0/pmelib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/pmelib.h -------------------------------------------------------------------------------- /public/tier0/protected_things.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/protected_things.h -------------------------------------------------------------------------------- /public/tier0/testthread.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/testthread.h -------------------------------------------------------------------------------- /public/tier0/validator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/validator.h -------------------------------------------------------------------------------- /public/tier0/valobject.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/valobject.h -------------------------------------------------------------------------------- /public/tier0/valve_off.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/valve_off.h -------------------------------------------------------------------------------- /public/tier0/valve_on.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/valve_on.h -------------------------------------------------------------------------------- /public/tier0/vcr_shared.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/vcr_shared.h -------------------------------------------------------------------------------- /public/tier0/vcrmode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/vcrmode.h -------------------------------------------------------------------------------- /public/tier0/vprof.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/vprof.h -------------------------------------------------------------------------------- /public/tier0/wchartypes.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: All of our code is completely Unicode. Instead of char, you should 4 | // use wchar, uint8, or char8, as explained below. 5 | // 6 | // $NoKeywords: $ 7 | //=============================================================================// 8 | 9 | 10 | #ifndef WCHARTYPES_H 11 | #define WCHARTYPES_H 12 | #ifdef _WIN32 13 | #pragma once 14 | #endif 15 | 16 | #ifdef _INC_TCHAR 17 | #error ("Must include tier0 type headers before tchar.h") 18 | #endif 19 | 20 | // Temporarily turn off Valve defines 21 | #include "tier0/valve_off.h" 22 | 23 | #if !defined(_WCHAR_T_DEFINED) && !defined(GNUC) 24 | typedef unsigned short wchar_t; 25 | #define _WCHAR_T_DEFINED 26 | #endif 27 | 28 | // char8 29 | // char8 is equivalent to char, and should be used when you really need a char 30 | // (for example, when calling an external function that's declared to take 31 | // chars). 32 | typedef char char8; 33 | 34 | // uint8 35 | // uint8 is equivalent to byte (but is preferred over byte for clarity). Use this 36 | // whenever you mean a byte (for example, one byte of a network packet). 37 | typedef unsigned char uint8; 38 | typedef unsigned char BYTE; 39 | typedef unsigned char byte; 40 | 41 | // wchar 42 | // wchar is a single character of text (currently 16 bits, as all of our text is 43 | // Unicode). Use this whenever you mean a piece of text (for example, in a string). 44 | typedef wchar_t wchar; 45 | //typedef char wchar; 46 | 47 | // __WFILE__ 48 | // This is a Unicode version of __FILE__ 49 | #define WIDEN2(x) L ## x 50 | #define WIDEN(x) WIDEN2(x) 51 | #define __WFILE__ WIDEN(__FILE__) 52 | 53 | #ifdef STEAM 54 | #ifndef _UNICODE 55 | #define FORCED_UNICODE 56 | #endif 57 | #define _UNICODE 58 | #endif 59 | 60 | #ifdef _WIN32 61 | #include 62 | #else 63 | #define _tcsstr strstr 64 | #define _tcsicmp stricmp 65 | #define _tcscmp strcmp 66 | #define _tcscpy strcpy 67 | #define _tcsncpy strncpy 68 | #define _tcsrchr strrchr 69 | #define _tcslen strlen 70 | #define _tfopen fopen 71 | #define _stprintf sprintf 72 | #define _ftprintf fprintf 73 | #define _vsntprintf _vsnprintf 74 | #define _tprintf printf 75 | #define _sntprintf _snprintf 76 | #define _T(s) s 77 | #endif 78 | 79 | #if defined(_UNICODE) 80 | typedef wchar tchar; 81 | #define tstring wstring 82 | #define __TFILE__ __WFILE__ 83 | #define TCHAR_IS_WCHAR 84 | #else 85 | typedef char tchar; 86 | #define tstring string 87 | #define __TFILE__ __FILE__ 88 | #define TCHAR_IS_CHAR 89 | #endif 90 | 91 | #if defined( _MSC_VER ) || defined( WIN32 ) 92 | typedef wchar_t uchar16; 93 | typedef unsigned int uchar32; 94 | #else 95 | typedef unsigned short uchar16; 96 | typedef wchar_t uchar32; 97 | #endif 98 | 99 | #ifdef FORCED_UNICODE 100 | #undef _UNICODE 101 | #endif 102 | 103 | // Turn valve defines back on 104 | #include "tier0/valve_on.h" 105 | 106 | 107 | #endif // WCHARTYPES 108 | 109 | 110 | -------------------------------------------------------------------------------- /public/tier0/xbox_codeline_defines.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier0/xbox_codeline_defines.h -------------------------------------------------------------------------------- /public/tier1/UtlStringMap.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //===========================================================================// 6 | 7 | #ifndef UTLSTRINGMAP_H 8 | #define UTLSTRINGMAP_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include "utlsymbol.h" 14 | 15 | template 16 | class CUtlStringMap 17 | { 18 | public: 19 | CUtlStringMap( bool caseInsensitive = true ) : m_SymbolTable( 0, 32, caseInsensitive ) 20 | { 21 | } 22 | 23 | // Get data by the string itself: 24 | T& operator[]( const char *pString ) 25 | { 26 | CUtlSymbol symbol = m_SymbolTable.AddString( pString ); 27 | int index = ( int )( UtlSymId_t )symbol; 28 | if( m_Vector.Count() <= index ) 29 | { 30 | m_Vector.EnsureCount( index + 1 ); 31 | } 32 | return m_Vector[index]; 33 | } 34 | 35 | // Get data by the string's symbol table ID - only used to retrieve a pre-existing symbol, not create a new one! 36 | T& operator[]( UtlSymId_t n ) 37 | { 38 | Assert( n >=0 && n <= m_Vector.Count() ); 39 | return m_Vector[n]; 40 | } 41 | 42 | const T& operator[]( UtlSymId_t n ) const 43 | { 44 | Assert( n >=0 && n <= m_Vector.Count() ); 45 | return m_Vector[n]; 46 | } 47 | 48 | bool Defined( const char *pString ) const 49 | { 50 | return m_SymbolTable.Find( pString ) != UTL_INVAL_SYMBOL; 51 | } 52 | 53 | UtlSymId_t Find( const char *pString ) const 54 | { 55 | return m_SymbolTable.Find( pString ); 56 | } 57 | 58 | static UtlSymId_t InvalidIndex() 59 | { 60 | return UTL_INVAL_SYMBOL; 61 | } 62 | 63 | int GetNumStrings( void ) const 64 | { 65 | return m_SymbolTable.GetNumStrings(); 66 | } 67 | 68 | const char *String( int n ) const 69 | { 70 | return m_SymbolTable.String( n ); 71 | } 72 | 73 | // Clear all of the data from the map 74 | void Clear() 75 | { 76 | m_Vector.RemoveAll(); 77 | m_SymbolTable.RemoveAll(); 78 | } 79 | 80 | void Purge() 81 | { 82 | m_Vector.Purge(); 83 | m_SymbolTable.RemoveAll(); 84 | } 85 | 86 | void PurgeAndDeleteElements() 87 | { 88 | m_Vector.PurgeAndDeleteElements(); 89 | m_SymbolTable.RemoveAll(); 90 | } 91 | 92 | 93 | 94 | private: 95 | CUtlVector m_Vector; 96 | CUtlSymbolTable m_SymbolTable; 97 | }; 98 | 99 | #endif // UTLSTRINGMAP_H 100 | -------------------------------------------------------------------------------- /public/tier1/characterset.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Shared code for parsing / searching for characters in a string 4 | // using lookup tables 5 | // 6 | // $Workfile: $ 7 | // $Date: $ 8 | // $NoKeywords: $ 9 | //===========================================================================// 10 | 11 | #ifndef CHARACTERSET_H 12 | #define CHARACTERSET_H 13 | 14 | #ifdef _WIN32 15 | #pragma once 16 | #endif 17 | 18 | 19 | struct characterset_t 20 | { 21 | char set[256]; 22 | }; 23 | 24 | 25 | // This is essentially a strpbrk() using a precalculated lookup table 26 | //----------------------------------------------------------------------------- 27 | // Purpose: builds a simple lookup table of a group of important characters 28 | // Input : *pSetBuffer - pointer to the buffer for the group 29 | // *pSetString - list of characters to flag 30 | //----------------------------------------------------------------------------- 31 | extern void CharacterSetBuild( characterset_t *pSetBuffer, const char *pSetString ); 32 | 33 | 34 | //----------------------------------------------------------------------------- 35 | // Purpose: 36 | // Input : *pSetBuffer - pre-build group buffer 37 | // character - character to lookup 38 | // Output : int - 1 if the character was in the set 39 | //----------------------------------------------------------------------------- 40 | #define IN_CHARACTERSET( SetBuffer, character ) ((SetBuffer).set[ (unsigned char) (character) ]) 41 | 42 | 43 | #endif // CHARACTERSET_H 44 | -------------------------------------------------------------------------------- /public/tier1/checksum_crc.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Generic CRC functions 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | #ifndef CHECKSUM_CRC_H 8 | #define CHECKSUM_CRC_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | typedef unsigned int CRC32_t; 14 | 15 | void CRC32_Init( CRC32_t *pulCRC ); 16 | void CRC32_ProcessBuffer( CRC32_t *pulCRC, const void *p, int len ); 17 | void CRC32_Final( CRC32_t *pulCRC ); 18 | CRC32_t CRC32_GetTableEntry( unsigned int slot ); 19 | 20 | inline CRC32_t CRC32_ProcessSingleBuffer( const void *p, int len ) 21 | { 22 | CRC32_t crc; 23 | 24 | CRC32_Init( &crc ); 25 | CRC32_ProcessBuffer( &crc, p, len ); 26 | CRC32_Final( &crc ); 27 | 28 | return crc; 29 | } 30 | 31 | #endif // CHECKSUM_CRC_H 32 | -------------------------------------------------------------------------------- /public/tier1/checksum_md5.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Generic MD5 hashing algo 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef CHECKSUM_MD5_H 8 | #define CHECKSUM_MD5_H 9 | 10 | #ifdef _WIN32 11 | #pragma once 12 | #endif 13 | 14 | // 16 bytes == 128 bit digest 15 | #define MD5_DIGEST_LENGTH 16 16 | #define MD5_BIT_LENGTH ( MD5_DIGEST_LENGTH * sizeof(unsigned char) ) 17 | struct MD5Value_t 18 | { 19 | unsigned char bits[MD5_DIGEST_LENGTH]; 20 | 21 | void Zero(); 22 | bool IsZero() const; 23 | 24 | bool operator==( const MD5Value_t &src ) const; 25 | bool operator!=( const MD5Value_t &src ) const; 26 | 27 | }; 28 | 29 | // MD5 Hash 30 | typedef struct 31 | { 32 | unsigned int buf[4]; 33 | unsigned int bits[2]; 34 | unsigned char in[64]; 35 | } MD5Context_t; 36 | 37 | void MD5Init( MD5Context_t *context ); 38 | void MD5Update( MD5Context_t *context, unsigned char const *buf, unsigned int len ); 39 | void MD5Final( unsigned char digest[ MD5_DIGEST_LENGTH ], MD5Context_t *context ); 40 | 41 | char *MD5_Print(unsigned char *digest, int hashlen ); 42 | 43 | /// Convenience wrapper to calculate the MD5 for a buffer, all in one step, without 44 | /// bothering with the context object. 45 | void MD5_ProcessSingleBuffer( const void *p, int len, MD5Value_t &md5Result ); 46 | 47 | unsigned int MD5_PseudoRandom(unsigned int nSeed); 48 | 49 | /// Returns true if the values match. 50 | bool MD5_Compare( const MD5Value_t &data, const MD5Value_t &compare ); 51 | 52 | inline bool MD5Value_t::operator==( const MD5Value_t &src ) const 53 | { 54 | return MD5_Compare( *this, src ); 55 | } 56 | 57 | inline bool MD5Value_t::operator!=( const MD5Value_t &src ) const 58 | { 59 | return !MD5_Compare( *this, src ); 60 | } 61 | 62 | #endif // CHECKSUM_MD5_H 63 | -------------------------------------------------------------------------------- /public/tier1/diff.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | // 7 | // Serialization/unserialization buffer 8 | //=============================================================================// 9 | 10 | #ifndef DIFF_H 11 | #define DIFF_H 12 | #pragma once 13 | 14 | int FindDiffs(uint8 const *NewBlock, uint8 const *OldBlock, 15 | int NewSize, int OldSize, int &DiffListSize,uint8 *Output,uint32 OutSize); 16 | 17 | int FindDiffsForLargeFiles(uint8 const *NewBlock, uint8 const *OldBlock, 18 | int NewSize, int OldSize, int &DiffListSize,uint8 *Output, 19 | uint32 OutSize, 20 | int hashsize=65536); 21 | 22 | void ApplyDiffs(uint8 const *OldBlock, uint8 const *DiffList, 23 | int OldSize, int DiffListSize, int &ResultListSize,uint8 *Output,uint32 OutSize); 24 | 25 | int FindDiffsLowMemory(uint8 const *NewBlock, uint8 const *OldBlock, 26 | int NewSize, int OldSize, int &DiffListSize,uint8 *Output,uint32 OutSize); 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /public/tier1/fileio.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: A collection of utility classes to simplify file I/O, and 4 | // as much as possible contain portability problems. Here avoiding 5 | // including windows.h. 6 | // 7 | //============================================================================= 8 | 9 | #ifndef FILEIO_H 10 | #define FILEIO_H 11 | 12 | #if defined (_WIN32) 13 | #else 14 | #include 15 | #include 16 | #if !defined( _PS3 ) 17 | #include 18 | #endif // _PS3 19 | #endif 20 | 21 | #include "tier0/platform.h" 22 | #include "tier1/utlstring.h" 23 | #include "tier1/utllinkedlist.h" 24 | 25 | const int64 k_nMillion = 1000000; 26 | const int64 k_nThousand = 1000; 27 | const int64 k_nKiloByte = 1024; 28 | const int64 k_nMegabyte = k_nKiloByte * k_nKiloByte; 29 | const int64 k_nGigabyte = k_nMegabyte * k_nKiloByte; 30 | 31 | class CPathString 32 | { 33 | public: 34 | 35 | // Constructors: Automatically fixes slashes and removes double slashes when the object is 36 | // constructed, and then knows how to append magic \\?\ on Windows for unicode paths 37 | CPathString( const char *pchUTF8Path ); 38 | ~CPathString(); 39 | 40 | // Gets the path in UTF8 41 | const char *GetUTF8Path(); 42 | 43 | // Gets wchar_t based path, with \\?\ pre-pended (allowing long paths on Win32, should only be used with unicode aware filesystem calls) 44 | const wchar_t *GetWCharPathPrePended(); 45 | 46 | private: 47 | 48 | void PopulateWCharPath(); 49 | 50 | char *m_pchUTF8Path; 51 | wchar_t *m_pwchWideCharPathPrepended; 52 | 53 | }; 54 | 55 | #if !defined(_PS3) 56 | //----------------------------------------------------------------------------- 57 | // Purpose: Encapsulates watching a directory for file changes 58 | //----------------------------------------------------------------------------- 59 | class CDirWatcher 60 | { 61 | public: 62 | CDirWatcher(); 63 | ~CDirWatcher(); 64 | 65 | // only one directory can be watched at a time 66 | void SetDirToWatch( const char *pchDir ); 67 | 68 | // retrieve any changes 69 | bool GetChangedFile( CUtlString *psFile ); 70 | 71 | #ifdef DBGFLAG_VALIDATE 72 | void Validate( CValidator &validator, const char *pchName ); 73 | #endif 74 | 75 | private: 76 | CUtlLinkedList m_listChangedFiles; 77 | void *m_hFile; 78 | void *m_pOverlapped; 79 | void *m_pFileInfo; 80 | #ifdef OSX 81 | public: 82 | struct timespec m_modTime; 83 | void AddFileToChangeList( const char *pchFile ); 84 | CUtlString m_BaseDir; 85 | private: 86 | void *m_WatcherStream; 87 | #endif 88 | friend class CDirWatcherFriend; 89 | 90 | #ifdef LINUX 91 | void AddFileToChangeList( const char *pchFile ); 92 | #endif 93 | #ifdef WIN32 94 | // used by callback functions to push a file onto the list 95 | void AddFileToChangeList( const char *pchFile ); 96 | void PostDirWatch(); 97 | #endif 98 | }; 99 | #endif // _PS3 100 | 101 | #endif // FILEIO_H 102 | -------------------------------------------------------------------------------- /public/tier1/kvpacker.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef KVPACKER_H 9 | #define KVPACKER_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include "KeyValues.h" 16 | 17 | //----------------------------------------------------------------------------- 18 | // Purpose: Handles packing KeyValues binary packing and unpacking in a a 19 | // consistent way across all branches, including Steam. If you change 20 | // this packing format you need to do so in a backward compatible way 21 | // so that the Steam servers and all the various GCs can still talk to 22 | // each other. 23 | //----------------------------------------------------------------------------- 24 | class KVPacker 25 | { 26 | public: 27 | bool WriteAsBinary( KeyValues *pNode, CUtlBuffer &buffer ); 28 | bool ReadAsBinary( KeyValues *pNode, CUtlBuffer &buffer ); 29 | 30 | private: 31 | // These types are used for serialization of KeyValues nodes. 32 | // Do not renumber them or you will break serialization across 33 | // branches. 34 | enum EPackType 35 | { 36 | PACKTYPE_NONE = 0, 37 | PACKTYPE_STRING, 38 | PACKTYPE_INT, 39 | PACKTYPE_FLOAT, 40 | PACKTYPE_PTR, 41 | PACKTYPE_WSTRING, 42 | PACKTYPE_COLOR, 43 | PACKTYPE_UINT64, 44 | PACKTYPE_NULLMARKER, // used to mark the end of a block in the binary format 45 | }; 46 | }; 47 | 48 | 49 | #endif // KVPACKER_H 50 | -------------------------------------------------------------------------------- /public/tier1/lzss.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // LZSS Codec. Designed for fast cheap gametime encoding/decoding. Compression results 4 | // are not aggresive as other alogrithms, but gets 2:1 on most arbitrary uncompressed data. 5 | // 6 | //=====================================================================================// 7 | 8 | #ifndef _LZSS_H 9 | #define _LZSS_H 10 | #pragma once 11 | 12 | #define LZSS_ID uint32( BigLong( ('L'<<24)|('Z'<<16)|('S'<<8)|('S') ) ) 13 | #define SNAPPY_ID uint32( BigLong( ('S'<<24)|('N'<<16)|('A'<<8)|('P') ) ) 14 | 15 | // bind the buffer for correct identification 16 | struct lzss_header_t 17 | { 18 | unsigned int id; 19 | unsigned int actualSize; // always little endian 20 | }; 21 | 22 | class CUtlBuffer; 23 | 24 | #define DEFAULT_LZSS_WINDOW_SIZE 4096 25 | 26 | class CLZSS 27 | { 28 | public: 29 | unsigned char* Compress( const unsigned char *pInput, int inputlen, unsigned int *pOutputSize ); 30 | unsigned char* CompressNoAlloc( const unsigned char *pInput, int inputlen, unsigned char *pOutput, unsigned int *pOutputSize ); 31 | unsigned int Uncompress( const unsigned char *pInput, unsigned char *pOutput ); 32 | //unsigned int Uncompress( unsigned char *pInput, CUtlBuffer &buf ); 33 | unsigned int SafeUncompress( const unsigned char *pInput, unsigned char *pOutput, unsigned int unBufSize ); 34 | 35 | static bool IsCompressed( const unsigned char *pInput ); 36 | static unsigned int GetActualSize( const unsigned char *pInput ); 37 | 38 | // windowsize must be a power of two. 39 | FORCEINLINE CLZSS( int nWindowSize = DEFAULT_LZSS_WINDOW_SIZE ); 40 | 41 | private: 42 | // expected to be sixteen bytes 43 | struct lzss_node_t 44 | { 45 | const unsigned char *pData; 46 | lzss_node_t *pPrev; 47 | lzss_node_t *pNext; 48 | char empty[4]; 49 | }; 50 | 51 | struct lzss_list_t 52 | { 53 | lzss_node_t *pStart; 54 | lzss_node_t *pEnd; 55 | }; 56 | 57 | void BuildHash( const unsigned char *pData ); 58 | lzss_list_t *m_pHashTable; 59 | lzss_node_t *m_pHashTarget; 60 | int m_nWindowSize; 61 | 62 | }; 63 | 64 | FORCEINLINE CLZSS::CLZSS( int nWindowSize ) 65 | { 66 | m_nWindowSize = nWindowSize; 67 | } 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /public/tier1/netadr.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | // 7 | //=============================================================================// 8 | // netadr.h 9 | #ifndef NETADR_H 10 | #define NETADR_H 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include "tier0/platform.h" 16 | #undef SetPort 17 | 18 | typedef enum 19 | { 20 | NA_NULL = 0, 21 | NA_LOOPBACK, 22 | NA_BROADCAST, 23 | NA_IP, 24 | } netadrtype_t; 25 | 26 | typedef struct netadr_s 27 | { 28 | public: 29 | netadr_s() { SetIP( 0 ); SetPort( 0 ); SetType( NA_IP ); } 30 | netadr_s( uint unIP, uint16 usPort ) { SetIP( unIP ); SetPort( usPort ); SetType( NA_IP ); } 31 | netadr_s( const char *pch ) { SetFromString( pch ); } 32 | void Clear(); // invalids Address 33 | 34 | void SetType( netadrtype_t type ); 35 | void SetPort( unsigned short port ); 36 | bool SetFromSockadr(const struct sockaddr *s); 37 | void SetIP(uint8 b1, uint8 b2, uint8 b3, uint8 b4); 38 | void SetIP(uint unIP); // Sets IP. unIP is in host order (little-endian) 39 | void SetIPAndPort( uint unIP, unsigned short usPort ) { SetIP( unIP ); SetPort( usPort ); } 40 | void SetFromString(const char *pch, bool bUseDNS = false ); // if bUseDNS is true then do a DNS lookup if needed 41 | 42 | bool CompareAdr (const netadr_s &a, bool onlyBase = false) const; 43 | bool CompareClassBAdr (const netadr_s &a) const; 44 | bool CompareClassCAdr (const netadr_s &a) const; 45 | 46 | netadrtype_t GetType() const; 47 | unsigned short GetPort() const; 48 | const char* ToString( bool onlyBase = false ) const; // returns xxx.xxx.xxx.xxx:ppppp 49 | void ToSockadr(struct sockaddr *s) const; 50 | unsigned int GetIPHostByteOrder() const; 51 | unsigned int GetIPNetworkByteOrder() const; 52 | 53 | bool IsLocalhost() const; // true, if this is the localhost IP 54 | bool IsLoopback() const; // true if engine loopback buffers are used 55 | bool IsReservedAdr() const; // true, if this is a private LAN IP 56 | bool IsValid() const; // ip & port != 0 57 | void SetFromSocket( int hSocket ); 58 | bool operator==(const netadr_s &netadr) const {return ( CompareAdr( netadr ) );} 59 | bool operator<(const netadr_s &netadr) const; 60 | 61 | public: // members are public to avoid to much changes 62 | 63 | netadrtype_t type; 64 | unsigned char ip[4]; 65 | unsigned short port; 66 | } netadr_t; 67 | 68 | #endif // NETADR_H 69 | -------------------------------------------------------------------------------- /public/tier1/processor_detect.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: functions to expose CPU capabilities 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | bool CheckMMXTechnology(void); 9 | bool CheckSSETechnology(void); 10 | bool CheckSSE2Technology(void); 11 | bool Check3DNowTechnology(void); 12 | 13 | -------------------------------------------------------------------------------- /public/tier1/rangecheckedvar.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef RANGECHECKEDVAR_H 8 | #define RANGECHECKEDVAR_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | 14 | #include "tier0/dbg.h" 15 | #include "tier0/threadtools.h" 16 | #include "mathlib/vector.h" 17 | #include 18 | 19 | 20 | // Use this to disable range checks within a scope. 21 | class CDisableRangeChecks 22 | { 23 | public: 24 | CDisableRangeChecks(); 25 | ~CDisableRangeChecks(); 26 | }; 27 | 28 | 29 | template< class T > 30 | inline void RangeCheck( const T &value, int minValue, int maxValue ) 31 | { 32 | #ifdef _DEBUG 33 | extern bool g_bDoRangeChecks; 34 | if ( ThreadInMainThread() && g_bDoRangeChecks ) 35 | { 36 | // Ignore the min/max stuff for now.. just make sure it's not a NAN. 37 | Assert( _finite( value ) ); 38 | } 39 | #endif 40 | } 41 | 42 | inline void RangeCheck( const Vector &value, int minValue, int maxValue ) 43 | { 44 | #ifdef _DEBUG 45 | RangeCheck( value.x, minValue, maxValue ); 46 | RangeCheck( value.y, minValue, maxValue ); 47 | RangeCheck( value.z, minValue, maxValue ); 48 | #endif 49 | } 50 | 51 | 52 | template< class T, int minValue, int maxValue, int startValue > 53 | class CRangeCheckedVar 54 | { 55 | public: 56 | 57 | inline CRangeCheckedVar() 58 | { 59 | m_Val = startValue; 60 | } 61 | 62 | inline CRangeCheckedVar( const T &value ) 63 | { 64 | *this = value; 65 | } 66 | 67 | T GetRaw() const 68 | { 69 | return m_Val; 70 | } 71 | 72 | // Clamp the value to its limits. Interpolation code uses this after interpolating. 73 | inline void Clamp() 74 | { 75 | if ( m_Val < minValue ) 76 | m_Val = minValue; 77 | else if ( m_Val > maxValue ) 78 | m_Val = maxValue; 79 | } 80 | 81 | inline operator const T&() const 82 | { 83 | return m_Val; 84 | } 85 | 86 | inline CRangeCheckedVar& operator=( const T &value ) 87 | { 88 | RangeCheck( value, minValue, maxValue ); 89 | m_Val = value; 90 | return *this; 91 | } 92 | 93 | inline CRangeCheckedVar& operator+=( const T &value ) 94 | { 95 | return (*this = m_Val + value); 96 | } 97 | 98 | inline CRangeCheckedVar& operator-=( const T &value ) 99 | { 100 | return (*this = m_Val - value); 101 | } 102 | 103 | inline CRangeCheckedVar& operator*=( const T &value ) 104 | { 105 | return (*this = m_Val * value); 106 | } 107 | 108 | inline CRangeCheckedVar& operator/=( const T &value ) 109 | { 110 | return (*this = m_Val / value); 111 | } 112 | 113 | private: 114 | 115 | T m_Val; 116 | }; 117 | 118 | #endif // RANGECHECKEDVAR_H 119 | -------------------------------------------------------------------------------- /public/tier1/stringpool.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef STRINGPOOL_H 9 | #define STRINGPOOL_H 10 | 11 | #if defined( _WIN32 ) 12 | #pragma once 13 | #endif 14 | 15 | #include "utlrbtree.h" 16 | #include "utlvector.h" 17 | 18 | //----------------------------------------------------------------------------- 19 | // Purpose: Allocates memory for strings, checking for duplicates first, 20 | // reusing exising strings if duplicate found. 21 | //----------------------------------------------------------------------------- 22 | 23 | class CStringPool 24 | { 25 | public: 26 | CStringPool(); 27 | ~CStringPool(); 28 | 29 | unsigned int Count() const; 30 | 31 | const char * Allocate( const char *pszValue ); 32 | void FreeAll(); 33 | 34 | // searches for a string already in the pool 35 | const char * Find( const char *pszValue ); 36 | 37 | protected: 38 | typedef CUtlRBTree CStrSet; 39 | 40 | CStrSet m_Strings; 41 | }; 42 | 43 | //----------------------------------------------------------------------------- 44 | // Purpose: A reference counted string pool. 45 | // 46 | // Elements are stored more efficiently than in the conventional string pool, 47 | // quicker to look up, and storage is tracked via reference counts. 48 | // 49 | // At some point this should replace CStringPool 50 | //----------------------------------------------------------------------------- 51 | class CCountedStringPool 52 | { 53 | public: // HACK, hash_item_t structure should not be public. 54 | 55 | struct hash_item_t 56 | { 57 | char* pString; 58 | unsigned short nNextElement; 59 | unsigned char nReferenceCount; 60 | unsigned char pad; 61 | }; 62 | 63 | enum 64 | { 65 | INVALID_ELEMENT = 0, 66 | MAX_REFERENCE = 0xFF, 67 | HASH_TABLE_SIZE = 1024 68 | }; 69 | 70 | CUtlVector m_HashTable; // Points to each element 71 | CUtlVector m_Elements; 72 | unsigned short m_FreeListStart; 73 | 74 | public: 75 | CCountedStringPool(); 76 | virtual ~CCountedStringPool(); 77 | 78 | void FreeAll(); 79 | 80 | char *FindString( const char* pIntrinsic ); 81 | char *ReferenceString( const char* pIntrinsic ); 82 | void DereferenceString( const char* pIntrinsic ); 83 | 84 | // These are only reliable if there are less than 64k strings in your string pool 85 | unsigned short FindStringHandle( const char* pIntrinsic ); 86 | unsigned short ReferenceStringHandle( const char* pIntrinsic ); 87 | char *HandleToString( unsigned short handle ); 88 | void SpewStrings(); 89 | }; 90 | 91 | #endif // STRINGPOOL_H 92 | -------------------------------------------------------------------------------- /public/tier1/tier1.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: A higher level link library for general use in the game and tools. 4 | // 5 | //===========================================================================// 6 | 7 | 8 | #ifndef TIER1_H 9 | #define TIER1_H 10 | 11 | #include "interface.h" 12 | 13 | //----------------------------------------------------------------------------- 14 | // Call this to connect to/disconnect from all tier 1 libraries. 15 | // It's up to the caller to check the globals it cares about to see if ones are missing 16 | //----------------------------------------------------------------------------- 17 | void ConnectTier1Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount ); 18 | void DisconnectTier1Libraries(); 19 | 20 | #endif // TIER1_H 21 | -------------------------------------------------------------------------------- /public/tier1/tokenreader.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef TOKENREADER_H 9 | #define TOKENREADER_H 10 | #ifdef _WIN32 11 | #pragma once 12 | #endif 13 | 14 | #include "tier0/basetypes.h" 15 | 16 | #ifdef _WIN32 17 | #pragma warning(push, 1) 18 | #pragma warning(disable:4701 4702 4530) 19 | #endif 20 | 21 | #undef min 22 | #undef max 23 | #include 24 | #include 25 | 26 | #ifdef _WIN32 27 | #pragma warning(pop) 28 | #endif 29 | 30 | #include 31 | 32 | 33 | typedef enum 34 | { 35 | TOKENSTRINGTOOLONG = -4, 36 | TOKENERROR = -3, 37 | TOKENNONE = -2, 38 | TOKENEOF = -1, 39 | OPERATOR, 40 | INTEGER, 41 | STRING, 42 | IDENT 43 | } trtoken_t; 44 | 45 | 46 | #define IsToken(s1, s2) !strcmpi(s1, s2) 47 | 48 | #define MAX_TOKEN 128 + 1 49 | #define MAX_IDENT 64 + 1 50 | #define MAX_STRING 128 + 1 51 | 52 | 53 | class TokenReader : private std::ifstream 54 | { 55 | public: 56 | 57 | TokenReader(); 58 | 59 | bool Open(const char *pszFilename); 60 | trtoken_t NextToken(char *pszStore, int nSize); 61 | trtoken_t NextTokenDynamic(char **ppszStore); 62 | void Close(); 63 | 64 | void IgnoreTill(trtoken_t ttype, const char *pszToken); 65 | void Stuff(trtoken_t ttype, const char *pszToken); 66 | bool Expecting(trtoken_t ttype, const char *pszToken); 67 | const char *Error(char *error, ...); 68 | trtoken_t PeekTokenType(char* = NULL, int maxlen = 0); 69 | 70 | inline int GetErrorCount(void); 71 | 72 | private: 73 | // compiler can't generate an assignment operator since descended from std::ifstream 74 | inline TokenReader(TokenReader const &); 75 | inline int operator=(TokenReader const &); 76 | 77 | trtoken_t GetString(char *pszStore, int nSize); 78 | bool SkipWhiteSpace(void); 79 | 80 | int m_nLine; 81 | int m_nErrorCount; 82 | 83 | char m_szFilename[128]; 84 | char m_szStuffed[128]; 85 | bool m_bStuffed; 86 | trtoken_t m_eStuffed; 87 | }; 88 | 89 | 90 | //----------------------------------------------------------------------------- 91 | // Purpose: Returns the total number of parsing errors since this file was opened. 92 | //----------------------------------------------------------------------------- 93 | int TokenReader::GetErrorCount(void) 94 | { 95 | return(m_nErrorCount); 96 | } 97 | 98 | 99 | #endif // TOKENREADER_H 100 | -------------------------------------------------------------------------------- /public/tier1/uniqueid.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | // 7 | // Utilities for globally unique IDs 8 | //=============================================================================// 9 | 10 | #ifndef UNIQUEID_H 11 | #define UNIQUEID_H 12 | 13 | #ifdef _WIN32 14 | #pragma once 15 | #endif 16 | 17 | #include "tier1/utlvector.h" 18 | 19 | 20 | //----------------------------------------------------------------------------- 21 | // Forward declarations 22 | //----------------------------------------------------------------------------- 23 | struct UniqueId_t; 24 | class CUtlBuffer; 25 | 26 | 27 | //----------------------------------------------------------------------------- 28 | // Defines a globally unique ID 29 | //----------------------------------------------------------------------------- 30 | struct UniqueId_t 31 | { 32 | unsigned char m_Value[16]; 33 | }; 34 | 35 | 36 | //----------------------------------------------------------------------------- 37 | // Methods related to unique ids 38 | //----------------------------------------------------------------------------- 39 | void CreateUniqueId( UniqueId_t *pDest ); 40 | void InvalidateUniqueId( UniqueId_t *pDest ); 41 | bool IsUniqueIdValid( const UniqueId_t &id ); 42 | bool IsUniqueIdEqual( const UniqueId_t &id1, const UniqueId_t &id2 ); 43 | void UniqueIdToString( const UniqueId_t &id, char *pBuf, int nMaxLen ); 44 | bool UniqueIdFromString( UniqueId_t *pDest, const char *pBuf, int nMaxLen = 0 ); 45 | void CopyUniqueId( const UniqueId_t &src, UniqueId_t *pDest ); 46 | bool Serialize( CUtlBuffer &buf, const UniqueId_t &src ); 47 | bool Unserialize( CUtlBuffer &buf, UniqueId_t &dest ); 48 | 49 | inline bool operator ==( const UniqueId_t& lhs, const UniqueId_t& rhs ) 50 | { 51 | return !Q_memcmp( (void *)&lhs.m_Value[ 0 ], (void *)&rhs.m_Value[ 0 ], sizeof( lhs.m_Value ) ); 52 | } 53 | 54 | 55 | #endif // UNIQUEID_H 56 | 57 | -------------------------------------------------------------------------------- /public/tier1/utlallocation.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // The CUtlAllocation class: 5 | // A single allocation in the style of CUtlMemory/CUtlString/CUtlBuffer 6 | // as compact as possible, no virtuals or extraneous data 7 | // to be used primarily to replace CUtlBuffer 8 | //============================================================================= 9 | 10 | #ifndef UTLALLOCATION_H 11 | #define UTLALLOCATION_H 12 | #ifdef _WIN32 13 | #pragma once 14 | #endif 15 | 16 | #include "tier1/utlmemory.h" 17 | 18 | class CUtlAllocation 19 | { 20 | public: 21 | 22 | // constructor, destructor 23 | CUtlAllocation() 24 | { 25 | m_pMemory = NULL; 26 | } 27 | 28 | CUtlAllocation( const void *pMemory, int cub ) 29 | { 30 | m_pMemory = NULL; 31 | Copy( pMemory, cub ); 32 | } 33 | 34 | CUtlAllocation( CUtlAllocation const &src ) 35 | { 36 | m_pMemory = NULL; 37 | Copy( src ); 38 | } 39 | 40 | ~CUtlAllocation() 41 | { 42 | Purge(); 43 | } 44 | 45 | CUtlAllocation &operator=( CUtlAllocation const &src ) 46 | { 47 | Copy( src ); 48 | return *this; 49 | } 50 | 51 | bool operator==( CUtlAllocation const &src ) 52 | { 53 | if ( Count() != src.Count() ) 54 | return false; 55 | return Q_memcmp( Base(), src.Base(), Count() ) == 0; 56 | } 57 | 58 | void Copy( const void *pMemory, int cub ) 59 | { 60 | if ( cub == 0 || pMemory == NULL ) 61 | { 62 | Purge(); 63 | return; 64 | } 65 | if ( cub != Count() ) 66 | { 67 | Purge(); 68 | m_pMemory = (ActualMemory_t *)malloc( cub + sizeof( int ) ); 69 | m_pMemory->cub = cub; 70 | } 71 | Q_memcpy( Base(), pMemory, cub ); 72 | } 73 | 74 | // Gets the base address 75 | uint8* Base() 76 | { 77 | if ( m_pMemory == NULL ) 78 | return NULL; 79 | return m_pMemory->rgub; 80 | } 81 | 82 | const uint8* Base() const 83 | { 84 | if ( m_pMemory == NULL ) 85 | return NULL; 86 | return m_pMemory->rgub; 87 | } 88 | 89 | // Size 90 | int Count() const 91 | { 92 | if ( m_pMemory == NULL ) 93 | return 0; 94 | return m_pMemory->cub; 95 | } 96 | 97 | // Memory deallocation 98 | void Purge() 99 | { 100 | if ( m_pMemory ) 101 | free(m_pMemory); 102 | m_pMemory = NULL; 103 | } 104 | 105 | void Copy( const CUtlAllocation &alloc ) 106 | { 107 | Copy( alloc.Base(), alloc.Count() ); 108 | } 109 | 110 | void Swap( CUtlAllocation &alloc ) 111 | { 112 | ActualMemory_t *pTemp = m_pMemory; 113 | m_pMemory = alloc.m_pMemory; 114 | alloc.m_pMemory = pTemp; 115 | } 116 | 117 | void Alloc( int cub ) 118 | { 119 | Purge(); 120 | m_pMemory = (ActualMemory_t *)malloc( cub + sizeof( int ) ); 121 | m_pMemory->cub = cub; 122 | } 123 | 124 | private: 125 | struct ActualMemory_t 126 | { 127 | int cub; 128 | uint8 rgub[4]; // i'd prefer to make this 0 but the compiler whines when i do 129 | }; 130 | 131 | ActualMemory_t *m_pMemory; 132 | }; 133 | 134 | #endif // UTLALLOCATION_H 135 | -------------------------------------------------------------------------------- /public/tier1/utlbinaryblock.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/tier1/utlbinaryblock.h -------------------------------------------------------------------------------- /public/tier1/utlmovingaverage.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Simple moving average class 4 | // 5 | // $NoKeywords: $ 6 | // 7 | // 8 | //=============================================================================// 9 | #ifndef MOVING_AVERAGE_H 10 | #define MOVING_AVERAGE_H 11 | 12 | #ifdef _WIN32 13 | #pragma once 14 | #endif 15 | 16 | #include "tier0/platform.h" 17 | #include "tier0/basetypes.h" 18 | 19 | template class CUtlMovingAverage 20 | { 21 | public: 22 | CUtlMovingAverage() : 23 | m_nValuesPushed( 0 ), 24 | m_flTotal( 0.0f ) 25 | { 26 | } 27 | 28 | void Reset() 29 | { 30 | m_nValuesPushed = 0; 31 | m_flTotal = 0.0f; 32 | } 33 | 34 | uint32 GetTotalValuesPushed() const 35 | { 36 | return m_nValuesPushed; 37 | } 38 | 39 | float GetAverage( ) 40 | { 41 | uint n = MIN( TBufferSize, m_nValuesPushed ); 42 | return n ? ( m_flTotal / static_cast( n ) ) : 0.0f; 43 | } 44 | 45 | void GetAverageAndAbsRange( float *pflOutAverage, float *pflOutAbsRange, float *pflMinTime, float *pflMaxTime ) 46 | { 47 | if ( m_nValuesPushed == 0 ) 48 | { 49 | *pflOutAverage = 0; 50 | *pflOutAbsRange = 0; 51 | *pflMinTime = 0; 52 | *pflMaxTime = 0; 53 | return; 54 | } 55 | 56 | *pflOutAverage = GetAverage(); 57 | 58 | const int nNumValues = MIN( m_nValuesPushed, TBufferSize ); 59 | 60 | float flAbsRange = 0; 61 | float flMinTime = 9e+9; 62 | float flMaxTime = 0; 63 | 64 | for ( int i = 0; i < nNumValues; ++i ) 65 | { 66 | float flDif = ( m_Buffer[i] - *pflOutAverage ); 67 | flAbsRange = MAX( flAbsRange, abs( flDif ) ); 68 | flMinTime = MIN( flMinTime, m_Buffer[i] ); 69 | flMaxTime = MAX( flMaxTime, m_Buffer[i] ); 70 | } 71 | 72 | *pflOutAbsRange = flAbsRange; 73 | *pflMinTime = flMinTime; 74 | *pflMaxTime = flMaxTime; 75 | } 76 | 77 | void PushValue( float v ) 78 | { 79 | uint nIndex = m_nValuesPushed % TBufferSize; 80 | 81 | if ( m_nValuesPushed >= TBufferSize ) 82 | { 83 | m_flTotal = MAX( m_flTotal - m_Buffer[nIndex], 0.0f ); 84 | } 85 | m_flTotal += v; 86 | 87 | m_Buffer[nIndex] = v; 88 | m_nValuesPushed++; 89 | 90 | if ( UINT_MAX == m_nValuesPushed ) 91 | { 92 | Reset(); 93 | } 94 | } 95 | 96 | private: 97 | float m_Buffer[TBufferSize]; 98 | uint32 m_nValuesPushed; 99 | 100 | double m_flTotal; 101 | }; 102 | 103 | #endif // MOVING_AVERAGE_H 104 | -------------------------------------------------------------------------------- /public/tier1/utlpair.h: -------------------------------------------------------------------------------- 1 | //========= Copyright, Valve Corporation, All rights reserved. ================// 2 | // 3 | // std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef UTLPAIR_H 8 | #define UTLPAIR_H 9 | 10 | #ifdef _WIN32 11 | #pragma once 12 | #endif 13 | 14 | 15 | // std::pair style container; exists to work easily in our CUtlMap/CUtlHashMap classes 16 | template 17 | class CUtlPair 18 | { 19 | public: 20 | CUtlPair() {} 21 | CUtlPair( T1 t1, T2 t2 ) : first( t1 ), second( t2 ) {} 22 | 23 | bool operator<( const CUtlPair &rhs ) const { 24 | if ( first != rhs.first ) 25 | return first < rhs.first; 26 | return second < rhs.second; 27 | } 28 | 29 | bool operator==( const CUtlPair &rhs ) const { 30 | return first == rhs.first && second == rhs.second; 31 | } 32 | 33 | T1 first; 34 | T2 second; 35 | }; 36 | 37 | // utility to make a CUtlPair without having to specify template parameters 38 | template 39 | inline CUtlPair MakeUtlPair( T1 t1, T2 t2 ) 40 | { 41 | return CUtlPair(t1, t2); 42 | } 43 | 44 | //// HashItem() overload that works automatically with our hash containers 45 | //template 46 | //inline uint32 HashItem( const CUtlPair &item ) 47 | //{ 48 | // return HashItem( (uint64)HashItem( item.first ) + ((uint64)HashItem( item.second ) << 32) ); 49 | //} 50 | 51 | 52 | #endif // UTLPAIR_H 53 | -------------------------------------------------------------------------------- /public/tier2/tier2.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: A link library for GoldSrc. 4 | // 5 | //===========================================================================// 6 | 7 | 8 | #ifndef TIER2_H 9 | #define TIER2_H 10 | 11 | #if defined( _WIN32 ) 12 | #pragma once 13 | #endif 14 | 15 | #include "tier1/tier1.h" 16 | 17 | 18 | //----------------------------------------------------------------------------- 19 | // Forward declarations 20 | //----------------------------------------------------------------------------- 21 | class IFileSystem; 22 | class IBaseUI; 23 | class IEngineVGui; 24 | class IGameConsole; 25 | class IGameUI; 26 | class IGameUIFuncs; 27 | 28 | namespace vgui2 29 | { 30 | class ISurface; 31 | class IVGui; 32 | class IInputInternal; 33 | class IPanel; 34 | class ILocalize; 35 | class ISchemeManager; 36 | class ISystem; 37 | } 38 | 39 | 40 | //----------------------------------------------------------------------------- 41 | // These tier2 libraries must be set by any users of this library. 42 | // They can be set by calling ConnectTier2Libraries or InitDefaultFileSystem. 43 | // It is hoped that setting this, and using this library will be the common mechanism for 44 | // allowing link libraries to access tier2 library interfaces 45 | //----------------------------------------------------------------------------- 46 | extern IFileSystem *g_pFullFileSystem; 47 | extern IBaseUI *g_pBaseUI; 48 | extern IEngineVGui *g_pEngineVGui; 49 | extern IGameUIFuncs *g_pGameUIFuncs; 50 | extern vgui2::ISurface *g_pVGuiSurface; 51 | extern vgui2::IInputInternal *g_pVGuiInput; 52 | extern vgui2::IVGui *g_pVGui; 53 | extern vgui2::IPanel *g_pVGuiPanel; 54 | extern vgui2::ILocalize *g_pVGuiLocalize; 55 | extern vgui2::ISchemeManager *g_pVGuiSchemeManager; 56 | extern vgui2::ISystem *g_pVGuiSystem; 57 | 58 | // These interfaces are exposed by GameUI.dll for the engine (hw.dll/sw.dll) 59 | // They are not supposed to be called directly. 60 | // Define TIER2_GAMEUI_INTERNALS if you really need them. 61 | #ifdef TIER2_GAMEUI_INTERNALS 62 | extern IGameConsole *g_pGameConsole; 63 | extern IGameUI *g_pGameUI; 64 | #endif 65 | 66 | 67 | //----------------------------------------------------------------------------- 68 | // Call this to connect to/disconnect from all tier 2 libraries. 69 | // It's up to the caller to check the globals it cares about to see if ones are missing 70 | //----------------------------------------------------------------------------- 71 | void ConnectTier2Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount ); 72 | void DisconnectTier2Libraries(); 73 | 74 | 75 | #endif // TIER2_H 76 | 77 | -------------------------------------------------------------------------------- /public/vgui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_sources( 2 | CMakeLists.txt 3 | Cursor.h 4 | Dar.h 5 | IBorder.h 6 | IClientPanel.h 7 | IHTML.h 8 | IImage.h 9 | IInput.h 10 | IInputInternal.h 11 | ILocalize.h 12 | IPanel.h 13 | IScheme.h 14 | ISurface.h 15 | ISurfaceV28.h 16 | ISurfaceV29.h 17 | ISystem.h 18 | IVGui.h 19 | IVguiMatInfo.h 20 | IVguiMatInfoVar.h 21 | IVguiV06.h 22 | KeyCode.h 23 | MouseCode.h 24 | Point.h 25 | VGUI2.h 26 | ) 27 | 28 | -------------------------------------------------------------------------------- /public/vgui/Cursor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/Cursor.h -------------------------------------------------------------------------------- /public/vgui/Dar.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/Dar.h -------------------------------------------------------------------------------- /public/vgui/IBorder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IBorder.h -------------------------------------------------------------------------------- /public/vgui/IClientPanel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IClientPanel.h -------------------------------------------------------------------------------- /public/vgui/IHTML.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IHTML.h -------------------------------------------------------------------------------- /public/vgui/IImage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IImage.h -------------------------------------------------------------------------------- /public/vgui/IInput.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IInput.h -------------------------------------------------------------------------------- /public/vgui/IInputInternal.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IInputInternal.h -------------------------------------------------------------------------------- /public/vgui/ILocalize.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/ILocalize.h -------------------------------------------------------------------------------- /public/vgui/IPanel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IPanel.h -------------------------------------------------------------------------------- /public/vgui/ISurface.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/ISurface.h -------------------------------------------------------------------------------- /public/vgui/ISystem.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/ISystem.h -------------------------------------------------------------------------------- /public/vgui/IVGui.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IVGui.h -------------------------------------------------------------------------------- /public/vgui/IVguiMatInfo.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IVguiMatInfo.h -------------------------------------------------------------------------------- /public/vgui/IVguiMatInfoVar.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/IVguiMatInfoVar.h -------------------------------------------------------------------------------- /public/vgui/KeyCode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/KeyCode.h -------------------------------------------------------------------------------- /public/vgui/MouseCode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/MouseCode.h -------------------------------------------------------------------------------- /public/vgui/Point.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/Point.h -------------------------------------------------------------------------------- /public/vgui/VGUI2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vgui/VGUI2.h -------------------------------------------------------------------------------- /public/vgui_controls/AnimatingImagePanel.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef ANIMATINGIMAGEPANEL_H 9 | #define ANIMATINGIMAGEPANEL_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | 21 | //----------------------------------------------------------------------------- 22 | // Purpose: Animating image 23 | //----------------------------------------------------------------------------- 24 | class AnimatingImagePanel : public Panel 25 | { 26 | DECLARE_CLASS_SIMPLE( AnimatingImagePanel, Panel ); 27 | 28 | public: 29 | AnimatingImagePanel(Panel *parent, const char *name); 30 | 31 | // Add an image to the end of the list of animations 32 | // image - pointer to the image to add to the end of the list 33 | virtual void AddImage(IImage *image); 34 | 35 | // Load a set of animations by name. 36 | // baseName - The name of the animations without their frame number or file extension, (e.g. c1.tga becomes just c.) 37 | // framecount: number of frames in the animation 38 | virtual void LoadAnimation(const char *baseName, int frameCount); 39 | 40 | virtual void StartAnimation(); 41 | virtual void StopAnimation(); 42 | virtual void ResetAnimation(int frame = 0); 43 | 44 | protected: 45 | virtual void OnTick(); 46 | virtual void PerformLayout(); 47 | virtual void PaintBackground(); 48 | 49 | virtual void GetSettings(KeyValues *outResourceData); 50 | virtual void ApplySettings(KeyValues *inResourceData); 51 | virtual const char *GetDescription(); 52 | 53 | private: 54 | int m_iCurrentImage; 55 | int m_iNextFrameTime; 56 | int m_iFrameTimeMillis; 57 | CUtlVector m_Frames; 58 | char *m_pImageName; 59 | bool m_bAnimating; 60 | bool m_bFiltered; 61 | bool m_bScaleImage; 62 | }; 63 | 64 | }; // namespace vgui2 65 | 66 | #endif // ANIMATINGIMAGEPANEL_H 67 | -------------------------------------------------------------------------------- /public/vgui_controls/BitmapImagePanel.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef BITMAPIMAGEPANEL_H 9 | #define BITMAPIMAGEPANEL_H 10 | #ifdef _WIN32 11 | #pragma once 12 | #endif 13 | 14 | #include 15 | 16 | namespace vgui2 { 17 | 18 | class CBitmapImagePanel : public vgui2::Panel 19 | { 20 | public: 21 | CBitmapImagePanel( vgui2::Panel *parent, char const *panelName, char const *filename = NULL ); 22 | ~CBitmapImagePanel(); 23 | 24 | virtual void PaintBackground(); 25 | 26 | virtual void setTexture( char const *filename, bool hardwareFiltered = true ); 27 | 28 | void setImageColor( Color color ) { m_bgColor = color; } 29 | 30 | // Set how the image aligns itself within the panel 31 | virtual void SetContentAlignment(Label::Alignment alignment); 32 | 33 | protected: 34 | virtual void GetSettings(KeyValues *outResourceData); 35 | virtual void ApplySettings(KeyValues *inResourceData); 36 | virtual const char *GetDescription(); 37 | virtual void ApplySchemeSettings( IScheme *pScheme ); 38 | virtual void PaintBorder(); 39 | 40 | private: 41 | typedef vgui2::Panel BaseClass; 42 | 43 | virtual void ComputeImagePosition(int &x, int &y, int &w, int &h); 44 | Label::Alignment m_contentAlignment; 45 | 46 | bool m_preserveAspectRatio; 47 | bool m_hardwareFiltered; 48 | 49 | IImage *m_pImage; 50 | Color m_bgColor; 51 | char *m_pszImageName; 52 | char *m_pszColorName; 53 | }; 54 | 55 | }; 56 | 57 | #endif // BITMAPIMAGEPANEL_H 58 | -------------------------------------------------------------------------------- /public/vgui_controls/CheckButton.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef CHECKBUTTON_H 9 | #define CHECKBUTTON_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace vgui2 20 | { 21 | 22 | class TextImage; 23 | 24 | //----------------------------------------------------------------------------- 25 | // Purpose: Check box image 26 | //----------------------------------------------------------------------------- 27 | class CheckImage : public TextImage 28 | { 29 | public: 30 | CheckImage(CheckButton *CheckButton) : TextImage( "g" ) 31 | { 32 | _CheckButton = CheckButton; 33 | 34 | SetSize(20, 13); 35 | } 36 | 37 | virtual void Paint(); 38 | 39 | virtual void SetColor(Color color) 40 | { 41 | _borderColor1 = color; 42 | _borderColor2 = color; 43 | _checkColor = color; 44 | } 45 | 46 | Color _borderColor1; 47 | Color _borderColor2; 48 | Color _checkColor; 49 | 50 | Color _bgColor; 51 | 52 | private: 53 | CheckButton *_CheckButton; 54 | }; 55 | 56 | //----------------------------------------------------------------------------- 57 | // Purpose: Tick-box button 58 | //----------------------------------------------------------------------------- 59 | class CheckButton : public ToggleButton 60 | { 61 | DECLARE_CLASS_SIMPLE( CheckButton, ToggleButton ); 62 | 63 | public: 64 | CheckButton(Panel *parent, const char *panelName, const char *text); 65 | ~CheckButton(); 66 | 67 | // Check the button 68 | virtual void SetSelected(bool state ); 69 | 70 | // sets whether or not the state of the check can be changed 71 | // if this is set to false, then no input in the code or by the user can change it's state 72 | virtual void SetCheckButtonCheckable(bool state); 73 | virtual bool IsCheckButtonCheckable() const { return m_bCheckButtonCheckable; } 74 | 75 | Color GetDisabledFgColor() { return _disabledFgColor; } 76 | Color GetDisabledBgColor() { return _disabledBgColor; } 77 | 78 | CheckImage *GetCheckImage() { return _checkBoxImage; } 79 | 80 | virtual void SetHighlightColor(Color fgColor); 81 | 82 | protected: 83 | virtual void ApplySchemeSettings(IScheme *pScheme); 84 | MESSAGE_FUNC_PTR( OnCheckButtonChecked, "CheckButtonChecked", panel ); 85 | virtual Color GetButtonFgColor(); 86 | 87 | virtual IBorder *GetBorder(bool depressed, bool armed, bool selected, bool keyfocus); 88 | 89 | /* MESSAGES SENT 90 | "CheckButtonChecked" - sent when the check button state is changed 91 | "state" - button state: 1 is checked, 0 is unchecked 92 | */ 93 | 94 | 95 | private: 96 | enum { CHECK_INSET = 6 }; 97 | bool m_bCheckButtonCheckable; 98 | CheckImage *_checkBoxImage; 99 | Color _disabledFgColor; 100 | Color _disabledBgColor; 101 | Color _highlightFgColor; 102 | }; 103 | 104 | } // namespace vgui2 105 | 106 | #endif // CHECKBUTTON_H 107 | -------------------------------------------------------------------------------- /public/vgui_controls/CheckButtonList.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef CHECKBUTTONLIST_H 8 | #define CHECKBUTTONLIST_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include 14 | #include "utlvector.h" 15 | 16 | namespace vgui2 17 | { 18 | 19 | //----------------------------------------------------------------------------- 20 | // Purpose: Contains a list of check boxes, displaying scrollbars if necessary 21 | //----------------------------------------------------------------------------- 22 | class CheckButtonList : public EditablePanel 23 | { 24 | DECLARE_CLASS_SIMPLE( CheckButtonList, EditablePanel ); 25 | 26 | public: 27 | CheckButtonList(Panel *parent, const char *name); 28 | ~CheckButtonList(); 29 | 30 | // adds a check button to the list 31 | int AddItem(const char *itemText, bool startsSelected, KeyValues *userData); 32 | 33 | // clears the list 34 | void RemoveAll(); 35 | 36 | // number of items in list that are checked 37 | int GetCheckedItemCount(); 38 | 39 | // item iteration 40 | bool IsItemIDValid(int itemID); 41 | int GetHighestItemID(); 42 | int GetItemCount(); 43 | 44 | // item info 45 | KeyValues *GetItemData(int itemID); 46 | bool IsItemChecked(int itemID); 47 | void SetItemCheckable(int itemID, bool state); 48 | 49 | /* MESSAGES SENT 50 | "CheckButtonChecked" - sent when one of the check buttons state has changed 51 | 52 | */ 53 | 54 | protected: 55 | virtual void PerformLayout(); 56 | virtual void ApplySchemeSettings(IScheme *pScheme); 57 | virtual void OnMouseWheeled(int delta); 58 | 59 | private: 60 | MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", pParams ); 61 | MESSAGE_FUNC( OnScrollBarSliderMoved, "ScrollBarSliderMoved" ); 62 | 63 | struct CheckItem_t 64 | { 65 | vgui2::CheckButton *checkButton; 66 | KeyValues *userData; 67 | }; 68 | CUtlVector m_CheckItems; 69 | vgui2::ScrollBar *m_pScrollBar; 70 | }; 71 | 72 | } 73 | 74 | #endif // CHECKBUTTONLIST_H 75 | -------------------------------------------------------------------------------- /public/vgui_controls/CircularProgressBar.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef CIRCULARPROGRESSBAR_H 9 | #define CIRCULARPROGRESSBAR_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | enum progress_textures_t 20 | { 21 | PROGRESS_TEXTURE_FG, 22 | PROGRESS_TEXTURE_BG, 23 | 24 | NUM_PROGRESS_TEXTURES, 25 | }; 26 | 27 | namespace vgui2 28 | { 29 | 30 | //----------------------------------------------------------------------------- 31 | // Purpose: Progress Bar in the shape of a pie graph 32 | //----------------------------------------------------------------------------- 33 | class CircularProgressBar : public ProgressBar 34 | { 35 | DECLARE_CLASS_SIMPLE( CircularProgressBar, ProgressBar ); 36 | 37 | public: 38 | CircularProgressBar(Panel *parent, const char *panelName); 39 | ~CircularProgressBar(); 40 | 41 | virtual void ApplySettings(KeyValues *inResourceData); 42 | virtual void ApplySchemeSettings(IScheme *pScheme); 43 | 44 | void SetFgImage(const char *imageName) { SetImage( imageName, PROGRESS_TEXTURE_FG ); } 45 | void SetBgImage(const char *imageName) { SetImage( imageName, PROGRESS_TEXTURE_BG ); } 46 | 47 | enum CircularProgressDir_e 48 | { 49 | PROGRESS_CW, 50 | PROGRESS_CCW 51 | }; 52 | int GetProgressDirection() const { return m_iProgressDirection; } 53 | void SetProgressDirection( int val ) { m_iProgressDirection = val; } 54 | void SetStartSegment( int val ) { m_iStartSegment = val; } 55 | 56 | protected: 57 | virtual void Paint(); 58 | virtual void PaintBackground(); 59 | 60 | void DrawCircleSegment( Color c, float flEndDegrees, bool clockwise /* = true */ ); 61 | void SetImage(const char *imageName, progress_textures_t iPos); 62 | 63 | private: 64 | int m_iProgressDirection; 65 | int m_iStartSegment; 66 | 67 | int m_nTextureId[NUM_PROGRESS_TEXTURES]; 68 | char *m_pszImageName[NUM_PROGRESS_TEXTURES]; 69 | int m_lenImageName[NUM_PROGRESS_TEXTURES]; 70 | }; 71 | 72 | } // namespace vgui2 73 | 74 | #endif // CIRCULARPROGRESSBAR_H -------------------------------------------------------------------------------- /public/vgui_controls/ControllerMap.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef CONTROLLERMAP_H 9 | #define CONTROLLERMAP_H 10 | #ifdef _WIN32 11 | #pragma once 12 | #endif 13 | 14 | #include "Panel.h" 15 | #include "utlmap.h" 16 | #include "utlsymbol.h" 17 | 18 | class CControllerMap : public vgui2::Panel 19 | { 20 | DECLARE_CLASS_SIMPLE( CControllerMap, vgui2::Panel ) 21 | 22 | virtual void OnKeyCodeTyped( vgui2::KeyCode code ); 23 | 24 | public: 25 | CControllerMap( vgui2::Panel *parent, const char *name ); 26 | 27 | virtual void ApplySettings( KeyValues *inResourceData ); 28 | 29 | int NumButtons( void ) 30 | { 31 | return m_buttonMap.Count(); 32 | } 33 | 34 | const char *GetBindingText( int idx ); 35 | const char *GetBindingIcon( int idx ); 36 | 37 | private: 38 | 39 | struct button_t 40 | { 41 | CUtlSymbol cmd; 42 | CUtlSymbol text; 43 | CUtlSymbol icon; 44 | }; 45 | CUtlMap< int, button_t > m_buttonMap; 46 | }; 47 | 48 | #endif // CONTROLLERMAP_H -------------------------------------------------------------------------------- /public/vgui_controls/Divider.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef DIVIDER_H 9 | #define DIVIDER_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | 17 | namespace vgui2 18 | { 19 | 20 | //----------------------------------------------------------------------------- 21 | // Purpose: Thin line used to divide sections in dialogs 22 | //----------------------------------------------------------------------------- 23 | class Divider : public Panel 24 | { 25 | DECLARE_CLASS_SIMPLE( Divider, Panel ); 26 | 27 | public: 28 | Divider(Panel *parent, const char *name); 29 | ~Divider(); 30 | 31 | virtual void ApplySchemeSettings(IScheme *pScheme); 32 | }; 33 | 34 | 35 | } // namespace vgui2 36 | 37 | 38 | #endif // DIVIDER_H 39 | -------------------------------------------------------------------------------- /public/vgui_controls/ExpandButton.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: A button with no borders that shows a left-pointing or down-pointing triangle 4 | // 5 | // $NoKeywords: $ 6 | //===========================================================================// 7 | 8 | #ifndef EXPANDBUTTON_H 9 | #define EXPANDBUTTON_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | 19 | namespace vgui2 20 | { 21 | 22 | //----------------------------------------------------------------------------- 23 | // Purpose: A button with no borders that shows a left-pointing or down-pointing arrow 24 | //----------------------------------------------------------------------------- 25 | class ExpandButton : public ToggleButton 26 | { 27 | DECLARE_CLASS_SIMPLE( ExpandButton, ToggleButton ); 28 | 29 | public: 30 | ExpandButton( Panel *parent, const char *panelName ); 31 | ~ExpandButton(); 32 | 33 | // Expand the button (selected == expanded) 34 | virtual void SetSelected( bool bExpand ); 35 | 36 | // sets whether or not the state of the check can be changed 37 | // if this is set to false, then no input in the code or by the user can change it's state 38 | void SetExpandable(bool state); 39 | 40 | virtual void Paint(); 41 | 42 | protected: 43 | virtual void ApplySchemeSettings(IScheme *pScheme); 44 | MESSAGE_FUNC_PTR( OnExpanded, "Expanded", panel ); 45 | 46 | virtual IBorder *GetBorder(bool depressed, bool armed, bool selected, bool keyfocus); 47 | 48 | /* MESSAGES SENT 49 | "Expanded" - sent when the expand button state is changed 50 | "state" - button state: 1 is expanded, 0 is unexpanded 51 | */ 52 | 53 | private: 54 | bool m_bExpandable; 55 | HFont m_hFont; 56 | Color m_Color; 57 | }; 58 | 59 | } // namespace vgui2 60 | 61 | #endif // EXPANDBUTTON_H 62 | -------------------------------------------------------------------------------- /public/vgui_controls/FocusNavGroup.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef FOCUSNAVGROUP_H 9 | #define FOCUSNAVGROUP_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | 21 | class Panel; 22 | 23 | //----------------------------------------------------------------------------- 24 | // Purpose: Handles navigation through a set of panels, with tab order & hotkeys 25 | //----------------------------------------------------------------------------- 26 | class FocusNavGroup 27 | { 28 | public: 29 | FocusNavGroup(Panel *panel); 30 | ~FocusNavGroup(); 31 | virtual Panel *GetDefaultPanel(); // returns a pointer to the panel with the default focus 32 | 33 | virtual void SetDefaultButton(Panel *panel); // sets which panel should receive input when ENTER is hit 34 | virtual VPANEL GetDefaultButton(); // panel which receives default input when ENTER is hit, if current focused item cannot accept ENTER 35 | virtual VPANEL GetCurrentDefaultButton(); // panel which receives input when ENTER is hit 36 | virtual Panel *FindPanelByHotkey(wchar_t key); // finds the panel which is activated by the specified key 37 | virtual bool RequestFocusPrev(VPANEL panel = NULL); // if panel is NULL, then the tab increment is based last known panel that had key focus 38 | virtual bool RequestFocusNext(VPANEL panel = NULL); 39 | 40 | virtual Panel *GetCurrentFocus(); 41 | virtual VPANEL SetCurrentFocus(VPANEL panel, VPANEL defaultPanel); // returns the Default panel 42 | 43 | // sets the panel that owns this FocusNavGroup to be the root in the focus traversal heirarchy 44 | // focus change via KEY_TAB will only travel to children of this main panel 45 | virtual void SetFocusTopLevel(bool state); 46 | 47 | virtual void SetCurrentDefaultButton(VPANEL panel, bool sendCurrentDefaultButtonMessage = true); 48 | private: 49 | bool CanButtonBeDefault(VPANEL panel); 50 | 51 | VPanelHandle _defaultButton; 52 | VPanelHandle _currentDefaultButton; 53 | VPanelHandle _currentFocus; 54 | 55 | Panel *_mainPanel; 56 | bool _topLevelFocus; 57 | }; 58 | 59 | } // namespace vgui2 60 | 61 | #endif // FOCUSNAVGROUP_H 62 | -------------------------------------------------------------------------------- /public/vgui_controls/GraphPanel.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef GRAPHPANEL_H 8 | #define GRAPHPANEL_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include 14 | #include "utllinkedlist.h" 15 | #include "utlvector.h" 16 | 17 | namespace vgui2 18 | { 19 | 20 | //----------------------------------------------------------------------------- 21 | // Purpose: Holds and displays a chart 22 | //----------------------------------------------------------------------------- 23 | class GraphPanel : public Panel 24 | { 25 | DECLARE_CLASS_SIMPLE( GraphPanel, Panel ); 26 | 27 | public: 28 | GraphPanel(Panel *parent, const char *name); 29 | 30 | // domain settings (x-axis settings) 31 | // sets the window of samples to display 32 | void SetDisplayDomainSize(float size); 33 | // sets the range of samples the graph should keep 34 | // should be set to the max you would set the display domain size 35 | void SetMaxDomainSize(float size); 36 | // sets the minimum domain that will be displayed; used to collapse samples 37 | void SetMinDomainSize(float size); 38 | 39 | // range settings (y-axis settings) 40 | void SetUseFixedRange(float lowRange, float highRange); 41 | void SetUseDynamicRange(float *rangeList, int numRanges); 42 | void GetDisplayedRange(float &lowRange, float &highRange); 43 | 44 | // adds an item to the end of the list 45 | // sampleEnd is assumed to be the trailing edge of the sample 46 | // assumes that the samples are fairly evenly spaced (not much more work to do to fix this though) 47 | void AddItem(float sampleEnd, float sampleValue); 48 | 49 | protected: 50 | virtual void Paint(); 51 | virtual void PerformLayout(); 52 | virtual void ApplySchemeSettings(IScheme *pScheme); 53 | 54 | private: 55 | int GetVisibleItemCount(); 56 | 57 | struct Sample_t 58 | { 59 | float sampleEnd; 60 | float value; 61 | }; 62 | CUtlLinkedList m_Samples; 63 | 64 | // the window to show 65 | float m_flDomainSize; 66 | float m_flMaxDomainSize, m_flMinDomainSize; 67 | bool m_bMaxDomainSizeSet; 68 | 69 | // range 70 | float m_flLowRange, m_flHighRange; 71 | bool m_bUseDynamicRange; 72 | CUtlVector m_RangeList; 73 | 74 | // rendering 75 | int m_iGraphBarWidth; 76 | int m_iGraphBarGapWidth; 77 | }; 78 | 79 | } // namespace vgui2 80 | 81 | #endif // GRAPHPANEL_H 82 | -------------------------------------------------------------------------------- /public/vgui_controls/Image.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef IMAGE_H 9 | #define IMAGE_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace vgui2 20 | { 21 | 22 | class Panel; 23 | 24 | //----------------------------------------------------------------------------- 25 | // Purpose: Basic image control 26 | //----------------------------------------------------------------------------- 27 | class Image : public IImage 28 | { 29 | public: 30 | Image(); 31 | virtual ~Image(); 32 | 33 | // Set the position of the image 34 | virtual void SetPos( int x, int y ); 35 | // Get the position of the image 36 | virtual void GetPos( int &x, int &y ); 37 | // Get the size of the image 38 | virtual void GetSize( int &wide, int &tall ); 39 | virtual void GetContentSize( int &wide, int &tall ); 40 | // Set the draw color 41 | virtual void SetColor( Color color ); 42 | // set the background color 43 | virtual void SetBkColor( Color color ) { DrawSetColor( color ); } 44 | // Get the draw color 45 | virtual Color GetColor(); 46 | virtual bool Evict(); 47 | virtual int GetNumFrames(); 48 | virtual void SetFrame( int nFrame ); 49 | virtual HTexture GetID(); 50 | virtual void SetRotation( int iRotation ) { return; }; 51 | 52 | protected: 53 | virtual void SetSize(int wide, int tall); 54 | virtual void DrawSetColor(Color color); 55 | virtual void DrawSetColor(int r, int g, int b, int a); 56 | virtual void DrawFilledRect(int x0, int y0, int x1, int y1); 57 | virtual void DrawOutlinedRect(int x0, int y0, int x1, int y1); 58 | virtual void DrawLine(int x0,int y0,int x1,int y1); 59 | virtual void DrawPolyLine(int *px, int *py, int numPoints); 60 | virtual void DrawSetTextFont(HFont font); 61 | virtual void DrawSetTextColor(Color color); 62 | virtual void DrawSetTextColor(int r, int g, int b, int a); 63 | virtual void DrawSetTextPos(int x,int y); 64 | virtual void DrawPrintText(const wchar_t *str, int strlen); 65 | virtual void DrawPrintText(int x, int y, const wchar_t *str, int strlen); 66 | virtual void DrawPrintChar(wchar_t ch); 67 | virtual void DrawPrintChar(int x, int y, wchar_t ch); 68 | virtual void DrawSetTexture(int id); 69 | virtual void DrawTexturedRect(int x0, int y0, int x1, int y1); 70 | virtual void Paint() = 0; 71 | 72 | private: 73 | int _pos[2]; 74 | int _size[2]; 75 | Color _color; 76 | }; 77 | 78 | } // namespace vgui2 79 | 80 | #endif // IMAGE_H 81 | -------------------------------------------------------------------------------- /public/vgui_controls/ImageList.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef IMAGELIST_H 9 | #define IMAGELIST_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace vgui2 20 | { 21 | 22 | //----------------------------------------------------------------------------- 23 | // Purpose: holds a collection of images 24 | // used by controls so that images can be refered to by indices 25 | //----------------------------------------------------------------------------- 26 | class ImageList 27 | { 28 | public: 29 | ImageList(bool deleteImagesWhenDone); 30 | ~ImageList(); 31 | 32 | // adds a new image to the list, returning the index it was placed at 33 | int AddImage(vgui2::IImage *image); 34 | 35 | // returns the number of images 36 | int GetImageCount(); 37 | 38 | // returns true if an index is valid 39 | bool IsValidIndex(int imageIndex); 40 | 41 | // sets an image at a specified index, growing and adding NULL images if necessary 42 | void SetImageAtIndex(int index, vgui2::IImage *image); 43 | 44 | // gets an image, imageIndex is of range [0, GetImageCount) 45 | // image index 0 is always the blank image 46 | vgui2::IImage *GetImage(int imageIndex); 47 | 48 | private: 49 | CUtlVector m_Images; 50 | bool m_bDeleteImagesWhenDone; 51 | }; 52 | 53 | 54 | } // namespace vgui2 55 | 56 | #endif // IMAGELIST_H 57 | -------------------------------------------------------------------------------- /public/vgui_controls/ImagePanel.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef IMAGEPANEL_H 9 | #define IMAGEPANEL_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | 21 | class IImage; 22 | 23 | //----------------------------------------------------------------------------- 24 | // Purpose: Panel that holds a single image 25 | //----------------------------------------------------------------------------- 26 | class ImagePanel : public Panel 27 | { 28 | DECLARE_CLASS_SIMPLE( ImagePanel, Panel ); 29 | public: 30 | ImagePanel(Panel *parent, const char *name); 31 | ~ImagePanel(); 32 | 33 | virtual void SetImage(IImage *image); 34 | virtual void SetImage(const char *imageName); 35 | virtual IImage *GetImage(); 36 | char *GetImageName(); 37 | 38 | void SetShouldCenterImage( bool state ) { m_bCenterImage = state; } 39 | bool GetShouldCenterImage() const { return m_bCenterImage; } 40 | 41 | // sets whether or not the image should scale to fit the size of the ImagePanel (defaults to false) 42 | void SetShouldScaleImage( bool state ); 43 | bool GetShouldScaleImage(); 44 | void SetScaleAmount( float scale ); 45 | float GetScaleAmount( void ); 46 | 47 | void SetTileImage( bool bTile ) { m_bTileImage = bTile; } 48 | 49 | // set the color to fill with, if no image is specified 50 | void SetFillColor( Color col ); 51 | Color GetFillColor(); 52 | 53 | virtual Color GetDrawColor( void ); 54 | virtual void SetDrawColor( Color drawColor ); 55 | 56 | virtual void ApplySettings(KeyValues *inResourceData); 57 | 58 | // unhooks and evicts image if possible, caller must re-establish 59 | bool EvictImage(); 60 | 61 | protected: 62 | virtual void PaintBackground(); 63 | virtual void GetSettings(KeyValues *outResourceData); 64 | virtual const char *GetDescription(); 65 | virtual void OnSizeChanged(int newWide, int newTall); 66 | virtual void ApplySchemeSettings( IScheme *pScheme ); 67 | 68 | private: 69 | IImage *m_pImage; 70 | char *m_pszImageName; 71 | char *m_pszFillColorName; 72 | char *m_pszDrawColorName; 73 | bool m_bPositionImage; 74 | bool m_bCenterImage; 75 | bool m_bScaleImage; 76 | bool m_bTileImage; 77 | bool m_bTileHorizontally; 78 | bool m_bTileVertically; 79 | float m_fScaleAmount; 80 | Color m_FillColor; 81 | Color m_DrawColor; 82 | }; 83 | 84 | } // namespace vgui2 85 | 86 | #endif // IMAGEPANEL_H 87 | -------------------------------------------------------------------------------- /public/vgui_controls/InputDialog.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #ifndef INPUTDIALOG_H 8 | #define INPUTDIALOG_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | namespace vgui2 17 | { 18 | 19 | class Label; 20 | class Button; 21 | class TextEntry; 22 | 23 | 24 | //----------------------------------------------------------------------------- 25 | // Purpose: Utility dialog base class - just has context kv and ok/cancel buttons 26 | //----------------------------------------------------------------------------- 27 | class BaseInputDialog : public Frame 28 | { 29 | DECLARE_CLASS_SIMPLE( BaseInputDialog, Frame ); 30 | 31 | public: 32 | BaseInputDialog( vgui2::Panel *parent, const char *title ); 33 | ~BaseInputDialog(); 34 | 35 | void DoModal( KeyValues *pContextKeyValues = NULL ); 36 | 37 | protected: 38 | virtual void PerformLayout(); 39 | virtual void PerformLayout( int x, int y, int w, int h ) {} 40 | 41 | // command buttons 42 | virtual void OnCommand( const char *command ); 43 | 44 | void CleanUpContextKeyValues(); 45 | KeyValues *m_pContextKeyValues; 46 | 47 | private: 48 | vgui2::Button *m_pCancelButton; 49 | vgui2::Button *m_pOKButton; 50 | }; 51 | 52 | //----------------------------------------------------------------------------- 53 | // Purpose: Utility dialog, used to ask yes/no questions of the user 54 | //----------------------------------------------------------------------------- 55 | class InputMessageBox : public BaseInputDialog 56 | { 57 | DECLARE_CLASS_SIMPLE( InputMessageBox, BaseInputDialog ); 58 | 59 | public: 60 | InputMessageBox( vgui2::Panel *parent, const char *title, char const *prompt ); 61 | ~InputMessageBox(); 62 | 63 | protected: 64 | virtual void PerformLayout( int x, int y, int w, int h ); 65 | 66 | private: 67 | vgui2::Label *m_pPrompt; 68 | }; 69 | 70 | //----------------------------------------------------------------------------- 71 | // Purpose: Utility dialog, used to let user type in some text 72 | //----------------------------------------------------------------------------- 73 | class InputDialog : public BaseInputDialog 74 | { 75 | DECLARE_CLASS_SIMPLE( InputDialog, BaseInputDialog ); 76 | 77 | public: 78 | InputDialog( vgui2::Panel *parent, const char *title, char const *prompt, char const *defaultValue = "" ); 79 | ~InputDialog(); 80 | 81 | void SetMultiline( bool state ); 82 | 83 | /* action signals 84 | 85 | "InputCompleted" 86 | "text" - the text entered 87 | 88 | "InputCanceled" 89 | */ 90 | void AllowNumericInputOnly( bool bOnlyNumeric ); 91 | 92 | protected: 93 | virtual void PerformLayout( int x, int y, int w, int h ); 94 | 95 | // command buttons 96 | virtual void OnCommand(const char *command); 97 | 98 | private: 99 | vgui2::Label *m_pPrompt; 100 | vgui2::TextEntry *m_pInput; 101 | }; 102 | 103 | } // namespace vgui2 104 | 105 | 106 | #endif // INPUTDIALOG_H 107 | -------------------------------------------------------------------------------- /public/vgui_controls/KeyBindingHelpDialog.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | 7 | #ifndef KEYBINDINGHELPDIALOG_H 8 | #define KEYBINDINGHELPDIALOG_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include "vgui_controls/Frame.h" 14 | #include "vgui/KeyCode.h" 15 | 16 | namespace vgui2 17 | { 18 | 19 | class ListPanel; 20 | class CKeyBoardEditorDialog; 21 | 22 | //----------------------------------------------------------------------------- 23 | // Purpose: Dialog for use in editing keybindings 24 | //----------------------------------------------------------------------------- 25 | class CKeyBindingHelpDialog : public Frame 26 | { 27 | DECLARE_CLASS_SIMPLE( CKeyBindingHelpDialog, Frame ); 28 | 29 | public: 30 | CKeyBindingHelpDialog( Panel *parent, Panel *panelToView, KeyBindingContextHandle_t handle, KeyCode code, int modifiers ); 31 | ~CKeyBindingHelpDialog(); 32 | 33 | virtual void OnCommand( char const *cmd ); 34 | virtual void OnKeyCodeTyped(vgui2::KeyCode code); 35 | 36 | // The key originally bound to help was pressed 37 | void HelpKeyPressed(); 38 | private: 39 | 40 | virtual void OnTick(); 41 | 42 | bool IsHelpKeyStillBeingHeld(); 43 | 44 | void PopulateList(); 45 | void GetMappingList( Panel *panel, CUtlVector< PanelKeyBindingMap * >& maps ); 46 | 47 | void AnsiText( char const *token, char *out, size_t buflen ); 48 | 49 | vgui2::PHandle m_hPanel; 50 | KeyBindingContextHandle_t m_Handle; 51 | KeyCode m_KeyCode; 52 | int m_Modifiers; 53 | 54 | ListPanel *m_pList; 55 | double m_flShowTime; 56 | bool m_bPermanent; 57 | 58 | DHANDLE< CKeyBoardEditorDialog > m_hKeyBindingsEditor; 59 | }; 60 | 61 | } 62 | 63 | #endif // KEYBINDINGHELPDIALOG_H 64 | -------------------------------------------------------------------------------- /public/vgui_controls/KeyRepeat.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | 7 | #ifndef KEYREPEAT_H 8 | #define KEYREPEAT_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include 14 | 15 | namespace vgui2 16 | { 17 | 18 | enum KEYREPEAT_ALIASES 19 | { 20 | KR_ALIAS_UP, 21 | KR_ALIAS_DOWN, 22 | KR_ALIAS_LEFT, 23 | KR_ALIAS_RIGHT, 24 | 25 | FM_NUM_KEYREPEAT_ALIASES, 26 | }; 27 | 28 | class CKeyRepeatHandler 29 | { 30 | public: 31 | CKeyRepeatHandler() 32 | { 33 | Reset(); 34 | for ( int i = 0; i < FM_NUM_KEYREPEAT_ALIASES; i++ ) 35 | { 36 | m_flRepeatTimes[i] = 0.16; 37 | } 38 | } 39 | 40 | void Reset( void ) { memset( m_bAliasDown, 0, sizeof(bool) * FM_NUM_KEYREPEAT_ALIASES ); m_bHaveKeyDown = false; } 41 | void KeyDown( vgui2::KeyCode code ); 42 | void KeyUp( vgui2::KeyCode code ); 43 | vgui2::KeyCode KeyRepeated( void ); 44 | void SetKeyRepeatTime( vgui2::KeyCode code, float flRepeat ); 45 | 46 | private: 47 | int GetIndexForCode( vgui2::KeyCode code ) 48 | { 49 | switch ( code ) 50 | { 51 | case KEY_XBUTTON_DOWN: 52 | case KEY_XSTICK1_DOWN: 53 | return KR_ALIAS_DOWN; break; 54 | case KEY_XBUTTON_UP: 55 | case KEY_XSTICK1_UP: 56 | return KR_ALIAS_UP; break; 57 | case KEY_XBUTTON_LEFT: 58 | case KEY_XSTICK1_LEFT: 59 | return KR_ALIAS_LEFT; break; 60 | case KEY_XBUTTON_RIGHT: 61 | case KEY_XSTICK1_RIGHT: 62 | return KR_ALIAS_RIGHT; break; 63 | default: 64 | break; 65 | } 66 | return -1; 67 | } 68 | 69 | private: 70 | bool m_bAliasDown[FM_NUM_KEYREPEAT_ALIASES]; 71 | float m_flRepeatTimes[FM_NUM_KEYREPEAT_ALIASES]; 72 | float m_flNextKeyRepeat; 73 | bool m_bHaveKeyDown; 74 | }; 75 | 76 | 77 | } // namespace vgui2 78 | 79 | #endif // KEYREPEAT_H 80 | -------------------------------------------------------------------------------- /public/vgui_controls/MenuBar.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef MENUBAR_H 9 | #define MENUBAR_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | 21 | //----------------------------------------------------------------------------- 22 | // Purpose: 23 | //----------------------------------------------------------------------------- 24 | class MenuBar : public Panel 25 | { 26 | DECLARE_CLASS_SIMPLE( MenuBar, Panel ); 27 | 28 | public: 29 | MenuBar(Panel *parent, const char *panelName); 30 | ~MenuBar(); 31 | 32 | virtual void AddButton(MenuButton *button); // add button to end of menu list 33 | virtual void AddMenu( const char *pButtonName, Menu *pMenu ); 34 | 35 | virtual void GetContentSize( int& w, int&h ); 36 | 37 | protected: 38 | virtual void OnKeyCodeTyped(KeyCode code); 39 | virtual void OnKeyTyped(wchar_t unichar); 40 | virtual void ApplySchemeSettings(IScheme *pScheme); 41 | virtual void PerformLayout(); 42 | virtual void Paint(); 43 | MESSAGE_FUNC( OnMenuClose, "MenuClose" ); 44 | MESSAGE_FUNC_INT( OnCursorEnteredMenuButton, "CursorEnteredMenuButton", VPanel); 45 | 46 | private: 47 | CUtlVector m_pMenuButtons; 48 | int m_nRightEdge; 49 | }; 50 | 51 | } // namespace vgui2 52 | 53 | #endif // MENUBAR_H 54 | 55 | -------------------------------------------------------------------------------- /public/vgui_controls/MenuButton.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef MENUBUTTON_H 9 | #define MENUBUTTON_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include "vgui_controls/Menu.h" 17 | 18 | namespace vgui2 19 | { 20 | 21 | class Menu; 22 | class TextImage; 23 | 24 | //----------------------------------------------------------------------------- 25 | // Purpose: Button that displays a menu when pressed 26 | //----------------------------------------------------------------------------- 27 | class MenuButton : public Button 28 | { 29 | DECLARE_CLASS_SIMPLE( MenuButton, Button ); 30 | 31 | public: 32 | MenuButton(Panel *parent, const char *panelName, const char *text); 33 | ~MenuButton(); 34 | 35 | // functions designed to be overriden 36 | virtual void OnShowMenu(Menu *menu) {} 37 | virtual void OnHideMenu(Menu *menu) {} 38 | virtual int OnCheckMenuItemCount() { return 0; } 39 | 40 | virtual void SetMenu(Menu *menu); 41 | virtual void HideMenu(void); 42 | virtual void DrawFocusBorder(int tx0, int ty0, int tx1, int ty1); 43 | MESSAGE_FUNC( OnMenuClose, "MenuClose" ); 44 | MESSAGE_FUNC_PARAMS( OnKillFocus, "KillFocus", kv ); // called after the panel loses the keyboard focus 45 | virtual void DoClick(); 46 | virtual void SetOpenOffsetY(int yOffset); 47 | 48 | virtual bool CanBeDefaultButton(void); 49 | 50 | // sets the direction in which the menu opens from the button, defaults to down 51 | virtual void SetOpenDirection(Menu::MenuDirection_e direction); 52 | 53 | virtual void OnKeyCodeTyped(KeyCode code); 54 | virtual void OnCursorEntered(); 55 | 56 | virtual void Paint(); 57 | virtual void PerformLayout(); 58 | virtual void ApplySchemeSettings( IScheme *pScheme ); 59 | virtual void OnCursorMoved( int x, int y ); 60 | 61 | // This style is like the IE "back" button where the left side acts like a regular button, the the right side has a little 62 | // combo box dropdown indicator and presents and submenu 63 | void SetDropMenuButtonStyle( bool state ); 64 | bool IsDropMenuButtonStyle() const; 65 | 66 | Menu *GetMenu(); 67 | 68 | private: 69 | 70 | Menu *m_pMenu; 71 | Menu::MenuDirection_e m_iDirection; 72 | 73 | int _openOffsetY; // vertical offset of menu from the menu button 74 | 75 | bool m_bDropMenuButtonStyle : 1; 76 | TextImage *m_pDropMenuImage; 77 | int m_nImageIndex; 78 | }; 79 | 80 | }; // namespace vgui2 81 | 82 | #endif // MENUBUTTON_H 83 | -------------------------------------------------------------------------------- /public/vgui_controls/PHandle.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef PHANDLE_H 9 | #define PHANDLE_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | 17 | namespace vgui2 18 | { 19 | 20 | class Panel; 21 | 22 | //----------------------------------------------------------------------------- 23 | // Purpose: Safe pointer class for handling Panel or derived panel classes 24 | //----------------------------------------------------------------------------- 25 | class PHandle 26 | { 27 | public: 28 | PHandle() : m_iPanelID(INVALID_PANEL) {} //m_iSerialNumber(0), m_pListEntry(0) {} 29 | 30 | Panel *Get(); 31 | Panel *Set( Panel *pPanel ); 32 | Panel *Set( HPanel hPanel ); 33 | 34 | operator Panel *() { return Get(); } 35 | Panel * operator ->() { return Get(); } 36 | Panel * operator = (Panel *pPanel) { return Set(pPanel); } 37 | 38 | bool operator == (Panel *pPanel) { return (Get() == pPanel); } 39 | operator bool () { return Get() != 0; } 40 | 41 | private: 42 | HPanel m_iPanelID; 43 | }; 44 | 45 | //----------------------------------------------------------------------------- 46 | // Purpose: Safe pointer class to just convert between VPANEL's and PHandle 47 | //----------------------------------------------------------------------------- 48 | class VPanelHandle 49 | { 50 | public: 51 | VPanelHandle() : m_iPanelID(INVALID_PANEL) {} 52 | 53 | VPANEL Get(); 54 | VPANEL Set( VPANEL pPanel ); 55 | 56 | operator VPANEL () { return Get(); } 57 | VPANEL operator = (VPANEL pPanel) { return Set(pPanel); } 58 | 59 | bool operator == (VPANEL pPanel) { return (Get() == pPanel); } 60 | operator bool () { return Get() != 0; } 61 | 62 | private: 63 | HPanel m_iPanelID; 64 | }; 65 | 66 | //----------------------------------------------------------------------------- 67 | // Purpose: DHANDLE is a templated version of PHandle 68 | //----------------------------------------------------------------------------- 69 | template< class PanelType > 70 | class DHANDLE : public PHandle 71 | { 72 | public: 73 | PanelType *Get() { return (PanelType *)PHandle::Get(); } 74 | PanelType *Set( PanelType *pPanel ) { return (PanelType *)PHandle::Set(pPanel); } 75 | PanelType *Set( HPanel hPanel ) { return (PanelType *)PHandle::Set(hPanel); } 76 | 77 | operator PanelType *() { return (PanelType *)PHandle::Get(); } 78 | PanelType * operator ->() { return (PanelType *)PHandle::Get(); } 79 | PanelType * operator = (PanelType *pPanel) { return (PanelType *)PHandle::Set(pPanel); } 80 | bool operator == (Panel *pPanel) { return (PHandle::Get() == pPanel); } 81 | operator bool () { return PHandle::Get() != NULL; } 82 | }; 83 | 84 | }; 85 | 86 | #endif // PHANDLE_H 87 | -------------------------------------------------------------------------------- /public/vgui_controls/PerforceFileExplorer.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Allows you to browse a directory structure, showing perforce files 4 | // 5 | // $NoKeywords: $ 6 | //===========================================================================// 7 | 8 | #ifndef PERFORCEFILEEXPLORER_H 9 | #define PERFORCEFILEEXPLORER_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | 16 | #include "tier1/utlstring.h" 17 | #include "vgui_controls/Frame.h" 18 | 19 | 20 | namespace vgui2 21 | { 22 | 23 | //----------------------------------------------------------------------------- 24 | // Forward declarations 25 | //----------------------------------------------------------------------------- 26 | class PerforceFileList; 27 | class ComboBox; 28 | class Button; 29 | 30 | 31 | //----------------------------------------------------------------------------- 32 | // Contains a list of files, determines their perforce status 33 | //----------------------------------------------------------------------------- 34 | class PerforceFileExplorer : public vgui2::Frame 35 | { 36 | DECLARE_CLASS_SIMPLE( PerforceFileExplorer, Frame ); 37 | 38 | public: 39 | // The context keyvalues are added to all messages sent by this dialog if they are specified 40 | PerforceFileExplorer( Panel *parent, const char *pPanelName ); 41 | ~PerforceFileExplorer(); 42 | 43 | // Inherited from Frame 44 | virtual void ApplySchemeSettings( IScheme *pScheme ); 45 | virtual void PerformLayout(); 46 | 47 | protected: 48 | MESSAGE_FUNC_PARAMS( OnTextChanged, "TextChanged", kv ); 49 | MESSAGE_FUNC( OnItemDoubleClicked, "ItemDoubleClicked" ); 50 | MESSAGE_FUNC( OnFolderUp, "FolderUp" ); 51 | 52 | void PopulateFileList(); 53 | void PopulateDriveList(); 54 | 55 | // Returns the current directory 56 | void SetCurrentDirectory( const char *pCurrentDirectory ); 57 | 58 | Button *m_pFolderUpButton; 59 | ComboBox *m_pFullPathCombo; 60 | PerforceFileList *m_pFileList; 61 | CUtlString m_CurrentDirectory; 62 | }; 63 | 64 | 65 | } // namespace vgui2 66 | 67 | #endif // PERFORCEFILEEXPLORER_H 68 | -------------------------------------------------------------------------------- /public/vgui_controls/ProgressBox.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef PROGRESSBOX_H 9 | #define PROGRESSBOX_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | // prevent windows macros from messing with the class 19 | #ifdef ProgressBox 20 | #undef ProgressBox 21 | #endif 22 | 23 | namespace vgui2 24 | { 25 | 26 | //----------------------------------------------------------------------------- 27 | // Purpose: Popup discardable message box 28 | //----------------------------------------------------------------------------- 29 | class ProgressBox : public Frame 30 | { 31 | DECLARE_CLASS_SIMPLE( ProgressBox, Frame ); 32 | 33 | public: 34 | // title - Text to be displayed in the title bar of the window 35 | // text - Text message in the message box 36 | // parent - parent panel of the message box, by default it has no parent. 37 | ProgressBox(const char *title, const char *text, const char *pszUnknownTimeString, Panel *parent = NULL); 38 | ProgressBox(const wchar_t *wszTitle, const wchar_t *wszText, const wchar_t *wszUnknownTimeString, Panel *parent = NULL); 39 | ~ProgressBox(); 40 | 41 | // Put the message box into a modal state 42 | virtual void DoModal(Frame *pFrameOver = NULL); 43 | 44 | // make the message box appear and in a modeless state 45 | virtual void ShowWindow(Frame *pFrameOver = NULL); 46 | 47 | // updates progress bar, range [0, 1] 48 | virtual void SetProgress(float progress); 49 | 50 | // sets the info text 51 | virtual void SetText(const char *text); 52 | 53 | // toggles visibility of the close box. 54 | virtual void SetCancelButtonVisible(bool state); 55 | 56 | // toggles the enabled state of the cancel button (for if it needs to be disabled part way through a process) 57 | virtual void SetCancelButtonEnabled(bool state); 58 | 59 | /* custom messages: 60 | 61 | "ProgressBoxCancelled" 62 | sent if the user pressed the cancel button (must be enabled & visible for this to happen) 63 | 64 | */ 65 | 66 | protected: 67 | virtual void PerformLayout(); 68 | virtual void OnClose(); 69 | virtual void OnCloseFrameButtonPressed(); 70 | virtual void ApplySchemeSettings(IScheme *pScheme); 71 | virtual void OnThink(); 72 | virtual void OnCommand(const char *command); 73 | virtual void OnTick(); 74 | 75 | // called when the update has been cancelled 76 | virtual void OnCancel(); 77 | 78 | private: 79 | MESSAGE_FUNC( OnShutdownRequest, "ShutdownRequest" ); 80 | void Init(); 81 | void UpdateTitle(); 82 | 83 | Label *m_pMessageLabel; 84 | ProgressBar *m_pProgressBar; 85 | Button *m_pCancelButton; 86 | 87 | wchar_t m_wszTitleString[128]; 88 | wchar_t m_wcsInfoString[128]; 89 | wchar_t m_wszUnknownTimeString[128]; 90 | 91 | float m_flFirstProgressUpdate; 92 | float m_flLastProgressUpdate; 93 | float m_flCurrentProgress; 94 | }; 95 | 96 | } // namespace vgui2 97 | 98 | 99 | #endif // PROGRESSBOX_H 100 | -------------------------------------------------------------------------------- /public/vgui_controls/PropertyDialog.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef PROPERTYDIALOG_H 9 | #define PROPERTYDIALOG_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | 21 | //----------------------------------------------------------------------------- 22 | // Purpose: Simple frame that holds a property sheet 23 | //----------------------------------------------------------------------------- 24 | class PropertyDialog : public Frame 25 | { 26 | DECLARE_CLASS_SIMPLE( PropertyDialog, Frame ); 27 | 28 | public: 29 | PropertyDialog(Panel *parent, const char *panelName); 30 | ~PropertyDialog(); 31 | 32 | // returns a pointer to the PropertySheet this dialog encapsulates 33 | virtual PropertySheet *GetPropertySheet(); 34 | 35 | // wrapper for PropertySheet interface 36 | virtual void AddPage(Panel *page, const char *title); 37 | virtual Panel *GetActivePage(); 38 | virtual void ResetAllData(); 39 | virtual void ApplyChanges(); 40 | 41 | // sets the text on the OK/Cancel buttons, overriding the default 42 | void SetOKButtonText(const char *text); 43 | void SetCancelButtonText(const char *text); 44 | void SetApplyButtonText(const char *text); 45 | 46 | // changes the visibility of the buttons 47 | void SetOKButtonVisible(bool state); 48 | void SetCancelButtonVisible(bool state); 49 | void SetApplyButtonVisible(bool state); 50 | 51 | /* MESSAGES SENT 52 | "ResetData" - sent when page is loaded. Data should be reloaded from document into controls. 53 | "ApplyChanges" - sent when the OK / Apply button is pressed. Changed data should be written into document. 54 | */ 55 | 56 | protected: 57 | // Called when the OK button is pressed. Simply closes the dialog. 58 | virtual bool OnOK(bool applyOnly); 59 | 60 | // called when the Cancel button is pressed 61 | virtual void OnCancel(); 62 | 63 | // vgui overrides 64 | virtual void PerformLayout(); 65 | virtual void OnCommand(const char *command); 66 | virtual void ActivateBuildMode(); 67 | virtual void OnKeyCodeTyped(KeyCode code); 68 | virtual void RequestFocus(int direction = 0); 69 | 70 | MESSAGE_FUNC( OnApplyButtonEnable, "ApplyButtonEnable" ); 71 | void EnableApplyButton(bool bEnable); 72 | 73 | private: 74 | PropertySheet *_propertySheet; 75 | Button *_okButton; 76 | Button *_cancelButton; 77 | Button *_applyButton; 78 | 79 | CPanelAnimationVar( int, m_iSheetInsetBottom, "sheetinset_bottom", "32" ); 80 | }; 81 | 82 | }; // vgui 83 | 84 | #endif // PROPERTYDIALOG_H 85 | -------------------------------------------------------------------------------- /public/vgui_controls/PropertyPage.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef PROPERTYPAGE_H 9 | #define PROPERTYPAGE_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | 21 | //----------------------------------------------------------------------------- 22 | // Purpose: Property page, as held by a set of property sheets 23 | //----------------------------------------------------------------------------- 24 | class PropertyPage : public EditablePanel 25 | { 26 | DECLARE_CLASS_SIMPLE( PropertyPage, EditablePanel ); 27 | 28 | public: 29 | PropertyPage(Panel *parent, const char *panelName); 30 | ~PropertyPage(); 31 | 32 | // Called when page is loaded. Data should be reloaded from document into controls. 33 | MESSAGE_FUNC( OnResetData, "ResetData" ); 34 | 35 | // Called when the OK / Apply button is pressed. Changed data should be written into document. 36 | MESSAGE_FUNC( OnApplyChanges, "ApplyChanges" ); 37 | 38 | // called when the page is shown/hidden 39 | MESSAGE_FUNC( OnPageShow, "PageShow" ); 40 | MESSAGE_FUNC( OnPageHide, "PageHide" ); 41 | 42 | virtual void OnKeyCodeTyped(KeyCode code); 43 | virtual bool HasUserConfigSettings() { return true; } 44 | 45 | virtual void SetVisible(bool state); 46 | 47 | protected: 48 | // called to be notified of the tab button used to Activate this page 49 | // if overridden this must be chained back to 50 | MESSAGE_FUNC_PTR( OnPageTabActivated, "PageTabActivated", panel ); 51 | 52 | private: 53 | PHandle _pageTab; 54 | }; 55 | 56 | } // namespace vgui2 57 | 58 | #endif // PROPERTYPAGE_H 59 | -------------------------------------------------------------------------------- /public/vgui_controls/QueryBox.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Creates a Message box with a question in it and yes/no buttons 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef QUERYBOX_H 9 | #define QUERYBOX_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace vgui2 20 | { 21 | 22 | //----------------------------------------------------------------------------- 23 | // Purpose: Creates A Message box with a question in it and yes/no buttons 24 | //----------------------------------------------------------------------------- 25 | class QueryBox : public MessageBox 26 | { 27 | DECLARE_CLASS_SIMPLE( QueryBox, MessageBox ); 28 | 29 | public: 30 | QueryBox(const char *title, const char *queryText,vgui2::Panel *parent = NULL ); 31 | QueryBox(const wchar_t *wszTitle, const wchar_t *wszQueryText,vgui2::Panel *parent = NULL); 32 | ~QueryBox(); 33 | 34 | // Layout the window for drawing 35 | virtual void PerformLayout(); 36 | 37 | // Set the keyvalues to send when ok button is hit 38 | void SetOKCommand(KeyValues *keyValues); 39 | 40 | // Set the keyvalues to send when the cancel button is hit 41 | void SetCancelCommand(KeyValues *keyValues); 42 | 43 | // Set the text on the Cancel button 44 | void SetCancelButtonText(const char *buttonText); 45 | void SetCancelButtonText(const wchar_t *wszButtonText); 46 | 47 | // Set a value of the ok command 48 | void SetOKCommandValue(const char *keyName, int value); 49 | 50 | protected: 51 | virtual void OnKeyCodeTyped( KeyCode code ); 52 | virtual void OnKeyCodePressed( KeyCode code ); 53 | virtual void OnCommand(const char *command); 54 | Button *m_pCancelButton; 55 | 56 | private: 57 | KeyValues *m_pCancelCommand; 58 | KeyValues *m_pOkCommand; 59 | }; 60 | 61 | } 62 | #endif // QUERYBOX_H 63 | -------------------------------------------------------------------------------- /public/vgui_controls/RotatingProgressBar.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef ROTATINGPROGRESSBAR_H 9 | #define ROTATINGPROGRESSBAR_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace vgui2 20 | { 21 | 22 | //----------------------------------------------------------------------------- 23 | // Purpose: Progress Bar that rotates an image around its center 24 | //----------------------------------------------------------------------------- 25 | class RotatingProgressBar : public ProgressBar 26 | { 27 | DECLARE_CLASS_SIMPLE( RotatingProgressBar, ProgressBar ); 28 | 29 | public: 30 | RotatingProgressBar(Panel *parent, const char *panelName); 31 | ~RotatingProgressBar(); 32 | 33 | virtual void ApplySettings(KeyValues *inResourceData); 34 | virtual void ApplySchemeSettings(IScheme *pScheme); 35 | 36 | void SetImage( const char *imageName ); 37 | 38 | protected: 39 | virtual void Paint(); 40 | virtual void PaintBackground(); 41 | virtual void OnTick(); 42 | 43 | private: 44 | int m_nTextureId; 45 | char *m_pszImageName; 46 | 47 | float m_flStartRadians; 48 | float m_flEndRadians; 49 | 50 | float m_flLastAngle; 51 | 52 | float m_flTickDelay; 53 | float m_flApproachSpeed; 54 | 55 | float m_flRotOriginX; 56 | float m_flRotOriginY; 57 | 58 | float m_flRotatingX; 59 | float m_flRotatingY; 60 | float m_flRotatingWide; 61 | float m_flRotatingTall; 62 | 63 | }; 64 | 65 | } // namespace vgui2 66 | 67 | #endif // ROTATINGPROGRESSBAR_H -------------------------------------------------------------------------------- /public/vgui_controls/ScalableImagePanel.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef SCALABLEIMAGEPANEL_H 9 | #define SCALABLEIMAGEPANEL_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | //----------------------------------------------------------------------------- 21 | // Purpose: 9-way Segmented background 22 | //----------------------------------------------------------------------------- 23 | class ScalableImagePanel : public Panel 24 | { 25 | DECLARE_CLASS_SIMPLE( ScalableImagePanel, Panel ); 26 | public: 27 | ScalableImagePanel(Panel *parent, const char *name); 28 | ~ScalableImagePanel(); 29 | 30 | virtual void SetImage(const char *imageName); 31 | void SetDrawColor( Color color ) { m_DrawColor = color; } 32 | 33 | protected: 34 | virtual void PaintBackground(); 35 | virtual void GetSettings(KeyValues *outResourceData); 36 | virtual void ApplySettings(KeyValues *inResourceData); 37 | virtual void PerformLayout( void ); 38 | virtual const char *GetDescription(); 39 | 40 | private: 41 | int m_iSrcCornerHeight; // in pixels, how tall is the corner inside the image 42 | int m_iSrcCornerWidth; // same for width 43 | int m_iCornerHeight; // output size of the corner height in pixels 44 | int m_iCornerWidth; // same for width 45 | 46 | int m_iTextureID; 47 | 48 | float m_flCornerWidthPercent; // corner width as percentage of image width 49 | float m_flCornerHeightPercent; // same for height 50 | 51 | char *m_pszImageName; 52 | 53 | char *m_pszDrawColorName; 54 | Color m_DrawColor; 55 | }; 56 | 57 | } // namespace vgui2 58 | 59 | #endif // SCALABLEIMAGEPANEL_H 60 | -------------------------------------------------------------------------------- /public/vgui_controls/ScrollBarSlider.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //===========================================================================// 7 | 8 | #ifndef SCROLLBARSLIDER_H 9 | #define SCROLLBARSLIDER_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | 21 | class IBorder; 22 | 23 | //----------------------------------------------------------------------------- 24 | // Purpose: ScrollBarSlider bar, as used in ScrollBar's 25 | //----------------------------------------------------------------------------- 26 | class ScrollBarSlider : public Panel 27 | { 28 | DECLARE_CLASS_SIMPLE( ScrollBarSlider, Panel ); 29 | 30 | public: 31 | ScrollBarSlider(Panel *parent, const char *panelName, bool vertical); 32 | 33 | // Set the ScrollBarSlider value of the nob. 34 | virtual void SetValue(int value); 35 | virtual int GetValue(); 36 | 37 | // Check whether the scroll bar is vertical or not 38 | virtual bool IsVertical(); 39 | 40 | // Set max and min range of lines to display 41 | virtual void SetRange(int min, int max); 42 | 43 | virtual void GetRange(int &min, int &max); 44 | 45 | // Set number of rows that can be displayed in window 46 | virtual void SetRangeWindow(int rangeWindow); 47 | 48 | // Get number of rows that can be displayed in window 49 | virtual int GetRangeWindow(); 50 | 51 | // Set the size of the ScrollBarSlider nob 52 | virtual void SetSize(int wide, int tall); 53 | 54 | // Get current ScrollBarSlider bounds 55 | virtual void GetNobPos(int &min, int &max); 56 | 57 | virtual bool HasFullRange(); 58 | virtual void SetButtonOffset(int buttonOffset); 59 | virtual void OnCursorMoved(int x, int y); 60 | virtual void OnMousePressed(MouseCode code); 61 | virtual void OnMouseDoublePressed(MouseCode code); 62 | virtual void OnMouseReleased(MouseCode code); 63 | 64 | // Return true if this slider is actually drawing itself 65 | virtual bool IsSliderVisible( void ); 66 | 67 | virtual void ApplySettings( KeyValues *pInResourceData ); 68 | 69 | protected: 70 | virtual void Paint(); 71 | virtual void PaintBackground(); 72 | virtual void PerformLayout(); 73 | virtual void ApplySchemeSettings(IScheme *pScheme); 74 | 75 | private: 76 | virtual void RecomputeNobPosFromValue(); 77 | virtual void RecomputeValueFromNobPos(); 78 | virtual void SendScrollBarSliderMovedMessage(); 79 | 80 | bool _vertical; 81 | bool _dragging; 82 | int _nobPos[2]; 83 | int _nobDragStartPos[2]; 84 | int _dragStartPos[2]; 85 | int _range[2]; 86 | int _value; // the position of the ScrollBarSlider, in coordinates as specified by SetRange/SetRangeWindow 87 | int _rangeWindow; 88 | int _buttonOffset; 89 | IBorder *_ScrollBarSliderBorder; 90 | }; 91 | 92 | } // namespace vgui2 93 | 94 | #endif // SCROLLBARSLIDER_H 95 | -------------------------------------------------------------------------------- /public/vgui_controls/ScrollableEditablePanel.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //============================================================================= 7 | 8 | #ifndef SCROLLABLEEDITABLEPANEL_H 9 | #define SCROLLABLEEDITABLEPANEL_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include "vgui_controls/EditablePanel.h" 16 | 17 | //----------------------------------------------------------------------------- 18 | // Forward declarations 19 | //----------------------------------------------------------------------------- 20 | namespace vgui2 21 | { 22 | class ScrollBar; 23 | } 24 | 25 | namespace vgui2 26 | { 27 | 28 | //----------------------------------------------------------------------------- 29 | // An editable panel that has a scrollbar 30 | //----------------------------------------------------------------------------- 31 | class ScrollableEditablePanel : public vgui2::EditablePanel 32 | { 33 | DECLARE_CLASS_SIMPLE( ScrollableEditablePanel, vgui2::EditablePanel ); 34 | 35 | public: 36 | ScrollableEditablePanel( vgui2::Panel *pParent, vgui2::EditablePanel *pChild, const char *pName ); 37 | virtual ~ScrollableEditablePanel() {} 38 | 39 | virtual void ApplySettings( KeyValues *pInResourceData ); 40 | virtual void PerformLayout(); 41 | 42 | vgui2::ScrollBar *GetScrollbar( void ) { return m_pScrollBar; } 43 | 44 | MESSAGE_FUNC( OnScrollBarSliderMoved, "ScrollBarSliderMoved" ); 45 | virtual void OnMouseWheeled(int delta); // respond to mouse wheel events 46 | 47 | private: 48 | vgui2::ScrollBar *m_pScrollBar; 49 | vgui2::EditablePanel *m_pChild; 50 | }; 51 | 52 | 53 | } // end namespace vgui2 54 | 55 | #endif // SCROLLABLEEDITABLEPANEL_H -------------------------------------------------------------------------------- /public/vgui_controls/Splitter.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //===========================================================================// 7 | 8 | #ifndef SPLITTER_H 9 | #define SPLITTER_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | 17 | namespace vgui2 18 | { 19 | 20 | enum SplitterMode_t 21 | { 22 | SPLITTER_MODE_HORIZONTAL = 0, 23 | SPLITTER_MODE_VERTICAL 24 | }; 25 | 26 | 27 | class SplitterHandle; 28 | class SplitterChildPanel; 29 | 30 | //----------------------------------------------------------------------------- 31 | // Purpose: Thin line used to divide sections, can be moved dragged! 32 | //----------------------------------------------------------------------------- 33 | class Splitter : public EditablePanel 34 | { 35 | DECLARE_CLASS_SIMPLE( Splitter, EditablePanel ); 36 | 37 | public: 38 | // nCount is the number of splitters to create. 39 | // NOTE: The constructor here will create (nCount+1) EditablePanel children 40 | // and name them child0...childN for .res file purposes. 41 | Splitter( Panel *parent, const char *name, SplitterMode_t mode, int nCount ); 42 | ~Splitter(); 43 | 44 | // Evenly respace all splitters 45 | void EvenlyRespaceSplitters(); 46 | 47 | // respace splitters using given fractions (must sum to 1) 48 | void RespaceSplitters( float *flFractions ); 49 | 50 | // Inherited from Panel 51 | virtual void ApplySettings(KeyValues *inResourceData); 52 | virtual void GetSettings( KeyValues *outResourceData ); 53 | virtual void PerformLayout(); 54 | virtual void OnSizeChanged(int newWide, int newTall); 55 | virtual void ApplyUserConfigSettings(KeyValues *userConfig); 56 | virtual void GetUserConfigSettings(KeyValues *userConfig); 57 | virtual bool HasUserConfigSettings() { return true; } 58 | 59 | // Sets the splitter color 60 | void SetSplitterColor( Color c ); 61 | 62 | // Enables borders on the splitters 63 | void EnableBorders( bool bEnable ); 64 | 65 | // Locks the size of a particular child in pixels. 66 | void LockChildSize( int nChildIndex, int nSize ); 67 | void UnlockChildSize( int nChildIndex ); 68 | 69 | private: 70 | void RecreateSplitters( int nCount ); 71 | 72 | struct SplitterInfo_t 73 | { 74 | SplitterChildPanel *m_pPanel; // This panel is to the left or above the handle 75 | SplitterHandle *m_pHandle; 76 | float m_flPos; 77 | bool m_bLocked; 78 | int m_nLockedSize; 79 | }; 80 | 81 | int GetPosRange(); 82 | int GetSplitterCount() const; 83 | int GetSplitterPosition( int nIndex ); 84 | void SetSplitterPosition( int nIndex, int nPos ); 85 | int GetSubPanelCount() const; 86 | int ComputeLockedSize( int nStartingIndex ); 87 | 88 | CUtlVector< SplitterInfo_t > m_Splitters; 89 | SplitterMode_t m_Mode; 90 | 91 | friend class SplitterHandle; 92 | }; 93 | 94 | 95 | } // namespace vgui2 96 | 97 | 98 | #endif // SPLITTER_H 99 | -------------------------------------------------------------------------------- /public/vgui_controls/ToggleButton.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //===========================================================================// 7 | 8 | #ifndef TOGGLEBUTTON_H 9 | #define TOGGLEBUTTON_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | 21 | //----------------------------------------------------------------------------- 22 | // Purpose: Type of button that when pressed stays selected & depressed until pressed again 23 | //----------------------------------------------------------------------------- 24 | class ToggleButton : public Button 25 | { 26 | DECLARE_CLASS_SIMPLE( ToggleButton, Button ); 27 | 28 | public: 29 | ToggleButton(Panel *parent, const char *panelName, const char *text); 30 | 31 | virtual void DoClick(); 32 | 33 | /* messages sent (get via AddActionSignalTarget()): 34 | "ButtonToggled" 35 | int "state" 36 | */ 37 | 38 | protected: 39 | // overrides 40 | virtual void OnMouseDoublePressed(MouseCode code); 41 | 42 | virtual Color GetButtonFgColor(); 43 | virtual void ApplySchemeSettings(IScheme *pScheme); 44 | 45 | virtual bool CanBeDefaultButton(void); 46 | virtual void OnKeyCodePressed(KeyCode code); 47 | 48 | private: 49 | Color _selectedColor; 50 | }; 51 | 52 | } // namespace vgui2 53 | 54 | #endif // TOGGLEBUTTON_H 55 | -------------------------------------------------------------------------------- /public/vgui_controls/ToolWindow.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | 7 | #ifndef TOOLWINDOW_H 8 | #define TOOLWINDOW_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include 14 | #include 15 | 16 | namespace vgui2 17 | { 18 | 19 | class ToolWindow; 20 | 21 | // So that an app can have a "custom" tool window class created during window drag/drop operations on the property sheet 22 | class IToolWindowFactory 23 | { 24 | public: 25 | virtual ToolWindow *InstanceToolWindow( Panel *parent, bool contextLabel, Panel *firstPage, char const *title, bool contextMenu ) = 0; 26 | }; 27 | 28 | //----------------------------------------------------------------------------- 29 | // Purpose: Simple frame that holds a property sheet 30 | //----------------------------------------------------------------------------- 31 | class ToolWindow : public Frame 32 | { 33 | DECLARE_CLASS_SIMPLE( ToolWindow, Frame ); 34 | 35 | public: 36 | ToolWindow(Panel *parent, bool contextLabel, IToolWindowFactory *factory = 0, Panel *page = NULL, char const *title = NULL, bool contextMenu = false, bool inGlobalList = true ); 37 | 38 | ~ToolWindow(); 39 | 40 | virtual bool IsDraggableTabContainer() const; 41 | 42 | // returns a pointer to the PropertySheet this dialog encapsulates 43 | PropertySheet *GetPropertySheet(); 44 | 45 | // wrapper for PropertySheet interface 46 | void AddPage(Panel *page, const char *title, bool contextMenu ); 47 | void RemovePage( Panel *page ); 48 | Panel *GetActivePage(); 49 | void SetActivePage( Panel *page ); 50 | 51 | void SetToolWindowFactory( IToolWindowFactory *factory ); 52 | IToolWindowFactory *GetToolWindowFactory(); 53 | 54 | static int GetToolWindowCount(); 55 | static ToolWindow *GetToolWindow( int index ); 56 | 57 | static CUtlVector< ToolWindow * > s_ToolWindows; 58 | 59 | virtual void Grow( int edge = 0, int from_x = -1, int from_y = -1 ); 60 | virtual void GrowFromClick(); 61 | 62 | protected: 63 | // vgui overrides 64 | virtual void PerformLayout(); 65 | virtual void ActivateBuildMode(); 66 | virtual void RequestFocus(int direction = 0); 67 | virtual void OnMousePressed(MouseCode code); 68 | virtual void OnMouseDoublePressed(MouseCode code); 69 | 70 | private: 71 | PropertySheet *m_pPropertySheet; 72 | IToolWindowFactory *m_pFactory; 73 | }; 74 | 75 | }; // vgui 76 | 77 | 78 | #endif // TOOLWINDOW_H 79 | -------------------------------------------------------------------------------- /public/vgui_controls/Tooltip.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Creates a Message box with a question in it and yes/no buttons 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef TOOLTIP_H 9 | #define TOOLTIP_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace vgui2 20 | { 21 | 22 | //----------------------------------------------------------------------------- 23 | // Purpose: Tooltip for a panel - shows text when cursor hovers over a panel 24 | //----------------------------------------------------------------------------- 25 | class BaseTooltip 26 | { 27 | public: 28 | BaseTooltip(Panel *parent, const char *text = NULL); 29 | 30 | virtual void SetText(const char *text); 31 | virtual const char *GetText(); 32 | 33 | virtual void ShowTooltip(Panel *currentPanel); 34 | virtual void HideTooltip(); 35 | 36 | bool ShouldLayout( void ); 37 | virtual void PerformLayout() { return; } 38 | virtual void PositionWindow( Panel *pTipPanel ); 39 | 40 | void ResetDelay(); 41 | void SetTooltipFormatToSingleLine(); 42 | void SetTooltipFormatToMultiLine(); 43 | void SetTooltipDelay(int tooltipDelayMilliseconds); 44 | int GetTooltipDelay(); 45 | void SetEnabled( bool bState ); 46 | 47 | private: 48 | Panel *m_pParent; 49 | virtual void ApplySchemeSettings(IScheme *pScheme) {}; 50 | protected: 51 | CUtlVector m_Text; 52 | int _delay; // delay that counts down 53 | int _tooltipDelay; // delay before tooltip comes up. 54 | bool _makeVisible : 1; 55 | bool _displayOnOneLine : 1; 56 | bool _isDirty : 1; 57 | bool _enabled : 1; 58 | }; 59 | 60 | class TextTooltip : public BaseTooltip 61 | { 62 | public: 63 | TextTooltip(Panel *parent, const char *text = NULL); 64 | ~TextTooltip(); 65 | 66 | virtual void SetText(const char *text); 67 | virtual void ShowTooltip(Panel *currentPanel); 68 | virtual void HideTooltip(); 69 | virtual void SizeTextWindow(); 70 | virtual void PerformLayout(); 71 | virtual void ApplySchemeSettings(IScheme *pScheme); 72 | }; 73 | 74 | }; 75 | 76 | #endif // TOOLTIP_H 77 | -------------------------------------------------------------------------------- /public/vgui_controls/URLLabel.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #ifndef URLLABEL_H 9 | #define URLLABEL_H 10 | 11 | #ifdef _WIN32 12 | #pragma once 13 | #endif 14 | 15 | #include 16 | #include 17 | 18 | namespace vgui2 19 | { 20 | 21 | class URLLabel : public Label 22 | { 23 | DECLARE_CLASS_SIMPLE( URLLabel, Label ); 24 | 25 | public: 26 | URLLabel(Panel *parent, const char *panelName, const char *text, const char *pszURL); 27 | URLLabel(Panel *parent, const char *panelName, const wchar_t *wszText, const char *pszURL); 28 | ~URLLabel(); 29 | 30 | void SetURL(const char *pszURL); 31 | 32 | protected: 33 | virtual void OnMousePressed(MouseCode code); 34 | virtual void ApplySettings( KeyValues *inResourceData ); 35 | virtual void GetSettings( KeyValues *outResourceData ); 36 | virtual void ApplySchemeSettings(IScheme *pScheme); 37 | virtual const char *GetDescription( void ); 38 | 39 | const char *GetURL( void ) { return m_pszURL; } 40 | 41 | private: 42 | char *m_pszURL; 43 | int m_iURLSize; 44 | bool m_bUnderline; 45 | }; 46 | 47 | } 48 | 49 | #endif // URLLABEL_H 50 | -------------------------------------------------------------------------------- /public/vgui_controls/savedocumentquery.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // This dialog asks if you want to save your work 4 | // 5 | //============================================================================= 6 | 7 | #ifndef SAVEDOCUMENTQUERY_H 8 | #define SAVEDOCUMENTQUERY_H 9 | 10 | #ifdef _WIN32 11 | #pragma once 12 | #endif 13 | 14 | 15 | //----------------------------------------------------------------------------- 16 | // Forward declarations 17 | //----------------------------------------------------------------------------- 18 | class KeyValues; 19 | namespace vgui2 20 | { 21 | class Panel; 22 | } 23 | 24 | 25 | //----------------------------------------------------------------------------- 26 | // Show the save document query dialog 27 | // NOTE: The following commands will be posted to the action signal target: 28 | // "OnExit" - when we want to quit 29 | // "OnSave" - when we want to save the file 30 | // "OnCloseNoSave" - when we want to close the file without saving it 31 | // "commandname" - additional command send after saving (SAVEDOC_POSTCOMMAND_AFTER_SAVE) 32 | // "OnMarkNotDirty" - when we want to mark the file not dirty 33 | //----------------------------------------------------------------------------- 34 | void ShowSaveDocumentQuery( vgui2::Panel *pParent, const char *pFileName, const char *pFileType, int nContext, vgui2::Panel *pActionSignalTarget, KeyValues *pPostSaveCommand ); 35 | 36 | 37 | #endif // SAVEDOCUMENTQUERY_H 38 | -------------------------------------------------------------------------------- /public/vgui_controls/subrectimage.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | 7 | #ifndef SUBRECTIMAGE_H 8 | #define SUBRECTIMAGE_H 9 | 10 | #ifdef _WIN32 11 | #pragma once 12 | #endif 13 | 14 | #include "vgui_controls/Image.h" 15 | #include "vgui/VGUI2.h" 16 | 17 | 18 | //----------------------------------------------------------------------------- 19 | // Purpose: Check box image 20 | //----------------------------------------------------------------------------- 21 | class CSubRectImage : public vgui2::Image 22 | { 23 | public: 24 | CSubRectImage( const char *filename, bool hardwareFiltered, int subx, int suby, int subw, int subh ); 25 | virtual ~CSubRectImage(); 26 | 27 | void GetSize( int &wide, int &tall ); 28 | void GetContentSize( int &wide, int &tall ); 29 | void SetSize( int x, int y ); 30 | void SetPos( int x, int y ); 31 | void SetColor( Color col ); 32 | const char *GetName(); 33 | void Paint(); 34 | void ForceUpload(); 35 | vgui2::HTexture GetID(); 36 | bool IsValid(); 37 | 38 | private: 39 | vgui2::HTexture _id; 40 | int sub[ 4 ]; 41 | char *_filename; 42 | int _pos[2]; 43 | int _wide,_tall; 44 | Color _color; 45 | bool _uploaded; 46 | bool _valid; 47 | bool _filtered; 48 | }; 49 | 50 | 51 | #endif // SUBRECTIMAGE_H -------------------------------------------------------------------------------- /public/vgui_controls/vgui_controls.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | #include "vgui/IVGui.h" 7 | #include "vgui_controls/Controls.h" 8 | 9 | #include "vgui_controls/AnimatingImagePanel.h" 10 | #include "vgui_controls/BitmapImagePanel.h" 11 | #include "vgui_controls/ExpandButton.h" 12 | #include "vgui_controls/TreeViewListControl.h" 13 | #include "vgui_controls/HTML.h" 14 | 15 | // NOTE: This has to be the last file included! 16 | #include "tier0/memdbgon.h" 17 | 18 | 19 | using namespace vgui2; 20 | 21 | USING_BUILD_FACTORY( Button ); 22 | USING_BUILD_FACTORY( EditablePanel ); 23 | USING_BUILD_FACTORY( ImagePanel ); 24 | USING_BUILD_FACTORY( Label ); 25 | USING_BUILD_FACTORY( Panel ); 26 | USING_BUILD_FACTORY( ToggleButton ); 27 | USING_BUILD_FACTORY( AnimatingImagePanel ); 28 | USING_BUILD_FACTORY( CBitmapImagePanel ); 29 | USING_BUILD_FACTORY( CheckButton ); 30 | USING_BUILD_FACTORY( ComboBox ); 31 | //USING_BUILD_FACTORY_ALIAS( CvarToggleCheckButton, CvarToggleCheckButton ); 32 | USING_BUILD_FACTORY( Divider ); 33 | USING_BUILD_FACTORY( ExpandButton ); 34 | USING_BUILD_FACTORY( GraphPanel ); 35 | //USING_BUILD_FACTORY_ALIAS( HTML, HTML_NoJavascript ); 36 | //USING_BUILD_FACTORY_ALIAS( HTML, HTML_Javascript ); 37 | USING_BUILD_FACTORY( ListPanel ); 38 | USING_BUILD_FACTORY( ListViewPanel ); 39 | USING_BUILD_FACTORY( Menu ); 40 | USING_BUILD_FACTORY( MenuBar ); 41 | USING_BUILD_FACTORY( MenuButton ); 42 | USING_BUILD_FACTORY( MenuItem ); 43 | USING_BUILD_FACTORY( MessageBox ); 44 | USING_BUILD_FACTORY( ProgressBar ); 45 | //USING_BUILD_FACTORY( CircularProgressBar ); 46 | USING_BUILD_FACTORY( RadioButton ); 47 | USING_BUILD_FACTORY( RichText ); 48 | //USING_BUILD_FACTORY( ScalableImagePanel ); 49 | USING_BUILD_FACTORY_ALIAS( ScrollBar, ScrollBar_Vertical ); 50 | USING_BUILD_FACTORY_ALIAS( ScrollBar, ScrollBar_Horizontal ); 51 | USING_BUILD_FACTORY( ScrollBar ); 52 | USING_BUILD_FACTORY( Slider ); 53 | USING_BUILD_FACTORY( TextEntry ); 54 | USING_BUILD_FACTORY( TreeView ); 55 | USING_BUILD_FACTORY( CTreeViewListControl ); 56 | USING_BUILD_FACTORY( URLLabel ); 57 | 58 | int g_nYou_Must_Add_Public_Vgui_Controls_Vgui_ControlsCpp_To_Your_Project = 0; 59 | -------------------------------------------------------------------------------- /public/vstdlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_sources( 2 | CMakeLists.txt 3 | cvar.h 4 | ICommandline.h 5 | IKeyValuesSystem.h 6 | pch_vstdlib.h 7 | random.h 8 | strtools.h 9 | vstdlib.h 10 | ) 11 | -------------------------------------------------------------------------------- /public/vstdlib/ICommandline.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vstdlib/ICommandline.h -------------------------------------------------------------------------------- /public/vstdlib/IKeyValuesSystem.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vstdlib/IKeyValuesSystem.h -------------------------------------------------------------------------------- /public/vstdlib/cvar.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vstdlib/cvar.h -------------------------------------------------------------------------------- /public/vstdlib/pch_vstdlib.h: -------------------------------------------------------------------------------- 1 | //======== (C) Copyright 1999, 2000 Valve, L.L.C. All rights reserved. ======== 2 | // 3 | // The copyright to the contents herein is the property of Valve, L.L.C. 4 | // The contents may be used and/or copied only with the written permission of 5 | // Valve, L.L.C., or in accordance with the terms and conditions stipulated in 6 | // the agreement/contract under which the contents have been supplied. 7 | // 8 | // Purpose: 9 | // 10 | // $Workfile: $ 11 | // $NoKeywords: $ 12 | //============================================================================= 13 | 14 | 15 | #pragma warning(disable: 4514) 16 | 17 | // First include standard libraries 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #ifdef POSIX 24 | #include 25 | #include 26 | #define _MAX_PATH PATH_MAX 27 | #endif 28 | 29 | // Next, include public 30 | #include "tier0/platform.h" 31 | #include "tier0/basetypes.h" 32 | #include "tier0/dbg.h" 33 | #include "tier0/valobject.h" 34 | 35 | // Next, include vstdlib 36 | #include "vstdlib/vstdlib.h" 37 | #include "vstdlib/strtools.h" 38 | #include "vstdlib/random.h" 39 | #include "tier1/keyvalues.h" 40 | #include "tier1/utlmemory.h" 41 | #include "tier1/utlrbtree.h" 42 | #include "tier1/utlvector.h" 43 | #include "tier1/utllinkedlist.h" 44 | #include "tier1/utlmultilist.h" 45 | #include "tier1/utlsymbol.h" 46 | #include "vstdlib/icommandline.h" 47 | #include "tier1/netadr.h" 48 | #include "tier1/mempool.h" 49 | #include "tier1/utlbuffer.h" 50 | #include "tier1/utlstring.h" 51 | 52 | #include "tier0/memdbgon.h" 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /public/vstdlib/random.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vstdlib/random.h -------------------------------------------------------------------------------- /public/vstdlib/strtools.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vstdlib/strtools.h -------------------------------------------------------------------------------- /public/vstdlib/vstdlib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/public/vstdlib/vstdlib.h -------------------------------------------------------------------------------- /public/winlite.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | // 7 | //=============================================================================// 8 | 9 | #ifndef WINLITE_H 10 | #define WINLITE_H 11 | #pragma once 12 | 13 | #ifdef _WIN32 14 | // 15 | // Prevent tons of unused windows definitions 16 | // 17 | #ifndef WIN32_LEAN_AND_MEAN 18 | #define WIN32_LEAN_AND_MEAN 19 | #endif 20 | #define NOWINRES 21 | #define NOSERVICE 22 | #define NOMCX 23 | #define NOIME 24 | #if !defined( _X360 ) 25 | #pragma warning(push, 1) 26 | #pragma warning(disable: 4005) 27 | #include 28 | #pragma warning(pop) 29 | #endif 30 | #undef PostMessage 31 | 32 | #pragma warning( disable: 4800 ) // forcing value to bool 'true' or 'false' (performance warning) 33 | 34 | #endif // WIN32 35 | #endif // WINLITE_H 36 | -------------------------------------------------------------------------------- /public/worldsize.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | // 7 | //=============================================================================// 8 | // worldsize.h -- extent of world and resolution/size of coordinate messages used in engine 9 | 10 | #ifndef WORLDSIZE_H 11 | #define WORLDSIZE_H 12 | #pragma once 13 | 14 | 15 | // These definitions must match the coordinate message sizes in coordsize.h 16 | 17 | // Following values should be +16384, -16384, +15/16, -15/16 18 | // NOTE THAT IF THIS GOES ANY BIGGER THEN DISK NODES/LEAVES CANNOT USE SHORTS TO STORE THE BOUNDS 19 | #define MAX_COORD_INTEGER (16384) 20 | #define MIN_COORD_INTEGER (-MAX_COORD_INTEGER) 21 | #define MAX_COORD_FRACTION (1.0-(1.0/16.0)) 22 | #define MIN_COORD_FRACTION (-1.0+(1.0/16.0)) 23 | 24 | #define MAX_COORD_FLOAT (16384.0f) 25 | #define MIN_COORD_FLOAT (-MAX_COORD_FLOAT) 26 | 27 | // Width of the coord system, which is TOO BIG to send as a client/server coordinate value 28 | #define COORD_EXTENT (2*MAX_COORD_INTEGER) 29 | 30 | // Maximum traceable distance ( assumes cubic world and trace from one corner to opposite ) 31 | // COORD_EXTENT * sqrt(3) 32 | #define MAX_TRACE_LENGTH ( 1.732050807569 * COORD_EXTENT ) 33 | 34 | // This value is the LONGEST possible range (limited by max valid coordinate number, not 2x) 35 | #define MAX_COORD_RANGE (MAX_COORD_INTEGER) 36 | 37 | #define ASSERT_COORD( v ) Assert( (v.x>=MIN_COORD_INTEGER*2) && (v.x<=MAX_COORD_INTEGER*2) && \ 38 | (v.y>=MIN_COORD_INTEGER*2) && (v.y<=MAX_COORD_INTEGER*2) && \ 39 | (v.z>=MIN_COORD_INTEGER*2) && (v.z<=MAX_COORD_INTEGER*2) ); \ 40 | 41 | 42 | #endif // WORLDSIZE_H 43 | -------------------------------------------------------------------------------- /thirdpartylegalnotices.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tmp64/hl1_source_sdk/4ee45b6cf749322e5e6734c2a3f16f6ac9726b54/thirdpartylegalnotices.txt -------------------------------------------------------------------------------- /tier1/characterset.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $Workfile: $ 6 | // $Date: $ 7 | // 8 | //----------------------------------------------------------------------------- 9 | // $Log: $ 10 | // 11 | // $NoKeywords: $ 12 | //============================================================================= 13 | 14 | #include 15 | #include "characterset.h" 16 | 17 | // memdbgon must be the last include file in a .cpp file!!! 18 | #include "tier0/memdbgon.h" 19 | 20 | //----------------------------------------------------------------------------- 21 | // Purpose: builds a simple lookup table of a group of important characters 22 | // Input : *pParseGroup - pointer to the buffer for the group 23 | // *pGroupString - null terminated list of characters to flag 24 | //----------------------------------------------------------------------------- 25 | void CharacterSetBuild( characterset_t *pSetBuffer, const char *pszSetString ) 26 | { 27 | int i = 0; 28 | 29 | // Test our pointers 30 | if ( !pSetBuffer || !pszSetString ) 31 | return; 32 | 33 | memset( pSetBuffer->set, 0, sizeof(pSetBuffer->set) ); 34 | 35 | while ( pszSetString[i] ) 36 | { 37 | pSetBuffer->set[ (unsigned)pszSetString[i] ] = 1; 38 | i++; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /tier1/processor_detect_linux.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: linux dependant ASM code for CPU capability detection 4 | // 5 | // $Workfile: $ 6 | // $NoKeywords: $ 7 | //=============================================================================// 8 | 9 | #define cpuid(in,a,b,c,d) \ 10 | asm("pushl %%ebx\n\t" "cpuid\n\t" "movl %%ebx,%%esi\n\t" "pop %%ebx": "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (in)); 11 | 12 | bool CheckMMXTechnology(void) 13 | { 14 | unsigned long eax,ebx,edx,unused; 15 | cpuid(1,eax,ebx,unused,edx); 16 | 17 | return edx & 0x800000; 18 | } 19 | 20 | bool CheckSSETechnology(void) 21 | { 22 | unsigned long eax,ebx,edx,unused; 23 | cpuid(1,eax,ebx,unused,edx); 24 | 25 | return edx & 0x2000000L; 26 | } 27 | 28 | bool CheckSSE2Technology(void) 29 | { 30 | unsigned long eax,ebx,edx,unused; 31 | cpuid(1,eax,ebx,unused,edx); 32 | 33 | return edx & 0x04000000; 34 | } 35 | 36 | bool Check3DNowTechnology(void) 37 | { 38 | unsigned long eax, unused; 39 | cpuid(0x80000000,eax,unused,unused,unused); 40 | 41 | if ( eax > 0x80000000L ) 42 | { 43 | cpuid(0x80000001,unused,unused,unused,eax); 44 | return ( eax & 1<<31 ); 45 | } 46 | return false; 47 | } 48 | -------------------------------------------------------------------------------- /tier1/rangecheckedvar.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //=============================================================================// 6 | 7 | #include "rangecheckedvar.h" 8 | 9 | // memdbgon must be the last include file in a .cpp file!!! 10 | #include "tier0/memdbgon.h" 11 | 12 | bool g_bDoRangeChecks = true; 13 | 14 | 15 | static int g_nDisables = 0; 16 | 17 | 18 | CDisableRangeChecks::CDisableRangeChecks() 19 | { 20 | if ( !ThreadInMainThread() ) 21 | return; 22 | g_nDisables++; 23 | g_bDoRangeChecks = false; 24 | } 25 | 26 | 27 | CDisableRangeChecks::~CDisableRangeChecks() 28 | { 29 | if ( !ThreadInMainThread() ) 30 | return; 31 | Assert( g_nDisables > 0 ); 32 | --g_nDisables; 33 | if ( g_nDisables == 0 ) 34 | { 35 | g_bDoRangeChecks = true; 36 | } 37 | } 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /tier1/reliabletimer.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //============================================================================= 6 | 7 | #include "tier1/reliabletimer.h" 8 | 9 | int64 CReliableTimer::sm_nPerformanceFrequency = 0; 10 | bool CReliableTimer::sm_bUseQPC = false; 11 | 12 | #ifdef _WIN32 13 | #include "winlite.h" 14 | #endif 15 | 16 | //----------------------------------------------------------------------------- 17 | // Purpose: Constructor 18 | //----------------------------------------------------------------------------- 19 | CReliableTimer::CReliableTimer() 20 | { 21 | m_nPerformanceCounterStart = 0; 22 | m_nPerformanceCounterEnd = 0; 23 | m_nPerformanceCounterLimit = 0; 24 | 25 | #ifdef _WIN32 26 | // calculate performance frequency the first time we use a timer 27 | if ( 0 == sm_nPerformanceFrequency ) 28 | { 29 | // Are we on a bad CPU? 30 | sm_bUseQPC = false; // todo 31 | const CPUInformation &cpu = GetCPUInformation(); 32 | sm_bUseQPC = ( ( 0 == Q_stricmp( cpu.m_szProcessorID, "AuthenticAMD" ) ) 33 | && ( cpu.m_nPhysicalProcessors > 1 ) ); 34 | 35 | if ( sm_bUseQPC ) 36 | { 37 | LARGE_INTEGER li; 38 | QueryPerformanceFrequency( &li ); 39 | sm_nPerformanceFrequency = li.QuadPart; 40 | } 41 | else 42 | { 43 | sm_nPerformanceFrequency = g_ClockSpeed; 44 | } 45 | } 46 | #elif defined(_PS3) 47 | // On PowerPC, the time base register increment frequency is implementation dependent, and doesn't have to be constant. 48 | // On PS3, measured it to be just shy of 80Mhz on the PPU and doesn't seem to change 49 | if ( sm_nPerformanceFrequency == 0 ) 50 | sm_nPerformanceFrequency = sys_time_get_timebase_frequency(); 51 | #else 52 | // calculate performance frequency the first time we use a timer 53 | if ( 0 == sm_nPerformanceFrequency ) 54 | { 55 | sm_nPerformanceFrequency = g_ClockSpeed; 56 | } 57 | #endif 58 | } 59 | 60 | 61 | //----------------------------------------------------------------------------- 62 | // Purpose: Returns current QueryPerformanceCounter value 63 | //----------------------------------------------------------------------------- 64 | int64 CReliableTimer::GetPerformanceCountNow() 65 | { 66 | //VPROF_BUDGET( "CReliableTimer::GetPerformanceCountNow", VPROF_BUDGETGROUP_OTHER_UNACCOUNTED ); 67 | #ifdef _WIN32 68 | if ( sm_bUseQPC ) 69 | { 70 | LARGE_INTEGER li = {0}; 71 | QueryPerformanceCounter( &li ); 72 | return li.QuadPart; 73 | } 74 | else 75 | { 76 | CCycleCount CycleCount; 77 | CycleCount.Sample(); 78 | return CycleCount.GetLongCycles(); 79 | } 80 | #elif defined( _PS3 ) 81 | // use handy macro to grab tb 82 | uint64 ulNow; 83 | SYS_TIMEBASE_GET( ulNow ); 84 | return ulNow; 85 | #else 86 | uint64 un64; 87 | __asm__ __volatile__ ( 88 | "rdtsc\n\t" 89 | : "=A" (un64) ); 90 | return (int64)un64; 91 | #endif 92 | } 93 | -------------------------------------------------------------------------------- /tier1/splitstring.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // 4 | // 5 | //================================================================================================== 6 | 7 | #include "strtools.h" 8 | #include "utlvector.h" 9 | 10 | CSplitString::CSplitString(const char *pString, const char **pSeparators, int nSeparators) 11 | { 12 | Construct(pString, pSeparators, nSeparators); 13 | }; 14 | 15 | CSplitString::CSplitString( const char *pString, const char *pSeparator) 16 | { 17 | Construct( pString, &pSeparator, 1 ); 18 | } 19 | 20 | CSplitString::~CSplitString() 21 | { 22 | if(m_szBuffer) 23 | delete [] m_szBuffer; 24 | } 25 | 26 | void CSplitString::Construct( const char *pString, const char **pSeparators, int nSeparators ) 27 | { 28 | ////////////////////////////////////////////////////////////////////////// 29 | // make a duplicate of the original string. We'll use pieces of this duplicate to tokenize the string 30 | // and create NULL-terminated tokens of the original string 31 | // 32 | int nOriginalStringLength = V_strlen(pString); 33 | m_szBuffer = new char[nOriginalStringLength + 1]; 34 | memcpy(m_szBuffer, pString, nOriginalStringLength + 1); 35 | 36 | this->Purge(); 37 | const char *pCurPos = pString; 38 | while ( 1 ) 39 | { 40 | int iFirstSeparator = -1; 41 | const char *pFirstSeparator = 0; 42 | for ( int i=0; i < nSeparators; i++ ) 43 | { 44 | const char *pTest = V_stristr( pCurPos, pSeparators[i] ); 45 | if ( pTest && (!pFirstSeparator || pTest < pFirstSeparator) ) 46 | { 47 | iFirstSeparator = i; 48 | pFirstSeparator = pTest; 49 | } 50 | } 51 | 52 | if ( pFirstSeparator ) 53 | { 54 | // Split on this separator and continue on. 55 | int separatorLen = strlen( pSeparators[iFirstSeparator] ); 56 | if ( pFirstSeparator > pCurPos ) 57 | { 58 | ////////////////////////////////////////////////////////////////////////// 59 | /// Cut the token out of the duplicate string 60 | char *pTokenInDuplicate = m_szBuffer + (pCurPos - pString); 61 | int nTokenLength = pFirstSeparator-pCurPos; 62 | Assert(nTokenLength > 0 && !memcmp(pTokenInDuplicate,pCurPos,nTokenLength)); 63 | pTokenInDuplicate[nTokenLength] = '\0'; 64 | 65 | this->AddToTail( pTokenInDuplicate /*AllocString( pCurPos, pFirstSeparator-pCurPos )*/ ); 66 | } 67 | 68 | pCurPos = pFirstSeparator + separatorLen; 69 | } 70 | else 71 | { 72 | // Copy the rest of the string 73 | int nTokenLength = strlen( pCurPos ); 74 | if ( nTokenLength ) 75 | { 76 | ////////////////////////////////////////////////////////////////////////// 77 | // There's no need to cut this token, because there's no separator after it. 78 | // just add its copy in the buffer to the tail 79 | char *pTokenInDuplicate = m_szBuffer + (pCurPos - pString); 80 | Assert(!memcmp(pTokenInDuplicate, pCurPos, nTokenLength)); 81 | 82 | this->AddToTail( pTokenInDuplicate/*AllocString( pCurPos, -1 )*/ ); 83 | } 84 | return; 85 | } 86 | } 87 | } 88 | 89 | void CSplitString::PurgeAndDeleteElements() 90 | { 91 | Purge(); 92 | } 93 | -------------------------------------------------------------------------------- /tier1/tier1.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: A higher level link library for general use in the game and tools. 4 | // 5 | //===========================================================================// 6 | 7 | #include 8 | #include "tier0/dbg.h" 9 | 10 | 11 | //----------------------------------------------------------------------------- 12 | // These tier1 libraries must be set by any users of this library. 13 | // They can be set by calling ConnectTier1Libraries or InitDefaultFileSystem. 14 | // It is hoped that setting this, and using this library will be the common mechanism for 15 | // allowing link libraries to access tier1 library interfaces 16 | //----------------------------------------------------------------------------- 17 | static bool s_bConnected = false; 18 | 19 | // for utlsortvector.h 20 | #ifndef _WIN32 21 | void *g_pUtlSortVectorQSortContext = NULL; 22 | #endif 23 | 24 | 25 | //----------------------------------------------------------------------------- 26 | // Call this to connect to all tier 1 libraries. 27 | // It's up to the caller to check the globals it cares about to see if ones are missing 28 | //----------------------------------------------------------------------------- 29 | void ConnectTier1Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount ) 30 | { 31 | // Don't connect twice.. 32 | if ( s_bConnected ) 33 | return; 34 | 35 | s_bConnected = true; 36 | 37 | for ( int i = 0; i < nFactoryCount; ++i ) 38 | { 39 | 40 | } 41 | } 42 | 43 | void DisconnectTier1Libraries() 44 | { 45 | if ( !s_bConnected ) 46 | return; 47 | 48 | s_bConnected = false; 49 | } 50 | -------------------------------------------------------------------------------- /tier1/undiff.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // UnDiff - Apply difference block 4 | // 5 | //=============================================================================// 6 | 7 | #include "tier0/platform.h" 8 | #include "tier0/dbg.h" 9 | #include "tier1/diff.h" 10 | #include "mathlib/mathlib.h" 11 | 12 | // memdbgon must be the last include file in a .cpp file!!! 13 | #include "tier0/memdbgon.h" 14 | 15 | void ApplyDiffs(uint8 const *OldBlock, uint8 const *DiffList, 16 | int OldSize, int DiffListSize, int &ResultListSize,uint8 *Output,uint32 OutSize) 17 | { 18 | uint8 const *copy_src=OldBlock; 19 | uint8 const *end_of_diff_list=DiffList+DiffListSize; 20 | uint8 const *obuf=Output; 21 | while(DiffList32767) 30 | copy_ofs|=0xffff0000; 31 | // printf("long cp from %x to %x len=%d\n", copy_src+copy_ofs-OldBlock,Output-obuf,copy_sz); 32 | 33 | memcpy(Output,copy_src+copy_ofs,copy_sz); 34 | Output+=copy_sz; 35 | copy_src=copy_src+copy_ofs+copy_sz; 36 | DiffList+=4; 37 | } 38 | else 39 | { 40 | if (op & 0x80) 41 | { 42 | int copy_sz=op & 0x7f; 43 | int copy_ofs; 44 | if (copy_sz==0) 45 | { 46 | copy_sz=DiffList[0]; 47 | if (copy_sz==0) 48 | { 49 | // big raw copy 50 | copy_sz=DiffList[1]+256*DiffList[2]+65536*DiffList[3]; 51 | memcpy(Output,DiffList+4,copy_sz); 52 | // printf("big rawcopy to %x len=%d\n", Output-obuf,copy_sz); 53 | 54 | DiffList+=copy_sz+4; 55 | Output+=copy_sz; 56 | } 57 | else 58 | { 59 | copy_ofs=DiffList[1]+(DiffList[2]*256); 60 | if (copy_ofs>32767) 61 | copy_ofs|=0xffff0000; 62 | // printf("long ofs cp from %x to %x len=%d\n", copy_src+copy_ofs-OldBlock,Output-obuf,copy_sz); 63 | 64 | memcpy(Output,copy_src+copy_ofs,copy_sz); 65 | Output+=copy_sz; 66 | copy_src=copy_src+copy_ofs+copy_sz; 67 | DiffList+=3; 68 | } 69 | } 70 | else 71 | { 72 | copy_ofs=DiffList[0]; 73 | if (copy_ofs>127) 74 | copy_ofs|=0xffffff80; 75 | // printf("cp from %x to %x len=%d\n", copy_src+copy_ofs-OldBlock,Output-obuf,copy_sz); 76 | 77 | memcpy(Output,copy_src+copy_ofs,copy_sz); 78 | Output+=copy_sz; 79 | copy_src=copy_src+copy_ofs+copy_sz; 80 | DiffList++; 81 | } 82 | } 83 | else 84 | { 85 | // printf("raw copy %d to %x\n",op & 127,Output-obuf); 86 | memcpy(Output,DiffList,op & 127); 87 | Output+=op & 127; 88 | DiffList+=(op & 127); 89 | } 90 | } 91 | } 92 | ResultListSize=Output-obuf; 93 | 94 | } 95 | -------------------------------------------------------------------------------- /tier2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set( TIER2_HEADER_FILES 2 | ${SOURCE_SDK_ROOT}/public/tier2/tier2.h 3 | KeyValuesCompat.h 4 | ) 5 | 6 | set( TIER2_SOURCE_FILES 7 | KeyValuesCompat.cpp 8 | steam_api.cpp 9 | tier2.cpp 10 | ) 11 | 12 | add_library( tier2 STATIC 13 | ${TIER2_HEADER_FILES} 14 | ${TIER2_SOURCE_FILES} 15 | ) 16 | 17 | source_sdk_check_winxp_support( tier2 ) 18 | 19 | target_include_directories( tier2 PRIVATE 20 | ${SOURCE_SDK_INCLUDE_PATHS} 21 | ) 22 | 23 | target_compile_definitions( tier2 PRIVATE 24 | ${SOURCE_SDK_DEFINES} 25 | ) 26 | 27 | set_target_properties( tier2 PROPERTIES 28 | COMPILE_FLAGS "${SOURCE_SDK_WARNING_LEVEL}" 29 | ) 30 | -------------------------------------------------------------------------------- /tier2/KeyValuesCompat.h: -------------------------------------------------------------------------------- 1 | #ifndef GAME_CLIENT_KEYVALUESCOMPAT_H 2 | #define GAME_CLIENT_KEYVALUESCOMPAT_H 3 | 4 | #include "interface.h" 5 | 6 | /** 7 | * Initializes the KeyValuesSystem accessor. 8 | * @return Whether initialization succeeded. 9 | */ 10 | bool KV_InitKeyValuesSystem( CreateInterfaceFn* pFactories, int iNumFactories ); 11 | 12 | #endif //GAME_CLIENT_KEYVALUESCOMPAT_H 13 | -------------------------------------------------------------------------------- /vgui2/src/vgui_key_translation.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //===========================================================================// 6 | 7 | #if defined( WIN32 ) && !defined( _X360 ) 8 | #undef ARRAYSIZE 9 | #include 10 | #include 11 | #include "xbox/xboxstubs.h" 12 | #endif 13 | #include "tier0/dbg.h" 14 | #include "vgui_key_translation.h" 15 | #if defined( _X360 ) 16 | #include "xbox/xbox_win32stubs.h" 17 | #endif 18 | #ifdef POSIX 19 | #define VK_RETURN -1 20 | #endif 21 | 22 | #include "tier2/tier2.h" 23 | #include "vgui/ISystem.h" 24 | 25 | // memdbgon must be the last include file in a .cpp file!!! 26 | #include "tier0/memdbgon.h" 27 | 28 | vgui2::KeyCode KeyCode_VirtualKeyToVGUI( int key ) 29 | { 30 | // Some tools load vgui for localization and never use input 31 | if ( !g_pVGuiSystem) 32 | return vgui2::KEY_NONE; 33 | return g_pVGuiSystem->KeyCode_VirtualKeyToVGUI( key ); 34 | } 35 | 36 | int KeyCode_VGUIToVirtualKey( vgui2::KeyCode code ) 37 | { 38 | // Some tools load vgui for localization and never use input 39 | if ( !g_pVGuiSystem) 40 | return VK_RETURN; 41 | 42 | return g_pVGuiSystem->KeyCode_VirtualKeyToVGUI( code ); 43 | } 44 | -------------------------------------------------------------------------------- /vgui2/src/vgui_key_translation.h: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | //===========================================================================// 6 | 7 | #ifndef VGUI_KEY_TRANSLATION_H 8 | #define VGUI_KEY_TRANSLATION_H 9 | #ifdef _WIN32 10 | #pragma once 11 | #endif 12 | 13 | #include 14 | 15 | // Convert from Windows scan codes to VGUI key codes. 16 | vgui2::KeyCode KeyCode_VirtualKeyToVGUI( int key ); 17 | int KeyCode_VGUIToVirtualKey( vgui2::KeyCode keycode ); 18 | 19 | 20 | #endif // VGUI_KEY_TRANSLATION_H 21 | -------------------------------------------------------------------------------- /vgui2/vgui_controls/BuildFactoryHelper.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: Helper for the CHudElement class to add themselves to the list of hud elements 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | #include "vgui/IVGui.h" 8 | #include "vgui_controls/MessageMap.h" 9 | 10 | // memdbgon must be the last include file in a .cpp file!!! 11 | #include "tier0/memdbgon.h" 12 | 13 | using namespace vgui2; 14 | 15 | // Start with empty list 16 | CBuildFactoryHelper *CBuildFactoryHelper::m_sHelpers = NULL; 17 | 18 | //----------------------------------------------------------------------------- 19 | // Purpose: Constructs a panel factory 20 | // Input : pfnCreate - fn Ptr to a function which generates a panel 21 | //----------------------------------------------------------------------------- 22 | CBuildFactoryHelper::CBuildFactoryHelper( char const *className, PANELCREATEFUNC func ) 23 | { 24 | // Make this fatal 25 | if ( HasFactory( className ) ) 26 | { 27 | Error( "CBuildFactoryHelper: Factory for '%s' already exists!!!!\n", className ); 28 | } 29 | 30 | //List is empty, or element belongs at front, insert here 31 | m_pNext = m_sHelpers; 32 | m_sHelpers = this; 33 | 34 | Assert( func ); 35 | m_CreateFunc = func; 36 | Assert( className ); 37 | m_pClassName = className; 38 | } 39 | 40 | //----------------------------------------------------------------------------- 41 | // Purpose: Returns next object in list 42 | // Output : CBuildFactoryHelper 43 | //----------------------------------------------------------------------------- 44 | CBuildFactoryHelper *CBuildFactoryHelper::GetNext( void ) 45 | { 46 | return m_pNext; 47 | } 48 | 49 | char const *CBuildFactoryHelper::GetClassName() const 50 | { 51 | return m_pClassName; 52 | } 53 | 54 | vgui2::Panel *CBuildFactoryHelper::CreatePanel() 55 | { 56 | if ( !m_CreateFunc ) 57 | return NULL; 58 | 59 | return ( *m_CreateFunc )(); 60 | } 61 | 62 | // private static meethod 63 | bool CBuildFactoryHelper::HasFactory( char const *className ) 64 | { 65 | CBuildFactoryHelper *p = m_sHelpers; 66 | while ( p ) 67 | { 68 | if ( !Q_stricmp( className, p->GetClassName() ) ) 69 | return true; 70 | 71 | p = p->GetNext(); 72 | } 73 | return false; 74 | } 75 | 76 | // static method 77 | vgui2::Panel *CBuildFactoryHelper::InstancePanel( char const *className ) 78 | { 79 | CBuildFactoryHelper *p = m_sHelpers; 80 | while ( p ) 81 | { 82 | if ( !Q_stricmp( className, p->GetClassName() ) ) 83 | return p->CreatePanel(); 84 | 85 | p = p->GetNext(); 86 | } 87 | return NULL; 88 | } 89 | 90 | // static method 91 | void CBuildFactoryHelper::GetFactoryNames( CUtlVector< char const * >& list ) 92 | { 93 | list.RemoveAll(); 94 | 95 | CBuildFactoryHelper *p = m_sHelpers; 96 | while ( p ) 97 | { 98 | list.AddToTail( p->GetClassName() ); 99 | p = p->GetNext(); 100 | } 101 | } 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /vgui2/vgui_controls/Divider.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #include 9 | 10 | #include 11 | 12 | // memdbgon must be the last include file in a .cpp file!!! 13 | #include "tier0/memdbgon.h" 14 | 15 | using namespace vgui2; 16 | 17 | DECLARE_BUILD_FACTORY( Divider ); 18 | 19 | //----------------------------------------------------------------------------- 20 | // Purpose: Constructor 21 | //----------------------------------------------------------------------------- 22 | Divider::Divider(Panel *parent, const char *name) : Panel(parent, name) 23 | { 24 | SetSize(128, 2); 25 | } 26 | 27 | //----------------------------------------------------------------------------- 28 | // Purpose: Destructor 29 | //----------------------------------------------------------------------------- 30 | Divider::~Divider() 31 | { 32 | } 33 | 34 | //----------------------------------------------------------------------------- 35 | // Purpose: sets up the border as the line to draw as a divider 36 | //----------------------------------------------------------------------------- 37 | void Divider::ApplySchemeSettings(IScheme *pScheme) 38 | { 39 | SetBorder(pScheme->GetBorder("ButtonDepressedBorder")); 40 | BaseClass::ApplySchemeSettings(pScheme); 41 | } 42 | -------------------------------------------------------------------------------- /vgui2/vgui_controls/KeyRepeat.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #include "vgui_controls/pch_vgui_controls.h" 9 | #include 10 | 11 | // memdbgon must be the last include file in a .cpp file 12 | #include "tier0/memdbgon.h" 13 | 14 | using namespace vgui2; 15 | 16 | vgui2::KeyCode g_iCodesForAliases[FM_NUM_KEYREPEAT_ALIASES] = 17 | { 18 | KEY_XBUTTON_UP, 19 | KEY_XBUTTON_DOWN, 20 | KEY_XBUTTON_LEFT, 21 | KEY_XBUTTON_RIGHT, 22 | }; 23 | 24 | //----------------------------------------------------------------------------- 25 | // Purpose: 26 | //----------------------------------------------------------------------------- 27 | void CKeyRepeatHandler::KeyDown( vgui2::KeyCode code ) 28 | { 29 | int iIndex = GetIndexForCode(code); 30 | if ( iIndex == -1 ) 31 | return; 32 | 33 | if ( m_bAliasDown[ iIndex ] ) 34 | return; 35 | 36 | Reset(); 37 | m_bAliasDown[ iIndex ] = true; 38 | m_flNextKeyRepeat = system()->GetCurrentTime() + 0.4; 39 | m_bHaveKeyDown = true; 40 | } 41 | 42 | //----------------------------------------------------------------------------- 43 | // Purpose: 44 | //----------------------------------------------------------------------------- 45 | void CKeyRepeatHandler::KeyUp( vgui2::KeyCode code ) 46 | { 47 | int iIndex = GetIndexForCode(code); 48 | if ( iIndex == -1 ) 49 | return; 50 | 51 | m_bAliasDown[ GetIndexForCode(code) ] = false; 52 | 53 | m_bHaveKeyDown = false; 54 | for ( int i = 0; i < FM_NUM_KEYREPEAT_ALIASES; i++ ) 55 | { 56 | if ( m_bAliasDown[i] ) 57 | { 58 | m_bHaveKeyDown = true; 59 | break; 60 | } 61 | } 62 | } 63 | 64 | //----------------------------------------------------------------------------- 65 | // Purpose: 66 | //----------------------------------------------------------------------------- 67 | vgui2::KeyCode CKeyRepeatHandler::KeyRepeated( void ) 68 | { 69 | if ( IsPC() ) 70 | return BUTTON_CODE_NONE; 71 | 72 | if ( !m_bHaveKeyDown ) 73 | return BUTTON_CODE_NONE; 74 | 75 | if ( m_flNextKeyRepeat < system()->GetCurrentTime() ) 76 | { 77 | for ( int i = 0; i < FM_NUM_KEYREPEAT_ALIASES; i++ ) 78 | { 79 | if ( m_bAliasDown[i] ) 80 | { 81 | m_flNextKeyRepeat = system()->GetCurrentTime() + m_flRepeatTimes[i]; 82 | return g_iCodesForAliases[i]; 83 | } 84 | } 85 | } 86 | 87 | return BUTTON_CODE_NONE; 88 | } 89 | 90 | //----------------------------------------------------------------------------- 91 | // Purpose: 92 | //----------------------------------------------------------------------------- 93 | void CKeyRepeatHandler::SetKeyRepeatTime( vgui2::KeyCode code, float flRepeat ) 94 | { 95 | int iIndex = GetIndexForCode(code); 96 | Assert( iIndex != -1 ); 97 | m_flRepeatTimes[ iIndex ] = flRepeat; 98 | } -------------------------------------------------------------------------------- /vgui2/vgui_controls/ScrollableEditablePanel.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //============================================================================= 7 | 8 | #include "vgui_controls/ScrollableEditablePanel.h" 9 | #include "vgui_controls/ScrollBar.h" 10 | #include "vgui_controls/ScrollBarSlider.h" 11 | #include "vgui_controls/Button.h" 12 | #include "KeyValues.h" 13 | 14 | // NOTE: This has to be the last file included! 15 | #include "tier0/memdbgon.h" 16 | 17 | 18 | using namespace vgui2; 19 | 20 | ScrollableEditablePanel::ScrollableEditablePanel( vgui2::Panel *pParent, vgui2::EditablePanel *pChild, const char *pName ) : 21 | BaseClass( pParent, pName ) 22 | { 23 | m_pChild = pChild; 24 | m_pChild->SetParent( this ); 25 | 26 | m_pScrollBar = new vgui2::ScrollBar( this, "VerticalScrollBar", true ); 27 | m_pScrollBar->SetWide( 16 ); 28 | m_pScrollBar->SetAutoResize( PIN_TOPRIGHT, AUTORESIZE_DOWN, 0, 0, -16, 0 ); 29 | m_pScrollBar->AddActionSignalTarget( this ); 30 | } 31 | 32 | void ScrollableEditablePanel::ApplySettings( KeyValues *pInResourceData ) 33 | { 34 | BaseClass::ApplySettings( pInResourceData ); 35 | 36 | KeyValues *pScrollbarKV = pInResourceData->FindKey( "Scrollbar" ); 37 | if ( pScrollbarKV ) 38 | { 39 | m_pScrollBar->ApplySettings( pScrollbarKV ); 40 | } 41 | } 42 | 43 | void ScrollableEditablePanel::PerformLayout() 44 | { 45 | BaseClass::PerformLayout(); 46 | 47 | m_pChild->SetWide( GetWide() - m_pScrollBar->GetWide() ); 48 | m_pScrollBar->SetRange( 0, m_pChild->GetTall() ); 49 | m_pScrollBar->SetRangeWindow( GetTall() ); 50 | 51 | if ( m_pScrollBar->GetSlider() ) 52 | { 53 | m_pScrollBar->GetSlider()->SetFgColor( GetFgColor() ); 54 | } 55 | if ( m_pScrollBar->GetButton(0) ) 56 | { 57 | m_pScrollBar->GetButton(0)->SetFgColor( GetFgColor() ); 58 | } 59 | if ( m_pScrollBar->GetButton(1) ) 60 | { 61 | m_pScrollBar->GetButton(1)->SetFgColor( GetFgColor() ); 62 | } 63 | } 64 | 65 | 66 | //----------------------------------------------------------------------------- 67 | // Called when the scroll bar moves 68 | //----------------------------------------------------------------------------- 69 | void ScrollableEditablePanel::OnScrollBarSliderMoved() 70 | { 71 | InvalidateLayout(); 72 | 73 | int nScrollAmount = m_pScrollBar->GetValue(); 74 | m_pChild->SetPos( 0, -nScrollAmount ); 75 | } 76 | 77 | //----------------------------------------------------------------------------- 78 | // respond to mouse wheel events 79 | //----------------------------------------------------------------------------- 80 | void ScrollableEditablePanel::OnMouseWheeled(int delta) 81 | { 82 | int val = m_pScrollBar->GetValue(); 83 | val -= (delta * 50); 84 | m_pScrollBar->SetValue( val ); 85 | } 86 | 87 | -------------------------------------------------------------------------------- /vgui2/vgui_controls/cvartogglecheckbutton.cpp: -------------------------------------------------------------------------------- 1 | //========= Copyright Valve Corporation, All rights reserved. ============// 2 | // 3 | // Purpose: 4 | // 5 | // $NoKeywords: $ 6 | //=============================================================================// 7 | 8 | #include "tier1/KeyValues.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | // memdbgon must be the last include file in a .cpp file!!! 15 | #include 16 | 17 | using namespace vgui2; 18 | 19 | vgui2::Panel *Create_CvarToggleCheckButton() 20 | { 21 | return new CvarToggleCheckButton< ConVarRef >( NULL, NULL ); 22 | } 23 | 24 | DECLARE_BUILD_FACTORY_CUSTOM_ALIAS( CvarToggleCheckButton, CvarToggleCheckButton, Create_CvarToggleCheckButton ); 25 | 26 | --------------------------------------------------------------------------------