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

Function LoadDynamicRoomData

TombEngine/Specific/level.cpp:851–937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

849}
850
851void LoadDynamicRoomData()
852{
853 int roomCount = ReadCount();
854
855 if (g_Level.Rooms.size() != roomCount)
856 throw std::exception("Dynamic room data count is inconsistent with room count.");
857
858 for (int i = 0; i < roomCount; i++)
859 {
860 auto& room = g_Level.Rooms[i];
861
862 room.Name = ReadString();
863
864 int tagCount = ReadCount();
865 room.Tags.resize(0);
866 room.Tags.reserve(tagCount);
867
868 for (int j = 0; j < tagCount; j++)
869 room.Tags.push_back(ReadString());
870
871 room.ambient = ReadVector3();
872
873 room.flippedRoom = ReadInt32();
874 room.flags = ReadInt32();
875 room.meshEffect = ReadInt32();
876 room.reverbType = (ReverbType)ReadInt32();
877 room.flipNumber = ReadInt32();
878
879 int staticCount = ReadCount();
880 room.mesh.resize(0);
881 room.mesh.reserve(staticCount);
882
883 for (int j = 0; j < staticCount; j++)
884 {
885 auto& mesh = room.mesh.emplace_back();
886
887 mesh.RoomNumber = i;
888 mesh.Pose.Position.x = ReadInt32();
889 mesh.Pose.Position.y = ReadInt32();
890 mesh.Pose.Position.z = ReadInt32();
891 mesh.Pose.Orientation.y = ReadUInt16();
892 mesh.Pose.Orientation.x = ReadUInt16();
893 mesh.Pose.Orientation.z = ReadUInt16();
894 mesh.Pose.Scale = Vector3(ReadFloat()); // TODO: Write Vector3 scale to level.
895 mesh.Flags = ReadUInt16();
896 mesh.Color = ReadVector4();
897 mesh.Slot = ReadUInt16();
898 mesh.HitPoints = ReadInt16();
899 mesh.Name = ReadString();
900
901 g_GameScriptEntities->AddName(mesh.Name, mesh);
902 }
903
904 int triggerVolumeCount = ReadCount();
905 room.TriggerVolumes.resize(0);
906 room.TriggerVolumes.reserve(triggerVolumeCount);
907
908 for (int j = 0; j < triggerVolumeCount; j++)

Callers 1

LoadLevelFunction · 0.85

Calls 15

ReadCountFunction · 0.85
ReadStringFunction · 0.85
ReadVector3Function · 0.85
ReadInt32Function · 0.85
ReadUInt16Function · 0.85
ReadFloatFunction · 0.85
ReadVector4Function · 0.85
ReadInt16Function · 0.85
ReadBoolFunction · 0.85
emplace_backMethod · 0.80
AddNameMethod · 0.80
Vector3Function · 0.50

Tested by

no test coverage detected