예제 #1
0
int CHudLensflare::MsgFunc_Lensflare(const char *pszName,  int iSize, void *pbuf)
{
    BEGIN_READ( pbuf, iSize );

	Sunanglex = READ_ANGLE();
	Sunangley = READ_ANGLE();

	m_iFlags |= HUD_ACTIVE;
    return 1;
}
예제 #2
0
int CHudAmmo::MsgFunc_Brass( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pbuf, iSize );
	READ_BYTE();

	Vector start, velocity;
	start.x = READ_COORD();
	start.y = READ_COORD();
	start.z = READ_COORD();
	READ_COORD();
	READ_COORD(); // unused data
	READ_COORD();
	velocity.x = READ_COORD();
	velocity.y = READ_COORD();
	velocity.z = READ_COORD();

	float Rotation = M_PI * READ_ANGLE() / 180.0f;
	int ModelIndex = READ_SHORT();
	int BounceSoundType = READ_BYTE();
	int Life = READ_BYTE();
	READ_BYTE();

	float sin, cos, x, y;
	sincosf( Rotation, &sin, &cos );
	x = -9.0 * sin;
	y = 9.0 * cos;

	if( cl_righthand->value != 0.0f )
	{
		velocity.x += sin * -120.0;
		velocity.y += cos * 120.0;
		x = 9.0 * sin;
		y = -9.0 * cos;
	}

	start.x += x;
	start.y += y;
	EV_EjectBrass( start, velocity, Rotation, ModelIndex, BounceSoundType, Life );
	return 1;
}
예제 #3
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;
}