1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 12:06:07 +08:00

Backported various changes from Alien Swarm SDK (bug 4532, r=dvander).

This commit is contained in:
Scott Ehlert
2010-07-22 01:55:24 -05:00
parent 096ab8ed3b
commit bd48f8889d
25 changed files with 516 additions and 1988 deletions

View File

@ -57,17 +57,18 @@ struct csurface_t
//-----------------------------------------------------------------------------
// A ray...
//-----------------------------------------------------------------------------
struct Ray_t
{
VectorAligned m_Start; // starting point, centered within the extents
VectorAligned m_Delta; // direction + length of the ray
VectorAligned m_StartOffset; // Add this to m_Start to get the actual ray start
VectorAligned m_Extents; // Describes an axis aligned box extruded along a ray
void *padding;
const matrix3x4_t *m_pWorldAxisTransform;
bool m_IsRay; // are the extents zero?
bool m_IsSwept; // is delta != 0?
Ray_t() : m_pWorldAxisTransform( NULL ) {}
void Init( Vector const& start, Vector const& end )
{
Assert( &end );
@ -75,9 +76,8 @@ struct Ray_t
m_IsSwept = (m_Delta.LengthSqr() != 0);
padding = NULL;
VectorClear( m_Extents );
m_pWorldAxisTransform = NULL;
m_IsRay = true;
// Offset m_Start to be in the center of the box...
@ -90,8 +90,7 @@ struct Ray_t
Assert( &end );
VectorSubtract( end, start, m_Delta );
padding = NULL;
m_pWorldAxisTransform = NULL;
m_IsSwept = (m_Delta.LengthSqr() != 0);
VectorSubtract( maxs, mins, m_Extents );

View File

@ -64,6 +64,8 @@ typedef enum _fieldtypes
FIELD_MATERIALINDEX, // a material index (using the material precache string table)
FIELD_VECTOR2D, // 2 floats
FIELD_INTEGER64, // 64bit integer
FIELD_TYPECOUNT, // MUST BE LAST
} fieldtype_t;
@ -98,6 +100,7 @@ DECLARE_FIELD_SIZE( FIELD_VECTOR, 3 * sizeof(float) )
DECLARE_FIELD_SIZE( FIELD_VECTOR2D, 2 * sizeof(float) )
DECLARE_FIELD_SIZE( FIELD_QUATERNION, 4 * sizeof(float))
DECLARE_FIELD_SIZE( FIELD_INTEGER, sizeof(int))
DECLARE_FIELD_SIZE( FIELD_INTEGER64, sizeof(int64))
DECLARE_FIELD_SIZE( FIELD_BOOLEAN, sizeof(char))
DECLARE_FIELD_SIZE( FIELD_SHORT, sizeof(short))
DECLARE_FIELD_SIZE( FIELD_CHARACTER, sizeof(char))
@ -165,6 +168,7 @@ DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) )
#ifndef NO_ENTITY_PREDICTION
// FTYPEDESC_KEY tells the prediction copy system to report the full nameof the field when reporting errors
#define DEFINE_PRED_TYPEDESCRIPTION( name, fieldtype ) \
{ FIELD_EMBEDDED, #name, { offsetof(classNameTypedef, name), 0 }, 1, FTYPEDESC_SAVE, NULL, NULL, NULL, &fieldtype::m_PredMap }
@ -247,7 +251,7 @@ struct typedescription_t;
enum
{
TD_OFFSET_NORMAL = 0,
// TD_OFFSET_PACKED = 1,
TD_OFFSET_PACKED = 1,
// Must be last
TD_OFFSET_COUNT,
@ -257,7 +261,7 @@ struct typedescription_t
{
fieldtype_t fieldType;
const char *fieldName;
int fieldOffset[ TD_OFFSET_COUNT ]; // 0 == normal, 1 == packed offset
int fieldOffset; // Local offset value
unsigned short fieldSize;
short flags;
// the name of the variable in the map/fgd data, or the name of the action
@ -280,8 +284,10 @@ struct typedescription_t
// Tolerance for field errors for float fields
float fieldTolerance;
int unknown[3];
// For raw fields (including children of embedded stuff) this is the flattened offset
int flatOffset[ TD_OFFSET_COUNT ];
unsigned short flatGroup;
};

View File

@ -103,7 +103,7 @@ typedef enum
DPT_Int=0,
DPT_Float,
DPT_Vector,
DPT_VectorXY,
DPT_VectorXY, // Only encodes the XY of a vector, ignores Z
DPT_String,
DPT_Array, // An array of the base types (can't be of datatables).
DPT_DataTable,
@ -117,50 +117,54 @@ typedef enum
class DVariant
{
public:
DVariant() {m_Type = DPT_Float;}
DVariant(float val) {m_Type = DPT_Float; m_Float = val;}
DVariant() {m_Type = DPT_Float;}
DVariant(float val) {m_Type = DPT_Float; m_Float = val;}
const char *ToString()
{
static char text[128];
const char *ToString()
{
static char text[128];
switch ( m_Type )
{
case DPT_Int :
Q_snprintf( text, sizeof(text), "%i", m_Int );
break;
case DPT_Float :
Q_snprintf( text, sizeof(text), "%.3f", m_Float );
break;
case DPT_Vector :
Q_snprintf( text, sizeof(text), "(%.3f,%.3f,%.3f)",
m_Vector[0], m_Vector[1], m_Vector[2] );
break;
switch ( m_Type )
{
case DPT_Int :
Q_snprintf( text, sizeof(text), "%i", m_Int );
break;
case DPT_Float :
Q_snprintf( text, sizeof(text), "%.3f", m_Float );
break;
case DPT_Vector :
Q_snprintf( text, sizeof(text), "(%.3f,%.3f,%.3f)",
m_Vector[0], m_Vector[1], m_Vector[2] );
break;
case DPT_VectorXY :
Q_snprintf( text, sizeof(text), "(%.3f,%.3f)",
m_Vector[0], m_Vector[1] );
break;
#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!!
case DPT_Quaternion :
Q_snprintf( text, sizeof(text), "(%.3f,%.3f,%.3f %.3f)",
m_Vector[0], m_Vector[1], m_Vector[2], m_Vector[3] );
break;
case DPT_Quaternion :
Q_snprintf( text, sizeof(text), "(%.3f,%.3f,%.3f %.3f)",
m_Vector[0], m_Vector[1], m_Vector[2], m_Vector[3] );
break;
#endif
case DPT_String :
if ( m_pString )
return m_pString;
else
return "NULL";
break;
case DPT_Array :
Q_snprintf( text, sizeof(text), "Array" );
break;
case DPT_DataTable :
Q_snprintf( text, sizeof(text), "DataTable" );
break;
default :
Q_snprintf( text, sizeof(text), "DVariant type %i unknown", m_Type );
break;
}
case DPT_String :
if ( m_pString )
return m_pString;
else
return "NULL";
break;
case DPT_Array :
Q_snprintf( text, sizeof(text), "Array" );
break;
case DPT_DataTable :
Q_snprintf( text, sizeof(text), "DataTable" );
break;
default :
Q_snprintf( text, sizeof(text), "DVariant type %i unknown", m_Type );
break;
}
return text;
}
return text;
}
union
{

View File

@ -202,7 +202,7 @@ public:
// If it's one of the numbered "000", "001", etc properties in an array, then
// these can be used to get its array property name for debugging.
const char* GetParentArrayPropName();
const char* GetParentArrayPropName() const;
void SetParentArrayPropName( const char *pArrayPropName );
const char* GetName() const;
@ -249,18 +249,15 @@ public:
float m_fLowValue;
float m_fHighValue;
SendProp *m_pArrayProp; // If this is an array, this is the property that defines each array element.
SendProp *m_pArrayProp; // If this is an array, this is the property that defines each array element.
ArrayLengthSendProxyFn m_ArrayLengthProxy; // This callback returns the array length.
int m_nElements; // Number of elements in the array (or 1 if it's not an array).
int m_ElementStride; // Pointer distance between array elements.
int m_nElements; // Number of elements in the array (or 1 if it's not an array).
int m_ElementStride; // Pointer distance between array elements.
const char *m_pExcludeDTName; // If this is an exclude prop, then this is the name of the datatable to exclude a prop from.
const char *m_pParentArrayPropName;
union
{
const char *m_pExcludeDTName; // If this is an exclude prop, then this is the name of the datatable to exclude a prop from.
const char *m_pParentArrayPropName;
};
int m_Unknown;
const char *m_pVarName;
float m_fHighLowMul;
@ -329,7 +326,7 @@ inline char const* SendProp::GetExcludeDTName() const
return m_pExcludeDTName;
}
inline const char* SendProp::GetParentArrayPropName()
inline const char* SendProp::GetParentArrayPropName() const
{
return m_pParentArrayPropName;
}
@ -614,6 +611,7 @@ void SendProxy_QAngles ( const SendProp *pProp, const void *pStruct, const voi
void SendProxy_AngleToFloat ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
void SendProxy_FloatToFloat ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
void SendProxy_VectorToVector ( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
void SendProxy_VectorXYToVectorXY( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!!
void SendProxy_QuaternionToQuaternion( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
#endif
@ -657,6 +655,16 @@ SendProp SendPropVector(
float fHighValue=HIGH_DEFAULT, // High value. If HIGH_DEFAULT, it's (1<<nBits).
SendVarProxyFn varProxy=SendProxy_VectorToVector
);
SendProp SendPropVectorXY(
const char *pVarName,
int offset,
int sizeofVar=SIZEOF_IGNORE,
int nBits=32, // Number of bits (for each floating-point component) to use when encoding.
int flags=SPROP_NOSCALE,
float fLowValue=0.0f, // For floating point, low and high values.
float fHighValue=HIGH_DEFAULT, // High value. If HIGH_DEFAULT, it's (1<<nBits).
SendVarProxyFn varProxy=SendProxy_VectorXYToVectorXY
);
#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!!
SendProp SendPropQuaternion(

View File

@ -19,6 +19,7 @@
#include "engine/ICollideable.h"
#include "iservernetworkable.h"
#include "bitvec.h"
#include "tier1/convar.h"
struct edict_t;
@ -59,19 +60,15 @@ public:
bool teamplay;
// current maxentities
int maxEntities;
// Number of servers spawned (-fork)
int serverCount;
// First edict/entity, usually worldspawn (0)
// - Replacement for IndexOfEntity: edict - baseEdict
// - Replacement for PEntityOfEntIndex: baseEdict + entIndex
edict_t *baseEdict;
edict_t *pEdicts;
};
inline CGlobalVars::CGlobalVars( bool bIsClient ) :
CGlobalVarsBase( bIsClient )
{
serverCount = 0;
}
@ -268,8 +265,8 @@ inline void CBaseEdict::ClearStateChanged()
inline void CBaseEdict::StateChanged()
{
// Note: this should only happen for properties in data tables that used some
// kind of pointer dereference. If the data is directly offsetable
// Note: this should only happen for properties in data tables that used some kind of pointer
// dereference. If the data is directly offsetable, then changes will automatically be detected
m_fStateFlags |= (FL_EDICT_CHANGED | FL_FULL_EDICT_CHANGED);
SetChangeInfoSerialNumber( 0 );
}
@ -419,9 +416,6 @@ struct edict_t : public CBaseEdict
{
public:
ICollideable *GetCollideable();
// The server timestampe at which the edict was freed (so we can try to use other edicts before reallocating this one)
// float freetime;
};
inline ICollideable *edict_t::GetCollideable()

View File

@ -57,7 +57,8 @@ class CStandardSendProxies;
class IAchievementMgr;
class CGamestatsData;
class CSteamID;
struct bbox_t;
class ISPSharedMemory;
class CGamestatsData;
typedef struct player_info_s player_info_t;
@ -73,6 +74,12 @@ typedef struct player_info_s player_info_t;
#define INTERFACEVERSION_VENGINESERVER "VEngineServer022"
struct bbox_t
{
Vector mins;
Vector maxs;
};
//-----------------------------------------------------------------------------
// Purpose: Interface the engine exposes to the game DLL
//-----------------------------------------------------------------------------
@ -123,13 +130,12 @@ public:
// returns -1 if the edict couldn't be found in the list of players.
virtual int GetPlayerUserId( const edict_t *e ) = 0;
virtual const char *GetPlayerNetworkIDString( const edict_t *e ) = 0;
virtual bool IsUserIDInUse ( int userid ) = 0;
virtual int GetLoadingProgressForUserID ( int userid ) = 0;
virtual bool IsUserIDInUse( int userID ) = 0; // TERROR: used for transitioning
virtual int GetLoadingProgressForUserID( int userID ) = 0; // TERROR: used for transitioning
// Return the current number of used edict slots
virtual int GetEntityCount( void ) = 0;
// Get stats info interface for a client netchannel
virtual INetChannelInfo* GetPlayerNetInfo( int playerIndex ) = 0;
@ -183,7 +189,7 @@ public:
// Begin a message from a server side entity to its client side counterpart (func_breakable glass, e.g.)
virtual bf_write *EntityMessageBegin( int ent_index, ServerClass * ent_class, bool reliable ) = 0;
// Begin a usermessage from the server to the client .dll
virtual bf_write *UserMessageBegin( IRecipientFilter *filter, int msg_type, const char *name ) = 0;
virtual bf_write *UserMessageBegin( IRecipientFilter *filter, int msg_type, char const *pchMsgName ) = 0;
// Finish the Entity or UserMessage and dispatch to network layer
virtual void MessageEnd( void ) = 0;
@ -265,8 +271,7 @@ public:
// Print a message to the server log file
virtual void LogPrint( const char *msg ) = 0;
virtual bool IsLogEnabled( void ) = 0;
virtual bool IsLogEnabled() = 0;
// Builds PVS information for an entity
virtual void BuildEntityClusterList( edict_t *pEdict, PVSInfo_t *pPVSInfo ) = 0;
@ -312,6 +317,8 @@ public:
// Is the engine in Commentary mode?
virtual int IsInCommentaryMode( void ) = 0;
// Is the engine running a background map?
virtual bool IsLevelMainMenuBackground( void ) = 0;
// Mark some area portals as open/closed. It's more efficient to use this
@ -357,8 +364,9 @@ public:
virtual int GetAppID() = 0;
virtual bool IsLowViolence() = 0;
virtual bool IsAnyClientLowViolence() = 0;
// Call this to find out the value of a cvar on the client.
//
// It is an asynchronous query, and it will call IServerGameDLL::OnQueryCvarValueFinished when
@ -376,32 +384,60 @@ public:
// Returns true if this client has been fully authenticated by Steam
virtual bool IsClientFullyAuthenticated( edict_t *pEdict ) = 0;
virtual bool IsSplitScreenPlayer( int ) = 0;
virtual int GetSplitScreenPlayerAttachToEdict( int ) = 0;
virtual int GetNumSplitScreenUsersAttachedToEdict( int ) = 0;
virtual int GetSplitScreenPlayerForEdict( int, int ) = 0;
virtual bool IsSplitScreenPlayer( int ent_num ) = 0;
virtual edict_t *GetSplitScreenPlayerAttachToEdict( int ent_num ) = 0;
virtual int GetNumSplitScreenUsersAttachedToEdict( int ent_num ) = 0;
virtual edict_t *GetSplitScreenPlayerForEdict( int ent_num, int nSlot ) = 0;
// Used by Foundry to hook into the loadgame process and override the entities that are getting loaded.
virtual bool IsOverrideLoadGameEntsOn() = 0;
virtual void ForceFlushEntity( int ) = 0;
virtual void *GetSinglePlayerSharedMemorySpace( char const * ) = 0;
virtual void *AllocLevelStaticData( unsigned int ) = 0;
// Used by Foundry when it changes an entity (and possibly its class) but preserves its serial number.
virtual void ForceFlushEntity( int iEntity ) = 0;
//Finds or Creates a shared memory space, the returned pointer will automatically be AddRef()ed
virtual ISPSharedMemory *GetSinglePlayerSharedMemorySpace( const char *szName, int ent_num = MAX_EDICTS ) = 0;
// Allocate hunk memory
virtual void *AllocLevelStaticData( size_t bytes ) = 0;
// Gets a list of all clusters' bounds. Returns total number of clusters.
virtual int GetClusterCount() = 0;
virtual void *GetAllClusterBounds( bbox_t *, int ) = 0;
virtual int GetAllClusterBounds( bbox_t *pBBoxList, int maxBBox ) = 0;
virtual bool IsCreatingReslist() = 0;
virtual bool IsCreatingXboxReslist() = 0;
virtual bool IsDedicatedServerForXbox() = 0;
virtual void Pause( bool, bool ) = 0;
virtual void Pause( bool bPause, bool bForce = false ) = 0;
// Methods to set/get a gamestats data container so client & server running in same process can send combined data
virtual void SetGamestatsData( CGamestatsData *pGamestatsData ) = 0;
virtual CGamestatsData *GetGamestatsData() = 0;
// Validate session
virtual void HostValidateSession() = 0;
// Update the 360 pacifier/spinner
virtual void RefreshScreenIfNecessary() = 0;
virtual bool IsReserved() = 0;
virtual void *AllocLevelStaticDataName( unsigned int, const char * ) = 0;
// Send a client command keyvalues
// keyvalues are deleted inside the function
virtual void ClientCommandKeyValues( edict_t *pEdict, KeyValues *pCommand ) = 0;
// get arbitrary launch options
virtual KeyValues* GetLaunchOptions( void ) = 0;
// This makes the host run 1 tick per frame instead of checking the system timer to see how many ticks to run in a certain frame.
// i.e. it does the same thing timedemo does.
virtual void SetDedicatedServerBenchmarkMode( bool bBenchmarkMode ) = 0;
// Returns the SteamID of the specified player. It'll be NULL if the player hasn't authenticated yet.
virtual const CSteamID *GetClientSteamID( edict_t *pPlayerEdict ) = 0;
};
#define INTERFACEVERSION_SERVERGAMEDLL_VERSION_4 "ServerGameDLL004"
@ -509,12 +545,22 @@ public:
// iCookie is the value returned by IServerPluginHelpers::StartQueryCvarValue.
// Added with version 2 of the interface.
virtual void OnQueryCvarValueFinished( QueryCvarCookie_t iCookie, edict_t *pPlayerEntity, EQueryCvarValueStatus eStatus, const char *pCvarName, const char *pCvarValue ) = 0;
// Called after tools are initialized (i.e. when Foundry is initialized so we can get IServerFoundry).
virtual void PostToolsInit() = 0;
virtual void PostToolsInit( void ) = 0;
virtual void ApplyGameSettings( KeyValues * ) = 0;
virtual const char * GetGameModeConfigFile( int ) = 0;
virtual int GameGameModePlayerSlots( int ) = 0;
virtual void GetMatchmakingTags( char *, unsigned int ) = 0;
// Called to apply lobby settings to a dedicated server
virtual void ApplyGameSettings( KeyValues *pKV ) = 0;
virtual void GetMatchmakingTags( char *buf, size_t bufSize ) = 0;
virtual void ServerHibernationUpdate( bool bHibernating ) = 0;
virtual void GenerateLumpFileName( const char *, char *, int, int ) = 0;
virtual void GetMatchmakingGameData( char *buf, size_t bufSize ) = 0;
virtual bool SupportsSaveRestore() = 0;
};
//-----------------------------------------------------------------------------
@ -549,8 +595,9 @@ public:
// This is also where an entity can force other entities to be transmitted if it refers to them
// with ehandles.
virtual void CheckTransmit( CCheckTransmitInfo *pInfo, const unsigned short *pEdictIndices, int nEdicts ) = 0;
virtual void PrepareForFullUpdate( edict_t * ) = 0;
// TERROR: Perform any PVS cleanup before a full update
virtual void PrepareForFullUpdate( edict_t *pEdict ) = 0;
};
#define INTERFACEVERSION_SERVERGAMECLIENTS "ServerGameClients003"
@ -609,15 +656,21 @@ public:
// Anything this game .dll wants to add to the bug reporter text (e.g., the entity/model under the picker crosshair)
// can be added here
virtual void GetBugReportInfo( char *buf, int buflen ) = 0;
virtual void ClientVoice( edict_t * ) = 0;
// TERROR: A player sent a voice packet
virtual void ClientVoice( edict_t *pEdict ) = 0;
// A user has had their network id setup and validated
virtual void NetworkIDValidated( const char *pszUserName, const char *pszNetworkID ) = 0;
virtual int GetMaxSplitscreenPlayers( void ) = 0;
virtual int GetMaxHumanPlayers( void ) = 0;
// Returns max splitscreen slot count ( 1 == no splits, 2 for 2-player split screen )
virtual int GetMaxSplitscreenPlayers() = 0;
// Return # of human slots, -1 if can't determine or don't care (engine will assume it's == maxplayers )
virtual int GetMaxHumanPlayers() = 0;
// The client has submitted a keyvalues command
virtual void ClientCommandKeyValues( edict_t *pEntity, KeyValues *pKeyValues ) = 0;
};
#define INTERFACEVERSION_UPLOADGAMESTATS "ServerUploadGameStats001"
@ -677,4 +730,16 @@ public:
#define SERVER_DLL_SHARED_APPSYSTEMS "VServerDllSharedAppSystems001"
#define INTERFACEVERSION_SERVERGAMETAGS "ServerGameTags001"
//-----------------------------------------------------------------------------
// Purpose: querying the game dll for Server cvar tags
//-----------------------------------------------------------------------------
abstract_class IServerGameTags
{
public:
// Get the list of cvars that require tags to show differently in the server browser
virtual void GetTaggedConVarList( KeyValues *pCvarTagList ) = 0;
};
#endif // EIFACE_H

View File

@ -1,614 +0,0 @@
//====== Copyright <20> 1996-2004, Valve Corporation, All rights reserved. =======
//
// Defines entity interface between engine and DLLs.
// This header file included by engine files and DLL files.
//
// Before including this header, DLLs must:
// include edict.h
// This is conveniently done for them in extdll.h
//
// $NoKeywords: $
//
//=============================================================================
#ifndef EIFACEV21_H
#define EIFACEV21_H
#ifdef _WIN32
#pragma once
#endif
#include "convar.h"
#include "icvar.h"
#include "edict.h"
#include "iserverentity.h"
#include "engine/ivmodelinfo.h"
#include "soundflags.h"
#include "bitvec.h"
//-----------------------------------------------------------------------------
// forward declarations
//-----------------------------------------------------------------------------
class SendTable;
class ServerClass;
class IMoveHelper;
struct Ray_t;
class CGameTrace;
typedef CGameTrace trace_t;
struct typedescription_t;
class CSaveRestoreData;
struct datamap_t;
class SendTable;
class ServerClass;
class IMoveHelper;
struct Ray_t;
struct studiohdr_t;
class CBaseEntity;
class CRestore;
class CSave;
class variant_t;
struct vcollide_t;
class bf_read;
class bf_write;
class IRecipientFilter;
class CBaseEntity;
class ITraceFilter;
struct client_textmessage_t;
class INetChannelInfo;
class ISpatialPartition;
class IScratchPad3D;
class CStandardSendProxiesV1;
// Terrain Modification Types
enum TerrainModType
{
TMod_Sphere = 0, // sphere that pushes all vertices out along their normal.
TMod_Suck,
TMod_AABB
};
class CTerrainModParams
{
public:
// Flags for m_Flags.
enum
{
TMOD_SUCKTONORMAL = ( 1 << 0 ), // For TMod_Suck, suck into m_Normal rather than on +Z.
TMOD_STAYABOVEORIGINAL = ( 1 << 1 ) // For TMod_Suck, don't go below the original vert on Z.
};
CTerrainModParams() { m_Flags = 0; } // people always forget to init this
Vector m_vCenter;
Vector m_vNormal; // If TMod_Suck and TMOD_SUCKTONORMAL is set.
int m_Flags; // Combination of TMOD_ flags.
float m_flRadius;
Vector m_vecMin; // Bounding box.
Vector m_vecMax;
float m_flStrength; // for TMod_Suck
float m_flMorphTime; // time over which the morph takes place
};
class CSpeculativeTerrainModVert
{
public:
Vector m_vOriginal; // vertex position before any mods
Vector m_vCurrent; // current vertex position
Vector m_vNew; // vertex position if the mod were applied
};
//-----------------------------------------------------------------------------
// Terrain modification interface
//-----------------------------------------------------------------------------
class ITerrainMod
{
public:
//---------------------------------------------------------------------
// Initialize the terrain modifier.
//---------------------------------------------------------------------
virtual void Init( const CTerrainModParams &params ) = 0;
//---------------------------------------------------------------------
// Apply the terrain modifier to the surface. The vertex should be
// moved from its original position to the target position.
// Return true if the position is modified.
//---------------------------------------------------------------------
virtual bool ApplyMod( Vector &vecTargetPos, Vector const &vecOriginalPos ) = 0;
//---------------------------------------------------------------------
// Apply the terrain modifier to the surface. The vertex should from
// its original position toward the target position bassed on the
// morph time.
// Return true if the posistion is modified.
//---------------------------------------------------------------------
virtual bool ApplyModAtMorphTime( Vector &vecTargetPos, const Vector&vecOriginalPos,
float flCurrentTime, float flMorphTime ) = 0;
//---------------------------------------------------------------------
// Get the bounding box for things that this mod can affect (note that
// it CAN move things outside of this bounding box).
//---------------------------------------------------------------------
virtual void GetBBox( Vector &vecBBMin, Vector &vecBBMax ) = 0;
};
//-----------------------------------------------------------------------------
// Purpose: Interface the engine exposes to the game DLL
//-----------------------------------------------------------------------------
#define VENGINESERVER_INTERFACEVERSION_21 "VEngineServer021"
namespace VEngineServerV21
{
abstract_class IVEngineServer
{
public:
// Tell engine to change level ( "changelevel s1\n" or "changelevel2 s1 s2\n" )
virtual void ChangeLevel( const char *s1, const char *s2 ) = 0;
// Ask engine whether the specified map is a valid map file (exists and has valid version number).
virtual int IsMapValid( const char *filename ) = 0;
// Is this a dedicated server?
virtual bool IsDedicatedServer( void ) = 0;
// Is in Hammer editing mode?
virtual int IsInEditMode( void ) = 0;
// Add to the server/client lookup/precache table, the specified string is given a unique index
// NOTE: The indices for PrecacheModel are 1 based
// a 0 returned from those methods indicates the model or sound was not correctly precached
// However, generic and decal are 0 based
// If preload is specified, the file is loaded into the server/client's cache memory before level startup, otherwise
// it'll only load when actually used (which can cause a disk i/o hitch if it occurs during play of a level).
virtual int PrecacheModel( const char *s, bool preload = false ) = 0;
virtual int PrecacheSentenceFile( const char *s, bool preload = false ) = 0;
virtual int PrecacheDecal( const char *name, bool preload = false ) = 0;
virtual int PrecacheGeneric( const char *s, bool preload = false ) = 0;
// Check's if the name is precached, but doesn't actually precache the name if not...
virtual bool IsModelPrecached( char const *s ) const = 0;
virtual bool IsDecalPrecached( char const *s ) const = 0;
virtual bool IsGenericPrecached( char const *s ) const = 0;
// Note that sounds are precached using the IEngineSound interface
// Special purpose PVS checking
// Get the cluster # for the specified position
virtual int GetClusterForOrigin( const Vector &org ) = 0;
// Get the PVS bits for a specified cluster and copy the bits into outputpvs. Returns the number of bytes needed to pack the PVS
virtual int GetPVSForCluster( int cluster, int outputpvslength, unsigned char *outputpvs ) = 0;
// Check whether the specified origin is inside the specified PVS
virtual bool CheckOriginInPVS( const Vector &org, const unsigned char *checkpvs, int checkpvssize ) = 0;
// Check whether the specified worldspace bounding box is inside the specified PVS
virtual bool CheckBoxInPVS( const Vector &mins, const Vector &maxs, const unsigned char *checkpvs, int checkpvssize ) = 0;
// Returns the server assigned userid for this player. Useful for logging frags, etc.
// returns -1 if the edict couldn't be found in the list of players.
virtual int GetPlayerUserId( const edict_t *e ) = 0;
virtual const char *GetPlayerNetworkIDString( const edict_t *e ) = 0;
// Return the current number of used edict slots
virtual int GetEntityCount( void ) = 0;
// Given an edict, returns the entity index
virtual int IndexOfEdict( const edict_t *pEdict ) = 0;
// Given and entity index, returns the corresponding edict pointer
virtual edict_t *PEntityOfEntIndex( int iEntIndex ) = 0;
// Get stats info interface for a client netchannel
virtual INetChannelInfo* GetPlayerNetInfo( int playerIndex ) = 0;
// Allocate space for string and return index/offset of string in global string list
// If iForceEdictIndex is not -1, then it will return the edict with that index. If that edict index
// is already used, it'll return null.
virtual edict_t *CreateEdict( int iForceEdictIndex = -1 ) = 0;
// Remove the specified edict and place back into the free edict list
virtual void RemoveEdict( edict_t *e ) = 0;
// Memory allocation for entity class data
virtual void *PvAllocEntPrivateData( long cb ) = 0;
virtual void FreeEntPrivateData( void *pEntity ) = 0;
// Save/restore uses a special memory allocator (which zeroes newly allocated memory, etc.)
virtual void *SaveAllocMemory( size_t num, size_t size ) = 0;
virtual void SaveFreeMemory( void *pSaveMem ) = 0;
// Emit an ambient sound associated with the specified entity
virtual void EmitAmbientSound( int entindex, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay = 0.0f ) = 0;
// Fade out the client's volume level toward silence (or fadePercent)
virtual void FadeClientVolume( const edict_t *pEdict, float fadePercent, float fadeOutSeconds, float holdTime, float fadeInSeconds ) = 0;
// Sentences / sentence groups
virtual int SentenceGroupPick( int groupIndex, char *name, int nameBufLen ) = 0;
virtual int SentenceGroupPickSequential( int groupIndex, char *name, int nameBufLen, int sentenceIndex, int reset ) = 0;
virtual int SentenceIndexFromName( const char *pSentenceName ) = 0;
virtual const char *SentenceNameFromIndex( int sentenceIndex ) = 0;
virtual int SentenceGroupIndexFromName( const char *pGroupName ) = 0;
virtual const char *SentenceGroupNameFromIndex( int groupIndex ) = 0;
virtual float SentenceLength( int sentenceIndex ) = 0;
// Issue a command to the command parser as if it was typed at the server console.
virtual void ServerCommand( const char *str ) = 0;
// Execute any commands currently in the command parser immediately (instead of once per frame)
virtual void ServerExecute( void ) = 0;
// Issue the specified command to the specified client (mimics that client typing the command at the console).
virtual void ClientCommand( edict_t *pEdict, const char *szFmt, ... ) = 0;
// Set the lightstyle to the specified value and network the change to any connected clients. Note that val must not
// change place in memory (use MAKE_STRING) for anything that's not compiled into your mod.
virtual void LightStyle( int style, const char *val ) = 0;
// Project a static decal onto the specified entity / model (for level placed decals in the .bsp)
virtual void StaticDecal( const Vector &originInEntitySpace, int decalIndex, int entityIndex, int modelIndex, bool lowpriority ) = 0;
// Given the current PVS(or PAS) and origin, determine which players should hear/receive the message
virtual void Message_DetermineMulticastRecipients( bool usepas, const Vector& origin, CBitVec< ABSOLUTE_PLAYER_LIMIT >& playerbits ) = 0;
// Begin a message from a server side entity to its client side counterpart (func_breakable glass, e.g.)
virtual bf_write *EntityMessageBegin( int ent_index, ServerClass * ent_class, bool reliable ) = 0;
// Begin a usermessage from the server to the client .dll
virtual bf_write *UserMessageBegin( IRecipientFilter *filter, int msg_type ) = 0;
// Finish the Entity or UserMessage and dispatch to network layer
virtual void MessageEnd( void ) = 0;
// Print szMsg to the client console.
virtual void ClientPrintf( edict_t *pEdict, const char *szMsg ) = 0;
// SINGLE PLAYER/LISTEN SERVER ONLY (just matching the client .dll api for this)
// Prints the formatted string to the notification area of the screen ( down the right hand edge
// numbered lines starting at position 0
virtual void Con_NPrintf( int pos, const char *fmt, ... ) = 0;
// SINGLE PLAYER/LISTEN SERVER ONLY(just matching the client .dll api for this)
// Similar to Con_NPrintf, but allows specifying custom text color and duration information
virtual void Con_NXPrintf( const struct con_nprint_s *info, const char *fmt, ... ) = 0;
// For ConCommand parsing or parsing client commands issued by players typing at their console
// Retrieves the raw command string (untokenized)
virtual const char *Cmd_Args( void ) = 0;
// Returns the number of tokens in the command string
virtual int Cmd_Argc( void ) = 0;
// Retrieves a specified token
virtual char *Cmd_Argv( int argc ) = 0;
// Change a specified player's "view entity" (i.e., use the view entity position/orientation for rendering the client view)
virtual void SetView( const edict_t *pClient, const edict_t *pViewent ) = 0;
// Get a high precision timer for doing profiling work
virtual float Time( void ) = 0;
// Set the player's crosshair angle
virtual void CrosshairAngle( const edict_t *pClient, float pitch, float yaw ) = 0;
// Get the current game directory (hl2, tf2, hl1, cstrike, etc.)
virtual void GetGameDir( char *szGetGameDir, int maxlength ) = 0;
// Used by AI node graph code to determine if .bsp and .ain files are out of date
virtual int CompareFileTime( const char *filename1, const char *filename2, int *iCompare ) = 0;
// Locks/unlocks the network string tables (.e.g, when adding bots to server, this needs to happen).
// Be sure to reset the lock after executing your code!!!
virtual bool LockNetworkStringTables( bool lock ) = 0;
// Create a bot with the given name. Returns NULL if fake client can't be created
virtual edict_t *CreateFakeClient( const char *netname ) = 0;
// Get a convar keyvalue for s specified client
virtual const char *GetClientConVarValue( int clientIndex, const char *name ) = 0;
// Parse a token from a file
virtual const char *ParseFile( const char *data, char *token, int maxlen ) = 0;
// Copies a file
virtual bool CopyFile( const char *source, const char *destination ) = 0;
// Reset the pvs, pvssize is the size in bytes of the buffer pointed to by pvs.
// This should be called right before any calls to AddOriginToPVS
virtual void ResetPVS( byte *pvs, int pvssize ) = 0;
// Merge the pvs bits into the current accumulated pvs based on the specified origin ( not that each pvs origin has an 8 world unit fudge factor )
virtual void AddOriginToPVS( const Vector &origin ) = 0;
// Mark a specified area portal as open/closes
virtual void SetAreaPortalState( int portalNumber, int isOpen ) = 0;
// Queue a temp entity for transmission
virtual void PlaybackTempEntity( IRecipientFilter& filter, float delay, const void *pSender, const SendTable *pST, int classID ) = 0;
// Given a node number and the specified PVS, return with the node is in the PVS
virtual int CheckHeadnodeVisible( int nodenum, const byte *pvs, int vissize ) = 0;
// Using area bits, cheeck whether area1 flows into area2 and vice versa (depends on area portal state)
virtual int CheckAreasConnected( int area1, int area2 ) = 0;
// Given an origin, determine which area index the origin is within
virtual int GetArea( const Vector &origin ) = 0;
// Get area portal bit set
virtual void GetAreaBits( int area, unsigned char *bits, int buflen ) = 0;
// Given a view origin (which tells us the area to start looking in) and a portal key,
// fill in the plane that leads out of this area (it points into whatever area it leads to).
virtual bool GetAreaPortalPlane( Vector const &vViewOrigin, int portalKey, VPlane *pPlane ) = 0;
// Apply a modification to the terrain.
virtual void ApplyTerrainMod( TerrainModType type, CTerrainModParams const &params ) = 0;
// Save/restore wrapper - FIXME: At some point we should move this to it's own interface
virtual bool LoadGameState( char const *pMapName, bool createPlayers ) = 0;
virtual void LoadAdjacentEnts( const char *pOldLevel, const char *pLandmarkName ) = 0;
virtual void ClearSaveDir() = 0;
// Get the pristine map entity lump string. (e.g., used by CS to reload the map entities when restarting a round.)
virtual const char* GetMapEntitiesString() = 0;
// Text message system -- lookup the text message of the specified name
virtual client_textmessage_t *TextMessageGet( const char *pName ) = 0;
// Print a message to the server log file
virtual void LogPrint( const char *msg ) = 0;
// Builds PVS information for an entity
virtual void BuildEntityClusterList( edict_t *pEdict, PVSInfo_t *pPVSInfo ) = 0;
// A solid entity moved, update spatial partition
virtual void SolidMoved( edict_t *pSolidEnt, ICollideable *pSolidCollide, const Vector* pPrevAbsOrigin ) = 0;
// A trigger entity moved, update spatial partition
virtual void TriggerMoved( edict_t *pTriggerEnt ) = 0;
// Create/destroy a custom spatial partition
virtual ISpatialPartition *CreateSpatialPartition( const Vector& worldmin, const Vector& worldmax ) = 0;
virtual void DestroySpatialPartition( ISpatialPartition * ) = 0;
// Draw the brush geometry in the map into the scratch pad.
// Flags is currently unused.
virtual void DrawMapToScratchPad( IScratchPad3D *pPad, unsigned long iFlags ) = 0;
// This returns which entities, to the best of the server's knowledge, the client currently knows about.
// This is really which entities were in the snapshot that this client last acked.
// This returns a bit vector with one bit for each entity.
//
// USE WITH CARE. Whatever tick the client is really currently on is subject to timing and
// ordering differences, so you should account for about a quarter-second discrepancy in here.
// Also, this will return NULL if the client doesn't exist or if this client hasn't acked any frames yet.
//
// iClientIndex is the CLIENT index, so if you use pPlayer->entindex(), subtract 1.
virtual const CBitVec<MAX_EDICTS>* GetEntityTransmitBitsForClient( int iClientIndex ) = 0;
// Is the game paused?
virtual bool IsPaused() = 0;
// Marks the filename for consistency checking. This should be called after precaching the file.
virtual void ForceExactFile( const char *s ) = 0;
virtual void ForceModelBounds( const char *s, const Vector &mins, const Vector &maxs ) = 0;
virtual void ClearSaveDirAfterClientLoad() = 0;
// Sets a USERINFO client ConVar for a fakeclient
virtual void SetFakeClientConVarValue( edict_t *pEntity, const char *cvar, const char *value ) = 0;
virtual void InsertServerCommand( const char *str ) = 0;
// Marks the material (vmt file) for consistency checking. If the client and server have different
// contents for the file, the client's vmt can only use the VertexLitGeneric shader, and can only
// contain $baseTexture and $bumpmap vars.
virtual void ForceSimpleMaterial( const char *s ) = 0;
// Is the engine in Commentary mode?
virtual int IsInCommentaryMode( void ) = 0;
};
} // end namespace
//-----------------------------------------------------------------------------
// Purpose: These are the interfaces that the game .dll exposes to the engine
//-----------------------------------------------------------------------------
#define SERVERGAMEDLL_INTERFACEVERSION_3 "ServerGameDLL003"
namespace ServerGameDLLV3
{
abstract_class IServerGameDLL
{
public:
// Initialize the game (one-time call when the DLL is first loaded )
// Return false if there is an error during startup.
virtual bool DLLInit( CreateInterfaceFn engineFactory,
CreateInterfaceFn physicsFactory,
CreateInterfaceFn fileSystemFactory,
CGlobalVars *pGlobals) = 0;
// This is called when a new game is started. (restart, map)
virtual bool GameInit( void ) = 0;
// Called any time a new level is started (after GameInit() also on level transitions within a game)
virtual bool LevelInit( char const *pMapName,
char const *pMapEntities, char const *pOldLevel,
char const *pLandmarkName, bool loadGame, bool background ) = 0;
// The server is about to activate
virtual void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ) = 0;
// The server should run physics/think on all edicts
virtual void GameFrame( bool simulating ) = 0;
// Called once per simulation frame on the final tick
virtual void PreClientUpdate( bool simulating ) = 0;
// Called when a level is shutdown (including changing levels)
virtual void LevelShutdown( void ) = 0;
// This is called when a game ends (server disconnect, death, restart, load)
// NOT on level transitions within a game
virtual void GameShutdown( void ) = 0;
// Called once during DLL shutdown
virtual void DLLShutdown( void ) = 0;
// Get the simulation interval (must be compiled with identical values into both client and game .dll for MOD!!!)
// Right now this is only requested at server startup time so it can't be changed on the fly, etc.
virtual float GetTickInterval( void ) const = 0;
// Give the list of datatable classes to the engine. The engine matches class names from here with
// edict_t::classname to figure out how to encode a class's data for networking
virtual ServerClass* GetAllServerClasses( void ) = 0;
// Returns string describing current .dll. e.g., TeamFortress 2, Half-Life 2.
// Hey, it's more descriptive than just the name of the game directory
virtual const char *GetGameDescription( void ) = 0;
// Let the game .dll allocate it's own network/shared string tables
virtual void CreateNetworkStringTables( void ) = 0;
// Save/restore system hooks
virtual CSaveRestoreData *SaveInit( int size ) = 0;
virtual void SaveWriteFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int ) = 0;
virtual void SaveReadFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int ) = 0;
virtual void SaveGlobalState( CSaveRestoreData * ) = 0;
virtual void RestoreGlobalState( CSaveRestoreData * ) = 0;
virtual void PreSave( CSaveRestoreData * ) = 0;
virtual void Save( CSaveRestoreData * ) = 0;
virtual void GetSaveComment( char *comment, int maxlength ) = 0;
virtual void WriteSaveHeaders( CSaveRestoreData * ) = 0;
virtual void ReadRestoreHeaders( CSaveRestoreData * ) = 0;
virtual void Restore( CSaveRestoreData *, bool ) = 0;
virtual bool IsRestoring() = 0;
// Returns the number of entities moved across the transition
virtual int CreateEntityTransitionList( CSaveRestoreData *, int ) = 0;
// Build the list of maps adjacent to the current map
virtual void BuildAdjacentMapList( void ) = 0;
// Retrieve info needed for parsing the specified user message
virtual bool GetUserMessageInfo( int msg_type, char *name, int maxnamelength, int& size ) = 0;
// Hand over the StandardSendProxies in the game DLL's module.
virtual CStandardSendProxiesV1* GetStandardSendProxies() = 0;
};
} // end namespace
//-----------------------------------------------------------------------------
// Just an interface version name for the random number interface
// See vstdlib/random.h for the interface definition
// NOTE: If you change this, also change VENGINE_CLIENT_RANDOM_INTERFACE_VERSION in cdll_int.h
//-----------------------------------------------------------------------------
#define VENGINE_SERVER_RANDOM_INTERFACE_VERSION_1 "VEngineRandom001"
//-----------------------------------------------------------------------------
// Purpose: Interface to get at server entities
//-----------------------------------------------------------------------------
#define SERVERGAMEENTS_INTERFACEVERSION_1 "ServerGameEnts001"
namespace ServerGameEntsV1
{
abstract_class IServerGameEnts
{
public:
virtual ~IServerGameEnts() {}
// Only for debugging. Set the edict base so you can get an edict's index in the debugger while debugging the game .dll
virtual void SetDebugEdictBase(edict_t *base) = 0;
// The engine wants to mark two entities as touching
virtual void MarkEntitiesAsTouching( edict_t *e1, edict_t *e2 ) = 0;
// Frees the entity attached to this edict
virtual void FreeContainingEntity( edict_t * ) = 0;
// This allows the engine to get at edicts in a CGameTrace.
virtual edict_t* BaseEntityToEdict( CBaseEntity *pEnt ) = 0;
virtual CBaseEntity* EdictToBaseEntity( edict_t *pEdict ) = 0;
// This sets a bit in pInfo for each edict in the list that wants to be transmitted to the
// client specified in pInfo.
//
// This is also where an entity can force other entities to be transmitted if it refers to them
// with ehandles.
virtual void CheckTransmit( CCheckTransmitInfo *pInfo, const unsigned short *pEdictIndices, int nEdicts ) = 0;
};
} // end namespace ServerGameEntsV1
//-----------------------------------------------------------------------------
// Purpose: Player / Client related functions
//-----------------------------------------------------------------------------
#define SERVERGAMECLIENTS_INTERFACEVERSION_3 "ServerGameClients003"
namespace ServerGameClientsV3
{
abstract_class IServerGameClients
{
public:
// Get server maxplayers and lower bound for same
virtual void GetPlayerLimits( int& minplayers, int& maxplayers, int &defaultMaxPlayers ) const = 0;
// Client is connecting to server ( return false to reject the connection )
// You can specify a rejection message by writing it into reject
virtual bool ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen ) = 0;
// Client is going active
// If bLoadGame is true, don't spawn the player because its state is already setup.
virtual void ClientActive( edict_t *pEntity, bool bLoadGame ) = 0;
// Client is disconnecting from server
virtual void ClientDisconnect( edict_t *pEntity ) = 0;
// Client is connected and should be put in the game
virtual void ClientPutInServer( edict_t *pEntity, char const *playername ) = 0;
// The client has typed a command at the console
virtual void ClientCommand( edict_t *pEntity ) = 0;
// Sets the client index for the client who typed the command into his/her console
virtual void SetCommandClient( int index ) = 0;
// A player changed one/several replicated cvars (name etc)
virtual void ClientSettingsChanged( edict_t *pEdict ) = 0;
// Determine PVS origin and set PVS for the player/viewentity
virtual void ClientSetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char *pvs, int pvssize ) = 0;
// A block of CUserCmds has arrived from the user, decode them and buffer for execution during player simulation
virtual float ProcessUsercmds( edict_t *player, bf_read *buf, int numcmds, int totalcmds,
int dropped_packets, bool ignore, bool paused ) = 0;
// Let the game .dll do stuff after messages have been sent to all of the clients once the server frame is complete
virtual void PostClientMessagesSent( void ) = 0;
// For players, looks up the CPlayerState structure corresponding to the player
virtual CPlayerState *GetPlayerState( edict_t *player ) = 0;
// Get the ear position for a specified client
virtual void ClientEarPosition( edict_t *pEntity, Vector *pEarOrigin ) = 0;
// returns number of delay ticks if player is in Replay mode (0 = no delay)
virtual int GetReplayDelay( edict_t *player ) = 0;
// Anything this game .dll wants to add to the bug reporter text (e.g., the entity/model under the picker crosshair)
// can be added here
virtual void GetBugReportInfo( char *buf, int buflen ) = 0;
};
} // end namespace ServerGameClientsV3
#define UPLOADGAMESTATS_INTERFACEVERSION_1 "ServerUploadGameStats001"
namespace UploadGameStatsV1
{
abstract_class IUploadGameStats
{
public:
// Note that this call will block the server until the upload is completed, so use only at levelshutdown if at all.
virtual bool UploadGameStats(
char const *mapname, // Game map name
unsigned int blobversion, // Version of the binary blob data
unsigned int blobsize, // Size in bytes of blob data
const void *pvBlobData ) = 0; // Pointer to the blob data.
};
} // end namespace UploadGameStatsV1
#endif // EIFACEV21_H

