Ejemplo n.º 1
0
/*
==================
SV_BotInitBotLib
==================
*/
void SV_BotInitBotLib(void)
{
#if defined(USE_BOTLIB)
	botlib_import_t botlib_import;

#if COPY_PROTECT
	if(!Cvar_VariableValue("fs_restrict") && !Sys_CheckCD())
	{
		Com_Error(ERR_NEED_CD, "Game CD not in drive");
	}
#else
	Com_Printf("Bypassing CD checks\n");
#endif

	botlib_import.Print = BotImport_Print;
	botlib_import.Trace = BotImport_Trace;
	botlib_import.EntityTrace = BotImport_EntityTrace;
	botlib_import.PointContents = BotImport_PointContents;
	botlib_import.inPVS = BotImport_inPVS;
	botlib_import.BSPEntityData = BotImport_BSPEntityData;
	botlib_import.BSPModelMinsMaxsOrigin = BotImport_BSPModelMinsMaxsOrigin;
	botlib_import.BotClientCommand = BotClientCommand;

	//memory management
	botlib_import.GetMemory = BotImport_GetMemory;
	botlib_import.FreeMemory = BotImport_FreeMemory;
	botlib_import.FreeZoneMemory = BotImport_FreeZoneMemory;
	botlib_import.HunkAlloc = BotImport_HunkAlloc;

	// file system acess
	botlib_import.FS_FOpenFile = FS_FOpenFileByMode;
	botlib_import.FS_Read = FS_Read;
	botlib_import.FS_Write = FS_Write;
	botlib_import.FS_FCloseFile = FS_FCloseFile;
	botlib_import.FS_Seek = FS_Seek;

	//debug lines
	botlib_import.DebugLineCreate = BotImport_DebugLineCreate;
	botlib_import.DebugLineDelete = BotImport_DebugLineDelete;
	botlib_import.DebugLineShow = BotImport_DebugLineShow;

	//debug polygons
	botlib_import.DebugPolygonCreate = BotImport_DebugPolygonCreate;
	botlib_import.DebugPolygonGetFree = BotImport_GetFreeDebugPolygon;
	botlib_import.DebugPolygonDelete = BotImport_DebugPolygonDelete;
	botlib_import.DebugPolygonDeletePointer = BotImport_DebugPolygonDeletePointer;

	//bot routines
	botlib_import.BotVisibleFromPos = BotImport_BotVisibleFromPos;
	botlib_import.BotCheckAttackAtPos = BotImport_BotCheckAttackAtPos;

	botlib_import.BotDrawPolygon = BotImport_DrawPolygon;

	// singleplayer check
	// Arnout: no need for this
	//botlib_import.BotGameIsSinglePlayer = SV_GameIsSinglePlayer;

	botlib_export = (botlib_export_t *) GetBotLibAPI(BOTLIB_API_VERSION, &botlib_import);
#endif
}
Ejemplo n.º 2
0
/*
==================
SV_BotInitBotLib
==================
*/
void SV_BotInitBotLib(void)
{
    botlib_import_t	botlib_import;

    if ( !Cvar_VariableValue("fs_restrict") && !Sys_CheckCD() )
    {
        Com_Error( ERR_NEED_CD, "Game CD not in drive" );
    }

    if (debugpolygons) Z_Free(debugpolygons);
    bot_maxdebugpolys = Cvar_VariableIntegerValue("bot_maxdebugpolys");
    debugpolygons = (bot_debugpoly_t *)Z_Malloc(sizeof(bot_debugpoly_t) * bot_maxdebugpolys);

    botlib_import.Print = BotImport_Print;
    botlib_import.Trace = BotImport_Trace;
    botlib_import.EntityTrace = BotImport_EntityTrace;
    botlib_import.PointContents = BotImport_PointContents;
    botlib_import.inPVS = BotImport_inPVS;
    botlib_import.BSPEntityData = BotImport_BSPEntityData;
    botlib_import.BSPModelMinsMaxsOrigin = BotImport_BSPModelMinsMaxsOrigin;
    botlib_import.BotClientCommand = BotClientCommand;

    //memory management
    botlib_import.GetMemory = BotImport_GetMemory;
    botlib_import.FreeMemory = BotImport_FreeMemory;
    botlib_import.AvailableMemory = Z_AvailableMemory;
    botlib_import.HunkAlloc = BotImport_HunkAlloc;

    // file system access
    botlib_import.FS_FOpenFile = FS_FOpenFileByMode;
    botlib_import.FS_Read = FS_Read2;
    botlib_import.FS_Write = FS_Write;
    botlib_import.FS_FCloseFile = FS_FCloseFile;
    botlib_import.FS_Seek = FS_Seek;

    //debug lines
    botlib_import.DebugLineCreate = BotImport_DebugLineCreate;
    botlib_import.DebugLineDelete = BotImport_DebugLineDelete;
    botlib_import.DebugLineShow = BotImport_DebugLineShow;

    //debug polygons
    botlib_import.DebugPolygonCreate = BotImport_DebugPolygonCreate;
    botlib_import.DebugPolygonDelete = BotImport_DebugPolygonDelete;

    botlib_export = (botlib_export_t *)GetBotLibAPI( BOTLIB_API_VERSION, &botlib_import );
    assert(botlib_export); 	// bk001129 - somehow we end up with a zero import.
}