MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / LoadStaticRoomData

Function LoadStaticRoomData

TombEngine/Specific/level.cpp:939–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937}
938
939void LoadStaticRoomData()
940{
941 constexpr auto SECTOR_AABB_CENTER_OFFSET = Vector3(BLOCK(0.5f), 0.0f, BLOCK(0.5f));
942 constexpr auto SECTOR_AABB_EXTENTS_BASE = Vector3(BLOCK(0.5f), 0.0f, BLOCK(0.5f));
943
944 int roomCount = ReadCount();
945 TENLog("Room count: " + std::to_string(roomCount), LogLevel::Info);
946
947 g_Level.Rooms.reserve(roomCount);
948 for (int i = 0; i < roomCount; i++)
949 {
950 auto& room = g_Level.Rooms.emplace_back();
951
952 room.Position.x = ReadInt32();
953 room.Position.y = 0;
954 room.Position.z = ReadInt32();
955 room.BottomHeight = ReadInt32();
956 room.TopHeight = ReadInt32();
957
958 int vertexCount = ReadCount(CUBE(1024));
959
960 room.positions.reserve(vertexCount);
961 for (int j = 0; j < vertexCount; j++)
962 room.positions.push_back(ReadVector3());
963
964 room.colors.reserve(vertexCount);
965 for (int j = 0; j < vertexCount; j++)
966 room.colors.push_back(ReadVector3());
967
968 room.effects.reserve(vertexCount);
969 for (int j = 0; j < vertexCount; j++)
970 room.effects.push_back(ReadVector3());
971
972 int bucketCount = ReadCount();
973 room.buckets.reserve(bucketCount);
974 for (int j = 0; j < bucketCount; j++)
975 {
976 auto bucket = BUCKET{};
977
978 bucket.texture = ReadInt32();
979 bucket.blendMode = (BlendMode)ReadUInt8();
980 bucket.materialIndex = ReadInt32();
981 bucket.animated = ReadBool();
982
983 bucket.numQuads = 0;
984 bucket.numTriangles = 0;
985
986 int polyCount = ReadCount(CUBE(1024));
987 bucket.polygons.reserve(polyCount);
988 for (int k = 0; k < polyCount; k++)
989 {
990 auto poly = POLYGON{};
991
992 poly.shape = ReadInt32();
993 poly.animatedSequence = ReadInt32();
994 poly.animatedFrame = ReadInt32();
995 poly.normal = ReadVector3();
996

Callers 1

LoadRoomsFunction · 0.85

Calls 15

ReadCountFunction · 0.85
TENLogFunction · 0.85
to_stringFunction · 0.85
ReadInt32Function · 0.85
ReadVector3Function · 0.85
ReadUInt8Function · 0.85
ReadBoolFunction · 0.85
ReadVector2Function · 0.85
ReadInt16Function · 0.85
FROM_RADFunction · 0.85
ReadFloatFunction · 0.85
ConvertFakePlaneToPlaneFunction · 0.85

Tested by

no test coverage detected