View File

@ -59,8 +59,6 @@ public:
virtual bool PrecacheSound( const char *pSample, bool bPreload = false, bool bIsUISound = false ) = 0;
virtual bool IsSoundPrecached( const char *pSample ) = 0;
virtual void PrefetchSound( const char *pSample ) = 0;
// Client only
virtual bool IsLoopingSound( const char *pSample ) = 0;
// Just loads the file header and checks for duration (not hooked up for .mp3's yet)
@ -119,9 +117,11 @@ public:
virtual void PrecacheSentenceGroup( const char *pGroupName ) = 0;
virtual void NotifyBeginMoviePlayback() = 0;
virtual void NotifyEndMoviePlayback() = 0;
virtual bool GetSoundChannelVolume( const char* sound, float &flVolumeLeft, float &flVolumeRight ) = 0;
// Client only
virtual float GetSoundChannelVolume( const char *, float &, float & ) = 0;
virtual float GetElapsedTimeByGuid( int guid ) = 0;
};

View File

@ -15,6 +15,7 @@
#include "basehandle.h"
#include "utlvector.h" //need CUtlVector for IEngineTrace::GetBrushesIn*()
#include "mathlib/vector4d.h"
#include "bspflags.h"
class Vector;
class IHandleEntity;
@ -23,6 +24,7 @@ class CGameTrace;
typedef CGameTrace trace_t;
class ICollideable;
class QAngle;
class ITraceListData;
class CPhysCollide;
struct cplane_t;
@ -44,16 +46,6 @@ public:
virtual TraceType_t GetTraceType() const = 0;
};
abstract_class ITraceListData
{
public:
virtual ~ITraceListData() {};
virtual void Reset() = 0;
virtual bool IsEmpty() = 0;
virtual bool CanTraceRay( const Ray_t &ray ) = 0;
};
//-----------------------------------------------------------------------------
// Classes are expected to inherit these + implement the ShouldHitEntity method
@ -138,9 +130,11 @@ abstract_class IEngineTrace
{
public:
// Returns the contents mask + entity at a particular world-space position
virtual int GetPointContents( const Vector &vecAbsPosition, int mask = 0, IHandleEntity** ppEntity = NULL ) = 0;
virtual int GetPointContents( const Vector &vecAbsPosition, int contentsMask = MASK_ALL, IHandleEntity** ppEntity = NULL ) = 0;
virtual int GetPointContents_WorldOnly( const Vector &vecAbsPosition, int mask = 0 ) = 0;
// Returns the contents mask of the world only @ the world-space position (static props are ignored)
virtual int GetPointContents_WorldOnly( const Vector &vecAbsPosition, int contentsMask = MASK_ALL ) = 0;
// Get the point contents, but only test the specific entity. This works
// on static props and brush models.
//
@ -158,9 +152,9 @@ public:
virtual void TraceRay( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace ) = 0;
// A version that sets up the leaf and entity lists and allows you to pass those in for collision.
virtual void SetupLeafAndEntityListRay( const Ray_t &ray, ITraceListData *traceData ) = 0;
virtual void SetupLeafAndEntityListBox( const Vector &vecBoxMin, const Vector &vecBoxMax, ITraceListData *traceData ) = 0;
virtual void TraceRayAgainstLeafAndEntityList( const Ray_t &ray, ITraceListData *traceData, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace ) = 0;
virtual void SetupLeafAndEntityListRay( const Ray_t &ray, ITraceListData *pTraceData ) = 0;
virtual void SetupLeafAndEntityListBox( const Vector &vecBoxMin, const Vector &vecBoxMax, ITraceListData *pTraceData ) = 0;
virtual void TraceRayAgainstLeafAndEntityList( const Ray_t &ray, ITraceListData *pTraceData, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace ) = 0;
// A version that sweeps a collideable through the world
// abs start + abs end represents the collision origins you want to sweep the collideable through
@ -195,9 +189,9 @@ public:
// Walks bsp to find the leaf containing the specified point
virtual int GetLeafContainingPoint( const Vector &ptTest ) = 0;
virtual ITraceListData *AllocTraceListData( void ) = 0;
virtual void FreeTraceListData( ITraceListData *traceData ) = 0;
virtual ITraceListData *AllocTraceListData() = 0;
virtual void FreeTraceListData(ITraceListData *) = 0;
};

