| 186 | } |
| 187 | |
| 188 | bool CPSLibrary::Load2() |
| 189 | { |
| 190 | if (!FS.path_exist("$game_particles$")) |
| 191 | { |
| 192 | return false; |
| 193 | } |
| 194 | |
| 195 | bool something_loaded{}; |
| 196 | Msg("Start load particle files..."); |
| 197 | |
| 198 | FS_FileSet files; |
| 199 | string_path _path; |
| 200 | |
| 201 | FS.update_path(_path, "$game_particles$", ""); |
| 202 | FS.file_list(files, _path, FS_ListFiles, "*.pe,*.pg"); |
| 203 | |
| 204 | FS_FileSet::iterator it = files.begin(); |
| 205 | FS_FileSet::iterator it_e = files.end(); |
| 206 | |
| 207 | string_path p_path, p_name, p_ext; |
| 208 | for (; it != it_e; ++it) |
| 209 | { |
| 210 | const FS_File& f = (*it); |
| 211 | _splitpath(f.name.c_str(), 0, p_path, p_name, p_ext); |
| 212 | FS.update_path(_path, "$game_particles$", f.name.c_str()); |
| 213 | CInifile ini(_path, TRUE, TRUE, FALSE); |
| 214 | |
| 215 | xr_sprintf(_path, sizeof(_path), "%s%s", p_path, p_name); |
| 216 | something_loaded = true; |
| 217 | if (0 == _stricmp(p_ext, ".pe")) |
| 218 | { |
| 219 | auto def = std::make_unique<PS::CPEDef>(); |
| 220 | def->m_copFormat = true; // always in cop mode |
| 221 | def->m_Name = _path; |
| 222 | if (def->Load2(ini)) |
| 223 | m_PEDs[def->m_Name] = std::move(def); |
| 224 | } |
| 225 | else if (0 == _stricmp(p_ext, ".pg")) |
| 226 | { |
| 227 | auto def = std::make_unique<PS::CPGDef>(); |
| 228 | def->m_Name = _path; |
| 229 | if (def->Load2(ini)) |
| 230 | m_PGDs[def->m_Name] = std::move(def); |
| 231 | } |
| 232 | else |
| 233 | { |
| 234 | R_ASSERT(0); |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | Msg("Loaded particle files: [%u]", files.size()); |
| 239 | |
| 240 | return something_loaded; |
| 241 | } |
| 242 | |
| 243 | bool CPSLibrary::Save2(bool override) const |
| 244 | { |
no test coverage detected