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

Function LoadMonstersDescription

PanzerChasm/game_resources.cpp:61–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61static void LoadMonstersDescription(
62 const Vfs::FileContent& inf_file,
63 GameResources& game_resources )
64{
65 const char* const monsters_start=
66 std::strstr( reinterpret_cast<const char*>(inf_file.data()), "[MONSTERS]" );
67 const char* const monsters_end= reinterpret_cast<const char*>(inf_file.data()) + inf_file.size() - 1u;
68
69 std::istringstream stream( std::string( monsters_start, monsters_end ) );
70
71 char line[ 512 ];
72 stream.getline( line, sizeof(line), '\n' );
73
74 unsigned int monsters_count= 0u;
75 stream >> monsters_count;
76 stream.getline( line, sizeof(line), '\n' );
77
78 game_resources.monsters_description.resize( monsters_count );
79
80 for( unsigned int i= 0u; i < monsters_count; )
81 {
82 stream.getline( line, sizeof(line), '\n' );
83 if( line[0] == ';' )
84 continue;
85
86 std::istringstream line_stream{ std::string( line ) };
87
88 GameResources::MonsterDescription& monster_description= game_resources.monsters_description[i];
89
90 line_stream >> monster_description.model_file_name;
91 line_stream >> monster_description.w_radius; // WRad
92 line_stream >> monster_description.attack_radius; // ARad
93 line_stream >> monster_description.speed; // SPEED/
94 line_stream >> monster_description.rotation_speed; // R
95 line_stream >> monster_description.life; // LIFE
96 line_stream >> monster_description.kick; // Kick
97 line_stream >> monster_description.rock; // Rock
98 line_stream >> monster_description.sep_limit; // SepLimit
99
100 monster_description.w_radius/= 256.0f;
101 monster_description.attack_radius/= 256.0f;
102
103 i++;
104 }
105}
106
107static void LoadSpriteEffectsDescription(
108 const Vfs::FileContent& inf_file,

Callers 1

LoadGameResourcesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected