void CASWHud3DMarineNames::PaintBoxesAroundUseEntities() { C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer(); if ( !pPlayer || !pPlayer->GetMarine() || pPlayer->GetMarine()->GetHealth() <= 0 ) return; C_BaseEntity *pEnt = NULL; if ( pPlayer->GetNumUseEntities() > 0 ) { pEnt = pPlayer->GetUseEntity(); if ( !pEnt ) { pEnt = pPlayer->GetUseEntity( 0 ); } IASW_Client_Usable_Entity* pUsable = dynamic_cast< IASW_Client_Usable_Entity* >( pEnt ); if ( !pUsable || !pUsable->ShouldPaintBoxAround() ) { pEnt = NULL; } } if ( pEnt ) { C_ASW_Use_Area *pArea = dynamic_cast< C_ASW_Use_Area* >( pEnt ); if ( pArea ) { if ( pArea->GetGlowEntity() ) { ASWInput()->SetUseGlowEntity( pArea->GetGlowEntity() ); } else { PaintBoxAround( pEnt, 6 ); } } else { ASWInput()->SetUseGlowEntity( pEnt ); } } else { ASWInput()->SetUseGlowEntity( NULL ); } }
bool CNB_Horiz_List::MouseOverScrollbar( void ) const { int nMouseX, nMouseY; ASWInput()->GetFullscreenMousePos( &nMouseX, &nMouseY ); m_pHorizScrollBar->ScreenToLocal( nMouseX, nMouseY ); return ( nMouseX > 0 && nMouseX < m_pHorizScrollBar->GetWide() && nMouseY > 0 && nMouseY < m_pHorizScrollBar->GetTall() ); }
void C_ASW_Hack_Wire_Tile::FrameDeleted(vgui::Panel *pPanel) { if (pPanel == m_hFrame.Get()) { m_hFrame = NULL; } ASWInput()->SetCameraFixed( false ); }
void CASWHud3DMarineNames::Paint() { VPROF_BUDGET( "CASWHud3DMarineNames::Paint", VPROF_BUDGETGROUP_ASW_CLIENT ); BaseClass::Paint(); //PaintFontTest(); MDLCACHE_CRITICAL_SECTION(); PaintMarineNameLabels(); PaintBoxesAroundUseEntities(); C_ASW_Player* pPlayer = C_ASW_Player::GetLocalASWPlayer(); if (pPlayer) { /* // check for drawing autoaim crosshair if (pPlayer->m_ASWLocal.m_hAutoAimTarget.Get() && pPlayer->GetMarine()) { C_ASW_Marine *pMarine = pPlayer->GetMarine(); C_ASW_Marine_Resource *pMR = pMarine->GetMarineResource(); if (pMR && pMR->IsFiring()) { C_ASW_Weapon *pWeapon = pMarine->GetActiveASWWeapon(); if (pWeapon->IsOffensiveWeapon()) PaintAutoaimCrosshairOn(pPlayer->m_ASWLocal.m_hAutoAimTarget.Get()); } } */ if (pPlayer->GetHighlightEntity()) { PaintBoxAround(pPlayer->GetHighlightEntity(), 6); } } if ( ASWInput() && ASWInput()->GetAutoaimEntity() ) { PaintAutoaimCrosshairOn( ASWInput()->GetAutoaimEntity() ); } PaintTrackedHealth(); if ( asw_DebugAutoAim.GetBool() ) { PaintAimingDebug(); } }
C_ASW_Hack_Wire_Tile::~C_ASW_Hack_Wire_Tile() { if (m_hFrame.Get()) { if (m_hFrame->m_pNotifyHackOnClose == this) m_hFrame->m_pNotifyHackOnClose = NULL; } ASWInput()->SetCameraFixed( false ); }
//----------------------------------------------------------------------------- // Purpose: ApplyMouse -- applies mouse deltas to CUserCmd // Input : viewangles - // *cmd - // mouse_x - // mouse_y - //----------------------------------------------------------------------------- void CASWInput::ApplyMouse( int nSlot, QAngle& viewangles, CUserCmd *cmd, float mouse_x, float mouse_y ) { int current_posx, current_posy; GetMousePos(current_posx, current_posy); if ( ASWInput()->ControllerModeActive() ) return; if ( asw_controls.GetBool() && !MarineControllingTurret() ) { TurnTowardMouse( viewangles, cmd ); // Re-center the mouse. // force the mouse to the center, so there's room to move ResetMouse(); SetMousePos( current_posx, current_posy ); // asw - swarm wants it unmoved (have to reset to stop buttons locking) } else { if ( MarineControllingTurret() ) { // accelerate up the mouse intertia static float mouse_x_accumulated = 0; static float mouse_y_accumulated = 0; // decay it mouse_x_accumulated *= 0.95f; mouse_y_accumulated *= 0.95f; mouse_x_accumulated += mouse_x * 0.04f; mouse_y_accumulated += mouse_y * 0.04f; // clamp it mouse_x_accumulated = clamp(mouse_x_accumulated, -500.0f,500.0f); mouse_y_accumulated = clamp(mouse_y_accumulated, -500.0f,500.0f); // move with our inertia style mouse_x = mouse_x_accumulated; mouse_y = mouse_y_accumulated; } if ( ( !ASWGameRules() || ASWGameRules()->GetMarineDeathCamInterp() <= 0.0f ) && ( !C_ASW_Marine::GetLocalMarine() || !C_ASW_Marine::GetLocalMarine()->IsUsingComputerOrButtonPanel() ) ) CInput::ApplyMouse( nSlot, viewangles, cmd, mouse_x, mouse_y ); // force the mouse to the center, so there's room to move ResetMouse(); } }
// if the player has his mouse over another marine, highlight it, cos he's the one we can give health to void CASW_Weapon_Medical_Satchel::MouseOverEntity(C_BaseEntity *pEnt, Vector vecWorldCursor) { C_ASW_Marine* pOtherMarine = C_ASW_Marine::AsMarine( pEnt ); CASW_Player *pOwner = GetCommander(); CASW_Marine *pMarine = GetMarine(); if (!pOwner || !pMarine) return; float fOtherHealth = 1.0f; if (pOtherMarine && pOtherMarine->GetMarineResource()) fOtherHealth = pOtherMarine->GetMarineResource()->GetHealthPercent(); if (!pOtherMarine) { C_ASW_Game_Resource *pGameResource = ASWGameResource(); if (pGameResource) { // find marine closest to world cursor const float fMustBeThisClose = 70; const C_ASW_Game_Resource::CMarineToCrosshairInfo::tuple_t &info = pGameResource->GetMarineCrosshairCache()->GetClosestMarine(); if ( info.m_fDistToCursor <= fMustBeThisClose ) { pOtherMarine = info.m_hMarine.Get(); } } } // if the marine our cursor is over is near enough, highlight him if (pOtherMarine) { float dist = (pMarine->GetAbsOrigin() - pOtherMarine->GetAbsOrigin()).Length2D(); if (dist < MAX_HEAL_DISTANCE) { bool bCanGiveHealth = ( fOtherHealth < 1.0f && m_iClip1 > 0 ); ASWInput()->SetHighlightEntity( pOtherMarine, bCanGiveHealth ); if ( bCanGiveHealth ) // if he needs healing, show the give health cursor { CASWHudCrosshair *pCrosshair = GET_HUDELEMENT( CASWHudCrosshair ); if ( pCrosshair ) { pCrosshair->SetShowGiveHealth(true); } } } } }
//----------------------------------------------------------------------------- // Purpose: ApplyMouse -- applies mouse deltas to CUserCmd // Input : viewangles - // *cmd - // mouse_x - // mouse_y - //----------------------------------------------------------------------------- void CASWInput::ApplyMouse( int nSlot, QAngle& viewangles, CUserCmd *cmd, float mouse_x, float mouse_y ) { int current_posx, current_posy; GetMousePos(current_posx, current_posy); if ( ASWInput()->ControllerModeActive() ) return; //by price if (MarineDidPrice() || !asw_controls.GetBool()) { TurnTowardMouse( viewangles, cmd ); // force the mouse to the center, so there's room to move ResetMouse(); SetMousePos( current_posx, current_posy ); // asw - swarm wants it unmoved (have to reset to stop buttons locking) } CInput::ApplyMouse( nSlot, viewangles, cmd, mouse_x, mouse_y ); // force the mouse to the center, so there's room to move ResetMouse(); }
CASW_VGUI_Info_Message::~CASW_VGUI_Info_Message() { if (GetControllerFocus()) { GetControllerFocus()->RemoveFromFocusList(m_pOkayButton); if (m_pLogButton) GetControllerFocus()->RemoveFromFocusList(m_pLogButton); } g_asw_iGUIWindowsOpen--; if (g_hCurrentInfoPanel.Get() == this) g_hCurrentInfoPanel = NULL; NotifyServerOfClose(); if ( !asw_info_sound_continue.GetBool() ) { StopInfoMessageSound(); } ASWInput()->SetCameraFixed( false ); }
void C_ASW_Ammo_Drop::ClientThink() { bool bShouldGlow = false; float flDistanceToMarineSqr = 0.0f; float flWithinDistSqr = (ASW_MARINE_USE_RADIUS*4)*(ASW_MARINE_USE_RADIUS*4); C_ASW_Player *pLocalPlayer = C_ASW_Player::GetLocalASWPlayer(); if ( pLocalPlayer && pLocalPlayer->GetMarine() && ASWInput()->GetUseGlowEntity() != this && AllowedToPickup( pLocalPlayer->GetMarine() ) ) { flDistanceToMarineSqr = (pLocalPlayer->GetMarine()->GetAbsOrigin() - WorldSpaceCenter()).LengthSqr(); if ( flDistanceToMarineSqr < flWithinDistSqr ) bShouldGlow = true; } m_GlowObject.SetRenderFlags( false, bShouldGlow ); if ( m_GlowObject.IsRendering() ) { m_GlowObject.SetAlpha( MIN( 0.7f, (1.0f - (flDistanceToMarineSqr / flWithinDistSqr)) * 1.0f) ); } }
/// @TODO can use a more optimal sorting strategy void C_ASW_Game_Resource::CMarineToCrosshairInfo::RecomputeCache() { VPROF("C_ASW_Game_Resource::CMarineToCrosshairInfo::RecomputeCache()"); C_ASW_Game_Resource * RESTRICT pGameResource = ASWGameResource(); // purge the array. m_tMarines.RemoveAll(); const Vector vecCrosshairAimingPos = ASWInput()->GetCrosshairAimingPos(); for ( int i=0; i<pGameResource->GetMaxMarineResources(); i++ ) { C_ASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i); C_ASW_Marine *pMarine; if ( pMR && (pMarine = pMR->GetMarineEntity()) ) { float dist = (vecCrosshairAimingPos - pMR->GetMarineEntity()->GetAbsOrigin()).Length2D(); m_tMarines.AddToTail( tuple_t(pMarine, dist) ); } } m_tMarines.Sort( &MarineTupleComparator ); m_iLastFrameCached = gpGlobals->framecount; }
void CASW_VGUI_Door_Tooltip::OnThink() { MDLCACHE_CRITICAL_SECTION(); C_ASW_Player* pPlayer = C_ASW_Player::GetLocalASWPlayer(); if ( pPlayer && m_bShowDoorUnderCursor ) { C_ASW_Door* pDoorUnderCursor = C_ASW_Door::GetDoorNear( ASWInput()->GetCrosshairAimingPos() ); if (pDoorUnderCursor && pDoorUnderCursor->IsOpen()) // don't show open doors pDoorUnderCursor = NULL; SetDoor(pDoorUnderCursor); } // fade in/out as the door changes if (m_bQueuedDoor) { if (GetAlpha() <= 0) { m_hDoor = m_hQueuedDoor; m_hQueuedDoor = NULL; m_bQueuedDoor = false; m_bDoingSlowFade = false; m_fNextUpdateTime = gpGlobals->curtime; if (GetDoor()) vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 200, 0, ASW_HEALTH_REPORT_FADE_TIME, vgui::AnimationController::INTERPOLATOR_LINEAR); } else if (GetAlpha() >= 200) { if (m_hQueuedDoor.Get() == NULL) { if (!m_bDoingSlowFade) { m_bDoingSlowFade = true; float delay = 0; // 1.5f vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 0, delay, ASW_HEALTH_REPORT_FADE_TIME * 3, vgui::AnimationController::INTERPOLATOR_LINEAR); } } else { vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 0, 0, ASW_HEALTH_REPORT_FADE_TIME, vgui::AnimationController::INTERPOLATOR_LINEAR); m_bDoingSlowFade = false; } } // if we're doing a slow fade out but the player has now mouse overed another door, do the fade quickly if (m_bDoingSlowFade && m_hQueuedDoor.Get() != NULL) { vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 0, 0, ASW_HEALTH_REPORT_FADE_TIME, vgui::AnimationController::INTERPOLATOR_LINEAR); m_bDoingSlowFade = false; } } // check for updating health C_ASW_Door* pDoor = GetDoor(); if (gpGlobals->curtime >= m_fNextUpdateTime && pDoor) { // set the health label accordingly int health = pDoor->GetHealth(); if (health != m_iOldDoorHealth) { m_iOldDoorHealth = health; m_fDoorHealthFraction = pDoor->GetHealthFraction(m_iDoorType); } m_fNextUpdateTime = gpGlobals->curtime + 0.05f; } // reposition if (pDoor) { int mx, my, iDoorType; if ( pDoor->IsAlive() && pDoor->GetHealthFraction(iDoorType) < 1.0f && !pDoor->IsOpen() && !pDoor->IsDormant() && GetDoorHealthBarPosition( pDoor, mx, my ) ) { mx = clamp(mx, 0, ScreenWidth() - GetWide()); my = clamp(my, 0, ScreenHeight() - GetTall()); SetPos(mx, my); } else { SetDoor( NULL ); return; } } }
void CNB_Horiz_List::OnThink() { BaseClass::OnThink(); if ( MouseOverScrollbar() ) { // No slidy auto scroll while using the scrollbar m_fScrollVelocity = 0.0f; m_fScrollChange = 0.0f; } else { int nMouseX, nMouseY; ASWInput()->GetFullscreenMousePos( &nMouseX, &nMouseY ); ScreenToLocal( nMouseX, nMouseY ); float fVelocityMax = 1200.0f; const float fAccelerationMax = 3000.0f; float fScrollAcceleration = 0.0f; if ( nMouseX > 0 && nMouseX < GetWide() && nMouseY > 0 && nMouseY < GetTall() ) { const float fDeadZoneSize = 0.55f; float fMouseXInterp = static_cast<float>( nMouseX ) / GetWide(); if ( fMouseXInterp > 0.5f + fDeadZoneSize * 0.5f ) { fMouseXInterp = 0.25f + ( fMouseXInterp - ( 0.5f + fDeadZoneSize * 0.5f ) ) / ( ( 1.0f - fDeadZoneSize ) * 0.666666666f ); } else if ( fMouseXInterp < 0.5f - fDeadZoneSize * 0.5f ) { fMouseXInterp = -0.25f - ( ( 0.5f - fDeadZoneSize * 0.5f ) - fMouseXInterp ) / ( ( 1.0f - fDeadZoneSize ) * 0.666666666f ); } else { fMouseXInterp = 0.0f; } fScrollAcceleration = fMouseXInterp * fAccelerationMax; fVelocityMax *= fabsf( fMouseXInterp ); } if ( fScrollAcceleration == 0.0f ) { // Dampen velocity in the dead zone m_fScrollVelocity = Approach( 0.0f, m_fScrollVelocity, gpGlobals->frametime * fAccelerationMax * 0.75f ); } else { // Apply acceleration to the velocity m_fScrollVelocity = clamp( m_fScrollVelocity + fScrollAcceleration * gpGlobals->frametime, -fVelocityMax, fVelocityMax ); } // Accumulate into a float for smaller than 1 changes m_fScrollChange += m_fScrollVelocity * gpGlobals->frametime; // Apply the integer amount int nScrollChange = m_fScrollChange; if ( nScrollChange <= -1 || nScrollChange >= 1 ) { bool bChanged = ChangeScrollValue( nScrollChange ); if ( bChanged ) { m_fScrollChange -= nScrollChange; } else { // Hit the end m_fScrollVelocity = 0.0f; m_fScrollChange = 0.0f; } } } if ( m_bHighlightOnMouseOver ) { for ( int i = 0; i < m_Entries.Count(); i++ ) { if ( m_Entries[i]->IsCursorOver() ) { SetHighlight( i ); break; } } } vgui::Panel *pHighlighted = GetHighlightedEntry(); if ( !pHighlighted ) return; int x, y; pHighlighted->GetPos( x, y ); m_flContainerTargetPos = YRES( 154 ) - x; if ( m_bInitialPlacement ) { m_bInitialPlacement = false; m_flContainerPos = m_flContainerTargetPos; } else { if ( m_flContainerPos < m_flContainerTargetPos ) { m_flContainerPos = MIN( m_flContainerPos + gpGlobals->frametime * SCROLL_SPEED, m_flContainerTargetPos ); } else if ( m_flContainerPos > m_flContainerTargetPos ) { m_flContainerPos = MAX( m_flContainerPos - gpGlobals->frametime * SCROLL_SPEED, m_flContainerTargetPos ); } } //Msg( "m_flContainerPos = %f target = %f\n", m_flContainerPos, m_flContainerTargetPos ); if ( !m_bShowScrollBar ) { m_pChildContainer->SetPos( m_flContainerPos, 0 ); } m_pLeftArrowButton->SetEnabled( m_nHighlightedEntry > 0 ); m_pRightArrowButton->SetEnabled( m_nHighlightedEntry < m_Entries.Count() - 1 ); }
void __MsgFunc_ASWBroadcastCamEnd( bf_read &msg ) { ASWInput()->CAM_ToThirdPerson(); }
void __MsgFunc_ASWBroadcastCamStart( bf_read &msg ) { ASWInput()->CAM_ToFirstPerson(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CASWInput::ASW_GetCameraLocation( C_ASW_Player *pPlayer, Vector &vecCameraLocation, QAngle &angCamera, int &nMouseX, int &nMouseY, bool bApplySmoothing ) { // Verify data. Assert( pPlayer != NULL ); if ( !pPlayer ) return; Assert( ASWInput() != NULL ); if ( !ASWInput() ) return; // If we've already calculated the camera position on this frame, then just return the previous result. // if ( pPlayer->m_nLastCameraFrame == gpGlobals->framecount ) // { // vecCameraLocation = pPlayer->m_vecLastCameraPosition; // angCamera = pPlayer->m_angLastCamera; // return; // } // Get the current camera position. vecCameraLocation = pPlayer->EyePosition(); // Get the camera angles and calculate the camera view directions. Vector vecCameraDirection; ::input->CAM_GetCameraOffset( vecCameraDirection ); angCamera[PITCH] = vecCameraDirection[PITCH]; angCamera[YAW] = vecCameraDirection[YAW]; angCamera[ROLL] = 0; Vector vecCamForward, vecCamRight, vecCamUp; AngleVectors( angCamera, &vecCamForward, &vecCamRight, &vecCamUp ); // Get the window center. int nCenterX, nCenterY; ASWInput()->ASW_GetWindowCenter( nCenterX, nCenterY ); // Get the position change. int nUnclampedX, nUnclampedY; ASWInput()->GetSimulatedFullscreenMousePos( &nMouseX, &nMouseY, &nUnclampedX, &nUnclampedY ); // Calculate the movement delta - only needed for mouse control or controller with pan enabled. int nDeltaX = 0; int nDeltaY = 0; if ( !ASWInput()->ControllerModeActive() || joy_pan_camera.GetBool() ) { nDeltaX = nMouseX - nCenterX; nDeltaY = nMouseY - nCenterY; // Calculate the camera shift and move the camera. float flShiftX, flShiftY; CalculateCameraShift( pPlayer, (float) nDeltaX / ( nCenterX * 2.0f ), (float) nDeltaY / ( nCenterY * 2.0f ), flShiftX, flShiftY ); VectorMA( vecCameraLocation, flShiftX, vecCamRight, vecCameraLocation ); vecCamUp.z = 0; // don't want the camera changing z vecCamUp.NormalizeInPlace(); VectorMA( vecCameraLocation, -flShiftY, vecCamUp, vecCameraLocation ); } bool bDeathcam = ASWGameRules() && ( ASWGameRules()->GetMarineDeathCamInterp() > 0.0f ); // Smooth the camera movement. if ( bApplySmoothing && !bDeathcam ) { SmoothCamera( pPlayer, vecCameraLocation ); pPlayer->m_vecLastCameraPosition = vecCameraLocation; } // Update the player camera data. pPlayer->m_nLastCameraFrame = gpGlobals->framecount; pPlayer->m_angLastCamera = angCamera; // Do we still need this??? pPlayer->m_hLastMarine = pPlayer->GetMarine(); }
CASW_VGUI_Info_Message::CASW_VGUI_Info_Message( vgui::Panel *pParent, const char *pElementName, C_ASW_Info_Message* pMessage ) : vgui::Panel( pParent, pElementName ), CASW_VGUI_Ingame_Panel() { //input->MouseEvent(0, false); // unclick all our mouse buttons when this panel pops up (so firing doesn't get stuck on) if (g_hCurrentInfoPanel.Get()) { g_hCurrentInfoPanel->MarkForDeletion(); g_hCurrentInfoPanel->SetVisible(false); } g_hCurrentInfoPanel = this; m_hMessage = pMessage; for (int i=0;i<4;i++) { m_pLine[i] = new vgui::WrappedLabel(this, "InfoMessageLabel", ""); m_pLine[i]->SetContentAlignment(vgui::Label::a_northwest); m_pLine[i]->SetMouseInputEnabled(false); } m_pOkayButton = new ImageButton(this, "OkayButton", "#asw_close"); m_pOkayButton->AddActionSignalTarget(this); KeyValues *msg = new KeyValues("Command"); msg->SetString("command", "OkayButton"); m_pOkayButton->SetCommand(msg); m_pMessageImage = new vgui::ImagePanel(this, "MessageImage"); m_pMessageImage->SetVisible(false); m_pMessageImage->SetShouldScaleImage(true); m_szImageName[0] = '\0'; if (ShouldAddLogButton()) { m_pLogButton = new ImageButton(this, "LogButton", "#asw_message_log"); m_pLogButton->AddActionSignalTarget(this); KeyValues *msg = new KeyValues("Command"); msg->SetString("command", "MessageLog"); m_pLogButton->SetCommand(msg); } else { Msg(" so not adding it\n"); m_pLogButton = NULL; } // find use key bind char lkeybuffer[12]; Q_snprintf(lkeybuffer, sizeof(lkeybuffer), "%s", ASW_FindKeyBoundTo("+use")); Q_strupr(lkeybuffer); // copy the found key into wchar_t format (localize it if it's a token rather than a normal keyname) wchar_t keybuffer[24]; if (lkeybuffer[0] == '#') { const wchar_t *pLocal = g_pVGuiLocalize->Find(lkeybuffer); if (pLocal) wcsncpy(keybuffer, pLocal, 24); else g_pVGuiLocalize->ConvertANSIToUnicode(lkeybuffer, keybuffer, sizeof(keybuffer)); } else g_pVGuiLocalize->ConvertANSIToUnicode(lkeybuffer, keybuffer, sizeof(keybuffer)); // look up close text localised const wchar_t *pLocal = g_pVGuiLocalize->Find("#asw_close"); if (pLocal) { // join use key and close text together wchar_t buffer[ 256 ]; g_pVGuiLocalize->ConstructString( buffer, sizeof(buffer), g_pVGuiLocalize->Find("#asw_use_icon_format"), 2, keybuffer, pLocal ); // set label m_pOkayButton->SetText(buffer); } if (GetControllerFocus()) { GetControllerFocus()->AddToFocusList(m_pOkayButton); GetControllerFocus()->SetFocusPanel(m_pOkayButton); if (m_pLogButton) { GetControllerFocus()->AddToFocusList(m_pLogButton); } } m_bClosingMessage = false; CLocalPlayerFilter filter; // check for a special sound in the info message const char *pszSound = pMessage ? pMessage->GetSound() : NULL; if (pszSound && Q_strlen(pszSound) > 0) { StopInfoMessageSound(); EmitSound_t ep; ep.m_pSoundName = pszSound; ep.m_flVolume = 1.0f; ep.m_nPitch = PITCH_NORM; ep.m_SoundLevel = SNDLVL_NONE; ep.m_nChannel = CHAN_STATIC; C_BaseEntity::EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, ep ); g_LastInfoSoundGUID = enginesound->GetGuidForLastSoundEmitted(); } UpdateMessage(); SetAlpha(0); vgui::GetAnimationController()->RunAnimationCommand(this, "Alpha", 255, 0.0f, 0.3f, vgui::AnimationController::INTERPOLATOR_LINEAR); SetKeyBoardInputEnabled(true); SetMouseInputEnabled(true); RequestFocus(); ASWInput()->SetCameraFixed( true ); g_asw_iGUIWindowsOpen++; }
void C_ASW_Hack_Wire_Tile::ClientThink() { HACK_GETLOCALPLAYER_GUARD( "Need to support launching multiple hack panels on one machine (1 for each splitscreen player) for this to make sense." ); if (m_bLaunchedHackPanel) // if we've launched our hack window, but the hack has lost its hacking marine, then close our window down { bool bStillUsing = true; if (!GetHackerMarineResource()) bStillUsing = false; if (!bStillUsing) { //Msg("wire hack has lost his hacking marine\n"); m_bLaunchedHackPanel = false; if (m_hFrame.Get()) { m_hFrame->SetVisible(false); m_hFrame->MarkForDeletion(); m_hFrame = NULL; ASWInput()->SetCameraFixed( false ); } } } // if we haven't launched the window and data is all present, launch it if (!m_bLaunchedHackPanel && m_iNumWires > 0 && GetHackerMarineResource() != NULL) { vgui::HScheme scheme = vgui::scheme()->LoadSchemeFromFile("resource/SwarmSchemeNew.res", "SwarmSchemeNew"); m_hFrame = new CASW_VGUI_Hack_Wire_Tile_Container( GetClientMode()->GetViewport(), "WireTileContainer", this); m_hFrame->SetScheme(scheme); CASW_VGUI_Hack_Wire_Tile* pHackWireFrame = new CASW_VGUI_Hack_Wire_Tile( m_hFrame.Get(), "HackWireTile", this ); pHackWireFrame->SetScheme(scheme); pHackWireFrame->ASWInit(); pHackWireFrame->MoveToFront(); pHackWireFrame->RequestFocus(); pHackWireFrame->SetVisible(true); pHackWireFrame->SetEnabled(true); m_bLaunchedHackPanel = true; } // check for hiding the panel if the player has a different marine selected, or if the selected marine is remote controlling a turret if (m_bLaunchedHackPanel && GetHackerMarineResource() && m_hFrame.Get()) { C_ASW_Player *pPlayer = C_ASW_Player::GetLocalASWPlayer(); if (!pPlayer) { m_hFrame->SetVisible(false); } else { bool bLocalPlayerControllingHacker = (GetHackerMarineResource()->IsInhabited() && GetHackerMarineResource()->GetCommanderIndex() == pPlayer->entindex()); bool bMarineControllingTurret = (GetHackerMarineResource()->GetMarineEntity() && GetHackerMarineResource()->GetMarineEntity()->IsControllingTurret()); if (bLocalPlayerControllingHacker && !bMarineControllingTurret) { ASWInput()->SetCameraFixed( true ); m_hFrame->SetVisible(true); if (gpGlobals->curtime > m_fNextLockCycleTime) { m_fNextLockCycleTime = gpGlobals->curtime + asw_hack_cycle_time.GetFloat(); CycleRows(); } } else { ASWInput()->SetCameraFixed( false ); m_hFrame->SetVisible(false); } } } }