MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / LoadBMPObjectsDescription

Function LoadBMPObjectsDescription

PanzerChasm/game_resources.cpp:149–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149static void LoadBMPObjectsDescription(
150 const Vfs::FileContent& inf_file,
151 GameResources& game_resources )
152{
153 const char* const bmp_start=
154 std::strstr( reinterpret_cast<const char*>(inf_file.data()), "[BMP_OBJECTS]" );
155 const char* const bmp_end= reinterpret_cast<const char*>(inf_file.data()) + inf_file.size() - 1u;
156
157 std::istringstream stream( std::string( bmp_start, bmp_end ) );
158
159 char line[ 512 ];
160 stream.getline( line, sizeof(line), '\n' );
161
162 unsigned int bmp_count= 0u;
163 stream >> bmp_count;
164 stream.getline( line, sizeof(line), '\n' );
165
166 game_resources.bmp_objects_description.resize( bmp_count );
167
168 for( unsigned int i= 0u; i < bmp_count; )
169 {
170 stream.getline( line, sizeof(line), '\n' );
171 if( line[0] == ';' )
172 continue;
173
174 std::istringstream line_stream{ std::string( line ) };
175
176 GameResources::BMPObjectDescription& description= game_resources.bmp_objects_description[i];
177 line_stream >> description.light;
178 line_stream >> description.glass;
179 line_stream >> description.half_size;
180
181 int zero;
182 line_stream >> zero; line_stream >> zero; line_stream >> zero;
183
184 line_stream >> description.sprite_file_name;
185
186 i++;
187 }
188}
189
190static void LoadWeaponsDescription(
191 const Vfs::FileContent& inf_file,

Callers 1

LoadGameResourcesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected