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

Method ParseAffect

code/icarus/Sequencer.cpp:684–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

682*/
683
684int CSequencer::ParseAffect( CBlock *block, bstream_t *bstream, CIcarus* icarus )
685{
686 IGameInterface* game = icarus->GetGame();
687 CSequencer *stream_sequencer = NULL;
688 char *entname = NULL;
689 int ret;
690 int ent = -1;
691
692 entname = (char*) block->GetMemberData( 0 );
693 ent = game->GetByName( entname );
694
695 if( ent < 0 ) // if there wasn't a valid entname in the affect, we need to check if it's a get command
696 {
697 //try to parse a 'get' command that is embeded in this 'affect'
698
699 int id;
700 char *p1 = NULL;
701 char *name = 0;
702 CBlockMember *bm = NULL;
703 //
704 // Get the first parameter (this should be the get)
705 //
706 bm = block->GetMember( 0 );
707 id = bm->GetID();
708
709 switch ( id )
710 {
711 // these 3 cases probably aren't necessary
712 case CIcarus::TK_STRING:
713 case CIcarus::TK_IDENTIFIER:
714 case CIcarus::TK_CHAR:
715 p1 = (char *) bm->GetData();
716 break;
717
718 case CIcarus::ID_GET:
719 {
720 int type;
721
722 //get( TYPE, NAME )
723 type = (int) (*(float *) block->GetMemberData( 1 ));
724 name = (char *) block->GetMemberData( 2 );
725
726 switch ( type ) // what type are they attempting to get
727 {
728
729 case CIcarus::TK_STRING:
730 //only string is acceptable for affect, store result in p1
731 if ( game->GetString( m_ownerID, name, &p1 ) == false)
732 {
733 block->Free(icarus);
734 delete block;
735 block = NULL;
736 return false;
737 }
738 break;
739 default:
740 //FIXME: Make an enum id for the error...
741 game->DebugPrint(IGameInterface::WL_ERROR, "Invalid parameter type on affect _1" );

Callers

nothing calls this directly

Calls 15

GetByNameMethod · 0.80
DebugPrintMethod · 0.80
CreateIcarusMethod · 0.80
FindSequencerMethod · 0.80
GetGameMethod · 0.45
GetMemberDataMethod · 0.45
GetMemberMethod · 0.45
GetIDMethod · 0.45
GetDataMethod · 0.45
GetStringMethod · 0.45
FreeMethod · 0.45
GetSequenceMethod · 0.45

Tested by

no test coverage detected