Exemplo n.º 1
0
CGrenade *CGrenade::ShootContact( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity )
{
	CGrenade *pGrenade = GetClassPtr( (CGrenade *)NULL );
	pGrenade->Spawn();
	// contact grenades arc lower
	pGrenade->pev->gravity = 0.5;// lower gravity since grenade is aerodynamic and engine doesn't know it.
	UTIL_SetOrigin( pGrenade, vecStart );
	pGrenade->SetLocalVelocity( vecVelocity );
	pGrenade->SetLocalAngles( UTIL_VecToAngles( pGrenade->GetLocalVelocity( )));
	pGrenade->pev->owner = ENT(pevOwner);
	
	// make monsters afaid of it while in the air
	pGrenade->SetThink( &CGrenade::DangerSoundThink );
	pGrenade->SetNextThink( 0 );
	
	// Tumble in air
	Vector avelocity( RANDOM_FLOAT ( 100, 500 ), 0, 0 );
	pGrenade->SetLocalAvelocity( avelocity );
	
	// Explode on contact
	pGrenade->SetTouch( &CGrenade::ExplodeTouch );

	pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade;

	return pGrenade;
}
Exemplo n.º 2
0
int CHudParticules::MsgFunc_ClientDecal( const char *pszName, int iSize, void *pbuf )
{
    BEGIN_READ( pbuf, iSize );

    Vector vecSrc, vecNormal;
    char chTextureType;

    vecSrc.x = READ_COORD();
    vecSrc.y = READ_COORD();
    vecSrc.z = READ_COORD();

    vecNormal.x = READ_COORD();
    vecNormal.y = READ_COORD();
    vecNormal.z = READ_COORD();

    chTextureType = READ_CHAR();
    int decal = READ_BYTE();

    if ( decal == 4 )	// explo electro-roquette
    {
        AddDecal ( vecSrc, Vector ( 90,0,0 ), "sprites/rpg_disk.spr", gHUD.m_flTime + ELECTRO_DISK_MAX / ELECTRO_DISK_SPEED + 0.5, FLAG_DECAL_DISK );
        return 1;
    }
    if ( decal == 5 )	// explo supergun
    {
        Vector angDir;
        VectorAngles ( -vecNormal, angDir );
        angDir.y += 180;

        AddDecal ( vecSrc, angDir, "sprites/rpg_disk.spr", gHUD.m_flTime + 0.5, FLAG_DECAL_SG );
        return 1;
    }

    if ( decal == 6 )	// muzzle outro
    {
        Vector vecDir = vecNormal, velocity (0,0,0), avelocity(0,0,0), src = vecSrc;
        float largeur, brightness;

        //gros

        for ( int j=0; j<4; j++ )
        {
            avelocity	= Vector (0.0f, 0.0f, gEngfuncs.pfnRandomFloat(30,60)* ((j%2)==0?1:-1) );
            velocity	= Vector (vecDir - vecSrc) * 0/*( 0.08 - j*0.02 )*/;
            largeur = 5;
            brightness = 0.3;

            AddParticule ( src, Vector (largeur,brightness,0.0f), velocity, avelocity , "sprites/outro_muzzle.spr", gHUD.m_flTime + 7, FLAG_PARTICULE_OUTRO1 );
        }

        // petits

        for ( int i=0; i<10; i++ )
        {
            brightness = 0.3;
            avelocity	= Vector (0.0f, 0.0f, gEngfuncs.pfnRandomFloat(-300,300) );
            //	velocity	= Vector (vecDir - vecSrc) * ( 0.3 - i*0.03 ) * 2.5;
            velocity	= Vector (vecDir - vecSrc).Normalize() * 0.1;
            largeur		= 1.2 + i*0.3;
            src			= vecSrc + 0.1*(vecDir-vecSrc);

            AddParticule ( src, Vector (largeur,brightness,0.0f), velocity, avelocity, "sprites/outro_muzzle.spr", gHUD.m_flTime + 7, FLAG_PARTICULE_OUTRO2 );
        }

        return 1;
    }

    EV_HLDM_EjectParticules ( vecSrc, vecNormal, chTextureType, decal, 1 );

    return 1;
}