Browse Source

WIP: fix compilation issues

aswarm
nillerusr 8 months ago
parent
commit
91a76f2a13
  1. 38
      game/public/game/client/IGameClientExports.h
  2. 41
      game/public/game/client/iclientrendertargets.h
  3. 68
      game/public/game/client/iviewport.h
  4. 198
      game/public/game/server/iplayerinfo.h
  5. 2
      game/server/ai_behavior.h
  6. 2
      game/server/ai_expresserfollowup.cpp
  7. 1
      game/server/nav_mesh.h
  8. 3
      game/server/wscript
  9. 4
      game/shared/env_wind_shared.cpp
  10. 4
      game/shared/physics_saverestore.h
  11. 16
      game/shared/saverestore_utlvector.h
  12. 2
      game/shared/soundenvelope.h
  13. 2
      game/shared/util_shared.h
  14. 306
      interfaces/interfaces.cpp
  15. 21
      interfaces/interfaces.vpc
  16. 1
      interfaces/vsi.nul
  17. 48
      interfaces/wscript
  18. 2
      public/appframework/IAppSystem.h
  19. 7
      public/const.h
  20. 6
      public/dt_send.cpp
  21. 1
      public/dt_send.h
  22. 300
      public/interfaces/interfaces.h
  23. 8
      public/mathlib/mathlib.h
  24. 61
      public/responserules/response_host_interface.h
  25. 418
      public/responserules/response_types.h
  26. 57
      public/responserules/rr_speechconcept.h
  27. 65
      public/tier2/interval.h
  28. 3
      wscript

38
game/public/game/client/IGameClientExports.h

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef IGAMECLIENTEXPORTS_H
#define IGAMECLIENTEXPORTS_H
#ifdef _WIN32
#pragma once
#endif
#include "interface.h"
//-----------------------------------------------------------------------------
// Purpose: Exports a set of functions for the GameUI interface to interact with the game client
//-----------------------------------------------------------------------------
abstract_class IGameClientExports : public IBaseInterface
{
public:
// ingame voice manipulation
virtual bool IsPlayerGameVoiceMuted(int playerIndex) = 0;
virtual void MutePlayerGameVoice(int playerIndex) = 0;
virtual void UnmutePlayerGameVoice(int playerIndex) = 0;
// notification of gameui state changes
virtual void OnGameUIActivated() = 0;
virtual void OnGameUIHidden() = 0;
// if true, the gameui applies the blur effect
virtual bool ClientWantsBlurEffect( void ) = 0;
};
#define GAMECLIENTEXPORTS_INTERFACE_VERSION "GameClientExports001"
#endif // IGAMECLIENTEXPORTS_H

41
game/public/game/client/iclientrendertargets.h

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Exposes interfaces to the engine which allow the client to setup their own render targets
// during the proper period of material system's init.
//
// $NoKeywords: $
//=============================================================================//
#ifndef ICLIENTRENDERTARGETS_H
#define ICLIENTRENDERTARGETS_H
#ifdef _WIN32
#pragma once
#endif
#include "interface.h" // For base interface
class IMaterialSystem;
class IMaterialSystemHardwareConfig;
//---------------------------------------------------------------------------------------------------
// Purpose: Exposes interfaces to the engine which allow the client to setup their own render targets
// during the proper period of material system's init.
//---------------------------------------------------------------------------------------------------
abstract_class IClientRenderTargets
{
public:
// Pass the material system interface to the client-- Their Material System singleton has not been created
// at the time they receive this call.
virtual void InitClientRenderTargets( IMaterialSystem* pMaterialSystem, IMaterialSystemHardwareConfig* pHardwareConfig ) = 0;
// Call shutdown on every created refrence-- Clients keep track of this themselves
// and should add shutdown code to this function whenever they add a new render target.
virtual void ShutdownClientRenderTargets( void ) = 0;
};
#define CLIENTRENDERTARGETS_INTERFACE_VERSION "ClientRenderTargets001"
extern IClientRenderTargets * g_pClientRenderTargets;
#endif // ICLIENTRENDERTARGETS_H

68
game/public/game/client/iviewport.h

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#if !defined( IVIEWPORT_H )
#define IVIEWPORT_H
#ifdef _WIN32
#pragma once
#endif
#include <vgui/VGUI.h>
#include "viewport_panel_names.h"
class KeyValues;
abstract_class IViewPortPanel
{
public:
virtual ~IViewPortPanel() {};
virtual const char *GetName( void ) = 0;// return identifer name
virtual void SetData(KeyValues *data) = 0; // set ViewPortPanel data
virtual void Reset( void ) = 0; // clears internal state, deactivates it
virtual void Update( void ) = 0; // updates all (size, position, content, etc)
virtual bool NeedsUpdate( void ) = 0; // query panel if content needs to be updated
virtual bool HasInputElements( void ) = 0; // true if panel contains elments which accepts input
virtual void ReloadScheme( void ) {}
virtual bool CanReplace( const char *panelName ) const { return true; } // returns true if this panel can appear on top of the given panel
virtual bool CanBeReopened( void ) const { return true; } // returns true if this panel can be re-opened after being hidden by another panel
virtual void ShowPanel( bool state ) = 0; // activate VGUI Frame
// VGUI functions:
virtual vgui::VPANEL GetVPanel( void ) = 0; // returns VGUI panel handle
virtual bool IsVisible() = 0; // true if panel is visible
virtual void SetParent( vgui::VPANEL parent ) = 0;
virtual bool WantsBackgroundBlurred( void ) = 0;
};
abstract_class IViewPort
{
public:
virtual void UpdateAllPanels( void ) = 0;
virtual void ShowPanel( const char *pName, bool state, KeyValues *data, bool autoDeleteData = true ) = 0;
virtual void ShowPanel( const char *pName, bool state ) = 0;
virtual void ShowPanel( IViewPortPanel* pPanel, bool state ) = 0;
virtual void ShowBackGround(bool bShow) = 0;
virtual IViewPortPanel* FindPanelByName(const char *szPanelName) = 0;
virtual IViewPortPanel* GetActivePanel( void ) = 0;
virtual void RecreatePanel( const char *szPanelName ) = 0;
virtual void PostMessageToPanel( const char *pName, KeyValues *pKeyValues ) = 0;
};
extern IViewPort *GetViewPortInterface();
extern IViewPort *GetFullscreenViewPortInterface();
#endif // IVIEWPORT_H

198
game/public/game/server/iplayerinfo.h

