build a list of rooms to be rendered fills in Render_list & N_render_rooms
| 1079 | // build a list of rooms to be rendered |
| 1080 | // fills in Render_list & N_render_rooms |
| 1081 | void BuildRoomList(int start_room_num) { |
| 1082 | clip_wnd wnd; |
| 1083 | room *rp = &Rooms[start_room_num]; |
| 1084 | int i; |
| 1085 | // For now, render all connected rooms |
| 1086 | for (i = 0; i <= Highest_room_index; i++) { |
| 1087 | Rooms_visited[i] = 0; |
| 1088 | Room_depth_list[i] = 255; |
| 1089 | Rooms[i].wpb_index = -1; |
| 1090 | } |
| 1091 | #ifdef EDITOR |
| 1092 | Rooms_visited[start_room_num] = 0; // take care of rooms in the room palette |
| 1093 | Room_depth_list[start_room_num] = 0; |
| 1094 | #endif |
| 1095 | N_external_rooms = -1; |
| 1096 | N_render_rooms = 0; |
| 1097 | Global_buffer_index = 0; |
| 1098 | // Mark all the faces in our start room as renderable |
| 1099 | for (i = 0; i < rp->num_faces; i++) |
| 1100 | rp->faces[i].flags |= FF_VISIBLE; |
| 1101 | |
| 1102 | MarkFacingFaces(start_room_num, rp->verts); |
| 1103 | // Enable mirror if there is one |
| 1104 | if (rp->mirror_face != -1 && Detail_settings.Mirrored_surfaces && |
| 1105 | !(rp->faces[rp->mirror_face].flags & FF_NOT_FACING)) { |
| 1106 | rp->flags |= RF_MIRROR_VISIBLE; |
| 1107 | Mirror_rooms[Num_mirror_rooms++] = start_room_num; |
| 1108 | } |
| 1109 | |
| 1110 | // Get our points rotated, and update the global point list |
| 1111 | rp->wpb_index = Global_buffer_index; |
| 1112 | |
| 1113 | // Katmai enhanced rotate only in a release build, because not |
| 1114 | // everyone has the intel compiler! |
| 1115 | #if (defined(RELEASE) && defined(KATMAI)) |
| 1116 | if (Katmai) |
| 1117 | |
| 1118 | RotateRoomPoints(rp, rp->verts4); |
| 1119 | else |
| 1120 | #endif |
| 1121 | RotateRoomPoints(rp, rp->verts); |
| 1122 | |
| 1123 | Global_buffer_index += rp->num_verts; |
| 1124 | |
| 1125 | // Mark all objects in this room as visible |
| 1126 | for (int objnum = rp->objects; (objnum != -1); objnum = Objects[objnum].next) |
| 1127 | Objects[objnum].flags |= OF_SAFE_TO_RENDER; |
| 1128 | |
| 1129 | // Initial clip window is whole screen |
| 1130 | wnd.left = wnd.top = 0.0; |
| 1131 | wnd.right = Render_width; |
| 1132 | wnd.bot = Render_height; |
| 1133 | BuildRoomListSub(start_room_num, &wnd, 0); |
| 1134 | // mprintf(0,"N_render_rooms = %d ",N_render_rooms); |
| 1135 | #ifdef EDITOR |
| 1136 | // Add all external rooms to render list if that flag set |
| 1137 | if (Editor_view_mode == VM_MINE && In_editor_mode) { |
| 1138 | if (Render_all_external_rooms) { |
no test coverage detected