View File

@ -35,6 +35,17 @@ class CUtlBuffer;
class IClientRenderable;
//-----------------------------------------------------------------------------
// Indicates the type of translucency of an unmodulated renderable
//-----------------------------------------------------------------------------
enum RenderableTranslucencyType_t
{
RENDERABLE_IS_OPAQUE = 0,
RENDERABLE_IS_TRANSLUCENT,
RENDERABLE_IS_TWO_PASS, // has both translucent and opaque sub-partsa
};
//-----------------------------------------------------------------------------
// Model info interface
//-----------------------------------------------------------------------------
@ -64,8 +75,8 @@ public:
virtual bool ModelHasMaterialProxy( const model_t *model ) const = 0;
virtual bool IsTranslucent( model_t const* model ) const = 0;
virtual bool IsTranslucentTwoPass( const model_t *model ) const = 0;
virtual void Unused0( void ) { }
virtual int ComputeTranslucencyType( const model_t *model, int nSkin, int nBody ) = 0;
virtual void Unused0() {};
virtual RenderableTranslucencyType_t ComputeTranslucencyType( const model_t *model, int nSkin, int nBody ) = 0;
virtual int GetModelMaterialCount( const model_t* model ) const = 0;
virtual void GetModelMaterials( const model_t *model, int count, IMaterial** ppMaterial ) = 0;
virtual bool IsModelVertexLit( const model_t *model ) const = 0;
@ -118,7 +129,6 @@ public:
virtual int GetBrushModelPlaneCount( const model_t *model ) const = 0;
virtual void GetBrushModelPlane( const model_t *model, int nIndex, cplane_t &plane, Vector *pOrigin ) const = 0;
virtual int GetSurfacepropsForVirtualTerrain( int index ) = 0;
virtual bool UsesEnvCubemap( const model_t *model ) const = 0;
virtual bool UsesStaticLighting( const model_t *model ) const = 0;
};

