==================== idRenderModelLiquid::InitFromFile ==================== */
| 343 | ==================== |
| 344 | */ |
| 345 | void idRenderModelLiquid::InitFromFile( const char *fileName ) { |
| 346 | int i, x, y; |
| 347 | idToken token; |
| 348 | idParser parser( LEXFL_ALLOWPATHNAMES | LEXFL_NOSTRINGESCAPECHARS ); |
| 349 | idList<int> tris; |
| 350 | float size_x, size_y; |
| 351 | float rate; |
| 352 | |
| 353 | name = fileName; |
| 354 | |
| 355 | if ( !parser.LoadFile( fileName ) ) { |
| 356 | MakeDefaultModel(); |
| 357 | return; |
| 358 | } |
| 359 | |
| 360 | size_x = scale_x * verts_x; |
| 361 | size_y = scale_y * verts_y; |
| 362 | |
| 363 | while( parser.ReadToken( &token ) ) { |
| 364 | if ( !token.Icmp( "seed" ) ) { |
| 365 | seed = parser.ParseInt(); |
| 366 | } else if ( !token.Icmp( "size_x" ) ) { |
| 367 | size_x = parser.ParseFloat(); |
| 368 | } else if ( !token.Icmp( "size_y" ) ) { |
| 369 | size_y = parser.ParseFloat(); |
| 370 | } else if ( !token.Icmp( "verts_x" ) ) { |
| 371 | verts_x = parser.ParseFloat(); |
| 372 | if ( verts_x < 2 ) { |
| 373 | parser.Warning( "Invalid # of verts. Using default model." ); |
| 374 | MakeDefaultModel(); |
| 375 | return; |
| 376 | } |
| 377 | } else if ( !token.Icmp( "verts_y" ) ) { |
| 378 | verts_y = parser.ParseFloat(); |
| 379 | if ( verts_y < 2 ) { |
| 380 | parser.Warning( "Invalid # of verts. Using default model." ); |
| 381 | MakeDefaultModel(); |
| 382 | return; |
| 383 | } |
| 384 | } else if ( !token.Icmp( "liquid_type" ) ) { |
| 385 | liquid_type = parser.ParseInt() - 1; |
| 386 | if ( ( liquid_type < 0 ) || ( liquid_type >= LIQUID_MAX_TYPES ) ) { |
| 387 | parser.Warning( "Invalid liquid_type. Using default model." ); |
| 388 | MakeDefaultModel(); |
| 389 | return; |
| 390 | } |
| 391 | } else if ( !token.Icmp( "density" ) ) { |
| 392 | density = parser.ParseFloat(); |
| 393 | } else if ( !token.Icmp( "drop_height" ) ) { |
| 394 | drop_height = parser.ParseFloat(); |
| 395 | } else if ( !token.Icmp( "drop_radius" ) ) { |
| 396 | drop_radius = parser.ParseInt(); |
| 397 | } else if ( !token.Icmp( "drop_delay" ) ) { |
| 398 | drop_delay = SEC2MS( parser.ParseFloat() ); |
| 399 | } else if ( !token.Icmp( "shader" ) ) { |
| 400 | parser.ReadToken( &token ); |
| 401 | shader = declManager->FindMaterial( token ); |
| 402 | } else if ( !token.Icmp( "update_rate" ) ) { |
nothing calls this directly
no test coverage detected