@ -0,0 +1,198 @@ @@ -0,0 +1,198 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: provides an interface for dlls to query information about players from the game dll
//
//=============================================================================//
#ifndef IPLAYERINFO_H
#define IPLAYERINFO_H
#ifdef _WIN32
#pragma once
#endif
#include "mathlib/vector.h"
// helper class for user commands
class CBotCmd
{
public:
CBotCmd()
{
Reset();
}
virtual ~CBotCmd() { };
void Reset()
{
command_number = 0;
tick_count = 0;
viewangles.Init();
forwardmove = 0.0f;
sidemove = 0.0f;
upmove = 0.0f;
buttons = 0;
impulse = 0;
weaponselect = 0;
weaponsubtype = 0;
random_seed = 0;
mousedx = 0;
mousedy = 0;
hasbeenpredicted = false;
}
CBotCmd& operator =( const CBotCmd& src )
{
if ( this == &src )
return *this;
command_number = src.command_number;
tick_count = src.tick_count;
viewangles = src.viewangles;
forwardmove = src.forwardmove;
sidemove = src.sidemove;
upmove = src.upmove;
buttons = src.buttons;
impulse = src.impulse;
weaponselect = src.weaponselect;
weaponsubtype = src.weaponsubtype;
random_seed = src.random_seed;
mousedx = src.mousedx;
mousedy = src.mousedy;
hasbeenpredicted = src.hasbeenpredicted;
return *this;
}
// For matching server and client commands for debugging
int command_number;
// the tick the client created this command
int tick_count;
// Player instantaneous view angles.
QAngle viewangles;
// Intended velocities
// forward velocity.
float forwardmove;
// sideways velocity.
float sidemove;
// upward velocity.
float upmove;
// Attack button states
int buttons;
// Impulse command issued.
byte impulse;
// Current weapon id
int weaponselect;
int weaponsubtype;
int random_seed; // For shared random functions
short mousedx; // mouse accum in x from create move
short mousedy; // mouse accum in y from create move
// Client only, tracks whether we've predicted this command at least once
bool hasbeenpredicted;
};
abstract_class IPlayerInfo
{
public:
// returns the players name (UTF-8 encoded)
virtual const char *GetName() = 0;
// returns the userid (slot number)
virtual int GetUserID() = 0;
// returns the string of their network (i.e Steam) ID
virtual const char *GetNetworkIDString() = 0;
// returns the team the player is on
virtual int GetTeamIndex() = 0;
// changes the player to a new team (if the game dll logic allows it)
virtual void ChangeTeam( int iTeamNum ) = 0;
// returns the number of kills this player has (exact meaning is mod dependent)
virtual int GetFragCount() = 0;
// returns the number of deaths this player has (exact meaning is mod dependent)
virtual int GetDeathCount() = 0;
// returns if this player slot is actually valid
virtual bool IsConnected() = 0;
// returns the armor/health of the player (exact meaning is mod dependent)
virtual int GetArmorValue() = 0;
// extensions added to V2
// various player flags
virtual bool IsHLTV() = 0;
#if defined( REPLAY_ENABLED )
virtual bool IsReplay() = 0;
#endif
virtual bool IsPlayer() = 0;
virtual bool IsFakeClient() = 0;
virtual bool IsDead() = 0;
virtual bool IsInAVehicle() = 0;
virtual bool IsObserver() = 0;
// player position and size
virtual const Vector GetAbsOrigin() = 0;
virtual const QAngle GetAbsAngles() = 0;
virtual const Vector GetPlayerMins() = 0;
virtual const Vector GetPlayerMaxs() = 0;
// the name of the weapon currently being carried
virtual const char *GetWeaponName() = 0;
// the name of the player model in use
virtual const char *GetModelName() = 0;
// current player health
virtual const int GetHealth() = 0;
// max health value
virtual const int GetMaxHealth() = 0;
// the last user input from this player
virtual CBotCmd GetLastUserCommand() = 0;
};
#define INTERFACEVERSION_PLAYERINFOMANAGER "PlayerInfoManager002"
abstract_class IPlayerInfoManager
{
public:
virtual IPlayerInfo *GetPlayerInfo( edict_t *pEdict ) = 0;
virtual CGlobalVars *GetGlobalVars() = 0;
};
abstract_class IBotController
{
public:
// change the bots position
virtual void SetAbsOrigin( Vector & vec ) = 0;
virtual void SetAbsAngles( QAngle & ang ) = 0;
virtual void SetLocalOrigin( const Vector& origin ) = 0;
virtual const Vector GetLocalOrigin( void ) = 0;
virtual void SetLocalAngles( const QAngle& angles ) = 0;
virtual const QAngle GetLocalAngles( void ) = 0;
// strip them of weapons, etc
virtual void RemoveAllItems( bool removeSuit ) = 0;
// give them a weapon
virtual void SetActiveWeapon( const char *WeaponName ) = 0;
// called after running a move command
virtual void PostClientMessagesSent( void ) = 0;
// check various effect flags
virtual bool IsEFlagSet( int nEFlagMask ) = 0;
// fire a virtual move command to the bot
virtual void RunPlayerMove( CBotCmd *ucmd ) = 0;
};
#define INTERFACEVERSION_PLAYERBOTMANAGER "BotManager001"
abstract_class IBotManager
{
public:
virtual IBotController *GetBotController( edict_t *pEdict ) = 0;
// create a new bot and spawn it into the server
virtual edict_t *CreateBot( const char *botname ) = 0;
};
#endif // IPLAYERINFO_H

2
game/server/ai_behavior.h

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
#include "ai_component.h"
#include "ai_basenpc.h"
#include "ai_default.h"
#include "AI_Criteria.h"
#include "ai_criteria.h"
#include "networkvar.h"
#include "delegates.h"
#include "tier1/utlvector.h"

