Example #1
0
int CHudHealth:: MsgFunc_Damage(const char *pszName,  int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );

	int armor = READ_BYTE();	// armor
	int damageTaken = READ_BYTE();	// health
	long bitsDamage = READ_LONG(); // damage bits

	vec3_t vecFrom;

	for ( int i = 0 ; i < 3 ; i++)
		vecFrom[i] = READ_COORD();

	UpdateTiles(gHUD.m_flTime, bitsDamage);

	// Actually took damage?
	if ( damageTaken > 0 || armor > 0 )
		CalcDamageDirection(vecFrom);

	return 1;
}
Example #2
0
int CHud :: MsgFunc_RainData( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	Rain.dripsPerSecond = READ_SHORT();
	Rain.distFromPlayer = READ_COORD();
	Rain.windX = READ_COORD();
	Rain.windY = READ_COORD();
	Rain.randX = READ_COORD();
	Rain.randY = READ_COORD();
	Rain.weatherMode = READ_SHORT();
	Rain.globalHeight= READ_COORD();	// FIXME: calc on client side ?

	END_READ();	

	return 1;
}
Example #3
0
int CHud :: MsgFunc_Damage(const char *pszName, int iSize, void *pbuf )
{
	int		armor, blood;
	Vector	from;
	int		i;
	float	count;
	
	BEGIN_READ( pbuf, iSize );
	armor = READ_BYTE();
	blood = READ_BYTE();

	for (i=0 ; i<3 ; i++)
		from[i] = READ_COORD();

	count = (blood * 0.5) + (armor * 0.5);

	if (count < 10)
		count = 10;

	// TODO: kick viewangles,  show damage visually

	return 1;
}
Example #4
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;
}
Example #5
0
// FGW
int __MsgFunc_BumpLight(const char *pszName, int iSize, void *pbuf)
{
	float rad, strength;
	Vector pos, col;
	int moveWithEnt;
	bool enabled;
	char* targetname;
	bool moveWithExtraInfo = false;
	Vector moveWithPos, moveWithAngles;
	int style;

	BEGIN_READ(pbuf, iSize);

	int msgtype = READ_BYTE();

	if (msgtype == 0)
	{
		// create a new light

		targetname = READ_STRING();

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

		rad = READ_COORD();
		strength = READ_COORD();
		col.x = READ_BYTE() / 255.0f;
		col.y = READ_BYTE() / 255.0f;
		col.z = READ_BYTE() / 255.0f;

		style = READ_BYTE();

		enabled = (READ_BYTE() ? true : false);

		moveWithEnt = READ_SHORT();

		if (moveWithEnt != -1 && READ_BYTE())
		{
			moveWithPos.x = READ_COORD();
			moveWithPos.y = READ_COORD();
			moveWithPos.z = READ_COORD();

			moveWithAngles.x = READ_ANGLE();
			moveWithAngles.y = READ_ANGLE();
			moveWithAngles.z = READ_ANGLE();

			moveWithExtraInfo = true;
		}

		g_BumpmapMgr.AddLight(targetname, pos, col, strength, rad, enabled, style, moveWithEnt, moveWithExtraInfo,
			moveWithPos, moveWithAngles);
	}
	else if (msgtype == 1)
	{
		// set the enabled/disabled state of an existing one

		targetname = READ_STRING();
		enabled = (READ_BYTE() ? true : false);

		g_BumpmapMgr.EnableLight(targetname, enabled);
	}
	else
	{
		gEngfuncs.Con_Printf("BUMPMAPPING: Bogus bump light message type: %i\n", msgtype); // Totally bogus, dude.
	}

	return 1;
}