/ * BSPBuildTree: Return a BSP tree for the given room. The room is bounded * by the box (min_x, min_y) (max_x, max_y). */
| 1055 | * by the box (min_x, min_y) (max_x, max_y). |
| 1056 | */ |
| 1057 | BSPnode *BSPBuildTree(WallData *wall_list, int min_x, int min_y, int max_x, int max_y) |
| 1058 | { |
| 1059 | BSPnode *tree; |
| 1060 | Poly poly; |
| 1061 | |
| 1062 | dprintf("BSPBuildTree got box (%d %d)-(%d %d)\n", min_x, min_y, max_x, max_y); |
| 1063 | |
| 1064 | // Set up initial polygon as rectangle enclosing room |
| 1065 | poly.npts = 4; |
| 1066 | poly.p[0].x = min_x; |
| 1067 | poly.p[0].y = min_y; |
| 1068 | poly.p[1].x = max_x; |
| 1069 | poly.p[1].y = min_y; |
| 1070 | poly.p[2].x = max_x; |
| 1071 | poly.p[2].y = max_y; |
| 1072 | poly.p[3].x = min_x; |
| 1073 | poly.p[3].y = max_y; |
| 1074 | poly.p[4] = poly.p[0]; |
| 1075 | |
| 1076 | tree = BSPBuildNode(wall_list, &poly, -1); |
| 1077 | |
| 1078 | BSPFindBoundingBoxes(tree); |
| 1079 | |
| 1080 | // BSPDumpTree(tree, 0); |
| 1081 | return tree; |
| 1082 | } |
no test coverage detected