View File

@ -16,6 +16,7 @@
#include "interface.h"
#include "mathlib/mathlib.h"
#include "istudiorender.h"
#include "datacache/idatacache.h"
//-----------------------------------------------------------------------------
// forward declarations
@ -28,6 +29,7 @@ class Vector;
struct studiohdr_t;
class IMaterial;
class CStudioHdr;
struct MaterialLightingState_t;
FORWARD_DECLARE_HANDLE( LightCacheHandle_t );
@ -91,10 +93,24 @@ struct StaticPropRenderInfo_t
const model_t *pModel;
IClientRenderable *pRenderable;
Vector *pLightingOrigin;
short skin;
ModelInstanceHandle_t instance;
uint8 skin;
uint8 alpha;
};
struct LightingQuery_t
{
Vector m_LightingOrigin;
ModelInstanceHandle_t m_InstanceHandle;
bool m_bAmbientBoost;
};
struct StaticLightingQuery_t : public LightingQuery_t
{
IClientRenderable *m_pRenderable;
};
// UNDONE: Move this to hud export code, subsume previous functions
abstract_class IVModelRender
{
@ -160,7 +176,7 @@ public:
virtual int DrawModelExStaticProp( ModelRenderInfo_t &pInfo ) = 0;
virtual bool DrawModelSetup( ModelRenderInfo_t &pInfo, DrawModelState_t *pState, matrix3x4_t *pCustomBoneToWorld, matrix3x4_t** ppBoneToWorldOut ) = 0;
virtual bool DrawModelSetup( ModelRenderInfo_t &pInfo, DrawModelState_t *pState, matrix3x4_t **ppBoneToWorldOut ) = 0;
virtual void DrawModelExecute( const DrawModelState_t &state, const ModelRenderInfo_t &pInfo, matrix3x4_t *pCustomBoneToWorld = NULL ) = 0;
// Sets up lighting context for a point in space
@ -174,13 +190,26 @@ public:
virtual void SuppressEngineLighting( bool bSuppress ) = 0;
virtual void SetupColorMeshes( int nTotalVerts ) = 0;
virtual void SetupLightingEx( const Vector &, unsigned short ) = 0;
virtual int GetBrightestShadowingLightSource( const Vector &, Vector &, Vector &, bool ) = 0;
virtual void ComputeLightingState( int, const LightingQuery_t *, MaterialLightingState_t *, ITexture **) = 0;
virtual void GetModelDecalHandles( StudioDecalHandle_t__ **, int, int, const unsigned short * ) = 0;
virtual void ComputeStaticLightingState( int, const StaticLightingQuery_t *, MaterialLightingState_t *, MaterialLightingState_t *, ColorMeshInfo_t **, ITexture **, memhandle_t__ **) = 0;
virtual void CleanupStaticLightingState( int, memhandle_t__ **) = 0;
// Sets up lighting context for a point in space, with smooth interpolation per model.
// Passing MODEL_INSTANCE_INVALID as a handle is equivalent to calling SetupLighting.
virtual void SetupLightingEx( const Vector &vecCenter, ModelInstanceHandle_t handle ) = 0;
// Finds the brightest light source illuminating a point. Returns false if there isn't any.
virtual bool GetBrightestShadowingLightSource( const Vector &vecCenter, Vector& lightPos, Vector& lightBrightness, bool bAllowNonTaggedLights ) = 0;
// Computes lighting state for an array of lighting requests
virtual void ComputeLightingState( int nCount, const LightingQuery_t *pQuery, MaterialLightingState_t *pState, ITexture **ppEnvCubemapTexture ) = 0;
// Gets an array of decal handles given model instances
virtual void GetModelDecalHandles( StudioDecalHandle_t *pDecals, int nDecalStride, int nCount, const ModelInstanceHandle_t *pHandles ) = 0;
// Computes lighting state for an array of lighting requests for renderables which use static lighting
virtual void ComputeStaticLightingState( int nCount, const StaticLightingQuery_t *pQuery, MaterialLightingState_t *pState, MaterialLightingState_t *pDecalState, ColorMeshInfo_t **ppStaticLighting, ITexture **ppEnvCubemapTexture, DataCacheHandle_t *pColorMeshHandles ) = 0;
// Cleans up lighting state. Must be called after the draw call that uses
// the color meshes return from ComputeStaticLightingState has been issued
virtual void CleanupStaticLightingState( int nCount, DataCacheHandle_t *pColorMeshHandles ) = 0;
};

