Create objects for the external rooms
| 1184 | |
| 1185 | // Create objects for the external rooms |
| 1186 | void CreateRoomObjects() { |
| 1187 | int objnum, r; |
| 1188 | room *rp; |
| 1189 | |
| 1190 | // First delete any old room objects |
| 1191 | for (objnum = 0; objnum <= Highest_object_index; objnum++) |
| 1192 | if (Objects[objnum].type == OBJ_ROOM) |
| 1193 | ObjDelete(objnum); |
| 1194 | |
| 1195 | // Now go through all rooms & create objects for external ones |
| 1196 | for (r = 0, rp = Rooms; r <= Highest_room_index; r++, rp++) |
| 1197 | if (rp->used && (rp->flags & RF_EXTERNAL)) { |
| 1198 | vector pos; |
| 1199 | float rad; |
| 1200 | int roomnum, objnum; |
| 1201 | |
| 1202 | rad = ComputeRoomBoundingSphere(&pos, rp); |
| 1203 | roomnum = GetTerrainRoomFromPos(&pos); |
| 1204 | |
| 1205 | ASSERT(roomnum != -1); |
| 1206 | |
| 1207 | objnum = ObjCreate(OBJ_ROOM, r, roomnum, &pos, NULL); |
| 1208 | ASSERT(objnum != -1); // DAJ -1FIX moved up |
| 1209 | Objects[objnum].size = rad; |
| 1210 | Objects[objnum].wall_sphere_offset = Zero_vector; |
| 1211 | Objects[objnum].anim_sphere_offset = Zero_vector; |
| 1212 | |
| 1213 | if ((rad >= MIN_BIG_OBJ_RAD) && !(Objects[objnum].flags & OF_BIG_OBJECT)) { |
| 1214 | BigObjAdd(objnum); |
| 1215 | } |
| 1216 | // Type specific should have set up the size, so now we can compute the bounding box. |
| 1217 | ObjSetAABB(&Objects[objnum]); |
| 1218 | } |
| 1219 | } |
| 1220 | |
| 1221 | // returns the index of the first room that is being used. Returns -1 if there are none |
| 1222 | int FindFirstUsedRoom() { |
no test coverage detected