Prerotates all external room points and caches them
| 686 | } |
| 687 | // Prerotates all external room points and caches them |
| 688 | void RotateAllExternalRooms() { |
| 689 | // Build the external room list if needed |
| 690 | if (N_external_rooms == -1) { |
| 691 | // Set up our z wall |
| 692 | float zclip = (Detail_settings.Terrain_render_distance) * Matrix_scale.z; |
| 693 | g3_SetFarClipZ(zclip); |
| 694 | N_external_rooms = 0; |
| 695 | |
| 696 | int i; |
| 697 | for (i = 0; i <= Highest_room_index; i++) { |
| 698 | if ((Rooms[i].flags & RF_EXTERNAL) && Rooms[i].used) { |
| 699 | External_room_list[N_external_rooms++] = i; |
| 700 | } |
| 701 | } |
| 702 | ASSERT(N_external_rooms < MAX_EXTERNAL_ROOMS); // Get Jason if hit this |
| 703 | // Rotate all the points |
| 704 | vector corners[8]; |
| 705 | for (i = 0; i < N_external_rooms; i++) { |
| 706 | int roomnum = External_room_list[i]; |
| 707 | room *rp = &Rooms[roomnum]; |
| 708 | MakePointsFromMinMax(corners, &rp->min_xyz, &rp->max_xyz); |
| 709 | |
| 710 | uint8_t andbyte = 0xff; |
| 711 | g3Point pnt; |
| 712 | External_room_codes[i] = 0xff; |
| 713 | External_room_project_net[i] = 0; |
| 714 | bool behind = 0; |
| 715 | bool infront = 0; |
| 716 | for (int t = 0; t < 8; t++) { |
| 717 | g3_RotatePoint(&pnt, &corners[t]); |
| 718 | External_room_codes[i] &= pnt.p3_codes; |
| 719 | if (pnt.p3_codes & CC_BEHIND) |
| 720 | behind = true; |
| 721 | else |
| 722 | infront = true; |
| 723 | pnt.p3_codes &= ~CC_BEHIND; |
| 724 | g3_ProjectPoint(&pnt); |
| 725 | External_room_corners[i][t].x = pnt.p3_sx; |
| 726 | External_room_corners[i][t].y = pnt.p3_sy; |
| 727 | } |
| 728 | if (infront && behind) { |
| 729 | External_room_codes[i] = 0; |
| 730 | External_room_project_net[i] = 1; |
| 731 | } else { |
| 732 | if (behind) { |
| 733 | External_room_codes[i] = CC_BEHIND; |
| 734 | } |
| 735 | } |
| 736 | } |
| 737 | } |
| 738 | } |
| 739 | |
| 740 | void CheckFogPortalExtents(int roomnum, int portalnum) { |
| 741 | room *rp = &Rooms[roomnum]; |
no test coverage detected