vec3_t destpos, int destnum, qboolean updateVisPos ) {
if ( VM_IsNative( gvm ) ) {
return VM_Call( gvm, AICAST_VISIBLEFROMPOS, srcpos, srcnum, destpos, destnum, updateVisPos );
} else {
qboolean ret;
unsigned gSrcPos;
unsigned gDestPos;
gSrcPos = VM_GetTempMemory( gvm, sizeof(vec3_t), srcpos );
gDestPos = VM_GetTempMemory( gvm, sizeof(vec3_t), destpos );
ret = VM_Call( gvm, AICAST_VISIBLEFROMPOS, gSrcPos, srcnum, gDestPos, destnum, updateVisPos );
VM_FreeTempMemory( gvm, gDestPos, sizeof(vec3_t), destpos );
VM_FreeTempMemory( gvm, gSrcPos, sizeof(vec3_t), srcpos );
return ret;
}
}
/*
===============
BotImport_AICast_CheckAttackAtPos
===============
*/
qboolean BotImport_AICast_CheckAttackAtPos( int entnum, int enemy, vec3_t pos, qboolean ducking, qboolean allowHitWorld ) {
if ( VM_IsNative( gvm ) ) {
return VM_Call( gvm, AICAST_CHECKATTACKATPOS, entnum, enemy, pos, ducking, allowHitWorld );
} else {
qboolean ret;
unsigned gPos;
gPos = VM_GetTempMemory( gvm, sizeof(vec3_t), pos );
ret = VM_Call( gvm, AICAST_CHECKATTACKATPOS, entnum, enemy, gPos, ducking, allowHitWorld );
VM_FreeTempMemory( gvm, gPos, sizeof(vec3_t), pos );
return ret;
}
}
// done.
/*
==================
SV_BotInitBotLib
==================
*/
void SV_BotInitBotLib( void ) {
botlib_import_t botlib_import;
Com_Printf( "Bypassing CD checks\n" );
/*
if ( botlib_export ) {
SV_BotLibShutdown();
}*/
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.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.DebugPolygonDelete = BotImport_DebugPolygonDelete;
// Ridah, Cast AI
botlib_import.AICast_VisibleFromPos = BotImport_AICast_VisibleFromPos;
botlib_import.AICast_CheckAttackAtPos = BotImport_AICast_CheckAttackAtPos;
// done.
botlib_export = (botlib_export_t *)GetBotLibAPI( BOTLIB_API_VERSION, &botlib_import );
assert(botlib_export); // somehow we end up with a zero import.
}
//
// * * * BOT AI CODE IS BELOW THIS POINT * * *
//
/*
==================
SV_BotGetConsoleMessage
==================
*/