2
game/server/ai_expresserfollowup.cpp

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
#include "basemultiplayerplayer.h"
#include "ai_baseactor.h"
//#include "flex_expresser.h"
#include "scenefilecache/iscenefilecache.h"
#include "scenefilecache/ISceneFileCache.h"
/*
#include "engine/ienginesound.h"
#include "keyvalues.h"

1
game/server/nav_mesh.h

@ -198,7 +198,6 @@ public: @@ -198,7 +198,6 @@ public:
unsigned int operator()( const NavVisPair_t &item ) const
{
COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 4 );
int key[2] = { (int)item.pAreas[0] + item.pAreas[1]->GetID(), (int)item.pAreas[1] + item.pAreas[0]->GetID() };
return Hash8( key );
}

3
game/server/wscript

@ -43,6 +43,7 @@ def build(bld): @@ -43,6 +43,7 @@ def build(bld):
includes = [
'.',
'../public',
'../shared',
'../../utils/common',
'../shared/econ',
@ -50,7 +51,7 @@ def build(bld): @@ -50,7 +51,7 @@ def build(bld):
'../../common',
'../../public/tier0',
'../../public/tier1',
'../../public'
'../../public',
]
defines = []

4
game/shared/env_wind_shared.cpp

@ -67,8 +67,8 @@ @@ -67,8 +67,8 @@
#include "cbase.h"
#include "env_wind_shared.h"
#include "soundenvelope.h"
#include "ieffects.h"
#include "engine/ienginesound.h"
#include "IEffects.h"
#include "engine/IEngineSound.h"
#include "sharedinterface.h"
#include "renderparm.h"

4
game/shared/physics_saverestore.h

@ -26,10 +26,10 @@ ISaveRestoreOps *GetPhysObjSaveRestoreOps( PhysInterfaceId_t ); @@ -26,10 +26,10 @@ ISaveRestoreOps *GetPhysObjSaveRestoreOps( PhysInterfaceId_t );
//-------------------------------------
#define DEFINE_PHYSPTR(name) \
{ FIELD_CUSTOM, #name, offsetof(classNameTypedef,name), 1, FTYPEDESC_SAVE, NULL, GetPhysObjSaveRestoreOps( GetPhysIID( &(((classNameTypedef *)0)->name) ) ), NULL }
{ FIELD_CUSTOM, #name, {offsetof(classNameTypedef,name), 0}, 1, FTYPEDESC_SAVE, NULL, GetPhysObjSaveRestoreOps( GetPhysIID( &(((classNameTypedef *)0)->name) ) ), NULL }
#define DEFINE_PHYSPTR_ARRAY(name) \
{ FIELD_CUSTOM, #name, offsetof(classNameTypedef,name), ARRAYSIZE(((classNameTypedef *)0)->name), FTYPEDESC_SAVE, NULL, GetPhysObjSaveRestoreOps( GetPhysIID( &(((classNameTypedef *)0)->name[0]) ) ), NULL }
{ FIELD_CUSTOM, #name, {offsetof(classNameTypedef,name), 0}, ARRAYSIZE(((classNameTypedef *)0)->name), FTYPEDESC_SAVE, NULL, GetPhysObjSaveRestoreOps( GetPhysIID( &(((classNameTypedef *)0)->name[0]) ) ), NULL }
//-----------------------------------------------------------------------------

16
game/shared/saverestore_utlvector.h

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
@ -34,7 +34,7 @@ public: @@ -34,7 +34,7 @@ public:
{
(fieldtype_t)FIELD_TYPE,
"elems",
0,
{ 0, 0 },
1,
FTYPEDESC_SAVE,
NULL,
@ -50,8 +50,9 @@ public: @@ -50,8 +50,9 @@ public:
1,
"uv",
NULL,
false,
false,
0,
NULL,
#ifdef _DEBUG
true
#endif
@ -86,7 +87,7 @@ public: @@ -86,7 +87,7 @@ public:
{
(fieldtype_t)FIELD_TYPE,
"elems",
0,
{ 0, 0 },
1,
FTYPEDESC_SAVE,
NULL,
@ -102,8 +103,9 @@ public: @@ -102,8 +103,9 @@ public:
1,
"uv",
NULL,
false,
false,
0,
NULL,
#ifdef _DEBUG
true
#endif
@ -171,10 +173,10 @@ public: @@ -171,10 +173,10 @@ public:
//-------------------------------------
#define DEFINE_UTLVECTOR(name,fieldtype) \
{ FIELD_CUSTOM, #name, offsetof(classNameTypedef,name), 1, FTYPEDESC_SAVE, NULL, CUtlVectorDataopsInstantiator<fieldtype>::GetDataOps(&(((classNameTypedef *)0)->name)), NULL }
{ FIELD_CUSTOM, #name, { offsetof(classNameTypedef,name), 0 }, 1, FTYPEDESC_SAVE, NULL, CUtlVectorDataopsInstantiator<fieldtype>::GetDataOps(&(((classNameTypedef *)0)->name)), NULL }
#define DEFINE_GLOBAL_UTLVECTOR(name,fieldtype) \
{ FIELD_CUSTOM, #name, offsetof(classNameTypedef,name), 1, FTYPEDESC_SAVE|FTYPEDESC_GLOBAL, NULL, CUtlVectorDataopsInstantiator<fieldtype>::GetDataOps(&(((classNameTypedef *)0)->name)), NULL }
{ FIELD_CUSTOM, #name, { offsetof(classNameTypedef,name), 0 }, 1, FTYPEDESC_SAVE|FTYPEDESC_GLOBAL, NULL, CUtlVectorDataopsInstantiator<fieldtype>::GetDataOps(&(((classNameTypedef *)0)->name)), NULL }
#endif // SAVERESTORE_UTLVECTOR_H

2
game/shared/soundenvelope.h

@ -99,7 +99,7 @@ class ISaveRestoreOps; @@ -99,7 +99,7 @@ class ISaveRestoreOps;
ISaveRestoreOps *GetSoundSaveRestoreOps( );
#define DEFINE_SOUNDPATCH(name) \
{ FIELD_CUSTOM, #name, offsetof(classNameTypedef,name), 1, FTYPEDESC_SAVE, NULL, GetSoundSaveRestoreOps( ), NULL }
{ FIELD_CUSTOM, #name, {offsetof(classNameTypedef,name), 0}, 1, FTYPEDESC_SAVE, NULL, GetSoundSaveRestoreOps( ), NULL }
#endif // SOUNDENVELOPE_H

2
game/shared/util_shared.h

@ -451,7 +451,7 @@ void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Ve @@ -451,7 +451,7 @@ void UTIL_TraceEntity( CBaseEntity *pEntity, const Vector &vecAbsStart, const Ve
bool UTIL_EntityHasMatchingRootParent( CBaseEntity *pRootParent, CBaseEntity *pEntity );
inline int UTIL_PointContents( const Vector &vec, int contentsMask )
inline int UTIL_PointContents( const Vector &vec, int contentsMask = 0 )
{
return enginetrace->GetPointContents( vec, contentsMask );
}

306
interfaces/interfaces.cpp

@ -0,0 +1,306 @@ @@ -0,0 +1,306 @@
//===== Copyright <EFBFBD> 2005-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: A higher level link library for general use in the game and tools.
//
//===========================================================================//
#include "tier0/platform.h"
#include "tier0/dbg.h"
#include "interfaces/interfaces.h"
//-----------------------------------------------------------------------------
// Tier 1 libraries
//-----------------------------------------------------------------------------
ICvar *cvar = 0;
ICvar *g_pCVar = 0;
IProcessUtils *g_pProcessUtils = 0;
static bool s_bConnected = false;
IPhysics2 *g_pPhysics2 = 0;
IPhysics2ActorManager *g_pPhysics2ActorManager = 0;
IPhysics2ResourceManager *g_pPhysics2ResourceManager = 0;
IEventSystem *g_pEventSystem = 0;
ILocalize *g_pLocalize = 0;
// for utlsortvector.h
#ifndef _WIN32
void *g_pUtlSortVectorQSortContext = NULL;
#endif
//-----------------------------------------------------------------------------
// Tier 2 libraries
//-----------------------------------------------------------------------------
IResourceSystem *g_pResourceSystem = 0;
IRenderDeviceMgr *g_pRenderDeviceMgr = 0;
IFileSystem *g_pFullFileSystem = 0;
IAsyncFileSystem *g_pAsyncFileSystem = 0;
IMaterialSystem *materials = 0;
IMaterialSystem *g_pMaterialSystem = 0;
IMaterialSystem2 *g_pMaterialSystem2 = 0;
IInputSystem *g_pInputSystem = 0;
IInputStackSystem *g_pInputStackSystem = 0;
INetworkSystem *g_pNetworkSystem = 0;
ISoundSystem *g_pSoundSystem = 0;
IMaterialSystemHardwareConfig *g_pMaterialSystemHardwareConfig = 0;
IDebugTextureInfo *g_pMaterialSystemDebugTextureInfo = 0;
IVBAllocTracker *g_VBAllocTracker = 0;
IColorCorrectionSystem *colorcorrection = 0;
IP4 *p4 = 0;
IMdlLib *mdllib = 0;
IQueuedLoader *g_pQueuedLoader = 0;
IResourceAccessControl *g_pResourceAccessControl = 0;
IPrecacheSystem *g_pPrecacheSystem = 0;
ISceneSystem *g_pSceneSystem = 0;
#if defined( PLATFORM_X360 )
IXboxInstaller *g_pXboxInstaller = 0;
#endif
IMatchFramework *g_pMatchFramework = 0;
IGameUISystemMgr *g_pGameUISystemMgr = 0;
#if defined( INCLUDE_SCALEFORM )
IScaleformUI *g_pScaleformUI = 0;
#elif defined( INCLUDE_ROCKETUI )
IRocketUI *g_pRocketUI = 0;
#endif
//-----------------------------------------------------------------------------
// Not exactly a global, but we're going to keep track of these here anyways
//-----------------------------------------------------------------------------
IRenderDevice *g_pRenderDevice = 0;
IRenderHardwareConfig *g_pRenderHardwareConfig = 0;
//-----------------------------------------------------------------------------
// Tier3 libraries
//-----------------------------------------------------------------------------
IMeshSystem *g_pMeshSystem = 0;
IStudioRender *g_pStudioRender = 0;
IStudioRender *studiorender = 0;
IMatSystemSurface *g_pMatSystemSurface = 0;
vgui::IInput *g_pVGuiInput = 0;
vgui::ISurface *g_pVGuiSurface = 0;
vgui::IPanel *g_pVGuiPanel = 0;
vgui::IVGui *g_pVGui = 0;
vgui::ILocalize *g_pVGuiLocalize = 0;
vgui::ISchemeManager *g_pVGuiSchemeManager = 0;
vgui::ISystem *g_pVGuiSystem = 0;
IDataCache *g_pDataCache = 0;
IMDLCache *g_pMDLCache = 0;
IMDLCache *mdlcache = 0;
IAvi *g_pAVI = 0;
IBik *g_pBIK = 0;
IDmeMakefileUtils *g_pDmeMakefileUtils = 0;
IPhysicsCollision *g_pPhysicsCollision = 0;
ISoundEmitterSystemBase *g_pSoundEmitterSystem = 0;
IWorldRendererMgr *g_pWorldRendererMgr = 0;
IVGuiRenderSurface *g_pVGuiRenderSurface = 0;
//-----------------------------------------------------------------------------
// Mapping of interface string to globals
//-----------------------------------------------------------------------------
struct InterfaceGlobals_t
{
const char *m_pInterfaceName;
void *m_ppGlobal;
};
static InterfaceGlobals_t g_pInterfaceGlobals[] =
{
{ CVAR_INTERFACE_VERSION, &cvar },
{ CVAR_INTERFACE_VERSION, &g_pCVar },
{ EVENTSYSTEM_INTERFACE_VERSION, &g_pEventSystem },
{ PROCESS_UTILS_INTERFACE_VERSION, &g_pProcessUtils },
{ VPHYSICS2_INTERFACE_VERSION, &g_pPhysics2 },
{ VPHYSICS2_ACTOR_MGR_INTERFACE_VERSION, &g_pPhysics2ActorManager },
{ VPHYSICS2_RESOURCE_MGR_INTERFACE_VERSION, &g_pPhysics2ResourceManager },
{ FILESYSTEM_INTERFACE_VERSION, &g_pFullFileSystem },
{ ASYNCFILESYSTEM_INTERFACE_VERSION, &g_pAsyncFileSystem },
{ RESOURCESYSTEM_INTERFACE_VERSION, &g_pResourceSystem },
{ MATERIAL_SYSTEM_INTERFACE_VERSION, &g_pMaterialSystem },
{ MATERIAL_SYSTEM_INTERFACE_VERSION, &materials },
{ MATERIAL_SYSTEM2_INTERFACE_VERSION, &g_pMaterialSystem2 },
{ INPUTSYSTEM_INTERFACE_VERSION, &g_pInputSystem },
{ INPUTSTACKSYSTEM_INTERFACE_VERSION, &g_pInputStackSystem },
{ NETWORKSYSTEM_INTERFACE_VERSION, &g_pNetworkSystem },
{ RENDER_DEVICE_MGR_INTERFACE_VERSION, &g_pRenderDeviceMgr },
{ MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION, &g_pMaterialSystemHardwareConfig },
{ SOUNDSYSTEM_INTERFACE_VERSION, &g_pSoundSystem },
{ DEBUG_TEXTURE_INFO_VERSION, &g_pMaterialSystemDebugTextureInfo },
{ VB_ALLOC_TRACKER_INTERFACE_VERSION, &g_VBAllocTracker },
{ COLORCORRECTION_INTERFACE_VERSION, &colorcorrection },
{ P4_INTERFACE_VERSION, &p4 },
{ MDLLIB_INTERFACE_VERSION, &mdllib },
{ QUEUEDLOADER_INTERFACE_VERSION, &g_pQueuedLoader },
{ RESOURCE_ACCESS_CONTROL_INTERFACE_VERSION, &g_pResourceAccessControl },
{ PRECACHE_SYSTEM_INTERFACE_VERSION, &g_pPrecacheSystem },
{ STUDIO_RENDER_INTERFACE_VERSION, &g_pStudioRender },
{ STUDIO_RENDER_INTERFACE_VERSION, &studiorender },
{ VGUI_IVGUI_INTERFACE_VERSION, &g_pVGui },
{ VGUI_INPUT_INTERFACE_VERSION, &g_pVGuiInput },
{ VGUI_PANEL_INTERFACE_VERSION, &g_pVGuiPanel },
{ VGUI_SURFACE_INTERFACE_VERSION, &g_pVGuiSurface },
{ VGUI_SCHEME_INTERFACE_VERSION, &g_pVGuiSchemeManager },
{ VGUI_SYSTEM_INTERFACE_VERSION, &g_pVGuiSystem },
{ LOCALIZE_INTERFACE_VERSION, &g_pLocalize },
{ LOCALIZE_INTERFACE_VERSION, &g_pVGuiLocalize },
{ MAT_SYSTEM_SURFACE_INTERFACE_VERSION, &g_pMatSystemSurface },
{ DATACACHE_INTERFACE_VERSION, &g_pDataCache },
{ MDLCACHE_INTERFACE_VERSION, &g_pMDLCache },
{ MDLCACHE_INTERFACE_VERSION, &mdlcache },
{ AVI_INTERFACE_VERSION, &g_pAVI },
{ BIK_INTERFACE_VERSION, &g_pBIK },
{ DMEMAKEFILE_UTILS_INTERFACE_VERSION, &g_pDmeMakefileUtils },
{ VPHYSICS_COLLISION_INTERFACE_VERSION, &g_pPhysicsCollision },
{ SOUNDEMITTERSYSTEM_INTERFACE_VERSION, &g_pSoundEmitterSystem },
{ MESHSYSTEM_INTERFACE_VERSION, &g_pMeshSystem },
{ RENDER_DEVICE_INTERFACE_VERSION, &g_pRenderDevice },
{ RENDER_HARDWARECONFIG_INTERFACE_VERSION, &g_pRenderHardwareConfig },
{ SCENESYSTEM_INTERFACE_VERSION, &g_pSceneSystem },
{ WORLD_RENDERER_MGR_INTERFACE_VERSION, &g_pWorldRendererMgr },
{ RENDER_SYSTEM_SURFACE_INTERFACE_VERSION, &g_pVGuiRenderSurface },
#if defined( _X360 )
{ XBOXINSTALLER_INTERFACE_VERSION, &g_pXboxInstaller },
#endif
{ MATCHFRAMEWORK_INTERFACE_VERSION, &g_pMatchFramework },
{ GAMEUISYSTEMMGR_INTERFACE_VERSION, &g_pGameUISystemMgr },
#if defined( INCLUDE_SCALEFORM )
{ SCALEFORMUI_INTERFACE_VERSION, &g_pScaleformUI },
#elif defined( INCLUDE_ROCKETUI )
{ ROCKETUI_INTERFACE_VERSION, &g_pRocketUI },
#endif
};
//-----------------------------------------------------------------------------
// The # of times this DLL has been connected
//-----------------------------------------------------------------------------
static int s_nConnectionCount = 0;
//-----------------------------------------------------------------------------
// At each level of connection, we're going to keep track of which interfaces
// we filled in. When we disconnect, we'll clear those interface pointers out.
//-----------------------------------------------------------------------------
struct ConnectionRegistration_t
{
void *m_ppGlobalStorage;
int m_nConnectionPhase;
};
static int s_nRegistrationCount = 0;
static ConnectionRegistration_t s_pConnectionRegistration[ ARRAYSIZE(g_pInterfaceGlobals) + 1 ];
void RegisterInterface( CreateInterfaceFn factory, const char *pInterfaceName, void **ppGlobal )
{
if ( !(*ppGlobal) )
{
*ppGlobal = factory( pInterfaceName, NULL );
if ( *ppGlobal )
{
Assert( s_nRegistrationCount < ARRAYSIZE(s_pConnectionRegistration) );
ConnectionRegistration_t &reg = s_pConnectionRegistration[s_nRegistrationCount++];
reg.m_ppGlobalStorage = ppGlobal;
reg.m_nConnectionPhase = s_nConnectionCount;
}
}
}
void ReconnectInterface( CreateInterfaceFn factory, const char *pInterfaceName, void **ppGlobal )
{
*ppGlobal = factory( pInterfaceName, NULL );
bool bFound = false;
Assert( s_nRegistrationCount < ARRAYSIZE(s_pConnectionRegistration) );
for ( int i = 0; i < s_nRegistrationCount; ++i )
{
ConnectionRegistration_t &reg = s_pConnectionRegistration[i];
if ( reg.m_ppGlobalStorage != ppGlobal )
continue;
reg.m_ppGlobalStorage = ppGlobal;
bFound = true;
}
if ( !bFound && *ppGlobal )
{
Assert( s_nRegistrationCount < ARRAYSIZE(s_pConnectionRegistration) );
ConnectionRegistration_t &reg = s_pConnectionRegistration[s_nRegistrationCount++];
reg.m_ppGlobalStorage = ppGlobal;
reg.m_nConnectionPhase = s_nConnectionCount;
}
}
//-----------------------------------------------------------------------------
// Call this to connect to all tier 1 libraries.
// It's up to the caller to check the globals it cares about to see if ones are missing
//-----------------------------------------------------------------------------
void ConnectInterfaces( CreateInterfaceFn *pFactoryList, int nFactoryCount )
{
if ( s_nRegistrationCount < 0 )
{
Error( "APPSYSTEM: In ConnectInterfaces(), s_nRegistrationCount is %d!\n", s_nRegistrationCount );
}
else if ( s_nRegistrationCount == 0 )
{
for ( int i = 0; i < nFactoryCount; ++i )
{
for ( int j = 0; j < ARRAYSIZE( g_pInterfaceGlobals ); ++j )
{
RegisterInterface( pFactoryList[i], g_pInterfaceGlobals[j].m_pInterfaceName, (void**)g_pInterfaceGlobals[j].m_ppGlobal );
}
}
}
else
{
// This is no longer questionable: ConnectInterfaces() is expected to be called multiple times for a file that exports multiple interfaces.
// Warning("APPSYSTEM: ConnectInterfaces() was called twice for the same DLL.\nThis is expected behavior in building reslists, but questionable otherwise.\n");
for ( int i = 0; i < nFactoryCount; ++i )
{
for ( int j = 0; j < ARRAYSIZE( g_pInterfaceGlobals ); ++j )
{
ReconnectInterface( pFactoryList[i], g_pInterfaceGlobals[j].m_pInterfaceName, (void**)g_pInterfaceGlobals[j].m_ppGlobal );
}
}
}
++s_nConnectionCount;
}
void DisconnectInterfaces()
{
Assert( s_nConnectionCount > 0 );
if ( --s_nConnectionCount < 0 )
return;
for ( int i = 0; i < s_nRegistrationCount; ++i )
{
if ( s_pConnectionRegistration[i].m_nConnectionPhase != s_nConnectionCount )
continue;
// Disconnect!
*(void**)(s_pConnectionRegistration[i].m_ppGlobalStorage) = 0;
}
}
//-----------------------------------------------------------------------------
// Reloads an interface
//-----------------------------------------------------------------------------
void ReconnectInterface( CreateInterfaceFn factory, const char *pInterfaceName )
{
for ( int i = 0; i < ARRAYSIZE( g_pInterfaceGlobals ); ++i )
{
if ( strcmp( g_pInterfaceGlobals[i].m_pInterfaceName, pInterfaceName ) )
continue;
ReconnectInterface( factory, g_pInterfaceGlobals[i].m_pInterfaceName, (void**)g_pInterfaceGlobals[i].m_ppGlobal );
}
}

21
interfaces/interfaces.vpc

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
//-----------------------------------------------------------------------------
// worldrenderer.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR ".."
$include "$SRCDIR\vpc_scripts\source_lib_base.vpc"
$Project "interfaces"
{
$Folder "Source Files"
{
$File "interfaces.cpp"
}
$Folder "Public Header Files"
{
$File "$SRCDIR\public\interfaces\interfaces.h"
}
}

1
interfaces/vsi.nul

@ -0,0 +1 @@ @@ -0,0 +1 @@
IMPORTANT: Do not remove the custom build step for this file

48
interfaces/wscript

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
#! /usr/bin/env python
# encoding: utf-8
from gettext import install
from waflib import Utils
import os, sys
top = '.'
PROJECT_NAME = 'interfaces'
def options(opt):
# stub
return
def configure(conf):
conf.define('VERSION_SAFE_STEAM_API_INTERFACES',1)
def build(bld):
source = [
'interfaces.cpp',
]
includes = [
'.',
'../common',
'../public',
'../public/tier0'
]
defines = []
# libs = ['tier0','tier1','tier2','vstdlib']
install_path = bld.env.LIBDIR
bld.stlib(
source = source,
target = PROJECT_NAME,
name = PROJECT_NAME,
features = 'c cxx',
includes = includes,
defines = defines,
# use = libs,
install_path = install_path,
subsystem = bld.env.MSVC_SUBSYSTEM,
idx = bld.get_taskgen_count()
)

2
public/appframework/IAppSystem.h

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
#endif
#include "tier1/interface.h"
#include "interfaces/interfaces.h"
//-----------------------------------------------------------------------------
// Client systems are singleton objects in the client codebase responsible for

7
public/const.h

@ -36,6 +36,12 @@ @@ -36,6 +36,12 @@
#define ABSOLUTE_PLAYER_LIMIT 255 // not 256, so we can send the limit as a byte
#define ABSOLUTE_PLAYER_LIMIT_DW ( (ABSOLUTE_PLAYER_LIMIT/32) + 1 )
#if ABSOLUTE_PLAYER_LIMIT > 32
#define CPlayerBitVec CBitVec<ABSOLUTE_PLAYER_LIMIT>
#else
#define CPlayerBitVec CDWordBitVec
#endif
// a player name may have 31 chars + 0 on the PC.
// the 360 only allows 15 char + 0, but stick with the larger PC size for cross-platform communication
#define MAX_PLAYER_NAME_LENGTH 32
@ -46,6 +52,7 @@ @@ -46,6 +52,7 @@
#define MAX_PLAYERS_PER_CLIENT 1 // One player per PC
#endif
// Max decorated map name, with things like workshop/cp_foo.ugc123456
#define MAX_MAP_NAME 96

6
public/dt_send.cpp

@ -246,6 +246,12 @@ void SendProxy_Int32ToInt32( const SendProp *pProp, const void *pStruct, const v @@ -246,6 +246,12 @@ void SendProxy_Int32ToInt32( const SendProp *pProp, const void *pStruct, const v
pOut->m_Int = *((int*)pData);
}
void SendProxy_Color32ToInt32( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID )
{
//Always send/receive as little endian to preserve byte order across network byte swaps
pOut->m_Int = LittleDWord( *((uint32 *)pData) );
}
#ifdef SUPPORTS_INT64
void SendProxy_Int64ToInt64( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID)
{

1
public/dt_send.h

@ -625,6 +625,7 @@ void SendProxy_Int32ToInt32 ( const SendProp *pProp, const void *pStruct, const @@ -625,6 +625,7 @@ void SendProxy_Int32ToInt32 ( const SendProp *pProp, const void *pStruct, const
void SendProxy_Int64ToInt64 ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
#endif
void SendProxy_StringToString ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
void SendProxy_Color32ToInt32 ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
// pData is the address of a data table.
void* SendProxy_DataTableToDataTable( const SendProp *pProp, const void *pStructBase, const void *pData, CSendProxyRecipients *pRecipients, int objectID );

300
public/interfaces/interfaces.h

@ -0,0 +1,300 @@ @@ -0,0 +1,300 @@
//===== Copyright <EFBFBD> 2005-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: A higher level link library for general use in the game and tools.
//
//===========================================================================//
#ifndef INTERFACES_H
#define INTERFACES_H
#if defined( COMPILER_MSVC )
#pragma once
#endif
//-----------------------------------------------------------------------------
// Interface creation function
//-----------------------------------------------------------------------------
typedef void* (*CreateInterfaceFn)(const char *pName, int *pReturnCode);
//-----------------------------------------------------------------------------
// Macros to declare interfaces appropriate for various tiers
//-----------------------------------------------------------------------------
#if 1 || defined( TIER1_LIBRARY ) || defined( TIER2_LIBRARY ) || defined( TIER3_LIBRARY ) || defined( TIER4_LIBRARY ) || defined( APPLICATION )
#define DECLARE_TIER1_INTERFACE( _Interface, _Global ) extern _Interface * _Global;
#else
#define DECLARE_TIER1_INTERFACE( _Interface, _Global )
#endif
#if 1 || defined( TIER2_LIBRARY ) || defined( TIER3_LIBRARY ) || defined( TIER4_LIBRARY ) || defined( APPLICATION )
#define DECLARE_TIER2_INTERFACE( _Interface, _Global ) extern _Interface * _Global;
#else
#define DECLARE_TIER2_INTERFACE( _Interface, _Global )
#endif
#if 1 || defined( TIER3_LIBRARY ) || defined( TIER4_LIBRARY ) || defined( APPLICATION )
#define DECLARE_TIER3_INTERFACE( _Interface, _Global ) extern _Interface * _Global;
#else
#define DECLARE_TIER3_INTERFACE( _Interface, _Global )
#endif
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class ICvar;
class IProcessUtils;
class ILocalize;
class IPhysics2;
class IPhysics2ActorManager;
class IPhysics2ResourceManager;
class IEventSystem;
class IAsyncFileSystem;
class IColorCorrectionSystem;
class IDebugTextureInfo;
class IFileSystem;
class IRenderHardwareConfig;
class IInputSystem;
class IInputStackSystem;
class IMaterialSystem;
class IMaterialSystem2;
class IMaterialSystemHardwareConfig;
class IMdlLib;
class INetworkSystem;
class IP4;
class IQueuedLoader;
class IResourceAccessControl;
class IPrecacheSystem;
class IRenderDevice;
class IRenderDeviceMgr;
class IResourceSystem;
class IVBAllocTracker;
class IXboxInstaller;
class IMatchFramework;
class ISoundSystem;
class IStudioRender;
class IMatSystemSurface;
class IGameUISystemMgr;
class IDataCache;
class IMDLCache;
class IAvi;
class IBik;
class IDmeMakefileUtils;
class IPhysicsCollision;
class ISoundEmitterSystemBase;
class IMeshSystem;
class IWorldRendererMgr;
class ISceneSystem;
class IVGuiRenderSurface;
class IScaleformUISystemMgr;
class IScaleformUI;
class IRocketUI;
namespace vgui
{
class ISurface;
class IVGui;
class IInput;
class IPanel;
class ILocalize;
class ISchemeManager;
class ISystem;
}
//-----------------------------------------------------------------------------
// Fills out global DLL exported interface pointers
//-----------------------------------------------------------------------------
#define CVAR_INTERFACE_VERSION "VEngineCvar007"
DECLARE_TIER1_INTERFACE( ICvar, cvar );
DECLARE_TIER1_INTERFACE( ICvar, g_pCVar )
#define PROCESS_UTILS_INTERFACE_VERSION "VProcessUtils002"
DECLARE_TIER1_INTERFACE( IProcessUtils, g_pProcessUtils );
#define VPHYSICS2_INTERFACE_VERSION "Physics2 Interface v0.3"
DECLARE_TIER1_INTERFACE( IPhysics2, g_pPhysics2 );
#define VPHYSICS2_ACTOR_MGR_INTERFACE_VERSION "Physics2 Interface ActorMgr v0.1"
DECLARE_TIER1_INTERFACE( IPhysics2ActorManager, g_pPhysics2ActorManager );
#define VPHYSICS2_RESOURCE_MGR_INTERFACE_VERSION "Physics2 Interface ResourceMgr v0.1"
DECLARE_TIER1_INTERFACE( IPhysics2ResourceManager, g_pPhysics2ResourceManager );
#define EVENTSYSTEM_INTERFACE_VERSION "EventSystem001"
DECLARE_TIER1_INTERFACE( IEventSystem, g_pEventSystem );
#define LOCALIZE_INTERFACE_VERSION "Localize_001"
DECLARE_TIER2_INTERFACE( ILocalize, g_pLocalize );
DECLARE_TIER3_INTERFACE( vgui::ILocalize, g_pVGuiLocalize );
#define RENDER_DEVICE_MGR_INTERFACE_VERSION "RenderDeviceMgr001"
DECLARE_TIER2_INTERFACE( IRenderDeviceMgr, g_pRenderDeviceMgr );
#define FILESYSTEM_INTERFACE_VERSION "VFileSystem017"
DECLARE_TIER2_INTERFACE( IFileSystem, g_pFullFileSystem );
#define ASYNCFILESYSTEM_INTERFACE_VERSION "VNewAsyncFileSystem001"
DECLARE_TIER2_INTERFACE( IAsyncFileSystem, g_pAsyncFileSystem );
#define RESOURCESYSTEM_INTERFACE_VERSION "ResourceSystem004"
DECLARE_TIER2_INTERFACE( IResourceSystem, g_pResourceSystem );
#define MATERIAL_SYSTEM_INTERFACE_VERSION "VMaterialSystem080"
DECLARE_TIER2_INTERFACE( IMaterialSystem, materials );
DECLARE_TIER2_INTERFACE( IMaterialSystem, g_pMaterialSystem );
#define MATERIAL_SYSTEM2_INTERFACE_VERSION "VMaterialSystem2_001"
DECLARE_TIER2_INTERFACE( IMaterialSystem2, g_pMaterialSystem2 );
#define INPUTSYSTEM_INTERFACE_VERSION "InputSystemVersion001"
DECLARE_TIER2_INTERFACE( IInputSystem, g_pInputSystem );
#define INPUTSTACKSYSTEM_INTERFACE_VERSION "InputStackSystemVersion001"
DECLARE_TIER2_INTERFACE( IInputStackSystem, g_pInputStackSystem );
#define MATERIALSYSTEM_HARDWARECONFIG_INTERFACE_VERSION "MaterialSystemHardwareConfig013"
DECLARE_TIER2_INTERFACE( IMaterialSystemHardwareConfig, g_pMaterialSystemHardwareConfig );
#define DEBUG_TEXTURE_INFO_VERSION "DebugTextureInfo001"
DECLARE_TIER2_INTERFACE( IDebugTextureInfo, g_pMaterialSystemDebugTextureInfo );
#define VB_ALLOC_TRACKER_INTERFACE_VERSION "VBAllocTracker001"
DECLARE_TIER2_INTERFACE( IVBAllocTracker, g_VBAllocTracker );
#define COLORCORRECTION_INTERFACE_VERSION "COLORCORRECTION_VERSION_1"
DECLARE_TIER2_INTERFACE( IColorCorrectionSystem, colorcorrection );
#define P4_INTERFACE_VERSION "VP4002"
DECLARE_TIER2_INTERFACE( IP4, p4 );
#define MDLLIB_INTERFACE_VERSION "VMDLLIB001"
DECLARE_TIER2_INTERFACE( IMdlLib, mdllib );
#define QUEUEDLOADER_INTERFACE_VERSION "QueuedLoaderVersion001"
DECLARE_TIER2_INTERFACE( IQueuedLoader, g_pQueuedLoader );
#define RESOURCE_ACCESS_CONTROL_INTERFACE_VERSION "VResourceAccessControl001"
DECLARE_TIER2_INTERFACE( IResourceAccessControl, g_pResourceAccessControl );
#define PRECACHE_SYSTEM_INTERFACE_VERSION "VPrecacheSystem001"
DECLARE_TIER2_INTERFACE( IPrecacheSystem, g_pPrecacheSystem );
#if defined( _X360 )
#define XBOXINSTALLER_INTERFACE_VERSION "XboxInstallerVersion001"
DECLARE_TIER2_INTERFACE( IXboxInstaller, g_pXboxInstaller );
#endif
#define MATCHFRAMEWORK_INTERFACE_VERSION "MATCHFRAMEWORK_001"
DECLARE_TIER2_INTERFACE( IMatchFramework, g_pMatchFramework );
#define GAMEUISYSTEMMGR_INTERFACE_VERSION "GameUISystemMgr001"
DECLARE_TIER3_INTERFACE( IGameUISystemMgr, g_pGameUISystemMgr );
#if defined( INCLUDE_SCALEFORM )
#define SCALEFORMUI_INTERFACE_VERSION "ScaleformUI002"
DECLARE_TIER3_INTERFACE( IScaleformUI, g_pScaleformUI );
#elif defined( INCLUDE_ROCKETUI )
#define ROCKETUI_INTERFACE_VERSION "RocketUI001"
DECLARE_TIER3_INTERFACE( IRocketUI, g_pRocketUI );
#endif
//-----------------------------------------------------------------------------
// Not exactly a global, but we're going to keep track of these here anyways
// NOTE: Appframework deals with connecting these bad boys. See materialsystem2app.cpp
//-----------------------------------------------------------------------------
#define RENDER_DEVICE_INTERFACE_VERSION "RenderDevice001"
DECLARE_TIER2_INTERFACE( IRenderDevice, g_pRenderDevice );
#define RENDER_HARDWARECONFIG_INTERFACE_VERSION "RenderHardwareConfig001"
DECLARE_TIER2_INTERFACE( IRenderHardwareConfig, g_pRenderHardwareConfig );
#define SOUNDSYSTEM_INTERFACE_VERSION "SoundSystem001"
DECLARE_TIER2_INTERFACE( ISoundSystem, g_pSoundSystem );
#define MESHSYSTEM_INTERFACE_VERSION "MeshSystem001"
DECLARE_TIER3_INTERFACE( IMeshSystem, g_pMeshSystem );
#define STUDIO_RENDER_INTERFACE_VERSION "VStudioRender026"
DECLARE_TIER3_INTERFACE( IStudioRender, g_pStudioRender );
DECLARE_TIER3_INTERFACE( IStudioRender, studiorender );
#define MAT_SYSTEM_SURFACE_INTERFACE_VERSION "MatSystemSurface006"
DECLARE_TIER3_INTERFACE( IMatSystemSurface, g_pMatSystemSurface );
#define RENDER_SYSTEM_SURFACE_INTERFACE_VERSION "RenderSystemSurface001"
DECLARE_TIER3_INTERFACE( IVGuiRenderSurface, g_pVGuiRenderSurface );
#define SCENESYSTEM_INTERFACE_VERSION "SceneSystem_001"
DECLARE_TIER3_INTERFACE( ISceneSystem, g_pSceneSystem );
#define VGUI_SURFACE_INTERFACE_VERSION "VGUI_Surface031"
DECLARE_TIER3_INTERFACE( vgui::ISurface, g_pVGuiSurface );
#define SCHEME_SURFACE_INTERFACE_VERSION "SchemeSurface001"
#define VGUI_INPUT_INTERFACE_VERSION "VGUI_Input005"
DECLARE_TIER3_INTERFACE( vgui::IInput, g_pVGuiInput );
#define VGUI_IVGUI_INTERFACE_VERSION "VGUI_ivgui008"
DECLARE_TIER3_INTERFACE( vgui::IVGui, g_pVGui );
#define VGUI_PANEL_INTERFACE_VERSION "VGUI_Panel009"
DECLARE_TIER3_INTERFACE( vgui::IPanel, g_pVGuiPanel );
#define VGUI_SCHEME_INTERFACE_VERSION "VGUI_Scheme010"
DECLARE_TIER3_INTERFACE( vgui::ISchemeManager, g_pVGuiSchemeManager );
#define VGUI_SYSTEM_INTERFACE_VERSION "VGUI_System010"
DECLARE_TIER3_INTERFACE( vgui::ISystem, g_pVGuiSystem );
#define DATACACHE_INTERFACE_VERSION "VDataCache003"
DECLARE_TIER3_INTERFACE( IDataCache, g_pDataCache ); // FIXME: Should IDataCache be in tier2?
#define MDLCACHE_INTERFACE_VERSION "MDLCache004"
DECLARE_TIER3_INTERFACE( IMDLCache, g_pMDLCache );
DECLARE_TIER3_INTERFACE( IMDLCache, mdlcache );
#define AVI_INTERFACE_VERSION "VAvi001"
DECLARE_TIER3_INTERFACE( IAvi, g_pAVI );
#define BIK_INTERFACE_VERSION "VBik001"
DECLARE_TIER3_INTERFACE( IBik, g_pBIK );
#define DMEMAKEFILE_UTILS_INTERFACE_VERSION "VDmeMakeFileUtils001"
DECLARE_TIER3_INTERFACE( IDmeMakefileUtils, g_pDmeMakefileUtils );
#define VPHYSICS_COLLISION_INTERFACE_VERSION "VPhysicsCollision007"
DECLARE_TIER3_INTERFACE( IPhysicsCollision, g_pPhysicsCollision );
#define SOUNDEMITTERSYSTEM_INTERFACE_VERSION "VSoundEmitter003"
DECLARE_TIER3_INTERFACE( ISoundEmitterSystemBase, g_pSoundEmitterSystem );
#define WORLD_RENDERER_MGR_INTERFACE_VERSION "WorldRendererMgr001"
DECLARE_TIER3_INTERFACE( IWorldRendererMgr, g_pWorldRendererMgr );
#define NETWORKSYSTEM_INTERFACE_VERSION "NetworkSystemVersion001"
DECLARE_TIER2_INTERFACE( INetworkSystem, g_pNetworkSystem );
//-----------------------------------------------------------------------------
// Fills out global DLL exported interface pointers
//-----------------------------------------------------------------------------
void ConnectInterfaces( CreateInterfaceFn *pFactoryList, int nFactoryCount );
void DisconnectInterfaces();
//-----------------------------------------------------------------------------
// Reconnects an interface
//-----------------------------------------------------------------------------
void ReconnectInterface( CreateInterfaceFn factory, const char *pInterfaceName );
#endif // INTERFACES_H

8
public/mathlib/mathlib.h

@ -250,6 +250,14 @@ struct matrix3x4_t @@ -250,6 +250,14 @@ struct matrix3x4_t
float m_flMatVal[3][4];
};
class ALIGN16 matrix3x4a_t : public matrix3x4_t
{
public:
/*
matrix3x4a_t() { if (((size_t)Base()) % 16 != 0) { Error( "matrix3x4a_t missaligned" ); } }
*/
matrix3x4a_t& operator=( const matrix3x4_t& src ) { memcpy( Base(), src.Base(), sizeof( float ) * 3 * 4 ); return *this; };
};
#ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h

