| 453 | */ |
| 454 | |
| 455 | int CTaskManager::GetVector( int entID, CBlock *block, int &memberNum, vec3_t &value, CIcarus* icarus ) |
| 456 | { |
| 457 | char *name; |
| 458 | int type, i; |
| 459 | |
| 460 | //See if this is a get() command replacement |
| 461 | if ( Check( CIcarus::ID_GET, block, memberNum ) ) |
| 462 | { |
| 463 | //Update the member past the header id |
| 464 | memberNum++; |
| 465 | |
| 466 | //get( TYPE, NAME ) |
| 467 | type = (int) (*(float *) block->GetMemberData( memberNum++ )); |
| 468 | name = (char *) block->GetMemberData( memberNum++ ); |
| 469 | |
| 470 | //TODO: Emit warning |
| 471 | if ( type != CIcarus::TK_VECTOR ) |
| 472 | { |
| 473 | icarus->GetGame()->DebugPrint(IGameInterface::WL_ERROR, "Get() call tried to return a non-VECTOR parameter!\n" ); |
| 474 | } |
| 475 | |
| 476 | return icarus->GetGame()->GetVector( entID, name, value ); |
| 477 | } |
| 478 | |
| 479 | //Look for a Q_flrand(0.0f, 1.0f) inline call |
| 480 | if ( Check( CIcarus::ID_RANDOM, block, memberNum ) ) |
| 481 | { |
| 482 | float min, max; |
| 483 | |
| 484 | memberNum++; |
| 485 | |
| 486 | min = *(float *) block->GetMemberData( memberNum++ ); |
| 487 | max = *(float *) block->GetMemberData( memberNum++ ); |
| 488 | |
| 489 | for ( i = 0; i < 3; i++ ) |
| 490 | { |
| 491 | value[i] = (float) icarus->GetGame()->Random( min, max ); //FIXME: Just truncating it for now.. should be fine though |
| 492 | } |
| 493 | |
| 494 | return true; |
| 495 | } |
| 496 | |
| 497 | //Look for a tag() inline call |
| 498 | if ( Check( CIcarus::ID_TAG, block, memberNum ) ) |
| 499 | { |
| 500 | char *tagName; |
| 501 | float tagLookup; |
| 502 | |
| 503 | memberNum++; |
| 504 | ICARUS_VALIDATE ( Get( entID, block, memberNum, &tagName, icarus ) ); |
| 505 | ICARUS_VALIDATE ( GetFloat( entID, block, memberNum, tagLookup, icarus ) ); |
| 506 | |
| 507 | if ( icarus->GetGame()->GetTag( entID, tagName, (int) tagLookup, value ) == false) |
| 508 | { |
| 509 | icarus->GetGame()->DebugPrint(IGameInterface::WL_ERROR, "Unable to find tag \"%s\"!\n", tagName ); |
| 510 | assert(0&&"Unable to find tag"); |
| 511 | return TASK_FAILED; |
| 512 | } |
no test coverage detected