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

Function CreateRoomObjects

Descent3/room.cpp:1186–1219  ·  view source on GitHub ↗

Create objects for the external rooms

Source from the content-addressed store, hash-verified

1184
1185// Create objects for the external rooms
1186void 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
1222int FindFirstUsedRoom() {

Callers 3

OnIdleMethod · 0.85
DeleteGroupFunction · 0.85
LoadLevelFunction · 0.85

Calls 6

ObjDeleteFunction · 0.85
GetTerrainRoomFromPosFunction · 0.85
ObjCreateFunction · 0.85
BigObjAddFunction · 0.85
ObjSetAABBFunction · 0.85

Tested by

no test coverage detected