View File

@ -26,6 +26,7 @@
//-----------------------------------------------------------------------------
class CUtlBuffer;
class CUtlString;
class KeyValues;
class IFileList;
@ -736,17 +737,20 @@ public:
// Installs a callback used to display a dirty disk dialog
virtual void InstallDirtyDiskReportFunc( FSDirtyDiskReportFunc_t func ) = 0;
virtual bool IsLaunchedFromXboxHDD() = 0;
virtual bool IsInstalledToXboxHDDCache() = 0;
virtual bool IsDVDHosted() = 0;
virtual bool IsInstallAllowed() = 0;
virtual int GetSearchPathID( char *pPath, int nMaxLen ) = 0;
virtual bool FixupSearchPathsAfterInstall() = 0;
virtual bool IsLaunchedFromXboxHDD( void ) = 0;
virtual bool IsInstalledToXboxHDDCache( void ) = 0;
virtual bool IsDVDHosted( void ) = 0;
virtual bool IsInstallAllowed( void ) = 0;
virtual void GetSearchPathID( char *, int ) = 0;
virtual bool FixupSearchPathsAfterInstall( void ) = 0;
virtual FSDirtyDiskReportFunc_t GetDirtyDiskReportFunc( void ) = 0;
virtual int AddVPKFile( const char *file ) = 0;
virtual FSDirtyDiskReportFunc_t GetDirtyDiskReportFunc() = 0;
virtual void AddVPKFile( char const *pszName, SearchPathAdd_t addType = PATH_ADD_TO_TAIL ) = 0;
virtual void RemoveVPKFile( char const *pszName ) = 0;
virtual void GetVPKFileNames( CUtlVector<CUtlString> &destVector ) = 0;
};
//-----------------------------------------------------------------------------

