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.
}
Ejemplo n.º 3
0
void *Sys_GetBotLibAPI (void *parms )
{
	void	*(*GetBotLibAPI) (void *);
	char	name[MAX_OSPATH];
	char	curpath[MAX_OSPATH];
#ifdef __i386__
	const char *botlibname = "qabotx86.so";
#elif defined(__amd64__) || defined(__x86_64__)
	const char *botlibname = "qabotamd64.so";
#elif defined __alpha__
	const char *botlibname = "qabotaxp.so";
#elif defined __mips__
	const char *botlibname = "qabotmips.so";
#else
#error Unknown arch
#endif
	// bk001129 - this code is never used
	assert(0);

	Sys_UnloadBotLib();
      
	getcwd(curpath, sizeof(curpath));

	Com_Printf("------- Loading %s -------\n", botlibname);
    
	sprintf (name, "%s/%s", curpath, botlibname);\
	// bk001129 - was  RTLD_LAZY
	botlib_library = dlopen (name, RTLD_NOW );
	if (!botlib_library)
	{
		Com_Printf ("LoadLibrary (%s)\n",name);
		Com_Error( ERR_FATAL, "Couldn't load botlib: %s", dlerror() );
	}

	GetBotLibAPI = (void *)dlsym (botlib_library, "GetBotLibAPI");
	if (!GetBotLibAPI)
	{
		Sys_UnloadBotLib ();
		Com_Error( ERR_FATAL, "dlsym() failed on GetBotLibAPI" );
	}

	// bk001129 - this is a signature mismatch
	return GetBotLibAPI (parms);
}
Ejemplo n.º 4
0
Archivo: bot.c Proyecto: icanhas/yantar
/*
 * SV_BotInitBotLib
 */
void
SV_BotInitBotLib(void)
{
	botlib_import_t botlib_import;

	if(debugpolygons) zfree(debugpolygons);
	bot_maxdebugpolys = cvargeti("bot_maxdebugpolys");
	debugpolygons = zalloc(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 = zmemavailable;
	botlib_import.HunkAlloc = BotImport_HunkAlloc;

	/* file system access */
	botlib_import.fsopen = fsopenmode;
	botlib_import.fsread	= fsread2;
	botlib_import.fswrite	= fswrite;
	botlib_import.fsclose = fsclose;
	botlib_import.fsseek = fsseek;

	/* 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);	/* somehow we end up with a zero import. */
}
Ejemplo n.º 5
0
/*
=======================================================================================================================================
SV_BotInitBotLib
=======================================================================================================================================
*/
void SV_BotInitBotLib(void) {
	botlib_import_t botlib_import;

	if (debugpolygons) {
		Z_Free(debugpolygons);
	}

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

	botlib_import.MilliSeconds = Sys_Milliseconds;
	botlib_import.Print = BotImport_Print;
	botlib_import.Trace = BotImport_Trace;
	botlib_import.EntitiesTrace = BotImport_EntitiesTrace;
	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_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.DebugPolygonDelete = BotImport_DebugPolygonDelete;

	botlib_export = (botlib_export_t *)GetBotLibAPI(BOTLIB_API_VERSION, &botlib_import);
	assert(botlib_export); // somehow we end up with a zero import.
}
Ejemplo n.º 6
0
/*
==================
SV_BotInitBotLib
==================
*/
void SV_BotInitBotLib(void)
{
	botlib_import_t botlib_import;

	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;

	botlib_import.BotDrawPolygon = BotImport_DrawPolygon;

	botlib_export = (botlib_export_t *)GetBotLibAPI(BOTLIB_API_VERSION, &botlib_import);
}