MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AIPathAllocPath

Function AIPathAllocPath

Descent3/aipath.cpp:1013–1168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1011}
1012
1013bool AIPathAllocPath(object *obj, ai_frame *ai_info, void *goal_ptr, int *start_room, vector *start_pos, int *end_room,
1014 vector *end_pos, float rad, int flags, int handle, int ignore_obj) {
1015 bool status;
1016 bool f_path_exists = true;
1017
1018 ai_path_info *aip = &ai_info->path;
1019
1020#ifdef _DEBUG
1021 if (AI_debug_robot_do && OBJNUM(obj) == AI_debug_robot_index) {
1022 mprintf(0, "AI Note: In free path\n");
1023 }
1024#endif
1025 AIPathFreePath(aip);
1026
1027 // if(ai_info->awareness <= AWARE_NONE && !(ai_info->flags & AIF_PERSISTANT)) // chrishack -- scalar max_nodes in
1028 // path by awareness return false;
1029
1030 aip->goal_index = (goal *)goal_ptr - ai_info->goals;
1031 aip->goal_uid = ((goal *)goal_ptr)->goal_uid;
1032
1033 status = AIPathAddDPath(aip, handle);
1034
1035 if (status) {
1036 int slot = aip->path_id[0];
1037 int cur_node = 0;
1038
1039 // Account for closed doors
1040 if (BOA_GetNextRoom(*start_room, *end_room) != BOA_NO_PATH) {
1041 bool f_make_alt = false;
1042 bool f_bline_ok = false;
1043 int last_room;
1044 fvi_query fq;
1045 fvi_info hit_info;
1046
1047 fq.p0 = start_pos;
1048 fq.startroom = *start_room;
1049 fq.p1 = end_pos;
1050 fq.rad = obj->size - .1f;
1051 if (fq.rad <= 0.0f)
1052 fq.rad = .1f;
1053 fq.thisobjnum = OBJNUM(obj);
1054 fq.ignore_obj_list = NULL;
1055 fq.flags = FQ_CHECK_OBJS | FQ_NO_RELINK | FQ_IGNORE_WEAPONS | FQ_IGNORE_POWERUPS;
1056
1057 int fate = fvi_FindIntersection(&fq, &hit_info);
1058
1059 if (fate == HIT_NONE ||
1060 ((fate == HIT_OBJECT || fate == HIT_SPHERE_2_POLY_OBJECT) && hit_info.hit_object[0] == ignore_obj)) {
1061 f_make_alt = false;
1062 f_bline_ok = true;
1063 } else if (BOA_Array[BOA_INDEX(*start_room)][BOA_INDEX(*end_room)] & BOAF_TOO_SMALL_FOR_ROBOT) {
1064 f_make_alt = true;
1065 } else if (BOA_HasPossibleBlockage(*start_room, *end_room)) {
1066 int next_room = BOA_INDEX(*start_room);
1067
1068 ASSERT(next_room >= 0 && next_room <= Highest_room_index + 8);
1069
1070 do {

Callers 5

AIFindRandomRoomFunction · 0.85
MakeTestPathFunction · 0.85
GoalDoFrameFunction · 0.85
GoalPathCompleteFunction · 0.85
GoalAddGoalFunction · 0.85

Calls 14

AIPathFreePathFunction · 0.85
AIPathAddDPathFunction · 0.85
BOA_GetNextRoomFunction · 0.85
fvi_FindIntersectionFunction · 0.85
BOA_HasPossibleBlockageFunction · 0.85
BOA_LockedDoorFunction · 0.85
AIFindAltPathFunction · 0.85
TERRAIN_REGIONFunction · 0.85
AIGenerateAltBNodePathFunction · 0.85
AIGenerateAltBOAPathFunction · 0.85
AIGenerateBNodePathFunction · 0.85

Tested by

no test coverage detected