View File

@ -229,14 +229,19 @@ public:
virtual void SetWhitelistSpewFlags( int spewFlags )
{ m_pFileSystemPassThru->SetWhitelistSpewFlags( spewFlags ); }
virtual void InstallDirtyDiskReportFunc( FSDirtyDiskReportFunc_t func ) { m_pFileSystemPassThru->InstallDirtyDiskReportFunc( func ); }
virtual bool IsLaunchedFromXboxHDD() { return m_pFileSystemPassThru->IsLaunchedFromXboxHDD(); }
virtual bool IsInstalledToXboxHDDCache() { return m_pFileSystemPassThru->IsInstalledToXboxHDDCache(); }
virtual bool IsDVDHosted() { return m_pFileSystemPassThru->IsDVDHosted(); }
virtual bool IsInstallAllowed() { return m_pFileSystemPassThru->IsInstallAllowed(); }
virtual void GetSearchPathID( char *a, int b ) { m_pFileSystemPassThru->GetSearchPathID(a, b); }
virtual bool FixupSearchPathsAfterInstall() { return m_pFileSystemPassThru->FixupSearchPathsAfterInstall(); }
virtual bool IsLaunchedFromXboxHDD() { return m_pFileSystemPassThru->IsLaunchedFromXboxHDD(); }
virtual bool IsInstalledToXboxHDDCache() { return m_pFileSystemPassThru->IsInstalledToXboxHDDCache(); }
virtual bool IsDVDHosted() { return m_pFileSystemPassThru->IsDVDHosted(); }
virtual bool IsInstallAllowed() { return m_pFileSystemPassThru->IsInstallAllowed(); }
virtual int GetSearchPathID( char *pPath, int nMaxLen ) { return m_pFileSystemPassThru->GetSearchPathID( pPath, nMaxLen ); }
virtual bool FixupSearchPathsAfterInstall() { return m_pFileSystemPassThru->FixupSearchPathsAfterInstall(); }
virtual FSDirtyDiskReportFunc_t GetDirtyDiskReportFunc() { return m_pFileSystemPassThru->GetDirtyDiskReportFunc(); }
virtual int AddVPKFile( const char *file ) { return m_pFileSystemPassThru->AddVPKFile(file); }
virtual void AddVPKFile( char const *pPkName, SearchPathAdd_t addType = PATH_ADD_TO_TAIL ) { m_pFileSystemPassThru->AddVPKFile( pPkName, addType ); }
virtual void RemoveVPKFile( char const *pPkName ) { m_pFileSystemPassThru->RemoveVPKFile( pPkName ); }
virtual void GetVPKFileNames( CUtlVector<CUtlString> &destVector ) { m_pFileSystemPassThru->GetVPKFileNames( destVector ); }
protected:
IFileSystem *m_pFileSystemPassThru;

View File

@ -93,6 +93,19 @@ typedef CGameTrace trace_t;
//=============================================================================
class ITraceListData
{
public:
virtual ~ITraceListData() {}
virtual void Reset() = 0;
virtual bool IsEmpty() = 0;
// CanTraceRay will return true if the current volume encloses the ray
// NOTE: The leaflist trace will NOT check this. Traces are intersected
// against the culled volume exclusively.
virtual bool CanTraceRay( const Ray_t &ray ) = 0;
};
#define TLD_DEF_LEAF_MAX 256
#define TLD_DEF_ENTITY_MAX 1024

View File

@ -12,6 +12,7 @@
#include <inetmsghandler.h>
#include "tier0/platform.h"
#include "tier1/utlvector.h"
class IServer;
class INetMessage;
@ -24,7 +25,7 @@ public:
virtual ~IClient() {}
// connect client
virtual void Connect(const char * szName, int nUserID, INetChannel *pNetChannel, bool bFakePlayer, CUtlVector< NetMessageCvar_t > *) = 0;
virtual void Connect( const char * szName, int nUserID, INetChannel *pNetChannel, bool bFakePlayer, CUtlVector< NetMessageCvar_t > *pVecCvars = NULL ) = 0;
// set the client in a pending state waiting for a new game
virtual void Inactivate( void ) = 0;
@ -81,12 +82,20 @@ public:
virtual bool IsProximityHearingClient(int index) const = 0;
virtual void SetMaxRoutablePayloadSize( int nMaxRoutablePayloadSize ) = 0;
virtual bool IsSplitScreenUser( void ) = 0;
virtual bool CheckConnect ( void ) = 0;
virtual bool IsLowViolenceClient( void ) = 0;
virtual int GetSplitScreenOwner( void ) = 0;
virtual int GetNumPlayers( void ) = 0;
// returns true, if client is a split screen user
virtual bool IsSplitScreenUser( void ) const = 0;
virtual bool CheckConnect( void ) = 0;
virtual bool IsLowViolenceClient( void ) const = 0;
virtual IClient *GetSplitScreenOwner() = 0;
// get the number of players on this client's machine
virtual int GetNumPlayers() = 0;
virtual bool IsHumanPlayer() const = 0;
};
#endif // ICLIENT_H

View File

@ -34,6 +34,8 @@ public:
virtual void ColorPrint( const Color& clr, const char *pMessage ) = 0;
virtual void Print( const char *pMessage ) = 0;
virtual void DPrint( const char *pMessage ) = 0;
virtual void GetConsoleText( char *pchText, size_t bufSize ) const = 0;
};
@ -48,16 +50,6 @@ public:
virtual bool AreConVarsLinkable( const ConVar *child, const ConVar *parent ) = 0;
};
abstract_class ICvarIteratorInternal
{
public:
virtual void SetFirst( void ) = 0;
virtual void Next( void ) = 0;
virtual bool IsValid( void ) = 0;
virtual ConCommandBase *Get( void ) = 0;
};
//-----------------------------------------------------------------------------
// Purpose: DLL interface to ConVars/ConCommands
//-----------------------------------------------------------------------------
@ -84,6 +76,8 @@ public:
virtual ConCommand *FindCommand( const char *name ) = 0;
virtual const ConCommand *FindCommand( const char *name ) const = 0;
// Install a global change callback (to be called when any convar changes)
virtual void InstallGlobalChangeCallback( FnChangeCallback_t callback ) = 0;
virtual void RemoveGlobalChangeCallback( FnChangeCallback_t callback ) = 0;
@ -108,32 +102,101 @@ public:
virtual void PublishToVXConsole( ) = 0;
#endif
virtual void SetMaxSplitScreenSlots( int ) = 0;
virtual int GetMaxSplitScreenSlots() const = 0;
virtual void AddSplitScreenConVars() = 0;
virtual void RemoveSplitScreenConVars( int ) = 0;
virtual int GetConsoleDisplayFuncCount() const = 0;
virtual void GetConsoleText( int, char *, unsigned int ) const = 0;
virtual bool IsMaterialThreadSetAllowed() const = 0;
virtual void QueueMaterialThreadSetValue( ConVar *, const char * ) = 0;
virtual void QueueMaterialThreadSetValue( ConVar *, int ) = 0;
virtual void QueueMaterialThreadSetValue( ConVar *, float ) = 0;
virtual bool HasQueuedMaterialThreadConVarSets() const = 0;
virtual int ProcessQueuedMaterialThreadConVarSets() = 0;
// Returns a cvar iterator pointer.
//
// If memoverride is not used, use g_pMemAlloc->Free() to deallocate the memory
// used by these iterators.
//
// If memoverride is used, you can use the delete operator even though there
// is no virtual destructor. This can be done because memoverride overloads the
// delete operator so that it will call g_pMemAlloc-Free().
virtual ICvarIteratorInternal *FactoryInternalIterator() = 0;
virtual void SetMaxSplitScreenSlots( int nSlots ) = 0;
virtual int GetMaxSplitScreenSlots() const = 0;
virtual void AddSplitScreenConVars() = 0;
virtual void RemoveSplitScreenConVars( CVarDLLIdentifier_t id ) = 0;
virtual int GetConsoleDisplayFuncCount() const = 0;
virtual void GetConsoleText( int nDisplayFuncIndex, char *pchText, size_t bufSize ) const = 0;
// Utilities for convars accessed by the material system thread
virtual bool IsMaterialThreadSetAllowed( ) const = 0;
virtual void QueueMaterialThreadSetValue( ConVar *pConVar, const char *pValue ) = 0;
virtual void QueueMaterialThreadSetValue( ConVar *pConVar, int nValue ) = 0;
virtual void QueueMaterialThreadSetValue( ConVar *pConVar, float flValue ) = 0;
virtual bool HasQueuedMaterialThreadConVarSets() const = 0;
virtual int ProcessQueuedMaterialThreadConVarSets() = 0;
protected: class ICVarIteratorInternal;
public:
/// Iteration over all cvars.
/// (THIS IS A SLOW OPERATION AND YOU SHOULD AVOID IT.)
/// usage:
/// { ICVar::Iterator iter(g_pCVar);
/// for ( iter.SetFirst() ; iter.IsValid() ; iter.Next() )
/// {
/// ConCommandBase *cmd = iter.Get();
/// }
/// }
/// The Iterator class actually wraps the internal factory methods
/// so you don't need to worry about new/delete -- scope takes care
// of it.
/// We need an iterator like this because we can't simply return a
/// pointer to the internal data type that contains the cvars --
/// it's a custom, protected class with unusual semantics and is
/// prone to change.
class Iterator
{
public:
inline Iterator(ICvar *icvar);
inline ~Iterator(void);
inline void SetFirst( void );
inline void Next( void );
inline bool IsValid( void );
inline ConCommandBase *Get( void );
private:
ICVarIteratorInternal *m_pIter;
};
protected:
// internals for ICVarIterator
class ICVarIteratorInternal
{
public:
virtual void SetFirst( void ) = 0;
virtual void Next( void ) = 0;
virtual bool IsValid( void ) = 0;
virtual ConCommandBase *Get( void ) = 0;
};
virtual ICVarIteratorInternal *FactoryInternalIterator( void ) = 0;
friend class Iterator;
};
#define CVAR_INTERFACE_VERSION "VEngineCvar007"
inline ICvar::Iterator::Iterator(ICvar *icvar)
{
m_pIter = icvar->FactoryInternalIterator();
}
inline ICvar::Iterator::~Iterator( void )
{
g_pMemAlloc->Free(m_pIter);
}
inline void ICvar::Iterator::SetFirst( void )
{
m_pIter->SetFirst();
}
inline void ICvar::Iterator::Next( void )
{
m_pIter->Next();
}
inline bool ICvar::Iterator::IsValid( void )
{
return m_pIter->IsValid();
}
inline ConCommandBase * ICvar::Iterator::Get( void )
{
return m_pIter->Get();
}
//-----------------------------------------------------------------------------
// These global names are defined by tier1.h, duplicated here so you