61
public/responserules/response_host_interface.h

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Core types for the response rules -- criteria, responses, rules, and matchers.
//
// $NoKeywords: $
//=============================================================================//
#ifndef RESPONSE_HOST_INTERFACE_H
#define RESPONSE_HOST_INTERFACE_H
#ifdef _WIN32
#pragma once
#endif
#include "filesystem.h"
class IUniformRandomStream;
class ICommandLine;
namespace ResponseRules
{
// FUNCTIONS YOU MUST IMPLEMENT IN THE HOST EXECUTABLE:
// These are functions that are mentioned in the header, but need their bodies implemented
// in the .dll that links against this lib.
// This is to wrap functions that previously came from the engine interface
// back when the response rules were inside the server.dll . Now that the rules
// are included into a standalone editor, we don't necessarily have an engine around,
// so there needs to be some other implementation.
abstract_class IEngineEmulator
{
public:
/// Given an input text buffer data pointer, parses a single token into the variable token and returns the new
/// reading position
virtual const char *ParseFile( const char *data, char *token, int maxlen ) = 0;
/// Return a pointer to an IFileSystem we can use to read and process scripts.
virtual IFileSystem *GetFilesystem() = 0;
/// Return a pointer to an instance of an IUniformRandomStream
virtual IUniformRandomStream *GetRandomStream() = 0 ;
/// Return a pointer to a tier0 ICommandLine
virtual ICommandLine *GetCommandLine() = 0;
/// Emulates the server's UTIL_LoadFileForMe
virtual byte *LoadFileForMe( const char *filename, int *pLength ) = 0;
/// Emulates the server's UTIL_FreeFile
virtual void FreeFile( byte *buffer ) = 0;
/// Somewhere in the host executable you should define this symbol and
/// point it at a singleton instance.
static IEngineEmulator *s_pSingleton;
// this is just a function that returns the pointer above -- just in
// case we need to define it differently. And I get asserts this way.
static IEngineEmulator *Get();
};
};
#endif

