예제 #1
0
Gib::Gib
	(
	str name,
	qboolean blood_trail,
	str bloodtrailname,
	str bloodspurtname,
	str bloodsplatname,
	float bloodsplatsize,
	float pitch
	)

   {
   setSize( Vector( "0 0 0" ), Vector( "0 0 0" ) );

	if ( name.length() )
		setModel( name.c_str() );

	setMoveType( MOVETYPE_GIB );
	setSolidType( SOLID_BBOX );
	takedamage = DAMAGE_YES;
   sprayed     = false;
   fadesplat   = true;
   scale       = 2.0f;

	next_bleed_time = 0;

	final_pitch	= pitch;

	if ( blood_trail )
		{
		// Make a blood emitter and bind it to the head
		blood = new Mover;
   
		if ( bloodtrailname.length() )
			blood->setModel( bloodtrailname.c_str() );

		blood->setMoveType( MOVETYPE_BOUNCE );
		blood->setSolidType( SOLID_NOT );
		blood->bind( this );

		// Save the blood spurt name

		if ( bloodspurtname.length() )
			blood_spurt_name = bloodspurtname;

		// Save the blood splat name

		if ( bloodsplatname.length() )
			blood_splat_name = bloodsplatname;

		blood_splat_size = bloodsplatsize;
		}
	else
		{
		blood = NULL;
		}

   Sound( "snd_decap", CHAN_BODY, 1, 300 );
   }
예제 #2
0
bool TFxSprite::Init(str particleSystem, TFxSpriteAnimTask * task, bool reset )
{
    TFxSpriteRef s = GetRef();

    if (reset)
    {
        mDrawnOnce = false;
        s->GetLPS()->NewScript();
    }

    if (particleSystem.length())
    {
        s->GetLPS()->RegisterDataSource("dLocus",&s->mEmitterLocus);
        s->GetLPS()->RegisterDataSource("dUp",&s->mEmitterUp);

        if( !s->GetLPS()->Init(particleSystem) )
        {
            return false;
        }
        s->mName = particleSystem ;
        if (!task)
        {
            task = ((TFxSpriteAnimTask*)GetAnimTask());
        }
        task->mSpriteList.insert( s );
    }
    return true;
}
예제 #3
0
time_stamp_t time_stamp_t::from_str(const str &s)
{
    size_t space_at;
    for (space_at = 0; space_at < s.length(); space_at++) {
        if (s[space_at] == ' ')
            break;
    }

    if (space_at == s.length() - 1) {
        throw std::invalid_argument("Malformed time stamp: " + s + ".");
    }

    str d = s.substr(0, space_at);
    str t = s.substr(space_at + 1, s.length() - space_at - 1);

    return time_stamp_t(date_t::from_str(d),
                        time_t::from_str(t));
}
예제 #4
0
파일: dsl_out.cpp 프로젝트: xkp/XKP
      std::vector<str> load_lines(const str& s)
        {
          std::vector<str> result;
          size_t curr = 0;
          for(size_t i = 0; i < s.length(); i++)
            {
              if (s[i] == '\n')
                {
                  result.push_back( s.substr(curr, i) );
                  curr = i;
                }
            }

          return result;
        }
예제 #5
0
파일: util.cpp 프로젝트: vis15/fractions
bool isNumeric(const str& token)
{
    if(token == "")
        return false;

    for(uint i=0; i<token.length(); i++)
    {
        const char num = token.at(i);
        if(i == 0 && Util::toString(num) == kSubtract() && token.size() > 1) //token.size > 1 because "-" is not a number
            continue;
        if(isdigit(num) == false && Util::toString(num) != kDot())
            return false;
    }

    return true;
}
예제 #6
0
// Parse ------------------------------------------------------
Slist s2vec(str const& s, char const delimiter) {
	Slist vec;
	str element;
	for (int i=0; i<s.length(); i++) {
		char ch = s[i];
		if (ch!=delimiter) element+=ch;
		else if (element.length()>0) {
			vec.push_back(element);
			element.clear();
		}
	}
	// Push in the last element if the string does not end with the delimiter
	if (element.length()>0){
		vec.push_back(element);
	}
	return vec;
}
예제 #7
0
TFxSpriteRef TFxSprite::Create(int32_t layer, str particleSystem, TFxSpriteAnimTask * task )
{
    TFxSpriteRef s= TFxSpriteRef( new TFxSprite(layer) );

    ScriptRegisterMemberFunctor(s->GetLPS()->GetScript(),"CreateFx",s.get(),TFxSprite::CreateFx);
    s->mContainerFolder = particleSystem;
    int lastSlash = s->mContainerFolder.find("/");
    if (lastSlash != str::npos)
    {
        s->mContainerFolder.erase(lastSlash);
    }
    lua_pushlightuserdata(s->GetLPS()->GetScript()->GetState(),s.get());
    lua_setglobal(s->GetLPS()->GetScript()->GetState(),"gParent");

    if (particleSystem.length())
    {
        s->Init(particleSystem,task, false);
    }
    return s;
}