View File

@ -75,17 +75,19 @@ public:
// Data access
virtual bool GetBool( const char *keyName = NULL, bool defaultValue = false ) = 0;
virtual int GetInt( const char *keyName = NULL, int defaultValue = 0 ) = 0;
virtual unsigned long long GetUint64 ( const char *keyName = NULL, unsigned long long defaultValue = 0) = 0;
virtual uint64 GetUint64( const char *keyName = NULL, uint64 defaultValue = 0 ) = 0;
virtual float GetFloat( const char *keyName = NULL, float defaultValue = 0.0f ) = 0;
virtual const char *GetString( const char *keyName = NULL, const char *defaultValue = "" ) = 0;
virtual void SetBool( const char *keyName, bool value ) = 0;
virtual void SetInt( const char *keyName, int value ) = 0;
virtual void SetUint64( const char *keyName, unsigned long long value ) = 0;
virtual void SetUint64( const char *keyName, uint64 value ) = 0;
virtual void SetFloat( const char *keyName, float value ) = 0;
virtual void SetString( const char *keyName, const char *value ) = 0;
};
#define EVENT_DEBUG_ID_INIT 42
#define EVENT_DEBUG_ID_SHUTDOWN 13
abstract_class IGameEventListener2
{
@ -95,10 +97,8 @@ public:
// FireEvent is called by EventManager if event just occured
// KeyValue memory will be freed by manager if not needed anymore
virtual void FireGameEvent( IGameEvent *event ) = 0;
virtual int GetEventDebugID( void )
{
return 42;
}
virtual int GetEventDebugID( void ) = 0;
};
abstract_class IGameEventManager2 : public IBaseInterface
@ -123,7 +123,7 @@ public:
// create an event by name, but doesn't fire it. returns NULL is event is not
// known or no listener is registered for it. bForce forces the creation even if no listener is active
virtual IGameEvent *CreateEvent( const char *name, bool bForce = false, int *unknown=NULL) = 0;
virtual IGameEvent *CreateEvent( const char *name, bool bForce = false, int *pCookie = NULL ) = 0;
// fires a server event created earlier, if bDontBroadcast is set, event is not send to clients
virtual bool FireEvent( IGameEvent *event, bool bDontBroadcast = false ) = 0;

View File

@ -13,13 +13,30 @@
#include "tier0/platform.h"
#include "inetchannelinfo.h"
#include "tier1/bitbuf.h"
#include "tier1/netadr.h"
class IDemoRecorder;
class INetMessage;
class INetChannelHandler;
class INetChannelInfo;
typedef struct netpacket_s netpacket_t;
typedef struct netadr_s netadr_t;
#ifndef NET_PACKET_ST_DEFINED
#define NET_PACKET_ST_DEFINED
typedef struct netpacket_s
{
netadr_t from; // sender IP
int source; // received source
double received; // received time
unsigned char *data; // pointer to raw packet data
bf_read message; // easy bitbuf data access
int size; // size in bytes
int wiresize; // size in bytes before decompression
bool stream; // was send as stream
struct netpacket_s *pNext; // for internal use, should be NULL in public
} netpacket_t;
#endif // NET_PACKET_ST_DEFINED
abstract_class INetChannel : public INetChannelInfo
{
@ -30,7 +47,7 @@ public:
virtual bool RegisterMessage(INetMessage *msg) = 0;
virtual bool StartStreaming( unsigned int challengeNr ) = 0;
virtual void ResetStreaming( void ) = 0;
virtual void SetTimeout(float seconds) = 0;
virtual void SetTimeout(float seconds, bool bForceExact = false) = 0;
virtual void SetDemoRecorder(IDemoRecorder *recorder) = 0;
virtual void SetChallengeNr(unsigned int chnr) = 0;
@ -82,10 +99,12 @@ public:
// Max # of payload bytes before we must split/fragment the packet
virtual void SetMaxRoutablePayloadSize( int nSplitSize ) = 0;
virtual int GetMaxRoutablePayloadSize() = 0;
virtual bool SetActiveChannel( INetChannel *msg ) = 0;
virtual void AttachSplitPlayer( int player, INetChannel *msg ) = 0;
virtual void DetachSplitPlayer( int player ) = 0;
// For routing messages to a different handler
virtual bool SetActiveChannel( INetChannel *pNewChannel ) = 0;
virtual void AttachSplitPlayer( int nSplitPlayerSlot, INetChannel *pChannel ) = 0;
virtual void DetachSplitPlayer( int nSplitPlayerSlot ) = 0;
virtual bool IsRemoteDisconnected() const = 0;
};

View File

@ -50,9 +50,6 @@ public:
#define PROCESS_CLC_MESSAGE( name ) \
virtual bool Process##name( CLC_##name *msg )
#define PROCESS_MM_MESSAGE( name ) \
virtual bool Process##name( MM_##name *msg )
#define REGISTER_NET_MSG( name ) \
NET_##name * p##name = new NET_##name(); \
@ -69,10 +66,6 @@ public:
p##name->m_pMessageHandler = this; \
chan->RegisterMessage( p##name ); \
#define REGISTER_MM_MSG( name ) \
MM_##name * p##name = new MM_##name(); \
p##name->m_pMessageHandler = this; \
chan->RegisterMessage( p##name ); \
class NET_Tick;
class NET_StringCmd;
@ -80,6 +73,7 @@ class NET_SetConVar;
class NET_SignonState;
class NET_SplitScreenUser;
class INetMessageHandler
{
public:
@ -101,6 +95,7 @@ class CLC_RespondCvarValue;
class CLC_SplitPlayerConnect;
class CLC_FileCRCCheck;
class CLC_LoadingProgress;
class CLC_CmdKeyValues;
class IClientMessageHandler : public INetMessageHandler
{
@ -116,6 +111,7 @@ public:
PROCESS_CLC_MESSAGE( SplitPlayerConnect ) = 0;
PROCESS_CLC_MESSAGE( FileCRCCheck ) = 0;
PROCESS_CLC_MESSAGE( LoadingProgress ) = 0;
PROCESS_CLC_MESSAGE( CmdKeyValues ) = 0;
};
class SVC_Print;
@ -142,6 +138,7 @@ class SVC_Menu;
class SVC_GameEventList;
class SVC_GetCvarValue;
class SVC_SplitScreen;
class SVC_CmdKeyValues;
class IServerMessageHandler : public INetMessageHandler
{
@ -172,34 +169,7 @@ public:
PROCESS_SVC_MESSAGE( GameEventList ) = 0;
PROCESS_SVC_MESSAGE( GetCvarValue ) = 0;
PROCESS_SVC_MESSAGE( SplitScreen ) = 0;
};
class MM_Heartbeat;
class MM_ClientInfo;
class MM_ClientJoinRequest;
class MM_RegisterResponse;
class MM_Mutelist;
class MM_Checkpoint;
class MM_JoinResponse;
class MM_Migrate;
class MM_ClientChat;
class MM_ClientRequest;
class IMatchmakingMessageHandler : public INetMessageHandler
{
public:
virtual ~IMatchmakingMessageHandler( void ) {};
PROCESS_MM_MESSAGE( Heartbeat ) = 0;
PROCESS_MM_MESSAGE( ClientInfo ) = 0;
PROCESS_MM_MESSAGE( ClientJoinRequest ) = 0;
PROCESS_MM_MESSAGE( RegisterResponse ) = 0;
PROCESS_MM_MESSAGE( Mutelist ) = 0;
PROCESS_MM_MESSAGE( Checkpoint) = 0;
PROCESS_MM_MESSAGE( JoinResponse ) = 0;
PROCESS_MM_MESSAGE( Migrate ) = 0;
PROCESS_MM_MESSAGE( ClientChat ) = 0;
PROCESS_MM_MESSAGE( ClientRequest ) = 0;
PROCESS_SVC_MESSAGE( CmdKeyValues ) = 0;
};
class IConnectionlessPacketHandler

View File

@ -49,31 +49,19 @@ public:
// Accessors (length -1 means don't change user data if string already exits)
virtual int AddString( bool bIsServer, const char *value, int length = -1, const void *userdata = 0 ) = 0;
virtual const char *GetString( int stringNumber ) = 0;
virtual const char *GetString( int stringNumber ) const = 0;
virtual void SetStringUserData( int stringNumber, int length, const void *userdata ) = 0;
virtual const void *GetStringUserData( int stringNumber, int *length ) = 0;
virtual const void *GetStringUserData( int stringNumber, int *length ) const = 0;
virtual int FindStringIndex( char const *string ) = 0; // returns INVALID_STRING_INDEX if not found
// Callbacks
virtual void SetStringChangedCallback( void *object, pfnStringChanged changeFunc ) = 0;
};
class INetworkStringDict
enum ENetworkStringtableFlags
{
public:
virtual ~INetworkStringDict( void ) {};
virtual int Count( void ) = 0;
virtual void Purge( void ) = 0;
virtual const char *String( int index ) = 0;
virtual bool IsValidIndex( int index ) = 0;
virtual int Insert( const char *string ) = 0;
virtual int Find( const char *string ) = 0;
virtual void UpdateDictionary( int ) = 0;
virtual int DictionaryIndex( int ) = 0;
virtual int Element( int ) = 0;
virtual int Element( int ) const = 0;
NSF_NONE = 0,
NSF_DICTIONARY_ENABLED = (1<<0), // Uses pre-calculated per map dictionaries to reduce bandwidth
};
class INetworkStringTableContainer
@ -83,7 +71,7 @@ public:
virtual ~INetworkStringTableContainer( void ) {};
// table creation/destruction
virtual INetworkStringTable *CreateStringTable( const char *tableName, int maxentries, int userdatafixedsize = 0, int userdatanetworkbits = 0, int unknown = 0 ) = 0;
virtual INetworkStringTable *CreateStringTable( const char *tableName, int maxentries, int userdatafixedsize = 0, int userdatanetworkbits = 0, int flags = NSF_NONE ) = 0;
virtual void RemoveAllTables( void ) = 0;
// table infos
@ -92,7 +80,8 @@ public:
virtual int GetNumTables( void ) const = 0;
virtual void SetAllowClientSideAddString( INetworkStringTable *table, bool bAllowClientSideAddString ) = 0;
virtual INetworkStringDict *CreateDictionary( const char *dictName ) = 0;
virtual void CreateDictionary( char const *pchMapName ) = 0;
};
#endif // NETWORKSTRINGTABLEDEFS_H

View File

@ -54,6 +54,9 @@ public:
virtual void Free( void *pMem, const char *pFileName, int nLine ) = 0;
virtual void *Expand_NoLongerSupported( void *pMem, size_t nSize, const char *pFileName, int nLine ) = 0;
inline void *IndirectAlloc( size_t nSize ) { return Alloc( nSize ); }
inline void *IndirectAlloc( size_t nSize, const char *pFileName, int nLine ) { return Alloc( nSize, pFileName, nLine ); }
// Returns size of a particular allocation
virtual size_t GetSize( void *pMem ) = 0;
@ -63,7 +66,7 @@ public:
// FIXME: Remove when we have our own allocator
// these methods of the Crt debug code is used in our codebase currently
virtual long CrtSetBreakAlloc( long lNewBreakAlloc ) = 0;
virtual int32 CrtSetBreakAlloc( int32 lNewBreakAlloc ) = 0;
virtual int CrtSetReportMode( int nReportType, int nReportMode ) = 0;
virtual int CrtIsValidHeapPointer( const void *pMem ) = 0;
virtual int CrtIsValidPointer( const void *pMem, unsigned int size, int access ) = 0;
@ -74,8 +77,7 @@ public:
// FIXME: Make a better stats interface
virtual void DumpStats() = 0;
virtual void DumpStatsFileBase( char const *pchFileBase ) = 0;
virtual size_t ComputeMemoryUsedBy( const char *pFileName ) = 0;
virtual size_t ComputeMemoryUsedBy( char const *pchSubStr ) = 0;
// FIXME: Remove when we have our own allocator
virtual void* CrtSetReportFile( int nRptType, void* hFile ) = 0;
@ -88,8 +90,8 @@ public:
virtual bool IsDebugHeap() = 0;
virtual void GetActualDbgInfo( const char *&pFileName, int &nLine ) = 0;
virtual void RegisterAllocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) = 0;
virtual void RegisterDeallocation( const char *pFileName, int nLine, int nLogicalSize, int nActualSize, unsigned nTime ) = 0;
virtual void RegisterAllocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) = 0;
virtual void RegisterDeallocation( const char *pFileName, int nLine, size_t nLogicalSize, size_t nActualSize, unsigned nTime ) = 0;
virtual int GetVersion() = 0;
@ -106,9 +108,10 @@ public:
// Returns 0 if no failure, otherwise the size_t of the last requested chunk
virtual size_t MemoryAllocFailed() = 0;
virtual void CompactIncremental() = 0;
virtual void OutOfMemory( size_t ) = 0;
virtual void CompactIncremental() = 0;
virtual void OutOfMemory( size_t nBytesAttempted = 0 ) = 0;
};
//-----------------------------------------------------------------------------