418
public/responserules/response_types.h

@ -0,0 +1,418 @@ @@ -0,0 +1,418 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Core types for the response rules -- criteria, responses, rules, and matchers.
//
// $NoKeywords: $
//=============================================================================//
#ifndef RESPONSE_TYPES_H
#define RESPONSE_TYPES_H
#ifdef _WIN32
#pragma once
#endif
#include "tier1/utlrbtree.h"
#include "tier1/utlsymbol.h"
#include "tier2/interval.h"
#include "mathlib/compressed_vector.h"
#include "datamap.h"
#include "soundflags.h"
#include "tier1/utlsymbol.h"
namespace ResponseRules
{
/// Custom symbol table for the response rules.
extern CUtlSymbolTable g_RS;
};
#ifdef _MANAGED
// forward declare some editor types just so we can friend them.
namespace ResponseRulesCLI
{
ref class ResponseQueryResult;
}
#endif
namespace ResponseRules
{
using ::DataMapAccess;
// using ::DataMapInit;
class CResponseSystem;
#pragma pack(push,1)
template<typename T>
struct response_interval_t
{
T start;
T range;
interval_t &ToInterval( interval_t &dest ) const { dest.start = start; dest.range = range; return dest; }
void FromInterval( const interval_t &from ) { start = from.start; range = from.range; }
float Random() const { interval_t temp = { start, range }; return RandomInterval( temp ); }
};
typedef response_interval_t<float16_with_assign> responseparams_interval_t;
#pragma pack(pop)
#pragma pack(push,1)
struct AI_ResponseFollowup
{
// TODO: make less wasteful of memory, by using a symbol table.
const char *followup_concept; // 12 -- next response
const char *followup_contexts; // 16
float followup_delay; // 20
const char *followup_target; // 24 -- to whom is this despatched?
// AIConceptHandle_t hConcept;
const char *followup_entityiotarget; //< if this rule involves firing entity io
const char *followup_entityioinput; //< if this rule involves firing entity io
float followup_entityiodelay;
bool bFired;
inline bool IsValid( void ) const { return (followup_concept && followup_contexts); }
inline void Invalidate() { followup_concept = NULL; followup_contexts = NULL; }
inline void SetFired( bool fired ) { bFired = fired; }
inline bool HasBeenFired() { return bFired; }
AI_ResponseFollowup( void ) : followup_concept(NULL), followup_contexts(NULL), followup_delay(0), followup_target(NULL), followup_entityiotarget(NULL), followup_entityioinput(NULL), followup_entityiodelay(0), bFired(false)
{};
AI_ResponseFollowup( char *_followup_concept, char *_followup_contexts, float _followup_delay, char *_followup_target,
char *_followup_entityiotarget, char *_followup_entityioinput, float _followup_entityiodelay ) :
followup_concept(_followup_concept), followup_contexts(_followup_contexts), followup_delay(_followup_delay), followup_target(_followup_target),
followup_entityiotarget(_followup_entityiotarget), followup_entityioinput(_followup_entityioinput), followup_entityiodelay(_followup_entityiodelay),
bFired(false)
{};
};
#pragma pack(pop)
enum ResponseType_t
{
RESPONSE_NONE = 0,
RESPONSE_SPEAK,
RESPONSE_SENTENCE,
RESPONSE_SCENE,
RESPONSE_RESPONSE, // A reference to another response by name
RESPONSE_PRINT,
RESPONSE_ENTITYIO, // poke an input on an entity
NUM_RESPONSES,
};
#pragma pack(push,1)
struct ResponseParams
{
DECLARE_SIMPLE_DATADESC_INSIDE_NAMESPACE();
enum
{
RG_DELAYAFTERSPEAK = (1<<0),
RG_SPEAKONCE = (1<<1),
RG_ODDS = (1<<2),
RG_RESPEAKDELAY = (1<<3),
RG_SOUNDLEVEL = (1<<4),
RG_DONT_USE_SCENE = (1<<5),
RG_STOP_ON_NONIDLE = (1<<6),
RG_WEAPONDELAY = (1<<7),
RG_DELAYBEFORESPEAK = (1<<8),
};
ResponseParams()
{
flags = 0;
odds = 100;
delay.start = 0;
delay.range = 0;
respeakdelay.start = 0;
respeakdelay.range = 0;
weapondelay.start = 0;
weapondelay.range = 0;
soundlevel = 0;
predelay.start = 0;
predelay.range = 0;
}
responseparams_interval_t delay; //4
responseparams_interval_t respeakdelay; //8
responseparams_interval_t weapondelay; //12
short odds; //14
short flags; //16
byte soundlevel; //17
responseparams_interval_t predelay; //21
ALIGN32 AI_ResponseFollowup *m_pFollowup;
};
#pragma pack(pop)
class CriteriaSet
{
public:
typedef CUtlSymbol CritSymbol_t; ///< just to make it clear that some symbols come out of our special static table
public:
CriteriaSet();
CriteriaSet( const CriteriaSet& src );
CriteriaSet( const char *criteria, const char *value ) ; // construct initialized with a key/value pair (convenience)
~CriteriaSet();
static CritSymbol_t ComputeCriteriaSymbol( const char *criteria );
void AppendCriteria( CritSymbol_t criteria, const char *value = "", float weight = 1.0f );
void AppendCriteria( const char *criteria, const char *value = "", float weight = 1.0f );
void AppendCriteria( const char *criteria, float value, float weight = 1.0f );
void RemoveCriteria( const char *criteria );
void Describe() const;
int GetCount() const;
int FindCriterionIndex( CritSymbol_t criteria ) const;
int FindCriterionIndex( const char *name ) const;
inline bool IsValidIndex( int index ) const;
CritSymbol_t GetNameSymbol( int nIndex ) const;
inline static const char *SymbolToStr( const CritSymbol_t &symbol );
const char *GetName( int index ) const;
const char *GetValue( int index ) const;
float GetWeight( int index ) const;
/// Merge another CriteriaSet into this one.
void Merge( const CriteriaSet *otherCriteria );
void Merge( const char *modifiers ); // add criteria parsed from a text string
/// add all of the contexts herein onto an entity. all durations are infinite.
void WriteToEntity( CBaseEntity *pEntity );
// Accessors to things that need only be done under unusual circumstances.
inline void EnsureCapacity( int num );
void Reset(); // clear out this criteria (should not be necessary)
/// When this is true, calls to AppendCriteria on a criteria that already exists
/// will override the existing value. (This is the default behavior). Can be temporarily
/// set false to prevent such overrides.
inline void OverrideOnAppend( bool bOverride ) { m_bOverrideOnAppend = bOverride; }
// For iteration from beginning to end (also should not be necessary except in
// save/load)
inline int Head() const;
inline int Next( int i ) const; // use with IsValidIndex above
const static char kAPPLYTOWORLDPREFIX = '$';
/// A last minute l4d2 change: deferred contexts prefixed with a '$'
/// character are actually applied to the world. This matches the
/// related hack in CBaseEntity::AppplyContext.
/// This function works IN-PLACE on the "from" parameter.
/// any $-prefixed criteria in pFrom become prefixed by "world",
/// and are also written into pSetOnWorld.
/// *IF* a response matches using the modified criteria, then and only
/// then should you write back the criteria in pSetOnWorld to the world
/// entity, subsequent to the match but BEFORE the dispatch.
/// Returns the number of contexts modified. If it returns 0, then
/// pSetOnWorld is empty.
static int InterceptWorldSetContexts( CriteriaSet * RESTRICT pFrom,
CriteriaSet * RESTRICT pSetOnWorld );
private:
void RemoveCriteria( int idx, bool bTestForPrefix );
struct CritEntry_t
{
CritEntry_t() :
criterianame( UTL_INVAL_SYMBOL ),
weight( 0.0f )
{
value[ 0 ] = 0;
}
CritEntry_t( const CritEntry_t& src )
{
criterianame = src.criterianame;
value[ 0 ] = 0;
weight = src.weight;
SetValue( src.value );
}
CritEntry_t& operator=( const CritEntry_t& src )
{
if ( this == &src )
return *this;
criterianame = src.criterianame;
weight = src.weight;
SetValue( src.value );
return *this;
}
static bool LessFunc( const CritEntry_t& lhs, const CritEntry_t& rhs )
{
return lhs.criterianame < rhs.criterianame;
}
void SetValue( char const *str )
{
if ( !str )
{
value[ 0 ] = 0;
}
else
{
Q_strncpy( value, str, sizeof( value ) );
}
}
CritSymbol_t criterianame;
char value[ 64 ];
float weight;
};
static CUtlSymbolTable sm_CriteriaSymbols;
typedef CUtlRBTree< CritEntry_t, short > Dict_t;
Dict_t m_Lookup;
int m_nNumPrefixedContexts; // number of contexts prefixed with kAPPLYTOWORLDPREFIX
bool m_bOverrideOnAppend;
};
inline void CriteriaSet::EnsureCapacity( int num )
{
m_Lookup.EnsureCapacity(num);
}
//-----------------------------------------------------------------------------
// Purpose: Generic container for a response to a match to a criteria set
// This is what searching for a response returns
//-----------------------------------------------------------------------------
class CRR_Response
{
public:
DECLARE_SIMPLE_DATADESC_INSIDE_NAMESPACE();
CRR_Response();
CRR_Response( const CRR_Response &from );
CRR_Response &operator=( const CRR_Response &from );
~CRR_Response();
private:
void operator delete(void* p); // please do not new or delete CRR_Responses.
public:
// void Release(); // we no longer encourage new and delete on these things
void GetName( char *buf, size_t buflen ) const;
void GetResponse( char *buf, size_t buflen ) const;
const ResponseParams *GetParams() const { return &m_Params; }
ResponseType_t GetType() const { return (ResponseType_t)m_Type; }
soundlevel_t GetSoundLevel() const;
float GetRespeakDelay() const;
float GetWeaponDelay() const;
bool GetSpeakOnce() const;
bool ShouldntUseScene( ) const;
bool ShouldBreakOnNonIdle( void ) const;
int GetOdds() const;
float GetDelay() const;
float GetPreDelay() const;
inline bool IsEmpty() const; // true iff my response name is empty
void Invalidate() ; // wipe out my contents, mark me invalid
// Get/set the contexts we apply to character and world after execution
void SetContext( const char *context );
const char * GetContext( void ) const { return m_szContext; }
// Get/set the score I matched with (under certain circumstances)
inline float GetMatchScore( void ) { return m_fMatchScore; }
inline void SetMatchScore( float f ) { m_fMatchScore = f; }
bool IsApplyContextToWorld( void ) { return m_bApplyContextToWorld; }
void Describe( const CriteriaSet *pDebugCriteria = NULL );
void Init( ResponseType_t type,
const char *responseName,
const ResponseParams& responseparams,
const char *matchingRule,
const char *applyContext,
bool bApplyContextToWorld );
static const char *DescribeResponse( ResponseType_t type );
enum
{
MAX_RESPONSE_NAME = 64,
MAX_RULE_NAME = 64
};
private:
byte m_Type;
char m_szResponseName[ MAX_RESPONSE_NAME ];
char m_szMatchingRule[ MAX_RULE_NAME ];
ResponseParams m_Params;
float m_fMatchScore; // when instantiated dynamically in SpeakFindResponse, the score of the rule that matched it.
char * m_szContext; // context data we apply to character after running
bool m_bApplyContextToWorld;
#ifdef _MANAGED
friend ref class ResponseRulesCLI::ResponseQueryResult;
#endif
};
abstract_class IResponseFilter
{
public:
virtual bool IsValidResponse( ResponseType_t type, const char *pszValue ) = 0;
};
abstract_class IResponseSystem
{
public:
virtual ~IResponseSystem() {}
virtual bool FindBestResponse( const CriteriaSet& set, CRR_Response& response, IResponseFilter *pFilter = NULL ) = 0;
virtual void GetAllResponses( CUtlVector<CRR_Response> *pResponses ) = 0;
virtual void PrecacheResponses( bool bEnable ) = 0;
};
// INLINE FUNCTIONS
// Used as a failsafe in finding responses.
bool CRR_Response::IsEmpty() const
{
return m_szResponseName[0] == 0;
}
inline bool CriteriaSet::IsValidIndex( int index ) const
{
return ( index >= 0 && index < ((int)(m_Lookup.Count())) );
}
inline int CriteriaSet::Head() const
{
return m_Lookup.FirstInorder();
}
inline int CriteriaSet::Next( int i ) const
{
return m_Lookup.NextInorder(i);
}
inline const char *CriteriaSet::SymbolToStr( const CritSymbol_t &symbol )
{
return sm_CriteriaSymbols.String(symbol);
}
}
#include "rr_speechconcept.h"
#include "response_host_interface.h"
#endif

