Exemple #1
0
void DrawLaserSight(
	const ActorPics *pics, const TActor *a, const Vec2i picPos)
{
	// Don't draw if dead or transparent
	if (pics->IsDead || pics->IsTransparent) return;
	// Check config
	const LaserSight ls = ConfigGetEnum(&gConfig, "Game.LaserSight");
	if (ls != LASER_SIGHT_ALL &&
		!(ls == LASER_SIGHT_PLAYERS && a->PlayerUID >= 0))
	{
		return;
	}
	// Draw weapon indicators
	const GunDescription *g = ActorGetGun(a)->Gun;
	Vec2i muzzlePos = Vec2iAdd(
		picPos, Vec2iFull2Real(GunGetMuzzleOffset(g, a->direction)));
	muzzlePos.y -= g->MuzzleHeight / Z_FACTOR;
	const double radians = dir2radians[a->direction] + g->AngleOffset;
	const int range = GunGetRange(g);
	color_t color = colorCyan;
	color.a = 64;
	const double spreadHalf =
		(g->Spread.Count - 1) * g->Spread.Width / 2 + g->Recoil / 2;
	if (spreadHalf > 0)
	{
		DrawLaserSightSingle(muzzlePos, radians - spreadHalf, range, color);
		DrawLaserSightSingle(muzzlePos, radians + spreadHalf, range, color);
	}
	else
	{
		DrawLaserSightSingle(muzzlePos, radians, range, color);
	}
}
Exemple #2
0
static void DrawLaserSight(const TActor *a, const Vec2i picPos)
{
    // Draw weapon indicators
    const GunDescription *g = ActorGetGun(a)->Gun;
    Vec2i muzzlePos = Vec2iAdd(
                          picPos, Vec2iFull2Real(GunGetMuzzleOffset(g, a->direction)));
    muzzlePos.y -= g->MuzzleHeight / Z_FACTOR;
    const double radians = dir2radians[a->direction] + g->AngleOffset;
    const int range = GunGetRange(g);
    color_t color = colorCyan;
    color.a = 64;
    const double spreadHalf =
        (g->Spread.Count - 1) * g->Spread.Width / 2 + g->Recoil / 2;
    if (spreadHalf > 0)
    {
        DrawLaserSightSingle(muzzlePos, radians - spreadHalf, range, color);
        DrawLaserSightSingle(muzzlePos, radians + spreadHalf, range, color);
    }
    else
    {
        DrawLaserSightSingle(muzzlePos, radians, range, color);
    }
}