MCPcopy Create free account
hub / github.com/JACoders/OpenJK / GetFloat

Method GetFloat

code/icarus/TaskManager.cpp:382–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380*/
381
382int CTaskManager::GetFloat( int entID, CBlock *block, int &memberNum, float &value, CIcarus* icarus )
383{
384 char *name;
385 int type;
386
387 //See if this is a get() command replacement
388 if ( Check( CIcarus::ID_GET, block, memberNum ) )
389 {
390 //Update the member past the header id
391 memberNum++;
392
393 //get( TYPE, NAME )
394 type = (int) (*(float *) block->GetMemberData( memberNum++ ));
395 name = (char *) block->GetMemberData( memberNum++ );
396
397 //TODO: Emit warning
398 if ( type != CIcarus::TK_FLOAT )
399 {
400 icarus->GetGame()->DebugPrint(IGameInterface::WL_ERROR, "Get() call tried to return a non-FLOAT parameter!\n" );
401 return false;
402 }
403
404 return icarus->GetGame()->GetFloat( entID, name, &value );
405 }
406
407 //Look for a Q_flrand(0.0f, 1.0f) inline call
408 if ( Check( CIcarus::ID_RANDOM, block, memberNum ) )
409 {
410 float min, max;
411
412 memberNum++;
413
414 min = *(float *) block->GetMemberData( memberNum++ );
415 max = *(float *) block->GetMemberData( memberNum++ );
416
417 value = icarus->GetGame()->Random( min, max );
418
419 return true;
420 }
421
422 //Look for a tag() inline call
423 if ( Check( CIcarus::ID_TAG, block, memberNum ) )
424 {
425 icarus->GetGame()->DebugPrint(IGameInterface::WL_WARNING, "Invalid use of \"tag\" inline. Not a valid replacement for type FLOAT\n" );
426 return false;
427 }
428
429 CBlockMember *bm = block->GetMember( memberNum );
430
431 if ( bm->GetID() == CIcarus::TK_INT )
432 {
433 value = (float) (*(int *) block->GetMemberData( memberNum++ ));
434 }
435 else if ( bm->GetID() == CIcarus::TK_FLOAT )
436 {
437 value = *(float *) block->GetMemberData( memberNum++ );
438 }
439 else

Callers 2

GetMethod · 0.45
EvaluateConditionalMethod · 0.45

Calls 6

DebugPrintMethod · 0.80
RandomMethod · 0.80
GetMemberDataMethod · 0.45
GetGameMethod · 0.45
GetMemberMethod · 0.45
GetIDMethod · 0.45

Tested by

no test coverage detected