void C_ASW_AOEGrenade_Projectile::UpdateParticleAttachments( CNewParticleEffect *pEffect, C_BaseEntity *pTarget )
{
	if ( GetArcAttachmentName() )
	{
		bool bAttachWeapon = false;
		if ( ShouldAttachEffectToWeapon() )
		{
			C_ASW_Marine *pMarine = C_ASW_Marine::AsMarine( pTarget );
			if ( pMarine && pMarine->GetActiveASWWeapon() )
			{
				C_ASW_Weapon *pWeapon = pMarine->GetActiveASWWeapon();
				int iAttachment = pWeapon->LookupAttachment( "muzzle" );
				if ( pWeapon->IsOffensiveWeapon() && iAttachment > 0 )
				{
					bAttachWeapon = true;
					ParticleProp()->AddControlPoint( pEffect, 1, pWeapon, PATTACH_POINT_FOLLOW, "muzzle" );
				}
			}
		}

		if ( !bAttachWeapon )
			ParticleProp()->AddControlPoint( pEffect, 1, pTarget, PATTACH_POINT_FOLLOW, GetArcAttachmentName() );
	}
	else
	{
		ParticleProp()->AddControlPoint( pEffect, 1, pTarget, PATTACH_ABSORIGIN_FOLLOW );
	}
}
void CASWHudCrosshair::DrawDirectionalCrosshair( int x, int y, int iSize )
{
	C_ASW_Player *local = C_ASW_Player::GetLocalASWPlayer();
	if (!local)
		return;	
	
	C_ASW_Marine *pMarine = local->GetMarine();
	if (!pMarine)
		return;

	Vector MarinePos = pMarine->GetRenderOrigin();
	Vector screenPos;
	debugoverlay->ScreenPosition( MarinePos + Vector( 0, 0, 45 ), screenPos );

	int cx, cy, dx, dy;
	ASWInput()->ASW_GetWindowCenter(cx, cy);
	dx = x - cx;
	dy = y - cy;
	float flDistance = FastSqrt( dx * dx + dy * dy );

	//CASWScriptCreatedItem *pItem = static_cast<CASWScriptCreatedItem*>( pMarine->GetActiveASWWeapon()->GetAttributeContainer()->GetItem() );
	//if ( !m_bIsCastingSuitAbility )//pItem && pItem->IsMeleeWeapon() &&
	//{
		// here is where we do the crosshair scaling
		int iMax = YRES(54);
		int iMin = YRES(16);
		// clamp the min and max distance the cursor is from the marine on screen
		float flSizeDist = clamp( flDistance, iMin, iMax );

		// this is the full percentage to scale by
		float flTemp = (flSizeDist - iMin) / ( iMax - iMin );
		
		float flMinTexScale = 0.8;
		float flMaxTexScale = 1.0;
		// this is the final percentage to scale by based on the clamping we want for the min and max texture scaling
		float flAdjust = flTemp * (flMaxTexScale - flMinTexScale) + flMinTexScale;

		iSize *= flAdjust;
		m_pAmmoProgress->SetScale( flAdjust );
	//}

	iSize *= 2;
	int iXHairHalfSize = iSize / 2;
	// draw a red pointing, potentially blinking, arrow
	//Vector vecFacing(screenPos.x - (ScreenWidth() * 0.5f), screenPos.y - (ScreenHeight() * 0.5f), 0);
	//float fFacingYaw = -UTIL_VecToYaw(vecFacing);

	Vector2D vXHairCenter( x , y );

	Vector vecCornerTL(-iXHairHalfSize, -iXHairHalfSize, 0);
	Vector vecCornerTR(iXHairHalfSize, -iXHairHalfSize, 0);
	Vector vecCornerBR(iXHairHalfSize, iXHairHalfSize, 0);
	Vector vecCornerBL(-iXHairHalfSize, iXHairHalfSize, 0);
	Vector vecCornerTL_rotated, vecCornerTR_rotated, vecCornerBL_rotated, vecCornerBR_rotated;	

	int current_posx = 0;
	int current_posy = 0;
	ASWInput()->GetSimulatedFullscreenMousePos( &current_posx, &current_posy );
	Vector vecFacing( 0, 0, 0 );
	vecFacing.x = screenPos.x - current_posx;
	vecFacing.y = screenPos.y - current_posy;
	float fFacingYaw = -UTIL_VecToYaw( vecFacing );

	/*
	if ( ASWInput()->ControllerModeActive() )
	{
		int current_posx = 0;
		int current_posy = 0;
		ASWInput()->GetSimulatedFullscreenMousePos( &current_posx, &current_posy );
		vecFacing.x = screenPos.x - current_posx;
		vecFacing.y = screenPos.y - current_posy;
		fFacingYaw = -UTIL_VecToYaw( vecFacing );
	}
	*/

	// rotate it by our facing yaw
	QAngle angFacing(0, -fFacingYaw + 90.0, 0);
	VectorRotate(vecCornerTL, angFacing, vecCornerTL_rotated);
	VectorRotate(vecCornerTR, angFacing, vecCornerTR_rotated);
	VectorRotate(vecCornerBR, angFacing, vecCornerBR_rotated);
	VectorRotate(vecCornerBL, angFacing, vecCornerBL_rotated);
	//


	float flAlpha = 245;

	// fade the crosshair out when it is very close to the marine
	float flAdjust2 = flDistance / YRES(28);
	flAdjust2 = clamp( flAdjust2, 0.1f, 1.0f );

	bool bShotWarn = false;
	Color colorCross = Color(255,255,255,flAlpha*flAdjust2);
	C_ASW_Weapon* pWeapon = pMarine->GetActiveASWWeapon();
	if ( pWeapon && pWeapon->IsOffensiveWeapon() )
	{
		C_BaseEntity *pEnt = pWeapon->GetLaserTargetEntity();
		if ( pEnt && pEnt->Classify() == CLASS_ASW_MARINE )
		{
			bShotWarn = true;
			colorCross = Color(255,0,0,flAlpha*flAdjust2);
		}
	}
	
	surface()->DrawSetColor( colorCross );
	
	if ( !asw_crosshair_use_perspective.GetBool() )
	{
		surface()->DrawSetTexture( m_nDirectCrosshairTexture2 );
	}
	else
	{
		if ( bShotWarn )
			surface()->DrawSetTexture( m_nDirectCrosshairTextureX );
		else
			surface()->DrawSetTexture( m_nDirectCrosshairTexture );
	}
	

	Vertex_t points[4] = 
	{ 
		Vertex_t( Vector2D(vXHairCenter.x + vecCornerTL_rotated.x, vXHairCenter.y + vecCornerTL_rotated.y), 
		Vector2D(0,0) ), 
		Vertex_t( Vector2D(vXHairCenter.x + vecCornerTR_rotated.x, vXHairCenter.y + vecCornerTR_rotated.y), 
		Vector2D(1,0) ), 
		Vertex_t( Vector2D(vXHairCenter.x + vecCornerBR_rotated.x, vXHairCenter.y + vecCornerBR_rotated.y), 
		Vector2D(1,1) ), 
		Vertex_t( Vector2D(vXHairCenter.x + vecCornerBL_rotated.x, vXHairCenter.y + vecCornerBL_rotated.y), 
		Vector2D(0,1) ) 
	}; 
	surface()->DrawTexturedPolygon( 4, points );

	// draw the center
	if ( !asw_crosshair_use_perspective.GetBool() )
	{
		surface()->DrawSetColor( colorCross );
		surface()->DrawSetTexture( m_nCrosshairTexture );
		surface()->DrawTexturedRect(vXHairCenter.x - iXHairHalfSize, vXHairCenter.y - iXHairHalfSize, vXHairCenter.x + iXHairHalfSize, vXHairCenter.y + iXHairHalfSize);
	}
}
Esempio n. 3
0
bool CScriptedIconLesson::Mod_ProcessElementAction( int iAction, bool bNot, const char *pchVarName, EHANDLE &hVar, const CGameInstructorSymbol *pchParamName, float fParam, C_BaseEntity *pParam, const char *pchParam, bool &bModHandled )
{
	// Assume we're going to handle the action
	bModHandled = true;

	C_BaseEntity *pVar = hVar.Get();

	switch ( iAction )
	{
		case LESSON_ACTION_IS_ALLOWED_ITEM:
		{
			C_ASW_Marine *pMarine = NULL;

			C_ASW_Player *pPlayer = dynamic_cast< C_ASW_Player* >( pVar );
			if ( pPlayer )
			{
				pMarine = dynamic_cast< C_ASW_Marine* >( pPlayer->GetMarine() );
			}

			if ( !pMarine )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->AllowedToPickup( [%s] )", pchParamName->String(), pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Marine returned NULL!\n" );
				}

				return false;
			}

			bool bIsAllowed = false;

			C_ASW_Pickup *pPickup = dynamic_cast< C_ASW_Pickup * >( pParam );
			if ( !pPickup )
			{
				C_ASW_Weapon *pWeapon = dynamic_cast< C_ASW_Weapon * >( pParam );

				if ( !pWeapon )
				{
					if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
					{
						ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->AllowedToPickup( [%s] )", pchParamName->String(), pchVarName );
						ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
						ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
						ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tParam handle as ASW_Weapon and ASW_Pickup returned NULL!\n" );
					}

					return false;
				}
				else
				{
					bIsAllowed = pWeapon->AllowedToPickup( pMarine );
				}
			}
			else
			{
				bIsAllowed = pPickup->AllowedToPickup( pMarine );
			}

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->AllowedToPickup( [%s] )", pchParamName->String(), pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bIsAllowed ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bIsAllowed ) : ( bIsAllowed );
		}

		case LESSON_ACTION_ITEM_WILL_SWAP:
		{
			C_ASW_Marine *pMarine = NULL;

			C_ASW_Player *pPlayer = dynamic_cast< C_ASW_Player* >( pVar );
			if ( pPlayer )
			{
				pMarine = dynamic_cast< C_ASW_Marine* >( pPlayer->GetMarine() );
			}

			if ( !pMarine )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->WillSwap( [%s] )", pchParamName->String(), pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Marine returned NULL!\n" );
				}

				return false;
			}

			bool bWillSwap = false;

			C_ASW_Pickup_Weapon *pPickup = dynamic_cast< C_ASW_Pickup_Weapon * >( pParam );
			if ( !pPickup )
			{
				C_ASW_Weapon *pWeapon = dynamic_cast< C_ASW_Weapon * >( pParam );

				if ( !pWeapon )
				{
					if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
					{
						ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->WillSwap( [%s] )", pchParamName->String(), pchVarName );
						ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
						ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
						ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tParam handle as ASW_Weapon and ASW_Pickup returned NULL!\n" );
					}

					return false;
				}
				else
				{
					int nSlot = pMarine->GetWeaponPositionForPickup( pWeapon->GetClassname() );
					bWillSwap = ( pMarine->GetASWWeapon( nSlot ) != NULL );
				}
			}
			else
			{
				int nSlot = pMarine->GetWeaponPositionForPickup( pPickup->GetWeaponClass() );
				bWillSwap = ( pMarine->GetASWWeapon( nSlot ) != NULL );
			}

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->WillSwap( [%s] )", pchParamName->String(), pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bWillSwap ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bWillSwap ) : ( bWillSwap );
		}

		case LESSON_ACTION_CAN_HACK:
		{
			C_ASW_Marine *pMarine = NULL;

			C_ASW_Player *pPlayer = dynamic_cast< C_ASW_Player* >( pVar );
			if ( pPlayer )
			{
				pMarine = dynamic_cast< C_ASW_Marine* >( pPlayer->GetMarine() );
			}

			if ( !pMarine )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->CanHack()", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Marine returned NULL!\n" );
				}

				return false;
			}

			bool bCanHack = pMarine->GetMarineProfile()->CanHack();

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->AllowedToPickup()", pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bCanHack ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bCanHack ) : ( bCanHack );
		}

		case LESSON_ACTION_CAN_OFFHAND:
		{
			C_ASW_Weapon *pWeapon = dynamic_cast< C_ASW_Weapon* >( pVar );
			if ( !pWeapon )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->CanOffhand()", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Weapon returned NULL!\n" );
				}

				return false;
			}

			bool bCanOffhand = pWeapon->GetWeaponInfo()->m_bOffhandActivate;

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->CanOffhand()", pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bCanOffhand ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bCanOffhand ) : ( bCanOffhand );
		}

		case LESSON_ACTION_HAS_SECONDARY:
		{
			C_ASW_Weapon *pWeapon = dynamic_cast< C_ASW_Weapon* >( pVar );
			if ( !pWeapon )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HasSecondary()", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Weapon returned NULL!\n" );
				}

				return false;
			}

			bool bHasSecondary = pWeapon->UsesSecondaryAmmo();

			if ( bHasSecondary )
			{
				bHasSecondary = !( ( pWeapon->UsesClipsForAmmo2() && pWeapon->m_iClip2 <= 0 ) ||
								   ( !pWeapon->UsesClipsForAmmo2() && pWeapon->GetOwner() && pWeapon->GetOwner()->GetAmmoCount( pWeapon->m_iSecondaryAmmoType ) <= 0 ) );
			}

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HasSecondary()", pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bHasSecondary ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bHasSecondary ) : ( bHasSecondary );
		}

		case LESSON_ACTION_HAS_SECONDARY_EXPLOSIVES:
		{
			C_ASW_Marine *pMarine = NULL;

			C_ASW_Player *pPlayer = dynamic_cast< C_ASW_Player* >( pVar );
			if ( pPlayer )
			{
				pMarine = dynamic_cast< C_ASW_Marine* >( pPlayer->GetMarine() );
			}

			if ( !pMarine )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HasAnySecondary()", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Marine returned NULL!\n" );
				}

				return false;
			}

			bool bHasAnySecondary = false;

			for ( int i = 0; i < ASW_MAX_EQUIP_SLOTS; ++i )
			{
				C_ASW_Weapon *pWeapon = static_cast< C_ASW_Weapon* >( pMarine->GetWeapon( i ) );
				if ( pWeapon && pWeapon->HasSecondaryExplosive() )
				{
					if ( !( ( pWeapon->UsesClipsForAmmo2() && pWeapon->m_iClip2 <= 0 ) || 
							( !pWeapon->UsesClipsForAmmo2() && pWeapon->GetOwner() && pWeapon->GetOwner()->GetAmmoCount( pWeapon->m_iSecondaryAmmoType ) <= 0 ) ) )
					{
						bHasAnySecondary = true;
						break;
					}
				}
			}

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HasAnySecondary()", pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bHasAnySecondary ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bHasAnySecondary ) : ( bHasAnySecondary );
		}

		case LESSON_ACTION_GET_MARINE:
		{
			int iTemp = static_cast<int>( fParam );

			if ( iTemp <= 0 || iTemp > 2 )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[entityINVALID] = [%s]->GetMarine()\n", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tParam selecting string is out of range!\n" );
				}

				return false;
			}

			CHandle<C_BaseEntity> *pHandle;

			char const *pchParamNameTemp = NULL;

			if ( iTemp == 2 )
			{
				pHandle = &m_hEntity2;
				pchParamNameTemp = "entity2";
			}
			else
			{
				pHandle = &m_hEntity1;
				pchParamNameTemp = "entity1";
			}

			C_ASW_Player *pPlayer = dynamic_cast< C_ASW_Player* >( pVar );
			if ( !pPlayer )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s] = [%s]->GetMarine()", pchParamNameTemp, pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "...\n" );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Player returned NULL!\n" );
				}

				return false;
			}

			C_ASW_Marine *pMarine = dynamic_cast< C_ASW_Marine* >( pPlayer->GetMarine() );

			pHandle->Set( pMarine );

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s] = [%s]->GetMarine()\n", pchParamNameTemp, pchVarName );
			}

			return true;
		}

		case LESSON_ACTION_IS_BOT:
		{
			C_ASW_Marine *pMarine = dynamic_cast< C_ASW_Marine* >( pVar );

			if ( !pMarine )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t![%s]->IsInhabited()", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Marine returned NULL!\n" );
				}

				return false;
			}

			bool bIsBot = !pMarine->IsInhabited();

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t![%s]->IsInhabited()", pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bIsBot ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bIsBot ) : ( bIsBot );
		}

		case LESSON_ACTION_WEAPON_HAS_SPARE:
		{
			C_ASW_Marine *pMarine = NULL;

			C_ASW_Player *pPlayer = dynamic_cast< C_ASW_Player* >( pVar );
			if ( pPlayer )
			{
				pMarine = dynamic_cast< C_ASW_Marine* >( pPlayer->GetMarine() );
			}

			if ( !pMarine )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HasSpareWeapon()", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Marine returned NULL!\n" );
				}

				return false;
			}

			int nOffensiveWeaponCount = 0;

			for ( int i = 0; i < ASW_MAX_EQUIP_SLOTS; ++i )
			{
				C_ASW_Weapon *pWeapon = static_cast< C_ASW_Weapon* >( pMarine->GetWeapon( i ) );
				if ( pWeapon && pWeapon->IsOffensiveWeapon() )
				{
					if ( !( ( pWeapon->UsesClipsForAmmo1() && pWeapon->m_iClip1 <= 0 ) || 
						 ( !pWeapon->UsesClipsForAmmo1() && pWeapon->GetOwner() && pWeapon->GetOwner()->GetAmmoCount( pWeapon->m_iPrimaryAmmoType ) <= 0 ) ) )
					{
						nOffensiveWeaponCount++;
					}
				}
			}

			bool bHasSpare = ( nOffensiveWeaponCount > 1 );

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->HasSpareWeapon()", pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bHasSpare ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bHasSpare ) : ( bHasSpare );
		}

		case LESSON_ACTION_WEAPON_IS_OFFENSIVE:
		{
			C_ASW_Marine *pMarine = NULL;

			C_ASW_Player *pPlayer = dynamic_cast< C_ASW_Player* >( pVar );
			if ( pPlayer )
			{
				pMarine = dynamic_cast< C_ASW_Marine* >( pPlayer->GetMarine() );
			}

			if ( !pMarine )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->WeaponIsOffensive()", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Marine returned NULL!\n" );
				}

				return false;
			}

			bool bIsOffensive = false;

			C_ASW_Weapon *pWeapon = pMarine->GetActiveASWWeapon();
			if ( pWeapon && pWeapon->IsOffensiveWeapon() )
			{
				if ( !( ( pWeapon->UsesClipsForAmmo1() && pWeapon->m_iClip1 <= 0 ) || 
					( !pWeapon->UsesClipsForAmmo1() && pWeapon->GetOwner() && pWeapon->GetOwner()->GetAmmoCount( pWeapon->m_iPrimaryAmmoType ) <= 0 ) ) )
				{
					bIsOffensive = true;
				}
			}

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->WeaponIsOffensive()", pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bIsOffensive ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bIsOffensive ) : ( bIsOffensive );
		}

		case LESSON_ACTION_WEAPON_LOCAL_HOTBAR_SLOT:
		{
			CASW_Hud_Master *pHUDMaster = GET_HUDELEMENT( CASW_Hud_Master );
			if ( pHUDMaster )
			{
				m_fOutput = pHUDMaster->GetHotBarSlot( pchParam );

				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\tm_fOutput = GET_HUDELEMENT( CASW_Hud_Squad_Hotbar )->GetHotBarSlot( [%s] ", pchParamName->String() );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "\"%s\"", pchParam );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ")\n" );
				}
			}

			return true;
		}

		case LESSON_ACTION_OWNS_HOTBAR_SLOT:
		{
			int iTemp = static_cast<int>( fParam );

			C_ASW_Player *pPlayer = dynamic_cast< C_ASW_Player* >( pVar );
			if ( !pPlayer )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\tGET_HUDELEMENT( CASW_Hud_Squad_Hotbar )->OwnsHotBarSlot( [%s] ", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "..." );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ", [%s] ", pchParamName->String() );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "\"%i\" ", iTemp );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ") " );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Player returned NULL!\n" );
				}

				return false;
			}

			bool bOwnsHotBarSlot = false;

			CASW_Hud_Master *pHUDMaster = GET_HUDELEMENT( CASW_Hud_Master );
			if ( pHUDMaster )
			{
				bOwnsHotBarSlot = pHUDMaster->OwnsHotBarSlot( pPlayer, iTemp );

				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\tGET_HUDELEMENT( CASW_Hud_Squad_Hotbar )->OwnsHotBarSlot( [%s], [%s] ", pchVarName, pchParamName->String() );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "\"%i\" ", iTemp );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ") " );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bOwnsHotBarSlot ? "true" : "false" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
				}
			}

			return ( bNot ) ? ( !bOwnsHotBarSlot ) : ( bOwnsHotBarSlot );
		}

		case LESSON_ACTION_SENTRY_WANTS_DISMANTLE:
		{
			C_ASW_Sentry_Base *pSentry = dynamic_cast< C_ASW_Sentry_Base* >( pVar );
			if ( !pSentry )
			{
				if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
				{
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->WantsDismantle()", pchVarName );
					ConColorMsg( CBaseLesson::m_rgbaVerboseName, "... " );
					ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
					ConColorMsg( CBaseLesson::m_rgbaVerboseClose, "\tVar handle as ASW_Sentry_Base returned NULL!\n" );
				}

				return false;
			}

			bool bWantsDismantle = pSentry->WantsDismantle();

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->WantsDismantle()", pchVarName );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bWantsDismantle ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bWantsDismantle ) : ( bWantsDismantle );
		}

		case LESSON_ACTION_IS_TUTORIAL:
		{
			bool bIsTutorial = ASWGameRules()->IsTutorialMap();

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\tASWGameRules()->IsTutorialMap()" );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bIsTutorial ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bIsTutorial ) : ( bIsTutorial );
		}

		case LESSON_ACTION_IS_SINGLEPLAYER:
		{
			bool bIsSingleplayer = ASWGameRules()->IsOfflineGame();

			if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
			{
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\tASWGameRules()->IsOfflineGame()" );
				ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%s ", ( bIsSingleplayer ? "true" : "false" ) );
				ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( "== false\n" ) : ( "== true\n" ) );
			}

			return ( bNot ) ? ( !bIsSingleplayer ) : ( bIsSingleplayer );
		}

		default:
			// Didn't handle this action
			bModHandled = false;
			break;
	}

	return false;
}
void CASWHudCrosshair::PaintReloadProgressBar( void )
{
	if ( !engine->IsActiveApp() )
	{
		m_pAmmoProgress->SetVisible( false );
		m_pFastReloadBar->SetVisible( false );
		return;
	}

	C_ASW_Player* pPlayer = C_ASW_Player::GetLocalASWPlayer();
	if ( !pPlayer )
		return;

	C_ASW_Marine* pMarine = pPlayer->GetMarine();
	if ( !pMarine )
		return;

	C_ASW_Weapon* pWeapon = pMarine->GetActiveASWWeapon();
	if ( !pWeapon || !asw_crosshair_use_perspective.GetBool() )
	{
		m_pAmmoProgress->SetVisible( false );
		m_pFastReloadBar->SetVisible( false );
		return;
	}

	int x, y;
	GetCurrentPos( x, y );
	int nCrosshair = GetCurrentCrosshair( x, y );

	if ( pWeapon && pWeapon->IsReloading() )
	{	
		m_bIsReloading = true;

		float flProgress = 0.0;

		float fStart = pWeapon->m_fReloadStart;
		float fNext = pWeapon->m_flNextPrimaryAttack;
		float fTotalTime = fNext - fStart;
		if (fTotalTime <= 0)
			fTotalTime = 0.1f;

		// if we're in single player, the progress code in the weapon doesn't run on the client because we aren't predicting
		if ( !cl_predict->GetInt() )
			flProgress = RescaleProgessForArt( (gpGlobals->curtime - fStart) / fTotalTime );
		else
			flProgress = RescaleProgessForArt( pWeapon->m_fReloadProgress );

		if ((int(gpGlobals->curtime*10) % 2) == 0)
			m_pAmmoProgress->SetFgColor( Color( 215, 205, 80, 255) );
		else
			m_pAmmoProgress->SetFgColor( Color( 175, 80, 80, 255) );

		if ( asw_fast_reload_enabled.GetBool() )
		{
			m_pFastReloadBar->SetFgColor( Color( 235, 235, 235, 100) );
			m_pFastReloadBar->SetBgColor( Color( 0, 0, 0, 0 ) );
			// fractions of ammo wide for fast reload start/end
			float fFastStart = RescaleProgessForArt( (pWeapon->m_fFastReloadStart - fStart) / fTotalTime );
			float fFastEnd = RescaleProgessForArt( (pWeapon->m_fFastReloadEnd - fStart) / fTotalTime );
			m_pFastReloadBar->SetStartProgress( fFastStart );
			m_pFastReloadBar->SetProgress( fFastEnd );
			m_pFastReloadBar->SetVisible( true );
		}

		m_pAmmoProgress->SetProgress( flProgress );
		m_pAmmoProgress->SetAlpha( 255 );
		m_pAmmoProgress->SetBgColor( Color( 100, 100, 100, 160*m_pAmmoProgress->GetScale() ) );
		m_pAmmoProgress->SetVisible( true );
	}
	/*else if ( m_bIsReloading )
	{
		m_bIsReloading = false;
		m_pAmmoProgress->SetFgColor( Color( 200, 200, 200, 255 ) );
		m_pAmmoProgress->SetProgress( 1.0 );
		vgui::GetAnimationController()->RunAnimationCommand( m_pAmmoProgress, "alpha",	0,		0, 0.5f, vgui::AnimationController::INTERPOLATOR_ACCEL );
	}
	*/
	else
	{
		float flScale = m_pAmmoProgress->GetScale();
		m_bIsReloading = false;
		m_pAmmoProgress->SetFgColor( Color( 220, 220, 220, 140*flScale ) );
		m_pFastReloadBar->SetVisible( false );

		int	nClip1 = pWeapon->Clip1();
		if ( nClip1 < 0 )
		{
			m_pAmmoProgress->SetVisible( false );
			return;
		}

		float flProgress = RescaleProgessForArt( float(nClip1) / float(pWeapon->GetMaxClip1()) ); 

		m_pAmmoProgress->SetProgress( flProgress );
		if ( flProgress < 0.25 && (int(gpGlobals->curtime*10) % 2) == 0 )
		{
			m_pAmmoProgress->SetBgColor( Color( 130, 90, 50, 160*flScale ) );
		}
		else
		{
			m_pAmmoProgress->SetBgColor( Color( 80, 80, 80, 130*flScale ) );
		}

		m_pAmmoProgress->SetVisible( !pPlayer->IsSniperScopeActive() && nCrosshair == m_nCrosshairTexture );
	}
};