Пример #1
0
void CL_LoadParticleMan( void )
{
	char szPDir[512];

	if ( gEngfuncs.COM_ExpandFilename( PARTICLEMAN_DLLNAME, szPDir, sizeof( szPDir ) ) == FALSE )
	{
		g_pParticleMan = NULL;
		g_hParticleManModule = NULL;
		return;
	}

	g_hParticleManModule = Sys_LoadModule( szPDir );
	CreateInterfaceFn particleManFactory = Sys_GetFactory( g_hParticleManModule );

	if ( particleManFactory == NULL )
	{
		g_pParticleMan = NULL;
		g_hParticleManModule = NULL;
		return;
	}

	g_pParticleMan = (IParticleMan *)particleManFactory( PARTICLEMAN_INTERFACE, NULL);

	if ( g_pParticleMan )
	{
		 g_pParticleMan->SetUp( &gEngfuncs );

		 // Add custom particle classes here BEFORE calling anything else or you will die.
		 g_pParticleMan->AddCustomParticleClassSize ( sizeof ( CBaseParticle ) );
	}
}
Пример #2
0
int CL_DLLEXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
{
	gEngfuncs = *pEnginefuncs;

	RecClInitialize(pEnginefuncs, iVersion);

	if (iVersion != CLDLL_INTERFACE_VERSION)
		return 0;

	memcpy(&gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t));

	EV_HookEvents();
	// get tracker interface, if any
	char szDir[512];
	if (!gEngfuncs.COM_ExpandFilename("Bin/TrackerUI.dll", szDir, sizeof(szDir)))
	{
		g_pTrackerUser = NULL;
		g_hTrackerModule = NULL;
		return 1;
	}

	g_hTrackerModule = Sys_LoadModule(szDir);
	CreateInterfaceFn trackerFactory = Sys_GetFactory(g_hTrackerModule);
	if (!trackerFactory)
	{
		g_pTrackerUser = NULL;
		g_hTrackerModule = NULL;
		return 1;
	}

	g_pTrackerUser = (ITrackerUser *)trackerFactory(TRACKERUSER_INTERFACE_VERSION, NULL);
	return 1;
}
Пример #3
0
int EXPORT Initialize( cl_enginefunc_t *pEnginefuncs, int iVersion )
{
    gEngfuncs = *pEnginefuncs;

    //!!! mwh UNDONE We need to think about our versioning strategy. Do we want to try to be compatible
    // with previous versions, especially when we're only 'bonus' functionality? Should it be the engine
    // that decides if the DLL is compliant?

    if (iVersion != CLDLL_INTERFACE_VERSION)
        return 0;

    memcpy(&gEngfuncs, pEnginefuncs, sizeof(cl_enginefunc_t));

    EV_HookEvents();

    // Determine which filesystem to use.
#if defined ( _WIN32 )
    char *szFsModule = "filesystem_stdio.dll";
#elif defined(OSX)
    char *szFsModule = "filesystem_stdio.dylib";
#elif defined(LINUX)
    char *szFsModule = "filesystem_stdio.so";
#else
#error
#endif


    char szFSDir[MAX_PATH];
    szFSDir[0] = 0;
    if ( gEngfuncs.COM_ExpandFilename( szFsModule, szFSDir, sizeof( szFSDir ) ) == FALSE )
    {
        return false;
    }

    // Get filesystem interface.
    g_pFileSystemModule = Sys_LoadModule( szFSDir );
    assert( g_pFileSystemModule );
    if( !g_pFileSystemModule )
    {
        return false;
    }

    CreateInterfaceFn fileSystemFactory = Sys_GetFactory( g_pFileSystemModule );
    if( !fileSystemFactory )
    {
        return false;
    }

    g_pFileSystem = ( IFileSystem * )fileSystemFactory( FILESYSTEM_INTERFACE_VERSION, NULL );
    assert( g_pFileSystem );
    if( !g_pFileSystem )
    {
        return false;
    }

    return 1;
}