csgo-2018-source/engine/cl_main.h

201 lines
5.4 KiB
C
Raw Permalink Normal View History

2021-07-25 12:11:47 +08:00
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $NoKeywords: $
//===========================================================================//
#ifndef CL_MAIN_H
#define CL_MAIN_H
#ifdef _WIN32
#pragma once
#endif
#include "basetypes.h"
#include "networkstringtable.h"
#include "const.h"
#include "utlvector.h"
#include "checksum_crc.h"
#include "cdll_int.h"
#include "netmessages.h"
#include "dlight.h"
#include "iefx.h"
#include "tier1/convar.h"
#include "cmodel_engine.h"
class CCommand;
#define MAX_STYLESTRING 64
#define MAX_ELIGHTS 64 // entity only point lights
extern dlight_t cl_dlights[MAX_DLIGHTS];
extern dlight_t cl_elights[MAX_ELIGHTS];
extern bool g_bActiveDlights;
extern bool g_bActiveElights;
extern int g_ActiveDLightIndex[MAX_DLIGHTS];
extern int g_ActiveELightIndex[MAX_ELIGHTS];
extern int g_nNumActiveDLights;
extern int g_nNumActiveELights;
// These can be used for fast access to the leaf indices of each light.
extern CFastPointLeafNum g_DLightLeafAccessors[MAX_DLIGHTS];
extern CFastPointLeafNum g_ELightLeafAccessors[MAX_ELIGHTS];
class CBaseClientState;
class CEntityReadInfo;
class CPureServerWhitelist;
struct SoundInfo_t;
#define DEFAULT_JPEG_QUALITY 50
void CL_TakeJpeg( const char *name = NULL, int quality = DEFAULT_JPEG_QUALITY );
struct MovieInfo_t
{
enum
{
FMOVIE_TGA = ( 1 << 0 ),
FMOVIE_AVI = ( 1 << 1 ),
FMOVIE_WAV = ( 1 << 2 ),
FMOVIE_AVISOUND = ( 1 << 3 ),
FMOVIE_JPG = ( 1<< 4 )
};
MovieInfo_t()
{
moviename[ 0 ] = 0;
movieframe = 0;
type = FMOVIE_TGA | FMOVIE_WAV;
jpeg_quality = DEFAULT_JPEG_QUALITY;
}
void Reset()
{
moviename[ 0 ] = 0;
movieframe = 0;
type = FMOVIE_TGA | FMOVIE_WAV;
jpeg_quality = DEFAULT_JPEG_QUALITY;
}
bool IsRecording() const
{
return moviename[ 0 ] != 0 ? true : false;
}
bool DoWav() const
{
return ( type & FMOVIE_WAV ) ? true : false;
}
bool DoTga() const
{
return ( type & FMOVIE_TGA ) ? true : false;
}
bool DoJpg() const
{
return ( type & FMOVIE_JPG ) ? true : false;
}
bool DoAVI() const
{
return ( type & FMOVIE_AVI ) ? true : false;
}
bool DoAVISound() const
{
return ( type & FMOVIE_AVISOUND ) ? true : false;
}
char moviename[ 256 ];
int movieframe;
int type;
int jpeg_quality;
};
extern MovieInfo_t cl_movieinfo;
//=============================================================================
// cl_main.cpp
//
void CL_StartMovie( const char *filename, int flags, int nWidth, int nHeight, float flFrameRate, int jpeg_quality );
bool CL_IsRecordingMovie();
void CL_EndMovie();
void CL_DecayLights( void );
void CL_UpdateDAndELights( bool bUpdateDecay = false );
void CL_AddSound( const SoundInfo_t &sound );
void CL_DispatchSounds( void );
void CL_DispatchSound( const SoundInfo_t &sound );
void CL_SetServerTick( int tick );
void CL_Init (void);
void CL_Shutdown( void );
void CL_FireEvents( void );
void CL_NextDemo (void);
void CL_TakeScreenshot(const char *name);
const struct CPrecacheUserData* CL_GetPrecacheUserData( INetworkStringTable *table, int index );
void Callback_ModelChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
void Callback_GenericChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
void Callback_SoundChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
void Callback_DecalChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
void Callback_InstanceBaselineChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
void Callback_UserInfoChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
void Callback_DynamicModelChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
void CL_InstallAndInvokeClientStringTableCallbacks();
void CL_HookClientStringTables();
void CL_LatchInterpolationAmount();
// Resource
void CL_RegisterResources ( void );
//
// cl_input
//
void CL_Move( float accumulated_extra_samples, bool bFinalTick );
void CL_ExtraMouseUpdate( float remainder );
void CL_ClearState (void);
void CL_ReadPackets ( bool framefinished ); // Read packets from server and other sources (ping requests, etc.)
//
// cl_main.cpp
//
void CL_FullyConnected( void );
void CL_Retry( void );
void CL_HudMessage( const char *pMessage );
void CL_CheckClientState( void );
void CL_TakeSnapshotAndSwap();
void CL_ReallocateDynamicData( int maxclients );
void CL_SetupMapName( const char* pName, char* pFixedName, int maxlen );
bool CL_CheckCRCs( const char *pszMap );
bool CL_ShouldLoadBackgroundLevel( const CCommand &args );
bool CL_IsHL2Demo();
bool CL_IsPortalDemo();
void CL_SetSteamCrashComment();
void CL_CheckForPureServerWhitelist();
void CL_HandlePureServerWhitelist( CPureServerWhitelist *pWhitelist );
void CL_GetStartupImage( char *pOutBuffer, int nOutBufferSize );
// Special mode where the client uses a console window and has no graphics. Useful for stress-testing a server
// without having to round up 32 people.
extern bool g_bTextMode;
extern bool cl_takesnapshot;
extern ConVar cl_language;
#endif // CL_MAIN_H