mirror of
https://github.com/fortressforever/fortressforever-2013.git
synced 2024-11-25 13:51:25 +00:00
- Added separate ScriptManagers for UI stuff and Game stuff (g_UIScriptManager (client-only) and g_GameScriptManager (client and server))
* Modified ScriptManager to have no static functions - Added our own client DLL interface class (CFF_CL_DLL_Interface) that inherits from CHLClient * Moved all FF code out of cdll_client_int.cpp * Moved CHLClient class declaration to cdll_client_int.h
This commit is contained in:
parent
41947795c8
commit
9aa4479a03
7 changed files with 421 additions and 53 deletions
|
@ -147,10 +147,6 @@
|
|||
#include "fbxsystem/fbxsystem.h"
|
||||
#endif
|
||||
|
||||
#ifdef FF
|
||||
//#include "lua/luaman.h"
|
||||
#endif
|
||||
|
||||
extern vgui::IInputInternal *g_InputInternal;
|
||||
const char *COM_GetModDirectory(); // return the mod dir (rather than the complete -game param, which can be a path)
|
||||
|
||||
|
@ -174,6 +170,11 @@ const char *COM_GetModDirectory(); // return the mod dir (rather than the comple
|
|||
#include "sixense/in_sixense.h"
|
||||
#endif
|
||||
|
||||
#ifdef FF
|
||||
#include "ff_cl_dll_interface.h"
|
||||
extern CFF_CL_DLL_Interface gFFClient;
|
||||
#endif
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
@ -588,6 +589,7 @@ void DisplayBoneSetupEnts()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef FF // Moved class definition to .h so we can inherit from it
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: engine to client .dll interface
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -734,14 +736,17 @@ private:
|
|||
|
||||
CUtlVector< IMaterial * > m_CachedMaterials;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FF // FF exposes its own interface
|
||||
CHLClient gHLClient;
|
||||
IBaseClientDLL *clientdll = &gHLClient;
|
||||
|
||||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CHLClient, IBaseClientDLL, CLIENT_DLL_INTERFACE_VERSION, gHLClient );
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FF
|
||||
//-----------------------------------------------------------------------------
|
||||
// Precaches a material
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -749,6 +754,15 @@ void PrecacheMaterial( const char *pMaterialName )
|
|||
{
|
||||
gHLClient.PrecacheMaterial( pMaterialName );
|
||||
}
|
||||
#else
|
||||
//-----------------------------------------------------------------------------
|
||||
// Precaches a material
|
||||
//-----------------------------------------------------------------------------
|
||||
void PrecacheMaterial( const char *pMaterialName )
|
||||
{
|
||||
gFFClient.PrecacheMaterial( pMaterialName );
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Converts a previously precached material into an index
|
||||
|
@ -871,27 +885,7 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi
|
|||
ConnectTier3Libraries( &appSystemFactory, 1 );
|
||||
|
||||
#ifndef NO_STEAM
|
||||
//assert ( false );
|
||||
ClientSteamContext().Activate();
|
||||
uint32 appId = steamapicontext->SteamUtils()->GetAppID();
|
||||
char msg[128];
|
||||
Q_snprintf(msg, 128,"Steam AppID = %i\n", appId);
|
||||
DevMsg(msg);
|
||||
/*
|
||||
// careful: you might want to use a long long if you're a internet celeb like squeek
|
||||
int numFriends = steamapicontext->SteamFriends()->GetFriendCount(k_EFriendFlagImmediate);
|
||||
for (int i = 0; i < numFriends; i++)
|
||||
{
|
||||
CSteamID steamFrendzor = steamapicontext->SteamFriends()->GetFriendByIndex(i, k_EFriendFlagImmediate);
|
||||
AccountID_t acctId = steamFrendzor.GetAccountID();
|
||||
//const char *steamName = steamapicontext->SteamFriends()->GetFriendPersonaName(steamFrendzor);
|
||||
if (acctId == 5800795)
|
||||
{
|
||||
//5800795 is my old steam acct running on my laptop to test this shit
|
||||
steamapicontext->SteamFriends()->InviteUserToGame(steamFrendzor, "connect 1.2.3.4;password barf");
|
||||
}
|
||||
|
||||
}*/
|
||||
#endif
|
||||
|
||||
// We aren't happy unless we get all of our interfaces.
|
||||
|
@ -1115,11 +1109,6 @@ int CHLClient::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physi
|
|||
#ifndef _X360
|
||||
HookHapticMessages(); // Always hook the messages
|
||||
#endif
|
||||
|
||||
#ifdef FF
|
||||
//lua_init();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1200,10 +1189,6 @@ void CHLClient::PostInit()
|
|||
//-----------------------------------------------------------------------------
|
||||
void CHLClient::Shutdown( void )
|
||||
{
|
||||
#ifdef FF
|
||||
//lua_shutdown();
|
||||
#endif
|
||||
|
||||
if (g_pAchievementsAndStatsInterface)
|
||||
{
|
||||
g_pAchievementsAndStatsInterface->ReleasePanel();
|
||||
|
@ -1839,6 +1824,7 @@ void CHLClient::VoiceStatus( int entindex, qboolean bTalking )
|
|||
}
|
||||
|
||||
|
||||
#ifndef FF
|
||||
//-----------------------------------------------------------------------------
|
||||
// Called when the string table for materials changes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1848,6 +1834,17 @@ void OnMaterialStringTableChanged( void *object, INetworkStringTable *stringTabl
|
|||
gHLClient.PrecacheMaterial( newString );
|
||||
RequestCacheUsedMaterials();
|
||||
}
|
||||
#else
|
||||
//-----------------------------------------------------------------------------
|
||||
// Called when the string table for materials changes
|
||||
//-----------------------------------------------------------------------------
|
||||
void OnMaterialStringTableChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, void const *newData )
|
||||
{
|
||||
// Make sure this puppy is precached
|
||||
gFFClient.PrecacheMaterial( newString );
|
||||
RequestCacheUsedMaterials();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -111,6 +111,154 @@ extern IReplayScreenshotManager *g_pReplayScreenshotManager;
|
|||
extern IEngineReplay *g_pEngineReplay;
|
||||
extern IEngineClientReplay *g_pEngineClientReplay;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: engine to client .dll interface
|
||||
//-----------------------------------------------------------------------------
|
||||
class CHLClient : public IBaseClientDLL
|
||||
{
|
||||
public:
|
||||
CHLClient();
|
||||
|
||||
virtual int Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physicsFactory, CGlobalVarsBase *pGlobals );
|
||||
|
||||
virtual void PostInit();
|
||||
virtual void Shutdown( void );
|
||||
|
||||
virtual bool ReplayInit( CreateInterfaceFn fnReplayFactory );
|
||||
virtual bool ReplayPostInit();
|
||||
|
||||
virtual void LevelInitPreEntity( const char *pMapName );
|
||||
virtual void LevelInitPostEntity();
|
||||
virtual void LevelShutdown( void );
|
||||
|
||||
virtual ClientClass *GetAllClasses( void );
|
||||
|
||||
virtual int HudVidInit( void );
|
||||
virtual void HudProcessInput( bool bActive );
|
||||
virtual void HudUpdate( bool bActive );
|
||||
virtual void HudReset( void );
|
||||
virtual void HudText( const char * message );
|
||||
|
||||
// Mouse Input Interfaces
|
||||
virtual void IN_ActivateMouse( void );
|
||||
virtual void IN_DeactivateMouse( void );
|
||||
virtual void IN_Accumulate( void );
|
||||
virtual void IN_ClearStates( void );
|
||||
virtual bool IN_IsKeyDown( const char *name, bool& isdown );
|
||||
virtual void IN_OnMouseWheeled( int nDelta );
|
||||
// Raw signal
|
||||
virtual int IN_KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszCurrentBinding );
|
||||
virtual void IN_SetSampleTime( float frametime );
|
||||
// Create movement command
|
||||
virtual void CreateMove ( int sequence_number, float input_sample_frametime, bool active );
|
||||
virtual void ExtraMouseSample( float frametime, bool active );
|
||||
virtual bool WriteUsercmdDeltaToBuffer( bf_write *buf, int from, int to, bool isnewcommand );
|
||||
virtual void EncodeUserCmdToBuffer( bf_write& buf, int slot );
|
||||
virtual void DecodeUserCmdFromBuffer( bf_read& buf, int slot );
|
||||
|
||||
|
||||
virtual void View_Render( vrect_t *rect );
|
||||
virtual void RenderView( const CViewSetup &view, int nClearFlags, int whatToDraw );
|
||||
virtual void View_Fade( ScreenFade_t *pSF );
|
||||
|
||||
virtual void SetCrosshairAngle( const QAngle& angle );
|
||||
|
||||
virtual void InitSprite( CEngineSprite *pSprite, const char *loadname );
|
||||
virtual void ShutdownSprite( CEngineSprite *pSprite );
|
||||
|
||||
virtual int GetSpriteSize( void ) const;
|
||||
|
||||
virtual void VoiceStatus( int entindex, qboolean bTalking );
|
||||
|
||||
virtual void InstallStringTableCallback( const char *tableName );
|
||||
|
||||
virtual void FrameStageNotify( ClientFrameStage_t curStage );
|
||||
|
||||
virtual bool DispatchUserMessage( int msg_type, bf_read &msg_data );
|
||||
|
||||
// Save/restore system hooks
|
||||
virtual CSaveRestoreData *SaveInit( int size );
|
||||
virtual void SaveWriteFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int );
|
||||
virtual void SaveReadFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int );
|
||||
virtual void PreSave( CSaveRestoreData * );
|
||||
virtual void Save( CSaveRestoreData * );
|
||||
virtual void WriteSaveHeaders( CSaveRestoreData * );
|
||||
virtual void ReadRestoreHeaders( CSaveRestoreData * );
|
||||
virtual void Restore( CSaveRestoreData *, bool );
|
||||
virtual void DispatchOnRestore();
|
||||
virtual void WriteSaveGameScreenshot( const char *pFilename );
|
||||
|
||||
// Given a list of "S(wavname) S(wavname2)" tokens, look up the localized text and emit
|
||||
// the appropriate close caption if running with closecaption = 1
|
||||
virtual void EmitSentenceCloseCaption( char const *tokenstream );
|
||||
virtual void EmitCloseCaption( char const *captionname, float duration );
|
||||
|
||||
virtual CStandardRecvProxies* GetStandardRecvProxies();
|
||||
|
||||
virtual bool CanRecordDemo( char *errorMsg, int length ) const;
|
||||
|
||||
virtual void OnDemoRecordStart( char const* pDemoBaseName );
|
||||
virtual void OnDemoRecordStop();
|
||||
virtual void OnDemoPlaybackStart( char const* pDemoBaseName );
|
||||
virtual void OnDemoPlaybackStop();
|
||||
|
||||
virtual bool ShouldDrawDropdownConsole();
|
||||
|
||||
// Get client screen dimensions
|
||||
virtual int GetScreenWidth();
|
||||
virtual int GetScreenHeight();
|
||||
|
||||
// save game screenshot writing
|
||||
virtual void WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height, bool bCreatePowerOf2Padded/*=false*/, bool bWriteVTF/*=false*/ );
|
||||
|
||||
// Gets the location of the player viewpoint
|
||||
virtual bool GetPlayerView( CViewSetup &playerView );
|
||||
|
||||
// Matchmaking
|
||||
virtual void SetupGameProperties( CUtlVector< XUSER_CONTEXT > &contexts, CUtlVector< XUSER_PROPERTY > &properties );
|
||||
virtual uint GetPresenceID( const char *pIDName );
|
||||
virtual const char *GetPropertyIdString( const uint id );
|
||||
virtual void GetPropertyDisplayString( uint id, uint value, char *pOutput, int nBytes );
|
||||
virtual void StartStatsReporting( HANDLE handle, bool bArbitrated );
|
||||
|
||||
virtual void InvalidateMdlCache();
|
||||
|
||||
virtual void ReloadFilesInList( IFileList *pFilesToReload );
|
||||
|
||||
// Let the client handle UI toggle - if this function returns false, the UI will toggle, otherwise it will not.
|
||||
virtual bool HandleUiToggle();
|
||||
|
||||
// Allow the console to be shown?
|
||||
virtual bool ShouldAllowConsole();
|
||||
|
||||
// Get renamed recv tables
|
||||
virtual CRenamedRecvTableInfo *GetRenamedRecvTableInfos();
|
||||
|
||||
// Get the mouthinfo for the sound being played inside UI panels
|
||||
virtual CMouthInfo *GetClientUIMouthInfo();
|
||||
|
||||
// Notify the client that a file has been received from the game server
|
||||
virtual void FileReceived( const char * fileName, unsigned int transferID );
|
||||
|
||||
virtual const char* TranslateEffectForVisionFilter( const char *pchEffectType, const char *pchEffectName );
|
||||
|
||||
virtual void ClientAdjustStartSoundParams( struct StartSoundParams_t& params );
|
||||
|
||||
// Returns true if the disconnect command has been handled by the client
|
||||
virtual bool DisconnectAttempt( void );
|
||||
public:
|
||||
void PrecacheMaterial( const char *pMaterialName );
|
||||
|
||||
virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar );
|
||||
|
||||
private:
|
||||
void UncacheAllMaterials( );
|
||||
void ResetStringTablePointers();
|
||||
|
||||
CUtlVector< IMaterial * > m_CachedMaterials;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// HPE_BEGIN
|
||||
// [dwenger] Necessary for stats display
|
||||
|
|
|
@ -32,7 +32,8 @@ $Project "Client (FF)"
|
|||
{
|
||||
$Folder "Game"
|
||||
{
|
||||
|
||||
$File "ff\ff_cl_dll_interface.cpp"
|
||||
$File "ff\ff_cl_dll_interface.h"
|
||||
}
|
||||
$Folder "Player"
|
||||
{
|
||||
|
|
51
mp/src/game/client/ff/ff_cl_dll_interface.cpp
Normal file
51
mp/src/game/client/ff/ff_cl_dll_interface.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include "cbase.h"
|
||||
#include "ff_cl_dll_interface.h"
|
||||
|
||||
#include "steam/steam_api.h"
|
||||
#include "ff_sh_scriptman.h"
|
||||
|
||||
#define CLIENT_DLL_INTERFACE_VERSION "VClient017"
|
||||
|
||||
int CFF_CL_DLL_Interface::Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physicsFactory, CGlobalVarsBase *pGlobals )
|
||||
{
|
||||
int ret = BaseClass::Init( appSystemFactory, physicsFactory, pGlobals );
|
||||
|
||||
// initialize UI Lua VM
|
||||
g_UIScriptManager.Init();
|
||||
|
||||
// Test steam API
|
||||
uint32 appId = steamapicontext->SteamUtils()->GetAppID();
|
||||
char msg[128];
|
||||
Q_snprintf(msg, 128,"Steam AppID = %i\n", appId);
|
||||
DevMsg(msg);
|
||||
/*
|
||||
// careful: you might want to use a long long if you're a internet celeb like squeek
|
||||
int numFriends = steamapicontext->SteamFriends()->GetFriendCount(k_EFriendFlagImmediate);
|
||||
for (int i = 0; i < numFriends; i++)
|
||||
{
|
||||
CSteamID steamFrendzor = steamapicontext->SteamFriends()->GetFriendByIndex(i, k_EFriendFlagImmediate);
|
||||
AccountID_t acctId = steamFrendzor.GetAccountID();
|
||||
//const char *steamName = steamapicontext->SteamFriends()->GetFriendPersonaName(steamFrendzor);
|
||||
if (acctId == 5800795)
|
||||
{
|
||||
//5800795 is my old steam acct running on my laptop to test this shit
|
||||
steamapicontext->SteamFriends()->InviteUserToGame(steamFrendzor, "connect 1.2.3.4;password barf");
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CFF_CL_DLL_Interface::Shutdown( void )
|
||||
{
|
||||
// shutdown UI Lua VM
|
||||
g_UIScriptManager.Shutdown();
|
||||
|
||||
BaseClass::Shutdown();
|
||||
}
|
||||
|
||||
CFF_CL_DLL_Interface gFFClient;
|
||||
IBaseClientDLL *clientdll = &gFFClient;
|
||||
|
||||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CFF_CL_DLL_Interface, IBaseClientDLL, CLIENT_DLL_INTERFACE_VERSION, gFFClient );
|
162
mp/src/game/client/ff/ff_cl_dll_interface.h
Normal file
162
mp/src/game/client/ff/ff_cl_dll_interface.h
Normal file
|
@ -0,0 +1,162 @@
|
|||
#ifndef FF_CL_DLL_INTERFACE_H
|
||||
#define FF_CL_DLL_INTERFACE_H
|
||||
#pragma once
|
||||
|
||||
#include "cdll_client_int.h"
|
||||
|
||||
class CHLClient;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: engine to client .dll interface
|
||||
//-----------------------------------------------------------------------------
|
||||
class CFF_CL_DLL_Interface : public CHLClient
|
||||
{
|
||||
public:
|
||||
// squeek: I couldn't get DECLARE_CLASS_NOBASE to compile in CHLClient, so I couldn't use DECLARE_CLASS here
|
||||
// this works but it could potentially have negative consequences
|
||||
DECLARE_CLASS_GAMEROOT( CFF_CL_DLL_Interface, CHLClient );
|
||||
|
||||
// <-- Extended functions (meaning the BaseClass function is always called)
|
||||
virtual int Init( CreateInterfaceFn appSystemFactory, CreateInterfaceFn physicsFactory, CGlobalVarsBase *pGlobals );
|
||||
virtual void Shutdown( void );
|
||||
// --> Extended functions
|
||||
|
||||
/*
|
||||
virtual void PostInit();
|
||||
|
||||
virtual bool ReplayInit( CreateInterfaceFn fnReplayFactory );
|
||||
virtual bool ReplayPostInit();
|
||||
|
||||
virtual void LevelInitPreEntity( const char *pMapName );
|
||||
virtual void LevelInitPostEntity();
|
||||
virtual void LevelShutdown( void );
|
||||
|
||||
virtual ClientClass *GetAllClasses( void );
|
||||
|
||||
virtual int HudVidInit( void );
|
||||
virtual void HudProcessInput( bool bActive );
|
||||
virtual void HudUpdate( bool bActive );
|
||||
virtual void HudReset( void );
|
||||
virtual void HudText( const char * message );
|
||||
|
||||
// Mouse Input Interfaces
|
||||
virtual void IN_ActivateMouse( void );
|
||||
virtual void IN_DeactivateMouse( void );
|
||||
virtual void IN_Accumulate( void );
|
||||
virtual void IN_ClearStates( void );
|
||||
virtual bool IN_IsKeyDown( const char *name, bool& isdown );
|
||||
virtual void IN_OnMouseWheeled( int nDelta );
|
||||
// Raw signal
|
||||
virtual int IN_KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszCurrentBinding );
|
||||
virtual void IN_SetSampleTime( float frametime );
|
||||
// Create movement command
|
||||
virtual void CreateMove ( int sequence_number, float input_sample_frametime, bool active );
|
||||
virtual void ExtraMouseSample( float frametime, bool active );
|
||||
virtual bool WriteUsercmdDeltaToBuffer( bf_write *buf, int from, int to, bool isnewcommand );
|
||||
virtual void EncodeUserCmdToBuffer( bf_write& buf, int slot );
|
||||
virtual void DecodeUserCmdFromBuffer( bf_read& buf, int slot );
|
||||
|
||||
|
||||
virtual void View_Render( vrect_t *rect );
|
||||
virtual void RenderView( const CViewSetup &view, int nClearFlags, int whatToDraw );
|
||||
virtual void View_Fade( ScreenFade_t *pSF );
|
||||
|
||||
virtual void SetCrosshairAngle( const QAngle& angle );
|
||||
|
||||
virtual void InitSprite( CEngineSprite *pSprite, const char *loadname );
|
||||
virtual void ShutdownSprite( CEngineSprite *pSprite );
|
||||
|
||||
virtual int GetSpriteSize( void ) const;
|
||||
|
||||
virtual void VoiceStatus( int entindex, qboolean bTalking );
|
||||
|
||||
virtual void InstallStringTableCallback( const char *tableName );
|
||||
|
||||
virtual void FrameStageNotify( ClientFrameStage_t curStage );
|
||||
|
||||
virtual bool DispatchUserMessage( int msg_type, bf_read &msg_data );
|
||||
|
||||
// Save/restore system hooks
|
||||
virtual CSaveRestoreData *SaveInit( int size );
|
||||
virtual void SaveWriteFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int );
|
||||
virtual void SaveReadFields( CSaveRestoreData *, const char *, void *, datamap_t *, typedescription_t *, int );
|
||||
virtual void PreSave( CSaveRestoreData * );
|
||||
virtual void Save( CSaveRestoreData * );
|
||||
virtual void WriteSaveHeaders( CSaveRestoreData * );
|
||||
virtual void ReadRestoreHeaders( CSaveRestoreData * );
|
||||
virtual void Restore( CSaveRestoreData *, bool );
|
||||
virtual void DispatchOnRestore();
|
||||
virtual void WriteSaveGameScreenshot( const char *pFilename );
|
||||
|
||||
// Given a list of "S(wavname) S(wavname2)" tokens, look up the localized text and emit
|
||||
// the appropriate close caption if running with closecaption = 1
|
||||
virtual void EmitSentenceCloseCaption( char const *tokenstream );
|
||||
virtual void EmitCloseCaption( char const *captionname, float duration );
|
||||
|
||||
virtual CStandardRecvProxies* GetStandardRecvProxies();
|
||||
|
||||
virtual bool CanRecordDemo( char *errorMsg, int length ) const;
|
||||
|
||||
virtual void OnDemoRecordStart( char const* pDemoBaseName );
|
||||
virtual void OnDemoRecordStop();
|
||||
virtual void OnDemoPlaybackStart( char const* pDemoBaseName );
|
||||
virtual void OnDemoPlaybackStop();
|
||||
|
||||
virtual bool ShouldDrawDropdownConsole();
|
||||
|
||||
// Get client screen dimensions
|
||||
virtual int GetScreenWidth();
|
||||
virtual int GetScreenHeight();
|
||||
|
||||
// save game screenshot writing
|
||||
virtual void WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height, bool bCreatePowerOf2Padded, bool bWriteVTF );
|
||||
|
||||
// Gets the location of the player viewpoint
|
||||
virtual bool GetPlayerView( CViewSetup &playerView );
|
||||
|
||||
// Matchmaking
|
||||
virtual void SetupGameProperties( CUtlVector< XUSER_CONTEXT > &contexts, CUtlVector< XUSER_PROPERTY > &properties );
|
||||
virtual uint GetPresenceID( const char *pIDName );
|
||||
virtual const char *GetPropertyIdString( const uint id );
|
||||
virtual void GetPropertyDisplayString( uint id, uint value, char *pOutput, int nBytes );
|
||||
virtual void StartStatsReporting( HANDLE handle, bool bArbitrated );
|
||||
|
||||
virtual void InvalidateMdlCache();
|
||||
|
||||
virtual void ReloadFilesInList( IFileList *pFilesToReload );
|
||||
|
||||
// Let the client handle UI toggle - if this function returns false, the UI will toggle, otherwise it will not.
|
||||
virtual bool HandleUiToggle();
|
||||
|
||||
// Allow the console to be shown?
|
||||
virtual bool ShouldAllowConsole();
|
||||
|
||||
// Get renamed recv tables
|
||||
virtual CRenamedRecvTableInfo *GetRenamedRecvTableInfos();
|
||||
|
||||
// Get the mouthinfo for the sound being played inside UI panels
|
||||
virtual CMouthInfo *GetClientUIMouthInfo();
|
||||
|
||||
// Notify the client that a file has been received from the game server
|
||||
virtual void FileReceived( const char * fileName, unsigned int transferID );
|
||||
|
||||
virtual const char* TranslateEffectForVisionFilter( const char *pchEffectType, const char *pchEffectName );
|
||||
|
||||
virtual void ClientAdjustStartSoundParams( struct StartSoundParams_t& params );
|
||||
|
||||
// Returns true if the disconnect command has been handled by the client
|
||||
virtual bool DisconnectAttempt( void );
|
||||
public:
|
||||
void PrecacheMaterial( const char *pMaterialName );
|
||||
|
||||
virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar );
|
||||
|
||||
private:
|
||||
void UncacheAllMaterials( );
|
||||
void ResetStringTablePointers();
|
||||
|
||||
CUtlVector< IMaterial * > m_CachedMaterials;
|
||||
*/
|
||||
};
|
||||
|
||||
#endif
|
|
@ -28,10 +28,10 @@
|
|||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
#if FF_DLL
|
||||
#ifdef FF
|
||||
// custom game modes made so damn easy
|
||||
ConVar sv_mapluasuffix( "sv_mapluasuffix", "0", FCVAR_ARCHIVE, "Have a custom lua file (game mode) loaded when the map loads. If this suffix string is set, maps\\mapname__suffix__.lua (if it exists) is used instead of maps\\mapname.lua. To reset this cvar, make it 0.");
|
||||
ConVar sv_luaglobalscript( "sv_globalluascript", "0", FCVAR_ARCHIVE, "Load a custom lua file globally after map scripts. Will overwrite map script. Will be loaded from maps\\globalscripts. To disable, set to 0.");
|
||||
ConVar sv_mapluasuffix( "sv_mapluasuffix", "0", FCVAR_NOTIFY, "Have a custom lua file (game mode) loaded when the map loads. If this suffix string is set, maps\\mapname__suffix__.lua (if it exists) is used instead of maps\\mapname.lua. To reset this cvar, make it 0.");
|
||||
ConVar sv_luaglobalscript( "sv_globalluascript", "0", FCVAR_NOTIFY, "Load a custom lua file globally after map scripts. Will overwrite map script. Will be loaded from maps\\globalscripts. To disable, set to 0.");
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -39,7 +39,10 @@ using namespace luabind;
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// globals
|
||||
CFF_SH_ScriptManager _scriptman;
|
||||
CFF_SH_ScriptManager g_GameScriptManager;
|
||||
#ifdef CLIENT_DLL
|
||||
CFF_SH_ScriptManager g_UIScriptManager;
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -108,7 +111,6 @@ void CFF_SH_ScriptManager::Init()
|
|||
Msg("[SCRIPT] Entity system initialization successful.\n");
|
||||
}
|
||||
|
||||
#ifdef FF_DLL
|
||||
void CFF_SH_ScriptManager::LevelInit(const char* szMapName)
|
||||
{
|
||||
const char* default_luafile = "maps/default.lua";
|
||||
|
@ -133,7 +135,11 @@ void CFF_SH_ScriptManager::LevelInit(const char* szMapName)
|
|||
if ( sv_mapluasuffix.GetString()[0] != '0' )
|
||||
{
|
||||
Msg( "[SCRIPT] sv_mapluasuffix set to %s | finding maps\\%s__%s__.lua\n", sv_mapluasuffix.GetString(), szMapName, sv_mapluasuffix.GetString() );
|
||||
#ifdef CLIENT_DLL
|
||||
if ( filesystem->FileExists( VarArgs( "maps/%s__%s__.lua", szMapName, sv_mapluasuffix.GetString() ) ) )
|
||||
#else
|
||||
if ( filesystem->FileExists( UTIL_VarArgs( "maps/%s__%s__.lua", szMapName, sv_mapluasuffix.GetString() ) ) )
|
||||
#endif
|
||||
{
|
||||
Q_snprintf( filename, sizeof(filename), "maps/%s__%s__.lua", szMapName, sv_mapluasuffix.GetString() );
|
||||
Msg( "[SCRIPT] maps\\%s__%s__.lua found\n", szMapName, sv_mapluasuffix.GetString() );
|
||||
|
@ -149,7 +155,11 @@ void CFF_SH_ScriptManager::LevelInit(const char* szMapName)
|
|||
{
|
||||
const char* scriptname = sv_luaglobalscript.GetString();
|
||||
Msg("[SCRIPT] sv_luaglobalscript set to %s | loading global script maps maps\\globalscripts\\%s.lua\n", scriptname, scriptname );
|
||||
#ifdef CLIENT_DLL
|
||||
if( filesystem->FileExists( VarArgs( "maps/globalscripts/%s.lua", scriptname ) ) )
|
||||
#else
|
||||
if( filesystem->FileExists( UTIL_VarArgs( "maps/globalscripts/%s.lua", scriptname ) ) )
|
||||
#endif
|
||||
{
|
||||
Q_snprintf( globalscript_filename, sizeof(globalscript_filename), "maps/globalscripts/%s.lua", scriptname );
|
||||
Msg("[SCRIPT] maps\\globalscripts\\%s.lua found\n", scriptname );\
|
||||
|
@ -231,9 +241,7 @@ void CFF_SH_ScriptManager::LevelInit(const char* szMapName)
|
|||
// spawn the helper entity
|
||||
//FF_TODO: CFFEntitySystemHelper::Create();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FF_DLL
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CFF_SH_ScriptManager::LevelShutdown()
|
||||
{
|
||||
|
@ -245,8 +253,6 @@ void CFF_SH_ScriptManager::LevelShutdown()
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CFF_SH_ScriptManager::OnScriptLoad(const char* szFileName,
|
||||
const char* szFileContents)
|
||||
|
@ -282,7 +288,7 @@ bool CFF_SH_ScriptManager::LoadFile( lua_State *L, const char *filename)
|
|||
//FF_TODO: VPROF_BUDGET( "CFF_SH_ScriptManager::LoadFile", VPROF_BUDGETGROUP_FF_LUA );
|
||||
|
||||
// don't allow scripters to sneak in scripts after the initial load
|
||||
if(!_scriptman.m_isLoading)
|
||||
if(!m_isLoading)
|
||||
{
|
||||
Warning("[SCRIPT] Loading of scripts after initial map load is not allowed.\n");
|
||||
return false;
|
||||
|
@ -309,7 +315,7 @@ bool CFF_SH_ScriptManager::LoadFile( lua_State *L, const char *filename)
|
|||
filesystem->Close(hFile);
|
||||
|
||||
// preprocess script data
|
||||
_scriptman.OnScriptLoad(filename, buffer);
|
||||
OnScriptLoad(filename, buffer);
|
||||
|
||||
// load script
|
||||
int errorCode = luaL_loadbuffer(L, buffer, fileSize, filename);
|
||||
|
|
|
@ -36,20 +36,20 @@ public:
|
|||
|
||||
public:
|
||||
// inserts the lua file into the script environment
|
||||
static bool LoadFile(lua_State*, const char* filePath);
|
||||
bool LoadFile(lua_State*, const char* filePath);
|
||||
|
||||
public:
|
||||
// initializes the script VM
|
||||
void Init();
|
||||
// closes the script VM
|
||||
void Shutdown();
|
||||
|
||||
// loads the scripts for the level
|
||||
void LevelInit(const char* szMapName);
|
||||
|
||||
// cleans up the scripts for the most recent level
|
||||
void LevelShutdown();
|
||||
|
||||
private:
|
||||
// initializes the script VM
|
||||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
// surround code that loads scripts to capture crc checksum
|
||||
// of the scripts that are loaded
|
||||
void BeginScriptLoad();
|
||||
|
@ -107,7 +107,10 @@ private:
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// global externs
|
||||
extern CFF_SH_ScriptManager _scriptman;
|
||||
extern CFF_SH_ScriptManager g_GameScriptManager;
|
||||
#ifdef CLIENT_DLL
|
||||
extern CFF_SH_ScriptManager g_UIScriptManager;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue