| 254 | } |
| 255 | |
| 256 | static void LoadRocketsDescription( |
| 257 | const Vfs::FileContent& inf_file, |
| 258 | GameResources& game_resources ) |
| 259 | { |
| 260 | const char* const rockets_start= |
| 261 | std::strstr( reinterpret_cast<const char*>(inf_file.data()), "[ROCKETS]" ); |
| 262 | const char* const rockets_end= reinterpret_cast<const char*>(inf_file.data()) + inf_file.size() - 1u; |
| 263 | |
| 264 | std::istringstream stream( std::string( rockets_start, rockets_end ) ); |
| 265 | |
| 266 | char line[ 512 ]; |
| 267 | stream.getline( line, sizeof(line), '\n' ); |
| 268 | |
| 269 | unsigned int rockets_count= 0u; |
| 270 | stream >> rockets_count; |
| 271 | stream.getline( line, sizeof(line), '\n' ); |
| 272 | stream.getline( line, sizeof(line), '\n' ); |
| 273 | |
| 274 | game_resources.rockets_description.resize( rockets_count ); |
| 275 | |
| 276 | for( unsigned int i= 0u; i < rockets_count; i++ ) |
| 277 | { |
| 278 | GameResources::RocketDescription& rocket_description= game_resources.rockets_description[i]; |
| 279 | |
| 280 | rocket_description.model_file_name[0]= '\0'; |
| 281 | rocket_description.animation_file_name[0]= '\0'; |
| 282 | |
| 283 | for( unsigned int j= 0u; j < 2u; j++ ) |
| 284 | { |
| 285 | stream.getline( line, sizeof(line), '\n' ); |
| 286 | std::istringstream line_stream{ std::string( line ) }; |
| 287 | |
| 288 | char param_name[64], param_value[64], eq[16]; |
| 289 | param_name[0]= param_value[0]= '\0'; |
| 290 | |
| 291 | line_stream >> param_name; |
| 292 | line_stream >> eq; |
| 293 | line_stream >> param_value; |
| 294 | |
| 295 | if( param_value[0] == ';' ) |
| 296 | continue; |
| 297 | |
| 298 | if( std::strcmp( param_name, "3d_MODEL" ) == 0u ) |
| 299 | std::strcpy( rocket_description.model_file_name, param_value ); |
| 300 | else if( std::strcmp( param_name, "ANIMATION" ) == 0u ) |
| 301 | std::strcpy( rocket_description.animation_file_name, param_value ); |
| 302 | } |
| 303 | |
| 304 | stream.getline( line, sizeof(line), '\n' ); |
| 305 | std::istringstream line_stream{ std::string( line ) }; |
| 306 | |
| 307 | line_stream >> rocket_description.blow_effect; // BW |
| 308 | line_stream >> rocket_description.gravity_force; // GF |
| 309 | line_stream >> rocket_description.explosion_radius; // Ard |
| 310 | line_stream >> rocket_description.CRd; // CRd |
| 311 | line_stream >> rocket_description.power; // Pwr |
| 312 | |
| 313 | line_stream >> rocket_description.reflect; // Rfl |