| 159 | } |
| 160 | |
| 161 | void CKinematics::Load(const char* N, IReader* data, const u32 dwFlags) |
| 162 | { |
| 163 | // Msg ("skeleton: %s",N); |
| 164 | inherited::Load(N, data, dwFlags); |
| 165 | |
| 166 | pUserData = nullptr; |
| 167 | m_lod = nullptr; |
| 168 | // loading lods |
| 169 | |
| 170 | IReader* LD = data->open_chunk(OGF_S_LODS); |
| 171 | if (LD) |
| 172 | { |
| 173 | // From stream |
| 174 | { |
| 175 | string_path lod_name; |
| 176 | LD->r_string(lod_name, sizeof(lod_name)); |
| 177 | |
| 178 | m_lod = smart_cast<dxRender_Visual*>(RImplementation.model_CreateChild(lod_name, nullptr)); |
| 179 | |
| 180 | if (CKinematics* lod_kinematics = smart_cast<CKinematics*>(m_lod)) |
| 181 | { |
| 182 | lod_kinematics->m_is_original_lod = true; |
| 183 | } |
| 184 | |
| 185 | VERIFY(m_lod, "Cant create LOD model for", N); |
| 186 | } |
| 187 | LD->close(); |
| 188 | } |
| 189 | |
| 190 | IReader* UD; |
| 191 | |
| 192 | if (const auto userdata_override_ini = RImplementation.Models->userdata_override_ini; |
| 193 | userdata_override_ini && userdata_override_ini->section_exist("data")) |
| 194 | { |
| 195 | for (const auto& pair : userdata_override_ini->r_section("data").Ordered_Data) |
| 196 | { |
| 197 | if (!strncmp(N, pair.first.c_str(), strlen(pair.first.c_str()))) |
| 198 | { |
| 199 | UD = FS.r_open(fsgame::game_configs, pair.second.c_str()); |
| 200 | if (UD) |
| 201 | { |
| 202 | Msg("Loading user_data [%s] for %s...", pair.second.c_str(), N); |
| 203 | |
| 204 | pUserData = xr_new<CInifile>(UD, FS.get_path(fsgame::game_configs)->m_Path); |
| 205 | UD->close(); |
| 206 | } |
| 207 | |
| 208 | break; |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | // try to read custom user data for module from ltx file |
| 214 | if (!pUserData) |
| 215 | { |
| 216 | string_path ini_path; |
| 217 | strcpy_s(ini_path, N); |
| 218 | if (strext(ini_path)) |
nothing calls this directly
no test coverage detected