57
public/responserules/rr_speechconcept.h

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Class data for an AI Concept, an atom of response-driven dialog.
//
// $NoKeywords: $
//=============================================================================//
#ifndef RR_SPEECHCONCEPT_H
#define RR_SPEECHCONCEPT_H
#if defined( _WIN32 )
#pragma once
#endif
#include "utlsymbol.h"
#define RR_CONCEPTS_ARE_STRINGS 0
typedef CUtlSymbolTable CRR_ConceptSymbolTable;
namespace ResponseRules
{
class CRR_Concept
{
public: // local typedefs
typedef CUtlSymbol tGenericId; // an int-like type that can be used to refer to all concepts of this type
tGenericId m_iConcept;
public:
CRR_Concept() {};
// construct concept from a string.
CRR_Concept(const char *fromString);
// Return as a string
const char *GetStringConcept() const;
static const char *GetStringForGenericId(tGenericId genericId);
operator tGenericId() const { return m_iConcept; }
operator const char *() const { return GetStringConcept(); }
inline bool operator==(const CRR_Concept &other) // default is compare by concept ids
{
return m_iConcept == other.m_iConcept;
}
bool operator==(const char *pszConcept);
protected:
private:
// dupe a concept
// CRR_Concept& operator=(CRR_Concept &other);
CRR_Concept& operator=(const char *fromString);
};
};
#endif

