| 325 | } |
| 326 | |
| 327 | static void LoadGibsDescription( |
| 328 | const Vfs::FileContent& inf_file, |
| 329 | GameResources& game_resources ) |
| 330 | { |
| 331 | const char* const gibs_start= |
| 332 | std::strstr( reinterpret_cast<const char*>(inf_file.data()), "[GIBS]" ); |
| 333 | const char* const gibs_end= reinterpret_cast<const char*>(inf_file.data()) + inf_file.size() - 1u; |
| 334 | |
| 335 | std::istringstream stream( std::string( gibs_start, gibs_end ) ); |
| 336 | |
| 337 | char line[ 512 ]; |
| 338 | stream.getline( line, sizeof(line), '\n' ); |
| 339 | |
| 340 | game_resources.gibs_description.reserve( 16u ); |
| 341 | |
| 342 | unsigned int gib_number= 0u; |
| 343 | while( !stream.fail() ) |
| 344 | { |
| 345 | stream.getline( line, sizeof(line), '\n' ); |
| 346 | if( stream.eof() ) |
| 347 | break; |
| 348 | if( std::strncmp( line, "#end", std::strlen( "#end" ) ) == 0 ) |
| 349 | break; |
| 350 | |
| 351 | const char* s= line; |
| 352 | |
| 353 | //const unsigned int gib_number= std::atoi(s) - GameResources::c_first_gib_number; |
| 354 | |
| 355 | while( std::isdigit( *s ) ) s++; |
| 356 | while( std::isspace( *s ) ) s++; |
| 357 | s++; // : |
| 358 | while( *s != '=' ) s++; |
| 359 | s++; // = |
| 360 | while( std::isspace( *s ) && *s != '\0' ) s++; |
| 361 | |
| 362 | if( *s == '\0' ) |
| 363 | continue; |
| 364 | |
| 365 | if( gib_number >= game_resources.gibs_description.size() ) |
| 366 | game_resources.gibs_description.resize( gib_number + 1u ); |
| 367 | |
| 368 | GameResources::GibDescription& gib= game_resources.gibs_description[ gib_number ]; |
| 369 | gib.model_file_name[0]= '\0'; |
| 370 | gib.sound_number= 0u; |
| 371 | |
| 372 | char* file_name_dst= gib.model_file_name; |
| 373 | while( !std::isspace( *s ) && *s != '\0' ) |
| 374 | { |
| 375 | *file_name_dst= *s; |
| 376 | file_name_dst++; |
| 377 | s++; |
| 378 | } |
| 379 | *file_name_dst= '\0'; |
| 380 | |
| 381 | while( std::isspace( *s ) && *s != '\0' ) s++; |
| 382 | |
| 383 | if( *s == 's' || *s == 's' ) |
| 384 | { |