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

Function CreateDefaultRoom

editor/HFile.cpp:405–443  ·  view source on GitHub ↗

Create a default room for a new mine

Source from the content-addressed store, hash-verified

403
404// Create a default room for a new mine
405room *CreateDefaultRoom() {
406 room *rp;
407 int i;
408
409 // Get a pointer to our room
410 rp = CreateNewRoom(16, 10, 0); // 16 verts, 10 faces, normal room
411 ASSERT(rp != NULL);
412
413 // Set the vertices for the room
414 for (i = 0; i < 16; i++)
415 rp->verts[i] = default_room_verts[i] + Mine_origin;
416
417 // Set the faces for the room
418 InitRoomFace(&rp->faces[0], 8);
419 for (i = 0; i < 8; i++)
420 rp->faces[0].face_verts[i] = i;
421
422 InitRoomFace(&rp->faces[1], 8);
423 for (i = 0; i < 8; i++)
424 rp->faces[1].face_verts[i] = 15 - i;
425
426 for (i = 0; i < 8; i++) {
427 InitRoomFace(&rp->faces[i + 2], 4);
428 rp->faces[i + 2].face_verts[0] = i;
429 rp->faces[i + 2].face_verts[1] = i + 8;
430 rp->faces[i + 2].face_verts[2] = ((i + 1) % 8) + 8;
431 rp->faces[i + 2].face_verts[3] = (i + 1) % 8;
432 }
433
434 // Set normals, textures and UVLs for face
435 for (i = 0; i < 10; i++) {
436 if (!ComputeFaceNormal(rp, i))
437 Int3(); // this is odd. Get Matt!
438 rp->faces[i].tmap = i + 1;
439 AssignDefaultUVsToRoomFace(rp, i);
440 }
441
442 return rp;
443}
444
445#define DEFAULT_SCRIPT "//Empty script\xd\xa"
446

Callers 1

CreateNewMineFunction · 0.85

Calls 4

CreateNewRoomFunction · 0.85
InitRoomFaceFunction · 0.85
ComputeFaceNormalFunction · 0.85

Tested by

no test coverage detected