codemp/game/g_syscalls.c

Go to the documentation of this file.
00001 // Copyright (C) 1999-2000 Id Software, Inc.
00002 //
00003 #include "g_local.h"
00004 
00005 // this file is only included when building a dll
00006 // g_syscalls.asm is included instead when building a qvm
00007 
00008 static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;
00009 
00010 #include "../namespace_begin.h"
00011 #ifdef __linux__
00012 extern "C" {
00013 #endif
00014 void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
00015         syscall = syscallptr;
00016 }
00017 #ifdef __linux__
00018 }
00019 #endif
00020 
00021 int PASSFLOAT( float x ) {
00022         float   floatTemp;
00023         floatTemp = x;
00024         return *(int *)&floatTemp;
00025 }
00026 
00027 void    trap_Printf( const char *fmt ) {
00028         syscall( G_PRINT, fmt );
00029 }
00030 
00031 void    trap_Error( const char *fmt ) {
00032         syscall( G_ERROR, fmt );
00033 }
00034 
00035 int             trap_Milliseconds( void ) {
00036         return syscall( G_MILLISECONDS ); 
00037 }
00038 
00039 
00040 //rww - precision timer funcs... -ALWAYS- call end after start with supplied ptr, or you'll get a nasty memory leak.
00041 //not that you should be using these outside of debug anyway.. because you shouldn't be. So don't.
00042 
00043 //Start should be suppled with a pointer to an empty pointer (e.g. void *blah; trap_PrecisionTimer_Start(&blah);),
00044 //the empty pointer will be filled with an exe address to our timer (this address means nothing in vm land however).
00045 //You must pass this pointer back unmodified to the timer end func.
00046 void trap_PrecisionTimer_Start(void **theNewTimer)
00047 {
00048         syscall(G_PRECISIONTIMER_START, theNewTimer);
00049 }
00050 
00051 //If you're using the above example, the appropriate call for this is int result = trap_PrecisionTimer_End(blah);
00052 int trap_PrecisionTimer_End(void *theTimer)
00053 {
00054         return syscall(G_PRECISIONTIMER_END, theTimer);
00055 }
00056 
00057 void    trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) {
00058         syscall( G_CVAR_REGISTER, cvar, var_name, value, flags );
00059 }
00060 
00061 void    trap_Cvar_Update( vmCvar_t *cvar ) {
00062         syscall( G_CVAR_UPDATE, cvar );
00063 }
00064 
00065 void trap_Cvar_Set( const char *var_name, const char *value ) {
00066         syscall( G_CVAR_SET, var_name, value );
00067 }
00068 
00069 int trap_Cvar_VariableIntegerValue( const char *var_name ) {
00070         return syscall( G_CVAR_VARIABLE_INTEGER_VALUE, var_name );
00071 }
00072 
00073 void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) {
00074         syscall( G_CVAR_VARIABLE_STRING_BUFFER, var_name, buffer, bufsize );
00075 }
00076 
00077 int             trap_Argc( void ) {
00078         return syscall( G_ARGC );
00079 }
00080 
00081 void    trap_Argv( int n, char *buffer, int bufferLength ) {
00082         syscall( G_ARGV, n, buffer, bufferLength );
00083 }
00084 
00085 int             trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
00086         return syscall( G_FS_FOPEN_FILE, qpath, f, mode );
00087 }
00088 
00089 void    trap_FS_Read( void *buffer, int len, fileHandle_t f ) {
00090         syscall( G_FS_READ, buffer, len, f );
00091 }
00092 
00093 void    trap_FS_Write( const void *buffer, int len, fileHandle_t f ) {
00094         syscall( G_FS_WRITE, buffer, len, f );
00095 }
00096 
00097 void    trap_FS_FCloseFile( fileHandle_t f ) {
00098         syscall( G_FS_FCLOSE_FILE, f );
00099 }
00100 
00101 void    trap_SendConsoleCommand( int exec_when, const char *text ) {
00102         syscall( G_SEND_CONSOLE_COMMAND, exec_when, text );
00103 }
00104 
00105 void trap_LocateGameData( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t,
00106                                                  playerState_t *clients, int sizeofGClient ) {
00107         syscall( G_LOCATE_GAME_DATA, gEnts, numGEntities, sizeofGEntity_t, clients, sizeofGClient );
00108 }
00109 
00110 void trap_DropClient( int clientNum, const char *reason ) {
00111         syscall( G_DROP_CLIENT, clientNum, reason );
00112 }
00113 
00114 void trap_SendServerCommand( int clientNum, const char *text ) {
00115         syscall( G_SEND_SERVER_COMMAND, clientNum, text );
00116 }
00117 
00118 void trap_SetConfigstring( int num, const char *string ) {
00119         syscall( G_SET_CONFIGSTRING, num, string );
00120 }
00121 
00122 void trap_GetConfigstring( int num, char *buffer, int bufferSize ) {
00123         syscall( G_GET_CONFIGSTRING, num, buffer, bufferSize );
00124 }
00125 
00126 void trap_GetUserinfo( int num, char *buffer, int bufferSize ) {
00127         syscall( G_GET_USERINFO, num, buffer, bufferSize );
00128 }
00129 
00130 void trap_SetUserinfo( int num, const char *buffer ) {
00131         syscall( G_SET_USERINFO, num, buffer );
00132 }
00133 
00134 void trap_GetServerinfo( char *buffer, int bufferSize ) {
00135         syscall( G_GET_SERVERINFO, buffer, bufferSize );
00136 }
00137 
00138 //server culling to reduce traffic on open maps -rww
00139 void trap_SetServerCull(float cullDistance)
00140 {
00141         syscall(G_SET_SERVER_CULL, PASSFLOAT(cullDistance));
00142 }
00143 
00144 void trap_SetBrushModel( gentity_t *ent, const char *name ) {
00145         syscall( G_SET_BRUSH_MODEL, ent, name );
00146 }
00147 
00148 void trap_Trace( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ) {
00149         syscall( G_TRACE, results, start, mins, maxs, end, passEntityNum, contentmask, 0, 10 );
00150 }
00151 
00152 //g2TraceType 0 is no g2 col, 1 is collision against anything not EF_DEAD, 2 is collision against all.
00153 void trap_G2Trace( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask, int g2TraceType, int traceLod ) {
00154         syscall( G_G2TRACE, results, start, mins, maxs, end, passEntityNum, contentmask, g2TraceType, traceLod );
00155 }
00156 
00157 int trap_PointContents( const vec3_t point, int passEntityNum ) {
00158         return syscall( G_POINT_CONTENTS, point, passEntityNum );
00159 }
00160 
00161 
00162 qboolean trap_InPVS( const vec3_t p1, const vec3_t p2 ) {
00163         return syscall( G_IN_PVS, p1, p2 );
00164 }
00165 
00166 qboolean trap_InPVSIgnorePortals( const vec3_t p1, const vec3_t p2 ) {
00167         return syscall( G_IN_PVS_IGNORE_PORTALS, p1, p2 );
00168 }
00169 
00170 void trap_AdjustAreaPortalState( gentity_t *ent, qboolean open ) {
00171         syscall( G_ADJUST_AREA_PORTAL_STATE, ent, open );
00172 }
00173 
00174 qboolean trap_AreasConnected( int area1, int area2 ) {
00175         return syscall( G_AREAS_CONNECTED, area1, area2 );
00176 }
00177 
00178 void trap_LinkEntity( gentity_t *ent ) {
00179         syscall( G_LINKENTITY, ent );
00180 }
00181 
00182 void trap_UnlinkEntity( gentity_t *ent ) {
00183         syscall( G_UNLINKENTITY, ent );
00184 }
00185 
00186 int trap_EntitiesInBox( const vec3_t mins, const vec3_t maxs, int *list, int maxcount ) {
00187         return syscall( G_ENTITIES_IN_BOX, mins, maxs, list, maxcount );
00188 }
00189 
00190 qboolean trap_EntityContact( const vec3_t mins, const vec3_t maxs, const gentity_t *ent ) {
00191         return syscall( G_ENTITY_CONTACT, mins, maxs, ent );
00192 }
00193 
00194 int trap_BotAllocateClient( void ) {
00195         return syscall( G_BOT_ALLOCATE_CLIENT );
00196 }
00197 
00198 void trap_BotFreeClient( int clientNum ) {
00199         syscall( G_BOT_FREE_CLIENT, clientNum );
00200 }
00201 
00202 void trap_GetUsercmd( int clientNum, usercmd_t *cmd ) {
00203         syscall( G_GET_USERCMD, clientNum, cmd );
00204 }
00205 
00206 qboolean trap_GetEntityToken( char *buffer, int bufferSize ) {
00207         return syscall( G_GET_ENTITY_TOKEN, buffer, bufferSize );
00208 }
00209 
00210 void trap_SiegePersSet(siegePers_t *pers)
00211 {
00212         syscall(G_SIEGEPERSSET, pers);
00213 }
00214 void trap_SiegePersGet(siegePers_t *pers)
00215 {
00216         syscall(G_SIEGEPERSGET, pers);
00217 }
00218 
00219 int trap_FS_GetFileList(  const char *path, const char *extension, char *listbuf, int bufsize ) {
00220         return syscall( G_FS_GETFILELIST, path, extension, listbuf, bufsize );
00221 }
00222 
00223 int trap_DebugPolygonCreate(int color, int numPoints, vec3_t *points) {
00224         return syscall( G_DEBUG_POLYGON_CREATE, color, numPoints, points );
00225 }
00226 
00227 void trap_DebugPolygonDelete(int id) {
00228         syscall( G_DEBUG_POLYGON_DELETE, id );
00229 }
00230 
00231 int trap_RealTime( qtime_t *qtime ) {
00232         return syscall( G_REAL_TIME, qtime );
00233 }
00234 
00235 void trap_SnapVector( float *v ) {
00236         syscall( G_SNAPVECTOR, v );
00237 }
00238 
00239 void trap_TraceCapsule( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ) {
00240         syscall( G_TRACECAPSULE, results, start, mins, maxs, end, passEntityNum, contentmask, 0, 10 );
00241 }
00242 
00243 qboolean trap_EntityContactCapsule( const vec3_t mins, const vec3_t maxs, const gentity_t *ent ) {
00244         return syscall( G_ENTITY_CONTACTCAPSULE, mins, maxs, ent );
00245 }
00246 
00247 //qboolean trap_SP_RegisterServer( const char *package ) 
00248 //{
00249 //      return syscall( SP_REGISTER_SERVER_CMD, package );
00250 //}
00251 
00252 int trap_SP_GetStringTextString(const char *text, char *buffer, int bufferLength)
00253 {
00254         return syscall( SP_GETSTRINGTEXTSTRING, text, buffer, bufferLength );
00255 }
00256 
00257 qboolean trap_ROFF_Clean( void ) 
00258 {
00259         return syscall( G_ROFF_CLEAN );
00260 }
00261 
00262 void trap_ROFF_UpdateEntities( void ) 
00263 {
00264         syscall( G_ROFF_UPDATE_ENTITIES );
00265 }
00266 
00267 int trap_ROFF_Cache( char *file ) 
00268 {
00269         return syscall( G_ROFF_CACHE, file );
00270 }
00271 
00272 qboolean trap_ROFF_Play( int entID, int roffID, qboolean doTranslation ) 
00273 {
00274         return syscall( G_ROFF_PLAY, entID, roffID, doTranslation );
00275 }
00276 
00277 qboolean trap_ROFF_Purge_Ent( int entID ) 
00278 {
00279         return syscall( G_ROFF_PURGE_ENT, entID );
00280 }
00281 
00282 //rww - dynamic vm memory allocation!
00283 void trap_TrueMalloc(void **ptr, int size)
00284 {
00285         syscall(G_TRUEMALLOC, ptr, size);
00286 }
00287 
00288 void trap_TrueFree(void **ptr)
00289 {
00290         syscall(G_TRUEFREE, ptr);
00291 }
00292 
00293 //rww - icarus traps
00294 int trap_ICARUS_RunScript( gentity_t *ent, const char *name )
00295 {
00296         return syscall(G_ICARUS_RUNSCRIPT, ent, name);
00297 }
00298 
00299 qboolean trap_ICARUS_RegisterScript( const char *name, qboolean bCalledDuringInterrogate)
00300 {
00301         return syscall(G_ICARUS_REGISTERSCRIPT, name, bCalledDuringInterrogate);
00302 }
00303 
00304 void trap_ICARUS_Init( void )
00305 {
00306         syscall(G_ICARUS_INIT);
00307 }
00308 
00309 qboolean trap_ICARUS_ValidEnt( gentity_t *ent )
00310 {
00311         return syscall(G_ICARUS_VALIDENT, ent);
00312 }
00313 
00314 qboolean trap_ICARUS_IsInitialized( int entID )
00315 {
00316         return syscall(G_ICARUS_ISINITIALIZED, entID);
00317 }
00318 
00319 qboolean trap_ICARUS_MaintainTaskManager( int entID )
00320 {
00321         return syscall(G_ICARUS_MAINTAINTASKMANAGER, entID);
00322 }
00323 
00324 qboolean trap_ICARUS_IsRunning( int entID )
00325 {
00326         return syscall(G_ICARUS_ISRUNNING, entID);
00327 }
00328 
00329 qboolean trap_ICARUS_TaskIDPending(gentity_t *ent, int taskID)
00330 {
00331         return syscall(G_ICARUS_TASKIDPENDING, ent, taskID);
00332 }
00333 
00334 void trap_ICARUS_InitEnt( gentity_t *ent )
00335 {
00336         syscall(G_ICARUS_INITENT, ent);
00337 }
00338 
00339 void trap_ICARUS_FreeEnt( gentity_t *ent )
00340 {
00341         syscall(G_ICARUS_FREEENT, ent);
00342 }
00343 
00344 void trap_ICARUS_AssociateEnt( gentity_t *ent )
00345 {
00346         syscall(G_ICARUS_ASSOCIATEENT, ent);
00347 }
00348 
00349 void trap_ICARUS_Shutdown( void )
00350 {
00351         syscall(G_ICARUS_SHUTDOWN);
00352 }
00353 
00354 void trap_ICARUS_TaskIDSet(gentity_t *ent, int taskType, int taskID)
00355 {
00356         syscall(G_ICARUS_TASKIDSET, ent, taskType, taskID);
00357 }
00358 
00359 void trap_ICARUS_TaskIDComplete(gentity_t *ent, int taskType)
00360 {
00361         syscall(G_ICARUS_TASKIDCOMPLETE, ent, taskType);
00362 }
00363 
00364 void trap_ICARUS_SetVar(int taskID, int entID, const char *type_name, const char *data)
00365 {
00366         syscall(G_ICARUS_SETVAR, taskID, entID, type_name, data);
00367 }
00368 
00369 int trap_ICARUS_VariableDeclared(const char *type_name)
00370 {
00371         return syscall(G_ICARUS_VARIABLEDECLARED, type_name);
00372 }
00373 
00374 int trap_ICARUS_GetFloatVariable( const char *name, float *value )
00375 {
00376         return syscall(G_ICARUS_GETFLOATVARIABLE, name, value);
00377 }
00378 
00379 int trap_ICARUS_GetStringVariable( const char *name, const char *value )
00380 {
00381         return syscall(G_ICARUS_GETSTRINGVARIABLE, name, value);
00382 }
00383 
00384 int trap_ICARUS_GetVectorVariable( const char *name, const vec3_t value )
00385 {
00386         return syscall(G_ICARUS_GETVECTORVARIABLE, name, value);
00387 }
00388 
00389 //rww - BEGIN NPC NAV TRAPS
00390 void trap_Nav_Init( void )
00391 {
00392         syscall(G_NAV_INIT);
00393 }
00394 
00395 void trap_Nav_Free( void )
00396 {
00397         syscall(G_NAV_FREE);
00398 }
00399 
00400 qboolean trap_Nav_Load( const char *filename, int checksum )
00401 {
00402         return syscall(G_NAV_LOAD, filename, checksum);
00403 }
00404 
00405 qboolean trap_Nav_Save( const char *filename, int checksum )
00406 {
00407         return syscall(G_NAV_SAVE, filename, checksum);
00408 }
00409 
00410 int trap_Nav_AddRawPoint( vec3_t point, int flags, int radius )
00411 {
00412         return syscall(G_NAV_ADDRAWPOINT, point, flags, radius);
00413 }
00414 
00415 void trap_Nav_CalculatePaths( qboolean recalc ) //recalc = qfalse
00416 {
00417         syscall(G_NAV_CALCULATEPATHS, recalc);
00418 }
00419 
00420 void trap_Nav_HardConnect( int first, int second )
00421 {
00422         syscall(G_NAV_HARDCONNECT, first, second);
00423 }
00424 
00425 void trap_Nav_ShowNodes( void )
00426 {
00427         syscall(G_NAV_SHOWNODES);
00428 }
00429 
00430 void trap_Nav_ShowEdges( void )
00431 {
00432         syscall(G_NAV_SHOWEDGES);
00433 }
00434 
00435 void trap_Nav_ShowPath( int start, int end )
00436 {
00437         syscall(G_NAV_SHOWPATH, start, end);
00438 }
00439 
00440 int trap_Nav_GetNearestNode( gentity_t *ent, int lastID, int flags, int targetID )
00441 {
00442         return syscall(G_NAV_GETNEARESTNODE, ent, lastID, flags, targetID);
00443 }
00444 
00445 int trap_Nav_GetBestNode( int startID, int endID, int rejectID ) //rejectID = NODE_NONE
00446 {
00447         return syscall(G_NAV_GETBESTNODE, startID, endID, rejectID);
00448 }
00449 
00450 int trap_Nav_GetNodePosition( int nodeID, vec3_t out )
00451 {
00452         return syscall(G_NAV_GETNODEPOSITION, nodeID, out);
00453 }
00454 
00455 int trap_Nav_GetNodeNumEdges( int nodeID )
00456 {
00457         return syscall(G_NAV_GETNODENUMEDGES, nodeID);
00458 }
00459 
00460 int trap_Nav_GetNodeEdge( int nodeID, int edge )
00461 {
00462         return syscall(G_NAV_GETNODEEDGE, nodeID, edge);
00463 }
00464 
00465 int trap_Nav_GetNumNodes( void )
00466 {
00467         return syscall(G_NAV_GETNUMNODES);
00468 }
00469         
00470 qboolean trap_Nav_Connected( int startID, int endID )
00471 {
00472         return syscall(G_NAV_CONNECTED, startID, endID);
00473 }
00474 
00475 int trap_Nav_GetPathCost( int startID, int endID )
00476 {
00477         return syscall(G_NAV_GETPATHCOST, startID, endID);
00478 }
00479 
00480 int trap_Nav_GetEdgeCost( int startID, int endID )
00481 {
00482         return syscall(G_NAV_GETEDGECOST, startID, endID);
00483 }
00484 
00485 int trap_Nav_GetProjectedNode( vec3_t origin, int nodeID )
00486 {
00487         return syscall(G_NAV_GETPROJECTEDNODE, origin, nodeID);
00488 }
00489 
00490 void trap_Nav_CheckFailedNodes( gentity_t *ent )
00491 {
00492         syscall(G_NAV_CHECKFAILEDNODES, ent);
00493 }
00494 
00495 void trap_Nav_AddFailedNode( gentity_t *ent, int nodeID )
00496 {
00497         syscall(G_NAV_ADDFAILEDNODE, ent, nodeID);
00498 }
00499 
00500 qboolean trap_Nav_NodeFailed( gentity_t *ent, int nodeID )
00501 {
00502         return syscall(G_NAV_NODEFAILED, ent, nodeID);
00503 }
00504 
00505 qboolean trap_Nav_NodesAreNeighbors( int startID, int endID )
00506 {
00507         return syscall(G_NAV_NODESARENEIGHBORS, startID, endID);
00508 }
00509 
00510 void trap_Nav_ClearFailedEdge( failedEdge_t     *failedEdge )
00511 {
00512         syscall(G_NAV_CLEARFAILEDEDGE, failedEdge);
00513 }
00514 
00515 void trap_Nav_ClearAllFailedEdges( void )
00516 {
00517         syscall(G_NAV_CLEARALLFAILEDEDGES);
00518 }
00519 
00520 int trap_Nav_EdgeFailed( int startID, int endID )
00521 {
00522         return syscall(G_NAV_EDGEFAILED, startID, endID);
00523 }
00524 
00525 void trap_Nav_AddFailedEdge( int entID, int startID, int endID )
00526 {
00527         syscall(G_NAV_ADDFAILEDEDGE, entID, startID, endID);
00528 }
00529 
00530 qboolean trap_Nav_CheckFailedEdge( failedEdge_t *failedEdge )
00531 {
00532         return syscall(G_NAV_CHECKFAILEDEDGE, failedEdge);
00533 }
00534 
00535 void trap_Nav_CheckAllFailedEdges( void )
00536 {
00537         syscall(G_NAV_CHECKALLFAILEDEDGES);
00538 }
00539 
00540 qboolean trap_Nav_RouteBlocked( int startID, int testEdgeID, int endID, int rejectRank )
00541 {
00542         return syscall(G_NAV_ROUTEBLOCKED, startID, testEdgeID, endID, rejectRank);
00543 }
00544 
00545 int trap_Nav_GetBestNodeAltRoute( int startID, int endID, int *pathCost, int rejectID ) //rejectID = NODE_NONE
00546 {
00547         return syscall(G_NAV_GETBESTNODEALTROUTE, startID, endID, pathCost, rejectID);
00548 }
00549 
00550 int trap_Nav_GetBestNodeAltRoute2( int startID, int endID, int rejectID ) //rejectID = NODE_NONE
00551 {
00552         return syscall(G_NAV_GETBESTNODEALT2, startID, endID, rejectID);
00553 }
00554         
00555 int trap_Nav_GetBestPathBetweenEnts( gentity_t *ent, gentity_t *goal, int flags )
00556 {
00557         return syscall(G_NAV_GETBESTPATHBETWEENENTS, ent, goal, flags);
00558 }
00559 
00560 int     trap_Nav_GetNodeRadius( int nodeID )
00561 {
00562         return syscall(G_NAV_GETNODERADIUS, nodeID);
00563 }
00564 
00565 void trap_Nav_CheckBlockedEdges( void )
00566 {
00567         syscall(G_NAV_CHECKBLOCKEDEDGES);
00568 }
00569 
00570 void trap_Nav_ClearCheckedNodes( void )
00571 {
00572         syscall(G_NAV_CLEARCHECKEDNODES);
00573 }
00574 
00575 int trap_Nav_CheckedNode(int wayPoint, int ent) //return int was byte
00576 {
00577         return syscall(G_NAV_CHECKEDNODE, wayPoint, ent);
00578 }
00579 
00580 void trap_Nav_SetCheckedNode(int wayPoint, int ent, int value) //int value was byte value
00581 {
00582         syscall(G_NAV_SETCHECKEDNODE, wayPoint, ent, value);
00583 }
00584 
00585 void trap_Nav_FlagAllNodes( int newFlag )
00586 {
00587         syscall(G_NAV_FLAGALLNODES, newFlag);
00588 }
00589 
00590 qboolean trap_Nav_GetPathsCalculated(void)
00591 {
00592         return syscall(G_NAV_GETPATHSCALCULATED);
00593 }
00594 
00595 void trap_Nav_SetPathsCalculated(qboolean newVal)
00596 {
00597         syscall(G_NAV_SETPATHSCALCULATED, newVal);
00598 }
00599 //rww - END NPC NAV TRAPS
00600 
00601 void trap_SV_RegisterSharedMemory(char *memory)
00602 {
00603         syscall(G_SET_SHARED_BUFFER, memory);
00604 }
00605 
00606 // BotLib traps start here
00607 int trap_BotLibSetup( void ) {
00608         return syscall( BOTLIB_SETUP );
00609 }
00610 
00611 int trap_BotLibShutdown( void ) {
00612         return syscall( BOTLIB_SHUTDOWN );
00613 }
00614 
00615 int trap_BotLibVarSet(char *var_name, char *value) {
00616         return syscall( BOTLIB_LIBVAR_SET, var_name, value );
00617 }
00618 
00619 int trap_BotLibVarGet(char *var_name, char *value, int size) {
00620         return syscall( BOTLIB_LIBVAR_GET, var_name, value, size );
00621 }
00622 
00623 int trap_BotLibDefine(char *string) {
00624         return syscall( BOTLIB_PC_ADD_GLOBAL_DEFINE, string );
00625 }
00626 
00627 int trap_BotLibStartFrame(float time) {
00628         return syscall( BOTLIB_START_FRAME, PASSFLOAT( time ) );
00629 }
00630 
00631 int trap_BotLibLoadMap(const char *mapname) {
00632         return syscall( BOTLIB_LOAD_MAP, mapname );
00633 }
00634 
00635 int trap_BotLibUpdateEntity(int ent, void /* struct bot_updateentity_s */ *bue) {
00636         return syscall( BOTLIB_UPDATENTITY, ent, bue );
00637 }
00638 
00639 int trap_BotLibTest(int parm0, char *parm1, vec3_t parm2, vec3_t parm3) {
00640         return syscall( BOTLIB_TEST, parm0, parm1, parm2, parm3 );
00641 }
00642 
00643 int trap_BotGetSnapshotEntity( int clientNum, int sequence ) {
00644         return syscall( BOTLIB_GET_SNAPSHOT_ENTITY, clientNum, sequence );
00645 }
00646 
00647 int trap_BotGetServerCommand(int clientNum, char *message, int size) {
00648         return syscall( BOTLIB_GET_CONSOLE_MESSAGE, clientNum, message, size );
00649 }
00650 
00651 void trap_BotUserCommand(int clientNum, usercmd_t *ucmd) {
00652         syscall( BOTLIB_USER_COMMAND, clientNum, ucmd );
00653 }
00654 
00655 void trap_AAS_EntityInfo(int entnum, void /* struct aas_entityinfo_s */ *info) {
00656         syscall( BOTLIB_AAS_ENTITY_INFO, entnum, info );
00657 }
00658 
00659 int trap_AAS_Initialized(void) {
00660         return syscall( BOTLIB_AAS_INITIALIZED );
00661 }
00662 
00663 void trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs) {
00664         syscall( BOTLIB_AAS_PRESENCE_TYPE_BOUNDING_BOX, presencetype, mins, maxs );
00665 }
00666 
00667 float trap_AAS_Time(void) {
00668         int temp;
00669         temp = syscall( BOTLIB_AAS_TIME );
00670         return (*(float*)&temp);
00671 }
00672 
00673 int trap_AAS_PointAreaNum(vec3_t point) {
00674         return syscall( BOTLIB_AAS_POINT_AREA_NUM, point );
00675 }
00676 
00677 int trap_AAS_PointReachabilityAreaIndex(vec3_t point) {
00678         return syscall( BOTLIB_AAS_POINT_REACHABILITY_AREA_INDEX, point );
00679 }
00680 
00681 int trap_AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas) {
00682         return syscall( BOTLIB_AAS_TRACE_AREAS, start, end, areas, points, maxareas );
00683 }
00684 
00685 int trap_AAS_BBoxAreas(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas) {
00686         return syscall( BOTLIB_AAS_BBOX_AREAS, absmins, absmaxs, areas, maxareas );
00687 }
00688 
00689 int trap_AAS_AreaInfo( int areanum, void /* struct aas_areainfo_s */ *info ) {
00690         return syscall( BOTLIB_AAS_AREA_INFO, areanum, info );
00691 }
00692 
00693 int trap_AAS_PointContents(vec3_t point) {
00694         return syscall( BOTLIB_AAS_POINT_CONTENTS, point );
00695 }
00696 
00697 int trap_AAS_NextBSPEntity(int ent) {
00698         return syscall( BOTLIB_AAS_NEXT_BSP_ENTITY, ent );
00699 }
00700 
00701 int trap_AAS_ValueForBSPEpairKey(int ent, char *key, char *value, int size) {
00702         return syscall( BOTLIB_AAS_VALUE_FOR_BSP_EPAIR_KEY, ent, key, value, size );
00703 }
00704 
00705 int trap_AAS_VectorForBSPEpairKey(int ent, char *key, vec3_t v) {
00706         return syscall( BOTLIB_AAS_VECTOR_FOR_BSP_EPAIR_KEY, ent, key, v );
00707 }
00708 
00709 int trap_AAS_FloatForBSPEpairKey(int ent, char *key, float *value) {
00710         return syscall( BOTLIB_AAS_FLOAT_FOR_BSP_EPAIR_KEY, ent, key, value );
00711 }
00712 
00713 int trap_AAS_IntForBSPEpairKey(int ent, char *key, int *value) {
00714         return syscall( BOTLIB_AAS_INT_FOR_BSP_EPAIR_KEY, ent, key, value );
00715 }
00716 
00717 int trap_AAS_AreaReachability(int areanum) {
00718         return syscall( BOTLIB_AAS_AREA_REACHABILITY, areanum );
00719 }
00720 
00721 int trap_AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags) {
00722         return syscall( BOTLIB_AAS_AREA_TRAVEL_TIME_TO_GOAL_AREA, areanum, origin, goalareanum, travelflags );
00723 }
00724 
00725 int trap_AAS_EnableRoutingArea( int areanum, int enable ) {
00726         return syscall( BOTLIB_AAS_ENABLE_ROUTING_AREA, areanum, enable );
00727 }
00728 
00729 int trap_AAS_PredictRoute(void /*struct aas_predictroute_s*/ *route, int areanum, vec3_t origin,
00730                                                         int goalareanum, int travelflags, int maxareas, int maxtime,
00731                                                         int stopevent, int stopcontents, int stoptfl, int stopareanum) {
00732         return syscall( BOTLIB_AAS_PREDICT_ROUTE, route, areanum, origin, goalareanum, travelflags, maxareas, maxtime, stopevent, stopcontents, stoptfl, stopareanum );
00733 }
00734 
00735 int trap_AAS_AlternativeRouteGoals(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags,
00736                                                                                 void /*struct aas_altroutegoal_s*/ *altroutegoals, int maxaltroutegoals,
00737                                                                                 int type) {
00738         return syscall( BOTLIB_AAS_ALTERNATIVE_ROUTE_GOAL, start, startareanum, goal, goalareanum, travelflags, altroutegoals, maxaltroutegoals, type );
00739 }
00740 
00741 int trap_AAS_Swimming(vec3_t origin) {
00742         return syscall( BOTLIB_AAS_SWIMMING, origin );
00743 }
00744 
00745 int trap_AAS_PredictClientMovement(void /* struct aas_clientmove_s */ *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize) {
00746         return syscall( BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT, move, entnum, origin, presencetype, onground, velocity, cmdmove, cmdframes, maxframes, PASSFLOAT(frametime), stopevent, stopareanum, visualize );
00747 }
00748 
00749 void trap_EA_Say(int client, char *str) {
00750         syscall( BOTLIB_EA_SAY, client, str );
00751 }
00752 
00753 void trap_EA_SayTeam(int client, char *str) {
00754         syscall( BOTLIB_EA_SAY_TEAM, client, str );
00755 }
00756 
00757 void trap_EA_Command(int client, char *command) {
00758         syscall( BOTLIB_EA_COMMAND, client, command );
00759 }
00760 
00761 void trap_EA_Action(int client, int action) {
00762         syscall( BOTLIB_EA_ACTION, client, action );
00763 }
00764 
00765 void trap_EA_Gesture(int client) {
00766         syscall( BOTLIB_EA_GESTURE, client );
00767 }
00768 
00769 void trap_EA_Talk(int client) {
00770         syscall( BOTLIB_EA_TALK, client );
00771 }
00772 
00773 void trap_EA_Attack(int client) {
00774         syscall( BOTLIB_EA_ATTACK, client );
00775 }
00776 
00777 void trap_EA_Alt_Attack(int client) {
00778         syscall( BOTLIB_EA_ALT_ATTACK, client );
00779 }
00780 
00781 void trap_EA_ForcePower(int client) {
00782         syscall( BOTLIB_EA_FORCEPOWER, client );
00783 }
00784 
00785 void trap_EA_Use(int client) {
00786         syscall( BOTLIB_EA_USE, client );
00787 }
00788 
00789 void trap_EA_Respawn(int client) {
00790         syscall( BOTLIB_EA_RESPAWN, client );
00791 }
00792 
00793 void trap_EA_Crouch(int client) {
00794         syscall( BOTLIB_EA_CROUCH, client );
00795 }
00796 
00797 void trap_EA_MoveUp(int client) {
00798         syscall( BOTLIB_EA_MOVE_UP, client );
00799 }
00800 
00801 void trap_EA_MoveDown(int client) {
00802         syscall( BOTLIB_EA_MOVE_DOWN, client );
00803 }
00804 
00805 void trap_EA_MoveForward(int client) {
00806         syscall( BOTLIB_EA_MOVE_FORWARD, client );
00807 }
00808 
00809 void trap_EA_MoveBack(int client) {
00810         syscall( BOTLIB_EA_MOVE_BACK, client );
00811 }
00812 
00813 void trap_EA_MoveLeft(int client) {
00814         syscall( BOTLIB_EA_MOVE_LEFT, client );
00815 }
00816 
00817 void trap_EA_MoveRight(int client) {
00818         syscall( BOTLIB_EA_MOVE_RIGHT, client );
00819 }
00820 
00821 void trap_EA_SelectWeapon(int client, int weapon) {
00822         syscall( BOTLIB_EA_SELECT_WEAPON, client, weapon );
00823 }
00824 
00825 void trap_EA_Jump(int client) {
00826         syscall( BOTLIB_EA_JUMP, client );
00827 }
00828 
00829 void trap_EA_DelayedJump(int client) {
00830         syscall( BOTLIB_EA_DELAYED_JUMP, client );
00831 }
00832 
00833 void trap_EA_Move(int client, vec3_t dir, float speed) {
00834         syscall( BOTLIB_EA_MOVE, client, dir, PASSFLOAT(speed) );
00835 }
00836 
00837 void trap_EA_View(int client, vec3_t viewangles) {
00838         syscall( BOTLIB_EA_VIEW, client, viewangles );
00839 }
00840 
00841 void trap_EA_EndRegular(int client, float thinktime) {
00842         syscall( BOTLIB_EA_END_REGULAR, client, PASSFLOAT(thinktime) );
00843 }
00844 
00845 void trap_EA_GetInput(int client, float thinktime, void /* struct bot_input_s */ *input) {
00846         syscall( BOTLIB_EA_GET_INPUT, client, PASSFLOAT(thinktime), input );
00847 }
00848 
00849 void trap_EA_ResetInput(int client) {
00850         syscall( BOTLIB_EA_RESET_INPUT, client );
00851 }
00852 
00853 int trap_BotLoadCharacter(char *charfile, float skill) {
00854         return syscall( BOTLIB_AI_LOAD_CHARACTER, charfile, PASSFLOAT(skill));
00855 }
00856 
00857 void trap_BotFreeCharacter(int character) {
00858         syscall( BOTLIB_AI_FREE_CHARACTER, character );
00859 }
00860 
00861 float trap_Characteristic_Float(int character, int index) {
00862         int temp;
00863         temp = syscall( BOTLIB_AI_CHARACTERISTIC_FLOAT, character, index );
00864         return (*(float*)&temp);
00865 }
00866 
00867 float trap_Characteristic_BFloat(int character, int index, float min, float max) {
00868         int temp;
00869         temp = syscall( BOTLIB_AI_CHARACTERISTIC_BFLOAT, character, index, PASSFLOAT(min), PASSFLOAT(max) );
00870         return (*(float*)&temp);
00871 }
00872 
00873 int trap_Characteristic_Integer(int character, int index) {
00874         return syscall( BOTLIB_AI_CHARACTERISTIC_INTEGER, character, index );
00875 }
00876 
00877 int trap_Characteristic_BInteger(int character, int index, int min, int max) {
00878         return syscall( BOTLIB_AI_CHARACTERISTIC_BINTEGER, character, index, min, max );
00879 }
00880 
00881 void trap_Characteristic_String(int character, int index, char *buf, int size) {
00882         syscall( BOTLIB_AI_CHARACTERISTIC_STRING, character, index, buf, size );
00883 }
00884 
00885 int trap_BotAllocChatState(void) {
00886         return syscall( BOTLIB_AI_ALLOC_CHAT_STATE );
00887 }
00888 
00889 void trap_BotFreeChatState(int handle) {
00890         syscall( BOTLIB_AI_FREE_CHAT_STATE, handle );
00891 }
00892 
00893 void trap_BotQueueConsoleMessage(int chatstate, int type, char *message) {
00894         syscall( BOTLIB_AI_QUEUE_CONSOLE_MESSAGE, chatstate, type, message );
00895 }
00896 
00897 void trap_BotRemoveConsoleMessage(int chatstate, int handle) {
00898         syscall( BOTLIB_AI_REMOVE_CONSOLE_MESSAGE, chatstate, handle );
00899 }
00900 
00901 int trap_BotNextConsoleMessage(int chatstate, void /* struct bot_consolemessage_s */ *cm) {
00902         return syscall( BOTLIB_AI_NEXT_CONSOLE_MESSAGE, chatstate, cm );
00903 }
00904 
00905 int trap_BotNumConsoleMessages(int chatstate) {
00906         return syscall( BOTLIB_AI_NUM_CONSOLE_MESSAGE, chatstate );
00907 }
00908 
00909 void trap_BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 ) {
00910         syscall( BOTLIB_AI_INITIAL_CHAT, chatstate, type, mcontext, var0, var1, var2, var3, var4, var5, var6, var7 );
00911 }
00912 
00913 int     trap_BotNumInitialChats(int chatstate, char *type) {
00914         return syscall( BOTLIB_AI_NUM_INITIAL_CHATS, chatstate, type );
00915 }
00916 
00917 int trap_BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 ) {
00918         return syscall( BOTLIB_AI_REPLY_CHAT, chatstate, message, mcontext, vcontext, var0, var1, var2, var3, var4, var5, var6, var7 );
00919 }
00920 
00921 int trap_BotChatLength(int chatstate) {
00922         return syscall( BOTLIB_AI_CHAT_LENGTH, chatstate );
00923 }
00924 
00925 void trap_BotEnterChat(int chatstate, int client, int sendto) {
00926         syscall( BOTLIB_AI_ENTER_CHAT, chatstate, client, sendto );
00927 }
00928 
00929 void trap_BotGetChatMessage(int chatstate, char *buf, int size) {
00930         syscall( BOTLIB_AI_GET_CHAT_MESSAGE, chatstate, buf, size);
00931 }
00932 
00933 int trap_StringContains(char *str1, char *str2, int casesensitive) {
00934         return syscall( BOTLIB_AI_STRING_CONTAINS, str1, str2, casesensitive );
00935 }
00936 
00937 int trap_BotFindMatch(char *str, void /* struct bot_match_s */ *match, unsigned long int context) {
00938         return syscall( BOTLIB_AI_FIND_MATCH, str, match, context );
00939 }
00940 
00941 void trap_BotMatchVariable(void /* struct bot_match_s */ *match, int variable, char *buf, int size) {
00942         syscall( BOTLIB_AI_MATCH_VARIABLE, match, variable, buf, size );
00943 }
00944 
00945 void trap_UnifyWhiteSpaces(char *string) {
00946         syscall( BOTLIB_AI_UNIFY_WHITE_SPACES, string );
00947 }
00948 
00949 void trap_BotReplaceSynonyms(char *string, unsigned long int context) {
00950         syscall( BOTLIB_AI_REPLACE_SYNONYMS, string, context );
00951 }
00952 
00953 int trap_BotLoadChatFile(int chatstate, char *chatfile, char *chatname) {
00954         return syscall( BOTLIB_AI_LOAD_CHAT_FILE, chatstate, chatfile, chatname );
00955 }
00956 
00957 void trap_BotSetChatGender(int chatstate, int gender) {
00958         syscall( BOTLIB_AI_SET_CHAT_GENDER, chatstate, gender );
00959 }
00960 
00961 void trap_BotSetChatName(int chatstate, char *name, int client) {
00962         syscall( BOTLIB_AI_SET_CHAT_NAME, chatstate, name, client );
00963 }
00964 
00965 void trap_BotResetGoalState(int goalstate) {
00966         syscall( BOTLIB_AI_RESET_GOAL_STATE, goalstate );
00967 }
00968 
00969 void trap_BotResetAvoidGoals(int goalstate) {
00970         syscall( BOTLIB_AI_RESET_AVOID_GOALS, goalstate );
00971 }
00972 
00973 void trap_BotRemoveFromAvoidGoals(int goalstate, int number) {
00974         syscall( BOTLIB_AI_REMOVE_FROM_AVOID_GOALS, goalstate, number);
00975 }
00976 
00977 void trap_BotPushGoal(int goalstate, void /* struct bot_goal_s */ *goal) {
00978         syscall( BOTLIB_AI_PUSH_GOAL, goalstate, goal );
00979 }
00980 
00981 void trap_BotPopGoal(int goalstate) {
00982         syscall( BOTLIB_AI_POP_GOAL, goalstate );
00983 }
00984 
00985 void trap_BotEmptyGoalStack(int goalstate) {
00986         syscall( BOTLIB_AI_EMPTY_GOAL_STACK, goalstate );
00987 }
00988 
00989 void trap_BotDumpAvoidGoals(int goalstate) {
00990         syscall( BOTLIB_AI_DUMP_AVOID_GOALS, goalstate );
00991 }
00992 
00993 void trap_BotDumpGoalStack(int goalstate) {
00994         syscall( BOTLIB_AI_DUMP_GOAL_STACK, goalstate );
00995 }
00996 
00997 void trap_BotGoalName(int number, char *name, int size) {
00998         syscall( BOTLIB_AI_GOAL_NAME, number, name, size );
00999 }
01000 
01001 int trap_BotGetTopGoal(int goalstate, void /* struct bot_goal_s */ *goal) {
01002         return syscall( BOTLIB_AI_GET_TOP_GOAL, goalstate, goal );
01003 }
01004 
01005 int trap_BotGetSecondGoal(int goalstate, void /* struct bot_goal_s */ *goal) {
01006         return syscall( BOTLIB_AI_GET_SECOND_GOAL, goalstate, goal );
01007 }
01008 
01009 int trap_BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags) {
01010         return syscall( BOTLIB_AI_CHOOSE_LTG_ITEM, goalstate, origin, inventory, travelflags );
01011 }
01012 
01013 int trap_BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, void /* struct bot_goal_s */ *ltg, float maxtime) {
01014         return syscall( BOTLIB_AI_CHOOSE_NBG_ITEM, goalstate, origin, inventory, travelflags, ltg, PASSFLOAT(maxtime) );
01015 }
01016 
01017 int trap_BotTouchingGoal(vec3_t origin, void /* struct bot_goal_s */ *goal) {
01018         return syscall( BOTLIB_AI_TOUCHING_GOAL, origin, goal );
01019 }
01020 
01021 int trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void /* struct bot_goal_s */ *goal) {
01022         return syscall( BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE, viewer, eye, viewangles, goal );
01023 }
01024 
01025 int trap_BotGetLevelItemGoal(int index, char *classname, void /* struct bot_goal_s */ *goal) {
01026         return syscall( BOTLIB_AI_GET_LEVEL_ITEM_GOAL, index, classname, goal );
01027 }
01028 
01029 int trap_BotGetNextCampSpotGoal(int num, void /* struct bot_goal_s */ *goal) {
01030         return syscall( BOTLIB_AI_GET_NEXT_CAMP_SPOT_GOAL, num, goal );
01031 }
01032 
01033 int trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal) {
01034         return syscall( BOTLIB_AI_GET_MAP_LOCATION_GOAL, name, goal );
01035 }
01036 
01037 float trap_BotAvoidGoalTime(int goalstate, int number) {
01038         int temp;
01039         temp = syscall( BOTLIB_AI_AVOID_GOAL_TIME, goalstate, number );
01040         return (*(float*)&temp);
01041 }
01042 
01043 void trap_BotSetAvoidGoalTime(int goalstate, int number, float avoidtime) {
01044         syscall( BOTLIB_AI_SET_AVOID_GOAL_TIME, goalstate, number, PASSFLOAT(avoidtime));
01045 }
01046 
01047 void trap_BotInitLevelItems(void) {
01048         syscall( BOTLIB_AI_INIT_LEVEL_ITEMS );
01049 }
01050 
01051 void trap_BotUpdateEntityItems(void) {
01052         syscall( BOTLIB_AI_UPDATE_ENTITY_ITEMS );
01053 }
01054 
01055 int trap_BotLoadItemWeights(int goalstate, char *filename) {
01056         return syscall( BOTLIB_AI_LOAD_ITEM_WEIGHTS, goalstate, filename );
01057 }
01058 
01059 void trap_BotFreeItemWeights(int goalstate) {
01060         syscall( BOTLIB_AI_FREE_ITEM_WEIGHTS, goalstate );
01061 }
01062 
01063 void trap_BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child) {
01064         syscall( BOTLIB_AI_INTERBREED_GOAL_FUZZY_LOGIC, parent1, parent2, child );
01065 }
01066 
01067 void trap_BotSaveGoalFuzzyLogic(int goalstate, char *filename) {
01068         syscall( BOTLIB_AI_SAVE_GOAL_FUZZY_LOGIC, goalstate, filename );
01069 }
01070 
01071 void trap_BotMutateGoalFuzzyLogic(int goalstate, float range) {
01072         syscall( BOTLIB_AI_MUTATE_GOAL_FUZZY_LOGIC, goalstate, range );
01073 }
01074 
01075 int trap_BotAllocGoalState(int state) {
01076         return syscall( BOTLIB_AI_ALLOC_GOAL_STATE, state );
01077 }
01078 
01079 void trap_BotFreeGoalState(int handle) {
01080         syscall( BOTLIB_AI_FREE_GOAL_STATE, handle );
01081 }
01082 
01083 void trap_BotResetMoveState(int movestate) {
01084         syscall( BOTLIB_AI_RESET_MOVE_STATE, movestate );
01085 }
01086 
01087 void trap_BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type) {
01088         syscall( BOTLIB_AI_ADD_AVOID_SPOT, movestate, origin, PASSFLOAT(radius), type);
01089 }
01090 
01091 void trap_BotMoveToGoal(void /* struct bot_moveresult_s */ *result, int movestate, void /* struct bot_goal_s */ *goal, int travelflags) {
01092         syscall( BOTLIB_AI_MOVE_TO_GOAL, result, movestate, goal, travelflags );
01093 }
01094 
01095 int trap_BotMoveInDirection(int movestate, vec3_t dir, float speed, int type) {
01096         return syscall( BOTLIB_AI_MOVE_IN_DIRECTION, movestate, dir, PASSFLOAT(speed), type );
01097 }
01098 
01099 void trap_BotResetAvoidReach(int movestate) {
01100         syscall( BOTLIB_AI_RESET_AVOID_REACH, movestate );
01101 }
01102 
01103 void trap_BotResetLastAvoidReach(int movestate) {
01104         syscall( BOTLIB_AI_RESET_LAST_AVOID_REACH,movestate  );
01105 }
01106 
01107 int trap_BotReachabilityArea(vec3_t origin, int testground) {
01108         return syscall( BOTLIB_AI_REACHABILITY_AREA, origin, testground );
01109 }
01110 
01111 int trap_BotMovementViewTarget(int movestate, void /* struct bot_goal_s */ *goal, int travelflags, float lookahead, vec3_t target) {
01112         return syscall( BOTLIB_AI_MOVEMENT_VIEW_TARGET, movestate, goal, travelflags, PASSFLOAT(lookahead), target );
01113 }
01114 
01115 int trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void /* struct bot_goal_s */ *goal, int travelflags, vec3_t target) {
01116         return syscall( BOTLIB_AI_PREDICT_VISIBLE_POSITION, origin, areanum, goal, travelflags, target );
01117 }
01118 
01119 int trap_BotAllocMoveState(void) {
01120         return syscall( BOTLIB_AI_ALLOC_MOVE_STATE );
01121 }
01122 
01123 void trap_BotFreeMoveState(int handle) {
01124         syscall( BOTLIB_AI_FREE_MOVE_STATE, handle );
01125 }
01126 
01127 void trap_BotInitMoveState(int handle, void /* struct bot_initmove_s */ *initmove) {
01128         syscall( BOTLIB_AI_INIT_MOVE_STATE, handle, initmove );
01129 }
01130 
01131 int trap_BotChooseBestFightWeapon(int weaponstate, int *inventory) {
01132         return syscall( BOTLIB_AI_CHOOSE_BEST_FIGHT_WEAPON, weaponstate, inventory );
01133 }
01134 
01135 void trap_BotGetWeaponInfo(int weaponstate, int weapon, void /* struct weaponinfo_s */ *weaponinfo) {
01136         syscall( BOTLIB_AI_GET_WEAPON_INFO, weaponstate, weapon, weaponinfo );
01137 }
01138 
01139 int trap_BotLoadWeaponWeights(int weaponstate, char *filename) {
01140         return syscall( BOTLIB_AI_LOAD_WEAPON_WEIGHTS, weaponstate, filename );
01141 }
01142 
01143 int trap_BotAllocWeaponState(void) {
01144         return syscall( BOTLIB_AI_ALLOC_WEAPON_STATE );
01145 }
01146 
01147 void trap_BotFreeWeaponState(int weaponstate) {
01148         syscall( BOTLIB_AI_FREE_WEAPON_STATE, weaponstate );
01149 }
01150 
01151 void trap_BotResetWeaponState(int weaponstate) {
01152         syscall( BOTLIB_AI_RESET_WEAPON_STATE, weaponstate );
01153 }
01154 
01155 int trap_GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child) {
01156         return syscall( BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION, numranks, ranks, parent1, parent2, child );
01157 }
01158 
01159 int trap_PC_LoadSource( const char *filename ) {
01160         return syscall( BOTLIB_PC_LOAD_SOURCE, filename );
01161 }
01162 
01163 int trap_PC_FreeSource( int handle ) {
01164         return syscall( BOTLIB_PC_FREE_SOURCE, handle );
01165 }
01166 
01167 int trap_PC_ReadToken( int handle, pc_token_t *pc_token ) {
01168         return syscall( BOTLIB_PC_READ_TOKEN, handle, pc_token );
01169 }
01170 
01171 int trap_PC_SourceFileAndLine( int handle, char *filename, int *line ) {
01172         return syscall( BOTLIB_PC_SOURCE_FILE_AND_LINE, handle, filename, line );
01173 }
01174 
01175 
01176 /*
01177 Ghoul2 Insert Start
01178 */
01179 qhandle_t trap_R_RegisterSkin( const char *name )
01180 {
01181         return syscall( G_R_REGISTERSKIN, name );
01182 }
01183 
01184 // CG Specific API calls
01185 void trap_G2_ListModelBones(void *ghlInfo, int frame)
01186 {
01187         syscall( G_G2_LISTBONES, ghlInfo, frame);
01188 }
01189 
01190 void trap_G2_ListModelSurfaces(void *ghlInfo)
01191 {
01192         syscall( G_G2_LISTSURFACES, ghlInfo);
01193 }
01194 
01195 qboolean trap_G2_HaveWeGhoul2Models(    void *ghoul2)
01196 {
01197         return (qboolean)(syscall(G_G2_HAVEWEGHOULMODELS, ghoul2));
01198 }
01199 
01200 void trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList)
01201 {
01202         syscall( G_G2_SETMODELS, ghoul2, modelList, skinList);
01203 }
01204 
01205 qboolean trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
01206                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
01207 {
01208         return (qboolean)(syscall(G_G2_GETBOLT, ghoul2, modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale));
01209 }
01210 
01211 qboolean trap_G2API_GetBoltMatrix_NoReconstruct(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
01212                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
01213 { //Same as above but force it to not reconstruct the skeleton before getting the bolt position
01214         return (qboolean)(syscall(G_G2_GETBOLT_NOREC, ghoul2, modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale));
01215 }
01216 
01217 qboolean trap_G2API_GetBoltMatrix_NoRecNoRot(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
01218                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale)
01219 { //Same as above but force it to not reconstruct the skeleton before getting the bolt position
01220         return (qboolean)(syscall(G_G2_GETBOLT_NOREC_NOROT, ghoul2, modelIndex, boltIndex, matrix, angles, position, frameNum, modelList, scale));
01221 }
01222 
01223 int trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
01224                                                   qhandle_t customShader, int modelFlags, int lodBias)
01225 {
01226         return syscall(G_G2_INITGHOUL2MODEL, ghoul2Ptr, fileName, modelIndex, customSkin, customShader, modelFlags, lodBias);
01227 }
01228 
01229 qboolean trap_G2API_SetSkin(void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin)
01230 {
01231         return syscall(G_G2_SETSKIN, ghoul2, modelIndex, customSkin, renderSkin);
01232 }
01233 
01234 int trap_G2API_Ghoul2Size ( void* ghlInfo )
01235 {
01236         return syscall(G_G2_SIZE, ghlInfo );
01237 }
01238 
01239 int trap_G2API_AddBolt(void *ghoul2, int modelIndex, const char *boneName)
01240 {
01241         return syscall(G_G2_ADDBOLT, ghoul2, modelIndex, boneName);
01242 }
01243 
01244 void trap_G2API_SetBoltInfo(void *ghoul2, int modelIndex, int boltInfo)
01245 {
01246         syscall(G_G2_SETBOLTINFO, ghoul2, modelIndex, boltInfo);
01247 }
01248 
01249 qboolean trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
01250                                                                 const int up, const int right, const int forward, qhandle_t *modelList,
01251                                                                 int blendTime , int currentTime )
01252 {
01253         return (syscall(G_G2_ANGLEOVERRIDE, ghoul2, modelIndex, boneName, angles, flags, up, right, forward, modelList, blendTime, currentTime));
01254 }
01255 
01256 qboolean trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
01257                                                           const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime )
01258 {
01259         return syscall(G_G2_PLAYANIM, ghoul2, modelIndex, boneName, startFrame, endFrame, flags, PASSFLOAT(animSpeed), currentTime, PASSFLOAT(setFrame), blendTime);
01260 }
01261 
01262 qboolean trap_G2API_GetBoneAnim(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame,
01263                                                    int *startFrame, int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex)
01264 {
01265         return syscall(G_G2_GETBONEANIM, ghoul2, boneName, currentTime, currentFrame, startFrame, endFrame, flags, animSpeed, modelList, modelIndex);
01266 }
01267 
01268 void trap_G2API_GetGLAName(void *ghoul2, int modelIndex, char *fillBuf)
01269 {
01270         syscall(G_G2_GETGLANAME, ghoul2, modelIndex, fillBuf);
01271 }
01272 
01273 int trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex)
01274 {
01275         return syscall(G_G2_COPYGHOUL2INSTANCE, g2From, g2To, modelIndex);
01276 }
01277 
01278 void trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo)
01279 {
01280         syscall(G_G2_COPYSPECIFICGHOUL2MODEL, g2From, modelFrom, g2To, modelTo);
01281 }
01282 
01283 void trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To)
01284 {
01285         syscall(G_G2_DUPLICATEGHOUL2INSTANCE, g2From, g2To);
01286 }
01287 
01288 qboolean trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex)
01289 {
01290         return syscall(G_G2_HASGHOUL2MODELONINDEX, ghlInfo, modelIndex);
01291 }
01292 
01293 qboolean trap_G2API_RemoveGhoul2Model(void *ghlInfo, int modelIndex)
01294 {
01295         return syscall(G_G2_REMOVEGHOUL2MODEL, ghlInfo, modelIndex);
01296 }
01297 
01298 qboolean trap_G2API_RemoveGhoul2Models(void *ghlInfo)
01299 {
01300         return syscall(G_G2_REMOVEGHOUL2MODELS, ghlInfo);
01301 }
01302 
01303 void trap_G2API_CleanGhoul2Models(void **ghoul2Ptr)
01304 {
01305         syscall(G_G2_CLEANMODELS, ghoul2Ptr);
01306 }
01307 
01308 void trap_G2API_CollisionDetect ( 
01309         CollisionRecord_t *collRecMap, 
01310         void* ghoul2, 
01311         const vec3_t angles, 
01312         const vec3_t position,
01313         int frameNumber, 
01314         int entNum, 
01315         vec3_t rayStart, 
01316         vec3_t rayEnd, 
01317         vec3_t scale, 
01318         int traceFlags, 
01319         int useLod,
01320         float fRadius
01321         )
01322 {
01323         syscall ( G_G2_COLLISIONDETECT, collRecMap, ghoul2, angles, position, frameNumber, entNum, rayStart, rayEnd, scale, traceFlags, useLod, PASSFLOAT(fRadius) );
01324 }
01325 
01326 void trap_G2API_CollisionDetectCache ( 
01327         CollisionRecord_t *collRecMap, 
01328         void* ghoul2, 
01329         const vec3_t angles, 
01330         const vec3_t position,
01331         int frameNumber, 
01332         int entNum, 
01333         vec3_t rayStart, 
01334         vec3_t rayEnd, 
01335         vec3_t scale, 
01336         int traceFlags, 
01337         int useLod,
01338         float fRadius
01339         )
01340 {
01341         syscall ( G_G2_COLLISIONDETECTCACHE, collRecMap, ghoul2, angles, position, frameNumber, entNum, rayStart, rayEnd, scale, traceFlags, useLod, PASSFLOAT(fRadius) );
01342 }
01343 
01344 void trap_G2API_GetSurfaceName(void *ghoul2, int surfNumber, int modelIndex, char *fillBuf)
01345 {
01346         syscall(G_G2_GETSURFACENAME, ghoul2, surfNumber, modelIndex, fillBuf);
01347 }
01348 
01349 qboolean trap_G2API_SetRootSurface(void *ghoul2, const int modelIndex, const char *surfaceName)
01350 {
01351         return syscall(G_G2_SETROOTSURFACE, ghoul2, modelIndex, surfaceName);
01352 }
01353 
01354 qboolean trap_G2API_SetSurfaceOnOff(void *ghoul2, const char *surfaceName, const int flags)
01355 {
01356         return syscall(G_G2_SETSURFACEONOFF, ghoul2, surfaceName, flags);
01357 }
01358 
01359 qboolean trap_G2API_SetNewOrigin(void *ghoul2, const int boltIndex)
01360 {
01361         return syscall(G_G2_SETNEWORIGIN, ghoul2, boltIndex);
01362 }
01363 
01364 //check if a bone exists on skeleton without actually adding to the bone list -rww
01365 qboolean trap_G2API_DoesBoneExist(void *ghoul2, int modelIndex, const char *boneName)
01366 {
01367         return syscall(G_G2_DOESBONEEXIST, ghoul2, modelIndex, boneName);
01368 }
01369 
01370 int trap_G2API_GetSurfaceRenderStatus(void *ghoul2, const int modelIndex, const char *surfaceName)
01371 {
01372         return syscall(G_G2_GETSURFACERENDERSTATUS, ghoul2, modelIndex, surfaceName);
01373 }
01374 
01375 //hack for smoothing during ugly situations. forgive me.
01376 void trap_G2API_AbsurdSmoothing(void *ghoul2, qboolean status)
01377 {
01378         syscall(G_G2_ABSURDSMOOTHING, ghoul2, status);
01379 }
01380 
01381 //rww - RAGDOLL_BEGIN
01382 void trap_G2API_SetRagDoll(void *ghoul2, sharedRagDollParams_t *params)
01383 {
01384         syscall(G_G2_SETRAGDOLL, ghoul2, params);
01385 }
01386 
01387 void trap_G2API_AnimateG2Models(void *ghoul2, int time, sharedRagDollUpdateParams_t *params)
01388 {
01389         syscall(G_G2_ANIMATEG2MODELS, ghoul2, time, params);
01390 }
01391 //rww - RAGDOLL_END
01392 
01393 //additional ragdoll options -rww
01394 qboolean trap_G2API_RagPCJConstraint(void *ghoul2, const char *boneName, vec3_t min, vec3_t max) //override default pcj bonee constraints
01395 {
01396         return syscall(G_G2_RAGPCJCONSTRAINT, ghoul2, boneName, min, max);
01397 }
01398 
01399 qboolean trap_G2API_RagPCJGradientSpeed(void *ghoul2, const char *boneName, const float speed) //override the default gradient movespeed for a pcj bone
01400 {
01401         return syscall(G_G2_RAGPCJGRADIENTSPEED, ghoul2, boneName, PASSFLOAT(speed));
01402 }
01403 
01404 qboolean trap_G2API_RagEffectorGoal(void *ghoul2, const char *boneName, vec3_t pos) //override an effector bone's goal position (world coordinates)
01405 {
01406         return syscall(G_G2_RAGEFFECTORGOAL, ghoul2, boneName, pos);
01407 }
01408 
01409 qboolean trap_G2API_GetRagBonePos(void *ghoul2, const char *boneName, vec3_t pos, vec3_t entAngles, vec3_t entPos, vec3_t entScale) //current position of said bone is put into pos (world coordinates)
01410 {
01411         return syscall(G_G2_GETRAGBONEPOS, ghoul2, boneName, pos, entAngles, entPos, entScale);
01412 }
01413 
01414 qboolean trap_G2API_RagEffectorKick(void *ghoul2, const char *boneName, vec3_t velocity) //add velocity to a rag bone
01415 {
01416         return syscall(G_G2_RAGEFFECTORKICK, ghoul2, boneName, velocity);
01417 }
01418 
01419 qboolean trap_G2API_RagForceSolve(void *ghoul2, qboolean force) //make sure we are actively performing solve/settle routines, if desired
01420 {
01421         return syscall(G_G2_RAGFORCESOLVE, ghoul2, force);
01422 }
01423 
01424 qboolean trap_G2API_SetBoneIKState(void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params)
01425 {
01426         return syscall(G_G2_SETBONEIKSTATE, ghoul2, time, boneName, ikState, params);
01427 }
01428 
01429 qboolean trap_G2API_IKMove(void *ghoul2, int time, sharedIKMoveParams_t *params)
01430 {
01431         return syscall(G_G2_IKMOVE, ghoul2, time, params);
01432 }
01433 
01434 qboolean trap_G2API_RemoveBone(void *ghoul2, const char *boneName, int modelIndex)
01435 {
01436         return syscall(G_G2_REMOVEBONE, ghoul2, boneName, modelIndex);
01437 }
01438 
01439 //rww - Stuff to allow association of ghoul2 instances to entity numbers.
01440 //This way, on listen servers when both the client and server are doing
01441 //ghoul2 operations, we can copy relevant data off the client instance
01442 //directly onto the server instance and slash the transforms and whatnot
01443 //right in half.
01444 void trap_G2API_AttachInstanceToEntNum(void *ghoul2, int entityNum, qboolean server)
01445 {
01446         syscall(G_G2_ATTACHINSTANCETOENTNUM, ghoul2, entityNum, server);
01447 }
01448 
01449 void trap_G2API_ClearAttachedInstance(int entityNum)
01450 {
01451         syscall(G_G2_CLEARATTACHEDINSTANCE, entityNum);
01452 }
01453 
01454 void trap_G2API_CleanEntAttachments(void)
01455 {
01456         syscall(G_G2_CLEANENTATTACHMENTS);
01457 }
01458 
01459 qboolean trap_G2API_OverrideServer(void *serverInstance)
01460 {
01461         return syscall(G_G2_OVERRIDESERVER, serverInstance);
01462 }
01463 
01464 /*
01465 Ghoul2 Insert End
01466 */
01467 
01468 void trap_SetActiveSubBSP(int index)
01469 { //rwwRMG - added [NEWTRAP]
01470         syscall( G_SET_ACTIVE_SUBBSP, index );
01471 }
01472 
01473 int     trap_CM_RegisterTerrain(const char *config)
01474 { //rwwRMG - added [NEWTRAP]
01475         return syscall(G_CM_REGISTER_TERRAIN, config);
01476 }
01477 
01478 void trap_RMG_Init(int terrainID)
01479 { //rwwRMG - added [NEWTRAP]
01480         syscall(G_RMG_INIT, terrainID);
01481 }
01482 
01483 void trap_Bot_UpdateWaypoints(int wpnum, wpobject_t **wps)
01484 {
01485         syscall(G_BOT_UPDATEWAYPOINTS, wpnum, wps);
01486 }
01487 
01488 void trap_Bot_CalculatePaths(int rmg)
01489 {
01490         syscall(G_BOT_CALCULATEPATHS, rmg);
01491 }
01492 
01493 #include "../namespace_end.h"