View File

@ -120,10 +120,10 @@ public:
virtual bool IsFlagSet( int flag ) const;
// Set flag
virtual void AddFlags( int flags );
// Remove flag
// Clear flag
virtual void RemoveFlags( int flags );
// Get flags
virtual int GetFlags( void ) const;
virtual int GetFlags() const;
// Return name of cvar
virtual const char *GetName( void ) const;
@ -329,6 +329,7 @@ class ConVar : public ConCommandBase, public IConVar
friend class CCvar;
friend class ConVarRef;
public:
typedef ConCommandBase BaseClass;

View File

@ -40,7 +40,7 @@ class CCommand;
#define FCVAR_DEVELOPMENTONLY (1<<1) // Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined.
#define FCVAR_GAMEDLL (1<<2) // defined by the game DLL
#define FCVAR_CLIENTDLL (1<<3) // defined by the client DLL
#define FCVAR_HIDDEN (1<<4) // Hidden. Doesn't appear in find or autocomplete. Like DEVELOPMENTONLY, but can't be compiled out.
#define FCVAR_HIDDEN (1<<4) // Hidden. Doesn't appear in find or auto complete. Like DEVELOPMENTONLY, but can't be compiled out.
// ConVar only
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
@ -48,7 +48,6 @@ class CCommand;
#define FCVAR_ARCHIVE (1<<7) // set to cause it to be saved to vars.rc
#define FCVAR_NOTIFY (1<<8) // notifies players when changed
#define FCVAR_USERINFO (1<<9) // changes the client's info string
#define FCVAR_CHEAT (1<<14) // Only useable in singleplayer / debug / multiplayer & sv_cheats
#define FCVAR_PRINTABLEONLY (1<<10) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
#define FCVAR_UNLOGGED (1<<11) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
@ -60,11 +59,17 @@ class CCommand;
// If a change is requested it must come from the console (i.e., no remote client changes)
// If a value is changed while a server is active, it's replicated to all connected clients
#define FCVAR_REPLICATED (1<<13) // server setting enforced on clients, TODO rename to FCAR_SERVER at some time
#define FCVAR_DEMO (1<<16) // record this cvar when starting a demo file
#define FCVAR_DONTRECORD (1<<17) // don't record these command in demofiles
#define FCVAR_CHEAT (1<<14) // Only useable in singleplayer / debug / multiplayer & sv_cheats
#define FCVAR_SS (1<<15) // causes varnameN where N == 2 through max splitscreen slots for mod to be autogenerated
#define FCVAR_DEMO (1<<16) // record this cvar when starting a demo file
#define FCVAR_DONTRECORD (1<<17) // don't record these command in demofiles
#define FCVAR_SS_ADDED (1<<18) // This is one of the "added" FCVAR_SS variables for the splitscreen players
#define FCVAR_RELEASE (1<<19) // Cvars tagged with this are the only cvars avaliable to customers
#define FCVAR_RELOAD_MATERIALS (1<<20) // If this cvar changes, it forces a material reload
#define FCVAR_RELOAD_TEXTURES (1<<21) // If this cvar changes, if forces a texture reload
#define FCVAR_NOT_CONNECTED (1<<22) // cvar cannot be changed by a client that is connected to a server
#define FCVAR_MATERIAL_SYSTEM_THREAD (1<<23) // Indicates this cvar is read from the material system thread
#define FCVAR_ARCHIVE_XBOX (1<<24) // cvar written to config.cfg on the Xbox
#define FCVAR_SERVER_CAN_EXECUTE (1<<28)// the server is allowed to execute this command on clients via ClientCommand/NET_StringCmd/CBaseClientState::ProcessStringCmd.
@ -72,17 +77,12 @@ class CCommand;
#define FCVAR_CLIENTCMD_CAN_EXECUTE (1<<30) // IVEngineClient::ClientCmd is allowed to execute this command.
// Note: IVEngineClient::ClientCmd_Unrestricted can run any client command.
// #define FCVAR_AVAILABLE (1<<15)
// #define FCVAR_AVAILABLE (1<<18)
// #define FCVAR_AVAILABLE (1<<19)
// #define FCVAR_AVAILABLE (1<<20)
// #define FCVAR_AVAILABLE (1<<21)
// #define FCVAR_AVAILABLE (1<<23)
// #define FCVAR_AVAILABLE (1<<25)
#define FCVAR_ACCESSIBLE_FROM_THREADS (1<<25) // used as a debugging tool necessary to check material system thread convars
// #define FCVAR_AVAILABLE (1<<26)
// #define FCVAR_AVAILABLE (1<<27)
// #define FCVAR_AVAILABLE (1<<31)
#define FCVAR_MATERIAL_THREAD_MASK ( FCVAR_RELOAD_MATERIALS | FCVAR_RELOAD_TEXTURES | FCVAR_MATERIAL_SYSTEM_THREAD )
//-----------------------------------------------------------------------------
// Called when a ConVar changes value
@ -104,13 +104,15 @@ public:
// Return name of command
virtual const char *GetName( void ) const = 0;
// Return name of command (usually == GetName(), except in case of FCVAR_SS_ADDED vars
virtual const char *GetBaseName( void ) const = 0;
// Accessors.. not as efficient as using GetState()/GetInfo()
// if you call these methods multiple times on the same IConVar
virtual bool IsFlagSet( int nFlag ) const = 0;
virtual int GetSplitScreenPlayerSlot( void ) const = 0;
virtual int GetSplitScreenPlayerSlot() const = 0;
};

View File

@ -269,7 +269,7 @@ public:
// begins parsing a vcollide. NOTE: This keeps pointers to the text
// If you free the text and call members of IVPhysicsKeyParser, it will crash
virtual IVPhysicsKeyParser *VPhysicsKeyParserCreate( const char *pKeyData ) = 0;
virtual IVPhysicsKeyParser *VPhysicsKeyParserCreate( vcollide_t * ) = 0;
virtual IVPhysicsKeyParser *VPhysicsKeyParserCreate( vcollide_t *pVCollide ) = 0;
// Free the parser created by VPhysicsKeyParserCreate
virtual void VPhysicsKeyParserDestroy( IVPhysicsKeyParser *pParser ) = 0;
@ -299,13 +299,17 @@ public:
// dumps info about the collide to Msg()
virtual void OutputDebugInfo( const CPhysCollide *pCollide ) = 0;
virtual unsigned int ReadStat( int statID ) = 0;
virtual int CollideGetRadius( const CPhysCollide *pCollide ) = 0;
virtual void *VCollideAllocUserData( vcollide_t *, unsigned int ) = 0;
virtual void VCollideFreeUserData( vcollide_t * ) = 0;
virtual int VCollideCheck( vcollide_t *, const char * ) = 0;
// Get an AABB for an oriented collision model
virtual float CollideGetRadius( const CPhysCollide *pCollide ) = 0;
virtual void *VCollideAllocUserData( vcollide_t *pVCollide, size_t userDataSize ) = 0;
virtual void VCollideFreeUserData( vcollide_t *pVCollide ) = 0;
virtual void VCollideCheck( vcollide_t *pVCollide, const char *pName ) = 0;
};
// this can be used to post-process a collision model
abstract_class ICollisionQuery
{
@ -663,11 +667,12 @@ public:
virtual void EnableConstraintNotify( bool bEnable ) = 0;
virtual void DebugCheckContacts(void) = 0;
virtual void SetAlternateGravity( const Vector& ) = 0;
virtual void GetAlternateGravity( Vector * ) const = 0;
virtual float GetDeltaFrameTime( int ) = 0;
virtual void ForceObjectsToSleep( IPhysicsObject **, int ) = 0;
virtual void SetAlternateGravity( const Vector &gravityVector ) = 0;
virtual void GetAlternateGravity( Vector *pGravityVector ) const = 0;
virtual float GetDeltaFrameTime( int maxTicks ) const = 0;
virtual void ForceObjectsToSleep( IPhysicsObject **pList, int listCount ) = 0;
};
enum callbackflags
@ -771,6 +776,7 @@ public:
// Get the radius if this is a sphere object (zero if this is a polygonal mesh)
virtual float GetSphereRadius() const = 0;
// Set the radius on a sphere. May need to force recalculation of contact points
virtual void SetSphereRadius( float radius ) = 0;
virtual float GetEnergy() const = 0;
virtual Vector GetMassCenterLocalSpace() const = 0;
@ -865,11 +871,18 @@ public:
// dumps info about the object to Msg()
virtual void OutputDebugInfo() const = 0;
virtual void SetUseAlternateGravity( bool ) = 0;
virtual void SetCollisionHints( unsigned int hint ) = 0;
virtual unsigned int GetCollisionHints( void ) const = 0;
#if OBJECT_WELDING
virtual void WeldToObject( IPhysicsObject *pParent ) = 0;
virtual void RemoveWeld( IPhysicsObject *pOther ) = 0;
virtual void RemoveAllWelds( void ) = 0;
#endif
// EnableGravity still determines whether to apply gravity
// This flag determines which gravity constant to use for an alternate gravity effect
virtual void SetUseAlternateGravity( bool bSet ) = 0;
virtual void SetCollisionHints( uint32 collisionHints ) = 0;
virtual uint32 GetCollisionHints() const = 0;
};
@ -920,8 +933,10 @@ struct surfaceaudioparams_t
struct surfacesoundnames_t
{
unsigned short stepleft;
unsigned short stepright;
unsigned short walkStepLeft;
unsigned short walkStepRight;
unsigned short runStepLeft;
unsigned short runStepRight;
unsigned short impactSoft;
unsigned short impactHard;
@ -938,8 +953,10 @@ struct surfacesoundnames_t
struct surfacesoundhandles_t
{
short stepleft;
short stepright;
short walkStepLeft;
short walkStepRight;
short runStepLeft;
short runStepRight;
short impactSoft;
short impactHard;
@ -1092,6 +1109,7 @@ struct convertconvexparams_t
bool buildOuterConvexHull;
bool buildDragAxisAreas;
bool buildOptimizedTraceTables;
bool checkOptimalTracing;
float dragAreaEpsilon;
CPhysConvex *pForcedOuterHull;
@ -1101,6 +1119,7 @@ struct convertconvexparams_t
buildOuterConvexHull = false;
buildDragAxisAreas = false;
buildOptimizedTraceTables = false;
checkOptimalTracing = false;
pForcedOuterHull = NULL;
}
};

File diff suppressed because it is too large Load Diff