void CASW_Simple_Alien::UpdateSleeping()
{
	if (m_bSleeping)	// asleep:  wake up if we can be seen
	{
		bool bCorpseCanSee = false;
		bool bCanBeSeen = (UTIL_ASW_AnyMarineCanSee(GetAbsOrigin(), 384.0f, bCorpseCanSee) != NULL) || bCorpseCanSee;
		SetSleeping(!bCanBeSeen);
	}
	else	// awake: if have no orders, no enemy and can't be seen, sleep
	{
		if (GetEnemy() == NULL && GetAlienOrders() == AOT_None)
		{
			bool bCorpseCanSee = false;
			bool bCanBeSeen = (UTIL_ASW_AnyMarineCanSee(GetAbsOrigin(), 384.0f, bCorpseCanSee) != NULL) || bCorpseCanSee;
			SetSleeping(!bCanBeSeen);
		}
	}
}
void asw_test_marinenearby_f(const CCommand &args)
{
	Msg("0.5 as float = %f\n", 0.5f);
	Msg("0.5f as int = %d\n", (int) 0.5f);
	Msg("0.51f as int = %d\n", (int) 0.51f);
	Msg("0.52f as int = %d\n", (int) 0.52f);
	Msg("0.6f as int = %d\n", (int) 0.6f);
	Msg("0.56f as int = %d\n", (int) 0.56f);
	Msg("0.49f as int = %d\n", (int) 0.49f);
	Msg("1.99f as int = %d\n", (int) 1.99f);
	Msg("2.01f as int = %d\n", (int) 2.01f);
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());	

	if (!ASWGameRules())
		return;
	if (!pPlayer || !pPlayer->GetMarine())
		return;
	
	if ( args.ArgC() < 4 )
	{
		Msg("Usage: asw_test_marinenearby [0|1] [grid step] [grid count]\n");
	}
	int iWide = atoi(args[1]);
	float fGridStep = atof(args[2]);
	int iGridCount = atoi(args[3]);
	//Msg("Wide = %d, step = %f, count = %d\n", iWide, fGridStep, iGridCount);

	Vector asw_default_camera_dir_2;
	QAngle test_angle(asw_marine_nearby_angle.GetFloat(), 90, 0);
	AngleVectors(test_angle, &asw_default_camera_dir_2);
	Vector asw_default_camera_offset_2 = asw_default_camera_dir_2 * -405.0f;

	for (int x=-iGridCount;x<iGridCount;x++)
	{
		for (int y=-iGridCount;y<iGridCount*3;y++)
		{
			Vector pos = pPlayer->GetMarine()->GetAbsOrigin() + Vector(x * fGridStep, y*fGridStep, 10);
			//Msg("Testing pos %f, %f, %f\n", pos.x, pos.y, pos.z);
			bool bCorpseCanSee = false;
			UTIL_ASW_AnyMarineCanSee(pos,
				iWide, bCorpseCanSee);
		}
	}	
	Vector pos = (pPlayer->GetMarine()->GetAbsOrigin() + asw_default_camera_offset_2);
	//NDebugOverlay::Line(pos, pos + asw_default_camera_dir_2 * 410, 0,0,255,true, 30);
}