| 559 | } |
| 560 | |
| 561 | void MapLoader::LoadWallsTexturesDescription( const Vfs::FileContent& resource_file, MapData& map_data ) |
| 562 | { |
| 563 | for( MapData::WallTextureDescription& tex: map_data.walls_textures ) |
| 564 | { |
| 565 | tex.file_path[0]= '\0'; |
| 566 | tex.gso[0]= tex.gso[1]= tex.gso[2]= false; |
| 567 | } |
| 568 | |
| 569 | const char* start= GetSubstring( reinterpret_cast<const char*>( resource_file.data() ), "#GFX" ); |
| 570 | start+= std::strlen( "#GFX" ); |
| 571 | const char* const end= GetSubstring( start, "#end" ); |
| 572 | |
| 573 | std::istringstream stream( std::string( start, end ) ); |
| 574 | |
| 575 | char line[ 512u ]; |
| 576 | stream.getline( line, sizeof(line), '\n' ); |
| 577 | |
| 578 | while( !stream.eof() ) |
| 579 | { |
| 580 | stream.getline( line, sizeof(line), '\n' ); |
| 581 | |
| 582 | if( stream.eof() ) |
| 583 | break; |
| 584 | |
| 585 | std::istringstream line_stream{ std::string( line ) }; |
| 586 | |
| 587 | unsigned int texture_number; |
| 588 | line_stream >> texture_number; |
| 589 | |
| 590 | char colon[8]; |
| 591 | line_stream >> colon; |
| 592 | if( line_stream.fail() ) |
| 593 | continue; |
| 594 | |
| 595 | MapData::WallTextureDescription& texture_description= map_data.walls_textures[ texture_number ]; |
| 596 | |
| 597 | char texture_name[ MapData::c_max_file_name_size ]; |
| 598 | line_stream >> texture_name; |
| 599 | if( line_stream.fail() ) |
| 600 | continue; |
| 601 | |
| 602 | if( texture_name[0] != '\0' ) |
| 603 | std::snprintf( |
| 604 | texture_description.file_path, |
| 605 | sizeof(MapData::WallTextureDescription::file_path), |
| 606 | "%s%s", textures_path_, texture_name ); |
| 607 | else |
| 608 | texture_description.file_path[0]= '\0'; |
| 609 | |
| 610 | char gso[16]; |
| 611 | line_stream >> gso; |
| 612 | if( !line_stream.fail() ) |
| 613 | { |
| 614 | for( unsigned int j= 0u; j < 3u; j++ ) |
| 615 | if( gso[j] != '.' ) |
| 616 | texture_description.gso[j]= true; |
| 617 | } |
| 618 | } |
nothing calls this directly
no test coverage detected