65
public/tier2/interval.h

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef INTERVAL_H
#define INTERVAL_H
#ifdef _WIN32
#pragma once
#endif
#include "basetypes.h"
#include "tier0/platform.h"
#include "tier1/strtools.h"
#include "vstdlib/random.h"
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pString -
// Output : interval_t
//-----------------------------------------------------------------------------
inline interval_t ReadInterval( const char *pString )
{
interval_t tmp;
tmp.start = 0;
tmp.range = 0;
char tempString[128];
Q_strncpy( tempString, pString, sizeof(tempString) );
char *token = strtok( tempString, "," );
if ( token )
{
tmp.start = atof( token );
token = strtok( NULL, "," );
if ( token )
{
tmp.range = atof( token ) - tmp.start;
}
}
return tmp;
}
//-----------------------------------------------------------------------------
// Purpose:
// Input : &interval -
// Output : float
//-----------------------------------------------------------------------------
inline float RandomInterval( const interval_t &interval )
{
float out = interval.start;
if ( interval.range != 0 )
{
out += RandomFloat( 0, interval.range );
}
return out;
}
#endif // INTERVAL_H

3
wscript

@ -40,7 +40,7 @@ projects={ @@ -40,7 +40,7 @@ projects={
'engine/voice_codecs/minimp3',
'filesystem',
# 'game/client',
# 'game/server',
'game/server',
'gameui',
'inputsystem',
'ivp/havana',
@ -79,6 +79,7 @@ projects={ @@ -79,6 +79,7 @@ projects={
'utils/vtex',
'unicode',
'video',
'interfaces'
],
'tests': [
'appframework',

Loading…
Cancel
Save