MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / LoadTrack

Method LoadTrack

src/Loaders/nfs3_loader.cpp:100–129  ·  view source on GitHub ↗

TRACK

Source from the content-addressed store, hash-verified

98
99// TRACK
100std::shared_ptr<TRACK> NFS3::LoadTrack(const std::string &track_base_path) {
101 LOG(INFO) << "Loading Track located at " << track_base_path;
102 auto track = make_shared<TRACK>(TRACK());
103
104 boost::filesystem::path p(track_base_path);
105 track->name = p.filename().string();
106 stringstream frd_path, col_path, can_path, hrz_path;
107 string strip = "k0";
108 size_t pos = track->name.find(strip);
109 if (pos != string::npos)
110 track->name.replace(pos, strip.size(), "");
111
112 frd_path << track_base_path << "/" << track->name << ".frd";
113 col_path << track_base_path << "/" << track->name << ".col";
114 can_path << track_base_path << "/" << track->name << "00a.can";
115 hrz_path << track_base_path << "/3" << track->name << ".hrz";
116
117 ASSERT(ExtractTrackTextures(track_base_path, track->name, NFSVer::NFS_3), "Could not extract " << track->name << " QFS texture pack.");
118 ASSERT(LoadFRD(frd_path.str(), track->name, track), "Could not load FRD file: " << frd_path.str()); // Load FRD file to get track block specific data
119 ASSERT(LoadCOL(col_path.str(), track), "Could not load COL file: " << col_path.str()); // Load Catalogue file to get global (non trkblock specific) data
120 ASSERT(LoadCAN(can_path.str(), track->cameraAnimation), "Could not load CAN file (camera animation): " << can_path.str()); // Load camera intro/outro animation data
121 ASSERT(LoadHRZ(hrz_path.str(), track), "Could not load HRZ file (skybox/lighting):" << hrz_path.str()); // Load HRZ Data
122
123 track->textureArrayID = MakeTextureArray(track->textures, false);
124 track->track_blocks = ParseTRKModels(track);
125 track->global_objects = ParseCOLModels(track);
126
127 LOG(INFO) << "Track loaded successfully";
128 return track;
129}
130
131void NFS3::FreeTrack(const std::shared_ptr<TRACK> &track) {
132 FreeFRD(track);

Callers

nothing calls this directly

Calls 4

ExtractTrackTexturesFunction · 0.85
LoadCANFunction · 0.85
MakeTextureArrayFunction · 0.85
TRACKClass · 0.50

Tested by

no test coverage detected