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

Function LoadItemsDescription

PanzerChasm/game_resources.cpp:14–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12{
13
14static void LoadItemsDescription(
15 const Vfs::FileContent& inf_file,
16 GameResources& game_resources )
17{
18 const char* const items_start=
19 std::strstr( reinterpret_cast<const char*>(inf_file.data()), "[3D_OBJECTS]" );
20 const char* const items_end= reinterpret_cast<const char*>(inf_file.data()) + inf_file.size() - 1u;
21
22 std::istringstream stream( std::string( items_start, items_end ) );
23
24 char line[ 512 ];
25 stream.getline( line, sizeof(line), '\n' );
26
27 unsigned int items_count= 0u;
28 stream >> items_count;
29 stream.getline( line, sizeof(line), '\n' );
30
31 game_resources.items_description.resize( items_count );
32 for( unsigned int i= 0u; i < items_count; )
33 {
34 stream.getline( line, sizeof(line), '\n' );
35 if( line[0] == ';' )
36 continue;
37
38 std::istringstream line_stream{ std::string( line ) };
39
40 GameResources::ItemDescription& item_description= game_resources.items_description[i];
41
42 line_stream >> item_description.radius; // GoRad
43 line_stream >> item_description.cast_shadow; // Shad
44 line_stream >> item_description.bmp_obj; // BObj
45 line_stream >> item_description.bmp_z; // BMPz
46 line_stream >> item_description.a_code; // AC
47 line_stream >> item_description.blow_up; // Blw
48 line_stream >> item_description.b_limit; // BLmt
49 line_stream >> item_description.b_sfx; // BSfx
50 line_stream >> item_description.sfx; // SFX
51
52 line_stream >> item_description.model_file_name; // FileName
53
54 item_description.animation_file_name[0]= '\0';
55 line_stream >> item_description.animation_file_name; // Animation
56
57 i++;
58 }
59}
60
61static void LoadMonstersDescription(
62 const Vfs::FileContent& inf_file,

Callers 1

LoadGameResourcesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected