00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "../game/q_shared.h"
00033 #include "l_memory.h"
00034 #include "l_log.h"
00035 #include "l_libvar.h"
00036 #include "l_script.h"
00037 #include "l_precomp.h"
00038 #include "l_struct.h"
00039 #include "aasfile.h"
00040 #include "../game/botlib.h"
00041 #include "../game/be_aas.h"
00042 #include "be_aas_funcs.h"
00043 #include "be_aas_def.h"
00044 #include "be_interface.h"
00045
00046 #include "../game/be_ea.h"
00047 #include "be_ai_weight.h"
00048 #include "../game/be_ai_goal.h"
00049 #include "../game/be_ai_move.h"
00050 #include "../game/be_ai_weap.h"
00051 #include "../game/be_ai_chat.h"
00052 #include "../game/be_ai_char.h"
00053 #include "../game/be_ai_gen.h"
00054
00055
00056 botlib_globals_t botlibglobals;
00057
00058 botlib_export_t be_botlib_export;
00059 botlib_import_t botimport;
00060
00061 int bot_developer;
00062
00063 int botlibsetup = qfalse;
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 int Sys_MilliSeconds(void)
00078 {
00079 return clock() * 1000 / CLOCKS_PER_SEC;
00080 }
00081
00082
00083
00084
00085
00086
00087 qboolean ValidClientNumber(int num, char *str)
00088 {
00089 if (num < 0 || num > botlibglobals.maxclients)
00090 {
00091
00092 botimport.Print(PRT_ERROR, "%s: invalid client number %d, [0, %d]\n",
00093 str, num, botlibglobals.maxclients);
00094 return qfalse;
00095 }
00096 return qtrue;
00097 }
00098
00099
00100
00101
00102
00103
00104 qboolean ValidEntityNumber(int num, char *str)
00105 {
00106 if (num < 0 || num > botlibglobals.maxentities)
00107 {
00108 botimport.Print(PRT_ERROR, "%s: invalid entity number %d, [0, %d]\n",
00109 str, num, botlibglobals.maxentities);
00110 return qfalse;
00111 }
00112 return qtrue;
00113 }
00114
00115
00116
00117
00118
00119
00120 qboolean BotLibSetup(char *str)
00121 {
00122 if (!botlibglobals.botlibsetup)
00123 {
00124 botimport.Print(PRT_ERROR, "%s: bot library used before being setup\n", str);
00125 return qfalse;
00126 }
00127 return qtrue;
00128 }
00129
00130
00131
00132
00133
00134
00135
00136 int Export_BotLibSetup(void)
00137 {
00138 int errnum;
00139
00140 bot_developer = LibVarGetValue("bot_developer");
00141 memset( &botlibglobals, 0, sizeof(botlibglobals) );
00142
00143
00144 Log_Open("botlib.log");
00145
00146 botimport.Print(PRT_MESSAGE, "------- BotLib Initialization -------\n");
00147
00148 botlibglobals.maxclients = (int) LibVarValue("maxclients", "128");
00149 botlibglobals.maxentities = (int) LibVarValue("maxentities", "1024");
00150
00151 errnum = AAS_Setup();
00152 if (errnum != BLERR_NOERROR) return errnum;
00153 errnum = EA_Setup();
00154 if (errnum != BLERR_NOERROR) return errnum;
00155 errnum = BotSetupWeaponAI();
00156 if (errnum != BLERR_NOERROR)return errnum;
00157 errnum = BotSetupGoalAI();
00158 if (errnum != BLERR_NOERROR) return errnum;
00159 errnum = BotSetupChatAI();
00160 if (errnum != BLERR_NOERROR) return errnum;
00161 errnum = BotSetupMoveAI();
00162 if (errnum != BLERR_NOERROR) return errnum;
00163
00164 botlibsetup = qtrue;
00165 botlibglobals.botlibsetup = qtrue;
00166
00167 return BLERR_NOERROR;
00168 }
00169
00170
00171
00172
00173
00174
00175 int Export_BotLibShutdown(void)
00176 {
00177 if (!BotLibSetup("BotLibShutdown")) return BLERR_LIBRARYNOTSETUP;
00178 #ifndef DEMO
00179
00180 #endif //DEMO
00181
00182 BotShutdownChatAI();
00183 BotShutdownMoveAI();
00184 BotShutdownGoalAI();
00185 BotShutdownWeaponAI();
00186 BotShutdownWeights();
00187 BotShutdownCharacters();
00188
00189 AAS_Shutdown();
00190
00191 EA_Shutdown();
00192
00193 LibVarDeAllocAll();
00194
00195 PC_RemoveAllGlobalDefines();
00196
00197
00198
00199 #ifdef DEBUG
00200 PrintMemoryLabels();
00201 #endif
00202
00203 Log_Shutdown();
00204
00205 botlibsetup = qfalse;
00206 botlibglobals.botlibsetup = qfalse;
00207
00208 PC_CheckOpenSourceHandles();
00209
00210 return BLERR_NOERROR;
00211 }
00212
00213
00214
00215
00216
00217
00218 int Export_BotLibVarSet(char *var_name, char *value)
00219 {
00220 LibVarSet(var_name, value);
00221 return BLERR_NOERROR;
00222 }
00223
00224
00225
00226
00227
00228
00229 int Export_BotLibVarGet(char *var_name, char *value, int size)
00230 {
00231 char *varvalue;
00232
00233 varvalue = LibVarGetString(var_name);
00234 strncpy(value, varvalue, size-1);
00235 value[size-1] = '\0';
00236 return BLERR_NOERROR;
00237 }
00238
00239
00240
00241
00242
00243
00244 int Export_BotLibStartFrame(float time)
00245 {
00246 if (!BotLibSetup("BotStartFrame")) return BLERR_LIBRARYNOTSETUP;
00247 return AAS_StartFrame(time);
00248 }
00249
00250
00251
00252
00253
00254
00255 int Export_BotLibLoadMap(const char *mapname)
00256 {
00257 #ifdef DEBUG
00258 int starttime = Sys_MilliSeconds();
00259 #endif
00260 int errnum;
00261
00262 if (!BotLibSetup("BotLoadMap")) return BLERR_LIBRARYNOTSETUP;
00263
00264 botimport.Print(PRT_MESSAGE, "------------ Map Loading ------------\n");
00265
00266 errnum = AAS_LoadMap(mapname);
00267 if (errnum != BLERR_NOERROR) return errnum;
00268
00269 BotInitLevelItems();
00270 BotSetBrushModelTypes();
00271
00272 botimport.Print(PRT_MESSAGE, "-------------------------------------\n");
00273 #ifdef DEBUG
00274 botimport.Print(PRT_MESSAGE, "map loaded in %d msec\n", Sys_MilliSeconds() - starttime);
00275 #endif
00276
00277 return BLERR_NOERROR;
00278 }
00279
00280
00281
00282
00283
00284
00285 int Export_BotLibUpdateEntity(int ent, bot_entitystate_t *state)
00286 {
00287 if (!BotLibSetup("BotUpdateEntity")) return BLERR_LIBRARYNOTSETUP;
00288 if (!ValidEntityNumber(ent, "BotUpdateEntity")) return BLERR_INVALIDENTITYNUMBER;
00289
00290 return AAS_UpdateEntity(ent, state);
00291 }
00292
00293
00294
00295
00296
00297
00298 void AAS_TestMovementPrediction(int entnum, vec3_t origin, vec3_t dir);
00299 void ElevatorBottomCenter(aas_reachability_t *reach, vec3_t bottomcenter);
00300 int BotGetReachabilityToGoal(vec3_t origin, int areanum,
00301 int lastgoalareanum, int lastareanum,
00302 int *avoidreach, float *avoidreachtimes, int *avoidreachtries,
00303 bot_goal_t *goal, int travelflags, int movetravelflags,
00304 struct bot_avoidspot_s *avoidspots, int numavoidspots, int *flags);
00305
00306 int AAS_PointLight(vec3_t origin, int *red, int *green, int *blue);
00307
00308 int AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas);
00309
00310 int AAS_Reachability_WeaponJump(int area1num, int area2num);
00311
00312 int BotFuzzyPointReachabilityArea(vec3_t origin);
00313
00314 float BotGapDistance(vec3_t origin, vec3_t hordir, int entnum);
00315
00316 void AAS_FloodAreas(vec3_t origin);
00317
00318 int BotExportTest(int parm0, char *parm1, vec3_t parm2, vec3_t parm3)
00319 {
00320
00321
00322
00323 #ifdef DEBUG
00324 static int area = -1;
00325 static int line[2];
00326 int newarea, i, highlightarea, flood;
00327
00328 vec3_t eye, forward, right, end, origin;
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338 vec3_t mins = {-16, -16, -24};
00339 vec3_t maxs = {16, 16, 32};
00340
00341
00342
00343
00344
00345
00346 if (!aasworld.loaded) return 0;
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356 for (i = 0; i < 2; i++) if (!line[i]) line[i] = botimport.DebugLineCreate();
00357
00358
00359
00360
00361
00362
00363
00364 highlightarea = LibVarGetValue("bot_highlightarea");
00365 if (highlightarea > 0)
00366 {
00367 newarea = highlightarea;
00368 }
00369 else
00370 {
00371 VectorCopy(parm2, origin);
00372 origin[2] += 0.5;
00373
00374 newarea = BotFuzzyPointReachabilityArea(origin);
00375 }
00376
00377 botimport.Print(PRT_MESSAGE, "\rtravel time to goal (%d) = %d ", botlibglobals.goalareanum,
00378 AAS_AreaTravelTimeToGoalArea(newarea, origin, botlibglobals.goalareanum, TFL_DEFAULT));
00379
00380 if (newarea != area)
00381 {
00382 botimport.Print(PRT_MESSAGE, "origin = %f, %f, %f\n", origin[0], origin[1], origin[2]);
00383 area = newarea;
00384 botimport.Print(PRT_MESSAGE, "new area %d, cluster %d, presence type %d\n",
00385 area, AAS_AreaCluster(area), AAS_PointPresenceType(origin));
00386 botimport.Print(PRT_MESSAGE, "area contents: ");
00387 if (aasworld.areasettings[area].contents & AREACONTENTS_WATER)
00388 {
00389 botimport.Print(PRT_MESSAGE, "water &");
00390 }
00391 if (aasworld.areasettings[area].contents & AREACONTENTS_LAVA)
00392 {
00393 botimport.Print(PRT_MESSAGE, "lava &");
00394 }
00395 if (aasworld.areasettings[area].contents & AREACONTENTS_SLIME)
00396 {
00397 botimport.Print(PRT_MESSAGE, "slime &");
00398 }
00399 if (aasworld.areasettings[area].contents & AREACONTENTS_JUMPPAD)
00400 {
00401 botimport.Print(PRT_MESSAGE, "jump pad &");
00402 }
00403 if (aasworld.areasettings[area].contents & AREACONTENTS_CLUSTERPORTAL)
00404 {
00405 botimport.Print(PRT_MESSAGE, "cluster portal &");
00406 }
00407 if (aasworld.areasettings[area].contents & AREACONTENTS_VIEWPORTAL)
00408 {
00409 botimport.Print(PRT_MESSAGE, "view portal &");
00410 }
00411 if (aasworld.areasettings[area].contents & AREACONTENTS_DONOTENTER)
00412 {
00413 botimport.Print(PRT_MESSAGE, "do not enter &");
00414 }
00415 if (aasworld.areasettings[area].contents & AREACONTENTS_MOVER)
00416 {
00417 botimport.Print(PRT_MESSAGE, "mover &");
00418 }
00419 if (!aasworld.areasettings[area].contents)
00420 {
00421 botimport.Print(PRT_MESSAGE, "empty");
00422 }
00423 botimport.Print(PRT_MESSAGE, "\n");
00424 botimport.Print(PRT_MESSAGE, "travel time to goal (%d) = %d\n", botlibglobals.goalareanum,
00425 AAS_AreaTravelTimeToGoalArea(newarea, origin, botlibglobals.goalareanum, TFL_DEFAULT|TFL_ROCKETJUMP));
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439 }
00440
00441 flood = LibVarGetValue("bot_flood");
00442 if (parm0 & 1)
00443 {
00444 if (flood)
00445 {
00446 AAS_ClearShownPolygons();
00447 AAS_ClearShownDebugLines();
00448 AAS_FloodAreas(parm2);
00449 }
00450 else
00451 {
00452 botlibglobals.goalareanum = newarea;
00453 VectorCopy(parm2, botlibglobals.goalorigin);
00454 botimport.Print(PRT_MESSAGE, "new goal %2.1f %2.1f %2.1f area %d\n",
00455 origin[0], origin[1], origin[2], newarea);
00456 }
00457 }
00458 if (flood)
00459 return 0;
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506 AAS_ClearShownPolygons();
00507 AAS_ClearShownDebugLines();
00508 AAS_ShowAreaPolygons(newarea, 1, parm0 & 4);
00509 if (parm0 & 2) AAS_ShowReachableAreas(area);
00510 else
00511 {
00512 static int lastgoalareanum, lastareanum;
00513 static int avoidreach[MAX_AVOIDREACH];
00514 static float avoidreachtimes[MAX_AVOIDREACH];
00515 static int avoidreachtries[MAX_AVOIDREACH];
00516 int reachnum, resultFlags;
00517 bot_goal_t goal;
00518 aas_reachability_t reach;
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531 int curarea;
00532 vec3_t curorigin;
00533
00534 goal.areanum = botlibglobals.goalareanum;
00535 VectorCopy(botlibglobals.goalorigin, goal.origin);
00536 VectorCopy(origin, curorigin);
00537 curarea = newarea;
00538 for ( i = 0; i < 100; i++ ) {
00539 if ( curarea == goal.areanum ) {
00540 break;
00541 }
00542 reachnum = BotGetReachabilityToGoal(curorigin, curarea,
00543 lastgoalareanum, lastareanum,
00544 avoidreach, avoidreachtimes, avoidreachtries,
00545 &goal, TFL_DEFAULT|TFL_FUNCBOB|TFL_ROCKETJUMP, TFL_DEFAULT|TFL_FUNCBOB|TFL_ROCKETJUMP,
00546 NULL, 0, &resultFlags);
00547 AAS_ReachabilityFromNum(reachnum, &reach);
00548 AAS_ShowReachability(&reach);
00549 VectorCopy(reach.end, origin);
00550 lastareanum = curarea;
00551 curarea = reach.areanum;
00552 }
00553 }
00554 VectorClear(forward);
00555
00556
00557
00558
00559
00560
00561
00562
00563 AngleVectors(parm3, forward, right, NULL);
00564
00565 VectorMA(parm2, 8, right, eye);
00566
00567 eye[2] += 24;
00568
00569 VectorMA(eye, 800, forward, end);
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605 #if 0
00606 AAS_ClearShownDebugLines();
00607
00608 bsptrace = AAS_Trace(eye, mins, maxs, end, 1, MASK_PLAYERSOLID);
00609 if (!line[0]) line[0] = botimport.DebugLineCreate();
00610 botimport.DebugLineShow(line[0], eye, bsptrace.endpos, LINECOLOR_YELLOW);
00611 if (bsptrace.fraction < 1.0)
00612 {
00613 face = AAS_TraceEndFace(&trace);
00614 if (face)
00615 {
00616 AAS_ShowFace(face - aasworld.faces);
00617 }
00618
00619 AAS_DrawPlaneCross(bsptrace.endpos,
00620 bsptrace.plane.normal,
00621 bsptrace.plane.dist + bsptrace.exp_dist,
00622 bsptrace.plane.type, LINECOLOR_GREEN);
00623 if (trace.ent)
00624 {
00625 ent = &aasworld.entities[trace.ent];
00626 AAS_ShowBoundingBox(ent->origin, ent->mins, ent->maxs);
00627 }
00628 }
00629
00630 bsptrace = AAS_Trace2(eye, mins, maxs, end, 1, MASK_PLAYERSOLID);
00631 botimport.DebugLineShow(line[1], eye, bsptrace.endpos, LINECOLOR_BLUE);
00632 if (bsptrace.fraction < 1.0)
00633 {
00634 AAS_DrawPlaneCross(bsptrace.endpos,
00635 bsptrace.plane.normal,
00636 bsptrace.plane.dist,
00637 bsptrace.plane.type, LINECOLOR_RED);
00638 if (bsptrace.ent)
00639 {
00640 ent = &aasworld.entities[bsptrace.ent];
00641 AAS_ShowBoundingBox(ent->origin, ent->mins, ent->maxs);
00642 }
00643 }
00644 #endif
00645 #endif
00646 return 0;
00647 }
00648
00649
00650
00651
00652
00653
00654
00655 static void Init_AAS_Export( aas_export_t *aas ) {
00656
00657
00658
00659 aas->AAS_EntityInfo = AAS_EntityInfo;
00660
00661
00662
00663 aas->AAS_Initialized = AAS_Initialized;
00664 aas->AAS_PresenceTypeBoundingBox = AAS_PresenceTypeBoundingBox;
00665 aas->AAS_Time = AAS_Time;
00666
00667
00668
00669 aas->AAS_PointAreaNum = AAS_PointAreaNum;
00670 aas->AAS_PointReachabilityAreaIndex = AAS_PointReachabilityAreaIndex;
00671 aas->AAS_TraceAreas = AAS_TraceAreas;
00672 aas->AAS_BBoxAreas = AAS_BBoxAreas;
00673 aas->AAS_AreaInfo = AAS_AreaInfo;
00674
00675
00676
00677 aas->AAS_PointContents = AAS_PointContents;
00678 aas->AAS_NextBSPEntity = AAS_NextBSPEntity;
00679 aas->AAS_ValueForBSPEpairKey = AAS_ValueForBSPEpairKey;
00680 aas->AAS_VectorForBSPEpairKey = AAS_VectorForBSPEpairKey;
00681 aas->AAS_FloatForBSPEpairKey = AAS_FloatForBSPEpairKey;
00682 aas->AAS_IntForBSPEpairKey = AAS_IntForBSPEpairKey;
00683
00684
00685
00686 aas->AAS_AreaReachability = AAS_AreaReachability;
00687
00688
00689
00690 aas->AAS_AreaTravelTimeToGoalArea = AAS_AreaTravelTimeToGoalArea;
00691 aas->AAS_EnableRoutingArea = AAS_EnableRoutingArea;
00692 aas->AAS_PredictRoute = AAS_PredictRoute;
00693
00694
00695
00696 aas->AAS_AlternativeRouteGoals = AAS_AlternativeRouteGoals;
00697
00698
00699
00700 aas->AAS_Swimming = AAS_Swimming;
00701 aas->AAS_PredictClientMovement = AAS_PredictClientMovement;
00702 }
00703
00704
00705
00706
00707
00708
00709
00710 static void Init_EA_Export( ea_export_t *ea ) {
00711
00712 ea->EA_Command = EA_Command;
00713 ea->EA_Say = EA_Say;
00714 ea->EA_SayTeam = EA_SayTeam;
00715
00716 ea->EA_Action = EA_Action;
00717 ea->EA_Gesture = EA_Gesture;
00718 ea->EA_Talk = EA_Talk;
00719 ea->EA_Attack = EA_Attack;
00720 ea->EA_Use = EA_Use;
00721 ea->EA_Respawn = EA_Respawn;
00722 ea->EA_Crouch = EA_Crouch;
00723 ea->EA_MoveUp = EA_MoveUp;
00724 ea->EA_MoveDown = EA_MoveDown;
00725 ea->EA_MoveForward = EA_MoveForward;
00726 ea->EA_MoveBack = EA_MoveBack;
00727 ea->EA_MoveLeft = EA_MoveLeft;
00728 ea->EA_MoveRight = EA_MoveRight;
00729
00730 ea->EA_SelectWeapon = EA_SelectWeapon;
00731 ea->EA_Jump = EA_Jump;
00732 ea->EA_DelayedJump = EA_DelayedJump;
00733 ea->EA_Move = EA_Move;
00734 ea->EA_View = EA_View;
00735 ea->EA_GetInput = EA_GetInput;
00736 ea->EA_EndRegular = EA_EndRegular;
00737 ea->EA_ResetInput = EA_ResetInput;
00738 }
00739
00740
00741
00742
00743
00744
00745
00746 static void Init_AI_Export( ai_export_t *ai ) {
00747
00748
00749
00750 ai->BotLoadCharacter = BotLoadCharacter;
00751 ai->BotFreeCharacter = BotFreeCharacter;
00752 ai->Characteristic_Float = Characteristic_Float;
00753 ai->Characteristic_BFloat = Characteristic_BFloat;
00754 ai->Characteristic_Integer = Characteristic_Integer;
00755 ai->Characteristic_BInteger = Characteristic_BInteger;
00756 ai->Characteristic_String = Characteristic_String;
00757
00758
00759
00760 ai->BotAllocChatState = BotAllocChatState;
00761 ai->BotFreeChatState = BotFreeChatState;
00762 ai->BotQueueConsoleMessage = BotQueueConsoleMessage;
00763 ai->BotRemoveConsoleMessage = BotRemoveConsoleMessage;
00764 ai->BotNextConsoleMessage = BotNextConsoleMessage;
00765 ai->BotNumConsoleMessages = BotNumConsoleMessages;
00766 ai->BotInitialChat = BotInitialChat;
00767 ai->BotNumInitialChats = BotNumInitialChats;
00768 ai->BotReplyChat = BotReplyChat;
00769 ai->BotChatLength = BotChatLength;
00770 ai->BotEnterChat = BotEnterChat;
00771 ai->BotGetChatMessage = BotGetChatMessage;
00772 ai->StringContains = StringContains;
00773 ai->BotFindMatch = BotFindMatch;
00774 ai->BotMatchVariable = BotMatchVariable;
00775 ai->UnifyWhiteSpaces = UnifyWhiteSpaces;
00776 ai->BotReplaceSynonyms = BotReplaceSynonyms;
00777 ai->BotLoadChatFile = BotLoadChatFile;
00778 ai->BotSetChatGender = BotSetChatGender;
00779 ai->BotSetChatName = BotSetChatName;
00780
00781
00782
00783 ai->BotResetGoalState = BotResetGoalState;
00784 ai->BotResetAvoidGoals = BotResetAvoidGoals;
00785 ai->BotRemoveFromAvoidGoals = BotRemoveFromAvoidGoals;
00786 ai->BotPushGoal = BotPushGoal;
00787 ai->BotPopGoal = BotPopGoal;
00788 ai->BotEmptyGoalStack = BotEmptyGoalStack;
00789 ai->BotDumpAvoidGoals = BotDumpAvoidGoals;
00790 ai->BotDumpGoalStack = BotDumpGoalStack;
00791 ai->BotGoalName = BotGoalName;
00792 ai->BotGetTopGoal = BotGetTopGoal;
00793 ai->BotGetSecondGoal = BotGetSecondGoal;
00794 ai->BotChooseLTGItem = BotChooseLTGItem;
00795 ai->BotChooseNBGItem = BotChooseNBGItem;
00796 ai->BotTouchingGoal = BotTouchingGoal;
00797 ai->BotItemGoalInVisButNotVisible = BotItemGoalInVisButNotVisible;
00798 ai->BotGetLevelItemGoal = BotGetLevelItemGoal;
00799 ai->BotGetNextCampSpotGoal = BotGetNextCampSpotGoal;
00800 ai->BotGetMapLocationGoal = BotGetMapLocationGoal;
00801 ai->BotAvoidGoalTime = BotAvoidGoalTime;
00802 ai->BotSetAvoidGoalTime = BotSetAvoidGoalTime;
00803 ai->BotInitLevelItems = BotInitLevelItems;
00804 ai->BotUpdateEntityItems = BotUpdateEntityItems;
00805 ai->BotLoadItemWeights = BotLoadItemWeights;
00806 ai->BotFreeItemWeights = BotFreeItemWeights;
00807 ai->BotInterbreedGoalFuzzyLogic = BotInterbreedGoalFuzzyLogic;
00808 ai->BotSaveGoalFuzzyLogic = BotSaveGoalFuzzyLogic;
00809 ai->BotMutateGoalFuzzyLogic = BotMutateGoalFuzzyLogic;
00810 ai->BotAllocGoalState = BotAllocGoalState;
00811 ai->BotFreeGoalState = BotFreeGoalState;
00812
00813
00814
00815 ai->BotResetMoveState = BotResetMoveState;
00816 ai->BotMoveToGoal = BotMoveToGoal;
00817 ai->BotMoveInDirection = BotMoveInDirection;
00818 ai->BotResetAvoidReach = BotResetAvoidReach;
00819 ai->BotResetLastAvoidReach = BotResetLastAvoidReach;
00820 ai->BotReachabilityArea = BotReachabilityArea;
00821 ai->BotMovementViewTarget = BotMovementViewTarget;
00822 ai->BotPredictVisiblePosition = BotPredictVisiblePosition;
00823 ai->BotAllocMoveState = BotAllocMoveState;
00824 ai->BotFreeMoveState = BotFreeMoveState;
00825 ai->BotInitMoveState = BotInitMoveState;
00826 ai->BotAddAvoidSpot = BotAddAvoidSpot;
00827
00828
00829
00830 ai->BotChooseBestFightWeapon = BotChooseBestFightWeapon;
00831 ai->BotGetWeaponInfo = BotGetWeaponInfo;
00832 ai->BotLoadWeaponWeights = BotLoadWeaponWeights;
00833 ai->BotAllocWeaponState = BotAllocWeaponState;
00834 ai->BotFreeWeaponState = BotFreeWeaponState;
00835 ai->BotResetWeaponState = BotResetWeaponState;
00836
00837
00838
00839 ai->GeneticParentsAndChildSelection = GeneticParentsAndChildSelection;
00840 }
00841
00842
00843
00844
00845
00846
00847
00848 botlib_export_t *GetBotLibAPI(int apiVersion, botlib_import_t *import) {
00849 assert(import);
00850 botimport = *import;
00851 assert(botimport.Print);
00852
00853 Com_Memset( &be_botlib_export, 0, sizeof( be_botlib_export ) );
00854
00855 if ( apiVersion != BOTLIB_API_VERSION ) {
00856 botimport.Print( PRT_ERROR, "Mismatched BOTLIB_API_VERSION: expected %i, got %i\n", BOTLIB_API_VERSION, apiVersion );
00857 return NULL;
00858 }
00859
00860 Init_AAS_Export(&be_botlib_export.aas);
00861 Init_EA_Export(&be_botlib_export.ea);
00862 Init_AI_Export(&be_botlib_export.ai);
00863
00864 be_botlib_export.BotLibSetup = Export_BotLibSetup;
00865 be_botlib_export.BotLibShutdown = Export_BotLibShutdown;
00866 be_botlib_export.BotLibVarSet = Export_BotLibVarSet;
00867 be_botlib_export.BotLibVarGet = Export_BotLibVarGet;
00868
00869 be_botlib_export.PC_AddGlobalDefine = PC_AddGlobalDefine;
00870 be_botlib_export.PC_LoadSourceHandle = PC_LoadSourceHandle;
00871 be_botlib_export.PC_FreeSourceHandle = PC_FreeSourceHandle;
00872 be_botlib_export.PC_ReadTokenHandle = PC_ReadTokenHandle;
00873 be_botlib_export.PC_SourceFileAndLine = PC_SourceFileAndLine;
00874
00875 be_botlib_export.BotLibStartFrame = Export_BotLibStartFrame;
00876 be_botlib_export.BotLibLoadMap = Export_BotLibLoadMap;
00877 be_botlib_export.BotLibUpdateEntity = Export_BotLibUpdateEntity;
00878 be_botlib_export.Test = BotExportTest;
00879
00880 return &be_botlib_export;
00881 }